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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/dist/{acp-harness-probe-D8GNCLKI.mjs → acp-harness-probe-6O1iSYIR.mjs} +2 -2
  2. package/dist/cli.mjs +16 -16
  3. package/dist/constants-YeHiomno.mjs +2 -0
  4. package/dist/git-handle-CqlG0S4W.mjs +1 -0
  5. package/dist/{git-handle-UnQwrdlT.mjs → git-handle-tXqNDNbG.mjs} +2 -2
  6. package/dist/index.mjs +41 -41
  7. package/dist/{init-eBP6ynxi.mjs → init-BJVLqPEk.mjs} +3 -3
  8. package/dist/init-yJjl6861.mjs +1 -0
  9. package/dist/{launch-json-removal-BFpdcojK.mjs → launch-json-removal-C7vezYJn.mjs} +2 -2
  10. package/dist/loader-BGxw7stI.mjs +1 -0
  11. package/dist/{loader-CRRZ4eTQ.mjs → loader-C4nhWSIa.mjs} +2 -2
  12. package/dist/md-manager-Bu71zQPt.mjs +2 -0
  13. package/dist/{open-browser-mXaE0V-v.mjs → open-browser-CxqP3TDJ.mjs} +2 -2
  14. package/dist/parse-worker.mjs +1 -1
  15. package/dist/{preview-cPC1BHPG.mjs → preview-BZwSz2kH.mjs} +2 -2
  16. package/dist/preview-SYaXc23U.mjs +1 -0
  17. package/dist/public/assets/{ActivityModeContent-BfSvNw28.js → ActivityModeContent-DotCr2H_.js} +1 -1
  18. package/dist/public/assets/{AddPropertiesButton-CDqx5oOU.js → AddPropertiesButton-BUwqaT5p.js} +1 -1
  19. package/dist/public/assets/{AgentDiffPane-DySEAYNs.js → AgentDiffPane-BUtJ3PVG.js} +1 -1
  20. package/dist/public/assets/{AgentThreadClientBinder-XXRp8VNW.js → AgentThreadClientBinder-1lFfm0IN.js} +1 -1
  21. package/dist/public/assets/{BugReportHistory-BzqzlDvE.js → BugReportHistory-jSGSgPau.js} +1 -1
  22. package/dist/public/assets/{BugReportHistoryDialog--Su04gP8.js → BugReportHistoryDialog-fz9oCk7_.js} +1 -1
  23. package/dist/public/assets/{CodeMirrorPropInput-DtX4bjvR.js → CodeMirrorPropInput-UX9dc3lK.js} +1 -1
  24. package/dist/public/assets/{ConsentDialogBody-DWgT7k5c.js → ConsentDialogBody-owDDRjs1.js} +1 -1
  25. package/dist/public/assets/{DocumentContext-BId0aBaa.js → DocumentContext-rwQWKRwZ.js} +1 -1
  26. package/dist/public/assets/{EditorModeToggle-D7GXfSQE.js → EditorModeToggle-Ca5ZwX6h.js} +1 -1
  27. package/dist/public/assets/{EnableSyncConfirmDialog-CVKmC5yw.js → EnableSyncConfirmDialog-DzdCcHho.js} +1 -1
  28. package/dist/public/assets/{ExcalidrawDocEditor-mxb0y2TR.js → ExcalidrawDocEditor-SaZwdFgG.js} +1 -1
  29. package/dist/public/assets/FeedbackForm-DJqGpa9l.js +1 -0
  30. package/dist/public/assets/{GraphPanel-DlmLJpXS.js → GraphPanel-B_ODpcQR.js} +1 -1
  31. package/dist/public/assets/{ImportSkillDialog-WPJMdoUX.js → ImportSkillDialog-Bx_ZWuER.js} +1 -1
  32. package/dist/public/assets/{LintConfigEditor-CREx0S2c.js → LintConfigEditor-BSHD88gy.js} +1 -1
  33. package/dist/public/assets/ManagedArtifactProperties-B0O5eYlt.js +1 -0
  34. package/dist/public/assets/{ManagedArtifactProperties-3wX-4L9A.js → ManagedArtifactProperties-BgdX1sgG.js} +1 -1
  35. package/dist/public/assets/{MermaidDocEditor-BeIZEdGa.js → MermaidDocEditor-B4OuFFRH.js} +1 -1
  36. package/dist/public/assets/{PropertyDisplayRow-DDOV4-Ci.js → PropertyDisplayRow-Bl0tZ1a5.js} +1 -1
  37. package/dist/public/assets/{ReportBugDialogBody-uz1wEEaL.js → ReportBugDialogBody-U3FbBtM2.js} +1 -1
  38. package/dist/public/assets/{ReportBugMenuTrigger-CciQFblr.js → ReportBugMenuTrigger-CGkkALKR.js} +2 -2
  39. package/dist/public/assets/{SchemaConfigEditor-sXi89wgY.js → SchemaConfigEditor-CFOJQbAI.js} +1 -1
  40. package/dist/public/assets/{SessionsHost-DUYXhSk4.js → SessionsHost-Df2f1sfx.js} +2 -2
  41. package/dist/public/assets/SettingsDialogBody-D4mpzMAr.js +12 -0
  42. package/dist/public/assets/{ShareBranchSwitchDialog-BuKFUw0e.js → ShareBranchSwitchDialog-B_ybMKWR.js} +1 -1
  43. package/dist/public/assets/{ShareReceiveDialog-ILk9qSQi.js → ShareReceiveDialog-D8IcYMqn.js} +1 -1
  44. package/dist/public/assets/{ShareReceiveMissDialog-DSPm1Ymd.js → ShareReceiveMissDialog-eZXVNMEa.js} +1 -1
  45. package/dist/public/assets/{SkillCostValue-Dnq-P4nV.js → SkillCostValue-CtuMRUcB.js} +1 -1
  46. package/dist/public/assets/{SkillEditBanner-Bi5UjV5F.js → SkillEditBanner-CgahuR4V.js} +1 -1
  47. package/dist/public/assets/SkillInstallMenu-t_UwNdxn.js +2 -0
  48. package/dist/public/assets/{SkillOriginInline-CxtxMYgG.js → SkillOriginInline-caW0di8-.js} +1 -1
  49. package/dist/public/assets/{SkillToolbarControls-BonUlpuf.js → SkillToolbarControls-BQSRblTW.js} +1 -1
  50. package/dist/public/assets/{SlidesToolbarControls-BFw5X_I9.js → SlidesToolbarControls-DmkIlVkT.js} +1 -1
  51. package/dist/public/assets/{SourceEditor-BzonD5kQ.js → SourceEditor-DSD8q5gQ.js} +1 -1
  52. package/dist/public/assets/{TerminalPanel-Dqg_--C1.js → TerminalPanel-3sFIDMyj.js} +1 -1
  53. package/dist/public/assets/{TerminalWindowApp-Bg0ksRvd.js → TerminalWindowApp-kA8FxYDa.js} +1 -1
  54. package/dist/public/assets/{TextDocEditor-oysjAuPF.js → TextDocEditor-31V7aZDr.js} +1 -1
  55. package/dist/public/assets/{ThreadView-B6FpcgQA.js → ThreadView-BXcveKKj.js} +1 -1
  56. package/dist/public/assets/{TimelineDiffPane-CQtzCGhI.js → TimelineDiffPane-ZXlxZPTz.js} +1 -1
  57. package/dist/public/assets/{agent-diff-store-7YPKABFM.js → agent-diff-store-Cpo8SCiH.js} +1 -1
  58. package/dist/public/assets/auth-state-cache-sqbJYZts.js +11 -0
  59. package/dist/public/assets/{bug-report-send-manager-idwD-g0s.js → bug-report-send-manager--d3jxz25.js} +1 -1
  60. package/dist/public/assets/{client-version-BH4Ct1dv.js → client-version-CXjYjiUZ.js} +1 -1
  61. package/dist/public/assets/{comment-chips-Dd3uvf5B.js → comment-chips-DAhAsZ8A.js} +1 -1
  62. package/dist/public/assets/{config-provider-C6FHgLZX.js → config-provider-D8nQpnDa.js} +3 -3
  63. package/dist/public/assets/{dist-C_QZEaeX.js → dist-B5qwv8-p.js} +2 -2
  64. package/dist/public/assets/{doc-paths-CzO1mA3r.js → doc-paths-mRmnn5mL.js} +1 -1
  65. package/dist/public/assets/{documents-events-CwqQxQT5.js → documents-events-BS3zz_ja.js} +1 -1
  66. package/dist/public/assets/{file-tree-adapter-Blu63jOX.js → file-tree-adapter-CxsCZrWb.js} +1 -1
  67. package/dist/public/assets/{file-tree-utils-CJ625FXw.js → file-tree-utils-BunIXRa7.js} +1 -1
  68. package/dist/public/assets/{folder-config-api-Dxuhqlqr.js → folder-config-api-BZVpNPGc.js} +1 -1
  69. package/dist/public/assets/globals-DGB4qla_.css +1 -0
  70. package/dist/public/assets/i18n-BwxzDzCF.js +1 -0
  71. package/dist/public/assets/{index-xtNevPWi.js → index-D8LrmUIw.js} +7 -7
  72. package/dist/public/assets/{launcher-selection-h6hBbSeu.js → launcher-selection-BBUas603.js} +1 -1
  73. package/dist/public/assets/{lint-config-client-CHoPvgQx.js → lint-config-client-BVZllbYJ.js} +1 -1
  74. package/dist/public/assets/{markdownlint-rule-browser-B15oIG0p.js → markdownlint-rule-browser-OBj8w6AO.js} +1 -1
  75. package/dist/public/assets/messages-2TaFL8Ip.js +1 -0
  76. package/dist/public/assets/messages-5EoLltUL.js +1 -0
  77. package/dist/public/assets/messages-BC11FP6A.js +1 -0
  78. package/dist/public/assets/messages-Bd3nERvw.js +1 -0
  79. package/dist/public/assets/messages-ByriK8ln.js +1 -0
  80. package/dist/public/assets/messages-CHhnwg_r.js +1 -0
  81. package/dist/public/assets/messages-CYykrejt.js +1 -0
  82. package/dist/public/assets/messages-D0jFOlFs.js +1 -0
  83. package/dist/public/assets/messages-DLDevhFL.js +1 -0
  84. package/dist/public/assets/messages-DZU_0bet.js +1 -0
  85. package/dist/public/assets/messages-SZ8C0t5f.js +1 -0
  86. package/dist/public/assets/messages-lAaVwcVx.js +1 -0
  87. package/dist/public/assets/{page-list-cache-CI-xFldj.js → page-list-cache-B3bvGAO5.js} +1 -1
  88. package/dist/public/assets/{pending-receive-nav-store-DSQDb6m_.js → pending-receive-nav-store-Cfa5notj.js} +1 -1
  89. package/dist/public/assets/{progress-Cbjh5yOY.js → progress-CGKEmqEm.js} +1 -1
  90. package/dist/public/assets/{project-paths-Da-3VtPS.js → project-paths-C69jkmMe.js} +1 -1
  91. package/dist/public/assets/{prop-types-DTEkSQcM.js → prop-types-B41RJtGt.js} +1 -1
  92. package/dist/public/assets/{receive-store-CZytnhfP.js → receive-store-D7nvngvO.js} +1 -1
  93. package/dist/public/assets/{selection-context-DcqZ3oLY.js → selection-context-zaeIFGZP.js} +1 -1
  94. package/dist/public/assets/{skill-scope-BOgGK9dw.js → skill-scope-BVNk6qeO.js} +1 -1
  95. package/dist/public/assets/{skills-api-Cpxu_weC.js → skills-api-Cq8_IlLq.js} +1 -1
  96. package/dist/public/assets/{src-o99n4-mI.js → src-G5zdelKj.js} +1 -1
  97. package/dist/public/assets/{startup-marks-CwgakJzA.js → startup-marks-jv6Qs2uF.js} +1 -1
  98. package/dist/public/assets/{tag-pill-input-Czha5J4D.js → tag-pill-input-88p34I7w.js} +1 -1
  99. package/dist/public/assets/{target-navigation-intent-C2Nfap4j.js → target-navigation-intent-BxOTP9s7.js} +1 -1
  100. package/dist/public/assets/{telemetry-startup-Cr2hA85U.js → telemetry-startup-CKd1LVjo.js} +1 -1
  101. package/dist/public/assets/{terminal-cli-display-Dt4cbzju.js → terminal-cli-display-DB9HP8Kz.js} +1 -1
  102. package/dist/public/assets/{typing-burst-detector-BfXA1WDv.js → typing-burst-detector-D7MT9xAL.js} +1 -1
  103. package/dist/public/assets/{uninstall-0vFtGMK2.js → uninstall-CqsvXVvr.js} +1 -1
  104. package/dist/public/assets/{use-activity-panel-DgMjR_uo.js → use-activity-panel-Cwiaxn7-.js} +1 -1
  105. package/dist/public/assets/{use-apply-config-color-theme-pxpDfOq4.js → use-apply-config-color-theme-BnIQOGE2.js} +1 -1
  106. package/dist/public/assets/{use-collab-url-CrPRD0Do.js → use-collab-url-BonPNl3w.js} +1 -1
  107. package/dist/public/assets/{use-live-xterm-theme-vRNyzDLo.js → use-live-xterm-theme-BkFdBq13.js} +1 -1
  108. package/dist/public/assets/{use-open-skill-DDH7y31F.js → use-open-skill-B5CQCTU9.js} +1 -1
  109. package/dist/public/assets/{use-settings-route-6Aa41RPQ.js → use-settings-route-K9deeZD-.js} +1 -1
  110. package/dist/public/assets/{use-skill-origin-CCXLtFlz.js → use-skill-origin-BFlhRLbw.js} +1 -1
  111. package/dist/public/assets/{use-skills-L0px0Zhw.js → use-skills-DFfNPUrm.js} +1 -1
  112. package/dist/public/assets/{use-terminal-enabled-UleqVo0K.js → use-terminal-enabled-Dn6oVKSs.js} +1 -1
  113. package/dist/public/assets/{use-timeline-entry-diff-CZDwTk89.js → use-timeline-entry-diff-Dy-DyEiC.js} +1 -1
  114. package/dist/public/assets/{use-workspace-7B06onC_.js → use-workspace-BA9aicCx.js} +1 -1
  115. package/dist/public/index.html +50 -50
  116. package/dist/public/uninstall.html +6 -6
  117. package/dist/{repair-launch-json-CkxVvou7.mjs → repair-launch-json-DUTqYxFF.mjs} +2 -2
  118. package/dist/{repair-mcp-configs-DjVdyrm2.mjs → repair-mcp-configs-xEpY6E7V.mjs} +2 -2
  119. package/dist/{repair-skills-Dbdo1dep.mjs → repair-skills-CnlSJ7Cv.mjs} +2 -2
  120. package/dist/repair-skills-Ddx30mOx.mjs +1 -0
  121. package/dist/{resolve-project-root-BgZ293gs.mjs → resolve-project-root-H2LH3evF.mjs} +5 -5
  122. package/dist/server-lock-JctV7pHU.mjs +1 -0
  123. package/dist/{server-lock-CcnGITIh.mjs → server-lock-pONFRxy9.mjs} +2 -2
  124. package/dist/{skill-teardown-BQcurw-H.mjs → skill-teardown-h8wjTE5-.mjs} +2 -2
  125. package/dist/src-1Rp1Dq8a.mjs +2041 -0
  126. package/dist/{src-DB7C0CZe.mjs → src-8rHUz2eY.mjs} +1 -1
  127. package/dist/{src-CaLoSvK5.mjs → src-wzwdHnH1.mjs} +107 -107
  128. package/dist/src-xpcCGBI8.mjs +1 -0
  129. package/dist/{src-BQg24g5w.mjs → src-ywNiPY0Z.mjs} +4 -4
  130. package/dist/{start-Cx3sd9S_.mjs → start-DKaGdrt1.mjs} +3 -3
  131. package/dist/start-ZBZQC08F.mjs +1 -0
  132. package/package.json +4 -4
  133. package/dist/constants-DzLzqZ-e.mjs +0 -2
  134. package/dist/git-handle-Bh1alj7a.mjs +0 -1
  135. package/dist/init-BX_9NOtu.mjs +0 -1
  136. package/dist/loader-BO6n9crj.mjs +0 -1
  137. package/dist/md-manager-BJ88tow5.mjs +0 -2
  138. package/dist/preview-DyOUTvCV.mjs +0 -1
  139. package/dist/public/assets/FeedbackForm-RpZ8ZAA4.js +0 -1
  140. package/dist/public/assets/ManagedArtifactProperties-CEBc2qva.js +0 -1
  141. package/dist/public/assets/SettingsDialogBody-BeSclbmh.js +0 -12
  142. package/dist/public/assets/SkillInstallMenu-DiCGjWcJ.js +0 -2
  143. package/dist/public/assets/auth-state-cache-CrQ_9ffi.js +0 -11
  144. package/dist/public/assets/globals-D1lEgZg7.css +0 -1
  145. package/dist/public/assets/i18n-Bn0IL-Jk.js +0 -1
  146. package/dist/public/assets/messages-20ZT_n81.js +0 -1
  147. package/dist/public/assets/messages-B2X-60YW.js +0 -1
  148. package/dist/public/assets/messages-B9Qrr14Q.js +0 -1
  149. package/dist/public/assets/messages-BUgRBtWn.js +0 -1
  150. package/dist/public/assets/messages-B_l2z4-1.js +0 -1
  151. package/dist/public/assets/messages-Bu7B_SFk.js +0 -1
  152. package/dist/public/assets/messages-CFu0nt3l.js +0 -1
  153. package/dist/public/assets/messages-CLBJUWjQ.js +0 -1
  154. package/dist/public/assets/messages-DagesR8a.js +0 -1
  155. package/dist/public/assets/messages-Dl-AHyyi.js +0 -1
  156. package/dist/public/assets/messages-mvZekN3y.js +0 -1
  157. package/dist/public/assets/messages-zTkemwXI.js +0 -1
  158. package/dist/repair-skills-CBdnIHQ1.mjs +0 -1
  159. package/dist/server-lock-D8d0WVYU.mjs +0 -1
  160. package/dist/src-C28fg0N6.mjs +0 -1
  161. package/dist/src-DGS-lA-C.mjs +0 -2041
  162. package/dist/start-Bzg4UT8v.mjs +0 -1
  163. /package/dist/public/assets/{globals-CVUc-u8t.js → globals-C_6Qm0sG.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{yt as r}from"./sleep-DyLEGHvt.mjs";import{Bs as i,_s as a,ac as o,ot as s,rt as c}from"./src-CaLoSvK5.mjs";import{Ar as l,Bi as u,La as d,Mi as f,Mr as p,Ni as m,Or as h,_n as g,bi as _,bn as v,d as y,er as b,f as x,fr as S,gn as ee,kr as C,mn as te,p as ne,pn as re,rr as ie,tr as ae,ur as oe,xi as se,yi as ce}from"./src-DGS-lA-C.mjs";import{I as w,P as le}from"./fs-traced-C5oeVBiQ.mjs";import{C as ue,a as T,d as de,f as fe,i as pe,l as me,n as he,o as ge,s as _e,t as ve,u as ye,x as be,y as xe}from"./resolve-project-root-BgZ293gs.mjs";import{i as E,n as D,o as O,r as Se,s as k,t as A}from"./colors-DSyAT9Cz.mjs";import{t as Ce}from"./constants-DzLzqZ-e.mjs";import{t as j}from"./is-object-Bw0-z8qH.mjs";import{t as we}from"./preview-cPC1BHPG.mjs";import{createRequire as Te}from"node:module";import{execFileSync as Ee}from"node:child_process";import De,{dirname as M,isAbsolute as Oe,join as N,relative as P,resolve as F,sep as ke}from"node:path";import I from"node:process";import{fileURLToPath as Ae}from"node:url";import{existsSync as L,lstatSync as je,mkdirSync as Me,readFileSync as R,readlinkSync as Ne,realpathSync as Pe,statSync as Fe,writeFileSync as Ie}from"node:fs";import{homedir as Le}from"node:os";import*as Re from"node:readline";import{inspect as ze,stripVTControlCharacters as Be,styleText as z}from"node:util";import{AsyncLocalStorage as Ve,AsyncResource as He}from"node:async_hooks";const Ue=new Set([`emacs`,`vim`]);function We(e){return Ue.has(e)}function Ge(){let e=process.env.INQUIRER_KEYBINDINGS;return e?Array.from(new Set(e.toLowerCase().split(/[\s,]+/).filter(We))):[]}const B=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,Ke=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,qe=e=>e.name===`space`,Je=e=>e.name===`backspace`,Ye=e=>`1234567890`.includes(e.name),Xe=e=>e.name===`enter`||e.name===`return`;var Ze=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},Qe=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},$e=class extends Error{name=`ExitPromptError`},et=class extends Error{name=`HookError`},tt=class extends Error{name=`ValidationError`};const nt=new Ve;function rt(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function it(e,t){let n=rt(e);return nt.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function V(){let e=nt.getStore();if(!e)throw new et(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function at(){return V().rl}function ot(e){return He.bind((...t)=>{let n=V(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function st(e){let t=V(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function ct(){V().handleChange()}const H={queue(e){let t=V(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(at());if(r!=null&&typeof r!=`function`)throw new tt(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=V();ot(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=V();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function lt(e){return typeof e==`function`}function U(e){return st(t=>{let n=He.bind(function(e){t.get()!==e&&(t.set(e),ct())});if(t.initialized)return[t.get(),n];let r=lt(e)?e():e;return t.set(r),[r,n]})}function ut(e,t){st(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&H.queue(e),n.set(t)})}function dt(){return I.platform.startsWith(`win`)?!!I.env.CI||!!I.env.WT_SESSION||!!I.env.TERMINUS_SUBLIME||I.env.ConEmuTask===`{cmd::Cmder}`||I.env.TERM_PROGRAM===`Terminus-Sublime`||I.env.TERM_PROGRAM===`vscode`||I.env.TERM===`xterm-256color`||I.env.TERM===`alacritty`||I.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:I.env.TERM!==`linux`}const ft={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},pt={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},mt={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},ht={...ft,...pt},gt={...ft,...mt},W=dt()?ht:gt;Object.entries(pt);const _t={prefix:{idle:z(`blue`,`?`),done:z(`green`,W.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>z(`yellow`,e))},keybindings:[],style:{answer:e=>z(`cyan`,e),message:e=>z(`bold`,e),error:e=>z(`red`,`> ${e}`),defaultAnswer:e=>z(`dim`,`(${e})`),help:e=>z(`dim`,e),highlight:e=>z(`cyan`,e),key:e=>z(`cyan`,z(`bold`,`<${e}>`))}};function vt(){return{..._t,keybindings:Ge()}}function yt(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function bt(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=yt(n)&&yt(r)?bt(n,r):r}return t}function xt(...e){return bt(vt(),...e.filter(e=>e!=null))}function St({status:e=`idle`,theme:t}){let[n,r]=U(!1),[i,a]=U(0),{prefix:o,spinner:s}=xt(t);return ut(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function Ct(e,t){return st(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function wt(e){return U({current:e})[0]}function Tt(e){let t=wt(e);t.current=e,ut(e=>{let n=!1,r=ot((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var Et=t(n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}))(),1);const Dt=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),Ot=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,kt=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,At=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,jt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Mt=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Nt=/\t{1,1000}/y,Pt=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Ft=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,It=/\p{M}+/gu,Lt={limit:1/0,ellipsis:``},Rt=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Rt(i,Lt,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Ft,l],[At,0],[jt,o],[Nt,s],[Pt,c],[Mt,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(It,``)){let t=e.codePointAt(0)||0;if(S=Ot(t)?2:kt(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===Mt?Dt(e.slice(p,n.lastIndex)):n===Pt?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},zt={limit:1/0,ellipsis:``,ellipsisWidth:0},G=(e,t={})=>Rt(e,zt,t).width,Bt=`]8;;`,Vt=RegExp(`(?:\\[(?<code>\\d+)m|\\${Bt}(?<uri>.*))`,`y`),Ht=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Ut=e=>`[${e}m`,Wt=e=>`${Bt}${e}`,Gt=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:G(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=G(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(Bt,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Kt=e=>{let t=e.split(` `),n=t.length;for(;n&&!G(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},qt=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=G(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=G(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Gt(s,r,t),c=G(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Gt(s,r,t),c=G(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Gt(s,r,t),c=G(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Kt(e)));let l=s.join(`
1
+ import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{yt as r}from"./sleep-DyLEGHvt.mjs";import{Bs as i,_s as a,oc as o,ot as s,rt as c}from"./src-wzwdHnH1.mjs";import{Ar as l,Bi as u,La as d,Mi as f,Mr as p,Ni as m,Or as h,_n as g,bi as _,bn as v,d as y,er as b,f as x,fr as S,gn as ee,kr as C,mn as te,p as ne,pn as re,rr as ie,tr as ae,ur as oe,xi as se,yi as ce}from"./src-1Rp1Dq8a.mjs";import{I as w,P as le}from"./fs-traced-C5oeVBiQ.mjs";import{C as ue,a as T,d as de,f as fe,i as pe,l as me,n as he,o as ge,s as _e,t as ve,u as ye,x as be,y as xe}from"./resolve-project-root-H2LH3evF.mjs";import{i as E,n as D,o as O,r as Se,s as k,t as A}from"./colors-DSyAT9Cz.mjs";import{t as Ce}from"./constants-YeHiomno.mjs";import{t as j}from"./is-object-Bw0-z8qH.mjs";import{t as we}from"./preview-BZwSz2kH.mjs";import{createRequire as Te}from"node:module";import{execFileSync as Ee}from"node:child_process";import De,{dirname as M,isAbsolute as Oe,join as N,relative as P,resolve as F,sep as ke}from"node:path";import I from"node:process";import{fileURLToPath as Ae}from"node:url";import{existsSync as L,lstatSync as je,mkdirSync as Me,readFileSync as R,readlinkSync as Ne,realpathSync as Pe,statSync as Fe,writeFileSync as Ie}from"node:fs";import{homedir as Le}from"node:os";import*as Re from"node:readline";import{inspect as ze,stripVTControlCharacters as Be,styleText as z}from"node:util";import{AsyncLocalStorage as Ve,AsyncResource as He}from"node:async_hooks";const Ue=new Set([`emacs`,`vim`]);function We(e){return Ue.has(e)}function Ge(){let e=process.env.INQUIRER_KEYBINDINGS;return e?Array.from(new Set(e.toLowerCase().split(/[\s,]+/).filter(We))):[]}const B=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,Ke=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,qe=e=>e.name===`space`,Je=e=>e.name===`backspace`,Ye=e=>`1234567890`.includes(e.name),Xe=e=>e.name===`enter`||e.name===`return`;var Ze=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},Qe=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},$e=class extends Error{name=`ExitPromptError`},et=class extends Error{name=`HookError`},tt=class extends Error{name=`ValidationError`};const nt=new Ve;function rt(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function it(e,t){let n=rt(e);return nt.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function V(){let e=nt.getStore();if(!e)throw new et(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function at(){return V().rl}function ot(e){return He.bind((...t)=>{let n=V(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function st(e){let t=V(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function ct(){V().handleChange()}const H={queue(e){let t=V(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(at());if(r!=null&&typeof r!=`function`)throw new tt(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=V();ot(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=V();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function lt(e){return typeof e==`function`}function U(e){return st(t=>{let n=He.bind(function(e){t.get()!==e&&(t.set(e),ct())});if(t.initialized)return[t.get(),n];let r=lt(e)?e():e;return t.set(r),[r,n]})}function ut(e,t){st(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&H.queue(e),n.set(t)})}function dt(){return I.platform.startsWith(`win`)?!!I.env.CI||!!I.env.WT_SESSION||!!I.env.TERMINUS_SUBLIME||I.env.ConEmuTask===`{cmd::Cmder}`||I.env.TERM_PROGRAM===`Terminus-Sublime`||I.env.TERM_PROGRAM===`vscode`||I.env.TERM===`xterm-256color`||I.env.TERM===`alacritty`||I.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:I.env.TERM!==`linux`}const ft={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},pt={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},mt={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},ht={...ft,...pt},gt={...ft,...mt},W=dt()?ht:gt;Object.entries(pt);const _t={prefix:{idle:z(`blue`,`?`),done:z(`green`,W.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>z(`yellow`,e))},keybindings:[],style:{answer:e=>z(`cyan`,e),message:e=>z(`bold`,e),error:e=>z(`red`,`> ${e}`),defaultAnswer:e=>z(`dim`,`(${e})`),help:e=>z(`dim`,e),highlight:e=>z(`cyan`,e),key:e=>z(`cyan`,z(`bold`,`<${e}>`))}};function vt(){return{..._t,keybindings:Ge()}}function yt(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function bt(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=yt(n)&&yt(r)?bt(n,r):r}return t}function xt(...e){return bt(vt(),...e.filter(e=>e!=null))}function St({status:e=`idle`,theme:t}){let[n,r]=U(!1),[i,a]=U(0),{prefix:o,spinner:s}=xt(t);return ut(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function Ct(e,t){return st(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function wt(e){return U({current:e})[0]}function Tt(e){let t=wt(e);t.current=e,ut(e=>{let n=!1,r=ot((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var Et=t(n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}))(),1);const Dt=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),Ot=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,kt=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,At=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,jt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Mt=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Nt=/\t{1,1000}/y,Pt=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Ft=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,It=/\p{M}+/gu,Lt={limit:1/0,ellipsis:``},Rt=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Rt(i,Lt,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Ft,l],[At,0],[jt,o],[Nt,s],[Pt,c],[Mt,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(It,``)){let t=e.codePointAt(0)||0;if(S=Ot(t)?2:kt(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===Mt?Dt(e.slice(p,n.lastIndex)):n===Pt?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},zt={limit:1/0,ellipsis:``,ellipsisWidth:0},G=(e,t={})=>Rt(e,zt,t).width,Bt=`]8;;`,Vt=RegExp(`(?:\\[(?<code>\\d+)m|\\${Bt}(?<uri>.*))`,`y`),Ht=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Ut=e=>`[${e}m`,Wt=e=>`${Bt}${e}`,Gt=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:G(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=G(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(Bt,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Kt=e=>{let t=e.split(` `),n=t.length;for(;n&&!G(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},qt=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=G(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=G(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Gt(s,r,t),c=G(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Gt(s,r,t),c=G(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Gt(s,r,t),c=G(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Kt(e)));let l=s.join(`
2
2
  `),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===`›`){Vt.lastIndex=e+1;let t=Vt.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
3
3
  `){a&&(r+=Wt(``));let e=i?Ht(i):void 0;i&&e&&(r+=Ut(e))}else t===`
4
4
  `&&(i&&Ht(i)&&(r+=Ut(i)),a&&(r+=Wt(a)))}return r},Jt=/\r?\n/;function Yt(e,t,n){return String(e).normalize().split(Jt).map(e=>qt(e,t,n)).join(`
@@ -635,6 +635,6 @@ export default function okBridge(pi: {
635
635
  `));let p=`${a?``:``}${d}`;return p!==i&&w(e,p,{mode:Y(e)}),{kind:l?`overwritten`:`written`}}const wi=e=>e!==`project`,Ti=e=>e!==`user`;async function Ei(){let e=await er({message:`Where should the MCP server be configured?
636
636
  `,required:!1,theme:{icon:{checked:`[x]`,unchecked:`[ ]`}},choices:[{name:`User-level (~/.claude.json, ~/.cursor/mcp.json, …)`,value:`user`,checked:!0},{name:`Project-level (.mcp.json, .cursor/mcp.json, …)`,value:`project`,checked:!0}]});return e.includes(`user`)&&e.includes(`project`)?`both`:e.includes(`user`)?`user`:e.includes(`project`)?`project`:null}async function Di(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??Ei)():`both`}async function Oi(e){return ar({message:`How do you want to handle OpenKnowledge config files (.ok/, .mcp.json)?`,default:e,choices:[{name:`Share with my team (commit alongside content)`,value:`shared`,description:`OK config gets committed alongside your project content.`},{name:`Local only (keep out of git via .git/info/exclude)`,value:`local-only`,description:"OK config stays on this machine only; teammates do not see it. Safe escape hatch via `ok config-sharing share`."}]})}async function ki(e){if(e.sharing!==void 0)return e.sharing;let t=Pn(e.projectRoot)===`local-only`||e.freshProject===!0?`local-only`:`shared`;return e.isTTY??process.stdout.isTTY?(e.promptFn??Oi)(t):t}var $=class extends Error{constructor(e){super(e),this.name=`ContentDirError`}};function Ai(e){if(e===void 0||e===!0)return new Set(_);if(e===!1)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(se.filter(e=>t.includes(e)))}function ji(e,t,n){let r=F(n,e),i;try{i=Fe(r)}catch(e){let t=e.code;throw t===`ENOENT`?new $(`--content-dir path does not exist: ${r}`):new $(`--content-dir path is not accessible (${t??`unknown error`}): ${r}`)}if(!i.isDirectory())throw new $(`--content-dir must be a directory: ${r}`);let a=P(Mi(t),Mi(r));if(a.startsWith(`..`)||Oe(a))throw new $(`--content-dir must be inside the project root (${t}); got ${r}`);return a===``?`.`:a}function Mi(e){try{return Pe(e)}catch{return e}}const Ni=`open-knowledge-ui`;function Pi(e,t,n){try{return L(e.detectPath?.(t,n)??M(e.configPath(t,n)))}catch{return!1}}function Fi(e,t,n){try{let r=F(M(e.configPath(t,n))),i=F(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+ke)}catch{return!1}}function Ii(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||Fi(e,t,r);if(!i&&s&&!Pi(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{he(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return Ri(e,o,a,n,{isProjectScope:i!==void 0});let c;try{c=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{Me(M(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let l={action:`written`},u;try{le(`${o}.lock`,()=>{let t=Jr(o).writePath;if(Me(M(t),{recursive:!0}),e.format===`toml`){let n=Si(ni(),t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}if(e.format===`yaml`){let n=Ci(t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}let n=xi(t,e.topLevelKey,a,c,e.serverMapSubKey);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){u=e instanceof Error?e:Error(String(e))}return u?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:u.message,...i===void 0?{}:{configScope:`project`}}:l.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:l.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:l.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const Li={pi:Br};function Ri(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=Li[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{Me(M(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{le(`${t}.lock`,()=>{let e=null;try{e=R(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}w(t,c,e===null?void 0:{mode:Y(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}function zi(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!L(n)))return{editorId:e.id,label:e.label,path:n}}function Bi(e,t,n,r){let i=Hi(e,t,n,r);return i.kind===`present`?i.entry:null}function Vi(e,t,n,r){let i=bi(e,t,r);if(!j(i))return{kind:`no-entry`};let a=i[n];return j(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function Hi(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!L(i))return{kind:`absent`};try{if(Fe(i).size>di)return{kind:`decline`,reason:`oversize`}}catch{return{kind:`decline`,reason:`unparseable`}}let a;try{a=R(i,`utf-8`)}catch{return{kind:`decline`,reason:`unparseable`}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:zr(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=ni().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return Vi(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,J.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:Vi(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=oi(a);return s?si(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:Vi(C(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}async function Ui(e={}){let t=F(e.cwd??process.cwd()),n=ve(t,{homeDir:e.home}),r=n.projectRoot;if(v(r,e.home??Le()))throw new g(r);let i=!L(N(r,`.ok`)),o=n.gitRootPromoted?P(r,t):void 0,s=e.contentDir===void 0?n.defaultContentDir:ji(e.contentDir,r,t);n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&s===`.`&&process.stderr.write(`${k(`[ok] Content scope promoted to the git repo root: ${r}`)}\n Ran in ${o}/, but .ok/ lives at the git root (one .ok/ per git repo),\n so the whole repo is now the content scope. To narrow it, re-run with\n \`ok init --content-dir .\`, or set content.dir: ${o} in .ok/config.yml.\n`);let c={mode:e.devMcp?`dev`:`published`},l=await ne(r),u;try{u=te(r,{contentDir:s})}catch(t){let i=_e.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:l.didInit,rootGitignoreCreated:!1,gitRootPromoted:n.gitRootPromoted,promotedFromDir:o,contentDirRequested:e.contentDir,contentScaffoldFailed:!0,mcpAction:`failed`,mcpPath:i,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`,sharing:{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:!1}}}let d=u.created.includes(Ce),f=!1;if(l.didInit)try{f=ee(r)===`created`}catch(e){console.warn(`[ok] Skipping .gitignore seed at ${r}: ${e instanceof Error?e.message:String(e)}`)}try{re(r)}catch(e){console.warn(`[ok] Skipping project-skill .gitignore entry at ${r}: ${e instanceof Error?e.message:String(e)}`)}let p=await y(r);p.kind===`untracked`&&console.warn(`[ok] Untracked the OpenKnowledge project skill (${p.dirs.join(`, `)}) — it is now local-only. Teammates will see this as a deletion on their next pull.`);let m=await Di({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),h=e.editors??Yi(r,e.home),_=e.editors??h,x=xe(h),C=xe(_),w=e.mcp===!1||m===null,le=Array.from(new Map([...x,...w?[]:C].map(e=>[e.id,e])).values()),ue=x.filter(t=>Pi(t,r,e.home)),T=[],de=[],fe=new Set;for(let t of le){if(w){let n=``;try{n=t.configPath(r,e.home)}catch{}T.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(wi(m)&&x.includes(t)&&t.scope===`global`&&T.push(Ii(t,r,c,e.home)),Ti(m)&&C.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Ii(t,r,c,e.home,n);T.push(i),(i.action===`written`||i.action===`overwritten`)&&fe.add(n)}}let me=new Set;for(let t of C){let n=t.projectSkillPath?.(r);!n||me.has(n)||(me.add(n),de.push(pe(t,r,{home:e.home})))}let he=de.filter(e=>e.action===`written`||e.action===`overwritten`).map(e=>e.editorId);if(he.length>0){let t=e.home??Le();ie({source:a,skills:[ce.project],agents:he,scope:r},{home:t,enabled:S(t).enabled})}let ge=!w&&m!==null&&Ti(m)?C.filter(e=>!e.projectConfigPath&&!e.projectSkillPath).map(e=>e.label):void 0,ye=w?[]:ue.map(e=>zi(e,r)).filter(e=>e!==void 0).filter(e=>!fe.has(e.path)),be=e.installUserSkill??ae,E=e.home??Le(),D=Ai(e.skills),O=!1,Se=!1,A=!1,j=!1,we=!1;for(let t of se){if(!D.has(t))continue;await oe(E,ce[t],!0).catch(()=>{}),O=!0;let n=await be({home:e.home,bundleId:t,force:!0});n===`installed`?Se=!0:n===`failed`?A=!0:n===`no-hosts`?we=!0:j=!0}let Te=A?`failed`:Se?`installed`:O&&j?`skip-current`:O&&we?`no-hosts`:`declined`,Ee=Se?b(E).map(e=>e.editorId):[],De=w?`skipped-flag`:`skipped-missing`,M=T.find(e=>e.editorId===`claude`)??T[0]??{action:De,configPath:_e.claude.configPath(r,e.home)},Oe=await Wi({projectRoot:r,desiredMode:await ki({sharing:e.sharing,projectRoot:r,isTTY:e.isTTY,freshProject:i,promptFn:e.sharingPromptFn}),explicitFlag:e.sharing});return{projectRoot:r,contentCreated:u.created,contentUpdated:u.updated,contentSkipped:u.skipped,editors:T,projectSkills:de,legacyProjectConfigs:ye,skillInstall:Te,skillHosts:Ee,didGitInit:l.didInit,rootGitignoreCreated:f,gitRootPromoted:n.gitRootPromoted,promotedFromDir:o,contentDir:d?s:void 0,contentDirRequested:e.contentDir,contentScaffoldFailed:!1,mcpAction:M.action,mcpPath:M.configPath,mcpError:`error`in M?M.error:void 0,projectScopeUnsupportedLabels:ge,sharing:Oe}}async function Wi(e){let{projectRoot:t,desiredMode:n,explicitFlag:r}=e,i=Pn(t);if(i===`no-git`)return{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:r===`local-only`};let a=An(t);if(n===`local-only`){let e=Mn(t,a);if(e.kind===`refused-tracked`){let t=e;return{kind:`refused-tracked`,tracked:t.tracked,remediation:t.remediation}}return e.kind===`no-exclude`?{kind:`no-exclude`,reason:e.reason,localOnlyRequested:r===`local-only`}:Gi(t,e,`add`)}if(i===`shared`)return{kind:`applied`,mode:`shared`,action:`noop`,appended:[],alreadyPresent:[],removed:[]};let o=Nn(t,a);return o.kind===`no-exclude`?{kind:`no-exclude`,reason:o.reason,localOnlyRequested:!1}:Gi(t,o,`remove`)}function Gi(e,t,n){let r=Pn(e);return n===`add`?{kind:`applied`,mode:r,action:t.appended.length>0?`added`:t.removed.length>0?`cleaned`:`noop`,appended:t.appended,alreadyPresent:t.alreadyPresent,removed:t.removed}:{kind:`applied`,mode:r,action:`removed`,appended:[],alreadyPresent:[],removed:t.removed}}function Ki(e){switch(e){case`oversize`:return`config too large to edit safely`;case`duplicate-container`:return`duplicate server block`;case`no-native-writer`:return`no format-preserving writer available`;default:return`config not readable`}}function qi(e,t){let n=[],r=e.editors.some(e=>e.action===`written`||e.action===`overwritten`),i=e.editors.some(e=>e.action===`failed`)||e.projectSkills.some(e=>e.action===`failed`),a=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-flag`),o=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-missing`);e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`),e.rootGitignoreCreated&&n.push(`Seeded .gitignore at ${t}/.gitignore (.DS_Store)`);let s=N(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(A(`Content scaffolded at ${s}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(A(`Content already present at ${s}/`)),e.contentSkipped.length>0&&n.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),n.push(``),e.mcpError&&e.editors.length===0)n.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0)if(n.push(A(`MCP server configuration:`)),e.mcpAction===`skipped-flag`)n.push(` MCP config not written — use without --no-mcp to configure editors`);else if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}else n.push(` No supported editor config directories detected; skipped MCP registration`);else if(a)n.push(`MCP config not written — use without --no-mcp to configure editors`);else if(o)n.push(A(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(A(`MCP server configuration:`));for(let r of e.editors){let e=r.configPath.startsWith(t)?P(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),i=r.serverName===`open-knowledge`?``:` (${r.serverName})`,a=r.configScope===`project`?` (project)`:``,o=`${r.label}${a}`,s=` `.repeat(Math.max(1,20-o.length)),c=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${o}${s}${e} ${O(`registered`)}${i}${c}`);break;case`overwritten`:n.push(` ${o}${s}${e} ${O(`updated`)}${i}${c}`);break;case`skipped-missing`:n.push(` ${o}${s}${e} config root missing; skipped`);break;case`failed`:n.push(` ${o}${s}${e} ${Se(`FAILED`)}: ${r.error}`);break;case`declined`:n.push(` ${o}${s}${e} left unchanged (${Ki(r.declineReason)})`);break;case`skipped-flag`:break;default:r.action}}if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}}if(e.projectSkills.length>0){n.push(``),n.push(A(`Project-local skills:`));for(let r of e.projectSkills){let e=`${r.label} (project)`,i=` `.repeat(Math.max(1,20-e.length)),a=r.path?P(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${O(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${O(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`skipped-prerequisite`:n.push(` ${e}${i}OpenKnowledge MCP is not configured; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${Se(`FAILED`)}: ${r.error}`);break}}}if(i&&(n.push(``),n.push(`For failed editors, add the MCP server entry or project skill manually. See:`),n.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){n.push(``),n.push(`Project MCP configs found:`);for(let r of e.legacyProjectConfigs)n.push(` ${r.label} ${P(t,r.path)}`);n.push(` These project-local files may override the global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.skillInstall)switch(n.push(``),n.push(A(`User-global skill:`)),e.skillInstall){case`installed`:{let t=(e.skillHosts??[]).map(e=>ge[e]??e),r=t.length>0?t.join(`, `):`the shared ~/.agents store`;n.push(` open-knowledge ${O(`installed for ${r}`)}`),n.push(` ${D(`Counted on skills.sh (skill name + source repo, once per machine).`)}`),n.push(` ${D(`Opt out: DO_NOT_TRACK=1, or Settings → User → Preferences.`)}`);break}case`skip-current`:n.push(` open-knowledge ${O(`already installed at current version`)}`);break;case`declined`:n.push(` open-knowledge ${D(`skipped for this run (--no-skills)`)}`),n.push(` ${D(`Nothing was installed or removed. Any built-in skills already on this`)}`),n.push(` ${D(`machine are untouched. Run init without the flag to install them:`)}`),n.push(` ${D(` ok init`)}`);break;case`no-hosts`:n.push(` open-knowledge ${D(`skipped — no supported agent host detected in your home directory`)}`);break;case`failed`:n.push(` ${k(`open-knowledge install failed — MCP still configured; retry with:`)}`),n.push(` ${k(` ok repair-skills`)}`);break}if(e.contentDirRequested!==void 0&&e.contentDir===void 0&&!e.contentScaffoldFailed?(n.push(``),n.push(k(`⚠ --content-dir ${e.contentDirRequested} ignored — .ok/config.yml already exists`)),n.push(` Edit .ok/config.yml → content.dir directly to change the content scope.`)):e.contentDir!==void 0&&e.contentDir!==`.`?(n.push(``),n.push(`Content scope set to ${e.contentDir}/ (content.dir in .ok/config.yml).`)):e.gitRootPromoted&&e.contentDir===`.`&&e.contentDirRequested===void 0&&(n.push(``),n.push(k(`⚠ Content scope promoted to the git repo root`)),n.push(` .ok/ was initialized at ${t} because it contains a .git folder (one .ok/ per git repo),`),n.push(` not the sub-folder you ran \`ok init\` in${e.promotedFromDir?` (${e.promotedFromDir})`:``}. The whole repo is now the content scope.`),e.promotedFromDir&&(n.push(" To scope to just that sub-folder, re-run `ok init --content-dir .` from there, or set"),n.push(` content.dir: ${e.promotedFromDir} in .ok/config.yml.`))),e.preview?(n.push(``),n.push(we(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),n.push(``),n.push(...Qi(e.sharing,t)),r){let t=new Set,r=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).filter(e=>!t.has(e.editorId)&&t.add(e.editorId)).map(e=>e.label);n.push(``),n.push(`${O(`✓`)} ${A(`Next steps:`)}`),n.push(` 1. Open your editor (${E(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${E(`ok seed --list-packs`)} — browse the starter packs`),n.push(` - ${E(`ok seed`)} — scaffold an empty repo`),n.push(` 4. Ask your agent to capture a source, research a topic, or build a wiki —`),n.push(` the procedures ship as skills alongside the MCP tools.`)}return n.join(`
637
637
  `)}function Ji(e,t){return{projectRoot:e.projectRoot,gitRootPromoted:e.gitRootPromoted,promotedFromDir:e.promotedFromDir??null,contentDir:t.contentDir,contentDirRequested:e.contentDirRequested??null,contentDirApplied:e.contentDir!==void 0,contentFileCount:t.contentFileCount,previewError:e.previewWarning??null,didGitInit:e.didGitInit,mcpAction:e.mcpAction,editors:e.editors.map(e=>({editorId:e.editorId,label:e.label,action:e.action,configPath:e.configPath,scope:e.configScope===`project`?`project`:`user`}))}}function Yi(e,t){let n=[];for(let r of T)Pi(_e[r],e,t)&&n.push(r);return n}function Xi(){let e={log:console.log,info:console.info,debug:console.debug},t=(...e)=>{process.stderr.write(`${e.map(e=>typeof e==`string`?e:ze(e)).join(` `)}\n`)};return console.log=t,console.info=t,console.debug=t,()=>{console.log=e.log,console.info=e.info,console.debug=e.debug}}function Zi(){return new be(`init`).description(`Scaffold .ok/ in the current directory and register the MCP server for your editor(s)`).option(`--mcp`,`Register the MCP server for selected editors (default: true)`,!0).option(`--no-mcp`,`Scaffold the .ok/ directory but do not touch MCP config`).option(`--dev-mcp`,`Register a local dev MCP entry using node + packages/cli/dist/cli.mjs with debug logging`).option(`--content-dir <dir>`,`Limit content to <dir> instead of the whole project. <dir> is interpreted relative to your current directory (e.g. "." = the folder you run the command in), then saved to .ok/config.yml as content.dir.`).option(`--json`,`Emit a structured JSON summary to stdout (diagnostics stay on stderr)`).option(`--skills <ids>`,`Install only the named user-global skill bundles (comma list: discovery,write-skill)`).option(`--no-skills`,`Do not install any user-global skill bundles`).addOption(new ue(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).addOption(new ue(`--shared`,`Commit OK config alongside content (the default for fresh repos)`).conflicts(`localOnly`)).addOption(new ue(`--local-only`,`Keep OK config out of git via .git/info/exclude (per-clone, not committed)`).conflicts(`shared`)).action(async e=>{let t=process.cwd(),n=e.shared?`shared`:e.localOnly?`local-only`:void 0,r=e.json?Xi():null;try{let r;try{r=await Ui({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope,sharing:n,contentDir:e.contentDir,skills:e.skills})}catch(e){if(e instanceof $||e instanceof g){process.stderr.write(`${e.message}\n`),process.exitCode=64;return}if(e instanceof f||e instanceof m){process.stderr.write(`${e.message}\n`),process.exitCode=78;return}if(e instanceof x){process.stderr.write(`open-knowledge could not initialize a git repo for this project. Re-run, or run 'git init' yourself in the project folder.
638
- `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-BO6n9crj.mjs`),{resolveContentDir:s}=await import(`./src-DB7C0CZe.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-DyOUTvCV.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(Ji(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${qi(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function Qi(e,t){let n=[];switch(e.kind){case`applied`:return n.push(A(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${O(`local-only`)} — appended ${e.appended.length} path(s) to ${A(`${t}/.git/info/exclude`)} (per-clone, not committed).`),e.removed.length>0&&n.push(` cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`)):e.action===`cleaned`?n.push(` ${O(`local-only`)} — already excluded; cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${O(`local-only`)} — already excluded; nothing to do.`):n.push(` ${O(`local-only`)}`):e.action===`removed`?n.push(` ${O(`shared`)} — removed OK paths from ${A(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${O(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(k(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
638
+ `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-BGxw7stI.mjs`),{resolveContentDir:s}=await import(`./src-8rHUz2eY.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-SYaXc23U.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(Ji(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${qi(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function Qi(e,t){let n=[];switch(e.kind){case`applied`:return n.push(A(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${O(`local-only`)} — appended ${e.appended.length} path(s) to ${A(`${t}/.git/info/exclude`)} (per-clone, not committed).`),e.removed.length>0&&n.push(` cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`)):e.action===`cleaned`?n.push(` ${O(`local-only`)} — already excluded; cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${O(`local-only`)} — already excluded; nothing to do.`):n.push(` ${O(`local-only`)}`):e.action===`removed`?n.push(` ${O(`shared`)} — removed OK paths from ${A(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${O(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(k(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
639
639
  `))n.push(t.length>0?` ${t}`:``);return n.push(` Re-run ${E(`ok config-sharing unshare`)} after resolving to complete the switch.`),n;case`no-exclude`:if(e.localOnlyRequested)n.push(k(`Sharing mode: --local-only requested but no git repo found — option ignored`)),n.push(` Run ${E(`git init`)} (or open this folder via OK Desktop, which can scaffold a repo) and then ${E(`ok config-sharing unshare`)}.`);else if(e.reason===`no-git`)return[];else n.push(k(`Sharing mode unavailable: ${e.reason}.`));return n}}export{Fn as A,xt as B,ar as C,Kn as D,Gn as E,Nn as F,Xe as H,Dn as I,hn as L,An as M,In as N,Mn as O,Pn as P,Tt as R,Rr as S,Y as T,U as V,vi as _,Ji as a,ni as b,qi as c,Bi as d,Ai as f,Ui as g,ki as h,Wi as i,jn as j,Ln as k,Qi as l,ji as m,Ni as n,Hi as o,Di as p,Li as r,Yi as s,$ as t,Zi as u,Ii as v,er as w,Br as x,ri as y,St as z};
640
- //# sourceMappingURL=init-eBP6ynxi.mjs.map
640
+ //# sourceMappingURL=init-BJVLqPEk.mjs.map
@@ -0,0 +1 @@
1
+ import"./src-1Rp1Dq8a.mjs";import{g as e}from"./init-BJVLqPEk.mjs";export{e as runInit};
@@ -1,2 +1,2 @@
1
- import{Mr as e,kr as t}from"./src-DGS-lA-C.mjs";import{I as n}from"./fs-traced-C5oeVBiQ.mjs";import{D as r,T as i}from"./init-eBP6ynxi.mjs";import{t as a}from"./is-object-Bw0-z8qH.mjs";import{join as o}from"node:path";import{existsSync as s,readFileSync as c}from"node:fs";const l={allowTrailingComma:!0,disallowComments:!1};function u(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function d(a){let d=o(a,`.claude`,`launch.json`);if(!s(d))return{kind:`not-present`};let p;try{p=c(d,`utf-8`)}catch{return{kind:`declined`}}let m=[],h=e(p,m,l)??void 0;if(m.some(e=>!u(e,p))||!h||h.type!==`object`)return{kind:`declined`};let g=t(h).configurations;if(!Array.isArray(g))return{kind:`not-present`};let _=g.findIndex(f);if(_===-1)return{kind:`not-present`};let{text:v,changed:y}=r(p,[`configurations`,_]);return y?(n(d,v,{mode:i(d)}),{kind:`removed`}):{kind:`not-present`}}function f(e){if(!a(e))return!1;let t=e;if(t.name!==`open-knowledge-ui`||!Array.isArray(t.runtimeArgs))return!1;let n=t.runtimeArgs;return t.runtimeExecutable===`/bin/sh`?n.length===3&&n[0]===`-l`&&n[1]===`-c`&&typeof n[2]==`string`&&/^# ok-ui-v[1-9]\d*$/.test(n[2].split(/\r?\n/,1)[0]??``):t.runtimeExecutable===`npx`?p.some(e=>m(n,e)):t.runtimeExecutable===`powershell`&&n.length===4&&n[0]===`-NoProfile`&&n[1]===`-NonInteractive`&&n[2]===`-Command`&&typeof n[3]==`string`&&/^# ok-ui-win-v[1-9]\d*$/.test(n[3].split(/\r?\n/,1)[0]??``)}const p=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function m(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{d as t};
2
- //# sourceMappingURL=launch-json-removal-BFpdcojK.mjs.map
1
+ import{Mr as e,kr as t}from"./src-1Rp1Dq8a.mjs";import{I as n}from"./fs-traced-C5oeVBiQ.mjs";import{D as r,T as i}from"./init-BJVLqPEk.mjs";import{t as a}from"./is-object-Bw0-z8qH.mjs";import{join as o}from"node:path";import{existsSync as s,readFileSync as c}from"node:fs";const l={allowTrailingComma:!0,disallowComments:!1};function u(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function d(a){let d=o(a,`.claude`,`launch.json`);if(!s(d))return{kind:`not-present`};let p;try{p=c(d,`utf-8`)}catch{return{kind:`declined`}}let m=[],h=e(p,m,l)??void 0;if(m.some(e=>!u(e,p))||!h||h.type!==`object`)return{kind:`declined`};let g=t(h).configurations;if(!Array.isArray(g))return{kind:`not-present`};let _=g.findIndex(f);if(_===-1)return{kind:`not-present`};let{text:v,changed:y}=r(p,[`configurations`,_]);return y?(n(d,v,{mode:i(d)}),{kind:`removed`}):{kind:`not-present`}}function f(e){if(!a(e))return!1;let t=e;if(t.name!==`open-knowledge-ui`||!Array.isArray(t.runtimeArgs))return!1;let n=t.runtimeArgs;return t.runtimeExecutable===`/bin/sh`?n.length===3&&n[0]===`-l`&&n[1]===`-c`&&typeof n[2]==`string`&&/^# ok-ui-v[1-9]\d*$/.test(n[2].split(/\r?\n/,1)[0]??``):t.runtimeExecutable===`npx`?p.some(e=>m(n,e)):t.runtimeExecutable===`powershell`&&n.length===4&&n[0]===`-NoProfile`&&n[1]===`-NonInteractive`&&n[2]===`-Command`&&typeof n[3]==`string`&&/^# ok-ui-win-v[1-9]\d*$/.test(n[3].split(/\r?\n/,1)[0]??``)}const p=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function m(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{d as t};
2
+ //# sourceMappingURL=launch-json-removal-C7vezYJn.mjs.map
@@ -0,0 +1 @@
1
+ import{n as e}from"./loader-C4nhWSIa.mjs";export{e as loadConfig};
@@ -1,2 +1,2 @@
1
- import{g as e,h as t,x as n,y as r,yt as i}from"./sleep-DyLEGHvt.mjs";import{Ec as a,Tc as o}from"./src-CaLoSvK5.mjs";import{b as s}from"./src-DGS-lA-C.mjs";import{A as c,L as l}from"./fs-traced-C5oeVBiQ.mjs";import{t as u}from"./constants-DzLzqZ-e.mjs";import{t as d}from"./is-object-Bw0-z8qH.mjs";import{resolve as f}from"node:path";import{existsSync as p,readFileSync as m}from"node:fs";import{realpath as h}from"node:fs/promises";var g=i();async function _(e){let t=f(e);try{return await h(t)}catch(e){if(e.code!==`ENOENT`){let n=e instanceof Error?e.message:String(e);console.warn(`[normalize-cwd] realpath failed for ${t}: ${n}`)}return t}}function v(e){if(!p(e))return{value:null,path:e,source:null,doc:null};let t;try{t=m(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,g.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return d(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function y(e,t){return e.map(e=>{let r=e.path.map(e=>typeof e==`symbol`?String(e):e),i={path:r,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=n({file:t.path,source:t.source,doc:t.doc,path:r});if(e!==void 0)return{...i,source:e}}return i})}function b(n){let i=n??process.cwd(),d=[],p=[],m=[],h=[],g=c(`user`,i),_=l({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&d.push(g);let b=(n,r=!1)=>{let i=v(n);if(i.diagnostic!==void 0&&p.push(i.diagnostic),i.value===null)return{};let o=t({value:i.value,file:i.path,source:i.source,doc:i.doc});p.push(...o),d.push(n);let s=o.length>0?e(i.value):i.value;return r&&h.push(...a({value:s,file:i.path,source:i.source,doc:i.doc})),s},x=f(i,`.ok`,u),S=b(x,!0),C=b(c(`project-local`,i)),w=o(_.value,S,C),T=s.safeParse(w);if(!T.success){let e=v(x),t={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(r(t))}return{config:T.data,sources:d,diagnostics:p,sidelined:m,ignoredCommittedKeys:h}}function x(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=_(e.startupCwd);return async o=>{let s=await _(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{b as n,x as t};
2
- //# sourceMappingURL=loader-CRRZ4eTQ.mjs.map
1
+ import{g as e,h as t,x as n,y as r,yt as i}from"./sleep-DyLEGHvt.mjs";import{Dc as a,Ec as o}from"./src-wzwdHnH1.mjs";import{b as s}from"./src-1Rp1Dq8a.mjs";import{A as c,L as l}from"./fs-traced-C5oeVBiQ.mjs";import{t as u}from"./constants-YeHiomno.mjs";import{t as d}from"./is-object-Bw0-z8qH.mjs";import{resolve as f}from"node:path";import{existsSync as p,readFileSync as m}from"node:fs";import{realpath as h}from"node:fs/promises";var g=i();async function _(e){let t=f(e);try{return await h(t)}catch(e){if(e.code!==`ENOENT`){let n=e instanceof Error?e.message:String(e);console.warn(`[normalize-cwd] realpath failed for ${t}: ${n}`)}return t}}function v(e){if(!p(e))return{value:null,path:e,source:null,doc:null};let t;try{t=m(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,g.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return d(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function y(e,t){return e.map(e=>{let r=e.path.map(e=>typeof e==`symbol`?String(e):e),i={path:r,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=n({file:t.path,source:t.source,doc:t.doc,path:r});if(e!==void 0)return{...i,source:e}}return i})}function b(n){let i=n??process.cwd(),d=[],p=[],m=[],h=[],g=c(`user`,i),_=l({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&d.push(g);let b=(n,r=!1)=>{let i=v(n);if(i.diagnostic!==void 0&&p.push(i.diagnostic),i.value===null)return{};let o=t({value:i.value,file:i.path,source:i.source,doc:i.doc});p.push(...o),d.push(n);let s=o.length>0?e(i.value):i.value;return r&&h.push(...a({value:s,file:i.path,source:i.source,doc:i.doc})),s},x=f(i,`.ok`,u),S=b(x,!0),C=b(c(`project-local`,i)),w=o(_.value,S,C),T=s.safeParse(w);if(!T.success){let e=v(x),t={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(r(t))}return{config:T.data,sources:d,diagnostics:p,sidelined:m,ignoredCommittedKeys:h}}function x(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=_(e.startupCwd);return async o=>{let s=await _(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{b as n,x as t};
2
+ //# sourceMappingURL=loader-C4nhWSIa.mjs.map
@@ -0,0 +1,2 @@
1
+ import{fs as e,ss as t,vo as n}from"./src-wzwdHnH1.mjs";const r=new n({extensions:t,deriveStructuralFreshness:!0}),i=e(t);export{i as n,r as t};
2
+ //# sourceMappingURL=md-manager-Bu71zQPt.mjs.map
@@ -1,2 +1,2 @@
1
- import{Bi as e}from"./src-DGS-lA-C.mjs";import{execFile as t}from"node:child_process";const n=new Set([`http:`,`https:`]),r=/[\u0000-\u0020\u007F-\u009F"'`\\&|<>^()$;{}[\]*?!~]/;function i(e,t){console.warn(`Could not auto-open browser (${t}); visit ${e} manually`)}function a(a){let o;try{o=new URL(a)}catch{i(a,`invalid URL`);return}if(!n.has(o.protocol)){i(a,`unsupported scheme '${o.protocol}'`);return}if(r.test(a)){i(a,`URL contains unsafe characters`);return}t(process.platform===`darwin`?`open`:process.platform===`win32`?`cmd`:`xdg-open`,process.platform===`win32`?[`/c`,`start`,``,a]:[a],e({}),e=>{e&&console.warn(`Could not auto-open browser (${e.message}); visit ${a} manually`)})}export{a as openBrowser};
2
- //# sourceMappingURL=open-browser-mXaE0V-v.mjs.map
1
+ import{Bi as e}from"./src-1Rp1Dq8a.mjs";import{execFile as t}from"node:child_process";const n=new Set([`http:`,`https:`]),r=/[\u0000-\u0020\u007F-\u009F"'`\\&|<>^()$;{}[\]*?!~]/;function i(e,t){console.warn(`Could not auto-open browser (${t}); visit ${e} manually`)}function a(a){let o;try{o=new URL(a)}catch{i(a,`invalid URL`);return}if(!n.has(o.protocol)){i(a,`unsupported scheme '${o.protocol}'`);return}if(r.test(a)){i(a,`URL contains unsafe characters`);return}t(process.platform===`darwin`?`open`:process.platform===`win32`?`cmd`:`xdg-open`,process.platform===`win32`?[`/c`,`start`,``,a]:[a],e({}),e=>{e&&console.warn(`Could not auto-open browser (${e.message}); visit ${a} manually`)})}export{a as openBrowser};
2
+ //# sourceMappingURL=open-browser-CxqP3TDJ.mjs.map
@@ -1,2 +1,2 @@
1
- import{t as e}from"./md-manager-BJ88tow5.mjs";import{parentPort as t}from"node:worker_threads";function n(t){try{let n,r;if(t.embedTable!==void 0&&t.sourcePath!==void 0){let e=t.embedTable;r={sourcePath:t.sourcePath,resolveEmbed:t=>e[t]?.path??null,...t.wantSizes?{resolveSize:t=>e[t]?.size??null}:{}}}else if(t.recordEmbeds&&t.sourcePath!==void 0){let e=new Set;n=e,r={sourcePath:t.sourcePath,resolveEmbed:t=>(e.add(t),null),...t.wantSizes?{resolveSize:t=>(e.add(t),null)}:{}}}let i=e.parseWithFallback(t.body,r);return n!==void 0&&n.size>0?{id:t.id,ok:!0,parsedJson:i,requestedTargets:[...n]}:{id:t.id,ok:!0,parsedJson:i}}catch(e){return{id:t.id,ok:!1,message:e instanceof Error?e.message.slice(0,500):String(e).slice(0,500)}}}t?.on(`message`,e=>{t?.postMessage(n(e))});export{};
1
+ import{t as e}from"./md-manager-Bu71zQPt.mjs";import{parentPort as t}from"node:worker_threads";function n(t){try{let n,r;if(t.embedTable!==void 0&&t.sourcePath!==void 0){let e=t.embedTable;r={sourcePath:t.sourcePath,resolveEmbed:t=>e[t]?.path??null,...t.wantSizes?{resolveSize:t=>e[t]?.size??null}:{}}}else if(t.recordEmbeds&&t.sourcePath!==void 0){let e=new Set;n=e,r={sourcePath:t.sourcePath,resolveEmbed:t=>(e.add(t),null),...t.wantSizes?{resolveSize:t=>(e.add(t),null)}:{}}}let i=e.parseWithFallback(t.body,r);return n!==void 0&&n.size>0?{id:t.id,ok:!0,parsedJson:i,requestedTargets:[...n]}:{id:t.id,ok:!0,parsedJson:i}}catch(e){return{id:t.id,ok:!1,message:e instanceof Error?e.message.slice(0,500):String(e).slice(0,500)}}}t?.on(`message`,e=>{t?.postMessage(n(e))});export{};
2
2
  //# sourceMappingURL=parse-worker.mjs.map
@@ -1,3 +1,3 @@
1
- import{Nr as e}from"./src-DGS-lA-C.mjs";import"./constants-DzLzqZ-e.mjs";import{join as t,relative as n}from"node:path";import{existsSync as r,lstatSync as i,readdirSync as a,realpathSync as o,statSync as s}from"node:fs";function c(r){let{projectDir:c,contentDir:l,sampleCap:u=5}=r,d=[],f=[];try{i(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let r;try{r=a(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);d.push(`could not read directory ${n(l,e)||`.`}: ${r}`);return}for(let i of r){let r=t(e,i.name);if(i.isSymbolicLink()){let e;try{e=o(r)}catch(e){let t=e.code;t===`ENOENT`||t===`ELOOP`?d.push(`broken or cyclic symlink: ${n(l,r)}`):d.push(`cannot resolve symlink ${n(l,r)}: ${t??`unknown error`}`);continue}let t;try{t=s(e)}catch{continue}if(t.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(t.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}else if(i.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(i.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,i){let a=[],o=n(i,e.contentDir),s=o===``?`./`:`./${o}`;if(a.push(`Content:`),a.push(` Found ${e.totalCount} markdown files in ${s}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;a.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)a.push(` Warning: ${t}`);return a.push(``),r(t(i,`.ok`,`config.yml`))?(a.push(` To adjust scope, add patterns to .okignore at the project root.`),a.push(` To change the content root, edit .ok/config.yml → content.dir.`)):a.push(" Run `open-knowledge init` to scaffold config + .okignore."),a.push(``),a.push(` Re-check anytime: open-knowledge preview`),a.join(`
1
+ import{Nr as e}from"./src-1Rp1Dq8a.mjs";import"./constants-YeHiomno.mjs";import{join as t,relative as n}from"node:path";import{existsSync as r,lstatSync as i,readdirSync as a,realpathSync as o,statSync as s}from"node:fs";function c(r){let{projectDir:c,contentDir:l,sampleCap:u=5}=r,d=[],f=[];try{i(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let r;try{r=a(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);d.push(`could not read directory ${n(l,e)||`.`}: ${r}`);return}for(let i of r){let r=t(e,i.name);if(i.isSymbolicLink()){let e;try{e=o(r)}catch(e){let t=e.code;t===`ENOENT`||t===`ELOOP`?d.push(`broken or cyclic symlink: ${n(l,r)}`):d.push(`cannot resolve symlink ${n(l,r)}: ${t??`unknown error`}`);continue}let t;try{t=s(e)}catch{continue}if(t.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(t.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}else if(i.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(i.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,i){let a=[],o=n(i,e.contentDir),s=o===``?`./`:`./${o}`;if(a.push(`Content:`),a.push(` Found ${e.totalCount} markdown files in ${s}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;a.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)a.push(` Warning: ${t}`);return a.push(``),r(t(i,`.ok`,`config.yml`))?(a.push(` To adjust scope, add patterns to .okignore at the project root.`),a.push(` To change the content root, edit .ok/config.yml → content.dir.`)):a.push(" Run `open-knowledge init` to scaffold config + .okignore."),a.push(``),a.push(` Re-check anytime: open-knowledge preview`),a.join(`
2
2
  `)}export{c as n,l as t};
3
- //# sourceMappingURL=preview-cPC1BHPG.mjs.map
3
+ //# sourceMappingURL=preview-BZwSz2kH.mjs.map
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./preview-BZwSz2kH.mjs";export{t as formatPreviewBlock,e as previewContent};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{a as n,i as r}from"./DocumentContext-BId0aBaa.js";import{t as i}from"./react-f2sANaYj.js";import{n as a,r as o}from"./dist-Nvb76hAm.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{t as c}from"./button-Cym3gapE.js";import{i as l,n as u,t as d}from"./tooltip-DttaCTqz.js";import{a as f,c as p,i as m,o as h,s as g,t as _}from"./dialog-CTNat3T_.js";import{n as v}from"./dist-CJhtNlOm2.js";import{t as y}from"./dist-Cr4-nBVI.js";import{u as b}from"./Mermaid-B4Oa2diB.js";import{t as x}from"./circle-alert-b-E0_BIP.js";import{i as S}from"./prop-types-DTEkSQcM.js";import{t as C}from"./spinner-t7GahFcQ.js";import{t as w}from"./undo-2-XcI_wHcs.js";import{d as T}from"./page-list-cache-CI-xFldj.js";import{a as E,i as D,n as O,o as k,t as A}from"./agent-diff-store-7YPKABFM.js";import{t as j}from"./timeline-diff-store-ym5Oz1UF.js";import{n as M}from"./use-activity-panel-DgMjR_uo.js";var N=s(),P=e(i(),1),F=t();function I(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function ee(e){let t=(0,N.c)(86),{burst:n,docName:r,editCount:i,sessionAlive:s,inFlight:v,onOpenDiff:y,onRestore:b}=e,{_:x}=o(),[S,T]=(0,P.useState)(te),D,O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{let e=setInterval(()=>T(Date.now()),3e4);return()=>clearInterval(e)},O=[],t[0]=D,t[1]=O):(D=t[0],O=t[1]),(0,P.useEffect)(D,O);let[k,A]=(0,P.useState)(!1),j=E(),M=n.stackIndex+1,ee=j?.docName===r&&j.keptCount===M,L=i-M,ne=!s||v||L<=0,re;t[2]!==L||t[3]!==b?(re=function(){A(!1),b(L)},t[2]=L,t[3]=b,t[4]=re):re=t[4];let ie=re,R;t[5]!==n||t[6]!==y?(R=()=>y(n),t[5]=n,t[6]=y,t[7]=R):R=t[7];let z;t[8]!==x||t[9]!==M||t[10]!==r?(z=x({id:`Z79bnE`,values:{burstNumber:M,docName:r}}),t[8]=x,t[9]=M,t[10]=r,t[11]=z):z=t[11];let ae=ee?`bg-muted`:`hover:bg-muted/40`,oe;t[12]===ae?oe=t[13]:(oe=[`flex min-w-0 flex-1 items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground transition-colors`,ae],t[12]=ae,t[13]=oe);let se=oe.join(` `),B;t[14]!==n.ts||t[15]!==S?(B=I(n.ts,S),t[14]=n.ts,t[15]=S,t[16]=B):B=t[16];let V;t[17]===B?V=t[18]:(V=(0,F.jsx)(`span`,{className:`font-mono`,children:B}),t[17]=B,t[18]=V);let H;t[19]===n.additions?H=t[20]:(H=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[19]=n.additions,t[20]=H);let U;t[21]===n.deletions?U=t[22]:(U=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[21]=n.deletions,t[22]=U);let W;t[23]!==H||t[24]!==U?(W=(0,F.jsxs)(`span`,{className:`ml-auto font-mono`,children:[H,` `,U]}),t[23]=H,t[24]=U,t[25]=W):W=t[25];let G;t[26]!==ee||t[27]!==V||t[28]!==W||t[29]!==R||t[30]!==z||t[31]!==se?(G=(0,F.jsxs)(`button`,{type:`button`,onClick:R,"aria-pressed":ee,"aria-label":z,"data-testid":`activity-panel-burst-open`,className:se,children:[V,W]}),t[26]=ee,t[27]=V,t[28]=W,t[29]=R,t[30]=z,t[31]=se,t[32]=G):G=t[32];let ce;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1.5 h-3 w-px shrink-0 bg-border`}),t[33]=ce):ce=t[33];let K;t[34]!==x||t[35]!==M||t[36]!==r?(K=x({id:`Zhe80e`,values:{burstNumber:M,docName:r}}),t[34]=x,t[35]=M,t[36]=r,t[37]=K):K=t[37];let le;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>A(!0),t[38]=le):le=t[38];let q;t[39]===v?q=t[40]:(q=v?(0,F.jsx)(C,{className:`size-3`,"aria-hidden":`true`}):(0,F.jsx)(w,{className:`size-3`,"aria-hidden":`true`}),t[39]=v,t[40]=q);let J;t[41]!==ne||t[42]!==K||t[43]!==q?(J=(0,F.jsx)(l,{asChild:!0,children:(0,F.jsx)(c,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`activity-panel-burst-restore`,"aria-label":K,disabled:ne,onClick:le,children:q})}),t[41]=ne,t[42]=K,t[43]=q,t[44]=J):J=t[44];let Y;t[45]!==x||t[46]!==L||t[47]!==s?(Y=x(s?L>0?{id:`SOPwPh`}:{id:`62bOuM`}:{id:`NzFvyK`}),t[45]=x,t[46]=L,t[47]=s,t[48]=Y):Y=t[48];let X;t[49]===Y?X=t[50]:(X=(0,F.jsx)(u,{side:`left`,children:Y}),t[49]=Y,t[50]=X);let Z;t[51]!==J||t[52]!==X?(Z=(0,F.jsxs)(d,{children:[J,X]}),t[51]=J,t[52]=X,t[53]=Z):Z=t[53];let Q;t[54]!==G||t[55]!==Z?(Q=(0,F.jsxs)(`div`,{className:`flex items-center border-t border-border/50 pr-3`,children:[G,ce,Z]}),t[54]=G,t[55]=Z,t[56]=Q):Q=t[56];let ue;t[57]===v?ue=t[58]:(ue=e=>{!e&&!v?A(!1):e&&A(!0)},t[57]=v,t[58]=ue);let de;t[59]===x?de=t[60]:(de=x({id:`a4FRQv`}),t[59]=x,t[60]=de);let fe;t[61]===de?fe=t[62]:(fe=(0,F.jsx)(p,{children:de}),t[61]=de,t[62]=fe);let pe;t[63]===L?pe=t[64]:(pe=(0,F.jsx)(f,{children:(0,F.jsx)(a,{id:`LKIPzv`,values:{laterEdits:L}})}),t[63]=L,t[64]=pe);let $;t[65]!==fe||t[66]!==pe?($=(0,F.jsxs)(g,{children:[fe,pe]}),t[65]=fe,t[66]=pe,t[67]=$):$=t[67];let me;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,F.jsx)(c,{variant:`outline`,"data-testid":`activity-panel-burst-restore-cancel`,onClick:()=>A(!1),children:(0,F.jsx)(a,{id:`dEgA5A`})}),t[68]=me):me=t[68];let he;t[69]===v?he=t[70]:(he=v?(0,F.jsx)(C,{className:`mr-2 size-4`,"aria-hidden":`true`}):null,t[69]=v,t[70]=he);let ge;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,F.jsx)(a,{id:`9uI_rE`}),t[71]=ge):ge=t[71];let _e;t[72]!==ie||t[73]!==v||t[74]!==he?(_e=(0,F.jsxs)(h,{children:[me,(0,F.jsxs)(c,{variant:`destructive`,"data-testid":`activity-panel-burst-restore-confirm`,disabled:v,onClick:ie,children:[he,ge]})]}),t[72]=ie,t[73]=v,t[74]=he,t[75]=_e):_e=t[75];let ve;t[76]!==$||t[77]!==_e?(ve=(0,F.jsxs)(m,{children:[$,_e]}),t[76]=$,t[77]=_e,t[78]=ve):ve=t[78];let ye;t[79]!==k||t[80]!==ue||t[81]!==ve?(ye=(0,F.jsx)(_,{open:k,onOpenChange:ue,children:ve}),t[79]=k,t[80]=ue,t[81]=ve,t[82]=ye):ye=t[82];let be;return t[83]!==Q||t[84]!==ye?(be=(0,F.jsxs)(F.Fragment,{children:[Q,ye]}),t[83]=Q,t[84]=ye,t[85]=be):be=t[85],be}function te(){return Date.now()}function L(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return y._({id:`nYeBmY`,values:{hours:r}})}function ne(e){let t=(0,N.c)(56),{file:n,sessionAlive:r,isWriting:i,onNavigate:s,onUndoDrop:c,onSetVersion:l}=e,{_:u}=o(),{docName:d}=n,[f,p]=(0,P.useState)(!1),[m,h]=(0,P.useState)(re),g,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=setInterval(()=>h(Date.now()),3e4);return()=>clearInterval(e)},_=[],t[0]=g,t[1]=_):(g=t[0],_=t[1]),(0,P.useEffect)(g,_);let v=n.bursts.length,y;t[2]!==n.docName||t[3]!==c||t[4]!==r||t[5]!==f?(y=e=>{e<=0||!r||f||(p(!0),Promise.resolve(c(n.docName,e)).finally(()=>{p(!1),A()}))},t[2]=n.docName,t[3]=c,t[4]=r,t[5]=f,t[6]=y):y=t[6];let b=y;if(n.bursts.length===0)return null;let x;t[7]!==n.docName||t[8]!==s?(x=()=>s(n.docName),t[7]=n.docName,t[8]=s,t[9]=x):x=t[9];let S;t[10]!==u||t[11]!==d?(S=u({id:`QcpeeE`,values:{docName:d}}),t[10]=u,t[11]=d,t[12]=S):S=t[12];let C;t[13]!==n.docName||t[14]!==x||t[15]!==S?(C=(0,F.jsx)(`button`,{type:`button`,onClick:x,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":S,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[13]=n.docName,t[14]=x,t[15]=S,t[16]=C):C=t[16];let w;t[17]===n.additionsTotal?w=t[18]:(w=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[17]=n.additionsTotal,t[18]=w);let T;t[19]===n.deletionsTotal?T=t[20]:(T=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[19]=n.deletionsTotal,t[20]=T);let E;t[21]!==w||t[22]!==T?(E=(0,F.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[w,` `,T]}),t[21]=w,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==n.lastTs||t[25]!==m?(D=L(n.lastTs,m),t[24]=n.lastTs,t[25]=m,t[26]=D):D=t[26];let O;t[27]===D?O=t[28]:(O=(0,F.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:D}),t[27]=D,t[28]=O);let k;t[29]===i?k=t[30]:(k=i?(0,F.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,F.jsx)(a,{id:`6q0rnH`})}):null,t[29]=i,t[30]=k);let j;t[31]!==O||t[32]!==k||t[33]!==C||t[34]!==E?(j=(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[C,E,O,k]}),t[31]=O,t[32]=k,t[33]=C,t[34]=E,t[35]=j):j=t[35];let M;if(t[36]!==b||t[37]!==v||t[38]!==n.bursts||t[39]!==n.docName||t[40]!==l||t[41]!==r||t[42]!==f){let e;t[44]!==b||t[45]!==v||t[46]!==n.docName||t[47]!==l||t[48]!==r||t[49]!==f?(e=e=>(0,F.jsx)(ee,{burst:e,docName:n.docName,editCount:v,sessionAlive:r,inFlight:f,onOpenDiff:e=>l(e.stackIndex+1),onRestore:b},`${n.docName}:${e.stackIndex}`),t[44]=b,t[45]=v,t[46]=n.docName,t[47]=l,t[48]=r,t[49]=f,t[50]=e):e=t[50],M=n.bursts.map(e),t[36]=b,t[37]=v,t[38]=n.bursts,t[39]=n.docName,t[40]=l,t[41]=r,t[42]=f,t[43]=M}else M=t[43];let I;t[51]===M?I=t[52]:(I=(0,F.jsx)(`div`,{children:M}),t[51]=M,t[52]=I);let te;return t[53]!==j||t[54]!==I?(te=(0,F.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[j,I]}),t[53]=j,t[54]=I,t[55]=te):te=t[55],te}function re(){return Date.now()}async function ie(e){let t=await fetch(`/api/agent-undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,agentId:e.connectionId})});if(!t.ok)throw Error(`agent-undo failed: HTTP ${t.status}`)}function R(e){return`#/${e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function z(e){typeof window>`u`||(window.location.hash=R(e))}function ae(){let e=(0,N.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(C,{className:`mr-2 size-4`,"aria-hidden":`true`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,F.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,F.jsx)(`span`,{className:`text-sm`,children:(0,F.jsx)(a,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function oe(e){let t=(0,N.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,F.jsx)(x,{className:`size-6 text-destructive`,"aria-hidden":`true`}),t[0]=i):i=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,F.jsx)(`p`,{className:`text-sm font-medium`,children:(0,F.jsx)(a,{id:`DhLHEb`})}),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=(0,F.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=s);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(a,{id:`6gRgw8`}),t[4]=l):l=t[4];let u;t[5]===r?u=t[6]:(u=(0,F.jsx)(c,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:l}),t[5]=r,t[6]=u);let d;return t[7]!==s||t[8]!==u?(d=(0,F.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,u]}),t[7]=s,t[8]=u,t[9]=d):d=t[9],d}function se(){let e=(0,N.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,F.jsx)(`p`,{className:`text-sm italic`,children:(0,F.jsx)(a,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function B(e){let t=(0,N.c)(12),{onExit:n,showBackButton:r}=e,{_:i}=o(),s;t[0]===i?s=t[1]:(s=i({id:`kYL1lH`}),t[0]=i,t[1]=s);let c;t[2]!==n||t[3]!==r?(c=r?(0,F.jsx)(V,{onClick:n}):null,t[2]=n,t[3]=r,t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,F.jsx)(a,{id:`kYL1lH`})}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[c,l]}),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,F.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,F.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,F.jsx)(a,{id:`D_WKe_`})})}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==u?(f=(0,F.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":s,children:[u,d]}),t[9]=s,t[10]=u,t[11]=f):f=t[11],f}function V(e){let t=(0,N.c)(9),{onClick:n}=e,{_:r}=o(),i;t[0]===r?i=t[1]:(i=r({id:`ogAuyr`}),t[0]=r,t[1]=i);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(b,{}),t[2]=s):s=t[2];let f;t[3]!==n||t[4]!==i?(f=(0,F.jsx)(l,{asChild:!0,children:(0,F.jsx)(c,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":i,"data-testid":`docpanel-exit-agent-mode`,children:s})}),t[3]=n,t[4]=i,t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,F.jsx)(u,{side:`bottom`,children:(0,F.jsx)(a,{id:`ogAuyr`})}),t[6]=p):p=t[6];let m;return t[7]===f?m=t[8]:(m=(0,F.jsxs)(d,{children:[f,p]}),t[7]=f,t[8]=m),m}function H(e){let t=(0,N.c)(9),{lastTs:n}=e,[r]=(0,P.useState)(U),i;t[0]!==n||t[1]!==r?(i=n?W(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(`span`,{className:`font-medium`,children:(0,F.jsx)(a,{id:`LCUy_N`})}),t[3]=s):s=t[3];let c;t[4]===o?c=t[5]:(c=o?(0,F.jsxs)(`span`,{children:[` · `,o]}):null,t[4]=o,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,F.jsx)(a,{id:`GK-IRZ`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,F.jsxs)(`div`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"data-testid":`activity-panel-session-ended`,children:[s,c,l]}),t[7]=c,t[8]=u),u}function U(){return Date.now()}function W(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return y._({id:`nYeBmY`,values:{hours:n}})}function G(e){let t=(0,N.c)(10),{agent:n,size:r}=e,i=r===void 0?28:r,a;t[0]!==n.color||t[1]!==i?(a={backgroundColor:n.color,width:i,height:i},t[0]=n.color,t[1]=i,t[2]=a):a=t[2];let o=i*.57,s=i*.57,c;t[3]!==n.icon||t[4]!==o||t[5]!==s?(c=(0,F.jsx)(k,{icon:n.icon,width:o,height:s}),t[3]=n.icon,t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,F.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function ce(e){let t=(0,N.c)(25),{data:n,status:r,error:i,reload:s,onExit:c,onNavigate:l,onUndoDrop:u,onSetVersion:d,showBackButton:f}=e,{_:p}=o(),m=n?.files?.[0]?.lastTs??null,h=n?.files?.length??0,g;t[0]===p?g=t[1]:(g=p({id:`kYL1lH`}),t[0]=p,t[1]=g);let _;t[2]!==c||t[3]!==f?(_=f?(0,F.jsx)(V,{onClick:c}):null,t[2]=c,t[3]=f,t[4]=_):_=t[4];let v;t[5]!==n||t[6]!==h||t[7]!==m?(v=n?.agent?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(G,{agent:n.agent}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,F.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,F.jsx)(a,{id:`F6pfE9`}):m===null?(0,F.jsx)(a,{id:`PMyJ9C`}):(0,F.jsx)(a,{id:`237hSL`}),n.files.length>0?(0,F.jsxs)(F.Fragment,{children:[` · `,(0,F.jsx)(a,{id:`u3BOHd`,values:{fileCount:h}})]}):null]})]})]}):(0,F.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,F.jsx)(a,{id:`kYL1lH`})})}),t[5]=n,t[6]=h,t[7]=m,t[8]=v):v=t[8];let y;t[9]!==_||t[10]!==v?(y=(0,F.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[_,v]}),t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;t[12]!==n||t[13]!==i||t[14]!==m||t[15]!==l||t[16]!==d||t[17]!==u||t[18]!==s||t[19]!==r?(b=(0,F.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:r===`loading`&&n===null?(0,F.jsx)(ae,{}):r===`error`&&i?(0,F.jsx)(oe,{error:i,onRetry:s}):n===null?(0,F.jsx)(se,{}):(0,F.jsxs)(F.Fragment,{children:[!n.sessionAlive&&m!==null?(0,F.jsx)(H,{lastTs:m}):null,n.files.length===0?(0,F.jsx)(se,{}):n.files.map(e=>(0,F.jsx)(ne,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:l,onUndoDrop:u,onSetVersion:t=>d(e,t)},e.docName))]})}),t[12]=n,t[13]=i,t[14]=m,t[15]=l,t[16]=d,t[17]=u,t[18]=s,t[19]=r,t[20]=b):b=t[20];let x;return t[21]!==g||t[22]!==y||t[23]!==b?(x=(0,F.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":g,children:[y,b]}),t[21]=g,t[22]=y,t[23]=b,t[24]=x):x=t[24],x}function K(e){let t=(0,N.c)(30),i;t[0]===e?i=t[1]:(i=e===void 0?{}:e,t[0]=e,t[1]=i);let{showBackButton:a}=i,s=a===void 0?!0:a,{_:c}=o(),{docPanelAgentId:l,closeActivityPanel:u}=r(),{openTargetTransition:d}=n(),{pageMeta:f}=S(),{data:p,status:m,error:h,reload:g}=M(l),_,y;if(t[2]!==p||t[3]!==l?(_=()=>{if(!(!p||l===null))for(let e of p.files)D(l,e.docName,e.bursts.length)},y=[p,l],t[2]=p,t[3]=l,t[4]=_,t[5]=y):(_=t[4],y=t[5]),(0,P.useEffect)(_,y),l===null){let e;return t[6]!==u||t[7]!==s?(e=(0,F.jsx)(B,{onExit:u,showBackButton:s}),t[6]=u,t[7]=s,t[8]=e):e=t[8],e}let b;t[9]!==d||t[10]!==f?(b=e=>{d(T({kind:`doc`,target:e,docName:e},f),{disposition:`permanent`,consumeActiveNewTab:!0}),z(e)},t[9]=d,t[10]=f,t[11]=b):b=t[11];let x=b,C;t[12]!==p||t[13]!==l?(C=(e,t)=>{if(!p?.agent||l===null)return;j();let n=e.bursts.length;O({agentId:l,agentName:p.agent.displayName,agentColor:p.agent.color,agentIcon:p.agent.icon,docName:e.docName,keptCount:Math.max(0,Math.min(t,n)),maxVersions:n})},t[12]=p,t[13]=l,t[14]=C):C=t[14];let w=C,E;t[15]!==c||t[16]!==p||t[17]!==l||t[18]!==g?(E=async(e,t)=>{if(!(t<=0))try{await ie({connectionId:l,docName:e,scope:`count`,count:t,agentName:p?.agent?.displayName}),v.success(c(t===1?{id:`-dNlfM`,values:{docName:e}}:{id:`ApeA0n`,values:{dropCount:t,docName:e}})),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);v.error(c({id:`EqrC_R`,values:{message:n}})),g()}},t[15]=c,t[16]=p,t[17]=l,t[18]=g,t[19]=E):E=t[19];let k=E,A;return t[20]!==u||t[21]!==p||t[22]!==h||t[23]!==x||t[24]!==w||t[25]!==k||t[26]!==g||t[27]!==s||t[28]!==m?(A=(0,F.jsx)(ce,{data:p,status:m,error:h,reload:g,onExit:u,onNavigate:x,onUndoDrop:k,onSetVersion:w,showBackButton:s}),t[20]=u,t[21]=p,t[22]=h,t[23]=x,t[24]=w,t[25]=k,t[26]=g,t[27]=s,t[28]=m,t[29]=A):A=t[29],A}export{K as ActivityModeContent};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{a as n,i as r}from"./DocumentContext-rwQWKRwZ.js";import{t as i}from"./react-f2sANaYj.js";import{n as a,r as o}from"./dist-Nvb76hAm.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{t as c}from"./button-Cym3gapE.js";import{i as l,n as u,t as d}from"./tooltip-DttaCTqz.js";import{a as f,c as p,i as m,o as h,s as g,t as _}from"./dialog-CTNat3T_.js";import{n as v}from"./dist-CJhtNlOm2.js";import{t as y}from"./dist-Cr4-nBVI.js";import{u as b}from"./Mermaid-B4Oa2diB.js";import{t as x}from"./circle-alert-b-E0_BIP.js";import{i as S}from"./prop-types-B41RJtGt.js";import{t as C}from"./spinner-t7GahFcQ.js";import{t as w}from"./undo-2-XcI_wHcs.js";import{d as T}from"./page-list-cache-B3bvGAO5.js";import{a as E,i as D,n as O,o as k,t as A}from"./agent-diff-store-Cpo8SCiH.js";import{t as j}from"./timeline-diff-store-ym5Oz1UF.js";import{n as M}from"./use-activity-panel-Cwiaxn7-.js";var N=s(),P=e(i(),1),F=t();function I(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function ee(e){let t=(0,N.c)(86),{burst:n,docName:r,editCount:i,sessionAlive:s,inFlight:v,onOpenDiff:y,onRestore:b}=e,{_:x}=o(),[S,T]=(0,P.useState)(te),D,O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{let e=setInterval(()=>T(Date.now()),3e4);return()=>clearInterval(e)},O=[],t[0]=D,t[1]=O):(D=t[0],O=t[1]),(0,P.useEffect)(D,O);let[k,A]=(0,P.useState)(!1),j=E(),M=n.stackIndex+1,ee=j?.docName===r&&j.keptCount===M,L=i-M,ne=!s||v||L<=0,re;t[2]!==L||t[3]!==b?(re=function(){A(!1),b(L)},t[2]=L,t[3]=b,t[4]=re):re=t[4];let ie=re,R;t[5]!==n||t[6]!==y?(R=()=>y(n),t[5]=n,t[6]=y,t[7]=R):R=t[7];let z;t[8]!==x||t[9]!==M||t[10]!==r?(z=x({id:`Z79bnE`,values:{burstNumber:M,docName:r}}),t[8]=x,t[9]=M,t[10]=r,t[11]=z):z=t[11];let ae=ee?`bg-muted`:`hover:bg-muted/40`,oe;t[12]===ae?oe=t[13]:(oe=[`flex min-w-0 flex-1 items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground transition-colors`,ae],t[12]=ae,t[13]=oe);let se=oe.join(` `),B;t[14]!==n.ts||t[15]!==S?(B=I(n.ts,S),t[14]=n.ts,t[15]=S,t[16]=B):B=t[16];let V;t[17]===B?V=t[18]:(V=(0,F.jsx)(`span`,{className:`font-mono`,children:B}),t[17]=B,t[18]=V);let H;t[19]===n.additions?H=t[20]:(H=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[19]=n.additions,t[20]=H);let U;t[21]===n.deletions?U=t[22]:(U=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[21]=n.deletions,t[22]=U);let W;t[23]!==H||t[24]!==U?(W=(0,F.jsxs)(`span`,{className:`ml-auto font-mono`,children:[H,` `,U]}),t[23]=H,t[24]=U,t[25]=W):W=t[25];let G;t[26]!==ee||t[27]!==V||t[28]!==W||t[29]!==R||t[30]!==z||t[31]!==se?(G=(0,F.jsxs)(`button`,{type:`button`,onClick:R,"aria-pressed":ee,"aria-label":z,"data-testid":`activity-panel-burst-open`,className:se,children:[V,W]}),t[26]=ee,t[27]=V,t[28]=W,t[29]=R,t[30]=z,t[31]=se,t[32]=G):G=t[32];let ce;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1.5 h-3 w-px shrink-0 bg-border`}),t[33]=ce):ce=t[33];let K;t[34]!==x||t[35]!==M||t[36]!==r?(K=x({id:`Zhe80e`,values:{burstNumber:M,docName:r}}),t[34]=x,t[35]=M,t[36]=r,t[37]=K):K=t[37];let le;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>A(!0),t[38]=le):le=t[38];let q;t[39]===v?q=t[40]:(q=v?(0,F.jsx)(C,{className:`size-3`,"aria-hidden":`true`}):(0,F.jsx)(w,{className:`size-3`,"aria-hidden":`true`}),t[39]=v,t[40]=q);let J;t[41]!==ne||t[42]!==K||t[43]!==q?(J=(0,F.jsx)(l,{asChild:!0,children:(0,F.jsx)(c,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`activity-panel-burst-restore`,"aria-label":K,disabled:ne,onClick:le,children:q})}),t[41]=ne,t[42]=K,t[43]=q,t[44]=J):J=t[44];let Y;t[45]!==x||t[46]!==L||t[47]!==s?(Y=x(s?L>0?{id:`SOPwPh`}:{id:`62bOuM`}:{id:`NzFvyK`}),t[45]=x,t[46]=L,t[47]=s,t[48]=Y):Y=t[48];let X;t[49]===Y?X=t[50]:(X=(0,F.jsx)(u,{side:`left`,children:Y}),t[49]=Y,t[50]=X);let Z;t[51]!==J||t[52]!==X?(Z=(0,F.jsxs)(d,{children:[J,X]}),t[51]=J,t[52]=X,t[53]=Z):Z=t[53];let Q;t[54]!==G||t[55]!==Z?(Q=(0,F.jsxs)(`div`,{className:`flex items-center border-t border-border/50 pr-3`,children:[G,ce,Z]}),t[54]=G,t[55]=Z,t[56]=Q):Q=t[56];let ue;t[57]===v?ue=t[58]:(ue=e=>{!e&&!v?A(!1):e&&A(!0)},t[57]=v,t[58]=ue);let de;t[59]===x?de=t[60]:(de=x({id:`a4FRQv`}),t[59]=x,t[60]=de);let fe;t[61]===de?fe=t[62]:(fe=(0,F.jsx)(p,{children:de}),t[61]=de,t[62]=fe);let pe;t[63]===L?pe=t[64]:(pe=(0,F.jsx)(f,{children:(0,F.jsx)(a,{id:`LKIPzv`,values:{laterEdits:L}})}),t[63]=L,t[64]=pe);let $;t[65]!==fe||t[66]!==pe?($=(0,F.jsxs)(g,{children:[fe,pe]}),t[65]=fe,t[66]=pe,t[67]=$):$=t[67];let me;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,F.jsx)(c,{variant:`outline`,"data-testid":`activity-panel-burst-restore-cancel`,onClick:()=>A(!1),children:(0,F.jsx)(a,{id:`dEgA5A`})}),t[68]=me):me=t[68];let he;t[69]===v?he=t[70]:(he=v?(0,F.jsx)(C,{className:`mr-2 size-4`,"aria-hidden":`true`}):null,t[69]=v,t[70]=he);let ge;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,F.jsx)(a,{id:`9uI_rE`}),t[71]=ge):ge=t[71];let _e;t[72]!==ie||t[73]!==v||t[74]!==he?(_e=(0,F.jsxs)(h,{children:[me,(0,F.jsxs)(c,{variant:`destructive`,"data-testid":`activity-panel-burst-restore-confirm`,disabled:v,onClick:ie,children:[he,ge]})]}),t[72]=ie,t[73]=v,t[74]=he,t[75]=_e):_e=t[75];let ve;t[76]!==$||t[77]!==_e?(ve=(0,F.jsxs)(m,{children:[$,_e]}),t[76]=$,t[77]=_e,t[78]=ve):ve=t[78];let ye;t[79]!==k||t[80]!==ue||t[81]!==ve?(ye=(0,F.jsx)(_,{open:k,onOpenChange:ue,children:ve}),t[79]=k,t[80]=ue,t[81]=ve,t[82]=ye):ye=t[82];let be;return t[83]!==Q||t[84]!==ye?(be=(0,F.jsxs)(F.Fragment,{children:[Q,ye]}),t[83]=Q,t[84]=ye,t[85]=be):be=t[85],be}function te(){return Date.now()}function L(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return y._({id:`nYeBmY`,values:{hours:r}})}function ne(e){let t=(0,N.c)(56),{file:n,sessionAlive:r,isWriting:i,onNavigate:s,onUndoDrop:c,onSetVersion:l}=e,{_:u}=o(),{docName:d}=n,[f,p]=(0,P.useState)(!1),[m,h]=(0,P.useState)(re),g,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=setInterval(()=>h(Date.now()),3e4);return()=>clearInterval(e)},_=[],t[0]=g,t[1]=_):(g=t[0],_=t[1]),(0,P.useEffect)(g,_);let v=n.bursts.length,y;t[2]!==n.docName||t[3]!==c||t[4]!==r||t[5]!==f?(y=e=>{e<=0||!r||f||(p(!0),Promise.resolve(c(n.docName,e)).finally(()=>{p(!1),A()}))},t[2]=n.docName,t[3]=c,t[4]=r,t[5]=f,t[6]=y):y=t[6];let b=y;if(n.bursts.length===0)return null;let x;t[7]!==n.docName||t[8]!==s?(x=()=>s(n.docName),t[7]=n.docName,t[8]=s,t[9]=x):x=t[9];let S;t[10]!==u||t[11]!==d?(S=u({id:`QcpeeE`,values:{docName:d}}),t[10]=u,t[11]=d,t[12]=S):S=t[12];let C;t[13]!==n.docName||t[14]!==x||t[15]!==S?(C=(0,F.jsx)(`button`,{type:`button`,onClick:x,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":S,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[13]=n.docName,t[14]=x,t[15]=S,t[16]=C):C=t[16];let w;t[17]===n.additionsTotal?w=t[18]:(w=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[17]=n.additionsTotal,t[18]=w);let T;t[19]===n.deletionsTotal?T=t[20]:(T=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[19]=n.deletionsTotal,t[20]=T);let E;t[21]!==w||t[22]!==T?(E=(0,F.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[w,` `,T]}),t[21]=w,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==n.lastTs||t[25]!==m?(D=L(n.lastTs,m),t[24]=n.lastTs,t[25]=m,t[26]=D):D=t[26];let O;t[27]===D?O=t[28]:(O=(0,F.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:D}),t[27]=D,t[28]=O);let k;t[29]===i?k=t[30]:(k=i?(0,F.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,F.jsx)(a,{id:`6q0rnH`})}):null,t[29]=i,t[30]=k);let j;t[31]!==O||t[32]!==k||t[33]!==C||t[34]!==E?(j=(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[C,E,O,k]}),t[31]=O,t[32]=k,t[33]=C,t[34]=E,t[35]=j):j=t[35];let M;if(t[36]!==b||t[37]!==v||t[38]!==n.bursts||t[39]!==n.docName||t[40]!==l||t[41]!==r||t[42]!==f){let e;t[44]!==b||t[45]!==v||t[46]!==n.docName||t[47]!==l||t[48]!==r||t[49]!==f?(e=e=>(0,F.jsx)(ee,{burst:e,docName:n.docName,editCount:v,sessionAlive:r,inFlight:f,onOpenDiff:e=>l(e.stackIndex+1),onRestore:b},`${n.docName}:${e.stackIndex}`),t[44]=b,t[45]=v,t[46]=n.docName,t[47]=l,t[48]=r,t[49]=f,t[50]=e):e=t[50],M=n.bursts.map(e),t[36]=b,t[37]=v,t[38]=n.bursts,t[39]=n.docName,t[40]=l,t[41]=r,t[42]=f,t[43]=M}else M=t[43];let I;t[51]===M?I=t[52]:(I=(0,F.jsx)(`div`,{children:M}),t[51]=M,t[52]=I);let te;return t[53]!==j||t[54]!==I?(te=(0,F.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[j,I]}),t[53]=j,t[54]=I,t[55]=te):te=t[55],te}function re(){return Date.now()}async function ie(e){let t=await fetch(`/api/agent-undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,agentId:e.connectionId})});if(!t.ok)throw Error(`agent-undo failed: HTTP ${t.status}`)}function R(e){return`#/${e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function z(e){typeof window>`u`||(window.location.hash=R(e))}function ae(){let e=(0,N.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(C,{className:`mr-2 size-4`,"aria-hidden":`true`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,F.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,F.jsx)(`span`,{className:`text-sm`,children:(0,F.jsx)(a,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function oe(e){let t=(0,N.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,F.jsx)(x,{className:`size-6 text-destructive`,"aria-hidden":`true`}),t[0]=i):i=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,F.jsx)(`p`,{className:`text-sm font-medium`,children:(0,F.jsx)(a,{id:`DhLHEb`})}),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=(0,F.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=s);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(a,{id:`6gRgw8`}),t[4]=l):l=t[4];let u;t[5]===r?u=t[6]:(u=(0,F.jsx)(c,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:l}),t[5]=r,t[6]=u);let d;return t[7]!==s||t[8]!==u?(d=(0,F.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,u]}),t[7]=s,t[8]=u,t[9]=d):d=t[9],d}function se(){let e=(0,N.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,F.jsx)(`p`,{className:`text-sm italic`,children:(0,F.jsx)(a,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function B(e){let t=(0,N.c)(12),{onExit:n,showBackButton:r}=e,{_:i}=o(),s;t[0]===i?s=t[1]:(s=i({id:`kYL1lH`}),t[0]=i,t[1]=s);let c;t[2]!==n||t[3]!==r?(c=r?(0,F.jsx)(V,{onClick:n}):null,t[2]=n,t[3]=r,t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,F.jsx)(a,{id:`kYL1lH`})}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[c,l]}),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,F.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,F.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,F.jsx)(a,{id:`D_WKe_`})})}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==u?(f=(0,F.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":s,children:[u,d]}),t[9]=s,t[10]=u,t[11]=f):f=t[11],f}function V(e){let t=(0,N.c)(9),{onClick:n}=e,{_:r}=o(),i;t[0]===r?i=t[1]:(i=r({id:`ogAuyr`}),t[0]=r,t[1]=i);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(b,{}),t[2]=s):s=t[2];let f;t[3]!==n||t[4]!==i?(f=(0,F.jsx)(l,{asChild:!0,children:(0,F.jsx)(c,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":i,"data-testid":`docpanel-exit-agent-mode`,children:s})}),t[3]=n,t[4]=i,t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,F.jsx)(u,{side:`bottom`,children:(0,F.jsx)(a,{id:`ogAuyr`})}),t[6]=p):p=t[6];let m;return t[7]===f?m=t[8]:(m=(0,F.jsxs)(d,{children:[f,p]}),t[7]=f,t[8]=m),m}function H(e){let t=(0,N.c)(9),{lastTs:n}=e,[r]=(0,P.useState)(U),i;t[0]!==n||t[1]!==r?(i=n?W(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(`span`,{className:`font-medium`,children:(0,F.jsx)(a,{id:`LCUy_N`})}),t[3]=s):s=t[3];let c;t[4]===o?c=t[5]:(c=o?(0,F.jsxs)(`span`,{children:[` · `,o]}):null,t[4]=o,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,F.jsx)(a,{id:`GK-IRZ`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,F.jsxs)(`div`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"data-testid":`activity-panel-session-ended`,children:[s,c,l]}),t[7]=c,t[8]=u),u}function U(){return Date.now()}function W(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return y._({id:`nYeBmY`,values:{hours:n}})}function G(e){let t=(0,N.c)(10),{agent:n,size:r}=e,i=r===void 0?28:r,a;t[0]!==n.color||t[1]!==i?(a={backgroundColor:n.color,width:i,height:i},t[0]=n.color,t[1]=i,t[2]=a):a=t[2];let o=i*.57,s=i*.57,c;t[3]!==n.icon||t[4]!==o||t[5]!==s?(c=(0,F.jsx)(k,{icon:n.icon,width:o,height:s}),t[3]=n.icon,t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,F.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function ce(e){let t=(0,N.c)(25),{data:n,status:r,error:i,reload:s,onExit:c,onNavigate:l,onUndoDrop:u,onSetVersion:d,showBackButton:f}=e,{_:p}=o(),m=n?.files?.[0]?.lastTs??null,h=n?.files?.length??0,g;t[0]===p?g=t[1]:(g=p({id:`kYL1lH`}),t[0]=p,t[1]=g);let _;t[2]!==c||t[3]!==f?(_=f?(0,F.jsx)(V,{onClick:c}):null,t[2]=c,t[3]=f,t[4]=_):_=t[4];let v;t[5]!==n||t[6]!==h||t[7]!==m?(v=n?.agent?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(G,{agent:n.agent}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,F.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,F.jsx)(a,{id:`F6pfE9`}):m===null?(0,F.jsx)(a,{id:`PMyJ9C`}):(0,F.jsx)(a,{id:`237hSL`}),n.files.length>0?(0,F.jsxs)(F.Fragment,{children:[` · `,(0,F.jsx)(a,{id:`u3BOHd`,values:{fileCount:h}})]}):null]})]})]}):(0,F.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,F.jsx)(a,{id:`kYL1lH`})})}),t[5]=n,t[6]=h,t[7]=m,t[8]=v):v=t[8];let y;t[9]!==_||t[10]!==v?(y=(0,F.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[_,v]}),t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;t[12]!==n||t[13]!==i||t[14]!==m||t[15]!==l||t[16]!==d||t[17]!==u||t[18]!==s||t[19]!==r?(b=(0,F.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:r===`loading`&&n===null?(0,F.jsx)(ae,{}):r===`error`&&i?(0,F.jsx)(oe,{error:i,onRetry:s}):n===null?(0,F.jsx)(se,{}):(0,F.jsxs)(F.Fragment,{children:[!n.sessionAlive&&m!==null?(0,F.jsx)(H,{lastTs:m}):null,n.files.length===0?(0,F.jsx)(se,{}):n.files.map(e=>(0,F.jsx)(ne,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:l,onUndoDrop:u,onSetVersion:t=>d(e,t)},e.docName))]})}),t[12]=n,t[13]=i,t[14]=m,t[15]=l,t[16]=d,t[17]=u,t[18]=s,t[19]=r,t[20]=b):b=t[20];let x;return t[21]!==g||t[22]!==y||t[23]!==b?(x=(0,F.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":g,children:[y,b]}),t[21]=g,t[22]=y,t[23]=b,t[24]=x):x=t[24],x}function K(e){let t=(0,N.c)(30),i;t[0]===e?i=t[1]:(i=e===void 0?{}:e,t[0]=e,t[1]=i);let{showBackButton:a}=i,s=a===void 0?!0:a,{_:c}=o(),{docPanelAgentId:l,closeActivityPanel:u}=r(),{openTargetTransition:d}=n(),{pageMeta:f}=S(),{data:p,status:m,error:h,reload:g}=M(l),_,y;if(t[2]!==p||t[3]!==l?(_=()=>{if(!(!p||l===null))for(let e of p.files)D(l,e.docName,e.bursts.length)},y=[p,l],t[2]=p,t[3]=l,t[4]=_,t[5]=y):(_=t[4],y=t[5]),(0,P.useEffect)(_,y),l===null){let e;return t[6]!==u||t[7]!==s?(e=(0,F.jsx)(B,{onExit:u,showBackButton:s}),t[6]=u,t[7]=s,t[8]=e):e=t[8],e}let b;t[9]!==d||t[10]!==f?(b=e=>{d(T({kind:`doc`,target:e,docName:e},f),{disposition:`permanent`,consumeActiveNewTab:!0}),z(e)},t[9]=d,t[10]=f,t[11]=b):b=t[11];let x=b,C;t[12]!==p||t[13]!==l?(C=(e,t)=>{if(!p?.agent||l===null)return;j();let n=e.bursts.length;O({agentId:l,agentName:p.agent.displayName,agentColor:p.agent.color,agentIcon:p.agent.icon,docName:e.docName,keptCount:Math.max(0,Math.min(t,n)),maxVersions:n})},t[12]=p,t[13]=l,t[14]=C):C=t[14];let w=C,E;t[15]!==c||t[16]!==p||t[17]!==l||t[18]!==g?(E=async(e,t)=>{if(!(t<=0))try{await ie({connectionId:l,docName:e,scope:`count`,count:t,agentName:p?.agent?.displayName}),v.success(c(t===1?{id:`-dNlfM`,values:{docName:e}}:{id:`ApeA0n`,values:{dropCount:t,docName:e}})),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);v.error(c({id:`EqrC_R`,values:{message:n}})),g()}},t[15]=c,t[16]=p,t[17]=l,t[18]=g,t[19]=E):E=t[19];let k=E,A;return t[20]!==u||t[21]!==p||t[22]!==h||t[23]!==x||t[24]!==w||t[25]!==k||t[26]!==g||t[27]!==s||t[28]!==m?(A=(0,F.jsx)(ce,{data:p,status:m,error:h,reload:g,onExit:u,onNavigate:x,onUndoDrop:k,onSetVersion:w,showBackButton:s}),t[20]=u,t[21]=p,t[22]=h,t[23]=x,t[24]=w,t[25]=k,t[26]=g,t[27]=s,t[28]=m,t[29]=A):A=t[29],A}export{K as ActivityModeContent};