@inkeep/open-knowledge 0.68.4-beta.0 → 0.68.4-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/{acp-harness-probe-DHPNTPAW.mjs → acp-harness-probe-C_3_wwAe.mjs} +2 -2
  2. package/dist/cli.mjs +6 -6
  3. package/dist/constants-DMZa5zQG.mjs +2 -0
  4. package/dist/{git-handle-DnoBon5O.mjs → git-handle-C9RU-MxT.mjs} +2 -2
  5. package/dist/git-handle-CzN6a5i1.mjs +1 -0
  6. package/dist/index.mjs +3 -3
  7. package/dist/{init-NLWQBOCI.mjs → init-DLQ79hjt.mjs} +3 -3
  8. package/dist/init-DW4PoVz_.mjs +1 -0
  9. package/dist/{launch-json-removal-BDX2jb-4.mjs → launch-json-removal-nqSmu4fN.mjs} +2 -2
  10. package/dist/loader-BA_dGJtf.mjs +1 -0
  11. package/dist/{loader-c29Dx87s.mjs → loader-D4Gb5uCH.mjs} +2 -2
  12. package/dist/md-manager-B0rABilg.mjs +2 -0
  13. package/dist/{open-browser-F9_RxhVL.mjs → open-browser-DxgGjEoj.mjs} +2 -2
  14. package/dist/parse-worker.mjs +1 -1
  15. package/dist/preview-B-771SYz.mjs +1 -0
  16. package/dist/{preview-BvikFuF1.mjs → preview-QbIfBqoY.mjs} +2 -2
  17. package/dist/public/assets/{ActivityModeContent-DpyVgHoT.js → ActivityModeContent-Co1JyqXQ.js} +1 -1
  18. package/dist/public/assets/{AddPropertiesButton-DEQfRnsk.js → AddPropertiesButton-b5lnEVKK.js} +2 -2
  19. package/dist/public/assets/{AgentDiffPane-Dbh2Ku2m.js → AgentDiffPane-DSyEDn_Y.js} +1 -1
  20. package/dist/public/assets/{AgentThreadClientBinder-BfzzW91s.js → AgentThreadClientBinder-g9d9BU09.js} +1 -1
  21. package/dist/public/assets/{BugReportHistory-BFeDHqqW.js → BugReportHistory-BYU251NU.js} +1 -1
  22. package/dist/public/assets/{BugReportHistoryDialog-BTq3iS9V.js → BugReportHistoryDialog-wi8j2imF.js} +1 -1
  23. package/dist/public/assets/CodeMirrorPropInput-2n_88FNl.js +3 -0
  24. package/dist/public/assets/{ConsentDialogBody-e0bDGpfC.js → ConsentDialogBody-D2QQqLvP.js} +1 -1
  25. package/dist/public/assets/{DiffViewBoundary-C_NVhw3Y.js → DiffViewBoundary-BIjXbCNm.js} +1 -1
  26. package/dist/public/assets/DocumentContext-C1MDqUGQ.js +38 -0
  27. package/dist/public/assets/{EditorModeToggle-ibhbLQIy.js → EditorModeToggle-PGfji8Z4.js} +1 -1
  28. package/dist/public/assets/{EnableSyncConfirmDialog-BcL75l3F.js → EnableSyncConfirmDialog-D73cTIc2.js} +1 -1
  29. package/dist/public/assets/{ExcalidrawDocEditor-BNHSMJQS.js → ExcalidrawDocEditor-DLYL4uLQ.js} +1 -1
  30. package/dist/public/assets/FeedbackForm-DgVONYW4.js +1 -0
  31. package/dist/public/assets/{GraphPanel-BUWA0D9J.js → GraphPanel-DODcHiM6.js} +2 -2
  32. package/dist/public/assets/{ImportSkillDialog-jFU7pbPY.js → ImportSkillDialog-SFJoXCHy.js} +1 -1
  33. package/dist/public/assets/{LintConfigEditor-D7YDlVNL.js → LintConfigEditor-cz4oBJkn.js} +1 -1
  34. package/dist/public/assets/ManagedArtifactProperties-D4in1i0d.js +1 -0
  35. package/dist/public/assets/{ManagedArtifactProperties-CZgD-BSq.js → ManagedArtifactProperties-DVYEs_-t.js} +1 -1
  36. package/dist/public/assets/{MermaidDocEditor-CxdG1bUB.js → MermaidDocEditor-BnbvkIUa.js} +1 -1
  37. package/dist/public/assets/{PropertyDisplayRow-B4oaLWuk.js → PropertyDisplayRow-DoKlSeCY.js} +1 -1
  38. package/dist/public/assets/{ReportBugDialogBody-B5V7nLOX.js → ReportBugDialogBody-Cn9kuPrd.js} +1 -1
  39. package/dist/public/assets/{ReportBugMenuTrigger-86Ew_tTi.js → ReportBugMenuTrigger-BWaaWbbQ.js} +2 -2
  40. package/dist/public/assets/{SchemaConfigEditor-Dm6jiRdF.js → SchemaConfigEditor-BqXzeHB3.js} +1 -1
  41. package/dist/public/assets/{SessionsHost-B8iiwkuP.js → SessionsHost-C1OZt5vc.js} +2 -2
  42. package/dist/public/assets/{SettingsDialogBody-CGru4MuC.js → SettingsDialogBody-DQtkh-bL.js} +4 -4
  43. package/dist/public/assets/{ShareBranchSwitchDialog-4R7TrS-D.js → ShareBranchSwitchDialog--N1Bd5qo.js} +1 -1
  44. package/dist/public/assets/{ShareReceiveDialog-Cmq2hZPb.js → ShareReceiveDialog-By6mslOj.js} +1 -1
  45. package/dist/public/assets/{ShareReceiveMissDialog-B0S_dCJU.js → ShareReceiveMissDialog-DrHrN8Zh.js} +1 -1
  46. package/dist/public/assets/{SkillCostValue-DHSmxhI-.js → SkillCostValue-CkONMU96.js} +1 -1
  47. package/dist/public/assets/{SkillEditBanner-B27-_Aay.js → SkillEditBanner-BkN4Vlyo.js} +1 -1
  48. package/dist/public/assets/{SkillForkDialog-BAZRmLVh.js → SkillForkDialog-Bkhm9FwF.js} +1 -1
  49. package/dist/public/assets/{SkillInstallMenu-Cw_GhQXv.js → SkillInstallMenu-DPBO7ZLl.js} +2 -2
  50. package/dist/public/assets/{SkillOriginInline-BSlC26uH.js → SkillOriginInline-DqGgPWeD.js} +1 -1
  51. package/dist/public/assets/{SkillToolbarControls-CKvPee0l.js → SkillToolbarControls-kSIovUXj.js} +1 -1
  52. package/dist/public/assets/{SlidesToolbarControls-BxNx9-Fx.js → SlidesToolbarControls-CloREzdd.js} +1 -1
  53. package/dist/public/assets/{SourceEditor-WIRsBFEm.js → SourceEditor-DxcW7Ji4.js} +1 -1
  54. package/dist/public/assets/{TerminalPanel-uwQJYmWz.js → TerminalPanel-zXPIa6n_.js} +1 -1
  55. package/dist/public/assets/{TerminalWindowApp-Beh9r_L9.js → TerminalWindowApp-Cpr1PRtm.js} +1 -1
  56. package/dist/public/assets/{TextDocEditor-otzsAiqo.js → TextDocEditor-CNvGi20m.js} +1 -1
  57. package/dist/public/assets/{ThreadView-DP20xiUN.js → ThreadView-BdfdaWKJ.js} +1 -1
  58. package/dist/public/assets/{TimelineDiffPane-BoPvynYM.js → TimelineDiffPane-BIR2lWwH.js} +1 -1
  59. package/dist/public/assets/{agent-diff-store-DVYE4Dgm.js → agent-diff-store-_WIhmrnK.js} +1 -1
  60. package/dist/public/assets/{auth-state-cache-q3yenLPa.js → auth-state-cache-BCDkELSW.js} +4 -4
  61. package/dist/public/assets/{bug-report-send-manager-TlhphH7d.js → bug-report-send-manager-BhNwFXTM.js} +1 -1
  62. package/dist/public/assets/{client-version-Celk29vl.js → client-version-DPdchc8q.js} +1 -1
  63. package/dist/public/assets/{comment-chips-DtlggR_o.js → comment-chips-SxWcQbb_.js} +1 -1
  64. package/dist/public/assets/config-provider-CFXUtiwu.js +5 -0
  65. package/dist/public/assets/{dist-CMzT53pm.js → dist-CDr44_5B.js} +3 -3
  66. package/dist/public/assets/{doc-hash-CbN6l-bN.js → doc-hash-CbPdvdAA.js} +1 -1
  67. package/dist/public/assets/{documents-events-BQph4Rf_.js → documents-events-CRdjzLAr.js} +1 -1
  68. package/dist/public/assets/{file-tree-adapter-BpMqjQeh.js → file-tree-adapter-Bg4PgS4F.js} +1 -1
  69. package/dist/public/assets/{file-tree-utils-D3vfryrA.js → file-tree-utils-Dt-qVN4W.js} +1 -1
  70. package/dist/public/assets/{folder-config-api-BGqXA_Yc.js → folder-config-api-Do2u-Rpg.js} +1 -1
  71. package/dist/public/assets/{globals-CL98nbsz.css → globals-ByagJMEb.css} +1 -1
  72. package/dist/public/assets/i18n-CApFNCKM.js +1 -0
  73. package/dist/public/assets/{index-DOJcKH7u.js → index-DWEZyyUh.js} +14 -14
  74. package/dist/public/assets/{launcher-selection-Q4ZIQ0VB.js → launcher-selection-BtAC_6OE.js} +1 -1
  75. package/dist/public/assets/{lint-config-client-nUUp3gxC.js → lint-config-client-C7Do4K-V.js} +1 -1
  76. package/dist/public/assets/{markdownlint-rule-browser-Dw2Ln--S.js → markdownlint-rule-browser-BuLeocmZ.js} +1 -1
  77. package/dist/public/assets/messages-6fcD2J3f.js +1 -0
  78. package/dist/public/assets/messages-BcgMON4t.js +1 -0
  79. package/dist/public/assets/messages-BfSRfllp.js +1 -0
  80. package/dist/public/assets/messages-BzB2vjb8.js +1 -0
  81. package/dist/public/assets/messages-CFC4xaZ5.js +1 -0
  82. package/dist/public/assets/messages-CHyeSnWa.js +1 -0
  83. package/dist/public/assets/messages-DZE-VzhB.js +1 -0
  84. package/dist/public/assets/messages-DZfszRg3.js +1 -0
  85. package/dist/public/assets/messages-DnatZmOM.js +1 -0
  86. package/dist/public/assets/messages-DrjcM4fb.js +1 -0
  87. package/dist/public/assets/messages-DvrupXSr.js +1 -0
  88. package/dist/public/assets/messages-DwrUkQ2i.js +1 -0
  89. package/dist/public/assets/page-list-cache-VMIjzKn4.js +1 -0
  90. package/dist/public/assets/{pending-receive-nav-store-YB8g1-yz.js → pending-receive-nav-store-DWGtNmXZ.js} +1 -1
  91. package/dist/public/assets/{progress-B1dcJzAD.js → progress-mhZcxRBo.js} +3 -3
  92. package/dist/public/assets/{project-paths-5B1myPxo.js → project-paths-BhoLIJti.js} +1 -1
  93. package/dist/public/assets/{prop-types-BkTKnQXu.js → prop-types-CUmrzSW1.js} +1 -1
  94. package/dist/public/assets/{receive-store-BQjSh3hv.js → receive-store-D2_q1wUu.js} +1 -1
  95. package/dist/public/assets/{selection-context-DrNiKImh.js → selection-context-EAVqhQEK.js} +1 -1
  96. package/dist/public/assets/{skill-scope-QdZW9jQB.js → skill-scope-NCYHirwV.js} +1 -1
  97. package/dist/public/assets/{skills-api-_0gvQ7uH.js → skills-api-Dz_rVA1C.js} +1 -1
  98. package/dist/public/assets/{src-DIGxVClC.js → src-DuGGvfdD.js} +1 -1
  99. package/dist/public/assets/{startup-marks-BrgDU-FF.js → startup-marks-BPR5ipj8.js} +1 -1
  100. package/dist/public/assets/{tag-pill-input-ORi2pYBF.js → tag-pill-input-CYAsZCew.js} +1 -1
  101. package/dist/public/assets/{target-navigation-intent-BE1C7c1m.js → target-navigation-intent-CYAnPRok.js} +1 -1
  102. package/dist/public/assets/{telemetry-startup-BJDvRilA.js → telemetry-startup-kezMCRHJ.js} +1 -1
  103. package/dist/public/assets/{terminal-cli-display-BBkrKOa9.js → terminal-cli-display-jaULlk-O.js} +1 -1
  104. package/dist/public/assets/{terminal-command-events-De5Ifk_s.js → terminal-command-events-D5gbDNfs.js} +1 -1
  105. package/dist/public/assets/typing-burst-detector-Dc6Z0dV2.js +8 -0
  106. package/dist/public/assets/{uninstall-4tf55J2_.js → uninstall-DAcZS1HG.js} +1 -1
  107. package/dist/public/assets/{use-activity-panel-DL_QQUqS.js → use-activity-panel-C8rnLWCk.js} +1 -1
  108. package/dist/public/assets/{use-apply-config-color-theme-B7J-6HE8.js → use-apply-config-color-theme-C3t6RLOI.js} +1 -1
  109. package/dist/public/assets/{use-collab-url-2h75iiK6.js → use-collab-url-CUI36lWb.js} +1 -1
  110. package/dist/public/assets/{use-conflicts-aEERGkga.js → use-conflicts-CBdH6psn.js} +1 -1
  111. package/dist/public/assets/{use-live-xterm-theme-tJoPOgqZ.js → use-live-xterm-theme-mYE4hguI.js} +1 -1
  112. package/dist/public/assets/{use-open-skill-DIebCcK8.js → use-open-skill-1xuIk7AK.js} +1 -1
  113. package/dist/public/assets/{use-settings-route-DwMidANO.js → use-settings-route-C_HC7gny.js} +1 -1
  114. package/dist/public/assets/{use-skill-origin-BCC3l5H8.js → use-skill-origin-BKe9dbHW.js} +1 -1
  115. package/dist/public/assets/{use-skills-rVlSdbIJ.js → use-skills-BhaOexz2.js} +1 -1
  116. package/dist/public/assets/{use-terminal-enabled-EXyL5BtZ.js → use-terminal-enabled-M2ci--Ho.js} +1 -1
  117. package/dist/public/assets/use-timeline-entry-diff-CIsFdF1_.js +6 -0
  118. package/dist/public/assets/{use-workspace-BzePm1UL.js → use-workspace-BHq7gCE9.js} +1 -1
  119. package/dist/public/index.html +52 -52
  120. package/dist/public/uninstall.html +6 -6
  121. package/dist/{repair-launch-json-CYrgkeXs.mjs → repair-launch-json-Cf98tAL2.mjs} +2 -2
  122. package/dist/{repair-mcp-configs-Doum-Sk9.mjs → repair-mcp-configs-BDUoYSqZ.mjs} +2 -2
  123. package/dist/{repair-skills-B4Ie9zFi.mjs → repair-skills-C8i0m9eF.mjs} +2 -2
  124. package/dist/repair-skills-WzWxastJ.mjs +1 -0
  125. package/dist/{resolve-project-root-CRNVR4G6.mjs → resolve-project-root-DbR2ne4Y.mjs} +2 -2
  126. package/dist/{server-lock-BIDrb6q3.mjs → server-lock-CGm9uKLf.mjs} +2 -2
  127. package/dist/server-lock-CHQfzAi7.mjs +1 -0
  128. package/dist/{skill-teardown-BkKm3Pt9.mjs → skill-teardown-ByJL1y5S.mjs} +2 -2
  129. package/dist/{src-BJWagnEk.mjs → src-B7MPIdgi.mjs} +2 -2
  130. package/dist/src-Bh9AbwbZ.mjs +1 -0
  131. package/dist/{src-CDcerRX2.mjs → src-CIngi0dD.mjs} +3 -3
  132. package/dist/{src-C_6FcYaw.mjs → src-DoNjy6J-.mjs} +4 -4
  133. package/dist/{src-DOJwM-g6.mjs → src-Dp7hirDl.mjs} +1 -1
  134. package/dist/{start-BQkQRbu6.mjs → start-CyKXYuNo.mjs} +3 -3
  135. package/dist/start-DgBREyCm.mjs +1 -0
  136. package/package.json +4 -4
  137. package/dist/constants-x2sw3BhG.mjs +0 -2
  138. package/dist/git-handle-CgzfmB2x.mjs +0 -1
  139. package/dist/init-_Kckfs8h.mjs +0 -1
  140. package/dist/loader-qy5vX1uK.mjs +0 -1
  141. package/dist/md-manager-BcWiy3AP.mjs +0 -2
  142. package/dist/preview-o83fzdre.mjs +0 -1
  143. package/dist/public/assets/CodeMirrorPropInput-CGzVH90R.js +0 -3
  144. package/dist/public/assets/DocumentContext-ClyIRsul.js +0 -38
  145. package/dist/public/assets/FeedbackForm-CGeSSXdH.js +0 -1
  146. package/dist/public/assets/ManagedArtifactProperties-Dui05152.js +0 -1
  147. package/dist/public/assets/config-provider-BOrlbspR.js +0 -5
  148. package/dist/public/assets/i18n-DOzrqmfh.js +0 -1
  149. package/dist/public/assets/messages-BFk3Lbb9.js +0 -1
  150. package/dist/public/assets/messages-BNDQG0rj.js +0 -1
  151. package/dist/public/assets/messages-BuzgKw3_.js +0 -1
  152. package/dist/public/assets/messages-BxF4_NK8.js +0 -1
  153. package/dist/public/assets/messages-CE6e4GL6.js +0 -1
  154. package/dist/public/assets/messages-CNIbN9u4.js +0 -1
  155. package/dist/public/assets/messages-CnEItHo-.js +0 -1
  156. package/dist/public/assets/messages-DANL5pZx.js +0 -1
  157. package/dist/public/assets/messages-DORMb6Q5.js +0 -1
  158. package/dist/public/assets/messages-DxrZl_3h.js +0 -1
  159. package/dist/public/assets/messages-RozmOeuj.js +0 -1
  160. package/dist/public/assets/messages-f6yF6x8h.js +0 -1
  161. package/dist/public/assets/page-list-cache-D2uEX_G6.js +0 -1
  162. package/dist/public/assets/typing-burst-detector-QMNs16Vx.js +0 -8
  163. package/dist/public/assets/use-timeline-entry-diff-D0zdVNJx.js +0 -6
  164. package/dist/repair-skills-Nir-boO_.mjs +0 -1
  165. package/dist/server-lock-C1GmzCcn.mjs +0 -1
  166. package/dist/src-DUxLgY5j.mjs +0 -1
  167. package/dist/start-DrdcM8ZS.mjs +0 -1
  168. /package/dist/public/assets/{globals-QZHWoM5P.js → globals-DIT-uAXH.js} +0 -0
package/dist/index.mjs CHANGED
@@ -181,7 +181,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
181
181
 
182
182
  `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Pn,s=!xn.jitless,c=s&&hee.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Pr([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Fr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Bn(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Wn(e,r,Sn())))}),t)}const Ir=P(`$ZodUnion`,(e,t)=>{Er.init(e,t),kn(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),kn(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),kn(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),kn(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Dn(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Fr(t,r,e,i)):Fr(o,r,e,i)}}),Vte=P(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Ir.init(e,t);let n=e._zod.parse;kn(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Tn(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!Pn(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Hte=P(`$ZodIntersection`,(e,t)=>{Er.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Rr(e,t,n)):Rr(e,i,a)}});function Lr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Fn(e)&&Fn(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Lr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Lr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Rr(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Bn(e))return e;let o=Lr(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const Ute=P(`$ZodRecord`,(e,t)=>{Er.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Fn(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>Wn(e,r,Sn())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...Hn(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...Hn(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&br.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Wn(e,r,Sn())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...Hn(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Hn(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Wte=P(`$ZodEnum`,(e,t)=>{Er.init(e,t);let n=Cn(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>gee.has(typeof e)).map(e=>typeof e==`string`?Ln(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Gte=P(`$ZodLiteral`,(e,t)=>{if(Er.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Ln(e):e?Ln(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Kte=P(`$ZodTransform`,(e,t)=>{Er.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new bn(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new yn;return n.value=i,n.fallback=!0,n}});function zr(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Br=P(`$ZodOptional`,(e,t)=>{Er.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,kn(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),kn(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Dn(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>zr(e,r)):zr(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),qte=P(`$ZodExactOptional`,(e,t)=>{Br.init(e,t),kn(e._zod,`values`,()=>t.innerType._zod.values),kn(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Jte=P(`$ZodNullable`,(e,t)=>{Er.init(e,t),kn(e._zod,`optin`,()=>t.innerType._zod.optin),kn(e._zod,`optout`,()=>t.innerType._zod.optout),kn(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Dn(e.source)}|null)$`):void 0}),kn(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Yte=P(`$ZodDefault`,(e,t)=>{Er.init(e,t),e._zod.optin=`optional`,kn(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Vr(e,t)):Vr(r,t)}});function Vr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Xte=P(`$ZodPrefault`,(e,t)=>{Er.init(e,t),e._zod.optin=`optional`,kn(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Hr=P(`$ZodNonOptional`,(e,t)=>{Er.init(e,t),kn(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Ur(t,e)):Ur(i,e)}});function Ur(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const Wr=P(`$ZodCatch`,(e,t)=>{Er.init(e,t),e._zod.optin=`optional`,kn(e._zod,`optout`,()=>t.innerType._zod.optout),kn(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Wn(e,n,Sn()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Wn(e,n,Sn()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Gr=P(`$ZodPipe`,(e,t)=>{Er.init(e,t),kn(e._zod,`values`,()=>t.in._zod.values),kn(e._zod,`optin`,()=>t.in._zod.optin),kn(e._zod,`optout`,()=>t.out._zod.optout),kn(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Kr(e,t.in,n)):Kr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Kr(e,t.out,n)):Kr(r,t.out,n)}});function Kr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const qr=P(`$ZodPreprocess`,(e,t)=>{Gr.init(e,t)}),Jr=P(`$ZodReadonly`,(e,t)=>{Er.init(e,t),kn(e._zod,`propValues`,()=>t.innerType._zod.propValues),kn(e._zod,`values`,()=>t.innerType._zod.values),kn(e._zod,`optin`,()=>t.innerType?._zod?.optin),kn(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Yr):Yr(r)}});function Yr(e){return e.value=Object.freeze(e.value),e}const Xr=P(`$ZodLazy`,(e,t)=>{Er.init(e,t),kn(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),kn(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),kn(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),kn(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),kn(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Zr=P(`$ZodCustom`,(e,t)=>{xr.init(e,t),Er.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Qr(t,n,r,e));Qr(i,n,r,e)}});function Qr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Kn(e))}}var $r,ei=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function ti(){return new ei}($r=globalThis).__zod_globalRegistry??($r.__zod_globalRegistry=ti());const ni=globalThis.__zod_globalRegistry;function ri(e,t){return new e({type:`string`,...zn(t)})}function ii(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...zn(t)})}function ai(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...zn(t)})}function oi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...zn(t)})}function si(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...zn(t)})}function ci(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...zn(t)})}function li(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...zn(t)})}function ui(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...zn(t)})}function di(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...zn(t)})}function fi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...zn(t)})}function pi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...zn(t)})}function mi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...zn(t)})}function hi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...zn(t)})}function gi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...zn(t)})}function _i(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...zn(t)})}function vi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...zn(t)})}function yi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...zn(t)})}function bi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...zn(t)})}function xi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...zn(t)})}function Si(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...zn(t)})}function Ci(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...zn(t)})}function wi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...zn(t)})}function Ti(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...zn(t)})}function Ei(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...zn(t)})}function Di(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...zn(t)})}function Oi(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...zn(t)})}function ki(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...zn(t)})}function Ai(e,t){return new e({type:`number`,checks:[],...zn(t)})}function ji(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...zn(t)})}function Mi(e,t){return new e({type:`boolean`,...zn(t)})}function Ni(e,t){return new e({type:`null`,...zn(t)})}function Pi(e){return new e({type:`unknown`})}function Fi(e,t){return new e({type:`never`,...zn(t)})}function Ii(e,t){return new Cr({check:`less_than`,...zn(t),value:e,inclusive:!1})}function Li(e,t){return new Cr({check:`less_than`,...zn(t),value:e,inclusive:!0})}function Ri(e,t){return new wr({check:`greater_than`,...zn(t),value:e,inclusive:!1})}function zi(e,t){return new wr({check:`greater_than`,...zn(t),value:e,inclusive:!0})}function Bi(e,t){return new Jee({check:`multiple_of`,...zn(t),value:e})}function Vi(e,t){return new Xee({check:`max_length`,...zn(t),maximum:e})}function Hi(e,t){return new Zee({check:`min_length`,...zn(t),minimum:e})}function Ui(e,t){return new Qee({check:`length_equals`,...zn(t),length:e})}function Wi(e,t){return new $ee({check:`string_format`,format:`regex`,...zn(t),pattern:e})}function Gi(e){return new ete({check:`string_format`,format:`lowercase`,...zn(e)})}function Ki(e){return new tte({check:`string_format`,format:`uppercase`,...zn(e)})}function qi(e,t){return new nte({check:`string_format`,format:`includes`,...zn(t),includes:e})}function Ji(e,t){return new rte({check:`string_format`,format:`starts_with`,...zn(t),prefix:e})}function Yi(e,t){return new ite({check:`string_format`,format:`ends_with`,...zn(t),suffix:e})}function Xi(e){return new ate({check:`overwrite`,tx:e})}function Zi(e){return Xi(t=>t.normalize(e))}function Qi(){return Xi(e=>e.trim())}function $i(){return Xi(e=>e.toLowerCase())}function ea(){return Xi(e=>e.toUpperCase())}function ta(){return Xi(e=>mee(e))}function na(e,t,n){return new e({type:`array`,element:t,...zn(n)})}function ra(e,t,n){let r=zn(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function ia(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...zn(n)})}function aa(e,t){let n=oa(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Kn(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Kn(r))}},e(t.value,t)),t);return n}function oa(e,t){let n=new xr({check:`custom`,...zn(t)});return n._zod.check=e,n}function sa(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??ni,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function ca(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,ca(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&da(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function la(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
183
183
 
184
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ua(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:pa(t,`input`,e.processors),output:pa(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function da(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return da(r.element,n);if(r.type===`set`)return da(r.valueType,n);if(r.type===`lazy`)return da(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return da(r.innerType,n);if(r.type===`intersection`)return da(r.left,n)||da(r.right,n);if(r.type===`record`||r.type===`map`)return da(r.keyType,n)||da(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:da(r.in,n)||da(r.out,n);if(r.type===`object`){for(let e in r.shape)if(da(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(da(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(da(e,n))return!0;return!!(r.rest&&da(r.rest,n))}return!1}const fa=(e,t={})=>n=>{let r=sa({...n,processors:t});return ca(e,r),la(r,e),ua(r,e)},pa=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=sa({...i??{},target:a,io:t,processors:n});return ca(e,o),la(o,e),ua(o,e)},ma={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ha=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ma[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},ga=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},_a=(e,t,n,r)=>{n.type=`boolean`},va=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},ya=(e,t,n,r)=>{n.not={}},ba=(e,t,n,r)=>{let i=e._zod.def,a=Cn(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},xa=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Sa=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Ca=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},wa=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=ca(a.element,t,{...r,path:[...r.path,`items`]})},Ta=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=ca(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=ca(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ea=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>ca(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Da=(e,t,n,r)=>{let i=e._zod.def,a=ca(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=ca(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Oa=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=ca(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=ca(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=ca(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},ka=(e,t,n,r)=>{let i=e._zod.def,a=ca(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Aa=(e,t,n,r)=>{let i=e._zod.def;ca(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ja=(e,t,n,r)=>{let i=e._zod.def;ca(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ma=(e,t,n,r)=>{let i=e._zod.def;ca(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Na=(e,t,n,r)=>{let i=e._zod.def;ca(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Pa=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;ca(o,t,r);let s=t.seen.get(e);s.ref=o},Fa=(e,t,n,r)=>{let i=e._zod.def;ca(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ia=(e,t,n,r)=>{let i=e._zod.def;ca(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},La=(e,t,n,r)=>{let i=e._zod.innerType;ca(i,t,r);let a=t.seen.get(e);a.ref=i},Ra=P(`ZodISODateTime`,(e,t)=>{yte.init(e,t),lo.init(e,t)});function za(e){return Ei(Ra,e)}const Ba=P(`ZodISODate`,(e,t)=>{bte.init(e,t),lo.init(e,t)});function Va(e){return Di(Ba,e)}const Ha=P(`ZodISOTime`,(e,t)=>{xte.init(e,t),lo.init(e,t)});function Ua(e){return Oi(Ha,e)}const Wa=P(`ZodISODuration`,(e,t)=>{Ste.init(e,t),lo.init(e,t)});function Ga(e){return ki(Wa,e)}const Ka=P(`ZodError`,(e,t)=>{Jn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Zn(e,t)},flatten:{value:t=>Xn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,wn,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,wn,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),qa=Qn(Ka),Ja=$n(Ka),Ya=er(Ka),Xa=nr(Ka),Za=ir(Ka),Qa=ar(Ka),$a=or(Ka),eo=sr(Ka),to=cr(Ka),no=lr(Ka),ro=ur(Ka),io=dr(Ka),ao=new WeakMap;function oo(e,t,n){let r=Object.getPrototypeOf(e),i=ao.get(r);if(i||(i=new Set,ao.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const so=P(`ZodType`,(e,t)=>(Er.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:pa(e,`input`),output:pa(e,`output`)}}),e.toJSONSchema=fa(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>qa(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ya(e,t,n),e.parseAsync=async(t,n)=>Ja(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Xa(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Za(e,t,n),e.decode=(t,n)=>Qa(e,t,n),e.encodeAsync=async(t,n)=>$a(e,t,n),e.decodeAsync=async(t,n)=>eo(e,t,n),e.safeEncode=(t,n)=>to(e,t,n),e.safeDecode=(t,n)=>no(e,t,n),e.safeEncodeAsync=async(t,n)=>ro(e,t,n),e.safeDecodeAsync=async(t,n)=>io(e,t,n),oo(e,`ZodType`,{check(...e){let t=this.def;return this.clone(jn(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Rn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Bne(e,t))},superRefine(e,t){return this.check(Vne(e,t))},overwrite(e){return this.check(Xi(e))},optional(){return Oo(this)},exactOptional(){return Dne(this)},nullable(){return ko(this)},nullish(){return Oo(ko(this))},nonoptional(e){return Nne(this,e)},array(){return z(this)},or(e){return xo([this,e])},and(e){return Co(this,e)},transform(e){return Mo(this,Eo(e))},default(e){return Ane(this,e)},prefault(e){return Mne(this,e)},catch(e){return Fne(this,e)},pipe(e){return Mo(this,e)},readonly(){return Rne(this)},describe(e){let t=this.clone();return ni.add(t,{description:e}),t},meta(...e){if(e.length===0)return ni.get(this);let t=this.clone();return ni.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,`description`,{get(){return ni.get(e)?.description},configurable:!0}),e)),co=P(`_ZodString`,(e,t)=>{Dr.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ha(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,oo(e,`_ZodString`,{regex(...e){return this.check(Wi(...e))},includes(...e){return this.check(qi(...e))},startsWith(...e){return this.check(Ji(...e))},endsWith(...e){return this.check(Yi(...e))},min(...e){return this.check(Hi(...e))},max(...e){return this.check(Vi(...e))},length(...e){return this.check(Ui(...e))},nonempty(...e){return this.check(Hi(1,...e))},lowercase(e){return this.check(Gi(e))},uppercase(e){return this.check(Ki(e))},trim(){return this.check(Qi())},normalize(...e){return this.check(Zi(...e))},toLowerCase(){return this.check($i())},toUpperCase(){return this.check(ea())},slugify(){return this.check(ta())}})}),Zte=P(`ZodString`,(e,t)=>{Dr.init(e,t),co.init(e,t),e.email=t=>e.check(ii(Qte,t)),e.url=t=>e.check(ui(po,t)),e.jwt=t=>e.check(Ti(mne,t)),e.emoji=t=>e.check(di(ene,t)),e.guid=t=>e.check(ai(uo,t)),e.uuid=t=>e.check(oi(fo,t)),e.uuidv4=t=>e.check(si(fo,t)),e.uuidv6=t=>e.check(ci(fo,t)),e.uuidv7=t=>e.check(li(fo,t)),e.nanoid=t=>e.check(fi(tne,t)),e.guid=t=>e.check(ai(uo,t)),e.cuid=t=>e.check(pi(nne,t)),e.cuid2=t=>e.check(mi(rne,t)),e.ulid=t=>e.check(hi(ine,t)),e.base64=t=>e.check(Si(dne,t)),e.base64url=t=>e.check(Ci(fne,t)),e.xid=t=>e.check(gi(ane,t)),e.ksuid=t=>e.check(_i(one,t)),e.ipv4=t=>e.check(vi(sne,t)),e.ipv6=t=>e.check(yi(cne,t)),e.cidrv4=t=>e.check(bi(lne,t)),e.cidrv6=t=>e.check(xi(une,t)),e.e164=t=>e.check(wi(pne,t)),e.datetime=t=>e.check(za(t)),e.date=t=>e.check(Va(t)),e.time=t=>e.check(Ua(t)),e.duration=t=>e.check(Ga(t))});function F(e){return ri(Zte,e)}const lo=P(`ZodStringFormat`,(e,t)=>{Or.init(e,t),co.init(e,t)}),Qte=P(`ZodEmail`,(e,t)=>{ute.init(e,t),lo.init(e,t)}),uo=P(`ZodGUID`,(e,t)=>{cte.init(e,t),lo.init(e,t)}),fo=P(`ZodUUID`,(e,t)=>{lte.init(e,t),lo.init(e,t)});function $te(e){return oi(fo,e)}const po=P(`ZodURL`,(e,t)=>{dte.init(e,t),lo.init(e,t)});function mo(e){return ui(po,e)}const ene=P(`ZodEmoji`,(e,t)=>{fte.init(e,t),lo.init(e,t)}),tne=P(`ZodNanoID`,(e,t)=>{pte.init(e,t),lo.init(e,t)}),nne=P(`ZodCUID`,(e,t)=>{mte.init(e,t),lo.init(e,t)}),rne=P(`ZodCUID2`,(e,t)=>{hte.init(e,t),lo.init(e,t)}),ine=P(`ZodULID`,(e,t)=>{gte.init(e,t),lo.init(e,t)}),ane=P(`ZodXID`,(e,t)=>{_te.init(e,t),lo.init(e,t)}),one=P(`ZodKSUID`,(e,t)=>{vte.init(e,t),lo.init(e,t)}),sne=P(`ZodIPv4`,(e,t)=>{Cte.init(e,t),lo.init(e,t)}),cne=P(`ZodIPv6`,(e,t)=>{wte.init(e,t),lo.init(e,t)}),lne=P(`ZodCIDRv4`,(e,t)=>{Tte.init(e,t),lo.init(e,t)}),une=P(`ZodCIDRv6`,(e,t)=>{Ete.init(e,t),lo.init(e,t)}),dne=P(`ZodBase64`,(e,t)=>{Dte.init(e,t),lo.init(e,t)}),fne=P(`ZodBase64URL`,(e,t)=>{kte.init(e,t),lo.init(e,t)}),pne=P(`ZodE164`,(e,t)=>{Ate.init(e,t),lo.init(e,t)}),mne=P(`ZodJWT`,(e,t)=>{Mte.init(e,t),lo.init(e,t)}),ho=P(`ZodNumber`,(e,t)=>{Ar.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ga(e,t,n,r),oo(e,`ZodNumber`,{gt(e,t){return this.check(Ri(e,t))},gte(e,t){return this.check(zi(e,t))},min(e,t){return this.check(zi(e,t))},lt(e,t){return this.check(Ii(e,t))},lte(e,t){return this.check(Li(e,t))},max(e,t){return this.check(Li(e,t))},int(e){return this.check(go(e))},safe(e){return this.check(go(e))},positive(e){return this.check(Ri(0,e))},nonnegative(e){return this.check(zi(0,e))},negative(e){return this.check(Ii(0,e))},nonpositive(e){return this.check(Li(0,e))},multipleOf(e,t){return this.check(Bi(e,t))},step(e,t){return this.check(Bi(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function I(e){return Ai(ho,e)}const hne=P(`ZodNumberFormat`,(e,t)=>{Nte.init(e,t),ho.init(e,t)});function go(e){return ji(hne,e)}const gne=P(`ZodBoolean`,(e,t)=>{Pte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_a(e,t,n,r)});function L(e){return Mi(gne,e)}const _ne=P(`ZodNull`,(e,t)=>{Fte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>va(e,t,n,r)});function _o(e){return Ni(_ne,e)}const vne=P(`ZodUnknown`,(e,t)=>{Ite.init(e,t),so.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function R(){return Pi(vne)}const yne=P(`ZodNever`,(e,t)=>{Lte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ya(e,t,n,r)});function bne(e){return Fi(yne,e)}const xne=P(`ZodArray`,(e,t)=>{Rte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wa(e,t,n,r),e.element=t.element,oo(e,`ZodArray`,{min(e,t){return this.check(Hi(e,t))},nonempty(e){return this.check(Hi(1,e))},max(e,t){return this.check(Vi(e,t))},length(e,t){return this.check(Ui(e,t))},unwrap(){return this.element}})});function z(e,t){return na(xne,e,t)}const vo=P(`ZodObject`,(e,t)=>{Bte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ta(e,t,n,r),kn(e,`shape`,()=>t.shape),oo(e,`ZodObject`,{keyof(){return H(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:R()})},loose(){return this.clone({...this._zod.def,catchall:R()})},strict(){return this.clone({...this._zod.def,catchall:bne()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return xee(this,e)},safeExtend(e){return See(this,e)},merge(e){return Cee(this,e)},pick(e){return yee(this,e)},omit(e){return bee(this,e)},partial(...e){return wee(Do,this,e[0])},required(...e){return Tee(Ao,this,e[0])}})});function B(e,t){return new vo({type:`object`,shape:e??{},...zn(t)})}function yo(e,t){return new vo({type:`object`,shape:e,catchall:R(),...zn(t)})}const bo=P(`ZodUnion`,(e,t)=>{Ir.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ea(e,t,n,r),e.options=t.options});function xo(e,t){return new bo({type:`union`,options:e,...zn(t)})}const Sne=P(`ZodDiscriminatedUnion`,(e,t)=>{bo.init(e,t),Vte.init(e,t)});function So(e,t,n){return new Sne({type:`union`,options:t,discriminator:e,...zn(n)})}const Cne=P(`ZodIntersection`,(e,t)=>{Hte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Da(e,t,n,r)});function Co(e,t){return new Cne({type:`intersection`,left:e,right:t})}const wo=P(`ZodRecord`,(e,t)=>{Ute.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oa(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function V(e,t,n){return!t||!t._zod?new wo({type:`record`,keyType:F(),valueType:e,...zn(t)}):new wo({type:`record`,keyType:e,valueType:t,...zn(n)})}const To=P(`ZodEnum`,(e,t)=>{Wte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ba(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new To({...t,checks:[],...zn(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new To({...t,checks:[],...zn(r),entries:i})}});function H(e,t){return new To({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...zn(t)})}const wne=P(`ZodLiteral`,(e,t)=>{Gte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xa(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function U(e,t){return new wne({type:`literal`,values:Array.isArray(e)?e:[e],...zn(t)})}const Tne=P(`ZodTransform`,(e,t)=>{Kte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ca(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new bn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Kn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Kn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Eo(e){return new Tne({type:`transform`,transform:e})}const Do=P(`ZodOptional`,(e,t)=>{Br.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ia(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Oo(e){return new Do({type:`optional`,innerType:e})}const Ene=P(`ZodExactOptional`,(e,t)=>{qte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ia(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dne(e){return new Ene({type:`optional`,innerType:e})}const One=P(`ZodNullable`,(e,t)=>{Jte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ka(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ko(e){return new One({type:`nullable`,innerType:e})}const kne=P(`ZodDefault`,(e,t)=>{Yte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ja(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ane(e,t){return new kne({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():In(t)}})}const jne=P(`ZodPrefault`,(e,t)=>{Xte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ma(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mne(e,t){return new jne({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():In(t)}})}const Ao=P(`ZodNonOptional`,(e,t)=>{Hr.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nne(e,t){return new Ao({type:`nonoptional`,innerType:e,...zn(t)})}const Pne=P(`ZodCatch`,(e,t)=>{Wr.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Na(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Fne(e,t){return new Pne({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const jo=P(`ZodPipe`,(e,t)=>{Gr.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pa(e,t,n,r),e.in=t.in,e.out=t.out});function Mo(e,t){return new jo({type:`pipe`,in:e,out:t})}const Ine=P(`ZodPreprocess`,(e,t)=>{jo.init(e,t),qr.init(e,t)}),Lne=P(`ZodReadonly`,(e,t)=>{Jr.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rne(e){return new Lne({type:`readonly`,innerType:e})}const zne=P(`ZodLazy`,(e,t)=>{Xr.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>La(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function No(e){return new zne({type:`lazy`,getter:e})}const Po=P(`ZodCustom`,(e,t)=>{Zr.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sa(e,t,n,r)});function Fo(e,t){return ra(Po,e??(()=>!0),t)}function Bne(e,t={}){return ia(Po,e,t)}function Vne(e,t){return aa(e,t)}function Io(e,t){return new Ine({type:`pipe`,in:Eo(e),out:t})}const Hne=B({path:z(xo([F(),I()])),message:F(),issueCode:F()});So(`code`,[B({code:U(`SCHEMA_INVALID`),issues:z(Hne)}),B({code:U(`WRITE_ERROR`),detail:F()})]);const Lo=[`text`,`number`,`boolean`,`date`,`list`,`object`];H(Lo);const Une=xo([F(),I(),L()]),Ro=No(()=>xo([Une.transform(e=>String(e)),V(F(),zo),z(Ro)])),zo=No(()=>xo([F(),I(),L(),z(Ro),V(F(),zo)]));function Bo(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(Bo(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:Bo(r);return t}return e}Io(Bo,V(F(),zo)),V(F(),xo([zo,_o()]));const Vo=/^---[ \t]*\r?\n([\s\S]*?\r?\n)?---[ \t]*(\r?\n|$)/;function Wne(e){let t=e.match(Vo);return t?{frontmatter:t[0],body:e.slice(t[0].length)}:{frontmatter:``,body:e}}function Gne(e){if(e===``)return``;let t=e.match(Vo);return t?(t[1]??``).replace(/\r?\n$/,``):e}Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});function Ho(e){return e>=2?e:0}function Uo(e,t){let n={line:e,column:1,offset:t};return{type:`paragraph`,children:[],position:{start:n,end:{...n}}}}function Wo(e,t){let n=e.children,r=n.length===0||t.leading===void 0?0:Ho(t.leading.length),i=n.length===0||t.trailing===void 0?0:Ho(t.trailing.length-1);if(r===0&&i===0)return t;let a=n[n.length-1]?.position?.end,o=[],s=[];if(r>0)for(let e=0;e<r;e++)o.push(Uo(1+e,e));if(i>0&&typeof a?.offset==`number`&&typeof a.line==`number`)for(let e=0;e<i;e++)s.push(Uo(a.line+1+e,a.offset+1+e));if(o.length===0&&s.length===0||(e.children=[...o,...n,...s],o.length>0&&delete t.leading,s.length>0&&delete t.trailing,t.bom!==void 0||t.leading!==void 0||t.trailing!==void 0))return t;e.data!==void 0&&delete e.data.sourceDocBoundary}const Kne=new gn.default;Kne.Match_Threshold=.5;function Go(e,t){let n=0;for(let r=0;r<t.length&&n<e.length;r++)e[n]===t[r]&&n++;return n===e.length}const qne=new Set([`sourceRaw`,`sourceDirty`,`position`]),Jne=new Set([`jsxComponent`,`table`,`tableRow`,`tableCell`,`tableHeader`,`list`,`listItem`,`blockquote`,`codeBlock`,`heading`]),Ko={type:`__br__`},Yne=/^<br\s*\/?>$/i;function qo(e){let t=Xo(e,qo);return(t.type===`tableCell`||t.type===`tableHeader`)&&t.content?{...t,content:Jo(t.content)}:t}function Jo(e){let t=[];for(let n of e){let e=Xne(n);e.length!==0&&(t.length>0&&t.push(Ko),t.push(...e))}return t}function Xne(e){return e.text!==void 0||e.type===`hardBreak`||e.type===`jsxInline`?[e]:!e.content||e.content.length===0?[]:e.content.some(e=>e.text===void 0&&e.type!==`hardBreak`&&e.type!==`jsxInline`&&!!e.content)?Jo(e.content):e.content}function Yo(e){return e.type===`hardBreak`||e.type===Ko.type||e.text!==void 0&&Yne.test(e.text.trim())?Ko:Xo(e,Yo)}const Zne=[{label:`table-cell-block-flatten`,severity:`pm-model-caused`,rationale:`GFM table cells have no block spelling; a block placed in a cell is flattened to inline on serialize, so a cell-with-blocks and a cell-with-inline describe the same persisted document.`,proofPointer:`markdown/table-cell-flatten.ts flattenCellBlocks (table-cell-flatten-dropped-block event)`,canonicalize:qo},{label:`void-hardbreak-br`,severity:`serializer-caused`,rationale:`A void hardBreak inside a table cell or heading serializes to a literal <br /> that a fresh parse keeps as text; the node form and the literal form are the same break.`,proofPointer:`markdown/void-br-promoter.ts + markdown/to-markdown-handlers.ts break handler`,canonicalize:Yo}];function Xo(e,t){return e.content?{...e,content:e.content.map(t)}:e}function Zo(e,t){let n={};e.type!==void 0&&(n.type=e.type),e.text!==void 0&&(n.text=e.text);let r=Qo(e.attrs,t);return r&&(n.attrs=r),e.marks&&e.marks.length>0&&(n.marks=[...e.marks].map(e=>({type:e.type,attrs:Qo(e.attrs,t)})).sort((e,t)=>es(e).localeCompare(es(t)))),e.content&&e.content.length>0&&(n.content=e.content.map(e=>Zo(e,t))),n}function Qo(e,t){if(!e)return null;let n={};for(let r of Object.keys(e).sort()){if(qne.has(r)||t?.(r))continue;let i=e[r];i!=null&&(n[r]=t?$o(i,t):i)}return Object.keys(n).length>0?n:null}function $o(e,t){if(Array.isArray(e))return e.map(e=>$o(e,t));if(e&&typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))t(r)||(n[r]=$o(i,t));return n}return e}function es(e){return JSON.stringify(e,(e,t)=>{if(t&&typeof t==`object`&&!Array.isArray(t)){let e={};for(let n of Object.keys(t).sort())e[n]=t[n];return e}return t})}function ts(e,t=!1){let n=``,r=e=>{if(!(t&&e.type===`rawMdxFallback`)&&(e.text!==void 0&&(n+=e.text),e.content))for(let t of e.content)r(t)};return r(e),n.replace(/\s+/g,``)}function ns(e){let t=[],n=e=>{if(e.type&&Jne.has(e.type)){let n=e.type===`jsxComponent`?String(e.attrs?.componentName??``):``;t.push(n?`${e.type}:${n}`:e.type)}if(e.content)for(let t of e.content)n(t)};return n(e),t.sort()}function rs(e){let t=e,n=[];for(let e of Zne){let r=es(t),i=e.canonicalize(t);es(i)!==r&&n.push(e.label),t=i}return{normalized:t,fired:n}}function Qne(e,t,n={}){let r=rs(e),i=rs(t),a=[...new Set([...r.fired,...i.fired])],o=Go(ts(r.normalized),ts(i.normalized)),s=!o&&n.rawSourceSide===`expected`&&Go(ts(r.normalized,!0),ts(i.normalized,!0));if(!o&&!s)return{equivalent:!1,level:`L1`,reason:`content-loss`,appliedDegrades:a,detail:`authored text did not survive the round-trip`};let c=ns(r.normalized),l=ns(i.normalized);if(es(c)!==es(l))return{equivalent:!1,level:`L1`,reason:`structural-shatter`,appliedDegrades:a,detail:`container multiset diverged: [${c.join(`, `)}] vs [${l.join(`, `)}]`};let u=Zo(r.normalized,n.ignoreAttrs),d=Zo(i.normalized,n.ignoreAttrs);return es(u)===es(d)?{equivalent:!0,level:a.length>0?`L2`:`L1`,appliedDegrades:a}:{equivalent:!1,level:`L2`,reason:`structural-divergence`,appliedDegrades:a,detail:is(u,d)}}function is(e,t,n=`doc`){let r=e,i=t;if(!r||!i)return`${n}: node presence differs`;if(r.type!==i.type)return`${n}: type ${String(r.type)} vs ${String(i.type)}`;let a=r.content??[],o=i.content??[];if(a.length!==o.length)return`${n}(${String(r.type)}): child count ${a.length} vs ${o.length}`;for(let e=0;e<a.length;e++)if(es(a[e])!==es(o[e]))return is(a[e],o[e],`${n}>${String(r.type)}[${e}]`);return`${n}(${String(r.type)}): attrs or marks differ`}function $ne(e,t,n){return!Qne(e,t,{ignoreAttrs:n}).equivalent}const ere=new Set([`src`,`href`,`size`]),tre=new Set([`WikiEmbedImage`,`WikiEmbedVideo`,`WikiEmbedAudio`,`WikiEmbedFile`]);function as(e){if(Array.isArray(e))return e.map(e=>as(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))ere.has(n)||(t[n]=as(r));return t}return e}function ss(e){return e.type===`jsxComponent`&&typeof e.attrs?.componentName==`string`&&tre.has(e.attrs.componentName)?as(e):e.content?{...e,content:e.content.map(ss)}:e}function cs(e){if(Array.isArray(e))return e.map(e=>cs(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))n!==`position`&&(t[n]=cs(r));return t}return e}function ls(e){if(e.type===`jsxComponent`)return e;if(e.content)for(let t of e.content){let e=ls(t);if(e)return e}}function nre(e){let t=e.cacheLimit??2048,n=new Map,r=r=>{let i=n.get(r);if(i!==void 0)return i;let a=ls(e.parse(r)),o=a?ss(cs(a)):null;if(n.size>=t){let e=n.keys().next().value;e!==void 0&&n.delete(e)}return n.set(r,o),o};return{isDiverged(e){if(e.type!==`jsxComponent`||!e.attrs||e.attrs.kind===`expression`)return!1;let t=e.attrs.sourceRaw;if(typeof t!=`string`||t.length===0)return!1;let n=r(t);return n?$ne(n,ss(cs(e))):!1}}}const us=`state/bug-reports`,rre=yo({at:F(),transport:F(),outcome:F(),reference:F().optional(),error:F().optional(),errorCode:F().optional()}),ire=yo({reason:F(),at:F(),errorCode:F().optional()});yo({version:I().int().catch(1),id:F(),createdAt:F(),bundleLevel:F(),zipBytes:I().int().nonnegative().catch(0),zipDeleted:L().optional(),state:F(),systemWide:L().optional(),projectSlug:F().nullable().optional(),reference:F().optional(),lastError:ire.optional(),attempts:z(rre).optional(),note:F().optional()}),yo({version:I().int().catch(1),id:F().optional(),sentAt:F().optional(),reference:F().optional()});const ds=new Map([[32,` `],[9,` `],[160,`\xA0`]]);function fs(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function ps(e){let t=fs(e);return t!==null&&ds.has(t)}function are(e){let t=fs(e);return t===null?null:ds.get(t)??null}const ms=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function hs(e){ms.lastIndex=0;let t=e.match(ms);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=are(e);if(t===null)return null;n+=t}return n}const ore=[`off`,`follow`,`full`],gs=`pull`,_s=[`off`,`follow`,`full`,gs],sre=[`follow`,`full`,gs],vs=3600,cre=new Set(Object.keys({sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,feature:`gherkin`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`})),lre=new Set([`md`,`mdx`,`mmd`,`mermaid`]);new Set([...cre,`txt`,`text`,`csv`,`tsv`,`log`,`toml`,`html`,`htm`,`svg`,`vue`,`svelte`,`astro`,`lock`].filter(e=>!lre.has(e)));const ys=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],ure=[`video/mp4`,`video/webm`,`video/ogg`],dre=[`audio/mpeg`,`audio/wav`,`audio/ogg`],fre=[`application/pdf`],bs=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),xs=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),pre=new Set([`pdf`]),Ss=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Cs=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),ws=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),mre=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml.lock`.split(`.`)),Ts=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Es=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],Ds=[`mp4`,`webm`,`mov`,`m4v`],Os=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],ks=[`pdf`],As=[`json`,`toml`,`lock`];function js(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}js(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,Es,bs),js(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,Ds,xs),js(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,Os,Ss),js(`SIDEBAR_PDF_ASSET_EXTENSIONS`,ks,pre),js(`FILE_ATTACHMENT_EXTENSIONS`,[...Cs],Ts),js(`WIKI_EMBED_EXTENSIONS`,[...Ts],ws),new Set(Es),new Set(Ds),new Set(Os),new Set(ks),new Set(As),js(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...Es,...Ds,...Os,...ks,...As])],mre);const hre=new Set([`base`,`canvas`]),gre=new Set([`mmd`,`mermaid`]),_re=new Set([`excalidraw`]),Ms=new Set([...ws,...hre,...gre,..._re]),Ns=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`ar`,`fr`,`bn`,`pt-BR`,`id`,`ur`,`ko`],vre=new Set([`ar`,`ur`]),yre=Ns.filter(e=>!vre.has(e)),bre=[`markdownlint`,`frontmatter`,`okf`],xre=[`missing`,`invalid`];[...bre];const Sre=[`off`,`warning`,`error`],Ps=`warning`,Cre=[`error`,`warning`],Fs=[`base00`,`base01`,`base02`,`base03`,`base04`,`base05`,`base06`,`base07`,`base08`,`base09`,`base0A`,`base0B`,`base0C`,`base0D`,`base0E`,`base0F`],wre={base00:`default background`,base01:`alt background — cards, popovers, sidebar`,base02:`selection background, borders`,base03:`comments, invisibles`,base04:`secondary text`,base05:`default foreground`,base06:`light foreground`,base07:`lightest foreground`,base08:`red — variables, tags, diff deleted`,base09:`orange — numbers, constants`,base0A:`yellow — classes, search highlight`,base0B:`green — strings, diff inserted`,base0C:`cyan — support, escapes, quotes`,base0D:`blue — functions, headings, accent`,base0E:`magenta — keywords, storage`,base0F:`deprecated markers, embedded tags`},Tre=/\P{White_Space}/u;function Ere(e){return Tre.test(e)}function Dre(e){let t=e.palette;return{background:t.base00,foreground:t.base05,card:t.base01,"card-foreground":t.base05,popover:t.base01,"popover-foreground":t.base05,primary:t.base0D,"primary-foreground":t.base00,secondary:t.base01,"secondary-foreground":t.base05,muted:t.base01,"muted-foreground":t.base04,accent:t.base02,"accent-foreground":t.base05,destructive:t.base08,border:t.base02,input:t.base02,ring:t.base0D,"selection-soft":t.base02,"chart-1":t.base0D,"chart-2":t.base0B,"chart-3":t.base0A,"chart-4":t.base0E,"chart-5":t.base08,sidebar:t.base01,"sidebar-foreground":t.base05,"sidebar-primary":t.base0D,"sidebar-primary-foreground":t.base00,"sidebar-accent":t.base02,"sidebar-accent-foreground":t.base0D,"sidebar-hover":t.base02,"sidebar-border":t.base02,"sidebar-ring":t.base0D,"syntax-keyword":t.base0E,"syntax-tag":t.base08,"syntax-attr":t.base0D,"syntax-string":t.base0B,"syntax-number":t.base09,"syntax-atom":t.base0C,"syntax-comment":t.base03,"syntax-func":t.base0D,"syntax-var":t.base08,"syntax-type":t.base0A,"syntax-operator":t.base05,"syntax-meta":t.base0F,"syntax-bg":t.base01,"link-color":t.base0D,"broken-link-color":t.base08,"lint-warning-color":t.base0A,"lint-error-color":t.base08,"diff-added":t.base0B,"diff-removed":t.base08,"diff-modified":t.base0D,"callout-note-color":t.base0D,"callout-info-color":t.base0D,"callout-todo-color":t.base0D,"callout-abstract-color":t.base0C,"callout-tip-color":t.base0B,"callout-success-color":t.base0B,"callout-important-color":t.base0E,"callout-example-color":t.base0E,"callout-question-color":t.base0E,"callout-warning-color":t.base0A,"callout-caution-color":t.base09,"callout-danger-color":t.base09,"callout-failure-color":t.base08,"callout-bug-color":t.base08,"callout-quote-color":t.base03,...kre(t)}}const Is={black:`base00`,red:`base08`,green:`base0B`,yellow:`base0A`,blue:`base0D`,magenta:`base0E`,cyan:`base0C`,white:`base05`,brightBlack:`base03`,brightRed:`base08`,brightGreen:`base0B`,brightYellow:`base0A`,brightBlue:`base0D`,brightMagenta:`base0E`,brightCyan:`base0C`,brightWhite:`base07`},Ore=Object.keys(Is);function kre(e){let t={};for(let n of Ore)t[`ansi-${Are(n)}`]=e[Is[n]];return t}function Are(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}const jre={name:`Dracula`,author:`clach04 (https://github.com/clach04)`,variant:`dark`,palette:{base00:`#282a36`,base01:`#21222c`,base02:`#44475a`,base03:`#6272a4`,base04:`#9ea8c7`,base05:`#f8f8f2`,base06:`#f8f8f2`,base07:`#ffffff`,base08:`#ff5555`,base09:`#ffb86c`,base0A:`#f1fa8c`,base0B:`#50fa7b`,base0C:`#8be9fd`,base0D:`#bd93f9`,base0E:`#ff79c6`,base0F:`#993333`}},Mre={name:`Catppuccin Frappé`,author:`https://github.com/catppuccin/catppuccin`,variant:`dark`,palette:{base00:`#303446`,base01:`#292c3c`,base02:`#414559`,base03:`#51576d`,base04:`#626880`,base05:`#c6d0f5`,base06:`#f2d5cf`,base07:`#babbf1`,base08:`#e78284`,base09:`#ef9f76`,base0A:`#e5c890`,base0B:`#a6d189`,base0C:`#81c8be`,base0D:`#8caaee`,base0E:`#ca9ee6`,base0F:`#eebebe`}},Nre={name:`Catppuccin Latte`,author:`https://github.com/catppuccin/catppuccin`,variant:`light`,palette:{base00:`#eff1f5`,base01:`#e6e9ef`,base02:`#ccd0da`,base03:`#bcc0cc`,base04:`#acb0be`,base05:`#4c4f69`,base06:`#dc8a78`,base07:`#7287fd`,base08:`#d20f39`,base09:`#fe640b`,base0A:`#df8e1d`,base0B:`#40a02b`,base0C:`#179299`,base0D:`#1d62ec`,base0E:`#8839ef`,base0F:`#dd7878`}},Pre={name:`Monokai`,author:`Wimer Hazenberg (http://www.monokai.nl)`,variant:`dark`,palette:{base00:`#272822`,base01:`#383830`,base02:`#49483e`,base03:`#75715e`,base04:`#a59f85`,base05:`#f8f8f2`,base06:`#f5f4f1`,base07:`#f9f8f5`,base08:`#f92672`,base09:`#fd971f`,base0A:`#f4bf75`,base0B:`#a6e22e`,base0C:`#a1efe4`,base0D:`#66d9ef`,base0E:`#ae81ff`,base0F:`#cc6633`}},Fre={name:`Gruvbox dark, medium`,author:`Dawid Kurek, morhetz (https://github.com/morhetz/gruvbox)`,variant:`dark`,palette:{base00:`#282828`,base01:`#3c3836`,base02:`#504945`,base03:`#665c54`,base04:`#bdae93`,base05:`#d5c4a1`,base06:`#ebdbb2`,base07:`#fbf1c7`,base08:`#fb4934`,base09:`#fe8019`,base0A:`#fabd2f`,base0B:`#b8bb26`,base0C:`#8ec07c`,base0D:`#83a598`,base0E:`#d3869b`,base0F:`#d65d0e`}},Ire={name:`Solarized Dark`,author:`Ethan Schoonover (modified by aramisgithub)`,variant:`dark`,palette:{base00:`#002b36`,base01:`#073642`,base02:`#586e75`,base03:`#657b83`,base04:`#839496`,base05:`#93a1a1`,base06:`#eee8d5`,base07:`#fdf6e3`,base08:`#dc322f`,base09:`#cb4b16`,base0A:`#b58900`,base0B:`#859900`,base0C:`#2aa198`,base0D:`#2995e1`,base0E:`#6c71c4`,base0F:`#d33682`}};function Ls(e,t,n){return{id:e,label:t,kind:n.variant,scheme:n,toTokens:()=>Dre(n)}}function Rs(e,t){return{id:e,label:t,kind:`system`}}const zs=[Rs(`default`,`Default`),Ls(`dracula`,`Dracula`,jre),Ls(`catppuccin-frappe`,`Catppuccin Frappé`,Mre),Ls(`catppuccin-latte`,`Catppuccin Latte`,Nre),Ls(`monokai`,`Monokai`,Pre),Ls(`gruvbox`,`Gruvbox`,Fre),Ls(`solarized`,`Solarized`,Ire),Rs(`custom`,`Custom`)],Lre=zs.map(e=>e.id),Bs=/^[a-z0-9-]{1,32}$/;new Map(zs.map(e=>[e.id,e]));const Vs=Symbol.for(`@inkeep/open-knowledge/field-registry`),Hs=globalThis;Hs[Vs]===void 0&&(Hs[Vs]=ti());const Us=Hs[Vs];function Rre(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=zre(t)?Us.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function zre(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}function Bre(){return Object.fromEntries(Fs.map(e=>[e,F().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${wre[e]}, as a #rrggbb hex string.`}).optional()]))}function Ws(){return Lre.filter(e=>e!==`default`&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}const Gs=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),Ks=52428800,qs=26214400,Js=12582912,Ys=`https://api.openai.com/v1`,Xs=`text-embedding-3-small`,Zs=Object.freeze([`127.0.0.1`]),Qs=/^[1-9]\d*(s|m|h)$/,$s=/^https?:\/\//;function ec(e){let t=e.trim();return t===``?`./`:t}function tc(e){let t=ec(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}const nc=yo({content:yo({dir:F().register(Us,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore. Read at server start; changing it requires a restart.`}).default(`.`),attachmentFolderPath:F().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Where pasted and dropped assets are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(tc,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:yo({theme:H([`light`,`dark`,`system`]).register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),language:H([`system`,...Ns]).register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Interface language. 'system' follows the operating system. A personal preference (user scope) — not shared with the project, and never applied to document content.`}).optional(),colorThemeLight:F().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Ws()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(Bs,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeDark:F().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Ws()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(Bs,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorTheme:F().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A short theme id (lowercase letters, digits, and hyphens; max 32 characters); an id no palette matches falls back to 'default'. A personal preference (user scope) — not shared with the project.`}).regex(Bs,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeEnabled:L().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on.`}).optional(),customTheme:yo({name:F().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:F().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's author credit, carried through from an imported base16 scheme.`}).optional(),variant:H([`dark`,`light`]).register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted.`}).optional(),...Bre()}).optional(),preview:yo({autoOpen:L().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:yo({showHiddenFiles:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillGroups:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Group skills in the sidebar by where they came from — the publisher they were imported from, or the plugin that ships them. Skills you authored stay ungrouped at the top of their scope. Per-machine (project-local) — not shared with collaborators.`}).default(!0),pinnedProjectSkills:z(F()).register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Project-scope skills pinned to the top of the Skills sidebar, by name. A pinned skill also keeps its normal row, so a provenance group still lists everything from its source. Per-machine (project-local) — not shared with collaborators.`}).default([]),pinnedGlobalSkills:z(F()).register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Global-scope skills pinned to the top of the Skills sidebar, by name. Stored per USER rather than per project, so a pinned global skill follows you into every project.`}).default([])}).optional()}).default({preview:{autoOpen:!0}}),editor:yo({wordWrap:L().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0),previewTabs:L().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Reuse one tab when clicking through the Files and Skills sidebars, the way an editor preview tab works. Turn off to open every click in its own tab. Pinned tabs keep their own tab either way. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0,previewTabs:!0}),agents:yo({autoApproveOkTools:L().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools (and `ok open` on Claude) for agents launched from the built-in terminal. Destructive tools (delete/move/share/install) still prompt. Per-machine personal preference (user scope)."}).default(!0)}).default({autoApproveOkTools:!0}),autoSync:yo({mode:H(_s).register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`What this machine syncs on a schedule for this project: 'off' (Manual — nothing scheduled; the manual pull/push actions still work), 'follow' (Auto, pull only — scheduled pulls, never a scheduled push; 'pull' is accepted as a legacy alias), or 'full' (Auto, pull and push — bidirectional). Explicit user-triggered pushes work in every mode. null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared. Supersedes the legacy autoSync.enabled boolean.`}).nullable().default(null),enabled:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Legacy per-machine sync toggle, superseded by autoSync.mode. Read only when mode is absent (true = full, false = off). null = not chosen yet. Per-machine (project-local) — not shared.`}).nullable().default(null),resumeMode:H(sre).register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`When sync is paused (autoSync.mode 'off') after having been enabled, the active mode to resume into ('follow' | 'full'). Per-machine UI memory; ignored while a mode is active. Not shared.`}).optional(),pullIntervalSeconds:I().int().min(30).max(vs).register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Seconds between scheduled pulls while autoSync.mode is follow or full (default 30). An unauthenticated follower is additionally floored to the anonymous poll minimum, so a lower value there has no effect. Per-machine (project-local) — not shared.`}).optional().catch(void 0),pushIntervalSeconds:I().int().min(30).max(vs).register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Seconds between scheduled pushes while autoSync.mode is full (default 60). Ignored in every other mode, which never pushes on a schedule. Each cycle with pending edits authors a commit, so a shorter interval means more, smaller commits in the repo's shared history. Per-machine (project-local) — not shared.`}).optional().catch(void 0),default:xo([L(),H(_s)]).register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Committed project default for a machine's sync mode on first open: 'off' | 'follow' | 'full', or the legacy boolean (true = full, false = off). null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.mode choice overrides it.`}).nullable().default(null)}).default({mode:null,enabled:null,default:null}),terminal:yo({enabled:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null),shell:F().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Absolute Windows shell executable override for the in-app terminal. PowerShell, cmd.exe, and Git Bash support OpenKnowledge-managed launches (agent chat tabs and fixed commands such as Resolve in terminal or Install Slidev) and dropped-file path insertion. A different existing executable remains usable for plain terminal tabs and shows a capability notice; requested agent and command launches open only the plain shell without running the agent or command, and dropped-file paths are refused. Empty values use automatic shell discovery. Per-machine (project-local), human-managed, and never shared via git, clone, or sync.`}).optional()}).default({enabled:null}),slides:yo({enabled:L().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Whether the Slides plugin appears in Settings → Plugins. When on, a document whose frontmatter has `slides: true` offers an action that opens the deck in a dedicated window (desktop only, requires a resolvable slidev). A personal preference (user scope). Default off."}).default(!1)}).default({enabled:!1}),telemetry:yo({localSink:yo({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:yo({maxBytes:I().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(Ks)}).default({maxBytes:Ks}),logs:yo({maxBytes:I().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(qs)}).default({maxBytes:qs}),attributeDenylist:z(F()).register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...Gs])}).default({enabled:!0,spans:{maxBytes:Ks},logs:{maxBytes:qs},attributeDenylist:[...Gs]}),skillInstallReports:yo({enabled:L().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Report skill installs to skills.sh so a published skill shows an accurate install count. Sends the skill name, its source repo, and which agent tools it was installed for — never file contents, and never for a private or local source. One report per skill per machine. Default on; the DO_NOT_TRACK and DISABLE_TELEMETRY environment variables also turn it off.`}).default(!0)}).default({enabled:!0})}).default({localSink:{enabled:!0,spans:{maxBytes:Ks},logs:{maxBytes:qs},attributeDenylist:[...Gs]},skillInstallReports:{enabled:!0}}),lossCapture:yo({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Record bridge loss-class events (content-free) under .ok/local/loss-capture/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),maxBytes:I().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB).`}).default(Js)}).default({enabled:!0,maxBytes:Js}),bridge:yo({backgroundThrottle:yo({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Keep the desktop window's timers running at full rate while it holds unsynced work, so backgrounding the app never starves sync or recovery; when the window is idle the OS-default background throttling is restored (battery). Honored by the desktop app. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),deferGuard:yo({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Defer a drain-shaped Observer B re-derive when the WYSIWYG fragment holds an un-propagated keystroke Y.Text lacks, so the keystroke survives instead of being stomped. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),lossDetector:yo({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Detect content the bridge silently dropped at its reconciliation boundary (an Observer-A apply arm or a paired agent-undo derive) and write a recovery checkpoint plus a content-free loss event. Detection only — never blocks a write. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),fixedPoint:yo({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Bound the Y.Text→WYSIWYG re-derive loop with a drain-count backstop: a run of re-derive drains that never reaches a raw-byte fixed point freezes the re-derive loop and writes a recovery checkpoint plus a content-free loss event, instead of churning unbounded. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),preDrain:yo({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Before an agent write or undo rebuilds the WYSIWYG fragment, flush an un-propagated keystroke that provably does not overlap the operation into Y.Text so the keystroke survives instead of needing recovery; overlapping or unmodellable cases fall back to the checkpoint floor. Scope: appending writes and single-frame undos — a write that replaces the whole body (replace / edit) overwrites the keystroke either way, so those always take the checkpoint floor. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),flushOnHide:yo({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`On tab hide/unload, force-send each doc's unsynced work to the server and commit its local cache, and re-sync on return to foreground, so a backgrounded tab never strands edits that IndexedDB alone would lose on recycle. Honored client-side. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0})}).default({backgroundThrottle:{enabled:!0},deferGuard:{enabled:!0},lossDetector:{enabled:!0},fixedPoint:{enabled:!0},preDrain:{enabled:!0},flushOnHide:{enabled:!0}}),search:yo({semantic:yo({enabled:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:F().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override to point at a self-hosted server (Ollama / vLLM / LM Studio) or another provider. The API key is NOT stored here — set it with `ok embeddings set-key` (`~/.ok/secrets.yml`); it is sent to whichever endpoint this names."}).default(Ys),model:F().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(Xs),dimensions:I().int().positive().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit (recommended) to detect the model's native size from its first response — that is what lets a non-OpenAI model work without knowing its size up front. Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality; a server that ignores the request param then fails loudly instead of silently. Changing it re-embeds the corpus.`}).optional(),similarityFloor:I().min(0).max(1).register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional()}).default({enabled:!1,baseUrl:Ys,model:Xs})}).default({semantic:{enabled:!1,baseUrl:Ys,model:Xs}}),contentRules:yo({markdownlint:B({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:B({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:z(B({appliesTo:xo([F(),z(F())]).optional(),file:F(),enabled:L().optional()})).register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Frontmatter schema mappings: which docs (appliesTo globs) validate against which JSON Schema file (project-root-relative path).`}).default([])}).default({enabled:!1,schemas:[]}),okf:B({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the OKF plugin (Open Knowledge Format portability + conformance rules) contributes diagnostics. Advisory warnings; never blocks a write.`}).default(!1),rules:V(F(),L()).register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Per-rule opt-outs for the OKF plugin, keyed by rule id (e.g. no-wiki-links). Omit a rule to leave it enabled; set false to silence it while keeping the plugin on.`}).optional(),generate:B({index:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether OK generates and maintains a navigation index.md in every folder that contains Markdown, each listing the documents in that folder grouped by frontmatter type and linking to its subfolders. OK owns these files: edits to them are replaced on the next rebuild.`}).default(!1)}).default({index:!1})}).default({enabled:!1,generate:{index:!1}})}).default({markdownlint:{enabled:!1},frontmatter:{enabled:!1,schemas:[]},okf:{enabled:!1,generate:{index:!1}}}),validation:yo({links:H(Sre).register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity.`}).default(Ps),fileTreeIndicators:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0)}).default({links:Ps,fileTreeIndicators:!0}),linkPreviews:yo({enabled:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata — outbound egress, one request per previewed link. Default ON; set to false to turn external previews off. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on.`}).default(!0)}).default({enabled:!0}),server:yo({port:I().int().min(1).max(65535).register(Us,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`TCP port the server listens on. Unset by default: a local start picks a free port dynamically, and deployment platforms inject the PORT environment variable instead. Read at server start; changing it requires a restart.`}).optional(),bind:z(F().min(1)).min(1).register(Us,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Addresses the server binds, e.g. [127.0.0.1] or [0.0.0.0]. Default loopback-only ([127.0.0.1]): nothing off this machine can connect. A non-loopback bind additionally requires the server.allowExternal consent interlock. Per-machine (project-local): a value committed to .ok/config.yml is ignored, so one machine exposing the server can never break local clones for the rest of the team — the exposing host sets it via OK_BIND, --bind, or .ok/local/config.yml. Lists replace, never merge. Read at server start; changing it requires a restart.`}).default([...Zs]),externalUrl:mo({protocol:/^https?$/}).regex($s).register(Us,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Canonical external origin the server is reached at, e.g. https://kb.example.com — its host joins the Host/Origin allowlists (external-Host + CORS admission). Unset by default: the server admits only loopback Hosts. Setting it declares external exposure, which additionally requires the server.allowExternal consent interlock. Read at server start; changing it requires a restart.`}).optional(),allowExternal:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Exposure consent interlock. Once the unified server boot lands, a non-loopback server.bind or a server.externalUrl without allowExternal: true will be refused at boot with a one-line fix. Default off. Per-machine (project-local) — consent never travels via git, clone, or share; containers consent via the environment instead.`}).default(!1),openBrowser:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Open the UI in a browser when the server starts. Default derived: true when every bind address is loopback (a laptop start pops the UI), false otherwise (a container or exposed bind is headless and must never try). Acts once at start. Per-machine (project-local) — not shared.`}).optional(),idleShutdown:xo([U(`off`),F().regex(Qs)]).register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m' for a loopback-only, unexposed server; 'off' otherwise — a non-loopback bind, or a loopback bind declared externally reachable (server.allowExternal + server.externalUrl), stays up, because a remote agent keeps it busy over /mcp, which the idle timer does not count. Residual case the derivation cannot see: a loopback server reached by remote agents with no server.externalUrl (e.g. behind a same-box reverse proxy) still idles at 30m — set 'off' by hand. Reloadable — a valid change applies without a restart. Per-machine (project-local) — not shared.`}).optional()}).default({bind:[...Zs],allowExternal:!1})});var rc,ic=n((()=>{rc=`1.9.1`}));function ac(e){let t=new Set([e]),n=new Set,r=e.match(oc);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(oc);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var oc,sc,cc=n((()=>{ic(),oc=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,sc=ac(rc)}));function lc(e,t,n,r=!1){let i=mc[pc]=mc[pc]??{version:rc};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${rc}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${rc}.`),!0}function uc(e){let t=mc[pc]?.version;if(!(!t||!sc(t)))return mc[pc]?.[e]}function dc(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${rc}.`);let n=mc[pc];n&&delete n[e]}var fc,pc,mc,hc=n((()=>{ic(),cc(),fc=rc.split(`.`)[0],pc=Symbol.for(`opentelemetry.js.api.${fc}`),mc=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function gc(e,t,n){let r=uc(`diag`);if(r)return r[e](t,...n)}var _c,vc=n((()=>{hc(),_c=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return gc(`debug`,this._namespace,e)}error(...e){return gc(`error`,this._namespace,e)}info(...e){return gc(`info`,this._namespace,e)}warn(...e){return gc(`warn`,this._namespace,e)}verbose(...e){return gc(`verbose`,this._namespace,e)}}})),yc,bc=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(yc||={})}));function xc(e,t){e<yc.NONE?e=yc.NONE:e>yc.ALL&&(e=yc.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,yc.ERROR),warn:n(`warn`,yc.WARN),info:n(`info`,yc.INFO),debug:n(`debug`,yc.DEBUG),verbose:n(`verbose`,yc.VERBOSE)}}var Sc=n((()=>{bc()})),Cc,wc,Tc=n((()=>{vc(),Sc(),bc(),hc(),Cc=`diag`,wc=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=uc(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:yc.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=uc(`diag`),i=xc(n.logLevel??yc.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return lc(`diag`,i,t,!0)},t.disable=()=>{dc(Cc,t)},t.createComponentLogger=e=>new _c(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}}));function Ec(e){return Symbol.for(e)}var Dc,Oc,kc=n((()=>{Dc=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},Oc=new Dc})),Ac,jc=n((()=>{kc(),Ac=class{active(){return Oc}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),Mc,Nc,Pc,Fc=n((()=>{jc(),hc(),Tc(),Mc=`context`,Nc=new Ac,Pc=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return lc(Mc,e,wc.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return uc(Mc)||Nc}disable(){this._getContextManager().disable(),dc(Mc,wc.instance())}}})),Ic,Lc=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(Ic||={})})),Rc,zc,Bc,Vc=n((()=>{Lc(),Rc=`0000000000000000`,zc=`00000000000000000000000000000000`,Bc={traceId:zc,spanId:Rc,traceFlags:Ic.NONE}})),Hc,Uc=n((()=>{Vc(),Hc=class{constructor(e=Bc){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function Wc(e){return e.getValue(Xc)||void 0}function Gc(){return Wc(Pc.getInstance().active())}function Kc(e,t){return e.setValue(Xc,t)}function qc(e){return e.deleteValue(Xc)}function Jc(e,t){return Kc(e,new Hc(t))}function Yc(e){return Wc(e)?.spanContext()}var Xc,Zc=n((()=>{kc(),Uc(),Fc(),Xc=Ec(`OpenTelemetry Context Key SPAN`)}));function Qc(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(rl[e.charCodeAt(t)]|0)+(rl[e.charCodeAt(t+1)]|0)+(rl[e.charCodeAt(t+2)]|0)+(rl[e.charCodeAt(t+3)]|0);return n===t}function $c(e){return Qc(e,32)&&e!==`00000000000000000000000000000000`}function el(e){return Qc(e,16)&&e!==`0000000000000000`}function tl(e){return $c(e.traceId)&&el(e.spanId)}function nl(e){return new Hc(e)}var rl,il=n((()=>{Vc(),Uc(),rl=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}));function al(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var ol,sl,cl=n((()=>{Fc(),Zc(),Uc(),il(),ol=Pc.getInstance(),sl=class{startSpan(e,t,n=ol.active()){if(t?.root)return new Hc;let r=n&&Yc(n);return al(r)&&tl(r)?new Hc(r):new Hc}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??ol.active(),c=this.startSpan(e,i,s),l=Kc(s,c);return ol.with(l,o,void 0,c)}}})),ll,ul,dl=n((()=>{cl(),ll=new sl,ul=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):ll}}})),fl,pl=n((()=>{cl(),fl=class{getTracer(e,t,n){return new sl}}})),ml,hl,gl=n((()=>{dl(),pl(),ml=new fl,hl=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new ul(this,e,t,n)}getDelegate(){return this._delegate??ml}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}}})),_l,vl=n((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(_l||={})})),yl,bl=n((()=>{Fc(),yl=Pc.getInstance()})),xl,Sl,Cl=n((()=>{hc(),gl(),il(),Zc(),Tc(),xl=`trace`,Sl=class e{constructor(){this._proxyTracerProvider=new hl,this.wrapSpanContext=nl,this.isSpanContextValid=tl,this.deleteSpan=qc,this.getSpan=Wc,this.getActiveSpan=Gc,this.getSpanContext=Yc,this.setSpan=Kc,this.setSpanContext=Jc}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=lc(xl,this._proxyTracerProvider,wc.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return uc(xl)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){dc(xl,wc.instance()),this._proxyTracerProvider=new hl}}})),wl,Tl=n((()=>{Cl(),wl=Sl.getInstance()})),El=n((()=>{Tc(),kc(),bc(),dl(),gl(),vl(),Lc(),il(),Vc(),bl(),Tl()}));function Dl(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function Ol(e,t){let n=e;for(let e of t){n=Dl(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function kl(e,t){let n=Ol(e,t);if(n!==void 0)return Rre(n)}const Al=new Map([[`PORT`,[`server`,`port`]],[`OK_BIND`,[`server`,`bind`]],[`OK_EXTERNAL_URL`,[`server`,`externalUrl`]],[`OK_ALLOW_EXTERNAL`,[`server`,`allowExternal`]],[`OK_OPEN_BROWSER`,[`server`,`openBrowser`]],[`OK_IDLE_SHUTDOWN`,[`server`,`idleShutdown`]]]);function jl(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toUpperCase()}function Ml(e){return`OK_${(e[0]===`server`?e.slice(1):e).map(jl).join(`_`)}`}function Nl(e,t){if(t.length===0)return e.contents??null;let n=e.getIn(t,!0);if((0,on.isNode)(n))return n;for(let n=t.length-1;n>=0;n--){let r=e.getIn(t.slice(0,n),!0);if((0,on.isNode)(r))return r}return e.contents??null}function Pl(e,t){let n=1,r=1,i=Math.min(t,e.length);for(let t=0;t<i;t++)e.charCodeAt(t)===10?(n++,r=1):r++;return{line:n,column:r}}function Fl(e,t,n,r,i){let a=e.split(`
184
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ua(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:pa(t,`input`,e.processors),output:pa(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function da(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return da(r.element,n);if(r.type===`set`)return da(r.valueType,n);if(r.type===`lazy`)return da(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return da(r.innerType,n);if(r.type===`intersection`)return da(r.left,n)||da(r.right,n);if(r.type===`record`||r.type===`map`)return da(r.keyType,n)||da(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:da(r.in,n)||da(r.out,n);if(r.type===`object`){for(let e in r.shape)if(da(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(da(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(da(e,n))return!0;return!!(r.rest&&da(r.rest,n))}return!1}const fa=(e,t={})=>n=>{let r=sa({...n,processors:t});return ca(e,r),la(r,e),ua(r,e)},pa=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=sa({...i??{},target:a,io:t,processors:n});return ca(e,o),la(o,e),ua(o,e)},ma={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ha=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ma[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},ga=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},_a=(e,t,n,r)=>{n.type=`boolean`},va=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},ya=(e,t,n,r)=>{n.not={}},ba=(e,t,n,r)=>{let i=e._zod.def,a=Cn(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},xa=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Sa=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Ca=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},wa=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=ca(a.element,t,{...r,path:[...r.path,`items`]})},Ta=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=ca(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=ca(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ea=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>ca(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Da=(e,t,n,r)=>{let i=e._zod.def,a=ca(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=ca(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Oa=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=ca(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=ca(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=ca(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},ka=(e,t,n,r)=>{let i=e._zod.def,a=ca(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Aa=(e,t,n,r)=>{let i=e._zod.def;ca(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ja=(e,t,n,r)=>{let i=e._zod.def;ca(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ma=(e,t,n,r)=>{let i=e._zod.def;ca(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Na=(e,t,n,r)=>{let i=e._zod.def;ca(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Pa=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;ca(o,t,r);let s=t.seen.get(e);s.ref=o},Fa=(e,t,n,r)=>{let i=e._zod.def;ca(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ia=(e,t,n,r)=>{let i=e._zod.def;ca(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},La=(e,t,n,r)=>{let i=e._zod.innerType;ca(i,t,r);let a=t.seen.get(e);a.ref=i},Ra=P(`ZodISODateTime`,(e,t)=>{yte.init(e,t),lo.init(e,t)});function za(e){return Ei(Ra,e)}const Ba=P(`ZodISODate`,(e,t)=>{bte.init(e,t),lo.init(e,t)});function Va(e){return Di(Ba,e)}const Ha=P(`ZodISOTime`,(e,t)=>{xte.init(e,t),lo.init(e,t)});function Ua(e){return Oi(Ha,e)}const Wa=P(`ZodISODuration`,(e,t)=>{Ste.init(e,t),lo.init(e,t)});function Ga(e){return ki(Wa,e)}const Ka=P(`ZodError`,(e,t)=>{Jn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Zn(e,t)},flatten:{value:t=>Xn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,wn,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,wn,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),qa=Qn(Ka),Ja=$n(Ka),Ya=er(Ka),Xa=nr(Ka),Za=ir(Ka),Qa=ar(Ka),$a=or(Ka),eo=sr(Ka),to=cr(Ka),no=lr(Ka),ro=ur(Ka),io=dr(Ka),ao=new WeakMap;function oo(e,t,n){let r=Object.getPrototypeOf(e),i=ao.get(r);if(i||(i=new Set,ao.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const so=P(`ZodType`,(e,t)=>(Er.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:pa(e,`input`),output:pa(e,`output`)}}),e.toJSONSchema=fa(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>qa(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ya(e,t,n),e.parseAsync=async(t,n)=>Ja(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Xa(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Za(e,t,n),e.decode=(t,n)=>Qa(e,t,n),e.encodeAsync=async(t,n)=>$a(e,t,n),e.decodeAsync=async(t,n)=>eo(e,t,n),e.safeEncode=(t,n)=>to(e,t,n),e.safeDecode=(t,n)=>no(e,t,n),e.safeEncodeAsync=async(t,n)=>ro(e,t,n),e.safeDecodeAsync=async(t,n)=>io(e,t,n),oo(e,`ZodType`,{check(...e){let t=this.def;return this.clone(jn(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Rn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Bne(e,t))},superRefine(e,t){return this.check(Vne(e,t))},overwrite(e){return this.check(Xi(e))},optional(){return Oo(this)},exactOptional(){return Dne(this)},nullable(){return ko(this)},nullish(){return Oo(ko(this))},nonoptional(e){return Nne(this,e)},array(){return z(this)},or(e){return xo([this,e])},and(e){return Co(this,e)},transform(e){return Mo(this,Eo(e))},default(e){return Ane(this,e)},prefault(e){return Mne(this,e)},catch(e){return Fne(this,e)},pipe(e){return Mo(this,e)},readonly(){return Rne(this)},describe(e){let t=this.clone();return ni.add(t,{description:e}),t},meta(...e){if(e.length===0)return ni.get(this);let t=this.clone();return ni.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,`description`,{get(){return ni.get(e)?.description},configurable:!0}),e)),co=P(`_ZodString`,(e,t)=>{Dr.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ha(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,oo(e,`_ZodString`,{regex(...e){return this.check(Wi(...e))},includes(...e){return this.check(qi(...e))},startsWith(...e){return this.check(Ji(...e))},endsWith(...e){return this.check(Yi(...e))},min(...e){return this.check(Hi(...e))},max(...e){return this.check(Vi(...e))},length(...e){return this.check(Ui(...e))},nonempty(...e){return this.check(Hi(1,...e))},lowercase(e){return this.check(Gi(e))},uppercase(e){return this.check(Ki(e))},trim(){return this.check(Qi())},normalize(...e){return this.check(Zi(...e))},toLowerCase(){return this.check($i())},toUpperCase(){return this.check(ea())},slugify(){return this.check(ta())}})}),Zte=P(`ZodString`,(e,t)=>{Dr.init(e,t),co.init(e,t),e.email=t=>e.check(ii(Qte,t)),e.url=t=>e.check(ui(po,t)),e.jwt=t=>e.check(Ti(mne,t)),e.emoji=t=>e.check(di(ene,t)),e.guid=t=>e.check(ai(uo,t)),e.uuid=t=>e.check(oi(fo,t)),e.uuidv4=t=>e.check(si(fo,t)),e.uuidv6=t=>e.check(ci(fo,t)),e.uuidv7=t=>e.check(li(fo,t)),e.nanoid=t=>e.check(fi(tne,t)),e.guid=t=>e.check(ai(uo,t)),e.cuid=t=>e.check(pi(nne,t)),e.cuid2=t=>e.check(mi(rne,t)),e.ulid=t=>e.check(hi(ine,t)),e.base64=t=>e.check(Si(dne,t)),e.base64url=t=>e.check(Ci(fne,t)),e.xid=t=>e.check(gi(ane,t)),e.ksuid=t=>e.check(_i(one,t)),e.ipv4=t=>e.check(vi(sne,t)),e.ipv6=t=>e.check(yi(cne,t)),e.cidrv4=t=>e.check(bi(lne,t)),e.cidrv6=t=>e.check(xi(une,t)),e.e164=t=>e.check(wi(pne,t)),e.datetime=t=>e.check(za(t)),e.date=t=>e.check(Va(t)),e.time=t=>e.check(Ua(t)),e.duration=t=>e.check(Ga(t))});function F(e){return ri(Zte,e)}const lo=P(`ZodStringFormat`,(e,t)=>{Or.init(e,t),co.init(e,t)}),Qte=P(`ZodEmail`,(e,t)=>{ute.init(e,t),lo.init(e,t)}),uo=P(`ZodGUID`,(e,t)=>{cte.init(e,t),lo.init(e,t)}),fo=P(`ZodUUID`,(e,t)=>{lte.init(e,t),lo.init(e,t)});function $te(e){return oi(fo,e)}const po=P(`ZodURL`,(e,t)=>{dte.init(e,t),lo.init(e,t)});function mo(e){return ui(po,e)}const ene=P(`ZodEmoji`,(e,t)=>{fte.init(e,t),lo.init(e,t)}),tne=P(`ZodNanoID`,(e,t)=>{pte.init(e,t),lo.init(e,t)}),nne=P(`ZodCUID`,(e,t)=>{mte.init(e,t),lo.init(e,t)}),rne=P(`ZodCUID2`,(e,t)=>{hte.init(e,t),lo.init(e,t)}),ine=P(`ZodULID`,(e,t)=>{gte.init(e,t),lo.init(e,t)}),ane=P(`ZodXID`,(e,t)=>{_te.init(e,t),lo.init(e,t)}),one=P(`ZodKSUID`,(e,t)=>{vte.init(e,t),lo.init(e,t)}),sne=P(`ZodIPv4`,(e,t)=>{Cte.init(e,t),lo.init(e,t)}),cne=P(`ZodIPv6`,(e,t)=>{wte.init(e,t),lo.init(e,t)}),lne=P(`ZodCIDRv4`,(e,t)=>{Tte.init(e,t),lo.init(e,t)}),une=P(`ZodCIDRv6`,(e,t)=>{Ete.init(e,t),lo.init(e,t)}),dne=P(`ZodBase64`,(e,t)=>{Dte.init(e,t),lo.init(e,t)}),fne=P(`ZodBase64URL`,(e,t)=>{kte.init(e,t),lo.init(e,t)}),pne=P(`ZodE164`,(e,t)=>{Ate.init(e,t),lo.init(e,t)}),mne=P(`ZodJWT`,(e,t)=>{Mte.init(e,t),lo.init(e,t)}),ho=P(`ZodNumber`,(e,t)=>{Ar.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ga(e,t,n,r),oo(e,`ZodNumber`,{gt(e,t){return this.check(Ri(e,t))},gte(e,t){return this.check(zi(e,t))},min(e,t){return this.check(zi(e,t))},lt(e,t){return this.check(Ii(e,t))},lte(e,t){return this.check(Li(e,t))},max(e,t){return this.check(Li(e,t))},int(e){return this.check(go(e))},safe(e){return this.check(go(e))},positive(e){return this.check(Ri(0,e))},nonnegative(e){return this.check(zi(0,e))},negative(e){return this.check(Ii(0,e))},nonpositive(e){return this.check(Li(0,e))},multipleOf(e,t){return this.check(Bi(e,t))},step(e,t){return this.check(Bi(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function I(e){return Ai(ho,e)}const hne=P(`ZodNumberFormat`,(e,t)=>{Nte.init(e,t),ho.init(e,t)});function go(e){return ji(hne,e)}const gne=P(`ZodBoolean`,(e,t)=>{Pte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_a(e,t,n,r)});function L(e){return Mi(gne,e)}const _ne=P(`ZodNull`,(e,t)=>{Fte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>va(e,t,n,r)});function _o(e){return Ni(_ne,e)}const vne=P(`ZodUnknown`,(e,t)=>{Ite.init(e,t),so.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function R(){return Pi(vne)}const yne=P(`ZodNever`,(e,t)=>{Lte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ya(e,t,n,r)});function bne(e){return Fi(yne,e)}const xne=P(`ZodArray`,(e,t)=>{Rte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wa(e,t,n,r),e.element=t.element,oo(e,`ZodArray`,{min(e,t){return this.check(Hi(e,t))},nonempty(e){return this.check(Hi(1,e))},max(e,t){return this.check(Vi(e,t))},length(e,t){return this.check(Ui(e,t))},unwrap(){return this.element}})});function z(e,t){return na(xne,e,t)}const vo=P(`ZodObject`,(e,t)=>{Bte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ta(e,t,n,r),kn(e,`shape`,()=>t.shape),oo(e,`ZodObject`,{keyof(){return H(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:R()})},loose(){return this.clone({...this._zod.def,catchall:R()})},strict(){return this.clone({...this._zod.def,catchall:bne()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return xee(this,e)},safeExtend(e){return See(this,e)},merge(e){return Cee(this,e)},pick(e){return yee(this,e)},omit(e){return bee(this,e)},partial(...e){return wee(Do,this,e[0])},required(...e){return Tee(Ao,this,e[0])}})});function B(e,t){return new vo({type:`object`,shape:e??{},...zn(t)})}function yo(e,t){return new vo({type:`object`,shape:e,catchall:R(),...zn(t)})}const bo=P(`ZodUnion`,(e,t)=>{Ir.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ea(e,t,n,r),e.options=t.options});function xo(e,t){return new bo({type:`union`,options:e,...zn(t)})}const Sne=P(`ZodDiscriminatedUnion`,(e,t)=>{bo.init(e,t),Vte.init(e,t)});function So(e,t,n){return new Sne({type:`union`,options:t,discriminator:e,...zn(n)})}const Cne=P(`ZodIntersection`,(e,t)=>{Hte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Da(e,t,n,r)});function Co(e,t){return new Cne({type:`intersection`,left:e,right:t})}const wo=P(`ZodRecord`,(e,t)=>{Ute.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oa(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function V(e,t,n){return!t||!t._zod?new wo({type:`record`,keyType:F(),valueType:e,...zn(t)}):new wo({type:`record`,keyType:e,valueType:t,...zn(n)})}const To=P(`ZodEnum`,(e,t)=>{Wte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ba(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new To({...t,checks:[],...zn(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new To({...t,checks:[],...zn(r),entries:i})}});function H(e,t){return new To({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...zn(t)})}const wne=P(`ZodLiteral`,(e,t)=>{Gte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xa(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function U(e,t){return new wne({type:`literal`,values:Array.isArray(e)?e:[e],...zn(t)})}const Tne=P(`ZodTransform`,(e,t)=>{Kte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ca(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new bn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Kn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Kn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Eo(e){return new Tne({type:`transform`,transform:e})}const Do=P(`ZodOptional`,(e,t)=>{Br.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ia(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Oo(e){return new Do({type:`optional`,innerType:e})}const Ene=P(`ZodExactOptional`,(e,t)=>{qte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ia(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dne(e){return new Ene({type:`optional`,innerType:e})}const One=P(`ZodNullable`,(e,t)=>{Jte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ka(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ko(e){return new One({type:`nullable`,innerType:e})}const kne=P(`ZodDefault`,(e,t)=>{Yte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ja(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ane(e,t){return new kne({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():In(t)}})}const jne=P(`ZodPrefault`,(e,t)=>{Xte.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ma(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mne(e,t){return new jne({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():In(t)}})}const Ao=P(`ZodNonOptional`,(e,t)=>{Hr.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nne(e,t){return new Ao({type:`nonoptional`,innerType:e,...zn(t)})}const Pne=P(`ZodCatch`,(e,t)=>{Wr.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Na(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Fne(e,t){return new Pne({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const jo=P(`ZodPipe`,(e,t)=>{Gr.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pa(e,t,n,r),e.in=t.in,e.out=t.out});function Mo(e,t){return new jo({type:`pipe`,in:e,out:t})}const Ine=P(`ZodPreprocess`,(e,t)=>{jo.init(e,t),qr.init(e,t)}),Lne=P(`ZodReadonly`,(e,t)=>{Jr.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rne(e){return new Lne({type:`readonly`,innerType:e})}const zne=P(`ZodLazy`,(e,t)=>{Xr.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>La(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function No(e){return new zne({type:`lazy`,getter:e})}const Po=P(`ZodCustom`,(e,t)=>{Zr.init(e,t),so.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sa(e,t,n,r)});function Fo(e,t){return ra(Po,e??(()=>!0),t)}function Bne(e,t={}){return ia(Po,e,t)}function Vne(e,t){return aa(e,t)}function Io(e,t){return new Ine({type:`pipe`,in:Eo(e),out:t})}const Hne=B({path:z(xo([F(),I()])),message:F(),issueCode:F()});So(`code`,[B({code:U(`SCHEMA_INVALID`),issues:z(Hne)}),B({code:U(`WRITE_ERROR`),detail:F()})]);const Lo=[`text`,`number`,`boolean`,`date`,`list`,`object`];H(Lo);const Une=xo([F(),I(),L()]),Ro=No(()=>xo([Une.transform(e=>String(e)),V(F(),zo),z(Ro)])),zo=No(()=>xo([F(),I(),L(),z(Ro),V(F(),zo)]));function Bo(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(Bo(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:Bo(r);return t}return e}Io(Bo,V(F(),zo)),V(F(),xo([zo,_o()]));const Vo=/^---[ \t]*\r?\n([\s\S]*?\r?\n)?---[ \t]*(\r?\n|$)/;function Wne(e){let t=e.match(Vo);return t?{frontmatter:t[0],body:e.slice(t[0].length)}:{frontmatter:``,body:e}}function Gne(e){if(e===``)return``;let t=e.match(Vo);return t?(t[1]??``).replace(/\r?\n$/,``):e}Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});function Ho(e,t){return e>=(t===`leading`?2:1)?e:0}function Uo(e,t){let n={line:e,column:1,offset:t};return{type:`paragraph`,children:[],position:{start:n,end:{...n}}}}function Wo(e,t){let n=e.children,r=n.length===0||t.leading===void 0?0:Ho(t.leading.length,`leading`),i=n.length===0||t.trailing===void 0?0:Ho(t.trailing.length-1,`trailing`);if(r===0&&i===0)return t;let a=n[n.length-1]?.position?.end,o=[],s=[];if(r>0)for(let e=0;e<r;e++)o.push(Uo(1+e,e));if(i>0&&typeof a?.offset==`number`&&typeof a.line==`number`)for(let e=0;e<i;e++)s.push(Uo(a.line+1+e,a.offset+1+e));if(o.length===0&&s.length===0||(e.children=[...o,...n,...s],o.length>0&&delete t.leading,s.length>0&&delete t.trailing,t.bom!==void 0||t.leading!==void 0||t.trailing!==void 0))return t;e.data!==void 0&&delete e.data.sourceDocBoundary}const Kne=new gn.default;Kne.Match_Threshold=.5;function Go(e,t){let n=0;for(let r=0;r<t.length&&n<e.length;r++)e[n]===t[r]&&n++;return n===e.length}const qne=new Set([`sourceRaw`,`sourceDirty`,`position`]),Jne=new Set([`jsxComponent`,`table`,`tableRow`,`tableCell`,`tableHeader`,`list`,`listItem`,`blockquote`,`codeBlock`,`heading`]),Ko={type:`__br__`},Yne=/^<br\s*\/?>$/i;function qo(e){let t=Xo(e,qo);return(t.type===`tableCell`||t.type===`tableHeader`)&&t.content?{...t,content:Jo(t.content)}:t}function Jo(e){let t=[];for(let n of e){let e=Xne(n);e.length!==0&&(t.length>0&&t.push(Ko),t.push(...e))}return t}function Xne(e){return e.text!==void 0||e.type===`hardBreak`||e.type===`jsxInline`?[e]:!e.content||e.content.length===0?[]:e.content.some(e=>e.text===void 0&&e.type!==`hardBreak`&&e.type!==`jsxInline`&&!!e.content)?Jo(e.content):e.content}function Yo(e){return e.type===`hardBreak`||e.type===Ko.type||e.text!==void 0&&Yne.test(e.text.trim())?Ko:Xo(e,Yo)}const Zne=[{label:`table-cell-block-flatten`,severity:`pm-model-caused`,rationale:`GFM table cells have no block spelling; a block placed in a cell is flattened to inline on serialize, so a cell-with-blocks and a cell-with-inline describe the same persisted document.`,proofPointer:`markdown/table-cell-flatten.ts flattenCellBlocks (table-cell-flatten-dropped-block event)`,canonicalize:qo},{label:`void-hardbreak-br`,severity:`serializer-caused`,rationale:`A void hardBreak inside a table cell or heading serializes to a literal <br /> that a fresh parse keeps as text; the node form and the literal form are the same break.`,proofPointer:`markdown/void-br-promoter.ts + markdown/to-markdown-handlers.ts break handler`,canonicalize:Yo}];function Xo(e,t){return e.content?{...e,content:e.content.map(t)}:e}function Zo(e,t){let n={};e.type!==void 0&&(n.type=e.type),e.text!==void 0&&(n.text=e.text);let r=Qo(e.attrs,t);return r&&(n.attrs=r),e.marks&&e.marks.length>0&&(n.marks=[...e.marks].map(e=>({type:e.type,attrs:Qo(e.attrs,t)})).sort((e,t)=>es(e).localeCompare(es(t)))),e.content&&e.content.length>0&&(n.content=e.content.map(e=>Zo(e,t))),n}function Qo(e,t){if(!e)return null;let n={};for(let r of Object.keys(e).sort()){if(qne.has(r)||t?.(r))continue;let i=e[r];i!=null&&(n[r]=t?$o(i,t):i)}return Object.keys(n).length>0?n:null}function $o(e,t){if(Array.isArray(e))return e.map(e=>$o(e,t));if(e&&typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))t(r)||(n[r]=$o(i,t));return n}return e}function es(e){return JSON.stringify(e,(e,t)=>{if(t&&typeof t==`object`&&!Array.isArray(t)){let e={};for(let n of Object.keys(t).sort())e[n]=t[n];return e}return t})}function ts(e,t=!1){let n=``,r=e=>{if(!(t&&e.type===`rawMdxFallback`)&&(e.text!==void 0&&(n+=e.text),e.content))for(let t of e.content)r(t)};return r(e),n.replace(/\s+/g,``)}function ns(e){let t=[],n=e=>{if(e.type&&Jne.has(e.type)){let n=e.type===`jsxComponent`?String(e.attrs?.componentName??``):``;t.push(n?`${e.type}:${n}`:e.type)}if(e.content)for(let t of e.content)n(t)};return n(e),t.sort()}function rs(e){let t=e,n=[];for(let e of Zne){let r=es(t),i=e.canonicalize(t);es(i)!==r&&n.push(e.label),t=i}return{normalized:t,fired:n}}function Qne(e,t,n={}){let r=rs(e),i=rs(t),a=[...new Set([...r.fired,...i.fired])],o=Go(ts(r.normalized),ts(i.normalized)),s=!o&&n.rawSourceSide===`expected`&&Go(ts(r.normalized,!0),ts(i.normalized,!0));if(!o&&!s)return{equivalent:!1,level:`L1`,reason:`content-loss`,appliedDegrades:a,detail:`authored text did not survive the round-trip`};let c=ns(r.normalized),l=ns(i.normalized);if(es(c)!==es(l))return{equivalent:!1,level:`L1`,reason:`structural-shatter`,appliedDegrades:a,detail:`container multiset diverged: [${c.join(`, `)}] vs [${l.join(`, `)}]`};let u=Zo(r.normalized,n.ignoreAttrs),d=Zo(i.normalized,n.ignoreAttrs);return es(u)===es(d)?{equivalent:!0,level:a.length>0?`L2`:`L1`,appliedDegrades:a}:{equivalent:!1,level:`L2`,reason:`structural-divergence`,appliedDegrades:a,detail:is(u,d)}}function is(e,t,n=`doc`){let r=e,i=t;if(!r||!i)return`${n}: node presence differs`;if(r.type!==i.type)return`${n}: type ${String(r.type)} vs ${String(i.type)}`;let a=r.content??[],o=i.content??[];if(a.length!==o.length)return`${n}(${String(r.type)}): child count ${a.length} vs ${o.length}`;for(let e=0;e<a.length;e++)if(es(a[e])!==es(o[e]))return is(a[e],o[e],`${n}>${String(r.type)}[${e}]`);return`${n}(${String(r.type)}): attrs or marks differ`}function $ne(e,t,n){return!Qne(e,t,{ignoreAttrs:n}).equivalent}const ere=new Set([`src`,`href`,`size`]),tre=new Set([`WikiEmbedImage`,`WikiEmbedVideo`,`WikiEmbedAudio`,`WikiEmbedFile`]);function as(e){if(Array.isArray(e))return e.map(e=>as(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))ere.has(n)||(t[n]=as(r));return t}return e}function ss(e){return e.type===`jsxComponent`&&typeof e.attrs?.componentName==`string`&&tre.has(e.attrs.componentName)?as(e):e.content?{...e,content:e.content.map(ss)}:e}function cs(e){if(Array.isArray(e))return e.map(e=>cs(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))n!==`position`&&(t[n]=cs(r));return t}return e}function ls(e){if(e.type===`jsxComponent`)return e;if(e.content)for(let t of e.content){let e=ls(t);if(e)return e}}function nre(e){let t=e.cacheLimit??2048,n=new Map,r=r=>{let i=n.get(r);if(i!==void 0)return i;let a=ls(e.parse(r)),o=a?ss(cs(a)):null;if(n.size>=t){let e=n.keys().next().value;e!==void 0&&n.delete(e)}return n.set(r,o),o};return{isDiverged(e){if(e.type!==`jsxComponent`||!e.attrs||e.attrs.kind===`expression`)return!1;let t=e.attrs.sourceRaw;if(typeof t!=`string`||t.length===0)return!1;let n=r(t);return n?$ne(n,ss(cs(e))):!1}}}const us=`state/bug-reports`,rre=yo({at:F(),transport:F(),outcome:F(),reference:F().optional(),error:F().optional(),errorCode:F().optional()}),ire=yo({reason:F(),at:F(),errorCode:F().optional()});yo({version:I().int().catch(1),id:F(),createdAt:F(),bundleLevel:F(),zipBytes:I().int().nonnegative().catch(0),zipDeleted:L().optional(),state:F(),systemWide:L().optional(),projectSlug:F().nullable().optional(),reference:F().optional(),lastError:ire.optional(),attempts:z(rre).optional(),note:F().optional()}),yo({version:I().int().catch(1),id:F().optional(),sentAt:F().optional(),reference:F().optional()});const ds=new Map([[32,` `],[9,` `],[160,`\xA0`]]);function fs(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function ps(e){let t=fs(e);return t!==null&&ds.has(t)}function are(e){let t=fs(e);return t===null?null:ds.get(t)??null}const ms=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function hs(e){ms.lastIndex=0;let t=e.match(ms);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=are(e);if(t===null)return null;n+=t}return n}const ore=[`off`,`follow`,`full`],gs=`pull`,_s=[`off`,`follow`,`full`,gs],sre=[`follow`,`full`,gs],vs=3600,cre=new Set(Object.keys({sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,feature:`gherkin`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`})),lre=new Set([`md`,`mdx`,`mmd`,`mermaid`]);new Set([...cre,`txt`,`text`,`csv`,`tsv`,`log`,`toml`,`html`,`htm`,`svg`,`vue`,`svelte`,`astro`,`lock`].filter(e=>!lre.has(e)));const ys=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],ure=[`video/mp4`,`video/webm`,`video/ogg`],dre=[`audio/mpeg`,`audio/wav`,`audio/ogg`],fre=[`application/pdf`],bs=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),xs=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),pre=new Set([`pdf`]),Ss=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Cs=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),ws=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),mre=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml.lock`.split(`.`)),Ts=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Es=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],Ds=[`mp4`,`webm`,`mov`,`m4v`],Os=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],ks=[`pdf`],As=[`json`,`toml`,`lock`];function js(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}js(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,Es,bs),js(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,Ds,xs),js(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,Os,Ss),js(`SIDEBAR_PDF_ASSET_EXTENSIONS`,ks,pre),js(`FILE_ATTACHMENT_EXTENSIONS`,[...Cs],Ts),js(`WIKI_EMBED_EXTENSIONS`,[...Ts],ws),new Set(Es),new Set(Ds),new Set(Os),new Set(ks),new Set(As),js(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...Es,...Ds,...Os,...ks,...As])],mre);const hre=new Set([`base`,`canvas`]),gre=new Set([`mmd`,`mermaid`]),_re=new Set([`excalidraw`]),Ms=new Set([...ws,...hre,...gre,..._re]),Ns=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`ar`,`fr`,`bn`,`pt-BR`,`id`,`ur`,`ko`],vre=new Set([`ar`,`ur`]),yre=Ns.filter(e=>!vre.has(e)),bre=[`markdownlint`,`frontmatter`,`okf`],xre=[`missing`,`invalid`];[...bre];const Sre=[`off`,`warning`,`error`],Ps=`warning`,Cre=[`error`,`warning`],Fs=[`base00`,`base01`,`base02`,`base03`,`base04`,`base05`,`base06`,`base07`,`base08`,`base09`,`base0A`,`base0B`,`base0C`,`base0D`,`base0E`,`base0F`],wre={base00:`default background`,base01:`alt background — cards, popovers, sidebar`,base02:`selection background, borders`,base03:`comments, invisibles`,base04:`secondary text`,base05:`default foreground`,base06:`light foreground`,base07:`lightest foreground`,base08:`red — variables, tags, diff deleted`,base09:`orange — numbers, constants`,base0A:`yellow — classes, search highlight`,base0B:`green — strings, diff inserted`,base0C:`cyan — support, escapes, quotes`,base0D:`blue — functions, headings, accent`,base0E:`magenta — keywords, storage`,base0F:`deprecated markers, embedded tags`},Tre=/\P{White_Space}/u;function Ere(e){return Tre.test(e)}function Dre(e){let t=e.palette;return{background:t.base00,foreground:t.base05,card:t.base01,"card-foreground":t.base05,popover:t.base01,"popover-foreground":t.base05,primary:t.base0D,"primary-foreground":t.base00,secondary:t.base01,"secondary-foreground":t.base05,muted:t.base01,"muted-foreground":t.base04,accent:t.base02,"accent-foreground":t.base05,destructive:t.base08,border:t.base02,input:t.base02,ring:t.base0D,"selection-soft":t.base02,"chart-1":t.base0D,"chart-2":t.base0B,"chart-3":t.base0A,"chart-4":t.base0E,"chart-5":t.base08,sidebar:t.base01,"sidebar-foreground":t.base05,"sidebar-primary":t.base0D,"sidebar-primary-foreground":t.base00,"sidebar-accent":t.base02,"sidebar-accent-foreground":t.base0D,"sidebar-hover":t.base02,"sidebar-border":t.base02,"sidebar-ring":t.base0D,"syntax-keyword":t.base0E,"syntax-tag":t.base08,"syntax-attr":t.base0D,"syntax-string":t.base0B,"syntax-number":t.base09,"syntax-atom":t.base0C,"syntax-comment":t.base03,"syntax-func":t.base0D,"syntax-var":t.base08,"syntax-type":t.base0A,"syntax-operator":t.base05,"syntax-meta":t.base0F,"syntax-bg":t.base01,"link-color":t.base0D,"broken-link-color":t.base08,"lint-warning-color":t.base0A,"lint-error-color":t.base08,"diff-added":t.base0B,"diff-removed":t.base08,"diff-modified":t.base0D,"callout-note-color":t.base0D,"callout-info-color":t.base0D,"callout-todo-color":t.base0D,"callout-abstract-color":t.base0C,"callout-tip-color":t.base0B,"callout-success-color":t.base0B,"callout-important-color":t.base0E,"callout-example-color":t.base0E,"callout-question-color":t.base0E,"callout-warning-color":t.base0A,"callout-caution-color":t.base09,"callout-danger-color":t.base09,"callout-failure-color":t.base08,"callout-bug-color":t.base08,"callout-quote-color":t.base03,...kre(t)}}const Is={black:`base00`,red:`base08`,green:`base0B`,yellow:`base0A`,blue:`base0D`,magenta:`base0E`,cyan:`base0C`,white:`base05`,brightBlack:`base03`,brightRed:`base08`,brightGreen:`base0B`,brightYellow:`base0A`,brightBlue:`base0D`,brightMagenta:`base0E`,brightCyan:`base0C`,brightWhite:`base07`},Ore=Object.keys(Is);function kre(e){let t={};for(let n of Ore)t[`ansi-${Are(n)}`]=e[Is[n]];return t}function Are(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}const jre={name:`Dracula`,author:`clach04 (https://github.com/clach04)`,variant:`dark`,palette:{base00:`#282a36`,base01:`#21222c`,base02:`#44475a`,base03:`#6272a4`,base04:`#9ea8c7`,base05:`#f8f8f2`,base06:`#f8f8f2`,base07:`#ffffff`,base08:`#ff5555`,base09:`#ffb86c`,base0A:`#f1fa8c`,base0B:`#50fa7b`,base0C:`#8be9fd`,base0D:`#bd93f9`,base0E:`#ff79c6`,base0F:`#993333`}},Mre={name:`Catppuccin Frappé`,author:`https://github.com/catppuccin/catppuccin`,variant:`dark`,palette:{base00:`#303446`,base01:`#292c3c`,base02:`#414559`,base03:`#51576d`,base04:`#626880`,base05:`#c6d0f5`,base06:`#f2d5cf`,base07:`#babbf1`,base08:`#e78284`,base09:`#ef9f76`,base0A:`#e5c890`,base0B:`#a6d189`,base0C:`#81c8be`,base0D:`#8caaee`,base0E:`#ca9ee6`,base0F:`#eebebe`}},Nre={name:`Catppuccin Latte`,author:`https://github.com/catppuccin/catppuccin`,variant:`light`,palette:{base00:`#eff1f5`,base01:`#e6e9ef`,base02:`#ccd0da`,base03:`#bcc0cc`,base04:`#acb0be`,base05:`#4c4f69`,base06:`#dc8a78`,base07:`#7287fd`,base08:`#d20f39`,base09:`#fe640b`,base0A:`#df8e1d`,base0B:`#40a02b`,base0C:`#179299`,base0D:`#1d62ec`,base0E:`#8839ef`,base0F:`#dd7878`}},Pre={name:`Monokai`,author:`Wimer Hazenberg (http://www.monokai.nl)`,variant:`dark`,palette:{base00:`#272822`,base01:`#383830`,base02:`#49483e`,base03:`#75715e`,base04:`#a59f85`,base05:`#f8f8f2`,base06:`#f5f4f1`,base07:`#f9f8f5`,base08:`#f92672`,base09:`#fd971f`,base0A:`#f4bf75`,base0B:`#a6e22e`,base0C:`#a1efe4`,base0D:`#66d9ef`,base0E:`#ae81ff`,base0F:`#cc6633`}},Fre={name:`Gruvbox dark, medium`,author:`Dawid Kurek, morhetz (https://github.com/morhetz/gruvbox)`,variant:`dark`,palette:{base00:`#282828`,base01:`#3c3836`,base02:`#504945`,base03:`#665c54`,base04:`#bdae93`,base05:`#d5c4a1`,base06:`#ebdbb2`,base07:`#fbf1c7`,base08:`#fb4934`,base09:`#fe8019`,base0A:`#fabd2f`,base0B:`#b8bb26`,base0C:`#8ec07c`,base0D:`#83a598`,base0E:`#d3869b`,base0F:`#d65d0e`}},Ire={name:`Solarized Dark`,author:`Ethan Schoonover (modified by aramisgithub)`,variant:`dark`,palette:{base00:`#002b36`,base01:`#073642`,base02:`#586e75`,base03:`#657b83`,base04:`#839496`,base05:`#93a1a1`,base06:`#eee8d5`,base07:`#fdf6e3`,base08:`#dc322f`,base09:`#cb4b16`,base0A:`#b58900`,base0B:`#859900`,base0C:`#2aa198`,base0D:`#2995e1`,base0E:`#6c71c4`,base0F:`#d33682`}};function Ls(e,t,n){return{id:e,label:t,kind:n.variant,scheme:n,toTokens:()=>Dre(n)}}function Rs(e,t){return{id:e,label:t,kind:`system`}}const zs=[Rs(`default`,`Default`),Ls(`dracula`,`Dracula`,jre),Ls(`catppuccin-frappe`,`Catppuccin Frappé`,Mre),Ls(`catppuccin-latte`,`Catppuccin Latte`,Nre),Ls(`monokai`,`Monokai`,Pre),Ls(`gruvbox`,`Gruvbox`,Fre),Ls(`solarized`,`Solarized`,Ire),Rs(`custom`,`Custom`)],Lre=zs.map(e=>e.id),Bs=/^[a-z0-9-]{1,32}$/;new Map(zs.map(e=>[e.id,e]));const Vs=Symbol.for(`@inkeep/open-knowledge/field-registry`),Hs=globalThis;Hs[Vs]===void 0&&(Hs[Vs]=ti());const Us=Hs[Vs];function Rre(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=zre(t)?Us.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function zre(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}function Bre(){return Object.fromEntries(Fs.map(e=>[e,F().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${wre[e]}, as a #rrggbb hex string.`}).optional()]))}function Ws(){return Lre.filter(e=>e!==`default`&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}const Gs=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),Ks=52428800,qs=26214400,Js=12582912,Ys=`https://api.openai.com/v1`,Xs=`text-embedding-3-small`,Zs=Object.freeze([`127.0.0.1`]),Qs=/^[1-9]\d*(s|m|h)$/,$s=/^https?:\/\//;function ec(e){let t=e.trim();return t===``?`./`:t}function tc(e){let t=ec(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}const nc=yo({content:yo({dir:F().register(Us,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore. Read at server start; changing it requires a restart.`}).default(`.`),attachmentFolderPath:F().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Where pasted and dropped assets are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(tc,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:yo({theme:H([`light`,`dark`,`system`]).register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),language:H([`system`,...Ns]).register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Interface language. 'system' follows the operating system. A personal preference (user scope) — not shared with the project, and never applied to document content.`}).optional(),colorThemeLight:F().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Ws()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(Bs,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeDark:F().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Ws()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(Bs,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorTheme:F().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A short theme id (lowercase letters, digits, and hyphens; max 32 characters); an id no palette matches falls back to 'default'. A personal preference (user scope) — not shared with the project.`}).regex(Bs,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeEnabled:L().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on.`}).optional(),customTheme:yo({name:F().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:F().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's author credit, carried through from an imported base16 scheme.`}).optional(),variant:H([`dark`,`light`]).register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted.`}).optional(),...Bre()}).optional(),preview:yo({autoOpen:L().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:yo({showHiddenFiles:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillGroups:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Group skills in the sidebar by where they came from — the publisher they were imported from, or the plugin that ships them. Skills you authored stay ungrouped at the top of their scope. Per-machine (project-local) — not shared with collaborators.`}).default(!0),pinnedProjectSkills:z(F()).register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Project-scope skills pinned to the top of the Skills sidebar, by name. A pinned skill also keeps its normal row, so a provenance group still lists everything from its source. Per-machine (project-local) — not shared with collaborators.`}).default([]),pinnedGlobalSkills:z(F()).register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Global-scope skills pinned to the top of the Skills sidebar, by name. Stored per USER rather than per project, so a pinned global skill follows you into every project.`}).default([])}).optional()}).default({preview:{autoOpen:!0}}),editor:yo({wordWrap:L().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0),previewTabs:L().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Reuse one tab when clicking through the Files and Skills sidebars, the way an editor preview tab works. Turn off to open every click in its own tab. Pinned tabs keep their own tab either way. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0,previewTabs:!0}),agents:yo({autoApproveOkTools:L().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools (and `ok open` on Claude) for agents launched from the built-in terminal. Destructive tools (delete/move/share/install) still prompt. Per-machine personal preference (user scope)."}).default(!0)}).default({autoApproveOkTools:!0}),autoSync:yo({mode:H(_s).register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`What this machine syncs on a schedule for this project: 'off' (Manual — nothing scheduled; the manual pull/push actions still work), 'follow' (Auto, pull only — scheduled pulls, never a scheduled push; 'pull' is accepted as a legacy alias), or 'full' (Auto, pull and push — bidirectional). Explicit user-triggered pushes work in every mode. null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared. Supersedes the legacy autoSync.enabled boolean.`}).nullable().default(null),enabled:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Legacy per-machine sync toggle, superseded by autoSync.mode. Read only when mode is absent (true = full, false = off). null = not chosen yet. Per-machine (project-local) — not shared.`}).nullable().default(null),resumeMode:H(sre).register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`When sync is paused (autoSync.mode 'off') after having been enabled, the active mode to resume into ('follow' | 'full'). Per-machine UI memory; ignored while a mode is active. Not shared.`}).optional(),pullIntervalSeconds:I().int().min(30).max(vs).register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Seconds between scheduled pulls while autoSync.mode is follow or full (default 30). An unauthenticated follower is additionally floored to the anonymous poll minimum, so a lower value there has no effect. Per-machine (project-local) — not shared.`}).optional().catch(void 0),pushIntervalSeconds:I().int().min(30).max(vs).register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Seconds between scheduled pushes while autoSync.mode is full (default 60). Ignored in every other mode, which never pushes on a schedule. Each cycle with pending edits authors a commit, so a shorter interval means more, smaller commits in the repo's shared history. Per-machine (project-local) — not shared.`}).optional().catch(void 0),default:xo([L(),H(_s)]).register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Committed project default for a machine's sync mode on first open: 'off' | 'follow' | 'full', or the legacy boolean (true = full, false = off). null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.mode choice overrides it.`}).nullable().default(null)}).default({mode:null,enabled:null,default:null}),terminal:yo({enabled:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null),shell:F().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Absolute Windows shell executable override for the in-app terminal. PowerShell, cmd.exe, and Git Bash support OpenKnowledge-managed launches (agent chat tabs and fixed commands such as Resolve in terminal or Install Slidev) and dropped-file path insertion. A different existing executable remains usable for plain terminal tabs and shows a capability notice; requested agent and command launches open only the plain shell without running the agent or command, and dropped-file paths are refused. Empty values use automatic shell discovery. Per-machine (project-local), human-managed, and never shared via git, clone, or sync.`}).optional()}).default({enabled:null}),slides:yo({enabled:L().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Whether the Slides plugin appears in Settings → Plugins. When on, a document whose frontmatter has `slides: true` offers an action that opens the deck in a dedicated window (desktop only, requires a resolvable slidev). A personal preference (user scope). Default off."}).default(!1)}).default({enabled:!1}),telemetry:yo({localSink:yo({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:yo({maxBytes:I().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(Ks)}).default({maxBytes:Ks}),logs:yo({maxBytes:I().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(qs)}).default({maxBytes:qs}),attributeDenylist:z(F()).register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...Gs])}).default({enabled:!0,spans:{maxBytes:Ks},logs:{maxBytes:qs},attributeDenylist:[...Gs]}),skillInstallReports:yo({enabled:L().register(Us,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Report skill installs to skills.sh so a published skill shows an accurate install count. Sends the skill name, its source repo, and which agent tools it was installed for — never file contents, and never for a private or local source. One report per skill per machine. Default on; the DO_NOT_TRACK and DISABLE_TELEMETRY environment variables also turn it off.`}).default(!0)}).default({enabled:!0})}).default({localSink:{enabled:!0,spans:{maxBytes:Ks},logs:{maxBytes:qs},attributeDenylist:[...Gs]},skillInstallReports:{enabled:!0}}),lossCapture:yo({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Record bridge loss-class events (content-free) under .ok/local/loss-capture/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),maxBytes:I().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB).`}).default(Js)}).default({enabled:!0,maxBytes:Js}),bridge:yo({backgroundThrottle:yo({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Keep the desktop window's timers running at full rate while it holds unsynced work, so backgrounding the app never starves sync or recovery; when the window is idle the OS-default background throttling is restored (battery). Honored by the desktop app. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),deferGuard:yo({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Defer a drain-shaped Observer B re-derive when the WYSIWYG fragment holds an un-propagated keystroke Y.Text lacks, so the keystroke survives instead of being stomped. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),lossDetector:yo({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Detect content the bridge silently dropped at its reconciliation boundary (an Observer-A apply arm or a paired agent-undo derive) and write a recovery checkpoint plus a content-free loss event. Detection only — never blocks a write. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),fixedPoint:yo({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Bound the Y.Text→WYSIWYG re-derive loop with a drain-count backstop: a run of re-derive drains that never reaches a raw-byte fixed point freezes the re-derive loop and writes a recovery checkpoint plus a content-free loss event, instead of churning unbounded. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),preDrain:yo({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Before an agent write or undo rebuilds the WYSIWYG fragment, flush an un-propagated keystroke that provably does not overlap the operation into Y.Text so the keystroke survives instead of needing recovery; overlapping or unmodellable cases fall back to the checkpoint floor. Scope: appending writes and single-frame undos — a write that replaces the whole body (replace / edit) overwrites the keystroke either way, so those always take the checkpoint floor. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),flushOnHide:yo({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`On tab hide/unload, force-send each doc's unsynced work to the server and commit its local cache, and re-sync on return to foreground, so a backgrounded tab never strands edits that IndexedDB alone would lose on recycle. Honored client-side. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0})}).default({backgroundThrottle:{enabled:!0},deferGuard:{enabled:!0},lossDetector:{enabled:!0},fixedPoint:{enabled:!0},preDrain:{enabled:!0},flushOnHide:{enabled:!0}}),search:yo({semantic:yo({enabled:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:F().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override to point at a self-hosted server (Ollama / vLLM / LM Studio) or another provider. The API key is NOT stored here — set it with `ok embeddings set-key` (`~/.ok/secrets.yml`); it is sent to whichever endpoint this names."}).default(Ys),model:F().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(Xs),dimensions:I().int().positive().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit (recommended) to detect the model's native size from its first response — that is what lets a non-OpenAI model work without knowing its size up front. Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality; a server that ignores the request param then fails loudly instead of silently. Changing it re-embeds the corpus.`}).optional(),similarityFloor:I().min(0).max(1).register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional()}).default({enabled:!1,baseUrl:Ys,model:Xs})}).default({semantic:{enabled:!1,baseUrl:Ys,model:Xs}}),contentRules:yo({markdownlint:B({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:B({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:z(B({appliesTo:xo([F(),z(F())]).optional(),file:F(),enabled:L().optional()})).register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Frontmatter schema mappings: which docs (appliesTo globs) validate against which JSON Schema file (project-root-relative path).`}).default([])}).default({enabled:!1,schemas:[]}),okf:B({enabled:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the OKF plugin (Open Knowledge Format portability + conformance rules) contributes diagnostics. Advisory warnings; never blocks a write.`}).default(!1),rules:V(F(),L()).register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Per-rule opt-outs for the OKF plugin, keyed by rule id (e.g. no-wiki-links). Omit a rule to leave it enabled; set false to silence it while keeping the plugin on.`}).optional(),generate:B({index:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether OK generates and maintains a navigation index.md in every folder that contains Markdown, each listing the documents in that folder grouped by frontmatter type and linking to its subfolders. OK owns these files: edits to them are replaced on the next rebuild.`}).default(!1)}).default({index:!1})}).default({enabled:!1,generate:{index:!1}})}).default({markdownlint:{enabled:!1},frontmatter:{enabled:!1,schemas:[]},okf:{enabled:!1,generate:{index:!1}}}),validation:yo({links:H(Sre).register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity.`}).default(Ps),fileTreeIndicators:L().register(Us,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0)}).default({links:Ps,fileTreeIndicators:!0}),linkPreviews:yo({enabled:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata — outbound egress, one request per previewed link. Default ON; set to false to turn external previews off. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on.`}).default(!0)}).default({enabled:!0}),server:yo({port:I().int().min(1).max(65535).register(Us,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`TCP port the server listens on. Unset by default: a local start picks a free port dynamically, and deployment platforms inject the PORT environment variable instead. Read at server start; changing it requires a restart.`}).optional(),bind:z(F().min(1)).min(1).register(Us,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Addresses the server binds, e.g. [127.0.0.1] or [0.0.0.0]. Default loopback-only ([127.0.0.1]): nothing off this machine can connect. A non-loopback bind additionally requires the server.allowExternal consent interlock. Per-machine (project-local): a value committed to .ok/config.yml is ignored, so one machine exposing the server can never break local clones for the rest of the team — the exposing host sets it via OK_BIND, --bind, or .ok/local/config.yml. Lists replace, never merge. Read at server start; changing it requires a restart.`}).default([...Zs]),externalUrl:mo({protocol:/^https?$/}).regex($s).register(Us,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Canonical external origin the server is reached at, e.g. https://kb.example.com — its host joins the Host/Origin allowlists (external-Host + CORS admission). Unset by default: the server admits only loopback Hosts. Setting it declares external exposure, which additionally requires the server.allowExternal consent interlock. Read at server start; changing it requires a restart.`}).optional(),allowExternal:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Exposure consent interlock. Once the unified server boot lands, a non-loopback server.bind or a server.externalUrl without allowExternal: true will be refused at boot with a one-line fix. Default off. Per-machine (project-local) — consent never travels via git, clone, or share; containers consent via the environment instead.`}).default(!1),openBrowser:L().register(Us,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Open the UI in a browser when the server starts. Default derived: true when every bind address is loopback (a laptop start pops the UI), false otherwise (a container or exposed bind is headless and must never try). Acts once at start. Per-machine (project-local) — not shared.`}).optional(),idleShutdown:xo([U(`off`),F().regex(Qs)]).register(Us,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m' for a loopback-only, unexposed server; 'off' otherwise — a non-loopback bind, or a loopback bind declared externally reachable (server.allowExternal + server.externalUrl), stays up, because a remote agent keeps it busy over /mcp, which the idle timer does not count. Residual case the derivation cannot see: a loopback server reached by remote agents with no server.externalUrl (e.g. behind a same-box reverse proxy) still idles at 30m — set 'off' by hand. Reloadable — a valid change applies without a restart. Per-machine (project-local) — not shared.`}).optional()}).default({bind:[...Zs],allowExternal:!1})});var rc,ic=n((()=>{rc=`1.9.1`}));function ac(e){let t=new Set([e]),n=new Set,r=e.match(oc);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(oc);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var oc,sc,cc=n((()=>{ic(),oc=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,sc=ac(rc)}));function lc(e,t,n,r=!1){let i=mc[pc]=mc[pc]??{version:rc};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${rc}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${rc}.`),!0}function uc(e){let t=mc[pc]?.version;if(!(!t||!sc(t)))return mc[pc]?.[e]}function dc(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${rc}.`);let n=mc[pc];n&&delete n[e]}var fc,pc,mc,hc=n((()=>{ic(),cc(),fc=rc.split(`.`)[0],pc=Symbol.for(`opentelemetry.js.api.${fc}`),mc=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function gc(e,t,n){let r=uc(`diag`);if(r)return r[e](t,...n)}var _c,vc=n((()=>{hc(),_c=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return gc(`debug`,this._namespace,e)}error(...e){return gc(`error`,this._namespace,e)}info(...e){return gc(`info`,this._namespace,e)}warn(...e){return gc(`warn`,this._namespace,e)}verbose(...e){return gc(`verbose`,this._namespace,e)}}})),yc,bc=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(yc||={})}));function xc(e,t){e<yc.NONE?e=yc.NONE:e>yc.ALL&&(e=yc.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,yc.ERROR),warn:n(`warn`,yc.WARN),info:n(`info`,yc.INFO),debug:n(`debug`,yc.DEBUG),verbose:n(`verbose`,yc.VERBOSE)}}var Sc=n((()=>{bc()})),Cc,wc,Tc=n((()=>{vc(),Sc(),bc(),hc(),Cc=`diag`,wc=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=uc(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:yc.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=uc(`diag`),i=xc(n.logLevel??yc.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return lc(`diag`,i,t,!0)},t.disable=()=>{dc(Cc,t)},t.createComponentLogger=e=>new _c(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}}));function Ec(e){return Symbol.for(e)}var Dc,Oc,kc=n((()=>{Dc=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},Oc=new Dc})),Ac,jc=n((()=>{kc(),Ac=class{active(){return Oc}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),Mc,Nc,Pc,Fc=n((()=>{jc(),hc(),Tc(),Mc=`context`,Nc=new Ac,Pc=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return lc(Mc,e,wc.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return uc(Mc)||Nc}disable(){this._getContextManager().disable(),dc(Mc,wc.instance())}}})),Ic,Lc=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(Ic||={})})),Rc,zc,Bc,Vc=n((()=>{Lc(),Rc=`0000000000000000`,zc=`00000000000000000000000000000000`,Bc={traceId:zc,spanId:Rc,traceFlags:Ic.NONE}})),Hc,Uc=n((()=>{Vc(),Hc=class{constructor(e=Bc){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function Wc(e){return e.getValue(Xc)||void 0}function Gc(){return Wc(Pc.getInstance().active())}function Kc(e,t){return e.setValue(Xc,t)}function qc(e){return e.deleteValue(Xc)}function Jc(e,t){return Kc(e,new Hc(t))}function Yc(e){return Wc(e)?.spanContext()}var Xc,Zc=n((()=>{kc(),Uc(),Fc(),Xc=Ec(`OpenTelemetry Context Key SPAN`)}));function Qc(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(rl[e.charCodeAt(t)]|0)+(rl[e.charCodeAt(t+1)]|0)+(rl[e.charCodeAt(t+2)]|0)+(rl[e.charCodeAt(t+3)]|0);return n===t}function $c(e){return Qc(e,32)&&e!==`00000000000000000000000000000000`}function el(e){return Qc(e,16)&&e!==`0000000000000000`}function tl(e){return $c(e.traceId)&&el(e.spanId)}function nl(e){return new Hc(e)}var rl,il=n((()=>{Vc(),Uc(),rl=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}));function al(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var ol,sl,cl=n((()=>{Fc(),Zc(),Uc(),il(),ol=Pc.getInstance(),sl=class{startSpan(e,t,n=ol.active()){if(t?.root)return new Hc;let r=n&&Yc(n);return al(r)&&tl(r)?new Hc(r):new Hc}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??ol.active(),c=this.startSpan(e,i,s),l=Kc(s,c);return ol.with(l,o,void 0,c)}}})),ll,ul,dl=n((()=>{cl(),ll=new sl,ul=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):ll}}})),fl,pl=n((()=>{cl(),fl=class{getTracer(e,t,n){return new sl}}})),ml,hl,gl=n((()=>{dl(),pl(),ml=new fl,hl=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new ul(this,e,t,n)}getDelegate(){return this._delegate??ml}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}}})),_l,vl=n((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(_l||={})})),yl,bl=n((()=>{Fc(),yl=Pc.getInstance()})),xl,Sl,Cl=n((()=>{hc(),gl(),il(),Zc(),Tc(),xl=`trace`,Sl=class e{constructor(){this._proxyTracerProvider=new hl,this.wrapSpanContext=nl,this.isSpanContextValid=tl,this.deleteSpan=qc,this.getSpan=Wc,this.getActiveSpan=Gc,this.getSpanContext=Yc,this.setSpan=Kc,this.setSpanContext=Jc}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=lc(xl,this._proxyTracerProvider,wc.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return uc(xl)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){dc(xl,wc.instance()),this._proxyTracerProvider=new hl}}})),wl,Tl=n((()=>{Cl(),wl=Sl.getInstance()})),El=n((()=>{Tc(),kc(),bc(),dl(),gl(),vl(),Lc(),il(),Vc(),bl(),Tl()}));function Dl(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function Ol(e,t){let n=e;for(let e of t){n=Dl(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function kl(e,t){let n=Ol(e,t);if(n!==void 0)return Rre(n)}const Al=new Map([[`PORT`,[`server`,`port`]],[`OK_BIND`,[`server`,`bind`]],[`OK_EXTERNAL_URL`,[`server`,`externalUrl`]],[`OK_ALLOW_EXTERNAL`,[`server`,`allowExternal`]],[`OK_OPEN_BROWSER`,[`server`,`openBrowser`]],[`OK_IDLE_SHUTDOWN`,[`server`,`idleShutdown`]]]);function jl(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toUpperCase()}function Ml(e){return`OK_${(e[0]===`server`?e.slice(1):e).map(jl).join(`_`)}`}function Nl(e,t){if(t.length===0)return e.contents??null;let n=e.getIn(t,!0);if((0,on.isNode)(n))return n;for(let n=t.length-1;n>=0;n--){let r=e.getIn(t.slice(0,n),!0);if((0,on.isNode)(r))return r}return e.contents??null}function Pl(e,t){let n=1,r=1,i=Math.min(t,e.length);for(let t=0;t<i;t++)e.charCodeAt(t)===10?(n++,r=1):r++;return{line:n,column:r}}function Fl(e,t,n,r,i){let a=e.split(`
185
185
  `),o=r-1;if(o<0||o>=a.length)return``;let s=a[o]??``,c=t-(i-1)+s.length,l=Math.max(1,Math.min(n,c)-t),u=[],d=String(o+2).length;for(let e=Math.max(0,o-1);e<=Math.min(a.length-1,o+1);e++){let t=e===o,n=t?`>`:` `,r=String(e+1).padStart(d,` `);if(u.push(`${n} ${r} | ${a[e]??``}`),t){let e=` `.repeat(2+d+3+i-1);u.push(`${e}${`^`.repeat(l)}`)}}return u.join(`
186
186
  `)}function Il(e){let t=Nl(e.doc,e.path);if(!t)return;let n=t.range;if(!n)return;let[r,,i=r]=n,{line:a,column:o}=Pl(e.source,r),s=(0,on.isCollection)(t)?Fl(e.source,r,r+1,a,o):Fl(e.source,r,i,a,o);return{file:e.file,line:a,column:o,snippet:s.length>0?s:void 0}}function Ll(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Rl(e){let{value:t,file:n,source:r,doc:i}=e,a=[],o=(e,t)=>{if(t.length>0){let e=kl(nc,t);if(e!==void 0){if(e.scope===`project-local`){let e=Ml(t),o;i!=null&&r!=null&&n!=null&&(o=Il({file:n,source:r,doc:i,path:t})),a.push({path:[...t],...Al.has(e)?{envVar:e}:{},...o===void 0?{}:{source:o}})}return}}if(Ll(e))for(let[n,r]of Object.entries(e))o(r,[...t,n])};return o(t,[]),a}const zl=B({file:F(),line:I().int().min(1),column:I().int().min(1),snippet:F().optional()}),Bl=B({path:z(xo([F(),I()])),message:F(),issueCode:F(),params:V(F(),R()).optional(),source:zl.optional()}),Vl=H([`user`,`project`,`project-local`,`either`]),Hl=H([`user`,`project`,`project-local`]),Ul=B({code:U(`YAML_PARSE`),detail:F()}),Wl=B({code:U(`UNREADABLE`),detail:F()}),Gl=B({code:U(`SCHEMA_INVALID`),issues:z(Bl)}),Kl=B({code:U(`REMOVED_KEY`),path:z(F()),redirect:F(),source:zl.optional()}),ql=So(`code`,[Ul,Gl,Wl,B({code:U(`SCOPE_VIOLATION`),path:z(F()),expectedScope:Vl,actualScope:Hl}),B({code:U(`NOT_AGENT_SETTABLE`),path:z(F())}),B({code:U(`MIXED_SCOPE`),paths:z(B({path:z(F()),scope:Hl}))}),Kl,B({code:U(`WRITE_ERROR`),detail:F()}),B({code:U(`OKIGNORE_INVALID`),detail:F(),lineNumber:I().int().min(1).optional()}),B({code:U(`UNKNOWN`),message:F().optional()})]);So(`code`,[Kl,Ul,Gl,Wl]),B({diagnostics:z(So(`code`,[B({code:U(`REMOVED_KEY`),scope:Hl,file:F(),path:z(F()),redirect:F()}),B({code:U(`YAML_PARSE`),scope:Hl,file:F()}),B({code:U(`SCHEMA_INVALID`),scope:Hl,file:F()}),B({code:U(`UNREADABLE`),scope:Hl,file:F()})]))});const Jl=new Set(ql.options.map(e=>e.shape.code.value)),Yl=xo([ql,yo({code:F(),message:F().optional()})]);function Xl(e){return Jl.has(e.code)}function Zl(e){switch(e){case`user`:return`~/.ok/global.yml`;case`project`:return`.ok/config.yml`;case`project-local`:return`.ok/local/config.yml`;case`either`:return`.ok/config.yml or ~/.ok/global.yml`}}function Ql(e){switch(e){case`user`:return`personal to you, across all projects`;case`project`:return`shared with your team via git`;case`project-local`:return`this machine only, not shared`;case`either`:return`user or project`}}function $l(e){if(!Xl(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${e.detail}`;case`UNREADABLE`:return`Could not read the file: ${e.detail}`;case`SCHEMA_INVALID`:{if(e.issues.length===0)return`Invalid configuration.`;let t=new Map;for(let n of e.issues){let e=n.source?.file??`<no source>`,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let[e,r]of t){e===`<no source>`?n.push(`Invalid configuration:`):n.push(`Invalid configuration at ${e}:`);for(let t of r){let r=t.path.length===0?`<root>`:t.path.join(`.`);if(t.source){if(n.push(` ${e}:${t.source.line}:${t.source.column}`),n.push(` ${r}: ${t.message}`),t.source.snippet&&t.source.snippet.length>0)for(let e of t.source.snippet.split(`
187
187
  `))n.push(` ${e}`)}else n.push(` ${r}: ${t.message}`)}}return n.join(`
@@ -266,7 +266,7 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
266
266
  `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Aoe,this.editor.getAttributes(WC)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=xb({find:GC,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=xb({find:GC,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(WC)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),joe=/^\s*(\[([( |x])?\])\s$/,Moe=Fb.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,Hv(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>Nb(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=Uv(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[xb({find:joe,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),Noe=Fb.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,Hv(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
267
267
  `):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=Mb(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=Mb(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ob.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(AC.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(jC.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(VC.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(KC.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Moe.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Noe.configure(this.options.taskList)),e}});var qC=`&nbsp;`,JC=`\xA0`,Poe=Fb.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,Hv(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===qC||n[0].text===qC||n[0].raw===JC||n[0].text===JC)&&r.length===1&&r[0].type===`text`&&(r[0].text===qC||r[0].text===JC)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?qC:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Foe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ioe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,YC=Zy.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,Hv(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[vb({find:Foe,type:this.type})]},addPasteRules(){return[Ib({find:Ioe,type:this.type})]}}),Loe=YC,Roe=Fb.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),XC=Zy.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,Hv(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),zoe=XC;function Boe(e={}){return new Vf({view(t){return new Voe(t,e)}})}var Voe=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=pf(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},ZC=class e extends Of{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):Of.near(r)}content(){return Ku.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new Hoe(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Uoe(e)||!Woe(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!Pf.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};ZC.prototype.visible=!1,ZC.findFrom=ZC.findGapCursorFrom,Of.jsonID(`gapcursor`,ZC);var Hoe=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ZC.valid(t)?new ZC(t):Of.near(t)}};function QC(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Uoe(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||QC(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Woe(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||QC(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Goe(){return new Vf({props:{decorations:Yoe,createSelectionBetween(e,t,n){return t.pos==n.pos&&ZC.valid(n)?new ZC(n):null},handleClick:qoe,handleKeyDown:Koe,handleDOMEvents:{beforeinput:Joe}}})}const Koe=u_({ArrowLeft:$C(`horiz`,-1),ArrowRight:$C(`horiz`,1),ArrowUp:$C(`vert`,-1),ArrowDown:$C(`vert`,1)});function $C(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof Mf){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=ZC.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new ZC(c))),!0):!1}}function qoe(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!ZC.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Pf.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new ZC(r))),!0)}function Joe(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof ZC))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=Bu.empty;for(let e=r.length-1;e>=0;e--)i=Bu.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new Ku(i,0,0));return a.setSelection(Mf.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function Yoe(e){if(!(e.selection instanceof ZC))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,lg.create(e.doc,[og.widget(e.selection.head,t,{key:`gapcursor`})])}var ew=200,tw=function(){};tw.prototype.append=function(e){return e.length?(e=tw.from(e),!this.length&&e||e.length<ew&&this.leafAppend(e)||this.length<ew&&e.leafPrepend(this)||this.appendInner(e)):this},tw.prototype.prepend=function(e){return e.length?tw.from(e).append(this):this},tw.prototype.appendInner=function(e){return new Xoe(this,e)},tw.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?tw.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},tw.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},tw.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},tw.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},tw.from=function(e){return e instanceof tw?e:e&&e.length?new nw(e):tw.empty};var nw=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=ew)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=ew)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(tw);tw.empty=new nw([]);var Xoe=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(tw),rw=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new iw(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new iw(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new iw(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>Qoe&&(s=Zoe(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new Wd;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new iw(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new iw(i,o,l))}else r.push(new iw(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new iw(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>500&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new iw(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(tw.from(i.reverse()),a)}};rw.empty=new rw(tw.empty,0);function Zoe(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var iw=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},aw=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}};const Qoe=20;function $oe(e,t,n,r){let i=n.getMeta(dw),a;if(i)return i.historyState;n.getMeta(nse)&&(e=new aw(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(dw))return o.getMeta(dw).redo?new aw(e.done.addTransform(n,void 0,r,uw(t)),e.undone,ow(n.mapping.maps),e.prevTime,e.prevComposition):new aw(e.done,e.undone.addTransform(n,void 0,r,uw(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!ese(n,e.prevRanges)),s=o?sw(e.prevRanges,n.mapping):ow(n.mapping.maps);return new aw(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,uw(t)),rw.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new aw(e.done.rebased(n,a),e.undone.rebased(n,a),sw(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new aw(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),sw(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function ese(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function ow(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function sw(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function tse(e,t,n){let r=uw(t),i=dw.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new aw(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(dw,{redo:n,historyState:c})}let cw=!1,lw=null;function uw(e){let t=e.plugins;if(lw!=t){cw=!1,lw=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){cw=!0;break}}return cw}const dw=new Wf(`history`),nse=new Wf(`closeHistory`);function rse(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Vf({key:dw,state:{init(){return new aw(rw.empty,rw.empty,null,0,-1)},apply(t,n,r){return $oe(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?pw:n==`historyRedo`?mw:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function fw(e,t){return(n,r)=>{let i=dw.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=tse(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}const pw=fw(!1,!0),mw=fw(!0,!0);ob.create({name:`characterCount`,addOptions(){return{limit:null,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Vf({key:new Wf(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit;if(i==null||i===0){e=!0;return}let a=this.storage.characters({node:r.doc});if(a>i){let t=a-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var ise=ob.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[Boe(this.options)]}});ob.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new Vf({key:new Wf(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return lg.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(og.node(t,t+e.nodeSize,{class:this.options.className}))}),lg.create(e,a)}}})]}});var ase=ob.create({name:`gapCursor`,addProseMirrorPlugins(){return[Goe()]},extendNodeSchema(e){return{allowGapCursor:Iv(Mv(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),hw=`placeholder`;function ose(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}ob.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:hw,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${ose(this.options.dataAttribute)}`:`data-${hw}`;return[new Vf({key:new Wf(`placeholder`),props:{decorations:({doc:t,selection:n})=>{let r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,a=[];if(!r)return null;let o=this.editor.isEmpty;return t.descendants((t,n)=>{let r=i>=n&&i<=n+t.nodeSize,s=!t.isLeaf&&gy(t);if(!t.type.isTextblock)return this.options.includeChildren;if((r||!this.options.showOnlyCurrent)&&s){let i=[this.options.emptyNodeClass];o&&i.push(this.options.emptyEditorClass);let s=og.node(n,n+t.nodeSize,{class:i.join(` `),[e]:typeof this.options.placeholder==`function`?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});a.push(s)}return this.options.includeChildren}),lg.create(t,a)}}})]}}),ob.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new Vf({key:new Wf(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||_y(n.selection)||e.view.dragging?null:lg.create(n.doc,[og.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function gw({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var sse=ob.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new Wf(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new Vf({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!gw({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!gw({node:r,types:n})}}})]}}),cse=ob.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>pw(e,t),redo:()=>({state:e,dispatch:t})=>mw(e,t)}},addProseMirrorPlugins(){return[rse(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),lse=ob.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(qb.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(TC.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(AC.configure(this.options.bulletList)),this.options.code!==!1&&e.push(EC.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(Bb.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(xoe.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(ise.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(ase.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(ox.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(cx.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(cse.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(DC.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push($b.configure(this.options.italic)),this.options.listItem!==!1&&e.push(jC.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(VC.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(Ox.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(KC.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(Poe.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(YC.configure(this.options.strike)),this.options.text!==!1&&e.push(Roe.configure(this.options.text)),this.options.underline!==!1&&e.push(XC.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(sse.configure(this.options?.trailingNode)),e}});const use=_oe.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),dse=boe.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1},sourcePadded:{default:!1,rendered:!1}}}}),fse=Fb.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),pse=Zy.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),mse=ob.create({name:`docFidelity`,addGlobalAttributes(){return[{types:[`doc`],attributes:{sourceDocBoundary:{default:null,rendered:!1}}}]}});function _w(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return t;return null}function hse(e){let t=!1;return e.descendants(e=>t?!1:(e.type.name===`list`&&(t=!0),!t)),t}function vw(e){let{selection:t}=e;return t instanceof Mf?t.$cursor:null}function gse(e){let t=vw(e);if(!t||t.parentOffset!==0)return!1;let n=_w(t);if(n===null||t.depth!==n+1||t.index(n)!==0)return!1;let r=t.index(n-1);return r===0?!1:hse(t.node(n-1).child(r-1))}function _se(e,t){for(let n=t-1;n>=0;n--){let t=e.node(n),r=e.index(n);if(r<t.childCount-1){let e=t.child(r+1),i=n+1;for(;e.type.name===`list`&&e.firstChild;)e=e.firstChild,i+=1;return e.type.name===`listItem`?i:null}}return null}function vse(e){let t=vw(e);if(!t||t.parentOffset!==t.parent.content.size)return!1;let n=_w(t);if(n===null)return!1;for(let e=t.depth;e>n;e--)if(t.index(e-1)!==t.node(e-1).childCount-1)return!1;let r=_se(t,n);return r!==null&&r<n}const yse=ob.create({name:`listBoundaryMerge`,addKeyboardShortcuts(){let e=()=>{let{editor:e}=this;if(!gse(e.state))return!1;if(e.commands.undoInputRule())return!0;let{state:t,view:n}=e;return Jf(t,n.dispatch,n)},t=()=>{let{editor:e}=this;if(!vse(e.state))return!1;let{state:t,view:n}=e;return Yf(t,n.dispatch,n)};return{Backspace:e,"Mod-Backspace":e,Delete:t,"Mod-Delete":t}}}),bse=ob.create({name:`plainTextClipboard`,priority:1e3,addProseMirrorPlugins(){return[new Vf({key:new Wf(`okPlainTextClipboard`),props:{clipboardTextSerializer:e=>e.content.textBetween(0,e.content.size,`
268
268
 
269
- `)}})]}}),xse=Zy.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function yw(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r||Sse(n)===r?!0:hs(e)===t}function Sse(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const Cse=Loe.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),wse=wC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),Tse=_C.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),Ese=vC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),Dse=Fb.create({name:`tag`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:ix,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),Ose=/^(?:---|—-|___\s|\*\*\*\s)$/;function kse(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const Ase=Soe.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[yb({find:Ose,type:this.type,getAttributes:e=>({sourceRaw:kse(e)})})]}}),jse=zoe.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceForm:{default:`u`,rendered:!1}}}});function bw(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function Mse(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const Nse=Fb.create({name:`wikiLink`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:ix,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:bw(e.getAttribute(`data-alias`)),anchor:bw(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:bw(e.getAttribute(`data-alias`)),anchor:bw(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=bw(e.attrs.alias),i=bw(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},Mse({target:n,alias:r,anchor:i})]}});function xw(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function Pse(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const Sw=[gx,$x,_x,Qx,Nse,Fb.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:ix,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:bw(e.getAttribute(`data-alias`)),anchor:bw(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=bw(e.attrs.alias),i=bw(e.attrs.anchor),a=bw(e.attrs.resolvedSrc),o=xw(n);if(bs.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},Pse({target:n,alias:r,anchor:i})]}}),Dse,Xx,Zx,ex,tx,Cse,jse,dse,Vb,use,lx,Ase,Fx,ux,Ix,sx,nx,mse,xse,bse,lse.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,listKeymap:{listTypes:[{itemName:`listItem`,wrapperNames:[`list`]}]},italic:!1,bold:!1,strike:!1,underline:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),yse,wse.configure({resizable:!0}),yC,Ese,Tse,hx.configure({inline:!0}),dx,nS,pse,fse,ax,rx],Fse=B({changes:z(So(`kind`,[B({key:F(),kind:U(`added`),after:zo}).loose(),B({key:F(),kind:U(`removed`),before:zo}).loose(),B({key:F(),kind:U(`changed`),before:zo,after:zo}).loose()])),unparseable:B({before:F(),after:F()}).loose().nullable()}).loose();function Ise(e){return`'${e.replace(/'/g,`'\\''`)}'`}`${Mu}`,[`delete`,`move`,`share_link`,`install`,`import`].map(e=>`mcp__${Mu}__${e}`),`${Ise(`mcp_servers.${Mu}.default_tools_approval_mode="approve"`)}`,3072-Lse("This is an OpenKnowledge project: load the `open-knowledge` skill and use the OpenKnowledge MCP tools for all markdown — don't probe for `.ok/` or use native file tools on `.md` / `.mdx`. ",`cursor`),new TextEncoder;function Lse(e,t){let n=encodeURIComponent(e);return t===`cursor`?encodeURIComponent(n).length:n.length}function Rse(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}function Cw(e,t){let n=Rse(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const ww=F().superRefine(Cw).optional(),zse=F().superRefine(Cw),Tw={agentId:F().optional(),agentName:F().optional(),colorSeed:F().optional(),clientName:F().optional(),clientVersion:F().optional(),label:F().optional()},Ew=F().optional(),Bse=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;So(`kind`,[B({kind:U(`doc`),docPath:F().min(1)}).loose(),B({kind:U(`folder`),folderPath:F()}).loose()]);const Dw=H([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`unsupported-share-url`]),Ow=H([`current`,`stale`,`absent`,`empty`]);So(`ok`,[B({ok:U(!0),shareUrl:F().min(1),sharedUrl:F().min(1),branch:F().min(1),freshness:Ow.optional().catch(void 0)}).loose(),B({ok:U(!1),error:Dw,branch:F().min(1).optional()}).loose()]);const Vse=H([`user`,`org`]),Hse=B({login:F().min(1),kind:Vse,avatarUrl:F().optional()}).loose(),kw=H([`auth-required`,`network`]);So(`ok`,[B({ok:U(!0),owners:z(Hse)}).loose(),B({ok:U(!1),error:kw}).loose()]),So(`ok`,[B({ok:U(!0),available:L()}).loose(),B({ok:U(!1),error:kw}).loose()]);const Use=H([`public`,`private`]);B({owner:F().min(1),name:F().min(1),visibility:Use,description:F().optional()}).loose();const Wse=H([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]);So(`ok`,[B({ok:U(!0),ownerLogin:F().min(1),repoName:F().min(1),cloneUrl:F().min(1),defaultBranch:F().min(1)}).loose(),B({ok:U(!1),error:Wse}).loose()]);function Aw(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const jw=e=>e.refine(Aw,`invalid branch name`),Mw={shareTargetExists:L(),dirtyConflicts:B({conflicts:L(),files:z(F().min(1))}).loose(),branchIsLocal:L(),shareTargetOnOriginBranch:L().optional()};So(`detached`,[B({detached:U(!1),currentBranch:F().min(1).nullable(),currentHeadSha:_o(),...Mw}).loose(),B({detached:U(!0),currentBranch:_o(),currentHeadSha:F().min(1),...Mw}).loose()]),B({branch:jw(F().min(1)),principalId:F().optional(),fastForward:L().optional()}).loose();const Gse=H([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]);So(`ok`,[B({ok:U(!0)}).loose(),B({ok:U(!1),reason:Gse,files:z(F().min(1)).optional(),otherWorktreePath:F().min(1).optional()}).loose()]),H([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]),B({branch:jw(F().min(1)),path:F(),kind:H([`doc`,`folder`]),contentRootDepth:I().int().min(1).max(65535).optional()}).loose(),So(`verdict`,[B({verdict:U(`on-origin`)}).loose(),B({verdict:U(`renamed`),renamedTo:F().min(1)}).loose(),B({verdict:U(`deleted`)}).loose(),B({verdict:U(`never-on-branch`)}).loose(),B({verdict:U(`changed-locally`)}).loose(),B({verdict:U(`unknown`)}).loose()]).catch({verdict:`unknown`});const Kse=B({startedAt:F().min(1),httpListenMs:I().nonnegative().optional(),seedWalkMs:I().nonnegative().optional(),indexesMs:I().nonnegative().optional(),readyMs:I().nonnegative().optional(),fileCount:I().nonnegative().optional()});B({serverInstanceId:F().min(1),currentBranch:F().min(1).optional(),currentDiskAckSVs:V(F().min(1),F().min(1)).optional(),boot:Kse.optional(),collabClients:I().int().nonnegative().optional()}).loose(),B({id:F().min(1),display_name:F().min(1),display_email:F(),source:H([`git-config`,`synthesized`]),created_at:F().min(1)}).loose(),B({collabUrl:F().nullable(),previewUrl:F().nullable(),port:I(),singleFile:L().default(!1)}).loose();const Nw=H(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:derived-index-unavailable.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:unresolved-conflict-markers.urn:ok:error:no-conflict-tracked.urn:ok:error:no-blocking-changes.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed.urn:ok:error:registry-unreachable.urn:ok:error:config-not-writable.urn:ok:error:audit-superseded.urn:ok:error:theme-name-taken.urn:ok:error:theme-name-invalid`.split(`.`)),qse=B({type:Nw,title:F().min(1),status:I().int().min(400).max(599),instance:F().regex(Bse,`instance must be urn:uuid:<uuid>`).optional(),detail:F().optional()}).loose();B({parentDocName:F().min(1),placement:H([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:F().min(1).optional(),agentName:F().min(1).optional()}).loose(),B({src:F().min(1),path:F().min(1).optional(),deduped:L().optional()}).loose(),B({url:F().min(1),dir:F().min(1),branch:F().min(1).refine(Aw,`invalid branch name`).optional()}).loose(),B({type:U(`error`),problem:qse}).loose();function Pw(e){try{let t=Intl.getCanonicalLocales(e)[0];return t===void 0?null:t}catch{return null}}function Fw(e){try{let t=Intl.getCanonicalLocales(e)[0];if(t===void 0)return null;let n=new Intl.Locale(t).maximize();return!n.language||!n.script?null:`${n.language}-${n.script}`}catch{return null}}function Iw(e,t){let n=t.map(e=>[Fw(e),e]);for(let t of e){let e=Fw(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function Jse(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=Iw([t],i);if(e!==void 0)return{locale:e,source:`override`}}if(n!==void 0&&n!==`system`&&i.includes(n))return{locale:n,source:`explicit`};let o=Iw(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}const Yse=[`.ok`,`local`,`installed-skills.json`],Xse=H(pu),Zse=yo({hosts:z(F()),scope:Xse,scripts:L(),installedAt:za(),projection:H([`symlink`,`copy`]).optional(),contentHash:F().optional()}),Qse=yo({schema:U(1),skills:V(F(),Zse).default({})});function $se(e){let t;try{t=JSON.parse(e)}catch{return null}let n=Qse.safeParse(t);return n.success?n.data:null}const Lw=[{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"\\]+\\"|"[A-Za-z0-9\-._~+/=]+"|[^\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]`},{name:`macos-home-path`,regex:/\/Users\/[^/"\r]*[^/"\r\\]/g,replacement:`~`},{name:`linux-home-path`,regex:/\/home\/[^/"\r]*[^/"\r\\]/g,replacement:`~`},{name:`windows-home-path`,regex:/[A-Za-z]:\\{1,2}Users\\{1,2}(?:(?![A-Za-z]:\\)[^\\"\r])+/gi,replacement:`~`}],ece=Lw.map(e=>e.name);function Rw(e){let t=new Set,n=0;return{redacted:e.split(`
269
+ `)}})]}}),xse=Zy.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function yw(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r||Sse(n)===r?!0:hs(e)===t}function Sse(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const Cse=Loe.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),wse=wC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),Tse=_C.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),Ese=vC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),Dse=Fb.create({name:`tag`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:ix,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),Ose=/^(?:---|—-|___\s|\*\*\*\s)$/;function kse(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const Ase=Soe.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[yb({find:Ose,type:this.type,getAttributes:e=>({sourceRaw:kse(e)})})]}}),jse=zoe.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceForm:{default:`u`,rendered:!1}}}});function bw(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function Mse(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const Nse=Fb.create({name:`wikiLink`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:ix,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:bw(e.getAttribute(`data-alias`)),anchor:bw(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:bw(e.getAttribute(`data-alias`)),anchor:bw(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=bw(e.attrs.alias),i=bw(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},Mse({target:n,alias:r,anchor:i})]}});function xw(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function Pse(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const Sw=[gx,$x,_x,Qx,Nse,Fb.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:ix,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:bw(e.getAttribute(`data-alias`)),anchor:bw(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=bw(e.attrs.alias),i=bw(e.attrs.anchor),a=bw(e.attrs.resolvedSrc),o=xw(n);if(bs.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},Pse({target:n,alias:r,anchor:i})]}}),Dse,Xx,Zx,ex,tx,Cse,jse,dse,Vb,use,lx,Ase,Fx,ux,Ix,sx,nx,mse,xse,bse,lse.configure({trailingNode:!1,undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,listKeymap:{listTypes:[{itemName:`listItem`,wrapperNames:[`list`]}]},italic:!1,bold:!1,strike:!1,underline:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),yse,wse.configure({resizable:!0}),yC,Ese,Tse,hx.configure({inline:!0}),dx,nS,pse,fse,ax,rx],Fse=B({changes:z(So(`kind`,[B({key:F(),kind:U(`added`),after:zo}).loose(),B({key:F(),kind:U(`removed`),before:zo}).loose(),B({key:F(),kind:U(`changed`),before:zo,after:zo}).loose()])),unparseable:B({before:F(),after:F()}).loose().nullable()}).loose();function Ise(e){return`'${e.replace(/'/g,`'\\''`)}'`}`${Mu}`,[`delete`,`move`,`share_link`,`install`,`import`].map(e=>`mcp__${Mu}__${e}`),`${Ise(`mcp_servers.${Mu}.default_tools_approval_mode="approve"`)}`,3072-Lse("This is an OpenKnowledge project: load the `open-knowledge` skill and use the OpenKnowledge MCP tools for all markdown — don't probe for `.ok/` or use native file tools on `.md` / `.mdx`. ",`cursor`),new TextEncoder;function Lse(e,t){let n=encodeURIComponent(e);return t===`cursor`?encodeURIComponent(n).length:n.length}function Rse(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}function Cw(e,t){let n=Rse(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const ww=F().superRefine(Cw).optional(),zse=F().superRefine(Cw),Tw={agentId:F().optional(),agentName:F().optional(),colorSeed:F().optional(),clientName:F().optional(),clientVersion:F().optional(),label:F().optional()},Ew=F().optional(),Bse=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;So(`kind`,[B({kind:U(`doc`),docPath:F().min(1)}).loose(),B({kind:U(`folder`),folderPath:F()}).loose()]);const Dw=H([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`unsupported-share-url`]),Ow=H([`current`,`stale`,`absent`,`empty`]);So(`ok`,[B({ok:U(!0),shareUrl:F().min(1),sharedUrl:F().min(1),branch:F().min(1),freshness:Ow.optional().catch(void 0)}).loose(),B({ok:U(!1),error:Dw,branch:F().min(1).optional()}).loose()]);const Vse=H([`user`,`org`]),Hse=B({login:F().min(1),kind:Vse,avatarUrl:F().optional()}).loose(),kw=H([`auth-required`,`network`]);So(`ok`,[B({ok:U(!0),owners:z(Hse)}).loose(),B({ok:U(!1),error:kw}).loose()]),So(`ok`,[B({ok:U(!0),available:L()}).loose(),B({ok:U(!1),error:kw}).loose()]);const Use=H([`public`,`private`]);B({owner:F().min(1),name:F().min(1),visibility:Use,description:F().optional()}).loose();const Wse=H([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]);So(`ok`,[B({ok:U(!0),ownerLogin:F().min(1),repoName:F().min(1),cloneUrl:F().min(1),defaultBranch:F().min(1)}).loose(),B({ok:U(!1),error:Wse}).loose()]);function Aw(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const jw=e=>e.refine(Aw,`invalid branch name`),Mw={shareTargetExists:L(),dirtyConflicts:B({conflicts:L(),files:z(F().min(1))}).loose(),branchIsLocal:L(),shareTargetOnOriginBranch:L().optional()};So(`detached`,[B({detached:U(!1),currentBranch:F().min(1).nullable(),currentHeadSha:_o(),...Mw}).loose(),B({detached:U(!0),currentBranch:_o(),currentHeadSha:F().min(1),...Mw}).loose()]),B({branch:jw(F().min(1)),principalId:F().optional(),fastForward:L().optional()}).loose();const Gse=H([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]);So(`ok`,[B({ok:U(!0)}).loose(),B({ok:U(!1),reason:Gse,files:z(F().min(1)).optional(),otherWorktreePath:F().min(1).optional()}).loose()]),H([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]),B({branch:jw(F().min(1)),path:F(),kind:H([`doc`,`folder`]),contentRootDepth:I().int().min(1).max(65535).optional()}).loose(),So(`verdict`,[B({verdict:U(`on-origin`)}).loose(),B({verdict:U(`renamed`),renamedTo:F().min(1)}).loose(),B({verdict:U(`deleted`)}).loose(),B({verdict:U(`never-on-branch`)}).loose(),B({verdict:U(`changed-locally`)}).loose(),B({verdict:U(`unknown`)}).loose()]).catch({verdict:`unknown`});const Kse=B({startedAt:F().min(1),httpListenMs:I().nonnegative().optional(),seedWalkMs:I().nonnegative().optional(),indexesMs:I().nonnegative().optional(),readyMs:I().nonnegative().optional(),fileCount:I().nonnegative().optional()});B({serverInstanceId:F().min(1),currentBranch:F().min(1).optional(),currentDiskAckSVs:V(F().min(1),F().min(1)).optional(),boot:Kse.optional(),collabClients:I().int().nonnegative().optional()}).loose(),B({id:F().min(1),display_name:F().min(1),display_email:F(),source:H([`git-config`,`synthesized`]),created_at:F().min(1)}).loose(),B({collabUrl:F().nullable(),previewUrl:F().nullable(),port:I(),singleFile:L().default(!1)}).loose();const Nw=H(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:derived-index-unavailable.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:unresolved-conflict-markers.urn:ok:error:no-conflict-tracked.urn:ok:error:no-blocking-changes.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed.urn:ok:error:registry-unreachable.urn:ok:error:config-not-writable.urn:ok:error:audit-superseded.urn:ok:error:theme-name-taken.urn:ok:error:theme-name-invalid`.split(`.`)),qse=B({type:Nw,title:F().min(1),status:I().int().min(400).max(599),instance:F().regex(Bse,`instance must be urn:uuid:<uuid>`).optional(),detail:F().optional()}).loose();B({parentDocName:F().min(1),placement:H([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:F().min(1).optional(),agentName:F().min(1).optional()}).loose(),B({src:F().min(1),path:F().min(1).optional(),deduped:L().optional()}).loose(),B({url:F().min(1),dir:F().min(1),branch:F().min(1).refine(Aw,`invalid branch name`).optional()}).loose(),B({type:U(`error`),problem:qse}).loose();function Pw(e){try{let t=Intl.getCanonicalLocales(e)[0];return t===void 0?null:t}catch{return null}}function Fw(e){try{let t=Intl.getCanonicalLocales(e)[0];if(t===void 0)return null;let n=new Intl.Locale(t).maximize();return!n.language||!n.script?null:`${n.language}-${n.script}`}catch{return null}}function Iw(e,t){let n=t.map(e=>[Fw(e),e]);for(let t of e){let e=Fw(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function Jse(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=Iw([t],i);if(e!==void 0)return{locale:e,source:`override`}}if(n!==void 0&&n!==`system`&&i.includes(n))return{locale:n,source:`explicit`};let o=Iw(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}const Yse=[`.ok`,`local`,`installed-skills.json`],Xse=H(pu),Zse=yo({hosts:z(F()),scope:Xse,scripts:L(),installedAt:za(),projection:H([`symlink`,`copy`]).optional(),contentHash:F().optional()}),Qse=yo({schema:U(1),skills:V(F(),Zse).default({})});function $se(e){let t;try{t=JSON.parse(e)}catch{return null}let n=Qse.safeParse(t);return n.success?n.data:null}const Lw=[{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"\\]+\\"|"[A-Za-z0-9\-._~+/=]+"|[^\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]`},{name:`macos-home-path`,regex:/\/Users\/[^/"\r]*[^/"\r\\]/g,replacement:`~`},{name:`linux-home-path`,regex:/\/home\/[^/"\r]*[^/"\r\\]/g,replacement:`~`},{name:`windows-home-path`,regex:/[A-Za-z]:\\{1,2}Users\\{1,2}(?:(?![A-Za-z]:\\)[^\\"\r])+/gi,replacement:`~`}],ece=Lw.map(e=>e.name);function Rw(e){let t=new Set,n=0;return{redacted:e.split(`
270
270
  `).map(e=>{let r=e,i=!1;for(let{name:e,regex:n,replacement:a}of Lw)n.lastIndex=0,n.test(r)&&(t.add(e),i=!0,n.lastIndex=0,r=r.replace(n,a));return i&&n++,r}).join(`
271
271
  `),patterns:[...t],lineCount:n}}function tce(e,t,n=3){let r=RegExp(`^ {0,3}(\\${e}+)[ \\t]*$`),i=Math.max(3,n);for(let e of t.split(`
272
272
  `)){let t=r.exec(e);t&&t[1].length>=i&&(i=t[1].length+1)}return i}const nce={};function zw(e,t){let n=t||nce;return Bw(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Bw(e,t,n){if(rce(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Vw(e.children,t,n)}return Array.isArray(e)?Vw(e,t,n):``}function Vw(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Bw(e[i],t,n);return r.join(``)}function rce(e){return!!(e&&typeof e==`object`)}const Hw={AElig:`Æ`,AMP:`&`,Aacute:`Á`,Abreve:`Ă`,Acirc:`Â`,Acy:`А`,Afr:`𝔄`,Agrave:`À`,Alpha:`Α`,Amacr:`Ā`,And:`⩓`,Aogon:`Ą`,Aopf:`𝔸`,ApplyFunction:`⁡`,Aring:`Å`,Ascr:`𝒜`,Assign:`≔`,Atilde:`Ã`,Auml:`Ä`,Backslash:`∖`,Barv:`⫧`,Barwed:`⌆`,Bcy:`Б`,Because:`∵`,Bernoullis:`ℬ`,Beta:`Β`,Bfr:`𝔅`,Bopf:`𝔹`,Breve:`˘`,Bscr:`ℬ`,Bumpeq:`≎`,CHcy:`Ч`,COPY:`©`,Cacute:`Ć`,Cap:`⋒`,CapitalDifferentialD:`ⅅ`,Cayleys:`ℭ`,Ccaron:`Č`,Ccedil:`Ç`,Ccirc:`Ĉ`,Cconint:`∰`,Cdot:`Ċ`,Cedilla:`¸`,CenterDot:`·`,Cfr:`ℭ`,Chi:`Χ`,CircleDot:`⊙`,CircleMinus:`⊖`,CirclePlus:`⊕`,CircleTimes:`⊗`,ClockwiseContourIntegral:`∲`,CloseCurlyDoubleQuote:`”`,CloseCurlyQuote:`’`,Colon:`∷`,Colone:`⩴`,Congruent:`≡`,Conint:`∯`,ContourIntegral:`∮`,Copf:`ℂ`,Coproduct:`∐`,CounterClockwiseContourIntegral:`∳`,Cross:`⨯`,Cscr:`𝒞`,Cup:`⋓`,CupCap:`≍`,DD:`ⅅ`,DDotrahd:`⤑`,DJcy:`Ђ`,DScy:`Ѕ`,DZcy:`Џ`,Dagger:`‡`,Darr:`↡`,Dashv:`⫤`,Dcaron:`Ď`,Dcy:`Д`,Del:`∇`,Delta:`Δ`,Dfr:`𝔇`,DiacriticalAcute:`´`,DiacriticalDot:`˙`,DiacriticalDoubleAcute:`˝`,DiacriticalGrave:"`",DiacriticalTilde:`˜`,Diamond:`⋄`,DifferentialD:`ⅆ`,Dopf:`𝔻`,Dot:`¨`,DotDot:`⃜`,DotEqual:`≐`,DoubleContourIntegral:`∯`,DoubleDot:`¨`,DoubleDownArrow:`⇓`,DoubleLeftArrow:`⇐`,DoubleLeftRightArrow:`⇔`,DoubleLeftTee:`⫤`,DoubleLongLeftArrow:`⟸`,DoubleLongLeftRightArrow:`⟺`,DoubleLongRightArrow:`⟹`,DoubleRightArrow:`⇒`,DoubleRightTee:`⊨`,DoubleUpArrow:`⇑`,DoubleUpDownArrow:`⇕`,DoubleVerticalBar:`∥`,DownArrow:`↓`,DownArrowBar:`⤓`,DownArrowUpArrow:`⇵`,DownBreve:`̑`,DownLeftRightVector:`⥐`,DownLeftTeeVector:`⥞`,DownLeftVector:`↽`,DownLeftVectorBar:`⥖`,DownRightTeeVector:`⥟`,DownRightVector:`⇁`,DownRightVectorBar:`⥗`,DownTee:`⊤`,DownTeeArrow:`↧`,Downarrow:`⇓`,Dscr:`𝒟`,Dstrok:`Đ`,ENG:`Ŋ`,ETH:`Ð`,Eacute:`É`,Ecaron:`Ě`,Ecirc:`Ê`,Ecy:`Э`,Edot:`Ė`,Efr:`𝔈`,Egrave:`È`,Element:`∈`,Emacr:`Ē`,EmptySmallSquare:`◻`,EmptyVerySmallSquare:`▫`,Eogon:`Ę`,Eopf:`𝔼`,Epsilon:`Ε`,Equal:`⩵`,EqualTilde:`≂`,Equilibrium:`⇌`,Escr:`ℰ`,Esim:`⩳`,Eta:`Η`,Euml:`Ë`,Exists:`∃`,ExponentialE:`ⅇ`,Fcy:`Ф`,Ffr:`𝔉`,FilledSmallSquare:`◼`,FilledVerySmallSquare:`▪`,Fopf:`𝔽`,ForAll:`∀`,Fouriertrf:`ℱ`,Fscr:`ℱ`,GJcy:`Ѓ`,GT:`>`,Gamma:`Γ`,Gammad:`Ϝ`,Gbreve:`Ğ`,Gcedil:`Ģ`,Gcirc:`Ĝ`,Gcy:`Г`,Gdot:`Ġ`,Gfr:`𝔊`,Gg:`⋙`,Gopf:`𝔾`,GreaterEqual:`≥`,GreaterEqualLess:`⋛`,GreaterFullEqual:`≧`,GreaterGreater:`⪢`,GreaterLess:`≷`,GreaterSlantEqual:`⩾`,GreaterTilde:`≳`,Gscr:`𝒢`,Gt:`≫`,HARDcy:`Ъ`,Hacek:`ˇ`,Hat:`^`,Hcirc:`Ĥ`,Hfr:`ℌ`,HilbertSpace:`ℋ`,Hopf:`ℍ`,HorizontalLine:`─`,Hscr:`ℋ`,Hstrok:`Ħ`,HumpDownHump:`≎`,HumpEqual:`≏`,IEcy:`Е`,IJlig:`IJ`,IOcy:`Ё`,Iacute:`Í`,Icirc:`Î`,Icy:`И`,Idot:`İ`,Ifr:`ℑ`,Igrave:`Ì`,Im:`ℑ`,Imacr:`Ī`,ImaginaryI:`ⅈ`,Implies:`⇒`,Int:`∬`,Integral:`∫`,Intersection:`⋂`,InvisibleComma:`⁣`,InvisibleTimes:`⁢`,Iogon:`Į`,Iopf:`𝕀`,Iota:`Ι`,Iscr:`ℐ`,Itilde:`Ĩ`,Iukcy:`І`,Iuml:`Ï`,Jcirc:`Ĵ`,Jcy:`Й`,Jfr:`𝔍`,Jopf:`𝕁`,Jscr:`𝒥`,Jsercy:`Ј`,Jukcy:`Є`,KHcy:`Х`,KJcy:`Ќ`,Kappa:`Κ`,Kcedil:`Ķ`,Kcy:`К`,Kfr:`𝔎`,Kopf:`𝕂`,Kscr:`𝒦`,LJcy:`Љ`,LT:`<`,Lacute:`Ĺ`,Lambda:`Λ`,Lang:`⟪`,Laplacetrf:`ℒ`,Larr:`↞`,Lcaron:`Ľ`,Lcedil:`Ļ`,Lcy:`Л`,LeftAngleBracket:`⟨`,LeftArrow:`←`,LeftArrowBar:`⇤`,LeftArrowRightArrow:`⇆`,LeftCeiling:`⌈`,LeftDoubleBracket:`⟦`,LeftDownTeeVector:`⥡`,LeftDownVector:`⇃`,LeftDownVectorBar:`⥙`,LeftFloor:`⌊`,LeftRightArrow:`↔`,LeftRightVector:`⥎`,LeftTee:`⊣`,LeftTeeArrow:`↤`,LeftTeeVector:`⥚`,LeftTriangle:`⊲`,LeftTriangleBar:`⧏`,LeftTriangleEqual:`⊴`,LeftUpDownVector:`⥑`,LeftUpTeeVector:`⥠`,LeftUpVector:`↿`,LeftUpVectorBar:`⥘`,LeftVector:`↼`,LeftVectorBar:`⥒`,Leftarrow:`⇐`,Leftrightarrow:`⇔`,LessEqualGreater:`⋚`,LessFullEqual:`≦`,LessGreater:`≶`,LessLess:`⪡`,LessSlantEqual:`⩽`,LessTilde:`≲`,Lfr:`𝔏`,Ll:`⋘`,Lleftarrow:`⇚`,Lmidot:`Ŀ`,LongLeftArrow:`⟵`,LongLeftRightArrow:`⟷`,LongRightArrow:`⟶`,Longleftarrow:`⟸`,Longleftrightarrow:`⟺`,Longrightarrow:`⟹`,Lopf:`𝕃`,LowerLeftArrow:`↙`,LowerRightArrow:`↘`,Lscr:`ℒ`,Lsh:`↰`,Lstrok:`Ł`,Lt:`≪`,Map:`⤅`,Mcy:`М`,MediumSpace:` `,Mellintrf:`ℳ`,Mfr:`𝔐`,MinusPlus:`∓`,Mopf:`𝕄`,Mscr:`ℳ`,Mu:`Μ`,NJcy:`Њ`,Nacute:`Ń`,Ncaron:`Ň`,Ncedil:`Ņ`,Ncy:`Н`,NegativeMediumSpace:`​`,NegativeThickSpace:`​`,NegativeThinSpace:`​`,NegativeVeryThinSpace:`​`,NestedGreaterGreater:`≫`,NestedLessLess:`≪`,NewLine:`
@@ -1529,6 +1529,6 @@ export default function okBridge(pi: {
1529
1529
  `))}function M9(e,t){let n=S(e,`utf-8`);if(n.trim().length!==0)try{let r=A9(JSON.parse(n),t),i=n.endsWith(`
1530
1530
  `)?`
1531
1531
  `:``;te(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=k9(n,t.contentDir);r!==n&&te(e,r)}}function N9(e,t){let n=S(e,`utf-8`),r=k9(n,t.contentDir);r!==n&&te(e,r)}function P9(e){try{return C(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>N(e,t.name))}catch{return[]}}const XTe=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function F9(e){return/\.log\.\d+$/.test(e)}function ZTe(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||F9(e)}const QTe=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function $Te(e){let t={contentDir:e.contentDir};for(let n of QTe)for(let r of P9(N(e.stagingDir,n)))ZTe(r)?j9(r,t):r.endsWith(`.json`)?M9(r,t):N9(r,t);for(let n of P9(N(e.stagingDir,`state`))){let e=fe(n);n.endsWith(`.jsonl`)?j9(n,t):XTe.has(e)?M9(n,t):N9(n,t)}}const I9=[`.ok`,`local`,`telemetry`],L9=[`.ok`,`local`,`logs`],R9=[`.ok`,`local`,`loss-capture`],z9=`spans-current.jsonl`,B9=`spans-prev.jsonl`,V9=`server-current.jsonl`,H9=`server-prev.jsonl`,U9=`loss-current.jsonl`,W9=`loss-prev.jsonl`;function eEe(e){return N(e,...I9,z9)}function tEe(e){return N(e,...I9,B9)}function nEe(e){return N(e,...L9,V9)}function rEe(e){return N(e,...L9,H9)}function iEe(e){return N(e,...R9,U9)}function aEe(e){return N(e,...R9,W9)}const G9=1e3;async function oEe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}async function sEe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}async function cEe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}function lEe(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
1532
- `)}\n`:null}catch{return null}}function uEe(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`log`,`--oneline`,`-50`],l3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function dEe(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],l3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function K9(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function fEe(){return{nodeVersion:process.version,platform:k(),arch:re()}}function pEe(){return process.env.OTEL_SDK_DISABLED===`false`}function q9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function J9(e){if(!g(e))return{};let t;try{t=(0,on.parse)(S(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!q9(t))return{};let n=t.telemetry;if(!q9(n))return{};let r=n.localSink;return q9(r)?r:{}}function Y9(e){return typeof e==`boolean`?e:void 0}function mEe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function X9(e){if(q9(e))return mEe(e.maxBytes)}function hEe(e){let t=J9(JQ(`project`,e)),n=J9(JQ(`project-local`,e));return{enabled:Y9(n.enabled)??Y9(t.enabled)??!0,spansMaxBytes:X9(n.spans)??X9(t.spans)??52428800,logsMaxBytes:X9(n.logs)??X9(t.logs)??26214400}}function gEe(e){return Ae(`sha256`).update(e).digest(`hex`)}function _Ee(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const vEe=[`"doc.name"`,`"docName"`];function yEe(e){let t=S(e,`utf-8`),n=0;for(let e of vEe){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z9(e,t){if(!g(e))return!1;try{return v(pe(t),{recursive:!0}),e.endsWith(`.ips`)?te(t,a9(S(e,`utf-8`))):m(e,t),!0}catch{return!1}}function Q9(e){let t=[],n=e=>{let r=C(e,{withFileTypes:!0});for(let i of r){let r=N(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const bEe=new Set([`.jsonl`]);function xEe(e){let t=e.lastIndexOf(`.`);return t===-1?!1:bEe.has(e.slice(t))}const SEe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function CEe(e){if(F9(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:SEe.has(e.slice(t))}function wEe(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!CEe(r))continue;let{redacted:i,patterns:a,lineCount:o}=Rw(S(n,`utf-8`));a.length!==0&&(te(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return _e(e,t).split(ye).join(`/`)}async function TEe(e){let t=ve(e.contentDir),n=ve(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??oEe,a=r.fetchAgentEffects??sEe,o=r.fetchWatcherRecent??cEe,s=r.readShadowHead??uEe,c=r.readCheckpointRefs??dEe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.68.4-beta.0`),d=r.readDesktopEnv??K9,f=r.readLanguage??O9,p=r.readRuntime??fEe,h=r.isOtlpPushEnabled??pEe,_=y(N(le(),`ok-bundle-`));try{v(N(_,`telemetry`),{recursive:!0}),v(N(_,`logs`),{recursive:!0}),v(N(_,`state`),{recursive:!0}),Z9(eEe(n),N(_,`telemetry`,z9)),Z9(tEe(n),N(_,`telemetry`,B9)),Z9(nEe(n),N(_,`logs`,V9)),Z9(rEe(n),N(_,`logs`,H9));for(let t of e.userLogFiles??[])Z9(t,N(_,`logs`,fe(t)));for(let t of e.userStateFiles??[])Z9(t,N(_,us,fe(t)));let y=0;for(let t of e.diagnosticReports?.files??[])Z9(t,N(_,`diagnostic-reports`,fe(t)))&&(y+=1);let b=N(n,`.ok`,`local`),x=N(b,`server.lock`),C=`not-running`,w=`no server.lock`,T=null;if(g(x)){Z9(x,N(_,`state`,`server.lock`));try{let e=S(x,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?T=t.port:w=`lock present but no port`}catch{w=`lock present but unparseable`}}if(T!==null){let e=await i(T);e===null?w=`agent-presence endpoint at :${T} unreachable`:(te(N(_,`state`,`agent-presence.json`),e),C=`running`,w=``);let t=await a(T);t!==null&&te(N(_,`state`,`agent-effects.json`),t);let n=await o(T);if(n!==null){let e=lEe(n);e!==null&&te(N(_,`state`,`watcher-recent.jsonl`),e)}}let E=s(t);E!==null&&te(N(_,`state`,`shadow-head.txt`),E);let ee=c(t);ee!==null&&te(N(_,`state`,`checkpoint-refs.txt`),ee),Z9(iEe(n),N(_,`state`,U9)),Z9(aEe(n),N(_,`state`,W9)),Z9(N(b,`last-spawn-error.log`),N(_,`state`,`last-spawn-error.log`)),Z9(N(b,Au),N(_,`state`,Au)),Z9(N(b,ju),N(_,`state`,ju));let ne=p(),re=d(),ie=f(),ae={ok:{version:u(),nodeVersion:ne.nodeVersion,platform:ne.platform,arch:ne.arch},host:{desktop:re,language:ie}};te(N(_,`state`,`runtime.json`),`${JSON.stringify(ae,null,2)}\n`);let oe=C===`running`?`running
1532
+ `)}\n`:null}catch{return null}}function uEe(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`log`,`--oneline`,`-50`],l3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function dEe(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],l3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function K9(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function fEe(){return{nodeVersion:process.version,platform:k(),arch:re()}}function pEe(){return process.env.OTEL_SDK_DISABLED===`false`}function q9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function J9(e){if(!g(e))return{};let t;try{t=(0,on.parse)(S(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!q9(t))return{};let n=t.telemetry;if(!q9(n))return{};let r=n.localSink;return q9(r)?r:{}}function Y9(e){return typeof e==`boolean`?e:void 0}function mEe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function X9(e){if(q9(e))return mEe(e.maxBytes)}function hEe(e){let t=J9(JQ(`project`,e)),n=J9(JQ(`project-local`,e));return{enabled:Y9(n.enabled)??Y9(t.enabled)??!0,spansMaxBytes:X9(n.spans)??X9(t.spans)??52428800,logsMaxBytes:X9(n.logs)??X9(t.logs)??26214400}}function gEe(e){return Ae(`sha256`).update(e).digest(`hex`)}function _Ee(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const vEe=[`"doc.name"`,`"docName"`];function yEe(e){let t=S(e,`utf-8`),n=0;for(let e of vEe){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z9(e,t){if(!g(e))return!1;try{return v(pe(t),{recursive:!0}),e.endsWith(`.ips`)?te(t,a9(S(e,`utf-8`))):m(e,t),!0}catch{return!1}}function Q9(e){let t=[],n=e=>{let r=C(e,{withFileTypes:!0});for(let i of r){let r=N(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const bEe=new Set([`.jsonl`]);function xEe(e){let t=e.lastIndexOf(`.`);return t===-1?!1:bEe.has(e.slice(t))}const SEe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function CEe(e){if(F9(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:SEe.has(e.slice(t))}function wEe(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!CEe(r))continue;let{redacted:i,patterns:a,lineCount:o}=Rw(S(n,`utf-8`));a.length!==0&&(te(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return _e(e,t).split(ye).join(`/`)}async function TEe(e){let t=ve(e.contentDir),n=ve(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??oEe,a=r.fetchAgentEffects??sEe,o=r.fetchWatcherRecent??cEe,s=r.readShadowHead??uEe,c=r.readCheckpointRefs??dEe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.68.4-beta.1`),d=r.readDesktopEnv??K9,f=r.readLanguage??O9,p=r.readRuntime??fEe,h=r.isOtlpPushEnabled??pEe,_=y(N(le(),`ok-bundle-`));try{v(N(_,`telemetry`),{recursive:!0}),v(N(_,`logs`),{recursive:!0}),v(N(_,`state`),{recursive:!0}),Z9(eEe(n),N(_,`telemetry`,z9)),Z9(tEe(n),N(_,`telemetry`,B9)),Z9(nEe(n),N(_,`logs`,V9)),Z9(rEe(n),N(_,`logs`,H9));for(let t of e.userLogFiles??[])Z9(t,N(_,`logs`,fe(t)));for(let t of e.userStateFiles??[])Z9(t,N(_,us,fe(t)));let y=0;for(let t of e.diagnosticReports?.files??[])Z9(t,N(_,`diagnostic-reports`,fe(t)))&&(y+=1);let b=N(n,`.ok`,`local`),x=N(b,`server.lock`),C=`not-running`,w=`no server.lock`,T=null;if(g(x)){Z9(x,N(_,`state`,`server.lock`));try{let e=S(x,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?T=t.port:w=`lock present but no port`}catch{w=`lock present but unparseable`}}if(T!==null){let e=await i(T);e===null?w=`agent-presence endpoint at :${T} unreachable`:(te(N(_,`state`,`agent-presence.json`),e),C=`running`,w=``);let t=await a(T);t!==null&&te(N(_,`state`,`agent-effects.json`),t);let n=await o(T);if(n!==null){let e=lEe(n);e!==null&&te(N(_,`state`,`watcher-recent.jsonl`),e)}}let E=s(t);E!==null&&te(N(_,`state`,`shadow-head.txt`),E);let ee=c(t);ee!==null&&te(N(_,`state`,`checkpoint-refs.txt`),ee),Z9(iEe(n),N(_,`state`,U9)),Z9(aEe(n),N(_,`state`,W9)),Z9(N(b,`last-spawn-error.log`),N(_,`state`,`last-spawn-error.log`)),Z9(N(b,Au),N(_,`state`,Au)),Z9(N(b,ju),N(_,`state`,ju));let ne=p(),re=d(),ie=f(),ae={ok:{version:u(),nodeVersion:ne.nodeVersion,platform:ne.platform,arch:ne.arch},host:{desktop:re,language:ie}};te(N(_,`state`,`runtime.json`),`${JSON.stringify(ae,null,2)}\n`);let oe=C===`running`?`running
1533
1533
  `:`not-running (${w})\n`;te(N(_,`state`,`server-status.txt`),oe);let se=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:i9(e.diagnosticReports,y);if(te(N(_,`state`,`diagnostic-reports-status.txt`),`${se}\n`),e.processDir&&g(e.processDir)){let t=N(_,`process`);v(t,{recursive:!0}),m(e.processDir,t,{recursive:!0})}let k=e.redact===!0;k&&$Te({stagingDir:_,contentDir:t}),e.note&&te(N(_,`note.txt`),e.note);let ce=null;e.scrubSecrets===!0&&(ce=wEe(_));for(let t of e.extraFiles??[])Z9(t.sourcePath,N(_,`extra`,t.zipName??fe(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let le=hEe(n),ue=Q9(_),A=[],j=0,de=0;for(let e of ue){let t=$9(_,e),n=O(e).size,r=xEe(t)?_Ee(e):0;A.push({path:t,bytes:n,lines:r}),j+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(de+=yEe(e))}let pe={applied:k};ce!==null&&(pe.secretScrub=ce);let me={schemaVersion:2,createdAt:l().toISOString(),ok:{version:u(),nodeVersion:ne.nodeVersion,platform:ne.platform,arch:ne.arch},host:{desktop:re,language:ie},contentDir:{pathSha256:gEe(t),absolutePath:k?`<CONTENT_DIR>`:t},telemetry:{localSink:le,otlpPushEnabled:h()},redaction:pe,serverStatus:C,files:A};te(N(_,`manifest.json`),`${JSON.stringify(me,null,2)}\n`);let M=ue.some(e=>{try{return S(e,`utf-8`).includes(t)}catch{return!1}}),he={stagedDiagnosticReports:y,totalBytes:j,fileCount:A.length,docNameCount:de,contentDirVisible:M,redacted:k},ge=!1;return{stagingDir:_,manifest:me,summary:he,cleanup:()=>{ge||(ge=!0,D(_,{recursive:!0,force:!0}))}}}catch(e){throw D(_,{recursive:!0,force:!0}),e}}async function EEe(e){let{collected:t,outputPath:n}=e,r=pe(n);if(!g(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new Bye.ZipFile,a=Q9(t.stagingDir);for(let e of a){let n=$9(t.stagingDir,e);i.addFile(e,n)}i.end();let o=h(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function DEe(e,t){let n=N(e,`.ok`,`config.yml`);if(g(n))try{let t=(0,on.parse)(S(n,`utf-8`)),r=O7(t)?t.content:void 0,i=O7(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return ve(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return ve(e)}async function OEe(e,t,n,r,i){let a=s9(t,e.logger),o=await TEe({contentDir:DEe(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...mTe(a,e.userLogsDir??N(oe(),`.ok`,`logs`)),...l9(e.cachesDir??N(oe(),`Library`,`Caches`))],userStateFiles:u9(e.bugReportsDir??o9()),diagnosticReports:i,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{v(pe(e.outputPath),{recursive:!0}),await EEe({collected:o,outputPath:e.outputPath});let t=o.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:a,files:o.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:o.manifest.createdAt}}}finally{o.cleanup()}}async function kEe(e){let{projectDir:t}=e,n=e.readDesktopEnv??K9,r=e.readLanguage??O9,i=()=>uTe(e.diagnosticReportsDir??N(oe(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return OEe(e,t,n,r,i());let{zipPath:a,summary:o}=await yTe({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:l9(e.cachesDir??N(oe(),`Library`,`Caches`)),bugReportLedgerFiles:u9(e.bugReportsDir??o9()),diagnosticReports:e.level===`full`?i():void 0,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:a,summary:{level:e.level,systemWide:t===void 0,projectSlug:o.projectSlug,files:o.files,redactions:o.redactions,redactedLineCount:o.redactedLineCount,generatedAt:o.generatedAt}}}export{M5 as ALL_EDITOR_IDS,N5 as EDITOR_LABELS,e7 as EDITOR_TARGETS,mCe as HOSTS_WITH_USER_SKILL_DIR,Ywe as LAUNCH_CONFIG_NAME,zTe as PATH_SHIM_BEGIN,VTe as PATH_SHIM_BLOCK_RE,BTe as PATH_SHIM_END,Awe as addOkPathsToGitExclude,b7 as assertProjectPathSafe,H5 as buildManagedServerEntry,kTe as buildMcpConfigDeclineEvent,ATe as buildMcpConfigMigrateEvent,r9 as classifyExistingMcpEntry,kEe as collectReportBundle,un as createTokenStore,dTe as defaultBugReportZipPath,Be as detectGh,Ue as detectGhAccounts,eTe as detectInstalledEditors,OCe as editorConfigPathDisplay,DCe as editorEntryLocator,xTe as ensurePiBridge,L7 as formatTrackedRemediation,Nwe as getExcludedOkPaths,F7 as getInstalledSkillProjectionPaths,kwe as getNativeTomlMcpEditor,P7 as getOkArtifactPaths,B5 as isEntryUpToDate,U5 as isOwnManagedEntry,ITe as loadConfig,fee as makeLazyProbeTokenStore,o9 as okBugReportsDir,w9 as parseGitHubBlobUrl,LTe as parseGitHubShareUrl,T9 as parseGitHubTreeUrl,C9 as parseGitUrl,HTe as pathInstallMarkerPath,cwe as previewContent,nTe as probeOwnManagedEditorMcpEntry,bTe as probePiBridgeState,I7 as probeTrackedOkPaths,t9 as readExistingMcpEntry,Mwe as readSharingMode,Rw as redactContent,jwe as removeOkPathsFromGitExclude,TTe as removeOwnMcpEntry,vwe as removeProjectSkill,WTe as removeUserGlobalSkillBundle,mwe as resolveProjectRoot,NTe as runStop,y9 as truncatePriorEntry,D9 as userGlobalSkillBundleTargets,RTe as validateLocalFolderForShare,e9 as writeEditorMcpConfig,qTe as writeProjectAiIntegrations,C7 as writeProjectSkill,$we as writeUserMcpConfigs};
1534
1534
  //# sourceMappingURL=index.mjs.map