@inkeep/open-knowledge 0.80.0-beta.6 → 0.80.0-beta.8

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 (148) hide show
  1. package/dist/cli.mjs +6 -6
  2. package/dist/config-schema.json +2 -1
  3. package/dist/config.user.schema.json +2 -1
  4. package/dist/constants-udCWsXgt.mjs +1 -0
  5. package/dist/{dist-GcFBLEr5.mjs → dist-BGZB40vV.mjs} +1 -1
  6. package/dist/{dist-BBi7mVvL.mjs → dist-UU05FlF5.mjs} +1 -1
  7. package/dist/index.d.mts +2 -1
  8. package/dist/index.mjs +2 -2
  9. package/dist/init-CPmsvtQB.mjs +1 -0
  10. package/dist/{init-BR_RY0pY.mjs → init-DixdtQo4.mjs} +2 -2
  11. package/dist/{launch-json-removal-CSulcUxI.mjs → launch-json-removal-DQSVIMKg.mjs} +1 -1
  12. package/dist/loader-BJdt_Inn.mjs +1 -0
  13. package/dist/{loader-CpDpte48.mjs → loader-OpRlMshE.mjs} +1 -1
  14. package/dist/{md-manager-BGnqyqi1-DCa5-0ww.mjs → md-manager-BGnqyqi1-CGCojPWP.mjs} +1 -1
  15. package/dist/{open-browser-CDL2mqCk.mjs → open-browser-xNlcpMgb.mjs} +1 -1
  16. package/dist/parse-worker.mjs +1 -1
  17. package/dist/preview-CPYHmnfi.mjs +1 -0
  18. package/dist/{preview-BCSrELqH.mjs → preview-DDX1gJqb.mjs} +1 -1
  19. package/dist/public/assets/{ActivityModeContent-DItZVTCk.js → ActivityModeContent-BRpsMl1W.js} +1 -1
  20. package/dist/public/assets/{AddPropertiesButton-CvdBSXbP.js → AddPropertiesButton-BUNE85Al.js} +2 -2
  21. package/dist/public/assets/{AgentDiffPane-Cm2GzZBM.js → AgentDiffPane-DhX2Q-kq.js} +1 -1
  22. package/dist/public/assets/{AgentThreadClientBinder-CFgtBbQR.js → AgentThreadClientBinder-oQqS9LMn.js} +1 -1
  23. package/dist/public/assets/{BugReportHistory-DDQ7rrrr.js → BugReportHistory-BeT4qc8x.js} +1 -1
  24. package/dist/public/assets/{BugReportHistoryDialog-Bt-xM9-I.js → BugReportHistoryDialog-qOgaU67n.js} +1 -1
  25. package/dist/public/assets/{CodeMirrorPropInput-Bf645WUa.js → CodeMirrorPropInput-BJDU0-70.js} +1 -1
  26. package/dist/public/assets/{ConsentDialogBody-RBMJ0gc0.js → ConsentDialogBody-CYQDvrod.js} +1 -1
  27. package/dist/public/assets/{DeleteConfirmationDialog-n90yA0mh.js → DeleteConfirmationDialog-_4ZcQ_WU.js} +1 -1
  28. package/dist/public/assets/{DiffViewBoundary-DsG9GOLX.js → DiffViewBoundary-WTsOr1JB.js} +1 -1
  29. package/dist/public/assets/{DocumentContext-B3xlplVb.js → DocumentContext-CjYhWoGU.js} +2 -2
  30. package/dist/public/assets/{EditorModeToggle-Blopqyef.js → EditorModeToggle-BJc88vvp.js} +1 -1
  31. package/dist/public/assets/{EnableSyncConfirmDialog-B056XoQ0.js → EnableSyncConfirmDialog-bbbliDE7.js} +1 -1
  32. package/dist/public/assets/ExcalidrawDocEditor-_5TmYiLc.js +1 -0
  33. package/dist/public/assets/FeedbackForm-Y66w6mKZ.js +1 -0
  34. package/dist/public/assets/{GraphPanel-CewYgyfZ.js → GraphPanel-DPvwBmDW.js} +1 -1
  35. package/dist/public/assets/{ImageAttachments-DmjOMNqA.js → ImageAttachments-ChTOkMU5.js} +1 -1
  36. package/dist/public/assets/{ImportSkillDialog-CgCFe5Pv.js → ImportSkillDialog-D2cOhqCs.js} +1 -1
  37. package/dist/public/assets/{LintConfigEditor-BgrTlSeu.js → LintConfigEditor-Bmt7m3WR.js} +1 -1
  38. package/dist/public/assets/{ManagedArtifactProperties-BTFq6Ngk.js → ManagedArtifactProperties-DQZHPU2z.js} +1 -1
  39. package/dist/public/assets/ManagedArtifactProperties-DXuD-PMR.js +1 -0
  40. package/dist/public/assets/{MermaidDocEditor-C5hGyxfZ.js → MermaidDocEditor-BeFnyZX6.js} +1 -1
  41. package/dist/public/assets/{OpenInAgentMenuItem-QrteG6Br.js → OpenInAgentMenuItem-D8NEKdSX.js} +1 -1
  42. package/dist/public/assets/{PropertyDisplayRow-D2nLNITg.js → PropertyDisplayRow-DcTwX5-h.js} +1 -1
  43. package/dist/public/assets/{RegisteredAgentIcon--fiCkSba.js → RegisteredAgentIcon-CcvblzpC.js} +1 -1
  44. package/dist/public/assets/{ReportBugDialogBody-BHJJSRc_.js → ReportBugDialogBody-byNRbXwl.js} +1 -1
  45. package/dist/public/assets/{ReportBugMenuTrigger-DDbgWwFU.js → ReportBugMenuTrigger-Cnn2Kpoj.js} +1 -1
  46. package/dist/public/assets/{SchemaConfigEditor-CkjLP98S.js → SchemaConfigEditor-Ar_uta_g.js} +1 -1
  47. package/dist/public/assets/{SessionsHost-4CsyZngA.js → SessionsHost-B8q1kalR.js} +2 -2
  48. package/dist/public/assets/{SettingsDialogBody-bpn_QRzv.js → SettingsDialogBody-DtqaucZk.js} +1 -1
  49. package/dist/public/assets/{ShareBranchSwitchDialog-C4Eqwx_r.js → ShareBranchSwitchDialog-BBaO_tr4.js} +1 -1
  50. package/dist/public/assets/{ShareReceiveDialog-CNa1HD1Q.js → ShareReceiveDialog-DkvKil4t.js} +1 -1
  51. package/dist/public/assets/{ShareReceiveMissDialog-B-_2h-KD.js → ShareReceiveMissDialog-6Vk1ov6n.js} +1 -1
  52. package/dist/public/assets/{SkillCostValue-CYw_tCqR.js → SkillCostValue-BKwKtiXH.js} +1 -1
  53. package/dist/public/assets/{SkillEditBanner-BuW2sJvG.js → SkillEditBanner-C5uTpSKD.js} +1 -1
  54. package/dist/public/assets/{SkillForkDialog-DAn5-JZV.js → SkillForkDialog-DnmjSB0n.js} +1 -1
  55. package/dist/public/assets/{SkillInstallMenu-Cesp0OI6.js → SkillInstallMenu-sgeehwe1.js} +1 -1
  56. package/dist/public/assets/{SkillOriginInline-_uPhVG7Y.js → SkillOriginInline-BnMdaW-1.js} +1 -1
  57. package/dist/public/assets/{SkillToolbarControls-C3cT4d_4.js → SkillToolbarControls-DSkcPyE7.js} +1 -1
  58. package/dist/public/assets/{SlidesToolbarControls-zHguPndQ.js → SlidesToolbarControls-D6fM1z2O.js} +1 -1
  59. package/dist/public/assets/{SourceEditor-Dkmhiwbb.js → SourceEditor-s6oqUBCs.js} +1 -1
  60. package/dist/public/assets/{TerminalPanel-BzL8_A5I.js → TerminalPanel-BVWOE3kU.js} +1 -1
  61. package/dist/public/assets/{TerminalWindowApp-vD_LAXsa.js → TerminalWindowApp-BNJ24WKK.js} +1 -1
  62. package/dist/public/assets/{TextDocEditor-DqBZzHgY.js → TextDocEditor-DfldlAp7.js} +1 -1
  63. package/dist/public/assets/{ThreadView-DMbL0dhG.js → ThreadView-BJq8AtlR.js} +1 -1
  64. package/dist/public/assets/{TimelineDiffPane-vm_67Xp-.js → TimelineDiffPane-CvTyxlJ-.js} +1 -1
  65. package/dist/public/assets/{agent-connections-BZwWjV-L.js → agent-connections-0X_wM1D5.js} +1 -1
  66. package/dist/public/assets/{auth-state-cache-DYtj5a86.js → auth-state-cache-BU4ajCHf.js} +1 -1
  67. package/dist/public/assets/{bug-report-send-manager-DOLrtOEv.js → bug-report-send-manager-D0ep_Jtf.js} +1 -1
  68. package/dist/public/assets/{client-version-CDitBjAS.js → client-version-47R1Hqu0.js} +1 -1
  69. package/dist/public/assets/{comment-chips-ClsM-kmI.js → comment-chips-Dl4tR59k.js} +1 -1
  70. package/dist/public/assets/{config-provider-Ca2HUShB.js → config-provider-D06S8HhQ.js} +1 -1
  71. package/dist/public/assets/{css-color-to-hex-AUn7eIel.js → css-color-to-hex-X_ubtbg_.js} +1 -1
  72. package/dist/public/assets/{diagnostic-breadcrumb-g0QEaFL4.js → diagnostic-breadcrumb-rWRd-iGs.js} +1 -1
  73. package/dist/public/assets/{dist-DILeGueK.js → dist-DTxb76k4.js} +2 -2
  74. package/dist/public/assets/{doc-paths-BWrKtSx2.js → doc-paths-VPO39t4f.js} +1 -1
  75. package/dist/public/assets/{doc-undo-manager-DSaQkZ_X.js → doc-undo-manager-D3cMP3Rz.js} +1 -1
  76. package/dist/public/assets/{documents-events-Do7TM3Hd.js → documents-events-DLvhFUkq.js} +1 -1
  77. package/dist/public/assets/{file-tree-adapter-C1_qOMsA.js → file-tree-adapter-Sub5h3Aa.js} +1 -1
  78. package/dist/public/assets/{file-tree-utils-BcIIWtsU.js → file-tree-utils-CIQBSzS9.js} +1 -1
  79. package/dist/public/assets/{folder-config-api-CDR1eAcz.js → folder-config-api-Cz9BQmTR.js} +1 -1
  80. package/dist/public/assets/{index-KTOtrBN1.js → index-BRQoyokT.js} +8 -8
  81. package/dist/public/assets/{lint-config-client--83L6Vzq.js → lint-config-client-ShgapJqD.js} +1 -1
  82. package/dist/public/assets/{markdownlint-rule-browser-Dwh97LWk.js → markdownlint-rule-browser-BiJOQswX.js} +1 -1
  83. package/dist/public/assets/messages-CjdjdvIS.js +1 -0
  84. package/dist/public/assets/{navigation-targets-CJ9ZxyzV.js → navigation-targets-Cj3FjSHM.js} +1 -1
  85. package/dist/public/assets/{page-list-cache-C6t_W1Qs.js → page-list-cache-Db-cMXXb.js} +1 -1
  86. package/dist/public/assets/{pending-receive-nav-store-CRjoDiuf.js → pending-receive-nav-store-Cvafwk5s.js} +1 -1
  87. package/dist/public/assets/{preferred-session-events-CwZtdTs7.js → preferred-session-events-D2UgCugO.js} +1 -1
  88. package/dist/public/assets/{progress-_zYa5fpq.js → progress-DIu1GSm2.js} +1 -1
  89. package/dist/public/assets/{project-paths-ygpKMwOT.js → project-paths-C8ucGf4F.js} +1 -1
  90. package/dist/public/assets/{prop-types-CT1xGqpW.js → prop-types-BaGWFLYl.js} +1 -1
  91. package/dist/public/assets/{receive-store-DutQ_RL1.js → receive-store-DE9tB4jY.js} +1 -1
  92. package/dist/public/assets/{selection-context-C1ld48kx.js → selection-context-BmxK2cQ1.js} +1 -1
  93. package/dist/public/assets/{sign-in-terminal-events-BqTVNN-V.js → sign-in-terminal-events-BUwsboGX.js} +1 -1
  94. package/dist/public/assets/{skill-scope-CUAEKGV-.js → skill-scope-bxDiQshW.js} +1 -1
  95. package/dist/public/assets/{skills-api-CM8h9xtl.js → skills-api-BaxUiF2f.js} +1 -1
  96. package/dist/public/assets/{src-U7mQYf3e.js → src-DpN4tqC_.js} +1 -1
  97. package/dist/public/assets/{startup-marks-vgWlVGPK.js → startup-marks-BxUZHKOy.js} +1 -1
  98. package/dist/public/assets/{tag-pill-input-BRyN2FKA.js → tag-pill-input-dKjZE88k.js} +1 -1
  99. package/dist/public/assets/{target-navigation-intent-7jeW8XWM.js → target-navigation-intent-CN-DIwXP.js} +1 -1
  100. package/dist/public/assets/{telemetry-impl-C6f28Ge5.js → telemetry-impl-CRQnPrM5.js} +2 -2
  101. package/dist/public/assets/{telemetry-startup-DiFICPCo.js → telemetry-startup-lxSU0usW.js} +1 -1
  102. package/dist/public/assets/{terminal-command-events-CVCqfbNT.js → terminal-command-events-Orubep-S.js} +1 -1
  103. package/dist/public/assets/{terminal-launch-events-DuaMfoq_.js → terminal-launch-events-CRAau5xV.js} +1 -1
  104. package/dist/public/assets/{terminal-telemetry-BHuv7G5q.js → terminal-telemetry-C6TBDBsx.js} +1 -1
  105. package/dist/public/assets/{thread-client-BZoVbxhe.js → thread-client-C8EMFbCt.js} +1 -1
  106. package/dist/public/assets/{typing-burst-detector-d8VRIyWa.js → typing-burst-detector-DYWkkyFn.js} +1 -1
  107. package/dist/public/assets/{uninstall-D2krzbU2.js → uninstall-rTTw6eol.js} +1 -1
  108. package/dist/public/assets/{use-activity-panel-HUILZrq4.js → use-activity-panel-CFjSB3Ko.js} +1 -1
  109. package/dist/public/assets/use-apply-config-language-BA8pb8bB.js +2 -0
  110. package/dist/public/assets/{use-collab-url-JUcW-mVG.js → use-collab-url-i6hEm2eD.js} +1 -1
  111. package/dist/public/assets/{use-conflicts-yBw-ZjZM.js → use-conflicts-Csl-W9sG.js} +1 -1
  112. package/dist/public/assets/{use-git-sync-status-CoUdayE7.js → use-git-sync-status-DrkQ-euc.js} +1 -1
  113. package/dist/public/assets/{use-installed-clis-j9XDtwV2.js → use-installed-clis-CywDYh_S.js} +2 -2
  114. package/dist/public/assets/{use-live-xterm-theme-DBWjwre6.js → use-live-xterm-theme-D87B7hkL.js} +1 -1
  115. package/dist/public/assets/{use-open-skill-Ci_4ajE0.js → use-open-skill-DcSc5W3j.js} +1 -1
  116. package/dist/public/assets/{use-settings-route-DHuAch1j.js → use-settings-route-CAshJWbw.js} +1 -1
  117. package/dist/public/assets/{use-skill-origin-DhcploXf.js → use-skill-origin-kW6ZZcES.js} +1 -1
  118. package/dist/public/assets/{use-skills-DJX6inxB.js → use-skills-DT7KgjWD.js} +1 -1
  119. package/dist/public/assets/{use-terminal-enabled-Y78SBxmZ.js → use-terminal-enabled-C1s8vXrb.js} +1 -1
  120. package/dist/public/assets/{use-timeline-entry-diff-Cf1oA_J7.js → use-timeline-entry-diff-DHQkGLuD.js} +1 -1
  121. package/dist/public/assets/{use-workspace-2aIeQVoi.js → use-workspace-ByLGR16G.js} +1 -1
  122. package/dist/public/index.html +59 -59
  123. package/dist/public/uninstall.html +3 -3
  124. package/dist/{registry-probes-CpUHw0Pt.mjs → registry-probes-CSVwdlnt.mjs} +1 -1
  125. package/dist/{removal-file-path-D4u7hIns.mjs → removal-file-path-wM2_Gnbs.mjs} +1 -1
  126. package/dist/{repair-launch-json-D12M3uwf.mjs → repair-launch-json-Bucu4SKC.mjs} +1 -1
  127. package/dist/{repair-mcp-configs-CFOzC6j6.mjs → repair-mcp-configs-B5eKvhO7.mjs} +1 -1
  128. package/dist/schemas/v0/config.user.schema.json +2 -1
  129. package/dist/src-DfFI0URL.mjs +1 -0
  130. package/dist/{src-CO1INi5A.mjs → src-DocALnhn.mjs} +1 -1
  131. package/dist/{start-CfQ2ZJ9V.mjs → start-CCqXKb5e.mjs} +3 -3
  132. package/dist/start-CgB7z6Zm.mjs +1 -0
  133. package/package.json +5 -5
  134. package/dist/constants-BM21y1CS.mjs +0 -1
  135. package/dist/init-z4dkIpZb.mjs +0 -1
  136. package/dist/loader-CDBcy7_5.mjs +0 -1
  137. package/dist/preview-rGoADBsd.mjs +0 -1
  138. package/dist/public/assets/ExcalidrawDocEditor-C4F3udw2.js +0 -1
  139. package/dist/public/assets/FeedbackForm-GRSOr0fy.js +0 -1
  140. package/dist/public/assets/ManagedArtifactProperties-mFeT6hbW.js +0 -1
  141. package/dist/public/assets/use-apply-config-language-BwIOrXvC.js +0 -2
  142. package/dist/src-DmfAVE82.mjs +0 -1
  143. package/dist/start-DjI3fnEc.mjs +0 -1
  144. /package/dist/public/assets/{__vite-browser-external-CfQ5hhbQ.js → __vite-browser-external-pxlgOdf3.js} +0 -0
  145. /package/dist/public/assets/{messages-C7vX5WHO.js → messages-0wCfOVUP.js} +0 -0
  146. /package/dist/public/assets/{messages-CdMg2dJ8.js → messages-Bia_CkTU.js} +0 -0
  147. /package/dist/public/assets/{messages-CiplIvRK.js → messages-BkyQO0O-.js} +0 -0
  148. /package/dist/public/assets/{messages-gQFOTX2J.js → messages-DbWtr8o5.js} +0 -0
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{Ct as r,Fs as i,Os as a,Ps as o,Uo as s,Vs as c,_ as l,fs as u,ls as d,v as f,ys as p}from"./dist-DILeGueK.js";import{t as m}from"./use-apply-config-theme-B5w38X1P.js";var h=e(t(),1);function g(e,t=d){return t.find(t=>t.id===e)??c(e)}function _(e,t=d){let n=g(e,t).kind;return n===`system`?void 0:n}function ee(e){return{colorThemeLight:e.light,colorThemeDark:e.dark,colorTheme:null}}function v(){return{colorThemeLight:null,colorThemeDark:null,colorTheme:null}}var te=new Map(r.map(e=>[e.name,e]));function y(e,t){let n=te.get(e);if(!n)throw Error(`color-themes: ${e} is not a generated base-theme token`);return n[t]}function b(e){return{sidebar:e===`dark`?l:f,background:y(`--background`,e),primary:y(`--primary`,e),border:y(`--border`,e),"syntax-string":y(`--chart-2`,e),"syntax-keyword":y(`--chart-4`,e),"syntax-atom":y(`--chart-3`,e)}}var x={name:`Custom`,variant:`dark`,palette:{base00:`#0f172a`,base01:`#1e293b`,base02:`#334155`,base03:`#64748b`,base04:`#94a3b8`,base05:`#e2e8f0`,base06:`#f1f5f9`,base07:`#f8fafc`,base08:`#e5534b`,base09:`#db8d3f`,base0A:`#d29922`,base0B:`#3fb950`,base0C:`#22d3ee`,base0D:`#6366f1`,base0E:`#a78bfa`,base0F:`#c2703f`}},S=[`background`,`surface`,`foreground`,`primary`,`accent`,`border`];function ne(e){let{background:t,foreground:n}=e;return{name:`Custom`,variant:o(t)<o(n)?`dark`:`light`,palette:{base00:t,base01:e.surface,base02:e.border,base03:a(t,n,.4),base04:a(t,n,.55),base05:n,base06:a(n,`#ffffff`,.3),base07:a(n,`#ffffff`,.6),base08:`#e5534b`,base09:`#db8d3f`,base0A:`#d29922`,base0B:`#3fb950`,base0C:e.accent,base0D:e.primary,base0E:e.accent,base0F:a(`#e5534b`,t,.35)}}}function re(e){return p(e)}function ie(){let e=x.palette;return{background:e.base00,surface:e.base01,foreground:e.base05,primary:e.base0D,accent:e.base0C,border:e.base02}}function ae(e){let t=ie(),n=!1;for(let r of S){let i=e[r];p(i)&&(t[r]=i,n=!0)}return n?t:null}function oe(e){return e?S.some(t=>p(e[t])):!1}function C(e){if(!e)return x;let t=ae(e),n={...(t?ne(t):x).palette};for(let t of s){let r=e[t];p(r)&&(n[t]=r)}let r=e.variant===`light`||e.variant===`dark`?e.variant:o(n.base00)<o(n.base05)?`dark`:`light`;return{name:typeof e.name==`string`&&e.name.trim()?e.name.trim():`Custom`,author:typeof e.author==`string`?e.author:void 0,variant:r,palette:n}}function se(e){let t={name:e.name,author:e.author??null,variant:e.variant};for(let n of s)t[n]=e.palette[n];for(let e of S)t[e]=null;return t}function w(e){return e.variant}function T(e){return i(`html[data-color-theme="custom"]`,e.variant,u(e))}var ce=Object.keys(u(x)).map(e=>`--${e}`),E=[...new Set([...r.filter(e=>e.name!==`--radius`).map(e=>e.name),...ce,`--ok-comment-hue`])],le=new Set(E);function D(e){return le.has(e)}var O=n(),k=`data-theme-color-transitions`,ue=`ok-theme-color-transitions`,A=`data-theme-color-fading`,j=200,de=E.map(e=>`${e} ${j}ms ease-out`).join(`,`),M=new WeakSet;function fe(e){return e.defaultView?.CSS}function pe(e){let t=fe(e);if(typeof t?.registerProperty!=`function`)return!1;let n=e.defaultView?.DOMException;for(let e of E)try{t.registerProperty({name:e,syntax:`<color>`,inherits:!0,initialValue:`transparent`})}catch(e){if(typeof n==`function`&&e instanceof n&&e.name===`InvalidModificationError`)continue;throw e}return!0}function me(e){if(e.getElementById(`ok-theme-color-transitions`))return;let t=e.createElement(`style`);t.id=ue,t.textContent=`@media (prefers-reduced-motion: no-preference){:root[${k}]{transition:${de}}}`,e.head.appendChild(t)}function N(e){return e===`color`||e===`fill`||e===`stroke`||e.endsWith(`-color`)||e===`--tw-gradient-from`||e===`--tw-gradient-via`||e===`--tw-gradient-to`}function he(e){let t=e.defaultView;if(!t||typeof t.requestAnimationFrame!=`function`)return;let n=e.documentElement,r=0,i=0,a=0,o=0,s=n.getAttribute(`class`),c=n.getAttribute(`data-color-theme`),l=new Set,u=e=>{for(let t of e.getAnimations({subtree:!1}))N(t.transitionProperty??``)&&t.cancel()},d=()=>{if(typeof e.getAnimations==`function`)for(let r of e.getAnimations()){let e=r.effect,i=e&&`target`in e?e.target:null;i===n||!(i instanceof t.Element)||N(r.transitionProperty??``)&&r.cancel()}},f=()=>{a||=t.requestAnimationFrame(()=>{a=0;for(let e of l)u(e);n.hasAttribute(`data-theme-color-fading`)&&f()})},p=t=>{if(r=0,t===o){if(e.hidden||!P(e)){n.removeAttribute(A),l.clear();return}m(t)}},m=e=>{r=t.requestAnimationFrame(()=>p(e))};new t.MutationObserver(()=>{let r=n.getAttribute(`class`),a=n.getAttribute(`data-color-theme`);if(r===s&&a===c)return;s=r,c=a,o+=1;let u=o;if(i&&=(t.clearTimeout(i),0),n.setAttribute(A,``),d(),!P(e)){n.removeAttribute(A),l.clear();return}i=t.setTimeout(()=>{i=0,p(u)},j),f()}).observe(n,{attributes:!0,attributeFilter:[`class`,`data-color-theme`]}),e.addEventListener(`visibilitychange`,()=>{e.hidden&&(o+=1,i&&t.clearTimeout(i),r&&t.cancelAnimationFrame(r),n.removeAttribute(A),l.clear())}),e.addEventListener(`transitionrun`,e=>{if(e.target===n||!n.hasAttribute(`data-theme-color-fading`)||!N(e.propertyName))return;let r=e.target;r instanceof t.Element&&(l.add(r),u(r),f())},!0)}function ge(e=window.document){return M.has(e)||e.documentElement.hasAttribute(`data-theme-color-transitions`)?(M.add(e),!0):pe(e)?(me(e),he(e),e.documentElement.setAttribute(k,``),M.add(e),!0):!1}function _e(e){let t=(0,O.c)(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>{if(!e)return;let t=ve;if(typeof requestAnimationFrame!=`function`){t();return}let n=requestAnimationFrame(t);return()=>cancelAnimationFrame(n)},r=[e],t[0]=e,t[1]=n,t[2]=r),(0,h.useEffect)(n,r)}function ve(){try{ge()}catch(e){let t=e;console.warn(JSON.stringify({event:`theme-color-transitions-arm-failed`,error:t instanceof Error?t.message:String(t)}))}}function P(e=window.document){let t=e.documentElement;return typeof t.getAnimations==`function`?t.getAnimations({subtree:!1}).some(e=>D(e.transitionProperty??``)):!1}var F=`ok-color-theme-pair-v1`,I=`ok-color-theme-v1`,ye=`ok-custom-theme-v1`,L=`data-color-theme`,R=`ok-custom-theme`,z=`ok-saved-theme`;function be(e){let t=document.getElementById(R);t||(t=document.createElement(`style`),t.id=R,document.head.appendChild(t)),t.textContent!==e&&(t.textContent=e)}function xe(){document.getElementById(R)?.remove()}function B(e){if(e.scheme)return i(`html[${L}]`,e.scheme.variant,u(e.scheme))}function Se(e){let t=document.getElementById(z);t||(t=document.createElement(`style`),t.id=z,document.head.appendChild(t)),t.textContent!==e&&(t.textContent=e)}function Ce(){document.getElementById(z)?.remove()}function V(e,t,n,r){return e===`custom`?w(C(n))===`dark`:(_(e,r)??t)===`dark`}function we(e,t,n){if(e===`custom`)return T(C(t));if(d.some(t=>t.id===e))return;let r=n.find(t=>t.id===e);return r?B(r):void 0}function H(e,t,n,r){let i=V(e,t,n,r),a=we(e,n,r);return a?{id:e,dark:i,css:a}:{id:e,dark:i}}function Te(e){let{selection:t,slotMode:n,customSeed:r,themes:i=d,enabled:a=!0}=e,o=g(a?t[n]:`default`,i).id;return{id:o,dark:V(o,n,r,i)}}function U(e){if(typeof document>`u`)return;let{selection:t,modePreference:n,customSeed:r,themes:i=d,enabled:a=!0}=e,o=Te(e),s=g(o.id,i),c=document.documentElement;o.id===`default`?c.removeAttribute(L):c.setAttribute(L,o.id);let l=!d.some(e=>e.id===o.id)&&s.id===o.id?B(s):void 0;l?Se(l):Ce(),o.id===`custom`?be(T(C(r))):xe();let u=t.light===`default`&&t.dark===`default`;try{!a||u?localStorage.removeItem(F):localStorage.setItem(F,JSON.stringify({pref:m(n),light:H(t.light,`light`,r,i),dark:H(t.dark,`dark`,r,i)})),localStorage.removeItem(I),localStorage.removeItem(ye)}catch{}}function Ee(e){let t=(0,O.c)(22),{selection:n,modePreference:r,slotMode:i,customSeed:a,themes:o,enabled:s,ready:c}=e,l=s===void 0?!0:s,u=c===void 0?!0:c,d;t[0]!==a||t[1]!==l||t[2]!==n.dark||t[3]!==n.light?(d=l&&(n.light===`custom`||n.dark===`custom`)?JSON.stringify(a??null):``,t[0]=a,t[1]=l,t[2]=n.dark,t[3]=n.light,t[4]=d):d=t[4];let f=d,p;t[5]!==a||t[6]!==l||t[7]!==r||t[8]!==u||t[9]!==n||t[10]!==i||t[11]!==o?(p=()=>{u&&U({selection:n,modePreference:r,slotMode:i,customSeed:a,themes:o,enabled:l})},t[5]=a,t[6]=l,t[7]=r,t[8]=u,t[9]=n,t[10]=i,t[11]=o,t[12]=p):p=t[12];let m;t[13]!==l||t[14]!==r||t[15]!==u||t[16]!==f||t[17]!==n.dark||t[18]!==n.light||t[19]!==i||t[20]!==o?(m=[n.light,n.dark,r,i,f,o,l,u],t[13]=l,t[14]=r,t[15]=u,t[16]=f,t[17]=n.dark,t[18]=n.light,t[19]=i,t[20]=o,t[21]=m):m=t[21],(0,h.useEffect)(p,m)}var W=0,G=new Set,K=null,q=0;function J(){W+=1;for(let e of G)e()}function Y(){if(q||typeof requestAnimationFrame!=`function`){typeof requestAnimationFrame!=`function`&&J();return}q=requestAnimationFrame(()=>{q=0,J(),P()&&Y()})}function X(e){e.target===document.documentElement&&D(e.propertyName)&&Y()}function Z(e){return G.add(e),!K&&typeof document<`u`&&(K=new MutationObserver(Y),K.observe(document.documentElement,{attributes:!0,attributeFilter:[L,`class`]}),K.observe(document.head,{childList:!0,subtree:!0,characterData:!0}),document.documentElement.addEventListener(`transitionrun`,X),document.documentElement.addEventListener(`transitionend`,X),document.documentElement.addEventListener(`transitioncancel`,X),P()&&Y()),()=>{G.delete(e),G.size===0&&(K?.disconnect(),K=null,document.documentElement.removeEventListener(`transitionrun`,X),document.documentElement.removeEventListener(`transitionend`,X),document.documentElement.removeEventListener(`transitioncancel`,X),q&&cancelAnimationFrame(q),q=0)}}function De(){return W}function Oe(){return 0}function ke(){return(0,h.useSyncExternalStore)(Z,De,Oe)}function Ae(e,t){let n=/^rgba?\(([^)]*)\)$/i.exec(e.trim())?.[1];if(n===void 0)return null;let r=n.split(/[\s,/]+/).filter(Boolean);if(r.length<3)return null;let i=`#`;for(let e=0;e<3;e++){let t=Math.round(Number(r[e]));if(!Number.isFinite(t)||t<0||t>255)return null;i+=t.toString(16).padStart(2,`0`)}if(t){let e=r[3]===void 0?1:Number(r[3]);if(!Number.isFinite(e)||e<0||e>1)return null;i+=Math.round(e*255).toString(16).padStart(2,`0`)}return i}var Q=null,$=null;function je(e,t){if(typeof document>`u`)return null;try{if(!Q){let e=document.createElement(`canvas`);e.width=1,e.height=1,Q=e.getContext(`2d`,{willReadFrequently:!0})}let n=Q;if(!n)return null;n.fillStyle=`#010203`,n.fillStyle=e;let r=n.fillStyle!==`#010203`;if(n.fillStyle=`#fefdfc`,n.fillStyle=e,!r&&n.fillStyle===`#fefdfc`)return null;n.clearRect(0,0,1,1),n.fillStyle=e,n.fillRect(0,0,1,1);let i=n.getImageData(0,0,1,1).data.slice(0,t?4:3);return $=null,`#${Array.from(i,e=>e.toString(16).padStart(2,`0`)).join(``)}`}catch(t){Q=null;let n=t instanceof Error?t.message:String(t);return $!==n&&($=n,console.warn(JSON.stringify({event:`css-color-to-hex-canvas-failed`,error:n,value:e}))),null}}function Me(e,t={}){let n=t.alpha??!1;return Ae(e,n)??je(e,n)}export{oe as _,U as a,_e as c,_ as d,v as f,b as g,se as h,L as i,E as l,w as m,Z as n,Ee as o,ee as p,ke as r,P as s,Me as t,x as u,re as v,C as y};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{Ct as r,Fs as i,Os as a,Ps as o,Uo as s,Vs as c,_ as l,fs as u,ls as d,v as f,ys as p}from"./dist-DTxb76k4.js";import{t as m}from"./use-apply-config-theme-B5w38X1P.js";var h=e(t(),1);function g(e,t=d){return t.find(t=>t.id===e)??c(e)}function _(e,t=d){let n=g(e,t).kind;return n===`system`?void 0:n}function ee(e){return{colorThemeLight:e.light,colorThemeDark:e.dark,colorTheme:null}}function v(){return{colorThemeLight:null,colorThemeDark:null,colorTheme:null}}var te=new Map(r.map(e=>[e.name,e]));function y(e,t){let n=te.get(e);if(!n)throw Error(`color-themes: ${e} is not a generated base-theme token`);return n[t]}function b(e){return{sidebar:e===`dark`?l:f,background:y(`--background`,e),primary:y(`--primary`,e),border:y(`--border`,e),"syntax-string":y(`--chart-2`,e),"syntax-keyword":y(`--chart-4`,e),"syntax-atom":y(`--chart-3`,e)}}var x={name:`Custom`,variant:`dark`,palette:{base00:`#0f172a`,base01:`#1e293b`,base02:`#334155`,base03:`#64748b`,base04:`#94a3b8`,base05:`#e2e8f0`,base06:`#f1f5f9`,base07:`#f8fafc`,base08:`#e5534b`,base09:`#db8d3f`,base0A:`#d29922`,base0B:`#3fb950`,base0C:`#22d3ee`,base0D:`#6366f1`,base0E:`#a78bfa`,base0F:`#c2703f`}},S=[`background`,`surface`,`foreground`,`primary`,`accent`,`border`];function ne(e){let{background:t,foreground:n}=e;return{name:`Custom`,variant:o(t)<o(n)?`dark`:`light`,palette:{base00:t,base01:e.surface,base02:e.border,base03:a(t,n,.4),base04:a(t,n,.55),base05:n,base06:a(n,`#ffffff`,.3),base07:a(n,`#ffffff`,.6),base08:`#e5534b`,base09:`#db8d3f`,base0A:`#d29922`,base0B:`#3fb950`,base0C:e.accent,base0D:e.primary,base0E:e.accent,base0F:a(`#e5534b`,t,.35)}}}function re(e){return p(e)}function ie(){let e=x.palette;return{background:e.base00,surface:e.base01,foreground:e.base05,primary:e.base0D,accent:e.base0C,border:e.base02}}function ae(e){let t=ie(),n=!1;for(let r of S){let i=e[r];p(i)&&(t[r]=i,n=!0)}return n?t:null}function oe(e){return e?S.some(t=>p(e[t])):!1}function C(e){if(!e)return x;let t=ae(e),n={...(t?ne(t):x).palette};for(let t of s){let r=e[t];p(r)&&(n[t]=r)}let r=e.variant===`light`||e.variant===`dark`?e.variant:o(n.base00)<o(n.base05)?`dark`:`light`;return{name:typeof e.name==`string`&&e.name.trim()?e.name.trim():`Custom`,author:typeof e.author==`string`?e.author:void 0,variant:r,palette:n}}function se(e){let t={name:e.name,author:e.author??null,variant:e.variant};for(let n of s)t[n]=e.palette[n];for(let e of S)t[e]=null;return t}function w(e){return e.variant}function T(e){return i(`html[data-color-theme="custom"]`,e.variant,u(e))}var ce=Object.keys(u(x)).map(e=>`--${e}`),E=[...new Set([...r.filter(e=>e.name!==`--radius`).map(e=>e.name),...ce,`--ok-comment-hue`])],le=new Set(E);function D(e){return le.has(e)}var O=n(),k=`data-theme-color-transitions`,ue=`ok-theme-color-transitions`,A=`data-theme-color-fading`,j=200,de=E.map(e=>`${e} ${j}ms ease-out`).join(`,`),M=new WeakSet;function fe(e){return e.defaultView?.CSS}function pe(e){let t=fe(e);if(typeof t?.registerProperty!=`function`)return!1;let n=e.defaultView?.DOMException;for(let e of E)try{t.registerProperty({name:e,syntax:`<color>`,inherits:!0,initialValue:`transparent`})}catch(e){if(typeof n==`function`&&e instanceof n&&e.name===`InvalidModificationError`)continue;throw e}return!0}function me(e){if(e.getElementById(`ok-theme-color-transitions`))return;let t=e.createElement(`style`);t.id=ue,t.textContent=`@media (prefers-reduced-motion: no-preference){:root[${k}]{transition:${de}}}`,e.head.appendChild(t)}function N(e){return e===`color`||e===`fill`||e===`stroke`||e.endsWith(`-color`)||e===`--tw-gradient-from`||e===`--tw-gradient-via`||e===`--tw-gradient-to`}function he(e){let t=e.defaultView;if(!t||typeof t.requestAnimationFrame!=`function`)return;let n=e.documentElement,r=0,i=0,a=0,o=0,s=n.getAttribute(`class`),c=n.getAttribute(`data-color-theme`),l=new Set,u=e=>{for(let t of e.getAnimations({subtree:!1}))N(t.transitionProperty??``)&&t.cancel()},d=()=>{if(typeof e.getAnimations==`function`)for(let r of e.getAnimations()){let e=r.effect,i=e&&`target`in e?e.target:null;i===n||!(i instanceof t.Element)||N(r.transitionProperty??``)&&r.cancel()}},f=()=>{a||=t.requestAnimationFrame(()=>{a=0;for(let e of l)u(e);n.hasAttribute(`data-theme-color-fading`)&&f()})},p=t=>{if(r=0,t===o){if(e.hidden||!P(e)){n.removeAttribute(A),l.clear();return}m(t)}},m=e=>{r=t.requestAnimationFrame(()=>p(e))};new t.MutationObserver(()=>{let r=n.getAttribute(`class`),a=n.getAttribute(`data-color-theme`);if(r===s&&a===c)return;s=r,c=a,o+=1;let u=o;if(i&&=(t.clearTimeout(i),0),n.setAttribute(A,``),d(),!P(e)){n.removeAttribute(A),l.clear();return}i=t.setTimeout(()=>{i=0,p(u)},j),f()}).observe(n,{attributes:!0,attributeFilter:[`class`,`data-color-theme`]}),e.addEventListener(`visibilitychange`,()=>{e.hidden&&(o+=1,i&&t.clearTimeout(i),r&&t.cancelAnimationFrame(r),n.removeAttribute(A),l.clear())}),e.addEventListener(`transitionrun`,e=>{if(e.target===n||!n.hasAttribute(`data-theme-color-fading`)||!N(e.propertyName))return;let r=e.target;r instanceof t.Element&&(l.add(r),u(r),f())},!0)}function ge(e=window.document){return M.has(e)||e.documentElement.hasAttribute(`data-theme-color-transitions`)?(M.add(e),!0):pe(e)?(me(e),he(e),e.documentElement.setAttribute(k,``),M.add(e),!0):!1}function _e(e){let t=(0,O.c)(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>{if(!e)return;let t=ve;if(typeof requestAnimationFrame!=`function`){t();return}let n=requestAnimationFrame(t);return()=>cancelAnimationFrame(n)},r=[e],t[0]=e,t[1]=n,t[2]=r),(0,h.useEffect)(n,r)}function ve(){try{ge()}catch(e){let t=e;console.warn(JSON.stringify({event:`theme-color-transitions-arm-failed`,error:t instanceof Error?t.message:String(t)}))}}function P(e=window.document){let t=e.documentElement;return typeof t.getAnimations==`function`?t.getAnimations({subtree:!1}).some(e=>D(e.transitionProperty??``)):!1}var F=`ok-color-theme-pair-v1`,I=`ok-color-theme-v1`,ye=`ok-custom-theme-v1`,L=`data-color-theme`,R=`ok-custom-theme`,z=`ok-saved-theme`;function be(e){let t=document.getElementById(R);t||(t=document.createElement(`style`),t.id=R,document.head.appendChild(t)),t.textContent!==e&&(t.textContent=e)}function xe(){document.getElementById(R)?.remove()}function B(e){if(e.scheme)return i(`html[${L}]`,e.scheme.variant,u(e.scheme))}function Se(e){let t=document.getElementById(z);t||(t=document.createElement(`style`),t.id=z,document.head.appendChild(t)),t.textContent!==e&&(t.textContent=e)}function Ce(){document.getElementById(z)?.remove()}function V(e,t,n,r){return e===`custom`?w(C(n))===`dark`:(_(e,r)??t)===`dark`}function we(e,t,n){if(e===`custom`)return T(C(t));if(d.some(t=>t.id===e))return;let r=n.find(t=>t.id===e);return r?B(r):void 0}function H(e,t,n,r){let i=V(e,t,n,r),a=we(e,n,r);return a?{id:e,dark:i,css:a}:{id:e,dark:i}}function Te(e){let{selection:t,slotMode:n,customSeed:r,themes:i=d,enabled:a=!0}=e,o=g(a?t[n]:`default`,i).id;return{id:o,dark:V(o,n,r,i)}}function U(e){if(typeof document>`u`)return;let{selection:t,modePreference:n,customSeed:r,themes:i=d,enabled:a=!0}=e,o=Te(e),s=g(o.id,i),c=document.documentElement;o.id===`default`?c.removeAttribute(L):c.setAttribute(L,o.id);let l=!d.some(e=>e.id===o.id)&&s.id===o.id?B(s):void 0;l?Se(l):Ce(),o.id===`custom`?be(T(C(r))):xe();let u=t.light===`default`&&t.dark===`default`;try{!a||u?localStorage.removeItem(F):localStorage.setItem(F,JSON.stringify({pref:m(n),light:H(t.light,`light`,r,i),dark:H(t.dark,`dark`,r,i)})),localStorage.removeItem(I),localStorage.removeItem(ye)}catch{}}function Ee(e){let t=(0,O.c)(22),{selection:n,modePreference:r,slotMode:i,customSeed:a,themes:o,enabled:s,ready:c}=e,l=s===void 0?!0:s,u=c===void 0?!0:c,d;t[0]!==a||t[1]!==l||t[2]!==n.dark||t[3]!==n.light?(d=l&&(n.light===`custom`||n.dark===`custom`)?JSON.stringify(a??null):``,t[0]=a,t[1]=l,t[2]=n.dark,t[3]=n.light,t[4]=d):d=t[4];let f=d,p;t[5]!==a||t[6]!==l||t[7]!==r||t[8]!==u||t[9]!==n||t[10]!==i||t[11]!==o?(p=()=>{u&&U({selection:n,modePreference:r,slotMode:i,customSeed:a,themes:o,enabled:l})},t[5]=a,t[6]=l,t[7]=r,t[8]=u,t[9]=n,t[10]=i,t[11]=o,t[12]=p):p=t[12];let m;t[13]!==l||t[14]!==r||t[15]!==u||t[16]!==f||t[17]!==n.dark||t[18]!==n.light||t[19]!==i||t[20]!==o?(m=[n.light,n.dark,r,i,f,o,l,u],t[13]=l,t[14]=r,t[15]=u,t[16]=f,t[17]=n.dark,t[18]=n.light,t[19]=i,t[20]=o,t[21]=m):m=t[21],(0,h.useEffect)(p,m)}var W=0,G=new Set,K=null,q=0;function J(){W+=1;for(let e of G)e()}function Y(){if(q||typeof requestAnimationFrame!=`function`){typeof requestAnimationFrame!=`function`&&J();return}q=requestAnimationFrame(()=>{q=0,J(),P()&&Y()})}function X(e){e.target===document.documentElement&&D(e.propertyName)&&Y()}function Z(e){return G.add(e),!K&&typeof document<`u`&&(K=new MutationObserver(Y),K.observe(document.documentElement,{attributes:!0,attributeFilter:[L,`class`]}),K.observe(document.head,{childList:!0,subtree:!0,characterData:!0}),document.documentElement.addEventListener(`transitionrun`,X),document.documentElement.addEventListener(`transitionend`,X),document.documentElement.addEventListener(`transitioncancel`,X),P()&&Y()),()=>{G.delete(e),G.size===0&&(K?.disconnect(),K=null,document.documentElement.removeEventListener(`transitionrun`,X),document.documentElement.removeEventListener(`transitionend`,X),document.documentElement.removeEventListener(`transitioncancel`,X),q&&cancelAnimationFrame(q),q=0)}}function De(){return W}function Oe(){return 0}function ke(){return(0,h.useSyncExternalStore)(Z,De,Oe)}function Ae(e,t){let n=/^rgba?\(([^)]*)\)$/i.exec(e.trim())?.[1];if(n===void 0)return null;let r=n.split(/[\s,/]+/).filter(Boolean);if(r.length<3)return null;let i=`#`;for(let e=0;e<3;e++){let t=Math.round(Number(r[e]));if(!Number.isFinite(t)||t<0||t>255)return null;i+=t.toString(16).padStart(2,`0`)}if(t){let e=r[3]===void 0?1:Number(r[3]);if(!Number.isFinite(e)||e<0||e>1)return null;i+=Math.round(e*255).toString(16).padStart(2,`0`)}return i}var Q=null,$=null;function je(e,t){if(typeof document>`u`)return null;try{if(!Q){let e=document.createElement(`canvas`);e.width=1,e.height=1,Q=e.getContext(`2d`,{willReadFrequently:!0})}let n=Q;if(!n)return null;n.fillStyle=`#010203`,n.fillStyle=e;let r=n.fillStyle!==`#010203`;if(n.fillStyle=`#fefdfc`,n.fillStyle=e,!r&&n.fillStyle===`#fefdfc`)return null;n.clearRect(0,0,1,1),n.fillStyle=e,n.fillRect(0,0,1,1);let i=n.getImageData(0,0,1,1).data.slice(0,t?4:3);return $=null,`#${Array.from(i,e=>e.toString(16).padStart(2,`0`)).join(``)}`}catch(t){Q=null;let n=t instanceof Error?t.message:String(t);return $!==n&&($=n,console.warn(JSON.stringify({event:`css-color-to-hex-canvas-failed`,error:n,value:e}))),null}}function Me(e,t={}){let n=t.alpha??!1;return Ae(e,n)??je(e,n)}export{oe as _,U as a,_e as c,_ as d,v as f,b as g,se as h,L as i,E as l,w as m,Z as n,Ee as o,ee as p,ke as r,P as s,Me as t,x as u,re as v,C as y};
@@ -1 +1 @@
1
- import{et as e}from"./dist-DILeGueK.js";var t=new Set(e);function n(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function r(e,r){try{let i={event:e},a=0,o=0;if(r){for(let[e,s]of Object.entries(r))if(!(e===`event`||s===void 0)){if(t.has(e)){o+=1;continue}if(!n(s)){a+=1;continue}i[e]=s}}a>0&&(i.droppedNonScalarFields=a),o>0&&(i.droppedReservedFields=o);let s=JSON.stringify(i);console.info(s.length<=4096?s:JSON.stringify({event:e,oversized:!0,fieldCount:Object.keys(i).length-1}))}catch{}}export{r as t};
1
+ import{et as e}from"./dist-DTxb76k4.js";var t=new Set(e);function n(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function r(e,r){try{let i={event:e},a=0,o=0;if(r){for(let[e,s]of Object.entries(r))if(!(e===`event`||s===void 0)){if(t.has(e)){o+=1;continue}if(!n(s)){a+=1;continue}i[e]=s}}a>0&&(i.droppedNonScalarFields=a),o>0&&(i.droppedReservedFields=o);let s=JSON.stringify(i);console.info(s.length<=4096?s:JSON.stringify({event:e,oversized:!0,fieldCount:Object.keys(i).length-1}))}catch{}}export{r as t};
@@ -172,7 +172,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
172
172
  `)?`\r
173
173
  `:`
174
174
  `)+t:t}function af(e){if(e===``)return``;let t=e.match(ef);return t?(t[1]??``).replace(/\r?\n$/,``):e}var of={defaultKeyType:`PLAIN`,defaultStringType:`PLAIN`,lineWidth:0};function sf(e){if(e.trim()===``)return{doc:new Ou({}),map:{}};let t;try{t=zd(e)}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new Ou({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=Xd.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function cf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function lf(e,t,n){if(Array.isArray(n)){let r=e.createNode(n),i=oc(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}if(cf(n)){let r=e.createNode(n),i=rc(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}return n}function uf(e){return e===``?``:`---\n${e.endsWith(`
175
- `)?e.slice(0,-1):e}\n---\n`}function df(e){let t=e.contents;return typeof t!=`object`||!t||!(`items`in t)?[]:t.items.map(e=>{let t=e.key;return typeof t==`string`?t:t&&typeof t==`object`&&`value`in t&&typeof t.value==`string`?t.value:null}).filter(e=>e!==null)}var ff=`__system__`,pf=`__config__/project`,mf=`__user__/config.yml`,hf=`__local__/project`,gf=`__config__/okignore`,_f=Object.freeze([pf,hf,mf,gf]),vf=`__skill__/`,yf=`__extskill__/`,bf=[`project`,`global`];function xf(e){return e.startsWith(`__skill__/`)||e.startsWith(`__template__/`)||e.startsWith(`__extskill__/`)}function Sf(e){return`${yf}${e}`}function Cf(e,t){return`${yf}${e}/${Ef(t)}`}function wf(e){return e.startsWith(yf)}function Tf(e){if(!e.startsWith(`__extskill__/`))return null;let t=e.slice(13),n=t.indexOf(`/`),r=n<0?t:t.slice(0,n),i=n<0?null:t.slice(n+1);return/^[a-z0-9-]+$/.test(r)?{name:r,rel:i&&i.length>0?i:null}:null}function Ef(e){return e.replace(/\.mdx?$/i,``)}var Df=`.ok/skills`;function Of(e){return`${Df}/${e}/SKILL`}var kf=[`references`,`scripts`];function Af(e,t){let n=e.trim();if(!n.startsWith(`/`))return null;let r=n.slice(1);if(r===``||r.includes(`/`))return null;let i=/^(\.[A-Za-z0-9_-]+\/skills)\/[^/]+\/(?:SKILL|references\/.+)$/.exec(t);return i?`${i[1]}/${r}/SKILL`:/^__skill__\/(global)\/[^/]+(?:\/references\/.+)?$/.exec(t)?If(`global`,r):null}function jf(e,t){let n=/^(\.[A-Za-z0-9_-]+\/skills\/[^/]+)\/(?:SKILL|references\/.+)$/.exec(t)??/^(__skill__\/global\/[^/]+)(?:\/references\/.+)?$/.exec(t)??/^(__extskill__\/[^/]+)(?:\/.+)?$/.exec(t);if(!n)return null;let r=n[1],i=Ef(e.trim()).split(`/`).filter(e=>e!==``&&e!==`.`),[a]=i;return!a||!kf.includes(a)||i.includes(`..`)||i.length<2?null:`${r}/${i.join(`/`)}`}var Mf=/^\.[A-Za-z0-9_-]+\/skills\/([^/]+)\/(SKILL|references\/.+)$/;function Nf(e){let t=Mf.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===`SKILL`?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}var Pf=/^__skill__\/global\/([^/]+)(?:\/(references\/.+))?$/;function Ff(e){let t=Pf.exec(e);if(!t)return null;let{name:n,host:r}=Lf(t[1]),i=t[2];return i===void 0?{name:n,kind:`skill`,rel:null,host:r}:{name:n,kind:`reference`,rel:i.slice(11),host:r}}function If(e,t,n){return e===`project`?Of(t):`${vf}${e}/${t}${n?`@${n}`:``}`}function Lf(e){let t=e.indexOf(`@`);if(t<0)return{name:e,host:null};let n=e.slice(t+1);return{name:e.slice(0,t),host:n===``?null:n}}function Rf(e,t,n,r){let i=Ef(n);return e===`project`?`${Df}/${t}/${i}`:`${vf}${e}/${t}${r?`@${r}`:``}/${i}`}function zf(e){if(e===``)return``;try{return e.split(`/`).map(e=>decodeURIComponent(e)).join(`/`)}catch{return e}}function Bf(e){if(e.startsWith(`__skill__/`)){let t=e.slice(10),n=t.indexOf(`/`);if(n<0)return null;let r=t.slice(0,n);if(r!==`global`&&r!==`project`)return null;let i=t.slice(n+1);if(!i)return null;let a=zf(i),o=a.indexOf(`/`),s=o<0?a:a.slice(0,o);if(!s)return null;let c=o<0?null:a.slice(o+1),{name:l,host:u}=Lf(s);return l?{kind:`skill`,scope:r,name:l,host:u,rel:c}:null}return null}var Vf=/^(?:(.+)\/)?\.ok\/templates\/([^/]+?)(?:\.md)?$/;function Hf(e,t){let n=e.replace(/^\/+|\/+$/g,``);return n?`${n}/.ok/templates/${t}`:`.ok/templates/${t}`}function Uf(e){let t=Vf.exec(e);return t?{folder:(t[1]??``).replace(/^\/+|\/+$/g,``),name:t[2]}:null}function Wf(e){if(!e.startsWith(`__template__/`))return null;let t=e.slice(13);if(!t)return null;let n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return r?{folder:zf(n<0?``:t.slice(0,n)),name:zf(r)}:null}var Gf=`.agents/skills`,Kf=`open-knowledge-pack-`,qf={"open-knowledge-pack-plain-notes":`note-taking`,"open-knowledge-pack-worldbuilding":`worldbuilding`,"open-knowledge-pack-writing-pipeline":`writing-workflow`,"open-knowledge-pack-codebase-wiki":`codebase-wiki`,"open-knowledge-pack-knowledge-base":`knowledge-base`,"open-knowledge-pack-software-lifecycle":`software-lifecycle`,"open-knowledge-pack-entity-vault":`personal-crm`,"open-knowledge-pack-okf":`okf-knowledge-base`,"open-knowledge-pack-software-lifecycle-frame-a-proposal":`frame-a-proposal`,"open-knowledge-pack-software-lifecycle-record-a-decision":`record-a-decision`,"open-knowledge-pack-software-lifecycle-write-a-spec":`write-a-spec`,"open-knowledge-pack-software-lifecycle-review-a-design":`review-a-design`,"open-knowledge-pack-software-lifecycle-write-a-postmortem":`write-a-postmortem`,"open-knowledge-pack-knowledge-base-research":`research-with-sources`,"open-knowledge-pack-knowledge-base-consolidate":`consolidate-notes`},Jf=`inkeep/open-knowledge-skills`,Yf=/(^|[\s([])\/([a-z0-9][a-z0-9-]{1,63})(?=$|[\s.,;:!?)\]])/g,Xf=new Set([`tmp`,`usr`,`etc`,`var`,`dev`,`opt`,`bin`,`api`,`home`,`root`]);function Zf(e){return!Xf.has(e)}var Qf=L({source:M(),pluginProvider:M().optional(),skill:M().optional(),ref:M().optional(),contentHash:M(),files:F(M()).optional(),localHash:M().optional(),baselineRef:M().optional(),publisher:M().optional(),importedAt:ra(),autoUpdate:P().optional()});L({schema:z(1),skills:_o(M(),Qf).default({})}),new Set(Object.values(qf));var $f=L({name:M(),description:M(),files:L({skillMd:M(),scripts:F(M()),references:F(M())})}),ep=L({pluginProvider:M().optional(),plugin:M().optional(),marketplace:M().optional(),repositoryUrl:M().optional(),version:M().optional(),gitCommitSha:M().optional(),scope:M().optional(),projectPath:M().optional()}),tp=L({commands:P(),hooks:P(),mcp:P()}),np=L({...$f.shape,sourceHarness:M(),sourceHarnesses:F(M()),home:M(),provenance:ep,inert:tp,outsideProject:P().optional()}),rp=L({schema:z(1),name:M(),version:M(),description:M().optional(),author:L({name:M()}).optional(),skills:F(M()),hostCompatibility:F(M()).optional(),capabilities:L({scripts:M(),network:M(),inert:F(M())}).optional(),provenance:L({source:M(),ref:M(),contentHash:M()}).optional()});I({skills:F(np),packs:F(rp)}).loose(),I({results:F(I({id:M().min(1),name:M().min(1),source:M().min(1),description:M(),installs:N().int().nonnegative().nullable(),publisher:M().nullable()}).loose()),backend:R([`skills.sh`,`github-fallback`]),degraded:P()}).loose(),I({title:M(),description:M(),image:M().nullable(),skillsUrl:M().nullable(),sourceKind:R([`github`,`site`]),sourceUrl:M()}).loose(),I({skills:F(I({name:M(),description:M().nullable()}).loose())}).loose(),I({kind:R([`local`,`import`,`none`]),scope:R(bf).optional(),name:M().optional(),dir:M().optional(),source:M().optional(),ref:M().optional(),via:R([`source`,`publisher`]).optional()}).loose();var ip=I({relPath:M(),content:M().nullable()}).loose(),ap=I({provider:M(),plugin:M(),version:M().optional(),marketplace:M().optional(),repositoryUrl:M().optional()}).loose(),op=I({provider:M(),plugin:M(),version:M().optional(),description:M().optional(),repositoryUrl:M().optional(),bundledSkills:F(M()),capabilities:I({commands:P(),hooks:P(),mcp:P(),agents:P()}),setupSupported:P()}).loose();I({name:M(),description:M().nullable(),skillMd:M(),files:F(ip),plugin:ap.optional(),pluginBundle:op.optional()}).loose();var sp=new Set([`project`,`local`]);function cp(e){return e!==void 0&&sp.has(e)?`project`:`global`}var lp=/^([\w.-]+)\/([\w.-]+)$/,up=/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function dp(e){let t=lp.exec(e);if(t){let[,e,n]=t;if(e&&n)return{kind:`github`,owner:e,repo:n}}return up.test(e)?{kind:`site`,hostname:e}:null}function fp(e,t){let n=dp(e),r=t.trim();if(!n||!r)return null;let i=encodeURIComponent(r);if(n.kind===`github`){let e=encodeURIComponent(n.owner),t=encodeURIComponent(n.repo);return{sourceKind:`github`,skillsUrl:`https://www.skills.sh/${e}/${t}/${i}`,sourceUrl:`https://github.com/${e}/${t}`}}return{sourceKind:`site`,skillsUrl:`https://www.skills.sh/site/${encodeURIComponent(n.hostname)}/${i}`,sourceUrl:`https://${n.hostname}`}}function pp(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,`0`)}var mp={"bridge-merge-loss":{visibility:`surfaced`,gcBucket:`bridge-merge-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"producer-guard-loss":{visibility:`surfaced`,gcBucket:`producer-guard-loss`,bundleExposure:`metadata`,chainAnchor:!1},"observer-a-duplication":{visibility:`surfaced`,gcBucket:`observer-a-duplication`,bundleExposure:`metadata`,chainAnchor:!1},"external-change-rescue":{visibility:`surfaced`,gcBucket:`external-change-rescue`,bundleExposure:`metadata`,chainAnchor:!1},"external-change-rescue-disk-update":{visibility:`surfaced`,gcBucket:`external-change-rescue-disk-update`,bundleExposure:`metadata`,chainAnchor:!1},"defer-exhaustion-loss":{visibility:`surfaced`,gcBucket:`defer-exhaustion-loss`,bundleExposure:`metadata`,chainAnchor:!1},"observer-a-apply-loss":{visibility:`surfaced`,gcBucket:`observer-a-apply-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"bridge-derive-loss":{visibility:`surfaced`,gcBucket:`bridge-derive-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"bridge-backstop-trip":{visibility:`surfaced`,gcBucket:`bridge-backstop-trip`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-reconcile-loss":{visibility:`surfaced`,gcBucket:`persistence-reconcile-loss`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-duplication-reset":{visibility:`surfaced`,gcBucket:`persistence-duplication-reset`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-divergence-realign":{visibility:`surfaced`,gcBucket:`persistence-divergence-realign`,bundleExposure:`metadata`,chainAnchor:!1},"managed-artifact-reconcile":{visibility:`surfaced`,gcBucket:`managed-artifact-reconcile`,bundleExposure:`metadata`,chainAnchor:!1},"auto-consolidation":{visibility:`hidden`,gcBucket:`auto-consolidation`,bundleExposure:`none`,chainAnchor:!0}};function hp(e){return e==null?!0:mp[e].visibility===`surfaced`}var gp=[`off`,`follow`,`full`],_p=`pull`,vp=[`off`,`follow`,`full`,_p],yp=[`follow`,`full`,_p];function bp(e){return e===_p?`follow`:xp(e)?e:null}function xp(e){return typeof e==`string`&&gp.includes(e)}function Sp(e){return e===!0?`full`:e===!1?`off`:null}function Cp(e){return e===!0?`full`:e===!1?`off`:bp(e)}function wp(e){let t=bp(e?.mode);return t===null?Sp(e?.enabled):t}var Tp=3600,Ep=[30,60,300,900,3600];function Dp(e,t){return typeof e!=`number`||!Number.isFinite(e)?t:Math.min(Tp,Math.max(30,Math.round(e)))}function Op(e){return{pullIntervalSeconds:Dp(e?.pullIntervalSeconds,30),pushIntervalSeconds:Dp(e?.pushIntervalSeconds,60)}}var kp=[`github`];function Ap(e){let t=e.toLowerCase().replace(/:\d+$/,``);return t===`www.github.com`?`github.com`:t}var jp=Symbol.for(`@inkeep/open-knowledge/field-registry`),Mp=globalThis;Mp[jp]===void 0&&(Mp[jp]=yr());var U=Mp[jp];function Np(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=Pp(t)?U.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function Pp(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}function Fp(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&(sc(e.getIn(r,!0))||e.deleteIn(r))}}function Ip(e,t){let n=[];function r(t,i){if(t!==void 0){if(t===null){e.deleteIn(i),n.push(i.join(`.`));return}if(Array.isArray(t)){Fp(e,i),e.setIn(i,t),n.push(i.join(`.`));return}if(typeof t==`object`){for(let[e,n]of Object.entries(t))r(n,[...i,e]);return}Fp(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function Lp(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}var Rp={provider:R(kp).register(U,{scope:`user`,agentSettable:!1,reload:`boot`,defaultScope:`user`,description:"Declares that this git host is a GitHub Enterprise Server instance, so OpenKnowledge treats its remotes the way it treats github.com (OpenKnowledge credential handling, the push-permission check, share links, and the default host for `ok auth`). 'github' is the only accepted value today. A host that is not declared here and is not github.com is treated as a generic git remote, so OpenKnowledge leaves the machine's own git credentials alone and does not check push permission. Per-machine (user scope, global.yml in the OpenKnowledge home folder); a value in a project's `.ok/config.yml` is ignored. The declaration takes effect when OpenKnowledge next starts."})},zp=Object.fromEntries(Object.entries(Rp).map(([e,t])=>[e,t.optional().catch(void 0)])),Bp=Object.fromEntries(Object.entries(Rp).map(([e,t])=>[e,t.nullish()])),Vp=L(zp).catch({});_o(M(),L(Rp).partial());var Hp=L({git:L({hosts:_o(M(),L(Bp).nullish()).nullish()}).nullish()});function Up(e){let t=Hp.safeParse(e);return t.success?null:{code:`SCHEMA_INVALID`,issues:t.error.issues.map(Lp)}}var Wp={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`},Gp=new Set(Object.keys(Wp));function Kp(e){return Wp[e.toLowerCase().replace(/^\./,``)]??null}var qp=new Set([`md`,`mdx`,`mmd`,`mermaid`]),Jp=new Set([...Gp,`txt`,`text`,`csv`,`tsv`,`log`,`toml`,`html`,`htm`,`svg`,`vue`,`svelte`,`astro`,`lock`].filter(e=>!qp.has(e))),Yp={html:`html`,htm:`html`,svg:`xml`,vue:`html`,svelte:`html`,astro:`html`,lock:`yaml`};function Xp(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:Jp.has(t.slice(n+1).toLowerCase())}var Zp=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],Qp=[`video/mp4`,`video/webm`,`video/ogg`],$p=[`audio/mpeg`,`audio/wav`,`audio/ogg`],em=[`application/pdf`],tm=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),nm=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),rm=new Set([`pdf`]),im=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),am=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(`.`)),om=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(`.`)),sm=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(`.`)),cm=`wikiembed`,lm=`toast`,um=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(`.`)),dm=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],fm=[`mp4`,`webm`,`mov`,`m4v`],pm=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],mm=[`pdf`],hm=[`json`,`toml`,`lock`];function gm(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}gm(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,dm,tm),gm(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,fm,nm),gm(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,pm,im),gm(`SIDEBAR_PDF_ASSET_EXTENSIONS`,mm,rm),gm(`FILE_ATTACHMENT_EXTENSIONS`,[...am],um),gm(`WIKI_EMBED_EXTENSIONS`,[...um],om);var _m=new Set(dm),vm=new Set(fm),ym=new Set(pm),bm=new Set(mm),xm=new Set(hm);gm(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...dm,...fm,...pm,...mm,...hm])],sm);var Sm=new Set([`base`,`canvas`]),Cm=new Set([`mmd`,`mermaid`]);function wm(e){let t=e.lastIndexOf(`.`);return t<0?!1:Cm.has(e.slice(t+1).toLowerCase())}var Tm=new Set([`excalidraw`]);function Em(e){let t=e.lastIndexOf(`.`);return t<0?!1:Tm.has(e.slice(t+1).toLowerCase())}function ene(e){return!wm(e)&&!Em(e)&&!Xp(e)}[...om,...Sm,...Cm,...Tm];function tne(e){let t=e.toLowerCase().replace(/^\./,``);return _m.has(t)?`image`:vm.has(t)?`video`:ym.has(t)?`audio`:bm.has(t)?`pdf`:xm.has(t)||Sm.has(t)?`text`:Cm.has(t)?`mermaid`:Tm.has(t)?`excalidraw`:Gp.has(t)?`text`:null}var Dm=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`ar`,`fr`,`bn`,`pt-BR`,`id`,`ur`,`ko`],nne=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`fr`,`bn`,`pt-BR`,`id`,`ko`],rne=new Set([`ar`,`ur`]),ine=Dm.filter(e=>!rne.has(e)),ane=[`markdownlint`,`frontmatter`,`okf`],one=[`missing`,`invalid`];function sne(e){return e.frontmatterScope!==void 0}[...ane];var cne=[`off`,`warning`,`error`],Om=`warning`,lne=[`error`,`warning`],km=[`base00`,`base01`,`base02`,`base03`,`base04`,`base05`,`base06`,`base07`,`base08`,`base09`,`base0A`,`base0B`,`base0C`,`base0D`,`base0E`,`base0F`],Am={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`},jm=/^#[0-9a-fA-F]{6}$/,une=/\P{White_Space}/u,Mm={graphical:3,text:4.5};function Nm(e){return une.test(e)}function Pm(e){return typeof e==`string`&&jm.test(e)}function Fm(e,t){let n=Um(e),r=Um(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Im(e,t){return t.reduce((t,n)=>Fm(e,n)>Fm(e,t)?n:t)}function Lm(e,t){let n=Im(e,t);return Fm(e,n)>=Mm.text?n:Im(e,[`#000000`,`#ffffff`])}function Rm(e,t,n){if(Fm(e,t)>=n)return t;let r=Im(e,[`#000000`,`#ffffff`]);for(let i=1;i<=255;i+=1){let a=Hm(t,r,i/255);if(Fm(e,a)>=n)return a}return console.warn(`[base16] No foreground reaches a ${n}:1 contrast ratio against ${e}; using the highest-contrast endpoint`),r}function zm(e){let t=e.palette,n=Hm(t.base02,e.variant===`dark`?`#ffffff`:`#000000`,.04);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-hover-foreground":Lm(t.base02,[t.base00,t.base05,t.base07]),"sidebar-hover-muted-foreground":Rm(t.base02,t.base04,Mm.text),"sidebar-hover-destructive-foreground":Rm(t.base02,t.base08,Mm.graphical),"sidebar-selected":n,"sidebar-selected-foreground":Lm(n,[t.base00,t.base05,t.base07]),"sidebar-selected-muted-foreground":Rm(n,t.base04,Mm.text),"sidebar-selected-destructive-foreground":Rm(n,t.base08,Mm.graphical),"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,...fne(t)}}var Bm={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`},dne=Object.keys(Bm);function fne(e){let t={};for(let n of dne)t[`ansi-${pne(n)}`]=e[Bm[n]];return t}function pne(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function Vm(e){return JSON.stringify(e).replace(/[\u007f-\u009f\u2028\u2029\ufffe\uffff]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}function mne(e){return`${[`system: "base16"`,`name: ${Vm(e.name)}`,...e.author?[`author: ${Vm(e.author)}`]:[],`variant: ${Vm(e.variant)}`,`palette:`,...km.map(t=>` ${t}: ${Vm(e.palette[t])}`)].join(`
175
+ `)?e.slice(0,-1):e}\n---\n`}function df(e){let t=e.contents;return typeof t!=`object`||!t||!(`items`in t)?[]:t.items.map(e=>{let t=e.key;return typeof t==`string`?t:t&&typeof t==`object`&&`value`in t&&typeof t.value==`string`?t.value:null}).filter(e=>e!==null)}var ff=`__system__`,pf=`__config__/project`,mf=`__user__/config.yml`,hf=`__local__/project`,gf=`__config__/okignore`,_f=Object.freeze([pf,hf,mf,gf]),vf=`__skill__/`,yf=`__extskill__/`,bf=[`project`,`global`];function xf(e){return e.startsWith(`__skill__/`)||e.startsWith(`__template__/`)||e.startsWith(`__extskill__/`)}function Sf(e){return`${yf}${e}`}function Cf(e,t){return`${yf}${e}/${Ef(t)}`}function wf(e){return e.startsWith(yf)}function Tf(e){if(!e.startsWith(`__extskill__/`))return null;let t=e.slice(13),n=t.indexOf(`/`),r=n<0?t:t.slice(0,n),i=n<0?null:t.slice(n+1);return/^[a-z0-9-]+$/.test(r)?{name:r,rel:i&&i.length>0?i:null}:null}function Ef(e){return e.replace(/\.mdx?$/i,``)}var Df=`.ok/skills`;function Of(e){return`${Df}/${e}/SKILL`}var kf=[`references`,`scripts`];function Af(e,t){let n=e.trim();if(!n.startsWith(`/`))return null;let r=n.slice(1);if(r===``||r.includes(`/`))return null;let i=/^(\.[A-Za-z0-9_-]+\/skills)\/[^/]+\/(?:SKILL|references\/.+)$/.exec(t);return i?`${i[1]}/${r}/SKILL`:/^__skill__\/(global)\/[^/]+(?:\/references\/.+)?$/.exec(t)?If(`global`,r):null}function jf(e,t){let n=/^(\.[A-Za-z0-9_-]+\/skills\/[^/]+)\/(?:SKILL|references\/.+)$/.exec(t)??/^(__skill__\/global\/[^/]+)(?:\/references\/.+)?$/.exec(t)??/^(__extskill__\/[^/]+)(?:\/.+)?$/.exec(t);if(!n)return null;let r=n[1],i=Ef(e.trim()).split(`/`).filter(e=>e!==``&&e!==`.`),[a]=i;return!a||!kf.includes(a)||i.includes(`..`)||i.length<2?null:`${r}/${i.join(`/`)}`}var Mf=/^\.[A-Za-z0-9_-]+\/skills\/([^/]+)\/(SKILL|references\/.+)$/;function Nf(e){let t=Mf.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===`SKILL`?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}var Pf=/^__skill__\/global\/([^/]+)(?:\/(references\/.+))?$/;function Ff(e){let t=Pf.exec(e);if(!t)return null;let{name:n,host:r}=Lf(t[1]),i=t[2];return i===void 0?{name:n,kind:`skill`,rel:null,host:r}:{name:n,kind:`reference`,rel:i.slice(11),host:r}}function If(e,t,n){return e===`project`?Of(t):`${vf}${e}/${t}${n?`@${n}`:``}`}function Lf(e){let t=e.indexOf(`@`);if(t<0)return{name:e,host:null};let n=e.slice(t+1);return{name:e.slice(0,t),host:n===``?null:n}}function Rf(e,t,n,r){let i=Ef(n);return e===`project`?`${Df}/${t}/${i}`:`${vf}${e}/${t}${r?`@${r}`:``}/${i}`}function zf(e){if(e===``)return``;try{return e.split(`/`).map(e=>decodeURIComponent(e)).join(`/`)}catch{return e}}function Bf(e){if(e.startsWith(`__skill__/`)){let t=e.slice(10),n=t.indexOf(`/`);if(n<0)return null;let r=t.slice(0,n);if(r!==`global`&&r!==`project`)return null;let i=t.slice(n+1);if(!i)return null;let a=zf(i),o=a.indexOf(`/`),s=o<0?a:a.slice(0,o);if(!s)return null;let c=o<0?null:a.slice(o+1),{name:l,host:u}=Lf(s);return l?{kind:`skill`,scope:r,name:l,host:u,rel:c}:null}return null}var Vf=/^(?:(.+)\/)?\.ok\/templates\/([^/]+?)(?:\.md)?$/;function Hf(e,t){let n=e.replace(/^\/+|\/+$/g,``);return n?`${n}/.ok/templates/${t}`:`.ok/templates/${t}`}function Uf(e){let t=Vf.exec(e);return t?{folder:(t[1]??``).replace(/^\/+|\/+$/g,``),name:t[2]}:null}function Wf(e){if(!e.startsWith(`__template__/`))return null;let t=e.slice(13);if(!t)return null;let n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return r?{folder:zf(n<0?``:t.slice(0,n)),name:zf(r)}:null}var Gf=`.agents/skills`,Kf=`open-knowledge-pack-`,qf={"open-knowledge-pack-plain-notes":`note-taking`,"open-knowledge-pack-worldbuilding":`worldbuilding`,"open-knowledge-pack-writing-pipeline":`writing-workflow`,"open-knowledge-pack-codebase-wiki":`codebase-wiki`,"open-knowledge-pack-knowledge-base":`knowledge-base`,"open-knowledge-pack-software-lifecycle":`software-lifecycle`,"open-knowledge-pack-entity-vault":`personal-crm`,"open-knowledge-pack-okf":`okf-knowledge-base`,"open-knowledge-pack-software-lifecycle-frame-a-proposal":`frame-a-proposal`,"open-knowledge-pack-software-lifecycle-record-a-decision":`record-a-decision`,"open-knowledge-pack-software-lifecycle-write-a-spec":`write-a-spec`,"open-knowledge-pack-software-lifecycle-review-a-design":`review-a-design`,"open-knowledge-pack-software-lifecycle-write-a-postmortem":`write-a-postmortem`,"open-knowledge-pack-knowledge-base-research":`research-with-sources`,"open-knowledge-pack-knowledge-base-consolidate":`consolidate-notes`},Jf=`inkeep/open-knowledge-skills`,Yf=/(^|[\s([])\/([a-z0-9][a-z0-9-]{1,63})(?=$|[\s.,;:!?)\]])/g,Xf=new Set([`tmp`,`usr`,`etc`,`var`,`dev`,`opt`,`bin`,`api`,`home`,`root`]);function Zf(e){return!Xf.has(e)}var Qf=L({source:M(),pluginProvider:M().optional(),skill:M().optional(),ref:M().optional(),contentHash:M(),files:F(M()).optional(),localHash:M().optional(),baselineRef:M().optional(),publisher:M().optional(),importedAt:ra(),autoUpdate:P().optional()});L({schema:z(1),skills:_o(M(),Qf).default({})}),new Set(Object.values(qf));var $f=L({name:M(),description:M(),files:L({skillMd:M(),scripts:F(M()),references:F(M())})}),ep=L({pluginProvider:M().optional(),plugin:M().optional(),marketplace:M().optional(),repositoryUrl:M().optional(),version:M().optional(),gitCommitSha:M().optional(),scope:M().optional(),projectPath:M().optional()}),tp=L({commands:P(),hooks:P(),mcp:P()}),np=L({...$f.shape,sourceHarness:M(),sourceHarnesses:F(M()),home:M(),provenance:ep,inert:tp,outsideProject:P().optional()}),rp=L({schema:z(1),name:M(),version:M(),description:M().optional(),author:L({name:M()}).optional(),skills:F(M()),hostCompatibility:F(M()).optional(),capabilities:L({scripts:M(),network:M(),inert:F(M())}).optional(),provenance:L({source:M(),ref:M(),contentHash:M()}).optional()});I({skills:F(np),packs:F(rp)}).loose(),I({results:F(I({id:M().min(1),name:M().min(1),source:M().min(1),description:M(),installs:N().int().nonnegative().nullable(),publisher:M().nullable()}).loose()),backend:R([`skills.sh`,`github-fallback`]),degraded:P()}).loose(),I({title:M(),description:M(),image:M().nullable(),skillsUrl:M().nullable(),sourceKind:R([`github`,`site`]),sourceUrl:M()}).loose(),I({skills:F(I({name:M(),description:M().nullable()}).loose())}).loose(),I({kind:R([`local`,`import`,`none`]),scope:R(bf).optional(),name:M().optional(),dir:M().optional(),source:M().optional(),ref:M().optional(),via:R([`source`,`publisher`]).optional()}).loose();var ip=I({relPath:M(),content:M().nullable()}).loose(),ap=I({provider:M(),plugin:M(),version:M().optional(),marketplace:M().optional(),repositoryUrl:M().optional()}).loose(),op=I({provider:M(),plugin:M(),version:M().optional(),description:M().optional(),repositoryUrl:M().optional(),bundledSkills:F(M()),capabilities:I({commands:P(),hooks:P(),mcp:P(),agents:P()}),setupSupported:P()}).loose();I({name:M(),description:M().nullable(),skillMd:M(),files:F(ip),plugin:ap.optional(),pluginBundle:op.optional()}).loose();var sp=new Set([`project`,`local`]);function cp(e){return e!==void 0&&sp.has(e)?`project`:`global`}var lp=/^([\w.-]+)\/([\w.-]+)$/,up=/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function dp(e){let t=lp.exec(e);if(t){let[,e,n]=t;if(e&&n)return{kind:`github`,owner:e,repo:n}}return up.test(e)?{kind:`site`,hostname:e}:null}function fp(e,t){let n=dp(e),r=t.trim();if(!n||!r)return null;let i=encodeURIComponent(r);if(n.kind===`github`){let e=encodeURIComponent(n.owner),t=encodeURIComponent(n.repo);return{sourceKind:`github`,skillsUrl:`https://www.skills.sh/${e}/${t}/${i}`,sourceUrl:`https://github.com/${e}/${t}`}}return{sourceKind:`site`,skillsUrl:`https://www.skills.sh/site/${encodeURIComponent(n.hostname)}/${i}`,sourceUrl:`https://${n.hostname}`}}function pp(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,`0`)}var mp={"bridge-merge-loss":{visibility:`surfaced`,gcBucket:`bridge-merge-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"producer-guard-loss":{visibility:`surfaced`,gcBucket:`producer-guard-loss`,bundleExposure:`metadata`,chainAnchor:!1},"observer-a-duplication":{visibility:`surfaced`,gcBucket:`observer-a-duplication`,bundleExposure:`metadata`,chainAnchor:!1},"external-change-rescue":{visibility:`surfaced`,gcBucket:`external-change-rescue`,bundleExposure:`metadata`,chainAnchor:!1},"external-change-rescue-disk-update":{visibility:`surfaced`,gcBucket:`external-change-rescue-disk-update`,bundleExposure:`metadata`,chainAnchor:!1},"defer-exhaustion-loss":{visibility:`surfaced`,gcBucket:`defer-exhaustion-loss`,bundleExposure:`metadata`,chainAnchor:!1},"observer-a-apply-loss":{visibility:`surfaced`,gcBucket:`observer-a-apply-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"bridge-derive-loss":{visibility:`surfaced`,gcBucket:`bridge-derive-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"bridge-backstop-trip":{visibility:`surfaced`,gcBucket:`bridge-backstop-trip`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-reconcile-loss":{visibility:`surfaced`,gcBucket:`persistence-reconcile-loss`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-duplication-reset":{visibility:`surfaced`,gcBucket:`persistence-duplication-reset`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-divergence-realign":{visibility:`surfaced`,gcBucket:`persistence-divergence-realign`,bundleExposure:`metadata`,chainAnchor:!1},"managed-artifact-reconcile":{visibility:`surfaced`,gcBucket:`managed-artifact-reconcile`,bundleExposure:`metadata`,chainAnchor:!1},"auto-consolidation":{visibility:`hidden`,gcBucket:`auto-consolidation`,bundleExposure:`none`,chainAnchor:!0}};function hp(e){return e==null?!0:mp[e].visibility===`surfaced`}var gp=[`off`,`follow`,`full`],_p=`pull`,vp=[`off`,`follow`,`full`,_p],yp=[`follow`,`full`,_p];function bp(e){return e===_p?`follow`:xp(e)?e:null}function xp(e){return typeof e==`string`&&gp.includes(e)}function Sp(e){return e===!0?`full`:e===!1?`off`:null}function Cp(e){return e===!0?`full`:e===!1?`off`:bp(e)}function wp(e){let t=bp(e?.mode);return t===null?Sp(e?.enabled):t}var Tp=3600,Ep=[30,60,300,900,3600];function Dp(e,t){return typeof e!=`number`||!Number.isFinite(e)?t:Math.min(Tp,Math.max(30,Math.round(e)))}function Op(e){return{pullIntervalSeconds:Dp(e?.pullIntervalSeconds,30),pushIntervalSeconds:Dp(e?.pushIntervalSeconds,60)}}var kp=[`github`];function Ap(e){let t=e.toLowerCase().replace(/:\d+$/,``);return t===`www.github.com`?`github.com`:t}var jp=Symbol.for(`@inkeep/open-knowledge/field-registry`),Mp=globalThis;Mp[jp]===void 0&&(Mp[jp]=yr());var U=Mp[jp];function Np(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=Pp(t)?U.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function Pp(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}function Fp(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&(sc(e.getIn(r,!0))||e.deleteIn(r))}}function Ip(e,t){let n=[];function r(t,i){if(t!==void 0){if(t===null){e.deleteIn(i),n.push(i.join(`.`));return}if(Array.isArray(t)){Fp(e,i),e.setIn(i,t),n.push(i.join(`.`));return}if(typeof t==`object`){for(let[e,n]of Object.entries(t))r(n,[...i,e]);return}Fp(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function Lp(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}var Rp={provider:R(kp).register(U,{scope:`user`,agentSettable:!1,reload:`boot`,defaultScope:`user`,description:"Declares that this git host is a GitHub Enterprise Server instance, so OpenKnowledge treats its remotes the way it treats github.com (OpenKnowledge credential handling, the push-permission check, share links, and the default host for `ok auth`). 'github' is the only accepted value today. A host that is not declared here and is not github.com is treated as a generic git remote, so OpenKnowledge leaves the machine's own git credentials alone and does not check push permission. Per-machine (user scope, global.yml in the OpenKnowledge home folder); a value in a project's `.ok/config.yml` is ignored. The declaration takes effect when OpenKnowledge next starts."})},zp=Object.fromEntries(Object.entries(Rp).map(([e,t])=>[e,t.optional().catch(void 0)])),Bp=Object.fromEntries(Object.entries(Rp).map(([e,t])=>[e,t.nullish()])),Vp=L(zp).catch({});_o(M(),L(Rp).partial());var Hp=L({git:L({hosts:_o(M(),L(Bp).nullish()).nullish()}).nullish()});function Up(e){let t=Hp.safeParse(e);return t.success?null:{code:`SCHEMA_INVALID`,issues:t.error.issues.map(Lp)}}var Wp={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`},Gp=new Set(Object.keys(Wp));function Kp(e){return Wp[e.toLowerCase().replace(/^\./,``)]??null}var qp=new Set([`md`,`mdx`,`mmd`,`mermaid`]),Jp=new Set([...Gp,`txt`,`text`,`csv`,`tsv`,`log`,`toml`,`html`,`htm`,`svg`,`vue`,`svelte`,`astro`,`lock`].filter(e=>!qp.has(e))),Yp={html:`html`,htm:`html`,svg:`xml`,vue:`html`,svelte:`html`,astro:`html`,lock:`yaml`};function Xp(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:Jp.has(t.slice(n+1).toLowerCase())}var Zp=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],Qp=[`video/mp4`,`video/webm`,`video/ogg`],$p=[`audio/mpeg`,`audio/wav`,`audio/ogg`],em=[`application/pdf`],tm=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),nm=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),rm=new Set([`pdf`]),im=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),am=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(`.`)),om=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(`.`)),sm=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(`.`)),cm=`wikiembed`,lm=`toast`,um=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(`.`)),dm=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],fm=[`mp4`,`webm`,`mov`,`m4v`],pm=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],mm=[`pdf`],hm=[`json`,`toml`,`lock`];function gm(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}gm(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,dm,tm),gm(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,fm,nm),gm(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,pm,im),gm(`SIDEBAR_PDF_ASSET_EXTENSIONS`,mm,rm),gm(`FILE_ATTACHMENT_EXTENSIONS`,[...am],um),gm(`WIKI_EMBED_EXTENSIONS`,[...um],om);var _m=new Set(dm),vm=new Set(fm),ym=new Set(pm),bm=new Set(mm),xm=new Set(hm);gm(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...dm,...fm,...pm,...mm,...hm])],sm);var Sm=new Set([`base`,`canvas`]),Cm=new Set([`mmd`,`mermaid`]);function wm(e){let t=e.lastIndexOf(`.`);return t<0?!1:Cm.has(e.slice(t+1).toLowerCase())}var Tm=new Set([`excalidraw`]);function Em(e){let t=e.lastIndexOf(`.`);return t<0?!1:Tm.has(e.slice(t+1).toLowerCase())}function ene(e){return!wm(e)&&!Em(e)&&!Xp(e)}[...om,...Sm,...Cm,...Tm];function tne(e){let t=e.toLowerCase().replace(/^\./,``);return _m.has(t)?`image`:vm.has(t)?`video`:ym.has(t)?`audio`:bm.has(t)?`pdf`:xm.has(t)||Sm.has(t)?`text`:Cm.has(t)?`mermaid`:Tm.has(t)?`excalidraw`:Gp.has(t)?`text`:null}var Dm=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`ar`,`fr`,`bn`,`pt-BR`,`id`,`ur`,`ko`,`pl`],nne=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`fr`,`bn`,`pt-BR`,`id`,`ko`,`pl`],rne=new Set([`ar`,`ur`]),ine=Dm.filter(e=>!rne.has(e)),ane=[`markdownlint`,`frontmatter`,`okf`],one=[`missing`,`invalid`];function sne(e){return e.frontmatterScope!==void 0}[...ane];var cne=[`off`,`warning`,`error`],Om=`warning`,lne=[`error`,`warning`],km=[`base00`,`base01`,`base02`,`base03`,`base04`,`base05`,`base06`,`base07`,`base08`,`base09`,`base0A`,`base0B`,`base0C`,`base0D`,`base0E`,`base0F`],Am={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`},jm=/^#[0-9a-fA-F]{6}$/,une=/\P{White_Space}/u,Mm={graphical:3,text:4.5};function Nm(e){return une.test(e)}function Pm(e){return typeof e==`string`&&jm.test(e)}function Fm(e,t){let n=Um(e),r=Um(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Im(e,t){return t.reduce((t,n)=>Fm(e,n)>Fm(e,t)?n:t)}function Lm(e,t){let n=Im(e,t);return Fm(e,n)>=Mm.text?n:Im(e,[`#000000`,`#ffffff`])}function Rm(e,t,n){if(Fm(e,t)>=n)return t;let r=Im(e,[`#000000`,`#ffffff`]);for(let i=1;i<=255;i+=1){let a=Hm(t,r,i/255);if(Fm(e,a)>=n)return a}return console.warn(`[base16] No foreground reaches a ${n}:1 contrast ratio against ${e}; using the highest-contrast endpoint`),r}function zm(e){let t=e.palette,n=Hm(t.base02,e.variant===`dark`?`#ffffff`:`#000000`,.04);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-hover-foreground":Lm(t.base02,[t.base00,t.base05,t.base07]),"sidebar-hover-muted-foreground":Rm(t.base02,t.base04,Mm.text),"sidebar-hover-destructive-foreground":Rm(t.base02,t.base08,Mm.graphical),"sidebar-selected":n,"sidebar-selected-foreground":Lm(n,[t.base00,t.base05,t.base07]),"sidebar-selected-muted-foreground":Rm(n,t.base04,Mm.text),"sidebar-selected-destructive-foreground":Rm(n,t.base08,Mm.graphical),"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,...fne(t)}}var Bm={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`},dne=Object.keys(Bm);function fne(e){let t={};for(let n of dne)t[`ansi-${pne(n)}`]=e[Bm[n]];return t}function pne(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function Vm(e){return JSON.stringify(e).replace(/[\u007f-\u009f\u2028\u2029\ufffe\uffff]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}function mne(e){return`${[`system: "base16"`,`name: ${Vm(e.name)}`,...e.author?[`author: ${Vm(e.author)}`]:[],`variant: ${Vm(e.variant)}`,`palette:`,...km.map(t=>` ${t}: ${Vm(e.palette[t])}`)].join(`
176
176
  `)}\n`}function hne(e){let t;try{t=Bd(e,{schema:`failsafe`})}catch(e){let t=e?.linePos;return{ok:!1,error:{kind:`unparseable`,line:typeof t?.[0]?.line==`number`?t[0].line:void 0}}}if(!t||typeof t!=`object`||Array.isArray(t))return{ok:!1,error:{kind:`not-a-scheme`}};let n=t,r=n.palette,i=r&&typeof r==`object`&&!Array.isArray(r)?r:n,a={},o=[],s=[];for(let e of km){let t=i[e]??i[e.toLowerCase()];if(t==null){o.push(e);continue}let n=gne(t);if(!n){s.push(e);continue}a[e]=n}return o.length?{ok:!1,error:{kind:`missing-slots`,slots:o}}:s.length?{ok:!1,error:{kind:`bad-hex`,slots:s}}:typeof n.name==`string`&&!Nm(n.name)||typeof n.author==`string`&&!Nm(n.author)?{ok:!1,error:{kind:`not-a-scheme`}}:{ok:!0,scheme:{name:typeof n.name==`string`?n.name:`Imported`,author:typeof n.author==`string`?n.author:void 0,variant:n.variant===`light`||n.variant===`dark`?n.variant:_ne(a),palette:a}}}function gne(e){if(typeof e!=`string`)return null;let t=e.trim();return t.startsWith(`#`)||(t=`#${t}`),/^#[0-9a-fA-F]{3}$/.test(t)&&(t=`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`),jm.test(t)?t.toLowerCase():null}function Hm(e,t,n){let r=Pm(e)?e:`#000000`,i=Pm(t)?t:`#000000`,a=Math.min(1,Math.max(0,n)),o=`#`;for(let e=0;e<3;e++){let t=Number.parseInt(r.slice(1+e*2,3+e*2),16),n=Number.parseInt(i.slice(1+e*2,3+e*2),16);o+=Math.round(t+(n-t)*a).toString(16).padStart(2,`0`)}return o}function Um(e){let t=Pm(e)?e:`#000000`,n=e=>{let n=Number.parseInt(t.slice(1+e*2,3+e*2),16)/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*n(0)+.7152*n(1)+.0722*n(2)}function _ne(e){return Um(e.base00)<Um(e.base05)?`dark`:`light`}var vne={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`}},yne={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`}},bne={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`}},xne={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`}},Sne={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`}},Cne={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 Wm(e,t,n){return{id:e,label:t,kind:n.variant,scheme:n,toTokens:()=>zm(n)}}function Gm(e,t){return{id:e,label:t,kind:`system`}}var Km=[Gm(`default`,`Default`),Wm(`dracula`,`Dracula`,vne),Wm(`catppuccin-frappe`,`Catppuccin Frappé`,yne),Wm(`catppuccin-latte`,`Catppuccin Latte`,bne),Wm(`monokai`,`Monokai`,xne),Wm(`gruvbox`,`Gruvbox`,Sne),Wm(`solarized`,`Solarized`,Cne),Gm(`custom`,`Custom`)],wne=Km.map(e=>e.id),qm=/^[a-z0-9-]{1,32}$/,Tne=`saved-`,Jm=26,Ene=/\p{M}+/gu,Dne=/['\u2019\u02bc]+/gu,One=/[^a-z0-9]+/g;function kne(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,`0`)}function Ane(e){let t=e.trim();if(t.length===0)return{ok:!1,code:`empty`};let n=t.normalize(`NFKD`).replace(Ene,``).toLowerCase().replace(Dne,``).replace(One,`-`).replace(/^-+|-+$/g,``),r=kne(t),i=n.length===0?`theme-${r}`:n.length<=Jm?n:`${n.slice(0,Jm-r.length-1).replace(/-+$/g,``)}-${r}`,a=jne(i);if(!a.ok)throw Error(`Saved theme name derivation produced an invalid id`);return{ok:!0,name:t,stem:i,id:a.id}}function jne(e){if(e.length===0)return{ok:!1,code:`empty`};let t=Tne+e;return qm.test(t)?{ok:!0,id:t}:{ok:!1,code:/^[a-z0-9-]+$/.test(t)?`too-long`:`invalid-chars`}}function Mne(e){if(!qm.test(e)||!e.startsWith(`saved-`))return{ok:!1};let t=e.slice(6);return t.length===0?{ok:!1}:{ok:!0,stem:t}}var Nne=new Map(Km.map(e=>[e.id,e]));function Pne(e){return e&&Nne.get(e)||Km[0]}function Fne(e,t=Km){let n=new Set(t.map(e=>e.id)),r=e?.colorTheme,i=r&&n.has(r)?r:Km[0].id,a=e=>e===void 0?i:n.has(e)?e:Km[0].id;return{light:a(e?.colorThemeLight),dark:a(e?.colorThemeDark)}}function Ine(e,t){return e===`light`||e===`dark`?e:t?`dark`:`light`}function Lne(e,t,n){return`${e} {\n color-scheme: ${t};\n${Object.entries(n).map(([e,t])=>` --${e}: ${t};`).join(`
177
177
  `)}\n}`}var Rne=I({prefix:M().regex(/^[A-Za-z][A-Za-z0-9_-]*$/,{message:`prefix must start with a letter and use only letters, digits, _ and -`}),url:M().regex(/^https?:\/\/[^\s<>]*<num>[^\s<>]*$/,{message:`url must be an http or https URL containing <num>`})}).nullable().catch(null);function zne(){return Object.fromEntries(km.map(e=>[e,M().register(U,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${Am[e]}, as a #rrggbb hex string.`}).optional()]))}function Ym(){return wne.filter(e=>e!==`default`&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}var Xm=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),Zm=52428800,Qm=26214400,$m=12582912,eh=`https://api.openai.com/v1`,th=`text-embedding-3-small`,nh=96e3,rh=3e4,ih=2048,ah=16384e3,oh=6e5,sh=Object.freeze([`127.0.0.1`]),Bne=/^[1-9]\d*(s|m|h)$/,Vne=/^https?:\/\//,Hne=24550;function Une(e){let t;try{t=new URL(e)}catch{return!1}let n=t.hostname.toLowerCase();return n===`localhost`||n===`127.0.0.1`||n===`[::1]`}function Wne(e){let t;try{t=new URL(e)}catch{return`invalid-url`}return t.protocol===`https:`||t.protocol===`http:`&&Une(e)?null:`insecure-scheme`}function ch(e){let t=e.trim();return t===``?`./`:t}function Gne(e){let t=ch(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}var lh=L({content:L({dir:M().register(U,{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:M().register(U,{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(Gne,{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:L({theme:R([`light`,`dark`,`system`]).register(U,{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:R([`system`,...Dm]).register(U,{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:M().register(U,{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 ${Ym()}, 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(qm,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeDark:M().register(U,{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 ${Ym()}, 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(qm,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorTheme:M().register(U,{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(qm,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeEnabled:P().register(U,{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:L({name:M().register(U,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:M().register(U,{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:R([`dark`,`light`]).register(U,{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(),...zne()}).optional(),preview:L({autoOpen:P().register(U,{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:L({showHiddenFiles:P().register(U,{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:P().register(U,{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:P().register(U,{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:P().register(U,{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:P().register(U,{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:F(M()).register(U,{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:F(M()).register(U,{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:L({wordWrap:P().register(U,{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:P().register(U,{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:L({autoApproveOkTools:P().register(U,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools for agents launched from the built-in terminal (plus `ok open` on Claude) and for in-app Agents-panel chats with any ACP agent. Destructive tools (delete/move/share/install/import) still prompt. Per-machine personal preference (user scope)."}).default(!0),browserTools:P().register(U,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Give in-app Claude Code and Codex chats a browser they can drive (Playwright MCP, started through npx from OpenKnowledge's own folder with a fresh in-memory profile), so an agent can open pages, click, and take screenshots. Every browser action asks for approval, with no option to always allow it, unless the agent's own mode or permission settings skip approvals. Needs Google Chrome and Node.js. Off by default; takes effect for chats started after the change. Per-machine personal preference (user scope).`}).default(!1)}).default({autoApproveOkTools:!0,browserTools:!1}),autoSync:L({mode:R(vp).register(U,{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:P().register(U,{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:R(yp).register(U,{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:N().int().min(30).max(Tp).register(U,{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:N().int().min(30).max(Tp).register(U,{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:uo([P(),R(vp)]).register(U,{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}),git:L({hosts:_o(M(),Vp).register(U,{scope:`user`,agentSettable:!1,reload:`boot`,defaultScope:`user`,description:"Per-git-host declarations, keyed by hostname (for example ghes.example.com). Each entry says how OpenKnowledge should treat remotes on that host; today the only key an entry carries is `provider`. Hosts absent from this map are treated as generic git remotes. Per-machine (user scope, global.yml in the OpenKnowledge home folder); a value in a project's `.ok/config.yml` is ignored. Declarations take effect when OpenKnowledge next starts."}).default({}).catch({})}).default({hosts:{}}),terminal:L({enabled:P().register(U,{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:M().register(U,{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:L({enabled:P().register(U,{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:L({localSink:L({enabled:P().register(U,{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:L({maxBytes:N().register(U,{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(Zm)}).default({maxBytes:Zm}),logs:L({maxBytes:N().register(U,{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(Qm)}).default({maxBytes:Qm}),attributeDenylist:F(M()).register(U,{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([...Xm])}).default({enabled:!0,spans:{maxBytes:Zm},logs:{maxBytes:Qm},attributeDenylist:[...Xm]}),skillInstallReports:L({enabled:P().register(U,{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:Zm},logs:{maxBytes:Qm},attributeDenylist:[...Xm]},skillInstallReports:{enabled:!0}}),lossCapture:L({enabled:P().register(U,{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:N().register(U,{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($m)}).default({enabled:!0,maxBytes:$m}),bridge:L({backgroundThrottle:L({enabled:P().register(U,{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:L({enabled:P().register(U,{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:L({enabled:P().register(U,{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:L({enabled:P().register(U,{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:L({enabled:P().register(U,{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:L({enabled:P().register(U,{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:L({semantic:L({enabled:P().register(U,{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:M().register(U,{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` (stored in secrets.yml in the OpenKnowledge home folder); it is sent to whichever endpoint this names."}).default(eh),model:M().register(U,{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(th),dimensions:N().int().positive().register(U,{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:N().min(0).max(1).register(U,{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(),maxBatchSize:N().int().min(1).max(ih).register(U,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Maximum number of text chunks sent in one indexing request (1–2048, default 96). The ceiling follows OpenAI's input-array limit; other providers may impose different limits. Larger requests may still be split by the character budget. Changing it preserves cached vectors and document chunking; it applies to the next indexing pass. Invalid values use the default and are reported by ok config validate and server logs.`}).default(96).catch(96),maxBatchChars:N().int().min(1).max(ah).register(U,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Approximate cumulative character budget per indexing request (1–16384000, default 96000). A single chunk can exceed this budget. OpenAI separately caps total input at 300000 tokens per request; this character budget does not enforce that limit, and high values can produce rejected requests. Other providers have their own limits. Changing it preserves cached vectors and document chunking; it applies to the next indexing pass. Invalid values use the default and are reported by ok config validate and server logs.`}).default(nh).catch(nh),docTimeoutMs:N().int().min(1).max(oh).register(U,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Timeout in milliseconds for each indexing request attempt (1–600000, default 30000). A request can retry four times, and a failed grouped request can trigger individual-document requests. There is no total indexing-pass deadline: large timeouts can delay newly queued work for hours. The query timeout remains 8 seconds per attempt. Changing it preserves cached vectors and applies to the next indexing pass; an in-progress pass keeps its current timeout. Invalid values use the default and are reported by ok config validate and server logs.`}).default(rh).catch(rh)}).default({enabled:!1,baseUrl:eh,model:th,maxBatchSize:96,maxBatchChars:nh,docTimeoutMs:rh})}).default({semantic:{enabled:!1,baseUrl:eh,model:th,maxBatchSize:96,maxBatchChars:nh,docTimeoutMs:rh}}),contentRules:L({markdownlint:I({enabled:P().register(U,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:I({enabled:P().register(U,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:F(I({appliesTo:uo([M(),F(M())]).optional(),file:M(),enabled:P().optional()})).register(U,{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:I({enabled:P().register(U,{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:_o(M(),P()).register(U,{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:I({index:P().register(U,{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:L({links:R(cne).register(U,{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(Om),fileTreeIndicators:P().register(U,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0),suppressLogLinkAdvisories:P().register(U,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether unresolved links in the reserved change-history documents (lowercase-stemmed log.md / log.mdx at any depth, where the extension's case does not matter and the stem's does) are omitted from broken-link advisories: the Problems panel, file-tree indicators, source diagnostics, audits, and agent write/edit results. Default true. Raw link views still show them, and LOG.md, Log.md, and every other stem spelling are ordinary documents.`}).default(!0)}).default({links:Om,fileTreeIndicators:!0,suppressLogLinkAdvisories:!0}),autolinks:F(Rne).register(U,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Turn ticket references into links; today they apply to Agents-panel chat messages. Each entry pairs a `prefix` (for example `PRD-`) with a `url` template containing `<num>` (for example `https://linear.app/inkeep/issue/PRD-<num>`); the prefix followed by digits links to that URL with the digits in place of `<num>`. Matching is case-sensitive. An invalid entry is skipped with a warning and the others still apply. Shared with collaborators (project scope, `.ok/config.yml`)."}).default([]).catch([]),linkPreviews:L({enabled:P().register(U,{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, and a status card when you hover a GitHub pull request or issue link in an agent chat. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata, and hovering a GitHub reference asks the GitHub host's API for it, signed in as you when a GitHub sign-in is available — 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:L({port:N().int().min(1).max(65535).register(U,{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:F(M().min(1)).min(1).register(U,{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([...sh]),externalUrl:Pa({protocol:/^https?$/}).regex(Vne).register(U,{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:P().register(U,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Exposure consent interlock. A non-loopback server.bind without allowExternal: true is refused at boot with a one-line fix; a server.externalUrl without it boots (a committed externalUrl never arms exposure on clones — but it is project-scoped, so its host still joins the Host/Origin allowlists there), but requests carrying forwarding headers (X-Forwarded-For etc.) are refused until consent is given — proxy tolerance requires both keys. Default off. The server has no authentication of its own, so only consent behind an authenticating edge. Per-machine (project-local) — consent never travels via git, clone, or share; containers consent via the environment instead.`}).default(!1),openBrowser:P().register(U,{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:uo([z(`off`),M().regex(Bne)]).register(U,{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:[...sh],allowExternal:!1})}),Kne=`open-knowledge-config`;function uh(e,t,n){let r=c.getTracer(Kne),i=t?{attributes:t}:{};return r.startActiveSpan(e,i,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:s.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function dh(e,t){let n=c.getActiveSpan();n&&n.addEvent(e,t)}function qne(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 fh(e,t){let n=e;for(let e of t){n=qne(n);let t=n?._zod?.def?.shape;if(!t){let e=n?._zod?.def;if(e?.type!==`record`)return;n=e.valueType;continue}if(n=t[String(e)],n===void 0)return}return n}function ph(e,t){let n=fh(e,t);if(n!==void 0)return Np(n)}function Jne(e,t){return e===`either`?!0:e===t}function Yne(e,t){let n=null;function r(e,i){if(n!==null||e===void 0)return;let a=ph(lh,i);if(a?.scope!==void 0&&!Jne(a.scope,t)){n={code:`SCOPE_VIOLATION`,path:i,expectedScope:a.scope,actualScope:t};return}if(typeof e==`object`&&e&&!Array.isArray(e)){for(let[t,a]of Object.entries(e))if(r(a,[...i,t]),n!==null)return;return}}for(let[t,i]of Object.entries(e))if(r(i,[t]),n!==null)break;return n}var mh=I({file:M(),line:N().int().min(1),column:N().int().min(1),snippet:M().optional()}),Xne=I({path:F(uo([M(),N()])),message:M(),issueCode:M(),params:_o(M(),ro()).optional(),source:mh.optional()}),Zne=R([`user`,`project`,`project-local`,`either`]),hh=R([`user`,`project`,`project-local`]),gh=I({code:z(`YAML_PARSE`),detail:M()}),_h=I({code:z(`UNREADABLE`),detail:M()}),vh=I({code:z(`SCHEMA_INVALID`),issues:F(Xne)}),yh=I({code:z(`REMOVED_KEY`),path:F(M()),redirect:M(),source:mh.optional()}),bh=I({path:F(M()),message:M(),source:mh.omit({snippet:!0}).optional()}),xh=I({code:z(`VALUE_FALLBACK`),issues:F(bh)}),Sh=po(`code`,[gh,vh,_h,I({code:z(`SCOPE_VIOLATION`),path:F(M()),expectedScope:Zne,actualScope:hh}),I({code:z(`NOT_AGENT_SETTABLE`),path:F(M())}),I({code:z(`MIXED_SCOPE`),paths:F(I({path:F(M()),scope:hh}))}),yh,I({code:z(`NOT_SYNCED`),detail:M()}),I({code:z(`WRITE_ERROR`),detail:M()}),I({code:z(`OKIGNORE_INVALID`),detail:M(),lineNumber:N().int().min(1).optional()}),I({code:z(`UNKNOWN`),message:M().optional()})]);po(`code`,[yh,xh,gh,vh,_h]),I({diagnostics:F(po(`code`,[I({code:z(`VALUE_FALLBACK`),scope:hh,file:M(),issues:F(bh.omit({source:!0}).extend({line:mh.shape.line.optional(),column:mh.shape.column.optional()}))}),I({code:z(`REMOVED_KEY`),scope:hh,file:M(),path:F(M()),redirect:M()}),I({code:z(`YAML_PARSE`),scope:hh,file:M()}),I({code:z(`SCHEMA_INVALID`),scope:hh,file:M()}),I({code:z(`UNREADABLE`),scope:hh,file:M()})]))});var Qne=new Set(Sh.options.map(e=>e.shape.code.value)),$ne=uo([Sh,L({code:M(),message:M().optional()})]);function Ch(e){return Qne.has(e.code)}function wh(e){switch(e){case`user`:return qs(`global.yml`);case`project`:return`.ok/config.yml`;case`project-local`:return`.ok/local/config.yml`;case`either`:return`.ok/config.yml or ${qs(`global.yml`)}`}}function ere(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 tre(e){if(e.code===`VALUE_FALLBACK`){let t=xh.safeParse(e);if(t.success){if(t.data.issues.length===0)return`Configuration loaded with defaults for invalid settings.`;let e=[`Configuration loaded with defaults for invalid settings:`];for(let n of t.data.issues)n.source&&e.push(` ${n.source.file}:${n.source.line}:${n.source.column}`),e.push(` ${n.path.join(`.`)}: ${n.message}`);return e.join(`
178
178
  `)}}if(!Ch(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(`
@@ -515,7 +515,7 @@ $2`).split(`
515
515
  `)}function J2(e,t,n,r,i,a,o){if(e.kind===`lines`)return W2(e.startLine,e.endLine,n);if(e.kind===`anchor`)return U2(e.markdown,n);let s=H2(e.markdown);return y2(q2(t,``,s,r,i),a,o)<=b2(o,g2)?s:U2(e.markdown,n)}function Y2(e,t,n,r){let{target:i}=e,a=e.transport??`url`,o=i2(e.docRelativePath),s=`Let's work on @${o} using OpenKnowledge.`,c=J2(t,s,o,n,r,i,a);return q2(s,I2(e.instruction,i,e=>q2(s,e,c,n,r),a),c,n,r)}function X2(e){let{target:t}=e,n=e.autoOpen?B2:``,r=G2(e.mentions);if(e.scope===`doc`&&e.selection!==void 0)return Y2(e,e.selection,r,n);let i=K2(e);return q2(i,I2(e.instruction,t,e=>q2(i,e,``,r,n),e.transport??`url`),``,r,n)}function Z2(e){let t=i2(e.relativePath),n=e.ruleAlias===void 0?`${e.source}/${e.code}`:`${e.source}/${e.code} (${e.ruleAlias})`,r=[`Fix this lint problem in @${t} using OpenKnowledge.`,``,`Problem: ${n} at line ${e.line}, column ${e.column}:`,``,V2(e.message.trim())],i=e.lineText??``;if(i.trim()!==``){let t=T2(i);r.push(``,`Line ${e.line} reads:`,``,t,i,t)}return r.push(``,`Edit @${t} via the OpenKnowledge MCP server, then re-lint it to confirm the problem is resolved.`),r.join(`
516
516
  `)}function Q2(e){if(e===null)return[`Fix every problem across this project's documents using OpenKnowledge.`,``,"Run the `audit` tool for the current list of lint violations and broken links, then work file by file — the `lint` tool with `fix: true` clears one document's mechanically-fixable problems at a time — and re-audit until it reports no problems."].join(`
517
517
  `);let t=i2(e);return[`Fix every problem in @${t} using OpenKnowledge.`,``,`Run the \`audit\` tool scoped to it for the current list of lint violations and broken links, then fix each one — the \`lint\` tool with \`fix: true\` clears the mechanically-fixable ones — and re-audit @${t} until it reports no problems.`].join(`
518
- `)}function $2(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}}var e4=new Set([`opencode.json`]),t4=/^\.[A-Za-z0-9_-]+\/skills\/[^/]+\/.+$/;function n4(e){return t4.test(e)}function r4(e){return n4(e)?!1:e.split(`/`).some(e=>e.startsWith(`.`))?!0:e4.has(e.slice(e.lastIndexOf(`/`)+1))}function i4(e,t){let n=$2(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}var a4=M().superRefine(i4).optional(),o4=M().superRefine(i4),s4={agentId:M().optional(),agentName:M().optional(),colorSeed:M().optional(),clientName:M().optional(),clientVersion:M().optional(),label:M().optional()},c4=M().optional(),l4=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;po(`kind`,[I({kind:z(`doc`),docPath:M().min(1)}).loose(),I({kind:z(`folder`),folderPath:M()}).loose()]);var u4=R([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`unsupported-share-url`]),d4=R([`current`,`stale`,`absent`,`empty`]),f4=po(`ok`,[I({ok:z(!0),shareUrl:M().min(1),sharedUrl:M().min(1),branch:M().min(1),freshness:d4.optional().catch(void 0)}).loose(),I({ok:z(!1),error:u4,branch:M().min(1).optional()}).loose()]),p4=R([`user`,`org`]),m4=I({login:M().min(1),kind:p4,avatarUrl:M().optional()}).loose(),h4=R([`auth-required`,`network`]),g4=po(`ok`,[I({ok:z(!0),owners:F(m4)}).loose(),I({ok:z(!1),error:h4}).loose()]),_4=po(`ok`,[I({ok:z(!0),available:P()}).loose(),I({ok:z(!1),error:h4}).loose()]),v4=R([`public`,`private`]);I({owner:M().min(1),name:M().min(1),visibility:v4,description:M().optional()}).loose();var y4=R([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),b4=po(`ok`,[I({ok:z(!0),ownerLogin:M().min(1),repoName:M().min(1),cloneUrl:M().min(1),defaultBranch:M().min(1)}).loose(),I({ok:z(!1),error:y4}).loose()]);function x4(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}var S4=e=>e.refine(x4,`invalid branch name`),C4={shareTargetExists:P(),dirtyConflicts:I({conflicts:P(),files:F(M().min(1))}).loose(),branchIsLocal:P(),shareTargetOnOriginBranch:P().optional()};po(`detached`,[I({detached:z(!1),currentBranch:M().min(1).nullable(),currentHeadSha:to(),...C4}).loose(),I({detached:z(!0),currentBranch:to(),currentHeadSha:M().min(1),...C4}).loose()]),I({branch:S4(M().min(1)),principalId:M().optional(),fastForward:P().optional()}).loose();var w4=R([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]);po(`ok`,[I({ok:z(!0)}).loose(),I({ok:z(!1),reason:w4,files:F(M().min(1)).optional(),otherWorktreePath:M().min(1).optional()}).loose()]),R([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]),I({branch:S4(M().min(1)),path:M(),kind:R([`doc`,`folder`]),contentRootDepth:N().int().min(1).max(65535).optional()}).loose(),po(`verdict`,[I({verdict:z(`on-origin`)}).loose(),I({verdict:z(`renamed`),renamedTo:M().min(1)}).loose(),I({verdict:z(`deleted`)}).loose(),I({verdict:z(`never-on-branch`)}).loose(),I({verdict:z(`changed-locally`)}).loose(),I({verdict:z(`unknown`)}).loose()]).catch({verdict:`unknown`});var T4=I({startedAt:M().min(1),httpListenMs:N().nonnegative().optional(),seedWalkMs:N().nonnegative().optional(),indexesMs:N().nonnegative().optional(),readyMs:N().nonnegative().optional(),fileCount:N().nonnegative().optional()}),E4=I({serverInstanceId:M().min(1),currentBranch:M().min(1).optional(),currentDiskAckSVs:_o(M().min(1),M().min(1)).optional(),boot:T4.optional(),collabClients:N().int().nonnegative().optional()}).loose(),D4=I({id:M().min(1),display_name:M().min(1),display_email:M(),source:R([`git-config`,`synthesized`]),created_at:M().min(1)}).loose();I({collabUrl:M().nullable(),previewUrl:M().nullable(),port:N(),singleFile:P().default(!1)}).loose();var O4=R(`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:symlink-refused.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:unsupported-media-type.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:stale-external-write.urn:ok:error:store-refused.urn:ok:error:doc-removed.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:non-github-origin.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:concurrent-overwrite-refused.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(`.`)),k4=I({type:O4,title:M().min(1),status:N().int().min(400).max(599),instance:M().regex(l4,`instance must be urn:uuid:<uuid>`).optional(),detail:M().optional()}).loose();I({parentDocName:M().min(1),placement:R([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:M().min(1).optional(),agentName:M().min(1).optional()}).loose();var A4=I({src:M().min(1),path:M().min(1).optional(),deduped:P().optional()}).loose();I({url:M().min(1),dir:M().min(1),branch:M().min(1).refine(x4,`invalid branch name`).optional()}).loose(),I({type:z(`error`),problem:k4}).loose();function j4(e){let t=e??(typeof navigator>`u`?void 0:navigator);return t===void 0?[]:t.languages!==void 0&&t.languages.length>0?Eh(t.languages):t.language===void 0?[]:Eh([t.language])}var M4={en:`ltr`,"zh-Hans":`ltr`,"zh-Hant":`ltr`,hi:`ltr`,es:`ltr`,ar:`rtl`,fr:`ltr`,bn:`ltr`,"pt-BR":`ltr`,id:`ltr`,ur:`rtl`,ko:`ltr`};function N4(e){let t=new Intl.Locale(e).getTextInfo?.().direction;return t===`rtl`||t===`ltr`?t:M4[e]}function P4(e,t){let n=t.map(e=>[Dh(e),e]);for(let t of e){let e=Dh(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function F4(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=P4([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=P4(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}var I4=`extra/screenshot.png`,L4=`extra/attachments/`,R4=3145728,z4=[`image/png`,`image/jpeg`,`image/webp`],B4={"image/png":`png`,"image/jpeg":`jpg`,"image/webp":`webp`};function moe(e){return e.startsWith(L4)}var hoe=`extra/agent-chat/`;function goe(e){return e.startsWith(hoe)}var _oe=`extra/`;function voe(e){return!e.startsWith(_oe)||!e.endsWith(`.dmp`)?!1:!e.slice(6).includes(`/`)}function V4(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===45||e===95}var yoe=8,H4=`eyJ`;function boe(e){if(!e.includes(H4))return null;let t=[],n=[];for(let r=0;r<e.length;r+=1)if(V4(e.charCodeAt(r))){for(t.push(r);r<e.length&&V4(e.charCodeAt(r));)r+=1;n.push(r)}let r=[];for(let t=e.indexOf(H4);t!==-1;t=e.indexOf(H4,t+1))r.push(t);let i=r=>r+1<t.length&&e[n[r]??-1]===`.`&&t[r+1]===(n[r]??-1)+1,a=[],o=0,s=0;for(let c=0;c+2<t.length;c+=1){let l=t[c]??0,u=n[c]??0;for(;s<r.length&&(r[s]??0)<l;)s+=1;if(!i(c)||!i(c+1))continue;let d=t[c+1]??0,f=n[c+1]??0,p=(n[c+2]??0)-(t[c+2]??0);if(!e.startsWith(H4,d)||f-d<11||p<yoe)continue;let m=r[s];m===void 0||m>=u||u-m<11||(a.push(e.slice(o,m),`[REDACTED-JWT]`),o=n[c+2]??e.length,c+=2)}return a.length===0?null:(a.push(e.slice(o)),a.join(``))}var xoe=/(?:\b|(?<=(?:\[|\u009b)[0-?]*[ -/]*[@-~]))/.source;function U4(e){return RegExp(`${xoe}${e.source}`,`g`)}var W4=[{name:`github-pat`,regex:/(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:U4(/(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/),replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/sk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:U4(/sk-[A-Za-z0-9]{20,}\b/),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`,redact:boe},{name:`url-credentials`,regex:/:\/\/[^/\s:@"]+:[^/\s:@"]+@/g,replacement:`://[REDACTED]@`},{name:`github-pat-fine-grained`,regex:/github_pat_[0-9A-Za-z_]{20,}/g,replacement:`[REDACTED-GH-PAT]`},{name:`openai-key-modern`,regex:U4(/sk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/),replacement:`[REDACTED-OPENAI]`},{name:`slack-token`,regex:/xox[a-z]-[A-Za-z0-9-]{10,}/g,replacement:`[REDACTED-SLACK]`},{name:`google-api-key`,regex:/AIza[0-9A-Za-z_-]{35}/g,replacement:`[REDACTED-GOOGLE]`},{name:`stripe-secret-key`,regex:U4(/(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/),replacement:`[REDACTED-STRIPE]`},{name:`gitlab-pat`,regex:/glpat-[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:`~`}];W4.map(e=>e.name);function Soe(e){let t=new Set,n=0;return{redacted:e.split(`
518
+ `)}function $2(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}}var e4=new Set([`opencode.json`]),t4=/^\.[A-Za-z0-9_-]+\/skills\/[^/]+\/.+$/;function n4(e){return t4.test(e)}function r4(e){return n4(e)?!1:e.split(`/`).some(e=>e.startsWith(`.`))?!0:e4.has(e.slice(e.lastIndexOf(`/`)+1))}function i4(e,t){let n=$2(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}var a4=M().superRefine(i4).optional(),o4=M().superRefine(i4),s4={agentId:M().optional(),agentName:M().optional(),colorSeed:M().optional(),clientName:M().optional(),clientVersion:M().optional(),label:M().optional()},c4=M().optional(),l4=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;po(`kind`,[I({kind:z(`doc`),docPath:M().min(1)}).loose(),I({kind:z(`folder`),folderPath:M()}).loose()]);var u4=R([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`unsupported-share-url`]),d4=R([`current`,`stale`,`absent`,`empty`]),f4=po(`ok`,[I({ok:z(!0),shareUrl:M().min(1),sharedUrl:M().min(1),branch:M().min(1),freshness:d4.optional().catch(void 0)}).loose(),I({ok:z(!1),error:u4,branch:M().min(1).optional()}).loose()]),p4=R([`user`,`org`]),m4=I({login:M().min(1),kind:p4,avatarUrl:M().optional()}).loose(),h4=R([`auth-required`,`network`]),g4=po(`ok`,[I({ok:z(!0),owners:F(m4)}).loose(),I({ok:z(!1),error:h4}).loose()]),_4=po(`ok`,[I({ok:z(!0),available:P()}).loose(),I({ok:z(!1),error:h4}).loose()]),v4=R([`public`,`private`]);I({owner:M().min(1),name:M().min(1),visibility:v4,description:M().optional()}).loose();var y4=R([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),b4=po(`ok`,[I({ok:z(!0),ownerLogin:M().min(1),repoName:M().min(1),cloneUrl:M().min(1),defaultBranch:M().min(1)}).loose(),I({ok:z(!1),error:y4}).loose()]);function x4(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}var S4=e=>e.refine(x4,`invalid branch name`),C4={shareTargetExists:P(),dirtyConflicts:I({conflicts:P(),files:F(M().min(1))}).loose(),branchIsLocal:P(),shareTargetOnOriginBranch:P().optional()};po(`detached`,[I({detached:z(!1),currentBranch:M().min(1).nullable(),currentHeadSha:to(),...C4}).loose(),I({detached:z(!0),currentBranch:to(),currentHeadSha:M().min(1),...C4}).loose()]),I({branch:S4(M().min(1)),principalId:M().optional(),fastForward:P().optional()}).loose();var w4=R([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]);po(`ok`,[I({ok:z(!0)}).loose(),I({ok:z(!1),reason:w4,files:F(M().min(1)).optional(),otherWorktreePath:M().min(1).optional()}).loose()]),R([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]),I({branch:S4(M().min(1)),path:M(),kind:R([`doc`,`folder`]),contentRootDepth:N().int().min(1).max(65535).optional()}).loose(),po(`verdict`,[I({verdict:z(`on-origin`)}).loose(),I({verdict:z(`renamed`),renamedTo:M().min(1)}).loose(),I({verdict:z(`deleted`)}).loose(),I({verdict:z(`never-on-branch`)}).loose(),I({verdict:z(`changed-locally`)}).loose(),I({verdict:z(`unknown`)}).loose()]).catch({verdict:`unknown`});var T4=I({startedAt:M().min(1),httpListenMs:N().nonnegative().optional(),seedWalkMs:N().nonnegative().optional(),indexesMs:N().nonnegative().optional(),readyMs:N().nonnegative().optional(),fileCount:N().nonnegative().optional()}),E4=I({serverInstanceId:M().min(1),currentBranch:M().min(1).optional(),currentDiskAckSVs:_o(M().min(1),M().min(1)).optional(),boot:T4.optional(),collabClients:N().int().nonnegative().optional()}).loose(),D4=I({id:M().min(1),display_name:M().min(1),display_email:M(),source:R([`git-config`,`synthesized`]),created_at:M().min(1)}).loose();I({collabUrl:M().nullable(),previewUrl:M().nullable(),port:N(),singleFile:P().default(!1)}).loose();var O4=R(`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:symlink-refused.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:unsupported-media-type.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:stale-external-write.urn:ok:error:store-refused.urn:ok:error:doc-removed.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:non-github-origin.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:concurrent-overwrite-refused.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(`.`)),k4=I({type:O4,title:M().min(1),status:N().int().min(400).max(599),instance:M().regex(l4,`instance must be urn:uuid:<uuid>`).optional(),detail:M().optional()}).loose();I({parentDocName:M().min(1),placement:R([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:M().min(1).optional(),agentName:M().min(1).optional()}).loose();var A4=I({src:M().min(1),path:M().min(1).optional(),deduped:P().optional()}).loose();I({url:M().min(1),dir:M().min(1),branch:M().min(1).refine(x4,`invalid branch name`).optional()}).loose(),I({type:z(`error`),problem:k4}).loose();function j4(e){let t=e??(typeof navigator>`u`?void 0:navigator);return t===void 0?[]:t.languages!==void 0&&t.languages.length>0?Eh(t.languages):t.language===void 0?[]:Eh([t.language])}var M4={en:`ltr`,"zh-Hans":`ltr`,"zh-Hant":`ltr`,hi:`ltr`,es:`ltr`,ar:`rtl`,fr:`ltr`,bn:`ltr`,"pt-BR":`ltr`,id:`ltr`,ur:`rtl`,ko:`ltr`,pl:`ltr`};function N4(e){let t=new Intl.Locale(e).getTextInfo?.().direction;return t===`rtl`||t===`ltr`?t:M4[e]}function P4(e,t){let n=t.map(e=>[Dh(e),e]);for(let t of e){let e=Dh(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function F4(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=P4([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=P4(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}var I4=`extra/screenshot.png`,L4=`extra/attachments/`,R4=3145728,z4=[`image/png`,`image/jpeg`,`image/webp`],B4={"image/png":`png`,"image/jpeg":`jpg`,"image/webp":`webp`};function moe(e){return e.startsWith(L4)}var hoe=`extra/agent-chat/`;function goe(e){return e.startsWith(hoe)}var _oe=`extra/`;function voe(e){return!e.startsWith(_oe)||!e.endsWith(`.dmp`)?!1:!e.slice(6).includes(`/`)}function V4(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===45||e===95}var yoe=8,H4=`eyJ`;function boe(e){if(!e.includes(H4))return null;let t=[],n=[];for(let r=0;r<e.length;r+=1)if(V4(e.charCodeAt(r))){for(t.push(r);r<e.length&&V4(e.charCodeAt(r));)r+=1;n.push(r)}let r=[];for(let t=e.indexOf(H4);t!==-1;t=e.indexOf(H4,t+1))r.push(t);let i=r=>r+1<t.length&&e[n[r]??-1]===`.`&&t[r+1]===(n[r]??-1)+1,a=[],o=0,s=0;for(let c=0;c+2<t.length;c+=1){let l=t[c]??0,u=n[c]??0;for(;s<r.length&&(r[s]??0)<l;)s+=1;if(!i(c)||!i(c+1))continue;let d=t[c+1]??0,f=n[c+1]??0,p=(n[c+2]??0)-(t[c+2]??0);if(!e.startsWith(H4,d)||f-d<11||p<yoe)continue;let m=r[s];m===void 0||m>=u||u-m<11||(a.push(e.slice(o,m),`[REDACTED-JWT]`),o=n[c+2]??e.length,c+=2)}return a.length===0?null:(a.push(e.slice(o)),a.join(``))}var xoe=/(?:\b|(?<=(?:\[|\u009b)[0-?]*[ -/]*[@-~]))/.source;function U4(e){return RegExp(`${xoe}${e.source}`,`g`)}var W4=[{name:`github-pat`,regex:/(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:U4(/(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/),replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/sk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:U4(/sk-[A-Za-z0-9]{20,}\b/),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`,redact:boe},{name:`url-credentials`,regex:/:\/\/[^/\s:@"]+:[^/\s:@"]+@/g,replacement:`://[REDACTED]@`},{name:`github-pat-fine-grained`,regex:/github_pat_[0-9A-Za-z_]{20,}/g,replacement:`[REDACTED-GH-PAT]`},{name:`openai-key-modern`,regex:U4(/sk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/),replacement:`[REDACTED-OPENAI]`},{name:`slack-token`,regex:/xox[a-z]-[A-Za-z0-9-]{10,}/g,replacement:`[REDACTED-SLACK]`},{name:`google-api-key`,regex:/AIza[0-9A-Za-z_-]{35}/g,replacement:`[REDACTED-GOOGLE]`},{name:`stripe-secret-key`,regex:U4(/(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/),replacement:`[REDACTED-STRIPE]`},{name:`gitlab-pat`,regex:/glpat-[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:`~`}];W4.map(e=>e.name);function Soe(e){let t=new Set,n=0;return{redacted:e.split(`
519
519
  `).map(e=>{let r=e,i=!1;for(let e of W4){if(`redact`in e){let n=e.redact(r);if(n===null)continue;t.add(e.name),i=!0,r=n;continue}let{name:n,regex:a,replacement:o}=e;a.lastIndex=0,a.test(r)&&(t.add(n),i=!0,a.lastIndex=0,r=r.replace(a,o))}return i&&n++,r}).join(`
520
520
  `),patterns:[...t],lineCount:n}}function G4(e){return Soe(e).redacted}var K4=8192,Coe=32768,woe=`…[truncated]`,q4=[`level`,`time`,`pid`,`hostname`,`msg`,`name`,`runtime`,`subsystem`,`trace_id`,`span_id`,`trace_flags`];function Toe(e){let t=G4(e).trim();if(t.length===0||t[0]!==`{`)return null;let n;try{n=JSON.parse(t)}catch{return null}if(typeof n!=`object`||!n||Array.isArray(n))return null;let r=n;for(let e of q4)delete r[e];return{event:typeof r.event==`string`?r.event:void 0,fields:r}}function Eoe(e){return e.length<=8192?e:`${e.slice(0,8180)}${woe}`}function Doe(e){return e.includes("`")?`~`:"`"}function J4(e,t,n=3){let r=RegExp(`^ {0,3}(\\${e}+)[ \\t]*$`),i=Math.max(3,n);for(let e of t.split(`
521
521
  `)){let t=r.exec(e);t&&t[1].length>=i&&(i=t[1].length+1)}return i}var Y4=/notionvc:/i,Ooe=()=>e=>{X4(e)&&(Z4(e),Q4(e))};function X4(e){if(!(`children`in e)||!Array.isArray(e.children))return!1;for(let t of e.children){if(t.type===`comment`){let e=String(t.value??``);if(Y4.test(e))return!0}if(t.type===`element`&&X4(t))return!0}return!1}function Z4(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&Z4(t);let t=[];for(let n of e.children){if(n.type!==`text`){t.push(n);continue}let e=String(n.value??``);if(!e.includes(`
@@ -1 +1 @@
1
- import{Zs as e}from"./dist-DILeGueK.js";function t(t){return e.includes(t)}function n(e){if(e.startsWith(b)||e.startsWith(w)||e.startsWith(T)||e.startsWith(D)||!e.startsWith(`#/`))return null;let t=e.slice(2),n=x(t),r=n>=0?t.slice(0,n):t;if(!r)return null;try{return r.split(`/`).map(decodeURIComponent).join(`/`)}catch{return r}}function r(e){if(e.startsWith(b)||!e.startsWith(`#/`))return null;let t=e.slice(2),n=t.indexOf(`#`);if(n<0)return null;let r=t.slice(n+1);if(!r)return null;try{return decodeURIComponent(r)}catch{return r}}var i=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;function a(e){return encodeURIComponent(e.replace(i,`�`))}function o(e){return e.split(`/`).map(a).join(`/`)}function s(e,t){let n=`#/${o(e)}`;return t?`${n}#${a(t)}`:n}function c(e,t){return e===t||l(e)===l(t)}function l(e){try{return decodeURIComponent(e)}catch{return e}}var u=`__okHashHistoryEntry`;function d(e){return{...typeof e==`object`&&e?e:{},[u]:!0}}function f(e){return typeof e==`object`&&!!e&&e[u]===!0}function p(){f(window.history.state)||window.history.replaceState(d(window.history.state),``)}function m(e){let{pathname:t,search:n}=window.location;window.history.replaceState(d(window.history.state),``,`${t}${n}${e}`)}function h(e){if(c(window.location.hash,e))return;let{pathname:t,search:n}=window.location;window.history.pushState(d(window.history.state),``,`${t}${n}${e}`)}function g(e){let t=e.toLowerCase();return t.endsWith(`.mdx`)?e.slice(0,-4):t.endsWith(`.md`)?e.slice(0,-3):e}function _(e,t){let n=e.replace(/^\/+|\/+$/g,``),r=n?`#/${o(n)}/`:`#/`;return t?`${r}#${a(t)}`:r}function v(e,t,n){if(e===`folder`)return _(t);let r=`#/${a(t)}`;return n==null||n===``?r:`${r}?branch=${a(n)}`}function y(e){if(e===`#/`)return!0;if(!e.startsWith(`#/`))return!1;let t=e.slice(2);return t.length>0&&t[0]===`?`}var b=`#/__asset__/`;function x(e){let t=e.indexOf(`?`),n=e.indexOf(`#`);return t<0?n:n<0?t:Math.min(t,n)}function S(e){if(!e.startsWith(b))return null;let t=e.slice(12);if(!t)return null;try{return t.split(`/`).map(decodeURIComponent).join(`/`)}catch{return t}}function C(e){return`${b}${o(e)}`}var w=`#/__skill-file__/`,T=`#/__skills__`;function E(e){return e===T||e.startsWith(`${T}/`)}var D=`#/__skill-preview__/`,O=[`explore`,`detected`,`builtin`,`foreign`,`linked`];function k(e){return e!==void 0&&O.includes(e)}var A=`project`;function j(e){return[e.flavor,e.source,e.name,e.subtitle,e.level??A].map(a).join(`/`)}function M(e){if(!e)return null;let n;try{n=e.split(`/`).map(decodeURIComponent)}catch{return null}if(n.length<4||n.length>6)return null;let[r,i,a,o,s,c]=n;return!k(r)||!i||!a?null:{flavor:r,source:i,name:a,subtitle:o??``,...s&&t(s)?{level:s}:{},...c?{path:c}:{}}}function N(e){let t=j(e);return e.path&&(t+=`/${a(e.path)}`),`${D}${t}`}function P(e){return e.startsWith(D)?M(e.slice(20)):null}var F=`:`;function I(e){let t=e.host===void 0?e.name:`${e.name}${F}${e.host}`;return`${w}${[e.scope,t].map(a).join(`/`)}/${o(e.path)}`}function L(e){if(!e.startsWith(w))return null;let n=e.slice(17);if(!n)return null;let r;try{r=n.split(`/`).map(decodeURIComponent)}catch{return null}if(r.length<3)return null;let[i,a,...o]=r,s=o.join(`/`);if(!i||!a||!s||!t(i))return null;let c=a.indexOf(F),l=c===-1?a:a.slice(0,c),u=c===-1?void 0:a.slice(c+1);return l?{scope:i,name:l,path:s,...u?{host:u}:{}}:null}var R=/\.(md|mdx)$/i;function z(e){return e.trim().replace(/^\.\/+/,``).replace(/^\/+/,``)}function B(e){return z(e).replace(R,``)}function V(e){let t=z(e);return t?R.test(t)?t:`${t}.md`:`untitled.md`}function H(e){let t=B(e),n=t.lastIndexOf(`/`);return{initialDir:n>0?t.slice(0,n):``,suggestedName:`${n>=0?t.slice(n+1):t||`untitled`}.md`}}export{P as C,L as S,f as _,S as a,h as b,v as c,C as d,s as f,y as g,N as h,r as i,j as l,I as m,V as n,M as o,_ as p,B as r,n as s,H as t,g as u,c as v,E as w,m as x,p as y};
1
+ import{Zs as e}from"./dist-DTxb76k4.js";function t(t){return e.includes(t)}function n(e){if(e.startsWith(b)||e.startsWith(w)||e.startsWith(T)||e.startsWith(D)||!e.startsWith(`#/`))return null;let t=e.slice(2),n=x(t),r=n>=0?t.slice(0,n):t;if(!r)return null;try{return r.split(`/`).map(decodeURIComponent).join(`/`)}catch{return r}}function r(e){if(e.startsWith(b)||!e.startsWith(`#/`))return null;let t=e.slice(2),n=t.indexOf(`#`);if(n<0)return null;let r=t.slice(n+1);if(!r)return null;try{return decodeURIComponent(r)}catch{return r}}var i=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;function a(e){return encodeURIComponent(e.replace(i,`�`))}function o(e){return e.split(`/`).map(a).join(`/`)}function s(e,t){let n=`#/${o(e)}`;return t?`${n}#${a(t)}`:n}function c(e,t){return e===t||l(e)===l(t)}function l(e){try{return decodeURIComponent(e)}catch{return e}}var u=`__okHashHistoryEntry`;function d(e){return{...typeof e==`object`&&e?e:{},[u]:!0}}function f(e){return typeof e==`object`&&!!e&&e[u]===!0}function p(){f(window.history.state)||window.history.replaceState(d(window.history.state),``)}function m(e){let{pathname:t,search:n}=window.location;window.history.replaceState(d(window.history.state),``,`${t}${n}${e}`)}function h(e){if(c(window.location.hash,e))return;let{pathname:t,search:n}=window.location;window.history.pushState(d(window.history.state),``,`${t}${n}${e}`)}function g(e){let t=e.toLowerCase();return t.endsWith(`.mdx`)?e.slice(0,-4):t.endsWith(`.md`)?e.slice(0,-3):e}function _(e,t){let n=e.replace(/^\/+|\/+$/g,``),r=n?`#/${o(n)}/`:`#/`;return t?`${r}#${a(t)}`:r}function v(e,t,n){if(e===`folder`)return _(t);let r=`#/${a(t)}`;return n==null||n===``?r:`${r}?branch=${a(n)}`}function y(e){if(e===`#/`)return!0;if(!e.startsWith(`#/`))return!1;let t=e.slice(2);return t.length>0&&t[0]===`?`}var b=`#/__asset__/`;function x(e){let t=e.indexOf(`?`),n=e.indexOf(`#`);return t<0?n:n<0?t:Math.min(t,n)}function S(e){if(!e.startsWith(b))return null;let t=e.slice(12);if(!t)return null;try{return t.split(`/`).map(decodeURIComponent).join(`/`)}catch{return t}}function C(e){return`${b}${o(e)}`}var w=`#/__skill-file__/`,T=`#/__skills__`;function E(e){return e===T||e.startsWith(`${T}/`)}var D=`#/__skill-preview__/`,O=[`explore`,`detected`,`builtin`,`foreign`,`linked`];function k(e){return e!==void 0&&O.includes(e)}var A=`project`;function j(e){return[e.flavor,e.source,e.name,e.subtitle,e.level??A].map(a).join(`/`)}function M(e){if(!e)return null;let n;try{n=e.split(`/`).map(decodeURIComponent)}catch{return null}if(n.length<4||n.length>6)return null;let[r,i,a,o,s,c]=n;return!k(r)||!i||!a?null:{flavor:r,source:i,name:a,subtitle:o??``,...s&&t(s)?{level:s}:{},...c?{path:c}:{}}}function N(e){let t=j(e);return e.path&&(t+=`/${a(e.path)}`),`${D}${t}`}function P(e){return e.startsWith(D)?M(e.slice(20)):null}var F=`:`;function I(e){let t=e.host===void 0?e.name:`${e.name}${F}${e.host}`;return`${w}${[e.scope,t].map(a).join(`/`)}/${o(e.path)}`}function L(e){if(!e.startsWith(w))return null;let n=e.slice(17);if(!n)return null;let r;try{r=n.split(`/`).map(decodeURIComponent)}catch{return null}if(r.length<3)return null;let[i,a,...o]=r,s=o.join(`/`);if(!i||!a||!s||!t(i))return null;let c=a.indexOf(F),l=c===-1?a:a.slice(0,c),u=c===-1?void 0:a.slice(c+1);return l?{scope:i,name:l,path:s,...u?{host:u}:{}}:null}var R=/\.(md|mdx)$/i;function z(e){return e.trim().replace(/^\.\/+/,``).replace(/^\/+/,``)}function B(e){return z(e).replace(R,``)}function V(e){let t=z(e);return t?R.test(t)?t:`${t}.md`:`untitled.md`}function H(e){let t=B(e),n=t.lastIndexOf(`/`);return{initialDir:n>0?t.slice(0,n):``,suggestedName:`${n>=0?t.slice(n+1):t||`untitled`}.md`}}export{P as C,L as S,f as _,S as a,h as b,v as c,C as d,s as f,y as g,N as h,r as i,j as l,I as m,V as n,M as o,_ as p,B as r,n as s,H as t,g as u,c as v,E as w,m as x,p as y};
@@ -1 +1 @@
1
- import{p as e}from"./config-provider-Ca2HUShB.js";var t=new WeakMap;function n(n,r){let i=t.get(r);if(i)return i;let a=new e(r);t.set(r,a);let o=r.doc,s=!1,c=()=>{s||(s=!0,n.off(`destroy`,c),o?.off(`destroy`,c),t.get(r)===a&&t.delete(r),a.clear(),a.destroy())};return n.on(`destroy`,c),o?.on(`destroy`,c),a}export{n as t};
1
+ import{p as e}from"./config-provider-D06S8HhQ.js";var t=new WeakMap;function n(n,r){let i=t.get(r);if(i)return i;let a=new e(r);t.set(r,a);let o=r.doc,s=!1,c=()=>{s||(s=!0,n.off(`destroy`,c),o?.off(`destroy`,c),t.get(r)===a&&t.delete(r),a.clear(),a.destroy())};return n.on(`destroy`,c),o?.on(`destroy`,c),a}export{n as t};
@@ -1 +1 @@
1
- import{N as e}from"./dist-DILeGueK.js";var t=`open-knowledge:documents-changed`,n=new Set(e.options);function r(e){return e===void 0||!Array.isArray(e)?[`files`]:[...new Set(e.filter(e=>n.has(e)))]}function i(e=[`files`]){window.dispatchEvent(new CustomEvent(t,{detail:{channels:r(e)}}))}function a(e){let n=t=>{e(r(t instanceof CustomEvent?t.detail?.channels:void 0))};return window.addEventListener(t,n),()=>window.removeEventListener(t,n)}function o(e){return e.includes(`local-targets`)||e.includes(`files`)}var s=`open-knowledge:doc-persisted`;function c(e){window.dispatchEvent(new CustomEvent(s,{detail:{docName:e}}))}function l(e){let t=t=>{if(!(t instanceof CustomEvent))return;let n=t.detail?.docName;typeof n==`string`&&n.length>0&&e(n)};return window.addEventListener(s,t),()=>window.removeEventListener(s,t)}var u=`open-knowledge:branch-changed`;function d(e){window.dispatchEvent(new CustomEvent(u,{detail:{branch:e}}))}function f(e){let t=t=>{if(!(t instanceof CustomEvent))return;let n=t.detail;e(n?.branch??null)};return window.addEventListener(u,t),()=>window.removeEventListener(u,t)}var p=`open-knowledge:templates-changed`;function m(){window.dispatchEvent(new CustomEvent(p))}function h(e){let t=()=>e();return window.addEventListener(p,t),()=>window.removeEventListener(p,t)}var g=`open-knowledge:skills-changed`;function _(){window.dispatchEvent(new CustomEvent(g))}function v(e){let t=()=>e();return window.addEventListener(g,t),()=>window.removeEventListener(g,t)}var y=`open-knowledge:skill-scope-moved`;function b(e){window.dispatchEvent(new CustomEvent(y,{detail:e}))}function x(e){let t=t=>e(t.detail);return window.addEventListener(y,t),()=>window.removeEventListener(y,t)}var S=new Set,C=(e,t)=>`${e}\u0000${t}`;function w(e,t){S.add(C(e,t)),_()}function T(e,t){S.delete(C(e,t))&&_()}var E=new Map;function D(e,t){let n=C(e,t);E.set(n,(E.get(n)??0)+1),_()}function O(e,t){let n=C(e,t),r=E.get(n);r!==void 0&&(r<=1?E.delete(n):E.set(n,r-1),_())}function k(e,t){return E.has(C(e,t))}function A(){return[...E.keys()].sort().join(``)}function j(e,t){return S.has(C(e,t))}function M(e){return S.size===0?e:e.filter(e=>!S.has(C(e.scope,e.name)))}export{l as _,c as a,v as b,_ as c,O as d,o as f,f as g,A as h,d as i,m as l,k as m,w as n,i as o,j as p,D as r,b as s,M as t,T as u,a as v,h as x,x as y};
1
+ import{N as e}from"./dist-DTxb76k4.js";var t=`open-knowledge:documents-changed`,n=new Set(e.options);function r(e){return e===void 0||!Array.isArray(e)?[`files`]:[...new Set(e.filter(e=>n.has(e)))]}function i(e=[`files`]){window.dispatchEvent(new CustomEvent(t,{detail:{channels:r(e)}}))}function a(e){let n=t=>{e(r(t instanceof CustomEvent?t.detail?.channels:void 0))};return window.addEventListener(t,n),()=>window.removeEventListener(t,n)}function o(e){return e.includes(`local-targets`)||e.includes(`files`)}var s=`open-knowledge:doc-persisted`;function c(e){window.dispatchEvent(new CustomEvent(s,{detail:{docName:e}}))}function l(e){let t=t=>{if(!(t instanceof CustomEvent))return;let n=t.detail?.docName;typeof n==`string`&&n.length>0&&e(n)};return window.addEventListener(s,t),()=>window.removeEventListener(s,t)}var u=`open-knowledge:branch-changed`;function d(e){window.dispatchEvent(new CustomEvent(u,{detail:{branch:e}}))}function f(e){let t=t=>{if(!(t instanceof CustomEvent))return;let n=t.detail;e(n?.branch??null)};return window.addEventListener(u,t),()=>window.removeEventListener(u,t)}var p=`open-knowledge:templates-changed`;function m(){window.dispatchEvent(new CustomEvent(p))}function h(e){let t=()=>e();return window.addEventListener(p,t),()=>window.removeEventListener(p,t)}var g=`open-knowledge:skills-changed`;function _(){window.dispatchEvent(new CustomEvent(g))}function v(e){let t=()=>e();return window.addEventListener(g,t),()=>window.removeEventListener(g,t)}var y=`open-knowledge:skill-scope-moved`;function b(e){window.dispatchEvent(new CustomEvent(y,{detail:e}))}function x(e){let t=t=>e(t.detail);return window.addEventListener(y,t),()=>window.removeEventListener(y,t)}var S=new Set,C=(e,t)=>`${e}\u0000${t}`;function w(e,t){S.add(C(e,t)),_()}function T(e,t){S.delete(C(e,t))&&_()}var E=new Map;function D(e,t){let n=C(e,t);E.set(n,(E.get(n)??0)+1),_()}function O(e,t){let n=C(e,t),r=E.get(n);r!==void 0&&(r<=1?E.delete(n):E.set(n,r-1),_())}function k(e,t){return E.has(C(e,t))}function A(){return[...E.keys()].sort().join(``)}function j(e,t){return S.has(C(e,t))}function M(e){return S.size===0?e:e.filter(e=>!S.has(C(e.scope,e.name)))}export{l as _,c as a,v as b,_ as c,O as d,o as f,f as g,A as h,d as i,m as l,k as m,w as n,i as o,j as p,D as r,b as s,M as t,T as u,a as v,h as x,x as y};
@@ -1 +1 @@
1
- import{Ds as e,Ts as t,bs as n,xs as r}from"./dist-DILeGueK.js";import{d as i,f as a,p as o}from"./doc-paths-BWrKtSx2.js";import{i as s}from"./navigation-targets-CJ9ZxyzV.js";import{c,l,s as u}from"./file-tree-utils-BcIIWtsU.js";import{t as d}from"./file-tree-rename-validation-DEqmyFYk.js";var f=`application/x-open-knowledge-sidebar-item+json`,p={image:!0,video:!0,audio:!0,pdf:!0,text:!0,mermaid:!0,excalidraw:!0};function m(e){return JSON.stringify(e)}function h(e){return e?Array.from(e.types).includes(f):!1}function ee(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:o(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:i(e.assetPath)}:{target:s(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:a(e.docName)}}function g(e){if(!e||!h(e))return null;let t=e.getData(f);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!_(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!v(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function v(e){return typeof e==`string`&&Object.hasOwn(p,e)}var y=`.md`,b=/\.(md|mdx)$/i;function x(e,i=y){return b.test(e)||t(e)||r(e)||n(e)?e:`${e}${i}`}function S(e){return $(e).replace(b,``)}function C(e,t){let n=$(e),r=k(t),i=t.find(e=>c(e)&&A(e,r)===n)??t.find(e=>c(e)&&T(e)===n);if(i)return i.docName;let a=S(n);return t.find(e=>{let t=T(e);return t!==n&&b.test(t)&&S(t)===a})&&b.test(n)?n:a}function w(e,t){let n=k(t);return t.find(t=>A(t,n)===e)??t.find(t=>T(t)===e)}function T(e){return l(e)?O(e.path):u(e)?e.path:x(e.docName,e.docExt)}function E(e){let t=$(e).match(b);return t?`.${t[1].toLowerCase()}`:void 0}function D(e){return $(e)}function O(e){let t=$(e.trim());return t?`${t}/`:``}function te(e){return e.endsWith(`/`)?D(e):S(e)}function k(e){let t=new Map;for(let n of e){if(!c(n))continue;let e=n.docName.match(b);if(!e)continue;let r=n.docName.slice(0,-e[0].length),i=t.get(r);i?i.add(e[0]):t.set(r,new Set([e[0]]))}return t}function A(e,t){let n=T(e);if(!c(e))return n;let r=e.docName.match(b);if(!r)return n;let i=e.docName.slice(0,-r[0].length);return(t.get(i)?.size??0)>1?n:`${e.docName}${e.docExt??y}`}function j(e){let t=k(e),n=new Set,r=[];for(let i of e){let e=A(i,t);n.has(e)||(n.add(e),r.push(e))}return r}function M(e){return[...e].sort().join(`\0`)}function N(e){return M(j(e))}function P(e,t={}){let n=new Set;for(let r of e){let e=(l(r)||u(r)?r.path:r.docName).split(`/`).filter(Boolean);if(!t.includeOkFolders&&e.includes(`.ok`))continue;if(l(r)){let e=O(r.path);e&&n.add(e)}let i=l(r)?e.length:e.length-1;for(let t=1;t<=i;t++)n.add(`${e.slice(0,t).join(`/`)}/`)}return[...n].sort()}function F(e){if(!e)return[];let t=$(e.replace(b,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function I(e,t,n){let r=E(e);if(r)return r;let i=n.find(e=>c(e)&&e.docName===t);return i?i.docExt??y:Q(e).includes(`.`)?void 0:y}function L(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!u(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function R(e,t,n){if(E(e))return null;let r=n.find(e=>u(e)&&e.path===t);return r?r.path:Q(e).includes(`.`)?t:L(t,n)}function z(e,t){let n=e.kind===`directory`,r=n?D(e.path):C(e.path,t);if(n)return{kind:`folder`,name:$(Q(e.path)).replace(b,``),path:r,treePath:V(e.path,!0)};let i=R(e.path,r,t);if(i)return{kind:`asset`,name:$(Q(i)),path:i,treePath:i};let a=I(e.path,r,t);return{kind:`file`,name:$(Q(e.path)).replace(b,``),path:r,treePath:V(e.path,!1),docExt:a}}function B(e){return e.kind===`directory`?D(e.path):e.path}function V(e,t){return t?O(e):b.test(e)?e:`${e}${y}`}function H(e,t,n){let r=O(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${y}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function U(e,t){return e===`file`?V(t,!1):`${D(t)}/index${y}`}function W(e,t){return t.kind===`root`||t.directoryPath==null?Q(e):`${t.directoryPath}${Q(e)}`}function G(e,t){if(t)return D(O(e));let n=S(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function K(e,t){let n=D(O(e));return n?`${n}/${t}`:t}function q(e,t,n){e.append(`parentDocName`,K(t,n)),e.append(`placement`,`parent-dir`)}function J(e,t){return(t.path??K(e,t.src)).replace(/^\/+/,``)}function Y(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function X(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function Z(t,n){let r=d(t).toLowerCase();if(r===``)return null;let i=new Date().toISOString();if(r===`.md`||r===`.mdx`)return{kind:`document`,docName:S(t),docExt:r,modified:i,size:n.size};let a=r.startsWith(`.`)?r.slice(1):r;return{kind:`asset`,path:t,assetExt:a,mediaKind:e(a),modified:i,size:n.size}}function Q(e){let t=$(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function $(e){return e.endsWith(`/`)?e.slice(0,-1):e}export{g as A,z as C,f as D,J as E,h as O,C as S,te as T,G as _,U as a,D as b,j as c,T as d,X as f,V as g,Y as h,W as i,m as j,ee as k,N as l,O as m,P as n,H as o,w as p,F as r,x as s,q as t,Z as u,B as v,M as w,S as x,L as y};
1
+ import{Ds as e,Ts as t,bs as n,xs as r}from"./dist-DTxb76k4.js";import{d as i,f as a,p as o}from"./doc-paths-VPO39t4f.js";import{i as s}from"./navigation-targets-Cj3FjSHM.js";import{c,l,s as u}from"./file-tree-utils-CIQBSzS9.js";import{t as d}from"./file-tree-rename-validation-DEqmyFYk.js";var f=`application/x-open-knowledge-sidebar-item+json`,p={image:!0,video:!0,audio:!0,pdf:!0,text:!0,mermaid:!0,excalidraw:!0};function m(e){return JSON.stringify(e)}function h(e){return e?Array.from(e.types).includes(f):!1}function ee(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:o(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:i(e.assetPath)}:{target:s(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:a(e.docName)}}function g(e){if(!e||!h(e))return null;let t=e.getData(f);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!_(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!v(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function v(e){return typeof e==`string`&&Object.hasOwn(p,e)}var y=`.md`,b=/\.(md|mdx)$/i;function x(e,i=y){return b.test(e)||t(e)||r(e)||n(e)?e:`${e}${i}`}function S(e){return $(e).replace(b,``)}function C(e,t){let n=$(e),r=k(t),i=t.find(e=>c(e)&&A(e,r)===n)??t.find(e=>c(e)&&T(e)===n);if(i)return i.docName;let a=S(n);return t.find(e=>{let t=T(e);return t!==n&&b.test(t)&&S(t)===a})&&b.test(n)?n:a}function w(e,t){let n=k(t);return t.find(t=>A(t,n)===e)??t.find(t=>T(t)===e)}function T(e){return l(e)?O(e.path):u(e)?e.path:x(e.docName,e.docExt)}function E(e){let t=$(e).match(b);return t?`.${t[1].toLowerCase()}`:void 0}function D(e){return $(e)}function O(e){let t=$(e.trim());return t?`${t}/`:``}function te(e){return e.endsWith(`/`)?D(e):S(e)}function k(e){let t=new Map;for(let n of e){if(!c(n))continue;let e=n.docName.match(b);if(!e)continue;let r=n.docName.slice(0,-e[0].length),i=t.get(r);i?i.add(e[0]):t.set(r,new Set([e[0]]))}return t}function A(e,t){let n=T(e);if(!c(e))return n;let r=e.docName.match(b);if(!r)return n;let i=e.docName.slice(0,-r[0].length);return(t.get(i)?.size??0)>1?n:`${e.docName}${e.docExt??y}`}function j(e){let t=k(e),n=new Set,r=[];for(let i of e){let e=A(i,t);n.has(e)||(n.add(e),r.push(e))}return r}function M(e){return[...e].sort().join(`\0`)}function N(e){return M(j(e))}function P(e,t={}){let n=new Set;for(let r of e){let e=(l(r)||u(r)?r.path:r.docName).split(`/`).filter(Boolean);if(!t.includeOkFolders&&e.includes(`.ok`))continue;if(l(r)){let e=O(r.path);e&&n.add(e)}let i=l(r)?e.length:e.length-1;for(let t=1;t<=i;t++)n.add(`${e.slice(0,t).join(`/`)}/`)}return[...n].sort()}function F(e){if(!e)return[];let t=$(e.replace(b,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function I(e,t,n){let r=E(e);if(r)return r;let i=n.find(e=>c(e)&&e.docName===t);return i?i.docExt??y:Q(e).includes(`.`)?void 0:y}function L(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!u(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function R(e,t,n){if(E(e))return null;let r=n.find(e=>u(e)&&e.path===t);return r?r.path:Q(e).includes(`.`)?t:L(t,n)}function z(e,t){let n=e.kind===`directory`,r=n?D(e.path):C(e.path,t);if(n)return{kind:`folder`,name:$(Q(e.path)).replace(b,``),path:r,treePath:V(e.path,!0)};let i=R(e.path,r,t);if(i)return{kind:`asset`,name:$(Q(i)),path:i,treePath:i};let a=I(e.path,r,t);return{kind:`file`,name:$(Q(e.path)).replace(b,``),path:r,treePath:V(e.path,!1),docExt:a}}function B(e){return e.kind===`directory`?D(e.path):e.path}function V(e,t){return t?O(e):b.test(e)?e:`${e}${y}`}function H(e,t,n){let r=O(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${y}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function U(e,t){return e===`file`?V(t,!1):`${D(t)}/index${y}`}function W(e,t){return t.kind===`root`||t.directoryPath==null?Q(e):`${t.directoryPath}${Q(e)}`}function G(e,t){if(t)return D(O(e));let n=S(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function K(e,t){let n=D(O(e));return n?`${n}/${t}`:t}function q(e,t,n){e.append(`parentDocName`,K(t,n)),e.append(`placement`,`parent-dir`)}function J(e,t){return(t.path??K(e,t.src)).replace(/^\/+/,``)}function Y(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function X(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function Z(t,n){let r=d(t).toLowerCase();if(r===``)return null;let i=new Date().toISOString();if(r===`.md`||r===`.mdx`)return{kind:`document`,docName:S(t),docExt:r,modified:i,size:n.size};let a=r.startsWith(`.`)?r.slice(1):r;return{kind:`asset`,path:t,assetExt:a,mediaKind:e(a),modified:i,size:n.size}}function Q(e){let t=$(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function $(e){return e.endsWith(`/`)?e.slice(0,-1):e}export{g as A,z as C,f as D,J as E,h as O,C as S,te as T,G as _,U as a,D as b,j as c,T as d,X as f,V as g,Y as h,W as i,m as j,ee as k,N as l,O as m,P as n,H as o,w as p,F as r,x as s,q as t,Z as u,B as v,M as w,S as x,L as y};
@@ -1 +1 @@
1
- import{pi as e,uc as t,yi as n}from"./dist-DILeGueK.js";function r(e){return e.kind===`asset`}function i(e){return e.kind===`document`}function a(e){return e.kind===`folder`}function o(e){let t=[],n=0;for(let r of e)switch(r.kind){case`document`:if(r.docName===void 0){n+=1;break}t.push({kind:`document`,docName:r.docName,docExt:r.docExt,size:r.size,modified:r.modified,isSymlink:r.isSymlink,canonicalDocName:r.canonicalDocName,targetPath:r.targetPath});break;case`asset`:if(r.path===void 0||r.assetExt===void 0){n+=1;break}t.push({kind:`asset`,path:r.path,assetExt:r.assetExt,mediaKind:r.mediaKind??null,size:r.size,modified:r.modified,referencedBy:r.referencedBy});break;case`file`:if(r.path===void 0){n+=1;break}t.push({kind:`asset`,path:r.path,assetExt:r.assetExt??s(r.path),mediaKind:null,size:r.size,modified:r.modified,referencedBy:[]});break;case`folder`:if(r.path===void 0){n+=1;break}t.push({kind:`folder`,path:r.path,size:r.size,modified:r.modified,hasChildren:r.hasChildren,isSymlink:r.isSymlink,targetPath:r.targetPath});break;default:r.kind;break}return n>0&&console.warn(`[file-tree-utils] dropped ${n} listing entries missing variant identity fields`),t}function s(e){let t=e.includes(`/`)?e.split(`/`).pop()??e:e,n=t.lastIndexOf(`.`);return n>0&&n<t.length-1?t.slice(n+1).toLowerCase():t.startsWith(`.`)&&t.length>1?t.slice(1).toLowerCase():`file`}function c(e){if(!e)return[];let t=e.split(`/`).filter(Boolean),n=[];for(let e=1;e<t.length;e++)n.push(t.slice(0,e).join(`/`));return n}function l(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t>0?e.slice(0,t):``}function u(e){return e.split(`/`).some(e=>e.toLowerCase()===`.ok`)}function d(e,t){return t&&e!==`document`&&e!==`folder`}function f(t,n){return!n&&e(t)}function p(t,r={}){let{showHiddenFiles:i=!1,showOnlyMarkdownFiles:a=!1,showOkFolders:o=!1}=r;return t.filter(t=>{let r=t.docName??t.path??``;if(r===``||d(t.kind,a))return!1;let s=r.split(`/`),c=s.indexOf(`.ok`);if(c!==-1){if(!o)return!1;let t=s.slice(0,c).join(`/`);return i||t===``||!e(t)}return n(r)?!1:!f(r,i)})}function m(e,r={}){let{showHiddenFiles:i=!1,showOnlyMarkdownFiles:a=!1}=r,o=e.docName??e.path??``;return o===``||t(o)||n(o)||u(o)?{hiddenFiles:!1,onlyMarkdownFiles:!1}:{hiddenFiles:f(o,i),onlyMarkdownFiles:d(e.kind,a)}}function h(e){let{visibility:t={},unfilteredRootEntryCount:n,knownPageCount:r}=e;return(n>0||r>0)&&(t.showOnlyMarkdownFiles??!1)?`filtered-to-zero`:`true-empty`}export{p as a,i as c,o as d,l as i,a as l,h as n,u as o,c as r,r as s,m as t,s as u};
1
+ import{pi as e,uc as t,yi as n}from"./dist-DTxb76k4.js";function r(e){return e.kind===`asset`}function i(e){return e.kind===`document`}function a(e){return e.kind===`folder`}function o(e){let t=[],n=0;for(let r of e)switch(r.kind){case`document`:if(r.docName===void 0){n+=1;break}t.push({kind:`document`,docName:r.docName,docExt:r.docExt,size:r.size,modified:r.modified,isSymlink:r.isSymlink,canonicalDocName:r.canonicalDocName,targetPath:r.targetPath});break;case`asset`:if(r.path===void 0||r.assetExt===void 0){n+=1;break}t.push({kind:`asset`,path:r.path,assetExt:r.assetExt,mediaKind:r.mediaKind??null,size:r.size,modified:r.modified,referencedBy:r.referencedBy});break;case`file`:if(r.path===void 0){n+=1;break}t.push({kind:`asset`,path:r.path,assetExt:r.assetExt??s(r.path),mediaKind:null,size:r.size,modified:r.modified,referencedBy:[]});break;case`folder`:if(r.path===void 0){n+=1;break}t.push({kind:`folder`,path:r.path,size:r.size,modified:r.modified,hasChildren:r.hasChildren,isSymlink:r.isSymlink,targetPath:r.targetPath});break;default:r.kind;break}return n>0&&console.warn(`[file-tree-utils] dropped ${n} listing entries missing variant identity fields`),t}function s(e){let t=e.includes(`/`)?e.split(`/`).pop()??e:e,n=t.lastIndexOf(`.`);return n>0&&n<t.length-1?t.slice(n+1).toLowerCase():t.startsWith(`.`)&&t.length>1?t.slice(1).toLowerCase():`file`}function c(e){if(!e)return[];let t=e.split(`/`).filter(Boolean),n=[];for(let e=1;e<t.length;e++)n.push(t.slice(0,e).join(`/`));return n}function l(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t>0?e.slice(0,t):``}function u(e){return e.split(`/`).some(e=>e.toLowerCase()===`.ok`)}function d(e,t){return t&&e!==`document`&&e!==`folder`}function f(t,n){return!n&&e(t)}function p(t,r={}){let{showHiddenFiles:i=!1,showOnlyMarkdownFiles:a=!1,showOkFolders:o=!1}=r;return t.filter(t=>{let r=t.docName??t.path??``;if(r===``||d(t.kind,a))return!1;let s=r.split(`/`),c=s.indexOf(`.ok`);if(c!==-1){if(!o)return!1;let t=s.slice(0,c).join(`/`);return i||t===``||!e(t)}return n(r)?!1:!f(r,i)})}function m(e,r={}){let{showHiddenFiles:i=!1,showOnlyMarkdownFiles:a=!1}=r,o=e.docName??e.path??``;return o===``||t(o)||n(o)||u(o)?{hiddenFiles:!1,onlyMarkdownFiles:!1}:{hiddenFiles:f(o,i),onlyMarkdownFiles:d(e.kind,a)}}function h(e){let{visibility:t={},unfilteredRootEntryCount:n,knownPageCount:r}=e;return(n>0||r>0)&&(t.showOnlyMarkdownFiles??!1)?`filtered-to-zero`:`true-empty`}export{p as a,i as c,o as d,l as i,a as l,h as n,u as o,c as r,r as s,m as t,s as u};
@@ -1 +1 @@
1
- import{l as e}from"./documents-events-Do7TM3Hd.js";import{t}from"./parse-api-error-BtEdpaFC.js";import{t as n}from"./createLucideIcon-B6ULg5PN.js";var r=n(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]);async function i(e){return t(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function a(e,t){try{let n=await fetch(`/api/folder-config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,frontmatter:t})});return n.ok?{ok:!0}:{ok:!1,error:await i(n)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function o(t){try{let n=await fetch(`/api/template`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)return{ok:!1,error:await i(n)};let r=await n.json().catch(()=>null);return e(),{ok:!0,created:r?.created??!1,warnings:r?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function s(t,n){try{let r=`?folder=${encodeURIComponent(t)}&name=${encodeURIComponent(n)}`,a=await fetch(`/api/template${r}`,{method:`DELETE`});if(!a.ok)return{ok:!1,error:await i(a)};let o=await a.json().catch(()=>null);return e(),{ok:!0,existed:o?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function c(t){try{let n=await fetch(`/api/template`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)return{ok:!1,error:await i(n)};let r=await n.json().catch(()=>null);return e(),{ok:!0,committed:r?.committed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function l(t){try{let n=await fetch(`/api/template/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)return{ok:!1,error:await i(n)};let r=await n.json().catch(()=>null);return e(),{ok:!0,path:r?.path??``,created:r?.created??!1,warnings:r?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}export{o as a,a as i,l as n,r as o,c as r,s as t};
1
+ import{l as e}from"./documents-events-DLvhFUkq.js";import{t}from"./parse-api-error-BtEdpaFC.js";import{t as n}from"./createLucideIcon-B6ULg5PN.js";var r=n(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]);async function i(e){return t(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function a(e,t){try{let n=await fetch(`/api/folder-config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,frontmatter:t})});return n.ok?{ok:!0}:{ok:!1,error:await i(n)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function o(t){try{let n=await fetch(`/api/template`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)return{ok:!1,error:await i(n)};let r=await n.json().catch(()=>null);return e(),{ok:!0,created:r?.created??!1,warnings:r?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function s(t,n){try{let r=`?folder=${encodeURIComponent(t)}&name=${encodeURIComponent(n)}`,a=await fetch(`/api/template${r}`,{method:`DELETE`});if(!a.ok)return{ok:!1,error:await i(a)};let o=await a.json().catch(()=>null);return e(),{ok:!0,existed:o?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function c(t){try{let n=await fetch(`/api/template`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)return{ok:!1,error:await i(n)};let r=await n.json().catch(()=>null);return e(),{ok:!0,committed:r?.committed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function l(t){try{let n=await fetch(`/api/template/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)return{ok:!1,error:await i(n)};let r=await n.json().catch(()=>null);return e(),{ok:!0,path:r?.path??``,created:r?.created??!1,warnings:r?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}export{o as a,a as i,l as n,r as o,c as r,s as t};