commit c08ff876f742249d91a9e65b342eb9a47a176815 Author: vincent Date: Mon Aug 17 15:41:27 2026 +0000 deploy: f6ac0722e9ff1d752f4987142bffa352be810e4d diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/index.html b/index.html new file mode 100644 index 0000000..b56e465 --- /dev/null +++ b/index.html @@ -0,0 +1,1275 @@ + + + + + + Recettes - Cook + + + + + + + + + + + +
+ + +
+ +
+ + +
+

+ Toutes les Recettes +

+ +
+ + + + + + + +
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/recipe/cuisses_poulet_four.cook b/recipe/cuisses_poulet_four.cook new file mode 100644 index 0000000..af5fbda --- /dev/null +++ b/recipe/cuisses_poulet_four.cook @@ -0,0 +1,33 @@ +--- +title: Cuisses de poulet au four (cuisson lente) +description: Peau croustillante, chair qui se détache toute seule. Cuisson lente, non supervisée. +servings: 4 +prep time: 5 minutes +cook time: 2 hours +course: plat +locale: fr +tags: + - batch + - four + - poulet +--- + +Préchauffer le #four{} à 150°C. + +Poser les @cuisses de poulet entières{4} dans un #plat à four{}, peau sur le dessus, sans qu'elles se touchent (serrées = peau à la vapeur). + +Arroser d'@huile d'olive{} et masser, puis @sel{} et @poivre{} généreux et les @épices{}(piment d'Espelette, cumin, paprika, coriandre, origan…). + +Enfourner ~{2%heures} minimum. Ni retourner, ni arroser, ni couvrir, ni liquide dans le plat. + +La chair doit se détacher de l'os et la peau être dorée. Sinon ~{5%minutes} sous le gril. + +== Notes == + +> 2 h 30 – 3 h sans problème, ça cale avec les 2 h de mijotage de la ratatouille. + +> Garder la graisse du plat pour faire revenir des légumes ou des patates plus tard. + +> Combos : cumin + coriandre + paprika · paprika fumé + origan · Espelette seul. + +> 3-4 jours au frigo, se réchauffe bien. diff --git a/recipe/cuisses_poulet_four.html b/recipe/cuisses_poulet_four.html new file mode 100644 index 0000000..f852a8e --- /dev/null +++ b/recipe/cuisses_poulet_four.html @@ -0,0 +1,1351 @@ + + + + + + Cuisses de poulet au four (cuisson lente) - Cook + + + + + + + + + + + +
+ + +
+ + + +
+ + +
+ + + + + +
+

+ Cuisses de poulet au four (cuisson lente) +

+ +
+ + + + + + + + + + +
+
+ + +
+ + +
+ + #batch + + #four + + #poulet + +
+ + + + + + +
+

Peau croustillante, chair qui se détache toute seule. Cuisson lente, non supervisée.

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ +
+
+
+

🥘 Ingrédients

+ + + + + + + + + +
    + +
  • +
    + + cuisses de poulet entières + + + +
    + + 4 + + +
  • + +
  • +
    + + huile d'olive + + + +
    + + + + +
  • + +
  • +
    + + poivre + + + +
    + + + + +
  • + +
  • +
    + + sel + + + +
    + + + + +
  • + +
  • +
    + + épices + + + (piment d'Espelette, cumin, paprika, coriandre, origan…) + +
    + + + + +
  • + +
+ + + + + + + +

🍳 Ustensiles

+
    + +
  • + four +
  • + +
  • + plat à four +
  • + +
+ +
+
+ +
+
+ + + + +
    + + +
  1. +
    + + +
    +
    1
    +
    +
    + + Préchauffer le + four + à 150°C. +
    + +
    +
    +
    +
  2. + + + +
  3. +
    + + +
    +
    2
    +
    +
    + + Poser les + cuisses de poulet entières + dans un + plat à four + , peau sur le dessus, sans qu'elles se touchent (serrées = peau à la vapeur). +
    + +
    + + + cuisses de poulet entières: 4 + + +
    + +
    +
    +
    +
  4. + + + +
  5. +
    + + +
    +
    3
    +
    +
    + + Arroser d' + huile d'olive + et masser, puis + sel + et + poivre + généreux et les + épices + . +
    + +
    + + + huile d'olive, + + + + sel, + + + + poivre, + + + + épices (piment d'Espelette, cumin, paprika, coriandre, origan…) + + +
    + +
    +
    +
    +
  6. + + + +
  7. +
    + + +
    +
    4
    +
    +
    + + Enfourner + ⏱️ 2 heures + minimum. Ni retourner, ni arroser, ni couvrir, ni liquide dans le plat. +
    + +
    +
    +
    +
  8. + + + +
  9. +
    + + +
    +
    5
    +
    +
    + + La chair doit se détacher de l'os et la peau être dorée. Sinon + ⏱️ 5 minutes + sous le gril. +
    + +
    +
    +
    +
  10. + + +
+ + +

Notes

+ + +
    + + +
  1. +
    + 📝 +

    2 h 30 – 3 h sans problème, ça cale avec les 2 h de mijotage de la ratatouille.

    +
    +
  2. + + + +
  3. +
    + 📝 +

    Garder la graisse du plat pour faire revenir des légumes ou des patates plus tard.

    +
    +
  4. + + + +
  5. +
    + 📝 +

    Combos : cumin + coriandre + paprika · paprika fumé + origan · Espelette seul.

    +
    +
  6. + + + +
  7. +
    + 📝 +

    3-4 jours au frigo, se réchauffe bien.

    +
    +
  8. + + +
+ +
+
+
+
+ + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/recipe/galette_lentilles.cook b/recipe/galette_lentilles.cook new file mode 100644 index 0000000..322910b --- /dev/null +++ b/recipe/galette_lentilles.cook @@ -0,0 +1,23 @@ +--- +title: Galettes de lentilles +servings: 4 +prep time: 10 minutes +cook time: 10 minutes +course: plat +locale: fr +tags: + - végétarien + - poêle +--- + +Râper finement les @carottes{2} et émincer l'@échalote{1}. + +Mélanger avec les @lentilles{200%g}(ou du maïs), @sel{2%g}, @cumin{2%g}, @coriandre{à volonté}, @farine{15%g}(ou Maïzena), @œuf{1} et @chapelure de pain{15%g}, jusqu'à obtenir une sorte de pâte grumeleuse. + +Filmer au contact et laisser reposer au frigo ~repos{1%heure} minimum. La pâte doit être assez compacte pour faire des boules type falafels ou des galettes. + +Cuire à la #poêle{} dans de l'@huile d'olive{}. + +== Notes == + +> Option : une fois les boules faites, les paner et les frire ou les passer au four. diff --git a/recipe/galette_lentilles.html b/recipe/galette_lentilles.html new file mode 100644 index 0000000..2ad666a --- /dev/null +++ b/recipe/galette_lentilles.html @@ -0,0 +1,1397 @@ + + + + + + Galettes de lentilles - Cook + + + + + + + + + + + +
+ + +
+ + + +
+ + +
+ + + + + +
+

+ Galettes de lentilles +

+ +
+ + + + + + + + + + +
+
+ + +
+ + +
+ + #végétarien + + #poêle + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ +
+
+
+

🥘 Ingrédients

+ + + + + + + + + +
    + +
  • +
    + + carottes + + + +
    + + 2 + + +
  • + +
  • +
    + + chapelure de pain + + + +
    + + 15 g + + +
  • + +
  • +
    + + coriandre + + + +
    + + à volonté + + +
  • + +
  • +
    + + cumin + + + +
    + + 2 g + + +
  • + +
  • +
    + + farine + + + (ou Maïzena) + +
    + + 15 g + + +
  • + +
  • +
    + + huile d'olive + + + +
    + + + + +
  • + +
  • +
    + + lentilles + + + (ou du maïs) + +
    + + 200 g + + +
  • + +
  • +
    + + sel + + + +
    + + 2 g + + +
  • + +
  • +
    + + échalote + + + +
    + + 1 + + +
  • + +
  • +
    + + œuf + + + +
    + + 1 + + +
  • + +
+ + + + + + + +

🍳 Ustensiles

+
    + +
  • + poêle +
  • + +
+ +
+
+ +
+
+ + + + +
    + + +
  1. +
    + + +
    +
    1
    +
    +
    + + Râper finement les + carottes + et émincer l' + échalote + . +
    + +
    + + + carottes: 2, + + + + échalote: 1 + + +
    + +
    +
    +
    +
  2. + + + +
  3. +
    + + +
    +
    2
    +
    +
    + + Mélanger avec les + lentilles + , + sel + , + cumin + , + coriandre + , + farine + , + œuf + et + chapelure de pain + , jusqu'à obtenir une sorte de pâte grumeleuse. +
    + +
    + + + lentilles: 200 g (ou du maïs), + + + + sel: 2 g, + + + + cumin: 2 g, + + + + coriandre: à volonté, + + + + farine: 15 g (ou Maïzena), + + + + œuf: 1, + + + + chapelure de pain: 15 g + + +
    + +
    +
    +
    +
  4. + + + +
  5. +
    + + +
    +
    3
    +
    +
    + + Filmer au contact et laisser reposer au frigo + ⏱️ 1 heure + minimum. La pâte doit être assez compacte pour faire des boules type falafels ou des galettes. +
    + +
    +
    +
    +
  6. + + + +
  7. +
    + + +
    +
    4
    +
    +
    + + Cuire à la + poêle + dans de l' + huile d'olive + . +
    + +
    + + + huile d'olive + + +
    + +
    +
    +
    +
  8. + + +
+ + +

Notes

+ + +
    + + +
  1. +
    + 📝 +

    Option : une fois les boules faites, les paner et les frire ou les passer au four.

    +
    +
  2. + + +
+ +
+
+
+
+ + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/recipe/legumes_rotis.cook b/recipe/legumes_rotis.cook new file mode 100644 index 0000000..6de51f3 --- /dev/null +++ b/recipe/legumes_rotis.cook @@ -0,0 +1,35 @@ +--- +title: Légumes rôtis au four +description: Bords caramélisés, cœur fondant. Une grande plaque pour la semaine. +servings: 6 +prep time: 10 minutes +cook time: 1 hour +course: accompagnement +locale: fr +tags: + - batch + - four + - légumes +--- + +Préchauffer le #four{} à 200°C. + +Couper en gros morceaux réguliers de 3-4 cm les légumes qui tiennent : @pommes de terre{}, @patate douce{}, @carottes{}, @panais{}, @courge{}, @betterave{}, @chou-fleur{}, @oignons rouges{}. Réguliers = tout cuit à la même vitesse. + +Mélanger dans un #saladier{} avec beaucoup d'@huile d'olive{}, @sel{}, @poivre{}, les @épices{}(cumin, paprika, curry, herbes de Provence, romarin) et l'@ail{1%tête}(gousses entières, en chemise). Chaque morceau doit être luisant. + +Étaler en une seule couche sur une #plaque{}, sans que ça se chevauche. + +Enfourner ~{45%minutes} à 1 h, en remuant une fois à mi-cuisson. Fini quand les bords sont dorés et qu'un couteau traverse sans résistance. + +== Notes == + +> Le seul vrai piège : la plaque surchargée. Les légumes rendent leur eau, ça cuit à la vapeur et ça ne dore jamais. Deux plaques plutôt qu'une trop pleine. + +> Les tendres (courgette, brocoli, poivron, tomates cerises) cuisent 2× plus vite : les ajouter 20-25 min avant la fin. + +> Bon chaud, bon froid en salade avec une vinaigrette ou du yaourt-citron. + +> Sur la même plaque que des cuisses de poulet, ça marche aussi, mais compter 150°C et 2 h. + +> 4-5 jours au frigo. Se congèle mal (ça devient mou). diff --git a/recipe/legumes_rotis.html b/recipe/legumes_rotis.html new file mode 100644 index 0000000..f0ee80f --- /dev/null +++ b/recipe/legumes_rotis.html @@ -0,0 +1,1525 @@ + + + + + + Légumes rôtis au four - Cook + + + + + + + + + + + +
+ + +
+ + + +
+ + +
+ + + + + +
+

+ Légumes rôtis au four +

+ +
+ + + + + + + + + + +
+
+ + +
+ + +
+ + #batch + + #four + + #légumes + +
+ + + + + + +
+

Bords caramélisés, cœur fondant. Une grande plaque pour la semaine.

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ +
+
+
+

🥘 Ingrédients

+ + + + + + + + + +
    + +
  • +
    + + ail + + + (gousses entières, en chemise) + +
    + + 1 tête + + +
  • + +
  • +
    + + betterave + + + +
    + + + + +
  • + +
  • +
    + + carottes + + + +
    + + + + +
  • + +
  • +
    + + chou-fleur + + + +
    + + + + +
  • + +
  • +
    + + courge + + + +
    + + + + +
  • + +
  • +
    + + huile d'olive + + + +
    + + + + +
  • + +
  • +
    + + oignons rouges + + + +
    + + + + +
  • + +
  • +
    + + panais + + + +
    + + + + +
  • + +
  • +
    + + patate douce + + + +
    + + + + +
  • + +
  • +
    + + poivre + + + +
    + + + + +
  • + +
  • +
    + + pommes de terre + + + +
    + + + + +
  • + +
  • +
    + + sel + + + +
    + + + + +
  • + +
  • +
    + + épices + + + (cumin, paprika, curry, herbes de Provence, romarin) + +
    + + + + +
  • + +
+ + + + + + + +

🍳 Ustensiles

+
    + +
  • + four +
  • + +
  • + saladier +
  • + +
  • + plaque +
  • + +
+ +
+
+ +
+
+ + + + +
    + + +
  1. +
    + + +
    +
    1
    +
    +
    + + Préchauffer le + four + à 200°C. +
    + +
    +
    +
    +
  2. + + + +
  3. +
    + + +
    +
    2
    +
    +
    + + Couper en gros morceaux réguliers de 3-4 cm les légumes qui tiennent : + pommes de terre + , + patate douce + , + carottes + , + panais + , + courge + , + betterave + , + chou-fleur + , + oignons rouges + . Réguliers = tout cuit à la même vitesse. +
    + +
    + + + pommes de terre, + + + + patate douce, + + + + carottes, + + + + panais, + + + + courge, + + + + betterave, + + + + chou-fleur, + + + + oignons rouges + + +
    + +
    +
    +
    +
  4. + + + +
  5. +
    + + +
    +
    3
    +
    +
    + + Mélanger dans un + saladier + avec beaucoup d' + huile d'olive + , + sel + , + poivre + , les + épices + et l' + ail + . Chaque morceau doit être luisant. +
    + +
    + + + huile d'olive, + + + + sel, + + + + poivre, + + + + épices (cumin, paprika, curry, herbes de Provence, romarin), + + + + ail: 1 tête (gousses entières, en chemise) + + +
    + +
    +
    +
    +
  6. + + + +
  7. +
    + + +
    +
    4
    +
    +
    + + Étaler en une seule couche sur une + plaque + , sans que ça se chevauche. +
    + +
    +
    +
    +
  8. + + + +
  9. +
    + + +
    +
    5
    +
    +
    + + Enfourner + ⏱️ 45 minutes + à 1 h, en remuant une fois à mi-cuisson. Fini quand les bords sont dorés et qu'un couteau traverse sans résistance. +
    + +
    +
    +
    +
  10. + + +
+ + +

Notes

+ + +
    + + +
  1. +
    + 📝 +

    Le seul vrai piège : la plaque surchargée. Les légumes rendent leur eau, ça cuit à la vapeur et ça ne dore jamais. Deux plaques plutôt qu'une trop pleine.

    +
    +
  2. + + + +
  3. +
    + 📝 +

    Les tendres (courgette, brocoli, poivron, tomates cerises) cuisent 2× plus vite : les ajouter 20-25 min avant la fin.

    +
    +
  4. + + + +
  5. +
    + 📝 +

    Bon chaud, bon froid en salade avec une vinaigrette ou du yaourt-citron.

    +
    +
  6. + + + +
  7. +
    + 📝 +

    Sur la même plaque que des cuisses de poulet, ça marche aussi, mais compter 150°C et 2 h.

    +
    +
  8. + + + +
  9. +
    + 📝 +

    4-5 jours au frigo. Se congèle mal (ça devient mou).

    +
    +
  10. + + +
+ +
+
+
+
+ + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/recipe/mi-cuit_chocolat.cook b/recipe/mi-cuit_chocolat.cook new file mode 100644 index 0000000..1b1cbdb --- /dev/null +++ b/recipe/mi-cuit_chocolat.cook @@ -0,0 +1,36 @@ +--- +title: Le gâteau mi-cuit au chocolat de Suzy Palatin +description: Gâteau au chocolat orgiaque, riche et gourmand, mais très facile à faire. Proposé par François-Régis Gaudry, et c'est Pierre Hermé qui dit que c'est le meilleur gâteau au chocolat du monde. +author: Suzy Palatin +source: https://www.youtube.com/watch?v=Vpa58PdBuoQ +servings: 8 +prep time: 15 minutes +cook time: 30 minutes +course: dessert +locale: fr +tags: + - chocolat + - gâteau +--- + +Préchauffer le #four{} à 200°C. + +Faire fondre le @chocolat pâtissier à 60 ou 70 %{250%g} au bain-marie ou au micro-ondes. + +Ajouter le @beurre{250%g}(pommade, coupé en morceaux) et bien mélanger à l'aide d'un #fouet{}, pour obtenir une texture lisse. + +Débarrasser dans un #cul de poule{}, ajouter le @sucre{250%g} et mélanger. + +Ajouter la @farine{70%g} en trois fois, en mélangeant énergiquement pour éviter les grumeaux. + +Casser les @œufs{4} dans un bol et les battre en omelette. Les ajouter à l'appareil chocolaté et bien mélanger. + +Verser la pâte dans un #moule à manqué de 24-25 cm{}, préalablement beurré et fariné, idéalement en silicone. + +Baisser le thermostat à 150°C et enfourner ~{30%minutes}. + +Laisser refroidir ~{10%minutes} et démouler. Le gâteau doit avoir une légère croûte et un cœur moelleux, fondant et crémeux à souhait. + +== Notes == + +> Prévoir un peu de beurre et de farine en plus des 250 g / 70 g, pour le moule. diff --git a/recipe/mi-cuit_chocolat.html b/recipe/mi-cuit_chocolat.html new file mode 100644 index 0000000..da5327f --- /dev/null +++ b/recipe/mi-cuit_chocolat.html @@ -0,0 +1,1424 @@ + + + + + + Le gâteau mi-cuit au chocolat de Suzy Palatin - Cook + + + + + + + + + + + +
+ + +
+ + + +
+ + +
+ + + + + +
+

+ Le gâteau mi-cuit au chocolat de Suzy Palatin +

+ +
+ + + + + + + + + + +
+
+ + +
+ + +
+ + #chocolat + + #gâteau + +
+ + + + + + +
+

Gâteau au chocolat orgiaque, riche et gourmand, mais très facile à faire. Proposé par François-Régis Gaudry, et c'est Pierre Hermé qui dit que c'est le meilleur gâteau au chocolat du monde.

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ +
+
+
+

🥘 Ingrédients

+ + + + + + + + + +
    + +
  • +
    + + beurre + + + (pommade, coupé en morceaux) + +
    + + 250 g + + +
  • + +
  • +
    + + chocolat pâtissier à 60 ou 70 % + + + +
    + + 250 g + + +
  • + +
  • +
    + + farine + + + +
    + + 70 g + + +
  • + +
  • +
    + + sucre + + + +
    + + 250 g + + +
  • + +
  • +
    + + œufs + + + +
    + + 4 + + +
  • + +
+ + + + + + + +

🍳 Ustensiles

+
    + +
  • + four +
  • + +
  • + fouet +
  • + +
  • + cul de poule +
  • + +
  • + moule à manqué de 24-25 cm +
  • + +
+ +
+
+ +
+
+ + + + +
    + + +
  1. +
    + + +
    +
    1
    +
    +
    + + Préchauffer le + four + à 200°C. +
    + +
    +
    +
    +
  2. + + + +
  3. +
    + + +
    +
    2
    +
    +
    + + Faire fondre le + chocolat pâtissier à 60 ou 70 % + au bain-marie ou au micro-ondes. +
    + +
    + + + chocolat pâtissier à 60 ou 70 %: 250 g + + +
    + +
    +
    +
    +
  4. + + + +
  5. +
    + + +
    +
    3
    +
    +
    + + Ajouter le + beurre + et bien mélanger à l'aide d'un + fouet + , pour obtenir une texture lisse. +
    + +
    + + + beurre: 250 g (pommade, coupé en morceaux) + + +
    + +
    +
    +
    +
  6. + + + +
  7. +
    + + +
    +
    4
    +
    +
    + + Débarrasser dans un + cul de poule + , ajouter le + sucre + et mélanger. +
    + +
    + + + sucre: 250 g + + +
    + +
    +
    +
    +
  8. + + + +
  9. +
    + + +
    +
    5
    +
    +
    + + Ajouter la + farine + en trois fois, en mélangeant énergiquement pour éviter les grumeaux. +
    + +
    + + + farine: 70 g + + +
    + +
    +
    +
    +
  10. + + + +
  11. +
    + + +
    +
    6
    +
    +
    + + Casser les + œufs + dans un bol et les battre en omelette. Les ajouter à l'appareil chocolaté et bien mélanger. +
    + +
    + + + œufs: 4 + + +
    + +
    +
    +
    +
  12. + + + +
  13. +
    + + +
    +
    7
    +
    +
    + + Verser la pâte dans un + moule à manqué de 24-25 cm + , préalablement beurré et fariné, idéalement en silicone. +
    + +
    +
    +
    +
  14. + + + +
  15. +
    + + +
    +
    8
    +
    +
    + + Baisser le thermostat à 150°C et enfourner + ⏱️ 30 minutes + . +
    + +
    +
    +
    +
  16. + + + +
  17. +
    + + +
    +
    9
    +
    +
    + + Laisser refroidir + ⏱️ 10 minutes + et démouler. Le gâteau doit avoir une légère croûte et un cœur moelleux, fondant et crémeux à souhait. +
    + +
    +
    +
    +
  18. + + +
+ + +

Notes

+ + +
    + + +
  1. +
    + 📝 +

    Prévoir un peu de beurre et de farine en plus des 250 g / 70 g, pour le moule.

    +
    +
  2. + + +
+ +
+
+
+
+ + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/recipe/poisson_papillote.cook b/recipe/poisson_papillote.cook new file mode 100644 index 0000000..8ebe6a7 --- /dev/null +++ b/recipe/poisson_papillote.cook @@ -0,0 +1,40 @@ +--- +title: Poisson en papillote +description: Zéro vaisselle, zéro surveillance. +servings: 4 +prep time: 10 minutes +cook time: 25 minutes +course: plat +locale: fr +tags: + - four + - poisson +--- + +Préchauffer le #four{} à 200°C. + +Couper fin les légumes : @courgette{1}(en rondelles), @poireau{1}(émincé), @tomates cerises{1%poignée}. Vraiment fin, sinon ils restent crus. + +Sur 4 grandes feuilles de #papier cuisson{} : un lit de légumes, puis un @pavé de poisson{4}(cabillaud, lieu, saumon, dorade) sur chacune. + +Ajouter un filet d'@huile d'olive{}, 2-3 rondelles de @citron{1}, @sel{}, @poivre{} et les @herbes{}(aneth, thym, origan). Optionnel : @vin blanc{1%c. à s.} par papillote, @ail{}, @piment{}. + +Fermer hermétiquement en roulant les bords : la papillote doit gonfler à la cuisson. + +Enfourner ~{20%minutes} pour des pavés de 2 cm, ~{25%minutes} pour 3-4 cm. Ne pas ouvrir en cours de route. + +La chair doit se détacher en lamelles à la fourchette. + +== Notes == + +> Les légumes cuisent moins vite que le poisson. Les durs (carotte, pomme de terre) sont à éviter, ou à précuire. + +> Poisson surgelé : direct sans décongeler, +8-10 min. + +> Papier cuisson plutôt qu'alu (le citron et la tomate attaquent l'alu). + +> Trop cuit = sec et cotonneux, c'est la seule vraie façon de rater. + +> Le jus au fond de la papillote est la sauce, le verser sur l'assiette. + +> Moins « batch » que le reste : se mange le jour même. Les restes sont bons froids, émiettés en salade. diff --git a/recipe/poisson_papillote.html b/recipe/poisson_papillote.html new file mode 100644 index 0000000..6ba8b54 --- /dev/null +++ b/recipe/poisson_papillote.html @@ -0,0 +1,1552 @@ + + + + + + Poisson en papillote - Cook + + + + + + + + + + + +
+ + +
+ + + +
+ + +
+ + + + + +
+

+ Poisson en papillote +

+ +
+ + + + + + + + + + +
+
+ + +
+ + +
+ + #four + + #poisson + +
+ + + + + + +
+

Zéro vaisselle, zéro surveillance.

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ +
+
+
+

🥘 Ingrédients

+ + + + + + + + + +
    + +
  • +
    + + ail + + + +
    + + + + +
  • + +
  • +
    + + citron + + + +
    + + 1 + + +
  • + +
  • +
    + + courgette + + + (en rondelles) + +
    + + 1 + + +
  • + +
  • +
    + + herbes + + + (aneth, thym, origan) + +
    + + + + +
  • + +
  • +
    + + huile d'olive + + + +
    + + + + +
  • + +
  • +
    + + pavé de poisson + + + (cabillaud, lieu, saumon, dorade) + +
    + + 4 + + +
  • + +
  • +
    + + piment + + + +
    + + + + +
  • + +
  • +
    + + poireau + + + (émincé) + +
    + + 1 + + +
  • + +
  • +
    + + poivre + + + +
    + + + + +
  • + +
  • +
    + + sel + + + +
    + + + + +
  • + +
  • +
    + + tomates cerises + + + +
    + + 1 poignée + + +
  • + +
  • +
    + + vin blanc + + + +
    + + 1 c. à s. + + +
  • + +
+ + + + + + + +

🍳 Ustensiles

+
    + +
  • + four +
  • + +
  • + papier cuisson +
  • + +
+ +
+
+ +
+
+ + + + +
    + + +
  1. +
    + + +
    +
    1
    +
    +
    + + Préchauffer le + four + à 200°C. +
    + +
    +
    +
    +
  2. + + + +
  3. +
    + + +
    +
    2
    +
    +
    + + Couper fin les légumes : + courgette + , + poireau + , + tomates cerises + . Vraiment fin, sinon ils restent crus. +
    + +
    + + + courgette: 1 (en rondelles), + + + + poireau: 1 (émincé), + + + + tomates cerises: 1 poignée + + +
    + +
    +
    +
    +
  4. + + + +
  5. +
    + + +
    +
    3
    +
    +
    + + Sur 4 grandes feuilles de + papier cuisson + : un lit de légumes, puis un + pavé de poisson + sur chacune. +
    + +
    + + + pavé de poisson: 4 (cabillaud, lieu, saumon, dorade) + + +
    + +
    +
    +
    +
  6. + + + +
  7. +
    + + +
    +
    4
    +
    +
    + + Ajouter un filet d' + huile d'olive + , 2-3 rondelles de + citron + , + sel + , + poivre + et les + herbes + . Optionnel : + vin blanc + par papillote, + ail + , + piment + . +
    + +
    + + + huile d'olive, + + + + citron: 1, + + + + sel, + + + + poivre, + + + + herbes (aneth, thym, origan), + + + + vin blanc: 1 c. à s., + + + + ail, + + + + piment + + +
    + +
    +
    +
    +
  8. + + + +
  9. +
    + + +
    +
    5
    +
    +
    + + Fermer hermétiquement en roulant les bords : la papillote doit gonfler à la cuisson. +
    + +
    +
    +
    +
  10. + + + +
  11. +
    + + +
    +
    6
    +
    +
    + + Enfourner + ⏱️ 20 minutes + pour des pavés de 2 cm, + ⏱️ 25 minutes + pour 3-4 cm. Ne pas ouvrir en cours de route. +
    + +
    +
    +
    +
  12. + + + +
  13. +
    + + +
    +
    7
    +
    +
    + + La chair doit se détacher en lamelles à la fourchette. +
    + +
    +
    +
    +
  14. + + +
+ + +

Notes

+ + +
    + + +
  1. +
    + 📝 +

    Les légumes cuisent moins vite que le poisson. Les durs (carotte, pomme de terre) sont à éviter, ou à précuire.

    +
    +
  2. + + + +
  3. +
    + 📝 +

    Poisson surgelé : direct sans décongeler, +8-10 min.

    +
    +
  4. + + + +
  5. +
    + 📝 +

    Papier cuisson plutôt qu'alu (le citron et la tomate attaquent l'alu).

    +
    +
  6. + + + +
  7. +
    + 📝 +

    Trop cuit = sec et cotonneux, c'est la seule vraie façon de rater.

    +
    +
  8. + + + +
  9. +
    + 📝 +

    Le jus au fond de la papillote est la sauce, le verser sur l'assiette.

    +
    +
  10. + + + +
  11. +
    + 📝 +

    Moins « batch » que le reste : se mange le jour même. Les restes sont bons froids, émiettés en salade.

    +
    +
  12. + + +
+ +
+
+
+
+ + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/recipe/porc_effiloche.cook b/recipe/porc_effiloche.cook new file mode 100644 index 0000000..bb7eb23 --- /dev/null +++ b/recipe/porc_effiloche.cook @@ -0,0 +1,37 @@ +--- +title: Porc effiloché au four +description: Le four fait tout, on n'ouvre pas. +servings: 8 +prep time: 10 minutes +cook time: 6 hours +course: plat +locale: fr +tags: + - batch + - four + - porc +--- + +Préchauffer le #four{} à 150°C. + +Frotter l'@échine de porc{2%kg}(ou palette, garder le gras) d'@huile d'olive{} ou de @moutarde{}, puis masser toutes les faces avec le rub : @sel{}, @poivre{}, @paprika fumé{}, @cumin{}, @ail en poudre{}, @origan{}, @cassonade{15%g}. + +Émincer les @oignons{2} et les étaler au fond d'une #cocotte{}. Poser la viande dessus, gras vers le haut, puis verser la @bière{1%verre}(ou cidre, bouillon, eau) à côté de la viande, pas dessus (ça rincerait le rub). + +Couvrir (couvercle ou alu bien serré) et cuire ~{5%heures} sans ouvrir. + +Prêt quand une fourchette s'enfonce sans résistance. Laisser reposer ~repos{30%minutes}, puis effilocher à deux fourchettes et remélanger avec le jus et les oignons. + +== Notes == + +> Compter ~3 h par kilo à 150°C. Trop cuit n'existe pas ici, pas assez cuit si. + +> Si c'est encore ferme à 5 h, c'est que le collagène n'a pas fondu : rallonger, pas monter la température. + +> Dernière heure à découvert pour une croûte, mais garder le jus pour remouiller après. + +> Le jus est gras : le laisser figer au frigo et retirer la couche du dessus si besoin. + +> Buns, tacos, riz, patates, ou juste avec des légumes rôtis. + +> 4-5 jours au frigo, se congèle très bien en portions (avec son jus, sinon ça sèche). diff --git a/recipe/porc_effiloche.html b/recipe/porc_effiloche.html new file mode 100644 index 0000000..032a6e0 --- /dev/null +++ b/recipe/porc_effiloche.html @@ -0,0 +1,1510 @@ + + + + + + Porc effiloché au four - Cook + + + + + + + + + + + +
+ + +
+ + + +
+ + +
+ + + + + +
+

+ Porc effiloché au four +

+ +
+ + + + + + + + + + +
+
+ + +
+ + +
+ + #batch + + #four + + #porc + +
+ + + + + + +
+

Le four fait tout, on n'ouvre pas.

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ +
+
+
+

🥘 Ingrédients

+ + + + + + + + + +
    + +
  • +
    + + ail en poudre + + + +
    + + + + +
  • + +
  • +
    + + bière + + + (ou cidre, bouillon, eau) + +
    + + 1 verre + + +
  • + +
  • +
    + + cassonade + + + +
    + + 15 g + + +
  • + +
  • +
    + + cumin + + + +
    + + + + +
  • + +
  • +
    + + huile d'olive + + + +
    + + + + +
  • + +
  • +
    + + moutarde + + + +
    + + + + +
  • + +
  • +
    + + oignons + + + +
    + + 2 + + +
  • + +
  • +
    + + origan + + + +
    + + + + +
  • + +
  • +
    + + paprika fumé + + + +
    + + + + +
  • + +
  • +
    + + poivre + + + +
    + + + + +
  • + +
  • +
    + + sel + + + +
    + + + + +
  • + +
  • +
    + + échine de porc + + + (ou palette, garder le gras) + +
    + + 2 kg + + +
  • + +
+ + + + + + + +

🍳 Ustensiles

+
    + +
  • + four +
  • + +
  • + cocotte +
  • + +
+ +
+
+ +
+
+ + + + +
    + + +
  1. +
    + + +
    +
    1
    +
    +
    + + Préchauffer le + four + à 150°C. +
    + +
    +
    +
    +
  2. + + + +
  3. +
    + + +
    +
    2
    +
    +
    + + Frotter l' + échine de porc + d' + huile d'olive + ou de + moutarde + , puis masser toutes les faces avec le rub : + sel + , + poivre + , + paprika fumé + , + cumin + , + ail en poudre + , + origan + , + cassonade + . +
    + +
    + + + échine de porc: 2 kg (ou palette, garder le gras), + + + + huile d'olive, + + + + moutarde, + + + + sel, + + + + poivre, + + + + paprika fumé, + + + + cumin, + + + + ail en poudre, + + + + origan, + + + + cassonade: 15 g + + +
    + +
    +
    +
    +
  4. + + + +
  5. +
    + + +
    +
    3
    +
    +
    + + Émincer les + oignons + et les étaler au fond d'une + cocotte + . Poser la viande dessus, gras vers le haut, puis verser la + bière + à côté de la viande, pas dessus (ça rincerait le rub). +
    + +
    + + + oignons: 2, + + + + bière: 1 verre (ou cidre, bouillon, eau) + + +
    + +
    +
    +
    +
  6. + + + +
  7. +
    + + +
    +
    4
    +
    +
    + + Couvrir (couvercle ou alu bien serré) et cuire + ⏱️ 5 heures + sans ouvrir. +
    + +
    +
    +
    +
  8. + + + +
  9. +
    + + +
    +
    5
    +
    +
    + + Prêt quand une fourchette s'enfonce sans résistance. Laisser reposer + ⏱️ 30 minutes + , puis effilocher à deux fourchettes et remélanger avec le jus et les oignons. +
    + +
    +
    +
    +
  10. + + +
+ + +

Notes

+ + +
    + + +
  1. +
    + 📝 +

    Compter ~3 h par kilo à 150°C. Trop cuit n'existe pas ici, pas assez cuit si.

    +
    +
  2. + + + +
  3. +
    + 📝 +

    Si c'est encore ferme à 5 h, c'est que le collagène n'a pas fondu : rallonger, pas monter la température.

    +
    +
  4. + + + +
  5. +
    + 📝 +

    Dernière heure à découvert pour une croûte, mais garder le jus pour remouiller après.

    +
    +
  6. + + + +
  7. +
    + 📝 +

    Le jus est gras : le laisser figer au frigo et retirer la couche du dessus si besoin.

    +
    +
  8. + + + +
  9. +
    + 📝 +

    Buns, tacos, riz, patates, ou juste avec des légumes rôtis.

    +
    +
  10. + + + +
  11. +
    + 📝 +

    4-5 jours au frigo, se congèle très bien en portions (avec son jus, sinon ça sèche).

    +
    +
  12. + + +
+ +
+
+
+
+ + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/recipe/ratatouille.cook b/recipe/ratatouille.cook new file mode 100644 index 0000000..bbe46d3 --- /dev/null +++ b/recipe/ratatouille.cook @@ -0,0 +1,35 @@ +--- +title: « Ratatouille » du frigo +description: Pas une vraie ratatouille - légumes cuits ensemble, départ à froid, 2 h de mijotage. +servings: 6 +prep time: 15 minutes +cook time: 2 hours 15 minutes +course: plat +locale: fr +tags: + - batch + - mijoté + - légumes +--- + +Couper en gros morceaux les @oignons{2} et, au choix, @tomates{}, @courgettes{}, @aubergines{}, @poivrons{}, @piments{}. Vraiment gros : 2 h de cuisson, coupé fin ça finit en purée. + +Tout mettre à froid dans une #marmite{} avec le @concentré de tomate{généreusement}, beaucoup d'@huile d'olive{}, @sel{} et @poivre{}. Allumer à feu bas-moyen. + +Laisser revenir à découvert ~{15%minutes} en remuant régulièrement : le concentré doit foncer et perdre son goût cru. + +Couvrir, feu minimum, ~{2%heures} minimum. Remuer de temps en temps. + +Goûter, rectifier le sel. + +== Notes == + +> Départ à froid = pas de saisie, les légumes confisent dans l'huile au lieu de griller. Ne pas lésiner sur l'huile, c'est elle qui fait la texture. + +> Pas d'eau : les légumes en rendent assez. Si ça attache, fond d'eau + baisser le feu. + +> Trop liquide à la fin : 15-20 min à découvert. + +> Ajouts : ail en fin de cuisson, herbes de Provence, laurier, pincée de sucre si les tomates sont acides. + +> Meilleur le lendemain. 4-5 jours au frigo, se congèle. diff --git a/recipe/ratatouille.html b/recipe/ratatouille.html new file mode 100644 index 0000000..c73afe7 --- /dev/null +++ b/recipe/ratatouille.html @@ -0,0 +1,1453 @@ + + + + + + « Ratatouille » du frigo - Cook + + + + + + + + + + + +
+ + +
+ + + +
+ + +
+ + + + + +
+

+ « Ratatouille » du frigo +

+ +
+ + + + + + + + + + +
+
+ + +
+ + +
+ + #batch + + #mijoté + + #légumes + +
+ + + + + + +
+

Pas une vraie ratatouille - légumes cuits ensemble, départ à froid, 2 h de mijotage.

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ +
+
+
+

🥘 Ingrédients

+ + + + + + + + + +
    + +
  • +
    + + aubergines + + + +
    + + + + +
  • + +
  • +
    + + concentré de tomate + + + +
    + + généreusement + + +
  • + +
  • +
    + + courgettes + + + +
    + + + + +
  • + +
  • +
    + + huile d'olive + + + +
    + + + + +
  • + +
  • +
    + + oignons + + + +
    + + 2 + + +
  • + +
  • +
    + + piments + + + +
    + + + + +
  • + +
  • +
    + + poivre + + + +
    + + + + +
  • + +
  • +
    + + poivrons + + + +
    + + + + +
  • + +
  • +
    + + sel + + + +
    + + + + +
  • + +
  • +
    + + tomates + + + +
    + + + + +
  • + +
+ + + + + + + +

🍳 Ustensiles

+
    + +
  • + marmite +
  • + +
+ +
+
+ +
+
+ + + + +
    + + +
  1. +
    + + +
    +
    1
    +
    +
    + + Couper en gros morceaux les + oignons + et, au choix, + tomates + , + courgettes + , + aubergines + , + poivrons + , + piments + . Vraiment gros : 2 h de cuisson, coupé fin ça finit en purée. +
    + +
    + + + oignons: 2, + + + + tomates, + + + + courgettes, + + + + aubergines, + + + + poivrons, + + + + piments + + +
    + +
    +
    +
    +
  2. + + + +
  3. +
    + + +
    +
    2
    +
    +
    + + Tout mettre à froid dans une + marmite + avec le + concentré de tomate + , beaucoup d' + huile d'olive + , + sel + et + poivre + . Allumer à feu bas-moyen. +
    + +
    + + + concentré de tomate: généreusement, + + + + huile d'olive, + + + + sel, + + + + poivre + + +
    + +
    +
    +
    +
  4. + + + +
  5. +
    + + +
    +
    3
    +
    +
    + + Laisser revenir à découvert + ⏱️ 15 minutes + en remuant régulièrement : le concentré doit foncer et perdre son goût cru. +
    + +
    +
    +
    +
  6. + + + +
  7. +
    + + +
    +
    4
    +
    +
    + + Couvrir, feu minimum, + ⏱️ 2 heures + minimum. Remuer de temps en temps. +
    + +
    +
    +
    +
  8. + + + +
  9. +
    + + +
    +
    5
    +
    +
    + + Goûter, rectifier le sel. +
    + +
    +
    +
    +
  10. + + +
+ + +

Notes

+ + +
    + + +
  1. +
    + 📝 +

    Départ à froid = pas de saisie, les légumes confisent dans l'huile au lieu de griller. Ne pas lésiner sur l'huile, c'est elle qui fait la texture.

    +
    +
  2. + + + +
  3. +
    + 📝 +

    Pas d'eau : les légumes en rendent assez. Si ça attache, fond d'eau + baisser le feu.

    +
    +
  4. + + + +
  5. +
    + 📝 +

    Trop liquide à la fin : 15-20 min à découvert.

    +
    +
  6. + + + +
  7. +
    + 📝 +

    Ajouts : ail en fin de cuisson, herbes de Provence, laurier, pincée de sucre si les tomates sont acides.

    +
    +
  8. + + + +
  9. +
    + 📝 +

    Meilleur le lendemain. 4-5 jours au frigo, se congèle.

    +
    +
  10. + + +
+ +
+
+
+
+ + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/recipe/saucisses.cook b/recipe/saucisses.cook new file mode 100644 index 0000000..470d28b --- /dev/null +++ b/recipe/saucisses.cook @@ -0,0 +1,23 @@ +--- +title: Saucisses maison +servings: 4 +prep time: 15 minutes +cook time: 15 minutes +course: plat +locale: fr +tags: + - saucisse + - poêle +--- + +Dans un #saladier{}, mélanger la @chair à saucisse bœuf et porc{450%g}, le @sel{3%g}, une pincée de @poivre{}, du @persil plat{}(ciselé) et le @paprika{7%g}. + +Couper une #bouteille en plastique d'1,5 L{} en deux : c'est le poussoir à saucisses. + +Transvaser la farce dans la moitié haute de la bouteille. Planter une #pique à brochette{} dans le goulot. + +Retourner la moitié basse de la bouteille et l'enfoncer dans la partie ouverte, pour pousser la farce vers le goulot. + +Chauffer une #sauteuse{} à feu moyen et cuire les saucisses à cœur. + +Garnir un @pain à hot-dog{} de @salade{}, ajouter de la @salsa{}, puis la saucisse, et enfin @ketchup{} et @moutarde{} selon l'envie. diff --git a/recipe/saucisses.html b/recipe/saucisses.html new file mode 100644 index 0000000..4db903f --- /dev/null +++ b/recipe/saucisses.html @@ -0,0 +1,1419 @@ + + + + + + Saucisses maison - Cook + + + + + + + + + + + +
+ + +
+ + + +
+ + +
+ + + + + +
+

+ Saucisses maison +

+ +
+ + + + + + + + + + +
+
+ + +
+ + +
+ + #saucisse + + #poêle + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ +
+
+
+

🥘 Ingrédients

+ + + +
    + +
  • +
    + + chair à saucisse bœuf et porc + + + +
    + + 450 g + + +
  • + +
  • +
    + + ketchup + + + +
    + + + + +
  • + +
  • +
    + + moutarde + + + +
    + + + + +
  • + +
  • +
    + + pain à hot-dog + + + +
    + + + + +
  • + +
  • +
    + + paprika + + + +
    + + 7 g + + +
  • + +
  • +
    + + persil plat + + + (ciselé) + +
    + + + + +
  • + +
  • +
    + + poivre + + + +
    + + + + +
  • + +
  • +
    + + salade + + + +
    + + + + +
  • + +
  • +
    + + salsa + + + +
    + + + + +
  • + +
  • +
    + + sel + + + +
    + + 3 g + + +
  • + +
+ + + +

🍳 Ustensiles

+
    + +
  • + saladier +
  • + +
  • + bouteille en plastique d'1,5 L +
  • + +
  • + pique à brochette +
  • + +
  • + sauteuse +
  • + +
+ +
+
+ +
+
+ + + + +
    + + +
  1. +
    + + +
    +
    1
    +
    +
    + + Dans un + saladier + , mélanger la + chair à saucisse bœuf et porc + , le + sel + , une pincée de + poivre + , du + persil plat + et le + paprika + . +
    + +
    + + + chair à saucisse bœuf et porc: 450 g, + + + + sel: 3 g, + + + + poivre, + + + + persil plat (ciselé), + + + + paprika: 7 g + + +
    + +
    +
    +
    +
  2. + + + +
  3. +
    + + +
    +
    2
    +
    +
    + + Couper une + bouteille en plastique d'1,5 L + en deux : c'est le poussoir à saucisses. +
    + +
    +
    +
    +
  4. + + + +
  5. +
    + + +
    +
    3
    +
    +
    + + Transvaser la farce dans la moitié haute de la bouteille. Planter une + pique à brochette + dans le goulot. +
    + +
    +
    +
    +
  6. + + + +
  7. +
    + + +
    +
    4
    +
    +
    + + Retourner la moitié basse de la bouteille et l'enfoncer dans la partie ouverte, pour pousser la farce vers le goulot. +
    + +
    +
    +
    +
  8. + + + +
  9. +
    + + +
    +
    5
    +
    +
    + + Chauffer une + sauteuse + à feu moyen et cuire les saucisses à cœur. +
    + +
    +
    +
    +
  10. + + + +
  11. +
    + + +
    +
    6
    +
    +
    + + Garnir un + pain à hot-dog + de + salade + , ajouter de la + salsa + , puis la saucisse, et enfin + ketchup + et + moutarde + selon l'envie. +
    + +
    + + + pain à hot-dog, + + + + salade, + + + + salsa, + + + + ketchup, + + + + moutarde + + +
    + +
    +
    +
    +
  12. + + +
+ +
+
+
+
+ + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 0000000..ea7a5a2 --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,38 @@ + + + + https://pub.sqrt.fr/vincent/recipes/ + + + https://pub.sqrt.fr/vincent/recipes/recipe/cuisses_poulet_four.html + 2026-08-17 + + + https://pub.sqrt.fr/vincent/recipes/recipe/galette_lentilles.html + 2026-08-17 + + + https://pub.sqrt.fr/vincent/recipes/recipe/legumes_rotis.html + 2026-08-17 + + + https://pub.sqrt.fr/vincent/recipes/recipe/mi-cuit_chocolat.html + 2026-08-17 + + + https://pub.sqrt.fr/vincent/recipes/recipe/poisson_papillote.html + 2026-08-17 + + + https://pub.sqrt.fr/vincent/recipes/recipe/porc_effiloche.html + 2026-08-17 + + + https://pub.sqrt.fr/vincent/recipes/recipe/ratatouille.html + 2026-08-17 + + + https://pub.sqrt.fr/vincent/recipes/recipe/saucisses.html + 2026-08-17 + + diff --git a/static/android-chrome-128x128.png b/static/android-chrome-128x128.png new file mode 100644 index 0000000..45a375a Binary files /dev/null and b/static/android-chrome-128x128.png differ diff --git a/static/android-chrome-144x144.png b/static/android-chrome-144x144.png new file mode 100644 index 0000000..e1181b8 Binary files /dev/null and b/static/android-chrome-144x144.png differ diff --git a/static/android-chrome-192x192-maskable.png b/static/android-chrome-192x192-maskable.png new file mode 100644 index 0000000..cf32e78 Binary files /dev/null and b/static/android-chrome-192x192-maskable.png differ diff --git a/static/android-chrome-192x192.png b/static/android-chrome-192x192.png new file mode 100644 index 0000000..b4ac5cd Binary files /dev/null and b/static/android-chrome-192x192.png differ diff --git a/static/android-chrome-256x256.png b/static/android-chrome-256x256.png new file mode 100644 index 0000000..2ba435b Binary files /dev/null and b/static/android-chrome-256x256.png differ diff --git a/static/android-chrome-384x384.png b/static/android-chrome-384x384.png new file mode 100644 index 0000000..3cff4ad Binary files /dev/null and b/static/android-chrome-384x384.png differ diff --git a/static/android-chrome-512x512-maskable.png b/static/android-chrome-512x512-maskable.png new file mode 100644 index 0000000..d40ca4e Binary files /dev/null and b/static/android-chrome-512x512-maskable.png differ diff --git a/static/android-chrome-512x512.png b/static/android-chrome-512x512.png new file mode 100644 index 0000000..676b79a Binary files /dev/null and b/static/android-chrome-512x512.png differ diff --git a/static/apple-touch-icon.png b/static/apple-touch-icon.png new file mode 100644 index 0000000..a153965 Binary files /dev/null and b/static/apple-touch-icon.png differ diff --git a/static/css/cooking-mode.css b/static/css/cooking-mode.css new file mode 100644 index 0000000..848030b --- /dev/null +++ b/static/css/cooking-mode.css @@ -0,0 +1,429 @@ +/* Cooking Mode Overlay */ +.cooking-overlay { + position: fixed; + inset: 0; + z-index: 9999; + background: #1a1a2e; + color: #e0e0e0; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; + display: flex; + flex-direction: column; + overflow: hidden; + user-select: none; + -webkit-user-select: none; +} + +/* Header bar */ +.cooking-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 12px 20px; + background: rgba(0, 0, 0, 0.3); + flex-shrink: 0; + gap: 12px; + z-index: 2; +} + +.cooking-header-title { + font-size: 16px; + font-weight: 600; + color: #fff; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + flex-shrink: 1; + min-width: 0; +} + +.cooking-header-sections { + display: flex; + gap: 8px; + overflow-x: auto; + flex-shrink: 0; + -webkit-overflow-scrolling: touch; + scrollbar-width: none; +} + +.cooking-header-sections::-webkit-scrollbar { + display: none; +} + +.cooking-section-pill { + padding: 6px 14px; + border-radius: 20px; + font-size: 13px; + font-weight: 500; + white-space: nowrap; + cursor: pointer; + background: rgba(255, 255, 255, 0.1); + color: rgba(255, 255, 255, 0.7); + border: 1px solid rgba(255, 255, 255, 0.15); + transition: all 0.2s; +} + +.cooking-section-pill:hover { + background: rgba(255, 255, 255, 0.15); +} + +.cooking-section-pill.active { + background: linear-gradient(135deg, #f97316, #eab308); + color: #fff; + border-color: transparent; +} + +.cooking-close-btn { + width: 40px; + height: 40px; + border-radius: 50%; + background: rgba(255, 255, 255, 0.1); + border: none; + color: #fff; + font-size: 20px; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; + transition: background 0.2s; +} + +.cooking-close-btn:hover { + background: rgba(255, 255, 255, 0.2); +} + +/* Carousel container */ +.cooking-carousel { + flex: 1; + position: relative; + overflow: hidden; + display: flex; + align-items: center; + justify-content: center; +} + +/* Card positioning */ +.cooking-card-container { + position: relative; + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.cooking-card { + position: absolute; + width: calc(100% - 40px); + max-width: 800px; + max-height: 70vh; + overflow-y: auto; + overflow-x: hidden; + -webkit-overflow-scrolling: touch; + border-radius: 20px; + padding: 32px; + transition: transform 0.3s ease-out, opacity 0.3s ease-out; + scrollbar-width: thin; + scrollbar-color: rgba(255,255,255,0.2) transparent; +} + +.cooking-card::-webkit-scrollbar { + width: 4px; +} + +.cooking-card::-webkit-scrollbar-thumb { + background: rgba(255,255,255,0.2); + border-radius: 2px; +} + +.cooking-card.current { + opacity: 1; + transform: translateY(0) scale(1); + z-index: 1; + touch-action: pan-y; +} + +.cooking-card.prev { + opacity: 0.25; + transform: translateY(-75%) scale(0.85); + z-index: 0; + cursor: pointer; +} + +.cooking-card.next { + opacity: 0.25; + transform: translateY(75%) scale(0.85); + z-index: 0; + cursor: pointer; +} + +.cooking-card.hidden-card { + opacity: 0; + transform: translateY(100%) scale(0.8); + pointer-events: none; +} + +/* Swipe animation */ +.cooking-card.swiping { + transition: none; +} + +/* Section header card */ +.cooking-card-section { + background: linear-gradient(135deg, #1e293b, #0f172a); + border: 1px solid rgba(255, 255, 255, 0.1); + text-align: center; +} + +.cooking-card-section h2 { + font-size: 32px; + font-weight: 700; + margin-bottom: 24px; + background: linear-gradient(135deg, #f97316, #eab308); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; +} + +.cooking-mise-grid { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); + gap: 12px; + text-align: left; +} + +.cooking-mise-item { + display: flex; + justify-content: space-between; + align-items: baseline; + padding: 8px 12px; + background: rgba(255, 255, 255, 0.05); + border-radius: 10px; + gap: 8px; + cursor: pointer; + transition: opacity 0.2s; +} + +.cooking-mise-item.checked { + opacity: 0.35; + text-decoration: line-through; +} + +.cooking-mise-name { + font-size: 18px; + color: #e0e0e0; +} + +.cooking-mise-note { + font-size: 14px; + color: rgba(255, 255, 255, 0.5); + font-style: italic; +} + +.cooking-mise-qty { + font-size: 16px; + font-weight: 600; + color: #f97316; + white-space: nowrap; +} + +/* Step card */ +.cooking-card-step { + background: linear-gradient(135deg, #1e293b, #162032); + border: 1px solid rgba(255, 255, 255, 0.1); +} + +.cooking-step-number { + display: inline-flex; + align-items: center; + justify-content: center; + width: 28px; + height: 28px; + border-radius: 50%; + background: linear-gradient(135deg, #f97316, #eab308); + color: #fff; + font-weight: 700; + font-size: 13px; + margin-right: 8px; + flex-shrink: 0; + vertical-align: middle; +} + +.cooking-step-image { + width: 100%; + max-height: 300px; + object-fit: cover; + border-radius: 12px; + margin-bottom: 16px; +} + +.cooking-step-text { + font-size: 24px; + line-height: 1.6; + color: #f0f0f0; +} + +/* Override badge styles within cooking mode for readability */ +.cooking-step-text .ingredient-badge { + font-size: 22px; + padding: 2px 10px; +} + +.cooking-step-text .cookware-badge { + font-size: 22px; + padding: 2px 10px; +} + +.cooking-step-text .timer-badge { + font-size: 22px; + padding: 2px 10px; +} + +.cooking-step-ingredients { + margin-top: 20px; + padding-top: 16px; + border-top: 1px solid rgba(255, 255, 255, 0.1); + font-size: 15px; + color: rgba(255, 255, 255, 0.5); +} + +.cooking-step-ingredients span { + margin-right: 12px; +} + +/* Done card */ +.cooking-card-done { + background: linear-gradient(135deg, #1e293b, #0f172a); + border: 1px solid rgba(255, 255, 255, 0.1); + text-align: center; +} + +.cooking-card-done h2 { + font-size: 36px; + margin-bottom: 12px; +} + +.cooking-card-done p { + font-size: 20px; + color: rgba(255, 255, 255, 0.6); +} + +.cooking-done-close-btn { + margin-top: 28px; + padding: 12px 40px; + border-radius: 12px; + border: none; + background: linear-gradient(135deg, #f97316, #eab308); + color: #fff; + font-size: 18px; + font-weight: 600; + cursor: pointer; + transition: opacity 0.2s; +} + +.cooking-done-close-btn:hover { + opacity: 0.85; +} + +/* Progress bar */ +.cooking-progress { + height: 3px; + background: rgba(255, 255, 255, 0.1); + flex-shrink: 0; +} + +.cooking-progress-bar { + height: 100%; + background: linear-gradient(90deg, #f97316, #eab308); + transition: width 0.3s ease-out; +} + +/* Responsive */ +@media (max-width: 640px) { + .cooking-header { + padding: 10px 12px; + gap: 8px; + } + + .cooking-header-sections { + flex-shrink: 1; + min-width: 0; + } + + .cooking-section-pill { + padding: 4px 10px; + font-size: 12px; + } + + .cooking-header-title { + font-size: 14px; + } + + .cooking-card { + width: calc(100% - 24px); + padding: 20px 16px; + max-height: 75vh; + border-radius: 16px; + } + + .cooking-card-section h2 { + font-size: 24px; + margin-bottom: 16px; + } + + .cooking-step-text { + font-size: 18px; + line-height: 1.5; + } + + .cooking-step-text .ingredient-badge, + .cooking-step-text .cookware-badge, + .cooking-step-text .timer-badge { + font-size: 16px; + padding: 1px 8px; + white-space: normal; + } + + .cooking-step-ingredients { + font-size: 13px; + } + + .cooking-mise-grid { + grid-template-columns: 1fr; + gap: 8px; + } + + .cooking-mise-name { + font-size: 15px; + } + + .cooking-mise-qty { + font-size: 14px; + } + + .cooking-mise-item { + padding: 6px 10px; + } + + .cooking-card-done h2 { + font-size: 28px; + } + + .cooking-done-close-btn { + padding: 10px 32px; + font-size: 16px; + } + + .cooking-close-btn { + width: 36px; + height: 36px; + font-size: 18px; + } +} + +@media (min-width: 1024px) { + .cooking-step-text { + font-size: 28px; + } +} diff --git a/static/css/custom-styles.css b/static/css/custom-styles.css new file mode 100644 index 0000000..99f03af --- /dev/null +++ b/static/css/custom-styles.css @@ -0,0 +1,146 @@ +/* Custom styles to enhance Tailwind */ +:root { + --primary-orange: #ff6b35; + --primary-green: #4ade80; + --light-orange: #fed7aa; + --light-blue: #dbeafe; + --light-green: #dcfce7; + --light-yellow: #fef3c7; +} + +/* Recipe cards with colorful borders */ +.recipe-card { + position: relative; + overflow: hidden; +} + +.recipe-card::before { + content: ''; + position: absolute; + top: 0; + left: 0; + right: 0; + height: 4px; + background: linear-gradient(90deg, #ff6b35, #fbbf24, #4ade80); +} + +/* Ingredient badges */ +.ingredient-badge { + background: linear-gradient(135deg, #fef3c7, #fed7aa); + border: 1px solid #fbbf24; + white-space: nowrap; +} + +.cookware-badge { + background: linear-gradient(135deg, #dcfce7, #bbf7d0); + border: 1px solid #4ade80; + white-space: nowrap; +} + +.timer-badge { + background: linear-gradient(135deg, #fee2e2, #fecaca); + border: 1px solid #f87171; + white-space: nowrap; +} + +/* Enhanced buttons */ +.btn-primary { + background: linear-gradient(135deg, #ff6b35, #f97316); + box-shadow: 0 4px 14px 0 rgba(255, 107, 53, 0.3); +} + +.btn-primary:hover { + transform: translateY(-2px); + box-shadow: 0 6px 20px 0 rgba(255, 107, 53, 0.4); +} + +/* Search input with colorful focus */ +.search-input:focus { + border-color: #ff6b35; + box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1); +} + +/* Recipe image placeholder with gradient */ +.recipe-image-placeholder { + background: linear-gradient(135deg, #ff6b35, #fbbf24); + width: 120px; + height: 120px; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + color: white; + font-size: 3rem; +} + +/* Step numbers with colorful circles */ +.step-number { + width: 32px; + height: 32px; + background: linear-gradient(135deg, #ff6b35, #f97316); + color: white; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + font-weight: bold; + flex-shrink: 0; +} + +/* Tags styling */ +.tag { + display: inline-block; + padding: 0.25rem 0.75rem; + border-radius: 9999px; + font-size: 0.75rem; + font-weight: 500; + margin-right: 0.5rem; + background: linear-gradient(135deg, #fbbf24, #fb923c); + color: white; + box-shadow: 0 2px 4px rgba(251, 146, 60, 0.2); +} + +/* Navigation pills */ +.nav-pill { + padding: 0.5rem 1.25rem; + border-radius: 9999px; + transition: all 0.3s; + font-weight: 500; + color: #6b7280; + position: relative; +} + +.nav-pill:hover { + background: linear-gradient(135deg, #fef3c7, #fed7aa); + color: #ea580c; + transform: translateY(-2px); + box-shadow: 0 4px 6px rgba(234, 88, 12, 0.1); +} + +.nav-pill.active { + background: linear-gradient(135deg, #ff6b35, #f97316); + color: white; + font-weight: 700; + box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3); +} + +/* Recipe metadata pills */ +.metadata-pill { + display: inline-flex; + align-items: center; + padding: 0.375rem 0.875rem; + border-radius: 9999px; + background: linear-gradient(135deg, #f9fafb, #f3f4f6); + border: 1px solid #e5e7eb; + font-size: 0.875rem; + color: #374151; + font-weight: 500; + line-height: 1.25rem; + white-space: nowrap; +} + +.metadata-pill svg { + width: 1rem; + height: 1rem; + margin-right: 0.5rem; +} \ No newline at end of file diff --git a/static/css/input.css b/static/css/input.css new file mode 100644 index 0000000..cace11d --- /dev/null +++ b/static/css/input.css @@ -0,0 +1,217 @@ +@import "tailwindcss"; + +/* Tailwind v4 is CSS-first and no longer auto-discovers tailwind.config.js. + @config keeps the existing JS config (custom colours, gradient keyframes, + darkMode: 'class' and the content globs) authoritative. */ +@config "../../tailwind.config.js"; + +/* Custom component classes */ +@layer components { + /* Recipe cards with colorful borders */ + .recipe-card { + @apply relative overflow-hidden; + } + + .recipe-card::before { + content: ''; + @apply absolute top-0 left-0 right-0 h-1; + background: linear-gradient(90deg, #ff6b35, #fbbf24, #4ade80); + } + + /* Ingredient badges */ + .ingredient-badge { + @apply inline-block align-middle px-2 py-0.5 rounded-full text-sm font-medium whitespace-nowrap; + background: linear-gradient(135deg, #fef3c7, #fed7aa); + @apply text-orange-700 border border-orange-400; + } + + .cookware-badge { + @apply inline-block align-middle px-2 py-0.5 rounded-full text-sm font-medium whitespace-nowrap; + background: linear-gradient(135deg, #dcfce7, #bbf7d0); + @apply text-green-900 border border-green-400; + } + + .timer-badge { + @apply inline-block align-middle px-2 py-0.5 rounded-full text-sm font-medium whitespace-nowrap; + background: linear-gradient(135deg, #fee2e2, #fecaca); + @apply text-red-900 border border-red-400; + } + + /* Enhanced buttons */ + .btn-primary { + background: linear-gradient(135deg, #ff6b35, #f97316); + @apply shadow-lg hover:-translate-y-0.5 transition-all; + } + + .btn-primary:hover { + box-shadow: 0 6px 20px 0 rgba(255, 107, 53, 0.4); + } + + /* Step numbers with colorful circles */ + .step-number { + @apply w-8 h-8 flex items-center justify-center rounded-full text-white font-bold shrink-0; + background: linear-gradient(135deg, #ff6b35, #f97316); + } + + /* Tags styling */ + .tag { + @apply inline-block px-3 py-1 rounded-full text-xs font-medium mr-2; + background: linear-gradient(135deg, #fbbf24, #fb923c); + @apply text-white shadow-xs; + } + + /* Navigation pills */ + .nav-pill { + @apply px-5 py-2 rounded-full transition-all font-medium text-gray-500 relative; + } + + .nav-pill:hover { + background: linear-gradient(135deg, #fef3c7, #fed7aa); + @apply text-orange-700 -translate-y-0.5 shadow-md; + } + + .nav-pill.active { + background: linear-gradient(135deg, #ff6b35, #f97316); + @apply text-white font-bold shadow-lg; + } + + /* Recipe metadata pills - simple outline style */ + .metadata-pill { + @apply inline-flex items-center px-3 py-1 rounded-full text-sm font-medium whitespace-nowrap border bg-white; + } + + .metadata-servings { + @apply text-gray-600 border-gray-300; + } + + .metadata-time { + @apply text-blue-600 border-blue-300; + } + + .metadata-difficulty { + @apply text-yellow-600 border-yellow-300; + } + + .metadata-course { + @apply text-orange-600 border-orange-300; + } + + .metadata-prep { + @apply text-indigo-600 border-indigo-300; + } + + .metadata-cook { + @apply text-red-600 border-red-300; + } + + .metadata-cuisine { + @apply text-green-600 border-green-300; + } + + .metadata-diet { + @apply text-lime-600 border-lime-300; + } + + .metadata-author { + @apply text-pink-600 border-pink-300; + } + + .metadata-custom { + @apply text-purple-600 border-purple-300; + } + + /* Search input with colorful focus */ + .search-input:focus { + @apply border-primary-orange; + box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1); + } + + /* Step images in recipes */ + .image-step { + @apply w-full max-h-80 object-contain rounded-xl; + } + + /* Recipe image placeholder with gradient */ + .recipe-image-placeholder { + background: linear-gradient(135deg, #ff6b35, #fbbf24); + @apply w-30 h-30 rounded-full flex items-center justify-center text-white text-5xl; + } + + /* Pantry item styles with improved dark mode support */ + .pantry-item { + @apply bg-gray-50 dark:bg-gray-800; + } + + .pantry-item:hover { + @apply bg-gray-100 dark:bg-gray-700; + } + + /* Out-of-stock pantry items with better dark mode contrast */ + .pantry-item.out-of-stock { + @apply bg-red-50 border border-red-200 dark:bg-red-950/30 dark:border-red-900/50; + } + + .pantry-item.out-of-stock:hover { + @apply bg-red-100 dark:bg-red-950/40; + } + + /* Pantry text colors for dark mode */ + .pantry-item .text-gray-900 { + @apply dark:text-gray-100; + } + + .pantry-item .text-gray-600 { + @apply dark:text-gray-400; + } + + .pantry-item .text-gray-500 { + @apply dark:text-gray-400; + } + + /* Out-of-stock text in dark mode */ + .pantry-item.out-of-stock .quantity-display { + @apply text-red-600 dark:text-red-400; + } + + /* Status dots with dark mode support */ + .item-status-dot.in-stock { + @apply bg-green-500 dark:bg-green-400; + } + + .item-status-dot.out-of-stock { + @apply bg-red-500 dark:bg-red-400; + } + + /* CodeMirror editor dark mode support */ + .dark .cm-editor { + @apply bg-gray-900; + } + + .dark .cm-gutters { + @apply bg-gray-800 border-gray-700; + } + + .dark .cm-lineNumbers .cm-gutterElement { + @apply text-gray-400; + } + + .dark .cm-activeLineGutter { + @apply bg-gray-700; + } + + .dark .cm-activeLine { + @apply bg-gray-800/50; + } + + .dark .cm-content { + caret-color: white; + } + + .dark .cm-cursor { + border-left-color: white; + } + + .dark .cm-selectionBackground { + @apply bg-blue-800/50!; + } +} \ No newline at end of file diff --git a/static/css/output.css b/static/css/output.css new file mode 100644 index 0000000..0880ad0 --- /dev/null +++ b/static/css/output.css @@ -0,0 +1,2 @@ +/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-red-950:oklch(25.8% .092 26.042);--color-orange-50:oklch(98% .016 73.684);--color-orange-100:oklch(95.4% .038 75.164);--color-orange-200:oklch(90.1% .076 70.697);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-orange-700:oklch(55.3% .195 38.402);--color-orange-800:oklch(47% .157 37.304);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-600:oklch(68.1% .162 75.834);--color-lime-300:oklch(89.7% .196 126.665);--color-lime-600:oklch(64.8% .2 131.684);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-green-900:oklch(39.3% .095 152.535);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-cyan-50:oklch(98.4% .019 200.873);--color-cyan-500:oklch(71.5% .143 215.221);--color-cyan-600:oklch(60.9% .126 221.723);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-blue-900:oklch(37.9% .146 265.522);--color-indigo-50:oklch(96.2% .018 272.314);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-600:oklch(51.1% .262 276.966);--color-purple-50:oklch(97.7% .014 308.299);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-200:oklch(90.2% .063 306.703);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-600:oklch(55.8% .288 302.321);--color-purple-700:oklch(49.6% .265 301.924);--color-purple-800:oklch(43.8% .218 303.724);--color-purple-900:oklch(38.1% .176 304.987);--color-pink-50:oklch(97.1% .014 343.198);--color-pink-100:oklch(94.8% .028 342.258);--color-pink-300:oklch(82.3% .12 346.018);--color-pink-500:oklch(65.6% .241 354.308);--color-pink-600:oklch(59.2% .249 .584);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-neutral-50:oklch(98.5% 0 none);--color-neutral-100:oklch(97% 0 none);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-xl:36rem;--container-2xl:42rem;--container-4xl:56rem;--container-5xl:64rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--text-5xl:3rem;--text-5xl--line-height:1;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-wide:.025em;--tracking-widest:.1em;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-out:cubic-bezier(0, 0, .2, 1);--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components{.recipe-card{position:relative;overflow:hidden}.recipe-card:before{content:"";height:var(--spacing);background:linear-gradient(90deg,#ff6b35,#fbbf24,#4ade80);position:absolute;top:0;left:0;right:0}.ingredient-badge{padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * .5);vertical-align:middle;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);white-space:nowrap;border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-orange-400);color:var(--color-orange-700);background:linear-gradient(135deg,#fef3c7,#fed7aa);border-radius:3.40282e38px;display:inline-block}.cookware-badge{padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * .5);vertical-align:middle;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);white-space:nowrap;border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-green-400);color:var(--color-green-900);background:linear-gradient(135deg,#dcfce7,#bbf7d0);border-radius:3.40282e38px;display:inline-block}.timer-badge{padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * .5);vertical-align:middle;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);white-space:nowrap;border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-red-400);color:var(--color-red-900);background:linear-gradient(135deg,#fee2e2,#fecaca);border-radius:3.40282e38px;display:inline-block}.btn-primary{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));background:linear-gradient(135deg,#ff6b35,#f97316)}@media (hover:hover){.btn-primary:hover{--tw-translate-y:calc(var(--spacing) * -.5);translate:var(--tw-translate-x) var(--tw-translate-y)}}.btn-primary:hover{box-shadow:0 6px 20px #ff6b3566}.step-number{height:calc(var(--spacing) * 8);width:calc(var(--spacing) * 8);--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold);color:var(--color-white);background:linear-gradient(135deg,#ff6b35,#f97316);border-radius:3.40282e38px;flex-shrink:0;justify-content:center;align-items:center;display:flex}.tag{margin-right:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 3);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-white);--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);background:linear-gradient(135deg,#fbbf24,#fb923c);border-radius:3.40282e38px;display:inline-block}.nav-pill{padding-inline:calc(var(--spacing) * 5);padding-block:calc(var(--spacing) * 2);--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-gray-500);transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-radius:3.40282e38px;position:relative}.nav-pill:hover{--tw-translate-y:calc(var(--spacing) * -.5);translate:var(--tw-translate-x) var(--tw-translate-y);color:var(--color-orange-700);--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);background:linear-gradient(135deg,#fef3c7,#fed7aa)}.nav-pill.active{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold);color:var(--color-white);--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);background:linear-gradient(135deg,#ff6b35,#f97316)}.metadata-pill{border-style:var(--tw-border-style);background-color:var(--color-white);padding-inline:calc(var(--spacing) * 3);padding-block:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);white-space:nowrap;border-width:1px;border-radius:3.40282e38px;align-items:center;display:inline-flex}.metadata-servings{border-color:var(--color-gray-300);color:var(--color-gray-600)}.metadata-time{border-color:var(--color-blue-300);color:var(--color-blue-600)}.metadata-difficulty{border-color:var(--color-yellow-300);color:var(--color-yellow-600)}.metadata-course{border-color:var(--color-orange-300);color:var(--color-orange-600)}.metadata-prep{border-color:var(--color-indigo-300);color:var(--color-indigo-600)}.metadata-cook{border-color:var(--color-red-300);color:var(--color-red-600)}.metadata-cuisine{border-color:var(--color-green-300);color:var(--color-green-600)}.metadata-diet{border-color:var(--color-lime-300);color:var(--color-lime-600)}.metadata-author{border-color:var(--color-pink-300);color:var(--color-pink-600)}.metadata-custom{border-color:var(--color-purple-300);color:var(--color-purple-600)}.search-input:focus{border-color:#ff6b35;box-shadow:0 0 0 3px #ff6b351a}.image-step{max-height:calc(var(--spacing) * 80);border-radius:var(--radius-xl);object-fit:contain;width:100%}.recipe-image-placeholder{height:calc(var(--spacing) * 30);width:calc(var(--spacing) * 30);font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height));color:var(--color-white);background:linear-gradient(135deg,#ff6b35,#fbbf24);border-radius:3.40282e38px;justify-content:center;align-items:center;display:flex}.pantry-item{background-color:var(--color-gray-50)}.pantry-item:is(.dark *){background-color:var(--color-gray-800)}.pantry-item:hover{background-color:var(--color-gray-100)}.pantry-item:hover:is(.dark *){background-color:var(--color-gray-700)}.pantry-item.out-of-stock{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-red-200);background-color:var(--color-red-50)}.pantry-item.out-of-stock:is(.dark *){border-color:#82181a80}@supports (color:color-mix(in lab, red, red)){.pantry-item.out-of-stock:is(.dark *){border-color:color-mix(in oklab, var(--color-red-900) 50%, transparent)}}.pantry-item.out-of-stock:is(.dark *){background-color:#4608094d}@supports (color:color-mix(in lab, red, red)){.pantry-item.out-of-stock:is(.dark *){background-color:color-mix(in oklab, var(--color-red-950) 30%, transparent)}}.pantry-item.out-of-stock:hover{background-color:var(--color-red-100)}.pantry-item.out-of-stock:hover:is(.dark *){background-color:#46080966}@supports (color:color-mix(in lab, red, red)){.pantry-item.out-of-stock:hover:is(.dark *){background-color:color-mix(in oklab, var(--color-red-950) 40%, transparent)}}.pantry-item .text-gray-900:is(.dark *){color:var(--color-gray-100)}.pantry-item .text-gray-600:is(.dark *),.pantry-item .text-gray-500:is(.dark *){color:var(--color-gray-400)}.pantry-item.out-of-stock .quantity-display{color:var(--color-red-600)}.pantry-item.out-of-stock .quantity-display:is(.dark *){color:var(--color-red-400)}.item-status-dot.in-stock{background-color:var(--color-green-500)}.item-status-dot.in-stock:is(.dark *){background-color:var(--color-green-400)}.item-status-dot.out-of-stock{background-color:var(--color-red-500)}.item-status-dot.out-of-stock:is(.dark *){background-color:var(--color-red-400)}.dark .cm-editor{background-color:var(--color-gray-900)}.dark .cm-gutters{border-color:var(--color-gray-700);background-color:var(--color-gray-800)}.dark .cm-lineNumbers .cm-gutterElement{color:var(--color-gray-400)}.dark .cm-activeLineGutter{background-color:var(--color-gray-700)}.dark .cm-activeLine{background-color:#1e293980}@supports (color:color-mix(in lab, red, red)){.dark .cm-activeLine{background-color:color-mix(in oklab, var(--color-gray-800) 50%, transparent)}}.dark .cm-content{caret-color:#fff}.dark .cm-cursor{border-left-color:#fff}.dark .cm-selectionBackground{background-color:#193cb880!important}@supports (color:color-mix(in lab, red, red)){.dark .cm-selectionBackground{background-color:color-mix(in oklab, var(--color-blue-800) 50%, transparent)!important}}}@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-y-0{inset-block:0}.top-6{top:calc(var(--spacing) * 6)}.top-full{top:100%}.right-0{right:0}.right-4{right:calc(var(--spacing) * 4)}.bottom-4{bottom:calc(var(--spacing) * 4)}.left-0{left:0}.z-50{z-index:50}.order-1{order:1}.order-2{order:2}.order-3{order:3}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-4{margin-inline:calc(var(--spacing) * 4)}.mx-auto{margin-inline:auto}.my-1{margin-block:var(--spacing)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-8{margin-top:calc(var(--spacing) * 8)}.mt-12{margin-top:calc(var(--spacing) * 12)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mr-3{margin-right:calc(var(--spacing) * 3)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.mb-10{margin-bottom:calc(var(--spacing) * 10)}.ml-1{margin-left:var(--spacing)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-8{margin-left:calc(var(--spacing) * 8)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-2{height:calc(var(--spacing) * 2)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-12{height:calc(var(--spacing) * 12)}.h-16{height:calc(var(--spacing) * 16)}.h-48{height:calc(var(--spacing) * 48)}.h-\[calc\(100vh-12rem\)\]{height:calc(100vh - 12rem)}.h-auto{height:auto}.h-full{height:100%}.h-screen{height:100vh}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[60vh\]{max-height:60vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[500px\]{max-height:500px}.min-h-screen{min-height:100vh}.w-2{width:calc(var(--spacing) * 2)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-12{width:calc(var(--spacing) * 12)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-56{width:calc(var(--spacing) * 56)}.w-64{width:calc(var(--spacing) * 64)}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-full{max-width:100%}.max-w-md{max-width:var(--container-md)}.max-w-xl{max-width:var(--container-xl)}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.scale-105{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.scroll-mt-24{scroll-margin-top:calc(var(--spacing) * 24)}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-2{column-gap:calc(var(--spacing) * 2)}:where(.space-x-1>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(var(--spacing) * var(--tw-space-x-reverse));margin-inline-end:calc(var(--spacing) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-3>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 3) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-x-reverse)))}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-l-lg{border-top-left-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.rounded-r-lg{border-top-right-radius:var(--radius-lg);border-bottom-right-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-blue-200{border-color:var(--color-blue-200)}.border-blue-400{border-color:var(--color-blue-400)}.border-blue-600{border-color:var(--color-blue-600)}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-green-200{border-color:var(--color-green-200)}.border-indigo-200{border-color:var(--color-indigo-200)}.border-orange-200{border-color:var(--color-orange-200)}.border-orange-300{border-color:var(--color-orange-300)}.border-orange-400{border-color:var(--color-orange-400)}.border-orange-500{border-color:var(--color-orange-500)}.border-orange-600{border-color:var(--color-orange-600)}.border-orange-800{border-color:var(--color-orange-800)}.border-purple-200{border-color:var(--color-purple-200)}.border-red-200{border-color:var(--color-red-200)}.border-red-300{border-color:var(--color-red-300)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-black{background-color:var(--color-black)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-blue-100{background-color:var(--color-blue-100)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-400{background-color:var(--color-gray-400)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-500{background-color:var(--color-green-500)}.bg-green-600{background-color:var(--color-green-600)}.bg-neutral-50{background-color:var(--color-neutral-50)}.bg-neutral-100{background-color:var(--color-neutral-100)}.bg-orange-50{background-color:var(--color-orange-50)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-600{background-color:var(--color-orange-600)}.bg-orange-700{background-color:var(--color-orange-700)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-500{background-color:var(--color-red-500)}.bg-white{background-color:var(--color-white)}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab, red, red)){.bg-white\/20{background-color:color-mix(in oklab, var(--color-white) 20%, transparent)}}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-blue-50{--tw-gradient-from:var(--color-blue-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-blue-500{--tw-gradient-from:var(--color-blue-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-gray-50{--tw-gradient-from:var(--color-gray-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-gray-600{--tw-gradient-from:var(--color-gray-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-green-50{--tw-gradient-from:var(--color-green-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-green-500{--tw-gradient-from:var(--color-green-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-indigo-50{--tw-gradient-from:var(--color-indigo-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-orange-50{--tw-gradient-from:var(--color-orange-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-orange-400{--tw-gradient-from:var(--color-orange-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-orange-500{--tw-gradient-from:var(--color-orange-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-orange-600{--tw-gradient-from:var(--color-orange-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-50{--tw-gradient-from:var(--color-purple-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-100{--tw-gradient-from:var(--color-purple-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-400{--tw-gradient-from:var(--color-purple-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-500{--tw-gradient-from:var(--color-purple-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-600{--tw-gradient-from:var(--color-purple-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-yellow-100{--tw-gradient-from:var(--color-yellow-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-yellow-400{--tw-gradient-from:var(--color-yellow-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-blue-50{--tw-gradient-to:var(--color-blue-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-blue-600{--tw-gradient-to:var(--color-blue-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-50{--tw-gradient-to:var(--color-cyan-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-500{--tw-gradient-to:var(--color-cyan-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-50{--tw-gradient-to:var(--color-emerald-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-500{--tw-gradient-to:var(--color-emerald-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-gray-700{--tw-gradient-to:var(--color-gray-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-green-600{--tw-gradient-to:var(--color-green-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-indigo-50{--tw-gradient-to:var(--color-indigo-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-orange-50{--tw-gradient-to:var(--color-orange-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-orange-100{--tw-gradient-to:var(--color-orange-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-orange-500{--tw-gradient-to:var(--color-orange-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-orange-600{--tw-gradient-to:var(--color-orange-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-50{--tw-gradient-to:var(--color-pink-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-100{--tw-gradient-to:var(--color-pink-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-500{--tw-gradient-to:var(--color-pink-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-600{--tw-gradient-to:var(--color-pink-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-purple-50{--tw-gradient-to:var(--color-purple-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-red-500{--tw-gradient-to:var(--color-red-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-yellow-50{--tw-gradient-to:var(--color-yellow-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-yellow-600{--tw-gradient-to:var(--color-yellow-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-1{padding:var(--spacing)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-1{padding-inline:var(--spacing)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-6{padding-left:calc(var(--spacing) * 6)}.pl-10{padding-left:calc(var(--spacing) * 10)}.text-center{text-align:center}.text-left{text-align:left}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-8{--tw-leading:calc(var(--spacing) * 8);line-height:calc(var(--spacing) * 8)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-800{color:var(--color-amber-800)}.text-blue-300{color:var(--color-blue-300)}.text-blue-400{color:var(--color-blue-400)}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-blue-700{color:var(--color-blue-700)}.text-blue-800{color:var(--color-blue-800)}.text-blue-900{color:var(--color-blue-900)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-green-800{color:var(--color-green-800)}.text-indigo-600{color:var(--color-indigo-600)}.text-orange-500{color:var(--color-orange-500)}.text-orange-600{color:var(--color-orange-600)}.text-orange-700{color:var(--color-orange-700)}.text-purple-400{color:var(--color-purple-400)}.text-purple-600{color:var(--color-purple-600)}.text-purple-700{color:var(--color-purple-700)}.text-purple-800{color:var(--color-purple-800)}.text-purple-900{color:var(--color-purple-900)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-transparent{color:#0000}.text-white{color:var(--color-white)}.text-yellow-400{color:var(--color-yellow-400)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.italic{font-style:italic}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.decoration-gray-300{-webkit-text-decoration-color:var(--color-gray-300);-webkit-text-decoration-color:var(--color-gray-300);text-decoration-color:var(--color-gray-300)}.placeholder-gray-500::placeholder{color:var(--color-gray-500)}.opacity-0{opacity:0}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.outline-hidden{outline-offset:2px;outline:2px solid #0000}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}@media (hover:hover){.group-hover\:text-gray-800:is(:where(.group):hover *){color:var(--color-gray-800)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media (hover:hover){.hover\:-translate-y-0\.5:hover{--tw-translate-y:calc(var(--spacing) * -.5);translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:border-orange-400:hover{border-color:var(--color-orange-400)}.hover\:border-red-400:hover{border-color:var(--color-red-400)}.hover\:bg-blue-50:hover{background-color:var(--color-blue-50)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-gray-300:hover{background-color:var(--color-gray-300)}.hover\:bg-gray-500:hover{background-color:var(--color-gray-500)}.hover\:bg-green-600:hover{background-color:var(--color-green-600)}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-orange-50:hover{background-color:var(--color-orange-50)}.hover\:bg-orange-700:hover{background-color:var(--color-orange-700)}.hover\:bg-orange-800:hover{background-color:var(--color-orange-800)}.hover\:bg-purple-50:hover{background-color:var(--color-purple-50)}.hover\:bg-red-50:hover{background-color:var(--color-red-50)}.hover\:bg-red-200:hover{background-color:var(--color-red-200)}.hover\:bg-red-600:hover{background-color:var(--color-red-600)}.hover\:bg-gradient-to-r:hover{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.hover\:from-blue-600:hover{--tw-gradient-from:var(--color-blue-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:from-gray-700:hover{--tw-gradient-from:var(--color-gray-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:from-green-600:hover{--tw-gradient-from:var(--color-green-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:from-orange-600:hover{--tw-gradient-from:var(--color-orange-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:from-purple-50:hover{--tw-gradient-from:var(--color-purple-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:from-purple-600:hover{--tw-gradient-from:var(--color-purple-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:to-cyan-600:hover{--tw-gradient-to:var(--color-cyan-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:to-emerald-600:hover{--tw-gradient-to:var(--color-emerald-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:to-gray-800:hover{--tw-gradient-to:var(--color-gray-800);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:to-pink-50:hover{--tw-gradient-to:var(--color-pink-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:to-pink-600:hover{--tw-gradient-to:var(--color-pink-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:to-red-600:hover{--tw-gradient-to:var(--color-red-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:text-blue-700:hover{color:var(--color-blue-700)}.hover\:text-blue-800:hover{color:var(--color-blue-800)}.hover\:text-gray-700:hover{color:var(--color-gray-700)}.hover\:text-gray-800:hover{color:var(--color-gray-800)}.hover\:text-gray-900:hover{color:var(--color-gray-900)}.hover\:text-orange-600:hover{color:var(--color-orange-600)}.hover\:text-orange-700:hover{color:var(--color-orange-700)}.hover\:text-orange-800:hover{color:var(--color-orange-800)}.hover\:text-purple-800:hover{color:var(--color-purple-800)}.hover\:text-red-600:hover{color:var(--color-red-600)}.hover\:text-red-700:hover{color:var(--color-red-700)}.hover\:underline:hover{text-decoration-line:underline}.hover\:decoration-orange-400:hover{-webkit-text-decoration-color:var(--color-orange-400);-webkit-text-decoration-color:var(--color-orange-400);text-decoration-color:var(--color-orange-400)}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}.focus\:border-orange-500:focus{border-color:var(--color-orange-500)}.focus\:border-purple-500:focus{border-color:var(--color-purple-500)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\:ring-orange-500:focus{--tw-ring-color:var(--color-orange-500)}.focus\:ring-purple-200:focus{--tw-ring-color:var(--color-purple-200)}.focus\:ring-purple-300:focus{--tw-ring-color:var(--color-purple-300)}.focus\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.focus\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}@media (min-width:40rem){.sm\:mx-auto{margin-inline:auto}.sm\:w-full{width:100%}.sm\:max-w-md{max-width:var(--container-md)}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:self-center{align-self:center}.sm\:rounded-lg{border-radius:var(--radius-lg)}.sm\:px-6{padding-inline:calc(var(--spacing) * 6)}.sm\:px-8{padding-inline:calc(var(--spacing) * 8)}.sm\:px-10{padding-inline:calc(var(--spacing) * 10)}}@media (min-width:48rem){.md\:col-span-1{grid-column:span 1/span 1}.md\:col-span-2{grid-column:span 2/span 2}.md\:mr-4{margin-right:calc(var(--spacing) * 4)}.md\:ml-2{margin-left:calc(var(--spacing) * 2)}.md\:flex{display:flex}.md\:hidden{display:none}.md\:inline-flex{display:inline-flex}.md\:w-auto{width:auto}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:justify-between{justify-content:space-between}.md\:text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}}@media (min-width:64rem){.lg\:mr-4{margin-right:calc(var(--spacing) * 4)}.lg\:inline{display:inline}.lg\:h-5{height:calc(var(--spacing) * 5)}.lg\:w-2\/5{width:40%}.lg\:w-5{width:calc(var(--spacing) * 5)}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:gap-2{gap:calc(var(--spacing) * 2)}.lg\:gap-3{gap:calc(var(--spacing) * 3)}.lg\:px-4{padding-inline:calc(var(--spacing) * 4)}.lg\:px-5{padding-inline:calc(var(--spacing) * 5)}.lg\:px-6{padding-inline:calc(var(--spacing) * 6)}.lg\:px-8{padding-inline:calc(var(--spacing) * 8)}.lg\:px-12{padding-inline:calc(var(--spacing) * 12)}.lg\:text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}}@media (min-width:80rem){.xl\:w-1\/3{width:33.3333%}.xl\:px-16{padding-inline:calc(var(--spacing) * 16)}}.dark\:block:is(.dark *){display:block}.dark\:hidden:is(.dark *){display:none}.dark\:border-gray-600:is(.dark *){border-color:var(--color-gray-600)}.dark\:border-gray-700:is(.dark *){border-color:var(--color-gray-700)}.dark\:bg-amber-900:is(.dark *){background-color:var(--color-amber-900)}.dark\:bg-blue-900:is(.dark *){background-color:var(--color-blue-900)}.dark\:bg-gray-200:is(.dark *){background-color:var(--color-gray-200)}.dark\:bg-gray-700:is(.dark *){background-color:var(--color-gray-700)}.dark\:bg-gray-800:is(.dark *){background-color:var(--color-gray-800)}.dark\:bg-gray-900:is(.dark *){background-color:var(--color-gray-900)}.dark\:bg-green-900:is(.dark *){background-color:var(--color-green-900)}.dark\:bg-purple-900:is(.dark *){background-color:var(--color-purple-900)}.dark\:bg-red-900:is(.dark *){background-color:var(--color-red-900)}.dark\:from-gray-800:is(.dark *){--tw-gradient-from:var(--color-gray-800);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.dark\:to-gray-800:is(.dark *){--tw-gradient-to:var(--color-gray-800);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.dark\:p-0\.5:is(.dark *){padding:calc(var(--spacing) * .5)}.dark\:text-amber-200:is(.dark *){color:var(--color-amber-200)}.dark\:text-blue-200:is(.dark *){color:var(--color-blue-200)}.dark\:text-gray-100:is(.dark *){color:var(--color-gray-100)}.dark\:text-gray-200:is(.dark *){color:var(--color-gray-200)}.dark\:text-gray-300:is(.dark *){color:var(--color-gray-300)}.dark\:text-gray-400:is(.dark *){color:var(--color-gray-400)}.dark\:text-green-200:is(.dark *){color:var(--color-green-200)}.dark\:text-purple-200:is(.dark *){color:var(--color-purple-200)}.dark\:text-red-200:is(.dark *){color:var(--color-red-200)}.dark\:text-red-400:is(.dark *){color:var(--color-red-400)}.dark\:text-white:is(.dark *){color:var(--color-white)}@media (hover:hover){.dark\:group-hover\:text-gray-200:is(.dark *):is(:where(.group):hover *){color:var(--color-gray-200)}.dark\:hover\:bg-gray-600:is(.dark *):hover{background-color:var(--color-gray-600)}.dark\:hover\:bg-gray-700:is(.dark *):hover{background-color:var(--color-gray-700)}.dark\:hover\:text-gray-200:is(.dark *):hover{color:var(--color-gray-200)}}@media print{.print\:mb-1{margin-bottom:var(--spacing)}.print\:block{display:block}.print\:hidden{display:none}.print\:flex-row{flex-direction:row}.print\:items-center{align-items:center}.print\:text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}}}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@keyframes pulse{50%{opacity:.5}} \ No newline at end of file diff --git a/static/css/styles.css b/static/css/styles.css new file mode 100644 index 0000000..127c71d --- /dev/null +++ b/static/css/styles.css @@ -0,0 +1,445 @@ +/* Base styles */ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; + background-color: #f9fafb; + color: #111827; + line-height: 1.5; +} + +/* Layout */ +.viewport { + width: 100%; + max-width: 1024px; + margin: 3rem auto; + padding: 0 1rem; +} + +/* Navigation */ +nav { + background-color: white; + box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1); + border-radius: 0.5rem; + margin-bottom: 1.5rem; +} + +nav > div { + padding: 1rem 1.5rem; +} + +nav .flex { + display: flex; + align-items: center; + justify-content: space-between; +} + +nav a { + text-decoration: none; + color: #4b5563; + transition: color 0.2s; +} + +nav a:hover { + color: #111827; +} + +nav a.font-semibold { + font-weight: 600; + color: #111827; +} + +/* Main content */ +main { + background-color: white; + border-radius: 0.5rem; + box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1); + padding: 1.5rem; +} + +/* Typography */ +h1 { + font-size: 1.5rem; + font-weight: bold; + margin-bottom: 1.5rem; +} + +h2 { + font-size: 1.125rem; + font-weight: 600; + margin-bottom: 0.75rem; +} + +h3 { + font-size: 1.125rem; + font-weight: 500; + margin-bottom: 0.5rem; +} + +/* Forms */ +input[type="text"], +input[type="number"] { + padding: 0.5rem; + border: 1px solid #d1d5db; + border-radius: 0.375rem; + outline: none; +} + +input[type="text"]:focus, +input[type="number"]:focus { + border-color: #3b82f6; + box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); +} + +.search-input { + width: 16rem; + padding: 0.5rem 1rem; +} + +/* Buttons */ +button, +.btn-primary, +.btn-secondary { + padding: 0.5rem 1rem; + border-radius: 0.375rem; + font-weight: 500; + cursor: pointer; + transition: all 0.2s; + border: none; + display: inline-block; +} + +.btn-primary { + background-color: #3b82f6; + color: white; +} + +.btn-primary:hover { + background-color: #2563eb; +} + +.btn-secondary { + background-color: #e5e7eb; + color: #374151; +} + +.btn-secondary:hover { + background-color: #d1d5db; +} + +/* Cards */ +.recipe-card { + background-color: white; + border-radius: 0.5rem; + box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1); + padding: 1rem; + margin-bottom: 1rem; + transition: box-shadow 0.2s; + text-decoration: none; + color: inherit; + display: block; +} + +.recipe-card:hover { + box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); + background-color: #f9fafb; +} + +.recipe-step { + margin-bottom: 1rem; + padding: 0.75rem; + background-color: #f9fafb; + border-radius: 0.375rem; +} + +/* Ingredients and tags */ +.ingredient, +.cookware, +.timer { + display: inline-block; + padding: 0.25rem 0.5rem; + border-radius: 0.25rem; + font-size: 0.875rem; + margin-right: 0.5rem; + margin-bottom: 0.5rem; +} + +.ingredient { + background-color: #dbeafe; + color: #1e40af; +} + +.cookware { + background-color: #d1fae5; + color: #065f46; +} + +.timer { + background-color: #fef3c7; + color: #92400e; +} + +/* Search results dropdown */ +.search-results { + position: absolute; + top: 100%; + margin-top: 0.5rem; + width: 100%; + background-color: white; + border: 1px solid #e5e7eb; + border-radius: 0.5rem; + box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); + max-height: 300px; + overflow-y: auto; +} + +.search-results a { + display: block; + padding: 0.5rem 0.75rem; + text-decoration: none; + color: #111827; +} + +.search-results a:hover { + background-color: #f9fafb; +} + +/* Utility classes */ +.hidden { + display: none; +} + +.flex { + display: flex; +} + +.items-center { + align-items: center; +} + +.justify-between { + justify-content: space-between; +} + +.space-x-2 > * + * { + margin-left: 0.5rem; +} + +.space-x-3 > * + * { + margin-left: 0.75rem; +} + +.space-x-6 > * + * { + margin-left: 1.5rem; +} + +.space-y-1 > * + * { + margin-top: 0.25rem; +} + +.space-y-2 > * + * { + margin-top: 0.5rem; +} + +.space-y-4 > * + * { + margin-top: 1rem; +} + +.mb-2 { + margin-bottom: 0.5rem; +} + +.mb-3 { + margin-bottom: 0.75rem; +} + +.mb-4 { + margin-bottom: 1rem; +} + +.mb-6 { + margin-bottom: 1.5rem; +} + +.ml-2 { + margin-left: 0.5rem; +} + +.mr-2 { + margin-right: 0.5rem; +} + +.mr-4 { + margin-right: 1rem; +} + +.mx-2 { + margin-left: 0.5rem; + margin-right: 0.5rem; +} + +.p-3 { + padding: 0.75rem; +} + +.px-3 { + padding-left: 0.75rem; + padding-right: 0.75rem; +} + +.py-1 { + padding-top: 0.25rem; + padding-bottom: 0.25rem; +} + +.py-2 { + padding-top: 0.5rem; + padding-bottom: 0.5rem; +} + +.text-sm { + font-size: 0.875rem; +} + +.text-lg { + font-size: 1.125rem; +} + +.text-xl { + font-size: 1.25rem; +} + +.text-2xl { + font-size: 1.5rem; +} + +.text-3xl { + font-size: 1.875rem; +} + +.font-medium { + font-weight: 500; +} + +.font-semibold { + font-weight: 600; +} + +.font-bold { + font-weight: 700; +} + +.text-gray-400 { + color: #9ca3af; +} + +.text-gray-500 { + color: #6b7280; +} + +.text-gray-600 { + color: #4b5563; +} + +.text-gray-700 { + color: #374151; +} + +.text-gray-800 { + color: #1f2937; +} + +.text-gray-900 { + color: #111827; +} + +.text-red-600 { + color: #dc2626; +} + +.text-red-800 { + color: #991b1b; +} + +.bg-gray-50 { + background-color: #f9fafb; +} + +.bg-white { + background-color: white; +} + +.rounded { + border-radius: 0.25rem; +} + +.rounded-lg { + border-radius: 0.5rem; +} + +.shadow-sm { + box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); +} + +.shadow-lg { + box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); +} + +.border { + border-width: 1px; +} + +.border-gray-200 { + border-color: #e5e7eb; +} + +.border-gray-300 { + border-color: #d1d5db; +} + +.hover\:text-gray-900:hover { + color: #111827; +} + +.hover\:text-red-800:hover { + color: #991b1b; +} + +.hover\:bg-gray-50:hover { + background-color: #f9fafb; +} + +.hover\:shadow-lg:hover { + box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); +} + +/* Breadcrumbs */ +ol.flex { + display: flex; + align-items: center; +} + +/* Grid */ +.grid { + display: grid; + grid-template-columns: 1fr; + gap: 1rem; +} + +@media (min-width: 768px) { + .md\:grid-cols-3 { + grid-template-columns: repeat(3, minmax(0, 1fr)); + } + + .md\:col-span-1 { + grid-column: span 1 / span 1; + } + + .md\:col-span-2 { + grid-column: span 2 / span 2; + } +} \ No newline at end of file diff --git a/static/favicon-16x16.png b/static/favicon-16x16.png new file mode 100644 index 0000000..ecf7c68 Binary files /dev/null and b/static/favicon-16x16.png differ diff --git a/static/favicon-32x32.png b/static/favicon-32x32.png new file mode 100644 index 0000000..55d243a Binary files /dev/null and b/static/favicon-32x32.png differ diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000..2da42ae Binary files /dev/null and b/static/favicon.ico differ diff --git a/static/js/cooking-mode.js b/static/js/cooking-mode.js new file mode 100644 index 0000000..c75ee6f --- /dev/null +++ b/static/js/cooking-mode.js @@ -0,0 +1,607 @@ +// Cooking Mode for CookCLI +(function() { + 'use strict'; + + // ─── Constants ─────────────────────────────────────────────── + + const WHEEL_THRESHOLD = 80; + const WHEEL_RESET_MS = 200; + const SWIPE_THRESHOLD = 50; + const SWIPE_CLAMP_MAX = 150; + const SWIPE_SCALE_FACTOR = 0.001; + + // ─── State ─────────────────────────────────────────────────── + + const state = { + cards: [], + cardEls: [], + currentIndex: 0, + wakeLock: null, + overlay: null, + touchStartY: 0, + touchCurrentY: 0, + isSwiping: false, + scrolling: false, + canScrollCard: false, + startScrollTop: 0, + wheelAccumulator: 0, + wheelResetTimeout: null, + triggerElement: null + }; + + // ─── Data Loading ───────────────────────────────────────────── + + function loadRecipeData() { + const el = document.getElementById('cooking-mode-data'); + if (!el) return null; + try { + return JSON.parse(el.textContent); + } catch (e) { + console.error('Failed to parse cooking mode data:', e); + return null; + } + } + + function captureStepHTML() { + const stepElements = []; + const sectionEls = document.querySelectorAll('.md\\:col-span-2 ol'); + sectionEls.forEach(function(ol) { + ol.querySelectorAll(':scope > li').forEach(function(li) { + const textDiv = li.querySelector('.leading-8'); + if (textDiv) { + stepElements.push(textDiv.innerHTML); + } + }); + }); + return stepElements; + } + + // ─── Card Building ──────────────────────────────────────────── + + function buildCards(data, stepHTMLs) { + const cards = []; + let stepHTMLIndex = 0; + + data.sections.forEach(function(section, sectionIndex) { + const sectionName = section.name || (data.sections.length > 1 ? 'Main' : null); + + if (section.ingredients.length > 0 || sectionName) { + cards.push({ + type: 'section', + sectionIndex: sectionIndex, + name: sectionName || data.name, + ingredients: section.ingredients + }); + } + + section.steps.forEach(function(step) { + cards.push({ + type: 'step', + sectionIndex: sectionIndex, + sectionName: sectionName, + number: step.number, + totalInSection: section.steps.length, + image: step.image, + html: stepHTMLs[stepHTMLIndex] || '', + ingredients: step.ingredients + }); + stepHTMLIndex++; + }); + }); + + cards.push({ + type: 'done', + sectionIndex: data.sections.length - 1, + name: data.name + }); + + return cards; + } + + // ─── Rendering ──────────────────────────────────────────────── + + function escapeHTML(str) { + const div = document.createElement('div'); + div.textContent = str; + return div.innerHTML; + } + + function renderCard(card) { + const div = document.createElement('div'); + div.className = 'cooking-card hidden-card'; + + if (card.type === 'section') { + div.classList.add('cooking-card-section'); + let ingredientsHTML = ''; + if (card.ingredients.length > 0) { + const items = card.ingredients.map(function(ing) { + const qty = [ing.quantity, ing.unit].filter(Boolean).join(' '); + const note = ing.note ? '(' + escapeHTML(ing.note) + ')' : ''; + return '
' + + '' + escapeHTML(ing.name) + ' ' + note + '' + + (qty ? '' + escapeHTML(qty) + '' : '') + + '
'; + }).join(''); + ingredientsHTML = '
' + items + '
'; + } + div.innerHTML = '

' + escapeHTML(card.name) + '

' + ingredientsHTML; + div.querySelectorAll('.cooking-mise-item').forEach(function(item) { + item.addEventListener('click', function() { + item.classList.toggle('checked'); + }); + }); + } + else if (card.type === 'step') { + div.classList.add('cooking-card-step'); + const imageHTML = card.image + ? 'Step ' + card.number + '' + : ''; + let ingredientsHTML = ''; + if (card.ingredients.length > 0) { + ingredientsHTML = '
' + + card.ingredients.map(function(ing) { + const qty = [ing.quantity, ing.unit].filter(Boolean).join(' '); + const note = ing.note ? ' (' + escapeHTML(ing.note) + ')' : ''; + return '' + escapeHTML(ing.name) + (qty ? ': ' + escapeHTML(qty) : '') + note + ''; + }).join('') + '
'; + } + div.innerHTML = + imageHTML + + '
' + card.number + '' + card.html + '
' + + ingredientsHTML; + } + else if (card.type === 'done') { + div.classList.add('cooking-card-done'); + div.innerHTML = '

Bon Appetit!

' + + ''; + div.querySelector('.cooking-done-close-btn').addEventListener('click', closeCookingMode); + } + + return div; + } + + function renderOverlay(data, cards) { + const overlay = document.createElement('div'); + overlay.className = 'cooking-overlay'; + overlay.id = 'cooking-overlay'; + overlay.setAttribute('role', 'dialog'); + overlay.setAttribute('aria-modal', 'true'); + overlay.setAttribute('aria-label', 'Cooking mode: ' + data.name); + + // ARIA live region for step announcements + const liveRegion = document.createElement('div'); + liveRegion.setAttribute('aria-live', 'polite'); + liveRegion.setAttribute('aria-atomic', 'true'); + liveRegion.className = 'sr-only'; + liveRegion.id = 'cooking-status'; + overlay.appendChild(liveRegion); + + // Header + const header = document.createElement('div'); + header.className = 'cooking-header'; + + const title = document.createElement('div'); + title.className = 'cooking-header-title'; + title.textContent = data.name; + + const sectionsNav = document.createElement('div'); + sectionsNav.className = 'cooking-header-sections'; + sectionsNav.id = 'cooking-sections-nav'; + + data.sections.forEach(function(section, i) { + const pill = document.createElement('button'); + pill.className = 'cooking-section-pill'; + pill.textContent = section.name || (data.sections.length > 1 ? 'Main' : 'Steps'); + pill.dataset.sectionIndex = i; + pill.addEventListener('click', function() { navigateToSection(i); }); + sectionsNav.appendChild(pill); + }); + + const closeBtn = document.createElement('button'); + closeBtn.className = 'cooking-close-btn'; + closeBtn.setAttribute('aria-label', 'Close cooking mode'); + closeBtn.innerHTML = '×'; + closeBtn.addEventListener('click', closeCookingMode); + + header.appendChild(title); + if (data.sections.length > 1 || (data.sections[0] && data.sections[0].name)) { + header.appendChild(sectionsNav); + } + header.appendChild(closeBtn); + + // Carousel + const carousel = document.createElement('div'); + carousel.className = 'cooking-carousel'; + carousel.id = 'cooking-carousel'; + + const container = document.createElement('div'); + container.className = 'cooking-card-container'; + container.id = 'cooking-card-container'; + + cards.forEach(function(card) { + container.appendChild(renderCard(card)); + }); + + // Click on prev/next card to navigate + container.addEventListener('click', function(e) { + const card = e.target.closest('.cooking-card'); + if (!card) return; + if (card.classList.contains('prev')) { + navigateTo(state.currentIndex - 1); + } else if (card.classList.contains('next')) { + navigateTo(state.currentIndex + 1); + } + }); + + carousel.appendChild(container); + + // Progress bar + const progress = document.createElement('div'); + progress.className = 'cooking-progress'; + progress.innerHTML = '
'; + + overlay.appendChild(header); + overlay.appendChild(carousel); + overlay.appendChild(progress); + + // Cache card element references + state.cardEls = Array.from(container.querySelectorAll('.cooking-card')); + + return overlay; + } + + // ─── Navigation ─────────────────────────────────────────────── + + function updateCards() { + const cardEls = state.cardEls; + if (cardEls.length === 0) return; + + // Only update cards that need changing: previous current +-1 and new current +-1 + const indicesToUpdate = new Set(); + for (let i = 0; i < cardEls.length; i++) { + const el = cardEls[i]; + if (el.classList.contains('current') || el.classList.contains('prev') || el.classList.contains('next')) { + indicesToUpdate.add(i); + } + } + indicesToUpdate.add(state.currentIndex); + if (state.currentIndex > 0) indicesToUpdate.add(state.currentIndex - 1); + if (state.currentIndex < cardEls.length - 1) indicesToUpdate.add(state.currentIndex + 1); + + indicesToUpdate.forEach(function(i) { + const el = cardEls[i]; + el.classList.remove('current', 'prev', 'next', 'hidden-card', 'swiping'); + el.style.transform = ''; + if (i === state.currentIndex) { + el.classList.add('current'); + } else if (i === state.currentIndex - 1) { + el.classList.add('prev'); + } else if (i === state.currentIndex + 1) { + el.classList.add('next'); + } else { + el.classList.add('hidden-card'); + } + }); + + // Update progress bar + const progressBar = document.getElementById('cooking-progress-bar'); + if (progressBar) { + const pct = state.cards.length > 1 + ? (state.currentIndex / (state.cards.length - 1)) * 100 + : 100; + progressBar.style.width = pct + '%'; + } + + // Update section pills + const currentCard = state.cards[state.currentIndex]; + if (currentCard) { + const pills = document.querySelectorAll('.cooking-section-pill'); + for (let j = 0; j < pills.length; j++) { + const isActive = parseInt(pills[j].dataset.sectionIndex) === currentCard.sectionIndex; + pills[j].classList.toggle('active', isActive); + } + } + + // Update ARIA live region + updateAriaStatus(); + } + + function updateAriaStatus() { + const statusEl = document.getElementById('cooking-status'); + if (!statusEl) return; + + const currentCard = state.cards[state.currentIndex]; + if (!currentCard) return; + + let message; + if (currentCard.type === 'section') { + message = 'Ingredients for ' + currentCard.name; + } else if (currentCard.type === 'step') { + message = 'Step ' + currentCard.number + ' of ' + currentCard.totalInSection; + } else if (currentCard.type === 'done') { + message = 'Recipe complete. Bon Appetit!'; + } + + statusEl.textContent = message; + } + + function navigateTo(index) { + if (index < 0 || index >= state.cards.length) return; + state.currentIndex = index; + updateCards(); + } + + function navigateToSection(sectionIndex) { + for (let i = 0; i < state.cards.length; i++) { + if (state.cards[i].sectionIndex === sectionIndex) { + navigateTo(i); + return; + } + } + } + + // ─── Touch Handling ─────────────────────────────────────────── + + function getCurrentCardEl() { + return state.cardEls[state.currentIndex] || null; + } + + function isAtScrollTop(el) { + return el.scrollTop <= 0; + } + + function isAtScrollBottom(el) { + return el.scrollTop + el.clientHeight >= el.scrollHeight - 1; + } + + function cardCanScroll(el) { + return el.scrollHeight > el.clientHeight + 1; + } + + function onTouchStart(e) { + if (e.touches.length !== 1) return; + state.touchStartY = e.touches[0].clientY; + state.touchCurrentY = state.touchStartY; + state.isSwiping = false; + state.scrolling = false; + + const currentEl = getCurrentCardEl(); + if (currentEl) { + state.startScrollTop = currentEl.scrollTop; + state.canScrollCard = cardCanScroll(currentEl); + } else { + state.canScrollCard = false; + } + } + + function onTouchMove(e) { + if (e.touches.length !== 1) return; + state.touchCurrentY = e.touches[0].clientY; + const delta = state.touchCurrentY - state.touchStartY; + const currentEl = getCurrentCardEl(); + if (!currentEl) return; + + // If card has scrollable content, let it scroll until at boundary + if (state.canScrollCard && !state.isSwiping) { + const swipingUp = delta < 0; + const swipingDown = delta > 0; + const atTop = isAtScrollTop(currentEl); + const atBottom = isAtScrollBottom(currentEl); + + // Allow native scroll if not at boundary, or scrolling into content + if ((swipingUp && !atBottom) || (swipingDown && !atTop)) { + state.scrolling = true; + return; // let browser handle scroll + } + + // At boundary and swiping away from content — start card swipe + if (!state.scrolling) { + state.isSwiping = true; + state.touchStartY = state.touchCurrentY; // reset start to boundary + } else { + // Was scrolling, now at boundary — wait for a new gesture + return; + } + } else { + state.isSwiping = true; + } + + if (state.isSwiping) { + const swipeDelta = state.touchCurrentY - state.touchStartY; + const clampedDelta = Math.max(-SWIPE_CLAMP_MAX, Math.min(SWIPE_CLAMP_MAX, swipeDelta)); + currentEl.classList.add('swiping'); + currentEl.style.transform = 'translateY(' + clampedDelta + 'px) scale(' + (1 - Math.abs(clampedDelta) * SWIPE_SCALE_FACTOR) + ')'; + } + } + + function onTouchEnd() { + try { + const currentEl = getCurrentCardEl(); + + if (state.isSwiping) { + const delta = state.touchCurrentY - state.touchStartY; + + if (currentEl) { + currentEl.classList.remove('swiping'); + currentEl.style.transform = ''; + } + + if (delta < -SWIPE_THRESHOLD && state.currentIndex < state.cards.length - 1) { + navigateTo(state.currentIndex + 1); + } else if (delta > SWIPE_THRESHOLD && state.currentIndex > 0) { + navigateTo(state.currentIndex - 1); + } else { + updateCards(); + } + } + } finally { + state.isSwiping = false; + state.scrolling = false; + } + } + + // ─── Keyboard Handling ──────────────────────────────────────── + + function onKeyDown(e) { + if (!state.overlay) return; + + switch (e.key) { + case 'ArrowDown': + case 'ArrowRight': + e.preventDefault(); + navigateTo(state.currentIndex + 1); + break; + case 'ArrowUp': + case 'ArrowLeft': + e.preventDefault(); + navigateTo(state.currentIndex - 1); + break; + case 'Escape': + e.preventDefault(); + closeCookingMode(); + break; + } + } + + // ─── Wheel Handling ───────────────────────────────────────────── + + function onWheel(e) { + if (!state.overlay) return; + e.preventDefault(); + + // Accumulate wheel delta (trackpads send many small events) + state.wheelAccumulator += e.deltaY; + + // Reset accumulator after a pause in scrolling + if (state.wheelResetTimeout) clearTimeout(state.wheelResetTimeout); + state.wheelResetTimeout = setTimeout(function() { + state.wheelAccumulator = 0; + state.wheelResetTimeout = null; + }, WHEEL_RESET_MS); + + // Navigate only when accumulated delta exceeds threshold + if (state.wheelAccumulator >= WHEEL_THRESHOLD) { + navigateTo(state.currentIndex + 1); + state.wheelAccumulator = 0; + } else if (state.wheelAccumulator <= -WHEEL_THRESHOLD) { + navigateTo(state.currentIndex - 1); + state.wheelAccumulator = 0; + } + } + + // ─── Wake Lock ──────────────────────────────────────────────── + + function acquireWakeLock() { + if (!('wakeLock' in navigator)) return; + navigator.wakeLock.request('screen').then(function(lock) { + state.wakeLock = lock; + lock.addEventListener('release', function() { + state.wakeLock = null; + }); + }).catch(function(err) { + console.warn('Wake lock request failed:', err); + }); + } + + function releaseWakeLock() { + if (state.wakeLock) { + state.wakeLock.release().catch(function() {}); + state.wakeLock = null; + } + } + + function onVisibilityChange() { + if (state.overlay && document.visibilityState === 'visible' && !state.wakeLock) { + acquireWakeLock(); + } + } + + function onBeforeUnload() { + releaseWakeLock(); + } + + // ─── Open / Close ───────────────────────────────────────────── + + function startCookingMode() { + const data = loadRecipeData(); + if (!data) return; + + // Save trigger element for focus restoration + state.triggerElement = document.activeElement; + + const stepHTMLs = captureStepHTML(); + state.cards = buildCards(data, stepHTMLs); + if (state.cards.length === 0) return; + + state.currentIndex = 0; + + state.overlay = renderOverlay(data, state.cards); + document.body.appendChild(state.overlay); + document.body.style.overflow = 'hidden'; + + updateCards(); + + // Add event listeners + const carousel = document.getElementById('cooking-carousel'); + carousel.addEventListener('touchstart', onTouchStart, { passive: true }); + carousel.addEventListener('touchmove', onTouchMove, { passive: true }); + carousel.addEventListener('touchend', onTouchEnd, { passive: true }); + carousel.addEventListener('wheel', onWheel, { passive: false }); + + document.addEventListener('keydown', onKeyDown); + window.addEventListener('beforeunload', onBeforeUnload); + + acquireWakeLock(); + document.addEventListener('visibilitychange', onVisibilityChange); + + // Move focus to overlay for accessibility + state.overlay.setAttribute('tabindex', '-1'); + state.overlay.focus(); + } + + function closeCookingMode() { + if (!state.overlay) return; + + // Remove carousel event listeners + const carousel = document.getElementById('cooking-carousel'); + if (carousel) { + carousel.removeEventListener('touchstart', onTouchStart); + carousel.removeEventListener('touchmove', onTouchMove); + carousel.removeEventListener('touchend', onTouchEnd); + carousel.removeEventListener('wheel', onWheel); + } + + state.overlay.remove(); + state.overlay = null; + document.body.style.overflow = ''; + + document.removeEventListener('keydown', onKeyDown); + window.removeEventListener('beforeunload', onBeforeUnload); + + releaseWakeLock(); + document.removeEventListener('visibilitychange', onVisibilityChange); + + // Clear wheel state + if (state.wheelResetTimeout) { + clearTimeout(state.wheelResetTimeout); + state.wheelResetTimeout = null; + } + state.wheelAccumulator = 0; + + // Restore focus to trigger element + if (state.triggerElement && state.triggerElement.focus) { + state.triggerElement.focus(); + state.triggerElement = null; + } + + state.cards = []; + state.cardEls = []; + state.currentIndex = 0; + } + + // ─── Global API ─────────────────────────────────────────────── + + window.startCookingMode = startCookingMode; + window.closeCookingMode = closeCookingMode; + +})(); diff --git a/static/js/editor.bundle.js b/static/js/editor.bundle.js new file mode 100644 index 0000000..ee01b48 --- /dev/null +++ b/static/js/editor.bundle.js @@ -0,0 +1,13 @@ +(()=>{var Hs=[],Ml=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(n=Ml[i])e=i+1;else return!0;if(e==t)return!1}}function Sl(n){return n>=127462&&n<=127487}var Cl=8205;function Tl(n,e,t=!0,i=!0){return(t?Dl:Rf)(n,e,i)}function Dl(n,e,t){if(e==n.length)return e;e&&Ol(n.charCodeAt(e))&&Bl(n.charCodeAt(e-1))&&e--;let i=Ws(n,e);for(e+=Al(i);e=0&&Sl(Ws(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Rf(n,e,t){for(;e>0;){let i=Dl(n,e-2,t);if(i=56320&&n<57344}function Bl(n){return n>=55296&&n<56320}function Al(n){return n<65536?1:2}var P=class n{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=jt(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),qt.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=jt(this,e,t);let i=[];return this.decompose(e,t,i,0),qt.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Ct(this),r=new Ct(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Ct(this,e)}iterRange(e,t=this.length){return new cn(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new fn(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?n.empty:e.length<=32?new ge(e):qt.from(ge.split(e,[]))}},ge=class n extends P{constructor(e,t=Pf(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new zs(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new n(Ll(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=hn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new n(l,o.length+r.length));else{let a=l.length>>1;i.push(new n(l.slice(0,a)),new n(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof n))return super.replace(e,t,i);[e,t]=jt(this,e,t);let s=hn(this.text,hn(i.text,Ll(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new n(s,r):qt.from(n.split(s,[]),r)}sliceString(e,t=this.length,i=` +`){[e,t]=jt(this,e,t);let s="";for(let r=0,o=0;r<=t&&oe&&o&&(s+=i),er&&(s+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new n(i,s)),i=[],s=-1);return s>-1&&t.push(new n(i,s)),t}},qt=class n extends P{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=a+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r=o){let h=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=jt(this,e,t),i.lines=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[s]=a,new n(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` +`){[e,t]=jt(this,e,t);let s="";for(let r=0,o=0;re&&r&&(s+=i),eo&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof n))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new ge(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof n)for(let m of d.children)f(m);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof ge&&a&&(p=c[c.length-1])instanceof ge&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new ge(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>s&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:n.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new n(l,t)}};P.empty=new ge([""],0);function Pf(n){let e=-1;for(let t of n)e+=t.length+1;return e}function hn(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r=t&&(a>i&&(l=l.slice(0,i-s)),s0?1:(e instanceof ge?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof ge?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(s instanceof ge){let a=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof ge?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},cn=class{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Ct(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},fn=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(P.prototype[Symbol.iterator]=function(){return this.iter()},Ct.prototype[Symbol.iterator]=cn.prototype[Symbol.iterator]=fn.prototype[Symbol.iterator]=function(){return this});var zs=class{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}};function jt(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function X(n,e,t=!0,i=!0){return Tl(n,e,t,i)}function If(n){return n>=56320&&n<57344}function Nf(n){return n>=55296&&n<56320}function Re(n,e){let t=n.charCodeAt(e);if(!Nf(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return If(i)?(t-55296<<10)+(i-56320)+65536:t}function yn(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function je(n){return n<65536?1:2}var qs=/\r\n?|\n/,ie=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(ie||(ie={})),et=class n{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=l}else{if(i!=ie.Simple&&h>=e&&(i==ie.TrackDel&&se||i==ie.TrackBefore&&se))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&l>=e)return st?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new n(e)}static create(e){return new n(e)}},ae=class n extends et{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Ks(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return $s(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length0&<(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?P.of(d.split(i||qs)):d:P.empty,m=p.length;if(f==u&&m==0)return;fo&&oe(s,f-o,-1),oe(s,u-f,m),lt(r,s,p),o=u}}return h(e),a(!l),l}static empty(e){return new n(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length=0&&t<=0&&t==n[s+1]?n[s]+=e:s>=0&&e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function lt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(s,h,r,c,f),s=h,r=c}}}function $s(n,e,t,i=!1){let s=[],r=i?[]:null,o=new At(n),l=new At(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);oe(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}var At=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?P.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?P.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},vt=class n{constructor(e,t,i,s){this.from=e,this.to=t,this.flags=i,this.goalColumn=s}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new n(i,s,this.flags,this.goalColumn)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return x.range(e,t,void 0,void 0,i);let s=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return x.range(this.anchor,s,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return x.range(e.anchor,e.head)}static create(e,t,i,s){return new n(e,t,i,s)}},x=class n{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:n.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new n(e.ranges.map(t=>vt.fromJSON(t)),e.main)}static single(e,t=e){return new n([n.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;ss.from-r.from),t=e.indexOf(i);for(let s=1;sr.head?n.range(a,l):n.range(l,a))}}return new n(e,t)}};function Fl(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}var er=0,S=class n{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=er++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new n(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:tr),!!e.static,e.enables)}of(e){return new Kt([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Kt(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Kt(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}};function tr(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}var Kt=class{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=er++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||js(f,c)){let d=i(f);if(l?!El(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,p=u.config.address[r];if(p!=null){let m=mn(u,p);if(this.dependencies.every(g=>g instanceof S?u.facet(g)===f.facet(g):g instanceof Z?u.field(g,!1)==f.field(g,!1):!0)||(l?El(d=i(f),m,s):s(d=i(f),m)))return f.values[o]=m,0}else d=i(f);return f.values[o]=d,1}}}get extension(){return this}};function El(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[a.id]),s=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;ci===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(on).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>{let r=i.facet(on),o=s.facet(on),l;return(l=r.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,on.of({field:this,create:e})]}get extension(){return this}},kt={lowest:4,low:3,default:2,high:1,highest:0};function yi(n){return e=>new un(e,n)}var Ce={highest:yi(kt.highest),high:yi(kt.high),default:yi(kt.default),low:yi(kt.low),lowest:yi(kt.lowest)},un=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},dn=class n{of(e){return new xi(this,e)}reconfigure(e){return n.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}},xi=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},pn=class n{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Wf(e,t,o))u instanceof Z?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of s)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i?.config.facets;for(let u in r){let d=r[u],p=d[0].facet,m=c&&c[u]||[];if(d.every(g=>g.type==0))if(l[p.id]=a.length<<1|1,tr(m,d))a.push(i.facet(p));else{let g=p.combine(d.map(y=>y.value));a.push(i&&p.compare(g,i.facet(p))?i.facet(p):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(y=>g.dynamicSlot(y)));l[p.id]=h.length<<1,h.push(g=>Ff(g,p,d))}}let f=h.map(u=>u(l));return new n(e,o,f,l,a,r)}};function Wf(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof xi&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof xi){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof un)r(o.inner,o.prec);else if(o instanceof Z)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Kt)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,kt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(h==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,kt.default),i.reduce((o,l)=>o.concat(l))}function bi(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function mn(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}var Wl=S.define(),Us=S.define({combine:n=>n.some(e=>e),static:!0}),Hl=S.define({combine:n=>n.length?n[0]:void 0,static:!0}),Vl=S.define(),zl=S.define(),ql=S.define(),Kl=S.define({combine:n=>n.length?n[0]:!1}),ue=class{constructor(e,t){this.type=e,this.value=t}static define(){return new _s}},_s=class{of(e){return new ue(this,e)}},Gs=class{constructor(e){this.map=e}of(e){return new L(this,e)}},L=class n{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new n(this.type,t)}is(e){return this.type==e}static define(e={}){return new Gs(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}};L.reconfigure=L.define();L.appendConfig=L.define();var Q=class n{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Fl(i,t.newLength),r.some(l=>l.type==n.time)||(this.annotations=r.concat(n.time.of(Date.now())))}static create(e,t,i,s,r,o){return new n(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(n.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}};Q.time=ue.define();Q.userEvent=ue.define();Q.addToHistory=ue.define();Q.remote=ue.define();function Hf(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof Q?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof Q?n=r[0]:n=jl(e,$t(r),!1)}return n}function zf(n){let e=n.startState,t=e.facet(ql),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=$l(i,Ys(e,r,n.changes.newLength),!0))}return i==n?n:Q.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}var qf=[];function $t(n){return n==null?qf:Array.isArray(n)?n:[n]}var $=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})($||($={})),Kf=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Js;try{Js=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function $f(n){if(Js)return Js.test(n);for(let e=0;e"\x80"&&(t.toUpperCase()!=t.toLowerCase()||Kf.test(t)))return!0}return!1}function jf(n){return e=>{if(!/\S/.test(e))return $.Space;if($f(e))return $.Word;for(let t=0;t-1)return $.Word;return $.Other}}var q=class n{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ls.set(h,a)),t=null),s.set(l.value.compartment,l.value.extension)):l.is(L.reconfigure)?(t=null,i=l.value):l.is(L.appendConfig)&&(t=null,i=$t(i).concat(l.value));let r;t?r=e.startState.values.slice():(t=pn.resolve(i,s,this),r=new n(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(Us)?e.newSelection:e.newSelection.asSingle();new n(t,e.newDoc,o,r,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:x.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=$t(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return n.create({doc:e.doc,selection:x.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=pn.resolve(e.extensions||[],new Map),i=e.doc instanceof P?e.doc:P.of((e.doc||"").split(t.staticFacet(n.lineSeparator)||qs)),s=e.selection?e.selection instanceof x?e.selection:x.single(e.selection.anchor,e.selection.head):x.single(0);return Fl(s,i.length),t.staticFacet(Us)||(s=s.asSingle()),new n(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(n.tabSize)}get lineBreak(){return this.facet(n.lineSeparator)||` +`}get readOnly(){return this.facet(Kl)}phrase(e,...t){for(let i of this.facet(n.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let r of this.facet(Wl))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return jf(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=X(t,o,!1);if(r(t.slice(a,o))!=$.Word)break;o=a}for(;ln.length?n[0]:4});q.lineSeparator=Hl;q.readOnly=Kl;q.phrases=S.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(s=>n[s]==e[s])}});q.languageData=Wl;q.changeFilter=Vl;q.transactionFilter=zl;q.transactionExtender=ql;dn.reconfigure=L.define();function ye(n,e,t={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,r))i[r]=t[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)i[s]===void 0&&(i[s]=e[s]);return i}var Se=class{eq(e){return this==e}range(e,t=e){return wi.create(e,t,this)}};Se.prototype.startSide=Se.prototype.endSide=0;Se.prototype.point=!1;Se.prototype.mapMode=ie.TrackDel;function ir(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}var wi=class n{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new n(e,t,i)}};function Xs(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}var Qs=class n{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let r=i?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let a=o+l>>1,h=r[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,t,i,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);rd||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),i.push(h),s.push(u-o),r.push(d-o))}return{mapped:i.length?new n(s,r,i,l):null,pos:o}}},W=class n{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new n(e,t,i,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(Xs)),this.isEmpty)return t.length?n.of(t):this;let l=new gn(this,null,-1).goto(0),a=0,h=[],c=new Ee;for(;l.value||a=0){let f=t[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||rl.to||r=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return vi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return vi.from(e).goto(t)}static compare(e,t,i,s,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),l=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),a=Rl(o,l,i),h=new St(o,a,r),c=new St(l,a,r);i.iterGaps((f,u,d)=>Pl(h,f,c,u,d,s)),i.empty&&i.length==0&&Pl(h,0,c,0,0,s)}static eq(e,t,i=0,s){s==null&&(s=999999999);let r=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0),o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=Rl(r,o),a=new St(r,l,0).goto(i),h=new St(o,l,0).goto(i);for(;;){if(a.to!=h.to||!Zs(a.active,h.active)||a.point&&(!h.point||!ir(a.point,h.point)))return!1;if(a.to>s)return!0;a.next(),h.next()}}static spans(e,t,i,s,r=-1){let o=new St(e,null,r).goto(t),l=t,a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroml&&(s.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(e,t=!1){let i=new Ee;for(let s of e instanceof wi?[e]:t?Uf(e):e)i.add(s.from,s.to,s.value);return i.finish()}static join(e){if(!e.length)return n.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let s=e[i];s!=n.empty;s=s.nextLayer)t=new n(s.chunkPos,s.chunk,t,Math.max(s.maxPoint,t.maxPoint));return t}};W.empty=new W([],[],null,-1);function Uf(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort(Xs);e=i}return n}W.empty.nextLayer=W.empty;var Ee=class n{finishChunk(e){this.chunks.push(new Qs(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new n)).add(e,t,i)}addInner(e,t,i){let s=e-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(W.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=W.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function Rl(n,e,t){let i=new Map;for(let r of n)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&s.push(new gn(o,t,i,r));return s.length==1?s[0]:new n(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Vs(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Vs(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Vs(this.heap,0)}}};function Vs(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let s=n[i];if(i+1=0&&(s=n[i+1],i++),t.compare(s)<0)break;n[i]=t,n[e]=s,e=i}}var St=class{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=vi.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){ln(this.active,e),ln(this.activeTo,e),ln(this.activeRank,e),this.minActive=Il(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:s,rank:r}=this.cursor;for(;t0;)t++;an(this.active,t,i),an(this.activeTo,t,s),an(this.activeRank,t,r),e&&an(e,t,this.cursor.from),this.minActive=Il(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),i&&ln(i,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[s]=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}};function Pl(n,e,t,i,s,r){n.goto(e),t.goto(i);let o=i+s,l=i,a=i-e,h=!!r.boundChange;for(let c=!1;;){let f=n.to+a-t.to,u=f||n.endSide-t.endSide,d=u<0?n.to+a:t.to,p=Math.min(d,o);if(n.point||t.point?(n.point&&t.point&&ir(n.point,t.point)&&Zs(n.activeForPoint(n.to),t.activeForPoint(t.to))||r.comparePoint(l,p,n.point,t.point),c=!1):(c&&r.boundChange(l),p>l&&!Zs(n.active,t.active)&&r.compareRange(l,p,n.active,t.active),h&&po)break;l=d,u<=0&&n.next(),u>=0&&t.next()}}function Zs(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function Il(n,e){let t=-1,i=1e9;for(let s=0;s=e)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?t-r%t:1,s=X(n,s)}return i===!0?-1:n.length}var _l=typeof Symbol>"u"?"__\u037C":Symbol.for("\u037C"),nr=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Gl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},Ae=class{constructor(e,t){this.rules=[];let{finish:i}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,a,h){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))r(d.split(/,\s*/).map(m=>o.map(g=>m.replace(/&/,g))).reduce((m,g)=>m.concat(g)),p,a);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(s(d),p,c,u)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(c.length||u)&&a.push((i&&!f&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=Gl[_l]||1;return Gl[_l]=e+1,"\u037C"+e.toString(36)}static mount(e,t,i){let s=e[nr],r=i&&i.nonce;s?r&&s.setNonce(r):s=new sr(e,r),s.mount(Array.isArray(t)?t:[t],e)}},Yl=new Map,sr=class{constructor(e,t){let i=e.ownerDocument||e,s=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let r=Yl.get(i);if(r)return e[nr]=r;this.sheet=new s.CSSStyleSheet,Yl.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[nr]=this}mount(e,t){let i=this.sheet,s=0,r=0;for(let o=0;o-1&&(this.modules.splice(a,1),r--,a=-1),a==-1){if(this.modules.splice(r++,0,l),i)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},_f=typeof navigator<"u"&&/Mac/.test(navigator.platform),Gf=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(ee=0;ee<10;ee++)tt[48+ee]=tt[96+ee]=String(ee);var ee;for(ee=1;ee<=24;ee++)tt[ee+111]="F"+ee;var ee;for(ee=65;ee<=90;ee++)tt[ee]=String.fromCharCode(ee+32),Ut[ee]=String.fromCharCode(ee);var ee;for(bn in tt)Ut.hasOwnProperty(bn)||(Ut[bn]=tt[bn]);var bn;function Jl(n){var e=_f&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Gf&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ut:tt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function F(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];typeof s=="string"?n.setAttribute(i,s):s!=null&&(n[i]=s)}e++}for(;e2),C={mac:ea||/Mac/.test(he.platform),windows:/Win/.test(he.platform),linux:/Linux|X11/.test(he.platform),ie:Jn,ie_version:La?dr.documentMode||6:mr?+mr[1]:pr?+pr[1]:0,gecko:Ql,gecko_version:Ql?+(/Firefox\/(\d+)/.exec(he.userAgent)||[0,0])[1]:0,chrome:!!rr,chrome_version:rr?+rr[1]:0,ios:ea,android:/Android\b/.test(he.userAgent),webkit:Zl,webkit_version:Zl?+(/\bAppleWebKit\/(\d+)/.exec(he.userAgent)||[0,0])[1]:0,safari:gr,safari_version:gr?+(/\bVersion\/(\d+(\.\d+)?)/.exec(he.userAgent)||[0,0])[1]:0,tabSize:dr.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function to(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}var En=Object.create(null);function io(n,e,t){if(n==e)return!0;n||(n=En),e||(e=En);let i=Object.keys(n),s=Object.keys(e);if(i.length-(t&&i.indexOf(t)>-1?1:0)!=s.length-(t&&s.indexOf(t)>-1?1:0))return!1;for(let r of i)if(r!=t&&(s.indexOf(r)==-1||n[r]!==e[r]))return!1;return!0}function Yf(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function ta(n,e,t){let i=!1;if(e)for(let s in e)t&&s in t||(i=!0,s=="style"?n.style.cssText="":n.removeAttribute(s));if(t)for(let s in t)e&&e[s]==t[s]||(i=!0,s=="style"?n.style.cssText=t[s]:n.setAttribute(s,t[s]));return i}function Jf(n){let e=Object.create(null);for(let t=0;t0?3e8:-4e8:t>0?1e8:-1e8,new Ot(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,s;if(e.isBlockGap)i=-5e8,s=4e8;else{let{start:r,end:o}=Ea(e,t);i=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new Ot(e,i,s,t,e.widget||null,!0)}static line(e){return new Ri(e)}static set(e,t=!1){return W.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};B.none=W.empty;var Ei=class n extends B{constructor(e){let{start:t,end:i}=Ea(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?to(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||En}eq(e){return this==e||e instanceof n&&this.tagName==e.tagName&&io(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}};Ei.prototype.point=!1;var Ri=class n extends B{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof n&&this.spec.class==e.spec.class&&io(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}};Ri.prototype.mapMode=ie.TrackBefore;Ri.prototype.point=!0;var Ot=class n extends B{constructor(e,t,i,s,r,o){super(t,i,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?ie.TrackBefore:ie.TrackAfter:ie.TrackDel}get type(){return this.startSide!=this.endSide?pe.WidgetRange:this.startSide<=0?pe.WidgetBefore:pe.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof n&&Xf(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}};Ot.prototype.point=!0;function Ea(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function Xf(n,e){return n==e||!!(n&&e&&n.compare(e))}function Qt(n,e,t,i=0){let s=t.length-1;s>=0&&t[s]+i>=n?t[s]=Math.max(t[s],e):t.push(n,e)}var Rn=class n extends Se{constructor(e,t,i){super(),this.tagName=e,this.attributes=t,this.rank=i}eq(e){return e==this||e instanceof n&&this.tagName==e.tagName&&io(this.attributes,e.attributes)}static create(e){return new n(e.tagName,e.attributes||En,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return W.of(e,t)}};Rn.prototype.startSide=Rn.prototype.endSide=-1;function Pi(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function yr(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function Ci(n,e){if(!e.anchorNode)return!1;try{return yr(n,e.anchorNode)}catch{return!1}}function Dn(n){return n.nodeType==3?Ii(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Ai(n,e,t,i){return t?ia(n,e,t,i,-1)||ia(n,e,t,i,1):!1}function ct(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function Pn(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function ia(n,e,t,i,s){for(;;){if(n==t&&e==i)return!0;if(e==(s<0?0:st(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;e=ct(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=s<0?st(n):0}else return!1}}function st(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function In(n,e){let{left:t,right:i}=n;if(t==i)return n;let s=e?t:i;return{left:s,right:s,top:n.top,bottom:n.bottom}}function Qf(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function Ra(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function Zf(n,e,t,i,s,r,o,l){let a=n.ownerDocument,h=a.defaultView||window;for(let c=n,f=!1;c&&!f;)if(c.nodeType==1){let u,d=c==a.body,p=1,m=1;if(d)u=Qf(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let w=c.getBoundingClientRect();({scaleX:p,scaleY:m}=Ra(c,w)),u={left:w.left,right:w.left+c.clientWidth*p,top:w.top,bottom:w.top+c.clientHeight*m}}let g=0,y=0;if(s=="nearest")e.top0&&e.bottom>u.bottom+y&&(y=e.bottom-u.bottom+o)):e.bottom>u.bottom-o&&(y=e.bottom-u.bottom+o,t<0&&e.top-y0&&e.right>u.right+g&&(g=e.right-u.right+r)):e.right>u.right-r&&(g=e.right-u.right+r,t<0&&e.leftu.bottom||e.leftu.right)&&(e={left:Math.max(e.left,u.left),right:Math.min(e.right,u.right),top:Math.max(e.top,u.top),bottom:Math.min(e.bottom,u.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function Pa(n,e=!0){let t=n.ownerDocument,i=null,s=null;for(let r=n.parentNode;r&&!(r==t.body||(!e||i)&&s);)if(r.nodeType==1)!s&&r.scrollHeight>r.clientHeight&&(s=r),e&&!i&&r.scrollWidth>r.clientWidth&&(i=r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;return{x:i,y:s}}var br=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?st(t):0),i,Math.min(e.focusOffset,i?st(i):0))}set(e,t,i,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=s}};function Ia(n){let e=[];for(let t=n;t;t=t.nodeType==11?t.host:t.parentNode)t.nodeType==1&&e.push({node:t,left:t.scrollLeft,top:t.scrollTop});return e}function Na(n,e=!0){for(let{node:t,left:i,top:s}of n)e&&t.scrollTop!=s&&(t.scrollTop=s),t.scrollLeft!=i&&(t.scrollLeft=i)}var Tt=null;C.safari&&C.safari_version>=26&&(Tt=!1);function Fa(n){if(n.setActive)return n.setActive();if(Tt)return n.focus(Tt);let e=Ia(n);n.focus(Tt==null?{get preventScroll(){return Tt={preventScroll:!0},!0}}:void 0),Tt||(Tt=!1,Na(e))}var na;function Ii(n,e,t=e){let i=na||(na=document.createRange());return i.setEnd(n,t),i.setStart(n,e),i}function Zt(n,e,t,i){let s={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=i);let r=new KeyboardEvent("keydown",s);r.synthetic=!0,n.dispatchEvent(r);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,n.dispatchEvent(o),r.defaultPrevented||o.defaultPrevented}function eu(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function tu(n,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,st(t));;)if(i){if(t.nodeType!=1)return!1;let s=t.childNodes[i-1];s.contentEditable=="false"?i--:(t=s,i=st(t))}else{if(t==n)return!0;i=ct(t),t=t.parentNode}}function Wa(n){return n instanceof Window?n.pageYOffset>Math.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function Ha(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=st(t)}else if(t.parentNode&&!Pn(t))i=ct(t),t=t.parentNode;else return null}}function Va(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i=t){if(l.level==i)return o;(r<0||(s!=0?s<0?l.fromt:e[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}};function Ka(n,e){if(n.length!=e.length)return!1;for(let t=0;t=0;m-=3)if(Ue[m+1]==-d){let g=Ue[m+2],y=g&2?s:g&4?g&1?r:s:0;y&&(H[f]=H[Ue[m]]=y),l=m;break}}else{if(Ue.length==189)break;Ue[l++]=f,Ue[l++]=u,Ue[l++]=a}else if((p=H[f])==2||p==1){let m=p==s;a=m?0:1;for(let g=l-3;g>=0;g-=3){let y=Ue[g+2];if(y&2)break;if(m)Ue[g+2]|=2;else{if(y&4)break;Ue[g+2]|=4}}}}}function lu(n,e,t,i){for(let s=0,r=i;s<=t.length;s++){let o=s?t[s-1].to:n,l=sa;)p==g&&(p=t[--m].from,g=m?t[m-1].to:n),H[--p]=d;a=c}else r=h,a++}}}function wr(n,e,t,i,s,r,o){let l=i%2?2:1;if(i%2==s%2)for(let a=e,h=0;aa&&o.push(new De(a,m.from,d));let g=m.direction==Bt!=!(d%2);vr(n,g?i+1:i,s,m.inner,m.from,m.to,o),a=m.to}p=m.to}else{if(p==t||(c?H[p]!=l:H[p]==l))break;p++}u?wr(n,a,p,i+1,s,u,o):ae;){let c=!0,f=!1;if(!h||a>r[h-1].to){let m=H[a-1];m!=l&&(c=!1,f=m==16)}let u=!c&&l==1?[]:null,d=c?i:i+1,p=a;e:for(;;)if(h&&p==r[h-1].to){if(f)break e;let m=r[--h];if(!c)for(let g=m.from,y=h;;){if(g==e)break e;if(y&&r[y-1].to==g)g=r[--y].from;else{if(H[g-1]==l)break e;break}}if(u)u.push(m);else{m.toH.length;)H[H.length]=256;let i=[],s=e==Bt?0:1;return vr(n,s,s,t,0,n.length,i),i}function $a(n){return[new De(0,n,0)]}var ja="";function hu(n,e,t,i,s){var r;let o=i.head-n.from,l=De.find(e,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc),a=e[l],h=a.side(s,t);if(o==h){let u=l+=s?1:-1;if(u<0||u>=e.length)return null;a=e[l=u],o=a.side(!s,t),h=a.side(s,t)}let c=X(n.text,o,a.forward(s,t));(ca.to)&&(c=h),ja=n.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return f&&c==h&&f.level+(s?0:1)n.some(e=>e)}),fu=S.define({combine:n=>n.some(e=>e)}),Za=S.define(),Mi=class n{constructor(e,t,i,s,r,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=s,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new n(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new n(x.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},xn=L.define({map:(n,e)=>n.map(e)}),eh=L.define();function ne(n,e,t){let i=n.facet(Ya);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}var it=S.define({combine:n=>n.length?n[0]:!0}),uu=0,Gt=S.define({combine(n){return n.filter((e,t)=>{for(let i=0;i{let a=[];return o&&a.push(Xn.of(h=>{let c=h.plugin(l);return c?o(c):B.none})),r&&a.push(r(l)),a})}static fromClass(e,t){return n.define((i,s)=>new e(i,s),t)}},Ti=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(ne(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){ne(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){ne(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},th=S.define(),oo=S.define(),Xn=S.define(),ih=S.define(),lo=S.define(),Ni=S.define(),nh=S.define();function sa(n,e){let t=n.state.facet(nh);if(!t.length)return t;let i=t.map(r=>r instanceof Function?r(n):r),s=[];return W.spans(i,e.from,e.to,{point(){},span(r,o,l,a){let h=r-e.from,c=o-e.from,f=s;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,p;if(d==null&&(d=cu(e.text,h,c)),a>0&&f.length&&(p=f[f.length-1]).to==h&&p.direction==d)p.to=c,f=p.inner;else{let m={from:h,to:c,direction:d,inner:[]};f.push(m),f=m.inner}}}}),s}var sh=S.define();function ao(n){let e=0,t=0,i=0,s=0;for(let r of n.state.facet(sh)){let o=r(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:t,top:i,bottom:s}}var ki=S.define(),Ie=class n{constructor(e,t,i,s){this.fromA=e,this.toA=t,this.fromB=i,this.toB=s}join(e){return new n(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>i.toA)){if(s.toAs.push(new Ie(r,o,l,a))),this.changedRanges=s}static create(e,t,i){return new n(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},du=[],U=class{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return du}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&Yf(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let i=t;for(let s of this.children){if(s==e)return i;i+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,i){return null}domPosFor(e,t){let i=ct(this.dom),s=this.length?e>0:t>0;return new _e(this.parent.dom,i+(s?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof ti)return e;return null}static get(e){return e.cmTile}},ei=class extends U{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,i=null,s,r=e?.node==t?e:null,o=0;for(let l of this.children){if(l.sync(e),o+=l.length+l.breakAfter,s=i?i.nextSibling:t.firstChild,r&&s!=l.dom&&(r.written=!0),l.dom.parentNode==t)for(;s&&s!=l.dom;)s=ra(s);else t.insertBefore(l.dom,s);i=l.dom}for(s=i?i.nextSibling:t.firstChild,r&&s&&(r.written=!0);s;)s=ra(s);this.length=o}};function ra(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}var ti=class extends ei{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=U.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,s=0,r=0;;)if(s==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&r++,s=t.pop()}else{let o=i.children[s++];if(o instanceof nt)t.push(s),i=o,s=0;else{let l=r+o.length,a=e(o,r);if(a!==void 0)return a;r=l+o.breakAfter}}}resolveBlock(e,t){let i,s=-1,r,o=-1;if(this.blockTiles((l,a)=>{let h=a+l.length;if(e>=a&&e<=h){if(l.isWidget()&&t>=-1&&t<=1){if(l.flags&32)return!0;l.flags&16&&(i=void 0)}(ae||e==a&&(t>1?l.length:l.covers(-1)))&&(!r||!l.isWidget()&&r.isWidget())&&(r=l,o=e-a)}}),!i&&!r)throw new Error("No tile at position "+e);return i&&t<0||!r?{tile:i,offset:s}:{tile:r,offset:o}}},nt=class n extends ei{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let i=new n(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}},ii=class n extends ei{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,i){let s=new n(t||document.createElement("div"),e);return(!t||!i)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(e,t,i){let s=null,r=-1,o=null,l=-1;function a(c,f){for(let u=0,d=0;u=f&&(p.isComposite()?a(p,f-d):(!o||o.isHidden&&(t>0&&!(o.flags&32)||i&&mu(o,p)))&&(m>f||p.flags&32&&t<=1)?(o=p,l=f-d):(d=-1)&&(s=p,r=f-d)),d=m}}a(this,e);let h=(t<0?s:o)||s||o;return h?{tile:h,offset:h==s?r:l}:null}coordsIn(e,t,i){let s=this.resolveInline(e,t,!0);return s?s.tile.coordsIn(Math.max(0,s.offset),t,i):pu(this)}domIn(e,t){let i=this.resolveInline(e,t);if(i){let{tile:s,offset:r}=i;if(this.dom.contains(s.dom))return s.isText()?new _e(s.dom,Math.min(s.dom.nodeValue.length,r)):s.domPosFor(r,s.flags&16?1:s.flags&32?-1:t);let o=i.tile.parent,l=!1;for(let a of o.children){if(l)return new _e(a.dom,0);a==i.tile&&(l=!0)}}return new _e(this.dom,0)}};function pu(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=Dn(e);return t[t.length-1]||null}function mu(n,e){let t=n.coordsIn(0,1),i=e.coordsIn(0,1);return t&&i&&i.tops&&(e=s);let r=e,o=e,l=0;e==0&&t<0||e==s&&t>=0?C.chrome||C.gecko||(e?(r--,l=1):o=0)?0:a.length-1];return C.safari&&!l&&h.width==0&&(h=Array.prototype.find.call(a,c=>c.width)||h),i==null?h:In(h,(l?l>0:t<0)==i)}static of(e,t){let i=new n(t||document.createTextNode(e),e);return t||(i.flags|=2),i}},Lt=class n extends U{constructor(e,t,i,s){super(e,t,s),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,i){let s=this.widget.coordsAt(this.dom,e,t);if(s)return s;if(i)return In(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let r=this.dom.getClientRects(),o=null;if(!r.length)return null;let l=this.flags&16?!0:this.flags&32?!1:e>0;for(let a=l?r.length-1:0;o=r[a],!(e>0?a==0:a==r.length-1||o.top0==i)}},Sr=class{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,i){let{tile:s,index:r,beforeBreak:o,parents:l}=this;for(;e||t>0;)if(s.isComposite())if(o){if(!e)break;i&&i.break(),e--,o=!1}else if(r==s.children.length){if(!e&&!l.length)break;i&&i.leave(s),o=!!s.breakAfter,{tile:s,index:r}=l.pop(),r++}else{let a=s.children[r],h=a.breakAfter;(t>0?a.length<=e:a.length=0;l--){let a=t.marks[l],h=s.lastChild;if(h instanceof de&&h.mark.eq(a.mark))h.dom!=a.dom&&h.setDOM(or(a.dom)),s=h;else{if(this.cache.reused.get(a)){let f=U.get(a.dom);f&&f.setDOM(or(a.dom))}let c=de.of(a.mark,a.dom);s.append(c),s=c}this.cache.reused.set(a,2)}let r=U.get(e.text);r&&this.cache.reused.set(r,2);let o=new Dt(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,s.append(o)}addInlineWidget(e,t,i){let s=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);s||this.flushBuffer();let r=this.ensureMarks(t,i);!s&&!(e.flags&16)&&r.append(this.getBuffer(1)),r.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var i;e||(e=rh);let s=ii.start(e,t||((i=this.cache.find(ii))===null||i===void 0?void 0:i.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var i;let s=this.curLine;for(let r=e.length-1;r>=0;r--){let o=e[r],l;if(t>0&&(l=s.lastChild)&&l instanceof de&&l.mark.eq(o))s=l,t--;else{let a=de.of(o,(i=this.cache.find(de,h=>h.mark.eq(o)))===null||i===void 0?void 0:i.dom);s.append(a),s=a,t=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!oa(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(C.ios&&oa(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(lr,0,32)||new Lt(lr.toDOM(),0,lr,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to=this.pos){let t=e.rank*102+e.value.rank,i=new Cr(e.from,e.to,e.value,t),s=this.wrappers.length;for(;s>0&&(this.wrappers[s-1].rank-i.rank||this.wrappers[s-1].to-i.to)<0;)s--;this.wrappers.splice(s,0,i)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let i of this.wrappers){let s=t.lastChild;if(i.fromo.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);t.append(r),t=r}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),i=this.cache.find(ni,void 0,1);return i&&(i.flags=t),i||new ni(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},Mr=class{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:s,lineBreak:r,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let l=this.textOff=Math.min(e,s.length);return r?null:s.slice(0,l)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}},Fn=[Lt,ii,Dt,de,ni,nt,ti];for(let n=0;n[]),this.index=Fn.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let s=e.bucket,r=this.buckets[s],o=this.index[s];for(let l=0;l{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let s=0,r=0,o=0;;){let l=os){let h=a-s;this.preserve(h,!o,!l),s=a,r+=h}if(!l)break;t&&l.fromA<=t.range.fromA&&l.toA>=t.range.toA?(this.forward(l.fromA,t.range.fromA,t.range.fromA{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(a-l);else{let h=a>0||l{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof de&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=r=0):o instanceof de&&(s.shift(),r=Math.min(r,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,s=this.builder,r=-1,o=W.spans(this.decorations,e,t,{point:(l,a,h,c,f,u)=>{if(h instanceof Ot){if(this.disallowBlockEffectsFor[u]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(a>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(r=c.length,f>c.length)s.continueWidget(a-l);else{let d=h.widget||(h.block?ft.block:ft.inline),p=gu(h),m=this.cache.findWidget(d,a-l,p)||Lt.of(d,this.view,a-l,p);h.block?(h.startSide>0&&s.addLineStartIfNotCovered(i),s.addBlockWidget(m)):(s.ensureLine(i),s.addInlineWidget(m,c,f))}i=null}else i=yu(i,h);a>l&&this.text.skip(a-l)},span:(l,a,h,c)=>{for(let f=l;f-1&&(this.openWidget=o>r),this.openWidget||s.addLineStartIfNotCovered(i),this.openMarks=o}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let s=e.parentNode;;s=s.parentNode){let r=U.get(s);if(s==this.view.contentDOM)break;r instanceof de?t.push(r):r?.isLine()?i=r:r instanceof nt||(s.nodeName=="DIV"&&!i&&s!=this.view.contentDOM?i=new ii(s,rh):i||t.push(de.of(new Ei({tagName:s.nodeName.toLowerCase(),attributes:Jf(s)}),s)))}return{line:i,marks:t}}};function oa(n,e){let t=i=>{for(let s of i.children)if((e?s.isText():s.length)||t(s))return!0;return!1};return t(n)}function gu(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}var rh={class:"cm-line"};function yu(n,e){let t=e.spec.attributes,i=e.spec.class;return!t&&!i||(n||(n={class:"cm-line"}),t&&to(t,n),i&&(n.class+=" "+i)),n}function bu(n){let e=[];for(let t=n.parents.length;t>1;t--){let i=t==n.parents.length?n.tile:n.parents[t].tile;i instanceof de&&e.push(i.mark)}return e}function or(n){let e=U.get(n);return e&&e.setDOM(n.cloneNode()),n}var ft=class extends Ne{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};ft.inline=new ft("span");ft.block=new ft("div");var lr=new class extends Ne{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}},Wn=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=B.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new ti(e,e.contentDOM),this.updateInner([new Ie(0,0,0,e.state.doc.length)],null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:c,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?s=this.domChanged.newSel.head:!Mu(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let r=s>-1?wu(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:f}=this.hasComposition;i=new Ie(c,f,e.changes.mapPos(c,-1),e.changes.mapPos(f,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(C.ie||C.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let a=Su(o,this.decorations,e.changes);a.length&&(i=Ie.extendWithRanges(i,a));let h=Cu(l,this.blockWrappers,e.changes);return h.length&&(i=Ie.extendWithRanges(i,h)),r&&!i.some(c=>c.fromA<=r.range.fromA&&c.toA>=r.range.toA)&&(i=r.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let o=this.tile,l=new Dr(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&U.get(t.text)&&l.cache.reused.set(U.get(t.text),2),this.tile=l.run(e,t),Or(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=C.chrome||C.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||i.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to-1)&&Ci(i,this.view.observer.selectionRange)&&!(s&&i.contains(s));if(!(r||t||o))return;let l=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,h,c;if(a.empty?c=h=this.inlineDOMNearPos(a.anchor,a.assoc||1):(c=this.inlineDOMNearPos(a.head,a.head==a.from?1:-1),h=this.inlineDOMNearPos(a.anchor,a.anchor==a.from?1:-1)),C.gecko&&a.empty&&!this.hasComposition&&xu(h)){let u=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(u,h.node.childNodes[h.offset]||null)),h=c=new _e(u,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!Ai(h.node,h.offset,f.anchorNode,f.anchorOffset)||!Ai(c.node,c.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,a))&&(this.view.observer.ignore(()=>{C.android&&C.chrome&&i.contains(f.focusNode)&&Au(f.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let u=Pi(this.view.root);if(u)if(a.empty){if(C.gecko){let d=vu(h.node,h.offset);if(d&&d!=3){let p=(d==1?Ha:Va)(h.node,h.offset);p&&(h=new _e(p.node,p.offset))}}u.collapse(h.node,h.offset),a.bidiLevel!=null&&u.caretBidiLevel!==void 0&&(u.caretBidiLevel=a.bidiLevel)}else if(u.extend){u.collapse(h.node,h.offset);try{u.extend(c.node,c.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([h,c]=[c,h]),d.setEnd(c.node,c.offset),d.setStart(h.node,h.offset),u.removeAllRanges(),u.addRange(d)}o&&this.view.root.activeElement==i&&(i.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(h,c)),this.impreciseAnchor=h.precise?null:new _e(f.anchorNode,f.anchorOffset),this.impreciseHead=c.precise?null:new _e(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ai(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=Pi(e.root),{anchorNode:s,anchorOffset:r}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!a||!h||a.bottom>h.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(c.node,c.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&i.collapse(s,r)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let s=i.posAtStart;if(i.isComposite()){let r;if(e==i.dom)r=i.dom.childNodes[t];else{let o=st(e)==0?0:t==0?-1:1;for(;;){let l=e.parentNode;if(l==i.dom)break;o==0&&l.firstChild!=l.lastChild&&(e==l.firstChild?o=-1:o=1),e=l}o<0?r=e:r=e.nextSibling}if(r==i.dom.firstChild)return s;for(;r&&!U.get(r);)r=r.nextSibling;if(!r)return s+i.length;for(let o=0,l=s;;o++){let a=i.children[o];if(a.dom==r)return l;l+=a.length+a.breakAfter}}else return i.isText()?e==i.dom?s+t:s+(t?i.length:0):s}domAtPos(e,t){let{tile:i,offset:s}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(s,t):i.domIn(s,t)}inlineDOMNearPos(e,t){let i,s=-1,r=!1,o,l=-1,a=!1;return this.tile.blockTiles((h,c)=>{if(h.isWidget()){if(h.flags&32&&c>=e)return!0;h.flags&16&&(r=!0)}else{let f=c+h.length;if(c<=e&&(i=h,s=e-c,r=f=e&&!o&&(o=h,l=e-c,a=c>e),c>e&&o)return!0}}),!i&&!o?this.domAtPos(e,t):(r&&o?i=null:a&&i&&(o=null),i&&t<0||!o?i.domIn(s,t):o.domIn(l,t))}coordsAt(e,t,i){let{tile:s,offset:r}=this.tile.resolveBlock(e,t);return s.isWidget()?s.widget instanceof Di?null:s.coordsInWidget(r,t,!0):s.coordsIn(r,t,i)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function s(r,o){if(r.isComposite())for(let l of r.children){if(l.length>=o){let a=s(l,o);if(a)return a}if(o-=l.length,o<0)break}else if(r.isText()&&oMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==V.LTR,h=0,c=(f,u,d)=>{for(let p=0;ps);p++){let m=f.children[p],g=u+m.length,y=m.dom.getBoundingClientRect(),{height:w}=y;if(d&&!p&&(h+=y.top-d.top),m instanceof nt)g>i&&c(m,u,y);else if(u>=i&&(h>0&&t.push(-h),t.push(w+h),h=0,o)){let b=m.dom.lastChild,D=b?Dn(b):[];if(D.length){let M=D[D.length-1],O=a?M.right-y.left:y.right-M.left;O>l&&(l=O,this.minWidth=r,this.minWidthFrom=u,this.minWidthTo=g)}}d&&p==f.children.length-1&&(h+=d.bottom-y.bottom),u=g+m.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?V.RTL:V.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,a;for(let h of o.children){if(!h.isText()||/[^ -~]/.test(h.text))return;let c=Dn(h.dom);if(c.length!=1)return;l+=c[0].width,a=c[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:a}}});if(e)return e;let t=document.createElement("div"),i,s,r;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=Dn(t.firstChild)[0];i=t.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,r=o&&o.height?o.height:i,t.remove()}),{lineHeight:i,charWidth:s,textHeight:r}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s],o=r?r.from-1:this.view.state.doc.length;if(o>i){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(B.replace({widget:new Di(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return B.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Xn).map(r=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),i=!1,s=this.view.state.facet(lo).map((r,o)=>{let l=typeof r=="function";return l&&(i=!0),l?r(this.view):r});for(s.length&&(this.dynamicDecorationMap[e++]=i,t.push(W.join(s))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];etypeof r=="function"?r(this.view):r)}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(Za))try{if(h(this.view,e.range,e))return!0}catch(c){ne(this.view.state,c,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),s;if(!i)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=ao(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;if(Zf(this.view.scrollDOM,o,t.head1&&(i.top>window.visualViewport.offsetTop+window.visualViewport.height||i.bottomi.isWidget()||i.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Or(this.tile)}};function Or(n,e){let t=e?.get(n);if(t!=1){t==null&&n.destroy();for(let i of n.children)Or(i,e)}}function xu(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function oh(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=Ha(t.focusNode,t.focusOffset),s=Va(t.focusNode,t.focusOffset),r=i||s;if(s&&i&&s.node!=i.node){let l=U.get(s.node);if(!l||l.isText()&&l.text!=s.node.nodeValue)r=s;else if(n.docView.lastCompositionAfterCursor){let a=U.get(i.node);!a||a.isText()&&a.text!=i.node.nodeValue||(r=s)}}if(n.docView.lastCompositionAfterCursor=r!=i,!r)return null;let o=e-r.offset;return{from:o,to:o+r.node.nodeValue.length,node:r.node}}function wu(n,e,t){let i=oh(n,t);if(!i)return null;let{node:s,from:r,to:o}=i,l=s.nodeValue;if(/[\n\r]/.test(l)||n.state.doc.sliceString(i.from,i.to)!=l)return null;let a=e.invertedDesc;return{range:new Ie(a.mapPos(r),a.mapPos(o),r,o),text:s}}function vu(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e{ie.from&&(t=!0)}),t}var Di=class extends Ne{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};function Tu(n,e,t=1){let i=n.charCategorizer(e),s=n.doc.lineAt(e),r=e-s.from;if(s.length==0)return x.cursor(e);r==0?t=1:r==s.length&&(t=-1);let o=r,l=r;t<0?o=X(s.text,r,!1):l=X(s.text,r);let a=i(s.text.slice(o,l));for(;o>0;){let h=X(s.text,o,!1);if(i(s.text.slice(h,o))!=a)break;o=h}for(;ln.defaultLineHeight*1.5){let l=n.viewState.heightOracle.textHeight,a=Math.floor((s-t.top-(n.defaultLineHeight-l)*.5)/l);r+=a*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+Ul(o,r,n.state.tabSize)}function Ou(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let s;for(let r of i.type){if(r.from>e)break;if(!(r.toe)return r;(!s||r.type==pe.Text&&(s.type!=r.type||(t<0?r.frome)))&&(s=r)}}return s||i}return i}function Bu(n,e,t,i){let s=Ou(n,e.head,e.assoc||-1),r=!i||s.type!=pe.Text||!(n.lineWrapping||s.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let o=n.dom.getBoundingClientRect(),l=n.textDirectionAt(s.from),a=n.posAtCoords({x:t==(l==V.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(a!=null)return x.cursor(a,t?-1:1)}return x.cursor(t?s.to:s.from,t?-1:1)}function la(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=n.bidiSpans(s),o=n.textDirectionAt(s.from);for(let l=e,a=null;;){let h=hu(s,r,o,l,t),c=ja;if(!h){if(s.number==(t?n.state.doc.lines:1))return l;c=` +`,s=n.state.doc.line(s.number+(t?1:-1)),r=n.bidiSpans(s),h=n.visualLineSide(s,!t)}if(a){if(!a(c))return l}else{if(!i)return h;a=i(c)}l=h}}function Lu(n,e,t){let i=n.state.charCategorizer(e),s=i(t);return r=>{let o=i(r);return s==$.Space&&(s=o),s==o}}function Eu(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return x.cursor(s,e.assoc);let o=e.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(s,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),c=n.documentTop;if(h)o==null&&(o=h.left-a.left),l=r<0?h.top:h.bottom;else{let p=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(s-p.from))),l=(r<0?p.top:p.bottom)+c}let f=a.left+o,u=n.viewState.heightOracle.textHeight>>1,d=i??u;for(let p=0;;p+=u){let m=l+(d+p)*r,g=Lr(n,{x:f,y:m},!1,r);if(t?m>a.bottom:ml:w{if(e>r&&es(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:x.cursor(i,in.viewState.docHeight)return new Te(n.state.doc.length,-1);if(h=n.elementAtHeight(a),i==null)break;if(h.type==pe.Text){if(i<0?h.ton.viewport.to)break;let u=n.docView.coordsAt(i<0?h.from:h.to,i>0?-1:1);if(u&&(i<0?u.top<=a+r:u.bottom>=a+r))break}let f=n.viewState.heightOracle.textHeight/2;a=i>0?h.bottom+f:h.top-f}if(n.viewport.from>=h.to||n.viewport.to<=h.from){if(t)return null;if(h.type==pe.Text){let f=Du(n,s,h,o,l);return new Te(f,f==h.from?1:-1)}}if(h.type!=pe.Text)return a<(h.top+h.bottom)/2?new Te(h.from,1):new Te(h.to,-1);let c=n.docView.lineAt(h.from,2);return(!c||c.length!=h.length)&&(c=n.docView.lineAt(h.from,-2)),new Er(n,o,l,n.textDirectionAt(h.from)).scanTile(c,h.from)}var Er=class{constructor(e,t,i,s){this.view=e,this.x=t,this.y=i,this.baseDir=s,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to1||i.length&&(i[0].level!=this.baseDir||i[0].to+s.from>1;t:if(o.has(m)){for(let w=1;w=r&&(b-=p),!o.has(b)){m=b;break t}}break e}o.add(m);let g=t(m),y=0;if(g)for(let w=0;w1))if(b.bottomthis.y)(!h||h.top>b.top)&&(h=b),y=-1;else{let D=b.left>this.x?this.x-b.left:b.right(p+p+m)/3)return this.y=a.bottom-1,this.scan(e,t,!0);if(h&&h.top<(p+m+m)/3)return this.y=h.top+1,this.scan(e,t,!0)}let d=(l?this.dirAt(e[c],1):this.baseDir)==V.LTR;return{i:c,after:this.x>(u.left+u.right)/2==d}}scanText(e,t){let i=[];for(let r=0;r{let o=i[r]-t,l=i[r+1]-t;return Ii(e.dom,o,l).getClientRects()});return s.after?new Te(i[s.i+1],-1):new Te(i[s.i],1)}scanTile(e,t){if(!e.length)return new Te(t,1);if(e.children.length==1){let l=e.children[0];if(l.isText())return this.scanText(l,t);if(l.isComposite())return this.scanTile(l,t)}let i=[t];for(let l=0,a=t;l{let a=e.children[l];return a.flags&48?null:(a.dom.nodeType==1?a.dom:Ii(a.dom,0,a.length)).getClientRects()}),r=e.children[s.i],o=i[s.i];return r.isText()?this.scanText(r,o):r.isComposite()?this.scanTile(r,o):s.after?new Te(i[s.i+1],-1):new Te(o,1)}},_t="\uFFFF",Rr=class{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(q.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=_t}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let s=e;;){this.findPointBefore(i,s);let r=this.text.length;this.readNode(s);let o=U.get(s),l=s.nextSibling;if(l==t){o?.breakAfter&&!l&&i!=this.view.contentDOM&&this.lineBreak();break}let a=U.get(l);(o&&a?o.breakAfter:(o?o.breakAfter:Pn(s))||Pn(l)&&(s.nodeName!="BR"||o?.isWidget())&&this.text.length>r)&&!Pu(l,t)&&this.lineBreak(),s=l}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,l;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=s.exec(t))&&(r=l.index,o=l[0].length),this.append(t.slice(i,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);i=r+o}}readNode(e){let t=U.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(Ru(e,i.node,i.offset)?t:0))}};function Ru(n,e,t){for(;;){if(!e||t-1;let{impreciseHead:r,impreciseAnchor:o}=e.docView,l=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=ah(e.docView.tile,t,i,0))){let a=r||o?[]:Nu(e),h=new Rr(a,e);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=Fu(a,this.bounds.from)}else{let a=e.observer.selectionRange,h=r&&r.node==a.focusNode&&r.offset==a.focusOffset||!yr(e.contentDOM,a.focusNode)?l.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!yr(e.contentDOM,a.anchorNode)?l.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),f=e.viewport;if((C.ios||C.chrome)&&h!=c&&Math.min(h,c)<=l.main.from&&Math.max(h,c)>=l.main.to&&(f.from>0||f.to-1&&l.ranges.length>1)this.newSel=l.replaceRange(x.range(c,h));else if(e.lineWrapping&&c==h&&!(l.main.empty&&l.main.head==h)&&e.inputState.lastTouchTime>Date.now()-100){let u=e.coordsAtPos(h,-1),d=0;u&&(d=e.inputState.lastTouchY<=u.bottom?-1:1),this.newSel=x.create([x.cursor(h,d)])}else this.newSel=x.single(c,h)}}};function ah(n,e,t,i){if(n.isComposite()){let s=-1,r=-1,o=-1,l=-1;for(let a=0,h=i,c=i;at)return ah(f,e,t,h);if(u>=e&&s==-1&&(s=a,r=h),h>t&&f.dom.parentNode==n.dom){o=a,l=c;break}c=u,h=u+f.breakAfter}return{from:r,to:l<0?i+n.length:l,startDOM:(s?n.children[s-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:o=0?n.children[o].dom:null}}else return n.isText()?{from:i,to:i+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function hh(n,e){let t,{newSel:i}=e,{state:s}=n,r=s.selection.main,o=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:a}=e.bounds,h=r.from,c=null;(o===8||C.android&&e.text.length=l&&r.to<=a&&(e.typeOver||f!=e.text)&&f.slice(0,r.from-l)==e.text.slice(0,r.from-l)&&f.slice(r.to-l)==e.text.slice(u=e.text.length-(f.length-(r.to-l)))?t={from:r.from,to:r.to,insert:P.of(e.text.slice(r.from-l,u).split(_t))}:(d=ch(f,e.text,h-l,c))&&(C.chrome&&o==13&&d.toB==d.from+2&&e.text.slice(d.from,d.toB)==_t+_t&&d.toB--,t={from:l+d.from,to:l+d.toA,insert:P.of(e.text.slice(d.from,d.toB).split(_t))})}else i&&(!n.hasFocus&&s.facet(it)||Vn(i,r))&&(i=null);if(!t&&!i)return!1;if((C.mac||C.android)&&t&&t.from==t.to&&t.from==r.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=x.single(i.main.anchor-1,i.main.head-1)),t={from:t.from,to:t.to,insert:P.of([t.insert.toString().replace("."," ")])}):s.doc.lineAt(r.from).toDate.now()-50?t={from:r.from,to:r.to,insert:s.toText(n.inputState.insertingText)}:C.chrome&&t&&t.from==t.to&&t.from==r.head&&t.insert.toString()==` + `&&n.lineWrapping&&(i&&(i=x.single(i.main.anchor-1,i.main.head-1)),t={from:r.from,to:r.to,insert:P.of([" "])}),t)return ho(n,t,i,o);if(i&&!Vn(i,r)){let l=!1,a="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(l=!0),a=n.inputState.lastSelectionOrigin,a=="select.pointer"&&(i=lh(s.facet(Ni).map(h=>h(n)),i))),n.dispatch({selection:i,scrollIntoView:l,userEvent:a}),!0}else return!1}function ho(n,e,t,i=-1){if(C.ios&&n.inputState.flushIOSKey(e))return!0;let s=n.state.selection.main;if(C.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&n.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Zt(n.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||i==8&&e.insert.lengths.head)&&Zt(n.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Zt(n.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=Iu(n,e,t));return n.state.facet(Ja).some(a=>a(n,e.from,e.to,r,l))||n.dispatch(l()),!0}function Iu(n,e,t){let i,s=n.state,r=s.selection.main,o=-1;if(e.from==e.to&&e.fromr.to){let a=e.fromf(n)),h,a);e.from==c&&(o=c)}if(o>-1)i={changes:e,selection:x.cursor(e.from+e.insert.length,-1)};else if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let a=r.frome.to?s.sliceDoc(e.to,r.to):"";i=s.replaceSelection(n.state.toText(a+e.insert.sliceString(0,void 0,n.state.lineBreak)+h))}else{let a=s.changes(e),h=t&&t.main.to<=a.newLength?t.main:void 0;if(s.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=r.to+10&&e.to>=r.to-10){let c=n.state.sliceDoc(e.from,e.to),f,u=t&&oh(n,t.main.head);if(u){let p=e.insert.length-(e.to-e.from);f={from:u.from,to:u.to-p}}else f=n.state.doc.lineAt(r.head);let d=r.to-e.to;i=s.changeByRange(p=>{if(p.from==r.from&&p.to==r.to)return{changes:a,range:h||p.map(a)};let m=p.to-d,g=m-c.length;if(n.state.sliceDoc(g,m)!=c||m>=f.from&&g<=f.to)return{range:p};let y=s.changes({from:g,to:m,insert:e.insert}),w=p.to-r.to;return{changes:y,range:h?x.range(Math.max(0,h.anchor+w),Math.max(0,h.head+w)):p.map(y)}})}else i={changes:a,selection:h&&s.selection.replaceRange(h)}}let l="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,l+=".compose",n.inputState.compositionFirstChange&&(l+=".start",n.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:l,scrollIntoView:!0})}function ch(n,e,t,i){let s=Math.min(n.length,e.length),r=0;for(;r0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));t-=o+a-r}if(o=o?r-t:0;r-=a,l=r+(l-o),o=r}else if(l=l?r-t:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function Nu(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return t&&(e.push(new Hn(t,i)),(s!=t||r!=i)&&e.push(new Hn(s,r))),e}function Fu(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?x.single(t+e,i+e):null}function Vn(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}var Ir=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,C.safari&&e.contentDOM.addEventListener("input",()=>null),C.gecko&&Qu(e.contentDOM.ownerDocument)}handleEvent(e){!ju(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let s of i.observers)s(this.view,t);for(let s of i.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Hu(e),i=this.handlers,s=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length,l=i[r];l&&o!=!l.handlers.length&&(s.removeEventListener(r,this.handleEvent),l=null),l||s.addEventListener(r,this.handleEvent,{passive:o})}for(let r in i)r!="scroll"&&!t[r]&&s.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&uh.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),C.android&&C.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(C.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(fh.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||Vu.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return t.shiftKey&&C.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&Wu(this.view.win)&&(t.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t},setTimeout(()=>this.flushIOSKey(),250),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from0?!0:C.safari&&!C.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function Wu(n){return n.visualViewport?n.visualViewport.height*n.visualViewport.scale/n.document.documentElement.clientHeight<.85:!1}function aa(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(s){ne(t.state,s)}}}function Hu(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let s=i.spec,r=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(r)for(let l in r){let a=r[l];a&&t(l).handlers.push(aa(i.value,a))}if(o)for(let l in o){let a=o[l];a&&t(l).observers.push(aa(i.value,a))}}for(let i in Fe)t(i).handlers.push(Fe[i]);for(let i in ce)t(i).observers.push(ce[i]);return e}var fh=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Vu="dthko",uh=[16,17,18,20,91,92,224,225],wn=6;function vn(n){return Math.max(0,n)*.7+8}function zu(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}var Nr=class{constructor(e,t,i,s){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Pa(e.contentDOM),this.atoms=e.state.facet(Ni).map(o=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(q.allowMultipleSelections)&&qu(e,t),this.dragging=$u(e,t)&&mh(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&zu(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,s=0,r=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=ao(this.view);e.clientX-a.left<=s+wn?t=-vn(s-e.clientX):e.clientX+a.right>=o-wn&&(t=vn(e.clientX-o)),e.clientY-a.top<=r+wn?i=-vn(r-e.clientY):e.clientY+a.bottom>=l-wn&&(i=vn(e.clientY-l)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=lh(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function qu(n,e){let t=n.state.facet(Ua);return t.length?t[0](e):C.mac?e.metaKey:e.ctrlKey}function Ku(n,e){let t=n.state.facet(_a);return t.length?t[0](e):C.mac?!e.altKey:!e.ctrlKey}function $u(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=Pi(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function ju(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=U.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}var Fe=Object.create(null),ce=Object.create(null),dh=C.ie&&C.ie_version<15||C.ios&&C.webkit_version<604;function Uu(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),ph(n,t.value)},50)}function Qn(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function ph(n,e){e=Qn(n.state,so,e);let{state:t}=n,i,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(Fr!=null&&t.selection.ranges.every(a=>a.empty)&&Fr==r.toString()){let a=-1;i=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==a)return{range:h};a=c.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:x.cursor(h.from+f.length)}})}else o?i=t.changeByRange(a=>{let h=r.line(s++);return{changes:{from:a.from,to:a.to,insert:h.text},range:x.cursor(a.from+h.length)}}):i=t.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}ce.scroll=n=>{let e=n.inputState;e.lastScrollTop=n.scrollDOM.scrollTop,e.lastScrollLeft=n.scrollDOM.scrollLeft,C.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};ce.wheel=ce.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};Fe.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);ce.touchstart=(n,e)=>{let t=n.inputState,i=e.targetTouches[0];t.touchActive=!0,t.lastTouchTime=Date.now(),i&&(t.lastTouchX=i.clientX,t.lastTouchY=i.clientY),t.setSelectionOrigin("select.pointer")};ce.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};ce.touchend=(n,e)=>{n.inputState.touchActive=!1};Fe.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(Ga))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=Gu(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new Nr(n,e,t,i)),i&&n.observer.ignore(()=>{Fa(n.contentDOM);let r=n.root.activeElement;r&&!r.contains(n.contentDOM)&&r.blur()});let s=n.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function ha(n,e,t,i){if(i==1)return x.cursor(e,t);if(i==2)return Tu(n.state,e,t);{let s=n.docView.lineAt(e,t),r=n.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return lDate.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(fa+1)%3:1}function Gu(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=mh(e),s=n.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),s=s.map(r.changes))},get(r,o,l){let a=n.posAndSideAtCoords({x:r.clientX,y:r.clientY},!1),h,c=ha(n,a.pos,a.assoc,i);if(t.pos!=a.pos&&!o){let f=ha(n,t.pos,t.assoc,i),u=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=u1&&(h=Yu(s,a.pos))?h:l?s.addRange(c):x.create([c])}}}function Yu(n,e){for(let t=0;t=e)return x.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}Fe.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let s=n.docView.tile.nearest(e.target);if(s&&s.isWidget()){let r=s.posAtStart,o=r+s.length;(r>=t.to||o<=t.from)&&(t=x.undirectionalRange(r,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Qn(n.state,ro,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Fe.dragend=n=>(n.inputState.draggedContent=null,!1);function da(n,e,t,i){if(t=Qn(n.state,so,t),!t)return;let s=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=n.inputState,o=i&&r&&Ku(n,e)?{from:r.from,to:r.to}:null,l={from:s,insert:t},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}Fe.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),s=0,r=()=>{++s==t.length&&da(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return da(n,e,i,!0),!0}return!1};Fe.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=dh?null:e.clipboardData;return t?(ph(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(Uu(n),!1)};function Ju(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function Xu(n){let e=[],t=[],i=!1;for(let s of n.selection.ranges)s.empty||(e.push(n.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:Qn(n,ro,e.join(n.lineBreak)),ranges:t,linewise:i}}var Fr=null;Fe.copy=Fe.cut=(n,e)=>{if(!Ci(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:i,linewise:s}=Xu(n.state);if(!t&&!s)return!1;Fr=s?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=dh?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(Ju(n,t),!1)};var gh=ue.define();function yh(n,e){let t=[];for(let i of n.facet(Xa)){let s=i(n,e);s&&t.push(s)}return t.length?n.update({effects:t,annotations:gh.of(!0)}):null}function bh(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=yh(n.state,e);t?n.dispatch(t):n.update([])}},10)}ce.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),bh(n)};ce.blur=n=>{n.observer.clearSelectionRange(),bh(n)};ce.compositionstart=ce.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};ce.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,C.chrome&&C.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};ce.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};Fe.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let r=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(r&&o.length){let l=o[0],a=n.posAtDOM(l.startContainer,l.startOffset),h=n.posAtDOM(l.endContainer,l.endOffset);return ho(n,{from:a,to:h,insert:n.state.toText(r)},null),!0}}let s;if(C.chrome&&C.android&&(s=fh.find(r=>r.inputType==e.inputType))&&(n.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let r=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return C.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),C.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>ce.compositionend(n,e),20),!1};var pa=new Set;function Qu(n){pa.has(n)||(pa.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}var ma=["pre-wrap","normal","pre-line","break-spaces"],si=!1;function ga(){si=!1}var Wr=class{constructor(e){this.lineWrapping=e,this.doc=P.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return ma.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=i,this.textHeight=s,this.lineLength=r,a){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>On&&(si=!0),this.height=e)}replace(e,t,i){return n.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,s){let r=this,o=i.doc;for(let l=s.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:c,toB:f}=s[l],u=r.lineAt(a,K.ByPosNoHeight,i.setDoc(t),0,0),d=u.to>=h?u:r.lineAt(h,K.ByPosNoHeight,i,0,0);for(f+=d.to-h,h=d.to;l>0&&u.from<=s[l-1].toA;)a=s[l-1].fromA,c=s[l-1].fromB,l--,ar*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(r>s*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(s=r&&o(this.lineAt(0,K.ByPos,i,s,r))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}},Me=class n extends qn{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new Pe(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof n||s instanceof ht&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof ht?s=new n(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):be.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setMeasuredHeight(s):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}},ht=class n extends be{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,r=s-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*r);o=a/r,this.length>r+1&&(l=(this.height-a)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:s,perLine:o,perChar:l}}blockAt(e,t,i,s){let{firstLine:r,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,s);if(t.lineWrapping){let h=s+(e0){let r=i[i.length-1];r instanceof n?i[i.length-1]=new n(r.length+s):i.push(null,new n(s-1))}if(e>0){let r=i[0];r instanceof n?i[0]=new n(e+r.length):i.unshift(new n(e-1),null)}return be.of(i)}decomposeLeft(e,t){t.push(new n(e-1),null)}decomposeRight(e,t){t.push(null,new n(this.length-e-1))}updateHeight(e,t=0,i=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],l=Math.max(t,s.from),a=-1;for(s.from>t&&o.push(new n(s.from-t-1).updateHeight(e,t));l<=r&&s.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=s.heights[s.index++],u=0;f<0&&(u=-f,f=s.heights[s.index++]),a==-1?a=f:Math.abs(f-a)>=On&&(a=-2);let d=new Me(c,f,u);d.outdated=!1,o.push(d),l+=c+1}l<=r&&o.push(null,new n(r-l).updateHeight(e,l));let h=be.of(o);return(a<0||Math.abs(h.height-this.height)>=On||Math.abs(a-this.heightMetrics(e,t).perLine)>=On)&&(si=!0),zn(this,h)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},Vr=class extends be{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,s){let r=i+this.left.height;return el))return h;let c=t==K.ByPosNoHeight?K.ByPosNoHeight:K.ByPos;return a?h.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,s,r).join(h)}forEachLine(e,t,i,s,r,o){let l=s+this.left.height,a=r+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,i,l,a,o);else{let h=this.lineAt(a,K.ByPos,i,s,r);e=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,l,a,o)}}replace(e,t,i){let s=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0&&ya(r,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e2*t.size||t.size>2*e.size?be.of(this.break?[e,null,t]:[e,t]):(this.left=zn(this.left,e),this.right=zn(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,s){let{left:r,right:o}=this,l=t+r.length+this.break,a=null;return s&&s.from<=t+r.length&&s.more?a=r=r.updateHeight(e,t,i,s):r.updateHeight(e,t,i),s&&s.from<=l+o.length&&s.more?a=o=o.updateHeight(e,l,i,s):o.updateHeight(e,l,i),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}};function ya(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof ht&&(i=n[e+1])instanceof ht&&n.splice(e-1,3,new ht(t.length+1+i.length))}var ed=5,zr=class n{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Me?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Me(i-this.pos,-1,0)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=ed)&&this.addLineDeco(s,r,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new Me(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new ht(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Me)return e;let t=new Me(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Me)&&!this.isCovered?this.nodes.push(new Me(0,-1,0)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();r=Math.max(r,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=Math.min(h==n.parentNode?s.innerHeight:a,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function nd(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left0&&e.top0}function sd(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}var Bi=class{constructor(e,t,i,s){this.from=e,this.to=t,this.size=i,this.displaySize=s}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new Wr(i),this.stateDeco=xa(t),this.heightMap=be.empty().applyChanges(this.stateDeco,P.empty,this.heightOracle.setDoc(t.doc),[new Ie(0,0,0,t.doc.length)]);for(let s=0;s<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());s++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=B.set(this.lineGaps.map(s=>s.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let s=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new Yt(r,o))}}return this.viewports=e.sort((i,s)=>i.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?ba:new $r(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Si(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=xa(this.state);let s=e.changedRanges,r=Ie.extendWithRanges(s,td(i,this.stateDeco,e?e.changes:ae.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);ga(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||si)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let h=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(fu)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?V.RTL:V.LTR;let o=this.heightOracle.mustRefreshForWrapping(r)||this.mustMeasureContent==="refresh",l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0;if(l.width&&l.height){let{scaleX:M,scaleY:O}=Ra(t,l);(M>.005&&Math.abs(this.scaleX-M)>.005||O>.005&&Math.abs(this.scaleY-O)>.005)&&(this.scaleX=M,this.scaleY=O,h|=16,o=a=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let d=Pa(this.view.contentDOM,!1).y;d!=this.scrollParent&&(this.scrollParent=d,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=Wa(this.scrollParent||e.win);let m=(this.printing?sd:id)(t,this.paddingTop),g=m.top-this.pixelViewport.top,y=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(a=!0)),!this.inView&&!this.scrollTarget&&!nd(e.dom))return 0;let b=l.width;if((this.contentDOMWidth!=b||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),a){let M=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(M)&&(o=!0),o||s.lineWrapping&&Math.abs(b-this.contentDOMWidth)>s.charWidth){let{lineHeight:O,charWidth:T,textHeight:N}=e.docView.measureTextSize();o=O>0&&s.refresh(r,O,T,N,Math.max(5,b/T),M),o&&(e.docView.minWidth=0,h|=16)}g>0&&y>0?c=Math.max(g,y):g<0&&y<0&&(c=Math.min(g,y)),ga();for(let O of this.viewports){let T=O.from==this.viewport.from?M:e.docView.measureVisibleLineHeights(O);this.heightMap=(o?be.empty().applyChanges(this.stateDeco,P.empty,this.heightOracle,[new Ie(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Hr(O.from,T))}si&&(h|=2)}let D=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return D&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(h&2||D)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new Yt(s.lineAt(o-i*1e3,K.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,K.ByHeight,r,0,0).to);if(t){let{head:h}=t.range;if(ha.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(h,K.ByPos,r,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&h=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&r>1,o=s<<1;if(this.defaultTextDirection!=V.LTR&&!i)return[];let l=[],a=(c,f,u,d)=>{if(f-cc&&yy.from>=u.from&&y.to<=u.to&&Math.abs(y.from-c)y.fromw));if(!g){if(fb.from<=f&&b.to>=f)){let b=t.moveToLineBoundary(x.cursor(f),!1,!0).head;b>c&&(f=b)}let y=this.gapSize(u,c,f,d),w=i||y<2e6?y:2e6;g=new Bi(c,f,y,w)}l.push(g)},h=c=>{if(c.length2e6)for(let O of e)O.from>=c.from&&O.fromc.from&&a(c.from,d,c,f),pt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];W.spans(t,this.viewport.from,this.viewport.to,{span(r,o){i.push({from:r,to:o})},point(){}},20);let s=0;if(i.length!=this.visibleRanges.length)s=12;else for(let r=0;r=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Si(this.heightMap.lineAt(e,K.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Si(this.heightMap.lineAt(this.scaler.fromDOM(e),K.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Si(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},Yt=class{constructor(e,t){this.from=e,this.to=t}};function rd(n,e,t){let i=[],s=n,r=0;return W.spans(t,n,e,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),r+=o-s),s=l}},20),s=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let s=0;;s++){let{from:r,to:o}=e[s],l=o-r;if(i<=l)return r+i;i-=l}}function Sn(n,e){let t=0;for(let{from:i,to:s}of n.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/n.total}function od(n,e){for(let t of n)if(e(t))return t}var ba={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function xa(n){let e=n.facet(Xn).filter(i=>typeof i!="function"),t=n.facet(lo).filter(i=>typeof i!="function");return t.length&&e.push(W.join(t)),e}var $r=class n{constructor(e,t,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=t.lineAt(l,K.ByPos,e,0,0).top,c=t.lineAt(a,K.ByPos,e,0,0).bottom;return s+=c-h,{from:l,to:a,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let r=tt.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}};function Si(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Pe(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(s=>Si(s,e)):n._content)}var Cn=S.define({combine:n=>n.join(" ")}),jr=S.define({combine:n=>n.indexOf(!0)>-1}),Ur=Ae.newName(),xh=Ae.newName(),wh=Ae.newName(),vh={"&light":"."+xh,"&dark":"."+wh};function _r(n,e,t){return new Ae(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):n+" "+i}})}var ld=_r("."+Ur,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},vh),ad={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},hr=C.ie&&C.ie_version<=11,Gr=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new br,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(C.ie&&C.ie_version<=11||C.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&C.android&&e.constructor.EDIT_CONTEXT!==!1&&!(C.chrome&&C.chrome_version<126)&&(this.editContext=new Yr(e),e.state.facet(it)&&(e.contentDOM.editContext=this.editContext.editContext)),hr&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(it)?i.root.activeElement!=this.dom:!Ci(this.dom,s))return;let r=s.anchorNode&&i.docView.tile.nearest(s.anchorNode);if(r&&r.isWidget()&&r.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(C.ie&&C.ie_version<=11||C.android&&C.chrome)&&!i.state.selection.main.empty&&s.focusNode&&Ai(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Pi(e.root);if(!t)return!1;let i=C.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&hd(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let s=Ci(this.dom,i);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&Zt(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,s=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(s=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:s}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),s=this.selectionChanged&&Ci(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Pr(this.view,e,t,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,s=hh(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!Vn(this.view.state.selection,t.newSel.main))&&this.view.update([]),s}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let i=wa(t,e.previousSibling||e.target.previousSibling,-1),s=wa(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(it)!=e.state.facet(it)&&(e.view.contentDOM.editContext=e.state.facet(it)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function wa(n,e,t){for(;e;){let i=U.get(e);if(i&&i.parent==n)return i;let s=e.parentNode;e=s!=n.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function va(n,e){let t=e.startContainer,i=e.startOffset,s=e.endContainer,r=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor,1);return Ai(o.node,o.offset,s,r)&&([t,i,s,r]=[s,r,t,i]),{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}}function hd(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return va(n,s)}let t=null;function i(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?va(n,t):null}var Yr=class{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let s=e.state.selection.main,{anchor:r,head:o}=s,l=this.toEditorPos(i.updateRangeStart),a=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let h=a-l>i.text.length;l==this.from&&rthis.to&&(a=r);let c=ch(e.state.sliceDoc(l,a),i.text,(h?s.from:s.to)-l,h?"end":null);if(!c){let u=x.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));Vn(u,s)||e.dispatch({selection:u,userEvent:"select"});return}let f={from:c.from+l,to:c.toA+l,insert:P.of(i.text.slice(c.from,c.toB).split(` +`))};if((C.mac||C.android)&&f.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:P.of([i.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let u=this.to-this.from+(f.to-f.from+f.insert.length);ho(e,f,x.single(this.toEditorPos(i.selectionStart,u),this.toEditorPos(i.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let s=[],r=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o{let s=[];for(let r of i.getTextFormats()){let o=r.underlineStyle,l=r.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(r.rangeStart),h=this.toEditorPos(r.rangeEnd);if(a{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let s=Pi(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,s=this.pendingContextChange;return e.changes.iterChanges((r,o,l,a,h)=>{if(i)return;let c=h.length-(o-r);if(s&&o>=s.to)if(s.from==r&&s.to==o&&s.insert.eq(h)){s=this.pendingContextChange=null,t+=c,this.to+=c;return}else s=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=c,this.to+=c;else if(rthis.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),h.toString()),this.to+=c}t+=c}),s&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),s=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},A=class n{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(s=>s.forEach(r=>i(r,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||eu(e.parent)||document,this.viewState=new Kn(this,e.state||q.create(e)),e.scrollTo&&e.scrollTo.is(xn)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Gt).map(s=>new Ti(s));for(let s of this.plugins)s.update(this);this.observer=new Gr(this),this.inputState=new Ir(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Wn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof Q?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,s,r=this.state;for(let u of e){if(u.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=u.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,a=null;e.some(u=>u.annotation(gh))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=yh(r,o),a||(l=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(q.phrases)!=this.state.facet(q.phrases))return this.setState(r);s=Nn.create(this,r,e),s.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection,{x:p,y:m}=this.state.facet(n.cursorScrollMargin);f=new Mi(d.empty?d:x.cursor(d.head,d.head>d.anchor?-1:1),"nearest","nearest",m,p)}for(let d of u.effects)d.is(xn)&&(f=d.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=$n.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(ki)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Cn)!=s.state.facet(Cn)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!s.empty)for(let u of this.state.facet(kr))try{u(s)}catch(d){ne(this.state,d,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!hh(this,c)&&h.force&&Zt(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Kn(this,e),this.plugins=e.facet(Gt).map(i=>new Ti(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Wn(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Gt),i=e.state.facet(Gt);if(t!=i){let s=[];for(let r of i){let o=t.indexOf(r);if(o<0)s.push(new Ti(r));else{let l=this.plugins[o];l.mustUpdate=e,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.viewState.scrollParent,s=this.viewState.getScrollOffset(),{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Wa(i||this.win))r=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(s);r=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure();if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let c=h.map(d=>{try{return d.read(this)}catch(p){return ne(this.state,p),ka}}),f=Nn.create(this,this.state,[]),u=!1;f.flags|=a,t?t.flags|=a:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let d=0;d1||p<-1)&&!(C.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){s=s+p,i?i.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(kr))l(t)}get themeClasses(){return Ur+" "+(this.state.facet(jr)?wh:xh)+" "+this.state.facet(Cn)}updateAttrs(){let e=Sa(this,th,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(it)?"true":"false",class:"cm-content",style:`${C.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Sa(this,oo,t);let i=this.observer.ignore(()=>{let s=ta(this.contentDOM,this.contentAttrs,t),r=ta(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(n.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(ki);let e=this.state.facet(n.cspNonce);Ae.mount(this.root,this.styleModules.concat(ld).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;ti.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return ar(this,e,la(this,e,t,i))}moveByGroup(e,t){return ar(this,e,la(this,e,t,i=>Lu(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),s=this.textDirectionAt(e.from),r=i[t?i.length-1:0];return x.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,i=!0){return Bu(this,e,t,i)}moveVertically(e,t,i){return ar(this,e,Eu(this,e,t,i))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let i=Lr(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Lr(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),r=s[De.find(s,e-i.from,-1,t)];return this.docView.coordsAt(e,t,r.dir==V.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Qa)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>cd)return $a(e.length);let t=this.textDirectionAt(e.from),i;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||Ka(r.isolates,i=sa(this,e))))return r.order;i||(i=sa(this,e));let s=au(e.text,t,i);return this.bidiCache.push(new $n(e.from,e.to,t,i,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||C.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Fa(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var i,s,r,o;return xn.of(new Mi(typeof e=="number"?x.cursor(e):e,(i=t.y)!==null&&i!==void 0?i:"nearest",(s=t.x)!==null&&s!==void 0?s:"nearest",(r=t.yMargin)!==null&&r!==void 0?r:5,(o=t.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return xn.of(new Mi(x.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return te.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return te.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=Ae.newName(),s=[Cn.of(i),ki.of(_r(`.${i}`,e))];return t&&t.dark&&s.push(jr.of(!0)),s}static baseTheme(e){return Ce.lowest(ki.of(_r("."+Ur,e,vh)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&U.get(i)||U.get(e);return((t=s?.root)===null||t===void 0?void 0:t.view)||null}};A.styleModule=ki;A.inputHandler=Ja;A.clipboardInputFilter=so;A.clipboardOutputFilter=ro;A.scrollHandler=Za;A.focusChangeEffect=Xa;A.perLineTextDirection=Qa;A.exceptionSink=Ya;A.updateListener=kr;A.editable=it;A.mouseSelectionStyle=Ga;A.dragMovesSelection=_a;A.clickAddsSelectionRange=Ua;A.decorations=Xn;A.blockWrappers=ih;A.outerDecorations=lo;A.atomicRanges=Ni;A.bidiIsolatedRanges=nh;A.cursorScrollMargin=S.define({combine:n=>{let e=5,t=5;for(let i of n)typeof i=="number"?e=t=i:{x:e,y:t}=i;return{x:e,y:t}}});A.scrollMargins=sh;A.darkTheme=jr;A.cspNonce=S.define({combine:n=>n.length?n[0]:""});A.contentAttributes=oo;A.editorAttributes=th;A.lineWrapping=A.contentAttributes.of({class:"cm-lineWrapping"});A.announce=L.define();var cd=4096,ka={},$n=class n{constructor(e,t,i,s,r,o){this.from=e,this.to=t,this.dir=i,this.isolates=s,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let i=[],s=e.length?e[e.length-1].dir:V.LTR;for(let r=Math.max(0,e.length-10);r=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&to(o,t)}return t}var fd=C.mac?"mac":C.windows?"win":C.linux?"linux":"key";function ud(n,e){let t=n.split(/-(?!$)/),i=t[t.length-1];i=="Space"&&(i=" ");let s,r,o,l;for(let a=0;ai.concat(s),[]))),t}function Sh(n,e,t){return Ch(kh(n.state),e,n,t)}var at=null,pd=4e3;function md(n,e=fd){let t=Object.create(null),i=Object.create(null),s=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,a,h,c)=>{var f,u;let d=t[o]||(t[o]=Object.create(null)),p=l.split(/ (?!$)/).map(y=>ud(y,e));for(let y=1;y{let D=at={view:b,prefix:w,scope:o};return setTimeout(()=>{at==D&&(at=null)},pd),!0}]})}let m=p.join(" ");s(m,!1);let g=d[m]||(d[m]={preventDefault:!1,stopPropagation:!1,run:((u=(f=d._any)===null||f===void 0?void 0:f.run)===null||u===void 0?void 0:u.slice())||[]});a&&g.run.push(a),h&&(g.preventDefault=!0),c&&(g.stopPropagation=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let c=t[h]||(t[h]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let u in c)c[u].run.push(d=>f(d,Jr))}let a=o[e]||o.key;if(a)for(let h of l)r(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}var Jr=null;function Ch(n,e,t,i){Jr=e;let s=Jl(e),r=Re(s,0),o=je(r)==s.length&&s!=" ",l="",a=!1,h=!1,c=!1;at&&at.view==t&&at.scope==i&&(l=at.prefix+" ",uh.indexOf(e.keyCode)<0&&(h=!0,at=null));let f=new Set,u=g=>{if(g){for(let y of g.run)if(!f.has(y)&&(f.add(y),y(t)))return g.stopPropagation&&(c=!0),!0;g.preventDefault&&(g.stopPropagation&&(c=!0),h=!0)}return!1},d=n[i],p,m;return d&&(u(d[l+An(s,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(C.windows&&e.ctrlKey&&e.altKey)&&!(C.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=tt[e.keyCode])&&p!=s?(u(d[l+An(p,e,!0)])||e.shiftKey&&(m=Ut[e.keyCode])!=s&&m!=p&&u(d[l+An(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&u(d[l+An(s,e,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&c&&e.stopPropagation(),Jr=null,a}var gd=C.gecko&&C.gecko_version==153?"#ffffff01":"transparent",p0=Ce.highest(A.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:`${gd} !important`},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}}));var m0=/x/.unicode!=null?"gu":"g";function Ah(){return bd}var yd=B.line({class:"cm-activeLine"}),bd=te.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let s=n.lineBlockAt(i.head);s.from>e&&(t.push(yd.range(s.from)),e=s.from)}return B.set(t)}},{decorations:n=>n.decorations});var Mn="-10000px",jn=class{constructor(e,t,i,s){this.facet=t,this.createTooltipView=i,this.removeTooltipView=s,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let r=null;this.tooltipViews=this.tooltips.map(o=>r=i(o,r))}update(e,t){var i;let s=e.state.facet(this.facet),r=s.filter(a=>a);if(s===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;at[h]=a),t.length=l.length),this.input=s,this.tooltips=r,this.tooltipViews=o,!0}};function xd(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}var cr=S.define({combine:n=>{var e,t,i;return{position:C.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||xd}}}),Aa=new WeakMap,co=te.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(cr);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new jn(n,Fi,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(cr);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",t.dom.appendChild(s)}return t.dom.style.position=this.position,t.dom.style.top=Mn,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(C.safari){let o=r.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!r.offsetParent&&r.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(n=r.width/this.parent.offsetWidth,e=r.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),s=ao(this.view);return{visible:{left:i.left+s.left,top:i.top+s.top,right:i.right-s.right,bottom:i.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((r,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(cr).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:t,space:i,scaleX:s,scaleY:r}=n,o=[];for(let l=0;l=Math.min(t.bottom,i.bottom)||f.rightMath.min(t.right,i.right)+.1)){c.style.top=Mn;continue}let d=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=u.right-u.left,g=(e=Aa.get(h))!==null&&e!==void 0?e:u.bottom-u.top,y=h.offset||vd,w=this.view.textDirection==V.LTR,b=u.width>i.right-i.left?w?i.left:i.right-u.width:w?Math.max(i.left,Math.min(f.left-(d?14:0)+y.x,i.right-m)):Math.min(Math.max(i.left,f.left-m+(d?14:0)-y.x),i.right-m),D=this.above[l];!a.strictSide&&(D?f.top-g-p-y.yi.bottom)&&D==i.bottom-f.bottom>f.top-i.top&&(D=this.above[l]=!D);let M=(D?f.top-i.top:i.bottom-f.bottom)-p;if(Mb&&N.topO&&(O=D?N.top-g-2-p:N.bottom+p+2);if(this.position=="absolute"?(c.style.top=(O-n.parent.top)/r+"px",Ma(c,(b-n.parent.left)/s)):(c.style.top=O/r+"px",Ma(c,b/s)),d){let N=f.left+(w?y.x:-y.x)-(b+14-7);d.style.left=N/s+"px"}h.overlap!==!0&&o.push({left:b,top:O,right:T,bottom:O+g}),c.classList.toggle("cm-tooltip-above",D),c.classList.toggle("cm-tooltip-below",!D),h.positioned&&h.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=Mn}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Ma(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}var wd=A.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),vd={x:0,y:0},Fi=S.define({enables:[co,wd]}),Un=S.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])}),_n=class n{static create(e){return new n(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new jn(e,Un,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let s=i[e];if(s!==void 0){if(t===void 0)t=s;else if(t!==s)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}},kd=Fi.compute([Un],n=>{let e=n.facet(Un);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:_n.create,above:e[0].above,arrow:e.some(t=>t.arrow)}}),Sd=S.define(),Xr=class{constructor(e,t,i,s,r,o){this.view=e,this.source=t,this.field=i,this.locked=s,this.setHover=r,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;eo.bottom||t.xo.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(s)).find(h=>h.from<=s&&h.to>=s),a=l&&l.dir==V.RTL?-1:1;r=t.x{if(l&&!(Array.isArray(l)&&!l.length)){let a=Array.isArray(l)?l:[l];s&&this.locked.set(a,s),e.dispatch({effects:this.setHover.of(a)})}};if(r&&"then"in r){let l=this.pending={pos:t};r.then(a=>{this.pending==l&&(this.pending=null,o(a))},a=>ne(e.state,a,"hover tooltip"))}else o(r)}get tooltip(){let e=this.view.plugin(co),t=e?e.manager.tooltips.findIndex(i=>i.create==_n.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:r}=this;if(s.length&&!this.locked.has(s)&&r&&!Cd(r.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,l=(i=(t=s[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!Ad(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t);let{active:s}=this;s.length&&!this.locked.has(s)&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}},Tn=4;function Cd(n,e){let{left:t,right:i,top:s,bottom:r}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();s=Math.min(l.top,s),r=Math.max(l.bottom,r)}return e.clientX>=t-Tn&&e.clientX<=i+Tn&&e.clientY>=s-Tn&&e.clientY<=r+Tn}function Ad(n,e,t,i,s,r){let o=n.scrollDOM.getBoundingClientRect(),l=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>i||o.rights||Math.min(o.bottom,l)=e&&a<=t}function Mh(n,e={}){let t=L.define(),i=new WeakMap,s=Z.define({create(){return[]},update(o,l){let a=i.get(o);if(o.length&&(e.hideOnChange&&(l.docChanged||l.selection)?o=[]:a&&a(l)?o=[]:e.hideOn&&(o=o.filter(h=>!e.hideOn(l,h)))),l.docChanged&&o.length){let h=[];for(let c of o){let f=l.changes.mapPos(c.pos,-1,ie.TrackDel);if(f!=null){let u=Object.assign(Object.create(null),c);u.pos=f,u.end!=null&&(u.end=l.changes.mapPos(u.end)),h.push(u)}}o=h}for(let h of l.effects)h.is(t)&&(o=h.value,a=void 0),(h.is(Md)&&!h.value||h.value==s)&&(o=[]);return o.length&&a&&i.set(o,a),o},provide:o=>Un.from(o)}),r=te.define(o=>new Xr(o,n,s,i,t,e.hoverTime||300));return{active:s,extension:[s,r,Sd.of(r),kd]}}function fo(n,e){let t=n.plugin(co);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}var Md=L.define();var Ta=S.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function Zn(n,e){let t=n.plugin(Th),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}var Th=te.fromClass(class{constructor(n){this.input=n.state.facet(Et),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(Ta);this.top=new Jt(n,!0,e.topContainer),this.bottom=new Jt(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(Ta);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Jt(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Jt(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Et);if(t!=this.input){let i=t.filter(a=>a),s=[],r=[],o=[],l=[];for(let a of i){let h=this.specs.indexOf(a),c;h<0?(c=a(n.view),l.push(c)):(c=this.panels[h],c.update&&c.update(n)),s.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>A.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})}),Jt=class{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Da(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Da(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}};function Da(n){let e=n.nextSibling;return n.remove(),e}var Et=S.define({enables:Th});function Dh(n,e){let t,i=new Promise(o=>t=o),s=o=>Td(o,e,t);n.state.field(fr,!1)?n.dispatch({effects:Oh.of(s)}):n.dispatch({effects:L.appendConfig.of(fr.init(()=>[s]))});let r=Bh.of(s);return{close:r,result:i.then(o=>((n.win.queueMicrotask||(a=>n.win.setTimeout(a,10)))(()=>{n.state.field(fr).indexOf(s)>-1&&n.dispatch({effects:r})}),o))}}var fr=Z.define({create(){return[]},update(n,e){for(let t of e.effects)t.is(Oh)?n=[t.value].concat(n):t.is(Bh)&&(n=n.filter(i=>i!=t.value));return n},provide:n=>Et.computeN([n],e=>e.field(n))}),Oh=L.define(),Bh=L.define();function Td(n,e,t){let i=e.content?e.content(n,()=>o(null)):null;if(!i){if(i=F("form"),e.input){let l=F("input",e.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),i.appendChild(F("label",(e.label||"")+": ",l))}else i.appendChild(document.createTextNode(e.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(F("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let s=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let l=0;l{h.keyCode==27?(h.preventDefault(),o(null)):h.keyCode==13&&(h.preventDefault(),o(a))}),a.addEventListener("submit",h=>{h.preventDefault(),o(a)})}let r=F("div",i,F("button",{onclick:()=>o(null),"aria-label":n.state.phrase("close"),class:"cm-dialog-close",type:"button"},["\xD7"]));e.class&&(r.className=e.class),r.classList.add("cm-dialog");function o(l){r.contains(r.ownerDocument.activeElement)&&n.focus(),t(l)}return{dom:r,top:e.top,mount:()=>{if(e.focus){let l;typeof e.focus=="string"?l=i.querySelector(e.focus):l=i.querySelector("input")||i.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}var Oe=class extends Se{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};Oe.prototype.elementClass="";Oe.prototype.toDOM=void 0;Oe.prototype.mapMode=ie.TrackBefore;Oe.prototype.startSide=Oe.prototype.endSide=-1;Oe.prototype.point=!0;var Bn=S.define(),Dd=S.define();var Ln=S.define();var Qr=S.define({combine:n=>n.some(e=>e)});function Od(n){let e=[Bd];return n&&n.fixed===!1&&e.push(Qr.of(!0)),e}var Bd=te.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(Ln).map(e=>new Gn(n,e)),this.fixed=!n.state.facet(Qr);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Qr)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=W.iter(this.view.state.facet(Bn),this.view.viewport.from),i=[],s=this.gutters.map(r=>new eo(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(r.type)){let o=!0;for(let l of r.type)if(l.type==pe.Text&&o){Zr(t,i,l.from);for(let a of s)a.line(this.view,l,i);o=!1}else if(l.widget)for(let a of s)a.widget(this.view,l)}else if(r.type==pe.Text){Zr(t,i,r.from);for(let o of s)o.line(this.view,r,i)}else if(r.widget)for(let o of s)o.widget(this.view,r);for(let r of s)r.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(Ln),t=n.state.facet(Ln),i=n.docChanged||n.heightChanged||n.viewportChanged||!W.eq(n.startState.facet(Bn),n.state.facet(Bn),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(n)&&(i=!0);else{i=!0;let s=[];for(let r of t){let o=e.indexOf(r);o<0?s.push(new Gn(this.view,r)):(this.gutters[o].update(n),s.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),s.indexOf(r)<0&&r.destroy();for(let r of s)r.config.side=="after"?this.getDOMAfter().appendChild(r.dom):this.dom.appendChild(r.dom);this.gutters=s}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>A.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,s=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==V.LTR?{left:i,right:s}:{right:i,left:s}})});function Oa(n){return Array.isArray(n)?n:[n]}function Zr(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}var eo=class{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=W.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:s}=this,r=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==s.elements.length){let l=new Yn(e,o,r,i);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,o,r,i);this.height=t.bottom,this.i++}line(e,t,i){let s=[];Zr(this.cursor,s,t.from),i.length&&(s=s.concat(i));let r=this.gutter.config.lineMarker(e,t,s);r&&s.unshift(r);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),s=i?[i]:null;for(let r of e.state.facet(Dd)){let o=r(e,t.widget,t);o&&(s||(s=[])).push(o)}s&&this.addElement(e,t,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}},Gn=class{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,s=>{let r=s.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let a=r.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=s.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,l,s)&&s.preventDefault()});this.markers=Oa(t.markers(e)),t.initialSpacer&&(this.spacer=new Yn(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Oa(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let i=e.view.viewport;return!W.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}},Yn=class{constructor(e,t,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,s)}update(e,t,i,s){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),Ld(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let i="cm-gutterElement",s=this.dom.firstChild;for(let r=0,o=0;;){let l=o,a=rr(l,a,h)||o(l,a,h):o}return i}})}}),Li=class extends Oe{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function ur(n,e){return n.state.facet(Xt).formatNumber(e,n.state)}var Pd=Ln.compute([Xt],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Ed)},lineMarker(e,t,i){return i.some(s=>s.toDOM)?null:new Li(ur(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let s of e.state.facet(Rd)){let r=s(e,t,i);if(r)return r}return null},lineMarkerChange:e=>e.startState.facet(Xt)!=e.state.facet(Xt),initialSpacer(e){return new Li(ur(e,Ba(e.state.doc.lines)))},updateSpacer(e,t){let i=ur(t.view,Ba(t.view.state.doc.lines));return i==e.number?e:new Li(i)},domEventHandlers:n.facet(Xt).domEventHandlers,side:"before"}));function Lh(n={}){return[Xt.of(n),Od(),Pd]}function Ba(n){let e=9;for(;e{let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head).from;s>t&&(t=s,e.push(Id.range(s)))}return W.of(e)});function Eh(){return Nd}var Fd=0,Wi=class{constructor(e,t){this.from=e,this.to=t}},R=class{constructor(e={}){this.id=Fd++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=fe.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}};R.closedBy=new R({deserialize:n=>n.split(" ")});R.openedBy=new R({deserialize:n=>n.split(" ")});R.group=new R({deserialize:n=>n.split(" ")});R.isolate=new R({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});R.contextHash=new R({perNode:!0});R.lookAhead=new R({perNode:!0});R.mounted=new R({perNode:!0});var Rt=class{constructor(e,t,i,s=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=s}static get(e){return e&&e.props&&e.props[R.mounted.id]}},Wd=Object.create(null),fe=class n{constructor(e,t,i,s=0){this.name=e,this.props=t,this.id=i,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):Wd,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new n(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(R.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(R.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?i.name:s[r]];if(o)return o}}}};fe.none=new fe("",Object.create(null),0,8);var is=class n{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|J.IncludeAnonymous);;){let h=!1;if(a.from<=r&&a.to>=s&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:xo(fe.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new n(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new n(fe.none,t,i,s)))}static build(e){return Vd(e)}};_.empty=new _(fe.none,[],[],0);var uo=class n{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new n(this.buffer,this.index)}},ut=class n{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return fe.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,i){let s=this.buffer,r=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function Hi(n,e,t,i){for(var s;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?a.length:-1;e!=c;e+=t){let f=a[e],u=h[e]+l.from;if(!(!(r&J.EnterBracketed&&f instanceof _&&((o=Rt.get(f))===null||o===void 0?void 0:o.overlay)===null&&(u>=i||u+f.length<=i))&&!Nh(s,i,u,u+f.length))){if(f instanceof ut){if(r&J.ExcludeBuffers)continue;let d=f.findChild(0,f.buffer.length,t,i-u,s);if(d>-1)return new Vi(new mo(l,f,e,u),null,d)}else if(r&J.IncludeAnonymous||!f.type.isAnonymous||bo(f)){let d;if(!(r&J.IgnoreMounts)&&(d=Rt.get(f))&&!d.overlay)return new n(d.tree,u,e,l);let p=new n(f,u,e,l);return r&J.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?f.children.length-1:0,t,i,s,r)}}}if(r&J.IncludeAnonymous||!l.type.isAnonymous||(l.index>=0?e=l.index+t:e=t<0?-1:l._parent._tree.children.length,l=l._parent,!l))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let s;if(!(i&J.IgnoreOverlays)&&(s=Rt.get(this._tree))&&s.overlay){let r=e-this.from,o=i&J.EnterBracketed&&s.bracketed;for(let{from:l,to:a}of s.overlay)if((t>0||o?l<=r:l=r:a>r))return new n(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function Ph(n,e,t,i){let s=n.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=s.type.is(t),!s.nextSibling())return r}for(;;){if(i!=null&&s.type.is(i))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return i==null?r:[]}}function po(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}var mo=class{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}},Vi=class n extends ns{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new n(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&J.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new n(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new n(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new n(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,s=this.index+4,r=i.buffer[this.index+3];if(r>s){let o=i.buffer[this.index+1];e.push(i.slice(s,r,o)),t.push(0)}return new _(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function Fh(n){if(!n.length)return null;let e=0,t=n[0];for(let r=1;rt.from||o.to=e){let l=new Ge(o.tree,o.overlay[0].from+r.from,-1,r);(s||(s=[i])).push(Hi(l,e,t,!1))}}return s?Fh(s):i}var zi=class{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~J.EnterBracketed,e instanceof Ge)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=i+s.buffer[e+1],this.to=i+s.buffer[e+2],!0}yield(e){return e?e instanceof Ge?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&J.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&J.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&J.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let l=i._tree.children[r];if(this.mode&J.IncludeAnonymous||l instanceof ut||!l.type.isAnonymous||bo(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,i=r+1;break e}s=this.stack[--r]}for(let s=i;s=0;r--){if(r<0)return po(this._tree,e,s);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}};function bo(n){return n.children.some(e=>e instanceof ut||!e.type.isAnonymous||bo(e))}function Vd(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=1024,reused:r=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new uo(t,t.length):t,a=i.types,h=0,c=0;function f(M,O,T,N,z,Y){let{id:I,start:E,end:j,size:G}=l,re=c,ot=h;if(G<0)if(l.next(),G==-1){let Ze=r[I];T.push(Ze),N.push(E-M);return}else if(G==-3){h=I;return}else if(G==-4){c=I;return}else throw new RangeError(`Unrecognized record size: ${G}`);let gi=a[I],sn,xt,vl=E-M;if(j-E<=s&&(xt=g(l.pos-O,z))){let Ze=new Uint16Array(xt.size-xt.skip),ke=l.pos-xt.size,$e=Ze.length;for(;l.pos>ke;)$e=y(xt.start,Ze,$e);sn=new ut(Ze,j-xt.start,i),vl=xt.start-M}else{let Ze=l.pos-G;l.next();let ke=[],$e=[],wt=I>=o?I:-1,zt=0,rn=j;for(;l.pos>Ze;)wt>=0&&l.id==wt&&l.size>=0?(l.end<=rn-s&&(p(ke,$e,E,zt,l.end,rn,wt,re,ot),zt=ke.length,rn=l.end),l.next()):Y>2500?u(E,Ze,ke,$e):f(E,Ze,ke,$e,wt,Y+1);if(wt>=0&&zt>0&&zt-1&&zt>0){let kl=d(gi,ot);sn=xo(gi,ke,$e,0,ke.length,0,j-E,kl,kl)}else sn=m(gi,ke,$e,j-E,re-j,ot)}T.push(sn),N.push(vl)}function u(M,O,T,N){let z=[],Y=0,I=-1;for(;l.pos>O;){let{id:E,start:j,end:G,size:re}=l;if(re>4)l.next();else{if(I>-1&&j=0;G-=3)E[re++]=z[G],E[re++]=z[G+1]-j,E[re++]=z[G+2]-j,E[re++]=re;T.push(new ut(E,z[2]-j,i)),N.push(j-M)}}function d(M,O){return(T,N,z)=>{let Y=0,I=T.length-1,E,j;if(I>=0&&(E=T[I])instanceof _){if(!I&&E.type==M&&E.length==z)return E;(j=E.prop(R.lookAhead))&&(Y=N[I]+E.length+j)}return m(M,T,N,z,Y,O)}}function p(M,O,T,N,z,Y,I,E,j){let G=[],re=[];for(;M.length>N;)G.push(M.pop()),re.push(O.pop()+T-z);M.push(m(i.types[I],G,re,Y-z,E-Y,j)),O.push(z-T)}function m(M,O,T,N,z,Y,I){if(Y){let E=[R.contextHash,Y];I=I?[E].concat(I):[E]}if(z>25){let E=[R.lookAhead,z];I=I?[E].concat(I):[E]}return new _(M,O,T,N,I)}function g(M,O){let T=l.fork(),N=0,z=0,Y=0,I=T.end-s,E={size:0,start:0,skip:0};e:for(let j=T.pos-M;T.pos>j;){let G=T.size;if(T.id==O&&G>=0){E.size=N,E.start=z,E.skip=Y,Y+=4,N+=4,T.next();continue}let re=T.pos-G;if(G<0||re=o?4:0,gi=T.start;for(T.next();T.pos>re;){if(T.size<0)if(T.size==-3||T.size==-4)ot+=4;else break e;else T.id>=o&&(ot+=4);T.next()}z=gi,N+=G,Y+=ot}return(O<0||N==M)&&(E.size=N,E.start=z,E.skip=Y),E.size>4?E:void 0}function y(M,O,T){let{id:N,start:z,end:Y,size:I}=l;if(l.next(),I>=0&&N4){let j=l.pos-(I-4);for(;l.pos>j;)T=y(M,O,T)}O[--T]=E,O[--T]=Y-M,O[--T]=z-M,O[--T]=N}else I==-3?h=N:I==-4&&(c=N);return T}let w=[],b=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,w,b,-1,0);let D=(e=n.length)!==null&&e!==void 0?e:w.length?b[0]+w[0].length:0;return new _(a[n.topID],w.reverse(),b.reverse(),D)}var Ih=new WeakMap;function ts(n,e){if(!n.isAnonymous||e instanceof ut||e.type!=n)return 1;let t=Ih.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof _)){t=1;break}t+=ts(n,i)}Ih.set(e,t)}return t}function xo(n,e,t,i,s,r,o,l,a){let h=0;for(let p=i;p=c)break;O+=T}if(b==D+1){if(O>c){let T=p[D];d(T.children,T.positions,0,T.children.length,m[D]+w);continue}f.push(p[D])}else{let T=m[b-1]+p[b-1].length-M;f.push(xo(n,p,m,D,b,M,T,null,a))}u.push(M+w-r)}}return d(e,t,i,s,0),(l||a)(f,u,o)}var Pt=class n{constructor(e,t,i,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let s=[new n(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=i)for(;o&&o.from=u.from||f<=u.to||h){let d=Math.max(u.from,a)-h,p=Math.min(u.to,f)-h;u=d>=p?null:new n(d,p,u.tree,u.offset+h,l>0,!!c)}if(u&&s.push(u),o.to>f)break;o=rnew Wi(s.from,s.to)):[new Wi(0,0)]:[new Wi(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let r=s.advance();if(r)return r}}},yo=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};var S0=new R({perNode:!0});var zd=0,We=class n{constructor(e,t,i,s){this.name=e,this.set=t,this.base=i,this.modified=s,this.id=zd++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof n&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let s=new n(i,[],null,[]);if(s.set.push(s),t)for(let r of t.set)s.set.push(r);return s}static defineModifier(e){let t=new ls(e);return i=>i.modified.indexOf(t)>-1?i:ls.get(i.base||i,i.modified.concat(t).sort((s,r)=>s.id-r.id))}},qd=0,ls=class n{constructor(e){this.name=e,this.instances=[],this.id=qd++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&Kd(t,l.modified));if(i)return i;let s=[],r=new We(e.name,s,e,t);for(let l of t)l.instances.push(r);let o=$d(t);for(let l of e.set)if(!l.modified.length)for(let a of o)s.push(n.get(l,a));return r}};function Kd(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function $d(n){let e=[[]];for(let t=0;ti.length-t.length)}function Vh(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let s of t.split(" "))if(s){let r=[],o=2,l=s;for(let f=0;;){if(l=="..."&&f>0&&f+3==s.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+s);if(r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==s.length)break;let d=s[f++];if(f==s.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let a=r.length-1,h=r[a];if(!h)throw new RangeError("Invalid path: "+s);let c=new Nt(i,o,a>0?r.slice(0,a):null);e[h]=c.sort(e[h])}}return zh.add(e)}var zh=new R({combine(n,e){let t,i,s;for(;n||e;){if(!n||e&&n.depth>=e.depth?(s=e,e=e.next):(s=n,n=n.next),t&&t.mode==s.mode&&!s.context&&!t.context)continue;let r=new Nt(s.tags,s.mode,s.context);t?t.next=r:i=r,t=r}return i}}),Nt=class{constructor(e,t,i,s){this.tags=e,this.mode=t,this.context=i,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=s;for(let l of r)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function jd(n,e){let t=null;for(let i of n){let s=i.style(e);s&&(t=t?t+" "+s:s)}return t}function qh(n,e,t,i=0,s=n.length){let r=new vo(i,Array.isArray(e)?e:[e],t);r.highlightRange(n.cursor(),i,s,"",r.highlighters),r.flush(s)}var vo=class{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,s,r){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=s,c=Ud(e)||Nt.empty,f=jd(r,c.tags);if(f&&(h&&(h+=" "),h+=f,c.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(t,l),h),c.opaque)return;let u=e.tree&&e.tree.prop(R.mounted);if(u&&u.overlay){let d=e.node.enter(u.overlay[0].from+l,1),p=this.highlighters.filter(g=>!g.scope||g.scope(u.tree.type)),m=e.firstChild();for(let g=0,y=l;;g++){let w=g=b||!e.nextSibling())););if(!w||b>i)break;y=w.to+l,y>t&&(this.highlightRange(d.cursor(),Math.max(t,w.from+l),Math.min(i,y),"",p),this.startSpan(Math.min(i,y),h))}m&&e.parent()}else if(e.firstChild()){u&&(s="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,s,r),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}};function Ud(n){let e=n.type.prop(zh);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}var k=We.define,ss=k(),dt=k(),Wh=k(dt),Hh=k(dt),pt=k(),rs=k(pt),wo=k(pt),Xe=k(),It=k(Xe),Ye=k(),Je=k(),ko=k(),Ki=k(ko),os=k(),v={comment:ss,lineComment:k(ss),blockComment:k(ss),docComment:k(ss),name:dt,variableName:k(dt),typeName:Wh,tagName:k(Wh),propertyName:Hh,attributeName:k(Hh),className:k(dt),labelName:k(dt),namespace:k(dt),macroName:k(dt),literal:pt,string:rs,docString:k(rs),character:k(rs),attributeValue:k(rs),number:wo,integer:k(wo),float:k(wo),bool:k(pt),regexp:k(pt),escape:k(pt),color:k(pt),url:k(pt),keyword:Ye,self:k(Ye),null:k(Ye),atom:k(Ye),unit:k(Ye),modifier:k(Ye),operatorKeyword:k(Ye),controlKeyword:k(Ye),definitionKeyword:k(Ye),moduleKeyword:k(Ye),operator:Je,derefOperator:k(Je),arithmeticOperator:k(Je),logicOperator:k(Je),bitwiseOperator:k(Je),compareOperator:k(Je),updateOperator:k(Je),definitionOperator:k(Je),typeOperator:k(Je),controlOperator:k(Je),punctuation:ko,separator:k(ko),bracket:Ki,angleBracket:k(Ki),squareBracket:k(Ki),paren:k(Ki),brace:k(Ki),content:Xe,heading:It,heading1:k(It),heading2:k(It),heading3:k(It),heading4:k(It),heading5:k(It),heading6:k(It),contentSeparator:k(Xe),list:k(Xe),quote:k(Xe),emphasis:k(Xe),strong:k(Xe),link:k(Xe),monospace:k(Xe),strikethrough:k(Xe),inserted:k(),deleted:k(),changed:k(),invalid:k(),meta:os,documentMeta:k(os),annotation:k(os),processingInstruction:k(os),definition:We.defineModifier("definition"),constant:We.defineModifier("constant"),function:We.defineModifier("function"),standard:We.defineModifier("standard"),local:We.defineModifier("local"),special:We.defineModifier("special")};for(let n in v){let e=v[n];e instanceof We&&(e.name=n)}var M0=So([{tag:v.link,class:"tok-link"},{tag:v.heading,class:"tok-heading"},{tag:v.emphasis,class:"tok-emphasis"},{tag:v.strong,class:"tok-strong"},{tag:v.keyword,class:"tok-keyword"},{tag:v.atom,class:"tok-atom"},{tag:v.bool,class:"tok-bool"},{tag:v.url,class:"tok-url"},{tag:v.labelName,class:"tok-labelName"},{tag:v.inserted,class:"tok-inserted"},{tag:v.deleted,class:"tok-deleted"},{tag:v.literal,class:"tok-literal"},{tag:v.string,class:"tok-string"},{tag:v.number,class:"tok-number"},{tag:[v.regexp,v.escape,v.special(v.string)],class:"tok-string2"},{tag:v.variableName,class:"tok-variableName"},{tag:v.local(v.variableName),class:"tok-variableName tok-local"},{tag:v.definition(v.variableName),class:"tok-variableName tok-definition"},{tag:v.special(v.variableName),class:"tok-variableName2"},{tag:v.definition(v.propertyName),class:"tok-propertyName tok-definition"},{tag:v.typeName,class:"tok-typeName"},{tag:v.namespace,class:"tok-namespace"},{tag:v.className,class:"tok-className"},{tag:v.macroName,class:"tok-macroName"},{tag:v.propertyName,class:"tok-propertyName"},{tag:v.operator,class:"tok-operator"},{tag:v.comment,class:"tok-comment"},{tag:v.meta,class:"tok-meta"},{tag:v.invalid,class:"tok-invalid"},{tag:v.punctuation,class:"tok-punctuation"}]);var Co,oi=new R;function Gd(n){return S.define({combine:n?e=>e.concat(n):void 0})}var Yd=new R,xe=class{constructor(e,t,i=[],s=""){this.data=e,this.name=s,q.prototype.hasOwnProperty("tree")||Object.defineProperty(q.prototype,"tree",{get(){return we(this)}}),this.parser=t,this.extension=[li.of(this),q.languageData.of((r,o,l)=>{let a=Kh(r,o,l),h=a.type.prop(oi);if(!h)return[];let c=r.facet(h),f=a.type.prop(Yd);if(f){let u=a.resolve(o-a.from,l);for(let d of f)if(d.test(u,r)){let p=r.facet(d.facet);return d.type=="replace"?p:p.concat(c)}}return c})].concat(i)}isActiveAt(e,t,i=-1){return Kh(e,t,i).type.prop(oi)==this.data}findRegions(e){let t=e.facet(li);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(oi)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(R.mounted);if(l){if(l.tree.prop(oi)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let a=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;a=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}},$i=null,ji=class n{constructor(e,t,i=[],s,r,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new n(e,t,[],_.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Do(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=_.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Pt.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=$i;$i=this;try{return e()}finally{$i=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=$h(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,c,f,u)=>a.push({fromA:h,toA:c,fromB:f,toB:u})),i=Pt.applyChanges(i,a),s=_.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);ce.from&&(this.fragments=$h(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends qi{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let a=$i;if(a){for(let h of s)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new _(fe.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return $i}};function $h(n,e,t){return Pt.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}var Ui=class n{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new n(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=ji.create(e.facet(li).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new n(i)}};xe.state=Z.define({create:Ui.init,update(n,e){for(let t of e.effects)if(t.is(xe.setState))return t.value;return e.startState.facet(li)!=e.state.facet(li)?Ui.init(e.state):n.apply(e)}});var Jh=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Jh=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});var Ao=typeof navigator<"u"&&(!((Co=navigator.scheduling)===null||Co===void 0)&&Co.isInputPending)?()=>navigator.scheduling.isInputPending():null,Jd=te.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(xe.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(xe.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Jh(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3,a=r.context.work(()=>Ao&&Ao()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:xe.setState.of(new Ui(r.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>ne(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),li=S.define({combine(n){return n.length?n[0]:null},enables:n=>[xe.state,Jd,A.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});var Xd=S.define(),hi=S.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function mt(n){let e=n.facet(hi);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Gi(n,e){let t="",i=n.tabSize,s=n.facet(hi)[0];if(s==" "){for(;e>=i;)t+=" ",e-=i;s=" "}for(let r=0;r=e?Qd(n,t,e):null}var Ft=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=mt(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:r}=this.options;return s!=null&&s>=i.from&&s<=i.to?r&&s==e?{text:"",from:e}:(t<0?s-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return Mt(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},Xh=new R;function Qd(n,e,t){let i=e.resolveStack(t),s=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(s!=i.node){let r=[];for(let o=s;o&&!(o.fromi.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)i={node:r[o],next:i}}return Qh(i,n,t)}function Qh(n,e,t){for(let i=n;i;i=i.next){let s=ep(i.node);if(s)return s(Oo.create(e,t,i))}return 0}function Zd(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function ep(n){let e=n.type.prop(Xh);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(R.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>sp(o,!0,1,void 0,r&&!Zd(o)?s.from:void 0)}return n.parent==null?tp:null}function tp(){return 0}var Oo=class n extends Ft{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new n(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(ip(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return Qh(this.context.next,this.base,this.pos)}};function ip(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function np(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let h=/^ */.exec(r.text.slice(t.to-r.from))[0].length;return{from:t.from,to:t.to+h}}l=a.to}}function sp(n,e,t,i,s){let r=n.textAfter,o=r.match(/^\s*/)[0].length,l=i&&r.slice(o,o+i.length)==i||s==n.pos+o,a=e?np(n):null;return a?l?n.column(a.from):n.column(a.to):n.baseIndent+(l?0:n.unit*t)}var ai=class n{constructor(e,t){this.specs=e;let i;function s(l){let a=Ae.newName();return(i||(i=Object.create(null)))["."+a]=l,a}let r=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof xe?l=>l.prop(oi)==o.data:o?l=>l==o:void 0,this.style=So(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new Ae(i):null,this.themeType=t.themeType}static define(e,t){return new n(e,t||{})}},Bo=S.define(),Zh=S.define({combine(n){return n.length?[n[0]]:null}});function Mo(n){let e=n.facet(Bo);return e.length?e:n.facet(Zh)}function ec(n,e){let t=[rp],i;return n instanceof ai&&(n.module&&t.push(A.styleModule.of(n.module)),i=n.themeType),e?.fallback?t.push(Zh.of(n)):i?t.push(Bo.computeN([A.darkTheme],s=>s.facet(A.darkTheme)==(i=="dark")?[n]:[])):t.push(Bo.of(n)),t}var Lo=class{constructor(e){this.markCache=Object.create(null),this.tree=we(e.state),this.decorations=this.buildDeco(e,Mo(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=we(e.state),i=Mo(e.state),s=i!=Mo(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||s)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return B.none;let i=new Ee;for(let{from:s,to:r}of e.visibleRanges)qh(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=B.mark({class:a})))},s,r);return i.finish()}},rp=Ce.high(te.fromClass(Lo,{decorations:n=>n.decorations})),P0=ai.define([{tag:v.meta,color:"#404740"},{tag:v.link,textDecoration:"underline"},{tag:v.heading,textDecoration:"underline",fontWeight:"bold"},{tag:v.emphasis,fontStyle:"italic"},{tag:v.strong,fontWeight:"bold"},{tag:v.strikethrough,textDecoration:"line-through"},{tag:v.keyword,color:"#708"},{tag:[v.atom,v.bool,v.url,v.contentSeparator,v.labelName],color:"#219"},{tag:[v.literal,v.inserted],color:"#164"},{tag:[v.string,v.deleted],color:"#a11"},{tag:[v.regexp,v.escape,v.special(v.string)],color:"#e40"},{tag:v.definition(v.variableName),color:"#00f"},{tag:v.local(v.variableName),color:"#30a"},{tag:[v.typeName,v.namespace],color:"#085"},{tag:v.className,color:"#167"},{tag:[v.special(v.variableName),v.macroName],color:"#256"},{tag:v.definition(v.propertyName),color:"#00c"},{tag:v.comment,color:"#940"},{tag:v.invalid,color:"#f00"}]),op=A.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),tc=1e4,ic="()[]{}",nc=S.define({combine(n){return ye(n,{afterCursor:!0,brackets:ic,maxScanDistance:tc,renderMatch:hp})}}),lp=B.mark({class:"cm-matchingBracket"}),ap=B.mark({class:"cm-nonmatchingBracket"});function hp(n){let e=[],t=n.matched?lp:ap;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function jh(n){let e=[],t=n.facet(nc);for(let i of n.selection.ranges){if(!i.empty)continue;let s=He(n,i.head,-1,t)||i.head>0&&He(n,i.head-1,1,t)||t.afterCursor&&(He(n,i.head,1,t)||i.headn.decorations}),fp=[cp,op];function sc(n={}){return[nc.of(n),fp]}var up=new R;function Eo(n,e,t){let i=n.prop(e<0?R.openedBy:R.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function Ro(n){let e=n.type.prop(up);return e?e(n.node):n}function He(n,e,t,i={}){let s=i.maxScanDistance||tc,r=i.brackets||ic,o=we(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let h=Eo(a.type,t,r);if(h&&a.from0?e>=c.from&&ec.from&&e<=c.to))return dp(n,e,t,a,c,h,r)}}return pp(n,e,t,o,l.type,s,r)}function dp(n,e,t,i,s,r,o){let l=i.parent,a={from:s.from,to:s.to},h=0,c=l?.cursor();if(c&&(t<0?c.childBefore(i.from):c.childAfter(i.to)))do if(t<0?c.to<=i.from:c.from>=i.to){if(h==0&&r.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=r;){let d=c.value;t<0&&(u+=d.length);let p=e+u*t;for(let m=t>0?0:d.length-1,g=t>0?d.length:-1;m!=g;m+=t){let y=o.indexOf(d[m]);if(!(y<0||i.resolveInner(p+m,1).type!=s))if(y%2==0==t>0)f++;else{if(f==1)return{start:h,end:{from:p+m,to:p+m+1},matched:y>>1==a>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:h,matched:!1}:null}function Uh(n,e,t,i=0,s=0){e==null&&(e=n.search(/[^\s\u00a0]/),e==-1&&(e=n.length));let r=s;for(let o=i;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosi?o.toLowerCase():o,r=this.string.substr(this.pos,e.length);return s(r)==s(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}};function mp(n){return{name:n.name||"",token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||gp,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||Fo,mergeTokens:n.mergeTokens!==!1}}function gp(n){if(typeof n!="object")return n;let e={};for(let t in n){let i=n[t];e[t]=i instanceof Array?i.slice():i}return e}var _h=new WeakMap,hs=class n extends xe{constructor(e){let t=Gd(e.languageData),i=mp(e),s,r=new class extends qi{createParse(o,l,a){return new Po(s,o,l,a)}};super(t,r,[],e.name),this.topNode=wp(t,this),s=this,this.streamParser=i,this.stateAfter=new R({perNode:!0}),this.tokenTable=e.tokenTable?new cs(i.tokenTable):xp}static define(e){return new n(e)}getIndent(e){let t,{overrideIndentation:i}=e.options;i&&(t=_h.get(e.state),t!=null&&t1e4)return null;for(;r=i&&t+e.length<=s&&e.prop(n.stateAfter);if(r)return{state:n.streamParser.copyState(r),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],a=t+e.positions[o],h=l instanceof _&&a=e.length)return e;!s&&t==0&&e.type==n.topNode&&(s=!0);for(let r=e.children.length-1;r>=0;r--){let o=e.positions[r],l=e.children[r],a;if(ot&&No(n,r.tree,0-r.offset,t,l),h;if(a&&a.pos<=i&&(h=rc(n,r.tree,t+r.offset,a.pos+r.offset,!1)))return{state:a.state,tree:h}}return{state:n.streamParser.startState(s?mt(s):4),tree:_.empty}}var Po=class{constructor(e,t,i,s){this.lang=e,this.input=t,this.fragments=i,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let r=ji.get(),o=s[0].from,{state:l,tree:a}=yp(e,i,o,this.to,r?.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let h=0;hh.from<=r.viewport.from&&h.to>=r.viewport.from)&&(this.state=this.lang.streamParser.startState(mt(r.state)),r.skipUntilInView(this.parsedPos,r.viewport.from),this.parsedPos=r.viewport.from),this.moveRangeIndex()}advance(){let e=ji.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),i=Math.min(t,this.chunkStart+512);for(e&&(i=Math.min(i,e.viewport.to));this.parsedPos=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==` +`&&(t="");else{let i=t.indexOf(` +`);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let s=this.rangeIndex;;){let r=this.ranges[s].to;if(r>=i||(t=t.slice(0,r-(i-t.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let s=this.ranges[this.rangeIndex].to,r=e+t;if(i>0?s>r:s>=r)break;let o=this.ranges[++this.rangeIndex].from;t+=o-s}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(t,s,1),t+=s;let l=this.chunk.length;s=this.skipGapsTo(i,s,-1),i+=s,r+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&r==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=i:this.chunk.push(e,t,i,r),s}parseLine(e){let{line:t,end:i}=this.nextLine(),s=0,{streamParser:r}=this.lang,o=new as(t,e?e.state.tabSize:4,e?mt(e.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=oc(r.token,o,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,s)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}var Fo=Object.create(null),_i=[fe.none],bp=new is(_i),Gh=[],Yh=Object.create(null),lc=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])lc[n]=ac(Fo,e);var cs=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),lc)}resolve(e){return e?this.table[e]||(this.table[e]=ac(this.extra,e)):0}},xp=new cs(Fo);function To(n,e){Gh.indexOf(n)>-1||(Gh.push(n),console.warn(e))}function ac(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=n[h]||v[h];c?typeof c=="function"?a.length?a=a.map(c):To(h,`Modifier ${h} used at start of tag`):a.length?To(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:To(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),s=i+" "+t.map(l=>l.id),r=Yh[s];if(r)return r.id;let o=Yh[s]=fe.define({id:_i.length,name:i,props:[Vh({[i]:t})]});return _i.push(o),o.id}function wp(n,e){let t=fe.define({id:_i.length,name:"Document",props:[oi.add(()=>n),Xh.add(()=>i=>e.getIndent(i))],top:!0});return _i.push(t),t}var I0={rtl:B.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:V.RTL}),ltr:B.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:V.LTR}),auto:B.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var vp=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=$o(n.state,t.from);return i.line?kp(n):i.block?Cp(n):!1};function Ko(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}var kp=Ko(Tp,0);var Sp=Ko(yc,0);var Cp=Ko((n,e)=>yc(n,e,Mp(e)),0);function $o(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}var Yi=50;function Ap(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-Yi,i),o=n.sliceDoc(s,s+Yi),l=/\s*$/.exec(r)[0].length,a=/^\s*/.exec(o)[0].length,h=r.length-l;if(r.slice(h-e.length,h)==e&&o.slice(a,a+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:s+a,margin:a&&1}};let c,f;s-i<=2*Yi?c=f=n.sliceDoc(i,s):(c=n.sliceDoc(i,i+Yi),f=n.sliceDoc(s-Yi,s));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-t.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function Mp(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to);s.from>i.from&&s.from==t.to&&(s=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:s.to})}return e}function yc(n,e,t=e.selection.ranges){let i=t.map(r=>$o(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>Ap(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,l;os&&(r==o||o>f.from)){s=f.from;let u=/^\s*/.exec(f.text)[0].length,d=u==f.length,p=f.text.slice(u,u+h.length)==h?u:-1;ur.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:a,indent:h,empty:c,single:f}of i)(f||!c)&&r.push({from:l.from+h,insert:a+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let h=o.from+l,c=h+a.length;o.text[c-o.from]==" "&&c++,r.push({from:h,to:c})}return{changes:r}}return null}var Ho=ue.define(),Dp=ue.define(),Op=S.define(),bc=S.define({combine(n){return ye(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,s)=>e(i,s)||t(i,s)})}}),xc=Z.define({create(){return Wt.empty},update(n,e){let t=e.state.facet(bc),i=e.annotation(Ho);if(i){let a=Ve.fromTransaction(e,i.selection),h=i.side,c=h==0?n.undone:n.done;return a?c=us(c,c.length,t.minDepth,a):c=Sc(c,e.startState.selection),new Wt(h==0?i.rest:c,h==0?c:i.rest)}let s=e.annotation(Dp);if((s=="full"||s=="before")&&(n=n.isolate()),e.annotation(Q.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let r=Ve.fromTransaction(e),o=e.annotation(Q.time),l=e.annotation(Q.userEvent);return r?n=n.addChanges(r,o,l,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(s=="full"||s=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new Wt(n.done.map(Ve.fromJSON),n.undone.map(Ve.fromJSON))}});function wc(n={}){return[xc,bc.of(n),A.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?vc:e.inputType=="historyRedo"?Vo:null;return i?(e.preventDefault(),i(t)):!1}})]}function ds(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let s=t.field(xc,!1);if(!s)return!1;let r=s.pop(n,t,e);return r?(i(r),!0):!1}}var vc=ds(0,!1),Vo=ds(1,!1),Bp=ds(0,!0),Lp=ds(1,!0);var Ve=class n{constructor(e,t,i,s,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new n(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new n(e.changes&&ae.fromJSON(e.changes),[],e.mapped&&et.fromJSON(e.mapped),e.startSelection&&x.fromJSON(e.startSelection),e.selectionsAfter.map(x.fromJSON))}static fromTransaction(e,t){let i=Be;for(let s of e.startState.facet(Op)){let r=s(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new n(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Be)}static selection(e){return new n(void 0,Be,void 0,void 0,e)}};function us(n,e,t,i){let s=e+1>t+20?e-t-1:0,r=n.slice(s,e);return r.push(i),r}function Ep(n,e){let t=[],i=!1;return n.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,l)=>{for(let a=0;a=h&&o<=c&&(i=!0)}}),i}function Rp(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function kc(n,e){return n.length?e.length?n.concat(e):n:e}var Be=[],Pp=200;function Sc(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-Pp));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),us(n,n.length-1,1e9,t.setSelAfter(i)))}else return[Ve.selection([e])]}function Ip(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Wo(n,e){if(!n.length)return n;let t=n.length,i=Be;for(;t;){let s=Np(n[t-1],e,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,i=s.selectionsAfter}return i.length?[Ve.selection(i)]:Be}function Np(n,e,t){let i=kc(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):Be,t);if(!n.changes)return Ve.selection(i);let s=n.changes.map(e),r=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new Ve(s,L.mapEffects(n.effects,e),o,n.startSelection.map(r),i)}var Fp=/^(input\.type|delete)($|\.)/,Wt=class n{constructor(e,t,i=0,s=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new n(this.done,this.undone):this}addChanges(e,t,i,s,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||Fp.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):ps(t,e))}function le(n){return n.textDirectionAt(n.state.selection.main.head)==V.LTR}var Mc=n=>Ac(n,!le(n)),Tc=n=>Ac(n,le(n));function Dc(n,e){return qe(n,t=>t.empty?n.moveByGroup(t,e):ps(t,e))}var Wp=n=>Dc(n,!le(n)),Hp=n=>Dc(n,le(n));var $0=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function Vp(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function ms(n,e,t){let i=we(n).resolveInner(e.head),s=t?R.closedBy:R.openedBy;for(let a=e.head;;){let h=t?i.childAfter(a):i.childBefore(a);if(!h)break;Vp(n,h,s)?i=h:a=t?h.to:h.from}let r=i.type.prop(s),o,l;return r&&(o=t?He(n,i.from,1):He(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,x.cursor(l,t?-1:1)}var zp=n=>qe(n,e=>ms(n.state,e,!le(n))),qp=n=>qe(n,e=>ms(n.state,e,le(n)));function Oc(n,e){return qe(n,t=>{if(!t.empty)return ps(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}var Bc=n=>Oc(n,!1),Lc=n=>Oc(n,!0);function Ec(n){let e=n.scrollDOM.clientHeighto.empty?n.moveVertically(o,e,t.height):ps(o,e));if(s.eq(i.selection))return!1;let r;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),l=n.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,h=l.bottom-t.marginBottom;o&&o.top>a&&o.bottomRc(n,!1),zo=n=>Rc(n,!0);function gt(n,e,t){let i=n.lineBlockAt(e.head),s=n.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?i.to:i.from)&&(s=n.moveToLineBoundary(e,t,!1)),!t&&s.head==i.from&&i.length){let r=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(s=x.cursor(i.from+r))}return s}var Kp=n=>qe(n,e=>gt(n,e,!0)),$p=n=>qe(n,e=>gt(n,e,!1)),jp=n=>qe(n,e=>gt(n,e,!le(n))),Up=n=>qe(n,e=>gt(n,e,le(n))),_p=n=>qe(n,e=>x.cursor(n.lineBlockAt(e.head).from,1)),Gp=n=>qe(n,e=>x.cursor(n.lineBlockAt(e.head).to,-1));function Yp(n,e,t){let i=!1,s=ci(n.selection,r=>{let o=He(n,r.head,-1)||He(n,r.head,1)||r.head>0&&He(n,r.head-1,1)||r.headYp(n,e,!1);function Le(n,e,t){let i=ci(n.state.selection,s=>{s.undirectional&&s.head>=s.anchor!=e&&(s=x.range(s.head,s.anchor));let r=t(s);return x.range(s.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return i.eq(n.state.selection)?!1:(n.dispatch(ze(n.state,i)),!0)}function Pc(n,e){return Le(n,e,t=>n.moveByChar(t,e))}var Ic=n=>Pc(n,!le(n)),Nc=n=>Pc(n,le(n));function Fc(n,e){return Le(n,e,t=>n.moveByGroup(t,e))}var Xp=n=>Fc(n,!le(n)),Qp=n=>Fc(n,le(n));var Zp=n=>{let e=!le(n);return Le(n,e,t=>ms(n.state,t,e))},em=n=>{let e=le(n);return Le(n,e,t=>ms(n.state,t,e))};function Wc(n,e){return Le(n,e,t=>n.moveVertically(t,e))}var Hc=n=>Wc(n,!1),Vc=n=>Wc(n,!0);function zc(n,e){return Le(n,e,t=>n.moveVertically(t,e,Ec(n).height))}var cc=n=>zc(n,!1),fc=n=>zc(n,!0),tm=n=>Le(n,!0,e=>gt(n,e,!0)),im=n=>Le(n,!1,e=>gt(n,e,!1)),nm=n=>{let e=!le(n);return Le(n,e,t=>gt(n,t,e))},sm=n=>{let e=le(n);return Le(n,e,t=>gt(n,t,e))},rm=n=>Le(n,!1,e=>x.cursor(n.lineBlockAt(e.head).from)),om=n=>Le(n,!0,e=>x.cursor(n.lineBlockAt(e.head).to)),uc=({state:n,dispatch:e})=>(e(ze(n,{anchor:0})),!0),dc=({state:n,dispatch:e})=>(e(ze(n,{anchor:n.doc.length})),!0),pc=({state:n,dispatch:e})=>(e(ze(n,{anchor:n.selection.main.anchor,head:0})),!0),mc=({state:n,dispatch:e})=>(e(ze(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),lm=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),am=({state:n,dispatch:e})=>{let t=gs(n).map(({from:i,to:s})=>x.range(i,Math.min(s+1,n.doc.length)));return e(n.update({selection:x.create(t),userEvent:"select"})),!0},hm=({state:n,dispatch:e})=>{let t=ci(n.selection,i=>{let s=we(n),r=s.resolveStack(i.from,1);if(i.empty){let o=s.resolveStack(i.from,-1);o.node.from>=r.node.from&&o.node.to<=r.node.to&&(r=o)}for(let o=r;o;o=o.next){let{node:l}=o;if((l.from=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return x.range(l.to,l.from)}return i});return t.eq(n.selection)?!1:(e(ze(n,t)),!0)};function qc(n,e){let{state:t}=n,i=t.selection,s=t.selection.ranges.slice();for(let r of t.selection.ranges){let o=t.doc.lineAt(r.head);if(e?o.to0)for(let l=r;;){let a=n.moveVertically(l,e);if(a.heado.to){s.some(h=>h.head==a.head)||s.push(a);break}else{if(a.head==l.head)break;l=a}}}return s.length==i.ranges.length?!1:(n.dispatch(ze(t,x.create(s,s.length-1))),!0)}var cm=n=>qc(n,!1),fm=n=>qc(n,!0),um=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=x.create([t.main]):t.main.empty||(i=x.create([x.cursor(t.main.head)])),i?(e(ze(n,i)),!0):!1};function Ji(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,s=i.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let a=e(r);ao&&(t="delete.forward",a=fs(n,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=fs(n,o,!1),l=fs(n,l,!0);return o==l?{range:r}:{changes:{from:o,to:l},range:x.cursor(o,os(n)))i.between(e,e,(s,r)=>{se&&(e=t?r:s)});return e}var Kc=(n,e,t)=>Ji(n,i=>{let s=i.from,{state:r}=n,o=r.doc.lineAt(s),l,a;if(t&&!e&&s>o.from&&sKc(n,!1,!0);var $c=n=>Kc(n,!0,!1),jc=(n,e)=>Ji(n,t=>{let i=t.head,{state:s}=n,r=s.doc.lineAt(i),o=s.charCategorizer(i);for(let l=null;;){if(i==(e?r.to:r.from)){i==t.head&&r.number!=(e?s.doc.lines:1)&&(i+=e?1:-1);break}let a=X(r.text,i-r.from,e)+r.from,h=r.text.slice(Math.min(i,a)-r.from,Math.max(i,a)-r.from),c=o(h);if(l!=null&&c!=l)break;(h!=" "||i!=t.head)&&(l=c),i=a}return i}),Uc=n=>jc(n,!1),dm=n=>jc(n,!0);var pm=n=>Ji(n,e=>{let t=n.lineBlockAt(e.head).to;return e.headJi(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),gm=n=>Ji(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:P.of(["",""])},range:x.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},bm=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let s=i.from,r=n.doc.lineAt(s),o=s==r.from?s-1:X(r.text,s-r.from,!1)+r.from,l=s==r.to?s+1:X(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:n.doc.slice(s,l).append(n.doc.slice(o,s))},range:x.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function gs(n){let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.from),r=n.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=n.doc.lineAt(i.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:s.from,to:r.to,ranges:[i]});t=r.number+1}return e}function _c(n,e,t){if(n.readOnly)return!1;let i=[],s=[];for(let r of gs(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1),l=o.length+1;if(t){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let a of r.ranges)s.push(x.range(Math.min(n.doc.length,a.anchor+l),Math.min(n.doc.length,a.head+l)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let a of r.ranges)s.push(x.range(a.anchor-l,a.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:x.create(s,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}var xm=({state:n,dispatch:e})=>_c(n,e,!1),wm=({state:n,dispatch:e})=>_c(n,e,!0);function Gc(n,e,t){if(n.readOnly)return!1;let i=[];for(let r of gs(n))t?i.push({from:r.from,insert:n.doc.slice(r.from,r.to)+n.lineBreak}):i.push({from:r.to,insert:n.lineBreak+n.doc.slice(r.from,r.to)});let s=n.changes(i);return e(n.update({changes:s,selection:n.selection.map(s,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var vm=({state:n,dispatch:e})=>Gc(n,e,!1),km=({state:n,dispatch:e})=>Gc(n,e,!0),Sm=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(gs(e).map(({from:s,to:r})=>(s>0?s--:r{let r;if(n.lineWrapping){let o=n.lineBlockAt(s.head),l=n.coordsAtPos(s.head,s.assoc||1);l&&(r=o.bottom+n.documentTop-l.bottom+n.defaultLineHeight/2)}return n.moveVertically(s,!0,r)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Cm(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=we(n).resolveInner(e),i=t.childBefore(e),s=t.childAfter(e),r;return i&&s&&i.to<=e&&s.from>=e&&(r=i.type.prop(R.closedBy))&&r.indexOf(s.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(s.from).from&&!/\S/.test(n.sliceDoc(i.to,s.from))?{from:i.to,to:s.from}:null}var gc=Yc(!1),Am=Yc(!0);function Yc(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(s=>{let{from:r,to:o}=s,l=e.doc.lineAt(r),a=!n&&r==o&&Cm(e,r);n&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let h=new Ft(e,{simulateBreak:r,simulateDoubleBreak:!!a}),c=Io(h,r);for(c==null&&(c=Mt(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize));ol.from&&r{let s=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,s,i),t=l.number),o=l.to+1}let r=n.changes(s);return{changes:s,range:x.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}var Mm=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new Ft(n,{overrideIndentation:r=>{let o=t[r];return o??-1}}),s=jo(n,(r,o,l)=>{let a=Io(i,r.from);if(a==null)return;/\S/.test(r.text)||(a=0);let h=/^\s*/.exec(r.text)[0],c=Gi(n,a);(h!=c||l.fromn.readOnly?!1:(e(n.update(jo(n,(t,i)=>{i.push({from:t.from,insert:n.facet(hi)})}),{userEvent:"input.indent"})),!0),Dm=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(jo(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=Mt(s,n.tabSize),o=0,l=Gi(n,Math.max(0,r-mt(n)));for(;o(n.setTabFocusMode(),!0);var Bm=[{key:"Ctrl-b",run:Mc,shift:Ic,preventDefault:!0},{key:"Ctrl-f",run:Tc,shift:Nc},{key:"Ctrl-p",run:Bc,shift:Hc},{key:"Ctrl-n",run:Lc,shift:Vc},{key:"Ctrl-a",run:_p,shift:rm},{key:"Ctrl-e",run:Gp,shift:om},{key:"Ctrl-d",run:$c},{key:"Ctrl-h",run:qo},{key:"Ctrl-k",run:pm},{key:"Ctrl-Alt-h",run:Uc},{key:"Ctrl-o",run:ym},{key:"Ctrl-t",run:bm},{key:"Ctrl-v",run:zo}],Lm=[{key:"ArrowLeft",run:Mc,shift:Ic,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Wp,shift:Xp,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:jp,shift:nm,preventDefault:!0},{key:"ArrowRight",run:Tc,shift:Nc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Hp,shift:Qp,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Up,shift:sm,preventDefault:!0},{key:"ArrowUp",run:Bc,shift:Hc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:uc,shift:pc},{mac:"Ctrl-ArrowUp",run:hc,shift:cc},{key:"ArrowDown",run:Lc,shift:Vc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:dc,shift:mc},{mac:"Ctrl-ArrowDown",run:zo,shift:fc},{key:"PageUp",run:hc,shift:cc},{key:"PageDown",run:zo,shift:fc},{key:"Home",run:$p,shift:im,preventDefault:!0},{key:"Mod-Home",run:uc,shift:pc},{key:"End",run:Kp,shift:tm,preventDefault:!0},{key:"Mod-End",run:dc,shift:mc},{key:"Enter",run:gc,shift:gc},{key:"Mod-a",run:lm},{key:"Backspace",run:qo,shift:qo,preventDefault:!0},{key:"Delete",run:$c,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Uc,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:dm,preventDefault:!0},{mac:"Mod-Backspace",run:mm,preventDefault:!0},{mac:"Mod-Delete",run:gm,preventDefault:!0}].concat(Bm.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),Jc=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:zp,shift:Zp},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:qp,shift:em},{key:"Alt-ArrowUp",run:xm},{key:"Shift-Alt-ArrowUp",run:vm},{key:"Alt-ArrowDown",run:wm},{key:"Shift-Alt-ArrowDown",run:km},{key:"Mod-Alt-ArrowUp",run:cm},{key:"Mod-Alt-ArrowDown",run:fm},{key:"Escape",run:um},{key:"Mod-Enter",run:Am},{key:"Alt-l",mac:"Ctrl-l",run:am},{key:"Mod-i",run:hm,preventDefault:!0},{key:"Mod-[",run:Dm},{key:"Mod-]",run:Tm},{key:"Mod-Alt-\\",run:Mm},{key:"Shift-Mod-k",run:Sm},{key:"Shift-Mod-\\",run:Jp},{key:"Mod-/",run:vp},{key:"Alt-A",run:Sp},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Om}].concat(Lm);var Xc=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n,bt=class{constructor(e,t,i=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,s),this.bufferStart=i,this.normalize=r?l=>r(Xc(l)):Xc,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Re(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=yn(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=je(e);let s=this.normalize(t);if(s.length)for(let r=0,o=i,l=!0;;r++){let a=s.charCodeAt(r),h=this.match(a,o,l,this.bufferPos+this.bufferStart,r==s.length-1);if(h)return this.value=h,this;if(r==s.length-1)break;l&&rthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;if(this.matchPos=ks(this.text,s+(i==s?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||s.to<=t){let l=new n(t,e.sliceString(t,i));return Uo.set(e,l),l}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,s=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,precise:!0,match:t},this.matchPos=ks(this.text,s+(i==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=ws.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(xs.prototype[Symbol.iterator]=vs.prototype[Symbol.iterator]=function(){return this});function Em(n){try{return new RegExp(n,Xo),!0}catch{return!1}}function ks(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}var Rm=n=>{let{state:e}=n,t=String(e.doc.lineAt(n.state.selection.main.head).number),{close:i,result:s}=Dh(n,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return s.then(r=>{let o=r&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.elements.line.value);if(!o){n.dispatch({effects:i});return}let l=e.doc.lineAt(e.selection.main.head),[,a,h,c,f]=o,u=c?+c.slice(1):0,d=h?+h:l.number;if(h&&f){let g=d/100;a&&(g=g*(a=="-"?-1:1)+l.number/e.doc.lines),d=Math.round(e.doc.lines*g)}else h&&a&&(d=d*(a=="-"?-1:1)+l.number);let p=e.doc.line(Math.max(1,Math.min(e.doc.lines,d))),m=x.cursor(p.from+Math.max(0,Math.min(u,p.length)));n.dispatch({effects:[i,A.scrollIntoView(m.from,{y:"center"})],selection:m})}),!0},Pm={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},tf=S.define({combine(n){return ye(n,Pm,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function nf(n){let e=[Hm,Wm];return n&&e.push(tf.of(n)),e}var Im=B.mark({class:"cm-selectionMatch"}),Nm=B.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Qc(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=$.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=$.Word)}function Fm(n,e,t,i){return n(e.sliceDoc(t,t+1))==$.Word&&n(e.sliceDoc(i-1,i))==$.Word}var Wm=te.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(tf),{state:t}=n,i=t.selection;if(i.ranges.length>1)return B.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return B.none;let a=t.wordAt(s.head);if(!a)return B.none;o=t.charCategorizer(s.head),r=t.sliceDoc(a.from,a.to)}else{let a=s.to-s.from;if(a200)return B.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(Qc(o,t,s.from,s.to)&&Fm(o,t,s.from,s.to)))return B.none}else if(r=t.sliceDoc(s.from,s.to),!r)return B.none}let l=[];for(let a of n.visibleRanges){let h=new bt(t.doc,r,a.from,a.to);for(;!h.next().done;){let{from:c,to:f}=h.value;if((!o||Qc(o,t,c,f))&&(s.empty&&c<=s.from&&f>=s.to?l.push(Nm.range(c,f)):(c>=s.to||f<=s.from)&&l.push(Im.range(c,f)),l.length>e.maxMatches))return B.none}}return B.set(l)}},{decorations:n=>n.decorations}),Hm=A.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Vm=({state:n,dispatch:e})=>{let{selection:t}=n,i=x.create(t.ranges.map(s=>n.wordAt(s.head)||x.cursor(s.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function zm(n,e){let{main:t,ranges:i}=n.selection,s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,l=new bt(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new bt(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(a=>a.from==l.value.from))continue;if(r){let a=n.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}var qm=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return Vm({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return!1;let s=zm(n,i);return s?(e(n.update({selection:n.selection.addRange(x.range(s.from,s.to),!1),effects:A.scrollIntoView(s.to)})),!0):!1},di=S.define({combine(n){return ye(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Jo(e),scrollToMatch:e=>A.scrollIntoView(e)})}});var Ss=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Em(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` +`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Go(this):new _o(this)}getCursor(e,t=0,i){let s=e.doc?e:q.create({doc:e});return i==null&&(i=s.doc.length),this.regexp?ui(this,s,t,i):fi(this,s,t,i)}},Cs=class{constructor(e){this.spec=e}};function Km(n,e,t){return(i,s,r,o)=>{if(t&&!t(i,s,r,o))return!1;let l=i>=o&&s<=o+r.length?r.slice(i-o,s-o):e.doc.sliceString(i,s);return n(l,e,i,s)}}function fi(n,e,t,i){let s;return n.wholeWord&&(s=$m(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(s=Km(n.test,e,s)),new bt(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:r=>r.toLowerCase(),s)}function $m(n,e){return(t,i,s,r)=>((r>t||r+s.length=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=fi(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}};function jm(n,e,t){return(i,s,r)=>(!t||t(i,s,r))&&n(r[0],e,i,s)}function ui(n,e,t,i){let s;return n.wholeWord&&(s=Um(e.charCategorizer(e.selection.main.head))),n.test&&(s=jm(n.test,e,s)),new xs(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:s},t,i)}function As(n,e){return n.slice(X(n,e,!1),e)}function Ms(n,e){return n.slice(e,X(n,e))}function Um(n){return(e,t,i)=>!i[0].length||(n(As(i.input,i.index))!=$.Word||n(Ms(i.input,i.index))!=$.Word)&&(n(Ms(i.input,i.index+i[0].length))!=$.Word||n(As(i.input,i.index+i[0].length))!=$.Word)}var Go=class extends Cs{nextMatch(e,t,i){let s=ui(this.spec,e,i,e.doc.length).next();return s.done&&(s=ui(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=ui(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let s=i.length;s>0;s--){let r=+i.slice(0,s);if(r>0&&r=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=ui(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}},Qi=L.define(),Qo=L.define(),yt=Z.define({create(n){return new Xi(Yo(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Qi)?n=new Xi(t.value.create(),n.panel):t.is(Qo)&&(n=new Xi(n.query,t.value?Zo:null));return n},provide:n=>Et.from(n,e=>e.panel)});var Xi=class{constructor(e,t){this.query=e,this.panel=t}},_m=B.mark({class:"cm-searchMatch"}),Gm=B.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Ym=te.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(yt))}update(n){let e=n.state.field(yt);(e!=n.startState.field(yt)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return B.none;let{view:t}=this,i=new Ee;for(let s=0,r=t.visibleRanges,o=r.length;sr[s+1].from-500;)a=r[++s].to;n.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?Gm:_m)})}return i.finish()}},{decorations:n=>n.decorations});function Zi(n){return e=>{let t=e.state.field(yt,!1);return t&&t.query.spec.valid?n(e,t):of(e)}}var Ts=Zi((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let s=x.single(i.from,i.to),r=n.state.facet(di);return n.dispatch({selection:s,effects:[el(n,i),r.scrollToMatch(s.main,n)],userEvent:"select.search"}),rf(n),!0}),Ds=Zi((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t,i,i);if(!s)return!1;let r=x.single(s.from,s.to),o=n.state.facet(di);return n.dispatch({selection:r,effects:[el(n,s),o.scrollToMatch(r.main,n)],userEvent:"select.search"}),rf(n),!0}),Jm=Zi((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:x.create(t.map(i=>x.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),Xm=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new bt(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(x.range(l.value.from,l.value.to))}return e(n.update({selection:x.create(r,o),userEvent:"select.search.matches"})),!0},Zc=Zi((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=r,l=[],a,h,c=[];o.precise?o.from==i&&o.to==s&&(h=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:h}),o=e.nextMatch(t,o.from,o.to),c.push(A.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))):o=e.nextMatch(t,o.from,o.to);let f=n.state.changes(l);return o&&(a=x.single(o.from,o.to).map(f),c.push(el(n,o)),c.push(t.facet(di).scrollToMatch(a.main,n))),n.dispatch({changes:f,selection:a,effects:c,userEvent:"input.replace"}),!0}),Qm=Zi((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let s of e.matchAll(n.state,1e9)){let{from:r,to:o,precise:l}=s;l&&t.push({from:r,to:o,insert:e.getReplacement(s)})}if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:A.announce.of(i),userEvent:"input.replace.all"}),!0});function Zo(n){return n.state.facet(di).createPanel(n)}function Yo(n,e){var t,i,s,r,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=n.facet(di);return new Ss({search:((t=e?.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e?.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(r=e?.regexp)!==null&&r!==void 0?r:h.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function sf(n){let e=Zn(n,Zo);return e&&e.dom.querySelector("[main-field]")}function rf(n){let e=sf(n);e&&e==n.root.activeElement&&e.select()}var of=n=>{let e=n.state.field(yt,!1);if(e&&e.panel){let t=sf(n);if(t&&t!=n.root.activeElement){let i=Yo(n.state,e.query.spec);i.valid&&n.dispatch({effects:Qi.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[Qo.of(!0),e?Qi.of(Yo(n.state,e.query.spec)):L.appendConfig.of(eg)]});return!0},lf=n=>{let e=n.state.field(yt,!1);if(!e||!e.panel)return!1;let t=Zn(n,Zo);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Qo.of(!1)}),!0},af=[{key:"Mod-f",run:of,scope:"editor search-panel"},{key:"F3",run:Ts,shift:Ds,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Ts,shift:Ds,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:lf,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Xm},{key:"Mod-Alt-g",run:Rm},{key:"Mod-d",run:qm,preventDefault:!0}],Jo=class{constructor(e){this.view=e;let t=this.query=e.state.field(yt).query.spec;this.commit=this.commit.bind(this),this.searchField=F("input",{value:t.search,placeholder:ve(e,"Find"),"aria-label":ve(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=F("input",{value:t.replace,placeholder:ve(e,"Replace"),"aria-label":ve(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=F("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=F("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=F("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(s,r,o){return F("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=F("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>Ts(e),[ve(e,"next")]),i("prev",()=>Ds(e),[ve(e,"previous")]),i("select",()=>Jm(e),[ve(e,"all")]),F("label",null,[this.caseField,ve(e,"match case")]),F("label",null,[this.reField,ve(e,"regexp")]),F("label",null,[this.wordField,ve(e,"by word")]),...e.state.readOnly?[]:[F("br"),this.replaceField,i("replace",()=>Zc(e),[ve(e,"replace")]),i("replaceAll",()=>Qm(e),[ve(e,"replace all")])],F("button",{name:"close",onclick:()=>lf(e),"aria-label":ve(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new Ss({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Qi.of(e)}))}keydown(e){Sh(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ds:Ts)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Zc(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(Qi)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(di).top}};function ve(n,e){return n.state.phrase(e)}var ys=30,bs=/[\s\.,:;?!]/;function el(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-ys),o=Math.min(s,t+ys),l=n.state.sliceDoc(r,o);if(r!=i.from){for(let a=0;al.length-ys;a--)if(!bs.test(l[a-1])&&bs.test(l[a])){l=l.slice(0,a);break}}return A.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}var Zm=A.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),eg=[yt,Ce.low(Ym),Zm];var Bs=class{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}},Ht=class n{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let s=i.facet(Qe).markerFilter;s&&(e=s(e,i));let r=e.slice().sort((d,p)=>d.from-p.from||d.to-p.to),o=new Ee,l=[],a=0,h=i.doc.iter(),c=0,f=i.doc.length;for(let d=0;;){let p=d==r.length?null:r[d];if(!p&&!l.length)break;let m,g;if(l.length)m=a,g=l.reduce((b,D)=>Math.min(b,D.to),p&&p.from>m?p.from:1e8);else{if(m=p.from,m>f)break;g=p.to,l.push(p),d++}for(;db.from||b.to==m))l.push(b),d++,g=Math.min(b.to,g);else{g=Math.min(b.from,g);break}}g=Math.min(g,f);let y=!1;if(l.some(b=>b.from==m&&(b.to==g||g==f))&&(y=m==g,!y&&g-m<10)){let b=m-(c+h.value.length);b>0&&(h.next(b),c=m);for(let D=m;;){if(D>=g){y=!0;break}if(!h.lineBreak&&c+h.value.length>D)break;D=c+h.value.length,c+=h.value.length,h.next()}}let w=ug(l);if(y)o.add(m,m,B.widget({widget:new tl(w),diagnostics:l.slice()}));else{let b=l.reduce((D,M)=>M.markClass?D+" "+M.markClass:D,"");o.add(m,g,B.mark({class:"cm-lintRange cm-lintRange-"+w+b,diagnostics:l.slice(),inclusiveEnd:l.some(D=>D.to>g)}))}if(a=g,a==f)break;for(let b=0;b{if(!(e&&o.diagnostics.indexOf(e)<0))if(!i)i=new Bs(s,r,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new Bs(i.from,r,i.diagnostic)}}),i}function tg(n,e){let t=e.pos,i=e.end||t,s=n.state.facet(Qe).hideOn(n,t,i);if(s!=null)return s;let r=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(il))||n.changes.touchesRange(r.from,Math.max(r.to,i)))}function ig(n,e){return n.field(Ke,!1)?e:e.concat(L.appendConfig.of(gf))}function ng(n,e){return{effects:ig(n,[il.of(e)])}}var il=L.define(),ff=L.define(),uf=L.define(),Ke=Z.define({create(){return new Ht(B.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,s=n.panel;if(n.selected){let r=e.changes.mapPos(n.selected.from,1);i=pi(t,n.selected.diagnostic,r)||pi(t,null,r)}!t.size&&s&&e.state.facet(Qe).autoPanel&&(s=null),n=new Ht(t,s,i)}for(let t of e.effects)if(t.is(il)){let i=e.state.facet(Qe).autoPanel?t.value.length?Es.open:null:n.panel;n=Ht.init(t.value,i,e.state)}else t.is(ff)?n=new Ht(n.diagnostics,t.value?Es.open:null,n.selected):t.is(uf)&&(n=new Ht(n.diagnostics,n.panel,t.value));return n},provide:n=>[Et.from(n,e=>e.panel),A.decorations.from(n,e=>e.diagnostics)]});var sg=B.mark({class:"cm-lintRange cm-lintRange-active"});function rg(n,e,t){let{diagnostics:i}=n.state.field(Ke),s,r=-1,o=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(a,h,{spec:c})=>{if(e>=a&&e<=h&&(a==h||(e>a||t>0)&&(emf(n,t,!1)))}var hf=n=>{let e=n.state.field(Ke,!1);return!e||!e.panel?!1:(n.dispatch({effects:ff.of(!1)}),!0)};var lg=te.fromClass(class{constructor(n){this.view=n,this.timeout=-1,this.set=!0;let{delay:e}=n.state.facet(Qe);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){clearTimeout(this.timeout);let n=Date.now();if(nPromise.resolve(i(this.view))),i=>{this.view.state.doc==e.doc&&this.view.dispatch(ng(this.view.state,i.reduce((s,r)=>s.concat(r))))},i=>{ne(this.view.state,i)})}}update(n){let e=n.state.facet(Qe);(n.docChanged||e!=n.startState.facet(Qe)||e.needsRefresh&&e.needsRefresh(n))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function ag(n,e,t){let i=[],s=-1;for(let r of n)r.then(o=>{i.push(o),clearTimeout(s),i.length==n.length?e(i):s=setTimeout(()=>e(i),200)},t)}var Qe=S.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...ye(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:cf,tooltipFilter:cf,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,s,r)=>e(i,s,r)||t(i,s,r):e:t,autoPanel:(e,t)=>e||t})}}});function cf(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function df(n,e={}){return[Qe.of({source:n,config:e}),lg,gf]}function pf(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;ir.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function mf(n,e,t){var i;let s=t?pf(e.actions):[];return F("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},F("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((r,o)=>{let l=!1,a=d=>{if(d.preventDefault(),l)return;l=!0;let p=pi(n.state.field(Ke).diagnostics,e);p&&r.apply(n,p.from,p.to)},{name:h}=r,c=s[o]?h.indexOf(s[o]):-1,f=c<0?h:[h.slice(0,c),F("u",h.slice(c,c+1)),h.slice(c+1)],u=r.markClass?" "+r.markClass:"";return F("button",{type:"button",class:"cm-diagnosticAction"+u,onclick:a,onmousedown:a,"aria-label":` Action: ${h}${c<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&F("div",{class:"cm-diagnosticSource"},e.source))}var tl=class extends Ne{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return F("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}},Ls=class{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=mf(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}},Es=class n{constructor(e){this.view=e,this.items=[];let t=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)hf(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=pf(r.actions);for(let l=0;l{for(let r=0;rhf(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(Ke).selected;if(!e)return-1;for(let t=0;t{for(let c of h.diagnostics){if(o.has(c))continue;o.add(c);let f=-1,u;for(let d=i;di&&(this.items.splice(i,f-i),s=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),r=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),i++}});i({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let h=a.height/this.list.offsetHeight;l.topa.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Ke),i=pi(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:uf.of(i)})}static open(e){return new n(e)}};function hg(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function Os(n){return hg(``,'width="6" height="3"')}var cg=A.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Os("#f11")},".cm-lintRange-warning":{backgroundImage:Os("orange")},".cm-lintRange-info":{backgroundImage:Os("#999")},".cm-lintRange-hint":{backgroundImage:Os("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function fg(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function ug(n){let e="hint",t=1;for(let i of n){let s=fg(i.severity);s>t&&(t=s,e=i.severity)}return e}var dg=Mh(rg,{hideOn:tg}),gf=[Ke,A.decorations.compute([Ke],n=>{let{selected:e,panel:t}=n.field(Ke);return!e||!t||e.from==e.to?B.none:B.set([sg.range(e.from,e.to)])}),dg,cg];var Ps=class{constructor(e,t,i,s){this.state=e,this.pos=t,this.explicit=i,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=we(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(Sf(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}};function yf(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function pg(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:pg(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}var Is=class{constructor(e,t,i,s){this.completion=e,this.source=t,this.match=i,this.score=s}};function Vt(n){return n.selection.main.from}function Sf(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}var pl=ue.define();function gg(n,e,t,i){let{main:s}=n.selection,r=t-s.from,o=i-s.from;return{...n.changeByRange(l=>{if(l!=s&&t!=i&&n.sliceDoc(l.from+r,l.from+o)!=n.sliceDoc(t,i))return{range:l};let a=n.toText(e);return{changes:{from:l.from+r,to:i==s.from?l.to:l.from+o,insert:a},range:x.cursor(l.from+r+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}var bf=new WeakMap;function yg(n){if(!Array.isArray(n))return n;let e=bf.get(n);return e||bf.set(n,e=mg(n)),e}var Ns=L.define(),en=L.define(),rl=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&M<=57||M>=97&&M<=122?2:M>=65&&M<=90?1:0:(O=yn(M))!=O.toLowerCase()?1:O!=O.toUpperCase()?2:0;(!w||T==1&&g||D==0&&T!=0)&&(t[f]==M||i[f]==M&&(u=!0)?o[f++]=w:o.length&&(y=!1)),D=T,w+=je(M)}return f==a&&o[0]==0&&y?this.result(-100+(u?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,m]):f==a?this.result(-100+(u?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[],r=0;for(let o of t){let l=o+(this.astral?je(Re(i,o)):1);r&&s[r-1]==o?s[r-1]=l:(s[r++]=o,s[r++]=l)}return this.ret(e-i.length,s)}},ol=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:bg,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>xf(e(i),t(i)),optionClass:(e,t)=>i=>xf(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function xf(n,e){return n?e?n+" "+e:n:e}function bg(n,e,t,i,s,r){let o=n.textDirection==V.RTL,l=o,a=!1,h="top",c,f,u=e.left-s.left,d=s.right-e.right,p=i.right-i.left,m=i.bottom-i.top;if(l&&u=m||w>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let g=(e.bottom-e.top)/r.offsetHeight,y=(e.right-e.left)/r.offsetWidth;return{style:`${h}: ${c/g}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}var ml=L.define();function xg(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s,r){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,c)));let u=o.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(l.slice(c,f))),u.className="cm-completionMatchedText",a=f}return at.position-i.position).map(t=>t.render)}function nl(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.ceil((n-e)/t);return{from:n-i*t,to:n-(i-1)*t}}var ll=class{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:r,selected:o}=s.open,l=e.state.facet(se);this.optionContent=xg(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=nl(r.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:h}=e.state.field(t).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(e.dispatch({effects:ml.of(c)}),a.preventDefault())}}),this.dom.addEventListener("focusout",a=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(se).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:en.of(null)})}),this.showOptions(r,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=s){let{options:r,selected:o,disabled:l}=i.open;(!s.open||s.open.options!=r)&&(this.range=nl(r.length,o,e.state.facet(se).maxRenderedOptions),this.showOptions(r,i.id)),this.updateSel(),l!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected=this.range.to)&&(this.range=nl(t.options.length,t.selected,this.view.state.facet(se).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:s}=t.options[t.selected],{info:r}=s;if(!r)return;let o=typeof r=="string"?document.createTextNode(r):r(s);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,s)}).catch(l=>ne(this.view.state,l,"completion info")):(this.addInfoPane(o,s),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:r}=e;i.appendChild(s),this.infoDestroy=r||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)i.nodeName!="LI"||!i.id?s--:s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&vg(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(r.bottom,t.bottom)-10||s.bottom{o.target==s&&o.preventDefault()});let r=null;for(let o=i.from;oi.from||i.from==0))if(r=u,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let d=s.appendChild(document.createElement("completion-section"));d.textContent=u}}let c=s.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.tonew ll(t,n,e)}function vg(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),s=t.height/n.offsetHeight;i.topt.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/s)}function wf(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function kg(n,e){let t=[],i=null,s=null,r=c=>{t.push(c);let{section:f}=c.completion;if(f){i||(i=[]);let u=typeof f=="string"?f:f.name;i.some(d=>d.name==u)||i.push(typeof f=="string"?{name:u}:f)}},o=e.facet(se);for(let c of n)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let u of c.result.options)r(new Is(u,c.source,f?f(u):[],1e9-t.length));else{let u=e.sliceDoc(c.from,c.to),d,p=o.filterStrict?new ol(u):new rl(u);for(let m of c.result.options)if(d=p.match(m.label)){let g=m.displayLabel?f?f(m,d.matched):[]:d.matched,y=d.score+(m.boost||0);if(r(new Is(m,c.source,g,y)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:w}=m.section;s||(s=Object.create(null)),s[w]=Math.max(y,s[w]||-1e9)}}}}if(i){let c=Object.create(null),f=0,u=(d,p)=>(d.rank==="dynamic"&&p.rank==="dynamic"?s[p.name]-s[d.name]:0)||(typeof d.rank=="number"?d.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(d.nameu.score-f.score||h(f.completion,u.completion))){let f=c.completion;!a||a.label!=f.label||a.detail!=f.detail||a.type!=null&&f.type!=null&&a.type!=f.type||a.apply!=f.apply||a.boost!=f.boost?l.push(c):wf(c.completion)>wf(a)&&(l[l.length-1]=c),a=c.completion}return l}var al=class n{constructor(e,t,i,s,r,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new n(this.options,vf(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,s,r,o){if(s&&!o&&e.some(h=>h.isPending))return s.setDisabled();let l=kg(e,t);if(!l.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let a=t.facet(se).selectOnOpen?0:-1;if(s&&s.selected!=a&&s.selected!=-1){let h=s.options[s.selected].completion;for(let c=0;cc.hasResult()?Math.min(h,c.from):h,1e8),create:Dg,above:r.aboveCursor},s?s.timestamp:Date.now(),a,!1)}map(e){return new n(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new n(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},hl=class n{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new n(Mg,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(se),r=(i.override||t.languageDataAt("autocomplete",Vt(t)).map(yg)).map(a=>(this.active.find(c=>c.source==a)||new rt(a,this.active.some(c=>c.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((a,h)=>a==this.active[h])&&(r=this.active);let o=this.open,l=e.effects.some(a=>a.is(gl));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!Sg(r,this.active)||l?o=al.build(r,t,this.id,o,i,l):o&&o.disabled&&!r.some(a=>a.isPending)&&(o=null),!o&&r.every(a=>!a.isPending)&&r.some(a=>a.hasResult())&&(r=r.map(a=>a.hasResult()?new rt(a.source,0):a));for(let a of e.effects)a.is(ml)&&(o=o&&o.setSelected(a.value,this.id));return r==this.active&&o==this.open?this:new n(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Cg:Ag}};function Sg(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}var Mg=[];function Cf(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(pl);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}var rt=class n{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=Cf(e,t),s=this;(i&8||i&16&&this.touches(e))&&(s=new n(s.source,0)),i&4&&s.state==0&&(s=new n(this.source,1)),s=s.updateFor(e,i);for(let r of e.effects)if(r.is(Ns))s=new n(s.source,1,r.value);else if(r.is(en))s=new n(s.source,0);else if(r.is(gl))for(let o of r.value)o.source==s.source&&(s=o);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Vt(e.state))}},Fs=class n extends rt{constructor(e,t,i,s,r,o){super(e,3,t),this.limit=i,this.result=s,this.from=r,this.to=o}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Vt(e.state);if(l>o||!s||t&2&&(Vt(e.startState)==this.from||lt.map(e))}}),me=Z.define({create(){return hl.start()},update(n,e){return n.update(e)},provide:n=>[Fi.from(n,e=>e.tooltip),A.contentAttributes.from(n,e=>e.attrs)]});function yl(n,e){let t=e.completion.apply||e.completion.label,i=n.state.field(me).active.find(s=>s.source==e.source);return i instanceof Fs?(typeof t=="string"?n.dispatch({...gg(n.state,t,i.from,i.to),annotations:pl.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}var Dg=wg(me,yl);function Rs(n,e="option"){return t=>{let i=t.state.field(me,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+s*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:ml.of(l)}),!0}}var Og=n=>{let e=n.state.field(me,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(me,!1)?(n.dispatch({effects:Ns.of(!0)}),!0):!1,Bg=n=>{let e=n.state.field(me,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:en.of(null)}),!0)},cl=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},Lg=50,Eg=1e3,Rg=te.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(me).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(me),t=n.state.facet(se);if(!n.selectionSet&&!n.docChanged&&n.startState.field(me)==e)return;let i=n.transactions.some(r=>{let o=Cf(r,t);return o&8||(r.selection||r.docChanged)&&!(o&3)});for(let r=0;rLg&&Date.now()-o.time>Eg){for(let l of o.context.abortListeners)try{l()}catch(a){ne(this.view.state,a)}o.context.abortListeners=null,this.running.splice(r--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(r=>r.effects.some(o=>o.is(Ns)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(r=>r.isPending&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let r of n.transactions)r.isUserEvent("input.type")?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(me);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(se).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Vt(e),i=new Ps(e,t,n.explicit,this.view),s=new cl(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:en.of(null)}),ne(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(se).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(se),i=this.view.state.field(me);for(let s=0;sl.source==r.active.source);if(o&&o.isPending)if(r.done==null){let l=new rt(r.active.source,0);for(let a of r.updates)l=l.update(a,t);l.isPending||e.push(l)}else this.startQuery(o)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:gl.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(me,!1);if(e&&e.tooltip&&this.view.state.facet(se).closeOnBlur){let t=e.open&&fo(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:en.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Ns.of(!1)}),20),this.composing=0}}}),Pg=typeof navigator=="object"&&/Win/.test(navigator.platform),Ig=Ce.highest(A.domEventHandlers({keydown(n,e){let t=e.state.field(me,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(Pg&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],s=t.active.find(o=>o.source==i.source),r=i.completion.commitCharacters||s.result.commitCharacters;return r&&r.indexOf(n.key)>-1&&yl(e,i),!1}})),Af=A.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),fl=class{constructor(e,t,i,s){this.field=e,this.line=t,this.from=i,this.to=s}},ul=class n{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,ie.TrackDel),i=e.mapPos(this.to,1,ie.TrackDel);return t==null||i==null?null:new n(this.field,t,i)}},dl=class n{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],s=[t],r=e.doc.lineAt(t),o=/^\s*/.exec(r.text)[0];for(let a of this.lines){if(i.length){let h=o,c=/^\t*/.exec(a)[0].length;for(let f=0;fnew ul(a.field,s[a.line]+a.from,s[a.line]+a.to));return{text:i,ranges:l}}static parse(e){let t=[],i=[],s=[],r;for(let o of e.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let l=r[1]?+r[1]:null,a=r[2]||r[3]||"",h=-1;l===0&&(l=1e9);let c=a.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f=h&&u.field++}for(let f of s)if(f.line==i.length&&f.from>r.index){let u=r[2]?3+(r[1]||"").length:2;f.from-=u,f.to-=u}s.push(new fl(h,i.length,r.index,r.index+c.length)),o=o.slice(0,r.index)+a+o.slice(r.index+r[0].length)}o=o.replace(/\\([{}])/g,(l,a,h)=>{for(let c of s)c.line==i.length&&c.from>h&&(c.from--,c.to--);return a}),i.push(o)}return new n(i,s)}},Ng=B.widget({widget:new class extends Ne{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),Fg=B.mark({class:"cm-snippetField"}),mi=class n{constructor(e,t){this.ranges=e,this.active=t,this.deco=B.set(e.map(i=>(i.from==i.to?Ng:Fg).range(i.from,i.to)),!0)}map(e){let t=[];for(let i of this.ranges){let s=i.map(e);if(!s)return null;t.push(s)}return new n(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(i=>i.field==this.active&&i.from<=t.from&&i.to>=t.to))}},nn=L.define({map(n,e){return n&&n.map(e)}}),Wg=L.define(),tn=Z.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(nn))return t.value;if(t.is(Wg)&&n)return new mi(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>A.decorations.from(n,e=>e?e.deco:B.none)});function bl(n,e){return x.create(n.filter(t=>t.field==e).map(t=>x.range(t.from,t.to)))}function Mf(n){let e=dl.parse(n);return(t,i,s,r)=>{let{text:o,ranges:l}=e.instantiate(t.state,s),{main:a}=t.state.selection,h={changes:{from:s,to:r==a.from?a.to:r,insert:P.of(o)},scrollIntoView:!0,annotations:i?[pl.of(i),Q.userEvent.of("input.complete")]:void 0};if(l.length&&(h.selection=bl(l,0)),l.some(c=>c.field>0)){let c=new mi(l,0),f=h.effects=[nn.of(c)];t.state.field(tn,!1)===void 0&&f.push(L.appendConfig.of([tn,Kg,$g,Af]))}t.dispatch(t.state.update(h))}}function Tf(n){return({state:e,dispatch:t})=>{let i=e.field(tn,!1);if(!i||n<0&&i.active==0)return!1;let s=i.active+n,r=n>0&&!i.ranges.some(o=>o.field==s+n);return t(e.update({selection:bl(i.ranges,s),effects:nn.of(r?null:new mi(i.ranges,s)),scrollIntoView:!0})),!0}}var Hg=({state:n,dispatch:e})=>n.field(tn,!1)?(e(n.update({effects:nn.of(null)})),!0):!1,Vg=Tf(1),zg=Tf(-1);var qg=[{key:"Tab",run:Vg,shift:zg},{key:"Escape",run:Hg}],kf=S.define({combine(n){return n.length?n[0]:qg}}),Kg=Ce.highest(ri.compute([kf],n=>n.facet(kf)));var $g=A.domEventHandlers({mousedown(n,e){let t=e.state.field(tn,!1),i;if(!t||(i=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let s=t.ranges.find(r=>r.from<=i&&r.to>=i);return!s||s.field==t.active?!1:(e.dispatch({selection:bl(t.ranges,s.field),effects:nn.of(t.ranges.some(r=>r.field>s.field)?new mi(t.ranges,s.field):null),scrollIntoView:!0}),!0)}});var Df=new class extends Se{};Df.startSide=1;Df.endSide=-1;var ly=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent);function Of(n={}){return[Ig,me,se.of(n),Rg,Ug,Af]}var jg=[{key:"Ctrl-Space",run:sl},{mac:"Alt-`",run:sl},{mac:"Alt-i",run:sl},{key:"Escape",run:Bg},{key:"ArrowDown",run:Rs(!0)},{key:"ArrowUp",run:Rs(!1)},{key:"PageDown",run:Rs(!0,"page")},{key:"PageUp",run:Rs(!1,"page")},{key:"Enter",run:Og}],Ug=Ce.highest(ri.computeN([se],n=>n.facet(se).defaultKeymap?[jg]:[]));var Bf=hs.define({name:"cooklang",startState(){return{formatting:!1,nextMultiline:!1,inMultiline:!1,afterSection:!1,position:null,inFrontmatter:!1,inMetadata:!1,inNote:!1,inComment:!1,afterAmount:!1}},token(n,e){let t=n.sol()||e.afterSection,i=n.eol();if(e.afterSection=!1,t&&(e.inNote=!1,e.inMetadata=!1,e.nextMultiline?(e.inMultiline=!0,e.nextMultiline=!1):e.position=null),i&&!e.nextMultiline&&(e.inMultiline=!1,e.position=null),t)for(;n.eatSpace(););if(t&&n.match(/^---\s*$/))return e.inFrontmatter=!e.inFrontmatter,"meta";if(e.inFrontmatter)return n.skipToEnd(),"meta";if(t&&n.match(/^=+/))return n.skipToEnd(),"heading";if(t&&n.match(/^--/))return n.skipToEnd(),"comment";if(n.match(/^\[-/))return e.inComment=!0,"comment";if(e.inComment)return n.match(/-]/)?(e.inComment=!1,"comment"):(n.skipToEnd(),"comment");if(t&&n.match(/^>>/))return e.inMetadata=!0,e.position="metadata-key","meta";if(e.inMetadata){if(e.position==="metadata-key")return n.match(/^[^:]+:/)?(e.position="metadata-value","meta"):(n.skipToEnd(),"meta");if(e.position==="metadata-value")return n.skipToEnd(),"meta"}if(t&&n.match(/^>/))return e.inNote=!0,"comment";if(e.inNote)return n.skipToEnd(),"comment";if(e.afterAmount&&n.match(/^\([^)]*\)/))return e.afterAmount=!1,"string";if(e.afterAmount&&!n.match(/^\s*(?=\()/,!1)&&(e.afterAmount=!1),n.match(/^@([^@#~]+?(?={))/))return"variableName";if(n.match(/^@(.+?\b)/))return"variableName";if(n.match(/^#([^@#~]+?(?={))/))return"keyword";if(n.match(/^#(.+?\b)/))return"keyword";if(n.match(/^~([^@#~]+?(?={))/))return"number";if(n.match(/^~(.+?\b)/))return"number";let s=n.next();return s?s==="{"?(e.position!=="timer"&&(e.position="measurement"),null):s==="}"?(e.position=null,e.afterAmount=!0,null):s==="%"&&(e.position==="measurement"||e.position==="timer")?(e.position="unit",null):e.position:null}});var Lf=[];function _g(n,e){Lf=e,n&&n.dispatch({effects:[]})}var Gg=df(n=>Lf,{delay:0}),xl=null;function Yg(n){xl=n}async function Jg(n){if(!xl)return null;let e=n.pos,t=n.state.doc.lineAt(e),s=t.text.slice(0,e-t.from).match(/[@#~]([a-zA-Z0-9_./\-]*)$/);if(!s)return null;let r=s[1],o=e-r.length,l=s[0][0];try{let a=await xl(t.number-1,e-t.from);return!a||a.length===0?null:{from:o,validFor:/^[a-zA-Z0-9_./\-]*$/,options:a.map(h=>{let c=h.kind===17?"file":h.kind===6?"variable":h.kind===14?"keyword":"text",f=h.textEdit?.newText||h.insertText||h.label;if(h.insertTextFormat===2&&f.includes("$")){let u=f.replace(/\$0/g,"${}").replace(/\$(\d+)/g,"${$1}");return{label:h.label,type:c,detail:h.detail||"",apply:Mf(u)}}return{label:h.label,type:c,detail:h.detail||"",apply:f}})}}catch(a){return console.error("Completion error:",a),null}}var Xg=ai.define([{tag:v.variableName,color:"#ea580c",fontWeight:"600"},{tag:v.keyword,color:"#16a34a",fontWeight:"600"},{tag:v.number,color:"#dc2626",fontWeight:"600"},{tag:v.comment,color:"#9ca3af",fontStyle:"italic"},{tag:v.meta,color:"#8b5cf6"},{tag:v.unit,color:"#6366f1"},{tag:v.heading,color:"#0891b2",fontWeight:"700",fontSize:"1.1em"},{tag:v.string,color:"#d97706",fontStyle:"italic"}]),Qg=A.theme({"&":{height:"100%",fontSize:"14px"},".cm-scroller":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",overflow:"auto"},".cm-content":{padding:"1rem"},".cm-line":{padding:"0 0.5rem"}}),wl=null;function Zg(n){wl=n}function e0(n,e,t){let i=A.updateListener.of(o=>{o.docChanged&&t&&t(o.state.doc.toString());let l=o.state.selection.main.head,a=o.state.doc.lineAt(l),h=l-a.from+1;wl&&wl(a.number,h)}),s=q.create({doc:e,extensions:[Lh(),Ah(),Eh(),wc(),sc(),nf(),Bf,ec(Xg),Qg,Gg,Of({override:[Jg],activateOnTyping:!0}),ri.of([...Jc,...Cc,...af]),i,A.lineWrapping]}),r=new A({state:s,parent:n});return r.dispatch({selection:{anchor:0}}),r.focus(),r}function t0(n){return n.state.doc.toString()}function i0(n,e){n.dispatch({changes:{from:0,to:n.state.doc.length,insert:e}})}window.CooklangEditor={initEditor:e0,getContent:t0,setContent:i0,setDiagnostics:_g,setCompletionResolver:Yg,setCursorPositionCallback:Zg};})(); diff --git a/static/js/keyboard-shortcuts.js b/static/js/keyboard-shortcuts.js new file mode 100644 index 0000000..9746aea --- /dev/null +++ b/static/js/keyboard-shortcuts.js @@ -0,0 +1,408 @@ +/** + * Keyboard shortcuts for Cook CLI web interface + * + * Global shortcuts (available on all pages): + * - / Focus search + * - g h Go to home/recipes + * - g s Go to shopping list + * - g p Go to pantry + * - g x Go to preferences + * - ? Show keyboard shortcuts help + * - Escape Close modals/dropdowns + * - t Toggle theme (dark/light) + * + * Recipe page shortcuts: + * - c Start cooking mode + * - e Edit recipe + * - a Add to shopping list + * - p Print recipe + * - +/- Increase/decrease scale + * - [/] Decrease/increase scale by 0.5 + */ + +(function() { + 'use strict'; + + // Track pending key sequences (for multi-key shortcuts like "g h") + let pendingKey = null; + let pendingTimeout = null; + + // Check if user is typing in a text-entry input field + function isTyping(event) { + const target = event.target; + const tagName = target.tagName.toLowerCase(); + + if (tagName === 'textarea' || tagName === 'select') { + return true; + } + + // Only block for text-entry inputs, not checkboxes/radios/etc. + if (tagName === 'input') { + const type = (target.type || 'text').toLowerCase(); + const textTypes = ['text', 'password', 'email', 'number', 'search', 'url', 'tel', 'date', 'time', 'datetime-local']; + return textTypes.includes(type); + } + + // Check for contenteditable elements + if (target.isContentEditable) { + return true; + } + + // Check for CodeMirror editor + if (target.closest('.cm-editor')) { + return true; + } + + return false; + } + + // Clear pending key sequence + function clearPendingKey() { + pendingKey = null; + if (pendingTimeout) { + clearTimeout(pendingTimeout); + pendingTimeout = null; + } + } + + // Show keyboard shortcuts modal + window.showShortcutsHelp = function() { + const existingModal = document.getElementById('keyboard-shortcuts-modal'); + if (existingModal) { + existingModal.classList.remove('hidden'); + return; + } + + const staticMode = window.__STATIC_MODE__ === true; + const kbd = 'class="px-2 py-1 bg-gray-100 dark:bg-gray-700 rounded text-sm font-mono"'; + const row = (label, keys) => ` +
+ ${label} + ${keys} +
`; + const k = (s) => `${s}`; + + const navRows = [ + row('Focus search', k('/')), + row('Navigate search results', `${k('↑')} ${k('↓')} ${k('Enter')}`), + row('Go to recipes', `${k('g')} ${k('h')}`), + ]; + if (!staticMode) { + navRows.push( + row('Go to shopping list', `${k('g')} ${k('s')}`), + row('Go to pantry', `${k('g')} ${k('p')}`), + row('Go to preferences', `${k('g')} ${k('x')}`) + ); + } + + const recipeRows = [row('Start cooking mode', k('c'))]; + if (!staticMode) { + recipeRows.push( + row('Edit recipe', k('e')), + row('Add to shopping list', k('a')) + ); + } + recipeRows.push(row('Print recipe', k('p'))); + if (!staticMode) { + recipeRows.push( + row('Increase scale', k('+')), + row('Decrease scale', k('-')) + ); + } + + const shoppingSection = staticMode ? '' : ` +
+

Shopping List

+
+ ${row('Clear all items', k('c'))} +
+
`; + + const modal = document.createElement('div'); + modal.id = 'keyboard-shortcuts-modal'; + modal.className = 'fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50'; + modal.innerHTML = ` +
+
+

Keyboard Shortcuts

+ +
+
+
+
+

Navigation

+
${navRows.join('')}
+
+
+

General

+
+ ${row('Toggle theme', k('t'))} + ${row('Show shortcuts', k('?'))} + ${row('Close modal', k('Esc'))} +
+
+
+

Recipe Page

+
${recipeRows.join('')}
+
+ ${shoppingSection} +
+
+
+ Press Esc to close +
+
+ `; + + document.body.appendChild(modal); + + // Close on backdrop click + modal.addEventListener('click', function(e) { + if (e.target === modal) { + closeShortcutsHelp(); + } + }); + } + + // Close keyboard shortcuts modal + window.closeShortcutsHelp = function() { + const modal = document.getElementById('keyboard-shortcuts-modal'); + if (modal) { + modal.classList.add('hidden'); + } + }; + + // Handle keyboard events + function handleKeydown(event) { + // Don't handle if user is typing + if (isTyping(event)) { + // But still allow Escape to blur inputs + if (event.key === 'Escape') { + event.target.blur(); + } + return; + } + + // Don't handle if modifier keys are pressed (except Shift for ? and +) + if (event.ctrlKey || event.metaKey || event.altKey) { + return; + } + + const key = event.key; + + // Handle pending key sequences (like "g h") + if (pendingKey === 'g') { + clearPendingKey(); + const pfx = window.__PREFIX__ || ''; + const staticMode = window.__STATIC_MODE__ === true; + switch (key) { + case 'h': + case 'r': + event.preventDefault(); + window.location.href = pfx + '/'; + return; + case 's': + if (staticMode) break; + event.preventDefault(); + window.location.href = pfx + '/shopping-list'; + return; + case 'p': + if (staticMode) break; + event.preventDefault(); + window.location.href = pfx + '/pantry'; + return; + case 'x': + if (staticMode) break; + event.preventDefault(); + window.location.href = pfx + '/preferences'; + return; + } + // If no valid second key, fall through to handle as new key + } + + // Global shortcuts + switch (key) { + case '/': + event.preventDefault(); + const searchInput = document.getElementById('search-input'); + if (searchInput) { + searchInput.focus(); + searchInput.select(); + } + return; + + case 'g': + event.preventDefault(); + pendingKey = 'g'; + // Clear pending after 1.5 seconds + pendingTimeout = setTimeout(clearPendingKey, 1500); + return; + + case '?': + event.preventDefault(); + showShortcutsHelp(); + return; + + case 'Escape': + event.preventDefault(); + // Close shortcuts modal if open + const shortcutsModal = document.getElementById('keyboard-shortcuts-modal'); + if (shortcutsModal && !shortcutsModal.classList.contains('hidden')) { + closeShortcutsHelp(); + return; + } + // Close search results if open + const searchResults = document.getElementById('search-results'); + if (searchResults && !searchResults.classList.contains('hidden')) { + searchResults.classList.add('hidden'); + return; + } + // Close any other modals + const modals = document.querySelectorAll('[data-modal]'); + modals.forEach(modal => modal.classList.add('hidden')); + return; + + case 't': + event.preventDefault(); + if (typeof toggleTheme === 'function') { + toggleTheme(); + } + return; + } + + // Page-specific shortcuts + const path = window.location.pathname; + const pfx2 = window.__PREFIX__ || ''; + + // Recipe page shortcuts + if (path.startsWith(pfx2 + '/recipe/')) { + handleRecipeShortcuts(event, key); + } + // Shopping list page shortcuts + else if (path === pfx2 + '/shopping-list') { + handleShoppingListShortcuts(event, key); + } + } + + // Recipe page specific shortcuts + function handleRecipeShortcuts(event, key) { + const staticMode = window.__STATIC_MODE__ === true; + switch (key) { + case 'c': + event.preventDefault(); + if (typeof startCookingMode === 'function') { + startCookingMode(); + } + return; + + case 'e': + if (staticMode) return; + event.preventDefault(); + // Find and click the edit link + const editPfx = (window.__PREFIX__ || '') + '/edit/'; + const editLink = document.querySelector(`a[href^="${editPfx}"]`); + if (editLink) { + editLink.click(); + } + return; + + case 'a': + if (staticMode) return; + event.preventDefault(); + // Find and click the add to shopping list button + const addButton = document.querySelector('button[onclick^="addToShoppingList"]'); + if (addButton) { + addButton.click(); + } + return; + + case 'p': + event.preventDefault(); + window.print(); + return; + + case '+': + case '=': // = is on the same key as + without shift + if (staticMode) return; + event.preventDefault(); + adjustScale(0.5); + return; + + case '-': + case '_': + if (staticMode) return; + event.preventDefault(); + adjustScale(-0.5); + return; + + case ']': + if (staticMode) return; + event.preventDefault(); + adjustScale(1); + return; + + case '[': + if (staticMode) return; + event.preventDefault(); + adjustScale(-1); + return; + } + } + + // Adjust recipe scale + function adjustScale(delta) { + const scaleInput = document.getElementById('scale'); + if (!scaleInput) return; + + let newValue = parseFloat(scaleInput.value) + delta; + const min = parseFloat(scaleInput.min) || 0.5; + const max = parseFloat(scaleInput.max) || 200; + + // Clamp to valid range + newValue = Math.max(min, Math.min(max, newValue)); + + // Round to avoid floating point issues + newValue = Math.round(newValue * 10) / 10; + + if (newValue !== parseFloat(scaleInput.value)) { + scaleInput.value = newValue; + // Trigger the onchange event + scaleInput.dispatchEvent(new Event('change')); + } + } + + // Shopping list page specific shortcuts + function handleShoppingListShortcuts(event, key) { + switch (key) { + case 'c': + event.preventDefault(); + // Clear the list (if the function exists) + if (typeof clearList === 'function') { + if (confirm('Clear all items from shopping list?')) { + clearList(); + } + } + return; + } + } + + // Initialize keyboard shortcuts + document.addEventListener('keydown', handleKeydown); + + // Add visual indicator for keyboard navigation + document.addEventListener('DOMContentLoaded', function() { + // Add a small hint in the search placeholder about the shortcut + const searchInput = document.getElementById('search-input'); + if (searchInput) { + const currentPlaceholder = searchInput.getAttribute('placeholder'); + if (currentPlaceholder && !currentPlaceholder.includes('/')) { + // Don't modify placeholder - keep it clean + } + } + }); + +})(); diff --git a/static/js/search.js b/static/js/search.js new file mode 100644 index 0000000..f38138b --- /dev/null +++ b/static/js/search.js @@ -0,0 +1,110 @@ +(function () { + var prefix = window.__PREFIX__ || "."; + var input = document.getElementById("search-input"); + var results = document.getElementById("search-results"); + if (!input || !results) return; + + var index = null; + var selectedIndex = -1; + + function loadIndex() { + if (index !== null) return Promise.resolve(index); + return fetch(prefix + "/static/search-index.json") + .then(function (r) { return r.json(); }) + .then(function (data) { + index = data; + return data; + }) + .catch(function (e) { + console.error("search-index load failed", e); + index = []; + return index; + }); + } + + function score(entry, q) { + var ql = q.toLowerCase(); + if (entry.title.toLowerCase().indexOf(ql) !== -1) return 3; + if (entry.tags.some(function (t) { return t.toLowerCase().indexOf(ql) !== -1; })) return 2; + if (entry.ingredients.some(function (i) { return i.toLowerCase().indexOf(ql) !== -1; })) return 1; + return 0; + } + + function escapeHtml(s) { + return s.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """); + } + + function render(matches) { + if (matches.length === 0) { + results.innerHTML = '
No recipes found
'; + } else { + results.innerHTML = matches.map(function (m) { + var href = prefix + "/" + m.path; + return '' + + '
' + escapeHtml(m.title) + '
' + + '
'; + }).join(""); + } + results.classList.remove("hidden"); + } + + function updateSearchSelection() { + var items = results.querySelectorAll("a"); + items.forEach(function (item, i) { + if (i === selectedIndex) { + item.classList.add("search-selected"); + item.scrollIntoView({ block: "nearest" }); + } else { + item.classList.remove("search-selected"); + } + }); + } + + var timeout; + input.addEventListener("input", function () { + clearTimeout(timeout); + var q = this.value.trim(); + selectedIndex = -1; + if (q.length < 2) { + results.classList.add("hidden"); + return; + } + timeout = setTimeout(function () { + loadIndex().then(function (idx) { + var matches = idx + .map(function (e) { return { e: e, s: score(e, q) }; }) + .filter(function (x) { return x.s > 0; }) + .sort(function (a, b) { return b.s - a.s; }) + .slice(0, 20) + .map(function (x) { return x.e; }); + render(matches); + }); + }, 150); + }); + + input.addEventListener("keydown", function (e) { + var items = results.querySelectorAll("a"); + if (items.length === 0 || results.classList.contains("hidden")) return; + if (e.key === "ArrowDown") { + e.preventDefault(); + selectedIndex = Math.min(selectedIndex + 1, items.length - 1); + updateSearchSelection(); + } else if (e.key === "ArrowUp") { + e.preventDefault(); + selectedIndex = Math.max(selectedIndex - 1, -1); + updateSearchSelection(); + } else if (e.key === "Enter") { + if (selectedIndex >= 0 && selectedIndex < items.length) { + e.preventDefault(); + items[selectedIndex].click(); + } + } + }); + + document.addEventListener("click", function (e) { + if (!input.contains(e.target) && !results.contains(e.target)) { + results.classList.add("hidden"); + selectedIndex = -1; + } + }); +})(); diff --git a/static/js/src/cooklang-mode.js b/static/js/src/cooklang-mode.js new file mode 100644 index 0000000..2883d8e --- /dev/null +++ b/static/js/src/cooklang-mode.js @@ -0,0 +1,176 @@ +import { StreamLanguage } from "@codemirror/language"; + +// Cooklang syntax highlighting mode for CodeMirror 6 +// Ported from cooklang-obsidian/src/mode/cook/cook.ts +export const cooklang = StreamLanguage.define({ + name: "cooklang", + + startState() { + return { + formatting: false, + nextMultiline: false, + inMultiline: false, + afterSection: false, + position: null, + inFrontmatter: false, + inMetadata: false, + inNote: false, + inComment: false, + afterAmount: false // Track if we just closed a {} to look for (prep) + }; + }, + + token(stream, state) { + const sol = stream.sol() || state.afterSection; + const eol = stream.eol(); + + state.afterSection = false; + + if (sol) { + // Reset single-line states at start of new line + state.inNote = false; + state.inMetadata = false; + + if (state.nextMultiline) { + state.inMultiline = true; + state.nextMultiline = false; + } else { + state.position = null; + } + } + + if (eol && !state.nextMultiline) { + state.inMultiline = false; + state.position = null; + } + + if (sol) { + while (stream.eatSpace()) {} + } + + // Frontmatter delimiters (---) + if (sol && stream.match(/^---\s*$/)) { + state.inFrontmatter = !state.inFrontmatter; + return "meta"; + } + + // Inside frontmatter + if (state.inFrontmatter) { + stream.skipToEnd(); + return "meta"; + } + + // Sections (= Section Name, == Section ==, etc.) + if (sol && stream.match(/^=+/)) { + stream.skipToEnd(); + return "heading"; + } + + // Line comments (-- comment) + if (sol && stream.match(/^--/)) { + stream.skipToEnd(); + return "comment"; + } + + // Block comments ([- comment -]) + if (stream.match(/^\[-/)) { + state.inComment = true; + return "comment"; + } + + if (state.inComment) { + if (stream.match(/-]/)) { + state.inComment = false; + return "comment"; + } + stream.skipToEnd(); + return "comment"; + } + + // Metadata (>> key: value) + if (sol && stream.match(/^>>/)) { + state.inMetadata = true; + state.position = "metadata-key"; + return "meta"; + } + + if (state.inMetadata) { + if (state.position === "metadata-key") { + if (stream.match(/^[^:]+:/)) { + state.position = "metadata-value"; + return "meta"; + } + stream.skipToEnd(); + return "meta"; + } else if (state.position === "metadata-value") { + stream.skipToEnd(); + return "meta"; + } + } + + // Notes (lines starting with >) + if (sol && stream.match(/^>/)) { + state.inNote = true; + return "comment"; + } + + if (state.inNote) { + stream.skipToEnd(); + return "comment"; + } + + // Shorthand preparations (prep) after ingredient amounts like @onion{1}(chopped) + if (state.afterAmount && stream.match(/^\([^)]*\)/)) { + state.afterAmount = false; + return "string"; // Use string style for prep instructions + } + + // Reset afterAmount if we see anything else + if (state.afterAmount && !stream.match(/^\s*(?=\()/, false)) { + state.afterAmount = false; + } + + // Ingredients (@ingredient{amount}) + if (stream.match(/^@([^@#~]+?(?={))/)) { + return "variableName"; + } else if (stream.match(/^@(.+?\b)/)) { + return "variableName"; + } + + // Cookware (#cookware{amount}) + if (stream.match(/^#([^@#~]+?(?={))/)) { + return "keyword"; + } else if (stream.match(/^#(.+?\b)/)) { + return "keyword"; + } + + // Timers (~timer{amount}) + if (stream.match(/^~([^@#~]+?(?={))/)) { + return "number"; + } else if (stream.match(/^~(.+?\b)/)) { + return "number"; + } + + // Amounts in curly braces + const ch = stream.next(); + if (!ch) return null; + + if (ch === '{') { + if (state.position !== "timer") state.position = "measurement"; + return null; + } + + if (ch === '}') { + state.position = null; + state.afterAmount = true; // Look for (prep) after closing brace + return null; + } + + if (ch === '%' && (state.position === "measurement" || state.position === "timer")) { + state.position = "unit"; + return null; + } + + return state.position; + } +}); diff --git a/static/js/src/editor.js b/static/js/src/editor.js new file mode 100644 index 0000000..a5fa112 --- /dev/null +++ b/static/js/src/editor.js @@ -0,0 +1,209 @@ +import { EditorState } from "@codemirror/state"; +import { EditorView, keymap, lineNumbers, highlightActiveLine, highlightActiveLineGutter } from "@codemirror/view"; +import { defaultKeymap, history, historyKeymap } from "@codemirror/commands"; +import { syntaxHighlighting, HighlightStyle, bracketMatching } from "@codemirror/language"; +import { searchKeymap, highlightSelectionMatches } from "@codemirror/search"; +import { linter } from "@codemirror/lint"; +import { autocompletion, snippet } from "@codemirror/autocomplete"; +import { tags as t } from "@lezer/highlight"; +import { cooklang } from "./cooklang-mode.js"; + +// Diagnostics support +let currentDiagnostics = []; + +export function setDiagnostics(view, diagnostics) { + currentDiagnostics = diagnostics; + // Trigger a state update to rerun the linter + if (view) { + view.dispatch({ + effects: [] + }); + } +} + +// Linter that returns current diagnostics +const cooklangLinter = linter((view) => currentDiagnostics, { delay: 0 }); + +// Completion support +let completionResolver = null; + +export function setCompletionResolver(resolver) { + completionResolver = resolver; +} + +// Async completion source for Cooklang +async function cooklangCompletions(context) { + if (!completionResolver) return null; + + const pos = context.pos; + const line = context.state.doc.lineAt(pos); + const textBefore = line.text.slice(0, pos - line.from); + + // Check for trigger characters (@, #, ~) + // Include . / - in character class so @./path file references trigger completion + const match = textBefore.match(/[@#~]([a-zA-Z0-9_./\-]*)$/); + if (!match) return null; + + const prefix = match[1]; + const from = pos - prefix.length; + const triggerChar = match[0][0]; + + try { + const items = await completionResolver(line.number - 1, pos - line.from); + if (!items || items.length === 0) return null; + + return { + from: from, + // Keep completion open while user types path chars; CodeMirror's + // built-in FuzzyMatcher handles client-side narrowing. + validFor: /^[a-zA-Z0-9_./\-]*$/, + options: items.map(item => { + const type = item.kind === 17 ? 'file' : item.kind === 6 ? 'variable' : item.kind === 14 ? 'keyword' : 'text'; + // Prefer textEdit.newText (used by recipe references with explicit ranges), + // then insertText, then label + const text = item.textEdit?.newText || item.insertText || item.label; + + // Check if LSP sent a snippet (insertTextFormat === 2) + if (item.insertTextFormat === 2 && text.includes('$')) { + // Convert LSP snippet syntax to CodeMirror: $0 -> ${}, $1 -> ${1} + const cmSnippet = text.replace(/\$0/g, '${}').replace(/\$(\d+)/g, '${$1}'); + return { + label: item.label, + type: type, + detail: item.detail || '', + apply: snippet(cmSnippet) + }; + } + + return { + label: item.label, + type: type, + detail: item.detail || '', + apply: text + }; + }) + }; + } catch (e) { + console.error('Completion error:', e); + return null; + } +} + +// Custom highlight style for Cooklang syntax +const cooklangHighlightStyle = HighlightStyle.define([ + { tag: t.variableName, color: "#ea580c", fontWeight: "600" }, // Ingredients (orange) + { tag: t.keyword, color: "#16a34a", fontWeight: "600" }, // Cookware (green) + { tag: t.number, color: "#dc2626", fontWeight: "600" }, // Timers (red) + { tag: t.comment, color: "#9ca3af", fontStyle: "italic" }, // Comments + { tag: t.meta, color: "#8b5cf6" }, // Metadata + { tag: t.unit, color: "#6366f1" }, // Units + { tag: t.heading, color: "#0891b2", fontWeight: "700", fontSize: "1.1em" }, // Sections (cyan) + { tag: t.string, color: "#d97706", fontStyle: "italic" } // Prep instructions (amber italic) +]); + +// Editor base theme for layout +const cooklangBaseTheme = EditorView.theme({ + "&": { + height: "100%", + fontSize: "14px" + }, + ".cm-scroller": { + fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace", + overflow: "auto" + }, + ".cm-content": { + padding: "1rem" + }, + ".cm-line": { + padding: "0 0.5rem" + } +}); + +// Cursor position callback +let cursorPositionCallback = null; + +export function setCursorPositionCallback(callback) { + cursorPositionCallback = callback; +} + +// Initialize editor +export function initEditor(container, initialContent, onChange) { + const updateListener = EditorView.updateListener.of((update) => { + if (update.docChanged && onChange) { + onChange(update.state.doc.toString()); + } + // Always update cursor position on any update + const pos = update.state.selection.main.head; + const line = update.state.doc.lineAt(pos); + const col = pos - line.from + 1; + if (cursorPositionCallback) { + cursorPositionCallback(line.number, col); + } + }); + + const state = EditorState.create({ + doc: initialContent, + extensions: [ + lineNumbers(), + highlightActiveLine(), + highlightActiveLineGutter(), + history(), + bracketMatching(), + highlightSelectionMatches(), + cooklang, + syntaxHighlighting(cooklangHighlightStyle), + cooklangBaseTheme, + cooklangLinter, + autocompletion({ + override: [cooklangCompletions], + activateOnTyping: true + }), + keymap.of([ + ...defaultKeymap, + ...historyKeymap, + ...searchKeymap + ]), + updateListener, + EditorView.lineWrapping + ] + }); + + const view = new EditorView({ + state, + parent: container + }); + + // Set cursor to beginning of document (line 1, col 1) + view.dispatch({ + selection: { anchor: 0 } + }); + view.focus(); + + return view; +} + +// Get editor content +export function getContent(view) { + return view.state.doc.toString(); +} + +// Set editor content +export function setContent(view, content) { + view.dispatch({ + changes: { + from: 0, + to: view.state.doc.length, + insert: content + } + }); +} + +// Export for global access +window.CooklangEditor = { + initEditor, + getContent, + setContent, + setDiagnostics, + setCompletionResolver, + setCursorPositionCallback +}; diff --git a/static/search-index.json b/static/search-index.json new file mode 100644 index 0000000..b68f4dc --- /dev/null +++ b/static/search-index.json @@ -0,0 +1 @@ +[{"title":"Légumes rôtis au four","path":"recipe/legumes_rotis.html","tags":["batch","four","légumes"],"ingredients":["pommes de terre","patate douce","carottes","panais","courge","betterave","chou-fleur","oignons rouges","huile d'olive","sel","poivre","épices","ail"]},{"title":"Porc effiloché au four","path":"recipe/porc_effiloche.html","tags":["batch","four","porc"],"ingredients":["échine de porc","huile d'olive","moutarde","sel","poivre","paprika fumé","cumin","ail en poudre","origan","cassonade","oignons","bière"]},{"title":"Galettes de lentilles","path":"recipe/galette_lentilles.html","tags":["végétarien","poêle"],"ingredients":["carottes","échalote","lentilles","sel","cumin","coriandre","farine","œuf","chapelure de pain","huile d'olive"]},{"title":"Le gâteau mi-cuit au chocolat de Suzy Palatin","path":"recipe/mi-cuit_chocolat.html","tags":["chocolat","gâteau"],"ingredients":["chocolat pâtissier à 60 ou 70 %","beurre","sucre","farine","œufs"]},{"title":"Cuisses de poulet au four (cuisson lente)","path":"recipe/cuisses_poulet_four.html","tags":["batch","four","poulet"],"ingredients":["cuisses de poulet entières","huile d'olive","sel","poivre","épices"]},{"title":"Poisson en papillote","path":"recipe/poisson_papillote.html","tags":["four","poisson"],"ingredients":["courgette","poireau","tomates cerises","pavé de poisson","huile d'olive","citron","sel","poivre","herbes","vin blanc","ail","piment"]},{"title":"Saucisses maison","path":"recipe/saucisses.html","tags":["saucisse","poêle"],"ingredients":["chair à saucisse bœuf et porc","sel","poivre","persil plat","paprika","pain à hot-dog","salade","salsa","ketchup","moutarde"]},{"title":"« Ratatouille » du frigo","path":"recipe/ratatouille.html","tags":["batch","mijoté","légumes"],"ingredients":["oignons","tomates","courgettes","aubergines","poivrons","piments","concentré de tomate","huile d'olive","sel","poivre"]}] \ No newline at end of file diff --git a/static/site.webmanifest b/static/site.webmanifest new file mode 100644 index 0000000..190fa7f --- /dev/null +++ b/static/site.webmanifest @@ -0,0 +1,60 @@ +{ + "name": "Cook", + "short_name": "Cook", + "description": "Cooklang recipe manager and shopping list", + "icons": [ + { + "src": "/static/android-chrome-128x128.png", + "sizes": "128x128", + "type": "image/png", + "purpose": "any" + }, + { + "src": "/static/android-chrome-144x144.png", + "sizes": "144x144", + "type": "image/png", + "purpose": "any" + }, + { + "src": "/static/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "any" + }, + { + "src": "/static/android-chrome-192x192-maskable.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "/static/android-chrome-256x256.png", + "sizes": "256x256", + "type": "image/png", + "purpose": "any" + }, + { + "src": "/static/android-chrome-384x384.png", + "sizes": "384x384", + "type": "image/png", + "purpose": "any" + }, + { + "src": "/static/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "any" + }, + { + "src": "/static/android-chrome-512x512-maskable.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ], + "theme_color": "#f97316", + "background_color": "#ffffff", + "display": "standalone", + "start_url": "/", + "scope": "/" +} \ No newline at end of file