@kabmo-labs/kabmo 0.41.0 → 0.42.1
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/client/index.html +1 -1
- package/dist/client/index.js +647 -633
- package/dist/client/static/js/{CsvGrid-60njj97j.js → CsvGrid-8gdp5b49.js} +2 -2
- package/dist/client/static/js/{DocxView-rsv0j46a.js → DocxView-j9sphgra.js} +5 -5
- package/dist/client/static/js/{DrawioView-n2g5df3a.js → DrawioView-xsgjc7d8.js} +2 -2
- package/dist/client/static/js/ImageView-ve9hc519.js +1 -0
- package/dist/client/static/js/LayoutWrapper-5mqffvkc.js +2 -0
- package/dist/client/static/js/Modal-50whypff.js +38 -0
- package/dist/client/static/js/{PdfView-1r7a0qkp.js → PdfView-afd5cg54.js} +1 -1
- package/dist/client/static/js/SessionsView-7719nvy0.js +1 -0
- package/dist/client/static/js/{SheetView-bt5pp042.js → SheetView-gfzgxb4r.js} +25 -25
- package/dist/client/static/js/{SvgPreview-vfmqgmrx.js → SvgPreview-225pkb99.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-8k5hk1yx.js → abnfDiagram-O67JEVCF-z70sk69m.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-cagtcfhk.js +1 -0
- package/dist/client/static/js/architectureDiagram-NJMV4G6O-pf1gpkje.js +36 -0
- package/dist/client/static/js/{astro-0rh34hha.js → astro-nn7xg0we.js} +1 -1
- package/dist/client/static/js/bash-fjzhxy10.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-04sbtdth.js → blockDiagram-BEXU5L5S-sr25kbn6.js} +6 -6
- package/dist/client/static/js/c-wqtyezvw.js +1 -0
- package/dist/client/static/js/c4Diagram-YGBWAQC7-znstpg86.js +38 -0
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-18cc0bsb.js → classDiagram-v2-NBCMYWYE-7n0pdcd8.js} +6 -6
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-dk683zvp.js → cose-bilkent-JH36ORCC-zn3qw4c4.js} +1 -1
- package/dist/client/static/js/cpp-y0nzwner.js +1 -0
- package/dist/client/static/js/css-a13jmmnc.js +1 -0
- package/dist/client/static/js/css-n2waj098.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-6g2ydrss.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-m2sx8d8s.js → cynefinDiagram-VND7K2PF-3z41vtzs.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-qf3pr59p.js → dagre-6A5THRUB-5j3zn883.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-twnz23mt.js → diagram-22UHCM2B-ryw1w2kh.js} +10 -10
- package/dist/client/static/js/{diagram-3UASUU5V-417bas6t.js → diagram-3UASUU5V-p91q4gkh.js} +1 -1
- package/dist/client/static/js/diagram-ATOU4E4O-22dn73g4.js +3 -0
- package/dist/client/static/js/diagram-CDSNMT55-589p9n53.js +30 -0
- package/dist/client/static/js/{diagram-MLGK6HIB-7a0h1hs3.js → diagram-MLGK6HIB-ezw06wbx.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-w75bftmd.js → diagram-MPIPVDR6-cfwrsvk1.js} +2 -2
- package/dist/client/static/js/{dockerfile-g5qbaeq3.js → dockerfile-r4k7q34y.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-vdzm3tsv.js → ebnfDiagram-ZINNZB2B-3rv2wvbf.js} +1 -1
- package/dist/client/static/js/{elixir-gpez1k9m.js → elixir-szk51ehr.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-2fsbb484.js → elk-276RUBZZ-ma40kneq.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-vnkztq7d.js → erDiagram-OPXOYQCR-xwstsfqa.js} +6 -6
- package/dist/client/static/js/{erlang-jqqa3ehb.js → erlang-zwy7cqdk.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-b774qbn2.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-evp84v09.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-pbvcch52.js → ganttDiagram-FUAMR5RP-qxyx9tr9.js} +2 -2
- package/dist/client/static/js/gitGraph-4MIJSDKK-b047d6vk.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-dkvktvzr.js → gitGraphDiagram-X574FWY7-v6sg7bkh.js} +2 -2
- package/dist/client/static/js/graphql-gvb7e2eb.js +1 -0
- package/dist/client/static/js/html-tbz83eke.js +1 -0
- package/dist/client/static/js/index-001vebsp.js +2 -0
- package/dist/client/static/js/{index-rc8wrs2a.js → index-03pyvmcz.js} +2 -2
- package/dist/client/static/js/index-0nca2nhp.js +1 -0
- package/dist/client/static/js/{index-3rymer2w.js → index-0p43qr4k.js} +1 -1
- package/dist/client/static/js/{index-amawahyh.js → index-2w9j2nj4.js} +2 -2
- package/dist/client/static/js/{index-f8pq132s.js → index-313ctswm.js} +1 -1
- package/dist/client/static/js/{index-a4ed3mks.js → index-3d40c0a7.js} +5 -5
- package/dist/client/static/js/{index-pn91shfp.js → index-4cncqz8j.js} +2 -2
- package/dist/client/static/js/{index-9fnzcg2x.js → index-4y0ayjfx.js} +2 -2
- package/dist/client/static/js/index-5599dngt.js +1 -0
- package/dist/client/static/js/index-5asf5625.js +4 -0
- package/dist/client/static/js/{index-tgper3yy.js → index-6dxs0tvg.js} +2 -2
- package/dist/client/static/js/{index-zfykeg7x.js → index-6eq445nn.js} +10 -10
- package/dist/client/static/js/index-869bpqcs.js +12 -0
- package/dist/client/static/js/{index-zye9309h.js → index-8b3t2y77.js} +2 -2
- package/dist/client/static/js/{index-rdqn92tc.js → index-8fvmyv7t.js} +2 -2
- package/dist/client/static/js/{index-0xaz2eyv.js → index-8pdz41yh.js} +3 -3
- package/dist/client/static/js/{index-ne131hmw.js → index-9hzfvjrb.js} +2 -2
- package/dist/client/static/js/{index-xfa5hswh.js → index-9ss64g4g.js} +1 -1
- package/dist/client/static/js/{index-yzg9mbsv.js → index-b0v6gwym.js} +2 -2
- package/dist/client/static/js/{index-j5ram1ve.js → index-b37ewyvk.js} +2 -2
- package/dist/client/static/js/{index-e6qjfcz9.js → index-b3d2k7ec.js} +1 -1
- package/dist/client/static/js/{index-6fx2t6y7.js → index-b42t14wk.js} +13 -13
- package/dist/client/static/js/{index-pbsm2vw7.js → index-cqaz1281.js} +2 -2
- package/dist/client/static/js/{index-pfbyfab5.js → index-df4yxfzd.js} +2 -2
- package/dist/client/static/js/{index-yq9vnd1y.js → index-dfqmwm7j.js} +2 -2
- package/dist/client/static/js/{index-0c6vpk89.js → index-e1yz59fa.js} +2 -2
- package/dist/client/static/js/{index-ce4vytm6.js → index-e6any867.js} +2 -2
- package/dist/client/static/js/index-f4vr1c6e.css +1 -0
- package/dist/client/static/js/{index-cytks03p.js → index-feffxxss.js} +2 -2
- package/dist/client/static/js/{index-c6kx7s6a.js → index-gsxebrq9.js} +2 -2
- package/dist/client/static/js/{index-s78n0dtv.js → index-hga3e13s.js} +2 -2
- package/dist/client/static/js/{index-ajjq0b8y.js → index-hw14rhen.js} +2 -2
- package/dist/client/static/js/{index-sj4y8kj2.js → index-j17h4z6f.js} +2 -2
- package/dist/client/static/js/{index-7w3gqw2b.js → index-kh6vp5w5.js} +1 -1
- package/dist/client/static/js/{index-djv15k5s.js → index-ktbrmp29.js} +2 -2
- package/dist/client/static/js/{index-2z9wrb46.js → index-mphhvgm9.js} +2 -2
- package/dist/client/static/js/{index-rebnv57p.js → index-mq6s2faf.js} +2 -2
- package/dist/client/static/js/index-mvykbyhe.js +1 -0
- package/dist/client/static/js/{index-ngk9h0v9.js → index-nh29fkk9.js} +2 -2
- package/dist/client/static/js/{index-gn92c6hp.js → index-p0ez6hqd.js} +2 -2
- package/dist/client/static/js/{index-e7yf273s.js → index-pkes9492.js} +2 -2
- package/dist/client/static/js/{index-hz177dr2.js → index-pxtff3ez.js} +2 -2
- package/dist/client/static/js/{index-fg965t62.js → index-pysqpc5n.js} +2 -2
- package/dist/client/static/js/{index-4jk8ngjg.js → index-q3qpm7jn.js} +2 -2
- package/dist/client/static/js/{index-55hq7tnj.js → index-qh753ynv.js} +1 -1
- package/dist/client/static/js/{index-ntcqyqd5.js → index-qx6x4z0y.js} +2 -2
- package/dist/client/static/js/{index-agdbjh5k.js → index-r8cc80w5.js} +2 -2
- package/dist/client/static/js/{index-9dnkfpx4.js → index-rab39785.js} +2 -2
- package/dist/client/static/js/index-rt6ac0kk.js +478 -0
- package/dist/client/static/js/{index-haaz8t7e.js → index-sk9ej289.js} +2 -2
- package/dist/client/static/js/{index-ds6a2cx7.js → index-sr7sdm2t.js} +5 -5
- package/dist/client/static/js/index-v5dbrq83.js +2 -0
- package/dist/client/static/js/index-w5q9ymf4.js +1 -0
- package/dist/client/static/js/{index-x2kb1kx5.js → index-x7a5jpvq.js} +3 -3
- package/dist/client/static/js/{index-re1xz433.js → index-x7m6dmt4.js} +1 -1
- package/dist/client/static/js/index-xsts4pqm.js +314 -0
- package/dist/client/static/js/index-y1p3bdsw.js +9 -0
- package/dist/client/static/js/info-A6RAGUB7-n495k952.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-mh6yks62.js → infoDiagram-VRGFBTTK-0anekyhb.js} +2 -2
- package/dist/client/static/js/ini-2gvjwh83.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-hnfqppnv.js → ishikawaDiagram-OU5B5YK6-zxpmfkjb.js} +2 -2
- package/dist/client/static/js/java-1xwcq79s.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-s4nv1f3q.js → journeyDiagram-ZHPQQLJL-1e86fzra.js} +3 -3
- package/dist/client/static/js/json-4pqjabgq.js +1 -0
- package/dist/client/static/js/jsx-wcsss15s.js +1 -0
- package/dist/client/static/js/{julia-yre4bxb9.js → julia-2eekpjq8.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-t8kbfefp.js → kanban-definition-PNTS6WVX-e85hhmr1.js} +6 -6
- package/dist/client/static/js/lua-h7vjcn0h.js +1 -0
- package/dist/client/static/js/markdown-f30jjjh9.js +1 -0
- package/dist/client/static/js/{mermaid.core-0784021p.js → mermaid.core-jpcrnzyw.js} +6 -6
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-swkkze8c.js → mindmap-definition-NLK3R4M7-xwy5928e.js} +5 -5
- package/dist/client/static/js/one-dark-pro-r0tswz8r.js +1 -0
- package/dist/client/static/js/one-light-xzcfrptf.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-zajj62z6.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-jqayzh7z.js → pegDiagram-GJSIUBJH-7dy6pw26.js} +1 -1
- package/dist/client/static/js/{perl-weeskn1v.js → perl-dtn1fccw.js} +1 -1
- package/dist/client/static/js/{php-vf3045p9.js → php-7av78hch.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-1ve78y5f.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-w03a65ky.js → pieDiagram-5QR66LMP-nrv2t5yn.js} +2 -2
- package/dist/client/static/js/properties-ymexza6q.js +1 -0
- package/dist/client/static/js/python-31ycwa66.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-2j7sfa9s.js → quadrantDiagram-O4NWA36T-3nt63xr8.js} +4 -4
- package/dist/client/static/js/r-t2nne4xp.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-8rqadb58.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-v6ppm8dy.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-9j6bae14.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-56cpyt0g.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-yfdmspf4.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-jtkkgy34.js → railroadDiagram-XR7U4H2S-evm05hzp.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-t85ckjdb.js → requirementDiagram-PLB6GJNP-tzrcmktj.js} +4 -4
- package/dist/client/static/js/{ruby-1a2ryzy6.js → ruby-s2bqr910.js} +1 -1
- package/dist/client/static/js/{rust-736r0f0v.js → rust-pcvgybk3.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-5pfkw8ne.js → sankeyDiagram-IPEJSGJF-jvjd5rz8.js} +2 -2
- package/dist/client/static/js/{sass-tq4vw7hd.js → sass-bm32bb5k.js} +1 -1
- package/dist/client/static/js/{scss-x7ddw6gb.js → scss-e2dndbfa.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-55vs9zv5.js → sequenceDiagram-PO4LG4MO-0zvjwx29.js} +10 -10
- package/dist/client/static/js/{sizeCapture-INFHLROL-pzqqd7f4.js → sizeCapture-INFHLROL-6t6g0edv.js} +1 -1
- package/dist/client/static/js/sql-bwnasywx.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-6nhrph8n.js → stateDiagram-v2-GCMORJYK-nb13b23a.js} +6 -6
- package/dist/client/static/js/{svelte-0hv6pak2.js → svelte-ztkaww47.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-6tcnxfbv.js → swimlanes-2SLR337P-ef8vmg6f.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-f4sx355z.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-1dz46nt5.js → timeline-definition-EJHVYXUP-3bfph698.js} +3 -3
- package/dist/client/static/js/treeView-Q6P3EWNA-vwpg3wp8.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-htfxwd32.js +1 -0
- package/dist/client/static/js/tsx-zfy727zs.js +1 -0
- package/dist/client/static/js/typescript-p3syh43m.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-b3jfveq6.js → usecaseDiagram-POWQR4AR-vj6yj6tc.js} +29 -29
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-dnc3jqvp.js → vennDiagram-UO4OBE2U-9xyyabaq.js} +2 -2
- package/dist/client/static/js/{vue-zccj3qa5.js → vue-cbqm4bed.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-hapfjkzq.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-466m8400.js → wardleyDiagram-VNRHLVJA-zpcwgv9d.js} +4 -4
- package/dist/client/static/js/xml-4enq788a.js +1 -0
- package/dist/client/static/js/xychartDiagram-PMCCYNJV-pdr2rms2.js +7 -0
- package/dist/client/static/js/yaml-pjtt3jsc.js +1 -0
- package/package.json +1 -1
- package/src/cli/lib/commands/session.js +12 -1
- package/src/client/components/common/batch-selection/folder-state.ts +2 -2
- package/src/client/components/common/server-control/Panel.tsx +16 -5
- package/src/client/components/common/server-control/index.test.tsx +63 -9
- package/src/client/components/common/session-row/TrailingSlot.tsx +8 -0
- package/src/client/components/common/session-row/index.tsx +16 -9
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +1 -1
- package/src/client/components/layout/session-sidebar/ClassicView.tsx +13 -0
- package/src/client/components/layout/session-sidebar/HarnessFilter.tsx +175 -0
- package/src/client/components/layout/session-sidebar/SessionList.tsx +9 -1
- package/src/client/components/layout/session-sidebar/SessionsView.tsx +6 -0
- package/src/client/components/layout/session-sidebar/harness-filter.test.tsx +173 -0
- package/src/client/components/layout/session-sidebar/modern/FilterChips.tsx +63 -18
- package/src/client/components/layout/session-sidebar/modern/SearchField.tsx +1 -1
- package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +21 -12
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +1 -1
- package/src/client/components/layout/session-sidebar/modern/index.tsx +11 -2
- package/src/client/components/layout/session-sidebar/modern/search-field.test.tsx +96 -0
- package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +3 -0
- package/src/client/components/layout/session-sidebar/variant-props.ts +7 -0
- package/src/client/components/mobile/SessionSidebar.tsx +14 -25
- package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +19 -0
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +1 -1
- package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +14 -123
- package/src/client/components/workspace/chat-timeline/OrchestrationNotice.tsx +214 -0
- package/src/client/components/workspace/chat-timeline/UserTurn.test.tsx +126 -0
- package/src/client/components/workspace/chat-timeline/UserTurn.tsx +183 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.image.test.ts +147 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +51 -83
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +44 -63
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ReadDirectory.tsx +72 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ReadImage.tsx +51 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/read-test-util.ts +91 -0
- package/src/client/components/workspace/git-panel/commit-modal/CommitRow.test.ts +80 -62
- package/src/client/components/workspace/git-panel/commit-modal/CommitRow.tsx +15 -33
- package/src/client/components/workspace/git-panel/commit-modal/Header.tsx +1 -1
- package/src/client/components/workspace/terminal-panel/copy.test.ts +179 -0
- package/src/client/components/workspace/terminal-panel/copy.ts +76 -0
- package/src/client/components/workspace/terminal-panel/mount.ts +13 -0
- package/src/client/data/settings/omp-schema.json +39 -18
- package/src/client/hooks/chat/omp/pending-child.test.ts +1 -1
- package/src/client/hooks/chat/omp/session-sidebar-controller.test.ts +61 -0
- package/src/client/hooks/chat/omp/session-sidebar-controller.ts +37 -39
- package/src/client/hooks/chat/omp/sidebar-filter.ts +62 -0
- package/src/client/hooks/chat/timeline/composer-modes.ts +10 -7
- package/src/client/hooks/chat/timeline/plan-review-republish.test.ts +121 -0
- package/src/client/hooks/chat/timeline/plan-review.ts +12 -3
- package/src/client/hooks/chat/timeline/session-changes.test.ts +85 -0
- package/src/client/hooks/chat/timeline/session-changes.ts +8 -5
- package/src/client/hooks/shell/servers.ts +60 -2
- package/src/client/hooks/ui/updates/mobile-flow.ts +56 -0
- package/src/client/tailwind.css +58 -0
- package/src/server/lib/harness/acp/acp-audit.server.ts +1 -1
- package/src/server/lib/harness/acp/commands.test.ts +1 -0
- package/src/server/lib/harness/acp/commands.ts +12 -4
- package/src/server/lib/harness/acp/replay-transcript.ts +32 -13
- package/src/server/lib/harness/acp/session-exit.ts +39 -5
- package/src/server/lib/harness/acp/session-transcript.server.test.ts +162 -0
- package/src/server/lib/harness/acp/session-transcript.server.ts +350 -0
- package/src/server/lib/harness/acp/session-turns.ts +67 -12
- package/src/server/lib/harness/acp/session.test.ts +61 -0
- package/src/server/lib/harness/acp/session.ts +21 -26
- package/src/server/lib/harness/acp/turn-outcome.server.test.ts +97 -0
- package/src/server/lib/harness/acp/turn-outcome.server.ts +71 -0
- package/src/server/lib/harness/acp/turn-silence.ts +52 -0
- package/src/server/lib/harness/acp/turn.test.ts +85 -3
- package/src/server/lib/harness/acp/turn.ts +62 -4
- package/src/server/lib/harness/schema.server.ts +18 -0
- package/src/server/lib/harness/spawn.server.ts +14 -1
- package/src/server/lib/lifecycle/after-listen.ts +10 -0
- package/src/server/lib/models/provider-icon-fetch.ts +2 -2
- package/src/server/lib/models/provider-icon-parse.test.ts +0 -12
- package/src/server/lib/models/provider-icon-parse.ts +0 -8
- package/src/server/lib/omp/rpc/frame-fold-contract.ts +21 -0
- package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +4 -0
- package/src/server/lib/omp/rpc/frame-fold.test.ts +16 -1
- package/src/server/lib/omp/rpc/frame-fold.ts +42 -6
- package/src/server/lib/omp/rpc/manager.ts +9 -8
- package/src/server/lib/omp/rpc/retry-saga.ts +54 -0
- package/src/server/lib/omp/rpc/run-settle.server.ts +38 -5
- package/src/server/lib/omp/rpc/run-settle.test.ts +5 -2
- package/src/server/lib/omp/rpc/session-commands-dialog.test.ts +6 -20
- package/src/server/lib/omp/rpc/session-commands-mapping.test.ts +131 -0
- package/src/server/lib/omp/rpc/session-commands.test.ts +95 -116
- package/src/server/lib/omp/rpc/session-commands.ts +38 -17
- package/src/server/lib/omp/rpc/terminal-settle.test.ts +223 -0
- package/src/server/lib/omp/rpc/terminal-settle.ts +127 -29
- package/src/server/lib/omp/session/blobs.server.test.ts +34 -0
- package/src/server/lib/omp/session/blobs.server.ts +8 -3
- package/src/server/lib/omp/session/delete.server.ts +4 -0
- package/src/server/lib/omp/session/sidebar-activity.server.test.ts +2 -1
- package/src/server/lib/sessions/notify.server.test.ts +11 -3
- package/src/server/lib/sessions/notify.server.ts +67 -42
- package/src/server/lib/sessions/spawn.server.test.ts +5 -1
- package/src/server/lib/sessions/spawn.server.ts +8 -3
- package/src/server/routes/agent/harness-command.test.ts +71 -0
- package/src/server/routes/agent/harness-command.ts +27 -13
- package/src/server/routes/chat/imported.ts +5 -2
- package/src/server/routes/chat/live-meta.ts +42 -0
- package/src/server/routes/chat/session.test.ts +110 -0
- package/src/server/routes/chat/session.ts +31 -34
- package/src/server/routes/sessions/answer.test.ts +62 -0
- package/src/server/routes/sessions/answer.ts +13 -2
- package/src/shared/lib/chat/composer/delegation.ts +11 -7
- package/src/shared/lib/chat/export-markdown.ts +19 -0
- package/src/shared/lib/chat/orchestration/notice.test.ts +118 -0
- package/src/shared/lib/chat/orchestration/notice.ts +183 -0
- package/src/shared/lib/chat/timeline/omp-callbacks.ts +6 -1
- package/src/shared/lib/chat/transcript-rows.ts +22 -0
- package/src/shared/lib/fs/file-kind.test.ts +46 -3
- package/src/shared/lib/fs/file-kind.ts +40 -9
- package/src/shared/lib/icons/tint-hues.generated.ts +36 -36
- package/src/shared/lib/omp/config/schema-releases.test.ts +29 -0
- package/src/shared/lib/workspace/harness-filter.test.ts +89 -0
- package/src/shared/lib/workspace/harness-filter.ts +75 -0
- package/src/{client/lib → shared/lib/workspace}/session-tree.test.ts +1 -1
- package/src/shared/lib/workspace/session-visibility.test.ts +71 -0
- package/src/shared/lib/workspace/session-visibility.ts +48 -23
- package/src/shared/lib/workspace/sidebar-filter-row.test.ts +64 -23
- package/src/shared/lib/workspace/sidebar-filter-row.ts +89 -31
- package/dist/client/static/js/ImageView-t330jx6y.js +0 -1
- package/dist/client/static/js/LayoutWrapper-qp6nsw65.js +0 -2
- package/dist/client/static/js/Modal-sbya4ahp.js +0 -38
- package/dist/client/static/js/SessionsView-yqs5m8tj.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-1wqga929.js +0 -1
- package/dist/client/static/js/architectureDiagram-NJMV4G6O-7jcb7fgy.js +0 -36
- package/dist/client/static/js/bash-vv2ysp0a.js +0 -1
- package/dist/client/static/js/c-67jyc7sg.js +0 -1
- package/dist/client/static/js/c4Diagram-YGBWAQC7-vwac9za0.js +0 -38
- package/dist/client/static/js/cpp-crfbnwv8.js +0 -1
- package/dist/client/static/js/css-2re5mbea.js +0 -1
- package/dist/client/static/js/css-983fbv00.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-j2dpdgkh.js +0 -1
- package/dist/client/static/js/diagram-ATOU4E4O-n63cpdnx.js +0 -3
- package/dist/client/static/js/diagram-CDSNMT55-v86p14dd.js +0 -30
- package/dist/client/static/js/eventmodeling-NTZA5JFV-xjvjawd3.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-j21f2bfg.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-r0zbk95f.js +0 -1
- package/dist/client/static/js/graphql-npbd9fdx.js +0 -1
- package/dist/client/static/js/html-1cpe2xc8.js +0 -1
- package/dist/client/static/js/index-1sw00wm0.js +0 -2
- package/dist/client/static/js/index-7fwppdkn.js +0 -1
- package/dist/client/static/js/index-ae91g8ka.js +0 -9
- package/dist/client/static/js/index-b6cyn4hr.js +0 -314
- package/dist/client/static/js/index-efn233xp.js +0 -4
- package/dist/client/static/js/index-esx3zwnt.js +0 -1
- package/dist/client/static/js/index-fbbp5cwj.js +0 -2
- package/dist/client/static/js/index-g1cggqgx.js +0 -12
- package/dist/client/static/js/index-ghsdzs4m.js +0 -1
- package/dist/client/static/js/index-gs7ytgdw.js +0 -474
- package/dist/client/static/js/index-jqs23cc7.css +0 -1
- package/dist/client/static/js/index-qjsy6p86.js +0 -1
- package/dist/client/static/js/info-A6RAGUB7-a8xap43w.js +0 -1
- package/dist/client/static/js/ini-df5bw23e.js +0 -1
- package/dist/client/static/js/java-8j33rj1p.js +0 -1
- package/dist/client/static/js/json-g5ggnd94.js +0 -1
- package/dist/client/static/js/jsx-f6p72qpc.js +0 -1
- package/dist/client/static/js/lua-bahx6qze.js +0 -1
- package/dist/client/static/js/markdown-9dhg1fax.js +0 -1
- package/dist/client/static/js/one-dark-pro-h5tmw145.js +0 -1
- package/dist/client/static/js/one-light-x7vj1pxr.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-b5bvg6v1.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-77ee73zg.js +0 -1
- package/dist/client/static/js/properties-49mfnee4.js +0 -1
- package/dist/client/static/js/python-qb69wp1s.js +0 -1
- package/dist/client/static/js/r-s3mf2tch.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-cp79xtvb.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-dcpgqhcb.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-qasqv686.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-e46908rd.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-7009t6bk.js +0 -1
- package/dist/client/static/js/sql-aczp05f2.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-7xrkrkpa.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-tpn62q8j.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-w910f1g4.js +0 -1
- package/dist/client/static/js/tsx-s1shkfg9.js +0 -1
- package/dist/client/static/js/typescript-htx9v6bf.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-pt9tq808.js +0 -1
- package/dist/client/static/js/xml-wr1dxav5.js +0 -1
- package/dist/client/static/js/xychartDiagram-PMCCYNJV-kryrpqp1.js +0 -7
- package/dist/client/static/js/yaml-0y9fdskg.js +0 -1
- /package/src/{client/lib → shared/lib/workspace}/session-tree.ts +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{d,n,o,W,i,Ao,u,a,Ue,$s,Ve,Le,e,vr,Kn,S,ju,za,s,E,Vn,Nn,Ga,m,yo,en,_,qr,Oi,$i,f,B,nt,re,An,rn,Y,D,Gi,ji,qi,Pn,cn,Wi,b,Ye,gr,ci,Ks,Vs,Yi,uA,lt,mA,fA,Ji,gA,AA,Zi,hA,bA,bt,yA,vA,Vu,kA,xA,Tt,Ba,J,_o,To,wt,pc,nd,Ym,ke,bn,On,sd,ra,$n,Za,Qt,k,M,Re,Sr,yn,aa,ae,Vt,pn,ue,tr,Xa,me,pt,eo,Tr,Yt,T,Oe,Bn,ye,I,pi,ph,mh,fh,gh,Ah,hh,bh,yh,Qc,vh,gg,ld,zn,ll,Jm,kh,xe,Un,Zm,ds,mi,cl,cd,ul,Ag,Xm,ef,tf,nf,dl,dd,pd,Dr,pl,rf,af,of,sf,lf,Eh,Bh,ml,uf,fi,pf,Fc,mf,bg,ff}from"./index-rt6ac0kk.js";import{hi}from"./index-001vebsp.js";import{ki}from"./index-df4yxfzd.js";var Vl={name:"square-dashed-text",size:24,node:[["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 14v1",key:"169vum"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h6",key:"1vyc9m"}],["path",{d:"M7 8h8",key:"1jbsf9"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M9 3h1",key:"1yesri"}]],aliases:["text-selection","text-select"]},$r=s(Vl);var Wl={name:"text-align-justify",size:24,node:[["path",{d:"M3 5h18",key:"1u36vt"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 19h18",key:"awlh7x"}]],aliases:["align-justify"]},It=s(Wl);var Ul={name:"diff",size:24,node:[["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M5 21h14",key:"11awu3"}]]},Ot=s(Ul);var $l={name:"file-x",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]},Oc=s($l);var _l={name:"message-square-off",size:24,node:[["path",{d:"M19 19H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.7.7 0 0 1 2 21.286V5a2 2 0 0 1 1.184-1.826",key:"1wyg69"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.656 3H20a2 2 0 0 1 2 2v11.344",key:"mhl4k6"}]]},_r=s(_l);var Kl={name:"space",size:24,node:[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]},Mn=s(Kl);function Kr({filePath:t,status:r,isStaged:l,repo:c,root:p,enabled:h=!0}){let[g,y]=n(""),[x,w]=n(""),[v,C]=n(""),[R,O]=n(r),[P,N]=n(l),[V,A]=n(!0),[L,F]=n(null),U=i(l),z=i(r),Z=i(0),q=a(async(G={})=>{if(!h||!t)return;let ne=++Z.current;A(!0),F(null);try{let H=G.staged??U.current,X=G.status??z.current,te=new URLSearchParams({fileDiff:"1",file:t,staged:H?"1":"0",repo:c||"."});if(X)te.set("status",X);if(p)te.set("root",p);let le=await fetch(`/api/fs/git?${te.toString()}`),ie=await le.json().catch(()=>null);if(ne!==Z.current)return;if(ie?.success){if(y(ie.diff||""),w(ie.oldContent??""),C(ie.newContent??""),ie.status)z.current=ie.status,O(ie.status);if(typeof ie.staged==="boolean")U.current=ie.staged,N(ie.staged)}else F(ie?.error||`Failed to load file diff (HTTP ${le.status})`)}catch(H){if(ne!==Z.current)return;F(H instanceof Error?H.message:"Error fetching diff")}finally{if(ne===Z.current)A(!1)}},[t,c,p,h]);o(()=>{if(!h)return;U.current=l,z.current=r,O(r),N(l),q()},[q,l,r,h]);let K=a((G)=>{if(typeof G.staged==="boolean")U.current=G.staged,N(G.staged);if(G.status)z.current=G.status,O(G.status)},[]);return{rawDiff:g,oldContent:x,newContent:v,currentStatus:R,currentStaged:P,isLoading:V,errorMessage:L,fetchDiff:q,adoptState:K}}function Hl(t){if(t==="added")return"A";if(t==="deleted")return"D";return"M"}function Hr(t){let[r,l]=n(""),[c,p]=n(""),[h,g]=n(""),[y,x]=n("M"),[w,v]=n(Boolean(t)),[C,R]=n(null),O=i(0),P=t?.sessionId,N=t?.path,V=t?.from,A=t?.to,L=a(async()=>{if(!P||!N||V===void 0||A===void 0)return;let U=++O.current;v(!0),R(null);try{let z=new URLSearchParams({path:N,from:String(V),to:String(A)}),Z=await fetch(`/api/sessions/${encodeURIComponent(P)}/changes/diff?${z.toString()}`),q=await Z.json().catch(()=>null);if(U!==O.current)return;if(q?.success){if(p(q.oldContent??""),g(q.newContent??""),l(q.diff??""),x(Hl(q.status)),q.unavailable)R("The journal did not store this file’s content (over 8 MB), so the two sides are unknown.")}else R(q?.error||`Failed to load the journal diff (HTTP ${Z.status})`)}catch(z){if(U!==O.current)return;R(z instanceof Error?z.message:"Error fetching the journal diff")}finally{if(U===O.current)v(!1)}},[P,N,V,A]);o(()=>{L()},[L]);let F=a(()=>{},[]);return{rawDiff:r,oldContent:c,newContent:h,currentStatus:y,currentStaged:!1,isLoading:w,errorMessage:C,fetchDiff:L,adoptState:F}}function zr(t){let{filePath:r,repo:l,root:c,staged:p,conflicted:h,adoptState:g,fetchDiff:y,onFileSaved:x}=t,[w,v]=n(!1),[C,R]=n(null),[O,P]=n({}),N=a(async(A)=>{let L=new FormData;for(let[F,U]of Object.entries(A))L.set(F,U);if(L.set("repo",l||"."),c)L.set("root",c);try{let F=await fetch("/api/fs/git",{method:"POST",body:L}),U=await F.json().catch(()=>null);if(!F.ok||!U?.success)return R(U?.error||`Request failed (HTTP ${F.status})`),!1;return R(null),!0}catch(F){return R(F instanceof Error?F.message:"Request failed"),!1}},[l,c]),V=a(async(A,L)=>{v(!0);try{if(!await N(A))return;await L()}finally{v(!1)}},[N]);return o(()=>{if(!h){P({});return}let A=!1,L=new URLSearchParams({conflictMarkers:"1",file:r,repo:l||"."});if(c)L.set("root",c);return fetch(`/api/fs/git?${L.toString()}`).then((F)=>F.json()).then((F)=>{if(!A)P(F.markers??{})}).catch(()=>{if(!A)P({})}),()=>{A=!0}},[h,r,l,c]),{isBusy:w,error:C,markers:O,dismissError:()=>R(null),stageUnstage:()=>V({actionType:p?"unstage":"stage",file:r},async()=>{g({staged:!p}),x?.(),await y({staged:!p})}),resolve:(A)=>V({actionType:"resolve_conflict",file:r,...A?{side:A}:{}},async()=>{x?.(),await y()}),revert:()=>V({actionType:"revert",file:r},async()=>{x?.(),await y()})}}var jr=[{target:"compact",label:"Compact view",hint:"Editor takes the chat width: chat hidden, sidebar and right panel kept",Icon:_r},{target:"full",label:"Full view",hint:"Editor takes the chat and sidebar width: chat and sidebar hidden, right panel kept",Icon:yo}];function Gr(){let[t,r]=za(pf,Fc);return{mode:mf(t)?t:Fc,setMode:r}}function bd(){let{mode:t,setMode:r}=Gr();return jr.map(({target:l,label:c,Icon:p})=>({label:c,icon:p,active:t===l,onSelect:()=>r(bg(t,l))}))}function yd({size:t=14}){let{mode:r,setMode:l}=Gr();return e(d,{children:jr.map(({target:c,label:p,hint:h,Icon:g})=>{let y=r===c;return e("button",{type:"button",onClick:()=>l(bg(r,c)),className:`flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer flex-shrink-0 ${y?"bg-ink/10 text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,title:h,"aria-label":p,"aria-pressed":y,children:e(g,{size:t})},c)})})}var Pt="px-2 py-0.5 rounded text-[11px] font-medium flex items-center space-x-1 transition-colors cursor-pointer flex-shrink-0",Jr="flex items-center bg-canvas rounded border border-ink/15 p-0.5 mr-0.5 @[440px]:mr-1";function Xr({viewMode:t,onSetViewMode:r}){return e("div",{className:Jr,children:[e("button",{type:"button",onClick:()=>r("split"),className:`${Pt} ${t==="split"?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Split (side-by-side) diff","aria-label":"Split (side-by-side) diff","aria-pressed":t==="split",children:[e(Nn,{size:12}),e("span",{className:"hidden @[420px]:inline",children:"Split"})]}),e("button",{type:"button",onClick:()=>r("unified"),className:`${Pt} ${t==="unified"?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Unified diff","aria-label":"Unified diff","aria-pressed":t==="unified",children:[e(It,{size:12}),e("span",{className:"hidden @[420px]:inline",children:"Unified"})]})]})}function Yr({contentMode:t,onSetContentMode:r}){return e("div",{className:Jr,children:[e("button",{type:"button",onClick:()=>r("full"),className:`${Pt} ${t==="full"?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Full code (whole file, changes marked)","aria-label":"Full code (whole file, changes marked)","aria-pressed":t==="full",children:[e(An,{size:12}),e("span",{className:"hidden @[420px]:inline",children:"Full Code"})]}),e("button",{type:"button",onClick:()=>r("diff"),className:`${Pt} ${t==="diff"?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Diff only (changed hunks)","aria-label":"Diff only (changed hunks)","aria-pressed":t==="diff",children:[e(Ot,{size:12}),e("span",{className:"hidden @[420px]:inline",children:"Diff Only"})]})]})}var Zr="flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-ink/50";function Qr({index:t,count:r,locked:l,onStep:c}){let p=t>=0?t+1:"–";return e("div",{className:"flex items-center gap-0.5",children:[e("button",{type:"button",onClick:()=>c(-1),disabled:l,className:`${Zr} text-ink/50 hover:text-ink hover:bg-ink/5`,title:"Previous change","aria-label":"Previous change",children:e(nt,{size:13})}),e("span",{className:"text-[10px] font-mono tabular-nums text-ink/50 px-0.5 min-w-[3.5ch] text-center",title:`Changed hunk ${p} of ${r}`,"aria-live":"polite",children:[p,"/",r]}),e("button",{type:"button",onClick:()=>c(1),disabled:l,className:`${Zr} text-ink/50 hover:text-ink hover:bg-ink/5`,title:"Next change","aria-label":"Next change",children:e(B,{size:13})})]})}var Bt="flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-ink/50";function to({isStaged:t,locked:r,readOnly:l,stageLabel:c,onStageUnstage:p,onDiscard:h}){if(l)return[];let g=[];if(!t)g.push({id:"discard",actions:[{label:"Discard changes in this file",icon:cn,onSelect:h,disabled:r}],children:e("button",{type:"button",onClick:h,className:`${Bt} text-ink/50 hover:text-error hover:bg-error/10`,title:"Discard changes in this file","aria-label":"Discard changes in this file",disabled:r,children:e(cn,{size:13})})});return g.push({id:"stage",pinned:!0,actions:[{label:c,icon:t?rn:Y,onSelect:p,disabled:r}],children:e("button",{type:"button",onClick:p,className:"px-2 py-1 text-[11px] font-medium rounded border border-ink/15 hover:bg-ink/5 flex items-center space-x-1 transition-colors text-ink cursor-pointer disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent",title:c,"aria-label":c,disabled:r,children:t?e(d,{children:[e(rn,{size:12}),e("span",{className:"hidden @[360px]:inline",children:"Unstage"})]}):e(d,{children:[e(Y,{size:12}),e("span",{className:"hidden @[360px]:inline",children:"Stage"})]})})}),g}function no({filePath:t,status:r,isStaged:l,viewMode:c,contentMode:p,wordWrap:h,ignoreWhitespace:g,additions:y,deletions:x,chunkIndex:w=-1,chunkCount:v=0,onStepChunk:C,isLoading:R,isCopied:O,isBusy:P=!1,viewModeButtons:N=!0,readOnly:V=!1,onSetViewMode:A,onSetContentMode:L,onToggleWordWrap:F,onToggleWhitespace:U,onStageUnstage:z,onDiscard:Z,onOpenInEditor:q,onRefresh:K,onCopyDiff:G}){let ne=bd(),H=t.split("/").pop()||t,X=Kn(r,l),te=R||P,le=l?"Unstage file":"Stage file",ie=h?"Word wrap on":"Word wrap off",oe=g?"Whitespace changes hidden":"Hide whitespace changes",Se=O?"Copied":"Copy diff text",ce=[];if(y>0||x>0)ce.push({id:"counts",pinned:!0,actions:[],children:e("div",{className:"flex items-center space-x-1.5 text-[11px] font-mono pr-1.5 mr-0.5 @[440px]:mr-1 border-r border-ink/10",children:[y>0&&e("span",{className:"text-success font-semibold",children:["+",y]}),x>0&&e("span",{className:"text-error font-semibold",children:["-",x]})]})});if(ce.push({id:"view-mode",actions:[{label:"Split (side-by-side) diff",icon:Nn,onSelect:()=>A("split"),active:c==="split"},{label:"Unified diff",icon:It,onSelect:()=>A("unified"),active:c==="unified"}],children:e(Xr,{viewMode:c,onSetViewMode:A})}),ce.push({id:"content-mode",actions:[{label:"Full code (whole file, changes marked)",icon:An,onSelect:()=>L("full"),active:p==="full"},{label:"Diff only (changed hunks)",icon:Ot,onSelect:()=>L("diff"),active:p==="diff"}],children:e(Yr,{contentMode:p,onSetContentMode:L})}),C&&v>0)ce.push({id:"hunks",actions:[{label:"Previous change",icon:nt,onSelect:()=>C(-1),disabled:te},{label:"Next change",icon:B,onSelect:()=>C(1),disabled:te}],children:e(Qr,{index:w,count:v,locked:te,onStep:C})});if(ce.push({id:"wrap",actions:[{label:ie,icon:en,onSelect:F,active:h}],children:e("button",{type:"button",onClick:F,className:`p-1.5 rounded transition-colors cursor-pointer flex-shrink-0 ${h?"bg-ink/10 text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,title:ie,"aria-label":ie,"aria-pressed":h,children:e(en,{size:13})})}),ce.push({id:"whitespace",actions:[{label:oe,icon:Mn,onSelect:U,active:g}],children:e("button",{type:"button",onClick:U,className:`p-1.5 rounded transition-colors cursor-pointer flex-shrink-0 ${g?"bg-ink/10 text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,title:oe,"aria-label":oe,"aria-pressed":g,children:e(Mn,{size:13})})}),N)ce.push({id:"view-modes",pinned:!0,actions:ne,children:e(yd,{size:13})});if(ce.push({id:"refresh",actions:[{label:"Reload this diff",icon:D,onSelect:K,disabled:te}],children:e("button",{type:"button",onClick:K,className:`${Bt} text-ink/50 hover:text-ink hover:bg-ink/5`,title:"Reload this diff","aria-label":"Reload this diff",disabled:te,children:e(D,{size:13,className:R?"animate-spin":""})})}),ce.push({id:"copy",actions:[{label:Se,icon:re,onSelect:G}],children:e("button",{type:"button",onClick:G,className:`${Bt} text-ink/50 hover:text-ink hover:bg-ink/5`,title:Se,"aria-label":Se,children:O?e(f,{size:13,className:"text-success"}):e(re,{size:13})})}),ce.push(...to({isStaged:l,locked:te,readOnly:V,stageLabel:le,onStageUnstage:z,onDiscard:Z})),q)ce.push({id:"edit-file",pinned:!0,actions:[{label:"Open in code editor",icon:Vn,onSelect:q}],children:e("button",{type:"button",onClick:q,className:"px-2 py-1 text-[11px] font-medium rounded bg-ink text-canvas hover:bg-ink/90 flex items-center space-x-1 transition-colors shadow-xs ml-1 cursor-pointer",title:"Open in code editor","aria-label":"Open in code editor",children:[e(Vn,{size:12}),e("span",{className:"hidden @[360px]:inline",children:"Edit File"})]})});return e("div",{className:"@container flex items-center justify-between px-3 py-1.5 bg-paper border-b border-ink/10 text-xs font-sans select-none flex-shrink-0 gap-2 min-w-0",children:[e("div",{className:"hidden @[560px]:flex items-center space-x-2 min-w-0 pr-2",children:[e(lt,{name:H,size:14,className:"flex-shrink-0"}),e("span",{className:"font-mono text-ink font-medium truncate",title:t,children:H}),e("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold rounded border ${X.badgeBgClass} flex-shrink-0`,children:[X.charStatus," ",X.label]})]}),e(ki,{clusters:ce,className:"text-ink/70 ml-auto"})]})}function ro({markers:t,isBusy:r,error:l,onResolve:c,onDismissError:p}){let h=t.ours||"ours",g=t.theirs||"theirs";return e("div",{className:"flex-shrink-0 border-b border-warning/30 bg-warning/5",children:[e("div",{className:"flex items-center gap-2 px-3 py-1.5 flex-wrap",children:[e(_,{size:13,className:"text-warning flex-shrink-0"}),e("span",{className:"text-[11px] font-medium text-warning",children:"Conflicted file"}),e("div",{className:"flex items-center gap-1.5 ml-auto flex-wrap",children:[e("button",{type:"button",onClick:()=>c("ours"),disabled:r,title:`Take ${h} — \`git checkout --ours\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 max-w-[40%] truncate",children:["take ",h]}),e("button",{type:"button",onClick:()=>c("theirs"),disabled:r,title:`Take ${g} — \`git checkout --theirs\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 max-w-[40%] truncate",children:["take ",g]}),e("button",{type:"button",onClick:()=>c(""),disabled:r,title:"Mark resolved: the file was edited by hand, this stages it",className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"mark resolved"})]})]}),l&&e("div",{className:"flex items-center gap-2 px-3 py-1 border-t border-error/25 bg-error/10 text-[10px] text-error",children:[e("span",{className:"min-w-0 flex-1 truncate",title:l,children:l}),e("button",{type:"button",onClick:p,className:"px-1 rounded hover:bg-error/15 cursor-pointer",title:"Dismiss","aria-label":"Dismiss",children:"✕"})]})]})}function oo(t){let r=hi();return e(lf,{...t,themeVars:r.vars,themes:r.themes})}function io(t){let r=t.split("/").pop()??"",l=r.lastIndexOf(".");return l>0&&l<r.length-1?r.slice(l).toLowerCase():""}function Cg(t){let r=Tt("fileOpener"),l=Tt("sourceCodeRenderer"),c=Ba(),p=t.extension??io(t.path),h=r.find((y)=>y.registration.matches({path:t.path,extension:p}));if(h)return{kind:"opener",pluginId:h.pluginId,Component:h.registration.component,props:{...c,path:t.path,extension:p}};let g=l.find((y)=>y.registration.extensions.includes(p));if(g)return{kind:"source",pluginId:g.pluginId,Component:g.registration.component,props:{...c,path:t.path,content:t.content,language:t.language}};return null}function so(t){let r=Tt("diffRenderer"),l=Ba(),c=io(t.path),p=r.find((h)=>{let g=h.registration.extensions;return g===void 0||g.includes(c)});if(!p)return null;return{pluginId:p.pluginId,Component:p.registration.component,props:{...l,path:t.path,diff:t.diff}}}function Eg({view:t}){if(t.kind==="opener"){let l=t.Component;return e(Ye,{pluginId:t.pluginId,children:e(l,{...t.props})})}let r=t.Component;return e(Ye,{pluginId:t.pluginId,children:e(r,{...t.props})})}function $c({filePath:t,status:r="M",isStaged:l=!1,root:c,repo:p=".",onOpenInEditor:h,onFileSaved:g,className:y="",tabKey:x=null,viewModeButtons:w=!0,journalDiff:v,readOnly:C=!1}){let[R,O]=ju("diff.viewMode","unified"),[P,N]=ju("diff.contentMode","diff"),[V,A]=ju("diff.wordWrap",!0),[L,F]=ju("diff.ignoreWhitespace",!1),[U,z]=n(null),[Z,q]=n(!1),[K,G]=n(!1),[ne,H]=n({additions:0,deletions:0}),[X,te]=n({index:-1,count:0}),le=i(null),ie=a((We)=>{le.current?.(We)},[]),oe=a((We)=>{le.current=We},[]),Se=To(),ce=Kr({filePath:t,status:r,isStaged:l,repo:p,root:c,enabled:!v}),be=Hr(v),{rawDiff:Ae,oldContent:Xe,newContent:Ne,currentStatus:Ce,currentStaged:Ee,isLoading:Ze,errorMessage:ee,fetchDiff:se,adoptState:de}=v?be:ce,j=!v&&vr(Ce),Q=C||Boolean(v),fe=bt(t),ve=so({path:t,diff:Ae}),Ie=(We)=>{O(We)},vt=(We)=>{N(We)},je=()=>{A(!V)},At=()=>{F(!L)},Cn=()=>{if(!Ae)return;navigator.clipboard.writeText(Ae).then(()=>{q(!0),setTimeout(()=>q(!1),2000)},()=>z("Clipboard write was refused by the browser"))},Ge=zr({filePath:t,repo:p,root:c,status:Ce,staged:Ee,conflicted:j,adoptState:de,fetchDiff:se,onFileSaved:g}),{isBusy:Lt,markers:En}=Ge,st=U??Ge.error;return e("div",{className:`flex flex-col min-h-0 bg-paper select-text relative font-sans ${y}`,children:[e(no,{filePath:t,status:Ce,isStaged:Ee,viewMode:R,contentMode:P,wordWrap:V,ignoreWhitespace:L,additions:ne.additions,deletions:ne.deletions,chunkIndex:X.index,chunkCount:X.count,onStepChunk:ie,isLoading:Ze,isCopied:Z,isBusy:Lt,viewModeButtons:w,readOnly:Q,onSetViewMode:Ie,onSetContentMode:vt,onToggleWordWrap:je,onToggleWhitespace:At,onStageUnstage:()=>{if(!Q)Ge.stageUnstage()},onDiscard:()=>{if(!Q)G(!0)},onOpenInEditor:h,onRefresh:()=>void se(),onCopyDiff:Cn}),j&&e(ro,{markers:En,isBusy:Lt,error:st,onResolve:(We)=>void Ge.resolve(We),onDismissError:()=>{Ge.dismissError(),z(null)}}),st&&!j&&e("div",{className:"flex items-center gap-2 border-b border-error/25 bg-error/10 px-3 py-1.5 text-[11px] text-error flex-shrink-0",children:[e(E,{size:13,className:"flex-shrink-0"}),e("span",{className:"min-w-0 flex-1 truncate",title:st,children:st}),e("button",{type:"button",onClick:()=>{Ge.dismissError(),z(null)},className:"px-1.5 rounded hover:bg-error/15 cursor-pointer",title:"Dismiss","aria-label":"Dismiss",children:"✕"})]}),e("div",{className:"flex-1 overflow-hidden relative flex flex-col bg-paper",children:Ze?e("div",{className:"flex-1 flex items-center justify-center space-x-2 text-ink/50 text-xs font-mono",children:[e(D,{size:14,className:"animate-spin"}),e("span",{children:"Loading file diff..."})]}):ee?e("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center space-y-2",children:[e(E,{size:20,className:"text-error"}),e("p",{className:"text-xs text-error font-medium",children:ee}),e("button",{onClick:()=>void se(),className:"px-3 py-1 text-xs bg-ink/10 hover:bg-ink/15 text-ink rounded font-sans transition-colors cursor-pointer",children:"Retry"})]}):ve?e(Ye,{pluginId:ve.pluginId,children:e(ve.Component,{...ve.props})}):e(oo,{original:Xe,next:Ne,language:fe,viewMode:R,contentMode:P,wordWrap:V,ignoreWhitespace:L,tabKey:x,onCounts:H,onChunkPosition:te,onStepChunk:oe,empty:!Ae||!Ae.trim(),fontFamily:Se,fontSize:_o})}),K&&e("div",{className:"fixed inset-0 modal-scrim z-50 flex items-center justify-center p-4 backdrop-blur-xs",children:e("div",{className:"glass-overlay bg-paper rounded-lg shadow-xl p-4 w-full max-w-sm border border-ink/15",children:[e("h3",{className:"font-semibold text-ink mb-1.5 text-sm",children:"Discard Changes?"}),e("p",{className:"text-xs text-ink/70 mb-4",children:["Are you sure you want to discard all unstaged changes in ",e("span",{className:"font-mono font-medium text-ink",children:t}),"? This cannot be undone."]}),e("div",{className:"flex justify-end space-x-2",children:[e("button",{type:"button",onClick:()=>G(!1),className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors cursor-pointer",children:"Cancel"}),e("button",{type:"button",onClick:()=>{G(!1),Ge.revert()},className:"px-3 py-1.5 text-xs bg-error text-white rounded hover:bg-error/90 font-medium transition-colors cursor-pointer",children:"Discard Changes"})]})]})})]})}var nr="flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer disabled:cursor-default disabled:opacity-50";function ps({label:t,pressed:r,title:l,onClick:c,children:p}){return e("button",{type:"button",onClick:c,className:`flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer disabled:cursor-default disabled:opacity-50 hover:bg-ink/5 ${r?"text-ink":"hover:text-ink"}`,title:l??t,"aria-label":t,"aria-pressed":r,children:p})}function lo(t){return t.lineStart===t.lineEnd?`L${t.lineStart}`:`L${t.lineStart}-${t.lineEnd}`}function ao({block:t,verdict:r,note:l,anchor:c,onSave:p,onRemove:h,onClose:g}){let y=i(null),x=i(null);o(()=>{x.current?.focus()},[]),o(()=>{let v=(C)=>{if(C.key!=="Escape")return;C.stopPropagation(),g()};return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[g]);let w=(v)=>p(v,x.current?.value??l);return e("div",{ref:y,role:"dialog","aria-label":`Review block ${lo(t)}`,style:{top:`${c.top}px`,left:`${c.left}px`},className:"glass-popover fixed z-[65] w-[min(24rem,calc(100vw-2rem))] rounded-md border border-ink/15 bg-paper shadow-lg p-2 font-sans text-[11.5px] text-ink",onClick:(v)=>v.stopPropagation(),children:[e("div",{className:"flex items-center gap-1.5 text-[10.5px] font-mono text-ink/50",children:[e("span",{children:lo(t)}),e("span",{className:"truncate",children:["«",t.quote,"»"]}),e("button",{type:"button",onClick:g,className:"ml-auto cursor-pointer text-ink/50 hover:text-ink","aria-label":"Close review",children:e(b,{size:12})})]}),e("div",{className:"mt-1.5 flex items-center gap-1.5",children:[e("button",{type:"button","aria-pressed":r==="good",title:"This block is good, so leave it alone",onClick:()=>w("good"),className:`${nr} border px-2 text-[11px] ${r==="good"?"border-ink bg-ink/10 text-ink":"border-ink/15 text-ink/70 hover:border-ink/40"}`,children:[e(f,{size:11})," Good"]}),e("button",{type:"button","aria-pressed":r==="needs-work",title:"This block needs work",onClick:()=>w("needs-work"),className:`${nr} border px-2 text-[11px] ${r==="needs-work"?"border-error bg-error/10 text-error":"border-ink/15 text-ink/70 hover:border-ink/40"}`,children:[e(b,{size:11})," Needs work"]}),r&&e("button",{type:"button",onClick:h,className:`${nr} ml-auto border border-ink/15 px-2 text-[11px] text-ink/60 hover:text-error`,children:"Remove"})]}),e("textarea",{ref:x,defaultValue:l,rows:3,placeholder:"What is wrong (or right) with this block…",onKeyDown:(v)=>{if(v.key==="Enter"&&(v.metaKey||v.ctrlKey)&&r)v.preventDefault(),w(r)},className:"mt-1.5 w-full resize-y rounded border border-ink/15 bg-canvas/40 px-2 py-1 text-[11px] font-sans outline-none focus:border-ink"}),e("div",{className:"mt-1 flex items-center gap-1.5 text-[10.5px] text-ink/45",children:e("span",{children:"Click an answer to save · ⌘↵ keeps the note with it"})})]})}function co(t){return t.lineStart===t.lineEnd?`L${t.lineStart}`:`L${t.lineStart}-${t.lineEnd}`}function uo({counts:t,outdated:r,error:l,sent:c,onSend:p,onRemoveOutdated:h,onExit:g}){let y=t.good+t.needsWork;return e("div",{className:"sticky bottom-0 z-40 mt-2 border-t border-ink/10 bg-paper/95 px-1 py-2 backdrop-blur",children:[r.length>0&&e("div",{className:"mb-1.5 space-y-1",children:[e("div",{className:"text-[10px] uppercase font-mono text-ink/40",children:[r.length," outdated — the block was edited or is no longer rendered"]}),r.map((x)=>e("div",{className:"flex items-start gap-1.5 text-[11px] text-ink/60",children:[e("span",{className:"font-mono text-[10.5px] text-ink/40",children:co(x)}),e("span",{className:"min-w-0 flex-1",children:[e("span",{className:"block truncate text-ink/45",children:x.quote||"(block text unavailable)"}),x.note.trim()&&e("span",{className:"block truncate text-ink/70",children:x.note})]}),e("button",{type:"button",onClick:()=>h(x.id),className:"cursor-pointer text-ink/40 hover:text-error","aria-label":`Remove outdated annotation at ${co(x)}`,children:e(b,{size:11})})]},x.id))]}),l&&e("div",{role:"alert",className:"mb-1.5 text-[11px] text-error",children:l}),e("div",{className:"flex items-center gap-2 font-sans text-[11px]",children:[e("span",{className:"text-ink/70",children:[e("span",{className:"text-ink",children:t.good})," good ·"," ",e("span",{className:"text-error",children:t.needsWork})," needs work"]}),c&&e("span",{className:"text-ink/50",children:"Added to the chat box"}),e("button",{type:"button",onClick:g,className:"ml-auto cursor-pointer p-1 text-ink/50 hover:text-ink",title:"Exit review mode","aria-label":"Exit review mode",children:e(b,{size:13})}),e("button",{type:"button",disabled:y===0,onClick:p,title:"Put this review into the chat box; you still choose to send it",className:"flex items-center gap-1 rounded border border-ink bg-ink px-2 py-1 text-canvas transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:[e(Pn,{size:11})," Send to chat"]})]})]})}function zl(t){let r=new URLSearchParams({path:t.path});if(t.root)r.set("root",t.root);if(t.repo&&t.repo!==".")r.set("repo",t.repo);return r}async function Rn(t){let r=await t.json().catch(()=>null);return typeof r?.error==="string"?r.error:`Request failed (${t.status})`}async function fo(t,r){let l=await fetch(`/api/review?${zl(t).toString()}`,{signal:r});if(!l.ok)throw Error(await Rn(l));let c=await l.json();return Array.isArray(c.annotations)?c.annotations:[]}async function mo(t,r){let l={...r,path:t.path,root:t.root,repo:t.repo},c=await fetch("/api/review",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!c.ok)throw Error(await Rn(c));let p=await c.json();if(!p.annotation)throw Error("The server answered without the saved annotation");return p.annotation}async function po(t){let r=await fetch(`/api/review?id=${encodeURIComponent(t)}`,{method:"DELETE"});if(!r.ok)throw Error(await Rn(r))}function ho(t,r){let[l,c]=n([]),[p,h]=n(!1),[g,y]=n(null),[x,w]=n(0),v=t?.path??null,C=t?.root??null,R=t?.repo??null;o(()=>{if(!r||!v){c([]),y(null),h(!1);return}let V=new AbortController;return h(!0),y(null),fo({path:v,root:C,repo:R},V.signal).then((A)=>{if(V.signal.aborted)return;c(A)}).catch((A)=>{if(V.signal.aborted)return;y(A instanceof Error?A.message:"Could not read annotations")}).finally(()=>{if(!V.signal.aborted)h(!1)}),()=>V.abort()},[r,v,C,R,x]);let O=i(l);O.current=l;let P=a(async(V)=>{if(!v)return;let A=O.current,L={id:`pending:${V.blockKey}`,scope:"",path:v,blockKey:V.blockKey,lineStart:V.lineStart,lineEnd:V.lineEnd,verdict:V.verdict,note:V.note,quote:V.quote,createdAt:Date.now(),updatedAt:Date.now()};c([...A.filter((F)=>F.blockKey!==V.blockKey),L]),y(null);try{let F=await mo({path:v,root:C,repo:R},V);c((U)=>U.map((z)=>z.blockKey===V.blockKey?F:z))}catch(F){c(A),y(F instanceof Error?F.message:"Could not save the annotation")}},[v,C,R]),N=a(async(V)=>{let A=O.current;c(A.filter((L)=>L.id!==V)),y(null);try{await po(V)}catch(L){c(A),y(L instanceof Error?L.message:"Could not remove the annotation")}},[]);return{annotations:l,loading:p,error:g,save:P,remove:N,reload:()=>w((V)=>V+1)}}function go(t,r){let l=new Map(t.map((h)=>[h.key,h])),c=new Map,p=[];for(let h of r)if(l.has(h.blockKey))c.set(h.blockKey,h);else p.push(h);return p.sort((h,g)=>g.updatedAt-h.updatedAt),{attached:c,outdated:p}}function bo(t){let r=0,l=0;for(let c of t.values())if(c.verdict==="good")r+=1;else l+=1;return{good:r,needsWork:l}}function xo({file:t,active:r}){let[l,c]=n([]),[p,h]=n(null),[g,y]=n(null),x=u(()=>({path:t.path,root:t.root??null,repo:t.repo??null}),[t.path,t.root,t.repo]),{annotations:w,loading:v,error:C,save:R,remove:O}=ho(x,r),{attached:P,outdated:N}=u(()=>go(l,w),[l,w]),V=u(()=>new Map([...P.values()].map((K)=>[K.blockKey,K.verdict])),[P]),A=u(()=>bo(P),[P]),L=u(()=>p?l.find((K)=>K.key===p)??null:null,[l,p]),F=a((K)=>{c((G)=>ql(G,K)?G:K)},[]),U=a((K,G)=>{h(K.key),y({top:G.bottom+6,left:Math.max(8,G.left)})},[]),z=a(()=>{h(null),y(null)},[]),Z=a(({block:K,verdict:G,note:ne})=>{R({blockKey:K.key,lineStart:K.lineStart,lineEnd:K.lineEnd,verdict:G,note:ne,quote:K.quote})},[R]),q=a(()=>{let K=Eh({path:t.path,annotations:[...P.values()]});if(!K)return!1;return Bh(K),!0},[P,t.path]);return{marks:V,selected:p,selectedBlock:L,selectedAnnotation:L?P.get(L.key)??null:null,anchor:g,outdated:N,counts:A,loading:v,error:C,setBlocks:F,pick:U,close:z,save:Z,remove:(K)=>void O(K),send:q}}function ql(t,r){if(t.length!==r.length)return!1;return t.every((l,c)=>l.key===r[c]?.key)}function zc({content:t,file:r,active:l,onExit:c}){let p=xo({file:r,active:l}),[h,g]=n(!1);o(()=>{if(!p.selected)return;let v=()=>p.close();return window.addEventListener("scroll",v,!0),()=>window.removeEventListener("scroll",v,!0)},[p.selected]),o(()=>{if(!l)p.close()},[l]);let y=p.counts.good+p.counts.needsWork;o(()=>{g(!1)},[y]);let{selectedBlock:x,selectedAnnotation:w}=p;return e("div",{className:l?"md-review-active":void 0,children:[e(J,{content:t,document:!0,scope:{path:r.path,root:r.root??void 0,repo:r.repo??void 0},onBlocks:p.setBlocks,review:l?{active:!0,marks:p.marks,selected:p.selected,onPick:p.pick}:void 0}),l&&x&&p.anchor&&e(ao,{block:x,verdict:p.marks.get(x.key)??null,note:w?.note??"",anchor:p.anchor,onSave:(v,C)=>{p.save({block:x,verdict:v,note:C}),p.close()},onRemove:()=>{if(w)p.remove(w.id);p.close()},onClose:p.close},x.key),l&&e(uo,{counts:p.counts,outdated:p.outdated,error:p.error,sent:h,onSend:()=>g(p.send()),onRemoveOutdated:p.remove,onExit:()=>{p.close(),c()}})]})}var vo=typeof String.prototype.normalize=="function"?(t)=>t.normalize("NFKD"):(t)=>t;class ut{constructor(t,r,l=0,c=t.length,p,h){this.test=h,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(l,c),this.bufferStart=l,this.normalize=p?(g)=>p(vo(g)):vo,this.query=this.normalize(r)}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 On(this.buffer,this.bufferPos)}next(){while(this.matches.length)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let r=sd(t),l=this.bufferStart+this.bufferPos;this.bufferPos+=ra(t);let c=this.normalize(r);if(c.length)for(let p=0,h=l,g=!0;;p++){let y=c.charCodeAt(p),x=this.match(y,h,g,this.bufferPos+this.bufferStart,p==c.length-1);if(x)return this.value=x,this;if(p==c.length-1)break;if(g&&p<r.length&&r.charCodeAt(p)==y)h++;else g=!1}}}match(t,r,l,c,p){let h=null;for(let g=0;g<this.matches.length;){let y=this.matches[g],x=!1;if(this.query.charCodeAt(y.index)==t)if(y.index==this.query.length-1)h={from:y.from,to:c,precise:p&&y.precise};else y.index++,x=!0;if(x)g++;else this.matches.splice(g,1)}if(this.query.charCodeAt(0)==t)if(this.query.length==1)h={from:r,to:c,precise:l&&p};else this.matches.push({from:r,index:1,precise:l});if(h&&this.test&&!this.test(h.from,h.to,this.buffer,this.bufferStart))h=null;return h}}if(typeof Symbol<"u")ut.prototype[Symbol.iterator]=function(){return this};var wo={from:-1,to:-1,match:/.*/.exec(""),precise:!0},So="gm"+(/x/.unicode==null?"":"u");class Nt{constructor(t,r,l,c=0,p=t.length){if(this.text=t,this.to=p,this.curLine="",this.done=!1,this.value=wo,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new Tn(t,r,l,c,p);this.re=new RegExp(r,So+((l===null||l===void 0?void 0:l.ignoreCase)?"i":"")),this.test=l===null||l===void 0?void 0:l.test,this.iter=t.iter();let h=t.lineAt(c);this.curLineStart=h.from,this.matchPos=Ft(t,c),this.getLine(this.curLineStart)}getLine(t){if(this.iter.next(t),this.iter.lineBreak)this.curLine="";else{if(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(){if(this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to)this.curLine="";else this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let l=this.curLineStart+r.index,c=l+r[0].length;if(this.matchPos=Ft(this.text,c+(l==c?1:0)),l==this.curLineStart+this.curLine.length)this.nextLine();if((l<c||l>this.value.to)&&(!this.test||this.test(l,c,r)))return this.value={from:l,to:c,precise:!0,match:r},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}var Dn=new WeakMap;class ct{constructor(t,r){this.from=t,this.text=r}get to(){return this.from+this.text.length}static get(t,r,l){let c=Dn.get(t);if(!c||c.from>=l||c.to<=r){let g=new ct(r,t.sliceString(r,l));return Dn.set(t,g),g}if(c.from==r&&c.to==l)return c;let{text:p,from:h}=c;if(h>r)p=t.sliceString(r,h)+p,h=r;if(c.to<l)p+=t.sliceString(c.to,l);return Dn.set(t,new ct(h,p)),new ct(r,p.slice(r-h,l-h))}}class Tn{constructor(t,r,l,c,p){this.text=t,this.to=p,this.done=!1,this.value=wo,this.matchPos=Ft(t,c),this.re=new RegExp(r,So+((l===null||l===void 0?void 0:l.ignoreCase)?"i":"")),this.test=l===null||l===void 0?void 0:l.test,this.flat=ct.get(t,c,this.chunkEnd(c+5000))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==t)this.re.lastIndex=t+1,r=this.re.exec(this.flat.text);if(r){let l=this.flat.from+r.index,c=l+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(l,c,r)))return this.value={from:l,to:c,precise:!0,match:r},this.matchPos=Ft(this.text,c+(l==c?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=ct.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}if(typeof Symbol<"u")Nt.prototype[Symbol.iterator]=Tn.prototype[Symbol.iterator]=function(){return this};function Ft(t,r){if(r>=t.length)return r;let l=t.lineAt(r),c;while(r<l.to&&(c=l.text.charCodeAt(r-l.from))>=56320&&c<57344)r++;return r}var Gl={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Co=M.define({combine(t){return tr(t,Gl,{highlightWordAroundCursor:(r,l)=>r||l,minSelectionLength:Math.min,maxMatches:Math.min})}});function Eo(t){let r=[Ql,Zl];if(t)r.push(Co.of(t));return r}var Jl=T.mark({class:"cm-selectionMatch"}),Xl=T.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function ko(t,r,l,c){return(l==0||t(r.sliceDoc(l-1,l))!=pn.Word)&&(c==r.doc.length||t(r.sliceDoc(c,c+1))!=pn.Word)}function Yl(t,r,l,c){return t(r.sliceDoc(l,l+1))==pn.Word&&t(r.sliceDoc(c-1,c))==pn.Word}var Zl=ye.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){if(t.selectionSet||t.docChanged||t.viewportChanged)this.decorations=this.getDeco(t.view)}getDeco(t){let r=t.state.facet(Co),{state:l}=t,c=l.selection;if(c.ranges.length>1)return T.none;let p=c.main,h,g=null;if(p.empty){if(!r.highlightWordAroundCursor)return T.none;let x=l.wordAt(p.head);if(!x)return T.none;g=l.charCategorizer(p.head),h=l.sliceDoc(x.from,x.to)}else{let x=p.to-p.from;if(x<r.minSelectionLength||x>200)return T.none;if(r.wholeWords){if(h=l.sliceDoc(p.from,p.to),g=l.charCategorizer(p.head),!(ko(g,l,p.from,p.to)&&Yl(g,l,p.from,p.to)))return T.none}else if(h=l.sliceDoc(p.from,p.to),!h)return T.none}let y=[];for(let x of t.visibleRanges){let w=new ut(l.doc,h,x.from,x.to);while(!w.next().done){let{from:v,to:C}=w.value;if(!g||ko(g,l,v,C)){if(p.empty&&v<=p.from&&C>=p.to)y.push(Xl.range(v,C));else if(v>=p.to||C<=p.from)y.push(Jl.range(v,C));if(y.length>r.maxMatches)return T.none}}}return T.set(y)}},{decorations:(t)=>t.decorations}),Ql=I.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),ea=({state:t,dispatch:r})=>{let{selection:l}=t,c=k.create(l.ranges.map((p)=>t.wordAt(p.head)||k.cursor(p.head)),l.mainIndex);if(c.eq(l))return!1;return r(t.update({selection:c})),!0};function ta(t,r){let{main:l,ranges:c}=t.selection,p=t.wordAt(l.head),h=p&&p.from==l.from&&p.to==l.to;for(let g=!1,y=new ut(t.doc,r,c[c.length-1].to);;)if(y.next(),y.done){if(g)return null;y=new ut(t.doc,r,0,Math.max(0,c[c.length-1].from-1)),g=!0}else{if(g&&c.some((x)=>x.from==y.value.from))continue;if(h){let x=t.wordAt(y.value.from);if(!x||x.from!=y.value.from||x.to!=y.value.to)continue}return y.value}}var Mo=({state:t,dispatch:r})=>{let{ranges:l}=t.selection;if(l.some((h)=>h.from===h.to))return ea({state:t,dispatch:r});let c=t.sliceDoc(l[0].from,l[0].to);if(t.selection.ranges.some((h)=>t.sliceDoc(h.from,h.to)!=c))return!1;let p=ta(t,c);if(!p)return!1;return r(t.update({selection:t.selection.addRange(k.range(p.from,p.to),!1),effects:I.scrollIntoView(p.to)})),!0};var Ro=({state:t,dispatch:r})=>{let l=t.selection;if(l.ranges.length>1||l.main.empty)return!1;let{from:c,to:p}=l.main,h=[],g=0;for(let y=new ut(t.doc,t.sliceDoc(c,p));!y.next().done;){if(h.length>1000)return!1;if(y.value.from==c)g=h.length;h.push(k.range(y.value.from,y.value.to))}return r(t.update({selection:k.create(h,g),userEvent:"select.search.matches"})),!0};var _n=(t)=>{let{state:r}=t,l=r.doc.lineAt(r.selection.main.from),c=jn(t.state,l.from);return c.line?na(t):c.block?oa(t):!1};function Hn(t,r){return({state:l,dispatch:c})=>{if(l.readOnly)return!1;let p=t(r,l);if(!p)return!1;return c(l.update(p)),!0}}var na=Hn(la,0);var qn=Hn(Po,0);var oa=Hn((t,r)=>Po(t,r,sa(r)),0);function jn(t,r){let l=t.languageDataAt("commentTokens",r,1);return l.length?l[0]:{}}var St=50;function ia(t,{open:r,close:l},c,p){let h=t.sliceDoc(c-St,c),g=t.sliceDoc(p,p+St),y=/\s*$/.exec(h)[0].length,x=/^\s*/.exec(g)[0].length,w=h.length-y;if(h.slice(w-r.length,w)==r&&g.slice(x,x+l.length)==l)return{open:{pos:c-y,margin:y&&1},close:{pos:p+x,margin:x&&1}};let v,C;if(p-c<=2*St)v=C=t.sliceDoc(c,p);else v=t.sliceDoc(c,c+St),C=t.sliceDoc(p-St,p);let R=/^\s*/.exec(v)[0].length,O=/\s*$/.exec(C)[0].length,P=C.length-O-l.length;if(v.slice(R,R+r.length)==r&&C.slice(P,P+l.length)==l)return{open:{pos:c+R+r.length,margin:/\s/.test(v.charAt(R+r.length))?1:0},close:{pos:p-O-l.length,margin:/\s/.test(C.charAt(P-1))?1:0}};return null}function sa(t){let r=[];for(let l of t.selection.ranges){let c=t.doc.lineAt(l.from),p=l.to<=c.to?c:t.doc.lineAt(l.to);if(p.from>c.from&&p.from==l.to)p=l.to==c.to+1?c:t.doc.lineAt(l.to-1);let h=r.length-1;if(h>=0&&r[h].to>c.from)r[h].to=p.to;else r.push({from:c.from+/^\s*/.exec(c.text)[0].length,to:p.to})}return r}function Po(t,r,l=r.selection.ranges){let c=l.map((h)=>jn(r,h.from).block);if(!c.every((h)=>h))return null;let p=l.map((h,g)=>ia(r,c[g],h.from,h.to));if(t!=2&&!p.every((h)=>h))return{changes:r.changes(l.map((h,g)=>{if(p[g])return[];return[{from:h.from,insert:c[g].open+" "},{from:h.to,insert:" "+c[g].close}]}))};else if(t!=1&&p.some((h)=>h)){let h=[];for(let g=0,y;g<p.length;g++)if(y=p[g]){let x=c[g],{open:w,close:v}=y;h.push({from:w.pos-x.open.length,to:w.pos+w.margin},{from:v.pos-v.margin,to:v.pos+x.close.length})}return{changes:h}}return null}function la(t,r,l=r.selection.ranges){let c=[],p=-1;e:for(let{from:h,to:g}of l){let y=c.length,x=1e9,w;for(let v=h;v<=g;){let C=r.doc.lineAt(v);if(w==null){if(w=jn(r,C.from).line,!w)continue e}if(C.from>p&&(h==g||g>C.from)){p=C.from;let R=/^\s*/.exec(C.text)[0].length,O=R==C.length,P=C.text.slice(R,R+w.length)==w?R:-1;if(R<C.text.length&&R<x)x=R;c.push({line:C,comment:P,token:w,indent:R,empty:O,single:!1})}v=C.to+1}if(x<1e9){for(let v=y;v<c.length;v++)if(c[v].indent<c[v].line.text.length)c[v].indent=x}if(c.length==y+1)c[y].single=!0}if(t!=2&&c.some((h)=>h.comment<0&&(!h.empty||h.single))){let h=[];for(let{line:y,token:x,indent:w,empty:v,single:C}of c)if(C||!v)h.push({from:y.from+w,insert:x+" "});let g=r.changes(h);return{changes:g,selection:r.selection.map(g,1)}}else if(t!=1&&c.some((h)=>h.comment>=0)){let h=[];for(let{line:g,comment:y,token:x}of c)if(y>=0){let w=g.from+y,v=w+x.length;if(g.text[v-g.from]==" ")v++;h.push({from:w,to:v})}return{changes:h}}return null}var In=aa.define(),ca=aa.define(),ua=M.define(),Bo=M.define({combine(t){return tr(t,{minDepth:100,newGroupDelay:500,joinToEvent:(r,l)=>l},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(r,l)=>(c,p)=>r(c,p)||l(c,p)})}}),Fo=Re.define({create(){return ze.empty},update(t,r){let l=r.state.facet(Bo),c=r.annotation(In);if(c){let x=Me.fromTransaction(r,c.selection),w=c.side,v=w==0?t.undone:t.done;if(x)v=Ut(v,v.length,l.minDepth,x);else v=$o(v,r.startState.selection);return new ze(w==0?c.rest:v,w==0?v:c.rest)}let p=r.annotation(ca);if(p=="full"||p=="before")t=t.isolate();if(r.annotation(Vt.addToHistory)===!1)return!r.changes.empty?t.addMapping(r.changes.desc):t;let h=Me.fromTransaction(r),g=r.annotation(Vt.time),y=r.annotation(Vt.userEvent);if(h)t=t.addChanges(h,g,y,l,r);else if(r.selection)t=t.addSelection(r.startState.selection,g,y,l.newGroupDelay);if(p=="full"||p=="after")t=t.isolate();return t},toJSON(t){return{done:t.done.map((r)=>r.toJSON()),undone:t.undone.map((r)=>r.toJSON())}},fromJSON(t){return new ze(t.done.map(Me.fromJSON),t.undone.map(Me.fromJSON))}});function No(t={}){return[Fo,Bo.of(t),I.domEventHandlers({beforeinput(r,l){let c=r.inputType=="historyUndo"?Gn:r.inputType=="historyRedo"?Jn:null;if(!c)return!1;return r.preventDefault(),c(l)}})]}function Vo(t,r){return function({state:l,dispatch:c}){if(!r&&l.readOnly)return!1;let p=l.field(Fo,!1);if(!p)return!1;let h=p.pop(t,l,r);if(!h)return!1;return c(h),!0}}var Gn=Vo(0,!1),Jn=Vo(1,!1);class Me{constructor(t,r,l,c,p){this.changes=t,this.effects=r,this.mapped=l,this.startSelection=c,this.selectionsAfter=p}setSelAfter(t){return new Me(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,r,l;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(r=this.mapped)===null||r===void 0?void 0:r.toJSON(),startSelection:(l=this.startSelection)===null||l===void 0?void 0:l.toJSON(),selectionsAfter:this.selectionsAfter.map((c)=>c.toJSON())}}static fromJSON(t){return new Me(t.changes&&Qt.fromJSON(t.changes),[],t.mapped&&Za.fromJSON(t.mapped),t.startSelection&&k.fromJSON(t.startSelection),t.selectionsAfter.map(k.fromJSON))}static fromTransaction(t,r){let l=Pe;for(let c of t.startState.facet(ua)){let p=c(t);if(p.length)l=l.concat(p)}if(!l.length&&t.changes.empty)return null;return new Me(t.changes.invert(t.startState.doc),l,void 0,r||t.startState.selection,Pe)}static selection(t){return new Me(void 0,Pe,void 0,void 0,t)}}function Ut(t,r,l,c){let p=r+1>l+20?r-l-1:0,h=t.slice(p,r);return h.push(c),h}function da(t,r){let l=[],c=!1;return t.iterChangedRanges((p,h)=>l.push(p,h)),r.iterChangedRanges((p,h,g,y)=>{for(let x=0;x<l.length;){let w=l[x++],v=l[x++];if(y>=w&&g<=v)c=!0}}),c}function fa(t,r){return t.ranges.length==r.ranges.length&&t.ranges.filter((l,c)=>l.empty!=r.ranges[c].empty).length===0}function Wo(t,r){return!t.length?r:!r.length?t:t.concat(r)}var Pe=[],ma=200;function $o(t,r){if(!t.length)return[Me.selection([r])];else{let l=t[t.length-1],c=l.selectionsAfter.slice(Math.max(0,l.selectionsAfter.length-ma));if(c.length&&c[c.length-1].eq(r))return t;return c.push(r),Ut(t,t.length-1,1e9,l.setSelAfter(c))}}function pa(t){let r=t[t.length-1],l=t.slice();return l[t.length-1]=r.setSelAfter(r.selectionsAfter.slice(0,r.selectionsAfter.length-1)),l}function Ln(t,r){if(!t.length)return t;let l=t.length,c=Pe;while(l){let p=ha(t[l-1],r,c);if(p.changes&&!p.changes.empty||p.effects.length){let h=t.slice(0,l);return h[l-1]=p,h}else r=p.mapped,l--,c=p.selectionsAfter}return c.length?[Me.selection(c)]:Pe}function ha(t,r,l){let c=Wo(t.selectionsAfter.length?t.selectionsAfter.map((y)=>y.map(r)):Pe,l);if(!t.changes)return Me.selection(c);let p=t.changes.map(r),h=r.mapDesc(t.changes,!0),g=t.mapped?t.mapped.composeDesc(h):h;return new Me(p,ae.mapEffects(t.effects,r),g,t.startSelection.map(h),c)}var ga=/^(input\.type|delete)($|\.)/;class ze{constructor(t,r,l=0,c=void 0){this.done=t,this.undone=r,this.prevTime=l,this.prevUserEvent=c}isolate(){return this.prevTime?new ze(this.done,this.undone):this}addChanges(t,r,l,c,p){let h=this.done,g=h[h.length-1];if(g&&g.changes&&!g.changes.empty&&t.changes&&(!l||ga.test(l))&&(!g.selectionsAfter.length&&r-this.prevTime<c.newGroupDelay&&c.joinToEvent(p,da(g.changes,t.changes))||l=="input.type.compose"))h=Ut(h,h.length-1,c.minDepth,new Me(t.changes.compose(g.changes),Wo(ae.mapEffects(t.effects,g.changes),g.effects),g.mapped,g.startSelection,Pe));else h=Ut(h,h.length,c.minDepth,t);return new ze(h,Pe,r,l)}addSelection(t,r,l,c){let p=this.done.length?this.done[this.done.length-1].selectionsAfter:Pe;if(p.length>0&&r-this.prevTime<c&&l==this.prevUserEvent&&l&&/^select($|\.)/.test(l)&&fa(p[p.length-1],t))return this;return new ze($o(this.done,t),this.undone,r,l)}addMapping(t){return new ze(Ln(this.done,t),Ln(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,r,l){let c=t==0?this.done:this.undone;if(c.length==0)return null;let p=c[c.length-1],h=p.selectionsAfter[0]||(p.startSelection?p.startSelection.map(p.changes.invertedDesc,1):r.selection);if(l&&p.selectionsAfter.length)return r.update({selection:p.selectionsAfter[p.selectionsAfter.length-1],annotations:In.of({side:t,rest:pa(c),selection:h}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});else if(!p.changes)return null;else{let g=c.length==1?Pe:c.slice(0,c.length-1);if(p.mapped)g=Ln(g,p.mapped);return r.update({changes:p.changes,selection:p.startSelection,effects:p.effects,annotations:In.of({side:t,rest:g,selection:h}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}}}ze.empty=new ze(Pe,Pe);function dt(t,r){return k.create(t.ranges.map(r),t.mainIndex)}function $e(t,r){return t.update({selection:r,scrollIntoView:!0,userEvent:"select"})}function _e({state:t,dispatch:r},l){let c=dt(t.selection,l);if(c.eq(t.selection,!0))return!1;return r($e(t,c)),!0}function zt(t,r){return k.cursor(r?t.to:t.from)}function Ko(t,r){return _e(t,(l)=>l.empty?t.moveByChar(l,r):zt(l,r))}function we(t){return t.textDirectionAt(t.state.selection.main.head)==Oe.LTR}var Ho=(t)=>Ko(t,!we(t)),zo=(t)=>Ko(t,we(t));function qo(t,r){return _e(t,(l)=>l.empty?t.moveByGroup(l,r):zt(l,r))}var ba=(t)=>qo(t,!we(t)),ya=(t)=>qo(t,we(t));var ip=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function xa(t,r,l){if(r.type.prop(l))return!0;let c=r.to-r.from;return c&&(c>2||/[^\s,.;:]/.test(t.sliceDoc(r.from,r.to)))||r.firstChild}function qt(t,r,l){let c=Un(t).resolveInner(r.head),p=l?xe.closedBy:xe.openedBy;for(let x=r.head;;){let w=l?c.childAfter(x):c.childBefore(x);if(!w)break;if(xa(t,w,p))c=w;else x=l?w.to:w.from}let h=c.type.prop(p),g,y;if(h&&(g=l?Dr(t,c.from,1):Dr(t,c.to,-1))&&g.matched)y=l?g.end.to:g.end.from;else y=l?c.to:c.from;return k.cursor(y,l?-1:1)}var va=(t)=>_e(t,(r)=>qt(t.state,r,!we(t))),ka=(t)=>_e(t,(r)=>qt(t.state,r,we(t)));function jo(t,r){return _e(t,(l)=>{if(!l.empty)return zt(l,r);let c=t.moveVertically(l,r);return c.head!=l.head?c:t.moveToLineBoundary(l,r)})}var Go=(t)=>jo(t,!1),Jo=(t)=>jo(t,!0);function Xo(t){let r=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,l=0,c=0,p;if(r){for(let h of t.state.facet(I.scrollMargins)){let g=h(t);if(g===null||g===void 0?void 0:g.top)l=Math.max(g===null||g===void 0?void 0:g.top,l);if(g===null||g===void 0?void 0:g.bottom)c=Math.max(g===null||g===void 0?void 0:g.bottom,c)}p=t.scrollDOM.clientHeight-l-c}else p=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:l,marginBottom:c,selfScroll:r,height:Math.max(t.defaultLineHeight,p-5)}}function Yo(t,r){let l=Xo(t),{state:c}=t,p=dt(c.selection,(g)=>g.empty?t.moveVertically(g,r,l.height):zt(g,r));if(p.eq(c.selection))return!1;let h;if(l.selfScroll){let g=t.coordsAtPos(c.selection.main.head),y=t.scrollDOM.getBoundingClientRect(),x=y.top+l.marginTop,w=y.bottom-l.marginBottom;if(g&&g.top>x&&g.bottom<w)h=I.scrollIntoView(p.main.head,{y:"start",yMargin:g.top-x})}return t.dispatch($e(c,p),{effects:h}),!0}var Do=(t)=>Yo(t,!1),Fn=(t)=>Yo(t,!0);function Qe(t,r,l){let c=t.lineBlockAt(r.head),p=t.moveToLineBoundary(r,l);if(p.head==r.head&&p.head!=(l?c.to:c.from))p=t.moveToLineBoundary(r,l,!1);if(!l&&p.head==c.from&&c.length){let h=/^\s*/.exec(t.state.sliceDoc(c.from,Math.min(c.from+100,c.to)))[0].length;if(h&&r.head!=c.from+h)p=k.cursor(c.from+h)}return p}var wa=(t)=>_e(t,(r)=>Qe(t,r,!0)),Sa=(t)=>_e(t,(r)=>Qe(t,r,!1)),Ca=(t)=>_e(t,(r)=>Qe(t,r,!we(t))),Ea=(t)=>_e(t,(r)=>Qe(t,r,we(t))),Xn=(t)=>_e(t,(r)=>t.moveToLineBoundary(r,!1,!1)),Yn=(t)=>_e(t,(r)=>t.moveToLineBoundary(r,!0,!1));function Ma(t,r,l){let c=!1,p=dt(t.selection,(h)=>{let g=Dr(t,h.head,-1)||Dr(t,h.head,1)||h.head>0&&Dr(t,h.head-1,1)||h.head<t.doc.length&&Dr(t,h.head+1,-1);if(!g||!g.end)return h;c=!0;let y=g.start.from==h.head?g.end.to:g.end.from;return l?k.range(h.anchor,y):k.cursor(y)});if(!c)return!1;return r($e(t,p)),!0}var Ra=({state:t,dispatch:r})=>Ma(t,r,!1);function Be(t,r,l){let c=dt(t.state.selection,(p)=>{if(p.undirectional&&p.head>=p.anchor!=r)p=k.range(p.head,p.anchor);let h=l(p);return k.range(p.anchor,h.head,h.goalColumn,h.bidiLevel||void 0,h.assoc)});if(c.eq(t.state.selection))return!1;return t.dispatch($e(t.state,c)),!0}function Zo(t,r){return Be(t,r,(l)=>t.moveByChar(l,r))}var Qo=(t)=>Zo(t,!we(t)),ei=(t)=>Zo(t,we(t));function ti(t,r){return Be(t,r,(l)=>t.moveByGroup(l,r))}var Da=(t)=>ti(t,!we(t)),Ta=(t)=>ti(t,we(t));var Aa=(t)=>{let r=!we(t);return Be(t,r,(l)=>qt(t.state,l,r))},La=(t)=>{let r=we(t);return Be(t,r,(l)=>qt(t.state,l,r))};function ni(t,r){return Be(t,r,(l)=>t.moveVertically(l,r))}var ri=(t)=>ni(t,!1),oi=(t)=>ni(t,!0);function ii(t,r){return Be(t,r,(l)=>t.moveVertically(l,r,Xo(t).height))}var Lo=(t)=>ii(t,!1),Io=(t)=>ii(t,!0),Ia=(t)=>Be(t,!0,(r)=>Qe(t,r,!0)),Oa=(t)=>Be(t,!1,(r)=>Qe(t,r,!1)),Pa=(t)=>{let r=!we(t);return Be(t,r,(l)=>Qe(t,l,r))},Fa=(t)=>{let r=we(t);return Be(t,r,(l)=>Qe(t,l,r))},Zn=(t)=>Be(t,!1,(r)=>k.cursor(t.lineBlockAt(r.head).from)),Qn=(t)=>Be(t,!0,(r)=>k.cursor(t.lineBlockAt(r.head).to)),$t=({state:t,dispatch:r})=>(r($e(t,{anchor:0})),!0),_t=({state:t,dispatch:r})=>(r($e(t,{anchor:t.doc.length})),!0),Kt=({state:t,dispatch:r})=>(r($e(t,{anchor:t.selection.main.anchor,head:0})),!0),Ht=({state:t,dispatch:r})=>(r($e(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Na=({state:t,dispatch:r})=>(r(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),er=({state:t,dispatch:r})=>{let l=jt(t).map(({from:c,to:p})=>k.undirectionalRange(c,Math.min(p+1,t.doc.length)));return r(t.update({selection:k.create(l),userEvent:"select"})),!0},Va=({state:t,dispatch:r})=>{let l=dt(t.selection,(c)=>{let p=Un(t),h=p.resolveStack(c.from,1);if(c.empty){let g=p.resolveStack(c.from,-1);if(g.node.from>=h.node.from&&g.node.to<=h.node.to)h=g}for(let g=h;g;g=g.next){let{node:y}=g;if((y.from<c.from&&y.to>=c.to||y.to>c.to&&y.from<=c.from)&&g.next)return k.undirectionalRange(y.from,y.to)}return c});if(l.eq(t.selection))return!1;return r($e(t,l)),!0};function si(t,r){let{state:l}=t,c=l.selection,p=l.selection.ranges.slice();for(let h of l.selection.ranges){let g=l.doc.lineAt(h.head);if(r?g.to<t.state.doc.length:g.from>0)for(let y=h;;){let x=t.moveVertically(y,r);if(x.head<g.from||x.head>g.to){if(!p.some((w)=>w.head==x.head))p.push(x);break}else if(x.head==y.head)break;else y=x}}if(p.length==c.ranges.length)return!1;return t.dispatch($e(l,k.create(p,p.length-1))),!0}var rr=(t)=>si(t,!1),or=(t)=>si(t,!0),ir=({state:t,dispatch:r})=>{let l=t.selection,c=null;if(l.ranges.length>1)c=k.create([l.main]);else if(!l.main.empty)c=k.create([k.cursor(l.main.head)]);if(!c)return!1;return r($e(t,c)),!0};function Ct(t,r){if(t.state.readOnly)return!1;let l="delete.selection",{state:c}=t,p=c.changeByRange((h)=>{let{from:g,to:y}=h;if(g==y){let x=r(h);if(x<g)l="delete.backward",x=Wt(t,x,!1);else if(x>g)l="delete.forward",x=Wt(t,x,!0);g=Math.min(g,x),y=Math.max(y,x)}else g=Wt(t,g,!1),y=Wt(t,y,!0);return g==y?{range:h}:{changes:{from:g,to:y},range:k.cursor(g,g<h.head?-1:1)}});if(p.changes.empty)return!1;return t.dispatch(c.update(p,{scrollIntoView:!0,userEvent:l,effects:l=="delete.selection"?I.announce.of(c.phrase("Selection deleted")):void 0})),!0}function Wt(t,r,l){if(t instanceof I)for(let c of t.state.facet(I.atomicRanges).map((p)=>p(t)))c.between(r,r,(p,h)=>{if(p<r&&h>r)r=l?h:p});return r}var li=(t,r,l)=>Ct(t,(c)=>{let p=c.from,{state:h}=t,g=h.doc.lineAt(p),y,x;if(l&&!r&&p>g.from&&p<g.from+200&&!/[^ \t]/.test(y=g.text.slice(0,p-g.from))){if(y[y.length-1]=="\t")return p-1;let w=eo(y,h.tabSize),v=w%mi(h)||mi(h);for(let C=0;C<v&&y[y.length-1-C]==" ";C++)p--;x=p}else if(x=bn(g.text,p-g.from,r,r)+g.from,x==p&&g.number!=(r?h.doc.lines:1))x+=r?1:-1;else if(!r&&/[\ufe00-\ufe0f]/.test(g.text.slice(x-g.from,p-g.from)))x=bn(g.text,x-g.from,!1,!1)+g.from;return x}),Wn=(t)=>li(t,!1,!0);var ai=(t)=>li(t,!0,!1),ui=(t,r)=>Ct(t,(l)=>{let c=l.head,{state:p}=t,h=p.doc.lineAt(c),g=p.charCategorizer(c);for(let y=null;;){if(c==(r?h.to:h.from)){if(c==l.head&&h.number!=(r?p.doc.lines:1))c+=r?1:-1;break}let x=bn(h.text,c-h.from,r)+h.from,w=h.text.slice(Math.min(c,x)-h.from,Math.max(c,x)-h.from),v=g(w);if(y!=null&&v!=y)break;if(w!=" "||c!=l.head)y=v;c=x}return c}),di=(t)=>ui(t,!1),Wa=(t)=>ui(t,!0);var Ua=(t)=>Ct(t,(r)=>{let l=t.lineBlockAt(r.head).to;return r.head<l?l:Math.min(t.state.doc.length,r.head+1)});var $a=(t)=>Ct(t,(r)=>{let l=t.moveToLineBoundary(r,!1).head;return r.head>l?l:Math.max(0,r.head-1)}),_a=(t)=>Ct(t,(r)=>{let l=t.moveToLineBoundary(r,!0).head;return r.head<l?l:Math.min(t.state.doc.length,r.head+1)});var Ka=({state:t,dispatch:r})=>{if(t.readOnly)return!1;let l=t.changeByRange((c)=>({changes:{from:c.from,to:c.to,insert:ke.of(["",""])},range:k.cursor(c.from)}));return r(t.update(l,{scrollIntoView:!0,userEvent:"input"})),!0},Ha=({state:t,dispatch:r})=>{if(t.readOnly)return!1;let l=t.changeByRange((c)=>{if(!c.empty||c.from==0||c.from==t.doc.length)return{range:c};let p=c.from,h=t.doc.lineAt(p),g=p==h.from?p-1:bn(h.text,p-h.from,!1)+h.from,y=p==h.to?p+1:bn(h.text,p-h.from,!0)+h.from;return{changes:{from:g,to:y,insert:t.doc.slice(p,y).append(t.doc.slice(g,p))},range:k.cursor(y)}});if(l.changes.empty)return!1;return r(t.update(l,{scrollIntoView:!0,userEvent:"move.character"})),!0};function jt(t){let r=[],l=-1;for(let c of t.selection.ranges){let p=t.doc.lineAt(c.from),h=t.doc.lineAt(c.to);if(!c.empty&&c.to==h.from)h=t.doc.lineAt(c.to-1);if(l>=p.number){let g=r[r.length-1];g.to=h.to,g.ranges.push(c)}else r.push({from:p.from,to:h.to,ranges:[c]});l=h.number+1}return r}function gi(t,r,l){if(t.readOnly)return!1;let c=[],p=[];for(let h of jt(t)){if(l?h.to==t.doc.length:h.from==0)continue;let g=t.doc.lineAt(l?h.to+1:h.from-1),y=g.length+1;if(l){c.push({from:h.to,to:g.to},{from:h.from,insert:g.text+t.lineBreak});for(let x of h.ranges)p.push(k.range(Math.min(t.doc.length,x.anchor+y),Math.min(t.doc.length,x.head+y)))}else{c.push({from:g.from,to:h.from},{from:h.to,insert:t.lineBreak+g.text});for(let x of h.ranges)p.push(k.range(x.anchor-y,x.head-y))}}if(!c.length)return!1;return r(t.update({changes:c,scrollIntoView:!0,selection:k.create(p,t.selection.mainIndex),userEvent:"move.line"})),!0}var sr=({state:t,dispatch:r})=>gi(t,r,!1),lr=({state:t,dispatch:r})=>gi(t,r,!0);function bi(t,r,l){if(t.readOnly)return!1;let c=[];for(let h of jt(t))if(l)c.push({from:h.from,insert:t.doc.slice(h.from,h.to)+t.lineBreak});else c.push({from:h.to,insert:t.lineBreak+t.doc.slice(h.from,h.to)});let p=t.changes(c);return r(t.update({changes:p,selection:t.selection.map(p,l?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var ar=({state:t,dispatch:r})=>bi(t,r,!1),cr=({state:t,dispatch:r})=>bi(t,r,!0),ur=(t)=>{if(t.state.readOnly)return!1;let{state:r}=t,l=r.changes(jt(r).map(({from:p,to:h})=>{if(p>0)p--;else if(h<r.doc.length)h++;return{from:p,to:h}})),c=dt(r.selection,(p)=>{let h=void 0;if(t.lineWrapping){let g=t.lineBlockAt(p.head),y=t.coordsAtPos(p.head,p.assoc||1);if(y)h=g.bottom+t.documentTop-y.bottom+t.defaultLineHeight/2}return t.moveVertically(p,!0,h)}).map(l);return t.dispatch({changes:l,selection:c,scrollIntoView:!0,userEvent:"delete.line"}),!0};function qa(t,r){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(r-1,r+1)))return{from:r,to:r};let l=Un(t).resolveInner(r),c=l.childBefore(r),p=l.childAfter(r),h;if(c&&p&&c.to<=r&&p.from>=r&&(h=c.type.prop(xe.closedBy))&&h.indexOf(p.name)>-1&&t.doc.lineAt(c.to).from==t.doc.lineAt(p.from).from&&!/\S/.test(t.sliceDoc(c.to,p.from)))return{from:c.to,to:p.from};return null}var Oo=yi(!1),dr=yi(!0);function yi(t){return({state:r,dispatch:l})=>{if(r.readOnly)return!1;let c=r.changeByRange((p)=>{let{from:h,to:g}=p,y=r.doc.lineAt(h),x=!t&&h==g&&qa(r,h);if(t)h=g=(g<=y.to?y:r.doc.lineAt(g)).to;let w=new ul(r,{simulateBreak:h,simulateDoubleBreak:!!x}),v=cd(w,h);if(v==null)v=eo(/^\s*/.exec(r.doc.lineAt(h).text)[0],r.tabSize);while(g<y.to&&/\s/.test(y.text[g-y.from]))g++;if(x)({from:h,to:g}=x);else if(h>y.from&&h<y.from+100&&!/\S/.test(y.text.slice(0,h)))h=y.from;let C=["",cl(r,v)];if(x)C.push(cl(r,w.lineIndent(y.from,-1)));return{changes:{from:h,to:g,insert:ke.of(C)},range:k.cursor(h+1+C[1].length)}});return l(r.update(c,{scrollIntoView:!0,userEvent:"input"})),!0}}function fr(t,r){let l=-1;return t.changeByRange((c)=>{let p=[];for(let g=c.from;g<=c.to;){let y=t.doc.lineAt(g);if(y.number>l&&(c.empty||c.to>y.from))r(y,p,c),l=y.number;g=y.to+1}let h=t.changes(p);return{changes:p,range:k.range(h.mapPos(c.anchor,1),h.mapPos(c.head,1))}})}var ja=({state:t,dispatch:r})=>{if(t.readOnly)return!1;let l=Object.create(null),c=new ul(t,{overrideIndentation:(h)=>{let g=l[h];return g==null?-1:g}}),p=fr(t,(h,g,y)=>{let x=cd(c,h.from);if(x==null)return;if(!/\S/.test(h.text))x=0;let w=/^\s*/.exec(h.text)[0],v=cl(t,x);if(w!=v||y.from<h.from+w.length)l[h.from]=x,g.push({from:h.from,to:h.from+w.length,insert:v})});if(!p.changes.empty)r(t.update(p,{userEvent:"indent"}));return!0},Gt=({state:t,dispatch:r})=>{if(t.readOnly)return!1;return r(t.update(fr(t,(l,c)=>{c.push({from:l.from,insert:t.facet(ds)})}),{userEvent:"input.indent"})),!0},Jt=({state:t,dispatch:r})=>{if(t.readOnly)return!1;return r(t.update(fr(t,(l,c)=>{let p=/^\s*/.exec(l.text)[0];if(!p)return;let h=eo(p,t.tabSize),g=0,y=cl(t,Math.max(0,h-mi(t)));while(g<p.length&&g<y.length&&p.charCodeAt(g)==y.charCodeAt(g))g++;c.push({from:l.from+g,to:l.from+p.length,insert:y.slice(g)})}),{userEvent:"delete.dedent"})),!0},Ja=(t)=>(t.setTabFocusMode(),!0);var Ya=[{key:"Ctrl-b",run:Ho,shift:Qo,preventDefault:!0},{key:"Ctrl-f",run:zo,shift:ei},{key:"Ctrl-p",run:Go,shift:ri},{key:"Ctrl-n",run:Jo,shift:oi},{key:"Ctrl-a",run:Xn,shift:Zn},{key:"Ctrl-e",run:Yn,shift:Qn},{key:"Ctrl-d",run:ai},{key:"Ctrl-h",run:Wn},{key:"Ctrl-k",run:Ua},{key:"Ctrl-Alt-h",run:di},{key:"Ctrl-o",run:Ka},{key:"Ctrl-t",run:Ha},{key:"Ctrl-v",run:Fn}],Qa=[{key:"ArrowLeft",run:Ho,shift:Qo,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:ba,shift:Da,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Ca,shift:Pa,preventDefault:!0},{key:"ArrowRight",run:zo,shift:ei,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:ya,shift:Ta,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Ea,shift:Fa,preventDefault:!0},{key:"ArrowUp",run:Go,shift:ri,preventDefault:!0},{mac:"Cmd-ArrowUp",run:$t,shift:Kt},{mac:"Ctrl-ArrowUp",run:Do,shift:Lo},{key:"ArrowDown",run:Jo,shift:oi,preventDefault:!0},{mac:"Cmd-ArrowDown",run:_t,shift:Ht},{mac:"Ctrl-ArrowDown",run:Fn,shift:Io},{key:"PageUp",run:Do,shift:Lo},{key:"PageDown",run:Fn,shift:Io},{key:"Home",run:Sa,shift:Oa,preventDefault:!0},{key:"Mod-Home",run:$t,shift:Kt},{key:"End",run:wa,shift:Ia,preventDefault:!0},{key:"Mod-End",run:_t,shift:Ht},{key:"Enter",run:Oo,shift:Oo},{key:"Mod-a",run:Na},{key:"Backspace",run:Wn,shift:Wn,preventDefault:!0},{key:"Delete",run:ai,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:di,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Wa,preventDefault:!0},{mac:"Mod-Backspace",run:$a,preventDefault:!0},{mac:"Mod-Delete",run:_a,preventDefault:!0}].concat(Ya.map((t)=>({mac:t.key,run:t.run,shift:t.shift}))),xi=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:va,shift:Aa},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:ka,shift:La},{key:"Alt-ArrowUp",run:sr},{key:"Shift-Alt-ArrowUp",run:ar},{key:"Alt-ArrowDown",run:lr},{key:"Shift-Alt-ArrowDown",run:cr},{key:"Mod-Alt-ArrowUp",run:rr},{key:"Mod-Alt-ArrowDown",run:or},{key:"Escape",run:ir},{key:"Mod-Enter",run:dr},{key:"Alt-l",mac:"Ctrl-l",run:er},{key:"Mod-i",run:Va,preventDefault:!0},{key:"Mod-[",run:Jt},{key:"Mod-]",run:Gt},{key:"Mod-Alt-\\",run:ja},{key:"Shift-Mod-k",run:ur},{key:"Shift-Mod-\\",run:Ra},{key:"Mod-/",run:_n},{key:"Alt-A",mac:"Ctrl-A",run:qn},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Ja}].concat(Qa);var ec={python:{line:"#"},bash:{line:"#"},yaml:{line:"#"},toml:{line:"#"},ruby:{line:"#"},perl:{line:"#"},r:{line:"#"},makefile:{line:"#"},dockerfile:{line:"#"},ini:{line:"#"},properties:{line:"#"},elixir:{line:"#"},graphql:{line:"#"},nix:{line:"#"},sql:{line:"--"},lua:{line:"--"},haskell:{line:"--"},css:{block:["/*","*/"]},scss:{block:["/*","*/"]},less:{block:["/*","*/"]},sass:{block:["/*","*/"]},stylus:{block:["/*","*/"]},html:{block:["<!--","-->"]},xml:{block:["<!--","-->"]},markdown:{block:["<!--","-->"]}};function vi(t){return ec[t]??{line:"//"}}function wi(t){return/^[ \t]*/.exec(t)?.[0].length??0}var De=(t)=>/[{[(\[]$/.test(t.trimEnd()),ge=/^[ \t]*[}\])]$/,Xt={yaml:{opens:(t)=>/:\s*$/.test(t.trimEnd())&&!/^[ \t]*#/.test(t)},toml:{opens:De,closes:ge},ini:{opens:De,closes:ge},hcl:{opens:De,closes:ge},protobuf:{opens:De,closes:ge},graphql:{opens:De,closes:ge},nix:{opens:De,closes:ge},svelte:{opens:De,closes:ge},astro:{opens:De,closes:ge},vue:{opens:De,closes:ge},zig:{opens:De,closes:ge},solidity:{opens:De,closes:ge},php:{opens:De,closes:ge},powershell:{opens:De,closes:ge},perl:{opens:De,closes:ge},bash:{opens:(t)=>/\b(then|do|else)\s*$/.test(t.trimEnd()),closes:/^[ \t]*(fi|done|esac|\})$/},haskell:{opens:(t)=>/(=|\bwhere|\bdo|\bof|\bthen|\belse)\s*$/.test(t.trimEnd())},ocaml:{opens:(t)=>/(=|\bdo|\bthen|\belse|\bin|\bwith)\s*$/.test(t.trimEnd())},dockerfile:{opens:(t)=>/\\$/.test(t.trimEnd())},html:{opens:(t)=>{let r=t.trimEnd();return/<[a-zA-Z][^<>]*>$/.test(r)&&!/\/>$/.test(r)},closes:/^[ \t]*<\//},sql:{opens:()=>!1},makefile:{opens:()=>!1},properties:{opens:()=>!1},markdown:{opens:()=>!1},diff:{opens:()=>!1},text:{opens:()=>!1},go:{closes:ge},tsx:{closes:ge},jsx:{closes:ge}};function Si(t){let r=Xt[t];return r!==void 0&&(r.opens!==void 0||r.closes!==void 0)}function Ci(t,r,l=2){let c=Xt[t]?.opens;if(!c)return null;let p=wi(r);return c(r)?p+l:p}function Ei(t,r,l=2){if(!Xt[t]?.closes?.test(r))return null;return Math.max(0,wi(r)-l)}function Mi(t){return Xt[t]?.closes??null}var tc=200;function nc(t){return(r,l)=>{if(!Si(t))return;let c=r.lineAt(l,-1);for(let h=0;h<tc&&!c.text.trim()&&c.from>0;h++)c=r.lineAt(Math.max(0,c.from-1),-1);if(!c.text.trim())return;let p=Ei(t,c.text,r.unit);if(p!==null)return p;return Ci(t,c.text,r.unit)??void 0}}function rc(t){let r=Mi(t);return r?[{indentOnInput:r}]:[]}function Ri(t){return[Ag(),Zm.of(nc(t))]}function Di(t){return ue.languageData.of(()=>rc(t))}class yr{constructor(t,r,l,c){this.state=t,this.pos=r,this.explicit=l,this.view=c,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let r=Un(this.state).resolveInner(this.pos,-1);while(r&&t.indexOf(r.name)<0)r=r.parent;return r?{from:r.from,to:this.pos,text:this.state.sliceDoc(r.from,this.pos),type:r.type}:null}matchBefore(t){let r=this.state.doc.lineAt(this.pos),l=Math.max(r.from,this.pos-250),c=r.text.slice(l-r.from,this.pos-r.from),p=c.search(Vi(t,!1));return p<0?null:{from:l+p,to:this.pos,text:c.slice(p)}}get aborted(){return this.abortListeners==null}addEventListener(t,r,l){if(t=="abort"&&this.abortListeners){if(this.abortListeners.push(r),l&&l.onDocChange)this.abortOnDocChange=!0}}}function Ti(t){let r=Object.keys(t).join(""),l=/\w/.test(r);if(l)r=r.replace(/\w/g,"");return`[${l?"\\w":""}${r.replace(/[^\w\s]/g,"\\$&")}]`}function oc(t){let r=Object.create(null),l=Object.create(null);for(let{label:p}of t){r[p[0]]=!0;for(let h=1;h<p.length;h++)l[p[h]]=!0}let c=Ti(r)+Ti(l)+"*$";return[new RegExp("^"+c),new RegExp(c)]}function ic(t){let r=t.map((p)=>typeof p=="string"?{label:p}:p),[l,c]=r.every((p)=>/^\w+$/.test(p.label))?[/\w*$/,/\w+$/]:oc(r);return(p)=>{let h=p.matchBefore(c);return h||p.explicit?{from:h?h.from:p.pos,options:r,validFor:l}:null}}class br{constructor(t,r,l,c){this.completion=t,this.source=r,this.match=l,this.score=c}}function tt(t){return t.selection.main.from}function Vi(t,r){var l;let{source:c}=t,p=r&&c[0]!="^",h=c[c.length-1]!="$";if(!p&&!h)return t;return new RegExp(`${p?"^":""}(?:${c})${h?"$":""}`,(l=t.flags)!==null&&l!==void 0?l:t.ignoreCase?"i":"")}var Ui=aa.define();function sc(t,r,l,c){let{main:p}=t.selection,h=l-p.from,g=c-p.from;return{...t.changeByRange((y)=>{if(y!=p&&l!=c&&t.sliceDoc(y.from+h,y.from+g)!=t.sliceDoc(l,c))return{range:y};let x=t.toText(r);return{changes:{from:y.from+h,to:c==p.from?y.to:y.from+g,insert:x},range:k.cursor(y.from+h+x.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}var Li=new WeakMap;function lc(t){if(!Array.isArray(t))return t;let r=Li.get(t);if(!r)Li.set(t,r=ic(t));return r}var tn=ae.define(),Et=ae.define();class _i{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let r=0;r<t.length;){let l=On(t,r),c=ra(l);this.chars.push(l);let p=t.slice(r,r+c),h=p.toUpperCase();this.folded.push(On(h==p?p.toLowerCase():h,0)),r+=c}this.astral=t.length!=this.chars.length}ret(t,r){return this.score=t,this.matched=r,this}match(t){if(this.pattern.length==0)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;let{chars:r,folded:l,any:c,precise:p,byWord:h}=this;if(r.length==1){let A=On(t,0),L=ra(A),F=L==t.length?0:-100;if(A==r[0]);else if(A==l[0])F+=-200;else return null;return this.ret(F,[0,L])}let g=t.indexOf(this.pattern);if(g==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let y=r.length,x=0;if(g<0){for(let A=0,L=Math.min(t.length,200);A<L&&x<y;){let F=On(t,A);if(F==r[x]||F==l[x])c[x++]=A;A+=ra(F)}if(x<y)return null}let w=0,v=0,C=!1,R=0,O=-1,P=-1,N=/[a-z]/.test(t),V=!0;for(let A=0,L=Math.min(t.length,200),F=0;A<L&&v<y;){let U=On(t,A);if(g<0){if(w<y&&U==r[w])p[w++]=A;if(R<y)if(U==r[R]||U==l[R]){if(R==0)O=A;P=A+1,R++}else R=0}let z,Z=U<255?U>=48&&U<=57||U>=97&&U<=122?2:U>=65&&U<=90?1:0:(z=sd(U))!=z.toLowerCase()?1:z!=z.toUpperCase()?2:0;if(!A||Z==1&&N||F==0&&Z!=0){if(r[v]==U||l[v]==U&&(C=!0))h[v++]=A;else if(h.length)V=!1}F=Z,A+=ra(U)}if(v==y&&h[0]==0&&V)return this.result(-100+(C?-200:0),h,t);if(R==y&&O==0)return this.ret(-200-t.length+(P==t.length?0:-100),[0,P]);if(g>-1)return this.ret(-700-t.length,[g,g+this.pattern.length]);if(R==y)return this.ret(-900-t.length,[O,P]);if(v==y)return this.result(-100+(C?-200:0)+-700+(V?0:-1100),h,t);return r.length==2?null:this.result((c[0]?-700:0)+-200+-1100,c,t)}result(t,r,l){let c=[],p=0;for(let h of r){let g=h+(this.astral?ra(On(l,h)):1);if(p&&c[p-1]==h)c[p-1]=g;else c[p++]=h,c[p++]=g}return this.ret(t-l.length,c)}}class Ki{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length<this.pattern.length)return null;let r=t.slice(0,this.pattern.length),l=r==this.pattern?0:r.toLowerCase()==this.folded?-200:null;if(l==null)return null;return this.matched=[0,r.length],this.score=l+(t.length==this.pattern.length?0:-100),this}}var he=M.define({combine(t){return tr(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:ac,filterStrict:!1,compareCompletions:(r,l)=>(r.sortText||r.label).localeCompare(l.sortText||l.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(r,l)=>r&&l,closeOnBlur:(r,l)=>r&&l,icons:(r,l)=>r&&l,tooltipClass:(r,l)=>(c)=>Ii(r(c),l(c)),optionClass:(r,l)=>(c)=>Ii(r(c),l(c)),addToOptions:(r,l)=>r.concat(l),filterStrict:(r,l)=>r||l})}});function Ii(t,r){return t?r?t+" "+r:t:r}function ac(t,r,l,c,p,h){let g=t.textDirection==Oe.RTL,y=g,x=!1,w="top",v,C,R=r.left-p.left,O=p.right-r.right,P=c.right-c.left,N=c.bottom-c.top;if(y&&R<Math.min(P,O))y=!1;else if(!y&&O<Math.min(P,R))y=!0;if(P<=(y?R:O))v=Math.max(p.top,Math.min(l.top,p.bottom-N))-r.top,C=Math.min(400,y?R:O);else{x=!0,C=Math.min(400,(g?r.right:p.right-r.left)-30);let L=p.bottom-r.bottom;if(L>=N||L>r.top)v=l.bottom-r.top;else w="bottom",v=r.bottom-l.top}let V=(r.bottom-r.top)/h.offsetHeight,A=(r.right-r.left)/h.offsetWidth;return{style:`${w}: ${v/V}px; max-width: ${C/A}px`,class:"cm-completionInfo-"+(x?g?"left-narrow":"right-narrow":y?"left":"right")}}var xr=ae.define();function cc(t){let r=t.addToOptions.slice();if(t.icons)r.push({render(l){let c=document.createElement("div");if(c.classList.add("cm-completionIcon"),l.type)c.classList.add(...l.type.split(/\s+/g).map((p)=>"cm-completionIcon-"+p));return c.setAttribute("aria-hidden","true"),c},position:20});return r.push({render(l,c,p,h){let g=document.createElement("span");g.className="cm-completionLabel";let y=l.displayLabel||l.label,x=0;for(let w=0;w<h.length;){let v=h[w++],C=h[w++];if(v>x)g.appendChild(document.createTextNode(y.slice(x,v)));let R=g.appendChild(document.createElement("span"));R.appendChild(document.createTextNode(y.slice(v,C))),R.className="cm-completionMatchedText",x=C}if(x<y.length)g.appendChild(document.createTextNode(y.slice(x)));return g},position:50},{render(l){if(!l.detail)return null;let c=document.createElement("span");return c.className="cm-completionDetail",c.textContent=l.detail,c},position:80}),r.sort((l,c)=>l.position-c.position).map((l)=>l.render)}function mr(t,r,l){if(t<=l)return{from:0,to:t};if(r<0)r=0;if(r<=t>>1){let p=Math.floor(r/l);return{from:p*l,to:(p+1)*l}}let c=Math.ceil((t-r)/l);return{from:t-c*l,to:t-(c-1)*l}}class Hi{constructor(t,r,l){this.view=t,this.stateField=r,this.applyCompletion=l,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:(y)=>this.placeInfo(y),key:this},this.space=null,this.currentClass="";let c=t.state.field(r),{options:p,selected:h}=c.open,g=t.state.facet(he);this.optionContent=cc(g),this.optionClass=g.optionClass,this.tooltipClass=g.tooltipClass,this.range=mr(p.length,h,g.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(y)=>{let{options:x}=t.state.field(r).open;for(let w=y.target,v;w&&w!=this.dom;w=w.parentNode)if(w.nodeName=="LI"&&(v=/-(\d+)$/.exec(w.id))&&+v[1]<x.length){this.applyCompletion(t,x[+v[1]]),y.preventDefault();return}if(y.target==this.list){let w=this.list.classList.contains("cm-completionListIncompleteTop")&&y.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&y.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;if(w!=null)t.dispatch({effects:xr.of(w)}),y.preventDefault()}}),this.dom.addEventListener("focusout",(y)=>{let x=t.state.field(this.stateField,!1);if(x&&x.tooltip&&t.state.facet(he).closeOnBlur&&y.relatedTarget!=t.contentDOM)t.dispatch({effects:Et.of(null)})}),this.showOptions(p,c.id)}mount(){this.updateSel()}showOptions(t,r){if(this.list)this.list.remove();this.list=this.dom.appendChild(this.createListBox(t,r,this.range)),this.list.addEventListener("scroll",()=>{if(this.info)this.view.requestMeasure(this.placeInfoReq)})}update(t){var r;let l=t.state.field(this.stateField),c=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),l!=c){let{options:p,selected:h,disabled:g}=l.open;if(!c.open||c.open.options!=p)this.range=mr(p.length,h,t.state.facet(he).maxRenderedOptions),this.showOptions(p,l.id);if(this.updateSel(),g!=((r=c.open)===null||r===void 0?void 0:r.disabled))this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!g)}}updateTooltipClass(t){let r=this.tooltipClass(t);if(r!=this.currentClass){for(let l of this.currentClass.split(" "))if(l)this.dom.classList.remove(l);for(let l of r.split(" "))if(l)this.dom.classList.add(l);this.currentClass=r}}positioned(t){if(this.space=t,this.info)this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),r=t.open;if(r.selected>-1&&r.selected<this.range.from||r.selected>=this.range.to)this.range=mr(r.options.length,r.selected,this.view.state.facet(he).maxRenderedOptions),this.showOptions(r.options,t.id);let l=this.updateSelectedOption(r.selected);if(l){this.destroyInfo();let{completion:c}=r.options[r.selected],{info:p}=c;if(!p)return;let h=typeof p==="string"?document.createTextNode(p):p(c);if(!h)return;if("then"in h)h.then((g)=>{if(g&&this.view.state.field(this.stateField,!1)==t)this.addInfoPane(g,c)}).catch((g)=>Bn(this.view.state,g,"completion info"));else this.addInfoPane(h,c),l.setAttribute("aria-describedby",this.info.id)}}addInfoPane(t,r){this.destroyInfo();let l=this.info=document.createElement("div");if(l.className="cm-tooltip cm-completionInfo",l.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),t.nodeType!=null)l.appendChild(t),this.infoDestroy=null;else{let{dom:c,destroy:p}=t;l.appendChild(c),this.infoDestroy=p||null}this.dom.appendChild(l),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let r=null;for(let l=this.list.firstChild,c=this.range.from;l;l=l.nextSibling,c++)if(l.nodeName!="LI"||!l.id)c--;else if(c==t){if(!l.hasAttribute("aria-selected"))l.setAttribute("aria-selected","true"),r=l}else if(l.hasAttribute("aria-selected"))l.removeAttribute("aria-selected"),l.removeAttribute("aria-describedby");if(r)dc(this.list,r);return r}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let r=this.dom.getBoundingClientRect(),l=this.info.getBoundingClientRect(),c=t.getBoundingClientRect(),p=this.space;if(!p){let h=this.dom.ownerDocument.documentElement;p={left:0,top:0,right:h.clientWidth,bottom:h.clientHeight}}if(c.top>Math.min(p.bottom,r.bottom)-10||c.bottom<Math.max(p.top,r.top)+10)return null;return this.view.state.facet(he).positionInfo(this.view,r,c,l,p,this.dom)}placeInfo(t){if(this.info)if(t){if(t.style)this.info.style.cssText=t.style;this.info.className="cm-tooltip cm-completionInfo "+(t.class||"")}else this.info.style.cssText="top: -1e6px"}createListBox(t,r,l){let c=document.createElement("ul");c.id=r,c.setAttribute("role","listbox"),c.setAttribute("aria-expanded","true"),c.setAttribute("aria-label",this.view.state.phrase("Completions")),c.addEventListener("mousedown",(h)=>{if(h.target==c)h.preventDefault()});let p=null;for(let h=l.from;h<l.to;h++){let{completion:g,match:y}=t[h],{section:x}=g;if(x){let C=typeof x=="string"?x:x.name;if(C!=p&&(h>l.from||l.from==0))if(p=C,typeof x!="string"&&x.header)c.appendChild(x.header(x));else{let R=c.appendChild(document.createElement("completion-section"));R.textContent=C}}let w=c.appendChild(document.createElement("li"));w.id=r+"-"+h,w.setAttribute("role","option");let v=this.optionClass(g);if(v)w.className=v;for(let C of this.optionContent){let R=C(g,this.view.state,this.view,y);if(R)w.appendChild(R)}}if(l.from)c.classList.add("cm-completionListIncompleteTop");if(l.to<t.length)c.classList.add("cm-completionListIncompleteBottom");return c}destroyInfo(){if(this.info){if(this.infoDestroy)this.infoDestroy();this.info.remove(),this.info=null}}destroy(){this.destroyInfo()}}function uc(t,r){return(l)=>new Hi(l,t,r)}function dc(t,r){let l=t.getBoundingClientRect(),c=r.getBoundingClientRect(),p=l.height/t.offsetHeight;if(c.top<l.top)t.scrollTop-=(l.top-c.top)/p;else if(c.bottom>l.bottom)t.scrollTop+=(c.bottom-l.bottom)/p}function Pi(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function fc(t,r){let l=[],c=null,p=null,h=(v)=>{l.push(v);let{section:C}=v.completion;if(C){if(!c)c=[];let R=typeof C=="string"?C:C.name;if(!c.some((O)=>O.name==R))c.push(typeof C=="string"?{name:R}:C)}},g=r.facet(he);for(let v of t)if(v.hasResult()){let C=v.result.getMatch;if(v.result.filter===!1)for(let R of v.result.options)h(new br(R,v.source,C?C(R):[],1e9-l.length));else{let R=r.sliceDoc(v.from,v.to),O,P=g.filterStrict?new Ki(R):new _i(R);for(let N of v.result.options)if(O=P.match(N.label)){let V=!N.displayLabel?O.matched:C?C(N,O.matched):[],A=O.score+(N.boost||0);if(h(new br(N,v.source,V,A)),typeof N.section=="object"&&N.section.rank==="dynamic"){let{name:L}=N.section;if(!p)p=Object.create(null);p[L]=Math.max(A,p[L]||-1e9)}}}}if(c){let v=Object.create(null),C=0,R=(O,P)=>(O.rank==="dynamic"&&P.rank==="dynamic"?p[P.name]-p[O.name]:0)||(typeof O.rank=="number"?O.rank:1e9)-(typeof P.rank=="number"?P.rank:1e9)||(O.name<P.name?-1:1);for(let O of c.sort(R))C-=1e5,v[O.name]=C;for(let O of l){let{section:P}=O.completion;if(P)O.score+=v[typeof P=="string"?P:P.name]}}let y=[],x=null,w=g.compareCompletions;for(let v of l.sort((C,R)=>R.score-C.score||w(C.completion,R.completion))){let C=v.completion;if(!x||x.label!=C.label||x.detail!=C.detail||x.type!=null&&C.type!=null&&x.type!=C.type||x.apply!=C.apply||x.boost!=C.boost)y.push(v);else if(Pi(v.completion)>Pi(x))y[y.length-1]=v;x=v.completion}return y}class ft{constructor(t,r,l,c,p,h){this.options=t,this.attrs=r,this.tooltip=l,this.timestamp=c,this.selected=p,this.disabled=h}setSelected(t,r){return t==this.selected||t>=this.options.length?this:new ft(this.options,Bi(r,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,r,l,c,p,h){if(c&&!h&&t.some((x)=>x.isPending))return c.setDisabled();let g=fc(t,r);if(!g.length)return c&&t.some((x)=>x.isPending)?c.setDisabled():null;let y=r.facet(he).selectOnOpen?0:-1;if(c&&c.selected!=y&&c.selected!=-1){let x=c.options[c.selected].completion;for(let w=0;w<g.length;w++)if(g[w].completion==x){y=w;break}}return new ft(g,Bi(l,y),{pos:t.reduce((x,w)=>w.hasResult()?Math.min(x,w.from):x,1e8),create:xc,above:p.aboveCursor},c?c.timestamp:Date.now(),y,!1)}map(t){return new ft(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new ft(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class nn{constructor(t,r,l){this.active=t,this.id=r,this.open=l}static start(){return new nn(bc,"cm-ac-"+Math.floor(Math.random()*2000000).toString(36),null)}update(t){let{state:r}=t,l=r.facet(he),p=(l.override||r.languageDataAt("autocomplete",tt(r)).map(lc)).map((y)=>(this.active.find((w)=>w.source==y)||new Fe(y,this.active.some((w)=>w.state!=0)?1:0)).update(t,l));if(p.length==this.active.length&&p.every((y,x)=>y==this.active[x]))p=this.active;let h=this.open,g=t.effects.some((y)=>y.is(kr));if(h&&t.docChanged)h=h.map(t.changes);if(t.selection||p.some((y)=>y.hasResult()&&t.changes.touchesRange(y.from,y.to))||!mc(p,this.active)||g)h=ft.build(p,r,this.id,h,l,g);else if(h&&h.disabled&&!p.some((y)=>y.isPending))h=null;if(!h&&p.every((y)=>!y.isPending)&&p.some((y)=>y.hasResult()))p=p.map((y)=>y.hasResult()?new Fe(y.source,0):y);for(let y of t.effects)if(y.is(xr))h=h&&h.setSelected(y.value,this.id);return p==this.active&&h==this.open?this:new nn(p,this.id,h)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?hc:gc}}function mc(t,r){if(t==r)return!0;for(let l=0,c=0;;){while(l<t.length&&!t[l].hasResult())l++;while(c<r.length&&!r[c].hasResult())c++;let p=l==t.length,h=c==r.length;if(p||h)return p==h;if(t[l++].result!=r[c++].result)return!1}}var hc={"aria-autocomplete":"list"},gc={};function Bi(t,r){let l={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};if(r>-1)l["aria-activedescendant"]=t+"-"+r;return l}var bc=[];function zi(t,r){if(t.isUserEvent("input.complete")){let c=t.annotation(Ui);if(c&&r.activateOnCompletion(c))return 12}let l=t.isUserEvent("input.type");return l&&r.activateOnTyping?5:l?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Fe{constructor(t,r,l=!1){this.source=t,this.state=r,this.explicit=l}hasResult(){return!1}get isPending(){return this.state==1}update(t,r){let l=zi(t,r),c=this;if(l&8||l&16&&this.touches(t))c=new Fe(c.source,0);if(l&4&&c.state==0)c=new Fe(this.source,1);c=c.updateFor(t,l);for(let p of t.effects)if(p.is(tn))c=new Fe(c.source,1,p.value);else if(p.is(Et))c=new Fe(c.source,0);else if(p.is(kr)){for(let h of p.value)if(h.source==c.source)c=h}return c}updateFor(t,r){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(tt(t.state))}}class mt extends Fe{constructor(t,r,l,c,p,h){super(t,3,r);this.limit=l,this.result=c,this.from=p,this.to=h}hasResult(){return!0}updateFor(t,r){var l;if(!(r&3))return this.map(t.changes);let c=this.result;if(c.map&&!t.changes.empty)c=c.map(c,t.changes);let p=t.changes.mapPos(this.from),h=t.changes.mapPos(this.to,1),g=tt(t.state);if(g>h||!c||r&2&&(tt(t.startState)==this.from||g<this.limit))return new Fe(this.source,r&4?1:0);let y=t.changes.mapPos(this.limit);if(yc(c.validFor,t.state,p,h))return new mt(this.source,this.explicit,y,c,p,h);if(c.update&&(c=c.update(c,p,h,new yr(t.state,g,!1))))return new mt(this.source,this.explicit,y,c,c.from,(l=c.to)!==null&&l!==void 0?l:tt(t.state));return new Fe(this.source,1,this.explicit)}map(t){if(t.empty)return this;let r=this.result.map?this.result.map(this.result,t):this.result;if(!r)return new Fe(this.source,0);return new mt(this.source,this.explicit,t.mapPos(this.limit),r,t.mapPos(this.from),t.mapPos(this.to,1))}touches(t){return t.changes.touchesRange(this.from,this.to)}}function yc(t,r,l,c){if(!t)return!1;let p=r.sliceDoc(l,c);return typeof t=="function"?t(p,l,c,r):Vi(t,!0).test(p)}var kr=ae.define({map(t,r){return t.map((l)=>l.map(r))}}),Te=Re.define({create(){return nn.start()},update(t,r){return t.update(r)},provide:(t)=>[Qc.from(t,(r)=>r.tooltip),I.contentAttributes.from(t,(r)=>r.attrs)]});function wr(t,r){let l=r.completion.apply||r.completion.label,c=t.state.field(Te).active.find((p)=>p.source==r.source);if(!(c instanceof mt))return!1;if(typeof l=="string")t.dispatch({...sc(t.state,l,c.from,c.to),annotations:Ui.of(r.completion)});else l(t,r.completion,c.from,c.to);return!0}var xc=uc(Te,wr);function Zt(t,r="option"){return(l)=>{let c=l.state.field(Te,!1);if(!c||!c.open||c.open.disabled||Date.now()-c.open.timestamp<l.state.facet(he).interactionDelay)return!1;let p=1,h;if(r=="page"&&(h=gg(l,c.open.tooltip)))p=Math.max(2,Math.floor(h.dom.offsetHeight/h.dom.querySelector("li").offsetHeight)-1);let{length:g}=c.open.options,y=c.open.selected>-1?c.open.selected+p*(t?1:-1):t?0:g-1;if(y<0)y=r=="page"?0:g-1;else if(y>=g)y=r=="page"?g-1:0;return l.dispatch({effects:xr.of(y)}),!0}}var vc=(t)=>{let r=t.state.field(Te,!1);if(t.state.readOnly||!r||!r.open||r.open.selected<0||r.open.disabled||Date.now()-r.open.timestamp<t.state.facet(he).interactionDelay)return!1;return wr(t,r.open.options[r.open.selected])},pr=(t)=>{if(!t.state.field(Te,!1))return!1;return t.dispatch({effects:tn.of(!0)}),!0},kc=(t)=>{let r=t.state.field(Te,!1);if(!r||!r.active.some((l)=>l.state!=0))return!1;return t.dispatch({effects:Et.of(null)}),!0};class Xi{constructor(t,r){this.active=t,this.context=r,this.time=Date.now(),this.updates=[],this.done=void 0}}var wc=50,Sc=1000,Cc=ye.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let r of t.state.field(Te).active)if(r.isPending)this.startQuery(r)}update(t){let r=t.state.field(Te),l=t.state.facet(he);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Te)==r)return;let c=t.transactions.some((h)=>{let g=zi(h,l);return g&8||(h.selection||h.docChanged)&&!(g&3)});for(let h=0;h<this.running.length;h++){let g=this.running[h];if(c||g.context.abortOnDocChange&&t.docChanged||g.updates.length+t.transactions.length>wc&&Date.now()-g.time>Sc){for(let y of g.context.abortListeners)try{y()}catch(x){Bn(this.view.state,x)}g.context.abortListeners=null,this.running.splice(h--,1)}else g.updates.push(...t.transactions)}if(this.debounceUpdate>-1)clearTimeout(this.debounceUpdate);if(t.transactions.some((h)=>h.effects.some((g)=>g.is(tn))))this.pendingStart=!0;let p=this.pendingStart?50:l.activateOnTypingDelay;if(this.debounceUpdate=r.active.some((h)=>h.isPending&&!this.running.some((g)=>g.active.source==h.source))?setTimeout(()=>this.startUpdate(),p):-1,this.composing!=0){for(let h of t.transactions)if(h.isUserEvent("input.type"))this.composing=2;else if(this.composing==2&&h.selection)this.composing=3}}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,r=t.field(Te);for(let l of r.active)if(l.isPending&&!this.running.some((c)=>c.active.source==l.source))this.startQuery(l);if(this.running.length&&r.open&&r.open.disabled)this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(he).updateSyncTime)}startQuery(t){let{state:r}=this.view,l=tt(r),c=new yr(r,l,t.explicit,this.view),p=new Xi(t,c);this.running.push(p),Promise.resolve(t.source(c)).then((h)=>{if(!p.context.aborted)p.done=h||null,this.scheduleAccept()},(h)=>{this.view.dispatch({effects:Et.of(null)}),Bn(this.view.state,h)})}scheduleAccept(){if(this.running.every((t)=>t.done!==void 0))this.accept();else if(this.debounceAccept<0)this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(he).updateSyncTime)}accept(){var t;if(this.debounceAccept>-1)clearTimeout(this.debounceAccept);this.debounceAccept=-1;let r=[],l=this.view.state.facet(he),c=this.view.state.field(Te);for(let p=0;p<this.running.length;p++){let h=this.running[p];if(h.done===void 0)continue;if(this.running.splice(p--,1),h.done){let y=tt(h.updates.length?h.updates[0].startState:this.view.state),x=Math.min(y,h.done.from+(h.active.explicit?0:1)),w=new mt(h.active.source,h.active.explicit,x,h.done,h.done.from,(t=h.done.to)!==null&&t!==void 0?t:y);for(let v of h.updates)w=w.update(v,l);if(w.hasResult()){r.push(w);continue}}let g=c.active.find((y)=>y.source==h.active.source);if(g&&g.isPending)if(h.done==null){let y=new Fe(h.active.source,0);for(let x of h.updates)y=y.update(x,l);if(!y.isPending)r.push(y)}else this.startQuery(g)}if(r.length||c.open&&c.open.disabled)this.view.dispatch({effects:kr.of(r)})}},{eventHandlers:{blur(t){let r=this.view.state.field(Te,!1);if(r&&r.tooltip&&this.view.state.facet(he).closeOnBlur){let l=r.open&&gg(this.view,r.open.tooltip);if(!l||!l.dom.contains(t.relatedTarget))setTimeout(()=>this.view.dispatch({effects:Et.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){if(this.composing==3)setTimeout(()=>this.view.dispatch({effects:tn.of(!1)}),20);this.composing=0}}}),Ec=typeof navigator=="object"&&/Win/.test(navigator.platform),Mc=Sr.highest(I.domEventHandlers({keydown(t,r){let l=r.state.field(Te,!1);if(!l||!l.open||l.open.disabled||l.open.selected<0||!t.key||t.key.length>1||t.ctrlKey&&!(Ec&&t.altKey)||t.metaKey)return!1;let c=l.open.options[l.open.selected],p=l.active.find((g)=>g.source==c.source),h=c.completion.commitCharacters||p.result.commitCharacters;if(h&&h.indexOf(t.key)>-1)wr(r,c);return!1}})),Rc=I.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:0.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:0.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'\uD835\uDC65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\uD835\uDC36'"}},".cm-completionIcon-type":{"&:after":{content:"'\uD835\uDC61'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\uD83D\uDD11︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});var Mt={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},et=ae.define({map(t,r){let l=r.mapPos(t,-1,$n.TrackAfter);return l==null?void 0:l}}),Cr=new class extends Xa{};Cr.startSide=1;Cr.endSide=-1;var Qi=Re.define({create(){return me.empty},update(t,r){if(t=t.map(r.changes),r.selection){let l=r.state.doc.lineAt(r.selection.main.head);t=t.update({filter:(c)=>c>=l.from&&c<=l.to})}for(let l of r.effects)if(l.is(et))t=t.update({add:[Cr.range(l.value,l.value+1)]});return t}});function es(){return[Tc,Qi]}var hr="()[]{}<>«»»«[]{}";function ts(t){for(let r=0;r<hr.length;r+=2)if(hr.charCodeAt(r)==t)return hr.charAt(r+1);return sd(t<128?t:t+1)}function ns(t,r){return t.languageDataAt("closeBrackets",r)[0]||Mt}var Dc=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Tc=I.inputHandler.of((t,r,l,c)=>{if((Dc?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let p=t.state.selection.main;if(c.length>2||c.length==2&&ra(On(c,0))==1||r!=p.from||l!=p.to)return!1;let h=Lc(t.state,c);if(!h)return!1;return t.dispatch(h),!0}),Ac=({state:t,dispatch:r})=>{if(t.readOnly)return!1;let c=ns(t,t.selection.main.head).brackets||Mt.brackets,p=null,h=t.changeByRange((g)=>{if(g.empty){let y=Ic(t.doc,g.head);for(let x of c)if(x==y&&on(t.doc,g.head)==ts(On(x,0)))return{changes:{from:g.head-x.length,to:g.head+x.length},range:k.cursor(g.head-x.length)}}return{range:p=g}});if(!p)r(t.update(h,{scrollIntoView:!0,userEvent:"delete.backward"}));return!p},rs=[{key:"Backspace",run:Ac}];function Lc(t,r){let l=ns(t,t.selection.main.head),c=l.brackets||Mt.brackets;for(let p of c){let h=ts(On(p,0));if(r==p)return h==p?Nc(t,p,c.indexOf(p+p+p)>-1,l):Pc(t,p,h,l.before||Mt.before);if(r==h&&os(t,t.selection.main.from))return Bc(t,p,h)}return null}function os(t,r){let l=!1;return t.field(Qi).between(0,t.doc.length,(c)=>{if(c==r)l=!0}),l}function on(t,r){let l=t.sliceString(r,r+2);return l.slice(0,ra(On(l,0)))}function Ic(t,r){let l=t.sliceString(r-2,r);return ra(On(l,0))==l.length?l:l.slice(1)}function Pc(t,r,l,c){let p=null,h=t.changeByRange((g)=>{if(!g.empty)return{changes:[{insert:r,from:g.from},{insert:l,from:g.to}],effects:et.of(g.to+r.length),range:k.range(g.anchor+r.length,g.head+r.length)};let y=on(t.doc,g.head);if(!y||/\s/.test(y)||c.indexOf(y)>-1)return{changes:{insert:r+l,from:g.head},effects:et.of(g.head+r.length),range:k.cursor(g.head+r.length)};return{range:p=g}});return p?null:t.update(h,{scrollIntoView:!0,userEvent:"input.type"})}function Bc(t,r,l){let c=null,p=t.changeByRange((h)=>{if(h.empty&&on(t.doc,h.head)==l)return{changes:{from:h.head,to:h.head+l.length,insert:l},range:k.cursor(h.head+l.length)};return c={range:h}});return c?null:t.update(p,{scrollIntoView:!0,userEvent:"input.type"})}function Nc(t,r,l,c){let p=c.stringPrefixes||Mt.stringPrefixes,h=null,g=t.changeByRange((y)=>{if(!y.empty)return{changes:[{insert:r,from:y.from},{insert:r,from:y.to}],effects:et.of(y.to+r.length),range:k.range(y.anchor+r.length,y.head+r.length)};let x=y.head,w=on(t.doc,x),v;if(w==r){if(Fi(t,x))return{changes:{insert:r+r,from:x},effects:et.of(x+r.length),range:k.cursor(x+r.length)};else if(os(t,x)){let R=l&&t.sliceDoc(x,x+r.length*3)==r+r+r?r+r+r:r;return{changes:{from:x,to:x+R.length,insert:R},range:k.cursor(x+R.length)}}}else if(l&&t.sliceDoc(x-2*r.length,x)==r+r&&(v=Ni(t,x-2*r.length,p))>-1&&Fi(t,v))return{changes:{insert:r+r+r+r,from:x},effects:et.of(x+r.length),range:k.cursor(x+r.length)};else if(t.charCategorizer(x)(w)!=pn.Word){if(Ni(t,x,p)>-1&&!_c(t,x,r,p))return{changes:{insert:r+r,from:x},effects:et.of(x+r.length),range:k.cursor(x+r.length)}}return{range:h=y}});return h?null:t.update(g,{scrollIntoView:!0,userEvent:"input.type"})}function Fi(t,r){let l=Un(t).resolveInner(r+1);return l.parent&&l.from==r}function _c(t,r,l,c){let p=Un(t).resolveInner(r,-1),h=c.reduce((g,y)=>Math.max(g,y.length),0);for(let g=0;g<5;g++){let y=t.sliceDoc(p.from,Math.min(p.to,p.from+l.length+h)),x=y.indexOf(l);if(!x||x>-1&&c.indexOf(y.slice(0,x))>-1){let v=p.firstChild;while(v&&v.from==p.from&&v.to-v.from>l.length+x){if(t.sliceDoc(v.to-l.length,v.to)==l)return!1;v=v.firstChild}return!0}let w=p.to==r&&p.parent;if(!w)break;p=w}return!1}function Ni(t,r,l){let c=t.charCategorizer(r);if(c(t.sliceDoc(r-1,r))!=pn.Word)return r;for(let p of l){let h=r-p.length;if(t.sliceDoc(h,r)==p&&c(t.sliceDoc(h-1,h))!=pn.Word)return h}return-1}function is(t={}){return[Mc,Te,he.of(t),Cc,ou,Rc]}var ru=[{key:"Ctrl-Space",run:pr},{mac:"Alt-`",run:pr},{mac:"Alt-i",run:pr},{key:"Escape",run:kc},{key:"ArrowDown",run:Zt(!0)},{key:"ArrowUp",run:Zt(!1)},{key:"PageDown",run:Zt(!0,"page")},{key:"PageUp",run:Zt(!1,"page")},{key:"Enter",run:vc}],ou=Sr.highest(pi.computeN([he],(t)=>t.facet(he).defaultKeymap?[ru]:[]));var ss=500,iu=3,ls=50,as=/[\w$]{3,}/g;function su(t){let r=new Set;for(let l of t.matchAll(as))if(r.add(l[0]),r.size>=ls*4)break;return[...r]}function lu(t){let r=t.matchBefore(as);if(!r&&!t.explicit)return null;if(r&&r.from===r.to&&!t.explicit)return null;let l=t.state.doc.lineAt(t.pos).number,c=Math.max(1,l-ss),p=Math.min(t.state.doc.lines,l+ss),h=t.state.sliceDoc(t.state.doc.line(c).from,t.state.doc.line(p).to),g=su(h).filter((y)=>y.length>=iu).slice(0,ls).map((y)=>({label:y}));if(g.length===0)return null;return{from:r?r.from:t.pos,options:g}}var cs={autoCloseBrackets:!0,autocomplete:!0};function sn({autoCloseBrackets:t,autocomplete:r}){let l=[];if(t)l.push(es(),pi.of(rs));if(r)l.push(is({override:[lu],activateOnTyping:!0}));return l}var au={" ":T.mark({class:"cm-whitespace-space"}),"\t":T.mark({class:"cm-whitespace-tab"})};function cu(t,r,l,c){let p=t.doc.lineAt(r);for(;;){let h=Math.max(r,p.from),g=Math.min(l,p.to);for(let y=h;y<g;y++){let x=p.text[y-p.from];if(x===" "||x==="\t")c.add(y,y+1,au[x])}if(p.to>=l||p.to>=t.doc.length)break;p=t.doc.lineAt(p.to+1)}}function uu(t,r,l,c,p){let h=Math.max(r.from,l),g=Math.min(r.to,c);if(h>=g)return;cu(t,h,g,p)}var us=ye.fromClass(class{constructor(t){this.decorations=this.build(t)}update(t){if(t.docChanged||t.selectionSet||t.viewportChanged)this.decorations=this.build(t.view)}build(t){let r=new pt;for(let{from:l,to:c}of t.visibleRanges)for(let p of t.state.selection.ranges)if(!p.empty)uu(t.state,p,l,c,r);return r.finish()}},{decorations:(t)=>t.decorations});var ln=ae.define(),du=T.mark({class:"find-match"}),fu=T.mark({class:"find-match",attributes:{"data-find-current":""}});function mu(t,r){if(t.marks.length===0)return T.none;let l=new pt;for(let c=0;c<t.marks.length;c++){let p=t.marks[c],h=Math.max(0,Math.min(p.start,r.length)),g=Math.max(h,Math.min(p.end,r.length));if(g===h)continue;l.add(h,g,c===t.current?fu:du)}return l.finish()}var hs=Re.define({create:()=>T.none,update(t,r){for(let l of r.effects)if(l.is(ln))return mu(l.value,r.state.doc);if(r.docChanged)return t.map(r.changes);return t},provide:(t)=>I.decorations.from(t)});var pu=new Set([".",",",")","]","}",";",":"]);function gs(t){let r=t.selection.main,l=t.doc.lineAt(r.from).number,c=t.doc.lineAt(r.to),p=r.to>r.from&&c.from===r.to?c.number-1:c.number;return{first:l,last:Math.max(l,p)}}var bs=({state:t,dispatch:r})=>{let l=t.selection.main,c=l.from===l.to,{first:p,last:h}=gs(t),g=c?p+1:h;if(g<=p||g>t.doc.lines)return!1;let y=g,x=[];for(let w=p;w<y;w++){let v=t.doc.line(w),C=t.doc.line(w+1),R=C.text.replace(/^[ \t]+/,""),O=R===""||pu.has(R[0])?"":" ";x.push({from:v.to,to:C.from+(C.text.length-R.length),insert:O})}return r(t.update({changes:x,scrollIntoView:!0,userEvent:"input.join"})),!0},ys=({state:t,dispatch:r})=>{let{first:l,last:c}=gs(t),p=[];for(let h=l;h<=c;h++){let g=t.doc.line(h),y=g.text.replace(/[ \t]+$/,"");if(y!==g.text)p.push({from:g.from+y.length,to:g.to,insert:""})}if(p.length===0)return!1;return r(t.update({changes:p,userEvent:"input.trim"})),!0};var hu=(t)=>{let{state:r}=t,l=r.selection.main,c=r.doc.lineAt(l.from),p=/^[ \t]*/.exec(c.text)?.[0]??"";return t.dispatch({changes:{from:c.from,insert:`${p}
|
|
2
|
+
`},selection:{anchor:c.from+p.length}}),!0},gu=(t)=>{if(t.state.selection.ranges.length<=1)return!1;return ir(t)},bu={undo:Gn,redo:Jn,selectNextOccurrence:Mo,selectAllOccurrences:Ro,insertCursorBelow:or,insertCursorAbove:rr,moveLineUp:sr,moveLineDown:lr,copyLineUp:ar,copyLineDown:cr,deleteLine:ur,toggleComment:_n,toggleBlockComment:qn,joinLines:bs,trimTrailingWhitespace:ys,insertLineBelow:dr,insertLineAbove:hu,indent:Gt,outdent:Jt,fold:Xm,unfold:ef,foldAll:tf,unfoldAll:nf,lineStart:Xn,lineEnd:Yn,documentStart:$t,documentEnd:_t,selectToLineStart:Zn,selectToLineEnd:Qn,selectToDocumentStart:Kt,selectToDocumentEnd:Ht,selectLine:er,escape:gu};function Mr(t,r,l){let c=bu[t];if(c)return c(r);return l?.(t),!0}var yu={Enter:"Enter",Escape:"Escape",Backspace:"Backspace",Delete:"Delete",Tab:"Tab",Space:"Space",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Home:"Home",End:"End",PageUp:"PageUp",PageDown:"PageDown"},xu={Slash:"/",Backslash:"\\",Comma:",",Period:".",Semicolon:";",Quote:"'",Backquote:"`",Minus:"-",Equal:"=",BracketLeft:"[",BracketRight:"]"};function vu(t){if(/^Key[A-Z]$/.test(t))return t.slice(3).toLowerCase();if(/^Digit\d$/.test(t))return t.slice(5);if(/^F\d{1,2}$/.test(t))return t;return yu[t]??xu[t]??null}function Er(t){let r=vu(t.code);if(!r)return null;let l=r;if(t.alt)l=`Alt-${l}`;if(t.ctrl)l=`Ctrl-${l}`;if(t.meta)l=`Meta-${l}`;if(t.shift)l=`Shift-${l}`;return l}function ku(t){let r=[];for(let l of fi){let c=Er(l.other),p=Er(l.mac),h=l.windows?Er(l.windows):null;if(!c&&!p)continue;let g=l.command;r.push({key:c??void 0,mac:p??void 0,win:h??void 0,run:(y)=>Mr(g,y,t)})}return r}var wu=[{key:"Tab",run:Gt,shift:Jt}];function xs(t,r=!1){let l=r?[]:wu;return pi.of([...ku(t),...l,...xi])}var ht="<<<<<<<",Su="|||||||",Cu=">>>>>>>",Eu=/^(?:<{7}|\|{7}|>{7})(?: .*)?$/,Mu=T.line({class:"cm-conflict-ours"}),Ru=T.line({class:"cm-conflict-base"}),Du=T.line({class:"cm-conflict-theirs"});function Tu(t){if(!Eu.test(t))return null;if(t.startsWith(Su))return Ru;if(t.startsWith(Cu))return Du;return Mu}function vs(t){let r=[];for(let{from:l,to:c}of t.visibleRanges){let p=l;while(p<=c){let h=t.state.doc.lineAt(p),g=Tu(h.text);if(g)r.push(g.range(h.from));if(h.to===p&&h.to===t.state.doc.length)break;p=h.to+1}}return T.set(r,!0)}function ks(){return ye.fromClass(class{constructor(t){this.decorations=vs(t)}update(t){if(t.docChanged||t.viewportChanged)this.decorations=vs(t.view)}},{decorations:(t)=>t.decorations})}function ws(t){let r=t.indexOf(ht);while(r!==-1){if(r===0||t.charCodeAt(r-1)===10)return!0;r=t.indexOf(ht,r+ht.length)}return!1}function Uc(t){let r=0,l=t.indexOf(ht);while(l!==-1){if(l===0||t.charCodeAt(l-1)===10)r++;l=t.indexOf(ht,l+ht.length)}return r}class Rr{constructor(t,r,l){this.from=t,this.to=r,this.diagnostic=l}}class rt{constructor(t,r,l){this.diagnostics=t,this.panel=r,this.selected=l}static init(t,r,l){let c=l.facet(qe).markerFilter;if(c)t=c(t,l);let p=t.slice().sort((R,O)=>R.from-O.from||R.to-O.to),h=new pt,g=[],y=0,x=l.doc.iter(),w=0,v=l.doc.length;for(let R=0;;){let O=R==p.length?null:p[R];if(!O&&!g.length)break;let P,N;if(g.length)P=y,N=g.reduce((L,F)=>Math.min(L,F.to),O&&O.from>P?O.from:1e8);else{if(P=O.from,P>v)break;N=O.to,g.push(O),R++}while(R<p.length){let L=p[R];if(L.from==P&&(L.to>L.from||L.to==P))g.push(L),R++,N=Math.min(L.to,N);else{N=Math.min(L.from,N);break}}N=Math.min(N,v);let V=!1;if(g.some((L)=>L.from==P&&(L.to==N||N==v))){if(V=P==N,!V&&N-P<10){let L=P-(w+x.value.length);if(L>0)x.next(L),w=P;for(let F=P;;){if(F>=N){V=!0;break}if(!x.lineBreak&&w+x.value.length>F)break;F=w+x.value.length,w+=x.value.length,x.next()}}}let A=Os(g);if(V)h.add(P,P,T.widget({widget:new Is(A),diagnostics:g.slice()}));else{let L=g.reduce((F,U)=>U.markClass?F+" "+U.markClass:F,"");h.add(P,N,T.mark({class:"cm-lintRange cm-lintRange-"+A+L,diagnostics:g.slice(),inclusiveEnd:g.some((F)=>F.to>N)}))}if(y=N,y==v)break;for(let L=0;L<g.length;L++)if(g[L].to<=y)g.splice(L--,1)}let C=h.finish();return new rt(C,r,gt(C))}}function gt(t,r=null,l=0){let c=null;return t.between(l,1e9,(p,h,{spec:g})=>{if(r&&g.diagnostics.indexOf(r)<0)return;if(!c)c=new Rr(p,h,r||g.diagnostics[0]);else if(g.diagnostics.indexOf(c.diagnostic)<0)return!1;else c=new Rr(c.from,h,c.diagnostic)}),c}function Es(t,r){let l=r.pos,c=r.end||l,p=t.state.facet(qe).hideOn(t,l,c);if(p!=null)return p;let h=t.startState.doc.lineAt(r.pos);return!!(t.effects.some((g)=>g.is(fn))||t.changes.touchesRange(h.from,Math.max(h.to,c)))}function Au(t,r){return t.field(Ke,!1)?r:r.concat(ae.appendConfig.of(Bs))}function Lu(t,r){return{effects:Au(t,[fn.of(r)])}}var fn=ae.define(),Ms=ae.define(),Rs=ae.define(),Ke=Re.define({create(){return new rt(T.none,null,null)},update(t,r){if(r.docChanged&&t.diagnostics.size){let l=t.diagnostics.map(r.changes),c=null,p=t.panel;if(t.selected){let h=r.changes.mapPos(t.selected.from,1);c=gt(l,t.selected.diagnostic,h)||gt(l,null,h)}if(!l.size&&p&&r.state.facet(qe).autoPanel)p=null;t=new rt(l,p,c)}for(let l of r.effects)if(l.is(fn)){let c=!r.state.facet(qe).autoPanel?t.panel:l.value.length?dn.open:null;t=rt.init(l.value,c,r.state)}else if(l.is(Ms))t=new rt(t.diagnostics,l.value?dn.open:null,t.selected);else if(l.is(Rs))t=new rt(t.diagnostics,t.panel,l.value);return t},provide:(t)=>[ld.from(t,(r)=>r.panel),I.decorations.from(t,(r)=>r.diagnostics)]});var Iu=T.mark({class:"cm-lintRange cm-lintRange-active"});function Ou(t,r,l){let{diagnostics:c}=t.state.field(Ke),p,h=-1,g=-1;c.between(r-(l<0?1:0),r+(l>0?1:0),(x,w,{spec:v})=>{if(r>=x&&r<=w&&(x==w||(r>x||l>0)&&(r<w||l<0)))return p=v.diagnostics,h=x,g=w,!1});let y=t.state.facet(qe).tooltipFilter;if(p&&y)p=y(p,t.state);if(!p)return null;return{pos:h,end:g,above:!0,create(){return{dom:Ds(t,p)}}}}function Ds(t,r){return Tr("ul",{class:"cm-tooltip-lint"},r.map((l)=>Ls(t,l,!1)))}var Ss=(t)=>{let r=t.state.field(Ke,!1);if(!r||!r.panel)return!1;return t.dispatch({effects:Ms.of(!1)}),!0};var Pu=ye.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:r}=t.state.facet(qe);this.lintTime=Date.now()+r,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,r)}run(){clearTimeout(this.timeout);let t=Date.now();if(t<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-t);else{this.set=!1;let{state:r}=this.view,{sources:l}=r.facet(qe);if(l.length)Bu(l.map((c)=>Promise.resolve(c(this.view))),(c)=>{if(this.view.state.doc==r.doc)this.view.dispatch(Lu(this.view.state,c.reduce((p,h)=>p.concat(h))))},(c)=>{Bn(this.view.state,c)})}}update(t){let r=t.state.facet(qe);if(t.docChanged||r!=t.startState.facet(qe)||r.needsRefresh&&r.needsRefresh(t)){if(this.lintTime=Date.now()+r.delay,!this.set)this.set=!0,this.timeout=setTimeout(this.run,r.delay)}}force(){if(this.set)this.lintTime=Date.now(),this.run()}destroy(){clearTimeout(this.timeout)}});function Bu(t,r,l){let c=[],p=-1;for(let h of t)h.then((g)=>{if(c.push(g),clearTimeout(p),c.length==t.length)r(c);else p=setTimeout(()=>r(c),200)},l)}var qe=M.define({combine(t){return{sources:t.map((r)=>r.source).filter((r)=>r!=null),...tr(t.map((r)=>r.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Cs,tooltipFilter:Cs,needsRefresh:(r,l)=>!r?l:!l?r:(c)=>r(c)||l(c),hideOn:(r,l)=>!r?l:!l?r:(c,p,h)=>r(c,p,h)||l(c,p,h),autoPanel:(r,l)=>r||l})}}});function Cs(t,r){return!t?r:!r?t:(l,c)=>r(t(l,c),c)}function Ts(t,r={}){return[qe.of({source:t,config:r}),Pu,Bs]}function As(t){let r=[];if(t)e:for(let{name:l}of t){for(let c=0;c<l.length;c++){let p=l[c];if(/[a-zA-Z]/.test(p)&&!r.some((h)=>h.toLowerCase()==p.toLowerCase())){r.push(p);continue e}}r.push("")}return r}function Ls(t,r,l){var c;let p=l?As(r.actions):[];return Tr("li",{class:"cm-diagnostic cm-diagnostic-"+r.severity},Tr("span",{class:"cm-diagnosticText"},r.renderMessage?r.renderMessage(t):r.message),(c=r.actions)===null||c===void 0?void 0:c.map((h,g)=>{let y=!1,x=(O)=>{if(O.preventDefault(),y)return;y=!0;let P=gt(t.state.field(Ke).diagnostics,r);if(P)h.apply(t,P.from,P.to)},{name:w}=h,v=p[g]?w.indexOf(p[g]):-1,C=v<0?w:[w.slice(0,v),Tr("u",w.slice(v,v+1)),w.slice(v+1)],R=h.markClass?" "+h.markClass:"";return Tr("button",{type:"button",class:"cm-diagnosticAction"+R,onclick:x,onmousedown:x,"aria-label":` Action: ${w}${v<0?"":` (access key "${p[g]})"`}.`},C)}),r.source&&Tr("div",{class:"cm-diagnosticSource"},r.source))}class Is extends Yt{constructor(t){super();this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return Tr("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Ar{constructor(t,r){this.diagnostic=r,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Ls(t,r,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class dn{constructor(t){this.view=t,this.items=[];let r=(c)=>{if(c.ctrlKey||c.altKey||c.metaKey)return;if(c.keyCode==27)Ss(this.view),this.view.focus();else if(c.keyCode==38||c.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(c.keyCode==40||c.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(c.keyCode==36)this.moveSelection(0);else if(c.keyCode==35)this.moveSelection(this.items.length-1);else if(c.keyCode==13)this.view.focus();else if(c.keyCode>=65&&c.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:p}=this.items[this.selectedIndex],h=As(p.actions);for(let g=0;g<h.length;g++)if(h[g].toUpperCase().charCodeAt(0)==c.keyCode){let y=gt(this.view.state.field(Ke).diagnostics,p);if(y)p.actions[g].apply(t,y.from,y.to)}}else return;c.preventDefault()},l=(c)=>{for(let p=0;p<this.items.length;p++)if(this.items[p].dom.contains(c.target))this.moveSelection(p)};this.list=Tr("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:r,onclick:l}),this.dom=Tr("div",{class:"cm-panel-lint"},this.list,Tr("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Ss(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Ke).selected;if(!t)return-1;for(let r=0;r<this.items.length;r++)if(this.items[r].diagnostic==t.diagnostic)return r;return-1}update(){let{diagnostics:t,selected:r}=this.view.state.field(Ke),l=0,c=!1,p=null,h=new Set;t.between(0,this.view.state.doc.length,(g,y,{spec:x})=>{for(let w of x.diagnostics){if(h.has(w))continue;h.add(w);let v=-1,C;for(let R=l;R<this.items.length;R++)if(this.items[R].diagnostic==w){v=R;break}if(v<0)C=new Ar(this.view,w),this.items.splice(l,0,C),c=!0;else if(C=this.items[v],v>l)this.items.splice(l,v-l),c=!0;if(r&&C.diagnostic==r.diagnostic){if(!C.dom.hasAttribute("aria-selected"))C.dom.setAttribute("aria-selected","true"),p=C}else if(C.dom.hasAttribute("aria-selected"))C.dom.removeAttribute("aria-selected");l++}});while(l<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0))c=!0,this.items.pop();if(this.items.length==0)this.items.push(new Ar(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),c=!0;if(p)this.list.setAttribute("aria-activedescendant",p.id),this.view.requestMeasure({key:this,read:()=>({sel:p.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:g,panel:y})=>{let x=y.height/this.list.offsetHeight;if(g.top<y.top)this.list.scrollTop-=(y.top-g.top)/x;else if(g.bottom>y.bottom)this.list.scrollTop+=(g.bottom-y.bottom)/x}});else if(this.selectedIndex<0)this.list.removeAttribute("aria-activedescendant");if(c)this.sync()}sync(){let t=this.list.firstChild;function r(){let l=t;t=l.nextSibling,l.remove()}for(let l of this.items)if(l.dom.parentNode==this.list){while(t!=l.dom)r();t=l.dom.nextSibling}else this.list.insertBefore(l.dom,t);while(t)r()}moveSelection(t){if(this.selectedIndex<0)return;let r=this.view.state.field(Ke),l=gt(r.diagnostics,this.items[t].diagnostic);if(!l)return;this.view.dispatch({selection:{anchor:l.from,head:l.to},scrollIntoView:!0,effects:Rs.of(l)})}static open(t){return new dn(t)}}function un(t,r='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${r}>${encodeURIComponent(t)}</svg>')`}function an(t){return un(`<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"')}var Fu=I.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:0.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:an("#f11")},".cm-lintRange-warning":{backgroundImage:an("orange")},".cm-lintRange-info":{backgroundImage:an("#999")},".cm-lintRange-hint":{backgroundImage:an("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function Nu(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function Os(t){let r="hint",l=1;for(let c of t){let p=Nu(c.severity);if(p>l)l=p,r=c.severity}return r}class Ir extends zn{constructor(t){super();this.diagnostics=t,this.severity=Os(t)}toDOM(t){let r=document.createElement("div");r.className="cm-lint-marker cm-lint-marker-"+this.severity;let l=this.diagnostics,c=t.state.facet(mn).tooltipFilter;if(c)l=c(l,t.state);if(l.length)r.onmouseover=()=>Uu(t,r,l);return r}}function Wu(t,r){let l=(c)=>{let p=r.getBoundingClientRect();if(c.clientX>p.left-10&&c.clientX<p.right+10&&c.clientY>p.top-10&&c.clientY<p.bottom+10)return;for(let h=c.target;h;h=h.parentNode)if(h.nodeType==1&&h.classList.contains("cm-tooltip-lint"))return;if(window.removeEventListener("mousemove",l),t.state.field(Ps))t.dispatch({effects:Or.of(null)})};window.addEventListener("mousemove",l)}function Uu(t,r,l){function c(){let g=t.elementAtHeight(r.getBoundingClientRect().top+5-t.documentTop);if(t.coordsAtPos(g.from))t.dispatch({effects:Or.of({pos:g.from,above:!1,clip:!1,create(){return{dom:Ds(t,l),getCoords:()=>r.getBoundingClientRect()}}})});r.onmouseout=r.onmousemove=null,Wu(t,r)}let{hoverTime:p}=t.state.facet(mn),h=setTimeout(c,p);r.onmouseout=()=>{clearTimeout(h),r.onmouseout=r.onmousemove=null},r.onmousemove=()=>{clearTimeout(h),h=setTimeout(c,p)}}function $u(t,r){let l=Object.create(null);for(let p of r){let h=t.lineAt(p.from);(l[h.from]||(l[h.from]=[])).push(p)}let c=[];for(let p in l)c.push(new Ir(l[p]).range(+p));return me.of(c,!0)}var _u=ll({class:"cm-gutter-lint",markers:(t)=>t.state.field(Lr),widgetMarker:(t,r,l)=>{let c=[];return t.state.field(Lr).between(l.from,l.to,(p,h,g)=>{if(p>l.from&&p<l.to)c.push(...g.diagnostics)}),c.length?new Ir(c):null}}),Lr=Re.define({create(){return me.empty},update(t,r){t=t.map(r.changes);let l=r.state.facet(mn).markerFilter;for(let c of r.effects)if(c.is(fn)){let p=c.value;if(l)p=l(p||[],r.state);t=$u(r.state.doc,p.slice(0))}return t}}),Or=ae.define(),Ps=Re.define({create(){return null},update(t,r){if(t&&r.docChanged)t=Es(r,t)?null:{...t,pos:r.changes.mapPos(t.pos)};return r.effects.reduce((l,c)=>c.is(Or)?c.value:l,t)},provide:(t)=>Qc.from(t)}),Ku=I.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:un('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:un('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:un('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Hu=vh(Ou,{hideOn:Es}),Bs=[Ke,I.decorations.compute([Ke],(t)=>{let{selected:r,panel:l}=t.field(Ke);return!r||!l||r.from==r.to?T.none:T.set([Iu.range(r.from,r.to)])}),Hu,Fu],mn=M.define({combine(t){return tr(t,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function Fs(t={}){return[mn.of(t),Lr,_u,Ku,Ps]}function Pr(t){if(t==="json")return"json";if(t==="yaml")return"yaml";if(t==="toml")return"toml";return null}async function zu(t){let{parse:r,printParseErrorCode:l}=await import("./main-rx9grv92.js"),c=[];r(t,c,{disallowComments:!0,allowTrailingComma:!1,allowEmptyContent:!0});let p=new Set,h=[];for(let g of c){if(p.has(g.offset))continue;p.add(g.offset),h.push({from:g.offset,to:g.offset+Math.max(g.length,1),message:l(g.error),severity:"error"})}return h}async function qu(t){let{parseDocument:r}=await import("./index-h6jxmkxk.js"),l=r(t,{prettyErrors:!1}),c=l.errors.map((p)=>({from:p.pos[0],to:Math.max(p.pos[1],p.pos[0]+1),message:p.message,severity:"error"}));for(let p of l.warnings)c.push({from:p.pos[0],to:Math.max(p.pos[1],p.pos[0]+1),message:p.message,severity:"warning"});return c}async function Gu(t){let{parse:r,TomlError:l}=await import("./index-vnvrzwht.js");try{return r(t),[]}catch(c){if(!(c instanceof l))throw c;let p=gr(t,c.line-1)+Math.max(c.column-1,0);return[{from:p,to:p+1,message:c.message.split(`
|
|
3
|
+
`)[0],severity:"error"}]}}var Ju={json:zu,yaml:qu,toml:Gu};async function Ns(t,r){return Ju[t](r)}var Xu=2097152,Yu=600;async function Zu(t,r){let l=Pr(t);if(!l||r.length>Xu)return[];if(ws(r))return[];return(await Ns(l,r)).map((p)=>({from:Math.max(0,Math.min(p.from,r.length)),to:Math.max(0,Math.min(p.to,r.length)),severity:p.severity,message:p.message}))}function Ws(t){if(!Pr(t))return[];return[Ts((l)=>Zu(t,l.state.doc.toString()),{delay:Yu}),Fs()]}function hn(t){return[ds.of(t),ue.tabSize.of(t==="\t"?1:t.length)]}function gn(t){return t?I.lineWrapping:[]}function xn(t){return t?[ue.readOnly.of(!0),I.editable.of(!1)]:[]}function Qu(t){let r=vi(t);if("line"in r)return{line:r.line};return{block:{open:r.block[0],close:r.block[1]}}}function Us({language:t,wordWrapCompartment:r,readOnlyCompartment:l,themeCompartment:c,languageCompartment:p,indentCompartment:h,typingCompartment:g,wordWrap:y,readOnly:x,themes:w,typing:v,indentUnitText:C,blame:R,blameCompartment:O,onCommand:P,onDocChange:N,onState:V,onCaret:A,placeholder:L}){return[Jm(),Ah(),kh(),Eo(),gh(),fh(),us,No(),ph(),mh(),bh(),yh(),ue.allowMultipleSelections.of(!0),h.of(hn(C)),p.of([]),ue.languageData.of(()=>[{commentTokens:Qu(t)}]),...Ri(t),Di(t),g.of(sn(v)),...Ws(t),ks(),hs,pd(),af,sf,dd(),dl({placeholderDOM:of}),c.of(pl(t,w)),rf(),O.of(R??[]),r.of(gn(y)),l.of(xn(x)),I.contentAttributes.of({spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no"}),I.updateListener.of((F)=>{if(F.docChanged||F.selectionSet)V(F.state);if(F.docChanged)N(F.state.doc.toString());if(F.docChanged||F.selectionSet){let U=F.state.selection.main,z=F.state.doc.lineAt(U.from),Z=F.view.contentDOM.dataset;Z.selection=`${U.from},${U.to}`,Z.line=String(z.number),A?.({line:z.number,column:U.from-z.from+1})}}),xs(P,x),L?hh(L):[],I.exceptionSink.of((F)=>vA(F))]}function _s(t,r,l){let c=[],p=t.length,h=0;for(let g of t)h+=r(g);for(let g of t){if(p<=1)break;if(p<=12&&h<=8388608)break;if(g===l)continue;c.push(g),p-=1,h-=r(g)}return c}function ed(t,r){return t!==void 0&&t.light===r.light&&t.dark===r.dark}function Hs(t){let r=new Map,l={wordWrap:t.wordWrap,readOnly:t.readOnly,blame:t.blame??null,themes:t.themes,indentUnitText:t.indentUnitText,typing:t.typing,placeholder:t.placeholder},c=new yn,p=new yn,h=new yn,g=new yn,y=new yn,x=new yn,w=new yn,v=new Map,C=new Map,R=new Map,O=new Map,P=(A)=>Us({language:A,wordWrapCompartment:c,readOnlyCompartment:h,themeCompartment:x,languageCompartment:w,indentCompartment:g,typingCompartment:y,blameCompartment:p,blame:l.blame??null,onCommand:t.onCommand,onDocChange:t.onDocChange,onState:t.onState,onCaret:t.onCaret,...l}),N=(A,L)=>{r.delete(A),r.set(A,L)},V=(A)=>{let L=_s([...r.keys()],(F)=>r.get(F)?.doc.length??0,A);for(let F of L)r.delete(F)};return{stateFor(A,L,F){let U=r.get(A);if(U)return N(A,U),U;let z=ue.create({doc:F,extensions:P(L)});return r.set(A,z),v.set(A,L),C.set(A,l.themes),R.set(A,l.indentUnitText),O.set(A,l.blame??null),V(A),z},remember(A,L){N(A,L)},drop(A){r.delete(A),v.delete(A),C.delete(A),R.delete(A),O.delete(A)},optionsEffects(A,L){let F=A.wordWrap!==l.wordWrap,U=A.readOnly!==l.readOnly,z=A.blame??null,Z=z!==l.blame,q=A.indentUnitText!==l.indentUnitText,K=A.typing.autoCloseBrackets!==l.typing.autoCloseBrackets||A.typing.autocomplete!==l.typing.autocomplete,G=A.themes.light!==l.themes.light||A.themes.dark!==l.themes.dark;l.wordWrap=A.wordWrap,l.readOnly=A.readOnly,l.blame=z,l.themes=A.themes,l.indentUnitText=A.indentUnitText,l.typing=A.typing;let ne=[];if(F)ne.push(c.reconfigure(gn(l.wordWrap)));if(Z){if(ne.push(p.reconfigure(l.blame??[])),L)O.set(L,l.blame??null)}if(U)ne.push(h.reconfigure(xn(l.readOnly)));if(q){if(ne.push(g.reconfigure(hn(l.indentUnitText))),L)R.set(L,l.indentUnitText)}if(K)ne.push(y.reconfigure(sn(l.typing)));let H=L?v.get(L):void 0;if(G&&H){if(ne.push(x.reconfigure(pl(H,l.themes))),L)C.set(L,l.themes)}return ne},currentEffects(A){let L=[c.reconfigure(gn(l.wordWrap)),h.reconfigure(xn(l.readOnly))],F=l.blame??null;if(A&&O.get(A)!==F)L.push(p.reconfigure(F??[])),O.set(A,F);let U=A?v.get(A):void 0;if(A&&R.get(A)!==l.indentUnitText)L.push(g.reconfigure(hn(l.indentUnitText))),R.set(A,l.indentUnitText);if(A&&U&&!ed(C.get(A),l.themes))L.push(x.reconfigure(pl(U,l.themes))),C.set(A,l.themes);return L},languageEffects(A,L){if(!r.has(A))return[];return[w.reconfigure(L)]}}}function zs({view:t,onCommand:r}){return{getSelection:()=>{let l=t.current;if(!l)return null;let c=l.state.selection.main;return{start:c.from,end:c.to}},select:(l,c,p=!0)=>{let h=t.current;if(!h)return;if(h.dispatch({selection:{anchor:l,head:c},scrollIntoView:!1}),p)h.focus()},applyDocument:(l,c,p)=>{let h=t.current;if(!h)return;h.dispatch({changes:{from:0,to:h.state.doc.length,insert:l},selection:{anchor:c,head:p}})},runCommand:(l)=>{let c=t.current;if(!c)return;Mr(l,c,r.current)},revealOffset:(l)=>{let c=t.current;if(!c)return;let p=Math.max(0,Math.min(l,c.state.doc.length));Ym(c.scrollDOM),c.dispatch({effects:I.scrollIntoView(p,{y:"nearest",yMargin:24})})}}}function Br(t,r,l,c){if(r===c.current)return;if(r===t.state.doc.toString()){c.current=r;return}l.current=!0;try{t.dispatch({changes:{from:0,to:t.state.doc.length,insert:r}}),c.current=r}finally{l.current=!1}}var td={typescript:()=>import("./javascript-18thb3jp.js"),tsx:()=>import("./javascript-18thb3jp.js"),javascript:()=>import("./javascript-18thb3jp.js"),jsx:()=>import("./javascript-18thb3jp.js"),json5:()=>import("./javascript-18thb3jp.js"),json:()=>import("./javascript-18thb3jp.js"),yaml:()=>import("./yaml-qwwswzvs.js"),toml:()=>import("./toml-prjdc335.js"),ini:()=>import("./properties-qq2pcfyk.js"),properties:()=>import("./properties-qq2pcfyk.js"),hcl:()=>import("./properties-qq2pcfyk.js"),css:()=>import("./css-n2waj098.js"),less:()=>import("./css-n2waj098.js"),scss:()=>import("./css-n2waj098.js"),sass:()=>import("./sass-bm32bb5k.js"),stylus:()=>import("./stylus-xh0f7m9m.js"),xml:()=>import("./xml-f6syr877.js"),bash:()=>import("./shell-5rhwzbr3.js"),python:()=>import("./python-wbdfs2gc.js"),ruby:()=>import("./ruby-nq98w40a.js"),perl:()=>import("./perl-3t5fm1te.js"),lua:()=>import("./lua-6at2ddf6.js"),powershell:()=>import("./powershell-rrzhqtmb.js"),go:()=>import("./go-nfrqbjpq.js"),rust:()=>import("./rust-pcvgybk3.js"),c:()=>import("./clike-h8p24dc6.js"),cpp:()=>import("./clike-h8p24dc6.js"),csharp:()=>import("./clike-h8p24dc6.js"),java:()=>import("./clike-h8p24dc6.js"),kotlin:()=>import("./clike-h8p24dc6.js"),scala:()=>import("./clike-h8p24dc6.js"),dart:()=>import("./clike-h8p24dc6.js"),"objective-c":()=>import("./clike-h8p24dc6.js"),swift:()=>import("./swift-rr9wc5y7.js"),haskell:()=>import("./haskell-phxh4hcg.js"),elixir:()=>import("./erlang-1ch2hjv9.js"),erlang:()=>import("./erlang-1ch2hjv9.js"),clojure:()=>import("./clojure-w19rx1x5.js"),scheme:()=>import("./scheme-jvs3e9c8.js"),racket:()=>import("./scheme-jvs3e9c8.js"),ocaml:()=>import("./mllike-cnahv8ak.js"),r:()=>import("./r-z4m38eb1.js"),julia:()=>import("./julia-ft9kd90a.js"),sql:()=>import("./sql-wsvbkyd1.js"),dockerfile:()=>import("./dockerfile-r4k7q34y.js"),protobuf:()=>import("./protobuf-ggczeare.js"),makefile:()=>import("./cmake-qpejsvqg.js"),groovy:()=>import("./groovy-63s5pygd.js")},qs={typescript:"typescript",tsx:"typescript",javascript:"javascript",jsx:"javascript",json5:"json",json:"json",yaml:"yaml",toml:"toml",ini:"properties",properties:"properties",hcl:"properties",css:"css",less:"less",scss:"sCSS",sass:"sass",stylus:"stylus",xml:"xml",bash:"shell",python:"python",ruby:"ruby",perl:"perl",lua:"lua",powershell:"powerShell",go:"go",rust:"rust",c:"c",cpp:"cpp",csharp:"csharp",java:"java",kotlin:"kotlin",scala:"scala",dart:"dart","objective-c":"objectiveC",swift:"swift",haskell:"haskell",elixir:"erlang",erlang:"erlang",clojure:"clojure",scheme:"scheme",racket:"scheme",ocaml:"oCaml",r:"r",julia:"julia",sql:"standardSQL",dockerfile:"dockerFile",protobuf:"protobuf",makefile:"cmake",groovy:"groovy"};function js(t){return td[t]??null}var Nr=new Map,Fr=new Map,rd=new Set;function od(t){for(let r of[...rd])try{r(t)}catch{}}function Gs(t){return Nr.get(t)??null}function Js(t){let r=Nr.get(t);if(r)return Promise.resolve(r);let l=Fr.get(t);if(l)return l;let c=js(t),p=qs[t];if(!c||!p)return Promise.resolve(null);let h=(async()=>{try{let[g,y]=await Promise.all([c(),import("./index-5599dngt.js")]),x=g[p];if(!x)return null;let w=y.StreamLanguage.define(x);return Nr.set(t,w),od(t),w}catch{return null}finally{Fr.delete(t)}})();return Fr.set(t,h),h}var Gc=$s(function({value:r,onValueChange:l,language:c,wordWrap:p,documentKey:h,marks:g,currentMark:y,onCommand:x,readOnly:w=!1,themeVars:v,themes:C,indentUnitText:R=" ",typing:O=cs,blame:P=null,style:N,padding:V=16,onCaret:A,placeholder:L,scrollTestId:F,onScroller:U,className:z},Z){let q=i(null),K=i(null),G=i(""),ne=i(""),H=i(!1),X=i(r),te=i(l);te.current=l;let le=i(x);le.current=x;let ie=i(U);ie.current=U;let oe=i(A);oe.current=A;let Se=i(g??[]),ce=i(y??-1);Se.current=g??[],ce.current=y??-1;let be=C??ci,Ae=i(be);Ae.current=be;let Xe=i(R);Xe.current=R;let Ne=i(O);Ne.current=O;let Ce=i(P);Ce.current=P;let Ee=i(null);if(!Ee.current)Ee.current=Hs({wordWrap:p,readOnly:w,themes:Ae.current,indentUnitText:Xe.current,typing:Ne.current,blame:Ce.current,placeholder:L,onDocChange:(ee)=>{if(X.current=ee,H.current)return;te.current(ee)},onState:(ee)=>{let se=G.current;if(se)Ee.current?.remember(se,ee)},onCommand:(ee)=>le.current?.(ee),onCaret:(ee)=>oe.current?.(ee)});W(()=>{let ee=q.current,se=Ee.current;if(!ee||!se)return;G.current=h;let de=new I({state:se.stateFor(h,c,r),parent:ee});if(K.current=de,X.current=r,F)de.scrollDOM.dataset.testid=F;ie.current?.(de.scrollDOM);let j=de.state.doc.lineAt(de.state.selection.main.head);return oe.current?.({line:j.number,column:de.state.selection.main.head-j.from+1}),()=>{ie.current?.(null),de.destroy(),K.current=null}},[]),W(()=>{let ee=K.current,se=Ee.current;if(!ee||!se)return;if(G.current===h)return;se.remember(G.current,ee.state),G.current=h,ee.setState(se.stateFor(h,c,r)),ee.dispatch({effects:se.currentEffects(h)}),Br(ee,r,H,X);let de=ee.state.doc.lineAt(ee.state.selection.main.head);oe.current?.({line:de.number,column:ee.state.selection.main.head-de.from+1}),ne.current="",ee.dispatch({effects:ln.of({marks:Se.current,current:ce.current})})},[h]),W(()=>{let ee=K.current;if(!ee||G.current!==h)return;Br(ee,r,H,X)},[r,h]),W(()=>{let ee=K.current,se=Ee.current;if(!ee||!se)return;let de=se.optionsEffects({wordWrap:p,readOnly:w,themes:be,indentUnitText:R,typing:O,blame:P},G.current);if(de.length>0)ee.dispatch({effects:de})},[p,w,be.light,be.dark,R,O,P]),W(()=>{let ee=K.current,se=Ee.current;if(!ee||!se)return;let de=!1,j=(fe)=>{if(de||!fe)return;let ve=K.current;if(!ve)return;let Ie=se.languageEffects(G.current,fe);if(Ie.length>0)ve.dispatch({effects:Ie})},Q=Gs(c);if(Q)return j(Q),()=>{de=!0};return Js(c).then(j),()=>{de=!0}},[c,h]),W(()=>{let ee=K.current;if(!ee)return;let se=g??[],de=`${y??-1}:${se.map((j)=>`${j.start}-${j.end}`).join(",")}`;if(de===ne.current)return;ne.current=de,ee.dispatch({effects:ln.of({marks:se,current:y??-1})})},[g,y]),Ao(Z,()=>zs({view:K,onCommand:le}),[]);let Ze={...v,...N,"--surface-pad":`${V}px`};return e("div",{ref:q,className:z,style:Ze,"data-code-surface":""})});var ot="flex items-center justify-center p-1 rounded transition-colors cursor-pointer disabled:cursor-default disabled:opacity-40";function Xs({active:t,title:r,onToggle:l,children:c}){return e("button",{type:"button",onClick:l,className:`${ot} ${t?"bg-ink/10 text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,title:r,"aria-label":r,"aria-pressed":t,children:c})}function jc({find:t}){let r=i(null),l=wt();o(()=>{r.current?.focus(),r.current?.select()},[t.focusRequest]);let c=t.matches.length,p=t.invalid?"Invalid pattern":c===0?t.query?"No results":"":`${t.currentIndex+1} of ${c}${t.truncated?"+":""}`,h=(x)=>{if(x.key==="Enter"&&!x.metaKey&&!x.ctrlKey&&!x.altKey)x.preventDefault(),t.step(x.shiftKey?-1:1)},g=(x,w)=>{let v=fi.find((C)=>C.command===x);return v?`${w} (${pc(v,l)})`:w},y=(x,w,v,C)=>e(Xs,{active:t.options[x],title:g(v,w),onToggle:()=>t.toggleOption(x),children:C});return e("div",{className:"absolute top-2 right-2 z-30 flex w-[330px] max-w-[calc(100%-1rem)] min-w-0 flex-col gap-1 bg-paper border border-ink/15 rounded-md shadow-lg p-1.5 text-xs text-ink font-sans",children:[e("div",{className:"flex items-center gap-1",children:[e("button",{type:"button",onClick:t.toggleReplace,className:`${ot} ${t.replaceOpen?"text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,title:t.replaceOpen?"Hide replace":"Show replace","aria-label":t.replaceOpen?"Hide replace":"Show replace","aria-pressed":t.replaceOpen,children:t.replaceOpen?e(nt,{size:13}):e(B,{size:13})}),e("input",{ref:r,type:"text",value:t.query,onInput:(x)=>t.setQuery(x.currentTarget.value),onKeyDown:h,placeholder:"Find","aria-label":"Find",className:`flex-1 min-w-0 bg-canvas border rounded px-2 py-1 font-mono text-xs focus:outline-none ${t.invalid?"border-error text-error":"border-ink/20 focus:border-ink text-ink"}`}),y("matchCase","Match case","toggleCaseSensitive",e($i,{size:13})),y("wholeWord","Match whole word","toggleWholeWord",e(Wi,{size:13})),y("isRegex","Use regular expression","toggleRegex",e(Gi,{size:13})),e(Xs,{active:t.options.inSelection,title:t.options.inSelection?"Searching the selection only":"Search the selection only",onToggle:()=>t.toggleOption("inSelection"),children:e($r,{size:13})}),e("span",{className:`font-mono text-[10px] whitespace-nowrap min-w-[52px] text-right ${t.invalid?"text-error":"text-ink/50"}`,"aria-live":"polite",children:p}),e("button",{type:"button",onClick:()=>t.step(-1),disabled:c===0,className:`${ot} text-ink/50 hover:text-ink hover:bg-ink/5`,title:g("previousMatch","Previous match"),"aria-label":"Previous match",children:e(Oi,{size:13})}),e("button",{type:"button",onClick:()=>t.step(1),disabled:c===0,className:`${ot} text-ink/50 hover:text-ink hover:bg-ink/5`,title:g("nextMatch","Next match"),"aria-label":"Next match",children:e(qr,{size:13})}),e("button",{type:"button",onClick:t.close,className:`${ot} text-ink/50 hover:text-ink hover:bg-ink/5`,title:"Close find (Escape)","aria-label":"Close find",children:e(b,{size:13})})]}),t.history.length>0&&e("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar",children:[e("span",{className:"text-[10px] uppercase tracking-wide text-ink/40 flex-shrink-0",children:"Recent"}),t.history.slice(0,6).map((x)=>e("button",{type:"button",onClick:()=>t.useHistoryEntry(x),title:`Find ${x}`,className:"px-1.5 py-0.5 rounded border border-ink/15 font-mono text-[10px] text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer whitespace-nowrap flex-shrink-0",children:x},x))]}),t.replaceOpen&&e("div",{className:"flex items-center gap-1",children:[e("span",{className:"w-[22px]","aria-hidden":"true"}),e("input",{type:"text",value:t.replacement,onInput:(x)=>t.setReplacement(x.currentTarget.value),onKeyDown:h,placeholder:"Replace","aria-label":"Replace",className:"flex-1 min-w-0 bg-canvas border border-ink/20 rounded px-2 py-1 font-mono text-xs text-ink focus:outline-none focus:border-ink"}),e("button",{type:"button",onClick:t.replaceCurrent,disabled:c===0,className:`${ot} text-ink/50 hover:text-ink hover:bg-ink/5`,title:g("replaceOne","Replace"),"aria-label":"Replace",children:e(qi,{size:13})}),e("button",{type:"button",onClick:t.replaceAll,disabled:c===0,className:`${ot} text-ink/50 hover:text-ink hover:bg-ink/5`,title:g("replaceAll","Replace all"),"aria-label":"Replace all",children:e(ji,{size:13})})]})]})}var id=12;function qc({path:t,scroller:r,preview:l}){let c=Ue(bA,hA);o(()=>{if(!c||!t||c.path!==t)return;if(!l||!r)return;let p=[...r.querySelectorAll("h1, h2, h3, h4, h5, h6")],h=yA(p.map((x)=>x.textContent??""),c),g=p[h];if(!g)return;Ym(r);let y=g.getBoundingClientRect().top-r.getBoundingClientRect().top;r.scrollTop+=y-id,Zi(null)})}var ad={docx:!0},ud={xls:!0,xlsx:!0,xlsm:!0},fd={csv:!0,tsv:!0},md={md:!0,markdown:!0,mdx:!0},hd={drawio:!0,dio:!0},vd={image:!0,pdf:!0,docx:!0,spreadsheet:!0,code:void 0,markdown:void 0,svg:void 0,csv:void 0,drawio:void 0},ms={markdown:!0,svg:!0,csv:!0,drawio:!0,code:void 0,image:void 0,pdf:void 0,docx:void 0,spreadsheet:void 0},Uo={code:"Text",markdown:"Markdown",svg:"SVG",csv:"CSV",image:"Image",pdf:"PDF",docx:"Document",spreadsheet:"Spreadsheet",drawio:"Diagram"};function fs(t){let r=Vs(t);if(!r)return"code";if(r==="svg")return"svg";if(hd[r])return"drawio";if(md[r])return"markdown";if(Yi(t))return"image";if(r==="pdf")return"pdf";if(ad[r])return"docx";if(ud[r])return"spreadsheet";if(fd[r])return"csv";return"code"}var Ys=0.1,gd=16,vn=1.4,xd=0.0015,Zs=48;function kd({measureKey:t,caption:r,overlay:l,className:c="",children:p}){let h=i(null),g=i(null),y=i(null),[x,w]=n(null),[v,C]=n(1),[R,O]=n({x:0,y:0}),[P,N]=n(!1),V=i(!1),A=a(()=>{let H=g.current;if(!H)return;let{offsetWidth:X,offsetHeight:te}=H;if(X<=0||te<=0)return;w((le)=>le&&le.width===X&&le.height===te?le:{width:X,height:te})},[]);W(()=>{V.current=!1,A()},[A,t]),o(()=>{if(typeof ResizeObserver>"u")return;let H=g.current;if(!H)return;let X=new ResizeObserver(A);return X.observe(H),()=>X.disconnect()},[A]);let L=a(()=>{let H=h.current?.getBoundingClientRect();if(!H||!x)return;let X=Math.min(1,(H.width-Zs)/x.width,(H.height-Zs)/x.height);C(Math.max(Ys,X)),O({x:0,y:0}),V.current=!1},[x]);o(()=>{if(x)L()},[x,L]);let F=a((H)=>{V.current=!0,C((X)=>Math.min(gd,Math.max(Ys,X*H)))},[]);o(()=>{if(typeof ResizeObserver>"u")return;let H=h.current;if(!H)return;let X=new ResizeObserver(()=>{if(!V.current)L()});return X.observe(H),()=>X.disconnect()},[L]);let U=a((H)=>{H.preventDefault(),F(Math.exp(-H.deltaY*xd))},[F]),z=a((H)=>{if(H.button!==0||!x)return;V.current=!0,y.current={pointerId:H.pointerId,x:H.clientX,y:H.clientY},H.currentTarget.setPointerCapture(H.pointerId),N(!0)},[x]),Z=a((H)=>{let X=y.current;if(!X||X.pointerId!==H.pointerId)return;let te=H.clientX-X.x,le=H.clientY-X.y;X.x=H.clientX,X.y=H.clientY,O((ie)=>({x:ie.x+te,y:ie.y+le}))},[]),q=a((H)=>{if(y.current?.pointerId!==H.pointerId)return;y.current=null,N(!1)},[]),K=a(()=>{if(Math.abs(v-1)<0.01)L();else C(1),O({x:0,y:0})},[v,L]);o(()=>{let H=(X)=>{if(X.key!=="+"&&X.key!=="="&&X.key!=="-"&&X.key!=="_"&&X.key!=="0")return;let te=X.target;if(!te||!h.current?.contains(te))return;if(X.preventDefault(),X.key==="0")L();else if(X.key==="+"||X.key==="=")F(vn);else F(1/vn)};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[F,L]);let G=Math.round(v*100),ne=x?`${x.width} × ${x.height} px`:"";return e("div",{className:`relative flex h-full w-full flex-col bg-paper ${c}`,children:[e("div",{ref:h,tabIndex:-1,onWheel:U,onPointerDown:z,onPointerMove:Z,onPointerUp:q,onPointerCancel:q,onDblClick:K,className:`relative flex-1 overflow-hidden outline-none ${P?"cursor-grabbing":"cursor-grab"}`,children:[e("div",{className:"absolute inset-0 flex items-center justify-center",children:e("div",{ref:g,className:"shrink-0",style:{transform:`translate3d(${R.x}px, ${R.y}px, 0) scale(${v})`,visibility:x?"visible":"hidden"},children:p})}),l]}),e("div",{className:"flex flex-shrink-0 items-center justify-between border-t border-ink/10 bg-canvas px-3 py-1.5 font-mono text-[10px] text-ink/50",children:[e("span",{children:r??ne}),e("div",{className:"flex items-center gap-3",children:[e("button",{type:"button",onClick:()=>F(1/vn),className:"hover:text-ink",title:"Zoom out (-)",children:"−"}),e("span",{className:"w-10 text-center tabular-nums",children:[G,"%"]}),e("button",{type:"button",onClick:()=>F(vn),className:"hover:text-ink",title:"Zoom in (+)",children:"+"}),e("button",{type:"button",onClick:L,className:"hover:text-ink",title:"Fit to view (0)",children:"Fit"})]})]})]})}function wd({src:t,name:r,className:l=""}){let c=i(null),[p,h]=n(null),[g,y]=n(null),x=a(()=>{let w=c.current;if(!w||!w.complete||w.naturalWidth===0)return!1;return h({width:w.naturalWidth,height:w.naturalHeight}),!0},[]);if(o(()=>{x()},[x]),g)return e("div",{className:`flex h-full w-full flex-col items-center justify-center gap-2 px-6 text-center bg-paper ${l}`,children:[e(_,{size:20,className:"text-error"}),e("span",{className:"font-sans text-xs text-error",children:["Could not read ",r]}),e("span",{className:"break-all font-mono text-[11px] text-ink/50",children:g})]});return e(kd,{className:l,measureKey:p,caption:p?`${p.width} × ${p.height} px`:"",overlay:p?null:e("div",{className:"absolute inset-0 flex items-center justify-center gap-2 text-xs text-ink/40",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Loading image…"})]}),children:e("img",{ref:c,src:t,alt:r,draggable:!1,onLoad:x,onError:()=>y("The file could not be decoded as an image."),className:"image-canvas max-h-none max-w-none select-none",style:{visibility:p?"visible":"hidden"}})})}function Ai(t){return e(wd,{...t},t.src)}var Sd=Le(()=>import("./PdfView-afd5cg54.js").then((t)=>({default:t.PdfView}))),Cd=Le(()=>import("./DocxView-j9sphgra.js").then((t)=>({default:t.DocxView}))),Ed=Le(()=>import("./SheetView-gfzgxb4r.js").then((t)=>({default:t.SheetView}))),Md=Le(()=>import("./CsvGrid-8gdp5b49.js").then((t)=>({default:t.CsvGrid}))),Rd=Le(()=>import("./SvgPreview-225pkb99.js").then((t)=>({default:t.SvgPreview}))),Dd=Le(()=>import("./ImageView-ve9hc519.js").then((t)=>({default:t.ImageView}))),Td=Le(()=>import("./DrawioView-xsgjc7d8.js").then((t)=>({default:t.DrawioView})));function Wc(t){return t==="image"||t==="pdf"||t==="docx"||t==="spreadsheet"||t==="csv"||t==="svg"||t==="drawio"}function it(){return e("div",{className:"flex flex-1 items-center justify-center gap-2 text-xs text-ink/40",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Loading…"})]})}function gl({kind:t,path:r,name:l,source:c,content:p,revision:h,onContentChange:g,onSaveBytes:y,onDirtyChange:x}){if(t==="image")return e(Ve,{fallback:e(it,{}),children:e(Dd,{source:c,name:l,revision:h})});if(t==="pdf")return e(Ve,{fallback:e(it,{}),children:e(Sd,{source:c,name:l,revision:h})});if(t==="docx")return e(Ve,{fallback:e(it,{}),children:e(Cd,{source:c,name:l,revision:h})});if(t==="spreadsheet")return e(Ve,{fallback:e(it,{}),children:e(Ed,{source:c,name:l,path:r,revision:h,onSaveBytes:y,onDirtyChange:x})});if(t==="csv")return e(Ve,{fallback:e(it,{}),children:e(Md,{content:p,path:r,onChange:g})});if(t==="svg")return e(Ve,{fallback:e(it,{}),children:e(Rd,{content:p,name:l})});if(t==="drawio")return e(Ve,{fallback:e(it,{}),children:e(Td,{content:p,name:l})});return null}function Al(t){if(!t.path)return!1;if(t.content!==void 0)return!1;if(t.handleId||t.deviceFile)return!1;return!t.isDiff}function Vr(t){return`${t.root??""}\x00${t.repo??"."}\x00${t.path??""}`}async function Ad(t){let r=new URLSearchParams({path:t.path??""});if(t.root)r.set("root",t.root);if(t.repo&&t.repo!==".")r.set("repo",t.repo);try{let l=await fetch(`/api/fs/exists?${r.toString()}`),c=await l.json().catch(()=>null);if(!l.ok||!c||typeof c.exists!=="boolean")return!0;return c.exists}catch{return!0}}function Kc(t,r){let[l,c]=n(()=>new Set),[p,h]=n(0),g=t.map((w)=>`${w.id}\x01${Vr(w)}`).join(`
|
|
4
|
+
`),y=i(t);y.current=t;let x=i(new Set);return o(()=>{let w=!1;return(async()=>{let v=new Map;for(let N of y.current)if(Al(N))v.set(Vr(N),N);let C=await Promise.all([...v.entries()].map(async([N,V])=>({key:N,exists:await Ad(V)})));if(w)return;let R=new Set;for(let{key:N,exists:V}of C)if(!V)R.add(N);let O=new Set;for(let N of y.current)if(Al(N)&&R.has(Vr(N)))O.add(N.id);let P=x.current;if(P.size===O.size&&[...O].every((N)=>P.has(N)))return;x.current=O,c(O)})(),()=>{w=!0}},[g,r,p]),o(()=>{let w=()=>h((v)=>v+1);return window.addEventListener("focus",w),document.addEventListener("visibilitychange",w),()=>{window.removeEventListener("focus",w),document.removeEventListener("visibilitychange",w)}},[]),l}async function Vc(t,r,l){if(t.handleId){let p=await uf(t.handleId,r,{interactive:l.interactive});if(p==="written")return{status:"written",mtimeMs:null};if(p==="needs-permission")return{status:"needs-permission"};return{status:"failed",error:"The browser refused the write."}}if(!t.path)return{status:"failed",error:"This file has no path to write to."};let c=new FormData;if(c.append("actionType","saveBytes"),c.append("path",t.path),c.append("bytes",new Blob([r])),t.root)c.append("root",t.root);if(t.repo&&t.repo!==".")c.append("repo",t.repo);if(typeof l.baseMtimeMs==="number")c.append("baseMtime",String(l.baseMtimeMs));try{let p=await fetch("/api/fs/action",{method:"POST",body:c}),h=await p.json().catch(()=>null);if(p.status===409)return{status:"conflict",diskMtimeMs:typeof h?.mtimeMs==="number"?h.mtimeMs:null};if(p.ok&&h?.success)return{status:"written",mtimeMs:typeof h.mtimeMs==="number"?h.mtimeMs:null};return{status:"failed",error:typeof h?.error==="string"?h.error:null}}catch{return{status:"failed",error:null}}}var Ld={id:"",url:null,loadBytes:null,mimeType:null};async function Wr(t){let r=await t.json().catch(()=>null);return typeof r?.error==="string"&&r.error?r.error:`Could not read the file (HTTP ${t.status}).`}function Qs(t){let r=uA(t.path);if(t.rawUrl){let p=t.rawUrl;return{id:p,url:p,mimeType:r,loadBytes:async()=>{let h=await fetch(p);if(!h.ok)throw Error(await Wr(h));return h.arrayBuffer()}}}let l=ff(t.handleId);if(l){let{bytes:p}=l;return{id:t.handleId,url:null,mimeType:l.mimeType??r,loadBytes:async()=>p.slice().buffer}}let c=ml(t.handleId);if(c)return{id:t.handleId,url:null,mimeType:r,loadBytes:async()=>(await c.getFile()).arrayBuffer()};return Ld}function el(t,r){let l=t?fs(t.path??""):"code",c=vd[l]===!0,p=Boolean(t?.path)&&!t?.handleId,h=p&&t?.content===void 0&&Yi(t?.path)?t.path:null,g=h!==null,y=t&&!g&&c&&p&&t.content===void 0?Ks({path:t.path,root:t.root,repo:t.repo}):null,x=Qs({path:t?.path,handleId:t?.handleId,rawUrl:h?`${Ks({path:h,root:t?.root,repo:t?.repo})}&v=${r}`:y});return{viewerKind:l,isBinaryViewer:c,isImage:g,imageUrl:g?x.url:null,byteSource:x}}function tl(t){let r=t.indexOf(`
|
|
5
|
+
`);return r>0&&t[r-1]==="\r"?"crlf":"lf"}function Rt(t){return t.includes("\r")?t.replace(/\r\n?/g,`
|
|
6
|
+
`):t}function nl(t,r){let l=Rt(t);return r==="crlf"?l.replace(/\n/g,`\r
|
|
7
|
+
`):l}function rl(t){return String(t.id??t.path??t.name)}function ol({target:t,key:r,isBinaryViewer:l,revision:c,loadedRef:p,contentsRef:h,baselinesRef:g,pendingRef:y,readingRef:x,remember:w}){let[v,C]=n(!1),[R,O]=n(!1),[P,N]=n(null),[V,A]=n(null);return o(()=>{if(O(!1),!t)return;let L=rl(t);if(p.current.has(L))return;if(p.current.add(L),l){N(null),A(null),C(!1);return}if(t.content!==void 0){w(L,t.content,null,null),N(null),A(null);return}if(!t.path){N("No file path supplied for this attachment."),A(null);return}let F=h.current[L]===void 0,U=!1;if(F)C(!0);N(null),A(null);let z=new URLSearchParams({path:t.path});if(t.root)z.set("root",t.root);if(t.repo&&t.repo!==".")z.set("repo",t.repo);return x.current+=1,O(!0),fetch(`/api/fs/read?${z.toString()}`).then(async(Z)=>{let q=await Z.json().catch(()=>null);if(!Z.ok||!q||typeof q.content!=="string"){let K=Error(q?.error||`HTTP ${Z.status}`);if(q?.kind)K.kind=q.kind;else if(Z.status===415)K.kind="binary";throw K}return{text:q.content,mtimeMs:typeof q.mtimeMs==="number"?q.mtimeMs:null,hash:typeof q.hash==="string"?q.hash:null}}).then(({text:Z,mtimeMs:q,hash:K})=>{if(U)return;let G=h.current[L];if(G!==void 0&&G!==g.current[L])return;let ne=y.current;if(ne&&rl(ne.file)===L)return;w(L,Z,q,K)}).catch((Z)=>{if(U)return;if(!F)return;w(L,"",null,null);let q=Z instanceof Error?Z.message:"Failed to read file",K=Z?.kind;A(K?q:null),N(q)}).finally(()=>{if(x.current-=1,!U)C(!1),O(!1)}),()=>{U=!0}},[r,t,w,c,l,p,h,g,y,x]),{isLoading:v,isReading:R&&!v,loadError:P,unsupported:V}}async function il(t,r){let l=await fetch(t);if(!l.ok)throw Error(`HTTP ${l.status}`);nd(await l.blob(),r)}async function sl(t){let r=await fetch(t);if(!r.ok)throw Error(`HTTP ${r.status}`);let l=await r.blob();if(typeof ClipboardItem>"u"||!navigator.clipboard?.write)throw Error("Image clipboard unavailable");await navigator.clipboard.write([new ClipboardItem({[l.type]:l})])}function al({target:t,content:r,downloadContent:l,imageUrl:c,downloadMimeType:p,byteSource:h,byteViewer:g=!1}){let[y,x]=n(!1),w=a(()=>{x(!0),window.setTimeout(()=>x(!1),1500)},[]),v=a(()=>{if(!t)return;if(c){sl(c).then(w).catch(()=>{});return}if(g)return;if(!navigator.clipboard)return;navigator.clipboard.writeText(r).then(w).catch(()=>{})},[t,r,c,g,w]),C=a(()=>{if(!t)return;if(c){il(c,t.name).catch(()=>{});return}if(g){let R=h?.loadBytes;if(!R)return;let O=h?.mimeType;R().then((P)=>nd(O?new Blob([P],{type:O}):new Blob([P]),t.name)).catch(()=>{});return}nd(new Blob([l],{type:p}),t.name)},[t,l,p,c,g,h]);return{copied:y,copy:v,download:C}}async function fl(t){let r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return Array.from(new Uint8Array(r),(l)=>l.toString(16).padStart(2,"0")).join("")}async function hl(t,r,l,c){if(t.handleId){let h=l==="crlf"?r.replace(/\n/g,`\r
|
|
8
|
+
`):r,g=await uf(t.handleId,h,{interactive:c.interactive});if(g==="written")return{status:"written",written:{mtimeMs:null,hash:await fl(h)}};if(g==="needs-permission")return{status:"needs-permission"};return{status:"failed"}}if(!t.path)return{status:"failed"};let p=new FormData;if(p.append("actionType","save"),p.append("path",t.path),p.append("content",r),p.append("eol",l),t.root)p.append("root",t.root);if(t.repo&&t.repo!==".")p.append("repo",t.repo);if(typeof c.baseMtimeMs==="number")p.append("baseMtime",String(c.baseMtimeMs));try{let h=await fetch("/api/fs/action",{method:"POST",body:p}),g=await h.json().catch(()=>null);if(h.status===409)return{status:"conflict",diskMtimeMs:typeof g?.mtimeMs==="number"?g.mtimeMs:null};if(h.ok&&g?.success)return{status:"written",written:{mtimeMs:typeof g.mtimeMs==="number"?g.mtimeMs:null,hash:typeof g.hash==="string"?g.hash:null}};return{status:"failed"}}catch{return{status:"failed"}}}function yt(t,r){let l={},c=!1;for(let[p,h]of Object.entries(t))if(r.has(p))l[p]=h;else c=!0;return c?l:t}function kn(t){return String(t.id??t.path??t.name)}function bl({target:t,isBinaryViewer:r,loadError:l,missing:c,contentsRef:p,lineEndingsRef:h,mtimesRef:g,pendingRef:y,flushOnUnmount:x,onSaveStart:w,onSaved:v,onSaveFailed:C,onNeedsPermission:R,onConflict:O}){let[P,N]=n(!1),V=i(c);V.current=c;let A=t?kn(t):"",L=a(async(K,G,ne={})=>{if(!K.path&&!K.handleId)return;if(K.handleId&&!ml(K.handleId))return;if(V.current&&!ne.allowMissing)return;w();let H=kn(K),X=ne.allowMissing?null:g.current[H]??null,te=await hl(K,G,h.current[H]??"lf",{interactive:ne.interactive===!0,baseMtimeMs:X});if(te.status==="written")v(H,G,te.written);else if(te.status==="needs-permission")R();else if(te.status==="conflict")O(H,te.diskMtimeMs);else C()},[h,g,O,R,C,w,v]),F=i(L);F.current=L;let U=a((K)=>{if(!t||r)return;if(!t.path)return;if(V.current)return;if(y.current)window.clearTimeout(y.current.timer);let G=window.setTimeout(()=>{y.current=null,F.current(t,K)},800);y.current={timer:G,file:t,content:K}},[t,r,y]),z=a(()=>{if(!t||r)return;if(l)return;if(t.handleId&&!ml(t.handleId))return;let K=p.current[kn(t)];if(K===void 0)return;if(y.current)window.clearTimeout(y.current.timer),y.current=null;if(V.current){N(!0);return}F.current(t,K,{interactive:!0})},[t,p,r,l,y]),Z=a(()=>{if(N(!1),!t||r||l)return;let K=p.current[kn(t)];if(K===void 0)return;F.current(t,K,{allowMissing:!0,interactive:!0})},[t,p,r,l]),q=a(()=>N(!1),[]);return o(()=>{if(!x)return;return()=>{let K=y.current;if(!K)return;if(window.clearTimeout(K.timer),y.current=null,V.current)return;F.current(K.file,K.content)}},[x,y]),o(()=>{if(!c)N(!1)},[c,A]),{onChange:U,saveNow:z,saveMissingConfirm:P,confirmSaveMissing:Z,cancelSaveMissing:q}}function yl({key:t,saveNow:r,mtimesRef:l,setMtimes:c,contentsRef:p,setContents:h,setBaselines:g,loadedRef:y,bumpRevision:x}){let[w,v]=n({}),C=a((A)=>{v((L)=>{if(L[A]===void 0)return L;let F={...L};return delete F[A],F})},[]),R=a((A,L)=>{v((F)=>({...F,[A]:{diskMtimeMs:L}}))},[]),O=a((A,L)=>{l.current={...l.current,[A]:L},c(l.current)},[l,c]),P=a((A)=>{if(!t)return;O(t,A),C(t)},[t,O,C]),N=a(()=>{if(!t)return;C(t),g((A)=>{let L={...A};return delete L[t],L}),h((A)=>{let L={...A};return delete L[t],L}),y.current.delete(t),x()},[t,C,g,h,y,x]),V=a(()=>{if(!t)return;let A=p.current[t],L=w[t]?.diskMtimeMs??null;if(C(t),A===void 0)return;if(L!==null)O(t,L);r()},[t,w,C,O,p,r]);return{conflict:w[t]??null,report:R,reload:N,keepMine:V,adopt:P,clear:C}}var Id=3000;async function Od(t,r,l){let c=new URLSearchParams({path:t});if(r)c.set("root",r);if(l&&l!==".")c.set("repo",l);try{let p=await fetch(`/api/fs/digest?${c.toString()}`),h=await p.json().catch(()=>null);if(!p.ok||!h||typeof h.exists!=="boolean")return"unknown";if(h.exists===!1)return"gone";if(typeof h.hash!=="string"||typeof h.mtimeMs!=="number")return"unknown";return{hash:h.hash,mtimeMs:h.mtimeMs}}catch{return"unknown"}}function xl({path:t,root:r=null,repo:l=null,baseHash:c,revision:p,onUnchanged:h,onChanged:g}){let y=i(h);y.current=h;let x=i(g);x.current=g,o(()=>{if(!t||c===null)return;let w=!1,v=!1,C=null,R=async()=>{if(w||v||document.hidden)return;v=!0;try{let V=await Od(t,r,l);if(w||V==="unknown"||V==="gone")return;if(V.hash===c){y.current(V.mtimeMs);return}if(C===V.hash)return;C=V.hash,x.current(V)}finally{v=!1}},O=window.setInterval(()=>void R(),Id);R();let P=()=>void R(),N=()=>{if(!document.hidden)R()};return window.addEventListener("focus",P),document.addEventListener("visibilitychange",N),()=>{w=!0,window.clearInterval(O),window.removeEventListener("focus",P),document.removeEventListener("visibilitychange",N)}},[t,r,l,c,p])}function He(t){return String(t.id??t.path??t.name)}function vl({key:t,target:r,baseHash:l,revision:c,hashesRef:p,mtimesRef:h,contentsRef:g,baselinesRef:y,pendingRef:x,readingRef:w,loadedRef:v,bumpRevision:C,adoptDiskMtime:R,clearConflict:O,reloadDiscardingEdits:P,discardPendingWrite:N}){let[V,A]=n(null),L=i(null);o(()=>{A(null),L.current=null},[t]);let F=a((q)=>{if(!t)return;if(h.current[t]!==q)R(q);A(null),L.current=null},[t,h,R]),U=a((q)=>{if(!t)return;if(p.current[t]===q.hash){A(null);return}if(L.current===q.hash)return;if(V?.hash===q.hash)return;let K=g.current[t],G=x.current;if(K!==void 0&&K!==y.current[t]||G!==null&&He(G.file)===t){A(q);return}if(w.current>0)return;v.current.delete(t),C()},[t,p,g,y,x,w,v,C,V]);xl({path:r&&Al({...r,id:t})?r.path??null:null,root:r?.root??null,repo:r?.repo??null,baseHash:l,revision:c,onUnchanged:F,onChanged:U});let z=a(()=>{if(!r)return;let q=He(r),K=g.current[q];if(K!==void 0&&K!==y.current[q]){N(q),P();return}O(q),v.current.delete(q),C()},[r,g,y,N,P,O,v,C]),Z=a(()=>{if(!V)return;L.current=V.hash,R(V.mtimeMs),A(null)},[V,R]);return{diskChange:V,reloadFromDisk:z,keepMineAgainstDisk:Z}}function kl({target:t,loadedRef:r,bumpRevision:l,setContents:c,setBaselines:p,setLineEndings:h,setMtimes:g,setHashes:y}){let x=a((R,O,P,N)=>{let V=tl(O),A=Rt(O);c((L)=>({...L,[R]:A})),p((L)=>({...L,[R]:A})),h((L)=>({...L,[R]:V})),g((L)=>({...L,[R]:P})),y((L)=>({...L,[R]:N}))},[c,p,h,g,y]),w=a(()=>{r.current.clear(),l()},[r,l]),v=a((R)=>{let O=new Set(R.map(String));for(let P of Array.from(r.current))if(!O.has(P))r.current.delete(P);c((P)=>yt(P,O)),p((P)=>yt(P,O)),h((P)=>yt(P,O)),g((P)=>yt(P,O)),y((P)=>yt(P,O))},[r,c,h,g,y]),C=a((R)=>{if(!t)return;h((O)=>({...O,[He(t)]:R}))},[t,h]);return{remember:x,reset:w,retain:v,setEol:C}}function wl({target:t,key:r,textDirty:l,contents:c,baselines:p,retain:h}){let[g,y]=n(()=>new Set),x=l||g.has(r),w=u(()=>{let R=new Set(g);for(let[O,P]of Object.entries(c)){let N=p[O];if(N!==void 0&&P!==N)R.add(O)}return R},[c,p,g]),v=a((R)=>{if(!t)return;let O=He(t);y((P)=>{if(P.has(O)===R)return P;let N=new Set(P);if(R)N.add(O);else N.delete(O);return N})},[t]),C=a((R)=>{h(R);let O=new Set(R.map(String));y((P)=>{let N=!1,V=new Set;for(let A of P)if(O.has(A))V.add(A);else N=!0;return N?V:P})},[h]);return{isDirty:x,dirtyKeys:w,setBinaryDirty:v,retain:C}}function Yc(t,r={}){let{flushOnUnmount:l=!1,reportSaveError:c=!1,downloadMimeType:p="text/plain",onFileSaved:h,missing:g=!1}=r,[y,x]=n({}),[w,v]=n({}),[C,R]=n({}),[O,P]=n({}),[N,V]=n({}),[A,L]=n("idle"),[F,U]=n(0),z=t?He(t):"",Z=t?y[z]??(t.content!==void 0?Rt(t.content):""):"",q=Z!==(w[z]??Z),{viewerKind:K,isBinaryViewer:G,isImage:ne,imageUrl:H,byteSource:X}=el(t,F),te=i(new Set),le=i(null),ie=i(0),oe=i(y);oe.current=y;let Se=i(w);Se.current=w;let ce=i(C);ce.current=C;let be=i(O);be.current=O;let Ae=i(N);Ae.current=N;let{remember:Xe,reset:Ne,retain:Ce,setEol:Ee}=kl({target:t,loadedRef:te,bumpRevision:()=>U((pe)=>pe+1),setContents:x,setBaselines:v,setLineEndings:R,setMtimes:P,setHashes:V}),{isDirty:Ze,dirtyKeys:ee,setBinaryDirty:se,retain:de}=wl({target:t,key:z,textDirty:q,contents:y,baselines:w,retain:Ce}),{isLoading:j,isReading:Q,loadError:fe,unsupported:ve}=ol({target:t,key:z,isBinaryViewer:G,revision:F,loadedRef:te,contentsRef:oe,baselinesRef:Se,pendingRef:le,readingRef:ie,remember:Xe}),Ie=bl({target:t,isBinaryViewer:G,loadError:fe,missing:g,contentsRef:oe,lineEndingsRef:ce,mtimesRef:be,pendingRef:le,flushOnUnmount:l,onSaveStart:()=>L("saving"),onSaved:(pe,Je,at)=>{if(L("saved"),v((kt)=>({...kt,[pe]:Je})),at.mtimeMs!==null)P((kt)=>({...kt,[pe]:at.mtimeMs}));if(at.hash!==null)V((kt)=>({...kt,[pe]:at.hash}));h?.()},onSaveFailed:()=>L(c?"error":"idle"),onNeedsPermission:()=>L("needs-permission"),onConflict:(pe,Je)=>{L("idle"),je.report(pe,Je)}}),vt=i(Ie);vt.current=Ie;let je=yl({key:z,saveNow:()=>vt.current.saveNow(),mtimesRef:be,setMtimes:P,contentsRef:oe,setContents:x,setBaselines:v,loadedRef:te,bumpRevision:()=>U((pe)=>pe+1)}),At=a((pe)=>{let Je=le.current;if(!Je||He(Je.file)!==pe)return;window.clearTimeout(Je.timer),le.current=null},[]),{diskChange:Cn,reloadFromDisk:Ge,keepMineAgainstDisk:Lt}=vl({key:z,target:t,baseHash:N[z]??null,revision:F,hashesRef:Ae,mtimesRef:be,contentsRef:oe,baselinesRef:Se,pendingRef:le,readingRef:ie,loadedRef:te,bumpRevision:()=>U((pe)=>pe+1),adoptDiskMtime:je.adopt,clearConflict:je.clear,reloadDiscardingEdits:je.reload,discardPendingWrite:At});o(()=>{if(A!=="saved")return;let pe=window.setTimeout(()=>L("idle"),1500);return()=>window.clearTimeout(pe)},[A]),o(()=>{L("idle")},[z]);let En=a((pe)=>{if(!t||G)return;let Je=He(t);x((at)=>({...at,[Je]:pe})),vt.current.onChange(pe)},[t,G]),{copied:st,copy:We,download:Nl}=al({target:t,content:Z,downloadContent:t?nl(Z,C[z]??"lf"):Z,imageUrl:H,downloadMimeType:p,byteSource:X,byteViewer:G});return{content:Z,onChange:En,isLoading:j,isReading:Q,loaded:t?G||t.content!==void 0||y[z]!==void 0:!1,loadError:fe,unsupported:ve,saveStatus:A,copied:st,isDirty:Ze,setBinaryDirty:se,eol:C[z]??"lf",setEol:Ee,baseMtimeMs:O[z]??null,dirtyKeys:ee,language:t?bt(t.name):"javascript",isImage:ne,imageUrl:H,viewerKind:K,byteSource:X,isBinaryViewer:G,revision:F,handleMissing:Boolean(t?.handleId)&&!t?.deviceFile&&ml(t?.handleId)===null,deviceBacked:Boolean(t?.deviceFile),deviceMissing:Boolean(t?.deviceFile)&&ff(t?.handleId)===null,saveNow:Ie.saveNow,copy:We,download:Nl,reset:Ne,retain:de,saveMissingConfirm:Ie.saveMissingConfirm,confirmSaveMissing:Ie.confirmSaveMissing,cancelSaveMissing:Ie.cancelSaveMissing,conflict:je.conflict,resolveConflictByReload:()=>{if(z)At(z);je.reload()},resolveConflictByKeepingMine:je.keepMine,reloadFromDisk:Ge,diskChange:Cn,keepMineAgainstDisk:Lt}}var Pd=20;function Sl(){let[t,r]=S("editor.findHistory",[]),l=a((c)=>{let p=c.trim();if(!p)return;r((h)=>[p,...h.filter((g)=>g!==p)].slice(0,Pd))},[r]);return{entries:t,remember:l}}function Cl(){let[t,r]=n(null),l=a((p)=>{let h=p();if(!h||h.start===h.end)return r(null),!1;return r(h),!0},[]),c=a(()=>r(null),[]);return{range:t,arm:l,disarm:c}}var El=5000,Ur={matchCase:!1,wholeWord:!1,isRegex:!1,inSelection:!1},Ml="gm"+("unicode"in RegExp.prototype?"u":"");function Sn(t,r){if(!t)return null;let l=r.isRegex?t:t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=r.wholeWord?`\\b(?:${l})\\b`:l;try{return new RegExp(c,r.matchCase?Ml:`${Ml}i`)}catch{return null}}var Rl=null,wn=null;function Bd(t){if(Rl===t&&wn)return wn;return wn=ke.of(t.split(`
|
|
9
|
+
`)),Rl=t,wn}function Dt(t,r,l,c){if(!r)return{matches:[],truncated:!1,invalid:!1};let p=Sn(r,l);if(!p)return{matches:[],truncated:!1,invalid:!0};let h=[],g;try{g=new Nt(Bd(t),p.source,{ignoreCase:!l.matchCase})}catch{return{matches:[],truncated:!1,invalid:!0}}let y=l.inSelection&&c?c:null;while(h.length<El&&!g.next().done){let{from:x,to:w}=g.value;if(x===w)continue;if(y&&(x<y.start||w>y.end))continue;h.push({start:x,end:w})}return{matches:h,truncated:h.length>=El,invalid:!1}}function xt(t,r){if(t.length===0)return-1;for(let l=0;l<t.length;l++)if(t[l].end>r)return l;return 0}function Dl(t,r,l){if(r<=0)return-1;if(t<0)return l===1?0:r-1;return(t+l+r)%r}function Fd(t){return{full:t[0],numbered:[void 0,...t.slice(1)],named:t.groups}}var Nd=/\$(\$|&|\d{1,2}|<[^>]*>)/g;function Tl(t,r){if(!t.includes("$"))return t;return t.replace(Nd,(l,c)=>{if(c==="$")return"$";if(c==="&")return r.full;if(c.startsWith("<"))return r.named?.[c.slice(1,-1)]??"";if(c.length===2){let p=r.numbered[Number(c)];if(p!==void 0)return p;let h=r.numbered[Number(c[0])];return h===void 0?"":h+c[1]}return r.numbered[Number(c)]??""})}function Vd(t,r,l,c,p){let h=Sn(l,p);if(!h)return null;h.lastIndex=r.start;let g=h.exec(t);if(!g||g.index!==r.start)return null;let y=p.isRegex?Tl(c,Fd(g)):c;return{found:g[0],inserted:y,start:g.index,end:g.index+g[0].length}}function Ll(t,r,l,c,p){let h=Vd(t,r,l,c,p);if(!h)return null;return{text:t.slice(0,h.start)+h.inserted+t.slice(h.end),caret:h.start+h.inserted.length}}function Il(t,r,l,c){let p=Sn(r,c);if(!p)return null;if(!c.isRegex)return t.replace(p,()=>l);return t.replace(p,(...h)=>{if(String(h[0]).length===0)return"";let g=h[h.length-1],y=typeof g==="object"&&g!==null,x=h.slice(1,h.length-(y?3:2));return Tl(l,{full:String(h[0]),numbered:[void 0,...x],named:y?g:void 0})})}function Wd(t,r){if(!r||r.start===r.end)return null;let l=t.slice(r.start,r.end);if(!l||l.includes(`
|
|
10
|
+
`)||l.length>200)return null;return l}function Jc({text:t,documentKey:r,readSelection:l,select:c,reveal:p,applyDocument:h,toggleWordWrap:g}){let[y,x]=S("editor.findQuery",""),[w,v]=S("editor.findReplace",""),[C,R]=S("editor.findOptions",Ur),O=u(()=>({...Ur,...C}),[C]),P=Cl(),N=Sl(),[V,A]=n(!1),[L,F]=n(!1),[U,z]=n(-1),[Z,q]=n(0),[K,G]=n(0),ne=i(!1);ne.current=V;let H=u(()=>Dt(t,y,O,O.inSelection?P.range:null),[t,y,O,P.range]),X=i(0),te=i(!0),le=i(p);le.current=p;let ie=i(c);ie.current=c;let oe=a((j)=>{X.current=j,te.current=!0},[]);o(()=>{oe(0),G((j)=>j+1)},[r,oe]),o(()=>{let j=H.matches;if(te.current){te.current=!1;let Q=xt(j,X.current);if(z(Q),Q>=0)ie.current(j[Q].start,j[Q].end,!1),le.current(j[Q].start);return}z((Q)=>{if(j.length===0)return-1;if(Q<0)return xt(j,X.current);return Math.min(Q,j.length-1)})},[H,K]);let Se=a((j)=>{x(j),oe(X.current)},[x,oe]),ce=a(()=>{if(q((fe)=>fe+1),ne.current)return;let j=l(),Q=Wd(t,j);if(Q)x(Q);oe(j?j.start:0),A(!0),G((fe)=>fe+1)},[t,l,oe,x]),be=a(()=>{F(!0),ce()},[ce]),Ae=a(()=>F((j)=>!j),[]),Xe=a(()=>{N.remember(y),A(!1),F(!1);let j=H.matches[U];if(j)c(j.start,j.end,!0)},[H.matches,U,c]),Ne=a((j)=>{let Q=H.matches;if(Q.length===0)return;let fe=Dl(U,Q.length,j);z(fe),X.current=Q[fe].end,c(Q[fe].start,Q[fe].end,!1),p(Q[fe].start)},[H.matches,U,c,p]),Ce=a((j)=>{let Q={...O,[j]:!O[j]};if(j==="inSelection"&&!P.arm(l)){R({...O,inSelection:!1});return}if(j==="inSelection"&&!Q.inSelection)P.disarm();R(Q),oe(X.current)},[O,R,oe,l,P]),Ee=a((j)=>{x(j),N.remember(j),oe(X.current),G((Q)=>Q+1)},[N,oe]),Ze=a((j)=>{let Q=gr(t,Math.max(0,j.line-1)),{matches:fe}=Dt(t,j.query,j.options),ve=xt(fe,Q);if(x(j.query),R(j.options),oe(ve>=0?fe[ve].start:Q),G((Ie)=>Ie+1),ve>=0)ie.current(fe[ve].start,fe[ve].end,!0),le.current(fe[ve].start)},[t,x,R,oe]),ee=a(()=>{let j=H.matches[U];if(!j)return;let Q=Ll(t,j,y,w,O);if(!Q)return;h(Q.text,Q.caret,Q.caret),oe(Q.caret)},[H.matches,U,t,y,w,O,h,oe]),se=a(()=>{let j=Il(t,y,w,O);if(j===null||j===t)return;let Q=Math.min(X.current,j.length);h(j,Q,Q),oe(Q)},[t,y,w,O,h,oe]),de=a((j)=>{switch(j){case"find":ce();return;case"replace":be();return;case"nextMatch":Ne(1);return;case"previousMatch":Ne(-1);return;case"replaceOne":ee();return;case"replaceAll":se();return;case"toggleCaseSensitive":Ce("matchCase");return;case"toggleWholeWord":Ce("wholeWord");return;case"toggleRegex":Ce("isRegex");return;case"toggleWordWrap":g?.();return;default:return}},[ce,be,Ne,ee,se,Ce,g]);return{open:V,replaceOpen:L,query:y,replacement:w,options:O,matches:H.matches,truncated:H.truncated,invalid:H.invalid,currentIndex:U,setQuery:Se,setReplacement:v,openFind:ce,openReplace:be,toggleReplace:Ae,focusRequest:Z,close:Xe,runCommand:de,revealMatch:Ze,toggleOption:Ce,selectionRange:O.inSelection?P.range:null,history:N.entries,useHistoryEntry:Ee,step:Ne,replaceCurrent:ee,replaceAll:se}}function Zc(t,r,l){let c=Ue(xA,kA),[p,h]=n(null);return o(()=>{if(!c||!t||c.path!==t||!l)return;h({request:c,path:t}),Vu(null)},[c,t,l]),u(()=>{if(!p||p.path!==t)return null;let{matches:g}=Dt(r,p.request.query,p.request.options),y=gr(r,Math.max(0,p.request.line-1));return{request:p.request,matches:g,currentIndex:xt(g,y)}},[p,t,r])}function Ol(t){let r=i({});o(()=>{if(!t)return;mA(r.current,Ud(t))}),o(()=>{let l=r.current;return()=>fA(l)},[])}function Ud(t){let{file:r}=t;if(!r)return{path:null,name:null,content:"",language:"text",state:"idle",note:null,preview:!1};let l={path:r.path,name:r.name,content:t.content,language:t.language,preview:t.preview&&t.viewerKind==="markdown"};if(r.isDiff)return{...l,content:"",state:"diff",note:null,preview:!1};if(t.loadError)return{...l,state:"error",note:t.loadError,preview:!1};if(t.isBinaryViewer)return{...l,content:"",state:"not-a-document",note:`${Uo[t.viewerKind]} files have no text outline.`,preview:!1};if(t.isLoading||!t.loaded)return{...l,state:"loading",note:null,preview:!1};return{...l,state:"ready",note:null}}function Pl(t,r,l){let c=Ue(AA,gA);return u(()=>{if(!c||!t||c.path!==t||!l)return null;let p=gr(r,Math.max(0,c.line-1)),h=r.indexOf(`
|
|
11
|
+
`,p),g=(h===-1?r.length:h)-p,y=Math.min(g,Math.max(0,(c.column??1)-1)),x=c.length===void 0?y:Math.min(g,y+c.length);return{path:t,offset:p,selectionStart:p+y,selectionEnd:p+x,request:c}},[c,t,l,r])}function Fl({path:t,content:r,ready:l,surfaceRef:c,isPreview:p,exitPreview:h}){let g=Pl(t,r,l),y=i(null),x=i(null);o(()=>{if(x.current!==null){let v=c.current;if(p||!v)return;let C=x.current;x.current=null,Bl(v,C);return}if(!g||y.current===g.request)return;if(p){y.current=g.request,x.current={start:g.selectionStart,end:g.selectionEnd,offset:g.offset},h();return}let w=c.current;if(!w)return;y.current=g.request,Bl(w,{start:g.selectionStart,end:g.selectionEnd,offset:g.offset})})}function Bl(t,r){t.select(r.start,r.end,!0),t.revealOffset(r.offset),Ji(null)}function Xc({file:t,editor:r,surfaceRef:l,isPreview:c,exitPreview:p,publish:h=!0}){Ol(h?{file:t,content:r.content,language:r.language,loaded:r.loaded,isLoading:r.isLoading,loadError:r.loadError,viewerKind:r.viewerKind,isBinaryViewer:r.isBinaryViewer,preview:c}:null),Fl({path:t?.path??null,content:r.content,ready:r.loaded&&!r.loadError,surfaceRef:l,isPreview:c,exitPreview:p})}function eu({fileName:t,onReload:r,onKeepMine:l}){return e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-info/30 bg-info/10 text-[11px] text-ink flex-shrink-0",role:"status","data-external-change-strip":"",children:[e(D,{size:13,className:"text-info flex-shrink-0 mt-0.5"}),e("div",{className:"min-w-0 flex-1",children:[e("div",{className:"font-medium",children:[e("span",{className:"font-mono",children:t})," changed on disk."]}),e("div",{className:"text-ink/60 mt-0.5",children:"Reload takes the disk copy and discards your edits. Keep mine writes yours over it."})]}),e("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e("button",{type:"button",onClick:r,className:"px-2 py-1 rounded border border-ink/20 hover:bg-ink/5 transition-colors cursor-pointer",title:"Take the file from disk",children:"Reload"}),e("button",{type:"button",onClick:l,className:"px-2 py-1 rounded border border-info/50 text-info hover:bg-info/10 transition-colors cursor-pointer",title:"Keep my buffer; the next save writes it",children:"Keep mine"})]})]})}function tu({fileName:t,filePath:r,onClose:l,onConfirm:c}){return o(()=>{let p=(h)=>{if(h.key!=="Escape")return;h.preventDefault(),l()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[l]),e("div",{className:"fixed inset-0 z-50 flex items-center justify-center modal-scrim animate-in fade-in duration-200 p-4",onClick:l,role:"dialog","aria-modal":"true","aria-label":"Save deleted file",children:e("div",{className:"glass-overlay bg-paper border border-ink/20 rounded-xl shadow-xl w-[min(94vw,440px)] overflow-hidden",onClick:(p)=>p.stopPropagation(),children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(Ga,{size:16,className:"text-error shrink-0"}),e("h2",{className:"text-[13px] font-semibold text-ink",children:"This file was deleted"})]}),e("div",{className:"px-4 py-4 space-y-3",children:[e("div",{className:"rounded-lg border border-ink/10 bg-canvas/50 px-3 py-2",children:[e("div",{className:"text-[12px] font-mono text-error line-through truncate",children:t}),e("div",{className:"text-[11px] font-mono text-ink/50 break-all mt-0.5",children:r})]}),e("p",{className:"text-[11.5px] leading-relaxed text-ink/60",children:"It was removed from disk while this tab was open. Saving recreates it with the buffer's current contents — anything written to that path since the deletion is lost."})]}),e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:l,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",autoFocus:!0,onClick:c,className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:"Save anyway"})]})]})})}function nu(t){let[r,l]=S("editor.reviewMode",{});return{active:r[t]===!0,toggle:()=>l((c)=>({...c,[t]:c[t]!==!0}))}}function Hc(t,r=0){let l=Boolean(t.url)&&!t.url?.startsWith("blob:"),[c,p]=n({url:l?null:t.url,loading:l||!t.url,error:null}),h=i(t);return h.current=t,o(()=>{let g=h.current;if(g.url){let v=g.url;if(v.startsWith("blob:")){p({url:v,loading:!1,error:null});return}let C=!1;return p({url:null,loading:!0,error:null}),fetch(v,{headers:{Range:"bytes=0-0"}}).then(async(R)=>{if(C)return;if(R.ok){p({url:v,loading:!1,error:null});return}p({url:null,loading:!1,error:await Wr(R)})}).catch(()=>{if(!C)p({url:v,loading:!1,error:null})}),()=>{C=!0}}let y=g.loadBytes;if(!y){p({url:null,loading:!1,error:"This file cannot be read from here."});return}let x=!1,w=null;return p({url:null,loading:!0,error:null}),y().then((v)=>{if(x)return;w=URL.createObjectURL(g.mimeType?new Blob([v],{type:g.mimeType}):new Blob([v])),p({url:w,loading:!1,error:null})}).catch((v)=>{if(x)return;p({url:null,loading:!1,error:v instanceof Error?v.message:"Could not read this file."})}),()=>{if(x=!0,w)URL.revokeObjectURL(w)}},[t.id,r]),c}
|
|
12
|
+
export{Oc,bd,yd,Cg,Eg,$c,nr,ps,zc,Uc,Gc,jc,qc,vd,ms,Uo,fs,kd,Ai,Hc,Wc,gl,Al,Kc,Vc,Yc,Jc,Zc,Xc,eu,tu,nu};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Zo}from"./index-rc8wrs2a.js";var e=Object.freeze(JSON.parse(`{"displayName":"Lua","name":"lua","patterns":[{"begin":"\\\\b(?:(local)\\\\s+)?(function)\\\\b(?![,:])","beginCaptures":{"1":{"name":"keyword.local.lua"},"2":{"name":"keyword.control.lua"}},"end":"(?<=[-\\\\]\\"')\\\\[{}])","name":"meta.function.lua","patterns":[{"include":"#comment"},{"begin":"(\\\\()","beginCaptures":{"1":{"name":"punctuation.definition.parameters.begin.lua"}},"end":"(\\\\))|(?=[-\\\\]\\"'\\\\[{}])|(?<!\\\\.)\\\\.(?!\\\\.)","endCaptures":{"1":{"name":"punctuation.definition.parameters.finish.lua"}},"name":"meta.parameter.lua","patterns":[{"include":"#comment"},{"captures":{"1":{"name":"constant.language.lua"},"2":{"name":"variable.parameter.function.lua"}},"match":"(\\\\.{3})\\\\s*([A-Z_a-z][0-9A-Z_a-z]*)"},{"match":"[A-Z_a-z][0-9A-Z_a-z]*","name":"variable.parameter.function.lua"},{"match":",","name":"punctuation.separator.arguments.lua"},{"begin":":","beginCaptures":{"0":{"name":"punctuation.separator.arguments.lua"}},"end":"(?=[),])","patterns":[{"include":"#emmydoc.type"}]}]},{"match":"\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b\\\\s*(?=:)","name":"entity.name.class.lua"},{"match":"\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b","name":"entity.name.function.lua"}]},{"match":"(?<![.\\\\w\\\\d])0[Xx]\\\\h+(\\\\.\\\\h*)?([Ee]-?\\\\d*)?([Pp][-+]\\\\d+)?","name":"constant.numeric.float.hexadecimal.lua"},{"match":"(?<![.\\\\w\\\\d])0[Xx]\\\\.\\\\h+([Ee]-?\\\\d*)?([Pp][-+]\\\\d+)?","name":"constant.numeric.float.hexadecimal.lua"},{"match":"(?<![.\\\\w\\\\d])0[Xx]\\\\h+(?![.0-9EPep])","name":"constant.numeric.integer.hexadecimal.lua"},{"match":"(?<![.\\\\w\\\\d])\\\\d+(\\\\.\\\\d*)?([Ee]-?\\\\d*)?","name":"constant.numeric.float.lua"},{"match":"(?<![.\\\\w\\\\d])\\\\.\\\\d+([Ee]-?\\\\d*)?","name":"constant.numeric.float.lua"},{"match":"(?<![.\\\\w\\\\d])\\\\d+(?![.0-9EPep])","name":"constant.numeric.integer.lua"},{"include":"#string"},{"captures":{"1":{"name":"punctuation.definition.comment.lua"}},"match":"\\\\A(#!).*$\\\\n?","name":"comment.line.shebang.lua"},{"include":"#comment"},{"captures":{"1":{"name":"keyword.control.goto.lua"},"2":{"name":"string.tag.lua"}},"match":"\\\\b(goto)\\\\s+([A-Z_a-z][0-9A-Z_a-z]*)"},{"captures":{"1":{"name":"punctuation.section.embedded.begin.lua"},"2":{"name":"punctuation.section.embedded.end.lua"}},"match":"(::)\\\\s*[A-Z_a-z][0-9A-Z_a-z]*\\\\s*(::)","name":"string.tag.lua"},{"captures":{"0":{"name":"storage.type.attribute.lua"}},"match":"<\\\\s*(c(?:onst|lose))\\\\s*>"},{"match":"<[*A-Z_a-z][-*.0-9A-Z_a-z]*>","name":"storage.type.generic.lua"},{"match":"\\\\b(break|do|else|for|if|elseif|goto|return|then|repeat|while|until|end|in)\\\\b","name":"keyword.control.lua"},{"match":"\\\\b(local)\\\\b","name":"keyword.local.lua"},{"captures":{"1":{"name":"keyword.global.lua"}},"match":"^\\\\s*(global)\\\\b(?!\\\\s*=)"},{"match":"\\\\b(function)\\\\b(?![,:])","name":"keyword.control.lua"},{"match":"(?<![^.]\\\\.|:)\\\\b(false|nil(?!:)|true|_ENV|_G|_VERSION|math\\\\.(pi|huge|maxinteger|mininteger)|utf8\\\\.charpattern|io\\\\.(std(?:in|out|err))|package\\\\.(config|cpath|loaded|loaders|path|preload|searchers))\\\\b|(?<!\\\\.)\\\\.{3}(?!\\\\.)","name":"constant.language.lua"},{"match":"(?<![^.]\\\\.|:)\\\\b(self)\\\\b","name":"variable.language.self.lua"},{"match":"(?<![^.]\\\\.|:)\\\\b(assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|loadstring|module|next|pairs|pcall|print|rawequal|rawget|rawlen|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\\\\b(?!\\\\s*=(?!=))","name":"support.function.lua"},{"match":"(?<![^.]\\\\.|:)\\\\b(async)\\\\b(?!\\\\s*=(?!=))","name":"entity.name.tag.lua"},{"match":"(?<![^.]\\\\.|:)\\\\b(coroutine\\\\.(create|isyieldable|close|resume|running|status|wrap|yield)|string\\\\.(byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)|table\\\\.(concat|create|insert|maxn|move|pack|remove|sort|unpack)|math\\\\.(abs|acos|asin|atan2?|ceil|cosh?|deg|exp|floor|fmod|frexp|ldexp|log|log10|max|min|modf|pow|rad|random|randomseed|sinh?|sqrt|tanh?|tointeger|type)|io\\\\.(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)|os\\\\.(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)|package\\\\.(loadlib|seeall|searchpath)|debug\\\\.(debug|[gs]etfenv|[gs]ethook|getinfo|[gs]etlocal|[gs]etmetatable|getregistry|[gs]etupvalue|[gs]etuservalue|set[Cc]stacklimit|traceback|upvalueid|upvaluejoin)|bit32\\\\.(arshift|band|bnot|bor|btest|bxor|extract|replace|lrotate|lshift|rrotate|rshift)|utf8\\\\.(char|codes|codepoint|len|offset))\\\\b(?!\\\\s*=(?!=))","name":"support.function.library.lua"},{"match":"\\\\b(\\\\|\\\\||&&|!)\\\\b","name":"keyword.operator.lua"},{"match":"\\\\b(and|or|not)\\\\b","name":"keyword.operator.logical.lua"},{"match":"\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b(?=\\\\s*(?:[\\"'({]|\\\\[\\\\[))","name":"support.function.any-method.lua"},{"match":"\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b(?=\\\\s*\\\\??:)","name":"entity.name.class.lua"},{"match":"(?<=[^.]\\\\.|:)\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b(?!\\\\s*=\\\\s*\\\\b(function)\\\\b)","name":"entity.other.attribute.lua"},{"match":"\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b(?!\\\\s*=\\\\s*\\\\b(function)\\\\b)","name":"variable.other.lua"},{"match":"\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b(?=\\\\s*=\\\\s*\\\\b(function)\\\\b)","name":"entity.name.function.lua"},{"match":"[-#%*+/^]|==?|~=|!=|<=?|>=?|(?<!\\\\.)\\\\.{2}(?!\\\\.)","name":"keyword.operator.lua"}],"repository":{"comment":{"patterns":[{"begin":"(^[\\\\t ]+)?(?=--)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.lua"}},"end":"(?!\\\\G)((?!^)[\\\\t ]+\\\\n)?","endCaptures":{"1":{"name":"punctuation.whitespace.comment.trailing.lua"}},"patterns":[{"begin":"--\\\\[(=*)\\\\[@@@","beginCaptures":{"0":{"name":"punctuation.definition.comment.begin.lua"}},"end":"(--)?]\\\\1]","endCaptures":{"0":{"name":"punctuation.definition.comment.end.lua"}},"name":"","patterns":[{"include":"source.lua"}]},{"begin":"--\\\\[(=*)\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.comment.begin.lua"}},"end":"(--)?]\\\\1]","endCaptures":{"0":{"name":"punctuation.definition.comment.end.lua"}},"name":"comment.block.lua","patterns":[{"include":"#emmydoc"},{"include":"#ldoc_tag"}]},{"begin":"----","beginCaptures":{"0":{"name":"punctuation.definition.comment.lua"}},"end":"\\\\n","name":"comment.line.double-dash.lua"},{"begin":"---","beginCaptures":{"0":{"name":"punctuation.definition.comment.lua"}},"end":"\\\\n","name":"comment.line.double-dash.documentation.lua","patterns":[{"include":"#emmydoc"},{"include":"#ldoc_tag"}]},{"begin":"--","beginCaptures":{"0":{"name":"punctuation.definition.comment.lua"}},"end":"\\\\n","name":"comment.line.double-dash.lua","patterns":[{"include":"#ldoc_tag"}]}]},{"begin":"/\\\\*","beginCaptures":{"0":{"name":"punctuation.definition.comment.begin.lua"}},"end":"\\\\*/","endCaptures":{"0":{"name":"punctuation.definition.comment.end.lua"}},"name":"comment.block.lua","patterns":[{"include":"#emmydoc"},{"include":"#ldoc_tag"}]}]},"emmydoc":{"patterns":[{"begin":"(?<=---)[\\\\t ]*@class","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"match":"\\\\b([*A-Z_a-z][-*.0-9A-Z_a-z]*)","name":"support.class.lua"},{"match":"[,:]","name":"keyword.operator.lua"}]},{"begin":"(?<=---)[\\\\t ]*@enum","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"begin":"\\\\b([*A-Z_a-z][-*.0-9A-Z_a-z]*)","beginCaptures":{"0":{"name":"variable.lua"}},"end":"(?=\\\\n)"}]},{"begin":"(?<=---)[\\\\t ]*@type","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"include":"#emmydoc.type"}]},{"begin":"(?<=---)[\\\\t ]*@alias","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"begin":"\\\\b([*A-Z_a-z][-*.0-9A-Z_a-z]*)","beginCaptures":{"0":{"name":"variable.lua"}},"end":"(?=[\\\\n#])","patterns":[{"include":"#emmydoc.type"}]}]},{"begin":"(?<=---)[\\\\t ]*(@operator)\\\\s*(\\\\b[a-z]+)?","beginCaptures":{"1":{"name":"storage.type.annotation.lua"},"2":{"name":"support.function.library.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"include":"#emmydoc.type"}]},{"begin":"(?<=---)[\\\\t ]*@cast","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"begin":"\\\\b([*A-Z_a-z][-*.0-9A-Z_a-z]*)","beginCaptures":{"0":{"name":"variable.other.lua"}},"end":"(?=\\\\n)","patterns":[{"include":"#emmydoc.type"},{"match":"([+-|])","name":"keyword.operator.lua"}]}]},{"begin":"(?<=---)[\\\\t ]*@param","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"begin":"\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b(\\\\??)","beginCaptures":{"1":{"name":"entity.name.variable.lua"},"2":{"name":"keyword.operator.lua"}},"end":"(?=[\\\\n#])","patterns":[{"include":"#emmydoc.type"}]}]},{"begin":"(?<=---)[\\\\t ]*@return","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"match":"\\\\?","name":"keyword.operator.lua"},{"include":"#emmydoc.type"}]},{"begin":"(?<=---)[\\\\t ]*@field","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"begin":"(\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b|(\\\\[))(\\\\??)","beginCaptures":{"2":{"name":"entity.name.variable.lua"},"3":{"name":"keyword.operator.lua"}},"end":"(?=[\\\\n#])","patterns":[{"include":"#string"},{"include":"#emmydoc.type"},{"match":"]","name":"keyword.operator.lua"}]}]},{"begin":"(?<=---)[\\\\t ]*@generic","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"begin":"\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b","beginCaptures":{"0":{"name":"storage.type.generic.lua"}},"end":"(?=\\\\n)|(,)","endCaptures":{"0":{"name":"keyword.operator.lua"}},"patterns":[{"match":":","name":"keyword.operator.lua"},{"include":"#emmydoc.type"}]}]},{"begin":"(?<=---)[\\\\t ]*@vararg","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"include":"#emmydoc.type"}]},{"begin":"(?<=---)[\\\\t ]*@overload","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"include":"#emmydoc.type"}]},{"begin":"(?<=---)[\\\\t ]*@deprecated","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])"},{"begin":"(?<=---)[\\\\t ]*@meta","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])"},{"begin":"(?<=---)[\\\\t ]*@private","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])"},{"begin":"(?<=---)[\\\\t ]*@protected","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])"},{"begin":"(?<=---)[\\\\t ]*@package","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])"},{"begin":"(?<=---)[\\\\t ]*@version","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"match":"\\\\b(5\\\\.1|5\\\\.2|5\\\\.3|5\\\\.4|JIT)\\\\b","name":"support.class.lua"},{"match":"[,<>]","name":"keyword.operator.lua"}]},{"begin":"(?<=---)[\\\\t ]*@see","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"match":"\\\\b([*A-Z_a-z][-*.0-9A-Z_a-z]*)","name":"support.class.lua"},{"match":"#","name":"keyword.operator.lua"}]},{"begin":"(?<=---)[\\\\t ]*@diagnostic","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"begin":"([-0-9A-Z_a-z]+)[\\\\t ]*(:)?","beginCaptures":{"1":{"name":"keyword.other.unit"},"2":{"name":"keyword.operator.unit"}},"end":"(?=\\\\n)","patterns":[{"match":"\\\\b([*A-Z_a-z][-0-9A-Z_a-z]*)","name":"support.class.lua"},{"match":",","name":"keyword.operator.lua"}]}]},{"begin":"(?<=---)[\\\\t ]*@module","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"include":"#string"}]},{"match":"(?<=---)[\\\\t ]*@(async|nodiscard)","name":"storage.type.annotation.lua"},{"begin":"(?<=---)\\\\|\\\\s*[+>]?","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"include":"#string"}]}]},"emmydoc.type":{"patterns":[{"begin":"\\\\bfun\\\\b","beginCaptures":{"0":{"name":"keyword.control.lua"}},"end":"(?=[#\\\\s])","patterns":[{"match":"[](),:<>?\\\\[][\\\\t ]*","name":"keyword.operator.lua"},{"match":"([A-Z_a-z][-*.0-9A-Z_a-z]*)(?<!,)[\\\\t ]*(?=\\\\??:)","name":"entity.name.variable.lua"},{"include":"#emmydoc.type"},{"include":"#string"}]},{"match":"<[*A-Z_a-z][-*.0-9A-Z_a-z]*>","name":"storage.type.generic.lua"},{"match":"\\\\basync\\\\b","name":"entity.name.tag.lua"},{"match":"[,:?\`{|}][\\\\t ]*","name":"keyword.operator.lua"},{"begin":"(?=[\\"'*.A-\\\\[_a-z])","end":"(?=[#),:?|}\\\\s])","patterns":[{"match":"([-\\\\]*,.0-9<>A-\\\\[_a-z]+)(?<!,)[\\\\t ]*","name":"support.type.lua"},{"match":"(\\\\.\\\\.\\\\.)[\\\\t ]*","name":"constant.language.lua"},{"include":"#string"}]}]},"escaped_char":{"patterns":[{"match":"\\\\\\\\[\\\\n\\"'\\\\\\\\abfnrtv]","name":"constant.character.escape.lua"},{"match":"\\\\\\\\z[\\\\t\\\\n ]*","name":"constant.character.escape.lua"},{"match":"\\\\\\\\\\\\d{1,3}","name":"constant.character.escape.byte.lua"},{"match":"\\\\\\\\x\\\\h\\\\h","name":"constant.character.escape.byte.lua"},{"match":"\\\\\\\\u\\\\{\\\\h+}","name":"constant.character.escape.unicode.lua"},{"match":"\\\\\\\\.","name":"invalid.illegal.character.escape.lua"}]},"ldoc_tag":{"captures":{"1":{"name":"punctuation.definition.block.tag.ldoc"},"2":{"name":"storage.type.class.ldoc"}},"match":"\\\\G[\\\\t ]*(@)(alias|annotation|author|charset|class|classmod|comment|constructor|copyright|description|example|export|factory|field|file|fixme|function|include|lfunction|license|local|module|name|param|pragma|private|raise|release|return|script|section|see|set|static|submodule|summary|tfield|thread|tparam|treturn|todo|topic|type|usage|warning|within)\\\\b"},"string":{"patterns":[{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.lua"}},"end":"'[\\\\t ]*|(?=\\\\n)","endCaptures":{"0":{"name":"punctuation.definition.string.end.lua"}},"name":"string.quoted.single.lua","patterns":[{"include":"#escaped_char"}]},{"begin":"\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.lua"}},"end":"\\"[\\\\t ]*|(?=\\\\n)","endCaptures":{"0":{"name":"punctuation.definition.string.end.lua"}},"name":"string.quoted.double.lua","patterns":[{"include":"#escaped_char"}]},{"begin":"\`","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.lua"}},"end":"\`[\\\\t ]*|(?=\\\\n)","endCaptures":{"0":{"name":"punctuation.definition.string.end.lua"}},"name":"string.quoted.double.lua"},{"begin":"(?<=\\\\.cdef)\\\\s*(\\\\[(=*)\\\\[)","beginCaptures":{"0":{"name":"string.quoted.other.multiline.lua"},"1":{"name":"punctuation.definition.string.begin.lua"}},"contentName":"meta.embedded.lua","end":"(]\\\\2])[\\\\t ]*","endCaptures":{"0":{"name":"string.quoted.other.multiline.lua"},"1":{"name":"punctuation.definition.string.end.lua"}},"patterns":[{"include":"source.c"}]},{"begin":"(?<!--)\\\\[(=*)\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.lua"}},"end":"]\\\\1][\\\\t ]*","endCaptures":{"0":{"name":"punctuation.definition.string.end.lua"}},"name":"string.quoted.other.multiline.lua"}]}},"scopeName":"source.lua","embeddedLangs":["c"]}`)),Kf=[...Zo,e];
|
|
2
|
-
export{
|
|
1
|
+
import{Xo}from"./index-03pyvmcz.js";var e=Object.freeze(JSON.parse(`{"displayName":"Lua","name":"lua","patterns":[{"begin":"\\\\b(?:(local)\\\\s+)?(function)\\\\b(?![,:])","beginCaptures":{"1":{"name":"keyword.local.lua"},"2":{"name":"keyword.control.lua"}},"end":"(?<=[-\\\\]\\"')\\\\[{}])","name":"meta.function.lua","patterns":[{"include":"#comment"},{"begin":"(\\\\()","beginCaptures":{"1":{"name":"punctuation.definition.parameters.begin.lua"}},"end":"(\\\\))|(?=[-\\\\]\\"'\\\\[{}])|(?<!\\\\.)\\\\.(?!\\\\.)","endCaptures":{"1":{"name":"punctuation.definition.parameters.finish.lua"}},"name":"meta.parameter.lua","patterns":[{"include":"#comment"},{"captures":{"1":{"name":"constant.language.lua"},"2":{"name":"variable.parameter.function.lua"}},"match":"(\\\\.{3})\\\\s*([A-Z_a-z][0-9A-Z_a-z]*)"},{"match":"[A-Z_a-z][0-9A-Z_a-z]*","name":"variable.parameter.function.lua"},{"match":",","name":"punctuation.separator.arguments.lua"},{"begin":":","beginCaptures":{"0":{"name":"punctuation.separator.arguments.lua"}},"end":"(?=[),])","patterns":[{"include":"#emmydoc.type"}]}]},{"match":"\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b\\\\s*(?=:)","name":"entity.name.class.lua"},{"match":"\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b","name":"entity.name.function.lua"}]},{"match":"(?<![.\\\\w\\\\d])0[Xx]\\\\h+(\\\\.\\\\h*)?([Ee]-?\\\\d*)?([Pp][-+]\\\\d+)?","name":"constant.numeric.float.hexadecimal.lua"},{"match":"(?<![.\\\\w\\\\d])0[Xx]\\\\.\\\\h+([Ee]-?\\\\d*)?([Pp][-+]\\\\d+)?","name":"constant.numeric.float.hexadecimal.lua"},{"match":"(?<![.\\\\w\\\\d])0[Xx]\\\\h+(?![.0-9EPep])","name":"constant.numeric.integer.hexadecimal.lua"},{"match":"(?<![.\\\\w\\\\d])\\\\d+(\\\\.\\\\d*)?([Ee]-?\\\\d*)?","name":"constant.numeric.float.lua"},{"match":"(?<![.\\\\w\\\\d])\\\\.\\\\d+([Ee]-?\\\\d*)?","name":"constant.numeric.float.lua"},{"match":"(?<![.\\\\w\\\\d])\\\\d+(?![.0-9EPep])","name":"constant.numeric.integer.lua"},{"include":"#string"},{"captures":{"1":{"name":"punctuation.definition.comment.lua"}},"match":"\\\\A(#!).*$\\\\n?","name":"comment.line.shebang.lua"},{"include":"#comment"},{"captures":{"1":{"name":"keyword.control.goto.lua"},"2":{"name":"string.tag.lua"}},"match":"\\\\b(goto)\\\\s+([A-Z_a-z][0-9A-Z_a-z]*)"},{"captures":{"1":{"name":"punctuation.section.embedded.begin.lua"},"2":{"name":"punctuation.section.embedded.end.lua"}},"match":"(::)\\\\s*[A-Z_a-z][0-9A-Z_a-z]*\\\\s*(::)","name":"string.tag.lua"},{"captures":{"0":{"name":"storage.type.attribute.lua"}},"match":"<\\\\s*(c(?:onst|lose))\\\\s*>"},{"match":"<[*A-Z_a-z][-*.0-9A-Z_a-z]*>","name":"storage.type.generic.lua"},{"match":"\\\\b(break|do|else|for|if|elseif|goto|return|then|repeat|while|until|end|in)\\\\b","name":"keyword.control.lua"},{"match":"\\\\b(local)\\\\b","name":"keyword.local.lua"},{"captures":{"1":{"name":"keyword.global.lua"}},"match":"^\\\\s*(global)\\\\b(?!\\\\s*=)"},{"match":"\\\\b(function)\\\\b(?![,:])","name":"keyword.control.lua"},{"match":"(?<![^.]\\\\.|:)\\\\b(false|nil(?!:)|true|_ENV|_G|_VERSION|math\\\\.(pi|huge|maxinteger|mininteger)|utf8\\\\.charpattern|io\\\\.(std(?:in|out|err))|package\\\\.(config|cpath|loaded|loaders|path|preload|searchers))\\\\b|(?<!\\\\.)\\\\.{3}(?!\\\\.)","name":"constant.language.lua"},{"match":"(?<![^.]\\\\.|:)\\\\b(self)\\\\b","name":"variable.language.self.lua"},{"match":"(?<![^.]\\\\.|:)\\\\b(assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|loadstring|module|next|pairs|pcall|print|rawequal|rawget|rawlen|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\\\\b(?!\\\\s*=(?!=))","name":"support.function.lua"},{"match":"(?<![^.]\\\\.|:)\\\\b(async)\\\\b(?!\\\\s*=(?!=))","name":"entity.name.tag.lua"},{"match":"(?<![^.]\\\\.|:)\\\\b(coroutine\\\\.(create|isyieldable|close|resume|running|status|wrap|yield)|string\\\\.(byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)|table\\\\.(concat|create|insert|maxn|move|pack|remove|sort|unpack)|math\\\\.(abs|acos|asin|atan2?|ceil|cosh?|deg|exp|floor|fmod|frexp|ldexp|log|log10|max|min|modf|pow|rad|random|randomseed|sinh?|sqrt|tanh?|tointeger|type)|io\\\\.(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)|os\\\\.(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)|package\\\\.(loadlib|seeall|searchpath)|debug\\\\.(debug|[gs]etfenv|[gs]ethook|getinfo|[gs]etlocal|[gs]etmetatable|getregistry|[gs]etupvalue|[gs]etuservalue|set[Cc]stacklimit|traceback|upvalueid|upvaluejoin)|bit32\\\\.(arshift|band|bnot|bor|btest|bxor|extract|replace|lrotate|lshift|rrotate|rshift)|utf8\\\\.(char|codes|codepoint|len|offset))\\\\b(?!\\\\s*=(?!=))","name":"support.function.library.lua"},{"match":"\\\\b(\\\\|\\\\||&&|!)\\\\b","name":"keyword.operator.lua"},{"match":"\\\\b(and|or|not)\\\\b","name":"keyword.operator.logical.lua"},{"match":"\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b(?=\\\\s*(?:[\\"'({]|\\\\[\\\\[))","name":"support.function.any-method.lua"},{"match":"\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b(?=\\\\s*\\\\??:)","name":"entity.name.class.lua"},{"match":"(?<=[^.]\\\\.|:)\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b(?!\\\\s*=\\\\s*\\\\b(function)\\\\b)","name":"entity.other.attribute.lua"},{"match":"\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b(?!\\\\s*=\\\\s*\\\\b(function)\\\\b)","name":"variable.other.lua"},{"match":"\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b(?=\\\\s*=\\\\s*\\\\b(function)\\\\b)","name":"entity.name.function.lua"},{"match":"[-#%*+/^]|==?|~=|!=|<=?|>=?|(?<!\\\\.)\\\\.{2}(?!\\\\.)","name":"keyword.operator.lua"}],"repository":{"comment":{"patterns":[{"begin":"(^[\\\\t ]+)?(?=--)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.lua"}},"end":"(?!\\\\G)((?!^)[\\\\t ]+\\\\n)?","endCaptures":{"1":{"name":"punctuation.whitespace.comment.trailing.lua"}},"patterns":[{"begin":"--\\\\[(=*)\\\\[@@@","beginCaptures":{"0":{"name":"punctuation.definition.comment.begin.lua"}},"end":"(--)?]\\\\1]","endCaptures":{"0":{"name":"punctuation.definition.comment.end.lua"}},"name":"","patterns":[{"include":"source.lua"}]},{"begin":"--\\\\[(=*)\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.comment.begin.lua"}},"end":"(--)?]\\\\1]","endCaptures":{"0":{"name":"punctuation.definition.comment.end.lua"}},"name":"comment.block.lua","patterns":[{"include":"#emmydoc"},{"include":"#ldoc_tag"}]},{"begin":"----","beginCaptures":{"0":{"name":"punctuation.definition.comment.lua"}},"end":"\\\\n","name":"comment.line.double-dash.lua"},{"begin":"---","beginCaptures":{"0":{"name":"punctuation.definition.comment.lua"}},"end":"\\\\n","name":"comment.line.double-dash.documentation.lua","patterns":[{"include":"#emmydoc"},{"include":"#ldoc_tag"}]},{"begin":"--","beginCaptures":{"0":{"name":"punctuation.definition.comment.lua"}},"end":"\\\\n","name":"comment.line.double-dash.lua","patterns":[{"include":"#ldoc_tag"}]}]},{"begin":"/\\\\*","beginCaptures":{"0":{"name":"punctuation.definition.comment.begin.lua"}},"end":"\\\\*/","endCaptures":{"0":{"name":"punctuation.definition.comment.end.lua"}},"name":"comment.block.lua","patterns":[{"include":"#emmydoc"},{"include":"#ldoc_tag"}]}]},"emmydoc":{"patterns":[{"begin":"(?<=---)[\\\\t ]*@class","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"match":"\\\\b([*A-Z_a-z][-*.0-9A-Z_a-z]*)","name":"support.class.lua"},{"match":"[,:]","name":"keyword.operator.lua"}]},{"begin":"(?<=---)[\\\\t ]*@enum","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"begin":"\\\\b([*A-Z_a-z][-*.0-9A-Z_a-z]*)","beginCaptures":{"0":{"name":"variable.lua"}},"end":"(?=\\\\n)"}]},{"begin":"(?<=---)[\\\\t ]*@type","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"include":"#emmydoc.type"}]},{"begin":"(?<=---)[\\\\t ]*@alias","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"begin":"\\\\b([*A-Z_a-z][-*.0-9A-Z_a-z]*)","beginCaptures":{"0":{"name":"variable.lua"}},"end":"(?=[\\\\n#])","patterns":[{"include":"#emmydoc.type"}]}]},{"begin":"(?<=---)[\\\\t ]*(@operator)\\\\s*(\\\\b[a-z]+)?","beginCaptures":{"1":{"name":"storage.type.annotation.lua"},"2":{"name":"support.function.library.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"include":"#emmydoc.type"}]},{"begin":"(?<=---)[\\\\t ]*@cast","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"begin":"\\\\b([*A-Z_a-z][-*.0-9A-Z_a-z]*)","beginCaptures":{"0":{"name":"variable.other.lua"}},"end":"(?=\\\\n)","patterns":[{"include":"#emmydoc.type"},{"match":"([+-|])","name":"keyword.operator.lua"}]}]},{"begin":"(?<=---)[\\\\t ]*@param","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"begin":"\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b(\\\\??)","beginCaptures":{"1":{"name":"entity.name.variable.lua"},"2":{"name":"keyword.operator.lua"}},"end":"(?=[\\\\n#])","patterns":[{"include":"#emmydoc.type"}]}]},{"begin":"(?<=---)[\\\\t ]*@return","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"match":"\\\\?","name":"keyword.operator.lua"},{"include":"#emmydoc.type"}]},{"begin":"(?<=---)[\\\\t ]*@field","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"begin":"(\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b|(\\\\[))(\\\\??)","beginCaptures":{"2":{"name":"entity.name.variable.lua"},"3":{"name":"keyword.operator.lua"}},"end":"(?=[\\\\n#])","patterns":[{"include":"#string"},{"include":"#emmydoc.type"},{"match":"]","name":"keyword.operator.lua"}]}]},{"begin":"(?<=---)[\\\\t ]*@generic","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"begin":"\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b","beginCaptures":{"0":{"name":"storage.type.generic.lua"}},"end":"(?=\\\\n)|(,)","endCaptures":{"0":{"name":"keyword.operator.lua"}},"patterns":[{"match":":","name":"keyword.operator.lua"},{"include":"#emmydoc.type"}]}]},{"begin":"(?<=---)[\\\\t ]*@vararg","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"include":"#emmydoc.type"}]},{"begin":"(?<=---)[\\\\t ]*@overload","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"include":"#emmydoc.type"}]},{"begin":"(?<=---)[\\\\t ]*@deprecated","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])"},{"begin":"(?<=---)[\\\\t ]*@meta","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])"},{"begin":"(?<=---)[\\\\t ]*@private","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])"},{"begin":"(?<=---)[\\\\t ]*@protected","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])"},{"begin":"(?<=---)[\\\\t ]*@package","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])"},{"begin":"(?<=---)[\\\\t ]*@version","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"match":"\\\\b(5\\\\.1|5\\\\.2|5\\\\.3|5\\\\.4|JIT)\\\\b","name":"support.class.lua"},{"match":"[,<>]","name":"keyword.operator.lua"}]},{"begin":"(?<=---)[\\\\t ]*@see","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"match":"\\\\b([*A-Z_a-z][-*.0-9A-Z_a-z]*)","name":"support.class.lua"},{"match":"#","name":"keyword.operator.lua"}]},{"begin":"(?<=---)[\\\\t ]*@diagnostic","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"begin":"([-0-9A-Z_a-z]+)[\\\\t ]*(:)?","beginCaptures":{"1":{"name":"keyword.other.unit"},"2":{"name":"keyword.operator.unit"}},"end":"(?=\\\\n)","patterns":[{"match":"\\\\b([*A-Z_a-z][-0-9A-Z_a-z]*)","name":"support.class.lua"},{"match":",","name":"keyword.operator.lua"}]}]},{"begin":"(?<=---)[\\\\t ]*@module","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"include":"#string"}]},{"match":"(?<=---)[\\\\t ]*@(async|nodiscard)","name":"storage.type.annotation.lua"},{"begin":"(?<=---)\\\\|\\\\s*[+>]?","beginCaptures":{"0":{"name":"storage.type.annotation.lua"}},"end":"(?=[\\\\n#@])","patterns":[{"include":"#string"}]}]},"emmydoc.type":{"patterns":[{"begin":"\\\\bfun\\\\b","beginCaptures":{"0":{"name":"keyword.control.lua"}},"end":"(?=[#\\\\s])","patterns":[{"match":"[](),:<>?\\\\[][\\\\t ]*","name":"keyword.operator.lua"},{"match":"([A-Z_a-z][-*.0-9A-Z_a-z]*)(?<!,)[\\\\t ]*(?=\\\\??:)","name":"entity.name.variable.lua"},{"include":"#emmydoc.type"},{"include":"#string"}]},{"match":"<[*A-Z_a-z][-*.0-9A-Z_a-z]*>","name":"storage.type.generic.lua"},{"match":"\\\\basync\\\\b","name":"entity.name.tag.lua"},{"match":"[,:?\`{|}][\\\\t ]*","name":"keyword.operator.lua"},{"begin":"(?=[\\"'*.A-\\\\[_a-z])","end":"(?=[#),:?|}\\\\s])","patterns":[{"match":"([-\\\\]*,.0-9<>A-\\\\[_a-z]+)(?<!,)[\\\\t ]*","name":"support.type.lua"},{"match":"(\\\\.\\\\.\\\\.)[\\\\t ]*","name":"constant.language.lua"},{"include":"#string"}]}]},"escaped_char":{"patterns":[{"match":"\\\\\\\\[\\\\n\\"'\\\\\\\\abfnrtv]","name":"constant.character.escape.lua"},{"match":"\\\\\\\\z[\\\\t\\\\n ]*","name":"constant.character.escape.lua"},{"match":"\\\\\\\\\\\\d{1,3}","name":"constant.character.escape.byte.lua"},{"match":"\\\\\\\\x\\\\h\\\\h","name":"constant.character.escape.byte.lua"},{"match":"\\\\\\\\u\\\\{\\\\h+}","name":"constant.character.escape.unicode.lua"},{"match":"\\\\\\\\.","name":"invalid.illegal.character.escape.lua"}]},"ldoc_tag":{"captures":{"1":{"name":"punctuation.definition.block.tag.ldoc"},"2":{"name":"storage.type.class.ldoc"}},"match":"\\\\G[\\\\t ]*(@)(alias|annotation|author|charset|class|classmod|comment|constructor|copyright|description|example|export|factory|field|file|fixme|function|include|lfunction|license|local|module|name|param|pragma|private|raise|release|return|script|section|see|set|static|submodule|summary|tfield|thread|tparam|treturn|todo|topic|type|usage|warning|within)\\\\b"},"string":{"patterns":[{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.lua"}},"end":"'[\\\\t ]*|(?=\\\\n)","endCaptures":{"0":{"name":"punctuation.definition.string.end.lua"}},"name":"string.quoted.single.lua","patterns":[{"include":"#escaped_char"}]},{"begin":"\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.lua"}},"end":"\\"[\\\\t ]*|(?=\\\\n)","endCaptures":{"0":{"name":"punctuation.definition.string.end.lua"}},"name":"string.quoted.double.lua","patterns":[{"include":"#escaped_char"}]},{"begin":"\`","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.lua"}},"end":"\`[\\\\t ]*|(?=\\\\n)","endCaptures":{"0":{"name":"punctuation.definition.string.end.lua"}},"name":"string.quoted.double.lua"},{"begin":"(?<=\\\\.cdef)\\\\s*(\\\\[(=*)\\\\[)","beginCaptures":{"0":{"name":"string.quoted.other.multiline.lua"},"1":{"name":"punctuation.definition.string.begin.lua"}},"contentName":"meta.embedded.lua","end":"(]\\\\2])[\\\\t ]*","endCaptures":{"0":{"name":"string.quoted.other.multiline.lua"},"1":{"name":"punctuation.definition.string.end.lua"}},"patterns":[{"include":"source.c"}]},{"begin":"(?<!--)\\\\[(=*)\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.lua"}},"end":"]\\\\1][\\\\t ]*","endCaptures":{"0":{"name":"punctuation.definition.string.end.lua"}},"name":"string.quoted.other.multiline.lua"}]}},"scopeName":"source.lua","embeddedLangs":["c"]}`)),Jf=[...Xo,e];
|
|
2
|
+
export{Jf};
|