@growthub/cli 0.3.10 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime/server/dist/routes/gtm.d.ts.map +1 -1
- package/dist/runtime/server/dist/routes/gtm.js +26 -14
- package/dist/runtime/server/dist/routes/gtm.js.map +1 -1
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/meta/_journal.json +7 -0
- package/dist/runtime/server/ui-dist/assets/{OnboardingWizard-B6t7W0wI.js → OnboardingWizard-BiZHH3vY.js} +4 -4
- package/dist/runtime/server/ui-dist/assets/{_basePickBy-AK_SWane.js → _basePickBy-DOJDGGWo.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{_baseUniq-Ce_AndV1.js → _baseUniq-DjoWC9VG.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{arc-s2YdnNJl.js → arc-DzAhgPuQ.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{architectureDiagram-VXUJARFQ-BcfuW_eB.js → architectureDiagram-VXUJARFQ-CFxoZ9U1.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{blockDiagram-VD42YOAC-BMTE1VUZ.js → blockDiagram-VD42YOAC-CmcNReYb.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{c4Diagram-YG6GDRKO-B-NXglhR.js → c4Diagram-YG6GDRKO-62g03z24.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/channel-CyMiLt_6.js +1 -0
- package/dist/runtime/server/ui-dist/assets/{chunk-4BX2VUAB-D-7wJtkB.js → chunk-4BX2VUAB-DdKgkZWf.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{chunk-55IACEB6-Duej5TeT.js → chunk-55IACEB6-BG61sDBH.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{chunk-B4BG7PRW-BoPmWIN4.js → chunk-B4BG7PRW-jHjDOzs3.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{chunk-DI55MBZ5-C3HY62-t.js → chunk-DI55MBZ5-QWOEgAft.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{chunk-FMBD7UC4-CVNH703m.js → chunk-FMBD7UC4-BTtsDCBm.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{chunk-QN33PNHL-DA7w4NyY.js → chunk-QN33PNHL-DQ0G5mTp.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{chunk-QZHKN3VN-SFQMSZap.js → chunk-QZHKN3VN-CwD654Gq.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{chunk-TZMSLE5B-BiEhEwtG.js → chunk-TZMSLE5B-BW4AfItk.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/classDiagram-2ON5EDUG-Bpt4jbt_.js +1 -0
- package/dist/runtime/server/ui-dist/assets/classDiagram-v2-WZHVMYZB-Bpt4jbt_.js +1 -0
- package/dist/runtime/server/ui-dist/assets/clone-C1pAl4cM.js +1 -0
- package/dist/runtime/server/ui-dist/assets/{cose-bilkent-S5V4N54A-vRH8NlIE.js → cose-bilkent-S5V4N54A-Cl5X2jL8.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{dagre-6UL2VRFP-CzSFYyZ_.js → dagre-6UL2VRFP-B2u9a5zG.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{diagram-PSM6KHXK-CKcj_yeO.js → diagram-PSM6KHXK-DsSVNioI.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{diagram-QEK2KX5R-h0Roaj0i.js → diagram-QEK2KX5R-C2oaCik_.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{diagram-S2PKOQOG-DCSBAsRf.js → diagram-S2PKOQOG-CuEvUbkw.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{dx-root-B0w_gPhT.js → dx-root-B5r5o3mh.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{erDiagram-Q2GNP2WA-DpWT9dJS.js → erDiagram-Q2GNP2WA-_1lFdkqV.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{flowDiagram-NV44I4VS-BisMBMKb.js → flowDiagram-NV44I4VS-DUoF0DLT.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{ganttDiagram-JELNMOA3-CmekAzdE.js → ganttDiagram-JELNMOA3-CruQ7D3m.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{gitGraphDiagram-V2S2FVAM-Br_qlrxw.js → gitGraphDiagram-V2S2FVAM-BDuS9ljz.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{graph-D-V_UoCw.js → graph-BFy59M3M.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/gtm-root-bgiNL285.js +11 -0
- package/dist/runtime/server/ui-dist/assets/{index-DdaDZR2v.js → index--dv-yDMD.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-Durw9xRw.js → index-A_Utfb1G.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-CSgPEZIf.js → index-AaLnuKvn.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-DS6VElYc.js → index-B9Xd_vMV.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-XVREjU0u.js → index-BCphYMJ8.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-zRyuq4cJ.js → index-BKO_Nk8c.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-D9rVjAIH.js → index-BMwN19Gi.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-BFQEyPDo.js → index-Bz0rSFov.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-COe0-YYa.js → index-BzNjBEzf.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-CAU5OZcp.js → index-CLWYCHoS.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-B7EJswmR.js → index-CZVyxyFA.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-Dwmb9KgG.js → index-Cpqm25YS.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-CwPfxt9_.js → index-Cv5ClxEP.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-hB0NRj8J.js → index-D2MHxpCH.js} +2 -2
- package/dist/runtime/server/ui-dist/assets/{index-DlgNqdiq.js → index-D3MPbMGr.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-BL5lcbji.js → index-DFUgoz9_.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-COGi5Wb7.js → index-DL95rih-.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-BL7iND8Y.js → index-DY60bSWi.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-D2G9ZSV4.js → index-DcoQC6ia.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-eCHfIyqy.js → index-DfnTp5y6.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-BheLWZ0d.js → index-Fb7iEaRG.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-CTAGezRr.js → index-TPJ_0VD8.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-Bn3GeDyS.js → index-WuexBBBr.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{infoDiagram-HS3SLOUP-BXSSUIic.js → infoDiagram-HS3SLOUP-CiI6r25R.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{journeyDiagram-XKPGCS4Q-plV2BdJI.js → journeyDiagram-XKPGCS4Q-BMmOHrov.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{kanban-definition-3W4ZIXB7-C_-AwmSZ.js → kanban-definition-3W4ZIXB7-BxeYeVi1.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{layout-5aphL7em.js → layout-anG6DZ8y.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{linear-CUh-S_3C.js → linear-CDTAlHE-.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{mermaid.core-BRfo14rF.js → mermaid.core-DNt7uRm5.js} +4 -4
- package/dist/runtime/server/ui-dist/assets/{mindmap-definition-VGOIOE7T-C1A43zg5.js → mindmap-definition-VGOIOE7T-DTO5b9so.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{pieDiagram-ADFJNKIX-CKDydAai.js → pieDiagram-ADFJNKIX-BteTAzPn.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{quadrantDiagram-AYHSOK5B-CgicP7a2.js → quadrantDiagram-AYHSOK5B-_gG2aKm4.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{requirementDiagram-UZGBJVZJ-CgUaakqy.js → requirementDiagram-UZGBJVZJ-CcOvI4e8.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{sankeyDiagram-TZEHDZUN-D5ZOuvY3.js → sankeyDiagram-TZEHDZUN-C1Rbdzvp.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{sequenceDiagram-WL72ISMW-BY_eD4WY.js → sequenceDiagram-WL72ISMW-DPx4fWtG.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{stateDiagram-FKZM4ZOC-C1PJa9GA.js → stateDiagram-FKZM4ZOC-CID-77J9.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/stateDiagram-v2-4FDKWEC3-DF70krIP.js +1 -0
- package/dist/runtime/server/ui-dist/assets/{timeline-definition-IT6M3QCI-mnsvrXms.js → timeline-definition-IT6M3QCI-CyA1h3jY.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{treemap-GDKQZRPO-CrhnH0yt.js → treemap-GDKQZRPO-nqrXf2kh.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{xychartDiagram-PRI3JC2R-D0-VyuWz.js → xychartDiagram-PRI3JC2R-CS0bUj41.js} +1 -1
- package/dist/runtime/server/ui-dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0000_mature_masked_marvel.sql +0 -208
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0001_fast_northstar.sql +0 -87
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0002_big_zaladane.sql +0 -1
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0003_shallow_quentin_quire.sql +0 -5
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0004_issue_identifiers.sql +0 -28
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0005_chief_luke_cage.sql +0 -19
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0006_overjoyed_mister_sinister.sql +0 -36
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0007_new_quentin_quire.sql +0 -20
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0008_amused_zzzax.sql +0 -1
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0009_fast_jackal.sql +0 -36
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0010_stale_justin_hammer.sql +0 -37
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0011_windy_corsair.sql +0 -18
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0012_perpetual_ser_duncan.sql +0 -2
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0013_dashing_wasp.sql +0 -4
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0014_many_mikhail_rasputin.sql +0 -135
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0015_project_color_archived.sql +0 -2
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0016_agent_icon.sql +0 -1
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0017_tiresome_gabe_jones.sql +0 -51
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0018_flat_sleepwalker.sql +0 -26
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0019_public_victor_mancha.sql +0 -18
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0020_white_anita_blake.sql +0 -1
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0021_chief_vindicator.sql +0 -1
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0022_company_brand_color.sql +0 -1
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0023_fair_lethal_legion.sql +0 -3
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0024_far_beast.sql +0 -2
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0025_nasty_salo.sql +0 -15
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0026_lying_pete_wisdom.sql +0 -39
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0027_tranquil_tenebrous.sql +0 -2
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0028_harsh_goliath.sql +0 -54
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0029_plugin_tables.sql +0 -177
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0030_rich_magneto.sql +0 -12
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0031_zippy_magma.sql +0 -51
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0032_pretty_doctor_octopus.sql +0 -102
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0033_shiny_black_tarantula.sql +0 -2
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0034_fat_dormammu.sql +0 -2
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0035_marvelous_satana.sql +0 -91
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0036_cheerful_nitro.sql +0 -9
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0037_friendly_eddie_brock.sql +0 -29
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0038_careless_iron_monger.sql +0 -5
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/0039_tickets.sql +0 -25
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0000_snapshot.json +0 -1743
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0001_snapshot.json +0 -2441
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0002_snapshot.json +0 -2454
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0003_snapshot.json +0 -2502
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0005_snapshot.json +0 -2719
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0006_snapshot.json +0 -3048
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0007_snapshot.json +0 -3258
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0008_snapshot.json +0 -3264
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0009_snapshot.json +0 -3587
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0010_snapshot.json +0 -3929
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0011_snapshot.json +0 -4068
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0012_snapshot.json +0 -4087
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0013_snapshot.json +0 -4118
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0014_snapshot.json +0 -5187
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0017_snapshot.json +0 -5215
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0018_snapshot.json +0 -5450
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0019_snapshot.json +0 -5603
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0020_snapshot.json +0 -5603
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0021_snapshot.json +0 -5609
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0023_snapshot.json +0 -5633
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0024_snapshot.json +0 -5693
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0025_snapshot.json +0 -5849
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0027_snapshot.json +0 -6205
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0028_snapshot.json +0 -6710
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0029_snapshot.json +0 -7899
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0030_snapshot.json +0 -8003
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0031_snapshot.json +0 -7242
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0032_snapshot.json +0 -7733
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0033_snapshot.json +0 -9038
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0034_snapshot.json +0 -9039
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0035_snapshot.json +0 -9959
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0036_snapshot.json +0 -10023
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0037_snapshot.json +0 -10263
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/0038_snapshot.json +0 -10301
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/migrations/meta/_journal.json +0 -293
- package/dist/runtime/server/ui-dist/assets/channel-DA_OM8-V.js +0 -1
- package/dist/runtime/server/ui-dist/assets/classDiagram-2ON5EDUG-Cf6Zhi-x.js +0 -1
- package/dist/runtime/server/ui-dist/assets/classDiagram-v2-WZHVMYZB-Cf6Zhi-x.js +0 -1
- package/dist/runtime/server/ui-dist/assets/clone-KxtiqD4L.js +0 -1
- package/dist/runtime/server/ui-dist/assets/gtm-root-D-OVTmcg.js +0 -11
- package/dist/runtime/server/ui-dist/assets/stateDiagram-v2-4FDKWEC3-C5p_b2GK.js +0 -1
- /package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/{migrations/0040_ticket_meta.sql → 0040_ticket_meta.sql} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
var YU=Object.defineProperty;var DN=t=>{throw TypeError(t)};var XU=(t,e,n)=>e in t?YU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Or=(t,e,n)=>XU(t,typeof e!="symbol"?e+"":e,n),S1=(t,e,n)=>e.has(t)||DN("Cannot "+n);var Q=(t,e,n)=>(S1(t,e,"read from private field"),n?n.call(t):e.get(t)),ut=(t,e,n)=>e.has(t)?DN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Be=(t,e,n,r)=>(S1(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),St=(t,e,n)=>(S1(t,e,"access private method"),n);var Qm=(t,e,n,r)=>({set _(s){Be(t,e,s,n)},get _(){return Q(t,e,r)}});import{g as em,c as eW,r as x,j as d,a as j,R as nP,d as tW,_ as me,e as FN}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BMwN19Gi.js","assets/index-CZVyxyFA.js","assets/index-D2MHxpCH.js","assets/index-ClbnJMz6.css","assets/index--dv-yDMD.js","assets/index-AaLnuKvn.js","assets/index-BKO_Nk8c.js","assets/index-TPJ_0VD8.js","assets/index-DcoQC6ia.js","assets/index-WuexBBBr.js","assets/index-Bz0rSFov.js","assets/index-DFUgoz9_.js","assets/index-Fb7iEaRG.js","assets/index-DY60bSWi.js","assets/index-DfnTp5y6.js","assets/index-Cv5ClxEP.js","assets/index-B9Xd_vMV.js","assets/index-BzNjBEzf.js","assets/index-A_Utfb1G.js","assets/index-D3MPbMGr.js","assets/index-DL95rih-.js","assets/index-BCphYMJ8.js","assets/dockerfile-BKs6k2Af.js","assets/simple-mode-GW_nhZxv.js","assets/factor-kuTfRLto.js","assets/nsis-LdVXkNf5.js","assets/pug-DeIclll2.js","assets/javascript-iXu5QeM3.js","assets/index-Cpqm25YS.js","assets/index-CLWYCHoS.js","assets/mermaid.core-DNt7uRm5.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var YU=Object.defineProperty;var DN=t=>{throw TypeError(t)};var XU=(t,e,n)=>e in t?YU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Or=(t,e,n)=>XU(t,typeof e!="symbol"?e+"":e,n),S1=(t,e,n)=>e.has(t)||DN("Cannot "+n);var Q=(t,e,n)=>(S1(t,e,"read from private field"),n?n.call(t):e.get(t)),ut=(t,e,n)=>e.has(t)?DN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Be=(t,e,n,r)=>(S1(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),St=(t,e,n)=>(S1(t,e,"access private method"),n);var Qm=(t,e,n,r)=>({set _(s){Be(t,e,s,n)},get _(){return Q(t,e,r)}});import{g as em,c as eW,r as x,j as d,a as j,R as nP,d as tW,_ as me,e as FN}from"./index-D2MHxpCH.js";function nW(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var Rl=eW();const rP=em(Rl),RRe=nW({__proto__:null,default:rP},[Rl]);/**
|
|
3
3
|
* react-router v7.13.0
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) Remix Software Inc.
|
|
@@ -769,7 +769,7 @@ ${l}`.trim();return[o,{kind:"tool_result",ts:e,toolUseId:_r(n.callID)||_r(n.id,r
|
|
|
769
769
|
`))};if((We.mac||We.android)&&f.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:a,to:l,insert:Yt.of([r.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let h=this.to-this.from+(f.to-f.from+f.insert.length);IE(e,f,Ce.single(this.toEditorPos(r.selectionStart,h),this.toEditorPos(r.selectionEnd,h)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from<f.to&&!f.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);i=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||i||new DOMRect,s.push(i)}n.updateCharacterBounds(r.rangeStart,s)},this.handlers.textformatupdate=r=>{let s=[];for(let i of r.getTextFormats()){let o=i.underlineStyle,a=i.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(i.rangeStart),c=this.toEditorPos(i.rangeEnd);if(l<c){let u=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;s.push(ht.mark({attributes:{style:u}}).range(l,c))}}}e.dispatch({effects:ZB.of(ht.set(s))})},this.handlers.compositionstart=()=>{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:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=Rp(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,o,a,l,c)=>{if(r)return;let u=c.length-(o-i);if(s&&o>=s.to)if(s.from==i&&s.to==o&&s.insert.eq(c)){s=this.pendingContextChange=null,n+=u,this.to+=u;return}else s=null,this.revertPending(e.state);if(i+=n,o+=n,o<=this.from)this.from+=u,this.to+=u;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),c.toString()),this.to+=u}n+=u}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.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||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+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 n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class He{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 n;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:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||_we(e.parent)||document,this.viewState=new sR(e.state||Vt.create(e)),e.scrollTo&&e.scrollTo.is(Pg)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(md).map(s=>new Dv(s));for(let s of this.plugins)s.update(this);this.observer=new qke(this),this.inputState=new gke(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Wj(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let n=e.length==1&&e[0]instanceof Qn?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let h of e){if(h.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=h.state}if(this.destroyed){this.viewState.state=i;return}let o=this.hasFocus,a=0,l=null;e.some(h=>h.annotation(fV))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=hV(i,o),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(u=null)):this.observer.clear(),i.facet(Vt.phrases)!=this.state.facet(Vt.phrases))return this.setState(i);s=uy.create(this,i,e),s.flags|=a;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let h of e){if(f&&(f=f.map(h.changes)),h.scrollIntoView){let{main:p}=h.state.selection;f=new Id(p.empty?p:Ce.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of h.effects)p.is(Pg)&&(f=p.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=my.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Sh)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(h=>h.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Bg)!=s.state.facet(Bg)&&(this.viewState.mustMeasureContent=!0),(n||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let h of this.state.facet(b2))try{h(s)}catch(p){vs(this.state,p,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!iV(this,u)&&c.force&&Ad(this.contentDOM,c.key,c.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 n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new sR(e),this.plugins=e.facet(md).map(r=>new Dv(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Wj(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(md),r=e.state.facet(md);if(n!=r){let s=[];for(let i of r){let o=n.indexOf(i);if(o<0)s.push(new Dv(i));else{let a=this.plugins[o];a.mustUpdate=e,s.push(a)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){vs(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(MB(r))i=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(s);i=p.from,o=p.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(p=>{try{return p.read(this)}catch(m){return vs(this.state,m),cR}}),f=uy.create(this,this.state,[]),h=!1;f.flags|=l,n?n.flags|=l:n=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),h=this.docView.update(f),h&&this.docViewUpdate());for(let p=0;p<c.length;p++)if(u[p]!=cR)try{let m=c[p];m.write&&m.write(u[p],this)}catch(m){vs(this.state,m)}if(h&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let m=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o;if(m>1||m<-1){s=s+m,r.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(b2))a(n)}get themeClasses(){return S2+" "+(this.state.facet(_2)?xV:gV)+" "+this.state.facet(Bg)}updateAttrs(){let e=uR(this,QB,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(pa)?"true":"false",class:"cm-content",style:`${We.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),uR(this,NE,n);let r=this.observer.ignore(()=>{let s=$j(this.contentDOM,this.contentAttrs,n),i=$j(this.dom,this.editorAttrs,e);return s||i});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(He.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Sh);let e=this.state.facet(He.cspNonce);Ul.mount(this.root,this.styleModules.concat(Wke).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 n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.plugin==e)||null),n&&n.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,n,r){return Vv(this,e,Kj(this,e,n,r))}moveByGroup(e,n){return Vv(this,e,Kj(this,e,n,r=>oke(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return Ce.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return ike(this,e,n,r)}moveVertically(e,n,r){return Vv(this,e,ake(this,e,n,r))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let r=k2(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),k2(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),o=i[So.find(i,e-s.from,-1,n)];return cy(r,o.dir==mn.LTR==n>0)}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(qB)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Zke)return $B(e.length);let n=this.textDirectionAt(e.from),r;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||FB(i.isolates,r=zj(this,e))))return i.order;r||(r=zj(this,e));let s=Rwe(e.text,n,r);return this.bidiCache.push(new my(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||We.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{RB(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,n={}){return Pg.of(new Id(typeof e=="number"?Ce.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Pg.of(new Id(Ce.cursor(r.from),"start","start",r.top-e,n,!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 nr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return nr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=Ul.newName(),s=[Bg.of(r),Sh.of(E2(`.${r}`,e))];return n&&n.dark&&s.push(_2.of(!0)),s}static baseTheme(e){return lc.lowest(Sh.of(E2("."+S2,e,yV)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&tr.get(r)||tr.get(e);return((n=s==null?void 0:s.root)===null||n===void 0?void 0:n.view)||null}}He.styleModule=Sh;He.inputHandler=WB;He.clipboardInputFilter=SE;He.clipboardOutputFilter=EE;He.scrollHandler=JB;He.focusChangeEffect=KB;He.perLineTextDirection=qB;He.exceptionSink=UB;He.updateListener=b2;He.editable=pa;He.mouseSelectionStyle=HB;He.dragMovesSelection=zB;He.clickAddsSelectionRange=VB;He.decorations=u1;He.blockWrappers=YB;He.outerDecorations=TE;He.atomicRanges=$m;He.bidiIsolatedRanges=XB;He.scrollMargins=eV;He.darkTheme=_2;He.cspNonce=Ue.define({combine:t=>t.length?t[0]:""});He.contentAttributes=NE;He.editorAttributes=QB;He.lineWrapping=He.contentAttributes.of({class:"cm-lineWrapping"});He.announce=yt.define();const Zke=4096,cR={};class my{constructor(e,n,r,s,i,o){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=o}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:mn.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let o=e[i];o.dir==s&&!n.touchesRange(o.from,o.to)&&r.push(new my(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function uR(t,e,n){for(let r=t.state.facet(e),s=r.length-1;s>=0;s--){let i=r[s],o=typeof i=="function"?i(t):i;o&&kE(o,n)}return n}const Qke=We.mac?"mac":We.windows?"win":We.linux?"linux":"key";function Yke(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,o,a;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))s=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return s&&(r="Alt-"+r),i&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function Vg(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const Xke=lc.default(He.domEventHandlers({keydown(t,e){return vV(bV(e.state),t,e,"editor")}})),Bm=Ue.define({enables:Xke}),dR=new WeakMap;function bV(t){let e=t.facet(Bm),n=dR.get(e);return n||dR.set(e,n=nCe(e.reduce((r,s)=>r.concat(s),[]))),n}function eCe(t,e,n){return vV(bV(t.state),e,t,n)}let ul=null;const tCe=4e3;function nCe(t,e=Qke){let n=Object.create(null),r=Object.create(null),s=(o,a)=>{let l=r[o];if(l==null)r[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},i=(o,a,l,c,u)=>{var f,h;let p=n[o]||(n[o]=Object.create(null)),m=a.split(/ (?!$)/).map(v=>Yke(v,e));for(let v=1;v<m.length;v++){let b=m.slice(0,v).join(" ");s(b,!0),p[b]||(p[b]={preventDefault:!0,stopPropagation:!1,run:[w=>{let k=ul={view:w,prefix:b,scope:o};return setTimeout(()=>{ul==k&&(ul=null)},tCe),!0}]})}let g=m.join(" ");s(g,!1);let y=p[g]||(p[g]={preventDefault:!1,stopPropagation:!1,run:((h=(f=p._any)===null||f===void 0?void 0:f.run)===null||h===void 0?void 0:h.slice())||[]});l&&y.run.push(l),c&&(y.preventDefault=!0),u&&(y.stopPropagation=!0)};for(let o of t){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let u=n[c]||(n[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let h in u)u[h].run.push(p=>f(p,N2))}let l=o[e]||o.key;if(l)for(let c of a)i(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return n}let N2=null;function vV(t,e,n,r){N2=e;let s=mwe(e),i=xs(s,0),o=vo(i)==s.length&&s!=" ",a="",l=!1,c=!1,u=!1;ul&&ul.view==n&&ul.scope==r&&(a=ul.prefix+" ",lV.indexOf(e.keyCode)<0&&(c=!0,ul=null));let f=new Set,h=y=>{if(y){for(let v of y.run)if(!f.has(v)&&(f.add(v),v(n)))return y.stopPropagation&&(u=!0),!0;y.preventDefault&&(y.stopPropagation&&(u=!0),c=!0)}return!1},p=t[r],m,g;return p&&(h(p[a+Vg(s,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(We.windows&&e.ctrlKey&&e.altKey)&&!(We.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(m=Wl[e.keyCode])&&m!=s?(h(p[a+Vg(m,e,!0)])||e.shiftKey&&(g=Ip[e.keyCode])!=s&&g!=m&&h(p[a+Vg(g,e,!1)]))&&(l=!0):o&&e.shiftKey&&h(p[a+Vg(s,e,!0)])&&(l=!0),!l&&h(p._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),N2=null,l}class Vm{constructor(e,n,r,s,i){this.className=e,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=wV(e);return[new Vm(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return rCe(e,n,r)}}function wV(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==mn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function fR(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,a=t.posAtCoords({x:i.left+1,y:o}),l=t.posAtCoords({x:i.right-1,y:o});return a==null||l==null?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function rCe(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),i=t.textDirection==mn.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=wV(t),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),f=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),h=a.right-(u?parseInt(u.paddingRight):0),p=w2(t,r,1),m=w2(t,s,-1),g=p.type==jr.Text?p:null,y=m.type==jr.Text?m:null;if(g&&(t.lineWrapping||p.widgetLineBreaks)&&(g=fR(t,r,1,g)),y&&(t.lineWrapping||m.widgetLineBreaks)&&(y=fR(t,s,-1,y)),g&&y&&g.from==y.from&&g.to==y.to)return b(w(n.from,n.to,g));{let C=g?w(n.from,null,g):k(p,!1),_=y?w(null,n.to,y):k(m,!0),S=[];return(g||p).to<(y||m).from-(g&&y?1:0)||p.widgetLineBreaks>1&&C.bottom+t.defaultLineHeight/2<_.top?S.push(v(f,C.bottom,h,_.top)):C.bottom<_.top&&t.elementAtHeight((C.bottom+_.top)/2).type==jr.Text&&(C.bottom=_.top=(C.bottom+_.top)/2),b(C).concat(S).concat(b(_))}function v(C,_,S,E){return new Vm(e,C-l.left,_-l.top,Math.max(0,S-C),E-_)}function b({top:C,bottom:_,horizontal:S}){let E=[];for(let N=0;N<S.length;N+=2)E.push(v(S[N],C,S[N+1],_));return E}function w(C,_,S){let E=1e9,N=-1e9,T=[];function O(M,V,G,D,B){let F=t.coordsAtPos(M,M==S.to?-2:2),R=t.coordsAtPos(G,G==S.from?2:-2);!F||!R||(E=Math.min(F.top,R.top,E),N=Math.max(F.bottom,R.bottom,N),B==mn.LTR?T.push(i&&V?f:F.left,i&&D?h:R.right):T.push(!i&&D?f:R.left,!i&&V?h:F.right))}let L=C??S.from,I=_??S.to;for(let M of t.visibleRanges)if(M.to>L&&M.from<I)for(let V=Math.max(M.from,L),G=Math.min(M.to,I);;){let D=t.state.doc.lineAt(V);for(let B of t.bidiSpans(D)){let F=B.from+D.from,R=B.to+D.from;if(F>=G)break;R>V&&O(Math.max(F,V),C==null&&F<=L,Math.min(R,G),_==null&&R>=I,B.dir)}if(V=D.to+1,V>=G)break}return T.length==0&&O(L,C==null,I,_==null,t.textDirection),{top:E,bottom:N,horizontal:T}}function k(C,_){let S=a.top+(_?C.top:C.bottom);return{top:S,bottom:S,horizontal:[]}}}function sCe(t,e){return t.constructor==e.constructor&&t.eq(e)}class iCe{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(Fx)!=e.state.facet(Fx)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(Fx);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!sCe(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,We.safari&&We.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Fx=Ue.define();function kV(t){return[nr.define(e=>new iCe(e,t)),Fx.of(t)]}const Pp=Ue.define({combine(t){return Wo(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function oCe(t={}){return[Pp.of(t),aCe,lCe,cCe,GB.of(!0)]}function CV(t){return t.startState.facet(Pp)!=t.state.facet(Pp)}const aCe=kV({above:!0,markers(t){let{state:e}=t,n=e.facet(Pp),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:Ce.cursor(s.head,s.head>s.anchor?-1:1);for(let l of Vm.forRange(t,o,a))r.push(l)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=CV(t);return n&&hR(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){hR(e.state,t)},class:"cm-cursorLayer"});function hR(t,e){e.style.animationDuration=t.facet(Pp).cursorBlinkRate+"ms"}const lCe=kV({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:Vm.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||CV(t)},class:"cm-selectionLayer"}),cCe=lc.highest(He.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),_V=yt.define({map(t,e){return t==null?null:e.mapPos(t)}}),Th=vr.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(_V)?r.value:n,t)}}),uCe=nr.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Th);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Th)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Th),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Th)!=t&&this.view.dispatch({effects:_V.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dCe(){return[Th,uCe]}function pR(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),o=n,a;!i.next().done;o+=i.value.length)if(!i.lineBreak)for(;a=e.exec(i.value);)s(o+a.index,a)}function fCe(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(t.state.doc.lineAt(s).from,s-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class hCe{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:o=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(a,l,c,u)=>s(u,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,u)=>{let f=r(a,l,c);f&&u(c,c+a[0].length,f)};else if(r)this.addMatch=(a,l,c,u)=>u(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=o}createDeco(e){let n=new La,r=n.add.bind(n);for(let{from:s,to:i}of fCe(e,this.maxLength))pR(e.state.doc,this.regexp,s,i,(o,a)=>this.addMatch(a,e,o,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,o,a,l)=>{l>=e.view.viewport.from&&a<=e.view.viewport.to&&(r=Math.min(a,r),s=Math.max(l,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let o=Math.max(i.from,r),a=Math.min(i.to,s);if(a>=o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,u=Math.max(i.from,l.from),f=Math.min(i.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){u=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){f=a;break}}let h=[],p,m=(g,y,v)=>h.push(v.range(g,y));if(l==c)for(this.regexp.lastIndex=u-l.from;(p=this.regexp.exec(l.text))&&p.index<f-l.from;)this.addMatch(p,e,p.index+l.from,m);else pR(e.state.doc,this.regexp,u,f,(g,y)=>this.addMatch(y,e,g,m));n=n.update({filterFrom:u,filterTo:f,filter:(g,y)=>g<u||y>f,add:h})}}return n}}const T2=/x/.unicode!=null?"gu":"g",pCe=new RegExp(`[\0-\b
|
|
770
770
|
--\u2028\u2029\uFEFF-]`,T2),mCe={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Uv=null;function gCe(){var t;if(Uv==null&&typeof document<"u"&&document.body){let e=document.body.style;Uv=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Uv||!1}const $x=Ue.define({combine(t){let e=Wo(t,{render:null,specialChars:pCe,addSpecialChars:null});return(e.replaceTabs=!gCe())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,T2)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,T2)),e}});function xCe(t={}){return[$x.of(t),yCe()]}let mR=null;function yCe(){return mR||(mR=nr.fromClass(class{constructor(t){this.view=t,this.decorations=ht.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet($x)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new hCe({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=xs(e[0],0);if(i==9){let o=s.lineAt(r),a=n.state.tabSize,l=$f(o.text,a,r-o.from);return ht.replace({widget:new kCe((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=ht.replace({widget:new wCe(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet($x);t.startState.facet($x)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const bCe="•";function vCe(t){return t>=32?bCe:t==10?"":String.fromCharCode(9216+t)}class wCe extends Ko{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=vCe(this.code),r=e.state.phrase("Control character")+" "+(mCe[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class kCe extends Ko{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function CCe(){return SCe}const _Ce=ht.line({class:"cm-activeLine"}),SCe=nr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(_Ce.range(s.from)),e=s.from)}return ht.set(n)}},{decorations:t=>t.decorations}),A2=2e3;function ECe(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>A2||n.off>A2||e.col<0||n.col<0){let o=Math.min(e.off,n.off),a=Math.max(e.off,n.off);for(let l=r;l<=s;l++){let c=t.doc.line(l);c.length<=a&&i.push(Ce.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,n.col),a=Math.max(e.col,n.col);for(let l=r;l<=s;l++){let c=t.doc.line(l),u=l2(c.text,o,t.tabSize,!0);if(u<0)i.push(Ce.cursor(c.to));else{let f=l2(c.text,a,t.tabSize);i.push(Ce.range(c.from+u,c.from+f))}}}return i}function NCe(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function gR(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),s=n-r.from,i=s>A2?-1:s==r.length?NCe(t,e.clientX):$f(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function TCe(t,e){let n=gR(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),o=s.state.doc.lineAt(i);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(s.changes)}},get(s,i,o){let a=gR(t,s);if(!a)return r;let l=ECe(t.state,n,a);return l.length?o?Ce.create(l.concat(r.ranges)):Ce.create(l):r}}:null}function ACe(t){let e=(n=>n.altKey&&n.button==0);return He.mouseSelectionStyle.of((n,r)=>e(r)?TCe(n,r):null)}const ICe={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},jCe={style:"cursor: crosshair"};function RCe(t={}){let[e,n]=ICe[t.key||"Alt"],r=nr.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||n(s))},keyup(s){(s.keyCode==e||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,He.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?jCe:null})]}const zg="-10000px";class SV{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let i=null;this.tooltipViews=this.tooltips.map(o=>i=r(o,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(l=>l);if(s===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=n?[]:null;for(let l=0;l<i.length;l++){let c=i[l],u=-1;if(c){for(let f=0;f<this.tooltips.length;f++){let h=this.tooltips[f];h&&h.create==c.create&&(u=f)}if(u<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let f=o[l]=this.tooltipViews[u];a&&(a[l]=n[u]),f.update&&f.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(a.forEach((l,c)=>n[c]=l),n.length=a.length),this.input=s,this.tooltips=i,this.tooltipViews=o,!0}}function MCe(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Wv=Ue.define({combine:t=>{var e,n,r;return{position:We.ios?"absolute":((e=t.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||MCe}}}),xR=new WeakMap,ME=nr.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Wv);this.position=e.position,this.parent=e.parent,this.classes=t.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 SV(t,PE,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.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 t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(Wv);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=zg,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(We.safari){let o=i.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=AE(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(Wv).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:u}=c,f=t.pos[a],h=t.size[a];if(!f||l.clip!==!1&&(f.bottom<=Math.max(n.top,r.top)||f.top>=Math.min(n.bottom,r.bottom)||f.right<Math.max(n.left,r.left)-.1||f.left>Math.min(n.right,r.right)+.1)){u.style.top=zg;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=p?7:0,g=h.right-h.left,y=(e=xR.get(c))!==null&&e!==void 0?e:h.bottom-h.top,v=c.offset||OCe,b=this.view.textDirection==mn.LTR,w=h.width>r.right-r.left?b?r.left:r.right-h.width:b?Math.max(r.left,Math.min(f.left-(p?14:0)+v.x,r.right-g)):Math.min(Math.max(r.left,f.left-g+(p?14:0)-v.x),r.right-g),k=this.above[a];!l.strictSide&&(k?f.top-y-m-v.y<r.top:f.bottom+y+m+v.y>r.bottom)&&k==r.bottom-f.bottom>f.top-r.top&&(k=this.above[a]=!k);let C=(k?f.top-r.top:r.bottom-f.bottom)-m;if(C<y&&c.resize!==!1){if(C<this.view.defaultLineHeight){u.style.top=zg;continue}xR.set(c,y),u.style.height=(y=C)/i+"px"}else u.style.height&&(u.style.height="");let _=k?f.top-y-m-v.y:f.bottom+m+v.y,S=w+g;if(c.overlap!==!0)for(let E of o)E.left<S&&E.right>w&&E.top<_+y&&E.bottom>_&&(_=k?E.top-y-2-m:E.bottom+m+2);if(this.position=="absolute"?(u.style.top=(_-t.parent.top)/i+"px",yR(u,(w-t.parent.left)/s)):(u.style.top=_/i+"px",yR(u,w/s)),p){let E=f.left+(b?v.x:-v.x)-(w+14-7);p.style.left=E/s+"px"}c.overlap!==!0&&o.push({left:w,top:_,right:S,bottom:_+y}),u.classList.toggle("cm-tooltip-above",k),u.classList.toggle("cm-tooltip-below",!k),c.positioned&&c.positioned(t.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 t of this.manager.tooltipViews)t.dom.style.top=zg}},{eventObservers:{scroll(){this.maybeMeasure()}}});function yR(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const PCe=He.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"}}}),OCe={x:0,y:0},PE=Ue.define({enables:[ME,PCe]}),gy=Ue.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class p1{static create(e){return new p1(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new SV(e,gy,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const LCe=PE.compute([gy],t=>{let e=t.facet(gy);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:p1.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class DCe{constructor(e,n,r,s,i){this.view=e,this.source=n,this.field=r,this.setHover=s,this.hoverTime=i,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(){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;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:n}=this,r=e.docView.tile.nearest(n.target);if(!r)return;let s,i=1;if(r.isWidget())s=r.posAtStart;else{if(s=e.posAtCoords(n),s==null)return;let a=e.coordsAtPos(s);if(!a||n.y<a.top||n.y>a.bottom||n.x<a.left-e.defaultCharacterWidth||n.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(s)).find(u=>u.from<=s&&u.to>=s),c=l&&l.dir==mn.RTL?-1:1;i=n.x<a.left?-c:c}let o=this.source(e,s,i);if(o!=null&&o.then){let a=this.pending={pos:s};o.then(l=>{this.pending==a&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>vs(e.state,l,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(ME),n=e?e.manager.tooltips.findIndex(r=>r.create==p1.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;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:i}=this;if(s.length&&i&&!FCe(i.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,a=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!$Ce(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Hg=4;function FCe(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();s=Math.min(a.top,s),i=Math.max(a.bottom,i)}return e.clientX>=n-Hg&&e.clientX<=r+Hg&&e.clientY>=s-Hg&&e.clientY<=i+Hg}function $Ce(t,e,n,r,s,i){let o=t.scrollDOM.getBoundingClientRect(),a=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.right<r||o.top>s||Math.min(o.bottom,a)<s)return!1;let l=t.posAtCoords({x:r,y:s},!1);return l>=e&&l<=n}function BCe(t,e={}){let n=yt.define(),r=vr.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(i,o))),i.docChanged)){let o=[];for(let a of s){let l=i.changes.mapPos(a.pos,-1,Ar.TrackDel);if(l!=null){let c=Object.assign(Object.create(null),a);c.pos=l,c.end!=null&&(c.end=i.changes.mapPos(c.end)),o.push(c)}}s=o}for(let o of i.effects)o.is(n)&&(s=o.value),o.is(VCe)&&(s=[]);return s},provide:s=>gy.from(s)});return{active:r,extension:[r,nr.define(s=>new DCe(s,t,r,n,e.hoverTime||300)),LCe]}}function EV(t,e){let n=t.plugin(ME);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const VCe=yt.define(),bR=Ue.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function OE(t,e){let n=t.plugin(NV),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const NV=nr.fromClass(class{constructor(t){this.input=t.state.facet(Op),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(bR);this.top=new Ug(t,!0,e.topContainer),this.bottom=new Ug(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(bR);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ug(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ug(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Op);if(n!=this.input){let r=n.filter(l=>l),s=[],i=[],o=[],a=[];for(let l of r){let c=this.specs.indexOf(l),u;c<0?(u=l(t.view),a.push(u)):(u=this.panels[c],u.update&&u.update(t)),s.push(u),(u.top?i:o).push(u)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>He.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Ug{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.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",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=vR(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=vR(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 vR(t){let e=t.nextSibling;return t.remove(),e}const Op=Ue.define({enables:NV});function zCe(t,e){let n,r=new Promise(o=>n=o),s=o=>HCe(o,e,n);t.state.field(Kv,!1)?t.dispatch({effects:TV.of(s)}):t.dispatch({effects:yt.appendConfig.of(Kv.init(()=>[s]))});let i=AV.of(s);return{close:i,result:r.then(o=>((t.win.queueMicrotask||(l=>t.win.setTimeout(l,10)))(()=>{t.state.field(Kv).indexOf(s)>-1&&t.dispatch({effects:i})}),o))}}const Kv=vr.define({create(){return[]},update(t,e){for(let n of e.effects)n.is(TV)?t=[n.value].concat(t):n.is(AV)&&(t=t.filter(r=>r!=n.value));return t},provide:t=>Op.computeN([t],e=>e.field(t))}),TV=yt.define(),AV=yt.define();function HCe(t,e,n){let r=e.content?e.content(t,()=>o(null)):null;if(!r){if(r=ln("form"),e.input){let a=ln("input",e.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),r.appendChild(ln("label",(e.label||"")+": ",a))}else r.appendChild(document.createTextNode(e.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(ln("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let s=r.nodeName=="FORM"?[r]:r.querySelectorAll("form");for(let a=0;a<s.length;a++){let l=s[a];l.addEventListener("keydown",c=>{c.keyCode==27?(c.preventDefault(),o(null)):c.keyCode==13&&(c.preventDefault(),o(l))}),l.addEventListener("submit",c=>{c.preventDefault(),o(l)})}let i=ln("div",r,ln("button",{onclick:()=>o(null),"aria-label":t.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(i.className=e.class),i.classList.add("cm-dialog");function o(a){i.contains(i.ownerDocument.activeElement)&&t.focus(),n(a)}return{dom:i,top:e.top,mount:()=>{if(e.focus){let a;typeof e.focus=="string"?a=r.querySelector(e.focus):a=r.querySelector("input")||r.querySelector("button"),a&&"select"in a?a.select():a&&"focus"in a&&a.focus()}}}}class Fa extends Hl{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Fa.prototype.elementClass="";Fa.prototype.toDOM=void 0;Fa.prototype.mapMode=Ar.TrackBefore;Fa.prototype.startSide=Fa.prototype.endSide=-1;Fa.prototype.point=!0;const Bx=Ue.define(),UCe=Ue.define(),WCe={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Pt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},qh=Ue.define();function KCe(t){return[IV(),qh.of({...WCe,...t})]}const wR=Ue.define({combine:t=>t.some(e=>e)});function IV(t){return[qCe]}const qCe=nr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.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=t.state.facet(qh).map(e=>new CR(t,e)),this.fixed=!t.state.facet(wR);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),t.scrollDOM.insertBefore(this.dom,t.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(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.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(wR)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=Pt.iter(this.view.state.facet(Bx),this.view.viewport.from),r=[],s=this.gutters.map(i=>new GCe(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let o=!0;for(let a of i.type)if(a.type==jr.Text&&o){I2(n,r,a.from);for(let l of s)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of s)l.widget(this.view,a)}else if(i.type==jr.Text){I2(n,r,i.from);for(let o of s)o.line(this.view,i,r)}else if(i.widget)for(let o of s)o.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(qh),n=t.state.facet(qh),r=t.docChanged||t.heightChanged||t.viewportChanged||!Pt.eq(t.startState.facet(Bx),t.state.facet(Bx),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let o=e.indexOf(i);o<0?s.push(new CR(this.view,i)):(this.gutters[o].update(t),s.push(this.gutters[o]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>He.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==mn.LTR?{left:r,right:s}:{right:r,left:s}})});function kR(t){return Array.isArray(t)?t:[t]}function I2(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class GCe{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Pt.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,o=n.height/e.scaleY;if(this.i==s.elements.length){let a=new jV(e,o,i,r);s.elements.push(a),s.dom.appendChild(a.dom)}else s.elements[this.i].update(e,o,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];I2(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(UCe)){let o=i(e,n.widget,n);o&&(s||(s=[])).push(o)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class CR{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,o;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let l=i.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=s.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[r](e,a,s)&&s.preventDefault()});this.markers=kR(n.markers(e)),n.initialSpacer&&(this.spacer=new jV(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=kR(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 r=e.view.viewport;return!Pt.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class jV{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),JCe(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,o=0;;){let a=o,l=i<n.length?n[i++]:null,c=!1;if(l){let u=l.elementClass;u&&(r+=" "+u);for(let f=o;f<this.markers.length;f++)if(this.markers[f].compare(l)){a=f,c=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM){u.destroy(s);let f=s.nextSibling;s.remove(),s=f}}if(!l)break;l.toDOM&&(c?s=s.nextSibling:this.dom.insertBefore(l.toDOM(e),s)),c&&o++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function JCe(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const ZCe=Ue.define(),QCe=Ue.define(),gd=Ue.define({combine(t){return Wo(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let s in n){let i=r[s],o=n[s];r[s]=i?(a,l,c)=>i(a,l,c)||o(a,l,c):o}return r}})}});class qv extends Fa{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Gv(t,e){return t.state.facet(gd).formatNumber(e,t.state)}const YCe=qh.compute([gd],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(ZCe)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new qv(Gv(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(QCe)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(gd)!=e.state.facet(gd),initialSpacer(e){return new qv(Gv(e,_R(e.state.doc.lines)))},updateSpacer(e,n){let r=Gv(n.view,_R(n.view.state.doc.lines));return r==e.number?e:new qv(r)},domEventHandlers:t.facet(gd).domEventHandlers,side:"before"}));function RV(t={}){return[gd.of(t),IV(),YCe]}function _R(t){let e=9;for(;e<t;)e=e*10+9;return e}const XCe=new class extends Fa{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},e2e=Bx.compute(["selection"],t=>{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(XCe.range(s)))}return Pt.of(e)});function t2e(){return e2e}const n2e=1024;let r2e=0,ti=class{constructor(e,n){this.from=e,this.to=n}};class jt{constructor(e={}){this.id=r2e++,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=ls.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}jt.closedBy=new jt({deserialize:t=>t.split(" ")});jt.openedBy=new jt({deserialize:t=>t.split(" ")});jt.group=new jt({deserialize:t=>t.split(" ")});jt.isolate=new jt({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});jt.contextHash=new jt({perNode:!0});jt.lookAhead=new jt({perNode:!0});jt.mounted=new jt({perNode:!0});class jd{constructor(e,n,r,s=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=s}static get(e){return e&&e.props&&e.props[jt.mounted.id]}}const s2e=Object.create(null);class ls{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):s2e,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new ls(e.name||"",n,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[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 n=this.prop(jt.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(jt.group),i=-1;i<(s?s.length:0);i++){let o=n[i<0?r.name:s[i]];if(o)return o}}}}ls.none=new ls("",Object.create(null),0,8);class LE{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let s=null;for(let i of e){let o=i(r);if(o){s||(s=Object.assign({},r.props));let a=o[1],l=o[0];l.combine&&l.id in s&&(a=l.combine(s[l.id],a)),s[l.id]=a}}n.push(s?new ls(r.name,s,r.id,r.flags):r)}return new LE(n)}}const Wg=new WeakMap,SR=new WeakMap;var pn;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(pn||(pn={}));class gn{constructor(e,n,r,s,i){if(this.type=e,this.children=n,this.positions=r,this.length=s,this.props=null,i&&i.length){this.props=Object.create(null);for(let[o,a]of i)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=jd.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let s=r.toString();s&&(n&&(n+=","),n+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new xy(this.topNode,e)}cursorAt(e,n=0,r=0){let s=Wg.get(this)||this.topNode,i=new xy(s);return i.moveTo(e,n),Wg.set(this,i._tree),i}get topNode(){return new Hr(this,0,0,null)}resolve(e,n=0){let r=Lp(Wg.get(this)||this.topNode,e,n,!1);return Wg.set(this,r),r}resolveInner(e,n=0){let r=Lp(SR.get(this)||this.topNode,e,n,!0);return SR.set(this,r),r}resolveStack(e,n=0){return a2e(this,e,n)}iterate(e){let{enter:n,leave:r,from:s=0,to:i=this.length}=e,o=e.mode||0,a=(o&pn.IncludeAnonymous)>0;for(let l=this.cursor(o|pn.IncludeAnonymous);;){let c=!1;if(l.from<=i&&l.to>=s&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!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 n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:$E(ls.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new gn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new gn(ls.none,n,r,s)))}static build(e){return l2e(e)}}gn.empty=new gn(ls.none,[],[],0);class DE{constructor(e,n){this.buffer=e,this.index=n}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 DE(this.buffer,this.index)}}class ql{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return ls.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],s=this.set.types[n],i=s.name;if(/\W/.test(i)&&!s.isError&&(i=JSON.stringify(i)),e+=4,r==e)return i;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return i+"("+o.join(",")+")"}findChild(e,n,r,s,i){let{buffer:o}=this,a=-1;for(let l=e;l!=n&&!(MV(i,s,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),o=0;for(let a=e,l=0;a<n;){i[l++]=s[a++],i[l++]=s[a++]-r;let c=i[l++]=s[a++]-r;i[l++]=s[a++]-e,o=Math.max(o,c)}return new ql(i,o,this.set)}}function MV(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Lp(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof Hr&&t.index<0?null:t.parent;if(!o)return t;t=o}let i=r?0:pn.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof Hr&&o.index<0&&((s=a.enter(e,n,i))===null||s===void 0?void 0:s.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,n,i);if(!o)return t;t=o}}class PV{cursor(e=0){return new xy(this,e)}getChild(e,n=null,r=null){let s=ER(this,e,n,r);return s.length?s[0]:null}getChildren(e,n=null,r=null){return ER(this,e,n,r)}resolve(e,n=0){return Lp(this,e,n,!1)}resolveInner(e,n=0){return Lp(this,e,n,!0)}matchContext(e){return j2(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let s=n.lastChild;if(!s||s.to!=n.to)break;s.type.isError&&s.from==s.to?(r=n,n=s.prevSibling):n=s}return r}get node(){return this}get next(){return this.parent}}class Hr extends PV{constructor(e,n,r,s){super(),this._tree=e,this.from=n,this.index=r,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,s,i=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=n>0?a.length:-1;e!=c;e+=n){let u=a[e],f=l[e]+o.from,h;if(!(!(i&pn.EnterBracketed&&u instanceof gn&&(h=jd.get(u))&&!h.overlay&&h.bracketed&&r>=f&&r<=f+u.length)&&!MV(s,r,f,f+u.length))){if(u instanceof ql){if(i&pn.ExcludeBuffers)continue;let p=u.findChild(0,u.buffer.length,n,r-f,s);if(p>-1)return new Eo(new i2e(o,u,e,f),null,p)}else if(i&pn.IncludeAnonymous||!u.type.isAnonymous||FE(u)){let p;if(!(i&pn.IgnoreMounts)&&(p=jd.get(u))&&!p.overlay)return new Hr(p.tree,f,e,o);let m=new Hr(u,f,e,o);return i&pn.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(n<0?u.children.length-1:0,n,r,s,i)}}}if(i&pn.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))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,n,r=0){let s;if(!(r&pn.IgnoreOverlays)&&(s=jd.get(this._tree))&&s.overlay){let i=e-this.from,o=r&pn.EnterBracketed&&s.bracketed;for(let{from:a,to:l}of s.overlay)if((n>0||o?a<=i:a<i)&&(n<0||o?l>=i:l>i))return new Hr(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}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 ER(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let o=!1;!o;)if(o=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function j2(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class i2e{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class Eo extends PV{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,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return i<0?null:new Eo(this.context,this,i)}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,n,r=0){if(r&pn.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new Eo(this.context,this,i)}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,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Eo(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Eo(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let o=r.buffer[this.index+1];e.push(r.slice(s,i,o)),n.push(0)}return new gn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function OV(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;i<t.length;i++){let o=t[i];(o.from>n.from||o.to<n.to)&&(n=o,e=i)}let r=n instanceof Hr&&n.index<0?null:n.parent,s=t.slice();return r?s[e]=r:s.splice(e,1),new o2e(s,n)}class o2e{constructor(e,n){this.heads=e,this.node=n}get next(){return OV(this.heads)}}function a2e(t,e,n){let r=t.resolveInner(e,n),s=null;for(let i=r instanceof Hr?r:r.context.parent;i;i=i.parent)if(i.index<0){let o=i.parent;(s||(s=[r])).push(o.resolve(e,n)),i=o}else{let o=jd.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Hr(o.tree,o.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(Lp(a,e,n,!1))}}return s?OV(s):r}class xy{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~pn.EnterBracketed,e instanceof Hr)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.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,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof Hr?(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,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}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,n,r=this.mode){return this.buffer?r&pn.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&pn.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&pn.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:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<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 n,r,{buffer:s}=this;if(s){if(e>0){if(this.index<s.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(s.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:r}=s)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let i=n+e,o=e<0?-1:r._tree.children.length;i!=o;i+=e){let a=r._tree.children[i];if(this.mode&pn.IncludeAnonymous||a instanceof ql||!a.type.isAnonymous||FE(a))return!1}return!0}move(e,n){if(n&&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,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let s=this.index,i=this.stack.length;i>=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;n=o,r=i+1;break e}s=this.stack[--i]}for(let s=r;s<this.stack.length;s++)n=new Eo(this.buffer,n,this.stack[s]);return this.bufferNode=new Eo(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let s=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&n&&n(this),s=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,s=!0}}}matchContext(e){if(!this.buffer)return j2(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let s=e.length-1,i=this.stack.length-1;s>=0;i--){if(i<0)return j2(this._tree,e,s);let o=r[n.buffer[this.stack[i]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function FE(t){return t.children.some(e=>e instanceof ql||!e.type.isAnonymous||FE(e))}function l2e(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=n2e,reused:i=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(n)?new DE(n,n.length):n,l=r.types,c=0,u=0;function f(C,_,S,E,N,T){let{id:O,start:L,end:I,size:M}=a,V=u,G=c;if(M<0)if(a.next(),M==-1){let U=i[O];S.push(U),E.push(L-C);return}else if(M==-3){c=O;return}else if(M==-4){u=O;return}else throw new RangeError(`Unrecognized record size: ${M}`);let D=l[O],B,F,R=L-C;if(I-L<=s&&(F=y(a.pos-_,N))){let U=new Uint16Array(F.size-F.skip),J=a.pos-F.size,P=U.length;for(;a.pos>J;)P=v(F.start,U,P);B=new ql(U,I-F.start,r),R=F.start-C}else{let U=a.pos-M;a.next();let J=[],P=[],ie=O>=o?O:-1,ge=0,ae=I;for(;a.pos>U;)ie>=0&&a.id==ie&&a.size>=0?(a.end<=ae-s&&(m(J,P,L,ge,a.end,ae,ie,V,G),ge=J.length,ae=a.end),a.next()):T>2500?h(L,U,J,P):f(L,U,J,P,ie,T+1);if(ie>=0&&ge>0&&ge<J.length&&m(J,P,L,ge,L,ae,ie,V,G),J.reverse(),P.reverse(),ie>-1&&ge>0){let Y=p(D,G);B=$E(D,J,P,0,J.length,0,I-L,Y,Y)}else B=g(D,J,P,I-L,V-I,G)}S.push(B),E.push(R)}function h(C,_,S,E){let N=[],T=0,O=-1;for(;a.pos>_;){let{id:L,start:I,end:M,size:V}=a;if(V>4)a.next();else{if(O>-1&&I<O)break;O<0&&(O=M-s),N.push(L,I,M),T++,a.next()}}if(T){let L=new Uint16Array(T*4),I=N[N.length-2];for(let M=N.length-3,V=0;M>=0;M-=3)L[V++]=N[M],L[V++]=N[M+1]-I,L[V++]=N[M+2]-I,L[V++]=V;S.push(new ql(L,N[2]-I,r)),E.push(I-C)}}function p(C,_){return(S,E,N)=>{let T=0,O=S.length-1,L,I;if(O>=0&&(L=S[O])instanceof gn){if(!O&&L.type==C&&L.length==N)return L;(I=L.prop(jt.lookAhead))&&(T=E[O]+L.length+I)}return g(C,S,E,N,T,_)}}function m(C,_,S,E,N,T,O,L,I){let M=[],V=[];for(;C.length>E;)M.push(C.pop()),V.push(_.pop()+S-N);C.push(g(r.types[O],M,V,T-N,L-T,I)),_.push(N-S)}function g(C,_,S,E,N,T,O){if(T){let L=[jt.contextHash,T];O=O?[L].concat(O):[L]}if(N>25){let L=[jt.lookAhead,N];O=O?[L].concat(O):[L]}return new gn(C,_,S,E,O)}function y(C,_){let S=a.fork(),E=0,N=0,T=0,O=S.end-s,L={size:0,start:0,skip:0};e:for(let I=S.pos-C;S.pos>I;){let M=S.size;if(S.id==_&&M>=0){L.size=E,L.start=N,L.skip=T,T+=4,E+=4,S.next();continue}let V=S.pos-M;if(M<0||V<I||S.start<O)break;let G=S.id>=o?4:0,D=S.start;for(S.next();S.pos>V;){if(S.size<0)if(S.size==-3||S.size==-4)G+=4;else break e;else S.id>=o&&(G+=4);S.next()}N=D,E+=M,T+=G}return(_<0||E==C)&&(L.size=E,L.start=N,L.skip=T),L.size>4?L:void 0}function v(C,_,S){let{id:E,start:N,end:T,size:O}=a;if(a.next(),O>=0&&E<o){let L=S;if(O>4){let I=a.pos-(O-4);for(;a.pos>I;)S=v(C,_,S)}_[--S]=L,_[--S]=T-C,_[--S]=N-C,_[--S]=E}else O==-3?c=E:O==-4&&(u=E);return S}let b=[],w=[];for(;a.pos>0;)f(t.start||0,t.bufferStart||0,b,w,-1,0);let k=(e=t.length)!==null&&e!==void 0?e:b.length?w[0]+b[0].length:0;return new gn(l[t.topID],b.reverse(),w.reverse(),k)}const NR=new WeakMap;function Vx(t,e){if(!t.isAnonymous||e instanceof ql||e.type!=t)return 1;let n=NR.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof gn)){n=1;break}n+=Vx(t,r)}NR.set(e,n)}return n}function $E(t,e,n,r,s,i,o,a,l){let c=0;for(let m=r;m<s;m++)c+=Vx(t,e[m]);let u=Math.ceil(c*1.5/8),f=[],h=[];function p(m,g,y,v,b){for(let w=y;w<v;){let k=w,C=g[w],_=Vx(t,m[w]);for(w++;w<v;w++){let S=Vx(t,m[w]);if(_+S>=u)break;_+=S}if(w==k+1){if(_>u){let S=m[k];p(S.children,S.positions,0,S.children.length,g[k]+b);continue}f.push(m[k])}else{let S=g[w-1]+m[w-1].length-C;f.push($E(t,m,g,k,w,C,S,null,l))}h.push(C+b-i)}}return p(e,n,r,s,0),(a||l)(f,h,o)}class RMe{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof Eo?this.setBuffer(e.context.buffer,e.index,n):e instanceof Hr&&this.map.set(e.tree,n)}get(e){return e instanceof Eo?this.getBuffer(e.context.buffer,e.index):e instanceof Hr?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Sa{constructor(e,n,r,s,i=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new Sa(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<n.length?n[a]:null,f=u?u.fromA:1e9;if(f-l>=r)for(;o&&o.from<f;){let h=o;if(l>=h.from||f<=h.to||c){let p=Math.max(h.from,l)-c,m=Math.min(h.to,f)-c;h=p>=m?null:new Sa(p,m,h.tree,h.offset+c,a>0,!!u)}if(h&&s.push(h),o.to>f)break;o=i<e.length?e[i++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return s}}class LV{startParse(e,n,r){return typeof e=="string"&&(e=new c2e(e)),r=r?r.length?r.map(s=>new ti(s.from,s.to)):[new ti(0,0)]:[new ti(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let i=s.advance();if(i)return i}}}class c2e{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}function MMe(t){return(e,n,r,s)=>new d2e(e,t,n,r,s)}class TR{constructor(e,n,r,s,i,o){this.parser=e,this.parse=n,this.overlay=r,this.bracketed=s,this.target=i,this.from=o}}function AR(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class u2e{constructor(e,n,r,s,i,o,a,l){this.parser=e,this.predicate=n,this.mounts=r,this.index=s,this.start=i,this.bracketed=o,this.target=a,this.prev=l,this.depth=0,this.ranges=[]}}const R2=new jt({perNode:!0});class d2e{constructor(e,n,r,s,i){this.nest=n,this.input=r,this.fragments=s,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let s of this.inner)s.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new gn(r.type,r.children,r.positions,r.length,r.propValues.concat([[R2,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],n=e.parse.advance();if(n){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[jt.mounted.id]=new jd(n,e.overlay,e.parser,e.bracketed),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].from<e&&(e=Math.min(e,this.inner[n].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].parse.stopAt(e)}startInner(){let e=new p2e(this.fragments),n=null,r=null,s=new xy(new Hr(this.baseTree,this.ranges[0].from,0,null),pn.IncludeAnonymous|pn.IgnoreMounts);e:for(let i,o;;){let a=!0,l;if(this.stoppedAt!=null&&s.from>=this.stoppedAt)a=!1;else if(e.hasNode(s)){if(n){let c=n.mounts.find(u=>u.frag.from<=s.from&&u.frag.to>=s.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let f=u.from+c.pos,h=u.to+c.pos;f>=s.from&&h<=s.to&&!n.ranges.some(p=>p.from<h&&p.to>f)&&n.ranges.push({from:f,to:h})}}a=!1}else if(r&&(o=f2e(r.ranges,s.from,s.to)))a=o!=2;else if(!s.type.isAnonymous&&(i=this.nest(s,this.input))&&(s.from<s.to||!i.overlay)){s.tree||(h2e(s),n&&n.depth++,r&&r.depth++);let c=e.findMounts(s.from,i.parser);if(typeof i.overlay=="function")n=new u2e(i.parser,i.overlay,c,this.inner.length,s.from,!!i.bracketed,s.tree,n);else{let u=RR(this.ranges,i.overlay||(s.from<s.to?[new ti(s.from,s.to)]:[]));u.length&&AR(u),(u.length||!i.overlay)&&this.inner.push(new TR(i.parser,u.length?i.parser.startParse(this.input,MR(c,u),u):i.parser.startParse(""),i.overlay?i.overlay.map(f=>new ti(f.from-s.from,f.to-s.from)):null,!!i.bracketed,s.tree,u.length?u[0].from:s.from)),i.overlay?u.length&&(r={ranges:u,depth:0,prev:r}):a=!1}}else if(n&&(l=n.predicate(s))&&(l===!0&&(l=new ti(s.from,s.to)),l.from<l.to)){let c=n.ranges.length-1;c>=0&&n.ranges[c].to==l.from?n.ranges[c]={from:n.ranges[c].from,to:l.to}:n.ranges.push(l)}if(a&&s.firstChild())n&&n.depth++,r&&r.depth++;else for(;!s.nextSibling();){if(!s.parent())break e;if(n&&!--n.depth){let c=RR(this.ranges,n.ranges);c.length&&(AR(c),this.inner.splice(n.index,0,new TR(n.parser,n.parser.startParse(this.input,MR(n.mounts,c),c),n.ranges.map(u=>new ti(u.from-n.start,u.to-n.start)),n.bracketed,n.target,c[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function f2e(t,e,n){for(let r of t){if(r.from>=n)break;if(r.to>e)return r.from<=e&&r.to>=n?2:1}return 0}function IR(t,e,n,r,s,i){if(e<n){let o=t.buffer[e+1];r.push(t.slice(e,n,o)),s.push(o-i)}}function h2e(t){let{node:e}=t,n=[],r=e.context.buffer;do n.push(t.index),t.parent();while(!t.tree);let s=t.tree,i=s.children.indexOf(r),o=s.children[i],a=o.buffer,l=[i];function c(u,f,h,p,m,g){let y=n[g],v=[],b=[];IR(o,u,y,v,b,p);let w=a[y+1],k=a[y+2];l.push(v.length);let C=g?c(y+4,a[y+3],o.set.types[a[y]],w,k-w,g-1):e.toTree();return v.push(C),b.push(w-p),IR(o,a[y+3],f,v,b,p),new gn(h,v,b,m)}s.children[i]=c(0,a.length,ls.none,0,o.length,n.length-1);for(let u of l){let f=t.tree.children[u],h=t.tree.positions[u];t.yield(new Hr(f,h+t.from,u,t._tree))}}class jR{constructor(e,n){this.offset=n,this.done=!1,this.cursor=e.cursor(pn.IncludeAnonymous|pn.IgnoreMounts)}moveTo(e){let{cursor:n}=this,r=e-this.offset;for(;!this.done&&n.from<r;)n.to>=e&&n.enter(r,1,pn.IgnoreOverlays|pn.ExcludeBuffers)||n.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==e.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof gn)n=n.children[0];else break}return!1}}class p2e{constructor(e){var n;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(n=r.tree.prop(R2))!==null&&n!==void 0?n:r.to,this.inner=new jR(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let n=this.curFrag=this.fragments[this.fragI];this.curTo=(e=n.tree.prop(R2))!==null&&e!==void 0?e:n.to,this.inner=new jR(n.tree,-n.offset)}}findMounts(e,n){var r;let s=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let i=this.inner.cursor.node;i;i=i.parent){let o=(r=i.tree)===null||r===void 0?void 0:r.prop(jt.mounted);if(o&&o.parser==n)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=i.to)break;l.tree==this.curFrag.tree&&s.push({frag:l,pos:i.from-l.offset,mount:o})}}}return s}}function RR(t,e){let n=null,r=e;for(let s=1,i=0;s<t.length;s++){let o=t[s-1].to,a=t[s].from;for(;i<r.length;i++){let l=r[i];if(l.from>=a)break;l.to<=o||(n||(r=n=e.slice()),l.from<o?(n[i]=new ti(l.from,o),l.to>a&&n.splice(i+1,0,new ti(a,l.to))):l.to>a?n[i--]=new ti(a,l.to):n.splice(i--,1))}}return r}function m2e(t,e,n,r){let s=0,i=0,o=!1,a=!1,l=-1e9,c=[];for(;;){let u=s==t.length?1e9:o?t[s].to:t[s].from,f=i==e.length?1e9:a?e[i].to:e[i].from;if(o!=a){let h=Math.max(l,n),p=Math.min(u,f,r);h<p&&c.push(new ti(h,p))}if(l=Math.min(u,f),l==1e9)break;u==l&&(o?(o=!1,s++):o=!0),f==l&&(a?(a=!1,i++):a=!0)}return c}function MR(t,e){let n=[];for(let{pos:r,mount:s,frag:i}of t){let o=r+(s.overlay?s.overlay[0].from:0),a=o+s.tree.length,l=Math.max(i.from,o),c=Math.min(i.to,a);if(s.overlay){let u=s.overlay.map(h=>new ti(h.from+r,h.to+r)),f=m2e(e,u,l,c);for(let h=0,p=l;;h++){let m=h==f.length,g=m?c:f[h].from;if(g>p&&n.push(new Sa(p,g,s.tree,-o,i.from>=p||i.openStart,i.to<=g||i.openEnd)),m)break;p=f[h].to}}else n.push(new Sa(l,c,s.tree,-o,i.from>=o||i.openStart,i.to<=a||i.openEnd))}return n}let g2e=0;class Qs{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=g2e++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof Qs&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let s=new Qs(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(e){let n=new yy(e);return r=>r.modified.indexOf(n)>-1?r:yy.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let x2e=0;class yy{constructor(e){this.name=e,this.instances=[],this.id=x2e++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&y2e(n,a.modified));if(r)return r;let s=[],i=new Qs(e.name,s,e,n);for(let a of n)a.instances.push(i);let o=b2e(n);for(let a of e.set)if(!a.modified.length)for(let l of o)s.push(yy.get(a,l));return i}}function y2e(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function b2e(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,s=e.length;r<s;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function v2e(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],o=2,a=s;for(let f=0;;){if(a=="..."&&f>0&&f+3==s.length){o=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!h)throw new RangeError("Invalid path: "+s);if(i.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),f+=h[0].length,f==s.length)break;let p=s[f++];if(f==s.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+s);a=s.slice(f)}let l=i.length-1,c=i[l];if(!c)throw new RangeError("Invalid path: "+s);let u=new Dp(r,o,l>0?i.slice(0,l):null);e[c]=u.sort(e[c])}}return DV.add(e)}const DV=new jt({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new Dp(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Dp{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Dp.empty=new Dp([],2,null);function FV(t,e){let n=Object.create(null);for(let i of t)if(!Array.isArray(i.tag))n[i.tag.id]=i.class;else for(let o of i.tag)n[o.id]=i.class;let{scope:r,all:s=null}=e||{};return{style:i=>{let o=s;for(let a of i)for(let l of a.set){let c=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function w2e(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function k2e(t,e,n,r=0,s=t.length){let i=new C2e(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class C2e{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:o,from:a,to:l}=e;if(a>=r||l<=n)return;o.isTop&&(i=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=s,u=_2e(e)||Dp.empty,f=w2e(i,u.tags);if(f&&(c&&(c+=" "),c+=f,u.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(n,a),c),u.opaque)return;let h=e.tree&&e.tree.prop(jt.mounted);if(h&&h.overlay){let p=e.node.enter(h.overlay[0].from+a,1),m=this.highlighters.filter(y=>!y.scope||y.scope(h.tree.type)),g=e.firstChild();for(let y=0,v=a;;y++){let b=y<h.overlay.length?h.overlay[y]:null,w=b?b.from+a:l,k=Math.max(n,v),C=Math.min(r,w);if(k<C&&g)for(;e.from<C&&(this.highlightRange(e,k,C,s,i),this.startSpan(Math.min(C,e.to),c),!(e.to>=w||!e.nextSibling())););if(!b||w>r)break;v=b.to+a,v>n&&(this.highlightRange(p.cursor(),Math.max(n,b.from+a),Math.min(r,v),"",m),this.startSpan(Math.min(r,v),c))}g&&e.parent()}else if(e.firstChild()){h&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function _2e(t){let e=t.type.prop(DV);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const De=Qs.define,Kg=De(),al=De(),PR=De(al),OR=De(al),ll=De(),qg=De(ll),Jv=De(ll),co=De(),xc=De(co),ao=De(),lo=De(),M2=De(),ih=De(M2),Gg=De(),pe={comment:Kg,lineComment:De(Kg),blockComment:De(Kg),docComment:De(Kg),name:al,variableName:De(al),typeName:PR,tagName:De(PR),propertyName:OR,attributeName:De(OR),className:De(al),labelName:De(al),namespace:De(al),macroName:De(al),literal:ll,string:qg,docString:De(qg),character:De(qg),attributeValue:De(qg),number:Jv,integer:De(Jv),float:De(Jv),bool:De(ll),regexp:De(ll),escape:De(ll),color:De(ll),url:De(ll),keyword:ao,self:De(ao),null:De(ao),atom:De(ao),unit:De(ao),modifier:De(ao),operatorKeyword:De(ao),controlKeyword:De(ao),definitionKeyword:De(ao),moduleKeyword:De(ao),operator:lo,derefOperator:De(lo),arithmeticOperator:De(lo),logicOperator:De(lo),bitwiseOperator:De(lo),compareOperator:De(lo),updateOperator:De(lo),definitionOperator:De(lo),typeOperator:De(lo),controlOperator:De(lo),punctuation:M2,separator:De(M2),bracket:ih,angleBracket:De(ih),squareBracket:De(ih),paren:De(ih),brace:De(ih),content:co,heading:xc,heading1:De(xc),heading2:De(xc),heading3:De(xc),heading4:De(xc),heading5:De(xc),heading6:De(xc),contentSeparator:De(co),list:De(co),quote:De(co),emphasis:De(co),strong:De(co),link:De(co),monospace:De(co),strikethrough:De(co),inserted:De(),deleted:De(),changed:De(),invalid:De(),meta:Gg,documentMeta:De(Gg),annotation:De(Gg),processingInstruction:De(Gg),definition:Qs.defineModifier("definition"),constant:Qs.defineModifier("constant"),function:Qs.defineModifier("function"),standard:Qs.defineModifier("standard"),local:Qs.defineModifier("local"),special:Qs.defineModifier("special")};for(let t in pe){let e=pe[t];e instanceof Qs&&(e.name=t)}FV([{tag:pe.link,class:"tok-link"},{tag:pe.heading,class:"tok-heading"},{tag:pe.emphasis,class:"tok-emphasis"},{tag:pe.strong,class:"tok-strong"},{tag:pe.keyword,class:"tok-keyword"},{tag:pe.atom,class:"tok-atom"},{tag:pe.bool,class:"tok-bool"},{tag:pe.url,class:"tok-url"},{tag:pe.labelName,class:"tok-labelName"},{tag:pe.inserted,class:"tok-inserted"},{tag:pe.deleted,class:"tok-deleted"},{tag:pe.literal,class:"tok-literal"},{tag:pe.string,class:"tok-string"},{tag:pe.number,class:"tok-number"},{tag:[pe.regexp,pe.escape,pe.special(pe.string)],class:"tok-string2"},{tag:pe.variableName,class:"tok-variableName"},{tag:pe.local(pe.variableName),class:"tok-variableName tok-local"},{tag:pe.definition(pe.variableName),class:"tok-variableName tok-definition"},{tag:pe.special(pe.variableName),class:"tok-variableName2"},{tag:pe.definition(pe.propertyName),class:"tok-propertyName tok-definition"},{tag:pe.typeName,class:"tok-typeName"},{tag:pe.namespace,class:"tok-namespace"},{tag:pe.className,class:"tok-className"},{tag:pe.macroName,class:"tok-macroName"},{tag:pe.propertyName,class:"tok-propertyName"},{tag:pe.operator,class:"tok-operator"},{tag:pe.comment,class:"tok-comment"},{tag:pe.meta,class:"tok-meta"},{tag:pe.invalid,class:"tok-invalid"},{tag:pe.punctuation,class:"tok-punctuation"}]);var Zv;const jc=new jt;function $V(t){return Ue.define({combine:t?e=>e.concat(t):void 0})}const S2e=new jt;class ni{constructor(e,n,r=[],s=""){this.data=e,this.name=s,Vt.prototype.hasOwnProperty("tree")||Object.defineProperty(Vt.prototype,"tree",{get(){return Rr(this)}}),this.parser=n,this.extension=[Gl.of(this),Vt.languageData.of((i,o,a)=>{let l=LR(i,o,a),c=l.type.prop(jc);if(!c)return[];let u=i.facet(c),f=l.type.prop(S2e);if(f){let h=l.resolve(o-l.from,a);for(let p of f)if(p.test(h,i)){let m=i.facet(p.facet);return p.type=="replace"?m:m.concat(u)}}return u})].concat(r)}isActiveAt(e,n,r=-1){return LR(e,n,r).type.prop(jc)==this.data}findRegions(e){let n=e.facet(Gl);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,o)=>{if(i.prop(jc)==this.data){r.push({from:o,to:o+i.length});return}let a=i.prop(jt.mounted);if(a){if(a.tree.prop(jc)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+i.length});return}else if(a.overlay){let l=r.length;if(s(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<i.children.length;l++){let c=i.children[l];c instanceof gn&&s(c,i.positions[l]+o)}};return s(Rr(e),0),r}get allowsNesting(){return!0}}ni.setState=yt.define();function LR(t,e,n){let r=t.facet(Gl),s=Rr(t).topNode;if(!r||r.allowsNesting)for(let i=s;i;i=i.enter(e,n,pn.ExcludeBuffers|pn.EnterBracketed))i.type.isTop&&(s=i);return s}class P2 extends ni{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=$V(e.languageData);return new P2(n,e.parser.configure({props:[jc.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new P2(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Rr(t){let e=t.field(ni.state,!1);return e?e.tree:gn.empty}class E2e{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let oh=null;class hf{constructor(e,n,r=[],s,i,o,a,l){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new hf(e,n,[],gn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new E2e(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=gn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(Sa.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(Sa.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=oh;oh=this;try{return e()}finally{oh=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=DR(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,f,h)=>l.push({fromA:c,toA:u,fromB:f,toB:h})),r=Sa.applyChanges(r,l),s=gn.empty,i=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),f=e.mapPos(c.to,-1);u<f&&a.push({from:u,to:f})}}}return new hf(this.parser,n,r,s,i,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:s,to:i}=this.skipped[r];s<e.to&&i>e.from&&(this.fragments=DR(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends LV{createParse(n,r,s){let i=s[0].from,o=s[s.length-1].to;return{parsedPos:i,advance(){let l=oh;if(l){for(let c of s)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new gn(ls.none,[],[],o-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return oh}}function DR(t,e,n){return Sa.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class pf{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new pf(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=hf.create(e.facet(Gl).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new pf(r)}}ni.state=vr.define({create:pf.init,update(t,e){for(let n of e.effects)if(n.is(ni.setState))return n.value;return e.startState.facet(Gl)!=e.state.facet(Gl)?pf.init(e.state):t.apply(e)}});let BV=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(BV=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Qv=typeof navigator<"u"&&(!((Zv=navigator.scheduling)===null||Zv===void 0)&&Zv.isInputPending)?()=>navigator.scheduling.isInputPending():null,N2e=nr.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 n=this.view.state.field(ni.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(ni.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=BV(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:s}}=this.view,i=r.field(ni.state);if(i.tree==i.context.tree&&i.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Qv?Math.max(25,e.timeRemaining()-5):1e9),a=i.context.treeLen<s&&r.doc.length>s+1e3,l=i.context.work(()=>Qv&&Qv()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:ni.setState.of(new pf(i.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>vs(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Gl=Ue.define({combine(t){return t.length?t[0]:null},enables:t=>[ni.state,N2e,He.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class T2e{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}class ue{constructor(e,n,r,s,i,o=void 0){this.name=e,this.alias=n,this.extensions=r,this.filename=s,this.loadFunc=i,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:n,support:r}=e;if(!n){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");n=()=>Promise.resolve(r)}return new ue(e.name,(e.alias||[]).concat(e.name).map(s=>s.toLowerCase()),e.extensions||[],e.filename,n,r)}static matchFilename(e,n){for(let s of e)if(s.filename&&s.filename.test(n))return s;let r=/\.([^.]+)$/.exec(n);if(r){for(let s of e)if(s.extensions.indexOf(r[1])>-1)return s}return null}static matchLanguageName(e,n,r=!0){n=n.toLowerCase();for(let s of e)if(s.alias.some(i=>i==n))return s;if(r)for(let s of e)for(let i of s.alias){let o=n.indexOf(i);if(o>-1&&(i.length>2||!/\w/.test(n[o-1])&&!/\w/.test(n[o+i.length])))return s}return null}}const A2e=Ue.define(),m1=Ue.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function wu(t){let e=t.facet(m1);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Fp(t,e){let n="",r=t.tabSize,s=t.facet(m1)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i<e;i++)n+=s;return n}function BE(t,e){t instanceof Vt&&(t=new g1(t));for(let r of t.state.facet(A2e)){let s=r(t,e);if(s!==void 0)return s}let n=Rr(t.state);return n.length>=e?I2e(t,n,e):null}class g1{constructor(e,n={}){this.state=e,this.options=n,this.unit=wu(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s<e:s<=e)?{text:r.text.slice(s-r.from),from:s}:{text:r.text.slice(0,s-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:s}=this.lineAt(e,n);return r.slice(e-s,Math.min(r.length,e+100-s))}column(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.countColumn(r,e-s),o=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return o>-1&&(i+=o-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return $f(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let o=i(s);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const VV=new jt;function I2e(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let o=s;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)i.push(o);for(let o=i.length-1;o>=0;o--)r={node:i[o],next:r}}return zV(r,t,n)}function zV(t,e,n){for(let r=t;r;r=r.next){let s=R2e(r.node);if(s)return s(VE.create(e,n,r))}return 0}function j2e(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function R2e(t){let e=t.type.prop(VV);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(jt.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return o=>HV(o,!0,1,void 0,i&&!j2e(o)?s.from:void 0)}return t.parent==null?M2e:null}function M2e(){return 0}class VE extends g1{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new VE(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(P2e(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return zV(this.context.next,this.base,this.pos)}}function P2e(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function O2e(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),o=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let a=n.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+c}}a=l.to}}function OMe({closing:t,align:e=!0,units:n=1}){return r=>HV(r,e,n,t)}function HV(t,e,n,r,s){let i=t.textAfter,o=i.match(/^\s*/)[0].length,a=r&&i.slice(o,o+r.length)==r||s==t.pos+o,l=e?O2e(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*n)}const LMe=t=>t.baseIndent;function DMe({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const L2e=200;function D2e(){return Vt.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,s=n.lineAt(r);if(r>s.from+L2e)return t;let i=n.sliceString(s.from,r);if(!e.some(c=>c.test(i)))return t;let{state:o}=t,a=-1,l=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==a)continue;a=u.from;let f=BE(o,u.from);if(f==null)continue;let h=/^\s*/.exec(u.text)[0],p=Fp(o,f);h!=p&&l.push({from:u.from,to:u.from+h.length,insert:p})}return l.length?[t,{changes:l,sequential:!0}]:t})}const F2e=Ue.define(),$2e=new jt;function FMe(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}function B2e(t,e,n){let r=Rr(t);if(r.length<n)return null;let s=r.resolveStack(n,1),i=null;for(let o=s;o;o=o.next){let a=o.node;if(a.to<=n||a.from>n)continue;if(i&&a.from<e)break;let l=a.type.prop($2e);if(l&&(a.to<r.length-50||r.length==t.doc.length||!V2e(a))){let c=l(a,t);c&&c.from<=n&&c.from>=e&&c.to>n&&(i=c)}}return i}function V2e(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function by(t,e,n){for(let r of t.facet(F2e)){let s=r(t,e,n);if(s)return s}return B2e(t,e,n)}function UV(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const x1=yt.define({map:UV}),zm=yt.define({map:UV});function WV(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const ku=vr.define({create(){return ht.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=FR(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(x1)&&!z2e(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(GV),s=r?ht.replace({widget:new J2e(r(e.state,n.value))}):$R;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(zm)&&(t=t.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=FR(t,e.selection.main.head)),t},provide:t=>He.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n<t.length;){let r=t[n++],s=t[n++];if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid JSON for fold state");e.push($R.range(r,s))}return ht.set(e,!0)}});function FR(t,e,n=e){let r=!1;return t.between(e,n,(s,i)=>{s<n&&i>e&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function vy(t,e,n){var r;let s=null;return(r=t.field(ku,!1))===null||r===void 0||r.between(e,n,(i,o)=>{(!s||s.from>i)&&(s={from:i,to:o})}),s}function z2e(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function KV(t,e){return t.field(ku,!1)?e:e.concat(yt.appendConfig.of(JV()))}const H2e=t=>{for(let e of WV(t)){let n=by(t.state,e.from,e.to);if(n)return t.dispatch({effects:KV(t.state,[x1.of(n),qV(t,n)])}),!0}return!1},U2e=t=>{if(!t.state.field(ku,!1))return!1;let e=[];for(let n of WV(t)){let r=vy(t.state,n.from,n.to);r&&e.push(zm.of(r),qV(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function qV(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return He.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const W2e=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let s=t.lineBlockAt(r),i=by(e,s.from,s.to);i&&n.push(x1.of(i)),r=(i?t.lineBlockAt(i.to):s).to+1}return n.length&&t.dispatch({effects:KV(t.state,n)}),!!n.length},K2e=t=>{let e=t.state.field(ku,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(zm.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},q2e=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:H2e},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:U2e},{key:"Ctrl-Alt-[",run:W2e},{key:"Ctrl-Alt-]",run:K2e}],G2e={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},GV=Ue.define({combine(t){return Wo(t,G2e)}});function JV(t){return[ku,Y2e]}function ZV(t,e){let{state:n}=t,r=n.facet(GV),s=o=>{let a=t.lineBlockAt(t.posAtDOM(o.target)),l=vy(t.state,a.from,a.to);l&&t.dispatch({effects:zm.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const $R=ht.replace({widget:new class extends Ko{toDOM(t){return ZV(t,null)}}});class J2e extends Ko{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return ZV(e,this.value)}}const Z2e={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Yv extends Fa{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function Q2e(t={}){let e={...Z2e,...t},n=new Yv(e,!0),r=new Yv(e,!1),s=nr.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Gl)!=o.state.facet(Gl)||o.startState.field(ku,!1)!=o.state.field(ku,!1)||Rr(o.startState)!=Rr(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new La;for(let l of o.viewportLineBlocks){let c=vy(o.state,l.from,l.to)?r:by(o.state,l.from,l.to)?n:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:i}=e;return[s,KCe({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(s))===null||a===void 0?void 0:a.markers)||Pt.empty},initialSpacer(){return new Yv(e,!1)},domEventHandlers:{...i,click:(o,a,l)=>{if(i.click&&i.click(o,a,l))return!0;let c=vy(o.state,a.from,a.to);if(c)return o.dispatch({effects:zm.of(c)}),!0;let u=by(o.state,a.from,a.to);return u?(o.dispatch({effects:x1.of(u)}),!0):!1}}}),JV()]}const Y2e=He.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Hm{constructor(e,n){this.specs=e;let r;function s(a){let l=Ul.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,o=n.scope;this.scope=o instanceof ni?a=>a.prop(jc)==o.data:o?a=>a==o:void 0,this.style=FV(e.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=r?new Ul(r):null,this.themeType=n.themeType}static define(e,n){return new Hm(e,n||{})}}const O2=Ue.define(),QV=Ue.define({combine(t){return t.length?[t[0]]:null}});function Xv(t){let e=t.facet(O2);return e.length?e:t.facet(QV)}function YV(t,e){let n=[e_e],r;return t instanceof Hm&&(t.module&&n.push(He.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?n.push(QV.of(t)):r?n.push(O2.computeN([He.darkTheme],s=>s.facet(He.darkTheme)==(r=="dark")?[t]:[])):n.push(O2.of(t)),n}class X2e{constructor(e){this.markCache=Object.create(null),this.tree=Rr(e.state),this.decorations=this.buildDeco(e,Xv(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=Rr(e.state),r=Xv(e.state),s=r!=Xv(e.startState),{viewport:i}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!s&&n.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return ht.none;let r=new La;for(let{from:s,to:i}of e.visibleRanges)k2e(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=ht.mark({class:l})))},s,i);return r.finish()}}const e_e=lc.high(nr.fromClass(X2e,{decorations:t=>t.decorations})),t_e=Hm.define([{tag:pe.meta,color:"#404740"},{tag:pe.link,textDecoration:"underline"},{tag:pe.heading,textDecoration:"underline",fontWeight:"bold"},{tag:pe.emphasis,fontStyle:"italic"},{tag:pe.strong,fontWeight:"bold"},{tag:pe.strikethrough,textDecoration:"line-through"},{tag:pe.keyword,color:"#708"},{tag:[pe.atom,pe.bool,pe.url,pe.contentSeparator,pe.labelName],color:"#219"},{tag:[pe.literal,pe.inserted],color:"#164"},{tag:[pe.string,pe.deleted],color:"#a11"},{tag:[pe.regexp,pe.escape,pe.special(pe.string)],color:"#e40"},{tag:pe.definition(pe.variableName),color:"#00f"},{tag:pe.local(pe.variableName),color:"#30a"},{tag:[pe.typeName,pe.namespace],color:"#085"},{tag:pe.className,color:"#167"},{tag:[pe.special(pe.variableName),pe.macroName],color:"#256"},{tag:pe.definition(pe.propertyName),color:"#00c"},{tag:pe.comment,color:"#940"},{tag:pe.invalid,color:"#f00"}]),n_e=He.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),XV=1e4,ez="()[]{}",tz=Ue.define({combine(t){return Wo(t,{afterCursor:!0,brackets:ez,maxScanDistance:XV,renderMatch:i_e})}}),r_e=ht.mark({class:"cm-matchingBracket"}),s_e=ht.mark({class:"cm-nonmatchingBracket"});function i_e(t){let e=[],n=t.matched?r_e:s_e;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const o_e=vr.define({create(){return ht.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(tz);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=No(e.state,s.head,-1,r)||s.head>0&&No(e.state,s.head-1,1,r)||r.afterCursor&&(No(e.state,s.head,1,r)||s.head<e.state.doc.length&&No(e.state,s.head+1,-1,r));i&&(n=n.concat(r.renderMatch(i,e.state)))}return ht.set(n,!0)},provide:t=>He.decorations.from(t)}),a_e=[o_e,n_e];function l_e(t={}){return[tz.of(t),a_e]}const c_e=new jt;function L2(t,e,n){let r=t.prop(e<0?jt.openedBy:jt.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function D2(t){let e=t.type.prop(c_e);return e?e(t.node):t}function No(t,e,n,r={}){let s=r.maxScanDistance||XV,i=r.brackets||ez,o=Rr(t),a=o.resolveInner(e,n);for(let l=a;l;l=l.parent){let c=L2(l.type,n,i);if(c&&l.from<l.to){let u=D2(l);if(u&&(n>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return u_e(t,e,n,l,u,c,i)}}return d_e(t,e,n,o,a.type,s,i)}function u_e(t,e,n,r,s,i,o){let a=r.parent,l={from:s.from,to:s.to},c=0,u=a==null?void 0:a.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(c==0&&i.indexOf(u.type.name)>-1&&u.from<u.to){let f=D2(u);return{start:l,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(L2(u.type,n,o))c++;else if(L2(u.type,-n,o)){if(c==0){let f=D2(u);return{start:l,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}c--}}while(n<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function d_e(t,e,n,r,s,i,o){let a=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?e-1:e,to:n>0?e+1:e},u=t.doc.iterRange(e,n>0?t.doc.length:0),f=0;for(let h=0;!u.next().done&&h<=i;){let p=u.value;n<0&&(h+=p.length);let m=e+h*n;for(let g=n>0?0:p.length-1,y=n>0?p.length:-1;g!=y;g+=n){let v=o.indexOf(p[g]);if(!(v<0||r.resolveInner(m+g,1).type!=s))if(v%2==0==n>0)f++;else{if(f==1)return{start:c,end:{from:m+g,to:m+g+1},matched:v>>1==l>>1};f--}}n>0&&(h+=p.length)}return u.done?{start:c,matched:!1}:null}function BR(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let o=r;o<e;o++)t.charCodeAt(o)==9?i+=n-i%n:i++;return i}class nz{constructor(e,n,r,s){this.string=e,this.tabSize=n,this.indentUnit=r,this.overrideIndent=s,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let n=this.string.charAt(this.pos),r;if(typeof e=="string"?r=n==e:r=n&&(e instanceof RegExp?e.test(n):e(n)),r)return++this.pos,n}eatWhile(e){let n=this.pos;for(;this.eat(e););return this.pos>n}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 n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=BR(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:BR(this.string,null,this.tabSize)}match(e,n,r){if(typeof e=="string"){let s=o=>r?o.toLowerCase():o,i=this.string.substr(this.pos,e.length);return s(i)==s(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&n!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function f_e(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||h_e,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||UE,mergeTokens:t.mergeTokens!==!1}}function h_e(t){if(typeof t!="object")return t;let e={};for(let n in t){let r=t[n];e[n]=r instanceof Array?r.slice():r}return e}const VR=new WeakMap;class zE extends ni{constructor(e){let n=$V(e.languageData),r=f_e(e),s,i=new class extends LV{createParse(o,a,l){return new m_e(s,o,a,l)}};super(n,i,[],e.name),this.topNode=y_e(n,this),s=this,this.streamParser=r,this.stateAfter=new jt({perNode:!0}),this.tokenTable=e.tokenTable?new oz(r.tokenTable):x_e}static define(e){return new zE(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=VR.get(e.state),n!=null&&n<e.pos-1e4&&(n=void 0));let s=HE(this,e.node.tree,e.node.from,e.node.from,n??e.pos),i,o;if(s?(o=s.state,i=s.pos+1):(o=this.streamParser.startState(e.unit),i=e.node.from),e.pos-i>1e4)return null;for(;i<e.pos;){let l=e.state.doc.lineAt(i),c=Math.min(e.pos,l.to);if(l.length){let u=r?r(l.from):-1,f=new nz(l.text,e.state.tabSize,e.unit,u<0?void 0:u);for(;f.pos<c-l.from;)sz(this.streamParser.token,f,o)}else this.streamParser.blankLine(o,e.unit);if(c==e.pos)break;i=l.to+1}let a=e.lineAt(e.pos);return r&&n==null&&VR.set(e.state,a.from),this.streamParser.indent(o,/^\s*(.*)/.exec(a.text)[1],e)}get allowsNesting(){return!1}}function HE(t,e,n,r,s){let i=n>=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let o=e.children.length-1;o>=0;o--){let a=e.children[o],l=n+e.positions[o],c=a instanceof gn&&l<s&&HE(t,a,l,r,s);if(c)return c}return null}function rz(t,e,n,r,s){if(s&&n<=0&&r>=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let o=e.positions[i],a=e.children[i],l;if(o<r&&a instanceof gn){if(!(l=rz(t,a,n-o,r-o,s)))break;return s?new gn(e.type,e.children.slice(0,i).concat(l),e.positions.slice(0,i+1),o+l.length):l}}return null}function p_e(t,e,n,r,s){for(let i of e){let o=i.from+(i.openStart?25:0),a=i.to-(i.openEnd?25:0),l=o<=n&&a>n&&HE(t,i.tree,0-i.offset,n,a),c;if(l&&l.pos<=r&&(c=rz(t,i.tree,n+i.offset,l.pos+i.offset,!1)))return{state:l.state,tree:c}}return{state:t.streamParser.startState(s?wu(s):4),tree:gn.empty}}class m_e{constructor(e,n,r,s){this.lang=e,this.input=n,this.fragments=r,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 i=hf.get(),o=s[0].from,{state:a,tree:l}=p_e(e,r,o,this.to,i==null?void 0:i.state);this.state=a,this.parsedPos=this.chunkStart=o+l.length;for(let c=0;c<l.children.length;c++)this.chunks.push(l.children[c]),this.chunkPos.push(l.positions[c]);i&&this.parsedPos<i.viewport.from-1e5&&s.some(c=>c.from<=i.viewport.from&&c.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(wu(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=hf.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos<r;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==`
|
|
771
771
|
`&&(n="");else{let r=n.indexOf(`
|
|
772
|
-
`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,a=this.lineAfter(o);n+=a,r=o+a.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let s=this.ranges[this.rangeIndex].to,i=e+n;if(r>0?s>i:s>=i)break;let o=this.ranges[++this.rangeIndex].from;n+=o-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,n,r,s){let i=4;if(this.ranges.length>1){s=this.skipGapsTo(n,s,1),n+=s;let a=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-a}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==n?this.chunk[o+2]=r:this.chunk.push(e,n,r,i),s}parseLine(e){let{line:n,end:r}=this.nextLine(),s=0,{streamParser:i}=this.lang,o=new nz(n,e?e.state.tabSize:4,e?wu(e.state):2);if(o.eol())i.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=sz(i.token,o,this.state);if(a&&(s=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,s)),o.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=gn.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:g_e,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new gn(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new gn(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function sz(t,e,n){e.start=e.pos;for(let r=0;r<10;r++){let s=t(e,n);if(e.pos>e.start)return s}throw new Error("Stream parser failed to advance stream.")}const UE=Object.create(null),$p=[ls.none],g_e=new LE($p),zR=[],HR=Object.create(null),iz=Object.create(null);for(let[t,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"]])iz[t]=az(UE,e);class oz{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),iz)}resolve(e){return e?this.table[e]||(this.table[e]=az(this.extra,e)):0}}const x_e=new oz(UE);function ew(t,e){zR.indexOf(t)>-1||(zR.push(t),console.warn(e))}function az(t,e){let n=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let u=t[c]||pe[c];u?typeof u=="function"?l.length?l=l.map(u):ew(c,`Modifier ${c} used at start of tag`):l.length?ew(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:ew(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(a=>a.id),i=HR[s];if(i)return i.id;let o=HR[s]=ls.define({id:$p.length,name:r,props:[v2e({[r]:n})]});return $p.push(o),o.id}function y_e(t,e){let n=ls.define({id:$p.length,name:"Document",props:[jc.add(()=>t),VV.add(()=>r=>e.getIndent(r))],top:!0});return $p.push(n),n}mn.RTL,mn.LTR;class lz{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=Rr(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(cz(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function UR(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function b_e(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;i<s.length;i++)n[s[i]]=!0}let r=UR(e)+UR(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function v_e(t){let e=t.map(s=>typeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:b_e(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function $Me(t,e){return n=>{for(let r=Rr(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}class WR{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}}function qc(t){return t.selection.main.from}function cz(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const WE=Ga.define();function w_e(t,e,n,r){let{main:s}=t.selection,i=n-s.from,o=r-s.from;return{...t.changeByRange(a=>{if(a!=s&&n!=r&&t.sliceDoc(a.from+i,a.from+o)!=t.sliceDoc(n,r))return{range:a};let l=t.toText(e);return{changes:{from:a.from+i,to:r==s.from?a.to:a.from+o,insert:l},range:Ce.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const KR=new WeakMap;function k_e(t){if(!Array.isArray(t))return t;let e=KR.get(t);return e||KR.set(t,e=v_e(t)),e}const wy=yt.define(),Bp=yt.define();class C_e{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=xs(e,n),s=vo(r);this.chars.push(r);let i=e.slice(n,n+s),o=i.toUpperCase();this.folded.push(xs(o==i?i.toLowerCase():o,0)),n+=s}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:s,precise:i,byWord:o}=this;if(n.length==1){let b=xs(e,0),w=vo(b),k=w==e.length?0:-100;if(b!=n[0])if(b==r[0])k+=-200;else return null;return this.ret(k,[0,w])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(a<0){for(let b=0,w=Math.min(e.length,200);b<w&&c<l;){let k=xs(e,b);(k==n[c]||k==r[c])&&(s[c++]=b),b+=vo(k)}if(c<l)return null}let u=0,f=0,h=!1,p=0,m=-1,g=-1,y=/[a-z]/.test(e),v=!0;for(let b=0,w=Math.min(e.length,200),k=0;b<w&&f<l;){let C=xs(e,b);a<0&&(u<l&&C==n[u]&&(i[u++]=b),p<l&&(C==n[p]||C==r[p]?(p==0&&(m=b),g=b+1,p++):p=0));let _,S=C<255?C>=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(_=xE(C))!=_.toLowerCase()?1:_!=_.toUpperCase()?2:0;(!b||S==1&&y||k==0&&S!=0)&&(n[f]==C||r[f]==C&&(h=!0)?o[f++]=b:o.length&&(v=!1)),k=S,b+=vo(C)}return f==l&&o[0]==0&&v?this.result(-100+(h?-200:0),o,e):p==l&&m==0?this.ret(-200-e.length+(g==e.length?0:-100),[0,g]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-900-e.length,[m,g]):f==l?this.result(-100+(h?-200:0)+-700+(v?0:-1100),o,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let o of n){let a=o+(this.astral?vo(xs(r,o)):1);i&&s[i-1]==o?s[i-1]=a:(s[i++]=o,s[i++]=a)}return this.ret(e-r.length,s)}}class __e{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const xr=Ue.define({combine(t){return Wo(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:S_e,filterStrict:!1,compareCompletions:(e,n)=>(e.sortText||e.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>qR(e(r),n(r)),optionClass:(e,n)=>r=>qR(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function qR(t,e){return t?e?t+" "+e:t:e}function S_e(t,e,n,r,s,i){let o=t.textDirection==mn.RTL,a=o,l=!1,c="top",u,f,h=e.left-s.left,p=s.right-e.right,m=r.right-r.left,g=r.bottom-r.top;if(a&&h<Math.min(m,p)?a=!1:!a&&p<Math.min(m,h)&&(a=!0),m<=(a?h:p))u=Math.max(s.top,Math.min(n.top,s.bottom-g))-e.top,f=Math.min(400,a?h:p);else{l=!0,f=Math.min(400,(o?e.right:s.right-e.left)-30);let b=s.bottom-e.bottom;b>=g||b>e.top?u=n.bottom-e.top:(c="bottom",u=e.bottom-n.top)}let y=(e.bottom-e.top)/i.offsetHeight,v=(e.right-e.left)/i.offsetWidth;return{style:`${c}: ${u/y}px; max-width: ${f/v}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function E_e(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let c=0;c<i.length;){let u=i[c++],f=i[c++];u>l&&o.appendChild(document.createTextNode(a.slice(l,u)));let h=o.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(a.slice(u,f))),h.className="cm-completionMatchedText",l=f}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function tw(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class N_e{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:o}=s.open,a=e.state.facet(xr);this.optionContent=E_e(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=tw(i.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(n).open;for(let u=l.target,f;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(f=/-(\d+)$/.exec(u.id))&&+f[1]<c.length){this.applyCompletion(e,c[+f[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(xr).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Bp.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:o,disabled:a}=r.open;(!s.open||s.open.options!=i)&&(this.range=tw(i.length,o,e.state.facet(xr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),a!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=tw(n.options.length,n.selected,this.view.state.facet(xr).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(s);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,s)}).catch(a=>vs(this.view.state,a,"completion info")):(this.addInfoPane(o,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&A_e(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet(xr).positionInfo(this.view,n,s,r,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,r){const s=document.createElement("ul");s.id=n,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let i=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let h=typeof c=="string"?c:c.name;if(h!=i&&(o>r.from||r.from==0))if(i=h,typeof c!="string"&&c.header)s.appendChild(c.header(c));else{let p=s.appendChild(document.createElement("completion-section"));p.textContent=h}}const u=s.appendChild(document.createElement("li"));u.id=n+"-"+o,u.setAttribute("role","option");let f=this.optionClass(a);f&&(u.className=f);for(let h of this.optionContent){let p=h(a,this.view.state,this.view,l);p&&u.appendChild(p)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function T_e(t,e){return n=>new N_e(n,t,e)}function A_e(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/s:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function GR(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function I_e(t,e){let n=[],r=null,s=null,i=u=>{n.push(u);let{section:f}=u.completion;if(f){r||(r=[]);let h=typeof f=="string"?f:f.name;r.some(p=>p.name==h)||r.push(typeof f=="string"?{name:h}:f)}},o=e.facet(xr);for(let u of t)if(u.hasResult()){let f=u.result.getMatch;if(u.result.filter===!1)for(let h of u.result.options)i(new WR(h,u.source,f?f(h):[],1e9-n.length));else{let h=e.sliceDoc(u.from,u.to),p,m=o.filterStrict?new __e(h):new C_e(h);for(let g of u.result.options)if(p=m.match(g.label)){let y=g.displayLabel?f?f(g,p.matched):[]:p.matched,v=p.score+(g.boost||0);if(i(new WR(g,u.source,y,v)),typeof g.section=="object"&&g.section.rank==="dynamic"){let{name:b}=g.section;s||(s=Object.create(null)),s[b]=Math.max(v,s[b]||-1e9)}}}}if(r){let u=Object.create(null),f=0,h=(p,m)=>(p.rank==="dynamic"&&m.rank==="dynamic"?s[m.name]-s[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(p.name<m.name?-1:1);for(let p of r.sort(h))f-=1e5,u[p.name]=f;for(let p of n){let{section:m}=p.completion;m&&(p.score+=u[typeof m=="string"?m:m.name])}}let a=[],l=null,c=o.compareCompletions;for(let u of n.sort((f,h)=>h.score-f.score||c(f.completion,h.completion))){let f=u.completion;!l||l.label!=f.label||l.detail!=f.detail||l.type!=null&&f.type!=null&&l.type!=f.type||l.apply!=f.apply||l.boost!=f.boost?a.push(u):GR(u.completion)>GR(l)&&(a[a.length-1]=u),l=u.completion}return a}class xd{constructor(e,n,r,s,i,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new xd(this.options,JR(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,o){if(s&&!o&&e.some(c=>c.isPending))return s.setDisabled();let a=I_e(e,n);if(!a.length)return s&&e.some(c=>c.isPending)?s.setDisabled():null;let l=n.facet(xr).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let c=s.options[s.selected].completion;for(let u=0;u<a.length;u++)if(a[u].completion==c){l=u;break}}return new xd(a,JR(r,l),{pos:e.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:L_e,above:i.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(e){return new xd(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new xd(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class ky{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new ky(P_e,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(xr),i=(r.override||n.languageDataAt("autocomplete",qc(n)).map(k_e)).map(l=>(this.active.find(u=>u.source==l)||new ri(l,this.active.some(u=>u.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((l,c)=>l==this.active[c])&&(i=this.active);let o=this.open,a=e.effects.some(l=>l.is(KE));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||i.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!j_e(i,this.active)||a?o=xd.build(i,n,this.id,o,r,a):o&&o.disabled&&!i.some(l=>l.isPending)&&(o=null),!o&&i.every(l=>!l.isPending)&&i.some(l=>l.hasResult())&&(i=i.map(l=>l.hasResult()?new ri(l.source,0):l));for(let l of e.effects)l.is(dz)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new ky(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?R_e:M_e}}function j_e(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let s=n==t.length,i=r==e.length;if(s||i)return s==i;if(t[n++].result!=e[r++].result)return!1}}const R_e={"aria-autocomplete":"list"},M_e={};function JR(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const P_e=[];function uz(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(WE);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class ri{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=uz(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new ri(s.source,0)),r&4&&s.state==0&&(s=new ri(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(wy))s=new ri(s.source,1,i.value);else if(i.is(Bp))s=new ri(s.source,0);else if(i.is(KE))for(let o of i.value)o.source==s.source&&(s=o);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(qc(e.state))}}class Rd extends ri{constructor(e,n,r,s,i,o){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=qc(e.state);if(a>o||!s||n&2&&(qc(e.startState)==this.from||a<this.limit))return new ri(this.source,n&4?1:0);let l=e.changes.mapPos(this.limit);return O_e(s.validFor,e.state,i,o)?new Rd(this.source,this.explicit,l,s,i,o):s.update&&(s=s.update(s,i,o,new lz(e.state,a,!1)))?new Rd(this.source,this.explicit,l,s,s.from,(r=s.to)!==null&&r!==void 0?r:qc(e.state)):new ri(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Rd(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new ri(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function O_e(t,e,n,r){if(!t)return!1;let s=e.sliceDoc(n,r);return typeof t=="function"?t(s,n,r,e):cz(t,!0).test(s)}const KE=yt.define({map(t,e){return t.map(n=>n.map(e))}}),dz=yt.define(),ys=vr.define({create(){return ky.start()},update(t,e){return t.update(e)},provide:t=>[PE.from(t,e=>e.tooltip),He.contentAttributes.from(t,e=>e.attrs)]});function qE(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(ys).active.find(s=>s.source==e.source);return r instanceof Rd?(typeof n=="string"?t.dispatch({...w_e(t.state,n,r.from,r.to),annotations:WE.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const L_e=T_e(ys,qE);function Jg(t,e="option"){return n=>{let r=n.state.field(ys,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(xr).interactionDelay)return!1;let s=1,i;e=="page"&&(i=EV(n,r.open.tooltip))&&(s=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+s*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),n.dispatch({effects:dz.of(a)}),!0}}const D_e=t=>{let e=t.state.field(ys,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(xr).interactionDelay?!1:qE(t,e.open.options[e.open.selected])},nw=t=>t.state.field(ys,!1)?(t.dispatch({effects:wy.of(!0)}),!0):!1,F_e=t=>{let e=t.state.field(ys,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Bp.of(null)}),!0)};class $_e{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const B_e=50,V_e=1e3,z_e=nr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(ys).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(ys),n=t.state.facet(xr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ys)==e)return;let r=t.transactions.some(i=>{let o=uz(i,n);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;i<this.running.length;i++){let o=this.running[i];if(r||o.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>B_e&&Date.now()-o.time>V_e){for(let a of o.context.abortListeners)try{a()}catch(l){vs(this.view.state,l)}o.context.abortListeners=null,this.running.splice(i--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(o=>o.is(wy)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(ys);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(xr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=qc(e),r=new lz(e,n,t.explicit,this.view),s=new $_e(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:Bp.of(null)}),vs(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(xr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(xr),r=this.view.state.field(ys);for(let s=0;s<this.running.length;s++){let i=this.running[s];if(i.done===void 0)continue;if(this.running.splice(s--,1),i.done){let a=qc(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(a,i.done.from+(i.active.explicit?0:1)),c=new Rd(i.active.source,i.active.explicit,l,i.done,i.done.from,(t=i.done.to)!==null&&t!==void 0?t:a);for(let u of i.updates)c=c.update(u,n);if(c.hasResult()){e.push(c);continue}}let o=r.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new ri(i.active.source,0);for(let l of i.updates)a=a.update(l,n);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:KE.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ys,!1);if(e&&e.tooltip&&this.view.state.facet(xr).closeOnBlur){let n=e.open&&EV(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Bp.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:wy.of(!1)}),20),this.composing=0}}}),H_e=typeof navigator=="object"&&/Win/.test(navigator.platform),U_e=lc.highest(He.domEventHandlers({keydown(t,e){let n=e.state.field(ys,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(H_e&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(o=>o.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&qE(e,r),!1}})),fz=He.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:'"···"',opacity:.5,display:"block",textAlign:"center"},".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:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class W_e{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class GE{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Ar.TrackDel),r=e.mapPos(this.to,1,Ar.TrackDel);return n==null||r==null?null:new GE(this.field,n,r)}}class JE{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),o=/^\s*/.exec(i.text)[0];for(let l of this.lines){if(r.length){let c=o,u=/^\t*/.exec(l)[0].length;for(let f=0;f<u;f++)c+=e.facet(m1);s.push(n+c.length-u),l=c+l.slice(u)}r.push(l),n+=l.length+1}let a=this.fieldPositions.map(l=>new GE(l.field,s[l.line]+l.from,s[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let n=[],r=[],s=[],i;for(let o of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let a=i[1]?+i[1]:null,l=i[2]||i[3]||"",c=-1,u=l.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f<n.length;f++)(a!=null?n[f].seq==a:u&&n[f].name==u)&&(c=f);if(c<0){let f=0;for(;f<n.length&&(a==null||n[f].seq!=null&&n[f].seq<a);)f++;n.splice(f,0,{seq:a,name:u}),c=f;for(let h of s)h.field>=c&&h.field++}for(let f of s)if(f.line==r.length&&f.from>i.index){let h=i[2]?3+(i[1]||"").length:2;f.from-=h,f.to-=h}s.push(new W_e(c,r.length,i.index,i.index+u.length)),o=o.slice(0,i.index)+l+o.slice(i.index+i[0].length)}o=o.replace(/\\([{}])/g,(a,l,c)=>{for(let u of s)u.line==r.length&&u.from>c&&(u.from--,u.to--);return l}),r.push(o)}return new JE(r,s)}}let K_e=ht.widget({widget:new class extends Ko{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),q_e=ht.mark({class:"cm-snippetField"});class Bf{constructor(e,n){this.ranges=e,this.active=n,this.deco=ht.set(e.map(r=>(r.from==r.to?K_e:q_e).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;n.push(s)}return new Bf(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const Um=yt.define({map(t,e){return t&&t.map(e)}}),G_e=yt.define(),Vp=vr.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(Um))return n.value;if(n.is(G_e)&&t)return new Bf(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>He.decorations.from(t,e=>e?e.deco:ht.none)});function ZE(t,e){return Ce.create(t.filter(n=>n.field==e).map(n=>Ce.range(n.from,n.to)))}function J_e(t){let e=JE.parse(t);return(n,r,s,i)=>{let{text:o,ranges:a}=e.instantiate(n.state,s),{main:l}=n.state.selection,c={changes:{from:s,to:i==l.from?l.to:i,insert:Yt.of(o)},scrollIntoView:!0,annotations:r?[WE.of(r),Qn.userEvent.of("input.complete")]:void 0};if(a.length&&(c.selection=ZE(a,0)),a.some(u=>u.field>0)){let u=new Bf(a,0),f=c.effects=[Um.of(u)];n.state.field(Vp,!1)===void 0&&f.push(yt.appendConfig.of([Vp,eSe,tSe,fz]))}n.dispatch(n.state.update(c))}}function hz(t){return({state:e,dispatch:n})=>{let r=e.field(Vp,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(o=>o.field==s+t);return n(e.update({selection:ZE(r.ranges,s),effects:Um.of(i?null:new Bf(r.ranges,s)),scrollIntoView:!0})),!0}}const Z_e=({state:t,dispatch:e})=>t.field(Vp,!1)?(e(t.update({effects:Um.of(null)})),!0):!1,Q_e=hz(1),Y_e=hz(-1),X_e=[{key:"Tab",run:Q_e,shift:Y_e},{key:"Escape",run:Z_e}],ZR=Ue.define({combine(t){return t.length?t[0]:X_e}}),eSe=lc.highest(Bm.compute([ZR],t=>t.facet(ZR)));function BMe(t,e){return{...e,apply:J_e(t)}}const tSe=He.domEventHandlers({mousedown(t,e){let n=e.state.field(Vp,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=n.ranges.find(i=>i.from<=r&&i.to>=r);return!s||s.field==n.active?!1:(e.dispatch({selection:ZE(n.ranges,s.field),effects:Um.of(n.ranges.some(i=>i.field>s.field)?new Bf(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),zp={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Rc=yt.define({map(t,e){let n=e.mapPos(t,-1,Ar.TrackAfter);return n??void 0}}),QE=new class extends Hl{};QE.startSide=1;QE.endSide=-1;const pz=vr.define({create(){return Pt.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(Rc)&&(t=t.update({add:[QE.range(n.value,n.value+1)]}));return t}});function nSe(){return[sSe,pz]}const rw="()[]{}<>«»»«[]{}";function mz(t){for(let e=0;e<rw.length;e+=2)if(rw.charCodeAt(e)==t)return rw.charAt(e+1);return xE(t<128?t:t+1)}function gz(t,e){return t.languageDataAt("closeBrackets",e)[0]||zp}const rSe=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),sSe=He.inputHandler.of((t,e,n,r)=>{if((rSe?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&vo(xs(r,0))==1||e!=s.from||n!=s.to)return!1;let i=aSe(t.state,r);return i?(t.dispatch(i),!0):!1}),iSe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=gz(t,t.selection.main.head).brackets||zp.brackets,s=null,i=t.changeByRange(o=>{if(o.empty){let a=lSe(t.doc,o.head);for(let l of r)if(l==a&&y1(t.doc,o.head)==mz(xs(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:Ce.cursor(o.head-l.length)}}return{range:s=o}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},oSe=[{key:"Backspace",run:iSe}];function aSe(t,e){let n=gz(t,t.selection.main.head),r=n.brackets||zp.brackets;for(let s of r){let i=mz(xs(s,0));if(e==s)return i==s?dSe(t,s,r.indexOf(s+s+s)>-1,n):cSe(t,s,i,n.before||zp.before);if(e==i&&xz(t,t.selection.main.from))return uSe(t,s,i)}return null}function xz(t,e){let n=!1;return t.field(pz).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function y1(t,e){let n=t.sliceString(e,e+2);return n.slice(0,vo(xs(n,0)))}function lSe(t,e){let n=t.sliceString(e-2,e);return vo(xs(n,0))==n.length?n:n.slice(1)}function cSe(t,e,n,r){let s=null,i=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:Rc.of(o.to+e.length),range:Ce.range(o.anchor+e.length,o.head+e.length)};let a=y1(t.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+n,from:o.head},effects:Rc.of(o.head+e.length),range:Ce.cursor(o.head+e.length)}:{range:s=o}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function uSe(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&y1(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ce.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function dSe(t,e,n,r){let s=r.stringPrefixes||zp.stringPrefixes,i=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Rc.of(a.to+e.length),range:Ce.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=y1(t.doc,l),u;if(c==e){if(QR(t,l))return{changes:{insert:e+e,from:l},effects:Rc.of(l+e.length),range:Ce.cursor(l+e.length)};if(xz(t,l)){let h=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+h.length,insert:h},range:Ce.cursor(l+h.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(u=YR(t,l-2*e.length,s))>-1&&QR(t,u))return{changes:{insert:e+e+e+e,from:l},effects:Rc.of(l+e.length),range:Ce.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=Mn.Word&&YR(t,l,s)>-1&&!fSe(t,l,e,s))return{changes:{insert:e+e,from:l},effects:Rc.of(l+e.length),range:Ce.cursor(l+e.length)}}return{range:i=a}});return i?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function QR(t,e){let n=Rr(t).resolveInner(e+1);return n.parent&&n.from==e}function fSe(t,e,n,r){let s=Rr(t).resolveInner(e,-1),i=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),l=a.indexOf(n);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let u=s.firstChild;for(;u&&u.from==s.from&&u.to-u.from>n.length+l;){if(t.sliceDoc(u.to-n.length,u.to)==n)return!1;u=u.firstChild}return!0}let c=s.to==e&&s.parent;if(!c)break;s=c}return!1}function YR(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Mn.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=Mn.Word)return i}return-1}function hSe(t={}){return[U_e,ys,xr.of(t),z_e,pSe,fz]}const yz=[{key:"Ctrl-Space",run:nw},{mac:"Alt-`",run:nw},{mac:"Alt-i",run:nw},{key:"Escape",run:F_e},{key:"ArrowDown",run:Jg(!0)},{key:"ArrowUp",run:Jg(!1)},{key:"PageDown",run:Jg(!0,"page")},{key:"PageUp",run:Jg(!1,"page")},{key:"Enter",run:D_e}],pSe=lc.highest(Bm.computeN([xr],t=>t.facet(xr).defaultKeymap?[yz]:[])),mSe=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=XE(t.state,n.from);return r.line?gSe(t):r.block?ySe(t):!1};function YE(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const gSe=YE(wSe,0),xSe=YE(bz,0),ySe=YE((t,e)=>bz(t,e,vSe(e)),0);function XE(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const ah=50;function bSe(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-ah,r),o=t.sliceDoc(s,s+ah),a=/\s*$/.exec(i)[0].length,l=/^\s*/.exec(o)[0].length,c=i.length-a;if(i.slice(c-e.length,c)==e&&o.slice(l,l+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:s+l,margin:l&&1}};let u,f;s-r<=2*ah?u=f=t.sliceDoc(r,s):(u=t.sliceDoc(r,r+ah),f=t.sliceDoc(s-ah,s));let h=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(f)[0].length,m=f.length-p-n.length;return u.slice(h,h+e.length)==e&&f.slice(m,m+n.length)==n?{open:{pos:r+h+e.length,margin:/\s/.test(u.charAt(h+e.length))?1:0},close:{pos:s-p-n.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function vSe(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function bz(t,e,n=e.selection.ranges){let r=n.map(i=>XE(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,o)=>bSe(e,r[o],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,o)=>s[o]?[]:[{from:i.from,insert:r[o].open+" "},{from:i.to,insert:" "+r[o].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let o=0,a;o<s.length;o++)if(a=s[o]){let l=r[o],{open:c,close:u}=a;i.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:i}}return null}function wSe(t,e,n=e.selection.ranges){let r=[],s=-1;e:for(let{from:i,to:o}of n){let a=r.length,l=1e9,c;for(let u=i;u<=o;){let f=e.doc.lineAt(u);if(c==null&&(c=XE(e,f.from).line,!c))continue e;if(f.from>s&&(i==o||o>f.from)){s=f.from;let h=/^\s*/.exec(f.text)[0].length,p=h==f.length,m=f.text.slice(h,h+c.length)==c?h:-1;h<f.text.length&&h<l&&(l=h),r.push({line:f,comment:m,token:c,indent:h,empty:p,single:!1})}u=f.to+1}if(l<1e9)for(let u=a;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=l);r.length==a+1&&(r[a].single=!0)}if(t!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:a,token:l,indent:c,empty:u,single:f}of r)(f||!u)&&i.push({from:a.from+c,insert:l+" "});let o=e.changes(i);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,i.push({from:c,to:u})}return{changes:i}}return null}const F2=Ga.define(),kSe=Ga.define(),CSe=Ue.define(),vz=Ue.define({combine(t){return Wo(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),wz=vr.define({create(){return To.empty},update(t,e){let n=e.state.facet(vz),r=e.annotation(F2);if(r){let l=ws.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return l?u=Cy(u,u.length,n.minDepth,l):u=_z(u,e.startState.selection),new To(c==0?r.rest:u,c==0?u:r.rest)}let s=e.annotation(kSe);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(Qn.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=ws.fromTransaction(e),o=e.annotation(Qn.time),a=e.annotation(Qn.userEvent);return i?t=t.addChanges(i,o,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new To(t.done.map(ws.fromJSON),t.undone.map(ws.fromJSON))}});function _Se(t={}){return[wz,vz.of(t),He.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?kz:e.inputType=="historyRedo"?$2:null;return r?(e.preventDefault(),r(n)):!1}})]}function b1(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(wz,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const kz=b1(0,!1),$2=b1(1,!1),SSe=b1(0,!0),ESe=b1(1,!0);class ws{constructor(e,n,r,s,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new ws(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new ws(e.changes&&ar.fromJSON(e.changes),[],e.mapped&&Mo.fromJSON(e.mapped),e.startSelection&&Ce.fromJSON(e.startSelection),e.selectionsAfter.map(Ce.fromJSON))}static fromTransaction(e,n){let r=si;for(let s of e.startState.facet(CSe)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new ws(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,si)}static selection(e){return new ws(void 0,si,void 0,void 0,e)}}function Cy(t,e,n,r){let s=e+1>n+20?e-n-1:0,i=t.slice(s,e);return i.push(r),i}function NSe(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],u=n[l++];a>=c&&o<=u&&(r=!0)}}),r}function TSe(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function Cz(t,e){return t.length?e.length?t.concat(e):t:e}const si=[],ASe=200;function _z(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-ASe));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Cy(t,t.length-1,1e9,n.setSelAfter(r)))}else return[ws.selection([e])]}function ISe(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function sw(t,e){if(!t.length)return t;let n=t.length,r=si;for(;n;){let s=jSe(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=t.slice(0,n);return i[n-1]=s,i}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[ws.selection(r)]:si}function jSe(t,e,n){let r=Cz(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):si,n);if(!t.changes)return ws.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(i):i;return new ws(s,yt.mapEffects(t.effects,e),o,t.startSelection.map(i),r)}const RSe=/^(input\.type|delete)($|\.)/;class To{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new To(this.done,this.undone):this}addChanges(e,n,r,s,i){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||RSe.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,NSe(a.changes,e.changes))||r=="input.type.compose")?o=Cy(o,o.length-1,s.minDepth,new ws(e.changes.compose(a.changes),Cz(yt.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,si)):o=Cy(o,o.length,s.minDepth,e),new To(o,si,n,r)}addSelection(e,n,r,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:si;return i.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&TSe(i[i.length-1],e)?this:new To(_z(this.done,e),this.undone,n,r)}addMapping(e){return new To(sw(this.done,e),sw(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let s=e==0?this.done:this.undone;if(s.length==0)return null;let i=s[s.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):n.selection);if(r&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:F2.of({side:e,rest:ISe(s),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=s.length==1?si:s.slice(0,s.length-1);return i.mapped&&(a=sw(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:F2.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}To.empty=new To(si,si);const MSe=[{key:"Mod-z",run:kz,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:$2,preventDefault:!0},{linux:"Ctrl-Shift-z",run:$2,preventDefault:!0},{key:"Mod-u",run:SSe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:ESe,preventDefault:!0}];function Vf(t,e){return Ce.create(t.ranges.map(e),t.mainIndex)}function to(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function no({state:t,dispatch:e},n){let r=Vf(t.selection,n);return r.eq(t.selection,!0)?!1:(e(to(t,r)),!0)}function v1(t,e){return Ce.cursor(e?t.to:t.from)}function Sz(t,e){return no(t,n=>n.empty?t.moveByChar(n,e):v1(n,e))}function Kr(t){return t.textDirectionAt(t.state.selection.main.head)==mn.LTR}const Ez=t=>Sz(t,!Kr(t)),Nz=t=>Sz(t,Kr(t));function Tz(t,e){return no(t,n=>n.empty?t.moveByGroup(n,e):v1(n,e))}const PSe=t=>Tz(t,!Kr(t)),OSe=t=>Tz(t,Kr(t));function LSe(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function w1(t,e,n){let r=Rr(t).resolveInner(e.head),s=n?jt.closedBy:jt.openedBy;for(let l=e.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;LSe(t,c,s)?r=c:l=n?c.to:c.from}let i=r.type.prop(s),o,a;return i&&(o=n?No(t,r.from,1):No(t,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,Ce.cursor(a,n?-1:1)}const DSe=t=>no(t,e=>w1(t.state,e,!Kr(t))),FSe=t=>no(t,e=>w1(t.state,e,Kr(t)));function Az(t,e){return no(t,n=>{if(!n.empty)return v1(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const Iz=t=>Az(t,!1),jz=t=>Az(t,!0);function Rz(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,s;if(e){for(let i of t.state.facet(He.scrollMargins)){let o=i(t);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(r=Math.max(o==null?void 0:o.bottom,r))}s=t.scrollDOM.clientHeight-n-r}else s=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,s-5)}}function Mz(t,e){let n=Rz(t),{state:r}=t,s=Vf(r.selection,o=>o.empty?t.moveVertically(o,e,n.height):v1(o,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<c&&(i=He.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(to(r,s),{effects:i}),!0}const XR=t=>Mz(t,!1),B2=t=>Mz(t,!0);function cc(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=Ce.cursor(r.from+i))}return s}const $Se=t=>no(t,e=>cc(t,e,!0)),BSe=t=>no(t,e=>cc(t,e,!1)),VSe=t=>no(t,e=>cc(t,e,!Kr(t))),zSe=t=>no(t,e=>cc(t,e,Kr(t))),HSe=t=>no(t,e=>Ce.cursor(t.lineBlockAt(e.head).from,1)),USe=t=>no(t,e=>Ce.cursor(t.lineBlockAt(e.head).to,-1));function WSe(t,e,n){let r=!1,s=Vf(t.selection,i=>{let o=No(t,i.head,-1)||No(t,i.head,1)||i.head>0&&No(t,i.head-1,1)||i.head<t.doc.length&&No(t,i.head+1,-1);if(!o||!o.end)return i;r=!0;let a=o.start.from==i.head?o.end.to:o.end.from;return Ce.cursor(a)});return r?(e(to(t,s)),!0):!1}const KSe=({state:t,dispatch:e})=>WSe(t,e);function yi(t,e){let n=Vf(t.state.selection,r=>{let s=e(r);return Ce.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(to(t.state,n)),!0)}function Pz(t,e){return yi(t,n=>t.moveByChar(n,e))}const Oz=t=>Pz(t,!Kr(t)),Lz=t=>Pz(t,Kr(t));function Dz(t,e){return yi(t,n=>t.moveByGroup(n,e))}const qSe=t=>Dz(t,!Kr(t)),GSe=t=>Dz(t,Kr(t)),JSe=t=>yi(t,e=>w1(t.state,e,!Kr(t))),ZSe=t=>yi(t,e=>w1(t.state,e,Kr(t)));function Fz(t,e){return yi(t,n=>t.moveVertically(n,e))}const $z=t=>Fz(t,!1),Bz=t=>Fz(t,!0);function Vz(t,e){return yi(t,n=>t.moveVertically(n,e,Rz(t).height))}const eM=t=>Vz(t,!1),tM=t=>Vz(t,!0),QSe=t=>yi(t,e=>cc(t,e,!0)),YSe=t=>yi(t,e=>cc(t,e,!1)),XSe=t=>yi(t,e=>cc(t,e,!Kr(t))),e5e=t=>yi(t,e=>cc(t,e,Kr(t))),t5e=t=>yi(t,e=>Ce.cursor(t.lineBlockAt(e.head).from)),n5e=t=>yi(t,e=>Ce.cursor(t.lineBlockAt(e.head).to)),nM=({state:t,dispatch:e})=>(e(to(t,{anchor:0})),!0),rM=({state:t,dispatch:e})=>(e(to(t,{anchor:t.doc.length})),!0),sM=({state:t,dispatch:e})=>(e(to(t,{anchor:t.selection.main.anchor,head:0})),!0),iM=({state:t,dispatch:e})=>(e(to(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),r5e=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),s5e=({state:t,dispatch:e})=>{let n=k1(t).map(({from:r,to:s})=>Ce.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ce.create(n),userEvent:"select"})),!0},i5e=({state:t,dispatch:e})=>{let n=Vf(t.selection,r=>{let s=Rr(t),i=s.resolveStack(r.from,1);if(r.empty){let o=s.resolveStack(r.from,-1);o.node.from>=i.node.from&&o.node.to<=i.node.to&&(i=o)}for(let o=i;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return Ce.range(a.to,a.from)}return r});return n.eq(t.selection)?!1:(e(to(t,n)),!0)};function zz(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let o=n.doc.lineAt(i.head);if(e?o.to<t.state.doc.length:o.from>0)for(let a=i;;){let l=t.moveVertically(a,e);if(l.head<o.from||l.head>o.to){s.some(c=>c.head==l.head)||s.push(l);break}else{if(l.head==a.head)break;a=l}}}return s.length==r.ranges.length?!1:(t.dispatch(to(n,Ce.create(s,s.length-1))),!0)}const o5e=t=>zz(t,!1),a5e=t=>zz(t,!0),l5e=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ce.create([n.main]):n.main.empty||(r=Ce.create([Ce.cursor(n.main.head)])),r?(e(to(t,r)),!0):!1};function Wm(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:o,to:a}=i;if(o==a){let l=e(i);l<o?(n="delete.backward",l=Zg(t,l,!1)):l>o&&(n="delete.forward",l=Zg(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Zg(t,o,!1),a=Zg(t,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:Ce.cursor(o,o<i.head?-1:1)}});return s.changes.empty?!1:(t.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?He.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Zg(t,e,n){if(t instanceof He)for(let r of t.state.facet(He.atomicRanges).map(s=>s(t)))r.between(e,e,(s,i)=>{s<e&&i>e&&(e=n?i:s)});return e}const Hz=(t,e,n)=>Wm(t,r=>{let s=r.from,{state:i}=t,o=i.doc.lineAt(s),a,l;if(n&&!e&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,s-o.from))){if(a[a.length-1]==" ")return s-1;let c=$f(a,i.tabSize),u=c%wu(i)||wu(i);for(let f=0;f<u&&a[a.length-1-f]==" ";f++)s--;l=s}else l=yr(o.text,s-o.from,e,e)+o.from,l==s&&o.number!=(e?i.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,s-o.from))&&(l=yr(o.text,l-o.from,!1,!1)+o.from);return l}),V2=t=>Hz(t,!1,!0),Uz=t=>Hz(t,!0,!1),Wz=(t,e)=>Wm(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),o=s.charCategorizer(r);for(let a=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let l=yr(i.text,r-i.from,e)+i.from,c=i.text.slice(Math.min(r,l)-i.from,Math.max(r,l)-i.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||r!=n.head)&&(a=u),r=l}return r}),Kz=t=>Wz(t,!1),c5e=t=>Wz(t,!0),u5e=t=>Wm(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),d5e=t=>Wm(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),f5e=t=>Wm(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),h5e=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Yt.of(["",""])},range:Ce.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},p5e=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),o=s==i.from?s-1:yr(i.text,s-i.from,!1)+i.from,a=s==i.to?s+1:yr(i.text,s-i.from,!0)+i.from;return{changes:{from:o,to:a,insert:t.doc.slice(s,a).append(t.doc.slice(o,s))},range:Ce.cursor(a)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function k1(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let o=e[e.length-1];o.to=i.to,o.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function qz(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of k1(t)){if(n?i.to==t.doc.length:i.from==0)continue;let o=t.doc.lineAt(n?i.to+1:i.from-1),a=o.length+1;if(n){r.push({from:i.to,to:o.to},{from:i.from,insert:o.text+t.lineBreak});for(let l of i.ranges)s.push(Ce.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:o.from,to:i.from},{from:i.to,insert:t.lineBreak+o.text});for(let l of i.ranges)s.push(Ce.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ce.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const m5e=({state:t,dispatch:e})=>qz(t,e,!1),g5e=({state:t,dispatch:e})=>qz(t,e,!0);function Gz(t,e,n){if(t.readOnly)return!1;let r=[];for(let i of k1(t))n?r.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):r.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});let s=t.changes(r);return e(t.update({changes:s,selection:t.selection.map(s,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const x5e=({state:t,dispatch:e})=>Gz(t,e,!1),y5e=({state:t,dispatch:e})=>Gz(t,e,!0),b5e=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(k1(e).map(({from:s,to:i})=>(s>0?s--:i<e.doc.length&&i++,{from:s,to:i}))),r=Vf(e.selection,s=>{let i;if(t.lineWrapping){let o=t.lineBlockAt(s.head),a=t.coordsAtPos(s.head,s.assoc||1);a&&(i=o.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function v5e(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Rr(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),i;return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(jt.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const oM=Jz(!1),w5e=Jz(!0);function Jz(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:o}=s,a=e.doc.lineAt(i),l=!t&&i==o&&v5e(e,i);t&&(i=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new g1(e,{simulateBreak:i,simulateDoubleBreak:!!l}),u=BE(c,i);for(u==null&&(u=$f(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:i,to:o}=l:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let f=["",Fp(e,u)];return l&&f.push(Fp(e,c.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:Yt.of(f)},range:Ce.cursor(i+1+f[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function eN(t,e){let n=-1;return t.changeByRange(r=>{let s=[];for(let o=r.from;o<=r.to;){let a=t.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(e(a,s,r),n=a.number),o=a.to+1}let i=t.changes(s);return{changes:s,range:Ce.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const k5e=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new g1(t,{overrideIndentation:i=>{let o=n[i];return o??-1}}),s=eN(t,(i,o,a)=>{let l=BE(r,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let c=/^\s*/.exec(i.text)[0],u=Fp(t,l);(c!=u||a.from<i.from+c.length)&&(n[i.from]=l,o.push({from:i.from,to:i.from+c.length,insert:u}))});return s.changes.empty||e(t.update(s,{userEvent:"indent"})),!0},Zz=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(eN(t,(n,r)=>{r.push({from:n.from,insert:t.facet(m1)})}),{userEvent:"input.indent"})),!0),Qz=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(eN(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=$f(s,t.tabSize),o=0,a=Fp(t,Math.max(0,i-wu(t)));for(;o<s.length&&o<a.length&&s.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+s.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),C5e=t=>(t.setTabFocusMode(),!0),_5e=[{key:"Ctrl-b",run:Ez,shift:Oz,preventDefault:!0},{key:"Ctrl-f",run:Nz,shift:Lz},{key:"Ctrl-p",run:Iz,shift:$z},{key:"Ctrl-n",run:jz,shift:Bz},{key:"Ctrl-a",run:HSe,shift:t5e},{key:"Ctrl-e",run:USe,shift:n5e},{key:"Ctrl-d",run:Uz},{key:"Ctrl-h",run:V2},{key:"Ctrl-k",run:u5e},{key:"Ctrl-Alt-h",run:Kz},{key:"Ctrl-o",run:h5e},{key:"Ctrl-t",run:p5e},{key:"Ctrl-v",run:B2}],S5e=[{key:"ArrowLeft",run:Ez,shift:Oz,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:PSe,shift:qSe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:VSe,shift:XSe,preventDefault:!0},{key:"ArrowRight",run:Nz,shift:Lz,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:OSe,shift:GSe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:zSe,shift:e5e,preventDefault:!0},{key:"ArrowUp",run:Iz,shift:$z,preventDefault:!0},{mac:"Cmd-ArrowUp",run:nM,shift:sM},{mac:"Ctrl-ArrowUp",run:XR,shift:eM},{key:"ArrowDown",run:jz,shift:Bz,preventDefault:!0},{mac:"Cmd-ArrowDown",run:rM,shift:iM},{mac:"Ctrl-ArrowDown",run:B2,shift:tM},{key:"PageUp",run:XR,shift:eM},{key:"PageDown",run:B2,shift:tM},{key:"Home",run:BSe,shift:YSe,preventDefault:!0},{key:"Mod-Home",run:nM,shift:sM},{key:"End",run:$Se,shift:QSe,preventDefault:!0},{key:"Mod-End",run:rM,shift:iM},{key:"Enter",run:oM,shift:oM},{key:"Mod-a",run:r5e},{key:"Backspace",run:V2,shift:V2,preventDefault:!0},{key:"Delete",run:Uz,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Kz,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:c5e,preventDefault:!0},{mac:"Mod-Backspace",run:d5e,preventDefault:!0},{mac:"Mod-Delete",run:f5e,preventDefault:!0}].concat(_5e.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),E5e=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:DSe,shift:JSe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:FSe,shift:ZSe},{key:"Alt-ArrowUp",run:m5e},{key:"Shift-Alt-ArrowUp",run:x5e},{key:"Alt-ArrowDown",run:g5e},{key:"Shift-Alt-ArrowDown",run:y5e},{key:"Mod-Alt-ArrowUp",run:o5e},{key:"Mod-Alt-ArrowDown",run:a5e},{key:"Escape",run:l5e},{key:"Mod-Enter",run:w5e},{key:"Alt-l",mac:"Ctrl-l",run:s5e},{key:"Mod-i",run:i5e,preventDefault:!0},{key:"Mod-[",run:Qz},{key:"Mod-]",run:Zz},{key:"Mod-Alt-\\",run:k5e},{key:"Shift-Mod-k",run:b5e},{key:"Shift-Mod-\\",run:KSe},{key:"Mod-/",run:mSe},{key:"Alt-A",run:xSe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:C5e}].concat(S5e),N5e={key:"Tab",run:Zz,shift:Qz};function T5e(t,e,n,r){const s=Lo(Rn),i=Ms(MF),o=j.useRef(null),{lexicalNode:a}=JC(),l=j.useRef(!1),c=j.useRef(!1),u=j.useCallback(()=>{i({editorType:e,rootNode:a,editorRef:o.current})},[e,a,i]),f=j.useCallback(h=>{var p,m,g,y,v,b;if(h.key==="ArrowDown"){const w=(m=(p=o.current)==null?void 0:p.getCodemirror())==null?void 0:m.state;if(w){const k=w.doc.length,C=w.selection.ranges[0].to;k===C&&(l.current?(s==null||s.update(()=>{var _,S;const E=un(t);E.getNextSibling()?((S=(_=o.current)==null?void 0:_.getCodemirror())==null||S.contentDOM.blur(),E.selectNext()):E.insertAfter(Zt())}),l.current=!1):l.current=!0)}}else if(h.key==="ArrowUp"){const w=(y=(g=o.current)==null?void 0:g.getCodemirror())==null?void 0:y.state;w&&w.selection.ranges[0].from===0&&(c.current?(s==null||s.update(()=>{var C,_;const S=un(t);S.getPreviousSibling()&&((_=(C=o.current)==null?void 0:C.getCodemirror())==null||_.contentDOM.blur(),S.selectPrevious())}),c.current=!1):c.current=!0)}else if(h.key==="Enter")h.stopPropagation();else if(h.key==="Backspace"||h.key==="Delete"){const w=(b=(v=o.current)==null?void 0:v.getCodemirror())==null?void 0:b.state;(w==null?void 0:w.doc.length)===0&&(s==null||s.update(()=>{un(t).remove()}))}},[s,t]);return j.useEffect(()=>{const h=o.current;return setTimeout(()=>{var p,m;(p=h==null?void 0:h.getCodemirror())==null||p.contentDOM.addEventListener("focus",u),(m=h==null?void 0:h.getCodemirror())==null||m.contentDOM.addEventListener("keydown",f)},300),()=>{var p,m;(p=h==null?void 0:h.getCodemirror())==null||p.contentDOM.removeEventListener("focus",u),(m=h==null?void 0:h.getCodemirror())==null||m.contentDOM.removeEventListener("keydown",f)}},[o,u,f,n]),j.useEffect(()=>{r.subscribe(()=>{var h,p;(p=(h=o.current)==null?void 0:h.getCodemirror())==null||p.focus(),u()})},[r,o,t,u]),o}function Se(t){return new T2e(zE.define(t))}function tl(t){return me(()=>import("./index-D9rVjAIH.js"),__vite__mapDeps([0,1,2,3])).then(e=>e.sql({dialect:e[t]}))}const A5e=[ue.of({name:"C",extensions:["c","h","ino"],load(){return me(()=>import("./index-DdaDZR2v.js"),__vite__mapDeps([4,1,2,3])).then(t=>t.cpp())}}),ue.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return me(()=>import("./index-DdaDZR2v.js"),__vite__mapDeps([4,1,2,3])).then(t=>t.cpp())}}),ue.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return tl("Cassandra")}}),ue.of({name:"CSS",extensions:["css"],load(){return me(()=>import("./index-CSgPEZIf.js"),__vite__mapDeps([5,1,2,3])).then(t=>t.css())}}),ue.of({name:"Go",extensions:["go"],load(){return me(()=>import("./index-zRyuq4cJ.js"),__vite__mapDeps([6,1,2,3])).then(t=>t.go())}}),ue.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return me(()=>import("./index-CTAGezRr.js"),__vite__mapDeps([7,1,5,2,3,8])).then(t=>t.html())}}),ue.of({name:"Java",extensions:["java"],load(){return me(()=>import("./index-Bn3GeDyS.js"),__vite__mapDeps([9,1,2,3])).then(t=>t.java())}}),ue.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return me(()=>import("./index-D2G9ZSV4.js"),__vite__mapDeps([8,1,2,3])).then(t=>t.javascript())}}),ue.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return me(()=>import("./index-BFQEyPDo.js"),__vite__mapDeps([10,7,1,5,2,3,8])).then(t=>t.jinja())}}),ue.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return me(()=>import("./index-BL5lcbji.js"),__vite__mapDeps([11,1,2,3])).then(t=>t.json())}}),ue.of({name:"JSX",extensions:["jsx"],load(){return me(()=>import("./index-D2G9ZSV4.js"),__vite__mapDeps([8,1,2,3])).then(t=>t.javascript({jsx:!0}))}}),ue.of({name:"LESS",extensions:["less"],load(){return me(()=>import("./index-BheLWZ0d.js"),__vite__mapDeps([12,5,1,2,3])).then(t=>t.less())}}),ue.of({name:"Liquid",extensions:["liquid"],load(){return me(()=>import("./index-BL7iND8Y.js"),__vite__mapDeps([13,7,1,5,2,3,8])).then(t=>t.liquid())}}),ue.of({name:"MariaDB SQL",load(){return tl("MariaSQL")}}),ue.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return me(()=>import("./index-eCHfIyqy.js"),__vite__mapDeps([14,7,1,5,2,3,8])).then(t=>t.markdown())}}),ue.of({name:"MS SQL",load(){return tl("MSSQL")}}),ue.of({name:"MySQL",load(){return tl("MySQL")}}),ue.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return me(()=>import("./index-CwPfxt9_.js"),__vite__mapDeps([15,1,7,5,2,3,8])).then(t=>t.php())}}),ue.of({name:"PLSQL",extensions:["pls"],load(){return tl("PLSQL")}}),ue.of({name:"PostgreSQL",load(){return tl("PostgreSQL")}}),ue.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return me(()=>import("./index-DS6VElYc.js"),__vite__mapDeps([16,1,2,3])).then(t=>t.python())}}),ue.of({name:"Rust",extensions:["rs"],load(){return me(()=>import("./index-COe0-YYa.js"),__vite__mapDeps([17,1,2,3])).then(t=>t.rust())}}),ue.of({name:"Sass",extensions:["sass"],load(){return me(()=>import("./index-Durw9xRw.js"),__vite__mapDeps([18,1,5,2,3])).then(t=>t.sass({indented:!0}))}}),ue.of({name:"SCSS",extensions:["scss"],load(){return me(()=>import("./index-Durw9xRw.js"),__vite__mapDeps([18,1,5,2,3])).then(t=>t.sass())}}),ue.of({name:"SQL",extensions:["sql"],load(){return tl("StandardSQL")}}),ue.of({name:"SQLite",load(){return tl("SQLite")}}),ue.of({name:"TSX",extensions:["tsx"],load(){return me(()=>import("./index-D2G9ZSV4.js"),__vite__mapDeps([8,1,2,3])).then(t=>t.javascript({jsx:!0,typescript:!0}))}}),ue.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return me(()=>import("./index-D2G9ZSV4.js"),__vite__mapDeps([8,1,2,3])).then(t=>t.javascript({typescript:!0}))}}),ue.of({name:"WebAssembly",extensions:["wat","wast"],load(){return me(()=>import("./index-DlgNqdiq.js"),__vite__mapDeps([19,1,2,3])).then(t=>t.wast())}}),ue.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return me(()=>import("./index-COGi5Wb7.js"),__vite__mapDeps([20,1,2,3])).then(t=>t.xml())}}),ue.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return me(()=>import("./index-XVREjU0u.js"),__vite__mapDeps([21,1,2,3])).then(t=>t.yaml())}}),ue.of({name:"APL",extensions:["dyalog","apl"],load(){return me(()=>import("./apl-B4CMkyY2.js"),[]).then(t=>Se(t.apl))}}),ue.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return me(()=>import("./asciiarmor-Df11BRmG.js"),[]).then(t=>Se(t.asciiArmor))}}),ue.of({name:"ASN.1",extensions:["asn","asn1"],load(){return me(()=>import("./asn1-EdZsLKOL.js"),[]).then(t=>Se(t.asn1({})))}}),ue.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return me(()=>import("./asterisk-B-8jnY81.js"),[]).then(t=>Se(t.asterisk))}}),ue.of({name:"Brainfuck",extensions:["b","bf"],load(){return me(()=>import("./brainfuck-C4LP7Hcl.js"),[]).then(t=>Se(t.brainfuck))}}),ue.of({name:"Cobol",extensions:["cob","cpy"],load(){return me(()=>import("./cobol-CWcv1MsR.js"),[]).then(t=>Se(t.cobol))}}),ue.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.csharp))}}),ue.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return me(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>Se(t.clojure))}}),ue.of({name:"ClojureScript",extensions:["cljs"],load(){return me(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>Se(t.clojure))}}),ue.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return me(()=>import("./css-BnMrqG3P.js"),[]).then(t=>Se(t.gss))}}),ue.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return me(()=>import("./cmake-BQqOBYOt.js"),[]).then(t=>Se(t.cmake))}}),ue.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return me(()=>import("./coffeescript-S37ZYGWr.js"),[]).then(t=>Se(t.coffeeScript))}}),ue.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return me(()=>import("./commonlisp-DBKNyK5s.js"),[]).then(t=>Se(t.commonLisp))}}),ue.of({name:"Cypher",extensions:["cyp","cypher"],load(){return me(()=>import("./cypher-C_CwsFkJ.js"),[]).then(t=>Se(t.cypher))}}),ue.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return me(()=>import("./python-BuPzkPfP.js"),[]).then(t=>Se(t.cython))}}),ue.of({name:"Crystal",extensions:["cr"],load(){return me(()=>import("./crystal-SjHAIU92.js"),[]).then(t=>Se(t.crystal))}}),ue.of({name:"D",extensions:["d"],load(){return me(()=>import("./d-pRatUO7H.js"),[]).then(t=>Se(t.d))}}),ue.of({name:"Dart",extensions:["dart"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.dart))}}),ue.of({name:"diff",extensions:["diff","patch"],load(){return me(()=>import("./diff-DbItnlRl.js"),[]).then(t=>Se(t.diff))}}),ue.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return me(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([22,23])).then(t=>Se(t.dockerFile))}}),ue.of({name:"DTD",extensions:["dtd"],load(){return me(()=>import("./dtd-DF_7sFjM.js"),[]).then(t=>Se(t.dtd))}}),ue.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return me(()=>import("./dylan-DwRh75JA.js"),[]).then(t=>Se(t.dylan))}}),ue.of({name:"EBNF",load(){return me(()=>import("./ebnf-CDyGwa7X.js"),[]).then(t=>Se(t.ebnf))}}),ue.of({name:"ECL",extensions:["ecl"],load(){return me(()=>import("./ecl-Cabwm37j.js"),[]).then(t=>Se(t.ecl))}}),ue.of({name:"edn",extensions:["edn"],load(){return me(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>Se(t.clojure))}}),ue.of({name:"Eiffel",extensions:["e"],load(){return me(()=>import("./eiffel-CnydiIhH.js"),[]).then(t=>Se(t.eiffel))}}),ue.of({name:"Elm",extensions:["elm"],load(){return me(()=>import("./elm-vLlmbW-K.js"),[]).then(t=>Se(t.elm))}}),ue.of({name:"Erlang",extensions:["erl"],load(){return me(()=>import("./erlang-BNw1qcRV.js"),[]).then(t=>Se(t.erlang))}}),ue.of({name:"Esper",load(){return me(()=>import("./sql-D0XecflT.js"),[]).then(t=>Se(t.esper))}}),ue.of({name:"Factor",extensions:["factor"],load(){return me(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([24,23])).then(t=>Se(t.factor))}}),ue.of({name:"FCL",load(){return me(()=>import("./fcl-Kvtd6kyn.js"),[]).then(t=>Se(t.fcl))}}),ue.of({name:"Forth",extensions:["forth","fth","4th"],load(){return me(()=>import("./forth-Ffai-XNe.js"),[]).then(t=>Se(t.forth))}}),ue.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return me(()=>import("./fortran-DYz_wnZ1.js"),[]).then(t=>Se(t.fortran))}}),ue.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return me(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>Se(t.fSharp))}}),ue.of({name:"Gas",extensions:["s"],load(){return me(()=>import("./gas-Bneqetm1.js"),[]).then(t=>Se(t.gas))}}),ue.of({name:"Gherkin",extensions:["feature"],load(){return me(()=>import("./gherkin-heZmZLOM.js"),[]).then(t=>Se(t.gherkin))}}),ue.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return me(()=>import("./groovy-D9Dt4D0W.js"),[]).then(t=>Se(t.groovy))}}),ue.of({name:"Haskell",extensions:["hs"],load(){return me(()=>import("./haskell-Cw1EW3IL.js"),[]).then(t=>Se(t.haskell))}}),ue.of({name:"Haxe",extensions:["hx"],load(){return me(()=>import("./haxe-H-WmDvRZ.js"),[]).then(t=>Se(t.haxe))}}),ue.of({name:"HXML",extensions:["hxml"],load(){return me(()=>import("./haxe-H-WmDvRZ.js"),[]).then(t=>Se(t.hxml))}}),ue.of({name:"HTTP",load(){return me(()=>import("./http-DBlCnlav.js"),[]).then(t=>Se(t.http))}}),ue.of({name:"IDL",extensions:["pro"],load(){return me(()=>import("./idl-BEugSyMb.js"),[]).then(t=>Se(t.idl))}}),ue.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return me(()=>import("./javascript-iXu5QeM3.js"),[]).then(t=>Se(t.jsonld))}}),ue.of({name:"Julia",extensions:["jl"],load(){return me(()=>import("./julia-DuME0IfC.js"),[]).then(t=>Se(t.julia))}}),ue.of({name:"Kotlin",extensions:["kt","kts"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.kotlin))}}),ue.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return me(()=>import("./livescript-BwQOo05w.js"),[]).then(t=>Se(t.liveScript))}}),ue.of({name:"Lua",extensions:["lua"],load(){return me(()=>import("./lua-BgMRiT3U.js"),[]).then(t=>Se(t.lua))}}),ue.of({name:"mIRC",extensions:["mrc"],load(){return me(()=>import("./mirc-CjQqDB4T.js"),[]).then(t=>Se(t.mirc))}}),ue.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return me(()=>import("./mathematica-DTrFuWx2.js"),[]).then(t=>Se(t.mathematica))}}),ue.of({name:"Modelica",extensions:["mo"],load(){return me(()=>import("./modelica-Dc1JOy9r.js"),[]).then(t=>Se(t.modelica))}}),ue.of({name:"MUMPS",extensions:["mps"],load(){return me(()=>import("./mumps-BT43cFF4.js"),[]).then(t=>Se(t.mumps))}}),ue.of({name:"Mbox",extensions:["mbox"],load(){return me(()=>import("./mbox-CNhZ1qSd.js"),[]).then(t=>Se(t.mbox))}}),ue.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return me(()=>import("./nginx-DdIZxoE0.js"),[]).then(t=>Se(t.nginx))}}),ue.of({name:"NSIS",extensions:["nsh","nsi"],load(){return me(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([25,23])).then(t=>Se(t.nsis))}}),ue.of({name:"NTriples",extensions:["nt","nq"],load(){return me(()=>import("./ntriples-BfvgReVJ.js"),[]).then(t=>Se(t.ntriples))}}),ue.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.objectiveC))}}),ue.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.objectiveCpp))}}),ue.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return me(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>Se(t.oCaml))}}),ue.of({name:"Octave",extensions:["m"],load(){return me(()=>import("./octave-Ck1zUtKM.js"),[]).then(t=>Se(t.octave))}}),ue.of({name:"Oz",extensions:["oz"],load(){return me(()=>import("./oz-BzwKVEFT.js"),[]).then(t=>Se(t.oz))}}),ue.of({name:"Pascal",extensions:["p","pas"],load(){return me(()=>import("./pascal--L3eBynH.js"),[]).then(t=>Se(t.pascal))}}),ue.of({name:"Perl",extensions:["pl","pm"],load(){return me(()=>import("./perl-CdXCOZ3F.js"),[]).then(t=>Se(t.perl))}}),ue.of({name:"Pig",extensions:["pig"],load(){return me(()=>import("./pig-CevX1Tat.js"),[]).then(t=>Se(t.pig))}}),ue.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return me(()=>import("./powershell-CFHJl5sT.js"),[]).then(t=>Se(t.powerShell))}}),ue.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return me(()=>import("./properties-C78fOPTZ.js"),[]).then(t=>Se(t.properties))}}),ue.of({name:"ProtoBuf",extensions:["proto"],load(){return me(()=>import("./protobuf-ChK-085T.js"),[]).then(t=>Se(t.protobuf))}}),ue.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return me(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([26,27])).then(t=>Se(t.pug))}}),ue.of({name:"Puppet",extensions:["pp"],load(){return me(()=>import("./puppet-DMA9R1ak.js"),[]).then(t=>Se(t.puppet))}}),ue.of({name:"Q",extensions:["q"],load(){return me(()=>import("./q-pXgVlZs6.js"),[]).then(t=>Se(t.q))}}),ue.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return me(()=>import("./r-B6wPVr8A.js"),[]).then(t=>Se(t.r))}}),ue.of({name:"RPM Changes",load(){return me(()=>import("./rpm-CTu-6PCP.js"),[]).then(t=>Se(t.rpmChanges))}}),ue.of({name:"RPM Spec",extensions:["spec"],load(){return me(()=>import("./rpm-CTu-6PCP.js"),[]).then(t=>Se(t.rpmSpec))}}),ue.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return me(()=>import("./ruby-B2Rjki9n.js"),[]).then(t=>Se(t.ruby))}}),ue.of({name:"SAS",extensions:["sas"],load(){return me(()=>import("./sas-B4kiWyti.js"),[]).then(t=>Se(t.sas))}}),ue.of({name:"Scala",extensions:["scala"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.scala))}}),ue.of({name:"Scheme",extensions:["scm","ss"],load(){return me(()=>import("./scheme-C41bIUwD.js"),[]).then(t=>Se(t.scheme))}}),ue.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return me(()=>import("./shell-CjFT_Tl9.js"),[]).then(t=>Se(t.shell))}}),ue.of({name:"Sieve",extensions:["siv","sieve"],load(){return me(()=>import("./sieve-C3Gn_uJK.js"),[]).then(t=>Se(t.sieve))}}),ue.of({name:"Smalltalk",extensions:["st"],load(){return me(()=>import("./smalltalk-CnHTOXQT.js"),[]).then(t=>Se(t.smalltalk))}}),ue.of({name:"Solr",load(){return me(()=>import("./solr-DehyRSwq.js"),[]).then(t=>Se(t.solr))}}),ue.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return me(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>Se(t.sml))}}),ue.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return me(()=>import("./sparql-DkYu6x3z.js"),[]).then(t=>Se(t.sparql))}}),ue.of({name:"Spreadsheet",alias:["excel","formula"],load(){return me(()=>import("./spreadsheet-BCZA_wO0.js"),[]).then(t=>Se(t.spreadsheet))}}),ue.of({name:"Squirrel",extensions:["nut"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.squirrel))}}),ue.of({name:"Stylus",extensions:["styl"],load(){return me(()=>import("./stylus-B533Al4x.js"),[]).then(t=>Se(t.stylus))}}),ue.of({name:"Swift",extensions:["swift"],load(){return me(()=>import("./swift-BzpIVaGY.js"),[]).then(t=>Se(t.swift))}}),ue.of({name:"sTeX",load(){return me(()=>import("./stex-C3f8Ysf7.js"),[]).then(t=>Se(t.stex))}}),ue.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return me(()=>import("./stex-C3f8Ysf7.js"),[]).then(t=>Se(t.stex))}}),ue.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return me(()=>import("./verilog-C6RDOZhf.js"),[]).then(t=>Se(t.verilog))}}),ue.of({name:"Tcl",extensions:["tcl"],load(){return me(()=>import("./tcl-DVfN8rqt.js"),[]).then(t=>Se(t.tcl))}}),ue.of({name:"Textile",extensions:["textile"],load(){return me(()=>import("./textile-CnDTJFAw.js"),[]).then(t=>Se(t.textile))}}),ue.of({name:"TiddlyWiki",load(){return me(()=>import("./tiddlywiki-DO-Gjzrf.js"),[]).then(t=>Se(t.tiddlyWiki))}}),ue.of({name:"Tiki wiki",load(){return me(()=>import("./tiki-DGYXhP31.js"),[]).then(t=>Se(t.tiki))}}),ue.of({name:"TOML",extensions:["toml"],load(){return me(()=>import("./toml-Bm5Em-hy.js"),[]).then(t=>Se(t.toml))}}),ue.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return me(()=>import("./troff-wAsdV37c.js"),[]).then(t=>Se(t.troff))}}),ue.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return me(()=>import("./ttcn-CfJYG6tj.js"),[]).then(t=>Se(t.ttcn))}}),ue.of({name:"TTCN_CFG",extensions:["cfg"],load(){return me(()=>import("./ttcn-cfg-B9xdYoR4.js"),[]).then(t=>Se(t.ttcnCfg))}}),ue.of({name:"Turtle",extensions:["ttl"],load(){return me(()=>import("./turtle-B1tBg_DP.js"),[]).then(t=>Se(t.turtle))}}),ue.of({name:"Web IDL",extensions:["webidl"],load(){return me(()=>import("./webidl-ZXfAyPTL.js"),[]).then(t=>Se(t.webIDL))}}),ue.of({name:"VB.NET",extensions:["vb"],load(){return me(()=>import("./vb-CmGdzxic.js"),[]).then(t=>Se(t.vb))}}),ue.of({name:"VBScript",extensions:["vbs"],load(){return me(()=>import("./vbscript-BuJXcnF6.js"),[]).then(t=>Se(t.vbScript))}}),ue.of({name:"Velocity",extensions:["vtl"],load(){return me(()=>import("./velocity-D8B20fx6.js"),[]).then(t=>Se(t.velocity))}}),ue.of({name:"Verilog",extensions:["v"],load(){return me(()=>import("./verilog-C6RDOZhf.js"),[]).then(t=>Se(t.verilog))}}),ue.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return me(()=>import("./vhdl-lSbBsy5d.js"),[]).then(t=>Se(t.vhdl))}}),ue.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return me(()=>import("./xquery-DzFWVndE.js"),[]).then(t=>Se(t.xQuery))}}),ue.of({name:"Yacas",extensions:["ys"],load(){return me(()=>import("./yacas-BJ4BC0dw.js"),[]).then(t=>Se(t.yacas))}}),ue.of({name:"Z80",extensions:["z80"],load(){return me(()=>import("./z80-Hz9HOZM7.js"),[]).then(t=>Se(t.z80))}}),ue.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return me(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>Se(t.mscgen))}}),ue.of({name:"Xù",extensions:["xu"],load(){return me(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>Se(t.xu))}}),ue.of({name:"MsGenny",extensions:["msgenny"],load(){return me(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>Se(t.msgenny))}}),ue.of({name:"Vue",extensions:["vue"],load(){return me(()=>import("./index-Dwmb9KgG.js"),__vite__mapDeps([28,7,1,5,2,3,8])).then(t=>t.vue())}}),ue.of({name:"Angular Template",load(){return me(()=>import("./index-CAU5OZcp.js"),__vite__mapDeps([29,7,1,5,2,3,8])).then(t=>t.angular())}})],aM="#2e3440",tN="#3b4252",lM="#434c5e",Qg="#4c566a",cM="#e5e9f0",z2="#eceff4",iw="#8fbcbb",uM="#88c0d0",I5e="#81a1c1",ki="#5e81ac",j5e="#bf616a",Qu="#d08770",ow="#ebcb8b",dM="#a3be8c",R5e="#b48ead",fM="#d30102",nN=z2,aw=nN,M5e="#ffffff",lw=tN,P5e=nN,hM=tN,O5e=He.theme({"&":{color:aM,backgroundColor:M5e},".cm-content":{caretColor:hM},".cm-cursor, .cm-dropCursor":{borderLeftColor:hM},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:P5e},".cm-panels":{backgroundColor:nN,color:Qg},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:`1px solid ${Qg}`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:cM},".cm-activeLine":{backgroundColor:aw},".cm-selectionMatch":{backgroundColor:cM},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${Qg}`},"&.cm-focused .cm-matchingBracket":{backgroundColor:z2},".cm-gutters":{backgroundColor:z2,color:aM,border:"none"},".cm-activeLineGutter":{backgroundColor:aw},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:lw},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:lw,borderBottomColor:lw},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:aw,color:Qg}}},{dark:!1}),L5e=Hm.define([{tag:pe.keyword,color:ki},{tag:[pe.name,pe.deleted,pe.character,pe.propertyName,pe.macroName],color:Qu},{tag:[pe.variableName],color:Qu},{tag:[pe.function(pe.variableName)],color:ki},{tag:[pe.labelName],color:I5e},{tag:[pe.color,pe.constant(pe.name),pe.standard(pe.name)],color:ki},{tag:[pe.definition(pe.name),pe.separator],color:dM},{tag:[pe.brace],color:iw},{tag:[pe.annotation],color:fM},{tag:[pe.number,pe.changed,pe.annotation,pe.modifier,pe.self,pe.namespace],color:uM},{tag:[pe.typeName,pe.className],color:ow},{tag:[pe.operator,pe.operatorKeyword],color:dM},{tag:[pe.tagName],color:R5e},{tag:[pe.squareBracket],color:j5e},{tag:[pe.angleBracket],color:Qu},{tag:[pe.attributeName],color:ow},{tag:[pe.regexp],color:ki},{tag:[pe.quote],color:tN},{tag:[pe.string],color:Qu},{tag:pe.link,color:iw,textDecoration:"underline",textUnderlinePosition:"under"},{tag:[pe.url,pe.escape,pe.special(pe.string)],color:Qu},{tag:[pe.meta],color:uM},{tag:[pe.comment],color:lM,fontStyle:"italic"},{tag:pe.strong,fontWeight:"bold",color:ki},{tag:pe.emphasis,fontStyle:"italic",color:ki},{tag:pe.strikethrough,textDecoration:"line-through"},{tag:pe.heading,fontWeight:"bold",color:ki},{tag:pe.special(pe.heading1),fontWeight:"bold",color:ki},{tag:pe.heading1,fontWeight:"bold",color:ki},{tag:[pe.heading2,pe.heading3,pe.heading4],fontWeight:"bold",color:ki},{tag:[pe.heading5,pe.heading6],color:ki},{tag:[pe.atom,pe.bool,pe.special(pe.variableName)],color:Qu},{tag:[pe.processingInstruction,pe.inserted],color:iw},{tag:[pe.contentSeparator],color:ow},{tag:pe.invalid,color:lM,borderBottom:`1px dotted ${fM}`}]),D5e=[O5e,YV(L5e)],pM=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class mf{constructor(e,n,r=0,s=e.length,i,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?a=>i(pM(a)):pM,this.query=this.normalize(n)}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 xs(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 n=xE(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=vo(e);let s=this.normalize(n);if(s.length)for(let i=0,o=r;;i++){let a=s.charCodeAt(i),l=this.match(a,o,this.bufferPos+this.bufferStart);if(i==s.length-1){if(l)return this.value=l,this;break}o==r&&i<n.length&&n.charCodeAt(i)==a&&o++}}}match(e,n,r){let s=null;for(let i=0;i<this.matches.length;i+=2){let o=this.matches[i],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?s={from:this.matches[i+1],to:r}:(this.matches[i]++,a=!0)),a||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:n,to:r}:this.matches.push(1,n)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(mf.prototype[Symbol.iterator]=function(){return this});const Yz={from:-1,to:-1,match:/.*/.exec("")},rN="gm"+(/x/.unicode==null?"":"u");class Xz{constructor(e,n,r,s=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=Yz,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new eH(e,n,r,s,i);this.re=new RegExp(n,rN+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.iter=e.iter();let o=e.lineAt(s);this.curLineStart=o.from,this.matchPos=_y(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.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 n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=_y(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<s||r>this.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const cw=new WeakMap;class Md{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let s=cw.get(e);if(!s||s.from>=r||s.to<=n){let a=new Md(n,e.sliceString(n,r));return cw.set(e,a),a}if(s.from==n&&s.to==r)return s;let{text:i,from:o}=s;return o>n&&(i=e.sliceString(n,o)+i,o=n),s.to<r&&(i+=e.sliceString(s.to,r)),cw.set(e,new Md(o,i)),new Md(n,i.slice(n-o,r-o))}}class eH{constructor(e,n,r,s,i){this.text=e,this.to=i,this.done=!1,this.value=Yz,this.matchPos=_y(e,s),this.re=new RegExp(n,rN+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=Md.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=_y(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Md.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Xz.prototype[Symbol.iterator]=eH.prototype[Symbol.iterator]=function(){return this});function F5e(t){try{return new RegExp(t,rN),!0}catch{return!1}}function _y(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}const $5e=t=>{let{state:e}=t,n=String(e.doc.lineAt(t.state.selection.main.head).number),{close:r,result:s}=zCe(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:e.phrase("go")});return s.then(i=>{let o=i&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.elements.line.value);if(!o){t.dispatch({effects:r});return}let a=e.doc.lineAt(e.selection.main.head),[,l,c,u,f]=o,h=u?+u.slice(1):0,p=c?+c:a.number;if(c&&f){let y=p/100;l&&(y=y*(l=="-"?-1:1)+a.number/e.doc.lines),p=Math.round(e.doc.lines*y)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let m=e.doc.line(Math.max(1,Math.min(e.doc.lines,p))),g=Ce.cursor(m.from+Math.max(0,Math.min(h,m.length)));t.dispatch({effects:[r,He.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},B5e={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},V5e=Ue.define({combine(t){return Wo(t,B5e,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function z5e(t){return[q5e,K5e]}const H5e=ht.mark({class:"cm-selectionMatch"}),U5e=ht.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function mM(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Mn.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Mn.Word)}function W5e(t,e,n,r){return t(e.sliceDoc(n,n+1))==Mn.Word&&t(e.sliceDoc(r-1,r))==Mn.Word}const K5e=nr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(V5e),{state:n}=t,r=n.selection;if(r.ranges.length>1)return ht.none;let s=r.main,i,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return ht.none;let l=n.wordAt(s.head);if(!l)return ht.none;o=n.charCategorizer(s.head),i=n.sliceDoc(l.from,l.to)}else{let l=s.to-s.from;if(l<e.minSelectionLength||l>200)return ht.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),o=n.charCategorizer(s.head),!(mM(o,n,s.from,s.to)&&W5e(o,n,s.from,s.to)))return ht.none}else if(i=n.sliceDoc(s.from,s.to),!i)return ht.none}let a=[];for(let l of t.visibleRanges){let c=new mf(n.doc,i,l.from,l.to);for(;!c.next().done;){let{from:u,to:f}=c.value;if((!o||mM(o,n,u,f))&&(s.empty&&u<=s.from&&f>=s.to?a.push(U5e.range(u,f)):(u>=s.to||f<=s.from)&&a.push(H5e.range(u,f)),a.length>e.maxMatches))return ht.none}}return ht.set(a)}},{decorations:t=>t.decorations}),q5e=He.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),G5e=({state:t,dispatch:e})=>{let{selection:n}=t,r=Ce.create(n.ranges.map(s=>t.wordAt(s.head)||Ce.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function J5e(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let o=!1,a=new mf(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new mf(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(i){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const Z5e=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return G5e({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=J5e(t,r);return s?(e(t.update({selection:t.selection.addRange(Ce.range(s.from,s.to),!1),effects:He.scrollIntoView(s.to)})),!0):!1},zf=Ue.define({combine(t){return Wo(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new uEe(e),scrollToMatch:e=>He.scrollIntoView(e)})}});class tH{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||F5e(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,(n,r)=>r=="n"?`
|
|
772
|
+
`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,a=this.lineAfter(o);n+=a,r=o+a.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let s=this.ranges[this.rangeIndex].to,i=e+n;if(r>0?s>i:s>=i)break;let o=this.ranges[++this.rangeIndex].from;n+=o-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,n,r,s){let i=4;if(this.ranges.length>1){s=this.skipGapsTo(n,s,1),n+=s;let a=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-a}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==n?this.chunk[o+2]=r:this.chunk.push(e,n,r,i),s}parseLine(e){let{line:n,end:r}=this.nextLine(),s=0,{streamParser:i}=this.lang,o=new nz(n,e?e.state.tabSize:4,e?wu(e.state):2);if(o.eol())i.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=sz(i.token,o,this.state);if(a&&(s=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,s)),o.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=gn.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:g_e,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new gn(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new gn(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function sz(t,e,n){e.start=e.pos;for(let r=0;r<10;r++){let s=t(e,n);if(e.pos>e.start)return s}throw new Error("Stream parser failed to advance stream.")}const UE=Object.create(null),$p=[ls.none],g_e=new LE($p),zR=[],HR=Object.create(null),iz=Object.create(null);for(let[t,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"]])iz[t]=az(UE,e);class oz{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),iz)}resolve(e){return e?this.table[e]||(this.table[e]=az(this.extra,e)):0}}const x_e=new oz(UE);function ew(t,e){zR.indexOf(t)>-1||(zR.push(t),console.warn(e))}function az(t,e){let n=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let u=t[c]||pe[c];u?typeof u=="function"?l.length?l=l.map(u):ew(c,`Modifier ${c} used at start of tag`):l.length?ew(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:ew(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(a=>a.id),i=HR[s];if(i)return i.id;let o=HR[s]=ls.define({id:$p.length,name:r,props:[v2e({[r]:n})]});return $p.push(o),o.id}function y_e(t,e){let n=ls.define({id:$p.length,name:"Document",props:[jc.add(()=>t),VV.add(()=>r=>e.getIndent(r))],top:!0});return $p.push(n),n}mn.RTL,mn.LTR;class lz{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=Rr(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(cz(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function UR(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function b_e(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;i<s.length;i++)n[s[i]]=!0}let r=UR(e)+UR(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function v_e(t){let e=t.map(s=>typeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:b_e(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function $Me(t,e){return n=>{for(let r=Rr(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}class WR{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}}function qc(t){return t.selection.main.from}function cz(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const WE=Ga.define();function w_e(t,e,n,r){let{main:s}=t.selection,i=n-s.from,o=r-s.from;return{...t.changeByRange(a=>{if(a!=s&&n!=r&&t.sliceDoc(a.from+i,a.from+o)!=t.sliceDoc(n,r))return{range:a};let l=t.toText(e);return{changes:{from:a.from+i,to:r==s.from?a.to:a.from+o,insert:l},range:Ce.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const KR=new WeakMap;function k_e(t){if(!Array.isArray(t))return t;let e=KR.get(t);return e||KR.set(t,e=v_e(t)),e}const wy=yt.define(),Bp=yt.define();class C_e{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=xs(e,n),s=vo(r);this.chars.push(r);let i=e.slice(n,n+s),o=i.toUpperCase();this.folded.push(xs(o==i?i.toLowerCase():o,0)),n+=s}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:s,precise:i,byWord:o}=this;if(n.length==1){let b=xs(e,0),w=vo(b),k=w==e.length?0:-100;if(b!=n[0])if(b==r[0])k+=-200;else return null;return this.ret(k,[0,w])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(a<0){for(let b=0,w=Math.min(e.length,200);b<w&&c<l;){let k=xs(e,b);(k==n[c]||k==r[c])&&(s[c++]=b),b+=vo(k)}if(c<l)return null}let u=0,f=0,h=!1,p=0,m=-1,g=-1,y=/[a-z]/.test(e),v=!0;for(let b=0,w=Math.min(e.length,200),k=0;b<w&&f<l;){let C=xs(e,b);a<0&&(u<l&&C==n[u]&&(i[u++]=b),p<l&&(C==n[p]||C==r[p]?(p==0&&(m=b),g=b+1,p++):p=0));let _,S=C<255?C>=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(_=xE(C))!=_.toLowerCase()?1:_!=_.toUpperCase()?2:0;(!b||S==1&&y||k==0&&S!=0)&&(n[f]==C||r[f]==C&&(h=!0)?o[f++]=b:o.length&&(v=!1)),k=S,b+=vo(C)}return f==l&&o[0]==0&&v?this.result(-100+(h?-200:0),o,e):p==l&&m==0?this.ret(-200-e.length+(g==e.length?0:-100),[0,g]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-900-e.length,[m,g]):f==l?this.result(-100+(h?-200:0)+-700+(v?0:-1100),o,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let o of n){let a=o+(this.astral?vo(xs(r,o)):1);i&&s[i-1]==o?s[i-1]=a:(s[i++]=o,s[i++]=a)}return this.ret(e-r.length,s)}}class __e{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const xr=Ue.define({combine(t){return Wo(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:S_e,filterStrict:!1,compareCompletions:(e,n)=>(e.sortText||e.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>qR(e(r),n(r)),optionClass:(e,n)=>r=>qR(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function qR(t,e){return t?e?t+" "+e:t:e}function S_e(t,e,n,r,s,i){let o=t.textDirection==mn.RTL,a=o,l=!1,c="top",u,f,h=e.left-s.left,p=s.right-e.right,m=r.right-r.left,g=r.bottom-r.top;if(a&&h<Math.min(m,p)?a=!1:!a&&p<Math.min(m,h)&&(a=!0),m<=(a?h:p))u=Math.max(s.top,Math.min(n.top,s.bottom-g))-e.top,f=Math.min(400,a?h:p);else{l=!0,f=Math.min(400,(o?e.right:s.right-e.left)-30);let b=s.bottom-e.bottom;b>=g||b>e.top?u=n.bottom-e.top:(c="bottom",u=e.bottom-n.top)}let y=(e.bottom-e.top)/i.offsetHeight,v=(e.right-e.left)/i.offsetWidth;return{style:`${c}: ${u/y}px; max-width: ${f/v}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function E_e(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let c=0;c<i.length;){let u=i[c++],f=i[c++];u>l&&o.appendChild(document.createTextNode(a.slice(l,u)));let h=o.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(a.slice(u,f))),h.className="cm-completionMatchedText",l=f}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function tw(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class N_e{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:o}=s.open,a=e.state.facet(xr);this.optionContent=E_e(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=tw(i.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(n).open;for(let u=l.target,f;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(f=/-(\d+)$/.exec(u.id))&&+f[1]<c.length){this.applyCompletion(e,c[+f[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(xr).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Bp.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:o,disabled:a}=r.open;(!s.open||s.open.options!=i)&&(this.range=tw(i.length,o,e.state.facet(xr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),a!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=tw(n.options.length,n.selected,this.view.state.facet(xr).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(s);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,s)}).catch(a=>vs(this.view.state,a,"completion info")):(this.addInfoPane(o,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&A_e(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet(xr).positionInfo(this.view,n,s,r,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,r){const s=document.createElement("ul");s.id=n,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let i=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let h=typeof c=="string"?c:c.name;if(h!=i&&(o>r.from||r.from==0))if(i=h,typeof c!="string"&&c.header)s.appendChild(c.header(c));else{let p=s.appendChild(document.createElement("completion-section"));p.textContent=h}}const u=s.appendChild(document.createElement("li"));u.id=n+"-"+o,u.setAttribute("role","option");let f=this.optionClass(a);f&&(u.className=f);for(let h of this.optionContent){let p=h(a,this.view.state,this.view,l);p&&u.appendChild(p)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function T_e(t,e){return n=>new N_e(n,t,e)}function A_e(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/s:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function GR(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function I_e(t,e){let n=[],r=null,s=null,i=u=>{n.push(u);let{section:f}=u.completion;if(f){r||(r=[]);let h=typeof f=="string"?f:f.name;r.some(p=>p.name==h)||r.push(typeof f=="string"?{name:h}:f)}},o=e.facet(xr);for(let u of t)if(u.hasResult()){let f=u.result.getMatch;if(u.result.filter===!1)for(let h of u.result.options)i(new WR(h,u.source,f?f(h):[],1e9-n.length));else{let h=e.sliceDoc(u.from,u.to),p,m=o.filterStrict?new __e(h):new C_e(h);for(let g of u.result.options)if(p=m.match(g.label)){let y=g.displayLabel?f?f(g,p.matched):[]:p.matched,v=p.score+(g.boost||0);if(i(new WR(g,u.source,y,v)),typeof g.section=="object"&&g.section.rank==="dynamic"){let{name:b}=g.section;s||(s=Object.create(null)),s[b]=Math.max(v,s[b]||-1e9)}}}}if(r){let u=Object.create(null),f=0,h=(p,m)=>(p.rank==="dynamic"&&m.rank==="dynamic"?s[m.name]-s[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(p.name<m.name?-1:1);for(let p of r.sort(h))f-=1e5,u[p.name]=f;for(let p of n){let{section:m}=p.completion;m&&(p.score+=u[typeof m=="string"?m:m.name])}}let a=[],l=null,c=o.compareCompletions;for(let u of n.sort((f,h)=>h.score-f.score||c(f.completion,h.completion))){let f=u.completion;!l||l.label!=f.label||l.detail!=f.detail||l.type!=null&&f.type!=null&&l.type!=f.type||l.apply!=f.apply||l.boost!=f.boost?a.push(u):GR(u.completion)>GR(l)&&(a[a.length-1]=u),l=u.completion}return a}class xd{constructor(e,n,r,s,i,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new xd(this.options,JR(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,o){if(s&&!o&&e.some(c=>c.isPending))return s.setDisabled();let a=I_e(e,n);if(!a.length)return s&&e.some(c=>c.isPending)?s.setDisabled():null;let l=n.facet(xr).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let c=s.options[s.selected].completion;for(let u=0;u<a.length;u++)if(a[u].completion==c){l=u;break}}return new xd(a,JR(r,l),{pos:e.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:L_e,above:i.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(e){return new xd(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new xd(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class ky{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new ky(P_e,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(xr),i=(r.override||n.languageDataAt("autocomplete",qc(n)).map(k_e)).map(l=>(this.active.find(u=>u.source==l)||new ri(l,this.active.some(u=>u.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((l,c)=>l==this.active[c])&&(i=this.active);let o=this.open,a=e.effects.some(l=>l.is(KE));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||i.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!j_e(i,this.active)||a?o=xd.build(i,n,this.id,o,r,a):o&&o.disabled&&!i.some(l=>l.isPending)&&(o=null),!o&&i.every(l=>!l.isPending)&&i.some(l=>l.hasResult())&&(i=i.map(l=>l.hasResult()?new ri(l.source,0):l));for(let l of e.effects)l.is(dz)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new ky(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?R_e:M_e}}function j_e(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let s=n==t.length,i=r==e.length;if(s||i)return s==i;if(t[n++].result!=e[r++].result)return!1}}const R_e={"aria-autocomplete":"list"},M_e={};function JR(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const P_e=[];function uz(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(WE);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class ri{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=uz(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new ri(s.source,0)),r&4&&s.state==0&&(s=new ri(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(wy))s=new ri(s.source,1,i.value);else if(i.is(Bp))s=new ri(s.source,0);else if(i.is(KE))for(let o of i.value)o.source==s.source&&(s=o);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(qc(e.state))}}class Rd extends ri{constructor(e,n,r,s,i,o){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=qc(e.state);if(a>o||!s||n&2&&(qc(e.startState)==this.from||a<this.limit))return new ri(this.source,n&4?1:0);let l=e.changes.mapPos(this.limit);return O_e(s.validFor,e.state,i,o)?new Rd(this.source,this.explicit,l,s,i,o):s.update&&(s=s.update(s,i,o,new lz(e.state,a,!1)))?new Rd(this.source,this.explicit,l,s,s.from,(r=s.to)!==null&&r!==void 0?r:qc(e.state)):new ri(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Rd(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new ri(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function O_e(t,e,n,r){if(!t)return!1;let s=e.sliceDoc(n,r);return typeof t=="function"?t(s,n,r,e):cz(t,!0).test(s)}const KE=yt.define({map(t,e){return t.map(n=>n.map(e))}}),dz=yt.define(),ys=vr.define({create(){return ky.start()},update(t,e){return t.update(e)},provide:t=>[PE.from(t,e=>e.tooltip),He.contentAttributes.from(t,e=>e.attrs)]});function qE(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(ys).active.find(s=>s.source==e.source);return r instanceof Rd?(typeof n=="string"?t.dispatch({...w_e(t.state,n,r.from,r.to),annotations:WE.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const L_e=T_e(ys,qE);function Jg(t,e="option"){return n=>{let r=n.state.field(ys,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(xr).interactionDelay)return!1;let s=1,i;e=="page"&&(i=EV(n,r.open.tooltip))&&(s=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+s*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),n.dispatch({effects:dz.of(a)}),!0}}const D_e=t=>{let e=t.state.field(ys,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(xr).interactionDelay?!1:qE(t,e.open.options[e.open.selected])},nw=t=>t.state.field(ys,!1)?(t.dispatch({effects:wy.of(!0)}),!0):!1,F_e=t=>{let e=t.state.field(ys,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Bp.of(null)}),!0)};class $_e{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const B_e=50,V_e=1e3,z_e=nr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(ys).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(ys),n=t.state.facet(xr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ys)==e)return;let r=t.transactions.some(i=>{let o=uz(i,n);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;i<this.running.length;i++){let o=this.running[i];if(r||o.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>B_e&&Date.now()-o.time>V_e){for(let a of o.context.abortListeners)try{a()}catch(l){vs(this.view.state,l)}o.context.abortListeners=null,this.running.splice(i--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(o=>o.is(wy)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(ys);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(xr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=qc(e),r=new lz(e,n,t.explicit,this.view),s=new $_e(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:Bp.of(null)}),vs(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(xr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(xr),r=this.view.state.field(ys);for(let s=0;s<this.running.length;s++){let i=this.running[s];if(i.done===void 0)continue;if(this.running.splice(s--,1),i.done){let a=qc(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(a,i.done.from+(i.active.explicit?0:1)),c=new Rd(i.active.source,i.active.explicit,l,i.done,i.done.from,(t=i.done.to)!==null&&t!==void 0?t:a);for(let u of i.updates)c=c.update(u,n);if(c.hasResult()){e.push(c);continue}}let o=r.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new ri(i.active.source,0);for(let l of i.updates)a=a.update(l,n);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:KE.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ys,!1);if(e&&e.tooltip&&this.view.state.facet(xr).closeOnBlur){let n=e.open&&EV(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Bp.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:wy.of(!1)}),20),this.composing=0}}}),H_e=typeof navigator=="object"&&/Win/.test(navigator.platform),U_e=lc.highest(He.domEventHandlers({keydown(t,e){let n=e.state.field(ys,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(H_e&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(o=>o.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&qE(e,r),!1}})),fz=He.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:'"···"',opacity:.5,display:"block",textAlign:"center"},".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:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class W_e{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class GE{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Ar.TrackDel),r=e.mapPos(this.to,1,Ar.TrackDel);return n==null||r==null?null:new GE(this.field,n,r)}}class JE{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),o=/^\s*/.exec(i.text)[0];for(let l of this.lines){if(r.length){let c=o,u=/^\t*/.exec(l)[0].length;for(let f=0;f<u;f++)c+=e.facet(m1);s.push(n+c.length-u),l=c+l.slice(u)}r.push(l),n+=l.length+1}let a=this.fieldPositions.map(l=>new GE(l.field,s[l.line]+l.from,s[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let n=[],r=[],s=[],i;for(let o of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let a=i[1]?+i[1]:null,l=i[2]||i[3]||"",c=-1,u=l.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f<n.length;f++)(a!=null?n[f].seq==a:u&&n[f].name==u)&&(c=f);if(c<0){let f=0;for(;f<n.length&&(a==null||n[f].seq!=null&&n[f].seq<a);)f++;n.splice(f,0,{seq:a,name:u}),c=f;for(let h of s)h.field>=c&&h.field++}for(let f of s)if(f.line==r.length&&f.from>i.index){let h=i[2]?3+(i[1]||"").length:2;f.from-=h,f.to-=h}s.push(new W_e(c,r.length,i.index,i.index+u.length)),o=o.slice(0,i.index)+l+o.slice(i.index+i[0].length)}o=o.replace(/\\([{}])/g,(a,l,c)=>{for(let u of s)u.line==r.length&&u.from>c&&(u.from--,u.to--);return l}),r.push(o)}return new JE(r,s)}}let K_e=ht.widget({widget:new class extends Ko{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),q_e=ht.mark({class:"cm-snippetField"});class Bf{constructor(e,n){this.ranges=e,this.active=n,this.deco=ht.set(e.map(r=>(r.from==r.to?K_e:q_e).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;n.push(s)}return new Bf(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const Um=yt.define({map(t,e){return t&&t.map(e)}}),G_e=yt.define(),Vp=vr.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(Um))return n.value;if(n.is(G_e)&&t)return new Bf(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>He.decorations.from(t,e=>e?e.deco:ht.none)});function ZE(t,e){return Ce.create(t.filter(n=>n.field==e).map(n=>Ce.range(n.from,n.to)))}function J_e(t){let e=JE.parse(t);return(n,r,s,i)=>{let{text:o,ranges:a}=e.instantiate(n.state,s),{main:l}=n.state.selection,c={changes:{from:s,to:i==l.from?l.to:i,insert:Yt.of(o)},scrollIntoView:!0,annotations:r?[WE.of(r),Qn.userEvent.of("input.complete")]:void 0};if(a.length&&(c.selection=ZE(a,0)),a.some(u=>u.field>0)){let u=new Bf(a,0),f=c.effects=[Um.of(u)];n.state.field(Vp,!1)===void 0&&f.push(yt.appendConfig.of([Vp,eSe,tSe,fz]))}n.dispatch(n.state.update(c))}}function hz(t){return({state:e,dispatch:n})=>{let r=e.field(Vp,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(o=>o.field==s+t);return n(e.update({selection:ZE(r.ranges,s),effects:Um.of(i?null:new Bf(r.ranges,s)),scrollIntoView:!0})),!0}}const Z_e=({state:t,dispatch:e})=>t.field(Vp,!1)?(e(t.update({effects:Um.of(null)})),!0):!1,Q_e=hz(1),Y_e=hz(-1),X_e=[{key:"Tab",run:Q_e,shift:Y_e},{key:"Escape",run:Z_e}],ZR=Ue.define({combine(t){return t.length?t[0]:X_e}}),eSe=lc.highest(Bm.compute([ZR],t=>t.facet(ZR)));function BMe(t,e){return{...e,apply:J_e(t)}}const tSe=He.domEventHandlers({mousedown(t,e){let n=e.state.field(Vp,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=n.ranges.find(i=>i.from<=r&&i.to>=r);return!s||s.field==n.active?!1:(e.dispatch({selection:ZE(n.ranges,s.field),effects:Um.of(n.ranges.some(i=>i.field>s.field)?new Bf(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),zp={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Rc=yt.define({map(t,e){let n=e.mapPos(t,-1,Ar.TrackAfter);return n??void 0}}),QE=new class extends Hl{};QE.startSide=1;QE.endSide=-1;const pz=vr.define({create(){return Pt.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(Rc)&&(t=t.update({add:[QE.range(n.value,n.value+1)]}));return t}});function nSe(){return[sSe,pz]}const rw="()[]{}<>«»»«[]{}";function mz(t){for(let e=0;e<rw.length;e+=2)if(rw.charCodeAt(e)==t)return rw.charAt(e+1);return xE(t<128?t:t+1)}function gz(t,e){return t.languageDataAt("closeBrackets",e)[0]||zp}const rSe=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),sSe=He.inputHandler.of((t,e,n,r)=>{if((rSe?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&vo(xs(r,0))==1||e!=s.from||n!=s.to)return!1;let i=aSe(t.state,r);return i?(t.dispatch(i),!0):!1}),iSe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=gz(t,t.selection.main.head).brackets||zp.brackets,s=null,i=t.changeByRange(o=>{if(o.empty){let a=lSe(t.doc,o.head);for(let l of r)if(l==a&&y1(t.doc,o.head)==mz(xs(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:Ce.cursor(o.head-l.length)}}return{range:s=o}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},oSe=[{key:"Backspace",run:iSe}];function aSe(t,e){let n=gz(t,t.selection.main.head),r=n.brackets||zp.brackets;for(let s of r){let i=mz(xs(s,0));if(e==s)return i==s?dSe(t,s,r.indexOf(s+s+s)>-1,n):cSe(t,s,i,n.before||zp.before);if(e==i&&xz(t,t.selection.main.from))return uSe(t,s,i)}return null}function xz(t,e){let n=!1;return t.field(pz).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function y1(t,e){let n=t.sliceString(e,e+2);return n.slice(0,vo(xs(n,0)))}function lSe(t,e){let n=t.sliceString(e-2,e);return vo(xs(n,0))==n.length?n:n.slice(1)}function cSe(t,e,n,r){let s=null,i=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:Rc.of(o.to+e.length),range:Ce.range(o.anchor+e.length,o.head+e.length)};let a=y1(t.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+n,from:o.head},effects:Rc.of(o.head+e.length),range:Ce.cursor(o.head+e.length)}:{range:s=o}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function uSe(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&y1(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ce.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function dSe(t,e,n,r){let s=r.stringPrefixes||zp.stringPrefixes,i=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Rc.of(a.to+e.length),range:Ce.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=y1(t.doc,l),u;if(c==e){if(QR(t,l))return{changes:{insert:e+e,from:l},effects:Rc.of(l+e.length),range:Ce.cursor(l+e.length)};if(xz(t,l)){let h=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+h.length,insert:h},range:Ce.cursor(l+h.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(u=YR(t,l-2*e.length,s))>-1&&QR(t,u))return{changes:{insert:e+e+e+e,from:l},effects:Rc.of(l+e.length),range:Ce.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=Mn.Word&&YR(t,l,s)>-1&&!fSe(t,l,e,s))return{changes:{insert:e+e,from:l},effects:Rc.of(l+e.length),range:Ce.cursor(l+e.length)}}return{range:i=a}});return i?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function QR(t,e){let n=Rr(t).resolveInner(e+1);return n.parent&&n.from==e}function fSe(t,e,n,r){let s=Rr(t).resolveInner(e,-1),i=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),l=a.indexOf(n);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let u=s.firstChild;for(;u&&u.from==s.from&&u.to-u.from>n.length+l;){if(t.sliceDoc(u.to-n.length,u.to)==n)return!1;u=u.firstChild}return!0}let c=s.to==e&&s.parent;if(!c)break;s=c}return!1}function YR(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Mn.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=Mn.Word)return i}return-1}function hSe(t={}){return[U_e,ys,xr.of(t),z_e,pSe,fz]}const yz=[{key:"Ctrl-Space",run:nw},{mac:"Alt-`",run:nw},{mac:"Alt-i",run:nw},{key:"Escape",run:F_e},{key:"ArrowDown",run:Jg(!0)},{key:"ArrowUp",run:Jg(!1)},{key:"PageDown",run:Jg(!0,"page")},{key:"PageUp",run:Jg(!1,"page")},{key:"Enter",run:D_e}],pSe=lc.highest(Bm.computeN([xr],t=>t.facet(xr).defaultKeymap?[yz]:[])),mSe=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=XE(t.state,n.from);return r.line?gSe(t):r.block?ySe(t):!1};function YE(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const gSe=YE(wSe,0),xSe=YE(bz,0),ySe=YE((t,e)=>bz(t,e,vSe(e)),0);function XE(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const ah=50;function bSe(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-ah,r),o=t.sliceDoc(s,s+ah),a=/\s*$/.exec(i)[0].length,l=/^\s*/.exec(o)[0].length,c=i.length-a;if(i.slice(c-e.length,c)==e&&o.slice(l,l+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:s+l,margin:l&&1}};let u,f;s-r<=2*ah?u=f=t.sliceDoc(r,s):(u=t.sliceDoc(r,r+ah),f=t.sliceDoc(s-ah,s));let h=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(f)[0].length,m=f.length-p-n.length;return u.slice(h,h+e.length)==e&&f.slice(m,m+n.length)==n?{open:{pos:r+h+e.length,margin:/\s/.test(u.charAt(h+e.length))?1:0},close:{pos:s-p-n.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function vSe(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function bz(t,e,n=e.selection.ranges){let r=n.map(i=>XE(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,o)=>bSe(e,r[o],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,o)=>s[o]?[]:[{from:i.from,insert:r[o].open+" "},{from:i.to,insert:" "+r[o].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let o=0,a;o<s.length;o++)if(a=s[o]){let l=r[o],{open:c,close:u}=a;i.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:i}}return null}function wSe(t,e,n=e.selection.ranges){let r=[],s=-1;e:for(let{from:i,to:o}of n){let a=r.length,l=1e9,c;for(let u=i;u<=o;){let f=e.doc.lineAt(u);if(c==null&&(c=XE(e,f.from).line,!c))continue e;if(f.from>s&&(i==o||o>f.from)){s=f.from;let h=/^\s*/.exec(f.text)[0].length,p=h==f.length,m=f.text.slice(h,h+c.length)==c?h:-1;h<f.text.length&&h<l&&(l=h),r.push({line:f,comment:m,token:c,indent:h,empty:p,single:!1})}u=f.to+1}if(l<1e9)for(let u=a;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=l);r.length==a+1&&(r[a].single=!0)}if(t!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:a,token:l,indent:c,empty:u,single:f}of r)(f||!u)&&i.push({from:a.from+c,insert:l+" "});let o=e.changes(i);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,i.push({from:c,to:u})}return{changes:i}}return null}const F2=Ga.define(),kSe=Ga.define(),CSe=Ue.define(),vz=Ue.define({combine(t){return Wo(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),wz=vr.define({create(){return To.empty},update(t,e){let n=e.state.facet(vz),r=e.annotation(F2);if(r){let l=ws.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return l?u=Cy(u,u.length,n.minDepth,l):u=_z(u,e.startState.selection),new To(c==0?r.rest:u,c==0?u:r.rest)}let s=e.annotation(kSe);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(Qn.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=ws.fromTransaction(e),o=e.annotation(Qn.time),a=e.annotation(Qn.userEvent);return i?t=t.addChanges(i,o,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new To(t.done.map(ws.fromJSON),t.undone.map(ws.fromJSON))}});function _Se(t={}){return[wz,vz.of(t),He.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?kz:e.inputType=="historyRedo"?$2:null;return r?(e.preventDefault(),r(n)):!1}})]}function b1(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(wz,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const kz=b1(0,!1),$2=b1(1,!1),SSe=b1(0,!0),ESe=b1(1,!0);class ws{constructor(e,n,r,s,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new ws(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new ws(e.changes&&ar.fromJSON(e.changes),[],e.mapped&&Mo.fromJSON(e.mapped),e.startSelection&&Ce.fromJSON(e.startSelection),e.selectionsAfter.map(Ce.fromJSON))}static fromTransaction(e,n){let r=si;for(let s of e.startState.facet(CSe)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new ws(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,si)}static selection(e){return new ws(void 0,si,void 0,void 0,e)}}function Cy(t,e,n,r){let s=e+1>n+20?e-n-1:0,i=t.slice(s,e);return i.push(r),i}function NSe(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],u=n[l++];a>=c&&o<=u&&(r=!0)}}),r}function TSe(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function Cz(t,e){return t.length?e.length?t.concat(e):t:e}const si=[],ASe=200;function _z(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-ASe));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Cy(t,t.length-1,1e9,n.setSelAfter(r)))}else return[ws.selection([e])]}function ISe(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function sw(t,e){if(!t.length)return t;let n=t.length,r=si;for(;n;){let s=jSe(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=t.slice(0,n);return i[n-1]=s,i}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[ws.selection(r)]:si}function jSe(t,e,n){let r=Cz(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):si,n);if(!t.changes)return ws.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(i):i;return new ws(s,yt.mapEffects(t.effects,e),o,t.startSelection.map(i),r)}const RSe=/^(input\.type|delete)($|\.)/;class To{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new To(this.done,this.undone):this}addChanges(e,n,r,s,i){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||RSe.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,NSe(a.changes,e.changes))||r=="input.type.compose")?o=Cy(o,o.length-1,s.minDepth,new ws(e.changes.compose(a.changes),Cz(yt.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,si)):o=Cy(o,o.length,s.minDepth,e),new To(o,si,n,r)}addSelection(e,n,r,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:si;return i.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&TSe(i[i.length-1],e)?this:new To(_z(this.done,e),this.undone,n,r)}addMapping(e){return new To(sw(this.done,e),sw(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let s=e==0?this.done:this.undone;if(s.length==0)return null;let i=s[s.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):n.selection);if(r&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:F2.of({side:e,rest:ISe(s),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=s.length==1?si:s.slice(0,s.length-1);return i.mapped&&(a=sw(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:F2.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}To.empty=new To(si,si);const MSe=[{key:"Mod-z",run:kz,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:$2,preventDefault:!0},{linux:"Ctrl-Shift-z",run:$2,preventDefault:!0},{key:"Mod-u",run:SSe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:ESe,preventDefault:!0}];function Vf(t,e){return Ce.create(t.ranges.map(e),t.mainIndex)}function to(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function no({state:t,dispatch:e},n){let r=Vf(t.selection,n);return r.eq(t.selection,!0)?!1:(e(to(t,r)),!0)}function v1(t,e){return Ce.cursor(e?t.to:t.from)}function Sz(t,e){return no(t,n=>n.empty?t.moveByChar(n,e):v1(n,e))}function Kr(t){return t.textDirectionAt(t.state.selection.main.head)==mn.LTR}const Ez=t=>Sz(t,!Kr(t)),Nz=t=>Sz(t,Kr(t));function Tz(t,e){return no(t,n=>n.empty?t.moveByGroup(n,e):v1(n,e))}const PSe=t=>Tz(t,!Kr(t)),OSe=t=>Tz(t,Kr(t));function LSe(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function w1(t,e,n){let r=Rr(t).resolveInner(e.head),s=n?jt.closedBy:jt.openedBy;for(let l=e.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;LSe(t,c,s)?r=c:l=n?c.to:c.from}let i=r.type.prop(s),o,a;return i&&(o=n?No(t,r.from,1):No(t,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,Ce.cursor(a,n?-1:1)}const DSe=t=>no(t,e=>w1(t.state,e,!Kr(t))),FSe=t=>no(t,e=>w1(t.state,e,Kr(t)));function Az(t,e){return no(t,n=>{if(!n.empty)return v1(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const Iz=t=>Az(t,!1),jz=t=>Az(t,!0);function Rz(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,s;if(e){for(let i of t.state.facet(He.scrollMargins)){let o=i(t);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(r=Math.max(o==null?void 0:o.bottom,r))}s=t.scrollDOM.clientHeight-n-r}else s=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,s-5)}}function Mz(t,e){let n=Rz(t),{state:r}=t,s=Vf(r.selection,o=>o.empty?t.moveVertically(o,e,n.height):v1(o,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<c&&(i=He.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(to(r,s),{effects:i}),!0}const XR=t=>Mz(t,!1),B2=t=>Mz(t,!0);function cc(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=Ce.cursor(r.from+i))}return s}const $Se=t=>no(t,e=>cc(t,e,!0)),BSe=t=>no(t,e=>cc(t,e,!1)),VSe=t=>no(t,e=>cc(t,e,!Kr(t))),zSe=t=>no(t,e=>cc(t,e,Kr(t))),HSe=t=>no(t,e=>Ce.cursor(t.lineBlockAt(e.head).from,1)),USe=t=>no(t,e=>Ce.cursor(t.lineBlockAt(e.head).to,-1));function WSe(t,e,n){let r=!1,s=Vf(t.selection,i=>{let o=No(t,i.head,-1)||No(t,i.head,1)||i.head>0&&No(t,i.head-1,1)||i.head<t.doc.length&&No(t,i.head+1,-1);if(!o||!o.end)return i;r=!0;let a=o.start.from==i.head?o.end.to:o.end.from;return Ce.cursor(a)});return r?(e(to(t,s)),!0):!1}const KSe=({state:t,dispatch:e})=>WSe(t,e);function yi(t,e){let n=Vf(t.state.selection,r=>{let s=e(r);return Ce.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(to(t.state,n)),!0)}function Pz(t,e){return yi(t,n=>t.moveByChar(n,e))}const Oz=t=>Pz(t,!Kr(t)),Lz=t=>Pz(t,Kr(t));function Dz(t,e){return yi(t,n=>t.moveByGroup(n,e))}const qSe=t=>Dz(t,!Kr(t)),GSe=t=>Dz(t,Kr(t)),JSe=t=>yi(t,e=>w1(t.state,e,!Kr(t))),ZSe=t=>yi(t,e=>w1(t.state,e,Kr(t)));function Fz(t,e){return yi(t,n=>t.moveVertically(n,e))}const $z=t=>Fz(t,!1),Bz=t=>Fz(t,!0);function Vz(t,e){return yi(t,n=>t.moveVertically(n,e,Rz(t).height))}const eM=t=>Vz(t,!1),tM=t=>Vz(t,!0),QSe=t=>yi(t,e=>cc(t,e,!0)),YSe=t=>yi(t,e=>cc(t,e,!1)),XSe=t=>yi(t,e=>cc(t,e,!Kr(t))),e5e=t=>yi(t,e=>cc(t,e,Kr(t))),t5e=t=>yi(t,e=>Ce.cursor(t.lineBlockAt(e.head).from)),n5e=t=>yi(t,e=>Ce.cursor(t.lineBlockAt(e.head).to)),nM=({state:t,dispatch:e})=>(e(to(t,{anchor:0})),!0),rM=({state:t,dispatch:e})=>(e(to(t,{anchor:t.doc.length})),!0),sM=({state:t,dispatch:e})=>(e(to(t,{anchor:t.selection.main.anchor,head:0})),!0),iM=({state:t,dispatch:e})=>(e(to(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),r5e=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),s5e=({state:t,dispatch:e})=>{let n=k1(t).map(({from:r,to:s})=>Ce.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ce.create(n),userEvent:"select"})),!0},i5e=({state:t,dispatch:e})=>{let n=Vf(t.selection,r=>{let s=Rr(t),i=s.resolveStack(r.from,1);if(r.empty){let o=s.resolveStack(r.from,-1);o.node.from>=i.node.from&&o.node.to<=i.node.to&&(i=o)}for(let o=i;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return Ce.range(a.to,a.from)}return r});return n.eq(t.selection)?!1:(e(to(t,n)),!0)};function zz(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let o=n.doc.lineAt(i.head);if(e?o.to<t.state.doc.length:o.from>0)for(let a=i;;){let l=t.moveVertically(a,e);if(l.head<o.from||l.head>o.to){s.some(c=>c.head==l.head)||s.push(l);break}else{if(l.head==a.head)break;a=l}}}return s.length==r.ranges.length?!1:(t.dispatch(to(n,Ce.create(s,s.length-1))),!0)}const o5e=t=>zz(t,!1),a5e=t=>zz(t,!0),l5e=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ce.create([n.main]):n.main.empty||(r=Ce.create([Ce.cursor(n.main.head)])),r?(e(to(t,r)),!0):!1};function Wm(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:o,to:a}=i;if(o==a){let l=e(i);l<o?(n="delete.backward",l=Zg(t,l,!1)):l>o&&(n="delete.forward",l=Zg(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Zg(t,o,!1),a=Zg(t,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:Ce.cursor(o,o<i.head?-1:1)}});return s.changes.empty?!1:(t.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?He.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Zg(t,e,n){if(t instanceof He)for(let r of t.state.facet(He.atomicRanges).map(s=>s(t)))r.between(e,e,(s,i)=>{s<e&&i>e&&(e=n?i:s)});return e}const Hz=(t,e,n)=>Wm(t,r=>{let s=r.from,{state:i}=t,o=i.doc.lineAt(s),a,l;if(n&&!e&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,s-o.from))){if(a[a.length-1]==" ")return s-1;let c=$f(a,i.tabSize),u=c%wu(i)||wu(i);for(let f=0;f<u&&a[a.length-1-f]==" ";f++)s--;l=s}else l=yr(o.text,s-o.from,e,e)+o.from,l==s&&o.number!=(e?i.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,s-o.from))&&(l=yr(o.text,l-o.from,!1,!1)+o.from);return l}),V2=t=>Hz(t,!1,!0),Uz=t=>Hz(t,!0,!1),Wz=(t,e)=>Wm(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),o=s.charCategorizer(r);for(let a=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let l=yr(i.text,r-i.from,e)+i.from,c=i.text.slice(Math.min(r,l)-i.from,Math.max(r,l)-i.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||r!=n.head)&&(a=u),r=l}return r}),Kz=t=>Wz(t,!1),c5e=t=>Wz(t,!0),u5e=t=>Wm(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),d5e=t=>Wm(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),f5e=t=>Wm(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),h5e=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Yt.of(["",""])},range:Ce.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},p5e=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),o=s==i.from?s-1:yr(i.text,s-i.from,!1)+i.from,a=s==i.to?s+1:yr(i.text,s-i.from,!0)+i.from;return{changes:{from:o,to:a,insert:t.doc.slice(s,a).append(t.doc.slice(o,s))},range:Ce.cursor(a)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function k1(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let o=e[e.length-1];o.to=i.to,o.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function qz(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of k1(t)){if(n?i.to==t.doc.length:i.from==0)continue;let o=t.doc.lineAt(n?i.to+1:i.from-1),a=o.length+1;if(n){r.push({from:i.to,to:o.to},{from:i.from,insert:o.text+t.lineBreak});for(let l of i.ranges)s.push(Ce.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:o.from,to:i.from},{from:i.to,insert:t.lineBreak+o.text});for(let l of i.ranges)s.push(Ce.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ce.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const m5e=({state:t,dispatch:e})=>qz(t,e,!1),g5e=({state:t,dispatch:e})=>qz(t,e,!0);function Gz(t,e,n){if(t.readOnly)return!1;let r=[];for(let i of k1(t))n?r.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):r.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});let s=t.changes(r);return e(t.update({changes:s,selection:t.selection.map(s,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const x5e=({state:t,dispatch:e})=>Gz(t,e,!1),y5e=({state:t,dispatch:e})=>Gz(t,e,!0),b5e=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(k1(e).map(({from:s,to:i})=>(s>0?s--:i<e.doc.length&&i++,{from:s,to:i}))),r=Vf(e.selection,s=>{let i;if(t.lineWrapping){let o=t.lineBlockAt(s.head),a=t.coordsAtPos(s.head,s.assoc||1);a&&(i=o.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function v5e(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Rr(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),i;return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(jt.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const oM=Jz(!1),w5e=Jz(!0);function Jz(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:o}=s,a=e.doc.lineAt(i),l=!t&&i==o&&v5e(e,i);t&&(i=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new g1(e,{simulateBreak:i,simulateDoubleBreak:!!l}),u=BE(c,i);for(u==null&&(u=$f(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:i,to:o}=l:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let f=["",Fp(e,u)];return l&&f.push(Fp(e,c.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:Yt.of(f)},range:Ce.cursor(i+1+f[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function eN(t,e){let n=-1;return t.changeByRange(r=>{let s=[];for(let o=r.from;o<=r.to;){let a=t.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(e(a,s,r),n=a.number),o=a.to+1}let i=t.changes(s);return{changes:s,range:Ce.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const k5e=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new g1(t,{overrideIndentation:i=>{let o=n[i];return o??-1}}),s=eN(t,(i,o,a)=>{let l=BE(r,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let c=/^\s*/.exec(i.text)[0],u=Fp(t,l);(c!=u||a.from<i.from+c.length)&&(n[i.from]=l,o.push({from:i.from,to:i.from+c.length,insert:u}))});return s.changes.empty||e(t.update(s,{userEvent:"indent"})),!0},Zz=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(eN(t,(n,r)=>{r.push({from:n.from,insert:t.facet(m1)})}),{userEvent:"input.indent"})),!0),Qz=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(eN(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=$f(s,t.tabSize),o=0,a=Fp(t,Math.max(0,i-wu(t)));for(;o<s.length&&o<a.length&&s.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+s.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),C5e=t=>(t.setTabFocusMode(),!0),_5e=[{key:"Ctrl-b",run:Ez,shift:Oz,preventDefault:!0},{key:"Ctrl-f",run:Nz,shift:Lz},{key:"Ctrl-p",run:Iz,shift:$z},{key:"Ctrl-n",run:jz,shift:Bz},{key:"Ctrl-a",run:HSe,shift:t5e},{key:"Ctrl-e",run:USe,shift:n5e},{key:"Ctrl-d",run:Uz},{key:"Ctrl-h",run:V2},{key:"Ctrl-k",run:u5e},{key:"Ctrl-Alt-h",run:Kz},{key:"Ctrl-o",run:h5e},{key:"Ctrl-t",run:p5e},{key:"Ctrl-v",run:B2}],S5e=[{key:"ArrowLeft",run:Ez,shift:Oz,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:PSe,shift:qSe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:VSe,shift:XSe,preventDefault:!0},{key:"ArrowRight",run:Nz,shift:Lz,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:OSe,shift:GSe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:zSe,shift:e5e,preventDefault:!0},{key:"ArrowUp",run:Iz,shift:$z,preventDefault:!0},{mac:"Cmd-ArrowUp",run:nM,shift:sM},{mac:"Ctrl-ArrowUp",run:XR,shift:eM},{key:"ArrowDown",run:jz,shift:Bz,preventDefault:!0},{mac:"Cmd-ArrowDown",run:rM,shift:iM},{mac:"Ctrl-ArrowDown",run:B2,shift:tM},{key:"PageUp",run:XR,shift:eM},{key:"PageDown",run:B2,shift:tM},{key:"Home",run:BSe,shift:YSe,preventDefault:!0},{key:"Mod-Home",run:nM,shift:sM},{key:"End",run:$Se,shift:QSe,preventDefault:!0},{key:"Mod-End",run:rM,shift:iM},{key:"Enter",run:oM,shift:oM},{key:"Mod-a",run:r5e},{key:"Backspace",run:V2,shift:V2,preventDefault:!0},{key:"Delete",run:Uz,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Kz,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:c5e,preventDefault:!0},{mac:"Mod-Backspace",run:d5e,preventDefault:!0},{mac:"Mod-Delete",run:f5e,preventDefault:!0}].concat(_5e.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),E5e=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:DSe,shift:JSe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:FSe,shift:ZSe},{key:"Alt-ArrowUp",run:m5e},{key:"Shift-Alt-ArrowUp",run:x5e},{key:"Alt-ArrowDown",run:g5e},{key:"Shift-Alt-ArrowDown",run:y5e},{key:"Mod-Alt-ArrowUp",run:o5e},{key:"Mod-Alt-ArrowDown",run:a5e},{key:"Escape",run:l5e},{key:"Mod-Enter",run:w5e},{key:"Alt-l",mac:"Ctrl-l",run:s5e},{key:"Mod-i",run:i5e,preventDefault:!0},{key:"Mod-[",run:Qz},{key:"Mod-]",run:Zz},{key:"Mod-Alt-\\",run:k5e},{key:"Shift-Mod-k",run:b5e},{key:"Shift-Mod-\\",run:KSe},{key:"Mod-/",run:mSe},{key:"Alt-A",run:xSe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:C5e}].concat(S5e),N5e={key:"Tab",run:Zz,shift:Qz};function T5e(t,e,n,r){const s=Lo(Rn),i=Ms(MF),o=j.useRef(null),{lexicalNode:a}=JC(),l=j.useRef(!1),c=j.useRef(!1),u=j.useCallback(()=>{i({editorType:e,rootNode:a,editorRef:o.current})},[e,a,i]),f=j.useCallback(h=>{var p,m,g,y,v,b;if(h.key==="ArrowDown"){const w=(m=(p=o.current)==null?void 0:p.getCodemirror())==null?void 0:m.state;if(w){const k=w.doc.length,C=w.selection.ranges[0].to;k===C&&(l.current?(s==null||s.update(()=>{var _,S;const E=un(t);E.getNextSibling()?((S=(_=o.current)==null?void 0:_.getCodemirror())==null||S.contentDOM.blur(),E.selectNext()):E.insertAfter(Zt())}),l.current=!1):l.current=!0)}}else if(h.key==="ArrowUp"){const w=(y=(g=o.current)==null?void 0:g.getCodemirror())==null?void 0:y.state;w&&w.selection.ranges[0].from===0&&(c.current?(s==null||s.update(()=>{var C,_;const S=un(t);S.getPreviousSibling()&&((_=(C=o.current)==null?void 0:C.getCodemirror())==null||_.contentDOM.blur(),S.selectPrevious())}),c.current=!1):c.current=!0)}else if(h.key==="Enter")h.stopPropagation();else if(h.key==="Backspace"||h.key==="Delete"){const w=(b=(v=o.current)==null?void 0:v.getCodemirror())==null?void 0:b.state;(w==null?void 0:w.doc.length)===0&&(s==null||s.update(()=>{un(t).remove()}))}},[s,t]);return j.useEffect(()=>{const h=o.current;return setTimeout(()=>{var p,m;(p=h==null?void 0:h.getCodemirror())==null||p.contentDOM.addEventListener("focus",u),(m=h==null?void 0:h.getCodemirror())==null||m.contentDOM.addEventListener("keydown",f)},300),()=>{var p,m;(p=h==null?void 0:h.getCodemirror())==null||p.contentDOM.removeEventListener("focus",u),(m=h==null?void 0:h.getCodemirror())==null||m.contentDOM.removeEventListener("keydown",f)}},[o,u,f,n]),j.useEffect(()=>{r.subscribe(()=>{var h,p;(p=(h=o.current)==null?void 0:h.getCodemirror())==null||p.focus(),u()})},[r,o,t,u]),o}function Se(t){return new T2e(zE.define(t))}function tl(t){return me(()=>import("./index-BMwN19Gi.js"),__vite__mapDeps([0,1,2,3])).then(e=>e.sql({dialect:e[t]}))}const A5e=[ue.of({name:"C",extensions:["c","h","ino"],load(){return me(()=>import("./index--dv-yDMD.js"),__vite__mapDeps([4,1,2,3])).then(t=>t.cpp())}}),ue.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return me(()=>import("./index--dv-yDMD.js"),__vite__mapDeps([4,1,2,3])).then(t=>t.cpp())}}),ue.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return tl("Cassandra")}}),ue.of({name:"CSS",extensions:["css"],load(){return me(()=>import("./index-AaLnuKvn.js"),__vite__mapDeps([5,1,2,3])).then(t=>t.css())}}),ue.of({name:"Go",extensions:["go"],load(){return me(()=>import("./index-BKO_Nk8c.js"),__vite__mapDeps([6,1,2,3])).then(t=>t.go())}}),ue.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return me(()=>import("./index-TPJ_0VD8.js"),__vite__mapDeps([7,1,5,2,3,8])).then(t=>t.html())}}),ue.of({name:"Java",extensions:["java"],load(){return me(()=>import("./index-WuexBBBr.js"),__vite__mapDeps([9,1,2,3])).then(t=>t.java())}}),ue.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return me(()=>import("./index-DcoQC6ia.js"),__vite__mapDeps([8,1,2,3])).then(t=>t.javascript())}}),ue.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return me(()=>import("./index-Bz0rSFov.js"),__vite__mapDeps([10,7,1,5,2,3,8])).then(t=>t.jinja())}}),ue.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return me(()=>import("./index-DFUgoz9_.js"),__vite__mapDeps([11,1,2,3])).then(t=>t.json())}}),ue.of({name:"JSX",extensions:["jsx"],load(){return me(()=>import("./index-DcoQC6ia.js"),__vite__mapDeps([8,1,2,3])).then(t=>t.javascript({jsx:!0}))}}),ue.of({name:"LESS",extensions:["less"],load(){return me(()=>import("./index-Fb7iEaRG.js"),__vite__mapDeps([12,5,1,2,3])).then(t=>t.less())}}),ue.of({name:"Liquid",extensions:["liquid"],load(){return me(()=>import("./index-DY60bSWi.js"),__vite__mapDeps([13,7,1,5,2,3,8])).then(t=>t.liquid())}}),ue.of({name:"MariaDB SQL",load(){return tl("MariaSQL")}}),ue.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return me(()=>import("./index-DfnTp5y6.js"),__vite__mapDeps([14,7,1,5,2,3,8])).then(t=>t.markdown())}}),ue.of({name:"MS SQL",load(){return tl("MSSQL")}}),ue.of({name:"MySQL",load(){return tl("MySQL")}}),ue.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return me(()=>import("./index-Cv5ClxEP.js"),__vite__mapDeps([15,1,7,5,2,3,8])).then(t=>t.php())}}),ue.of({name:"PLSQL",extensions:["pls"],load(){return tl("PLSQL")}}),ue.of({name:"PostgreSQL",load(){return tl("PostgreSQL")}}),ue.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return me(()=>import("./index-B9Xd_vMV.js"),__vite__mapDeps([16,1,2,3])).then(t=>t.python())}}),ue.of({name:"Rust",extensions:["rs"],load(){return me(()=>import("./index-BzNjBEzf.js"),__vite__mapDeps([17,1,2,3])).then(t=>t.rust())}}),ue.of({name:"Sass",extensions:["sass"],load(){return me(()=>import("./index-A_Utfb1G.js"),__vite__mapDeps([18,1,5,2,3])).then(t=>t.sass({indented:!0}))}}),ue.of({name:"SCSS",extensions:["scss"],load(){return me(()=>import("./index-A_Utfb1G.js"),__vite__mapDeps([18,1,5,2,3])).then(t=>t.sass())}}),ue.of({name:"SQL",extensions:["sql"],load(){return tl("StandardSQL")}}),ue.of({name:"SQLite",load(){return tl("SQLite")}}),ue.of({name:"TSX",extensions:["tsx"],load(){return me(()=>import("./index-DcoQC6ia.js"),__vite__mapDeps([8,1,2,3])).then(t=>t.javascript({jsx:!0,typescript:!0}))}}),ue.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return me(()=>import("./index-DcoQC6ia.js"),__vite__mapDeps([8,1,2,3])).then(t=>t.javascript({typescript:!0}))}}),ue.of({name:"WebAssembly",extensions:["wat","wast"],load(){return me(()=>import("./index-D3MPbMGr.js"),__vite__mapDeps([19,1,2,3])).then(t=>t.wast())}}),ue.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return me(()=>import("./index-DL95rih-.js"),__vite__mapDeps([20,1,2,3])).then(t=>t.xml())}}),ue.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return me(()=>import("./index-BCphYMJ8.js"),__vite__mapDeps([21,1,2,3])).then(t=>t.yaml())}}),ue.of({name:"APL",extensions:["dyalog","apl"],load(){return me(()=>import("./apl-B4CMkyY2.js"),[]).then(t=>Se(t.apl))}}),ue.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return me(()=>import("./asciiarmor-Df11BRmG.js"),[]).then(t=>Se(t.asciiArmor))}}),ue.of({name:"ASN.1",extensions:["asn","asn1"],load(){return me(()=>import("./asn1-EdZsLKOL.js"),[]).then(t=>Se(t.asn1({})))}}),ue.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return me(()=>import("./asterisk-B-8jnY81.js"),[]).then(t=>Se(t.asterisk))}}),ue.of({name:"Brainfuck",extensions:["b","bf"],load(){return me(()=>import("./brainfuck-C4LP7Hcl.js"),[]).then(t=>Se(t.brainfuck))}}),ue.of({name:"Cobol",extensions:["cob","cpy"],load(){return me(()=>import("./cobol-CWcv1MsR.js"),[]).then(t=>Se(t.cobol))}}),ue.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.csharp))}}),ue.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return me(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>Se(t.clojure))}}),ue.of({name:"ClojureScript",extensions:["cljs"],load(){return me(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>Se(t.clojure))}}),ue.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return me(()=>import("./css-BnMrqG3P.js"),[]).then(t=>Se(t.gss))}}),ue.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return me(()=>import("./cmake-BQqOBYOt.js"),[]).then(t=>Se(t.cmake))}}),ue.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return me(()=>import("./coffeescript-S37ZYGWr.js"),[]).then(t=>Se(t.coffeeScript))}}),ue.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return me(()=>import("./commonlisp-DBKNyK5s.js"),[]).then(t=>Se(t.commonLisp))}}),ue.of({name:"Cypher",extensions:["cyp","cypher"],load(){return me(()=>import("./cypher-C_CwsFkJ.js"),[]).then(t=>Se(t.cypher))}}),ue.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return me(()=>import("./python-BuPzkPfP.js"),[]).then(t=>Se(t.cython))}}),ue.of({name:"Crystal",extensions:["cr"],load(){return me(()=>import("./crystal-SjHAIU92.js"),[]).then(t=>Se(t.crystal))}}),ue.of({name:"D",extensions:["d"],load(){return me(()=>import("./d-pRatUO7H.js"),[]).then(t=>Se(t.d))}}),ue.of({name:"Dart",extensions:["dart"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.dart))}}),ue.of({name:"diff",extensions:["diff","patch"],load(){return me(()=>import("./diff-DbItnlRl.js"),[]).then(t=>Se(t.diff))}}),ue.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return me(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([22,23])).then(t=>Se(t.dockerFile))}}),ue.of({name:"DTD",extensions:["dtd"],load(){return me(()=>import("./dtd-DF_7sFjM.js"),[]).then(t=>Se(t.dtd))}}),ue.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return me(()=>import("./dylan-DwRh75JA.js"),[]).then(t=>Se(t.dylan))}}),ue.of({name:"EBNF",load(){return me(()=>import("./ebnf-CDyGwa7X.js"),[]).then(t=>Se(t.ebnf))}}),ue.of({name:"ECL",extensions:["ecl"],load(){return me(()=>import("./ecl-Cabwm37j.js"),[]).then(t=>Se(t.ecl))}}),ue.of({name:"edn",extensions:["edn"],load(){return me(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>Se(t.clojure))}}),ue.of({name:"Eiffel",extensions:["e"],load(){return me(()=>import("./eiffel-CnydiIhH.js"),[]).then(t=>Se(t.eiffel))}}),ue.of({name:"Elm",extensions:["elm"],load(){return me(()=>import("./elm-vLlmbW-K.js"),[]).then(t=>Se(t.elm))}}),ue.of({name:"Erlang",extensions:["erl"],load(){return me(()=>import("./erlang-BNw1qcRV.js"),[]).then(t=>Se(t.erlang))}}),ue.of({name:"Esper",load(){return me(()=>import("./sql-D0XecflT.js"),[]).then(t=>Se(t.esper))}}),ue.of({name:"Factor",extensions:["factor"],load(){return me(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([24,23])).then(t=>Se(t.factor))}}),ue.of({name:"FCL",load(){return me(()=>import("./fcl-Kvtd6kyn.js"),[]).then(t=>Se(t.fcl))}}),ue.of({name:"Forth",extensions:["forth","fth","4th"],load(){return me(()=>import("./forth-Ffai-XNe.js"),[]).then(t=>Se(t.forth))}}),ue.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return me(()=>import("./fortran-DYz_wnZ1.js"),[]).then(t=>Se(t.fortran))}}),ue.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return me(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>Se(t.fSharp))}}),ue.of({name:"Gas",extensions:["s"],load(){return me(()=>import("./gas-Bneqetm1.js"),[]).then(t=>Se(t.gas))}}),ue.of({name:"Gherkin",extensions:["feature"],load(){return me(()=>import("./gherkin-heZmZLOM.js"),[]).then(t=>Se(t.gherkin))}}),ue.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return me(()=>import("./groovy-D9Dt4D0W.js"),[]).then(t=>Se(t.groovy))}}),ue.of({name:"Haskell",extensions:["hs"],load(){return me(()=>import("./haskell-Cw1EW3IL.js"),[]).then(t=>Se(t.haskell))}}),ue.of({name:"Haxe",extensions:["hx"],load(){return me(()=>import("./haxe-H-WmDvRZ.js"),[]).then(t=>Se(t.haxe))}}),ue.of({name:"HXML",extensions:["hxml"],load(){return me(()=>import("./haxe-H-WmDvRZ.js"),[]).then(t=>Se(t.hxml))}}),ue.of({name:"HTTP",load(){return me(()=>import("./http-DBlCnlav.js"),[]).then(t=>Se(t.http))}}),ue.of({name:"IDL",extensions:["pro"],load(){return me(()=>import("./idl-BEugSyMb.js"),[]).then(t=>Se(t.idl))}}),ue.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return me(()=>import("./javascript-iXu5QeM3.js"),[]).then(t=>Se(t.jsonld))}}),ue.of({name:"Julia",extensions:["jl"],load(){return me(()=>import("./julia-DuME0IfC.js"),[]).then(t=>Se(t.julia))}}),ue.of({name:"Kotlin",extensions:["kt","kts"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.kotlin))}}),ue.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return me(()=>import("./livescript-BwQOo05w.js"),[]).then(t=>Se(t.liveScript))}}),ue.of({name:"Lua",extensions:["lua"],load(){return me(()=>import("./lua-BgMRiT3U.js"),[]).then(t=>Se(t.lua))}}),ue.of({name:"mIRC",extensions:["mrc"],load(){return me(()=>import("./mirc-CjQqDB4T.js"),[]).then(t=>Se(t.mirc))}}),ue.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return me(()=>import("./mathematica-DTrFuWx2.js"),[]).then(t=>Se(t.mathematica))}}),ue.of({name:"Modelica",extensions:["mo"],load(){return me(()=>import("./modelica-Dc1JOy9r.js"),[]).then(t=>Se(t.modelica))}}),ue.of({name:"MUMPS",extensions:["mps"],load(){return me(()=>import("./mumps-BT43cFF4.js"),[]).then(t=>Se(t.mumps))}}),ue.of({name:"Mbox",extensions:["mbox"],load(){return me(()=>import("./mbox-CNhZ1qSd.js"),[]).then(t=>Se(t.mbox))}}),ue.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return me(()=>import("./nginx-DdIZxoE0.js"),[]).then(t=>Se(t.nginx))}}),ue.of({name:"NSIS",extensions:["nsh","nsi"],load(){return me(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([25,23])).then(t=>Se(t.nsis))}}),ue.of({name:"NTriples",extensions:["nt","nq"],load(){return me(()=>import("./ntriples-BfvgReVJ.js"),[]).then(t=>Se(t.ntriples))}}),ue.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.objectiveC))}}),ue.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.objectiveCpp))}}),ue.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return me(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>Se(t.oCaml))}}),ue.of({name:"Octave",extensions:["m"],load(){return me(()=>import("./octave-Ck1zUtKM.js"),[]).then(t=>Se(t.octave))}}),ue.of({name:"Oz",extensions:["oz"],load(){return me(()=>import("./oz-BzwKVEFT.js"),[]).then(t=>Se(t.oz))}}),ue.of({name:"Pascal",extensions:["p","pas"],load(){return me(()=>import("./pascal--L3eBynH.js"),[]).then(t=>Se(t.pascal))}}),ue.of({name:"Perl",extensions:["pl","pm"],load(){return me(()=>import("./perl-CdXCOZ3F.js"),[]).then(t=>Se(t.perl))}}),ue.of({name:"Pig",extensions:["pig"],load(){return me(()=>import("./pig-CevX1Tat.js"),[]).then(t=>Se(t.pig))}}),ue.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return me(()=>import("./powershell-CFHJl5sT.js"),[]).then(t=>Se(t.powerShell))}}),ue.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return me(()=>import("./properties-C78fOPTZ.js"),[]).then(t=>Se(t.properties))}}),ue.of({name:"ProtoBuf",extensions:["proto"],load(){return me(()=>import("./protobuf-ChK-085T.js"),[]).then(t=>Se(t.protobuf))}}),ue.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return me(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([26,27])).then(t=>Se(t.pug))}}),ue.of({name:"Puppet",extensions:["pp"],load(){return me(()=>import("./puppet-DMA9R1ak.js"),[]).then(t=>Se(t.puppet))}}),ue.of({name:"Q",extensions:["q"],load(){return me(()=>import("./q-pXgVlZs6.js"),[]).then(t=>Se(t.q))}}),ue.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return me(()=>import("./r-B6wPVr8A.js"),[]).then(t=>Se(t.r))}}),ue.of({name:"RPM Changes",load(){return me(()=>import("./rpm-CTu-6PCP.js"),[]).then(t=>Se(t.rpmChanges))}}),ue.of({name:"RPM Spec",extensions:["spec"],load(){return me(()=>import("./rpm-CTu-6PCP.js"),[]).then(t=>Se(t.rpmSpec))}}),ue.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return me(()=>import("./ruby-B2Rjki9n.js"),[]).then(t=>Se(t.ruby))}}),ue.of({name:"SAS",extensions:["sas"],load(){return me(()=>import("./sas-B4kiWyti.js"),[]).then(t=>Se(t.sas))}}),ue.of({name:"Scala",extensions:["scala"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.scala))}}),ue.of({name:"Scheme",extensions:["scm","ss"],load(){return me(()=>import("./scheme-C41bIUwD.js"),[]).then(t=>Se(t.scheme))}}),ue.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return me(()=>import("./shell-CjFT_Tl9.js"),[]).then(t=>Se(t.shell))}}),ue.of({name:"Sieve",extensions:["siv","sieve"],load(){return me(()=>import("./sieve-C3Gn_uJK.js"),[]).then(t=>Se(t.sieve))}}),ue.of({name:"Smalltalk",extensions:["st"],load(){return me(()=>import("./smalltalk-CnHTOXQT.js"),[]).then(t=>Se(t.smalltalk))}}),ue.of({name:"Solr",load(){return me(()=>import("./solr-DehyRSwq.js"),[]).then(t=>Se(t.solr))}}),ue.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return me(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>Se(t.sml))}}),ue.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return me(()=>import("./sparql-DkYu6x3z.js"),[]).then(t=>Se(t.sparql))}}),ue.of({name:"Spreadsheet",alias:["excel","formula"],load(){return me(()=>import("./spreadsheet-BCZA_wO0.js"),[]).then(t=>Se(t.spreadsheet))}}),ue.of({name:"Squirrel",extensions:["nut"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.squirrel))}}),ue.of({name:"Stylus",extensions:["styl"],load(){return me(()=>import("./stylus-B533Al4x.js"),[]).then(t=>Se(t.stylus))}}),ue.of({name:"Swift",extensions:["swift"],load(){return me(()=>import("./swift-BzpIVaGY.js"),[]).then(t=>Se(t.swift))}}),ue.of({name:"sTeX",load(){return me(()=>import("./stex-C3f8Ysf7.js"),[]).then(t=>Se(t.stex))}}),ue.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return me(()=>import("./stex-C3f8Ysf7.js"),[]).then(t=>Se(t.stex))}}),ue.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return me(()=>import("./verilog-C6RDOZhf.js"),[]).then(t=>Se(t.verilog))}}),ue.of({name:"Tcl",extensions:["tcl"],load(){return me(()=>import("./tcl-DVfN8rqt.js"),[]).then(t=>Se(t.tcl))}}),ue.of({name:"Textile",extensions:["textile"],load(){return me(()=>import("./textile-CnDTJFAw.js"),[]).then(t=>Se(t.textile))}}),ue.of({name:"TiddlyWiki",load(){return me(()=>import("./tiddlywiki-DO-Gjzrf.js"),[]).then(t=>Se(t.tiddlyWiki))}}),ue.of({name:"Tiki wiki",load(){return me(()=>import("./tiki-DGYXhP31.js"),[]).then(t=>Se(t.tiki))}}),ue.of({name:"TOML",extensions:["toml"],load(){return me(()=>import("./toml-Bm5Em-hy.js"),[]).then(t=>Se(t.toml))}}),ue.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return me(()=>import("./troff-wAsdV37c.js"),[]).then(t=>Se(t.troff))}}),ue.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return me(()=>import("./ttcn-CfJYG6tj.js"),[]).then(t=>Se(t.ttcn))}}),ue.of({name:"TTCN_CFG",extensions:["cfg"],load(){return me(()=>import("./ttcn-cfg-B9xdYoR4.js"),[]).then(t=>Se(t.ttcnCfg))}}),ue.of({name:"Turtle",extensions:["ttl"],load(){return me(()=>import("./turtle-B1tBg_DP.js"),[]).then(t=>Se(t.turtle))}}),ue.of({name:"Web IDL",extensions:["webidl"],load(){return me(()=>import("./webidl-ZXfAyPTL.js"),[]).then(t=>Se(t.webIDL))}}),ue.of({name:"VB.NET",extensions:["vb"],load(){return me(()=>import("./vb-CmGdzxic.js"),[]).then(t=>Se(t.vb))}}),ue.of({name:"VBScript",extensions:["vbs"],load(){return me(()=>import("./vbscript-BuJXcnF6.js"),[]).then(t=>Se(t.vbScript))}}),ue.of({name:"Velocity",extensions:["vtl"],load(){return me(()=>import("./velocity-D8B20fx6.js"),[]).then(t=>Se(t.velocity))}}),ue.of({name:"Verilog",extensions:["v"],load(){return me(()=>import("./verilog-C6RDOZhf.js"),[]).then(t=>Se(t.verilog))}}),ue.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return me(()=>import("./vhdl-lSbBsy5d.js"),[]).then(t=>Se(t.vhdl))}}),ue.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return me(()=>import("./xquery-DzFWVndE.js"),[]).then(t=>Se(t.xQuery))}}),ue.of({name:"Yacas",extensions:["ys"],load(){return me(()=>import("./yacas-BJ4BC0dw.js"),[]).then(t=>Se(t.yacas))}}),ue.of({name:"Z80",extensions:["z80"],load(){return me(()=>import("./z80-Hz9HOZM7.js"),[]).then(t=>Se(t.z80))}}),ue.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return me(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>Se(t.mscgen))}}),ue.of({name:"Xù",extensions:["xu"],load(){return me(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>Se(t.xu))}}),ue.of({name:"MsGenny",extensions:["msgenny"],load(){return me(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>Se(t.msgenny))}}),ue.of({name:"Vue",extensions:["vue"],load(){return me(()=>import("./index-Cpqm25YS.js"),__vite__mapDeps([28,7,1,5,2,3,8])).then(t=>t.vue())}}),ue.of({name:"Angular Template",load(){return me(()=>import("./index-CLWYCHoS.js"),__vite__mapDeps([29,7,1,5,2,3,8])).then(t=>t.angular())}})],aM="#2e3440",tN="#3b4252",lM="#434c5e",Qg="#4c566a",cM="#e5e9f0",z2="#eceff4",iw="#8fbcbb",uM="#88c0d0",I5e="#81a1c1",ki="#5e81ac",j5e="#bf616a",Qu="#d08770",ow="#ebcb8b",dM="#a3be8c",R5e="#b48ead",fM="#d30102",nN=z2,aw=nN,M5e="#ffffff",lw=tN,P5e=nN,hM=tN,O5e=He.theme({"&":{color:aM,backgroundColor:M5e},".cm-content":{caretColor:hM},".cm-cursor, .cm-dropCursor":{borderLeftColor:hM},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:P5e},".cm-panels":{backgroundColor:nN,color:Qg},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:`1px solid ${Qg}`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:cM},".cm-activeLine":{backgroundColor:aw},".cm-selectionMatch":{backgroundColor:cM},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${Qg}`},"&.cm-focused .cm-matchingBracket":{backgroundColor:z2},".cm-gutters":{backgroundColor:z2,color:aM,border:"none"},".cm-activeLineGutter":{backgroundColor:aw},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:lw},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:lw,borderBottomColor:lw},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:aw,color:Qg}}},{dark:!1}),L5e=Hm.define([{tag:pe.keyword,color:ki},{tag:[pe.name,pe.deleted,pe.character,pe.propertyName,pe.macroName],color:Qu},{tag:[pe.variableName],color:Qu},{tag:[pe.function(pe.variableName)],color:ki},{tag:[pe.labelName],color:I5e},{tag:[pe.color,pe.constant(pe.name),pe.standard(pe.name)],color:ki},{tag:[pe.definition(pe.name),pe.separator],color:dM},{tag:[pe.brace],color:iw},{tag:[pe.annotation],color:fM},{tag:[pe.number,pe.changed,pe.annotation,pe.modifier,pe.self,pe.namespace],color:uM},{tag:[pe.typeName,pe.className],color:ow},{tag:[pe.operator,pe.operatorKeyword],color:dM},{tag:[pe.tagName],color:R5e},{tag:[pe.squareBracket],color:j5e},{tag:[pe.angleBracket],color:Qu},{tag:[pe.attributeName],color:ow},{tag:[pe.regexp],color:ki},{tag:[pe.quote],color:tN},{tag:[pe.string],color:Qu},{tag:pe.link,color:iw,textDecoration:"underline",textUnderlinePosition:"under"},{tag:[pe.url,pe.escape,pe.special(pe.string)],color:Qu},{tag:[pe.meta],color:uM},{tag:[pe.comment],color:lM,fontStyle:"italic"},{tag:pe.strong,fontWeight:"bold",color:ki},{tag:pe.emphasis,fontStyle:"italic",color:ki},{tag:pe.strikethrough,textDecoration:"line-through"},{tag:pe.heading,fontWeight:"bold",color:ki},{tag:pe.special(pe.heading1),fontWeight:"bold",color:ki},{tag:pe.heading1,fontWeight:"bold",color:ki},{tag:[pe.heading2,pe.heading3,pe.heading4],fontWeight:"bold",color:ki},{tag:[pe.heading5,pe.heading6],color:ki},{tag:[pe.atom,pe.bool,pe.special(pe.variableName)],color:Qu},{tag:[pe.processingInstruction,pe.inserted],color:iw},{tag:[pe.contentSeparator],color:ow},{tag:pe.invalid,color:lM,borderBottom:`1px dotted ${fM}`}]),D5e=[O5e,YV(L5e)],pM=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class mf{constructor(e,n,r=0,s=e.length,i,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?a=>i(pM(a)):pM,this.query=this.normalize(n)}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 xs(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 n=xE(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=vo(e);let s=this.normalize(n);if(s.length)for(let i=0,o=r;;i++){let a=s.charCodeAt(i),l=this.match(a,o,this.bufferPos+this.bufferStart);if(i==s.length-1){if(l)return this.value=l,this;break}o==r&&i<n.length&&n.charCodeAt(i)==a&&o++}}}match(e,n,r){let s=null;for(let i=0;i<this.matches.length;i+=2){let o=this.matches[i],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?s={from:this.matches[i+1],to:r}:(this.matches[i]++,a=!0)),a||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:n,to:r}:this.matches.push(1,n)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(mf.prototype[Symbol.iterator]=function(){return this});const Yz={from:-1,to:-1,match:/.*/.exec("")},rN="gm"+(/x/.unicode==null?"":"u");class Xz{constructor(e,n,r,s=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=Yz,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new eH(e,n,r,s,i);this.re=new RegExp(n,rN+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.iter=e.iter();let o=e.lineAt(s);this.curLineStart=o.from,this.matchPos=_y(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.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 n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=_y(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<s||r>this.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const cw=new WeakMap;class Md{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let s=cw.get(e);if(!s||s.from>=r||s.to<=n){let a=new Md(n,e.sliceString(n,r));return cw.set(e,a),a}if(s.from==n&&s.to==r)return s;let{text:i,from:o}=s;return o>n&&(i=e.sliceString(n,o)+i,o=n),s.to<r&&(i+=e.sliceString(s.to,r)),cw.set(e,new Md(o,i)),new Md(n,i.slice(n-o,r-o))}}class eH{constructor(e,n,r,s,i){this.text=e,this.to=i,this.done=!1,this.value=Yz,this.matchPos=_y(e,s),this.re=new RegExp(n,rN+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=Md.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=_y(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Md.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Xz.prototype[Symbol.iterator]=eH.prototype[Symbol.iterator]=function(){return this});function F5e(t){try{return new RegExp(t,rN),!0}catch{return!1}}function _y(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}const $5e=t=>{let{state:e}=t,n=String(e.doc.lineAt(t.state.selection.main.head).number),{close:r,result:s}=zCe(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:e.phrase("go")});return s.then(i=>{let o=i&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.elements.line.value);if(!o){t.dispatch({effects:r});return}let a=e.doc.lineAt(e.selection.main.head),[,l,c,u,f]=o,h=u?+u.slice(1):0,p=c?+c:a.number;if(c&&f){let y=p/100;l&&(y=y*(l=="-"?-1:1)+a.number/e.doc.lines),p=Math.round(e.doc.lines*y)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let m=e.doc.line(Math.max(1,Math.min(e.doc.lines,p))),g=Ce.cursor(m.from+Math.max(0,Math.min(h,m.length)));t.dispatch({effects:[r,He.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},B5e={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},V5e=Ue.define({combine(t){return Wo(t,B5e,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function z5e(t){return[q5e,K5e]}const H5e=ht.mark({class:"cm-selectionMatch"}),U5e=ht.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function mM(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Mn.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Mn.Word)}function W5e(t,e,n,r){return t(e.sliceDoc(n,n+1))==Mn.Word&&t(e.sliceDoc(r-1,r))==Mn.Word}const K5e=nr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(V5e),{state:n}=t,r=n.selection;if(r.ranges.length>1)return ht.none;let s=r.main,i,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return ht.none;let l=n.wordAt(s.head);if(!l)return ht.none;o=n.charCategorizer(s.head),i=n.sliceDoc(l.from,l.to)}else{let l=s.to-s.from;if(l<e.minSelectionLength||l>200)return ht.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),o=n.charCategorizer(s.head),!(mM(o,n,s.from,s.to)&&W5e(o,n,s.from,s.to)))return ht.none}else if(i=n.sliceDoc(s.from,s.to),!i)return ht.none}let a=[];for(let l of t.visibleRanges){let c=new mf(n.doc,i,l.from,l.to);for(;!c.next().done;){let{from:u,to:f}=c.value;if((!o||mM(o,n,u,f))&&(s.empty&&u<=s.from&&f>=s.to?a.push(U5e.range(u,f)):(u>=s.to||f<=s.from)&&a.push(H5e.range(u,f)),a.length>e.maxMatches))return ht.none}}return ht.set(a)}},{decorations:t=>t.decorations}),q5e=He.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),G5e=({state:t,dispatch:e})=>{let{selection:n}=t,r=Ce.create(n.ranges.map(s=>t.wordAt(s.head)||Ce.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function J5e(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let o=!1,a=new mf(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new mf(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(i){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const Z5e=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return G5e({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=J5e(t,r);return s?(e(t.update({selection:t.selection.addRange(Ce.range(s.from,s.to),!1),effects:He.scrollIntoView(s.to)})),!0):!1},zf=Ue.define({combine(t){return Wo(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new uEe(e),scrollToMatch:e=>He.scrollIntoView(e)})}});class tH{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||F5e(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,(n,r)=>r=="n"?`
|
|
773
773
|
`:r=="r"?"\r":r=="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 nEe(this):new X5e(this)}getCursor(e,n=0,r){let s=e.doc?e:Vt.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?ud(this,s,n,r):cd(this,s,n,r)}}class nH{constructor(e){this.spec=e}}function Q5e(t,e,n){return(r,s,i,o)=>{if(n&&!n(r,s,i,o))return!1;let a=r>=o&&s<=o+i.length?i.slice(r-o,s-o):e.doc.sliceString(r,s);return t(a,e,r,s)}}function cd(t,e,n,r){let s;return t.wholeWord&&(s=Y5e(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(s=Q5e(t.test,e,s)),new mf(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:i=>i.toLowerCase(),s)}function Y5e(t,e){return(n,r,s,i)=>((i>n||i+s.length<r)&&(i=Math.max(0,n-2),s=t.sliceString(i,Math.min(t.length,r+2))),(e(Sy(s,n-i))!=Mn.Word||e(Ey(s,n-i))!=Mn.Word)&&(e(Ey(s,r-i))!=Mn.Word||e(Sy(s,r-i))!=Mn.Word))}class X5e extends nH{constructor(e){super(e)}nextMatch(e,n,r){let s=cd(this.spec,e,r,e.doc.length).nextOverlapping();if(s.done){let i=Math.min(e.doc.length,n+this.spec.unquoted.length);s=cd(this.spec,e,0,i).nextOverlapping()}return s.done||s.value.from==n&&s.value.to==r?null:s.value}prevMatchInRange(e,n,r){for(let s=r;;){let i=Math.max(n,s-1e4-this.spec.unquoted.length),o=cd(this.spec,e,i,s),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(i==n)return null;s-=1e4}}prevMatch(e,n,r){let s=this.prevMatchInRange(e,0,n);return s||(s=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=n||s.to!=r)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=cd(this.spec,e,0,e.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=cd(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function eEe(t,e,n){return(r,s,i)=>(!n||n(r,s,i))&&t(i[0],e,r,s)}function ud(t,e,n,r){let s;return t.wholeWord&&(s=tEe(e.charCategorizer(e.selection.main.head))),t.test&&(s=eEe(t.test,e,s)),new Xz(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:s},n,r)}function Sy(t,e){return t.slice(yr(t,e,!1),e)}function Ey(t,e){return t.slice(e,yr(t,e))}function tEe(t){return(e,n,r)=>!r[0].length||(t(Sy(r.input,r.index))!=Mn.Word||t(Ey(r.input,r.index))!=Mn.Word)&&(t(Ey(r.input,r.index+r[0].length))!=Mn.Word||t(Sy(r.input,r.index+r[0].length))!=Mn.Word)}class nEe extends nH{nextMatch(e,n,r){let s=ud(this.spec,e,r,e.doc.length).next();return s.done&&(s=ud(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),o=ud(this.spec,e,i,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(i==n||a.from>i+10))return a;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i<e.match.length)return e.match[i]+r.slice(s)}return n})}matchAll(e,n){let r=ud(this.spec,e,0,e.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=ud(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const Hp=yt.define(),sN=yt.define(),jl=vr.define({create(t){return new uw(H2(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Hp)?t=new uw(n.value.create(),t.panel):n.is(sN)&&(t=new uw(t.query,n.value?iN:null));return t},provide:t=>Op.from(t,e=>e.panel)});class uw{constructor(e,n){this.query=e,this.panel=n}}const rEe=ht.mark({class:"cm-searchMatch"}),sEe=ht.mark({class:"cm-searchMatch cm-searchMatch-selected"}),iEe=nr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(jl))}update(t){let e=t.state.field(jl);(e!=t.startState.field(jl)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ht.none;let{view:n}=this,r=new La;for(let s=0,i=n.visibleRanges,o=i.length;s<o;s++){let{from:a,to:l}=i[s];for(;s<o-1&&l>i[s+1].from-500;)l=i[++s].to;t.highlight(n.state,a,l,(c,u)=>{let f=n.state.selection.ranges.some(h=>h.from==c&&h.to==u);r.add(c,u,f?sEe:rEe)})}return r.finish()}},{decorations:t=>t.decorations});function Km(t){return e=>{let n=e.state.field(jl,!1);return n&&n.query.spec.valid?t(e,n):iH(e)}}const Ny=Km((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Ce.single(r.from,r.to),i=t.state.facet(zf);return t.dispatch({selection:s,effects:[oN(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),sH(t),!0}),Ty=Km((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Ce.single(s.from,s.to),o=t.state.facet(zf);return t.dispatch({selection:i,effects:[oN(t,s),o.scrollToMatch(i.main,t)],userEvent:"select.search"}),sH(t),!0}),oEe=Km((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Ce.create(n.map(r=>Ce.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),aEe=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],o=0;for(let a=new mf(t.doc,t.sliceDoc(r,s));!a.next().done;){if(i.length>1e3)return!1;a.value.from==r&&(o=i.length),i.push(Ce.range(a.value.from,a.value.to))}return e(t.update({selection:Ce.create(i,o),userEvent:"select.search.matches"})),!0},gM=Km((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let o=i,a=[],l,c,u=[];o.from==r&&o.to==s&&(c=n.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(n,o.from,o.to),u.push(He.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let f=t.state.changes(a);return o&&(l=Ce.single(o.from,o.to).map(f),u.push(oN(t,o)),u.push(n.facet(zf).scrollToMatch(l.main,t))),t.dispatch({changes:f,selection:l,effects:u,userEvent:"input.replace"}),!0}),lEe=Km((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:o}=s;return{from:i,to:o,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:He.announce.of(r),userEvent:"input.replace.all"}),!0});function iN(t){return t.state.facet(zf).createPanel(t)}function H2(t,e){var n,r,s,i,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet(zf);return new tH({search:((n=e==null?void 0:e.literal)!==null&&n!==void 0?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e==null?void 0:e.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(s=e==null?void 0:e.literal)!==null&&s!==void 0?s:c.literal,regexp:(i=e==null?void 0:e.regexp)!==null&&i!==void 0?i:c.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function rH(t){let e=OE(t,iN);return e&&e.dom.querySelector("[main-field]")}function sH(t){let e=rH(t);e&&e==t.root.activeElement&&e.select()}const iH=t=>{let e=t.state.field(jl,!1);if(e&&e.panel){let n=rH(t);if(n&&n!=t.root.activeElement){let r=H2(t.state,e.query.spec);r.valid&&t.dispatch({effects:Hp.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[sN.of(!0),e?Hp.of(H2(t.state,e.query.spec)):yt.appendConfig.of(fEe)]});return!0},oH=t=>{let e=t.state.field(jl,!1);if(!e||!e.panel)return!1;let n=OE(t,iN);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:sN.of(!1)}),!0},cEe=[{key:"Mod-f",run:iH,scope:"editor search-panel"},{key:"F3",run:Ny,shift:Ty,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Ny,shift:Ty,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:oH,scope:"editor search-panel"},{key:"Mod-Shift-l",run:aEe},{key:"Mod-Alt-g",run:$5e},{key:"Mod-d",run:Z5e,preventDefault:!0}];class uEe{constructor(e){this.view=e;let n=this.query=e.state.field(jl).query.spec;this.commit=this.commit.bind(this),this.searchField=ln("input",{value:n.search,placeholder:Ns(e,"Find"),"aria-label":Ns(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ln("input",{value:n.replace,placeholder:Ns(e,"Replace"),"aria-label":Ns(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ln("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=ln("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=ln("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,o){return ln("button",{class:"cm-button",name:s,onclick:i,type:"button"},o)}this.dom=ln("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>Ny(e),[Ns(e,"next")]),r("prev",()=>Ty(e),[Ns(e,"previous")]),r("select",()=>oEe(e),[Ns(e,"all")]),ln("label",null,[this.caseField,Ns(e,"match case")]),ln("label",null,[this.reField,Ns(e,"regexp")]),ln("label",null,[this.wordField,Ns(e,"by word")]),...e.state.readOnly?[]:[ln("br"),this.replaceField,r("replace",()=>gM(e),[Ns(e,"replace")]),r("replaceAll",()=>lEe(e),[Ns(e,"replace all")])],ln("button",{name:"close",onclick:()=>oH(e),"aria-label":Ns(e,"close"),type:"button"},["×"])])}commit(){let e=new tH({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:Hp.of(e)}))}keydown(e){eCe(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ty:Ny)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),gM(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Hp)&&!r.value.eq(this.query)&&this.setQuery(r.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(zf).top}}function Ns(t,e){return t.state.phrase(e)}const Yg=30,Xg=/[\s\.,:;?!]/;function oN(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-Yg),o=Math.min(s,n+Yg),a=t.state.sliceDoc(i,o);if(i!=r.from){for(let l=0;l<Yg;l++)if(!Xg.test(a[l+1])&&Xg.test(a[l])){a=a.slice(l);break}}if(o!=s){for(let l=a.length-1;l>a.length-Yg;l--)if(!Xg.test(a[l-1])&&Xg.test(a[l])){a=a.slice(0,l);break}}return He.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${r.number}.`)}const dEe=He.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"}}),fEe=[jl,lc.low(iEe),dEe];class xM{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class Ec{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(Up).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((p,m)=>p.from-m.from||p.to-m.to),o=new La,a=[],l=0,c=r.doc.iter(),u=0,f=r.doc.length;for(let p=0;;){let m=p==i.length?null:i[p];if(!m&&!a.length)break;let g,y;if(a.length)g=l,y=a.reduce((w,k)=>Math.min(w,k.to),m&&m.from>g?m.from:1e8);else{if(g=m.from,g>f)break;y=m.to,a.push(m),p++}for(;p<i.length;){let w=i[p];if(w.from==g&&(w.to>w.from||w.to==g))a.push(w),p++,y=Math.min(w.to,y);else{y=Math.min(w.from,y);break}}y=Math.min(y,f);let v=!1;if(a.some(w=>w.from==g&&(w.to==y||y==f))&&(v=g==y,!v&&y-g<10)){let w=g-(u+c.value.length);w>0&&(c.next(w),u=g);for(let k=g;;){if(k>=y){v=!0;break}if(!c.lineBreak&&u+c.value.length>k)break;k=u+c.value.length,u+=c.value.length,c.next()}}let b=SEe(a);if(v)o.add(g,g,ht.widget({widget:new wEe(b),diagnostics:a.slice()}));else{let w=a.reduce((k,C)=>C.markClass?k+" "+C.markClass:k,"");o.add(g,y,ht.mark({class:"cm-lintRange cm-lintRange-"+b+w,diagnostics:a.slice(),inclusiveEnd:a.some(k=>k.to>y)}))}if(l=y,l==f)break;for(let w=0;w<a.length;w++)a[w].to<=l&&a.splice(w--,1)}let h=o.finish();return new Ec(h,n,Jl(h))}}function Jl(t,e=null,n=0){let r=null;return t.between(n,1e9,(s,i,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new xM(s,i,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new xM(r.from,i,r.diagnostic)}}),r}function hEe(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(Up).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(aH))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function pEe(t,e){return t.field(Ls,!1)?e:e.concat(yt.appendConfig.of(EEe))}const aH=yt.define(),aN=yt.define(),lH=yt.define(),Ls=vr.define({create(){return new Ec(ht.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=Jl(n,t.selected.diagnostic,i)||Jl(n,null,i)}!n.size&&s&&e.state.facet(Up).autoPanel&&(s=null),t=new Ec(n,s,r)}for(let n of e.effects)if(n.is(aH)){let r=e.state.facet(Up).autoPanel?n.value.length?Wp.open:null:t.panel;t=Ec.init(n.value,r,e.state)}else n.is(aN)?t=new Ec(t.diagnostics,n.value?Wp.open:null,t.selected):n.is(lH)&&(t=new Ec(t.diagnostics,t.panel,n.value));return t},provide:t=>[Op.from(t,e=>e.panel),He.decorations.from(t,e=>e.diagnostics)]}),mEe=ht.mark({class:"cm-lintRange cm-lintRange-active"});function gEe(t,e,n){let{diagnostics:r}=t.state.field(Ls),s,i=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(l,c,{spec:u})=>{if(e>=l&&e<=c&&(l==c||(e>l||n>0)&&(e<c||n<0)))return s=u.diagnostics,i=l,o=c,!1});let a=t.state.facet(Up).tooltipFilter;return s&&a&&(s=a(s,t.state)),s?{pos:i,end:o,above:t.state.doc.lineAt(i).to<o,create(){return{dom:xEe(t,s)}}}:null}function xEe(t,e){return ln("ul",{class:"cm-tooltip-lint"},e.map(n=>uH(t,n,!1)))}const yEe=t=>{let e=t.state.field(Ls,!1);(!e||!e.panel)&&t.dispatch({effects:pEe(t.state,[aN.of(!0)])});let n=OE(t,Wp.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},yM=t=>{let e=t.state.field(Ls,!1);return!e||!e.panel?!1:(t.dispatch({effects:aN.of(!1)}),!0)},bEe=t=>{let e=t.state.field(Ls,!1);if(!e)return!1;let n=t.state.selection.main,r=Jl(e.diagnostics,null,n.to+1);return!r&&(r=Jl(e.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},vEe=[{key:"Mod-Shift-m",run:yEe,preventDefault:!0},{key:"F8",run:bEe}],Up=Ue.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Wo(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:bM,tooltipFilter:bM,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,s,i)=>e(r,s,i)||n(r,s,i):e:n,autoPanel:(e,n)=>e||n})}}});function bM(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function cH(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let s=n[r];if(/[a-zA-Z]/.test(s)&&!e.some(i=>i.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function uH(t,e,n){var r;let s=n?cH(e.actions):[];return ln("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},ln("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,o)=>{let a=!1,l=p=>{if(p.preventDefault(),a)return;a=!0;let m=Jl(t.state.field(Ls).diagnostics,e);m&&i.apply(t,m.from,m.to)},{name:c}=i,u=s[o]?c.indexOf(s[o]):-1,f=u<0?c:[c.slice(0,u),ln("u",c.slice(u,u+1)),c.slice(u+1)],h=i.markClass?" "+i.markClass:"";return ln("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&ln("div",{class:"cm-diagnosticSource"},e.source))}class wEe extends Ko{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return ln("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class vM{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=uH(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Wp{constructor(e){this.view=e,this.items=[];let n=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)yM(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:i}=this.items[this.selectedIndex],o=cH(i.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==s.keyCode){let l=Jl(this.view.state.field(Ls).diagnostics,i);l&&i.actions[a].apply(e,l.from,l.to)}}else return;s.preventDefault()}},r=s=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(s.target)&&this.moveSelection(i)};this.list=ln("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=ln("div",{class:"cm-panel-lint"},this.list,ln("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>yM(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ls).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(Ls),r=0,s=!1,i=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,l,{spec:c})=>{for(let u of c.diagnostics){if(o.has(u))continue;o.add(u);let f=-1,h;for(let p=r;p<this.items.length;p++)if(this.items[p].diagnostic==u){f=p;break}f<0?(h=new vM(this.view,u),this.items.splice(r,0,h),s=!0):(h=this.items[f],f>r&&(this.items.splice(r,f-r),s=!0)),n&&h.diagnostic==n.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),i=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new vM(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let c=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/c:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Ls),r=Jl(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:lH.of(r)})}static open(e){return new Wp(e)}}function kEe(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function ex(t){return kEe(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const CEe=He.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:ex("#d11")},".cm-lintRange-warning":{backgroundImage:ex("orange")},".cm-lintRange-info":{backgroundImage:ex("#999")},".cm-lintRange-hint":{backgroundImage:ex("#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}}});function _Ee(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function SEe(t){let e="hint",n=1;for(let r of t){let s=_Ee(r.severity);s>n&&(n=s,e=r.severity)}return e}const EEe=[Ls,He.decorations.compute([Ls],t=>{let{selected:e,panel:n}=t.field(Ls);return!e||!n||e.from==e.to?ht.none:ht.set([mEe.range(e.from,e.to)])}),BCe(gEe,{hideOn:hEe}),CEe],NEe=[RV(),t2e(),xCe(),_Se(),Q2e(),oCe(),dCe(),Vt.allowMultipleSelections.of(!0),D2e(),YV(t_e,{fallback:!0}),l_e(),nSe(),hSe(),ACe(),RCe(),CCe(),z5e(),Bm.of([...oSe,...E5e,...cEe,...MSe,...q2e,...yz,...vEe])],TEe=j.forwardRef(({title:t,children:e},n)=>{const r=Lo(Ou);return j.createElement(uS,{delayDuration:100},j.createElement(dS,null,j.createElement(fS,{ref:n,asChild:!0},j.createElement("span",{className:Ae.tooltipTrigger},e)),j.createElement(hS,{container:r==null?void 0:r.current},j.createElement(pS,{className:cn(Ae.tooltipContent),sideOffset:10},t))))}),AEe=j.forwardRef(({children:t,className:e,...n},r)=>j.createElement(dX,{...n,ref:r,className:cn(e,Ae.selectItem)},j.createElement(fX,null,t))),IEe=({title:t,placeholder:e,className:n})=>{const[r,s]=Xi(Ji,Ha);return j.createElement(TEe,{title:t},j.createElement(iX,{"aria-label":e,className:cn(Ae.selectTrigger,n),"data-toolbar-item":!0,disabled:r},j.createElement(oX,{placeholder:e}),j.createElement(aX,{className:Ae.selectDropdownArrow},s("arrow_drop_down"))))},jEe=({children:t,className:e=Ae.selectContainer})=>{const n=Lo(Ou);return j.createElement(lX,{container:n==null?void 0:n.current},j.createElement(cX,{className:cn(e,"mdxeditor-select-content"),onCloseAutoFocus:r=>{r.preventDefault()},position:"popper"},j.createElement(uX,{"data-editor-dropdown":!0},t)))},REe=t=>j.createElement(sX,{value:t.value||"",onValueChange:t.onChange,disabled:t.disabled},j.createElement(IEe,{title:t.triggerTitle,placeholder:t.placeholder}),j.createElement(jEe,null,t.items.map((e,n)=>e==="separator"?j.createElement(hX,{key:n}):j.createElement(AEe,{key:n,value:e.value},e.label)))),wM="__EMPTY_VALUE__",dH=({language:t,nodeKey:e,code:n,focusEmitter:r})=>{const s=Ua(),{parentEditor:i,lexicalNode:o}=JC(),[a,l,c,u,f]=Xi(Ji,W2,K2,Ha,U2),h=T5e(e,"codeblock",t,r),{setCode:p}=JC(),m=j.useRef(null),g=j.useRef(null),y=j.useRef(p);return y.current=p,h.current={getCodemirror:()=>m.current},j.useEffect(()=>{const v=g.current;return(async()=>{const b=[...l,NEe,D5e,RV(),Bm.of([N5e]),He.lineWrapping,He.updateListener.of(({state:w})=>{y.current(w.doc.toString())}),He.domEventHandlers({focus:()=>{i.update(()=>{Bn(null)})}})];if(a&&b.push(Vt.readOnly.of(!0)),t!==""&&c){const w=A5e.find(k=>k.name===t||k.alias.includes(t)||k.extensions.includes(t));if(w)try{const k=await w.load();b.push(k.extension)}catch{console.warn("failed to load language support for",t)}}v.innerHTML="",m.current=new He({parent:v,state:Vt.create({doc:n,extensions:b})}),v.addEventListener("keydown",kM)})(),()=>{var b;(b=m.current)==null||b.destroy(),m.current=null,v.removeEventListener("keydown",kM)}},[a,t,...l]),j.createElement("div",{className:Ae.codeMirrorWrapper},j.createElement("div",{className:Ae.codeMirrorToolbar},j.createElement(REe,{disabled:a,value:t,onChange:v=>{i.update(()=>{o.setLanguage(v===wM?"":v),setTimeout(()=>{i.update(()=>{o.getLatest().select()})})})},triggerTitle:s("codeBlock.selectLanguage","Select code block language"),placeholder:s("codeBlock.inlineLanguage","Language"),items:Object.entries(f).map(([v,b])=>({value:v||wM,label:b}))}),j.createElement("button",{className:Ae.iconButton,type:"button",disabled:a,title:s("codeblock.delete","Delete code block"),onClick:v=>{v.preventDefault(),i.update(()=>{o.remove()})}},u("delete_small"))),j.createElement("div",{ref:g}))};function kM(t){t.stopPropagation()}const U2=qe({js:"JavaScript",ts:"TypeScript",tsx:"TypeScript (React)",jsx:"JavaScript (React)",css:"CSS"}),MEe=Wn(t=>{t.link(t.pipe(MEe,$l(({language:e,code:n})=>({code:n,language:e,meta:""}))),aB)}),W2=qe([]),K2=qe(!0),PEe=xi({update(t,e){t.pubIn({[U2]:e==null?void 0:e.codeBlockLanguages,[W2]:(e==null?void 0:e.codeMirrorExtensions)??[],[K2]:(e==null?void 0:e.autoLoadLanguageSupport)??!0})},init(t,e){t.pubIn({[U2]:e==null?void 0:e.codeBlockLanguages,[W2]:(e==null?void 0:e.codeMirrorExtensions)??[],[Wve]:OEe((e==null?void 0:e.codeBlockLanguages)??{}),[K2]:(e==null?void 0:e.autoLoadLanguageSupport)??!0})}});function OEe(t){return{match(e,n){return Object.hasOwn(t,e??"")&&!n},priority:1,Editor:dH}}function LEe({url:t,title:e,text:n,onSubmit:r,onCancel:s,linkAutocompleteSuggestions:i,showLinkTitleField:o,showAnchorTextField:a}){const{register:l,handleSubmit:c,control:u,setValue:f,reset:h}=L$({values:{url:t,title:e,text:n}}),p=Ua();return j.createElement("form",{onSubmit:m=>{c(r)(m),m.stopPropagation(),m.preventDefault()},onReset:m=>{m.stopPropagation(),s()},onKeyDown:m=>{m.key==="Escape"&&(m.stopPropagation(),s())},className:cn(Ae.multiFieldForm,Ae.linkDialogEditForm)},j.createElement("div",{className:Ae.formField},j.createElement("label",{htmlFor:"link-url"},p("createLink.url","URL")),j.createElement(eB,{register:l,initialInputValue:t,inputName:"url",suggestions:i,setValue:f,control:u,placeholder:p("createLink.urlPlaceholder","Select or paste an URL"),autofocus:!0})),a?j.createElement("div",{className:Ae.formField},j.createElement("label",{htmlFor:"link-text",title:p("createLink.textTooltip","The text to be displayed for the link")},p("createLink.text","Anchor text")),j.createElement("input",{id:"link-text",className:Ae.textInput,size:40,...l("text")})):null,o?j.createElement("div",{className:Ae.formField},j.createElement("label",{htmlFor:"link-title",title:p("createLink.titleTooltip","The link's title attribute, shown on hover")},p("createLink.title","Link title")),j.createElement("input",{id:"link-title",className:Ae.textInput,size:40,...l("title")})):null,j.createElement("div",{style:{display:"flex",justifyContent:"flex-end",gap:"var(--spacing-2)"}},j.createElement("button",{type:"submit",title:p("createLink.saveTooltip","Set URL"),"aria-label":p("createLink.saveTooltip","Set URL"),className:cn(Ae.primaryButton)},p("dialogControls.save","Save")),j.createElement("button",{type:"reset",title:p("createLink.cancelTooltip","Cancel change"),"aria-label":p("createLink.cancelTooltip","Cancel change"),className:cn(Ae.secondaryButton)},p("dialogControls.cancel","Cancel"))))}const DEe=()=>{const[t,e,n,r,s,i,o]=Xi(Ou,Rn,Ha,fs,yH,bH,wH),a=Ms(fH),l=Ms(hH),c=Ms(pH),u=Ms(mH),f=Ms(gH);j.useEffect(()=>{const v=()=>{e==null||e.getEditorState().read(()=>{a(!0)})};return window.addEventListener("resize",v),window.addEventListener("scroll",v),()=>{window.removeEventListener("resize",v),window.removeEventListener("scroll",v)}},[e,a]);const[h,p]=j.useState(!1),m=Ua();if(r.type==="inactive")return null;const g=r.rectangle,y=r.type==="preview"&&r.url.startsWith("http");return j.createElement(lb,{open:!0},j.createElement(vY,{"data-visible":r.type==="edit",className:Ae.linkDialogAnchor,style:{top:`${g.top}px`,left:`${g.left}px`,width:`${g.width}px`,height:`${g.height}px`}}),j.createElement(cb,{container:t==null?void 0:t.current},j.createElement(W9,{className:cn(Ae.linkDialogPopoverContent),sideOffset:5,onOpenAutoFocus:v=>{v.preventDefault()},key:r.linkNodeKey},r.type==="edit"&&j.createElement(LEe,{url:r.url,title:r.title,text:r.text,onSubmit:l,onCancel:c.bind(null),linkAutocompleteSuggestions:s,showLinkTitleField:o,showAnchorTextField:r.withAnchorText}),r.type==="preview"&&j.createElement(j.Fragment,null,j.createElement("a",{className:Ae.linkDialogPreviewAnchor,href:r.url,...y?{target:"_blank",rel:"noreferrer"}:{},onClick:v=>{i!==null&&(v.preventDefault(),i(r.url))},title:y?m("linkPreview.open","Open {{url}} in new window",{url:r.url}):r.url},j.createElement("span",null,r.url),y&&n("open_in_new")),j.createElement(dw,{onClick:()=>{u()},title:m("linkPreview.edit","Edit link URL"),"aria-label":m("linkPreview.edit","Edit link URL")},n("edit")),j.createElement(uS,null,j.createElement(dS,{open:h},j.createElement(fS,{asChild:!0},j.createElement(dw,{title:m("linkPreview.copyToClipboard","Copy to clipboard"),"aria-label":m("linkPreview.copyToClipboard","Copy to clipboard"),onClick:()=>{window.navigator.clipboard.writeText(r.url).then(()=>{p(!0),setTimeout(()=>{p(!1)},1e3)})}},n(h?"check":"content_copy"))),j.createElement(hS,{container:t==null?void 0:t.current},j.createElement(pS,{className:cn(Ae.tooltipContent),sideOffset:5},m("linkPreview.copied","Copied!"),j.createElement(xD,null))))),j.createElement(dw,{title:m("linkPreview.remove","Remove link"),"aria-label":m("linkPreview.remove","Remove link"),onClick:()=>{f()}},n("link_off"))),j.createElement(Y_,{className:Ae.popoverArrow}))))},dw=j.forwardRef(({className:t,...e},n)=>j.createElement("button",{className:cn(Ae.actionButton,t),ref:n,...e}));function q2(t){if(!t)return null;const e=xye(t);if(e===null)return null;const n=e.getParent();return gs(n)?n:gs(e)?e:null}const fH=Wn(),fs=qe({type:"inactive"},t=>{t.pub(kp,e=>e.registerCommand(vm,()=>t.getValue(fs).type==="preview"?(t.pub(fs,{type:"inactive"}),!0):!1,_n)),t.sub(t.pipe(Cp),e=>{e!=="rich-text"&&t.pub(fs,{type:"inactive"})}),t.pub(kp,e=>e.registerCommand(qS,n=>{if(n.key==="k"&&(a$?n.metaKey:n.ctrlKey)&&!t.getValue(Ji)){const r=Ie();return _e(r)?(t.pub(xH),n.stopPropagation(),n.preventDefault(),!0):!1}return!1},nC)),t.sub(t.pipe(mH,Fn(fs,Rn)),([,e,n])=>{if(e.type==="preview")setTimeout(()=>{n==null||n.getEditorState().read(()=>{const r=un(e.linkNodeKey),s=gs(r)?r.getTextContent().length>0&&r.getChildrenSize()<=1:!1,i=s&&r?r.getTextContent():"";t.pub(fs,{type:"edit",initialUrl:e.url,url:e.url,title:e.title,text:i,withAnchorText:s,linkNodeKey:e.linkNodeKey,rectangle:e.rectangle})})});else throw new Error("Cannot switch to edit mode when not in preview mode")}),t.sub(t.pipe(hH,Fn(Rn,fs,of)),([e,n,r,s])=>{var i,o,a;const l=((i=e.text)==null?void 0:i.trim())??"",c=((o=e.url)==null?void 0:o.trim())??"",u=((a=e.title)==null?void 0:a.trim())??"";if(c!==""){if(s!=null&&s.isCollapsed()){const f=l||u||c;n==null||n.update(()=>{const h=q2(s);if(h)if(Ii(h)){const p=Oa(c,{title:u});p.append(fn(l)),h.replace(p),p.select()}else h.setURL(c),h.setTitle(u),CM(h.getFirstChild(),l);else{const p=Oa(c,{title:u});p.append(fn(f)),If([p]),p.select()}},{discrete:!0})}else n==null||n.update(()=>{CM(s==null?void 0:s.anchor.getNode(),l)}),n==null||n.dispatchCommand(af,{url:c,title:u});t.pub(fs,{type:"preview",linkNodeKey:r.linkNodeKey,rectangle:r.rectangle,title:u,url:c})}else r.type==="edit"&&r.initialUrl!==""&&(n==null||n.dispatchCommand(af,null)),t.pub(fs,{type:"inactive"})}),t.link(t.pipe(pH,Fn(fs,Rn),$l(([,e,n])=>{if(e.type==="edit")return n==null||n.focus(),e.initialUrl===""?{type:"inactive"}:{type:"preview",url:e.initialUrl,linkNodeKey:e.linkNodeKey,rectangle:e.rectangle};throw new Error("Cannot cancel edit when not in edit mode")})),fs),t.link(t.pipe(t.combine(of,fH),Fn(Rn,fs,Ji),$l(([[e],n,r,s])=>{if(_e(e)&&n&&!s){const i=q2(e);if(!e.isCollapsed())return{type:"inactive"};if(i){const o=s$(n);return o?{type:"preview",url:i.getURL(),linkNodeKey:i.getKey(),title:i.getTitle(),rectangle:o}:{type:"inactive"}}else return{type:"inactive"}}else return{type:"inactive"}})),fs)}),hH=Wn(),pH=sc();sc();const mH=sc(),gH=sc(t=>{t.sub(t.pipe(gH,Fn(Rn)),([,e])=>{e==null||e.dispatchCommand(af,null)})}),xH=sc(t=>{t.sub(t.pipe(xH,Fn(of,Rn),ym(([,e])=>_e(e))),([,e,n])=>{n==null||n.focus(()=>{setTimeout(()=>{n.getEditorState().read(()=>{const r=q2(e),s=s$(n),i=(r==null?void 0:r.getURL())??"",o=(r==null?void 0:r.getURL())??"",a=(r==null?void 0:r.getTitle())??"",l=(r==null?void 0:r.getKey())??"",c=r?r.getTextContent().length>0&&r.getChildrenSize()<=1:!!(e!=null&&e.isCollapsed()),u=c&&r?r.getTextContent():"";t.pub(fs,{type:"edit",initialUrl:i,url:o,title:a,text:u,withAnchorText:c,linkNodeKey:l,rectangle:s})})})})})}),yH=qe([]),bH=qe(null),vH=qe(null,t=>{t.pub(kp,e=>{function n(r){const[s,i]=t.getValues([Ji,vH]);!s||i===null||e.update(()=>{const o=Fo(r.target);if(o!==null){const a=Bi(o,l=>l instanceof Wa);a!==null&&i(r,a,a.getURL())}})}return e.registerRootListener((r,s)=>{r&&r.addEventListener("click",n),s&&s.removeEventListener("click",n)})})});function CM(t,e){Re(t)&&e&&(t.setTextContent(e),t.selectStart())}const wH=qe(!0),FEe=xi({init(t,e){t.pub(Lu,(e==null?void 0:e.LinkDialog)??DEe),t.pub(bH,(e==null?void 0:e.onClickLinkCallback)??null),t.pub(vH,(e==null?void 0:e.onReadOnlyClickLinkCallback)??null),t.pub(wH,(e==null?void 0:e.showLinkTitleField)??!0)},update(t,e={}){t.pub(yH,e.linkAutocompleteSuggestions??[])}});var fw={exports:{}},_M;function $Ee(){return _M||(_M=1,(function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
|
|
774
774
|
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
775
775
|
*
|
|
@@ -801,7 +801,7 @@ ${l}`.trim();return[o,{kind:"tool_result",ts:e,toolUseId:_r(n.callID)||_r(n.id,r
|
|
|
801
801
|
`}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
|
|
802
802
|
`}),n}function t4(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function n4(t,e){const n=pAe(t,e),r=n.one(t,void 0),s=fAe(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
|
|
803
803
|
`},s),i}function bAe(t,e){return t&&"run"in t?async function(n,r){const s=n4(n,{file:r,...e});await t.run(s,r)}:function(n,r){return n4(n,{file:r,...t||e})}}function r4(t){if(t)throw t}var vw,s4;function vAe(){if(s4)return vw;s4=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(c){return typeof Array.isArray=="function"?Array.isArray(c):e.call(c)==="[object Array]"},i=function(c){if(!c||e.call(c)!=="[object Object]")return!1;var u=t.call(c,"constructor"),f=c.constructor&&c.constructor.prototype&&t.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!f)return!1;var h;for(h in c);return typeof h>"u"||t.call(c,h)},o=function(c,u){n&&u.name==="__proto__"?n(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},a=function(c,u){if(u==="__proto__")if(t.call(c,u)){if(r)return r(c,u).value}else return;return c[u]};return vw=function l(){var c,u,f,h,p,m,g=arguments[0],y=1,v=arguments.length,b=!1;for(typeof g=="boolean"&&(b=g,g=arguments[1]||{},y=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});y<v;++y)if(c=arguments[y],c!=null)for(u in c)f=a(g,u),h=a(c,u),g!==h&&(b&&h&&(i(h)||(p=s(h)))?(p?(p=!1,m=f&&s(f)?f:[]):m=f&&i(f)?f:{},o(g,{name:u,newValue:l(b,m,h)})):typeof h<"u"&&o(g,{name:u,newValue:h}));return g},vw}var wAe=vAe();const ww=em(wAe);function e_(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function kAe(){const t=[],e={run:n,use:r};return e;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...s);function a(l,...c){const u=t[++i];let f=-1;if(l){o(l);return}for(;++f<s.length;)(c[f]===null||c[f]===void 0)&&(c[f]=s[f]);s=c,u?CAe(u,a)(...c):o(null,...c)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return t.push(s),e}}function CAe(t,e){let n;return r;function r(...o){const a=t.length>o.length;let l;a&&o.push(s);try{l=t.apply(this,o)}catch(c){const u=c;if(a&&n)throw u;return s(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(o,...a){n||(n=!0,e(o,...a))}function i(o){s(null,o)}}const ho={basename:_Ae,dirname:SAe,extname:EAe,join:NAe,sep:"/"};function _Ae(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Jm(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,a=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),a>-1&&(t.codePointAt(s)===e.codePointAt(a--)?a<0&&(r=s):(a=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function SAe(t){if(Jm(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function EAe(t){Jm(t);let e=t.length,n=-1,r=0,s=-1,i=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),a===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function NAe(...t){let e=-1,n;for(;++e<t.length;)Jm(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":TAe(n)}function TAe(t){Jm(t);const e=t.codePointAt(0)===47;let n=AAe(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function AAe(t,e){let n="",r=0,s=-1,i=0,o=-1,a,l;for(;++o<=t.length;){if(o<t.length)a=t.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(s===o-1||i===1))if(s!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,o):n=t.slice(s+1,o),r=o-s-1;s=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function Jm(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const IAe={cwd:jAe};function jAe(){return"/"}function t_(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function RAe(t){if(typeof t=="string")t=new URL(t);else if(!t_(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return MAe(t)}function MAe(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(e)}const kw=["history","path","basename","stem","extname","dirname"];class lU{constructor(e){let n;e?t_(e)?n={path:e}:typeof e=="string"||PAe(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":IAe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<kw.length;){const i=kw[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)kw.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?ho.basename(this.path):void 0}set basename(e){_w(e,"basename"),Cw(e,"basename"),this.path=ho.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?ho.dirname(this.path):void 0}set dirname(e){i4(this.basename,"dirname"),this.path=ho.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?ho.extname(this.path):void 0}set extname(e){if(Cw(e,"extname"),i4(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ho.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){t_(e)&&(e=RAe(e)),_w(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?ho.basename(this.path,this.extname):void 0}set stem(e){_w(e,"stem"),Cw(e,"stem"),this.path=ho.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const s=this.message(e,n,r);throw s.fatal=!0,s}info(e,n,r){const s=this.message(e,n,r);return s.fatal=void 0,s}message(e,n,r){const s=new Qt(e,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Cw(t,e){if(t&&t.includes(ho.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+ho.sep+"`")}function _w(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function i4(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function PAe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const OAe=(function(t){const r=this.constructor.prototype,s=r[t],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),LAe={}.hasOwnProperty;class kN extends OAe{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=kAe()}copy(){const e=new kN;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(ww(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Nw("data",this.frozen),this.namespace[e]=n,this):LAe.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Nw("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(e,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=ix(e),r=this.parser||this.Parser;return Sw("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),Sw("process",this.parser||this.Parser),Ew("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const a=ix(e),l=r.parse(a);r.run(l,a,function(u,f,h){if(u||!f||!h)return c(u);const p=f,m=r.stringify(p,h);$Ae(m)?h.value=m:h.result=m,c(u,h)});function c(u,f){u||!f?o(u):i?i(f):n(void 0,f)}}}processSync(e){let n=!1,r;return this.freeze(),Sw("processSync",this.parser||this.Parser),Ew("processSync",this.compiler||this.Compiler),this.process(e,s),a4("processSync","process",n),r;function s(i,o){n=!0,r4(i),r=o}}run(e,n,r){o4(e),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,a){const l=ix(n);s.run(e,l,c);function c(u,f,h){const p=f||e;u?a(u):o?o(p):r(void 0,p,h)}}}runSync(e,n){let r=!1,s;return this.run(e,n,i),a4("runSync","run",r),s;function i(o,a){r4(o),s=a,r=!0}}stringify(e,n){this.freeze();const r=ix(n),s=this.compiler||this.Compiler;return Ew("stringify",s),o4(e),s(e,r)}use(e,...n){const r=this.attachers,s=this.namespace;if(Nw("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else if(typeof e=="object")Array.isArray(e)?a(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...f]=c;l(u,f)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(s.settings=ww(!0,s.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const f=c[u];i(f)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===c){h=f;break}if(h===-1)r.push([c,...u]);else if(u.length>0){let[p,...m]=u;const g=r[h][1];e_(g)&&e_(p)&&(p=ww(!0,g,p)),r[h]=[c,p,...m]}}}}const DAe=new kN().freeze();function Sw(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Ew(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Nw(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function o4(t){if(!e_(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function a4(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function ix(t){return FAe(t)?t:new lU(t)}function FAe(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function $Ae(t){return typeof t=="string"||BAe(t)}function BAe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const VAe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",l4=[],c4={allowDangerousHtml:!0},zAe=/^(https?|ircs?|mailto|xmpp)$/i,HAe=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function UAe(t){const e=WAe(t),n=KAe(t);return qAe(e.runSync(e.parse(n),n),t)}function WAe(t){const e=t.rehypePlugins||l4,n=t.remarkPlugins||l4,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...c4}:c4;return DAe().use(MTe).use(n).use(bAe,r).use(e)}function KAe(t){const e=t.children||"",n=new lU;return typeof e=="string"&&(n.value=e),n}function qAe(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||GAe;for(const u of HAe)Object.hasOwn(e,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+VAe+u.id,void 0);return T5(t,c),xTe(t,{Fragment:d.Fragment,components:s,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function c(u,f,h){if(u.type==="raw"&&h&&typeof f=="number")return o?h.children.splice(f,1):h.children[f]={type:"text",value:u.value},f;if(u.type==="element"){let p;for(p in bw)if(Object.hasOwn(bw,p)&&Object.hasOwn(u.properties,p)){const m=u.properties[p],g=bw[p];(g===null||g.includes(u.tagName))&&(u.properties[p]=l(String(m||""),p,u))}}if(u.type==="element"){let p=n?!n.includes(u.tagName):i?i.includes(u.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(u,f,h)),p&&h&&typeof f=="number")return a&&u.children?h.children.splice(f,1,...u.children):h.children.splice(f,1),f}}}function GAe(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||zAe.test(t.slice(0,e))?t:""}function JAe(t,e,n){const s=e1((n||{}).ignore||[]),i=ZAe(e);let o=-1;for(;++o<i.length;)U7(t,"text",a);function a(c,u){let f=-1,h;for(;++f<u.length;){const p=u[f],m=h?h.children:void 0;if(s(p,m?m.indexOf(p):void 0,h))return;h=p}if(h)return l(c,u)}function l(c,u){const f=u[u.length-1],h=i[o][0],p=i[o][1];let m=0;const y=f.children.indexOf(c);let v=!1,b=[];h.lastIndex=0;let w=h.exec(c.value);for(;w;){const k=w.index,C={index:w.index,input:w.input,stack:[...u,c]};let _=p(...w,C);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?h.lastIndex=k+1:(m!==k&&b.push({type:"text",value:c.value.slice(m,k)}),Array.isArray(_)?b.push(..._):_&&b.push(_),m=k+w[0].length,v=!0),!h.global)break;w=h.exec(c.value)}return v?(m<c.value.length&&b.push({type:"text",value:c.value.slice(m)}),f.children.splice(y,1,...b)):b=[c],y+b.length}}function ZAe(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let r=-1;for(;++r<n.length;){const s=n[r];e.push([QAe(s[0]),YAe(s[1])])}return e}function QAe(t){return typeof t=="string"?new RegExp(Mve(t),"g"):t}function YAe(t){return typeof t=="function"?t:function(){return t}}const Tw="phrasing",Aw=["autolink","link","image","label"];function XAe(){return{transforms:[o3e],enter:{literalAutolink:t3e,literalAutolinkEmail:Iw,literalAutolinkHttp:Iw,literalAutolinkWww:Iw},exit:{literalAutolink:i3e,literalAutolinkEmail:s3e,literalAutolinkHttp:n3e,literalAutolinkWww:r3e}}}function e3e(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Tw,notInConstruct:Aw},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Tw,notInConstruct:Aw},{character:":",before:"[ps]",after:"\\/",inConstruct:Tw,notInConstruct:Aw}]}}function t3e(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Iw(t){this.config.enter.autolinkProtocol.call(this,t)}function n3e(t){this.config.exit.autolinkProtocol.call(this,t)}function r3e(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function s3e(t){this.config.exit.autolinkEmail.call(this,t)}function i3e(t){this.exit(t)}function o3e(t){JAe(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,a3e],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),l3e]],{ignore:["link","linkReference"]})}function a3e(t,e,n,r,s){let i="";if(!cU(s)||(/^w/i.test(e)&&(n=e+n,e="",i="http://"),!c3e(n)))return!1;const o=u3e(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:i+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function l3e(t,e,n,r){return!cU(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function c3e(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function u3e(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=H0(t,"(");let i=H0(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function cU(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Zr(n)||Xb(n))&&(!e||n!==47)}uU.peek=b3e;function d3e(){this.buffer()}function f3e(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function h3e(){this.buffer()}function p3e(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function m3e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Vi(this.sliceSerialize(t)).toLowerCase(),n.label=e}function g3e(t){this.exit(t)}function x3e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Vi(this.sliceSerialize(t)).toLowerCase(),n.label=e}function y3e(t){this.exit(t)}function b3e(){return"["}function uU(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),a(),o(),i+=s.move("]"),i}function v3e(){return{enter:{gfmFootnoteCallString:d3e,gfmFootnoteCall:f3e,gfmFootnoteDefinitionLabelString:h3e,gfmFootnoteDefinition:p3e},exit:{gfmFootnoteCallString:m3e,gfmFootnoteCall:g3e,gfmFootnoteDefinitionLabelString:x3e,gfmFootnoteDefinition:y3e}}}function w3e(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:uU},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const a=i.createTracker(o);let l=a.move("[^");const c=i.enter("footnoteDefinition"),u=i.enter("label");return l+=a.move(i.safe(i.associationId(r),{before:l,after:"]"})),u(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((e?`
|
|
804
|
-
`:" ")+i.indentLines(i.containerFlow(r,a.current()),e?dU:k3e))),c(),l}}function k3e(t,e,n){return e===0?t:dU(t,e,n)}function dU(t,e,n){return(n?"":" ")+t}function C3e(){return[XAe(),v3e(),_7(),m$(),h$()]}function _3e(t){return{extensions:[e3e(),w3e(t),S7(),g$(t),p$()]}}const S3e={tokenize:j3e,partial:!0},fU={tokenize:R3e,partial:!0},hU={tokenize:M3e,partial:!0},pU={tokenize:P3e,partial:!0},E3e={tokenize:O3e,partial:!0},mU={name:"wwwAutolink",tokenize:A3e,previous:xU},gU={name:"protocolAutolink",tokenize:I3e,previous:yU},Ja={name:"emailAutolink",tokenize:T3e,previous:bU},qo={};function N3e(){return{text:qo}}let yc=48;for(;yc<123;)qo[yc]=Ja,yc++,yc===58?yc=65:yc===91&&(yc=97);qo[43]=Ja;qo[45]=Ja;qo[46]=Ja;qo[95]=Ja;qo[72]=[Ja,gU];qo[104]=[Ja,gU];qo[87]=[Ja,mU];qo[119]=[Ja,mU];function T3e(t,e,n){const r=this;let s,i;return o;function o(f){return!n_(f)||!bU.call(r,r.previous)||CN(r.events)?n(f):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(f))}function a(f){return n_(f)?(t.consume(f),a):f===64?(t.consume(f),l):n(f)}function l(f){return f===46?t.check(E3e,u,c)(f):f===45||f===95||Br(f)?(i=!0,t.consume(f),l):u(f)}function c(f){return t.consume(f),s=!0,l}function u(f){return i&&s&&Yr(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(f)):n(f)}}function A3e(t,e,n){const r=this;return s;function s(o){return o!==87&&o!==119||!xU.call(r,r.previous)||CN(r.events)?n(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(S3e,t.attempt(fU,t.attempt(hU,i),n),n)(o))}function i(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function I3e(t,e,n){const r=this;let s="",i=!1;return o;function o(f){return(f===72||f===104)&&yU.call(r,r.previous)&&!CN(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),s+=String.fromCodePoint(f),t.consume(f),a):n(f)}function a(f){if(Yr(f)&&s.length<5)return s+=String.fromCodePoint(f),t.consume(f),a;if(f===58){const h=s.toLowerCase();if(h==="http"||h==="https")return t.consume(f),l}return n(f)}function l(f){return f===47?(t.consume(f),i?c:(i=!0,l)):n(f)}function c(f){return f===null||z0(f)||zt(f)||Zr(f)||Xb(f)?n(f):t.attempt(fU,t.attempt(hU,u),n)(f)}function u(f){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(f)}}function j3e(t,e,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,t.consume(o),s):o===46&&r===3?(t.consume(o),i):n(o)}function i(o){return o===null?n(o):e(o)}}function R3e(t,e,n){let r,s,i;return o;function o(c){return c===46||c===95?t.check(pU,l,a)(c):c===null||zt(c)||Zr(c)||c!==45&&Xb(c)?l(c):(i=!0,t.consume(c),o)}function a(c){return c===95?r=!0:(s=r,r=void 0),t.consume(c),o}function l(c){return s||r||!i?n(c):e(c)}}function M3e(t,e){let n=0,r=0;return s;function s(o){return o===40?(n++,t.consume(o),s):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(pU,e,i)(o):o===null||zt(o)||Zr(o)?e(o):(t.consume(o),s)}function i(o){return o===41&&r++,t.consume(o),s}}function P3e(t,e,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),r):a===38?(t.consume(a),i):a===93?(t.consume(a),s):a===60||a===null||zt(a)||Zr(a)?e(a):n(a)}function s(a){return a===null||a===40||a===91||zt(a)||Zr(a)?e(a):r(a)}function i(a){return Yr(a)?o(a):n(a)}function o(a){return a===59?(t.consume(a),r):Yr(a)?(t.consume(a),o):n(a)}}function O3e(t,e,n){return r;function r(i){return t.consume(i),s}function s(i){return Br(i)?n(i):e(i)}}function xU(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||zt(t)}function yU(t){return!Yr(t)}function bU(t){return!(t===47||n_(t))}function n_(t){return t===43||t===45||t===46||t===95||Br(t)}function CN(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const L3e={tokenize:U3e,partial:!0};function D3e(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:V3e,continuation:{tokenize:z3e},exit:H3e}},text:{91:{name:"gfmFootnoteCall",tokenize:B3e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:F3e,resolveTo:$3e}}}}function F3e(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const l=r.events[s][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=Vi(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function $3e(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...a),t}function B3e(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return a;function a(f){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(t.enter("gfmFootnoteCallMarker"),t.consume(f),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(f){if(i>999||f===93&&!o||f===null||f===91||zt(f))return n(f);if(f===93){t.exit("chunkString");const h=t.exit("gfmFootnoteCallString");return s.includes(Vi(r.sliceSerialize(h)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(f)}return zt(f)||(o=!0),i++,t.consume(f),f===92?u:c}function u(f){return f===91||f===92||f===93?(t.consume(f),i++,c):c(f)}}function V3e(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,a;return l;function l(m){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):n(m)}function u(m){if(o>999||m===93&&!a||m===null||m===91||zt(m))return n(m);if(m===93){t.exit("chunkString");const g=t.exit("gfmFootnoteDefinitionLabelString");return i=Vi(r.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),h}return zt(m)||(a=!0),o++,t.consume(m),m===92?f:u}function f(m){return m===91||m===92||m===93?(t.consume(m),o++,u):u(m)}function h(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),s.includes(i)||s.push(i),Ot(t,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return e(m)}}function z3e(t,e,n){return t.check(Im,e,t.attempt(L3e,e,n))}function H3e(t){t.exit("gfmFootnoteDefinition")}function U3e(t,e,n){const r=this;return Ot(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(i):n(i)}}function W3e(t){return cF([N3e(),D3e(),C7(t),x$(),f$()])}const K3e={};function q3e(t){const e=this,n=t||K3e,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(W3e(n)),i.push(C3e()),o.push(_3e(n))}let jw=null;function G3e(){return jw||(jw=me(()=>import("./mermaid.core-BRfo14rF.js").then(t=>t.bC),__vite__mapDeps([30,2,3])).then(t=>t.default)),jw}function vU(t){return t==null?"":typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(e=>vU(e)).join(""):""}function J3e(t){if(!x.isValidElement(t))return null;const e=t.props;return typeof e.className!="string"||!/\blanguage-mermaid\b/i.test(e.className)?null:vU(e.children).replace(/\n$/,"")}function Z3e(t){const e=/^#([0-9a-f]{6})$/i.exec(t.trim());if(!e)return null;const n=e[1];return{r:parseInt(n.slice(0,2),16),g:parseInt(n.slice(2,4),16),b:parseInt(n.slice(4,6),16)}}function Q3e(t){if(!t)return;const e=Z3e(t);if(!e)return;const n=(.299*e.r+.587*e.g+.114*e.b)/255;return{borderColor:t,backgroundColor:`rgba(${e.r}, ${e.g}, ${e.b}, 0.22)`,color:n>.55?"#111827":"#f8fafc"}}function Y3e({source:t,darkMode:e}){const n=x.useId().replace(/[^a-zA-Z0-9_-]/g,""),[r,s]=x.useState(null),[i,o]=x.useState(null);return x.useEffect(()=>{let a=!0;return s(null),o(null),G3e().then(async l=>{l.initialize({startOnLoad:!1,securityLevel:"strict",theme:e?"dark":"default",fontFamily:"inherit",suppressErrorRendering:!0});const c=await l.render(`paperclip-mermaid-${n}`,t);a&&s(c.svg)}).catch(l=>{if(!a)return;const c=l instanceof Error&&l.message?l.message:"Failed to render Mermaid diagram.";o(c)}),()=>{a=!1}},[e,n,t]),d.jsx("div",{className:"paperclip-mermaid",children:r?d.jsx("div",{dangerouslySetInnerHTML:{__html:r}}):d.jsxs(d.Fragment,{children:[d.jsx("p",{className:Z("paperclip-mermaid-status",i&&"paperclip-mermaid-status-error"),children:i?`Unable to render Mermaid diagram: ${i}`:"Rendering Mermaid diagram..."}),d.jsx("pre",{className:"paperclip-mermaid-source",children:d.jsx("code",{className:"language-mermaid",children:t})})]})})}function Zm({children:t,className:e}){const{theme:n}=Eq();return d.jsx("div",{className:Z("paperclip-markdown prose prose-sm max-w-none break-words overflow-hidden",n==="dark"&&"prose-invert",e),children:d.jsx(UAe,{remarkPlugins:[q3e],components:{pre:({node:r,children:s,...i})=>{const o=J3e(s);return o?d.jsx(Y3e,{source:o,darkMode:n==="dark"}):d.jsx("pre",{...i,children:s})},a:({href:r,children:s})=>{const i=r?e6(r):null;if(i){const o=s;return d.jsx("a",{href:`/projects/${i.projectId}`,className:"paperclip-project-mention-chip",style:Q3e(i.color),children:o})}return d.jsx("a",{href:r,rel:"noreferrer",children:s})}},children:t})})}function u4({text:t,children:e,className:n,copiedLabel:r="Copied!"}){const[s,i]=x.useState(!1),[o,a]=x.useState(r),l=x.useRef(void 0),c=x.useRef(null),u=x.useCallback(async()=>{try{await navigator.clipboard.writeText(t),a(r)}catch{a("Copy failed")}clearTimeout(l.current),i(!0),l.current=setTimeout(()=>i(!1),1500)},[r,t]);return d.jsxs("span",{className:"relative inline-flex",children:[d.jsx("button",{ref:c,type:"button",className:Z("cursor-copy hover:text-foreground transition-colors",n),onClick:u,children:e??t}),d.jsx("span",{role:"status","aria-live":"polite",className:Z("pointer-events-none absolute left-1/2 -translate-x-1/2 bottom-full mb-1.5 rounded-md bg-foreground text-background px-2 py-1 text-xs whitespace-nowrap transition-opacity duration-300",s?"opacity-100":"opacity-0"),children:o})]})}function X3e({leading:t,identifier:e,title:n,subtitle:r,trailing:s,selected:i,to:o,onClick:a,className:l}){const u=Z("flex items-center gap-3 px-4 py-2 text-sm border-b border-border last:border-b-0 transition-colors",!!(o||a)&&"cursor-pointer hover:bg-accent/50",i&&"bg-accent/30",l),f=d.jsxs(d.Fragment,{children:[t&&d.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[e&&d.jsx("span",{className:"text-xs text-muted-foreground font-mono shrink-0 relative top-[1px]",children:e}),d.jsx("span",{className:"truncate",children:n})]}),r&&d.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:r})]}),s&&d.jsx("div",{className:"flex items-center gap-2 shrink-0",children:s})]});return o?d.jsx(en,{to:o,className:Z(u,"no-underline text-inherit"),onClick:a,children:f}):d.jsx("div",{className:u,onClick:a,children:f})}function Nt({className:t,...e}){return d.jsx("div",{"data-slot":"skeleton",className:Z("bg-accent/75 rounded-md",t),...e})}function wU({variant:t="list"}){return t==="dashboard"?d.jsxs("div",{className:"space-y-6",children:[d.jsx(Nt,{className:"h-32 w-full border border-border"}),d.jsx("div",{className:"grid grid-cols-2 gap-2 xl:grid-cols-4",children:Array.from({length:4}).map((e,n)=>d.jsx(Nt,{className:"h-24 w-full"},n))}),d.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:Array.from({length:4}).map((e,n)=>d.jsx(Nt,{className:"h-44 w-full"},n))}),d.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[d.jsx(Nt,{className:"h-72 w-full"}),d.jsx(Nt,{className:"h-72 w-full"})]})]}):t==="approvals"?d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"flex items-center justify-between",children:d.jsx(Nt,{className:"h-9 w-44"})}),d.jsx("div",{className:"grid gap-3",children:Array.from({length:3}).map((e,n)=>d.jsx(Nt,{className:"h-36 w-full"},n))})]}):t==="costs"?d.jsxs("div",{className:"space-y-6",children:[d.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Array.from({length:6}).map((e,n)=>d.jsx(Nt,{className:"h-9 w-28"},n))}),d.jsx(Nt,{className:"h-40 w-full"}),d.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[d.jsx(Nt,{className:"h-72 w-full"}),d.jsx(Nt,{className:"h-72 w-full"})]})]}):t==="inbox"?d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx(Nt,{className:"h-9 w-56"}),d.jsx(Nt,{className:"h-8 w-40"})]}),d.jsx("div",{className:"space-y-5",children:Array.from({length:3}).map((e,n)=>d.jsxs("div",{className:"space-y-2",children:[d.jsx(Nt,{className:"h-4 w-40"}),d.jsx("div",{className:"space-y-1 border border-border",children:Array.from({length:3}).map((r,s)=>d.jsx(Nt,{className:"h-14 w-full rounded-none"},s))})]},n))})]}):t==="org-chart"?d.jsx("div",{className:"space-y-4",children:d.jsx(Nt,{className:"h-[calc(100vh-4rem)] w-full rounded-lg border border-border"})}):t==="detail"?d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"space-y-3",children:[d.jsx(Nt,{className:"h-3 w-64"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Nt,{className:"h-6 w-6"}),d.jsx(Nt,{className:"h-6 w-6"}),d.jsx(Nt,{className:"h-7 w-48"})]}),d.jsx(Nt,{className:"h-4 w-40"})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsx(Nt,{className:"h-10 w-full"}),d.jsx(Nt,{className:"h-32 w-full"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Nt,{className:"h-8 w-24"}),d.jsx(Nt,{className:"h-8 w-24"}),d.jsx(Nt,{className:"h-8 w-24"})]}),d.jsx(Nt,{className:"h-24 w-full"}),d.jsx(Nt,{className:"h-24 w-full"})]})]}):t==="issues-list"?d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[d.jsx(Nt,{className:"h-9 w-64"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Nt,{className:"h-8 w-16"}),d.jsx(Nt,{className:"h-8 w-16"}),d.jsx(Nt,{className:"h-8 w-16"}),d.jsx(Nt,{className:"h-8 w-24"})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Nt,{className:"h-4 w-40"}),d.jsx("div",{className:"space-y-1",children:Array.from({length:8}).map((e,n)=>d.jsx(Nt,{className:"h-11 w-full rounded-none"},n))})]})]}):d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[d.jsx(Nt,{className:"h-9 w-44"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Nt,{className:"h-8 w-20"}),d.jsx(Nt,{className:"h-8 w-24"})]})]}),d.jsx("div",{className:"space-y-1",children:Array.from({length:7}).map((e,n)=>d.jsx(Nt,{className:"h-11 w-full rounded-none"},n))})]})}function d4(t){return(t/100).toFixed(2)}function eIe(t){const e=t.trim();if(e.length===0)return 0;const n=Number(e);return!Number.isFinite(n)||n<0?null:Math.round(n*100)}function f4(t){return t==="lifetime"?"Lifetime budget":"Monthly UTC budget"}function tIe(t){return t==="hard_stop"?"text-red-300 border-red-500/30 bg-red-500/10":t==="warning"?"text-amber-200 border-amber-500/30 bg-amber-500/10":"text-emerald-200 border-emerald-500/30 bg-emerald-500/10"}function nIe({summary:t,onSave:e,isSaving:n,compact:r=!1,variant:s="card"}){const[i,o]=x.useState(d4(t.amount));x.useEffect(()=>{o(d4(t.amount))},[t.amount]);const a=eIe(i),l=typeof a=="number"&&a!==t.amount&&!!e,c=t.amount>0?Math.min(100,t.utilizationPercent):0,u=t.status==="hard_stop"?Koe:t.status==="warning"?_b:vae,f=s==="plain",h=f?d.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Observed"}),d.jsx("div",{className:"mt-2 text-xl font-semibold tabular-nums",children:rd(t.observedAmount)}),d.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:t.amount>0?`${t.utilizationPercent}% of limit`:"No cap configured"})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Budget"}),d.jsx("div",{className:"mt-2 text-xl font-semibold tabular-nums",children:t.amount>0?rd(t.amount):"Disabled"}),d.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:["Soft alert at ",t.warnPercent,"%",t.paused&&t.pauseReason?` · ${t.pauseReason} pause`:""]})]})]}):d.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[d.jsxs("div",{className:"rounded-xl border border-border/70 bg-black/[0.18] px-4 py-3",children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Observed"}),d.jsx("div",{className:"mt-2 text-xl font-semibold tabular-nums",children:rd(t.observedAmount)}),d.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:t.amount>0?`${t.utilizationPercent}% of limit`:"No cap configured"})]}),d.jsxs("div",{className:"rounded-xl border border-border/70 bg-black/[0.18] px-4 py-3",children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Budget"}),d.jsx("div",{className:"mt-2 text-xl font-semibold tabular-nums",children:t.amount>0?rd(t.amount):"Disabled"}),d.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:["Soft alert at ",t.warnPercent,"%",t.paused&&t.pauseReason?` · ${t.pauseReason} pause`:""]})]})]}),p=d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[d.jsx("span",{children:"Remaining"}),d.jsx("span",{children:t.amount>0?rd(t.remainingAmount):"Unlimited"})]}),d.jsx("div",{className:Z("h-2 overflow-hidden rounded-full",f?"bg-border/70":"bg-muted/70"),children:d.jsx("div",{className:Z("h-full rounded-full transition-[width,background-color] duration-200",t.status==="hard_stop"?"bg-red-400":t.status==="warning"?"bg-amber-300":"bg-emerald-300"),style:{width:`${c}%`}})})]}),m=t.paused?d.jsxs("div",{className:"flex items-start gap-2 rounded-xl border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-100",children:[d.jsx(aie,{className:"mt-0.5 h-4 w-4 shrink-0"}),d.jsx("div",{children:t.scopeType==="project"?"Execution is paused for this project until the budget is raised or the incident is dismissed.":"Heartbeats are paused for this scope until the budget is raised or the incident is dismissed."})]}):null,g=e?d.jsxs("div",{className:Z("flex flex-col gap-3 sm:flex-row sm:items-end",f?"":"rounded-xl border border-border/70 bg-background/50 p-3"),children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("label",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Budget (USD)"}),d.jsx(wd,{value:i,onChange:y=>o(y.target.value),className:"mt-2",inputMode:"decimal",placeholder:"0.00"})]}),d.jsx(Fe,{onClick:()=>{typeof a=="number"&&e&&e(a)},disabled:!l||n||a===null,children:n?"Saving...":t.amount>0?"Update budget":"Set budget"})]}):null;return f?d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-start justify-between gap-6",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.22em] text-muted-foreground",children:t.scopeType}),d.jsx("div",{className:"mt-2 text-xl font-semibold",children:t.scopeName}),d.jsx("div",{className:"mt-2 text-sm text-muted-foreground",children:f4(t.windowKind)})]}),d.jsxs("div",{className:Z("inline-flex items-center gap-2 text-[11px] uppercase tracking-[0.18em]",t.status==="hard_stop"?"text-red-300":t.status==="warning"?"text-amber-200":"text-muted-foreground"),children:[d.jsx(u,{className:"h-3.5 w-3.5"}),t.paused?"Paused":t.status==="warning"?"Warning":t.status==="hard_stop"?"Hard stop":"Healthy"]})]}),h,p,m,g,a===null?d.jsx("p",{className:"text-xs text-destructive",children:"Enter a valid non-negative dollar amount."}):null]}):d.jsxs(jae,{className:Z("overflow-hidden border-border/70 bg-card/80",r?"":"shadow-[0_20px_80px_-40px_rgba(0,0,0,0.55)]"),children:[d.jsx(Rae,{className:Z("gap-3",r?"px-4 pt-4 pb-2":"px-5 pt-5 pb-3"),children:d.jsxs("div",{className:"flex items-start justify-between gap-3",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.22em] text-muted-foreground",children:t.scopeType}),d.jsx(Mae,{className:"mt-1 text-base",children:t.scopeName}),d.jsx(Pae,{className:"mt-1",children:f4(t.windowKind)})]}),d.jsxs("div",{className:Z("inline-flex items-center gap-2 rounded-full border px-3 py-1 text-[11px] uppercase tracking-[0.18em]",tIe(t.status)),children:[d.jsx(u,{className:"h-3.5 w-3.5"}),t.paused?"Paused":t.status==="warning"?"Warning":t.status==="hard_stop"?"Hard stop":"Healthy"]})]})}),d.jsxs(Oae,{className:Z("space-y-4",r?"px-4 pb-4 pt-0":"px-5 pb-5 pt-0"),children:[h,p,m,g,a===null?d.jsx("p",{className:"text-xs text-destructive",children:"Enter a valid non-negative dollar amount."}):null]})]})}function h4(){const t=document.getElementById("main-content");if(t instanceof HTMLElement){const e=window.getComputedStyle(t).overflowY;if((e==="auto"||e==="scroll"||e==="overlay")&&t.scrollHeight>t.clientHeight+1)return{type:"element",element:t}}return{type:"window"}}function rIe(t){return t.type==="element"?t.element.scrollHeight-t.element.scrollTop-t.element.clientHeight:(document.scrollingElement??document.documentElement).scrollHeight-window.scrollY-window.innerHeight}function kU(){const[t,e]=x.useState(!1);x.useEffect(()=>{const r=()=>{e(rIe(h4())>300)},s=document.getElementById("main-content");return r(),s==null||s.addEventListener("scroll",r,{passive:!0}),window.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),()=>{s==null||s.removeEventListener("scroll",r),window.removeEventListener("scroll",r),window.removeEventListener("resize",r)}},[]);const n=x.useCallback(()=>{const r=h4();if(r.type==="element"){r.element.scrollTo({top:r.element.scrollHeight,behavior:"smooth"});return}const s=document.scrollingElement??document.documentElement;window.scrollTo({top:s.scrollHeight,behavior:"smooth"})},[]);return t?d.jsx("button",{onClick:n,className:"fixed bottom-[calc(1.5rem+5rem+env(safe-area-inset-bottom))] right-6 z-40 flex h-9 w-9 items-center justify-center rounded-full border border-border bg-background shadow-md hover:bg-accent transition-colors md:bottom-6","aria-label":"Scroll to bottom",children:d.jsx(AS,{className:"h-4 w-4"})}):null}const r_={bot:vh,cpu:kie,brain:Wse,zap:O6,rocket:Rk,code:N6,terminal:v0,shield:Goe,eye:RS,search:zoe,wrench:P6,hammer:Gie,lightbulb:toe,sparkles:PS,star:nae,heart:wh,flame:Bie,bug:Gse,cog:xie,database:Eie,globe:Kie,lock:aoe,mail:coe,"message-square":j6,"file-code":Oie,"git-branch":Uie,package:Eoe,puzzle:Loe,target:lae,wand:kae,atom:zse,"circuit-board":hie,radar:Foe,swords:iae,telescope:uae,microscope:goe,crown:_ie,gem:I6,hexagon:y0,pentagon:Roe,fingerprint:Fie},CU="bot";function sIe(t){return t&&xS.includes(t)?r_[t]:r_[CU]}function gf({icon:t,className:e}){const n=sIe(t);return d.jsx(n,{className:e})}function iIe({value:t,onChange:e,children:n}){const[r,s]=x.useState(!1),[i,o]=x.useState(""),a=x.useMemo(()=>{const l=xS.map(u=>[u,r_[u]]);if(!i)return l;const c=i.toLowerCase();return l.filter(([u])=>u.includes(c))},[i]);return d.jsxs(es,{open:r,onOpenChange:s,children:[d.jsx(ts,{asChild:!0,children:n}),d.jsxs(ns,{className:"w-72 p-3",align:"start",children:[d.jsx(wd,{placeholder:"Search icons...",value:i,onChange:l=>o(l.target.value),className:"mb-2 h-8 text-sm",autoFocus:!0}),d.jsxs("div",{className:"grid grid-cols-7 gap-1 max-h-48 overflow-y-auto",children:[a.map(([l,c])=>d.jsx("button",{onClick:()=>{e(l),s(!1),o("")},className:Z("flex items-center justify-center h-8 w-8 rounded hover:bg-accent transition-colors",(t??CU)===l&&"bg-accent ring-1 ring-primary"),title:l,children:d.jsx(c,{className:"h-4 w-4"})},l)),a.length===0&&d.jsx("p",{className:"col-span-7 text-xs text-muted-foreground text-center py-2",children:"No icons match"})]})]})]})}function _N(t){return typeof t!="object"||t===null||Array.isArray(t)?null:t}function Vo(t){return t.replace(/\s+/g," ").trim()}function Ni(t,e){return t.length>e?`${t.slice(0,Math.max(0,e-1))}…`:t}function _U(t){return t.replace(/[_-]+/g," ").trim().replace(/\b\w/g,e=>e.toUpperCase())}function p4(t){const e=Vo(t),n=e.match(/^(?:(?:\/bin\/)?(?:zsh|bash|sh)|cmd(?:\.exe)?(?:\s+\/d)?(?:\s+\/s)?(?:\s+\/c)?)\s+(?:-lc|\/c)\s+(.+)$/i),r=(n==null?void 0:n[1])??e,s=r.match(/^(['"])([\s\S]*)\1$/);return Vo((s==null?void 0:s[2])??r)}function SU(t){if(typeof t=="string")return t;if(t==null)return"";try{return JSON.stringify(t,null,2)}catch{return String(t)}}function qp(t){if(typeof t=="string")try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}return SU(t)}function oIe(t){const e=_N(t);if(!e)return;const n=[e.toolUseId,e.tool_use_id,e.callId,e.call_id,e.id];for(const r of n)if(typeof r=="string"&&r.trim())return r}function m4(t,e){for(const n of e){const r=t[n];if(typeof r=="string"&&r.trim())return Ni(Vo(r),120)}return null}function s_(t,e,n){const r=n==="compact"?72:120;if(typeof e=="string"){const l=Gp(t,e)?p4(e):Vo(e);return Ni(l,r)}const s=_N(e);if(!s){const l=Vo(SU(e));return l?Ni(l,r):`Inspect ${t} input`}const i=typeof s.command=="string"?s.command:typeof s.cmd=="string"?s.cmd:null;if(i&&Gp(t,s))return Ni(p4(i),r);const o=m4(s,["command","cmd","path","filePath","file_path","query","url","prompt","message"])??m4(s,["pattern","name","title","target","tool"])??null;if(o)return Ni(o,r);if(Array.isArray(s.paths)&&s.paths.length>0){const l=s.paths.find(c=>typeof c=="string"&&c.trim().length>0);if(l)return Ni(`${s.paths.length} paths, starting with ${l}`,r)}const a=Object.keys(s);return a.length===0?`No ${t} input`:a.length===1?Ni(`${a[0]} payload`,r):Ni(`${a.length} fields: ${a.slice(0,3).join(", ")}`,r)}function EU(t){var i;if(!t)return null;const e=t.split(/\r?\n/),n=new Map;let r=e.findIndex(o=>o.trim()==="");r===-1&&(r=e.length);for(let o=0;o<r;o+=1){const a=(i=e[o])==null?void 0:i.match(/^([a-z_]+):\s*(.+)$/i);a&&n.set(a[1].toLowerCase(),Vo(a[2]))}const s=e.slice(Math.min(r+1,e.length)).map(o=>Vo(o)).filter(Boolean).join(`
|
|
804
|
+
`:" ")+i.indentLines(i.containerFlow(r,a.current()),e?dU:k3e))),c(),l}}function k3e(t,e,n){return e===0?t:dU(t,e,n)}function dU(t,e,n){return(n?"":" ")+t}function C3e(){return[XAe(),v3e(),_7(),m$(),h$()]}function _3e(t){return{extensions:[e3e(),w3e(t),S7(),g$(t),p$()]}}const S3e={tokenize:j3e,partial:!0},fU={tokenize:R3e,partial:!0},hU={tokenize:M3e,partial:!0},pU={tokenize:P3e,partial:!0},E3e={tokenize:O3e,partial:!0},mU={name:"wwwAutolink",tokenize:A3e,previous:xU},gU={name:"protocolAutolink",tokenize:I3e,previous:yU},Ja={name:"emailAutolink",tokenize:T3e,previous:bU},qo={};function N3e(){return{text:qo}}let yc=48;for(;yc<123;)qo[yc]=Ja,yc++,yc===58?yc=65:yc===91&&(yc=97);qo[43]=Ja;qo[45]=Ja;qo[46]=Ja;qo[95]=Ja;qo[72]=[Ja,gU];qo[104]=[Ja,gU];qo[87]=[Ja,mU];qo[119]=[Ja,mU];function T3e(t,e,n){const r=this;let s,i;return o;function o(f){return!n_(f)||!bU.call(r,r.previous)||CN(r.events)?n(f):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(f))}function a(f){return n_(f)?(t.consume(f),a):f===64?(t.consume(f),l):n(f)}function l(f){return f===46?t.check(E3e,u,c)(f):f===45||f===95||Br(f)?(i=!0,t.consume(f),l):u(f)}function c(f){return t.consume(f),s=!0,l}function u(f){return i&&s&&Yr(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(f)):n(f)}}function A3e(t,e,n){const r=this;return s;function s(o){return o!==87&&o!==119||!xU.call(r,r.previous)||CN(r.events)?n(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(S3e,t.attempt(fU,t.attempt(hU,i),n),n)(o))}function i(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function I3e(t,e,n){const r=this;let s="",i=!1;return o;function o(f){return(f===72||f===104)&&yU.call(r,r.previous)&&!CN(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),s+=String.fromCodePoint(f),t.consume(f),a):n(f)}function a(f){if(Yr(f)&&s.length<5)return s+=String.fromCodePoint(f),t.consume(f),a;if(f===58){const h=s.toLowerCase();if(h==="http"||h==="https")return t.consume(f),l}return n(f)}function l(f){return f===47?(t.consume(f),i?c:(i=!0,l)):n(f)}function c(f){return f===null||z0(f)||zt(f)||Zr(f)||Xb(f)?n(f):t.attempt(fU,t.attempt(hU,u),n)(f)}function u(f){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(f)}}function j3e(t,e,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,t.consume(o),s):o===46&&r===3?(t.consume(o),i):n(o)}function i(o){return o===null?n(o):e(o)}}function R3e(t,e,n){let r,s,i;return o;function o(c){return c===46||c===95?t.check(pU,l,a)(c):c===null||zt(c)||Zr(c)||c!==45&&Xb(c)?l(c):(i=!0,t.consume(c),o)}function a(c){return c===95?r=!0:(s=r,r=void 0),t.consume(c),o}function l(c){return s||r||!i?n(c):e(c)}}function M3e(t,e){let n=0,r=0;return s;function s(o){return o===40?(n++,t.consume(o),s):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(pU,e,i)(o):o===null||zt(o)||Zr(o)?e(o):(t.consume(o),s)}function i(o){return o===41&&r++,t.consume(o),s}}function P3e(t,e,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),r):a===38?(t.consume(a),i):a===93?(t.consume(a),s):a===60||a===null||zt(a)||Zr(a)?e(a):n(a)}function s(a){return a===null||a===40||a===91||zt(a)||Zr(a)?e(a):r(a)}function i(a){return Yr(a)?o(a):n(a)}function o(a){return a===59?(t.consume(a),r):Yr(a)?(t.consume(a),o):n(a)}}function O3e(t,e,n){return r;function r(i){return t.consume(i),s}function s(i){return Br(i)?n(i):e(i)}}function xU(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||zt(t)}function yU(t){return!Yr(t)}function bU(t){return!(t===47||n_(t))}function n_(t){return t===43||t===45||t===46||t===95||Br(t)}function CN(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const L3e={tokenize:U3e,partial:!0};function D3e(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:V3e,continuation:{tokenize:z3e},exit:H3e}},text:{91:{name:"gfmFootnoteCall",tokenize:B3e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:F3e,resolveTo:$3e}}}}function F3e(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const l=r.events[s][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=Vi(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function $3e(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...a),t}function B3e(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return a;function a(f){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(t.enter("gfmFootnoteCallMarker"),t.consume(f),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(f){if(i>999||f===93&&!o||f===null||f===91||zt(f))return n(f);if(f===93){t.exit("chunkString");const h=t.exit("gfmFootnoteCallString");return s.includes(Vi(r.sliceSerialize(h)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(f)}return zt(f)||(o=!0),i++,t.consume(f),f===92?u:c}function u(f){return f===91||f===92||f===93?(t.consume(f),i++,c):c(f)}}function V3e(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,a;return l;function l(m){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):n(m)}function u(m){if(o>999||m===93&&!a||m===null||m===91||zt(m))return n(m);if(m===93){t.exit("chunkString");const g=t.exit("gfmFootnoteDefinitionLabelString");return i=Vi(r.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),h}return zt(m)||(a=!0),o++,t.consume(m),m===92?f:u}function f(m){return m===91||m===92||m===93?(t.consume(m),o++,u):u(m)}function h(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),s.includes(i)||s.push(i),Ot(t,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return e(m)}}function z3e(t,e,n){return t.check(Im,e,t.attempt(L3e,e,n))}function H3e(t){t.exit("gfmFootnoteDefinition")}function U3e(t,e,n){const r=this;return Ot(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(i):n(i)}}function W3e(t){return cF([N3e(),D3e(),C7(t),x$(),f$()])}const K3e={};function q3e(t){const e=this,n=t||K3e,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(W3e(n)),i.push(C3e()),o.push(_3e(n))}let jw=null;function G3e(){return jw||(jw=me(()=>import("./mermaid.core-DNt7uRm5.js").then(t=>t.bC),__vite__mapDeps([30,2,3])).then(t=>t.default)),jw}function vU(t){return t==null?"":typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(e=>vU(e)).join(""):""}function J3e(t){if(!x.isValidElement(t))return null;const e=t.props;return typeof e.className!="string"||!/\blanguage-mermaid\b/i.test(e.className)?null:vU(e.children).replace(/\n$/,"")}function Z3e(t){const e=/^#([0-9a-f]{6})$/i.exec(t.trim());if(!e)return null;const n=e[1];return{r:parseInt(n.slice(0,2),16),g:parseInt(n.slice(2,4),16),b:parseInt(n.slice(4,6),16)}}function Q3e(t){if(!t)return;const e=Z3e(t);if(!e)return;const n=(.299*e.r+.587*e.g+.114*e.b)/255;return{borderColor:t,backgroundColor:`rgba(${e.r}, ${e.g}, ${e.b}, 0.22)`,color:n>.55?"#111827":"#f8fafc"}}function Y3e({source:t,darkMode:e}){const n=x.useId().replace(/[^a-zA-Z0-9_-]/g,""),[r,s]=x.useState(null),[i,o]=x.useState(null);return x.useEffect(()=>{let a=!0;return s(null),o(null),G3e().then(async l=>{l.initialize({startOnLoad:!1,securityLevel:"strict",theme:e?"dark":"default",fontFamily:"inherit",suppressErrorRendering:!0});const c=await l.render(`paperclip-mermaid-${n}`,t);a&&s(c.svg)}).catch(l=>{if(!a)return;const c=l instanceof Error&&l.message?l.message:"Failed to render Mermaid diagram.";o(c)}),()=>{a=!1}},[e,n,t]),d.jsx("div",{className:"paperclip-mermaid",children:r?d.jsx("div",{dangerouslySetInnerHTML:{__html:r}}):d.jsxs(d.Fragment,{children:[d.jsx("p",{className:Z("paperclip-mermaid-status",i&&"paperclip-mermaid-status-error"),children:i?`Unable to render Mermaid diagram: ${i}`:"Rendering Mermaid diagram..."}),d.jsx("pre",{className:"paperclip-mermaid-source",children:d.jsx("code",{className:"language-mermaid",children:t})})]})})}function Zm({children:t,className:e}){const{theme:n}=Eq();return d.jsx("div",{className:Z("paperclip-markdown prose prose-sm max-w-none break-words overflow-hidden",n==="dark"&&"prose-invert",e),children:d.jsx(UAe,{remarkPlugins:[q3e],components:{pre:({node:r,children:s,...i})=>{const o=J3e(s);return o?d.jsx(Y3e,{source:o,darkMode:n==="dark"}):d.jsx("pre",{...i,children:s})},a:({href:r,children:s})=>{const i=r?e6(r):null;if(i){const o=s;return d.jsx("a",{href:`/projects/${i.projectId}`,className:"paperclip-project-mention-chip",style:Q3e(i.color),children:o})}return d.jsx("a",{href:r,rel:"noreferrer",children:s})}},children:t})})}function u4({text:t,children:e,className:n,copiedLabel:r="Copied!"}){const[s,i]=x.useState(!1),[o,a]=x.useState(r),l=x.useRef(void 0),c=x.useRef(null),u=x.useCallback(async()=>{try{await navigator.clipboard.writeText(t),a(r)}catch{a("Copy failed")}clearTimeout(l.current),i(!0),l.current=setTimeout(()=>i(!1),1500)},[r,t]);return d.jsxs("span",{className:"relative inline-flex",children:[d.jsx("button",{ref:c,type:"button",className:Z("cursor-copy hover:text-foreground transition-colors",n),onClick:u,children:e??t}),d.jsx("span",{role:"status","aria-live":"polite",className:Z("pointer-events-none absolute left-1/2 -translate-x-1/2 bottom-full mb-1.5 rounded-md bg-foreground text-background px-2 py-1 text-xs whitespace-nowrap transition-opacity duration-300",s?"opacity-100":"opacity-0"),children:o})]})}function X3e({leading:t,identifier:e,title:n,subtitle:r,trailing:s,selected:i,to:o,onClick:a,className:l}){const u=Z("flex items-center gap-3 px-4 py-2 text-sm border-b border-border last:border-b-0 transition-colors",!!(o||a)&&"cursor-pointer hover:bg-accent/50",i&&"bg-accent/30",l),f=d.jsxs(d.Fragment,{children:[t&&d.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[e&&d.jsx("span",{className:"text-xs text-muted-foreground font-mono shrink-0 relative top-[1px]",children:e}),d.jsx("span",{className:"truncate",children:n})]}),r&&d.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:r})]}),s&&d.jsx("div",{className:"flex items-center gap-2 shrink-0",children:s})]});return o?d.jsx(en,{to:o,className:Z(u,"no-underline text-inherit"),onClick:a,children:f}):d.jsx("div",{className:u,onClick:a,children:f})}function Nt({className:t,...e}){return d.jsx("div",{"data-slot":"skeleton",className:Z("bg-accent/75 rounded-md",t),...e})}function wU({variant:t="list"}){return t==="dashboard"?d.jsxs("div",{className:"space-y-6",children:[d.jsx(Nt,{className:"h-32 w-full border border-border"}),d.jsx("div",{className:"grid grid-cols-2 gap-2 xl:grid-cols-4",children:Array.from({length:4}).map((e,n)=>d.jsx(Nt,{className:"h-24 w-full"},n))}),d.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:Array.from({length:4}).map((e,n)=>d.jsx(Nt,{className:"h-44 w-full"},n))}),d.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[d.jsx(Nt,{className:"h-72 w-full"}),d.jsx(Nt,{className:"h-72 w-full"})]})]}):t==="approvals"?d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"flex items-center justify-between",children:d.jsx(Nt,{className:"h-9 w-44"})}),d.jsx("div",{className:"grid gap-3",children:Array.from({length:3}).map((e,n)=>d.jsx(Nt,{className:"h-36 w-full"},n))})]}):t==="costs"?d.jsxs("div",{className:"space-y-6",children:[d.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Array.from({length:6}).map((e,n)=>d.jsx(Nt,{className:"h-9 w-28"},n))}),d.jsx(Nt,{className:"h-40 w-full"}),d.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[d.jsx(Nt,{className:"h-72 w-full"}),d.jsx(Nt,{className:"h-72 w-full"})]})]}):t==="inbox"?d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx(Nt,{className:"h-9 w-56"}),d.jsx(Nt,{className:"h-8 w-40"})]}),d.jsx("div",{className:"space-y-5",children:Array.from({length:3}).map((e,n)=>d.jsxs("div",{className:"space-y-2",children:[d.jsx(Nt,{className:"h-4 w-40"}),d.jsx("div",{className:"space-y-1 border border-border",children:Array.from({length:3}).map((r,s)=>d.jsx(Nt,{className:"h-14 w-full rounded-none"},s))})]},n))})]}):t==="org-chart"?d.jsx("div",{className:"space-y-4",children:d.jsx(Nt,{className:"h-[calc(100vh-4rem)] w-full rounded-lg border border-border"})}):t==="detail"?d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"space-y-3",children:[d.jsx(Nt,{className:"h-3 w-64"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Nt,{className:"h-6 w-6"}),d.jsx(Nt,{className:"h-6 w-6"}),d.jsx(Nt,{className:"h-7 w-48"})]}),d.jsx(Nt,{className:"h-4 w-40"})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsx(Nt,{className:"h-10 w-full"}),d.jsx(Nt,{className:"h-32 w-full"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Nt,{className:"h-8 w-24"}),d.jsx(Nt,{className:"h-8 w-24"}),d.jsx(Nt,{className:"h-8 w-24"})]}),d.jsx(Nt,{className:"h-24 w-full"}),d.jsx(Nt,{className:"h-24 w-full"})]})]}):t==="issues-list"?d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[d.jsx(Nt,{className:"h-9 w-64"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Nt,{className:"h-8 w-16"}),d.jsx(Nt,{className:"h-8 w-16"}),d.jsx(Nt,{className:"h-8 w-16"}),d.jsx(Nt,{className:"h-8 w-24"})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Nt,{className:"h-4 w-40"}),d.jsx("div",{className:"space-y-1",children:Array.from({length:8}).map((e,n)=>d.jsx(Nt,{className:"h-11 w-full rounded-none"},n))})]})]}):d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[d.jsx(Nt,{className:"h-9 w-44"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Nt,{className:"h-8 w-20"}),d.jsx(Nt,{className:"h-8 w-24"})]})]}),d.jsx("div",{className:"space-y-1",children:Array.from({length:7}).map((e,n)=>d.jsx(Nt,{className:"h-11 w-full rounded-none"},n))})]})}function d4(t){return(t/100).toFixed(2)}function eIe(t){const e=t.trim();if(e.length===0)return 0;const n=Number(e);return!Number.isFinite(n)||n<0?null:Math.round(n*100)}function f4(t){return t==="lifetime"?"Lifetime budget":"Monthly UTC budget"}function tIe(t){return t==="hard_stop"?"text-red-300 border-red-500/30 bg-red-500/10":t==="warning"?"text-amber-200 border-amber-500/30 bg-amber-500/10":"text-emerald-200 border-emerald-500/30 bg-emerald-500/10"}function nIe({summary:t,onSave:e,isSaving:n,compact:r=!1,variant:s="card"}){const[i,o]=x.useState(d4(t.amount));x.useEffect(()=>{o(d4(t.amount))},[t.amount]);const a=eIe(i),l=typeof a=="number"&&a!==t.amount&&!!e,c=t.amount>0?Math.min(100,t.utilizationPercent):0,u=t.status==="hard_stop"?Koe:t.status==="warning"?_b:vae,f=s==="plain",h=f?d.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Observed"}),d.jsx("div",{className:"mt-2 text-xl font-semibold tabular-nums",children:rd(t.observedAmount)}),d.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:t.amount>0?`${t.utilizationPercent}% of limit`:"No cap configured"})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Budget"}),d.jsx("div",{className:"mt-2 text-xl font-semibold tabular-nums",children:t.amount>0?rd(t.amount):"Disabled"}),d.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:["Soft alert at ",t.warnPercent,"%",t.paused&&t.pauseReason?` · ${t.pauseReason} pause`:""]})]})]}):d.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[d.jsxs("div",{className:"rounded-xl border border-border/70 bg-black/[0.18] px-4 py-3",children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Observed"}),d.jsx("div",{className:"mt-2 text-xl font-semibold tabular-nums",children:rd(t.observedAmount)}),d.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:t.amount>0?`${t.utilizationPercent}% of limit`:"No cap configured"})]}),d.jsxs("div",{className:"rounded-xl border border-border/70 bg-black/[0.18] px-4 py-3",children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Budget"}),d.jsx("div",{className:"mt-2 text-xl font-semibold tabular-nums",children:t.amount>0?rd(t.amount):"Disabled"}),d.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:["Soft alert at ",t.warnPercent,"%",t.paused&&t.pauseReason?` · ${t.pauseReason} pause`:""]})]})]}),p=d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[d.jsx("span",{children:"Remaining"}),d.jsx("span",{children:t.amount>0?rd(t.remainingAmount):"Unlimited"})]}),d.jsx("div",{className:Z("h-2 overflow-hidden rounded-full",f?"bg-border/70":"bg-muted/70"),children:d.jsx("div",{className:Z("h-full rounded-full transition-[width,background-color] duration-200",t.status==="hard_stop"?"bg-red-400":t.status==="warning"?"bg-amber-300":"bg-emerald-300"),style:{width:`${c}%`}})})]}),m=t.paused?d.jsxs("div",{className:"flex items-start gap-2 rounded-xl border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-100",children:[d.jsx(aie,{className:"mt-0.5 h-4 w-4 shrink-0"}),d.jsx("div",{children:t.scopeType==="project"?"Execution is paused for this project until the budget is raised or the incident is dismissed.":"Heartbeats are paused for this scope until the budget is raised or the incident is dismissed."})]}):null,g=e?d.jsxs("div",{className:Z("flex flex-col gap-3 sm:flex-row sm:items-end",f?"":"rounded-xl border border-border/70 bg-background/50 p-3"),children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("label",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Budget (USD)"}),d.jsx(wd,{value:i,onChange:y=>o(y.target.value),className:"mt-2",inputMode:"decimal",placeholder:"0.00"})]}),d.jsx(Fe,{onClick:()=>{typeof a=="number"&&e&&e(a)},disabled:!l||n||a===null,children:n?"Saving...":t.amount>0?"Update budget":"Set budget"})]}):null;return f?d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-start justify-between gap-6",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.22em] text-muted-foreground",children:t.scopeType}),d.jsx("div",{className:"mt-2 text-xl font-semibold",children:t.scopeName}),d.jsx("div",{className:"mt-2 text-sm text-muted-foreground",children:f4(t.windowKind)})]}),d.jsxs("div",{className:Z("inline-flex items-center gap-2 text-[11px] uppercase tracking-[0.18em]",t.status==="hard_stop"?"text-red-300":t.status==="warning"?"text-amber-200":"text-muted-foreground"),children:[d.jsx(u,{className:"h-3.5 w-3.5"}),t.paused?"Paused":t.status==="warning"?"Warning":t.status==="hard_stop"?"Hard stop":"Healthy"]})]}),h,p,m,g,a===null?d.jsx("p",{className:"text-xs text-destructive",children:"Enter a valid non-negative dollar amount."}):null]}):d.jsxs(jae,{className:Z("overflow-hidden border-border/70 bg-card/80",r?"":"shadow-[0_20px_80px_-40px_rgba(0,0,0,0.55)]"),children:[d.jsx(Rae,{className:Z("gap-3",r?"px-4 pt-4 pb-2":"px-5 pt-5 pb-3"),children:d.jsxs("div",{className:"flex items-start justify-between gap-3",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.22em] text-muted-foreground",children:t.scopeType}),d.jsx(Mae,{className:"mt-1 text-base",children:t.scopeName}),d.jsx(Pae,{className:"mt-1",children:f4(t.windowKind)})]}),d.jsxs("div",{className:Z("inline-flex items-center gap-2 rounded-full border px-3 py-1 text-[11px] uppercase tracking-[0.18em]",tIe(t.status)),children:[d.jsx(u,{className:"h-3.5 w-3.5"}),t.paused?"Paused":t.status==="warning"?"Warning":t.status==="hard_stop"?"Hard stop":"Healthy"]})]})}),d.jsxs(Oae,{className:Z("space-y-4",r?"px-4 pb-4 pt-0":"px-5 pb-5 pt-0"),children:[h,p,m,g,a===null?d.jsx("p",{className:"text-xs text-destructive",children:"Enter a valid non-negative dollar amount."}):null]})]})}function h4(){const t=document.getElementById("main-content");if(t instanceof HTMLElement){const e=window.getComputedStyle(t).overflowY;if((e==="auto"||e==="scroll"||e==="overlay")&&t.scrollHeight>t.clientHeight+1)return{type:"element",element:t}}return{type:"window"}}function rIe(t){return t.type==="element"?t.element.scrollHeight-t.element.scrollTop-t.element.clientHeight:(document.scrollingElement??document.documentElement).scrollHeight-window.scrollY-window.innerHeight}function kU(){const[t,e]=x.useState(!1);x.useEffect(()=>{const r=()=>{e(rIe(h4())>300)},s=document.getElementById("main-content");return r(),s==null||s.addEventListener("scroll",r,{passive:!0}),window.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),()=>{s==null||s.removeEventListener("scroll",r),window.removeEventListener("scroll",r),window.removeEventListener("resize",r)}},[]);const n=x.useCallback(()=>{const r=h4();if(r.type==="element"){r.element.scrollTo({top:r.element.scrollHeight,behavior:"smooth"});return}const s=document.scrollingElement??document.documentElement;window.scrollTo({top:s.scrollHeight,behavior:"smooth"})},[]);return t?d.jsx("button",{onClick:n,className:"fixed bottom-[calc(1.5rem+5rem+env(safe-area-inset-bottom))] right-6 z-40 flex h-9 w-9 items-center justify-center rounded-full border border-border bg-background shadow-md hover:bg-accent transition-colors md:bottom-6","aria-label":"Scroll to bottom",children:d.jsx(AS,{className:"h-4 w-4"})}):null}const r_={bot:vh,cpu:kie,brain:Wse,zap:O6,rocket:Rk,code:N6,terminal:v0,shield:Goe,eye:RS,search:zoe,wrench:P6,hammer:Gie,lightbulb:toe,sparkles:PS,star:nae,heart:wh,flame:Bie,bug:Gse,cog:xie,database:Eie,globe:Kie,lock:aoe,mail:coe,"message-square":j6,"file-code":Oie,"git-branch":Uie,package:Eoe,puzzle:Loe,target:lae,wand:kae,atom:zse,"circuit-board":hie,radar:Foe,swords:iae,telescope:uae,microscope:goe,crown:_ie,gem:I6,hexagon:y0,pentagon:Roe,fingerprint:Fie},CU="bot";function sIe(t){return t&&xS.includes(t)?r_[t]:r_[CU]}function gf({icon:t,className:e}){const n=sIe(t);return d.jsx(n,{className:e})}function iIe({value:t,onChange:e,children:n}){const[r,s]=x.useState(!1),[i,o]=x.useState(""),a=x.useMemo(()=>{const l=xS.map(u=>[u,r_[u]]);if(!i)return l;const c=i.toLowerCase();return l.filter(([u])=>u.includes(c))},[i]);return d.jsxs(es,{open:r,onOpenChange:s,children:[d.jsx(ts,{asChild:!0,children:n}),d.jsxs(ns,{className:"w-72 p-3",align:"start",children:[d.jsx(wd,{placeholder:"Search icons...",value:i,onChange:l=>o(l.target.value),className:"mb-2 h-8 text-sm",autoFocus:!0}),d.jsxs("div",{className:"grid grid-cols-7 gap-1 max-h-48 overflow-y-auto",children:[a.map(([l,c])=>d.jsx("button",{onClick:()=>{e(l),s(!1),o("")},className:Z("flex items-center justify-center h-8 w-8 rounded hover:bg-accent transition-colors",(t??CU)===l&&"bg-accent ring-1 ring-primary"),title:l,children:d.jsx(c,{className:"h-4 w-4"})},l)),a.length===0&&d.jsx("p",{className:"col-span-7 text-xs text-muted-foreground text-center py-2",children:"No icons match"})]})]})]})}function _N(t){return typeof t!="object"||t===null||Array.isArray(t)?null:t}function Vo(t){return t.replace(/\s+/g," ").trim()}function Ni(t,e){return t.length>e?`${t.slice(0,Math.max(0,e-1))}…`:t}function _U(t){return t.replace(/[_-]+/g," ").trim().replace(/\b\w/g,e=>e.toUpperCase())}function p4(t){const e=Vo(t),n=e.match(/^(?:(?:\/bin\/)?(?:zsh|bash|sh)|cmd(?:\.exe)?(?:\s+\/d)?(?:\s+\/s)?(?:\s+\/c)?)\s+(?:-lc|\/c)\s+(.+)$/i),r=(n==null?void 0:n[1])??e,s=r.match(/^(['"])([\s\S]*)\1$/);return Vo((s==null?void 0:s[2])??r)}function SU(t){if(typeof t=="string")return t;if(t==null)return"";try{return JSON.stringify(t,null,2)}catch{return String(t)}}function qp(t){if(typeof t=="string")try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}return SU(t)}function oIe(t){const e=_N(t);if(!e)return;const n=[e.toolUseId,e.tool_use_id,e.callId,e.call_id,e.id];for(const r of n)if(typeof r=="string"&&r.trim())return r}function m4(t,e){for(const n of e){const r=t[n];if(typeof r=="string"&&r.trim())return Ni(Vo(r),120)}return null}function s_(t,e,n){const r=n==="compact"?72:120;if(typeof e=="string"){const l=Gp(t,e)?p4(e):Vo(e);return Ni(l,r)}const s=_N(e);if(!s){const l=Vo(SU(e));return l?Ni(l,r):`Inspect ${t} input`}const i=typeof s.command=="string"?s.command:typeof s.cmd=="string"?s.cmd:null;if(i&&Gp(t,s))return Ni(p4(i),r);const o=m4(s,["command","cmd","path","filePath","file_path","query","url","prompt","message"])??m4(s,["pattern","name","title","target","tool"])??null;if(o)return Ni(o,r);if(Array.isArray(s.paths)&&s.paths.length>0){const l=s.paths.find(c=>typeof c=="string"&&c.trim().length>0);if(l)return Ni(`${s.paths.length} paths, starting with ${l}`,r)}const a=Object.keys(s);return a.length===0?`No ${t} input`:a.length===1?Ni(`${a[0]} payload`,r):Ni(`${a.length} fields: ${a.slice(0,3).join(", ")}`,r)}function EU(t){var i;if(!t)return null;const e=t.split(/\r?\n/),n=new Map;let r=e.findIndex(o=>o.trim()==="");r===-1&&(r=e.length);for(let o=0;o<r;o+=1){const a=(i=e[o])==null?void 0:i.match(/^([a-z_]+):\s*(.+)$/i);a&&n.set(a[1].toLowerCase(),Vo(a[2]))}const s=e.slice(Math.min(r+1,e.length)).map(o=>Vo(o)).filter(Boolean).join(`
|
|
805
805
|
`);return{command:n.get("command")??null,status:n.get("status")??null,exitCode:n.get("exit_code")??null,body:s}}function Gp(t,e){if(t==="command_execution"||t==="shell"||t==="shellToolCall"||t==="bash")return!0;if(typeof e=="string")return/\b(?:bash|zsh|sh|cmd|powershell)\b/i.test(e);const n=_N(e);return!!(n&&(typeof n.command=="string"||typeof n.cmd=="string"))}function aIe(t,e){return Gp(t,e)?"Executing command":_U(t)}function lIe(t,e,n){if(!t)return e?"Tool failed":"Waiting for result";const r=EU(t);if(r){if(r.body)return Ni(r.body.split(`
|
|
806
806
|
`)[0]??r.body,n==="compact"?84:140);if(r.status==="completed")return"Completed";if(r.status==="failed"||r.status==="error")return r.exitCode?`Failed with exit code ${r.exitCode}`:"Failed"}const i=t.split(/\r?\n/).map(o=>Vo(o)).filter(Boolean)[0]??t;return Ni(i,n==="compact"?84:140)}function cIe(t){const e=t.match(/^item (started|completed):\s*([a-z0-9_-]+)(?:\s+\(id=([^)]+)\))?$/i);return e?{status:e[1].toLowerCase()==="started"?"running":"completed",name:_U(e[2]??"Activity"),activityId:e[3]||void 0}:null}function uIe(t){return Vo(t).toLowerCase().startsWith("[paperclip] skipping saved session resume")}function dIe(t){const e=[];let n=[],r=null,s;const i=()=>{n.length===0||!r||(e.push({type:"command_group",ts:r,endTs:s,items:n}),n=[],r=null,s=void 0)};for(const o of t){if(o.type==="tool"&&Gp(o.name,o.input)){r||(r=o.ts),s=o.endTs??o.ts,n.push({ts:o.ts,endTs:o.endTs,input:o.input,result:o.result,isError:o.isError,status:o.status});continue}i(),e.push(o)}return i(),e}function fIe(t,e){const n=[],r=new Map,s=new Map;for(const i of t){const o=n[n.length-1];if(i.kind==="assistant"||i.kind==="user"){const l=e&&i.kind==="assistant"&&i.delta===!0;(o==null?void 0:o.type)==="message"&&o.role===i.kind?(o.text+=o.text.endsWith(`
|
|
807
807
|
`)||i.text.startsWith(`
|