@inkeep/open-knowledge 0.72.0-beta.4 → 0.72.0-beta.6

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 (175) hide show
  1. package/dist/cli.mjs +67 -67
  2. package/dist/constants-CeQ3-tAG.mjs +1 -0
  3. package/dist/{dist-B7NFh0MZ.mjs → dist-CIcphNQy.mjs} +484 -484
  4. package/dist/{dist-D7HUGErx.mjs → dist-DJSvIyoE.mjs} +1 -1
  5. package/dist/index.d.mts +1 -1
  6. package/dist/index.mjs +194 -194
  7. package/dist/init-BRG0F45U.mjs +1 -0
  8. package/dist/{init-R__-FL-k.mjs → init-eXRAsKsb.mjs} +7 -7
  9. package/dist/{launch-json-removal-7D0nQT56.mjs → launch-json-removal-26YgpKf4.mjs} +1 -1
  10. package/dist/{loader-BRYG-jTN.mjs → loader-DDxZz72j.mjs} +1 -1
  11. package/dist/loader-VRqyKQuf.mjs +1 -0
  12. package/dist/{md-manager-BGnqyqi1-hmuoZRep.mjs → md-manager-BGnqyqi1-Bo-Rq5FL.mjs} +98 -98
  13. package/dist/{open-browser-4-j8NELI.mjs → open-browser-Bq5FSdgJ.mjs} +1 -1
  14. package/dist/parse-worker.mjs +1 -1
  15. package/dist/{preview-DjhHIWGN.mjs → preview-C83BBgSH.mjs} +1 -1
  16. package/dist/preview-DiTLAAbh.mjs +1 -0
  17. package/dist/public/assets/{ActivityModeContent-DLnzCgfz.js → ActivityModeContent-DuV-Wxoa.js} +1 -1
  18. package/dist/public/assets/AddPropertiesButton-DPmktRPG.js +2 -0
  19. package/dist/public/assets/{AgentDiffPane-B5amlfmP.js → AgentDiffPane-CxU1PJrg.js} +1 -1
  20. package/dist/public/assets/{AgentIconCluster-DiWkEX6O.js → AgentIconCluster-BfdKE6ui.js} +1 -1
  21. package/dist/public/assets/{AgentThreadClientBinder-iSWzdyTG.js → AgentThreadClientBinder-DjubXLi6.js} +1 -1
  22. package/dist/public/assets/{BugReportHistory-CounGQhT.js → BugReportHistory-C_ZU9yMs.js} +1 -1
  23. package/dist/public/assets/{BugReportHistoryDialog-CgPrrnbM.js → BugReportHistoryDialog-DJiu9Guq.js} +1 -1
  24. package/dist/public/assets/CodeMirrorPropInput-D97WOcle.js +3 -0
  25. package/dist/public/assets/{ConsentDialogBody-BD4DWbp5.js → ConsentDialogBody-Dqev0b07.js} +1 -1
  26. package/dist/public/assets/{DiffViewBoundary-BXdwk2Iq.js → DiffViewBoundary-CFZjF4Xj.js} +1 -1
  27. package/dist/public/assets/DocumentContext-DX4_PUWv.js +39 -0
  28. package/dist/public/assets/{EditorModeToggle-Dg7vVHl3.js → EditorModeToggle-CvJLZD0M.js} +1 -1
  29. package/dist/public/assets/{EnableSyncConfirmDialog-R-Z946N5.js → EnableSyncConfirmDialog-czS5nsXI.js} +1 -1
  30. package/dist/public/assets/{ExcalidrawDocEditor-CY1lJS-2.js → ExcalidrawDocEditor-Cz-kIZcN.js} +1 -1
  31. package/dist/public/assets/FeedbackForm-BKQfuKfi.js +1 -0
  32. package/dist/public/assets/{GraphPanel-omwwsp_N.js → GraphPanel-Brw8ehEB.js} +1 -1
  33. package/dist/public/assets/{ImageAttachments-BpYJnzlN.js → ImageAttachments-CC1lPWjh.js} +1 -1
  34. package/dist/public/assets/{ImportSkillDialog-BTpla3g7.js → ImportSkillDialog-d_yMgunZ.js} +1 -1
  35. package/dist/public/assets/{LintConfigEditor-CVkLVVX0.js → LintConfigEditor-Cql11JCw.js} +1 -1
  36. package/dist/public/assets/ManagedArtifactProperties-BG4Fy3XQ.js +1 -0
  37. package/dist/public/assets/{ManagedArtifactProperties-C1nhYITR.js → ManagedArtifactProperties-DVOVMN78.js} +1 -1
  38. package/dist/public/assets/MermaidDocEditor-BzvUKrvv.js +1 -0
  39. package/dist/public/assets/{OpenInAgentMenuItem-CzPwpHyZ.js → OpenInAgentMenuItem-pI7QqxQ8.js} +1 -1
  40. package/dist/public/assets/{PropertyDisplayRow-BGe6-4L9.js → PropertyDisplayRow-EAikSGib.js} +1 -1
  41. package/dist/public/assets/{RegisteredAgentIcon-Dit7Zlh0.js → RegisteredAgentIcon-H1tWUX4M.js} +1 -1
  42. package/dist/public/assets/{ReportBugDialogBody-CiI1lRKj.js → ReportBugDialogBody-B0Hz8PSu.js} +2 -2
  43. package/dist/public/assets/{ReportBugMenuTrigger-DoDCPu1X.js → ReportBugMenuTrigger-fqTsxaHY.js} +2 -2
  44. package/dist/public/assets/{SchemaConfigEditor-CSINzXTv.js → SchemaConfigEditor-q_ojTlU-.js} +1 -1
  45. package/dist/public/assets/{SessionsHost-Crwf7ff-.js → SessionsHost-Bype_V2w.js} +2 -2
  46. package/dist/public/assets/SettingsDialogBody-ClOXAL7Y.js +12 -0
  47. package/dist/public/assets/{ShareBranchSwitchDialog-DqSgSjyg.js → ShareBranchSwitchDialog-DOFGWcAi.js} +1 -1
  48. package/dist/public/assets/{ShareReceiveDialog-BZtxSZra.js → ShareReceiveDialog-DeXX0A9G.js} +1 -1
  49. package/dist/public/assets/{ShareReceiveMissDialog-dnAsxL19.js → ShareReceiveMissDialog-DikJivBp.js} +1 -1
  50. package/dist/public/assets/{SkillCostValue-CHZQh8Rq.js → SkillCostValue-Bz3F4Rhv.js} +1 -1
  51. package/dist/public/assets/{SkillEditBanner-SYzSHptQ.js → SkillEditBanner-CwcNkco_.js} +1 -1
  52. package/dist/public/assets/{SkillForkDialog-Cz82rkwA.js → SkillForkDialog-CkG_oW7h.js} +1 -1
  53. package/dist/public/assets/{SkillInstallMenu-CNY0p5vX.js → SkillInstallMenu-B87ijGMQ.js} +1 -1
  54. package/dist/public/assets/{SkillOriginInline-DuKHAOBP.js → SkillOriginInline-Ca3SXbe0.js} +1 -1
  55. package/dist/public/assets/{SkillToolbarControls-CjE7B4SI.js → SkillToolbarControls-BaE_PtLx.js} +1 -1
  56. package/dist/public/assets/SlidesToolbarControls-8RmRXuaP.js +1 -0
  57. package/dist/public/assets/SourceEditor-DdIDVFJy.js +1 -0
  58. package/dist/public/assets/{TerminalPanel-Lr-gSBEo.js → TerminalPanel-Dg4Odd7P.js} +3 -3
  59. package/dist/public/assets/{TerminalWindowApp-Cbqv2j6x.js → TerminalWindowApp-CuHu-kBD.js} +1 -1
  60. package/dist/public/assets/TextDocEditor-aXrm23PN.js +1 -0
  61. package/dist/public/assets/{ThreadView-BhfeLCUr.js → ThreadView-DwpDF29Z.js} +6 -6
  62. package/dist/public/assets/{TimelineDiffPane-DeUhHr6c.js → TimelineDiffPane-COILPEZH.js} +1 -1
  63. package/dist/public/assets/agent-connection-status-CORLBJuD.js +1 -0
  64. package/dist/public/assets/auth-state-cache-D93mj765.js +11 -0
  65. package/dist/public/assets/{bug-report-send-manager-C8UOqZop.js → bug-report-send-manager-0zuWMSw7.js} +1 -1
  66. package/dist/public/assets/client-version-C8sAZlzC.js +1 -0
  67. package/dist/public/assets/{comment-chips-DG6TcreO.js → comment-chips-DaPmziL-.js} +1 -1
  68. package/dist/public/assets/{config-provider-CL2LHJwy.js → config-provider-xvx1bLbF.js} +4 -4
  69. package/dist/public/assets/{css-color-to-hex-21hHTVNl.js → css-color-to-hex-DPzuRcEY.js} +1 -1
  70. package/dist/public/assets/{dist-75Tp0j2s.js → dist-BBNlIz6B.js} +194 -194
  71. package/dist/public/assets/{doc-hash-0sJsliMq.js → doc-hash-BP0Io59r.js} +1 -1
  72. package/dist/public/assets/{doc-undo-manager-CUMz1Lu7.js → doc-undo-manager-Cp9RgUJD.js} +1 -1
  73. package/dist/public/assets/{documents-events-DvTemRtX.js → documents-events-BhW9c1L3.js} +1 -1
  74. package/dist/public/assets/{file-tree-adapter-C-zUZxGY.js → file-tree-adapter-CV_ZL37X.js} +1 -1
  75. package/dist/public/assets/{file-tree-utils-DQrKhuvs.js → file-tree-utils-Ba9yRKBT.js} +1 -1
  76. package/dist/public/assets/{folder-config-api-O8wiP8u9.js → folder-config-api-VEvZwzig.js} +1 -1
  77. package/dist/public/assets/index-DR2b9bQ8.js +2205 -0
  78. package/dist/public/assets/{lint-config-client-D_K_I33M.js → lint-config-client-qZ7mC1Zy.js} +1 -1
  79. package/dist/public/assets/{markdownlint-rule-browser-D_33Iwwv.js → markdownlint-rule-browser-BJMH4HJX.js} +1 -1
  80. package/dist/public/assets/messages-BVMprXL3.js +1 -0
  81. package/dist/public/assets/messages-Bqfd7jkb.js +1 -0
  82. package/dist/public/assets/messages-CH72i-bO.js +1 -0
  83. package/dist/public/assets/messages-CzlIjFg6.js +1 -0
  84. package/dist/public/assets/messages-D8dZFF9f.js +1 -0
  85. package/dist/public/assets/messages-D9axSU6Y.js +1 -0
  86. package/dist/public/assets/messages-DKTKP9pT.js +1 -0
  87. package/dist/public/assets/messages-DMFl2kw9.js +1 -0
  88. package/dist/public/assets/messages-DSA8fzIO.js +1 -0
  89. package/dist/public/assets/messages-bATdY7jB.js +1 -0
  90. package/dist/public/assets/messages-dbMtQLBB.js +1 -0
  91. package/dist/public/assets/messages-knxD2r8o.js +1 -0
  92. package/dist/public/assets/navigation-targets-DBLYH48Z.js +1 -0
  93. package/dist/public/assets/{page-list-cache-DmQP_SV8.js → page-list-cache-ia70Eztn.js} +1 -1
  94. package/dist/public/assets/{pending-receive-nav-store-lpN2Xg2z.js → pending-receive-nav-store-DsL1PcWo.js} +1 -1
  95. package/dist/public/assets/{progress-CpKCXRqy.js → progress-CqeKUHyJ.js} +4 -4
  96. package/dist/public/assets/{project-paths-gqDqqCq-.js → project-paths-BWUfIMzR.js} +1 -1
  97. package/dist/public/assets/prop-types-Cu1KjM7N.js +1 -0
  98. package/dist/public/assets/{receive-store-CmP1Rnn7.js → receive-store-MWZ6Efgw.js} +1 -1
  99. package/dist/public/assets/{selection-context-BYtzxyLE.js → selection-context-BzpZfjkH.js} +1 -1
  100. package/dist/public/assets/{skill-scope-zjfKF_hV.js → skill-scope-nA3yMJC-.js} +1 -1
  101. package/dist/public/assets/{skills-api-DefDq-V9.js → skills-api-DM_st9cJ.js} +1 -1
  102. package/dist/public/assets/{src-DyfxwlyE.js → src-Bew9jsBg.js} +1 -1
  103. package/dist/public/assets/startup-marks-DjGilb1Q.js +1 -0
  104. package/dist/public/assets/{tag-pill-input-fBTfmjgu.js → tag-pill-input-I-zmy30v.js} +1 -1
  105. package/dist/public/assets/{target-navigation-intent-JS6hYcot.js → target-navigation-intent-ZRGm8Ebz.js} +1 -1
  106. package/dist/public/assets/{telemetry-impl-CFkmFcv6.js → telemetry-impl-Ccp0NCP8.js} +1 -1
  107. package/dist/public/assets/{telemetry-startup-Bac091X8.js → telemetry-startup-BTPhdwGS.js} +1 -1
  108. package/dist/public/assets/{terminal-cli-display-B8ySenln.js → terminal-cli-display-UR6Dbpk0.js} +1 -1
  109. package/dist/public/assets/{terminal-command-events-DrvZC8Eu.js → terminal-command-events-MPQ3tB2h.js} +1 -1
  110. package/dist/public/assets/{terminal-launch-events-qWlFGuUx.js → terminal-launch-events-BBSlYIZk.js} +1 -1
  111. package/dist/public/assets/{terminal-telemetry-CpRQ96Ji.js → terminal-telemetry-pvyydkXE.js} +1 -1
  112. package/dist/public/assets/typing-burst-detector-BbwwSUxU.js +8 -0
  113. package/dist/public/assets/{uninstall-v61_ZoXT.js → uninstall-DxyqZMFJ.js} +1 -1
  114. package/dist/public/assets/{use-activity-panel-DCGFCgW4.js → use-activity-panel-CXRjvVsk.js} +1 -1
  115. package/dist/public/assets/use-apply-config-language-CJPbOFtI.js +2 -0
  116. package/dist/public/assets/{use-collab-url-mFOjr2IA.js → use-collab-url-D-Rpmggc.js} +1 -1
  117. package/dist/public/assets/{use-conflicts-C8dN_iXo.js → use-conflicts-GDmwqh_O.js} +1 -1
  118. package/dist/public/assets/{use-live-xterm-theme-B9dAAZD3.js → use-live-xterm-theme-RBRq5pG-.js} +1 -1
  119. package/dist/public/assets/{use-open-skill-BAPaR7kA.js → use-open-skill-DDuaC258.js} +1 -1
  120. package/dist/public/assets/{use-settings-route-BxaIY7g8.js → use-settings-route-DmYoFPHM.js} +1 -1
  121. package/dist/public/assets/{use-skill-origin-CZlBPaka.js → use-skill-origin-DbioIXic.js} +1 -1
  122. package/dist/public/assets/{use-skills-C6QmTsGG.js → use-skills-BagPzj6D.js} +1 -1
  123. package/dist/public/assets/{use-terminal-enabled-D0rb9s4e.js → use-terminal-enabled-CHN--3NP.js} +1 -1
  124. package/dist/public/assets/use-timeline-entry-diff-C_2xolry.js +5 -0
  125. package/dist/public/assets/{use-workspace-CPN4D3G_.js → use-workspace-BX0piG-D.js} +1 -1
  126. package/dist/public/index.html +55 -55
  127. package/dist/public/uninstall.html +4 -4
  128. package/dist/{registry-probes-Cthf_D-E.mjs → registry-probes-Bu-DRU8y.mjs} +2 -2
  129. package/dist/{removal-file-path-B3Ia2LYa.mjs → removal-file-path-U_eN5_8R.mjs} +1 -1
  130. package/dist/{repair-launch-json-LAfXDQlt.mjs → repair-launch-json-CYs9uh9p.mjs} +1 -1
  131. package/dist/{repair-mcp-configs-Dz9benJ2.mjs → repair-mcp-configs-DSVn28ud.mjs} +1 -1
  132. package/dist/src--7MYuwle.mjs +1 -0
  133. package/dist/src-hRABCxrW.mjs +11 -0
  134. package/dist/{start-C9LxTCYi.mjs → start-B0HmFZEI.mjs} +3 -3
  135. package/dist/start-CsF-S_or.mjs +1 -0
  136. package/package.json +4 -4
  137. package/dist/constants-tN6BLxqK.mjs +0 -1
  138. package/dist/init-0RF5mT_e.mjs +0 -1
  139. package/dist/loader-BicS4rg_.mjs +0 -1
  140. package/dist/preview-DtEWXaoq.mjs +0 -1
  141. package/dist/public/assets/AddPropertiesButton-5U2Y3uKp.js +0 -2
  142. package/dist/public/assets/CodeMirrorPropInput-Cmq0OheO.js +0 -3
  143. package/dist/public/assets/DocumentContext-TAFDDp6U.js +0 -39
  144. package/dist/public/assets/FeedbackForm-CUHxAufb.js +0 -1
  145. package/dist/public/assets/ManagedArtifactProperties-D_9Orim7.js +0 -1
  146. package/dist/public/assets/MermaidDocEditor-Nc0VfQkz.js +0 -1
  147. package/dist/public/assets/SettingsDialogBody-Bl3NZ37F.js +0 -12
  148. package/dist/public/assets/SlidesToolbarControls-C5RytnIw.js +0 -1
  149. package/dist/public/assets/SourceEditor-CAEGq_cL.js +0 -1
  150. package/dist/public/assets/TextDocEditor-BbjLCMRm.js +0 -1
  151. package/dist/public/assets/agent-connection-status-XSdlZ0uj.js +0 -1
  152. package/dist/public/assets/auth-state-cache-lPOpwdxt.js +0 -11
  153. package/dist/public/assets/client-version-DMKN1tA1.js +0 -1
  154. package/dist/public/assets/index-YzLx3klx.js +0 -2205
  155. package/dist/public/assets/messages-BYiJXmNN.js +0 -1
  156. package/dist/public/assets/messages-BwGMYA_G.js +0 -1
  157. package/dist/public/assets/messages-CFWXeDS9.js +0 -1
  158. package/dist/public/assets/messages-CbXu74T2.js +0 -1
  159. package/dist/public/assets/messages-Czy5uUdz.js +0 -1
  160. package/dist/public/assets/messages-DKoHMjaK.js +0 -1
  161. package/dist/public/assets/messages-DVDSsf5u.js +0 -1
  162. package/dist/public/assets/messages-Dnppvuua.js +0 -1
  163. package/dist/public/assets/messages-IHf96h9y.js +0 -1
  164. package/dist/public/assets/messages-ijpiuVRD.js +0 -1
  165. package/dist/public/assets/messages-lPluOXUP.js +0 -1
  166. package/dist/public/assets/messages-nbT9wGXG.js +0 -1
  167. package/dist/public/assets/navigation-targets-CLA-LGSO.js +0 -1
  168. package/dist/public/assets/prop-types-Cz_4UFXS.js +0 -1
  169. package/dist/public/assets/startup-marks-DkofILWo.js +0 -1
  170. package/dist/public/assets/typing-burst-detector-BBbOZnKo.js +0 -8
  171. package/dist/public/assets/use-apply-config-language-BS-vov2w.js +0 -2
  172. package/dist/public/assets/use-timeline-entry-diff-6pBvX9Gh.js +0 -5
  173. package/dist/src-BCVXAb8B.mjs +0 -1
  174. package/dist/src-CQqhz0Kv.mjs +0 -11
  175. package/dist/start-C5D7Sm06.mjs +0 -1
@@ -1 +0,0 @@
1
- import{A as e,Bs as t,Gs as n,Js as r,Ks as i,Qo as a,Ws as o,Xr as s,Xs as c,Ys as l,Zo as u,Zs as d,ec as f,is as p,ns as m,oa as h,tc as g}from"./dist-75Tp0j2s.js";import{r as _}from"./doc-paths-CExjBWO9.js";import{o as v,r as y}from"./file-tree-utils-DQrKhuvs.js";function b(e){return e.scope===`project`?f(x(e)):d(e.scope,e.name,e.hostQualifier)}function x(e){return e.canonicalPath??e.path}function S(e,t){return e.scope===`project`?`${x(e).replace(/\/SKILL\.mdx?$/i,``)}/${f(t)}`:c(e.scope,e.name,t,e.hostQualifier)}function C(e){let t=i(e);return t?.kind===`skill`?t.name:null}function w(e){let t=e.trim();return{normalizedTarget:t.replace(/^\.\/+/,``).replace(/^\/+/,``).replace(/\/+$/g,``),expectsFolder:/\/+$/.test(t)}}function T(e){return _(e).replace(/\/+$/g,``)}var E=/\.(md|mdx)$/i;function D(e){let t=e;for(;E.test(t);){let e=t.replace(E,``);if(!e)return t;t=e}return t}function O(e,t){let{normalizedTarget:n,expectsFolder:r}=w(e);if(r||!E.test(n))return e;let i=D(n);return t.has(n)&&!t.has(i)?e:i}function k(e){let t=new Set;for(let n of e)for(let e of y(n))t.add(e);return t}function A(e,t){if(!t)return;let n=h(e);if(n)return t.get(n)}function j(e,t){if(!t||e.includes(`/`))return;let n=h(e);if(n)return t.get(n)}function M(e,t){return t?`${e}${t}`:(e.split(`/`).pop()??``).lastIndexOf(`.`)>0?e:`${e}.md`}function N(e,t){if(!v(e)||r(e)||t.pages.has(e))return null;let n=M(e,t.docExt);return{kind:`asset`,target:n,assetPath:n,mediaKind:p(n.slice(n.lastIndexOf(`.`)+1))}}function P(e,i){let s=O(e,i.pages);if(t(s)){let e=n(s);if(e?.kind===`skill`&&e.scope===`project`){let t=l(e.name);return{kind:`doc`,target:t,docName:t}}let t=o(s);if(t){let e=g(t.folder,t.name);return{kind:`doc`,target:e,docName:e}}return{kind:`doc`,target:s,docName:s}}if(C(s))return{kind:`doc`,target:s,docName:s};let c=r(s);if(c){let e=g(c.folder,c.name);return{kind:`doc`,target:e,docName:e}}let{normalizedTarget:d,expectsFolder:f}=w(s);if(!d)return{kind:`missing`,target:d};if(!f&&(m(d)||a(d)||u(d)))return{kind:`doc`,target:d,docName:d};let p=T(s);if(!f&&p!==d&&i.pages.has(p))return{kind:`doc`,target:p,docName:p};if(!f&&i.pages.has(d))return{kind:`doc`,target:d,docName:d};if(!f){let e=A(p,i.pagesBySlug);if(e)return{kind:`doc`,target:e,docName:e}}let h=`${p}/index`;if(i.pages.has(h))return{kind:`folder-index`,target:p,folderPath:p,docName:h,noteKind:`canonical-index`};let _=p.split(`/`).pop(),v=_?`${p}/${_}`:null;if(v&&i.pages.has(v))return{kind:`folder-index`,target:p,folderPath:p,docName:v,noteKind:`legacy-folder-note`};if(!f){let e=j(p,i.pagesByBasename);if(e)return{kind:`doc`,target:e,docName:e}}if((i.folderPaths??k(i.pages)).has(p))return{kind:`folder`,target:p,folderPath:p};if(!f){let e=N(d,i);if(e)return e}return{kind:`missing`,target:p||d}}function F(e){return e.kind===`folder-index`?{kind:`folder`,target:e.folderPath,folderPath:e.folderPath}:e}function I(t,n,r=e){return typeof n!=`number`||!s(n,r)?null:{kind:`large-file`,target:t,docName:t,size:n,limit:r}}function L(t,n,r=e){return t.kind!==`doc`&&t.kind!==`folder-index`?t:I(t.docName,n.get(t.docName)?.size,r)??t}function R(e){switch(e.kind){case`doc`:case`folder-index`:case`large-file`:return e.docName;case`missing`:return e.target;case`asset`:case`skill-file`:case`skills`:case`skill-preview`:case`folder`:return null}}export{N as a,C as c,I as i,S as l,R as n,P as o,F as r,L as s,k as t,b as u};
@@ -1 +0,0 @@
1
- import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{On as a,kn as o,oa as s}from"./dist-75Tp0j2s.js";import{t as ee}from"./dist-Cr4-nBVI.js";import{v as te}from"./documents-events-DvTemRtX.js";import{t as c}from"./parse-api-error-BtEdpaFC.js";import{t as l}from"./createLucideIcon-B6ULg5PN.js";import{r as ne}from"./startup-marks-DkofILWo.js";import{t as re}from"./navigation-targets-CLA-LGSO.js";import{r as ie,t as ae}from"./page-list-cache-DmQP_SV8.js";import{t as u}from"./documents-fetch-sbhR-qg0.js";var d=l(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),f=l(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),p=e(r(),1),oe=i();function m(e,t){let n=!1,r=!1,i=!1;async function a(){if(!i){n=!0;try{await e()}finally{n=!1,i?r=!1:r&&(r=!1,a())}}}return{request(){if(!i){if(n){r=!0,t?.();return}a()}},dispose(){i=!0,r=!1,t?.()}}}var se=n(),h=(0,p.createContext)(null);function ce(e,t){if(t.size===0)return new Set(e);let n=new Set(e);for(let e of t)n.add(e);return n}function le(e,t){if(e.size===0)return new Set;let n=new Set;for(let r of e)t.has(r)||n.add(r);return n}function ue(e,t){let n=new Map(e);for(let e of t)n.has(e)||n.set(e,e);return n}async function de(){let e=await fetch(`/api/pages`);if(!e.ok){let t=await e.json().catch(()=>null);throw Error(c(t)??`/api/pages responded with ${e.status}`)}let t=await e.json();return Array.isArray(t.pages)?t.pages:[]}async function fe(){let{ok:e,status:t,body:n}=await u();if(!e)throw Error(c(n)??`/api/documents responded with ${t}`);let r=n??{};return Array.isArray(r.documents)?{assetPaths:r.documents.filter(e=>e.kind===`asset`&&typeof e.path==`string`&&e.path.length>0).map(e=>e.path),folderPaths:r.documents.filter(e=>e.kind===`folder`&&typeof e.path==`string`&&e.path.length>0).map(e=>e.path),filePaths:r.documents.filter(e=>e.kind===`file`&&typeof e.path==`string`&&e.path.length>0).map(e=>e.path)}:{assetPaths:[],folderPaths:[],filePaths:[]}}function pe(e){console.error(`[PageListContext] Failed to load pages:`,e)}function g(e){console.warn(`[PageListContext] Failed to load referenced assets:`,e)}function _(e){let t=(0,oe.c)(54),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Set,t[0]=r):r=t[0];let[i,c]=(0,p.useState)(r),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=new Map,t[1]=l):l=t[1];let[u,d]=(0,p.useState)(l),f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=new Map,t[2]=f):f=t[2];let[g,_]=(0,p.useState)(f),v;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(v=new Set,t[3]=v):v=t[3];let[y,b]=(0,p.useState)(v),x;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(x=new Set,t[4]=x):x=t[4];let[S,C]=(0,p.useState)(x),w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=new Set,t[5]=w):w=t[5];let[T,ve]=(0,p.useState)(w),E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=new Set,t[6]=E):E=t[6];let[D,O]=(0,p.useState)(E),[k,ye]=(0,p.useState)(!0),[A,j]=(0,p.useState)(null),M=(0,p.useRef)(0),N;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(N=function(){let e=M.current+=1;return Promise.all([de(),fe().catch(_e)]).then(t=>{let[n,r]=t;if(e!==M.current)return;let i=new Set(n.map(ge));c(i),d(new Map(n.map(he))),_(new Map(n.map(me))),b(new Set(r.assetPaths)),C(new Set(r.folderPaths)),ve(new Set(r.filePaths)),O(e=>le(e,i)),j(null),ne()}).catch(t=>{e===M.current&&(pe(t),j(t instanceof Error?t.message:ee._({id:`9Y6cCI`})))}).finally(()=>{e===M.current&&ye(!1)})},t[7]=N):N=t[7];let P=N,F;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){O(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n}),j(null)},t[8]=F):F=t[8];let I=F,L,R;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{let e=m(P);e.request();let t=null,n=()=>{document.visibilityState===`visible`&&e.request()};window.addEventListener(`focus`,n),window.addEventListener(`visibilitychange`,n);let r=te(n=>{n.includes(`files`)&&t===null&&(t=setTimeout(()=>{t=null,e.request()},300))});return()=>{t!==null&&clearTimeout(t),e.dispose(),window.removeEventListener(`focus`,n),window.removeEventListener(`visibilitychange`,n),r()}},R=[],t[9]=L,t[10]=R):(L=t[9],R=t[10]),(0,p.useEffect)(L,R);let z,B,V,H,U,W,G,K;if(t[11]!==D||t[12]!==y||t[13]!==T||t[14]!==S||t[15]!==g||t[16]!==u||t[17]!==i){W=ce(i,D);let e;t[26]!==D||t[27]!==u?(e=ue(u,D),t[26]=D,t[27]=u,t[28]=e):e=t[28],U=e,H=g,z=y,B=T,V=new Set([...re(W),...S]),G=o(W,s),K=a(W,s),t[11]=D,t[12]=y,t[13]=T,t[14]=S,t[15]=g,t[16]=u,t[17]=i,t[18]=z,t[19]=B,t[20]=V,t[21]=H,t[22]=U,t[23]=W,t[24]=G,t[25]=K}else z=t[18],B=t[19],V=t[20],H=t[21],U=t[22],W=t[23],G=t[24],K=t[25];let q=K,J;t[29]===g?J=t[30]:(J=ae(g),t[29]=g,t[30]=J);let Y=J,X,Z;t[31]!==z||t[32]!==B||t[33]!==V||t[34]!==Y||t[35]!==W||t[36]!==q||t[37]!==G?(X=()=>{ie({pages:W,folderPaths:V,pagesBySlug:G,pagesByBasename:q,assetPaths:z,filePaths:B,pageIcons:Y})},Z=[W,V,G,q,z,B,Y],t[31]=z,t[32]=B,t[33]=V,t[34]=Y,t[35]=W,t[36]=q,t[37]=G,t[38]=X,t[39]=Z):(X=t[38],Z=t[39]),(0,p.useEffect)(X,Z);let Q;t[40]!==z||t[41]!==A||t[42]!==B||t[43]!==V||t[44]!==k||t[45]!==H||t[46]!==U||t[47]!==W||t[48]!==q||t[49]!==G?(Q={pages:W,pagesBySlug:G,pagesByBasename:q,pageTitles:U,pageMeta:H,folderPaths:V,assetPaths:z,filePaths:B,loading:k,error:A,refetch:P,addPage:I},t[40]=z,t[41]=A,t[42]=B,t[43]=V,t[44]=k,t[45]=H,t[46]=U,t[47]=W,t[48]=q,t[49]=G,t[50]=Q):Q=t[50];let $;return t[51]!==n||t[52]!==Q?($=(0,se.jsx)(h,{value:Q,children:n}),t[51]=n,t[52]=Q,t[53]=$):$=t[53],$}function me(e){return[e.docName,{size:e.size,modified:e.modified,docExt:e.docExt,icon:e.icon}]}function he(e){return[e.docName,e.title]}function ge(e){return e.docName}function _e(e){return g(e),{assetPaths:[],folderPaths:[],filePaths:[]}}function v(){let e=(0,p.use)(h);if(!e)throw Error(`usePageList must be used within <PageListProvider />`);return e}function y(){return(0,p.use)(h)}var b=t(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),x=t(((e,t)=>{var n=b();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),S=t(((e,t)=>{t.exports=x()()}));export{m as a,v as i,_ as n,f as o,y as r,d as s,S as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{$ as i}from"./dist-75Tp0j2s.js";var a=new Set(i);function o(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function s(e,t){try{let n={event:e},r=0,i=0;if(t){for(let[e,s]of Object.entries(t))if(!(e===`event`||s===void 0)){if(a.has(e)){i+=1;continue}if(!o(s)){r+=1;continue}n[e]=s}}r>0&&(n.droppedNonScalarFields=r),i>0&&(n.droppedReservedFields=i);let s=JSON.stringify(n);console.info(s.length<=4096?s:JSON.stringify({event:e,oversized:!0,fieldCount:Object.keys(n).length-1}))}catch{}}function c(e,t){return t}var l=new Set([`ok/scroll-restore`]);function u(e){let t=e.split(`/`);return t.length<2?`ok`:`${t[0]}/${t[1]}`}function d(e){if(!e)return;let t=Object.entries(e);if(t.length!==0)return t.map(([e,t])=>{if(t==null)return[e,String(t)];if(typeof t==`string`)return[e,t];if(typeof t==`number`||typeof t==`boolean`)return[e,String(t)];try{return[e,JSON.stringify(t)]}catch{return[e,`[unserializable]`]}})}function f(e,t,n){let r=u(e);if(l.has(r)&&s(e,t),typeof performance>`u`||!performance.measure)return;let i=d(t),a={devtools:{dataType:`track-entry`,track:r,...i?{properties:i}:{},...n?.tooltipText?{tooltipText:n.tooltipText}:{}}},o=performance.now(),c=n?.startTime??o,f=n?.duration??Math.max(0,o-c);try{performance.measure(e,{start:c,duration:f,detail:a})}catch{}({...t?{properties:t}:{}})}function p(e,t){}function m(e,t,n){f(e,{...t,durationMs:n},{duration:n})}var h=Object.assign(f,{count:p,histogram:m}),g=r(),_=e(n(),1),v=t();function y(e){let t=(0,g.c)(3),{name:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,v.jsx)(_.Profiler,{id:n,onRender:b,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}var b=(e,t,n,r,i,a)=>{h(`ok/render/${e}`,{phase:t,actualDuration:Math.round(n*1e3)/1e3,baseDuration:Math.round(r*1e3)/1e3},{startTime:i,duration:Math.max(0,a-i)})},x,S,C=!1,w;function T(e){if(C&&x!==void 0&&S!==void 0){e(Math.max(x,S));return}w=e}function E(){if(C||x===void 0||S===void 0)return;C=!0;let e=Math.max(x,S);(typeof window<`u`?window.okDesktop?.startup?.reportMarks:void 0)?.({pageListReadyMs:x,firstContentMs:e}),w?.(e),w=void 0}function D(){x===void 0&&(x=Date.now(),h(`ok/startup/page-list-ready`),E())}function O(){S===void 0&&(S=Date.now(),h(`ok/startup/first-content`),E())}export{h as a,y as i,T as n,c as o,D as r,s,O as t};
@@ -1,8 +0,0 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{$n as n,Bt as r,Cn as i,Pn as a,R as o,Rn as s,Tn as c,Un as l,hi as u,i as d,mn as f,vi as p,vr as m,wr as h,zt as g}from"./DocumentContext-TAFDDp6U.js";import{t as _}from"./react-f2sANaYj.js";import{n as v,r as y}from"./dist-Nvb76hAm.js";import{r as b,t as x}from"./useQuery-ZeEDLtxh.js";import{t as S}from"./compiler-runtime-BfE3aGVn.js";import{t as C}from"./utils-CPqDy6Hr.js";import{t as w}from"./button-Cym3gapE.js";import{i as T,n as E,t as D}from"./tooltip-BnyyQDRs.js";import{n as O,r as k,t as A}from"./collapsible-DYySK8La.js";import{n as j,t as M}from"./toggle-group-C2_37kV5.js";import{$s as N,Bs as P,Ct as F,Dt as I,Es as L,R as ee,Zo as R,ar as z,dn as B,ir as V,qi as H,un as U}from"./dist-75Tp0j2s.js";import{n as W}from"./dist-CJhtNlOm2.js";import{s as G}from"./use-settings-route-BxaIY7g8.js";import{t as K}from"./dist-Cr4-nBVI.js";import{f as q,v as J}from"./documents-events-DvTemRtX.js";import{t as te}from"./note-window-mode-CsmLTxU_.js";import{t as Y}from"./createLucideIcon-B6ULg5PN.js";import{t as X}from"./chevron-right-C-g4JuT4.js";import{n as ne,t as re}from"./lint-plugin-meta-zA9wHIBR.js";import{n as ie}from"./upload-DGQJhdiQ.js";import{i as ae,r as oe}from"./prop-types-Cz_4UFXS.js";import{Et as se,Ot as ce,S as le,X as ue,jt as de,rt as fe}from"./CodeMirrorPropInput-Cmq0OheO.js";import{t as pe}from"./info-CilGMBpP.js";import{t as me}from"./refresh-cw-DisV0kHO.js";import{t as he}from"./sparkles-CKoBZZKl.js";import{t as ge}from"./triangle-alert-CCeXtPLU.js";import{t as _e}from"./wrench-Cjhn9plF.js";import{l as ve,s as ye}from"./doc-hash-0sJsliMq.js";import{a as be,i as xe,s as Se}from"./startup-marks-DkofILWo.js";import{b as Ce,w as we}from"./config-provider-CL2LHJwy.js";import{J as Te,K as Ee,Mt as De,Nt as Oe,X as ke,wt as Ae}from"./dist-AflZtDqw.js";import{t as je}from"./badge-Dk9RrOMI.js";import{a as Me,c as Ne,i as Pe,n as Fe,r as Ie,s as Le,t as Re}from"./panel-YWvIeRKP.js";import{t as ze}from"./skeleton-DPvIu5NU.js";import{a as Be,c as Ve,d as He}from"./lint-config-client-D_K_I33M.js";var Ue=Y(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),We=56,Ge=2,Ke=150,qe=2e3;function Je(e,t,n){return e.top+e.height/2-(n+t)/2}function Ye(e,t){let n=Math.max(0,t.scrollHeight-t.clientHeight);return Math.max(0,Math.min(e,n))}function Xe(e){let{docName:t,container:n,measureTarget:r,placement:i,intent:o,grade:c,landedMode:u,transition:d,onOutcome:f,onDiscardQueuedTarget:p,toolbarOffset:m=We,driftThresholdPx:h=Ge,quietMs:g=Ke,abandonAfterMs:_=qe}=e,v=e.contentColumn??n.firstElementChild,y=a(t,`landing`),b=s(t,{yieldsToNavigation:o===`toggle`,supersede:()=>P(`superseded`)}),x=n.style.overflowAnchor;n.style.overflowAnchor=`none`,d&&be(`ok/mode-switch/transition`,{from:d.from,to:d.to,grade:c});let S=!1,C=null,w,T,E=0,D,O=()=>{let e=r();return e===null?null:Ye(i===`center`?Je(e,n.clientHeight,m):e.top-m,n)},k=()=>{let e=O();if(e===null)return{measurable:!1,moved:!1};C=e;let t=Math.abs(n.scrollTop-e)>h;return t&&(n.scrollTop=e),{measurable:!0,moved:t}},A=()=>n.scrollTop-(O()??C??n.scrollTop),j=()=>{w&&clearTimeout(w),T&&clearTimeout(T),E&&cancelAnimationFrame(E),D?.disconnect(),n.removeEventListener(`wheel`,I),n.removeEventListener(`touchstart`,I),n.removeEventListener(`contentvisibilityautostatechange`,L,!0),n.style.overflowAnchor=x,y.release(),b.release()},M=()=>{if(S)return;S=!0;let e;try{k(),e=A(),C!==null&&l({docName:t,container:n,targetScrollTop:n.scrollTop,mode:u})}finally{j()}be(`ok/landing/land`,{grade:c,delta:e}),f?.({status:`landed`,delta:e})},N=()=>{if(S)return;S=!0;let e=C??n.scrollTop,t;try{t=A()}finally{j()}be(`ok/landing/abandoned`,{grade:c,target:e,delta:t}),f?.({status:`abandoned`,delta:t})},P=e=>{S||(S=!0,j(),e===`mode-flip`&&p?.(),f?.({status:`cancelled`,reason:e}))},F=()=>{w&&clearTimeout(w),w=setTimeout(M,g)};function I(){P(`user-scroll`)}function L(){if(S)return;let{measurable:e,moved:t}=k();e&&(t||w===void 0)&&F()}try{k().measurable&&F(),n.addEventListener(`contentvisibilityautostatechange`,L,!0),n.addEventListener(`wheel`,I,{passive:!0}),n.addEventListener(`touchstart`,I,{passive:!0}),typeof ResizeObserver<`u`&&v&&(D=new ResizeObserver(L),D.observe(v)),E=requestAnimationFrame(L),T=setTimeout(N,_)}catch(e){throw S=!0,j(),e}return{cancel:P}}function Ze(e){switch(e){case`bulletList`:case`orderedList`:case`taskList`:case`list`:return`list`;case`codeBlock`:case`code`:return`code`;case`horizontalRule`:case`thematicBreak`:return`thematicBreak`;case`jsxComponent`:case`mdxJsxFlowElement`:case`mdxJsxTextElement`:return`jsx`;case`htmlBlock`:case`html`:return`html`;default:return e}}function Qe(e){return typeof e!=`object`||!e?``:`value`in e&&typeof e.value==`string`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map(Qe).join(``):``}function $e(e,t){let{frontmatter:n,body:r}=N(e),i=n===``?0:n.split(`
2
- `).length-1;try{return{blocks:t.parseToEditorMdast(r).children.map(e=>({start:(e.position?.start.line??1/0)+i,end:(e.position?.end.line??-1/0)+i,kind:Ze(e.type),text:Qe(e)})),fmLineCount:i}}catch{return performance.mark(`ok/block-spans/parse-failed`),{blocks:[],fmLineCount:i}}}function et(e,t){let{blocks:n,fmLineCount:r}=$e(e,t);return{spans:n.map(e=>({start:e.start,end:e.end})),fmLineCount:r}}function tt(e,t){if(e.length===0)return null;let n=0,r=e.length-1,i=e.length-1;for(;n<=r;){let a=n+r>>1,o=e[a];o!==void 0&&o.end>=t?(i=a,r=a-1):n=a+1}return i}function nt(e){let t=0;for(let n=e.childCount-1;n>=0;n--){let r=e.child(n);if(r.type.name!==`paragraph`||r.content.size!==0)break;t++}return t===e.childCount?0:e.childCount}function rt(e,t,n){let r=e.childCount,i=Math.max(0,Math.min(t,r)),a=Math.max(i,Math.min(n,r));if(a<=i)return null;let o=0;for(let t=0;t<i;t++)o+=e.child(t).nodeSize;let s=o;for(let t=i;t<a;t++)o+=e.child(t).nodeSize;let c=o,l=e.content.size,u=Math.max(0,Math.min(s,l)),d=Math.max(u,Math.min(c,l));return d<=u?null:{from:u,to:d}}function it(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
3
- `&&t.push(n+1);return t}function at(e,t,n){return t<=1?0:t-1>=e.length?n:e[t-1]??n}function ot(e,t){let n=0,r=e.length-1,i=1;for(;n<=r;){let a=n+r>>1;(e[a]??0)<=t?(i=a+1,n=a+1):r=a-1}return i}function st(e,t,n){return Math.max(t,Math.min(e,n))}function ct(e,t){let n=e=>e.replace(/\s+/g,` `).trim();return n(e)===n(t)}function lt(e,t){return t.inRange?t.tripwireOk?ct(e.content,t.text)?`exact`:e.kind===t.kind?`same-type-ordinal`:`ordinal`:`ordinal`:`clamped`}function ut(e){let t=null,n=null;function r(r){return n!==null&&t===r?n:(n={blocks:$e(r,e).blocks,lineStarts:it(r)},t=r,n)}return{captureFromWysiwyg(e,t,n){if(e.childCount===0)return null;let r=st(t,0,e.content.size),i=0,a=e.childCount-1,o=0;for(let t=0;t<e.childCount;t++){let n=e.child(t).nodeSize;if(r<i+n){a=t,o=i+1;break}i+=n,o=i+1}let s=e.child(a),c={blockIndex:a,kind:Ze(s.type.name),content:s.textContent};return n?.refine&&(c.selectionInBlock=Math.max(0,r-o)),c},captureFromSource(e,t,n){let{blocks:i,lineStarts:a}=r(e);if(i.length===0)return null;let o=st(t,0,e.length),s=tt(i,ot(a,o));if(s===null)return null;let c=i[s];if(!c)return null;let l={blockIndex:s,kind:c.kind,content:c.text};if(n?.refine){let t=at(a,c.start,e.length);l.selectionInBlock=Math.max(0,o-t)}return l},resolveInSource(e,{source:t,doc:n}){let{blocks:i,lineStarts:a}=r(t);if(i.length===0)return null;let o=e.blockIndex>=0&&e.blockIndex<i.length,s=nt(n)===i.length,c=i[st(e.blockIndex,0,i.length-1)],l=at(a,c.start,t.length),u=Math.min(at(a,c.end+1,t.length),t.length),d=lt(e,{inRange:o,tripwireOk:s,kind:c.kind,text:c.text}),f=l;return d===`exact`&&e.selectionInBlock!==void 0&&(f=st(l+e.selectionInBlock,l,u)),{blockStart:l,blockEnd:u,point:f,confidence:d}},resolveInWysiwyg(e,{source:t,doc:n}){let i=nt(n);if(i===0)return null;let{blocks:a}=r(t),o=e.blockIndex>=0&&e.blockIndex<i,s=i===a.length,c=st(e.blockIndex,0,i-1),l=rt(n,c,c+1);if(l===null)return null;let u=n.child(c),d=lt(e,{inRange:o,tripwireOk:s,kind:Ze(u.type.name),text:u.textContent});return{blockStart:l.from,blockEnd:l.to,point:l.from,confidence:d}}}}var dt=De.define(),ft=De.define(),pt=Ee.mark({class:g}),mt=Oe.define({create(){return Ee.none},update(e,t){let n=e.map(t.changes);for(let e of t.effects)e.is(dt)?n=Ee.set([pt.range(e.value.from,e.value.to)]):e.is(ft)&&(n=Ee.none);return n},provide:e=>Te.decorations.from(e)}),ht=new WeakMap,gt=ke.define(e=>({destroy(){let t=ht.get(e);t!==void 0&&(clearTimeout(t),ht.delete(e))}}));function _t(e,t,n,i){let a=r(e.state.doc.length,t,n,i);if(!a)return;e.dispatch({effects:dt.of(a)});let o=ht.get(e);o!==void 0&&clearTimeout(o);let s=setTimeout(()=>{ht.delete(e),e.dispatch({effects:ft.of(null)})},ee);ht.set(e,s)}function vt(){return[mt,gt]}var yt=3e4;function bt(){let e=new Map,t=e=>e?Date.now()-e.rememberedAt>yt?null:e.navigation:null;return{remember(t,n){e.set(t,{navigation:n,rememberedAt:Date.now()})},peek(n){return t(e.get(n))},consume(n){let r=e.get(n);return e.delete(n),t(r)},clear(t){e.delete(t)},clearForTest(){e.clear()}}}var xt=bt(),St=bt(),Ct=xt.remember,wt=xt.peek,Tt=xt.consume,Et=xt.clear;xt.clearForTest;var Dt=St.remember,Ot=St.peek,kt=St.consume,At=St.clear;St.clearForTest;function jt(e,t,n){return{start:we(e,t),end:we(e,n)}}function Mt(e,t){let n=Ce(e.start,t),r=Ce(e.end,t);return n===null||r===null||r.index<=n.index?null:n.index}var Nt=`open-knowledge:view-in-source`,Pt=null;function Ft(){return Pt??=ut(ue()),Pt}function It(e,t,n,r,i=`toggle`){let a=r.captureFromWysiwyg(e,t,{refine:i===`jump`});if(!a)return null;let o=r.resolveInSource(a,{source:n.toString(),doc:e});return{kind:`selection-offset`,intent:i,anchor:a,pin:o?jt(n,o.blockStart,o.blockEnd):void 0}}function Lt(e){let{editor:t,docName:n,ytext:r}=e,i=se(t);if(!i)return;let a=i.state.selection.from,o=It(i.state.doc,a,r,Ft(),`jump`);o&&Ct(n,o),window.dispatchEvent(new CustomEvent(Nt,{detail:{docName:n}}))}function Rt(e,t,n,r,i){let a=r.captureFromSource(e,t);if(!a)return null;let o=i?r.resolveInSource(a,{source:e,doc:i}):null;return{kind:`selection-offset`,anchor:a,pin:o?jt(n,o.blockStart,o.blockEnd):void 0}}function zt(e,t){let{source:n,pmDoc:r,ydoc:i,resolver:a}=t;if(e.pin){let t=Mt(e.pin,i);if(t===null){let t=a.resolveInWysiwyg(e.anchor,{source:n,doc:r});return t?{...t,point:t.blockStart,confidence:`clamped`}:null}let o=a.captureFromSource(n,t);if(o)return a.resolveInWysiwyg(o,{source:n,doc:r})}return a.resolveInWysiwyg(e.anchor,{source:n,doc:r})}function Bt(e,t){let{source:n,pmDoc:r,ydoc:i,resolver:a}=t;if(e.pin){let t=Mt(e.pin,i);if(t===null){let t=a.resolveInSource(e.anchor,{source:n,doc:r});return t?{...t,point:t.blockStart,confidence:`clamped`}:null}let o=a.captureFromSource(n,t);if(o)return a.resolveInSource(o,{source:n,doc:r})}return a.resolveInSource(e.anchor,{source:n,doc:r})}function Vt(e,t){try{return e.coordsAtPos(t)}catch{return null}}function Ht(e,t,n){let r=Math.max(0,Math.min(n,e.state.doc.length)),i=t.getBoundingClientRect().top,a=Vt(e,r);if(a)return{top:a.top-i+t.scrollTop,height:a.bottom-a.top};try{let n=e.lineBlockAt(r);return{top:e.documentTop-i+t.scrollTop+n.top,height:n.height}}catch{return null}}function Ut(e,t){if(e.isDestroyed)return null;try{let n=e.nodeDOM(t);if(n instanceof HTMLElement)return n;let{node:r}=e.domAtPos(t);return r instanceof HTMLElement?r:r.parentElement}catch{return null}}function Wt(e,t,n){if(e.isDestroyed)return null;let r=Ut(e,Math.max(0,Math.min(n,e.state.doc.content.size)));if(!r)return null;let i=r.getBoundingClientRect(),a=t.getBoundingClientRect().top;return{top:i.top-a+t.scrollTop,height:i.height}}function Gt(){return typeof document>`u`?null:f()}function Kt(e,t){let n=t.getBoundingClientRect(),r=n.left+n.width/2,i=le();for(let t of[i+1,i+12,i+40]){let i=e.posAtCoords({left:r,top:n.top+t});if(i)return i.pos}return null}function qt(e,t){let n=t.getBoundingClientRect(),r=n.left+n.width/2,i=le();for(let t of[i+1,i+12,i+40]){let i=e.posAtCoords({x:r,y:n.top+t});if(i!==null)return i}return null}function Jt(e){let{from:t,to:n,docName:r,ytext:i}=e;t===`wysiwyg`&&n===`source`?Yt(r,i):t===`source`&&n===`wysiwyg`&&Xt(r,i)}function Yt(e,t){let r=wt(e);if(r&&r.kind!==`selection-offset`)return;let i=n(e);if(!i)return;let a=se(i);if(!a)return;let o=Gt();if(!o)return;let s=Kt(a,o);if(s===null)return;let c=It(a.state.doc,s,t,Ft());c&&Ct(e,c)}function Xt(e,t){let r=i(e);if(!r)return;let a=Gt();if(!a)return;let o=qt(r,a);if(o===null)return;let s=n(e),c=s?se(s)?.state.doc:void 0,l=Rt(t.toString(),o,t,Ft(),c);l&&Dt(e,l)}function Zt(e){let{view:t,docName:r,navigation:i,ydoc:a,transition:o}=e,c=n(r),l=c?se(c)?.state.doc:void 0;if(!l)return null;let u=Bt(i,{source:t.state.doc.toString(),pmDoc:l,ydoc:a,resolver:Ft()});if(!u)return null;let d=Gt();if(!d)return null;let f=u,p=i.intent===`jump`,m=p?f.point:f.blockStart;t.dispatch({effects:Te.scrollIntoView(m,{y:`start`})});let h=!1,g=null,_=s(r,{yieldsToNavigation:!p,supersede:()=>{h=!0,_.release()}}),v=e=>{if(!h){if(Vt(t,m)===null&&e<8){requestAnimationFrame(()=>v(e+1));return}try{p&&(t.dispatch({selection:Ae.cursor(m)}),t.focus())}finally{_.release()}g=Xe({docName:r,container:d,contentColumn:t.contentDOM,measureTarget:()=>Ht(t,d,m),placement:p?`center`:`top`,intent:p?`jump`:`toggle`,grade:f.confidence,landedMode:`source`,transition:o,toolbarOffset:le(),onOutcome:p?e=>{e.status===`landed`&&_t(t,f.blockStart,f.blockEnd,f.confidence)}:void 0,onDiscardQueuedTarget:()=>Et(r)})}};return v(0),{cancel:e=>{h=!0,_.release(),g?.cancel(e)}}}function Qt(e){let{editor:t,docName:n,navigation:r,ydoc:i,transition:a}=e,o=se(t);if(!o)return null;let s=zt(r,{source:i.getText(`source`).toString(),pmDoc:o.state.doc,ydoc:i,resolver:Ft()});if(!s)return null;let c=Gt();if(!c)return null;let l=s;return Xe({docName:n,container:c,contentColumn:o.dom,measureTarget:()=>Wt(o,c,l.point),placement:`top`,intent:`toggle`,grade:l.confidence,landedMode:`wysiwyg`,transition:a,toolbarOffset:le(),onDiscardQueuedTarget:()=>At(n)})}var $t={words:0,chars:0,tokens:0},en=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,tn=/[\p{L}\p{N}]/u,nn=new Set([`text`,`inlineCode`,`code`,`tag`]),rn=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),an=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function on(e,t){if(!e)return;let n=e.type;if(!rn.has(n)){if(nn.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
4
- `));return}if(n===`wikiLink`||n===`wikiLinkEmbed`){let n=e.data?.alias??e.value??``;n&&t.push(n);return}if(Array.isArray(e.children)){for(let n of e.children)on(n,t);if(an.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`
5
- `)&&t.push(`
6
- `)}}}}function sn(e){try{let t=ue().parseToMdast(e),n=[];return on(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function cn(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))tn.test(n)&&t++;return t}function ln(e){let t=globalThis.Intl.Segmenter;if(!t)return cn(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function un(e){let t=en.test(e)?1.5:4;return Math.ceil(e.length/t)}function dn(e){return e?{words:en.test(e)?ln(e):cn(e),chars:e.length,tokens:un(e)}:{words:0,chars:0,tokens:0}}function fn(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=N(e);return t.trim()?dn(sn(t)):{words:0,chars:0,tokens:0}}function pn(e){return dn(e)}function mn(e,{isMarkdown:t}){let n=e.trim();return n?dn(t?sn(e):n):$t}function hn(e,t){return e!==null&&R(e)?`source`:t}var gn=new Map,_n=new Set,vn=(e,t)=>`${t}:${e}`;function yn(){for(let e of _n)e()}function bn(e,t,n){let r=vn(e,t);if(n===null){gn.delete(r)&&yn();return}let i=gn.get(r);i&&i.words===n.words&&i.chars===n.chars&&i.tokens===n.tokens||(gn.set(r,n),yn())}function xn(e,t){return e===null?null:gn.get(vn(e,t))??null}function Sn(e){return _n.add(e),()=>{_n.delete(e)}}function Cn(e){let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
7
- `,` `);return i.trim()?mn(i,{isMarkdown:!1}):null}function wn(e){let t=[];for(let n of e.state.selection.ranges)n.empty||t.push(e.state.sliceDoc(n.from,n.to));if(t.length===0)return null;let n=t.join(`
8
- `);return n.trim()?mn(n,{isMarkdown:!0}):null}var Z=e(_(),1),Q=S(),$=t();function Tn(e){let t=(0,Q.c)(14),{scope:n,onScopeChange:r,projectLabel:i}=e,{_:a}=y(),o;t[0]===r?o=t[1]:(o=e=>{e&&r(e)},t[0]=r,t[1]=o);let s;t[2]===a?s=t[3]:(s=a({id:`aBgwis`}),t[2]=a,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(j,{value:`doc`,className:`flex-1`,"data-testid":`panel-scope-doc`,children:(0,$.jsx)(v,{id:`UpCz01`})}),t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=i??(0,$.jsx)(v,{id:`ZWyHmq`}),t[5]=i,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,$.jsx)(j,{value:`project`,className:`flex-1`,"data-testid":`panel-scope-project`,children:l}),t[7]=l,t[8]=u);let d;return t[9]!==n||t[10]!==o||t[11]!==s||t[12]!==u?(d=(0,$.jsx)(`div`,{className:`shrink-0 px-4 pb-2`,children:(0,$.jsxs)(M,{type:`single`,variant:`segmented`,size:`sm`,spacing:1,value:n,onValueChange:o,"aria-label":s,className:`w-full rounded-md bg-muted p-0.5 dark:bg-background`,children:[c,u]})}),t[9]=n,t[10]=o,t[11]=s,t[12]=u,t[13]=d):d=t[13],d}function En(e){let t=e.localTarget;if(e.source!==`links`||t===void 0)return e.message;let n=t.resolvedTarget??t.href;return t.reason===`unresolvable`?t.role===`image`?K._({id:`W5qdI_`,values:{shown:n}}):K._({id:`bpMVIA`,values:{shown:n}}):t.targetKind===`file`?t.role===`image`?K._({id:`iSWh95`,values:{shown:n}}):K._({id:`fOzzSV`,values:{shown:n}}):K._({id:`XBBZnv`,values:{shown:n}})}var Dn=`audit-superseded`;async function On(e={kind:`project`},t){return An(e,B,!1,t)}async function kn(e={kind:`project`},t){return An(e,U,!0,t)}async function An(e,t,n,r){try{let i=new URLSearchParams;e.kind===`path`?i.set(`path`,e.path):e.kind===`doc`&&i.set(`doc`,e.docName),n&&i.set(`counts`,`1`);let a=i.size===0?``:`?${i}`,o=await fetch(`/api/audit${a}`,r===void 0?void 0:{signal:r});if(!o.ok)return o.status===409?Dn:(console.warn(`[audit] request failed`,o.status,o.statusText),null);let s;try{s=await o.json()}catch{return r?.aborted===!0||console.warn(`[audit] response body is not valid JSON`),null}let c=t.safeParse(s);return c.success?c.data:(console.warn(`[audit] response failed schema validation`,c.error.issues),null)}catch(e){return r?.aborted===!0||console.warn(`[audit] fetch threw`,e),null}}function jn(e,t){let n=!1,r=!1,i=!1,a=[],o,s=null,c=()=>({findings:a,...o===void 0?{}:{brokenLinkSuppression:o}}),l=()=>{if(r){i=!0;return}r=!0,s=new AbortController,t({status:`loading`,...c()}),On({kind:`doc`,docName:e},s.signal).then(e=>{if(!(n||s?.signal.aborted===!0)){if(e===null){t({status:`failed`,...c()});return}if(e===`audit-superseded`){i=!0;return}i||(a=e.files.flatMap(e=>e.diagnostics).filter(e=>e.source===`links`),o=e.brokenLinkSuppression,t({status:`loaded`,...c()}))}}).finally(()=>{n||(r=!1,s=null,i&&(i=!1,l()))})};l();let u=J(e=>{(e.includes(`backlinks`)||q(e))&&l()}),d=Ve(l);return()=>{n=!0,s?.abort(),u(),d()}}function Mn(e){let t=(0,Q.c)(6),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={docName:null,state:{status:`idle`,findings:[]}},t[0]=n):n=t[0];let[r,i]=(0,Z.useState)(n),a,o;if(t[1]===e?(a=t[2],o=t[3]):(a=()=>{if(e===null){i({docName:null,state:{status:`idle`,findings:[]}});return}return i({docName:e,state:{status:`loading`,findings:[]}}),jn(e,t=>i({docName:e,state:t}))},o=[e],t[1]=e,t[2]=a,t[3]=o),(0,Z.useEffect)(a,o),r.docName!==e){let n;return t[4]===e?n=t[5]:(n=e===null?{status:`idle`,findings:[]}:{status:`loading`,findings:[]},t[4]=e,t[5]=n),n}return r.state}function Nn(e){return Math.min(50,Math.max(1,Math.ceil(e/10)))}function Pn(e,t){return e===t||e%Nn(t)===0}var Fn=[250,500,1e3,2e3,4e3];function In(e){return e.status===503&&e.problemType===`urn:ok:error:too-many-agent-sessions`}async function Ln(e,t){let n=await t.fixItem(e);for(let r of Fn){if(n.ok||!In(n)||!t.shouldContinue()||(console.debug(`[sweep] capacity refusal, backing off %dms`,r),await t.sleep(r),!t.shouldContinue()))break;n=await t.fixItem(e)}return n}async function Rn(e){let t=e.items.length,n=[];for(let[r,i]of e.items.entries()){if(r>0&&(await e.sleep(15),!e.shouldContinue()))return{failures:n,cancelled:!0};let a=await Ln(i,e);if(a.ok||n.push({item:i,detail:a.errorDetail}),!e.shouldContinue())return{failures:n,cancelled:!0};let o=r+1;Pn(o,t)&&e.onProgress(o,t)}return{failures:n,cancelled:!1}}function zn(e){return new Promise(t=>setTimeout(t,e))}var Bn=null,Vn=!1,Hn=new Set,Un=new Set;function Wn(e){Bn=e;for(let e of Hn)e()}function Gn(e){return Hn.add(e),()=>{Hn.delete(e)}}function Kn(){return Bn}function qn(){return(0,Z.useSyncExternalStore)(Gn,Kn,Kn)}function Jn(e){return Un.add(e),()=>{Un.delete(e)}}function Yn(){Vn=!0}function Xn(e,t,n){if(e.length>0&&(console.warn(`[lint] fix-all: ${e.length} of ${n} files failed`,e.map(e=>({file:e.item.file,detail:e.detail}))),!t)){let t=e[0];W.error(K._({id:`se-tU0`,values:{0:e.length,total:n}}),{description:t===void 0?void 0:`${t.item.file}${t.detail===null?``:` — ${t.detail}`}`})}if(t){W.info(K._({id:`H1TmTu`}));return}e.length===0&&W.success(K._({id:`SWX1O7`,values:{total:n}}))}async function Zn({items:e,fixItem:t,sleep:n=zn}){if(Bn!==null||e.length===0)return;let r=e.length;Vn=!1,Wn({done:0,total:r});let i=[],a=!1,o=!1;try{let o=await Rn({items:e,fixItem:t,sleep:n,onProgress:e=>Wn({done:e,total:r}),shouldContinue:()=>!Vn});i=o.failures,a=o.cancelled}catch(e){console.warn(`[lint] fix-all: sweep threw`,e),o=!0}finally{Wn(null)}try{o?W.error(K._({id:`vwV-kH`})):Xn(i,a,r)}finally{for(let e of Un)e()}}var Qn={errorCount:0,warningCount:0},$n=new Map,er=new Set,tr=new Map;function nr(){let e=new Map;for(let[t,n]of $n){let r=n.lint.errorCount+n.links.errorCount,i=n.lint.warningCount+n.links.warningCount;r===0&&i===0||e.set(t,{errorCount:r,warningCount:i})}tr=e;for(let e of er)e()}var rr=V;function ir(e){return er.add(e),()=>{er.delete(e)}}function ar(){return tr}function or(e){$n.clear();for(let t of e)$n.set(ye(t.file),rr(t.diagnostics));nr()}function sr(e){$n.clear();for(let t of e)$n.set(ye(t.file),{lint:t.lint,links:t.links});nr()}function cr(e,t){$n.set(e,rr(t)),nr()}function lr(e,t,n){let r=$n.get(e)??{lint:Qn,links:Qn},i=r[t];i.errorCount===n.errorCount&&i.warningCount===n.warningCount||($n.set(e,{...r,[t]:n}),nr())}var ur=`open-knowledge:lint-nav`;function dr(e,t){return e.range.start.line-t.range.start.line||e.range.start.character-t.range.start.character}function fr(e,t){return{docName:e,line:t.range.start.line+1,column:t.range.start.character+1,source:t.source,...t.frontmatterScope===void 0?{}:{frontmatterScope:t.frontmatterScope}}}function pr(e){if(e.source!==`links`)return null;let t=e.localTarget;return t===void 0?`document`:t.role===`image`?`image`:t.targetKind===`file`?`file`:t.targetKind===`document`?`document`:`unresolvable`}var mr={document:m,file:h,image:ce,unresolvable:m};function hr(e){return e.linkTarget!==void 0&&pr(e)===`document`}function gr(e){let t=(0,Q.c)(40),{diagnostic:n,instanceCount:r}=e,{_:i}=y(),a=n.severity===`error`?ie:ge,o=n.range.start.line+1,s;t[0]===n?s=t[1]:(s=pr(n),t[0]=n,t[1]=s);let c=s,l=c===null?null:mr[c],u=r!==void 0&&r>1,d=n.severity===`error`?`text-destructive`:`text-amber-500`,f;t[2]===d?f=t[3]:(f=C(`mt-0.5 size-3.5 shrink-0`,d),t[2]=d,t[3]=f);let p;t[4]!==a||t[5]!==f?(p=(0,$.jsx)(a,{"aria-hidden":`true`,className:f}),t[4]=a,t[5]=f,t[6]=p):p=t[6];let m;t[7]===n?m=t[8]:(m=En(n),t[7]=n,t[8]=m);let h;t[9]===m?h=t[10]:(h=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 text-foreground`,children:m}),t[9]=m,t[10]=h);let g;t[11]!==u||t[12]!==r?(g=u?(0,$.jsxs)(`span`,{className:`mt-0.5 flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(je,{variant:`gray`,"data-testid":`problems-instance-count`,className:`h-4 px-1 font-sans text-[10px] leading-none`,children:(0,$.jsx)(v,{id:`iZCZmF`,values:{instanceCount:r}})}),(0,$.jsx)(X,{"aria-hidden":`true`,className:`size-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`})]}):null,t[11]=u,t[12]=r,t[13]=g):g=t[13];let _;t[14]!==p||t[15]!==h||t[16]!==g?(_=(0,$.jsxs)(`span`,{className:`flex items-start gap-1.5 text-sm`,children:[p,h,g]}),t[14]=p,t[15]=h,t[16]=g,t[17]=_):_=t[17];let b=c??void 0,x=l!==null&&`gap-0.5`,S;t[18]===x?S=t[19]:(S=C(`h-4 shrink-0 px-1 font-sans text-[10px] uppercase leading-none`,x),t[18]=x,t[19]=S);let w;t[20]===l?w=t[21]:(w=l===null?null:(0,$.jsx)(l,{"aria-hidden":`true`,className:`size-2.5`}),t[20]=l,t[21]=w);let T;t[22]!==n.source||t[23]!==S||t[24]!==w||t[25]!==b?(T=(0,$.jsxs)(je,{variant:`gray`,"data-testid":`problems-source-tag`,"data-target-kind":b,className:S,children:[w,n.source]}),t[22]=n.source,t[23]=S,t[24]=w,t[25]=b,t[26]=T):T=t[26];let E;t[27]!==i||t[28]!==n.code||t[29]!==o||t[30]!==u?(E=u?n.code:`${n.code} · ${i({id:`enPTnx`,values:{displayLine:o}})}`,t[27]=i,t[28]=n.code,t[29]=o,t[30]=u,t[31]=E):E=t[31];let D;t[32]===E?D=t[33]:(D=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:E}),t[32]=E,t[33]=D);let O;t[34]!==T||t[35]!==D?(O=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 ps-5 font-mono text-xs text-muted-foreground`,children:[T,D]}),t[34]=T,t[35]=D,t[36]=O):O=t[36];let k;return t[37]!==O||t[38]!==_?(k=(0,$.jsxs)($.Fragment,{children:[_,O]}),t[37]=O,t[38]=_,t[39]=k):k=t[39],k}function _r(e){let t=new Map;for(let n of e){let e=`${n.source}/${n.code}\u0000${n.linkTarget??``}\u0000${n.message}`,r=t.get(e);r===void 0?t.set(e,{key:e,instances:[n]}):r.instances.push(n)}return[...t.values()]}function vr(e){let t=(0,Q.c)(63),{group:n,onNavigate:r,navTitle:i,renderActions:a}=e,{_:o}=y(),s=n.instances[0],c,l,u,d,f,p,m,h;if(t[0]!==o||t[1]!==s||t[2]!==n.instances.length||t[3]!==i||t[4]!==r||t[5]!==a){h=Symbol.for(`react.early_return_sentinel`);bb0:{let e=En(s);if(n.instances.length===1){let e;t[14]!==s||t[15]!==a?(e=a(s),t[14]=s,t[15]=a,t[16]=e):e=t[16];let n=e,o;t[17]!==s||t[18]!==r?(o=()=>r(s),t[17]=s,t[18]=r,t[19]=o):o=t[19];let c;t[20]!==s||t[21]!==i?(c=i(s),t[20]=s,t[21]=i,t[22]=c):c=t[22];let l;t[23]===s?l=t[24]:(l=(0,$.jsx)(gr,{diagnostic:s}),t[23]=s,t[24]=l);let u;t[25]!==l||t[26]!==o||t[27]!==c?(u=(0,$.jsx)(`button`,{type:`button`,onClick:o,className:`flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left`,title:c,children:l}),t[25]=l,t[26]=o,t[27]=c,t[28]=u):u=t[28];let d;t[29]===n?d=t[30]:(d=n===null?null:(0,$.jsx)(`div`,{className:`absolute bottom-1 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:n}),t[29]=n,t[30]=d);let f;t[31]!==u||t[32]!==d?(f=(0,$.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[u,d]}),t[31]=u,t[32]=d,t[33]=f):f=t[33],h=f;break bb0}p=`rounded`,m=`problems-duplicate-group`,l=A,t[34]!==s||t[35]!==n.instances.length?(f=(0,$.jsx)(k,{className:`group flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:(0,$.jsx)(gr,{diagnostic:s,instanceCount:n.instances.length})}),t[34]=s,t[35]=n.instances.length,t[36]=f):f=t[36],c=O,d=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in] motion-reduce:animate-none`,u=o({id:`_Bix3-`,values:{localizedFirstMessage:e}})}t[0]=o,t[1]=s,t[2]=n.instances.length,t[3]=i,t[4]=r,t[5]=a,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];if(h!==Symbol.for(`react.early_return_sentinel`))return h;let g;if(t[37]!==o||t[38]!==n.instances||t[39]!==i||t[40]!==r||t[41]!==a){let e;t[43]!==o||t[44]!==i||t[45]!==r||t[46]!==a?(e=e=>{let t=a(e),n=e.range.start.line+1,s=En(e);return(0,$.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`flex w-full cursor-pointer rounded px-2 py-1 text-left font-mono text-xs text-muted-foreground`,title:i(e),"aria-label":o({id:`txUHO8`,values:{localizedMessage:s,displayLine:n}}),children:o({id:`enPTnx`,values:{displayLine:n}})}),t===null?null:(0,$.jsx)(`div`,{className:`absolute bottom-0.5 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:t})]},yr(e))},t[43]=o,t[44]=i,t[45]=r,t[46]=a,t[47]=e):e=t[47],g=n.instances.map(e),t[37]=o,t[38]=n.instances,t[39]=i,t[40]=r,t[41]=a,t[42]=g}else g=t[42];let _;t[48]!==u||t[49]!==g?(_=(0,$.jsx)(`ul`,{"aria-label":u,className:`flex flex-col gap-0.5 pb-1 ps-5`,"data-testid":`problems-duplicate-instances`,children:g}),t[48]=u,t[49]=g,t[50]=_):_=t[50];let v;t[51]!==c||t[52]!==d||t[53]!==_?(v=(0,$.jsx)(c,{className:d,children:_}),t[51]=c,t[52]=d,t[53]=_,t[54]=v):v=t[54];let b;t[55]!==l||t[56]!==f||t[57]!==v?(b=(0,$.jsxs)(l,{children:[f,v]}),t[55]=l,t[56]=f,t[57]=v,t[58]=b):b=t[58];let x;return t[59]!==b||t[60]!==p||t[61]!==m?(x=(0,$.jsx)(`li`,{className:p,"data-testid":m,children:b}),t[59]=b,t[60]=p,t[61]=m,t[62]=x):x=t[62],x}function yr(e){return`${e.source}/${e.code}-${e.range.start.line}-${e.range.start.character}-${e.message}`}function br(e){return e.reduce((e,t)=>e+ +((t.fixes?.length??0)>0),0)}function xr(e){let t=(0,Q.c)(11),{target:n,creating:r,disabled:i,onCreate:a}=e,{_:o}=y(),s;t[0]!==o||t[1]!==n?(s=o({id:`oWsZk8`,values:{target:n}}),t[0]=o,t[1]=n,t[2]=s):s=t[2];let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(de,{"aria-hidden":`true`,className:`size-3`}),t[3]=c):c=t[3];let l;t[4]===r?l=t[5]:(l=r?(0,$.jsx)(v,{id:`E9bKSA`}):(0,$.jsx)(v,{id:`XRuL0i`}),t[4]=r,t[5]=l);let u;return t[6]!==i||t[7]!==a||t[8]!==s||t[9]!==l?(u=(0,$.jsxs)(w,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:i,onClick:a,"aria-label":s,"data-testid":`problems-create-page`,children:[c,l]}),t[6]=i,t[7]=a,t[8]=s,t[9]=l,t[10]=u):u=t[10],u}function Sr(e){let t=(0,Q.c)(8),{tip:n,testId:r,children:i}=e,a;t[0]===i?a=t[1]:(a=(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:i})}),t[0]=i,t[1]=a);let o;t[2]!==r||t[3]!==n?(o=(0,$.jsx)(E,{"data-testid":r,children:n}),t[2]=r,t[3]=n,t[4]=o):o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(D,{children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Cr(e){let t=(0,Q.c)(21),{count:n,problemCount:r,aiAvailable:i,disabled:a,onClick:o,children:s}=e,{_:c}=y(),l;t[0]!==i||t[1]!==n||t[2]!==r?(l=n>0?(0,$.jsx)(v,{id:`vjwsDi`,values:{count:n}}):r===0?(0,$.jsx)(v,{id:`gAhHu7`}):i?(0,$.jsx)(v,{id:`zA9zRL`}):(0,$.jsx)(v,{id:`X3MMeA`}),t[0]=i,t[1]=n,t[2]=r,t[3]=l):l=t[3];let u;t[4]!==c||t[5]!==s||t[6]!==n||t[7]!==r?(u=s===void 0?r===0?c({id:`4m-xuX`}):n===0?c({id:`SqIoy_`}):void 0:void 0,t[4]=c,t[5]=s,t[6]=n,t[7]=r,t[8]=u):u=t[8];let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),t[9]=d):d=t[9];let f;t[10]!==s||t[11]!==n?(f=s??(0,$.jsx)(v,{id:`RZXTlY`,values:{count:n}}),t[10]=s,t[11]=n,t[12]=f):f=t[12];let p;t[13]!==a||t[14]!==o||t[15]!==u||t[16]!==f?(p=(0,$.jsxs)(w,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:a,onClick:o,"aria-label":u,"data-testid":`problems-auto-fix`,children:[d,f]}),t[13]=a,t[14]=o,t[15]=u,t[16]=f,t[17]=p):p=t[17];let m;return t[18]!==l||t[19]!==p?(m=(0,$.jsx)(Sr,{testId:`problems-auto-fix-tip`,tip:l,children:p}),t[18]=l,t[19]=p,t[20]=m):m=t[20],m}function wr(e){let t=(0,Q.c)(12),{count:n,disabled:r,onClick:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(v,{id:`mgDKWS`,values:{count:n}}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(he,{"aria-hidden":`true`,className:`size-3`}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,$.jsx)(v,{id:`gyHDWC`,values:{count:n}}),t[3]=n,t[4]=s);let c;t[5]!==r||t[6]!==i||t[7]!==s?(c=(0,$.jsxs)(w,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:r,onClick:i,"data-testid":`problems-fix-with-ai`,children:[o,s]}),t[5]=r,t[6]=i,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,$.jsx)(Sr,{testId:`problems-fix-with-ai-tip`,tip:a,children:c}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function Tr(e){let t=(0,Q.c)(61),{docName:n,diagnostics:r,linkFindingsStatus:i,brokenLinkSuppression:a,onFix:s,onAutoFix:c,onAskAi:l,onFixWithAi:d}=e,f=i===void 0?`loaded`:i,{_:m}=y(),h=(0,Z.useRef)(null),g=(0,Z.useId)(),[_,b]=(0,Z.useState)(`doc`),x;t[0]===n?x=t[1]:(x=R(n),t[0]=n,t[1]=x);let S=!x,{data:C}=He(),O=C===null?null:C.effective.enabled?re.filter(e=>C.effective.plugins[e.id].enabled):[],k=O!==null&&O.length===0,A=a!==void 0,j=(_===`project`||S)&&O!==null&&O.length>0,M;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(M={status:`idle`},t[2]=M):M=t[2];let[N,P]=(0,Z.useState)(M),F=qn(),I=oe(),[L,ee]=(0,Z.useState)(null),z=(0,Z.useRef)(!0),B,V;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>(z.current=!0,()=>{z.current=!1}),V=[],t[3]=B,t[4]=V):(B=t[3],V=t[4]),(0,Z.useEffect)(B,V);let H=(0,Z.useRef)(Nr),U=(0,Z.useRef)(Mr),K;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(K={status:`idle`},t[5]=K):K=t[5];let te=(0,Z.useRef)(K),Y;t[6]===N?Y=t[7]:(Y=()=>{N.status!==`loading`&&(te.current=N)},t[6]=N,t[7]=Y),(0,Z.useEffect)(Y);let X=(0,Z.useRef)(0),ne=[...r].sort(dr),ie=br(ne),ae;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(ae=async function(){X.current+=1;let e=X.current,t=te.current;P({status:`loading`});let n=await On();if(n===`audit-superseded`){X.current===e&&z.current&&P(t.status===`idle`?{status:`failed`}:t);return}n!==null&&or(n.files),z.current&&P(n===null?{status:`failed`}:{status:`loaded`,result:n})},t[8]=ae):ae=t[8];let se=ae,ce;t[9]!==m||t[10]!==N.status||t[11]!==L||t[12]!==I?(ce=async function(e){let t=e.linkTarget;if(!(t===void 0||L!==null||I===null)){ee(t);try{await o({initialDir:``,suggestedName:t},{addPage:I.addPage})}catch(e){let t=e;W.error(t instanceof Error?t.message:m({id:`tfi40B`})),z.current&&ee(null);return}W.success(m({id:`EWCJFu`,values:{target:t}})),z.current&&ee(null),z.current&&N.status===`loaded`&&await se()}},t[9]=m,t[10]=N.status,t[11]=L,t[12]=I,t[13]=ce):ce=t[13];let le=ce,ue=N.status===`loaded`?N.result.files.filter(Ar):[],de=function(){Zn({items:ue,fixItem:kr})},fe;t[14]===N.status?fe=t[15]:(fe=function(e){b(e),e===`project`&&N.status===`idle`&&se()},t[14]=N.status,t[15]=fe);let pe=fe,me;t[16]===N.status?me=t[17]:(me=()=>{H.current=()=>{N.status===`idle`||N.status===`failed`||se()}},t[16]=N.status,t[17]=me),(0,Z.useEffect)(me);let ge,be;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(ge=()=>Ve(()=>H.current()),be=[],t[18]=ge,t[19]=be):(ge=t[18],be=t[19]),(0,Z.useEffect)(ge,be);let xe,Se;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(xe=()=>J(e=>{q(e)&&H.current()}),Se=[],t[20]=xe,t[21]=Se):(xe=t[20],Se=t[21]),(0,Z.useEffect)(xe,Se);let Ce;t[22]===pe?Ce=t[23]:(Ce=(e,t)=>{e===`problems`&&(u(`problems`),t.scope!==void 0&&pe(t.scope),t.focus===`panel`&&h.current?.focus({preventScroll:!0}))},t[22]=pe,t[23]=Ce);let we=(0,Z.useEffectEvent)(Ce),Te;t[24]===we?Te=t[25]:(Te=()=>{let e=u(`problems`);return e!==null&&we(`problems`,e),p(we)},t[24]=we,t[25]=Te);let Ee;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=[],t[26]=Ee):Ee=t[26],(0,Z.useEffect)(Te,Ee);let De;t[27]===N.status?De=t[28]:(De=()=>{U.current=()=>{N.status===`idle`||N.status===`failed`||se().catch(e=>{console.warn(`[lint] post-sweep re-audit failed`,e),z.current&&P({status:`failed`})})}},t[27]=N.status,t[28]=De),(0,Z.useEffect)(De);let Oe,ke;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=()=>Jn(()=>U.current()),ke=[],t[29]=Oe,t[30]=ke):(Oe=t[29],ke=t[30]),(0,Z.useEffect)(Oe,ke);let Ae;t[31]===n?Ae=t[32]:(Ae=function(e){let t=fr(n,e);Ct(n,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(ur,{detail:t}))},t[31]=n,t[32]=Ae);let je=Ae,ze;t[33]!==n||t[34]!==je?(ze=function(e,t){let r=ye(e);if(r===n){je(t);return}Ct(r,{kind:`lint`,detail:fr(r,t)}),window.location.hash=ve(r)},t[33]=n,t[34]=je,t[35]=ze):ze=t[35];let Be=ze,Ue;t[36]!==m||t[37]!==le||t[38]!==L||t[39]!==l||t[40]!==s||t[41]!==I?(Ue=function(e){let t=s!==void 0&&(e.fixes?.length??0)>0,n=hr(e)&&I!==null;if(!t&&!n&&l===void 0)return null;let r=`${e.source}/${e.code}`;return(0,$.jsxs)($.Fragment,{children:[n?(0,$.jsx)(xr,{target:e.linkTarget??``,creating:L===e.linkTarget,disabled:L!==null,onCreate:()=>void le(e)}):null,t?(0,$.jsxs)(w,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>s?.(e),"aria-label":m({id:`fZj9em`,values:{flatId:r}}),"data-testid":`problems-fix`,children:[(0,$.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,$.jsx)(v,{id:`c4fVUV`})]}):null,l===void 0?null:(0,$.jsxs)(w,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>l(e),"aria-label":m({id:`hh4mVC`,values:{flatId:r}}),"data-testid":`problems-ask-ai`,children:[(0,$.jsx)(he,{"aria-hidden":`true`,className:`size-3`}),(0,$.jsx)(v,{id:`xWEvuo`})]})]})},t[36]=m,t[37]=le,t[38]=L,t[39]=l,t[40]=s,t[41]=I,t[42]=Ue):Ue=t[42];let We=Ue,Ge=Re,Ke;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,$.jsx)(v,{id:`OXdGnd`}),t[43]=Ke):Ke=t[43];let qe;t[44]===g?qe=t[45]:(qe=(0,$.jsx)(Ne,{id:g,children:Ke}),t[44]=g,t[45]=qe);let Je=j&&(0,$.jsxs)(D,{children:[(0,$.jsx)(T,{className:`shrink-0 cursor-default rounded-md bg-muted-foreground/5 px-2 py-1 font-mono text-xs text-muted-foreground`,"data-testid":`problems-active-plugins`,children:(0,$.jsx)(v,{id:`yxF19Y`,values:{0:O.length}})}),(0,$.jsx)(E,{"data-testid":`problems-active-plugins-tooltip`,children:(0,$.jsx)(v,{id:`ws5o1F`,values:{0:O.map(Or).join(`, `)}})})]}),Ye;t[46]!==qe||t[47]!==Je?(Ye=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[qe,Je]}),t[46]=qe,t[47]=Je,t[48]=Ye):Ye=t[48];let Xe=_===`doc`&&ne.length>0&&(0,$.jsx)(Ie,{children:ne.length}),Ze;t[49]!==Ye||t[50]!==Xe?(Ze=(0,$.jsxs)(Le,{children:[Ye,Xe]}),t[49]=Ye,t[50]=Xe,t[51]=Ze):Ze=t[51];let Qe;t[52]!==pe||t[53]!==_?(Qe=(0,$.jsx)(Tn,{scope:_,onScopeChange:pe}),t[52]=pe,t[53]=_,t[54]=Qe):Qe=t[54];let $e=_===`doc`?(0,$.jsxs)(Fe,{className:`px-2 py-2`,children:[f===`idle`||f===`loading`?(0,$.jsx)(Pe,{className:`px-2 pb-2`,role:`status`,"aria-live":`polite`,"data-testid":`problems-links-loading`,children:(0,$.jsx)(v,{id:`W9NSe0`})}):f===`failed`?(0,$.jsx)(Me,{className:`px-2 pb-2`,role:`status`,"data-testid":`problems-links-failed`,children:ne.length>0||A?(0,$.jsx)(v,{id:`IoHQYP`}):(0,$.jsx)(v,{id:`gpbKxw`})}):null,A&&(0,$.jsx)(Rr,{suppression:a}),ne.length===0?f===`loaded`?S?k?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Pe,{className:`px-2`,"data-testid":`problems-no-plugins`,children:A?(0,$.jsx)(v,{id:`mI1KPS`}):(0,$.jsx)(v,{id:`Hngy37`})}),(0,$.jsx)(`div`,{className:`px-2 pt-2`,children:(0,$.jsx)(w,{variant:`outline`,size:`sm`,onClick:G,"data-testid":`problems-enable-plugins`,children:(0,$.jsx)(v,{id:`rnX-1S`})})})]}):A?null:(0,$.jsx)(Pe,{className:`px-2`,children:(0,$.jsx)(v,{id:`ZI8uvA`})}):(0,$.jsx)(Pe,{className:`px-2`,"data-testid":`problems-markdown-not-applicable`,children:(0,$.jsx)(v,{id:`Kdvukk`})}):null:(0,$.jsxs)($.Fragment,{children:[c!==void 0||d!==void 0?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1 px-2 pb-1`,children:[c!==void 0&&(0,$.jsx)(Cr,{count:ie,problemCount:ne.length,aiAvailable:d!==void 0,disabled:ie===0,onClick:c}),d!==void 0&&(0,$.jsx)(wr,{count:ne.length,disabled:!1,onClick:()=>d(`doc`)})]}):null,(0,$.jsx)(`ul`,{"aria-label":m({id:`OXdGnd`}),className:`flex flex-col gap-0.5`,children:_r(ne).map(e=>(0,$.jsx)(vr,{group:e,onNavigate:je,navTitle:e=>m({id:`vbMHjo`,values:{0:e.range.start.line+1}}),renderActions:We},e.key))})]})]}):(0,$.jsx)(Pr,{audit:N,onRefresh:()=>void se(),onNavigate:Be,fixableCount:ue.reduce(Dr,0),problemCount:N.status===`loaded`?N.result.files.reduce(Er,0):0,fixing:F,onAutoFix:de,onCancelFix:Yn,onFixWithAi:d===void 0||N.status!==`loaded`?void 0:()=>d(`project`),onCreateTarget:I===null?void 0:e=>void le(e),creatingTarget:L}),et;return t[55]!==Ge||t[56]!==g||t[57]!==Ze||t[58]!==Qe||t[59]!==$e?(et=(0,$.jsxs)(Ge,{ref:h,tabIndex:-1,"aria-labelledby":g,"data-testid":`problems-panel`,children:[Ze,Qe,$e]}),t[55]=Ge,t[56]=g,t[57]=Ze,t[58]=Qe,t[59]=$e,t[60]=et):et=t[60],et}function Er(e,t){return e+t.diagnostics.length}function Dr(e,t){return e+br(t.diagnostics)}function Or(e){return e.label}function kr(e){return Be(ye(e.file))}function Ar(e){return e.diagnostics.some(jr)}function jr(e){return(e.fixes?.length??0)>0}function Mr(){}function Nr(){}function Pr(e){let t=(0,Q.c)(81),{audit:n,onRefresh:r,onNavigate:i,fixableCount:a,problemCount:o,fixing:s,onAutoFix:c,onCancelFix:l,onFixWithAi:u,onCreateTarget:d,creatingTarget:f}=e,{_:p}=y(),m=n.status===`loading`||n.status===`idle`,h;t[0]!==n.result||t[1]!==n.status?(h=n.status===`loaded`?n.result.files:[],t[0]=n.result,t[1]=n.status,t[2]=h):h=t[2];let g=h,[_,b]=(0,Z.useState)(Lr),x;t[3]!==_||t[4]!==g?(x=g.length>0&&g.every(e=>_.has(e.file)),t[3]=_,t[4]=g,t[5]=x):x=t[5];let S=x,C;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=function(e,t){b(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},t[6]=C):C=t[6];let O=C,k;t[7]!==S||t[8]!==g?(k=function(){b(S?new Set:new Set(g.map(Ir)))},t[7]=S,t[8]=g,t[9]=k):k=t[9];let A=k,j;t[10]!==n.result||t[11]!==n.status?(j=n.status===`loaded`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(v,{id:`DsDwR-`,values:{0:n.result.errorCount}}),` · `,(0,$.jsx)(v,{id:`W1SI2K`,values:{0:n.result.warningCount}})]}),t[10]=n.result,t[11]=n.status,t[12]=j):j=t[12];let M;t[13]===j?M=t[14]:(M=(0,$.jsx)(`p`,{className:`min-w-0 truncate text-xs text-muted-foreground`,"data-testid":`problems-audit-summary`,children:j}),t[13]=j,t[14]=M);let N;t[15]!==p||t[16]!==S||t[17]!==g.length||t[18]!==A?(N=g.length>0?(0,$.jsxs)(D,{children:[(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(w,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":p(S?{id:`I4LGsH`}:{id:`Ugvy4O`}),"data-testid":`problems-audit-expand-toggle`,onClick:A,children:S?(0,$.jsx)(Ue,{"aria-hidden":`true`,className:`size-3.5`}):(0,$.jsx)(ne,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,$.jsx)(E,{"data-testid":`problems-audit-expand-toggle-tooltip`,children:S?(0,$.jsx)(v,{id:`I4LGsH`}):(0,$.jsx)(v,{id:`Ugvy4O`})})]}):null,t[15]=p,t[16]=S,t[17]=g.length,t[18]=A,t[19]=N):N=t[19];let P;t[20]===p?P=t[21]:(P=p({id:`I7y_vn`}),t[20]=p,t[21]=P);let F=m||s!==null,I;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(me,{"aria-hidden":`true`,className:`size-3.5`}),t[22]=I):I=t[22];let L;t[23]!==r||t[24]!==P||t[25]!==F?(L=(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(w,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":P,"data-testid":`problems-audit-refresh`,disabled:F,onClick:r,children:I})}),t[23]=r,t[24]=P,t[25]=F,t[26]=L):L=t[26];let ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(E,{"data-testid":`problems-audit-refresh-tooltip`,children:(0,$.jsx)(v,{id:`I7y_vn`})}),t[27]=ee):ee=t[27];let R;t[28]===L?R=t[29]:(R=(0,$.jsxs)(D,{children:[L,ee]}),t[28]=L,t[29]=R);let z;t[30]!==R||t[31]!==N?(z=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[N,R]}),t[30]=R,t[31]=N,t[32]=z):z=t[32];let B;t[33]!==z||t[34]!==M?(B=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[M,z]}),t[33]=z,t[34]=M,t[35]=B):B=t[35];let V;t[36]!==p||t[37]!==s?(V=s===null?null:(0,$.jsx)(`span`,{className:`sr-only`,role:`status`,children:p({id:`gZElfU`,values:{0:s.done,1:s.total}})}),t[36]=p,t[37]=s,t[38]=V):V=t[38];let H;t[39]!==p||t[40]!==s||t[41]!==l?(H=s===null?null:(0,$.jsxs)(D,{children:[(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(w,{variant:`ghost`,size:`sm`,className:`h-6 shrink-0 px-2 text-muted-foreground`,"aria-label":p({id:`q2cLM6`}),"data-testid":`problems-cancel-fix`,onClick:l,children:(0,$.jsx)(v,{id:`ygCKqB`})})}),(0,$.jsx)(E,{"data-testid":`problems-cancel-fix-tooltip`,children:(0,$.jsx)(v,{id:`yvSAuM`})})]}),t[39]=p,t[40]=s,t[41]=l,t[42]=H):H=t[42];let U=u!==void 0,W=m||s!==null||a===0,G;t[43]===s?G=t[44]:(G=s===null?void 0:(0,$.jsx)(v,{id:`S9t1PI`,values:{0:s.done,1:s.total}}),t[43]=s,t[44]=G);let K;t[45]!==a||t[46]!==c||t[47]!==o||t[48]!==U||t[49]!==W||t[50]!==G?(K=(0,$.jsx)(Cr,{count:a,problemCount:o,aiAvailable:U,disabled:W,onClick:c,children:G}),t[45]=a,t[46]=c,t[47]=o,t[48]=U,t[49]=W,t[50]=G,t[51]=K):K=t[51];let q;t[52]!==s||t[53]!==u||t[54]!==o?(q=u!==void 0&&o>0?(0,$.jsx)(wr,{count:o,disabled:s!==null,onClick:u}):null,t[52]=s,t[53]=u,t[54]=o,t[55]=q):q=t[55];let J;t[56]!==V||t[57]!==H||t[58]!==K||t[59]!==q?(J=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1`,children:[V,H,K,q]}),t[56]=V,t[57]=H,t[58]=K,t[59]=q,t[60]=J):J=t[60];let te;t[61]!==B||t[62]!==J?(te=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 px-2 pb-1`,children:[B,J]}),t[61]=B,t[62]=J,t[63]=te):te=t[63];let Y;t[64]!==p||t[65]!==m?(Y=m&&(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,role:`status`,"aria-busy":`true`,"aria-label":p({id:`dx-TwN`}),children:[1,2,3].map(Fr)}),t[64]=p,t[65]=m,t[66]=Y):Y=t[66];let X;t[67]===n.status?X=t[68]:(X=n.status===`failed`&&(0,$.jsx)(Me,{className:`px-2 text-xs`,children:(0,$.jsx)(v,{id:`IFezUv`})}),t[67]=n.status,t[68]=X);let re;t[69]!==n.result||t[70]!==n.status||t[71]!==f||t[72]!==_||t[73]!==d||t[74]!==i?(re=n.status===`loaded`&&(0,$.jsx)(zr,{result:n.result,onNavigate:i,onCreateTarget:d,creatingTarget:f,expandedFiles:_,onToggleFile:O}),t[69]=n.result,t[70]=n.status,t[71]=f,t[72]=_,t[73]=d,t[74]=i,t[75]=re):re=t[75];let ie;return t[76]!==te||t[77]!==Y||t[78]!==X||t[79]!==re?(ie=(0,$.jsxs)(Fe,{className:`px-2 py-2`,"data-testid":`problems-project-scope`,children:[te,Y,X,re]}),t[76]=te,t[77]=Y,t[78]=X,t[79]=re,t[80]=ie):ie=t[80],ie}function Fr(e){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded px-2 py-1.5`,children:[(0,$.jsx)(ze,{className:`mt-0.5 size-3.5 shrink-0 rounded`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,$.jsx)(ze,{className:`h-3 w-28`}),(0,$.jsx)(ze,{className:`h-3 w-40`})]})]},e)}function Ir(e){return e.file}function Lr(){return new Set}function Rr(e){let t=(0,Q.c)(6),{suppression:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(pe,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),t[0]=r):r=t[0];let i;t[1]===n.count?i=t[2]:(i=(0,$.jsx)(v,{id:`gi9c0-`,values:{0:n.count}}),t[1]=n.count,t[2]=i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(v,{id:`l91IVc`}),t[3]=a):a=t[3];let o;return t[4]===i?o=t[5]:(o=(0,$.jsxs)(`div`,{role:`note`,"aria-live":`polite`,"data-testid":`problems-broken-link-suppression`,className:`mx-2 mb-1 flex items-start gap-1.5 rounded-md border border-border/70 bg-muted/40 px-2 py-1.5 text-xs text-muted-foreground`,children:[r,(0,$.jsxs)(`span`,{className:`min-w-0`,children:[i,` `,a]})]}),t[4]=i,t[5]=o),o}function zr(e){let t=(0,Q.c)(18),{result:n,onNavigate:r,onCreateTarget:i,creatingTarget:a,expandedFiles:o,onToggleFile:s}=e,{_:c}=y(),l;t[0]!==c||t[1]!==n.warnings?(l=n.warnings.length>0&&(0,$.jsx)(`ul`,{"aria-label":c({id:`Rsdhj9`}),className:`flex flex-col gap-0.5 pb-1`,children:n.warnings.map(Br)}),t[0]=c,t[1]=n.warnings,t[2]=l):l=t[2];let u;t[3]===n.brokenLinkSuppression?u=t[4]:(u=n.brokenLinkSuppression!==void 0&&(0,$.jsx)(Rr,{suppression:n.brokenLinkSuppression}),t[3]=n.brokenLinkSuppression,t[4]=u);let d;t[5]!==a||t[6]!==o||t[7]!==i||t[8]!==r||t[9]!==s||t[10]!==n.brokenLinkSuppression||t[11]!==n.fileCount||t[12]!==n.files?(d=n.files.length===0?n.brokenLinkSuppression===void 0?(0,$.jsx)(Pe,{className:`px-2`,children:(0,$.jsx)(v,{id:`k_Dqw1`,values:{0:n.fileCount}})}):null:n.files.map(e=>(0,$.jsx)(Vr,{file:e,onNavigate:r,onCreateTarget:i,creatingTarget:a,open:o.has(e.file),onOpenChange:t=>s(e.file,t)},e.file)),t[5]=a,t[6]=o,t[7]=i,t[8]=r,t[9]=s,t[10]=n.brokenLinkSuppression,t[11]=n.fileCount,t[12]=n.files,t[13]=d):d=t[13];let f;return t[14]!==l||t[15]!==u||t[16]!==d?(f=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[l,u,d]}),t[14]=l,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function Br(e,t){return(0,$.jsxs)(`li`,{className:`flex items-start gap-1.5 px-2 text-xs`,children:[(0,$.jsx)(ge,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-500`}),(0,$.jsx)(`span`,{className:`min-w-0 text-foreground`,children:e})]},`${t}-${e}`)}function Vr(e){let t=(0,Q.c)(45),{file:n,onNavigate:r,onCreateTarget:i,creatingTarget:a,open:o,onOpenChange:s}=e,{_:c}=y(),l,u,d,f,p,m,h,g,_,v;if(t[0]!==c||t[1]!==a||t[2]!==n.diagnostics||t[3]!==n.file||t[4]!==i||t[5]!==r||t[6]!==s||t[7]!==o){let e=[...n.diagnostics].sort(dr);u=A,h=o,g=s,_=`problems-audit-group`;let y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(X,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`}),t[18]=y):y=t[18];let b;t[19]===n.file?b=t[20]:(b=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,title:n.file,children:n.file}),t[19]=n.file,t[20]=b),v=(0,$.jsxs)(k,{className:`group flex w-full cursor-pointer items-center gap-1.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:[y,b,(0,$.jsx)(je,{variant:`gray`,"data-testid":`problems-audit-file-count`,className:`shrink-0`,children:e.length})]}),l=O,m=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in] motion-reduce:animate-none`,t[21]!==c||t[22]!==n.file?(d=c({id:`zAJzIg`,values:{0:n.file}}),t[21]=c,t[22]=n.file,t[23]=d):d=t[23],f=`flex flex-col gap-0.5 pb-1 ps-3`;let x;t[24]!==c||t[25]!==a||t[26]!==n.file||t[27]!==i||t[28]!==r?(x=e=>(0,$.jsx)(vr,{group:e,onNavigate:e=>r(n.file,e),navTitle:e=>c({id:`xKDsGS`,values:{0:e.range.start.line+1,1:n.file}}),renderActions:e=>!hr(e)||i===void 0?null:(0,$.jsx)(xr,{target:e.linkTarget??``,creating:a===e.linkTarget,disabled:a!==null,onCreate:()=>i(e)})},e.key),t[24]=c,t[25]=a,t[26]=n.file,t[27]=i,t[28]=r,t[29]=x):x=t[29],p=_r(e).map(x),t[0]=c,t[1]=a,t[2]=n.diagnostics,t[3]=n.file,t[4]=i,t[5]=r,t[6]=s,t[7]=o,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=_,t[17]=v}else l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13],h=t[14],g=t[15],_=t[16],v=t[17];let b;t[30]!==d||t[31]!==f||t[32]!==p?(b=(0,$.jsx)(`ul`,{"aria-label":d,className:f,children:p}),t[30]=d,t[31]=f,t[32]=p,t[33]=b):b=t[33];let x;t[34]!==l||t[35]!==m||t[36]!==b?(x=(0,$.jsx)(l,{className:m,children:b}),t[34]=l,t[35]=m,t[36]=b,t[37]=x):x=t[37];let S;return t[38]!==u||t[39]!==x||t[40]!==h||t[41]!==g||t[42]!==_||t[43]!==v?(S=(0,$.jsxs)(u,{open:h,onOpenChange:g,"data-testid":_,children:[v,x]}),t[38]=u,t[39]=x,t[40]=h,t[41]=g,t[42]=_,t[43]=v,t[44]=S):S=t[44],S}function Hr(e,t){return e.has(t)||P(t)}var Ur=null,Wr=[];function Gr(e){if(e===Ur)return Wr;let t=Kr(e);return Ur=e,Wr=t,t}function Kr(e){let t=[],n=new Map,r=z();for(let i=qr(e);i<=e.lines;i++){let a=e.line(i);if(r(a.text))continue;let o=H(a.text,n);o&&t.push({slug:o.slug,from:a.from})}return t}function qr(e){if(!Jr(e.line(1).text))return 1;for(let t=2;t<=e.lines;t++)if(Jr(e.line(t).text))return t+1;return 1}function Jr(e){return L.test(e.endsWith(`\r`)?e.slice(0,-1):e)}function Yr(e){let t=document.getElementById(e);return t?t.getBoundingClientRect().top:null}function Xr(e){let t=new Map;for(let n of Gr(e.state.doc))t.set(n.slug,n.from);let n=e.documentTop;return r=>{let i=t.get(r);return i===void 0?null:n+e.lineBlockAt(i).top}}function Zr(e,t){let n=(0,Q.c)(9),r;n[0]===t?r=n[1]:(r=t===void 0?{}:t,n[0]=t,n[1]=r);let{isSourceMode:a,docName:o}=r,s=a===void 0?!1:a,[l,u]=(0,Z.useState)(void 0),d=(0,Z.useRef)(null),f;n[2]===o?f=n[3]:(f=()=>o?i(o):null,n[2]=o,n[3]=f);let p=(0,Z.useSyncExternalStore)(c,f,Qr),m,h;return n[4]!==s||n[5]!==e||n[6]!==p?(m=()=>{if(e.length===0||s&&!p){u(void 0);return}let t=function(){let t=s&&p?Xr(p):Yr,n=window.innerHeight/2,r,i;for(let a of e){let e=t(a);e!==null&&(e<0?r=a:i===void 0&&e<n&&(i=a))}u(i??r??e[0])},n=function(){d.current===null&&(d.current=requestAnimationFrame(()=>{d.current=null,t()}))};return document.addEventListener(`scroll`,n,{capture:!0,passive:!0}),t(),()=>{document.removeEventListener(`scroll`,n,{capture:!0}),d.current!==null&&(cancelAnimationFrame(d.current),d.current=null)}},h=[e,s,p],n[4]=s,n[5]=e,n[6]=p,n[7]=m,n[8]=h):(m=n[7],h=n[8]),(0,Z.useEffect)(m,h),l}function Qr(){return null}var $r=300;async function ei(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new fe(K._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=I.safeParse(n);throw e.success?Error(e.data.title):new fe(K._({id:`zlErBl`}),{status:t.status})}let r=F.safeParse(n);if(!r.success)throw new fe(K._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var ti=32,ni=12,ri=6,ii=`open-knowledge:outline-nav`,ai=`ok-outline-nav`,oi=`ok-outline-nav-dispatch`,si=`ok-outline-nav-settled`;function ci(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(xe,{name:`outline-panel`,children:(0,$.jsx)(li,{...e})}),t[0]=e,t[1]=n),n}function li(e){let t=(0,Q.c)(65),{docName:n,isSourceMode:r,className:i}=e,a=i===void 0?``:i,{_:o}=y(),{pages:s,loading:c,error:l}=ae(),u=b(),{activeProvider:f,activeDocName:p}=d(),m;t[0]!==n||t[1]!==s?(m=Hr(s,n),t[0]=n,t[1]=s,t[2]=m):m=t[2];let h=m,g;t[3]!==n||t[4]!==u?(g=u.getQueryState([`page-headings`,n]),t[3]=n,t[4]=u,t[5]=g):g=t[5];let _=!c&&l===null&&!h&&g!==void 0,S,w;t[6]===n?(S=t[7],w=t[8]):(S=[`page-headings`,n],w=()=>ei(n),t[6]=n,t[7]=S,t[8]=w);let T=!c&&h,E;t[9]!==S||t[10]!==w||t[11]!==T?(E={queryKey:S,queryFn:w,enabled:T,staleTime:1/0},t[9]=S,t[10]=w,t[11]=T,t[12]=E):E=t[12];let{data:D,isLoading:O,error:k}=x(E),A;t[13]===D?A=t[14]:(A=D===void 0?[]:D,t[13]=D,t[14]=A);let j=A,M,N;t[15]!==n||t[16]!==_||t[17]!==u?(M=()=>{_&&u.resetQueries({queryKey:[`page-headings`,n]})},N=[_,n,u],t[15]=n,t[16]=_,t[17]=u,t[18]=M,t[19]=N):(M=t[18],N=t[19]),(0,Z.useEffect)(M,N);let P,F;t[20]!==p||t[21]!==f||t[22]!==n||t[23]!==u?(P=()=>{if(!f||p!==n)return;let e=f.document,t=null,r=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,u.invalidateQueries({queryKey:[`page-headings`,n]})},$r)};return e.on(`update`,r),()=>{e.off(`update`,r),t!==null&&clearTimeout(t)}},F=[f,p,n,u],t[20]=p,t[21]=f,t[22]=n,t[23]=u,t[24]=P,t[25]=F):(P=t[24],F=t[25]),(0,Z.useEffect)(P,F);let I=c||O,L;t[26]===j?L=t[27]:(L=j.map(ui),t[26]=j,t[27]=L);let ee=L,R;t[28]!==n||t[29]!==r?(R={isSourceMode:r,docName:n},t[28]=n,t[29]=r,t[30]=R):R=t[30];let z=Zr(ee,R),B,V,H,U,W,G,K;if(t[31]!==o||t[32]!==z||t[33]!==a||t[34]!==n||t[35]!==k||t[36]!==j||t[37]!==I||t[38]!==r||t[39]!==_){let e=z?j.findIndex(e=>e.slug===z):-1,i=function(t,i){let a={docName:n,index:t,slug:i,mode:r?`source`:`wysiwyg`};a.mode===`source`&&Ct(n,{kind:`outline`,detail:a}),Se(oi,{docName:n,index:t,mode:a.mode,outlineCount:j.length,headingLevel:j[t]?.level,activeIndex:e}),window.dispatchEvent(new CustomEvent(ii,{detail:a}))},s=((e>=0?j[e].level:1)-1)*ni+(ni-ri)/2,c=e*ti+(ti-ri)/2;V=Re,G=a;let l;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(Ne,{children:(0,$.jsx)(v,{id:`dD7NPy`})}),t[47]=l):l=t[47];let u;t[48]!==k||t[49]!==j.length||t[50]!==I||t[51]!==_?(u=!I&&!k&&!_&&(0,$.jsx)(Ie,{children:j.length}),t[48]=k,t[49]=j.length,t[50]=I,t[51]=_,t[52]=u):u=t[52],t[53]===u?K=t[54]:(K=(0,$.jsxs)(Le,{children:[l,u]}),t[53]=u,t[54]=K),B=Fe,H=`px-3 py-2`,U=I,W=_?(0,$.jsx)(Pe,{className:`px-2`,role:`status`,children:(0,$.jsx)(v,{id:`0x9smA`})}):k?(0,$.jsx)(Me,{className:`px-2`,children:k instanceof Error?k.message:o({id:`GuqOb1`})}):j.length===0&&!I?(0,$.jsx)(Pe,{className:`px-2`,children:(0,$.jsx)(v,{id:`0BB9ID`})}):(0,$.jsxs)(`nav`,{"aria-label":o({id:`BymzO4`}),className:`relative`,children:[e>=0&&(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-0 top-0 rounded-full bg-primary motion-safe:[transition:transform_0.25s_var(--ease-out-strong)]`,style:{width:ri,height:ri,transform:`translate(${s}px, ${c}px)`}}),j.map((e,t)=>{let n=e.slug===z;return(0,$.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>i(t,e.slug),className:C(`w-full cursor-pointer truncate py-1.5 pe-2 text-left text-sm transition-colors`,n?`font-medium text-primary`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${(e.level-1)*ni+20}px`},title:e.text,children:e.text},t)})]}),t[31]=o,t[32]=z,t[33]=a,t[34]=n,t[35]=k,t[36]=j,t[37]=I,t[38]=r,t[39]=_,t[40]=B,t[41]=V,t[42]=H,t[43]=U,t[44]=W,t[45]=G,t[46]=K}else B=t[40],V=t[41],H=t[42],U=t[43],W=t[44],G=t[45],K=t[46];let q;t[55]!==B||t[56]!==H||t[57]!==U||t[58]!==W?(q=(0,$.jsx)(B,{className:H,"aria-busy":U,children:W}),t[55]=B,t[56]=H,t[57]=U,t[58]=W,t[59]=q):q=t[59];let J;return t[60]!==V||t[61]!==G||t[62]!==K||t[63]!==q?(J=(0,$.jsxs)(V,{className:G,children:[K,q]}),t[60]=V,t[61]=G,t[62]=K,t[63]=q,t[64]=J):J=t[64],J}function ui(e){return e.slug}var di=!1;function fi(){return di||!te()?!1:(di=!0,!0)}export{pn as A,Ot as B,xn as C,Sn as D,Cn as E,Nt as F,nt as G,vt as H,Et as I,et as K,Tt as L,Lt as M,Zt as N,$t as O,Qt as P,kt as R,hn as S,wn as T,tt as U,Ct as V,rt as W,kn as _,ci as a,En as b,ur as c,cr as d,lr as f,On as g,Dn as h,si as i,Jt as j,fn as k,Tr as l,ir as m,ai as n,Gr as o,sr as p,ii as r,Hr as s,fi as t,ar as u,jn as v,bn as w,Tn as x,Mn as y,wt as z};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./messages-Czy5uUdz.js","./chunk-CYidjpOJ.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{Bi as i,Fi as a,Ro as o,mi as s,yo as c}from"./dist-75Tp0j2s.js";import{n as l}from"./dist-CJhtNlOm2.js";import{t as u}from"./dist-Cr4-nBVI.js";import{t as d}from"./messages-Czy5uUdz.js";var f=e(n(),1),p=r();u.load(`en`,d.messages),u.activate(`en`);var m={en:()=>t(()=>import(`./messages-Czy5uUdz.js`).then(e=>e.n),__vite__mapDeps([0,1]),import.meta.url),"zh-Hans":()=>t(()=>import(`./messages-DKoHMjaK.js`),[],import.meta.url),"zh-Hant":()=>t(()=>import(`./messages-CFWXeDS9.js`),[],import.meta.url),hi:()=>t(()=>import(`./messages-BYiJXmNN.js`),[],import.meta.url),es:()=>t(()=>import(`./messages-lPluOXUP.js`),[],import.meta.url),ar:()=>t(()=>import(`./messages-BwGMYA_G.js`),[],import.meta.url),fr:()=>t(()=>import(`./messages-DVDSsf5u.js`),[],import.meta.url),bn:()=>t(()=>import(`./messages-Dnppvuua.js`),[],import.meta.url),"pt-BR":()=>t(()=>import(`./messages-CbXu74T2.js`),[],import.meta.url),id:()=>t(()=>import(`./messages-ijpiuVRD.js`),[],import.meta.url),ur:()=>t(()=>import(`./messages-nbT9wGXG.js`),[],import.meta.url),ko:()=>t(()=>import(`./messages-IHf96h9y.js`),[],import.meta.url)},h=new Set([`en`]),g=`en`;async function _(e){if(g=e,!h.has(e)){let{default:t}=await m[e]();u.load(e,t.messages),h.add(e)}g===e&&u.activate(e)}function v(){return!1}async function y(){}var b=`ok-locale-load-failed`;function x(){window.location.reload()}function S({locale:e,reload:t=x}){let n=new Intl.DisplayNames([u.locale],{type:`language`}).of(e)??e;l.error(u._({id:`loE6tM`,values:{language:n}}),{id:b,description:u._({id:`GtPGNJ`}),duration:1/0,action:{label:u._({id:`HpK_8d`}),onClick:t}})}function C(){l.dismiss(b)}var w=`ok-language-v1`;function T({preference:e,locale:t}){if(typeof document>`u`)return;let n=s(t),r=document.documentElement;r.lang=t,r.dir=n;try{localStorage.setItem(w,JSON.stringify({pref:e,locale:t,dir:n}))}catch{}}function E(e){return e===`system`?`system`:o.includes(e)?e:void 0}function D(){if(!(typeof localStorage>`u`))try{let e=localStorage.getItem(w);return e===null?void 0:E(JSON.parse(e).pref)}catch{return}}function O(e){let t=(0,p.c)(4),{preference:n,userConfigSynced:r}=e,s,l;t[0]!==n||t[1]!==r?(s=()=>{if(v()){y().catch(k);return}if(!r)return;let{locale:e}=i({override:void 0,storedPreference:n,preferenceList:a(),supportedLocales:o,autoDetectableLocales:c}),t=!1;return _(e).then(()=>{t||(C(),T({preference:n??`system`,locale:e}))}).catch(n=>{console.warn(JSON.stringify({event:`ok-locale-activate-failed`,locale:e,error:String(n)})),!t&&S({locale:e})}),()=>{t=!0}},l=[n,r],t[0]=n,t[1]=r,t[2]=s,t[3]=l):(s=t[2],l=t[3]),(0,f.useEffect)(s,l)}function k(e){console.warn(JSON.stringify({event:`ok-pseudo-locale-activate-failed`,error:String(e)}))}export{_ as a,O as i,E as n,D as r,T as t};
@@ -1,5 +0,0 @@
1
- import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{g as r,i,pr as a}from"./DocumentContext-TAFDDp6U.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./react-dom-DPxgxlDT.js";import{t as u}from"./compiler-runtime-BfE3aGVn.js";import{$s as d,La as f,Ls as p,Xa as m,Y as h,Ya as g,ao as _,dr as v,eo as y,fo as b,lo as x,so as ee,to as te,uo as S,wa as ne}from"./dist-75Tp0j2s.js";import{i as re}from"./local-menu-action-bus-4I1Xm40D.js";import{i as ie,l as ae,m as C,n as oe,t as se}from"./PropertyDisplayRow-BGe6-4L9.js";import{J as ce,V as le,X as ue}from"./CodeMirrorPropInput-Cmq0OheO.js";import{t as w}from"./minus-cd1ERTPg.js";import{t as de}from"./libesm-CFNuVJUm.js";var T=u(),E=n(),D=200;function fe(e){let t=(0,T.c)(27),{delta:n,open:r,onOpenChange:i}=e;if(n.unparseable!==null){let e;return t[0]===n.unparseable?e=t[1]:(e=(0,E.jsx)(_e,{regions:n.unparseable}),t[0]=n.unparseable,t[1]=e),e}if(n.changes.length===0)return null;let a,o,c,l,u,d,f,p,m;if(t[2]!==n.changes||t[3]!==i||t[4]!==r){let e=n.changes.slice(0,50);o=n.changes.length-e.length,a=oe,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,E.jsx)(s,{id:`l_UFPv`}),t[14]=c):c=t[14],l=n.changes.length,u=`property-diff-block`,d=`border-b border-border py-3`,f=r,p=i,m=e.map(pe),t[2]=n.changes,t[3]=i,t[4]=r,t[5]=a,t[6]=o,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m}else a=t[5],o=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13];let h;t[15]===o?h=t[16]:(h=o>0&&(0,E.jsx)(`p`,{className:`px-2 pt-1 text-xs text-muted-foreground italic`,children:(0,E.jsx)(s,{id:`6qFchx`,values:{omitted:o}})}),t[15]=o,t[16]=h);let g;return t[17]!==a||t[18]!==c||t[19]!==l||t[20]!==u||t[21]!==d||t[22]!==f||t[23]!==p||t[24]!==m||t[25]!==h?(g=(0,E.jsxs)(a,{title:c,count:l,testId:u,className:d,open:f,onOpenChange:p,children:[m,h]}),t[17]=a,t[18]=c,t[19]=l,t[20]=u,t[21]=d,t[22]=f,t[23]=p,t[24]=m,t[25]=h,t[26]=g):g=t[26],g}function pe(e){return(0,E.jsx)(me,{change:e},`${e.kind}-${e.key}`)}function me(e){let t=(0,T.c)(22),{change:n}=e,{_:r}=c(),i=ae[p(n.kind===`removed`?n.before:n.after)],o;t[0]!==r||t[1]!==n.kind?(o=n.kind===`added`?{KindIcon:re,kindLabel:r({id:`hp8OtS`})}:n.kind===`removed`?{KindIcon:w,kindLabel:r({id:`eps54V`})}:{KindIcon:a,kindLabel:r({id:`cNsIJf`})},t[0]=r,t[1]=n.kind,t[2]=o):o=t[2];let{KindIcon:s,kindLabel:l}=o,u;t[3]===s?u=t[4]:(u=(0,E.jsx)(s,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=s,t[4]=u);let d;t[5]===l?d=t[6]:(d=(0,E.jsx)(`span`,{className:`sr-only`,children:l}),t[5]=l,t[6]=d);let f;t[7]!==u||t[8]!==d?(f=(0,E.jsxs)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-muted-foreground`,children:[u,d]}),t[7]=u,t[8]=d,t[9]=f):f=t[9];let m;t[10]===i?m=t[11]:(m=(0,E.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),t[10]=i,t[11]=m);let h;t[12]===n?h=t[13]:(h=(0,E.jsx)(he,{change:n}),t[12]=n,t[13]=h);let g;t[14]!==n.key||t[15]!==m||t[16]!==h?(g=(0,E.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,E.jsx)(se,{icon:m,label:n.key,dataKey:n.key,children:h})}),t[14]=n.key,t[15]=m,t[16]=h,t[17]=g):g=t[17];let _;return t[18]!==n.key||t[19]!==f||t[20]!==g?(_=(0,E.jsxs)(`div`,{"data-property-change":``,"data-key":n.key,"data-testid":`property-diff-row`,className:`flex items-start gap-1`,children:[f,g]}),t[18]=n.key,t[19]=f,t[20]=g,t[21]=_):_=t[21],_}function he(e){let t=(0,T.c)(17),{change:n}=e;if(n.kind===`added`){let e;return t[0]!==n.after||t[1]!==n.key?(e=(0,E.jsx)(O,{value:n.after,keyName:n.key}),t[0]=n.after,t[1]=n.key,t[2]=e):e=t[2],e}if(n.kind===`removed`){let e;return t[3]!==n.before||t[4]!==n.key?(e=(0,E.jsx)(O,{value:n.before,keyName:n.key,removed:!0}),t[3]=n.before,t[4]=n.key,t[5]=e):e=t[5],e}let r=C(n.before)||C(n.after)?`flex flex-col gap-1`:`flex flex-wrap items-center gap-1.5`,i;t[6]!==n.before||t[7]!==n.key?(i=(0,E.jsx)(O,{value:n.before,keyName:n.key,removed:!0}),t[6]=n.before,t[7]=n.key,t[8]=i):i=t[8];let a;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,E.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:`→`}),t[9]=a):a=t[9];let o;t[10]!==n.after||t[11]!==n.key?(o=(0,E.jsx)(O,{value:n.after,keyName:n.key}),t[10]=n.after,t[11]=n.key,t[12]=o):o=t[12];let s;return t[13]!==r||t[14]!==i||t[15]!==o?(s=(0,E.jsxs)(`div`,{className:r,"data-testid":`property-diff-change-pair`,children:[i,a,o]}),t[13]=r,t[14]=i,t[15]=o,t[16]=s):s=t[16],s}function O(e){let t=(0,T.c)(17),{value:n,keyName:r,removed:i}=e,a=i===void 0?!1:i;if(C(n)){let e=a?`opacity-70`:void 0,i;t[0]!==r||t[1]!==n?(i=(0,E.jsx)(ie,{keyName:r,value:n}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let o;return t[3]!==e||t[4]!==i?(o=(0,E.jsx)(`div`,{className:e,children:i}),t[3]=e,t[4]=i,t[5]=o):o=t[5],o}let o,s,c,l;if(t[6]!==a||t[7]!==n){let e=Array.isArray(n)?n.filter(ge).join(`, `):String(n),r=e.length>D;o=a?`px-1 text-sm break-words text-muted-foreground line-through`:`px-1 text-sm break-words`,s=r?e:void 0,c=`property-diff-value`,l=r?`${e.slice(0,D)}…`:e,t[6]=a,t[7]=n,t[8]=o,t[9]=s,t[10]=c,t[11]=l}else o=t[8],s=t[9],c=t[10],l=t[11];let u;return t[12]!==o||t[13]!==s||t[14]!==c||t[15]!==l?(u=(0,E.jsx)(`span`,{className:o,title:s,"data-testid":c,children:l}),t[12]=o,t[13]=s,t[14]=c,t[15]=l,t[16]=u):u=t[16],u}function ge(e){return typeof e==`string`}function _e(e){let t=(0,T.c)(10),{regions:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:(0,E.jsx)(s,{id:`wFyXOW`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,E.jsx)(s,{id:`EmSrGB`}),t[1]=i):i=t[1];let a;t[2]===n.before?a=t[3]:(a=(0,E.jsx)(k,{label:i,text:n.before}),t[2]=n.before,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(s,{id:`NawEr2`}),t[4]=o):o=t[4];let c;t[5]===n.after?c=t[6]:(c=(0,E.jsx)(k,{label:o,text:n.after}),t[5]=n.after,t[6]=c);let l;return t[7]!==a||t[8]!==c?(l=(0,E.jsxs)(`div`,{className:`border-b border-border px-4 py-3`,"data-testid":`property-diff-unparseable`,"data-property-change":``,children:[r,(0,E.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[a,c]})]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function k(e){let t=(0,T.c)(7),{label:n,text:r}=e,i;t[0]===n?i=t[1]:(i=(0,E.jsx)(`p`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:n}),t[0]=n,t[1]=i);let a=r===``?`—`:r,o;t[2]===a?o=t[3]:(o=(0,E.jsx)(`pre`,{className:`overflow-x-auto rounded-md bg-muted px-2 py-1.5 font-mono text-xs whitespace-pre-wrap`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,E.jsxs)(`div`,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}var A=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.unescapeToken=t,e.escapeToken=n;function t(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function n(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.Pointer=function(){function e(e){e===void 0&&(e=[``]),this.tokens=e}return e.fromJSON=function(n){var r=n.split(`/`).map(t);if(r[0]!==``)throw Error(`Invalid JSON Pointer: ${n}`);return new e(r)},e.prototype.toString=function(){return this.tokens.map(n).join(`/`)},e.prototype.evaluate=function(e){for(var t=null,n=``,r=e,i=1,a=this.tokens.length;i<a;i++)t=r,n=this.tokens[i],!(n==`__proto__`||n==`constructor`||n==`prototype`)&&(r=(t||{})[n]);return{parent:t,key:n,value:r}},e.prototype.get=function(e){return this.evaluate(e).value},e.prototype.set=function(e,t){var n=this.evaluate(e);n.parent&&(n.parent[n.key]=t)},e.prototype.push=function(e){this.tokens.push(e)},e.prototype.add=function(t){return new e(this.tokens.concat(String(t)))},e.prototype.parent=function(){return new e(this.tokens.length>1?this.tokens.slice(0,-1):[``])},e}()})),j=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hasOwnProperty=void 0,e.objectType=t,e.clone=r,e.hasOwnProperty=Object.prototype.hasOwnProperty;function t(e){return e===void 0?`undefined`:e===null?`null`:Array.isArray(e)?`array`:typeof e}function n(e){return typeof e==`object`&&!!e}function r(t){if(!n(t))return t;if(t.constructor==Array){for(var i=t.length,a=Array(i),o=0;o<i;o++)a[o]=r(t[o]);return a}if(t.constructor==Date)return new Date(+t);var s={};for(var c in t)e.hasOwnProperty.call(t,c)&&(s[c]=r(t[c]));return s}})),M=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isDestructive=n,e.subtract=r,e.intersection=i,e.diffArrays=l,e.diffObjects=u,e.diffAny=d;var t=j();function n(e){var t=e.op;return t===`remove`||t===`replace`||t===`copy`||t===`move`}function r(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&!(t.hasOwnProperty.call(n,i)&&n[i]!==void 0)&&r.push(i);return r}function i(e){for(var n=e.length,r={},i=0;i<n;i++){var a=e[i];for(var o in a)t.hasOwnProperty.call(a,o)&&a[o]!==void 0&&(r[o]=(r[o]||0)+1)}for(var o in r)r[o]<n&&delete r[o];return Object.keys(r)}function a(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&t.hasOwnProperty.call(n,i)&&n[i]!==void 0&&r.push(i);return r}function o(e){return e.op===`add`}function s(e){return e.op===`remove`}function c(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function l(e,t,n,r){r===void 0&&(r=d);var i=Math.max(e.length,t.length),a=new Map([[0,{operations:[],cost:0}]]);function l(o,s){var u=o*i+s,d=a.get(u);if(d===void 0){if(o>0&&s>0&&!r(e[o-1],t[s-1],n.add(String(o-1))).length)d=l(o-1,s-1);else{var f=[];if(o>0){var p=l(o-1,s),m={op:`remove`,index:o-1};f.push(c(p,m))}if(s>0){var h=l(o,s-1),g={op:`add`,index:o-1,value:t[s-1]};f.push(c(h,g))}if(o>0&&s>0){var _=l(o-1,s-1),v={op:`replace`,index:o-1,original:e[o-1],value:t[s-1]};f.push(c(_,v))}d=f.sort(function(e,t){return e.cost-t.cost})[0]}a.set(u,d)}return d}var u=isNaN(e.length)||e.length<=0?0:e.length;return l(u,isNaN(t.length)||t.length<=0?0:t.length).operations.reduce(function(e,t){var i=e[0],a=e[1];if(o(t)){var c=t.index+1+a,l=c<u+a?String(c):`-`,d={op:t.op,path:n.add(l).toString(),value:t.value};return[i.concat(d),a+1]}else if(s(t)){var d={op:t.op,path:n.add(String(t.index+a)).toString()};return[i.concat(d),a-1]}else{var f=n.add(String(t.index+a)),p=r(t.original,t.value,f);return[i.concat.apply(i,p),a]}},[[],0])[0]}function u(e,t,n,i){i===void 0&&(i=d);var o=[];return r(e,t).forEach(function(e){o.push({op:`remove`,path:n.add(e).toString()})}),r(t,e).forEach(function(e){o.push({op:`add`,path:n.add(e).toString(),value:t[e]})}),a(e,t).forEach(function(r){o.push.apply(o,i(e[r],t[r],n.add(r)))}),o}function d(e,n,r,i){if(i===void 0&&(i=d),e===n)return[];var a=(0,t.objectType)(e),o=(0,t.objectType)(n);return a==`array`&&o==`array`?l(e,n,r,i):a==`object`&&o==`object`?u(e,n,r,i):[{op:`replace`,path:r.toString(),value:n}]}})),ve=t((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0}),e.InvalidOperationError=e.TestError=e.MissingError=void 0,e.add=l,e.remove=u,e.replace=d,e.move=f,e.copy=p,e.test=m,e.apply=g;var n=A(),r=j(),i=M(),a=function(e){t(n,e);function n(t){var n=e.call(this,`Value required at path: ${t}`)||this;return n.path=t,n.name=`MissingError`,n}return n}(Error);e.MissingError=a;var o=function(e){t(n,e);function n(t,n){var r=e.call(this,`Test failed: ${t} != ${n}`)||this;return r.actual=t,r.expected=n,r.name=`TestError`,r}return n}(Error);e.TestError=o;function s(e,t,n){if(Array.isArray(e))if(t==`-`)e.push(n);else{var r=parseInt(t,10);e.splice(r,0,n)}else e[t]=n}function c(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function l(e,t,i){var o=n.Pointer.fromJSON(t.path);if(i?.implicitArrayCreation&&o.tokens[o.tokens.length-1]===`-`){var c=o.parent().evaluate(e);c.value===void 0&&(0,r.objectType)(c.parent)===`object`&&(c.parent[c.key]=[])}var l=o.evaluate(e);return l.parent===void 0||i?.implicitArrayCreation&&l.key===`-`&&!Array.isArray(l.parent)?new a(t.path):(s(l.parent,l.key,(0,r.clone)(t.value)),null)}function u(e,t,r){var i=n.Pointer.fromJSON(t.path).evaluate(e);return i.value===void 0?new a(t.path):(c(i.parent,i.key),null)}function d(e,t,i){var o=n.Pointer.fromJSON(t.path).evaluate(e);if(o.parent===null)return new a(t.path);if(Array.isArray(o.parent)){if(parseInt(o.key,10)>=o.parent.length)return new a(t.path)}else if(o.value===void 0)return new a(t.path);return o.parent[o.key]=(0,r.clone)(t.value),null}function f(e,t,r){var i=n.Pointer.fromJSON(t.from).evaluate(e);if(i.value===void 0)return new a(t.from);var o=n.Pointer.fromJSON(t.path).evaluate(e);return o.parent===void 0?new a(t.path):(c(i.parent,i.key),s(o.parent,o.key,i.value),null)}function p(e,t,i){var o=n.Pointer.fromJSON(t.from).evaluate(e);if(o.value===void 0)return new a(t.from);var c=n.Pointer.fromJSON(t.path).evaluate(e);return c.parent===void 0?new a(t.path):(s(c.parent,c.key,(0,r.clone)(o.value)),null)}function m(e,t,r){var a=n.Pointer.fromJSON(t.path).evaluate(e);return(0,i.diffAny)(a.value,t.value,new n.Pointer).length?new o(a.value,t.value):null}var h=function(e){t(n,e);function n(t){var n=e.call(this,`Invalid operation: ${t.op}`)||this;return n.operation=t,n.name=`InvalidOperationError`,n}return n}(Error);e.InvalidOperationError=h;function g(e,t,n){switch(t.op){case`add`:return l(e,t,n);case`remove`:return u(e,t,n);case`replace`:return d(e,t,n);case`move`:return f(e,t,n);case`copy`:return p(e,t,n);case`test`:return m(e,t,n)}return new h(t)}})),ye=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.applyPatch=i,e.createPatch=o;var t=A();Object.defineProperty(e,`Pointer`,{enumerable:!0,get:function(){return t.Pointer}});var n=ve(),r=M();function i(e,t,r){return t.map(function(t){return(0,n.apply)(e,t,r)})}function a(e){function t(n,i,a){var o=e(n,i,a);return Array.isArray(o)?o:(0,r.diffAny)(n,i,a,t)}return t}function o(e,n,i){var o=new t.Pointer;return(i?a(i):r.diffAny)(e,n,o)}})),N=e(o(),1),be=e(l(),1),P=ye();function F(){}F.prototype={diff:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.callback;typeof n==`function`&&(r=n,n={}),this.options=n;var i=this;function a(e){return r?(setTimeout(function(){r(void 0,e)},0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var o=t.length,s=e.length,c=1,l=o+s;n.maxEditLength&&(l=Math.min(l,n.maxEditLength));var u=n.timeout??1/0,d=Date.now()+u,f=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(f[0],t,e,0);if(f[0].oldPos+1>=s&&p+1>=o)return a([{value:this.join(t),count:t.length}]);var m=-1/0,h=1/0;function g(){for(var n=Math.max(m,-c);n<=Math.min(h,c);n+=2){var r=void 0,l=f[n-1],u=f[n+1];l&&(f[n-1]=void 0);var d=!1;if(u){var g=u.oldPos-n;d=u&&0<=g&&g<o}var _=l&&l.oldPos+1<s;if(!d&&!_){f[n]=void 0;continue}if(r=!_||d&&l.oldPos+1<u.oldPos?i.addToPath(u,!0,void 0,0):i.addToPath(l,void 0,!0,1),p=i.extractCommon(r,t,e,n),r.oldPos+1>=s&&p+1>=o)return a(xe(i,r.lastComponent,t,e,i.useLongestToken));f[n]=r,r.oldPos+1>=s&&(h=Math.min(h,n-1)),p+1>=o&&(m=Math.max(m,n+1))}c++}if(r)(function e(){setTimeout(function(){if(c>l||Date.now()>d)return r();g()||e()},0)})();else for(;c<=l&&Date.now()<=d;){var _=g();if(_)return _}},addToPath:function(e,t,n,r){var i=e.lastComponent;return i&&i.added===t&&i.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:i.count+1,added:t,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:i}}},extractCommon:function(e,t,n,r){for(var i=t.length,a=n.length,o=e.oldPos,s=o-r,c=0;s+1<i&&o+1<a&&this.equals(t[s+1],n[o+1]);)s++,o++,c++;return c&&(e.lastComponent={count:c,previousComponent:e.lastComponent}),e.oldPos=o,s},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},castInput:function(e){return e},tokenize:function(e){return e.split(``)},join:function(e){return e.join(``)}};function xe(e,t,n,r,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,c=a.length,l=0,u=0;s<c;s++){var d=a[s];if(!d.removed){if(!d.added&&i){var f=n.slice(l,l+d.count);f=f.map(function(e,t){var n=r[u+t];return n.length>e.length?n:e}),d.value=e.join(f)}else d.value=e.join(n.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}else if(d.value=e.join(r.slice(u,u+d.count)),u+=d.count,s&&a[s-1].added){var p=a[s-1];a[s-1]=a[s],a[s]=p}}var m=a[c-1];return c>1&&typeof m.value==`string`&&(m.added||m.removed)&&e.equals(``,m.value)&&(a[c-2].value+=m.value,a.pop()),a}var Se=new F;function Ce(e,t,n){return Se.diff(e,t,n)}var I=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,L=/\S/,R=new F;R.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!L.test(e)&&!L.test(t)},R.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&I.test(t[n])&&I.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};function we(e,t,n){return R.diff(e,t,n)}var z=new F;z.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
2
- `));var t=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var r=0;r<n.length;r++){var i=n[r];r%2&&!this.options.newlineIsToken?t[t.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),t.push(i))}return t};var Te=new F;Te.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var Ee=new F;Ee.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function B(e){"@babel/helpers - typeof";return B=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},B(e)}var De=Object.prototype.toString,V=new F;V.useLongestToken=!0,V.tokenize=z.tokenize,V.castInput=function(e){var t=this.options,n=t.undefinedReplacement,r=t.stringifyReplacer,i=r===void 0?function(e,t){return t===void 0?n:t}:r;return typeof e==`string`?e:JSON.stringify(H(e,null,null,i),i,` `)},V.equals=function(e,t){return F.prototype.equals.call(V,e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`))};function H(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i,e));var a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];var o;if(De.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=H(e[a],t,n,r,i);return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),B(e)===`object`&&e!==null){t.push(e),o={},n.push(o);var s=[],c;for(c in e)e.hasOwnProperty(c)&&s.push(c);for(s.sort(),a=0;a<s.length;a+=1)c=s[a],o[c]=H(e[c],t,n,r,c);t.pop(),n.pop()}else o=e;return o}var U=new F;U.tokenize=function(e){return e.slice()},U.join=U.removeEmpty=function(e){return e};function W(e,t){let n=t.content.findDiffStart(e.content);if(n===null)return!1;let{a:r,b:i}=t.content.findDiffEnd(e.content),a=n-Math.min(r,i);return a>0&&(e.resolve(n-a).depth<t.resolve(r+a).depth?n-=a:(r+=a,i+=a)),new x(n,i,t.slice(n,r))}function Oe(e){if(!e.steps.length)return;let t=new S(e.docs[0]),n=e.steps.slice();for(;n.length;){let e=n.shift();for(;n.length&&e.merge(n[0]);){let r=n.shift();e=e instanceof x&&r instanceof x?W(t.doc,r.apply(e.apply(t.doc).doc).doc):e.merge(r)}t.step(e)}return t}function G(e){let t=new S(e);return t.removeMark(0,e.nodeSize-2),t.doc}function ke(e,t){let n=t.split(`/`);for(n.shift();n.length;){if(typeof e!=`object`)throw Error();let t=n.shift();e=e[t]}return e}function K(e){return JSON.parse(JSON.stringify(e))}var Ae=class{fromDoc;toDoc;complexSteps;wordDiffs;simplifyDiff;schema;tr;currentJSON;finalJSON;ops;constructor(e,t,n={}){let r={complexSteps:!0,wordDiffs:!1,simplifyDiff:!0,...n};this.fromDoc=e,this.toDoc=t,this.complexSteps=r.complexSteps,this.wordDiffs=r.wordDiffs,this.simplifyDiff=r.simplifyDiff,this.schema=e.type.schema,this.tr=new S(e),this.currentJSON={},this.finalJSON={},this.ops=[]}init(){return this.complexSteps?(this.currentJSON=G(this.fromDoc).toJSON(),this.finalJSON=G(this.toDoc).toJSON(),this.ops=(0,P.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps(),this.recreateChangeMarkSteps()):(this.currentJSON=this.fromDoc.toJSON(),this.finalJSON=this.toDoc.toJSON(),this.ops=(0,P.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps()),this.simplifyDiff&&(this.tr=Oe(this.tr)||this.tr),this.tr}recreateChangeContentSteps(){let e=[];for(;this.ops.length;){let t=this.ops.shift();e.push(t);let n,r=K(this.currentJSON),i=t.path.split(`/`);for(;n==null;){(0,P.applyPatch)(r,[t]);try{n=this.schema.nodeFromJSON(r),n.check()}catch{if(n=null,this.ops.length>0)t=this.ops.shift(),e.push(t);else throw Error(`No valid diff possible applying ${t.path}`)}}this.complexSteps&&e.length===1&&(i.includes(`attrs`)||i.includes(`type`))?(this.addSetNodeMarkup(),e=[]):e.length===1&&t.op===`replace`&&i[i.length-1]===`text`?(this.addReplaceTextSteps(t,r),e=[]):this.addReplaceStep(n,r)&&(e=[])}}addSetNodeMarkup(){let e=this.schema.nodeFromJSON(this.currentJSON),t=this.schema.nodeFromJSON(this.finalJSON),n=t.content.findDiffStart(e.content),r=e.nodeAt(n),i=t.nodeAt(n);if(n!=null){let e=r.type===i.type?null:i.type;try{this.tr.setNodeMarkup(n,e,i.attrs,i.marks)}catch(t){if(e&&t.message.includes(`Invalid content`))this.tr.replaceWith(n,n+r.nodeSize,i);else throw t}return this.currentJSON=G(this.tr.doc).toJSON(),this.ops=(0,P.createPatch)(this.currentJSON,this.finalJSON),!0}return!1}recreateChangeMarkSteps(){this.toDoc.descendants((e,t)=>{if(!e.isInline)return!0;this.tr.doc.nodesBetween(t,t+e.nodeSize,(n,r)=>{if(!n.isInline)return!0;let i=Math.max(t,r),a=Math.min(t+e.nodeSize,r+n.nodeSize);n.marks.forEach(t=>{t.isInSet(e.marks)||this.tr.removeMark(i,a,t)}),e.marks.forEach(e=>{e.isInSet(n.marks)||this.tr.addMark(i,a,e)})})})}addReplaceStep(e,t){let n=W(this.schema.nodeFromJSON(this.currentJSON),e);if(!n)return!1;if(!this.tr.maybeStep(n).failed)return this.currentJSON=t,!0;throw Error(`No valid step found.`)}addReplaceTextSteps(e,t){let n={...e,value:`xx`},r={...e,value:`yy`},i=K(this.currentJSON),a=K(this.currentJSON);(0,P.applyPatch)(i,[n]),(0,P.applyPatch)(a,[r]);let o=this.schema.nodeFromJSON(i),s=this.schema.nodeFromJSON(a),c=e.value,l=ke(this.currentJSON,e.path),u=this.wordDiffs?we(l,c):Ce(l,c),d=o.content.findDiffStart(s.content),f=o.resolve(d+1).marks();for(;u.length;){let e=u.shift();if(e.added){let t=this.schema.nodeFromJSON({type:`text`,text:e.value}).mark(f);if(u.length&&u[0].removed){let e=u.shift();this.tr.replaceWith(d,d+e.value.length,t)}else this.tr.insert(d,t);d+=e.value.length}else if(e.removed)if(u.length&&u[0].added){let t=u.shift(),n=this.schema.nodeFromJSON({type:`text`,text:t.value}).mark(f);this.tr.replaceWith(d,d+e.value.length,n),d+=t.value.length}else this.tr.delete(d,d+e.value.length);else d+=e.value.length}this.currentJSON=t}};function je(e,t,n={}){return new Ae(e,t,n).init()}var Me=new Set([`list`,`bulletList`,`orderedList`,`taskList`]);function q(e){let t=[];return e.forEach((e,n)=>{if(Me.has(e.type.name)){let r=n+1,i=0;e.forEach(e=>{let n=r+i;t.push({from:n,to:n+e.nodeSize,key:`${e.type.name}:${e.textContent}`}),i+=e.nodeSize})}else t.push({from:n,to:n+e.nodeSize,key:`${e.type.name}:${e.textContent}`})}),t}function Ne(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let a=n-1;a>=0;a--)for(let n=r-1;n>=0;n--)i[a][n]=e[a].key===t[n].key?i[a+1][n+1]+1:Math.max(i[a+1][n],i[a][n+1]);let a=[],o=0,s=0;for(;o<n&&s<r;)e[o].key===t[s].key?(a.push({type:`same`,b:t[s]}),o++,s++):i[o+1][s]>=i[o][s+1]?(a.push({type:`del`,a:e[o]}),o++):(a.push({type:`ins`,b:t[s]}),s++);for(;o<n;)a.push({type:`del`,a:e[o++]});for(;s<r;)a.push({type:`ins`,b:t[s++]});return a}function Pe(e,t){let n=Ne(q(e),q(t)),r=[],i=0;for(let e of n)e.type===`same`?i=e.b.to:e.type===`ins`?(r.push({fromA:0,toA:0,fromB:e.b.from,toB:e.b.to}),i=e.b.to):r.push({fromA:e.a.from,toA:e.a.to,fromB:i,toB:i});return r}var Fe=400;function J(e,t,n){return t.nodeFromJSON(e.parseWithFallback(n))}function Ie(e,t){let n=t.filter(e=>e.toB>e.fromB),r=[];return e.steps.forEach((t,i)=>{let a=t instanceof _?`add`:t instanceof ee?`remove`:null;if(a===null)return;let o=t,s=e.mapping.slice(i+1),c=s.map(o.from,-1),l=s.map(o.to,1);if(l<=c||n.some(e=>e.fromB<=c&&l<=e.toB))return;let u=e.mapping.slice(0,i).invert(),d=u.map(o.from),f=u.map(o.to);f<=d||r.push({fromA:d,toA:f,fromB:c,toB:l,markName:o.mark.type.name,kind:a})}),r}function Le(e,t,n,r){if(e.length>2e5||t.length>2e5)return{ok:!1,reason:`ceiling`};let i,a;try{i=J(r,n,e),a=J(r,n,t)}catch{return{ok:!1,reason:`parse`}}let o=a,s=null;try{s=je(i,a,{complexSteps:!0,wordDiffs:!0,simplifyDiff:!0}),o=s.doc}catch{}let c=Pe(i,o),l=s?Ie(s,c):[];return c.length+l.length>Fe?{ok:!1,reason:`ceiling`}:{ok:!0,afterDoc:o,beforeDoc:i,changes:c,markChanges:l}}var Re=`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`;function ze(e){return e.changes.length+2*e.markChanges.length}function Y(e){let t=!1;return e.forEach(e=>{e.isBlock&&(t=!0)}),t}function Be(e){if(e.childCount===0)return!1;let t=!0;return e.forEach(e=>{e.type.name!==`listItem`&&e.type.name!==`taskItem`&&(t=!1)}),t}function X(e,t,n){let r=document.createElement(n?`div`:`span`);r.className=n?`ok-diff-del ok-diff-del-block`:`ok-diff-del`,r.setAttribute(`data-diff-deleted`,``);let i=e.serializeFragment(t);if(n&&Be(t)){let e=document.createElement(`ul`);e.appendChild(i),r.appendChild(e)}else r.appendChild(i);return r}function Ve(e,t,n,r,i){let a=b.fromSchema(i),o=[];for(let e of r){let n=t.slice(e.fromA,e.toA),r=Y(n.content);o.push(g.widget(e.fromB,()=>X(a,n.content,r),{side:-1,ignoreSelection:!0,marks:[]})),o.push(g.inline(e.fromB,e.toB,{class:`ok-diff-ins`},{inclusiveEnd:!0}))}for(let e of n)if(e.toB>e.fromB&&o.push(g.node(e.fromB,e.toB,{class:`ok-diff-ins-block`})),e.toA>e.fromA){let n=t.slice(e.fromA,e.toA),r=Y(n.content);o.push(g.widget(e.fromB,()=>X(a,n.content,r),{side:-1,ignoreSelection:!0,marks:[]}))}return m.create(e,o)}var He=new Set([`slashCommand`,`blockDragHandle`,`blockMover`,`tableInsertControls`,`trailingAffordance`,`fileHandler`,`gfmAutolink`,`inlineLinkInputRule`,`keyboardNav`,`tiptapFindReplace`,`selectionState`,`sourceDirtyObserver`,`tabFocusTrap`]),Z=r.filter(e=>!He.has(e.name)).map(e=>e.name===`jsxComponent`?h:e),Q=f(Z);function Ue(e,t){return Le(e,t,Q,ue())}var We=ne.create({name:`renderedDiffDecorations`,addOptions(){return{decorations:m.empty}},addProseMirrorPlugins(){let e=this.options.decorations;return[new y({key:new te(`renderedDiffDecorations`),props:{decorations:()=>e}})]}});function Ge(e){let t=(0,T.c)(31),{diff:n}=e,r,i,a,o;if(t[0]!==n.afterDoc||t[1]!==n.beforeDoc||t[2]!==n.changes||t[3]!==n.markChanges){let e=Ve(n.afterDoc,n.beforeDoc,n.changes,n.markChanges,Q);o=ce,a=!1,r=Z,i=We.configure({decorations:e}),t[0]=n.afterDoc,t[1]=n.beforeDoc,t[2]=n.changes,t[3]=n.markChanges,t[4]=r,t[5]=i,t[6]=a,t[7]=o}else r=t[4],i=t[5],a=t[6],o=t[7];let s;t[8]!==r||t[9]!==i?(s=[...r,i],t[8]=r,t[9]=i,t[10]=s):s=t[10];let c;t[11]===n.afterDoc?c=t[12]:(c=n.afterDoc.toJSON(),t[11]=n.afterDoc,t[12]=c);let l;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(l={attributes:{class:`pt-4`}},t[13]=l):l=t[13];let u;t[14]!==a||t[15]!==s||t[16]!==c?(u={editable:a,extensions:s,content:c,editorProps:l},t[14]=a,t[15]=s,t[16]=c,t[17]=u):u=t[17];let d;t[18]===n?d=t[19]:(d=[n],t[18]=n,t[19]=d);let f=o(u,d),[p]=(0,N.useState)(Ke),m=(0,N.useRef)(null),h,g;t[20]===p?(h=t[21],g=t[22]):(h=()=>{let e=m.current;if(e)return e.appendChild(p),()=>{p.parentNode===e&&e.removeChild(p)}},g=[p],t[20]=p,t[21]=h,t[22]=g),(0,N.useLayoutEffect)(h,g);let _;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,E.jsx)(`div`,{className:`tiptap-editor`,children:(0,E.jsx)(`div`,{ref:m,style:{display:`contents`}})}),t[23]=_):_=t[23];let v;t[24]===f?v=t[25]:(v=(0,E.jsx)(le,{editor:f,className:`tiptap-editor-portal-content`}),t[24]=f,t[25]=v);let y;t[26]!==p||t[27]!==v?(y=(0,be.createPortal)(v,p),t[26]=p,t[27]=v,t[28]=y):y=t[28];let b;return t[29]===y?b=t[30]:(b=(0,E.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1`,"data-testid":`rendered-diff-view`,children:[_,y]}),t[29]=y,t[30]=b),b}function Ke(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var qe=`[data-property-change]`,Je=`[data-content] > [data-line-type="change-addition"], [data-content] > [data-line-type="change-deletion"]`;function Ye(e){let t=[];for(let n of e.querySelectorAll(`diffs-container`)){let e=n.shadowRoot;e&&t.push(...e.querySelectorAll(Je))}return t}function Xe(e,t){let n=new Map;return{sync(){for(let r of e.querySelectorAll(`diffs-container`)){let e=r.shadowRoot;if(e===null||n.has(e))continue;let i=new MutationObserver(t);i.observe(e,{childList:!0,subtree:!0}),n.set(e,i)}},disconnect(){for(let e of n.values())e.disconnect();n.clear()}}}function Ze(e){let t=Ye(e),n=[],r=null;for(let e of t)(r===null||e.previousElementSibling!==r)&&n.push(e),r=e;return n}function $(e){let t=0,n=0;for(let r of e.split(`
3
- `))r.startsWith(`+`)&&!r.startsWith(`+++`)?t++:r.startsWith(`-`)&&!r.startsWith(`---`)&&n++;return{additions:t,deletions:n}}function Qe(e,t){return`${e}\u0000${t}`}function $e(e,t,n){let r=d(e).body,i=d(t).body;return r===i?``:de(n,r,i,``,``,{context:Math.max(r.split(`
4
- `).length,i.split(`
5
- `).length)})}function et(e,t,n,r,a){let o=(0,T.c)(10),s=r===void 0?`vs-live`:r,c=a===void 0?null:a,{activeProvider:l}=i(),u;o[0]===Symbol.for(`react.memo_cache_sentinel`)?(u={status:`idle`,diff:null},o[0]=u):u=o[0];let[f,p]=(0,N.useState)(u),m=(0,N.useRef)(l),h;o[1]===l?h=o[2]:(h=()=>{m.current=l},o[1]=l,o[2]=h),(0,N.useEffect)(h);let g,_;return o[3]!==n||o[4]!==t||o[5]!==s||o[6]!==c||o[7]!==e?(g=()=>{if(!e){p({status:`idle`,diff:null});return}let r=e,i=!1;p({status:`loading`,diff:null});let a=async function(e){let r=Qe(t,e),i=n.get(r);if(i!==void 0)return i;let a=await fetch(`/api/history/${e}?docName=${encodeURIComponent(t)}`);if(!a.ok)return console.error(`[timeline-diff] history fetch returned non-ok response`,{sha:e,docName:t,status:a.status}),null;let o=(await a.json()).content??``;return n.set(r,o),o};return(async function(){try{let e=await a(r);if(i)return;if(e===null){p({status:`error`,diff:null});return}let n,o;if(s===`vs-parent`){let t=c?await a(c):``;if(i)return;if(t===null){p({status:`error`,diff:null});return}n=t,o=e}else n=e,o=m.current?.document.getText(`source`).toString()??``;let l=d(n).body,u=d(o).body,f=$e(n,o,t),h=v(n,o);if(i)return;let{additions:g,deletions:_}=$(f);p({status:`ready`,diff:f,additions:g,deletions:_,before:l,after:u,properties:h})}catch(e){i||(console.error(`[timeline-diff] failed to load entry diff`,{sha:r,docName:t,mode:s,err:e}),p({status:`error`,diff:null}))}})(),()=>{i=!0}},_=[e,t,n,s,c],o[3]=n,o[4]=t,o[5]=s,o[6]=c,o[7]=e,o[8]=g,o[9]=_):(g=o[8],_=o[9]),(0,N.useEffect)(g,_),f}export{Xe as a,Re as c,Ze as i,ze as l,et as n,Ge as o,qe as r,Ue as s,$ as t,fe as u};
@@ -1 +0,0 @@
1
- import"./md-manager-BGnqyqi1-hmuoZRep.mjs";import"./init-R__-FL-k.mjs";import"./registry-probes-Cthf_D-E.mjs";import"./src-CQqhz0Kv.mjs";import"./start-C9LxTCYi.mjs";import{n as e}from"./loader-BRYG-jTN.mjs";import"./preview-DjhHIWGN.mjs";import"./cli.mjs";import"./repair-mcp-configs-Dz9benJ2.mjs";export{e as loadConfig};
@@ -1,11 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-tZXQYakl.mjs";import{An as t,Ec as n,Es as r,Oc as i,Tc as a,_o as o,bd as s,fu as c,hs as l,jn as ee,nc as te,zn as ne}from"./md-manager-BGnqyqi1-hmuoZRep.mjs";import{$a as u,$r as d,Ct as f,Eo as p,Fn as m,Gn as h,Gr as g,Qr as _,To as v,Xi as y,Yn as b,Zr as x,cr as S,gi as C,hi as w,m as T,wo as E,zr as D}from"./dist-B7NFh0MZ.mjs";import{t as re}from"./yazl-BBz29IQN.mjs";import{at as O,ot as k,vt as A}from"./init-R__-FL-k.mjs";import{b as j,l as ie}from"./registry-probes-Cthf_D-E.mjs";import{c as M}from"./colors-r_owlCuY.mjs";import{t as N}from"./is-object-BGze3w87.mjs";import{n as ae}from"./constants-tN6BLxqK.mjs";import"./loader-BRYG-jTN.mjs";import"./preview-DjhHIWGN.mjs";import{execSync as oe,spawnSync as P}from"node:child_process";import{basename as F,dirname as I,isAbsolute as se,join as L,relative as R,resolve as z,sep as B}from"node:path";import{closeSync as ce,cpSync as le,createWriteStream as ue,existsSync as V,lstatSync as de,mkdirSync as H,mkdtempSync as fe,openSync as pe,readFileSync as U,readSync as me,readdirSync as W,rmSync as G,rmdirSync as he,statSync as ge,writeFileSync as K}from"node:fs";import{arch as _e,freemem as ve,homedir as q,hostname as ye,platform as be,release as xe,tmpdir as Se,totalmem as Ce,type as we,uptime as Te}from"node:os";import"node:fs/promises";import{createHash as Ee}from"node:crypto";const De=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Oe(e,t,n=b){if(e!==void 0&&!De.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let ke=null;function Ae(e){ke=e}function je(){return ke??process.cwd()}const Me=`Open Knowledge`;function Ne(e={}){let t=e.platformName??process.platform,n=e.productName??`OpenKnowledge`;return O(t).join(k({...e,platformName:t}),n)}function Pe(e={}){let t=e.platformName??process.platform,n=e.home??q(),r=e.env??process.env,i=O(t),a;return a=t===`win32`?r.LOCALAPPDATA||i.join(n,`AppData`,`Local`):t===`darwin`?i.join(n,`Library`,`Caches`):r.XDG_CACHE_HOME||i.join(n,`.cache`),i.join(a,`@inkeepopen-knowledge-desktop-updater`)}function Fe(e){if(typeof e!=`object`||!e)return null;let t=e.recentProjects;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.path==`string`&&typeof t.name==`string`&&n.push({path:t.path,name:t.name})}return n}function Ie(e){let t=L(e,`state.json`);if(!V(t))return[];let n;try{n=JSON.parse(U(t,`utf-8`))}catch{return[]}return Fe(n)??[]}function Le(e){let t=L(e,`state.json`);if(!V(t))return!1;try{return Fe(JSON.parse(U(t,`utf-8`)))!==null}catch{return!1}}const Re=8192;function ze(e,t){if(e.outcome===`not-present`)return`not-present (no DiagnosticReports directory)`;if(e.outcome===`unreadable-directory`)return`unreadable (${e.directoryErrorCode??`unknown`} reading DiagnosticReports)`;let n=[`${e.windowDays}d`,`${e.foreignIgnored} other-process report(s) ignored`,`${e.unparseable} unparseable`];e.droppedOverCap>0&&n.push(`${e.droppedOverCap} older dropped over cap`);let r=e.files.length-t;return r>0&&n.push(`${r} vanished before staging`),e.outcome===`none-in-window`?`none found in window (${n.join(`; `)})`:`${t} collected (${n.join(`; `)})`}function Be(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const Ve=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function He(e){return e.replace(Ve,`$1"[REDACTED-DEVICE-ID]"`)}function Ue(e){return He(Be(e))}const We=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function Ge(e){if(typeof e!=`string`)return null;let t=We.exec(e.trim());if(t===null)return null;let[,n,r,i=``,a,o]=t,s=Date.parse(`${n}T${r}${i}${a}:${o}`);return Number.isNaN(s)?null:s}function Ke(e){let t=pe(e,`r`);try{let e=Buffer.alloc(Re),n=0,r=!1;for(;n<Re;){let i=me(t,e,n,Re-n,n);if(i===0){r=!0;break}let a=n;n+=i;let o=e.subarray(0,n).indexOf(10,a);if(o!==-1)return e.subarray(0,o).toString(`utf-8`)}return r?e.subarray(0,n).toString(`utf-8`):null}finally{ce(t)}}function qe(e){try{let t=Ke(e);if(t===null)return{kind:`unreadable`};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{kind:`unreadable`};let{name:r,app_name:i,timestamp:a}=n,o=typeof r==`string`?r:typeof i==`string`?i:null;return o===null?{kind:`unreadable`}:{kind:`named`,name:o,timestampMs:Ge(a)}}catch{return{kind:`unreadable`}}}function Je(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function Ye(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=W(e,{withFileTypes:!0})}catch(e){let t=e.code;return t===`ENOENT`?{...n,outcome:`not-present`}:{...n,outcome:`unreadable-directory`,directoryErrorCode:t??`unknown`}}let i=t.getTime()-6048e5,a=[],o=0,s=0;for(let t of r){if(!t.isFile()||!t.name.endsWith(`.ips`))continue;let n=L(e,t.name),r;try{r=ge(n).mtimeMs}catch{continue}if(r<i)continue;let c=qe(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!Je(c.name)){o+=1;continue}a.push({path:n,atMs:l})}a.sort((e,t)=>t.atMs-e.atMs);let c=a.slice(0,25),l={foreignIgnored:o,unparseable:s,droppedOverCap:a.length-c.length,windowDays:7};return c.length===0?{...l,files:[],outcome:`none-in-window`}:{...l,files:c.map(e=>e.path),outcome:`collected`}}function J(){return L(q(),`.ok`,`bug-reports`)}function Xe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=J(),r=`${t}-bugreport`,i=L(n,`${r}.zip`);for(let e=2;V(i);e+=1)i=L(n,`${r}-${e}.zip`);return i}function Ze(e,t){let n=L(e,`.ok`,`config.yml`);if(V(n))try{let e=U(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return V(L(e,`.ok`))?Ee(`sha256`).update(z(e)).digest(`hex`).slice(0,12):null}function Qe(){let e={timestamp:new Date().toISOString(),platform:be(),osType:we(),osRelease:xe(),hostname:`[redacted]`,uptime:Te(),freeMem:ve(),totalMem:Ce(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=oe(`sw_vers -productVersion 2>/dev/null`,u({encoding:`utf8`})).trim()}catch{}try{let t=L(__dirname,`..`,`..`,`package.json`);V(t)&&(e.okVersion=JSON.parse(U(t,`utf8`)).version)}catch{}return e}const $e=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function et(e){let t=F(e);return $e.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function tt(e,t){return at(e,t).files}const nt=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function rt(e,t=ie){let n=L(e,`${t}.ShipIt`);if(!V(n))return[];let r;try{r=W(n)}catch{return[]}return nt.flatMap(e=>r.map(t=>{if(t===e)return{entry:t,suffix:-1};if(!t.startsWith(`${e}.`))return null;let n=t.slice(e.length+1);return/^\d+$/.test(n)?{entry:t,suffix:Number(n)}:null}).filter(e=>e!==null).sort((e,t)=>e.suffix-t.suffix).slice(0,4).map(e=>L(n,e.entry)))}function it(e){if(!V(e))return[];try{let n=new Map;for(let r of W(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=r.endsWith(`.sent.yaml`)?r.slice(0,-t.length):r.slice(0,-5),i=n.get(e);i===void 0?n.set(e,[r]):i.push(r)}return[...n.values()].slice(-25).flat().map(t=>L(e,t))}catch{return[]}}function at(e,t){if(!V(t))return{files:[],excludedByProjectSlug:0};let n=W(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>L(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(et),i=[],a=r.filter(t=>{try{return U(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!et(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function ot(e){let t=L(e,`.ok`,`local`);return V(t)?{files:[`server.lock`,`last-spawn-error.log`,a].map(e=>L(t,e)).filter(e=>V(e))}:{files:[]}}function st(e){let t=L(e,`.ok`,`local`,`logs`);return V(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>L(t,e)).filter(e=>V(e))}:{files:[]}}function ct(e){let t=0,n=new Map,r=e.replace(/("(?:docName|doc\.name|documentName)"\s*:\s*")((?:[^"\\]|\\.)*)"/g,(e,r,i)=>{t+=1;let a=n.get(i);return a===void 0&&(a=`doc#${Ee(`sha256`).update(i).digest(`hex`).slice(0,12)}`,n.set(i,a)),`${r}${a}"`});for(let[e,i]of[...n].sort(([e],[t])=>t.length-e.length)){if(e.length===0||!r.includes(e))continue;let n=r.split(e);t+=n.length-1,r=n.join(i)}return{text:r,count:t}}function lt(e){let t=e.revealDocNames?e.content:ct(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=l(t);e.zipfile.addBuffer(Buffer.from(n,`utf8`),e.name),e.bundleFiles.push(e.name),r.length>0&&e.redactions.push({file:e.name,lineCount:i,patterns:r})}else e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name)}function Y(e){for(let t of e.files)try{let n=U(t,`utf8`);lt({zipfile:e.zipfile,name:`${e.prefix}/${F(t)}`,content:t.endsWith(`.ips`)?Ue(n):n,redact:e.redact,revealDocNames:e.revealDocNames,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function ut(t){let{redact:n,outputPath:r,logger:i}=t,a=t.revealDocNames??!1,o=t.userLogsDir??L(q(),`.ok`,`logs`),s=t.projectDir?Ze(t.projectDir,i):null;H(I(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=Qe();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:te}=at(s,o),{files:u}=t.projectDir?ot(t.projectDir):{files:[]},{files:d}=t.projectDir?st(t.projectDir):{files:[]},f=t.shipItLogFiles??[],p=t.diagnosticReports?.files??[];i?.info({logFileCount:l.length,logFilesExcludedByProjectSlug:te,lockFileCount:u.length,localSinkFileCount:d.length,shipItLogFileCount:f.length,diagnosticReportCount:p.length},`files collected`);let m=[],h=[],{ZipFile:g}=await import(`./yazl-BsCX6KWo.mjs`).then(t=>e(t.default,1)),_=new g;Y({zipfile:_,files:[...l,...f],prefix:`logs`,redact:n,revealDocNames:a,bundleFiles:h,redactions:m,logger:i}),Y({zipfile:_,files:u,prefix:`lockdir`,redact:n,revealDocNames:a,bundleFiles:h,redactions:m,logger:i}),Y({zipfile:_,files:d,prefix:`local-logs`,redact:n,revealDocNames:a,bundleFiles:h,redactions:m,logger:i}),Y({zipfile:_,files:t.bugReportLedgerFiles??[],prefix:ee,redact:n,revealDocNames:a,bundleFiles:h,redactions:m,logger:i}),Y({zipfile:_,files:p,prefix:`diagnostic-reports`,redact:n,revealDocNames:a,bundleFiles:h,redactions:m,logger:i});for(let e of t.extraFiles??[])try{let t=U(e.sourcePath),n=`extra/${e.zipName??F(e.sourcePath)}`;_.addBuffer(t,n),h.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&lt({zipfile:_,name:`note.txt`,content:t.note,redact:n,revealDocNames:a,bundleFiles:h,redactions:m});let v=new Set(p.map(e=>`diagnostic-reports/${F(e)}`)),y=h.filter(e=>v.has(e)),b=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:ze(t.diagnosticReports,y.length);_.addBuffer(Buffer.from(`${b}\n`,`utf8`),`state/diagnostic-reports-status.txt`),h.push(`state/diagnostic-reports-status.txt`);let x=JSON.stringify(c,null,2);_.addBuffer(Buffer.from(x,`utf8`),`sysinfo.json`),h.push(`sysinfo.json`);let S={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:h,redactions:m,sysinfo:c};_.addBuffer(Buffer.from(JSON.stringify(S,null,2),`utf8`),`MANIFEST.json`);let C=m.reduce((e,t)=>e+t.lineCount,0),w=new Set(f.map(e=>`logs/${F(e)}`)),T=h.filter(e=>w.has(e)),E=new Set((t.bugReportLedgerFiles??[]).map(e=>`${ee}/${F(e)}`)),D=h.filter(e=>E.has(e)),re=s?h.filter(e=>e.startsWith(`logs/`)&&!et(e)&&!w.has(e)):[],O=y.length>0?[`Crash reports under diagnostic-reports/ are rewritten on the way in,`,`independently of this setting: escaped path separators are normalised`,`so the scrub above can read them, and the identifiers that link this`,`machine's bundles to each other are replaced. Nothing else is changed;`,`they are not byte-identical to the files macOS wrote.`]:[],k=O.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...O]:[`Redaction was disabled for this bundle; file contents are unmodified.`],A=[`# Bug Report Bundle`,``,`Generated: ${S.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${S.disciplineVersion}`,``,`## Contents`,``,...h.map(e=>`- ${e}`),``,`## Privacy`,``,...re.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...re.map(e=>`- ${e}`),``]:[],...T.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...T.map(e=>`- ${e}`),``]:[],...y.length>0?[`Crash reports: written by macOS itself rather than by OpenKnowledge,`,`and machine-wide rather than scoped to any one project. They record`,`why the operating system ended a process of this app — the signal or`,`exception, the code-signing verdict, and whatever text the process`,`left behind as it died. They also carry machine details the OS puts`,`in every report: the account uid, the Mac model, and the name of the`,`process that launched this app, which on a managed machine can be`,`internal tooling. The identifiers that would link this machine's`,`bundles to each other are replaced before bundling. Only this`,`app's own reports are collected, never another application's, though`,`a report of ours still names the processes it ran alongside:`,...y.map(e=>`- ${e}`),``]:[],...D.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...D.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${ne.join(`, `)}`,C>0?`${C} line(s) were scrubbed across ${m.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...O,``,`This bundle is safe to attach to a GitHub issue.`]:k].join(`
2
- `);_.addBuffer(Buffer.from(A,`utf8`),`README.md`),_.end();let j=ue(r);return _.outputStream.pipe(j),await new Promise((e,t)=>{j.on(`close`,e),j.on(`error`,t)}),i?.info({bundlePath:r,fileCount:h.length,redactionCount:C},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:h,redactions:m,redactedLineCount:C,generatedAt:S.generatedAt}}}var dt=c(),ft=e(re(),1),X=e(M(),1);function pt(e){let t=p(`user`,e,e);return E({absPath:t,sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function mt({home:e=q(),env:t=process.env}={}){let n=pt(e),{override:a,preferenceList:o}=v(t),{locale:s,source:c}=r({override:a,storedPreference:n,supportedLocales:i,preferenceList:o,autoDetectableLocales:te});return{preference:n,locale:s,source:c,systemLanguages:o}}function ht(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function gt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _t(e,t){if(typeof e==`string`)return ht(e,t.contentDir);if(Array.isArray(e))return e.map(e=>_t(e,t));if(!gt(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=_t(i,t);return n}function vt(e,t){let n=U(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
3
- `),i=n.split(`
4
- `),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(e!==i.length-1||n!==``){if(n.length===0){a.push(``);continue}try{let e=_t(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}let o=r?`${a.join(`
5
- `)}\n`:a.join(`
6
- `);K(e,o)}function yt(e,t){let n=U(e,`utf-8`);if(n.trim().length!==0)try{let r=_t(JSON.parse(n),t),i=n.endsWith(`
7
- `)?`
8
- `:``;K(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=ht(n,t.contentDir);r!==n&&K(e,r)}}function bt(e,t){let n=U(e,`utf-8`),r=ht(n,t.contentDir);r!==n&&K(e,r)}function xt(e){try{return W(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>L(e,t.name))}catch{return[]}}const St=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function Ct(e){return/\.log\.\d+$/.test(e)}function wt(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||Ct(e)}const Tt=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function Et(e){let t={contentDir:e.contentDir};for(let n of Tt)for(let r of xt(L(e.stagingDir,n)))wt(r)?vt(r,t):r.endsWith(`.json`)?yt(r,t):bt(r,t);for(let n of xt(L(e.stagingDir,`state`))){let e=F(n);n.endsWith(`.jsonl`)?vt(n,t):St.has(e)?yt(n,t):bt(n,t)}}const Dt=[`.ok`,`local`,`telemetry`],Ot=[`.ok`,`local`,`logs`],kt=[`.ok`,`local`,`loss-capture`],At=`spans-current.jsonl`,jt=`spans-prev.jsonl`,Mt=`server-current.jsonl`,Nt=`server-prev.jsonl`,Pt=`loss-current.jsonl`,Ft=`loss-prev.jsonl`;function It(e){return L(e,...Dt,At)}function Lt(e){return L(e,...Dt,jt)}function Rt(e){return L(e,...Ot,Mt)}function zt(e){return L(e,...Ot,Nt)}function Bt(e){return L(e,...kt,Pt)}function Vt(e){return L(e,...kt,Ft)}const Ht=1e3;async function Ut(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(Ht)});return t.ok?await t.text():null}catch{return null}}async function Wt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(Ht)});return t.ok?await t.text():null}catch{return null}}async function Gt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(Ht)});return t.ok?await t.text():null}catch{return null}}function Kt(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
9
- `)}\n`:null}catch{return null}}function qt(e){let t=L(e,`.git`,`ok`);if(!V(t))return null;let n=P(`git`,[`-C`,t,`log`,`--oneline`,`-50`],u({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Jt(e){let t=L(e,`.git`,`ok`);if(!V(t))return null;let n=P(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],u({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Yt(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function Xt(){return{nodeVersion:process.version,platform:be(),arch:_e()}}function Zt(){return process.env.OTEL_SDK_DISABLED===`false`}function Qt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $t(e){if(!V(e))return{};let t;try{t=(0,dt.parse)(U(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!Qt(t))return{};let n=t.telemetry;if(!Qt(n))return{};let r=n.localSink;return Qt(r)?r:{}}function en(e){return typeof e==`boolean`?e:void 0}function tn(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function nn(e){if(Qt(e))return tn(e.maxBytes)}function rn(e){let t=$t(p(`project`,e)),n=$t(p(`project-local`,e));return{enabled:en(n.enabled)??en(t.enabled)??!0,spansMaxBytes:nn(n.spans)??nn(t.spans)??52428800,logsMaxBytes:nn(n.logs)??nn(t.logs)??26214400}}function an(e){return Ee(`sha256`).update(e).digest(`hex`)}function on(e){let t=U(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const sn=[`"doc.name"`,`"docName"`];function cn(e){let t=U(e,`utf-8`),n=0;for(let e of sn){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z(e,t){if(!V(e))return!1;try{return H(I(t),{recursive:!0}),e.endsWith(`.ips`)?K(t,Ue(U(e,`utf-8`))):le(e,t),!0}catch{return!1}}function ln(e){let t=[],n=e=>{let r=W(e,{withFileTypes:!0});for(let i of r){let r=L(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const un=new Set([`.jsonl`]);function dn(e){let t=e.lastIndexOf(`.`);return t!==-1&&un.has(e.slice(t))}const fn=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function pn(e){if(Ct(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&fn.has(e.slice(t))}function mn(e){let t=[];for(let n of ln(e)){let r=hn(e,n);if(!pn(r))continue;let{redacted:i,patterns:a,lineCount:o}=l(U(n,`utf-8`));a.length!==0&&(K(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function hn(e,t){return R(e,t).split(B).join(`/`)}async function gn(e){let t=z(e.contentDir),r=z(e.projectDir??e.contentDir),i=e.deps??{},o=i.fetchAgentPresence??Ut,s=i.fetchAgentEffects??Wt,c=i.fetchWatcherRecent??Gt,l=i.readShadowHead??qt,te=i.readCheckpointRefs??Jt,ne=i.now??(()=>new Date),u=i.okVersion??(()=>ae),d=i.readDesktopEnv??Yt,f=i.readLanguage??mt,p=i.readRuntime??Xt,m=i.isOtlpPushEnabled??Zt,h=fe(L(Se(),`ok-bundle-`));try{H(L(h,`telemetry`),{recursive:!0}),H(L(h,`logs`),{recursive:!0}),H(L(h,`state`),{recursive:!0}),Z(It(r),L(h,`telemetry`,At)),Z(Lt(r),L(h,`telemetry`,jt)),Z(Rt(r),L(h,`logs`,Mt)),Z(zt(r),L(h,`logs`,Nt));for(let t of e.userLogFiles??[])Z(t,L(h,`logs`,F(t)));for(let t of e.userStateFiles??[])Z(t,L(h,ee,F(t)));let g=0;for(let t of e.diagnosticReports?.files??[])Z(t,L(h,`diagnostic-reports`,F(t)))&&(g+=1);let _=L(r,`.ok`,`local`),v=L(_,`server.lock`),y=`not-running`,b=`no server.lock`,x=null;if(V(v)){Z(v,L(h,`state`,`server.lock`));try{let e=U(v,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?x=t.port:b=`lock present but no port`}catch{b=`lock present but unparseable`}}if(x!==null){let e=await o(x);e===null?b=`agent-presence endpoint at :${x} unreachable`:(K(L(h,`state`,`agent-presence.json`),e),y=`running`,b=``);let t=await s(x);t!==null&&K(L(h,`state`,`agent-effects.json`),t);let n=await c(x);if(n!==null){let e=Kt(n);e!==null&&K(L(h,`state`,`watcher-recent.jsonl`),e)}}let S=l(t);S!==null&&K(L(h,`state`,`shadow-head.txt`),S);let C=te(t);C!==null&&K(L(h,`state`,`checkpoint-refs.txt`),C),Z(Bt(r),L(h,`state`,Pt)),Z(Vt(r),L(h,`state`,Ft)),Z(L(_,`last-spawn-error.log`),L(h,`state`,`last-spawn-error.log`)),Z(L(_,n),L(h,`state`,n)),Z(L(_,a),L(h,`state`,a));let w=p(),T=d(),E=f(),D={ok:{version:u(),nodeVersion:w.nodeVersion,platform:w.platform,arch:w.arch},host:{desktop:T,language:E}};K(L(h,`state`,`runtime.json`),`${JSON.stringify(D,null,2)}\n`);let re=y===`running`?`running
10
- `:`not-running (${b})\n`;K(L(h,`state`,`server-status.txt`),re);let O=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:ze(e.diagnosticReports,g);if(K(L(h,`state`,`diagnostic-reports-status.txt`),`${O}\n`),e.processDir&&V(e.processDir)){let t=L(h,`process`);H(t,{recursive:!0}),le(e.processDir,t,{recursive:!0})}let k=e.redact===!0;k&&Et({stagingDir:h,contentDir:t}),e.note&&K(L(h,`note.txt`),e.note);let A=null;e.scrubSecrets===!0&&(A=mn(h));for(let t of e.extraFiles??[])Z(t.sourcePath,L(h,`extra`,t.zipName??F(t.sourcePath)))||i.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let j=rn(r),ie=ln(h),M=[],N=0,ae=0;for(let e of ie){let t=hn(h,e),n=ge(e).size,r=dn(t)?on(e):0;M.push({path:t,bytes:n,lines:r}),N+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(ae+=cn(e))}let oe={applied:k};A!==null&&(oe.secretScrub=A);let P={schemaVersion:2,createdAt:ne().toISOString(),ok:{version:u(),nodeVersion:w.nodeVersion,platform:w.platform,arch:w.arch},host:{desktop:T,language:E},contentDir:{pathSha256:an(t),absolutePath:k?`<CONTENT_DIR>`:t},telemetry:{localSink:j,otlpPushEnabled:m()},redaction:oe,serverStatus:y,files:M};K(L(h,`manifest.json`),`${JSON.stringify(P,null,2)}\n`);let I=ie.some(e=>{try{return U(e,`utf-8`).includes(t)}catch{return!1}}),se={stagedDiagnosticReports:g,totalBytes:N,fileCount:M.length,docNameCount:ae,contentDirVisible:I,redacted:k},R=!1;return{stagingDir:h,manifest:P,summary:se,cleanup:()=>{R||(R=!0,G(h,{recursive:!0,force:!0}))}}}catch(e){throw G(h,{recursive:!0,force:!0}),e}}async function _n(e){let{collected:t,outputPath:n}=e,r=I(n);if(!V(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new ft.ZipFile,a=ln(t.stagingDir);for(let e of a){let n=hn(t.stagingDir,e);i.addFile(e,n)}i.end();let o=ue(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function vn(e,t){let n=L(e,`.ok`,`config.yml`);if(V(n))try{let t=(0,dt.parse)(U(n,`utf-8`)),r=N(t)?t.content:void 0,i=N(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return z(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return z(e)}async function yn(e,t,n,r,i){let a=Ze(t,e.logger),o=await gn({contentDir:vn(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...tt(a,e.userLogsDir??L(q(),`.ok`,`logs`)),...rt(e.cachesDir??L(q(),`Library`,`Caches`))],userStateFiles:it(e.bugReportsDir??J()),diagnosticReports:i,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{H(I(e.outputPath),{recursive:!0}),await _n({collected:o,outputPath:e.outputPath});let t=o.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:a,files:o.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:o.manifest.createdAt}}}finally{o.cleanup()}}async function bn(e){let{projectDir:t}=e,n=e.readDesktopEnv??Yt,r=e.readLanguage??mt,i=()=>Ye(e.diagnosticReportsDir??L(q(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return yn(e,t,n,r,i());let{zipPath:a,summary:o}=await ut({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:rt(e.cachesDir??L(q(),`Library`,`Caches`)),bugReportLedgerFiles:it(e.bugReportsDir??J()),diagnosticReports:e.level===`full`?i():void 0,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:a,summary:{level:e.level,systemWide:t===void 0,projectSlug:o.projectSlug,files:o.files,redactions:o.redactions,redactedLineCount:o.redactedLineCount,generatedAt:o.generatedAt}}}function Q(e,t,n={}){let r=d(e,t),i;try{i=U(r,`utf-8`)}catch(e){return e&&typeof e==`object`&&`code`in e&&e.code===`ENOENT`?{status:`missing`,lockPath:r}:{status:`read-error`,lockPath:r,error:e instanceof Error?e.message:String(e)}}let a;try{a=JSON.parse(i)}catch{return{status:`corrupt`,lockPath:r}}let o=a&&typeof a==`object`?a:{},s=`machineId`in o&&typeof o.machineId==`string`?o.machineId!==(n.machineId??S()):`hostname`in o&&typeof o.hostname==`string`&&o.hostname!==(n.host??ye());if(!a||typeof a!=`object`||!g(a.pid))return{status:`corrupt`,lockPath:r,...s?{foreignHost:!0}:{}};let c=a.pid,l=`machineId`in o&&typeof o.machineId==`string`||`hostname`in o&&typeof o.hostname==`string`;return s?{status:`foreign-host`,lockPath:r,lock:a}:(n.isAlive??D)(c)?l?{status:`alive`,lockPath:r,lock:a}:{status:`unverified-owner`,lockPath:r,pid:c}:{status:`dead-pid`,lockPath:r,lock:a}}function xn(e){return e.status===`unverified-owner`?`Cannot verify shutdown: the server lock at ${e.lockPath} does not record its owning machine, and its recorded process ${e.pid} is still running on this machine. Check whether process ${e.pid} is an OpenKnowledge server. If it is, stop it and retry. Do not remove the lock file while that process is running.`:`Cannot verify shutdown: the server lock at ${e.lockPath} belongs to another machine. Stop OpenKnowledge on the owning machine. Confirm that no OpenKnowledge server is using this directory on the owning machine or any other machine sharing it. Only then remove the stale lock file at ${e.lockPath} and retry cleanup.`}function Sn(e){return e.replace(/:\d+$/,``)}function Cn(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:Sn(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:Sn(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:Sn(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.\-~%]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}const wn=[{hostDir:`.adal`,pruneRoot:`.adal`},{hostDir:`.aider-desk`,pruneRoot:`.aider-desk`},{hostDir:`.astrbot/data`,pruneRoot:`.astrbot`},{hostDir:`.augment`,pruneRoot:`.augment`},{hostDir:`.autohand`,pruneRoot:`.autohand`},{hostDir:`.bob`,pruneRoot:`.bob`},{hostDir:`.codeartsdoer`,pruneRoot:`.codeartsdoer`},{hostDir:`.codebuddy`,pruneRoot:`.codebuddy`},{hostDir:`.codeium/windsurf`,pruneRoot:`.codeium`},{hostDir:`.codemaker`,pruneRoot:`.codemaker`},{hostDir:`.codestudio`,pruneRoot:`.codestudio`},{hostDir:`.commandcode`,pruneRoot:`.commandcode`},{hostDir:`.config/crush`,pruneRoot:`.config/crush`},{hostDir:`.config/devin`,pruneRoot:`.config/devin`},{hostDir:`.config/goose`,pruneRoot:`.config/goose`},{hostDir:`.config/kimchi/harness`,pruneRoot:`.config/kimchi`},{hostDir:`.continue`,pruneRoot:`.continue`},{hostDir:`.factory`,pruneRoot:`.factory`},{hostDir:`.forge`,pruneRoot:`.forge`},{hostDir:`.grok`,pruneRoot:`.grok`},{hostDir:`.iflow`,pruneRoot:`.iflow`},{hostDir:`.inferencesh`,pruneRoot:`.inferencesh`},{hostDir:`.jazz`,pruneRoot:`.jazz`},{hostDir:`.junie`,pruneRoot:`.junie`},{hostDir:`.kilocode`,pruneRoot:`.kilocode`},{hostDir:`.kiro`,pruneRoot:`.kiro`},{hostDir:`.kode`,pruneRoot:`.kode`},{hostDir:`.lingma`,pruneRoot:`.lingma`},{hostDir:`.mcpjam`,pruneRoot:`.mcpjam`},{hostDir:`.moxby`,pruneRoot:`.moxby`},{hostDir:`.mux`,pruneRoot:`.mux`},{hostDir:`.neovate`,pruneRoot:`.neovate`},{hostDir:`.ona`,pruneRoot:`.ona`},{hostDir:`.openhands`,pruneRoot:`.openhands`},{hostDir:`.pochi`,pruneRoot:`.pochi`},{hostDir:`.qoder`,pruneRoot:`.qoder`},{hostDir:`.qoder-cn`,pruneRoot:`.qoder-cn`},{hostDir:`.qwen`,pruneRoot:`.qwen`},{hostDir:`.reasonix`,pruneRoot:`.reasonix`},{hostDir:`.roo`,pruneRoot:`.roo`},{hostDir:`.rovodev`,pruneRoot:`.rovodev`},{hostDir:`.snowflake/cortex`,pruneRoot:`.snowflake`},{hostDir:`.tabnine/agent`,pruneRoot:`.tabnine`},{hostDir:`.terramind`,pruneRoot:`.terramind`},{hostDir:`.tinycloud`,pruneRoot:`.tinycloud`},{hostDir:`.trae`,pruneRoot:`.trae`},{hostDir:`.trae-cn`,pruneRoot:`.trae-cn`},{hostDir:`.vibe`,pruneRoot:`.vibe`},{hostDir:`.zcode`,pruneRoot:`.zcode`},{hostDir:`.zencoder`,pruneRoot:`.zencoder`}],Tn=[...f.map(e=>T[e]),`open-knowledge`];function En(e){if(!se(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=z(e);if(t===B||I(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function Dn(e,t){let n=R(e,t);if(n.startsWith(`..`)||se(n))return!1;let r=e;for(let e of n.split(B)){r=L(r,e);try{if(!de(r).isDirectory())return!1}catch{return!1}}return!0}function On(e,t){try{return W(e).every(n=>t.has(L(e,n)))}catch{return!1}}function kn(e){let t=En(e),n=[],r=[],i=new Set;for(let e of wn){let a=L(t,e.hostDir,`skills`);if(!Dn(t,a))continue;let o=Tn.map(e=>L(a,e)).filter(e=>V(e));n.push(...o);for(let e of o)i.add(e);let s=L(t,e.pruneRoot),c=a;for(;On(c,i)&&(r.push(c),i.add(c),c!==s);){let e=I(c);if(e===c||e===t||!e.startsWith(t+B))break;c=e}}return{skillDirs:n,emptyDirs:r}}function An(e){try{if(!de(e).isDirectory())return!1;let t=W(e);return t.length===0||t.includes(`SKILL.md`)}catch{return!1}}function jn(e){let t=new Set,n=new Set;for(let r of wn){let i=L(e,r.hostDir,`skills`);for(let e of Tn)t.add(L(i,e));let a=L(e,r.pruneRoot),o=i;for(;n.add(o),o!==a;){let t=I(o);if(t===o||t===e||!t.startsWith(e+B))break;o=t}}return{skillDirs:t,emptyDirs:n}}function Mn(e,t){let n=En(e),r=jn(n),i=[...t.skillDirs.filter(e=>!r.skillDirs.has(e)),...t.emptyDirs.filter(e=>!r.emptyDirs.has(e))];if(i.length>0)throw Error(`refusing skill cleanup — ${i.length} path(s) outside the known legacy set: ${i.join(`, `)}`);let a=[];for(let e of t.skillDirs)if(Dn(n,e)&&An(e))try{G(e,{recursive:!0,force:!0}),a.push(e)}catch{}for(let e of t.emptyDirs)if(Dn(n,e))try{he(e),a.push(e)}catch{}return a}function Nn(e){let t=En(e),n=[];for(let e of f){let r=T[e];n.push({path:L(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of s)n.push({path:L(t,i.skillsRoot,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function Pn(e,t){let n=[];for(let r of Nn(e))if(r.bundleId===t)try{G(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}function Fn(e){return e!=null&&e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function In(e,t=Date.now()){if(e===null)return`—`;let n=o(e,t);return n===`unknown`?`—`:n}function Ln(e){let t=I(e);return F(e)===`local`&&F(t)===`.ok`?I(t):F(e)===`.ok`?t:null}function Rn(e,t,n,r){if(t.status===`missing`||t.status===`corrupt`||t.status===`read-error`)return null;if(t.status===`unverified-owner`)return{directory:Ln(e),server:{port:null,status:t.status,pid:t.pid,startedAt:null,usage:null},ui:null,hostname:null,lockPath:t.lockPath,binary:null,command:null,isDesktop:!1};let i=t.lock,a=t.status===`alive`&&x(i)?{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r}:null;return{directory:i.worktreeRoot,server:{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r},ui:a,hostname:i.hostname,lockPath:t.lockPath,binary:n==null?null:h(n),command:n,isDesktop:Fn(n)}}function zn(e){let t=e.server.status;switch(t){case`unverified-owner`:return`unverified`;case`alive`:return e.isDesktop?`desktop`:`running`;case`foreign-host`:return e.isDesktop?`desktop`:`foreign`;case`dead-pid`:return`stale`;default:return t}}const Bn=new Set([`running`,`desktop`,`foreign`,`unverified`]);function Vn(e){switch(e){case`running`:return X.default.green(e);case`desktop`:return X.default.blue(e);case`foreign`:return X.default.cyan(e);case`unverified`:case`stale`:return X.default.yellow(e)}}function Hn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function Un(e){return`${Hn(e.server.usage)} | ${Hn(e.ui?.usage??null)}`}function Wn(e){return`${e.server.port===null?`—`:e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null?`—`:String(e.ui.port)}`}function Gn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>[e.directory??`—`,Wn(e),Un(e),zn(e),String(e.server.pid),In(e.server.startedAt),e.binary??`—`]),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=Vn(zn(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=X.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
11
- `)}async function Kn(e={}){let t=e.discover??m,n=e.inspect??(e=>Q(e,`server`)),r=e.log??(e=>console.log(e)),i=e.resolveCommand??w,a=e.resolveUsage??C,o=await t(),s=[];for(let e of o){let t=n(e),r=Rn(e,t,t.status===`missing`||t.status===`corrupt`||t.status===`read-error`||t.status===`unverified-owner`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`||t.status===`read-error`||t.status===`unverified-owner`?null:a(t.lock.pid));r!=null&&s.push(r)}if(e.json){let e=s.map(e=>({...e,displayStatus:zn(e)}));r(JSON.stringify(e,null,2));return}r(Gn(e.all?s:s.filter(e=>Bn.has(zn(e)))))}function qn(){return new A(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale entries (foreign and unverified entries already show)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await Kn({all:t.all===!0||e===`all`,json:t.json===!0})})}async function Jn(e,t=j()){let n=Q(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=_(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500)});if(!n.ok)return t?.warn({lockDir:e,baseUrl:r,outcome:`http-error`,status:n.status},`stop client-probe failed`),null;let i=(await n.json())?.collabClients;return typeof i==`number`&&Number.isFinite(i)?i:(t?.warn({lockDir:e,baseUrl:r,outcome:`no-client-count`,received:typeof i},`stop client-probe failed`),null)}catch(n){return t?.warn({lockDir:e,baseUrl:r,outcome:`unreachable`,err:n},`stop client-probe failed`),null}}function Yn(e,t={}){return{targets:$(e,t.isAlive??D)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}async function Xn(e){let t=e.inspect??(()=>Q(e.lockDir,`server`)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=e.probeClients??Jn,o=e.logger??j(),s=Yn(t(),{isAlive:e.isAlive});if(s.targets.length===0)return r(`No running open-knowledge processes.`),o?.info({lockDir:e.lockDir,targets:0},`stop found nothing to signal`),{stopped:[],failed:[],hadTargets:!1};if(e.force!==!0){let t=await a(e.lockDir,o);if(t!==null&&t>0)return i(`Not stopping: ${t} collaboration client${t===1?``:`s`} (editor window${t===1?``:`s`} or agents) still connected to the server at ${e.lockDir}. Close them, or re-run with --force to terminate anyway.`),o?.warn({lockDir:e.lockDir,clients:t,pids:s.targets.map(e=>e.pid)},`stop declined: live collaboration clients`),{stopped:[],failed:[],hadTargets:!0,declined:{clients:t}}}let c=[],l=[];for(let e of s.targets)try{n(e.pid,`SIGTERM`),c.push(e)}catch(t){l.push({target:e,error:t instanceof Error?t.message:String(t)})}return c.length>0&&r(`Stopped: ${c.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),o?.info({lockDir:e.lockDir,signalled:c.map(e=>({name:e.name,pid:e.pid,port:e.port})),failed:l.map(({target:e,error:t})=>({pid:e.pid,error:t})),forced:e.force===!0},`stop signalled processes`),l.length>0&&i(`Failed to stop: ${l.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:c,failed:l,hadTargets:!0}}function $(e,t){return e.status===`alive`||e.status===`foreign-host`&&t(e.lock.pid)}async function Zn(e,t=D){let n=await m(),r=null;for(let i of n){let n=Q(i,`server`);if($(n,t)){if(n.lock.port===e)return i;r===null&&n.lock.pid===e&&(r=i)}}return r}async function Qn(e,t){let n=await Xn({lockDir:e,force:t});return(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1),n}function $n(e,t,n={}){return t===0?`Nothing was running for ${e}, and no other open-knowledge servers are running.`:`Nothing was running for ${e}. ${t} other open-knowledge server${t===1?` is`:`s are`} running${n.listingFollows===!0?``:" — run `ok ps` to list them"}.`}async function er(e){let t=await m(),n=0;for(let r of t)r!==e&&$(Q(r,`server`),D)&&n++;return n}function tr(e){return new A(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the enclosing project — run it from anywhere inside the project. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).option(`--force`,`Stop even when editor windows or agents are still connected to the server`).action(async(t,n)=>{let r=n.force===!0,i=t.length===0?void 0:t.join(` `);if(i===void 0){e();let t=y(process.cwd()),n=await Xn({lockDir:t,force:r,log:()=>{}});if(n.hadTargets){if(n.stopped.length>0){let e=n.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1)}else{let e=await er(t);console.log($n(process.cwd(),e,{listingFollows:e>0})),e>0&&await Kn({})}return}if(i===`all`){let e=await m();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e)$(Q(n,`server`),D)&&(await Qn(n,r),t++);t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(i)){let e=Number.parseInt(i,10),t=await Zn(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}await Qn(t,r);return}let a=z(je(),i),o=y(a),s=[],c=await Xn({lockDir:o,force:r,log:e=>s.push(e)});if((c.failed.length>0||c.declined!==void 0)&&(process.exitCode=1),c.hadTargets)for(let e of s)console.log(e);else console.log($n(a,await er(o)))})}export{Le as C,Oe as E,Ie as S,Ae as T,Ye as _,Mn as a,Pe as b,Nn as c,Q as d,bn as f,J as g,Xe as h,qn as i,Cn as l,_n as m,Xn as n,kn as o,gn as p,tr as r,Pn as s,Jn as t,xn as u,ze as v,je as w,Ne as x,Me as y};
@@ -1 +0,0 @@
1
- import{S as e,m as t,p as n,r}from"./start-C9LxTCYi.mjs";export{r as bootStartServer,n as resolveBundledReactShellDir,t as resolveHost,e as startCommand};