@inkeep/open-knowledge 0.46.0-beta.17 → 0.46.0-beta.19
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/{acp-harness-probe-De8I5GLi.mjs → acp-harness-probe-Citbab-5.mjs} +2 -2
- package/dist/assets/skills/write-skill/SKILL.md +5 -2
- package/dist/cli.mjs +7 -7
- package/dist/config-schema.json +20 -0
- package/dist/config.project.schema.json +3 -0
- package/dist/config.user.schema.json +47 -0
- package/dist/constants-Bs8Sdcru.mjs +2 -0
- package/dist/{fs-traced-wfI5VoOz.mjs → fs-traced-BxDcwVzG.mjs} +2 -2
- package/dist/fs-traced-C4vgso5m.mjs +1 -0
- package/dist/{git-handle-TtCDd9Le.mjs → git-handle-C-4njDy4.mjs} +2 -2
- package/dist/git-handle-DBNV29KD.mjs +1 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +1 -1
- package/dist/{init-CpL53GmG.mjs → init-DEMEBRkr.mjs} +36 -36
- package/dist/init-DsvGKuD0.mjs +1 -0
- package/dist/{launch-json-removal-A2gRrDY9.mjs → launch-json-removal-DfjmJ4T1.mjs} +2 -2
- package/dist/loader-CI_L6sck.mjs +1 -0
- package/dist/{loader-Dtp3Zsz2.mjs → loader-YVgaNCUP.mjs} +2 -2
- package/dist/md-manager-BfHofc4f.mjs +2 -0
- package/dist/{open-browser-BiK9JzSf.mjs → open-browser-ht7iEqMu.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-G09EUZwC.mjs → preview-Bqtgs1Zn.mjs} +2 -2
- package/dist/preview-DBlmue3X.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-BSGDxL9R.js → ActivityModeContent-DuPmJelx.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-D7bJvGdp.js → AgentDiffPane-Ca6Ds4IN.js} +2 -2
- package/dist/public/assets/{AgentThreadClientBinder-CaTryHIE.js → AgentThreadClientBinder-CxZSN0mY.js} +1 -1
- package/dist/public/assets/{ChangedOutsideBadge-C-Qu_Pl8.js → ChangedOutsideBadge-CBtNiBYy.js} +1 -1
- package/dist/public/assets/CodeMirrorPropInput-BjY_uqg0.js +3 -0
- package/dist/public/assets/DocumentContext-BdXBfUst.js +38 -0
- package/dist/public/assets/{EditorModeToggle-N6JjLfr-.js → EditorModeToggle-EtEqcZm6.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-Bc_A_XCY.js → EnableSyncConfirmDialog-CqlZIrfh.js} +1 -1
- package/dist/public/assets/FeedbackForm-BVthm5nK.js +1 -0
- package/dist/public/assets/{GraphPanel-aAVgqxld.js → GraphPanel-CDIzPzWR.js} +2 -2
- package/dist/public/assets/{ImportSkillDialog-LkmkJ0YU.js → ImportSkillDialog-BBhvhWY2.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-9eXwxoS2.js → LintConfigEditor-BBNyuz2O.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-B5DslPxD.js +2 -0
- package/dist/public/assets/ManagedArtifactProperties-hpx8i1kW.js +1 -0
- package/dist/public/assets/{McpConsentDialogBody-090py53F.js → McpConsentDialogBody-Bzy77Gzw.js} +1 -1
- package/dist/public/assets/{Mermaid-BQAWkx48.js → Mermaid-Ba_Bj7D1.js} +2 -2
- package/dist/public/assets/{MermaidDocEditor-C_G_ovY8.js → MermaidDocEditor-BV3EpcCc.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-5eJLreAy.js → ReportBugDialogBody-CoM6D3VY.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-DcJSH6Kd.js → SchemaConfigEditor-DvpY4XyG.js} +1 -1
- package/dist/public/assets/{SessionsHost-17eNV0Wq.js → SessionsHost-BjyGEs-m.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-DYeGMO3E.js → SettingsDialogBody-ClkzqCWV.js} +3 -3
- package/dist/public/assets/{ShareBranchSwitchDialog-Dm4ZdzUl.js → ShareBranchSwitchDialog-M8nEIk2w.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-Cd240Jdo.js → ShareReceiveDialog-BJ8uKULf.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog--hmiMg2v.js → ShareReceiveMissDialog-Ch00HDAB.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-DIJcGPhx.js → SkillEditBanner-cQP3OGlb.js} +1 -1
- package/dist/public/assets/SkillOriginInline-DVRZGBc9.js +1 -0
- package/dist/public/assets/{SkillToolbarControls-CkezCxAG.js → SkillToolbarControls-BW5izjWm.js} +1 -1
- package/dist/public/assets/{SourceEditor-D3d3_XjY.js → SourceEditor-CdEukFaO.js} +1 -1
- package/dist/public/assets/{TerminalPanel-DEwu_bZF.js → TerminalPanel-DYpr3gZa.js} +3 -3
- package/dist/public/assets/{TerminalWindowApp-CqNlVfBp.js → TerminalWindowApp-CLPcrjfp.js} +1 -1
- package/dist/public/assets/{TextDocEditor-4ayETwjy.js → TextDocEditor-CZc0ittq.js} +1 -1
- package/dist/public/assets/{ThreadView-DcNUIsnx.js → ThreadView-BHGSStQm.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-EP2JbHka.js → TimelineDiffPane-DrjrNbpa.js} +2 -2
- package/dist/public/assets/{abnfDiagram-VRR7QNED-DHJtI87X.js → abnfDiagram-VRR7QNED-BR4MFhNI.js} +1 -1
- package/dist/public/assets/{agent-diff-store-NxhFZCYu.js → agent-diff-store-BndzgDhQ.js} +1 -1
- package/dist/public/assets/{agent-visibility-BVTKArCQ.js → agent-visibility-CTpE4Fld.js} +1 -1
- package/dist/public/assets/{arc-CcVRsw3e.js → arc-BLA1oiJE.js} +1 -1
- package/dist/public/assets/architecture-TIHT7OUA-4xbw6BHT.js +1 -0
- package/dist/public/assets/{architectureDiagram-ZJ3FMSHR-CiwaxO5n.js → architectureDiagram-ZJ3FMSHR-BrnPZKqe.js} +1 -1
- package/dist/public/assets/auth-state-cache-BuUCXNdR.js +11 -0
- package/dist/public/assets/{blockDiagram-677ZJIJ3-0zO7n7Sf.js → blockDiagram-677ZJIJ3-CQbm0LEu.js} +1 -1
- package/dist/public/assets/{c4Diagram-LMCZKHZV-C662qesx.js → c4Diagram-LMCZKHZV-D4Y9FZQ4.js} +1 -1
- package/dist/public/assets/channel-CEdybrh9.js +1 -0
- package/dist/public/assets/chunk-2Q5K7J3B-CTVQtWlX.js +1 -0
- package/dist/public/assets/{chunk-32BRIVSS-CydyM0Ml.js → chunk-32BRIVSS-Nd1XGYMr.js} +1 -1
- package/dist/public/assets/{chunk-52WLFC77-cG-DvO_j.js → chunk-52WLFC77-DngEZdpt.js} +1 -1
- package/dist/public/assets/{chunk-5FCAYU7R-Bxw_oikr.js → chunk-5FCAYU7R-CVOgng3o.js} +1 -1
- package/dist/public/assets/{chunk-5HE753X5-DKXmxfLW.js → chunk-5HE753X5-CD6gRM54.js} +1 -1
- package/dist/public/assets/{chunk-5JV3BV7I-DvmJcvTR.js → chunk-5JV3BV7I-C7ouju6I.js} +1 -1
- package/dist/public/assets/{chunk-5TONJI2A-DzotvxWN.js → chunk-5TONJI2A-BKisaZuR.js} +1 -1
- package/dist/public/assets/{chunk-5VM5RSS4-BhXaeUUw.js → chunk-5VM5RSS4-DldpLG4q.js} +1 -1
- package/dist/public/assets/{chunk-7BUUIJ7U-nkQ2KUUq.js → chunk-7BUUIJ7U-B8p2bGIc.js} +1 -1
- package/dist/public/assets/{chunk-BIQX33UG-dgZifYB8.js → chunk-BIQX33UG-B-IlaACl.js} +1 -1
- package/dist/public/assets/{chunk-BO2N2NFS-BgpjQQXT.js → chunk-BO2N2NFS-BmPFIuzT.js} +3 -3
- package/dist/public/assets/{chunk-C7G6YPKG-DeJ7KSfD.js → chunk-C7G6YPKG-CTPk4N9r.js} +1 -1
- package/dist/public/assets/{chunk-CQNSW5MT-WJU8lHxD.js → chunk-CQNSW5MT-BoHYZDmN.js} +1 -1
- package/dist/public/assets/{chunk-CYSBUYHQ-5BxfdOgL.js → chunk-CYSBUYHQ-BtnyZlJv.js} +1 -1
- package/dist/public/assets/{chunk-EMLP6XTP-mSjYkSCS.js → chunk-EMLP6XTP-D_CFM3mi.js} +1 -1
- package/dist/public/assets/{chunk-EX3LRPZG-BNd6Cxwo.js → chunk-EX3LRPZG-9kHpIDAY.js} +1 -1
- package/dist/public/assets/{chunk-FWX5IMBZ-CXQqiinv.js → chunk-FWX5IMBZ-A1C9veGN.js} +2 -2
- package/dist/public/assets/{chunk-HOUHSVGY-FQeseOdw.js → chunk-HOUHSVGY-D2OO7RX0.js} +1 -1
- package/dist/public/assets/{chunk-ICXQ74PX-QBz75RJe.js → chunk-ICXQ74PX-CINPzArE.js} +1 -1
- package/dist/public/assets/{chunk-JG7HCLWE-ClAPLVoN.js → chunk-JG7HCLWE-jpq6rFyK.js} +1 -1
- package/dist/public/assets/{chunk-JWPE2WC7-D00QuO4l.js → chunk-JWPE2WC7-BUo8MoXj.js} +1 -1
- package/dist/public/assets/{chunk-MOJQB5TN-BHolK4Fc.js → chunk-MOJQB5TN-INvVDa7M.js} +1 -1
- package/dist/public/assets/{chunk-MOZMSUNE-B2zrwpvW.js → chunk-MOZMSUNE-bwYn0Kww.js} +1 -1
- package/dist/public/assets/{chunk-OGEWGWER-D9rNoxcC.js → chunk-OGEWGWER-Di8f25Zt.js} +1 -1
- package/dist/public/assets/{chunk-OSBZ3O6U-pMDQqwwa.js → chunk-OSBZ3O6U-CUc7n3PO.js} +1 -1
- package/dist/public/assets/{chunk-PUDLZKDR-zvmgn7x_.js → chunk-PUDLZKDR-C9YcryH0.js} +1 -1
- package/dist/public/assets/{chunk-Q4XR5HBZ-FwXZQ9hY.js → chunk-Q4XR5HBZ-DuA-1W6g.js} +1 -1
- package/dist/public/assets/{chunk-QBLGF6JB-gQMNwA9k.js → chunk-QBLGF6JB-DOtavLb0.js} +1 -1
- package/dist/public/assets/{chunk-R7FJI6CG-4qEQ9dBZ.js → chunk-R7FJI6CG-CWhtEDe1.js} +1 -1
- package/dist/public/assets/{chunk-RYQCIY6F-BV0ikdQB.js → chunk-RYQCIY6F-D8KQw2wV.js} +1 -1
- package/dist/public/assets/{chunk-U6XO7XAA-CaNmcaAV.js → chunk-U6XO7XAA-CMfN73K7.js} +1 -1
- package/dist/public/assets/{chunk-V7JOEXUC-CsJjje8x.js → chunk-V7JOEXUC-868ygkS5.js} +1 -1
- package/dist/public/assets/chunk-VAUOI2AC-BPnCZl88.js +1 -0
- package/dist/public/assets/{chunk-VR4S4FIN-bcHVGPIL.js → chunk-VR4S4FIN-BZrd9pWi.js} +1 -1
- package/dist/public/assets/{chunk-WYO6CB5R-BMZjhy31.js → chunk-WYO6CB5R-T4JOF4Cu.js} +1 -1
- package/dist/public/assets/chunk-XXDRQBXY-AFNsmOQr.js +1 -0
- package/dist/public/assets/{chunk-YOTPTUD7-NNZ-Yv3s.js → chunk-YOTPTUD7-DzE2J0ru.js} +1 -1
- package/dist/public/assets/{chunk-ZGVPDNZ5-DN7h9evR.js → chunk-ZGVPDNZ5-BtaLh1Pm.js} +1 -1
- package/dist/public/assets/{chunk-ZIRB5QZD-BUzL4gtl.js → chunk-ZIRB5QZD-DTzEX6O5.js} +1 -1
- package/dist/public/assets/classDiagram-OUVF2IWQ-DJJ_lD6S.js +1 -0
- package/dist/public/assets/classDiagram-v2-EOCWNBFH-DU_c9B2S.js +1 -0
- package/dist/public/assets/client-version-_i4MI4fL.js +1 -0
- package/dist/public/assets/{comment-chips-qxdAVfqd.js → comment-chips-BFJ87jiN.js} +2 -2
- package/dist/public/assets/{config-provider-C5VnXykq.js → config-provider-BwmrVQtw.js} +2 -2
- package/dist/public/assets/{cose-bilkent-JH36ORCC-C3tuxXMJ.js → cose-bilkent-JH36ORCC-Dfdgm0c_.js} +1 -1
- package/dist/public/assets/cynefin-VYW2F7L2-PIqjqGI8.js +1 -0
- package/dist/public/assets/{cynefinDiagram-TSTJHNR4-gF8dJ8RL.js → cynefinDiagram-TSTJHNR4-DRyLma_-.js} +1 -1
- package/dist/public/assets/{dagre-DqpVUR-3.js → dagre-Bx2kZZfx.js} +1 -1
- package/dist/public/assets/{dagre-VKFMJZFB-Bdh7Hq5O.js → dagre-VKFMJZFB-CWRpaHfL.js} +1 -1
- package/dist/public/assets/{diagram-FQU43EPY-BZ8uLueR.js → diagram-FQU43EPY-BWhEolBl.js} +1 -1
- package/dist/public/assets/{diagram-G47NLZAW-QyYub_Y-.js → diagram-G47NLZAW-CtrwOhAm.js} +1 -1
- package/dist/public/assets/{diagram-NH7WQ7WH-BZmKErWp.js → diagram-NH7WQ7WH-Bwg0orbY.js} +1 -1
- package/dist/public/assets/{diagram-OA4YK3LP-X4I0Ny_1.js → diagram-OA4YK3LP-sK_x_R3w.js} +1 -1
- package/dist/public/assets/{diagram-WEI45ONY-Dvn-EcwS.js → diagram-WEI45ONY-BGLea-AN.js} +1 -1
- package/dist/public/assets/{dist-DmGGmoBk.js → dist-2Zg1mqwY.js} +1 -1
- package/dist/public/assets/{dist-D8RKvolB2.js → dist-DZN2z2Ue2.js} +52 -52
- package/dist/public/assets/{doc-paths-CBQZMJ5n.js → doc-paths-CR2slzEF.js} +1 -1
- package/dist/public/assets/{documents-events-CUD1Vtsd.js → documents-events-BhxlQGXQ.js} +1 -1
- package/dist/public/assets/{ebnfDiagram-CCIWWBDH-Bee-0Vsa.js → ebnfDiagram-CCIWWBDH-LwDvRqCc.js} +1 -1
- package/dist/public/assets/{erDiagram-Q63AITRT-DxkcAaEh.js → erDiagram-Q63AITRT-ZtP-do8Y.js} +1 -1
- package/dist/public/assets/eventmodeling-45OFAUF4-BXfoXwmF.js +1 -0
- package/dist/public/assets/{file-tree-adapter-CRvIFP_w.js → file-tree-adapter-DLG2-zm9.js} +1 -1
- package/dist/public/assets/{file-tree-utils-Bz8x8io4.js → file-tree-utils-BWXvrWAR.js} +1 -1
- package/dist/public/assets/flowDiagram-23GEKE2U-FFa51yc6.js +1 -0
- package/dist/public/assets/{folder-config-api-DI42D8Ib.js → folder-config-api-CZeUrq2G.js} +1 -1
- package/dist/public/assets/{ganttDiagram-NO4QXBWP-CfKrR8t0.js → ganttDiagram-NO4QXBWP-toql98c1.js} +1 -1
- package/dist/public/assets/gitGraph-TEB2WS4Q-CO_Nyook.js +1 -0
- package/dist/public/assets/{gitGraphDiagram-IHSO6WYX-l_eG9uKD.js → gitGraphDiagram-IHSO6WYX-D7D6x-Xl.js} +1 -1
- package/dist/public/assets/{globals-0NgAOIr4.js → globals-LiBs9D18.js} +1 -1
- package/dist/public/assets/{graphlib-2mbBufU8.js → graphlib-BIjbwrWA.js} +1 -1
- package/dist/public/assets/{highlighted-body-OFNGDK62-BIipOt-U.js → highlighted-body-OFNGDK62-Ckmp4Uen.js} +1 -1
- package/dist/public/assets/index-DBNyG_Ke.js +2092 -0
- package/dist/public/assets/info-DKCQHKI2-Qu4WNhHa.js +1 -0
- package/dist/public/assets/{infoDiagram-FWYZ7A6U-DgvJ7Awn.js → infoDiagram-FWYZ7A6U-D-w6lLUB.js} +1 -1
- package/dist/public/assets/{ishikawaDiagram-FXEZZL3T-DQ4Gskk4.js → ishikawaDiagram-FXEZZL3T-DiMtCb6J.js} +1 -1
- package/dist/public/assets/{journeyDiagram-5HDEW3XC-DPs0RcwQ.js → journeyDiagram-5HDEW3XC-BBd5InQB.js} +1 -1
- package/dist/public/assets/{kanban-definition-HUTT4EX6-Ck2HSfan.js → kanban-definition-HUTT4EX6-CA41_RYU.js} +1 -1
- package/dist/public/assets/{line-DWKLErsv.js → line-DE139-H6.js} +1 -1
- package/dist/public/assets/{linear-dbIThZWJ.js → linear-HAqJanW2.js} +1 -1
- package/dist/public/assets/{lint-config-client-B3CFuMcz.js → lint-config-client-B-vQycwW.js} +1 -1
- package/dist/public/assets/{map-DCuMc749.js → map-CUyVBcsz.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-taWXhAIu.js → markdownlint-rule-browser-CfejazL_.js} +1 -1
- package/dist/public/assets/mermaid-GHXKKRXX-C0TBTYbW.js +1 -0
- package/dist/public/assets/{mermaid-parser.core-B2uYfibA.js → mermaid-parser.core-CAIoUhyF.js} +2 -2
- package/dist/public/assets/{mermaid.core-BUTR3k00.js → mermaid.core-B8bL0otS.js} +3 -3
- package/dist/public/assets/{mindmap-definition-LN4V7U3C-CjuwnrRK.js → mindmap-definition-LN4V7U3C-BG4thSqa.js} +1 -1
- package/dist/public/assets/navigation-targets-MirHYTh2.js +1 -0
- package/dist/public/assets/{now-D9M3Ys6o.js → now-DrceMm81.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-BJBa-17A.js → open-managed-artifact-tab-DfPczkie.js} +1 -1
- package/dist/public/assets/{ordinal-DdrNAXbu.js → ordinal-DOdOZcEj.js} +1 -1
- package/dist/public/assets/packet-7NZHBO7P-DYoxmend.js +1 -0
- package/dist/public/assets/{pegDiagram-2B236MQR-BbkSvB2I.js → pegDiagram-2B236MQR-LXeKNT9p.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-BZZR-nkd.js → pending-receive-nav-store-Bxm3O-w-.js} +1 -1
- package/dist/public/assets/pie-RZYD4A2V-C5oywqmk.js +1 -0
- package/dist/public/assets/{pieDiagram-ENE6RG2P-mC03ntFr.js → pieDiagram-ENE6RG2P-CP834p3L.js} +1 -1
- package/dist/public/assets/{prop-types-UV1Ku4nq.js → prop-types-BWDJYVli.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-ABIIQ3AL-C5Wf9EzX.js → quadrantDiagram-ABIIQ3AL-CRH-DZR6.js} +1 -1
- package/dist/public/assets/radar-I7S5WNFK-adGffv9k.js +1 -0
- package/dist/public/assets/railroad-3IZDKUUU-D4AY10Mc.js +1 -0
- package/dist/public/assets/railroad-abnf-AHOZXSZD-CSShZExy.js +1 -0
- package/dist/public/assets/railroad-ebnf-EBAXGLYW-Dl_rhwOm.js +1 -0
- package/dist/public/assets/railroad-peg-LSFZ7HO6-B2JvE7nW.js +1 -0
- package/dist/public/assets/{railroadDiagram-RFXS5EU6-D5k_b8X2.js → railroadDiagram-RFXS5EU6-B0y7CNEU.js} +1 -1
- package/dist/public/assets/{receive-store-CqvpoBpo.js → receive-store-BISeFaHm.js} +1 -1
- package/dist/public/assets/{requirementDiagram-TGXJPOKE-sZXA_y1K.js → requirementDiagram-TGXJPOKE-CDOzFe2o.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-HTMAVEWB-VaejSuXD.js → sankeyDiagram-HTMAVEWB-8LYEe9RT.js} +1 -1
- package/dist/public/assets/{selection-context-SAJ9lGhe.js → selection-context-SfeWnyax.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-DBY2YBRQ-nCH-USjy.js → sequenceDiagram-DBY2YBRQ-DTI3lfyS.js} +1 -1
- package/dist/public/assets/{sizeCapture-X5ZJPWSS-CyNe-U3Z.js → sizeCapture-X5ZJPWSS-CdOK33Lp.js} +1 -1
- package/dist/public/assets/skill-actions-DeToVw_b.js +2 -0
- package/dist/public/assets/{skill-scope-CEk2zosm.js → skill-scope-DHskNAp8.js} +1 -1
- package/dist/public/assets/{skills-api-DqNFNsgd.js → skills-api-DhbM0zp_.js} +1 -1
- package/dist/public/assets/{src-DFZupjZD.js → src-CprZUkQE.js} +1 -1
- package/dist/public/assets/{src-D2I-MNPe.js → src-D1fpFbQG.js} +1 -1
- package/dist/public/assets/{stateDiagram-2N3HPSRC-uY9Mif8t.js → stateDiagram-2N3HPSRC-Be5NtYCp.js} +1 -1
- package/dist/public/assets/stateDiagram-v2-6OUMAXLB-B6a4uvcW.js +1 -0
- package/dist/public/assets/{swimlanes-5IMT3BWC-cGipHfZ5.js → swimlanes-5IMT3BWC-Cyw1mKbC.js} +2 -2
- package/dist/public/assets/swimlanesDiagram-G3AALYLV-D3egjuKf.js +8 -0
- package/dist/public/assets/{tag-pill-input-Dm-oHELs.js → tag-pill-input-Bz9pQv5K.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-D4NuVWIm.js → target-navigation-intent-DBjtrY9M.js} +1 -1
- package/dist/public/assets/{telemetry-impl-wWahzeD4.js → telemetry-impl-DWXkoD72.js} +2 -2
- package/dist/public/assets/{telemetry-startup-DqooJFoo.js → telemetry-startup-3Sng8oEw.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-DPnh23jk.js → terminal-launch-events-U2hE6Ms1.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-C0iAhsN9.js → terminal-telemetry-D-x2ahmt.js} +1 -1
- package/dist/public/assets/{text-viewer-languages-qm3MvP0J.js → text-viewer-languages-DFJQsbAG.js} +2 -2
- package/dist/public/assets/{timeline-definition-FHXFAJF6-BaWSHiEf.js → timeline-definition-FHXFAJF6-BlFXUexj.js} +1 -1
- package/dist/public/assets/treeView-QDETBFTQ-qMpkjbKi.js +1 -0
- package/dist/public/assets/treemap-6X3UGDF4-BW1Uc-Dj.js +1 -0
- package/dist/public/assets/{typing-burst-detector-aQ1X_8Fj.js → typing-burst-detector-BcckucCO.js} +3 -3
- package/dist/public/assets/{uninstall-D3gX2hi1.js → uninstall--VaT1wrx.js} +1 -1
- package/dist/public/assets/{use-activity-panel-CrUZg0eD.js → use-activity-panel-Boa2gsSF.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-CFZIZmfZ.js → use-apply-config-color-theme-Cm_U612q.js} +2 -2
- package/dist/public/assets/{use-collab-url-DrWInPcY.js → use-collab-url-26Kxxrga.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-C7ahxcoU.js → use-live-xterm-theme-PP95E3RH.js} +1 -1
- package/dist/public/assets/{use-open-skill-BQedNtMG.js → use-open-skill-BQGld6Oo.js} +1 -1
- package/dist/public/assets/{use-settings-route-DHvE2hA4.js → use-settings-route-b9ICe6ju.js} +1 -1
- package/dist/public/assets/{use-skill-directory-CVAgFkVK.js → use-skill-directory-BPA2CjtJ.js} +1 -1
- package/dist/public/assets/use-skill-origin-CYFatjkw.js +1 -0
- package/dist/public/assets/{use-skills-LdaAjRrH.js → use-skills-CQ22zxZh.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-DwK_rPTk.js → use-terminal-enabled-DD-6dEVX.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-B5KnaOaD.js → use-timeline-entry-diff-B6q2MvpV.js} +4 -4
- package/dist/public/assets/{use-workspace-Csf6sHD8.js → use-workspace-B7bQ2SZR.js} +1 -1
- package/dist/public/assets/{vennDiagram-L72KCM5P-boRPAxOy.js → vennDiagram-L72KCM5P-CbMxlzwT.js} +1 -1
- package/dist/public/assets/wardley-OPB4EBWU-BBZU6-hF.js +1 -0
- package/dist/public/assets/{wardleyDiagram-EHGQE667-vi90NC-5.js → wardleyDiagram-EHGQE667-CVZ_1-Ob.js} +1 -1
- package/dist/public/assets/{xychartDiagram-FW5EYKEG-Ckph0Tnv.js → xychartDiagram-FW5EYKEG-CiobWJYX.js} +1 -1
- package/dist/public/index.html +50 -49
- package/dist/public/uninstall.html +3 -3
- package/dist/{repair-launch-json-DZqGZNe1.mjs → repair-launch-json-qrFgG_0f.mjs} +2 -2
- package/dist/{repair-mcp-configs-DxrHIXaa.mjs → repair-mcp-configs-BGEi4dY8.mjs} +2 -2
- package/dist/repair-skills-BKWnC8s9.mjs +1 -0
- package/dist/{repair-skills-B5s_18d0.mjs → repair-skills-Cp0zxj36.mjs} +2 -2
- package/dist/schemas/v0/config.project.schema.json +3 -0
- package/dist/schemas/v0/config.user.schema.json +47 -0
- package/dist/{server-lock-CCS3UzJQ.mjs → server-lock-CWyGkpt0.mjs} +2 -2
- package/dist/server-lock-Cd8tGKJ7.mjs +1 -0
- package/dist/{sleep-TXRFWg8x.mjs → sleep-CKdHmS4J.mjs} +2 -2
- package/dist/{src-C9yhZBbO.mjs → src-B9eLNT3o.mjs} +4 -4
- package/dist/src-CPkwD6c_.mjs +2030 -0
- package/dist/{src-BI2J7o5q.mjs → src-CR3XTRFS.mjs} +2 -2
- package/dist/{src-Dmoupsem.mjs → src-R13rZ762.mjs} +1 -1
- package/dist/{start-CsoFcJw4.mjs → start-CcE78o1l.mjs} +3 -3
- package/dist/start-CwbVz0xz.mjs +1 -0
- package/dist/{write-project-skill-BIBvYtT6.mjs → write-project-skill-Dwv4krCb.mjs} +2 -2
- package/package.json +5 -5
- package/dist/constants-BfwnJrO6.mjs +0 -2
- package/dist/fs-traced-DB5c--Vd.mjs +0 -1
- package/dist/git-handle-CMWGPj44.mjs +0 -1
- package/dist/init-DkRUVy0u.mjs +0 -1
- package/dist/loader-Cu1PSU1a.mjs +0 -1
- package/dist/md-manager-wJEAbIvp.mjs +0 -2
- package/dist/preview-CXHa4Isv.mjs +0 -1
- package/dist/public/assets/CodeMirrorPropInput-CRKAndsx.js +0 -3
- package/dist/public/assets/DocumentContext-COt_qsrp.js +0 -38
- package/dist/public/assets/FeedbackForm-CT893Lit.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-Bte_ppBh.js +0 -2
- package/dist/public/assets/ManagedArtifactProperties-TmTNhIv4.js +0 -1
- package/dist/public/assets/SkillOriginInline-M3Vr6Vl3.js +0 -1
- package/dist/public/assets/architecture-TIHT7OUA-B22-UzyM.js +0 -1
- package/dist/public/assets/auth-state-cache-DeOaKoC3.js +0 -11
- package/dist/public/assets/channel-DfI0YSva.js +0 -1
- package/dist/public/assets/chunk-2Q5K7J3B-BSFIGC1j.js +0 -1
- package/dist/public/assets/chunk-VAUOI2AC-B_byVmRb.js +0 -1
- package/dist/public/assets/chunk-XXDRQBXY-BW_2kVvu.js +0 -1
- package/dist/public/assets/classDiagram-OUVF2IWQ-D-ugBPkQ.js +0 -1
- package/dist/public/assets/classDiagram-v2-EOCWNBFH-Bn6YRP9I.js +0 -1
- package/dist/public/assets/client-version-BhYZd6K_.js +0 -1
- package/dist/public/assets/cynefin-VYW2F7L2-g7Kr3o9e.js +0 -1
- package/dist/public/assets/eventmodeling-45OFAUF4-DdR7ha8I.js +0 -1
- package/dist/public/assets/flowDiagram-23GEKE2U-BAuyQn3U.js +0 -1
- package/dist/public/assets/gitGraph-TEB2WS4Q-B9_Hbzw_.js +0 -1
- package/dist/public/assets/index-BHF-BkPA.js +0 -2092
- package/dist/public/assets/info-DKCQHKI2-BQeDe2mR.js +0 -1
- package/dist/public/assets/mermaid-GHXKKRXX-DE1vq5OK.js +0 -1
- package/dist/public/assets/navigation-targets-Cqw8JcW2.js +0 -1
- package/dist/public/assets/packet-7NZHBO7P-BW9abikZ.js +0 -1
- package/dist/public/assets/pie-RZYD4A2V-D86NaVqt.js +0 -1
- package/dist/public/assets/radar-I7S5WNFK-DQAd0dLq.js +0 -1
- package/dist/public/assets/railroad-3IZDKUUU-BpjxCYYP.js +0 -1
- package/dist/public/assets/railroad-abnf-AHOZXSZD-BVzINhcN.js +0 -1
- package/dist/public/assets/railroad-ebnf-EBAXGLYW-FAz3aWnD.js +0 -1
- package/dist/public/assets/railroad-peg-LSFZ7HO6-Smtu6BYl.js +0 -1
- package/dist/public/assets/skill-actions-bjJCqQ6r.js +0 -2
- package/dist/public/assets/stateDiagram-v2-6OUMAXLB-BdS5vmc7.js +0 -1
- package/dist/public/assets/swimlanesDiagram-G3AALYLV-Do_H-wCL.js +0 -8
- package/dist/public/assets/treeView-QDETBFTQ-BgORrhQ0.js +0 -1
- package/dist/public/assets/treemap-6X3UGDF4-Zr5ZEdj0.js +0 -1
- package/dist/public/assets/wardley-OPB4EBWU-WeTAUrVk.js +0 -1
- package/dist/repair-skills-ByGIGa0z.mjs +0 -1
- package/dist/server-lock-CKTWPQax.mjs +0 -1
- package/dist/src-CJQ7Tr0x.mjs +0 -2030
- package/dist/start-Cgl1RMlt.mjs +0 -1
- /package/dist/public/assets/{ActivityPanelDiffView-DzcGG-3T.js → ActivityPanelDiffView-BXFg3amj.js} +0 -0
- /package/dist/public/assets/{AppMenubar-rFZzqUIz.js → AppMenubar-Cub3r1zs.js} +0 -0
- /package/dist/public/assets/{BugReportHistoryDialog-BIDjQ_82.js → BugReportHistoryDialog-_HgchijV.js} +0 -0
- /package/dist/public/assets/{ConsentDialogBody-DRrUivNs.js → ConsentDialogBody-C9wS0j09.js} +0 -0
- /package/dist/public/assets/{DiffView-DITcPuOr.js → DiffView-DD1wPMUw.js} +0 -0
- /package/dist/public/assets/{__vite-browser-external-DRftbq1J.js → __vite-browser-external-CVGzy5OC.js} +0 -0
- /package/dist/public/assets/{agent-presence-DspgbUIJ.js → agent-presence-Dn2bQ2Pn.js} +0 -0
- /package/dist/public/assets/{array-BlR6RSqS.js → array-CxykTcx8.js} +0 -0
- /package/dist/public/assets/{calendar-BRay90Yd.js → calendar-C__xvB0F.js} +0 -0
- /package/dist/public/assets/{chunk-KEIR6QF5-Cvu_RfZc.js → chunk-KEIR6QF5-DQW1nIEN.js} +0 -0
- /package/dist/public/assets/{chunk-Y2CYZVJY-BavonG01.js → chunk-Y2CYZVJY-Dp_m2dHs.js} +0 -0
- /package/dist/public/assets/{clike-BTKURkAr.js → clike-D2Qtyj0W.js} +0 -0
- /package/dist/public/assets/{colors-DThYSuj1.js → colors-DxV0gzKw.js} +0 -0
- /package/dist/public/assets/{cytoscape.esm-CcKBPOPz.js → cytoscape.esm-Yabh0yK_.js} +0 -0
- /package/dist/public/assets/{defaultLocale-Bj1aksfd.js → defaultLocale-BwEiHuJD.js} +0 -0
- /package/dist/public/assets/{diff-CC9Zbhye.js → diff-Dke_3Gcp.js} +0 -0
- /package/dist/public/assets/{dist-Dtdr1fU5.js → dist-2t_r6dn4.js} +0 -0
- /package/dist/public/assets/{dist-CublDHOR.js → dist-CPBLOoKm.js} +0 -0
- /package/dist/public/assets/{dist-9KHzlPis.js → dist-CVBOvb5_.js} +0 -0
- /package/dist/public/assets/{dist-BKO-SihH.js → dist-yoZDDKeY.js} +0 -0
- /package/dist/public/assets/{form-DipRd6xO.js → form-CDklsKOD.js} +0 -0
- /package/dist/public/assets/{go-BOoSlAXr.js → go-CcjpRIwm.js} +0 -0
- /package/dist/public/assets/{init-tTyHApSS.js → init-c3-Nu4HJ.js} +0 -0
- /package/dist/public/assets/{input-group-DpE_QejY.js → input-group-Dw-FNINK.js} +0 -0
- /package/dist/public/assets/{isObject-CS6pZNNk.js → isObject-cN229uXS.js} +0 -0
- /package/dist/public/assets/{libesm-COuF-Ycc.js → libesm-DXt8eMZu.js} +0 -0
- /package/dist/public/assets/{lru-string-cache-DXyh0UqD.js → lru-string-cache-Dvzy2WTu.js} +0 -0
- /package/dist/public/assets/{lua-Dxo01oIG.js → lua-DxmBbMX2.js} +0 -0
- /package/dist/public/assets/{mcp-consent-store-BivjPpLe.js → mcp-consent-store-BcrhbRwc.js} +0 -0
- /package/dist/public/assets/{min-B52VabRz.js → min-BZE3RIbd.js} +0 -0
- /package/dist/public/assets/{panzoom.es-JQqfaE6_.js → panzoom.es-BG-eqGqR.js} +0 -0
- /package/dist/public/assets/{path-BTSnI4V0.js → path-C0vgPxDI.js} +0 -0
- /package/dist/public/assets/{pdf-DDNlrbvd.js → pdf-Cvbt6FaY.js} +0 -0
- /package/dist/public/assets/{pdf.worker-MgQT7Lb-.js → pdf.worker-D0hSc7ZI.js} +0 -0
- /package/dist/public/assets/{perl-L_d0-K7D.js → perl-CTbv8SzR.js} +0 -0
- /package/dist/public/assets/{properties-B1mL7FEj.js → properties-CJVfsSwL.js} +0 -0
- /package/dist/public/assets/{r-D1HJ6WJD.js → r-DePwCFla.js} +0 -0
- /package/dist/public/assets/{rough.esm-FREjYXwx.js → rough.esm-jZQkcmER.js} +0 -0
- /package/dist/public/assets/{ruby-BWJ7ZkjF.js → ruby-CbNmqTQ7.js} +0 -0
- /package/dist/public/assets/{schema-fields-view-intent-BMcQ1vbw.js → schema-fields-view-intent-DQNqHHeG.js} +0 -0
- /package/dist/public/assets/{share-metadata-rows-c17l05D6.js → share-metadata-rows-CuFlpaJB.js} +0 -0
- /package/dist/public/assets/{shell-ul8ysUs1.js → shell-PtNEZQbu.js} +0 -0
- /package/dist/public/assets/{sql-BJVFbIWu.js → sql-DLytrKWQ.js} +0 -0
- /package/dist/public/assets/{src-CIOeKeVw.js → src-D9TuoXKa.js} +0 -0
- /package/dist/public/assets/{swift-BmJYIPlb.js → swift-BqNeJfD7.js} +0 -0
- /package/dist/public/assets/{thread-client-CylUCx4y.js → thread-client-CACCERyj.js} +0 -0
- /package/dist/public/assets/{thread-draft-staging-Df0IT4FR.js → thread-draft-staging-XfhEE_6X.js} +0 -0
- /package/dist/public/assets/{toml-BOOm8Wvq.js → toml-Cboq-aWW.js} +0 -0
- /package/dist/public/assets/{useLintConfigViewMode-15VleUG7.js → useLintConfigViewMode-DHyC74de.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,o as t,r as n,t as r}from"./chunk-DTipWd-i.mjs";import{$ as i,A as a,J as o,L as s,M as c,O as l,P as u,R as d,U as f,_t as p,at as m,c as h,ct as g,dt as _,et as v,ft as y,gt as b,ht as x,it as S,j as C,k as w,lt as T,mt as E,nt as D,q as O,rt as k,ut as ee,vt as te,wt as ne,xt as A,yt as re}from"./sleep-
|
|
1
|
+
import{i as e,o as t,r as n,t as r}from"./chunk-DTipWd-i.mjs";import{$ as i,A as a,J as o,L as s,M as c,O as l,P as u,R as d,U as f,_t as p,at as m,c as h,ct as g,dt as _,et as v,ft as y,gt as b,ht as x,it as S,j as C,k as w,lt as T,mt as E,nt as D,q as O,rt as k,ut as ee,vt as te,wt as ne,xt as A,yt as re}from"./sleep-CKdHmS4J.mjs";import{n as ie,t as ae}from"./markdownit-BX7TxUEO.mjs";import j from"node:path";import{access as oe,accessSync as se,readFile as ce,readFileSync as M}from"node:fs";import{EOL as N,homedir as le}from"node:os";import ue from"node:process";import{fileURLToPath as de}from"node:url";function fe(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,`0`)}const pe=`ok-checkpoint-v1: `;function me(e){if(!e)return null;for(let t of e.split(`
|
|
2
2
|
`)){let e=t.trim();if(!e.startsWith(pe))continue;let n;try{n=JSON.parse(e.slice(18))}catch{return null}if(typeof n!=`object`||!n)return null;let r=n,i=r.kind,a=r.metadata;if(typeof a!=`object`||!a)return null;let o=typeof r.docName==`string`?r.docName:null,s=typeof r.size==`number`&&Number.isFinite(r.size)?r.size:null;if(i===`bridge-merge-loss`){let e=a;return Array.isArray(e.lostSubstrings)&&e.lostSubstrings.every(e=>typeof e==`string`)?{kind:`bridge-merge-loss`,docName:o,size:s,metadata:{lostSubstrings:e.lostSubstrings}}:null}if(i===`producer-guard-loss`){let e=a;return typeof e.construct==`string`?{kind:`producer-guard-loss`,docName:o,size:s,metadata:{construct:e.construct}}:null}if(i===`observer-a-duplication`){let e=a;return typeof e.duplicatedLineCount==`number`&&Number.isFinite(e.duplicatedLineCount)?{kind:`observer-a-duplication`,docName:o,size:s,metadata:{duplicatedLineCount:e.duplicatedLineCount}}:null}if(i===`external-change-rescue`){let e=a;return typeof e.incomingDiskSha==`string`?{kind:`external-change-rescue`,docName:o,size:s,metadata:{incomingDiskSha:e.incomingDiskSha}}:null}if(i===`defer-exhaustion-loss`){let e=a;return typeof e.deferCount==`number`&&Number.isFinite(e.deferCount)?{kind:`defer-exhaustion-loss`,docName:o,size:s,metadata:{deferCount:e.deferCount}}:null}if(i===`observer-a-apply-loss`){let e=a;return Array.isArray(e.lostSubstrings)&&e.lostSubstrings.every(e=>typeof e==`string`)?{kind:`observer-a-apply-loss`,docName:o,size:s,metadata:{lostSubstrings:e.lostSubstrings}}:null}if(i===`bridge-derive-loss`){let e=a;return Array.isArray(e.lostSubstrings)&&e.lostSubstrings.every(e=>typeof e==`string`)?{kind:`bridge-derive-loss`,docName:o,size:s,metadata:{lostSubstrings:e.lostSubstrings}}:null}if(i===`bridge-backstop-trip`){let e=a;return typeof e.rounds==`number`&&Number.isFinite(e.rounds)?{kind:`bridge-backstop-trip`,docName:o,size:s,metadata:{rounds:e.rounds}}:null}if(i===`persistence-reconcile-loss`){let e=a;return typeof e.atRiskLines==`number`&&Number.isFinite(e.atRiskLines)&&typeof e.witnessAvailable==`boolean`?{kind:`persistence-reconcile-loss`,docName:o,size:s,metadata:{atRiskLines:e.atRiskLines,witnessAvailable:e.witnessAvailable}}:null}if(i===`persistence-duplication-reset`){let e=a;return typeof e.copies==`number`&&Number.isFinite(e.copies)&&typeof e.fragmentChildren==`number`&&Number.isFinite(e.fragmentChildren)?{kind:`persistence-duplication-reset`,docName:o,size:s,metadata:{copies:e.copies,fragmentChildren:e.fragmentChildren}}:null}if(i===`persistence-divergence-realign`||i===`managed-artifact-reconcile`){let e=a;return typeof e.diskBytes==`number`&&Number.isFinite(e.diskBytes)&&typeof e.discardedBytes==`number`&&Number.isFinite(e.discardedBytes)?{kind:i,docName:o,size:s,metadata:{diskBytes:e.diskBytes,discardedBytes:e.discardedBytes}}:null}if(i===`auto-consolidation`){let e=a;return typeof e.foldedRefs==`number`&&Number.isFinite(e.foldedRefs)&&typeof e.trigger==`string`?{kind:`auto-consolidation`,docName:o,size:s,metadata:{foldedRefs:e.foldedRefs,trigger:e.trigger}}:null}return null}return null}function he(e){let t={kind:e.kind,metadata:e.metadata};return e.docName!==null&&(t.docName=e.docName),e.size!==null&&(t.size=e.size),`${pe}${JSON.stringify(t)}`}const ge={"bridge-merge-loss":{visibility:`surfaced`,gcBucket:`bridge-merge-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"producer-guard-loss":{visibility:`surfaced`,gcBucket:`producer-guard-loss`,bundleExposure:`metadata`,chainAnchor:!1},"observer-a-duplication":{visibility:`surfaced`,gcBucket:`observer-a-duplication`,bundleExposure:`metadata`,chainAnchor:!1},"external-change-rescue":{visibility:`surfaced`,gcBucket:`external-change-rescue`,bundleExposure:`metadata`,chainAnchor:!1},"defer-exhaustion-loss":{visibility:`surfaced`,gcBucket:`defer-exhaustion-loss`,bundleExposure:`metadata`,chainAnchor:!1},"observer-a-apply-loss":{visibility:`surfaced`,gcBucket:`observer-a-apply-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"bridge-derive-loss":{visibility:`surfaced`,gcBucket:`bridge-derive-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"bridge-backstop-trip":{visibility:`surfaced`,gcBucket:`bridge-backstop-trip`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-reconcile-loss":{visibility:`surfaced`,gcBucket:`persistence-reconcile-loss`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-duplication-reset":{visibility:`surfaced`,gcBucket:`persistence-duplication-reset`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-divergence-realign":{visibility:`surfaced`,gcBucket:`persistence-divergence-realign`,bundleExposure:`metadata`,chainAnchor:!1},"managed-artifact-reconcile":{visibility:`surfaced`,gcBucket:`managed-artifact-reconcile`,bundleExposure:`metadata`,chainAnchor:!1},"auto-consolidation":{visibility:`hidden`,gcBucket:`auto-consolidation`,bundleExposure:`none`,chainAnchor:!0}},_e=Object.keys(ge);function P(e){return e==null?!0:ge[e].visibility===`surfaced`}function ve(e){return e==null?!0:ge[e].chainAnchor}const ye=ee({at:b(),transport:b(),outcome:b(),reference:b().optional(),error:b().optional()}),be=ee({reason:b(),at:b()});ee({version:_().int().catch(1),id:b(),createdAt:b(),bundleLevel:b(),zipBytes:_().int().nonnegative().catch(0),zipDeleted:k().optional(),state:b(),systemWide:k().optional(),projectSlug:b().nullable().optional(),reference:b().optional(),lastError:be.optional(),attempts:D(ye).optional(),note:b().optional()});const xe=1,Se={protocol:`x-ok-client-protocol`,runtime:`x-ok-client-runtime`,kind:`x-ok-client-kind`};function Ce({kind:e,runtimeVersion:t}){return{[Se.protocol]:`1`,[Se.runtime]:t,[Se.kind]:e}}const we=[{name:`macos-home-path`,regex:/\/Users\/[^/]+\//g,replacement:`~/`},{name:`linux-home-path`,regex:/\/home\/[^/]+\//g,replacement:`~/`},{name:`github-pat`,regex:/\b(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:/\b(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/g,replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/\bsk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:/\bsk-[A-Za-z0-9]{20,}\b/g,replacement:`[REDACTED-OPENAI]`},{name:`bearer-token`,regex:/([Aa]uthorization:\s*[Bb]earer\s+)\S+/g,replacement:`$1[REDACTED]`},{name:`jwt`,regex:/eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,replacement:`[REDACTED-JWT]`},{name:`url-credentials`,regex:/:\/\/[^/\s:@]+:[^/\s:@]+@/g,replacement:`://[REDACTED]@`},{name:`github-pat-fine-grained`,regex:/\bgithub_pat_[0-9A-Za-z_]{20,}/g,replacement:`[REDACTED-GH-PAT]`},{name:`openai-key-modern`,regex:/\bsk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/g,replacement:`[REDACTED-OPENAI]`},{name:`slack-token`,regex:/\bxox[a-z]-[A-Za-z0-9-]{10,}/g,replacement:`[REDACTED-SLACK]`},{name:`google-api-key`,regex:/\bAIza[0-9A-Za-z_-]{35}/g,replacement:`[REDACTED-GOOGLE]`},{name:`stripe-secret-key`,regex:/\b(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/g,replacement:`[REDACTED-STRIPE]`},{name:`gitlab-pat`,regex:/\bglpat-[0-9A-Za-z_-]{20,}/g,replacement:`[REDACTED-GITLAB]`},{name:`bearer-token-json`,regex:/("[Aa]uthorization"\s*:\s*"[Bb]earer\s+)[^"]+/g,replacement:`$1[REDACTED]`}],Te=we.map(e=>e.name);function Ee(e){let t=new Set,n=0;return{redacted:e.split(`
|
|
3
3
|
`).map(e=>{let r=e,i=!1;for(let{name:e,regex:n,replacement:a}of we)n.lastIndex=0,n.test(r)&&(t.add(e),i=!0,n.lastIndex=0,r=r.replace(n,a));return i&&n++,r}).join(`
|
|
4
4
|
`),patterns:[...t],lineCount:n}}function De(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?ke(e.position):`start`in e||`end`in e?ke(e):`line`in e||`column`in e?Oe(e):``}function Oe(e){return Ae(e&&e.line)+`:`+Ae(e&&e.column)}function ke(e){return Oe(e&&e.start)+`-`+Oe(e&&e.end)}function Ae(e){return e&&typeof e==`number`?e:1}var je=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=De(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};je.prototype.file=``,je.prototype.name=``,je.prototype.reason=``,je.prototype.message=``,je.prototype.stack=``,je.prototype.column=void 0,je.prototype.line=void 0,je.prototype.ancestors=void 0,je.prototype.cause=void 0,je.prototype.fatal=void 0,je.prototype.place=void 0,je.prototype.ruleId=void 0,je.prototype.source=void 0;const Me=new Set([`*`,`_`,"`",`~`,`\\`]),Ne=/^\]\([^)]*\)/,Pe=/^(?:#{1,6}[ \t]+|>[ \t]?|[-*+][ \t]+|\d{1,9}[.)][ \t]+)/;function Fe(e){return e===` `||e===` `||e===`
|
|
@@ -288,7 +288,7 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
|
|
|
288
288
|
`),i=vJ(t);return n.map(e=>bJ(e,r,yJ(e,i)))}function vJ(e){let t=new Map;return Object.entries(e).forEach(([e,n],r)=>{let i=e.toUpperCase();if(i===`DEFAULT`)return;let a=null;if(n===`error`||n===`warning`)a=n;else if(typeof n==`object`&&n&&!Array.isArray(n)){let e=n.severity;(e===`error`||e===`warning`)&&(a=e)}a!==null&&t.set(i,{entryIndex:r,severity:a})}),t}function yJ(e,t){let n;for(let r of e.ruleNames){let e=t.get(r.toUpperCase());e!==void 0&&(n===void 0||e.entryIndex>n.entryIndex)&&(n=e)}return n?.severity??`warning`}function bJ(e,t,n){let[r,i]=e.errorRange??[1,null],a=e.lineNumber-1,o=(r??1)-1,s=t[a]?.length??0,c=i==null?s:Math.min(o+i,s),l=e.fixInfo?[xJ(e.fixInfo,e.lineNumber,t)]:void 0;return{range:{start:{line:a,character:o},end:{line:a,character:Math.max(c,o)}},severity:n,source:`markdownlint`,code:e.ruleNames[0]??`MD000`,message:e.errorDetail?`${e.ruleDescription}: ${e.errorDetail}`:e.ruleDescription,...l?{fixes:l}:{}}}function xJ(e,t,n){let r=e.lineNumber??t,i=r-1;if(e.deleteCount===-1){if(r<n.length)return{range:{start:{line:i,character:0},end:{line:i+1,character:0}},newText:``};if(i>0){let e=n[i-1]?.length??0;return{range:{start:{line:i-1,character:e},end:{line:i,character:n[i]?.length??0}},newText:``}}return{range:{start:{line:0,character:0},end:{line:0,character:n[0]?.length??0}},newText:``}}let a=(e.editColumn??1)-1;return{range:{start:{line:i,character:a},end:{line:i,character:a+Math.max(0,e.deleteCount??0)}},newText:e.insertText??``}}const SJ=p([k(),i(l),x(b(),te())]),CJ={id:`markdownlint`,sliceSchema:y({enabled:k(),rules:x(b(),SJ)}),defaultSlice:{enabled:!1,rules:YV},async lint(e,t){return _J(e,XV(t.rules))},fix(e,t){return gJ(e,XV(t.rules))}},wJ=y({appliesTo:p([b(),D(b())]).optional(),file:b(),enabled:k().optional(),key:b().optional(),schema:x(b(),te()).optional()}),TJ=[CJ,{id:`frontmatter`,sliceSchema:y({enabled:k(),schemas:D(wJ)}),defaultSlice:{enabled:!1,schemas:[]},async lint(e,t,n){return EW(e,oW(t.schemas,n.docName))}}],EJ={enabled:!0,plugins:Object.fromEntries(TJ.map(e=>[e.id,e.defaultSlice]))};function DJ(e){return{enabled:e.enabled??!0,plugins:{markdownlint:{...e.markdownlint,rules:e.markdownlint.rules??YV},frontmatter:{enabled:e.frontmatter?.enabled??!1,schemas:e.frontmatter?.schemas??[]}}}}const OJ=Object.fromEntries(TJ.map(e=>[e.id,e.sliceSchema])),kJ=y({effective:y({enabled:k(),plugins:y(OJ)}),configFile:b().nullable().optional(),configProblems:D(b()).optional()}),AJ=p([k(),x(b(),te())]),jJ=y({ruleId:b().min(1).max(64).regex(/^[A-Za-z][A-Za-z0-9_-]*$/),value:p([AJ,v()])}),MJ=y({file:b().min(1).max(512),delete:T(!0).optional(),field:b().min(1).max(256).optional(),parentPath:D(p([b().min(1).max(256),y({items:T(!0)}).strict()])).max(8).optional(),removeField:T(!0).optional(),renameTo:b().min(1).max(256).optional(),constraint:y({type:i([`string`,`number`,`boolean`,`array`,`object`]).nullable().optional(),enum:D(p([b(),_(),k()])).nullable().optional(),itemsEnum:D(p([b(),_(),k()])).nullable().optional(),itemsType:i([`string`,`number`,`boolean`,`object`]).nullable().optional(),pattern:b().nullable().optional(),format:b().nullable().optional(),description:b().max(2048).nullable().optional(),required:k().optional()}).optional()}).refine(e=>e.delete===void 0||e.field===void 0&&e.constraint===void 0&&e.removeField===void 0&&e.renameTo===void 0,{message:`delete cannot be combined with a field edit`}).refine(e=>[e.constraint,e.removeField,e.renameTo].filter(e=>e!==void 0).length<=1,{message:`constraint, removeField, and renameTo are mutually exclusive`}).refine(e=>e.removeField===void 0&&e.renameTo===void 0||e.field!==void 0,{message:`removeField and renameTo require field`}).refine(e=>e.parentPath===void 0||e.field!==void 0,{message:`parentPath requires field`}).refine(e=>e.field===void 0?e.constraint===void 0:e.constraint!==void 0||e.removeField!==void 0||e.renameTo!==void 0,{message:`field requires constraint, removeField, or renameTo`}),NJ=y({schemas:D(b()),truncated:k()}).strict(),PJ=y({line:_(),character:_()}),FJ=y({start:PJ,end:PJ}),IJ=y({range:FJ,severity:i([`error`,`warning`,`info`,`hint`]),source:b(),code:b(),message:b(),fixes:D(y({range:FJ,newText:b()})).optional()}),LJ=y({file:b(),diagnostics:D(IJ),warnings:D(b()).optional()}),RJ=y({files:D(LJ),fileCount:_(),errorCount:_(),warningCount:_(),warnings:D(b())}),zJ=IJ.extend({linkTarget:b().optional()}),BJ=y({files:D(y({file:b(),diagnostics:D(zJ)})),fileCount:_(),errorCount:_(),warningCount:_(),warnings:D(b())}),VJ=y({errorCount:_().int().nonnegative(),warningCount:_().int().nonnegative()}),HJ=y({files:D(y({file:b(),lint:VJ,links:VJ})),fileCount:_().int().nonnegative(),errorCount:_().int().nonnegative(),warningCount:_().int().nonnegative(),warnings:D(b())}),UJ=y({docName:Ly,summary:By,...zy}).loose(),WJ=y({file:b(),fixedCount:_(),diagnostics:D(IJ),errorCount:_(),warningCount:_(),warning:b().optional()});function GJ(){let e=sW[lW];return`${JSON.stringify({$schema:e,type:`object`},null,2)}\n`}function KJ(e){let t=e.trim().replace(/^\.\//,``);if(!t.startsWith(`.ok/schemas/`))return!1;let n=t.slice(12);return n.length>0&&!n.includes(`/`)&&!n.includes(`\\`)&&n!==`.`&&n!==`..`}function qJ(e){let t=e.trim().toLowerCase().split(`/`).pop()??``;return t.endsWith(`.schema.json`)&&t.length>12?!0:KJ(e)&&t.endsWith(`.json`)}var JJ=class extends Error{};function YJ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function XJ(e,t,n){let r=e;for(let e of t){if(typeof e!=`string`){let e=r.items;if(e===void 0){if(!n)throw new JJ(`field path items does not exist`);let e={type:`object`};r.items=e,r=e;continue}if(!YJ(e))throw new JJ(`field path items is not an object sub-schema`);r=e;continue}let t=$J(r),i=t[e];if(i===void 0){if(!n)throw new JJ(`field path ${JSON.stringify(e)} does not exist`);let i={type:`object`};r.properties={...t,[e]:i},r=i;continue}if(!YJ(i))throw new JJ(`field path ${JSON.stringify(e)} is not an object property`);r=i}return r}function ZJ(e,t,n,r=[]){let i;i=e.trim()===``?JSON.parse(GJ()):QJ(e);let a=XJ(i,r,!0),o=$J(a),s={...YJ(o[t])?o[t]:{}};for(let e of[`type`,`enum`,`pattern`,`format`,`description`]){if(!(e in n))continue;let t=n[e];t==null?delete s[e]:s[e]=t}if(`itemsEnum`in n||`itemsType`in n){if(s.items!==void 0&&!YJ(s.items))throw new JJ(`field path items is not an object sub-schema`);let e=YJ(s.items)?{...s.items}:{};`itemsEnum`in n&&(n.itemsEnum===null||n.itemsEnum===void 0?delete e.enum:e.enum=n.itemsEnum),`itemsType`in n&&(n.itemsType===null||n.itemsType===void 0?delete e.type:e.type=n.itemsType),Object.keys(e).length>0?s.items=e:delete s.items}if(Object.keys(s).length>0)a.properties={...o,[t]:s};else if(t in o){let{[t]:e,...n}=o;Object.keys(n).length>0?a.properties=n:delete a.properties}if(n.required!==void 0){let e=eY(a),r=e.includes(t);n.required&&!r?a.required=[...e,t]:!n.required&&r&&tY(a,e.filter(e=>e!==t))}return`${JSON.stringify(i,null,2)}\n`}function QJ(e){let t;try{t=JSON.parse(e)}catch(e){throw new JJ(`schema is not valid JSON (${e instanceof Error?e.message:String(e)})`)}if(!YJ(t))throw new JJ(`schema is not a JSON object`);return t}function $J(e){return YJ(e.properties)?e.properties:{}}function eY(e){return Array.isArray(e.required)?e.required.filter(e=>typeof e==`string`):[]}function tY(e,t){t.length>0?e.required=t:delete e.required}function nY(e,t,n=[]){let r=QJ(e),i=XJ(r,n,!1),a=$J(i);if(t in a){let{[t]:e,...n}=a;Object.keys(n).length>0?i.properties=n:delete i.properties}return tY(i,eY(i).filter(e=>e!==t)),`${JSON.stringify(r,null,2)}\n`}function rY(e,t,n,r=[]){let i=QJ(e),a=XJ(i,r,!1),o=$J(a);if(!(t in o))throw new JJ(`field ${JSON.stringify(t)} does not exist`);if(n in o)throw new JJ(`field ${JSON.stringify(n)} already exists`);let s={};for(let[e,r]of Object.entries(o))s[e===t?n:e]=r;return a.properties=s,tY(a,eY(a).map(e=>e===t?n:e)),`${JSON.stringify(i,null,2)}\n`}const iY=[{id:`MD001`,alias:`heading-increment`,aliases:[`heading-increment`],name:`Heading levels should only increment by one level at a time`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md001.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`}]},{id:`MD003`,alias:`heading-style`,aliases:[`heading-style`],name:`Heading style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md003.md`,tags:[`headings`],options:[{key:`style`,type:`enum`,description:`Heading style`,enum:[`consistent`,`atx`,`atx_closed`,`setext`,`setext_with_atx`,`setext_with_atx_closed`],default:`consistent`}]},{id:`MD004`,alias:`ul-style`,aliases:[`ul-style`],name:`Unordered list style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md004.md`,tags:[`bullet`,`ul`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`consistent`,`asterisk`,`plus`,`dash`,`sublist`],default:`consistent`}]},{id:`MD005`,alias:`list-indent`,aliases:[`list-indent`],name:`Inconsistent indentation for list items at the same level`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md005.md`,tags:[`bullet`,`ul`,`indentation`],options:[]},{id:`MD007`,alias:`ul-indent`,aliases:[`ul-indent`],name:`Unordered list indentation`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md007.md`,tags:[`bullet`,`ul`,`indentation`],options:[{key:`indent`,type:`integer`,description:`Spaces for indent`,default:2,minimum:1},{key:`start_indented`,type:`boolean`,description:`Whether to indent the first level of the list`,default:!1},{key:`start_indent`,type:`integer`,description:`Spaces for first level indent (when start_indented is set)`,default:2,minimum:1}]},{id:`MD009`,alias:`no-trailing-spaces`,aliases:[`no-trailing-spaces`],name:`Trailing spaces`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md009.md`,tags:[`whitespace`],options:[{key:`br_spaces`,type:`integer`,description:`Spaces for line break`,default:2,minimum:0},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!1},{key:`list_item_empty_lines`,type:`boolean`,description:`Allow spaces for empty lines in list items`,default:!1},{key:`strict`,type:`boolean`,description:`Include unnecessary breaks`,default:!1}]},{id:`MD010`,alias:`no-hard-tabs`,aliases:[`no-hard-tabs`],name:`Hard tabs`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md010.md`,tags:[`whitespace`,`hard_tab`],options:[{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`ignore_code_languages`,type:`string-array`,description:`Fenced code languages to ignore`,default:[]},{key:`spaces_per_tab`,type:`integer`,description:`Number of spaces for each hard tab`,default:1,minimum:0}]},{id:`MD011`,alias:`no-reversed-links`,aliases:[`no-reversed-links`],name:`Reversed link syntax`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md011.md`,tags:[`links`],options:[]},{id:`MD012`,alias:`no-multiple-blanks`,aliases:[`no-multiple-blanks`],name:`Multiple consecutive blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md012.md`,tags:[`whitespace`,`blank_lines`],options:[{key:`maximum`,type:`integer`,description:`Consecutive blank lines`,default:1,minimum:1}]},{id:`MD013`,alias:`line-length`,aliases:[`line-length`],name:`Line length`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md013.md`,tags:[`line_length`],options:[{key:`line_length`,type:`integer`,description:`Number of characters`,default:80,minimum:1},{key:`heading_line_length`,type:`integer`,description:`Number of characters for headings`,default:80,minimum:1},{key:`code_block_line_length`,type:`integer`,description:`Number of characters for code blocks`,default:80,minimum:1},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`tables`,type:`boolean`,description:`Include tables`,default:!0},{key:`headings`,type:`boolean`,description:`Include headings`,default:!0},{key:`strict`,type:`boolean`,description:`Strict length checking`,default:!1},{key:`stern`,type:`boolean`,description:`Stern length checking`,default:!1}]},{id:`MD014`,alias:`commands-show-output`,aliases:[`commands-show-output`],name:`Dollar signs used before commands without showing output`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md014.md`,tags:[`code`],options:[]},{id:`MD018`,alias:`no-missing-space-atx`,aliases:[`no-missing-space-atx`],name:`No space after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md018.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD019`,alias:`no-multiple-space-atx`,aliases:[`no-multiple-space-atx`],name:`Multiple spaces after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md019.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD020`,alias:`no-missing-space-closed-atx`,aliases:[`no-missing-space-closed-atx`],name:`No space inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md020.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD021`,alias:`no-multiple-space-closed-atx`,aliases:[`no-multiple-space-closed-atx`],name:`Multiple spaces inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md021.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD022`,alias:`blanks-around-headings`,aliases:[`blanks-around-headings`],name:`Headings should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md022.md`,tags:[`headings`,`blank_lines`],options:[{key:`include_front_matter`,type:`boolean`,description:`Include front matter content`,default:!1},{key:`lines_above`,type:`unsupported`,description:`Blank lines above heading`,default:1},{key:`lines_below`,type:`unsupported`,description:`Blank lines below heading`,default:1}]},{id:`MD023`,alias:`heading-start-left`,aliases:[`heading-start-left`],name:`Headings must start at the beginning of the line`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md023.md`,tags:[`headings`,`spaces`],options:[]},{id:`MD024`,alias:`no-duplicate-heading`,aliases:[`no-duplicate-heading`],name:`Multiple headings with the same content`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md024.md`,tags:[`headings`],options:[{key:`siblings_only`,type:`boolean`,description:`Only check sibling headings`,default:!1}]},{id:`MD025`,alias:`single-title`,aliases:[`single-title`,`single-h1`],name:`Multiple top-level headings in the same document`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md025.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD026`,alias:`no-trailing-punctuation`,aliases:[`no-trailing-punctuation`],name:`Trailing punctuation in heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md026.md`,tags:[`headings`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!。,;:!`}]},{id:`MD027`,alias:`no-multiple-space-blockquote`,aliases:[`no-multiple-space-blockquote`],name:`Multiple spaces after blockquote symbol`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md027.md`,tags:[`indentation`,`whitespace`,`blockquote`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD028`,alias:`no-blanks-blockquote`,aliases:[`no-blanks-blockquote`],name:`Blank line inside blockquote`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md028.md`,tags:[`whitespace`,`blockquote`],options:[]},{id:`MD029`,alias:`ol-prefix`,aliases:[`ol-prefix`],name:`Ordered list item prefix`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md029.md`,tags:[`ol`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`one`,`ordered`,`one_or_ordered`,`zero`],default:`one_or_ordered`}]},{id:`MD030`,alias:`list-marker-space`,aliases:[`list-marker-space`],name:`Spaces after list markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md030.md`,tags:[`ul`,`whitespace`,`ol`],options:[{key:`ul_single`,type:`integer`,description:`Spaces for single-line unordered list items`,default:1,minimum:1},{key:`ol_single`,type:`integer`,description:`Spaces for single-line ordered list items`,default:1,minimum:1},{key:`ul_multi`,type:`integer`,description:`Spaces for multi-line unordered list items`,default:1,minimum:1},{key:`ol_multi`,type:`integer`,description:`Spaces for multi-line ordered list items`,default:1,minimum:1}]},{id:`MD031`,alias:`blanks-around-fences`,aliases:[`blanks-around-fences`],name:`Fenced code blocks should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md031.md`,tags:[`blank_lines`,`code`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD032`,alias:`blanks-around-lists`,aliases:[`blanks-around-lists`],name:`Lists should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md032.md`,tags:[`bullet`,`ul`,`blank_lines`,`ol`],options:[]},{id:`MD033`,alias:`no-inline-html`,aliases:[`no-inline-html`],name:`Inline HTML`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md033.md`,tags:[`html`],options:[{key:`allowed_elements`,type:`string-array`,description:`Allowed elements`,default:[]},{key:`table_allowed_elements`,type:`string-array`,description:`Allowed elements in tables`,default:[]}]},{id:`MD034`,alias:`no-bare-urls`,aliases:[`no-bare-urls`],name:`Bare URL used`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md034.md`,tags:[`links`,`url`],options:[]},{id:`MD035`,alias:`hr-style`,aliases:[`hr-style`],name:`Horizontal rule style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md035.md`,tags:[`hr`],options:[{key:`style`,type:`string`,description:`Horizontal rule style`,default:`consistent`}]},{id:`MD036`,alias:`no-emphasis-as-heading`,aliases:[`no-emphasis-as-heading`],name:`Emphasis used instead of a heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md036.md`,tags:[`headings`,`emphasis`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!?。,;:!?`}]},{id:`MD037`,alias:`no-space-in-emphasis`,aliases:[`no-space-in-emphasis`],name:`Spaces inside emphasis markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md037.md`,tags:[`whitespace`,`emphasis`],options:[]},{id:`MD038`,alias:`no-space-in-code`,aliases:[`no-space-in-code`],name:`Spaces inside code span elements`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md038.md`,tags:[`whitespace`,`code`],options:[]},{id:`MD039`,alias:`no-space-in-links`,aliases:[`no-space-in-links`],name:`Spaces inside link text`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md039.md`,tags:[`whitespace`,`links`],options:[]},{id:`MD040`,alias:`fenced-code-language`,aliases:[`fenced-code-language`],name:`Fenced code blocks should have a language specified`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md040.md`,tags:[`code`,`language`],options:[{key:`allowed_languages`,type:`string-array`,description:`List of languages`,default:[]},{key:`language_only`,type:`boolean`,description:`Require language only`,default:!1}]},{id:`MD041`,alias:`first-line-heading`,aliases:[`first-line-heading`,`first-line-h1`],name:`First line in a file should be a top-level heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md041.md`,tags:[`headings`],options:[{key:`allow_preamble`,type:`boolean`,description:`Allow content before first heading`,default:!1},{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD042`,alias:`no-empty-links`,aliases:[`no-empty-links`],name:`No empty links`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md042.md`,tags:[`links`],options:[]},{id:`MD043`,alias:`required-headings`,aliases:[`required-headings`],name:`Required heading structure`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md043.md`,tags:[`headings`],options:[{key:`headings`,type:`string-array`,description:`List of headings`,default:[]},{key:`match_case`,type:`boolean`,description:`Match case of headings`,default:!1}]},{id:`MD044`,alias:`proper-names`,aliases:[`proper-names`],name:`Proper names should have the correct capitalization`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md044.md`,tags:[`spelling`],options:[{key:`names`,type:`string-array`,description:`List of proper names`,default:[]},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`html_elements`,type:`boolean`,description:`Include HTML elements`,default:!0}]},{id:`MD045`,alias:`no-alt-text`,aliases:[`no-alt-text`],name:`Images should have alternate text (alt text)`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md045.md`,tags:[`accessibility`,`images`],options:[]},{id:`MD046`,alias:`code-block-style`,aliases:[`code-block-style`],name:`Code block style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md046.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Block style`,enum:[`consistent`,`fenced`,`indented`],default:`consistent`}]},{id:`MD047`,alias:`single-trailing-newline`,aliases:[`single-trailing-newline`],name:`Files should end with a single newline character`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md047.md`,tags:[`blank_lines`],options:[]},{id:`MD048`,alias:`code-fence-style`,aliases:[`code-fence-style`],name:`Code fence style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md048.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Code fence style`,enum:[`consistent`,`backtick`,`tilde`],default:`consistent`}]},{id:`MD049`,alias:`emphasis-style`,aliases:[`emphasis-style`],name:`Emphasis style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md049.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Emphasis style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD050`,alias:`strong-style`,aliases:[`strong-style`],name:`Strong style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md050.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Strong style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD051`,alias:`link-fragments`,aliases:[`link-fragments`],name:`Link fragments should be valid`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md051.md`,tags:[`links`],options:[{key:`ignore_case`,type:`boolean`,description:`Ignore case of fragments`,default:!1},{key:`ignored_pattern`,type:`string`,description:`Pattern for ignoring additional fragments`,default:``}]},{id:`MD052`,alias:`reference-links-images`,aliases:[`reference-links-images`],name:`Reference links and images should use a label that is defined`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md052.md`,tags:[`links`,`images`],options:[{key:`ignored_labels`,type:`string-array`,description:`Ignored link labels`,default:[`x`]},{key:`shortcut_syntax`,type:`boolean`,description:`Include shortcut syntax`,default:!1}]},{id:`MD053`,alias:`link-image-reference-definitions`,aliases:[`link-image-reference-definitions`],name:`Link and image reference definitions should be needed`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md053.md`,tags:[`links`,`images`],options:[{key:`ignored_definitions`,type:`string-array`,description:`Ignored definitions`,default:[`//`]}]},{id:`MD054`,alias:`link-image-style`,aliases:[`link-image-style`],name:`Link and image style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md054.md`,tags:[`links`,`images`],options:[{key:`autolink`,type:`boolean`,description:`Allow autolinks`,default:!0},{key:`inline`,type:`boolean`,description:`Allow inline links and images`,default:!0},{key:`full`,type:`boolean`,description:`Allow full reference links and images`,default:!0},{key:`collapsed`,type:`boolean`,description:`Allow collapsed reference links and images`,default:!0},{key:`shortcut`,type:`boolean`,description:`Allow shortcut reference links and images`,default:!0},{key:`url_inline`,type:`boolean`,description:`Allow URLs as inline links`,default:!0}]},{id:`MD055`,alias:`table-pipe-style`,aliases:[`table-pipe-style`],name:`Table pipe style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table pipe style`,enum:[`consistent`,`leading_only`,`trailing_only`,`leading_and_trailing`,`no_leading_or_trailing`],default:`consistent`}]},{id:`MD056`,alias:`table-column-count`,aliases:[`table-column-count`],name:`Table column count`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md056.md`,tags:[`table`],options:[]},{id:`MD058`,alias:`blanks-around-tables`,aliases:[`blanks-around-tables`],name:`Tables should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md058.md`,tags:[`table`],options:[]},{id:`MD059`,alias:`descriptive-link-text`,aliases:[`descriptive-link-text`],name:`Link text should be descriptive`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md059.md`,tags:[`links`,`accessibility`],options:[{key:`prohibited_texts`,type:`string-array`,description:`Prohibited link texts`,default:[`click here`,`here`,`link`,`more`]}]},{id:`MD060`,alias:`table-column-style`,aliases:[`table-column-style`],name:`Table column style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md060.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table column style`,enum:[`any`,`aligned`,`compact`,`tight`],default:`any`},{key:`aligned_delimiter`,type:`boolean`,description:`Aligned delimiter columns`,default:!1}]}],aY=(()=>{let e=new Map;for(let t of iY){e.set(t.id.toUpperCase(),t.id);for(let n of t.aliases)e.set(n.toUpperCase(),t.id)}return e})();function oY(e){return aY.get(e.toUpperCase())??null}function sY(e,t){let n=oY(t);if(n===null)return;let r;for(let[t,i]of Object.entries(e))oY(t)===n&&(r={key:t,value:i});return r}function cY(e){let t={lint:{errorCount:0,warningCount:0},links:{errorCount:0,warningCount:0}};for(let n of e){let e=n.source===`links`?t.links:t.lint;n.severity===`error`?e.errorCount+=1:e.warningCount+=1}return t}async function lY(e,t,n){if(!t.enabled)return[];let r=[];for(let i of TJ){let a=t.plugins[i.id];a.enabled&&r.push(...await i.lint(e,a,{docName:n}))}return r}function uY(e,t){if(!t.enabled)return e;let n=e;for(let e of TJ){let r=t.plugins[e.id];!r.enabled||!e.fix||(n=e.fix(n,r))}return n}const dY=/\p{M}+/gu,fY=/[^\p{L}\p{N}]+/gu,pY=/^-+|-+$/g;function mY(e){return e.trim().normalize(`NFKD`).replace(dY,``).toLowerCase().replace(fY,`-`).replace(pY,``)}function hY(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function gY(e,t){let n=mY(e);return n?hY(n,t):``}const _Y=new Set([`img`,`video`,`audio`,`mark`,`u`,`ins`]);new Map(rP.flatMap(e=>e.surface===`compat`&&_Y.has(e.rendersAs)?[[e.name,e]]:[])),Wk(`<>`);const vY=aB(),yY=Cz(),bY=wz();function xY(){return rP.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function SY(){return xY().filter(e=>{let t=CY(e);return t!==`fence`&&t!==`html`})}function CY(e){return e.name===`MermaidFence`?`fence`:e.name===`HtmlAlignBlock`?`html`:e.hasChildren?`jsx-block`:`jsx-void`}function wY(e){return{id:e.name,displayName:e.displayName??e.name,description:e.description??``,kind:CY(e)}}function TY(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 EY(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 DY(e){let t=[];for(let n of e.props){let e=TY(n);e!==void 0&&EY(n,e)&&t.push(hN(n.name,e))}return t}function OY(e){return KF(e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`Body content here.`,{extensions:[vY],mdastExtensions:[yY]}).children}function kY(e){let t=CY(e),n;if(t===`fence`)n={type:`code`,lang:`mermaid`,meta:null,value:e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`graph LR
|
|
289
289
|
A --> B`};else{let r=DY(e),i=t===`jsx-block`?OY(e):[];n={type:`mdxJsxFlowElement`,name:e.name,attributes:r,children:i}}return GO({type:`root`,children:[n]},{extensions:[bY]}).trimEnd()}function AY(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 jY(e){return{...wY(e),example:kY(e),params:AY(e)}}function MY(){return[``,"**Custom canonical components.** OK `.md` / `.mdx` supports the JSX components below. For source syntax + parameter schemas, call `palette({ components: [ids] })`. Arbitrary `<TagName>` JSX falls through as raw MDX when no canonical fits.",``,...SY().map(wY).map(e=>`- \`${e.id}\` (${e.kind}) — ${e.description}`)].join(`
|
|
290
290
|
`)}function NY(){return[MY(),``,"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."].join(`
|
|
291
|
-
`)}const PY=[`text`,`number`,`boolean`,`date`,`list`,`object`];i(PY);const FY=p([b(),_(),k()]),IY=g(()=>p([FY.transform(e=>String(e)),x(b(),LY),D(IY)])),LY=g(()=>p([b(),_(),k(),D(IY),x(b(),LY)]));function RY(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(RY(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:RY(r);return t}return e}const zY=E(RY,x(b(),LY));x(b(),p([LY,v()]));function BY(e){return!!(e===null||typeof e==`string`&&e===``||Array.isArray(e)&&e.length===0)}const VY=y({docName:Ly,summary:By,content:b().optional(),...zy}).loose(),HY=y({docName:Ly,summary:By,markdown:b(),position:i([`append`,`prepend`,`replace`]).optional(),extension:i(ht).optional(),...zy}).loose(),UY=y({docName:Ly,summary:By,find:b().min(1),replace:b(),offset:_().int().nonnegative().optional(),...zy}).loose(),WY=y({docName:Ly,connectionId:b().min(1),scope:i([`last`,`session`,`file`,`count`]).optional(),count:_().int().positive().optional(),...zy}).loose().refine(e=>e.scope!==`count`||e.count!==void 0,{message:`count is required when scope is 'count'`,path:[`count`]}),GY=y({value:b(),truncatedFrom:_().int().nonnegative().optional(),hint:b().optional()}).loose(),KY=m(`kind`,[y({kind:T(`inline`),content:b()}),y({kind:T(`truncated`),byteLength:_().int().nonnegative(),hint:b()})]),qY=y({kind:T(`content-divergence`),intendedBytes:_().int().nonnegative(),actualBytes:_().int().nonnegative(),byteDelta:_().int(),divergenceType:b().optional(),currentState:KY.optional(),hint:b().optional()}).loose(),JY=y({type:T(`orphan`),parentCandidates:D(b()),message:b()}).loose(),YY=y({kind:T(`disk-edit-reconciled`),intendedBytes:_().int().nonnegative(),actualBytes:_().int().nonnegative(),byteDelta:_().int(),mergeOutcome:b().optional(),hint:b().optional()}).loose(),XY=m(`kind`,[qY,YY]),ZY=m(`kind`,[qY,YY,y({kind:T(`mermaid-parse-error`),fenceIndex:_().int().positive(),fenceFirstLine:b(),message:b(),line:_().int().positive().optional()}).loose(),y({kind:T(`lint-violation`),source:b(),code:b(),message:b(),severity:i([`error`,`warning`,`info`,`hint`]),line:_().int().positive(),column:_().int().positive(),linkTarget:b().optional()}).loose()]),QY=D(ZY).min(1),$Y=y({href:b(),resolvedTo:b().nullable(),reason:i([`no-such-doc`,`no-such-file`,`unresolvable`])}).loose(),eX=D($Y),tX=y({timestamp:b().min(1),summary:GY.optional(),warning:XY.optional(),warnings:QY.optional()}).loose(),nX=y({timestamp:b().min(1),subscriberCount:_().int().nonnegative(),systemSubscriberCount:_().int().nonnegative(),hints:D(JY).optional(),summary:GY.optional(),warning:XY.optional(),warnings:QY.optional(),brokenLinks:eX}).loose(),rX=y({timestamp:b().min(1),subscriberCount:_().int().nonnegative(),systemSubscriberCount:_().int().nonnegative(),summary:GY.optional(),warning:XY.optional(),warnings:QY.optional(),brokenLinks:eX}).loose(),iX=y({docName:b().min(1),scope:i([`last`,`session`,`count`]),undone:k()}).loose(),aX=y({docs:D(y({docName:Ry,markdown:b(),position:i([`append`,`prepend`,`replace`]).optional(),extension:i(ht).optional(),summary:By}).loose()).min(1).max(100),...zy}).loose(),oX=y({type:Sb,title:b(),detail:b().optional()}).loose(),sX=m(`status`,[y({status:T(`written`),docName:b().min(1),summary:GY.optional(),warnings:QY.optional(),brokenLinks:eX}).loose(),y({status:T(`error`),docName:b().min(1),error:oX}).loose()]),cX=y({timestamp:b().min(1),results:D(sX),written:_().int().nonnegative(),failed:_().int().nonnegative()}).loose(),lX=y({docName:Ly,patch:x(b(),p([LY,v()])),types:x(b(),i(PY)).optional(),summary:By,...zy}).loose(),uX=y({timestamp:b().min(1),subscriberCount:_().int().nonnegative(),systemSubscriberCount:_().int().nonnegative(),appliedKeys:D(b()),summary:GY.optional(),warning:XY.optional(),warnings:QY.optional(),brokenLinks:eX}).loose(),dX=y({entries:D(y({level:i([`info`,`warn`,`error`]),message:b().max(8192),event:b().optional(),fields:x(b(),te()).optional(),ts:_().optional(),sourceId:b().optional(),lineNumber:_().optional()}).loose()).max(100),droppedSinceLastFlush:_().int().min(0).optional()}).loose(),fX=y({accepted:_().int().min(0)}).loose(),pX=y({exact:b().min(1),prefix:b(),suffix:b(),start:_().int().nonnegative(),end:_().int().nonnegative()}),mX=D(p([b(),_().int().nonnegative()])),hX=m(`kind`,[y({kind:T(`body`)}),y({kind:T(`property`),key:b().min(1),path:mX.default([])})]).default({kind:`body`}),gX=i([`anchored`,`orphaned`,`resolved`]),_X=y({threadId:b().min(1),docName:b().min(1),target:hX,anchor:pX.nullable(),state:gX,queued:k(),latestComment:b(),createdBy:b().min(1),createdAt:_()}),vX=y({docName:b(),instruction:b(),property:b().nullable(),passage:y({exact:b(),prefix:b(),suffix:b()}).nullable(),anchorLost:k(),passageRepeats:k()}).loose(),yX=y({threadId:b(),ok:T(!0)}),bX=y({threadId:b(),ok:T(!1),error:T(`not-found`)}),xX=y({threads:D(_X)}).loose(),SX=y({meta:_X,orphaned:k()}).loose(),CX=y({threadId:b()}).loose(),wX=y({meta:_X,payload:vX}).loose(),TX=y({results:D(p([yX.extend({meta:_X,payload:vX}),bX]))}).loose(),EX=y({results:D(p([yX.extend({meta:_X}),bX]))}).loose(),DX=y({status:b().min(1),reason:b()}).loose(),OX=y({docName:b().min(1),content:b(),lifecycle:DX.nullable()}).loose(),kX=y({documents:D(y({kind:i([`document`,`asset`,`folder`,`file`]).default(`document`),docName:b().min(1).optional(),docExt:b().min(1).default(`.md`),size:_().int().nonnegative(),modified:b().min(1),isSymlink:k().default(!1),canonicalDocName:b().nullable().default(null),targetPath:b().nullable().default(null),path:b().min(1).optional(),assetExt:b().min(1).optional(),mediaKind:i([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`]).nullable().optional(),referencedBy:D(b().min(1)).optional(),hasChildren:k().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:k().optional()}).loose(),AX=y({source:b().min(1),anchor:b().nullable(),title:b(),snippet:b().nullable()}).loose(),jX=y({docName:b().min(1),backlinks:D(AX)}).loose(),MX=y({counts:x(b().min(1),_().int().nonnegative())}).loose(),NX=y({counts:x(b().min(1),_().int().nonnegative())}).loose(),PX=m(`kind`,[y({kind:T(`doc`),docName:b().min(1),anchor:b().nullable(),title:b(),snippet:b().nullable()}).loose(),y({kind:T(`external`),url:b().min(1),title:b(),snippet:b().nullable()}).loose()]),FX=y({docName:b().min(1),forwardLinks:D(PX)}).loose(),IX=m(`kind`,[y({id:b().min(1),kind:T(`doc`),docName:b().min(1),anchor:b().nullable(),label:b(),cluster:b().nullable(),category:b().nullable(),tags:D(b()).nullable()}).loose(),y({id:b().min(1),kind:T(`external`),url:b().min(1),label:b()}).loose()]),LX=y({source:b().min(1),target:b().min(1)}).loose(),RX=y({nodes:D(IX),links:D(LX)}).loose(),zX=y({ts:_().int().min(0),url:b(),method:b(),ua:b().optional(),origin:b().optional(),referer:b().optional(),host:b().optional(),remote:b().optional(),secChUa:b().optional(),secChUaMobile:b().optional(),secChUaPlatform:b().optional(),secFetchSite:b().optional(),secFetchDest:b().optional(),secFetchMode:b().optional(),secFetchUser:b().optional()}).loose(),BX=y({app:p([T(`cursor`),T(`codex`),T(`claude`),v()]),signals_fired:D(b())}).loose(),VX=y({entries:D(zX),count:_().int().min(0),detection:BX}).loose(),HX=y({writers:D(y({id:b().min(1),name:b().optional(),email:b().optional()}).loose()).optional(),summary:By,...zy}).loose(),UX=y({checkpointRef:b().min(1)}).loose(),WX=y({v:_().int().optional(),id:b().min(1),name:b().min(1),colorSeed:b().optional(),docs:D(b()),summaries:D(b()).optional()}).loose(),GX=y({entries:D(y({sha:b().min(1),timestamp:b().min(1),author:b(),authorEmail:b(),type:i([`checkpoint`,`wip`,`upstream`,`park`]),message:b(),contributors:D(WX),checkpoint:te().nullable(),parentSha:b().nullable().optional()}).loose()),total:_().int().nonnegative().optional(),truncated:k().optional(),hasMore:k().optional()}).loose(),KX=y({sha:b().regex(/^[0-9a-f]{40}$/i),content:b(),timestamp:b(),author:b()}).loose(),qX=y({contentDir:b().min(1),pathSeparator:i([`/`,`\\`]),symlinkResolved:k()}).loose(),JX=D(m(`source`,[y({docName:b().min(1),timestamp:b().min(1),size:_().int().nonnegative(),source:T(`flat`)}).loose(),y({docName:b().min(1),timestamp:b().min(1),source:T(`timeline`),sha:b().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),YX=y({domain:b().min(1),title:b().optional(),description:b().optional(),siteName:b().optional(),faviconDataUri:b().optional()}).loose(),XX=y({url:b()}).loose(),ZX=m(`ok`,[y({ok:T(!0),metadata:YX}).loose(),y({ok:T(!1),reason:b()}).loose()]),QX=y({orphans:D(y({docName:b().min(1),title:b()}).loose())}).loose(),$X=y({hubs:D(y({docName:b().min(1),title:b(),count:_().int().nonnegative()}).loose())}).loose(),eZ=y({source:b().min(1),title:b(),snippet:b().nullable()}).loose(),tZ=y({deadLinks:D(y({target:b().min(1),sources:D(eZ)}).loose())}).loose(),nZ=y({target:y({docName:b().min(1),title:b(),aliases:D(b())}).loose(),mentions:D(y({source:b().min(1),excerpt:b(),offset:_().int().nonnegative()}).loose()),truncated:k()}).loose(),rZ=y({projectPath:b().min(1)}).loose(),iZ=i([`not-a-git-worktree`,`init-failed`]),aZ=m(`ok`,[y({ok:T(!0),projectPath:b().min(1)}).loose(),y({ok:T(!1),reason:iZ,message:b().min(1)}).loose()]),oZ=y({host:b().min(1).optional()}).loose(),sZ=y({host:b().min(1).optional(),token:b().min(1)}).loose(),cZ=y({host:b(),login:b()}).loose(),lZ=y({key:b().min(1)}).loose(),uZ=y({keyPresent:k()}).loose(),dZ=i([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]),fZ=m(`ok`,[y({ok:T(!0),endpoint:b().min(1),model:b().min(1),dimensions:_().int().positive()}).loose(),y({ok:T(!1),endpoint:b().min(1),model:b().min(1),reason:dZ,status:_().int().optional()}).loose()]),pZ=y({name:b().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:b().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),mZ=y({authenticated:k()}).loose(),hZ=y({channel:i([`login`,`gh-login`]).default(`login`)}).loose(),gZ=y({}).loose(),_Z=y({stackIndex:_().int().min(0),ts:_().int().min(0),additions:_().int().min(0),deletions:_().int().min(0)}).loose(),vZ=y({docName:b().min(1),additionsTotal:_().int().min(0),deletionsTotal:_().int().min(0),lastTs:_().int().min(0),bursts:D(_Z)}).loose(),yZ=y({displayName:b().min(1),color:b().min(1),icon:b().optional(),connectionId:b().min(1)}).loose(),bZ=y({sessionAlive:k(),agent:yZ.nullable(),files:D(vZ)}).loose(),xZ=y({diff:b(),before:b(),after:b(),generatedAt:_().int().min(0)}).loose(),SZ=y({}).loose(),CZ=y({}).loose(),wZ=y({}).loose(),TZ=y({}).loose(),EZ=y({}).loose(),DZ=y({}).loose(),OZ=y({displayName:b().min(1),icon:b(),color:b().min(1),currentDoc:b().nullable(),mode:i([`idle`,`writing`]),ts:_().int().min(0)}).loose(),kZ=y({presence:x(b().min(1),OZ)}).loose(),AZ=y({sessionId:b().min(1),agentType:b().min(1),ts:_().int().min(0),insertedChars:_().int().min(0),deletedChars:_().int().min(0)}).loose(),jZ=y({effects:D(y({"doc.name":b().min(1),entries:D(AZ)}).loose())}).loose(),MZ=y({decisions:D(y({ts:_().int().min(0),decision:b().min(1),kind:b().min(1),"doc.name":b().min(1),pathRole:b().min(1)}).loose())}).loose(),NZ=x(b().min(1),k()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});y({path:b().min(1,`path must be non-empty`)}).loose();const PZ=y({}).loose(),FZ=y({fromDocName:b().min(1),toDocName:b().min(1)}).loose(),IZ=y({fromPath:b().min(1),toPath:b().min(1)}).loose(),LZ=y({}).loose(),RZ=y({path:b().min(1),...zy,summary:By}).loose(),zZ=y({docName:b().min(1)}).loose(),BZ=y({path:b().min(1),...zy,summary:By}).loose(),VZ=y({path:b().min(1)}).loose(),HZ=y({kind:i([`file`,`folder`]),path:b().min(1),...zy,summary:By}).loose(),UZ=y({kind:i([`file`,`folder`]),path:b().min(1),duplicatedDocNames:D(b().min(1))}).loose(),WZ=y({pages:D(y({docName:b().min(1),title:b(),docExt:b().min(1),size:_().int().nonnegative(),modified:b().min(1),icon:b().min(1).max(2048).optional()}).loose())}).loose(),GZ=y({level:_().int().min(1).max(6),text:b(),slug:b()}).loose(),KZ=y({docName:b().min(1),headings:D(GZ)}).loose(),qZ=y({docName:b().min(1),rewrites:_().int().nonnegative()}).loose(),JZ=y({kind:i([`file`,`folder`,`asset`]),fromPath:b().min(1),toPath:b().min(1),...zy,summary:By}).loose(),YZ=y({renamed:D(FZ),renamedAssets:D(IZ),rewrittenDocs:D(qZ).optional(),summary:GY.optional()}).loose(),XZ=y({kind:i([`file`,`folder`,`asset`]),path:b().min(1),...zy}).loose(),ZZ=y({deletedDocNames:D(b().min(1))}).loose(),QZ=y({kind:i([`file`,`folder`,`asset`]),path:b().min(1),...zy,summary:By}).loose(),$Z=y({deletedDocNames:D(b().min(1))}).loose(),eQ=y({docName:b().min(1),commitSha:b().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:By,...zy}).loose(),tQ=y({restoredFrom:b().min(1),timestamp:b().min(1),summary:GY.optional(),warning:qY.optional(),warnings:QY.optional()}).loose(),nQ=i([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),rQ=y({label:b().min(1),webUrl:re().nullable()}).loose(),iQ=m(`checkStatus`,[y({checkStatus:T(`allowed`)}).loose(),y({checkStatus:T(`denied`),deniedReason:i([`no-collaborator`,`private-no-access`,`repo-not-found`,`not-authenticated`])}).loose(),y({checkStatus:T(`unknown`),unknownError:i([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`,`ssh-unverified`]).optional()}).loose()]),aQ=i([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),oQ=i(o),sQ=i([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]),cQ=y({state:nQ,lastSyncUtc:b().nullable(),lastFetchUtc:b().nullable(),lastPushedSha:b().nullable(),ahead:_().int().min(0),behind:_().int().min(0),consecutiveFailures:_().int().min(0),conflictCount:_().int().min(0),hasRemote:k(),syncEnabled:k(),identityUnresolved:k(),remote:rQ.nullable().optional(),pushError:b().optional(),pushErrorCode:aQ.optional(),pullError:b().optional(),pullErrorCode:aQ.optional(),pausedReason:b().optional(),pushPermission:iQ.optional(),syncMode:oQ.optional(),lastPullUtc:b().nullable().optional(),lastPullOutcome:sQ.nullable().optional()}).loose(),lQ=y({op:i([`sync`,`push`,`pull`]).optional()}).loose(),uQ=y({op:i([`sync`,`push`,`pull`])}).loose(),dQ=y({conflicts:D(y({file:b().min(1),detectedAt:b().min(1),oursSha:b().optional(),theirsSha:b().optional(),baseSha:b().optional()}).loose())}).loose(),fQ=y({file:b().min(1),strategy:i([`mine`,`theirs`,`content`,`delete`]),content:b().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`]}),pQ=y({}).loose(),mQ=y({file:b().min(1),base:b(),ours:b(),theirs:b(),kind:i([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:b().nullable()}).loose(),hQ=y({plan:S(e=>e!==void 0,{message:`plan is required`})}).loose(),gQ=y({plan:S(e=>e!==void 0,{message:`plan is required`})}).loose(),_Q=y({result:S(e=>e!==void 0,{message:`result is required`})}).loose(),vQ=y({path:b().min(1),summary:b().min(1)}).loose(),yQ=y({files:_().int().nonnegative(),folders:_().int().nonnegative()}).loose(),bQ=y({packs:D(y({id:b().min(1),name:b().min(1),description:b().min(1),defaultSubfolder:b().optional(),folders:D(vQ),entryCounts:yQ}).loose())}).loose(),xQ=y({noOpen:k().optional(),out:b().min(1).optional()}).loose(),SQ=y({reason:i([`unsupported-platform`,`spawn-error`]),message:b()}).loose(),CQ=m(`status`,[y({status:T(`installed`),outputPath:b(),size:_().int().nonnegative(),sha256:b(),skillVersion:b()}).loose(),y({status:T(`built`),outputPath:b(),size:_().int().nonnegative(),sha256:b(),skillVersion:b(),handoffError:SQ.optional()}).loose(),y({status:T(`failed`),buildError:b()}).loose(),y({status:T(`skip-current`),skillVersion:b(),recordedAt:b().optional()}).loose()]),wQ=i(St);function TQ(e){return e===`agents`||St.includes(e)}const EQ=y({tags:D(y({name:b().min(1),count:_().int().nonnegative(),isLeaf:k()}).loose())}).loose(),DQ=y({docName:b().min(1),title:b(),matchingTags:D(b().min(1)),snippet:b().nullable()}).loose(),OQ=y({name:b().min(1),docs:D(DQ)}).loose(),kQ=y({folder:te(),frontmatter_local:x(b(),te()).nullable()}).loose(),AQ=y({path:b(),frontmatter:x(b(),te()).optional()}).loose(),jQ=y({applied:te()}).loose(),MQ=x(b(),te()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),NQ=y({template:y({name:b().min(1),folder:b(),scope:i([`local`,`inherited`]),path:b().min(1),frontmatter:MQ,body:b()}).strict()}).strict(),PQ=y({templates:D(y({name:b().min(1),title:b().optional(),description:b().optional(),path:b().min(1),source_folder:b()}).strict()),truncated:k()}).strict(),FQ=y({folder:b(),name:b(),body:b().optional(),frontmatter:MQ.optional(),...zy,summary:By}).strict(),IQ=y({path:b().min(1),created:k(),warnings:D(b())}).strict(),LQ=y({sourcePath:b().min(1),targetFolder:b(),name:b().optional(),title:b().optional(),deleteSource:k().optional(),...zy,summary:By}).strict(),RQ=y({path:b().min(1),created:k(),warnings:D(b())}).strict(),zQ=y({existed:k(),path:b().min(1)}).strict(),BQ=y({fromFolder:b(),fromName:b(),toFolder:b(),toName:b(),body:b().optional(),frontmatter:MQ.optional(),...zy,summary:By}).strict(),VQ=y({from:b().min(1),to:b().min(1),committed:k()}).strict(),HQ=i(Xe),UQ=/^[a-z0-9-]+$/,WQ=/<\/?[A-Za-z][^>]*>/;function GQ(e){return WQ.test(e)}const KQ=/^[A-Za-z0-9_-]+$/,qQ=y({name:b(),description:b()}).strict(),JQ=y({skill:y({name:b().min(1),scope:HQ,path:b().min(1),frontmatter:qQ,body:b(),files:D(y({path:b().min(1),text:b().nullable()})).optional(),managed:k().optional()}).strict()}).strict(),YQ=y({source:b().min(1),publisher:b().optional(),skill:b().optional(),marketplaceUrl:b().optional(),importedAt:b().min(1),autoUpdate:k().optional()}).strict(),XQ=y({skills:D(y({name:b().min(1),description:b().optional(),scope:HQ,path:b().min(1),absolutePath:b().min(1).optional(),installed:k(),hosts:D(b()),driftPaths:D(b()).optional().meta({description:`Recorded locations whose on-disk form (copy vs symlink) no longer matches what OK last wrote there — evidence another tool rewrote the path.`}),hostAliases:x(b(),b()).optional().meta({description:`Host skills roots that are symlink ALIASES of another location (host id → base-relative target root). An aliased folder is a derived view — no menu row, never a write target; the host's icon rides the target root's row.`}),conflictHosts:D(b()).optional().meta({description:`Hosts whose dir holds a DIFFERENT same-name skill (fork/conflict) — occupied, not this skill.`}),symlinkedHosts:D(b()).optional(),installableEditors:D(b()).optional(),linkMode:k().optional(),customPlacements:D(y({path:b(),mode:i([`copy`,`link`])}).strict()).optional(),managed:k().optional(),origin:YQ.optional(),modified:k().optional(),revertable:k().optional()}).strict()),truncated:k()}).strict(),ZQ=y({scope:HQ.default(`project`),name:b().meta({description:`Managed skill name to create or update.`}),body:b().optional(),frontmatter:qQ,...zy,summary:By}).strict(),QQ=y({path:b().min(1),created:k(),warnings:D(b())}).strict(),$Q=y({scope:HQ.default(`project`),name:b(),dryRun:k().optional(),setAutoUpdate:k().optional(),...zy,summary:By}).strict(),e$=y({name:b().min(1),updated:k(),source:b().min(1),localBody:b().optional(),upstreamBody:b().optional(),gitTracked:k().optional(),warnings:D(b())}).strict(),t$=y({scope:HQ.default(`project`),name:b(),...zy,summary:By}).strict(),n$=y({name:b().min(1),baselineRef:b().min(1),restoredFiles:D(b()),warnings:D(b())}).strict(),r$=y({existed:k(),path:b().min(1)}).strict(),i$=y({scope:HQ.default(`project`),fromName:b(),toName:b(),body:b().optional(),frontmatter:qQ.optional(),...zy,summary:By}).strict(),a$=y({from:b().min(1),to:b().min(1),committed:k()}).strict(),o$=y({name:b(),fromScope:HQ,toScope:HQ,...zy,summary:By}).strict(),s$=y({scope:HQ,path:b().optional()}).strict(),c$=y({scope:HQ,name:b(),toName:b(),...zy,summary:By}).strict(),l$=y({name:b().min(1)}).strict(),u$=y({name:b(),home:b().min(1)}).strict(),d$=y({docName:b().min(1)}).strict(),f$=i([`reference`,`script`,`file`]),p$=y({scope:HQ.default(`project`),name:b(),path:b().min(1),content:b(),...zy,summary:By}).strict(),m$=y({path:b().min(1),created:k(),kind:f$,content:k()}).strict(),h$=y({scope:HQ.default(`project`),name:b(),from:b().min(1),to:b().min(1),...zy,summary:By}).strict(),g$=y({from:b().min(1),to:b().min(1),fromDocName:b().optional(),toDocName:b().optional()}).strict(),_$=y({path:b().min(1),kind:f$,text:b()}).strict(),v$=y({path:b().min(1),existed:k(),kind:f$}).strict(),y$=p([wQ,T(`agents`)]),b$=b().min(1).refine(e=>!e.startsWith(`/`)&&!e.startsWith(`~`)&&!/^[A-Za-z]:/.test(e),{error:`a custom root is base-relative (e.g. ".tim/skills"), not absolute or ~-prefixed`}).refine(e=>e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{error:`a custom root may not contain "..", "." or empty path segments`}).refine(e=>e.includes(`/`),{error:`a custom root is a path (e.g. ".tim/skills") — bare editor names are host ids`}),x$=p([y$,b$]),S$=y({scope:HQ.default(`project`),name:b(),targets:D(y$).optional().meta({description:'SET-EXACT install targets (editor ids, plus "agents" for the .agents hub — in-place skills only): the COMPLETE resulting host set. Omit to use project-configured editors; pass [] to uninstall everywhere. Stateless callers should prefer `add`/`remove`.'}),add:D(x$).optional().meta({description:`Locations to ADD the skill to (everything else untouched). Editor ids fan out a managed copy/symlink; a custom root path (".tim/skills") places the bundle there.`}),remove:D(x$).optional().meta({description:"Locations to REMOVE the skill from (lossless only — a hand-edited fork is refused, never deleted). The source cannot be removed; move it first with `source`."}),mode:i([`copy`,`link`]).optional().meta({description:`"link": one real folder (the source); every other location becomes a symlink to it. "copy": independent real folders, refreshed from the source until hand-edited (a hand-edit forks that copy). Converts existing locations losslessly. Omit to follow the form the skill already uses.`}),source:x$.optional().meta({description:`Move the skill's REAL folder to this location (the old source becomes a symlink to it — never a removal). Sticky across rescans.`}),linkMode:k().optional(),setSource:b().min(1).optional(),place:y({dir:b().min(1).meta({description:`Project-relative directory the bundle dir is created under (e.g. ".windsurf/skills").`}),mode:i([`copy`,`link`])}).strict().optional(),convert:y({target:x$.meta({description:`The installed location to convert — an editor id, "agents", or a recorded custom placement path.`}),mode:i([`copy`,`link`]).meta({description:`"link": replace this location with a symlink to the source. "copy": replace it with an independent real folder.`})}).strict().optional(),unplace:y({path:b().min(1).meta({description:`The recorded placement bundle path (e.g. ".windsurf/skills/my-skill").`})}).strict().optional(),...zy,summary:By,fork:y({editor:b().min(1),action:i([`align`,`make-source`,`rename`]),toName:b().optional()}).strict().optional()}).strict().refine(e=>!(e.targets!==void 0&&(e.add!==void 0||e.remove!==void 0)),{error:"`targets` is set-exact; `add`/`remove` are additive — use one style per call"}).refine(e=>e.fork===void 0||e.targets===void 0&&e.add===void 0&&e.remove===void 0&&e.source===void 0&&e.setSource===void 0,{error:"`fork` is its own operation — run it in a separate call"}).refine(e=>e.fork?.action!==`rename`||e.fork.toName!==void 0,{error:"`fork.rename` requires `toName`"}).refine(e=>!(e.source!==void 0&&(e.add!==void 0||e.remove!==void 0)),{error:"a `source` move is its own operation — run it in a separate call from `add`/`remove`"}).refine(e=>[e.targets!==void 0||e.add!==void 0||e.remove!==void 0,e.place!==void 0,e.unplace!==void 0,e.convert!==void 0,e.source!==void 0||e.setSource!==void 0,e.fork!==void 0].filter(Boolean).length<=1,{error:"one operation per call — membership (`targets`/`add`/`remove`), `place`, `unplace`, `convert`, `source`, and `fork` are mutually exclusive"}),C$=[`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`],w$=y({name:b().min(1).meta({description:`Managed skill name installed or uninstalled.`}),hosts:D(b()).meta({description:`Editor ids the skill is projected into after the operation; [] is expected after uninstall.`}),scripts:k().meta({description:`True when the skill ships executable scripts, projected but never run.`}),warnings:D(b()).meta({description:`Non-fatal install/uninstall warnings from target projection.`}),warningCodes:D(i(C$)).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:b().optional(),sourceMovedTo:b().optional()}).strict(),T$=y({scope:HQ.default(`project`),name:b().meta({description:`Managed skill name to uninstall without deleting source.`})}).strict(),E$=y({name:b().min(1).meta({description:`Managed skill name requested for uninstall.`}),uninstalled:k().meta({description:`True when an install marker existed and was removed; false for an idempotent no-op.`})}).strict(),D$=y({targets:D(wQ),configured:k(),folders:D(y({scope:HQ,host:b(),root:b(),state:i([`own`,`linked`,`linked-parent`,`absent`]),target:b().optional(),drift:T(!0).optional(),expected:b().optional()}).strict()).optional()}).strict(),O$=m(`action`,[y({action:T(`link`),scope:HQ,root:b().min(1).meta({description:`The folder to link (e.g. ".codex/skills").`}),target:b().min(1).meta({description:`The root it merges into (e.g. ".agents/skills"). Required.`})}).strict(),y({action:T(`unlink`),scope:HQ,root:b().min(1).meta({description:`The linked folder to materialize back.`}),exclude:D(b().min(1)).optional().meta({description:`Skill names to LEAVE OUT when materializing — the folder keeps every other skill it currently sees (as per-skill links) and stops auto-following the target root.`})}).strict(),y({action:T(`add-root`),scope:HQ,root:b$.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict()]),k$=y({folderAction:O$}).strict(),A$=y({targets:D(wQ),reprojected:D(y({name:b(),hosts:D(b())}).strict()),bundleHosts:D(b()),removedFrom:D(b()),folder:y({moved:D(b()),dropped:D(b()),linked:D(b())}).strict().optional()}).strict(),j$=y({scope:HQ.default(`project`),name:b(),version:b().regex(/^[0-9a-f]{40}$/i),...zy,summary:By}).strict(),M$=y({name:b().min(1),version:b(),restoredFiles:D(b()),warnings:D(b())}).strict(),N$=y({query:b().optional(),intent:i([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:i([`navigation`,`relevance`]).optional(),scopes:D(i([`page`,`folder`,`content`,`file`])).optional(),scope:b().optional(),limit:_().int().nonnegative().optional(),semantic:k().optional(),source:i([`omnibar`,`mcp`,`http`]).optional()}).loose(),P$=y({kind:i([`page`,`folder`,`content`,`file`]),path:b().min(1),title:b(),score:_(),signals:x(b(),te()),snippet:b().optional()}).loose(),F$=y({capable:k(),applied:k(),coverage:y({embedded:_().int().nonnegative(),total:_().int().nonnegative()})}).loose(),I$=y({enabled:k(),keyPresent:k(),keyNotRequired:k(),keySource:i([`project`,`file`,`env`]).nullable(),keyHint:b().nullable(),ready:k(),capable:k(),embedded:_().int().nonnegative(),total:_().int().nonnegative()}).loose(),L$=y({query:b(),intent:i([`autocomplete`,`full_text`,`omnibar`]),results:D(P$),elapsedMs:_().nonnegative(),semantic:F$.optional(),truncated:k().optional(),ready:k().optional()}).loose(),R$=y({version:b().min(1),recordedAt:b().min(1)}).loose(),z$=y({currentVersion:b().min(1),targets:x(b(),R$.nullable())}).loose(),B$=y({scope:HQ.default(`project`),source:b().min(1).meta({description:`External skill source: full skills.sh skill-page URL (https://www.skills.sh/<owner>/<repo>/<skill>, or https://www.skills.sh/site/<hostname>/<skill> for a website catalog), GitHub owner/repo[/subpath], git URL, or local/file path.`}),skill:b().min(1).optional().meta({description:`Specific skill name to import from a multi-skill source.`}),install:k().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection (the caller installs explicitly afterwards). Default true.`}),...zy,summary:By}).strict(),V$=y({scope:HQ.default(`project`),source:b().min(1).meta({description:`External skill source: full skills.sh skill-page URL, GitHub owner/repo[/subpath], git URL, or local/file path.`}),skills:D(b().min(1)).min(1).max(100).meta({description:`Skill names to import from the source.`}),install:k().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection. Default true.`}),...zy,summary:By}).strict(),H$=y({results:D(y({requested:b(),status:i([`imported`,`already-imported`,`not-found`,`failed`]),name:b().optional(),collisionRenamedFrom:b().optional(),warnings:D(b()),error:b().optional()}).loose()),imported:_(),alreadyImported:_(),failed:_()}).loose(),U$=y({source:b(),ref:b().optional(),contentHash:b(),publisher:b().optional()}).loose(),W$=y({name:b().min(1).meta({description:`Managed skill name created or matched.`}),path:b().min(1).meta({description:`Store-relative path to the imported skill source.`}),created:k().meta({description:`True when this request created new source files.`}),alreadyImported:k().meta({description:`True when identical content was already present and no files changed.`}),collisionRenamedFrom:b().optional().meta({description:`Original source name when collision handling renamed the import.`}),provenance:U$,warnings:D(b()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`})}).loose(),G$=`server-info`,K$=`branch-switched`,q$=`disk-ack`,J$=`config-validation-rejected`,Y$=`config-ignore-nested-error`,X$=i([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`,`comments`,`lint-config`]),Z$=y({v:T(1),ch:T(G$),seq:_(),serverInstanceId:b().min(1),currentBranch:b().min(1).optional()}).loose(),Q$=y({v:T(1),ch:T(K$),seq:_(),branch:b().min(1)}).loose(),$$=y({v:T(1),ch:X$,seq:_()}).loose(),e1=y({v:T(1),ch:T(q$),seq:_(),docName:b().min(1),sv:b().min(1)}).loose(),t1=y({v:T(1),ch:T(J$),seq:_(),docName:b().min(1),error:h}).loose(),n1=y({v:T(1),ch:T(Y$),seq:_(),path:b().min(1),error:b().min(1)}).loose();function r1(e){let t=e?.trim();return t===void 0||t===``?void 0:t}function i1(e){return e.reason!==void 0||r1(e.note)!==void 0||r1(e.email)!==void 0}function a1(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol===`https:`)return t;let n=t.hostname===`localhost`||t.hostname===`127.0.0.1`||t.hostname===`[::1]`;return t.protocol===`http:`&&n?t:null}function o1(){return a1((typeof process>`u`?void 0:r1(process.env?.OK_FEEDBACK_INTAKE_ORIGIN))??`https://openknowledge.ai`)}function s1(e){let t=r1(e);if(t!==void 0)return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)?t:void 0}async function c1(e,t,n){try{let r=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t),signal:AbortSignal.timeout(n)});if(r.ok){let e=await r.json().catch(()=>null);return{ok:!0,reference:typeof e?.reference==`string`?e.reference:``}}return r.status===400||r.status===413?{ok:!1,reason:`invalid`}:r.status===503?{ok:!1,reason:`unavailable`}:{ok:!1,reason:`error`}}catch(e){return{ok:!1,reason:e instanceof Error&&(e.name===`TimeoutError`||e.name===`AbortError`)?`timeout`:`error`}}}async function l1(e,t={}){let n=o1();if(n===null)return{ok:!1,reason:`error`};let r=new URL(`/api/feedback`,n),i=r1(e.note),a=s1(e.email),o={kind:`uninstall`,reasons:e.reason===void 0?[]:[e.reason],...i===void 0?{}:{message:i},appVersion:e.appVersion,platform:e.platform,source:e.source},s=Date.now()+(t.timeoutMs??4e3),c=()=>s-Date.now();if(a===void 0)return c1(r,o,c());let l=await c1(r,{...o,email:a},c());return l.ok||l.reason!==`invalid`||c()<=0?l:c1(r,o,c())}var u1=t(r(((e,t)=>{var n=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},r=-1,i=1,a=0;n.Diff=function(e,t){return[e,t]},n.prototype.diff_main=function(e,t,r,i){i===void 0&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:new Date().getTime()+this.Diff_Timeout*1e3);var o=i;if(e==null||t==null)throw Error(`Null input. (diff_main)`);if(e==t)return e?[new n.Diff(a,e)]:[];r===void 0&&(r=!0);var s=r,c=this.diff_commonPrefix(e,t),l=e.substring(0,c);e=e.substring(c),t=t.substring(c),c=this.diff_commonSuffix(e,t);var u=e.substring(e.length-c);e=e.substring(0,e.length-c),t=t.substring(0,t.length-c);var d=this.diff_compute_(e,t,s,o);return l&&d.unshift(new n.Diff(a,l)),u&&d.push(new n.Diff(a,u)),this.diff_cleanupMerge(d),d},n.prototype.diff_compute_=function(e,t,o,s){var c;if(!e)return[new n.Diff(i,t)];if(!t)return[new n.Diff(r,e)];var l=e.length>t.length?e:t,u=e.length>t.length?t:e,d=l.indexOf(u);if(d!=-1)return c=[new n.Diff(i,l.substring(0,d)),new n.Diff(a,u),new n.Diff(i,l.substring(d+u.length))],e.length>t.length&&(c[0][0]=c[2][0]=r),c;if(u.length==1)return[new n.Diff(r,e),new n.Diff(i,t)];var f=this.diff_halfMatch_(e,t);if(f){var p=f[0],m=f[1],h=f[2],g=f[3],_=f[4],v=this.diff_main(p,h,o,s),y=this.diff_main(m,g,o,s);return v.concat([new n.Diff(a,_)],y)}return o&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,s):this.diff_bisect_(e,t,s)},n.prototype.diff_lineMode_=function(e,t,o){var s=this.diff_linesToChars_(e,t);e=s.chars1,t=s.chars2;var c=s.lineArray,l=this.diff_main(e,t,!1,o);this.diff_charsToLines_(l,c),this.diff_cleanupSemantic(l),l.push(new n.Diff(a,``));for(var u=0,d=0,f=0,p=``,m=``;u<l.length;){switch(l[u][0]){case i:f++,m+=l[u][1];break;case r:d++,p+=l[u][1];break;case a:if(d>=1&&f>=1){l.splice(u-d-f,d+f),u=u-d-f;for(var h=this.diff_main(p,m,!1,o),g=h.length-1;g>=0;g--)l.splice(u,0,h[g]);u+=h.length}f=0,d=0,p=``,m=``;break}u++}return l.pop(),l},n.prototype.diff_bisect_=function(e,t,a){for(var o=e.length,s=t.length,c=Math.ceil((o+s)/2),l=c,u=2*c,d=Array(u),f=Array(u),p=0;p<u;p++)d[p]=-1,f[p]=-1;d[l+1]=0,f[l+1]=0;for(var m=o-s,h=m%2!=0,g=0,_=0,v=0,y=0,b=0;b<c&&!(new Date().getTime()>a);b++){for(var x=-b+g;x<=b-_;x+=2){for(var S=l+x,C=x==-b||x!=b&&d[S-1]<d[S+1]?d[S+1]:d[S-1]+1,w=C-x;C<o&&w<s&&e.charAt(C)==t.charAt(w);)C++,w++;if(d[S]=C,C>o)_+=2;else if(w>s)g+=2;else if(h){var T=l+m-x;if(T>=0&&T<u&&f[T]!=-1){var E=o-f[T];if(C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}for(var D=-b+v;D<=b-y;D+=2){for(var T=l+D,E=D==-b||D!=b&&f[T-1]<f[T+1]?f[T+1]:f[T-1]+1,O=E-D;E<o&&O<s&&e.charAt(o-E-1)==t.charAt(s-O-1);)E++,O++;if(f[T]=E,E>o)y+=2;else if(O>s)v+=2;else if(!h){var S=l+m-D;if(S>=0&&S<u&&d[S]!=-1){var C=d[S],w=l+C-S;if(E=o-E,C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}}return[new n.Diff(r,e),new n.Diff(i,t)]},n.prototype.diff_bisectSplit_=function(e,t,n,r,i){var a=e.substring(0,n),o=t.substring(0,r),s=e.substring(n),c=t.substring(r),l=this.diff_main(a,o,!1,i),u=this.diff_main(s,c,!1,i);return l.concat(u)},n.prototype.diff_linesToChars_=function(e,t){var n=[],r={};n[0]=``;function i(e){for(var t=``,i=0,o=-1,s=n.length;o<e.length-1;){o=e.indexOf(`
|
|
291
|
+
`)}const PY=[`text`,`number`,`boolean`,`date`,`list`,`object`];i(PY);const FY=p([b(),_(),k()]),IY=g(()=>p([FY.transform(e=>String(e)),x(b(),LY),D(IY)])),LY=g(()=>p([b(),_(),k(),D(IY),x(b(),LY)]));function RY(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(RY(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:RY(r);return t}return e}const zY=E(RY,x(b(),LY));x(b(),p([LY,v()]));function BY(e){return!!(e===null||typeof e==`string`&&e===``||Array.isArray(e)&&e.length===0)}const VY=y({docName:Ly,summary:By,content:b().optional(),...zy}).loose(),HY=y({docName:Ly,summary:By,markdown:b(),position:i([`append`,`prepend`,`replace`]).optional(),extension:i(ht).optional(),...zy}).loose(),UY=y({docName:Ly,summary:By,find:b().min(1),replace:b(),offset:_().int().nonnegative().optional(),...zy}).loose(),WY=y({docName:Ly,connectionId:b().min(1),scope:i([`last`,`session`,`file`,`count`]).optional(),count:_().int().positive().optional(),...zy}).loose().refine(e=>e.scope!==`count`||e.count!==void 0,{message:`count is required when scope is 'count'`,path:[`count`]}),GY=y({value:b(),truncatedFrom:_().int().nonnegative().optional(),hint:b().optional()}).loose(),KY=m(`kind`,[y({kind:T(`inline`),content:b()}),y({kind:T(`truncated`),byteLength:_().int().nonnegative(),hint:b()})]),qY=y({kind:T(`content-divergence`),intendedBytes:_().int().nonnegative(),actualBytes:_().int().nonnegative(),byteDelta:_().int(),divergenceType:b().optional(),currentState:KY.optional(),hint:b().optional()}).loose(),JY=y({type:T(`orphan`),parentCandidates:D(b()),message:b()}).loose(),YY=y({kind:T(`disk-edit-reconciled`),intendedBytes:_().int().nonnegative(),actualBytes:_().int().nonnegative(),byteDelta:_().int(),mergeOutcome:b().optional(),hint:b().optional()}).loose(),XY=m(`kind`,[qY,YY]),ZY=m(`kind`,[qY,YY,y({kind:T(`mermaid-parse-error`),fenceIndex:_().int().positive(),fenceFirstLine:b(),message:b(),line:_().int().positive().optional()}).loose(),y({kind:T(`lint-violation`),source:b(),code:b(),message:b(),severity:i([`error`,`warning`,`info`,`hint`]),line:_().int().positive(),column:_().int().positive(),linkTarget:b().optional()}).loose()]),QY=D(ZY).min(1),$Y=y({href:b(),resolvedTo:b().nullable(),reason:i([`no-such-doc`,`no-such-file`,`unresolvable`])}).loose(),eX=D($Y),tX=y({timestamp:b().min(1),summary:GY.optional(),warning:XY.optional(),warnings:QY.optional()}).loose(),nX=y({timestamp:b().min(1),subscriberCount:_().int().nonnegative(),systemSubscriberCount:_().int().nonnegative(),hints:D(JY).optional(),summary:GY.optional(),warning:XY.optional(),warnings:QY.optional(),brokenLinks:eX}).loose(),rX=y({timestamp:b().min(1),subscriberCount:_().int().nonnegative(),systemSubscriberCount:_().int().nonnegative(),summary:GY.optional(),warning:XY.optional(),warnings:QY.optional(),brokenLinks:eX}).loose(),iX=y({docName:b().min(1),scope:i([`last`,`session`,`count`]),undone:k()}).loose(),aX=y({docs:D(y({docName:Ry,markdown:b(),position:i([`append`,`prepend`,`replace`]).optional(),extension:i(ht).optional(),summary:By}).loose()).min(1).max(100),...zy}).loose(),oX=y({type:Sb,title:b(),detail:b().optional()}).loose(),sX=m(`status`,[y({status:T(`written`),docName:b().min(1),summary:GY.optional(),warnings:QY.optional(),brokenLinks:eX}).loose(),y({status:T(`error`),docName:b().min(1),error:oX}).loose()]),cX=y({timestamp:b().min(1),results:D(sX),written:_().int().nonnegative(),failed:_().int().nonnegative()}).loose(),lX=y({docName:Ly,patch:x(b(),p([LY,v()])),types:x(b(),i(PY)).optional(),summary:By,...zy}).loose(),uX=y({timestamp:b().min(1),subscriberCount:_().int().nonnegative(),systemSubscriberCount:_().int().nonnegative(),appliedKeys:D(b()),summary:GY.optional(),warning:XY.optional(),warnings:QY.optional(),brokenLinks:eX}).loose(),dX=y({entries:D(y({level:i([`info`,`warn`,`error`]),message:b().max(8192),event:b().optional(),fields:x(b(),te()).optional(),ts:_().optional(),sourceId:b().optional(),lineNumber:_().optional()}).loose()).max(100),droppedSinceLastFlush:_().int().min(0).optional()}).loose(),fX=y({accepted:_().int().min(0)}).loose(),pX=y({exact:b().min(1),prefix:b(),suffix:b(),start:_().int().nonnegative(),end:_().int().nonnegative()}),mX=D(p([b(),_().int().nonnegative()])),hX=m(`kind`,[y({kind:T(`body`)}),y({kind:T(`property`),key:b().min(1),path:mX.default([])})]).default({kind:`body`}),gX=i([`anchored`,`orphaned`,`resolved`]),_X=y({threadId:b().min(1),docName:b().min(1),target:hX,anchor:pX.nullable(),state:gX,queued:k(),latestComment:b(),createdBy:b().min(1),createdAt:_()}),vX=y({docName:b(),instruction:b(),property:b().nullable(),passage:y({exact:b(),prefix:b(),suffix:b()}).nullable(),anchorLost:k(),passageRepeats:k()}).loose(),yX=y({threadId:b(),ok:T(!0)}),bX=y({threadId:b(),ok:T(!1),error:T(`not-found`)}),xX=y({threads:D(_X)}).loose(),SX=y({meta:_X,orphaned:k()}).loose(),CX=y({threadId:b()}).loose(),wX=y({meta:_X,payload:vX}).loose(),TX=y({results:D(p([yX.extend({meta:_X,payload:vX}),bX]))}).loose(),EX=y({results:D(p([yX.extend({meta:_X}),bX]))}).loose(),DX=y({status:b().min(1),reason:b()}).loose(),OX=y({docName:b().min(1),content:b(),lifecycle:DX.nullable()}).loose(),kX=y({documents:D(y({kind:i([`document`,`asset`,`folder`,`file`]).default(`document`),docName:b().min(1).optional(),docExt:b().min(1).default(`.md`),size:_().int().nonnegative(),modified:b().min(1),isSymlink:k().default(!1),canonicalDocName:b().nullable().default(null),targetPath:b().nullable().default(null),path:b().min(1).optional(),assetExt:b().min(1).optional(),mediaKind:i([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`]).nullable().optional(),referencedBy:D(b().min(1)).optional(),hasChildren:k().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:k().optional()}).loose(),AX=y({source:b().min(1),anchor:b().nullable(),title:b(),snippet:b().nullable()}).loose(),jX=y({docName:b().min(1),backlinks:D(AX)}).loose(),MX=y({counts:x(b().min(1),_().int().nonnegative())}).loose(),NX=y({counts:x(b().min(1),_().int().nonnegative())}).loose(),PX=m(`kind`,[y({kind:T(`doc`),docName:b().min(1),anchor:b().nullable(),title:b(),snippet:b().nullable()}).loose(),y({kind:T(`external`),url:b().min(1),title:b(),snippet:b().nullable()}).loose()]),FX=y({docName:b().min(1),forwardLinks:D(PX)}).loose(),IX=m(`kind`,[y({id:b().min(1),kind:T(`doc`),docName:b().min(1),anchor:b().nullable(),label:b(),cluster:b().nullable(),category:b().nullable(),tags:D(b()).nullable()}).loose(),y({id:b().min(1),kind:T(`external`),url:b().min(1),label:b()}).loose()]),LX=y({source:b().min(1),target:b().min(1)}).loose(),RX=y({nodes:D(IX),links:D(LX)}).loose(),zX=y({ts:_().int().min(0),url:b(),method:b(),ua:b().optional(),origin:b().optional(),referer:b().optional(),host:b().optional(),remote:b().optional(),secChUa:b().optional(),secChUaMobile:b().optional(),secChUaPlatform:b().optional(),secFetchSite:b().optional(),secFetchDest:b().optional(),secFetchMode:b().optional(),secFetchUser:b().optional()}).loose(),BX=y({app:p([T(`cursor`),T(`codex`),T(`claude`),v()]),signals_fired:D(b())}).loose(),VX=y({entries:D(zX),count:_().int().min(0),detection:BX}).loose(),HX=y({writers:D(y({id:b().min(1),name:b().optional(),email:b().optional()}).loose()).optional(),summary:By,...zy}).loose(),UX=y({checkpointRef:b().min(1)}).loose(),WX=y({v:_().int().optional(),id:b().min(1),name:b().min(1),colorSeed:b().optional(),docs:D(b()),summaries:D(b()).optional()}).loose(),GX=y({entries:D(y({sha:b().min(1),timestamp:b().min(1),author:b(),authorEmail:b(),type:i([`checkpoint`,`wip`,`upstream`,`park`]),message:b(),contributors:D(WX),checkpoint:te().nullable(),parentSha:b().nullable().optional()}).loose()),total:_().int().nonnegative().optional(),truncated:k().optional(),hasMore:k().optional()}).loose(),KX=y({sha:b().regex(/^[0-9a-f]{40}$/i),content:b(),timestamp:b(),author:b()}).loose(),qX=y({contentDir:b().min(1),pathSeparator:i([`/`,`\\`]),symlinkResolved:k()}).loose(),JX=D(m(`source`,[y({docName:b().min(1),timestamp:b().min(1),size:_().int().nonnegative(),source:T(`flat`)}).loose(),y({docName:b().min(1),timestamp:b().min(1),source:T(`timeline`),sha:b().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),YX=y({domain:b().min(1),title:b().optional(),description:b().optional(),siteName:b().optional(),faviconDataUri:b().optional()}).loose(),XX=y({url:b()}).loose(),ZX=m(`ok`,[y({ok:T(!0),metadata:YX}).loose(),y({ok:T(!1),reason:b()}).loose()]),QX=y({orphans:D(y({docName:b().min(1),title:b()}).loose())}).loose(),$X=y({hubs:D(y({docName:b().min(1),title:b(),count:_().int().nonnegative()}).loose())}).loose(),eZ=y({source:b().min(1),title:b(),snippet:b().nullable()}).loose(),tZ=y({deadLinks:D(y({target:b().min(1),sources:D(eZ)}).loose())}).loose(),nZ=y({target:y({docName:b().min(1),title:b(),aliases:D(b())}).loose(),mentions:D(y({source:b().min(1),excerpt:b(),offset:_().int().nonnegative()}).loose()),truncated:k()}).loose(),rZ=y({projectPath:b().min(1)}).loose(),iZ=i([`not-a-git-worktree`,`init-failed`]),aZ=m(`ok`,[y({ok:T(!0),projectPath:b().min(1)}).loose(),y({ok:T(!1),reason:iZ,message:b().min(1)}).loose()]),oZ=y({host:b().min(1).optional()}).loose(),sZ=y({host:b().min(1).optional(),token:b().min(1)}).loose(),cZ=y({host:b(),login:b()}).loose(),lZ=y({key:b().min(1)}).loose(),uZ=y({keyPresent:k()}).loose(),dZ=i([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]),fZ=m(`ok`,[y({ok:T(!0),endpoint:b().min(1),model:b().min(1),dimensions:_().int().positive()}).loose(),y({ok:T(!1),endpoint:b().min(1),model:b().min(1),reason:dZ,status:_().int().optional()}).loose()]),pZ=y({name:b().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:b().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),mZ=y({authenticated:k()}).loose(),hZ=y({channel:i([`login`,`gh-login`]).default(`login`)}).loose(),gZ=y({}).loose(),_Z=y({stackIndex:_().int().min(0),ts:_().int().min(0),additions:_().int().min(0),deletions:_().int().min(0)}).loose(),vZ=y({docName:b().min(1),additionsTotal:_().int().min(0),deletionsTotal:_().int().min(0),lastTs:_().int().min(0),bursts:D(_Z)}).loose(),yZ=y({displayName:b().min(1),color:b().min(1),icon:b().optional(),connectionId:b().min(1)}).loose(),bZ=y({sessionAlive:k(),agent:yZ.nullable(),files:D(vZ)}).loose(),xZ=y({diff:b(),before:b(),after:b(),generatedAt:_().int().min(0)}).loose(),SZ=y({}).loose(),CZ=y({}).loose(),wZ=y({}).loose(),TZ=y({}).loose(),EZ=y({}).loose(),DZ=y({}).loose(),OZ=y({displayName:b().min(1),icon:b(),color:b().min(1),currentDoc:b().nullable(),mode:i([`idle`,`writing`]),ts:_().int().min(0)}).loose(),kZ=y({presence:x(b().min(1),OZ)}).loose(),AZ=y({sessionId:b().min(1),agentType:b().min(1),ts:_().int().min(0),insertedChars:_().int().min(0),deletedChars:_().int().min(0)}).loose(),jZ=y({effects:D(y({"doc.name":b().min(1),entries:D(AZ)}).loose())}).loose(),MZ=y({decisions:D(y({ts:_().int().min(0),decision:b().min(1),kind:b().min(1),"doc.name":b().min(1),pathRole:b().min(1)}).loose())}).loose(),NZ=x(b().min(1),k()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});y({path:b().min(1,`path must be non-empty`)}).loose();const PZ=y({}).loose(),FZ=y({fromDocName:b().min(1),toDocName:b().min(1)}).loose(),IZ=y({fromPath:b().min(1),toPath:b().min(1)}).loose(),LZ=y({}).loose(),RZ=y({path:b().min(1),...zy,summary:By}).loose(),zZ=y({docName:b().min(1)}).loose(),BZ=y({path:b().min(1),...zy,summary:By}).loose(),VZ=y({path:b().min(1)}).loose(),HZ=y({kind:i([`file`,`folder`]),path:b().min(1),...zy,summary:By}).loose(),UZ=y({kind:i([`file`,`folder`]),path:b().min(1),duplicatedDocNames:D(b().min(1))}).loose(),WZ=y({pages:D(y({docName:b().min(1),title:b(),docExt:b().min(1),size:_().int().nonnegative(),modified:b().min(1),icon:b().min(1).max(2048).optional()}).loose())}).loose(),GZ=y({level:_().int().min(1).max(6),text:b(),slug:b()}).loose(),KZ=y({docName:b().min(1),headings:D(GZ)}).loose(),qZ=y({docName:b().min(1),rewrites:_().int().nonnegative()}).loose(),JZ=y({kind:i([`file`,`folder`,`asset`]),fromPath:b().min(1),toPath:b().min(1),...zy,summary:By}).loose(),YZ=y({renamed:D(FZ),renamedAssets:D(IZ),rewrittenDocs:D(qZ).optional(),summary:GY.optional()}).loose(),XZ=y({kind:i([`file`,`folder`,`asset`]),path:b().min(1),...zy}).loose(),ZZ=y({deletedDocNames:D(b().min(1))}).loose(),QZ=y({kind:i([`file`,`folder`,`asset`]),path:b().min(1),...zy,summary:By}).loose(),$Z=y({deletedDocNames:D(b().min(1))}).loose(),eQ=y({docName:b().min(1),commitSha:b().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:By,...zy}).loose(),tQ=y({restoredFrom:b().min(1),timestamp:b().min(1),summary:GY.optional(),warning:qY.optional(),warnings:QY.optional()}).loose(),nQ=i([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),rQ=y({label:b().min(1),webUrl:re().nullable()}).loose(),iQ=m(`checkStatus`,[y({checkStatus:T(`allowed`)}).loose(),y({checkStatus:T(`denied`),deniedReason:i([`no-collaborator`,`private-no-access`,`repo-not-found`,`not-authenticated`])}).loose(),y({checkStatus:T(`unknown`),unknownError:i([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`,`ssh-unverified`]).optional()}).loose()]),aQ=i([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),oQ=i(o),sQ=i([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]),cQ=y({state:nQ,lastSyncUtc:b().nullable(),lastFetchUtc:b().nullable(),lastPushedSha:b().nullable(),ahead:_().int().min(0),behind:_().int().min(0),consecutiveFailures:_().int().min(0),conflictCount:_().int().min(0),hasRemote:k(),syncEnabled:k(),identityUnresolved:k(),remote:rQ.nullable().optional(),pushError:b().optional(),pushErrorCode:aQ.optional(),pullError:b().optional(),pullErrorCode:aQ.optional(),pausedReason:b().optional(),pushPermission:iQ.optional(),syncMode:oQ.optional(),lastPullUtc:b().nullable().optional(),lastPullOutcome:sQ.nullable().optional()}).loose(),lQ=y({op:i([`sync`,`push`,`pull`]).optional()}).loose(),uQ=y({op:i([`sync`,`push`,`pull`])}).loose(),dQ=y({conflicts:D(y({file:b().min(1),detectedAt:b().min(1),oursSha:b().optional(),theirsSha:b().optional(),baseSha:b().optional()}).loose())}).loose(),fQ=y({file:b().min(1),strategy:i([`mine`,`theirs`,`content`,`delete`]),content:b().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`]}),pQ=y({}).loose(),mQ=y({file:b().min(1),base:b(),ours:b(),theirs:b(),kind:i([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:b().nullable()}).loose(),hQ=y({plan:S(e=>e!==void 0,{message:`plan is required`})}).loose(),gQ=y({plan:S(e=>e!==void 0,{message:`plan is required`})}).loose(),_Q=y({result:S(e=>e!==void 0,{message:`result is required`})}).loose(),vQ=y({path:b().min(1),summary:b().min(1)}).loose(),yQ=y({files:_().int().nonnegative(),folders:_().int().nonnegative()}).loose(),bQ=y({packs:D(y({id:b().min(1),name:b().min(1),description:b().min(1),defaultSubfolder:b().optional(),folders:D(vQ),entryCounts:yQ}).loose())}).loose(),xQ=y({noOpen:k().optional(),out:b().min(1).optional()}).loose(),SQ=y({reason:i([`unsupported-platform`,`spawn-error`]),message:b()}).loose(),CQ=m(`status`,[y({status:T(`installed`),outputPath:b(),size:_().int().nonnegative(),sha256:b(),skillVersion:b()}).loose(),y({status:T(`built`),outputPath:b(),size:_().int().nonnegative(),sha256:b(),skillVersion:b(),handoffError:SQ.optional()}).loose(),y({status:T(`failed`),buildError:b()}).loose(),y({status:T(`skip-current`),skillVersion:b(),recordedAt:b().optional()}).loose()]),wQ=i(St);function TQ(e){return e===`agents`||St.includes(e)}const EQ=y({tags:D(y({name:b().min(1),count:_().int().nonnegative(),isLeaf:k()}).loose())}).loose(),DQ=y({docName:b().min(1),title:b(),matchingTags:D(b().min(1)),snippet:b().nullable()}).loose(),OQ=y({name:b().min(1),docs:D(DQ)}).loose(),kQ=y({folder:te(),frontmatter_local:x(b(),te()).nullable()}).loose(),AQ=y({path:b(),frontmatter:x(b(),te()).optional()}).loose(),jQ=y({applied:te()}).loose(),MQ=x(b(),te()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),NQ=y({template:y({name:b().min(1),folder:b(),scope:i([`local`,`inherited`]),path:b().min(1),frontmatter:MQ,body:b()}).strict()}).strict(),PQ=y({templates:D(y({name:b().min(1),title:b().optional(),description:b().optional(),path:b().min(1),source_folder:b()}).strict()),truncated:k()}).strict(),FQ=y({folder:b(),name:b(),body:b().optional(),frontmatter:MQ.optional(),...zy,summary:By}).strict(),IQ=y({path:b().min(1),created:k(),warnings:D(b())}).strict(),LQ=y({sourcePath:b().min(1),targetFolder:b(),name:b().optional(),title:b().optional(),deleteSource:k().optional(),...zy,summary:By}).strict(),RQ=y({path:b().min(1),created:k(),warnings:D(b())}).strict(),zQ=y({existed:k(),path:b().min(1)}).strict(),BQ=y({fromFolder:b(),fromName:b(),toFolder:b(),toName:b(),body:b().optional(),frontmatter:MQ.optional(),...zy,summary:By}).strict(),VQ=y({from:b().min(1),to:b().min(1),committed:k()}).strict(),HQ=i(Xe),UQ=/^[a-z0-9-]+$/,WQ=/<\/?[A-Za-z][^>]*>/;function GQ(e){return WQ.test(e)}const KQ=/^[A-Za-z0-9_-]+$/,qQ=y({name:b(),description:b()}).strict(),JQ=y({skill:y({name:b().min(1),scope:HQ,path:b().min(1),frontmatter:qQ,body:b(),files:D(y({path:b().min(1),text:b().nullable()})).optional(),managed:k().optional()}).strict()}).strict(),YQ=y({source:b().min(1),publisher:b().optional(),skill:b().optional(),marketplaceUrl:b().optional(),importedAt:b().min(1),autoUpdate:k().optional()}).strict(),XQ=y({skills:D(y({name:b().min(1),description:b().optional(),scope:HQ,path:b().min(1),absolutePath:b().min(1).optional(),installed:k(),hosts:D(b()),driftPaths:D(b()).optional().meta({description:`Recorded locations whose on-disk form (copy vs symlink) no longer matches what OK last wrote there — evidence another tool rewrote the path.`}),hostAliases:x(b(),b()).optional().meta({description:`Host skills roots that are symlink ALIASES of another location (host id → base-relative target root). An aliased folder is a derived view — no menu row, never a write target; the host's icon rides the target root's row.`}),conflictHosts:D(b()).optional().meta({description:`Hosts whose dir holds a DIFFERENT same-name skill (fork/conflict) — occupied, not this skill.`}),symlinkedHosts:D(b()).optional(),installableEditors:D(b()).optional(),linkMode:k().optional(),customPlacements:D(y({path:b(),mode:i([`copy`,`link`])}).strict()).optional(),managed:k().optional(),origin:YQ.optional(),modified:k().optional(),revertable:k().optional()}).strict()),truncated:k()}).strict(),ZQ=y({scope:HQ.default(`project`),name:b().meta({description:`Managed skill name to create or update.`}),body:b().optional(),frontmatter:qQ,...zy,summary:By}).strict(),QQ=y({path:b().min(1),created:k(),warnings:D(b())}).strict(),$Q=y({scope:HQ.default(`project`),name:b(),dryRun:k().optional(),setAutoUpdate:k().optional(),...zy,summary:By}).strict(),e$=y({name:b().min(1),updated:k(),source:b().min(1),localBody:b().optional(),upstreamBody:b().optional(),gitTracked:k().optional(),warnings:D(b())}).strict(),t$=y({scope:HQ.default(`project`),name:b(),...zy,summary:By}).strict(),n$=y({name:b().min(1),baselineRef:b().min(1),restoredFiles:D(b()),warnings:D(b())}).strict(),r$=y({existed:k(),path:b().min(1)}).strict(),i$=y({scope:HQ.default(`project`),fromName:b(),toName:b(),body:b().optional(),frontmatter:qQ.optional(),...zy,summary:By}).strict(),a$=y({from:b().min(1),to:b().min(1),committed:k()}).strict(),o$=y({name:b(),fromScope:HQ,toScope:HQ,...zy,summary:By}).strict(),s$=y({scope:HQ,path:b().optional()}).strict(),c$=y({scope:HQ,name:b(),toName:b(),...zy,summary:By}).strict(),l$=y({name:b().min(1)}).strict(),u$=y({name:b(),home:b().min(1)}).strict(),d$=y({docName:b().min(1)}).strict(),f$=i([`reference`,`script`,`file`]),p$=y({scope:HQ.default(`project`),name:b(),path:b().min(1),content:b(),...zy,summary:By}).strict(),m$=y({path:b().min(1),created:k(),kind:f$,content:k()}).strict(),h$=y({scope:HQ.default(`project`),name:b(),from:b().min(1),to:b().min(1),...zy,summary:By}).strict(),g$=y({from:b().min(1),to:b().min(1),fromDocName:b().optional(),toDocName:b().optional()}).strict(),_$=y({path:b().min(1),kind:f$,text:b()}).strict(),v$=y({path:b().min(1),existed:k(),kind:f$}).strict(),y$=p([wQ,T(`agents`)]),b$=b().min(1).refine(e=>!e.startsWith(`/`)&&!e.startsWith(`~`)&&!/^[A-Za-z]:/.test(e),{error:`a custom root is base-relative (e.g. ".tim/skills"), not absolute or ~-prefixed`}).refine(e=>e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{error:`a custom root may not contain "..", "." or empty path segments`}).refine(e=>e.includes(`/`),{error:`a custom root is a path (e.g. ".tim/skills") — bare editor names are host ids`}),x$=p([y$,b$]),S$=y({scope:HQ.default(`project`),name:b(),targets:D(y$).optional().meta({description:'SET-EXACT install targets (editor ids, plus "agents" for the .agents hub — in-place skills only): the COMPLETE resulting host set. Omit to use project-configured editors; pass [] to uninstall everywhere. Stateless callers should prefer `add`/`remove`.'}),add:D(x$).optional().meta({description:`Locations to ADD the skill to (everything else untouched). Editor ids fan out a managed copy/symlink; a custom root path (".tim/skills") places the bundle there.`}),remove:D(x$).optional().meta({description:"Locations to REMOVE the skill from (lossless only — a hand-edited fork is refused, never deleted). The source cannot be removed; move it first with `source`."}),mode:i([`copy`,`link`]).optional().meta({description:`"link": one real folder (the source); every other location becomes a symlink to it. "copy": independent real folders, refreshed from the source until hand-edited (a hand-edit forks that copy). Converts existing locations losslessly. Omit to follow the form the skill already uses.`}),source:x$.optional().meta({description:`Move the skill's REAL folder to this location (the old source becomes a symlink to it — never a removal). Sticky across rescans.`}),linkMode:k().optional(),setSource:b().min(1).optional(),place:y({dir:b().min(1).meta({description:`Project-relative directory the bundle dir is created under (e.g. ".windsurf/skills").`}),mode:i([`copy`,`link`])}).strict().optional(),convert:y({target:x$.meta({description:`The installed location to convert — an editor id, "agents", or a recorded custom placement path.`}),mode:i([`copy`,`link`]).meta({description:`"link": replace this location with a symlink to the source. "copy": replace it with an independent real folder.`})}).strict().optional(),unplace:y({path:b().min(1).meta({description:`The recorded placement bundle path (e.g. ".windsurf/skills/my-skill").`})}).strict().optional(),...zy,summary:By,fork:y({editor:b().min(1),action:i([`align`,`make-source`,`rename`]),toName:b().optional()}).strict().optional()}).strict().refine(e=>!(e.targets!==void 0&&(e.add!==void 0||e.remove!==void 0)),{error:"`targets` is set-exact; `add`/`remove` are additive — use one style per call"}).refine(e=>e.fork===void 0||e.targets===void 0&&e.add===void 0&&e.remove===void 0&&e.source===void 0&&e.setSource===void 0,{error:"`fork` is its own operation — run it in a separate call"}).refine(e=>e.fork?.action!==`rename`||e.fork.toName!==void 0,{error:"`fork.rename` requires `toName`"}).refine(e=>!(e.source!==void 0&&(e.add!==void 0||e.remove!==void 0)),{error:"a `source` move is its own operation — run it in a separate call from `add`/`remove`"}).refine(e=>[e.targets!==void 0||e.add!==void 0||e.remove!==void 0,e.place!==void 0,e.unplace!==void 0,e.convert!==void 0,e.source!==void 0||e.setSource!==void 0,e.fork!==void 0].filter(Boolean).length<=1,{error:"one operation per call — membership (`targets`/`add`/`remove`), `place`, `unplace`, `convert`, `source`, and `fork` are mutually exclusive"}),C$=[`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`],w$=y({name:b().min(1).meta({description:`Managed skill name installed or uninstalled.`}),hosts:D(b()).meta({description:`Editor ids the skill is projected into after the operation; [] is expected after uninstall.`}),scripts:k().meta({description:`True when the skill ships executable scripts, projected but never run.`}),warnings:D(b()).meta({description:`Non-fatal install/uninstall warnings from target projection.`}),warningCodes:D(i(C$)).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:b().optional(),sourceMovedTo:b().optional()}).strict(),T$=y({scope:HQ.default(`project`),name:b().meta({description:`Managed skill name to uninstall without deleting source.`})}).strict(),E$=y({name:b().min(1).meta({description:`Managed skill name requested for uninstall.`}),uninstalled:k().meta({description:`True when an install marker existed and was removed; false for an idempotent no-op.`})}).strict(),D$=y({targets:D(wQ),configured:k(),folders:D(y({scope:HQ,host:b(),root:b(),state:i([`own`,`linked`,`linked-parent`,`absent`]),target:b().optional(),drift:T(!0).optional(),expected:b().optional()}).strict()).optional()}).strict(),O$=m(`action`,[y({action:T(`link`),scope:HQ,root:b().min(1).meta({description:`The folder to link (e.g. ".codex/skills").`}),target:b().min(1).meta({description:`The root it merges into (e.g. ".agents/skills"). Required.`})}).strict(),y({action:T(`unlink`),scope:HQ,root:b().min(1).meta({description:`The linked folder to materialize back.`}),exclude:D(b().min(1)).optional().meta({description:`Skill names to LEAVE OUT when materializing — the folder keeps every other skill it currently sees (as per-skill links) and stops auto-following the target root.`})}).strict(),y({action:T(`add-root`),scope:HQ,root:b$.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict()]),k$=y({folderAction:O$}).strict(),A$=y({targets:D(wQ),reprojected:D(y({name:b(),hosts:D(b())}).strict()),bundleHosts:D(b()),removedFrom:D(b()),folder:y({moved:D(b()),dropped:D(b()),linked:D(b())}).strict().optional()}).strict(),j$=y({scope:HQ.default(`project`),name:b(),version:b().regex(/^[0-9a-f]{40}$/i),...zy,summary:By}).strict(),M$=y({name:b().min(1),version:b(),restoredFiles:D(b()),warnings:D(b())}).strict(),N$=y({query:b().optional(),intent:i([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:i([`navigation`,`relevance`]).optional(),scopes:D(i([`page`,`folder`,`content`,`file`])).optional(),scope:b().optional(),limit:_().int().nonnegative().optional(),semantic:k().optional(),source:i([`omnibar`,`mcp`,`http`]).optional()}).loose(),P$=y({kind:i([`page`,`folder`,`content`,`file`]),path:b().min(1),title:b(),score:_(),signals:x(b(),te()),snippet:b().optional()}).loose(),F$=y({capable:k(),applied:k(),coverage:y({embedded:_().int().nonnegative(),total:_().int().nonnegative()})}).loose(),I$=y({enabled:k(),keyPresent:k(),keyNotRequired:k(),keySource:i([`project`,`file`,`env`]).nullable(),keyHint:b().nullable(),ready:k(),capable:k(),embedded:_().int().nonnegative(),total:_().int().nonnegative()}).loose(),L$=y({query:b(),intent:i([`autocomplete`,`full_text`,`omnibar`]),results:D(P$),elapsedMs:_().nonnegative(),semantic:F$.optional(),truncated:k().optional(),ready:k().optional()}).loose(),R$=y({version:b().min(1),recordedAt:b().min(1)}).loose(),z$=y({currentVersion:b().min(1),targets:x(b(),R$.nullable())}).loose(),B$=y({scope:HQ.default(`project`),source:b().min(1).meta({description:`External skill source: full skills.sh skill-page URL (https://www.skills.sh/<owner>/<repo>/<skill>, or https://www.skills.sh/site/<hostname>/<skill> for a website catalog), GitHub owner/repo[/subpath], git URL, or local/file path.`}),skill:b().min(1).optional().meta({description:`Specific skill name to import from a multi-skill source.`}),install:k().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection (the caller installs explicitly afterwards). Default true.`}),marketplace:k().optional().meta({description:"The source came from a skills.sh listing the user chose (the Explore tab), so the install is reported to skills.sh and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...zy,summary:By}).strict(),V$=y({scope:HQ.default(`project`),source:b().min(1).meta({description:`External skill source: full skills.sh skill-page URL, GitHub owner/repo[/subpath], git URL, or local/file path.`}),skills:D(b().min(1)).min(1).max(100).meta({description:`Skill names to import from the source.`}),install:k().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection. Default true.`}),...zy,summary:By}).strict(),H$=y({results:D(y({requested:b(),status:i([`imported`,`already-imported`,`not-found`,`failed`]),name:b().optional(),collisionRenamedFrom:b().optional(),warnings:D(b()),error:b().optional()}).loose()),imported:_(),alreadyImported:_(),failed:_()}).loose(),U$=y({source:b(),ref:b().optional(),contentHash:b(),publisher:b().optional()}).loose(),W$=y({name:b().min(1).meta({description:`Managed skill name created or matched.`}),path:b().min(1).meta({description:`Store-relative path to the imported skill source.`}),created:k().meta({description:`True when this request created new source files.`}),alreadyImported:k().meta({description:`True when identical content was already present and no files changed.`}),collisionRenamedFrom:b().optional().meta({description:`Original source name when collision handling renamed the import.`}),provenance:U$,warnings:D(b()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`})}).loose(),G$=`server-info`,K$=`branch-switched`,q$=`disk-ack`,J$=`config-validation-rejected`,Y$=`config-ignore-nested-error`,X$=i([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`,`comments`,`lint-config`]),Z$=y({v:T(1),ch:T(G$),seq:_(),serverInstanceId:b().min(1),currentBranch:b().min(1).optional()}).loose(),Q$=y({v:T(1),ch:T(K$),seq:_(),branch:b().min(1)}).loose(),$$=y({v:T(1),ch:X$,seq:_()}).loose(),e1=y({v:T(1),ch:T(q$),seq:_(),docName:b().min(1),sv:b().min(1)}).loose(),t1=y({v:T(1),ch:T(J$),seq:_(),docName:b().min(1),error:h}).loose(),n1=y({v:T(1),ch:T(Y$),seq:_(),path:b().min(1),error:b().min(1)}).loose();function r1(e){let t=e?.trim();return t===void 0||t===``?void 0:t}function i1(e){return e.reason!==void 0||r1(e.note)!==void 0||r1(e.email)!==void 0}function a1(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol===`https:`)return t;let n=t.hostname===`localhost`||t.hostname===`127.0.0.1`||t.hostname===`[::1]`;return t.protocol===`http:`&&n?t:null}function o1(){return a1((typeof process>`u`?void 0:r1(process.env?.OK_FEEDBACK_INTAKE_ORIGIN))??`https://openknowledge.ai`)}function s1(e){let t=r1(e);if(t!==void 0)return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)?t:void 0}async function c1(e,t,n){try{let r=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t),signal:AbortSignal.timeout(n)});if(r.ok){let e=await r.json().catch(()=>null);return{ok:!0,reference:typeof e?.reference==`string`?e.reference:``}}return r.status===400||r.status===413?{ok:!1,reason:`invalid`}:r.status===503?{ok:!1,reason:`unavailable`}:{ok:!1,reason:`error`}}catch(e){return{ok:!1,reason:e instanceof Error&&(e.name===`TimeoutError`||e.name===`AbortError`)?`timeout`:`error`}}}async function l1(e,t={}){let n=o1();if(n===null)return{ok:!1,reason:`error`};let r=new URL(`/api/feedback`,n),i=r1(e.note),a=s1(e.email),o={kind:`uninstall`,reasons:e.reason===void 0?[]:[e.reason],...i===void 0?{}:{message:i},appVersion:e.appVersion,platform:e.platform,source:e.source},s=Date.now()+(t.timeoutMs??4e3),c=()=>s-Date.now();if(a===void 0)return c1(r,o,c());let l=await c1(r,{...o,email:a},c());return l.ok||l.reason!==`invalid`||c()<=0?l:c1(r,o,c())}var u1=t(r(((e,t)=>{var n=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},r=-1,i=1,a=0;n.Diff=function(e,t){return[e,t]},n.prototype.diff_main=function(e,t,r,i){i===void 0&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:new Date().getTime()+this.Diff_Timeout*1e3);var o=i;if(e==null||t==null)throw Error(`Null input. (diff_main)`);if(e==t)return e?[new n.Diff(a,e)]:[];r===void 0&&(r=!0);var s=r,c=this.diff_commonPrefix(e,t),l=e.substring(0,c);e=e.substring(c),t=t.substring(c),c=this.diff_commonSuffix(e,t);var u=e.substring(e.length-c);e=e.substring(0,e.length-c),t=t.substring(0,t.length-c);var d=this.diff_compute_(e,t,s,o);return l&&d.unshift(new n.Diff(a,l)),u&&d.push(new n.Diff(a,u)),this.diff_cleanupMerge(d),d},n.prototype.diff_compute_=function(e,t,o,s){var c;if(!e)return[new n.Diff(i,t)];if(!t)return[new n.Diff(r,e)];var l=e.length>t.length?e:t,u=e.length>t.length?t:e,d=l.indexOf(u);if(d!=-1)return c=[new n.Diff(i,l.substring(0,d)),new n.Diff(a,u),new n.Diff(i,l.substring(d+u.length))],e.length>t.length&&(c[0][0]=c[2][0]=r),c;if(u.length==1)return[new n.Diff(r,e),new n.Diff(i,t)];var f=this.diff_halfMatch_(e,t);if(f){var p=f[0],m=f[1],h=f[2],g=f[3],_=f[4],v=this.diff_main(p,h,o,s),y=this.diff_main(m,g,o,s);return v.concat([new n.Diff(a,_)],y)}return o&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,s):this.diff_bisect_(e,t,s)},n.prototype.diff_lineMode_=function(e,t,o){var s=this.diff_linesToChars_(e,t);e=s.chars1,t=s.chars2;var c=s.lineArray,l=this.diff_main(e,t,!1,o);this.diff_charsToLines_(l,c),this.diff_cleanupSemantic(l),l.push(new n.Diff(a,``));for(var u=0,d=0,f=0,p=``,m=``;u<l.length;){switch(l[u][0]){case i:f++,m+=l[u][1];break;case r:d++,p+=l[u][1];break;case a:if(d>=1&&f>=1){l.splice(u-d-f,d+f),u=u-d-f;for(var h=this.diff_main(p,m,!1,o),g=h.length-1;g>=0;g--)l.splice(u,0,h[g]);u+=h.length}f=0,d=0,p=``,m=``;break}u++}return l.pop(),l},n.prototype.diff_bisect_=function(e,t,a){for(var o=e.length,s=t.length,c=Math.ceil((o+s)/2),l=c,u=2*c,d=Array(u),f=Array(u),p=0;p<u;p++)d[p]=-1,f[p]=-1;d[l+1]=0,f[l+1]=0;for(var m=o-s,h=m%2!=0,g=0,_=0,v=0,y=0,b=0;b<c&&!(new Date().getTime()>a);b++){for(var x=-b+g;x<=b-_;x+=2){for(var S=l+x,C=x==-b||x!=b&&d[S-1]<d[S+1]?d[S+1]:d[S-1]+1,w=C-x;C<o&&w<s&&e.charAt(C)==t.charAt(w);)C++,w++;if(d[S]=C,C>o)_+=2;else if(w>s)g+=2;else if(h){var T=l+m-x;if(T>=0&&T<u&&f[T]!=-1){var E=o-f[T];if(C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}for(var D=-b+v;D<=b-y;D+=2){for(var T=l+D,E=D==-b||D!=b&&f[T-1]<f[T+1]?f[T+1]:f[T-1]+1,O=E-D;E<o&&O<s&&e.charAt(o-E-1)==t.charAt(s-O-1);)E++,O++;if(f[T]=E,E>o)y+=2;else if(O>s)v+=2;else if(!h){var S=l+m-D;if(S>=0&&S<u&&d[S]!=-1){var C=d[S],w=l+C-S;if(E=o-E,C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}}return[new n.Diff(r,e),new n.Diff(i,t)]},n.prototype.diff_bisectSplit_=function(e,t,n,r,i){var a=e.substring(0,n),o=t.substring(0,r),s=e.substring(n),c=t.substring(r),l=this.diff_main(a,o,!1,i),u=this.diff_main(s,c,!1,i);return l.concat(u)},n.prototype.diff_linesToChars_=function(e,t){var n=[],r={};n[0]=``;function i(e){for(var t=``,i=0,o=-1,s=n.length;o<e.length-1;){o=e.indexOf(`
|
|
292
292
|
`,i),o==-1&&(o=e.length-1);var c=e.substring(i,o+1);(r.hasOwnProperty?r.hasOwnProperty(c):r[c]!==void 0)?t+=String.fromCharCode(r[c]):(s==a&&(c=e.substring(i),o=e.length),t+=String.fromCharCode(s),r[c]=s,n[s++]=c),i=o+1}return t}var a=4e4,o=i(e);return a=65535,{chars1:o,chars2:i(t),lineArray:n}},n.prototype.diff_charsToLines_=function(e,t){for(var n=0;n<e.length;n++){for(var r=e[n][1],i=[],a=0;a<r.length;a++)i[a]=t[r.charCodeAt(a)];e[n][1]=i.join(``)}},n.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},n.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},n.prototype.diff_commonOverlap_=function(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var a=0,o=1;;){var s=e.substring(i-o),c=t.indexOf(s);if(c==-1)return a;o+=c,(c==0||e.substring(i-o)==t.substring(0,o))&&(a=o,o++)}},n.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||r.length*2<n.length)return null;var i=this;function a(e,t,n){for(var r=e.substring(n,n+Math.floor(e.length/4)),a=-1,o=``,s,c,l,u;(a=t.indexOf(r,a+1))!=-1;){var d=i.diff_commonPrefix(e.substring(n),t.substring(a)),f=i.diff_commonSuffix(e.substring(0,n),t.substring(0,a));o.length<f+d&&(o=t.substring(a-f,a)+t.substring(a,a+d),s=e.substring(0,n-f),c=e.substring(n+d),l=t.substring(0,a-f),u=t.substring(a+d))}return o.length*2>=e.length?[s,c,l,u,o]:null}var o=a(n,r,Math.ceil(n.length/4)),s=a(n,r,Math.ceil(n.length/2)),c;if(!o&&!s)return null;c=s?o&&o[4].length>s[4].length?o:s:o;var l,u,d,f;e.length>t.length?(l=c[0],u=c[1],d=c[2],f=c[3]):(d=c[0],f=c[1],l=c[2],u=c[3]);var p=c[4];return[l,u,d,f,p]},n.prototype.diff_cleanupSemantic=function(e){for(var t=!1,o=[],s=0,c=null,l=0,u=0,d=0,f=0,p=0;l<e.length;)e[l][0]==a?(o[s++]=l,u=f,d=p,f=0,p=0,c=e[l][1]):(e[l][0]==i?f+=e[l][1].length:p+=e[l][1].length,c&&c.length<=Math.max(u,d)&&c.length<=Math.max(f,p)&&(e.splice(o[s-1],0,new n.Diff(r,c)),e[o[s-1]+1][0]=i,s--,s--,l=s>0?o[s-1]:-1,u=0,d=0,f=0,p=0,c=null,t=!0)),l++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),l=1;l<e.length;){if(e[l-1][0]==r&&e[l][0]==i){var m=e[l-1][1],h=e[l][1],g=this.diff_commonOverlap_(m,h),_=this.diff_commonOverlap_(h,m);g>=_?(g>=m.length/2||g>=h.length/2)&&(e.splice(l,0,new n.Diff(a,h.substring(0,g))),e[l-1][1]=m.substring(0,m.length-g),e[l+1][1]=h.substring(g),l++):(_>=m.length/2||_>=h.length/2)&&(e.splice(l,0,new n.Diff(a,m.substring(0,_))),e[l-1][0]=i,e[l-1][1]=h.substring(0,h.length-_),e[l+1][0]=r,e[l+1][1]=m.substring(_),l++),l++}l++}},n.prototype.diff_cleanupSemanticLossless=function(e){function t(e,t){if(!e||!t)return 6;var r=e.charAt(e.length-1),i=t.charAt(0),a=r.match(n.nonAlphaNumericRegex_),o=i.match(n.nonAlphaNumericRegex_),s=a&&r.match(n.whitespaceRegex_),c=o&&i.match(n.whitespaceRegex_),l=s&&r.match(n.linebreakRegex_),u=c&&i.match(n.linebreakRegex_),d=l&&e.match(n.blanklineEndRegex_),f=u&&t.match(n.blanklineStartRegex_);return d||f?5:l||u?4:a&&!s&&c?3:s||c?2:a||o?1:0}for(var r=1;r<e.length-1;){if(e[r-1][0]==a&&e[r+1][0]==a){var i=e[r-1][1],o=e[r][1],s=e[r+1][1],c=this.diff_commonSuffix(i,o);if(c){var l=o.substring(o.length-c);i=i.substring(0,i.length-c),o=l+o.substring(0,o.length-c),s=l+s}for(var u=i,d=o,f=s,p=t(i,o)+t(o,s);o.charAt(0)===s.charAt(0);){i+=o.charAt(0),o=o.substring(1)+s.charAt(0),s=s.substring(1);var m=t(i,o)+t(o,s);m>=p&&(p=m,u=i,d=o,f=s)}e[r-1][1]!=u&&(u?e[r-1][1]=u:(e.splice(r-1,1),r--),e[r][1]=d,f?e[r+1][1]=f:(e.splice(r+1,1),r--))}r++}},n.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,n.whitespaceRegex_=/\s/,n.linebreakRegex_=/[\r\n]/,n.blanklineEndRegex_=/\n\r?\n$/,n.blanklineStartRegex_=/^\r?\n\r?\n/,n.prototype.diff_cleanupEfficiency=function(e){for(var t=!1,o=[],s=0,c=null,l=0,u=!1,d=!1,f=!1,p=!1;l<e.length;)e[l][0]==a?(e[l][1].length<this.Diff_EditCost&&(f||p)?(o[s++]=l,u=f,d=p,c=e[l][1]):(s=0,c=null),f=p=!1):(e[l][0]==r?p=!0:f=!0,c&&(u&&d&&f&&p||c.length<this.Diff_EditCost/2&&u+d+f+p==3)&&(e.splice(o[s-1],0,new n.Diff(r,c)),e[o[s-1]+1][0]=i,s--,c=null,u&&d?(f=p=!0,s=0):(s--,l=s>0?o[s-1]:-1,f=p=!1),t=!0)),l++;t&&this.diff_cleanupMerge(e)},n.prototype.diff_cleanupMerge=function(e){e.push(new n.Diff(a,``));for(var t=0,o=0,s=0,c=``,l=``,u;t<e.length;)switch(e[t][0]){case i:s++,l+=e[t][1],t++;break;case r:o++,c+=e[t][1],t++;break;case a:o+s>1?(o!==0&&s!==0&&(u=this.diff_commonPrefix(l,c),u!==0&&(t-o-s>0&&e[t-o-s-1][0]==a?e[t-o-s-1][1]+=l.substring(0,u):(e.splice(0,0,new n.Diff(a,l.substring(0,u))),t++),l=l.substring(u),c=c.substring(u)),u=this.diff_commonSuffix(l,c),u!==0&&(e[t][1]=l.substring(l.length-u)+e[t][1],l=l.substring(0,l.length-u),c=c.substring(0,c.length-u))),t-=o+s,e.splice(t,o+s),c.length&&(e.splice(t,0,new n.Diff(r,c)),t++),l.length&&(e.splice(t,0,new n.Diff(i,l)),t++),t++):t!==0&&e[t-1][0]==a?(e[t-1][1]+=e[t][1],e.splice(t,1)):t++,s=0,o=0,c=``,l=``;break}e[e.length-1][1]===``&&e.pop();var d=!1;for(t=1;t<e.length-1;)e[t-1][0]==a&&e[t+1][0]==a&&(e[t][1].substring(e[t][1].length-e[t-1][1].length)==e[t-1][1]?(e[t][1]=e[t-1][1]+e[t][1].substring(0,e[t][1].length-e[t-1][1].length),e[t+1][1]=e[t-1][1]+e[t+1][1],e.splice(t-1,1),d=!0):e[t][1].substring(0,e[t+1][1].length)==e[t+1][1]&&(e[t-1][1]+=e[t+1][1],e[t][1]=e[t][1].substring(e[t+1][1].length)+e[t+1][1],e.splice(t+1,1),d=!0)),t++;d&&this.diff_cleanupMerge(e)},n.prototype.diff_xIndex=function(e,t){var n=0,a=0,o=0,s=0,c;for(c=0;c<e.length&&(e[c][0]!==i&&(n+=e[c][1].length),e[c][0]!==r&&(a+=e[c][1].length),!(n>t));c++)o=n,s=a;return e.length!=c&&e[c][0]===r?s:s+(t-o)},n.prototype.diff_prettyHtml=function(e){for(var t=[],n=/&/g,o=/</g,s=/>/g,c=/\n/g,l=0;l<e.length;l++){var u=e[l][0],d=e[l][1].replace(n,`&`).replace(o,`<`).replace(s,`>`).replace(c,`¶<br>`);switch(u){case i:t[l]=`<ins style="background:#e6ffe6;">`+d+`</ins>`;break;case r:t[l]=`<del style="background:#ffe6e6;">`+d+`</del>`;break;case a:t[l]=`<span>`+d+`</span>`;break}}return t.join(``)},n.prototype.diff_text1=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==i&&(t[n]=e[n][1]);return t.join(``)},n.prototype.diff_text2=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==r&&(t[n]=e[n][1]);return t.join(``)},n.prototype.diff_levenshtein=function(e){for(var t=0,n=0,o=0,s=0;s<e.length;s++){var c=e[s][0],l=e[s][1];switch(c){case i:n+=l.length;break;case r:o+=l.length;break;case a:t+=Math.max(n,o),n=0,o=0;break}}return t+=Math.max(n,o),t},n.prototype.diff_toDelta=function(e){for(var t=[],n=0;n<e.length;n++)switch(e[n][0]){case i:t[n]=`+`+encodeURI(e[n][1]);break;case r:t[n]=`-`+e[n][1].length;break;case a:t[n]=`=`+e[n][1].length;break}return t.join(` `).replace(/%20/g,` `)},n.prototype.diff_fromDelta=function(e,t){for(var o=[],s=0,c=0,l=t.split(/\t/g),u=0;u<l.length;u++){var d=l[u].substring(1);switch(l[u].charAt(0)){case`+`:try{o[s++]=new n.Diff(i,decodeURI(d))}catch{throw Error(`Illegal escape in diff_fromDelta: `+d)}break;case`-`:case`=`:var f=parseInt(d,10);if(isNaN(f)||f<0)throw Error(`Invalid number in diff_fromDelta: `+d);var p=e.substring(c,c+=f);l[u].charAt(0)==`=`?o[s++]=new n.Diff(a,p):o[s++]=new n.Diff(r,p);break;default:if(l[u])throw Error(`Invalid diff operation in diff_fromDelta: `+l[u])}}if(c!=e.length)throw Error(`Delta length (`+c+`) does not equal source text length (`+e.length+`).`);return o},n.prototype.match_main=function(e,t,n){if(e==null||t==null||n==null)throw Error(`Null input. (match_main)`);return n=Math.max(0,Math.min(n,e.length)),e==t?0:e.length?e.substring(n,n+t.length)==t?n:this.match_bitap_(e,t,n):-1},n.prototype.match_bitap_=function(e,t,n){if(t.length>this.Match_MaxBits)throw Error(`Pattern too long for this browser.`);var r=this.match_alphabet_(t),i=this;function a(e,r){var a=e/t.length,o=Math.abs(n-r);return i.Match_Distance?a+o/i.Match_Distance:o?1:a}var o=this.Match_Threshold,s=e.indexOf(t,n);s!=-1&&(o=Math.min(a(0,s),o),s=e.lastIndexOf(t,n+t.length),s!=-1&&(o=Math.min(a(0,s),o)));var c=1<<t.length-1;s=-1;for(var l,u,d=t.length+e.length,f,p=0;p<t.length;p++){for(l=0,u=d;l<u;)a(p,n+u)<=o?l=u:d=u,u=Math.floor((d-l)/2+l);d=u;var m=Math.max(1,n-u+1),h=Math.min(n+u,e.length)+t.length,g=Array(h+2);g[h+1]=(1<<p)-1;for(var _=h;_>=m;_--){var v=r[e.charAt(_-1)];if(p===0?g[_]=(g[_+1]<<1|1)&v:g[_]=(g[_+1]<<1|1)&v|(f[_+1]|f[_])<<1|1|f[_+1],g[_]&c){var y=a(p,_-1);if(y<=o)if(o=y,s=_-1,s>n)m=Math.max(1,2*n-s);else break}}if(a(p+1,n)>o)break;f=g}return s},n.prototype.match_alphabet_=function(e){for(var t={},n=0;n<e.length;n++)t[e.charAt(n)]=0;for(var n=0;n<e.length;n++)t[e.charAt(n)]|=1<<e.length-n-1;return t},n.prototype.patch_addContext_=function(e,t){if(t.length!=0){if(e.start2===null)throw Error(`patch not initialized`);for(var r=t.substring(e.start2,e.start2+e.length1),i=0;t.indexOf(r)!=t.lastIndexOf(r)&&r.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)i+=this.Patch_Margin,r=t.substring(e.start2-i,e.start2+e.length1+i);i+=this.Patch_Margin;var o=t.substring(e.start2-i,e.start2);o&&e.diffs.unshift(new n.Diff(a,o));var s=t.substring(e.start2+e.length1,e.start2+e.length1+i);s&&e.diffs.push(new n.Diff(a,s)),e.start1-=o.length,e.start2-=o.length,e.length1+=o.length+s.length,e.length2+=o.length+s.length}},n.prototype.patch_make=function(e,t,o){var s,c;if(typeof e==`string`&&typeof t==`string`&&o===void 0)s=e,c=this.diff_main(s,t,!0),c.length>2&&(this.diff_cleanupSemantic(c),this.diff_cleanupEfficiency(c));else if(e&&typeof e==`object`&&t===void 0&&o===void 0)c=e,s=this.diff_text1(c);else if(typeof e==`string`&&t&&typeof t==`object`&&o===void 0)s=e,c=t;else if(typeof e==`string`&&typeof t==`string`&&o&&typeof o==`object`)s=e,c=o;else throw Error(`Unknown call format to patch_make.`);if(c.length===0)return[];for(var l=[],u=new n.patch_obj,d=0,f=0,p=0,m=s,h=s,g=0;g<c.length;g++){var _=c[g][0],v=c[g][1];switch(!d&&_!==a&&(u.start1=f,u.start2=p),_){case i:u.diffs[d++]=c[g],u.length2+=v.length,h=h.substring(0,p)+v+h.substring(p);break;case r:u.length1+=v.length,u.diffs[d++]=c[g],h=h.substring(0,p)+h.substring(p+v.length);break;case a:v.length<=2*this.Patch_Margin&&d&&c.length!=g+1?(u.diffs[d++]=c[g],u.length1+=v.length,u.length2+=v.length):v.length>=2*this.Patch_Margin&&d&&(this.patch_addContext_(u,m),l.push(u),u=new n.patch_obj,d=0,m=h,f=p);break}_!==i&&(f+=v.length),_!==r&&(p+=v.length)}return d&&(this.patch_addContext_(u,m),l.push(u)),l},n.prototype.patch_deepCopy=function(e){for(var t=[],r=0;r<e.length;r++){var i=e[r],a=new n.patch_obj;a.diffs=[];for(var o=0;o<i.diffs.length;o++)a.diffs[o]=new n.Diff(i.diffs[o][0],i.diffs[o][1]);a.start1=i.start1,a.start2=i.start2,a.length1=i.length1,a.length2=i.length2,t[r]=a}return t},n.prototype.patch_apply=function(e,t){if(e.length==0)return[t,[]];e=this.patch_deepCopy(e);var n=this.patch_addPadding(e);t=n+t+n,this.patch_splitMax(e);for(var o=0,s=[],c=0;c<e.length;c++){var l=e[c].start2+o,u=this.diff_text1(e[c].diffs),d,f=-1;if(u.length>this.Match_MaxBits?(d=this.match_main(t,u.substring(0,this.Match_MaxBits),l),d!=-1&&(f=this.match_main(t,u.substring(u.length-this.Match_MaxBits),l+u.length-this.Match_MaxBits),(f==-1||d>=f)&&(d=-1))):d=this.match_main(t,u,l),d==-1)s[c]=!1,o-=e[c].length2-e[c].length1;else{s[c]=!0,o=d-l;var p=f==-1?t.substring(d,d+u.length):t.substring(d,f+this.Match_MaxBits);if(u==p)t=t.substring(0,d)+this.diff_text2(e[c].diffs)+t.substring(d+u.length);else{var m=this.diff_main(u,p,!1);if(u.length>this.Match_MaxBits&&this.diff_levenshtein(m)/u.length>this.Patch_DeleteThreshold)s[c]=!1;else{this.diff_cleanupSemanticLossless(m);for(var h=0,g,_=0;_<e[c].diffs.length;_++){var v=e[c].diffs[_];v[0]!==a&&(g=this.diff_xIndex(m,h)),v[0]===i?t=t.substring(0,d+g)+v[1]+t.substring(d+g):v[0]===r&&(t=t.substring(0,d+g)+t.substring(d+this.diff_xIndex(m,h+v[1].length))),v[0]!==r&&(h+=v[1].length)}}}}}return t=t.substring(n.length,t.length-n.length),[t,s]},n.prototype.patch_addPadding=function(e){for(var t=this.Patch_Margin,r=``,i=1;i<=t;i++)r+=String.fromCharCode(i);for(var i=0;i<e.length;i++)e[i].start1+=t,e[i].start2+=t;var o=e[0],s=o.diffs;if(s.length==0||s[0][0]!=a)s.unshift(new n.Diff(a,r)),o.start1-=t,o.start2-=t,o.length1+=t,o.length2+=t;else if(t>s[0][1].length){var c=t-s[0][1].length;s[0][1]=r.substring(s[0][1].length)+s[0][1],o.start1-=c,o.start2-=c,o.length1+=c,o.length2+=c}if(o=e[e.length-1],s=o.diffs,s.length==0||s[s.length-1][0]!=a)s.push(new n.Diff(a,r)),o.length1+=t,o.length2+=t;else if(t>s[s.length-1][1].length){var c=t-s[s.length-1][1].length;s[s.length-1][1]+=r.substring(0,c),o.length1+=c,o.length2+=c}return r},n.prototype.patch_splitMax=function(e){for(var t=this.Match_MaxBits,o=0;o<e.length;o++)if(!(e[o].length1<=t)){var s=e[o];e.splice(o--,1);for(var c=s.start1,l=s.start2,u=``;s.diffs.length!==0;){var d=new n.patch_obj,f=!0;for(d.start1=c-u.length,d.start2=l-u.length,u!==``&&(d.length1=d.length2=u.length,d.diffs.push(new n.Diff(a,u)));s.diffs.length!==0&&d.length1<t-this.Patch_Margin;){var p=s.diffs[0][0],m=s.diffs[0][1];p===i?(d.length2+=m.length,l+=m.length,d.diffs.push(s.diffs.shift()),f=!1):p===r&&d.diffs.length==1&&d.diffs[0][0]==a&&m.length>2*t?(d.length1+=m.length,c+=m.length,f=!1,d.diffs.push(new n.Diff(p,m)),s.diffs.shift()):(m=m.substring(0,t-d.length1-this.Patch_Margin),d.length1+=m.length,c+=m.length,p===a?(d.length2+=m.length,l+=m.length):f=!1,d.diffs.push(new n.Diff(p,m)),m==s.diffs[0][1]?s.diffs.shift():s.diffs[0][1]=s.diffs[0][1].substring(m.length))}u=this.diff_text2(d.diffs),u=u.substring(u.length-this.Patch_Margin);var h=this.diff_text1(s.diffs).substring(0,this.Patch_Margin);h!==``&&(d.length1+=h.length,d.length2+=h.length,d.diffs.length!==0&&d.diffs[d.diffs.length-1][0]===a?d.diffs[d.diffs.length-1][1]+=h:d.diffs.push(new n.Diff(a,h))),f||e.splice(++o,0,d)}}},n.prototype.patch_toText=function(e){for(var t=[],n=0;n<e.length;n++)t[n]=e[n];return t.join(``)},n.prototype.patch_fromText=function(e){var t=[];if(!e)return t;for(var o=e.split(`
|
|
293
293
|
`),s=0,c=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;s<o.length;){var l=o[s].match(c);if(!l)throw Error(`Invalid patch string: `+o[s]);var u=new n.patch_obj;for(t.push(u),u.start1=parseInt(l[1],10),l[2]===``?(u.start1--,u.length1=1):l[2]==`0`?u.length1=0:(u.start1--,u.length1=parseInt(l[2],10)),u.start2=parseInt(l[3],10),l[4]===``?(u.start2--,u.length2=1):l[4]==`0`?u.length2=0:(u.start2--,u.length2=parseInt(l[4],10)),s++;s<o.length;){var d=o[s].charAt(0);try{var f=decodeURI(o[s].substring(1))}catch{throw Error(`Illegal escape in patch_fromText: `+f)}if(d==`-`)u.diffs.push(new n.Diff(r,f));else if(d==`+`)u.diffs.push(new n.Diff(i,f));else if(d==` `)u.diffs.push(new n.Diff(a,f));else if(d==`@`)break;else if(d!==``)throw Error(`Invalid patch mode "`+d+`" in: `+f);s++}}return t},n.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},n.patch_obj.prototype.toString=function(){for(var e=this.length1===0?this.start1+`,0`:this.length1==1?this.start1+1:this.start1+1+`,`+this.length1,t=this.length2===0?this.start2+`,0`:this.length2==1?this.start2+1:this.start2+1+`,`+this.length2,n=[`@@ -`+e+` +`+t+` @@
|
|
294
294
|
`],o,s=0;s<this.diffs.length;s++){switch(this.diffs[s][0]){case i:o=`+`;break;case r:o=`-`;break;case a:o=` `;break}n[s+1]=o+encodeURI(this.diffs[s][1])+`
|
|
@@ -338,8 +338,8 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
338
338
|
`,PLUGIN_SECURE_PROXY_MISSING_CHAT_MODEL:`Could not find a chat model defined in the secure proxy plugin configuration.
|
|
339
339
|
Please provide a chat model before proceeding with creating an answer session.
|
|
340
340
|
Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#plugin-secure-proxy
|
|
341
|
-
`,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 W2(e,...t){let n=Error(x2(U2[e]??`Unsupported Orama Error code: ${e}`,...t));return n.code=e,`captureStackTrace`in Error.prototype&&Error.captureStackTrace(n),n}function G2(e){return{raw:Number(e),formatted:T2(e)}}function K2(e){if(e.id){if(typeof e.id!=`string`)throw W2(`DOCUMENT_ID_MUST_BE_STRING`,typeof e.id);return e.id}return D2()}function q2(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(Z2(r)){let e=e4(r);if(!Array.isArray(t)||t.length!==e)throw W2(`INVALID_INPUT_VECTOR`,n,e,t.length);continue}if(Q2(r)){if(!Array.isArray(t))return n;let e=$2(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=q2(t,r);if(e)return n+`.`+e;continue}if(typeof t!==r)return n}}}const J2={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},Y2={"string[]":`string`,"number[]":`number`,"boolean[]":`boolean`,"enum[]":`enum`};function X2(e){return e===`geopoint`}function Z2(e){return typeof e==`string`&&/^vector\[\d+\]$/.test(e)}function Q2(e){return typeof e==`string`&&J2[e]}function $2(e){return Y2[e]}function e4(e){let t=Number(e.slice(7,-1));switch(!0){case isNaN(t):throw W2(`INVALID_VECTOR_VALUE`,e);case t<=0:throw W2(`INVALID_VECTOR_SIZE`,e);default:return t}}function t4(){return{idToInternalId:new Map,internalIdToId:[],save:n4,load:r4}}function n4(e){return{internalIdToId:e.internalIdToId}}function r4(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 i4(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?i4(e,t.toString()):t}function a4(e,t){if(e.internalIdToId.length<t)throw Error(`Invalid internalId ${t}`);return e.internalIdToId[t-1]}function o4(e,t){return{sharedInternalDocumentStore:t,docs:{},count:0}}function s4(e,t){let n=i4(e.sharedInternalDocumentStore,t);return e.docs[n]}function c4(e,t){let n=t.length,r=Array.from({length:n});for(let i=0;i<n;i++){let n=i4(e.sharedInternalDocumentStore,t[i]);r[i]=e.docs[n]}return r}function l4(e){return e.docs}function u4(e,t,n,r){return e.docs[n]===void 0?(e.docs[n]=r,e.count++,!0):!1}function d4(e,t){let n=i4(e.sharedInternalDocumentStore,t);return e.docs[n]===void 0?!1:(delete e.docs[n],e.count--,!0)}function f4(e){return e.count}function p4(e,t){let n=t;return{docs:n.docs,count:n.count,sharedInternalDocumentStore:e}}function m4(e){return{docs:e.docs,count:e.count}}function h4(){return{create:o4,get:s4,getMultiple:c4,getAll:l4,store:u4,remove:d4,count:f4,load:p4,save:m4}}const g4=[`beforeInsert`,`afterInsert`,`beforeRemove`,`afterRemove`,`beforeUpdate`,`afterUpdate`,`beforeUpsert`,`afterUpsert`,`beforeSearch`,`afterSearch`,`beforeInsertMultiple`,`afterInsertMultiple`,`beforeRemoveMultiple`,`afterRemoveMultiple`,`beforeUpdateMultiple`,`afterUpdateMultiple`,`beforeUpsertMultiple`,`afterUpsertMultiple`,`beforeLoad`,`afterLoad`,`afterCreate`];function _4(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),W2(`PLUGIN_CRASHED`)}return n}const v4=[`tokenizer`,`index`,`documentsStore`,`sorter`,`pinning`],y4=[`validateSchema`,`getDocumentIndexId`,`getDocumentProperties`,`formatElapsedTime`];function b4(e,t,n,r){if(e.some(I2))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function x4(e,t,n){if(e.some(I2))return(async()=>{for(let r of e)await r(t,n)})();for(let r of e)r(t,n)}function S4(e,t,n,r,i){if(e.some(I2))return(async()=>{for(let a of e)await a(t,n,r,i)})();for(let a of e)a(t,n,r,i)}function C4(e,t,n,r){if(e.some(I2))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function w4(e,t){if(e.some(I2))return(async()=>{for(let n of e)await n(t)})();for(let n of e)n(t)}var T4=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}},E4=class e{root=null;insertCount=0;constructor(e,t){e!==void 0&&t!==void 0&&(this.root=new T4(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?T4.fromJSON(t.root):null,n.insertCount=t.insertCount||0,n}insertNode(e,t,n,r){if(e===null)return new T4(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 T4(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 T4(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}},D4=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 O4(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 k4(e,t,n){let r=O4(e,t,n);return{distance:r,isBounded:r>=0}}var A4=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(O2(e,i)!==null)if(r)if(Math.abs(t.length-i.length)<=r&&k4(t,i,r).isBounded)e[i]=[];else continue;else e[i]=[];if(O2(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&&(k4(e,n,r).isBounded&&(i[n]=[]),O2(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}},j4=class e extends A4{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,A4.fromJSON(t)])||[]),n}toJSON(){return super.toJSON()}},M4=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}},N4=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 M4(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=M4.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))),D=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-D)}},P4=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 F4(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 I4=class e{size;vectors=new Map;constructor(e){this.size=e}add(e,t){t instanceof Float32Array||(t=new Float32Array(t));let n=L4(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)),R4(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 L4(e,t){let n=0;for(let r=0;r<t;r++)n+=e[r]*e[r];return Math.sqrt(n)}function R4(e,t,n,r,i){let a=L4(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 z4(e,t,n,r,i){let a=i4(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 B4(e,t,n,r,i){let a=0;for(let e of r)e===i&&a++;let o=i4(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 V4(e,t,n,r){let i=i4(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 H4(e,t,n){e.tokenOccurrences[t][n]--}function U4(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)){U4(e,t,o,r,n);continue}if(Z2(o))r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o,r.vectorIndexes[n]={type:`Vector`,node:new I4(e4(o)),isArray:!1};else{let e=/\[/.test(o);switch(o){case`boolean`:case`boolean[]`:r.indexes[n]={type:`Bool`,node:new P4,isArray:e};break;case`number`:case`number[]`:r.indexes[n]={type:`AVL`,node:new E4(0,[]),isArray:e};break;case`string`:case`string[]`:r.indexes[n]={type:`Radix`,node:new j4,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 D4,isArray:e};break;case`geopoint`:r.indexes[n]={type:`BKD`,node:new N4,isArray:e};break;default:throw W2(`INVALID_SCHEMA_TYPE`,Array.isArray(o)?`array`:o,n)}r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o}}return r}function W4(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 G4(e,t,n,r,i,a,o,s,c,l,u){if(Z2(o))return K4(t,n,a,r,i);let d=W4(e,t,n,i,s,c,l,u);if(!Q2(o))return d(a);let f=a,p=f.length;for(let e=0;e<p;e++)d(f[e])}function K4(e,t,n,r,i){e.vectorIndexes[t].node.add(i,n)}function q4(e,t,n,r,i,a,o,s,c,l){if(Z2(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 J4(e,t,n,r,i,a,o,s,c,l){if(!Q2(o))return q4(e,t,n,r,i,a,o,s,c,l);let u=$2(o),d=a,f=d.length;for(let a=0;a<f;a++)q4(e,t,n,r,i,d[a],u,s,c,l);return!0}function Y4(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=F4(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 X4(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 W2(`WRONG_SEARCH_PROPERTY_TYPE`,n);let d=s[n]??1;if(d<=0)throw W2(`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];Y4(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 Z4(e,t,n,r){if(`and`in n&&n.and&&Array.isArray(n.and)){let i=n.and;return i.length===0?new Set:R2(...i.map(n=>Z4(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=>Z4(e,t,n,r)).reduce((e,t)=>B2(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 V2(a,Z4(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 W2(`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]=B2(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=P2(t,r),d=s.searchByRadius(n,u,c,void 0,l);a[o]=r3(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]=r3(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]=s3(a[o],t)}}continue}let u=Object.keys(i);if(u.length>1)throw W2(`INVALID_FILTER_OPERATION`,u.length);if(c===`Flat`){let e=new Set(l?s.filterArr(i):s.filter(i));a[o]=B2(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 W2(`INVALID_FILTER_OPERATION`,e)}a[o]=B2(a[o],n)}}return R2(...Object.values(a))}function Q4(e){return e.searchableProperties}function $4(e){return e.searchablePropertiesWithTypes}function e3(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:j4.fromJSON(t),isArray:i};break;case`Flat`:u[e]={type:`Flat`,node:D4.fromJSON(t),isArray:i};break;case`AVL`:u[e]={type:`AVL`,node:E4.fromJSON(t),isArray:i};break;case`BKD`:u[e]={type:`BKD`,node:N4.fromJSON(t),isArray:i};break;case`Bool`:u[e]={type:`Bool`,node:P4.fromJSON(t),isArray:i};break;default:u[e]=n[e]}}for(let e of Object.keys(r))d[e]={type:`Vector`,isArray:!1,node:I4.fromJSON(r[e])};return{sharedInternalDocumentStore:e,indexes:u,vectorIndexes:d,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}}function t3(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 n3(){return{create:U4,insert:G4,remove:J4,insertDocumentScoreParameters:z4,insertTokenScoreParameters:B4,removeDocumentScoreParameters:V4,removeTokenScoreParameters:H4,calculateResultScores:Y4,search:X4,searchByWhereClause:Z4,getSearchableProperties:Q4,getSearchablePropertiesWithTypes:$4,load:e3,save:t3}}function r3(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 i3(e,t,n=!1){let r=n?N4.vincentyDistance:N4.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 a3(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 o3(e,t){let n=e,r=a3(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=P2(e,n);return s=o.searchByRadius(c,l,r,`asc`,i),i3(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=N4.calculatePolygonCentroid(e);return i3(s,r,n)}return null}function s3(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 c3(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=c3(e,t,s,r,n);b2(a.sortableProperties,i.sortableProperties),a.sorts={...a.sorts,...i.sorts},a.sortablePropertiesWithTypes={...a.sortablePropertiesWithTypes,...i.sortablePropertiesWithTypes};continue}if(!Z2(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 W2(`INVALID_SORT_SCHEMA_TYPE`,Array.isArray(s)?`array`:s,n)}}}return a}function l3(e,t,n,r){return r?.enabled===!1?{disabled:!0}:c3(e,t,n,(r||{}).unsortableProperties||[],``)}function u3(e,t,n,r){if(!e.enabled)return;e.isSorted=!1;let i=i4(e.sharedInternalDocumentStore,n),a=e.sorts[t];a.orderedDocsToRemove.has(i)&&_3(e,t),a.docs.set(i,a.orderedDocs.length),a.orderedDocs.push([i,r])}function d3(e){if(e.isSorted||!e.enabled)return;let t=Object.keys(e.sorts);for(let n of t)h3(e,n);e.isSorted=!0}function f3(e,t,n){return t[1].localeCompare(n[1],p2(e))}function p3(e,t){return e[1]-t[1]}function m3(e,t){return t[1]?-1:1}function h3(e,t){let n=e.sorts[t],r;switch(n.type){case`string`:r=f3.bind(null,e.language);break;case`number`:r=p3.bind(null);break;case`boolean`:r=m3.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 g3(e){let t=Object.keys(e.sorts);for(let n of t)_3(e,n)}function _3(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 v3(e,t,n){if(!e.enabled)return;let r=e.sorts[t],i=i4(e.sharedInternalDocumentStore,n);r.docs.get(i)&&(r.docs.delete(i),r.orderedDocsToRemove.set(i,!0))}function y3(e,t,n){if(!e.enabled)throw W2(`SORT_DISABLED`);let r=n.property,i=n.order===`DESC`,a=e.sorts[r];if(!a)throw W2(`UNABLE_TO_SORT_ON_UNKNOWN_FIELD`,r,e.sortableProperties.join(`, `));return _3(e,r),d3(e),t.sort((t,n)=>{let r=a.docs.get(i4(e.sharedInternalDocumentStore,t[0])),o=a.docs.get(i4(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 b3(e){return e.enabled?e.sortableProperties:[]}function x3(e){return e.enabled?e.sortablePropertiesWithTypes:{}}function S3(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 C3(e){if(!e.enabled)return{enabled:!1};g3(e),d3(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 w3(){return{create:l3,insert:u3,remove:v3,save:C3,load:S3,sortBy:y3,getSortableProperties:b3,getSortablePropertiesWithTypes:x3}}const T3=[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 E3(e){return e<192||e>383?e:T3[e-192]||e}function D3(e){let t=[];for(let n=0;n<e.length;n++)t[n]=E3(e.charCodeAt(n));return String.fromCharCode(...t)}const O3={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`},k3={icate:`ic`,ative:``,alize:`al`,iciti:`ic`,ical:`ic`,ful:``,ness:``},A3=`[aeiouy]`,j3=`[^aeiou][^aeiouy]*`;A3+``;const M3=`^(`+j3+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*`;``+j3;const N3=`^(`+j3+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*`,P3=`^(`+j3+`)?[aeiouy]`;function F3(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(M3),r.test(t[1])&&(r=/.$/,e=e.replace(r,``))}else i.test(e)&&(t=i.exec(e)[1],i=new RegExp(P3),i.test(t)&&(e=t,i=/(at|bl|iz)$/,a=RegExp(`([^aeiouylsz])\\1$`),o=RegExp(`^`+j3+A3+`[^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(P3),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(M3),t&&r.test(t)&&(e=t+O3[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(M3),t&&r.test(t)&&(e=t+k3[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(N3),t&&r.test(t)&&(e=t);else if(i.test(e)){let n=i.exec(e);t=n?.[1]??``+n?.[2]??``,i=new RegExp(N3),i.test(t)&&(e=t)}return r=/^(.+?)e$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(N3),i=RegExp(`^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$`),a=RegExp(`^`+j3+A3+`[^aeiouwxy]$`),t&&(r.test(t)||i.test(t)&&!a.test(t))&&(e=t)),r=/ll$/,i=new RegExp(N3),r.test(e)&&i.test(e)&&(r=/.$/,e=e.replace(r,``)),s==`y`&&(e=s.toLowerCase()+e.substring(1)),e}function I3(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=D3(t),n&&this.normalizationCache.set(r,t),t)}function L3(e){for(;e[e.length-1]===``;)e.pop();for(;e[0]===``;)e.shift();return e}function R3(e,t,n,r=!0){if(t&&t!==this.language)throw W2(`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=d2[this.language];a=e.toLowerCase().split(t).map(e=>i(e,r)).filter(Boolean)}let o=L3(a);return this.allowDuplicates?o:Array.from(new Set(o))}function z3(e={}){if(!e.language)e.language=`english`;else if(!f2.includes(e.language))throw W2(`LANGUAGE_NOT_SUPPORTED`,e.language);let t;if(e.stemming||e.stemmer&&!(`stemming`in e))if(e.stemmer){if(typeof e.stemmer!=`function`)throw W2(`INVALID_STEMMER_FUNCTION_TYPE`);t=e.stemmer}else if(e.language===`english`)t=F3;else throw W2(`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 W2(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);if(!Array.isArray(n))throw W2(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);for(let e of n)if(typeof e!=`string`)throw W2(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`)}let r={tokenize:R3,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:I3,normalizationCache:new Map};return r.tokenize=R3.bind(r),r.normalizeToken=I3,r}function B3(e){return{sharedInternalDocumentStore:e,rules:new Map}}function V3(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 H3(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 U3(e,t){return e.rules.delete(t)}function W3(e,t){return e.rules.get(t)}function G3(e){return Array.from(e.rules.values())}function K3(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 q3(e,t){return e?t.conditions.every(t=>K3(e,t)):!1}function J3(e,t){if(!t)return[];let n=[];for(let r of e.rules.values())q3(t,r)&&n.push(r);return n}function Y3(e,t){return{sharedInternalDocumentStore:e,rules:new Map(t?.rules??[])}}function X3(e){return{rules:Array.from(e.rules.entries())}}function Z3(){return{create:B3,addRule:V3,updateRule:H3,removeRule:U3,getRule:W3,getAllRules:G3,getMatchingRules:J3,load:Y3,save:X3}}function Q3(e){let t={formatElapsedTime:G2,getDocumentIndexId:K2,getDocumentProperties:j2,validateSchema:q2};for(let n of y4){let r=n;if(e[r]){if(typeof e[r]!=`function`)throw W2(`COMPONENT_MUST_BE_FUNCTION`,r)}else e[r]=t[r]}for(let t of Object.keys(e))if(!v4.includes(t)&&!y4.includes(t))throw W2(`UNSUPPORTED_COMPONENT`,t)}function $3({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 W2(`PLUGIN_COMPONENT_CONFLICT`,e,t.name);r={...r,...n}}i||=D2();let o=r.tokenizer,s=r.index,c=r.documentsStore,l=r.sorter,u=r.pinning;if(o=o?o.tokenize?o:z3(o):z3({language:n??`english`}),r.tokenizer&&n)throw W2(`NO_LANGUAGE_WITH_CUSTOM_TOKENIZER`);let d=t4();s||=n3(),l||=w3(),c||=h4(),u||=Z3(),Q3(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:e6()};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 g4)g[e]=(g[e]??[]).concat(_4(g,e));let _=g.afterCreate;return _&&w4(_,g),g}function e6(){return`{{VERSION}}`}function t6(e){return e.documentsStore.count(e.data.docs)}function n6(e,t,n,r,i){let a=e.validateSchema(t,e.schema);if(a)throw W2(`SCHEMA_VALIDATION_FAILURE`,a);return I2(e.beforeInsert)||I2(e.afterInsert)||I2(e.index.beforeInsert)||I2(e.index.insert)||I2(e.index.afterInsert)?a6(e,t,n,r,i):o6(e,t,n,r,i)}const r6=new Set([`enum`,`enum[]`]),i6=new Set([`string`,`number`]);async function a6(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw W2(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=i4(e.internalDocumentIDStore,s);if(r||await b4(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw W2(`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];s6(n,r,e,t)}return await c6(e,s,u,f,l,n,t,i),r||await b4(e.afterInsert,e,s,t),s}function o6(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw W2(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=i4(e.internalDocumentIDStore,s);if(r||b4(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw W2(`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];s6(n,r,e,t)}return l6(e,s,u,f,l,n,t,i),r||b4(e.afterInsert,e,s,t),s}function s6(e,t,n,r){if(!(X2(t)&&typeof r==`object`&&typeof r.lon==`number`&&typeof r.lat==`number`)&&!(Z2(t)&&Array.isArray(r))&&!(Q2(t)&&Array.isArray(r))&&!(r6.has(t)&&i6.has(e))&&e!==t)throw W2(`INVALID_DOCUMENT_PROPERTY`,n,t,e)}async function c6(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 l6(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=i4(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 u6(e,t,n,r,i,a){return I2(e.afterInsertMultiple)||I2(e.beforeInsertMultiple)||I2(e.index.beforeInsert)||I2(e.index.insert)||I2(e.index.afterInsert)?d6(e,t,n,r,i,a):f6(e,t,n,r,i,a)}async function d6(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 n6(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&&H2(e)}}})(),i||await x4(e.afterInsertMultiple,e,t),o}function f6(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=n6(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&&H2(e)}}}return l(),i||x4(e.afterInsertMultiple,e,t),o}function p6(e,t,n,r){return I2(e.index.beforeRemove)||I2(e.index.remove)||I2(e.index.afterRemove)?m6(e,t,n,r):h6(e,t,n,r)}async function m6(e,t,n,r){let i=!0,{index:a,docs:o}=e.data,s=e.documentsStore.get(o,t);if(!s)return!1;let c=i4(e.internalDocumentIDStore,t),l=a4(e.internalDocumentIDStore,c),u=e.documentsStore.count(o);r||await b4(e.beforeRemove,e,l);let d=e.index.getSearchableProperties(a),f=e.index.getSearchablePropertiesWithTypes(a),p=e.getDocumentProperties(s,d);for(let r of d){let a=p[r];if(a===void 0)continue;let o=f[r];await e.index.beforeRemove?.(e.data.index,r,l,a,o,n,e.tokenizer,u),await e.index.remove(e.index,e.data.index,r,t,c,a,o,n,e.tokenizer,u)||(i=!1),await e.index.afterRemove?.(e.data.index,r,l,a,o,n,e.tokenizer,u)}let m=await e.sorter.getSortableProperties(e.data.sorting),h=await e.getDocumentProperties(s,m);for(let n of m)h[n]!==void 0&&e.sorter.remove(e.data.sorting,n,t);return r||await b4(e.afterRemove,e,l),e.documentsStore.remove(e.data.docs,t,c),i}function h6(e,t,n,r){let i=!0,{index:a,docs:o}=e.data,s=e.documentsStore.get(o,t);if(!s)return!1;let c=i4(e.internalDocumentIDStore,t),l=a4(e.internalDocumentIDStore,c),u=e.documentsStore.count(o);r||b4(e.beforeRemove,e,l);let d=e.index.getSearchableProperties(a),f=e.index.getSearchablePropertiesWithTypes(a),p=e.getDocumentProperties(s,d);for(let r of d){let a=p[r];if(a===void 0)continue;let o=f[r];e.index.beforeRemove?.(e.data.index,r,l,a,o,n,e.tokenizer,u),e.index.remove(e.index,e.data.index,r,t,c,a,o,n,e.tokenizer,u)||(i=!1),e.index.afterRemove?.(e.data.index,r,l,a,o,n,e.tokenizer,u)}let m=e.sorter.getSortableProperties(e.data.sorting),h=e.getDocumentProperties(s,m);for(let n of m)h[n]!==void 0&&e.sorter.remove(e.data.sorting,n,t);return r||b4(e.afterRemove,e,l),e.documentsStore.remove(e.data.docs,t,c),i}function g6(e,t,n,r,i){return I2(e.index.beforeRemove)||I2(e.index.remove)||I2(e.index.afterRemove)||I2(e.beforeRemoveMultiple)||I2(e.afterRemoveMultiple)?_6(e,t,n,r,i):v6(e,t,n,r,i)}async function _6(e,t,n,r,i){let a=0;n||=1e3;let o=i?[]:t.map(t=>a4(e.internalDocumentIDStore,i4(e.internalDocumentIDStore,t)));return i||await x4(e.beforeRemoveMultiple,e,o),await new Promise((o,s)=>{let c=0;async function l(){let u=t.slice(c*n,++c*n);if(!u.length)return o();for(let t of u)try{await p6(e,t,r,i)&&a++}catch(e){s(e)}setTimeout(l,0)}setTimeout(l,0)}),i||await x4(e.afterRemoveMultiple,e,o),a}function v6(e,t,n,r,i){let a=0;n||=1e3;let o=i?[]:t.map(t=>a4(e.internalDocumentIDStore,i4(e.internalDocumentIDStore,t)));i||x4(e.beforeRemoveMultiple,e,o);let s=0;function c(){let o=t.slice(s*n,++s*n);if(o.length){for(let t of o)p6(e,t,r,i)&&a++;setTimeout(c,0)}}return c(),i||x4(e.afterRemoveMultiple,e,o),a}function y6(e,t){return e[1]-t[1]}function b6(e,t){return t[1]-e[1]}function x6(e=`desc`){return e.toLowerCase()===`asc`?y6:b6}function S6(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(`.`)?M2(t,e):t[e],a=s[e],o=r[e].values;switch(a){case`number`:{let t=n[e].ranges;C6(t,o)(i);break}case`number[]`:{let t=new Set,r=n[e].ranges,a=C6(r,o,t);for(let e of i)a(e);break}case`boolean`:case`enum`:case`string`:w6(o,a)(i);break;case`boolean[]`:case`enum[]`:case`string[]`:{let e=w6(o,a===`boolean[]`?`boolean`:`string`,new Set);for(let t of i)e(t);break}default:throw W2(`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=x6(r.sort);t.values=Object.fromEntries(Object.entries(t.values).sort(i).slice(r.offset??0,r.limit??10))}}return r}function C6(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 w6(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 T6={reducer:(e,t,n,r)=>(t[r]=n,t),getInitialValue:e=>Array.from({length:e})},E6=[`string`,`number`,`boolean`];function D6(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 W2(`UNKNOWN_GROUP_BY_PROPERTY`,t);if(!E6.includes(a[t]))throw W2(`INVALID_GROUP_BY_PROPERTY`,t,E6.join(`, `),a[t])}let o=t.map(([t])=>a4(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=M2(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=O6(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=A2(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||T6,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 O6(e,t=0){if(t+1===e.length)return e[t].map(e=>[e]);let n=e[t],r=O6(e,t+1),i=[];for(let e of n)for(let t of r){let n=[e];b2(n,t),i.push(n)}return i}function k6(e,t,n,r){let i=J3(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=i4(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 A6(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 W2(`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=t6(e);if(l=e.index.search(a,r||``,e.tokenizer,n,o,t.exact||!1,t.tolerance||0,t.boost||{},F6(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=M6(r,e);if(typeof n==`string`&&t.every(e=>RegExp(`\\b${j6(e)}\\b`).test(n)))return!0}return!1})}}else l=s?o3(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 j6(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function M6(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 N6(e,t,n){let r=E2();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=A6(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])=>[i4(e.internalDocumentIDStore,t),n]);else d=d.sort(k2);d=k6(e,e.data.pinning,d,t.term);let f;u||(f=c?q6(e,d,s,o,c):J6(e,d,s,o));let p={elapsed:{formatted:``,raw:0},hits:[],count:d.length};return f!==void 0&&(p.hits=f.filter(Boolean),l||F2(p,i)),a&&(p.facets=S6(e,d,t.facets)),t.groupBy&&(p.groups=D6(e,d,t.groupBy)),p.elapsed=e.formatElapsedTime(E2()-r),p}async function a(){e.beforeSearch&&await C4(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await S4(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}const P6={k:1.2,b:.75,d:.5};function F6(e){let t=e??{};return t.k=t.k??P6.k,t.b=t.b??P6.b,t.d=t.d??P6.d,t}function I6(e,t,n){let r=t.vector;if(r&&(!(`value`in r)||!(`property`in r)))throw W2(`INVALID_VECTOR_INPUT`,Object.keys(r).join(`, `));let i=e.data.index.vectorIndexes[r.property];if(!i)throw W2(`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?W2(`INVALID_INPUT_VECTOR`,`undefined`,a,`undefined`):W2(`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 L6(e,t,n=`english`){let r=E2();function i(){let i=I6(e,t,n).sort(k2);i=k6(e,e.data.pinning,i,void 0);let a=[];t.facets&&Object.keys(t.facets).length>0&&(a=S6(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:a4(e.internalDocumentIDStore,n[0]),score:n[1],document:r})}let d=[];t.groupBy&&(d=D6(e,i,t.groupBy));let f=E2()-r;return{count:i.length,hits:u.filter(Boolean),elapsed:{raw:Number(f),formatted:T2(f)},...a?{facets:a}:{},...d?{groups:d}:{}}}async function a(){e.beforeSearch&&await C4(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await S4(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function R6(e,t,n){let r=V6(A6(e,t,n)),i=I6(e,t,n),a=t.hybridWeights;return W6(r,i,t.term??``,a)}function z6(e,t,n){let r=E2();function i(){let i=R6(e,t,n);i=k6(e,e.data.pinning,i,t.term);let a;t.facets&&Object.keys(t.facets).length>0&&(a=S6(e,i,t.facets));let o;t.groupBy&&(o=D6(e,i,t.groupBy));let s=t.offset??0,c=t.limit??10,l=J6(e,i,s,c).filter(Boolean),u=E2(),d={count:i.length,elapsed:{raw:Number(u-r),formatted:T2(u-r)},hits:l,...a?{facets:a}:{},...o?{groups:o}:{}};return(t.includeVectors??!1)||F2(d,Object.keys(e.data.index.vectorIndexes)),d}async function a(){e.beforeSearch&&await C4(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await S4(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function B6(e){return e[1]}function V6(e){let t=Math.max.apply(Math,e.map(B6));return e.map(([e,n])=>[e,n/t])}function H6(e,t){return e/t}function U6(e,t){return(n,r)=>n*e+r*t}function W6(e,t,n,r){let i=Math.max.apply(Math,e.map(B6)),a=Math.max.apply(Math,t.map(B6)),{text:o,vector:s}=r&&r.text&&r.vector?r:G6(n),c=new Map,l=e.length,u=U6(o,s);for(let t=0;t<l;t++){let[n,r]=e[t],a=u(H6(r,i),0);c.set(n,a)}let d=t.length;for(let e=0;e<d;e++){let[n,r]=t[e],i=H6(r,a),o=c.get(n)??0;c.set(n,o+u(0,i))}return[...c].sort((e,t)=>t[1]-e[1])}function G6(e){return{text:.5,vector:.5}}function K6(e,t,n){let r=t.mode??`fulltext`;if(r===`fulltext`)return N6(e,t,n);if(r===`vector`)return L6(e,t);if(r===`hybrid`)return z6(e,t);throw W2(`INVALID_SEARCH_MODE`,r)}function q6(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=M2(m,i);if(!(h===void 0||o.has(h))&&(o.set(h,!0),u++,!(u<=n)&&(s.push({id:a4(e.internalDocumentIDStore,f),score:p,document:m}),c.add(f),u>=n+r)))break}return s}function J6(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:a4(e.internalDocumentIDStore,r),score:c,document:t},o.add(r)}}return a}const Y6={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},X6=new WeakMap;function Z6(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function Q6(e){return e.trim().toLowerCase()}const $6=/\.(?:md|mdx)$/;function e8(e,t){if(t!==`page`)return e;let n=e.replace($6,``);return n.length>0?n:e}function t8(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function n8(e){let t=t8(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 r8(e){let t=$3({schema:Y6});return e.length>0&&u6(t,e),t}function i8(e){let t={documents:e};return X6.set(t,r8(e)),t}function a8(e){let t=X6.get(e);if(t)return t;let n=r8(e.documents);return X6.set(e,n),n}const o8=new WeakSet;function s8(e,t){return e===t||e.kind===t.kind&&e.path===t.path&&e.title===t.title&&e.name===t.name&&e.pathSegments===t.pathSegments&&e.modifiedTs===t.modifiedTs&&e.content===t.content}function c8(e,t){let n=e=>({corpus:i8(t),inserted:0,updated:0,removed:0,rebuilt:!0,rebuildReason:e}),r=X6.get(e);if(!r)return n(`no-index`);if(o8.has(e))return n(`stale-base`);let i=new Map(t.map(e=>[e.id,e]));if(i.size!==t.length)return n(`duplicate-id`);let a=[],o=[],s=0;for(let t of e.documents){let e=i.get(t.id);e?s8(t,e)||(a.push(t.id),o.push(e),s+=1):a.push(t.id)}let c=new Set(e.documents.map(e=>e.id));for(let e of t)c.has(e.id)||o.push(e);if(a.length+o.length>t.length)return n(`bulk-change`);o8.add(e);try{if(a.length>0&&g6(r,a),o.length>0&&u6(r,o),t6(r)!==t.length)throw Error(`Search index count ${t6(r)} diverged from document count ${t.length} after incremental update`)}catch{return n(`mutation-failed`)}let l={documents:t};return X6.set(l,r),{corpus:l,inserted:o.length-s,updated:s,removed:a.length-s,rebuilt:!1}}function l8(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function u8(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function d8(e,t){let n=Q6(t);if(!n)return 0;let r=e8(n,e.kind),i=Q6(e.title),a=Q6(e.name),o=Q6(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 f8(e,t){let n=d8(e,t);return n<=0?n:Fy(e.path)?n*.5:n}function p8(e){return e===`file`?-60:0}function m8(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 h8(e,t,n,r){return e+t*20+n+p8(r)}function g8(e,t,n,r,i,a){return e===`relevance`?h8(t,n,r,i):m8(t,n,r,i,a)}function _8(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function v8(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function y8(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 b8(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function x8(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 S8(e,t){return Q6(t).length<4?0:+(e===`full_text`)}function C8(e){let{lexical:t,fullText:n}=e.signals;return t>=500?`lexical`:t===450&&n<=0?`pathOnly`:`body`}function w8(e){let t=[],n=[],r=[];for(let i of e){let e=C8(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 T8(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=w8(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 E8(e,t,n={}){let r=n.intent??`omnibar`,i=_8(r,n.ranking),a=Z6(n.limit),o=new Set(n.scopes??l8(r)),s=e.documents.filter(e=>u8(e,o)),c=Q6(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=K6(a8(e),{term:c,properties:b8(r),boost:x8(r),tolerance:S8(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>u8(e.document,o)).map(e=>[e.document.id,e.score])),d=y8(s),f=new Map;for(let e of s)f8(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)u8(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=v8(f.values(),u);return T8([...f.values()].map(t=>{let n=Math.max(0,f8(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:g8(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 T8(O8({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function D8(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function O8(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=v8(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,f8(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?g8(o,t,n,s,e.kind,m):h8(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=D8(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)),_=D8(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),r=+(t.lexical>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}))}const k8=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),A8=globalThis;A8[k8]===void 0&&(A8[k8]=ne());const j8=A8[k8],M8=[`.ok`,`skill-state.yml`],N8=[`claude-cowork`,`cli-hosts`],P8=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],F8=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,I8=ee({version:b().regex(F8,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(j8,{description:`Recorded skill version for this target.`}),recordedAt:A().register(j8,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:i(P8).register(j8,{description:`Install-source surface that recorded this entry.`}).optional()}),L8=ee({enabled:k().register(j8,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:A().register(j8,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})}),R8=ee({schema:T(1).register(j8,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:ee({"claude-cowork":I8.optional(),"cli-hosts":I8.optional()}).register(j8,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:x(b(),L8).register(j8,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional()});function z8(e,t){return e??t.installedOnDisk}function B8(){return{schema:1,targets:{}}}const V8=16*1024*1024,H8=64*1024*1024,U8=ee({name:b(),description:b(),files:ee({skillMd:b(),scripts:D(b()),references:D(b())})}),W8=ee({pluginProvider:b().optional(),plugin:b().optional(),marketplace:b().optional(),version:b().optional(),gitCommitSha:b().optional(),scope:b().optional(),projectPath:b().optional()}),G8=ee({commands:k(),hooks:k(),mcp:k()}),K8=ee({...U8.shape,sourceHarness:b(),sourceHarnesses:D(b()),home:b(),provenance:W8,inert:G8}),q8=ee({schema:T(1),name:b(),version:b(),description:b().optional(),author:ee({name:b()}).optional(),skills:D(b()),hostCompatibility:D(b()).optional(),capabilities:ee({scripts:b(),network:b(),inert:D(b())}).optional(),provenance:ee({source:b(),ref:b(),contentHash:b()}).optional()}),J8=y({skills:D(K8),packs:D(q8)}).loose(),Y8=y({results:D(y({id:b().min(1),name:b().min(1),source:b().min(1),description:b(),installs:_().int().nonnegative().nullable(),publisher:b().nullable()}).loose()),backend:i([`skills.sh`,`github-fallback`]),degraded:k()}).loose(),X8=y({title:b(),description:b(),image:b().nullable(),skillsUrl:b().nullable(),sourceKind:i([`github`,`site`]),sourceUrl:b()}).loose(),Z8=y({skills:D(y({name:b(),description:b().nullable()}).loose())}).loose(),Q8=y({kind:i([`local`,`import`,`none`]),scope:i(Xe).optional(),name:b().optional(),dir:b().optional(),source:b().optional(),ref:b().optional(),via:i([`source`,`publisher`]).optional()}).loose(),$8=y({relPath:b(),content:b().nullable()}).loose(),e5=y({provider:b(),plugin:b(),version:b().optional(),marketplace:b().optional(),repositoryUrl:b().optional()}).loose(),t5=y({provider:b(),plugin:b(),version:b().optional(),description:b().optional(),repositoryUrl:b().optional(),bundledSkills:D(b()),capabilities:y({commands:k(),hooks:k(),mcp:k(),agents:k()}),setupSupported:k()}).loose(),n5=y({name:b(),description:b().nullable(),skillMd:b(),files:D($8),plugin:e5.optional(),pluginBundle:t5.optional()}).loose(),r5=new Set([`project`,`local`]);function i5(e){return e!==void 0&&r5.has(e)?`project`:`global`}function a5(e,t){let n=e=>e.replace(/\/+$/,``);return n(e)===n(t)}function o5(e,t){if(i5(e.scope)===`global`)return!0;let n=e.projectPath;return n===void 0||t===void 0?!0:a5(n,t)}const s5=/^([\w.-]+)\/([\w.-]+)$/,c5=/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function l5(e){let t=s5.exec(e);if(t){let[,e,n]=t;if(e&&n)return{kind:`github`,owner:e,repo:n}}return c5.test(e)?{kind:`site`,hostname:e}:null}function u5(e,t){let n=l5(e),r=t.trim();if(!n||!r)return null;let i=encodeURIComponent(r);if(n.kind===`github`){let e=encodeURIComponent(n.owner),t=encodeURIComponent(n.repo);return{sourceKind:`github`,skillsUrl:`https://www.skills.sh/${e}/${t}/${i}`,sourceUrl:`https://github.com/${e}/${t}`}}return{sourceKind:`site`,skillsUrl:`https://www.skills.sh/site/${encodeURIComponent(n.hostname)}/${i}`,sourceUrl:`https://${n.hostname}`}}function d5(e){return e.includes(`/`)?e.split(`/`)[0]??null:null}function f5(e){let t=e.split(`/`).pop();return t&&t.length>0?t:e}const p5=`template`;function m5(e){if(e.trim()===``)return{};let t;try{t=(0,ze.parse)(e)}catch{return{}}return typeof t!=`object`||!t||Array.isArray(t)?{}:t}function h5(e,t){return e.trim()===``?t:`---\n${e}\n---\n${t}`}function g5(e){let{frontmatter:t,body:n}=om(e);return t===``?{docFrontmatterText:``,markdown:e}:{docFrontmatterText:cm(t),markdown:n}}function _5(e){let t=e.split(`
|
|
341
|
+
`,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 W2(e,...t){let n=Error(x2(U2[e]??`Unsupported Orama Error code: ${e}`,...t));return n.code=e,`captureStackTrace`in Error.prototype&&Error.captureStackTrace(n),n}function G2(e){return{raw:Number(e),formatted:T2(e)}}function K2(e){if(e.id){if(typeof e.id!=`string`)throw W2(`DOCUMENT_ID_MUST_BE_STRING`,typeof e.id);return e.id}return D2()}function q2(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(Z2(r)){let e=e4(r);if(!Array.isArray(t)||t.length!==e)throw W2(`INVALID_INPUT_VECTOR`,n,e,t.length);continue}if(Q2(r)){if(!Array.isArray(t))return n;let e=$2(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=q2(t,r);if(e)return n+`.`+e;continue}if(typeof t!==r)return n}}}const J2={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},Y2={"string[]":`string`,"number[]":`number`,"boolean[]":`boolean`,"enum[]":`enum`};function X2(e){return e===`geopoint`}function Z2(e){return typeof e==`string`&&/^vector\[\d+\]$/.test(e)}function Q2(e){return typeof e==`string`&&J2[e]}function $2(e){return Y2[e]}function e4(e){let t=Number(e.slice(7,-1));switch(!0){case isNaN(t):throw W2(`INVALID_VECTOR_VALUE`,e);case t<=0:throw W2(`INVALID_VECTOR_SIZE`,e);default:return t}}function t4(){return{idToInternalId:new Map,internalIdToId:[],save:n4,load:r4}}function n4(e){return{internalIdToId:e.internalIdToId}}function r4(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 i4(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?i4(e,t.toString()):t}function a4(e,t){if(e.internalIdToId.length<t)throw Error(`Invalid internalId ${t}`);return e.internalIdToId[t-1]}function o4(e,t){return{sharedInternalDocumentStore:t,docs:{},count:0}}function s4(e,t){let n=i4(e.sharedInternalDocumentStore,t);return e.docs[n]}function c4(e,t){let n=t.length,r=Array.from({length:n});for(let i=0;i<n;i++){let n=i4(e.sharedInternalDocumentStore,t[i]);r[i]=e.docs[n]}return r}function l4(e){return e.docs}function u4(e,t,n,r){return e.docs[n]===void 0?(e.docs[n]=r,e.count++,!0):!1}function d4(e,t){let n=i4(e.sharedInternalDocumentStore,t);return e.docs[n]===void 0?!1:(delete e.docs[n],e.count--,!0)}function f4(e){return e.count}function p4(e,t){let n=t;return{docs:n.docs,count:n.count,sharedInternalDocumentStore:e}}function m4(e){return{docs:e.docs,count:e.count}}function h4(){return{create:o4,get:s4,getMultiple:c4,getAll:l4,store:u4,remove:d4,count:f4,load:p4,save:m4}}const g4=[`beforeInsert`,`afterInsert`,`beforeRemove`,`afterRemove`,`beforeUpdate`,`afterUpdate`,`beforeUpsert`,`afterUpsert`,`beforeSearch`,`afterSearch`,`beforeInsertMultiple`,`afterInsertMultiple`,`beforeRemoveMultiple`,`afterRemoveMultiple`,`beforeUpdateMultiple`,`afterUpdateMultiple`,`beforeUpsertMultiple`,`afterUpsertMultiple`,`beforeLoad`,`afterLoad`,`afterCreate`];function _4(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),W2(`PLUGIN_CRASHED`)}return n}const v4=[`tokenizer`,`index`,`documentsStore`,`sorter`,`pinning`],y4=[`validateSchema`,`getDocumentIndexId`,`getDocumentProperties`,`formatElapsedTime`];function b4(e,t,n,r){if(e.some(I2))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function x4(e,t,n){if(e.some(I2))return(async()=>{for(let r of e)await r(t,n)})();for(let r of e)r(t,n)}function S4(e,t,n,r,i){if(e.some(I2))return(async()=>{for(let a of e)await a(t,n,r,i)})();for(let a of e)a(t,n,r,i)}function C4(e,t,n,r){if(e.some(I2))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function w4(e,t){if(e.some(I2))return(async()=>{for(let n of e)await n(t)})();for(let n of e)n(t)}var T4=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}},E4=class e{root=null;insertCount=0;constructor(e,t){e!==void 0&&t!==void 0&&(this.root=new T4(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?T4.fromJSON(t.root):null,n.insertCount=t.insertCount||0,n}insertNode(e,t,n,r){if(e===null)return new T4(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 T4(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 T4(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}},D4=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 O4(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 k4(e,t,n){let r=O4(e,t,n);return{distance:r,isBounded:r>=0}}var A4=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(O2(e,i)!==null)if(r)if(Math.abs(t.length-i.length)<=r&&k4(t,i,r).isBounded)e[i]=[];else continue;else e[i]=[];if(O2(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&&(k4(e,n,r).isBounded&&(i[n]=[]),O2(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}},j4=class e extends A4{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,A4.fromJSON(t)])||[]),n}toJSON(){return super.toJSON()}},M4=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}},N4=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 M4(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=M4.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))),D=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-D)}},P4=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 F4(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 I4=class e{size;vectors=new Map;constructor(e){this.size=e}add(e,t){t instanceof Float32Array||(t=new Float32Array(t));let n=L4(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)),R4(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 L4(e,t){let n=0;for(let r=0;r<t;r++)n+=e[r]*e[r];return Math.sqrt(n)}function R4(e,t,n,r,i){let a=L4(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 z4(e,t,n,r,i){let a=i4(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 B4(e,t,n,r,i){let a=0;for(let e of r)e===i&&a++;let o=i4(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 V4(e,t,n,r){let i=i4(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 H4(e,t,n){e.tokenOccurrences[t][n]--}function U4(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)){U4(e,t,o,r,n);continue}if(Z2(o))r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o,r.vectorIndexes[n]={type:`Vector`,node:new I4(e4(o)),isArray:!1};else{let e=/\[/.test(o);switch(o){case`boolean`:case`boolean[]`:r.indexes[n]={type:`Bool`,node:new P4,isArray:e};break;case`number`:case`number[]`:r.indexes[n]={type:`AVL`,node:new E4(0,[]),isArray:e};break;case`string`:case`string[]`:r.indexes[n]={type:`Radix`,node:new j4,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 D4,isArray:e};break;case`geopoint`:r.indexes[n]={type:`BKD`,node:new N4,isArray:e};break;default:throw W2(`INVALID_SCHEMA_TYPE`,Array.isArray(o)?`array`:o,n)}r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o}}return r}function W4(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 G4(e,t,n,r,i,a,o,s,c,l,u){if(Z2(o))return K4(t,n,a,r,i);let d=W4(e,t,n,i,s,c,l,u);if(!Q2(o))return d(a);let f=a,p=f.length;for(let e=0;e<p;e++)d(f[e])}function K4(e,t,n,r,i){e.vectorIndexes[t].node.add(i,n)}function q4(e,t,n,r,i,a,o,s,c,l){if(Z2(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 J4(e,t,n,r,i,a,o,s,c,l){if(!Q2(o))return q4(e,t,n,r,i,a,o,s,c,l);let u=$2(o),d=a,f=d.length;for(let a=0;a<f;a++)q4(e,t,n,r,i,d[a],u,s,c,l);return!0}function Y4(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=F4(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 X4(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 W2(`WRONG_SEARCH_PROPERTY_TYPE`,n);let d=s[n]??1;if(d<=0)throw W2(`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];Y4(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 Z4(e,t,n,r){if(`and`in n&&n.and&&Array.isArray(n.and)){let i=n.and;return i.length===0?new Set:R2(...i.map(n=>Z4(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=>Z4(e,t,n,r)).reduce((e,t)=>B2(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 V2(a,Z4(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 W2(`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]=B2(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=P2(t,r),d=s.searchByRadius(n,u,c,void 0,l);a[o]=r3(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]=r3(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]=s3(a[o],t)}}continue}let u=Object.keys(i);if(u.length>1)throw W2(`INVALID_FILTER_OPERATION`,u.length);if(c===`Flat`){let e=new Set(l?s.filterArr(i):s.filter(i));a[o]=B2(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 W2(`INVALID_FILTER_OPERATION`,e)}a[o]=B2(a[o],n)}}return R2(...Object.values(a))}function Q4(e){return e.searchableProperties}function $4(e){return e.searchablePropertiesWithTypes}function e3(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:j4.fromJSON(t),isArray:i};break;case`Flat`:u[e]={type:`Flat`,node:D4.fromJSON(t),isArray:i};break;case`AVL`:u[e]={type:`AVL`,node:E4.fromJSON(t),isArray:i};break;case`BKD`:u[e]={type:`BKD`,node:N4.fromJSON(t),isArray:i};break;case`Bool`:u[e]={type:`Bool`,node:P4.fromJSON(t),isArray:i};break;default:u[e]=n[e]}}for(let e of Object.keys(r))d[e]={type:`Vector`,isArray:!1,node:I4.fromJSON(r[e])};return{sharedInternalDocumentStore:e,indexes:u,vectorIndexes:d,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}}function t3(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 n3(){return{create:U4,insert:G4,remove:J4,insertDocumentScoreParameters:z4,insertTokenScoreParameters:B4,removeDocumentScoreParameters:V4,removeTokenScoreParameters:H4,calculateResultScores:Y4,search:X4,searchByWhereClause:Z4,getSearchableProperties:Q4,getSearchablePropertiesWithTypes:$4,load:e3,save:t3}}function r3(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 i3(e,t,n=!1){let r=n?N4.vincentyDistance:N4.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 a3(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 o3(e,t){let n=e,r=a3(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=P2(e,n);return s=o.searchByRadius(c,l,r,`asc`,i),i3(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=N4.calculatePolygonCentroid(e);return i3(s,r,n)}return null}function s3(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 c3(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=c3(e,t,s,r,n);b2(a.sortableProperties,i.sortableProperties),a.sorts={...a.sorts,...i.sorts},a.sortablePropertiesWithTypes={...a.sortablePropertiesWithTypes,...i.sortablePropertiesWithTypes};continue}if(!Z2(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 W2(`INVALID_SORT_SCHEMA_TYPE`,Array.isArray(s)?`array`:s,n)}}}return a}function l3(e,t,n,r){return r?.enabled===!1?{disabled:!0}:c3(e,t,n,(r||{}).unsortableProperties||[],``)}function u3(e,t,n,r){if(!e.enabled)return;e.isSorted=!1;let i=i4(e.sharedInternalDocumentStore,n),a=e.sorts[t];a.orderedDocsToRemove.has(i)&&_3(e,t),a.docs.set(i,a.orderedDocs.length),a.orderedDocs.push([i,r])}function d3(e){if(e.isSorted||!e.enabled)return;let t=Object.keys(e.sorts);for(let n of t)h3(e,n);e.isSorted=!0}function f3(e,t,n){return t[1].localeCompare(n[1],p2(e))}function p3(e,t){return e[1]-t[1]}function m3(e,t){return t[1]?-1:1}function h3(e,t){let n=e.sorts[t],r;switch(n.type){case`string`:r=f3.bind(null,e.language);break;case`number`:r=p3.bind(null);break;case`boolean`:r=m3.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 g3(e){let t=Object.keys(e.sorts);for(let n of t)_3(e,n)}function _3(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 v3(e,t,n){if(!e.enabled)return;let r=e.sorts[t],i=i4(e.sharedInternalDocumentStore,n);r.docs.get(i)&&(r.docs.delete(i),r.orderedDocsToRemove.set(i,!0))}function y3(e,t,n){if(!e.enabled)throw W2(`SORT_DISABLED`);let r=n.property,i=n.order===`DESC`,a=e.sorts[r];if(!a)throw W2(`UNABLE_TO_SORT_ON_UNKNOWN_FIELD`,r,e.sortableProperties.join(`, `));return _3(e,r),d3(e),t.sort((t,n)=>{let r=a.docs.get(i4(e.sharedInternalDocumentStore,t[0])),o=a.docs.get(i4(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 b3(e){return e.enabled?e.sortableProperties:[]}function x3(e){return e.enabled?e.sortablePropertiesWithTypes:{}}function S3(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 C3(e){if(!e.enabled)return{enabled:!1};g3(e),d3(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 w3(){return{create:l3,insert:u3,remove:v3,save:C3,load:S3,sortBy:y3,getSortableProperties:b3,getSortablePropertiesWithTypes:x3}}const T3=[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 E3(e){return e<192||e>383?e:T3[e-192]||e}function D3(e){let t=[];for(let n=0;n<e.length;n++)t[n]=E3(e.charCodeAt(n));return String.fromCharCode(...t)}const O3={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`},k3={icate:`ic`,ative:``,alize:`al`,iciti:`ic`,ical:`ic`,ful:``,ness:``},A3=`[aeiouy]`,j3=`[^aeiou][^aeiouy]*`;A3+``;const M3=`^(`+j3+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*`;``+j3;const N3=`^(`+j3+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*`,P3=`^(`+j3+`)?[aeiouy]`;function F3(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(M3),r.test(t[1])&&(r=/.$/,e=e.replace(r,``))}else i.test(e)&&(t=i.exec(e)[1],i=new RegExp(P3),i.test(t)&&(e=t,i=/(at|bl|iz)$/,a=RegExp(`([^aeiouylsz])\\1$`),o=RegExp(`^`+j3+A3+`[^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(P3),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(M3),t&&r.test(t)&&(e=t+O3[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(M3),t&&r.test(t)&&(e=t+k3[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(N3),t&&r.test(t)&&(e=t);else if(i.test(e)){let n=i.exec(e);t=n?.[1]??``+n?.[2]??``,i=new RegExp(N3),i.test(t)&&(e=t)}return r=/^(.+?)e$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(N3),i=RegExp(`^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$`),a=RegExp(`^`+j3+A3+`[^aeiouwxy]$`),t&&(r.test(t)||i.test(t)&&!a.test(t))&&(e=t)),r=/ll$/,i=new RegExp(N3),r.test(e)&&i.test(e)&&(r=/.$/,e=e.replace(r,``)),s==`y`&&(e=s.toLowerCase()+e.substring(1)),e}function I3(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=D3(t),n&&this.normalizationCache.set(r,t),t)}function L3(e){for(;e[e.length-1]===``;)e.pop();for(;e[0]===``;)e.shift();return e}function R3(e,t,n,r=!0){if(t&&t!==this.language)throw W2(`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=d2[this.language];a=e.toLowerCase().split(t).map(e=>i(e,r)).filter(Boolean)}let o=L3(a);return this.allowDuplicates?o:Array.from(new Set(o))}function z3(e={}){if(!e.language)e.language=`english`;else if(!f2.includes(e.language))throw W2(`LANGUAGE_NOT_SUPPORTED`,e.language);let t;if(e.stemming||e.stemmer&&!(`stemming`in e))if(e.stemmer){if(typeof e.stemmer!=`function`)throw W2(`INVALID_STEMMER_FUNCTION_TYPE`);t=e.stemmer}else if(e.language===`english`)t=F3;else throw W2(`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 W2(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);if(!Array.isArray(n))throw W2(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);for(let e of n)if(typeof e!=`string`)throw W2(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`)}let r={tokenize:R3,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:I3,normalizationCache:new Map};return r.tokenize=R3.bind(r),r.normalizeToken=I3,r}function B3(e){return{sharedInternalDocumentStore:e,rules:new Map}}function V3(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 H3(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 U3(e,t){return e.rules.delete(t)}function W3(e,t){return e.rules.get(t)}function G3(e){return Array.from(e.rules.values())}function K3(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 q3(e,t){return e?t.conditions.every(t=>K3(e,t)):!1}function J3(e,t){if(!t)return[];let n=[];for(let r of e.rules.values())q3(t,r)&&n.push(r);return n}function Y3(e,t){return{sharedInternalDocumentStore:e,rules:new Map(t?.rules??[])}}function X3(e){return{rules:Array.from(e.rules.entries())}}function Z3(){return{create:B3,addRule:V3,updateRule:H3,removeRule:U3,getRule:W3,getAllRules:G3,getMatchingRules:J3,load:Y3,save:X3}}function Q3(e){let t={formatElapsedTime:G2,getDocumentIndexId:K2,getDocumentProperties:j2,validateSchema:q2};for(let n of y4){let r=n;if(e[r]){if(typeof e[r]!=`function`)throw W2(`COMPONENT_MUST_BE_FUNCTION`,r)}else e[r]=t[r]}for(let t of Object.keys(e))if(!v4.includes(t)&&!y4.includes(t))throw W2(`UNSUPPORTED_COMPONENT`,t)}function $3({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 W2(`PLUGIN_COMPONENT_CONFLICT`,e,t.name);r={...r,...n}}i||=D2();let o=r.tokenizer,s=r.index,c=r.documentsStore,l=r.sorter,u=r.pinning;if(o=o?o.tokenize?o:z3(o):z3({language:n??`english`}),r.tokenizer&&n)throw W2(`NO_LANGUAGE_WITH_CUSTOM_TOKENIZER`);let d=t4();s||=n3(),l||=w3(),c||=h4(),u||=Z3(),Q3(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:e6()};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 g4)g[e]=(g[e]??[]).concat(_4(g,e));let _=g.afterCreate;return _&&w4(_,g),g}function e6(){return`{{VERSION}}`}function t6(e){return e.documentsStore.count(e.data.docs)}function n6(e,t,n,r,i){let a=e.validateSchema(t,e.schema);if(a)throw W2(`SCHEMA_VALIDATION_FAILURE`,a);return I2(e.beforeInsert)||I2(e.afterInsert)||I2(e.index.beforeInsert)||I2(e.index.insert)||I2(e.index.afterInsert)?a6(e,t,n,r,i):o6(e,t,n,r,i)}const r6=new Set([`enum`,`enum[]`]),i6=new Set([`string`,`number`]);async function a6(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw W2(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=i4(e.internalDocumentIDStore,s);if(r||await b4(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw W2(`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];s6(n,r,e,t)}return await c6(e,s,u,f,l,n,t,i),r||await b4(e.afterInsert,e,s,t),s}function o6(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw W2(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=i4(e.internalDocumentIDStore,s);if(r||b4(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw W2(`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];s6(n,r,e,t)}return l6(e,s,u,f,l,n,t,i),r||b4(e.afterInsert,e,s,t),s}function s6(e,t,n,r){if(!(X2(t)&&typeof r==`object`&&typeof r.lon==`number`&&typeof r.lat==`number`)&&!(Z2(t)&&Array.isArray(r))&&!(Q2(t)&&Array.isArray(r))&&!(r6.has(t)&&i6.has(e))&&e!==t)throw W2(`INVALID_DOCUMENT_PROPERTY`,n,t,e)}async function c6(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 l6(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=i4(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 u6(e,t,n,r,i,a){return I2(e.afterInsertMultiple)||I2(e.beforeInsertMultiple)||I2(e.index.beforeInsert)||I2(e.index.insert)||I2(e.index.afterInsert)?d6(e,t,n,r,i,a):f6(e,t,n,r,i,a)}async function d6(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 n6(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&&H2(e)}}})(),i||await x4(e.afterInsertMultiple,e,t),o}function f6(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=n6(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&&H2(e)}}}return l(),i||x4(e.afterInsertMultiple,e,t),o}function p6(e,t,n,r){return I2(e.index.beforeRemove)||I2(e.index.remove)||I2(e.index.afterRemove)?m6(e,t,n,r):h6(e,t,n,r)}async function m6(e,t,n,r){let i=!0,{index:a,docs:o}=e.data,s=e.documentsStore.get(o,t);if(!s)return!1;let c=i4(e.internalDocumentIDStore,t),l=a4(e.internalDocumentIDStore,c),u=e.documentsStore.count(o);r||await b4(e.beforeRemove,e,l);let d=e.index.getSearchableProperties(a),f=e.index.getSearchablePropertiesWithTypes(a),p=e.getDocumentProperties(s,d);for(let r of d){let a=p[r];if(a===void 0)continue;let o=f[r];await e.index.beforeRemove?.(e.data.index,r,l,a,o,n,e.tokenizer,u),await e.index.remove(e.index,e.data.index,r,t,c,a,o,n,e.tokenizer,u)||(i=!1),await e.index.afterRemove?.(e.data.index,r,l,a,o,n,e.tokenizer,u)}let m=await e.sorter.getSortableProperties(e.data.sorting),h=await e.getDocumentProperties(s,m);for(let n of m)h[n]!==void 0&&e.sorter.remove(e.data.sorting,n,t);return r||await b4(e.afterRemove,e,l),e.documentsStore.remove(e.data.docs,t,c),i}function h6(e,t,n,r){let i=!0,{index:a,docs:o}=e.data,s=e.documentsStore.get(o,t);if(!s)return!1;let c=i4(e.internalDocumentIDStore,t),l=a4(e.internalDocumentIDStore,c),u=e.documentsStore.count(o);r||b4(e.beforeRemove,e,l);let d=e.index.getSearchableProperties(a),f=e.index.getSearchablePropertiesWithTypes(a),p=e.getDocumentProperties(s,d);for(let r of d){let a=p[r];if(a===void 0)continue;let o=f[r];e.index.beforeRemove?.(e.data.index,r,l,a,o,n,e.tokenizer,u),e.index.remove(e.index,e.data.index,r,t,c,a,o,n,e.tokenizer,u)||(i=!1),e.index.afterRemove?.(e.data.index,r,l,a,o,n,e.tokenizer,u)}let m=e.sorter.getSortableProperties(e.data.sorting),h=e.getDocumentProperties(s,m);for(let n of m)h[n]!==void 0&&e.sorter.remove(e.data.sorting,n,t);return r||b4(e.afterRemove,e,l),e.documentsStore.remove(e.data.docs,t,c),i}function g6(e,t,n,r,i){return I2(e.index.beforeRemove)||I2(e.index.remove)||I2(e.index.afterRemove)||I2(e.beforeRemoveMultiple)||I2(e.afterRemoveMultiple)?_6(e,t,n,r,i):v6(e,t,n,r,i)}async function _6(e,t,n,r,i){let a=0;n||=1e3;let o=i?[]:t.map(t=>a4(e.internalDocumentIDStore,i4(e.internalDocumentIDStore,t)));return i||await x4(e.beforeRemoveMultiple,e,o),await new Promise((o,s)=>{let c=0;async function l(){let u=t.slice(c*n,++c*n);if(!u.length)return o();for(let t of u)try{await p6(e,t,r,i)&&a++}catch(e){s(e)}setTimeout(l,0)}setTimeout(l,0)}),i||await x4(e.afterRemoveMultiple,e,o),a}function v6(e,t,n,r,i){let a=0;n||=1e3;let o=i?[]:t.map(t=>a4(e.internalDocumentIDStore,i4(e.internalDocumentIDStore,t)));i||x4(e.beforeRemoveMultiple,e,o);let s=0;function c(){let o=t.slice(s*n,++s*n);if(o.length){for(let t of o)p6(e,t,r,i)&&a++;setTimeout(c,0)}}return c(),i||x4(e.afterRemoveMultiple,e,o),a}function y6(e,t){return e[1]-t[1]}function b6(e,t){return t[1]-e[1]}function x6(e=`desc`){return e.toLowerCase()===`asc`?y6:b6}function S6(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(`.`)?M2(t,e):t[e],a=s[e],o=r[e].values;switch(a){case`number`:{let t=n[e].ranges;C6(t,o)(i);break}case`number[]`:{let t=new Set,r=n[e].ranges,a=C6(r,o,t);for(let e of i)a(e);break}case`boolean`:case`enum`:case`string`:w6(o,a)(i);break;case`boolean[]`:case`enum[]`:case`string[]`:{let e=w6(o,a===`boolean[]`?`boolean`:`string`,new Set);for(let t of i)e(t);break}default:throw W2(`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=x6(r.sort);t.values=Object.fromEntries(Object.entries(t.values).sort(i).slice(r.offset??0,r.limit??10))}}return r}function C6(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 w6(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 T6={reducer:(e,t,n,r)=>(t[r]=n,t),getInitialValue:e=>Array.from({length:e})},E6=[`string`,`number`,`boolean`];function D6(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 W2(`UNKNOWN_GROUP_BY_PROPERTY`,t);if(!E6.includes(a[t]))throw W2(`INVALID_GROUP_BY_PROPERTY`,t,E6.join(`, `),a[t])}let o=t.map(([t])=>a4(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=M2(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=O6(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=A2(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||T6,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 O6(e,t=0){if(t+1===e.length)return e[t].map(e=>[e]);let n=e[t],r=O6(e,t+1),i=[];for(let e of n)for(let t of r){let n=[e];b2(n,t),i.push(n)}return i}function k6(e,t,n,r){let i=J3(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=i4(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 A6(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 W2(`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=t6(e);if(l=e.index.search(a,r||``,e.tokenizer,n,o,t.exact||!1,t.tolerance||0,t.boost||{},F6(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=M6(r,e);if(typeof n==`string`&&t.every(e=>RegExp(`\\b${j6(e)}\\b`).test(n)))return!0}return!1})}}else l=s?o3(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 j6(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function M6(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 N6(e,t,n){let r=E2();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=A6(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])=>[i4(e.internalDocumentIDStore,t),n]);else d=d.sort(k2);d=k6(e,e.data.pinning,d,t.term);let f;u||(f=c?q6(e,d,s,o,c):J6(e,d,s,o));let p={elapsed:{formatted:``,raw:0},hits:[],count:d.length};return f!==void 0&&(p.hits=f.filter(Boolean),l||F2(p,i)),a&&(p.facets=S6(e,d,t.facets)),t.groupBy&&(p.groups=D6(e,d,t.groupBy)),p.elapsed=e.formatElapsedTime(E2()-r),p}async function a(){e.beforeSearch&&await C4(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await S4(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}const P6={k:1.2,b:.75,d:.5};function F6(e){let t=e??{};return t.k=t.k??P6.k,t.b=t.b??P6.b,t.d=t.d??P6.d,t}function I6(e,t,n){let r=t.vector;if(r&&(!(`value`in r)||!(`property`in r)))throw W2(`INVALID_VECTOR_INPUT`,Object.keys(r).join(`, `));let i=e.data.index.vectorIndexes[r.property];if(!i)throw W2(`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?W2(`INVALID_INPUT_VECTOR`,`undefined`,a,`undefined`):W2(`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 L6(e,t,n=`english`){let r=E2();function i(){let i=I6(e,t,n).sort(k2);i=k6(e,e.data.pinning,i,void 0);let a=[];t.facets&&Object.keys(t.facets).length>0&&(a=S6(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:a4(e.internalDocumentIDStore,n[0]),score:n[1],document:r})}let d=[];t.groupBy&&(d=D6(e,i,t.groupBy));let f=E2()-r;return{count:i.length,hits:u.filter(Boolean),elapsed:{raw:Number(f),formatted:T2(f)},...a?{facets:a}:{},...d?{groups:d}:{}}}async function a(){e.beforeSearch&&await C4(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await S4(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function R6(e,t,n){let r=V6(A6(e,t,n)),i=I6(e,t,n),a=t.hybridWeights;return W6(r,i,t.term??``,a)}function z6(e,t,n){let r=E2();function i(){let i=R6(e,t,n);i=k6(e,e.data.pinning,i,t.term);let a;t.facets&&Object.keys(t.facets).length>0&&(a=S6(e,i,t.facets));let o;t.groupBy&&(o=D6(e,i,t.groupBy));let s=t.offset??0,c=t.limit??10,l=J6(e,i,s,c).filter(Boolean),u=E2(),d={count:i.length,elapsed:{raw:Number(u-r),formatted:T2(u-r)},hits:l,...a?{facets:a}:{},...o?{groups:o}:{}};return(t.includeVectors??!1)||F2(d,Object.keys(e.data.index.vectorIndexes)),d}async function a(){e.beforeSearch&&await C4(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await S4(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function B6(e){return e[1]}function V6(e){let t=Math.max.apply(Math,e.map(B6));return e.map(([e,n])=>[e,n/t])}function H6(e,t){return e/t}function U6(e,t){return(n,r)=>n*e+r*t}function W6(e,t,n,r){let i=Math.max.apply(Math,e.map(B6)),a=Math.max.apply(Math,t.map(B6)),{text:o,vector:s}=r&&r.text&&r.vector?r:G6(n),c=new Map,l=e.length,u=U6(o,s);for(let t=0;t<l;t++){let[n,r]=e[t],a=u(H6(r,i),0);c.set(n,a)}let d=t.length;for(let e=0;e<d;e++){let[n,r]=t[e],i=H6(r,a),o=c.get(n)??0;c.set(n,o+u(0,i))}return[...c].sort((e,t)=>t[1]-e[1])}function G6(e){return{text:.5,vector:.5}}function K6(e,t,n){let r=t.mode??`fulltext`;if(r===`fulltext`)return N6(e,t,n);if(r===`vector`)return L6(e,t);if(r===`hybrid`)return z6(e,t);throw W2(`INVALID_SEARCH_MODE`,r)}function q6(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=M2(m,i);if(!(h===void 0||o.has(h))&&(o.set(h,!0),u++,!(u<=n)&&(s.push({id:a4(e.internalDocumentIDStore,f),score:p,document:m}),c.add(f),u>=n+r)))break}return s}function J6(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:a4(e.internalDocumentIDStore,r),score:c,document:t},o.add(r)}}return a}const Y6={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},X6=new WeakMap;function Z6(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function Q6(e){return e.trim().toLowerCase()}const $6=/\.(?:md|mdx)$/;function e8(e,t){if(t!==`page`)return e;let n=e.replace($6,``);return n.length>0?n:e}function t8(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function n8(e){let t=t8(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 r8(e){let t=$3({schema:Y6});return e.length>0&&u6(t,e),t}function i8(e){let t={documents:e};return X6.set(t,r8(e)),t}function a8(e){let t=X6.get(e);if(t)return t;let n=r8(e.documents);return X6.set(e,n),n}const o8=new WeakSet;function s8(e,t){return e===t||e.kind===t.kind&&e.path===t.path&&e.title===t.title&&e.name===t.name&&e.pathSegments===t.pathSegments&&e.modifiedTs===t.modifiedTs&&e.content===t.content}function c8(e,t){let n=e=>({corpus:i8(t),inserted:0,updated:0,removed:0,rebuilt:!0,rebuildReason:e}),r=X6.get(e);if(!r)return n(`no-index`);if(o8.has(e))return n(`stale-base`);let i=new Map(t.map(e=>[e.id,e]));if(i.size!==t.length)return n(`duplicate-id`);let a=[],o=[],s=0;for(let t of e.documents){let e=i.get(t.id);e?s8(t,e)||(a.push(t.id),o.push(e),s+=1):a.push(t.id)}let c=new Set(e.documents.map(e=>e.id));for(let e of t)c.has(e.id)||o.push(e);if(a.length+o.length>t.length)return n(`bulk-change`);o8.add(e);try{if(a.length>0&&g6(r,a),o.length>0&&u6(r,o),t6(r)!==t.length)throw Error(`Search index count ${t6(r)} diverged from document count ${t.length} after incremental update`)}catch{return n(`mutation-failed`)}let l={documents:t};return X6.set(l,r),{corpus:l,inserted:o.length-s,updated:s,removed:a.length-s,rebuilt:!1}}function l8(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function u8(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function d8(e,t){let n=Q6(t);if(!n)return 0;let r=e8(n,e.kind),i=Q6(e.title),a=Q6(e.name),o=Q6(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 f8(e,t){let n=d8(e,t);return n<=0?n:Fy(e.path)?n*.5:n}function p8(e){return e===`file`?-60:0}function m8(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 h8(e,t,n,r){return e+t*20+n+p8(r)}function g8(e,t,n,r,i,a){return e===`relevance`?h8(t,n,r,i):m8(t,n,r,i,a)}function _8(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function v8(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function y8(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 b8(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function x8(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 S8(e,t){return Q6(t).length<4?0:+(e===`full_text`)}function C8(e){let{lexical:t,fullText:n}=e.signals;return t>=500?`lexical`:t===450&&n<=0?`pathOnly`:`body`}function w8(e){let t=[],n=[],r=[];for(let i of e){let e=C8(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 T8(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=w8(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 E8(e,t,n={}){let r=n.intent??`omnibar`,i=_8(r,n.ranking),a=Z6(n.limit),o=new Set(n.scopes??l8(r)),s=e.documents.filter(e=>u8(e,o)),c=Q6(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=K6(a8(e),{term:c,properties:b8(r),boost:x8(r),tolerance:S8(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>u8(e.document,o)).map(e=>[e.document.id,e.score])),d=y8(s),f=new Map;for(let e of s)f8(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)u8(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=v8(f.values(),u);return T8([...f.values()].map(t=>{let n=Math.max(0,f8(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:g8(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 T8(O8({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function D8(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function O8(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=v8(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,f8(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?g8(o,t,n,s,e.kind,m):h8(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=D8(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)),_=D8(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),r=+(t.lexical>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}))}const k8=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),A8=globalThis;A8[k8]===void 0&&(A8[k8]=ne());const j8=A8[k8],M8=[`.ok`,`skill-state.yml`],N8=[`claude-cowork`,`cli-hosts`],P8=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],F8=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,I8=ee({version:b().regex(F8,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(j8,{description:`Recorded skill version for this target.`}),recordedAt:A().register(j8,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:i(P8).register(j8,{description:`Install-source surface that recorded this entry.`}).optional()}),L8=ee({enabled:k().register(j8,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:A().register(j8,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})}),R8=ee({schema:T(1).register(j8,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:ee({"claude-cowork":I8.optional(),"cli-hosts":I8.optional()}).register(j8,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:x(b(),L8).register(j8,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:D(b()).register(j8,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});function z8(e,t){return e??t.installedOnDisk}function B8(){return{schema:1,targets:{}}}const V8=16*1024*1024,H8=64*1024*1024,U8=ee({name:b(),description:b(),files:ee({skillMd:b(),scripts:D(b()),references:D(b())})}),W8=ee({pluginProvider:b().optional(),plugin:b().optional(),marketplace:b().optional(),version:b().optional(),gitCommitSha:b().optional(),scope:b().optional(),projectPath:b().optional()}),G8=ee({commands:k(),hooks:k(),mcp:k()}),K8=ee({...U8.shape,sourceHarness:b(),sourceHarnesses:D(b()),home:b(),provenance:W8,inert:G8}),q8=ee({schema:T(1),name:b(),version:b(),description:b().optional(),author:ee({name:b()}).optional(),skills:D(b()),hostCompatibility:D(b()).optional(),capabilities:ee({scripts:b(),network:b(),inert:D(b())}).optional(),provenance:ee({source:b(),ref:b(),contentHash:b()}).optional()}),J8=y({skills:D(K8),packs:D(q8)}).loose(),Y8=y({results:D(y({id:b().min(1),name:b().min(1),source:b().min(1),description:b(),installs:_().int().nonnegative().nullable(),publisher:b().nullable()}).loose()),backend:i([`skills.sh`,`github-fallback`]),degraded:k()}).loose(),X8=y({title:b(),description:b(),image:b().nullable(),skillsUrl:b().nullable(),sourceKind:i([`github`,`site`]),sourceUrl:b()}).loose(),Z8=y({skills:D(y({name:b(),description:b().nullable()}).loose())}).loose(),Q8=y({kind:i([`local`,`import`,`none`]),scope:i(Xe).optional(),name:b().optional(),dir:b().optional(),source:b().optional(),ref:b().optional(),via:i([`source`,`publisher`]).optional()}).loose(),$8=y({relPath:b(),content:b().nullable()}).loose(),e5=y({provider:b(),plugin:b(),version:b().optional(),marketplace:b().optional(),repositoryUrl:b().optional()}).loose(),t5=y({provider:b(),plugin:b(),version:b().optional(),description:b().optional(),repositoryUrl:b().optional(),bundledSkills:D(b()),capabilities:y({commands:k(),hooks:k(),mcp:k(),agents:k()}),setupSupported:k()}).loose(),n5=y({name:b(),description:b().nullable(),skillMd:b(),files:D($8),plugin:e5.optional(),pluginBundle:t5.optional()}).loose(),r5=new Set([`project`,`local`]);function i5(e){return e!==void 0&&r5.has(e)?`project`:`global`}function a5(e,t){let n=e=>e.replace(/\/+$/,``);return n(e)===n(t)}function o5(e,t){if(i5(e.scope)===`global`)return!0;let n=e.projectPath;return n===void 0||t===void 0?!0:a5(n,t)}const s5=/^([\w.-]+)\/([\w.-]+)$/,c5=/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function l5(e){let t=s5.exec(e);if(t){let[,e,n]=t;if(e&&n)return{kind:`github`,owner:e,repo:n}}return c5.test(e)?{kind:`site`,hostname:e}:null}function u5(e,t){let n=l5(e),r=t.trim();if(!n||!r)return null;let i=encodeURIComponent(r);if(n.kind===`github`){let e=encodeURIComponent(n.owner),t=encodeURIComponent(n.repo);return{sourceKind:`github`,skillsUrl:`https://www.skills.sh/${e}/${t}/${i}`,sourceUrl:`https://github.com/${e}/${t}`}}return{sourceKind:`site`,skillsUrl:`https://www.skills.sh/site/${encodeURIComponent(n.hostname)}/${i}`,sourceUrl:`https://${n.hostname}`}}function d5(e){return e.includes(`/`)?e.split(`/`)[0]??null:null}function f5(e){let t=e.split(`/`).pop();return t&&t.length>0?t:e}const p5=`template`;function m5(e){if(e.trim()===``)return{};let t;try{t=(0,ze.parse)(e)}catch{return{}}return typeof t!=`object`||!t||Array.isArray(t)?{}:t}function h5(e,t){return e.trim()===``?t:`---\n${e}\n---\n${t}`}function g5(e){let{frontmatter:t,body:n}=om(e);return t===``?{docFrontmatterText:``,markdown:e}:{docFrontmatterText:cm(t),markdown:n}}function _5(e){let t=e.split(`
|
|
342
342
|
`);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=m5(n.join(`
|
|
343
343
|
`))[p5];return{identity:typeof i==`object`&&i&&!Array.isArray(i)?i:{},docFrontmatterText:t.slice(r).join(`
|
|
344
344
|
`).replace(/\n+$/,``)}}function v5(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,{frontmatter:n,body:r}=om(t);if(n===``)return{identity:{},starterContent:t};let i=cm(n),a=_5(i);if(a)return{identity:a.identity,starterContent:h5(a.docFrontmatterText,r)};let{frontmatter:o}=om(r);if(o!==``)return{identity:m5(i),starterContent:r};let s=m5(i);return typeof s.title==`string`?{identity:s,starterContent:r}:{identity:{},starterContent:h5(i,r)}}function y5(e,t){let{docFrontmatterText:n,markdown:r}=g5(t),i={};for(let[t,n]of Object.entries(e))n!==void 0&&(i[t]=n);let a=(0,ze.stringify)({[p5]:i});return`---\n${n.trim()===``?a:`${a}${n}\n`}---\n${r}`}function b5(e){return v5(e).starterContent}const x5=`(agent thread)`;function S5(){let e=!1,t=``,n=0;return r=>{let i=C5(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 C5(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 w5=/^(#{1,6})\s+(.+)$/;function T5(e,t){let n=(e.endsWith(`\r`)?e.slice(0,-1):e).match(w5);if(!n)return null;let r=n[2].trim(),i=gY(r,t);return i?{level:n[1].length,text:r,slug:i}:null}const E5=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],D5={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function O5(e,t=E5){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const k5={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function A5(e){return e?k5[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const j5={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function M5(e){let t=e?.trim();return t?j5[A5(t)]??t:`Agent`}function N5(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 P5=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function F5(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function I5(e){let t=e.trim();return P5.test(t)||t.startsWith(`//`)}function L5(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(I5(n))return{kind:`external`,url:n};let r=n.indexOf(`#`),i=r<0?n:n.slice(0,r),a=at(i,t);if(a)return{kind:`doc`,docName:a,anchor:r<0?null:n.slice(r+1)};let o=it(i,t);if(o)return{kind:`doc`,docName:o,anchor:r<0?null:n.slice(r+1)};let s=N5(n,t);if(s)return{kind:`doc`,docName:s.docName,anchor:s.anchor};let c=F5(n);return c&&c!==`md`&&c!==`mdx`?{kind:`asset`,url:n,ext:c}:null}function R5(e,t){let n=e.trim();if(!n)return null;if(I5(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=F5(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function z5(e,t){let n=e.trim();if(!n||P5.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 B5(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function V5(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function H5(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function U5(e){return e.split(`/`).filter(e=>e!==``)}function W5(e,t){let n=H5(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function G5(e,t){let n=H5(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:U5(r).length}function K5(e,t){let n=U5(e),r=U5(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function q5(){let e=new Map;function t(t){let n=B5(t);if(n===``)return;let r=V5(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=B5(t),r=V5(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=H5(B5(n)),o=[],s=[];for(let e of i)W5(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=G5(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=G5(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=K5(a,H5(t));for(let r=1;r<e.length;r++){let i=e[r],o=K5(a,H5(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 J5(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 Y5(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}export{J0 as $,lb as $a,JJ as $i,_Q as $n,Xe as $o,QX as $r,u$ as $t,Y8 as A,dP as Aa,WY as Ai,A$ as An,At as Ao,kZ as Ar,l1 as At,n8 as B,Cb as Ba,uX as Bi,NQ as Bn,Ct as Bo,gZ as Br,q$ as Bt,i5 as C,aW as Ca,SX as Ci,j$ as Cn,Pt as Co,tQ as Cr,me as Cs,A1 as Ct,n5 as D,LV as Da,ZY as Di,HQ as Dn,Mt as Do,xZ as Dr,h1 as Dt,Z8 as E,YV as Ea,fX as Ei,n$ as En,jt as Eo,bZ as Er,D1 as Et,F8 as F,wb as Fa,nX as Fi,XQ as Fn,bt as Fo,TZ as Fr,e1 as Ft,c2 as G,Gy as Ga,NY as Gi,FQ as Gn,qe as Go,mZ as Gr,C$ as Gt,c8 as H,pb as Ha,BY as Hi,RQ as Hn,gt as Ho,sZ as Hr,kQ as Ht,R8 as I,yb as Ia,VY as Ii,KQ as In,xt as Io,CZ as Ir,Z$ as It,$0 as J,Yy as Ja,uY as Ji,GQ as Jn,Ge as Jo,fZ as Jr,L$ as Jt,l2 as K,Wy as Ka,MY as Ki,IQ as Kn,Ke as Ko,uZ as Kr,UQ as Kt,B8 as L,Ob as La,tX as Li,OQ as Ln,Tt as Lo,wZ as Lr,K$ as Lt,H8 as M,xb as Ma,aX as Mi,E$ as Mn,vt as Mo,EZ as Mr,n1 as Mt,M8 as N,Db as Na,cX as Ni,V$ as Nn,yt as No,MZ as Nr,t1 as Nt,Q8 as O,IV as Oa,UY as Oi,D$ as On,Ot as Oo,NZ as Or,m1 as Ot,N8 as P,bb as Pa,HY as Pi,H$ as Pn,Et as Po,PZ as Pr,$$ as Pt,X0 as Q,_b as Qa,sY as Qi,gQ as Qn,Ye as Qo,$X as Qr,l$ as Qt,z8 as R,Eb as Ra,$Y as Ri,EQ as Rn,St as Ro,SZ as Rr,Y$ as Rt,f5 as S,iW as Sa,wX as Si,e$ as Sn,It as So,eQ as Sr,P as Ss,k1 as St,X8 as T,uU as Ta,dX as Ti,t$ as Tn,Nt as To,$Z as Tr,E1 as Tt,i2 as U,hb as Ua,SY as Ui,BQ as Un,ht as Uo,cZ as Ur,AQ as Ut,E8 as V,fb as Va,LY as Vi,LQ as Vn,_t as Vo,oZ as Vr,G$ as Vt,s2 as W,Hy as Wa,jY as Wi,VQ as Wn,He as Wo,pZ as Wr,jQ as Wt,Q0 as X,eb as Xa,cY as Xi,xQ as Xn,tt as Xo,aZ as Xr,r$ as Xt,Y0 as Y,Qy as Ya,lY as Yi,TQ as Yn,We as Yo,rZ as Yr,I$ as Yt,Z0 as Z,gb as Za,oY as Zi,CQ as Zn,Je as Zo,tZ as Zr,c$ as Zt,b5 as _,sW as _a,RX as _i,s$ as _n,zt as _o,LZ as _r,xe as _s,W1 as _t,R5 as a,MJ as aa,KX as ai,h$ as an,jy as ao,pQ as ar,lt as as,P0 as at,l5 as b,xW as ba,CX as bi,QQ as bn,Gt as bo,JZ as br,he as bs,P1 as bt,D5 as c,kJ as ca,UX as ci,JQ as cn,Ty as co,uQ as cr,nt as cs,m0 as ct,A5 as d,WJ as da,MX as di,S$ as dn,om as do,RZ as dr,Be as ds,$1 as dt,ZJ as ea,nZ as ei,d$ as en,rb as eo,bQ as er,Ve as es,q0 as et,T5 as f,jJ as fa,jX as fi,z$ as fn,cm as fo,zZ as fr,Re as fs,e0 as ft,y5 as g,EJ as ga,FX as gi,o$ as gn,Kt as go,UZ as gr,Ce as gs,K1 as gt,p5 as h,DJ as ha,OX as hi,i$ as hn,F as ho,HZ as hr,Se as hs,q1 as ht,L5 as i,rY as ia,GX as ii,m$ as in,Ny as io,fQ as ir,$e as is,N0 as it,V8 as j,rN as ja,iX as ji,T$ as jn,Dt as jo,DZ as jr,Q$ as jt,J8 as k,yR as ka,rX as ki,k$ as kn,kt as ko,jZ as kr,i1 as kt,O5 as l,LJ as la,qX as li,B$ as ln,xy as lo,BZ as lr,at as ls,o0 as lt,x5 as m,BJ as ma,kX as mi,x$ as mn,zi as mo,ZZ as mr,Ee as ms,J1 as mt,Y5 as n,qJ as na,XX as ni,_$ as nn,tb as no,mQ as nr,Ze as ns,F0 as nt,z5 as o,NJ as oa,JX as oi,g$ as on,Ay as oo,cQ as or,ft as os,j0 as ot,S5 as p,HJ as pa,NX as pi,w$ as pn,Zd as po,XZ as pr,Te as ps,Z1 as pt,r2 as q,Xy as qa,mY as qi,PQ as qn,Ue as qo,lZ as qr,N$ as qt,q5 as r,nY as ra,ZX as ri,p$ as rn,Fy as ro,dQ as rr,mt as rs,V0 as rt,N5 as s,RJ as sa,HX as si,O$ as sn,Oy as so,lQ as sr,st as ss,u0 as st,J5 as t,GJ as ta,YX as ti,v$ as tn,ub as to,hQ as tr,Qe as ts,H0 as tt,M5 as u,UJ as ua,VX as ui,W$ as un,sm as uo,VZ as ur,ut as us,c0 as ut,v5 as v,lW as va,_X as vi,a$ as vn,Rt as vo,KZ as vr,_e as vs,U1 as vt,o5 as w,GU as wa,xX as wi,M$ as wn,Ft as wo,QZ as wr,fe as ws,N1 as wt,u5 as x,pW as xa,TX as xi,$Q as xn,Lt as xo,YZ as xr,ve as xs,L1 as xt,d5 as y,cW as ya,EX as yi,ZQ as yn,Wt as yo,WZ as yr,ge as ys,H1 as yt,i8 as z,Tb as za,lX as zi,zQ as zn,wt as zo,hZ as zr,J$ as zt};
|
|
345
|
-
//# sourceMappingURL=src-
|
|
345
|
+
//# sourceMappingURL=src-B9eLNT3o.mjs.map
|