@inkeep/open-knowledge 0.38.4 → 0.39.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 (182) hide show
  1. package/dist/THIRD_PARTY_NOTICES.md +6 -7
  2. package/dist/{acp-harness-probe-BdmNFu8L.mjs → acp-harness-probe-BtCFgpt9.mjs} +2 -2
  3. package/dist/assets/skills/discovery/SKILL.md +1 -1
  4. package/dist/assets/skills/project/SKILL.md +1 -1
  5. package/dist/assets/skills/write-skill/SKILL.md +1 -1
  6. package/dist/cli.mjs +64 -62
  7. package/dist/constants-geQohyDW.mjs +2 -0
  8. package/dist/fs-traced-DOXZOlKx.mjs +1 -0
  9. package/dist/{fs-traced-B-qtPUmb.mjs → fs-traced-vMO6kYgZ.mjs} +2 -2
  10. package/dist/{git-handle-DnLoe9hy.mjs → git-handle-B30Z3S49.mjs} +2 -2
  11. package/dist/git-handle-RhB108wn.mjs +1 -0
  12. package/dist/index.mjs +1 -1
  13. package/dist/{init-BWhBsLIZ.mjs → init-BDsdA_o5.mjs} +5 -5
  14. package/dist/init-UpwZfJC9.mjs +1 -0
  15. package/dist/{launch-json-removal-BsMbCWYS.mjs → launch-json-removal-DvHJ0pIl.mjs} +2 -2
  16. package/dist/{loader-DO3qjQDp.mjs → loader-Cvfiqwbx.mjs} +2 -2
  17. package/dist/loader-D5j7kLJN.mjs +1 -0
  18. package/dist/{logger-CuGHGn_E.mjs → logger-B7Z8XO-z.mjs} +2 -2
  19. package/dist/md-manager-DqdW_K1F.mjs +2 -0
  20. package/dist/{open-browser-Bbzq7Z7d.mjs → open-browser-BAGk1RTK.mjs} +2 -2
  21. package/dist/parse-worker.mjs +1 -1
  22. package/dist/{preview-C1DTZkXE.mjs → preview-DlS48lyQ.mjs} +2 -2
  23. package/dist/preview-MJbgqGrR.mjs +1 -0
  24. package/dist/public/assets/{ActivityModeContent-CQTRie_S.js → ActivityModeContent-D7IDAADR.js} +1 -1
  25. package/dist/public/assets/{AgentDiffPane-ZsuLVO9W.js → AgentDiffPane-CKdCEnqD.js} +1 -1
  26. package/dist/public/assets/{AgentThreadClientBinder-poPjsQXP.js → AgentThreadClientBinder-CBCAdG4p.js} +1 -1
  27. package/dist/public/assets/{AppMenubar-DqlpmcU7.js → AppMenubar-hPGBtMtR.js} +1 -1
  28. package/dist/public/assets/{CodeMirrorPropInput-DUwQlljh.js → CodeMirrorPropInput-DqNDfEnD.js} +3 -3
  29. package/dist/public/assets/{DocumentContext-CPZffvoA.js → DocumentContext-C4Ar5jL6.js} +2 -2
  30. package/dist/public/assets/{EnableSyncConfirmDialog-BfZ_iVD2.js → EnableSyncConfirmDialog-DrkGGVev.js} +1 -1
  31. package/dist/public/assets/{FeedbackForm-BUn96JmL.js → FeedbackForm-CXXvUOWy.js} +1 -1
  32. package/dist/public/assets/{GraphPanel-BjCltqW1.js → GraphPanel-CG7ehFyf.js} +1 -1
  33. package/dist/public/assets/{ManagedArtifactProperties-CHmkRShb.js → ManagedArtifactProperties-C2eNyJKF.js} +1 -1
  34. package/dist/public/assets/{McpConsentDialogBody-B0VkhB1e.js → McpConsentDialogBody-BEu_w4lu.js} +1 -1
  35. package/dist/public/assets/{MermaidDocEditor-cedDjA-A.js → MermaidDocEditor-P9f8X7tU.js} +1 -1
  36. package/dist/public/assets/PropertyPanel-Bmem71bg.js +2 -0
  37. package/dist/public/assets/{ReportBugDialogBody-hPmCfQyc.js → ReportBugDialogBody--5aXNg8I.js} +1 -1
  38. package/dist/public/assets/{SettingsDialogBody-B6_psJil.js → SettingsDialogBody-DzDGWXMf.js} +1 -1
  39. package/dist/public/assets/{ShareBranchSwitchDialog-GXTPAgND.js → ShareBranchSwitchDialog-Dz3x9STZ.js} +1 -1
  40. package/dist/public/assets/{ShareReceiveDialog-IVAS4xf8.js → ShareReceiveDialog-B4PVwjNG.js} +1 -1
  41. package/dist/public/assets/{ShareReceiveMissDialog-ClkBICGx.js → ShareReceiveMissDialog-ByUnHZEP.js} +1 -1
  42. package/dist/public/assets/{SkillEditorActions-BEtnBlep.js → SkillEditorActions-Dr52b0PZ.js} +1 -1
  43. package/dist/public/assets/{SourceEditor-Bp45kdTW.js → SourceEditor-HYrhk_fF.js} +1 -1
  44. package/dist/public/assets/{TerminalPanel-CUoZt7C0.js → TerminalPanel-BpSo4w0_.js} +1 -1
  45. package/dist/public/assets/{TerminalSessionsHost-CNebjNFj.js → TerminalSessionsHost-DtGNhWg4.js} +2 -2
  46. package/dist/public/assets/{TerminalWindowApp-B6bT25Jw.js → TerminalWindowApp-DWqRcNhK.js} +1 -1
  47. package/dist/public/assets/{ThreadView-CmIHLGuV.js → ThreadView-CHP5Ra30.js} +1 -1
  48. package/dist/public/assets/{TimelineDiffPane-DffKOwf1.js → TimelineDiffPane-Cc8rHqoV.js} +1 -1
  49. package/dist/public/assets/{abnfDiagram-VRR7QNED-VSTZcs2U.js → abnfDiagram-VRR7QNED-D9F9DXsr.js} +1 -1
  50. package/dist/public/assets/{agent-diff-store-D6N0WX_4.js → agent-diff-store-Bd0NDaYd.js} +1 -1
  51. package/dist/public/assets/{agent-visibility-Z2AQQ5Ce.js → agent-visibility-bo7-lQPw.js} +1 -1
  52. package/dist/public/assets/architecture-TIHT7OUA-B1GVwxkr.js +1 -0
  53. package/dist/public/assets/{architectureDiagram-ZJ3FMSHR-CdM-QQxh.js → architectureDiagram-ZJ3FMSHR-DfsVDv0h.js} +1 -1
  54. package/dist/public/assets/{auth-state-cache-CfU3gJ3i.js → auth-state-cache-UUKRA6mi.js} +1 -1
  55. package/dist/public/assets/{chunk-5FCAYU7R-NiUcHUPk.js → chunk-5FCAYU7R-BZbSx9vA.js} +1 -1
  56. package/dist/public/assets/{chunk-5HE753X5-Dg-RP8eS.js → chunk-5HE753X5-B2Flc7i4.js} +1 -1
  57. package/dist/public/assets/{chunk-5JV3BV7I-B4O-mi81.js → chunk-5JV3BV7I-B6P7lOib.js} +1 -1
  58. package/dist/public/assets/{chunk-5TONJI2A-0kIjpsBw.js → chunk-5TONJI2A-Bx2IxKM5.js} +1 -1
  59. package/dist/public/assets/{chunk-BIQX33UG-D48fi9B_.js → chunk-BIQX33UG-BK09YW6f.js} +1 -1
  60. package/dist/public/assets/{chunk-CQNSW5MT-v0U-WvYg.js → chunk-CQNSW5MT-BAtlNSBX.js} +1 -1
  61. package/dist/public/assets/{chunk-CYSBUYHQ-DxqLAiLc.js → chunk-CYSBUYHQ-D8hsDORv.js} +1 -1
  62. package/dist/public/assets/{chunk-EMLP6XTP-CJ9U9-wH.js → chunk-EMLP6XTP-ChQSYJxh.js} +1 -1
  63. package/dist/public/assets/{chunk-JG7HCLWE-C-1xmmk6.js → chunk-JG7HCLWE-Biog_J3i.js} +1 -1
  64. package/dist/public/assets/{chunk-MOZMSUNE-C1Vt9ku6.js → chunk-MOZMSUNE-CPb1eEls.js} +1 -1
  65. package/dist/public/assets/{chunk-OSBZ3O6U-C6W744Of.js → chunk-OSBZ3O6U-DLOl9lpV.js} +1 -1
  66. package/dist/public/assets/{chunk-QBLGF6JB-gEqmaH-L.js → chunk-QBLGF6JB-CXHeFNVR.js} +1 -1
  67. package/dist/public/assets/{chunk-R7FJI6CG-BDAk393G.js → chunk-R7FJI6CG-C16CHt3a.js} +1 -1
  68. package/dist/public/assets/{chunk-U6XO7XAA-BrFJStxD.js → chunk-U6XO7XAA-DbjPtJON.js} +1 -1
  69. package/dist/public/assets/{chunk-YOTPTUD7-D0J4uIcv.js → chunk-YOTPTUD7-CI44npHy.js} +1 -1
  70. package/dist/public/assets/client-version-Ti93fR_U.js +1 -0
  71. package/dist/public/assets/{config-provider-DstRVgzH.js → config-provider-BMeRatQe.js} +1 -1
  72. package/dist/public/assets/cynefin-VYW2F7L2-IoPsg8uT.js +1 -0
  73. package/dist/public/assets/{cynefinDiagram-TSTJHNR4-BSgy8cxo.js → cynefinDiagram-TSTJHNR4-BerNcsRY.js} +1 -1
  74. package/dist/public/assets/{diagram-FQU43EPY-CMvIHgbq.js → diagram-FQU43EPY-Bn3pI3fo.js} +1 -1
  75. package/dist/public/assets/{diagram-G47NLZAW-fKFf9jF_.js → diagram-G47NLZAW-DlmHXzE8.js} +1 -1
  76. package/dist/public/assets/{diagram-NH7WQ7WH-B7-_M2pB.js → diagram-NH7WQ7WH-DSU5C3aY.js} +1 -1
  77. package/dist/public/assets/{diagram-OA4YK3LP-DZtbNsi6.js → diagram-OA4YK3LP-BxczHUUr.js} +1 -1
  78. package/dist/public/assets/{diagram-WEI45ONY-CCuX-lrB.js → diagram-WEI45ONY-9RfHZ21T.js} +1 -1
  79. package/dist/public/assets/{dist-DKsN2Ojq.js → dist-2zkQMrQC.js} +1 -1
  80. package/dist/public/assets/dist-DfKVxirz.js +124 -0
  81. package/dist/public/assets/{dist-Vm1kQiqo.js → dist-df-v6kvy.js} +64 -64
  82. package/dist/public/assets/{doc-hash-B8kD24Kw.js → doc-hash-NyLrtNo2.js} +1 -1
  83. package/dist/public/assets/{documents-events-DQ6Iario.js → documents-events-BHJB8gGz.js} +1 -1
  84. package/dist/public/assets/{ebnfDiagram-CCIWWBDH-lTULSp5K.js → ebnfDiagram-CCIWWBDH-D2xzvzqw.js} +1 -1
  85. package/dist/public/assets/eventmodeling-45OFAUF4-Miu5EHpe.js +1 -0
  86. package/dist/public/assets/{file-tree-adapter-eftmn56d.js → file-tree-adapter-BnZwo5Ls.js} +1 -1
  87. package/dist/public/assets/gitGraph-TEB2WS4Q-OmjugmYN.js +1 -0
  88. package/dist/public/assets/{gitGraphDiagram-IHSO6WYX-DST3agGX.js → gitGraphDiagram-IHSO6WYX-LRtYXzVh.js} +1 -1
  89. package/dist/public/assets/index-CJ7E0pG6.css +1 -0
  90. package/dist/public/assets/{index-XkYGz2OG.js → index-WhmMzp-C.js} +97 -97
  91. package/dist/public/assets/info-DKCQHKI2-BNI5cXhn.js +1 -0
  92. package/dist/public/assets/{infoDiagram-FWYZ7A6U-Cj1rH5Ql.js → infoDiagram-FWYZ7A6U-CoQbECuU.js} +1 -1
  93. package/dist/public/assets/{keyboard-shortcuts-DZ9kTSZ4.js → keyboard-shortcuts-Ctc7xams.js} +1 -1
  94. package/dist/public/assets/{lint-config-client-Bg-6mquJ.js → lint-config-client-BwIg_Zty.js} +1 -1
  95. package/dist/public/assets/{mermaid-parser.core-BO-Jr815.js → mermaid-parser.core-3Xu6H-xr.js} +2 -2
  96. package/dist/public/assets/{mermaid.core-BQ2yyMHt.js → mermaid.core-BgfUsmdk.js} +3 -3
  97. package/dist/public/assets/{navigation-targets-4J3F85tT.js → navigation-targets-D1rdXyAI.js} +1 -1
  98. package/dist/public/assets/{open-managed-artifact-tab-ze9HkqWn.js → open-managed-artifact-tab-MjzvjrV8.js} +1 -1
  99. package/dist/public/assets/packet-7NZHBO7P-B_5BB2Lm.js +1 -0
  100. package/dist/public/assets/{pegDiagram-2B236MQR-VQ3qdS5Z.js → pegDiagram-2B236MQR-BWoigFVh.js} +1 -1
  101. package/dist/public/assets/{pending-receive-nav-store-CVDTioM4.js → pending-receive-nav-store-XNS4eahL.js} +1 -1
  102. package/dist/public/assets/pie-RZYD4A2V-DN_XCApP.js +1 -0
  103. package/dist/public/assets/{pieDiagram-ENE6RG2P-B5fNaqzS.js → pieDiagram-ENE6RG2P-CkC6m5hO.js} +1 -1
  104. package/dist/public/assets/{prop-types-B0l6ZN6O.js → prop-types-C0wWXvTx.js} +1 -1
  105. package/dist/public/assets/radar-I7S5WNFK-KdS1Y0nk.js +1 -0
  106. package/dist/public/assets/railroad-3IZDKUUU-CargXMo2.js +1 -0
  107. package/dist/public/assets/railroad-abnf-AHOZXSZD-rKz-719h.js +1 -0
  108. package/dist/public/assets/railroad-ebnf-EBAXGLYW-BwxcIuUm.js +1 -0
  109. package/dist/public/assets/railroad-peg-LSFZ7HO6-D-qfZOX5.js +1 -0
  110. package/dist/public/assets/{railroadDiagram-RFXS5EU6-hi-XN2Rm.js → railroadDiagram-RFXS5EU6-DFdEG7eg.js} +1 -1
  111. package/dist/public/assets/{receive-store-jfaprLyZ.js → receive-store-B3ygF-LA.js} +1 -1
  112. package/dist/public/assets/{selection-context-BpEA0WhV.js → selection-context-z7qCoarT.js} +1 -1
  113. package/dist/public/assets/{skill-actions-s_ATobEI.js → skill-actions-DeZSwOo7.js} +1 -1
  114. package/dist/public/assets/{skills-api-CYoD9FQt.js → skills-api-vt4KnCX6.js} +1 -1
  115. package/dist/public/assets/{src-B-pNk3y3.js → src-BlUYczaV.js} +1 -1
  116. package/dist/public/assets/{target-navigation-intent-95GTKrco.js → target-navigation-intent-DNrmu8Sx.js} +1 -1
  117. package/dist/public/assets/{telemetry-impl-BgQUPJ0t.js → telemetry-impl-ThDnRQ01.js} +1 -1
  118. package/dist/public/assets/{telemetry-startup-DcvNN2rn.js → telemetry-startup-BYGi0S46.js} +1 -1
  119. package/dist/public/assets/{terminal-launch-events-D0NkBM4g.js → terminal-launch-events-vDhBoD8w.js} +1 -1
  120. package/dist/public/assets/{terminal-telemetry-DxZXlrf4.js → terminal-telemetry-D1lMQO11.js} +1 -1
  121. package/dist/public/assets/treeView-QDETBFTQ-ocdjjjzR.js +1 -0
  122. package/dist/public/assets/treemap-6X3UGDF4-PQZ2TLFo.js +1 -0
  123. package/dist/public/assets/{typing-burst-detector-CI_4wux0.js → typing-burst-detector-BJJh89A5.js} +1 -1
  124. package/dist/public/assets/{use-activity-panel-DoU5dDI7.js → use-activity-panel-DddtATqP.js} +1 -1
  125. package/dist/public/assets/{use-apply-config-color-theme-DBdIMwiU.js → use-apply-config-color-theme-R1RZkk5a.js} +1 -1
  126. package/dist/public/assets/{use-collab-url-CwAStsIj.js → use-collab-url-B-LUA0g9.js} +1 -1
  127. package/dist/public/assets/{use-live-xterm-theme-oqXGh0AM.js → use-live-xterm-theme-DW54zfIk.js} +1 -1
  128. package/dist/public/assets/{use-terminal-enabled-B1QnDzPO.js → use-terminal-enabled-C0F3SkCA.js} +1 -1
  129. package/dist/public/assets/{use-timeline-entry-diff-C_hkFzJg.js → use-timeline-entry-diff-DTpDQjgI.js} +2 -2
  130. package/dist/public/assets/{use-workspace-DyAcZSjY.js → use-workspace-0T1cdRp3.js} +1 -1
  131. package/dist/public/assets/wardley-OPB4EBWU-CAyNEwcQ.js +1 -0
  132. package/dist/public/assets/{wardleyDiagram-EHGQE667-ZOtSnSGU.js → wardleyDiagram-EHGQE667-C30zq5TO.js} +1 -1
  133. package/dist/public/assets/{workspace-paths-B_ozK4P-.js → workspace-paths-nkXut9sM.js} +1 -1
  134. package/dist/public/assets/{zod-CCGVCn6n.js → zod-BmQcPlGk.js} +1 -1
  135. package/dist/public/index.html +36 -36
  136. package/dist/{repair-launch-json-BIpE7NKe.mjs → repair-launch-json-DUkhIhmI.mjs} +2 -2
  137. package/dist/{repair-mcp-configs-xT4PqUrS.mjs → repair-mcp-configs-CKxdm8Dd.mjs} +2 -2
  138. package/dist/repair-skills-D2vECWae.mjs +1 -0
  139. package/dist/{repair-skills-DaVaOiQC.mjs → repair-skills-hgtdKE41.mjs} +2 -2
  140. package/dist/{server-lock-DzWMWbLN.mjs → server-lock-B6fpjbeE.mjs} +2 -2
  141. package/dist/server-lock-C_4LRuVM.mjs +1 -0
  142. package/dist/{src-eVRfK1KK.mjs → src-BNWCeu4P.mjs} +1 -1
  143. package/dist/{src-D_kKrwVo.mjs → src-CNWv2m7o.mjs} +6 -6
  144. package/dist/src-CaRd1QSi.mjs +3264 -0
  145. package/dist/{src-Cwu3lS3D.mjs → src-FuRMJntf.mjs} +107 -107
  146. package/dist/start-BKZeR4jl.mjs +1 -0
  147. package/dist/{start-BnU7-Z9L.mjs → start-BZulfzdD.mjs} +2 -2
  148. package/dist/{write-project-skill-DtERurRT.mjs → write-project-skill-CnAZrDt1.mjs} +4 -4
  149. package/package.json +5 -5
  150. package/dist/constants-B_riNG8U.mjs +0 -2
  151. package/dist/fs-traced-BRzKbmYW.mjs +0 -1
  152. package/dist/git-handle-DluCIpMR.mjs +0 -1
  153. package/dist/init-BEOhkLFQ.mjs +0 -1
  154. package/dist/loader-JolD1GIz.mjs +0 -1
  155. package/dist/md-manager-DtA0LK6p.mjs +0 -2
  156. package/dist/preview-CluoUHys.mjs +0 -1
  157. package/dist/public/assets/PropertyPanel-CpcpWkfS.js +0 -2
  158. package/dist/public/assets/architecture-TIHT7OUA-ei5hsjAY.js +0 -1
  159. package/dist/public/assets/client-version-BBhtdyiC.js +0 -1
  160. package/dist/public/assets/cynefin-VYW2F7L2-CSnwYRoV.js +0 -1
  161. package/dist/public/assets/dist-BS_gC2L8.js +0 -124
  162. package/dist/public/assets/eventmodeling-45OFAUF4-DaV8ZCTn.js +0 -1
  163. package/dist/public/assets/gitGraph-TEB2WS4Q-P9_tpoZt.js +0 -1
  164. package/dist/public/assets/index-NzW9g3x_.css +0 -1
  165. package/dist/public/assets/info-DKCQHKI2-DJJ8FtaQ.js +0 -1
  166. package/dist/public/assets/packet-7NZHBO7P-DOwsFu9x.js +0 -1
  167. package/dist/public/assets/pie-RZYD4A2V-DEV7c1Ne.js +0 -1
  168. package/dist/public/assets/radar-I7S5WNFK-B607lrnK.js +0 -1
  169. package/dist/public/assets/railroad-3IZDKUUU-CRgAnFFT.js +0 -1
  170. package/dist/public/assets/railroad-abnf-AHOZXSZD-DulrY9_U.js +0 -1
  171. package/dist/public/assets/railroad-ebnf-EBAXGLYW-D8e0kEYb.js +0 -1
  172. package/dist/public/assets/railroad-peg-LSFZ7HO6-C2iIAAkK.js +0 -1
  173. package/dist/public/assets/treeView-QDETBFTQ-DIWn4fzK.js +0 -1
  174. package/dist/public/assets/treemap-6X3UGDF4-WPqEPk4A.js +0 -1
  175. package/dist/public/assets/wardley-OPB4EBWU-CFdyGX48.js +0 -1
  176. package/dist/repair-skills-vw_jVt0o.mjs +0 -1
  177. package/dist/server-lock-DZZ64TDY.mjs +0 -1
  178. package/dist/src-DxAg43k_.mjs +0 -3264
  179. package/dist/start-yhXxcSrI.mjs +0 -1
  180. /package/dist/public/assets/{chunk-KEIR6QF5-CFEoHvxJ.js → chunk-KEIR6QF5-dYt3HMDt.js} +0 -0
  181. /package/dist/public/assets/{dist-BneDw0Gk.js → dist-Y35lJRjm.js} +0 -0
  182. /package/dist/public/assets/{panzoom.es-BH0upAOZ.js → panzoom.es-DSQCRJbU.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{O as r,j as i,ja as a,ma as o}from"./src-Cwu3lS3D.mjs";import{$n as s,$t as c,Hn as l,Mn as u,Nr as d,Tn as f,Vn as p,c as m,en as h,er as g,fn as _,in as v,l as y,nn as b,pa as x,pn as S,rr as C,tr as ee,u as te}from"./src-DxAg43k_.mjs";import{U as ne}from"./sleep-DcENuR74.mjs";import{M as w,P as T}from"./fs-traced-B-qtPUmb.mjs";import{C as re,a as ie,b as ae,d as E,f as oe,i as se,l as D,m as ce,p as le,s as ue,t as de,x as fe}from"./write-project-skill-DtERurRT.mjs";import{t as pe}from"./constants-B_riNG8U.mjs";import{t as O}from"./is-object-Bw0-z8qH.mjs";import{i as k,n as me,o as A,r as he,s as j,t as M}from"./colors-_gzKDfrv.mjs";import{t as ge}from"./preview-C1DTZkXE.mjs";import{createRequire as _e}from"node:module";import{execFileSync as ve}from"node:child_process";import N,{dirname as P,isAbsolute as ye,join as F,relative as I,resolve as be,sep as xe}from"node:path";import{existsSync as L,lstatSync as Se,mkdirSync as Ce,readFileSync as R,readlinkSync as we,realpathSync as Te,statSync as Ee,writeFileSync as De}from"node:fs";import{homedir as Oe}from"node:os";import z from"node:process";import{fileURLToPath as ke}from"node:url";import*as Ae from"node:readline";import{inspect as je,stripVTControlCharacters as Me,styleText as B}from"node:util";import{AsyncLocalStorage as Ne,AsyncResource as Pe}from"node:async_hooks";const Fe=new Set([`emacs`,`vim`]);function Ie(e){return Fe.has(e)}function Le(){let e=process.env.INQUIRER_KEYBINDINGS;return e?Array.from(new Set(e.toLowerCase().split(/[\s,]+/).filter(Ie))):[]}const V=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,Re=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,ze=e=>e.name===`space`,Be=e=>e.name===`backspace`,Ve=e=>`1234567890`.includes(e.name),He=e=>e.name===`enter`||e.name===`return`;var Ue=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},We=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},Ge=class extends Error{name=`ExitPromptError`},Ke=class extends Error{name=`HookError`},qe=class extends Error{name=`ValidationError`};const Je=new Ne;function Ye(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function Xe(e,t){let n=Ye(e);return Je.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function H(){let e=Je.getStore();if(!e)throw new Ke(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function Ze(){return H().rl}function Qe(e){return Pe.bind((...t)=>{let n=H(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function $e(e){let t=H(),{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 et(){H().handleChange()}const U={queue(e){let t=H(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(Ze());if(r!=null&&typeof r!=`function`)throw new qe(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=H();Qe(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=H();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function tt(e){return typeof e==`function`}function W(e){return $e(t=>{let n=Pe.bind(function(e){t.get()!==e&&(t.set(e),et())});if(t.initialized)return[t.get(),n];let r=tt(e)?e():e;return t.set(r),[r,n]})}function nt(e,t){$e(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&U.queue(e),n.set(t)})}function rt(){return z.platform.startsWith(`win`)?!!z.env.CI||!!z.env.WT_SESSION||!!z.env.TERMINUS_SUBLIME||z.env.ConEmuTask===`{cmd::Cmder}`||z.env.TERM_PROGRAM===`Terminus-Sublime`||z.env.TERM_PROGRAM===`vscode`||z.env.TERM===`xterm-256color`||z.env.TERM===`alacritty`||z.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:z.env.TERM!==`linux`}const it={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:`╱`},at={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:`⅒`},ot={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`},st={...it,...at},ct={...it,...ot},G=rt()?st:ct;Object.entries(at);const lt={prefix:{idle:B(`blue`,`?`),done:B(`green`,G.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>B(`yellow`,e))},keybindings:[],style:{answer:e=>B(`cyan`,e),message:e=>B(`bold`,e),error:e=>B(`red`,`> ${e}`),defaultAnswer:e=>B(`dim`,`(${e})`),help:e=>B(`dim`,e),highlight:e=>B(`cyan`,e),key:e=>B(`cyan`,B(`bold`,`<${e}>`))}};function ut(){return{...lt,keybindings:Le()}}function dt(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 ft(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=dt(n)&&dt(r)?ft(n,r):r}return t}function pt(...e){return ft(ut(),...e.filter(e=>e!=null))}function mt({status:e=`idle`,theme:t}){let[n,r]=W(!1),[i,a]=W(0),{prefix:o,spinner:s}=pt(t);return nt(()=>{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 ht(e,t){return $e(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 gt(e){return W({current:e})[0]}function _t(e){let t=gt(e);t.current=e,nt(e=>{let n=!1,r=Qe((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var vt=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 yt=(()=>{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}})(),bt=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,xt=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,St=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Ct=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,wt=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Tt=/\t{1,1000}/y,Et=/[\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,Dt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Ot=/\p{M}+/gu,kt={limit:1/0,ellipsis:``},At=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?At(i,kt,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Dt,l],[St,0],[Ct,o],[Tt,s],[Et,c],[wt,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(Ot,``)){let t=e.codePointAt(0)||0;if(S=bt(t)?2:xt(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===wt?yt(e.slice(p,n.lastIndex)):n===Et?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}},jt={limit:1/0,ellipsis:``,ellipsisWidth:0},K=(e,t={})=>At(e,jt,t).width,Mt=`]8;;`,Nt=RegExp(`(?:\\[(?<code>\\d+)m|\\${Mt}(?<uri>.*))`,`y`),Pt=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},Ft=e=>`[${e}m`,It=e=>`${Mt}${e}`,Lt=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:K(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=K(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(Mt,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())},Rt=e=>{let t=e.split(` `),n=t.length;for(;n&&!K(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},zt=(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=K(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=K(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(``),Lt(s,r,t),c=K(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Lt(s,r,t),c=K(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Lt(s,r,t),c=K(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Rt(e)));let l=s.join(`
1
+ import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{O as r,Pa as i,_a as a,j as o}from"./src-FuRMJntf.mjs";import{$n as s,$t as c,Hn as l,Mn as u,Nr as d,Tn as f,Vn as p,c as m,en as h,er as g,fn as _,in as v,l as y,nn as b,pa as x,pn as S,rr as C,tr as ee,u as te}from"./src-CaRd1QSi.mjs";import{U as ne}from"./sleep-DcENuR74.mjs";import{M as w,P as T}from"./fs-traced-vMO6kYgZ.mjs";import{C as re,a as ie,b as ae,d as E,f as oe,i as se,l as D,m as ce,p as le,s as ue,t as de,x as fe}from"./write-project-skill-CnAZrDt1.mjs";import{t as pe}from"./constants-geQohyDW.mjs";import{t as O}from"./is-object-Bw0-z8qH.mjs";import{i as k,n as me,o as A,r as he,s as j,t as M}from"./colors-_gzKDfrv.mjs";import{t as ge}from"./preview-DlS48lyQ.mjs";import{createRequire as _e}from"node:module";import{execFileSync as ve}from"node:child_process";import N,{dirname as P,isAbsolute as ye,join as F,relative as I,resolve as be,sep as xe}from"node:path";import{existsSync as L,lstatSync as Se,mkdirSync as Ce,readFileSync as R,readlinkSync as we,realpathSync as Te,statSync as Ee,writeFileSync as De}from"node:fs";import{homedir as Oe}from"node:os";import z from"node:process";import{fileURLToPath as ke}from"node:url";import*as Ae from"node:readline";import{inspect as je,stripVTControlCharacters as Me,styleText as B}from"node:util";import{AsyncLocalStorage as Ne,AsyncResource as Pe}from"node:async_hooks";const Fe=new Set([`emacs`,`vim`]);function Ie(e){return Fe.has(e)}function Le(){let e=process.env.INQUIRER_KEYBINDINGS;return e?Array.from(new Set(e.toLowerCase().split(/[\s,]+/).filter(Ie))):[]}const V=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,Re=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,ze=e=>e.name===`space`,Be=e=>e.name===`backspace`,Ve=e=>`1234567890`.includes(e.name),He=e=>e.name===`enter`||e.name===`return`;var Ue=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},We=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},Ge=class extends Error{name=`ExitPromptError`},Ke=class extends Error{name=`HookError`},qe=class extends Error{name=`ValidationError`};const Je=new Ne;function Ye(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function Xe(e,t){let n=Ye(e);return Je.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function H(){let e=Je.getStore();if(!e)throw new Ke(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function Ze(){return H().rl}function Qe(e){return Pe.bind((...t)=>{let n=H(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function $e(e){let t=H(),{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 et(){H().handleChange()}const U={queue(e){let t=H(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(Ze());if(r!=null&&typeof r!=`function`)throw new qe(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=H();Qe(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=H();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function tt(e){return typeof e==`function`}function W(e){return $e(t=>{let n=Pe.bind(function(e){t.get()!==e&&(t.set(e),et())});if(t.initialized)return[t.get(),n];let r=tt(e)?e():e;return t.set(r),[r,n]})}function nt(e,t){$e(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&U.queue(e),n.set(t)})}function rt(){return z.platform.startsWith(`win`)?!!z.env.CI||!!z.env.WT_SESSION||!!z.env.TERMINUS_SUBLIME||z.env.ConEmuTask===`{cmd::Cmder}`||z.env.TERM_PROGRAM===`Terminus-Sublime`||z.env.TERM_PROGRAM===`vscode`||z.env.TERM===`xterm-256color`||z.env.TERM===`alacritty`||z.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:z.env.TERM!==`linux`}const it={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:`╱`},at={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:`⅒`},ot={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`},st={...it,...at},ct={...it,...ot},G=rt()?st:ct;Object.entries(at);const lt={prefix:{idle:B(`blue`,`?`),done:B(`green`,G.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>B(`yellow`,e))},keybindings:[],style:{answer:e=>B(`cyan`,e),message:e=>B(`bold`,e),error:e=>B(`red`,`> ${e}`),defaultAnswer:e=>B(`dim`,`(${e})`),help:e=>B(`dim`,e),highlight:e=>B(`cyan`,e),key:e=>B(`cyan`,B(`bold`,`<${e}>`))}};function ut(){return{...lt,keybindings:Le()}}function dt(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 ft(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=dt(n)&&dt(r)?ft(n,r):r}return t}function pt(...e){return ft(ut(),...e.filter(e=>e!=null))}function mt({status:e=`idle`,theme:t}){let[n,r]=W(!1),[i,a]=W(0),{prefix:o,spinner:s}=pt(t);return nt(()=>{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 ht(e,t){return $e(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 gt(e){return W({current:e})[0]}function _t(e){let t=gt(e);t.current=e,nt(e=>{let n=!1,r=Qe((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var vt=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 yt=(()=>{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}})(),bt=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,xt=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,St=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Ct=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,wt=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Tt=/\t{1,1000}/y,Et=/[\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,Dt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Ot=/\p{M}+/gu,kt={limit:1/0,ellipsis:``},At=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?At(i,kt,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Dt,l],[St,0],[Ct,o],[Tt,s],[Et,c],[wt,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(Ot,``)){let t=e.codePointAt(0)||0;if(S=bt(t)?2:xt(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===wt?yt(e.slice(p,n.lastIndex)):n===Et?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}},jt={limit:1/0,ellipsis:``,ellipsisWidth:0},K=(e,t={})=>At(e,jt,t).width,Mt=`]8;;`,Nt=RegExp(`(?:\\[(?<code>\\d+)m|\\${Mt}(?<uri>.*))`,`y`),Pt=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},Ft=e=>`[${e}m`,It=e=>`${Mt}${e}`,Lt=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:K(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=K(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(Mt,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())},Rt=e=>{let t=e.split(` `),n=t.length;for(;n&&!K(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},zt=(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=K(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=K(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(``),Lt(s,r,t),c=K(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Lt(s,r,t),c=K(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Lt(s,r,t),c=K(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Rt(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===`›`){Nt.lastIndex=e+1;let t=Nt.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+=It(``));let e=i?Pt(i):void 0;i&&e&&(r+=Ft(e))}else t===`
4
4
  `&&(i&&Pt(i)&&(r+=Ft(i)),a&&(r+=It(a)))}return r},Bt=/\r?\n/;function Vt(e,t,n){return String(e).normalize().split(Bt).map(e=>zt(e,t,n)).join(`
@@ -12,7 +12,7 @@ import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{O as r,j as i,ja a
12
12
  `).pop()??``;var hn=class{height=0;extraLinesUnderPrompt=0;cursorPos;rl;constructor(e){this.rl=e,this.cursorPos=e.getCursorPos()}write(e){this.rl.output.unmute(),this.rl.output.write(e),this.rl.output.mute()}render(e,t=``){let n=Me(mn(e)),r=n;this.rl.line.length>0&&(r=r.slice(0,-this.rl.line.length)),this.rl.setPrompt(r),this.cursorPos=this.rl.getCursorPos();let i=Ut();e=Ht(e,i),t=Ht(t,i),n.length%i===0&&(e+=`
13
13
  `);let a=e+(t?`
14
14
  `+t:``),o=Math.floor(n.length/i)-this.cursorPos.rows+(t?pn(t):0);o>0&&(a+=cn(o)),a+=un(this.cursorPos.cols),this.write(ln(this.extraLinesUnderPrompt)+fn(this.height)+a),this.extraLinesUnderPrompt=o,this.height=pn(a)}checkCursorPos(){let e=this.rl.getCursorPos();e.cols!==this.cursorPos.cols&&(this.write(un(e.cols)),this.cursorPos=e)}done({clearContent:e}){this.rl.setPrompt(``);let t=ln(this.extraLinesUnderPrompt);t+=e?fn(this.height):`
15
- `,t+=`\x1B[G`,t+=`\x1B[?25h`,this.write(t),this.rl.close()}},gn=class extends Promise{static withResolver(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}};const _n=globalThis.setImmediate;function vn(){let e=Error.prepareStackTrace,t=[];try{Error.prepareStackTrace=(e,n)=>{let r=n.slice(1);return t=r,r},Error().stack}catch{return t}return Error.prepareStackTrace=e,t}function yn(e){let t=vn();return(n,r={})=>{let{input:i=process.stdin,signal:a}=r,o=new Set,s=new Kt.default;s.pipe(r.output??process.stdout);let c=Ae.createInterface({terminal:!0,input:i,output:s});s.mute();let l=new hn(c),{promise:u,resolve:d,reject:f}=gn.withResolver(),p=()=>f(new We);if(a){let e=()=>f(new Ue({cause:a.reason}));if(a.aborted)return e(),Object.assign(u,{cancel:p});a.addEventListener(`abort`,e),o.add(()=>a.removeEventListener(`abort`,e))}o.add(rn((e,t)=>{f(new Ge(`User force closed the prompt with ${e} ${t}`))}));let m=()=>f(new Ge(`User force closed the prompt with SIGINT`));return c.on(`SIGINT`,m),o.add(()=>c.removeListener(`SIGINT`,m)),Xe(c,a=>{let m=Pe.bind(()=>U.clearAll());c.on(`close`,m),o.add(()=>c.removeListener(`close`,m));let h=()=>{let r=()=>l.checkCursorPos();c.input.on(`keypress`,r),o.add(()=>c.input.removeListener(`keypress`,r));let i=null;a(()=>{let r=!1;try{let a=e(n,e=>{r?d(e):i={value:e}});if(a===void 0){let e=t[1]?.getFileName();throw e&&!e.startsWith(`file://`)&&(e=N.resolve(e)),Error(`Prompt functions must return a string.\n at ${e}`)}let[o,s]=typeof a==`string`?[a]:a;l.render(o,s),U.run()}catch(e){f(e)}if(r=!0,i!==null){let{value:e}=i;i=null,d(e)}})};return`readableFlowing`in i?_n(h):h(),Object.assign(u.then(e=>(U.clearAll(),e),e=>{throw U.clearAll(),e}).finally(()=>{o.forEach(e=>e()),l.done({clearContent:!!r.clearPromptOnDone}),s.end()}).then(()=>u),{cancel:p})})}}var J=class{separator=B(`dim`,Array.from({length:15}).join(G.line));type=`separator`;constructor(e){e&&(this.separator=e)}static isSeparator(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`separator`)}},bn=ne();const xn=`.ok/`,Sn=`**/.ok/*`,Cn=`!**/${a}/`;function wn(e){let t=[`.ok/`,`.okignore`];for(let n of ue){let r=D[n];r.projectConfigPath&&t.push(In(r.projectConfigPath(e),e))}t.push(`.claude/launch.json`);let n=F(e,...r);if(L(n))try{let e=i(R(n,`utf-8`));if(e){for(let[n,r]of Object.entries(e.skills))if(n!==`open-knowledge`)for(let e of r.hosts){let r=o[e];r&&t.push(`${r}/${n}/`)}}}catch{}return Array.from(new Set(t))}function Tn(e,t){let n=jn(e,t).tracked;if(n.length>0)return{kind:`refused-tracked`,tracked:n,remediation:Mn(n)};let r=Y(e);if(r.kind!==`ok`)return r.result;let i=L(r.path)?R(r.path,`utf-8`):``,a=Fn(i),o=[],s=[];for(let e of t)Pn(a,e)?s.push(e):o.push(e);if(o.length===0)return{kind:`updated`,appended:o,alreadyPresent:s,removed:[]};let c=i.length===0||i.endsWith(`
15
+ `,t+=`\x1B[G`,t+=`\x1B[?25h`,this.write(t),this.rl.close()}},gn=class extends Promise{static withResolver(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}};const _n=globalThis.setImmediate;function vn(){let e=Error.prepareStackTrace,t=[];try{Error.prepareStackTrace=(e,n)=>{let r=n.slice(1);return t=r,r},Error().stack}catch{return t}return Error.prepareStackTrace=e,t}function yn(e){let t=vn();return(n,r={})=>{let{input:i=process.stdin,signal:a}=r,o=new Set,s=new Kt.default;s.pipe(r.output??process.stdout);let c=Ae.createInterface({terminal:!0,input:i,output:s});s.mute();let l=new hn(c),{promise:u,resolve:d,reject:f}=gn.withResolver(),p=()=>f(new We);if(a){let e=()=>f(new Ue({cause:a.reason}));if(a.aborted)return e(),Object.assign(u,{cancel:p});a.addEventListener(`abort`,e),o.add(()=>a.removeEventListener(`abort`,e))}o.add(rn((e,t)=>{f(new Ge(`User force closed the prompt with ${e} ${t}`))}));let m=()=>f(new Ge(`User force closed the prompt with SIGINT`));return c.on(`SIGINT`,m),o.add(()=>c.removeListener(`SIGINT`,m)),Xe(c,a=>{let m=Pe.bind(()=>U.clearAll());c.on(`close`,m),o.add(()=>c.removeListener(`close`,m));let h=()=>{let r=()=>l.checkCursorPos();c.input.on(`keypress`,r),o.add(()=>c.input.removeListener(`keypress`,r));let i=null;a(()=>{let r=!1;try{let a=e(n,e=>{r?d(e):i={value:e}});if(a===void 0){let e=t[1]?.getFileName();throw e&&!e.startsWith(`file://`)&&(e=N.resolve(e)),Error(`Prompt functions must return a string.\n at ${e}`)}let[o,s]=typeof a==`string`?[a]:a;l.render(o,s),U.run()}catch(e){f(e)}if(r=!0,i!==null){let{value:e}=i;i=null,d(e)}})};return`readableFlowing`in i?_n(h):h(),Object.assign(u.then(e=>(U.clearAll(),e),e=>{throw U.clearAll(),e}).finally(()=>{o.forEach(e=>e()),l.done({clearContent:!!r.clearPromptOnDone}),s.end()}).then(()=>u),{cancel:p})})}}var J=class{separator=B(`dim`,Array.from({length:15}).join(G.line));type=`separator`;constructor(e){e&&(this.separator=e)}static isSeparator(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`separator`)}},bn=ne();const xn=`.ok/`,Sn=`**/.ok/*`,Cn=`!**/${i}/`;function wn(e){let t=[`.ok/`,`.okignore`];for(let n of ue){let r=D[n];r.projectConfigPath&&t.push(In(r.projectConfigPath(e),e))}t.push(`.claude/launch.json`);let n=F(e,...r);if(L(n))try{let e=o(R(n,`utf-8`));if(e){for(let[n,r]of Object.entries(e.skills))if(n!==`open-knowledge`)for(let e of r.hosts){let r=a[e];r&&t.push(`${r}/${n}/`)}}}catch{}return Array.from(new Set(t))}function Tn(e,t){let n=jn(e,t).tracked;if(n.length>0)return{kind:`refused-tracked`,tracked:n,remediation:Mn(n)};let r=Y(e);if(r.kind!==`ok`)return r.result;let i=L(r.path)?R(r.path,`utf-8`):``,a=Fn(i),o=[],s=[];for(let e of t)Pn(a,e)?s.push(e):o.push(e);if(o.length===0)return{kind:`updated`,appended:o,alreadyPresent:s,removed:[]};let c=i.length===0||i.endsWith(`
16
16
  `)?``:`
17
17
  `,l=`${o.join(`
18
18
  `)}\n`;try{De(r.path,`${i}${c}${l}`,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:o,alreadyPresent:s,removed:[]}}function En(e,t){let n=Y(e);if(n.kind!==`ok`)return n.result;if(!L(n.path))return{kind:`updated`,appended:[],alreadyPresent:[],removed:[]};let r=t.map(e=>Nn(e)),i=new Set;for(let e of r)for(let t of e)i.add(t);i.add(Sn),i.add(Cn);let a;try{a=R(n.path,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}let o=a.split(`
@@ -638,6 +638,6 @@ export default function okBridge(pi: {
638
638
  `));let f=`${a?``:``}${u}`;return f!==i&&T(e,f,{mode:Bn(e)}),{kind:l?`overwritten`:`written`}}const _i=e=>e!==`project`,vi=e=>e!==`user`;async function yi(){let e=await Yn({message:`Where should the MCP server be configured?
639
639
  `,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 bi(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??yi)():`both`}async function xi(e){return er({message:`How do you want to handle OpenKnowledge config files (.ok/, .mcp.json, project skills)?`,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 Si(e){if(e.sharing!==void 0)return e.sharing;let t=Dn(e.projectRoot)===`local-only`?`local-only`:`shared`;return e.isTTY??process.stdout.isTTY?(e.promptFn??xi)(t):t}var $=class extends Error{constructor(e){super(e),this.name=`ContentDirError`}};function Ci(e){if(e===void 0||e===!0)return new Set(l);if(e===!1)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(l.filter(e=>t.includes(e)))}function wi(e,t,n){let r=be(n,e),i;try{i=Ee(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=I(Ti(t),Ti(r));if(a.startsWith(`..`)||ye(a))throw new $(`--content-dir must be inside the project root (${t}); got ${r}`);return a===``?`.`:a}function Ti(e){try{return Te(e)}catch{return e}}const Ei=`open-knowledge-ui`;function Di(e,t,n){try{return L(e.detectPath?.(t,n)??P(e.configPath(t,n)))}catch{return!1}}function Oi(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;if(!i&&s&&!Di(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{de(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 Ai(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{Ce(P(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{w(`${o}.lock`,()=>{let t=Kr(o).writePath;if(Ce(P(t),{recursive:!0}),e.format===`toml`){let n=hi(ei(),t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}if(e.format===`yaml`){let n=gi(t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}let n=mi(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 ki={pi:Fr};function Ai(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=ki[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{Ce(P(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{w(`${t}.lock`,()=>{let e=null;try{e=R(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}T(t,c,e===null?void 0:{mode:Bn(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 ji(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!L(n)))return{editorId:e.id,label:e.label,path:n}}async function Mi(e){let t=ae(e.editors).filter(e=>e.scope===`global`),n={mode:`published`,skipAvailabilityCheck:!0};return t.map(t=>Oi(t,``,n,e.home))}function Ni(e,t,n,r){let i=Fi(e,t,n,r);return i.kind===`present`?i.entry:null}function Pi(e,t,n,r){let i=pi(e,t,r);if(!O(i))return{kind:`no-entry`};let a=i[n];return O(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function Fi(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(Ee(i).size>ci)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:Pr(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=ei().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return Pi(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,bn.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:Pi(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=ri(a);return s?ii(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:Pi(g(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}async function Ii(e={}){let t=be(e.cwd??process.cwd()),n=Rr(t,{homeDir:e.home}),r=n.projectRoot,i=!L(F(r,`.ok`)),a=n.gitRootPromoted?I(r,t):void 0,o=e.contentDir===void 0?n.defaultContentDir:wi(e.contentDir,r,t);n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&o===`.`&&process.stderr.write(`${j(`[ok] Content scope promoted to the git repo root: ${r}`)}\n Ran in ${a}/, 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: ${a} in .ok/config.yml.\n`);let s={mode:e.devMcp?`dev`:`published`},d=await te(r),g;try{g=h(r,{contentDir:o})}catch(t){let i=D.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:d.didInit,rootGitignoreCreated:!1,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,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 _=g.created.includes(pe),v=!1;if(d.didInit)try{v=b(r)===`created`}catch(e){console.warn(`[ok] Skipping .gitignore seed at ${r}: ${e instanceof Error?e.message:String(e)}`)}try{c(r)}catch(e){console.warn(`[ok] Skipping project-skill .gitignore entry at ${r}: ${e instanceof Error?e.message:String(e)}`)}let y=await m(r);y.kind===`untracked`&&console.warn(`[ok] Untracked the OpenKnowledge project skill (${y.dirs.join(`, `)}) — it is now local-only. Teammates will see this as a deletion on their next pull.`);let x=await bi({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),S=e.editors??Hi(r,e.home),C=e.editors??ue.filter(e=>D[e].projectConfigPath!==void 0||D[e].projectSkillPath!==void 0),ee=ae(S),ne=ae(C),w=e.mcp===!1||x===null,T=Array.from(new Map([...ee,...w?[]:ne].map(e=>[e.id,e])).values()),re=ee.filter(t=>Di(t,r,e.home)),E=[],oe=[],ce=new Set;for(let t of T){if(w){let n=``;try{n=t.configPath(r,e.home)}catch{}E.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(_i(x)&&ee.includes(t)&&t.scope===`global`&&E.push(Oi(t,r,s,e.home)),vi(x)&&ne.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Oi(t,r,s,e.home,n);E.push(i),(i.action===`written`||i.action===`overwritten`)&&ce.add(n)}}let le=new Set;for(let t of ne){let n=t.projectSkillPath?.(r);!n||le.has(n)||(le.add(n),oe.push(se(t,r,{home:e.home})))}let de=!w&&x!==null&&vi(x)?ne.filter(e=>!e.projectConfigPath&&!e.projectSkillPath).map(e=>e.label):void 0,fe=w?[]:re.map(e=>ji(e,r)).filter(e=>e!==void 0).filter(e=>!ce.has(e.path)),O=e.installUserSkill??f,k=e.home??Oe(),me=Ci(e.skills),A=!1,he=!1,M=!1,ge=!1;for(let t of l){let n=me.has(t);if(await u(k,p[t],n).catch(()=>{}),n){A=!0;let n=await O({home:e.home,bundleId:t,force:!0});n===`installed`?he=!0:n===`failed`?M=!0:ge=!0}else try{ie(k,t)}catch{}}let _e=M?`failed`:he?`installed`:A&&ge?`skip-current`:`declined`,ve=w?`skipped-flag`:`skipped-missing`,N=E.find(e=>e.editorId===`claude`)??E[0]??{action:ve,configPath:D.claude.configPath(r,e.home)},P=await Li({projectRoot:r,desiredMode:await Si({sharing:e.sharing,projectRoot:r,isTTY:e.isTTY,promptFn:e.sharingPromptFn}),explicitFlag:e.sharing});return{projectRoot:r,contentCreated:g.created,contentUpdated:g.updated,contentSkipped:g.skipped,editors:E,projectSkills:oe,legacyProjectConfigs:fe,skillInstall:_e,didGitInit:d.didInit,rootGitignoreCreated:v,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDir:_?o:void 0,contentDirRequested:e.contentDir,contentScaffoldFailed:!1,mcpAction:N.action,mcpPath:N.configPath,mcpError:`error`in N?N.error:void 0,projectScopeUnsupportedLabels:de,sharing:P}}async function Li(e){let{projectRoot:t,desiredMode:n,explicitFlag:r}=e,i=Dn(t);if(i===`no-git`)return{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:r===`local-only`};let a=wn(t);if(n===`local-only`){let e=Tn(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`}:Ri(t,e,`add`)}if(i===`shared`)return{kind:`applied`,mode:`shared`,action:`noop`,appended:[],alreadyPresent:[],removed:[]};let o=En(t,a);return o.kind===`no-exclude`?{kind:`no-exclude`,reason:o.reason,localOnlyRequested:!1}:Ri(t,o,`remove`)}function Ri(e,t,n){let r=Dn(e);return n===`add`?{kind:`applied`,mode:r,action:t.appended.length>0?`added`:`noop`,appended:t.appended,alreadyPresent:t.alreadyPresent,removed:[]}:{kind:`applied`,mode:r,action:`removed`,appended:[],alreadyPresent:[],removed:t.removed}}function zi(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 Bi(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=F(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(M(`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(M(`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(M(`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(M(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(M(`MCP server configuration:`));for(let r of e.editors){let e=r.configPath.startsWith(t)?I(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} ${A(`registered`)}${i}${c}`);break;case`overwritten`:n.push(` ${o}${s}${e} ${A(`updated`)}${i}${c}`);break;case`skipped-missing`:n.push(` ${o}${s}${e} config root missing; skipped`);break;case`failed`:n.push(` ${o}${s}${e} ${he(`FAILED`)}: ${r.error}`);break;case`declined`:n.push(` ${o}${s}${e} left unchanged (${zi(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(M(`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?I(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${A(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${A(`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} ${he(`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} ${I(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(M(`User-global skill:`)),e.skillInstall){case`installed`:n.push(` open-knowledge ${A(`installed to detected agent hosts`)} via \`npx skills\``);break;case`skip-current`:n.push(` open-knowledge ${A(`already installed at current version`)}`);break;case`declined`:n.push(` open-knowledge ${me(`skipped (opted out via --no-skills)`)}`);break;case`failed`:n.push(` ${j(`open-knowledge install failed — MCP still configured; run manually:`)}`),n.push(` ${j(` npx skills@~1.5.0 add <bundled-path> --agent '*' -g -y --copy`)}`);break}if(e.contentDirRequested!==void 0&&e.contentDir===void 0&&!e.contentScaffoldFailed?(n.push(``),n.push(j(`⚠ --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(j(`⚠ 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(ge(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),n.push(``),n.push(...Gi(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(`${A(`✓`)} ${M(`Next steps:`)}`),n.push(` 1. Open your editor (${k(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${k(`ok seed`)} — empty repo, Karpathy 3-layer`),n.push(` - ${k(`mcp__open-knowledge__discover`)} — existing repo, extract conventions`),n.push(` 4. Use the MCP workflow tools as you build the wiki:`),n.push(` - ${k(`mcp__open-knowledge__ingest`)} — capture an external source`),n.push(` - ${k(`mcp__open-knowledge__research`)} — gather sources and write findings`),n.push(` - ${k(`mcp__open-knowledge__consolidate`)} — promote research to canonical articles`)}return n.join(`
640
640
  `)}function Vi(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 Hi(e,t){let n=[];for(let r of ue)Di(D[r],e,t)&&n.push(r);return n}function Ui(){let e={log:console.log,info:console.info,debug:console.debug},t=(...e)=>{process.stderr.write(`${e.map(e=>typeof e==`string`?e:je(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 Wi(){return new fe(`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 re(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).addOption(new re(`--shared`,`Commit OK config alongside content (the default for fresh repos)`).conflicts(`localOnly`)).addOption(new re(`--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?Ui():null;try{let r;try{r=await Ii({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope,sharing:n,contentDir:e.contentDir,skills:e.skills})}catch(e){if(e instanceof $){process.stderr.write(`${e.message}\n`),process.exitCode=64;return}if(e instanceof _||e instanceof S){process.stderr.write(`${e.message}\n`),process.exitCode=78;return}if(e instanceof y){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.
641
- `),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-JolD1GIz.mjs`),{resolveContentDir:s}=await import(`./src-eVRfK1KK.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-CluoUHys.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(Vi(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${Bi(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function Gi(e,t){let n=[];switch(e.kind){case`applied`:return n.push(M(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?n.push(` ${A(`local-only`)} — appended ${e.appended.length} path(s) to ${M(`${t}/.git/info/exclude`)} (per-clone, not committed).`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${A(`local-only`)} — already excluded; nothing to do.`):n.push(` ${A(`local-only`)}`):e.action===`removed`?n.push(` ${A(`shared`)} — removed OK paths from ${M(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${A(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(j(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
642
- `))n.push(t.length>0?` ${t}`:``);return n.push(` Re-run ${k(`ok config-sharing unshare`)} after resolving to complete the switch.`),n;case`no-exclude`:if(e.localOnlyRequested)n.push(j(`Sharing mode: --local-only requested but no git repo found — option ignored`)),n.push(` Run ${k(`git init`)} (or open this folder via OK Desktop, which can scaffold a repo) and then ${k(`ok config-sharing unshare`)}.`);else if(e.reason===`no-git`)return[];else n.push(j(`Sharing mode unavailable: ${e.reason}.`));return n}}export{wn as A,pt as B,Yn as C,Tn as D,Vn as E,An as F,He as H,yn as I,sn as L,Dn as M,kn as N,Mn as O,En as P,_t as R,Nr as S,zn as T,W as V,di as _,Vi as a,ei as b,Bi as c,Ni as d,Ci as f,Ii as g,Si as h,Li as i,jn as j,On as k,Gi as l,wi as m,Ei as n,Fi as o,bi as p,ki as r,Hi as s,$ as t,Wi as u,Oi as v,Bn as w,Rr as x,Mi as y,mt as z};
643
- //# sourceMappingURL=init-BWhBsLIZ.mjs.map
641
+ `),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-D5j7kLJN.mjs`),{resolveContentDir:s}=await import(`./src-BNWCeu4P.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-MJbgqGrR.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(Vi(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${Bi(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function Gi(e,t){let n=[];switch(e.kind){case`applied`:return n.push(M(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?n.push(` ${A(`local-only`)} — appended ${e.appended.length} path(s) to ${M(`${t}/.git/info/exclude`)} (per-clone, not committed).`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${A(`local-only`)} — already excluded; nothing to do.`):n.push(` ${A(`local-only`)}`):e.action===`removed`?n.push(` ${A(`shared`)} — removed OK paths from ${M(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${A(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(j(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
642
+ `))n.push(t.length>0?` ${t}`:``);return n.push(` Re-run ${k(`ok config-sharing unshare`)} after resolving to complete the switch.`),n;case`no-exclude`:if(e.localOnlyRequested)n.push(j(`Sharing mode: --local-only requested but no git repo found — option ignored`)),n.push(` Run ${k(`git init`)} (or open this folder via OK Desktop, which can scaffold a repo) and then ${k(`ok config-sharing unshare`)}.`);else if(e.reason===`no-git`)return[];else n.push(j(`Sharing mode unavailable: ${e.reason}.`));return n}}export{On as A,mt as B,er as C,Vn as D,zn as E,En as F,W as H,An as I,yn as L,jn as M,Dn as N,Tn as O,kn as P,sn as R,Nr as S,Bn as T,He as U,pt as V,di as _,Vi as a,ei as b,Bi as c,Ni as d,Ci as f,Ii as g,Si as h,Li as i,wn as j,Mn as k,Gi as l,wi as m,Ei as n,Fi as o,bi as p,ki as r,Hi as s,$ as t,Wi as u,Oi as v,Yn as w,Rr as x,Mi as y,_t as z};
643
+ //# sourceMappingURL=init-BDsdA_o5.mjs.map
@@ -0,0 +1 @@
1
+ import{g as e}from"./init-BDsdA_o5.mjs";export{e as runInit};
@@ -1,2 +1,2 @@
1
- import{er as e,rr as t}from"./src-DxAg43k_.mjs";import{P as n}from"./fs-traced-B-qtPUmb.mjs";import{E as r,w as i}from"./init-BWhBsLIZ.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,rmSync as l}from"node:fs";const u={allowTrailingComma:!0,disallowComments:!1};function d(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function f(f){let p=o(f,`.claude`,`launch.json`);if(!s(p))return{kind:`not-present`};let m;try{m=c(p,`utf-8`)}catch{return{kind:`declined`}}let h=[],g=t(m,h,u)??void 0;if(h.some(e=>!d(e,m))||!g||g.type!==`object`)return{kind:`declined`};let _=e(g).configurations;if(!Array.isArray(_))return{kind:`not-present`};let v=_.findIndex(e=>a(e)&&e.name===`open-knowledge-ui`);if(v===-1)return{kind:`not-present`};if(_.length===1)return l(p,{force:!0}),{kind:`removed-file`};let{text:y,changed:b}=r(m,[`configurations`,v]);return b?(n(p,y,{mode:i(p)}),{kind:`removed`}):{kind:`not-present`}}export{f as t};
2
- //# sourceMappingURL=launch-json-removal-BsMbCWYS.mjs.map
1
+ import{er as e,rr as t}from"./src-CaRd1QSi.mjs";import{P as n}from"./fs-traced-vMO6kYgZ.mjs";import{D as r,T as i}from"./init-BDsdA_o5.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,rmSync as l}from"node:fs";const u={allowTrailingComma:!0,disallowComments:!1};function d(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function f(f){let p=o(f,`.claude`,`launch.json`);if(!s(p))return{kind:`not-present`};let m;try{m=c(p,`utf-8`)}catch{return{kind:`declined`}}let h=[],g=t(m,h,u)??void 0;if(h.some(e=>!d(e,m))||!g||g.type!==`object`)return{kind:`declined`};let _=e(g).configurations;if(!Array.isArray(_))return{kind:`not-present`};let v=_.findIndex(e=>a(e)&&e.name===`open-knowledge-ui`);if(v===-1)return{kind:`not-present`};if(_.length===1)return l(p,{force:!0}),{kind:`removed-file`};let{text:y,changed:b}=r(m,[`configurations`,v]);return b?(n(p,y,{mode:i(p)}),{kind:`removed`}):{kind:`not-present`}}export{f as t};
2
+ //# sourceMappingURL=launch-json-removal-DvHJ0pIl.mjs.map
@@ -1,4 +1,4 @@
1
- import"./src-Cwu3lS3D.mjs";import{_ as e}from"./src-DxAg43k_.mjs";import{U as t,l as n,o as r,s as i}from"./sleep-DcENuR74.mjs";import{D as a,O as o}from"./fs-traced-B-qtPUmb.mjs";import{t as s}from"./constants-B_riNG8U.mjs";import{t as c}from"./is-object-Bw0-z8qH.mjs";import{resolve as l}from"node:path";import{existsSync as u,readFileSync as d}from"node:fs";import{realpath as f}from"node:fs/promises";var p=t();async function m(e){let t=l(e);try{return await f(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 h(e,t){let n={...e};for(let r of Object.keys(t)){let i=e[r],a=t[r];c(a)&&c(i)?n[r]=h(i,a):a!==void 0&&(n[r]=a)}return n}function g(e){if(!u(e))return{value:null,path:e,source:null,doc:null};let t;try{t=d(e,`utf-8`)}catch(t){return console.warn(`[config] Failed to read ${e}: ${t instanceof Error?t.message:t}`),{value:null,path:e,source:null,doc:null}}let n=(0,p.parseDocument)(t);if(n.errors.length>0)return console.warn(`[config] Failed to parse ${e}: ${n.errors.map(e=>e.message).join(`; `)}`),{value:null,path:e,source:t,doc:null};let r=n.toJSON();return c(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function _(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),r={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=i({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function v(t){let i=t??process.cwd(),c=[],u=o(`user`,i),d=a({absPath:u}),f={};d.valid&&d.source!==void 0?(f=h(f,d.value),c.push(u)):d.valid;let p=l(i,`.ok`,s),m=g(p);if(m.value!==null){let e=r({value:m.value,file:m.path,source:m.source,doc:m.doc});if(e.length>0)throw Error(e.map(n).join(`
1
+ import"./src-FuRMJntf.mjs";import{_ as e}from"./src-CaRd1QSi.mjs";import{U as t,l as n,o as r,s as i}from"./sleep-DcENuR74.mjs";import{D as a,O as o}from"./fs-traced-vMO6kYgZ.mjs";import{t as s}from"./constants-geQohyDW.mjs";import{t as c}from"./is-object-Bw0-z8qH.mjs";import{resolve as l}from"node:path";import{existsSync as u,readFileSync as d}from"node:fs";import{realpath as f}from"node:fs/promises";var p=t();async function m(e){let t=l(e);try{return await f(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 h(e,t){let n={...e};for(let r of Object.keys(t)){let i=e[r],a=t[r];c(a)&&c(i)?n[r]=h(i,a):a!==void 0&&(n[r]=a)}return n}function g(e){if(!u(e))return{value:null,path:e,source:null,doc:null};let t;try{t=d(e,`utf-8`)}catch(t){return console.warn(`[config] Failed to read ${e}: ${t instanceof Error?t.message:t}`),{value:null,path:e,source:null,doc:null}}let n=(0,p.parseDocument)(t);if(n.errors.length>0)return console.warn(`[config] Failed to parse ${e}: ${n.errors.map(e=>e.message).join(`; `)}`),{value:null,path:e,source:t,doc:null};let r=n.toJSON();return c(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function _(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),r={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=i({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function v(t){let i=t??process.cwd(),c=[],u=o(`user`,i),d=a({absPath:u}),f={};d.valid&&d.source!==void 0?(f=h(f,d.value),c.push(u)):d.valid;let p=l(i,`.ok`,s),m=g(p);if(m.value!==null){let e=r({value:m.value,file:m.path,source:m.source,doc:m.doc});if(e.length>0)throw Error(e.map(n).join(`
2
2
 
3
3
  `));f=h(f,m.value),c.push(p)}let v=e.safeParse(f);if(!v.success){let e={code:`SCHEMA_INVALID`,issues:_(v.error.issues,m)};throw Error(n(e))}return{config:v.data,sources:c}}function y(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??v,r=new Map,i=new Map,a=m(e.startupCwd);return async o=>{let s=await m(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{v as n,y as t};
4
- //# sourceMappingURL=loader-DO3qjQDp.mjs.map
4
+ //# sourceMappingURL=loader-Cvfiqwbx.mjs.map
@@ -0,0 +1 @@
1
+ import{n as e}from"./loader-Cvfiqwbx.mjs";export{e as loadConfig};
@@ -35,5 +35,5 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
35
35
  `}){let r=e.split(/\r?\n/);for(let e=1;e<r.length;e+=1)r[e]=t+r[e];return r.join(n)}})),fS=a(((e,t)=>{t.exports=s;let{LEVEL_NAMES:n}=Q(),r=Yx(),i=cS(),a=sS(),o=Jx();function s(e){let t=e.crlf?`\r
36
36
  `:`
37
37
  `,{customPrettifiers:s,errorLikeObjectKeys:c,hideObject:l,levelFirst:u,levelKey:d,levelLabel:f,messageFormat:p,messageKey:m,minimumLevel:h,singleLine:g,timestampKey:_,translateTime:v}=e,y=e.errorProps.split(`,`),b=typeof e.useOnlyCustomProps==`boolean`?e.useOnlyCustomProps:e.useOnlyCustomProps===`true`,x=i(e.customLevels),S=a(e.customLevels),C=o(b,x,S),w;if(e.customColors)if(typeof e.customColors==`string`)w=e.customColors.split(`,`).reduce((t,r)=>{let[i,a]=r.split(`:`),o=(b?e.customLevels:S[i]!==void 0)?S[i]:n[i],s=o===void 0?i:o;return t.push([s,a]),t},[]);else if(typeof e.customColors==`object`)w=Object.keys(e.customColors).reduce((t,r)=>{let[i,a]=[r,e.customColors[r]],o=(b?e.customLevels:S[i]!==void 0)?S[i]:n[i],s=o===void 0?i:o;return t.push([s,a]),t},[]);else throw Error(`options.customColors must be of type string or object.`);let T={customLevels:x,customLevelNames:S};b===!0&&!e.customLevels&&(T.customLevels=void 0,T.customLevelNames=void 0);let E=e.include===void 0?void 0:new Set(e.include.split(`,`)),D=!E&&e.ignore?new Set(e.ignore.split(`,`)):void 0,O=r(e.colorize,w,b),k=e.colorizeObjects?O:r(!1,[],!1);return{EOL:t,IDENT:` `,colorizer:O,customColors:w,customLevelNames:S,customLevels:x,customPrettifiers:s,customProperties:T,errorLikeObjectKeys:c,errorProps:y,getLevelLabelData:C,hideObject:l,ignoreKeys:D,includeKeys:E,levelFirst:u,levelKey:d,levelLabel:f,messageFormat:p,messageKey:m,minimumLevel:h,objectColorizer:k,singleLine:g,timestampKey:_,translateTime:v,useOnlyCustomProps:b}}})),pS=a(((e,t)=>{t.exports=s,s.default=s,s.stable=d,s.stableStringify=d;var n=`[...]`,r=`[Circular]`,i=[],a=[];function o(){return{depthLimit:2**53-1,edgesLimit:2**53-1}}function s(e,t,n,r){r===void 0&&(r=o()),l(e,``,0,[],void 0,0,r);var s;try{s=a.length===0?JSON.stringify(e,t,n):JSON.stringify(e,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var c=i.pop();c.length===4?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return s}function c(e,t,n,r){var o=Object.getOwnPropertyDescriptor(r,n);o.get===void 0?(r[n]=e,i.push([r,n,t])):o.configurable?(Object.defineProperty(r,n,{value:e}),i.push([r,n,t,o])):a.push([t,n,e])}function l(e,t,i,a,o,s,u){s+=1;var d;if(typeof e==`object`&&e){for(d=0;d<a.length;d++)if(a[d]===e){c(r,e,t,o);return}if(u.depthLimit!==void 0&&s>u.depthLimit){c(n,e,t,o);return}if(u.edgesLimit!==void 0&&i+1>u.edgesLimit){c(n,e,t,o);return}if(a.push(e),Array.isArray(e))for(d=0;d<e.length;d++)l(e[d],d,d,a,e,s,u);else{var f=Object.keys(e);for(d=0;d<f.length;d++){var p=f[d];l(e[p],p,d,a,e,s,u)}}a.pop()}}function u(e,t){return e<t?-1:+(e>t)}function d(e,t,n,r){r===void 0&&(r=o());var s=f(e,``,0,[],void 0,0,r)||e,c;try{c=a.length===0?JSON.stringify(s,t,n):JSON.stringify(s,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var l=i.pop();l.length===4?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return c}function f(e,t,a,o,s,l,d){l+=1;var p;if(typeof e==`object`&&e){for(p=0;p<o.length;p++)if(o[p]===e){c(r,e,t,s);return}try{if(typeof e.toJSON==`function`)return}catch{return}if(d.depthLimit!==void 0&&l>d.depthLimit){c(n,e,t,s);return}if(d.edgesLimit!==void 0&&a+1>d.edgesLimit){c(n,e,t,s);return}if(o.push(e),Array.isArray(e))for(p=0;p<e.length;p++)f(e[p],p,p,o,e,l,d);else{var m={},h=Object.keys(e).sort(u);for(p=0;p<h.length;p++){var g=h[p];f(e[g],g,p,o,e,l,d),m[g]=e[g]}if(s!==void 0)i.push([s,t,e]),s[t]=m;else return m}o.pop()}}function p(e){return e=e===void 0?function(e,t){return t}:e,function(t,n){if(a.length>0)for(var r=0;r<a.length;r++){var i=a[r];if(i[1]===t&&i[0]===n){n=i[2],a.splice(r,1);break}}return e.call(this,t,n)}}})),mS=a(((e,t)=>{t.exports=r;let n=dS();function r({keyName:e,lines:t,eol:r,ident:i}){let a=``,o=`${i}${e}: ${n({input:t,ident:i,eol:r})}${r}`.split(r);for(let e=0;e<o.length;e+=1){e!==0&&(a+=r);let t=o[e];if(/^\s*"stack"/.test(t)){let e=/^(\s*"stack":)\s*(".*"),?$/.exec(t);if(e&&e.length===3){let n=/^\s*/.exec(t)[0].length+4,i=` `.repeat(n),o=e[2];a+=e[1]+r+i+JSON.parse(o).replace(/\n/g,r+i)}else a+=t}else a+=t}return a}})),hS=a(((e,t)=>{t.exports=o;let{LOGGER_KEYS:n}=Q(),r=pS(),i=dS(),a=mS();function o({log:e,excludeLoggerKeys:t=!0,skipKeys:o=[],context:s}){let{EOL:c,IDENT:l,customPrettifiers:u,errorLikeObjectKeys:d,objectColorizer:f,singleLine:p,colorizer:m}=s,h=[].concat(o);t===!0&&Array.prototype.push.apply(h,n);let g=``,{plain:_,errors:v}=Object.entries(e).reduce(({plain:t,errors:n},[r,i])=>{if(h.includes(r)===!1){let a=typeof u[r]==`function`?u[r](i,r,e,{colors:m.colors}):i;d.includes(r)?n[r]=a:t[r]=a}return{plain:t,errors:n}},{plain:{},errors:{}});return p?(Object.keys(_).length>0&&(g+=f.greyMessage(r(_))),g+=c,g=g.replace(/\\\\/gi,`\\`)):Object.entries(_).forEach(([e,t])=>{let n=typeof u[e]==`function`?t:r(t,null,2);if(n===void 0)return;n=n.replace(/\\\\/gi,`\\`);let a=i({input:n,ident:l,eol:c});g+=`${l}${f.property(e)}:${a.startsWith(c)?``:` `}${a}${c}`}),Object.entries(v).forEach(([e,t])=>{let n=typeof u[e]==`function`?t:r(t,null,2);n!==void 0&&(g+=a({keyName:e,lines:n,eol:c,ident:l}))}),g}})),gS=a(((e,t)=>{t.exports=o;let{LOGGER_KEYS:n}=Q(),r=uS(),i=dS(),a=hS();function o({log:e,context:t}){let{EOL:o,IDENT:s,errorProps:c,messageKey:l}=t,u=e.stack,d=`${s}${i({input:u,ident:s,eol:o})}${o}`;if(c.length>0){let i=n.concat(l,`type`,`stack`),u;u=c[0]===`*`?Object.keys(e).filter(e=>i.includes(e)===!1):c.filter(e=>i.includes(e)===!1);for(let n=0;n<u.length;n+=1){let i=u[n];if(i in e){if(r(e[i])){let n=a({log:e[i],excludeLoggerKeys:!1,context:{...t,IDENT:s+s}});d=`${d}${s}${i}: {${o}${n}${s}}${o}`;continue}d=`${d}${s}${i}: ${e[i]}${o}`}}}return d}})),_S=a(((e,t)=>{t.exports=r;let n=tS();function r({log:e,context:t}){let{colorizer:r,customLevels:i,customLevelNames:a,levelKey:o,getLevelLabelData:s}=t,c=t.customPrettifiers?.level,l=n(e,o);if(l===void 0)return;let u=r(l,{customLevels:i,customLevelNames:a});if(c){let[t]=s(l);return c(l,o,e,{label:t,labelColorized:u,colors:r.colors})}return u}})),vS=a(((e,t)=>{t.exports=a;let{LEVELS:n}=Q(),r=tS(),i=lS();function a({log:e,context:t}){let{colorizer:a,customLevels:o,levelKey:s,levelLabel:c,messageFormat:l,messageKey:u,useOnlyCustomProps:d}=t;if(l&&typeof l==`string`){let t=i(l,e),u=String(t).replace(/{([^{}]+)}/g,function(t,i){let a;if(i===c&&(a=r(e,s))!==void 0)return(d?o===void 0:o[a]===void 0)?n[a]:o[a];let l=r(e,i);return l===void 0?``:l});return a.message(u)}if(l&&typeof l==`function`){let t=l(e,u,c,{colors:a.colors});return a.message(t)}if(u in e&&!(typeof e[u]!=`string`&&typeof e[u]!=`number`&&typeof e[u]!=`boolean`))return a.message(e[u])}})),yS=a(((e,t)=>{t.exports=n;function n({log:e,context:t}){let{customPrettifiers:n,colorizer:r}=t,i=``;if(e.name||e.pid||e.hostname){if(i+=`(`,e.name&&(i+=n.name?n.name(e.name,`name`,e,{colors:r.colors}):e.name),e.pid){let t=n.pid?n.pid(e.pid,`pid`,e,{colors:r.colors}):e.pid;e.name&&e.pid?i+=`/`+t:i+=t}if(e.hostname){let t=n.hostname?n.hostname(e.hostname,`hostname`,e,{colors:r.colors}):e.hostname;i+=`${i===`(`?`on`:` on`} ${t}`}i+=`)`}if(e.caller){let t=n.caller?n.caller(e.caller,`caller`,e,{colors:r.colors}):e.caller;i+=`${i===``?``:` `}<${t}>`}if(i!==``)return i}})),bS=a(((e,t)=>{t.exports=r;let n=oS();function r({log:e,context:t}){let{timestampKey:r,translateTime:i}=t,a=t.customPrettifiers?.time,o=null;if(r in e?o=e[r]:`timestamp`in e&&(o=e.timestamp),o===null)return;let s=i?n(o,i):o;return a?a(s):`[${s}]`}})),xS=a(((e,t)=>{t.exports={buildSafeSonicBoom:Zx(),createDate:$x(),deleteLogProperty:nS(),filterLog:iS(),formatTime:oS(),getPropertyValue:tS(),handleCustomLevelsNamesOpts:sS(),handleCustomLevelsOpts:cS(),interpretConditionals:lS(),isObject:uS(),isValidDate:Qx(),joinLinesWithIndentation:dS(),noop:Xx(),parseFactoryOptions:fS(),prettifyErrorLog:gS(),prettifyError:mS(),prettifyLevel:_S(),prettifyMessage:vS(),prettifyMetadata:yS(),prettifyObject:hS(),prettifyTime:bS(),splitPropertyKey:eS(),getLevelLabelData:Jx()}})),SS=a(((e,t)=>{let n=typeof Buffer<`u`,r=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,i=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function a(e,t,a){a==null&&typeof t==`object`&&t&&(a=t,t=void 0),n&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));let s=JSON.parse(e,t);if(typeof s!=`object`||!s)return s;let c=a&&a.protoAction||`error`,l=a&&a.constructorAction||`error`;if(c===`ignore`&&l===`ignore`)return s;if(c!==`ignore`&&l!==`ignore`){if(r.test(e)===!1&&i.test(e)===!1)return s}else if(c!==`ignore`&&l===`ignore`){if(r.test(e)===!1)return s}else if(i.test(e)===!1)return s;return o(s,{protoAction:c,constructorAction:l,safe:a&&a.safe})}function o(e,{protoAction:t=`error`,constructorAction:n=`error`,safe:r}={}){let i=[e];for(;i.length;){let e=i;i=[];for(let a of e){if(t!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`__proto__`)){if(r===!0)return null;if(t===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.__proto__}if(n!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`constructor`)&&a.constructor!==null&&typeof a.constructor==`object`&&Object.prototype.hasOwnProperty.call(a.constructor,`prototype`)){if(r===!0)return null;if(n===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.constructor}for(let e in a){let t=a[e];t&&typeof t==`object`&&i.push(t)}}}return e}function s(e,t,n){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return a(e,t,n)}finally{Error.stackTraceLimit=r}}function c(e,t){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return a(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}}t.exports=s,t.exports.default=s,t.exports.parse=s,t.exports.safeParse=c,t.exports.scan=o})),CS=a(((e,t)=>{t.exports=h;let n=SS(),r=uS(),i=gS(),a=_S(),o=vS(),s=yS(),c=hS(),l=bS(),u=iS(),{LEVELS:d,LEVEL_KEY:f,LEVEL_NAMES:p}=Q(),m=e=>{try{return{value:n.parse(e,{protoAction:`remove`})}}catch(e){return{err:e}}};function h(e){let t;if(r(e))t=e;else{let n=m(e);if(n.err||!r(n.value))return e+this.EOL;t=n.value}if(this.minimumLevel){let e;e=this.useOnlyCustomProps?this.customLevels:this.customLevelNames[this.minimumLevel]!==void 0;let n;if(n=e?this.customLevelNames[this.minimumLevel]:p[this.minimumLevel],n||=typeof this.minimumLevel==`string`?p[this.minimumLevel]:p[d[this.minimumLevel].toLowerCase()],t[this.levelKey===void 0?f:this.levelKey]<n)return}let n=o({log:t,context:this.context});(this.ignoreKeys||this.includeKeys)&&(t=u({log:t,context:this.context}));let h=a({log:t,context:{...this.context,...this.context.customProperties}}),g=s({log:t,context:this.context}),_=l({log:t,context:this.context}),v=``;if(this.levelFirst&&h&&(v=`${h}`),_&&v===``?v=`${_}`:_&&(v=`${v} ${_}`),!this.levelFirst&&h&&(v=v.length>0?`${v} ${h}`:h),g&&(v=v.length>0?`${v} ${g}:`:g),v.endsWith(`:`)===!1&&v!==``&&(v+=`:`),n!==void 0&&(v=v.length>0?`${v} ${n}`:n),v.length>0&&!this.singleLine&&(v+=this.EOL),t.type===`Error`&&typeof t.stack==`string`){let e=i({log:t,context:this.context});this.singleLine&&(v+=this.EOL),v+=e}else if(this.hideObject===!1){let e=[this.messageKey,this.levelKey,this.timestampKey].map(e=>e.replaceAll(/\\/g,``)).filter(e=>typeof t[e]==`string`||typeof t[e]==`number`||typeof t[e]==`boolean`),n=c({log:t,skipKeys:e,context:this.context});this.singleLine&&!/^\s$/.test(n)&&(v+=` `),v+=n}return v}})),wS=a(((e,n)=>{let{isColorSupported:r}=Vx(),i=Gx(),{Transform:a}=t(`node:stream`),o=qx(),s=Yx(),{ERROR_LIKE_KEYS:c,LEVEL_KEY:l,LEVEL_LABEL:u,MESSAGE_KEY:d,TIMESTAMP_KEY:f}=Q(),{buildSafeSonicBoom:p,parseFactoryOptions:m}=xS(),h=CS(),g={colorize:r,colorizeObjects:!0,crlf:!1,customColors:null,customLevels:null,customPrettifiers:{},errorLikeObjectKeys:c,errorProps:``,hideObject:!1,ignore:`hostname`,include:void 0,levelFirst:!1,levelKey:l,levelLabel:u,messageFormat:null,messageKey:d,minimumLevel:void 0,outputStream:process.stdout,singleLine:!1,timestampKey:f,translateTime:!0,useOnlyCustomProps:!0};function _(e){let t=m(Object.assign({},g,e));return h.bind({...t,context:t})}function v(e={}){let t=_(e),n;return o(function(r){r.on(`message`,function n(i){!i||i.code!==`PINO_CONFIG`||(Object.assign(e,{messageKey:i.config.messageKey,errorLikeObjectKeys:Array.from(new Set([...e.errorLikeObjectKeys||c,i.config.errorKey])),customLevels:i.config.levels.values}),t=_(e),r.off(`message`,n))});let o=new a({objectMode:!0,autoDestroy:!0,transform(e,n,r){r(null,t(e))}});return n=typeof e.destination==`object`&&typeof e.destination.write==`function`?e.destination:p({dest:e.destination||1,append:e.append,mkdir:e.mkdir,sync:e.sync}),r.on(`unknown`,function(e){n.write(e+`
38
- `)}),i(r,o,n),o},{parse:`lines`,close(e,t){n.on(`close`,()=>{t(e)})}})}n.exports=v,n.exports.build=v,n.exports.PinoPretty=v,n.exports.prettyFactory=_,n.exports.colorizerFactory=s,n.exports.isColorSupported=r,n.exports.default=v}));o();var $=r(Bx(),1),TS=r(wS(),1),ES=Fv(),DS=dx(),OS=class{#e;#t;#n;#r=Promise.resolve();#i=!1;constructor(e){this.#e=e.currentPath,this.#t=e.previousPath,this.#n=e.maxBytes}append(e){let t=this.#r.catch(()=>void 0).then(()=>this.#a(e));return this.#r=t,t}async drain(){await this.#r.catch(()=>void 0)}async#a(e){this.#i||=(await p(u(this.#e),{recursive:!0}),!0),await h(this.#e,e,{flag:`a`});let t;try{t=f(this.#e).size}catch{this.#i=!1;return}t>this.#n&&await m(this.#e,this.#t)}};const kS=[`.ok`,`local`,`telemetry`];function AS(e){return d(e,...kS,`spans-current.jsonl`)}function jS(e){return d(e,...kS,`spans-prev.jsonl`)}var MS=class{#e;#t=!1;constructor(e){this.#e=new OS({currentPath:AS(e.projectDir),previousPath:jS(e.projectDir),maxBytes:e.maxBytes})}export(e,t){if(this.#t){t({code:ES.ExportResultCode.FAILED,error:Error(`FileSpanExporter: export called after shutdown`)});return}if(e.length===0){t({code:ES.ExportResultCode.SUCCESS});return}let n=DS.JsonTraceSerializer.serializeRequest(e);if(!n||n.byteLength===0){t({code:ES.ExportResultCode.SUCCESS});return}let r=new Uint8Array(n.byteLength+1);r.set(n),r[n.byteLength]=10,this.#e.append(r).then(()=>t({code:ES.ExportResultCode.SUCCESS}),e=>t({code:ES.ExportResultCode.FAILED,error:e instanceof Error?e:Error(String(e))}))}async shutdown(){this.#t=!0,await this.#e.drain()}async forceFlush(){await this.#e.drain()}};const NS=new Set([`.`,`/`,`_`]);function PS(e,t){if(t.has(e))return!0;for(let n of t){if(n.length===0||e.length<=n.length||!e.endsWith(n))continue;let t=e.charAt(e.length-n.length-1);if(NS.has(t))return!0}return!1}function FS(e,t,n){for(let r of Object.keys(e)){let i=e[r];if(i!==void 0){if(PS(r.toLowerCase(),t)){e[r]=`[REDACTED]`;continue}if(typeof i==`string`){let t=Buffer.byteLength(i,`utf-8`);t>n&&(e[r]=`[TRUNCATED:${t}]`)}}}}var IS=class{#e;#t;constructor(e){this.#e=new Set(e.attributeDenylist.map(e=>e.toLowerCase())),this.#t=e.maxValueBytes??4096}onStart(e,t){}onEnd(e){FS(e.attributes,this.#e,this.#t);for(let t of e.events)t.attributes!==void 0&&FS(t.attributes,this.#e,this.#t);for(let t of e.links)t.attributes!==void 0&&FS(t.attributes,this.#e,this.#t)}async forceFlush(){}async shutdown(){}};const LS=[`.ok`,`local`,`logs`];function RS(e){return d(e,...LS,`server-current.jsonl`)}function zS(e){return d(e,...LS,`server-prev.jsonl`)}var BS=class extends g{#e;constructor(e){super({decodeStrings:!1}),this.#e=new OS({currentPath:RS(e.projectDir),previousPath:zS(e.projectDir),maxBytes:e.maxBytes})}_write(e,t,n){this.#e.append(e).then(()=>n(),e=>n(e instanceof Error?e:Error(String(e))))}async drain(){await this.#e.drain()}};function VS(){let e=s.getSpan(c.active());if(!e)return{};let t=e.spanContext();return{trace_id:t.traceId,span_id:t.spanId,trace_flags:t.traceFlags}}function HS(){return process.env.NO_COLOR&&process.env.NO_COLOR!==``?!1:process.stdout.isTTY??!1}const US=new Set([`fatal`,`error`,`warn`,`info`,`debug`,`trace`,`silent`]);function WS(e){return e===`silent`?1/0:$.default.levels.values[e]??$.default.levels.values.info}function GS(e,t){return WS(e)<=WS(t)?e:t}var KS=class{name;transportConfigs=[];fileSinkOpts;redactPaths;activeFileSink;pinoInstance;options;constructor(e,t={}){this.name=e,this.options={name:this.name,level:process.env.LOG_LEVEL||(process.env.NODE_ENV===`test`?`silent`:`info`),serializers:{err:$.default.stdSerializers.err,error:$.default.stdSerializers.err},mixin:VS,...t.options},t.transportConfigs&&(this.transportConfigs=t.transportConfigs),t.fileSink&&(this.fileSinkOpts=t.fileSink),t.redactPaths&&t.redactPaths.length>0&&(this.redactPaths=t.redactPaths,this.options={...this.options,redact:{paths:[...t.redactPaths],censor:`[REDACTED]`}}),this.pinoInstance=this.buildInstance()}resolveStreamLevels(){let e=this.options.level??`info`,t=process.env.OK_FILE_LEVEL?.toLowerCase(),n=t&&US.has(t)?t:e===`silent`?`silent`:GS(e,`debug`),r=process.env.OK_CONSOLE_LEVEL?.toLowerCase(),i=r&&US.has(r)?r:e;return{fileLevel:n,consoleLevel:i,instanceLevel:GS(n,i)}}buildInstance(){this.activeFileSink=void 0;let{fileLevel:e,consoleLevel:t,instanceLevel:n}=this.resolveStreamLevels();if(this.transportConfigs.length>0)return(0,$.default)(this.options,$.default.transport({targets:this.transportConfigs}));let r;try{r=(0,TS.default)({colorize:HS(),translateTime:`HH:MM:ss`,ignore:`pid,hostname`})}catch(r){if(console.warn(`[PinoLogger] pino-pretty failed, falling back to JSON:`,r),this.fileSinkOpts){let t=new BS(this.fileSinkOpts);return this.activeFileSink=t,(0,$.default)({...this.options,level:n},$.default.multistream([{stream:t,level:e}]))}return(0,$.default)({...this.options,level:t})}if(this.fileSinkOpts){let i=new BS(this.fileSinkOpts);return this.activeFileSink=i,(0,$.default)({...this.options,level:n},$.default.multistream([{stream:r,level:t},{stream:i,level:e}]))}return(0,$.default)({...this.options,level:t},r)}recreateInstance(){typeof this.pinoInstance.flush==`function`&&this.pinoInstance.flush(),this.pinoInstance=this.buildInstance()}addTransport(e){this.transportConfigs.push(e),this.recreateInstance()}removeTransport(e){e>=0&&e<this.transportConfigs.length&&(this.transportConfigs.splice(e,1),this.recreateInstance())}getTransports(){return[...this.transportConfigs]}updateOptions(e){this.options={...this.options,...e},this.recreateInstance()}reconfigure(e){e.options&&(this.options={...this.options,...e.options}),e.transportConfigs&&(this.transportConfigs=e.transportConfigs),e.fileSink&&(this.fileSinkOpts=e.fileSink),e.redactPaths&&e.redactPaths.length>0&&(this.redactPaths=e.redactPaths,this.options={...this.options,redact:{paths:[...e.redactPaths],censor:`[REDACTED]`}}),this.recreateInstance()}getPinoInstance(){return this.pinoInstance}async flushFileSink(){this.activeFileSink&&await this.activeFileSink.drain()}error(e,t){this.pinoInstance.error(e,t)}warn(e,t){this.pinoInstance.warn(e,t)}info(e,t){this.pinoInstance.info(e,t)}debug(e,t){this.pinoInstance.debug(e,t)}};const qS=new class{config={};loggers=new Map;configure(e){if(this.config=e,e.pinoConfig&&!e.defaultLogger&&!e.loggerFactory){for(let t of this.loggers.values())t.reconfigure(e.pinoConfig);return}this.loggers.clear()}getLogger(e){let t=this.loggers.get(e);if(t)return t;let n;return n=this.config.loggerFactory?this.config.loggerFactory(e):this.config.defaultLogger?this.config.defaultLogger:new KS(e,this.config.pinoConfig),this.loggers.set(e,n),n}reset(){this.config={},this.loggers.clear()}async flushAllFileSinks(){let e=[];for(let t of this.loggers.values())e.push(t.flushFileSink());await Promise.all(e)}};function JS(e){return qS.getLogger(e)}function YS(e=`test`){return new KS(e,{options:{level:`silent`}})}function XS(){qS.configure({pinoConfig:{options:{level:`silent`}}})}export{Pg as C,d_ as D,u_ as E,uh as S,c_ as T,Fv as _,qS as a,Zm as b,IS as c,AS as d,jS as f,X as g,Eb as h,XS as i,RS as l,dx as m,YS as n,MS as o,Bx as p,JS as r,OS as s,KS as t,zS as u,pv as v,Ig as w,lh as x,mv as y};
39
- //# sourceMappingURL=logger-CuGHGn_E.mjs.map
38
+ `)}),i(r,o,n),o},{parse:`lines`,close(e,t){n.on(`close`,()=>{t(e)})}})}n.exports=v,n.exports.build=v,n.exports.PinoPretty=v,n.exports.prettyFactory=_,n.exports.colorizerFactory=s,n.exports.isColorSupported=r,n.exports.default=v}));o();var $=r(Bx(),1),TS=r(wS(),1),ES=Fv(),DS=dx();const OS=new Map;function kS(e){let t=OS.get(e);return t||(t={chain:Promise.resolve(),parentDirEnsured:!1},OS.set(e,t)),t}var AS=class{#e;#t;#n;#r;constructor(e){this.#e=e.currentPath,this.#t=e.previousPath,this.#n=e.maxBytes,this.#r=kS(e.currentPath)}append(e){let t=this.#r.chain.catch(()=>void 0).then(()=>this.#i(e));return this.#r.chain=t,t}async drain(){await this.#r.chain.catch(()=>void 0)}async#i(e){this.#r.parentDirEnsured||(await p(u(this.#e),{recursive:!0}),this.#r.parentDirEnsured=!0),await h(this.#e,e,{flag:`a`});let t;try{t=f(this.#e).size}catch{this.#r.parentDirEnsured=!1;return}if(t>this.#n)try{await m(this.#e,this.#t)}catch(e){if(e?.code!==`ENOENT`)throw e}}};const jS=[`.ok`,`local`,`telemetry`];function MS(e){return d(e,...jS,`spans-current.jsonl`)}function NS(e){return d(e,...jS,`spans-prev.jsonl`)}var PS=class{#e;#t=!1;constructor(e){this.#e=new AS({currentPath:MS(e.projectDir),previousPath:NS(e.projectDir),maxBytes:e.maxBytes})}export(e,t){if(this.#t){t({code:ES.ExportResultCode.FAILED,error:Error(`FileSpanExporter: export called after shutdown`)});return}if(e.length===0){t({code:ES.ExportResultCode.SUCCESS});return}let n=DS.JsonTraceSerializer.serializeRequest(e);if(!n||n.byteLength===0){t({code:ES.ExportResultCode.SUCCESS});return}let r=new Uint8Array(n.byteLength+1);r.set(n),r[n.byteLength]=10,this.#e.append(r).then(()=>t({code:ES.ExportResultCode.SUCCESS}),e=>t({code:ES.ExportResultCode.FAILED,error:e instanceof Error?e:Error(String(e))}))}async shutdown(){this.#t=!0,await this.#e.drain()}async forceFlush(){await this.#e.drain()}};const FS=new Set([`.`,`/`,`_`]);function IS(e,t){if(t.has(e))return!0;for(let n of t){if(n.length===0||e.length<=n.length||!e.endsWith(n))continue;let t=e.charAt(e.length-n.length-1);if(FS.has(t))return!0}return!1}function LS(e,t,n){for(let r of Object.keys(e)){let i=e[r];if(i!==void 0){if(IS(r.toLowerCase(),t)){e[r]=`[REDACTED]`;continue}if(typeof i==`string`){let t=Buffer.byteLength(i,`utf-8`);t>n&&(e[r]=`[TRUNCATED:${t}]`)}}}}var RS=class{#e;#t;constructor(e){this.#e=new Set(e.attributeDenylist.map(e=>e.toLowerCase())),this.#t=e.maxValueBytes??4096}onStart(e,t){}onEnd(e){LS(e.attributes,this.#e,this.#t);for(let t of e.events)t.attributes!==void 0&&LS(t.attributes,this.#e,this.#t);for(let t of e.links)t.attributes!==void 0&&LS(t.attributes,this.#e,this.#t)}async forceFlush(){}async shutdown(){}};const zS=[`.ok`,`local`,`logs`];function BS(e){return d(e,...zS,`server-current.jsonl`)}function VS(e){return d(e,...zS,`server-prev.jsonl`)}var HS=class extends g{#e;#t=0;#n=0;constructor(e){super({decodeStrings:!1}),this.#e=new AS({currentPath:BS(e.projectDir),previousPath:VS(e.projectDir),maxBytes:e.maxBytes})}_write(e,t,n){this.#e.append(e).then(()=>n(),e=>{this.#r(e),n()})}#r(e){let t=Date.now();if(t-this.#t<5e3){this.#n++;return}this.#i(e instanceof Error?e.message:String(e),t)}#i(e,t){let n=this.#n;this.#n=0,this.#t=t,console.error(JSON.stringify({event:`pino-file-sink-write-dropped`,error:e,suppressed:n}))}async drain(){await this.#e.drain(),this.#n>0&&this.#i(`flushed at drain`,Date.now())}};function US(){let e=s.getSpan(c.active());if(!e)return{};let t=e.spanContext();return{trace_id:t.traceId,span_id:t.spanId,trace_flags:t.traceFlags}}function WS(){return process.env.NO_COLOR&&process.env.NO_COLOR!==``?!1:process.stdout.isTTY??!1}const GS=new Set([`fatal`,`error`,`warn`,`info`,`debug`,`trace`,`silent`]);function KS(e){return e===`silent`?1/0:$.default.levels.values[e]??$.default.levels.values.info}function qS(e,t){return KS(e)<=KS(t)?e:t}var JS=class{name;transportConfigs=[];fileSinkOpts;redactPaths;activeFileSink;pinoInstance;options;constructor(e,t={}){this.name=e,this.options={name:this.name,level:process.env.LOG_LEVEL||(process.env.NODE_ENV===`test`?`silent`:`info`),serializers:{err:$.default.stdSerializers.err,error:$.default.stdSerializers.err},mixin:US,...t.options},t.transportConfigs&&(this.transportConfigs=t.transportConfigs),t.fileSink&&(this.fileSinkOpts=t.fileSink),t.redactPaths&&t.redactPaths.length>0&&(this.redactPaths=t.redactPaths,this.options={...this.options,redact:{paths:[...t.redactPaths],censor:`[REDACTED]`}}),this.pinoInstance=this.buildInstance()}resolveStreamLevels(){let e=this.options.level??`info`,t=process.env.OK_FILE_LEVEL?.toLowerCase(),n=t&&GS.has(t)?t:e===`silent`?`silent`:qS(e,`debug`),r=process.env.OK_CONSOLE_LEVEL?.toLowerCase(),i=r&&GS.has(r)?r:e;return{fileLevel:n,consoleLevel:i,instanceLevel:qS(n,i)}}buildInstance(){this.activeFileSink=void 0;let{fileLevel:e,consoleLevel:t,instanceLevel:n}=this.resolveStreamLevels();if(this.transportConfigs.length>0)return(0,$.default)(this.options,$.default.transport({targets:this.transportConfigs}));let r;try{r=(0,TS.default)({colorize:WS(),translateTime:`HH:MM:ss`,ignore:`pid,hostname`})}catch(r){if(console.warn(`[PinoLogger] pino-pretty failed, falling back to JSON:`,r),this.fileSinkOpts){let t=new HS(this.fileSinkOpts);return this.activeFileSink=t,(0,$.default)({...this.options,level:n},$.default.multistream([{stream:t,level:e}]))}return(0,$.default)({...this.options,level:t})}if(this.fileSinkOpts){let i=new HS(this.fileSinkOpts);return this.activeFileSink=i,(0,$.default)({...this.options,level:n},$.default.multistream([{stream:r,level:t},{stream:i,level:e}]))}return(0,$.default)({...this.options,level:t},r)}recreateInstance(){typeof this.pinoInstance.flush==`function`&&this.pinoInstance.flush(),this.pinoInstance=this.buildInstance()}addTransport(e){this.transportConfigs.push(e),this.recreateInstance()}removeTransport(e){e>=0&&e<this.transportConfigs.length&&(this.transportConfigs.splice(e,1),this.recreateInstance())}getTransports(){return[...this.transportConfigs]}updateOptions(e){this.options={...this.options,...e},this.recreateInstance()}reconfigure(e){e.options&&(this.options={...this.options,...e.options}),e.transportConfigs&&(this.transportConfigs=e.transportConfigs),e.fileSink&&(this.fileSinkOpts=e.fileSink),e.redactPaths&&e.redactPaths.length>0&&(this.redactPaths=e.redactPaths,this.options={...this.options,redact:{paths:[...e.redactPaths],censor:`[REDACTED]`}}),this.recreateInstance()}getPinoInstance(){return this.pinoInstance}async flushFileSink(){this.activeFileSink&&await this.activeFileSink.drain()}error(e,t){this.pinoInstance.error(e,t)}warn(e,t){this.pinoInstance.warn(e,t)}info(e,t){this.pinoInstance.info(e,t)}debug(e,t){this.pinoInstance.debug(e,t)}};const YS=new class{config={};loggers=new Map;configure(e){if(this.config=e,e.pinoConfig&&!e.defaultLogger&&!e.loggerFactory){for(let t of this.loggers.values())t.reconfigure(e.pinoConfig);return}this.loggers.clear()}getLogger(e){let t=this.loggers.get(e);if(t)return t;let n;return n=this.config.loggerFactory?this.config.loggerFactory(e):this.config.defaultLogger?this.config.defaultLogger:new JS(e,this.config.pinoConfig),this.loggers.set(e,n),n}reset(){this.config={},this.loggers.clear()}async flushAllFileSinks(){let e=[];for(let t of this.loggers.values())e.push(t.flushFileSink());await Promise.all(e)}};function XS(e){return YS.getLogger(e)}function ZS(e=`test`){return new JS(e,{options:{level:`silent`}})}function QS(){YS.configure({pinoConfig:{options:{level:`silent`}}})}export{Pg as C,d_ as D,u_ as E,uh as S,c_ as T,Fv as _,YS as a,Zm as b,RS as c,MS as d,NS as f,X as g,Eb as h,QS as i,BS as l,dx as m,ZS as n,PS as o,Bx as p,XS as r,AS as s,JS as t,VS as u,pv as v,Ig as w,lh as x,mv as y};
39
+ //# sourceMappingURL=logger-B7Z8XO-z.mjs.map
@@ -0,0 +1,2 @@
1
+ import{$i as e,Ji as t,hi as n}from"./src-FuRMJntf.mjs";const r=new n({extensions:t,deriveStructuralFreshness:!0}),i=e(t);export{i as n,r as t};
2
+ //# sourceMappingURL=md-manager-DqdW_K1F.mjs.map
@@ -1,2 +1,2 @@
1
- import{Nr as e}from"./src-DxAg43k_.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-Bbzq7Z7d.mjs.map
1
+ import{Nr as e}from"./src-CaRd1QSi.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-BAGk1RTK.mjs.map
@@ -1,2 +1,2 @@
1
- import{t as e}from"./md-manager-DtA0LK6p.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-DqdW_K1F.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{ir as e}from"./src-DxAg43k_.mjs";import"./constants-B_riNG8U.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{ir as e}from"./src-CaRd1QSi.mjs";import"./constants-geQohyDW.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-C1DTZkXE.mjs.map
3
+ //# sourceMappingURL=preview-DlS48lyQ.mjs.map
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./preview-DlS48lyQ.mjs";export{t as formatPreviewBlock,e as previewContent};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{n,r}from"./DocumentContext-CPZffvoA.js";import{t as i}from"./react-JNybMug3.js";import{n as a,r as o}from"./dist-DBENJeML.js";import{t as s}from"./compiler-runtime-dQcBxOhn.js";import{t as c}from"./button-DHE6Sx02.js";import{i as l,n as u,t as d}from"./tooltip-BCGL5jDF.js";import{a as f,c as p,i as m,o as h,s as g,t as _}from"./dialog-BLaUGJCd.js";import{vt as v}from"./CodeMirrorPropInput-DUwQlljh.js";import{n as y}from"./CopyButton-D0gTyMvW.js";import{i as b}from"./prop-types-B0l6ZN6O.js";import{t as x}from"./loader-circle-K7Xwpjny.js";import{i as S,t as C}from"./timeline-diff-store-dt1fl2gd.js";import{n as w}from"./dist-DwCd6eR-.js";import{t as T}from"./dist-BD3698ve.js";import{s as E}from"./navigation-targets-4J3F85tT.js";import{a as D,i as O,n as k,o as A,t as j}from"./agent-diff-store-D6N0WX_4.js";import{n as M}from"./use-activity-panel-DoU5dDI7.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 T._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return T._({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,{_:C}=o(),[w,T]=(0,P.useState)(te),E,O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>{let e=setInterval(()=>T(Date.now()),3e4);return()=>clearInterval(e)},O=[],t[0]=E,t[1]=O):(E=t[0],O=t[1]),(0,P.useEffect)(E,O);let[k,A]=(0,P.useState)(!1),j=D(),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]!==C||t[9]!==M||t[10]!==r?(z=C({id:`Z79bnE`,values:{burstNumber:M,docName:r}}),t[8]=C,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]!==w?(B=I(n.ts,w),t[14]=n.ts,t[15]=w,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]!==C||t[35]!==M||t[36]!==r?(K=C({id:`Zhe80e`,values:{burstNumber:M,docName:r}}),t[34]=C,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)(x,{className:`size-3 animate-spin`,"aria-hidden":`true`}):(0,F.jsx)(S,{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]!==C||t[46]!==L||t[47]!==s?(Y=C(s?L>0?{id:`SOPwPh`}:{id:`62bOuM`}:{id:`NzFvyK`}),t[45]=C,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 $;t[57]===v?$=t[58]:($=e=>{!e&&!v?A(!1):e&&A(!0)},t[57]=v,t[58]=$);let ue;t[59]===C?ue=t[60]:(ue=C({id:`a4FRQv`}),t[59]=C,t[60]=ue);let de;t[61]===ue?de=t[62]:(de=(0,F.jsx)(p,{children:ue}),t[61]=ue,t[62]=de);let fe;t[63]===L?fe=t[64]:(fe=(0,F.jsx)(f,{children:(0,F.jsx)(a,{id:`LKIPzv`,values:{laterEdits:L}})}),t[63]=L,t[64]=fe);let pe;t[65]!==de||t[66]!==fe?(pe=(0,F.jsxs)(g,{children:[de,fe]}),t[65]=de,t[66]=fe,t[67]=pe):pe=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)(x,{className:`mr-2 size-4 animate-spin`,"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]!==pe||t[77]!==_e?(ve=(0,F.jsxs)(m,{children:[pe,_e]}),t[76]=pe,t[77]=_e,t[78]=ve):ve=t[78];let ye;t[79]!==k||t[80]!==$||t[81]!==ve?(ye=(0,F.jsx)(_,{open:k,onOpenChange:$,children:ve}),t[79]=k,t[80]=$,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 T._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return T._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return T._({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),j()}))},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 A;t[31]!==O||t[32]!==k||t[33]!==C||t[34]!==E?(A=(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]=A):A=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]!==A||t[54]!==I?(te=(0,F.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[A,I]}),t[53]=A,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)(x,{className:`mr-2 size-4 animate-spin`,"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)(y,{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)(v,{}),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 T._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return T._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return T._({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)(A,{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}=n(),{openTargetTransition:d}=r(),{pageMeta:f}=b(),{data:p,status:m,error:h,reload:g}=M(l),_,v;if(t[2]!==p||t[3]!==l?(_=()=>{if(!(!p||l===null))for(let e of p.files)O(l,e.docName,e.bursts.length)},v=[p,l],t[2]=p,t[3]=l,t[4]=_,t[5]=v):(_=t[4],v=t[5]),(0,P.useEffect)(_,v),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 y;t[9]!==d||t[10]!==f?(y=e=>{d(E({kind:`doc`,target:e,docName:e},f)),z(e)},t[9]=d,t[10]=f,t[11]=y):y=t[11];let x=y,S;t[12]!==p||t[13]!==l?(S=(e,t)=>{if(!p?.agent||l===null)return;C();let n=e.bursts.length;k({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]=S):S=t[14];let T=S,D;t[15]!==c||t[16]!==p||t[17]!==l||t[18]!==g?(D=async(e,t)=>{if(!(t<=0))try{await ie({connectionId:l,docName:e,scope:`count`,count:t,agentName:p?.agent?.displayName}),w.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);w.error(c({id:`EqrC_R`,values:{message:n}})),g()}},t[15]=c,t[16]=p,t[17]=l,t[18]=g,t[19]=D):D=t[19];let A=D,j;return t[20]!==u||t[21]!==p||t[22]!==h||t[23]!==x||t[24]!==T||t[25]!==A||t[26]!==g||t[27]!==s||t[28]!==m?(j=(0,F.jsx)(ce,{data:p,status:m,error:h,reload:g,onExit:u,onNavigate:x,onUndoDrop:A,onSetVersion:T,showBackButton:s}),t[20]=u,t[21]=p,t[22]=h,t[23]=x,t[24]=T,t[25]=A,t[26]=g,t[27]=s,t[28]=m,t[29]=j):j=t[29],j}export{K as ActivityModeContent};
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{n,r}from"./DocumentContext-C4Ar5jL6.js";import{t as i}from"./react-JNybMug3.js";import{n as a,r as o}from"./dist-DBENJeML.js";import{t as s}from"./compiler-runtime-dQcBxOhn.js";import{t as c}from"./button-DHE6Sx02.js";import{i as l,n as u,t as d}from"./tooltip-BCGL5jDF.js";import{a as f,c as p,i as m,o as h,s as g,t as _}from"./dialog-BLaUGJCd.js";import{vt as v}from"./CodeMirrorPropInput-DqNDfEnD.js";import{n as y}from"./CopyButton-D0gTyMvW.js";import{i as b}from"./prop-types-C0wWXvTx.js";import{t as x}from"./loader-circle-K7Xwpjny.js";import{i as S,t as C}from"./timeline-diff-store-dt1fl2gd.js";import{n as w}from"./dist-DwCd6eR-.js";import{t as T}from"./dist-BD3698ve.js";import{s as E}from"./navigation-targets-D1rdXyAI.js";import{a as D,i as O,n as k,o as A,t as j}from"./agent-diff-store-Bd0NDaYd.js";import{n as M}from"./use-activity-panel-DddtATqP.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 T._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return T._({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,{_:C}=o(),[w,T]=(0,P.useState)(te),E,O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>{let e=setInterval(()=>T(Date.now()),3e4);return()=>clearInterval(e)},O=[],t[0]=E,t[1]=O):(E=t[0],O=t[1]),(0,P.useEffect)(E,O);let[k,A]=(0,P.useState)(!1),j=D(),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]!==C||t[9]!==M||t[10]!==r?(z=C({id:`Z79bnE`,values:{burstNumber:M,docName:r}}),t[8]=C,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]!==w?(B=I(n.ts,w),t[14]=n.ts,t[15]=w,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]!==C||t[35]!==M||t[36]!==r?(K=C({id:`Zhe80e`,values:{burstNumber:M,docName:r}}),t[34]=C,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)(x,{className:`size-3 animate-spin`,"aria-hidden":`true`}):(0,F.jsx)(S,{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]!==C||t[46]!==L||t[47]!==s?(Y=C(s?L>0?{id:`SOPwPh`}:{id:`62bOuM`}:{id:`NzFvyK`}),t[45]=C,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 $;t[57]===v?$=t[58]:($=e=>{!e&&!v?A(!1):e&&A(!0)},t[57]=v,t[58]=$);let ue;t[59]===C?ue=t[60]:(ue=C({id:`a4FRQv`}),t[59]=C,t[60]=ue);let de;t[61]===ue?de=t[62]:(de=(0,F.jsx)(p,{children:ue}),t[61]=ue,t[62]=de);let fe;t[63]===L?fe=t[64]:(fe=(0,F.jsx)(f,{children:(0,F.jsx)(a,{id:`LKIPzv`,values:{laterEdits:L}})}),t[63]=L,t[64]=fe);let pe;t[65]!==de||t[66]!==fe?(pe=(0,F.jsxs)(g,{children:[de,fe]}),t[65]=de,t[66]=fe,t[67]=pe):pe=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)(x,{className:`mr-2 size-4 animate-spin`,"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]!==pe||t[77]!==_e?(ve=(0,F.jsxs)(m,{children:[pe,_e]}),t[76]=pe,t[77]=_e,t[78]=ve):ve=t[78];let ye;t[79]!==k||t[80]!==$||t[81]!==ve?(ye=(0,F.jsx)(_,{open:k,onOpenChange:$,children:ve}),t[79]=k,t[80]=$,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 T._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return T._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return T._({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),j()}))},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 A;t[31]!==O||t[32]!==k||t[33]!==C||t[34]!==E?(A=(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]=A):A=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]!==A||t[54]!==I?(te=(0,F.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[A,I]}),t[53]=A,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)(x,{className:`mr-2 size-4 animate-spin`,"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)(y,{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)(v,{}),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 T._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return T._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return T._({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)(A,{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}=n(),{openTargetTransition:d}=r(),{pageMeta:f}=b(),{data:p,status:m,error:h,reload:g}=M(l),_,v;if(t[2]!==p||t[3]!==l?(_=()=>{if(!(!p||l===null))for(let e of p.files)O(l,e.docName,e.bursts.length)},v=[p,l],t[2]=p,t[3]=l,t[4]=_,t[5]=v):(_=t[4],v=t[5]),(0,P.useEffect)(_,v),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 y;t[9]!==d||t[10]!==f?(y=e=>{d(E({kind:`doc`,target:e,docName:e},f)),z(e)},t[9]=d,t[10]=f,t[11]=y):y=t[11];let x=y,S;t[12]!==p||t[13]!==l?(S=(e,t)=>{if(!p?.agent||l===null)return;C();let n=e.bursts.length;k({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]=S):S=t[14];let T=S,D;t[15]!==c||t[16]!==p||t[17]!==l||t[18]!==g?(D=async(e,t)=>{if(!(t<=0))try{await ie({connectionId:l,docName:e,scope:`count`,count:t,agentName:p?.agent?.displayName}),w.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);w.error(c({id:`EqrC_R`,values:{message:n}})),g()}},t[15]=c,t[16]=p,t[17]=l,t[18]=g,t[19]=D):D=t[19];let A=D,j;return t[20]!==u||t[21]!==p||t[22]!==h||t[23]!==x||t[24]!==T||t[25]!==A||t[26]!==g||t[27]!==s||t[28]!==m?(j=(0,F.jsx)(ce,{data:p,status:m,error:h,reload:g,onExit:u,onNavigate:x,onUndoDrop:A,onSetVersion:T,showBackButton:s}),t[20]=u,t[21]=p,t[22]=h,t[23]=x,t[24]=T,t[25]=A,t[26]=g,t[27]=s,t[28]=m,t[29]=j):j=t[29],j}export{K as ActivityModeContent};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ActivityPanelDiffView-Ca-9q7Zb.js","./chunk-DseTPa7n.js","./dist-DBENJeML.js","./jsx-runtime-DyiINK0N.js","./react-JNybMug3.js","./compiler-runtime-dQcBxOhn.js","./ActivityPanelDiffView-legcy4jI.css"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./preload-helper-2ej06EnG.js";import{t as n}from"./jsx-runtime-DyiINK0N.js";import{t as r}from"./react-JNybMug3.js";import{n as i,r as a}from"./dist-DBENJeML.js";import{t as o}from"./compiler-runtime-dQcBxOhn.js";import{t as ee}from"./button-DHE6Sx02.js";import{i as te,n as ne,t as re}from"./tooltip-BCGL5jDF.js";import{n as s,t as c}from"./toggle-group-CxrQL99E.js";import{t as l}from"./loader-circle-K7Xwpjny.js";import{n as u,t as d}from"./panel-right-open-CBweAP43.js";import{t as ie}from"./x-6ATUQvcC.js";import{o as ae,r as oe,t as se}from"./agent-diff-store-D6N0WX_4.js";import{t as f}from"./lru-string-cache-D19dwCKJ.js";import{t as ce}from"./use-activity-panel-DoU5dDI7.js";import{a as le,o as ue,r as de,t as fe}from"./use-timeline-entry-diff-C_hkFzJg.js";var pe=o(),p=e(r(),1),m=n(),me=(0,p.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-Ca-9q7Zb.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).ActivityPanelDiffView})),h=64;function g(e){let t=(0,pe.c)(115),{view:n,isPanelCollapsed:r,onTogglePanel:o}=e,{_:f}=a(),{agentId:h,agentName:g,agentColor:_,agentIcon:v,docName:y,keptCount:b}=n,[x]=(0,p.useState)(ge),_e=(0,p.useRef)(null),[S,ve]=(0,p.useState)(`rendered`),ye;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(ye={status:`loading`,diff:``,before:``,after:``},t[0]=ye):ye=t[0];let[C,be]=(0,p.useState)(ye),xe,Se;t[1]!==h||t[2]!==x||t[3]!==y||t[4]!==b?(xe=()=>{let e=!1;be({status:`loading`,diff:``,before:``,after:``});let t=`${y}\0${b}`,n=x.get(t);if(n!==void 0){be({status:`ready`,...JSON.parse(n)});return}return ce(h,y,b).then(n=>{e||(x.set(t,JSON.stringify(n)),be({status:`ready`,...n}))}).catch(t=>{e||(console.error(`[agent-diff] failed to load burst diff`,{agentId:h,docName:y,keptCount:b,err:t}),be({status:`error`,diff:``,before:``,after:``}))}),()=>{e=!0}},Se=[h,y,b,x],t[1]=h,t[2]=x,t[3]=y,t[4]=b,t[5]=xe,t[6]=Se):(xe=t[5],Se=t[6]),(0,p.useEffect)(xe,Se);let Ce;t[7]!==C.after||t[8]!==C.before||t[9]!==C.status?(Ce=C.status===`ready`?ue(C.before,C.after):null,t[7]=C.after,t[8]=C.before,t[9]=C.status,t[10]=Ce):Ce=t[10];let w=Ce,T=C.status===`ready`&&C.diff!==``?`${S}:${C.diff}`:``,E,D;t[11]===T?(E=t[12],D=t[13]):(E=()=>{let e=_e.current;if(T===``||!e)return;let t=!1,n=null,r,i,a=()=>{if(t)return;let r=e.querySelector(`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`)??de(e)[0];if(!r)return;t=!0,n?.disconnect();let i=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;r.scrollIntoView({block:`center`,behavior:i?`auto`:`smooth`})},o=()=>{t||(r!==void 0&&clearTimeout(r),r=setTimeout(()=>{i!==void 0&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{i=requestAnimationFrame(a)})},120))};n=new MutationObserver(o),n.observe(e,{childList:!0,subtree:!0}),o();let ee=setTimeout(()=>n?.disconnect(),5e3);return()=>{n?.disconnect(),r!==void 0&&clearTimeout(r),i!==void 0&&cancelAnimationFrame(i),clearTimeout(ee)}},D=[T],t[11]=T,t[12]=E,t[13]=D),(0,p.useEffect)(E,D);let O,k;t[14]===b?(O=t[15],k=t[16]):(O=()=>{let e=e=>{let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`)||(e.key===`Escape`?se():e.key===`j`||e.key===`ArrowRight`?(e.preventDefault(),oe(b+1)):(e.key===`k`||e.key===`ArrowLeft`)&&(e.preventDefault(),oe(b-1)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},k=[b],t[14]=b,t[15]=O,t[16]=k),(0,p.useEffect)(O,k);let A,j,M,N,P,F,I,L;if(t[17]!==f||t[18]!==_||t[19]!==v||t[20]!==g||t[21]!==y||t[22]!==C.diff||t[23]!==C.status){let e=C.status===`ready`?fe(C.diff):{additions:0,deletions:0},n=e.additions>0||e.deletions>0;F=`absolute inset-0 z-20 flex flex-col bg-background`,I=`agent-diff-pane`,j=`flex flex-wrap items-center gap-x-2 gap-y-1.5 border-b border-border px-3 py-2`;let r;t[32]===f?r=t[33]:(r=f({id:`b18t0_`}),t[32]=f,t[33]=r);let i;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,m.jsx)(ie,{className:`size-4`}),t[34]=i):i=t[34];let a;t[35]===r?a=t[36]:(a=(0,m.jsx)(te,{asChild:!0,children:(0,m.jsx)(ee,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`agent-diff-close`,"aria-label":r,onClick:he,children:i})}),t[35]=r,t[36]=a);let o;t[37]===f?o=t[38]:(o=f({id:`b18t0_`}),t[37]=f,t[38]=o);let s;t[39]===o?s=t[40]:(s=(0,m.jsx)(ne,{side:`bottom`,children:o}),t[39]=o,t[40]=s),t[41]!==a||t[42]!==s?(M=(0,m.jsxs)(re,{children:[a,s]}),t[41]=a,t[42]=s,t[43]=M):M=t[43];let c;t[44]===_?c=t[45]:(c={backgroundColor:_},t[44]=_,t[45]=c);let l;t[46]===v?l=t[47]:(l=(0,m.jsx)(ae,{icon:v,width:13,height:13}),t[46]=v,t[47]=l),t[48]!==c||t[49]!==l?(N=(0,m.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full text-white`,style:c,children:l}),t[48]=c,t[49]=l,t[50]=N):N=t[50];let u;t[51]===y?u=t[52]:(u=(0,m.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:y}),t[51]=y,t[52]=u);let d;t[53]===g?d=t[54]:(d=(0,m.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:g}),t[53]=g,t[54]=d),t[55]!==u||t[56]!==d?(P=(0,m.jsxs)(`div`,{className:`min-w-0 max-w-[14rem] shrink`,children:[u,d]}),t[55]=u,t[56]=d,t[57]=P):P=t[57],L=`ml-auto flex flex-wrap items-center justify-end gap-2`,A=n&&(0,m.jsxs)(`span`,{role:`img`,className:`shrink-0 text-xs tabular-nums`,"data-testid":`agent-diff-stat`,"aria-label":f({id:`8lwQlE`,values:{0:e.additions,1:e.deletions}}),children:[(0,m.jsxs)(`span`,{"aria-hidden":`true`,className:`text-emerald-600 dark:text-emerald-500`,children:[`+`,e.additions]}),` `,(0,m.jsxs)(`span`,{"aria-hidden":`true`,className:`text-red-600 dark:text-red-500`,children:[`−`,e.deletions]})]}),t[17]=f,t[18]=_,t[19]=v,t[20]=g,t[21]=y,t[22]=C.diff,t[23]=C.status,t[24]=A,t[25]=j,t[26]=M,t[27]=N,t[28]=P,t[29]=F,t[30]=I,t[31]=L}else A=t[24],j=t[25],M=t[26],N=t[27],P=t[28],F=t[29],I=t[30],L=t[31];let R;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{(e===`rendered`||e===`source`)&&ve(e)},t[58]=R):R=t[58];let z;t[59]===f?z=t[60]:(z=f({id:`ZW3mlR`}),t[59]=f,t[60]=z);let B;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,m.jsx)(s,{value:`rendered`,className:`h-6 px-2 text-xs`,"data-testid":`agent-diff-render-rendered`,children:(0,m.jsx)(i,{id:`4z_1j2`})}),t[61]=B):B=t[61];let we;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,m.jsx)(s,{value:`source`,className:`h-6 px-2 text-xs`,"data-testid":`agent-diff-render-source`,children:(0,m.jsx)(i,{id:`wdxz7K`})}),t[62]=we):we=t[62];let V;t[63]!==S||t[64]!==z?(V=(0,m.jsxs)(c,{type:`single`,value:S,onValueChange:R,"aria-label":z,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 rounded-md bg-muted p-0.5 dark:bg-background`,children:[B,we]}),t[63]=S,t[64]=z,t[65]=V):V=t[65];let H;t[66]!==f||t[67]!==r?(H=f(r?{id:`6iDEWA`}:{id:`170Js2`}),t[66]=f,t[67]=r,t[68]=H):H=t[68];let Te=!r,U;t[69]===r?U=t[70]:(U=r?(0,m.jsx)(d,{className:`size-4`}):(0,m.jsx)(u,{className:`size-4`}),t[69]=r,t[70]=U);let W;t[71]!==o||t[72]!==H||t[73]!==Te||t[74]!==U?(W=(0,m.jsx)(te,{asChild:!0,children:(0,m.jsx)(ee,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`agent-diff-toggle-panel`,"aria-label":H,"aria-expanded":Te,onClick:o,children:U})}),t[71]=o,t[72]=H,t[73]=Te,t[74]=U,t[75]=W):W=t[75];let G;t[76]!==f||t[77]!==r?(G=f(r?{id:`6iDEWA`}:{id:`170Js2`}),t[76]=f,t[77]=r,t[78]=G):G=t[78];let K;t[79]===G?K=t[80]:(K=(0,m.jsx)(ne,{side:`bottom`,children:G}),t[79]=G,t[80]=K);let q;t[81]!==W||t[82]!==K?(q=(0,m.jsxs)(re,{children:[W,K]}),t[81]=W,t[82]=K,t[83]=q):q=t[83];let J;t[84]!==A||t[85]!==V||t[86]!==q||t[87]!==L?(J=(0,m.jsxs)(`div`,{className:L,children:[A,V,q]}),t[84]=A,t[85]=V,t[86]=q,t[87]=L,t[88]=J):J=t[88];let Y;t[89]!==j||t[90]!==M||t[91]!==N||t[92]!==P||t[93]!==J?(Y=(0,m.jsxs)(`div`,{className:j,children:[M,N,P,J]}),t[89]=j,t[90]=M,t[91]=N,t[92]=P,t[93]=J,t[94]=Y):Y=t[94];let X;t[95]===C.status?X=t[96]:(X=C.status===`loading`&&(0,m.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,m.jsx)(l,{className:`size-3 animate-spin`}),(0,m.jsx)(i,{id:`38foVZ`})]}),t[95]=C.status,t[96]=X);let Z;t[97]===C.status?Z=t[98]:(Z=C.status===`error`&&(0,m.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:(0,m.jsx)(i,{id:`vvWZnu`})}),t[97]=C.status,t[98]=Z);let Q;t[99]!==b||t[100]!==S||t[101]!==w||t[102]!==C.after||t[103]!==C.diff||t[104]!==C.status?(Q=C.status===`ready`&&(S===`rendered`&&w?.ok?(0,m.jsx)(le,{diff:w}):C.diff===``?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`p`,{className:`border-b border-border px-4 py-2 text-xs text-muted-foreground italic`,children:b===0?(0,m.jsx)(i,{id:`klPS-L`}):(0,m.jsx)(i,{id:`k7Hoig`})}),(0,m.jsx)(`pre`,{className:`whitespace-pre-wrap px-4 py-3 font-mono text-xs text-foreground/90`,children:C.after})]}):(0,m.jsx)(p.Suspense,{fallback:(0,m.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,m.jsx)(l,{className:`size-3 animate-spin`}),(0,m.jsx)(i,{id:`EDm3wJ`})]}),children:(0,m.jsx)(me,{diff:C.diff,viewType:`unified`})})),t[99]=b,t[100]=S,t[101]=w,t[102]=C.after,t[103]=C.diff,t[104]=C.status,t[105]=Q):Q=t[105];let $;t[106]!==X||t[107]!==Z||t[108]!==Q?($=(0,m.jsxs)(`div`,{ref:_e,className:`min-h-0 flex-1 overflow-auto subtle-scrollbar`,children:[X,Z,Q]}),t[106]=X,t[107]=Z,t[108]=Q,t[109]=$):$=t[109];let Ee;return t[110]!==F||t[111]!==I||t[112]!==Y||t[113]!==$?(Ee=(0,m.jsxs)(`div`,{className:F,"data-testid":I,children:[Y,$]}),t[110]=F,t[111]=I,t[112]=Y,t[113]=$,t[114]=Ee):Ee=t[114],Ee}function he(){return se()}function ge(){return new f(h)}export{g as AgentDiffPane};
2
+ import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./preload-helper-2ej06EnG.js";import{t as n}from"./jsx-runtime-DyiINK0N.js";import{t as r}from"./react-JNybMug3.js";import{n as i,r as a}from"./dist-DBENJeML.js";import{t as o}from"./compiler-runtime-dQcBxOhn.js";import{t as ee}from"./button-DHE6Sx02.js";import{i as te,n as ne,t as re}from"./tooltip-BCGL5jDF.js";import{n as s,t as c}from"./toggle-group-CxrQL99E.js";import{t as l}from"./loader-circle-K7Xwpjny.js";import{n as u,t as d}from"./panel-right-open-CBweAP43.js";import{t as ie}from"./x-6ATUQvcC.js";import{o as ae,r as oe,t as se}from"./agent-diff-store-Bd0NDaYd.js";import{t as f}from"./lru-string-cache-D19dwCKJ.js";import{t as ce}from"./use-activity-panel-DddtATqP.js";import{a as le,o as ue,r as de,t as fe}from"./use-timeline-entry-diff-DTpDQjgI.js";var pe=o(),p=e(r(),1),m=n(),me=(0,p.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-Ca-9q7Zb.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).ActivityPanelDiffView})),h=64;function g(e){let t=(0,pe.c)(115),{view:n,isPanelCollapsed:r,onTogglePanel:o}=e,{_:f}=a(),{agentId:h,agentName:g,agentColor:_,agentIcon:v,docName:y,keptCount:b}=n,[x]=(0,p.useState)(ge),_e=(0,p.useRef)(null),[S,ve]=(0,p.useState)(`rendered`),ye;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(ye={status:`loading`,diff:``,before:``,after:``},t[0]=ye):ye=t[0];let[C,be]=(0,p.useState)(ye),xe,Se;t[1]!==h||t[2]!==x||t[3]!==y||t[4]!==b?(xe=()=>{let e=!1;be({status:`loading`,diff:``,before:``,after:``});let t=`${y}\0${b}`,n=x.get(t);if(n!==void 0){be({status:`ready`,...JSON.parse(n)});return}return ce(h,y,b).then(n=>{e||(x.set(t,JSON.stringify(n)),be({status:`ready`,...n}))}).catch(t=>{e||(console.error(`[agent-diff] failed to load burst diff`,{agentId:h,docName:y,keptCount:b,err:t}),be({status:`error`,diff:``,before:``,after:``}))}),()=>{e=!0}},Se=[h,y,b,x],t[1]=h,t[2]=x,t[3]=y,t[4]=b,t[5]=xe,t[6]=Se):(xe=t[5],Se=t[6]),(0,p.useEffect)(xe,Se);let Ce;t[7]!==C.after||t[8]!==C.before||t[9]!==C.status?(Ce=C.status===`ready`?ue(C.before,C.after):null,t[7]=C.after,t[8]=C.before,t[9]=C.status,t[10]=Ce):Ce=t[10];let w=Ce,T=C.status===`ready`&&C.diff!==``?`${S}:${C.diff}`:``,E,D;t[11]===T?(E=t[12],D=t[13]):(E=()=>{let e=_e.current;if(T===``||!e)return;let t=!1,n=null,r,i,a=()=>{if(t)return;let r=e.querySelector(`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`)??de(e)[0];if(!r)return;t=!0,n?.disconnect();let i=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;r.scrollIntoView({block:`center`,behavior:i?`auto`:`smooth`})},o=()=>{t||(r!==void 0&&clearTimeout(r),r=setTimeout(()=>{i!==void 0&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{i=requestAnimationFrame(a)})},120))};n=new MutationObserver(o),n.observe(e,{childList:!0,subtree:!0}),o();let ee=setTimeout(()=>n?.disconnect(),5e3);return()=>{n?.disconnect(),r!==void 0&&clearTimeout(r),i!==void 0&&cancelAnimationFrame(i),clearTimeout(ee)}},D=[T],t[11]=T,t[12]=E,t[13]=D),(0,p.useEffect)(E,D);let O,k;t[14]===b?(O=t[15],k=t[16]):(O=()=>{let e=e=>{let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`)||(e.key===`Escape`?se():e.key===`j`||e.key===`ArrowRight`?(e.preventDefault(),oe(b+1)):(e.key===`k`||e.key===`ArrowLeft`)&&(e.preventDefault(),oe(b-1)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},k=[b],t[14]=b,t[15]=O,t[16]=k),(0,p.useEffect)(O,k);let A,j,M,N,P,F,I,L;if(t[17]!==f||t[18]!==_||t[19]!==v||t[20]!==g||t[21]!==y||t[22]!==C.diff||t[23]!==C.status){let e=C.status===`ready`?fe(C.diff):{additions:0,deletions:0},n=e.additions>0||e.deletions>0;F=`absolute inset-0 z-20 flex flex-col bg-background`,I=`agent-diff-pane`,j=`flex flex-wrap items-center gap-x-2 gap-y-1.5 border-b border-border px-3 py-2`;let r;t[32]===f?r=t[33]:(r=f({id:`b18t0_`}),t[32]=f,t[33]=r);let i;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,m.jsx)(ie,{className:`size-4`}),t[34]=i):i=t[34];let a;t[35]===r?a=t[36]:(a=(0,m.jsx)(te,{asChild:!0,children:(0,m.jsx)(ee,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`agent-diff-close`,"aria-label":r,onClick:he,children:i})}),t[35]=r,t[36]=a);let o;t[37]===f?o=t[38]:(o=f({id:`b18t0_`}),t[37]=f,t[38]=o);let s;t[39]===o?s=t[40]:(s=(0,m.jsx)(ne,{side:`bottom`,children:o}),t[39]=o,t[40]=s),t[41]!==a||t[42]!==s?(M=(0,m.jsxs)(re,{children:[a,s]}),t[41]=a,t[42]=s,t[43]=M):M=t[43];let c;t[44]===_?c=t[45]:(c={backgroundColor:_},t[44]=_,t[45]=c);let l;t[46]===v?l=t[47]:(l=(0,m.jsx)(ae,{icon:v,width:13,height:13}),t[46]=v,t[47]=l),t[48]!==c||t[49]!==l?(N=(0,m.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full text-white`,style:c,children:l}),t[48]=c,t[49]=l,t[50]=N):N=t[50];let u;t[51]===y?u=t[52]:(u=(0,m.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:y}),t[51]=y,t[52]=u);let d;t[53]===g?d=t[54]:(d=(0,m.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:g}),t[53]=g,t[54]=d),t[55]!==u||t[56]!==d?(P=(0,m.jsxs)(`div`,{className:`min-w-0 max-w-[14rem] shrink`,children:[u,d]}),t[55]=u,t[56]=d,t[57]=P):P=t[57],L=`ml-auto flex flex-wrap items-center justify-end gap-2`,A=n&&(0,m.jsxs)(`span`,{role:`img`,className:`shrink-0 text-xs tabular-nums`,"data-testid":`agent-diff-stat`,"aria-label":f({id:`8lwQlE`,values:{0:e.additions,1:e.deletions}}),children:[(0,m.jsxs)(`span`,{"aria-hidden":`true`,className:`text-emerald-600 dark:text-emerald-500`,children:[`+`,e.additions]}),` `,(0,m.jsxs)(`span`,{"aria-hidden":`true`,className:`text-red-600 dark:text-red-500`,children:[`−`,e.deletions]})]}),t[17]=f,t[18]=_,t[19]=v,t[20]=g,t[21]=y,t[22]=C.diff,t[23]=C.status,t[24]=A,t[25]=j,t[26]=M,t[27]=N,t[28]=P,t[29]=F,t[30]=I,t[31]=L}else A=t[24],j=t[25],M=t[26],N=t[27],P=t[28],F=t[29],I=t[30],L=t[31];let R;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{(e===`rendered`||e===`source`)&&ve(e)},t[58]=R):R=t[58];let z;t[59]===f?z=t[60]:(z=f({id:`ZW3mlR`}),t[59]=f,t[60]=z);let B;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,m.jsx)(s,{value:`rendered`,className:`h-6 px-2 text-xs`,"data-testid":`agent-diff-render-rendered`,children:(0,m.jsx)(i,{id:`4z_1j2`})}),t[61]=B):B=t[61];let we;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,m.jsx)(s,{value:`source`,className:`h-6 px-2 text-xs`,"data-testid":`agent-diff-render-source`,children:(0,m.jsx)(i,{id:`wdxz7K`})}),t[62]=we):we=t[62];let V;t[63]!==S||t[64]!==z?(V=(0,m.jsxs)(c,{type:`single`,value:S,onValueChange:R,"aria-label":z,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 rounded-md bg-muted p-0.5 dark:bg-background`,children:[B,we]}),t[63]=S,t[64]=z,t[65]=V):V=t[65];let H;t[66]!==f||t[67]!==r?(H=f(r?{id:`6iDEWA`}:{id:`170Js2`}),t[66]=f,t[67]=r,t[68]=H):H=t[68];let Te=!r,U;t[69]===r?U=t[70]:(U=r?(0,m.jsx)(d,{className:`size-4`}):(0,m.jsx)(u,{className:`size-4`}),t[69]=r,t[70]=U);let W;t[71]!==o||t[72]!==H||t[73]!==Te||t[74]!==U?(W=(0,m.jsx)(te,{asChild:!0,children:(0,m.jsx)(ee,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`agent-diff-toggle-panel`,"aria-label":H,"aria-expanded":Te,onClick:o,children:U})}),t[71]=o,t[72]=H,t[73]=Te,t[74]=U,t[75]=W):W=t[75];let G;t[76]!==f||t[77]!==r?(G=f(r?{id:`6iDEWA`}:{id:`170Js2`}),t[76]=f,t[77]=r,t[78]=G):G=t[78];let K;t[79]===G?K=t[80]:(K=(0,m.jsx)(ne,{side:`bottom`,children:G}),t[79]=G,t[80]=K);let q;t[81]!==W||t[82]!==K?(q=(0,m.jsxs)(re,{children:[W,K]}),t[81]=W,t[82]=K,t[83]=q):q=t[83];let J;t[84]!==A||t[85]!==V||t[86]!==q||t[87]!==L?(J=(0,m.jsxs)(`div`,{className:L,children:[A,V,q]}),t[84]=A,t[85]=V,t[86]=q,t[87]=L,t[88]=J):J=t[88];let Y;t[89]!==j||t[90]!==M||t[91]!==N||t[92]!==P||t[93]!==J?(Y=(0,m.jsxs)(`div`,{className:j,children:[M,N,P,J]}),t[89]=j,t[90]=M,t[91]=N,t[92]=P,t[93]=J,t[94]=Y):Y=t[94];let X;t[95]===C.status?X=t[96]:(X=C.status===`loading`&&(0,m.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,m.jsx)(l,{className:`size-3 animate-spin`}),(0,m.jsx)(i,{id:`38foVZ`})]}),t[95]=C.status,t[96]=X);let Z;t[97]===C.status?Z=t[98]:(Z=C.status===`error`&&(0,m.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:(0,m.jsx)(i,{id:`vvWZnu`})}),t[97]=C.status,t[98]=Z);let Q;t[99]!==b||t[100]!==S||t[101]!==w||t[102]!==C.after||t[103]!==C.diff||t[104]!==C.status?(Q=C.status===`ready`&&(S===`rendered`&&w?.ok?(0,m.jsx)(le,{diff:w}):C.diff===``?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`p`,{className:`border-b border-border px-4 py-2 text-xs text-muted-foreground italic`,children:b===0?(0,m.jsx)(i,{id:`klPS-L`}):(0,m.jsx)(i,{id:`k7Hoig`})}),(0,m.jsx)(`pre`,{className:`whitespace-pre-wrap px-4 py-3 font-mono text-xs text-foreground/90`,children:C.after})]}):(0,m.jsx)(p.Suspense,{fallback:(0,m.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,m.jsx)(l,{className:`size-3 animate-spin`}),(0,m.jsx)(i,{id:`EDm3wJ`})]}),children:(0,m.jsx)(me,{diff:C.diff,viewType:`unified`})})),t[99]=b,t[100]=S,t[101]=w,t[102]=C.after,t[103]=C.diff,t[104]=C.status,t[105]=Q):Q=t[105];let $;t[106]!==X||t[107]!==Z||t[108]!==Q?($=(0,m.jsxs)(`div`,{ref:_e,className:`min-h-0 flex-1 overflow-auto subtle-scrollbar`,children:[X,Z,Q]}),t[106]=X,t[107]=Z,t[108]=Q,t[109]=$):$=t[109];let Ee;return t[110]!==F||t[111]!==I||t[112]!==Y||t[113]!==$?(Ee=(0,m.jsxs)(`div`,{className:F,"data-testid":I,children:[Y,$]}),t[110]=F,t[111]=I,t[112]=Y,t[113]=$,t[114]=Ee):Ee=t[114],Ee}function he(){return se()}function ge(){return new f(h)}export{g as AgentDiffPane};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./react-JNybMug3.js";import{t as n}from"./compiler-runtime-dQcBxOhn.js";import{n as r}from"./use-collab-url-CwAStsIj.js";import{i,r as a}from"./thread-client-DH1Xs0By.js";var o=n(),s=e(t(),1);function c(){let e=(0,o.c)(3),{collabUrl:t}=r(),n,c;return e[0]===t?(n=e[1],c=e[2]):(n=()=>{a().setUrl(i(t))},c=[t],e[0]=t,e[1]=n,e[2]=c),(0,s.useEffect)(n,c),null}export{c as AgentThreadClientBinder};
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./react-JNybMug3.js";import{t as n}from"./compiler-runtime-dQcBxOhn.js";import{n as r}from"./use-collab-url-B-LUA0g9.js";import{i,r as a}from"./thread-client-DH1Xs0By.js";var o=n(),s=e(t(),1);function c(){let e=(0,o.c)(3),{collabUrl:t}=r(),n,c;return e[0]===t?(n=e[1],c=e[2]):(n=()=>{a().setUrl(i(t))},c=[t],e[0]=t,e[1]=n,e[2]=c),(0,s.useEffect)(n,c),null}export{c as AgentThreadClientBinder};