@inkeep/open-knowledge 0.6.0-beta.8 → 0.6.0-beta.9

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 (188) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +4 -4
  4. package/dist/constants-CkYsa36O.mjs +2 -0
  5. package/dist/index.mjs +1 -1
  6. package/dist/{init-al09RZM6.mjs → init-BG3i7h4P.mjs} +3 -3
  7. package/dist/init-CGZULhvc.mjs +1 -0
  8. package/dist/{loader-B64XEbbD.mjs → loader-4X5eR4wo.mjs} +2 -2
  9. package/dist/loader-DOJXinKb.mjs +1 -0
  10. package/dist/preview-DCei46zt.mjs +1 -0
  11. package/dist/{preview-CYIUoqRn.mjs → preview-fk1DB9JQ.mjs} +2 -2
  12. package/dist/public/assets/ActivityModeContent-DMKML_zC.js +2 -0
  13. package/dist/public/assets/ActivityPanelDiffView-BN3fSrLi.js +13 -0
  14. package/dist/public/assets/ConsentDialogBody-C5uHYfEW.js +2 -0
  15. package/dist/public/assets/DocumentContext-CP8suU6i.js +62 -0
  16. package/dist/public/assets/{GraphPanel-Btq3W8xK.js → GraphPanel-Dk9s6BR5.js} +1 -1
  17. package/dist/public/assets/McpConsentDialogBody-BfIuibLb.js +1 -0
  18. package/dist/public/assets/SettingsDialogBody-DD8SsPLc.js +7 -0
  19. package/dist/public/assets/{SourceEditor-BBghYkCg.js → SourceEditor-_oSCmouY.js} +1 -1
  20. package/dist/public/assets/{_baseFor-B3FCzyNW.js → _baseFor-BQ6FmUXQ.js} +1 -1
  21. package/dist/public/assets/{arc-GOD6SLHR.js → arc-BTYHqK6I.js} +1 -1
  22. package/dist/public/assets/architecture-YZFGNWBL-haHjZ-W1.js +1 -0
  23. package/dist/public/assets/{architectureDiagram-Q4EWVU46-CIVh0TLx.js → architectureDiagram-Q4EWVU46-BeBUNHfZ.js} +1 -1
  24. package/dist/public/assets/{blockDiagram-DXYQGD6D-Cg-UHasz.js → blockDiagram-DXYQGD6D-DsdTvw8_.js} +1 -1
  25. package/dist/public/assets/{c4Diagram-AHTNJAMY-KFeHAAOO.js → c4Diagram-AHTNJAMY-C-rFnJCR.js} +1 -1
  26. package/dist/public/assets/channel-BrrATp5X.js +1 -0
  27. package/dist/public/assets/checkbox-DlLMG5cc.js +1 -0
  28. package/dist/public/assets/{chunk-2KRD3SAO-ChBquZUZ.js → chunk-2KRD3SAO-C0VEmSSK.js} +1 -1
  29. package/dist/public/assets/{chunk-336JU56O-DHqaXNrn.js → chunk-336JU56O-gb9mgyWz.js} +2 -2
  30. package/dist/public/assets/chunk-426QAEUC-WS9k1tU2.js +1 -0
  31. package/dist/public/assets/{chunk-4BX2VUAB-Dagml-_v.js → chunk-4BX2VUAB-CqFQlA48.js} +1 -1
  32. package/dist/public/assets/{chunk-4TB4RGXK-QLafKs7A.js → chunk-4TB4RGXK-SWtNUTYl.js} +1 -1
  33. package/dist/public/assets/chunk-55IACEB6-mJDPihNE.js +1 -0
  34. package/dist/public/assets/{chunk-5FUZZQ4R-DoG5zk7O.js → chunk-5FUZZQ4R-CwnM4vYi.js} +1 -1
  35. package/dist/public/assets/{chunk-5PVQY5BW--zDnbXdQ.js → chunk-5PVQY5BW-D1dRE2Kl.js} +1 -1
  36. package/dist/public/assets/{chunk-67CJDMHE-BDDJCVvR.js → chunk-67CJDMHE-DaOHFcoK.js} +1 -1
  37. package/dist/public/assets/{chunk-7N4EOEYR-DcM-tXJf.js → chunk-7N4EOEYR-DxJSpCGX.js} +1 -1
  38. package/dist/public/assets/{chunk-AA7GKIK3-CIk9DOam.js → chunk-AA7GKIK3-Ck4Wrqot.js} +1 -1
  39. package/dist/public/assets/{chunk-BSJP7CBP-CC13npHT.js → chunk-BSJP7CBP-c353z_ln.js} +1 -1
  40. package/dist/public/assets/{chunk-CIAEETIT-B7rpgB3I.js → chunk-CIAEETIT-fgTeYGb2.js} +1 -1
  41. package/dist/public/assets/{chunk-EDXVE4YY-BfT15Ufb.js → chunk-EDXVE4YY-DgNhZfoF.js} +1 -1
  42. package/dist/public/assets/{chunk-ENJZ2VHE-DEtEhITq.js → chunk-ENJZ2VHE-BuXqjNcc.js} +1 -1
  43. package/dist/public/assets/{chunk-FMBD7UC4-DXl_nUYs.js → chunk-FMBD7UC4-c2vVGInH.js} +1 -1
  44. package/dist/public/assets/{chunk-FOC6F5B3-wEKzMqND.js → chunk-FOC6F5B3-CH9dNZl0.js} +1 -1
  45. package/dist/public/assets/{chunk-ICPOFSXX-C8AElYY_.js → chunk-ICPOFSXX-JDKZSS0Z.js} +2 -2
  46. package/dist/public/assets/{chunk-K5T4RW27-DcJgbIMU.js → chunk-K5T4RW27-DPAjYSpe.js} +1 -1
  47. package/dist/public/assets/{chunk-KGLVRYIC-kNC4I9ls.js → chunk-KGLVRYIC-BKUgXOPp.js} +1 -1
  48. package/dist/public/assets/{chunk-LIHQZDEY-B0zYcYPV.js → chunk-LIHQZDEY-CWn5kZJ_.js} +1 -1
  49. package/dist/public/assets/{chunk-ORNJ4GCN-S_3Y_0FS.js → chunk-ORNJ4GCN-BETATk1q.js} +1 -1
  50. package/dist/public/assets/{chunk-OYMX7WX6-CX3nrwxJ.js → chunk-OYMX7WX6-Dj48iVpu.js} +1 -1
  51. package/dist/public/assets/chunk-QZHKN3VN-B5CMAE_s.js +1 -0
  52. package/dist/public/assets/{chunk-U2HBQHQK-CfAyyLJz.js → chunk-U2HBQHQK-CHYJZdMm.js} +1 -1
  53. package/dist/public/assets/{chunk-X2U36JSP-CmACymAN.js → chunk-X2U36JSP-CXEQobKO.js} +1 -1
  54. package/dist/public/assets/{chunk-XPW4576I-D1s3NdKZ.js → chunk-XPW4576I-BQtjckSw.js} +1 -1
  55. package/dist/public/assets/{chunk-YZCP3GAM-CiWxV9XS.js → chunk-YZCP3GAM-CjxtydJy.js} +1 -1
  56. package/dist/public/assets/{chunk-ZZ45TVLE-B7t5_MqN.js → chunk-ZZ45TVLE-D0y4RiW0.js} +1 -1
  57. package/dist/public/assets/classDiagram-6PBFFD2Q-CQWW9Gah.js +1 -0
  58. package/dist/public/assets/classDiagram-v2-HSJHXN6E-BLv6Pgu5.js +1 -0
  59. package/dist/public/assets/clone-bY7YorPK.js +1 -0
  60. package/dist/public/assets/config-validation-events-OLcd2xaS.js +10 -0
  61. package/dist/public/assets/{cose-bilkent-S5V4N54A-BjJ-OKPr.js → cose-bilkent-S5V4N54A-D7YGD8wq.js} +1 -1
  62. package/dist/public/assets/{dagre-BuFRtOcC.js → dagre-DMcENKoE.js} +1 -1
  63. package/dist/public/assets/{dagre-KV5264BT-BpBW6R71.js → dagre-KV5264BT-BqnXUWtP.js} +1 -1
  64. package/dist/public/assets/{diagram-5BDNPKRD-B5phtkJp.js → diagram-5BDNPKRD-vW7QcnnV.js} +1 -1
  65. package/dist/public/assets/{diagram-G4DWMVQ6-tjReW6yx.js → diagram-G4DWMVQ6-Da6SwXmu.js} +1 -1
  66. package/dist/public/assets/{diagram-MMDJMWI5-b4CgKryF.js → diagram-MMDJMWI5-dI7u2q2_.js} +1 -1
  67. package/dist/public/assets/{diagram-TYMM5635-D5B0g2lj.js → diagram-TYMM5635-CPHmeIdk.js} +1 -1
  68. package/dist/public/assets/dialog-bA5Nvc2p.js +45 -0
  69. package/dist/public/assets/{dist-DQ1oWohr.js → dist-BPdgMMrT.js} +1 -1
  70. package/dist/public/assets/{dist-D3YXABda.js → dist-BzP1Tn1M.js} +1 -1
  71. package/dist/public/assets/dist-CQw2y-s3.js +1 -0
  72. package/dist/public/assets/{dist-D-oqC0-R.js → dist-ChXyuS-V.js} +1 -1
  73. package/dist/public/assets/{dist-DpEGxZ9h.js → dist-DBGkcnST.js} +1 -1
  74. package/dist/public/assets/{dist-DXgyWuz5.js → dist-J4_ocm9a.js} +1 -1
  75. package/dist/public/assets/{dist-By89CQBy.js → dist-Wjnnj7ws.js} +1 -1
  76. package/dist/public/assets/{dist-DllAuqQQ.js → dist-rBb7QGSM.js} +1 -1
  77. package/dist/public/assets/{doc-hash-BUfOgpiD.js → doc-hash-BrKkCdCz.js} +1 -1
  78. package/dist/public/assets/{erDiagram-SMLLAGMA-CRJz10Jv.js → erDiagram-SMLLAGMA-DitwrtLX.js} +1 -1
  79. package/dist/public/assets/{flatten-BWAerz3O.js → flatten-ptFIxnDZ.js} +1 -1
  80. package/dist/public/assets/{flowDiagram-DWJPFMVM-BDCJTgJ7.js → flowDiagram-DWJPFMVM-C0gFyX_S.js} +1 -1
  81. package/dist/public/assets/{ganttDiagram-T4ZO3ILL-cPQKlGYc.js → ganttDiagram-T4ZO3ILL-tiotNOZI.js} +1 -1
  82. package/dist/public/assets/gitGraph-7Q5UKJZL-EPtzLtdn.js +1 -0
  83. package/dist/public/assets/{gitGraphDiagram-UUTBAWPF-BMyjc352.js → gitGraphDiagram-UUTBAWPF-DMvh5XLj.js} +1 -1
  84. package/dist/public/assets/{graphlib-BU8FnRz1.js → graphlib-BrqdZy8t.js} +1 -1
  85. package/dist/public/assets/index-DoV-kWhK.js +1916 -0
  86. package/dist/public/assets/info-OMHHGYJF-DhGHQOTJ.js +1 -0
  87. package/dist/public/assets/{infoDiagram-42DDH7IO-BZ6v5y-j.js → infoDiagram-42DDH7IO-DKk8uvIK.js} +1 -1
  88. package/dist/public/assets/{isEmpty-Cairwk5V.js → isEmpty-Dff4GQVw.js} +1 -1
  89. package/dist/public/assets/isSymbol-DIRIUNhN.js +1 -0
  90. package/dist/public/assets/{ishikawaDiagram-UXIWVN3A-DA7_P2Up.js → ishikawaDiagram-UXIWVN3A-CdKANno1.js} +1 -1
  91. package/dist/public/assets/{journeyDiagram-VCZTEJTY-CzZoB161.js → journeyDiagram-VCZTEJTY-DbR4q1G1.js} +1 -1
  92. package/dist/public/assets/{kanban-definition-6JOO6SKY-DKg7pXv1.js → kanban-definition-6JOO6SKY-dx60koQU.js} +1 -1
  93. package/dist/public/assets/{line-DGc-MCyQ.js → line--3PJLF7I.js} +1 -1
  94. package/dist/public/assets/{linear-D6wzOaQP.js → linear-B5hCL-s4.js} +1 -1
  95. package/dist/public/assets/{mermaid-parser.core-Bm2u0Ges.js → mermaid-parser.core-DfyX5Z2V.js} +2 -2
  96. package/dist/public/assets/{mermaid.core-DRx0wZe0.js → mermaid.core-3naqvDT_.js} +3 -3
  97. package/dist/public/assets/{mindmap-definition-QFDTVHPH-C9GRZxO6.js → mindmap-definition-QFDTVHPH-B6GzcY6Y.js} +1 -1
  98. package/dist/public/assets/{now-BN_Nj6nz.js → now-y3Cm704C.js} +1 -1
  99. package/dist/public/assets/{ordinal-Dk6d5Y-0.js → ordinal-CdtiT3iH.js} +1 -1
  100. package/dist/public/assets/packet-4T2RLAQJ-dOkbaGJi.js +1 -0
  101. package/dist/public/assets/pie-ZZUOXDRM-7mxWmZMD.js +1 -0
  102. package/dist/public/assets/{pieDiagram-DEJITSTG-L6I3ft9Z.js → pieDiagram-DEJITSTG-DpAjvB-E.js} +1 -1
  103. package/dist/public/assets/{propagation-api-3kmMXRwS.js → propagation-api-CobBjsTC.js} +1 -1
  104. package/dist/public/assets/{quadrantDiagram-34T5L4WZ-Dp2IeEPC.js → quadrantDiagram-34T5L4WZ-Cfy7zW3N.js} +1 -1
  105. package/dist/public/assets/radar-PYXPWWZC-CYrvwt0c.js +1 -0
  106. package/dist/public/assets/{reduce-CSWSFqzz.js → reduce-C8tvPXVb.js} +1 -1
  107. package/dist/public/assets/{requirementDiagram-MS252O5E-BxNWyIZg.js → requirementDiagram-MS252O5E-Bq0qocwq.js} +1 -1
  108. package/dist/public/assets/{sankeyDiagram-XADWPNL6-CRn0_xkw.js → sankeyDiagram-XADWPNL6-Cs_gUjif.js} +1 -1
  109. package/dist/public/assets/{sequenceDiagram-FGHM5R23-Drkjb1j4.js → sequenceDiagram-FGHM5R23-mAj4_C_D.js} +1 -1
  110. package/dist/public/assets/{src-DZeiyxTL.js → src-BqeO7p9A.js} +1 -1
  111. package/dist/public/assets/{stateDiagram-FHFEXIEX-BBUFKS0u.js → stateDiagram-FHFEXIEX-Dl7UQcWR.js} +1 -1
  112. package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-BBPg5CA6.js +1 -0
  113. package/dist/public/assets/{target-navigation-intent-Bg_vCLDN.js → target-navigation-intent-B5Xuyiwx.js} +1 -1
  114. package/dist/public/assets/{telemetry-impl-DPRMO_b_.js → telemetry-impl-4gFdQtY5.js} +2 -2
  115. package/dist/public/assets/{timeline-definition-GMOUNBTQ-CLoe9y-z.js → timeline-definition-GMOUNBTQ-BsJlKEZE.js} +1 -1
  116. package/dist/public/assets/{toggle-group-BvHaWPjZ.js → toggle-group-Dzandm58.js} +1 -1
  117. package/dist/public/assets/treeView-SZITEDCU-bf7fN5vg.js +1 -0
  118. package/dist/public/assets/treemap-W4RFUUIX-DeijdxYt.js +1 -0
  119. package/dist/public/assets/{typing-burst-detector-xohyxOCA.js → typing-burst-detector-tbQ3pXg5.js} +1 -1
  120. package/dist/public/assets/{vennDiagram-DHZGUBPP-q2zdiy4F.js → vennDiagram-DHZGUBPP-8a9bTsJc.js} +1 -1
  121. package/dist/public/assets/wardley-RL74JXVD-XbGOizT8.js +1 -0
  122. package/dist/public/assets/{wardleyDiagram-NUSXRM2D-Njg6YHso.js → wardleyDiagram-NUSXRM2D-C_5vGuXg.js} +1 -1
  123. package/dist/public/assets/{xychartDiagram-5P7HB3ND-Ct8Wgp45.js → xychartDiagram-5P7HB3ND-C-11ks2d.js} +1 -1
  124. package/dist/public/index.html +24 -23
  125. package/dist/{repair-launch-json-CKIaPf4Q.mjs → repair-launch-json-ChOioNjY.mjs} +2 -2
  126. package/dist/{repair-mcp-configs-nHEH7ZXG.mjs → repair-mcp-configs-KXG6sJju.mjs} +2 -2
  127. package/dist/{src-DJUgVPb0.mjs → src-C-7gHcnB.mjs} +2 -2
  128. package/dist/start-CNPhu259.mjs +1 -0
  129. package/dist/{start-B0qxkaI0.mjs → start-vBx0y7gg.mjs} +2 -2
  130. package/package.json +1 -1
  131. package/dist/constants-HL-7SyJ2.mjs +0 -2
  132. package/dist/init-BtOr-X4H.mjs +0 -1
  133. package/dist/loader-BGK5A8F9.mjs +0 -1
  134. package/dist/preview-DZKfHXsi.mjs +0 -1
  135. package/dist/public/assets/ActivityModeContent-Dgodq1_3.js +0 -2
  136. package/dist/public/assets/ActivityPanelDiffView-d4ec9M69.js +0 -13
  137. package/dist/public/assets/ConsentDialogBody-Y-YFxY-Y.js +0 -2
  138. package/dist/public/assets/DocumentContext-CqL0pPxh.js +0 -62
  139. package/dist/public/assets/McpConsentDialogBody-CR1y0qI_.js +0 -1
  140. package/dist/public/assets/SettingsDialogBody-E4CxiCsR.js +0 -7
  141. package/dist/public/assets/architecture-YZFGNWBL-B2pJrg2X.js +0 -1
  142. package/dist/public/assets/channel-BqqURnVG.js +0 -1
  143. package/dist/public/assets/checkbox-BLSL0WqH.js +0 -1
  144. package/dist/public/assets/chunk-426QAEUC-CuPmuy8t.js +0 -1
  145. package/dist/public/assets/chunk-55IACEB6-BRPDx2aU.js +0 -1
  146. package/dist/public/assets/chunk-QZHKN3VN-CTZ4su3-.js +0 -1
  147. package/dist/public/assets/classDiagram-6PBFFD2Q-DrN_pUa5.js +0 -1
  148. package/dist/public/assets/classDiagram-v2-HSJHXN6E-C1MJ1Ukt.js +0 -1
  149. package/dist/public/assets/clone-CecJCxEU.js +0 -1
  150. package/dist/public/assets/config-validation-events-BAWD3yoI.js +0 -10
  151. package/dist/public/assets/dialog-B6QxSuMP.js +0 -45
  152. package/dist/public/assets/gitGraph-7Q5UKJZL-BMann5g7.js +0 -1
  153. package/dist/public/assets/index-DrLQYAlB.js +0 -1916
  154. package/dist/public/assets/info-OMHHGYJF-CKMkwFH6.js +0 -1
  155. package/dist/public/assets/isSymbol-BKUBGC2u.js +0 -1
  156. package/dist/public/assets/packet-4T2RLAQJ-DXn_0fd3.js +0 -1
  157. package/dist/public/assets/pie-ZZUOXDRM-BdZBZPW9.js +0 -1
  158. package/dist/public/assets/radar-PYXPWWZC-yUE2OrUV.js +0 -1
  159. package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-BtYsWsIg.js +0 -1
  160. package/dist/public/assets/treeView-SZITEDCU-BjJ_gnFc.js +0 -1
  161. package/dist/public/assets/treemap-W4RFUUIX-DiV984fD.js +0 -1
  162. package/dist/public/assets/wardley-RL74JXVD-DbPCtCHV.js +0 -1
  163. package/dist/start-BS3czGsk.mjs +0 -1
  164. /package/dist/public/assets/{__vite-browser-external-Bet_nOzq.js → __vite-browser-external-CCyf2WTU.js} +0 -0
  165. /package/dist/public/assets/{array-DfeqBzds.js → array-B4rubdDx.js} +0 -0
  166. /package/dist/public/assets/{collapsible-CYwJ8q8x.js → collapsible-DfUFsfqv.js} +0 -0
  167. /package/dist/public/assets/{colors-CuFmRbNJ.js → colors-DTkp5rhC.js} +0 -0
  168. /package/dist/public/assets/{cytoscape.esm-C3hcpWGW.js → cytoscape.esm-lL68JtBB.js} +0 -0
  169. /package/dist/public/assets/{defaultLocale-CmG7Nywc.js → defaultLocale-VDKImYxX.js} +0 -0
  170. /package/dist/public/assets/{dist-GFox5lpz.js → dist-Df8SLnPf.js} +0 -0
  171. /package/dist/public/assets/{go-BjDSeE19.js → go-D1ad2i41.js} +0 -0
  172. /package/dist/public/assets/{init-D-V7N9g_.js → init-B4uw1rya.js} +0 -0
  173. /package/dist/public/assets/{isObjectLike-HLvQwJYx.js → isObjectLike-DkPsJ8ZC.js} +0 -0
  174. /package/dist/public/assets/{katex-DX-tM4Fr.js → katex-qwlL5fSd.js} +0 -0
  175. /package/dist/public/assets/{label-Bdsqm1CY.js → label-D2tjsHNp.js} +0 -0
  176. /package/dist/public/assets/{mcp-consent-store-BPw6Zd40.js → mcp-consent-store-DncCuarR.js} +0 -0
  177. /package/dist/public/assets/{min-CHzARyU6.js → min-DTUJKQNu.js} +0 -0
  178. /package/dist/public/assets/{path-Bf8MP5yP.js → path-flVp2dgl.js} +0 -0
  179. /package/dist/public/assets/{pdf-wFLJduM2.js → pdf-zy6UKR6F.js} +0 -0
  180. /package/dist/public/assets/{pdf.worker-CP44mBOj.js → pdf.worker-CETvIAHl.js} +0 -0
  181. /package/dist/public/assets/{project-paths-DKT5BePl.js → project-paths-6yNxfBJd.js} +0 -0
  182. /package/dist/public/assets/{rough.esm-Di0388iR.js → rough.esm-pmFy2cex.js} +0 -0
  183. /package/dist/public/assets/{shell-184Lov7C.js → shell-FUK9YCOo.js} +0 -0
  184. /package/dist/public/assets/{src-Dz70a8sm.js → src-CdWhPaRj.js} +0 -0
  185. /package/dist/public/assets/{stex-ChE_gMQ6.js → stex-BUy0wSq4.js} +0 -0
  186. /package/dist/public/assets/{textarea-CQGiqhkV.js → textarea-CzzwWKq0.js} +0 -0
  187. /package/dist/public/assets/{trace-api-CiCjX4Sz.js → trace-api-3dczfLSc.js} +0 -0
  188. /package/dist/public/assets/{w3c-keyname-B5t0fahT.js → w3c-keyname-BSTW6KzM.js} +0 -0
@@ -3,7 +3,7 @@ name: open-knowledge-discovery
3
3
  description: "Read when the user asks what Open Knowledge is, wants to install it on a repository, wants to share an Open Knowledge project with collaborators, or asks how `ok init` / `ok install-skill` / OK Desktop set up a project. Do NOT load to perform Open Knowledge reads/writes — the runtime guidance for editing markdown inside an initialized OK project ships as a separate project-local skill at `.claude/skills/open-knowledge/` whenever `ok init` runs. If the user appears to be editing markdown inside a `.ok/` project and this is the only OK skill loaded, advise them to re-run `ok init` to install the project-local skill."
4
4
  compatibility: "Any agent host — no MCP server required. Pure discovery + install guidance."
5
5
  metadata:
6
- version: "0.6.0-beta.8"
6
+ version: "0.6.0-beta.9"
7
7
  author: "Inkeep"
8
8
  repository: "https://github.com/inkeep/open-knowledge"
9
9
  ---
@@ -3,7 +3,7 @@ name: open-knowledge
3
3
  description: "MUST invoke before reading or editing any `.md` / `.mdx` file, and before any `mcp__open-knowledge__*` tool call (`exec`, `search`, `write_document`, `edit_document`, and the rest). This skill is installed into the repository by `ok init`, so its presence alone means this is an Open Knowledge project — its runtime contract governs every markdown file here, with no need to probe for a `.ok/` directory. Authoritative agent-runtime contract; supersedes the overlapping MCP server `instructions` echo."
4
4
  compatibility: "Claude Code, Claude Desktop, Claude Cowork, Claude.ai web. Requires Open Knowledge MCP server + code execution."
5
5
  metadata:
6
- version: "0.6.0-beta.8"
6
+ version: "0.6.0-beta.9"
7
7
  author: "Inkeep"
8
8
  repository: "https://github.com/inkeep/open-knowledge"
9
9
  ---
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{o as e}from"./chunk-FK9Q3tQk.mjs";import{t}from"./esm-CEs3LWY3.mjs";import{Ai as n,B as r,Ci as i,D as a,Di as o,E as s,Ei as c,En as l,Gr as u,Hr as d,Jr as f,Kr as p,Oi as m,Rn as h,Si as g,Ti as _,U as v,Ur as ee,Vr as te,Wn as y,Wr as b,Wt as ne,Yr as re,Z as ie,_i as ae,bi as oe,fi as se,fn as ce,it as le,ji as ue,ki as de,m as fe,nt as pe,qn as me,sr as he,tn as ge,wi as _e,xi as x,yi as ve,z as ye}from"./dist-soQLoIV1.mjs";import{n as be,r as xe,t as S}from"./dist-bundle-BSdjl7Rj.mjs";import{A as Se,C as Ce,D as we,E as Te,O as Ee,S as De,T as Oe,b as ke,j as Ae,k as je,o as Me,p as Ne,w as Pe,x as Fe}from"./init-al09RZM6.mjs";import{c as Ie,f as Le,l as Re,n as ze,s as C}from"./server-lock-D7DXNVql-BRVVzA6T.mjs";import{i as Be}from"./git-handle-DwfYp_z--CfyPz4Dz.mjs";import{n as Ve}from"./constants-HL-7SyJ2.mjs";import{i as He}from"./src-DJUgVPb0.mjs";import{n as Ue,t as We}from"./loader-B64XEbbD.mjs";import{d as Ge,f as Ke,l as qe,m as Je,p as Ye,s as Xe}from"./start-B0qxkaI0.mjs";import{c as Ze,i as Qe,n as w,o as T,r as E,s as D,t as O}from"./colors-BtKMHmBX.mjs";import{execFileSync as $e,execSync as et,spawn as tt,spawnSync as k}from"node:child_process";import nt,{basename as rt,dirname as it,isAbsolute as at,join as A,relative as ot,resolve as j}from"node:path";import{closeSync as st,existsSync as M,lstatSync as ct,mkdirSync as lt,mkdtempSync as ut,openSync as dt,readFileSync as N,readdirSync as ft,realpathSync as pt,rmSync as mt,statSync as ht,unlinkSync as gt,writeFileSync as _t}from"node:fs";import vt from"node:process";import{homedir as yt,hostname as bt,tmpdir as xt}from"node:os";import{fileURLToPath as St}from"node:url";import{AsyncLocalStorage as Ct,AsyncResource as wt}from"node:async_hooks";import{stripVTControlCharacters as Tt,styleText as P}from"node:util";import*as Et from"node:readline";import{randomUUID as Dt}from"node:crypto";import{realpath as Ot}from"node:fs/promises";import{setTimeout as kt}from"node:timers/promises";import{createInterface as At}from"node:readline/promises";var jt=ue();const Mt=`open-knowledge`;var Nt=class{backend=`keyring`;async get(e){let{Entry:t}=await import(`@napi-rs/keyring`);try{let n=new t(Mt,e).getPassword();return n==null?null:JSON.parse(n)}catch{return null}}async set(e,t,n,r){let{Entry:i}=await import(`@napi-rs/keyring`),a=new i(Mt,e),o={login:t,token:n,...r};a.setPassword(JSON.stringify(o))}async clear(e){let{Entry:t}=await import(`@napi-rs/keyring`);try{new t(Mt,e).deletePassword()}catch{}}},Pt=class{backend=`file`;authFile;constructor(e){this.authFile=e??A(yt(),`.ok`,`auth.yml`)}read(){if(!M(this.authFile))return{};try{return(0,jt.parse)(N(this.authFile,`utf-8`))??{}}catch(e){let t=e instanceof Error?e.message:`unknown error`;return process.stderr.write(`[auth] Failed to parse ${this.authFile}: ${t}. Starting with empty credentials.\n`),{}}}write(e){let t=it(this.authFile);M(t)||lt(t,{recursive:!0,mode:448}),_t(this.authFile,(0,jt.stringify)(e),{mode:384})}async get(e){return this.read()[e]??null}async set(e,t,n,r){let i=this.read();i[e]={login:t,token:n,...r},this.write(i)}async clear(e){let t=this.read();delete t[e],this.write(t)}};async function Ft(e){try{let{Entry:e}=await import(`@napi-rs/keyring`);return new e(Mt,`__probe__`),process.stderr.write(`[auth] token storage: OS keychain
2
+ import{o as e}from"./chunk-FK9Q3tQk.mjs";import{t}from"./esm-CEs3LWY3.mjs";import{Ai as n,B as r,Ci as i,D as a,Di as o,E as s,Ei as c,En as l,Gr as u,Hr as d,Jr as f,Kr as p,Oi as m,Rn as h,Si as g,Ti as _,U as v,Ur as ee,Vr as te,Wn as y,Wr as b,Wt as ne,Yr as re,Z as ie,_i as ae,bi as oe,fi as se,fn as ce,it as le,ji as ue,ki as de,m as fe,nt as pe,qn as me,sr as he,tn as ge,wi as _e,xi as x,yi as ve,z as ye}from"./dist-soQLoIV1.mjs";import{n as be,r as xe,t as S}from"./dist-bundle-BSdjl7Rj.mjs";import{A as Se,C as Ce,D as we,E as Te,O as Ee,S as De,T as Oe,b as ke,j as Ae,k as je,o as Me,p as Ne,w as Pe,x as Fe}from"./init-BG3i7h4P.mjs";import{c as Ie,f as Le,l as Re,n as ze,s as C}from"./server-lock-D7DXNVql-BRVVzA6T.mjs";import{i as Be}from"./git-handle-DwfYp_z--CfyPz4Dz.mjs";import{n as Ve}from"./constants-CkYsa36O.mjs";import{i as He}from"./src-C-7gHcnB.mjs";import{n as Ue,t as We}from"./loader-4X5eR4wo.mjs";import{d as Ge,f as Ke,l as qe,m as Je,p as Ye,s as Xe}from"./start-vBx0y7gg.mjs";import{c as Ze,i as Qe,n as w,o as T,r as E,s as D,t as O}from"./colors-BtKMHmBX.mjs";import{execFileSync as $e,execSync as et,spawn as tt,spawnSync as k}from"node:child_process";import nt,{basename as rt,dirname as it,isAbsolute as at,join as A,relative as ot,resolve as j}from"node:path";import{closeSync as st,existsSync as M,lstatSync as ct,mkdirSync as lt,mkdtempSync as ut,openSync as dt,readFileSync as N,readdirSync as ft,realpathSync as pt,rmSync as mt,statSync as ht,unlinkSync as gt,writeFileSync as _t}from"node:fs";import vt from"node:process";import{homedir as yt,hostname as bt,tmpdir as xt}from"node:os";import{fileURLToPath as St}from"node:url";import{AsyncLocalStorage as Ct,AsyncResource as wt}from"node:async_hooks";import{stripVTControlCharacters as Tt,styleText as P}from"node:util";import*as Et from"node:readline";import{randomUUID as Dt}from"node:crypto";import{realpath as Ot}from"node:fs/promises";import{setTimeout as kt}from"node:timers/promises";import{createInterface as At}from"node:readline/promises";var jt=ue();const Mt=`open-knowledge`;var Nt=class{backend=`keyring`;async get(e){let{Entry:t}=await import(`@napi-rs/keyring`);try{let n=new t(Mt,e).getPassword();return n==null?null:JSON.parse(n)}catch{return null}}async set(e,t,n,r){let{Entry:i}=await import(`@napi-rs/keyring`),a=new i(Mt,e),o={login:t,token:n,...r};a.setPassword(JSON.stringify(o))}async clear(e){let{Entry:t}=await import(`@napi-rs/keyring`);try{new t(Mt,e).deletePassword()}catch{}}},Pt=class{backend=`file`;authFile;constructor(e){this.authFile=e??A(yt(),`.ok`,`auth.yml`)}read(){if(!M(this.authFile))return{};try{return(0,jt.parse)(N(this.authFile,`utf-8`))??{}}catch(e){let t=e instanceof Error?e.message:`unknown error`;return process.stderr.write(`[auth] Failed to parse ${this.authFile}: ${t}. Starting with empty credentials.\n`),{}}}write(e){let t=it(this.authFile);M(t)||lt(t,{recursive:!0,mode:448}),_t(this.authFile,(0,jt.stringify)(e),{mode:384})}async get(e){return this.read()[e]??null}async set(e,t,n,r){let i=this.read();i[e]={login:t,token:n,...r},this.write(i)}async clear(e){let t=this.read();delete t[e],this.write(t)}};async function Ft(e){try{let{Entry:e}=await import(`@napi-rs/keyring`);return new e(Mt,`__probe__`),process.stderr.write(`[auth] token storage: OS keychain
3
3
  `),new Nt}catch{return process.stderr.write(`[auth] token storage: file (~/.ok/auth.yml)
4
4
  `),new Pt(e)}}async function It(e,t){let n=[],r=new Pt(t);await r.get(e)!=null&&(await r.clear(e),n.push(`file`));try{let{Entry:t}=await import(`@napi-rs/keyring`);new t(Mt,`__probe__`);let r=new Nt;await r.get(e)!=null&&(await r.clear(e),n.push(`keychain`))}catch{}return{touched:n}}async function Lt(e,t,n){let r=Rt(await zt(e)).host??``;if(!r)return 1;let i=await n.get(r);if(i==null)return 1;let a=e=>e.replace(/[\r\n]/g,``);return t.write(`username=${a(i.login)}\npassword=${a(i.token)}\n`),0}function Rt(e){let t={};for(let n of e.split(`
5
5
  `)){let e=n.trim();if(e===``)continue;let r=e.indexOf(`=`);r!==-1&&(t[e.slice(0,r)]=e.slice(r+1))}return t}function zt(e){return new Promise((t,n)=>{let r=[];e.on(`data`,e=>r.push(e)),e.on(`end`,()=>t(Buffer.concat(r).toString(`utf-8`))),e.on(`error`,n)})}function Bt(e){let n=new t(`git-credential`);return n.description(`Git credential helper (git credential-helper protocol)`),n.command(`get`).description(`Lookup credentials from TokenStore (called by git)`).action(async()=>{let t=await e(),n=await Lt(process.stdin,process.stdout,t);process.exit(n)}),n}function Vt(e){let t=e.endpoint.DEFAULTS;return/^https:\/\/(api\.)?github\.com$/.test(t.baseUrl)?`https://github.com`:t.baseUrl.replace(`/api/v3`,``)}async function Ht(e,t,n){let r={baseUrl:Vt(e),headers:{accept:`application/json`},...n},i=await e(t,r);if(`error`in i.data){let n=new be(`${i.data.error_description} (${i.data.error}, ${i.data.error_uri})`,400,{request:e.endpoint.merge(t,r)});throw n.response=i,n}return i}async function Ut(e){let t=e.request||S,n={client_id:e.clientId};return`scopes`in e&&Array.isArray(e.scopes)&&(n.scope=e.scopes.join(` `)),Ht(t,`POST /login/device/code`,n)}async function Wt(e){let t=await Ht(e.request||S,`POST /login/oauth/access_token`,{client_id:e.clientId,device_code:e.code,grant_type:`urn:ietf:params:oauth:grant-type:device_code`}),n={clientType:e.clientType,clientId:e.clientId,token:t.data.access_token,scopes:t.data.scope.split(/\s+/).filter(Boolean)};if(`clientSecret`in e&&(n.clientSecret=e.clientSecret),e.clientType===`github-app`){if(`refresh_token`in t.data){let e=new Date(t.headers.date).getTime();n.refreshToken=t.data.refresh_token,n.expiresAt=Gt(e,t.data.expires_in),n.refreshTokenExpiresAt=Gt(e,t.data.refresh_token_expires_in)}delete n.scopes}return{...t,authentication:n}}function Gt(e,t){return new Date(e+t*1e3).toISOString()}async function Kt(e,t){let n=qt(e,t.auth);if(n)return n;let{data:r}=await Ut({clientType:e.clientType,clientId:e.clientId,request:t.request||e.request,scopes:t.auth.scopes||e.scopes});await e.onVerification(r);let i=await Yt(t.request||e.request,e.clientId,e.clientType,r);return e.authentication=i,i}function qt(e,t){if(t.refresh===!0||!e.authentication)return!1;if(e.clientType===`github-app`)return e.authentication;let n=e.authentication;return(`scopes`in t&&t.scopes||e.scopes).join(` `)===n.scopes.join(` `)?n:!1}async function Jt(e){await new Promise(t=>setTimeout(t,e*1e3))}async function Yt(e,t,n,r){try{let i={clientId:t,request:e,code:r.device_code},{authentication:a}=n===`oauth-app`?await Wt({...i,clientType:`oauth-app`}):await Wt({...i,clientType:`github-app`});return{type:`token`,tokenType:`oauth`,...a}}catch(i){if(!i.response)throw i;let a=i.response.data.error;if(a===`authorization_pending`)return await Jt(r.interval),Yt(e,t,n,r);if(a===`slow_down`)return await Jt(r.interval+7),Yt(e,t,n,r);throw i}}async function Xt(e,t){return Kt(e,{auth:t})}async function Zt(e,t,n,r){let i=t.endpoint.merge(n,r);if(/\/login\/(oauth\/access_token|device\/code)$/.test(i.url))return t(i);let{token:a}=await Kt(e,{request:t,auth:{type:`oauth`}});return i.headers.authorization=`token ${a}`,t(i)}var Qt=`0.0.0-development`;function $t(e){let t=e.request||S.defaults({headers:{"user-agent":`octokit-auth-oauth-device.js/${Qt} ${xe()}`}}),{request:n=t,...r}=e,i=e.clientType===`github-app`?{...r,clientType:`github-app`,request:n}:{...r,clientType:`oauth-app`,request:n,scopes:e.scopes||[]};if(!e.clientId)throw Error(`[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)`);if(!e.onVerification)throw Error(`[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)`);return Object.assign(Xt.bind(null,i),{hook:Zt.bind(null,i)})}async function en(e){let{clientId:t,scopes:n=[`repo`,`read:user`,`user:email`],onVerification:r,host:i}=e,a=i&&i!==`github.com`?`https://${i}/api/v3`:`https://api.github.com`,o=$t({clientType:`oauth-app`,clientId:t,scopes:n,onVerification:async e=>{await r({verificationUri:e.verification_uri,userCode:e.user_code,expiresIn:e.expires_in,interval:e.interval})},request:a===`https://api.github.com`?void 0:(await import(`./dist-bundle-BmF5_Mcp.mjs`)).request.defaults({baseUrl:a})}),s;try{s=await o({type:`oauth`})}catch(e){if(e instanceof Error){let t=e.message.toLowerCase();throw t.includes(`access_denied`)?Error(`Device-flow authorization was denied.`):t.includes(`expired_token`)||t.includes(`timeout`)||t.includes(`timed out`)?Error(`Device-flow code expired before authorization — please try again.`):Error(`GitHub sign-in failed: ${e.message}`)}throw e}return{token:s.token,tokenType:s.tokenType,scopes:s.scopes??[]}}const tn={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`};var nn;(function(e){})(nn||={});function rn(e){return de(ve,e)}function an(){return process.env.OPEN_KNOWLEDGE_GITHUB_CLIENT_ID??`Ov23liqlSd0V1MwR6rhI`}const on=new Set([`gitlab.com`,`bitbucket.org`,`codeberg.org`,`gitea.com`,`sr.ht`,`sourcehut.org`]);function F(e){let t=e.toLowerCase().replace(/:\d+$/,``);on.has(t)&&(process.stderr.write(`Error: ${e} is not a GitHub host. Only GitHub and GitHub Enterprise Server are supported.\n`),process.exit(1))}function sn(e,t){e&&process.stdout.write(`${JSON.stringify(t)}\n`)}async function cn(e,t,n=en){let r=an(),{host:i,json:a}=e;F(i),a||process.stderr.write(`Logging in to ${i}\n`);let o=await n({clientId:r,host:i===`github.com`?void 0:i,onVerification:e=>{e.userCode,e.verificationUri,a?sn(!0,{type:`verification`,user_code:e.userCode,verification_uri:e.verificationUri,expires_in:e.expiresIn}):process.stderr.write(`Open: ${e.verificationUri}\nEnter code: ${e.userCode}\n`)}}),s=`unknown`,c,l;try{let e=i===`github.com`?`https://api.github.com`:`https://${i}/api/v3`,t=await fetch(`${e}/user`,{headers:{Authorization:`Bearer ${o.token}`,"User-Agent":`open-knowledge-cli`,Accept:`application/vnd.github+json`}});if(t.ok){let e=await t.json();s=e.login??s,c=e.name??void 0,l=e.email??void 0}}catch{}await t.set(i,s,o.token,{gitProtocol:`https`,name:c,email:l}),a?sn(!0,{type:`complete`,host:i,login:s}):process.stderr.write(`✓ Logged in as ${s} on ${i}\n`)}function ln(e){return new t(`login`).description(`Authenticate with GitHub via Device Flow`).option(`--host <host>`,`GitHub or GitHub Enterprise hostname`,`github.com`).option(`--json`,`Output JSONL progress events`,!1).action(async t=>{await cn(t,await e())})}const un=e=>e.name===`enter`||e.name===`return`;var dn=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},fn=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},pn=class extends Error{name=`ExitPromptError`},mn=class extends Error{name=`HookError`},hn=class extends Error{name=`ValidationError`};const gn=new Ct;function _n(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function vn(e,t){let n=_n(e);return gn.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function I(){let e=gn.getStore();if(!e)throw new mn(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function yn(){return I().rl}function bn(e){return wt.bind((...t)=>{let n=I(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function xn(e){let t=I(),{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 Sn(){I().handleChange()}const L={queue(e){let t=I(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(yn());if(r!=null&&typeof r!=`function`)throw new hn(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=I();bn(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=I();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function Cn(e){return typeof e==`function`}function R(e){return xn(t=>{let n=wt.bind(function(e){t.get()!==e&&(t.set(e),Sn())});if(t.initialized)return[t.get(),n];let r=Cn(e)?e():e;return t.set(r),[r,n]})}function wn(e,t){xn(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&L.queue(e),n.set(t)})}const Tn={prefix:{idle:P(`blue`,`?`),done:P(`green`,Ae.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>P(`yellow`,e))},style:{answer:e=>P(`cyan`,e),message:e=>P(`bold`,e),error:e=>P(`red`,`> ${e}`),defaultAnswer:e=>P(`dim`,`(${e})`),help:e=>P(`dim`,e),highlight:e=>P(`cyan`,e),key:e=>P(`cyan`,P(`bold`,`<${e}>`))}};function En(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 Dn(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=En(n)&&En(r)?Dn(n,r):r}return t}function On(...e){return Dn(Tn,...e.filter(e=>e!=null))}function kn({status:e=`idle`,theme:t}){let[n,r]=R(!1),[i,a]=R(0),{prefix:o,spinner:s}=On(t);return wn(()=>{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 An(e){return R({current:e})[0]}function jn(e){let t=An(e);t.current=e,wn(e=>{let n=!1,r=bn((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var Mn=e(Se(),1);function Nn(e,t){return e.split(`
@@ -19,10 +19,10 @@ import{o as e}from"./chunk-FK9Q3tQk.mjs";import{t}from"./esm-CEs3LWY3.mjs";impor
19
19
  `)}function Kr(){return new t(`signout`).description(`Remove stored credentials`).option(`--host <host>`,`GitHub hostname`,`github.com`).action(async e=>{await Gr(e)})}async function qr(e,t,n=Vr){let r=n(e);if(r.available&&r.token)return{tier:`A`,token:r.token};let i=await t.get(e);return i==null?{tier:`none`}:{tier:i.gitProtocol===`ssh`?`C`:`B`,token:i.token}}async function Jr(e,t){let{host:n,json:r}=e;F(n);let i=await qr(n,t);i.tier===`none`&&(r?process.stdout.write(`${JSON.stringify({type:`status`,host:n,authenticated:!1})}\n`):process.stderr.write(`Not logged in to ${n}\n`),process.exit(1));let a=n===`github.com`?void 0:`https://${n}/api/v3`,o=new B({auth:i.token,...a?{baseUrl:a}:{}});try{let{data:e}=await o.users.getAuthenticated();r?process.stdout.write(`${JSON.stringify({type:`status`,host:n,authenticated:!0,tier:i.tier,login:e.login,name:e.name,email:e.email})}\n`):process.stderr.write(`✓ Logged in as ${e.login} on ${n}\n`)}catch{r?process.stdout.write(JSON.stringify({type:`status`,host:n,authenticated:!1,error:`token invalid`})+`
20
20
  `):process.stderr.write(`✗ Token invalid for ${n}\n`),process.exit(1)}}function Yr(e){return new t(`status`).description(`Show authentication status`).option(`--host <host>`,`GitHub or GitHub Enterprise hostname`,`github.com`).option(`--json`,`Output JSON`,!1).action(async t=>{await Jr(t,await e())})}function Xr(){let e=new t(`auth`);e.description(`GitHub authentication management`);let n=()=>Ft();return e.addCommand(ln(n)),e.addCommand(Yr(n)),e.addCommand(Wr(n)),e.addCommand(Kr()),e.addCommand(zr(n)),e.addCommand(Bt(n)),e}function V(e,t,n={}){let r=Re(e,t);if(!M(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(N(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!Ie(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??C)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};let o=n.host??bt();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}function Zr(e,t){let n=[];for(let[r,i]of[[`server`,e],[`ui`,t]])(i.status===`dead-pid`||i.status===`corrupt`)&&n.push({name:r,lockPath:i.lockPath,reason:i.status});return{prune:n}}function Qr(e){let t=e.inspect??(t=>V(e.lockDir,t)),n=e.unlink??(e=>gt(e)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=Zr(t(`server`),t(`ui`));if(a.prune.length===0)return r(`No stale locks.`),{pruned:[],failed:[]};let o=[],s=[];for(let e of a.prune)try{n(e.lockPath),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}if(o.length>0){let e=o.map(e=>`${e.name} (${e.reason})`).join(`, `);r(`Pruned ${o.length} stale lock${o.length===1?``:`s`}: ${e}`)}return s.length>0&&i(`Failed to prune: ${s.map(({target:e,error:t})=>`${e.name} (${e.lockPath}): ${t}`).join(`; `)}`),{pruned:o,failed:s}}function $r(e){return new t(`clean`).description(`Prune stale / corrupt open-knowledge lock files (never touches live locks)`).action(()=>{e(),Qr({lockDir:me(process.cwd())}).failed.length>0&&(process.exitCode=1)})}async function ei(e,t,n={},r=Vr){if(!n.skipGhDetect&&r().available)return{tier:`A`,credentialArgs:[`-c`,`credential.helper=!gh auth git-credential`]};let i=await t.get(e);return i==null?{tier:`none`,credentialArgs:[]}:{tier:i.gitProtocol===`ssh`?`C`:`B`,credentialArgs:[`-c`,`credential.helper=!open-knowledge auth git-credential`]}}async function ti(e,t,n=fetch){let r=new AbortController,i=setTimeout(()=>r.abort(),5e3);try{return(await n(`https://api.github.com/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{signal:r.signal,headers:{"User-Agent":`open-knowledge-cli`,Accept:`application/vnd.github+json`}})).status===200}catch{return!1}finally{clearTimeout(i)}}const ni=[[`count`,0,10],[`compress`,10,20],[`receiv`,20,60],[`resolv`,60,100]];function ri(e){let t=/^([\w ]+):\s+(\d+)%/.exec(e.trim());if(!t)return null;let n=t[1].toLowerCase(),r=Number(t[2]);for(let[e,i,a]of ni)if(n.includes(e))return{stage:t[1],pct:Math.round(i+r/100*(a-i))};return null}function H(e,t){e&&process.stdout.write(`${JSON.stringify(t)}\n`)}function ii(e,t,n){return e===`https`&&t===`github.com`&&n}async function ai(e,t,n,r=process.cwd()){let i=He(e);if(!i)throw Error(`Invalid git URL: ${e}`);let a=t.dir?j(r,t.dir):j(r,i.name);if(M(a)&&ft(a).length>0)throw Error(`Target directory is not empty: ${a}`);let o=await Ft(),s=i.protocol===`https`&&i.hostname===`github.com`?await ti(i.owner,i.name):!1,c=ii(i.protocol,i.hostname,s)?{tier:`none`,credentialArgs:[]}:await ei(i.hostname,o,{}),l=Be({baseDir:r,config:c.credentialArgs.length>=2?[c.credentialArgs[1]]:[],unsafe:{allowUnsafeCredentialHelper:!0}}).env({GIT_TERMINAL_PROMPT:`0`}),u=-1;l.outputHandler((e,n,r)=>{r.on(`data`,e=>{let n=e.toString(`utf-8`);for(let e of n.split(`
21
21
  `)){let n=ri(e);n&&n.pct!==u&&(u=n.pct,H(t.json,{type:`progress`,pct:n.pct,stage:n.stage}),t.json||process.stderr.write(`\r Cloning ${n.pct}%`))}})}),await l.clone(e,a,[`--progress`]),t.json||process.stderr.write(`
22
- `);try{let{runInit:e}=await import(`./init-BtOr-X4H.mjs`),n=await e({cwd:a,mcp:!1});if(n.contentUpdated.length>0){let e=`auto-init: updated ${n.contentUpdated.join(`, `)}`;t.json?H(!0,{type:`warning`,message:e}):process.stderr.write(` ${e}\n`)}}catch(e){let n=e instanceof Error?e.message:String(e);t.json?H(!0,{type:`warning`,message:`auto-init: ${n}`}):process.stderr.write(` auto-init: ${n}\n`)}try{oi(a)}catch(e){let n=e instanceof Error?e.message:String(e);t.json?H(!0,{type:`warning`,message:`git-exclude: ${n}`}):process.stderr.write(` git-exclude: ${n}\n`)}return a}function oi(e){let t=A(e,`.git`,`info`,`exclude`);if(!M(t))return`no-exclude`;let n=N(t,`utf-8`),r=new Set([`.ok`,`.ok/`,`/.ok`,`/.ok/`]);return n.split(`
22
+ `);try{let{runInit:e}=await import(`./init-CGZULhvc.mjs`),n=await e({cwd:a,mcp:!1});if(n.contentUpdated.length>0){let e=`auto-init: updated ${n.contentUpdated.join(`, `)}`;t.json?H(!0,{type:`warning`,message:e}):process.stderr.write(` ${e}\n`)}}catch(e){let n=e instanceof Error?e.message:String(e);t.json?H(!0,{type:`warning`,message:`auto-init: ${n}`}):process.stderr.write(` auto-init: ${n}\n`)}try{oi(a)}catch(e){let n=e instanceof Error?e.message:String(e);t.json?H(!0,{type:`warning`,message:`git-exclude: ${n}`}):process.stderr.write(` git-exclude: ${n}\n`)}return a}function oi(e){let t=A(e,`.git`,`info`,`exclude`);if(!M(t))return`no-exclude`;let n=N(t,`utf-8`),r=new Set([`.ok`,`.ok/`,`/.ok`,`/.ok/`]);return n.split(`
23
23
  `).map(e=>e.trim()).some(e=>r.has(e))?`already-present`:(_t(t,`${n}${n.length===0||n.endsWith(`
24
24
  `)?``:`
25
- `}.ok/\n`,`utf-8`),`appended`)}function si(e){return new t(`clone`).description(`Clone a git repository and open it`).argument(`<url>`,`Repository URL or owner/repo shorthand`).argument(`[dir]`,`Target directory (default: ./<repo-name>)`).option(`--json`,`Output JSONL progress events`,!1).action(async(t,n,r)=>{let i=e();try{let a=await ai(t,{json:r.json,dir:n},i);if(r.json)H(!0,{type:`complete`,dir:a});else{process.stderr.write(`✓ Cloned to ${a}\n`),process.chdir(a);let{startCommand:t}=await import(`./start-BS3czGsk.mjs`);await t(e).parseAsync([],{from:`user`})}}catch(e){let t=e instanceof Error?e.message:String(e);r.json?H(!0,{type:`error`,message:t}):process.stderr.write(`✗ ${t}\n`),process.exitCode=1}})}const ci=[[`sync`],[`persistence`,`debounceMs`],[`persistence`,`maxDebounceMs`],[`server`,`port`],[`content`,`include`],[`content`,`exclude`]];function li(e={}){let t=e.log??(e=>console.error(e)),n=e.error??(e=>console.error(e)),r=e.loadConfigFn??Ue;try{let{sources:n}=r(e.cwd);return t(`✓ Configuration valid (sources: ${n.length===0?`defaults only`:n.join(`, `)})`),{ok:!0}}catch(e){return n(e instanceof Error?e.message:String(e)),{ok:!1}}}function ui(e){let t=(0,jt.parseDocument)(N(e,`utf-8`));if(t.errors.length>0)throw Error(`Could not parse ${e}: ${t.errors.map(e=>e.message).join(`; `)}`);let n=[];for(let e of ci)t.hasIn(e)&&n.push(e.join(`.`));return n}function di(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fi(e){let t={};for(let n of e){let e=t;for(let t=0;t<n.length-1;t++){let r=n[t],i=e[r],a=di(i)?i:{};e[r]=a,e=a}e[n[n.length-1]]=null}return t}async function pi(e={}){let t=e.log??(e=>console.log(e)),n=e.error??(e=>console.error(e)),r=e.scope??`both`,i=e.dryRun??!1,a=e.cwd??process.cwd(),o=e.writeConfigPatchFn??re,s=[];(r===`project`||r===`both`)&&s.push({scope:`project`,absPath:f(`project`,a,e.homedirOverride)}),(r===`user`||r===`both`)&&s.push({scope:`user`,absPath:f(`user`,a,e.homedirOverride)});let c=[],l=!0;for(let{scope:t,absPath:n}of s){if(!M(n)){c.push({path:n,scope:t,found:[],removed:[]});continue}let r;try{r=ui(n)}catch(e){let r=e instanceof Error?e.message:String(e);c.push({path:n,scope:t,found:[],removed:[],error:r}),l=!1;continue}if(r.length===0||i){c.push({path:n,scope:t,found:r,removed:[]});continue}let s=await o({cwd:a,scope:t,patch:fi(ci.filter(e=>r.includes(e.join(`.`)))),homedirOverride:e.homedirOverride});if(!s.ok){c.push({path:n,scope:t,found:r,removed:[],error:se(s.error)}),l=!1;continue}c.push({path:n,scope:t,found:r,removed:r})}for(let e of c)e.error&&n(`✗ ${e.path}: ${e.error}`);let u=c.some(e=>e.error!==void 0),d=c.reduce((e,t)=>e+t.found.length,0);if(d===0&&!u)t(`No deprecated fields found.`);else if(d>0)for(let e of c)e.error||(e.found.length===0?t(` ${e.path}: no deprecated fields`):t(i?`[dry-run] ${e.path}: would remove ${e.found.length} field(s): ${e.found.join(`, `)}`:`✓ ${e.path}: removed ${e.removed.length} field(s): ${e.removed.join(`, `)}`));return{outcomes:c,ok:l}}function mi(){let e=new t(`config`).description(`Inspect and maintain Open Knowledge configuration files`);return e.command(`validate`).description(`Validate the merged config (defaults → user → project)`).action(()=>{li({}).ok||(process.exitCode=1)}),e.command(`migrate`).description(`Remove deprecated config fields (sync.*, persistence.{debounceMs,maxDebounceMs}, server.port, content.{include,exclude}) idempotently`).option(`--scope <scope>`,`Which scope to migrate: project | user | both`,`both`).option(`--dry-run`,`Preview without writing`,!1).action(async e=>{let t=e.scope;if(t!==`project`&&t!==`user`&&t!==`both`){console.error(`Invalid --scope: ${t}. Expected: project | user | both`),process.exitCode=2;return}(await pi({scope:t,dryRun:e.dryRun})).ok||(process.exitCode=1)}),e}var U=e(Ze(),1);const W=2e3,hi=2e3,gi=[/cli\.mjs/,/(^|[\s/])(open-knowledge|ok)\s+(start|mcp|ui)(\s|$)/,/Open Knowledge(?:\.app| Helper)/,/(^|[\s/])bun([\s/]).*?(run dev|packages\/app|vite|hocuspocus)/,/(^|[\s/])node([\s/]).*?(packages\/(cli|app)|vite|hocuspocus)/,/(^|\s)--ok-lock-dir-b64=/,/(^|\s)--ok-project-path=/];function _i(e){return gi.some(t=>t.test(e))}function vi(e){let t=e.trim().split(/\s+/).find(e=>e.startsWith(`--ok-lock-dir-b64=`));if(t==null)return null;let n=t.slice(18);if(!n)return null;try{let e=Buffer.from(n,`base64url`).toString(`utf8`);return at(e)?e:null}catch{return null}}function yi(e){let t=e.indexOf(`--ok-project-path=`);if(t===-1)return null;let n=t+18,r=e.slice(n),i=r.search(/\s--/),a=(i===-1?r:r.slice(0,i)).trim();return a&&at(a)?a:null}function bi(e){let t=[];for(let n of e.split(`
25
+ `}.ok/\n`,`utf-8`),`appended`)}function si(e){return new t(`clone`).description(`Clone a git repository and open it`).argument(`<url>`,`Repository URL or owner/repo shorthand`).argument(`[dir]`,`Target directory (default: ./<repo-name>)`).option(`--json`,`Output JSONL progress events`,!1).action(async(t,n,r)=>{let i=e();try{let a=await ai(t,{json:r.json,dir:n},i);if(r.json)H(!0,{type:`complete`,dir:a});else{process.stderr.write(`✓ Cloned to ${a}\n`),process.chdir(a);let{startCommand:t}=await import(`./start-CNPhu259.mjs`);await t(e).parseAsync([],{from:`user`})}}catch(e){let t=e instanceof Error?e.message:String(e);r.json?H(!0,{type:`error`,message:t}):process.stderr.write(`✗ ${t}\n`),process.exitCode=1}})}const ci=[[`sync`],[`persistence`,`debounceMs`],[`persistence`,`maxDebounceMs`],[`server`,`port`],[`content`,`include`],[`content`,`exclude`]];function li(e={}){let t=e.log??(e=>console.error(e)),n=e.error??(e=>console.error(e)),r=e.loadConfigFn??Ue;try{let{sources:n}=r(e.cwd);return t(`✓ Configuration valid (sources: ${n.length===0?`defaults only`:n.join(`, `)})`),{ok:!0}}catch(e){return n(e instanceof Error?e.message:String(e)),{ok:!1}}}function ui(e){let t=(0,jt.parseDocument)(N(e,`utf-8`));if(t.errors.length>0)throw Error(`Could not parse ${e}: ${t.errors.map(e=>e.message).join(`; `)}`);let n=[];for(let e of ci)t.hasIn(e)&&n.push(e.join(`.`));return n}function di(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fi(e){let t={};for(let n of e){let e=t;for(let t=0;t<n.length-1;t++){let r=n[t],i=e[r],a=di(i)?i:{};e[r]=a,e=a}e[n[n.length-1]]=null}return t}async function pi(e={}){let t=e.log??(e=>console.log(e)),n=e.error??(e=>console.error(e)),r=e.scope??`both`,i=e.dryRun??!1,a=e.cwd??process.cwd(),o=e.writeConfigPatchFn??re,s=[];(r===`project`||r===`both`)&&s.push({scope:`project`,absPath:f(`project`,a,e.homedirOverride)}),(r===`user`||r===`both`)&&s.push({scope:`user`,absPath:f(`user`,a,e.homedirOverride)});let c=[],l=!0;for(let{scope:t,absPath:n}of s){if(!M(n)){c.push({path:n,scope:t,found:[],removed:[]});continue}let r;try{r=ui(n)}catch(e){let r=e instanceof Error?e.message:String(e);c.push({path:n,scope:t,found:[],removed:[],error:r}),l=!1;continue}if(r.length===0||i){c.push({path:n,scope:t,found:r,removed:[]});continue}let s=await o({cwd:a,scope:t,patch:fi(ci.filter(e=>r.includes(e.join(`.`)))),homedirOverride:e.homedirOverride});if(!s.ok){c.push({path:n,scope:t,found:r,removed:[],error:se(s.error)}),l=!1;continue}c.push({path:n,scope:t,found:r,removed:r})}for(let e of c)e.error&&n(`✗ ${e.path}: ${e.error}`);let u=c.some(e=>e.error!==void 0),d=c.reduce((e,t)=>e+t.found.length,0);if(d===0&&!u)t(`No deprecated fields found.`);else if(d>0)for(let e of c)e.error||(e.found.length===0?t(` ${e.path}: no deprecated fields`):t(i?`[dry-run] ${e.path}: would remove ${e.found.length} field(s): ${e.found.join(`, `)}`:`✓ ${e.path}: removed ${e.removed.length} field(s): ${e.removed.join(`, `)}`));return{outcomes:c,ok:l}}function mi(){let e=new t(`config`).description(`Inspect and maintain Open Knowledge configuration files`);return e.command(`validate`).description(`Validate the merged config (defaults → user → project)`).action(()=>{li({}).ok||(process.exitCode=1)}),e.command(`migrate`).description(`Remove deprecated config fields (sync.*, persistence.{debounceMs,maxDebounceMs}, server.port, content.{include,exclude}) idempotently`).option(`--scope <scope>`,`Which scope to migrate: project | user | both`,`both`).option(`--dry-run`,`Preview without writing`,!1).action(async e=>{let t=e.scope;if(t!==`project`&&t!==`user`&&t!==`both`){console.error(`Invalid --scope: ${t}. Expected: project | user | both`),process.exitCode=2;return}(await pi({scope:t,dryRun:e.dryRun})).ok||(process.exitCode=1)}),e}var U=e(Ze(),1);const W=2e3,hi=2e3,gi=[/cli\.mjs/,/(^|[\s/])(open-knowledge|ok)\s+(start|mcp|ui)(\s|$)/,/Open Knowledge(?:\.app| Helper)/,/(^|[\s/])bun([\s/]).*?(run dev|packages\/app|vite|hocuspocus)/,/(^|[\s/])node([\s/]).*?(packages\/(cli|app)|vite|hocuspocus)/,/(^|\s)--ok-lock-dir-b64=/,/(^|\s)--ok-project-path=/];function _i(e){return gi.some(t=>t.test(e))}function vi(e){let t=e.trim().split(/\s+/).find(e=>e.startsWith(`--ok-lock-dir-b64=`));if(t==null)return null;let n=t.slice(18);if(!n)return null;try{let e=Buffer.from(n,`base64url`).toString(`utf8`);return at(e)?e:null}catch{return null}}function yi(e){let t=e.indexOf(`--ok-project-path=`);if(t===-1)return null;let n=t+18,r=e.slice(n),i=r.search(/\s--/),a=(i===-1?r:r.slice(0,i)).trim();return a&&at(a)?a:null}function bi(e){let t=[];for(let n of e.split(`
26
26
  `)){let e=n.trim();if(!e)continue;let r=e.indexOf(` `);if(r===-1)continue;let i=e.slice(0,r),a=e.slice(r+1),o=Number.parseInt(i,10);!Number.isNaN(o)&&_i(a)&&t.push({pid:o,command:a})}return t}function xi(e){let t=[],n=e.split(`
27
27
  `);for(let e=1;e<n.length;e++){let r=n[e]?.trim();if(!r)continue;let i=r.indexOf(` `);if(i===-1)continue;let a=r.slice(0,i),o=r.slice(i+1).trim(),s=Number.parseInt(a,10);!Number.isNaN(s)&&_i(o)&&t.push({pid:s,command:o})}return t}async function Si(){let e=k(`pgrep`,[`-a`,`-f`,`cli\\.mjs|open-knowledge|Open Knowledge(\\.app| Helper)|--ok-lock-dir-b64=|--ok-project-path=|(^|[ /])ok[ ]+(start|mcp|ui)([ ]|$)|packages/(cli|app)|hocuspocus|vite`],{encoding:`utf-8`,timeout:W});if(!(e.error!=null&&e.error.code===`ENOENT`)){let t=e.stdout??``,n=bi(t);if(n.length>0||t.trim()===``)return n}let t=k(`ps`,[`-axo`,`pid,command`],{encoding:`utf-8`,timeout:W});return t.error!=null||!t.stdout?[]:xi(t.stdout)}function Ci(e){let t=e.trim().split(/\s+/).filter(Boolean);for(let e of t){if(e.startsWith(`@`))continue;let t=rt(e);if(t===`open-knowledge`||t===`ok`||e.endsWith(`/packages/cli/src/cli.ts`)||e.endsWith(`/packages/cli/dist/cli.mjs`)||t===`cli.mjs`||t===`cli.ts`)return e}return null}function wi(e){let t=k(`ps`,[`-p`,String(e),`-o`,`command=`],{encoding:`utf-8`,timeout:W});return t.error!=null||!t.stdout?null:t.stdout.trim()||null}function Ti(e){let t=k(`ps`,[`-p`,String(e),`-o`,`%cpu=,%mem=`],{encoding:`utf-8`,timeout:W});if(t.error!=null||!t.stdout)return null;let[n,r]=t.stdout.trim().split(/\s+/),i=Number.parseFloat(n??``),a=Number.parseFloat(r??``);return Number.isNaN(i)||Number.isNaN(a)?null:{cpuPercent:i,memPercent:a}}async function Ei(e){let t=k(`lsof`,[`-p`,String(e),`-a`,`-d`,`cwd`,`-Fn`],{encoding:`utf-8`,timeout:W});if(t.error!=null)return null;let n=t.stdout??``;for(let e of n.split(`
28
28
  `))if(e.startsWith(`n`)&&e.length>1)return e.slice(1);return null}function Di(e){let t=[],n=e.split(`
@@ -59,7 +59,7 @@ setTimeout(() => process.exit(2), ${t+1e4});
59
59
  `,r),o=-1;if(i!==-1&&a!==-1?o=Math.min(i,a):i===-1?a!==-1&&(o=a):o=i===e.length-1?-1:i,o===-1){n=e.slice(r);break}else{let n=e.slice(r,o);t.push(n),r=o+1,e[r-1]===`\r`&&e[r]===`
60
60
  `&&r++}}return[t,n]}var xo=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let r;super({start(i){r=yo({onEvent:e=>{i.enqueue(e)},onError(t){e===`terminate`?i.error(t):typeof e==`function`&&e(t)},onRetry:t,onComment:n})},transform(e){r.feed(e)}})}};const So={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};var Y=class extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}},Co=class{constructor(e,t){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=aa(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??So}async _authThenStart(){if(!this._authProvider)throw new J(`No auth provider`);let e;try{e=await Ya(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(e){throw this.onerror?.(e),e}if(e!==`AUTHORIZED`)throw new J;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let t=await this._authProvider.tokens();t&&(e.Authorization=`Bearer ${t.access_token}`)}this._sessionId&&(e[`mcp-session-id`]=this._sessionId),this._protocolVersion&&(e[`mcp-protocol-version`]=this._protocolVersion);let t=ia(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){let{resumptionToken:t}=e;try{let n=await this._commonHeaders();n.set(`Accept`,`text/event-stream`),t&&n.set(`last-event-id`,t);let r=await(this._fetch??fetch)(this._url,{method:`GET`,headers:n,signal:this._abortController?.signal});if(!r.ok){if(await r.body?.cancel(),r.status===401&&this._authProvider)return await this._authThenStart();if(r.status===405)return;throw new Y(r.status,`Failed to open SSE stream: ${r.statusText}`)}this._handleSseStream(r.body,e,!0)}catch(e){throw this.onerror?.(e),e}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let t=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*n**+e,r)}_scheduleReconnection(e,t=0){let n=this._reconnectionOptions.maxRetries;if(t>=n){this.onerror?.(Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let r=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(n=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${n instanceof Error?n.message:String(n)}`)),this._scheduleReconnection(e,t+1)})},r)}_handleSseStream(e,t,n){if(!e)return;let{onresumptiontoken:r,replayMessageId:i}=t,a,o=!1,s=!1;(async()=>{try{let t=e.pipeThrough(new TextDecoderStream).pipeThrough(new xo({onRetry:e=>{this._serverRetryMs=e}})).getReader();for(;;){let{value:e,done:n}=await t.read();if(n)break;if(e.id&&(a=e.id,o=!0,r?.(e.id)),e.data&&(!e.event||e.event===`message`))try{let t=d.parse(JSON.parse(e.data));p(t)&&(s=!0,i!==void 0&&(t.id=i)),this.onmessage?.(t)}catch(e){this.onerror?.(e)}}(n||o)&&!s&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:a,onresumptiontoken:r,replayMessageId:i},0)}catch(e){if(this.onerror?.(Error(`SSE stream disconnected: ${e}`)),(n||o)&&!s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:a,onresumptiontoken:r,replayMessageId:i},0)}catch(e){this.onerror?.(Error(`Failed to reconnect: ${e instanceof Error?e.message:String(e)}`))}}})()}async start(){if(this._abortController)throw Error(`StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.`);this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new J(`No auth provider`);if(await Ya(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!==`AUTHORIZED`)throw new J(`Failed to authorize`)}async close(){this._reconnectionTimeout&&=(clearTimeout(this._reconnectionTimeout),void 0),this._abortController?.abort(),this.onclose?.()}async send(e,t){try{let{resumptionToken:n,onresumptiontoken:r}=t||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:u(e)?e.id:void 0}).catch(e=>this.onerror?.(e));return}let i=await this._commonHeaders();i.set(`content-type`,`application/json`),i.set(`accept`,`application/json, text/event-stream`);let a={...this._requestInit,method:`POST`,headers:i,body:JSON.stringify(e),signal:this._abortController?.signal},o=await(this._fetch??fetch)(this._url,a),s=o.headers.get(`mcp-session-id`);if(s&&(this._sessionId=s),!o.ok){let t=await o.text().catch(()=>null);if(o.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Y(401,`Server returned 401 after successful authentication`);let{resourceMetadataUrl:t,scope:n}=$a(o);if(this._resourceMetadataUrl=t,this._scope=n,await Ya(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!==`AUTHORIZED`)throw new J;return this._hasCompletedAuthFlow=!0,this.send(e)}if(o.status===403&&this._authProvider){let{resourceMetadataUrl:t,scope:n,error:r}=$a(o);if(r===`insufficient_scope`){let r=o.headers.get(`WWW-Authenticate`);if(this._lastUpscopingHeader===r)throw new Y(403,`Server returned 403 after trying upscoping`);if(n&&(this._scope=n),t&&(this._resourceMetadataUrl=t),this._lastUpscopingHeader=r??void 0,await Ya(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!==`AUTHORIZED`)throw new J;return this.send(e)}}throw new Y(o.status,`Error POSTing to endpoint: ${t}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,o.status===202){await o.body?.cancel(),b(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(e=>this.onerror?.(e));return}let c=(Array.isArray(e)?e:[e]).filter(e=>`method`in e&&`id`in e&&e.id!==void 0).length>0,l=o.headers.get(`content-type`);if(c)if(l?.includes(`text/event-stream`))this._handleSseStream(o.body,{onresumptiontoken:r},!1);else if(l?.includes(`application/json`)){let e=await o.json(),t=Array.isArray(e)?e.map(e=>d.parse(e)):[d.parse(e)];for(let e of t)this.onmessage?.(e)}else throw await o.body?.cancel(),new Y(-1,`Unexpected content type: ${l}`);else await o.body?.cancel()}catch(e){throw this.onerror?.(e),e}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),t={...this._requestInit,method:`DELETE`,headers:e,signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._url,t);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new Y(n.status,`Failed to terminate session: ${n.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}};function wo(e){return(t,n)=>{if((n?.method??`GET`).toUpperCase()===`GET`)return globalThis.fetch(t,n);let r=new AbortController,i=setTimeout(()=>r.abort(Error(`MCP request timed out after ${e}ms`)),e),a=n?.signal instanceof AbortSignal?AbortSignal.any([n.signal,r.signal]):r.signal;return globalThis.fetch(t,{...n,signal:a}).finally(()=>clearTimeout(i))}}function To(e){if(e===void 0||e===``)return;let t=Number.parseInt(e,10);if(!(Number.isNaN(t)||t<=0))return t}function Eo(e){return e===`0.0.0.0`||e===`::`?`localhost`:e.includes(`:`)&&!e.startsWith(`[`)?`[${e}]`:e}function Do(e,t){return`http://${Eo(e)}:${t}/mcp`}function Oo(e,t){return`ws://${Eo(e)}:${t}`}function ko(e){let t=new URL(e);return t.protocol=t.protocol===`https:`?`wss:`:`ws:`,t.pathname=``,t.search=``,t.hash=``,t.toString().replace(/\/$/,``)}function Ao(e,t){if(!(!e||e.port<=0)&&t(e.pid))return e.port}function jo(e){return M(e)?N(e,`utf-8`).trim():``}function Mo(e,t){return`server did not start within ${e}ms${t?` stderr:\n${t}`:``}`}function No(e){if(e&&typeof e==`object`&&`method`in e&&`id`in e)return e.id}function Po(e){if(!e||typeof e!=`object`||!(`result`in e))return;let t=e.result;if(!t||typeof t!=`object`||!(`protocolVersion`in t))return;let n=t.protocolVersion;return typeof n==`string`?n:void 0}function Fo(e,t){return{jsonrpc:`2.0`,id:e,error:{code:-32e3,message:t instanceof Error?t.message:String(t)}}}async function Io(e){let t=e.readLock??(()=>Le(e.lockDir)),n=e.isAlive??C,r=e.sleep??(e=>kt(e)),i=e.spawn??tt,a=e.readErrorLog??jo,o=e.openErrorLog??(e=>dt(e,`w`)),s=e.closeFd??st,c=e.timeoutMs??5e3,l=e.pollIntervalMs??100;if(e.portOverride!==void 0){let t=Number.parseInt(e.portOverride,10);if(Number.isNaN(t)||t<=0)throw Error(`invalid --port value '${e.portOverride}' — HTTP MCP shim requires a positive port`);return Do(`localhost`,t)}let u=Ao(t(),n);if(u!==void 0)return Do(`localhost`,u);if(e.envAutoStart===`0`)throw Error(`Open Knowledge server is not running and OK_MCP_AUTOSTART=0 disables auto-start.`);M(e.lockDir)||lt(e.lockDir,{recursive:!0});let d=A(e.lockDir,`last-spawn-error.log`),f=o(d),p,m,h=Ge();try{try{p=i(h.command,[...h.prefixArgs,`start`],{detached:!0,stdio:[`ignore`,`ignore`,f],cwd:e.contentDir,env:{...process.env,OK_LOCK_KIND:`mcp-spawned`}}),p.on(`error`,e=>{m=e instanceof Error?e.message:String(e)}),p.unref()}catch(e){m=e instanceof Error?e.message:String(e)}}finally{try{s(f)}catch{}}let g=Date.now()+c;for(;Date.now()<g;){if(m){let e=a(d),t=e?` stderr:\n${e}`:``;throw Error(`spawn failed: ${m}${t}`)}await r(l);let e=Ao(t(),n);if(e!==void 0)return Do(`localhost`,e)}if(m){let e=a(d),t=e?` stderr:\n${e}`:``;throw Error(`spawn failed: ${m}${t}`)}throw Error(Mo(c,a(d)))}function Lo(e,t){if(e.portOverride!==void 0)return ko(t);let n=e.readLock??(()=>Le(e.lockDir)),r=e.isAlive??C,i=Ao(n(),r);if(i!==void 0)return Oo(`localhost`,i)}async function Ro(e,t={}){let n=t.stderr??process.stderr,r=t.requestTimeoutMs??12e4,i=t.createStdioTransport?t.createStdioTransport(t.stdin,t.stdout):new Qi(t.stdin,t.stdout),a=t.createHttpTransport?t.createHttpTransport(new URL(e)):new Co(new URL(e),{fetch:wo(r),...t.connectionId===void 0?{}:{requestInit:{headers:{[s]:t.connectionId}}}}),o=!1,c=async()=>{o||(o=!0,t.onclose?.(),await Promise.allSettled([i.close(),a.close()]))};i.onerror=e=>{n.write(`[mcp-shim] stdio error: ${e.message}\n`)},a.onerror=e=>{n.write(`[mcp-shim] HTTP transport error: ${e.message}\n`)},i.onclose=()=>{c()},a.onclose=()=>{c()};let l=Promise.resolve();i.onmessage=e=>{l=l.then(async()=>{try{await a.send(e)}catch(t){let r=No(e);if(r===void 0){n.write(`[mcp-shim] failed to forward stdio notification: ${t instanceof Error?t.message:String(t)}\n`);return}await i.send(Fo(r,t)).catch(e=>{n.write(`[mcp-shim] failed to write stdio error response: ${e instanceof Error?e.message:String(e)}\n`)})}}).catch(e=>{n.write(`[mcp-shim] unexpected stdio forwarding failure: ${e instanceof Error?e.message:String(e)}\n`)})},a.onmessage=e=>{let t=Po(e);t&&a.setProtocolVersion?.(t),i.send(e).catch(e=>{n.write(`[mcp-shim] failed to write stdio response: ${e instanceof Error?e.message:String(e)}\n`)})};try{await a.start(),await i.start()}catch(e){throw await c(),e}return{close:c}}async function zo(e){let t=e.stderr??process.stderr,n=e.bridgeFn??Ro,r=await Io(e),i=e.createConnectionId?.()??Dt(),a=!1,o=(e.startKeepalive??na)({connectionId:i,resolveWsUrl:async()=>Lo(e,r),log:e=>t.write(`[mcp-shim] keepalive: ${e}\n`)});t.write(`[mcp-shim] proxying stdio to ${r}\n`);let s;try{s=await n(r,{stderr:t,connectionId:i,onclose:()=>{a||(o.close(),process.exit(0))}})}catch(e){throw o.close(),e}let c=()=>{a=!0,o.close(),s.close().finally(()=>{process.exit(0)})};process.once(`SIGINT`,c),process.once(`SIGTERM`,c)}const Bo=St(import.meta.url);function Vo(e){let t=j(e);for(;;){if(ce(t))return t;let n=it(t);if(n===t)throw Error(`No Open Knowledge project found at or above ${e}. Pass an explicit \`cwd\` argument that points inside an OK project (a directory with a \`${ae}\`).`);t=n}}function Ho(e){try{let t=new URL(e);return t.protocol===`file:`?St(t):void 0}catch{return}}async function Uo(e){if(!e.getClientCapabilities()?.roots)return;let t;try{t=await e.listRoots()}catch(t){e.log?.(`listRoots fallback failed: ${t instanceof Error?t.message:String(t)}`);return}let n=t.roots??[];if(n.length!==1)return;let r=Ho(n[0].uri);return r===void 0&&e.log?.(`single root URI not usable as fs path: ${n[0].uri}`),r}async function Wo(e,t){if(e!==void 0)return Vo(e);let n=await t();if(n!==void 0)return Vo(n);throw Error("`cwd` is required for tool calls against the global MCP server. Pass an absolute path inside an Open Knowledge project, or have the MCP client advertise a single root.")}async function Go(e){let t=process.stderr,n=e.spawnTimeoutMs??To(process.env.OK_MCP_SPAWN_TIMEOUT_MS),r=e.envAutoStart??process.env.OK_MCP_AUTOSTART,i=We({startupCwd:e.startupCwd,startupConfig:e.startupConfig}),o=new te({name:a,version:ze},{instructions:le({dir:`.`})});ge(o);let s=Dt(),c={current:{connectionId:s,displayName:s,colorSeed:s}},l=new Map,u=e=>{if(l.has(e))return;let n=ne(e),r=c.current,i=na({connectionId:s,displayName:r.displayName,clientName:r.clientInfo?.name??r.displayName,colorSeed:r.colorSeed,resolveWsUrl:async()=>Lo({lockDir:n,contentDir:e},``),log:n=>t.write(`[mcp] keepalive[${e}]: ${n}\n`)});l.set(e,i)},d=()=>Uo({getClientCapabilities:()=>o.server.getClientCapabilities(),listRoots:()=>o.server.listRoots(),log:e=>t.write(`[mcp] ${e}\n`)}),f=e=>Wo(e,d),p=async e=>{let t;if(e===void 0){let e=await d();if(e===void 0)return;t=Vo(e)}else t=Vo(e);let a=await i(t),o=await Io({lockDir:ne(t),contentDir:y(a,t),envAutoStart:r,...n===void 0?{}:{timeoutMs:n}});return u(t),o.replace(/\/mcp$/,``)};o.server.oninitialized=()=>{let e=o.server.getClientVersion(),t=he(e?.name,s);c.current={connectionId:s,clientInfo:e?{name:t,version:e.version}:void 0,displayName:t,colorSeed:t}},h(o,{serverUrl:p,resolveCwd:f,config:i,identityRef:c});let m=new Qi,g=!1,_,v=async()=>{if(g)return;g=!0,_?.stop();for(let e of l.values())try{e.close()}catch(e){t.write(`[mcp] keepalive close error: ${e instanceof Error?e.message:String(e)}\n`)}l.clear();let e=await Promise.allSettled([o.close(),m.close()]);for(let n of e)if(n.status===`rejected`){let e=n.reason;t.write(`[mcp] shutdown close error: ${e instanceof Error?e.message:String(e)}\n`)}};await o.connect(m),t.write(`[mcp] global stdio server ready (per-call project routing)
61
61
  `);let ee=!1,b=()=>{ee||(ee=!0,setTimeout(()=>{t.write(`[mcp] shutdown deadline (5s) reached — forcing exit(1)
62
- `),process.exit(1)},5e3).unref(),v().finally(()=>{process.exit(0)}))};if(process.once(`SIGINT`,b),process.once(`SIGTERM`,b),ra({log:e=>t.write(`${e}\n`),transport:m,process,stdin:process.stdin}),process.platform===`darwin`){let e=ta(Bo,{realpathSync:pt,statInoSync:e=>ht(e).ino,log:e=>t.write(`${e}\n`)});if(e!==void 0){t.write(`[mcp] bundle identity anchor=${e.resolvedPath} inode=${e.inode} version=${ze}\n`);let{resolvedPath:n,inode:r}=e;_=ea({detect:()=>$i({bundleAnchorPath:Bo,currentInode:r,platform:process.platform,realpath:pt,statInode:e=>ht(e).ino}),onReplaced:e=>{t.write(`[mcp] bundle replaced anchor=${n} bootInode=${e.currentInode} onDiskInode=${e.onDiskInode} version=${ze} — exiting for host respawn\n`),b()},log:e=>t.write(`[mcp] ${e}\n`)})}}return{close:v}}function Ko(e){return new t(`mcp`).description(`Start MCP stdio server for project knowledge base`).option(`-p, --port <port>`,`Override per-call routing and proxy stdio to this HTTP MCP port`,void 0).action(async t=>{try{let n=e(),r=process.cwd();if(t.port!==void 0){let e=To(process.env.OK_MCP_SPAWN_TIMEOUT_MS);await zo({lockDir:``,contentDir:``,portOverride:t.port,envAutoStart:process.env.OK_MCP_AUTOSTART,timeoutMs:e});return}await Go({startupCwd:r,startupConfig:n})}catch(e){process.stderr.write(`MCP server failed to start: ${e instanceof Error?e.message:String(e)}\n`),process.exitCode=1}})}function qo(e){return new t(`preview`).description(`Show what content the watcher will track (read-only)`).action(async()=>{let{previewContent:t,formatPreviewBlock:n}=await import(`./preview-DZKfHXsi.mjs`),r=e(),i=process.cwd(),a=y(r,i),o;try{o=t({projectDir:i,contentDir:a})}catch(e){console.error(`Content preview failed: ${e instanceof Error?e.message:String(e)}`),process.exitCode=1;return}process.stdout.write(`${n(o,i)}\n`),o.totalCount===0&&o.warnings.length>0&&(process.exitCode=1)})}function Jo(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function Yo(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Xo(e,t,n,r,i,a){if(t.status===`missing`||t.status===`corrupt`)return null;let o=t.lock,s=null;if(n.status!==`missing`&&n.status!==`corrupt`){let e=n.lock;s={port:e.port,status:n.status,pid:e.pid,startedAt:e.startedAt,usage:a}}return{directory:o.worktreeRoot,server:{port:o.port,status:t.status,pid:o.pid,startedAt:o.startedAt,usage:i},ui:s,hostname:o.hostname,lockPath:t.lockPath,binary:r==null?null:Ci(r),command:r,isDesktop:Jo(r)}}function Zo(e){return e.ui==null?!1:e.ui.status===`alive`||e.ui.status===`foreign-host`}function Qo(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:t===`dead-pid`&&Zo(e)?`ui-orphan`:`stale`}const $o=new Set([`running`,`desktop`,`foreign`,`ui-orphan`]);function es(e){switch(e){case`running`:return U.default.green(e);case`desktop`:return U.default.blue(e);case`foreign`:return U.default.cyan(e);case`ui-orphan`:return U.default.magenta(e);case`stale`:return U.default.yellow(e)}}function ts(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function ns(e){return`${ts(e.server.usage)} | ${ts(e.ui?.usage??null)}`}function rs(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null||e.ui.status===`dead-pid`?`—`:String(e.ui.port)}`}function is(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>{let t=Qo(e),n=t===`ui-orphan`&&e.ui!=null?e.ui.pid:e.server.pid;return[e.directory,rs(e),ns(e),t,String(n),Yo(e.server.startedAt),e.binary??`—`]}),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=es(Qo(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=U.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
62
+ `),process.exit(1)},5e3).unref(),v().finally(()=>{process.exit(0)}))};if(process.once(`SIGINT`,b),process.once(`SIGTERM`,b),ra({log:e=>t.write(`${e}\n`),transport:m,process,stdin:process.stdin}),process.platform===`darwin`){let e=ta(Bo,{realpathSync:pt,statInoSync:e=>ht(e).ino,log:e=>t.write(`${e}\n`)});if(e!==void 0){t.write(`[mcp] bundle identity anchor=${e.resolvedPath} inode=${e.inode} version=${ze}\n`);let{resolvedPath:n,inode:r}=e;_=ea({detect:()=>$i({bundleAnchorPath:Bo,currentInode:r,platform:process.platform,realpath:pt,statInode:e=>ht(e).ino}),onReplaced:e=>{t.write(`[mcp] bundle replaced anchor=${n} bootInode=${e.currentInode} onDiskInode=${e.onDiskInode} version=${ze} — exiting for host respawn\n`),b()},log:e=>t.write(`[mcp] ${e}\n`)})}}return{close:v}}function Ko(e){return new t(`mcp`).description(`Start MCP stdio server for project knowledge base`).option(`-p, --port <port>`,`Override per-call routing and proxy stdio to this HTTP MCP port`,void 0).action(async t=>{try{let n=e(),r=process.cwd();if(t.port!==void 0){let e=To(process.env.OK_MCP_SPAWN_TIMEOUT_MS);await zo({lockDir:``,contentDir:``,portOverride:t.port,envAutoStart:process.env.OK_MCP_AUTOSTART,timeoutMs:e});return}await Go({startupCwd:r,startupConfig:n})}catch(e){process.stderr.write(`MCP server failed to start: ${e instanceof Error?e.message:String(e)}\n`),process.exitCode=1}})}function qo(e){return new t(`preview`).description(`Show what content the watcher will track (read-only)`).action(async()=>{let{previewContent:t,formatPreviewBlock:n}=await import(`./preview-DCei46zt.mjs`),r=e(),i=process.cwd(),a=y(r,i),o;try{o=t({projectDir:i,contentDir:a})}catch(e){console.error(`Content preview failed: ${e instanceof Error?e.message:String(e)}`),process.exitCode=1;return}process.stdout.write(`${n(o,i)}\n`),o.totalCount===0&&o.warnings.length>0&&(process.exitCode=1)})}function Jo(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function Yo(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Xo(e,t,n,r,i,a){if(t.status===`missing`||t.status===`corrupt`)return null;let o=t.lock,s=null;if(n.status!==`missing`&&n.status!==`corrupt`){let e=n.lock;s={port:e.port,status:n.status,pid:e.pid,startedAt:e.startedAt,usage:a}}return{directory:o.worktreeRoot,server:{port:o.port,status:t.status,pid:o.pid,startedAt:o.startedAt,usage:i},ui:s,hostname:o.hostname,lockPath:t.lockPath,binary:r==null?null:Ci(r),command:r,isDesktop:Jo(r)}}function Zo(e){return e.ui==null?!1:e.ui.status===`alive`||e.ui.status===`foreign-host`}function Qo(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:t===`dead-pid`&&Zo(e)?`ui-orphan`:`stale`}const $o=new Set([`running`,`desktop`,`foreign`,`ui-orphan`]);function es(e){switch(e){case`running`:return U.default.green(e);case`desktop`:return U.default.blue(e);case`foreign`:return U.default.cyan(e);case`ui-orphan`:return U.default.magenta(e);case`stale`:return U.default.yellow(e)}}function ts(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function ns(e){return`${ts(e.server.usage)} | ${ts(e.ui?.usage??null)}`}function rs(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null||e.ui.status===`dead-pid`?`—`:String(e.ui.port)}`}function is(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>{let t=Qo(e),n=t===`ui-orphan`&&e.ui!=null?e.ui.pid:e.server.pid;return[e.directory,rs(e),ns(e),t,String(n),Yo(e.server.startedAt),e.binary??`—`]}),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=es(Qo(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=U.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
63
63
  `)}async function as(e={}){let t=e.discover??ji,n=e.inspect??V,r=e.log??(e=>console.log(e)),i=e.resolveCommand??wi,a=e.resolveUsage??Ti,o=await t(),s=[];for(let e of o){let t=n(e,`server`),r=n(e,`ui`),o=Xo(e,t,r,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid),r.status===`missing`||r.status===`corrupt`?null:a(r.lock.pid));o!=null&&s.push(o)}if(e.json){let e=s.map(e=>({...e,displayStatus:Qo(e)}));r(JSON.stringify(e,null,2));return}r(is(e.all?s:s.filter(e=>$o.has(Qo(e)))))}function os(){return new t(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await as({all:t.all===!0||e===`all`,json:t.json===!0})})}function X(e,t){e&&process.stdout.write(`${JSON.stringify(t)}\n`)}async function ss(e,t,n=process.cwd()){let r=e.op??`sync`,i=Le(me(n));if(i&&i.port>0){let t=`http://127.0.0.1:${i.port}/api/sync/trigger`;e.json||process.stderr.write(`Triggering ${r} via running server (port ${i.port})\n`);try{let n=await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:r})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.title??e.error??e.message??`Server responded with ${n.status}`)}X(e.json,{type:`triggered`,op:r,port:i.port}),e.json||process.stderr.write(`✓ ${r} triggered\n`);return}catch(t){let n=t instanceof Error?t.message:String(t);e.json||process.stderr.write(`Server trigger failed (${n}), running directly\n`)}}e.json||process.stderr.write(`Running ${r} directly (no live server)\n`);let a=Be({baseDir:n});if(r===`sync`||r===`pull`){X(e.json,{type:`step`,step:`pull`});let t=await a.pull();X(e.json,{type:`pull`,summary:t.summary}),e.json||process.stderr.write(` pull: ${t.summary.changes} changes\n`)}(r===`sync`||r===`push`)&&(X(e.json,{type:`step`,step:`push`}),await a.push(),X(e.json,{type:`push`,ok:!0}),e.json||process.stderr.write(` push: ok
64
64
  `)),X(e.json,{type:`complete`,op:r}),e.json||process.stderr.write(`✓ ${r} complete\n`)}function cs(e){return new t(`sync`).description(`Commit, pull, and push to the remote`).option(`--json`,`Output JSONL progress events`,!1).action(async t=>{try{await ss({json:t.json,op:`sync`},e())}catch(e){let n=e instanceof Error?e.message:String(e);t.json?process.stdout.write(`${JSON.stringify({type:`error`,message:n})}\n`):process.stderr.write(`✗ sync failed: ${n}\n`),process.exit(1)}})}function ls(e){return new t(`pull`).description(`Pull changes from the remote`).option(`--json`,`Output JSONL progress events`,!1).action(async t=>{try{await ss({json:t.json,op:`pull`},e())}catch(e){let n=e instanceof Error?e.message:String(e);t.json?process.stdout.write(`${JSON.stringify({type:`error`,message:n})}\n`):process.stderr.write(`✗ pull failed: ${n}\n`),process.exit(1)}})}function us(e){return new t(`push`).description(`Push commits to the remote`).option(`--json`,`Output JSONL progress events`,!1).action(async t=>{try{await ss({json:t.json,op:`push`},e())}catch(e){let n=e instanceof Error?e.message:String(e);t.json?process.stdout.write(`${JSON.stringify({type:`error`,message:n})}\n`):process.stderr.write(`✗ push failed: ${n}\n`),process.exit(1)}})}function ds(e){return typeof e==`string`&&r.includes(e)}async function fs(e={}){let t=j(e.cwd??process.cwd()),n=e.pack??`knowledge-base`;if(!ye[n])return{status:`failed`,message:`${E(`Error:`)} Unknown pack "${n}". Available: ${r.join(`, `)}`,exitCode:1};let i;try{i=await l({projectDir:t,rootDir:e.root,packId:n})}catch(e){return e instanceof v?{status:`prerequisite-missing`,message:`${E(`Error:`)} ${e.message}`,exitCode:1}:{status:`failed`,message:`${E(`Error:`)} ${e instanceof Error?e.message:String(e)}`,exitCode:1}}if(i.created.length===0){let e=ye[n].name;return{status:`no-op`,message:`${T(`Your ${e} pack is already seeded.`)}\n${w(`Nothing to do.`)}`,plan:i,exitCode:0}}if(e.dryRun)return{status:`dry-run`,message:`${O(`Plan (dry-run — no changes made):`)}\n\n${ms(i,t)}`,plan:i,exitCode:0};if(!e.yes&&!await hs(`${O(`Plan:`)}\n\n${ms(i,t)}\n\n${O(`Apply?`)} ${w(`[Y/n] `)}`,e.confirmStream))return{status:`cancelled`,message:w(`Cancelled.`),plan:i,exitCode:0};let a=await ie(i,{projectDir:t,packId:n});if(a.errors.length>0){let e=a.errors.map(e=>` ${E(`✗`)} ${e.path}: ${e.error}`);return{status:`failed`,message:[`${D(`Applied`)} ${a.applied} entries, ${D(String(a.errors.length))} error(s):`,...e].join(`
65
65
  `),plan:i,exitCode:1}}let o=ye[n].name;return{status:`applied`,message:`${T(`✓ Seeded ${o}`)} ${w(`(${a.applied} entries, ${a.durationMs}ms)`)}`,plan:i,exitCode:0}}function ps(){let e=[O(`Available packs:`)];for(let t of r){let n=ye[t];e.push(` ${T(t)} ${w(`—`)} ${n.name}: ${n.description}`)}return e.join(`
@@ -0,0 +1,2 @@
1
+ import"./dist-soQLoIV1.mjs";var e=`0.6.0-beta.9`;const t=`config.yml`,n=e;export{n,t};
2
+ //# sourceMappingURL=constants-CkYsa36O.mjs.map
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{b as e,d as t,f as n,g as r,h as i,i as a,m as o,r as s,s as c,t as l,u,y as d}from"./init-al09RZM6.mjs";import{i as f,n as p,r as m,t as h}from"./src-DJUgVPb0.mjs";import{n as g}from"./loader-B64XEbbD.mjs";import{n as _}from"./preview-CYIUoqRn.mjs";export{o as ALL_EDITOR_IDS,i as EDITOR_LABELS,r as EDITOR_TARGETS,l as LAUNCH_CONFIG_NAME,s as classifyExistingMcpEntry,a as detectInstalledEditors,e as initContent,g as loadConfig,m as parseGitHubBlobUrl,f as parseGitUrl,_ as previewContent,c as readExistingMcpEntry,d as resolveProjectRoot,u as scaffoldLaunchJson,p as validateLocalFolderForShare,t as writeEditorMcpConfig,h as writeProjectAiIntegrations,n as writeUserMcpConfigs};
1
+ import{b as e,d as t,f as n,g as r,h as i,i as a,m as o,r as s,s as c,t as l,u,y as d}from"./init-BG3i7h4P.mjs";import{i as f,n as p,r as m,t as h}from"./src-C-7gHcnB.mjs";import{n as g}from"./loader-4X5eR4wo.mjs";import{n as _}from"./preview-fk1DB9JQ.mjs";export{o as ALL_EDITOR_IDS,i as EDITOR_LABELS,r as EDITOR_TARGETS,l as LAUNCH_CONFIG_NAME,s as classifyExistingMcpEntry,a as detectInstalledEditors,e as initContent,g as loadConfig,m as parseGitHubBlobUrl,f as parseGitUrl,_ as previewContent,c as readExistingMcpEntry,d as resolveProjectRoot,u as scaffoldLaunchJson,p as validateLocalFolderForShare,t as writeEditorMcpConfig,h as writeProjectAiIntegrations,n as writeUserMcpConfigs};
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,t as n}from"./chunk-FK9Q3tQk.mjs";import{r,t as i}from"./esm-CEs3LWY3.mjs";import{$r as a,D as o,N as s,Nt as c,Qr as l,Un as u,ai as d,an as f,di as p,fn as m,gi as h,hi as g,ii as _,in as v,jt as y,ln as b,ri as x,rn as S,si as C}from"./dist-soQLoIV1.mjs";import{n as ee,t as te}from"./constants-HL-7SyJ2.mjs";import{t as w}from"./is-object-C-4FJ0rP.mjs";import{i as T,o as E,r as ne,s as D,t as O}from"./colors-BtKMHmBX.mjs";import{t as re}from"./preview-CYIUoqRn.mjs";import{execFileSync as ie}from"node:child_process";import ae,{basename as oe,dirname as k,isAbsolute as A,join as j,posix as M,relative as N,resolve as P,sep as F,win32 as I}from"node:path";import{cpSync as se,existsSync as L,lstatSync as ce,mkdirSync as R,readFileSync as z,realpathSync as le,rmSync as ue,writeFileSync as B}from"node:fs";import V from"node:process";import{homedir as H}from"node:os";import{AsyncLocalStorage as de,AsyncResource as fe}from"node:async_hooks";import{stripVTControlCharacters as pe,styleText as U}from"node:util";import*as me from"node:readline";import{randomUUID as he}from"node:crypto";import{createServer as ge,request as _e}from"node:http";import{connect as ve}from"node:net";function ye(){return V.platform.startsWith(`win`)?!!V.env.CI||!!V.env.WT_SESSION||!!V.env.TERMINUS_SUBLIME||V.env.ConEmuTask===`{cmd::Cmder}`||V.env.TERM_PROGRAM===`Terminus-Sublime`||V.env.TERM_PROGRAM===`vscode`||V.env.TERM===`xterm-256color`||V.env.TERM===`alacritty`||V.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:V.env.TERM!==`linux`}const be={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:`╱`},xe={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:`⅒`},Se={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`},Ce={...be,...xe},we={...be,...Se},W=ye()?Ce:we;Object.entries(xe);var Te=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}}));const Ee=(()=>{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}})(),De=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Oe=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,ke=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Ae=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,je=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Me=/\t{1,1000}/y,Ne=/[\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,Pe=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Fe=/\p{M}+/gu,Ie={limit:1/0,ellipsis:``},Le=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Le(i,Ie,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Pe,l],[ke,0],[Ae,o],[Me,s],[Ne,c],[je,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(Fe,``)){let t=e.codePointAt(0)||0;if(S=De(t)?2:Oe(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===je?Ee(e.slice(p,n.lastIndex)):n===Ne?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}},Re={limit:1/0,ellipsis:``,ellipsisWidth:0},G=(e,t={})=>Le(e,Re,t).width,ze=`]8;;`,Be=RegExp(`(?:\\[(?<code>\\d+)m|\\${ze}(?<uri>.*))`,`y`),Ve=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},He=e=>`[${e}m`,Ue=e=>`${ze}${e}`,We=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:G(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=G(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(ze,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())},Ge=e=>{let t=e.split(` `),n=t.length;for(;n&&!G(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ke=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=G(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=G(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),We(s,r,t),c=G(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){We(s,r,t),c=G(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){We(s,r,t),c=G(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Ge(e)));let l=s.join(`
1
+ import{i as e,o as t,t as n}from"./chunk-FK9Q3tQk.mjs";import{r,t as i}from"./esm-CEs3LWY3.mjs";import{$r as a,D as o,N as s,Nt as c,Qr as l,Un as u,ai as d,an as f,di as p,fn as m,gi as h,hi as g,ii as _,in as v,jt as y,ln as b,ri as x,rn as S,si as C}from"./dist-soQLoIV1.mjs";import{n as ee,t as te}from"./constants-CkYsa36O.mjs";import{t as w}from"./is-object-C-4FJ0rP.mjs";import{i as T,o as E,r as ne,s as D,t as O}from"./colors-BtKMHmBX.mjs";import{t as re}from"./preview-fk1DB9JQ.mjs";import{execFileSync as ie}from"node:child_process";import ae,{basename as oe,dirname as k,isAbsolute as A,join as j,posix as M,relative as N,resolve as P,sep as F,win32 as I}from"node:path";import{cpSync as se,existsSync as L,lstatSync as ce,mkdirSync as R,readFileSync as z,realpathSync as le,rmSync as ue,writeFileSync as B}from"node:fs";import V from"node:process";import{homedir as H}from"node:os";import{AsyncLocalStorage as de,AsyncResource as fe}from"node:async_hooks";import{stripVTControlCharacters as pe,styleText as U}from"node:util";import*as me from"node:readline";import{randomUUID as he}from"node:crypto";import{createServer as ge,request as _e}from"node:http";import{connect as ve}from"node:net";function ye(){return V.platform.startsWith(`win`)?!!V.env.CI||!!V.env.WT_SESSION||!!V.env.TERMINUS_SUBLIME||V.env.ConEmuTask===`{cmd::Cmder}`||V.env.TERM_PROGRAM===`Terminus-Sublime`||V.env.TERM_PROGRAM===`vscode`||V.env.TERM===`xterm-256color`||V.env.TERM===`alacritty`||V.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:V.env.TERM!==`linux`}const be={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:`╱`},xe={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:`⅒`},Se={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`},Ce={...be,...xe},we={...be,...Se},W=ye()?Ce:we;Object.entries(xe);var Te=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}}));const Ee=(()=>{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}})(),De=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Oe=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,ke=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Ae=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,je=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Me=/\t{1,1000}/y,Ne=/[\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,Pe=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Fe=/\p{M}+/gu,Ie={limit:1/0,ellipsis:``},Le=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Le(i,Ie,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Pe,l],[ke,0],[Ae,o],[Me,s],[Ne,c],[je,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(Fe,``)){let t=e.codePointAt(0)||0;if(S=De(t)?2:Oe(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===je?Ee(e.slice(p,n.lastIndex)):n===Ne?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}},Re={limit:1/0,ellipsis:``,ellipsisWidth:0},G=(e,t={})=>Le(e,Re,t).width,ze=`]8;;`,Be=RegExp(`(?:\\[(?<code>\\d+)m|\\${ze}(?<uri>.*))`,`y`),Ve=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},He=e=>`[${e}m`,Ue=e=>`${ze}${e}`,We=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:G(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=G(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(ze,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())},Ge=e=>{let t=e.split(` `),n=t.length;for(;n&&!G(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ke=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=G(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=G(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),We(s,r,t),c=G(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){We(s,r,t),c=G(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){We(s,r,t),c=G(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Ge(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===`›`){Be.lastIndex=e+1;let t=Be.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+=Ue(``));let e=i?Ve(i):void 0;i&&e&&(r+=He(e))}else t===`
4
4
  `&&(i&&Ve(i)&&(r+=He(i)),a&&(r+=Ue(a)))}return r},qe=/\r?\n/;function Je(e,t,n){return String(e).normalize().split(qe).map(e=>Ke(e,t,n)).join(`
@@ -405,5 +405,5 @@ last-spawn-error.log
405
405
  `)?n:`${n}\n`,`utf-8`)}const Ur=e=>e!==`project`,Wr=e=>e!==`user`;async function Gr(){let e=await dn({message:`Where should the MCP server be configured?
406
406
  `,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 Kr(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??Gr)():`both`}const qr=`0.0.1`,Jr=`open-knowledge-ui`,Yr=[`-y`,`@inkeep/open-knowledge@latest`,`ui`];function Xr(e,t={}){let n=j(e,`.claude`,`launch.json`),r=t.cliPath===void 0?t.mode===`dev`?{name:Jr,runtimeExecutable:`node`,runtimeArgs:[cr(),`ui`],port:jr,autoPort:!0}:{name:Jr,runtimeExecutable:`npx`,runtimeArgs:[...Yr],port:jr,autoPort:!0}:{name:Jr,runtimeExecutable:t.cliPath,runtimeArgs:[`ui`],port:jr,autoPort:!0};try{if(nr(n,e),!L(n))return R(k(n),{recursive:!0}),B(n,`${JSON.stringify({version:qr,configurations:[r]},null,2)}\n`,`utf-8`),{action:`created`,configPath:n};let t=z(n,`utf-8`).trim(),i=t?JSON.parse(t):{};if(!w(i))return{action:`failed`,configPath:n,error:`launch.json root is not an object`};let a=Array.isArray(i.configurations)?i.configurations:[],o=a.findIndex(e=>w(e)&&e.name===`open-knowledge-ui`);o>=0?a[o]=r:a.push(r);let s={...i,version:i.version??qr,configurations:a};return B(n,`${JSON.stringify(s,null,2)}\n`,`utf-8`),{action:o>=0?`merged`:`created`,configPath:n}}catch(e){return{action:`failed`,configPath:n,error:e instanceof Error?e.message:String(e)}}}function Zr(e,t,n){try{return L(e.detectPath?.(t,n)??k(e.configPath(t,n)))}catch{return!1}}function Qr(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)}}if(!i&&!n.skipAvailabilityCheck&&!Zr(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{nr(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`}}let s;try{s=e.format===`toml`?Br(o):zr(o)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}let c=s[e.topLevelKey]??{},l=c[a],u;try{u=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)}}let d={...s,[e.topLevelKey]:{...c,[a]:u}};try{e.format===`toml`?Hr(o,d):Vr(o,d)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}return{editorId:e.id,label:e.label,action:l===void 0?`written`:`overwritten`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}function $r(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!L(n)))return{editorId:e.id,label:e.label,path:n}}async function ei(e){let t=br(e.editors),n={mode:`published`,cliPath:e.cliPath,skipAvailabilityCheck:!0};return t.map(t=>Qr(t,``,n,e.home))}function ti(e,t,n,r){let i=ni(e,t,n,r);return i.kind===`present`?i.entry:null}function ni(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!L(i))return{kind:`absent`};let a;try{a=z(i,`utf-8`)}catch(e){return{kind:`corrupt`,error:e instanceof Error?e.message:String(e)}}if(a.trim()===``)return{kind:`corrupt`,error:`file is empty`};let o;try{o=e.format===`toml`?Br(i):zr(i)}catch(e){return{kind:`corrupt`,error:e instanceof Error?e.message:String(e)}}let s=o[e.topLevelKey];if(!w(s))return{kind:`no-entry`};let c=s[e.serverName(t)];return w(c)?{kind:`present`,entry:c}:{kind:`no-entry`}}async function ri(e={}){let t=P(e.cwd??process.cwd()),n=tr(t,{homeDir:e.home}),r=n.projectRoot,i=!L(j(r,`.ok`));n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&console.log(`[ok] Initialized OK at ${r} — opened parent of ${N(r,t)} because it contains a .git folder`);let a={mode:e.devMcp?`dev`:`published`},o=await c(r),s;try{s=Qn(r,{contentDir:n.defaultContentDir})}catch(t){let n=Q.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:o.didInit,claudeDesktopDetected:!1,mcpAction:`failed`,mcpPath:n,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`}}let l=await Kr({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),u=e.editors??ai(r,e.home),d=e.editors??ir.filter(e=>Q[e].projectConfigPath!==void 0),f=br(u),p=br(d),m=e.mcp===!1||l===null,h=Array.from(new Map([...f,...m?[]:p].map(e=>[e.id,e])).values()),g=f.filter(t=>Zr(t,r,e.home)),_=[],v=[],b=new Set;for(let t of h){if(m){let n=``;try{n=t.configPath(r,e.home)}catch{}_.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(Ur(l)&&f.includes(t)&&_.push(Qr(t,r,a,e.home)),Wr(l)&&p.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Qr(t,r,a,e.home,n);_.push(i),(i.action===`written`||i.action===`overwritten`)&&b.add(n)}}for(let e of p)e.projectSkillPath&&v.push(rr(e,r));let x=!m&&l!==null&&Wr(l)?p.filter(e=>!e.projectConfigPath).map(e=>e.label):void 0,C=m?[]:g.map(e=>$r(e,r)).filter(e=>e!==void 0).filter(e=>!b.has(e.path)),ee=g.some(e=>e.id===`claude`)&&!m?Xr(r,a):void 0,te=await(e.installUserSkill??S)({home:e.home}),w=y({home:e.home}),T=m?`skipped-flag`:`skipped-missing`,E=_.find(e=>e.editorId===`claude`)??_[0]??{action:T,configPath:Q.claude.configPath(r,e.home)};return{projectRoot:r,contentCreated:s.created,contentUpdated:s.updated,contentSkipped:s.skipped,editors:_,projectSkills:v,legacyProjectConfigs:C,launchJson:ee,skillInstall:te,didGitInit:o.didInit,claudeDesktopDetected:w,mcpAction:E.action,mcpPath:E.configPath,mcpError:`error`in E?E.error:void 0,projectScopeUnsupportedLabels:x}}function ii(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`),s=e=>{let n=e.configPath.startsWith(t)?N(t,e.configPath):e.configPath;switch(e.action){case`created`:return` app preview server ${n} configured for Claude Code Desktop embedded browser`;case`merged`:return` app preview server ${n} updated for Claude Code Desktop embedded browser`;case`failed`:return` app preview server ${n} FAILED: ${e.error}`}};e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`);let c=j(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(O(`Content scaffolded at ${c}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(O(`Content already present at ${c}/`)),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(O(`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(O(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(O(`MCP server configuration:`));for(let r of e.editors){let i=r.configPath.startsWith(t)?N(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),a=r.serverName===`open-knowledge`?``:` (${r.serverName})`,o=r.configScope===`project`?` (project)`:``,c=`${r.label}${o}`,l=` `.repeat(Math.max(1,20-c.length)),u=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${c}${l}${i} ${E(`registered`)}${a}${u}`);break;case`overwritten`:n.push(` ${c}${l}${i} ${E(`updated`)}${a}${u}`);break;case`skipped-missing`:n.push(` ${c}${l}${i} config root missing; skipped`);break;case`failed`:n.push(` ${c}${l}${i} ${ne(`FAILED`)}: ${r.error}`);break;case`skipped-flag`:break}r.editorId===`claude`&&e.launchJson&&n.push(s(e.launchJson))}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(O(`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?N(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${E(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${E(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${ne(`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} ${N(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(O(`User-global skill:`)),e.skillInstall){case`installed`:n.push(` open-knowledge ${E(`installed to detected agent hosts`)} via \`npx skills\``);break;case`skip-current`:n.push(` open-knowledge ${E(`already installed at current version`)}`);break;case`failed`:n.push(` ${D(`open-knowledge install failed — MCP still configured; run manually:`)}`),n.push(` ${D(` npx skills@~1.5.0 add <bundled-path> --agent '*' -g -y --copy`)}`);break}if(e.claudeDesktopDetected&&(n.push(``),n.push(`Claude Desktop App detected. To enable in Claude Chat & Cowork, run: ${O(`ok install-skill`)}`)),e.preview?(n.push(``),n.push(re(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),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(`${E(`✓`)} ${O(`Next steps:`)}`),n.push(` 1. Open your editor (${T(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${T(`ok seed`)} — empty repo, Karpathy 3-layer`),n.push(` - ${T(`mcp__open-knowledge__discover`)} — existing repo, extract conventions`),n.push(` 4. Use the MCP workflow tools as you build the wiki:`),n.push(` - ${T(`mcp__open-knowledge__ingest`)} — capture an external source`),n.push(` - ${T(`mcp__open-knowledge__research`)} — gather sources and write findings`),n.push(` - ${T(`mcp__open-knowledge__consolidate`)} — promote research to canonical articles`)}return n.join(`
407
407
  `)}function ai(e,t){let n=[];for(let r of ir)Zr(Q[r],e,t)&&n.push(r);return n}function oi(){return new i(`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`).addOption(new r(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).action(async e=>{let t=process.cwd(),n;try{n=await ri({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope})}catch(e){if(e instanceof s){process.stderr.write(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.
408
- `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}try{let{previewContent:e}=await import(`./preview-DZKfHXsi.mjs`),{loadConfig:t}=await import(`./loader-BGK5A8F9.mjs`),{resolveContentDir:r}=await import(`./dist-7_PKsuCz.mjs`),{config:i}=t(n.projectRoot),a=r(i,n.projectRoot);n.preview=e({projectDir:n.projectRoot,contentDir:a})}catch(e){n.previewWarning=e instanceof Error?e.message:String(e)}process.stdout.write(`${ii(n,n.projectRoot)}\n`),(n.editors.some(e=>e.action===`failed`)||n.mcpAction===`failed`)&&(process.exitCode=1)})}export{Te as A,ut as C,ot as D,ht as E,Ye as O,lt as S,dt as T,or as _,ii as a,Qn as b,Kr as c,Qr as d,ei as f,Q as g,ar as h,ai as i,W as j,Je as k,ri as l,ir as m,Yr as n,oi as o,Lr as p,ni as r,ti as s,Jr as t,Xr as u,rr as v,pt as w,ft as x,tr as y};
409
- //# sourceMappingURL=init-al09RZM6.mjs.map
408
+ `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}try{let{previewContent:e}=await import(`./preview-DCei46zt.mjs`),{loadConfig:t}=await import(`./loader-DOJXinKb.mjs`),{resolveContentDir:r}=await import(`./dist-7_PKsuCz.mjs`),{config:i}=t(n.projectRoot),a=r(i,n.projectRoot);n.preview=e({projectDir:n.projectRoot,contentDir:a})}catch(e){n.previewWarning=e instanceof Error?e.message:String(e)}process.stdout.write(`${ii(n,n.projectRoot)}\n`),(n.editors.some(e=>e.action===`failed`)||n.mcpAction===`failed`)&&(process.exitCode=1)})}export{Te as A,ut as C,ot as D,ht as E,Ye as O,lt as S,dt as T,or as _,ii as a,Qn as b,Kr as c,Qr as d,ei as f,Q as g,ar as h,ai as i,W as j,Je as k,ri as l,ir as m,Yr as n,oi as o,Lr as p,ni as r,ti as s,Jr as t,Xr as u,rr as v,pt as w,ft as x,tr as y};
409
+ //# sourceMappingURL=init-BG3i7h4P.mjs.map
@@ -0,0 +1 @@
1
+ import{l as e}from"./init-BG3i7h4P.mjs";export{e as runInit};
@@ -1,4 +1,4 @@
1
- import{Jr as e,f as t,fi as n,ji as r,qr as i,vi as a}from"./dist-soQLoIV1.mjs";import{t as o}from"./constants-HL-7SyJ2.mjs";import{t as s}from"./is-object-C-4FJ0rP.mjs";import{resolve as c}from"node:path";import{existsSync as l,readFileSync as u}from"node:fs";import{realpath as d}from"node:fs/promises";async function f(e){let t=c(e);try{return await d(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}}var p=r();function m(e,t){let n={...e};for(let r of Object.keys(t)){let i=e[r],a=t[r];s(a)&&s(i)?n[r]=m(i,a):a!==void 0&&(n[r]=a)}return n}function h(e){if(!l(e))return{value:null,path:e,source:null,doc:null};let t;try{t=u(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 s(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}const g=[`include`,`exclude`];function _(e){let t="Run `ok config migrate` to strip the obsolete key from config.yml automatically, or remove it by hand.";return e===`exclude`?[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,t].join(` `):[`content.include has been removed.`,`For subdirectory scoping, set content.dir in .ok/config.yml instead.`,`For pattern-based filtering, use .okignore (gitignore syntax — exclude-only; do not copy include patterns directly).`,t].join(` `)}function v(e){let t=e.value;if(!s(t))return[];let n=t.content;if(!s(n))return[];let r=[];for(let t of g)if(t in n){let n=[`content`,t],i;e.doc!==null&&e.source!==null&&(i=a({file:e.path,source:e.source,doc:e.doc,path:n})),r.push({code:`REMOVED_KEY`,path:n,redirect:_(t),...i===void 0?{}:{source:i}})}return r}function y(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=a({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function b(r){let a=r??process.cwd(),s=[],l=e(`user`,a),u=i({absPath:l}),d={};u.valid&&u.source!==void 0?(d=m(d,u.value),s.push(l)):u.valid;let f=c(a,`.ok`,o),p=h(f);if(p.value!==null){let e=v(p);if(e.length>0)throw Error(e.map(n).join(`
1
+ import{Jr as e,f as t,fi as n,ji as r,qr as i,vi as a}from"./dist-soQLoIV1.mjs";import{t as o}from"./constants-CkYsa36O.mjs";import{t as s}from"./is-object-C-4FJ0rP.mjs";import{resolve as c}from"node:path";import{existsSync as l,readFileSync as u}from"node:fs";import{realpath as d}from"node:fs/promises";async function f(e){let t=c(e);try{return await d(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}}var p=r();function m(e,t){let n={...e};for(let r of Object.keys(t)){let i=e[r],a=t[r];s(a)&&s(i)?n[r]=m(i,a):a!==void 0&&(n[r]=a)}return n}function h(e){if(!l(e))return{value:null,path:e,source:null,doc:null};let t;try{t=u(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 s(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}const g=[`include`,`exclude`];function _(e){let t="Run `ok config migrate` to strip the obsolete key from config.yml automatically, or remove it by hand.";return e===`exclude`?[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,t].join(` `):[`content.include has been removed.`,`For subdirectory scoping, set content.dir in .ok/config.yml instead.`,`For pattern-based filtering, use .okignore (gitignore syntax — exclude-only; do not copy include patterns directly).`,t].join(` `)}function v(e){let t=e.value;if(!s(t))return[];let n=t.content;if(!s(n))return[];let r=[];for(let t of g)if(t in n){let n=[`content`,t],i;e.doc!==null&&e.source!==null&&(i=a({file:e.path,source:e.source,doc:e.doc,path:n})),r.push({code:`REMOVED_KEY`,path:n,redirect:_(t),...i===void 0?{}:{source:i}})}return r}function y(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=a({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function b(r){let a=r??process.cwd(),s=[],l=e(`user`,a),u=i({absPath:l}),d={};u.valid&&u.source!==void 0?(d=m(d,u.value),s.push(l)):u.valid;let f=c(a,`.ok`,o),p=h(f);if(p.value!==null){let e=v(p);if(e.length>0)throw Error(e.map(n).join(`
2
2
 
3
3
  `));d=m(d,p.value),s.push(f)}x(d,[`upload`,`maxBytes`],`streaming uploads have no user-facing cap`),x(d,[`github`,`oauthAppClientId`],`use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID env var instead`),x(d,[`server`,`host`],`use the --host flag or HOST env var instead`),x(d,[`server`,`openOnAgentEdit`]),x(d,[`mcp`,`autoStart`],`to disable auto-start, set OK_MCP_AUTOSTART=0`),x(d,[`mcp`,`tools`,`read_document`,`historyDepth`]),x(d,[`mcp`,`tools`,`grep`,`maxResults`]),x(d,[`mcp`,`tools`,`search`,`maxResults`]),x(d,[`preview`,`baseUrl`],"preview URLs now resolve only to the running UI process — start one with `ok ui`");let g=t.safeParse(d);if(!g.success){let e={code:`SCHEMA_INVALID`,issues:y(g.error.issues,p)};throw Error(n(e))}return{config:g.data,sources:s}}function x(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){if(!s(r))return;r=r[t[e]]}if(!s(r))return;let i=t[t.length-1];if(r[i]===void 0)return;let a=t.join(`.`);console.warn(`[config] ${a} is no longer user-configurable; ${n??`the value is hardcoded in @inkeep/open-knowledge-core`}. Remove the key to silence this warning.`)}function S(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=f(e.startupCwd);return async o=>{let s=await f(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{b as n,S as t};
4
- //# sourceMappingURL=loader-B64XEbbD.mjs.map
4
+ //# sourceMappingURL=loader-4X5eR4wo.mjs.map
@@ -0,0 +1 @@
1
+ import{n as e}from"./loader-4X5eR4wo.mjs";export{e as loadConfig};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./preview-fk1DB9JQ.mjs";export{t as formatPreviewBlock,e as previewContent};
@@ -1,3 +1,3 @@
1
- import{bt as e}from"./dist-soQLoIV1.mjs";import"./constants-HL-7SyJ2.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{bt as e}from"./dist-soQLoIV1.mjs";import"./constants-CkYsa36O.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-CYIUoqRn.mjs.map
3
+ //# sourceMappingURL=preview-fk1DB9JQ.mjs.map
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ActivityPanelDiffView-BN3fSrLi.js","./chunk-CFjPhJqf.js","./dist-CQw2y-s3.js","./compiler-runtime-CVnuRdak.js","./ActivityPanelDiffView-legcy4jI.css"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./preload-helper-2ej06EnG.js";import{n,r,t as i}from"./compiler-runtime-CVnuRdak.js";import{Nn as a,_n as o,er as s,n as c,nr as l,nt as u,r as d}from"./DocumentContext-CP8suU6i.js";import{n as f,r as p}from"./dist-CQw2y-s3.js";import{$ as m,A as h,D as g,O as _,Vt as v,_ as y,et as b}from"./doc-hash-BrKkCdCz.js";import{C as x,t as S}from"./button-JrGyO3-P.js";import{f as C,i as w,m as T,r as E,t as D}from"./agent-presence-DUe_PdKt.js";import{a as O,c as k,i as A,o as j,s as M,t as ee,x as N}from"./dialog-bA5Nvc2p.js";import{a as te}from"./collapsible-DfUFsfqv.js";var ne=x(`rewind`,[[`path`,{d:`M12 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 12 18z`,key:`2a1g8i`}],[`path`,{d:`M22 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 22 18z`,key:`rg3s36`}]]),P=i(),F=e(n(),1),I=500,re=64;async function ie(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new u(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=v.safeParse(r);throw e.success?Error(e.data.title):new u(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let i=m.safeParse(r);if(!i.success)throw new u(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:i.error,status:n.status});return i.data}async function L(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&stackIndex=${n}`,i=await fetch(r),a;try{a=await i.json()}catch(e){throw new u(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:i.status})}if(!i.ok){let e=v.safeParse(a);throw e.success?Error(e.data.title):new u(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:i.status})}let o=b.safeParse(a);if(!o.success)throw new u(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:o.error,status:i.status});return o.data.diff}function ae(e){let t=(0,P.c)(23),{systemProvider:n}=c(),[r,i]=(0,F.useState)(null),[a,o]=(0,F.useState)(`idle`),[s,l]=(0,F.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=new w(re),t[0]=u):u=t[0];let d=(0,F.useRef)(u),f=(0,F.useRef)(0),p;t[1]===n?p=t[2]:(p=e=>{let t=f.current+=1;o(`loading`),l(null),ie(e).then(r=>{if(f.current!==t)return;let a=R(n,e);i({...r,writingDocs:a}),o(`ready`)}).catch(e=>{f.current===t&&(l(e instanceof Error?e.message:String(e)),o(`error`))})},t[1]=n,t[2]=p);let m=p,h;t[3]!==e||t[4]!==m?(h=()=>{if(!e){f.current+=1,i(null),o(`idle`),l(null),d.current.clear();return}d.current.clear(),m(e);let t=null,n=y(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,m(e)},I))});return()=>{t&&clearTimeout(t),n()}},t[3]=e,t[4]=m,t[5]=h):h=t[5];let g;t[6]===e?g=t[7]:(g=[e],t[6]=e,t[7]=g),(0,F.useEffect)(h,g);let _,v;t[8]!==e||t[9]!==n?(_=()=>{if(!e||!n)return;let t=()=>{if(!n.awareness)return;let t=R(n,e);i(e=>!e||oe(e.writingDocs,t)?e:{...e,writingDocs:t})},r=n.awareness;if(!r||typeof r.on!=`function`){t();return}r.on(`update`,t),t();let a=setInterval(t,1e3);return()=>{clearInterval(a),typeof r.off==`function`&&r.off(`update`,t)}},v=[e,n],t[8]=e,t[9]=n,t[10]=_,t[11]=v):(_=t[10],v=t[11]),(0,F.useEffect)(_,v);let b;t[12]===e?b=t[13]:(b=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=d.current.get(r);if(i!==void 0)return i;let a=await L(e,t,n);return d.current.set(r,a),a},t[12]=e,t[13]=b);let x=b,S;t[14]!==e||t[15]!==m?(S=()=>{e&&m(e)},t[14]=e,t[15]=m,t[16]=S):S=t[16];let C=S,T;return t[17]!==r||t[18]!==s||t[19]!==x||t[20]!==C||t[21]!==a?(T={data:r,status:a,error:s,reload:C,fetchBurstDiff:x},t[17]=r,t[18]=s,t[19]=x,t[20]=C,t[21]=a,t[22]=T):T=t[22],T}function oe(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function R(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!D(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}var z=r(),se=(0,F.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-BN3fSrLi.js`),__vite__mapDeps([0,1,2,3,4]),import.meta.url)).ActivityPanelDiffView}));function ce(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return o._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return o._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function le(e){let t=(0,P.c)(42),{burst:n,docName:r,fetchBurstDiff:i}=e,{_:a}=p(),[o,s]=(0,F.useState)(!1),[c,u]=(0,F.useState)(null),[d,m]=(0,F.useState)(null),[h,g]=(0,F.useState)(!1),[_,v]=(0,F.useState)(ue),y,b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let e=setInterval(()=>v(Date.now()),3e4);return()=>clearInterval(e)},b=[],t[0]=y,t[1]=b):(y=t[0],b=t[1]),(0,F.useEffect)(y,b);let x;t[2]!==n.stackIndex||t[3]!==c||t[4]!==r||t[5]!==o||t[6]!==i||t[7]!==h?(x=()=>{let e=!o;s(e),e&&c===null&&!h&&(g(!0),m(null),i(r,n.stackIndex).then(e=>{u(e),g(!1)}).catch(e=>{m(e instanceof Error?e.message:String(e)),g(!1)}))},t[2]=n.stackIndex,t[3]=c,t[4]=r,t[5]=o,t[6]=i,t[7]=h,t[8]=x):x=t[8];let S=x,C=n.stackIndex+1,w;t[9]!==a||t[10]!==C||t[11]!==o?(w=a(o?{id:`-i7ik4`,values:{burstNumber:C}}:{id:`EeRZnZ`,values:{burstNumber:C}}),t[9]=a,t[10]=C,t[11]=o,t[12]=w):w=t[12];let T;t[13]===o?T=t[14]:(T=o?(0,z.jsx)(l,{className:`size-3 shrink-0`,"aria-hidden":`true`}):(0,z.jsx)(te,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[13]=o,t[14]=T);let E;t[15]!==n.ts||t[16]!==_?(E=ce(n.ts,_),t[15]=n.ts,t[16]=_,t[17]=E):E=t[17];let D;t[18]===E?D=t[19]:(D=(0,z.jsx)(`span`,{className:`font-mono`,children:E}),t[18]=E,t[19]=D);let O;t[20]===n.additions?O=t[21]:(O=(0,z.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[20]=n.additions,t[21]=O);let k;t[22]===n.deletions?k=t[23]:(k=(0,z.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[22]=n.deletions,t[23]=k);let A;t[24]!==O||t[25]!==k?(A=(0,z.jsxs)(`span`,{className:`ml-auto font-mono`,children:[O,` `,k]}),t[24]=O,t[25]=k,t[26]=A):A=t[26];let j;t[27]!==o||t[28]!==A||t[29]!==w||t[30]!==T||t[31]!==D||t[32]!==S?(j=(0,z.jsxs)(`button`,{type:`button`,onClick:S,className:`flex w-full items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground hover:bg-muted/40`,"aria-expanded":o,"aria-label":w,children:[T,D,A]}),t[27]=o,t[28]=A,t[29]=w,t[30]=T,t[31]=D,t[32]=S,t[33]=j):j=t[33];let M;t[34]!==c||t[35]!==o||t[36]!==d||t[37]!==h?(M=o?(0,z.jsx)(`div`,{className:`bg-muted/20`,children:h?(0,z.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,z.jsx)(f,{id:`38foVZ`})}):d?(0,z.jsx)(`div`,{className:`px-4 py-2 text-xs text-destructive`,children:(0,z.jsx)(f,{id:`pmKdif`,values:{loadError:d}})}):c===null?(0,z.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,z.jsx)(f,{id:`iNFKkm`})}):(0,z.jsx)(F.Suspense,{fallback:(0,z.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,z.jsx)(f,{id:`38foVZ`})}),children:(0,z.jsx)(se,{diff:c})})}):null,t[34]=c,t[35]=o,t[36]=d,t[37]=h,t[38]=M):M=t[38];let ee;return t[39]!==j||t[40]!==M?(ee=(0,z.jsxs)(`div`,{className:`border-t border-border/50`,children:[j,M]}),t[39]=j,t[40]=M,t[41]=ee):ee=t[41],ee}function ue(){return Date.now()}function de(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return o._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return o._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return o._({id:`nYeBmY`,values:{hours:r}})}function fe(e){let t=(0,P.c)(118),{file:n,sessionAlive:r,isWriting:i,onNavigate:a,onUndoLast:o,onUndoAll:s,fetchBurstDiff:c}=e,{_:u}=p(),{docName:d}=n,[m,v]=(0,F.useState)(!1),[y,b]=(0,F.useState)(!1),[x,w]=(0,F.useState)(!1),[T,E]=(0,F.useState)(me),D,N;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{let e=setInterval(()=>E(Date.now()),3e4);return()=>clearInterval(e)},N=[],t[0]=D,t[1]=N):(D=t[0],N=t[1]),(0,F.useEffect)(D,N),n.bursts.length===0)return null;let I=!r||n.bursts.length===0||x,re=n.bursts.length,ie;t[2]!==u||t[3]!==n.bursts.length||t[4]!==r?(ie=r?n.bursts.length===0?u({id:`2fkdnR`}):null:u({id:`NzFvyK`}),t[2]=u,t[3]=n.bursts.length,t[4]=r,t[5]=ie):ie=t[5];let L=ie,ae;t[6]!==I||t[7]!==n.docName||t[8]!==o?(ae=e=>{e.stopPropagation(),!I&&(w(!0),Promise.resolve(o(n.docName)).finally(()=>w(!1)))},t[6]=I,t[7]=n.docName,t[8]=o,t[9]=ae):ae=t[9];let oe=ae,R;t[10]===I?R=t[11]:(R=e=>{e.stopPropagation(),!I&&b(!0)},t[10]=I,t[11]=R);let se=R,ce;t[12]!==I||t[13]!==n.docName||t[14]!==s?(ce=()=>{b(!1),!I&&(w(!0),Promise.resolve(s(n.docName)).finally(()=>w(!1)))},t[12]=I,t[13]=n.docName,t[14]=s,t[15]=ce):ce=t[15];let ue=ce,fe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>v(pe),t[16]=fe):fe=t[16];let B;t[17]!==u||t[18]!==d||t[19]!==m?(B=u(m?{id:`rVgSRB`,values:{docName:d}}:{id:`tW_yvQ`,values:{docName:d}}),t[17]=u,t[18]=d,t[19]=m,t[20]=B):B=t[20];let V;t[21]===m?V=t[22]:(V=m?(0,z.jsx)(l,{className:`size-4`,"aria-hidden":`true`}):(0,z.jsx)(te,{className:`size-4`,"aria-hidden":`true`}),t[21]=m,t[22]=V);let H;t[23]!==m||t[24]!==B||t[25]!==V?(H=(0,z.jsx)(`button`,{type:`button`,onClick:fe,className:`flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted`,"aria-expanded":m,"aria-label":B,"data-testid":`activity-panel-file-row-carrot`,children:V}),t[23]=m,t[24]=B,t[25]=V,t[26]=H):H=t[26];let U;t[27]!==n.docName||t[28]!==a?(U=()=>a(n.docName),t[27]=n.docName,t[28]=a,t[29]=U):U=t[29];let W;t[30]!==u||t[31]!==d?(W=u({id:`QcpeeE`,values:{docName:d}}),t[30]=u,t[31]=d,t[32]=W):W=t[32];let G;t[33]!==n.docName||t[34]!==U||t[35]!==W?(G=(0,z.jsx)(`button`,{type:`button`,onClick:U,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":W,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[33]=n.docName,t[34]=U,t[35]=W,t[36]=G):G=t[36];let K;t[37]!==u||t[38]!==d?(K=u({id:`m4v3XT`,values:{docName:d}}),t[37]=u,t[38]=d,t[39]=K):K=t[39];let he;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,z.jsx)(C,{className:`size-3.5`,"aria-hidden":`true`}),t[40]=he):he=t[40];let q;t[41]!==I||t[42]!==oe||t[43]!==K?(q=(0,z.jsx)(h,{asChild:!0,children:(0,z.jsx)(S,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:oe,disabled:I,"aria-label":K,"data-testid":`activity-panel-undo-last`,children:he})}),t[41]=I,t[42]=oe,t[43]=K,t[44]=q):q=t[44];let J;t[45]!==u||t[46]!==L?(J=L??u({id:`ArBWJf`}),t[45]=u,t[46]=L,t[47]=J):J=t[47];let Y;t[48]===J?Y=t[49]:(Y=(0,z.jsx)(_,{side:`bottom`,children:J}),t[48]=J,t[49]=Y);let X;t[50]!==q||t[51]!==Y?(X=(0,z.jsxs)(g,{children:[q,Y]}),t[50]=q,t[51]=Y,t[52]=X):X=t[52];let Z;t[53]!==u||t[54]!==d?(Z=u({id:`J2MgzQ`,values:{docName:d}}),t[53]=u,t[54]=d,t[55]=Z):Z=t[55];let ge;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,z.jsx)(ne,{className:`size-3.5`,"aria-hidden":`true`}),t[56]=ge):ge=t[56];let _e;t[57]!==I||t[58]!==se||t[59]!==Z?(_e=(0,z.jsx)(h,{asChild:!0,children:(0,z.jsx)(S,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:se,disabled:I,"aria-label":Z,"data-testid":`activity-panel-undo-all`,children:ge})}),t[57]=I,t[58]=se,t[59]=Z,t[60]=_e):_e=t[60];let ve;t[61]!==u||t[62]!==L?(ve=L??u({id:`mNY1G6`}),t[61]=u,t[62]=L,t[63]=ve):ve=t[63];let ye;t[64]===ve?ye=t[65]:(ye=(0,z.jsx)(_,{side:`bottom`,children:ve}),t[64]=ve,t[65]=ye);let be;t[66]!==_e||t[67]!==ye?(be=(0,z.jsxs)(g,{children:[_e,ye]}),t[66]=_e,t[67]=ye,t[68]=be):be=t[68];let xe;t[69]===n.additionsTotal?xe=t[70]:(xe=(0,z.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[69]=n.additionsTotal,t[70]=xe);let Se;t[71]===n.deletionsTotal?Se=t[72]:(Se=(0,z.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[71]=n.deletionsTotal,t[72]=Se);let Ce;t[73]!==xe||t[74]!==Se?(Ce=(0,z.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[xe,` `,Se]}),t[73]=xe,t[74]=Se,t[75]=Ce):Ce=t[75];let we;t[76]!==n.lastTs||t[77]!==T?(we=de(n.lastTs,T),t[76]=n.lastTs,t[77]=T,t[78]=we):we=t[78];let Q;t[79]===we?Q=t[80]:(Q=(0,z.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:we}),t[79]=we,t[80]=Q);let Te;t[81]===i?Te=t[82]:(Te=i?(0,z.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,z.jsx)(f,{id:`6q0rnH`})}):null,t[81]=i,t[82]=Te);let Ee;t[83]!==H||t[84]!==G||t[85]!==X||t[86]!==be||t[87]!==Ce||t[88]!==Q||t[89]!==Te?(Ee=(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[H,G,X,be,Ce,Q,Te]}),t[83]=H,t[84]=G,t[85]=X,t[86]=be,t[87]=Ce,t[88]=Q,t[89]=Te,t[90]=Ee):Ee=t[90];let De;t[91]!==m||t[92]!==c||t[93]!==n.bursts||t[94]!==n.docName?(De=m?(0,z.jsx)(`div`,{children:n.bursts.map(e=>(0,z.jsx)(le,{burst:e,docName:n.docName,fetchBurstDiff:c},`${n.docName}:${e.stackIndex}`))}):null,t[91]=m,t[92]=c,t[93]=n.bursts,t[94]=n.docName,t[95]=De):De=t[95];let Oe;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,z.jsx)(k,{children:(0,z.jsx)(f,{id:`SEYWYq`})}),t[96]=Oe):Oe=t[96];let ke;t[97]!==re||t[98]!==d?(ke={docName:d,burstCount:re},t[97]=re,t[98]=d,t[99]=ke):ke=t[99];let Ae;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ae={0:(0,z.jsx)(`span`,{className:`font-mono text-foreground`})},t[100]=Ae):Ae=t[100];let je;t[101]===ke?je=t[102]:(je=(0,z.jsxs)(M,{children:[Oe,(0,z.jsx)(O,{children:(0,z.jsx)(f,{id:`ZBYKxv`,values:ke,components:Ae})})]}),t[101]=ke,t[102]=je);let Me;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Me=()=>b(!1),t[103]=Me):Me=t[103];let Ne;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,z.jsx)(S,{type:`button`,variant:`outline`,onClick:Me,"data-testid":`activity-panel-undo-all-cancel`,children:(0,z.jsx)(f,{id:`dEgA5A`})}),t[104]=Ne):Ne=t[104];let Pe;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,z.jsx)(f,{id:`MWrUEd`}),t[105]=Pe):Pe=t[105];let Fe;t[106]===ue?Fe=t[107]:(Fe=(0,z.jsxs)(j,{children:[Ne,(0,z.jsx)(S,{type:`button`,variant:`destructive`,onClick:ue,"data-testid":`activity-panel-undo-all-confirm`,children:Pe})]}),t[106]=ue,t[107]=Fe);let Ie;t[108]!==je||t[109]!==Fe?(Ie=(0,z.jsxs)(A,{className:`sm:max-w-md`,children:[je,Fe]}),t[108]=je,t[109]=Fe,t[110]=Ie):Ie=t[110];let $;t[111]!==y||t[112]!==Ie?($=(0,z.jsx)(ee,{open:y,onOpenChange:b,children:Ie}),t[111]=y,t[112]=Ie,t[113]=$):$=t[113];let Le;return t[114]!==Ee||t[115]!==De||t[116]!==$?(Le=(0,z.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[Ee,De,$]}),t[114]=Ee,t[115]=De,t[116]=$,t[117]=Le):Le=t[117],Le}function pe(e){return!e}function me(){return Date.now()}async function B(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 V(e){return`#/${e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function H(e){typeof window>`u`||(window.location.hash=V(e))}function U(){let e=(0,P.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsx)(a,{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,z.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,z.jsx)(`span`,{className:`text-sm`,children:(0,z.jsx)(f,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function W(e){let t=(0,P.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,z.jsx)(s,{className:`size-6 text-destructive`,"aria-hidden":`true`}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,z.jsx)(f,{id:`DhLHEb`})}),t[1]=a):a=t[1];let o;t[2]===n?o=t[3]:(o=(0,z.jsxs)(`div`,{className:`space-y-1`,children:[a,(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=o);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,z.jsx)(f,{id:`6gRgw8`}),t[4]=c):c=t[4];let l;t[5]===r?l=t[6]:(l=(0,z.jsx)(S,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:c}),t[5]=r,t[6]=l);let u;return t[7]!==o||t[8]!==l?(u=(0,z.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function G(){let e=(0,P.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,z.jsx)(`p`,{className:`text-sm italic`,children:(0,z.jsx)(f,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function K(e){let t=(0,P.c)(12),{onExit:n,showBackButton:r}=e,{_:i}=p(),a;t[0]===i?a=t[1]:(a=i({id:`kYL1lH`}),t[0]=i,t[1]=a);let o;t[2]!==n||t[3]!==r?(o=r?(0,z.jsx)(he,{onClick:n}):null,t[2]=n,t[3]=r,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,z.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,z.jsx)(f,{id:`kYL1lH`})}),t[5]=s):s=t[5];let c;t[6]===o?c=t[7]:(c=(0,z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[o,s]}),t[6]=o,t[7]=c);let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,z.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,z.jsx)(f,{id:`D_WKe_`})})}),t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==c?(u=(0,z.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":a,children:[c,l]}),t[9]=a,t[10]=c,t[11]=u):u=t[11],u}function he(e){let t=(0,P.c)(9),{onClick:n}=e,{_:r}=p(),i;t[0]===r?i=t[1]:(i=r({id:`ogAuyr`}),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,z.jsx)(T,{}),t[2]=a):a=t[2];let o;t[3]!==n||t[4]!==i?(o=(0,z.jsx)(h,{asChild:!0,children:(0,z.jsx)(S,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":i,"data-testid":`docpanel-exit-agent-mode`,children:a})}),t[3]=n,t[4]=i,t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,z.jsx)(_,{side:`bottom`,children:(0,z.jsx)(f,{id:`ogAuyr`})}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,z.jsxs)(g,{children:[o,s]}),t[7]=o,t[8]=c),c}function q(e){let t=(0,P.c)(9),{lastTs:n}=e,[r]=(0,F.useState)(J),i;t[0]!==n||t[1]!==r?(i=n?Y(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,z.jsx)(`span`,{className:`font-medium`,children:(0,z.jsx)(f,{id:`LCUy_N`})}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=a?(0,z.jsxs)(`span`,{children:[` · `,a]}):null,t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,z.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,z.jsx)(f,{id:`GK-IRZ`})}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(0,z.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:[o,s,c]}),t[7]=s,t[8]=l),l}function J(){return Date.now()}function Y(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return o._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return o._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return o._({id:`nYeBmY`,values:{hours:n}})}function X(e){let t=(0,P.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,z.jsx)(E,{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,z.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 Z(e){let t=(0,P.c)(26),{data:n,status:r,error:i,reload:a,fetchBurstDiff:o,onExit:s,onNavigate:c,onUndoLast:l,onUndoAll:u,showBackButton:d}=e,{_:m}=p(),h=n?.files?.[0]?.lastTs??null,g=n?.files?.length??0,_;t[0]===m?_=t[1]:(_=m({id:`kYL1lH`}),t[0]=m,t[1]=_);let v;t[2]!==s||t[3]!==d?(v=d?(0,z.jsx)(he,{onClick:s}):null,t[2]=s,t[3]=d,t[4]=v):v=t[4];let y;t[5]!==n||t[6]!==g||t[7]!==h?(y=n?.agent?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(X,{agent:n.agent}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,z.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,z.jsx)(f,{id:`F6pfE9`}):h===null?(0,z.jsx)(f,{id:`PMyJ9C`}):(0,z.jsx)(f,{id:`237hSL`}),n.files.length>0?(0,z.jsxs)(z.Fragment,{children:[` · `,(0,z.jsx)(f,{id:`u3BOHd`,values:{fileCount:g}})]}):null]})]})]}):(0,z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,z.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,z.jsx)(f,{id:`kYL1lH`})})}),t[5]=n,t[6]=g,t[7]=h,t[8]=y):y=t[8];let b;t[9]!==v||t[10]!==y?(b=(0,z.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[v,y]}),t[9]=v,t[10]=y,t[11]=b):b=t[11];let x;t[12]!==n||t[13]!==i||t[14]!==o||t[15]!==h||t[16]!==c||t[17]!==u||t[18]!==l||t[19]!==a||t[20]!==r?(x=(0,z.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:r===`loading`&&n===null?(0,z.jsx)(U,{}):r===`error`&&i?(0,z.jsx)(W,{error:i,onRetry:a}):n===null?(0,z.jsx)(G,{}):(0,z.jsxs)(z.Fragment,{children:[!n.sessionAlive&&h!==null?(0,z.jsx)(q,{lastTs:h}):null,n.files.length===0?(0,z.jsx)(G,{}):n.files.map(e=>(0,z.jsx)(fe,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:c,onUndoLast:l,onUndoAll:u,fetchBurstDiff:o},e.docName))]})}),t[12]=n,t[13]=i,t[14]=o,t[15]=h,t[16]=c,t[17]=u,t[18]=l,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;return t[22]!==_||t[23]!==b||t[24]!==x?(S=(0,z.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":_,children:[b,x]}),t[22]=_,t[23]=b,t[24]=x,t[25]=S):S=t[25],S}function ge(e){let t=(0,P.c)(28),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{showBackButton:r}=n,i=r===void 0?!0:r,{_:a}=p(),{docPanelAgentId:o,closeActivityPanel:s}=c(),{openDocumentTransition:l}=d(),{data:u,status:f,error:m,reload:h,fetchBurstDiff:g}=ae(o);if(o===null){let e;return t[2]!==s||t[3]!==i?(e=(0,z.jsx)(K,{onExit:s,showBackButton:i}),t[2]=s,t[3]=i,t[4]=e):e=t[4],e}let _;t[5]===l?_=t[6]:(_=e=>{l(e),H(e)},t[5]=l,t[6]=_);let v=_,y;t[7]!==a||t[8]!==u||t[9]!==o||t[10]!==h?(y=async e=>{try{await B({connectionId:o,docName:e,scope:`last`,agentName:u?.agent?.displayName}),h()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);N.error(a({id:`EqrC_R`,values:{message:n}})),h()}},t[7]=a,t[8]=u,t[9]=o,t[10]=h,t[11]=y):y=t[11];let b=y,x;t[12]!==a||t[13]!==u||t[14]!==o||t[15]!==h?(x=async e=>{try{await B({connectionId:o,docName:e,scope:`file`,agentName:u?.agent?.displayName}),N.success(a({id:`pRc-Im`,values:{docName:e}})),h()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);N.error(a({id:`7KeV5F`,values:{message:n}})),h()}},t[12]=a,t[13]=u,t[14]=o,t[15]=h,t[16]=x):x=t[16];let S=x,C;return t[17]!==s||t[18]!==u||t[19]!==m||t[20]!==g||t[21]!==v||t[22]!==S||t[23]!==b||t[24]!==h||t[25]!==i||t[26]!==f?(C=(0,z.jsx)(Z,{data:u,status:f,error:m,reload:h,fetchBurstDiff:g,onExit:s,onNavigate:v,onUndoLast:b,onUndoAll:S,showBackButton:i}),t[17]=s,t[18]=u,t[19]=m,t[20]=g,t[21]=v,t[22]=S,t[23]=b,t[24]=h,t[25]=i,t[26]=f,t[27]=C):C=t[27],C}export{ge as ActivityModeContent};
@@ -0,0 +1,13 @@
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{n as i}from"./dist-CQw2y-s3.js";var a=r(),o=n(),s=e(t());function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?c(Object(n),!0).forEach((function(t){u(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function u(e,t,n){return(t=function(e){var t=function(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}(e,`string`);return typeof t==`symbol`?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){if(e==null)return{};var n,r,i=function(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function f(e,t){return m(e)||function(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}(e,t)||g(e,t)||v()}function p(e){return function(e){if(Array.isArray(e))return _(e)}(e)||h(e)||g(e)||function(){throw TypeError(`Invalid attempt to spread non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function m(e){if(Array.isArray(e))return e}function h(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function g(e,t){if(e){if(typeof e==`string`)return _(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_(e,t):void 0}}function _(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=g(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
4
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}var b=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function x(e,t){return e(t={exports:{}},t.exports),t.exports}var S=x((function(e){(function(){var t={}.hasOwnProperty;function n(){for(var e=[],r=0;r<arguments.length;r++){var i=arguments[r];if(i){var a=typeof i;if(a===`string`||a===`number`)e.push(i);else if(Array.isArray(i)){if(i.length){var o=n.apply(null,i);o&&e.push(o)}}else if(a===`object`){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes(`[native code]`)){e.push(i.toString());continue}for(var s in i)t.call(i,s)&&i[s]&&e.push(s)}}}return e.join(` `)}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})),C={hunkClassName:``,lineClassName:``,gutterClassName:``,codeClassName:``,monotonous:!1,gutterType:`default`,viewType:`split`,widgets:{},hideGutter:!1,selectedChanges:[],generateAnchorID:function(){},generateLineClassName:function(){},renderGutter:function(e){var t=e.renderDefault;return(0,e.wrapInAnchor)(t())},codeEvents:{},gutterEvents:{}},w=(0,s.createContext)(C),T=w.Provider,E=function(){return(0,s.useContext)(w)},D=x((function(e,t){(function(t){function n(e){var t=e.slice(11),n=null,r=null;switch(t.indexOf(`"`)){case-1:n=(o=t.split(` `))[0].slice(2),r=o[1].slice(2);break;case 0:var i=t.indexOf(`"`,2);n=t.slice(3,i);var a=t.indexOf(`"`,i+1);r=a<0?t.slice(i+4):t.slice(a+3,-1);break;default:var o;n=(o=t.split(` `))[0].slice(2),r=o[1].slice(3,-1)}return{oldPath:n,newPath:r}}e.exports={parse:function(e){for(var t,r,i,a,o,s=[],c=2,l=e.split(`
5
+ `),u=l.length,d=0;d<u;){var f=l[d];if(f.indexOf(`diff --git`)===0){t={hunks:[],oldEndingNewLine:!0,newEndingNewLine:!0,oldPath:(o=n(f)).oldPath,newPath:o.newPath},s.push(t);var p,m=null;simiLoop:for(;p=l[++d];){var h=p.indexOf(` `),g=h>-1?p.slice(0,h):g;switch(g){case`diff`:d--;break simiLoop;case`deleted`:case`new`:var _=p.slice(h+1);_.indexOf(`file mode`)===0&&(t[g===`new`?`newMode`:`oldMode`]=_.slice(10));break;case`similarity`:t.similarity=parseInt(p.split(` `)[2],10);break;case`index`:var v=p.slice(h+1).split(` `),y=v[0].split(`..`);t.oldRevision=y[0],t.newRevision=y[1],v[1]&&(t.oldMode=t.newMode=v[1]);break;case`copy`:case`rename`:var b=p.slice(h+1);b.indexOf(`from`)===0?t.oldPath=b.slice(5):t.newPath=b.slice(3),m=g;break;case`---`:var x=p.slice(h+1),S=l[++d].slice(4);x===`/dev/null`?(S=S.slice(2),m=`add`):S===`/dev/null`?(x=x.slice(2),m=`delete`):(m=`modify`,x=x.slice(2),S=S.slice(2)),x&&(t.oldPath=x),S&&(t.newPath=S),c=5;break simiLoop}}t.type=m||`modify`}else if(f.indexOf(`Binary`)===0)t.isBinary=!0,t.type=f.indexOf(`/dev/null and`)>=0?`add`:f.indexOf(`and /dev/null`)>=0?`delete`:`modify`,c=2,t=null;else if(c===5)if(f.indexOf(`@@`)===0){var C=/^@@\s+-([0-9]+)(,([0-9]+))?\s+\+([0-9]+)(,([0-9]+))?/.exec(f);r={content:f,oldStart:C[1]-0,newStart:C[4]-0,oldLines:C[3]-0||1,newLines:C[6]-0||1,changes:[]},t.hunks.push(r),i=r.oldStart,a=r.newStart}else{var w=f.slice(0,1),T={content:f.slice(1)};switch(w){case`+`:T.type=`insert`,T.isInsert=!0,T.lineNumber=a,a++;break;case`-`:T.type=`delete`,T.isDelete=!0,T.lineNumber=i,i++;break;case` `:T.type=`normal`,T.isNormal=!0,T.oldLineNumber=i,T.newLineNumber=a,i++,a++;break;case`\\`:var E=r.changes[r.changes.length-1];E.isDelete||(t.newEndingNewLine=!1),E.isInsert||(t.oldEndingNewLine=!1)}T.type&&r.changes.push(T)}d++}return s}}})()}));function O(e){return e.type===`insert`}function k(e){return e.type===`delete`}function A(e){return e.type===`normal`}function j(e,t){var n=t.nearbySequences===`zip`?function(e){return f(e.reduce((function(e,t,n){var r=f(e,3),i=r[0],a=r[1],o=r[2];return a?O(t)&&o>=0?(i.splice(o+1,0,t),[i,t,o+2]):(i.push(t),[i,t,k(t)&&k(a)?o:n]):(i.push(t),[i,t,k(t)?n:-1])}),[[],null,-1]),1)[0]}(e.changes):e.changes;return l(l({},e),{},{isPlain:!1,changes:n})}function M(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=function(e){if(e.startsWith(`diff --git`))return e;var t=e.indexOf(`
6
+ `),n=e.indexOf(`
7
+ `,t+1),r=e.slice(0,t),i=e.slice(t+1,n),a=r.split(` `).slice(1,-3).join(` `),o=i.split(` `).slice(1,-3).join(` `);return[`diff --git a/${a} b/${o}`,`index 1111111..2222222 100644`,`--- a/${a}`,`+++ b/${o}`,e.slice(n+1)].join(`
8
+ `)}(e.trimStart());return D.parse(n).map((function(e){return function(e,t){var n=e.hunks.map((function(e){return j(e,t)}));return l(l({},e),{},{hunks:n})}(e,t)}))}function N(e){return e[0]}function P(e){return e[e.length-1]}function F(e){return[`${e}Start`,`${e}Lines`]}function I(e){return e===`old`?function(e){return O(e)?-1:A(e)?e.oldLineNumber:e.lineNumber}:function(e){return k(e)?-1:A(e)?e.newLineNumber:e.lineNumber}}function ee(e,t){return function(n,r){var i=n[e],a=i+n[t];return r>=i&&r<a}}function te(e,t){return function(n,r,i){var a=n[e]+n[t],o=r[e];return i>=a&&i<o}}function ne(e){var t=I(e),n=function(e){var t=f(F(e),2),n=ee(t[0],t[1]);return function(e,t){return e.find((function(e){return n(e,t)}))}}(e);return function(e,r){var i=n(e,r);if(i)return i.changes.find((function(e){return t(e)===r}))}}function re(e){var t=e===`old`?`new`:`old`,n=f(F(e),2),r=n[0],i=n[1],a=f(F(t),2),o=a[0],s=a[1],c=I(e),l=I(t),u=ee(r,i),d=te(r,i);return function(e,t){var n=N(e);if(t<n[r]){var a=n[r]-t;return n[o]-a}var f=P(e);if(f[r]+f[i]<=t){var p=t-f[r]-f[i];return f[o]+f[s]+p}for(var m=0;m<e.length;m++){var h=e[m],g=e[m+1];if(u(h,t)){var _=h.changes.findIndex((function(e){return c(e)===t})),v=h.changes[_];if(A(v))return l(v);var y=k(v)?_+1:_-1,b=h.changes[y];if(!b)return-1;var x=O(v)?`delete`:`insert`;return b.type===x?l(b):-1}if(d(h,g,t)){var S=t-h[r]-h[i];return h[o]+h[s]+S}}throw Error(`Unexpected line position ${t}`)}}var ie=function(){this.__data__=[],this.size=0},ae=function(e,t){return e===t||e!=e&&t!=t},oe=function(e,t){for(var n=e.length;n--;)if(ae(e[n][0],t))return n;return-1},L=Array.prototype.splice,R=function(e){var t=this.__data__,n=oe(t,e);return!(n<0)&&(n==t.length-1?t.pop():L.call(t,n,1),--this.size,!0)},se=function(e){var t=this.__data__,n=oe(t,e);return n<0?void 0:t[n][1]},ce=function(e){return oe(this.__data__,e)>-1},le=function(e,t){var n=this.__data__,r=oe(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function z(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}z.prototype.clear=ie,z.prototype.delete=R,z.prototype.get=se,z.prototype.has=ce,z.prototype.set=le;var ue=z,de=function(){this.__data__=new ue,this.size=0},fe=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},pe=function(e){return this.__data__.get(e)},me=function(e){return this.__data__.has(e)},he=typeof b==`object`&&b&&b.Object===Object&&b,ge=typeof self==`object`&&self&&self.Object===Object&&self,B=he||ge||Function(`return this`)(),V=B.Symbol,_e=Object.prototype,ve=_e.hasOwnProperty,ye=_e.toString,H=V?V.toStringTag:void 0,be=function(e){var t=ve.call(e,H),n=e[H];try{e[H]=void 0;var r=!0}catch{}var i=ye.call(e);return r&&(t?e[H]=n:delete e[H]),i},xe=Object.prototype.toString,Se=function(e){return xe.call(e)},Ce=V?V.toStringTag:void 0,U=function(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Ce&&Ce in Object(e)?be(e):Se(e)},we=function(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)},Te=function(e){if(!we(e))return!1;var t=U(e);return t==`[object Function]`||t==`[object GeneratorFunction]`||t==`[object AsyncFunction]`||t==`[object Proxy]`},Ee=B[`__core-js_shared__`],De=function(){var e=/[^.]+$/.exec(Ee&&Ee.keys&&Ee.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),Oe=function(e){return!!De&&De in e},ke=Function.prototype.toString,W=function(e){if(e!=null){try{return ke.call(e)}catch{}try{return e+``}catch{}}return``},Ae=/^\[object .+?Constructor\]$/,je=Function.prototype,Me=Object.prototype,Ne=je.toString,Pe=Me.hasOwnProperty,Fe=RegExp(`^`+Ne.call(Pe).replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),Ie=function(e){return!(!we(e)||Oe(e))&&(Te(e)?Fe:Ae).test(W(e))},Le=function(e,t){return e?.[t]},G=function(e,t){var n=Le(e,t);return Ie(n)?n:void 0},Re=G(B,`Map`),ze=G(Object,`create`),Be=function(){this.__data__=ze?ze(null):{},this.size=0},Ve=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t},He=Object.prototype.hasOwnProperty,Ue=function(e){var t=this.__data__;if(ze){var n=t[e];return n===`__lodash_hash_undefined__`?void 0:n}return He.call(t,e)?t[e]:void 0},We=Object.prototype.hasOwnProperty,Ge=function(e){var t=this.__data__;return ze?t[e]!==void 0:We.call(t,e)},Ke=function(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=ze&&t===void 0?`__lodash_hash_undefined__`:t,this};function K(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}K.prototype.clear=Be,K.prototype.delete=Ve,K.prototype.get=Ue,K.prototype.has=Ge,K.prototype.set=Ke;var qe=K,Je=function(){this.size=0,this.__data__={hash:new qe,map:new(Re||ue),string:new qe}},Ye=function(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null},Xe=function(e,t){var n=e.__data__;return Ye(t)?n[typeof t==`string`?`string`:`hash`]:n.map},Ze=function(e){var t=Xe(this,e).delete(e);return this.size-=+!!t,t},Qe=function(e){return Xe(this,e).get(e)},$e=function(e){return Xe(this,e).has(e)},et=function(e,t){var n=Xe(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function q(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}q.prototype.clear=Je,q.prototype.delete=Ze,q.prototype.get=Qe,q.prototype.has=$e,q.prototype.set=et;var tt=q,nt=function(e,t){var n=this.__data__;if(n instanceof ue){var r=n.__data__;if(!Re||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new tt(r)}return n.set(e,t),this.size=n.size,this};function J(e){this.size=(this.__data__=new ue(e)).size}J.prototype.clear=de,J.prototype.delete=fe,J.prototype.get=pe,J.prototype.has=me,J.prototype.set=nt;var rt=J,it=function(e){return this.__data__.set(e,`__lodash_hash_undefined__`),this},at=function(e){return this.__data__.has(e)};function ot(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new tt;++t<n;)this.add(e[t])}ot.prototype.add=ot.prototype.push=it,ot.prototype.has=at;var st=ot,ct=function(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1},lt=function(e,t){return e.has(t)},ut=function(e,t,n,r,i,a){var o=1&n,s=e.length,c=t.length;if(s!=c&&!(o&&c>s))return!1;var l=a.get(e),u=a.get(t);if(l&&u)return l==t&&u==e;var d=-1,f=!0,p=2&n?new st:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var m=e[d],h=t[d];if(r)var g=o?r(h,m,d,t,e,a):r(m,h,d,e,t,a);if(g!==void 0){if(g)continue;f=!1;break}if(p){if(!ct(t,(function(e,t){if(!lt(p,t)&&(m===e||i(m,e,n,r,a)))return p.push(t)}))){f=!1;break}}else if(m!==h&&!i(m,h,n,r,a)){f=!1;break}}return a.delete(e),a.delete(t),f},dt=B.Uint8Array,ft=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n},pt=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n},mt=V?V.prototype:void 0,ht=mt?mt.valueOf:void 0,gt=function(e,t,n,r,i,a,o){switch(n){case`[object DataView]`:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case`[object ArrayBuffer]`:return!(e.byteLength!=t.byteLength||!a(new dt(e),new dt(t)));case`[object Boolean]`:case`[object Date]`:case`[object Number]`:return ae(+e,+t);case`[object Error]`:return e.name==t.name&&e.message==t.message;case`[object RegExp]`:case`[object String]`:return e==t+``;case`[object Map]`:var s=ft;case`[object Set]`:var c=1&r;if(s||=pt,e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=2,o.set(e,t);var u=ut(s(e),s(t),r,i,a,o);return o.delete(e),u;case`[object Symbol]`:if(ht)return ht.call(e)==ht.call(t)}return!1},_t=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e},Y=Array.isArray,vt=function(e,t,n){var r=t(e);return Y(e)?r:_t(r,n(e))},yt=function(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a},bt=function(){return[]},xt=Object.prototype.propertyIsEnumerable,St=Object.getOwnPropertySymbols,Ct=St?function(e){return e==null?[]:(e=Object(e),yt(St(e),(function(t){return xt.call(e,t)})))}:bt,wt=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r},X=function(e){return typeof e==`object`&&!!e},Tt=function(e){return X(e)&&U(e)==`[object Arguments]`},Et=Object.prototype,Dt=Et.hasOwnProperty,Ot=Et.propertyIsEnumerable,kt=Tt(function(){return arguments}())?Tt:function(e){return X(e)&&Dt.call(e,`callee`)&&!Ot.call(e,`callee`)},At=function(){return!1},jt=x((function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,i=r&&r.exports===n?B.Buffer:void 0;e.exports=(i?i.isBuffer:void 0)||At})),Mt=/^(?:0|[1-9]\d*)$/,Nt=function(e,t){var n=typeof e;return!!(t??=9007199254740991)&&(n==`number`||n!=`symbol`&&Mt.test(e))&&e>-1&&e%1==0&&e<t},Pt=function(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=9007199254740991},Z={};Z[`[object Float32Array]`]=Z[`[object Float64Array]`]=Z[`[object Int8Array]`]=Z[`[object Int16Array]`]=Z[`[object Int32Array]`]=Z[`[object Uint8Array]`]=Z[`[object Uint8ClampedArray]`]=Z[`[object Uint16Array]`]=Z[`[object Uint32Array]`]=!0,Z[`[object Arguments]`]=Z[`[object Array]`]=Z[`[object ArrayBuffer]`]=Z[`[object Boolean]`]=Z[`[object DataView]`]=Z[`[object Date]`]=Z[`[object Error]`]=Z[`[object Function]`]=Z[`[object Map]`]=Z[`[object Number]`]=Z[`[object Object]`]=Z[`[object RegExp]`]=Z[`[object Set]`]=Z[`[object String]`]=Z[`[object WeakMap]`]=!1;var Ft=function(e){return X(e)&&Pt(e.length)&&!!Z[U(e)]},It=function(e){return function(t){return e(t)}},Lt=x((function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,i=r&&r.exports===n&&he.process;e.exports=function(){try{return r&&r.require&&r.require(`util`).types||i&&i.binding&&i.binding(`util`)}catch{}}()})),Rt=Lt&&Lt.isTypedArray,zt=Rt?It(Rt):Ft,Bt=Object.prototype.hasOwnProperty,Vt=function(e,t){var n=Y(e),r=!n&&kt(e),i=!n&&!r&&jt(e),a=!n&&!r&&!i&&zt(e),o=n||r||i||a,s=o?wt(e.length,String):[],c=s.length;for(var l in e)!t&&!Bt.call(e,l)||o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||Nt(l,c))||s.push(l);return s},Ht=Object.prototype,Ut=function(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||Ht)},Wt=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),Gt=Object.prototype.hasOwnProperty,Kt=function(e){if(!Ut(e))return Wt(e);var t=[];for(var n in Object(e))Gt.call(e,n)&&n!=`constructor`&&t.push(n);return t},qt=function(e){return e!=null&&Pt(e.length)&&!Te(e)},Jt=function(e){return qt(e)?Vt(e):Kt(e)},Yt=function(e){return vt(e,Jt,Ct)},Xt=Object.prototype.hasOwnProperty,Zt=function(e,t,n,r,i,a){var o=1&n,s=Yt(e),c=s.length;if(c!=Yt(t).length&&!o)return!1;for(var l=c;l--;){var u=s[l];if(!(o?u in t:Xt.call(t,u)))return!1}var d=a.get(e),f=a.get(t);if(d&&f)return d==t&&f==e;var p=!0;a.set(e,t),a.set(t,e);for(var m=o;++l<c;){var h=e[u=s[l]],g=t[u];if(r)var _=o?r(g,h,u,t,e,a):r(h,g,u,e,t,a);if(!(_===void 0?h===g||i(h,g,n,r,a):_)){p=!1;break}m||=u==`constructor`}if(p&&!m){var v=e.constructor,y=t.constructor;v==y||!(`constructor`in e)||!(`constructor`in t)||typeof v==`function`&&v instanceof v&&typeof y==`function`&&y instanceof y||(p=!1)}return a.delete(e),a.delete(t),p},Qt=G(B,`DataView`),$t=G(B,`Promise`),en=G(B,`Set`),tn=G(B,`WeakMap`),nn=W(Qt),rn=W(Re),an=W($t),on=W(en),sn=W(tn),Q=U;(Qt&&Q(new Qt(new ArrayBuffer(1)))!=`[object DataView]`||Re&&Q(new Re)!=`[object Map]`||$t&&Q($t.resolve())!=`[object Promise]`||en&&Q(new en)!=`[object Set]`||tn&&Q(new tn)!=`[object WeakMap]`)&&(Q=function(e){var t=U(e),n=t==`[object Object]`?e.constructor:void 0,r=n?W(n):``;if(r)switch(r){case nn:return`[object DataView]`;case rn:return`[object Map]`;case an:return`[object Promise]`;case on:return`[object Set]`;case sn:return`[object WeakMap]`}return t});var cn=Q,ln=`[object Object]`,un=Object.prototype.hasOwnProperty,dn=function(e,t,n,r,i,a){var o=Y(e),s=Y(t),c=o?`[object Array]`:cn(e),l=s?`[object Array]`:cn(t),u=(c=c==`[object Arguments]`?ln:c)==ln,d=(l=l==`[object Arguments]`?ln:l)==ln,f=c==l;if(f&&jt(e)){if(!jt(t))return!1;o=!0,u=!1}if(f&&!u)return a||=new rt,o||zt(e)?ut(e,t,n,r,i,a):gt(e,t,c,n,r,i,a);if(!(1&n)){var p=u&&un.call(e,`__wrapped__`),m=d&&un.call(t,`__wrapped__`);if(p||m){var h=p?e.value():e,g=m?t.value():t;return a||=new rt,i(h,g,n,r,a)}}return!!f&&(a||=new rt,Zt(e,t,n,r,i,a))},fn=function e(t,n,r,i,a){return t===n||(t==null||n==null||!X(t)&&!X(n)?t!=t&&n!=n:dn(t,n,r,i,e,a))},pn=function(e,t,n,r){var i=n.length,a=i,o=!r;if(e==null)return!a;for(e=Object(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){var c=(s=n[i])[0],l=e[c],u=s[1];if(o&&s[2]){if(l===void 0&&!(c in e))return!1}else{var d=new rt;if(r)var f=r(l,u,c,e,t,d);if(!(f===void 0?fn(u,l,3,r,d):f))return!1}}return!0},mn=function(e){return e==e&&!we(e)},hn=function(e){for(var t=Jt(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,mn(i)]}return t},gn=function(e,t){return function(n){return n!=null&&n[e]===t&&(t!==void 0||e in Object(n))}},_n=function(e){var t=hn(e);return t.length==1&&t[0][2]?gn(t[0][0],t[0][1]):function(n){return n===e||pn(n,e,t)}},vn=function(e){return typeof e==`symbol`||X(e)&&U(e)==`[object Symbol]`},yn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,bn=/^\w*$/,xn=function(e,t){if(Y(e))return!1;var n=typeof e;return!(n!=`number`&&n!=`symbol`&&n!=`boolean`&&e!=null&&!vn(e))||bn.test(e)||!yn.test(e)||t!=null&&e in Object(t)};function Sn(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(`Expected a function`);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Sn.Cache||tt),n}Sn.Cache=tt;var Cn=Sn,wn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Tn=/\\(\\)?/g,En=function(e){var t=Cn(e,(function(e){return n.size===500&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(wn,(function(e,n,r,i){t.push(r?i.replace(Tn,`$1`):n||e)})),t})),Dn=function(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i},On=V?V.prototype:void 0,kn=On?On.toString:void 0,An=function e(t){if(typeof t==`string`)return t;if(Y(t))return Dn(t,e)+``;if(vn(t))return kn?kn.call(t):``;var n=t+``;return n==`0`&&1/t==-1/0?`-0`:n},jn=function(e){return e==null?``:An(e)},Mn=function(e,t){return Y(e)?e:xn(e,t)?[e]:En(jn(e))},Nn=function(e){if(typeof e==`string`||vn(e))return e;var t=e+``;return t==`0`&&1/e==-1/0?`-0`:t},Pn=function(e,t){for(var n=0,r=(t=Mn(t,e)).length;e!=null&&n<r;)e=e[Nn(t[n++])];return n&&n==r?e:void 0},Fn=function(e,t,n){var r=e==null?void 0:Pn(e,t);return r===void 0?n:r},In=function(e,t){return e!=null&&t in Object(e)},Ln=function(e,t,n){for(var r=-1,i=(t=Mn(t,e)).length,a=!1;++r<i;){var o=Nn(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:!!(i=e==null?0:e.length)&&Pt(i)&&Nt(o,i)&&(Y(e)||kt(e))},Rn=function(e,t){return e!=null&&Ln(e,t,In)},zn=function(e,t){return xn(e)&&mn(t)?gn(Nn(e),t):function(n){var r=Fn(n,e);return r===void 0&&r===t?Rn(n,e):fn(t,r,3)}},Bn=function(e){return e},Vn=function(e){return function(t){return t?.[e]}},Hn=function(e){return function(t){return Pn(t,e)}},Un=function(e){return xn(e)?Vn(Nn(e)):Hn(e)},Wn=function(e){return typeof e==`function`?e:e==null?Bn:typeof e==`object`?Y(e)?zn(e[0],e[1]):_n(e):Un(e)};function $(e){if(!e)throw Error(`change is not provided`);return A(e)?`N${e.oldLineNumber}`:`${O(e)?`I`:`D`}${e.lineNumber}`}re(`old`);var Gn=I(`old`),Kn=I(`new`);ne(`old`),ne(`new`),re(`new`),re(`old`);var qn=function(){try{var e=G(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),Jn=function(e,t,n){t==`__proto__`&&qn?qn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Yn=function(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(!1===n(a[c],c,a))break}return t}}(),Xn=function(e,t){return e&&Yn(e,t,Jt)},Zn=function(e,t){var n={};return t=Wn(t),Xn(e,(function(e,r,i){Jn(n,r,t(e,r,i))})),n},Qn=[`changeKey`,`text`,`tokens`,`renderToken`],$n=function e(t,n){var r=t.type,i=t.value,a=t.markType,s=t.properties,c=t.className,l=t.children,u=function(t){return(0,o.jsx)(`span`,{className:t,children:i||l&&l.map(e)},n)};switch(r){case`text`:return i;case`mark`:return u(`diff-code-mark diff-code-mark-${a}`);case`edit`:return u(`diff-code-edit`);default:var d=s&&s.className;return u(S(c||d))}};function er(e){if(!Array.isArray(e))return!0;if(e.length>1)return!1;if(e.length===1){var t=f(e,1)[0];return t.type===`text`&&!t.value}return!0}function tr(e){var t=e.changeKey,n=e.text,r=e.tokens,i=e.renderToken,a=d(e,Qn),s=i?function(e,t){return i(e,$n,t)}:$n;return(0,o.jsx)(`td`,l(l({},a),{},{"data-change-key":t,children:r?er(r)?` `:r.map(s):n||` `}))}var nr=(0,s.memo)(tr);function rr(e,t){return function(){var n=t===`old`?Gn(e):Kn(e);return n===-1?void 0:n}}function ir(e,t){return function(n){return e&&n?(0,o.jsx)(`a`,{href:t?`#`+t:void 0,children:n}):n}}function ar(e,t){return t?function(n){e(),t(n)}:e}function or(e,t,n,r){return(0,s.useMemo)((function(){var i=Zn(e,(function(e){return function(n){return e&&e(t,n)}}));return i.onMouseEnter=ar(n,i.onMouseEnter),i.onMouseLeave=ar(r,i.onMouseLeave),i}),[e,n,r,t])}function sr(e,t,n,r,i,a,s,c,u){var d={change:t,side:r,inHoverState:c,renderDefault:rr(t,r),wrapInAnchor:ir(i,a)};return(0,o.jsx)(`td`,l(l({className:e},s),{},{"data-change-key":n,children:u(d)}))}function cr(e){var t,n,r,i=e.change,a=e.selected,c=e.tokens,u=e.className,d=e.generateLineClassName,p=e.gutterClassName,m=e.codeClassName,h=e.gutterEvents,g=e.codeEvents,_=e.hideGutter,v=e.gutterAnchor,y=e.generateAnchorID,b=e.renderToken,x=e.renderGutter,C=i.type,w=i.content,T=$(i),E=f((t=f((0,s.useState)(!1),2),n=t[0],r=t[1],[n,(0,s.useCallback)((function(){return r(!0)}),[]),(0,s.useCallback)((function(){return r(!1)}),[])]),3),D=E[0],O=E[1],k=E[2],A=(0,s.useMemo)((function(){return{change:i}}),[i]),j=or(h,A,O,k),M=or(g,A,O,k),N=y(i),P=d({changes:[i],defaultGenerate:function(){return u}}),F=S(`diff-gutter`,`diff-gutter-${C}`,p,{"diff-gutter-selected":a}),I=S(`diff-code`,`diff-code-${C}`,m,{"diff-code-selected":a});return(0,o.jsxs)(`tr`,{id:N,className:S(`diff-line`,P),children:[!_&&sr(F,i,T,`old`,v,N,j,D,x),!_&&sr(F,i,T,`new`,v,N,j,D,x),(0,o.jsx)(nr,l({className:I,changeKey:T,text:w,tokens:c,renderToken:b},M))]})}var lr=(0,s.memo)(cr);function ur(e){var t=e.hideGutter,n=e.element;return(0,o.jsx)(`tr`,{className:`diff-widget`,children:(0,o.jsx)(`td`,{colSpan:t?1:3,className:`diff-widget-content`,children:n})})}var dr=[`hideGutter`,`selectedChanges`,`tokens`,`lineClassName`],fr=[`hunk`,`widgets`,`className`];function pr(e){var t=e.hunk,n=e.widgets,r=e.className,i=d(e,fr),a=function(e,t){return e.reduce((function(e,n){var r=$(n);e.push([`change`,r,n]);var i=t[r];return i&&e.push([`widget`,r,i]),e}),[])}(t.changes,n);return(0,o.jsx)(`tbody`,{className:S(`diff-hunk`,r),children:a.map((function(e){return function(e,t){var n=f(e,3),r=n[0],i=n[1],a=n[2],s=t.hideGutter,c=t.selectedChanges,u=t.tokens,p=t.lineClassName,m=d(t,dr);if(r===`change`){var h=k(a)?`old`:`new`,g=k(a)?Gn(a):Kn(a),_=u?u[h][g-1]:null;return(0,o.jsx)(lr,l({className:p,change:a,hideGutter:s,selected:c.includes(i),tokens:_},m),`change${i}`)}return r===`widget`?(0,o.jsx)(ur,{hideGutter:s,element:a},`widget${i}`):null}(e,i)}))})}var mr=0;function hr(e,t,n,r){var i=(0,s.useCallback)((function(){return t(e)}),[e,t]),a=(0,s.useCallback)((function(){return t(``)}),[t]);return(0,s.useMemo)((function(){var t=Zn(r,(function(t){return function(r){return t&&t({side:e,change:n},r)}}));return t.onMouseEnter=ar(i,t.onMouseEnter),t.onMouseLeave=ar(a,t.onMouseLeave),t}),[n,r,i,e,a])}function gr(e){var t=e.change,n=e.side,r=e.selected,i=e.tokens,a=e.gutterClassName,s=e.codeClassName,c=e.gutterEvents,d=e.codeEvents,f=e.anchorID,p=e.gutterAnchor,m=e.gutterAnchorTarget,h=e.hideGutter,g=e.hover,_=e.renderToken,v=e.renderGutter;if(!t){var y=S(`diff-gutter`,`diff-gutter-omit`,a),b=S(`diff-code`,`diff-code-omit`,s);return[!h&&(0,o.jsx)(`td`,{className:y},`gutter`),(0,o.jsx)(`td`,{className:b},`code`)]}var x=t.type,C=t.content,w=$(t),T=n===mr?`old`:`new`,E=l({id:f||void 0,className:S(`diff-gutter`,`diff-gutter-${x}`,u({"diff-gutter-selected":r},`diff-line-hover-`+T,g),a),children:v({change:t,side:T,inHoverState:g,renderDefault:rr(t,T),wrapInAnchor:ir(p,m)})},c),D=S(`diff-code`,`diff-code-${x}`,u({"diff-code-selected":r},`diff-line-hover-`+T,g),s);return[!h&&(0,o.jsx)(`td`,l(l({},E),{},{"data-change-key":w}),`gutter`),(0,o.jsx)(nr,l({className:D,changeKey:w,text:C,tokens:i,renderToken:_},d),`code`)]}function _r(e){var t=e.className,n=e.oldChange,r=e.newChange,i=e.oldSelected,a=e.newSelected,c=e.oldTokens,u=e.newTokens,d=e.monotonous,p=e.gutterClassName,m=e.codeClassName,h=e.gutterEvents,g=e.codeEvents,_=e.hideGutter,v=e.generateAnchorID,y=e.generateLineClassName,b=e.gutterAnchor,x=e.renderToken,C=e.renderGutter,w=f((0,s.useState)(``),2),T=w[0],E=w[1],D=hr(`old`,E,n,h),O=hr(`new`,E,r,h),k=hr(`old`,E,n,g),A=hr(`new`,E,r,g),j=n&&v(n),M=r&&v(r),N=y({changes:[n,r],defaultGenerate:function(){return t}}),P={monotonous:d,hideGutter:_,gutterClassName:p,codeClassName:m,gutterEvents:h,codeEvents:g,renderToken:x,renderGutter:C},F=l(l({},P),{},{change:n,side:mr,selected:i,tokens:c,gutterEvents:D,codeEvents:k,anchorID:j,gutterAnchor:b,gutterAnchorTarget:j,hover:T===`old`}),I=l(l({},P),{},{change:r,side:1,selected:a,tokens:u,gutterEvents:O,codeEvents:A,anchorID:n===r?null:M,gutterAnchor:b,gutterAnchorTarget:n===r?j:M,hover:T===`new`});return d?(0,o.jsx)(`tr`,{className:S(`diff-line`,N),children:gr(n?F:I)}):(0,o.jsxs)(`tr`,{className:S(`diff-line`,function(e,t){return e&&!t?`diff-line-old-only`:!e&&t?`diff-line-new-only`:e===t?`diff-line-normal`:`diff-line-compare`}(n,r),N),children:[gr(F),gr(I)]})}var vr=(0,s.memo)(_r);function yr(e){var t=e.hideGutter,n=e.oldElement,r=e.newElement;return e.monotonous?(0,o.jsx)(`tr`,{className:`diff-widget`,children:(0,o.jsx)(`td`,{colSpan:t?1:2,className:`diff-widget-content`,children:n||r})}):n===r?(0,o.jsx)(`tr`,{className:`diff-widget`,children:(0,o.jsx)(`td`,{colSpan:t?2:4,className:`diff-widget-content`,children:n})}):(0,o.jsxs)(`tr`,{className:`diff-widget`,children:[(0,o.jsx)(`td`,{colSpan:t?1:2,className:`diff-widget-content`,children:n}),(0,o.jsx)(`td`,{colSpan:t?1:2,className:`diff-widget-content`,children:r})]})}var br=[`selectedChanges`,`monotonous`,`hideGutter`,`tokens`,`lineClassName`],xr=[`hunk`,`widgets`,`className`];function Sr(e,t){return(e?$(e):`00`)+(t?$(t):`00`)}function Cr(e){var t=e.hunk,n=e.widgets,r=e.className,i=d(e,xr),a=function(e,t){for(var n=function(e){return e&&t[$(e)]||null},r=[],i=0;i<e.length;i++){var a=e[i];if(A(a))r.push([`change`,Sr(a,a),a,a]);else if(k(a)){var o=e[i+1];o&&O(o)?(i+=1,r.push([`change`,Sr(a,o),a,o])):r.push([`change`,Sr(a,null),a,null])}else r.push([`change`,Sr(null,a),null,a]);var s=r[r.length-1],c=n(s[2]),l=n(s[3]);if(c||l){var u=s[1];r.push([`widget`,u,c,l])}}return r}(t.changes,n);return(0,o.jsx)(`tbody`,{className:S(`diff-hunk`,r),children:a.map((function(e){return function(e,t){var n=f(e,4),r=n[0],i=n[1],a=n[2],s=n[3],c=t.selectedChanges,u=t.monotonous,p=t.hideGutter,m=t.tokens,h=t.lineClassName,g=d(t,br);return r===`change`?(0,o.jsx)(vr,l({className:h,oldChange:a,newChange:s,monotonous:u,hideGutter:p,oldSelected:!!a&&c.includes($(a)),newSelected:!!s&&c.includes($(s)),oldTokens:a&&m?m.old[Gn(a)-1]:null,newTokens:s&&m?m.new[Kn(s)-1]:null},g),`change${i}`):r===`widget`?(0,o.jsx)(yr,{monotonous:u,hideGutter:p,oldElement:a,newElement:s},`widget${i}`):null}(e,i)}))})}var wr=[`gutterType`,`hunkClassName`];function Tr(e){var t=e.hunk,n=E(),r=n.gutterType,i=n.hunkClassName,a=d(n,wr),s=r===`none`,c=r===`anchor`;return(0,o.jsx)(a.viewType===`unified`?pr:Cr,l(l({},a),{},{hunk:t,hideGutter:s,gutterAnchor:c,className:i}))}function Er(){}function Dr(e,t){var n=t?`auto`:`none`;e instanceof HTMLElement&&e.style.userSelect!==n&&(e.style.userSelect=n)}function Or(e){return e.map((function(e){return(0,o.jsx)(Tr,{hunk:e},function(e){return`-${e.oldStart},${e.oldLines} +${e.newStart},${e.newLines}`}(e))}))}function kr(e){var t=e.diffType,n=e.hunks,r=e.optimizeSelection,i=e.className,a=e.hunkClassName,c=a===void 0?C.hunkClassName:a,l=e.lineClassName,u=l===void 0?C.lineClassName:l,d=e.generateLineClassName,f=d===void 0?C.generateLineClassName:d,m=e.gutterClassName,h=m===void 0?C.gutterClassName:m,g=e.codeClassName,_=g===void 0?C.codeClassName:g,v=e.gutterType,b=v===void 0?C.gutterType:v,x=e.viewType,w=x===void 0?C.viewType:x,E=e.gutterEvents,D=E===void 0?C.gutterEvents:E,O=e.codeEvents,k=O===void 0?C.codeEvents:O,A=e.generateAnchorID,j=A===void 0?C.generateAnchorID:A,M=e.selectedChanges,N=M===void 0?C.selectedChanges:M,P=e.widgets,F=P===void 0?C.widgets:P,I=e.renderGutter,ee=I===void 0?C.renderGutter:I,te=e.tokens,ne=e.renderToken,re=e.children,ie=re===void 0?Or:re,ae=(0,s.useRef)(null),oe=(0,s.useCallback)((function(e){var t=e.target;if(e.button===0){var n=function(e,t){for(var n=e;n&&n!==document.documentElement&&!n.classList.contains(t);)n=n.parentElement;return n===document.documentElement?null:n}(t,`diff-code`);if(n&&n.parentElement){var r=window.getSelection();r&&r.removeAllRanges();var i=p(n.parentElement.children).indexOf(n);if(i===1||i===3){var a,o=y(ae.current?ae.current.querySelectorAll(`.diff-line`):[]);try{for(o.s();!(a=o.n()).done;){var s=a.value.children;Dr(s[1],i===1),Dr(s[3],i===3)}}catch(e){o.e(e)}finally{o.f()}}}}}),[]),L=b===`none`,R=t===`add`||t===`delete`,se=w===`split`&&!R&&r?oe:Er,ce=(0,s.useMemo)((function(){return(0,o.jsxs)(`colgroup`,w===`unified`?{children:[!L&&(0,o.jsx)(`col`,{className:`diff-gutter-col`}),!L&&(0,o.jsx)(`col`,{className:`diff-gutter-col`}),(0,o.jsx)(`col`,{})]}:R?{children:[!L&&(0,o.jsx)(`col`,{className:`diff-gutter-col`}),(0,o.jsx)(`col`,{})]}:{children:[!L&&(0,o.jsx)(`col`,{className:`diff-gutter-col`}),(0,o.jsx)(`col`,{}),!L&&(0,o.jsx)(`col`,{className:`diff-gutter-col`}),(0,o.jsx)(`col`,{})]})}),[w,R,L]);return(0,o.jsx)(T,{value:(0,s.useMemo)((function(){return{hunkClassName:c,lineClassName:u,generateLineClassName:f,gutterClassName:h,codeClassName:_,monotonous:R,hideGutter:L,viewType:w,gutterType:b,codeEvents:k,gutterEvents:D,generateAnchorID:j,selectedChanges:N,widgets:F,renderGutter:ee,tokens:te,renderToken:ne}}),[_,k,j,h,D,b,L,c,u,f,R,ee,ne,N,te,w,F]),children:(0,o.jsxs)(`table`,{ref:ae,className:S(`diff`,`diff-${w}`,i),onMouseDown:se,children:[ce,ie(n)]})})}var Ar=(0,s.memo)(kr);(function(e,t){return function(n,r){if(n==null)return n;if(!qt(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&!1!==r(o[a],a,o););return n}})(Xn),V&&V.isConcatSpreadable;var jr=x((function(e){var t=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32};t.Diff=function(e,t){return[e,t]},t.prototype.diff_main=function(e,n,r,i){i===void 0&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:new Date().getTime()+1e3*this.Diff_Timeout);var a=i;if(e==null||n==null)throw Error(`Null input. (diff_main)`);if(e==n)return e?[new t.Diff(0,e)]:[];r===void 0&&(r=!0);var o=r,s=this.diff_commonPrefix(e,n),c=e.substring(0,s);e=e.substring(s),n=n.substring(s),s=this.diff_commonSuffix(e,n);var l=e.substring(e.length-s);e=e.substring(0,e.length-s),n=n.substring(0,n.length-s);var u=this.diff_compute_(e,n,o,a);return c&&u.unshift(new t.Diff(0,c)),l&&u.push(new t.Diff(0,l)),this.diff_cleanupMerge(u),u},t.prototype.diff_compute_=function(e,n,r,i){var a;if(!e)return[new t.Diff(1,n)];if(!n)return[new t.Diff(-1,e)];var o=e.length>n.length?e:n,s=e.length>n.length?n:e,c=o.indexOf(s);if(c!=-1)return a=[new t.Diff(1,o.substring(0,c)),new t.Diff(0,s),new t.Diff(1,o.substring(c+s.length))],e.length>n.length&&(a[0][0]=a[2][0]=-1),a;if(s.length==1)return[new t.Diff(-1,e),new t.Diff(1,n)];var l=this.diff_halfMatch_(e,n);if(l){var u=l[0],d=l[1],f=l[2],p=l[3],m=l[4],h=this.diff_main(u,f,r,i),g=this.diff_main(d,p,r,i);return h.concat([new t.Diff(0,m)],g)}return r&&e.length>100&&n.length>100?this.diff_lineMode_(e,n,i):this.diff_bisect_(e,n,i)},t.prototype.diff_lineMode_=function(e,n,r){var i=this.diff_linesToChars_(e,n);e=i.chars1,n=i.chars2;var a=i.lineArray,o=this.diff_main(e,n,!1,r);this.diff_charsToLines_(o,a),this.diff_cleanupSemantic(o),o.push(new t.Diff(0,``));for(var s=0,c=0,l=0,u=``,d=``;s<o.length;){switch(o[s][0]){case 1:l++,d+=o[s][1];break;case-1:c++,u+=o[s][1];break;case 0:if(c>=1&&l>=1){o.splice(s-c-l,c+l),s=s-c-l;for(var f=this.diff_main(u,d,!1,r),p=f.length-1;p>=0;p--)o.splice(s,0,f[p]);s+=f.length}l=0,c=0,u=``,d=``}s++}return o.pop(),o},t.prototype.diff_bisect_=function(e,n,r){for(var i=e.length,a=n.length,o=Math.ceil((i+a)/2),s=o,c=2*o,l=Array(c),u=Array(c),d=0;d<c;d++)l[d]=-1,u[d]=-1;l[s+1]=0,u[s+1]=0;for(var f=i-a,p=f%2!=0,m=0,h=0,g=0,_=0,v=0;v<o&&!(new Date().getTime()>r);v++){for(var y=-v+m;y<=v-h;y+=2){for(var b=s+y,x=(E=y==-v||y!=v&&l[b-1]<l[b+1]?l[b+1]:l[b-1]+1)-y;E<i&&x<a&&e.charAt(E)==n.charAt(x);)E++,x++;if(l[b]=E,E>i)h+=2;else if(x>a)m+=2;else if(p&&(w=s+f-y)>=0&&w<c&&u[w]!=-1&&E>=(C=i-u[w]))return this.diff_bisectSplit_(e,n,E,x,r)}for(var S=-v+g;S<=v-_;S+=2){for(var C,w=s+S,T=(C=S==-v||S!=v&&u[w-1]<u[w+1]?u[w+1]:u[w-1]+1)-S;C<i&&T<a&&e.charAt(i-C-1)==n.charAt(a-T-1);)C++,T++;if(u[w]=C,C>i)_+=2;else if(T>a)g+=2;else if(!p&&(b=s+f-S)>=0&&b<c&&l[b]!=-1){var E;if(x=s+(E=l[b])-b,E>=(C=i-C))return this.diff_bisectSplit_(e,n,E,x,r)}}}return[new t.Diff(-1,e),new t.Diff(1,n)]},t.prototype.diff_bisectSplit_=function(e,t,n,r,i){var a=e.substring(0,n),o=t.substring(0,r),s=e.substring(n),c=t.substring(r),l=this.diff_main(a,o,!1,i),u=this.diff_main(s,c,!1,i);return l.concat(u)},t.prototype.diff_linesToChars_=function(e,t){var n=[],r={};function i(e){for(var t=``,i=0,o=-1,s=n.length;o<e.length-1;){(o=e.indexOf(`
9
+ `,i))==-1&&(o=e.length-1);var c=e.substring(i,o+1);(r.hasOwnProperty?r.hasOwnProperty(c):r[c]!==void 0)?t+=String.fromCharCode(r[c]):(s==a&&(c=e.substring(i),o=e.length),t+=String.fromCharCode(s),r[c]=s,n[s++]=c),i=o+1}return t}n[0]=``;var a=4e4,o=i(e);return a=65535,{chars1:o,chars2:i(t),lineArray:n}},t.prototype.diff_charsToLines_=function(e,t){for(var n=0;n<e.length;n++){for(var r=e[n][1],i=[],a=0;a<r.length;a++)i[a]=t[r.charCodeAt(a)];e[n][1]=i.join(``)}},t.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?a=n=i:r=i,i=Math.floor((r-n)/2+n);return i},t.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?a=n=i:r=i,i=Math.floor((r-n)/2+n);return i},t.prototype.diff_commonOverlap_=function(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var a=0,o=1;;){var s=e.substring(i-o),c=t.indexOf(s);if(c==-1)return a;o+=c,c!=0&&e.substring(i-o)!=t.substring(0,o)||(a=o,o++)}},t.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||2*r.length<n.length)return null;var i=this;function a(e,t,n){for(var r,a,o,s,c=e.substring(n,n+Math.floor(e.length/4)),l=-1,u=``;(l=t.indexOf(c,l+1))!=-1;){var d=i.diff_commonPrefix(e.substring(n),t.substring(l)),f=i.diff_commonSuffix(e.substring(0,n),t.substring(0,l));u.length<f+d&&(u=t.substring(l-f,l)+t.substring(l,l+d),r=e.substring(0,n-f),a=e.substring(n+d),o=t.substring(0,l-f),s=t.substring(l+d))}return 2*u.length>=e.length?[r,a,o,s,u]:null}var o,s,c,l,u,d=a(n,r,Math.ceil(n.length/4)),f=a(n,r,Math.ceil(n.length/2));return d||f?(o=f?d&&d[4].length>f[4].length?d:f:d,e.length>t.length?(s=o[0],c=o[1],l=o[2],u=o[3]):(l=o[0],u=o[1],s=o[2],c=o[3]),[s,c,l,u,o[4]]):null},t.prototype.diff_cleanupSemantic=function(e){for(var n=!1,r=[],i=0,a=null,o=0,s=0,c=0,l=0,u=0;o<e.length;)e[o][0]==0?(r[i++]=o,s=l,c=u,l=0,u=0,a=e[o][1]):(e[o][0]==1?l+=e[o][1].length:u+=e[o][1].length,a&&a.length<=Math.max(s,c)&&a.length<=Math.max(l,u)&&(e.splice(r[i-1],0,new t.Diff(-1,a)),e[r[i-1]+1][0]=1,i--,o=--i>0?r[i-1]:-1,s=0,c=0,l=0,u=0,a=null,n=!0)),o++;for(n&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),o=1;o<e.length;){if(e[o-1][0]==-1&&e[o][0]==1){var d=e[o-1][1],f=e[o][1],p=this.diff_commonOverlap_(d,f),m=this.diff_commonOverlap_(f,d);p>=m?(p>=d.length/2||p>=f.length/2)&&(e.splice(o,0,new t.Diff(0,f.substring(0,p))),e[o-1][1]=d.substring(0,d.length-p),e[o+1][1]=f.substring(p),o++):(m>=d.length/2||m>=f.length/2)&&(e.splice(o,0,new t.Diff(0,d.substring(0,m))),e[o-1][0]=1,e[o-1][1]=f.substring(0,f.length-m),e[o+1][0]=-1,e[o+1][1]=d.substring(m),o++),o++}o++}},t.prototype.diff_cleanupSemanticLossless=function(e){function n(e,n){if(!e||!n)return 6;var r=e.charAt(e.length-1),i=n.charAt(0),a=r.match(t.nonAlphaNumericRegex_),o=i.match(t.nonAlphaNumericRegex_),s=a&&r.match(t.whitespaceRegex_),c=o&&i.match(t.whitespaceRegex_),l=s&&r.match(t.linebreakRegex_),u=c&&i.match(t.linebreakRegex_),d=l&&e.match(t.blanklineEndRegex_),f=u&&n.match(t.blanklineStartRegex_);return d||f?5:l||u?4:a&&!s&&c?3:s||c?2:a||o?1:0}for(var r=1;r<e.length-1;){if(e[r-1][0]==0&&e[r+1][0]==0){var i=e[r-1][1],a=e[r][1],o=e[r+1][1],s=this.diff_commonSuffix(i,a);if(s){var c=a.substring(a.length-s);i=i.substring(0,i.length-s),a=c+a.substring(0,a.length-s),o=c+o}for(var l=i,u=a,d=o,f=n(i,a)+n(a,o);a.charAt(0)===o.charAt(0);){i+=a.charAt(0),a=a.substring(1)+o.charAt(0),o=o.substring(1);var p=n(i,a)+n(a,o);p>=f&&(f=p,l=i,u=a,d=o)}e[r-1][1]!=l&&(l?e[r-1][1]=l:(e.splice(r-1,1),r--),e[r][1]=u,d?e[r+1][1]=d:(e.splice(r+1,1),r--))}r++}},t.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,t.whitespaceRegex_=/\s/,t.linebreakRegex_=/[\r\n]/,t.blanklineEndRegex_=/\n\r?\n$/,t.blanklineStartRegex_=/^\r?\n\r?\n/,t.prototype.diff_cleanupEfficiency=function(e){for(var n=!1,r=[],i=0,a=null,o=0,s=!1,c=!1,l=!1,u=!1;o<e.length;)e[o][0]==0?(e[o][1].length<this.Diff_EditCost&&(l||u)?(r[i++]=o,s=l,c=u,a=e[o][1]):(i=0,a=null),l=u=!1):(e[o][0]==-1?u=!0:l=!0,a&&(s&&c&&l&&u||a.length<this.Diff_EditCost/2&&s+c+l+u==3)&&(e.splice(r[i-1],0,new t.Diff(-1,a)),e[r[i-1]+1][0]=1,i--,a=null,s&&c?(l=u=!0,i=0):(o=--i>0?r[i-1]:-1,l=u=!1),n=!0)),o++;n&&this.diff_cleanupMerge(e)},t.prototype.diff_cleanupMerge=function(e){e.push(new t.Diff(0,``));for(var n,r=0,i=0,a=0,o=``,s=``;r<e.length;)switch(e[r][0]){case 1:a++,s+=e[r][1],r++;break;case-1:i++,o+=e[r][1],r++;break;case 0:i+a>1?(i!==0&&a!==0&&((n=this.diff_commonPrefix(s,o))!==0&&(r-i-a>0&&e[r-i-a-1][0]==0?e[r-i-a-1][1]+=s.substring(0,n):(e.splice(0,0,new t.Diff(0,s.substring(0,n))),r++),s=s.substring(n),o=o.substring(n)),(n=this.diff_commonSuffix(s,o))!==0&&(e[r][1]=s.substring(s.length-n)+e[r][1],s=s.substring(0,s.length-n),o=o.substring(0,o.length-n))),r-=i+a,e.splice(r,i+a),o.length&&(e.splice(r,0,new t.Diff(-1,o)),r++),s.length&&(e.splice(r,0,new t.Diff(1,s)),r++),r++):r!==0&&e[r-1][0]==0?(e[r-1][1]+=e[r][1],e.splice(r,1)):r++,a=0,i=0,o=``,s=``}e[e.length-1][1]===``&&e.pop();var c=!1;for(r=1;r<e.length-1;)e[r-1][0]==0&&e[r+1][0]==0&&(e[r][1].substring(e[r][1].length-e[r-1][1].length)==e[r-1][1]?(e[r][1]=e[r-1][1]+e[r][1].substring(0,e[r][1].length-e[r-1][1].length),e[r+1][1]=e[r-1][1]+e[r+1][1],e.splice(r-1,1),c=!0):e[r][1].substring(0,e[r+1][1].length)==e[r+1][1]&&(e[r-1][1]+=e[r+1][1],e[r][1]=e[r][1].substring(e[r+1][1].length)+e[r+1][1],e.splice(r+1,1),c=!0)),r++;c&&this.diff_cleanupMerge(e)},t.prototype.diff_xIndex=function(e,t){var n,r=0,i=0,a=0,o=0;for(n=0;n<e.length&&(e[n][0]!==1&&(r+=e[n][1].length),e[n][0]!==-1&&(i+=e[n][1].length),!(r>t));n++)a=r,o=i;return e.length!=n&&e[n][0]===-1?o:o+(t-a)},t.prototype.diff_prettyHtml=function(e){for(var t=[],n=/&/g,r=/</g,i=/>/g,a=/\n/g,o=0;o<e.length;o++){var s=e[o][0],c=e[o][1].replace(n,`&amp;`).replace(r,`&lt;`).replace(i,`&gt;`).replace(a,`&para;<br>`);switch(s){case 1:t[o]=`<ins style="background:#e6ffe6;">`+c+`</ins>`;break;case-1:t[o]=`<del style="background:#ffe6e6;">`+c+`</del>`;break;case 0:t[o]=`<span>`+c+`</span>`}}return t.join(``)},t.prototype.diff_text1=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==1&&(t[n]=e[n][1]);return t.join(``)},t.prototype.diff_text2=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==-1&&(t[n]=e[n][1]);return t.join(``)},t.prototype.diff_levenshtein=function(e){for(var t=0,n=0,r=0,i=0;i<e.length;i++){var a=e[i][0],o=e[i][1];switch(a){case 1:n+=o.length;break;case-1:r+=o.length;break;case 0:t+=Math.max(n,r),n=0,r=0}}return t+=Math.max(n,r)},t.prototype.diff_toDelta=function(e){for(var t=[],n=0;n<e.length;n++)switch(e[n][0]){case 1:t[n]=`+`+encodeURI(e[n][1]);break;case-1:t[n]=`-`+e[n][1].length;break;case 0:t[n]=`=`+e[n][1].length}return t.join(` `).replace(/%20/g,` `)},t.prototype.diff_fromDelta=function(e,n){for(var r=[],i=0,a=0,o=n.split(/\t/g),s=0;s<o.length;s++){var c=o[s].substring(1);switch(o[s].charAt(0)){case`+`:try{r[i++]=new t.Diff(1,decodeURI(c))}catch{throw Error(`Illegal escape in diff_fromDelta: `+c)}break;case`-`:case`=`:var l=parseInt(c,10);if(isNaN(l)||l<0)throw Error(`Invalid number in diff_fromDelta: `+c);var u=e.substring(a,a+=l);o[s].charAt(0)==`=`?r[i++]=new t.Diff(0,u):r[i++]=new t.Diff(-1,u);break;default:if(o[s])throw Error(`Invalid diff operation in diff_fromDelta: `+o[s])}}if(a!=e.length)throw Error(`Delta length (`+a+`) does not equal source text length (`+e.length+`).`);return r},t.prototype.match_main=function(e,t,n){if(e==null||t==null||n==null)throw Error(`Null input. (match_main)`);return n=Math.max(0,Math.min(n,e.length)),e==t?0:e.length?e.substring(n,n+t.length)==t?n:this.match_bitap_(e,t,n):-1},t.prototype.match_bitap_=function(e,t,n){if(t.length>this.Match_MaxBits)throw Error(`Pattern too long for this browser.`);var r=this.match_alphabet_(t),i=this;function a(e,r){var a=e/t.length,o=Math.abs(n-r);return i.Match_Distance?a+o/i.Match_Distance:o?1:a}var o=this.Match_Threshold,s=e.indexOf(t,n);s!=-1&&(o=Math.min(a(0,s),o),(s=e.lastIndexOf(t,n+t.length))!=-1&&(o=Math.min(a(0,s),o)));var c,l,u=1<<t.length-1;s=-1;for(var d,f=t.length+e.length,p=0;p<t.length;p++){for(c=0,l=f;c<l;)a(p,n+l)<=o?c=l:f=l,l=Math.floor((f-c)/2+c);f=l;var m=Math.max(1,n-l+1),h=Math.min(n+l,e.length)+t.length,g=Array(h+2);g[h+1]=(1<<p)-1;for(var _=h;_>=m;_--){var v=r[e.charAt(_-1)];if(g[_]=p===0?(g[_+1]<<1|1)&v:(g[_+1]<<1|1)&v|(d[_+1]|d[_])<<1|1|d[_+1],g[_]&u){var y=a(p,_-1);if(y<=o){if(o=y,!((s=_-1)>n))break;m=Math.max(1,2*n-s)}}}if(a(p+1,n)>o)break;d=g}return s},t.prototype.match_alphabet_=function(e){for(var t={},n=0;n<e.length;n++)t[e.charAt(n)]=0;for(n=0;n<e.length;n++)t[e.charAt(n)]|=1<<e.length-n-1;return t},t.prototype.patch_addContext_=function(e,n){if(n.length!=0){if(e.start2===null)throw Error(`patch not initialized`);for(var r=n.substring(e.start2,e.start2+e.length1),i=0;n.indexOf(r)!=n.lastIndexOf(r)&&r.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)i+=this.Patch_Margin,r=n.substring(e.start2-i,e.start2+e.length1+i);i+=this.Patch_Margin;var a=n.substring(e.start2-i,e.start2);a&&e.diffs.unshift(new t.Diff(0,a));var o=n.substring(e.start2+e.length1,e.start2+e.length1+i);o&&e.diffs.push(new t.Diff(0,o)),e.start1-=a.length,e.start2-=a.length,e.length1+=a.length+o.length,e.length2+=a.length+o.length}},t.prototype.patch_make=function(e,n,r){var i,a;if(typeof e==`string`&&typeof n==`string`&&r===void 0)i=e,(a=this.diff_main(i,n,!0)).length>2&&(this.diff_cleanupSemantic(a),this.diff_cleanupEfficiency(a));else if(e&&typeof e==`object`&&n===void 0&&r===void 0)a=e,i=this.diff_text1(a);else if(typeof e==`string`&&n&&typeof n==`object`&&r===void 0)i=e,a=n;else{if(typeof e!=`string`||typeof n!=`string`||!r||typeof r!=`object`)throw Error(`Unknown call format to patch_make.`);i=e,a=r}if(a.length===0)return[];for(var o=[],s=new t.patch_obj,c=0,l=0,u=0,d=i,f=i,p=0;p<a.length;p++){var m=a[p][0],h=a[p][1];switch(c||m===0||(s.start1=l,s.start2=u),m){case 1:s.diffs[c++]=a[p],s.length2+=h.length,f=f.substring(0,u)+h+f.substring(u);break;case-1:s.length1+=h.length,s.diffs[c++]=a[p],f=f.substring(0,u)+f.substring(u+h.length);break;case 0:h.length<=2*this.Patch_Margin&&c&&a.length!=p+1?(s.diffs[c++]=a[p],s.length1+=h.length,s.length2+=h.length):h.length>=2*this.Patch_Margin&&c&&(this.patch_addContext_(s,d),o.push(s),s=new t.patch_obj,c=0,d=f,l=u)}m!==1&&(l+=h.length),m!==-1&&(u+=h.length)}return c&&(this.patch_addContext_(s,d),o.push(s)),o},t.prototype.patch_deepCopy=function(e){for(var n=[],r=0;r<e.length;r++){var i=e[r],a=new t.patch_obj;a.diffs=[];for(var o=0;o<i.diffs.length;o++)a.diffs[o]=new t.Diff(i.diffs[o][0],i.diffs[o][1]);a.start1=i.start1,a.start2=i.start2,a.length1=i.length1,a.length2=i.length2,n[r]=a}return n},t.prototype.patch_apply=function(e,t){if(e.length==0)return[t,[]];e=this.patch_deepCopy(e);var n=this.patch_addPadding(e);t=n+t+n,this.patch_splitMax(e);for(var r=0,i=[],a=0;a<e.length;a++){var o,s,c=e[a].start2+r,l=this.diff_text1(e[a].diffs),u=-1;if(l.length>this.Match_MaxBits?(o=this.match_main(t,l.substring(0,this.Match_MaxBits),c))!=-1&&((u=this.match_main(t,l.substring(l.length-this.Match_MaxBits),c+l.length-this.Match_MaxBits))==-1||o>=u)&&(o=-1):o=this.match_main(t,l,c),o==-1)i[a]=!1,r-=e[a].length2-e[a].length1;else if(i[a]=!0,r=o-c,l==(s=u==-1?t.substring(o,o+l.length):t.substring(o,u+this.Match_MaxBits)))t=t.substring(0,o)+this.diff_text2(e[a].diffs)+t.substring(o+l.length);else{var d=this.diff_main(l,s,!1);if(l.length>this.Match_MaxBits&&this.diff_levenshtein(d)/l.length>this.Patch_DeleteThreshold)i[a]=!1;else{this.diff_cleanupSemanticLossless(d);for(var f,p=0,m=0;m<e[a].diffs.length;m++){var h=e[a].diffs[m];h[0]!==0&&(f=this.diff_xIndex(d,p)),h[0]===1?t=t.substring(0,o+f)+h[1]+t.substring(o+f):h[0]===-1&&(t=t.substring(0,o+f)+t.substring(o+this.diff_xIndex(d,p+h[1].length))),h[0]!==-1&&(p+=h[1].length)}}}}return[t=t.substring(n.length,t.length-n.length),i]},t.prototype.patch_addPadding=function(e){for(var n=this.Patch_Margin,r=``,i=1;i<=n;i++)r+=String.fromCharCode(i);for(i=0;i<e.length;i++)e[i].start1+=n,e[i].start2+=n;var a=e[0],o=a.diffs;if(o.length==0||o[0][0]!=0)o.unshift(new t.Diff(0,r)),a.start1-=n,a.start2-=n,a.length1+=n,a.length2+=n;else if(n>o[0][1].length){var s=n-o[0][1].length;o[0][1]=r.substring(o[0][1].length)+o[0][1],a.start1-=s,a.start2-=s,a.length1+=s,a.length2+=s}return(o=(a=e[e.length-1]).diffs).length==0||o[o.length-1][0]!=0?(o.push(new t.Diff(0,r)),a.length1+=n,a.length2+=n):n>o[o.length-1][1].length&&(s=n-o[o.length-1][1].length,o[o.length-1][1]+=r.substring(0,s),a.length1+=s,a.length2+=s),r},t.prototype.patch_splitMax=function(e){for(var n=this.Match_MaxBits,r=0;r<e.length;r++)if(!(e[r].length1<=n)){var i=e[r];e.splice(r--,1);for(var a=i.start1,o=i.start2,s=``;i.diffs.length!==0;){var c=new t.patch_obj,l=!0;for(c.start1=a-s.length,c.start2=o-s.length,s!==``&&(c.length1=c.length2=s.length,c.diffs.push(new t.Diff(0,s)));i.diffs.length!==0&&c.length1<n-this.Patch_Margin;){var u=i.diffs[0][0],d=i.diffs[0][1];u===1?(c.length2+=d.length,o+=d.length,c.diffs.push(i.diffs.shift()),l=!1):u===-1&&c.diffs.length==1&&c.diffs[0][0]==0&&d.length>2*n?(c.length1+=d.length,a+=d.length,l=!1,c.diffs.push(new t.Diff(u,d)),i.diffs.shift()):(d=d.substring(0,n-c.length1-this.Patch_Margin),c.length1+=d.length,a+=d.length,u===0?(c.length2+=d.length,o+=d.length):l=!1,c.diffs.push(new t.Diff(u,d)),d==i.diffs[0][1]?i.diffs.shift():i.diffs[0][1]=i.diffs[0][1].substring(d.length))}s=(s=this.diff_text2(c.diffs)).substring(s.length-this.Patch_Margin);var f=this.diff_text1(i.diffs).substring(0,this.Patch_Margin);f!==``&&(c.length1+=f.length,c.length2+=f.length,c.diffs.length!==0&&c.diffs[c.diffs.length-1][0]===0?c.diffs[c.diffs.length-1][1]+=f:c.diffs.push(new t.Diff(0,f))),l||e.splice(++r,0,c)}}},t.prototype.patch_toText=function(e){for(var t=[],n=0;n<e.length;n++)t[n]=e[n];return t.join(``)},t.prototype.patch_fromText=function(e){var n=[];if(!e)return n;for(var r=e.split(`
10
+ `),i=0,a=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;i<r.length;){var o=r[i].match(a);if(!o)throw Error(`Invalid patch string: `+r[i]);var s=new t.patch_obj;for(n.push(s),s.start1=parseInt(o[1],10),o[2]===``?(s.start1--,s.length1=1):o[2]==`0`?s.length1=0:(s.start1--,s.length1=parseInt(o[2],10)),s.start2=parseInt(o[3],10),o[4]===``?(s.start2--,s.length2=1):o[4]==`0`?s.length2=0:(s.start2--,s.length2=parseInt(o[4],10)),i++;i<r.length;){var c=r[i].charAt(0);try{var l=decodeURI(r[i].substring(1))}catch{throw Error(`Illegal escape in patch_fromText: `+l)}if(c==`-`)s.diffs.push(new t.Diff(-1,l));else if(c==`+`)s.diffs.push(new t.Diff(1,l));else if(c==` `)s.diffs.push(new t.Diff(0,l));else{if(c==`@`)break;if(c!==``)throw Error(`Invalid patch mode "`+c+`" in: `+l)}i++}}return n},(t.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0}).prototype.toString=function(){for(var e,t=[`@@ -`+(this.length1===0?this.start1+`,0`:this.length1==1?this.start1+1:this.start1+1+`,`+this.length1)+` +`+(this.length2===0?this.start2+`,0`:this.length2==1?this.start2+1:this.start2+1+`,`+this.length2)+` @@
11
+ `],n=0;n<this.diffs.length;n++){switch(this.diffs[n][0]){case 1:e=`+`;break;case-1:e=`-`;break;case 0:e=` `}t[n+1]=e+encodeURI(this.diffs[n][1])+`
12
+ `}return t.join(``).replace(/%20/g,` `)},e.exports=t,e.exports.diff_match_patch=t,e.exports.DIFF_DELETE=-1,e.exports.DIFF_INSERT=1,e.exports.DIFF_EQUAL=0}));jr.DIFF_EQUAL,jr.DIFF_DELETE,jr.DIFF_INSERT;function Mr(e){let t=e.indexOf(`
13
+ --- `);return t>=0?e.slice(t+1):e}function Nr(e){let t=(0,a.c)(15),{diff:n,viewType:r}=e,s=r===void 0?`unified`:r;if(!n.trim()){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,o.jsx)(`div`,{className:`activity-panel-diff px-3 py-2 text-xs text-muted-foreground italic`,children:(0,o.jsx)(i,{id:`kknhfj`})}),t[0]=e):e=t[0],e}let c,l,u,d;if(t[1]!==n||t[2]!==s){d=Symbol.for(`react.early_return_sentinel`);bb0:{try{c=M(Mr(n))}catch{let e;t[7]===n?e=t[8]:(e=(0,o.jsx)(`pre`,{className:`activity-panel-diff font-mono text-xs whitespace-pre-wrap px-3 py-2`,children:n}),t[7]=n,t[8]=e),d=e;break bb0}if(c.every(Ir)){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,o.jsx)(`div`,{className:`activity-panel-diff px-3 py-2 text-xs text-muted-foreground italic`,children:(0,o.jsx)(i,{id:`kknhfj`})}),t[9]=e):e=t[9],d=e;break bb0}l=`activity-panel-diff`;let e;t[10]===s?e=t[11]:(e=e=>(0,o.jsx)(Ar,{viewType:s,diffType:e.type,hunks:e.hunks,children:Pr},`${e.oldPath??`a`}→${e.newPath??`b`}`),t[10]=s,t[11]=e),u=c.map(e)}t[1]=n,t[2]=s,t[3]=l,t[4]=u,t[5]=d,t[6]=c}else l=t[3],u=t[4],d=t[5],c=t[6];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;return t[12]!==l||t[13]!==u?(f=(0,o.jsx)(`div`,{className:l,children:u}),t[12]=l,t[13]=u,t[14]=f):f=t[14],f}function Pr(e){return e.map(Fr)}function Fr(e){return(0,o.jsx)(Tr,{hunk:e},e.content)}function Ir(e){return e.hunks.length===0}export{Nr as ActivityPanelDiffView};