@inkeep/open-knowledge 0.31.0-beta.8 → 0.31.0
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/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +67 -57
- package/dist/config-schema.json +0 -17
- package/dist/config.project-local.schema.json +0 -17
- package/dist/constants-Buc3Khk9.mjs +2 -0
- package/dist/{dist-CynAX6cy.mjs → dist-Bu8EnbFm.mjs} +27 -27
- package/dist/dist-s05zKf10.mjs +1 -0
- package/dist/{gh-detect-Uu4VAWnW.mjs → gh-detect-Dvi-l8Fu.mjs} +2 -2
- package/dist/index.d.mts +4 -101
- package/dist/index.mjs +1 -1
- package/dist/init-0JqajBIK.mjs +653 -0
- package/dist/init-BZ0VgwrF.mjs +1 -0
- package/dist/{is-object-Cie0xXKD.mjs → is-object-Cg453afR.mjs} +1 -1
- package/dist/launch-json-removal-Bc0nsm9s.mjs +2 -0
- package/dist/loader-BO5HbT0u.mjs +1 -0
- package/dist/{loader-DIcwzOTi.mjs → loader-DX0gEzQH.mjs} +3 -3
- package/dist/{open-browser-Lk0l8JF5.mjs → open-browser-B5VaZ8SA.mjs} +2 -2
- package/dist/{preview-C9JeIyOB.mjs → preview-BVy_yUWj.mjs} +2 -2
- package/dist/preview-CuQ-f0Ce.mjs +1 -0
- package/dist/public/assets/ActivityModeContent-O1kmRaYv.js +2 -0
- package/dist/public/assets/CodeMirrorPropInput-Bun2HhT4.js +3 -0
- package/dist/public/assets/ConsentDialogBody-BAqZ9VoD.js +2 -0
- package/dist/public/assets/DocumentContext-CfINo_Mw.js +35 -0
- package/dist/public/assets/EnableSyncConfirmDialog-CGcWliZX.js +1 -0
- package/dist/public/assets/GraphPanel-psKCWN5A.js +46 -0
- package/dist/public/assets/ManagedArtifactProperties-DgrIcsNj.js +1 -0
- package/dist/public/assets/McpConsentDialogBody-tmZV4IV0.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-DoV9dGJN.js → MermaidDocEditor-BCfIy1Pt.js} +1 -1
- package/dist/public/assets/PropertyPanel-DATdDgBR.js +2 -0
- package/dist/public/assets/SettingsDialogBody-c0x_Jk-n.js +7 -0
- package/dist/public/assets/ShareBranchSwitchDialog-ByGG9GtW.js +1 -0
- package/dist/public/assets/ShareReceiveDialog-Dv8wcWQl.js +1 -0
- package/dist/public/assets/ShareReceiveMissDialog-C3kajhK9.js +1 -0
- package/dist/public/assets/SkillEditorActions-Cv2ng-RP.js +1 -0
- package/dist/public/assets/SourceEditor-jBkr15gq.js +1 -0
- package/dist/public/assets/{TerminalPanel-Bd8Dtt_n.js → TerminalPanel-BQO8Y-CN.js} +3 -3
- package/dist/public/assets/{_baseFor-0d9AvFx1.js → _baseFor-BmaoxMlo.js} +1 -1
- package/dist/public/assets/agent-presence-BIAongcY.js +1 -0
- package/dist/public/assets/{arc-BWLwkJ2r.js → arc-BXir8W_f.js} +1 -1
- package/dist/public/assets/architecture-YZFGNWBL-CaPSZfdV.js +1 -0
- package/dist/public/assets/{architectureDiagram-Q4EWVU46-KXeh9itt.js → architectureDiagram-Q4EWVU46-DBTz54wh.js} +1 -1
- package/dist/public/assets/arrow-up-right-8pfjkZqS.js +1 -0
- package/dist/public/assets/auth-state-cache-CrfcQc3U.js +11 -0
- package/dist/public/assets/{blockDiagram-DXYQGD6D-DtrdFoMb.js → blockDiagram-DXYQGD6D-D4bYX8pX.js} +1 -1
- package/dist/public/assets/button-cneJOVxD.js +1 -0
- package/dist/public/assets/{c4Diagram-AHTNJAMY-fq1Z49Kc.js → c4Diagram-AHTNJAMY-BOsQb_-W.js} +1 -1
- package/dist/public/assets/calendar-BbVtdK1g.js +1 -0
- package/dist/public/assets/channel-Cf4pPTY1.js +1 -0
- package/dist/public/assets/check-ChQiT7oS.js +1 -0
- package/dist/public/assets/checkbox-Du1jumyn.js +1 -0
- package/dist/public/assets/chevron-down-BNXqfGKq.js +1 -0
- package/dist/public/assets/chevron-left-BBxdkhy7.js +1 -0
- package/dist/public/assets/chevron-right-B0Wo_9Sg.js +1 -0
- package/dist/public/assets/{chunk-2KRD3SAO-Bk_Wilkm.js → chunk-2KRD3SAO-Cdn0_KuR.js} +1 -1
- package/dist/public/assets/{chunk-336JU56O-CL9kwjEg.js → chunk-336JU56O-C6KVZ0tT.js} +2 -2
- package/dist/public/assets/chunk-426QAEUC-BZfWcxWh.js +1 -0
- package/dist/public/assets/{chunk-4BX2VUAB-D96BT_Bg.js → chunk-4BX2VUAB-kKn-Fa2A.js} +1 -1
- package/dist/public/assets/{chunk-4TB4RGXK-1ZoApeth.js → chunk-4TB4RGXK-DPDZUWSG.js} +1 -1
- package/dist/public/assets/chunk-55IACEB6-D2oQNvOq.js +1 -0
- package/dist/public/assets/{chunk-5FUZZQ4R-DPbA0GBM.js → chunk-5FUZZQ4R-CE2r23Tt.js} +1 -1
- package/dist/public/assets/{chunk-5PVQY5BW-CQS0U6F7.js → chunk-5PVQY5BW-BaCH2jUD.js} +1 -1
- package/dist/public/assets/{chunk-67CJDMHE-okMxnkQT.js → chunk-67CJDMHE-Cf4qHZvI.js} +1 -1
- package/dist/public/assets/{chunk-7N4EOEYR-Drske5an.js → chunk-7N4EOEYR-CaLXISN2.js} +1 -1
- package/dist/public/assets/{chunk-AA7GKIK3-BlHxQeSp.js → chunk-AA7GKIK3-BesY--Yf.js} +1 -1
- package/dist/public/assets/{chunk-BSJP7CBP-BpNyv8Y4.js → chunk-BSJP7CBP-HRb_DZiR.js} +1 -1
- package/dist/public/assets/{chunk-CIAEETIT-8deU_mkj.js → chunk-CIAEETIT-C6kcGp2f.js} +1 -1
- package/dist/public/assets/{chunk-EDXVE4YY-VzPvg9KF.js → chunk-EDXVE4YY-BhzOYMWA.js} +1 -1
- package/dist/public/assets/{chunk-ENJZ2VHE-BjhT8OeZ.js → chunk-ENJZ2VHE-pRhNQy5K.js} +1 -1
- package/dist/public/assets/{chunk-FMBD7UC4-CGtQ8v2r.js → chunk-FMBD7UC4-B9WsPaBW.js} +1 -1
- package/dist/public/assets/{chunk-FOC6F5B3--YnpQUAX.js → chunk-FOC6F5B3-B34b1kdM.js} +1 -1
- package/dist/public/assets/{chunk-ICPOFSXX-By9Q-6fm.js → chunk-ICPOFSXX-FUqEyzVa.js} +2 -2
- package/dist/public/assets/{chunk-K5T4RW27-C_6VcMXC.js → chunk-K5T4RW27-BvMe003e.js} +1 -1
- package/dist/public/assets/{chunk-KGLVRYIC-C3De9ry6.js → chunk-KGLVRYIC-B2xoojsm.js} +1 -1
- package/dist/public/assets/{chunk-LIHQZDEY-D4-GsYgm.js → chunk-LIHQZDEY-qSFnrF4a.js} +1 -1
- package/dist/public/assets/{chunk-ORNJ4GCN-qQUTfvQr.js → chunk-ORNJ4GCN-BQkOf7L-.js} +1 -1
- package/dist/public/assets/{chunk-OYMX7WX6-DAJTRr-n.js → chunk-OYMX7WX6-keoSJPWn.js} +1 -1
- package/dist/public/assets/chunk-QZHKN3VN-CRAtM2dA.js +1 -0
- package/dist/public/assets/{chunk-U2HBQHQK-Cp-6rjnO.js → chunk-U2HBQHQK-BJ9jeiqm.js} +1 -1
- package/dist/public/assets/{chunk-X2U36JSP-BFqfQNWU.js → chunk-X2U36JSP-C2-eEatP.js} +1 -1
- package/dist/public/assets/{chunk-XPW4576I-DI0-cfrS.js → chunk-XPW4576I-iLIgnX6_.js} +1 -1
- package/dist/public/assets/{chunk-YZCP3GAM-sn7T8ho2.js → chunk-YZCP3GAM-DCLhfuTC.js} +1 -1
- package/dist/public/assets/{chunk-ZZ45TVLE-CxH2fGjk.js → chunk-ZZ45TVLE-Cuifzj6s.js} +1 -1
- package/dist/public/assets/classDiagram-6PBFFD2Q-v8EnrTlo.js +1 -0
- package/dist/public/assets/classDiagram-v2-HSJHXN6E-Bh3u7TCm.js +1 -0
- package/dist/public/assets/clone-CENMxO1q.js +1 -0
- package/dist/public/assets/collapsible-mJvufeMs.js +1 -0
- package/dist/public/assets/config-provider-C16_sC_R.js +4 -0
- package/dist/public/assets/{cose-bilkent-S5V4N54A-CXBsVXq9.js → cose-bilkent-S5V4N54A-B9iA1NZS.js} +1 -1
- package/dist/public/assets/{cursor-BsJMggkz.js → cursor-Bz3j3UrW.js} +1 -1
- package/dist/public/assets/{dagre-C2Qb6hf2.js → dagre-B1wiFyrD.js} +1 -1
- package/dist/public/assets/{dagre-KV5264BT-BQUJovtG.js → dagre-KV5264BT-GGwDqdQ_.js} +1 -1
- package/dist/public/assets/{diagram-5BDNPKRD-C6tTTvBq.js → diagram-5BDNPKRD-CY8bFFiZ.js} +1 -1
- package/dist/public/assets/{diagram-G4DWMVQ6-Cq1-s9xc.js → diagram-G4DWMVQ6-Ba38EFwg.js} +1 -1
- package/dist/public/assets/{diagram-MMDJMWI5-BE-MhKN8.js → diagram-MMDJMWI5-C4HgKh6K.js} +1 -1
- package/dist/public/assets/{diagram-TYMM5635-G0QPzMX4.js → diagram-TYMM5635-C41UHohH.js} +1 -1
- package/dist/public/assets/dialog-DdHaoAGK.js +45 -0
- package/dist/public/assets/dist-BSkHa6UR.js +1 -0
- package/dist/public/assets/{dist-BVRsG3b2.js → dist-BtuJEC9v.js} +108 -108
- package/dist/public/assets/{dist-CN2Ak373.js → dist-BzxczcQx.js} +1 -1
- package/dist/public/assets/{dist-CFvMrf5i.js → dist-COmtpu4e.js} +1 -1
- package/dist/public/assets/{dist-CqC3taBS.js → dist-C_IQr_bg.js} +1 -1
- package/dist/public/assets/{dist-DSzqChbc.js → dist-Cdtf6fGT.js} +1 -1
- package/dist/public/assets/{dist-C_9BPzNE.js → dist-ClYcK7Yq.js} +1 -1
- package/dist/public/assets/dist-CoyydoqN.js +1 -0
- package/dist/public/assets/{dist-B0sSo1rx.js → dist-Csh9y0a0.js} +1 -1
- package/dist/public/assets/dist-CyYz03up.js +1 -0
- package/dist/public/assets/{dist-p4lElMBx.js → dist-DYyQPSDl.js} +1 -1
- package/dist/public/assets/dist-Dkr4jGYv.js +1 -0
- package/dist/public/assets/{dist-CPK5NxVp.js → dist-DmkgvB1A.js} +1 -1
- package/dist/public/assets/{dist-LqTeaHS1.js → dist-Dot7Y1W_.js} +1 -1
- package/dist/public/assets/{dist-BI2wTleN.js → dist-Gaq2suxg.js} +1 -1
- package/dist/public/assets/{dist-DfkfQshV.js → dist-HABBiN9I.js} +1 -1
- package/dist/public/assets/dist-fpPv-rVb.js +1 -0
- package/dist/public/assets/{dist-C9Q20TxL.js → dist-sRKGD4vA.js} +1 -1
- package/dist/public/assets/{doc-hash-CmkGIiUd.js → doc-hash-Ce3LmfP6.js} +1 -1
- package/dist/public/assets/{documents-events-CBqhEmHl.js → documents-events-BzQ1LRmI.js} +1 -1
- package/dist/public/assets/{erDiagram-SMLLAGMA-N7gNLe9o.js → erDiagram-SMLLAGMA-DYhY6Kqx.js} +1 -1
- package/dist/public/assets/eye-CWV-kBQc.js +1 -0
- package/dist/public/assets/{file-tree-adapter-BRoSU5bE.js → file-tree-adapter-CwWuHCOM.js} +1 -1
- package/dist/public/assets/{flatten-dENnAN6s.js → flatten-CQjVT6Ii.js} +1 -1
- package/dist/public/assets/{flowDiagram-DWJPFMVM-DgclgNSr.js → flowDiagram-DWJPFMVM-1K1AtH2O.js} +1 -1
- package/dist/public/assets/folder-open-ChJVxKuY.js +1 -0
- package/dist/public/assets/{ganttDiagram-T4ZO3ILL-CAydivVh.js → ganttDiagram-T4ZO3ILL-BeyyR9TG.js} +1 -1
- package/dist/public/assets/git-branch-YjYuPpdJ.js +1 -0
- package/dist/public/assets/gitGraph-7Q5UKJZL-Bte10OSc.js +1 -0
- package/dist/public/assets/{gitGraphDiagram-UUTBAWPF-Qfom5ijS.js → gitGraphDiagram-UUTBAWPF-DWgxXelB.js} +1 -1
- package/dist/public/assets/{graphlib-BZWt_BGf.js → graphlib-CK7mhD3w.js} +1 -1
- package/dist/public/assets/index-Ba1S3D-p.css +1 -0
- package/dist/public/assets/index-vCSQZ9S5.js +2003 -0
- package/dist/public/assets/info-BlYnsVoP.js +1 -0
- package/dist/public/assets/info-OMHHGYJF-DAVSj56v.js +1 -0
- package/dist/public/assets/{infoDiagram-42DDH7IO-BLFTlht0.js → infoDiagram-42DDH7IO-Di3j3EUh.js} +1 -1
- package/dist/public/assets/input-tW78aNaR.js +1 -0
- package/dist/public/assets/{isEmpty-Dg6Et8UD.js → isEmpty-DGhTXexw.js} +1 -1
- package/dist/public/assets/isSymbol-DRPcfi38.js +1 -0
- package/dist/public/assets/{ishikawaDiagram-UXIWVN3A-C8gBLX8v.js → ishikawaDiagram-UXIWVN3A-DI42GrR2.js} +1 -1
- package/dist/public/assets/{journeyDiagram-VCZTEJTY-DVV127Ia.js → journeyDiagram-VCZTEJTY-OV5qHmr0.js} +1 -1
- package/dist/public/assets/{kanban-definition-6JOO6SKY-Bi_LNUlw.js → kanban-definition-6JOO6SKY-CxQ7-Ree.js} +1 -1
- package/dist/public/assets/{keyboard-shortcuts-Dw2cvMMp.js → keyboard-shortcuts-B5l045PW.js} +1 -1
- package/dist/public/assets/label-DPn_C7ZD.js +1 -0
- package/dist/public/assets/{line-CuRBOqmw.js → line-Dkx8G9Yq.js} +1 -1
- package/dist/public/assets/{linear-BnfMN22g.js → linear-9Xx8T62b.js} +1 -1
- package/dist/public/assets/loader-circle-B7Gv_Djz.js +1 -0
- package/dist/public/assets/{mermaid-parser.core-noqTIfNm.js → mermaid-parser.core-Cwc31N0O.js} +2 -2
- package/dist/public/assets/{mermaid.core-DMKNygs1.js → mermaid.core-DAi9DT6V.js} +3 -3
- package/dist/public/assets/{mindmap-definition-QFDTVHPH-DLIIn_h8.js → mindmap-definition-QFDTVHPH-BWEBzSzW.js} +1 -1
- package/dist/public/assets/miss-dialog-store-PJQ_kr0I.js +1 -0
- package/dist/public/assets/{navigation-targets-G6yEVp6c.js → navigation-targets-XC4PBjfz.js} +1 -1
- package/dist/public/assets/{now-esIbxJzw.js → now-C37BZh9O.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-acLO8au6.js → open-managed-artifact-tab-DA0lLz1S.js} +1 -1
- package/dist/public/assets/{ordinal-DYUgOuL7.js → ordinal-CHifPrEh.js} +1 -1
- package/dist/public/assets/packet-4T2RLAQJ-BZDcl12z.js +1 -0
- package/dist/public/assets/panel-BH2RZRZQ.js +1 -0
- package/dist/public/assets/pending-receive-nav-store-BZqYvfd4.js +1 -0
- package/dist/public/assets/pie-ZZUOXDRM-D4-hdMsS.js +1 -0
- package/dist/public/assets/{pieDiagram-DEJITSTG-C-vgeRar.js → pieDiagram-DEJITSTG-BI6kYV3y.js} +1 -1
- package/dist/public/assets/project-paths-Bdm7wr4i.js +1 -0
- package/dist/public/assets/prop-types-BRDXyauO.js +1 -0
- package/dist/public/assets/{propagation-api-M_AcuP6N.js → propagation-api-BHhJitgG.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-34T5L4WZ-BmQcA7GQ.js → quadrantDiagram-34T5L4WZ-DoQSwIHy.js} +1 -1
- package/dist/public/assets/radar-PYXPWWZC-5qU-LNrp.js +1 -0
- package/dist/public/assets/radio-group-B0RG5um-.js +1 -0
- package/dist/public/assets/{receive-store-CrJ3w3k0.js → receive-store-BSTpqIWS.js} +1 -1
- package/dist/public/assets/{reduce-BKUJZ1TP.js → reduce-CTE0I3YX.js} +1 -1
- package/dist/public/assets/refresh-cw-CluaccKu.js +1 -0
- package/dist/public/assets/{requirementDiagram-MS252O5E-DPE-Czmf.js → requirementDiagram-MS252O5E-BEVc-KLK.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-XADWPNL6-C6mEVWX1.js → sankeyDiagram-XADWPNL6-2RCUEHbt.js} +1 -1
- package/dist/public/assets/{selection-context-8HFgCBJz.js → selection-context-D8rdwap3.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-FGHM5R23-rp9LrkhC.js → sequenceDiagram-FGHM5R23-BwxKjMu8.js} +1 -1
- package/dist/public/assets/skill-actions-B89T-zt1.js +1 -0
- package/dist/public/assets/skills-api-BCCSobN4.js +1 -0
- package/dist/public/assets/{src-sATQ-1TS.js → src-DYQWxrea.js} +1 -1
- package/dist/public/assets/{src-DldiksFQ.js → src-z-i21x0m.js} +1 -1
- package/dist/public/assets/{stateDiagram-FHFEXIEX-4q5ruYzC.js → stateDiagram-FHFEXIEX-C71hJfI3.js} +1 -1
- package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-Cw1nXPsQ.js +1 -0
- package/dist/public/assets/{target-navigation-intent-DIz1qTBm.js → target-navigation-intent-0O0lLUxg.js} +1 -1
- package/dist/public/assets/{telemetry-impl-Cs0UMIR2.js → telemetry-impl-DP51iS8w.js} +2 -2
- package/dist/public/assets/telemetry-startup-DK-ZExiC.js +1 -0
- package/dist/public/assets/textarea-CISJEQhO.js +1 -0
- package/dist/public/assets/{timeline-definition-GMOUNBTQ-CRtE2coR.js → timeline-definition-GMOUNBTQ-Bzsn0Uft.js} +1 -1
- package/dist/public/assets/toggle-group-CXHn0FKi.js +1 -0
- package/dist/public/assets/tooltip-FFg0kVkD.js +1 -0
- package/dist/public/assets/trash-2-Dcpo0Di-.js +1 -0
- package/dist/public/assets/treeView-SZITEDCU-BIqdNeir.js +1 -0
- package/dist/public/assets/treemap-W4RFUUIX-Bne30e5d.js +1 -0
- package/dist/public/assets/triangle-alert-c3yCucJv.js +1 -0
- package/dist/public/assets/typing-burst-detector-0csjpabL.js +6 -0
- package/dist/public/assets/{vennDiagram-DHZGUBPP-B5-arv9-.js → vennDiagram-DHZGUBPP-CnhxnPdb.js} +1 -1
- package/dist/public/assets/wardley-RL74JXVD-Bx6nHdkF.js +1 -0
- package/dist/public/assets/{wardleyDiagram-NUSXRM2D-NXmNnKuY.js → wardleyDiagram-NUSXRM2D-CynkQzsD.js} +1 -1
- package/dist/public/assets/workspace-paths-CgdsJHHk.js +1 -0
- package/dist/public/assets/{xychartDiagram-5P7HB3ND-B_cLbDrg.js → xychartDiagram-5P7HB3ND-Bwt6zYHi.js} +1 -1
- package/dist/public/index.html +83 -87
- package/dist/{repair-launch-json-DzczMayl.mjs → repair-launch-json-A83Cn4C3.mjs} +2 -2
- package/dist/repair-mcp-configs-Dp3AqC8R.mjs +2 -0
- package/dist/repair-skills-D5HH0xbe.mjs +1 -0
- package/dist/{repair-skills-XQg-rb3q.mjs → repair-skills-Dgp9yVUB.mjs} +2 -2
- package/dist/schemas/v0/config.project-local.schema.json +0 -17
- package/dist/server-lock-GuuouVft-xGs0zrNQ.mjs +1 -0
- package/dist/{server-lock-iLcBw_q0-DddnIrHS.mjs → server-lock-iLcBw_q0-6FEAZKHu.mjs} +45 -45
- package/dist/src-r-A-5thI.mjs +11 -0
- package/dist/start-B-mC7chd.mjs +1 -0
- package/dist/{start-Ig8o-wfe.mjs → start-uH8C-cIP.mjs} +2 -2
- package/dist/write-project-skill-XtppilgQ.mjs +36 -0
- package/package.json +1 -1
- package/dist/constants-B2EvNGWZ.mjs +0 -2
- package/dist/dist-DiaxTJ69.mjs +0 -1
- package/dist/init-1G9fj8cH.mjs +0 -639
- package/dist/init-MrbSP11w.mjs +0 -1
- package/dist/launch-json-removal-D3x1PYMJ.mjs +0 -2
- package/dist/loader-BvbWpeUk.mjs +0 -1
- package/dist/preview-CZN7WKk2.mjs +0 -1
- package/dist/public/assets/ActivityModeContent-BbFXNuKx.js +0 -2
- package/dist/public/assets/CodeMirrorPropInput-CHf8Iz40.js +0 -3
- package/dist/public/assets/ConsentDialogBody-TGvdiCLr.js +0 -2
- package/dist/public/assets/CopyButton-DoEsGDa4.js +0 -1
- package/dist/public/assets/DocumentContext-DG5n9u7B.js +0 -36
- package/dist/public/assets/EnableSyncConfirmDialog-CJzmvuen.js +0 -1
- package/dist/public/assets/GraphPanel-m-nt5HQn.js +0 -46
- package/dist/public/assets/ManagedArtifactProperties-BePO6ANU.js +0 -1
- package/dist/public/assets/McpConsentDialogBody-arNbqqes.js +0 -1
- package/dist/public/assets/PropertyPanel-DUZsqzTw.js +0 -2
- package/dist/public/assets/ReportBugDialogBody-CJkfjKa2.js +0 -2
- package/dist/public/assets/SettingsDialogBody-BPlL1Yed.js +0 -7
- package/dist/public/assets/ShareBranchSwitchDialog-DSKoiVrF.js +0 -1
- package/dist/public/assets/ShareReceiveDialog-Bvh3tHuH.js +0 -1
- package/dist/public/assets/ShareReceiveMissDialog-Bdk7y3ML.js +0 -1
- package/dist/public/assets/SkillEditorActions-oiOuAa4I.js +0 -1
- package/dist/public/assets/SourceEditor-Df_8kdW5.js +0 -1
- package/dist/public/assets/agent-presence-Dl0E_LN8.js +0 -1
- package/dist/public/assets/architecture-YZFGNWBL-9BNhGkdz.js +0 -1
- package/dist/public/assets/arrow-up-right-Bj9cWgcz.js +0 -1
- package/dist/public/assets/auth-state-cache-BSJEl4LS.js +0 -11
- package/dist/public/assets/calendar-B2qs7swV.js +0 -1
- package/dist/public/assets/channel-CuMNseph.js +0 -1
- package/dist/public/assets/check-nyYgwOgK.js +0 -1
- package/dist/public/assets/checkbox-CgcvT5md.js +0 -1
- package/dist/public/assets/chevron-down-B4gqqe-h.js +0 -1
- package/dist/public/assets/chevron-left-aRnXScdx.js +0 -1
- package/dist/public/assets/chevron-right-DjreZbLo.js +0 -1
- package/dist/public/assets/chunk-426QAEUC-pZbdhoaS.js +0 -1
- package/dist/public/assets/chunk-55IACEB6-HEGApgMn.js +0 -1
- package/dist/public/assets/chunk-QZHKN3VN-DI8KBGbP.js +0 -1
- package/dist/public/assets/classDiagram-6PBFFD2Q-D98rNdcz.js +0 -1
- package/dist/public/assets/classDiagram-v2-HSJHXN6E-Cz77sXrt.js +0 -1
- package/dist/public/assets/clipboard-adapter-BYqGVFAr.js +0 -1
- package/dist/public/assets/clone-DXiEg0sZ.js +0 -1
- package/dist/public/assets/collapsible-Cc4bgirL.js +0 -1
- package/dist/public/assets/config-provider-CFiLGdZF.js +0 -4
- package/dist/public/assets/copy-D8YVE0Jc.js +0 -1
- package/dist/public/assets/createLucideIcon-BPhNPfG7.js +0 -1
- package/dist/public/assets/dialog-BvTRDNMV.js +0 -45
- package/dist/public/assets/dist-B0Ibo2lT.js +0 -1
- package/dist/public/assets/dist-BR1KZiCX.js +0 -1
- package/dist/public/assets/dist-BhVkC6Rc.js +0 -1
- package/dist/public/assets/dist-CaqI7EF5.js +0 -1
- package/dist/public/assets/dist-jyqE5kfZ.js +0 -1
- package/dist/public/assets/eye-W_Da58Av.js +0 -1
- package/dist/public/assets/folder-open-DVXRBalt.js +0 -1
- package/dist/public/assets/git-branch-BfSSsaKF.js +0 -1
- package/dist/public/assets/gitGraph-7Q5UKJZL-DuuJiYvS.js +0 -1
- package/dist/public/assets/index-C3IDVWhb.css +0 -1
- package/dist/public/assets/index-FeSh48__.js +0 -2003
- package/dist/public/assets/info-DsmJgZ0m.js +0 -1
- package/dist/public/assets/info-OMHHGYJF-DmgDPzke.js +0 -1
- package/dist/public/assets/input-tBscWWrn.js +0 -1
- package/dist/public/assets/isSymbol-BhYgyzzO.js +0 -1
- package/dist/public/assets/label-DmfuSB7r.js +0 -1
- package/dist/public/assets/loader-circle-IFoG3v_v.js +0 -1
- package/dist/public/assets/miss-dialog-store-E61ZbtU3.js +0 -1
- package/dist/public/assets/packet-4T2RLAQJ-CVcq-ivT.js +0 -1
- package/dist/public/assets/panel-HcGnbQ9h.js +0 -1
- package/dist/public/assets/pending-receive-nav-store-omPUhaeY.js +0 -1
- package/dist/public/assets/pie-ZZUOXDRM-DSvYqp8t.js +0 -1
- package/dist/public/assets/project-paths-CqH22Xq0.js +0 -1
- package/dist/public/assets/prop-types-6gA_YVnm.js +0 -1
- package/dist/public/assets/radar-PYXPWWZC-BrGdIzLo.js +0 -1
- package/dist/public/assets/radio-group-DyHNJs2C.js +0 -1
- package/dist/public/assets/refresh-cw-C6wj273J.js +0 -1
- package/dist/public/assets/skill-actions-D2r7iq9h.js +0 -1
- package/dist/public/assets/skills-api-DvU5qnRa.js +0 -1
- package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-9Y5TkQAw.js +0 -1
- package/dist/public/assets/telemetry-startup-BO7q-IdH.js +0 -1
- package/dist/public/assets/textarea-IugbKaIV.js +0 -1
- package/dist/public/assets/toggle-group-Hn7Etr9N.js +0 -1
- package/dist/public/assets/tooltip-tSMIHkKA.js +0 -1
- package/dist/public/assets/trash-2-DuQrfywu.js +0 -1
- package/dist/public/assets/treeView-SZITEDCU-C_aWaIS6.js +0 -1
- package/dist/public/assets/treemap-W4RFUUIX-CcQyutfG.js +0 -1
- package/dist/public/assets/triangle-alert-CX4BgEzP.js +0 -1
- package/dist/public/assets/typing-burst-detector-DP8u_tQC.js +0 -6
- package/dist/public/assets/wardley-RL74JXVD-B57ZwOFM.js +0 -1
- package/dist/public/assets/workspace-paths-Dj3MgOE7.js +0 -1
- package/dist/public/assets/x-Bcc1k6VU.js +0 -1
- package/dist/repair-mcp-configs-Cp5VRehu.mjs +0 -2
- package/dist/repair-skills-B-9mVcmb.mjs +0 -1
- package/dist/server-lock-GuuouVft-C6kYMpa7.mjs +0 -1
- package/dist/src-CZcBOOJs.mjs +0 -21
- package/dist/start-DcvuVtnN.mjs +0 -1
- package/dist/write-project-skill-DV1PSHkd.mjs +0 -50
- /package/dist/public/assets/{ActivityPanelDiffView-B2UyxRqh.js → ActivityPanelDiffView-BWnxl5f-.js} +0 -0
- /package/dist/public/assets/{__vite-browser-external-DWP-nnLG.js → __vite-browser-external-TJ7c6L0o.js} +0 -0
- /package/dist/public/assets/{array-DCThpSXQ.js → array-FgcTybOD.js} +0 -0
- /package/dist/public/assets/{clike-DBPhSRc7.js → clike-Dwn0hkfx.js} +0 -0
- /package/dist/public/assets/{colors-BWTxgr-H.js → colors-D6fuRjk1.js} +0 -0
- /package/dist/public/assets/{config-context-B9tR3DuQ.js → config-context-CE3SCVYc.js} +0 -0
- /package/dist/public/assets/{cytoscape.esm-DI3FlJaw.js → cytoscape.esm-Dzv7Z08T.js} +0 -0
- /package/dist/public/assets/{defaultLocale-CRhqsANo.js → defaultLocale-B8_UIoxV.js} +0 -0
- /package/dist/public/assets/{desktop-bridge-types-BTzWYfK3.js → desktop-bridge-types-NXCK8Pd7.js} +0 -0
- /package/dist/public/assets/{diff-Drz_kYcR.js → diff-7ylxwA-Z.js} +0 -0
- /package/dist/public/assets/{dist-URshSBRl.js → dist-84zLmbM_.js} +0 -0
- /package/dist/public/assets/{dist-BRGTi0a4.js → dist-BvBijIC5.js} +0 -0
- /package/dist/public/assets/{dist-DXmpSd5X.js → dist-BzWUi0nJ.js} +0 -0
- /package/dist/public/assets/{documents-fetch-B7M_d64D.js → documents-fetch-oup83IZh.js} +0 -0
- /package/dist/public/assets/{external-link-Ds9yTh4D.js → external-link-DvDOavYT.js} +0 -0
- /package/dist/public/assets/{file-tree-rename-validation-DcXYaYEd.js → file-tree-rename-validation-DeKIxKnc.js} +0 -0
- /package/dist/public/assets/{floating-ui.dom-B3TJy2Tg.js → floating-ui.dom-DVRWCLii.js} +0 -0
- /package/dist/public/assets/{format-Dfi8-r7-.js → format-CC5hmMSn.js} +0 -0
- /package/dist/public/assets/{go-BpmSPnTF.js → go-DUVmyJ08.js} +0 -0
- /package/dist/public/assets/{init-Do59aTWs.js → init-BG_j-rIv.js} +0 -0
- /package/dist/public/assets/{isObjectLike-DBZB8Di0.js → isObjectLike-B-1HrArC.js} +0 -0
- /package/dist/public/assets/{katex-C_q0VtM5.js → katex-BunQWEOH.js} +0 -0
- /package/dist/public/assets/{lua-C_zL8YdL.js → lua-Deq9zhNp.js} +0 -0
- /package/dist/public/assets/{mcp-consent-store-Q4I4TJ6C.js → mcp-consent-store-BowAuxpw.js} +0 -0
- /package/dist/public/assets/{min-CHYmOP54.js → min-CFR8cRpW.js} +0 -0
- /package/dist/public/assets/{panzoom.es-IG_ffrHS.js → panzoom.es-B5TJP3N-.js} +0 -0
- /package/dist/public/assets/{parse-api-error-CKwNHPHP.js → parse-api-error-CqtA8BcL.js} +0 -0
- /package/dist/public/assets/{path-BumxrnWh.js → path-C0E9fOMz.js} +0 -0
- /package/dist/public/assets/{pdf-Dfrvv9Dp.js → pdf-BC6z-ijO.js} +0 -0
- /package/dist/public/assets/{pdf.worker-BW4O2Ok7.js → pdf.worker-CoJyScAX.js} +0 -0
- /package/dist/public/assets/{perl-CBgKNlH2.js → perl-D0WL8lyk.js} +0 -0
- /package/dist/public/assets/{properties-CYWLEd9P.js → properties-wKN3JgMQ.js} +0 -0
- /package/dist/public/assets/{r-C7V19TwF.js → r-B9o_5PRF.js} +0 -0
- /package/dist/public/assets/{rough.esm-DGd9yuC8.js → rough.esm-ClvsyqQj.js} +0 -0
- /package/dist/public/assets/{ruby-XhXUlf0J.js → ruby-DTqG95KX.js} +0 -0
- /package/dist/public/assets/{share-metadata-rows-C9T0cDSG.js → share-metadata-rows-DexRdF2p.js} +0 -0
- /package/dist/public/assets/{shell-CGj6v8kb.js → shell-DDux6XjL.js} +0 -0
- /package/dist/public/assets/{sql-CLlqBctF.js → sql-Drqtn151.js} +0 -0
- /package/dist/public/assets/{src-DHCu-mNI.js → src-DQSPzvWZ.js} +0 -0
- /package/dist/public/assets/{startup-marks-DkfPsa68.js → startup-marks-DDtA9pbt.js} +0 -0
- /package/dist/public/assets/{stex-Bt71ugp5.js → stex-4t0JIuX_.js} +0 -0
- /package/dist/public/assets/{swift-C_3ADj_i.js → swift-B0YNGkay.js} +0 -0
- /package/dist/public/assets/{toml-DohB9k6t.js → toml-DU2M2RLq.js} +0 -0
- /package/dist/public/assets/{trace-api-BIWqyPc9.js → trace-api-D6fqC5Nw.js} +0 -0
- /package/dist/public/assets/{w3c-keyname-CRPBoZED.js → w3c-keyname-CHcJEDvG.js} +0 -0
- /package/dist/public/assets/{worktree-store-DfQ15jw3.js → worktree-store-CPUnHORD.js} +0 -0
|
@@ -151,7 +151,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
151
151
|
|
|
152
152
|
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Nt,s=!vt.jitless,c=s&&Pt.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?oi([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function li(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Yt(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Qt(e,r,yt())))}),t)}const ui=O(`$ZodUnion`,(e,t)=>{br.init(e,t),Dt(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Dt(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Dt(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Dt(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>wt(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>li(t,i,e,a)):li(s,i,e,a)}}),di=O(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,ui.init(e,t);let n=e._zod.parse;Dt(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=St(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!Nt(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),fi=O(`$ZodIntersection`,(e,t)=>{br.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>mi(e,t,n)):mi(e,i,a)}});function pi(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ft(e)&&Ft(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=pi(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=pi(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function mi(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Yt(e))return e;let o=pi(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const hi=O(`$ZodRecord`,(e,t)=>{br.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Ft(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...Xt(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...Xt(e,o.issues)),n.value[e]=o.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Xn.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Qt(e,r,yt())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...Xt(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Xt(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),gi=O(`$ZodEnum`,(e,t)=>{br.init(e,t);let n=bt(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Lt.has(typeof e)).map(e=>typeof e==`string`?Rt(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),_i=O(`$ZodLiteral`,(e,t)=>{if(br.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Rt(e):e?Rt(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),vi=O(`$ZodTransform`,(e,t)=>{br.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new _t(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new gt;return n.value=i,n}});function yi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const bi=O(`$ZodOptional`,(e,t)=>{br.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Dt(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Dt(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${wt(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>yi(t,e.value)):yi(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),xi=O(`$ZodExactOptional`,(e,t)=>{bi.init(e,t),Dt(e._zod,`values`,()=>t.innerType._zod.values),Dt(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Si=O(`$ZodNullable`,(e,t)=>{br.init(e,t),Dt(e._zod,`optin`,()=>t.innerType._zod.optin),Dt(e._zod,`optout`,()=>t.innerType._zod.optout),Dt(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${wt(e.source)}|null)$`):void 0}),Dt(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ci=O(`$ZodDefault`,(e,t)=>{br.init(e,t),e._zod.optin=`optional`,Dt(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>wi(e,t)):wi(r,t)}});function wi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Ti=O(`$ZodPrefault`,(e,t)=>{br.init(e,t),e._zod.optin=`optional`,Dt(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Ei=O(`$ZodNonOptional`,(e,t)=>{br.init(e,t),Dt(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Di(t,e)):Di(i,e)}});function Di(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const Oi=O(`$ZodCatch`,(e,t)=>{br.init(e,t),Dt(e._zod,`optin`,()=>t.innerType._zod.optin),Dt(e._zod,`optout`,()=>t.innerType._zod.optout),Dt(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Qt(e,n,yt()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Qt(e,n,yt()))},input:e.value}),e.issues=[]),e)}}),ki=O(`$ZodPipe`,(e,t)=>{br.init(e,t),Dt(e._zod,`values`,()=>t.in._zod.values),Dt(e._zod,`optin`,()=>t.in._zod.optin),Dt(e._zod,`optout`,()=>t.out._zod.optout),Dt(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Ai(e,t.in,n)):Ai(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ai(e,t.out,n)):Ai(r,t.out,n)}});function Ai(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const ji=O(`$ZodReadonly`,(e,t)=>{br.init(e,t),Dt(e._zod,`propValues`,()=>t.innerType._zod.propValues),Dt(e._zod,`values`,()=>t.innerType._zod.values),Dt(e._zod,`optin`,()=>t.innerType?._zod?.optin),Dt(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Mi):Mi(r)}});function Mi(e){return e.value=Object.freeze(e.value),e}const Ni=O(`$ZodLazy`,(e,t)=>{br.init(e,t),Dt(e._zod,`innerType`,()=>t.getter()),Dt(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),Dt(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),Dt(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),Dt(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Pi=O(`$ZodCustom`,(e,t)=>{tr.init(e,t),br.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Fi(t,n,r,e));Fi(i,n,r,e)}});function Fi(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(en(e))}}var Ii,Li=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Ri(){return new Li}(Ii=globalThis).__zod_globalRegistry??(Ii.__zod_globalRegistry=Ri());const zi=globalThis.__zod_globalRegistry;function Bi(e,t){return new e({type:`string`,...k(t)})}function Vi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...k(t)})}function Hi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...k(t)})}function Ui(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...k(t)})}function Wi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...k(t)})}function Gi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...k(t)})}function Ki(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...k(t)})}function qi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...k(t)})}function Ji(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...k(t)})}function Yi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...k(t)})}function Xi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...k(t)})}function Zi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...k(t)})}function Qi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...k(t)})}function $i(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...k(t)})}function ea(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...k(t)})}function ta(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...k(t)})}function na(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...k(t)})}function ra(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...k(t)})}function ia(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...k(t)})}function aa(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...k(t)})}function oa(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...k(t)})}function sa(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...k(t)})}function ca(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...k(t)})}function la(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...k(t)})}function ua(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...k(t)})}function da(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...k(t)})}function fa(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...k(t)})}function pa(e,t){return new e({type:`number`,checks:[],...k(t)})}function ma(e,t){return new e({type:`number`,coerce:!0,checks:[],...k(t)})}function ha(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...k(t)})}function ga(e,t){return new e({type:`boolean`,...k(t)})}function _a(e,t){return new e({type:`null`,...k(t)})}function va(e){return new e({type:`any`})}function ya(e){return new e({type:`unknown`})}function ba(e,t){return new e({type:`never`,...k(t)})}function xa(e,t){return new rr({check:`less_than`,...k(t),value:e,inclusive:!1})}function Sa(e,t){return new rr({check:`less_than`,...k(t),value:e,inclusive:!0})}function Ca(e,t){return new ir({check:`greater_than`,...k(t),value:e,inclusive:!1})}function wa(e,t){return new ir({check:`greater_than`,...k(t),value:e,inclusive:!0})}function Ta(e,t){return new ar({check:`multiple_of`,...k(t),value:e})}function Ea(e,t){return new sr({check:`max_length`,...k(t),maximum:e})}function Da(e,t){return new cr({check:`min_length`,...k(t),minimum:e})}function Oa(e,t){return new lr({check:`length_equals`,...k(t),length:e})}function ka(e,t){return new dr({check:`string_format`,format:`regex`,...k(t),pattern:e})}function Aa(e){return new fr({check:`string_format`,format:`lowercase`,...k(e)})}function ja(e){return new pr({check:`string_format`,format:`uppercase`,...k(e)})}function Ma(e,t){return new mr({check:`string_format`,format:`includes`,...k(t),includes:e})}function Na(e,t){return new hr({check:`string_format`,format:`starts_with`,...k(t),prefix:e})}function Pa(e,t){return new gr({check:`string_format`,format:`ends_with`,...k(t),suffix:e})}function Fa(e){return new _r({check:`overwrite`,tx:e})}function Ia(e){return Fa(t=>t.normalize(e))}function La(){return Fa(e=>e.trim())}function Ra(){return Fa(e=>e.toLowerCase())}function za(){return Fa(e=>e.toUpperCase())}function Ba(){return Fa(e=>jt(e))}function Va(e,t,n){return new e({type:`array`,element:t,...k(n)})}function Ha(e,t,n){let r=k(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function Ua(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...k(n)})}function Wa(e){let t=Ga(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(en(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(en(r))}},e(n.value,n)));return t}function Ga(e,t){let n=new tr({check:`custom`,...k(t)});return n._zod.check=e,n}function Ka(e){let t=new tr({check:`describe`});return t._zod.onattach=[t=>{let n=zi.get(t)??{};zi.add(t,{...n,description:e})}],t._zod.check=()=>{},t}function qa(e){let t=new tr({check:`meta`});return t._zod.onattach=[t=>{let n=zi.get(t)??{};zi.add(t,{...n,...e})}],t._zod.check=()=>{},t}function Ja(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??zi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Ya(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Ya(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Qa(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Xa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
153
153
|
|
|
154
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Za(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:eo(t,`input`,e.processors),output:eo(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Qa(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Qa(r.element,n);if(r.type===`set`)return Qa(r.valueType,n);if(r.type===`lazy`)return Qa(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Qa(r.innerType,n);if(r.type===`intersection`)return Qa(r.left,n)||Qa(r.right,n);if(r.type===`record`||r.type===`map`)return Qa(r.keyType,n)||Qa(r.valueType,n);if(r.type===`pipe`)return Qa(r.in,n)||Qa(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Qa(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Qa(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Qa(e,n))return!0;return!!(r.rest&&Qa(r.rest,n))}return!1}const $a=(e,t={})=>n=>{let r=Ja({...n,processors:t});return Ya(e,r),Xa(r,e),Za(r,e)},eo=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ja({...i??{},target:a,io:t,processors:n});return Ya(e,o),Xa(o,e),Za(o,e)},to={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},no=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=to[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},ro=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},io=(e,t,n,r)=>{n.type=`boolean`},ao=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},oo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},so=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},co=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},lo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},uo=(e,t,n,r)=>{n.not={}},fo=(e,t,n,r)=>{},po=(e,t,n,r)=>{},mo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},ho=(e,t,n,r)=>{let i=e._zod.def,a=bt(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},go=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},_o=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},vo=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},yo=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},bo=(e,t,n,r)=>{n.type=`boolean`},xo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},So=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Co=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},wo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},To=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},Eo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Ya(a.element,t,{...r,path:[...r.path,`items`]})},Do=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Ya(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Ya(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Oo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ya(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ko=(e,t,n,r)=>{let i=e._zod.def,a=Ya(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ya(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Ao=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Ya(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Ya(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},jo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Ya(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Ya(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Ya(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Mo=(e,t,n,r)=>{let i=e._zod.def,a=Ya(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},No=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Po=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Fo=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Io=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Lo=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Ya(a,t,r);let o=t.seen.get(e);o.ref=a},Ro=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},zo=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Bo=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Vo=(e,t,n,r)=>{let i=e._zod.innerType;Ya(i,t,r);let a=t.seen.get(e);a.ref=i},Ho={string:no,number:ro,boolean:io,bigint:ao,symbol:oo,null:so,undefined:co,void:lo,never:uo,any:fo,unknown:po,date:mo,enum:ho,literal:go,nan:_o,template_literal:vo,file:yo,success:bo,custom:xo,function:So,transform:Co,map:wo,set:To,array:Eo,object:Do,union:Oo,intersection:ko,tuple:Ao,record:jo,nullable:Mo,nonoptional:No,default:Po,prefault:Fo,catch:Io,pipe:Lo,readonly:Ro,promise:zo,optional:Bo,lazy:Vo};function Uo(e,t){if(`_idmap`in e){let n=e,r=Ja({...t,processors:Ho}),i={};for(let e of n._idmap.entries()){let[t,n]=e;Ya(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Xa(r,n),a[t]=Za(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Ja({...t,processors:Ho});return Ya(e,n),Xa(n,e),Za(n,e)}const Wo=O(`ZodISODateTime`,(e,t)=>{Pr.init(e,t),gs.init(e,t)});function Go(e){return la(Wo,e)}const Ko=O(`ZodISODate`,(e,t)=>{Fr.init(e,t),gs.init(e,t)});function qo(e){return ua(Ko,e)}const Jo=O(`ZodISOTime`,(e,t)=>{Ir.init(e,t),gs.init(e,t)});function Yo(e){return da(Jo,e)}const Xo=O(`ZodISODuration`,(e,t)=>{Lr.init(e,t),gs.init(e,t)});function Zo(e){return fa(Xo,e)}const Qo=(e,t)=>{nn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>on(e,t)},flatten:{value:t=>an(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,xt,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,xt,2)}},isEmpty:{get(){return e.issues.length===0}}})};O(`ZodError`,Qo);const $o=O(`ZodError`,Qo,{Parent:Error}),es=ln($o),ts=dn($o),ns=pn($o),rs=hn($o),is=_n($o),as=vn($o),ss=yn($o),cs=bn($o),ls=xn($o),us=Sn($o),ds=Cn($o),fs=wn($o),ps=O(`ZodType`,(e,t)=>(br.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:eo(e,`input`),output:eo(e,`output`)}}),e.toJSONSchema=$a(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(kt(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>zt(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>es(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ns(e,t,n),e.parseAsync=async(t,n)=>ts(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>rs(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>is(e,t,n),e.decode=(t,n)=>as(e,t,n),e.encodeAsync=async(t,n)=>ss(e,t,n),e.decodeAsync=async(t,n)=>cs(e,t,n),e.safeEncode=(t,n)=>ls(e,t,n),e.safeDecode=(t,n)=>us(e,t,n),e.safeEncodeAsync=async(t,n)=>ds(e,t,n),e.safeDecodeAsync=async(t,n)=>fs(e,t,n),e.refine=(t,n)=>e.check(Mc(t,n)),e.superRefine=t=>e.check(Nc(t)),e.overwrite=t=>e.check(Fa(t)),e.optional=()=>dc(e),e.exactOptional=()=>pc(e),e.nullable=()=>hc(e),e.nullish=()=>dc(hc(e)),e.nonoptional=t=>xc(e,t),e.array=()=>N(e),e.or=t=>$s([e,t]),e.and=t=>rc(e,t),e.transform=t=>Tc(e,lc(t)),e.default=t=>_c(e,t),e.prefault=t=>yc(e,t),e.catch=t=>Cc(e,t),e.pipe=t=>Tc(e,t),e.readonly=()=>Dc(e),e.describe=t=>{let n=e.clone();return zi.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return zi.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return zi.get(e);let n=e.clone();return zi.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),ms=O(`_ZodString`,(e,t)=>{xr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(ka(...t)),e.includes=(...t)=>e.check(Ma(...t)),e.startsWith=(...t)=>e.check(Na(...t)),e.endsWith=(...t)=>e.check(Pa(...t)),e.min=(...t)=>e.check(Da(...t)),e.max=(...t)=>e.check(Ea(...t)),e.length=(...t)=>e.check(Oa(...t)),e.nonempty=(...t)=>e.check(Da(1,...t)),e.lowercase=t=>e.check(Aa(t)),e.uppercase=t=>e.check(ja(t)),e.trim=()=>e.check(La()),e.normalize=(...t)=>e.check(Ia(...t)),e.toLowerCase=()=>e.check(Ra()),e.toUpperCase=()=>e.check(za()),e.slugify=()=>e.check(Ba())}),hs=O(`ZodString`,(e,t)=>{xr.init(e,t),ms.init(e,t),e.email=t=>e.check(Vi(_s,t)),e.url=t=>e.check(qi(bs,t)),e.jwt=t=>e.check(ca(Is,t)),e.emoji=t=>e.check(Ji(Ss,t)),e.guid=t=>e.check(Hi(vs,t)),e.uuid=t=>e.check(Ui(ys,t)),e.uuidv4=t=>e.check(Wi(ys,t)),e.uuidv6=t=>e.check(Gi(ys,t)),e.uuidv7=t=>e.check(Ki(ys,t)),e.nanoid=t=>e.check(Yi(Cs,t)),e.guid=t=>e.check(Hi(vs,t)),e.cuid=t=>e.check(Xi(ws,t)),e.cuid2=t=>e.check(Zi(Ts,t)),e.ulid=t=>e.check(Qi(Es,t)),e.base64=t=>e.check(aa(Ns,t)),e.base64url=t=>e.check(oa(Ps,t)),e.xid=t=>e.check($i(Ds,t)),e.ksuid=t=>e.check(ea(Os,t)),e.ipv4=t=>e.check(ta(ks,t)),e.ipv6=t=>e.check(na(As,t)),e.cidrv4=t=>e.check(ra(js,t)),e.cidrv6=t=>e.check(ia(Ms,t)),e.e164=t=>e.check(sa(Fs,t)),e.datetime=t=>e.check(Go(t)),e.date=t=>e.check(qo(t)),e.time=t=>e.check(Yo(t)),e.duration=t=>e.check(Zo(t))});function A(e){return Bi(hs,e)}const gs=O(`ZodStringFormat`,(e,t)=>{Sr.init(e,t),ms.init(e,t)}),_s=O(`ZodEmail`,(e,t)=>{Tr.init(e,t),gs.init(e,t)}),vs=O(`ZodGUID`,(e,t)=>{Cr.init(e,t),gs.init(e,t)}),ys=O(`ZodUUID`,(e,t)=>{wr.init(e,t),gs.init(e,t)}),bs=O(`ZodURL`,(e,t)=>{Er.init(e,t),gs.init(e,t)});function xs(e){return qi(bs,e)}const Ss=O(`ZodEmoji`,(e,t)=>{Dr.init(e,t),gs.init(e,t)}),Cs=O(`ZodNanoID`,(e,t)=>{Or.init(e,t),gs.init(e,t)}),ws=O(`ZodCUID`,(e,t)=>{kr.init(e,t),gs.init(e,t)}),Ts=O(`ZodCUID2`,(e,t)=>{Ar.init(e,t),gs.init(e,t)}),Es=O(`ZodULID`,(e,t)=>{jr.init(e,t),gs.init(e,t)}),Ds=O(`ZodXID`,(e,t)=>{Mr.init(e,t),gs.init(e,t)}),Os=O(`ZodKSUID`,(e,t)=>{Nr.init(e,t),gs.init(e,t)}),ks=O(`ZodIPv4`,(e,t)=>{Rr.init(e,t),gs.init(e,t)}),As=O(`ZodIPv6`,(e,t)=>{zr.init(e,t),gs.init(e,t)}),js=O(`ZodCIDRv4`,(e,t)=>{Br.init(e,t),gs.init(e,t)}),Ms=O(`ZodCIDRv6`,(e,t)=>{Vr.init(e,t),gs.init(e,t)}),Ns=O(`ZodBase64`,(e,t)=>{Ur.init(e,t),gs.init(e,t)}),Ps=O(`ZodBase64URL`,(e,t)=>{Gr.init(e,t),gs.init(e,t)}),Fs=O(`ZodE164`,(e,t)=>{Kr.init(e,t),gs.init(e,t)}),Is=O(`ZodJWT`,(e,t)=>{Jr.init(e,t),gs.init(e,t)}),Ls=O(`ZodNumber`,(e,t)=>{Yr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),e.gt=(t,n)=>e.check(Ca(t,n)),e.gte=(t,n)=>e.check(wa(t,n)),e.min=(t,n)=>e.check(wa(t,n)),e.lt=(t,n)=>e.check(xa(t,n)),e.lte=(t,n)=>e.check(Sa(t,n)),e.max=(t,n)=>e.check(Sa(t,n)),e.int=t=>e.check(zs(t)),e.safe=t=>e.check(zs(t)),e.positive=t=>e.check(Ca(0,t)),e.nonnegative=t=>e.check(wa(0,t)),e.negative=t=>e.check(xa(0,t)),e.nonpositive=t=>e.check(Sa(0,t)),e.multipleOf=(t,n)=>e.check(Ta(t,n)),e.step=(t,n)=>e.check(Ta(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function j(e){return pa(Ls,e)}const Rs=O(`ZodNumberFormat`,(e,t)=>{Xr.init(e,t),Ls.init(e,t)});function zs(e){return ha(Rs,e)}const Bs=O(`ZodBoolean`,(e,t)=>{Zr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r)});function M(e){return ga(Bs,e)}const Vs=O(`ZodNull`,(e,t)=>{Qr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r)});function Hs(e){return _a(Vs,e)}const Us=O(`ZodAny`,(e,t)=>{$r.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ws(){return va(Us)}const Gs=O(`ZodUnknown`,(e,t)=>{ei.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ks(){return ya(Gs)}const qs=O(`ZodNever`,(e,t)=>{ti.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r)});function Js(e){return ba(qs,e)}const Ys=O(`ZodArray`,(e,t)=>{ri.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Da(t,n)),e.nonempty=t=>e.check(Da(1,t)),e.max=(t,n)=>e.check(Ea(t,n)),e.length=(t,n)=>e.check(Oa(t,n)),e.unwrap=()=>e.element});function N(e,t){return Va(Ys,e,t)}const Xs=O(`ZodObject`,(e,t)=>{ci.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r),Dt(e,`shape`,()=>t.shape),e.keyof=()=>F(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ks()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ks()}),e.strict=()=>e.clone({...e._zod.def,catchall:Js()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Wt(e,t),e.safeExtend=t=>Gt(e,t),e.merge=t=>Kt(e,t),e.pick=t=>Ht(e,t),e.omit=t=>Ut(e,t),e.partial=(...t)=>qt(uc,e,t[0]),e.required=(...t)=>Jt(bc,e,t[0])});function P(e,t){return new Xs({type:`object`,shape:e??{},...k(t)})}function Zs(e,t){return new Xs({type:`object`,shape:e,catchall:Ks(),...k(t)})}const Qs=O(`ZodUnion`,(e,t)=>{ui.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.options=t.options});function $s(e,t){return new Qs({type:`union`,options:e,...k(t)})}const ec=O(`ZodDiscriminatedUnion`,(e,t)=>{Qs.init(e,t),di.init(e,t)});function tc(e,t,n){return new ec({type:`union`,options:t,discriminator:e,...k(n)})}const nc=O(`ZodIntersection`,(e,t)=>{fi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r)});function rc(e,t){return new nc({type:`intersection`,left:e,right:t})}const ic=O(`ZodRecord`,(e,t)=>{hi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function ac(e,t,n){return new ic({type:`record`,keyType:e,valueType:t,...k(n)})}const oc=O(`ZodEnum`,(e,t)=>{gi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new oc({...t,checks:[],...k(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new oc({...t,checks:[],...k(r),entries:i})}});function F(e,t){return new oc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...k(t)})}const sc=O(`ZodLiteral`,(e,t)=>{_i.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function I(e,t){return new sc({type:`literal`,values:Array.isArray(e)?e:[e],...k(t)})}const cc=O(`ZodTransform`,(e,t)=>{vi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new _t(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(en(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(en(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function lc(e){return new cc({type:`transform`,transform:e})}const uc=O(`ZodOptional`,(e,t)=>{bi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dc(e){return new uc({type:`optional`,innerType:e})}const fc=O(`ZodExactOptional`,(e,t)=>{xi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pc(e){return new fc({type:`optional`,innerType:e})}const mc=O(`ZodNullable`,(e,t)=>{Si.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hc(e){return new mc({type:`nullable`,innerType:e})}const gc=O(`ZodDefault`,(e,t)=>{Ci.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function _c(e,t){return new gc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():It(t)}})}const vc=O(`ZodPrefault`,(e,t)=>{Ti.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yc(e,t){return new vc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():It(t)}})}const bc=O(`ZodNonOptional`,(e,t)=>{Ei.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xc(e,t){return new bc({type:`nonoptional`,innerType:e,...k(t)})}const Sc=O(`ZodCatch`,(e,t)=>{Oi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Cc(e,t){return new Sc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const wc=O(`ZodPipe`,(e,t)=>{ki.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.in=t.in,e.out=t.out});function Tc(e,t){return new wc({type:`pipe`,in:e,out:t})}const Ec=O(`ZodReadonly`,(e,t)=>{ji.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dc(e){return new Ec({type:`readonly`,innerType:e})}const Oc=O(`ZodLazy`,(e,t)=>{Ni.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function kc(e){return new Oc({type:`lazy`,getter:e})}const Ac=O(`ZodCustom`,(e,t)=>{Pi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r)});function jc(e,t){return Ha(Ac,e??(()=>!0),t)}function Mc(e,t={}){return Ua(Ac,e,t)}function Nc(e){return Wa(e)}function Pc(e,t){return Tc(lc(e),t)}var Fc=mt();a();const Ic=new Set(Object.keys({sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`})),Lc=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],Rc=[`video/mp4`,`video/webm`,`video/ogg`],zc=[`audio/mpeg`,`audio/wav`,`audio/ogg`],Bc=[`application/pdf`],Vc=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),Hc=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),Uc=new Set([`pdf`]),Wc=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Gc=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Kc=new Set(`exe.bat.cmd.ps1.com.msi.vbs.js.jse.wsf.wsh.hta.sh.command.csh.ksh.bash.zsh.fish.desktop.action.workflow.html.htm.svg.xml.mhtml.svgz.dmg.pkg.mpkg.scpt.applescript.terminal.prefpane.webloc.inetloc.fileloc.jar.appimage.deb.rpm.msix.appx.ipa.apk.pif.scr.lnk.url`.split(`.`)),qc=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),Jc=new Set([`html`,`htm`]),Yc=`sandbox allow-scripts; connect-src 'none'`,Xc=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml.lock`.split(`.`)),Zc=`same-dir`,Qc=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),$c=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],el=[`mp4`,`webm`,`mov`,`m4v`],tl=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],nl=[`pdf`],rl=[`json`,`toml`,`lock`];function il(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}il(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,$c,Vc),il(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,el,Hc),il(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,tl,Wc),il(`SIDEBAR_PDF_ASSET_EXTENSIONS`,nl,Uc),il(`FILE_ATTACHMENT_EXTENSIONS`,[...Gc],Qc),il(`WIKI_EMBED_EXTENSIONS`,[...Qc],qc);const al=new Set($c),ol=new Set(el),sl=new Set(tl),cl=new Set(nl),ll=new Set(rl);il(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...$c,...el,...tl,...nl,...rl])],Xc);const ul=new Set([`base`,`canvas`]),dl=new Set([`mmd`,`mermaid`]);function fl(e){let t=e.lastIndexOf(`.`);return t<0?!1:dl.has(e.slice(t+1).toLowerCase())}const pl=new Set([...qc,...ul,...dl]);function ml(e){let t=e.toLowerCase().replace(/^\./,``);return al.has(t)?`image`:ol.has(t)?`video`:sl.has(t)?`audio`:cl.has(t)?`pdf`:ll.has(t)||ul.has(t)?`text`:dl.has(t)?`mermaid`:Ic.has(t)?`text`:null}const hl=Symbol.for(`@inkeep/open-knowledge/field-registry`),gl=globalThis;gl[hl]===void 0&&(gl[hl]=Ri());const _l=gl[hl];function vl(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=yl(t)?_l.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function yl(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}const bl=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),xl=52428800,Sl=26214400,Cl=`https://api.openai.com/v1`,wl=`text-embedding-3-small`;function Tl(e){let t;try{t=new URL(e)}catch{return`invalid-url`}if(t.protocol===`https:`)return null;let n=t.hostname.toLowerCase(),r=n===`localhost`||n===`127.0.0.1`||n===`[::1]`;return t.protocol===`http:`&&r?null:`insecure-scheme`}function El(e){let t=e.trim();return t===``?`./`:t}function Dl(e){let t=El(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}const Ol=Zs({content:Zs({dir:A().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore.`}).default(`.`),attachmentFolderPath:A().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Where pasted and dropped assets are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(Dl,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:Zs({theme:F([`light`,`dark`,`system`]).register(_l,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),preview:Zs({autoOpen:M().register(_l,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:Zs({showHiddenFiles:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1)}).optional()}).default({preview:{autoOpen:!0}}),editor:Zs({wordWrap:M().register(_l,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0}),agents:Zs({autoApproveOkTools:M().register(_l,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools (and `ok open` on Claude) for agents launched from the built-in terminal. Destructive tools (delete/move/share/install) still prompt. Per-machine personal preference (user scope)."}).default(!0)}).default({autoApproveOkTools:!0}),autoSync:Zs({enabled:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Whether this machine auto-pulls and auto-pushes git commits for this project. null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared.`}).nullable().default(null),default:M().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Committed project default for a machine's autoSync.enabled on first open: true = auto-sync on, false = off, null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.enabled choice overrides it.`}).nullable().default(null)}).default({enabled:null,default:null}),terminal:Zs({enabled:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null)}).default({enabled:null}),telemetry:Zs({localSink:Zs({enabled:M().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:Zs({maxBytes:j().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(xl)}).default({maxBytes:xl}),logs:Zs({maxBytes:j().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(Sl)}).default({maxBytes:Sl}),attributeDenylist:N(A()).register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...bl])}).default({enabled:!0,spans:{maxBytes:xl},logs:{maxBytes:Sl},attributeDenylist:[...bl]})}).default({localSink:{enabled:!0,spans:{maxBytes:xl},logs:{maxBytes:Sl},attributeDenylist:[...bl]}}),search:Zs({semantic:Zs({enabled:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:A().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override for Azure / self-hosted / other providers. The API key is NOT stored here — set it with `ok embeddings set-key` (OS keyring)."}).default(Cl),model:A().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(wl),dimensions:j().int().positive().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit to use the model's native size (1536 for text-embedding-3-small). Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality. Changing it re-embeds the corpus.`}).optional(),similarityFloor:j().min(0).max(1).register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional()}).default({enabled:!1,baseUrl:Cl,model:wl})}).default({semantic:{enabled:!1,baseUrl:Cl,model:wl}}),linkPreviews:Zs({enabled:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata — outbound egress, one request per previewed link. Default OFF. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on.`}).default(!1)}).default({enabled:!1})}),kl=`open-knowledge-config`;async function Al(e,t,n){let r=o.getTracer(kl),a=t?{attributes:t}:{};return r.startActiveSpan(e,a,async e=>{try{return await n(e)}catch(t){throw e.recordException(t),e.setStatus({code:i.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function jl(e,t,n){let r=o.getTracer(kl),a=t?{attributes:t}:{};return r.startActiveSpan(e,a,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:i.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function Ml(e,t){let n=o.getActiveSpan();n&&n.addEvent(e,t)}function Nl(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function Pl(e,t){let n=e;for(let e of t){n=Nl(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function Fl(e,t){let n=Pl(e,t);if(n!==void 0)return vl(n)}function Il(e,t){return e===`either`?!0:e===t}function Ll(e,t){let n=null;function r(e,i){if(n!==null||e===void 0)return;if(typeof e==`object`&&e&&!Array.isArray(e)){for(let[t,a]of Object.entries(e))if(r(a,[...i,t]),n!==null)return;return}let a=Fl(Ol,i);a?.scope!==void 0&&(Il(a.scope,t)||(n={code:`SCOPE_VIOLATION`,path:i,expectedScope:a.scope,actualScope:t}))}for(let[t,i]of Object.entries(e))if(r(i,[t]),n!==null)break;return n}function Rl(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&((0,Fc.isCollection)(e.getIn(r,!0))||e.deleteIn(r))}}function zl(e,t){let n=[];function r(t,i){if(t!==void 0){if(t===null){e.deleteIn(i),n.push(i.join(`.`));return}if(Array.isArray(t)){Rl(e,i),e.setIn(i,t),n.push(i.join(`.`));return}if(typeof t==`object`){for(let[e,n]of Object.entries(t))r(n,[...i,e]);return}Rl(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function Bl(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}const Vl=P({file:A(),line:j().int().min(1),column:j().int().min(1),snippet:A().optional()}),Hl=P({path:N($s([A(),j()])),message:A(),issueCode:A(),params:ac(A(),Ks()).optional(),source:Vl.optional()}),Ul=F([`user`,`project`,`project-local`,`either`]),Wl=F([`user`,`project`,`project-local`]),Gl=tc(`code`,[P({code:I(`YAML_PARSE`),detail:A()}),P({code:I(`SCHEMA_INVALID`),issues:N(Hl)}),P({code:I(`SCOPE_VIOLATION`),path:N(A()),expectedScope:Ul,actualScope:Wl}),P({code:I(`NOT_AGENT_SETTABLE`),path:N(A())}),P({code:I(`MIXED_SCOPE`),paths:N(P({path:N(A()),scope:Wl}))}),P({code:I(`REMOVED_KEY`),path:N(A()),redirect:A(),source:Vl.optional()}),P({code:I(`WRITE_ERROR`),detail:A()}),P({code:I(`OKIGNORE_INVALID`),detail:A(),lineNumber:j().int().min(1).optional()}),P({code:I(`UNKNOWN`),message:A().optional()})]),Kl=new Set(Gl.options.map(e=>e.shape.code.value)),ql=$s([Gl,Zs({code:A(),message:A().optional()})]);function Jl(e){return Kl.has(e.code)}function Yl(e){switch(e){case`user`:return`~/.ok/global.yml`;case`project`:return`.ok/config.yml`;case`project-local`:return`.ok/local/config.yml`;case`either`:return`.ok/config.yml or ~/.ok/global.yml`}}function Xl(e){switch(e){case`user`:return`personal to you, across all projects`;case`project`:return`shared with your team via git`;case`project-local`:return`this machine only, not shared`;case`either`:return`user or project`}}function Zl(e){if(!Jl(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${e.detail}`;case`SCHEMA_INVALID`:{if(e.issues.length===0)return`Invalid configuration.`;let t=new Map;for(let n of e.issues){let e=n.source?.file??`<no source>`,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let[e,r]of t){e===`<no source>`?n.push(`Invalid configuration:`):n.push(`Invalid configuration at ${e}:`);for(let t of r){let r=t.path.length===0?`<root>`:t.path.join(`.`);if(t.source){if(n.push(` ${e}:${t.source.line}:${t.source.column}`),n.push(` ${r}: ${t.message}`),t.source.snippet&&t.source.snippet.length>0)for(let e of t.source.snippet.split(`
|
|
154
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Za(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:eo(t,`input`,e.processors),output:eo(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Qa(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Qa(r.element,n);if(r.type===`set`)return Qa(r.valueType,n);if(r.type===`lazy`)return Qa(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Qa(r.innerType,n);if(r.type===`intersection`)return Qa(r.left,n)||Qa(r.right,n);if(r.type===`record`||r.type===`map`)return Qa(r.keyType,n)||Qa(r.valueType,n);if(r.type===`pipe`)return Qa(r.in,n)||Qa(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Qa(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Qa(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Qa(e,n))return!0;return!!(r.rest&&Qa(r.rest,n))}return!1}const $a=(e,t={})=>n=>{let r=Ja({...n,processors:t});return Ya(e,r),Xa(r,e),Za(r,e)},eo=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ja({...i??{},target:a,io:t,processors:n});return Ya(e,o),Xa(o,e),Za(o,e)},to={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},no=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=to[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},ro=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},io=(e,t,n,r)=>{n.type=`boolean`},ao=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},oo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},so=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},co=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},lo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},uo=(e,t,n,r)=>{n.not={}},fo=(e,t,n,r)=>{},po=(e,t,n,r)=>{},mo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},ho=(e,t,n,r)=>{let i=e._zod.def,a=bt(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},go=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},_o=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},vo=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},yo=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},bo=(e,t,n,r)=>{n.type=`boolean`},xo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},So=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Co=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},wo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},To=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},Eo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Ya(a.element,t,{...r,path:[...r.path,`items`]})},Do=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Ya(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Ya(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Oo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ya(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ko=(e,t,n,r)=>{let i=e._zod.def,a=Ya(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ya(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Ao=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Ya(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Ya(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},jo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Ya(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Ya(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Ya(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Mo=(e,t,n,r)=>{let i=e._zod.def,a=Ya(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},No=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Po=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Fo=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Io=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Lo=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Ya(a,t,r);let o=t.seen.get(e);o.ref=a},Ro=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},zo=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Bo=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Vo=(e,t,n,r)=>{let i=e._zod.innerType;Ya(i,t,r);let a=t.seen.get(e);a.ref=i},Ho={string:no,number:ro,boolean:io,bigint:ao,symbol:oo,null:so,undefined:co,void:lo,never:uo,any:fo,unknown:po,date:mo,enum:ho,literal:go,nan:_o,template_literal:vo,file:yo,success:bo,custom:xo,function:So,transform:Co,map:wo,set:To,array:Eo,object:Do,union:Oo,intersection:ko,tuple:Ao,record:jo,nullable:Mo,nonoptional:No,default:Po,prefault:Fo,catch:Io,pipe:Lo,readonly:Ro,promise:zo,optional:Bo,lazy:Vo};function Uo(e,t){if(`_idmap`in e){let n=e,r=Ja({...t,processors:Ho}),i={};for(let e of n._idmap.entries()){let[t,n]=e;Ya(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Xa(r,n),a[t]=Za(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Ja({...t,processors:Ho});return Ya(e,n),Xa(n,e),Za(n,e)}const Wo=O(`ZodISODateTime`,(e,t)=>{Pr.init(e,t),gs.init(e,t)});function Go(e){return la(Wo,e)}const Ko=O(`ZodISODate`,(e,t)=>{Fr.init(e,t),gs.init(e,t)});function qo(e){return ua(Ko,e)}const Jo=O(`ZodISOTime`,(e,t)=>{Ir.init(e,t),gs.init(e,t)});function Yo(e){return da(Jo,e)}const Xo=O(`ZodISODuration`,(e,t)=>{Lr.init(e,t),gs.init(e,t)});function Zo(e){return fa(Xo,e)}const Qo=(e,t)=>{nn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>on(e,t)},flatten:{value:t=>an(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,xt,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,xt,2)}},isEmpty:{get(){return e.issues.length===0}}})};O(`ZodError`,Qo);const $o=O(`ZodError`,Qo,{Parent:Error}),es=ln($o),ts=dn($o),ns=pn($o),rs=hn($o),is=_n($o),as=vn($o),ss=yn($o),cs=bn($o),ls=xn($o),us=Sn($o),ds=Cn($o),fs=wn($o),ps=O(`ZodType`,(e,t)=>(br.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:eo(e,`input`),output:eo(e,`output`)}}),e.toJSONSchema=$a(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(kt(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>zt(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>es(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ns(e,t,n),e.parseAsync=async(t,n)=>ts(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>rs(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>is(e,t,n),e.decode=(t,n)=>as(e,t,n),e.encodeAsync=async(t,n)=>ss(e,t,n),e.decodeAsync=async(t,n)=>cs(e,t,n),e.safeEncode=(t,n)=>ls(e,t,n),e.safeDecode=(t,n)=>us(e,t,n),e.safeEncodeAsync=async(t,n)=>ds(e,t,n),e.safeDecodeAsync=async(t,n)=>fs(e,t,n),e.refine=(t,n)=>e.check(Mc(t,n)),e.superRefine=t=>e.check(Nc(t)),e.overwrite=t=>e.check(Fa(t)),e.optional=()=>dc(e),e.exactOptional=()=>pc(e),e.nullable=()=>hc(e),e.nullish=()=>dc(hc(e)),e.nonoptional=t=>xc(e,t),e.array=()=>N(e),e.or=t=>$s([e,t]),e.and=t=>rc(e,t),e.transform=t=>Tc(e,lc(t)),e.default=t=>_c(e,t),e.prefault=t=>yc(e,t),e.catch=t=>Cc(e,t),e.pipe=t=>Tc(e,t),e.readonly=()=>Dc(e),e.describe=t=>{let n=e.clone();return zi.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return zi.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return zi.get(e);let n=e.clone();return zi.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),ms=O(`_ZodString`,(e,t)=>{xr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(ka(...t)),e.includes=(...t)=>e.check(Ma(...t)),e.startsWith=(...t)=>e.check(Na(...t)),e.endsWith=(...t)=>e.check(Pa(...t)),e.min=(...t)=>e.check(Da(...t)),e.max=(...t)=>e.check(Ea(...t)),e.length=(...t)=>e.check(Oa(...t)),e.nonempty=(...t)=>e.check(Da(1,...t)),e.lowercase=t=>e.check(Aa(t)),e.uppercase=t=>e.check(ja(t)),e.trim=()=>e.check(La()),e.normalize=(...t)=>e.check(Ia(...t)),e.toLowerCase=()=>e.check(Ra()),e.toUpperCase=()=>e.check(za()),e.slugify=()=>e.check(Ba())}),hs=O(`ZodString`,(e,t)=>{xr.init(e,t),ms.init(e,t),e.email=t=>e.check(Vi(_s,t)),e.url=t=>e.check(qi(bs,t)),e.jwt=t=>e.check(ca(Is,t)),e.emoji=t=>e.check(Ji(Ss,t)),e.guid=t=>e.check(Hi(vs,t)),e.uuid=t=>e.check(Ui(ys,t)),e.uuidv4=t=>e.check(Wi(ys,t)),e.uuidv6=t=>e.check(Gi(ys,t)),e.uuidv7=t=>e.check(Ki(ys,t)),e.nanoid=t=>e.check(Yi(Cs,t)),e.guid=t=>e.check(Hi(vs,t)),e.cuid=t=>e.check(Xi(ws,t)),e.cuid2=t=>e.check(Zi(Ts,t)),e.ulid=t=>e.check(Qi(Es,t)),e.base64=t=>e.check(aa(Ns,t)),e.base64url=t=>e.check(oa(Ps,t)),e.xid=t=>e.check($i(Ds,t)),e.ksuid=t=>e.check(ea(Os,t)),e.ipv4=t=>e.check(ta(ks,t)),e.ipv6=t=>e.check(na(As,t)),e.cidrv4=t=>e.check(ra(js,t)),e.cidrv6=t=>e.check(ia(Ms,t)),e.e164=t=>e.check(sa(Fs,t)),e.datetime=t=>e.check(Go(t)),e.date=t=>e.check(qo(t)),e.time=t=>e.check(Yo(t)),e.duration=t=>e.check(Zo(t))});function A(e){return Bi(hs,e)}const gs=O(`ZodStringFormat`,(e,t)=>{Sr.init(e,t),ms.init(e,t)}),_s=O(`ZodEmail`,(e,t)=>{Tr.init(e,t),gs.init(e,t)}),vs=O(`ZodGUID`,(e,t)=>{Cr.init(e,t),gs.init(e,t)}),ys=O(`ZodUUID`,(e,t)=>{wr.init(e,t),gs.init(e,t)}),bs=O(`ZodURL`,(e,t)=>{Er.init(e,t),gs.init(e,t)});function xs(e){return qi(bs,e)}const Ss=O(`ZodEmoji`,(e,t)=>{Dr.init(e,t),gs.init(e,t)}),Cs=O(`ZodNanoID`,(e,t)=>{Or.init(e,t),gs.init(e,t)}),ws=O(`ZodCUID`,(e,t)=>{kr.init(e,t),gs.init(e,t)}),Ts=O(`ZodCUID2`,(e,t)=>{Ar.init(e,t),gs.init(e,t)}),Es=O(`ZodULID`,(e,t)=>{jr.init(e,t),gs.init(e,t)}),Ds=O(`ZodXID`,(e,t)=>{Mr.init(e,t),gs.init(e,t)}),Os=O(`ZodKSUID`,(e,t)=>{Nr.init(e,t),gs.init(e,t)}),ks=O(`ZodIPv4`,(e,t)=>{Rr.init(e,t),gs.init(e,t)}),As=O(`ZodIPv6`,(e,t)=>{zr.init(e,t),gs.init(e,t)}),js=O(`ZodCIDRv4`,(e,t)=>{Br.init(e,t),gs.init(e,t)}),Ms=O(`ZodCIDRv6`,(e,t)=>{Vr.init(e,t),gs.init(e,t)}),Ns=O(`ZodBase64`,(e,t)=>{Ur.init(e,t),gs.init(e,t)}),Ps=O(`ZodBase64URL`,(e,t)=>{Gr.init(e,t),gs.init(e,t)}),Fs=O(`ZodE164`,(e,t)=>{Kr.init(e,t),gs.init(e,t)}),Is=O(`ZodJWT`,(e,t)=>{Jr.init(e,t),gs.init(e,t)}),Ls=O(`ZodNumber`,(e,t)=>{Yr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),e.gt=(t,n)=>e.check(Ca(t,n)),e.gte=(t,n)=>e.check(wa(t,n)),e.min=(t,n)=>e.check(wa(t,n)),e.lt=(t,n)=>e.check(xa(t,n)),e.lte=(t,n)=>e.check(Sa(t,n)),e.max=(t,n)=>e.check(Sa(t,n)),e.int=t=>e.check(zs(t)),e.safe=t=>e.check(zs(t)),e.positive=t=>e.check(Ca(0,t)),e.nonnegative=t=>e.check(wa(0,t)),e.negative=t=>e.check(xa(0,t)),e.nonpositive=t=>e.check(Sa(0,t)),e.multipleOf=(t,n)=>e.check(Ta(t,n)),e.step=(t,n)=>e.check(Ta(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function j(e){return pa(Ls,e)}const Rs=O(`ZodNumberFormat`,(e,t)=>{Xr.init(e,t),Ls.init(e,t)});function zs(e){return ha(Rs,e)}const Bs=O(`ZodBoolean`,(e,t)=>{Zr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r)});function M(e){return ga(Bs,e)}const Vs=O(`ZodNull`,(e,t)=>{Qr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r)});function Hs(e){return _a(Vs,e)}const Us=O(`ZodAny`,(e,t)=>{$r.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ws(){return va(Us)}const Gs=O(`ZodUnknown`,(e,t)=>{ei.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ks(){return ya(Gs)}const qs=O(`ZodNever`,(e,t)=>{ti.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r)});function Js(e){return ba(qs,e)}const Ys=O(`ZodArray`,(e,t)=>{ri.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Da(t,n)),e.nonempty=t=>e.check(Da(1,t)),e.max=(t,n)=>e.check(Ea(t,n)),e.length=(t,n)=>e.check(Oa(t,n)),e.unwrap=()=>e.element});function N(e,t){return Va(Ys,e,t)}const Xs=O(`ZodObject`,(e,t)=>{ci.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r),Dt(e,`shape`,()=>t.shape),e.keyof=()=>F(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ks()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ks()}),e.strict=()=>e.clone({...e._zod.def,catchall:Js()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Wt(e,t),e.safeExtend=t=>Gt(e,t),e.merge=t=>Kt(e,t),e.pick=t=>Ht(e,t),e.omit=t=>Ut(e,t),e.partial=(...t)=>qt(uc,e,t[0]),e.required=(...t)=>Jt(bc,e,t[0])});function P(e,t){return new Xs({type:`object`,shape:e??{},...k(t)})}function Zs(e,t){return new Xs({type:`object`,shape:e,catchall:Ks(),...k(t)})}const Qs=O(`ZodUnion`,(e,t)=>{ui.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.options=t.options});function $s(e,t){return new Qs({type:`union`,options:e,...k(t)})}const ec=O(`ZodDiscriminatedUnion`,(e,t)=>{Qs.init(e,t),di.init(e,t)});function tc(e,t,n){return new ec({type:`union`,options:t,discriminator:e,...k(n)})}const nc=O(`ZodIntersection`,(e,t)=>{fi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r)});function rc(e,t){return new nc({type:`intersection`,left:e,right:t})}const ic=O(`ZodRecord`,(e,t)=>{hi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function ac(e,t,n){return new ic({type:`record`,keyType:e,valueType:t,...k(n)})}const oc=O(`ZodEnum`,(e,t)=>{gi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new oc({...t,checks:[],...k(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new oc({...t,checks:[],...k(r),entries:i})}});function F(e,t){return new oc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...k(t)})}const sc=O(`ZodLiteral`,(e,t)=>{_i.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function I(e,t){return new sc({type:`literal`,values:Array.isArray(e)?e:[e],...k(t)})}const cc=O(`ZodTransform`,(e,t)=>{vi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new _t(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(en(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(en(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function lc(e){return new cc({type:`transform`,transform:e})}const uc=O(`ZodOptional`,(e,t)=>{bi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dc(e){return new uc({type:`optional`,innerType:e})}const fc=O(`ZodExactOptional`,(e,t)=>{xi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pc(e){return new fc({type:`optional`,innerType:e})}const mc=O(`ZodNullable`,(e,t)=>{Si.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hc(e){return new mc({type:`nullable`,innerType:e})}const gc=O(`ZodDefault`,(e,t)=>{Ci.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function _c(e,t){return new gc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():It(t)}})}const vc=O(`ZodPrefault`,(e,t)=>{Ti.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yc(e,t){return new vc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():It(t)}})}const bc=O(`ZodNonOptional`,(e,t)=>{Ei.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xc(e,t){return new bc({type:`nonoptional`,innerType:e,...k(t)})}const Sc=O(`ZodCatch`,(e,t)=>{Oi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Cc(e,t){return new Sc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const wc=O(`ZodPipe`,(e,t)=>{ki.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.in=t.in,e.out=t.out});function Tc(e,t){return new wc({type:`pipe`,in:e,out:t})}const Ec=O(`ZodReadonly`,(e,t)=>{ji.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dc(e){return new Ec({type:`readonly`,innerType:e})}const Oc=O(`ZodLazy`,(e,t)=>{Ni.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function kc(e){return new Oc({type:`lazy`,getter:e})}const Ac=O(`ZodCustom`,(e,t)=>{Pi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r)});function jc(e,t){return Ha(Ac,e??(()=>!0),t)}function Mc(e,t={}){return Ua(Ac,e,t)}function Nc(e){return Wa(e)}function Pc(e,t){return Tc(lc(e),t)}var Fc=mt();a();const Ic=new Set(Object.keys({sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`})),Lc=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],Rc=[`video/mp4`,`video/webm`,`video/ogg`],zc=[`audio/mpeg`,`audio/wav`,`audio/ogg`],Bc=[`application/pdf`],Vc=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),Hc=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),Uc=new Set([`pdf`]),Wc=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Gc=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Kc=new Set(`exe.bat.cmd.ps1.com.msi.vbs.js.jse.wsf.wsh.hta.sh.command.csh.ksh.bash.zsh.fish.desktop.action.workflow.html.htm.svg.xml.mhtml.svgz.dmg.pkg.mpkg.scpt.applescript.terminal.prefpane.webloc.inetloc.fileloc.jar.appimage.deb.rpm.msix.appx.ipa.apk.pif.scr.lnk.url`.split(`.`)),qc=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),Jc=new Set([`html`,`htm`]),Yc=`sandbox allow-scripts; connect-src 'none'`,Xc=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml.lock`.split(`.`)),Zc=`same-dir`,Qc=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),$c=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],el=[`mp4`,`webm`,`mov`,`m4v`],tl=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],nl=[`pdf`],rl=[`json`,`toml`,`lock`];function il(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}il(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,$c,Vc),il(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,el,Hc),il(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,tl,Wc),il(`SIDEBAR_PDF_ASSET_EXTENSIONS`,nl,Uc),il(`FILE_ATTACHMENT_EXTENSIONS`,[...Gc],Qc),il(`WIKI_EMBED_EXTENSIONS`,[...Qc],qc);const al=new Set($c),ol=new Set(el),sl=new Set(tl),cl=new Set(nl),ll=new Set(rl);il(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...$c,...el,...tl,...nl,...rl])],Xc);const ul=new Set([`base`,`canvas`]),dl=new Set([`mmd`,`mermaid`]);function fl(e){let t=e.lastIndexOf(`.`);return t<0?!1:dl.has(e.slice(t+1).toLowerCase())}const pl=new Set([...qc,...ul,...dl]);function ml(e){let t=e.toLowerCase().replace(/^\./,``);return al.has(t)?`image`:ol.has(t)?`video`:sl.has(t)?`audio`:cl.has(t)?`pdf`:ll.has(t)||ul.has(t)?`text`:dl.has(t)?`mermaid`:Ic.has(t)?`text`:null}const hl=Symbol.for(`@inkeep/open-knowledge/field-registry`),gl=globalThis;gl[hl]===void 0&&(gl[hl]=Ri());const _l=gl[hl];function vl(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=yl(t)?_l.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function yl(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}const bl=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),xl=52428800,Sl=26214400,Cl=`https://api.openai.com/v1`,wl=`text-embedding-3-small`;function Tl(e){let t;try{t=new URL(e)}catch{return`invalid-url`}if(t.protocol===`https:`)return null;let n=t.hostname.toLowerCase(),r=n===`localhost`||n===`127.0.0.1`||n===`[::1]`;return t.protocol===`http:`&&r?null:`insecure-scheme`}function El(e){let t=e.trim();return t===``?`./`:t}function Dl(e){let t=El(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}const Ol=Zs({content:Zs({dir:A().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore.`}).default(`.`),attachmentFolderPath:A().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Where pasted and dropped assets are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(Dl,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:Zs({theme:F([`light`,`dark`,`system`]).register(_l,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),preview:Zs({autoOpen:M().register(_l,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:Zs({showHiddenFiles:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1)}).optional()}).default({preview:{autoOpen:!0}}),editor:Zs({wordWrap:M().register(_l,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0}),agents:Zs({autoApproveOkTools:M().register(_l,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools (and `ok open` on Claude) for agents launched from the built-in terminal. Destructive tools (delete/move/share/install) still prompt. Per-machine personal preference (user scope)."}).default(!0)}).default({autoApproveOkTools:!0}),autoSync:Zs({enabled:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Whether this machine auto-pulls and auto-pushes git commits for this project. null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared.`}).nullable().default(null),default:M().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Committed project default for a machine's autoSync.enabled on first open: true = auto-sync on, false = off, null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.enabled choice overrides it.`}).nullable().default(null)}).default({enabled:null,default:null}),terminal:Zs({enabled:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null)}).default({enabled:null}),telemetry:Zs({localSink:Zs({enabled:M().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:Zs({maxBytes:j().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(xl)}).default({maxBytes:xl}),logs:Zs({maxBytes:j().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(Sl)}).default({maxBytes:Sl}),attributeDenylist:N(A()).register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...bl])}).default({enabled:!0,spans:{maxBytes:xl},logs:{maxBytes:Sl},attributeDenylist:[...bl]})}).default({localSink:{enabled:!0,spans:{maxBytes:xl},logs:{maxBytes:Sl},attributeDenylist:[...bl]}}),search:Zs({semantic:Zs({enabled:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:A().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override for Azure / self-hosted / other providers. The API key is NOT stored here — set it with `ok embeddings set-key` (OS keyring)."}).default(Cl),model:A().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(wl),dimensions:j().int().positive().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit to use the model's native size (1536 for text-embedding-3-small). Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality. Changing it re-embeds the corpus.`}).optional(),similarityFloor:j().min(0).max(1).register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional()}).default({enabled:!1,baseUrl:Cl,model:wl})}).default({semantic:{enabled:!1,baseUrl:Cl,model:wl}})}),kl=`open-knowledge-config`;async function Al(e,t,n){let r=o.getTracer(kl),a=t?{attributes:t}:{};return r.startActiveSpan(e,a,async e=>{try{return await n(e)}catch(t){throw e.recordException(t),e.setStatus({code:i.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function jl(e,t,n){let r=o.getTracer(kl),a=t?{attributes:t}:{};return r.startActiveSpan(e,a,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:i.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function Ml(e,t){let n=o.getActiveSpan();n&&n.addEvent(e,t)}function Nl(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function Pl(e,t){let n=e;for(let e of t){n=Nl(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function Fl(e,t){let n=Pl(e,t);if(n!==void 0)return vl(n)}function Il(e,t){return e===`either`?!0:e===t}function Ll(e,t){let n=null;function r(e,i){if(n!==null||e===void 0)return;if(typeof e==`object`&&e&&!Array.isArray(e)){for(let[t,a]of Object.entries(e))if(r(a,[...i,t]),n!==null)return;return}let a=Fl(Ol,i);a?.scope!==void 0&&(Il(a.scope,t)||(n={code:`SCOPE_VIOLATION`,path:i,expectedScope:a.scope,actualScope:t}))}for(let[t,i]of Object.entries(e))if(r(i,[t]),n!==null)break;return n}function Rl(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&((0,Fc.isCollection)(e.getIn(r,!0))||e.deleteIn(r))}}function zl(e,t){let n=[];function r(t,i){if(t!==void 0){if(t===null){e.deleteIn(i),n.push(i.join(`.`));return}if(Array.isArray(t)){Rl(e,i),e.setIn(i,t),n.push(i.join(`.`));return}if(typeof t==`object`){for(let[e,n]of Object.entries(t))r(n,[...i,e]);return}Rl(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function Bl(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}const Vl=P({file:A(),line:j().int().min(1),column:j().int().min(1),snippet:A().optional()}),Hl=P({path:N($s([A(),j()])),message:A(),issueCode:A(),params:ac(A(),Ks()).optional(),source:Vl.optional()}),Ul=F([`user`,`project`,`project-local`,`either`]),Wl=F([`user`,`project`,`project-local`]),Gl=tc(`code`,[P({code:I(`YAML_PARSE`),detail:A()}),P({code:I(`SCHEMA_INVALID`),issues:N(Hl)}),P({code:I(`SCOPE_VIOLATION`),path:N(A()),expectedScope:Ul,actualScope:Wl}),P({code:I(`NOT_AGENT_SETTABLE`),path:N(A())}),P({code:I(`MIXED_SCOPE`),paths:N(P({path:N(A()),scope:Wl}))}),P({code:I(`REMOVED_KEY`),path:N(A()),redirect:A(),source:Vl.optional()}),P({code:I(`WRITE_ERROR`),detail:A()}),P({code:I(`OKIGNORE_INVALID`),detail:A(),lineNumber:j().int().min(1).optional()}),P({code:I(`UNKNOWN`),message:A().optional()})]),Kl=new Set(Gl.options.map(e=>e.shape.code.value)),ql=$s([Gl,Zs({code:A(),message:A().optional()})]);function Jl(e){return Kl.has(e.code)}function Yl(e){switch(e){case`user`:return`~/.ok/global.yml`;case`project`:return`.ok/config.yml`;case`project-local`:return`.ok/local/config.yml`;case`either`:return`.ok/config.yml or ~/.ok/global.yml`}}function Xl(e){switch(e){case`user`:return`personal to you, across all projects`;case`project`:return`shared with your team via git`;case`project-local`:return`this machine only, not shared`;case`either`:return`user or project`}}function Zl(e){if(!Jl(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${e.detail}`;case`SCHEMA_INVALID`:{if(e.issues.length===0)return`Invalid configuration.`;let t=new Map;for(let n of e.issues){let e=n.source?.file??`<no source>`,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let[e,r]of t){e===`<no source>`?n.push(`Invalid configuration:`):n.push(`Invalid configuration at ${e}:`);for(let t of r){let r=t.path.length===0?`<root>`:t.path.join(`.`);if(t.source){if(n.push(` ${e}:${t.source.line}:${t.source.column}`),n.push(` ${r}: ${t.message}`),t.source.snippet&&t.source.snippet.length>0)for(let e of t.source.snippet.split(`
|
|
155
155
|
`))n.push(` ${e}`)}else n.push(` ${r}: ${t.message}`)}}return n.join(`
|
|
156
156
|
`)}case`SCOPE_VIOLATION`:return[`Setting ${e.path.join(`.`)} belongs in your ${e.expectedScope} config`,`(${Yl(e.expectedScope)} — ${Xl(e.expectedScope)}),`,`but it was set in the ${e.actualScope} config (${Yl(e.actualScope)}).`,`Move it to ${Yl(e.expectedScope)}.`].join(` `);case`NOT_AGENT_SETTABLE`:return[`Setting ${e.path.join(`.`)} is human-only and can't be changed by an agent.`,`Change it in the Settings pane, or edit the config.yml by hand.`].join(` `);case`MIXED_SCOPE`:return[`This change touches settings that live in different config files. Apply them one file at a time:`,e.paths.map(({path:e,scope:t})=>` ${e.join(`.`)} → ${Yl(t)} (${t})`).join(`
|
|
157
157
|
`)].join(`
|
|
@@ -270,7 +270,7 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
|
|
|
270
270
|
`,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
|
|
271
271
|
`),i;function a(e){return r.stack.push(e),t;function t(){r.stack.pop()}}}function qP(e){throw Error("Cannot handle value `"+e+"`, expected node")}function JP(e){throw Error("Cannot handle unknown node `"+e.type+"`")}function YP(e,t){if(e.type===`definition`&&e.type===t.type)return 0}function XP(e,t){return LP(e,this,t)}function ZP(e,t){return RP(e,this,t)}function QP(e,t){return HP(this,e,t)}function $P(){return{enter:{table:eF,tableData:iF,tableHeader:iF,tableRow:nF},exit:{codeText:aF,table:tF,tableData:rF,tableHeader:rF,tableRow:rF}}}function eF(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function tF(e){this.exit(e),this.data.inTable=void 0}function nF(e){this.enter({type:`tableRow`,children:[]},e)}function rF(e){this.exit(e)}function iF(e){this.enter({type:`tableCell`,children:[]},e)}function aF(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,oF));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function oF(e,t){return t===`|`?t:e}function sF(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
272
272
|
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
273
|
-
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return bN(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=CP.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function cF(){return{exit:{taskListCheckValueChecked:uF,taskListCheckValueUnchecked:uF,paragraph:dF}}}function lF(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:fF}}}function uF(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function dF(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function fF(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=CP.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function pF(){return[LM(),cN(),pN(),$P(),cF()]}function mF(e){return{extensions:[RM(),lN(e),mN(),sF(e),lF()]}}function hF(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function gF(e,t){return e.length>0?(hF(e,e.length,0,t),e):t}const _F={}.hasOwnProperty;function vF(e){let t={},n=-1;for(;++n<e.length;)yF(t,e[n]);return t}function yF(e,t){let n;for(n in t){let r=(_F.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){_F.call(r,a)||(r[a]=[]);let e=i[a];bF(r[a],Array.isArray(e)?e:e?[e]:[])}}}function bF(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);hF(e,0,0,r)}const xF={tokenize:FF,partial:!0},SF={tokenize:IF,partial:!0},CF={tokenize:LF,partial:!0},wF={tokenize:RF,partial:!0},TF={tokenize:zF,partial:!0},EF={name:`wwwAutolink`,tokenize:NF,previous:BF},DF={name:`protocolAutolink`,tokenize:PF,previous:VF},OF={name:`emailAutolink`,tokenize:MF,previous:HF},kF={};function AF(){return{text:kF}}let jF=48;for(;jF<123;)kF[jF]=OF,jF++,jF===58?jF=65:jF===91&&(jF=97);kF[43]=OF,kF[45]=OF,kF[46]=OF,kF[95]=OF,kF[72]=[OF,DF],kF[104]=[OF,DF],kF[87]=[OF,EF],kF[119]=[OF,EF];function MF(e,t,n){let r=this,i,a;return o;function o(t){return!UF(t)||!HF.call(r,r.previous)||WF(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return UF(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(TF,u,l)(t):t===45||t===95||bM(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&yM(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function NF(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!BF.call(r,r.previous)||WF(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(xF,e.attempt(SF,e.attempt(CF,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function PF(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&VF.call(r,r.previous)&&!WF(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(yM(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||SM(t)||EM(t)||OM(t)||DM(t)?n(t):e.attempt(SF,e.attempt(CF,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function FF(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function IF(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(wF,c,s)(t):t===null||EM(t)||OM(t)||t!==45&&DM(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function LF(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(wF,t,a)(o):o===null||EM(o)||OM(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function RF(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||EM(o)||OM(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||EM(e)||OM(e)?t(e):r(e)}function a(e){return yM(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):yM(t)?(e.consume(t),o):n(t)}}function zF(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return bM(e)?n(e):t(e)}}function BF(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||EM(e)}function VF(e){return!yM(e)}function HF(e){return!(e===47||UF(e))}function UF(e){return e===43||e===45||e===46||e===95||bM(e)}function WF(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function GF(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&bM(e.charCodeAt(n+1))&&bM(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function KF(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const qF={name:`attention`,resolveAll:JF,tokenize:YF};function JF(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};XF(d,-c),XF(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=gF(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=gF(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=gF(l,KF(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=gF(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=gF(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,hF(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function YF(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=UN(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=UN(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function XF(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const ZF={name:`autolink`,tokenize:QF};function QF(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return yM(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||bM(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||bM(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||SM(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):xM(t)?(e.consume(t),l):n(t)}function u(e){return bM(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||bM(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}function $F(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return $(r)?(e.enter(n),s(r)):t(r)}function s(r){return $(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}const eI={partial:!0,tokenize:tI};function tI(e,t,n){return r;function r(t){return $(t)?$F(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Q(e)?t(e):n(e)}}const nI={continuation:{tokenize:iI},exit:aI,name:`blockQuote`,tokenize:rI};function rI(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return $(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function iI(e,t,n){let r=this;return i;function i(t){return $(t)?$F(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(nI,t,n)(r)}}function aI(e){e.exit(`blockQuote`)}const oI={name:`characterEscape`,tokenize:sI};function sI(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return TM(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}const cI={name:`characterReference`,tokenize:lI};function lI(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=bM,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=wM,u):(e.enter(`characterReferenceValue`),a=7,o=CM,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===bM&&!AP(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}const uI={partial:!0,tokenize:pI},dI={concrete:!0,name:`codeFenced`,tokenize:fI};function fI(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),$(t)?$F(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Q(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(uI,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):$(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),$F(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Q(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&$(t)?$F(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Q(t)?e.check(uI,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Q(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),$(t)?$F(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),$(t)?$F(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Q(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function pI(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}const mI={name:`codeIndented`,tokenize:gI},hI={partial:!0,tokenize:_I};function gI(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),$F(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Q(t)?e.attempt(hI,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Q(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function _I(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):$F(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Q(e)?i(e):n(e)}}const vI={name:`codeText`,previous:bI,resolve:yI,tokenize:xI};function yI(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function bI(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function xI(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Q(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var SI=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&CI(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),CI(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),CI(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);CI(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);CI(this.left,t.reverse())}}};function CI(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function wI(e){let t={},n=-1,r,i,a,o,s,c,l,u=new SI(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,TI(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return hF(e,0,1/0,u.slice(0)),!l}function TI(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}const EI={resolve:OI,tokenize:kI},DI={partial:!0,tokenize:AI};function OI(e){return wI(e),e}function kI(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Q(t)?e.check(DI,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function AI(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$F(e,a,`linePrefix`)}function a(i){if(i===null||Q(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function jI(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||SM(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Q(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||EM(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||SM(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function MI(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Q(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Q(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!$(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function NI(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$F(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Q(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function PI(e,t){let n;return r;function r(i){return Q(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):$(i)?$F(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}const FI={name:`definition`,tokenize:LI},II={partial:!0,tokenize:RI};function LI(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return MI.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=ZM(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return EM(t)?PI(e,l)(t):l(t)}function l(t){return jI(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(II,d,d)(t)}function d(t){return $(t)?$F(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Q(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function RI(e,t,n){return r;function r(t){return EM(t)?PI(e,i)(t):n(t)}function i(t){return NI(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return $(t)?$F(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Q(e)?t(e):n(e)}}const zI={name:`hardBreakEscape`,tokenize:BI};function BI(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Q(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}const VI={name:`headingAtx`,resolve:HI,tokenize:UI};function HI(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},hF(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function UI(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||EM(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Q(n)?(e.exit(`atxHeading`),t(n)):$(n)?$F(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||EM(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}const WI=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),GI=[`pre`,`script`,`style`,`textarea`],KI={concrete:!0,name:`htmlFlow`,resolveTo:YI,tokenize:XI},qI={partial:!0,tokenize:QI},JI={partial:!0,tokenize:ZI};function YI(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function XI(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ce):yM(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):yM(a)?(e.consume(a),i=4,r.interrupt?t:ce):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ce):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:te:m):n(i)}function h(t){return yM(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||EM(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&GI.includes(l)?(i=1,r.interrupt?t(s):te(s)):WI.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):te(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||bM(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:te):n(i)}function v(t){return $(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||yM(t)?(e.consume(t),b):$(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||bM(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):$(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):$(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Q(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||EM(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||$(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),ee):n(t)}function ee(t){return t===null||Q(t)?te(t):$(t)?(e.consume(t),ee):n(t)}function te(t){return t===45&&i===2?(e.consume(t),ae):t===60&&i===1?(e.consume(t),D):t===62&&i===4?(e.consume(t),le):t===63&&i===3?(e.consume(t),ce):t===93&&i===5?(e.consume(t),se):Q(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(qI,ue,ne)(t)):t===null||Q(t)?(e.exit(`htmlFlowData`),ne(t)):(e.consume(t),te)}function ne(t){return e.check(JI,re,ue)(t)}function re(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ie}function ie(t){return t===null||Q(t)?ne(t):(e.enter(`htmlFlowData`),te(t))}function ae(t){return t===45?(e.consume(t),ce):te(t)}function D(t){return t===47?(e.consume(t),o=``,oe):te(t)}function oe(t){if(t===62){let n=o.toLowerCase();return GI.includes(n)?(e.consume(t),le):te(t)}return yM(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),oe):te(t)}function se(t){return t===93?(e.consume(t),ce):te(t)}function ce(t){return t===62?(e.consume(t),le):t===45&&i===2?(e.consume(t),ce):te(t)}function le(t){return t===null||Q(t)?(e.exit(`htmlFlowData`),ue(t)):(e.consume(t),le)}function ue(n){return e.exit(`htmlFlow`),t(n)}}function ZI(e,t,n){let r=this;return i;function i(t){return Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function QI(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(eI,t,n)}}const $I={name:`htmlText`,tokenize:eL};function eL(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):yM(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):yM(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Q(t)?(o=d,D(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ae(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Q(t)?(o=h,D(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ae(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ae(t):Q(t)?(o=v,D(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Q(t)?(o=y,D(t)):(e.consume(t),y)}function b(e){return e===62?ae(e):y(e)}function x(t){return yM(t)?(e.consume(t),S):n(t)}function S(t){return t===45||bM(t)?(e.consume(t),S):C(t)}function C(t){return Q(t)?(o=C,D(t)):$(t)?(e.consume(t),C):ae(t)}function w(t){return t===45||bM(t)?(e.consume(t),w):t===47||t===62||EM(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ae):t===58||t===95||yM(t)?(e.consume(t),E):Q(t)?(o=T,D(t)):$(t)?(e.consume(t),T):ae(t)}function E(t){return t===45||t===46||t===58||t===95||bM(t)?(e.consume(t),E):ee(t)}function ee(t){return t===61?(e.consume(t),te):Q(t)?(o=ee,D(t)):$(t)?(e.consume(t),ee):T(t)}function te(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,ne):Q(t)?(o=te,D(t)):$(t)?(e.consume(t),te):(e.consume(t),re)}function ne(t){return t===i?(e.consume(t),i=void 0,ie):t===null?n(t):Q(t)?(o=ne,D(t)):(e.consume(t),ne)}function re(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||EM(t)?T(t):(e.consume(t),re)}function ie(e){return e===47||e===62||EM(e)?T(e):n(e)}function ae(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function D(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),oe}function oe(t){return $(t)?$F(e,se,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):se(t)}function se(t){return e.enter(`htmlTextData`),o(t)}}const tL={name:`labelEnd`,resolveAll:aL,resolveTo:oL,tokenize:sL},nL={tokenize:cL},rL={tokenize:lL},iL={tokenize:uL};function aL(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&hF(e,0,e.length,n),e}function oL(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=gF(s,e.slice(a+1,a+r+3)),s=gF(s,[[`enter`,u,t]]),s=gF(s,KF(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=gF(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=gF(s,e.slice(o+1)),s=gF(s,[[`exit`,c,t]]),hF(e,a,e.length,s),e}function sL(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(ZM(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(nL,u,o?u:d)(t):t===91?e.attempt(rL,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(iL,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function cL(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return EM(t)?PI(e,a)(t):a(t)}function a(t){return t===41?u(t):jI(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return EM(t)?PI(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?NI(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return EM(t)?PI(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function lL(e,t,n){let r=this;return i;function i(t){return MI.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(ZM(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function uL(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}const dL={name:`labelStartImage`,resolveAll:tL.resolveAll,tokenize:fL};function fL(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}const pL={name:`labelStartLink`,resolveAll:tL.resolveAll,tokenize:mL};function mL(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}const hL={name:`lineEnding`,tokenize:gL};function gL(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),$F(e,t,`linePrefix`)}}const _L={name:`thematicBreak`,tokenize:vL};function vL(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Q(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),$(t)?$F(e,s,`whitespace`)(t):s(t))}}const yL={continuation:{tokenize:CL},exit:TL,name:`list`,tokenize:SL},bL={partial:!0,tokenize:EL},xL={partial:!0,tokenize:wL};function SL(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:CM(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(_L,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return CM(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(eI,r.interrupt?n:u,e.attempt(bL,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return $(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function CL(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(eI,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,$F(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!$(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(xL,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,$F(e,e.attempt(yL,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function wL(e,t,n){let r=this;return $F(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function TL(e){e.exit(this.containerState.type)}function EL(e,t,n){let r=this;return $F(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!$(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}const DL={name:`setextUnderline`,resolveTo:OL,tokenize:kL};function OL(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function kL(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),$(t)?$F(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Q(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}const AL={tokenize:RL,partial:!0};function jL(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:FL,continuation:{tokenize:IL},exit:LL}},text:{91:{name:`gfmFootnoteCall`,tokenize:PL},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:ML,resolveTo:NL}}}}function ML(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=ZM(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function NL(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function PL(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||EM(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(ZM(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return EM(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function FL(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||EM(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=ZM(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return EM(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),$F(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function IL(e,t,n){return e.check(eI,t,e.attempt(AL,t,n))}function LL(e){e.exit(`gfmFootnoteDefinition`)}function RL(e,t,n){let r=this;return $F(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function zL(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&hF(o,o.length,0,KF(s,e.slice(r+1,n),t)),hF(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),hF(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=UN(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=UN(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var BL=class{constructor(){this.map=[]}add(e,t,n){VL(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function VL(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function HL(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function UL(){return{flow:{null:{name:`table`,tokenize:WL,resolveAll:GL}}}}function WL(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Q(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):$(t)?$F(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||EM(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,$(t)?$F(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return $(t)?$F(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Q(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return $(t)?$F(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Q(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Q(n)?(e.exit(`tableRow`),t(n)):$(n)?$F(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||EM(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function GL(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new BL;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(qL(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=KL(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=KL(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=KL(f,t,o,i,n,d)):(o[0]=o[1],d=KL(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&qL(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=HL(t.events,n))}return e}function KL(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},JL(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=JL(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=JL(t.events,n[2]),a=JL(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},JL(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function qL(e,t,n,r,i){let a=[],o=JL(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function JL(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}const YL={name:`tasklistCheck`,tokenize:ZL};function XL(){return{text:{91:YL}}}function ZL(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return EM(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Q(r)?t(r):$(r)?e.check({tokenize:QL},t,n)(r):n(r)}}function QL(e,t,n){return $F(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function $L(e){return vF([AF(),jL(),zL(e),UL(),XL()])}const eR={};function tR(e){let t=this,n=e||eR,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push($L(n)),a.push(pF()),o.push(mF(n))}function nR(e){let t=this;t.compiler=n;function n(n){return KP(n,{...t.data(`settings`),...e,extensions:t.data(`toMarkdownExtensions`)||[]})}}function rR(e){if(e)throw e}var iR=r(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function aR(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function oR(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?sR(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function sR(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}const cR=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r});var lR=n(iR(),1);const uR={}.hasOwnProperty,dR=new class e extends cR{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=oR()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,lR.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(mR(`data`,this.frozen),this.namespace[e]=t,this):uR.call(this.namespace,e)&&this.namespace[e]||void 0:e?(mR(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=_R(e),n=this.parser||this.Parser;return fR(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),fR(`process`,this.parser||this.Parser),pR(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=_R(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);yR(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),fR(`processSync`,this.parser||this.Parser),pR(`processSync`,this.compiler||this.Compiler),this.process(e,r),gR(`processSync`,`process`,t),n;function r(e,r){t=!0,rR(e),n=r}}run(e,t,n){hR(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=_R(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),gR(`runSync`,`run`,n),r;function i(e,t){rR(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=_R(t),r=this.compiler||this.Compiler;return pR(`stringify`,r),hR(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(mR(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,lR.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];aR(o)&&aR(r)&&(r=(0,lR.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function fR(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function pR(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function mR(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function hR(e){if(!aR(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function gR(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function _R(e){return vR(e)?e:new Ij(e)}function vR(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function yR(e){return typeof e==`string`||bR(e)}function bR(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}function xR(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(SR(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(SR(t.slice(i),i>0,!1)),a.join(``)}function SR(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===9||t===32;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===9||t===32;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function CR(e,t,n,r){let i=new Map,a=new Map,o={all:c,definitionById:i,footnoteById:a,footnoteCounts:new Map,footnoteOrder:[],one:s};return dM(r,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?i:a,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),o;function s(r,i){return jR(e,t,n,r,i,o)}function c(t){let n=[];if(`children`in t){let r=t.children,i=-1;for(;++i<r.length;){let a=o.one(r[i],t);if(a){let t=i?r[i-1]:void 0;if(t?.type===`break`&&t.data?.sourceStyle!==`html`){if(!Array.isArray(a)&&a.type===e.nodes.text){let t=DR(a.text);a=t.length>0?e.text(t):void 0}else if(!Array.isArray(a)&&a.type!==e.nodes.text){let t=a.firstChild;if(t&&t.type===e.nodes.text){let n=DR(t.text),r=L.from(a.content);a=a.copy(n.length>0?r.replaceChild(0,e.text(n)):r.cut(t.nodeSize))}}}}a&&(Array.isArray(a)?n.push(...a):n.push(a))}}return n}}function wR(e){return e.replaceAll(/\n([^\n])/g,` $1`)}function TR(e,t,n){let r=t.referenceType,i=`]`;if(r===`collapsed`?i+=`[]`:r===`full`&&(i+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[e.text(`![`+(t.alt??``)+i)];let a=n.all(t),o=a[0];o&&o.type===e.nodes.text?a[0]=o.copy(L.from(e.text(`[`+(o.text??``)))):a.unshift(e.text(`[`));let s=a[a.length-1];return s&&s.type===e.nodes.text?a[a.length-1]=s.copy(L.from(e.text((s.text??``)+i))):a.push(e.text(i)),a}function ER(e){throw Error(`unknown markdown node: ${e.type}`)}function DR(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function OR(){}function kR(e){throw Error("Expected node, not `"+JSON.stringify(e)+"`")}function AR(e,t,n,r){return wN(`tagName`,{handlers:e})(t,n,r)}function jR(e,t,n,r,i,a){return wN(`type`,{invalid:kR,unknown:ER,handlers:{toml:OR,yaml:OR,definition:OR,footnoteDefinition:OR,root(t,n,r){let i=r.all(t);return e.topNodeType.create(null,i)},html(t){let r=qj(t.value).children[0];if(r?.type!==`element`)return null;let[,i]=r.children;if(i?.type!==`element`)return null;let o=i.children[0];return o?.type===`element`?AR(n,o,void 0,a)||(t.value?e.text(t.value):null):null},text(t){let n=wR(xR(String(t.value)));return n?e.text(n):null},...t,linkReference(n,r,i){if(t.linkReference)return t.linkReference(n,r,i);let a=String(n.identifier).toUpperCase(),o=i.definitionById.get(a);if(!o)return TR(e,n,i);let s={type:`link`,url:o.url,title:o.title,children:n.children,data:{...o.data,...n.data}};return t.link?.(s,r,i)}}})(r,i,a)}function MR(e,t){return(n,r,i)=>{let a=i.all(n);return e.createAndFill(t?.(n)??null,a)}}function NR(e,t){return(n,r,i)=>{let a=i.all(n),o=e.create(t?.(n)??null);return a.map(e=>e.mark(o.addToSet(e.marks)))}}const PR=function(e,t){let n=jR(t.schema,t.handlers,t.htmlHandlers??{},e,void 0,CR(t.schema,t.handlers,t.htmlHandlers??{},e));return n.check(),n},FR=function(e){this.compiler=function(t){return PR(t,e)}};function IR(e,t){let n={one:r,all:u,nodeHandlers:e,markHandlers:t};function r(e,t){let r=e.type.schema,i=e.type.name,a=n.nodeHandlers[i];if(a)return a(e,t,n);if(e.type===r.topNodeType){let t=n.all(e);return t.some(e=>Qj(e,`root`)),{type:`root`,children:t}}return e.type===r.nodes.text?{type:`text`,value:e.text}:null}function i(e){if(e.length===0)return[];let t=e[0].marks,n=[];for(let r of t){let t=!0;for(let n=1;n<e.length;n++)if(!e[n].marks.some(e=>e.eq(r))){t=!1;break}t&&n.push(r)}return n}function a(e,t){let n=e.findIndex(e=>e.eq(t));return n===-1?e:e.slice(0,n).concat(e.slice(n+1))}function o(e,t){let n=[];for(let r of e)t.some(e=>e.eq(r))&&n.push(r);return n}function s(e,t,r){let i=n.markHandlers[e.type.name];if(!i)return r;let a=i(e,t,r,n);return(Array.isArray(a)?a:[a]).filter(e=>e!=null)}function c(e,t){let r=[];for(let i of e){let e=n.one(i.node,t);e!=null&&r.push(e)}return r}function l(e,t){if(e.length===0)return[];if(e.every(e=>e.marks.length===0))return c(e,t);let n=i(e);if(n.length>0){let r=n[0];return s(r,t,l(e.map(e=>({node:e.node,marks:a(e.marks,r)})),t))}let r=[],u=[e[0]],d=e[0].marks.slice();for(let t=1;t<e.length;t++){let n=e[t],i=o(d,n.marks),a=d.length===0&&n.marks.length===0;i.length>0||a?(u.push(n),d=a?[]:i):(r.push(u),u=[n],d=n.marks.slice())}if(r.push(u),r.length===1&&e.length>1){console.warn(`[mdast-util-from-prosemirror] degenerate mark partition; falling back to per-span rendering`,{spanCount:e.length,firstSpanMarks:e[0]?.marks.map(e=>e.type.name),lastSpanMarks:e[e.length-1]?.marks.map(e=>e.type.name)});let n=[];for(let r of e)for(let e of l([r],t))n.push(e);return n}let f=[];for(let e of r)for(let n of l(e,t))f.push(n);return f}function u(e){return l(e.children.map(e=>({node:e,marks:e.marks})),e)}return n}function LR(e,t){return IR(t.nodeHandlers,t.markHandlers).one(e)}function RR(e,t){return(n,r,i)=>{let a=i.all(n);return{type:e,...t?.(n),children:a}}}function zR(e,t){return(n,r,i)=>({type:e,...t?.(n),children:i})}var BR=n(r(((e,t)=>{(function(){var e=t===void 0?function(){return this||(0,eval)(`this`)}():t.exports=i;e.format=i,e.vsprintf=r,typeof console<`u`&&typeof console.log==`function`&&(e.printf=n);function n(){console.log(i.apply(null,arguments))}function r(e,t){return i.apply(null,[e].concat(t))}function i(e){for(var t=1,n=[].slice.call(arguments),r=0,i=e.length,a=``,o,s=!1,c,l,u=!1,d,f=function(){return n[t++]},p=function(){for(var t=``;/\d/.test(e[r]);)t+=e[r++],o=e[r];return t.length>0?parseInt(t):null};r<i;++r)if(o=e[r],s)switch(s=!1,o==`.`?(u=!1,o=e[++r]):o==`0`&&e[r+1]==`.`?(u=!0,r+=2,o=e[r]):u=!0,d=p(),o){case`b`:a+=parseInt(f(),10).toString(2);break;case`c`:c=f(),typeof c==`string`||c instanceof String?a+=c:a+=String.fromCharCode(parseInt(c,10));break;case`d`:a+=parseInt(f(),10);break;case`f`:l=String(parseFloat(f()).toFixed(d||6)),a+=u?l:l.replace(/^0/,``);break;case`j`:a+=JSON.stringify(f());break;case`o`:a+=`0`+parseInt(f(),10).toString(8);break;case`s`:a+=f();break;case`x`:a+=`0x`+parseInt(f(),10).toString(16);break;case`X`:a+=`0x`+parseInt(f(),10).toString(16).toUpperCase();break;default:a+=o;break}else o===`%`?s=!0:a+=o;return a}})()}))(),1);const VR=Object.assign(HR(Error),{eval:HR(EvalError),range:HR(RangeError),reference:HR(ReferenceError),syntax:HR(SyntaxError),type:HR(TypeError),uri:HR(URIError)});function HR(e){return t.displayName=e.displayName||e.name,t;function t(t,...n){return new e(t&&(0,BR.default)(t,...n))}}const UR={}.hasOwnProperty,WR={yaml:`-`,toml:`+`};function GR(e){let t=[],n=-1,r=Array.isArray(e)?e:e?[e]:[`yaml`];for(;++n<r.length;)t[n]=KR(r[n]);return t}function KR(e){let t=e;if(typeof t==`string`){if(!UR.call(WR,t))throw VR("Missing matter definition for `%s`",t);t={type:t,marker:WR[t]}}else if(typeof t!=`object`)throw VR("Expected matter to be an object, not `%j`",t);if(!UR.call(t,`type`))throw VR("Missing `type` in matter `%j`",t);if(!UR.call(t,`fence`)&&!UR.call(t,`marker`))throw VR("Missing `marker` or `fence` in matter `%j`",t);return t}function qR(e){let t=GR(e),n={},r=-1;for(;++r<t.length;){let e=t[r],i=YR(e,`open`).charCodeAt(0),a=JR(e),o=n[i];Array.isArray(o)?o.push(a):n[i]=[a]}return{flow:n}}function JR(e){let t=e.anywhere,n=e.type,r=n+`Fence`,i=r+`Sequence`,a=n+`Value`,o={tokenize:u,partial:!0},s,c=0;return{tokenize:l,concrete:!0};function l(l,u,d){let f=this;return p;function p(a){let o=f.now();return o.column===1&&(o.line===1||t)&&(s=YR(e,`open`),c=0,a===s.charCodeAt(c))?(l.enter(n),l.enter(r),l.enter(i),m(a)):d(a)}function m(e){return c===s.length?(l.exit(i),$(e)?(l.enter(`whitespace`),h(e)):g(e)):e===s.charCodeAt(c++)?(l.consume(e),m):d(e)}function h(e){return $(e)?(l.consume(e),h):(l.exit(`whitespace`),g(e))}function g(t){return Q(t)?(l.exit(r),l.enter(`lineEnding`),l.consume(t),l.exit(`lineEnding`),s=YR(e,`close`),c=0,l.attempt(o,b,_)):d(t)}function _(e){return e===null||Q(e)?y(e):(l.enter(a),v(e))}function v(e){return e===null||Q(e)?(l.exit(a),y(e)):(l.consume(e),v)}function y(e){return e===null?d(e):(l.enter(`lineEnding`),l.consume(e),l.exit(`lineEnding`),l.attempt(o,b,_))}function b(e){return l.exit(n),u(e)}}function u(e,t,n){let a=0;return o;function o(t){return t===s.charCodeAt(a)?(e.enter(r),e.enter(i),c(t)):n(t)}function c(t){return a===s.length?(e.exit(i),$(t)?(e.enter(`whitespace`),l(t)):u(t)):t===s.charCodeAt(a++)?(e.consume(t),c):n(t)}function l(t){return $(t)?(e.consume(t),l):(e.exit(`whitespace`),u(t))}function u(i){return i===null||Q(i)?(e.exit(r),t(i)):n(i)}}}function YR(e,t){return e.marker?XR(e.marker,t).repeat(3):XR(e.fence,t)}function XR(e,t){return typeof e==`string`?e:e[t]}function ZR(e){let t=GR(e),n={},r={},i=-1;for(;++i<t.length;){let e=t[i];n[e.type]=QR(e),r[e.type]=$R,r[e.type+`Value`]=ez}return{enter:n,exit:r}}function QR(e){return t;function t(t){this.enter({type:e.type,value:``},t),this.buffer()}}function $R(e){let t=this.resume(),n=this.stack[this.stack.length-1];`value`in n,this.exit(e),n.value=t.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``)}function ez(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}function tz(e){let t=[],n={},r=GR(e),i=-1;for(;++i<r.length;){let e=r[i];n[e.type]=nz(e);let a=rz(e,`open`);t.push({atBreak:!0,character:a.charAt(0),after:AM(a.charAt(1))})}return{unsafe:t,handlers:n}}function nz(e){let t=rz(e,`open`),n=rz(e,`close`);return r;function r(e){return t+(e.value?`
|
|
273
|
+
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return bN(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=CP.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function cF(){return{exit:{taskListCheckValueChecked:uF,taskListCheckValueUnchecked:uF,paragraph:dF}}}function lF(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:fF}}}function uF(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function dF(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function fF(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=CP.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function pF(){return[LM(),cN(),pN(),$P(),cF()]}function mF(e){return{extensions:[RM(),lN(e),mN(),sF(e),lF()]}}function hF(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function gF(e,t){return e.length>0?(hF(e,e.length,0,t),e):t}const _F={}.hasOwnProperty;function vF(e){let t={},n=-1;for(;++n<e.length;)yF(t,e[n]);return t}function yF(e,t){let n;for(n in t){let r=(_F.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){_F.call(r,a)||(r[a]=[]);let e=i[a];bF(r[a],Array.isArray(e)?e:e?[e]:[])}}}function bF(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);hF(e,0,0,r)}const xF={tokenize:FF,partial:!0},SF={tokenize:IF,partial:!0},CF={tokenize:LF,partial:!0},wF={tokenize:RF,partial:!0},TF={tokenize:zF,partial:!0},EF={name:`wwwAutolink`,tokenize:NF,previous:BF},DF={name:`protocolAutolink`,tokenize:PF,previous:VF},OF={name:`emailAutolink`,tokenize:MF,previous:HF},kF={};function AF(){return{text:kF}}let jF=48;for(;jF<123;)kF[jF]=OF,jF++,jF===58?jF=65:jF===91&&(jF=97);kF[43]=OF,kF[45]=OF,kF[46]=OF,kF[95]=OF,kF[72]=[OF,DF],kF[104]=[OF,DF],kF[87]=[OF,EF],kF[119]=[OF,EF];function MF(e,t,n){let r=this,i,a;return o;function o(t){return!UF(t)||!HF.call(r,r.previous)||WF(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return UF(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(TF,u,l)(t):t===45||t===95||bM(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&yM(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function NF(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!BF.call(r,r.previous)||WF(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(xF,e.attempt(SF,e.attempt(CF,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function PF(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&VF.call(r,r.previous)&&!WF(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(yM(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||SM(t)||EM(t)||OM(t)||DM(t)?n(t):e.attempt(SF,e.attempt(CF,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function FF(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function IF(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(wF,c,s)(t):t===null||EM(t)||OM(t)||t!==45&&DM(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function LF(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(wF,t,a)(o):o===null||EM(o)||OM(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function RF(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||EM(o)||OM(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||EM(e)||OM(e)?t(e):r(e)}function a(e){return yM(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):yM(t)?(e.consume(t),o):n(t)}}function zF(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return bM(e)?n(e):t(e)}}function BF(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||EM(e)}function VF(e){return!yM(e)}function HF(e){return!(e===47||UF(e))}function UF(e){return e===43||e===45||e===46||e===95||bM(e)}function WF(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function GF(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&bM(e.charCodeAt(n+1))&&bM(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function KF(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const qF={name:`attention`,resolveAll:JF,tokenize:YF};function JF(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};XF(d,-c),XF(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=gF(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=gF(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=gF(l,KF(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=gF(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=gF(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,hF(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function YF(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=UN(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=UN(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function XF(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const ZF={name:`autolink`,tokenize:QF};function QF(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return yM(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||bM(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||bM(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||SM(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):xM(t)?(e.consume(t),l):n(t)}function u(e){return bM(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||bM(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}function $F(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return $(r)?(e.enter(n),s(r)):t(r)}function s(r){return $(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}const eI={partial:!0,tokenize:tI};function tI(e,t,n){return r;function r(t){return $(t)?$F(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Q(e)?t(e):n(e)}}const nI={continuation:{tokenize:iI},exit:aI,name:`blockQuote`,tokenize:rI};function rI(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return $(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function iI(e,t,n){let r=this;return i;function i(t){return $(t)?$F(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(nI,t,n)(r)}}function aI(e){e.exit(`blockQuote`)}const oI={name:`characterEscape`,tokenize:sI};function sI(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return TM(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}const cI={name:`characterReference`,tokenize:lI};function lI(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=bM,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=wM,u):(e.enter(`characterReferenceValue`),a=7,o=CM,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===bM&&!AP(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}const uI={partial:!0,tokenize:pI},dI={concrete:!0,name:`codeFenced`,tokenize:fI};function fI(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),$(t)?$F(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Q(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(uI,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):$(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),$F(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Q(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&$(t)?$F(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Q(t)?e.check(uI,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Q(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),$(t)?$F(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),$(t)?$F(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Q(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function pI(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}const mI={name:`codeIndented`,tokenize:gI},hI={partial:!0,tokenize:_I};function gI(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),$F(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Q(t)?e.attempt(hI,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Q(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function _I(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):$F(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Q(e)?i(e):n(e)}}const vI={name:`codeText`,previous:bI,resolve:yI,tokenize:xI};function yI(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function bI(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function xI(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Q(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var SI=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&CI(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),CI(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),CI(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);CI(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);CI(this.left,t.reverse())}}};function CI(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function wI(e){let t={},n=-1,r,i,a,o,s,c,l,u=new SI(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,TI(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return hF(e,0,1/0,u.slice(0)),!l}function TI(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}const EI={resolve:OI,tokenize:kI},DI={partial:!0,tokenize:AI};function OI(e){return wI(e),e}function kI(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Q(t)?e.check(DI,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function AI(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$F(e,a,`linePrefix`)}function a(i){if(i===null||Q(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function jI(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||SM(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Q(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||EM(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||SM(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function MI(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Q(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Q(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!$(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function NI(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$F(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Q(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function PI(e,t){let n;return r;function r(i){return Q(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):$(i)?$F(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}const FI={name:`definition`,tokenize:LI},II={partial:!0,tokenize:RI};function LI(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return MI.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=ZM(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return EM(t)?PI(e,l)(t):l(t)}function l(t){return jI(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(II,d,d)(t)}function d(t){return $(t)?$F(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Q(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function RI(e,t,n){return r;function r(t){return EM(t)?PI(e,i)(t):n(t)}function i(t){return NI(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return $(t)?$F(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Q(e)?t(e):n(e)}}const zI={name:`hardBreakEscape`,tokenize:BI};function BI(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Q(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}const VI={name:`headingAtx`,resolve:HI,tokenize:UI};function HI(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},hF(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function UI(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||EM(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Q(n)?(e.exit(`atxHeading`),t(n)):$(n)?$F(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||EM(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}const WI=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),GI=[`pre`,`script`,`style`,`textarea`],KI={concrete:!0,name:`htmlFlow`,resolveTo:YI,tokenize:XI},qI={partial:!0,tokenize:QI},JI={partial:!0,tokenize:ZI};function YI(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function XI(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ce):yM(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):yM(a)?(e.consume(a),i=4,r.interrupt?t:ce):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ce):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:te:m):n(i)}function h(t){return yM(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||EM(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&GI.includes(l)?(i=1,r.interrupt?t(s):te(s)):WI.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):te(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||bM(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:te):n(i)}function v(t){return $(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||yM(t)?(e.consume(t),b):$(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||bM(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):$(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):$(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Q(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||EM(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||$(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),ee):n(t)}function ee(t){return t===null||Q(t)?te(t):$(t)?(e.consume(t),ee):n(t)}function te(t){return t===45&&i===2?(e.consume(t),ae):t===60&&i===1?(e.consume(t),D):t===62&&i===4?(e.consume(t),le):t===63&&i===3?(e.consume(t),ce):t===93&&i===5?(e.consume(t),se):Q(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(qI,ue,ne)(t)):t===null||Q(t)?(e.exit(`htmlFlowData`),ne(t)):(e.consume(t),te)}function ne(t){return e.check(JI,re,ue)(t)}function re(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ie}function ie(t){return t===null||Q(t)?ne(t):(e.enter(`htmlFlowData`),te(t))}function ae(t){return t===45?(e.consume(t),ce):te(t)}function D(t){return t===47?(e.consume(t),o=``,oe):te(t)}function oe(t){if(t===62){let n=o.toLowerCase();return GI.includes(n)?(e.consume(t),le):te(t)}return yM(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),oe):te(t)}function se(t){return t===93?(e.consume(t),ce):te(t)}function ce(t){return t===62?(e.consume(t),le):t===45&&i===2?(e.consume(t),ce):te(t)}function le(t){return t===null||Q(t)?(e.exit(`htmlFlowData`),ue(t)):(e.consume(t),le)}function ue(n){return e.exit(`htmlFlow`),t(n)}}function ZI(e,t,n){let r=this;return i;function i(t){return Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function QI(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(eI,t,n)}}const $I={name:`htmlText`,tokenize:eL};function eL(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):yM(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):yM(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Q(t)?(o=d,D(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ae(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Q(t)?(o=h,D(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ae(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ae(t):Q(t)?(o=v,D(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Q(t)?(o=y,D(t)):(e.consume(t),y)}function b(e){return e===62?ae(e):y(e)}function x(t){return yM(t)?(e.consume(t),S):n(t)}function S(t){return t===45||bM(t)?(e.consume(t),S):C(t)}function C(t){return Q(t)?(o=C,D(t)):$(t)?(e.consume(t),C):ae(t)}function w(t){return t===45||bM(t)?(e.consume(t),w):t===47||t===62||EM(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ae):t===58||t===95||yM(t)?(e.consume(t),E):Q(t)?(o=T,D(t)):$(t)?(e.consume(t),T):ae(t)}function E(t){return t===45||t===46||t===58||t===95||bM(t)?(e.consume(t),E):ee(t)}function ee(t){return t===61?(e.consume(t),te):Q(t)?(o=ee,D(t)):$(t)?(e.consume(t),ee):T(t)}function te(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,ne):Q(t)?(o=te,D(t)):$(t)?(e.consume(t),te):(e.consume(t),re)}function ne(t){return t===i?(e.consume(t),i=void 0,ie):t===null?n(t):Q(t)?(o=ne,D(t)):(e.consume(t),ne)}function re(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||EM(t)?T(t):(e.consume(t),re)}function ie(e){return e===47||e===62||EM(e)?T(e):n(e)}function ae(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function D(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),oe}function oe(t){return $(t)?$F(e,se,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):se(t)}function se(t){return e.enter(`htmlTextData`),o(t)}}const tL={name:`labelEnd`,resolveAll:aL,resolveTo:oL,tokenize:sL},nL={tokenize:cL},rL={tokenize:lL},iL={tokenize:uL};function aL(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&hF(e,0,e.length,n),e}function oL(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=gF(s,e.slice(a+1,a+r+3)),s=gF(s,[[`enter`,u,t]]),s=gF(s,KF(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=gF(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=gF(s,e.slice(o+1)),s=gF(s,[[`exit`,c,t]]),hF(e,a,e.length,s),e}function sL(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(ZM(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(nL,u,o?u:d)(t):t===91?e.attempt(rL,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(iL,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function cL(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return EM(t)?PI(e,a)(t):a(t)}function a(t){return t===41?u(t):jI(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return EM(t)?PI(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?NI(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return EM(t)?PI(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function lL(e,t,n){let r=this;return i;function i(t){return MI.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(ZM(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function uL(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}const dL={name:`labelStartImage`,resolveAll:tL.resolveAll,tokenize:fL};function fL(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}const pL={name:`labelStartLink`,resolveAll:tL.resolveAll,tokenize:mL};function mL(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}const hL={name:`lineEnding`,tokenize:gL};function gL(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),$F(e,t,`linePrefix`)}}const _L={name:`thematicBreak`,tokenize:vL};function vL(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Q(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),$(t)?$F(e,s,`whitespace`)(t):s(t))}}const yL={continuation:{tokenize:CL},exit:TL,name:`list`,tokenize:SL},bL={partial:!0,tokenize:EL},xL={partial:!0,tokenize:wL};function SL(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:CM(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(_L,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return CM(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(eI,r.interrupt?n:u,e.attempt(bL,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return $(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function CL(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(eI,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,$F(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!$(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(xL,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,$F(e,e.attempt(yL,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function wL(e,t,n){let r=this;return $F(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function TL(e){e.exit(this.containerState.type)}function EL(e,t,n){let r=this;return $F(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!$(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}const DL={name:`setextUnderline`,resolveTo:OL,tokenize:kL};function OL(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function kL(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),$(t)?$F(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Q(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}const AL={tokenize:RL,partial:!0};function jL(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:FL,continuation:{tokenize:IL},exit:LL}},text:{91:{name:`gfmFootnoteCall`,tokenize:PL},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:ML,resolveTo:NL}}}}function ML(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=ZM(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function NL(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function PL(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||EM(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(ZM(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return EM(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function FL(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||EM(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=ZM(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return EM(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),$F(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function IL(e,t,n){return e.check(eI,t,e.attempt(AL,t,n))}function LL(e){e.exit(`gfmFootnoteDefinition`)}function RL(e,t,n){let r=this;return $F(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function zL(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&hF(o,o.length,0,KF(s,e.slice(r+1,n),t)),hF(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),hF(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=UN(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=UN(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var BL=class{constructor(){this.map=[]}add(e,t,n){VL(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function VL(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function HL(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function UL(){return{flow:{null:{name:`table`,tokenize:WL,resolveAll:GL}}}}function WL(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Q(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):$(t)?$F(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||EM(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,$(t)?$F(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return $(t)?$F(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Q(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return $(t)?$F(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Q(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Q(n)?(e.exit(`tableRow`),t(n)):$(n)?$F(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||EM(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function GL(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new BL;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(qL(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=KL(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=KL(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=KL(f,t,o,i,n,d)):(o[0]=o[1],d=KL(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&qL(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=HL(t.events,n))}return e}function KL(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},JL(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=JL(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=JL(t.events,n[2]),a=JL(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},JL(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function qL(e,t,n,r,i){let a=[],o=JL(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function JL(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}const YL={name:`tasklistCheck`,tokenize:ZL};function XL(){return{text:{91:YL}}}function ZL(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return EM(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Q(r)?t(r):$(r)?e.check({tokenize:QL},t,n)(r):n(r)}}function QL(e,t,n){return $F(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function $L(e){return vF([AF(),jL(),zL(e),UL(),XL()])}const eR={};function tR(e){let t=this,n=e||eR,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push($L(n)),a.push(pF()),o.push(mF(n))}function nR(e){let t=this;t.compiler=n;function n(n){return KP(n,{...t.data(`settings`),...e,extensions:t.data(`toMarkdownExtensions`)||[]})}}function rR(e){if(e)throw e}var iR=r(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function aR(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function oR(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?sR(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function sR(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}const cR=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r});var lR=n(iR(),1);const uR={}.hasOwnProperty,dR=new class e extends cR{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=oR()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,lR.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(mR(`data`,this.frozen),this.namespace[e]=t,this):uR.call(this.namespace,e)&&this.namespace[e]||void 0:e?(mR(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=_R(e),n=this.parser||this.Parser;return fR(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),fR(`process`,this.parser||this.Parser),pR(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=_R(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);yR(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),fR(`processSync`,this.parser||this.Parser),pR(`processSync`,this.compiler||this.Compiler),this.process(e,r),gR(`processSync`,`process`,t),n;function r(e,r){t=!0,rR(e),n=r}}run(e,t,n){hR(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=_R(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),gR(`runSync`,`run`,n),r;function i(e,t){rR(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=_R(t),r=this.compiler||this.Compiler;return pR(`stringify`,r),hR(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(mR(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,lR.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];aR(o)&&aR(r)&&(r=(0,lR.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function fR(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function pR(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function mR(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function hR(e){if(!aR(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function gR(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function _R(e){return vR(e)?e:new Ij(e)}function vR(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function yR(e){return typeof e==`string`||bR(e)}function bR(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}function xR(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(SR(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(SR(t.slice(i),i>0,!1)),a.join(``)}function SR(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===9||t===32;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===9||t===32;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function CR(e,t,n,r){let i=new Map,a=new Map,o={all:c,definitionById:i,footnoteById:a,footnoteCounts:new Map,footnoteOrder:[],one:s};return dM(r,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?i:a,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),o;function s(r,i){return jR(e,t,n,r,i,o)}function c(t){let n=[];if(`children`in t){let r=t.children,i=-1;for(;++i<r.length;){let a=o.one(r[i],t);if(a){let t=i?r[i-1]:void 0;if(t?.type===`break`&&t.data?.sourceStyle!==`html`){if(!Array.isArray(a)&&a.type===e.nodes.text){let t=DR(a.text);a=t.length>0?e.text(t):void 0}else if(!Array.isArray(a)&&a.type!==e.nodes.text){let t=a.firstChild;if(t&&t.type===e.nodes.text){let n=DR(t.text),r=L.from(a.content);a=a.copy(n.length>0?r.replaceChild(0,e.text(n)):r.cut(t.nodeSize))}}}}a&&(Array.isArray(a)?n.push(...a):n.push(a))}}return n}}function wR(e){return e.replaceAll(/\n([^\n])/g,` $1`)}function TR(e,t,n){let r=t.referenceType,i=`]`;if(r===`collapsed`?i+=`[]`:r===`full`&&(i+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[e.text(`![`+(t.alt??``)+i)];let a=n.all(t),o=a[0];o&&o.type===e.nodes.text?a[0]=o.copy(L.from(e.text(`[`+(o.text??``)))):a.unshift(e.text(`[`));let s=a[a.length-1];return s&&s.type===e.nodes.text?a[a.length-1]=s.copy(L.from(e.text((s.text??``)+i))):a.push(e.text(i)),a}function ER(e){throw Error(`unknown markdown node: ${e.type}`)}function DR(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function OR(){}function kR(e){throw Error("Expected node, not `"+JSON.stringify(e)+"`")}function AR(e,t,n,r){return wN(`tagName`,{handlers:e})(t,n,r)}function jR(e,t,n,r,i,a){return wN(`type`,{invalid:kR,unknown:ER,handlers:{toml:OR,yaml:OR,definition:OR,footnoteDefinition:OR,root(t,n,r){let i=r.all(t);return e.topNodeType.create(null,i)},html(t){let r=qj(t.value).children[0];if(r?.type!==`element`)return null;let[,i]=r.children;if(i?.type!==`element`)return null;let o=i.children[0];return o?.type===`element`?AR(n,o,void 0,a)||(t.value?e.text(t.value):null):null},text(t){let n=wR(xR(String(t.value)));return n?e.text(/^\s+$/.test(n)?n.replace(/ /g,`\xA0`):n):null},...t,linkReference(n,r,i){if(t.linkReference)return t.linkReference(n,r,i);let a=String(n.identifier).toUpperCase(),o=i.definitionById.get(a);if(!o)return TR(e,n,i);let s={type:`link`,url:o.url,title:o.title,children:n.children,data:{...o.data,...n.data}};return t.link?.(s,r,i)}}})(r,i,a)}function MR(e,t){return(n,r,i)=>{let a=i.all(n);return e.createAndFill(t?.(n)??null,a)}}function NR(e,t){return(n,r,i)=>{let a=i.all(n),o=e.create(t?.(n)??null);return a.map(e=>e.mark(o.addToSet(e.marks)))}}const PR=function(e,t){let n=jR(t.schema,t.handlers,t.htmlHandlers??{},e,void 0,CR(t.schema,t.handlers,t.htmlHandlers??{},e));return n.check(),n},FR=function(e){this.compiler=function(t){return PR(t,e)}};function IR(e,t){let n={one:r,all:u,nodeHandlers:e,markHandlers:t};function r(e,t){let r=e.type.schema,i=e.type.name,a=n.nodeHandlers[i];if(a)return a(e,t,n);if(e.type===r.topNodeType){let t=n.all(e);return t.some(e=>Qj(e,`root`)),{type:`root`,children:t}}return e.type===r.nodes.text?{type:`text`,value:e.text}:null}function i(e){if(e.length===0)return[];let t=e[0].marks,n=[];for(let r of t){let t=!0;for(let n=1;n<e.length;n++)if(!e[n].marks.some(e=>e.eq(r))){t=!1;break}t&&n.push(r)}return n}function a(e,t){let n=e.findIndex(e=>e.eq(t));return n===-1?e:e.slice(0,n).concat(e.slice(n+1))}function o(e,t){let n=[];for(let r of e)t.some(e=>e.eq(r))&&n.push(r);return n}function s(e,t,r){let i=n.markHandlers[e.type.name];if(!i)return r;let a=i(e,t,r,n);return(Array.isArray(a)?a:[a]).filter(e=>e!=null)}function c(e,t){let r=[];for(let i of e){let e=n.one(i.node,t);e!=null&&r.push(e)}return r}function l(e,t){if(e.length===0)return[];if(e.every(e=>e.marks.length===0))return c(e,t);let n=i(e);if(n.length>0){let r=n[0];return s(r,t,l(e.map(e=>({node:e.node,marks:a(e.marks,r)})),t))}let r=[],u=[e[0]],d=e[0].marks.slice();for(let t=1;t<e.length;t++){let n=e[t],i=o(d,n.marks),a=d.length===0&&n.marks.length===0;i.length>0||a?(u.push(n),d=a?[]:i):(r.push(u),u=[n],d=n.marks.slice())}if(r.push(u),r.length===1&&e.length>1){console.warn(`[mdast-util-from-prosemirror] degenerate mark partition; falling back to per-span rendering`,{spanCount:e.length,firstSpanMarks:e[0]?.marks.map(e=>e.type.name),lastSpanMarks:e[e.length-1]?.marks.map(e=>e.type.name)});let n=[];for(let r of e)for(let e of l([r],t))n.push(e);return n}let f=[];for(let e of r)for(let n of l(e,t))f.push(n);return f}function u(e){return l(e.children.map(e=>({node:e,marks:e.marks})),e)}return n}function LR(e,t){return IR(t.nodeHandlers,t.markHandlers).one(e)}function RR(e,t){return(n,r,i)=>{let a=i.all(n);return{type:e,...t?.(n),children:a}}}function zR(e,t){return(n,r,i)=>({type:e,...t?.(n),children:i})}var BR=n(r(((e,t)=>{(function(){var e=t===void 0?function(){return this||(0,eval)(`this`)}():t.exports=i;e.format=i,e.vsprintf=r,typeof console<`u`&&typeof console.log==`function`&&(e.printf=n);function n(){console.log(i.apply(null,arguments))}function r(e,t){return i.apply(null,[e].concat(t))}function i(e){for(var t=1,n=[].slice.call(arguments),r=0,i=e.length,a=``,o,s=!1,c,l,u=!1,d,f=function(){return n[t++]},p=function(){for(var t=``;/\d/.test(e[r]);)t+=e[r++],o=e[r];return t.length>0?parseInt(t):null};r<i;++r)if(o=e[r],s)switch(s=!1,o==`.`?(u=!1,o=e[++r]):o==`0`&&e[r+1]==`.`?(u=!0,r+=2,o=e[r]):u=!0,d=p(),o){case`b`:a+=parseInt(f(),10).toString(2);break;case`c`:c=f(),typeof c==`string`||c instanceof String?a+=c:a+=String.fromCharCode(parseInt(c,10));break;case`d`:a+=parseInt(f(),10);break;case`f`:l=String(parseFloat(f()).toFixed(d||6)),a+=u?l:l.replace(/^0/,``);break;case`j`:a+=JSON.stringify(f());break;case`o`:a+=`0`+parseInt(f(),10).toString(8);break;case`s`:a+=f();break;case`x`:a+=`0x`+parseInt(f(),10).toString(16);break;case`X`:a+=`0x`+parseInt(f(),10).toString(16).toUpperCase();break;default:a+=o;break}else o===`%`?s=!0:a+=o;return a}})()}))(),1);const VR=Object.assign(HR(Error),{eval:HR(EvalError),range:HR(RangeError),reference:HR(ReferenceError),syntax:HR(SyntaxError),type:HR(TypeError),uri:HR(URIError)});function HR(e){return t.displayName=e.displayName||e.name,t;function t(t,...n){return new e(t&&(0,BR.default)(t,...n))}}const UR={}.hasOwnProperty,WR={yaml:`-`,toml:`+`};function GR(e){let t=[],n=-1,r=Array.isArray(e)?e:e?[e]:[`yaml`];for(;++n<r.length;)t[n]=KR(r[n]);return t}function KR(e){let t=e;if(typeof t==`string`){if(!UR.call(WR,t))throw VR("Missing matter definition for `%s`",t);t={type:t,marker:WR[t]}}else if(typeof t!=`object`)throw VR("Expected matter to be an object, not `%j`",t);if(!UR.call(t,`type`))throw VR("Missing `type` in matter `%j`",t);if(!UR.call(t,`fence`)&&!UR.call(t,`marker`))throw VR("Missing `marker` or `fence` in matter `%j`",t);return t}function qR(e){let t=GR(e),n={},r=-1;for(;++r<t.length;){let e=t[r],i=YR(e,`open`).charCodeAt(0),a=JR(e),o=n[i];Array.isArray(o)?o.push(a):n[i]=[a]}return{flow:n}}function JR(e){let t=e.anywhere,n=e.type,r=n+`Fence`,i=r+`Sequence`,a=n+`Value`,o={tokenize:u,partial:!0},s,c=0;return{tokenize:l,concrete:!0};function l(l,u,d){let f=this;return p;function p(a){let o=f.now();return o.column===1&&(o.line===1||t)&&(s=YR(e,`open`),c=0,a===s.charCodeAt(c))?(l.enter(n),l.enter(r),l.enter(i),m(a)):d(a)}function m(e){return c===s.length?(l.exit(i),$(e)?(l.enter(`whitespace`),h(e)):g(e)):e===s.charCodeAt(c++)?(l.consume(e),m):d(e)}function h(e){return $(e)?(l.consume(e),h):(l.exit(`whitespace`),g(e))}function g(t){return Q(t)?(l.exit(r),l.enter(`lineEnding`),l.consume(t),l.exit(`lineEnding`),s=YR(e,`close`),c=0,l.attempt(o,b,_)):d(t)}function _(e){return e===null||Q(e)?y(e):(l.enter(a),v(e))}function v(e){return e===null||Q(e)?(l.exit(a),y(e)):(l.consume(e),v)}function y(e){return e===null?d(e):(l.enter(`lineEnding`),l.consume(e),l.exit(`lineEnding`),l.attempt(o,b,_))}function b(e){return l.exit(n),u(e)}}function u(e,t,n){let a=0;return o;function o(t){return t===s.charCodeAt(a)?(e.enter(r),e.enter(i),c(t)):n(t)}function c(t){return a===s.length?(e.exit(i),$(t)?(e.enter(`whitespace`),l(t)):u(t)):t===s.charCodeAt(a++)?(e.consume(t),c):n(t)}function l(t){return $(t)?(e.consume(t),l):(e.exit(`whitespace`),u(t))}function u(i){return i===null||Q(i)?(e.exit(r),t(i)):n(i)}}}function YR(e,t){return e.marker?XR(e.marker,t).repeat(3):XR(e.fence,t)}function XR(e,t){return typeof e==`string`?e:e[t]}function ZR(e){let t=GR(e),n={},r={},i=-1;for(;++i<t.length;){let e=t[i];n[e.type]=QR(e),r[e.type]=$R,r[e.type+`Value`]=ez}return{enter:n,exit:r}}function QR(e){return t;function t(t){this.enter({type:e.type,value:``},t),this.buffer()}}function $R(e){let t=this.resume(),n=this.stack[this.stack.length-1];`value`in n,this.exit(e),n.value=t.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``)}function ez(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}function tz(e){let t=[],n={},r=GR(e),i=-1;for(;++i<r.length;){let e=r[i];n[e.type]=nz(e);let a=rz(e,`open`);t.push({atBreak:!0,character:a.charAt(0),after:AM(a.charAt(1))})}return{unsafe:t,handlers:n}}function nz(e){let t=rz(e,`open`),n=rz(e,`close`);return r;function r(e){return t+(e.value?`
|
|
274
274
|
`+e.value:``)+`
|
|
275
275
|
`+n}}function rz(e,t){return e.marker?iz(e.marker,t).repeat(3):iz(e.fence,t)}function iz(e,t){return typeof e==`string`?e:e[t]}function az(e){let t=this,n=e||`yaml`,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(qR(n)),a.push(ZR(n)),o.push(tz(n))}function oz(e){return e.charAt(0).toUpperCase()+e.slice(1)}const sz={note:`<svg class="octicon octicon-info mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>`,tip:`<svg class="octicon octicon-light-bulb mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z"></path></svg>`,important:`<svg class="octicon octicon-report mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>`,warning:`<svg class="octicon octicon-alert mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>`,caution:`<svg class="octicon octicon-stop mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>`};function cz(e){return e.replace(`<svg`,~e.indexOf(`xmlns`)?`<svg`:`<svg xmlns="http://www.w3.org/2000/svg"`).replaceAll(`"`,`'`).replaceAll(`%`,`%25`).replaceAll(`#`,`%23`).replaceAll(`{`,`%7B`).replaceAll(`}`,`%7D`).replaceAll(`<`,`%3C`).replaceAll(`>`,`%3E`)}const lz=(e={})=>{let{markers:t=[`TIP`,`NOTE`,`IMPORTANT`,`WARNING`,`CAUTION`],icons:n=sz,matchCaseSensitive:r=!1,titles:i={},classPrefix:a=`markdown-alert`,ignoreSquareBracket:o=!1}=e,s=t===`*`?`\\w+`:t.join(`|`),c=RegExp(o?`^!(${s})([^\\n\\r]*)`:`^\\[\\!(${s})\\]([^\\n\\r]*)`,r?``:`i`);return e=>(dM(e,`blockquote`,(e,t,r)=>{let o=e.children[0];if(!o)return;let s=o.children?.[0];if(!s||(!(`value`in s)&&`children`in s&&s.children[0]&&(s=s.children[0]),s.type!==`text`))return;let l=s.value.match(c);if(!l)return;let u=l[1]?.toLowerCase(),d=l[2]?.trim()||(i[u]??oz(u)),f=n[u],p=`data:image/svg+xml;utf8,${cz(f)}`;t===void 0||!r||(s.value=s.value.slice(l[0].length).trimStart(),e.data={hName:`div`,hProperties:{class:`${a} ${a}-${u}`}},e.children=[{type:`paragraph`,data:{hName:`p`,hProperties:{class:`${a}-title`}},children:[{type:`span`,data:{hName:`span`,hProperties:{class:`octicon octicon-${u}`,style:`--oct-icon: url("${p}")`}}},{type:`text`,value:d}]},...e.children])}),e)};function uz(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:a},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:s,mathText:o,mathTextData:s}};function e(e){this.enter({type:`math`,meta:null,value:``,data:{hName:`pre`,hChildren:[{type:`element`,tagName:`code`,properties:{className:[`language-math`,`math-display`]},children:[]}]}},e)}function t(){this.buffer()}function n(){let e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.meta=e}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(e){let t=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t;let r=n.data.hChildren[0];r.type,r.tagName,r.children.push({type:`text`,value:t}),this.data.mathFlowInside=void 0}function a(e){this.enter({type:`inlineMath`,value:``,data:{hName:`code`,hProperties:{className:[`language-math`,`math-inline`]},hChildren:[]}},e),this.buffer()}function o(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t,n.data.hChildren.push({type:`text`,value:t})}function s(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}}function dz(e){let t=(e||{}).singleDollarTextMath;return t??=!0,r.peek=i,{unsafe:[{character:`\r`,inConstruct:`mathFlowMeta`},{character:`
|
|
276
276
|
`,inConstruct:`mathFlowMeta`},{character:`$`,after:t?void 0:`\\$`,inConstruct:`phrasing`},{character:`$`,inConstruct:`mathFlowMeta`},{atBreak:!0,character:`$`,after:`\\$`}],handlers:{math:n,inlineMath:r}};function n(e,t,n,r){let i=e.value||``,a=n.createTracker(r),o=`$`.repeat(Math.max(PN(i,`$`)+1,2)),s=n.enter(`mathFlow`),c=a.move(o);if(e.meta){let t=n.enter(`mathFlowMeta`);c+=a.move(n.safe(e.meta,{after:`
|
|
@@ -301,7 +301,7 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
301
301
|
`,PLUGIN_SECURE_PROXY_MISSING_CHAT_MODEL:`Could not find a chat model defined in the secure proxy plugin configuration.
|
|
302
302
|
Please provide a chat model before proceeding with creating an answer session.
|
|
303
303
|
Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#plugin-secure-proxy
|
|
304
|
-
`,ANSWER_SESSION_LAST_MESSAGE_IS_NOT_ASSISTANT:`The last message in the session is not an assistant message. Cannot regenerate non-assistant messages.`,PLUGIN_COMPONENT_CONFLICT:`The component "%s" is already defined. The plugin "%s" is trying to redefine it.`};function mH(e,...t){let n=Error(GV(pH[e]??`Unsupported Orama Error code: ${e}`,...t));return n.code=e,`captureStackTrace`in Error.prototype&&Error.captureStackTrace(n),n}function hH(e){return{raw:Number(e),formatted:YV(e)}}function gH(e){if(e.id){if(typeof e.id!=`string`)throw mH(`DOCUMENT_ID_MUST_BE_STRING`,typeof e.id);return e.id}return ZV()}function _H(e,t){for(let[n,r]of Object.entries(t)){let t=e[n];if(t!==void 0&&!(r===`geopoint`&&typeof t==`object`&&typeof t.lon==`number`&&typeof t.lat==`number`)&&!(r===`enum`&&(typeof t==`string`||typeof t==`number`))){if(r===`enum[]`&&Array.isArray(t)){let e=t.length;for(let r=0;r<e;r++)if(typeof t[r]!=`string`&&typeof t[r]!=`number`)return n+`.`+r;continue}if(xH(r)){let e=wH(r);if(!Array.isArray(t)||t.length!==e)throw mH(`INVALID_INPUT_VECTOR`,n,e,t.length);continue}if(SH(r)){if(!Array.isArray(t))return n;let e=CH(r),i=t.length;for(let r=0;r<i;r++)if(typeof t[r]!==e)return n+`.`+r;continue}if(typeof r==`object`){if(!t||typeof t!=`object`)return n;let e=_H(t,r);if(e)return n+`.`+e;continue}if(typeof t!==r)return n}}}const vH={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},yH={"string[]":`string`,"number[]":`number`,"boolean[]":`boolean`,"enum[]":`enum`};function bH(e){return e===`geopoint`}function xH(e){return typeof e==`string`&&/^vector\[\d+\]$/.test(e)}function SH(e){return typeof e==`string`&&vH[e]}function CH(e){return yH[e]}function wH(e){let t=Number(e.slice(7,-1));switch(!0){case isNaN(t):throw mH(`INVALID_VECTOR_VALUE`,e);case t<=0:throw mH(`INVALID_VECTOR_SIZE`,e);default:return t}}function TH(){return{idToInternalId:new Map,internalIdToId:[],save:EH,load:DH}}function EH(e){return{internalIdToId:e.internalIdToId}}function DH(e,t){let{internalIdToId:n}=t;e.internalDocumentIDStore.idToInternalId.clear(),e.internalDocumentIDStore.internalIdToId=[];let r=n.length;for(let t=0;t<r;t++){let r=n[t];e.internalDocumentIDStore.idToInternalId.set(r,t+1),e.internalDocumentIDStore.internalIdToId.push(r)}}function OH(e,t){if(typeof t==`string`){let n=e.idToInternalId.get(t);if(n)return n;let r=e.idToInternalId.size+1;return e.idToInternalId.set(t,r),e.internalIdToId.push(t),r}return t>e.internalIdToId.length?OH(e,t.toString()):t}function kH(e,t){if(e.internalIdToId.length<t)throw Error(`Invalid internalId ${t}`);return e.internalIdToId[t-1]}function AH(e,t){return{sharedInternalDocumentStore:t,docs:{},count:0}}function jH(e,t){let n=OH(e.sharedInternalDocumentStore,t);return e.docs[n]}function MH(e,t){let n=t.length,r=Array.from({length:n});for(let i=0;i<n;i++){let n=OH(e.sharedInternalDocumentStore,t[i]);r[i]=e.docs[n]}return r}function NH(e){return e.docs}function PH(e,t,n,r){return e.docs[n]===void 0?(e.docs[n]=r,e.count++,!0):!1}function FH(e,t){let n=OH(e.sharedInternalDocumentStore,t);return e.docs[n]===void 0?!1:(delete e.docs[n],e.count--,!0)}function IH(e){return e.count}function LH(e,t){let n=t;return{docs:n.docs,count:n.count,sharedInternalDocumentStore:e}}function RH(e){return{docs:e.docs,count:e.count}}function zH(){return{create:AH,get:jH,getMultiple:MH,getAll:NH,store:PH,remove:FH,count:IH,load:LH,save:RH}}const BH=[`beforeInsert`,`afterInsert`,`beforeRemove`,`afterRemove`,`beforeUpdate`,`afterUpdate`,`beforeUpsert`,`afterUpsert`,`beforeSearch`,`afterSearch`,`beforeInsertMultiple`,`afterInsertMultiple`,`beforeRemoveMultiple`,`afterRemoveMultiple`,`beforeUpdateMultiple`,`afterUpdateMultiple`,`beforeUpsertMultiple`,`afterUpsertMultiple`,`beforeLoad`,`afterLoad`,`afterCreate`];function VH(e,t){let n=[],r=e.plugins?.length;if(!r)return n;for(let i=0;i<r;i++)try{let r=e.plugins[i];typeof r[t]==`function`&&n.push(r[t])}catch(e){throw console.error(`Caught error in getAllPluginsByHook:`,e),mH(`PLUGIN_CRASHED`)}return n}const HH=[`tokenizer`,`index`,`documentsStore`,`sorter`,`pinning`],UH=[`validateSchema`,`getDocumentIndexId`,`getDocumentProperties`,`formatElapsedTime`];function WH(e,t,n,r){if(e.some(oH))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function GH(e,t,n){if(e.some(oH))return(async()=>{for(let r of e)await r(t,n)})();for(let r of e)r(t,n)}function KH(e,t,n,r,i){if(e.some(oH))return(async()=>{for(let a of e)await a(t,n,r,i)})();for(let a of e)a(t,n,r,i)}function qH(e,t,n,r){if(e.some(oH))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function JH(e,t){if(e.some(oH))return(async()=>{for(let n of e)await n(t)})();for(let n of e)n(t)}var YH=class e{k;v;l=null;r=null;h=1;constructor(e,t){this.k=e,this.v=new Set(t)}updateHeight(){this.h=Math.max(e.getHeight(this.l),e.getHeight(this.r))+1}static getHeight(e){return e?e.h:0}getBalanceFactor(){return e.getHeight(this.l)-e.getHeight(this.r)}rotateLeft(){let e=this.r;return this.r=e.l,e.l=this,this.updateHeight(),e.updateHeight(),e}rotateRight(){let e=this.l;return this.l=e.r,e.r=this,this.updateHeight(),e.updateHeight(),e}toJSON(){return{k:this.k,v:Array.from(this.v),l:this.l?this.l.toJSON():null,r:this.r?this.r.toJSON():null,h:this.h}}static fromJSON(t){let n=new e(t.k,t.v);return n.l=t.l?e.fromJSON(t.l):null,n.r=t.r?e.fromJSON(t.r):null,n.h=t.h,n}},XH=class e{root=null;insertCount=0;constructor(e,t){e!==void 0&&t!==void 0&&(this.root=new YH(e,t))}insert(e,t,n=1e3){this.root=this.insertNode(this.root,e,t,n)}insertMultiple(e,t,n=1e3){for(let r of t)this.insert(e,r,n)}rebalance(){this.root&&=this.rebalanceNode(this.root)}toJSON(){return{root:this.root?this.root.toJSON():null,insertCount:this.insertCount}}static fromJSON(t){let n=new e;return n.root=t.root?YH.fromJSON(t.root):null,n.insertCount=t.insertCount||0,n}insertNode(e,t,n,r){if(e===null)return new YH(t,[n]);let i=[],a=e,o=null;for(;a!==null;)if(i.push({parent:o,node:a}),t<a.k)if(a.l===null){a.l=new YH(t,[n]),i.push({parent:a,node:a.l});break}else o=a,a=a.l;else if(t>a.k)if(a.r===null){a.r=new YH(t,[n]),i.push({parent:a,node:a.r});break}else o=a,a=a.r;else return a.v.add(n),e;let s=!1;this.insertCount++%r===0&&(s=!0);for(let t=i.length-1;t>=0;t--){let{parent:n,node:r}=i[t];if(r.updateHeight(),s){let t=this.rebalanceNode(r);n?n.l===r?n.l=t:n.r===r&&(n.r=t):e=t}}return e}rebalanceNode(e){let t=e.getBalanceFactor();if(t>1){if(e.l&&e.l.getBalanceFactor()>=0)return e.rotateRight();if(e.l)return e.l=e.l.rotateLeft(),e.rotateRight()}if(t<-1){if(e.r&&e.r.getBalanceFactor()<=0)return e.rotateLeft();if(e.r)return e.r=e.r.rotateRight(),e.rotateLeft()}return e}find(e){let t=this.findNodeByKey(e);return t?t.v:null}contains(e){return this.find(e)!==null}getSize(){let e=0,t=[],n=this.root;for(;n||t.length>0;){for(;n;)t.push(n),n=n.l;n=t.pop(),e++,n=n.r}return e}isBalanced(){if(!this.root)return!0;let e=[this.root];for(;e.length>0;){let t=e.pop(),n=t.getBalanceFactor();if(Math.abs(n)>1)return!1;t.l&&e.push(t.l),t.r&&e.push(t.r)}return!0}remove(e){this.root=this.removeNode(this.root,e)}removeDocument(e,t){let n=this.findNodeByKey(e);n&&(n.v.size===1?this.root=this.removeNode(this.root,e):n.v=new Set([...n.v.values()].filter(e=>e!==t)))}findNodeByKey(e){let t=this.root;for(;t;)if(e<t.k)t=t.l;else if(e>t.k)t=t.r;else return t;return null}removeNode(e,t){if(e===null)return null;let n=[],r=e;for(;r!==null&&r.k!==t;)n.push(r),r=t<r.k?r.l:r.r;if(r===null)return e;if(r.l===null||r.r===null){let t=r.l?r.l:r.r;if(n.length===0)e=t;else{let e=n[n.length-1];e.l===r?e.l=t:e.r=t}}else{let e=r,t=r.r;for(;t.l!==null;)e=t,t=t.l;r.k=t.k,r.v=t.v,e.l===t?e.l=t.r:e.r=t.r,r=e}n.push(r);for(let t=n.length-1;t>=0;t--){let r=n[t];r.updateHeight();let i=this.rebalanceNode(r);if(t>0){let e=n[t-1];e.l===r?e.l=i:e.r===r&&(e.r=i)}else e=i}return e}rangeSearch(e,t){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.l;if(i=r.pop(),i.k>=e&&i.k<=t)for(let e of i.v)n.add(e);if(i.k>t)break;i=i.r}return n}greaterThan(e,t=!1){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.r;if(i=r.pop(),t&&i.k>=e||!t&&i.k>e)for(let e of i.v)n.add(e);else if(i.k<=e)break;i=i.l}return n}lessThan(e,t=!1){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.l;if(i=r.pop(),t&&i.k<=e||!t&&i.k<e)for(let e of i.v)n.add(e);else if(i.k>e)break;i=i.r}return n}},ZH=class e{numberToDocumentId;constructor(){this.numberToDocumentId=new Map}insert(e,t){this.numberToDocumentId.has(e)?this.numberToDocumentId.get(e).add(t):this.numberToDocumentId.set(e,new Set([t]))}find(e){let t=this.numberToDocumentId.get(e);return t?Array.from(t):null}remove(e){this.numberToDocumentId.delete(e)}removeDocument(e,t){let n=this.numberToDocumentId.get(t);n&&(n.delete(e),n.size===0&&this.numberToDocumentId.delete(t))}contains(e){return this.numberToDocumentId.has(e)}getSize(){let e=0;for(let t of this.numberToDocumentId.values())e+=t.size;return e}filter(e){let t=Object.keys(e);if(t.length!==1)throw Error(`Invalid operation`);let n=t[0];switch(n){case`eq`:{let t=e[n],r=this.numberToDocumentId.get(t);return r?Array.from(r):[]}case`in`:{let t=e[n],r=new Set;for(let e of t){let t=this.numberToDocumentId.get(e);if(t)for(let e of t)r.add(e)}return Array.from(r)}case`nin`:{let t=new Set(e[n]),r=new Set;for(let[e,n]of this.numberToDocumentId.entries())if(!t.has(e))for(let e of n)r.add(e);return Array.from(r)}default:throw Error(`Invalid operation`)}}filterArr(e){let t=Object.keys(e);if(t.length!==1)throw Error(`Invalid operation`);let n=t[0];switch(n){case`containsAll`:{let t=e[n].map(e=>this.numberToDocumentId.get(e)??new Set);if(t.length===0)return[];let r=t.reduce((e,t)=>new Set([...e].filter(e=>t.has(e))));return Array.from(r)}case`containsAny`:{let t=e[n].map(e=>this.numberToDocumentId.get(e)??new Set);if(t.length===0)return[];let r=t.reduce((e,t)=>new Set([...e,...t]));return Array.from(r)}default:throw Error(`Invalid operation`)}}static fromJSON(t){if(!t.numberToDocumentId)throw Error(`Invalid Flat Tree JSON`);let n=new e;for(let[e,r]of t.numberToDocumentId)n.numberToDocumentId.set(e,new Set(r));return n}toJSON(){return{numberToDocumentId:Array.from(this.numberToDocumentId.entries()).map(([e,t])=>[e,Array.from(t)])}}};function QH(e,t,n){if(n<0)return-1;if(e===t)return 0;let r=e.length,i=t.length;if(r===0)return i<=n?i:-1;if(i===0)return r<=n?r:-1;let a=Math.abs(r-i);if(e.startsWith(t))return a<=n?a:-1;if(t.startsWith(e))return 0;if(a>n)return-1;let o=[];for(let e=0;e<=r;e++){o[e]=[e];for(let t=1;t<=i;t++)o[e][t]=e===0?t:0}for(let a=1;a<=r;a++){let r=1/0;for(let n=1;n<=i;n++)e[a-1]===t[n-1]?o[a][n]=o[a-1][n-1]:o[a][n]=Math.min(o[a-1][n]+1,o[a][n-1]+1,o[a-1][n-1]+1),r=Math.min(r,o[a][n]);if(r>n)return-1}return o[r][i]<=n?o[r][i]:-1}function $H(e,t,n){let r=QH(e,t,n);return{distance:r,isBounded:r>=0}}var eU=class e{k;s;c=new Map;d=new Set;e;w=``;constructor(e,t,n){this.k=e,this.s=t,this.e=n}updateParent(e){this.w=e.w+this.s}addDocument(e){this.d.add(e)}removeDocument(e){return this.d.delete(e)}findAllWords(e,t,n,r){let i=[this];for(;i.length>0;){let a=i.pop();if(a.e){let{w:i,d:o}=a;if(n&&i!==t)continue;if(QV(e,i)!==null)if(r)if(Math.abs(t.length-i.length)<=r&&$H(t,i,r).isBounded)e[i]=[];else continue;else e[i]=[];if(QV(e,i)!=null&&o.size>0){let t=e[i];for(let e of o)t.includes(e)||t.push(e)}}a.c.size>0&&i.push(...a.c.values())}return e}insert(t,n){let r=this,i=0,a=t.length;for(;i<a;){let o=t[i],s=r.c.get(o);if(s){let o=s.s,c=o.length,l=0;for(;l<c&&i+l<a&&o[l]===t[i+l];)l++;if(l===c){if(r=s,i+=l,i===a){s.e||=!0,s.addDocument(n);return}continue}let u=o.slice(0,l),d=o.slice(l),f=t.slice(i+l),p=new e(u[0],u,!1);if(r.c.set(u[0],p),p.updateParent(r),s.s=d,s.k=d[0],p.c.set(d[0],s),s.updateParent(p),f){let t=new e(f[0],f,!0);t.addDocument(n),p.c.set(f[0],t),t.updateParent(p)}else p.e=!0,p.addDocument(n);return}else{let a=new e(o,t.slice(i),!0);a.addDocument(n),r.c.set(o,a),a.updateParent(r);return}}r.e||=!0,r.addDocument(n)}_findLevenshtein(e,t,n,r,i){let a=[{node:this,index:t,tolerance:n}];for(;a.length>0;){let{node:t,index:n,tolerance:o}=a.pop();if(t.w.startsWith(e)){t.findAllWords(i,e,!1,0);continue}if(o<0)continue;if(t.e){let{w:n,d:a}=t;if(n&&($H(e,n,r).isBounded&&(i[n]=[]),QV(i,n)!==void 0&&a.size>0)){let e=new Set(i[n]);for(let t of a)e.add(t);i[n]=Array.from(e)}}if(n>=e.length)continue;let s=e[n];if(t.c.has(s)){let e=t.c.get(s);a.push({node:e,index:n+1,tolerance:o})}a.push({node:t,index:n+1,tolerance:o-1});for(let[e,r]of t.c)a.push({node:r,index:n,tolerance:o-1}),e!==s&&a.push({node:r,index:n+1,tolerance:o-1})}}find(e){let{term:t,exact:n,tolerance:r}=e;if(r&&!n){let e={};return this._findLevenshtein(t,0,r,r,e),e}else{let e=this,i=0,a=t.length;for(;i<a;){let o=t[i],s=e.c.get(o);if(s){let o=s.s,c=o.length,l=0;for(;l<c&&i+l<a&&o[l]===t[i+l];)l++;if(l===c)e=s,i+=l;else if(i+l===a)if(l===a-i){if(n)return{};{let e={};return s.findAllWords(e,t,n,r),e}}else return{};else return{}}else return{}}let o={};return e.findAllWords(o,t,n,r),o}}contains(e){let t=this,n=0,r=e.length;for(;n<r;){let i=e[n],a=t.c.get(i);if(a){let i=a.s,o=i.length,s=0;for(;s<o&&n+s<r&&i[s]===e[n+s];)s++;if(s<o)return!1;n+=o,t=a}else return!1}return!0}removeWord(e){if(!e)return!1;let t=this,n=e.length,r=[];for(let i=0;i<n;i++){let n=e[i];if(t.c.has(n)){let e=t.c.get(n);r.push({parent:t,character:n}),i+=e.s.length-1,t=e}else return!1}for(t.d.clear(),t.e=!1;r.length>0&&t.c.size===0&&!t.e&&t.d.size===0;){let{parent:e,character:n}=r.pop();e.c.delete(n),t=e}return!0}removeDocumentByWord(e,t,n=!0){if(!e)return!0;let r=this,i=e.length;for(let a=0;a<i;a++){let i=e[a];if(r.c.has(i)){let o=r.c.get(i);a+=o.s.length-1,r=o,n&&r.w!==e||r.removeDocument(t)}else return!1}return!0}static getCommonPrefix(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e.charCodeAt(r)===t.charCodeAt(r);)r++;return e.slice(0,r)}toJSON(){return{w:this.w,s:this.s,e:this.e,k:this.k,d:Array.from(this.d),c:Array.from(this.c?.entries())?.map(([e,t])=>[e,t.toJSON()])}}static fromJSON(t){let n=new e(t.k,t.s,t.e);return n.w=t.w,n.d=new Set(t.d),n.c=new Map(t?.c?.map(([t,n])=>[t,e.fromJSON(n)])||[]),n}},tU=class e extends eU{constructor(){super(``,``,!1)}static fromJSON(t){let n=new e;return n.w=t.w,n.s=t.s,n.e=t.e,n.k=t.k,n.d=new Set(t.d),n.c=new Map(t?.c?.map(([e,t])=>[e,eU.fromJSON(t)])||[]),n}toJSON(){return super.toJSON()}},nU=class e{point;docIDs;left;right;parent;constructor(e,t){this.point=e,this.docIDs=new Set(t),this.left=null,this.right=null,this.parent=null}toJSON(){return{point:this.point,docIDs:Array.from(this.docIDs),left:this.left?this.left.toJSON():null,right:this.right?this.right.toJSON():null}}static fromJSON(t,n=null){let r=new e(t.point,t.docIDs);return r.parent=n,t.left&&(r.left=e.fromJSON(t.left,r)),t.right&&(r.right=e.fromJSON(t.right,r)),r}},rU=class e{root;nodeMap;constructor(){this.root=null,this.nodeMap=new Map}getPointKey(e){return`${e.lon},${e.lat}`}insert(e,t){let n=this.getPointKey(e),r=this.nodeMap.get(n);if(r){t.forEach(e=>r.docIDs.add(e));return}let i=new nU(e,t);if(this.nodeMap.set(n,i),this.root==null){this.root=i;return}let a=this.root,o=0;for(;;){if(o%2==0)if(e.lon<a.point.lon){if(a.left==null){a.left=i,i.parent=a;return}a=a.left}else{if(a.right==null){a.right=i,i.parent=a;return}a=a.right}else if(e.lat<a.point.lat){if(a.left==null){a.left=i,i.parent=a;return}a=a.left}else{if(a.right==null){a.right=i,i.parent=a;return}a=a.right}o++}}contains(e){let t=this.getPointKey(e);return this.nodeMap.has(t)}getDocIDsByCoordinates(e){let t=this.getPointKey(e),n=this.nodeMap.get(t);return n?Array.from(n.docIDs):null}removeDocByID(e,t){let n=this.getPointKey(e),r=this.nodeMap.get(n);r&&(r.docIDs.delete(t),r.docIDs.size===0&&(this.nodeMap.delete(n),this.deleteNode(r)))}deleteNode(e){let t=e.parent,n=e.left?e.left:e.right;n&&(n.parent=t),t?t.left===e?t.left=n:t.right===e&&(t.right=n):(this.root=n,this.root&&(this.root.parent=null))}searchByRadius(t,n,r=!0,i=`asc`,a=!1){let o=a?e.vincentyDistance:e.haversineDistance,s=[{node:this.root,depth:0}],c=[];for(;s.length>0;){let{node:e,depth:i}=s.pop();if(e==null)continue;let a=o(t,e.point);(r?a<=n:a>n)&&c.push({point:e.point,docIDs:Array.from(e.docIDs)}),e.left!=null&&s.push({node:e.left,depth:i+1}),e.right!=null&&s.push({node:e.right,depth:i+1})}return i&&c.sort((e,n)=>{let r=o(t,e.point),a=o(t,n.point);return i.toLowerCase()===`asc`?r-a:a-r}),c}searchByPolygon(t,n=!0,r=null,i=!1){let a=[{node:this.root,depth:0}],o=[];for(;a.length>0;){let{node:r,depth:i}=a.pop();if(r==null)continue;r.left!=null&&a.push({node:r.left,depth:i+1}),r.right!=null&&a.push({node:r.right,depth:i+1});let s=e.isPointInPolygon(t,r.point);(s&&n||!s&&!n)&&o.push({point:r.point,docIDs:Array.from(r.docIDs)})}let s=e.calculatePolygonCentroid(t);if(r){let t=i?e.vincentyDistance:e.haversineDistance;o.sort((e,n)=>{let i=t(s,e.point),a=t(s,n.point);return r.toLowerCase()===`asc`?i-a:a-i})}return o}toJSON(){return{root:this.root?this.root.toJSON():null}}static fromJSON(t){let n=new e;return t.root&&(n.root=nU.fromJSON(t.root),n.buildNodeMap(n.root)),n}buildNodeMap(e){if(e==null)return;let t=this.getPointKey(e.point);this.nodeMap.set(t,e),e.left&&this.buildNodeMap(e.left),e.right&&this.buildNodeMap(e.right)}static calculatePolygonCentroid(e){let t=0,n=0,r=0,i=e.length;for(let a=0,o=i-1;a<i;o=a++){let i=e[a].lon,s=e[a].lat,c=e[o].lon,l=e[o].lat,u=i*l-c*s;t+=u,n+=(i+c)*u,r+=(s+l)*u}t/=2;let a=6*t;return n/=a,r/=a,{lon:n,lat:r}}static isPointInPolygon(e,t){let n=!1,r=t.lon,i=t.lat,a=e.length;for(let t=0,o=a-1;t<a;o=t++){let a=e[t].lon,s=e[t].lat,c=e[o].lon,l=e[o].lat;s>i!=l>i&&r<(c-a)*(i-s)/(l-s)+a&&(n=!n)}return n}static haversineDistance(e,t){let n=Math.PI/180,r=e.lat*n,i=t.lat*n,a=(t.lat-e.lat)*n,o=(t.lon-e.lon)*n,s=Math.sin(a/2)*Math.sin(a/2)+Math.cos(r)*Math.cos(i)*Math.sin(o/2)*Math.sin(o/2);return 6371e3*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}static vincentyDistance(e,t){let n=6378137,r=1/298.257223563,i=(1-r)*n,a=Math.PI/180,o=e.lat*a,s=t.lat*a,c=(t.lon-e.lon)*a,l=Math.atan((1-r)*Math.tan(o)),u=Math.atan((1-r)*Math.tan(s)),d=Math.sin(l),f=Math.cos(l),p=Math.sin(u),m=Math.cos(u),h=c,g,_=1e3,v,y,b,x,S,C;do{let e=Math.sin(h),t=Math.cos(h);if(v=Math.sqrt(m*e*(m*e)+(f*p-d*m*t)*(f*p-d*m*t)),v===0)return 0;y=d*p+f*m*t,b=Math.atan2(v,y),x=f*m*e/v,S=1-x*x,C=y-2*d*p/S,isNaN(C)&&(C=0);let n=r/16*S*(4+r*(4-3*S));g=h,h=c+(1-n)*r*x*(b+n*v*(C+n*y*(-1+2*C*C)))}while(Math.abs(h-g)>1e-12&&--_>0);if(_===0)return NaN;let w=S*(n*n-i*i)/(i*i),T=1+w/16384*(4096+w*(-768+w*(320-175*w))),E=w/1024*(256+w*(-128+w*(74-47*w))),ee=E*v*(C+E/4*(y*(-1+2*C*C)-E/6*C*(-3+4*v*v)*(-3+4*C*C)));return i*T*(b-ee)}},iU=class e{true;false;constructor(){this.true=new Set,this.false=new Set}insert(e,t){t?this.true.add(e):this.false.add(e)}delete(e,t){t?this.true.delete(e):this.false.delete(e)}getSize(){return this.true.size+this.false.size}toJSON(){return{true:Array.from(this.true),false:Array.from(this.false)}}static fromJSON(t){let n=new e;return n.true=new Set(t.true),n.false=new Set(t.false),n}};function aU(e,t,n,r,i,{k:a,b:o,d:s}){return Math.log(1+(n-t+.5)/(t+.5))*(s+e*(a+1))/(e+a*(1-o+o*r/i))}var oU=class e{size;vectors=new Map;constructor(e){this.size=e}add(e,t){t instanceof Float32Array||(t=new Float32Array(t));let n=sU(t,this.size);this.vectors.set(e,[n,t])}remove(e){this.vectors.delete(e)}find(e,t,n){return e instanceof Float32Array||(e=new Float32Array(e)),cU(e,n,this.vectors,this.size,t)}toJSON(){let e=[];for(let[t,[n,r]]of this.vectors)e.push([t,[n,Array.from(r)]]);return{size:this.size,vectors:e}}static fromJSON(t){let n=t,r=new e(n.size);for(let[e,[t,i]]of n.vectors)r.vectors.set(e,[t,new Float32Array(i)]);return r}};function sU(e,t){let n=0;for(let r=0;r<t;r++)n+=e[r]*e[r];return Math.sqrt(n)}function cU(e,t,n,r,i){let a=sU(e,r),o=[],s=t||n.keys();for(let t of s){let s=n.get(t);if(!s)continue;let c=s[0],l=s[1],u=0;for(let t=0;t<r;t++)u+=e[t]*l[t];let d=u/(a*c);d>=i&&o.push([t,d])}return o}function lU(e,t,n,r,i){let a=OH(e.sharedInternalDocumentStore,n);e.avgFieldLength[t]=((e.avgFieldLength[t]??0)*(i-1)+r.length)/i,e.fieldLengths[t][a]=r.length,e.frequencies[t][a]={}}function uU(e,t,n,r,i){let a=0;for(let e of r)e===i&&a++;let o=OH(e.sharedInternalDocumentStore,n),s=a/r.length;e.frequencies[t][o][i]=s,i in e.tokenOccurrences[t]||(e.tokenOccurrences[t][i]=0),e.tokenOccurrences[t][i]=(e.tokenOccurrences[t][i]??0)+1}function dU(e,t,n,r){let i=OH(e.sharedInternalDocumentStore,n);r>1?e.avgFieldLength[t]=(e.avgFieldLength[t]*r-e.fieldLengths[t][i])/(r-1):e.avgFieldLength[t]=void 0,e.fieldLengths[t][i]=void 0,e.frequencies[t][i]=void 0}function fU(e,t,n){e.tokenOccurrences[t][n]--}function pU(e,t,n,r,i=``){r||={sharedInternalDocumentStore:t,indexes:{},vectorIndexes:{},searchableProperties:[],searchablePropertiesWithTypes:{},frequencies:{},tokenOccurrences:{},avgFieldLength:{},fieldLengths:{}};for(let[a,o]of Object.entries(n)){let n=`${i}${i?`.`:``}${a}`;if(typeof o==`object`&&!Array.isArray(o)){pU(e,t,o,r,n);continue}if(xH(o))r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o,r.vectorIndexes[n]={type:`Vector`,node:new oU(wH(o)),isArray:!1};else{let e=/\[/.test(o);switch(o){case`boolean`:case`boolean[]`:r.indexes[n]={type:`Bool`,node:new iU,isArray:e};break;case`number`:case`number[]`:r.indexes[n]={type:`AVL`,node:new XH(0,[]),isArray:e};break;case`string`:case`string[]`:r.indexes[n]={type:`Radix`,node:new tU,isArray:e},r.avgFieldLength[n]=0,r.frequencies[n]={},r.tokenOccurrences[n]={},r.fieldLengths[n]={};break;case`enum`:case`enum[]`:r.indexes[n]={type:`Flat`,node:new ZH,isArray:e};break;case`geopoint`:r.indexes[n]={type:`BKD`,node:new rU,isArray:e};break;default:throw mH(`INVALID_SCHEMA_TYPE`,Array.isArray(o)?`array`:o,n)}r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o}}return r}function mU(e,t,n,r,i,a,o,s){return c=>{let{type:l,node:u}=t.indexes[n];switch(l){case`Bool`:u[c?`true`:`false`].add(r);break;case`AVL`:{let e=s?.avlRebalanceThreshold??1;u.insert(c,r,e);break}case`Radix`:{let s=a.tokenize(c,i,n,!1);e.insertDocumentScoreParameters(t,n,r,s,o);for(let i of s)e.insertTokenScoreParameters(t,n,r,s,i),u.insert(i,r);break}case`Flat`:u.insert(c,r);break;case`BKD`:u.insert(c,[r]);break}}}function hU(e,t,n,r,i,a,o,s,c,l,u){if(xH(o))return gU(t,n,a,r,i);let d=mU(e,t,n,i,s,c,l,u);if(!SH(o))return d(a);let f=a,p=f.length;for(let e=0;e<p;e++)d(f[e])}function gU(e,t,n,r,i){e.vectorIndexes[t].node.add(i,n)}function _U(e,t,n,r,i,a,o,s,c,l){if(xH(o))return t.vectorIndexes[n].node.remove(i),!0;let{type:u,node:d}=t.indexes[n];switch(u){case`AVL`:return d.removeDocument(a,i),!0;case`Bool`:return d[a?`true`:`false`].delete(i),!0;case`Radix`:{let o=c.tokenize(a,s,n);e.removeDocumentScoreParameters(t,n,r,l);for(let r of o)e.removeTokenScoreParameters(t,n,r),d.removeDocumentByWord(r,i);return!0}case`Flat`:return d.removeDocument(i,a),!0;case`BKD`:return d.removeDocByID(a,i),!1}}function vU(e,t,n,r,i,a,o,s,c,l){if(!SH(o))return _U(e,t,n,r,i,a,o,s,c,l);let u=CH(o),d=a,f=d.length;for(let a=0;a<f;a++)_U(e,t,n,r,i,d[a],u,s,c,l);return!0}function yU(e,t,n,r,i,a,o,s,c,l){let u=Array.from(r),d=e.avgFieldLength[t],f=e.fieldLengths[t],p=e.tokenOccurrences[t],m=e.frequencies[t],h=typeof p[n]==`number`?p[n]??0:0,g=u.length;for(let e=0;e<g;e++){let r=u[e];if(c&&!c.has(r))continue;l.has(r)||l.set(r,new Map);let p=l.get(r);p.set(t,(p.get(t)||0)+1);let g=aU(m?.[r]?.[n]??0,h,i,f[r],d,a);o.has(r)?o.set(r,o.get(r)+g*s):o.set(r,g*s)}}function bU(e,t,n,r,i,a,o,s,c,l,u,d=0){let f=n.tokenize(t,r),p=f.length||1,m=new Map,h=new Map,g=new Map;for(let n of i){if(!(n in e.indexes))continue;let r=e.indexes[n],{type:i}=r;if(i!==`Radix`)throw mH(`WRONG_SEARCH_PROPERTY_TYPE`,n);let d=s[n]??1;if(d<=0)throw mH(`INVALID_BOOST_VALUE`,d);f.length===0&&!t&&f.push(``);let p=f.length;for(let t=0;t<p;t++){let i=f[t],s=r.node.find({term:i,exact:a,tolerance:o}),p=Object.keys(s);p.length>0&&h.set(i,!0);let _=p.length;for(let t=0;t<_;t++){let r=p[t],i=s[r];yU(e,n,r,i,l,c,g,d,u,m)}}}let _=Array.from(g.entries()).map(([e,t])=>[e,t]).sort((e,t)=>t[1]-e[1]);if(_.length===0)return[];if(d===1)return _;if(d===0){if(p===1)return _;for(let e of f)if(!h.get(e))return[];return _.filter(([e])=>{let t=m.get(e);return t?Array.from(t.values()).some(e=>e===p):!1})}let v=_.filter(([e])=>{let t=m.get(e);return t?Array.from(t.values()).some(e=>e===p):!1});if(v.length>0){let e=_.filter(([e])=>!v.some(([t])=>t===e)),t=Math.ceil(e.length*d);return[...v,...e.slice(0,t)]}return _}function xU(e,t,n,r){if(`and`in n&&n.and&&Array.isArray(n.and)){let i=n.and;return i.length===0?new Set:cH(...i.map(n=>xU(e,t,n,r)))}if(`or`in n&&n.or&&Array.isArray(n.or)){let i=n.or;return i.length===0?new Set:i.map(n=>xU(e,t,n,r)).reduce((e,t)=>uH(e,t),new Set)}if(`not`in n&&n.not){let i=n.not,a=new Set,o=e.sharedInternalDocumentStore;for(let e=1;e<=o.internalIdToId.length;e++)a.add(e);return dH(a,xU(e,t,i,r))}let i=Object.keys(n),a=i.reduce((e,t)=>({[t]:new Set,...e}),{});for(let o of i){let i=n[o];if(e.indexes[o]===void 0)throw mH(`UNKNOWN_FILTER_PROPERTY`,o);let{node:s,type:c,isArray:l}=e.indexes[o];if(c===`Bool`){let e=s,t=i?e.true:e.false;a[o]=uH(a[o],t);continue}if(c===`BKD`){let e;if(`radius`in i)e=`radius`;else if(`polygon`in i)e=`polygon`;else throw Error(`Invalid operation ${i}`);if(e===`radius`){let{value:t,coordinates:n,unit:r=`m`,inside:c=!0,highPrecision:l=!1}=i[e],u=iH(t,r),d=s.searchByRadius(n,u,c,void 0,l);a[o]=DU(a[o],d)}else{let{coordinates:t,inside:n=!0,highPrecision:r=!1}=i[e],c=s.searchByPolygon(t,n,void 0,r);a[o]=DU(a[o],c)}continue}if(c===`Radix`&&(typeof i==`string`||Array.isArray(i))){for(let e of[i].flat()){let n=t.tokenize(e,r,o);for(let e of n){let t=s.find({term:e,exact:!0});a[o]=jU(a[o],t)}}continue}let u=Object.keys(i);if(u.length>1)throw mH(`INVALID_FILTER_OPERATION`,u.length);if(c===`Flat`){let e=new Set(l?s.filterArr(i):s.filter(i));a[o]=uH(a[o],e);continue}if(c===`AVL`){let e=u[0],t=i[e],n;switch(e){case`gt`:n=s.greaterThan(t,!1);break;case`gte`:n=s.greaterThan(t,!0);break;case`lt`:n=s.lessThan(t,!1);break;case`lte`:n=s.lessThan(t,!0);break;case`eq`:n=s.find(t)??new Set;break;case`between`:{let[e,r]=t;n=s.rangeSearch(e,r);break}default:throw mH(`INVALID_FILTER_OPERATION`,e)}a[o]=uH(a[o],n)}}return cH(...Object.values(a))}function SU(e){return e.searchableProperties}function CU(e){return e.searchablePropertiesWithTypes}function wU(e,t){let{indexes:n,vectorIndexes:r,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}=t,u={},d={};for(let e of Object.keys(n)){let{node:t,type:r,isArray:i}=n[e];switch(r){case`Radix`:u[e]={type:`Radix`,node:tU.fromJSON(t),isArray:i};break;case`Flat`:u[e]={type:`Flat`,node:ZH.fromJSON(t),isArray:i};break;case`AVL`:u[e]={type:`AVL`,node:XH.fromJSON(t),isArray:i};break;case`BKD`:u[e]={type:`BKD`,node:rU.fromJSON(t),isArray:i};break;case`Bool`:u[e]={type:`Bool`,node:iU.fromJSON(t),isArray:i};break;default:u[e]=n[e]}}for(let e of Object.keys(r))d[e]={type:`Vector`,isArray:!1,node:oU.fromJSON(r[e])};return{sharedInternalDocumentStore:e,indexes:u,vectorIndexes:d,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}}function TU(e){let{indexes:t,vectorIndexes:n,searchableProperties:r,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:o,avgFieldLength:s,fieldLengths:c}=e,l={};for(let e of Object.keys(n))l[e]=n[e].node.toJSON();let u={};for(let e of Object.keys(t)){let{type:n,node:r,isArray:i}=t[e];n===`Flat`||n===`Radix`||n===`AVL`||n===`BKD`||n===`Bool`?u[e]={type:n,node:r.toJSON(),isArray:i}:(u[e]=t[e],u[e].node=u[e].node.toJSON())}return{indexes:u,vectorIndexes:l,searchableProperties:r,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:o,avgFieldLength:s,fieldLengths:c}}function EU(){return{create:pU,insert:hU,remove:vU,insertDocumentScoreParameters:lU,insertTokenScoreParameters:uU,removeDocumentScoreParameters:dU,removeTokenScoreParameters:fU,calculateResultScores:yU,search:bU,searchByWhereClause:xU,getSearchableProperties:SU,getSearchablePropertiesWithTypes:CU,load:wU,save:TU}}function DU(e,t){e||=new Set;let n=t.length;for(let r=0;r<n;r++){let n=t[r].docIDs,i=n.length;for(let t=0;t<i;t++)e.add(n[t])}return e}function OU(e,t,n=!1){let r=n?rU.vincentyDistance:rU.haversineDistance,i=[],a=[];for(let{point:n}of e)a.push(r(t,n));let o=Math.max(...a),s=0;for(let{docIDs:t}of e){let e=o-a[s]+1;for(let n of t)i.push([n,e]);s++}return i.sort((e,t)=>t[1]-e[1]),i}function kU(e,t){let n=Object.keys(e);if(n.length!==1)return{isGeoOnly:!1};let r=n[0],i=e[r];if(t.indexes[r]===void 0)return{isGeoOnly:!1};let{type:a}=t.indexes[r];return a===`BKD`&&i&&(`radius`in i||`polygon`in i)?{isGeoOnly:!0,geoProperty:r,geoOperation:i}:{isGeoOnly:!1}}function AU(e,t){let n=e,r=kU(t,n);if(!r.isGeoOnly||!r.geoProperty||!r.geoOperation)return null;let{node:i}=n.indexes[r.geoProperty],a=r.geoOperation,o=i,s;if(`radius`in a){let{value:e,coordinates:t,unit:n=`m`,inside:r=!0,highPrecision:i=!1}=a.radius,c=t,l=iH(e,n);return s=o.searchByRadius(c,l,r,`asc`,i),OU(s,c,i)}else if(`polygon`in a){let{coordinates:e,inside:t=!0,highPrecision:n=!1}=a.polygon;s=o.searchByPolygon(e,t,`asc`,n);let r=rU.calculatePolygonCentroid(e);return OU(s,r,n)}return null}function jU(e,t){e||=new Set;let n=Object.keys(t),r=n.length;for(let i=0;i<r;i++){let r=t[n[i]],a=r.length;for(let t=0;t<a;t++)e.add(r[t])}return e}function MU(e,t,n,r,i){let a={language:e.tokenizer.language,sharedInternalDocumentStore:t,enabled:!0,isSorted:!0,sortableProperties:[],sortablePropertiesWithTypes:{},sorts:{}};for(let[o,s]of Object.entries(n)){let n=`${i}${i?`.`:``}${o}`;if(!r.includes(n)){if(typeof s==`object`&&!Array.isArray(s)){let i=MU(e,t,s,r,n);WV(a.sortableProperties,i.sortableProperties),a.sorts={...a.sorts,...i.sorts},a.sortablePropertiesWithTypes={...a.sortablePropertiesWithTypes,...i.sortablePropertiesWithTypes};continue}if(!xH(s))switch(s){case`boolean`:case`number`:case`string`:a.sortableProperties.push(n),a.sortablePropertiesWithTypes[n]=s,a.sorts[n]={docs:new Map,orderedDocsToRemove:new Map,orderedDocs:[],type:s};break;case`geopoint`:case`enum`:continue;case`enum[]`:case`boolean[]`:case`number[]`:case`string[]`:continue;default:throw mH(`INVALID_SORT_SCHEMA_TYPE`,Array.isArray(s)?`array`:s,n)}}}return a}function NU(e,t,n,r){return r?.enabled===!1?{disabled:!0}:MU(e,t,n,(r||{}).unsortableProperties||[],``)}function PU(e,t,n,r){if(!e.enabled)return;e.isSorted=!1;let i=OH(e.sharedInternalDocumentStore,n),a=e.sorts[t];a.orderedDocsToRemove.has(i)&&VU(e,t),a.docs.set(i,a.orderedDocs.length),a.orderedDocs.push([i,r])}function FU(e){if(e.isSorted||!e.enabled)return;let t=Object.keys(e.sorts);for(let n of t)zU(e,n);e.isSorted=!0}function IU(e,t,n){return t[1].localeCompare(n[1],LV(e))}function LU(e,t){return e[1]-t[1]}function RU(e,t){return t[1]?-1:1}function zU(e,t){let n=e.sorts[t],r;switch(n.type){case`string`:r=IU.bind(null,e.language);break;case`number`:r=LU.bind(null);break;case`boolean`:r=RU.bind(null);break}n.orderedDocs.sort(r);let i=n.orderedDocs.length;for(let e=0;e<i;e++){let t=n.orderedDocs[e][0];n.docs.set(t,e)}}function BU(e){let t=Object.keys(e.sorts);for(let n of t)VU(e,n)}function VU(e,t){let n=e.sorts[t];n.orderedDocsToRemove.size&&(n.orderedDocs=n.orderedDocs.filter(e=>!n.orderedDocsToRemove.has(e[0])),n.orderedDocsToRemove.clear())}function HU(e,t,n){if(!e.enabled)return;let r=e.sorts[t],i=OH(e.sharedInternalDocumentStore,n);r.docs.get(i)&&(r.docs.delete(i),r.orderedDocsToRemove.set(i,!0))}function UU(e,t,n){if(!e.enabled)throw mH(`SORT_DISABLED`);let r=n.property,i=n.order===`DESC`,a=e.sorts[r];if(!a)throw mH(`UNABLE_TO_SORT_ON_UNKNOWN_FIELD`,r,e.sortableProperties.join(`, `));return VU(e,r),FU(e),t.sort((t,n)=>{let r=a.docs.get(OH(e.sharedInternalDocumentStore,t[0])),o=a.docs.get(OH(e.sharedInternalDocumentStore,n[0])),s=r!==void 0,c=o!==void 0;return!s&&!c?0:s?c?i?o-r:r-o:-1:1}),t}function WU(e){return e.enabled?e.sortableProperties:[]}function GU(e){return e.enabled?e.sortablePropertiesWithTypes:{}}function KU(e,t){let n=t;if(!n.enabled)return{enabled:!1};let r=Object.keys(n.sorts).reduce((e,t)=>{let{docs:r,orderedDocs:i,type:a}=n.sorts[t];return e[t]={docs:new Map(Object.entries(r).map(([e,t])=>[+e,t])),orderedDocsToRemove:new Map,orderedDocs:i,type:a},e},{});return{sharedInternalDocumentStore:e,language:n.language,sortableProperties:n.sortableProperties,sortablePropertiesWithTypes:n.sortablePropertiesWithTypes,sorts:r,enabled:!0,isSorted:n.isSorted}}function qU(e){if(!e.enabled)return{enabled:!1};BU(e),FU(e);let t=Object.keys(e.sorts).reduce((t,n)=>{let{docs:r,orderedDocs:i,type:a}=e.sorts[n];return t[n]={docs:Object.fromEntries(r.entries()),orderedDocs:i,type:a},t},{});return{language:e.language,sortableProperties:e.sortableProperties,sortablePropertiesWithTypes:e.sortablePropertiesWithTypes,sorts:t,enabled:e.enabled,isSorted:e.isSorted}}function JU(){return{create:NU,insert:PU,remove:HU,save:qU,load:KU,sortBy:UU,getSortableProperties:WU,getSortablePropertiesWithTypes:GU}}const YU=[65,65,65,65,65,65,65,67,69,69,69,69,73,73,73,73,69,78,79,79,79,79,79,null,79,85,85,85,85,89,80,115,97,97,97,97,97,97,97,99,101,101,101,101,105,105,105,105,101,110,111,111,111,111,111,null,111,117,117,117,117,121,112,121,65,97,65,97,65,97,67,99,67,99,67,99,67,99,68,100,68,100,69,101,69,101,69,101,69,101,69,101,71,103,71,103,71,103,71,103,72,104,72,104,73,105,73,105,73,105,73,105,73,105,73,105,74,106,75,107,107,76,108,76,108,76,108,76,108,76,108,78,110,78,110,78,110,110,78,110,79,111,79,111,79,111,79,111,82,114,82,114,82,114,83,115,83,115,83,115,83,115,84,116,84,116,84,116,85,117,85,117,85,117,85,117,85,117,85,117,87,119,89,121,89,90,122,90,122,90,122,115];function XU(e){return e<192||e>383?e:YU[e-192]||e}function ZU(e){let t=[];for(let n=0;n<e.length;n++)t[n]=XU(e.charCodeAt(n));return String.fromCharCode(...t)}const QU={ational:`ate`,tional:`tion`,enci:`ence`,anci:`ance`,izer:`ize`,bli:`ble`,alli:`al`,entli:`ent`,eli:`e`,ousli:`ous`,ization:`ize`,ation:`ate`,ator:`ate`,alism:`al`,iveness:`ive`,fulness:`ful`,ousness:`ous`,aliti:`al`,iviti:`ive`,biliti:`ble`,logi:`log`},$U={icate:`ic`,ative:``,alize:`al`,iciti:`ic`,ical:`ic`,ful:``,ness:``},eW=`[aeiouy]`,tW=`[^aeiou][^aeiouy]*`;eW+``;const nW=`^(`+tW+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*`;``+tW;const rW=`^(`+tW+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*`,iW=`^(`+tW+`)?[aeiouy]`;function aW(e){let t,n,r,i,a,o;if(e.length<3)return e;let s=e.substring(0,1);if(s==`y`&&(e=s.toUpperCase()+e.substring(1)),r=/^(.+?)(ss|i)es$/,i=/^(.+?)([^s])s$/,r.test(e)?e=e.replace(r,`$1$2`):i.test(e)&&(e=e.replace(i,`$1$2`)),r=/^(.+?)eed$/,i=/^(.+?)(ed|ing)$/,r.test(e)){let t=r.exec(e);r=new RegExp(nW),r.test(t[1])&&(r=/.$/,e=e.replace(r,``))}else i.test(e)&&(t=i.exec(e)[1],i=new RegExp(iW),i.test(t)&&(e=t,i=/(at|bl|iz)$/,a=RegExp(`([^aeiouylsz])\\1$`),o=RegExp(`^`+tW+eW+`[^aeiouwxy]$`),i.test(e)?e+=`e`:a.test(e)?(r=/.$/,e=e.replace(r,``)):o.test(e)&&(e+=`e`)));if(r=/^(.+?)y$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(iW),t&&r.test(t)&&(e=t+`i`)),r=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,r.test(e)){let i=r.exec(e);t=i?.[1],n=i?.[2],r=new RegExp(nW),t&&r.test(t)&&(e=t+QU[n])}if(r=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,r.test(e)){let i=r.exec(e);t=i?.[1],n=i?.[2],r=new RegExp(nW),t&&r.test(t)&&(e=t+$U[n])}if(r=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,i=/^(.+?)(s|t)(ion)$/,r.test(e))t=r.exec(e)?.[1],r=new RegExp(rW),t&&r.test(t)&&(e=t);else if(i.test(e)){let n=i.exec(e);t=n?.[1]??``+n?.[2]??``,i=new RegExp(rW),i.test(t)&&(e=t)}return r=/^(.+?)e$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(rW),i=RegExp(`^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$`),a=RegExp(`^`+tW+eW+`[^aeiouwxy]$`),t&&(r.test(t)||i.test(t)&&!a.test(t))&&(e=t)),r=/ll$/,i=new RegExp(rW),r.test(e)&&i.test(e)&&(r=/.$/,e=e.replace(r,``)),s==`y`&&(e=s.toLowerCase()+e.substring(1)),e}function oW(e,t,n=!0){let r=`${this.language}:${e}:${t}`;return n&&this.normalizationCache.has(r)?this.normalizationCache.get(r):this.stopWords?.includes(t)?(n&&this.normalizationCache.set(r,``),``):(this.stemmer&&!this.stemmerSkipProperties.has(e)&&(t=this.stemmer(t)),t=ZU(t),n&&this.normalizationCache.set(r,t),t)}function sW(e){for(;e[e.length-1]===``;)e.pop();for(;e[0]===``;)e.shift();return e}function cW(e,t,n,r=!0){if(t&&t!==this.language)throw mH(`LANGUAGE_NOT_SUPPORTED`,t);if(typeof e!=`string`)return[e];let i=this.normalizeToken.bind(this,n??``),a;if(n&&this.tokenizeSkipProperties.has(n))a=[i(e,r)];else{let t=FV[this.language];a=e.toLowerCase().split(t).map(e=>i(e,r)).filter(Boolean)}let o=sW(a);return this.allowDuplicates?o:Array.from(new Set(o))}function lW(e={}){if(!e.language)e.language=`english`;else if(!IV.includes(e.language))throw mH(`LANGUAGE_NOT_SUPPORTED`,e.language);let t;if(e.stemming||e.stemmer&&!(`stemming`in e))if(e.stemmer){if(typeof e.stemmer!=`function`)throw mH(`INVALID_STEMMER_FUNCTION_TYPE`);t=e.stemmer}else if(e.language===`english`)t=aW;else throw mH(`MISSING_STEMMER`,e.language);let n;if(e.stopWords!==!1){if(n=[],Array.isArray(e.stopWords))n=e.stopWords;else if(typeof e.stopWords==`function`)n=e.stopWords(n);else if(e.stopWords)throw mH(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);if(!Array.isArray(n))throw mH(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);for(let e of n)if(typeof e!=`string`)throw mH(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`)}let r={tokenize:cW,language:e.language,stemmer:t,stemmerSkipProperties:new Set(e.stemmerSkipProperties?[e.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(e.tokenizeSkipProperties?[e.tokenizeSkipProperties].flat():[]),stopWords:n,allowDuplicates:!!e.allowDuplicates,normalizeToken:oW,normalizationCache:new Map};return r.tokenize=cW.bind(r),r.normalizeToken=oW,r}function uW(e){return{sharedInternalDocumentStore:e,rules:new Map}}function dW(e,t){if(e.rules.has(t.id))throw Error(`PINNING_RULE_ALREADY_EXISTS: A pinning rule with id "${t.id}" already exists. Use updateRule to modify it.`);e.rules.set(t.id,t)}function fW(e,t){if(!e.rules.has(t.id))throw Error(`PINNING_RULE_NOT_FOUND: Cannot update pinning rule with id "${t.id}" because it does not exist. Use addRule to create it.`);e.rules.set(t.id,t)}function pW(e,t){return e.rules.delete(t)}function mW(e,t){return e.rules.get(t)}function hW(e){return Array.from(e.rules.values())}function gW(e,t){let n=e.toLowerCase().trim(),r=t.pattern.toLowerCase().trim();switch(t.anchoring){case`is`:return n===r;case`starts_with`:return n.startsWith(r);case`contains`:return n.includes(r);default:return!1}}function _W(e,t){return e?t.conditions.every(t=>gW(e,t)):!1}function vW(e,t){if(!t)return[];let n=[];for(let r of e.rules.values())_W(t,r)&&n.push(r);return n}function yW(e,t){return{sharedInternalDocumentStore:e,rules:new Map(t?.rules??[])}}function bW(e){return{rules:Array.from(e.rules.entries())}}function xW(){return{create:uW,addRule:dW,updateRule:fW,removeRule:pW,getRule:mW,getAllRules:hW,getMatchingRules:vW,load:yW,save:bW}}function SW(e){let t={formatElapsedTime:hH,getDocumentIndexId:gH,getDocumentProperties:tH,validateSchema:_H};for(let n of UH){let r=n;if(e[r]){if(typeof e[r]!=`function`)throw mH(`COMPONENT_MUST_BE_FUNCTION`,r)}else e[r]=t[r]}for(let t of Object.keys(e))if(!HH.includes(t)&&!UH.includes(t))throw mH(`UNSUPPORTED_COMPONENT`,t)}function CW({schema:e,sort:t,language:n,components:r,id:i,plugins:a}){r||={};for(let t of a??[]){if(!(`getComponents`in t)||typeof t.getComponents!=`function`)continue;let n=t.getComponents(e),i=Object.keys(n);for(let e of i)if(r[e])throw mH(`PLUGIN_COMPONENT_CONFLICT`,e,t.name);r={...r,...n}}i||=ZV();let o=r.tokenizer,s=r.index,c=r.documentsStore,l=r.sorter,u=r.pinning;if(o=o?o.tokenize?o:lW(o):lW({language:n??`english`}),r.tokenizer&&n)throw mH(`NO_LANGUAGE_WITH_CUSTOM_TOKENIZER`);let d=TH();s||=EU(),l||=JU(),c||=zH(),u||=xW(),SW(r);let{getDocumentProperties:f,getDocumentIndexId:p,validateSchema:m,formatElapsedTime:h}=r,g={data:{},caches:{},schema:e,tokenizer:o,index:s,sorter:l,documentsStore:c,pinning:u,internalDocumentIDStore:d,getDocumentProperties:f,getDocumentIndexId:p,validateSchema:m,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeUpsert:[],afterUpsert:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],beforeUpdateMultiple:[],afterUpdateMultiple:[],beforeUpsertMultiple:[],afterUpsertMultiple:[],afterCreate:[],formatElapsedTime:h,id:i,plugins:a,version:wW()};g.data={index:g.index.create(g,d,e),docs:g.documentsStore.create(g,d),sorting:g.sorter.create(g,d,e,t),pinning:g.pinning.create(d)};for(let e of BH)g[e]=(g[e]??[]).concat(VH(g,e));let _=g.afterCreate;return _&&JH(_,g),g}function wW(){return`{{VERSION}}`}function TW(e){return e.documentsStore.count(e.data.docs)}function EW(e,t,n,r,i){let a=e.validateSchema(t,e.schema);if(a)throw mH(`SCHEMA_VALIDATION_FAILURE`,a);return oH(e.beforeInsert)||oH(e.afterInsert)||oH(e.index.beforeInsert)||oH(e.index.insert)||oH(e.index.afterInsert)?kW(e,t,n,r,i):AW(e,t,n,r,i)}const DW=new Set([`enum`,`enum[]`]),OW=new Set([`string`,`number`]);async function kW(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw mH(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=OH(e.internalDocumentIDStore,s);if(r||await WH(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw mH(`DOCUMENT_ALREADY_EXISTS`,s);let l=e.documentsStore.count(o),u=e.index.getSearchableProperties(a),d=e.index.getSearchablePropertiesWithTypes(a),f=e.getDocumentProperties(t,u);for(let[e,t]of Object.entries(f)){if(t===void 0)continue;let n=typeof t,r=d[e];jW(n,r,e,t)}return await MW(e,s,u,f,l,n,t,i),r||await WH(e.afterInsert,e,s,t),s}function AW(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw mH(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=OH(e.internalDocumentIDStore,s);if(r||WH(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw mH(`DOCUMENT_ALREADY_EXISTS`,s);let l=e.documentsStore.count(o),u=e.index.getSearchableProperties(a),d=e.index.getSearchablePropertiesWithTypes(a),f=e.getDocumentProperties(t,u);for(let[e,t]of Object.entries(f)){if(t===void 0)continue;let n=typeof t,r=d[e];jW(n,r,e,t)}return NW(e,s,u,f,l,n,t,i),r||WH(e.afterInsert,e,s,t),s}function jW(e,t,n,r){if(!(bH(t)&&typeof r==`object`&&typeof r.lon==`number`&&typeof r.lat==`number`)&&!(xH(t)&&Array.isArray(r))&&!(SH(t)&&Array.isArray(r))&&!(DW.has(t)&&OW.has(e))&&e!==t)throw mH(`INVALID_DOCUMENT_PROPERTY`,n,t,e)}async function MW(e,t,n,r,i,a,o,s){for(let o of n){let n=r[o];if(n===void 0)continue;let c=e.index.getSearchablePropertiesWithTypes(e.data.index)[o];await e.index.beforeInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i);let l=e.internalDocumentIDStore.idToInternalId.get(t);await e.index.insert(e.index,e.data.index,o,t,l,n,c,a,e.tokenizer,i,s),await e.index.afterInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i)}let c=e.sorter.getSortableProperties(e.data.sorting),l=e.getDocumentProperties(o,c);for(let n of c){let r=l[n];if(r===void 0)continue;let i=e.sorter.getSortablePropertiesWithTypes(e.data.sorting)[n];e.sorter.insert(e.data.sorting,n,t,r,i,a)}}function NW(e,t,n,r,i,a,o,s){for(let o of n){let n=r[o];if(n===void 0)continue;let c=e.index.getSearchablePropertiesWithTypes(e.data.index)[o],l=OH(e.internalDocumentIDStore,t);e.index.beforeInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i),e.index.insert(e.index,e.data.index,o,t,l,n,c,a,e.tokenizer,i,s),e.index.afterInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i)}let c=e.sorter.getSortableProperties(e.data.sorting),l=e.getDocumentProperties(o,c);for(let n of c){let r=l[n];if(r===void 0)continue;let i=e.sorter.getSortablePropertiesWithTypes(e.data.sorting)[n];e.sorter.insert(e.data.sorting,n,t,r,i,a)}}function PW(e,t,n,r,i,a){return oH(e.afterInsertMultiple)||oH(e.beforeInsertMultiple)||oH(e.index.beforeInsert)||oH(e.index.insert)||oH(e.index.afterInsert)?FW(e,t,n,r,i,a):IW(e,t,n,r,i,a)}async function FW(e,t,n=1e3,r,i,a=0){let o=[],s=async a=>{let s=Math.min(a+n,t.length),c=t.slice(a,s);for(let t of c){let n=await EW(e,t,r,i,{avlRebalanceThreshold:c.length});o.push(n)}return s};return await(async()=>{let e=0;for(;e<t.length;){let t=Date.now();if(e=await s(e),a>0){let e=a-(Date.now()-t);e>0&&fH(e)}}})(),i||await GH(e.afterInsertMultiple,e,t),o}function IW(e,t,n=1e3,r,i,a=0){let o=[],s=0;function c(){let a=t.slice(s*n,(s+1)*n);if(a.length===0)return!1;for(let t of a){let n=EW(e,t,r,i,{avlRebalanceThreshold:a.length});o.push(n)}return s++,!0}function l(){let e=Date.now();for(;c();)if(a>0){let t=Date.now()-e;if(t>=a){let e=a-t%a;e>0&&fH(e)}}}return l(),i||GH(e.afterInsertMultiple,e,t),o}function LW(e,t){return e[1]-t[1]}function RW(e,t){return t[1]-e[1]}function zW(e=`desc`){return e.toLowerCase()===`asc`?LW:RW}function BW(e,t,n){let r={},i=t.map(([e])=>e),a=e.documentsStore.getMultiple(e.data.docs,i),o=Object.keys(n),s=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e of o){let t;if(s[e]===`number`){let{ranges:r}=n[e],i=r.length,a=Array.from({length:i});for(let e=0;e<i;e++){let t=r[e];a[e]=[`${t.from}-${t.to}`,0]}t=Object.fromEntries(a)}r[e]={count:0,values:t??{}}}let c=a.length;for(let e=0;e<c;e++){let t=a[e];for(let e of o){let i=e.includes(`.`)?nH(t,e):t[e],a=s[e],o=r[e].values;switch(a){case`number`:{let t=n[e].ranges;VW(t,o)(i);break}case`number[]`:{let t=new Set,r=n[e].ranges,a=VW(r,o,t);for(let e of i)a(e);break}case`boolean`:case`enum`:case`string`:HW(o,a)(i);break;case`boolean[]`:case`enum[]`:case`string[]`:{let e=HW(o,a===`boolean[]`?`boolean`:`string`,new Set);for(let t of i)e(t);break}default:throw mH(`FACET_NOT_SUPPORTED`,a)}}}for(let e of o){let t=r[e];if(t.count=Object.keys(t.values).length,s[e]===`string`){let r=n[e],i=zW(r.sort);t.values=Object.fromEntries(Object.entries(t.values).sort(i).slice(r.offset??0,r.limit??10))}}return r}function VW(e,t,n){return r=>{for(let i of e){let e=`${i.from}-${i.to}`;n?.has(e)||r>=i.from&&r<=i.to&&(t[e]===void 0?t[e]=1:(t[e]++,n?.add(e)))}}}function HW(e,t,n){let r=t===`boolean`?`false`:``;return t=>{let i=t?.toString()??r;n?.has(i)||(e[i]=(e[i]??0)+1,n?.add(i))}}const UW={reducer:(e,t,n,r)=>(t[r]=n,t),getInitialValue:e=>Array.from({length:e})},WW=[`string`,`number`,`boolean`];function GW(e,t,n){let r=n.properties,i=r.length,a=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e=0;e<i;e++){let t=r[e];if(a[t]===void 0)throw mH(`UNKNOWN_GROUP_BY_PROPERTY`,t);if(!WW.includes(a[t]))throw mH(`INVALID_GROUP_BY_PROPERTY`,t,WW.join(`, `),a[t])}let o=t.map(([t])=>kH(e.internalDocumentIDStore,t)),s=e.documentsStore.getMultiple(e.data.docs,o),c=s.length,l=n.maxResult||2**53-1,u=[],d={};for(let e=0;e<i;e++){let t=r[e],n={property:t,perValue:{}},i=new Set;for(let e=0;e<c;e++){let r=s[e],a=nH(r,t);if(a===void 0)continue;let o=typeof a==`boolean`?``+a:a,c=n.perValue[o]??{indexes:[],count:0};c.count>=l||(c.indexes.push(e),c.count++,n.perValue[o]=c,i.add(a))}u.push(Array.from(i)),d[t]=n}let f=KW(u),p=f.length,m=[];for(let e=0;e<p;e++){let t=f[e],n=t.length,i={values:[],indexes:[]},a=[];for(let e=0;e<n;e++){let n=t[e],o=r[e];a.push(d[o].perValue[typeof n==`boolean`?``+n:n].indexes),i.values.push(n)}i.indexes=eH(a).sort((e,t)=>e-t),i.indexes.length!==0&&m.push(i)}let h=m.length,g=Array.from({length:h});for(let e=0;e<h;e++){let r=m[e],i=n.reduce||UW,a=r.indexes.map(e=>({id:o[e],score:t[e][1],document:s[e]})),c=i.reducer.bind(null,r.values),l=i.getInitialValue(r.indexes.length),u=a.reduce(c,l);g[e]={values:r.values,result:u}}return g}function KW(e,t=0){if(t+1===e.length)return e[t].map(e=>[e]);let n=e[t],r=KW(e,t+1),i=[];for(let e of n)for(let t of r){let n=[e];WV(n,t),i.push(n)}return i}function qW(e,t,n,r){let i=vW(t,r);if(i.length===0)return n;let a=i.flatMap(e=>e.consequence.promote);a.sort((e,t)=>e.position-t.position);let o=new Set,s=new Map,c=new Set;for(let t of a){let n=OH(e.internalDocumentIDStore,t.doc_id);if(n!==void 0){if(s.has(n)){let e=s.get(n);t.position<e&&s.set(n,t.position);continue}c.has(t.position)||(o.add(n),s.set(n,t.position),c.add(t.position))}}if(s.size===0)return n;let l=n.filter(([e])=>!o.has(e)),u=[];for(let[t,r]of s.entries())n.find(([e])=>e===t)?u.push([t,1e6-r]):e.documentsStore.get(e.data.docs,t)&&u.push([t,0]);u.sort((e,t)=>(s.get(e[0])??1/0)-(s.get(t[0])??1/0));let d=[],f=new Map;for(let e of u){let t=s.get(e[0]);f.set(t,e)}let p=0,m=0;for(;m<l.length+u.length;)if(f.has(m))d.push(f.get(m)),m++;else if(p<l.length)d.push(l[p]),p++,m++;else break;for(let[e,t]of f.entries())e>=d.length&&d.push(t);return d}function JW(e,t,n){let{term:r,properties:i}=t,a=e.data.index,o=e.caches.propertiesToSearch;if(!o){let t=e.index.getSearchablePropertiesWithTypes(a);o=e.index.getSearchableProperties(a),o=o.filter(e=>t[e].startsWith(`string`)),e.caches.propertiesToSearch=o}if(i&&i!==`*`){for(let e of i)if(!o.includes(e))throw mH(`UNKNOWN_INDEX`,e,o.join(`, `));o=o.filter(e=>i.includes(e))}let s=Object.keys(t.where??{}).length>0,c;s&&(c=e.index.searchByWhereClause(a,e.tokenizer,t.where,n));let l,u=t.threshold!==void 0&&t.threshold!==null?t.threshold:1;if(r||i){let i=TW(e);if(l=e.index.search(a,r||``,e.tokenizer,n,o,t.exact||!1,t.tolerance||0,t.boost||{},$W(t.relevance),i,c,u),t.exact&&r){let t=r.trim().split(/\s+/);l=l.filter(([n])=>{let r=e.documentsStore.get(e.data.docs,n);if(!r)return!1;for(let e of o){let n=XW(r,e);if(typeof n==`string`&&t.every(e=>RegExp(`\\b${YW(e)}\\b`).test(n)))return!0}return!1})}}else l=s?AU(a,t.where)||(c?Array.from(c):[]).map(e=>[+e,0]):Object.keys(e.documentsStore.getAll(e.data.docs)).map(e=>[+e,0]);return l}function YW(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function XW(e,t){let n=t.split(`.`),r=e;for(let e of n)if(r&&typeof r==`object`&&e in r)r=r[e];else return;return r}function ZW(e,t,n){let r=XV();function i(){let i=Object.keys(e.data.index.vectorIndexes),a=t.facets&&Object.keys(t.facets).length>0,{limit:o=10,offset:s=0,distinctOn:c,includeVectors:l=!1}=t,u=t.preflight===!0,d=JW(e,t,n);if(t.sortBy)if(typeof t.sortBy==`function`){let n=d.map(([e])=>e),r=e.documentsStore.getMultiple(e.data.docs,n).map((e,t)=>[d[t][0],d[t][1],e]);r.sort(t.sortBy),d=r.map(([e,t])=>[e,t])}else d=e.sorter.sortBy(e.data.sorting,d,t.sortBy).map(([t,n])=>[OH(e.internalDocumentIDStore,t),n]);else d=d.sort($V);d=qW(e,e.data.pinning,d,t.term);let f;u||(f=c?dG(e,d,s,o,c):fG(e,d,s,o));let p={elapsed:{formatted:``,raw:0},hits:[],count:d.length};return f!==void 0&&(p.hits=f.filter(Boolean),l||aH(p,i)),a&&(p.facets=BW(e,d,t.facets)),t.groupBy&&(p.groups=GW(e,d,t.groupBy)),p.elapsed=e.formatElapsedTime(XV()-r),p}async function a(){e.beforeSearch&&await qH(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await KH(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}const QW={k:1.2,b:.75,d:.5};function $W(e){let t=e??{};return t.k=t.k??QW.k,t.b=t.b??QW.b,t.d=t.d??QW.d,t}function eG(e,t,n){let r=t.vector;if(r&&(!(`value`in r)||!(`property`in r)))throw mH(`INVALID_VECTOR_INPUT`,Object.keys(r).join(`, `));let i=e.data.index.vectorIndexes[r.property];if(!i)throw mH(`UNKNOWN_VECTOR_PROPERTY`,r.property);let a=i.node.size;if(r?.value.length!==a)throw r?.property===void 0||r?.value.length===void 0?mH(`INVALID_INPUT_VECTOR`,`undefined`,a,`undefined`):mH(`INVALID_INPUT_VECTOR`,r.property,a,r.value.length);let o=e.data.index,s;return Object.keys(t.where??{}).length>0&&(s=e.index.searchByWhereClause(o,e.tokenizer,t.where,n)),i.node.find(r.value,t.similarity??.8,s)}function tG(e,t,n=`english`){let r=XV();function i(){let i=eG(e,t,n).sort($V);i=qW(e,e.data.pinning,i,void 0);let a=[];t.facets&&Object.keys(t.facets).length>0&&(a=BW(e,i,t.facets));let o=t.vector.property,s=t.includeVectors??!1,c=t.limit??10,l=t.offset??0,u=Array.from({length:c});for(let t=0;t<c;t++){let n=i[t+l];if(!n)break;let r=e.data.docs.docs[n[0]];r&&(s||(r[o]=null),u[t]={id:kH(e.internalDocumentIDStore,n[0]),score:n[1],document:r})}let d=[];t.groupBy&&(d=GW(e,i,t.groupBy));let f=XV()-r;return{count:i.length,hits:u.filter(Boolean),elapsed:{raw:Number(f),formatted:YV(f)},...a?{facets:a}:{},...d?{groups:d}:{}}}async function a(){e.beforeSearch&&await qH(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await KH(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function nG(e,t,n){let r=aG(JW(e,t,n)),i=eG(e,t,n),a=t.hybridWeights;return cG(r,i,t.term??``,a)}function rG(e,t,n){let r=XV();function i(){let i=nG(e,t,n);i=qW(e,e.data.pinning,i,t.term);let a;t.facets&&Object.keys(t.facets).length>0&&(a=BW(e,i,t.facets));let o;t.groupBy&&(o=GW(e,i,t.groupBy));let s=t.offset??0,c=t.limit??10,l=fG(e,i,s,c).filter(Boolean),u=XV(),d={count:i.length,elapsed:{raw:Number(u-r),formatted:YV(u-r)},hits:l,...a?{facets:a}:{},...o?{groups:o}:{}};return(t.includeVectors??!1)||aH(d,Object.keys(e.data.index.vectorIndexes)),d}async function a(){e.beforeSearch&&await qH(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await KH(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function iG(e){return e[1]}function aG(e){let t=Math.max.apply(Math,e.map(iG));return e.map(([e,n])=>[e,n/t])}function oG(e,t){return e/t}function sG(e,t){return(n,r)=>n*e+r*t}function cG(e,t,n,r){let i=Math.max.apply(Math,e.map(iG)),a=Math.max.apply(Math,t.map(iG)),{text:o,vector:s}=r&&r.text&&r.vector?r:lG(n),c=new Map,l=e.length,u=sG(o,s);for(let t=0;t<l;t++){let[n,r]=e[t],a=u(oG(r,i),0);c.set(n,a)}let d=t.length;for(let e=0;e<d;e++){let[n,r]=t[e],i=oG(r,a),o=c.get(n)??0;c.set(n,o+u(0,i))}return[...c].sort((e,t)=>t[1]-e[1])}function lG(e){return{text:.5,vector:.5}}function uG(e,t,n){let r=t.mode??`fulltext`;if(r===`fulltext`)return ZW(e,t,n);if(r===`vector`)return tG(e,t);if(r===`hybrid`)return rG(e,t);throw mH(`INVALID_SEARCH_MODE`,r)}function dG(e,t,n,r,i){let a=e.data.docs,o=new Map,s=[],c=new Set,l=t.length,u=0;for(let d=0;d<l;d++){let l=t[d];if(l===void 0)continue;let[f,p]=l;if(c.has(f))continue;let m=e.documentsStore.get(a,f),h=nH(m,i);if(!(h===void 0||o.has(h))&&(o.set(h,!0),u++,!(u<=n)&&(s.push({id:kH(e.internalDocumentIDStore,f),score:p,document:m}),c.add(f),u>=n+r)))break}return s}function fG(e,t,n,r){let i=e.data.docs,a=Array.from({length:r}),o=new Set;for(let s=n;s<r+n;s++){let n=t[s];if(n===void 0)break;let[r,c]=n;if(!o.has(r)){let t=e.documentsStore.get(i,r);a[s]={id:kH(e.internalDocumentIDStore,r),score:c,document:t},o.add(r)}}return a}var pG=n(kV(),1);const mG=1,hG={protocol:`x-ok-client-protocol`,runtime:`x-ok-client-runtime`,kind:`x-ok-client-kind`};function gG({kind:e,runtimeVersion:t}){return{[hG.protocol]:`1`,[hG.runtime]:t,[hG.kind]:e}}const _G=`__system__`,vG=1,yG=`__config__/project`,bG=`__user__/config.yml`,xG=`__local__/project`,SG=`__config__/okignore`,CG=Object.freeze([yG,xG,bG,SG]),wG=`__skill__/`,TG=`__template__/`,EG=[`project`,`global`];function DG(e){return e.startsWith(`__skill__/`)||e.startsWith(`__template__/`)}const OG=`.ok/skills`;function kG(e){return`${OG}/${e}/SKILL`}const AG=[`references`,`scripts`];function jG(e,t){let n=/^(\.ok\/skills\/[^/]+)\/SKILL$/.exec(t);if(!n)return null;let r=n[1],i=e.trim().replace(/\.mdx?$/i,``).split(`/`).filter(e=>e!==``&&e!==`.`),[a]=i;return!a||!AG.includes(a)||i.includes(`..`)||i.length<2?null:`${r}/${i.join(`/`)}`}const MG=/^\.ok\/skills\/([^/]+)\/(SKILL|references\/.+)$/;function NG(e){let t=MG.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===`SKILL`?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}const PG=/^__skill__\/global\/([^/]+)(?:\/(references\/.+))?$/;function FG(e){let t=PG.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===void 0?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}function IG(e,t){return e===`project`?kG(t):`${wG}${e}/${t}`}function LG(e){if(e===``)return``;try{return e.split(`/`).map(e=>decodeURIComponent(e)).join(`/`)}catch{return e}}function RG(e){if(e.startsWith(`__skill__/`)){let t=e.slice(10),n=t.indexOf(`/`);if(n<0)return null;let r=t.slice(0,n);if(r!==`global`&&r!==`project`)return null;let i=t.slice(n+1);return i?{kind:`skill`,scope:r,name:LG(i)}:null}if(e.startsWith(`__template__/`)){let t=e.slice(13);if(!t)return null;let n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return r?{kind:`template`,folder:LG(n<0?``:t.slice(0,n)),name:LG(r)}:null}return null}const zG=/^(?:(.+)\/)?\.ok\/templates\/([^/]+?)(?:\.mdx?)?$/;function BG(e){let t=zG.exec(e);if(t){let e=(t[1]??``).replace(/^\/+|\/+$/g,``);return`${TG}${e?`${e}/`:``}${t[2]}`}return null}const VG=[`.mdx`,`.md`],HG=`epoch`,UG=512*1024,WG=[`claude`,`claude-desktop`,`cursor`,`codex`,`copilot`,`opencode`,`openclaw`,`pi`,`antigravity`,`lm-studio`,`hermes`],GG={claude:`Claude`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`,copilot:`GitHub Copilot`,opencode:`OpenCode`,openclaw:`OpenClaw`,pi:`Pi`,antigravity:`Antigravity`,"lm-studio":`LM Studio`,hermes:`Hermes`},KG={claude:`.claude/skills`,"claude-desktop":null,cursor:`.cursor/skills`,codex:`.codex/skills`,copilot:`.github/skills`,opencode:`.opencode/skills`,openclaw:null,pi:`.pi/skills`,antigravity:null,"lm-studio":null,hermes:null},qG=WG.filter(e=>KG[e]!==null),JG=qG.filter(e=>e!==`pi`&&e!==`copilot`).map(e=>({hostDir:(KG[e]??``).split(`/`)[0],editorId:e})),YG={claude:`.mcp.json`,"claude-desktop":null,cursor:`.cursor/mcp.json`,codex:`.codex/config.toml`,copilot:null,opencode:`opencode.json`,openclaw:null,pi:`.pi/extensions/open-knowledge.ts`,antigravity:null,"lm-studio":null,hermes:null},XG={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/},ZG=`Ov23liqlSd0V1MwR6rhI`,QG=new Set([`gitlab.com`,`bitbucket.org`,`codeberg.org`,`gitea.com`,`sr.ht`,`sourcehut.org`]),$G=[`incoming`,`outgoing`,`both`];function eK(e){return $G.includes(e)}const tK=`open-knowledge`,nK=[{id:`chart`,title:`Chart`,description:`A bar chart whose series colors track the OK chart palette.`,html:`<div style="font-family:system-ui,sans-serif;padding:20px;color:var(--foreground)">
|
|
304
|
+
`,ANSWER_SESSION_LAST_MESSAGE_IS_NOT_ASSISTANT:`The last message in the session is not an assistant message. Cannot regenerate non-assistant messages.`,PLUGIN_COMPONENT_CONFLICT:`The component "%s" is already defined. The plugin "%s" is trying to redefine it.`};function mH(e,...t){let n=Error(GV(pH[e]??`Unsupported Orama Error code: ${e}`,...t));return n.code=e,`captureStackTrace`in Error.prototype&&Error.captureStackTrace(n),n}function hH(e){return{raw:Number(e),formatted:YV(e)}}function gH(e){if(e.id){if(typeof e.id!=`string`)throw mH(`DOCUMENT_ID_MUST_BE_STRING`,typeof e.id);return e.id}return ZV()}function _H(e,t){for(let[n,r]of Object.entries(t)){let t=e[n];if(t!==void 0&&!(r===`geopoint`&&typeof t==`object`&&typeof t.lon==`number`&&typeof t.lat==`number`)&&!(r===`enum`&&(typeof t==`string`||typeof t==`number`))){if(r===`enum[]`&&Array.isArray(t)){let e=t.length;for(let r=0;r<e;r++)if(typeof t[r]!=`string`&&typeof t[r]!=`number`)return n+`.`+r;continue}if(xH(r)){let e=wH(r);if(!Array.isArray(t)||t.length!==e)throw mH(`INVALID_INPUT_VECTOR`,n,e,t.length);continue}if(SH(r)){if(!Array.isArray(t))return n;let e=CH(r),i=t.length;for(let r=0;r<i;r++)if(typeof t[r]!==e)return n+`.`+r;continue}if(typeof r==`object`){if(!t||typeof t!=`object`)return n;let e=_H(t,r);if(e)return n+`.`+e;continue}if(typeof t!==r)return n}}}const vH={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},yH={"string[]":`string`,"number[]":`number`,"boolean[]":`boolean`,"enum[]":`enum`};function bH(e){return e===`geopoint`}function xH(e){return typeof e==`string`&&/^vector\[\d+\]$/.test(e)}function SH(e){return typeof e==`string`&&vH[e]}function CH(e){return yH[e]}function wH(e){let t=Number(e.slice(7,-1));switch(!0){case isNaN(t):throw mH(`INVALID_VECTOR_VALUE`,e);case t<=0:throw mH(`INVALID_VECTOR_SIZE`,e);default:return t}}function TH(){return{idToInternalId:new Map,internalIdToId:[],save:EH,load:DH}}function EH(e){return{internalIdToId:e.internalIdToId}}function DH(e,t){let{internalIdToId:n}=t;e.internalDocumentIDStore.idToInternalId.clear(),e.internalDocumentIDStore.internalIdToId=[];let r=n.length;for(let t=0;t<r;t++){let r=n[t];e.internalDocumentIDStore.idToInternalId.set(r,t+1),e.internalDocumentIDStore.internalIdToId.push(r)}}function OH(e,t){if(typeof t==`string`){let n=e.idToInternalId.get(t);if(n)return n;let r=e.idToInternalId.size+1;return e.idToInternalId.set(t,r),e.internalIdToId.push(t),r}return t>e.internalIdToId.length?OH(e,t.toString()):t}function kH(e,t){if(e.internalIdToId.length<t)throw Error(`Invalid internalId ${t}`);return e.internalIdToId[t-1]}function AH(e,t){return{sharedInternalDocumentStore:t,docs:{},count:0}}function jH(e,t){let n=OH(e.sharedInternalDocumentStore,t);return e.docs[n]}function MH(e,t){let n=t.length,r=Array.from({length:n});for(let i=0;i<n;i++){let n=OH(e.sharedInternalDocumentStore,t[i]);r[i]=e.docs[n]}return r}function NH(e){return e.docs}function PH(e,t,n,r){return e.docs[n]===void 0?(e.docs[n]=r,e.count++,!0):!1}function FH(e,t){let n=OH(e.sharedInternalDocumentStore,t);return e.docs[n]===void 0?!1:(delete e.docs[n],e.count--,!0)}function IH(e){return e.count}function LH(e,t){let n=t;return{docs:n.docs,count:n.count,sharedInternalDocumentStore:e}}function RH(e){return{docs:e.docs,count:e.count}}function zH(){return{create:AH,get:jH,getMultiple:MH,getAll:NH,store:PH,remove:FH,count:IH,load:LH,save:RH}}const BH=[`beforeInsert`,`afterInsert`,`beforeRemove`,`afterRemove`,`beforeUpdate`,`afterUpdate`,`beforeUpsert`,`afterUpsert`,`beforeSearch`,`afterSearch`,`beforeInsertMultiple`,`afterInsertMultiple`,`beforeRemoveMultiple`,`afterRemoveMultiple`,`beforeUpdateMultiple`,`afterUpdateMultiple`,`beforeUpsertMultiple`,`afterUpsertMultiple`,`beforeLoad`,`afterLoad`,`afterCreate`];function VH(e,t){let n=[],r=e.plugins?.length;if(!r)return n;for(let i=0;i<r;i++)try{let r=e.plugins[i];typeof r[t]==`function`&&n.push(r[t])}catch(e){throw console.error(`Caught error in getAllPluginsByHook:`,e),mH(`PLUGIN_CRASHED`)}return n}const HH=[`tokenizer`,`index`,`documentsStore`,`sorter`,`pinning`],UH=[`validateSchema`,`getDocumentIndexId`,`getDocumentProperties`,`formatElapsedTime`];function WH(e,t,n,r){if(e.some(oH))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function GH(e,t,n){if(e.some(oH))return(async()=>{for(let r of e)await r(t,n)})();for(let r of e)r(t,n)}function KH(e,t,n,r,i){if(e.some(oH))return(async()=>{for(let a of e)await a(t,n,r,i)})();for(let a of e)a(t,n,r,i)}function qH(e,t,n,r){if(e.some(oH))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function JH(e,t){if(e.some(oH))return(async()=>{for(let n of e)await n(t)})();for(let n of e)n(t)}var YH=class e{k;v;l=null;r=null;h=1;constructor(e,t){this.k=e,this.v=new Set(t)}updateHeight(){this.h=Math.max(e.getHeight(this.l),e.getHeight(this.r))+1}static getHeight(e){return e?e.h:0}getBalanceFactor(){return e.getHeight(this.l)-e.getHeight(this.r)}rotateLeft(){let e=this.r;return this.r=e.l,e.l=this,this.updateHeight(),e.updateHeight(),e}rotateRight(){let e=this.l;return this.l=e.r,e.r=this,this.updateHeight(),e.updateHeight(),e}toJSON(){return{k:this.k,v:Array.from(this.v),l:this.l?this.l.toJSON():null,r:this.r?this.r.toJSON():null,h:this.h}}static fromJSON(t){let n=new e(t.k,t.v);return n.l=t.l?e.fromJSON(t.l):null,n.r=t.r?e.fromJSON(t.r):null,n.h=t.h,n}},XH=class e{root=null;insertCount=0;constructor(e,t){e!==void 0&&t!==void 0&&(this.root=new YH(e,t))}insert(e,t,n=1e3){this.root=this.insertNode(this.root,e,t,n)}insertMultiple(e,t,n=1e3){for(let r of t)this.insert(e,r,n)}rebalance(){this.root&&=this.rebalanceNode(this.root)}toJSON(){return{root:this.root?this.root.toJSON():null,insertCount:this.insertCount}}static fromJSON(t){let n=new e;return n.root=t.root?YH.fromJSON(t.root):null,n.insertCount=t.insertCount||0,n}insertNode(e,t,n,r){if(e===null)return new YH(t,[n]);let i=[],a=e,o=null;for(;a!==null;)if(i.push({parent:o,node:a}),t<a.k)if(a.l===null){a.l=new YH(t,[n]),i.push({parent:a,node:a.l});break}else o=a,a=a.l;else if(t>a.k)if(a.r===null){a.r=new YH(t,[n]),i.push({parent:a,node:a.r});break}else o=a,a=a.r;else return a.v.add(n),e;let s=!1;this.insertCount++%r===0&&(s=!0);for(let t=i.length-1;t>=0;t--){let{parent:n,node:r}=i[t];if(r.updateHeight(),s){let t=this.rebalanceNode(r);n?n.l===r?n.l=t:n.r===r&&(n.r=t):e=t}}return e}rebalanceNode(e){let t=e.getBalanceFactor();if(t>1){if(e.l&&e.l.getBalanceFactor()>=0)return e.rotateRight();if(e.l)return e.l=e.l.rotateLeft(),e.rotateRight()}if(t<-1){if(e.r&&e.r.getBalanceFactor()<=0)return e.rotateLeft();if(e.r)return e.r=e.r.rotateRight(),e.rotateLeft()}return e}find(e){let t=this.findNodeByKey(e);return t?t.v:null}contains(e){return this.find(e)!==null}getSize(){let e=0,t=[],n=this.root;for(;n||t.length>0;){for(;n;)t.push(n),n=n.l;n=t.pop(),e++,n=n.r}return e}isBalanced(){if(!this.root)return!0;let e=[this.root];for(;e.length>0;){let t=e.pop(),n=t.getBalanceFactor();if(Math.abs(n)>1)return!1;t.l&&e.push(t.l),t.r&&e.push(t.r)}return!0}remove(e){this.root=this.removeNode(this.root,e)}removeDocument(e,t){let n=this.findNodeByKey(e);n&&(n.v.size===1?this.root=this.removeNode(this.root,e):n.v=new Set([...n.v.values()].filter(e=>e!==t)))}findNodeByKey(e){let t=this.root;for(;t;)if(e<t.k)t=t.l;else if(e>t.k)t=t.r;else return t;return null}removeNode(e,t){if(e===null)return null;let n=[],r=e;for(;r!==null&&r.k!==t;)n.push(r),r=t<r.k?r.l:r.r;if(r===null)return e;if(r.l===null||r.r===null){let t=r.l?r.l:r.r;if(n.length===0)e=t;else{let e=n[n.length-1];e.l===r?e.l=t:e.r=t}}else{let e=r,t=r.r;for(;t.l!==null;)e=t,t=t.l;r.k=t.k,r.v=t.v,e.l===t?e.l=t.r:e.r=t.r,r=e}n.push(r);for(let t=n.length-1;t>=0;t--){let r=n[t];r.updateHeight();let i=this.rebalanceNode(r);if(t>0){let e=n[t-1];e.l===r?e.l=i:e.r===r&&(e.r=i)}else e=i}return e}rangeSearch(e,t){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.l;if(i=r.pop(),i.k>=e&&i.k<=t)for(let e of i.v)n.add(e);if(i.k>t)break;i=i.r}return n}greaterThan(e,t=!1){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.r;if(i=r.pop(),t&&i.k>=e||!t&&i.k>e)for(let e of i.v)n.add(e);else if(i.k<=e)break;i=i.l}return n}lessThan(e,t=!1){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.l;if(i=r.pop(),t&&i.k<=e||!t&&i.k<e)for(let e of i.v)n.add(e);else if(i.k>e)break;i=i.r}return n}},ZH=class e{numberToDocumentId;constructor(){this.numberToDocumentId=new Map}insert(e,t){this.numberToDocumentId.has(e)?this.numberToDocumentId.get(e).add(t):this.numberToDocumentId.set(e,new Set([t]))}find(e){let t=this.numberToDocumentId.get(e);return t?Array.from(t):null}remove(e){this.numberToDocumentId.delete(e)}removeDocument(e,t){let n=this.numberToDocumentId.get(t);n&&(n.delete(e),n.size===0&&this.numberToDocumentId.delete(t))}contains(e){return this.numberToDocumentId.has(e)}getSize(){let e=0;for(let t of this.numberToDocumentId.values())e+=t.size;return e}filter(e){let t=Object.keys(e);if(t.length!==1)throw Error(`Invalid operation`);let n=t[0];switch(n){case`eq`:{let t=e[n],r=this.numberToDocumentId.get(t);return r?Array.from(r):[]}case`in`:{let t=e[n],r=new Set;for(let e of t){let t=this.numberToDocumentId.get(e);if(t)for(let e of t)r.add(e)}return Array.from(r)}case`nin`:{let t=new Set(e[n]),r=new Set;for(let[e,n]of this.numberToDocumentId.entries())if(!t.has(e))for(let e of n)r.add(e);return Array.from(r)}default:throw Error(`Invalid operation`)}}filterArr(e){let t=Object.keys(e);if(t.length!==1)throw Error(`Invalid operation`);let n=t[0];switch(n){case`containsAll`:{let t=e[n].map(e=>this.numberToDocumentId.get(e)??new Set);if(t.length===0)return[];let r=t.reduce((e,t)=>new Set([...e].filter(e=>t.has(e))));return Array.from(r)}case`containsAny`:{let t=e[n].map(e=>this.numberToDocumentId.get(e)??new Set);if(t.length===0)return[];let r=t.reduce((e,t)=>new Set([...e,...t]));return Array.from(r)}default:throw Error(`Invalid operation`)}}static fromJSON(t){if(!t.numberToDocumentId)throw Error(`Invalid Flat Tree JSON`);let n=new e;for(let[e,r]of t.numberToDocumentId)n.numberToDocumentId.set(e,new Set(r));return n}toJSON(){return{numberToDocumentId:Array.from(this.numberToDocumentId.entries()).map(([e,t])=>[e,Array.from(t)])}}};function QH(e,t,n){if(n<0)return-1;if(e===t)return 0;let r=e.length,i=t.length;if(r===0)return i<=n?i:-1;if(i===0)return r<=n?r:-1;let a=Math.abs(r-i);if(e.startsWith(t))return a<=n?a:-1;if(t.startsWith(e))return 0;if(a>n)return-1;let o=[];for(let e=0;e<=r;e++){o[e]=[e];for(let t=1;t<=i;t++)o[e][t]=e===0?t:0}for(let a=1;a<=r;a++){let r=1/0;for(let n=1;n<=i;n++)e[a-1]===t[n-1]?o[a][n]=o[a-1][n-1]:o[a][n]=Math.min(o[a-1][n]+1,o[a][n-1]+1,o[a-1][n-1]+1),r=Math.min(r,o[a][n]);if(r>n)return-1}return o[r][i]<=n?o[r][i]:-1}function $H(e,t,n){let r=QH(e,t,n);return{distance:r,isBounded:r>=0}}var eU=class e{k;s;c=new Map;d=new Set;e;w=``;constructor(e,t,n){this.k=e,this.s=t,this.e=n}updateParent(e){this.w=e.w+this.s}addDocument(e){this.d.add(e)}removeDocument(e){return this.d.delete(e)}findAllWords(e,t,n,r){let i=[this];for(;i.length>0;){let a=i.pop();if(a.e){let{w:i,d:o}=a;if(n&&i!==t)continue;if(QV(e,i)!==null)if(r)if(Math.abs(t.length-i.length)<=r&&$H(t,i,r).isBounded)e[i]=[];else continue;else e[i]=[];if(QV(e,i)!=null&&o.size>0){let t=e[i];for(let e of o)t.includes(e)||t.push(e)}}a.c.size>0&&i.push(...a.c.values())}return e}insert(t,n){let r=this,i=0,a=t.length;for(;i<a;){let o=t[i],s=r.c.get(o);if(s){let o=s.s,c=o.length,l=0;for(;l<c&&i+l<a&&o[l]===t[i+l];)l++;if(l===c){if(r=s,i+=l,i===a){s.e||=!0,s.addDocument(n);return}continue}let u=o.slice(0,l),d=o.slice(l),f=t.slice(i+l),p=new e(u[0],u,!1);if(r.c.set(u[0],p),p.updateParent(r),s.s=d,s.k=d[0],p.c.set(d[0],s),s.updateParent(p),f){let t=new e(f[0],f,!0);t.addDocument(n),p.c.set(f[0],t),t.updateParent(p)}else p.e=!0,p.addDocument(n);return}else{let a=new e(o,t.slice(i),!0);a.addDocument(n),r.c.set(o,a),a.updateParent(r);return}}r.e||=!0,r.addDocument(n)}_findLevenshtein(e,t,n,r,i){let a=[{node:this,index:t,tolerance:n}];for(;a.length>0;){let{node:t,index:n,tolerance:o}=a.pop();if(t.w.startsWith(e)){t.findAllWords(i,e,!1,0);continue}if(o<0)continue;if(t.e){let{w:n,d:a}=t;if(n&&($H(e,n,r).isBounded&&(i[n]=[]),QV(i,n)!==void 0&&a.size>0)){let e=new Set(i[n]);for(let t of a)e.add(t);i[n]=Array.from(e)}}if(n>=e.length)continue;let s=e[n];if(t.c.has(s)){let e=t.c.get(s);a.push({node:e,index:n+1,tolerance:o})}a.push({node:t,index:n+1,tolerance:o-1});for(let[e,r]of t.c)a.push({node:r,index:n,tolerance:o-1}),e!==s&&a.push({node:r,index:n+1,tolerance:o-1})}}find(e){let{term:t,exact:n,tolerance:r}=e;if(r&&!n){let e={};return this._findLevenshtein(t,0,r,r,e),e}else{let e=this,i=0,a=t.length;for(;i<a;){let o=t[i],s=e.c.get(o);if(s){let o=s.s,c=o.length,l=0;for(;l<c&&i+l<a&&o[l]===t[i+l];)l++;if(l===c)e=s,i+=l;else if(i+l===a)if(l===a-i){if(n)return{};{let e={};return s.findAllWords(e,t,n,r),e}}else return{};else return{}}else return{}}let o={};return e.findAllWords(o,t,n,r),o}}contains(e){let t=this,n=0,r=e.length;for(;n<r;){let i=e[n],a=t.c.get(i);if(a){let i=a.s,o=i.length,s=0;for(;s<o&&n+s<r&&i[s]===e[n+s];)s++;if(s<o)return!1;n+=o,t=a}else return!1}return!0}removeWord(e){if(!e)return!1;let t=this,n=e.length,r=[];for(let i=0;i<n;i++){let n=e[i];if(t.c.has(n)){let e=t.c.get(n);r.push({parent:t,character:n}),i+=e.s.length-1,t=e}else return!1}for(t.d.clear(),t.e=!1;r.length>0&&t.c.size===0&&!t.e&&t.d.size===0;){let{parent:e,character:n}=r.pop();e.c.delete(n),t=e}return!0}removeDocumentByWord(e,t,n=!0){if(!e)return!0;let r=this,i=e.length;for(let a=0;a<i;a++){let i=e[a];if(r.c.has(i)){let o=r.c.get(i);a+=o.s.length-1,r=o,n&&r.w!==e||r.removeDocument(t)}else return!1}return!0}static getCommonPrefix(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e.charCodeAt(r)===t.charCodeAt(r);)r++;return e.slice(0,r)}toJSON(){return{w:this.w,s:this.s,e:this.e,k:this.k,d:Array.from(this.d),c:Array.from(this.c?.entries())?.map(([e,t])=>[e,t.toJSON()])}}static fromJSON(t){let n=new e(t.k,t.s,t.e);return n.w=t.w,n.d=new Set(t.d),n.c=new Map(t?.c?.map(([t,n])=>[t,e.fromJSON(n)])||[]),n}},tU=class e extends eU{constructor(){super(``,``,!1)}static fromJSON(t){let n=new e;return n.w=t.w,n.s=t.s,n.e=t.e,n.k=t.k,n.d=new Set(t.d),n.c=new Map(t?.c?.map(([e,t])=>[e,eU.fromJSON(t)])||[]),n}toJSON(){return super.toJSON()}},nU=class e{point;docIDs;left;right;parent;constructor(e,t){this.point=e,this.docIDs=new Set(t),this.left=null,this.right=null,this.parent=null}toJSON(){return{point:this.point,docIDs:Array.from(this.docIDs),left:this.left?this.left.toJSON():null,right:this.right?this.right.toJSON():null}}static fromJSON(t,n=null){let r=new e(t.point,t.docIDs);return r.parent=n,t.left&&(r.left=e.fromJSON(t.left,r)),t.right&&(r.right=e.fromJSON(t.right,r)),r}},rU=class e{root;nodeMap;constructor(){this.root=null,this.nodeMap=new Map}getPointKey(e){return`${e.lon},${e.lat}`}insert(e,t){let n=this.getPointKey(e),r=this.nodeMap.get(n);if(r){t.forEach(e=>r.docIDs.add(e));return}let i=new nU(e,t);if(this.nodeMap.set(n,i),this.root==null){this.root=i;return}let a=this.root,o=0;for(;;){if(o%2==0)if(e.lon<a.point.lon){if(a.left==null){a.left=i,i.parent=a;return}a=a.left}else{if(a.right==null){a.right=i,i.parent=a;return}a=a.right}else if(e.lat<a.point.lat){if(a.left==null){a.left=i,i.parent=a;return}a=a.left}else{if(a.right==null){a.right=i,i.parent=a;return}a=a.right}o++}}contains(e){let t=this.getPointKey(e);return this.nodeMap.has(t)}getDocIDsByCoordinates(e){let t=this.getPointKey(e),n=this.nodeMap.get(t);return n?Array.from(n.docIDs):null}removeDocByID(e,t){let n=this.getPointKey(e),r=this.nodeMap.get(n);r&&(r.docIDs.delete(t),r.docIDs.size===0&&(this.nodeMap.delete(n),this.deleteNode(r)))}deleteNode(e){let t=e.parent,n=e.left?e.left:e.right;n&&(n.parent=t),t?t.left===e?t.left=n:t.right===e&&(t.right=n):(this.root=n,this.root&&(this.root.parent=null))}searchByRadius(t,n,r=!0,i=`asc`,a=!1){let o=a?e.vincentyDistance:e.haversineDistance,s=[{node:this.root,depth:0}],c=[];for(;s.length>0;){let{node:e,depth:i}=s.pop();if(e==null)continue;let a=o(t,e.point);(r?a<=n:a>n)&&c.push({point:e.point,docIDs:Array.from(e.docIDs)}),e.left!=null&&s.push({node:e.left,depth:i+1}),e.right!=null&&s.push({node:e.right,depth:i+1})}return i&&c.sort((e,n)=>{let r=o(t,e.point),a=o(t,n.point);return i.toLowerCase()===`asc`?r-a:a-r}),c}searchByPolygon(t,n=!0,r=null,i=!1){let a=[{node:this.root,depth:0}],o=[];for(;a.length>0;){let{node:r,depth:i}=a.pop();if(r==null)continue;r.left!=null&&a.push({node:r.left,depth:i+1}),r.right!=null&&a.push({node:r.right,depth:i+1});let s=e.isPointInPolygon(t,r.point);(s&&n||!s&&!n)&&o.push({point:r.point,docIDs:Array.from(r.docIDs)})}let s=e.calculatePolygonCentroid(t);if(r){let t=i?e.vincentyDistance:e.haversineDistance;o.sort((e,n)=>{let i=t(s,e.point),a=t(s,n.point);return r.toLowerCase()===`asc`?i-a:a-i})}return o}toJSON(){return{root:this.root?this.root.toJSON():null}}static fromJSON(t){let n=new e;return t.root&&(n.root=nU.fromJSON(t.root),n.buildNodeMap(n.root)),n}buildNodeMap(e){if(e==null)return;let t=this.getPointKey(e.point);this.nodeMap.set(t,e),e.left&&this.buildNodeMap(e.left),e.right&&this.buildNodeMap(e.right)}static calculatePolygonCentroid(e){let t=0,n=0,r=0,i=e.length;for(let a=0,o=i-1;a<i;o=a++){let i=e[a].lon,s=e[a].lat,c=e[o].lon,l=e[o].lat,u=i*l-c*s;t+=u,n+=(i+c)*u,r+=(s+l)*u}t/=2;let a=6*t;return n/=a,r/=a,{lon:n,lat:r}}static isPointInPolygon(e,t){let n=!1,r=t.lon,i=t.lat,a=e.length;for(let t=0,o=a-1;t<a;o=t++){let a=e[t].lon,s=e[t].lat,c=e[o].lon,l=e[o].lat;s>i!=l>i&&r<(c-a)*(i-s)/(l-s)+a&&(n=!n)}return n}static haversineDistance(e,t){let n=Math.PI/180,r=e.lat*n,i=t.lat*n,a=(t.lat-e.lat)*n,o=(t.lon-e.lon)*n,s=Math.sin(a/2)*Math.sin(a/2)+Math.cos(r)*Math.cos(i)*Math.sin(o/2)*Math.sin(o/2);return 6371e3*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}static vincentyDistance(e,t){let n=6378137,r=1/298.257223563,i=(1-r)*n,a=Math.PI/180,o=e.lat*a,s=t.lat*a,c=(t.lon-e.lon)*a,l=Math.atan((1-r)*Math.tan(o)),u=Math.atan((1-r)*Math.tan(s)),d=Math.sin(l),f=Math.cos(l),p=Math.sin(u),m=Math.cos(u),h=c,g,_=1e3,v,y,b,x,S,C;do{let e=Math.sin(h),t=Math.cos(h);if(v=Math.sqrt(m*e*(m*e)+(f*p-d*m*t)*(f*p-d*m*t)),v===0)return 0;y=d*p+f*m*t,b=Math.atan2(v,y),x=f*m*e/v,S=1-x*x,C=y-2*d*p/S,isNaN(C)&&(C=0);let n=r/16*S*(4+r*(4-3*S));g=h,h=c+(1-n)*r*x*(b+n*v*(C+n*y*(-1+2*C*C)))}while(Math.abs(h-g)>1e-12&&--_>0);if(_===0)return NaN;let w=S*(n*n-i*i)/(i*i),T=1+w/16384*(4096+w*(-768+w*(320-175*w))),E=w/1024*(256+w*(-128+w*(74-47*w))),ee=E*v*(C+E/4*(y*(-1+2*C*C)-E/6*C*(-3+4*v*v)*(-3+4*C*C)));return i*T*(b-ee)}},iU=class e{true;false;constructor(){this.true=new Set,this.false=new Set}insert(e,t){t?this.true.add(e):this.false.add(e)}delete(e,t){t?this.true.delete(e):this.false.delete(e)}getSize(){return this.true.size+this.false.size}toJSON(){return{true:Array.from(this.true),false:Array.from(this.false)}}static fromJSON(t){let n=new e;return n.true=new Set(t.true),n.false=new Set(t.false),n}};function aU(e,t,n,r,i,{k:a,b:o,d:s}){return Math.log(1+(n-t+.5)/(t+.5))*(s+e*(a+1))/(e+a*(1-o+o*r/i))}var oU=class e{size;vectors=new Map;constructor(e){this.size=e}add(e,t){t instanceof Float32Array||(t=new Float32Array(t));let n=sU(t,this.size);this.vectors.set(e,[n,t])}remove(e){this.vectors.delete(e)}find(e,t,n){return e instanceof Float32Array||(e=new Float32Array(e)),cU(e,n,this.vectors,this.size,t)}toJSON(){let e=[];for(let[t,[n,r]]of this.vectors)e.push([t,[n,Array.from(r)]]);return{size:this.size,vectors:e}}static fromJSON(t){let n=t,r=new e(n.size);for(let[e,[t,i]]of n.vectors)r.vectors.set(e,[t,new Float32Array(i)]);return r}};function sU(e,t){let n=0;for(let r=0;r<t;r++)n+=e[r]*e[r];return Math.sqrt(n)}function cU(e,t,n,r,i){let a=sU(e,r),o=[],s=t||n.keys();for(let t of s){let s=n.get(t);if(!s)continue;let c=s[0],l=s[1],u=0;for(let t=0;t<r;t++)u+=e[t]*l[t];let d=u/(a*c);d>=i&&o.push([t,d])}return o}function lU(e,t,n,r,i){let a=OH(e.sharedInternalDocumentStore,n);e.avgFieldLength[t]=((e.avgFieldLength[t]??0)*(i-1)+r.length)/i,e.fieldLengths[t][a]=r.length,e.frequencies[t][a]={}}function uU(e,t,n,r,i){let a=0;for(let e of r)e===i&&a++;let o=OH(e.sharedInternalDocumentStore,n),s=a/r.length;e.frequencies[t][o][i]=s,i in e.tokenOccurrences[t]||(e.tokenOccurrences[t][i]=0),e.tokenOccurrences[t][i]=(e.tokenOccurrences[t][i]??0)+1}function dU(e,t,n,r){let i=OH(e.sharedInternalDocumentStore,n);r>1?e.avgFieldLength[t]=(e.avgFieldLength[t]*r-e.fieldLengths[t][i])/(r-1):e.avgFieldLength[t]=void 0,e.fieldLengths[t][i]=void 0,e.frequencies[t][i]=void 0}function fU(e,t,n){e.tokenOccurrences[t][n]--}function pU(e,t,n,r,i=``){r||={sharedInternalDocumentStore:t,indexes:{},vectorIndexes:{},searchableProperties:[],searchablePropertiesWithTypes:{},frequencies:{},tokenOccurrences:{},avgFieldLength:{},fieldLengths:{}};for(let[a,o]of Object.entries(n)){let n=`${i}${i?`.`:``}${a}`;if(typeof o==`object`&&!Array.isArray(o)){pU(e,t,o,r,n);continue}if(xH(o))r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o,r.vectorIndexes[n]={type:`Vector`,node:new oU(wH(o)),isArray:!1};else{let e=/\[/.test(o);switch(o){case`boolean`:case`boolean[]`:r.indexes[n]={type:`Bool`,node:new iU,isArray:e};break;case`number`:case`number[]`:r.indexes[n]={type:`AVL`,node:new XH(0,[]),isArray:e};break;case`string`:case`string[]`:r.indexes[n]={type:`Radix`,node:new tU,isArray:e},r.avgFieldLength[n]=0,r.frequencies[n]={},r.tokenOccurrences[n]={},r.fieldLengths[n]={};break;case`enum`:case`enum[]`:r.indexes[n]={type:`Flat`,node:new ZH,isArray:e};break;case`geopoint`:r.indexes[n]={type:`BKD`,node:new rU,isArray:e};break;default:throw mH(`INVALID_SCHEMA_TYPE`,Array.isArray(o)?`array`:o,n)}r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o}}return r}function mU(e,t,n,r,i,a,o,s){return c=>{let{type:l,node:u}=t.indexes[n];switch(l){case`Bool`:u[c?`true`:`false`].add(r);break;case`AVL`:{let e=s?.avlRebalanceThreshold??1;u.insert(c,r,e);break}case`Radix`:{let s=a.tokenize(c,i,n,!1);e.insertDocumentScoreParameters(t,n,r,s,o);for(let i of s)e.insertTokenScoreParameters(t,n,r,s,i),u.insert(i,r);break}case`Flat`:u.insert(c,r);break;case`BKD`:u.insert(c,[r]);break}}}function hU(e,t,n,r,i,a,o,s,c,l,u){if(xH(o))return gU(t,n,a,r,i);let d=mU(e,t,n,i,s,c,l,u);if(!SH(o))return d(a);let f=a,p=f.length;for(let e=0;e<p;e++)d(f[e])}function gU(e,t,n,r,i){e.vectorIndexes[t].node.add(i,n)}function _U(e,t,n,r,i,a,o,s,c,l){if(xH(o))return t.vectorIndexes[n].node.remove(i),!0;let{type:u,node:d}=t.indexes[n];switch(u){case`AVL`:return d.removeDocument(a,i),!0;case`Bool`:return d[a?`true`:`false`].delete(i),!0;case`Radix`:{let o=c.tokenize(a,s,n);e.removeDocumentScoreParameters(t,n,r,l);for(let r of o)e.removeTokenScoreParameters(t,n,r),d.removeDocumentByWord(r,i);return!0}case`Flat`:return d.removeDocument(i,a),!0;case`BKD`:return d.removeDocByID(a,i),!1}}function vU(e,t,n,r,i,a,o,s,c,l){if(!SH(o))return _U(e,t,n,r,i,a,o,s,c,l);let u=CH(o),d=a,f=d.length;for(let a=0;a<f;a++)_U(e,t,n,r,i,d[a],u,s,c,l);return!0}function yU(e,t,n,r,i,a,o,s,c,l){let u=Array.from(r),d=e.avgFieldLength[t],f=e.fieldLengths[t],p=e.tokenOccurrences[t],m=e.frequencies[t],h=typeof p[n]==`number`?p[n]??0:0,g=u.length;for(let e=0;e<g;e++){let r=u[e];if(c&&!c.has(r))continue;l.has(r)||l.set(r,new Map);let p=l.get(r);p.set(t,(p.get(t)||0)+1);let g=aU(m?.[r]?.[n]??0,h,i,f[r],d,a);o.has(r)?o.set(r,o.get(r)+g*s):o.set(r,g*s)}}function bU(e,t,n,r,i,a,o,s,c,l,u,d=0){let f=n.tokenize(t,r),p=f.length||1,m=new Map,h=new Map,g=new Map;for(let n of i){if(!(n in e.indexes))continue;let r=e.indexes[n],{type:i}=r;if(i!==`Radix`)throw mH(`WRONG_SEARCH_PROPERTY_TYPE`,n);let d=s[n]??1;if(d<=0)throw mH(`INVALID_BOOST_VALUE`,d);f.length===0&&!t&&f.push(``);let p=f.length;for(let t=0;t<p;t++){let i=f[t],s=r.node.find({term:i,exact:a,tolerance:o}),p=Object.keys(s);p.length>0&&h.set(i,!0);let _=p.length;for(let t=0;t<_;t++){let r=p[t],i=s[r];yU(e,n,r,i,l,c,g,d,u,m)}}}let _=Array.from(g.entries()).map(([e,t])=>[e,t]).sort((e,t)=>t[1]-e[1]);if(_.length===0)return[];if(d===1)return _;if(d===0){if(p===1)return _;for(let e of f)if(!h.get(e))return[];return _.filter(([e])=>{let t=m.get(e);return t?Array.from(t.values()).some(e=>e===p):!1})}let v=_.filter(([e])=>{let t=m.get(e);return t?Array.from(t.values()).some(e=>e===p):!1});if(v.length>0){let e=_.filter(([e])=>!v.some(([t])=>t===e)),t=Math.ceil(e.length*d);return[...v,...e.slice(0,t)]}return _}function xU(e,t,n,r){if(`and`in n&&n.and&&Array.isArray(n.and)){let i=n.and;return i.length===0?new Set:cH(...i.map(n=>xU(e,t,n,r)))}if(`or`in n&&n.or&&Array.isArray(n.or)){let i=n.or;return i.length===0?new Set:i.map(n=>xU(e,t,n,r)).reduce((e,t)=>uH(e,t),new Set)}if(`not`in n&&n.not){let i=n.not,a=new Set,o=e.sharedInternalDocumentStore;for(let e=1;e<=o.internalIdToId.length;e++)a.add(e);return dH(a,xU(e,t,i,r))}let i=Object.keys(n),a=i.reduce((e,t)=>({[t]:new Set,...e}),{});for(let o of i){let i=n[o];if(e.indexes[o]===void 0)throw mH(`UNKNOWN_FILTER_PROPERTY`,o);let{node:s,type:c,isArray:l}=e.indexes[o];if(c===`Bool`){let e=s,t=i?e.true:e.false;a[o]=uH(a[o],t);continue}if(c===`BKD`){let e;if(`radius`in i)e=`radius`;else if(`polygon`in i)e=`polygon`;else throw Error(`Invalid operation ${i}`);if(e===`radius`){let{value:t,coordinates:n,unit:r=`m`,inside:c=!0,highPrecision:l=!1}=i[e],u=iH(t,r),d=s.searchByRadius(n,u,c,void 0,l);a[o]=DU(a[o],d)}else{let{coordinates:t,inside:n=!0,highPrecision:r=!1}=i[e],c=s.searchByPolygon(t,n,void 0,r);a[o]=DU(a[o],c)}continue}if(c===`Radix`&&(typeof i==`string`||Array.isArray(i))){for(let e of[i].flat()){let n=t.tokenize(e,r,o);for(let e of n){let t=s.find({term:e,exact:!0});a[o]=jU(a[o],t)}}continue}let u=Object.keys(i);if(u.length>1)throw mH(`INVALID_FILTER_OPERATION`,u.length);if(c===`Flat`){let e=new Set(l?s.filterArr(i):s.filter(i));a[o]=uH(a[o],e);continue}if(c===`AVL`){let e=u[0],t=i[e],n;switch(e){case`gt`:n=s.greaterThan(t,!1);break;case`gte`:n=s.greaterThan(t,!0);break;case`lt`:n=s.lessThan(t,!1);break;case`lte`:n=s.lessThan(t,!0);break;case`eq`:n=s.find(t)??new Set;break;case`between`:{let[e,r]=t;n=s.rangeSearch(e,r);break}default:throw mH(`INVALID_FILTER_OPERATION`,e)}a[o]=uH(a[o],n)}}return cH(...Object.values(a))}function SU(e){return e.searchableProperties}function CU(e){return e.searchablePropertiesWithTypes}function wU(e,t){let{indexes:n,vectorIndexes:r,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}=t,u={},d={};for(let e of Object.keys(n)){let{node:t,type:r,isArray:i}=n[e];switch(r){case`Radix`:u[e]={type:`Radix`,node:tU.fromJSON(t),isArray:i};break;case`Flat`:u[e]={type:`Flat`,node:ZH.fromJSON(t),isArray:i};break;case`AVL`:u[e]={type:`AVL`,node:XH.fromJSON(t),isArray:i};break;case`BKD`:u[e]={type:`BKD`,node:rU.fromJSON(t),isArray:i};break;case`Bool`:u[e]={type:`Bool`,node:iU.fromJSON(t),isArray:i};break;default:u[e]=n[e]}}for(let e of Object.keys(r))d[e]={type:`Vector`,isArray:!1,node:oU.fromJSON(r[e])};return{sharedInternalDocumentStore:e,indexes:u,vectorIndexes:d,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}}function TU(e){let{indexes:t,vectorIndexes:n,searchableProperties:r,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:o,avgFieldLength:s,fieldLengths:c}=e,l={};for(let e of Object.keys(n))l[e]=n[e].node.toJSON();let u={};for(let e of Object.keys(t)){let{type:n,node:r,isArray:i}=t[e];n===`Flat`||n===`Radix`||n===`AVL`||n===`BKD`||n===`Bool`?u[e]={type:n,node:r.toJSON(),isArray:i}:(u[e]=t[e],u[e].node=u[e].node.toJSON())}return{indexes:u,vectorIndexes:l,searchableProperties:r,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:o,avgFieldLength:s,fieldLengths:c}}function EU(){return{create:pU,insert:hU,remove:vU,insertDocumentScoreParameters:lU,insertTokenScoreParameters:uU,removeDocumentScoreParameters:dU,removeTokenScoreParameters:fU,calculateResultScores:yU,search:bU,searchByWhereClause:xU,getSearchableProperties:SU,getSearchablePropertiesWithTypes:CU,load:wU,save:TU}}function DU(e,t){e||=new Set;let n=t.length;for(let r=0;r<n;r++){let n=t[r].docIDs,i=n.length;for(let t=0;t<i;t++)e.add(n[t])}return e}function OU(e,t,n=!1){let r=n?rU.vincentyDistance:rU.haversineDistance,i=[],a=[];for(let{point:n}of e)a.push(r(t,n));let o=Math.max(...a),s=0;for(let{docIDs:t}of e){let e=o-a[s]+1;for(let n of t)i.push([n,e]);s++}return i.sort((e,t)=>t[1]-e[1]),i}function kU(e,t){let n=Object.keys(e);if(n.length!==1)return{isGeoOnly:!1};let r=n[0],i=e[r];if(t.indexes[r]===void 0)return{isGeoOnly:!1};let{type:a}=t.indexes[r];return a===`BKD`&&i&&(`radius`in i||`polygon`in i)?{isGeoOnly:!0,geoProperty:r,geoOperation:i}:{isGeoOnly:!1}}function AU(e,t){let n=e,r=kU(t,n);if(!r.isGeoOnly||!r.geoProperty||!r.geoOperation)return null;let{node:i}=n.indexes[r.geoProperty],a=r.geoOperation,o=i,s;if(`radius`in a){let{value:e,coordinates:t,unit:n=`m`,inside:r=!0,highPrecision:i=!1}=a.radius,c=t,l=iH(e,n);return s=o.searchByRadius(c,l,r,`asc`,i),OU(s,c,i)}else if(`polygon`in a){let{coordinates:e,inside:t=!0,highPrecision:n=!1}=a.polygon;s=o.searchByPolygon(e,t,`asc`,n);let r=rU.calculatePolygonCentroid(e);return OU(s,r,n)}return null}function jU(e,t){e||=new Set;let n=Object.keys(t),r=n.length;for(let i=0;i<r;i++){let r=t[n[i]],a=r.length;for(let t=0;t<a;t++)e.add(r[t])}return e}function MU(e,t,n,r,i){let a={language:e.tokenizer.language,sharedInternalDocumentStore:t,enabled:!0,isSorted:!0,sortableProperties:[],sortablePropertiesWithTypes:{},sorts:{}};for(let[o,s]of Object.entries(n)){let n=`${i}${i?`.`:``}${o}`;if(!r.includes(n)){if(typeof s==`object`&&!Array.isArray(s)){let i=MU(e,t,s,r,n);WV(a.sortableProperties,i.sortableProperties),a.sorts={...a.sorts,...i.sorts},a.sortablePropertiesWithTypes={...a.sortablePropertiesWithTypes,...i.sortablePropertiesWithTypes};continue}if(!xH(s))switch(s){case`boolean`:case`number`:case`string`:a.sortableProperties.push(n),a.sortablePropertiesWithTypes[n]=s,a.sorts[n]={docs:new Map,orderedDocsToRemove:new Map,orderedDocs:[],type:s};break;case`geopoint`:case`enum`:continue;case`enum[]`:case`boolean[]`:case`number[]`:case`string[]`:continue;default:throw mH(`INVALID_SORT_SCHEMA_TYPE`,Array.isArray(s)?`array`:s,n)}}}return a}function NU(e,t,n,r){return r?.enabled===!1?{disabled:!0}:MU(e,t,n,(r||{}).unsortableProperties||[],``)}function PU(e,t,n,r){if(!e.enabled)return;e.isSorted=!1;let i=OH(e.sharedInternalDocumentStore,n),a=e.sorts[t];a.orderedDocsToRemove.has(i)&&VU(e,t),a.docs.set(i,a.orderedDocs.length),a.orderedDocs.push([i,r])}function FU(e){if(e.isSorted||!e.enabled)return;let t=Object.keys(e.sorts);for(let n of t)zU(e,n);e.isSorted=!0}function IU(e,t,n){return t[1].localeCompare(n[1],LV(e))}function LU(e,t){return e[1]-t[1]}function RU(e,t){return t[1]?-1:1}function zU(e,t){let n=e.sorts[t],r;switch(n.type){case`string`:r=IU.bind(null,e.language);break;case`number`:r=LU.bind(null);break;case`boolean`:r=RU.bind(null);break}n.orderedDocs.sort(r);let i=n.orderedDocs.length;for(let e=0;e<i;e++){let t=n.orderedDocs[e][0];n.docs.set(t,e)}}function BU(e){let t=Object.keys(e.sorts);for(let n of t)VU(e,n)}function VU(e,t){let n=e.sorts[t];n.orderedDocsToRemove.size&&(n.orderedDocs=n.orderedDocs.filter(e=>!n.orderedDocsToRemove.has(e[0])),n.orderedDocsToRemove.clear())}function HU(e,t,n){if(!e.enabled)return;let r=e.sorts[t],i=OH(e.sharedInternalDocumentStore,n);r.docs.get(i)&&(r.docs.delete(i),r.orderedDocsToRemove.set(i,!0))}function UU(e,t,n){if(!e.enabled)throw mH(`SORT_DISABLED`);let r=n.property,i=n.order===`DESC`,a=e.sorts[r];if(!a)throw mH(`UNABLE_TO_SORT_ON_UNKNOWN_FIELD`,r,e.sortableProperties.join(`, `));return VU(e,r),FU(e),t.sort((t,n)=>{let r=a.docs.get(OH(e.sharedInternalDocumentStore,t[0])),o=a.docs.get(OH(e.sharedInternalDocumentStore,n[0])),s=r!==void 0,c=o!==void 0;return!s&&!c?0:s?c?i?o-r:r-o:-1:1}),t}function WU(e){return e.enabled?e.sortableProperties:[]}function GU(e){return e.enabled?e.sortablePropertiesWithTypes:{}}function KU(e,t){let n=t;if(!n.enabled)return{enabled:!1};let r=Object.keys(n.sorts).reduce((e,t)=>{let{docs:r,orderedDocs:i,type:a}=n.sorts[t];return e[t]={docs:new Map(Object.entries(r).map(([e,t])=>[+e,t])),orderedDocsToRemove:new Map,orderedDocs:i,type:a},e},{});return{sharedInternalDocumentStore:e,language:n.language,sortableProperties:n.sortableProperties,sortablePropertiesWithTypes:n.sortablePropertiesWithTypes,sorts:r,enabled:!0,isSorted:n.isSorted}}function qU(e){if(!e.enabled)return{enabled:!1};BU(e),FU(e);let t=Object.keys(e.sorts).reduce((t,n)=>{let{docs:r,orderedDocs:i,type:a}=e.sorts[n];return t[n]={docs:Object.fromEntries(r.entries()),orderedDocs:i,type:a},t},{});return{language:e.language,sortableProperties:e.sortableProperties,sortablePropertiesWithTypes:e.sortablePropertiesWithTypes,sorts:t,enabled:e.enabled,isSorted:e.isSorted}}function JU(){return{create:NU,insert:PU,remove:HU,save:qU,load:KU,sortBy:UU,getSortableProperties:WU,getSortablePropertiesWithTypes:GU}}const YU=[65,65,65,65,65,65,65,67,69,69,69,69,73,73,73,73,69,78,79,79,79,79,79,null,79,85,85,85,85,89,80,115,97,97,97,97,97,97,97,99,101,101,101,101,105,105,105,105,101,110,111,111,111,111,111,null,111,117,117,117,117,121,112,121,65,97,65,97,65,97,67,99,67,99,67,99,67,99,68,100,68,100,69,101,69,101,69,101,69,101,69,101,71,103,71,103,71,103,71,103,72,104,72,104,73,105,73,105,73,105,73,105,73,105,73,105,74,106,75,107,107,76,108,76,108,76,108,76,108,76,108,78,110,78,110,78,110,110,78,110,79,111,79,111,79,111,79,111,82,114,82,114,82,114,83,115,83,115,83,115,83,115,84,116,84,116,84,116,85,117,85,117,85,117,85,117,85,117,85,117,87,119,89,121,89,90,122,90,122,90,122,115];function XU(e){return e<192||e>383?e:YU[e-192]||e}function ZU(e){let t=[];for(let n=0;n<e.length;n++)t[n]=XU(e.charCodeAt(n));return String.fromCharCode(...t)}const QU={ational:`ate`,tional:`tion`,enci:`ence`,anci:`ance`,izer:`ize`,bli:`ble`,alli:`al`,entli:`ent`,eli:`e`,ousli:`ous`,ization:`ize`,ation:`ate`,ator:`ate`,alism:`al`,iveness:`ive`,fulness:`ful`,ousness:`ous`,aliti:`al`,iviti:`ive`,biliti:`ble`,logi:`log`},$U={icate:`ic`,ative:``,alize:`al`,iciti:`ic`,ical:`ic`,ful:``,ness:``},eW=`[aeiouy]`,tW=`[^aeiou][^aeiouy]*`;eW+``;const nW=`^(`+tW+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*`;``+tW;const rW=`^(`+tW+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*`,iW=`^(`+tW+`)?[aeiouy]`;function aW(e){let t,n,r,i,a,o;if(e.length<3)return e;let s=e.substring(0,1);if(s==`y`&&(e=s.toUpperCase()+e.substring(1)),r=/^(.+?)(ss|i)es$/,i=/^(.+?)([^s])s$/,r.test(e)?e=e.replace(r,`$1$2`):i.test(e)&&(e=e.replace(i,`$1$2`)),r=/^(.+?)eed$/,i=/^(.+?)(ed|ing)$/,r.test(e)){let t=r.exec(e);r=new RegExp(nW),r.test(t[1])&&(r=/.$/,e=e.replace(r,``))}else i.test(e)&&(t=i.exec(e)[1],i=new RegExp(iW),i.test(t)&&(e=t,i=/(at|bl|iz)$/,a=RegExp(`([^aeiouylsz])\\1$`),o=RegExp(`^`+tW+eW+`[^aeiouwxy]$`),i.test(e)?e+=`e`:a.test(e)?(r=/.$/,e=e.replace(r,``)):o.test(e)&&(e+=`e`)));if(r=/^(.+?)y$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(iW),t&&r.test(t)&&(e=t+`i`)),r=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,r.test(e)){let i=r.exec(e);t=i?.[1],n=i?.[2],r=new RegExp(nW),t&&r.test(t)&&(e=t+QU[n])}if(r=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,r.test(e)){let i=r.exec(e);t=i?.[1],n=i?.[2],r=new RegExp(nW),t&&r.test(t)&&(e=t+$U[n])}if(r=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,i=/^(.+?)(s|t)(ion)$/,r.test(e))t=r.exec(e)?.[1],r=new RegExp(rW),t&&r.test(t)&&(e=t);else if(i.test(e)){let n=i.exec(e);t=n?.[1]??``+n?.[2]??``,i=new RegExp(rW),i.test(t)&&(e=t)}return r=/^(.+?)e$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(rW),i=RegExp(`^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$`),a=RegExp(`^`+tW+eW+`[^aeiouwxy]$`),t&&(r.test(t)||i.test(t)&&!a.test(t))&&(e=t)),r=/ll$/,i=new RegExp(rW),r.test(e)&&i.test(e)&&(r=/.$/,e=e.replace(r,``)),s==`y`&&(e=s.toLowerCase()+e.substring(1)),e}function oW(e,t,n=!0){let r=`${this.language}:${e}:${t}`;return n&&this.normalizationCache.has(r)?this.normalizationCache.get(r):this.stopWords?.includes(t)?(n&&this.normalizationCache.set(r,``),``):(this.stemmer&&!this.stemmerSkipProperties.has(e)&&(t=this.stemmer(t)),t=ZU(t),n&&this.normalizationCache.set(r,t),t)}function sW(e){for(;e[e.length-1]===``;)e.pop();for(;e[0]===``;)e.shift();return e}function cW(e,t,n,r=!0){if(t&&t!==this.language)throw mH(`LANGUAGE_NOT_SUPPORTED`,t);if(typeof e!=`string`)return[e];let i=this.normalizeToken.bind(this,n??``),a;if(n&&this.tokenizeSkipProperties.has(n))a=[i(e,r)];else{let t=FV[this.language];a=e.toLowerCase().split(t).map(e=>i(e,r)).filter(Boolean)}let o=sW(a);return this.allowDuplicates?o:Array.from(new Set(o))}function lW(e={}){if(!e.language)e.language=`english`;else if(!IV.includes(e.language))throw mH(`LANGUAGE_NOT_SUPPORTED`,e.language);let t;if(e.stemming||e.stemmer&&!(`stemming`in e))if(e.stemmer){if(typeof e.stemmer!=`function`)throw mH(`INVALID_STEMMER_FUNCTION_TYPE`);t=e.stemmer}else if(e.language===`english`)t=aW;else throw mH(`MISSING_STEMMER`,e.language);let n;if(e.stopWords!==!1){if(n=[],Array.isArray(e.stopWords))n=e.stopWords;else if(typeof e.stopWords==`function`)n=e.stopWords(n);else if(e.stopWords)throw mH(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);if(!Array.isArray(n))throw mH(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);for(let e of n)if(typeof e!=`string`)throw mH(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`)}let r={tokenize:cW,language:e.language,stemmer:t,stemmerSkipProperties:new Set(e.stemmerSkipProperties?[e.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(e.tokenizeSkipProperties?[e.tokenizeSkipProperties].flat():[]),stopWords:n,allowDuplicates:!!e.allowDuplicates,normalizeToken:oW,normalizationCache:new Map};return r.tokenize=cW.bind(r),r.normalizeToken=oW,r}function uW(e){return{sharedInternalDocumentStore:e,rules:new Map}}function dW(e,t){if(e.rules.has(t.id))throw Error(`PINNING_RULE_ALREADY_EXISTS: A pinning rule with id "${t.id}" already exists. Use updateRule to modify it.`);e.rules.set(t.id,t)}function fW(e,t){if(!e.rules.has(t.id))throw Error(`PINNING_RULE_NOT_FOUND: Cannot update pinning rule with id "${t.id}" because it does not exist. Use addRule to create it.`);e.rules.set(t.id,t)}function pW(e,t){return e.rules.delete(t)}function mW(e,t){return e.rules.get(t)}function hW(e){return Array.from(e.rules.values())}function gW(e,t){let n=e.toLowerCase().trim(),r=t.pattern.toLowerCase().trim();switch(t.anchoring){case`is`:return n===r;case`starts_with`:return n.startsWith(r);case`contains`:return n.includes(r);default:return!1}}function _W(e,t){return e?t.conditions.every(t=>gW(e,t)):!1}function vW(e,t){if(!t)return[];let n=[];for(let r of e.rules.values())_W(t,r)&&n.push(r);return n}function yW(e,t){return{sharedInternalDocumentStore:e,rules:new Map(t?.rules??[])}}function bW(e){return{rules:Array.from(e.rules.entries())}}function xW(){return{create:uW,addRule:dW,updateRule:fW,removeRule:pW,getRule:mW,getAllRules:hW,getMatchingRules:vW,load:yW,save:bW}}function SW(e){let t={formatElapsedTime:hH,getDocumentIndexId:gH,getDocumentProperties:tH,validateSchema:_H};for(let n of UH){let r=n;if(e[r]){if(typeof e[r]!=`function`)throw mH(`COMPONENT_MUST_BE_FUNCTION`,r)}else e[r]=t[r]}for(let t of Object.keys(e))if(!HH.includes(t)&&!UH.includes(t))throw mH(`UNSUPPORTED_COMPONENT`,t)}function CW({schema:e,sort:t,language:n,components:r,id:i,plugins:a}){r||={};for(let t of a??[]){if(!(`getComponents`in t)||typeof t.getComponents!=`function`)continue;let n=t.getComponents(e),i=Object.keys(n);for(let e of i)if(r[e])throw mH(`PLUGIN_COMPONENT_CONFLICT`,e,t.name);r={...r,...n}}i||=ZV();let o=r.tokenizer,s=r.index,c=r.documentsStore,l=r.sorter,u=r.pinning;if(o=o?o.tokenize?o:lW(o):lW({language:n??`english`}),r.tokenizer&&n)throw mH(`NO_LANGUAGE_WITH_CUSTOM_TOKENIZER`);let d=TH();s||=EU(),l||=JU(),c||=zH(),u||=xW(),SW(r);let{getDocumentProperties:f,getDocumentIndexId:p,validateSchema:m,formatElapsedTime:h}=r,g={data:{},caches:{},schema:e,tokenizer:o,index:s,sorter:l,documentsStore:c,pinning:u,internalDocumentIDStore:d,getDocumentProperties:f,getDocumentIndexId:p,validateSchema:m,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeUpsert:[],afterUpsert:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],beforeUpdateMultiple:[],afterUpdateMultiple:[],beforeUpsertMultiple:[],afterUpsertMultiple:[],afterCreate:[],formatElapsedTime:h,id:i,plugins:a,version:wW()};g.data={index:g.index.create(g,d,e),docs:g.documentsStore.create(g,d),sorting:g.sorter.create(g,d,e,t),pinning:g.pinning.create(d)};for(let e of BH)g[e]=(g[e]??[]).concat(VH(g,e));let _=g.afterCreate;return _&&JH(_,g),g}function wW(){return`{{VERSION}}`}function TW(e){return e.documentsStore.count(e.data.docs)}function EW(e,t,n,r,i){let a=e.validateSchema(t,e.schema);if(a)throw mH(`SCHEMA_VALIDATION_FAILURE`,a);return oH(e.beforeInsert)||oH(e.afterInsert)||oH(e.index.beforeInsert)||oH(e.index.insert)||oH(e.index.afterInsert)?kW(e,t,n,r,i):AW(e,t,n,r,i)}const DW=new Set([`enum`,`enum[]`]),OW=new Set([`string`,`number`]);async function kW(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw mH(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=OH(e.internalDocumentIDStore,s);if(r||await WH(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw mH(`DOCUMENT_ALREADY_EXISTS`,s);let l=e.documentsStore.count(o),u=e.index.getSearchableProperties(a),d=e.index.getSearchablePropertiesWithTypes(a),f=e.getDocumentProperties(t,u);for(let[e,t]of Object.entries(f)){if(t===void 0)continue;let n=typeof t,r=d[e];jW(n,r,e,t)}return await MW(e,s,u,f,l,n,t,i),r||await WH(e.afterInsert,e,s,t),s}function AW(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw mH(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=OH(e.internalDocumentIDStore,s);if(r||WH(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw mH(`DOCUMENT_ALREADY_EXISTS`,s);let l=e.documentsStore.count(o),u=e.index.getSearchableProperties(a),d=e.index.getSearchablePropertiesWithTypes(a),f=e.getDocumentProperties(t,u);for(let[e,t]of Object.entries(f)){if(t===void 0)continue;let n=typeof t,r=d[e];jW(n,r,e,t)}return NW(e,s,u,f,l,n,t,i),r||WH(e.afterInsert,e,s,t),s}function jW(e,t,n,r){if(!(bH(t)&&typeof r==`object`&&typeof r.lon==`number`&&typeof r.lat==`number`)&&!(xH(t)&&Array.isArray(r))&&!(SH(t)&&Array.isArray(r))&&!(DW.has(t)&&OW.has(e))&&e!==t)throw mH(`INVALID_DOCUMENT_PROPERTY`,n,t,e)}async function MW(e,t,n,r,i,a,o,s){for(let o of n){let n=r[o];if(n===void 0)continue;let c=e.index.getSearchablePropertiesWithTypes(e.data.index)[o];await e.index.beforeInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i);let l=e.internalDocumentIDStore.idToInternalId.get(t);await e.index.insert(e.index,e.data.index,o,t,l,n,c,a,e.tokenizer,i,s),await e.index.afterInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i)}let c=e.sorter.getSortableProperties(e.data.sorting),l=e.getDocumentProperties(o,c);for(let n of c){let r=l[n];if(r===void 0)continue;let i=e.sorter.getSortablePropertiesWithTypes(e.data.sorting)[n];e.sorter.insert(e.data.sorting,n,t,r,i,a)}}function NW(e,t,n,r,i,a,o,s){for(let o of n){let n=r[o];if(n===void 0)continue;let c=e.index.getSearchablePropertiesWithTypes(e.data.index)[o],l=OH(e.internalDocumentIDStore,t);e.index.beforeInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i),e.index.insert(e.index,e.data.index,o,t,l,n,c,a,e.tokenizer,i,s),e.index.afterInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i)}let c=e.sorter.getSortableProperties(e.data.sorting),l=e.getDocumentProperties(o,c);for(let n of c){let r=l[n];if(r===void 0)continue;let i=e.sorter.getSortablePropertiesWithTypes(e.data.sorting)[n];e.sorter.insert(e.data.sorting,n,t,r,i,a)}}function PW(e,t,n,r,i,a){return oH(e.afterInsertMultiple)||oH(e.beforeInsertMultiple)||oH(e.index.beforeInsert)||oH(e.index.insert)||oH(e.index.afterInsert)?FW(e,t,n,r,i,a):IW(e,t,n,r,i,a)}async function FW(e,t,n=1e3,r,i,a=0){let o=[],s=async a=>{let s=Math.min(a+n,t.length),c=t.slice(a,s);for(let t of c){let n=await EW(e,t,r,i,{avlRebalanceThreshold:c.length});o.push(n)}return s};return await(async()=>{let e=0;for(;e<t.length;){let t=Date.now();if(e=await s(e),a>0){let e=a-(Date.now()-t);e>0&&fH(e)}}})(),i||await GH(e.afterInsertMultiple,e,t),o}function IW(e,t,n=1e3,r,i,a=0){let o=[],s=0;function c(){let a=t.slice(s*n,(s+1)*n);if(a.length===0)return!1;for(let t of a){let n=EW(e,t,r,i,{avlRebalanceThreshold:a.length});o.push(n)}return s++,!0}function l(){let e=Date.now();for(;c();)if(a>0){let t=Date.now()-e;if(t>=a){let e=a-t%a;e>0&&fH(e)}}}return l(),i||GH(e.afterInsertMultiple,e,t),o}function LW(e,t){return e[1]-t[1]}function RW(e,t){return t[1]-e[1]}function zW(e=`desc`){return e.toLowerCase()===`asc`?LW:RW}function BW(e,t,n){let r={},i=t.map(([e])=>e),a=e.documentsStore.getMultiple(e.data.docs,i),o=Object.keys(n),s=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e of o){let t;if(s[e]===`number`){let{ranges:r}=n[e],i=r.length,a=Array.from({length:i});for(let e=0;e<i;e++){let t=r[e];a[e]=[`${t.from}-${t.to}`,0]}t=Object.fromEntries(a)}r[e]={count:0,values:t??{}}}let c=a.length;for(let e=0;e<c;e++){let t=a[e];for(let e of o){let i=e.includes(`.`)?nH(t,e):t[e],a=s[e],o=r[e].values;switch(a){case`number`:{let t=n[e].ranges;VW(t,o)(i);break}case`number[]`:{let t=new Set,r=n[e].ranges,a=VW(r,o,t);for(let e of i)a(e);break}case`boolean`:case`enum`:case`string`:HW(o,a)(i);break;case`boolean[]`:case`enum[]`:case`string[]`:{let e=HW(o,a===`boolean[]`?`boolean`:`string`,new Set);for(let t of i)e(t);break}default:throw mH(`FACET_NOT_SUPPORTED`,a)}}}for(let e of o){let t=r[e];if(t.count=Object.keys(t.values).length,s[e]===`string`){let r=n[e],i=zW(r.sort);t.values=Object.fromEntries(Object.entries(t.values).sort(i).slice(r.offset??0,r.limit??10))}}return r}function VW(e,t,n){return r=>{for(let i of e){let e=`${i.from}-${i.to}`;n?.has(e)||r>=i.from&&r<=i.to&&(t[e]===void 0?t[e]=1:(t[e]++,n?.add(e)))}}}function HW(e,t,n){let r=t===`boolean`?`false`:``;return t=>{let i=t?.toString()??r;n?.has(i)||(e[i]=(e[i]??0)+1,n?.add(i))}}const UW={reducer:(e,t,n,r)=>(t[r]=n,t),getInitialValue:e=>Array.from({length:e})},WW=[`string`,`number`,`boolean`];function GW(e,t,n){let r=n.properties,i=r.length,a=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e=0;e<i;e++){let t=r[e];if(a[t]===void 0)throw mH(`UNKNOWN_GROUP_BY_PROPERTY`,t);if(!WW.includes(a[t]))throw mH(`INVALID_GROUP_BY_PROPERTY`,t,WW.join(`, `),a[t])}let o=t.map(([t])=>kH(e.internalDocumentIDStore,t)),s=e.documentsStore.getMultiple(e.data.docs,o),c=s.length,l=n.maxResult||2**53-1,u=[],d={};for(let e=0;e<i;e++){let t=r[e],n={property:t,perValue:{}},i=new Set;for(let e=0;e<c;e++){let r=s[e],a=nH(r,t);if(a===void 0)continue;let o=typeof a==`boolean`?``+a:a,c=n.perValue[o]??{indexes:[],count:0};c.count>=l||(c.indexes.push(e),c.count++,n.perValue[o]=c,i.add(a))}u.push(Array.from(i)),d[t]=n}let f=KW(u),p=f.length,m=[];for(let e=0;e<p;e++){let t=f[e],n=t.length,i={values:[],indexes:[]},a=[];for(let e=0;e<n;e++){let n=t[e],o=r[e];a.push(d[o].perValue[typeof n==`boolean`?``+n:n].indexes),i.values.push(n)}i.indexes=eH(a).sort((e,t)=>e-t),i.indexes.length!==0&&m.push(i)}let h=m.length,g=Array.from({length:h});for(let e=0;e<h;e++){let r=m[e],i=n.reduce||UW,a=r.indexes.map(e=>({id:o[e],score:t[e][1],document:s[e]})),c=i.reducer.bind(null,r.values),l=i.getInitialValue(r.indexes.length),u=a.reduce(c,l);g[e]={values:r.values,result:u}}return g}function KW(e,t=0){if(t+1===e.length)return e[t].map(e=>[e]);let n=e[t],r=KW(e,t+1),i=[];for(let e of n)for(let t of r){let n=[e];WV(n,t),i.push(n)}return i}function qW(e,t,n,r){let i=vW(t,r);if(i.length===0)return n;let a=i.flatMap(e=>e.consequence.promote);a.sort((e,t)=>e.position-t.position);let o=new Set,s=new Map,c=new Set;for(let t of a){let n=OH(e.internalDocumentIDStore,t.doc_id);if(n!==void 0){if(s.has(n)){let e=s.get(n);t.position<e&&s.set(n,t.position);continue}c.has(t.position)||(o.add(n),s.set(n,t.position),c.add(t.position))}}if(s.size===0)return n;let l=n.filter(([e])=>!o.has(e)),u=[];for(let[t,r]of s.entries())n.find(([e])=>e===t)?u.push([t,1e6-r]):e.documentsStore.get(e.data.docs,t)&&u.push([t,0]);u.sort((e,t)=>(s.get(e[0])??1/0)-(s.get(t[0])??1/0));let d=[],f=new Map;for(let e of u){let t=s.get(e[0]);f.set(t,e)}let p=0,m=0;for(;m<l.length+u.length;)if(f.has(m))d.push(f.get(m)),m++;else if(p<l.length)d.push(l[p]),p++,m++;else break;for(let[e,t]of f.entries())e>=d.length&&d.push(t);return d}function JW(e,t,n){let{term:r,properties:i}=t,a=e.data.index,o=e.caches.propertiesToSearch;if(!o){let t=e.index.getSearchablePropertiesWithTypes(a);o=e.index.getSearchableProperties(a),o=o.filter(e=>t[e].startsWith(`string`)),e.caches.propertiesToSearch=o}if(i&&i!==`*`){for(let e of i)if(!o.includes(e))throw mH(`UNKNOWN_INDEX`,e,o.join(`, `));o=o.filter(e=>i.includes(e))}let s=Object.keys(t.where??{}).length>0,c;s&&(c=e.index.searchByWhereClause(a,e.tokenizer,t.where,n));let l,u=t.threshold!==void 0&&t.threshold!==null?t.threshold:1;if(r||i){let i=TW(e);if(l=e.index.search(a,r||``,e.tokenizer,n,o,t.exact||!1,t.tolerance||0,t.boost||{},$W(t.relevance),i,c,u),t.exact&&r){let t=r.trim().split(/\s+/);l=l.filter(([n])=>{let r=e.documentsStore.get(e.data.docs,n);if(!r)return!1;for(let e of o){let n=XW(r,e);if(typeof n==`string`&&t.every(e=>RegExp(`\\b${YW(e)}\\b`).test(n)))return!0}return!1})}}else l=s?AU(a,t.where)||(c?Array.from(c):[]).map(e=>[+e,0]):Object.keys(e.documentsStore.getAll(e.data.docs)).map(e=>[+e,0]);return l}function YW(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function XW(e,t){let n=t.split(`.`),r=e;for(let e of n)if(r&&typeof r==`object`&&e in r)r=r[e];else return;return r}function ZW(e,t,n){let r=XV();function i(){let i=Object.keys(e.data.index.vectorIndexes),a=t.facets&&Object.keys(t.facets).length>0,{limit:o=10,offset:s=0,distinctOn:c,includeVectors:l=!1}=t,u=t.preflight===!0,d=JW(e,t,n);if(t.sortBy)if(typeof t.sortBy==`function`){let n=d.map(([e])=>e),r=e.documentsStore.getMultiple(e.data.docs,n).map((e,t)=>[d[t][0],d[t][1],e]);r.sort(t.sortBy),d=r.map(([e,t])=>[e,t])}else d=e.sorter.sortBy(e.data.sorting,d,t.sortBy).map(([t,n])=>[OH(e.internalDocumentIDStore,t),n]);else d=d.sort($V);d=qW(e,e.data.pinning,d,t.term);let f;u||(f=c?dG(e,d,s,o,c):fG(e,d,s,o));let p={elapsed:{formatted:``,raw:0},hits:[],count:d.length};return f!==void 0&&(p.hits=f.filter(Boolean),l||aH(p,i)),a&&(p.facets=BW(e,d,t.facets)),t.groupBy&&(p.groups=GW(e,d,t.groupBy)),p.elapsed=e.formatElapsedTime(XV()-r),p}async function a(){e.beforeSearch&&await qH(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await KH(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}const QW={k:1.2,b:.75,d:.5};function $W(e){let t=e??{};return t.k=t.k??QW.k,t.b=t.b??QW.b,t.d=t.d??QW.d,t}function eG(e,t,n){let r=t.vector;if(r&&(!(`value`in r)||!(`property`in r)))throw mH(`INVALID_VECTOR_INPUT`,Object.keys(r).join(`, `));let i=e.data.index.vectorIndexes[r.property];if(!i)throw mH(`UNKNOWN_VECTOR_PROPERTY`,r.property);let a=i.node.size;if(r?.value.length!==a)throw r?.property===void 0||r?.value.length===void 0?mH(`INVALID_INPUT_VECTOR`,`undefined`,a,`undefined`):mH(`INVALID_INPUT_VECTOR`,r.property,a,r.value.length);let o=e.data.index,s;return Object.keys(t.where??{}).length>0&&(s=e.index.searchByWhereClause(o,e.tokenizer,t.where,n)),i.node.find(r.value,t.similarity??.8,s)}function tG(e,t,n=`english`){let r=XV();function i(){let i=eG(e,t,n).sort($V);i=qW(e,e.data.pinning,i,void 0);let a=[];t.facets&&Object.keys(t.facets).length>0&&(a=BW(e,i,t.facets));let o=t.vector.property,s=t.includeVectors??!1,c=t.limit??10,l=t.offset??0,u=Array.from({length:c});for(let t=0;t<c;t++){let n=i[t+l];if(!n)break;let r=e.data.docs.docs[n[0]];r&&(s||(r[o]=null),u[t]={id:kH(e.internalDocumentIDStore,n[0]),score:n[1],document:r})}let d=[];t.groupBy&&(d=GW(e,i,t.groupBy));let f=XV()-r;return{count:i.length,hits:u.filter(Boolean),elapsed:{raw:Number(f),formatted:YV(f)},...a?{facets:a}:{},...d?{groups:d}:{}}}async function a(){e.beforeSearch&&await qH(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await KH(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function nG(e,t,n){let r=aG(JW(e,t,n)),i=eG(e,t,n),a=t.hybridWeights;return cG(r,i,t.term??``,a)}function rG(e,t,n){let r=XV();function i(){let i=nG(e,t,n);i=qW(e,e.data.pinning,i,t.term);let a;t.facets&&Object.keys(t.facets).length>0&&(a=BW(e,i,t.facets));let o;t.groupBy&&(o=GW(e,i,t.groupBy));let s=t.offset??0,c=t.limit??10,l=fG(e,i,s,c).filter(Boolean),u=XV(),d={count:i.length,elapsed:{raw:Number(u-r),formatted:YV(u-r)},hits:l,...a?{facets:a}:{},...o?{groups:o}:{}};return(t.includeVectors??!1)||aH(d,Object.keys(e.data.index.vectorIndexes)),d}async function a(){e.beforeSearch&&await qH(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await KH(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function iG(e){return e[1]}function aG(e){let t=Math.max.apply(Math,e.map(iG));return e.map(([e,n])=>[e,n/t])}function oG(e,t){return e/t}function sG(e,t){return(n,r)=>n*e+r*t}function cG(e,t,n,r){let i=Math.max.apply(Math,e.map(iG)),a=Math.max.apply(Math,t.map(iG)),{text:o,vector:s}=r&&r.text&&r.vector?r:lG(n),c=new Map,l=e.length,u=sG(o,s);for(let t=0;t<l;t++){let[n,r]=e[t],a=u(oG(r,i),0);c.set(n,a)}let d=t.length;for(let e=0;e<d;e++){let[n,r]=t[e],i=oG(r,a),o=c.get(n)??0;c.set(n,o+u(0,i))}return[...c].sort((e,t)=>t[1]-e[1])}function lG(e){return{text:.5,vector:.5}}function uG(e,t,n){let r=t.mode??`fulltext`;if(r===`fulltext`)return ZW(e,t,n);if(r===`vector`)return tG(e,t);if(r===`hybrid`)return rG(e,t);throw mH(`INVALID_SEARCH_MODE`,r)}function dG(e,t,n,r,i){let a=e.data.docs,o=new Map,s=[],c=new Set,l=t.length,u=0;for(let d=0;d<l;d++){let l=t[d];if(l===void 0)continue;let[f,p]=l;if(c.has(f))continue;let m=e.documentsStore.get(a,f),h=nH(m,i);if(!(h===void 0||o.has(h))&&(o.set(h,!0),u++,!(u<=n)&&(s.push({id:kH(e.internalDocumentIDStore,f),score:p,document:m}),c.add(f),u>=n+r)))break}return s}function fG(e,t,n,r){let i=e.data.docs,a=Array.from({length:r}),o=new Set;for(let s=n;s<r+n;s++){let n=t[s];if(n===void 0)break;let[r,c]=n;if(!o.has(r)){let t=e.documentsStore.get(i,r);a[s]={id:kH(e.internalDocumentIDStore,r),score:c,document:t},o.add(r)}}return a}var pG=n(kV(),1);const mG=1,hG={protocol:`x-ok-client-protocol`,runtime:`x-ok-client-runtime`,kind:`x-ok-client-kind`};function gG({kind:e,runtimeVersion:t}){return{[hG.protocol]:`1`,[hG.runtime]:t,[hG.kind]:e}}const _G=`__system__`,vG=1,yG=`__config__/project`,bG=`__user__/config.yml`,xG=`__local__/project`,SG=`__config__/okignore`,CG=Object.freeze([yG,xG,bG,SG]),wG=`__skill__/`,TG=`__template__/`,EG=[`project`,`global`];function DG(e){return e.startsWith(`__skill__/`)||e.startsWith(`__template__/`)}const OG=`.ok/skills`;function kG(e){return`${OG}/${e}/SKILL`}const AG=[`references`,`scripts`];function jG(e,t){let n=/^(\.ok\/skills\/[^/]+)\/SKILL$/.exec(t);if(!n)return null;let r=n[1],i=e.trim().replace(/\.mdx?$/i,``).split(`/`).filter(e=>e!==``&&e!==`.`),[a]=i;return!a||!AG.includes(a)||i.includes(`..`)||i.length<2?null:`${r}/${i.join(`/`)}`}const MG=/^\.ok\/skills\/([^/]+)\/(SKILL|references\/.+)$/;function NG(e){let t=MG.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===`SKILL`?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}const PG=/^__skill__\/global\/([^/]+)(?:\/(references\/.+))?$/;function FG(e){let t=PG.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===void 0?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}function IG(e,t){return e===`project`?kG(t):`${wG}${e}/${t}`}function LG(e){if(e===``)return``;try{return e.split(`/`).map(e=>decodeURIComponent(e)).join(`/`)}catch{return e}}function RG(e){if(e.startsWith(`__skill__/`)){let t=e.slice(10),n=t.indexOf(`/`);if(n<0)return null;let r=t.slice(0,n);if(r!==`global`&&r!==`project`)return null;let i=t.slice(n+1);return i?{kind:`skill`,scope:r,name:LG(i)}:null}if(e.startsWith(`__template__/`)){let t=e.slice(13);if(!t)return null;let n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return r?{kind:`template`,folder:LG(n<0?``:t.slice(0,n)),name:LG(r)}:null}return null}const zG=/^(?:(.+)\/)?\.ok\/templates\/([^/]+?)(?:\.mdx?)?$/;function BG(e){let t=zG.exec(e);if(t){let e=(t[1]??``).replace(/^\/+|\/+$/g,``);return`${TG}${e?`${e}/`:``}${t[2]}`}return null}const VG=[`.mdx`,`.md`],HG=`epoch`,UG=512*1024,WG=[`claude`,`claude-desktop`,`cursor`,`codex`,`opencode`,`openclaw`,`pi`,`antigravity`,`lm-studio`,`hermes`],GG={claude:`Claude`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`,opencode:`OpenCode`,openclaw:`OpenClaw`,pi:`Pi`,antigravity:`Antigravity`,"lm-studio":`LM Studio`,hermes:`Hermes`},KG={claude:`.claude/skills`,"claude-desktop":null,cursor:`.cursor/skills`,codex:`.codex/skills`,opencode:`.opencode/skills`,openclaw:null,pi:`.pi/skills`,antigravity:null,"lm-studio":null,hermes:null},qG=WG.filter(e=>KG[e]!==null),JG=qG.filter(e=>e!==`pi`).map(e=>({hostDir:(KG[e]??``).split(`/`)[0],editorId:e})),YG={claude:`.mcp.json`,"claude-desktop":null,cursor:`.cursor/mcp.json`,codex:`.codex/config.toml`,opencode:`opencode.json`,openclaw:null,pi:`.pi/extensions/open-knowledge.ts`,antigravity:null,"lm-studio":null,hermes:null},XG={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/},ZG=`Ov23liqlSd0V1MwR6rhI`,QG=[`incoming`,`outgoing`,`both`];function $G(e){return QG.includes(e)}const eK=`open-knowledge`,tK=[{id:`chart`,title:`Chart`,description:`A bar chart whose series colors track the OK chart palette.`,html:`<div style="font-family:system-ui,sans-serif;padding:20px;color:var(--foreground)">
|
|
305
305
|
<h3 style="margin:0 0 14px;font-size:15px;font-weight:600">Revenue by region</h3>
|
|
306
306
|
<div id="bars" style="display:flex;align-items:flex-end;gap:14px;height:170px"></div>
|
|
307
307
|
<script>
|
|
@@ -363,26 +363,26 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
363
363
|
out.textContent = '$' + Number(amt.value).toLocaleString();
|
|
364
364
|
});
|
|
365
365
|
<\/script>
|
|
366
|
-
</div>`}];function
|
|
367
|
-
`)}const iK=[{name:`--chart-1`,light:`oklch(0.62 0.19 259)`,dark:`oklch(0.72 0.14 259)`},{name:`--chart-2`,light:`oklch(0.58 0.14 145)`,dark:`oklch(0.73 0.13 145)`},{name:`--chart-3`,light:`oklch(0.62 0.15 70)`,dark:`oklch(0.77 0.14 70)`},{name:`--chart-4`,light:`oklch(0.55 0.18 290)`,dark:`oklch(0.72 0.16 290)`},{name:`--chart-5`,light:`oklch(0.58 0.21 25)`,dark:`oklch(0.72 0.2 25)`},{name:`--primary`,light:`oklch(0.6321 0.1983 259.59)`,dark:`#69a3ff`},{name:`--primary-foreground`,light:`oklch(0.985 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--background`,light:`oklch(1 0 0)`,dark:`oklch(0.145 0 0)`},{name:`--card`,light:`oklch(1 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--card-foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--muted-foreground`,light:`oklch(0.556 0 0)`,dark:`oklch(0.708 0 0)`},{name:`--border`,light:`oklch(0.922 0 0)`,dark:`oklch(1 0 0 / 10%)`},{name:`--destructive`,light:`oklch(0.577 0.245 27.325)`,dark:`oklch(0.704 0.191 22.216)`},{name:`--radius`,light:`0.625rem`,dark:`0.625rem`}],aK=`127.0.0.1`,oK=oS.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`},sourceClosingFenceLength:{default:null,rendered:!1},sourceFenceIndent:{default:null,rendered:!1},sourceInfoPadding:{default:null,rendered:!1},sourceIndents:{default:null,rendered:!1}}}}),sK=yS.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[Lx({find:mS,type:this.type,getAttributes:{sourceDelimiter:`*`}}),Lx({find:gS,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),cK=pS.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[Lx({find:cS,type:this.type,getAttributes:{sourceDelimiter:`**`}}),Lx({find:uS,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),lK=gx.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),uK=eS.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":n,id:`fn-${n}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${n}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}}),dK=eS.create({name:`footnoteReference`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){return[{tag:`sup[data-footnote-ref]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}}}]},renderHTML({node:e}){let t=String(e.attrs.identifier??``);return[`sup`,{id:`fnref-${t}`,"data-footnote-ref":``,"data-footnote-id":t,class:`footnote-ref`},[`a`,{href:`#fn-${t}`,class:`footnote-ref-link`},`[${t}]`]]},addCommands(){return{insertFootnoteReference:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e}})}}}),fK=/^---[ \t]*\r?\n([\s\S]*?\r?\n)?---[ \t]*(\r?\n|$)/;function pK(e){let t=e.match(fK);return t?{frontmatter:t[0],body:e.slice(t[0].length)}:{frontmatter:``,body:e}}function mK(e,t){return e?e+t:t}function hK(e){if(e===``)return``;let t=e.match(fK);return t?(t[1]??``).replace(/\r?\n$/,``):e}const gK=xS.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`},sourceRaw:{default:null}}}}),_K=CS.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1},sourceLeadingIndent:{default:null,rendered:!1},sourceInteriorSpacing:{default:null,rendered:!1}}}}),vK=eS.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}});function yK(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}const bK=TS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=sb(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=yK(t.src)),[`img`,t]}}),xK=eS.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),SK=eS.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,addAttributes(){return{}},parseHTML(){return[{tag:`span[data-jsx-inline]`}]},renderHTML(){return[`span`,{"data-jsx-inline":``},0]}}),CK=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],wK=CK.map(e=>`${e}:`).join(`|`);RegExp(`^(?:${wK}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function TK(e){let t=e.trim();if(t===``)return!0;let n=t.indexOf(`:`);if(n===-1)return!0;let r=t.indexOf(`/`),i=t.indexOf(`?`),a=t.indexOf(`#`);return n>Math.min(r===-1?1/0:r,i===-1?1/0:i,a===-1?1/0:a)}const EK=new Set(CK.map(e=>`${e}:`));function DK(e){try{let t=new URL(e,`https://placeholder.invalid`);return EK.has(t.protocol.toLowerCase())}catch{return!1}}const OK=LS.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:DK,validate:DK,shouldAutoLink:()=>!0}},addAttributes(){return{...this.parent?.(),linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1},sourceUrlForm:{default:null,rendered:!1},sourceTitleMarker:{default:null,rendered:!1}}}}),kK=eS.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs,i=r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},i]}});function AK(e){return e.type.name===`list`&&!e.attrs.ordered}function jK(e){return e.type.name===`list`&&!!e.attrs.ordered}function MK(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function NK(e,t,n,r,i,a,o){let s=Zy(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?Jp(r)(e,t):!1}if(s){if(!t)return!0;let{tr:n}=e;return n.setNodeMarkup(s.pos,void 0,{...s.node.attrs,...a}),o!==void 0&&s.node.forEach((e,t)=>{if(e.type.name===`listItem`){let r=s.pos+1+t;n.setNodeMarkup(r,void 0,{...e.attrs,...o})}}),t(n),!0}return Gp(n,a)(e,void 0)?t?Gp(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!0:!1}const PK=eS.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.ordered?`ol`:`ul`,r={};return e.attrs.ordered&&e.attrs.start!==1&&(r.start=e.attrs.start),[n,sb(t,r),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:NK(e,t,n,r,e=>AK(e)&&!MK(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:NK(e,t,n,r,e=>jK(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:NK(e,t,n,r,e=>AK(e)&&MK(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[Bx({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]}),joinPredicate:(e,t)=>t.attrs.ordered===!1}),Bx({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]}),joinPredicate:(e,t)=>t.attrs.ordered===!0}),new cx({find:/^\s*[-*+]\s\[([ xX])\]\s$/,handler:({state:e,range:t,match:n})=>{let r=e.schema.nodes.list;if(!r)return null;let i=n[1]!==` `,a=e.tr.delete(t.from,t.to),o=a.doc.resolve(t.from).blockRange();if(!o)return null;let s=sf(o,r,{ordered:!1});if(!s)return null;a.wrap(o,s);let c=a.doc.resolve(a.mapping.map(t.from));for(let e=c.depth;e>0;e--){let t=c.node(e);if(t.type.name===`listItem`){a.setNodeMarkup(c.before(e),void 0,{...t.attrs,checked:i});break}}}})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),FK=eS.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1},sourceMarkerSpacing:{default:null,rendered:!1},sourceOrdinal:{default:null,rendered:!1},sourceCheckboxChar:{default:null,rendered:!1},sourceContinuationIndent:{default:null,rendered:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,sb(t),0]:[`li`,sb(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:n,HTMLAttributes:r})=>{let i=document.createElement(`li`);Object.entries(sb(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`),c=()=>{o&&(o.disabled=!n.isEditable)};return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,c(),n.on(`update`,c),o.addEventListener(`change`,()=>{let r=t();r===void 0||typeof r!=`number`||n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,o.disabled=!n.isEditable,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)},destroy(){n.off(`update`,c)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),IK=PK,LK=FK,RK=eS.create({name:`mathInline`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`},sourceDelimiter:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e==`string`?!1:{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),zK=eS.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){let e=e=>typeof e==`string`?!1:{reason:e.getAttribute(`data-reason`)||``};return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e},{tag:`pre[data-raw-mdx-fallback]`,getAttrs:e}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let n=document.createElement(`pre`);return n.classList.add(`raw-mdx-fallback-content`),n.setAttribute(`contenteditable`,`false`),t.appendChild(n),{dom:t,contentDOM:n,ignoreMutation:()=>!0}}}}),BK=Jw.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),VK=Qw.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1},sourcePadded:{default:!1,rendered:!1}}}}),HK=eS.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,style:`display: none;`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),UK=gx.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,style:`display: none;`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),WK=Tx.create({name:`docFidelity`,addGlobalAttributes(){return[{types:[`doc`],attributes:{sourceDocBoundary:{default:null,rendered:!1}}}]}}),GK=eS.create({name:`imageReference`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{alt:{default:``},label:{default:``},identifier:{default:``},referenceType:{default:`shortcut`}}},parseHTML(){return[{tag:`img[data-image-reference]`}]},renderHTML({node:e}){let{alt:t,label:n,referenceType:r}=e.attrs,i=t||n;return[`img`,{"data-image-reference":``,"data-reference-type":r,"data-label":n,alt:i}]}});function KK(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return t;return null}function qK(e){let t=!1;return e.descendants(e=>t?!1:(e.type.name===`list`&&(t=!0),!t)),t}function JK(e){let{selection:t}=e;return t instanceof B?t.$cursor:null}function YK(e){let t=JK(e);if(!t||t.parentOffset!==0)return!1;let n=KK(t);if(n===null||t.depth!==n+1||t.index(n)!==0)return!1;let r=t.index(n-1);return r===0?!1:qK(t.node(n-1).child(r-1))}function XK(e,t){for(let n=t-1;n>=0;n--){let t=e.node(n),r=e.index(n);if(r<t.childCount-1){let e=t.child(r+1),i=n+1;for(;e.type.name===`list`&&e.firstChild;)e=e.firstChild,i+=1;return e.type.name===`listItem`?i:null}}return null}function ZK(e){let t=JK(e);if(!t||t.parentOffset!==t.parent.content.size)return!1;let n=KK(t);if(n===null)return!1;for(let e=t.depth;e>n;e--)if(t.index(e-1)!==t.node(e-1).childCount-1)return!1;let r=XK(t,n);return r!==null&&r<n}const QK=Tx.create({name:`listBoundaryMerge`,addKeyboardShortcuts(){let e=()=>{let{editor:e}=this;if(!YK(e.state))return!1;if(e.commands.undoInputRule())return!0;let{state:t,view:n}=e;return dp(t,n.dispatch,n)},t=()=>{let{editor:e}=this;if(!ZK(e.state))return!1;let{state:t,view:n}=e;return fp(t,n.dispatch,n)};return{Backspace:e,"Mod-Backspace":e,Delete:t,"Mod-Delete":t}}}),$K=new Map([[32,` `],[9,` `],[160,`\xA0`]]);function eq(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function tq(e){let t=eq(e);return t!==null&&$K.has(t)}function nq(e){let t=eq(e);return t===null?null:$K.get(t)??null}const rq=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function iq(e){rq.lastIndex=0;let t=e.match(rq);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=nq(e);if(t===null)return null;n+=t}return n}const aq=gx.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function oq(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r||sq(n)===r?!0:iq(e)===t}function sq(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const cq=RT.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),lq=Gw.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),uq=Aw.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),dq=jw.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),fq=eS.create({name:`tag`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),pq=/^(?:---|—-|___\s|\*\*\*\s)$/;function mq(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const hq=tT.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[Rx({find:pq,type:this.type,getAttributes:e=>({sourceRaw:mq(e)})})]}});function gq(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function _q(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const vq=eS.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:gq(e.getAttribute(`data-alias`)),anchor:gq(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:gq(e.getAttribute(`data-alias`)),anchor:gq(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=gq(e.attrs.alias),i=gq(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},_q({target:n,alias:r,anchor:i})]}});function yq(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function bq(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const xq=[xK,zK,SK,RK,vq,eS.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:gq(e.getAttribute(`data-alias`)),anchor:gq(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=gq(e.attrs.alias),i=gq(e.attrs.anchor),a=gq(e.attrs.resolvedSrc),o=yq(n);if(Vc.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},bq({target:n,alias:r,anchor:i})]}}),fq,IK,LK,sK,cK,cq,VK,oK,BK,_K,hq,OK,vK,kK,gK,lK,WK,aq,AE.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,listKeymap:{listTypes:[{itemName:`listItem`,wrapperNames:[`list`]}]},italic:!1,bold:!1,strike:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),QK,lq.configure({resizable:!0}),Mw,dq,uq,bK.configure({inline:!0}),GK,BS,UK,HK,dK,uK];3072-Sq("This is an OpenKnowledge project: load the `open-knowledge` skill and use the OpenKnowledge MCP tools for all markdown — don't probe for `.ok/` or use native file tools on `.md` / `.mdx`. ",`cursor`);function Sq(e,t){let n=encodeURIComponent(e);return t===`cursor`?encodeURIComponent(n).length:n.length}function Cq(e){return`'${e.replace(/'/g,`'\\''`)}'`}`${tK}`,[`delete`,`move`,`share_link`,`install`].map(e=>`mcp__${tK}__${e}`),`${Cq(`mcp_servers.${tK}.default_tools_approval_mode="approve"`)}`;function wq(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}const Tq=new Set([`opencode.json`]);function Eq(e){return e.split(`/`).some(e=>e.startsWith(`.`))?!0:Tq.has(e.slice(e.lastIndexOf(`/`)+1))}function Dq(e,t){let n=wq(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const Oq=A().superRefine(Dq).optional(),kq={agentId:A().optional(),agentName:A().optional(),colorSeed:A().optional(),clientName:A().optional(),clientVersion:A().optional(),label:A().optional()},Aq=A().optional(),jq=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Mq=tc(`kind`,[P({kind:I(`doc`),docPath:A().min(1)}).loose(),P({kind:I(`folder`),folderPath:A()}).loose()]),Nq=F([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`]),Pq=F([`current`,`stale`,`absent`]),Fq=tc(`ok`,[P({ok:I(!0),shareUrl:A().min(1),sharedUrl:A().min(1),branch:A().min(1),freshness:Pq.optional().catch(void 0)}).loose(),P({ok:I(!1),error:Nq,branch:A().min(1).optional()}).loose()]),Iq=F([`user`,`org`]),Lq=P({login:A().min(1),kind:Iq,avatarUrl:A().optional()}).loose(),Rq=F([`auth-required`,`network`]),zq=tc(`ok`,[P({ok:I(!0),owners:N(Lq)}).loose(),P({ok:I(!1),error:Rq}).loose()]),Bq=tc(`ok`,[P({ok:I(!0),available:M()}).loose(),P({ok:I(!1),error:Rq}).loose()]),Vq=F([`public`,`private`]),Hq=P({owner:A().min(1),name:A().min(1),visibility:Vq,description:A().optional()}).loose(),Uq=F([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),Wq=tc(`ok`,[P({ok:I(!0),ownerLogin:A().min(1),repoName:A().min(1),cloneUrl:A().min(1),defaultBranch:A().min(1)}).loose(),P({ok:I(!1),error:Uq}).loose()]);function Gq(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const Kq=e=>e.refine(Gq,`invalid branch name`);function qq(e){if(e==null)return!1;let t=e instanceof Error?e.message:String(e);return/couldn'?t find remote ref|Remote branch .+ not found/i.test(t)}const Jq=[/could not read (username|password)/i,/terminal prompts disabled/i],Yq=[/insufficient scopes/i,/missing.*scope/i,/required scope/i],Xq=[/permission denied.*\(publickey\)/i,/host key verification failed/i],Zq=[/\b(401|403)\b/,/authentication failed/i,/authorization failed/i,/invalid credentials/i,/credential helper/i,/bad credentials/i,/token.*expired/i,/expired.*token/i,/fatal:.*repository.*not found/i];function Qq(e){if(typeof e!=`object`||!e)return``;let t=e.git;return t==null?``:String(t)}function $q(e){if(e==null)return{kind:`non-auth`};let t=`${e instanceof Error?e.message:String(e)}\n${Qq(e)}`;return Jq.some(e=>e.test(t))?{kind:`auth`,subclass:`no-credential`}:Yq.some(e=>e.test(t))?{kind:`auth`,subclass:`scope-mismatch`}:Xq.some(e=>e.test(t))?{kind:`auth`,subclass:`ssh-auth`}:Zq.some(e=>e.test(t))?/\b401\b/.test(t)||/token.*expired/i.test(t)?{kind:`auth`,subclass:`401`}:/\b403\b/.test(t)?{kind:`auth`,subclass:`403`}:{kind:`auth`,subclass:`unknown-auth`}:{kind:`non-auth`}}function eJ(e){return e.kind===`auth`?e.subclass===`no-credential`||e.subclass===`401`||e.subclass===`unknown-auth`:!1}const tJ={shareTargetExists:M(),dirtyConflicts:P({conflicts:M(),files:N(A().min(1))}).loose(),branchIsLocal:M(),shareTargetOnOriginBranch:M().optional()},nJ=tc(`detached`,[P({detached:I(!1),currentBranch:A().min(1).nullable(),currentHeadSha:Hs(),...tJ}).loose(),P({detached:I(!0),currentBranch:Hs(),currentHeadSha:A().min(1),...tJ}).loose()]),rJ=P({branch:Kq(A().min(1)),principalId:A().optional(),fastForward:M().optional()}).loose(),iJ=F([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]),aJ=tc(`ok`,[P({ok:I(!0)}).loose(),P({ok:I(!1),reason:iJ,files:N(A().min(1)).optional(),otherWorktreePath:A().min(1).optional()}).loose()]);F([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]);const oJ=P({branch:Kq(A().min(1)),path:A(),kind:F([`doc`,`folder`])}).loose(),sJ=tc(`verdict`,[P({verdict:I(`on-origin`)}).loose(),P({verdict:I(`renamed`),renamedTo:A().min(1)}).loose(),P({verdict:I(`deleted`)}).loose(),P({verdict:I(`never-on-branch`)}).loose(),P({verdict:I(`changed-locally`)}).loose(),P({verdict:I(`unknown`)}).loose()]).catch({verdict:`unknown`}),cJ=P({startedAt:A().min(1),httpListenMs:j().nonnegative().optional(),seedWalkMs:j().nonnegative().optional(),indexesMs:j().nonnegative().optional(),readyMs:j().nonnegative().optional(),fileCount:j().nonnegative().optional()}),lJ=P({serverInstanceId:A().min(1),currentBranch:A().min(1).optional(),currentDiskAckSVs:ac(A().min(1),A().min(1)).optional(),boot:cJ.optional()}).loose(),uJ=P({id:A().min(1),display_name:A().min(1),display_email:A(),source:F([`git-config`,`synthesized`]),created_at:A().min(1)}).loose(),dJ=P({collabUrl:A().nullable(),previewUrl:A().nullable(),port:j(),singleFile:M().default(!1)}).loose(),fJ=F(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:no-conflict-tracked.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed`.split(`.`));function pJ(e){throw Error(`Unexpected ProblemType variant: ${JSON.stringify(e)}`)}const mJ=P({type:fJ,title:A().min(1),status:j().int().min(400).max(599),instance:A().regex(jq,`instance must be urn:uuid:<uuid>`).optional(),detail:A().optional()}).loose(),hJ=P({parentDocName:A().min(1),placement:F([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:A().min(1).optional(),agentName:A().min(1).optional()}).loose(),gJ=P({src:A().min(1),path:A().min(1).optional(),deduped:M().optional()}).loose(),_J=P({url:A().min(1),dir:A().min(1),branch:A().min(1).refine(Gq,`invalid branch name`).optional()}).loose(),vJ=P({type:I(`error`),problem:mJ}).loose();function yJ(e){let t=[],n=0,r=()=>{t.length>0&&(n+=1)},i=e=>{for(;n>0;)t.push({type:`break`}),--n;t.push(e)},a=e=>{e.split(`
|
|
368
|
-
`).forEach((e,t)=>{t>0&&r(),e.length>0&&i({type:`text`,value:e})})},o=e=>{let t=e.ordered===!0,n=typeof e.start==`number`?e.start:1,a=e.data,o=typeof a?.bulletMarker==`string`?a.bulletMarker:`-`,c=typeof a?.listMarkerDelimiter==`string`?a.listMarkerDelimiter:`.`;e.children.forEach((e,a)=>{a>0&&r(),i({type:`text`,value:t?`${n+a}${c} `:`${o} `}),e.children.forEach((e,t)=>{t>0&&r(),s(e)})})},s=e=>{switch(e.type){case`paragraph`:case`heading`:e.children.forEach(i);return;case`list`:o(e);return;case`code`:case`html`:a(e.value);return;case`thematicBreak`:i({type:`text`,value:e.data?.sourceRaw??`---`});return;default:{let t=e;if(Array.isArray(t.children)&&t.children.length>0){t.children.forEach((e,t)=>{t>0&&r(),s(e)});return}let n=e;if(typeof n.value==`string`){a(n.value);return}console.warn(JSON.stringify({event:`table-cell-flatten-dropped-block`,nodeType:e.type}))}}};return e.forEach((e,t)=>{t>0&&r(),s(e)}),t}function bJ(e,t){let n=0;for(let r=0;r<t.length&&n<e.length;r++)e[n]===t[r]&&n++;return n===e.length}const xJ=new Set([`sourceRaw`,`sourceDirty`,`position`]),SJ=new Set([`jsxComponent`,`table`,`tableRow`,`tableCell`,`tableHeader`,`list`,`listItem`,`blockquote`,`codeBlock`,`heading`]),CJ={type:`__br__`},wJ=/^<br\s*\/?>$/i;function TJ(e){let t=AJ(e,TJ);return(t.type===`tableCell`||t.type===`tableHeader`)&&t.content?{...t,content:EJ(t.content)}:t}function EJ(e){let t=[];for(let n of e){let e=DJ(n);e.length!==0&&(t.length>0&&t.push(CJ),t.push(...e))}return t}function DJ(e){return e.text!==void 0||e.type===`hardBreak`||e.type===`jsxInline`?[e]:!e.content||e.content.length===0?[]:e.content.some(e=>e.text===void 0&&e.type!==`hardBreak`&&e.type!==`jsxInline`&&!!e.content)?EJ(e.content):e.content}function OJ(e){return e.type===`hardBreak`||e.type===CJ.type||e.text!==void 0&&wJ.test(e.text.trim())?CJ:AJ(e,OJ)}const kJ=[{label:`table-cell-block-flatten`,severity:`pm-model-caused`,rationale:`GFM table cells have no block spelling; a block placed in a cell is flattened to inline on serialize, so a cell-with-blocks and a cell-with-inline describe the same persisted document.`,proofPointer:`markdown/table-cell-flatten.ts flattenCellBlocks (table-cell-flatten-dropped-block event)`,canonicalize:TJ},{label:`void-hardbreak-br`,severity:`serializer-caused`,rationale:`A void hardBreak inside a table cell or heading serializes to a literal <br /> that a fresh parse keeps as text; the node form and the literal form are the same break.`,proofPointer:`markdown/void-br-promoter.ts + markdown/to-markdown-handlers.ts break handler`,canonicalize:OJ}];function AJ(e,t){return e.content?{...e,content:e.content.map(t)}:e}function jJ(e,t){let n={};e.type!==void 0&&(n.type=e.type),e.text!==void 0&&(n.text=e.text);let r=MJ(e.attrs,t);return r&&(n.attrs=r),e.marks&&e.marks.length>0&&(n.marks=[...e.marks].map(e=>({type:e.type,attrs:MJ(e.attrs,t)})).sort((e,t)=>PJ(e).localeCompare(PJ(t)))),e.content&&e.content.length>0&&(n.content=e.content.map(e=>jJ(e,t))),n}function MJ(e,t){if(!e)return null;let n={};for(let r of Object.keys(e).sort()){if(xJ.has(r)||t?.(r))continue;let i=e[r];i!=null&&(n[r]=t?NJ(i,t):i)}return Object.keys(n).length>0?n:null}function NJ(e,t){if(Array.isArray(e))return e.map(e=>NJ(e,t));if(e&&typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))t(r)||(n[r]=NJ(i,t));return n}return e}function PJ(e){return JSON.stringify(e,(e,t)=>{if(t&&typeof t==`object`&&!Array.isArray(t)){let e={};for(let n of Object.keys(t).sort())e[n]=t[n];return e}return t})}function FJ(e){let t=``,n=e=>{if(e.text!==void 0&&(t+=e.text),e.content)for(let t of e.content)n(t)};return n(e),t.replace(/\s+/g,``)}function IJ(e){let t=[],n=e=>{if(e.type&&SJ.has(e.type)){let n=e.type===`jsxComponent`?String(e.attrs?.componentName??``):``;t.push(n?`${e.type}:${n}`:e.type)}if(e.content)for(let t of e.content)n(t)};return n(e),t.sort()}function LJ(e){let t=e,n=[];for(let e of kJ){let r=PJ(t),i=e.canonicalize(t);PJ(i)!==r&&n.push(e.label),t=i}return{normalized:t,fired:n}}function RJ(e,t,n={}){let r=LJ(e),i=LJ(t),a=[...new Set([...r.fired,...i.fired])];if(!bJ(FJ(r.normalized),FJ(i.normalized)))return{equivalent:!1,level:`L1`,reason:`content-loss`,appliedDegrades:a,detail:`authored text did not survive the round-trip`};let o=IJ(r.normalized),s=IJ(i.normalized);if(PJ(o)!==PJ(s))return{equivalent:!1,level:`L1`,reason:`structural-shatter`,appliedDegrades:a,detail:`container multiset diverged: [${o.join(`, `)}] vs [${s.join(`, `)}]`};let c=jJ(r.normalized,n.ignoreAttrs),l=jJ(i.normalized,n.ignoreAttrs);return PJ(c)===PJ(l)?{equivalent:!0,level:a.length>0?`L2`:`L1`,appliedDegrades:a}:{equivalent:!1,level:`L2`,reason:`structural-divergence`,appliedDegrades:a,detail:zJ(c,l)}}function zJ(e,t,n=`doc`){let r=e,i=t;if(!r||!i)return`${n}: node presence differs`;if(r.type!==i.type)return`${n}: type ${String(r.type)} vs ${String(i.type)}`;let a=r.content??[],o=i.content??[];if(a.length!==o.length)return`${n}(${String(r.type)}): child count ${a.length} vs ${o.length}`;for(let e=0;e<a.length;e++)if(PJ(a[e])!==PJ(o[e]))return zJ(a[e],o[e],`${n}>${String(r.type)}[${e}]`);return`${n}(${String(r.type)}): attrs or marks differ`}function BJ(e,t,n){return!RJ(e,t,{ignoreAttrs:n}).equivalent}const VJ=new Set([`src`,`href`,`size`]),HJ=new Set([`WikiEmbedImage`,`WikiEmbedVideo`,`WikiEmbedAudio`,`WikiEmbedFile`]);function UJ(e){if(Array.isArray(e))return e.map(e=>UJ(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))VJ.has(n)||(t[n]=UJ(r));return t}return e}function WJ(e){return e.type===`jsxComponent`&&typeof e.attrs?.componentName==`string`&&HJ.has(e.attrs.componentName)?UJ(e):e.content?{...e,content:e.content.map(WJ)}:e}function GJ(e){if(Array.isArray(e))return e.map(e=>GJ(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))n!==`position`&&(t[n]=GJ(r));return t}return e}function KJ(e){if(e.type===`jsxComponent`)return e;if(e.content)for(let t of e.content){let e=KJ(t);if(e)return e}}function qJ(e){let t=e.cacheLimit??2048,n=new Map,r=r=>{let i=n.get(r);if(i!==void 0)return i;let a=KJ(e.parse(r)),o=a?WJ(GJ(a)):null;if(n.size>=t){let e=n.keys().next().value;e!==void 0&&n.delete(e)}return n.set(r,o),o};return{isDiverged(e){if(e.type!==`jsxComponent`||!e.attrs||e.attrs.kind===`expression`)return!1;let t=e.attrs.sourceRaw;if(typeof t!=`string`||t.length===0)return!1;let n=r(t);return n?BJ(n,WJ(GJ(e))):!1}}}function JJ(e,t){let n=Array.isArray(e.attrs.attributes)?e.attrs.attributes.filter(e=>typeof e==`object`&&!!e&&`type`in e):[],r=e.attrs.props??{},i=new Map,a=new Set;if(t)for(let e of t)e.omitOnDefault===!0&&`defaultValue`in e&&e.defaultValue!==void 0&&i.set(e.name,e.defaultValue),e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&a.add(e.name);for(let[e,t]of Object.entries(r)){let r=n.findIndex(t=>t.type===`mdxJsxAttribute`&&t.name===e);if(i.has(e)&&Object.is(i.get(e),t)){r>=0&&n.splice(r,1);continue}if(a.has(e)&&t===``){r>=0&&n.splice(r,1);continue}if(r>=0){let e=n[r];if(e.type===`mdxJsxAttribute`&&e.value!=null&&typeof e.value==`object`&&e.value.type===`mdxJsxAttributeValueExpression`&&YJ(e.value.value,t))continue}let o=XJ(e,t);r>=0?n[r]=o:n.push(o)}return n}function YJ(e,t){try{return JSON.stringify(JSON.parse(e))===JSON.stringify(t)}catch{return!1}}function XJ(e,t){if(t===!0)return{type:`mdxJsxAttribute`,name:e,value:null};if(t===!1)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}};if(t==null)return{type:`mdxJsxAttribute`,name:e,value:null};if(typeof t==`string`)return{type:`mdxJsxAttribute`,name:e,value:t};if(typeof t==`number`)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:JSON.stringify(t)}};if(typeof t==`object`){let n;try{n=JSON.stringify(t)}catch{n=String(t)}return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:n}}}return{type:`mdxJsxAttribute`,name:e,value:String(t)}}function ZJ(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:JJ(t,r),children:n.all(t),data:{}}}const QJ=/^[A-Za-z0-9]{20,}$/,$J=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function eY(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function tY(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let n=t[1]??``;return QJ.test(n)?n:null}function nY(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!eY(t.hostname))return null;let n=tY(t);if(!n)return null;let r=t.searchParams.get(`t`);return{id:n,startRaw:r&&r.length>0&&$J.test(r)?r:null}}function rY(e){return nY(e)!==null}function iY(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function aY(e){if(typeof e!=`string`||e.length===0)return!1;let t;try{t=new URL(e)}catch{return!1}return t.protocol!==`http:`&&t.protocol!==`https:`?!1:iY(t.hostname)}const oY=/^[A-Za-z0-9_-]{11}$/;function sY(e){let t=e.toLowerCase();return t===`youtube.com`||t===`www.youtube.com`||t===`m.youtube.com`||t===`music.youtube.com`||t===`youtu.be`||t===`youtube-nocookie.com`||t===`www.youtube-nocookie.com`}function cY(e){if(e.length===0)return null;if(/^[0-9]+$/.test(e)){let t=Number.parseInt(e,10);return t>0?t:null}let t=e.match(/^(?:([0-9]+)h)?(?:([0-9]+)m)?(?:([0-9]+)s?)?$/);if(!t)return null;let n=t[1]?Number.parseInt(t[1],10):0,r=t[2]?Number.parseInt(t[2],10):0,i=t[3]?Number.parseInt(t[3],10):0,a=n*3600+r*60+i;return a>0?a:null}function lY(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return oY.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return oY.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function uY(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!sY(t.hostname))return null;let n=lY(t);if(!n)return null;let r=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:n,startSeconds:r.length>0?cY(r):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}const dY=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`],defaultValue:`note`,required:!1,description:`Callout variant`},{name:`title`,type:`string`,required:!1,description:`Optional heading shown above the body`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Lightbulb`)",iconPicker:!0},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)",colorPicker:!0},{name:`collapsible`,type:`boolean`,required:!1,defaultValue:!1,advanced:!0,description:"Render as a foldable `<details>` (Obsidian `[!TYPE]+/-`)"},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,description:`When collapsible, start in the open state`,hideWhen:e=>e.collapsible!==!0},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],fY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:Lc,autoFocus:!0},{name:`alt`,type:`string`,required:!0,description:`Alt text`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Image width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Image height`},{name:`srcset`,type:`string`,required:!1,advanced:!0,description:`Responsive image candidate set (e.g. "x.png 1x, y.png 2x")`},{name:`sizes`,type:`string`,required:!1,advanced:!0,description:`Responsive image sizes hint paired with srcset`},{name:`loading`,type:`enum`,enumValues:[`eager`,`lazy`],defaultValue:`lazy`,required:!1,advanced:!0,omitOnDefault:!0,description:`Native img loading strategy (defaults to lazy)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`decoding`,type:`enum`,enumValues:[`sync`,`async`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Hint for how the browser should decode the image`},{name:`fetchpriority`,type:`enum`,enumValues:[`high`,`low`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Resource fetch priority hint`},{name:`crossorigin`,type:`enum`,enumValues:[`anonymous`,`use-credentials`],required:!1,advanced:!0,description:`CORS mode for the image fetch`},{name:`referrerpolicy`,type:`string`,required:!1,advanced:!0,description:`Referrer policy for the image fetch (HTML referrerpolicy values)`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],pY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Embedded page URL (must start with http:// or https://)`,autoFocus:!0},{name:`title`,type:`string`,required:!1,description:`Iframe title (accessible label for screen readers)`},{name:`width`,type:`string`,required:!1,advanced:!0,description:`Embed width as a CSS length (e.g. "100%", "640px")`,cssLengthInput:!0},{name:`height`,type:`string`,required:!1,advanced:!0,description:`Embed height as a CSS length (e.g. "26rem", "480px")`,cssLengthInput:!0},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],mY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:Rc,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`,hideWhen:e=>typeof e.src==`string`&&(aY(e.src)||rY(e.src))},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`poster`,type:`string`,required:!1,advanced:!0,description:`Poster image URL shown before playback`,accept:Lc,hideWhen:e=>typeof e.src==`string`&&(aY(e.src)||rY(e.src))},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Video width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Video height`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`,hideWhen:e=>typeof e.src==`string`&&rY(e.src)},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`,hideWhen:e=>typeof e.src==`string`&&(aY(e.src)||rY(e.src))},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`,hideWhen:e=>typeof e.src==`string`&&(uY(e.src)!==null||aY(e.src)||rY(e.src))},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],hY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:zc,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 audio controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the audio to preload`}],gY=[{name:`title`,type:`string`,required:!0,description:`Accordion heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the accordion renders expanded on initial load`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Rocket`)",iconPicker:!0},{name:`description`,type:`string`,required:!1,advanced:!0,description:`Optional subtitle rendered below the title inside <summary>`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#advanced-options`)"},{name:`name`,type:`string`,required:!1,advanced:!0,description:`HTML5 <details name=> group — siblings with the same name are mutually exclusive`}],_Y=[dY[0],dY[1],dY[4],dY[5],dY[6]],vY=[fY[0],fY[1],fY[7]],yY=[gY[0],gY[1],gY[4],gY[5]],bY=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],xY=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],SY=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],CY=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],wY=[{name:`label`,type:`string`,required:!0,autoFocus:!0,defaultValue:`Tab`,description:`Tab strip label — shown in the clickable pill at the top`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#tab-npm`)"}],TY=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,language:`latex`,description:`LaTeX math source (rendered with KaTeX in the browser)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#eq-pythagoras`)"},{name:`language`,type:`string`,required:!1,advanced:!0,description:"Forward-compat hint for the math source language (default `latex`). Reserved for future MathJax / Typst / AsciiMath substrates."}],EY=[TY[0]],DY=[TY[0]],OY=[{name:`chart`,type:`string`,required:!0,hidden:!0,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],kY=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],AY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],jY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:Bc,autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded PDF viewer`},{name:`anchor`,type:`string`,required:!1,advanced:!0,description:"PDF viewer parameters as a single URL-fragment string (e.g. `page=3&height=600`)"}],MY=[{name:`src`,type:`string`,required:!0,description:"Path of the source doc, extension-less (e.g. `api-spec`).",autoFocus:!0},{name:`anchor`,type:`string`,required:!0,description:"Id of the `<MirrorSource>` block within the source doc."}],NY=[{name:`id`,type:`string`,required:!0,description:"Stable id agents and authors use to reference this block from `<Mirror>` elsewhere.",autoFocus:!0},{name:`children`,type:`reactnode`,required:!0,description:`Block content this MirrorSource owns — paragraphs, callouts, code, nested JSX, anything.`}];function PY(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function FY(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function IY(e){let t=e.attrs.props,n=t?.target??``,r=typeof t?.alias==`string`&&t.alias.length>0?t.alias:null,i=typeof t?.anchor==`string`&&t.anchor.length>0?t.anchor:null,a=r??(i?`${n}#${i}`:n);return{type:`wikiLinkEmbed`,value:a,data:{target:n,anchor:i,alias:r},children:[{type:`text`,value:a}]}}const LY=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:dY,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)`,searchTerms:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`,`alert`,`admonition`,`callout`],serialize:(e,t)=>ZJ(`Callout`,e,t,dY)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:fY,icon:`Image`,category:`media`,displayName:`Image`,description:`Image with click-to-zoom and HTML-native attributes`,searchTerms:[`image`,`zoom`,`picture`,`photo`],placeholder:{label:`Add an image`},serialize:(e,t)=>ZJ(`img`,e,t,fY)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:mY,icon:`SquarePlay`,category:`media`,displayName:`Video`,description:`HTML5 video player with native controls`,searchTerms:[`video`,`media`,`player`,`mp4`,`webm`,`movie`],placeholder:{label:`Add a video`},serialize:(e,t)=>ZJ(`video`,e,t,mY)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:hY,icon:`Volume2`,category:`media`,displayName:`Audio`,description:`HTML5 audio player with native controls`,searchTerms:[`audio`,`sound`,`music`,`mp3`,`podcast`,`player`],placeholder:{label:`Add audio`},serialize:(e,t)=>ZJ(`audio`,e,t,hY)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:jY,icon:`FileText`,category:`media`,displayName:`PDF`,description:"Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)",searchTerms:[`pdf`,`document`,`embed`,`pdfjs`],placeholder:{label:`Add a PDF`},serialize:(e,t)=>ZJ(`Pdf`,e,t,jY)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:AY,icon:`Paperclip`,category:`media`,displayName:`File`,description:`Downloadable file attachment — inline row with name + size + download link`,searchTerms:[`file`,`attachment`,`download`,`document`,`zip`,`docx`,`doc`],placeholder:{label:`Add a file`},serialize:(e,t)=>ZJ(`File`,e,t,AY)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:pY,icon:`AppWindow`,category:`media`,displayName:`Embed`,description:'Inline web embed (iframe) — drop a URL, get a resizable preview pane. For YouTube / Vimeo / Loom prefer `<video src="…">` (player props, click-facade); `<Embed>` auto-rewrites watch URLs as a fallback.',searchTerms:[`embed`,`iframe`,`website`,`page`,`inline`,`frame`,`preview`],placeholder:{label:`Embed a URL`},serialize:(e,t)=>ZJ(`Embed`,e,t,pY)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:gY,icon:`ChevronRight`,category:`content`,displayName:`Accordion`,description:"Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX.",searchTerms:[`toggle`,`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],exampleBody:`Body content revealed when the accordion is expanded.`,serialize:(e,t)=>ZJ(`Accordion`,e,t,gY)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:CY,icon:`LayoutPanelTop`,category:`content`,displayName:`Tabs`,description:"Horizontal tab strip + active panel below. Each `<Tab>` child is one panel; clickable pills at the top switch the active one. Active selection is ephemeral (resets on reload).",searchTerms:[`tabs`,`tabbed`,`panels`,`tabgroup`,`switcher`],exampleBody:`<Tab label="One">Body of the first tab panel.</Tab>
|
|
369
|
-
<Tab label="Two">Body of the second tab panel.</Tab>`,serialize:(e,t)=>
|
|
370
|
-
`)}\n\n`:``}function
|
|
366
|
+
</div>`}];function nK(e){return["```html preview",e.html,"```"].join(`
|
|
367
|
+
`)}const rK=[{name:`--chart-1`,light:`oklch(0.62 0.19 259)`,dark:`oklch(0.72 0.14 259)`},{name:`--chart-2`,light:`oklch(0.58 0.14 145)`,dark:`oklch(0.73 0.13 145)`},{name:`--chart-3`,light:`oklch(0.62 0.15 70)`,dark:`oklch(0.77 0.14 70)`},{name:`--chart-4`,light:`oklch(0.55 0.18 290)`,dark:`oklch(0.72 0.16 290)`},{name:`--chart-5`,light:`oklch(0.58 0.21 25)`,dark:`oklch(0.72 0.2 25)`},{name:`--primary`,light:`oklch(0.6321 0.1983 259.59)`,dark:`#69a3ff`},{name:`--primary-foreground`,light:`oklch(0.985 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--background`,light:`oklch(1 0 0)`,dark:`oklch(0.145 0 0)`},{name:`--card`,light:`oklch(1 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--card-foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--muted-foreground`,light:`oklch(0.556 0 0)`,dark:`oklch(0.708 0 0)`},{name:`--border`,light:`oklch(0.922 0 0)`,dark:`oklch(1 0 0 / 10%)`},{name:`--destructive`,light:`oklch(0.577 0.245 27.325)`,dark:`oklch(0.704 0.191 22.216)`},{name:`--radius`,light:`0.625rem`,dark:`0.625rem`}],iK=`127.0.0.1`,aK=oS.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`},sourceClosingFenceLength:{default:null,rendered:!1},sourceFenceIndent:{default:null,rendered:!1},sourceInfoPadding:{default:null,rendered:!1},sourceIndents:{default:null,rendered:!1}}}}),oK=yS.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[Lx({find:mS,type:this.type,getAttributes:{sourceDelimiter:`*`}}),Lx({find:gS,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),sK=pS.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[Lx({find:cS,type:this.type,getAttributes:{sourceDelimiter:`**`}}),Lx({find:uS,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),cK=gx.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),lK=eS.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":n,id:`fn-${n}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${n}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}}),uK=eS.create({name:`footnoteReference`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){return[{tag:`sup[data-footnote-ref]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}}}]},renderHTML({node:e}){let t=String(e.attrs.identifier??``);return[`sup`,{id:`fnref-${t}`,"data-footnote-ref":``,"data-footnote-id":t,class:`footnote-ref`},[`a`,{href:`#fn-${t}`,class:`footnote-ref-link`},`[${t}]`]]},addCommands(){return{insertFootnoteReference:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e}})}}}),dK=/^---[ \t]*\r?\n([\s\S]*?\r?\n)?---[ \t]*(\r?\n|$)/;function fK(e){let t=e.match(dK);return t?{frontmatter:t[0],body:e.slice(t[0].length)}:{frontmatter:``,body:e}}function pK(e,t){return e?e+t:t}function mK(e){if(e===``)return``;let t=e.match(dK);return t?(t[1]??``).replace(/\r?\n$/,``):e}const hK=xS.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`},sourceRaw:{default:null}}}}),gK=CS.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1},sourceLeadingIndent:{default:null,rendered:!1},sourceInteriorSpacing:{default:null,rendered:!1}}}}),_K=eS.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}});function vK(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}const yK=TS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=sb(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=vK(t.src)),[`img`,t]}}),bK=eS.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),xK=eS.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,addAttributes(){return{}},parseHTML(){return[{tag:`span[data-jsx-inline]`}]},renderHTML(){return[`span`,{"data-jsx-inline":``},0]}}),SK=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],CK=SK.map(e=>`${e}:`).join(`|`);RegExp(`^(?:${CK}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function wK(e){let t=e.trim();if(t===``)return!0;let n=t.indexOf(`:`);if(n===-1)return!0;let r=t.indexOf(`/`),i=t.indexOf(`?`),a=t.indexOf(`#`);return n>Math.min(r===-1?1/0:r,i===-1?1/0:i,a===-1?1/0:a)}const TK=new Set(SK.map(e=>`${e}:`));function EK(e){try{let t=new URL(e,`https://placeholder.invalid`);return TK.has(t.protocol.toLowerCase())}catch{return!1}}const DK=LS.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:EK,validate:EK,shouldAutoLink:()=>!0}},addAttributes(){return{...this.parent?.(),linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1},sourceUrlForm:{default:null,rendered:!1},sourceTitleMarker:{default:null,rendered:!1}}}}),OK=eS.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs,i=r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},i]}});function kK(e){return e.type.name===`list`&&!e.attrs.ordered}function AK(e){return e.type.name===`list`&&!!e.attrs.ordered}function jK(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function MK(e,t,n,r,i,a,o){let s=Zy(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?Jp(r)(e,t):!1}if(s){if(!t)return!0;let{tr:n}=e;return n.setNodeMarkup(s.pos,void 0,{...s.node.attrs,...a}),o!==void 0&&s.node.forEach((e,t)=>{if(e.type.name===`listItem`){let r=s.pos+1+t;n.setNodeMarkup(r,void 0,{...e.attrs,...o})}}),t(n),!0}return Gp(n,a)(e,void 0)?t?Gp(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!0:!1}const NK=eS.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.ordered?`ol`:`ul`,r={};return e.attrs.ordered&&e.attrs.start!==1&&(r.start=e.attrs.start),[n,sb(t,r),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:MK(e,t,n,r,e=>kK(e)&&!jK(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:MK(e,t,n,r,e=>AK(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:MK(e,t,n,r,e=>kK(e)&&jK(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[Bx({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]}),joinPredicate:(e,t)=>t.attrs.ordered===!1}),Bx({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]}),joinPredicate:(e,t)=>t.attrs.ordered===!0}),new cx({find:/^\s*[-*+]\s\[([ xX])\]\s$/,handler:({state:e,range:t,match:n})=>{let r=e.schema.nodes.list;if(!r)return null;let i=n[1]!==` `,a=e.tr.delete(t.from,t.to),o=a.doc.resolve(t.from).blockRange();if(!o)return null;let s=sf(o,r,{ordered:!1});if(!s)return null;a.wrap(o,s);let c=a.doc.resolve(a.mapping.map(t.from));for(let e=c.depth;e>0;e--){let t=c.node(e);if(t.type.name===`listItem`){a.setNodeMarkup(c.before(e),void 0,{...t.attrs,checked:i});break}}}})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),PK=eS.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1},sourceMarkerSpacing:{default:null,rendered:!1},sourceOrdinal:{default:null,rendered:!1},sourceCheckboxChar:{default:null,rendered:!1},sourceContinuationIndent:{default:null,rendered:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,sb(t),0]:[`li`,sb(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:n,HTMLAttributes:r})=>{let i=document.createElement(`li`);Object.entries(sb(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`),c=()=>{o&&(o.disabled=!n.isEditable)};return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,c(),n.on(`update`,c),o.addEventListener(`change`,()=>{let r=t();r===void 0||typeof r!=`number`||n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,o.disabled=!n.isEditable,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)},destroy(){n.off(`update`,c)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),FK=NK,IK=PK,LK=eS.create({name:`mathInline`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`},sourceDelimiter:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e==`string`?!1:{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),RK=eS.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){let e=e=>typeof e==`string`?!1:{reason:e.getAttribute(`data-reason`)||``};return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e},{tag:`pre[data-raw-mdx-fallback]`,getAttrs:e}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let n=document.createElement(`pre`);return n.classList.add(`raw-mdx-fallback-content`),n.setAttribute(`contenteditable`,`false`),t.appendChild(n),{dom:t,contentDOM:n,ignoreMutation:()=>!0}}}}),zK=Jw.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),BK=Qw.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1},sourcePadded:{default:!1,rendered:!1}}}}),VK=eS.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,style:`display: none;`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),HK=gx.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,style:`display: none;`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),UK=Tx.create({name:`docFidelity`,addGlobalAttributes(){return[{types:[`doc`],attributes:{sourceDocBoundary:{default:null,rendered:!1}}}]}}),WK=eS.create({name:`imageReference`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{alt:{default:``},label:{default:``},identifier:{default:``},referenceType:{default:`shortcut`}}},parseHTML(){return[{tag:`img[data-image-reference]`}]},renderHTML({node:e}){let{alt:t,label:n,referenceType:r}=e.attrs,i=t||n;return[`img`,{"data-image-reference":``,"data-reference-type":r,"data-label":n,alt:i}]}});function GK(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return t;return null}function KK(e){let t=!1;return e.descendants(e=>t?!1:(e.type.name===`list`&&(t=!0),!t)),t}function qK(e){let{selection:t}=e;return t instanceof B?t.$cursor:null}function JK(e){let t=qK(e);if(!t||t.parentOffset!==0)return!1;let n=GK(t);if(n===null||t.depth!==n+1||t.index(n)!==0)return!1;let r=t.index(n-1);return r===0?!1:KK(t.node(n-1).child(r-1))}function YK(e,t){for(let n=t-1;n>=0;n--){let t=e.node(n),r=e.index(n);if(r<t.childCount-1){let e=t.child(r+1),i=n+1;for(;e.type.name===`list`&&e.firstChild;)e=e.firstChild,i+=1;return e.type.name===`listItem`?i:null}}return null}function XK(e){let t=qK(e);if(!t||t.parentOffset!==t.parent.content.size)return!1;let n=GK(t);if(n===null)return!1;for(let e=t.depth;e>n;e--)if(t.index(e-1)!==t.node(e-1).childCount-1)return!1;let r=YK(t,n);return r!==null&&r<n}const ZK=Tx.create({name:`listBoundaryMerge`,addKeyboardShortcuts(){let e=()=>{let{editor:e}=this;if(!JK(e.state))return!1;if(e.commands.undoInputRule())return!0;let{state:t,view:n}=e;return dp(t,n.dispatch,n)},t=()=>{let{editor:e}=this;if(!XK(e.state))return!1;let{state:t,view:n}=e;return fp(t,n.dispatch,n)};return{Backspace:e,"Mod-Backspace":e,Delete:t,"Mod-Delete":t}}}),QK=new Map([[32,` `],[9,` `]]);function $K(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function eq(e){let t=$K(e);return t!==null&&QK.has(t)}function tq(e){let t=$K(e);return t===null?null:QK.get(t)??null}const nq=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function rq(e){nq.lastIndex=0;let t=e.match(nq);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=tq(e);if(t===null)return null;n+=t}return n}const iq=gx.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function aq(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r||oq(n)===r?!0:rq(n)===r}function oq(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const sq=RT.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),cq=Gw.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),lq=Aw.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),uq=jw.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),dq=eS.create({name:`tag`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),fq=/^(?:---|—-|___\s|\*\*\*\s)$/;function pq(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const mq=tT.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[Rx({find:fq,type:this.type,getAttributes:e=>({sourceRaw:pq(e)})})]}});function hq(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function gq(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const _q=eS.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:hq(e.getAttribute(`data-alias`)),anchor:hq(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:hq(e.getAttribute(`data-alias`)),anchor:hq(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=hq(e.attrs.alias),i=hq(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},gq({target:n,alias:r,anchor:i})]}});function vq(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function yq(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const bq=[bK,RK,xK,LK,_q,eS.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:hq(e.getAttribute(`data-alias`)),anchor:hq(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=hq(e.attrs.alias),i=hq(e.attrs.anchor),a=hq(e.attrs.resolvedSrc),o=vq(n);if(Vc.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},yq({target:n,alias:r,anchor:i})]}}),dq,FK,IK,oK,sK,sq,BK,aK,zK,gK,mq,DK,_K,OK,hK,cK,UK,iq,AE.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,listKeymap:{listTypes:[{itemName:`listItem`,wrapperNames:[`list`]}]},italic:!1,bold:!1,strike:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),ZK,cq.configure({resizable:!0}),Mw,uq,lq,yK.configure({inline:!0}),WK,BS,HK,VK,uK,lK];3072-xq("This is an OpenKnowledge project: load the `open-knowledge` skill and use the OpenKnowledge MCP tools for all markdown — don't probe for `.ok/` or use native file tools on `.md` / `.mdx`. ",`cursor`);function xq(e,t){let n=encodeURIComponent(e);return t===`cursor`?encodeURIComponent(n).length:n.length}function Sq(e){return`'${e.replace(/'/g,`'\\''`)}'`}`${eK}`,[`delete`,`move`,`share_link`,`install`].map(e=>`mcp__${eK}__${e}`),`${Sq(`mcp_servers.${eK}.default_tools_approval_mode="approve"`)}`;function Cq(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}const wq=new Set([`opencode.json`]);function Tq(e){return e.split(`/`).some(e=>e.startsWith(`.`))?!0:wq.has(e.slice(e.lastIndexOf(`/`)+1))}function Eq(e,t){let n=Cq(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const Dq=A().superRefine(Eq).optional(),Oq={agentId:A().optional(),agentName:A().optional(),colorSeed:A().optional(),clientName:A().optional(),clientVersion:A().optional(),label:A().optional()},kq=A().optional(),Aq=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,jq=tc(`kind`,[P({kind:I(`doc`),docPath:A().min(1)}).loose(),P({kind:I(`folder`),folderPath:A()}).loose()]),Mq=F([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`]),Nq=F([`current`,`stale`,`absent`]),Pq=tc(`ok`,[P({ok:I(!0),shareUrl:A().min(1),sharedUrl:A().min(1),branch:A().min(1),freshness:Nq.optional().catch(void 0)}).loose(),P({ok:I(!1),error:Mq,branch:A().min(1).optional()}).loose()]),Fq=F([`user`,`org`]),Iq=P({login:A().min(1),kind:Fq,avatarUrl:A().optional()}).loose(),Lq=F([`auth-required`,`network`]),Rq=tc(`ok`,[P({ok:I(!0),owners:N(Iq)}).loose(),P({ok:I(!1),error:Lq}).loose()]),zq=tc(`ok`,[P({ok:I(!0),available:M()}).loose(),P({ok:I(!1),error:Lq}).loose()]),Bq=F([`public`,`private`]),Vq=P({owner:A().min(1),name:A().min(1),visibility:Bq,description:A().optional()}).loose(),Hq=F([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),Uq=tc(`ok`,[P({ok:I(!0),ownerLogin:A().min(1),repoName:A().min(1),cloneUrl:A().min(1),defaultBranch:A().min(1)}).loose(),P({ok:I(!1),error:Hq}).loose()]);function Wq(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const Gq=e=>e.refine(Wq,`invalid branch name`);function Kq(e){if(e==null)return!1;let t=e instanceof Error?e.message:String(e);return/couldn'?t find remote ref|Remote branch .+ not found/i.test(t)}const qq=[/could not read (username|password)/i,/terminal prompts disabled/i],Jq=[/insufficient scopes/i,/missing.*scope/i,/required scope/i],Yq=[/permission denied.*\(publickey\)/i,/host key verification failed/i],Xq=[/\b(401|403)\b/,/authentication failed/i,/authorization failed/i,/invalid credentials/i,/credential helper/i,/bad credentials/i,/token.*expired/i,/expired.*token/i,/fatal:.*repository.*not found/i];function Zq(e){if(typeof e!=`object`||!e)return``;let t=e.git;return t==null?``:String(t)}function Qq(e){if(e==null)return{kind:`non-auth`};let t=`${e instanceof Error?e.message:String(e)}\n${Zq(e)}`;return qq.some(e=>e.test(t))?{kind:`auth`,subclass:`no-credential`}:Jq.some(e=>e.test(t))?{kind:`auth`,subclass:`scope-mismatch`}:Yq.some(e=>e.test(t))?{kind:`auth`,subclass:`ssh-auth`}:Xq.some(e=>e.test(t))?/\b401\b/.test(t)||/token.*expired/i.test(t)?{kind:`auth`,subclass:`401`}:/\b403\b/.test(t)?{kind:`auth`,subclass:`403`}:{kind:`auth`,subclass:`unknown-auth`}:{kind:`non-auth`}}function $q(e){return e.kind===`auth`?e.subclass===`no-credential`||e.subclass===`401`||e.subclass===`unknown-auth`:!1}const eJ={shareTargetExists:M(),dirtyConflicts:P({conflicts:M(),files:N(A().min(1))}).loose(),branchIsLocal:M(),shareTargetOnOriginBranch:M().optional()},tJ=tc(`detached`,[P({detached:I(!1),currentBranch:A().min(1).nullable(),currentHeadSha:Hs(),...eJ}).loose(),P({detached:I(!0),currentBranch:Hs(),currentHeadSha:A().min(1),...eJ}).loose()]),nJ=P({branch:Gq(A().min(1)),principalId:A().optional(),fastForward:M().optional()}).loose(),rJ=F([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]),iJ=tc(`ok`,[P({ok:I(!0)}).loose(),P({ok:I(!1),reason:rJ,files:N(A().min(1)).optional(),otherWorktreePath:A().min(1).optional()}).loose()]);F([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]);const aJ=P({branch:Gq(A().min(1)),path:A(),kind:F([`doc`,`folder`])}).loose(),oJ=tc(`verdict`,[P({verdict:I(`on-origin`)}).loose(),P({verdict:I(`renamed`),renamedTo:A().min(1)}).loose(),P({verdict:I(`deleted`)}).loose(),P({verdict:I(`never-on-branch`)}).loose(),P({verdict:I(`changed-locally`)}).loose(),P({verdict:I(`unknown`)}).loose()]).catch({verdict:`unknown`}),sJ=P({startedAt:A().min(1),httpListenMs:j().nonnegative().optional(),seedWalkMs:j().nonnegative().optional(),indexesMs:j().nonnegative().optional(),readyMs:j().nonnegative().optional(),fileCount:j().nonnegative().optional()}),cJ=P({serverInstanceId:A().min(1),currentBranch:A().min(1).optional(),currentDiskAckSVs:ac(A().min(1),A().min(1)).optional(),boot:sJ.optional()}).loose(),lJ=P({id:A().min(1),display_name:A().min(1),display_email:A(),source:F([`git-config`,`synthesized`]),created_at:A().min(1)}).loose(),uJ=P({collabUrl:A().nullable(),previewUrl:A().nullable(),port:j(),singleFile:M().default(!1)}).loose(),dJ=F(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:no-conflict-tracked.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed`.split(`.`));function fJ(e){throw Error(`Unexpected ProblemType variant: ${JSON.stringify(e)}`)}const pJ=P({type:dJ,title:A().min(1),status:j().int().min(400).max(599),instance:A().regex(Aq,`instance must be urn:uuid:<uuid>`).optional(),detail:A().optional()}).loose(),mJ=P({parentDocName:A().min(1),placement:F([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:A().min(1).optional(),agentName:A().min(1).optional()}).loose(),hJ=P({src:A().min(1),path:A().min(1).optional(),deduped:M().optional()}).loose(),gJ=P({url:A().min(1),dir:A().min(1),branch:A().min(1).refine(Wq,`invalid branch name`).optional()}).loose(),_J=P({type:I(`error`),problem:pJ}).loose();function vJ(e){let t=[],n=0,r=()=>{t.length>0&&(n+=1)},i=e=>{for(;n>0;)t.push({type:`break`}),--n;t.push(e)},a=e=>{e.split(`
|
|
368
|
+
`).forEach((e,t)=>{t>0&&r(),e.length>0&&i({type:`text`,value:e})})},o=e=>{let t=e.ordered===!0,n=typeof e.start==`number`?e.start:1,a=e.data,o=typeof a?.bulletMarker==`string`?a.bulletMarker:`-`,c=typeof a?.listMarkerDelimiter==`string`?a.listMarkerDelimiter:`.`;e.children.forEach((e,a)=>{a>0&&r(),i({type:`text`,value:t?`${n+a}${c} `:`${o} `}),e.children.forEach((e,t)=>{t>0&&r(),s(e)})})},s=e=>{switch(e.type){case`paragraph`:case`heading`:e.children.forEach(i);return;case`list`:o(e);return;case`code`:case`html`:a(e.value);return;case`thematicBreak`:i({type:`text`,value:e.data?.sourceRaw??`---`});return;default:{let t=e;if(Array.isArray(t.children)&&t.children.length>0){t.children.forEach((e,t)=>{t>0&&r(),s(e)});return}let n=e;if(typeof n.value==`string`){a(n.value);return}console.warn(JSON.stringify({event:`table-cell-flatten-dropped-block`,nodeType:e.type}))}}};return e.forEach((e,t)=>{t>0&&r(),s(e)}),t}function yJ(e,t){let n=0;for(let r=0;r<t.length&&n<e.length;r++)e[n]===t[r]&&n++;return n===e.length}const bJ=new Set([`sourceRaw`,`sourceDirty`,`position`]),xJ=new Set([`jsxComponent`,`table`,`tableRow`,`tableCell`,`tableHeader`,`list`,`listItem`,`blockquote`,`codeBlock`,`heading`]),SJ={type:`__br__`},CJ=/^<br\s*\/?>$/i;function wJ(e){let t=kJ(e,wJ);return(t.type===`tableCell`||t.type===`tableHeader`)&&t.content?{...t,content:TJ(t.content)}:t}function TJ(e){let t=[];for(let n of e){let e=EJ(n);e.length!==0&&(t.length>0&&t.push(SJ),t.push(...e))}return t}function EJ(e){return e.text!==void 0||e.type===`hardBreak`||e.type===`jsxInline`?[e]:!e.content||e.content.length===0?[]:e.content.some(e=>e.text===void 0&&e.type!==`hardBreak`&&e.type!==`jsxInline`&&!!e.content)?TJ(e.content):e.content}function DJ(e){return e.type===`hardBreak`||e.type===SJ.type||e.text!==void 0&&CJ.test(e.text.trim())?SJ:kJ(e,DJ)}const OJ=[{label:`table-cell-block-flatten`,severity:`pm-model-caused`,rationale:`GFM table cells have no block spelling; a block placed in a cell is flattened to inline on serialize, so a cell-with-blocks and a cell-with-inline describe the same persisted document.`,proofPointer:`markdown/table-cell-flatten.ts flattenCellBlocks (table-cell-flatten-dropped-block event)`,canonicalize:wJ},{label:`void-hardbreak-br`,severity:`serializer-caused`,rationale:`A void hardBreak inside a table cell or heading serializes to a literal <br /> that a fresh parse keeps as text; the node form and the literal form are the same break.`,proofPointer:`markdown/void-br-promoter.ts + markdown/to-markdown-handlers.ts break handler`,canonicalize:DJ}];function kJ(e,t){return e.content?{...e,content:e.content.map(t)}:e}function AJ(e,t){let n={};e.type!==void 0&&(n.type=e.type),e.text!==void 0&&(n.text=e.text);let r=jJ(e.attrs,t);return r&&(n.attrs=r),e.marks&&e.marks.length>0&&(n.marks=[...e.marks].map(e=>({type:e.type,attrs:jJ(e.attrs,t)})).sort((e,t)=>NJ(e).localeCompare(NJ(t)))),e.content&&e.content.length>0&&(n.content=e.content.map(e=>AJ(e,t))),n}function jJ(e,t){if(!e)return null;let n={};for(let r of Object.keys(e).sort()){if(bJ.has(r)||t?.(r))continue;let i=e[r];i!=null&&(n[r]=t?MJ(i,t):i)}return Object.keys(n).length>0?n:null}function MJ(e,t){if(Array.isArray(e))return e.map(e=>MJ(e,t));if(e&&typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))t(r)||(n[r]=MJ(i,t));return n}return e}function NJ(e){return JSON.stringify(e,(e,t)=>{if(t&&typeof t==`object`&&!Array.isArray(t)){let e={};for(let n of Object.keys(t).sort())e[n]=t[n];return e}return t})}function PJ(e){let t=``,n=e=>{if(e.text!==void 0&&(t+=e.text),e.content)for(let t of e.content)n(t)};return n(e),t.replace(/\s+/g,``)}function FJ(e){let t=[],n=e=>{if(e.type&&xJ.has(e.type)){let n=e.type===`jsxComponent`?String(e.attrs?.componentName??``):``;t.push(n?`${e.type}:${n}`:e.type)}if(e.content)for(let t of e.content)n(t)};return n(e),t.sort()}function IJ(e){let t=e,n=[];for(let e of OJ){let r=NJ(t),i=e.canonicalize(t);NJ(i)!==r&&n.push(e.label),t=i}return{normalized:t,fired:n}}function LJ(e,t,n={}){let r=IJ(e),i=IJ(t),a=[...new Set([...r.fired,...i.fired])];if(!yJ(PJ(r.normalized),PJ(i.normalized)))return{equivalent:!1,level:`L1`,reason:`content-loss`,appliedDegrades:a,detail:`authored text did not survive the round-trip`};let o=FJ(r.normalized),s=FJ(i.normalized);if(NJ(o)!==NJ(s))return{equivalent:!1,level:`L1`,reason:`structural-shatter`,appliedDegrades:a,detail:`container multiset diverged: [${o.join(`, `)}] vs [${s.join(`, `)}]`};let c=AJ(r.normalized,n.ignoreAttrs),l=AJ(i.normalized,n.ignoreAttrs);return NJ(c)===NJ(l)?{equivalent:!0,level:a.length>0?`L2`:`L1`,appliedDegrades:a}:{equivalent:!1,level:`L2`,reason:`structural-divergence`,appliedDegrades:a,detail:RJ(c,l)}}function RJ(e,t,n=`doc`){let r=e,i=t;if(!r||!i)return`${n}: node presence differs`;if(r.type!==i.type)return`${n}: type ${String(r.type)} vs ${String(i.type)}`;let a=r.content??[],o=i.content??[];if(a.length!==o.length)return`${n}(${String(r.type)}): child count ${a.length} vs ${o.length}`;for(let e=0;e<a.length;e++)if(NJ(a[e])!==NJ(o[e]))return RJ(a[e],o[e],`${n}>${String(r.type)}[${e}]`);return`${n}(${String(r.type)}): attrs or marks differ`}function zJ(e,t,n){return!LJ(e,t,{ignoreAttrs:n}).equivalent}const BJ=new Set([`src`,`href`,`size`]),VJ=new Set([`WikiEmbedImage`,`WikiEmbedVideo`,`WikiEmbedAudio`,`WikiEmbedFile`]);function HJ(e){if(Array.isArray(e))return e.map(e=>HJ(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))BJ.has(n)||(t[n]=HJ(r));return t}return e}function UJ(e){return e.type===`jsxComponent`&&typeof e.attrs?.componentName==`string`&&VJ.has(e.attrs.componentName)?HJ(e):e.content?{...e,content:e.content.map(UJ)}:e}function WJ(e){if(Array.isArray(e))return e.map(e=>WJ(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))n!==`position`&&(t[n]=WJ(r));return t}return e}function GJ(e){if(e.type===`jsxComponent`)return e;if(e.content)for(let t of e.content){let e=GJ(t);if(e)return e}}function KJ(e){let t=e.cacheLimit??2048,n=new Map,r=r=>{let i=n.get(r);if(i!==void 0)return i;let a=GJ(e.parse(r)),o=a?UJ(WJ(a)):null;if(n.size>=t){let e=n.keys().next().value;e!==void 0&&n.delete(e)}return n.set(r,o),o};return{isDiverged(e){if(e.type!==`jsxComponent`||!e.attrs||e.attrs.kind===`expression`)return!1;let t=e.attrs.sourceRaw;if(typeof t!=`string`||t.length===0)return!1;let n=r(t);return n?zJ(n,UJ(WJ(e))):!1}}}function qJ(e,t){let n=Array.isArray(e.attrs.attributes)?e.attrs.attributes.filter(e=>typeof e==`object`&&!!e&&`type`in e):[],r=e.attrs.props??{},i=new Map,a=new Set;if(t)for(let e of t)e.omitOnDefault===!0&&`defaultValue`in e&&e.defaultValue!==void 0&&i.set(e.name,e.defaultValue),e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&a.add(e.name);for(let[e,t]of Object.entries(r)){let r=n.findIndex(t=>t.type===`mdxJsxAttribute`&&t.name===e);if(i.has(e)&&Object.is(i.get(e),t)){r>=0&&n.splice(r,1);continue}if(a.has(e)&&t===``){r>=0&&n.splice(r,1);continue}if(r>=0){let e=n[r];if(e.type===`mdxJsxAttribute`&&e.value!=null&&typeof e.value==`object`&&e.value.type===`mdxJsxAttributeValueExpression`&&JJ(e.value.value,t))continue}let o=YJ(e,t);r>=0?n[r]=o:n.push(o)}return n}function JJ(e,t){try{return JSON.stringify(JSON.parse(e))===JSON.stringify(t)}catch{return!1}}function YJ(e,t){if(t===!0)return{type:`mdxJsxAttribute`,name:e,value:null};if(t===!1)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}};if(t==null)return{type:`mdxJsxAttribute`,name:e,value:null};if(typeof t==`string`)return{type:`mdxJsxAttribute`,name:e,value:t};if(typeof t==`number`)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:JSON.stringify(t)}};if(typeof t==`object`){let n;try{n=JSON.stringify(t)}catch{n=String(t)}return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:n}}}return{type:`mdxJsxAttribute`,name:e,value:String(t)}}function XJ(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:qJ(t,r),children:n.all(t),data:{}}}const ZJ=/^[A-Za-z0-9]{20,}$/,QJ=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function $J(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function eY(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let n=t[1]??``;return ZJ.test(n)?n:null}function tY(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!$J(t.hostname))return null;let n=eY(t);if(!n)return null;let r=t.searchParams.get(`t`);return{id:n,startRaw:r&&r.length>0&&QJ.test(r)?r:null}}function nY(e){return tY(e)!==null}function rY(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function iY(e){if(typeof e!=`string`||e.length===0)return!1;let t;try{t=new URL(e)}catch{return!1}return t.protocol!==`http:`&&t.protocol!==`https:`?!1:rY(t.hostname)}const aY=/^[A-Za-z0-9_-]{11}$/;function oY(e){let t=e.toLowerCase();return t===`youtube.com`||t===`www.youtube.com`||t===`m.youtube.com`||t===`music.youtube.com`||t===`youtu.be`||t===`youtube-nocookie.com`||t===`www.youtube-nocookie.com`}function sY(e){if(e.length===0)return null;if(/^[0-9]+$/.test(e)){let t=Number.parseInt(e,10);return t>0?t:null}let t=e.match(/^(?:([0-9]+)h)?(?:([0-9]+)m)?(?:([0-9]+)s?)?$/);if(!t)return null;let n=t[1]?Number.parseInt(t[1],10):0,r=t[2]?Number.parseInt(t[2],10):0,i=t[3]?Number.parseInt(t[3],10):0,a=n*3600+r*60+i;return a>0?a:null}function cY(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return aY.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return aY.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function lY(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!oY(t.hostname))return null;let n=cY(t);if(!n)return null;let r=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:n,startSeconds:r.length>0?sY(r):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}const uY=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`],defaultValue:`note`,required:!1,description:`Callout variant`},{name:`title`,type:`string`,required:!1,description:`Optional heading shown above the body`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Lightbulb`)",iconPicker:!0},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)",colorPicker:!0},{name:`collapsible`,type:`boolean`,required:!1,defaultValue:!1,advanced:!0,description:"Render as a foldable `<details>` (Obsidian `[!TYPE]+/-`)"},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,description:`When collapsible, start in the open state`,hideWhen:e=>e.collapsible!==!0},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],dY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:Lc,autoFocus:!0},{name:`alt`,type:`string`,required:!0,description:`Alt text`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Image width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Image height`},{name:`srcset`,type:`string`,required:!1,advanced:!0,description:`Responsive image candidate set (e.g. "x.png 1x, y.png 2x")`},{name:`sizes`,type:`string`,required:!1,advanced:!0,description:`Responsive image sizes hint paired with srcset`},{name:`loading`,type:`enum`,enumValues:[`eager`,`lazy`],defaultValue:`lazy`,required:!1,advanced:!0,omitOnDefault:!0,description:`Native img loading strategy (defaults to lazy)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`decoding`,type:`enum`,enumValues:[`sync`,`async`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Hint for how the browser should decode the image`},{name:`fetchpriority`,type:`enum`,enumValues:[`high`,`low`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Resource fetch priority hint`},{name:`crossorigin`,type:`enum`,enumValues:[`anonymous`,`use-credentials`],required:!1,advanced:!0,description:`CORS mode for the image fetch`},{name:`referrerpolicy`,type:`string`,required:!1,advanced:!0,description:`Referrer policy for the image fetch (HTML referrerpolicy values)`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],fY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Embedded page URL (must start with http:// or https://)`,autoFocus:!0},{name:`title`,type:`string`,required:!1,description:`Iframe title (accessible label for screen readers)`},{name:`width`,type:`string`,required:!1,advanced:!0,description:`Embed width as a CSS length (e.g. "100%", "640px")`,cssLengthInput:!0},{name:`height`,type:`string`,required:!1,advanced:!0,description:`Embed height as a CSS length (e.g. "26rem", "480px")`,cssLengthInput:!0},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],pY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:Rc,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`,hideWhen:e=>typeof e.src==`string`&&(iY(e.src)||nY(e.src))},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`poster`,type:`string`,required:!1,advanced:!0,description:`Poster image URL shown before playback`,accept:Lc,hideWhen:e=>typeof e.src==`string`&&(iY(e.src)||nY(e.src))},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Video width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Video height`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`,hideWhen:e=>typeof e.src==`string`&&nY(e.src)},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`,hideWhen:e=>typeof e.src==`string`&&(iY(e.src)||nY(e.src))},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`,hideWhen:e=>typeof e.src==`string`&&(lY(e.src)!==null||iY(e.src)||nY(e.src))},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],mY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:zc,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 audio controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the audio to preload`}],hY=[{name:`title`,type:`string`,required:!0,description:`Accordion heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the accordion renders expanded on initial load`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Rocket`)",iconPicker:!0},{name:`description`,type:`string`,required:!1,advanced:!0,description:`Optional subtitle rendered below the title inside <summary>`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#advanced-options`)"},{name:`name`,type:`string`,required:!1,advanced:!0,description:`HTML5 <details name=> group — siblings with the same name are mutually exclusive`}],gY=[uY[0],uY[1],uY[4],uY[5],uY[6]],_Y=[dY[0],dY[1],dY[7]],vY=[hY[0],hY[1],hY[4],hY[5]],yY=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],bY=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],xY=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],SY=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],CY=[{name:`label`,type:`string`,required:!0,autoFocus:!0,defaultValue:`Tab`,description:`Tab strip label — shown in the clickable pill at the top`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#tab-npm`)"}],wY=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,language:`latex`,description:`LaTeX math source (rendered with KaTeX in the browser)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#eq-pythagoras`)"},{name:`language`,type:`string`,required:!1,advanced:!0,description:"Forward-compat hint for the math source language (default `latex`). Reserved for future MathJax / Typst / AsciiMath substrates."}],TY=[wY[0]],EY=[wY[0]],DY=[{name:`chart`,type:`string`,required:!0,hidden:!0,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],OY=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],kY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],AY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:Bc,autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded PDF viewer`},{name:`anchor`,type:`string`,required:!1,advanced:!0,description:"PDF viewer parameters as a single URL-fragment string (e.g. `page=3&height=600`)"}],jY=[{name:`src`,type:`string`,required:!0,description:"Path of the source doc, extension-less (e.g. `api-spec`).",autoFocus:!0},{name:`anchor`,type:`string`,required:!0,description:"Id of the `<MirrorSource>` block within the source doc."}],MY=[{name:`id`,type:`string`,required:!0,description:"Stable id agents and authors use to reference this block from `<Mirror>` elsewhere.",autoFocus:!0},{name:`children`,type:`reactnode`,required:!0,description:`Block content this MirrorSource owns — paragraphs, callouts, code, nested JSX, anything.`}];function NY(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function PY(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function FY(e){let t=e.attrs.props,n=t?.target??``,r=typeof t?.alias==`string`&&t.alias.length>0?t.alias:null,i=typeof t?.anchor==`string`&&t.anchor.length>0?t.anchor:null,a=r??(i?`${n}#${i}`:n);return{type:`wikiLinkEmbed`,value:a,data:{target:n,anchor:i,alias:r},children:[{type:`text`,value:a}]}}const IY=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:uY,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)`,searchTerms:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`,`alert`,`admonition`,`callout`],serialize:(e,t)=>XJ(`Callout`,e,t,uY)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:dY,icon:`Image`,category:`media`,displayName:`Image`,description:`Image with click-to-zoom and HTML-native attributes`,searchTerms:[`image`,`zoom`,`picture`,`photo`],placeholder:{label:`Add an image`},serialize:(e,t)=>XJ(`img`,e,t,dY)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:pY,icon:`SquarePlay`,category:`media`,displayName:`Video`,description:`HTML5 video player with native controls`,searchTerms:[`video`,`media`,`player`,`mp4`,`webm`,`movie`],placeholder:{label:`Add a video`},serialize:(e,t)=>XJ(`video`,e,t,pY)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:mY,icon:`Volume2`,category:`media`,displayName:`Audio`,description:`HTML5 audio player with native controls`,searchTerms:[`audio`,`sound`,`music`,`mp3`,`podcast`,`player`],placeholder:{label:`Add audio`},serialize:(e,t)=>XJ(`audio`,e,t,mY)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:AY,icon:`FileText`,category:`media`,displayName:`PDF`,description:"Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)",searchTerms:[`pdf`,`document`,`embed`,`pdfjs`],placeholder:{label:`Add a PDF`},serialize:(e,t)=>XJ(`Pdf`,e,t,AY)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:kY,icon:`Paperclip`,category:`media`,displayName:`File`,description:`Downloadable file attachment — inline row with name + size + download link`,searchTerms:[`file`,`attachment`,`download`,`document`,`zip`,`docx`,`doc`],placeholder:{label:`Add a file`},serialize:(e,t)=>XJ(`File`,e,t,kY)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:fY,icon:`AppWindow`,category:`media`,displayName:`Embed`,description:'Inline web embed (iframe) — drop a URL, get a resizable preview pane. For YouTube / Vimeo / Loom prefer `<video src="…">` (player props, click-facade); `<Embed>` auto-rewrites watch URLs as a fallback.',searchTerms:[`embed`,`iframe`,`website`,`page`,`inline`,`frame`,`preview`],placeholder:{label:`Embed a URL`},serialize:(e,t)=>XJ(`Embed`,e,t,fY)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:hY,icon:`ChevronRight`,category:`content`,displayName:`Accordion`,description:"Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX.",searchTerms:[`toggle`,`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],exampleBody:`Body content revealed when the accordion is expanded.`,serialize:(e,t)=>XJ(`Accordion`,e,t,hY)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:SY,icon:`LayoutPanelTop`,category:`content`,displayName:`Tabs`,description:"Horizontal tab strip + active panel below. Each `<Tab>` child is one panel; clickable pills at the top switch the active one. Active selection is ephemeral (resets on reload).",searchTerms:[`tabs`,`tabbed`,`panels`,`tabgroup`,`switcher`],exampleBody:`<Tab label="One">Body of the first tab panel.</Tab>
|
|
369
|
+
<Tab label="Two">Body of the second tab panel.</Tab>`,serialize:(e,t)=>XJ(`Tabs`,e,t,SY)},{name:`Tab`,surface:`canonical`,hasChildren:!0,props:CY,icon:`PanelTop`,category:`content`,displayName:`Tab`,description:"A single tab panel inside a `<Tabs>` container — carries the strip label and the block-content body.",searchTerms:[`tab`,`panel`],exampleBody:"Panel content — must be nested inside a `<Tabs>` parent.",serialize:(e,t)=>XJ(`Tab`,e,t,CY)},{name:`Math`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:wY,icon:`Sigma`,category:`content`,displayName:`Math`,description:`Block math equation rendered with KaTeX from a LaTeX source string`,searchTerms:[`math`,`latex`,`equation`,`formula`,`katex`,`tex`],serialize:(e,t)=>XJ(`Math`,e,t,wY)},{name:`MermaidFence`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:DY,icon:`Workflow`,category:`content`,displayName:`Mermaid`,description:"Diagram rendered from Mermaid source (flowchart, sequence, class, state, ER, gantt, pie). Authored exclusively as ` ```mermaid ` fenced code.",searchTerms:[`mermaid`,`diagram`,`flowchart`,`graph`,`sequence`,`sequencediagram`,`class`,`state`,`er`,`erdiagram`,`gantt`,`pie`,`chart`],serialize:e=>({type:`code`,lang:`mermaid`,meta:null,value:e.attrs.props?.chart??``})},{name:`Mirror`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:jY,icon:`CopyPlus`,category:`content`,displayName:`Mirror`,description:"Render a read-only copy of a `<MirrorSource>` block from another doc. Use to keep the same content in sync across multiple docs without copy-paste — edits land at the source, every Mirror reflects the change.",searchTerms:[`mirror`,`sync`,`synced`,`transclude`,`embed`,`reference`,`shared block`],serialize:(e,t)=>XJ(`Mirror`,e,t,jY)},{name:`MirrorSource`,surface:`canonical`,hasChildren:!0,props:MY,icon:`GitBranch`,category:`content`,displayName:`Mirror Source`,description:'Mark a block as the source of truth for content that appears in multiple docs. Wrap any block content; `<Mirror src="…" anchor="<id>">` references render this verbatim read-only at every call-site. Edit here, propagate everywhere.',searchTerms:[`mirror source`,`sync source`,`source block`,`master block`,`shared`],exampleBody:"Authoritative content lives inside this block — edits here propagate to every `<Mirror>` that references this id.",serialize:(e,t)=>XJ(`MirrorSource`,e,t,MY)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:gY,icon:`MessageSquareWarning`,category:`content`,displayName:`GFM Callout`,description:"GFM blockquote alert (`> [!NOTE]`) — read-only compat. Preserves `> [!NOTE]` syntax on round-trip; insert a fresh Callout block for the full prop surface.",rendersAs:`Callout`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),i=n?.type??`note`;return{type:`blockquote`,children:[{type:`html`,value:`[!${(r.has(i.toLowerCase())?i:`note`).toUpperCase()}]${n?.collapsible?n.defaultOpen===!1?`-`:`+`:``}${n?.title?` ${n.title}`:``}`},...t.all(e).filter(e=>{if(e.type!==`paragraph`)return!0;let t=e;return Array.isArray(t.children)&&t.children.length>0})]}}},{name:`CommonMarkImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:_Y,icon:`Image`,category:`media`,displayName:`CommonMark Image`,description:'CommonMark image (``) — read-only compat. Preserves `` syntax on round-trip; insert a fresh Image block for the full HTML-native attribute surface (srcset, sizes, decoding, etc.).',rendersAs:`img`,translateProps:e=>e,serialize:e=>{let t=e.attrs.props;return{type:`paragraph`,children:[{type:`image`,url:t?.sourceUrl??t?.src??``,alt:t?.alt??``,title:t?.title??null}]}}},{name:`WikiEmbedImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:yY,icon:`ZoomIn`,category:`media`,displayName:`Wiki Embed Image`,description:"Obsidian-style `![[file.png]]` wiki-embed — read-only compat. Edit the alt-text via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`img`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,alt:t??n}},serialize:FY},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:bY,icon:`Film`,category:`media`,displayName:`Wiki Embed Video`,description:"Obsidian-style `![[clip.mp4]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`video`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:FY},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:xY,icon:`Volume2`,category:`media`,displayName:`Wiki Embed Audio`,description:"Obsidian-style `![[song.mp3]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`audio`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:FY},{name:`WikiEmbedFile`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:OY,icon:`Paperclip`,category:`media`,displayName:`Wiki Embed File`,description:"Obsidian-style `![[file.zip]]` wiki-embed — read-only compat for arbitrary downloadable attachments. Renders through the `File` canonical (inline row with file-up icon + bold name + optional dim size). Edit the display name via the alias slot.",rendersAs:`File`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.size==`string`&&e.size.length>0?e.size:null;return{src:e.src,name:t??void 0,size:n??void 0}},serialize:FY},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:vY,icon:`ChevronRight`,category:`content`,displayName:`HTML5 Details`,description:"HTML5 `<details><summary>` collapsible — read-only compat. Preserves `<details>` syntax on round-trip; insert a fresh Accordion block for icon / description / group-name props.",rendersAs:`Accordion`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=n?.defaultOpen?` open`:``,i=n?.name?` name="${NY(n.name)}"`:``,a=n?.id?` id="${NY(n.id)}"`:``,o=n?.title?.trim(),s=o?`<summary>${PY(o)}</summary>`:``;return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<details${r}${i}${a}>\n${s}`,closer:`</details>`}}}}},{name:`DollarMath`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:TY,icon:`Sigma`,category:`content`,displayName:`Dollar Math`,description:"Block math via `$$…$$` syntax — read-only compat. Preserves `$$…$$` form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`math`,value:e.attrs.props?.formula??``})},{name:`MathFence`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:EY,icon:`Sigma`,category:`content`,displayName:`Math Fence`,description:"Block math via ` ```math ` fenced code syntax — read-only compat. Preserves the fence form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`code`,lang:`math`,meta:null,value:e.attrs.props?.formula??``})}],LY={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>XJ(e.attrs.componentName||`*`,e,t)};function RY(){let e=new Map;e.set(`*`,LY);for(let t of IY)e.set(t.name,t);return{get(t){return e.get(t)},getOrWildcard(t){return e.get(t)??e.get(`*`)},set(t,n){e.set(t,n)},has(t){return e.has(t)},entries(){return e.entries()}}}function zY(){let e=globalThis;return e.__okYpsCounters||={block:0,inline:0},e.__okYpsCounters}const BY={parseFallback:{blockLevel:0,wholeDoc:0,wholeDocBudget:0},jsxRenderFailure:{},jsxAutoConvertFailed:{},jsxAutoConvertSucceeded:{},jsxPropDropped:{},jsxMoveFailed:{},jsxStuckCopyFailed:{},jsxStuckDeleteFailed:{},jsxPopoverCloseRestoreFailed:{},jsxKeyboardDeleteFailed:{},blockGripClickSelectFailed:{},jsxArrowNodeSelectFailed:{}};function VY(){BY.parseFallback.blockLevel++}function HY(){BY.parseFallback.wholeDoc++}function UY(){BY.parseFallback.wholeDocBudget++}function WY(){let e=zY();return{parseFallback:{...BY.parseFallback},ypsMismatch:{block:e.block,inline:e.inline},jsxRenderFailure:{...BY.jsxRenderFailure},jsxAutoConvertFailed:{...BY.jsxAutoConvertFailed},jsxAutoConvertSucceeded:{...BY.jsxAutoConvertSucceeded},jsxPropDropped:{...BY.jsxPropDropped},jsxMoveFailed:{...BY.jsxMoveFailed},jsxStuckCopyFailed:{...BY.jsxStuckCopyFailed},jsxStuckDeleteFailed:{...BY.jsxStuckDeleteFailed},jsxPopoverCloseRestoreFailed:{...BY.jsxPopoverCloseRestoreFailed},jsxKeyboardDeleteFailed:{...BY.jsxKeyboardDeleteFailed},blockGripClickSelectFailed:{...BY.blockGripClickSelectFailed},jsxArrowNodeSelectFailed:{...BY.jsxArrowNodeSelectFailed}}}const GY=/^(`{3,}|~{3,})/gm;function KY(e){let t=[],n=null;for(let r of e.matchAll(GY)){let e=r[1],i=r.index;n?e[0]===n.marker[0]&&e.length>=n.marker.length&&(t.push([n.offset,i+r[0].length]),n=null):n={marker:e,offset:i}}return n&&t.push([n.offset,e.length]),t}function qY(e,t){return t.some(([t,n])=>e>=t&&e<n)}const JY=/^[ \t]{0,3}\[([^\]]+)\]:\s*(\S+)(\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*$/gm;function YY(e){let t=KY(e),n=[];for(let r of e.matchAll(JY))qY(r.index,t)||n.push(r[0].trimEnd());return n.length>0?`${n.join(`
|
|
370
|
+
`)}\n\n`:``}function XY(e,t){let n={startMs:typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),calls:0};return $Y(e,t.parse,0,n)}function ZY(e){return e.calls>=1e3?!0:(typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now())-e.startMs>=500}function QY(e){return e instanceof Error?{name:e.name,message:e.message.slice(0,500),stack:e.stack?.split(`
|
|
371
371
|
`).slice(0,4).join(`
|
|
372
|
-
`)}:{name:`UnknownError`,message:String(e??`unknown`).slice(0,500)}}function
|
|
373
|
-
`||n===`\r`||n==="`")return!1;if(n!==`[`&&n!==`]`)continue;let r=0;for(let n=e-1;n>=0&&t[n]===`\\`;n--)r++;if(r%2!=1){if(n===`]`||t[e+1]===`^`||t[e-1]===`]`)return!1;i=!0;break}}if(!i)return!1;let o=!1,s=-1,c=Math.min(t.length,e+1+
|
|
374
|
-
`||e===`\r`||e===``||e===``||e===``||e===``||e===``)return!1;(e===` `||e===` `)&&(o=!0)}return s===-1||!o?!1:t[s+1]===`)`}function
|
|
372
|
+
`)}:{name:`UnknownError`,message:String(e??`unknown`).slice(0,500)}}function $Y(e,t,n,r){if(n>20)return HY(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`MAX_SPLIT_DEPTH exceeded`})),cX(e);if(r){if(ZY(r))return UY(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`parse budget exhausted`,calls:r.calls})),cX(e);r.calls+=1}try{return t(e)}catch(i){let a=eX(i),o=QY(i);if(a===void 0){if(n===0){let n=sX(e,t,i,r);if(n)return n}return HY(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:o.message,error:o})),cX(e)}VY(),console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:a,reason:o.message,error:o}));try{let i=aX(e,a),s=e.slice(0,i.start),c=e.slice(i.start,i.end),l=e.slice(i.end),u=s.trim()?$Y(s,t,n+1,r):{type:`doc`,content:[]},d=l.trim()?$Y(YY(s)+l,t,n+1,r):{type:`doc`,content:[]},f={type:`rawMdxFallback`,attrs:{reason:o.message,originalSpan:{start:i.start,end:i.end}},content:c?[{type:`text`,text:c}]:[]},p=[...u.content??[],f,...d.content??[]];return{type:`doc`,content:p.length>0?p:[{type:`paragraph`,content:[]}]}}catch(t){HY();let n=QY(t);return console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`Recovery failed: ${n.message}`,recoveryPath:`block-split-then-rejoin`,error:n,originalError:o})),cX(e)}}}function eX(e){if(!e||typeof e!=`object`)return;let t=e;if(t.place&&typeof t.place.offset==`number`)return t.place.offset;if(t.place?.start&&typeof t.place.start.offset==`number`)return t.place.start.offset;if(t.position&&typeof t.position.offset==`number`)return t.position.offset;if(t.position?.start&&typeof t.position.start.offset==`number`)return t.position.start.offset}function tX(e,t){let n=/\n\s*\n/g,r=null;for(let i of e.matchAll(n)){if(i.index>=t)break;r=i.index+i[0].length}return r}function nX(e,t){for(let n of e.matchAll(/\n\s*\n/g))if(n.index>=t)return n.index;return null}function rX(e,t){let n=[];for(let r of e.matchAll(/<(\/?)([A-Z][A-Za-z0-9.]*)/g)){let i=r.index;if(qY(i,t))continue;let a=r[1]===`/`,o=r[2],s=i+r[0].length,c=Math.min(e.length,s+32768),l=!1,u=0,d=-1,f=!1;for(let t=s;t<c;t++){let n=e[t];if(l){n===`"`&&(l=!1),n===`\\`&&t+1<c&&t++;continue}if(n===`"`){l=!0;continue}if(n===`{`){u++;continue}if(n===`}`&&u>0){u--;continue}if(!(u>0)&&n===`>`){d=t,t>0&&e[t-1]===`/`&&(f=!0);break}}if(d===-1)continue;let p=d+1;a?n.push({kind:`close`,name:o,start:i,end:p}):f?n.push({kind:`self-close`,name:o,start:i,end:p}):n.push({kind:`open`,name:o,start:i,end:p})}return n}function iX(e){let t=rX(e,KY(e)),n=[],r=[];for(let i of t){if(i.kind===`self-close`)continue;if(i.kind===`open`){n.push(i);continue}let t=-1;for(let e=n.length-1;e>=0;e--)if(n[e].name===i.name){t=e;break}if(t!==-1){for(let a=n.length-1;a>t;a--){let t=n[a],o=nX(e,t.start)??e.length;r.push({start:t.start,end:Math.min(i.start,o),source:`unmatched`})}r.push({start:n[t].start,end:i.end,source:`pair`}),n.length=t}}for(let t of n){let n=nX(e,t.start)??e.length;r.push({start:t.start,end:Math.min(e.length,n),source:`unmatched`})}return r}function aX(e,t){let n=iX(e),r=null;for(let e of n)e.start<=t&&t<=e.end&&(!r||e.end-e.start<r.end-r.start)&&(r=e);return r?{start:r.start,end:r.end}:{start:tX(e,t)??0,end:nX(e,t)??e.length}}function oX(e){let t=KY(e),n=/\n[ \t]*\n/g,r=[0];for(let i of e.matchAll(n)){let e=i.index;qY(e,t)||r.push(e+i[0].length)}r.push(e.length);let i=[];for(let t=0;t<r.length-1;t++){let n=r[t],a=r[t+1];if(a<=n)continue;let o=e.slice(n,a);o.trim()&&i.push({src:o,start:n,end:a})}return i}function sX(e,t,n,r){let i=oX(e);if(i.length<2)return null;let a=[],o=!1,s=``;for(let e of i){if(r&&ZY(r))break;r&&(r.calls+=1);let i=s+e.src;try{let n=t(i).content??[];s+=YY(e.src);let r=n.filter(e=>e.type!==`paragraph`||Array.isArray(e.content)&&e.content.length>0);if(r.length===0&&n.length>0){o=!0;continue}a.push(...r),o=!0}catch(t){VY();let r=t?.message?.slice(0,200)??`unknown block error`,i=n?.message?.slice(0,160)??`unknown`;console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:e.start,reason:`Per-block recovery after position-less error: ${i}`,blockError:r,blockErrorName:t?.name})),a.push({type:`rawMdxFallback`,attrs:{reason:r,originalSpan:{start:e.start,end:e.end}},content:[{type:`text`,text:e.src}]})}}return o?{type:`doc`,content:a.length>0?a:[{type:`paragraph`,content:[]}]}:null}function cX(e){return{type:`doc`,content:[{type:`paragraph`,content:[{type:`text`,text:e}]}]}}const lX=[[``,``],[``,``],[``,``],[``,``],[``,``]],uX=/[\uE000-\uE004]/,dX=/[\uE005-\uE009]/;lX.map(([e,t])=>({from:e,to:t}));const fX=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g,pX=/<!--[\s\S]*?-->/g,mX=/<\/([a-z][a-z0-9]*)\s*>/g,hX=/<([a-z][a-z0-9]*)(\s[^>]*)?\/?>/g,gX=new Set([`img`,`video`,`audio`]),_X=new Set([`mark`]),vX=/<\/([A-Z][A-Za-z0-9.]*)>/g;function yX(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i]<t?n=i+1:r=i}return n}function bX(e){let t=new Map,n=new RegExp(vX.source,`g`),r=n.exec(e);for(;r!==null;){let i=t.get(r[1]);i?i.push(r.index):t.set(r[1],[r.index]),r=n.exec(e)}return t}function xX(e){let t=[],n=/\n\s*\n/g,r=n.exec(e);for(;r!==null;)t.push(r.index),r=n.exec(e);return t}function SX(e){let t=[],n=e.indexOf(`/>`);for(;n!==-1;)t.push(n),n=e.indexOf(`/>`,n+2);return t}function CX(e){let t=[],n=e.indexOf(`>`);for(;n!==-1;)t.push(n),n=e.indexOf(`>`,n+1);return t}const wX=1024;function TX(e,t){if(t[e-1]!==`(`||t[e-2]!==`]`)return!1;let n=e-2,r=0;for(let e=n-1;e>=0&&t[e]===`\\`;e--)r++;if(r%2==1)return!1;let i=!1,a=Math.max(0,n-wX);for(let e=n-1;e>=a;e--){let n=t[e];if(n===`
|
|
373
|
+
`||n===`\r`||n==="`")return!1;if(n!==`[`&&n!==`]`)continue;let r=0;for(let n=e-1;n>=0&&t[n]===`\\`;n--)r++;if(r%2!=1){if(n===`]`||t[e+1]===`^`||t[e-1]===`]`)return!1;i=!0;break}}if(!i)return!1;let o=!1,s=-1,c=Math.min(t.length,e+1+wX);for(let n=e+1;n<c;n++){let e=t[n];if(e===`>`){s=n;break}if(e===`<`||e===`\\`||e===`
|
|
374
|
+
`||e===`\r`||e===``||e===``||e===``||e===``||e===``)return!1;(e===` `||e===` `)&&(o=!0)}return s===-1||!o?!1:t[s+1]===`)`}function EX(e,t,n,r){let i=yX(n,e);if(i>=n.length)return!1;let a=n[i],o=yX(r,e);return a>=(o<r.length?r[o]:t.length)?!1:t[a-1]===`/`}function DX(e){let t=e;if(uX.test(t))for(let[e,n]of lX)t=t.replaceAll(e,n);t=t.replace(pX,e=>e.replace(/</g,``).replace(/>/g,``)),t=t.replace(fX,(e,t)=>`${t.replaceAll(`:`,``).replaceAll(`@`,``)}`),t=t.replace(mX,(e,t)=>_X.has(t)?e:e.replace(/</g,``).replace(/>/g,``)),t=t.replace(hX,(e,t)=>gX.has(t)&&e.endsWith(`/>`)||_X.has(t)?e:t[0]===t[0].toLowerCase()&&t[0]!==t[0].toUpperCase()?e.replace(/</g,``).replace(/>/g,``):e),t=t.replace(/<>/g,``);let n=bX(t),r=xX(t),i=SX(t),a=CX(t);t=t.replace(/</g,(e,o)=>{if(TX(o,t))return e;let s=t.slice(o,o+256);if(s[1]===`/`)return/^<\/[a-zA-Z][a-zA-Z0-9.]*[ \t]*>/.test(s)?e:``;let c=/^<([a-z][a-z0-9]*)/.exec(s);if(c&&gX.has(c[1])&&EX(o,t,a,r))return e;let l=/^<([a-z][a-z0-9]*)([\s/>])/.exec(s);if(l&&_X.has(l[1])){let n=l[1];return s.startsWith(`<${n}/>`)||t.indexOf(`</${n}>`,o)!==-1?e:``}let u=/^<([A-Z][a-zA-Z0-9.]*)[\s/>]/.exec(s);if(!u)return``;let d=u[1],f=yX(r,o),p=yX(i,f<r.length?r[f]:t.length);if(p>0){let n=i[p-1];if(n>o){let r=o+u[0].length-1;if(!t.slice(r,n).replace(/"[^"]*"|'[^']*'/g,``).includes(`/`))return e}}let m=n.get(d);return m&&yX(m,o)<m.length?e:``});{let e=[],n=[];for(let r=0;r<t.length;r++){if(t[r]===`
|
|
375
375
|
`){let i=t[r+1];if(i===`
|
|
376
376
|
`||i===`>`){if(e.push(...n),n.length=0,i===`
|
|
377
377
|
`)for(;t[r+1]===`
|
|
378
|
-
`;)r++;continue}}if(t[r]===`{`||t[r]===`}`){let e=0;for(let n=r-1;n>=0&&t[n]===`\\`;n--)e++;if(e%2==1)continue;t[r]===`{`?n.push(r):n.length>0&&n.pop()}}if(e.push(...n),e.length>0){let n=t.split(``);for(let t of e)n[t]=``;t=n.join(``)}}return t}function
|
|
379
|
-
`,t),r=(n===-1?e.slice(t):e.slice(t,n)).match(
|
|
380
|
-
`?(n+=1,r=1):r+=1;return{line:n,column:r,offset:t}}function
|
|
381
|
-
`;)r--;let i=e.slice(r,n===t-1?n:n+1);if(i.trim().length===0){n=r-2;continue}return
|
|
382
|
-
`),n=!1;for(let e of t)if(e.length!==0&&(n=!0,!
|
|
378
|
+
`;)r++;continue}}if(t[r]===`{`||t[r]===`}`){let e=0;for(let n=r-1;n>=0&&t[n]===`\\`;n--)e++;if(e%2==1)continue;t[r]===`{`?n.push(r):n.length>0&&n.pop()}}if(e.push(...n),e.length>0){let n=t.split(``);for(let t of e)n[t]=``;t=n.join(``)}}return t}function OX(e){return uX.test(e)||dX.test(e)}function kX(){return e=>{dM(e,e=>{let t=e;typeof t.value==`string`&&OX(t.value)&&(t.value=AX(t.value)),typeof t.url==`string`&&OX(t.url)&&(t.url=AX(t.url)),typeof t.title==`string`&&OX(t.title)&&(t.title=AX(t.title)),typeof t.alt==`string`&&OX(t.alt)&&(t.alt=AX(t.alt)),typeof t.lang==`string`&&OX(t.lang)&&(t.lang=AX(t.lang)),typeof t.meta==`string`&&OX(t.meta)&&(t.meta=AX(t.meta))})}}function AX(e){let t=e.replaceAll(``,`<`).replaceAll(``,`>`).replaceAll(``,`:`).replaceAll(``,`@`).replaceAll(``,`{`);if(dX.test(t))for(let[e,n]of lX)t=t.replaceAll(n,e);return t}const jX=/&(?:[A-Za-z][A-Za-z0-9]*|#[0-9]+|#[xX][0-9A-Fa-f]+);/g;function MX(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n}function NX(e,t,n){return t.lastIndex=0,e.replace(t,(t,r)=>typeof r!=`number`||MX(e,r)%2==1?t:n(t))}function PX(e){return NX(e,jX,e=>`${e.slice(1,-1)}`)}const FX=RegExp(`([^]+)`,`g`);function IX(e){if(!e.includes(``))return{value:e,spans:[]};let t=[],n=``,r=0;FX.lastIndex=0;let i=FX.exec(e);for(;i!==null;){i.index>r&&(n+=e.slice(r,i.index));let a=`&${i[1]??``};`;t.push({offset:n.length,length:a.length,raw:a}),n+=a,r=i.index+i[0].length,i=FX.exec(e)}return r<e.length&&(n+=e.slice(r)),{value:n,spans:t}}function LX(){return e=>{dM(e,e=>{let t=e;if(typeof t.value==`string`&&t.value.includes(``)){let{value:n,spans:r}=IX(t.value);if(t.value=n,e.type===`text`&&r.length>0){let t=e;t.data??={},t.data.entityRefSpans=r}}for(let e of[`url`,`title`,`alt`,`lang`,`meta`]){let n=t[e];typeof n==`string`&&n.includes(``)&&(t[e]=IX(n).value)}})}}const RX=/\\</g;function zX(e){return NX(e,RX,e=>`${e.slice(1)}`)}function BX(){return e=>{dM(e,e=>{let t=e;typeof t.value==`string`&&t.value.includes(``)&&(t.value=t.value.split(``).join(``));for(let e of[`url`,`title`,`alt`]){let n=t[e];typeof n==`string`&&n.includes(``)&&(t[e]=n.split(``).join(``))}})}}const VX=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),HX={note:`note`,tip:`tip`,important:`important`,warning:`warning`,caution:`caution`,abstract:`abstract`,info:`info`,todo:`todo`,success:`success`,question:`question`,failure:`failure`,danger:`danger`,bug:`bug`,example:`example`,quote:`quote`,summary:`abstract`,tldr:`abstract`,check:`success`,done:`success`,help:`question`,faq:`question`,fail:`failure`,missing:`failure`,error:`danger`,cite:`quote`,idea:`tip`,hint:`tip`,warn:`warning`,attention:`warning`},UX=`ok-alert`,WX=RegExp(`(?:^|\\s)${UX}-(\\w+)(?:\\s|$)`),GX=/^>\s*\[!(\w+)\]([+-])?(?:\s+(.*?))?\s*$/i;function KX(e,t){if(t<0||t>=e.length)return null;let n=e.indexOf(`
|
|
379
|
+
`,t),r=(n===-1?e.slice(t):e.slice(t,n)).match(GX);return r?{rawType:r[1],foldableMarker:r[2]===`+`||r[2]===`-`?r[2]:null,title:r[3]?.trim()||null}:null}function qX(e){if(e.data?.hName!==`div`)return null;let t=e.data?.hProperties?.class;if(typeof t!=`string`)return null;let n=t.match(WX);return n?n[1].toLowerCase():null}function JX(e){return HX[e.toLowerCase()]??null}function YX(e,t,n,r,i=null){let a=[{type:`mdxJsxAttribute`,name:`type`,value:t}];n&&a.push({type:`mdxJsxAttribute`,name:`title`,value:n}),i&&a.push({type:`mdxJsxAttribute`,name:`data-authored-as`,value:i}),r!==null&&(a.push({type:`mdxJsxAttribute`,name:`collapsible`,value:null}),r===`+`?a.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}):a.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}}));let o=e.children.slice(1),s=e.position?.start.line;return{type:`mdxJsxFlowElement`,name:`GFMCallout`,attributes:a,children:n&&o.length>0&&s!==void 0&&XX(o[0],s)?o.slice(1):o,position:e.position}}function XX(e,t){if(!e||typeof e!=`object`)return!1;let n=e;if(n.type!==`paragraph`)return!1;let r=n.position?.start?.line,i=n.position?.end?.line;return r===t&&i===t}function ZX(e){if(!e||typeof e!=`object`||e.type!==`paragraph`)return!1;let t=e.data?.hProperties?.class;return typeof t==`string`&&t.includes(`${UX}-title`)}function QX(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;dM(e,`blockquote`,(e,t,r)=>{if(r===void 0||typeof t!=`number`)return;let i=qX(e);if(!i)return;let a=JX(i),o=null,s=null;e.position?.start?.offset!==void 0&&(s=KX(n,e.position.start.offset),s&&(o=s.title,a||=JX(s.rawType)));let c=a??`note`,l=s&&VX.has(c)?s.foldableMarker:null,u=(()=>{if(e.position?.start?.offset!==void 0){let t=KX(n,e.position.start.offset);if(t?.rawType)return t.rawType}return i})(),d=u.toLowerCase()===c?null:u;if(!ZX(e.children[0]))return;let f=YX(e,c,o,l,d);r.children[t]=f})}}const $X={markers:`*`,classPrefix:UX,matchCaseSensitive:!1,icons:new Proxy({},{get:()=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"></svg>`})};function eZ(e,t,n,r){let i=t,a=0;for(;a<r&&i<e.length;)e[i]===`\\`&&i+1<e.length&&n[a]===e[i+1]?(i+=2,a+=1):(i+=1,a+=1);return i}function tZ(e,t){let n=1,r=1;for(let i=0;i<t&&i<e.length;i++)e[i]===`
|
|
380
|
+
`?(n+=1,r=1):r+=1;return{line:n,column:r,offset:t}}function nZ(e,t,n){return{start:tZ(e,t),end:tZ(e,n)}}function rZ(e,t,n,r){if(!e||!t.position||typeof t.position.start?.offset!=`number`)return;let i=t.position.start.offset;return nZ(e,eZ(e,i,t.value,n),eZ(e,i,t.value,r))}const iZ=/(?<!%)%%([^\n]*?[^\n%])%%(?!%)/g,aZ=/<!--([\s\S]*?)-->/g;function oZ(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;cZ(e),dM(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`%%`)===-1&&i.indexOf(`<!--`)===-1)return;let a=sZ(i);if(a.length===0)return;let o=[],s=0;for(let t of a){if(t.start>s){let r={type:`text`,value:i.slice(s,t.start)},a=rZ(n,e,s,t.start);a&&(r.position=a),o.push(r)}let r={type:`comment`,children:[{type:`text`,value:t.body}],data:{sourceForm:t.sourceForm}},a=rZ(n,e,t.start,t.end);a&&(r.position=a),o.push(r),s=t.end}if(s<i.length){let t={type:`text`,value:i.slice(s)},r=rZ(n,e,s,i.length);r&&(t.position=r),o.push(t)}return r.children.splice(t,1,...o),[cM,t+o.length]})}}function sZ(e){let t=[];iZ.lastIndex=0;let n;for(;(n=iZ.exec(e))!==null;)n[1].trim().length!==0&&t.push({start:n.index,end:n.index+n[0].length,body:n[1],sourceForm:`percent`});aZ.lastIndex=0;let r;for(;(r=aZ.exec(e))!==null;){let e=r[1].trim();e!==``&&t.push({start:r.index,end:r.index+r[0].length,body:e,sourceForm:`html`})}t.sort((e,t)=>e.start-t.start);let i=[],a=-1;for(let e of t)e.start<a||(i.push(e),a=e.end);return i}function cZ(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(e.type===`paragraph`){let r=lZ(e);if(r!==null){let e=uZ(r);if(e!==null){let r={type:`commentBlock`,children:[{type:`paragraph`,children:[{type:`text`,value:e}]}],data:{sourceForm:`percent`,sourceLayout:`block`}};t.splice(n,1,r),n+=1;continue}let i=dZ(r);if(i!==null){let e={type:`commentBlock`,children:[{type:`paragraph`,children:[{type:`text`,value:i}]}],data:{sourceForm:`html`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}}let i=fZ(e);if(i!==null){let e={type:`commentBlock`,children:[i],data:{sourceForm:`html`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}let a=pZ(e);if(a!==null){let e={type:`commentBlock`,children:[a],data:{sourceForm:`percent`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}}if(e.type===`paragraph`&&hZ(e)){let e=n+1;for(;e<t.length;){let n=t[e];if(n.type===`paragraph`&&hZ(n))break;e+=1}if(e<t.length&&e>n+1){let r={type:`commentBlock`,children:t.slice(n+1,e),data:{sourceForm:`percent`,sourceLayout:`block`}};t.splice(n,e-n+1,r),n+=1;continue}}n+=1}}function lZ(e){if(e.children.length!==1)return null;let t=e.children[0];return t.type===`text`?t.value:null}function uZ(e){let t=e.match(/^%%\n((?:.|\n(?!\n))+?)\n%%$/);return t===null?null:t[1]}function dZ(e){let t=e.trim();if(!t.startsWith(`<!--`)||!t.endsWith(`-->`))return null;let n=t.slice(4,-3);if(n.includes(`-->`)||n.includes(`<!--`))return null;let r=n.trim();return r===``?null:r}function fZ(e){if(e.children.length<2)return null;let t=e.children[0],n=e.children[e.children.length-1];if(t.type!==`text`||n.type!==`text`)return null;let r=t.value.trimStart();if(!r.startsWith(`<!--`))return null;let i=n.value.trimEnd();if(!i.endsWith(`-->`))return null;for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`text`)continue;let r=n.value;if(t===0){if(mZ(r,`<!--`)>1||mZ(r,`-->`)>0)return null}else if(t===e.children.length-1){if(mZ(r,`<!--`)>0||mZ(r,`-->`)>1)return null}else if(r.includes(`<!--`)||r.includes(`-->`))return null}let a=r.slice(4);a.startsWith(` `)&&(a=a.slice(1));let o=i.slice(0,-3);o.endsWith(` `)&&(o=o.slice(0,-1));let s=[];a.length>0&&s.push({...t,value:a});for(let t=1;t<e.children.length-1;t++)s.push(e.children[t]);return o.length>0&&s.push({...n,value:o}),s.length===0?null:{type:`paragraph`,children:s}}function pZ(e){if(e.children.length<2)return null;let t=e.children[0],n=e.children[e.children.length-1];if(t.type!==`text`||n.type!==`text`)return null;let r=t.value.trimStart();if(!r.startsWith(`%%`)||r.startsWith(`%%%`))return null;let i=n.value.trimEnd();if(!i.endsWith(`%%`)||i.endsWith(`%%%`))return null;let a=r.slice(2);a.startsWith(` `)&&(a=a.slice(1));let o=i.slice(0,-2);if(o.endsWith(` `)&&(o=o.slice(0,-1)),a.indexOf(`%%`)!==-1||o.indexOf(`%%`)!==-1)return null;for(let t=1;t<e.children.length-1;t++){let n=e.children[t];if(n.type===`text`&&n.value.indexOf(`%%`)!==-1)return null}if(!(e.children.slice(1,-1).some(e=>e.type===`text`?e.value.trim().length>0:!0)||a.trim().length>0||o.trim().length>0))return null;let s=[];a.length>0&&s.push({...t,value:a});for(let t=1;t<e.children.length-1;t++)s.push(e.children[t]);return o.length>0&&s.push({...n,value:o}),s.length===0?null:{type:`paragraph`,children:s}}function mZ(e,t){if(!t)return 0;let n=0,r=0;for(;;){let i=e.indexOf(t,r);if(i===-1)break;n+=1,r=i+t.length}return n}function hZ(e){let t=lZ(e);return t===null?!1:t.trim()===`%%`}const gZ=/^([ ]{1,3})(<\/[A-Z][A-Za-z0-9_]*\s*>)([ \t]*)$/gm,_Z=/^[ ]{0,3}([-*+]|\d{1,9}[.)])([ \t]|$)/;function vZ(e,t){if(t===0)return!1;let n=t-1;for(;n>=0;){let r=n;for(;r>0&&e[r-1]!==`
|
|
381
|
+
`;)r--;let i=e.slice(r,n===t-1?n:n+1);if(i.trim().length===0){n=r-2;continue}return _Z.test(i)}return!1}function yZ(e){if(!e.includes(`</`))return e;let t=KY(e),n=!1,r=e.replace(gZ,(r,i,a,o,s)=>qY(s,t)||!vZ(e,s)?r:(n=!0,`${a}${o}`));return n?r:e}const bZ=/^<details(\s[^>]*)?>\s*<summary>([\s\S]*?)<\/summary>([\s\S]*?)<\/details>\s*$/,xZ=/^<details(\s[^>]*)?>(?:\s*<summary>([\s\S]*?)<\/summary>)?[\s\S]*$/,SZ=/^\s*<\/details>\s*$/;function CZ(e){let t=!1,n=null,r=null;if(!e)return{defaultOpen:t,name:n,id:r};let i=/(\w+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,a=i.exec(e);for(;a!==null;){let o=a[1].toLowerCase(),s=a[2]??a[3]??a[4]??null;o===`open`?t=!0:o===`name`?n=s:o===`id`&&(r=s),a=i.exec(e)}return{defaultOpen:t,name:n,id:r}}function wZ(e){let t=[];return e.title!==null&&t.push({type:`mdxJsxAttribute`,name:`title`,value:e.title}),e.defaultOpen&&t.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}),e.name!==null&&t.push({type:`mdxJsxAttribute`,name:`name`,value:e.name}),e.id!==null&&t.push({type:`mdxJsxAttribute`,name:`id`,value:e.id}),t}function TZ(e){if(e.type!==`paragraph`)return!1;let t=e.children;return t.length===1&&t[0].type===`text`}function EZ(e){return e.children[0].value??``}function DZ(e){if(!TZ(e))return null;let t=EZ(e).match(bZ);if(!t)return null;let{defaultOpen:n,name:r,id:i}=CZ(t[1]),a=t[2].trim()||null,o=t[3].trim(),s=o?[{type:`paragraph`,children:[{type:`text`,value:o}]}]:[];return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:wZ({title:a,defaultOpen:n,name:r,id:i}),children:s,position:e.position}}function OZ(e,t){let n=e[t];if(!TZ(n))return null;let r=EZ(n);if(!r.startsWith(`<details`)||r.includes(`</details>`))return null;let i=r.match(xZ);if(!i)return null;let{defaultOpen:a,name:o,id:s}=CZ(i[1]),c=i[2]?.trim()||null;for(let n=t+1;n<e.length;n++){let t=e[n];if(!TZ(t))continue;let r=EZ(t);if(SZ.test(r))return{closerIdx:n,title:c,defaultOpen:a,name:o,id:s};if(r.includes(`</details>`))return null}return null}function kZ(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(TZ(e)){let r=DZ(e);if(r){t[n]=r,n++;continue}let i=OZ(t,n);if(i){let r=e,a=t[i.closerIdx],o=n+1,s=i.closerIdx,c=t.slice(o,s),l=r.position,u=a.position,d={type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:wZ(i),children:c,position:l&&u?{start:l.start,end:u.end}:void 0},f=i.closerIdx-n+1;t.splice(n,f,d),n++;continue}}n++}}function AZ(){return e=>{dM(e,e=>{`children`in e&&Array.isArray(e.children)&&kZ(e)})}}const jZ=/(?<!=)==(?=\S)([^\n]*?[^\s=])==(?!=)/g;function MZ(e){return e.type===`strong`||e.type===`emphasis`||e.type===`delete`||e.type===`inlineCode`}function NZ(e){return e.type===`text`||e.type===`inlineCode`?e.value.length>0?e.value.charAt(0):null:`children`in e&&Array.isArray(e.children)&&e.children.length>0?NZ(e.children[0]):null}function PZ(e){if(e.type===`text`||e.type===`inlineCode`)return e.value.length>0?e.value.slice(-1):null;if(`children`in e&&Array.isArray(e.children)&&e.children.length>0){let t=e.children;return PZ(t[t.length-1])}return null}function FZ(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(e.type!==`text`){n++;continue}let r=e.value,i=-1;for(let e=0;e<=r.length-2;e++){if(r.charCodeAt(e)!==61||r.charCodeAt(e+1)!==61||e>0&&r.charCodeAt(e-1)===61)continue;let a;if(e+2<r.length)a=r.charAt(e+2);else{let e=t[n+1];if(!e)continue;a=NZ(e)}if(!(a===null||/\s/.test(a))){i=e;break}}if(i===-1){n++;continue}let a=-1,o=-1,s=!1;for(let e=i+3;e<=r.length-2;e++){if(r.charCodeAt(e)!==61||r.charCodeAt(e+1)!==61)continue;let i=r.charAt(e-1);if(/[\s=]/.test(i))continue;let o;if(e+2<r.length)o=r.charAt(e+2);else{let e=t[n+1];o=e?e.type===`text`?e.value[0]??null:NZ(e):null}if(o!==`=`){a=-2;break}}if(a===-2){n++;continue}for(let e=n+1;e<t.length;e++){let n=t[e];if(n.type===`text`){for(let r=0;r<=n.value.length-2;r++){if(n.value.charCodeAt(r)!==61||n.value.charCodeAt(r+1)!==61)continue;let i;if(r>0)i=n.value.charAt(r-1);else{let n=t[e-1];i=PZ(n)}if(i===null||/[\s=]/.test(i))continue;let c;if(r+2<n.value.length)c=n.value.charAt(r+2);else{let n=t[e+1];c=n?n.type===`text`?n.value[0]??null:NZ(n):null}if(c!==`=`){a=e,o=r,s=!0;break}}if(a>=0)break}else if(!MZ(n))break}if(a<0){n++;continue}let c=t[a],l=r.slice(0,i),u=r.slice(i+2),d=c.value.slice(0,o),f=c.value.slice(o+2),p=[];u.length>0&&p.push({type:`text`,value:u});for(let e=n+1;e<a;e++)p.push(t[e]);if(d.length>0&&p.push({type:`text`,value:d}),!s){n++;continue}let m={type:`mark`,children:p},h=[];l.length>0&&h.push({type:`text`,value:l}),h.push(m),f.length>0&&h.push({type:`text`,value:f}),t.splice(n,a-n+1,...h),n+=(l.length>0?1:0)+1}}function IZ(e){if(`children`in e&&Array.isArray(e.children)){FZ(e);for(let t of e.children)IZ(t)}}function LZ(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;dM(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`==`)===-1)return;jZ.lastIndex=0;let a=[],o;for(;(o=jZ.exec(i))!==null;)a.push(o);if(a.length===0)return;let s=[],c=0;for(let t of a){let r=t.index,a=r+t[0].length;if(r>c){let t={type:`text`,value:i.slice(c,r)},a=rZ(n,e,c,r);a&&(t.position=a),s.push(t)}let o={type:`text`,value:t[1]},l=rZ(n,e,r+2,a-2);l&&(o.position=l);let u={type:`mark`,children:[o]},d=rZ(n,e,r,a);d&&(u.position=d),s.push(u),c=a}if(c<i.length){let t={type:`text`,value:i.slice(c)},r=rZ(n,e,c,i.length);r&&(t.position=r),s.push(t)}return r.children.splice(t,1,...s),[cM,t+s.length]}),IZ(e),dM(e,`mdxJsxTextElement`,(e,t,n)=>{if(n===void 0||t==null||e.name!==`mark`)return;let r={type:`mark`,children:e.children??[]};return n.children.splice(t,1,r),t+1})}}function RZ(){return e=>{dM(e,`paragraph`,(e,t,n)=>{if(!n||t==null||e.children.length!==1)return;let r=e.children[0];if(!r||r.type!==`image`)return;let i=zZ(r,e);n.children[t]=i})}}function zZ(e,t){let n=[{type:`mdxJsxAttribute`,name:`src`,value:e.url}];typeof e.alt==`string`&&n.push({type:`mdxJsxAttribute`,name:`alt`,value:e.alt}),e.title&&n.push({type:`mdxJsxAttribute`,name:`title`,value:e.title});let r={type:`mdxJsxFlowElement`,name:`CommonMarkImage`,attributes:n,children:[]};return t.position&&(r.position=t.position),r}const BZ=/^( {4}|\t)/;function VZ(e){let t=e.split(`
|
|
382
|
+
`),n=!1;for(let e of t)if(e.length!==0&&(n=!0,!BZ.test(e)))return!1;return n}function HZ(e){return e.split(`
|
|
383
383
|
`).map(e=>e.length===0?e:e.startsWith(` `)?e.slice(4):e.startsWith(` `)?e.slice(1):e).join(`
|
|
384
|
-
`)}function
|
|
385
|
-
`;)a--;if(a===r)return null;let o=t.slice(a,r);if(!
|
|
384
|
+
`)}function UZ(e,t){let n=e.position;if(!n||typeof n.start.offset!=`number`||typeof n.end.offset!=`number`)return null;let r=n.start.offset,i=n.end.offset;if(r<0||i>t.length||r>=i)return null;let a=r;for(;a>0&&t[a-1]!==`
|
|
385
|
+
`;)a--;if(a===r)return null;let o=t.slice(a,r);if(!BZ.test(o))return null;let s=t.slice(a,i);if(!VZ(s))return null;let c={start:{line:n.start.line,column:1,offset:a},end:n.end};return{type:`code`,lang:null,meta:null,value:HZ(s).replace(/\n+$/,``),position:c,data:{sourceStyle:`indented`}}}const WZ=function(){return(e,t)=>{let n=String(t.value??``);n&&dM(e,`paragraph`,(e,t,r)=>{if(!r||r.type!==`root`||t==null)return;let i=r.children[t-1];if(i&&i.type===`list`)return;let a=UZ(e,n);a&&(r.children[t]=a)})}};function GZ(e,t,n){let r={type:`mdxJsxFlowElement`,name:e,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t}],children:[]};return n&&(r.position=n),r}function KZ(){return e=>{dM(e,`math`,(e,t,n)=>{if(!n||t==null)return;let r=GZ(`DollarMath`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r}),dM(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`math`)return;let r=GZ(`MathFence`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}const qZ=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g;function JZ(e,t=``){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value;qZ.lastIndex=0;let a=[],o=0;for(;;){let n=qZ.exec(e);if(n===null)break;let s=n[0],c=n[1],l=n.index;if(l>o){let n={type:`text`,value:e.slice(o,l)},r=rZ(t,i,o,l);r&&(n.position=r),a.push(n)}let u={type:`text`,value:c},d=rZ(t,i,l+1,l+1+c.length);d&&(u.position=d);let f={type:`link`,url:c,title:null,children:[u],data:{sourceStyle:`autolink`}},p=rZ(t,i,l,l+s.length);p&&(f.position=p),a.push(f),o=l+s.length,r=!0}if(a.length===0)n.push(i);else{if(o<e.length){let n={type:`text`,value:e.slice(o)},r=rZ(t,i,o,e.length);r&&(n.position=r),a.push(n)}n.push(...a)}}r&&(e.children=n)}const YZ=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`.split(``));function XZ(e){let t=[],n=``;for(let r=0;r<e.length;r++){let i=e[r];if(i===`\\`&&r+1<e.length&&e[r+1]===`|`){n+=`${i}|`,r++;continue}if(i===`|`){t.push(n),n=``;continue}n+=i}return t.push(n),t}function ZZ(e,t,n=!1,r){if(!t)return;let i=e.position;if(!i||typeof i.start?.offset!=`number`){n&&console.warn(`[position-slice] node type=${e.type} has no position — fidelity defaults apply`);return}let a=i.start.offset,o=i.end?.offset??a;if(a<0||o>t.length){n&&console.warn(`[position-slice] node type=${e.type} position out of bounds: start=${a} end=${o} sourceLen=${t.length}`);return}switch(e.data??={},e.type){case`text`:{let n=t.slice(a,o),r=e.value??``;if(n.length>r.length&&n.includes(`\\`)){let t=[],i=0,a=0;for(;i<n.length&&a<r.length;)n[i]===`\\`&&i+1<n.length&&YZ.has(n[i+1])&&r[a]===n[i+1]?(t.push({offset:a,char:n[i+1]}),i+=2,a+=1):(i++,a++);t.length>0&&(e.data.escapedChars=t)}n.endsWith(`\\`)&&r.endsWith(`\\`)&&(e.data.sourceRaw=n);break}case`emphasis`:{let n=t[a];(n===`*`||n===`_`)&&(e.data.sourceDelimiter=n);break}case`strong`:{let n=t.slice(a,a+2);(n===`**`||n===`__`)&&(e.data.sourceDelimiter=n);break}case`heading`:{let n=t[a],i=t.slice(a,o);if(n===`#`){if(e.data.sourceStyle=`atx`,r?.type===`root`){let n=a;for(;n>0&&t[n-1]!==`
|
|
386
386
|
`;)n--;let r=t.slice(n,a);r.length>=1&&r.length<=3&&/^ +$/.test(r)&&(e.data.sourceLeadingIndent=r.length)}let n=/^#+( {2,})[^ ]/.exec(i);n&&(e.data.sourceInteriorSpacing=n[1].length);let o=/^.*?[ \t](#+)[ \t]*$/.exec(i);o&&(e.data.sourceTrailingHashes=o[1].length)}else{let t=/\n(=+)[ \t]*$/.exec(i),n=/\n(-+)[ \t]*$/.exec(i),r=t??n;r?(e.data.sourceStyle=`setext`,e.data.sourceUnderlineLength=r[1].length):e.data.sourceStyle=`atx`}break}case`blockquote`:{let n=a;for(;n>0&&t[n-1]!==`
|
|
387
387
|
`;)n--;let r=!1;for(let e=n;e<a;e++)if(t[e]===`>`){r=!0;break}let i=t.slice(a,o).split(`
|
|
388
388
|
`),s=[];for(let e=0;e<i.length;e++){let t=i[e];if(t.trim().length===0)continue;if(r&&e>0)break;let n=t.replace(/^ {1,3}/,``);if(n[0]!==`>`){e>0&&t.trimStart()[0]!==`>`&&s.push(`lazy`);continue}if(n.slice(1).trimEnd()!==``)if(n[1]===` `)s.push(1);else{let e=0;for(;n[1+e]===` `;)e++;s.push(e)}}s.length>0&&(e.data.sourceMarkerSpacings=s);break}case`list`:{let n=e.children?.[0];if(n?.position?.start?.offset!=null){let r=n.position.start.offset;if(r>=0&&r<t.length){let n=t[r];if(!e.ordered&&(n===`-`||n===`*`||n===`+`))e.data.bulletMarker=n;else if(e.ordered){let n=t.slice(r,Math.min(r+10,t.length)).match(/^\d+([.)])/);n&&(e.data.listMarkerDelimiter=n[1])}}}break}case`listItem`:{let n=t.slice(a,o),r=/^(?:([-+*])|(\d{1,9})[.)])( *)/.exec(n);if(!r)break;let s=r[1]?1:(r[2]?.length??0)+1,c=r[3].length;c>=2&&c<=4&&(e.data.sourceMarkerSpacing=c),r[2]&&(e.data.sourceOrdinal=Number.parseInt(r[2],10)),e.checked!=null&&/^\[([xX])\] /.exec(n.slice(s+Math.max(c,1)))?.[1]===`X`&&(e.data.sourceCheckboxChar=`X`);let l=s+(c>=2&&c<=4?c:1),u=a;for(;u>0&&t[u-1]!==`
|
|
@@ -392,15 +392,15 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
392
392
|
`),r=(e.value??``).split(`
|
|
393
393
|
`);if(n.length===r.length){let t=[],i=!1,a=!0;for(let e=0;e<n.length;e++){let o=n[e],s=r[e];if(!o.endsWith(s)){a=!1;break}let c=o.slice(0,o.length-s.length);if(!/^[ \t]*$/.test(c)){a=!1;break}t.push(c),c!==(s.length>0?` `:``)&&(i=!0)}a&&i&&(e.data.sourceIndents=t)}}break}case`inlineCode`:{let n=t[a];if(n==="`"||n===`~`){e.data.sourceFenceChar=n;let r=0;for(;a+r<t.length&&t[a+r]===n;)r++;r>=1&&(e.data.sourceFenceLength=r);let i=t.slice(a+r,o-r),s=e.value??``;i!==s&&i===` ${s} `&&(e.data.sourcePadded=!0)}break}case`inlineMath`:if(t[a]===`$`){let n=0;for(;a+n<t.length&&t[a+n]===`$`;)n++;e.data.sourceDelimiter=`$`.repeat(n)}break;case`thematicBreak`:e.data.sourceRaw=t.slice(a,o);break;case`table`:{let n=t.slice(a,o),r=n.indexOf(`
|
|
394
394
|
`);if(r===-1)break;let i=n.slice(r+1),s=i.indexOf(`
|
|
395
|
-
`),c=s===-1?i:i.slice(0,s),l=c.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`),u=[];for(let e of l){let t=e.match(/-/g);u.push(t?t.length:0)}u.some(e=>e>0)&&(e.data.sourceDashCounts=u);{let t=c.trim(),n=
|
|
395
|
+
`),c=s===-1?i:i.slice(0,s),l=c.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`),u=[];for(let e of l){let t=e.match(/-/g);u.push(t?t.length:0)}u.some(e=>e>0)&&(e.data.sourceDashCounts=u);{let t=c.trim(),n=XZ(t);n.length>0&&n[0]===``&&t.startsWith(`|`)&&n.shift(),n.length>0&&n[n.length-1]===``&&t.endsWith(`|`)&&n.pop();let r=n.every(e=>/^[-: ]+$/.test(e)),i=[];for(let e of n){let t=0;for(;t<e.length&&e[t]===` `;)t++;let n=0;for(;n<e.length-t&&e[e.length-1-n]===` `;)n++;i.push({left:t,right:n})}r&&i.length>0&&(e.data.sourceAlignmentPadding=i)}{let t=n.split(`
|
|
396
396
|
`).filter(e=>e.trim().length>0);if(t.length>=2){let n=t.map(e=>e.trimStart().startsWith(`|`)),r=t.map(e=>/(^|[^\\])\|$/.test(e.trimEnd())),i=n.every(e=>e===n[0]),a=r.every(e=>e===r[0]);if(i&&a){let t=n[0],i=r[0];(!t||!i)&&(e.data.sourceOuterPipes={leading:t,trailing:i})}}}for(let n of e.children??[]){if(n.type!==`tableRow`||!n.position)continue;let e=n.position.start.offset,r=n.position.end.offset;if(typeof e!=`number`||typeof r!=`number`)continue;let i=t.slice(e,r),a=i.indexOf(`
|
|
397
|
-
`);a!==-1&&(i=i.slice(0,a));let o=
|
|
397
|
+
`);a!==-1&&(i=i.slice(0,a));let o=XZ(i);o.length>0&&o[0]===``&&i.startsWith(`|`)&&o.shift(),o.length>0&&o[o.length-1]===``&&i.endsWith(`|`)&&o.pop();let s=n.children??[],c=Math.min(s.length,o.length);for(let e=0;e<c;e++){let t=s[e];if(t.type!==`tableCell`)continue;let n=o[e],r=0;for(;r<n.length&&n[r]===` `;)r++;let i=0;for(;i<n.length-r&&n[n.length-1-i]===` `;)i++;t.data||={},t.data.sourcePadding={left:r,right:i}}}break}case`link`:case`linkReference`:if(`children`in e&&e.children.length===0&&(e.data.sourceRaw=t.slice(a,o)),e.type===`link`){let n=t[a];if(n!==`[`&&n!==`<`&&!e.title)e.data.sourceStyle=`gfm-autolink`;else if(n===`[`){let n=t.slice(a,o),r=n.lastIndexOf(`](`);if(r!==-1){let t=r+2;for(;t<n.length&&(n[t]===` `||n[t]===` `);)t++;if(n[t]===`<`&&(e.data.sourceUrlForm=`angle-bracketed`),e.title!==void 0&&e.title!==null&&n[n.length-1]===`)`){let t=n.length-2;for(;t>r+1&&(n[t]===` `||n[t]===` `||n[t]===`
|
|
398
398
|
`);)t--;n[t]===`"`?e.data.sourceTitleMarker=`double`:n[t]===`'`?e.data.sourceTitleMarker=`single`:n[t]===`)`&&(e.data.sourceTitleMarker=`paren`)}}}}break;case`definition`:{let n=t.slice(a,o);if(e.data.sourceLayout=n.includes(`
|
|
399
|
-
`)?`multiline`:`inline`,typeof e.title==`string`&&n.length>0){let t=n[n.length-1];t===`"`?e.data.sourceTitleMarker=`double`:t===`'`?e.data.sourceTitleMarker=`single`:t===`)`&&(e.data.sourceTitleMarker=`paren`)}break}case`mdxJsxFlowElement`:case`mdxJsxTextElement`:case`mdxFlowExpression`:case`mdxTextExpression`:e.data.sourceRaw=t.slice(a,o);break;case`break`:if(e.data.sourceRaw)break;t.slice(a,o).includes(`\\`)?e.data.sourceStyle=`backslash`:e.data.sourceStyle=`spaces`;break}}function
|
|
399
|
+
`)?`multiline`:`inline`,typeof e.title==`string`&&n.length>0){let t=n[n.length-1];t===`"`?e.data.sourceTitleMarker=`double`:t===`'`?e.data.sourceTitleMarker=`single`:t===`)`&&(e.data.sourceTitleMarker=`paren`)}break}case`mdxJsxFlowElement`:case`mdxJsxTextElement`:case`mdxFlowExpression`:case`mdxTextExpression`:e.data.sourceRaw=t.slice(a,o);break;case`break`:if(e.data.sourceRaw)break;t.slice(a,o).includes(`\\`)?e.data.sourceStyle=`backslash`:e.data.sourceStyle=`spaces`;break}}function QZ(){return RegExp(`(^|\\s)#([a-zA-Z][\\w/-]*)`,`g`)}const $Z=QZ();function eQ(e,t){if(t<=0||e[t-1]!==`\\`)return!1;let n=t-1,r=0;for(;n>=0&&e[n]===`\\`;)r++,n--;return r%2==1}function tQ(e,t=``){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value,a=typeof i.position?.start?.offset==`number`?i.position?.start?.offset??0:0;$Z.lastIndex=0;let o=[],s=0;for(;;){let n=$Z.exec(e);if(n===null)break;let c=n[1]??``,l=n[2]??``,u=n.index+c.length;if(t&&a>=0){let n=a,r=0,i=-1;for(;r<=u&&n<t.length;){let a=t[n]===`\\`&&n+1<t.length&&e[r]===t[n+1],o=a?n+1:n;if(r===u){i=o;break}n=a?n+2:n+1,r+=1}if(i>=0&&eQ(t,i))continue}if(u>s){let n={type:`text`,value:e.slice(s,u)},r=rZ(t,i,s,u);r&&(n.position=r),o.push(n)}let d={type:`tag`,value:l},f=rZ(t,i,u,u+1+l.length);f&&(d.position=f),o.push(d),s=u+1+l.length,r=!0}if(o.length===0)n.push(i);else{if(s<e.length){let n={type:`text`,value:e.slice(s)},r=rZ(t,i,s,e.length);r&&(n.position=r),o.push(n)}n.push(...o)}}r&&(e.children=n)}const nQ=new Set(`root.paragraph.heading.text.emphasis.strong.blockquote.list.listItem.code.inlineCode.link.image.linkReference.imageReference.definition.html.thematicBreak.break.yaml.toml.table.tableRow.tableCell.delete.footnoteDefinition.footnoteReference.mdxFlowExpression.mdxJsxFlowElement.mdxJsxTextElement.mdxTextExpression.wikiLink.wikiLinkEmbed.tag.math.inlineMath.mark.comment.commentBlock.rawMdxFallbackMdast`.split(`.`));function rQ(e,t){if(!e||typeof e!=`object`)return null;if(typeof e.offset==`number`)return e.offset>=0&&e.offset<=t.length?e.offset:null;let{line:n,column:r}=e;if(typeof n!=`number`||typeof r!=`number`||n<1||r<1)return null;let i=0;for(let e=1;e<n;e++){let e=t.indexOf(`
|
|
400
400
|
`,i);if(e===-1)return null;i=e+1}let a=t.indexOf(`
|
|
401
|
-
`,i),o=a===-1?t.length:a,s=i+r-1;return s<=o?s:null}function aQ(e,t){if(!e)return null;let n=iQ(e.start,t),r=iQ(e.end,t);return n===null||r===null||r<n?null:t.slice(n,r)}function oQ(e,t){let n=aQ(e.position,t);return{type:`rawMdxFallbackMdast`,originalType:e.type??`unknown`,value:n??``,unresolvedPosition:n===null,position:e.position}}function sQ(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``,r=typeof process<`u`&&process.env?.OK_DEBUG_POSITION_SLICE===`1`;dM(e,(e,t,i)=>{if(i!==void 0&&typeof t==`number`&&typeof e.type==`string`&&!rQ.has(e.type)){let r=oQ(e,n);return i.children[t]=r,cM}if(`children`in e&&Array.isArray(e.children)){let t=e;t.children.some(e=>e.type===`text`)&&(YZ(t,n),nQ(t,n))}if(QZ(e,n,r,i),e.type===`heading`&&i!==void 0&&typeof t==`number`){let n=e.position?.end?.line,r=i.children[t+1],a=r?.position?.start?.line;if(r?.type===`paragraph`&&typeof n==`number`&&typeof a==`number`&&a===n+1){let t=e;t.data??={},t.data.sourceContiguousNext=!0}}})}}function cQ(e,t){let n={type:`mdxJsxFlowElement`,name:`MermaidFence`,attributes:[{type:`mdxJsxAttribute`,name:`chart`,value:e}],children:[]};return t&&(n.position=t),n}function lQ(){return e=>{dM(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`mermaid`)return;let r=cQ(typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}function uQ(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}const dQ=(e,t)=>{if(uQ(e,t))return 0;let n=t.data?.sourcePrecedingBlankLines;if(typeof n==`number`&&n>=2)return n;let r=e.position,i=t.position;if(!r||!i)return;let a=i.start.line-r.end.line-1;return a>=1?a:void 0},fQ=OV(),pQ=KB(),mQ=qB();function hQ(){let e=this.data();e.micromarkExtensions||=[],e.fromMarkdownExtensions||=[],e.toMarkdownExtensions||=[];let t=e.micromarkExtensions;t.some(e=>e===fQ)||t.push(fQ);let n=e.fromMarkdownExtensions;n.some(e=>e===pQ)||n.push(pQ);let r=e.toMarkdownExtensions;r.some(e=>e===mQ)||r.push(mQ)}const gQ=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function _Q(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;dM(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`$`)===-1)return;gQ.lastIndex=0;let a=[],o;for(;(o=gQ.exec(i))!==null;)a.push(o);if(a.length===0)return;let s=[],c=0;for(let t of a){let r=t.index,a=r+t[0].length;if(r>c){let t={type:`text`,value:i.slice(c,r)},a=iZ(n,e,c,r);a&&(t.position=a),s.push(t)}let o={type:`inlineMath`,value:t[1]},l=iZ(n,e,r,a);l&&(o.position=l),s.push(o),c=a}if(c<i.length){let t={type:`text`,value:i.slice(c)},r=iZ(n,e,c,i.length);r&&(t.position=r),s.push(t)}return r.children.splice(t,1,...s),[cM,t+s.length]})}}const vQ={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[a-zA-Z]`}]};function yQ(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===vQ)||e.toMarkdownExtensions.push(vQ)}const bQ=/(?<!\uE102)<br[ \t]*\/?>/g,xQ=new Set([`mdxJsxTextElement`,`mdxJsxFlowElement`]);function SQ(e,t){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value;bQ.lastIndex=0;let a=[],o=0;for(;;){let n=bQ.exec(e);if(n===null)break;let s=n.index;if(s>o){let n={type:`text`,value:e.slice(o,s)},r=iZ(t,i,o,s);r&&(n.position=r),a.push(n)}let c={type:`break`,data:{sourceStyle:`html`,sourceRaw:n[0]}},l=iZ(t,i,s,s+n[0].length);l&&(c.position=l),a.push(c),o=s+n[0].length,r=!0}if(a.length===0)n.push(i);else{if(o<e.length){let n={type:`text`,value:e.slice(o)},r=iZ(t,i,o,e.length);r&&(n.position=r),a.push(n)}n.push(...a)}}r&&(e.children=n)}function CQ(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;dM(e,e=>{if(xQ.has(e.type))return cM;let t=e;Array.isArray(t.children)&&SQ(e,n)})}}const wQ={name:`wikiLink`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===91?(e.enter(`wikiLink`),e.enter(`wikiLinkMarker`),e.consume(t),s):n(t)}function s(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),c):n(t)}function c(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),d(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),l):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),r++,c)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),d(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),i++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),d(t)):(e.consume(t),a++,u)}function d(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),f):n(t)}function f(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLink`),t):n(r)}}},TQ={name:`wikiLinkEmbed`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===33?(e.enter(`wikiLinkEmbed`),e.enter(`wikiLinkEmbedBang`),e.consume(t),e.exit(`wikiLinkEmbedBang`),s):n(t)}function s(t){return t===91?(e.enter(`wikiLinkMarker`),e.consume(t),c):n(t)}function c(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),l):n(t)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),f(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),u):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),r++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),f(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),i++,u)}function d(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),f(t)):(e.consume(t),a++,d)}function f(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),p):n(t)}function p(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLinkEmbed`),t):n(r)}}};function EQ(){return{text:{91:wQ,33:TQ}}}function DQ(e){this.enter({type:`wikiLink`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function OQ(e){this.enter({type:`wikiLinkEmbed`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function kQ(e){return e.stack[e.stack.length-1]}function AQ(e){let t=kQ(this),n=this.sliceSerialize(e);t.data.target=n.trim(),n!==t.data.target&&(t.data.sourceTarget=n)}function jQ(e){let t=kQ(this),n=this.sliceSerialize(e),r=n.trim();t.data.anchor=r.length?r:null,t.data.anchor!==null&&n!==r&&(t.data.sourceAnchor=n)}function MQ(e){let t=kQ(this),n=this.sliceSerialize(e),r=n.trim();t.data.alias=r.length?r:null,t.data.alias!==null&&n!==r&&(t.data.sourceAlias=n)}function NQ(e){let{target:t,anchor:n,alias:r}=e.data,i=r||(n?`${t}#${n}`:t);e.value=i,e.children=[{type:`text`,value:i}]}function PQ(e){NQ(kQ(this)),this.exit(e)}function FQ(e){NQ(kQ(this)),this.exit(e)}const IQ={enter:{wikiLink:DQ,wikiLinkEmbed:OQ},exit:{wikiLinkTarget:AQ,wikiLinkAnchor:jQ,wikiLinkAlias:MQ,wikiLink:PQ,wikiLinkEmbed:FQ}};function LQ(e,t){return typeof e==`string`&&e.trim()===t?e:t}const RQ={handlers:{wikiLink:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`[[${LQ(t.data?.sourceTarget,n)}`;return r&&(a+=`#${LQ(t.data?.sourceAnchor,r)}`),i&&(a+=`|${LQ(t.data?.sourceAlias,i)}`),`${a}]]`},wikiLinkEmbed:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`![[${n}`;return r&&(a+=`#${r}`),i&&(a+=`|${i}`),`${a}]]`}},unsafe:[{character:`[`,inConstruct:[`phrasing`]}]},zQ=EQ();function BQ(){let e=this.data();e.micromarkExtensions||=[],e.micromarkExtensions.some(e=>e===zQ)||e.micromarkExtensions.push(zQ),e.fromMarkdownExtensions||=[],e.fromMarkdownExtensions.some(e=>e===IQ)||e.fromMarkdownExtensions.push(IQ),e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===RQ)||e.toMarkdownExtensions.push(RQ)}function VQ(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}const HQ=[{name:`remark-parse`,plugin:oB},{name:`remark-mdx-agnostic`,plugin:hQ},{name:`remark-gfm`,plugin:tR},{name:`remark-math`,plugin:xz,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:BQ},{name:`remark-github-alerts`,plugin:lz,options:eZ},{name:`callout-transformer`,plugin:$X},{name:`restore-from-mdx`,plugin:AX},{name:`void-br-promoter`,plugin:CQ},{name:`restore-entity-refs`,plugin:RX},{name:`restore-backslash-escapes`,plugin:VX},{name:`details-accordion-promoter`,plugin:jZ},{name:`image-promoter`,plugin:zZ},{name:`indented-code-promoter`,plugin:GZ},{name:`math-promoter`,plugin:qZ},{name:`single-dollar-math-promoter`,plugin:_Q},{name:`highlight-promoter`,plugin:RZ},{name:`mermaid-promoter`,plugin:lQ},{name:`comment-promoter`,plugin:sZ},{name:`merged-post-parse-walker`,plugin:sQ},{name:`ensure-non-empty-doc`,plugin:()=>VQ}];function UQ(e){let t=dR();for(let e of HQ)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(FR,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function WQ(e){let t=dR().use(az,[`yaml`]).use(tR,{tablePipeAlign:!1}).use(xz,{singleDollarTextMath:!1}).use(hQ).use(BQ).use(yQ).use(nR,{bullet:`-`,fences:!0,rule:`-`,join:[dQ],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function GQ(e){return e.charCodeAt(0)===65279?{source:e.slice(1),hadBom:!0}:{source:e,hadBom:!1}}const KQ=/^\n+$/,qQ=/^\n{2,}$/;function JQ(e,t,n){let r,i,a,o=e.children;if(o.length>0){let e=o[0]?.position?.start?.offset;if(typeof e==`number`&&e>0){let n=t.slice(0,e);KQ.test(n)&&(r=n)}let n=o[o.length-1]?.position?.end?.offset;if(typeof n==`number`&&n<=t.length){let e=t.slice(n);qQ.test(e)&&(i=e)}let s=[],c=!1;for(let e=1;e<o.length;e++){let n=o[e-1]?.position?.end?.offset,r=o[e]?.position?.start?.offset,i=null;if(typeof n==`number`&&typeof r==`number`&&r>=n){let e=t.slice(n,r);RegExp(`^\\n{3,}$`).test(e)&&(i=e.length-1,c=!0)}s.push(i)}c&&(a=s)}if(!n&&r===void 0&&i===void 0&&!a)return;let s={...n?{bom:!0}:{},...r===void 0?{}:{leading:r},...i===void 0?{}:{trailing:i},...a?{gapBlankLines:a}:{}};return e.data??={},e.data.sourceDocBoundary=s,s}function YQ(e){if(typeof e!=`object`||!e)return;let t=e,n={};return t.bom===!0&&(n.bom=!0),typeof t.leading==`string`&&KQ.test(t.leading)&&(n.leading=t.leading),typeof t.trailing==`string`&&qQ.test(t.trailing)&&(n.trailing=t.trailing),Array.isArray(t.gapBlankLines)&&t.gapBlankLines.every(e=>e===null||typeof e==`number`&&Number.isInteger(e)&&e>=2)&&(n.gapBlankLines=t.gapBlankLines),n.bom||n.leading||n.trailing||n.gapBlankLines?n:void 0}function XQ(e,t){let{source:n,hadBom:r}=GQ(e),i=bZ(n),a=new Ij(FX(OX(BX(i)))),o=t.parse(a);a.value=i;let s=t.runSync(o,a),c=JQ(s,i,r),l=t.stringify(s);return c?l.type.create({...l.attrs,sourceDocBoundary:c},l.content,l.marks):l}function ZQ(e,t){let{source:n,hadBom:r}=GQ(e),i=bZ(n),a=new Ij(FX(OX(BX(i)))),o=t.parse(a);a.value=i;let s=t.runSync(o,a);return JQ(s,i,r),s}function QQ(e,t,n){let r=LR(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers}),i=YQ(e.attrs?.sourceDocBoundary),a=i?.gapBlankLines;if(a&&a.length===r.children.length-1)for(let e=1;e<r.children.length;e++){let t=a[e-1];if(typeof t==`number`){let n=r.children[e];n.data??={},n.data.sourcePrecedingBlankLines=t}}let o=String(t.stringify(r));return i?.leading&&(o=i.leading+o),i?.trailing&&(o=o.replace(/\n+$/,``)+i.trailing),i?.bom&&(o=`\uFEFF${o}`),o}function $Q(){return typeof process>`u`||!process.env?!1:process.env.NODE_ENV===`development`||process.env.NODE_ENV===`test`}function e$(e){let t=e.lastIndexOf(`/`);return t===-1?``:t===0?`/`:e.slice(0,t)}function t$(e,t){let n=e?`${e}/${t}`:t,r=n.startsWith(`/`),i=[];for(let e of n.split(`/`))if(!(e===``||e===`.`)){if(e===`..`){let e=i[i.length-1];i.length>0&&e!==`..`?i.pop():r||i.push(`..`);continue}i.push(e)}let a=i.join(`/`);return r?`/${a}`:a}function n$(e,t){if(typeof e!=`string`||e===``||!t||e.startsWith(`/`)||!TK(e))return e;let n=t$(e$(t),e);return n===``||n===`..`||n.startsWith(`../`)?($Q()&&console.warn(`[resolve-image-url] doc-relative path escapes contentDir; emitting raw URL: ${e} (from sourcePath ${t})`),e):`/${n}`}const r$=Object.assign(C$,{peek:()=>`$`}),i$=Object.assign(w$,{peek:()=>`~`}),a$=(()=>{for(let e of mQ.extensions??[]){let t=e?.handlers?.mdxJsxFlowElement;if(typeof t==`function`)return t}throw Error(`mdast-util-mdx-jsx mdxJsxFlowElement to-markdown handler not found — the dirty MDX JSX serialize path cannot bind. Likely a breaking change in mdast-util-mdx-jsx (pinned in the root overrides); re-run the markdown-pipeline upgrade protocol (test:fidelity).`)})(),o$=/^[ \t]*(?:$|#{1,6}(?:[ \t]|[ \t]*$)|>|(?:[-+*]|\d{1,9}[.)])[ \t]|`{3,}|~{3,}|=+[ \t]*$|-+[ \t]*$|(?:\*[ \t]*){3,}$|(?:_[ \t]*){3,}$)/,s$={text(e,t,n,r){if(typeof e.data?.sourceRaw==`string`&&oq(e.data.sourceRaw,e.value??``))return e.data.sourceRaw;if(e.data?.escapedChars?.length){let t=e.value??``,i=e.data.escapedChars,a=``,o=0;for(let{offset:e,char:s}of i)e>o&&(a+=h$(n,t.slice(o,e),{...r,before:r.before+a,after:`\\`})),a+=`\\${s}`,o=e+1;return o<t.length&&(a+=h$(n,t.slice(o),{...r,before:r.before+a})),a}return h$(n,e.value??``,r)},emphasis(e,t,n,r){let i=e.data?.sourceDelimiter??`*`,a=n.createTracker(r),o=n.enter(`emphasis`),s=a.move(i);return s+=b$(n.containerPhrasing(e,{before:s,after:i,...a.current()}),r,i),s+=a.move(i),o(),s},strong(e,t,n,r){let i=e.data?.sourceDelimiter??`**`,a=n.createTracker(r),o=n.enter(`strong`),s=a.move(i);return s+=b$(n.containerPhrasing(e,{before:s,after:i,...a.current()}),r,i),s+=a.move(i),o(),s},link(e,t,n,r){if(e.data?.sourceStyle===`autolink`)return`<${e.url??``}>`;if(e.data?.sourceStyle===`gfm-autolink`){let t=e.children?.length===1?e.children[0]:null;if(t?.type===`text`&&typeof t.value==`string`)return t.value}let i=n.createTracker(r),a=n.enter(`link`),o=n.enter(`label`),s=i.move(`[`);s+=i.move(n.containerPhrasing(e,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`),l=String(e.url??``),u=e.data?.sourceUrlForm===`angle-bracketed`,d=l.startsWith(`<`)&&l.endsWith(`>`),f=u&&!d?`<${l}>`:f$(l);if(s+=i.move(f),c(),e.title){let t=e.data?.sourceTitleMarker??`double`;s+=i.move(d$(e.title,t))}return s+=i.move(`)`),a(),s},image(e,t,n,r){let i=n.createTracker(r),a=n.enter(`image`),o=n.enter(`label`),s=i.move(`})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`);if(s+=i.move(f$(String(e.url??``))),c(),e.title){let t=n.enter(`titleQuote`);s+=i.move(` "`),s+=i.move(n.safe(e.title,{before:s,after:`"`,...i.current()})),s+=i.move(`"`),t()}return s+=i.move(`)`),a(),s},definition(e,t,n,r){let i=e.data?.sourceLayout??`inline`,a=e.data?.sourceTitleMarker??`double`,o=n.enter(`definition`),s=n.createTracker(r),c=n.enter(`label`),l=s.move(`[`);l+=s.move(n.safe(n.associationId(e),{before:l,after:`]`,...s.current()})),l+=s.move(`]:`),c();let u=i===`multiline`?`
|
|
402
|
-
`:` `;l+=s.move(u);let d=String(e.url??``);if(!d||/[\0- ]/.test(d)){let e=n.enter(`destinationLiteral`);l+=s.move(`<`),l+=s.move(n.safe(d,{before:l,after:`>`,...s.current()})),l+=s.move(`>`),e()}else{let e=n.enter(`destinationRaw`);l+=s.move(
|
|
403
|
-
`:` `;l+=s.move(
|
|
401
|
+
`,i),o=a===-1?t.length:a,s=i+r-1;return s<=o?s:null}function iQ(e,t){if(!e)return null;let n=rQ(e.start,t),r=rQ(e.end,t);return n===null||r===null||r<n?null:t.slice(n,r)}function aQ(e,t){let n=iQ(e.position,t);return{type:`rawMdxFallbackMdast`,originalType:e.type??`unknown`,value:n??``,unresolvedPosition:n===null,position:e.position}}function oQ(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``,r=typeof process<`u`&&process.env?.OK_DEBUG_POSITION_SLICE===`1`;dM(e,(e,t,i)=>{if(i!==void 0&&typeof t==`number`&&typeof e.type==`string`&&!nQ.has(e.type)){let r=aQ(e,n);return i.children[t]=r,cM}if(`children`in e&&Array.isArray(e.children)){let t=e;t.children.some(e=>e.type===`text`)&&(JZ(t,n),tQ(t,n))}if(ZZ(e,n,r,i),e.type===`heading`&&i!==void 0&&typeof t==`number`){let n=e.position?.end?.line,r=i.children[t+1],a=r?.position?.start?.line;if(r?.type===`paragraph`&&typeof n==`number`&&typeof a==`number`&&a===n+1){let t=e;t.data??={},t.data.sourceContiguousNext=!0}}})}}function sQ(e,t){let n={type:`mdxJsxFlowElement`,name:`MermaidFence`,attributes:[{type:`mdxJsxAttribute`,name:`chart`,value:e}],children:[]};return t&&(n.position=t),n}function cQ(){return e=>{dM(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`mermaid`)return;let r=sQ(typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}function lQ(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}const uQ=(e,t)=>{if(lQ(e,t))return 0;let n=t.data?.sourcePrecedingBlankLines;if(typeof n==`number`&&n>=2)return n;let r=e.position,i=t.position;if(!r||!i)return;let a=i.start.line-r.end.line-1;return a>=1?a:void 0},dQ=OV(),fQ=KB(),pQ=qB();function mQ(){let e=this.data();e.micromarkExtensions||=[],e.fromMarkdownExtensions||=[],e.toMarkdownExtensions||=[];let t=e.micromarkExtensions;t.some(e=>e===dQ)||t.push(dQ);let n=e.fromMarkdownExtensions;n.some(e=>e===fQ)||n.push(fQ);let r=e.toMarkdownExtensions;r.some(e=>e===pQ)||r.push(pQ)}const hQ=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function gQ(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;dM(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`$`)===-1)return;hQ.lastIndex=0;let a=[],o;for(;(o=hQ.exec(i))!==null;)a.push(o);if(a.length===0)return;let s=[],c=0;for(let t of a){let r=t.index,a=r+t[0].length;if(r>c){let t={type:`text`,value:i.slice(c,r)},a=rZ(n,e,c,r);a&&(t.position=a),s.push(t)}let o={type:`inlineMath`,value:t[1]},l=rZ(n,e,r,a);l&&(o.position=l),s.push(o),c=a}if(c<i.length){let t={type:`text`,value:i.slice(c)},r=rZ(n,e,c,i.length);r&&(t.position=r),s.push(t)}return r.children.splice(t,1,...s),[cM,t+s.length]})}}const _Q={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[a-zA-Z]`}]};function vQ(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===_Q)||e.toMarkdownExtensions.push(_Q)}const yQ=/(?<!\uE102)<br[ \t]*\/?>/g,bQ=new Set([`mdxJsxTextElement`,`mdxJsxFlowElement`]);function xQ(e,t){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value;yQ.lastIndex=0;let a=[],o=0;for(;;){let n=yQ.exec(e);if(n===null)break;let s=n.index;if(s>o){let n={type:`text`,value:e.slice(o,s)},r=rZ(t,i,o,s);r&&(n.position=r),a.push(n)}let c={type:`break`,data:{sourceStyle:`html`,sourceRaw:n[0]}},l=rZ(t,i,s,s+n[0].length);l&&(c.position=l),a.push(c),o=s+n[0].length,r=!0}if(a.length===0)n.push(i);else{if(o<e.length){let n={type:`text`,value:e.slice(o)},r=rZ(t,i,o,e.length);r&&(n.position=r),a.push(n)}n.push(...a)}}r&&(e.children=n)}function SQ(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;dM(e,e=>{if(bQ.has(e.type))return cM;let t=e;Array.isArray(t.children)&&xQ(e,n)})}}const CQ={name:`wikiLink`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===91?(e.enter(`wikiLink`),e.enter(`wikiLinkMarker`),e.consume(t),s):n(t)}function s(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),c):n(t)}function c(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),d(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),l):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),r++,c)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),d(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),i++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),d(t)):(e.consume(t),a++,u)}function d(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),f):n(t)}function f(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLink`),t):n(r)}}},wQ={name:`wikiLinkEmbed`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===33?(e.enter(`wikiLinkEmbed`),e.enter(`wikiLinkEmbedBang`),e.consume(t),e.exit(`wikiLinkEmbedBang`),s):n(t)}function s(t){return t===91?(e.enter(`wikiLinkMarker`),e.consume(t),c):n(t)}function c(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),l):n(t)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),f(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),u):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),r++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),f(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),i++,u)}function d(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),f(t)):(e.consume(t),a++,d)}function f(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),p):n(t)}function p(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLinkEmbed`),t):n(r)}}};function TQ(){return{text:{91:CQ,33:wQ}}}function EQ(e){this.enter({type:`wikiLink`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function DQ(e){this.enter({type:`wikiLinkEmbed`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function OQ(e){return e.stack[e.stack.length-1]}function kQ(e){let t=OQ(this),n=this.sliceSerialize(e);t.data.target=n.trim(),n!==t.data.target&&(t.data.sourceTarget=n)}function AQ(e){let t=OQ(this),n=this.sliceSerialize(e),r=n.trim();t.data.anchor=r.length?r:null,t.data.anchor!==null&&n!==r&&(t.data.sourceAnchor=n)}function jQ(e){let t=OQ(this),n=this.sliceSerialize(e),r=n.trim();t.data.alias=r.length?r:null,t.data.alias!==null&&n!==r&&(t.data.sourceAlias=n)}function MQ(e){let{target:t,anchor:n,alias:r}=e.data,i=r||(n?`${t}#${n}`:t);e.value=i,e.children=[{type:`text`,value:i}]}function NQ(e){MQ(OQ(this)),this.exit(e)}function PQ(e){MQ(OQ(this)),this.exit(e)}const FQ={enter:{wikiLink:EQ,wikiLinkEmbed:DQ},exit:{wikiLinkTarget:kQ,wikiLinkAnchor:AQ,wikiLinkAlias:jQ,wikiLink:NQ,wikiLinkEmbed:PQ}};function IQ(e,t){return typeof e==`string`&&e.trim()===t?e:t}const LQ={handlers:{wikiLink:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`[[${IQ(t.data?.sourceTarget,n)}`;return r&&(a+=`#${IQ(t.data?.sourceAnchor,r)}`),i&&(a+=`|${IQ(t.data?.sourceAlias,i)}`),`${a}]]`},wikiLinkEmbed:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`![[${n}`;return r&&(a+=`#${r}`),i&&(a+=`|${i}`),`${a}]]`}},unsafe:[{character:`[`,inConstruct:[`phrasing`]}]},RQ=TQ();function zQ(){let e=this.data();e.micromarkExtensions||=[],e.micromarkExtensions.some(e=>e===RQ)||e.micromarkExtensions.push(RQ),e.fromMarkdownExtensions||=[],e.fromMarkdownExtensions.some(e=>e===FQ)||e.fromMarkdownExtensions.push(FQ),e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===LQ)||e.toMarkdownExtensions.push(LQ)}function BQ(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}const VQ=[{name:`remark-parse`,plugin:oB},{name:`remark-mdx-agnostic`,plugin:mQ},{name:`remark-gfm`,plugin:tR},{name:`remark-math`,plugin:xz,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:zQ},{name:`remark-github-alerts`,plugin:lz,options:$X},{name:`callout-transformer`,plugin:QX},{name:`restore-from-mdx`,plugin:kX},{name:`void-br-promoter`,plugin:SQ},{name:`restore-entity-refs`,plugin:LX},{name:`restore-backslash-escapes`,plugin:BX},{name:`details-accordion-promoter`,plugin:AZ},{name:`image-promoter`,plugin:RZ},{name:`indented-code-promoter`,plugin:WZ},{name:`math-promoter`,plugin:KZ},{name:`single-dollar-math-promoter`,plugin:gQ},{name:`highlight-promoter`,plugin:LZ},{name:`mermaid-promoter`,plugin:cQ},{name:`comment-promoter`,plugin:oZ},{name:`merged-post-parse-walker`,plugin:oQ},{name:`ensure-non-empty-doc`,plugin:()=>BQ}];function HQ(e){let t=dR();for(let e of VQ)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(FR,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function UQ(e){let t=dR().use(az,[`yaml`]).use(tR,{tablePipeAlign:!1}).use(xz,{singleDollarTextMath:!1}).use(mQ).use(zQ).use(vQ).use(nR,{bullet:`-`,fences:!0,rule:`-`,join:[uQ],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function WQ(e){return e.charCodeAt(0)===65279?{source:e.slice(1),hadBom:!0}:{source:e,hadBom:!1}}const GQ=/^\n+$/,KQ=/^\n{2,}$/;function qQ(e,t,n){let r,i,a,o=e.children;if(o.length>0){let e=o[0]?.position?.start?.offset;if(typeof e==`number`&&e>0){let n=t.slice(0,e);GQ.test(n)&&(r=n)}let n=o[o.length-1]?.position?.end?.offset;if(typeof n==`number`&&n<=t.length){let e=t.slice(n);KQ.test(e)&&(i=e)}let s=[],c=!1;for(let e=1;e<o.length;e++){let n=o[e-1]?.position?.end?.offset,r=o[e]?.position?.start?.offset,i=null;if(typeof n==`number`&&typeof r==`number`&&r>=n){let e=t.slice(n,r);RegExp(`^\\n{3,}$`).test(e)&&(i=e.length-1,c=!0)}s.push(i)}c&&(a=s)}if(!n&&r===void 0&&i===void 0&&!a)return;let s={...n?{bom:!0}:{},...r===void 0?{}:{leading:r},...i===void 0?{}:{trailing:i},...a?{gapBlankLines:a}:{}};return e.data??={},e.data.sourceDocBoundary=s,s}function JQ(e){if(typeof e!=`object`||!e)return;let t=e,n={};return t.bom===!0&&(n.bom=!0),typeof t.leading==`string`&&GQ.test(t.leading)&&(n.leading=t.leading),typeof t.trailing==`string`&&KQ.test(t.trailing)&&(n.trailing=t.trailing),Array.isArray(t.gapBlankLines)&&t.gapBlankLines.every(e=>e===null||typeof e==`number`&&Number.isInteger(e)&&e>=2)&&(n.gapBlankLines=t.gapBlankLines),n.bom||n.leading||n.trailing||n.gapBlankLines?n:void 0}function YQ(e,t){let{source:n,hadBom:r}=WQ(e),i=yZ(n),a=new Ij(PX(DX(zX(i)))),o=t.parse(a);a.value=i;let s=t.runSync(o,a),c=qQ(s,i,r),l=t.stringify(s);return c?l.type.create({...l.attrs,sourceDocBoundary:c},l.content,l.marks):l}function XQ(e,t){let{source:n,hadBom:r}=WQ(e),i=yZ(n),a=new Ij(PX(DX(zX(i)))),o=t.parse(a);a.value=i;let s=t.runSync(o,a);return qQ(s,i,r),s}function ZQ(e,t,n){let r=LR(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers}),i=JQ(e.attrs?.sourceDocBoundary),a=i?.gapBlankLines;if(a&&a.length===r.children.length-1)for(let e=1;e<r.children.length;e++){let t=a[e-1];if(typeof t==`number`){let n=r.children[e];n.data??={},n.data.sourcePrecedingBlankLines=t}}let o=String(t.stringify(r));return i?.leading&&(o=i.leading+o),i?.trailing&&(o=o.replace(/\n+$/,``)+i.trailing),i?.bom&&(o=`\uFEFF${o}`),o}function QQ(){return typeof process>`u`||!process.env?!1:process.env.NODE_ENV===`development`||process.env.NODE_ENV===`test`}function $Q(e){let t=e.lastIndexOf(`/`);return t===-1?``:t===0?`/`:e.slice(0,t)}function e$(e,t){let n=e?`${e}/${t}`:t,r=n.startsWith(`/`),i=[];for(let e of n.split(`/`))if(!(e===``||e===`.`)){if(e===`..`){let e=i[i.length-1];i.length>0&&e!==`..`?i.pop():r||i.push(`..`);continue}i.push(e)}let a=i.join(`/`);return r?`/${a}`:a}function t$(e,t){if(typeof e!=`string`||e===``||!t||e.startsWith(`/`)||!wK(e))return e;let n=e$($Q(t),e);return n===``||n===`..`||n.startsWith(`../`)?(QQ()&&console.warn(`[resolve-image-url] doc-relative path escapes contentDir; emitting raw URL: ${e} (from sourcePath ${t})`),e):`/${n}`}const n$=Object.assign(S$,{peek:()=>`$`}),r$=Object.assign(C$,{peek:()=>`~`}),i$=(()=>{for(let e of pQ.extensions??[]){let t=e?.handlers?.mdxJsxFlowElement;if(typeof t==`function`)return t}throw Error(`mdast-util-mdx-jsx mdxJsxFlowElement to-markdown handler not found — the dirty MDX JSX serialize path cannot bind. Likely a breaking change in mdast-util-mdx-jsx (pinned in the root overrides); re-run the markdown-pipeline upgrade protocol (test:fidelity).`)})(),a$=/^[ \t]*(?:$|#{1,6}(?:[ \t]|[ \t]*$)|>|(?:[-+*]|\d{1,9}[.)])[ \t]|`{3,}|~{3,}|=+[ \t]*$|-+[ \t]*$|(?:\*[ \t]*){3,}$|(?:_[ \t]*){3,}$)/,o$={text(e,t,n,r){if(typeof e.data?.sourceRaw==`string`&&aq(e.data.sourceRaw,e.value??``))return e.data.sourceRaw;if(e.data?.escapedChars?.length){let t=e.value??``,i=e.data.escapedChars,a=``,o=0;for(let{offset:e,char:s}of i)e>o&&(a+=m$(n,t.slice(o,e),{...r,before:r.before+a,after:`\\`})),a+=`\\${s}`,o=e+1;return o<t.length&&(a+=m$(n,t.slice(o),{...r,before:r.before+a})),a}return m$(n,(e.value??``).replaceAll(`\xA0`,` `),r)},emphasis(e,t,n,r){let i=e.data?.sourceDelimiter??`*`,a=n.createTracker(r),o=n.enter(`emphasis`),s=a.move(i);return s+=y$(n.containerPhrasing(e,{before:s,after:i,...a.current()}),r,i),s+=a.move(i),o(),s},strong(e,t,n,r){let i=e.data?.sourceDelimiter??`**`,a=n.createTracker(r),o=n.enter(`strong`),s=a.move(i);return s+=y$(n.containerPhrasing(e,{before:s,after:i,...a.current()}),r,i),s+=a.move(i),o(),s},link(e,t,n,r){if(e.data?.sourceStyle===`autolink`)return`<${e.url??``}>`;if(e.data?.sourceStyle===`gfm-autolink`){let t=e.children?.length===1?e.children[0]:null;if(t?.type===`text`&&typeof t.value==`string`)return t.value}let i=n.createTracker(r),a=n.enter(`link`),o=n.enter(`label`),s=i.move(`[`);s+=i.move(n.containerPhrasing(e,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`),l=String(e.url??``),u=e.data?.sourceUrlForm===`angle-bracketed`,d=l.startsWith(`<`)&&l.endsWith(`>`),f=u&&!d?`<${l}>`:d$(l);if(s+=i.move(f),c(),e.title){let t=e.data?.sourceTitleMarker??`double`;s+=i.move(u$(e.title,t))}return s+=i.move(`)`),a(),s},image(e,t,n,r){let i=n.createTracker(r),a=n.enter(`image`),o=n.enter(`label`),s=i.move(`})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`);if(s+=i.move(d$(String(e.url??``))),c(),e.title){let t=n.enter(`titleQuote`);s+=i.move(` "`),s+=i.move(n.safe(e.title,{before:s,after:`"`,...i.current()})),s+=i.move(`"`),t()}return s+=i.move(`)`),a(),s},definition(e,t,n,r){let i=e.data?.sourceLayout??`inline`,a=e.data?.sourceTitleMarker??`double`,o=n.enter(`definition`),s=n.createTracker(r),c=n.enter(`label`),l=s.move(`[`);l+=s.move(n.safe(n.associationId(e),{before:l,after:`]`,...s.current()})),l+=s.move(`]:`),c();let u=i===`multiline`?`
|
|
402
|
+
`:` `;l+=s.move(u);let d=String(e.url??``);if(!d||/[\0- ]/.test(d)){let e=n.enter(`destinationLiteral`);l+=s.move(`<`),l+=s.move(n.safe(d,{before:l,after:`>`,...s.current()})),l+=s.move(`>`),e()}else{let e=n.enter(`destinationRaw`);l+=s.move(d$(d)),e()}if(e.title){let t=i===`multiline`?`
|
|
403
|
+
`:` `;l+=s.move(u$(e.title,a,t))}return o(),l},thematicBreak(e){return e.data?.sourceRaw??`---`},break(e,t,n){let r=e.data?.sourceRaw;return typeof r==`string`&&r.length>0?r:n.stack.includes(`tableCell`)||n.stack.includes(`okAtxHeading`)?`<br />`:e.data?.sourceStyle===`backslash`?`\\
|
|
404
404
|
`:`
|
|
405
405
|
`},code(e){let t=e.value??``;if(e.data?.sourceStyle===`indented`){let n=t.split(`
|
|
406
406
|
`),r=e.data.sourceIndents;return Array.isArray(r)&&r.length===n.length?n.map((e,t)=>`${r[t]??(e.length>0?` `:``)}${e}`).join(`
|
|
@@ -408,7 +408,7 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
408
408
|
`)}let n=e.data?.sourceFenceChar===`~`?`~`:"`",r=Math.max(3,e.data?.sourceFenceLength??3),i=RegExp(`^ {0,3}(\\${n}+)[ \\t]*$`);for(let e of t.split(`
|
|
409
409
|
`)){let t=i.exec(e);t&&t[1].length>=r&&(r=t[1].length+1)}let a=e.data?.sourceClosingFenceLength,o=typeof a==`number`&&a>r?a:r,s=e.data?.sourceFenceIndent,c=typeof s==`number`&&s>=1&&s<=3?` `.repeat(s):``,l=e.data?.sourceInfoPadding,u=n.repeat(r),d=e.lang??``,f=`${u}${d&&typeof l==`number`&&l>=1?` `.repeat(l):``}${d}${e.meta?` ${e.meta}`:``}\n${t}\n${n.repeat(o)}`;return c?f.split(`
|
|
410
410
|
`).map(e=>e.length>0?`${c}${e}`:e).join(`
|
|
411
|
-
`):f},inlineCode(e,t,n){let r=e.value??``,i=e.data?.sourceFenceChar===`~`?`~`:"`",a=typeof e.data?.sourceFenceLength==`number`&&e.data.sourceFenceLength>0?e.data.sourceFenceLength:1,o=i==="`"?"`":`~`,s=a;for(;RegExp(`(^|[^${o}])${o.repeat(s)}([^${o}]|$)`).test(r);)s+=1;let c=i.repeat(s);/[^ \r\n]/.test(r)&&(e.data?.sourcePadded===!0||/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||r.startsWith(i)||r.endsWith(i))&&(r=` ${r} `);let l=`${c}${r}${c}`;return n.stack.includes(`tableCell`)?l.replace(/\|/g,`\\$&`):l},inlineMath:
|
|
411
|
+
`):f},inlineCode(e,t,n){let r=e.value??``,i=e.data?.sourceFenceChar===`~`?`~`:"`",a=typeof e.data?.sourceFenceLength==`number`&&e.data.sourceFenceLength>0?e.data.sourceFenceLength:1,o=i==="`"?"`":`~`,s=a;for(;RegExp(`(^|[^${o}])${o.repeat(s)}([^${o}]|$)`).test(r);)s+=1;let c=i.repeat(s);/[^ \r\n]/.test(r)&&(e.data?.sourcePadded===!0||/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||r.startsWith(i)||r.endsWith(i))&&(r=` ${r} `);let l=`${c}${r}${c}`;return n.stack.includes(`tableCell`)?l.replace(/\|/g,`\\$&`):l},inlineMath:n$,delete:r$,heading(e,t,n,r){let i=e.data?.sourceStyle??`atx`,a=e.depth;if(i===`setext`&&(a===1||a===2)){let t=n.containerPhrasing(e,{...r,before:`
|
|
412
412
|
`,after:`
|
|
413
413
|
`}),i=e.data?.sourceUnderlineLength,o=typeof i==`number`&&i>=1?i:Math.max(t.length,3);return`${t}\n${(a===1?`=`:`-`).repeat(o)}`}let o=e.data?.sourceLeadingIndent,s=typeof o==`number`&&o>=1&&o<=3?` `.repeat(o):``,c=e.data?.sourceInteriorSpacing,l=typeof c==`number`&&c>=2?` `.repeat(c):` `,u=`#`.repeat(a),d=n.enter(`okAtxHeading`),f=n.containerPhrasing(e,{...r,before:`${u} `,after:`
|
|
414
414
|
`});d();let p=e.data?.sourceTrailingHashes;if(typeof p==`number`&&p>0){let e=`#`.repeat(p);return f?`${s}${u}${l}${f} ${e}`:`${s}${u} ${e}`}return f?`${s}${u}${l}${f}`:`${s}${u}`},list(e,t,n,r){let i=n.options.bullet||`-`,a=!!e.ordered,o=n.bulletCurrent,s=n.bulletLastUsed;if(!a){let t=e.data?.bulletMarker;(t===`-`||t===`*`||t===`+`)&&(n.bulletCurrent=t)}let c=e.children||[],l=[],u=a?e.data?.listMarkerDelimiter??`.`:null,d=e.start??1;for(let t=0;t<c.length;t++){let o=c[t],s=o.data?.sourceOrdinal,f=typeof s==`number`&&s>=0?s:d+t,p=a?`${f}${u}`:e.data?.bulletMarker??i,m=o.data?.sourceMarkerSpacing,h=typeof m==`number`&&m>=2&&m<=4?m:1,g=` `.repeat(h),_=p;o.checked===!0?_+=`${g}[${o.data?.sourceCheckboxChar===`X`?`X`:`x`}]`:o.checked===!1&&(_+=`${g}[ ]`);let v=o.data?.sourceContinuationIndent,y=p.length+h,b=typeof v==`number`&&v>=y&&v<=y+3?v:y,x=` `.repeat(b),S=o.checked===null||o.checked===void 0?g:` `,C=o.children??[],w=C[0]?.type===`list`,T;if(w){let e=o.checked!==null&&o.checked!==void 0,t=n.containerFlow({...o,children:[C[0]]},r),i=C.slice(1),a=i.length?n.containerFlow({...o,children:i},r):``,s=t.split(`
|
|
@@ -422,39 +422,39 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
422
422
|
|
|
423
423
|
`:`
|
|
424
424
|
`;return l.join(f)},table(e,t,n,r){let i=n.enter(`table`),a=[],o=[],s=e.children??[];for(let e of s){let t=e.children??[],i=[],s=[];for(let e of t){let t=n.enter(`tableCell`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,{...r,before:` `,after:` `});a(),t(),i.push(o);let c=e.data?.sourcePadding;s.push(c&&typeof c.left==`number`&&typeof c.right==`number`?{left:c.left,right:c.right}:null)}a.push(i),o.push(s)}i();let c=e.align??[],l=e.data?.sourceDashCounts,u=a[0]?.length??0,d=a.slice(1).reduce((e,t)=>Math.max(e,t.length),0),f=Math.max(u,d,c.length);if(f===0)return console.warn(JSON.stringify({event:`table-serialize-dropped-empty`,rows:s.length})),``;let p=[];for(let e=0;e<f;e++){let t=c[e],n=``,r=``;t===`center`?(n=`:`,r=`:`):t===`left`?n=`:`:t===`right`&&(r=`:`);let i=l?.[e],a=typeof i==`number`&&i>=1?i:1;p.push(n+`-`.repeat(a)+r)}let m=(e,t)=>{let n=[];for(let r=0;r<f;r++){let i=e[r]??``,a=t[r]??{left:1,right:1};n.push(` `.repeat(a.left)+i+` `.repeat(a.right))}let r=v&&!v.leading?``:`|`,i=v&&!v.trailing?``:`|`;return`${r}${n.join(`|`)}${i}`},h=e.data?.sourceAlignmentPadding,g=Array.from({length:f},(e,t)=>{let n=h?.[t];return n&&typeof n.left==`number`&&typeof n.right==`number`?n:null}),_=e.data?.sourceOuterPipes,v=_&&f>=2&&a.every(e=>{let t=(e[0]??``).trim(),n=(e[f-1]??``).trim();return(_.leading||t.length>0)&&(_.trailing||n.length>0&&!n.endsWith(`\\`))})?_:null;if(a.length===0)return m(p,g);let y=[];y.push(m(a[0],o[0]??[])),y.push(m(p,g));for(let e=1;e<a.length;e++)y.push(m(a[e],o[e]??[]));return y.join(`
|
|
425
|
-
`)},mdxJsxFlowElement(e,t,n,r){let i=e,a=i.data?.sourceRaw;if(typeof a==`string`)return a;let o=i.data?.htmlBoundary;if(o&&typeof o.opener==`string`&&typeof o.closer==`string`){let e=n.containerFlow({type:`root`,children:i.children??[]},r);return`${o.opener}\n\n${e}\n\n${o.closer}`}let s=i.name??``,c=
|
|
426
|
-
]|$)`};return delete t._compiled,t});let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return
|
|
427
|
-
`||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function y$(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&v$(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=_$(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function b$(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=t.before??``,a=t.after??``,o=e,s=o.charCodeAt(0);x$(i.charCodeAt(i.length-1),s,r)&&(o=S$(s)+o.slice(1));let c=o.charCodeAt(o.length-1);return x$(a.charCodeAt(0),c,r)&&(o=o.slice(0,-1)+S$(c)),o}function x$(e,t,n){return!(UN(t)!==1||n===`_`&&UN(e)===void 0)}function S$(e){return`&#x${e.toString(16).toUpperCase()};`}function C$(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!T$(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function w$(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=b$(n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),r,i),s+=a.move(i),o(),s}function T$(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}function E$(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var D$=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};freshnessHolder={checker:void 0};constructor(e){this.schema=_b(e.extensions),this.handlers=L$(this.schema,this.parseCtx),this.freshnessHolder.checker=e.deriveStructuralFreshness?qJ({parse:e=>this.parseWithFallback(e)}):void 0;let{nodeHandlers:t,markHandlers:n}=R$(this.schema,this.freshnessHolder);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=UQ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=WQ({toMarkdownHandlers:s$})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return XQ(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?ZQ(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?ZY(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e,t){let n;try{n=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}let r=this.freshnessHolder.checker;t?.skipFreshnessDerive&&(this.freshnessHolder.checker=void 0);try{return QQ(n,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}finally{this.freshnessHolder.checker=r}}};const O$=zY();function k$(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else i?.type===`boolean`?r[e]=t.value===`true`:r[e]=t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function A$(e){let t=!1;return e.descendants(e=>t||e.type.name===`jsxInline`?!1:e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function j$(e,t){return e.attrs.sourceDirty||A$(e)?!0:t?t.isDiverged(e.toJSON()):!1}function M$(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0?!0:t.every(e=>e.type===`text`&&e.value===``)}function N$(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function P$(e,t){if(e.length===0)return N$({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return N$({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[P$(n.children,t)]}}return N$({type:`inlineCode`,value:F$(e)},t)}function F$(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=F$(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const I$=Vc;function L$(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=MR(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=MR(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=n$(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},n.imageReference?i.imageReference=e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i)return r.sourceLiteral?e.text(n,[r.sourceLiteral.create({sourceRaw:i})]):e.text(n);let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n);let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&iq(t.raw)!==null&&tq(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length);if(i)if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=iq(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i));u=t.offset+t.length}}if(u<n.length){let t=n.slice(u);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=NR(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=NR(r.highlight)),r.comment&&(i.comment=NR(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=MR(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=NR(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=NR(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=MR(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??null}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`,sourceRaw:e.data?.sourceRaw??null})),n.list&&(i.list=MR(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=MR(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:``,title:null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=O$.getOrWildcard(o),c=k$(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=n$(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=yq(o),{resolveEmbed:u,sourcePath:d}=t.current,f=u&&d?u(o,d)??null:null,p=f?`/${f}`:o,m=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(m&&I$.has(l)&&n.jsxComponent&&O$.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,alt:s??o,target:o,anchor:c,alias:s}});if(m&&Hc.has(l)&&n.jsxComponent&&O$.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&Wc.has(l)&&n.jsxComponent&&O$.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&Gc.has(l)&&n.jsxComponent&&O$.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:E$(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if(r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=MR(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function R$(e,t){let n={},r={},i=e.nodes,a=e.marks;i.paragraph&&(n.paragraph=RR(`paragraph`)),i.blockquote&&(n.blockquote=RR(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),i.heading&&(n.heading=RR(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??void 0}}))),i.codeBlock&&(n.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),i.thematicBreak&&(n.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),i.hardBreak&&(n.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle,...typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0?{sourceRaw:e.attrs.sourceRaw}:{}}})),i.list&&(n.list=RR(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),i.listItem&&(n.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&M$(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},children:i}}),i.table&&(n.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c={};Array.isArray(s)&&s.length>0&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),i.tableRow&&(n.tableRow=RR(`tableRow`));let o=(e,t)=>{let n={type:`tableCell`,children:yJ(t)},r=e.attrs.sourcePadding;return typeof r==`object`&&r&&typeof r.left==`number`&&typeof r.right==`number`&&(n.data={sourcePadding:r}),n};if(i.tableCell&&(n.tableCell=(e,t,n)=>o(e,n.all(e))),i.tableHeader&&(n.tableHeader=(e,t,n)=>o(e,n.all(e))),i.image&&(n.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),i.imageReference&&(n.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),i.htmlBlock&&(n.htmlBlock=e=>({type:`html`,value:e.attrs.content})),i.linkDefinition??i.linkRefDef){let e=i.linkDefinition?`linkDefinition`:`linkRefDef`;n[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(i.jsxComponent&&(n.jsxComponent=(e,n,r)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let i=e.attrs.componentName||null,a=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!j$(e,t.checker)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:i,attributes:a,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:O$.getOrWildcard(i??`*`).serialize(e,{all:e=>r.all(e),registry:O$,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),i.rawMdxFallback&&(n.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),i.jsxInline&&(n.jsxInline=e=>{let t=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:null,attributes:[],children:[],data:{sourceRaw:String(t)}}}),i.mathInline&&(n.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),i.wikiLink&&(n.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},children:[{type:`text`,value:i}]}}),i.tag&&(n.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),i.wikiLinkEmbed&&(n.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),a.emphasis&&(r.emphasis=zR(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.strong&&(r.strong=zR(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.code&&(r.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return P$(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0?!0:void 0})}),a.strike??a.delete){let e=a.strike?`strike`:`delete`;r[e]=zR(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return a.highlight&&(r.highlight=zR(`mark`)),a.comment&&(r.comment=zR(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),i.commentBlock&&(n.commentBlock=RR(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),i.footnoteReference&&(n.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),i.footnoteDefinition&&(n.footnoteDefinition=RR(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),a.link&&(r.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=i||(r?`${t}#${r}`:t),o=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return o!==a&&o.trim().length>0&&!o.includes(`]]`)&&(i=o,a=o),{type:`wikiLinkEmbed`,value:a,data:{target:t,anchor:r,alias:i},children:[{type:`text`,value:a}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),a.escapeMark&&(r.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data??={},t.data.escapedChars??=[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),a.sourceLiteral&&(r.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return oq(t,e.value)&&(e.data??={},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:n,markHandlers:r}}const z$=/\p{M}+/gu,B$=/[^\p{L}\p{N}]+/gu,V$=/^-+|-+$/g;function H$(e){return e.trim().normalize(`NFKD`).replace(z$,``).toLowerCase().replace(B$,`-`).replace(V$,``)}function U$(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function W$(e,t){let n=H$(e);return n?U$(n,t):``}const G$=new Set([`img`,`video`,`audio`,`mark`]);new Map(LY.flatMap(e=>e.surface===`compat`&&G$.has(e.rendersAs)?[[e.name,e]]:[])),GF(`<>`);const K$=OV(),q$=KB(),J$=qB();function Y$(){return LY.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function X$(){return Y$().filter(e=>Z$(e)!==`fence`)}function Z$(e){return e.name===`MermaidFence`?`fence`:e.hasChildren?`jsx-block`:`jsx-void`}function Q$(e){return{id:e.name,displayName:e.displayName??e.name,description:e.description??``,kind:Z$(e)}}function $$(e){if(e.hidden!==!0&&e.type!==`reactnode`){if(`defaultValue`in e&&e.defaultValue!==void 0)return e.defaultValue;if(e.type===`enum`)return e.enumValues[0];if(e.type===`string`)return``;if(e.type===`number`)return 0;if(e.type===`boolean`)return!1}}function e1(e,t){return!(e.omitOnDefault===!0&&`defaultValue`in e&&Object.is(e.defaultValue,t)||e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&t===``)}function t1(e){let t=[];for(let n of e.props){let e=$$(n);e!==void 0&&e1(n,e)&&t.push(XJ(n.name,e))}return t}function n1(e){return eB(e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`Body content here.`,{extensions:[K$],mdastExtensions:[q$]}).children}function r1(e){let t=Z$(e),n;if(t===`fence`)n={type:`code`,lang:`mermaid`,meta:null,value:e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`graph LR
|
|
428
|
-
A --> B`};else{let r=
|
|
429
|
-
`)}const s1=[`text`,`number`,`boolean`,`date`,`list`,`object`];F(s1);const c1=$s([A(),j(),M()]),l1=kc(()=>$s([c1.transform(e=>String(e)),ac(A(),u1),N(l1)])),u1=kc(()=>$s([A(),j(),M(),N(l1),ac(A(),u1)]));function d1(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(d1(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:d1(r);return t}return e}const f1=Pc(d1,ac(A(),u1));ac(A(),$s([u1,Hs()]));function p1(e){return!!(e===null||typeof e==`string`&&e===``||Array.isArray(e)&&e.length===0)}const m1=P({docName:Oq,summary:Aq,content:A().optional(),...kq}).loose(),h1=P({docName:Oq,summary:Aq,markdown:A(),position:F([`append`,`prepend`,`replace`]).optional(),extension:F(VG).optional(),...kq}).loose(),g1=P({docName:Oq,summary:Aq,find:A().min(1),replace:A(),offset:j().int().nonnegative().optional(),...kq}).loose(),_1=P({docName:Oq,connectionId:A().min(1),scope:F([`last`,`session`,`file`]).optional(),...kq}).loose(),v1=P({value:A(),truncatedFrom:j().int().nonnegative().optional(),hint:A().optional()}).loose(),y1=tc(`kind`,[P({kind:I(`inline`),content:A()}),P({kind:I(`truncated`),byteLength:j().int().nonnegative(),hint:A()})]),b1=P({kind:I(`content-divergence`),intendedBytes:j().int().nonnegative(),actualBytes:j().int().nonnegative(),byteDelta:j().int(),divergenceType:A().optional(),currentState:y1.optional(),hint:A().optional()}).loose(),x1=P({type:I(`orphan`),parentCandidates:N(A()),message:A()}).loose(),S1=P({kind:I(`disk-edit-reconciled`),intendedBytes:j().int().nonnegative(),actualBytes:j().int().nonnegative(),byteDelta:j().int(),mergeOutcome:A().optional(),hint:A().optional()}).loose(),C1=tc(`kind`,[b1,S1]),w1=tc(`kind`,[b1,S1,P({kind:I(`mermaid-parse-error`),fenceIndex:j().int().positive(),fenceFirstLine:A(),message:A(),line:j().int().positive().optional()}).loose()]),T1=N(w1).min(1),E1=P({href:A(),resolvedTo:A().nullable(),reason:F([`no-such-doc`,`no-such-file`,`unresolvable`])}).loose(),D1=N(E1),O1=P({timestamp:A().min(1),summary:v1.optional(),warning:C1.optional(),warnings:T1.optional()}).loose(),k1=P({timestamp:A().min(1),subscriberCount:j().int().nonnegative(),systemSubscriberCount:j().int().nonnegative(),hints:N(x1).optional(),summary:v1.optional(),warning:C1.optional(),warnings:T1.optional(),brokenLinks:D1}).loose(),A1=P({timestamp:A().min(1),subscriberCount:j().int().nonnegative(),systemSubscriberCount:j().int().nonnegative(),summary:v1.optional(),warning:C1.optional(),warnings:T1.optional(),brokenLinks:D1}).loose(),j1=P({docName:A().min(1),scope:F([`last`,`session`]),undone:M()}).loose(),M1=P({docName:Oq,patch:ac(A(),$s([u1,Hs()])),types:ac(A(),F(s1)).optional(),summary:Aq,...kq}).loose(),N1=P({timestamp:A().min(1),subscriberCount:j().int().nonnegative(),systemSubscriberCount:j().int().nonnegative(),appliedKeys:N(A()),summary:v1.optional(),warning:C1.optional(),warnings:T1.optional(),brokenLinks:D1}).loose(),P1=P({entries:N(P({level:F([`info`,`warn`,`error`]),message:A().max(8192),event:A().optional(),fields:ac(A(),Ks()).optional(),ts:j().optional(),sourceId:A().optional(),lineNumber:j().optional()}).loose()).max(100)}).loose(),F1=P({accepted:j().int().min(0)}).loose(),I1=P({status:A().min(1),reason:A()}).loose(),L1=P({docName:A().min(1),content:A(),lifecycle:I1.nullable()}).loose(),R1=P({documents:N(P({kind:F([`document`,`asset`,`folder`,`file`]).default(`document`),docName:A().min(1).optional(),docExt:A().min(1).default(`.md`),size:j().int().nonnegative(),modified:A().min(1),isSymlink:M().default(!1),canonicalDocName:A().nullable().default(null),targetPath:A().nullable().default(null),path:A().min(1).optional(),assetExt:A().min(1).optional(),mediaKind:F([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`]).nullable().optional(),referencedBy:N(A().min(1)).optional(),hasChildren:M().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:M().optional()}).loose(),z1=P({source:A().min(1),anchor:A().nullable(),title:A(),snippet:A().nullable()}).loose(),B1=P({docName:A().min(1),backlinks:N(z1)}).loose(),V1=P({counts:ac(A().min(1),j().int().nonnegative())}).loose(),H1=tc(`kind`,[P({kind:I(`doc`),docName:A().min(1),anchor:A().nullable(),title:A(),snippet:A().nullable()}).loose(),P({kind:I(`external`),url:A().min(1),title:A(),snippet:A().nullable()}).loose()]),U1=P({docName:A().min(1),forwardLinks:N(H1)}).loose(),W1=tc(`kind`,[P({id:A().min(1),kind:I(`doc`),docName:A().min(1),anchor:A().nullable(),label:A(),cluster:A().nullable(),category:A().nullable(),tags:N(A()).nullable()}).loose(),P({id:A().min(1),kind:I(`external`),url:A().min(1),label:A()}).loose()]),G1=P({source:A().min(1),target:A().min(1)}).loose(),K1=P({nodes:N(W1),links:N(G1)}).loose(),q1=P({ts:j().int().min(0),url:A(),method:A(),ua:A().optional(),origin:A().optional(),referer:A().optional(),host:A().optional(),remote:A().optional(),secChUa:A().optional(),secChUaMobile:A().optional(),secChUaPlatform:A().optional(),secFetchSite:A().optional(),secFetchDest:A().optional(),secFetchMode:A().optional(),secFetchUser:A().optional()}).loose(),J1=P({app:$s([I(`cursor`),I(`codex`),I(`claude`),Hs()]),signals_fired:N(A())}).loose(),Y1=P({entries:N(q1),count:j().int().min(0),detection:J1}).loose(),X1=P({writers:N(P({id:A().min(1),name:A().optional(),email:A().optional()}).loose()).optional(),summary:Aq,...kq}).loose(),Z1=P({checkpointRef:A().min(1)}).loose(),Q1=P({v:j().int().optional(),id:A().min(1),name:A().min(1),colorSeed:A().optional(),docs:N(A()),summaries:N(A()).optional()}).loose(),$1=P({entries:N(P({sha:A().min(1),timestamp:A().min(1),author:A(),authorEmail:A(),type:F([`checkpoint`,`wip`,`upstream`,`park`]),message:A(),contributors:N(Q1),checkpoint:Ks().nullable()}).loose()),total:j().int().nonnegative().optional(),truncated:M().optional(),hasMore:M().optional()}).loose(),e0=P({sha:A().regex(/^[0-9a-f]{40}$/i),content:A(),timestamp:A(),author:A()}).loose(),t0=P({contentDir:A().min(1),pathSeparator:F([`/`,`\\`]),symlinkResolved:M()}).loose(),n0=N(tc(`source`,[P({docName:A().min(1),timestamp:A().min(1),size:j().int().nonnegative(),source:I(`flat`)}).loose(),P({docName:A().min(1),timestamp:A().min(1),source:I(`timeline`),sha:A().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),r0=P({domain:A().min(1),title:A().optional(),description:A().optional(),siteName:A().optional(),faviconDataUri:A().optional()}).loose(),i0=P({url:A()}).loose(),a0=tc(`ok`,[P({ok:I(!0),metadata:r0}).loose(),P({ok:I(!1),reason:A()}).loose()]),o0=P({orphans:N(P({docName:A().min(1),title:A()}).loose())}).loose(),s0=P({hubs:N(P({docName:A().min(1),title:A(),count:j().int().nonnegative()}).loose())}).loose(),c0=P({source:A().min(1),title:A(),snippet:A().nullable()}).loose(),l0=P({deadLinks:N(P({target:A().min(1),sources:N(c0)}).loose())}).loose(),u0=P({target:P({docName:A().min(1),title:A(),aliases:N(A())}).loose(),mentions:N(P({source:A().min(1),excerpt:A(),offset:j().int().nonnegative()}).loose()),truncated:M()}).loose(),d0=P({projectPath:A().min(1)}).loose(),f0=F([`not-a-git-worktree`,`init-failed`]),p0=tc(`ok`,[P({ok:I(!0),projectPath:A().min(1)}).loose(),P({ok:I(!1),reason:f0,message:A().min(1)}).loose()]),m0=P({host:A().min(1).optional()}).loose(),h0=P({key:A().min(1)}).loose(),g0=P({keyPresent:M()}).loose(),_0=P({name:A().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:A().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),v0=P({authenticated:M()}).loose(),y0=P({}).loose(),b0=P({stackIndex:j().int().min(0),ts:j().int().min(0),additions:j().int().min(0),deletions:j().int().min(0)}).loose(),x0=P({docName:A().min(1),additionsTotal:j().int().min(0),deletionsTotal:j().int().min(0),lastTs:j().int().min(0),bursts:N(b0)}).loose(),S0=P({displayName:A().min(1),color:A().min(1),icon:A().optional(),connectionId:A().min(1)}).loose(),C0=P({sessionAlive:M(),agent:S0.nullable(),files:N(x0)}).loose(),w0=P({diff:A(),generatedAt:j().int().min(0)}).loose(),T0=P({}).loose(),E0=P({}).loose(),D0=P({}).loose(),O0=P({}).loose(),k0=P({}).loose(),A0=P({}).loose(),j0=P({displayName:A().min(1),icon:A(),color:A().min(1),currentDoc:A().nullable(),mode:F([`idle`,`writing`]),ts:j().int().min(0)}).loose(),M0=P({presence:ac(A().min(1),j0)}).loose(),N0=ac(A().min(1),M()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});P({path:A().min(1,`path must be non-empty`)}).loose();const P0=P({}).loose(),F0=P({fromDocName:A().min(1),toDocName:A().min(1)}).loose(),I0=P({fromPath:A().min(1),toPath:A().min(1)}).loose(),L0=P({}).loose(),R0=P({path:A().min(1),...kq,summary:Aq}).loose(),z0=P({docName:A().min(1)}).loose(),B0=P({path:A().min(1),...kq,summary:Aq}).loose(),V0=P({path:A().min(1)}).loose(),H0=P({kind:F([`file`,`folder`]),path:A().min(1),...kq,summary:Aq}).loose(),U0=P({kind:F([`file`,`folder`]),path:A().min(1),duplicatedDocNames:N(A().min(1))}).loose(),W0=P({pages:N(P({docName:A().min(1),title:A(),docExt:A().min(1),size:j().int().nonnegative(),modified:A().min(1),icon:A().min(1).max(2048).optional()}).loose())}).loose(),G0=P({level:j().int().min(1).max(6),text:A(),slug:A()}).loose(),K0=P({docName:A().min(1),headings:N(G0)}).loose(),q0=P({docName:A().min(1),rewrites:j().int().nonnegative()}).loose(),J0=P({kind:F([`file`,`folder`,`asset`]),fromPath:A().min(1),toPath:A().min(1),...kq,summary:Aq}).loose(),Y0=P({renamed:N(F0),renamedAssets:N(I0),rewrittenDocs:N(q0).optional(),summary:v1.optional()}).loose(),X0=P({kind:F([`file`,`folder`,`asset`]),path:A().min(1),...kq}).loose(),Z0=P({deletedDocNames:N(A().min(1))}).loose(),Q0=P({kind:F([`file`,`folder`,`asset`]),path:A().min(1),...kq,summary:Aq}).loose(),$0=P({deletedDocNames:N(A().min(1))}).loose(),e2=P({docName:A().min(1),commitSha:A().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:Aq,...kq}).loose(),t2=P({restoredFrom:A().min(1),timestamp:A().min(1),summary:v1.optional(),warning:b1.optional(),warnings:T1.optional()}).loose(),n2=F([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),r2=P({label:A().min(1),webUrl:xs().nullable()}).loose(),i2=tc(`checkStatus`,[P({checkStatus:I(`allowed`)}).loose(),P({checkStatus:I(`denied`),deniedReason:F([`no-collaborator`,`private-no-access`,`repo-not-found`])}).loose(),P({checkStatus:I(`unknown`),unknownError:F([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`]).optional()}).loose()]),a2=F([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),o2=P({state:n2,lastSyncUtc:A().nullable(),lastFetchUtc:A().nullable(),lastPushedSha:A().nullable(),ahead:j().int().min(0),behind:j().int().min(0),consecutiveFailures:j().int().min(0),conflictCount:j().int().min(0),hasRemote:M(),syncEnabled:M(),identityUnresolved:M(),remote:r2.nullable().optional(),pushError:A().optional(),pushErrorCode:a2.optional(),pullError:A().optional(),pullErrorCode:a2.optional(),pausedReason:A().optional(),pushPermission:i2.optional()}).loose(),s2=P({op:F([`sync`,`push`,`pull`]).optional()}).loose(),c2=P({op:F([`sync`,`push`,`pull`])}).loose(),l2=P({conflicts:N(P({file:A().min(1),detectedAt:A().min(1),oursSha:A().optional(),theirsSha:A().optional(),baseSha:A().optional()}).loose())}).loose(),u2=P({file:A().min(1),strategy:F([`mine`,`theirs`,`content`,`delete`]),content:A().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),d2=P({}).loose(),f2=P({file:A().min(1),base:A(),ours:A(),theirs:A(),kind:F([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:A().nullable()}).loose(),p2=P({plan:jc(e=>e!==void 0,{message:`plan is required`})}).loose(),m2=P({plan:jc(e=>e!==void 0,{message:`plan is required`})}).loose(),h2=P({result:jc(e=>e!==void 0,{message:`result is required`})}).loose(),g2=P({path:A().min(1),summary:A().min(1)}).loose(),_2=P({files:j().int().nonnegative(),folders:j().int().nonnegative()}).loose(),v2=P({packs:N(P({id:A().min(1),name:A().min(1),description:A().min(1),defaultSubfolder:A().optional(),folders:N(g2),entryCounts:_2}).loose())}).loose(),y2=P({noOpen:M().optional(),out:A().min(1).optional()}).loose(),b2=P({reason:F([`unsupported-platform`,`spawn-error`]),message:A()}).loose(),x2=tc(`status`,[P({status:I(`installed`),outputPath:A(),size:j().int().nonnegative(),sha256:A(),skillVersion:A()}).loose(),P({status:I(`built`),outputPath:A(),size:j().int().nonnegative(),sha256:A(),skillVersion:A(),handoffError:b2.optional()}).loose(),P({status:I(`failed`),buildError:A()}).loose(),P({status:I(`skip-current`),skillVersion:A(),recordedAt:A().optional()}).loose()]),S2=[`.ok`,`skill-targets.json`],C2=F(qG),w2=Zs({schema:I(1),targets:N(C2).default([])});function T2(e){let t;try{t=JSON.parse(e)}catch{return null}let n=w2.safeParse(t);return n.success?n.data:null}const E2=P({tags:N(P({name:A().min(1),count:j().int().nonnegative(),isLeaf:M()}).loose())}).loose(),D2=P({docName:A().min(1),title:A(),matchingTags:N(A().min(1)),snippet:A().nullable()}).loose(),O2=P({name:A().min(1),docs:N(D2)}).loose(),k2=P({folder:Ks(),frontmatter_local:ac(A(),Ks()).nullable()}).loose(),A2=P({path:A(),frontmatter:ac(A(),Ks()).optional()}).loose(),j2=P({applied:Ks()}).loose(),M2=ac(A(),Ks()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),N2=P({template:P({name:A().min(1),folder:A(),scope:F([`local`,`inherited`]),path:A().min(1),frontmatter:M2,body:A()}).strict()}).strict(),P2=P({templates:N(P({name:A().min(1),title:A().optional(),description:A().optional(),path:A().min(1),source_folder:A()}).strict()),truncated:M()}).strict(),F2=P({folder:A(),name:A(),body:A().optional(),frontmatter:M2.optional(),...kq,summary:Aq}).strict(),I2=P({path:A().min(1),created:M(),warnings:N(A())}).strict(),L2=P({existed:M(),path:A().min(1)}).strict(),R2=P({fromFolder:A(),fromName:A(),toFolder:A(),toName:A(),body:A().optional(),frontmatter:M2.optional(),...kq,summary:Aq}).strict(),z2=P({from:A().min(1),to:A().min(1),committed:M()}).strict(),B2=F(EG),V2=/^[a-z0-9-]+$/,H2=/<\/?[A-Za-z][^>]*>/;function U2(e){return H2.test(e)}const W2=/^[A-Za-z0-9_-]+$/,G2=P({name:A(),description:A()}).strict(),K2=P({skill:P({name:A().min(1),scope:B2,path:A().min(1),frontmatter:G2,body:A(),files:N(P({path:A().min(1),text:A().nullable()})).optional()}).strict()}).strict(),q2=P({skills:N(P({name:A().min(1),description:A().optional(),scope:B2,path:A().min(1),absolutePath:A().min(1).optional(),installed:M(),hosts:N(A()),installedVersion:A().optional(),bundledVersion:A().optional(),updateAvailable:M().optional()}).strict()),truncated:M()}).strict(),J2=P({scope:B2.default(`project`),name:A(),body:A().optional(),frontmatter:G2,...kq,summary:Aq}).strict(),Y2=P({path:A().min(1),created:M(),warnings:N(A())}).strict(),X2=P({scope:B2.default(`project`),name:A(),...kq,summary:Aq}).strict(),Z2=P({name:A().min(1),version:A().min(1),previousVersion:A().optional(),checkpointRef:A().optional()}).strict(),Q2=P({existed:M(),path:A().min(1)}).strict(),$2=P({scope:B2.default(`project`),fromName:A(),toName:A(),body:A().optional(),frontmatter:G2.optional(),...kq,summary:Aq}).strict(),e4=P({from:A().min(1),to:A().min(1),committed:M()}).strict(),t4=F([`reference`,`script`]),n4=P({scope:B2.default(`project`),name:A(),path:A().min(1),content:A(),...kq,summary:Aq}).strict(),r4=P({path:A().min(1),created:M(),kind:t4,content:M()}).strict(),i4=P({path:A().min(1),kind:t4,text:A()}).strict(),a4=P({path:A().min(1),existed:M(),kind:t4}).strict(),o4=P({scope:B2.default(`project`),name:A(),targets:N(C2).optional().meta({description:`Explicit editor ids to install into; omit to use project-configured editors.`}),...kq,summary:Aq}).strict(),s4=P({name:A().min(1),hosts:N(A()),scripts:M(),warnings:N(A()),warningCodes:N(F([`no-targets`,`scripts-present`]))}).strict(),c4=P({scope:B2.default(`project`),name:A()}).strict(),l4=P({name:A().min(1),uninstalled:M()}).strict(),u4=P({targets:N(C2),configured:M()}).strict(),d4=P({targets:N(C2)}).strict(),f4=P({targets:N(C2),reprojected:N(P({name:A(),hosts:N(A())}).strict()),bundleHosts:N(A()),removedFrom:N(A())}).strict(),p4=P({scope:B2.default(`project`),name:A(),version:A().regex(/^[0-9a-f]{40}$/i),...kq,summary:Aq}).strict(),m4=P({name:A().min(1),version:A(),restoredFiles:N(A()),warnings:N(A())}).strict(),h4=P({query:A().optional(),intent:F([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:F([`navigation`,`relevance`]).optional(),scopes:N(F([`page`,`folder`,`content`,`file`])).optional(),scope:A().optional(),limit:j().int().nonnegative().optional(),semantic:M().optional(),source:F([`omnibar`,`mcp`,`http`]).optional()}).loose(),g4=P({kind:F([`page`,`folder`,`content`,`file`]),path:A().min(1),title:A(),score:j(),signals:ac(A(),Ks()),snippet:A().optional()}).loose(),_4=P({capable:M(),applied:M(),coverage:P({embedded:j().int().nonnegative(),total:j().int().nonnegative()})}).loose(),v4=P({enabled:M(),keyPresent:M(),keySource:F([`file`,`env`]).nullable(),keyHint:A().nullable(),ready:M(),capable:M(),embedded:j().int().nonnegative(),total:j().int().nonnegative()}).loose(),y4=P({query:A(),intent:F([`autocomplete`,`full_text`,`omnibar`]),results:N(g4),elapsedMs:j().nonnegative(),semantic:_4.optional(),truncated:M().optional(),ready:M().optional()}).loose(),b4=P({version:A().min(1),recordedAt:A().min(1)}).loose(),x4=P({currentVersion:A().min(1),targets:ac(A(),b4.nullable())}).loose(),S4=`server-info`,C4=`branch-switched`,w4=`disk-ack`,T4=`config-validation-rejected`,E4=`config-ignore-nested-error`,D4=F([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),O4=P({v:I(1),ch:I(S4),seq:j(),serverInstanceId:A().min(1),currentBranch:A().min(1).optional()}).loose(),k4=P({v:I(1),ch:I(C4),seq:j(),branch:A().min(1)}).loose(),A4=P({v:I(1),ch:D4,seq:j()}).loose(),j4=P({v:I(1),ch:I(w4),seq:j(),docName:A().min(1),sv:A().min(1)}).loose(),M4=P({v:I(1),ch:I(T4),seq:j(),docName:A().min(1),error:ql}).loose(),N4=P({v:I(1),ch:I(E4),seq:j(),path:A().min(1),error:A().min(1)}).loose(),P4=new pG.default;function F4(e,t){if(e===t)return[{value:e}];let{chars1:n,chars2:r,lineArray:i}=P4.diff_linesToChars_(e,t),a=P4.diff_main(n,r,!1);P4.diff_charsToLines_(a,i),P4.diff_cleanupSemantic(a);let o=[];for(let[e,t]of a)e===pG.default.DIFF_DELETE?o.push({value:t,removed:!0}):e===pG.default.DIFF_INSERT?o.push({value:t,added:!0}):o.push({value:t});return o}const I4=new pG.default;I4.Diff_Timeout=.25;const L4=256*1024;function R4(e,t,n){if(t===n)return;let r=F4(t,n),i=0;for(let n=0;n<r.length;n++){let a=r[n],o=r[n+1];if(a.removed&&o?.added){if(t.substring(i,i+o.value.length)===o.value){i+=o.value.length,n++;continue}e.delete(i,a.value.length),e.insert(i,o.value),i+=o.value.length,n++}else a.removed?e.delete(i,a.value.length):(a.added&&e.insert(i,a.value),i+=a.value.length)}}function z4(e,t,n){if(t===n)return;if(t.length>L4||n.length>L4){B4(e,t,n);return}let r=I4.diff_main(t,n);I4.diff_cleanupSemantic(r);let i=0;for(let[t,n]of r)t===0?i+=n.length:t===-1?e.delete(i,n.length):t===1&&(e.insert(i,n),i+=n.length)}function B4(e,t,n){let r=0,i=Math.min(t.length,n.length);for(;r<i&&t.charCodeAt(r)===n.charCodeAt(r);)r++;let a=0;for(;a<i-r&&t.charCodeAt(t.length-1-a)===n.charCodeAt(n.length-1-a);)a++;let o=t.length-r-a,s=n.slice(r,n.length-a);o>0&&e.delete(r,o),s.length>0&&e.insert(r,s)}const V4=P({path:N($s([A(),j()])),message:A(),issueCode:A()});tc(`code`,[P({code:I(`SCHEMA_INVALID`),issues:N(V4)}),P({code:I(`WRITE_ERROR`),detail:A()})]);const H4={defaultKeyType:`PLAIN`,defaultStringType:`PLAIN`,lineWidth:0};function U4(e){if(e.trim()===``)return{doc:new Fc.Document({}),map:{}};let t;try{t=(0,Fc.parseDocument)(e)}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new Fc.Document({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=f1.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function W4(e){return Object.keys(e).length===0?``:new Fc.Document(e).toString(H4)}function G4(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K4(e,t,n){if(Array.isArray(n)){let r=e.createNode(n),i=(0,Fc.isSeq)(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}if(G4(n)){let r=e.createNode(n),i=(0,Fc.isMap)(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}return n}function q4(e){return e===``?``:`---\n${e.endsWith(`
|
|
430
|
-
`)?e.slice(0,-1):e}\n---\n`}function
|
|
431
|
-
`)}function
|
|
432
|
-
`)){if(!
|
|
425
|
+
`)},mdxJsxFlowElement(e,t,n,r){let i=e,a=i.data?.sourceRaw;if(typeof a==`string`)return a;let o=i.data?.htmlBoundary;if(o&&typeof o.opener==`string`&&typeof o.closer==`string`){let e=n.containerFlow({type:`root`,children:i.children??[]},r);return`${o.opener}\n\n${e}\n\n${o.closer}`}let s=i.name??``,c=s$(i.attributes??[]);return!i.children||i.children.length===0?s?c?`<${s} ${c} />`:`<${s} />`:``:i$({...i,attributes:(i.attributes??[]).map(l$)},t,n,r)},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=y$(n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),r,`==`),o+=i.move(`==`),a(),o},comment(e,t,n,r){let i=e.data?.sourceForm,a=i===`html`?`<!-- `:`%%`,o=i===`html`?` -->`:`%%`,s=n.createTracker(r),c=n.enter(`comment`),l=s.move(a);return l+=n.containerPhrasing(e,{before:l,after:o,...s.current()}),l+=s.move(o),c(),l},commentBlock(e,t,n,r){let i=n.createTracker(r),a=n.enter(`commentBlock`),o=e.children??[],s=e.data?.sourceForm,c=e.data?.sourceLayout,l=o.length===1&&o[0]?.type===`paragraph`;if(s===`html`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`<!-- `,after:` -->`,...i.current()});return a(),`<!-- ${t} -->`}if(c===`inline`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`%% `,after:` %%`,...i.current()});return a(),`%% ${t} %%`}let u=n.containerFlow(e,i.current());return a(),`%%\n\n${u}\n\n%%`},mdxJsxTextElement(e){let t=e.data?.sourceRaw;if(typeof t==`string`)return t;let n=e.name??``,r=s$(e.attributes??[]);return r?`<${n} ${r} />`:`<${n}/>`},rawMdxFallback(e){return e.value??``},blockquote(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.containerFlow(e,a.current());i();let s=e.data?.sourceMarkerSpacings,c=0;return n.indentLines(o,(e,t,n)=>{if(n)return`>`;let r=c++,i=s?.[r];return i===`lazy`&&r>0&&!a$.test(e)?e:i===`none`||i===0?`>${e}`:typeof i==`number`&&i>=2&&!e.startsWith(` `)?`>${` `.repeat(i)}${e}`:`> ${e}`})}};function s$(e){let t=[];for(let n of e){if(n.type===`mdxJsxExpressionAttribute`){t.push(`{${n.value}}`);continue}let e=n.name;if(n.value===null||n.value===void 0){t.push(e);continue}if(typeof n.value==`string`){n.value.includes(`"`)?t.push(`${e}={${c$(n.value)}}`):t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function c$(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function l$(e){return e.type===`mdxJsxAttribute`&&typeof e.value==`string`&&e.value.includes(`"`)?{type:`mdxJsxAttribute`,name:e.name,value:{type:`mdxJsxAttributeValueExpression`,value:c$(e.value)}}:e}function u$(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function d$(e){if(!e)return``;let t=0,n=!0;for(let r of e)r===`(`?t++:r===`)`&&(t--,t<0&&(n=!1));return t!==0&&(n=!1),n?e:e.replace(/[\\()]/g,`\\$&`)}function f$(e){return e.replace(/(?<!\\)&(?=(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z][A-Za-z0-9]*);)/g,(e,t)=>p$(t)?e:`\\${e}`)}function p$(e){if(e.charCodeAt(0)!==35)return!1;let t=e[1]===`x`||e[1]===`X`?Number.parseInt(e.slice(2),16):Number.parseInt(e.slice(1),10);return t===9||t===10||t===11||t===12||t===13||t===32}function m$(e,t,n){let r=e.unsafe;e.unsafe=r.filter(e=>!(e.character===`&`&&e.after===`[#A-Za-z]`||e.character===`<`||e.character===`[`||e.character===`(`||e.character===`!`&&e.after===`\\[`&&e.inConstruct===`phrasing`||e.character===`@`&&e.before===`[+\\-.\\w]`||e.character===`{`&&Array.isArray(e.inConstruct)&&e.inConstruct.includes(`phrasing`)||e.character==="`"||(e.character===`*`||e.character===`_`||e.character===`~`)&&e.inConstruct===`phrasing`||e.character===`=`&&e.atBreak===!0||e.character===` `&&e.inConstruct===`phrasing`&&e.after===`[\\r\\n]`||e.character===` `&&e.inConstruct===`phrasing`&&e.after===`[\\r\\n]`)),e.unsafe=e.unsafe.map(e=>{if(e.character!==`)`||e.atBreak!==!0||e.before!==`\\d+`||e.after!==void 0)return e;let t={...e,after:`(?:[ \r
|
|
426
|
+
]|$)`};return delete t._compiled,t});let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return f$(v$(i,n))}function h$(e){if(Number.isNaN(e))return`ws`;let t=UN(e);return t===1?`ws`:t===2?`punct`:`other`}function g$(e,t,n){let r=h$(t),i=h$(n),a=i!==`ws`&&(i===`other`||r!==`other`),o=r!==`ws`&&(r===`other`||i!==`other`);return e===`_`?a&&(!o||r===`punct`)||o&&(!a||i===`punct`):a||o}function _$(e,t,n){let r=t;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;if(r<e.length)return e[r]===`
|
|
427
|
+
`||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function v$(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&_$(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=g$(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function y$(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=t.before??``,a=t.after??``,o=e,s=o.charCodeAt(0);b$(i.charCodeAt(i.length-1),s,r)&&(o=x$(s)+o.slice(1));let c=o.charCodeAt(o.length-1);return b$(a.charCodeAt(0),c,r)&&(o=o.slice(0,-1)+x$(c)),o}function b$(e,t,n){return!(UN(t)!==1||n===`_`&&UN(e)===void 0)}function x$(e){return`&#x${e.toString(16).toUpperCase()};`}function S$(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!w$(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function C$(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=y$(n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),r,i),s+=a.move(i),o(),s}function w$(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}function T$(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var E$=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};freshnessHolder={checker:void 0};constructor(e){this.schema=_b(e.extensions),this.handlers=I$(this.schema,this.parseCtx),this.freshnessHolder.checker=e.deriveStructuralFreshness?KJ({parse:e=>this.parseWithFallback(e)}):void 0;let{nodeHandlers:t,markHandlers:n}=L$(this.schema,this.freshnessHolder);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=HQ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=UQ({toMarkdownHandlers:o$})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return YQ(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?XQ(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?XY(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e,t){let n;try{n=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}let r=this.freshnessHolder.checker;t?.skipFreshnessDerive&&(this.freshnessHolder.checker=void 0);try{return ZQ(n,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}finally{this.freshnessHolder.checker=r}}};const D$=RY();function O$(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else i?.type===`boolean`?r[e]=t.value===`true`:r[e]=t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function k$(e){let t=!1;return e.descendants(e=>t||e.type.name===`jsxInline`?!1:e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function A$(e,t){return e.attrs.sourceDirty||k$(e)?!0:t?t.isDiverged(e.toJSON()):!1}function j$(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0?!0:t.every(e=>e.type===`text`&&e.value===``)}function M$(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function N$(e,t){if(e.length===0)return M$({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return M$({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[N$(n.children,t)]}}return M$({type:`inlineCode`,value:P$(e)},t)}function P$(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=P$(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const F$=Vc;function I$(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=MR(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=MR(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=t$(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},n.imageReference?i.imageReference=e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i){let t=n.replaceAll(`\xA0`,` `);return r.sourceLiteral?e.text(t,[r.sourceLiteral.create({sourceRaw:i})]):e.text(t)}let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n.replaceAll(`\xA0`,` `));let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&rq(t.raw)!==null&&eq(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset).replaceAll(`\xA0`,` `);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length).replaceAll(`\xA0`,` `);if(i)if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=rq(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i));u=t.offset+t.length}}if(u<n.length){let t=n.slice(u).replaceAll(`\xA0`,` `);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=NR(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=NR(r.highlight)),r.comment&&(i.comment=NR(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=MR(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=NR(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=NR(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=MR(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??null}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`,sourceRaw:e.data?.sourceRaw??null})),n.list&&(i.list=MR(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=MR(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:``,title:null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=D$.getOrWildcard(o),c=O$(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=t$(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=vq(o),{resolveEmbed:u,sourcePath:d}=t.current,f=u&&d?u(o,d)??null:null,p=f?`/${f}`:o,m=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(m&&F$.has(l)&&n.jsxComponent&&D$.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,alt:s??o,target:o,anchor:c,alias:s}});if(m&&Hc.has(l)&&n.jsxComponent&&D$.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&Wc.has(l)&&n.jsxComponent&&D$.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&Gc.has(l)&&n.jsxComponent&&D$.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:T$(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if(r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=MR(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function L$(e,t){let n={},r={},i=e.nodes,a=e.marks;i.paragraph&&(n.paragraph=RR(`paragraph`)),i.blockquote&&(n.blockquote=RR(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),i.heading&&(n.heading=RR(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??void 0}}))),i.codeBlock&&(n.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),i.thematicBreak&&(n.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),i.hardBreak&&(n.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle,...typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0?{sourceRaw:e.attrs.sourceRaw}:{}}})),i.list&&(n.list=RR(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),i.listItem&&(n.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&j$(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},children:i}}),i.table&&(n.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c={};Array.isArray(s)&&s.length>0&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),i.tableRow&&(n.tableRow=RR(`tableRow`));let o=(e,t)=>{let n={type:`tableCell`,children:vJ(t)},r=e.attrs.sourcePadding;return typeof r==`object`&&r&&typeof r.left==`number`&&typeof r.right==`number`&&(n.data={sourcePadding:r}),n};if(i.tableCell&&(n.tableCell=(e,t,n)=>o(e,n.all(e))),i.tableHeader&&(n.tableHeader=(e,t,n)=>o(e,n.all(e))),i.image&&(n.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),i.imageReference&&(n.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),i.htmlBlock&&(n.htmlBlock=e=>({type:`html`,value:e.attrs.content})),i.linkDefinition??i.linkRefDef){let e=i.linkDefinition?`linkDefinition`:`linkRefDef`;n[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(i.jsxComponent&&(n.jsxComponent=(e,n,r)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let i=e.attrs.componentName||null,a=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!A$(e,t.checker)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:i,attributes:a,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:D$.getOrWildcard(i??`*`).serialize(e,{all:e=>r.all(e),registry:D$,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),i.rawMdxFallback&&(n.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),i.jsxInline&&(n.jsxInline=e=>{let t=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:null,attributes:[],children:[],data:{sourceRaw:String(t)}}}),i.mathInline&&(n.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),i.wikiLink&&(n.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},children:[{type:`text`,value:i}]}}),i.tag&&(n.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),i.wikiLinkEmbed&&(n.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),a.emphasis&&(r.emphasis=zR(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.strong&&(r.strong=zR(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.code&&(r.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return N$(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0?!0:void 0})}),a.strike??a.delete){let e=a.strike?`strike`:`delete`;r[e]=zR(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return a.highlight&&(r.highlight=zR(`mark`)),a.comment&&(r.comment=zR(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),i.commentBlock&&(n.commentBlock=RR(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),i.footnoteReference&&(n.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),i.footnoteDefinition&&(n.footnoteDefinition=RR(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),a.link&&(r.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=i||(r?`${t}#${r}`:t),o=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return o!==a&&o.trim().length>0&&!o.includes(`]]`)&&(i=o,a=o),{type:`wikiLinkEmbed`,value:a,data:{target:t,anchor:r,alias:i},children:[{type:`text`,value:a}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),a.escapeMark&&(r.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data??={},t.data.escapedChars??=[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),a.sourceLiteral&&(r.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return aq(t,e.value)&&(e.data??={},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:n,markHandlers:r}}const R$=/\p{M}+/gu,z$=/[^\p{L}\p{N}]+/gu,B$=/^-+|-+$/g;function V$(e){return e.trim().normalize(`NFKD`).replace(R$,``).toLowerCase().replace(z$,`-`).replace(B$,``)}function H$(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function U$(e,t){let n=V$(e);return n?H$(n,t):``}const W$=new Set([`img`,`video`,`audio`,`mark`]);new Map(IY.flatMap(e=>e.surface===`compat`&&W$.has(e.rendersAs)?[[e.name,e]]:[])),GF(`<>`);const G$=OV(),K$=KB(),q$=qB();function J$(){return IY.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function Y$(){return J$().filter(e=>X$(e)!==`fence`)}function X$(e){return e.name===`MermaidFence`?`fence`:e.hasChildren?`jsx-block`:`jsx-void`}function Z$(e){return{id:e.name,displayName:e.displayName??e.name,description:e.description??``,kind:X$(e)}}function Q$(e){if(e.hidden!==!0&&e.type!==`reactnode`){if(`defaultValue`in e&&e.defaultValue!==void 0)return e.defaultValue;if(e.type===`enum`)return e.enumValues[0];if(e.type===`string`)return``;if(e.type===`number`)return 0;if(e.type===`boolean`)return!1}}function $$(e,t){return!(e.omitOnDefault===!0&&`defaultValue`in e&&Object.is(e.defaultValue,t)||e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&t===``)}function e1(e){let t=[];for(let n of e.props){let e=Q$(n);e!==void 0&&$$(n,e)&&t.push(YJ(n.name,e))}return t}function t1(e){return eB(e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`Body content here.`,{extensions:[G$],mdastExtensions:[K$]}).children}function n1(e){let t=X$(e),n;if(t===`fence`)n={type:`code`,lang:`mermaid`,meta:null,value:e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`graph LR
|
|
428
|
+
A --> B`};else{let r=e1(e),i=t===`jsx-block`?t1(e):[];n={type:`mdxJsxFlowElement`,name:e.name,attributes:r,children:i}}return KP({type:`root`,children:[n]},{extensions:[q$]}).trimEnd()}function r1(e){let t=[];for(let n of e.props){if(n.hidden===!0)continue;let e={name:n.name,type:n.type,required:n.required};n.description!==void 0&&(e.description=n.description),n.advanced===!0&&(e.advanced=!0),n.omitOnDefault===!0&&(e.omitOnDefault=!0),n.type===`enum`&&(e.values=n.enumValues,n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue)),n.type===`string`&&(n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.language!==void 0&&(e.language=n.language),n.accept!==void 0&&(e.accept=n.accept)),n.type===`boolean`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.type===`number`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),t.push(e)}return t}function i1(e){return{...Z$(e),example:n1(e),params:r1(e)}}function a1(){return[``,"**Custom canonical components.** OK `.md` / `.mdx` supports the JSX components below — use whichever is semantically useful in any part of the doc. For full source syntax + parameter schemas, call `palette({ components: [ids] })` with the ids you want to use. Fenced code blocks render naturally and don't need a fetch — including ` ```mermaid ` for diagrams (mermaid label text has sharp edges — `palette({ components: [\"Mermaid\"] })` lists them; parse failures come back as `warnings` entries on write/edit) and ` ```html preview ` for interactive HTML/JS/CSS pages (the fence info-string `preview` token renders the block as a live iframe; works for `html` / `htm` / `xml`; optional `h=` / `w=` tokens set size, e.g. ` ```html preview h=400px `). Use ` ```html preview ` whenever you want anything interactive or JS-powered (charts, demos, calculators, animations) — just author the standalone HTML page in the fence. Call `palette` for the markdown-native component forms (write `> [!NOTE]`, not `<Callout>`), copy-ready themed `html preview` starters, and the theme tokens (`var(--chart-1)`, `var(--foreground)`, …) an embed should reference so it tracks the reader's light/dark theme. Arbitrary `<TagName>` JSX falls through as raw MDX when no canonical fits.",``,...Y$().map(Z$).map(e=>`- \`${e.id}\` (${e.kind}) — ${e.description}`)].join(`
|
|
429
|
+
`)}const o1=[`text`,`number`,`boolean`,`date`,`list`,`object`];F(o1);const s1=$s([A(),j(),M()]),c1=kc(()=>$s([s1.transform(e=>String(e)),ac(A(),l1),N(c1)])),l1=kc(()=>$s([A(),j(),M(),N(c1),ac(A(),l1)]));function u1(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(u1(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:u1(r);return t}return e}const d1=Pc(u1,ac(A(),l1));ac(A(),$s([l1,Hs()]));function f1(e){return!!(e===null||typeof e==`string`&&e===``||Array.isArray(e)&&e.length===0)}const p1=P({docName:Dq,summary:kq,content:A().optional(),...Oq}).loose(),m1=P({docName:Dq,summary:kq,markdown:A(),position:F([`append`,`prepend`,`replace`]).optional(),extension:F(VG).optional(),...Oq}).loose(),h1=P({docName:Dq,summary:kq,find:A().min(1),replace:A(),offset:j().int().nonnegative().optional(),...Oq}).loose(),g1=P({docName:Dq,connectionId:A().min(1),scope:F([`last`,`session`,`file`]).optional(),...Oq}).loose(),_1=P({value:A(),truncatedFrom:j().int().nonnegative().optional(),hint:A().optional()}).loose(),v1=tc(`kind`,[P({kind:I(`inline`),content:A()}),P({kind:I(`truncated`),byteLength:j().int().nonnegative(),hint:A()})]),y1=P({kind:I(`content-divergence`),intendedBytes:j().int().nonnegative(),actualBytes:j().int().nonnegative(),byteDelta:j().int(),divergenceType:A().optional(),currentState:v1.optional(),hint:A().optional()}).loose(),b1=P({type:I(`orphan`),parentCandidates:N(A()),message:A()}).loose(),x1=P({kind:I(`disk-edit-reconciled`),intendedBytes:j().int().nonnegative(),actualBytes:j().int().nonnegative(),byteDelta:j().int(),mergeOutcome:A().optional(),hint:A().optional()}).loose(),S1=tc(`kind`,[y1,x1]),C1=tc(`kind`,[y1,x1,P({kind:I(`mermaid-parse-error`),fenceIndex:j().int().positive(),fenceFirstLine:A(),message:A(),line:j().int().positive().optional()}).loose()]),w1=N(C1).min(1),T1=P({href:A(),resolvedTo:A().nullable(),reason:F([`no-such-doc`,`no-such-file`,`unresolvable`])}).loose(),E1=N(T1),D1=P({timestamp:A().min(1),summary:_1.optional(),warning:S1.optional(),warnings:w1.optional()}).loose(),O1=P({timestamp:A().min(1),subscriberCount:j().int().nonnegative(),systemSubscriberCount:j().int().nonnegative(),hints:N(b1).optional(),summary:_1.optional(),warning:S1.optional(),warnings:w1.optional(),brokenLinks:E1}).loose(),k1=P({timestamp:A().min(1),subscriberCount:j().int().nonnegative(),systemSubscriberCount:j().int().nonnegative(),summary:_1.optional(),warning:S1.optional(),warnings:w1.optional(),brokenLinks:E1}).loose(),A1=P({docName:A().min(1),scope:F([`last`,`session`]),undone:M()}).loose(),j1=P({docName:Dq,patch:ac(A(),$s([l1,Hs()])),types:ac(A(),F(o1)).optional(),summary:kq,...Oq}).loose(),M1=P({timestamp:A().min(1),subscriberCount:j().int().nonnegative(),systemSubscriberCount:j().int().nonnegative(),appliedKeys:N(A()),summary:_1.optional(),warning:S1.optional(),warnings:w1.optional(),brokenLinks:E1}).loose(),N1=P({entries:N(P({level:F([`info`,`warn`,`error`]),message:A().max(8192),event:A().optional(),fields:ac(A(),Ks()).optional(),ts:j().optional(),sourceId:A().optional(),lineNumber:j().optional()}).loose()).max(100)}).loose(),P1=P({accepted:j().int().min(0)}).loose(),F1=P({status:A().min(1),reason:A()}).loose(),I1=P({docName:A().min(1),content:A(),lifecycle:F1.nullable()}).loose(),L1=P({documents:N(P({kind:F([`document`,`asset`,`folder`,`file`]).default(`document`),docName:A().min(1).optional(),docExt:A().min(1).default(`.md`),size:j().int().nonnegative(),modified:A().min(1),isSymlink:M().default(!1),canonicalDocName:A().nullable().default(null),targetPath:A().nullable().default(null),path:A().min(1).optional(),assetExt:A().min(1).optional(),mediaKind:F([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`]).nullable().optional(),referencedBy:N(A().min(1)).optional(),hasChildren:M().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:M().optional()}).loose(),R1=P({source:A().min(1),anchor:A().nullable(),title:A(),snippet:A().nullable()}).loose(),z1=P({docName:A().min(1),backlinks:N(R1)}).loose(),B1=P({counts:ac(A().min(1),j().int().nonnegative())}).loose(),V1=tc(`kind`,[P({kind:I(`doc`),docName:A().min(1),anchor:A().nullable(),title:A(),snippet:A().nullable()}).loose(),P({kind:I(`external`),url:A().min(1),title:A(),snippet:A().nullable()}).loose()]),H1=P({docName:A().min(1),forwardLinks:N(V1)}).loose(),U1=tc(`kind`,[P({id:A().min(1),kind:I(`doc`),docName:A().min(1),anchor:A().nullable(),label:A(),cluster:A().nullable(),category:A().nullable(),tags:N(A()).nullable()}).loose(),P({id:A().min(1),kind:I(`external`),url:A().min(1),label:A()}).loose()]),W1=P({source:A().min(1),target:A().min(1)}).loose(),G1=P({nodes:N(U1),links:N(W1)}).loose(),K1=P({ts:j().int().min(0),url:A(),method:A(),ua:A().optional(),origin:A().optional(),referer:A().optional(),host:A().optional(),remote:A().optional(),secChUa:A().optional(),secChUaMobile:A().optional(),secChUaPlatform:A().optional(),secFetchSite:A().optional(),secFetchDest:A().optional(),secFetchMode:A().optional(),secFetchUser:A().optional()}).loose(),q1=P({app:$s([I(`cursor`),I(`codex`),I(`claude`),Hs()]),signals_fired:N(A())}).loose(),J1=P({entries:N(K1),count:j().int().min(0),detection:q1}).loose(),Y1=P({writers:N(P({id:A().min(1),name:A().optional(),email:A().optional()}).loose()).optional(),summary:kq,...Oq}).loose(),X1=P({checkpointRef:A().min(1)}).loose(),Z1=P({v:j().int().optional(),id:A().min(1),name:A().min(1),colorSeed:A().optional(),docs:N(A()),summaries:N(A()).optional()}).loose(),Q1=P({entries:N(P({sha:A().min(1),timestamp:A().min(1),author:A(),authorEmail:A(),type:F([`checkpoint`,`wip`,`upstream`,`park`]),message:A(),contributors:N(Z1),checkpoint:Ks().nullable()}).loose()),total:j().int().nonnegative().optional(),truncated:M().optional(),hasMore:M().optional()}).loose(),$1=P({sha:A().regex(/^[0-9a-f]{40}$/i),content:A(),timestamp:A(),author:A()}).loose(),e0=P({contentDir:A().min(1),pathSeparator:F([`/`,`\\`]),symlinkResolved:M()}).loose(),t0=N(tc(`source`,[P({docName:A().min(1),timestamp:A().min(1),size:j().int().nonnegative(),source:I(`flat`)}).loose(),P({docName:A().min(1),timestamp:A().min(1),source:I(`timeline`),sha:A().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),n0=P({orphans:N(P({docName:A().min(1),title:A()}).loose())}).loose(),r0=P({hubs:N(P({docName:A().min(1),title:A(),count:j().int().nonnegative()}).loose())}).loose(),i0=P({source:A().min(1),title:A(),snippet:A().nullable()}).loose(),a0=P({deadLinks:N(P({target:A().min(1),sources:N(i0)}).loose())}).loose(),o0=P({target:P({docName:A().min(1),title:A(),aliases:N(A())}).loose(),mentions:N(P({source:A().min(1),excerpt:A(),offset:j().int().nonnegative()}).loose()),truncated:M()}).loose(),s0=P({projectPath:A().min(1)}).loose(),c0=F([`not-a-git-worktree`,`init-failed`]),l0=tc(`ok`,[P({ok:I(!0),projectPath:A().min(1)}).loose(),P({ok:I(!1),reason:c0,message:A().min(1)}).loose()]),u0=P({host:A().min(1).optional()}).loose(),d0=P({key:A().min(1)}).loose(),f0=P({keyPresent:M()}).loose(),p0=P({name:A().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:A().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),m0=P({authenticated:M()}).loose(),h0=P({}).loose(),g0=P({stackIndex:j().int().min(0),ts:j().int().min(0),additions:j().int().min(0),deletions:j().int().min(0)}).loose(),_0=P({docName:A().min(1),additionsTotal:j().int().min(0),deletionsTotal:j().int().min(0),lastTs:j().int().min(0),bursts:N(g0)}).loose(),v0=P({displayName:A().min(1),color:A().min(1),icon:A().optional(),connectionId:A().min(1)}).loose(),y0=P({sessionAlive:M(),agent:v0.nullable(),files:N(_0)}).loose(),b0=P({diff:A(),generatedAt:j().int().min(0)}).loose(),x0=P({}).loose(),S0=P({}).loose(),C0=P({}).loose(),w0=P({}).loose(),T0=P({}).loose(),E0=P({}).loose(),D0=P({displayName:A().min(1),icon:A(),color:A().min(1),currentDoc:A().nullable(),mode:F([`idle`,`writing`]),ts:j().int().min(0)}).loose(),O0=P({presence:ac(A().min(1),D0)}).loose(),k0=ac(A().min(1),M()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});P({path:A().min(1,`path must be non-empty`)}).loose();const A0=P({}).loose(),j0=P({fromDocName:A().min(1),toDocName:A().min(1)}).loose(),M0=P({fromPath:A().min(1),toPath:A().min(1)}).loose(),N0=P({}).loose(),P0=P({path:A().min(1),...Oq,summary:kq}).loose(),F0=P({docName:A().min(1)}).loose(),I0=P({path:A().min(1),...Oq,summary:kq}).loose(),L0=P({path:A().min(1)}).loose(),R0=P({kind:F([`file`,`folder`]),path:A().min(1),...Oq,summary:kq}).loose(),z0=P({kind:F([`file`,`folder`]),path:A().min(1),duplicatedDocNames:N(A().min(1))}).loose(),B0=P({pages:N(P({docName:A().min(1),title:A(),docExt:A().min(1),size:j().int().nonnegative(),modified:A().min(1),icon:A().min(1).max(2048).optional()}).loose())}).loose(),V0=P({level:j().int().min(1).max(6),text:A(),slug:A()}).loose(),H0=P({docName:A().min(1),headings:N(V0)}).loose(),U0=P({docName:A().min(1),rewrites:j().int().nonnegative()}).loose(),W0=P({kind:F([`file`,`folder`,`asset`]),fromPath:A().min(1),toPath:A().min(1),...Oq,summary:kq}).loose(),G0=P({renamed:N(j0),renamedAssets:N(M0),rewrittenDocs:N(U0).optional(),summary:_1.optional()}).loose(),K0=P({kind:F([`file`,`folder`,`asset`]),path:A().min(1),...Oq}).loose(),q0=P({deletedDocNames:N(A().min(1))}).loose(),J0=P({kind:F([`file`,`folder`,`asset`]),path:A().min(1),...Oq,summary:kq}).loose(),Y0=P({deletedDocNames:N(A().min(1))}).loose(),X0=P({docName:A().min(1),commitSha:A().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:kq,...Oq}).loose(),Z0=P({restoredFrom:A().min(1),timestamp:A().min(1),summary:_1.optional(),warning:y1.optional(),warnings:w1.optional()}).loose(),Q0=F([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),$0=P({label:A().min(1),webUrl:xs().nullable()}).loose(),e2=tc(`checkStatus`,[P({checkStatus:I(`allowed`)}).loose(),P({checkStatus:I(`denied`),deniedReason:F([`no-collaborator`,`private-no-access`,`repo-not-found`])}).loose(),P({checkStatus:I(`unknown`),unknownError:F([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`]).optional()}).loose()]),t2=F([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),n2=P({state:Q0,lastSyncUtc:A().nullable(),lastFetchUtc:A().nullable(),lastPushedSha:A().nullable(),ahead:j().int().min(0),behind:j().int().min(0),consecutiveFailures:j().int().min(0),conflictCount:j().int().min(0),hasRemote:M(),syncEnabled:M(),identityUnresolved:M(),remote:$0.nullable().optional(),pushError:A().optional(),pushErrorCode:t2.optional(),pullError:A().optional(),pullErrorCode:t2.optional(),pausedReason:A().optional(),pushPermission:e2.optional()}).loose(),r2=P({op:F([`sync`,`push`,`pull`]).optional()}).loose(),i2=P({op:F([`sync`,`push`,`pull`])}).loose(),a2=P({conflicts:N(P({file:A().min(1),detectedAt:A().min(1),oursSha:A().optional(),theirsSha:A().optional(),baseSha:A().optional()}).loose())}).loose(),o2=P({file:A().min(1),strategy:F([`mine`,`theirs`,`content`,`delete`]),content:A().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),s2=P({}).loose(),c2=P({file:A().min(1),base:A(),ours:A(),theirs:A(),kind:F([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:A().nullable()}).loose(),l2=P({plan:jc(e=>e!==void 0,{message:`plan is required`})}).loose(),u2=P({plan:jc(e=>e!==void 0,{message:`plan is required`})}).loose(),d2=P({result:jc(e=>e!==void 0,{message:`result is required`})}).loose(),f2=P({path:A().min(1),summary:A().min(1)}).loose(),p2=P({files:j().int().nonnegative(),folders:j().int().nonnegative()}).loose(),m2=P({packs:N(P({id:A().min(1),name:A().min(1),description:A().min(1),defaultSubfolder:A().optional(),folders:N(f2),entryCounts:p2}).loose())}).loose(),h2=P({noOpen:M().optional(),out:A().min(1).optional()}).loose(),g2=P({reason:F([`unsupported-platform`,`spawn-error`]),message:A()}).loose(),_2=tc(`status`,[P({status:I(`installed`),outputPath:A(),size:j().int().nonnegative(),sha256:A(),skillVersion:A()}).loose(),P({status:I(`built`),outputPath:A(),size:j().int().nonnegative(),sha256:A(),skillVersion:A(),handoffError:g2.optional()}).loose(),P({status:I(`failed`),buildError:A()}).loose(),P({status:I(`skip-current`),skillVersion:A(),recordedAt:A().optional()}).loose()]),v2=[`.ok`,`skill-targets.json`],y2=F(qG),b2=Zs({schema:I(1),targets:N(y2).default([])});function x2(e){let t;try{t=JSON.parse(e)}catch{return null}let n=b2.safeParse(t);return n.success?n.data:null}const S2=P({tags:N(P({name:A().min(1),count:j().int().nonnegative(),isLeaf:M()}).loose())}).loose(),C2=P({docName:A().min(1),title:A(),matchingTags:N(A().min(1)),snippet:A().nullable()}).loose(),w2=P({name:A().min(1),docs:N(C2)}).loose(),T2=P({folder:Ks(),frontmatter_local:ac(A(),Ks()).nullable()}).loose(),E2=P({path:A(),frontmatter:ac(A(),Ks()).optional()}).loose(),D2=P({applied:Ks()}).loose(),O2=ac(A(),Ks()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),k2=P({template:P({name:A().min(1),folder:A(),scope:F([`local`,`inherited`]),path:A().min(1),frontmatter:O2,body:A()}).strict()}).strict(),A2=P({templates:N(P({name:A().min(1),title:A().optional(),description:A().optional(),path:A().min(1),source_folder:A()}).strict()),truncated:M()}).strict(),j2=P({folder:A(),name:A(),body:A().optional(),frontmatter:O2.optional(),...Oq,summary:kq}).strict(),M2=P({path:A().min(1),created:M(),warnings:N(A())}).strict(),N2=P({existed:M(),path:A().min(1)}).strict(),P2=P({fromFolder:A(),fromName:A(),toFolder:A(),toName:A(),body:A().optional(),frontmatter:O2.optional(),...Oq,summary:kq}).strict(),F2=P({from:A().min(1),to:A().min(1),committed:M()}).strict(),I2=F(EG),L2=/^[a-z0-9-]+$/,R2=/<\/?[A-Za-z][^>]*>/;function z2(e){return R2.test(e)}const B2=/^[A-Za-z0-9_-]+$/,V2=P({name:A(),description:A()}).strict(),H2=P({skill:P({name:A().min(1),scope:I2,path:A().min(1),frontmatter:V2,body:A(),files:N(P({path:A().min(1),text:A().nullable()})).optional()}).strict()}).strict(),U2=P({skills:N(P({name:A().min(1),description:A().optional(),scope:I2,path:A().min(1),absolutePath:A().min(1).optional(),installed:M(),hosts:N(A()),installedVersion:A().optional(),bundledVersion:A().optional(),updateAvailable:M().optional()}).strict()),truncated:M()}).strict(),W2=P({scope:I2.default(`project`),name:A(),body:A().optional(),frontmatter:V2,...Oq,summary:kq}).strict(),G2=P({path:A().min(1),created:M(),warnings:N(A())}).strict(),K2=P({scope:I2.default(`project`),name:A(),...Oq,summary:kq}).strict(),q2=P({name:A().min(1),version:A().min(1),previousVersion:A().optional(),checkpointRef:A().optional()}).strict(),J2=P({existed:M(),path:A().min(1)}).strict(),Y2=P({scope:I2.default(`project`),fromName:A(),toName:A(),body:A().optional(),frontmatter:V2.optional(),...Oq,summary:kq}).strict(),X2=P({from:A().min(1),to:A().min(1),committed:M()}).strict(),Z2=F([`reference`,`script`]),Q2=P({scope:I2.default(`project`),name:A(),path:A().min(1),content:A(),...Oq,summary:kq}).strict(),$2=P({path:A().min(1),created:M(),kind:Z2,content:M()}).strict(),e4=P({path:A().min(1),kind:Z2,text:A()}).strict(),t4=P({path:A().min(1),existed:M(),kind:Z2}).strict(),n4=P({scope:I2.default(`project`),name:A(),targets:N(y2).optional().meta({description:`Explicit editor ids to install into; omit to use project-configured editors.`}),...Oq,summary:kq}).strict(),r4=P({name:A().min(1),hosts:N(A()),scripts:M(),warnings:N(A()),warningCodes:N(F([`no-targets`,`scripts-present`]))}).strict(),i4=P({scope:I2.default(`project`),name:A()}).strict(),a4=P({name:A().min(1),uninstalled:M()}).strict(),o4=P({targets:N(y2),configured:M()}).strict(),s4=P({targets:N(y2)}).strict(),c4=P({targets:N(y2),reprojected:N(P({name:A(),hosts:N(A())}).strict()),bundleHosts:N(A()),removedFrom:N(A())}).strict(),l4=P({scope:I2.default(`project`),name:A(),version:A().regex(/^[0-9a-f]{40}$/i),...Oq,summary:kq}).strict(),u4=P({name:A().min(1),version:A(),restoredFiles:N(A()),warnings:N(A())}).strict(),d4=P({query:A().optional(),intent:F([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:F([`navigation`,`relevance`]).optional(),scopes:N(F([`page`,`folder`,`content`,`file`])).optional(),scope:A().optional(),limit:j().int().nonnegative().optional(),semantic:M().optional(),source:F([`omnibar`,`mcp`,`http`]).optional()}).loose(),f4=P({kind:F([`page`,`folder`,`content`,`file`]),path:A().min(1),title:A(),score:j(),signals:ac(A(),Ks()),snippet:A().optional()}).loose(),p4=P({capable:M(),applied:M(),coverage:P({embedded:j().int().nonnegative(),total:j().int().nonnegative()})}).loose(),m4=P({enabled:M(),keyPresent:M(),keySource:F([`file`,`env`]).nullable(),keyHint:A().nullable(),ready:M(),capable:M(),embedded:j().int().nonnegative(),total:j().int().nonnegative()}).loose(),h4=P({query:A(),intent:F([`autocomplete`,`full_text`,`omnibar`]),results:N(f4),elapsedMs:j().nonnegative(),semantic:p4.optional(),truncated:M().optional(),ready:M().optional()}).loose(),g4=P({version:A().min(1),recordedAt:A().min(1)}).loose(),_4=P({currentVersion:A().min(1),targets:ac(A(),g4.nullable())}).loose(),v4=`server-info`,y4=`branch-switched`,b4=`disk-ack`,x4=`config-validation-rejected`,S4=`config-ignore-nested-error`,C4=F([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),w4=P({v:I(1),ch:I(v4),seq:j(),serverInstanceId:A().min(1),currentBranch:A().min(1).optional()}).loose(),T4=P({v:I(1),ch:I(y4),seq:j(),branch:A().min(1)}).loose(),E4=P({v:I(1),ch:C4,seq:j()}).loose(),D4=P({v:I(1),ch:I(b4),seq:j(),docName:A().min(1),sv:A().min(1)}).loose(),O4=P({v:I(1),ch:I(x4),seq:j(),docName:A().min(1),error:ql}).loose(),k4=P({v:I(1),ch:I(S4),seq:j(),path:A().min(1),error:A().min(1)}).loose(),A4=new pG.default;function j4(e,t){if(e===t)return[{value:e}];let{chars1:n,chars2:r,lineArray:i}=A4.diff_linesToChars_(e,t),a=A4.diff_main(n,r,!1);A4.diff_charsToLines_(a,i),A4.diff_cleanupSemantic(a);let o=[];for(let[e,t]of a)e===pG.default.DIFF_DELETE?o.push({value:t,removed:!0}):e===pG.default.DIFF_INSERT?o.push({value:t,added:!0}):o.push({value:t});return o}const M4=new pG.default;M4.Diff_Timeout=.25;const N4=256*1024;function P4(e,t,n){if(t===n)return;let r=j4(t,n),i=0;for(let n=0;n<r.length;n++){let a=r[n],o=r[n+1];if(a.removed&&o?.added){if(t.substring(i,i+o.value.length)===o.value){i+=o.value.length,n++;continue}e.delete(i,a.value.length),e.insert(i,o.value),i+=o.value.length,n++}else a.removed?e.delete(i,a.value.length):(a.added&&e.insert(i,a.value),i+=a.value.length)}}function F4(e,t,n){if(t===n)return;if(t.length>N4||n.length>N4){I4(e,t,n);return}let r=M4.diff_main(t,n);M4.diff_cleanupSemantic(r);let i=0;for(let[t,n]of r)t===0?i+=n.length:t===-1?e.delete(i,n.length):t===1&&(e.insert(i,n),i+=n.length)}function I4(e,t,n){let r=0,i=Math.min(t.length,n.length);for(;r<i&&t.charCodeAt(r)===n.charCodeAt(r);)r++;let a=0;for(;a<i-r&&t.charCodeAt(t.length-1-a)===n.charCodeAt(n.length-1-a);)a++;let o=t.length-r-a,s=n.slice(r,n.length-a);o>0&&e.delete(r,o),s.length>0&&e.insert(r,s)}const L4=P({path:N($s([A(),j()])),message:A(),issueCode:A()});tc(`code`,[P({code:I(`SCHEMA_INVALID`),issues:N(L4)}),P({code:I(`WRITE_ERROR`),detail:A()})]);const R4={defaultKeyType:`PLAIN`,defaultStringType:`PLAIN`,lineWidth:0};function z4(e){if(e.trim()===``)return{doc:new Fc.Document({}),map:{}};let t;try{t=(0,Fc.parseDocument)(e)}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new Fc.Document({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=d1.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function B4(e){return Object.keys(e).length===0?``:new Fc.Document(e).toString(R4)}function V4(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function H4(e,t,n){if(Array.isArray(n)){let r=e.createNode(n),i=(0,Fc.isSeq)(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}if(V4(n)){let r=e.createNode(n),i=(0,Fc.isMap)(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}return n}function U4(e){return e===``?``:`---\n${e.endsWith(`
|
|
430
|
+
`)?e.slice(0,-1):e}\n---\n`}function W4(e){let t=e.match(dK);return t?{fenced:t[0],body:e.slice(t[0].length)}:{fenced:``,body:e}}function G4(e){if(e.trim()===``)return{doc:new Fc.Document({}),map:{}};let t;try{t=(0,Fc.parseDocument)(e,{uniqueKeys:!1})}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new Fc.Document({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=d1.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function K4(e){return e===``?{doc:new Fc.Document({}),map:{}}:G4(mK(e))}function q4(e){let{fenced:t}=W4(e),{map:n}=K4(t);return n??{}}function J4(e){if(e.contents==null||!(`items`in e.contents)){let t=e.createNode({});return e.contents=t,t}return e.contents}function Y4(e){let t=e.contents;return!t||!(`items`in t)||(t.items?.length??0)===0?``:U4(e.toString(R4))}function X4(e){let t=new TextEncoder().encode(e).byteLength;return t>65536?{kind:`region_too_large`,bytes:t,limit:65536}:null}function Z4(e){let t=Y4(e),n=X4(t);return n?{ok:!1,error:n}:{ok:!0,nextFenced:t}}function Q4(e,t){if(Object.hasOwn(t,`frontmatter`))return{ok:!1,error:{kind:`reserved_key`,key:`frontmatter`}};let{doc:n,map:r}=K4(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{J4(n);for(let[e,r]of Object.entries(t)){if(r===null){n.delete(e);continue}let t=l1.safeParse(r);if(!t.success)return{ok:!1,error:{kind:`invalid_value`,key:e,reason:t.error.issues[0]?.message??`invalid value`}};n.set(e,H4(n,n.get(e,!0),t.data))}return Z4(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});function $4(e,t){let n=t?.verbose===!0,r=t?.nowMs===void 0?new Date().toISOString():new Date(t.nowMs).toISOString(),i={event:`bridge-invariant-violation`,site:e.site,"doc.name":e.docName??null,"tolerance-class-attempted":`untracked`,"normalize-equal-modulo-tolerance":!1,ytextLen:e.ytextSnapshot.length,fragmentLen:e.fragmentMdSnapshot.length,ytextHash:uu(e.ytextSnapshot),fragmentHash:uu(e.fragmentMdSnapshot),redacted:!n,timestamp:r};return n?{...i,diff:e.unifiedDiff}:i}var e3=class extends Error{violation;constructor(e){let t=typeof e.origin==`string`?e.origin:e.origin?.context?.origin??`unknown-object`,n=e.docName?` doc='${e.docName}'`:``;super(`Bridge invariant violated [site='${e.site}'${n}, origin='${t}'].\n Y.Text (${e.ytextSnapshot.length} chars): ${e.ytextSnapshot.slice(0,200)}...\n Fragment (${e.fragmentMdSnapshot.length} chars): ${e.fragmentMdSnapshot.slice(0,200)}...\n Diff:\n${e.unifiedDiff}`),this.name=`BridgeInvariantViolationError`,this.violation=e}};const t3=/^(?:\r?\n)+/;function n3(e){let{frontmatter:t,body:n}=fK(e),r=n.match(t3);if(!r)return{boundary:``,text:e};let i=n.slice(r[0].length);return t===``&&dK.test(i)?{boundary:``,text:e}:{boundary:r[0],text:t+i}}function r3(e,t){if(t===``)return e;let{frontmatter:n,body:r}=fK(e);return n+t+r}function i3(e){let t=n3(e).text;return fK(t).frontmatter===``?t:r3(t,`
|
|
431
|
+
`)}function a3(e,t=16){let n=e.trim();return n.length<t?!1:!(n.startsWith(`<`)||n.startsWith("```")||n.startsWith(`|`))}function o3(e,t=16){let n=new Map;for(let r of e.split(`
|
|
432
|
+
`)){if(!a3(r,t))continue;let e=r.trim();n.set(e,(n.get(e)??0)+1)}return n}function s3(e,t,n=16){let r=o3(t,n),i=[];for(let[t,a]of o3(e,n))a>=2&&a>(r.get(t)??0)&&i.push(t);return i}const c3=new pG.default;c3.Match_Threshold=.5;function l3(e,t,n){let r=u3(e,t,n);return h3(e,t,n,r),r}function u3(e,t,n){if(e===t)return n;if(e===n||t===n)return t;let r=NV(t.split(`
|
|
433
433
|
`),e.split(`
|
|
434
434
|
`),n.split(`
|
|
435
435
|
`)),i=[];for(let e=0;e<r.length;e++){let t=r[e];if(`ok`in t&&t.ok)i.push(t.ok.join(`
|
|
436
436
|
`));else if(`conflict`in t&&t.conflict){let e=t.conflict.o.join(`
|
|
437
437
|
`),n=t.conflict.a.join(`
|
|
438
438
|
`),r=t.conflict.b.join(`
|
|
439
|
-
`);i.push(
|
|
440
|
-
`)}function
|
|
441
|
-
`)){let t=e.trim();t.length!==0&&r.push(t)}return r}function
|
|
439
|
+
`);i.push(g3(e,n,r))}}return i.join(`
|
|
440
|
+
`)}function d3(e){return e.map(e=>({len:e.length,digest:uu(e)}))}var f3=class extends Error{info;constructor(e){let t=e.lostSubstrings.map(e=>JSON.stringify(e.length>80?`${e.slice(0,77)}...`:e)).join(`, `);super(`Bridge merge content loss (which=${e.which}, side=${e.side}): ${t}`),this.name=`BridgeMergeContentLossError`,this.info=e}toLog(e){let t=e?.verbose===!0;return{event:`bridge-merge-content-loss`,which:this.info.which,side:this.info.side,baselineLen:this.info.baseline.length,userTextLen:this.info.userText.length,agentTextLen:this.info.agentText.length,resultLen:this.info.result.length,lostSubstrings:t?this.info.lostSubstrings:d3(this.info.lostSubstrings),redacted:!t}}};function p3(e,t){if(e===t)return[];let n=c3.diff_main(e,t);c3.diff_cleanupSemantic(n);let r=[];for(let[e,t]of n)if(e===1)for(let e of t.split(`
|
|
441
|
+
`)){let t=e.trim();t.length!==0&&r.push(t)}return r}function m3(e,t){let n=0;for(let r of t){let t=e.indexOf(r,n);if(t<0){if(e.indexOf(r)<0)continue;return r}n=t+r.length}return null}function h3(e,t,n,r){let i=p3(e,t),a=p3(e,n),o=i.filter(e=>!r.includes(e));if(o.length>0)throw new f3({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:o,which:`substring`,side:`user`});let s=a.filter(e=>!r.includes(e));if(s.length>0)throw new f3({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:s,which:`substring`,side:`agent`});let c=m3(r,i);if(c!==null)throw new f3({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:[c],which:`order`,side:`user`});let l=m3(r,a);if(l!==null)throw new f3({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:[l],which:`order`,side:`agent`});let u=o3(e),d=o3(t),f=o3(n);for(let[i,a]of o3(r))if(!(a<2)&&a>Math.max(u.get(i)??0,d.get(i)??0,f.get(i)??0))throw new f3({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:[i],which:`growth`,side:`user`})}function g3(e,t,n){if(t===``)return n;if(n===``)return t;let r=c3.patch_make(e,t),[i,a]=c3.patch_apply(r,n);return a.some(e=>!e)&&console.warn(JSON.stringify({event:`bridge-merge-patch-drop`,applied:a.filter(Boolean).length,total:a.length,regionSize:n.length})),i}const _3=/\\([!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~])/g,v3=/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/,y3=/^[ \t]+([-+*]|\d+[.)]|[a-zA-Z][.)])\s/,b3=/^\d+([.)])(?=\s)/,x3=/\*\*\s*(`[^`]+`)\s*\*\*/g,S3=/^(`{3,}|~{3,})/;function C3(e){let t=new Set,n=null;for(let r=0;r<e.length;r++){let i=e[r].trimEnd(),a=S3.exec(i);if(a){let e=a[1][0];if(n===null){n=e;continue}if(n===e){n=null;continue}}if(n!==null||r===0||!v3.test(i))continue;let o=e[r-1].trimEnd();if(!(!o.startsWith(`|`)||v3.test(o))){t.add(r-1),t.add(r);for(let n=r+1;n<e.length&&e[n].trimEnd().startsWith(`|`);n++)t.add(n)}}return t}function w3(e){return e.slice(0,-1).trimEnd()}const T3=/^(?:#{1,6}[ \t]|>|(?:[-+*]|\d{1,9}[.)])[ \t]|`{3,}|~{3,}|=+[ \t]*$|-+[ \t]*$|(?:\*[ \t]*){3,}$|(?:_[ \t]*){3,}$)/;function E3(e){let t=new Set,n=null;for(let r=0;r<e.length;r++){let i=e[r]??``,a=/^(`{3,}|~{3,})/.exec(i.trimStart());if(a?.[1]){let e=a[1][0];if(n===null){n=e;continue}if(n===e){n=null;continue}}n!==null&&t.add(r)}return t}const D3=/^<\/?[A-Z][A-Za-z0-9.]*(?:\s[^>]*)?>$/,O3=/^<[A-Z][A-Za-z0-9.]*(?:\s[^>]*)?>$/,k3=/^<\/[A-Z][A-Za-z0-9.]*\s*>$/,A3=/<\/?[A-Z]/;function j3(e){let t=!1;for(let n=0;n<e.length;n++)if(A3.test(e[n]??``)){t=!0;break}if(!t)return e;let n=E3(e),r=[],i=[],a=0;for(let t=0;t<e.length;t++){let o=e[t]??``,s=o.trim();if(n.has(t)){r.push(!1),i.push(a);continue}let c=a>=1||!/^[ \t]/.test(o);r.push(c&&D3.test(s));let l=c&&k3.test(s),u=c&&!l&&O3.test(s)&&!s.endsWith(`/>`);l?(a=Math.max(0,a-1),i.push(a)):(i.push(a),u&&(a+=1))}let o=Array(e.length);for(let t=0,n=-1;t<e.length;t++)o[t]=n,(e[t]??``).trim()!==``&&(n=t);let s=Array(e.length);for(let t=e.length-1,n=e.length;t>=0;t--)s[t]=n,(e[t]??``).trim()!==``&&(n=t);let c=new Set;for(let t=0;t<e.length;t++){if((e[t]??``).trim()!==``||n.has(t)||(i[t]??0)<1)continue;let a=o[t]??-1,l=s[t]??e.length;(a>=0&&r[a]===!0||l<e.length&&r[l]===!0)&&c.add(t)}let l=[];for(let t=0;t<e.length;t++){if(c.has(t))continue;let n=e[t]??``;l.push(r[t]===!0&&(i[t]??0)>=1?n.replace(/^[ \t]+/,``):n)}return l}function M3(e){let t=j3(e.replace(/^/,``).replace(/\r/g,``).replace(_3,`$1`).replace(x3,`$1`).replace(/^\n+/,``).replace(/^[*-]{3,}(?=\n|$)/,`---`).replace(/(\n)([#>+-]|\d+[.)]|`{3,}|~{3,})/g,`
|
|
442
442
|
|
|
443
443
|
$2`).replace(/^([#>+-].*|\d+[.)].*|`{3,}.*|~{3,}.*)\n([^\n])/gm,`$1
|
|
444
444
|
|
|
445
445
|
$2`).split(`
|
|
446
|
-
`)),n=
|
|
446
|
+
`)),n=C3(t),r=E3(t);return t.map((e,i)=>{let a=e.trimEnd();if(i>0&&!r.has(i)&&/^[ \t]+\S/.test(a)&&(t[i-1]??``).trim()!==``&&!y3.test(a)&&!T3.test(a.trimStart())){let e=(t[i-1]??``).trimStart();if(!T3.test(e)&&!e.startsWith(`|`))return a.replace(/^[ \t]+/,``)}if(v3.test(a)){let e=a.replace(/\s+/g,``);return n.has(i)&&e.length>1&&e.startsWith(`|`)&&e.endsWith(`|`)?w3(e):e}let o=y3.test(a)?a.replace(/^[ \t]+/,``):a;return n.has(i)&&o.length>1&&o.startsWith(`|`)&&o.endsWith(`|`)&&(o=w3(o)),o.replace(b3,`1$1`)}).join(`
|
|
447
447
|
`).replace(/\n{3,}/g,`
|
|
448
448
|
|
|
449
|
-
`).replace(/\n+$/,``)}function
|
|
449
|
+
`).replace(/\n+$/,``)}function N3(e,t){let n=[];(e.charCodeAt(0)===65279||t.charCodeAt(0)===65279)&&n.push(`bom`),(e.includes(`\r`)||t.includes(`\r`))&&n.push(`crlf`),(/\\[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/.test(e)||/\\[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/.test(t))&&n.push(`commonmark-escape`),(/\*\*\s*`[^`]+`\s*\*\*/.test(e)||/\*\*\s*`[^`]+`\s*\*\*/.test(t))&&n.push(`emphasis-around-code`);let r=e.replace(/^/,``),i=t.replace(/^/,``);r.startsWith(`
|
|
450
450
|
`)!==i.startsWith(`
|
|
451
451
|
`)&&n.push(`leading-newline`);let a=r.replace(/^\n+/,``),o=i.replace(/^\n+/,``),s=/^\*{3,}(?=\n|$)/.test(a),c=/^-{3,}(?=\n|$)/.test(a),l=/^\*{3,}(?=\n|$)/.test(o),u=/^-{3,}(?=\n|$)/.test(o);(s&&u||c&&l)&&n.push(`doc-start-thematic`);let d=/\n\n([#>+-]|\d+[.)]|`{3,}|~{3,})/,f=/^([#>+-].*|\d+[.)].*|`{3,}.*|~{3,}.*)\n\n[^\n]/m,p=d.test(r),m=d.test(i),h=f.test(r),g=f.test(i);(p!==m||h!==g)&&n.push(`block-separator-collapse`);let _=r.replace(/\r/g,``),v=i.replace(/\r/g,``),y=/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/m;(y.test(_)||y.test(v))&&n.push(`table-align-row-spacing`);let b=e=>y.test(e)&&/^\|[^\n]*[^|\s][ \t]*$/m.test(e);b(_)!==b(v)&&n.push(`row-no-trailing-pipe`);let x=/^[ \t]+([-+*]|\d+[.)]|[a-zA-Z][.)])\s/m;(x.test(_)||x.test(v))&&n.push(`list-indent-canonical`);let S=/[^\n]\n[ \t]+(?![-+*>#]|\d+[.)])\S/;(S.test(_)||S.test(v))&&n.push(`paragraph-continuation-indent`);let C=_.split(`
|
|
452
452
|
`),w=v.split(`
|
|
453
|
-
`),T=e=>{for(let t=0;t<e.length-1;t++){let n=(e[t]??``).trim(),r=(e[t+1]??``).trim(),i=n!==``&&r===``&&
|
|
453
|
+
`),T=e=>{for(let t=0;t<e.length-1;t++){let n=(e[t]??``).trim(),r=(e[t+1]??``).trim(),i=n!==``&&r===``&&D3.test(n),a=n===``&&r!==``&&D3.test(r);if(i||a)return!0}return!1};(T(C)||T(w))&&n.push(`jsx-container-boundary-blank`);let E=e=>e.replace(/^[ \t]+/,``).replace(b3,`1$1`),ee=Math.min(C.length,w.length);for(let e=0;e<ee;e++){let t=C[e]??``,r=w[e]??``;if(t!==r&&E(t)===E(r)&&/^[ \t]*\d+[.)]\s/.test(t)){n.push(`ordered-list-marker-number`);break}}return(/[ \t]\n/.test(_)||/[ \t]\n/.test(v))&&n.push(`trailing-whitespace`),(/[ \t]$/.test(_)||/[ \t]$/.test(v))&&(n.includes(`trailing-whitespace`)||n.push(`trailing-whitespace`)),(/\n{3,}/.test(_)||/\n{3,}/.test(v))&&n.push(`blank-line-collapse`),_.endsWith(`
|
|
454
454
|
`)!==v.endsWith(`
|
|
455
|
-
`)&&n.push(`trailing-newline`),n}const
|
|
456
|
-
`).map(e=>e.replace(V3,(e,t,n)=>`${t}1${n}`)).join(``).replace(/\s+/g,``)}const U3=new Set;function W3(e,t,n){let r=pK(e),i=pK(t);if(r.frontmatter!==i.frontmatter)return!1;if(r.body===i.body)return!0;let a;try{a=n(r.body)}catch(e){let t=e instanceof Error?e.message:String(e);return U3.size<8&&!U3.has(t)&&(U3.add(t),console.warn(`[parse-equivalence] canonicalizeBody threw; treating as not equivalent:`,t)),!1}return z3(B3(a))===z3(B3(i.body))?bJ(H3(r.body),H3(a)):!1}const G3={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e),now:()=>Date.now()},K3={"emphasis-around-code":`pm-model-caused`,bom:`parser-caused`,crlf:`parser-caused`,"commonmark-escape":`parser-caused`,"leading-newline":`parser-caused`,"paragraph-continuation-indent":`parser-caused`,"doc-start-thematic":`parser-caused`,"block-separator-collapse":`serializer-caused`,"table-align-row-spacing":`serializer-caused`,"row-no-trailing-pipe":`serializer-caused`,"ordered-list-marker-number":`serializer-caused`,"list-indent-canonical":`serializer-caused`,"jsx-container-boundary-blank":`serializer-caused`,"trailing-whitespace":`serializer-caused`,"blank-line-collapse":`serializer-caused`,"trailing-newline":`serializer-caused`,"parse-equivalence":`parser-caused`};function q3(e){return K3[e]}function J3(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e.charCodeAt(r)!==t.charCodeAt(r))return r;return e.length===t.length?-1:n}let Y3=null;function X3(e){Y3=e}function Z3(e,t,n,r){if(!Y3||e.length===0)return;let i=J3(t,n),a=new Date().toISOString();for(let t of e)Y3({timestamp:a,className:t,documentName:r,codeUnitPosition:i,severity:q3(t)})}const Q3=1e4,$3=`last-spawn-error.log`,e6=/^[a-zA-Z0-9][\w/-]*$/;function t6(e){return e.startsWith(`#`)?e.slice(1):e}function n6(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function r6(e){if(!e||e.trim()===``)return[];let{map:t}=U4(e);if(!t)return[];let n=n6(t.tags),r=[];for(let e of n){let t=t6(e);e6.test(t)&&r.push(t)}return r}const i6=[`.ok`,`local`,`installed-skills.json`],a6=F(EG),o6=Zs({hosts:N(A()),scope:a6,scripts:M(),installedAt:Go()}),s6=Zs({schema:I(1),skills:ac(A(),o6).default({})});function c6(){return{schema:1,skills:{}}}function l6(e){let t;try{t=JSON.parse(e)}catch{return null}let n=s6.safeParse(t);return n.success?n.data:null}const u6={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},d6=new WeakMap;function f6(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function p6(e){return e.trim().toLowerCase()}const m6=/\.(?:md|mdx)$/;function h6(e,t){if(t!==`page`)return e;let n=e.replace(m6,``);return n.length>0?n:e}function g6(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function _6(e){let t=g6(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0,i=e.path.split(`/`).filter(Boolean),a=new Set(i),o=[...new Set((e.aliases??[]).flatMap(e=>e.split(`/`).filter(Boolean)).filter(e=>!a.has(e)))];return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:[...i,...o].join(` `),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function v6(e){let t=CW({schema:u6});return e.length>0&&PW(t,e),t}function y6(e){let t={documents:e};return d6.set(t,v6(e)),t}function b6(e){let t=d6.get(e);if(t)return t;let n=v6(e.documents);return d6.set(e,n),n}function x6(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function S6(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function C6(e,t){let n=p6(t);if(!n)return 0;let r=h6(n,e.kind),i=p6(e.title),a=p6(e.name),o=p6(e.path),s=o.split(`/`);return i===r||a===r?700:o===r?650:i.startsWith(r)||a.startsWith(r)?600:s.some(e=>e.startsWith(r))?550:i.includes(r)||a.includes(r)?500:o.includes(r)?450:-1}function w6(e,t){let n=C6(e,t);return n<=0?n:Eq(e.path)?n*.5:n}function T6(e){return e===`file`?-60:0}function E6(e,t,n,r,i){let a=i>0?t/i:0,o=n/50,s=r===`file`?-.001:0,c=1*a+1*o+s;return e*1e3+c}function D6(e,t,n,r){return e+t*20+n+T6(r)}function O6(e,t,n,r,i,a){return e===`relevance`?D6(t,n,r,i):E6(t,n,r,i,a)}function k6(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function A6(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function j6(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function M6(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function N6(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}function P6(e,t){return p6(t).length<4?0:e===`full_text`?1:0}function F6(e){let{lexical:t,fullText:n}=e.signals;return t>=500?`lexical`:t===450&&n<=0?`pathOnly`:`body`}function I6(e){let t=[],n=[],r=[];for(let i of e){let e=F6(i);e===`lexical`?t.length<100&&t.push(i):e===`body`?n.length<6&&n.push(i):r.length<4&&r.push(i)}return[...t,...n,...r]}function L6(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=I6(e),i=[],a=0,o=0;for(let e of r){if(e.document.kind===`folder`){if(a>=3)continue;a+=1}else if(e.document.kind===`file`){if(o>=3)continue;o+=1}if(i.push(e),i.length>=n)break}return i}function R6(e,t,n={}){let r=n.intent??`omnibar`,i=k6(r,n.ranking),a=f6(n.limit),o=new Set(n.scopes??x6(r)),s=e.documents.filter(e=>S6(e,o)),c=p6(t);if(!c)return s.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,a).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let l=uG(b6(e),{term:c,properties:M6(r),boost:N6(r),tolerance:P6(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>S6(e.document,o)).map(e=>[e.document.id,e.score])),d=j6(s),f=new Map;for(let e of s)w6(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)S6(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=A6(f.values(),u);return L6([...f.values()].map(t=>{let n=Math.max(0,w6(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:O6(i,n,r,a,t.kind,e),signals:{lexical:n,fullText:r,recency:a}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score),i,a)}return L6(B6({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function z6(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function B6(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,ranking:o,semantic:s}=e,c=s.rrfK??60,l=s.candidateLimit??64,u=s.similarityFloor??0,d=s.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=A6(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,w6(e,a)),n=r.get(e.id)??0,s=i.get(e.id)??0,c=d.get(e.id),l=c!==void 0&&c>=u;return{document:e,score:t>0?O6(o,t,n,s,e.kind,m):D6(t,n,s,e.kind),signals:l?{lexical:t,fullText:n,recency:s,vector:c}:{lexical:t,fullText:n,recency:s},lexical:t,fullText:n,recency:s,cosine:c}}),g=z6(h.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=z6(h.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),v=e=>{let t=0,n=g.get(e);n!==void 0&&(t+=1/(c+n));let r=_.get(e);return r!==void 0&&(t+=1/(c+r)),t};return h.sort((e,t)=>{let n=e.lexical>0?1:0,r=t.lexical>0?1:0;if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=v(e.document.id),a=v(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n}))}function V6(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),H6(n)}function H6(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}const U6=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),W6=globalThis;W6[U6]===void 0&&(W6[U6]=Ri());const G6=W6[U6],K6=[`.ok`,`skill-state.yml`],q6=[`claude-cowork`,`cli-hosts`],J6=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],Y6=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,X6=Zs({version:A().regex(Y6,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(G6,{description:`Recorded skill version for this target.`}),recordedAt:Go().register(G6,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:F(J6).register(G6,{description:`Install-source surface that recorded this entry.`}).optional()}),Z6=Zs({enabled:M().register(G6,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Go().register(G6,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})}),Q6=Zs({schema:I(1).register(G6,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Zs({"claude-cowork":X6.optional(),"cli-hosts":X6.optional()}).register(G6,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:ac(A(),Z6).register(G6,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional()});function $6(e,t){return e??t.installedOnDisk}function e8(){return{schema:1,targets:{}}}const t8=`template`;function n8(e){if(e.trim()===``)return{};let t;try{t=(0,Fc.parse)(e)}catch{return{}}return typeof t!=`object`||!t||Array.isArray(t)?{}:t}function r8(e,t){return e.trim()===``?t:`---\n${e}\n---\n${t}`}function i8(e){let{frontmatter:t,body:n}=pK(e);return t===``?{docFrontmatterText:``,markdown:e}:{docFrontmatterText:hK(t),markdown:n}}function a8(e){let t=e.split(`
|
|
457
|
-
`);if(!(t[0]??``).startsWith(`template:`))return null;let n=[t[0]??``],r=1;for(;r<t.length;){let e=t[r]??``;if(/^[ \t]/.test(e)){n.push(e),r++;continue}if(e.trim()===``){let i=r+1;for(;i<t.length&&(t[i]??``).trim()===``;)i++;if(i<t.length&&/^[ \t]/.test(t[i]??``)){n.push(e),r++;continue}}break}let i=
|
|
458
|
-
`))[
|
|
459
|
-
`).replace(/\n+$/,``)}}function o8(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,{frontmatter:n,body:r}=pK(t);if(n===``)return{identity:{},starterContent:t};let i=hK(n),a=a8(i);if(a)return{identity:a.identity,starterContent:r8(a.docFrontmatterText,r)};let{frontmatter:o}=pK(r);if(o!==``)return{identity:n8(i),starterContent:r};let s=n8(i);return typeof s.title==`string`?{identity:s,starterContent:r}:{identity:{},starterContent:r8(i,r)}}function s8(e,t){let{docFrontmatterText:n,markdown:r}=i8(t),i={};for(let[t,n]of Object.entries(e))n!==void 0&&(i[t]=n);let a=(0,Fc.stringify)({[t8]:i});return`---\n${n.trim()===``?a:`${a}${n}\n`}---\n${r}`}function c8(e){return o8(e).starterContent}function l8(){let e=!1,t=``,n=0;return r=>{let i=u8(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function u8(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}const d8=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],f8={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function p8(e,t=d8){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const m8={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function h8(e){return e?m8[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const g8={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function _8(e){let t=e?.trim();return t?g8[h8(t)]??t:`Agent`}function v8(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}const y8=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function b8(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function x8(e){let t=e.trim();return y8.test(t)||t.startsWith(`//`)}function S8(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if(x8(n))return{kind:`external`,url:n};let r=v8(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=b8(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function C8(e,t){let n=e.trim();if(!n)return null;if(x8(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=b8(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function w8(e,t){let n=e.trim();if(!n||y8.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function T8(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function E8(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function D8(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function O8(e){return e.split(`/`).filter(e=>e!==``)}function k8(e,t){let n=D8(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function A8(e,t){let n=D8(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:O8(r).length}function j8(e,t){let n=O8(e),r=O8(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function M8(){let e=new Map;function t(t){let n=T8(t);if(n===``)return;let r=E8(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=T8(t),r=E8(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=D8(T8(n)),o=[],s=[];for(let e of i)k8(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=A8(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=A8(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=j8(a,D8(t));for(let r=1;r<e.length;r++){let i=e[r],o=j8(a,D8(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}function N8(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function P8(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}function F8(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function I8(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}const L8=/^[A-Za-z0-9-]{8,64}$/;let R8=null;function z8(e){return l(e??m(),`.ok`,`machine-id`)}function B8(e){if(e===void 0&&R8!==null)return R8;let t=z8(e),n=null;try{let e=b(t,`utf-8`).trim();L8.test(e)&&(n=e)}catch{}if(n===null){n=w();try{v(c(t),{recursive:!0}),S(t,`${n}\n`,{encoding:`utf-8`,mode:384})}catch(e){console.warn(`[machine-id] Failed to persist ${t} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${e instanceof Error?e.message:String(e)}`)}}return e===void 0&&(R8=n),n}function V8(){try{let e=u(c(f(import.meta.url)),`..`,`package.json`),t=JSON.parse(b(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}const H8=V8(),U8=1;var W8=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`OpenKnowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function G8(e,t){return u(e,`${t}.lock`)}const K8=new Map;function q8(e){K8.set(e,(K8.get(e)??0)+1)}function J8(e){let t=K8.get(e);return t===void 0||t<=1?(K8.delete(e),!0):(K8.set(e,t-1),!1)}function Y8(e){return typeof e.machineId==`string`?e.machineId===B8():e.hostname===h()}const X8=new Set;let Z8=!1;function Q8(e){X8.add(e),!Z8&&(Z8=!0,process.on(`exit`,()=>{for(let e of X8)try{let t=JSON.parse(b(e,`utf-8`));if(t?.pid!==process.pid||typeof t.machineId==`string`&&t.machineId!==B8()||t.machineId===void 0&&typeof t.hostname==`string`&&t.hostname!==h())continue;x(e)}catch{}}))}function $8(e,t){try{let n=JSON.parse(b(e,`utf-8`));return n&&typeof n==`object`&&I8(n.pid)?n:(console.warn(`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return console.warn(`${t} Corrupt lock file at ${e} — replacing`),null}}function e5(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;v(n,{recursive:!0});let a=G8(n,t),o={pid:process.pid,hostname:h(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,machineId:B8(),...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??H8},s=JSON.stringify(o,null,2);for(let e=0;e<3;e++){if(!_(a))try{let e=y(a,`wx`,384);try{C(e,s)}finally{g(e)}return q8(a),Q8(a),t5({lockName:t,lockDir:n,lockPath:a})}catch(e){if(e.code!==`EEXIST`)throw e}let e=$8(a,i);if(e){if(Y8(e)&&e.pid===process.pid)return S(a,s,{encoding:`utf-8`,mode:384}),q8(a),Q8(a),t5({lockName:t,lockDir:n,lockPath:a});if(F8(e.pid))throw new W8(e,a,t);console.warn(`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{x(a)}catch{}}throw Error(`${i} Failed to acquire ${a} after 3 attempts (concurrent acquire contention).`)}function t5(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>s5({lockName:t,lockDir:n}),updatePort:e=>n5({lockName:t,lockDir:n,port:e})}}function n5(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=G8(n,t);if(!_(a)){console.warn(`${i} Lock file missing at ${a} during port update — skipping`);return}let o;try{let e=JSON.parse(b(a,`utf-8`));if(!e||typeof e!=`object`||!I8(e.pid)){console.warn(`${i} Corrupt lock at ${a} during port update — skipping`);return}o=e}catch{console.warn(`${i} Unreadable lock at ${a} during port update — skipping`);return}if(o.pid===process.pid&&Y8(o)){o.port=r;try{S(a,JSON.stringify(o,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${i} Failed to update port in ${a}: ${e instanceof Error?e.message:String(e)}`)}}}function r5(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=G8(n,t);if((K8.get(i)??0)>1)return;let a;try{let e=JSON.parse(b(i,`utf-8`));if(!e||typeof e!=`object`||!I8(e.pid)){console.warn(`${r} Corrupt lock at ${i} during draining mark — skipping`);return}a=e}catch(e){e.code!==`ENOENT`&&console.warn(`${r} Unreadable lock at ${i} during draining mark — skipping: ${e instanceof Error?e.message:String(e)}`);return}if(a.pid===process.pid&&Y8(a)&&a.draining!==!0){a.draining=!0;try{S(i,JSON.stringify(a,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${r} Failed to mark ${i} draining: ${e instanceof Error?e.message:String(e)}`)}}}function i5(e){let{lockName:t,lockDir:n}=e,r=G8(n,t);if(!_(r))return null;let i;try{let e=JSON.parse(b(r,`utf-8`));if(!e||typeof e!=`object`||!I8(e.pid))return null;i=e}catch{return null}if(!Y8(i))return null;if(!F8(i.pid)){try{x(r)}catch{}return null}return i}function a5(e){let{lockName:t,lockDir:n}=e,r=G8(n,t);if(!_(r))return{status:`absent`};let i;try{i=JSON.parse(b(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let a=i;if(!I8(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o={pid:a.pid,hostname:a.hostname,port:a.port,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,machineId:typeof a.machineId==`string`?a.machineId:void 0,draining:a.draining===!0?!0:void 0,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(!Y8(o))return{status:`stale`,lock:o};if(!F8(o.pid)){try{x(r)}catch{}return{status:`stale`,lock:o}}return o.protocolVersion===void 0||o.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:o}}async function o5(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>i5({lockName:t,lockDir:n})),o=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),s=a();if(s===null||s.draining!==!0)return`no-drain`;let c=Date.now()+r;for(;Date.now()<c;){await o(i);let e=a();if(e===null)return`released`;if(e.draining!==!0)return`no-drain`}return`timeout`}function s5(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,i=`[${t}-lock]`,a=G8(n,t);if(J8(a)){if(r){r5({lockName:t,lockDir:n});return}if(_(a))try{let e=JSON.parse(b(a,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!Y8(e))return;x(a),X8.delete(a)}catch(e){console.warn(`${i} Failed to release ${a}: ${e instanceof Error?e.message:String(e)}`)}}}var c5=class extends W8{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function l5(e,t){try{return e5({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof W8&&e.lockName===`server`?new c5(e.existing,e.lockPath):e}}function u5(e,t){n5({lockName:`server`,lockDir:e,port:t})}function d5(e){return i5({lockName:`server`,lockDir:e})}function f5(e,t){s5({lockName:`server`,lockDir:e,...t})}function p5(e){r5({lockName:`server`,lockDir:e})}function m5(e,t){return o5({lockName:`server`,lockDir:e,...t})}export{hG as $,Ml as $a,U4 as $i,Hq as $n,D0 as $r,_0 as $t,h1 as A,wq as Aa,e8 as Ai,OG as An,ac as Ao,P0 as Ar,A2 as At,E1 as B,Cl as Ba,c8 as Bi,Z1 as Bn,si as Bo,t8 as Br,i6 as Bt,w1 as C,IG as Ca,_6 as Ci,uJ as Cn,rc as Co,f4 as Cr,U0 as Ct,A1 as D,r3 as Da,_8 as Di,n0 as Dn,P as Do,X2 as Dr,Y1 as Dt,g1 as E,P8 as Ea,J4 as Ei,Y0 as En,j as Eo,l4 as Er,KG as Et,V1 as F,uu as Fa,X$ as Fi,S2 as Fn,Go as Fo,u2 as Fr,u1 as Ft,j4 as G,Kc as Ga,DG as Gi,v2 as Gn,gn as Go,N2 as Gr,QG as Gt,N4 as H,Sl as Ha,p1 as Hi,y4 as Hn,un as Ho,O2 as Hr,x2 as Ht,B1 as I,qc as Ia,W$ as Ii,$3 as In,Uo as Io,d2 as Ir,JG as It,E4 as J,lu as Ja,Gq as Ji,lJ as Jn,Dt as Jo,F2 as Jr,r0 as Jt,O4 as K,Xc as Ka,eK as Ki,p2 as Kn,cn as Ko,R2 as Kr,HG as Kt,nJ as L,su as La,GY as Li,VG as Ln,ma as Lo,o2 as Lr,$1 as Lt,m1 as M,_b as Ma,N8 as Mi,K6 as Mn,$s as Mo,u0 as Mr,U1 as Mt,O1 as N,sp as Na,r6 as Ni,q6 as Nn,Ks as No,f2 as Nr,M1 as Nt,_1 as O,H$ as Oa,Z3 as Oi,e2 as On,dc as Oo,Z2 as Or,L0 as Ot,dJ as P,L as Pa,E$ as Pi,Y6 as Pn,xs as Po,l2 as Pr,N1 as Pt,vG as Q,Jc as Qa,d3 as Qi,zq as Qn,mt as Qo,E0 as Qr,m0 as Qt,i3 as R,Ol as Ra,_q as Ri,_G as Rn,Ka as Ro,s2 as Rr,e0 as Rt,WG as S,Cq as Sa,y6 as Si,W0 as Sn,tc as So,d4 as Sr,H0 as St,w0 as T,pK as Ta,L3 as Ti,J0 as Tn,Zs as To,c4 as Tr,YG as Tt,M4 as U,xl as Ua,Eq as Ui,m2 as Un,fn as Uo,E2 as Ur,N0 as Ut,k4 as V,wl as Va,qq as Vi,h4 as Vn,br as Vo,W2 as Vr,y2 as Vt,A4 as W,bl as Wa,eJ as Wi,h2 as Wn,mn as Wo,L2 as Wr,s6 as Wt,w4 as X,ru as Xa,p3 as Xi,Fq as Xn,O as Xo,P2 as Xr,a0 as Xt,T4 as Y,cu as Ya,BG as Yi,Mq as Yn,k as Yo,I2 as Yr,i0 as Yt,S4 as Z,Yc as Za,I3 as Zi,Bq as Zn,ht as Zo,O0 as Zr,y0 as Zt,f5 as _,jG as _a,s8 as _i,nK as _n,Hs as _o,m4 as _r,l0 as _t,e5 as a,o8 as aa,hJ as ai,p0 as an,fl as ao,i4 as ar,rJ as at,m5 as b,X3 as ba,l8 as bi,mG as bn,M as bo,C2 as br,R1 as bt,F8 as c,a1 as ca,R4 as ci,EG as cn,ml as co,K2 as cr,F1 as ct,r5 as d,Z4 as da,$q as di,M0 as dn,Ll as do,s4 as dr,R0 as dt,FG as ea,T0 as ei,v0 as en,zl as eo,Wq as er,CG as et,p5 as f,s3 as fa,S8 as fi,A0 as fn,Al as fo,$2 as fr,z0 as ft,s5 as g,v8 as ga,RJ as gi,R3 as gn,F as go,p4 as gr,UG as gt,d5 as h,$6 as ha,p8 as hi,o0 as hn,uc as ho,Y2 as hr,Q3 as ht,c5 as i,T2 as ia,gJ as ii,d0 as in,Jl as io,a4 as ir,bG as it,k1 as j,q4 as ja,V6 as ji,V2 as jn,A as jo,vJ as jr,j2 as jt,j1 as k,hK as ka,c6 as ki,t2 as kn,Pc as ko,q2 as kr,k2 as kt,I8 as l,c3 as la,n3 as li,tK as ln,El as lo,o4 as lr,B0 as lt,a5 as m,w8 as ma,gG as mi,$G as mn,Ls as mo,J2 as mr,aK as mt,H8 as n,RG as na,$0 as ni,g0 as nn,ou as no,sJ as nr,yG as nt,l5 as o,mK as oa,t0 as oi,wG as on,Dl as oo,n4 as or,aJ as ot,i5 as p,o1 as pa,C8 as pi,k0 as pn,jl as po,e4 as pr,ZG as pt,C4 as q,pl as qa,W3 as qi,v4 as qn,zt as qo,z2 as qr,K1 as qt,U8 as r,NG as ra,XG as ri,h0 as rn,Zl as ro,Q2 as rr,xG as rt,B8 as s,rK as sa,z4 as si,TG as sn,tu as so,r4 as sr,P1 as st,W8 as t,l6 as ta,Q0 as ti,_J as tn,Tl as to,oJ as tr,SG as tt,G8 as u,kG as ua,pJ as ui,D$ as un,Bl as uo,x4 as ur,V0 as ut,n5 as v,R6 as va,U2 as vi,iK as vn,Ws as vo,B2 as vr,X0 as vt,C0 as w,o3 as wa,G3 as wi,mJ as wn,I as wo,w2 as wr,GG as wt,f8 as x,xq as xa,$Z as xi,K0 as xn,jc as xo,u4 as xr,L1 as xt,u5 as y,W4 as ya,M8 as yi,qG as yn,N as yo,Q6 as yr,Z0 as yt,g3 as z,Zc as za,h8 as zi,X1 as zn,qa as zo,c2 as zr,s0 as zt};
|
|
460
|
-
//# sourceMappingURL=server-lock-iLcBw_q0-
|
|
455
|
+
`)&&n.push(`trailing-newline`),n}const P3=`parse-equivalence`;function F3(e){return e.replace(/^\n+/,``).replace(/\n+$/,``)}function I3(e){return e.replace(/[ \t]+$/gm,``)}const L3=/^([ \t]*)\d+([.)])(?=[ \t])/;function R3(e){return e.split(`
|
|
456
|
+
`).map(e=>e.replace(L3,(e,t,n)=>`${t}1${n}`)).join(``).replace(/\s+/g,``)}const z3=new Set;function B3(e,t,n){let r=fK(e),i=fK(t);if(r.frontmatter!==i.frontmatter)return!1;if(r.body===i.body)return!0;let a;try{a=n(r.body)}catch(e){let t=e instanceof Error?e.message:String(e);return z3.size<8&&!z3.has(t)&&(z3.add(t),console.warn(`[parse-equivalence] canonicalizeBody threw; treating as not equivalent:`,t)),!1}return F3(I3(a))===F3(I3(i.body))?yJ(R3(r.body),R3(a)):!1}const V3={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e),now:()=>Date.now()},H3={"emphasis-around-code":`pm-model-caused`,bom:`parser-caused`,crlf:`parser-caused`,"commonmark-escape":`parser-caused`,"leading-newline":`parser-caused`,"paragraph-continuation-indent":`parser-caused`,"doc-start-thematic":`parser-caused`,"block-separator-collapse":`serializer-caused`,"table-align-row-spacing":`serializer-caused`,"row-no-trailing-pipe":`serializer-caused`,"ordered-list-marker-number":`serializer-caused`,"list-indent-canonical":`serializer-caused`,"jsx-container-boundary-blank":`serializer-caused`,"trailing-whitespace":`serializer-caused`,"blank-line-collapse":`serializer-caused`,"trailing-newline":`serializer-caused`,"parse-equivalence":`parser-caused`};function U3(e){return H3[e]}function W3(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e.charCodeAt(r)!==t.charCodeAt(r))return r;return e.length===t.length?-1:n}let G3=null;function K3(e){G3=e}function q3(e,t,n,r){if(!G3||e.length===0)return;let i=W3(t,n),a=new Date().toISOString();for(let t of e)G3({timestamp:a,className:t,documentName:r,codeUnitPosition:i,severity:U3(t)})}const J3=1e4,Y3=`last-spawn-error.log`,X3=/^[a-zA-Z0-9][\w/-]*$/;function Z3(e){return e.startsWith(`#`)?e.slice(1):e}function Q3(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function $3(e){if(!e||e.trim()===``)return[];let{map:t}=z4(e);if(!t)return[];let n=Q3(t.tags),r=[];for(let e of n){let t=Z3(e);X3.test(t)&&r.push(t)}return r}const e6=[`.ok`,`local`,`installed-skills.json`],t6=F(EG),n6=Zs({hosts:N(A()),scope:t6,scripts:M(),installedAt:Go()}),r6=Zs({schema:I(1),skills:ac(A(),n6).default({})});function i6(){return{schema:1,skills:{}}}function a6(e){let t;try{t=JSON.parse(e)}catch{return null}let n=r6.safeParse(t);return n.success?n.data:null}const o6={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},s6=new WeakMap;function c6(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function l6(e){return e.trim().toLowerCase()}const u6=/\.(?:md|mdx)$/;function d6(e,t){if(t!==`page`)return e;let n=e.replace(u6,``);return n.length>0?n:e}function f6(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function p6(e){let t=f6(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0,i=e.path.split(`/`).filter(Boolean),a=new Set(i),o=[...new Set((e.aliases??[]).flatMap(e=>e.split(`/`).filter(Boolean)).filter(e=>!a.has(e)))];return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:[...i,...o].join(` `),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function m6(e){let t=CW({schema:o6});return e.length>0&&PW(t,e),t}function h6(e){let t={documents:e};return s6.set(t,m6(e)),t}function g6(e){let t=s6.get(e);if(t)return t;let n=m6(e.documents);return s6.set(e,n),n}function _6(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function v6(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function y6(e,t){let n=l6(t);if(!n)return 0;let r=d6(n,e.kind),i=l6(e.title),a=l6(e.name),o=l6(e.path),s=o.split(`/`);return i===r||a===r?700:o===r?650:i.startsWith(r)||a.startsWith(r)?600:s.some(e=>e.startsWith(r))?550:i.includes(r)||a.includes(r)?500:o.includes(r)?450:-1}function b6(e,t){let n=y6(e,t);return n<=0?n:Tq(e.path)?n*.5:n}function x6(e){return e===`file`?-60:0}function S6(e,t,n,r,i){let a=i>0?t/i:0,o=n/50,s=r===`file`?-.001:0,c=1*a+1*o+s;return e*1e3+c}function C6(e,t,n,r){return e+t*20+n+x6(r)}function w6(e,t,n,r,i,a){return e===`relevance`?C6(t,n,r,i):S6(t,n,r,i,a)}function T6(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function E6(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function D6(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function O6(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function k6(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}function A6(e,t){return l6(t).length<4?0:e===`full_text`?1:0}function j6(e){let{lexical:t,fullText:n}=e.signals;return t>=500?`lexical`:t===450&&n<=0?`pathOnly`:`body`}function M6(e){let t=[],n=[],r=[];for(let i of e){let e=j6(i);e===`lexical`?t.length<100&&t.push(i):e===`body`?n.length<6&&n.push(i):r.length<4&&r.push(i)}return[...t,...n,...r]}function N6(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=M6(e),i=[],a=0,o=0;for(let e of r){if(e.document.kind===`folder`){if(a>=3)continue;a+=1}else if(e.document.kind===`file`){if(o>=3)continue;o+=1}if(i.push(e),i.length>=n)break}return i}function P6(e,t,n={}){let r=n.intent??`omnibar`,i=T6(r,n.ranking),a=c6(n.limit),o=new Set(n.scopes??_6(r)),s=e.documents.filter(e=>v6(e,o)),c=l6(t);if(!c)return s.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,a).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let l=uG(g6(e),{term:c,properties:O6(r),boost:k6(r),tolerance:A6(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>v6(e.document,o)).map(e=>[e.document.id,e.score])),d=D6(s),f=new Map;for(let e of s)b6(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)v6(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=E6(f.values(),u);return N6([...f.values()].map(t=>{let n=Math.max(0,b6(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:w6(i,n,r,a,t.kind,e),signals:{lexical:n,fullText:r,recency:a}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score),i,a)}return N6(I6({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function F6(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function I6(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,ranking:o,semantic:s}=e,c=s.rrfK??60,l=s.candidateLimit??64,u=s.similarityFloor??0,d=s.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=E6(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,b6(e,a)),n=r.get(e.id)??0,s=i.get(e.id)??0,c=d.get(e.id),l=c!==void 0&&c>=u;return{document:e,score:t>0?w6(o,t,n,s,e.kind,m):C6(t,n,s,e.kind),signals:l?{lexical:t,fullText:n,recency:s,vector:c}:{lexical:t,fullText:n,recency:s},lexical:t,fullText:n,recency:s,cosine:c}}),g=F6(h.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=F6(h.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),v=e=>{let t=0,n=g.get(e);n!==void 0&&(t+=1/(c+n));let r=_.get(e);return r!==void 0&&(t+=1/(c+r)),t};return h.sort((e,t)=>{let n=e.lexical>0?1:0,r=t.lexical>0?1:0;if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=v(e.document.id),a=v(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n}))}function L6(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),R6(n)}function R6(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}const z6=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),B6=globalThis;B6[z6]===void 0&&(B6[z6]=Ri());const V6=B6[z6],H6=[`.ok`,`skill-state.yml`],U6=[`claude-cowork`,`cli-hosts`],W6=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],G6=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,K6=Zs({version:A().regex(G6,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(V6,{description:`Recorded skill version for this target.`}),recordedAt:Go().register(V6,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:F(W6).register(V6,{description:`Install-source surface that recorded this entry.`}).optional()}),q6=Zs({enabled:M().register(V6,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Go().register(V6,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})}),J6=Zs({schema:I(1).register(V6,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Zs({"claude-cowork":K6.optional(),"cli-hosts":K6.optional()}).register(V6,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:ac(A(),q6).register(V6,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional()});function Y6(e,t){return e??t.installedOnDisk}function X6(){return{schema:1,targets:{}}}const Z6=`template`;function Q6(e){if(e.trim()===``)return{};let t;try{t=(0,Fc.parse)(e)}catch{return{}}return typeof t!=`object`||!t||Array.isArray(t)?{}:t}function $6(e,t){return e.trim()===``?t:`---\n${e}\n---\n${t}`}function e8(e){let{frontmatter:t,body:n}=fK(e);return t===``?{docFrontmatterText:``,markdown:e}:{docFrontmatterText:mK(t),markdown:n}}function t8(e){let t=e.split(`
|
|
457
|
+
`);if(!(t[0]??``).startsWith(`template:`))return null;let n=[t[0]??``],r=1;for(;r<t.length;){let e=t[r]??``;if(/^[ \t]/.test(e)){n.push(e),r++;continue}if(e.trim()===``){let i=r+1;for(;i<t.length&&(t[i]??``).trim()===``;)i++;if(i<t.length&&/^[ \t]/.test(t[i]??``)){n.push(e),r++;continue}}break}let i=Q6(n.join(`
|
|
458
|
+
`))[Z6];return{identity:typeof i==`object`&&i&&!Array.isArray(i)?i:{},docFrontmatterText:t.slice(r).join(`
|
|
459
|
+
`).replace(/\n+$/,``)}}function n8(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,{frontmatter:n,body:r}=fK(t);if(n===``)return{identity:{},starterContent:t};let i=mK(n),a=t8(i);if(a)return{identity:a.identity,starterContent:$6(a.docFrontmatterText,r)};let{frontmatter:o}=fK(r);if(o!==``)return{identity:Q6(i),starterContent:r};let s=Q6(i);return typeof s.title==`string`?{identity:s,starterContent:r}:{identity:{},starterContent:$6(i,r)}}function r8(e,t){let{docFrontmatterText:n,markdown:r}=e8(t),i={};for(let[t,n]of Object.entries(e))n!==void 0&&(i[t]=n);let a=(0,Fc.stringify)({[Z6]:i});return`---\n${n.trim()===``?a:`${a}${n}\n`}---\n${r}`}function i8(e){return n8(e).starterContent}function a8(){let e=!1,t=``,n=0;return r=>{let i=o8(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function o8(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}const s8=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],c8={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function l8(e,t=s8){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const u8={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function d8(e){return e?u8[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const f8={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function p8(e){let t=e?.trim();return t?f8[d8(t)]??t:`Agent`}function m8(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}const h8=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function g8(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function _8(e){let t=e.trim();return h8.test(t)||t.startsWith(`//`)}function v8(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if(_8(n))return{kind:`external`,url:n};let r=m8(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=g8(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function y8(e,t){let n=e.trim();if(!n)return null;if(_8(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=g8(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function b8(e,t){let n=e.trim();if(!n||h8.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function x8(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function S8(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function C8(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function w8(e){return e.split(`/`).filter(e=>e!==``)}function T8(e,t){let n=C8(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function E8(e,t){let n=C8(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:w8(r).length}function D8(e,t){let n=w8(e),r=w8(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function O8(){let e=new Map;function t(t){let n=x8(t);if(n===``)return;let r=S8(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=x8(t),r=S8(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=C8(x8(n)),o=[],s=[];for(let e of i)T8(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=E8(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=E8(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=D8(a,C8(t));for(let r=1;r<e.length;r++){let i=e[r],o=D8(a,C8(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}function k8(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function A8(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}function j8(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function M8(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}const N8=/^[A-Za-z0-9-]{8,64}$/;let P8=null;function F8(e){return l(e??m(),`.ok`,`machine-id`)}function I8(e){if(e===void 0&&P8!==null)return P8;let t=F8(e),n=null;try{let e=b(t,`utf-8`).trim();N8.test(e)&&(n=e)}catch{}if(n===null){n=w();try{v(c(t),{recursive:!0}),S(t,`${n}\n`,{encoding:`utf-8`,mode:384})}catch(e){console.warn(`[machine-id] Failed to persist ${t} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${e instanceof Error?e.message:String(e)}`)}}return e===void 0&&(P8=n),n}function L8(){try{let e=u(c(f(import.meta.url)),`..`,`package.json`),t=JSON.parse(b(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}const R8=L8(),z8=1;var B8=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`OpenKnowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function V8(e,t){return u(e,`${t}.lock`)}const H8=new Map;function U8(e){H8.set(e,(H8.get(e)??0)+1)}function W8(e){let t=H8.get(e);return t===void 0||t<=1?(H8.delete(e),!0):(H8.set(e,t-1),!1)}function G8(e){return typeof e.machineId==`string`?e.machineId===I8():e.hostname===h()}const K8=new Set;let q8=!1;function J8(e){K8.add(e),!q8&&(q8=!0,process.on(`exit`,()=>{for(let e of K8)try{let t=JSON.parse(b(e,`utf-8`));if(t?.pid!==process.pid||typeof t.machineId==`string`&&t.machineId!==I8()||t.machineId===void 0&&typeof t.hostname==`string`&&t.hostname!==h())continue;x(e)}catch{}}))}function Y8(e,t){try{let n=JSON.parse(b(e,`utf-8`));return n&&typeof n==`object`&&M8(n.pid)?n:(console.warn(`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return console.warn(`${t} Corrupt lock file at ${e} — replacing`),null}}function X8(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;v(n,{recursive:!0});let a=V8(n,t),o={pid:process.pid,hostname:h(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,machineId:I8(),...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??R8},s=JSON.stringify(o,null,2);for(let e=0;e<3;e++){if(!_(a))try{let e=y(a,`wx`,384);try{C(e,s)}finally{g(e)}return U8(a),J8(a),Z8({lockName:t,lockDir:n,lockPath:a})}catch(e){if(e.code!==`EEXIST`)throw e}let e=Y8(a,i);if(e){if(G8(e)&&e.pid===process.pid)return S(a,s,{encoding:`utf-8`,mode:384}),U8(a),J8(a),Z8({lockName:t,lockDir:n,lockPath:a});if(j8(e.pid))throw new B8(e,a,t);console.warn(`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{x(a)}catch{}}throw Error(`${i} Failed to acquire ${a} after 3 attempts (concurrent acquire contention).`)}function Z8(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>r5({lockName:t,lockDir:n}),updatePort:e=>Q8({lockName:t,lockDir:n,port:e})}}function Q8(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=V8(n,t);if(!_(a)){console.warn(`${i} Lock file missing at ${a} during port update — skipping`);return}let o;try{let e=JSON.parse(b(a,`utf-8`));if(!e||typeof e!=`object`||!M8(e.pid)){console.warn(`${i} Corrupt lock at ${a} during port update — skipping`);return}o=e}catch{console.warn(`${i} Unreadable lock at ${a} during port update — skipping`);return}if(o.pid===process.pid&&G8(o)){o.port=r;try{S(a,JSON.stringify(o,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${i} Failed to update port in ${a}: ${e instanceof Error?e.message:String(e)}`)}}}function $8(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=V8(n,t);if((H8.get(i)??0)>1)return;let a;try{let e=JSON.parse(b(i,`utf-8`));if(!e||typeof e!=`object`||!M8(e.pid)){console.warn(`${r} Corrupt lock at ${i} during draining mark — skipping`);return}a=e}catch(e){e.code!==`ENOENT`&&console.warn(`${r} Unreadable lock at ${i} during draining mark — skipping: ${e instanceof Error?e.message:String(e)}`);return}if(a.pid===process.pid&&G8(a)&&a.draining!==!0){a.draining=!0;try{S(i,JSON.stringify(a,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${r} Failed to mark ${i} draining: ${e instanceof Error?e.message:String(e)}`)}}}function e5(e){let{lockName:t,lockDir:n}=e,r=V8(n,t);if(!_(r))return null;let i;try{let e=JSON.parse(b(r,`utf-8`));if(!e||typeof e!=`object`||!M8(e.pid))return null;i=e}catch{return null}if(!G8(i))return null;if(!j8(i.pid)){try{x(r)}catch{}return null}return i}function t5(e){let{lockName:t,lockDir:n}=e,r=V8(n,t);if(!_(r))return{status:`absent`};let i;try{i=JSON.parse(b(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let a=i;if(!M8(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o={pid:a.pid,hostname:a.hostname,port:a.port,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,machineId:typeof a.machineId==`string`?a.machineId:void 0,draining:a.draining===!0?!0:void 0,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(!G8(o))return{status:`stale`,lock:o};if(!j8(o.pid)){try{x(r)}catch{}return{status:`stale`,lock:o}}return o.protocolVersion===void 0||o.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:o}}async function n5(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>e5({lockName:t,lockDir:n})),o=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),s=a();if(s===null||s.draining!==!0)return`no-drain`;let c=Date.now()+r;for(;Date.now()<c;){await o(i);let e=a();if(e===null)return`released`;if(e.draining!==!0)return`no-drain`}return`timeout`}function r5(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,i=`[${t}-lock]`,a=V8(n,t);if(W8(a)){if(r){$8({lockName:t,lockDir:n});return}if(_(a))try{let e=JSON.parse(b(a,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!G8(e))return;x(a),K8.delete(a)}catch(e){console.warn(`${i} Failed to release ${a}: ${e instanceof Error?e.message:String(e)}`)}}}var i5=class extends B8{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function a5(e,t){try{return X8({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof B8&&e.lockName===`server`?new i5(e.existing,e.lockPath):e}}function o5(e,t){Q8({lockName:`server`,lockDir:e,port:t})}function s5(e){return e5({lockName:`server`,lockDir:e})}function c5(e,t){r5({lockName:`server`,lockDir:e,...t})}function l5(e){$8({lockName:`server`,lockDir:e})}function u5(e,t){return n5({lockName:`server`,lockDir:e,...t})}export{hG as $,Zl as $a,NG as $i,J2 as $n,XG as $r,d0 as $t,m1 as A,L as Aa,T$ as Ai,G6 as An,xs as Ao,a2 as Ar,E2 as At,T1 as B,bl as Ba,$q as Bi,d2 as Bn,mn as Bo,N2 as Br,e6 as Bt,C1 as C,$4 as Ca,p8 as Ci,t0 as Cn,P as Co,K2 as Cr,z0 as Ct,k1 as D,U4 as Da,L6 as Di,L2 as Dn,A as Do,_J as Dr,J1 as Dt,h1 as E,Cq as Ea,X6 as Ei,OG as En,ac as Eo,A0 as Er,KG as Et,B1 as F,Zc as Fa,d8 as Fi,Y1 as Fn,qa as Fo,i2 as Fr,l1 as Ft,D4 as G,cu as Ga,BG as Gi,jq as Gn,k as Go,M2 as Gr,HG as Gt,k4 as H,Xc as Ha,$G as Hi,l2 as Hn,cn as Ho,P2 as Hr,_2 as Ht,z1 as I,Cl as Ia,i8 as Ii,X1 as In,si as Io,Z6 as Ir,JG as It,S4 as J,Jc as Ja,s3 as Ji,Rq as Jn,mt as Jo,S0 as Jr,u0 as Jt,w4 as K,ru as Ka,l3 as Ki,Pq as Kn,O as Ko,A2 as Kr,G1 as Kt,tJ as L,wl as La,Kq as Li,d4 as Ln,br as Lo,B2 as Lr,Q1 as Lt,p1 as M,qc as Ma,U$ as Mi,Y3 as Mn,Uo as Mo,s2 as Mr,H1 as Mt,D1 as N,su as Na,WY as Ni,VG as Nn,ma as No,n2 as Nr,j1 as Nt,g1 as O,_b as Oa,k8 as Oi,H6 as On,$s as Oo,o0 as Or,N0 as Ot,uJ as P,Ol as Pa,gq as Pi,_G as Pn,Ka as Po,r2 as Pr,M1 as Pt,vG as Q,ou as Qa,RG as Qi,oJ as Qn,Y0 as Qr,f0 as Qt,e3 as R,Sl as Ra,f1 as Ri,h4 as Rn,un as Ro,w2 as Rr,$1 as Rt,WG as S,A8 as Sa,W4 as Si,G0 as Sn,j as So,a4 as Sr,R0 as St,b0 as T,mK as Ta,i6 as Ti,Z0 as Tn,Pc as To,U2 as Tr,YG as Tt,O4 as U,pl as Ua,B3 as Ui,m4 as Un,zt as Uo,F2 as Ur,k0 as Ut,T4 as V,Kc as Va,DG as Vi,m2 as Vn,gn as Vo,k2 as Vr,h2 as Vt,E4 as W,lu as Wa,Wq as Wi,cJ as Wn,Dt as Wo,j2 as Wr,r6 as Wt,b4 as X,zl as Xa,FG as Xi,Uq as Xn,x0 as Xr,m0 as Xt,x4 as Y,Ml as Ya,z4 as Yi,Vq as Yn,C0 as Yr,p0 as Yt,v4 as Z,Tl as Za,a6 as Zi,aJ as Zn,J0 as Zr,gJ as Zt,c5 as _,bq as _a,QZ as _i,H0 as _n,jc as _o,o4 as _r,a0 as _t,X8 as a,i3 as aa,Q4 as ai,eK as an,El as ao,n4 as ar,nJ as at,u5 as b,n3 as ba,V3 as bi,pJ as bn,I as bo,b2 as br,L1 as bt,j8 as c,r3 as ca,v8 as ci,E0 as cn,Al as co,Y2 as cr,P1 as ct,$8 as d,Y6 as da,l8 as di,n0 as dn,uc as do,G2 as dr,P0 as dt,x2 as ea,hJ as ei,s0 as en,Jl as eo,t4 as er,CG as et,l5 as f,m8 as fa,LJ as fi,P3 as fn,F as fo,l4 as fr,F0 as ft,r5 as g,K3 as ga,a8 as gi,mG as gn,M as go,y2 as gr,UG as gt,s5 as h,B4 as ha,O8 as hi,qG as hn,N as ho,J6 as hr,J3 as ht,i5 as i,i1 as ia,P4 as ii,EG as in,ml as io,H2 as ir,bG as it,O1 as j,uu as ja,Y$ as ji,v2 as jn,Go as jo,o2 as jr,D2 as jt,A1 as k,sp as ka,$3 as ki,U6 as kn,Ks as ko,c2 as kr,T2 as kt,M8 as l,a1 as la,y8 as li,T0 as ln,jl as lo,X2 as lr,I0 as lt,t5 as m,P6 as ma,z2 as mi,rK as mn,Ws as mo,I2 as mr,iK as mt,R8 as n,pK as na,e0 as ni,wG as nn,Dl as no,Q2 as nr,yG as nt,a5 as o,kG as oa,fJ as oi,E$ as on,Bl as oo,_4 as or,iJ as ot,e5 as p,jG as pa,r8 as pi,tK as pn,Hs as po,u4 as pr,ZG as pt,y4 as q,Yc as qa,M3 as qi,zq as qn,ht as qo,w0 as qr,h0 as qt,z8 as r,nK as ra,F4 as ri,TG as rn,tu as ro,$2 as rr,xG as rt,I8 as s,q4 as sa,Qq as si,O0 as sn,Ll as so,r4 as sr,N1 as st,B8 as t,n8 as ta,mJ as ti,l0 as tn,fl as to,e4 as tr,SG as tt,V8 as u,b8 as ua,gG as ui,QG as un,Ls as uo,W2 as ur,L0 as ut,Q8 as v,Sq as va,h6 as vi,B0 as vn,tc as vo,s4 as vr,K0 as vt,y0 as w,V$ as wa,q3 as wi,X0 as wn,dc as wo,q2 as wr,GG as wt,c8 as x,fK as xa,N3 as xi,W0 as xn,Zs as xo,i4 as xr,I1 as xt,o5 as y,IG as ya,p6 as yi,lJ as yn,rc as yo,c4 as yr,q0 as yt,f3 as z,xl as za,Tq as zi,u2 as zn,fn as zo,S2 as zr,r0 as zt};
|
|
460
|
+
//# sourceMappingURL=server-lock-iLcBw_q0-6FEAZKHu.mjs.map
|