@kabmo-labs/kabmo 0.57.1 → 0.58.0

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 (520) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +523 -506
  3. package/dist/client/static/js/Body-karkrzkc.js +3 -0
  4. package/dist/client/static/js/{CsvGrid-563qmmmr.js → CsvGrid-j03knmbe.js} +2 -2
  5. package/dist/client/static/js/{DocxView-5j69q3s0.js → DocxView-e8408vzs.js} +2 -2
  6. package/dist/client/static/js/{DrawioView-gd6k3hvn.js → DrawioView-fj4mfzch.js} +2 -2
  7. package/dist/client/static/js/{HtmlPreview-6gnktzzp.js → HtmlPreview-9g8xwzgw.js} +1 -1
  8. package/dist/client/static/js/ImageView-sz4fzz9k.js +1 -0
  9. package/dist/client/static/js/LayoutWrapper-q6q4h04a.js +2 -0
  10. package/dist/client/static/js/MergeDiffView-b8f013ws.js +1 -0
  11. package/dist/client/static/js/Modal-ahecatp5.js +60 -0
  12. package/dist/client/static/js/{PdfView-n1zq27td.js → PdfView-8jtdx5hd.js} +1 -1
  13. package/dist/client/static/js/SessionsView-jwp8xvw5.js +1 -0
  14. package/dist/client/static/js/{SheetView-nes7j86v.js → SheetView-hwx8s864.js} +11 -11
  15. package/dist/client/static/js/{SvgPreview-vv0qzkt7.js → SvgPreview-ete36nzv.js} +1 -1
  16. package/dist/client/static/js/{abnfDiagram-O67JEVCF-02g96sn6.js → abnfDiagram-O67JEVCF-7nsqzz6z.js} +1 -1
  17. package/dist/client/static/js/architecture-7GRP2DOG-dc7zys46.js +1 -0
  18. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-7qj2fpwt.js → architectureDiagram-NJMV4G6O-xvpkfq2f.js} +11 -11
  19. package/dist/client/static/js/{astro-asmathwv.js → astro-rsrqgjjx.js} +1 -1
  20. package/dist/client/static/js/bash-n5d0esqg.js +1 -0
  21. package/dist/client/static/js/{blockDiagram-BEXU5L5S-grdr1j2h.js → blockDiagram-BEXU5L5S-0saahcs6.js} +7 -7
  22. package/dist/client/static/js/c-pk766wx0.js +1 -0
  23. package/dist/client/static/js/{c4Diagram-YGBWAQC7-7y980xpx.js → c4Diagram-YGBWAQC7-ktpqnb4a.js} +2 -2
  24. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-29ag4js1.js → classDiagram-v2-NBCMYWYE-x67cz3ms.js} +5 -5
  25. package/dist/client/static/js/{cose-bilkent-JH36ORCC-e5dvgehd.js → cose-bilkent-JH36ORCC-9wzmhkz8.js} +1 -1
  26. package/dist/client/static/js/cpp-3pt91jvm.js +1 -0
  27. package/dist/client/static/js/css-sp1cgdbr.js +1 -0
  28. package/dist/client/static/js/cynefin-OW5HDTMX-9fx59e89.js +1 -0
  29. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-eq6fmx0b.js → cynefinDiagram-VND7K2PF-dmmgmv99.js} +2 -2
  30. package/dist/client/static/js/{dagre-6A5THRUB-xfhwp8ha.js → dagre-6A5THRUB-ygkkms1t.js} +2 -2
  31. package/dist/client/static/js/{diagram-22UHCM2B-1bw6x6zt.js → diagram-22UHCM2B-qxj0pqb4.js} +14 -14
  32. package/dist/client/static/js/{diagram-3UASUU5V-076ej5n5.js → diagram-3UASUU5V-77k8w5dt.js} +1 -1
  33. package/dist/client/static/js/{diagram-ATOU4E4O-cvf9fhdq.js → diagram-ATOU4E4O-m0h86vf4.js} +3 -3
  34. package/dist/client/static/js/{diagram-CDSNMT55-hn1wdx54.js → diagram-CDSNMT55-5v28kaeg.js} +5 -5
  35. package/dist/client/static/js/{diagram-MLGK6HIB-76gk27b5.js → diagram-MLGK6HIB-zgcg9gaz.js} +2 -2
  36. package/dist/client/static/js/{diagram-MPIPVDR6-0cbajhpx.js → diagram-MPIPVDR6-10c9s6e6.js} +2 -2
  37. package/dist/client/static/js/{dockerfile-7atfjhnf.js → dockerfile-dr9sdsqp.js} +1 -1
  38. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-n0g3b9m2.js → ebnfDiagram-ZINNZB2B-mz4022dz.js} +1 -1
  39. package/dist/client/static/js/{elixir-7q2k61zb.js → elixir-3dy25ex8.js} +1 -1
  40. package/dist/client/static/js/{elk-276RUBZZ-f6wrjcv9.js → elk-276RUBZZ-ccerbsag.js} +1 -1
  41. package/dist/client/static/js/{erDiagram-OPXOYQCR-jz622yrg.js → erDiagram-OPXOYQCR-a8vjyrrw.js} +5 -5
  42. package/dist/client/static/js/{erlang-tjsd7n4d.js → erlang-v7344938.js} +1 -1
  43. package/dist/client/static/js/eventmodeling-NTZA5JFV-61d2ee91.js +1 -0
  44. package/dist/client/static/js/flowDiagram-KWPJA3E3-104ywb7w.js +1 -0
  45. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-2ex4nxyg.js → ganttDiagram-FUAMR5RP-sz1g29fp.js} +4 -4
  46. package/dist/client/static/js/gitGraph-4MIJSDKK-zkb30q0t.js +1 -0
  47. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-38eyay6g.js → gitGraphDiagram-X574FWY7-efqk42q0.js} +15 -15
  48. package/dist/client/static/js/graphql-2ntm7jyh.js +1 -0
  49. package/dist/client/static/js/html-mt2yb43b.js +1 -0
  50. package/dist/client/static/js/{index-db7vsjkd.js → index-2a0b9ya2.js} +1 -1
  51. package/dist/client/static/js/index-2f6psebk.js +2 -0
  52. package/dist/client/static/js/{index-j9y4tjk0.js → index-3m1dksmy.js} +2 -2
  53. package/dist/client/static/js/{index-668fc1df.js → index-3p732mvs.js} +2 -2
  54. package/dist/client/static/js/{index-3x88t8g9.js → index-3ymw778n.js} +2 -2
  55. package/dist/client/static/js/{index-rbkvw2xs.js → index-5tp3emtg.js} +2 -2
  56. package/dist/client/static/js/{index-8444mec5.js → index-6ac860yz.js} +2 -2
  57. package/dist/client/static/js/{index-zzggk17b.js → index-6ey6y9em.js} +2 -2
  58. package/dist/client/static/js/index-6h46r2de.js +1 -0
  59. package/dist/client/static/js/index-6qqsy78z.js +1 -0
  60. package/dist/client/static/js/{index-25zpywv7.js → index-6x0kn8pb.js} +2 -2
  61. package/dist/client/static/js/{index-zv8wrvha.js → index-7ma44af3.js} +3 -3
  62. package/dist/client/static/js/index-7s4dge1z.js +1 -0
  63. package/dist/client/static/js/{index-my856e49.js → index-7ynf3s2w.js} +2 -2
  64. package/dist/client/static/js/index-8aqjj2x2.js +1 -0
  65. package/dist/client/static/js/index-bkwax812.js +1 -0
  66. package/dist/client/static/js/{index-60g0e74a.js → index-dqf0srrp.js} +2 -2
  67. package/dist/client/static/js/{index-jaxhfk9x.js → index-dz18nn65.js} +2 -2
  68. package/dist/client/static/js/{index-9gfn1a3h.js → index-e42ys2q3.js} +7 -7
  69. package/dist/client/static/js/{index-wxs0x3g1.js → index-ewryzs4g.js} +2 -2
  70. package/dist/client/static/js/{index-55v3qv04.js → index-f31c6jg8.js} +22 -22
  71. package/dist/client/static/js/index-f44k9k8d.css +1 -0
  72. package/dist/client/static/js/{index-nnqyew8n.js → index-fhtnvqgf.js} +2 -2
  73. package/dist/client/static/js/{index-396g4zz4.js → index-gaa39w5q.js} +2 -2
  74. package/dist/client/static/js/{index-63mk2qk6.js → index-gqsnyh8k.js} +2 -2
  75. package/dist/client/static/js/index-gw4c5n3a.js +2 -0
  76. package/dist/client/static/js/index-j863hg0d.js +9 -0
  77. package/dist/client/static/js/{index-e4yj4kbe.js → index-jnxmvxb8.js} +12 -12
  78. package/dist/client/static/js/{index-0prwdwyb.js → index-jxsha63v.js} +2 -2
  79. package/dist/client/static/js/index-k1576e2m.js +2 -0
  80. package/dist/client/static/js/index-k4qshngy.js +4 -0
  81. package/dist/client/static/js/{index-ep99arz1.js → index-k56patms.js} +2 -2
  82. package/dist/client/static/js/{index-8pqx5n2p.js → index-kc5yt2cd.js} +2 -2
  83. package/dist/client/static/js/index-mkp3gwag.js +1 -0
  84. package/dist/client/static/js/{index-g2e0m757.js → index-nzq51nbb.js} +7 -7
  85. package/dist/client/static/js/{index-1q934wfk.js → index-q5q8a3qn.js} +2 -2
  86. package/dist/client/static/js/{index-tksrpqkh.js → index-qbqm3c91.js} +5 -5
  87. package/dist/client/static/js/{index-zynbvm7x.js → index-qkcmspxq.js} +2 -2
  88. package/dist/client/static/js/index-r1wrke3j.js +1 -0
  89. package/dist/client/static/js/index-rr79n77k.js +470 -0
  90. package/dist/client/static/js/{index-y1j18rha.js → index-rxt8sf9a.js} +2 -2
  91. package/dist/client/static/js/{index-tdryzzy9.js → index-ssepzdaz.js} +6 -6
  92. package/dist/client/static/js/{index-rsyqf691.js → index-sxag9ptg.js} +2 -2
  93. package/dist/client/static/js/{index-ewst55j2.js → index-t71k3b28.js} +2 -2
  94. package/dist/client/static/js/index-tc07gd33.js +2 -0
  95. package/dist/client/static/js/{index-m6eh5g1q.js → index-tdg7hz80.js} +2 -2
  96. package/dist/client/static/js/{index-nt17ejrm.js → index-th61y26d.js} +2 -2
  97. package/dist/client/static/js/{index-n1xmkf2g.js → index-tnxp90ac.js} +1 -1
  98. package/dist/client/static/js/{index-ms80nne4.js → index-tq3t3qm4.js} +2 -2
  99. package/dist/client/static/js/index-ts8rhd06.js +1 -0
  100. package/dist/client/static/js/{index-xtrsvm0d.js → index-v8xhgfeq.js} +2 -2
  101. package/dist/client/static/js/{index-ays8t3t3.js → index-vb5a3g01.js} +4 -4
  102. package/dist/client/static/js/{index-pjf5wak8.js → index-ver116ed.js} +1 -1
  103. package/dist/client/static/js/{index-hge0y4vn.js → index-vf01q99d.js} +2 -2
  104. package/dist/client/static/js/{index-4cff0zg2.js → index-w5j1wgcz.js} +1 -1
  105. package/dist/client/static/js/{index-cwwg7k5f.js → index-wnk9k57k.js} +27 -27
  106. package/dist/client/static/js/{index-6z30g3ha.js → index-x7h04xzf.js} +2 -2
  107. package/dist/client/static/js/{index-xfnjwhan.js → index-xfyxmaj1.js} +85 -85
  108. package/dist/client/static/js/index-xygk0v3e.js +2 -0
  109. package/dist/client/static/js/{index-kt7c42n7.js → index-y0f3wbc3.js} +2 -2
  110. package/dist/client/static/js/index-zh550byg.js +2 -0
  111. package/dist/client/static/js/info-A6RAGUB7-xxvyt8p8.js +1 -0
  112. package/dist/client/static/js/{infoDiagram-VRGFBTTK-c55t0tvd.js → infoDiagram-VRGFBTTK-rykcacj5.js} +1 -1
  113. package/dist/client/static/js/ini-bdk46a3d.js +1 -0
  114. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-r9kg5kg5.js → ishikawaDiagram-OU5B5YK6-rj752kd8.js} +3 -3
  115. package/dist/client/static/js/java-3g3925cf.js +1 -0
  116. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-zmmst4v8.js → journeyDiagram-ZHPQQLJL-mtetwn6f.js} +5 -5
  117. package/dist/client/static/js/json-hdyzmffz.js +1 -0
  118. package/dist/client/static/js/jsx-y8r9mrdq.js +1 -0
  119. package/dist/client/static/js/{julia-d18zhpyp.js → julia-mxe3pnz3.js} +1 -1
  120. package/dist/client/static/js/{kanban-definition-PNTS6WVX-3tt6sc9a.js → kanban-definition-PNTS6WVX-4h5pw5mm.js} +3 -3
  121. package/dist/client/static/js/lua-wf5k6p3r.js +1 -0
  122. package/dist/client/static/js/markdown-9bf16dx7.js +1 -0
  123. package/dist/client/static/js/{mermaid.core-pkrs8zp5.js → mermaid.core-bs542jma.js} +8 -8
  124. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-b4c6gxg4.js → mindmap-definition-NLK3R4M7-67s4xy7h.js} +5 -5
  125. package/dist/client/static/js/one-dark-pro-541ed4b7.js +1 -0
  126. package/dist/client/static/js/one-light-nr79mykt.js +1 -0
  127. package/dist/client/static/js/packet-AYTQ26CC-cm8jeesg.js +1 -0
  128. package/dist/client/static/js/{pegDiagram-GJSIUBJH-9jkat1mz.js → pegDiagram-GJSIUBJH-qykb6ssk.js} +1 -1
  129. package/dist/client/static/js/{perl-sns2qvmf.js → perl-a8eeaqkn.js} +1 -1
  130. package/dist/client/static/js/{php-3q6v9eey.js → php-6gq92zt8.js} +1 -1
  131. package/dist/client/static/js/pie-WAS4IAKB-8b9xgcxv.js +1 -0
  132. package/dist/client/static/js/{pieDiagram-5QR66LMP-6pbchjh7.js → pieDiagram-5QR66LMP-mymrrvck.js} +2 -2
  133. package/dist/client/static/js/properties-xk4dn00p.js +1 -0
  134. package/dist/client/static/js/python-7sgz05n4.js +1 -0
  135. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-p9brea19.js → quadrantDiagram-O4NWA36T-6f8ahd40.js} +6 -6
  136. package/dist/client/static/js/r-w4qxm0pv.js +1 -0
  137. package/dist/client/static/js/radar-RG4KPBEZ-fxr2x2mf.js +1 -0
  138. package/dist/client/static/js/railroad-74A4TZTK-5qd45xk1.js +1 -0
  139. package/dist/client/static/js/railroad-abnf-HS5TGJTU-6fa00vpk.js +1 -0
  140. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-pcbtg7tj.js +1 -0
  141. package/dist/client/static/js/railroad-peg-WCYAUIDC-r0fdhdtp.js +1 -0
  142. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-3cep8css.js → railroadDiagram-XR7U4H2S-c3habpvw.js} +1 -1
  143. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-x1yjgsrr.js → requirementDiagram-PLB6GJNP-nysqy6te.js} +12 -12
  144. package/dist/client/static/js/{ruby-f9k99tfq.js → ruby-mc826p2e.js} +1 -1
  145. package/dist/client/static/js/{rust-yy8gekx8.js → rust-m4f4vpvn.js} +1 -1
  146. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-23wzf4aj.js → sankeyDiagram-IPEJSGJF-s5dtfp3z.js} +4 -4
  147. package/dist/client/static/js/{sass-2syegq28.js → sass-8bq5r2tz.js} +1 -1
  148. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-w4wr3zzr.js → sequenceDiagram-PO4LG4MO-bb3yp049.js} +21 -21
  149. package/dist/client/static/js/{sizeCapture-INFHLROL-aabfesnr.js → sizeCapture-INFHLROL-0m2msee7.js} +1 -1
  150. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-t0n288xw.js → stateDiagram-v2-GCMORJYK-cd0qgj6t.js} +3 -3
  151. package/dist/client/static/js/{svelte-mm3jfpje.js → svelte-5vrwkc13.js} +1 -1
  152. package/dist/client/static/js/{swimlanes-2SLR337P-1nnm0p7h.js → swimlanes-2SLR337P-rpb01f7p.js} +1 -1
  153. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-zx36y2c8.js +8 -0
  154. package/dist/client/static/js/{timeline-definition-EJHVYXUP-8pyssn0q.js → timeline-definition-EJHVYXUP-tqw2e6y1.js} +5 -5
  155. package/dist/client/static/js/treeView-Q6P3EWNA-9sn2h4ea.js +1 -0
  156. package/dist/client/static/js/treemap-WGGIJYW6-9fzms0pq.js +1 -0
  157. package/dist/client/static/js/tsx-h5yzg80q.js +1 -0
  158. package/dist/client/static/js/typescript-qy1sbhea.js +1 -0
  159. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-vveepvt6.js → usecaseDiagram-POWQR4AR-dhf4d5xg.js} +41 -41
  160. package/dist/client/static/js/{vennDiagram-UO4OBE2U-tqyvmqxc.js → vennDiagram-UO4OBE2U-ztkk79dv.js} +7 -7
  161. package/dist/client/static/js/{vue-e8e3q3hj.js → vue-gmjnxjm3.js} +1 -1
  162. package/dist/client/static/js/wardley-WFR3VGLG-vy6rp5gp.js +1 -0
  163. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-p8rs34em.js → wardleyDiagram-VNRHLVJA-ahre5tmv.js} +5 -5
  164. package/dist/client/static/js/xml-mrk4xakv.js +1 -0
  165. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-pgnvxtps.js → xychartDiagram-PMCCYNJV-vak2c50n.js} +6 -6
  166. package/dist/client/static/js/yaml-xaza6dra.js +1 -0
  167. package/package.json +6 -6
  168. package/src/client/bootstrap.d.ts +11 -0
  169. package/src/client/borders.css +3 -4
  170. package/src/client/components/auth/login-screen/index.tsx +1 -1
  171. package/src/client/components/common/ComposerPicker.tsx +1 -1
  172. package/src/client/components/common/CopyButton.tsx +1 -1
  173. package/src/client/components/common/FolderPicker.tsx +1 -1
  174. package/src/client/components/common/SubagentStatusIcon.tsx +2 -2
  175. package/src/client/components/common/ViewportSelector.tsx +2 -2
  176. package/src/client/components/common/batch-selection/BatchActionBar.tsx +1 -1
  177. package/src/client/components/common/batch-selection/BatchDeleteModal.tsx +4 -4
  178. package/src/client/components/common/checkbox/style.ts +1 -1
  179. package/src/client/components/common/context-usage-button/McpSection.tsx +3 -2
  180. package/src/client/components/common/file-icon/index.tsx +3 -3
  181. package/src/client/components/common/harness-glyph/index.tsx +4 -3
  182. package/src/client/components/common/image-viewer/fullscreen.tsx +1 -1
  183. package/src/client/components/common/image-viewer/index.tsx +2 -2
  184. package/src/client/components/common/markdown-review/ReviewPopover.tsx +2 -2
  185. package/src/client/components/common/markdown-review/ReviewSummary.tsx +3 -3
  186. package/src/client/components/common/plugin-render-boundary/index.tsx +1 -1
  187. package/src/client/components/common/server-control/Panel.tsx +1 -1
  188. package/src/client/components/common/server-control/Row.tsx +3 -3
  189. package/src/client/components/common/session-actions-menu/MenuItem.tsx +2 -2
  190. package/src/client/components/common/session-branch/SubagentRow.tsx +1 -1
  191. package/src/client/components/common/session-delete-modal/index.tsx +4 -4
  192. package/src/client/components/common/session-row/StatusSlot.tsx +1 -1
  193. package/src/client/components/common/session-row/index.tsx +40 -2
  194. package/src/client/components/common/session-row/session-row.test.tsx +46 -3
  195. package/src/client/components/common/shell-update-button/Modal.tsx +1 -1
  196. package/src/client/components/common/todo-row/index.tsx +1 -1
  197. package/src/client/components/common/window-controls/index.tsx +1 -1
  198. package/src/client/components/common/workspace-options-menu/index.tsx +4 -4
  199. package/src/client/components/layout/session-sidebar/Toolbar.tsx +2 -2
  200. package/src/client/components/layout/session-sidebar/WorktreeBadge.tsx +1 -1
  201. package/src/client/components/layout/session-sidebar/about-modal/UpdateLogDialog.tsx +1 -1
  202. package/src/client/components/layout/session-sidebar/about-modal/UpdateSection.tsx +3 -3
  203. package/src/client/components/layout/session-sidebar/about-modal/index.tsx +1 -1
  204. package/src/client/components/layout/session-sidebar/modern/FilterChips.tsx +1 -1
  205. package/src/client/components/layout/session-sidebar/new-workspace-modal/DirectoryList.tsx +2 -2
  206. package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +1 -1
  207. package/src/client/components/layout/session-sidebar/scheduler-modal/ModelFields.tsx +1 -1
  208. package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +1 -1
  209. package/src/client/components/layout/session-sidebar/scheduler-modal/TaskList.tsx +4 -4
  210. package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +1 -1
  211. package/src/client/components/layout/update-popup/Actions.tsx +1 -1
  212. package/src/client/components/mobile/mobile-right-sidebar/Action.tsx +1 -1
  213. package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +3 -3
  214. package/src/client/components/mobile/mobile-right-sidebar/MissingFileBanner.tsx +2 -2
  215. package/src/client/components/mobile/mobile-right-sidebar/PreviewScroller.tsx +2 -2
  216. package/src/client/components/mobile/mobile-right-sidebar/StatusBar.tsx +2 -2
  217. package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +3 -3
  218. package/src/client/components/settings/Modal.tsx +8 -3
  219. package/src/client/components/settings/SettingsSidebarList.tsx +2 -2
  220. package/src/client/components/settings/Sidebar.tsx +3 -3
  221. package/src/client/components/settings/apply-side-effects.test.ts +46 -0
  222. package/src/client/components/settings/apply-side-effects.ts +8 -0
  223. package/src/client/components/settings/categories/BehaviorSettings.tsx +1 -1
  224. package/src/client/components/settings/categories/OmpSettings.tsx +3 -3
  225. package/src/client/components/settings/categories/UsageSettings.tsx +3 -3
  226. package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +5 -5
  227. package/src/client/components/settings/categories/appearance-settings/CustomThemeEditor.tsx +177 -0
  228. package/src/client/components/settings/categories/appearance-settings/CustomThemeSection.test.tsx +136 -0
  229. package/src/client/components/settings/categories/appearance-settings/CustomThemeSection.tsx +180 -0
  230. package/src/client/components/settings/categories/appearance-settings/ThemeCard.tsx +1 -1
  231. package/src/client/components/settings/categories/appearance-settings/ThemeGrid.tsx +6 -5
  232. package/src/client/components/settings/categories/appearance-settings/ThemePreview.tsx +106 -0
  233. package/src/client/components/settings/categories/appearance-settings/ThemeSection.tsx +7 -3
  234. package/src/client/components/settings/categories/behavior-settings/Editor.tsx +1 -1
  235. package/src/client/components/settings/categories/chat-settings/ToolRenderSection.tsx +1 -1
  236. package/src/client/components/settings/categories/command-settings/DetailPane.tsx +4 -4
  237. package/src/client/components/settings/categories/dictation-settings/ExternalSection.tsx +1 -1
  238. package/src/client/components/settings/categories/git-settings/CommitMessageSection.tsx +1 -1
  239. package/src/client/components/settings/categories/git-settings/IdentitySection.tsx +2 -2
  240. package/src/client/components/settings/categories/harness-settings/AccountLoginPanel.tsx +3 -3
  241. package/src/client/components/settings/categories/harness-settings/AccountsPanel.tsx +13 -83
  242. package/src/client/components/settings/categories/harness-settings/HarnessImportControls.tsx +1 -1
  243. package/src/client/components/settings/categories/mcp-settings/ConnectionTest.tsx +1 -1
  244. package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +5 -5
  245. package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +1 -1
  246. package/src/client/components/settings/categories/mcp-settings/KeyValueSection.tsx +1 -1
  247. package/src/client/components/settings/categories/mcp-settings/SidebarList.tsx +2 -2
  248. package/src/client/components/settings/categories/omp-settings/ConfigTabs.tsx +4 -4
  249. package/src/client/components/settings/categories/omp-settings/OrderedChips.tsx +1 -1
  250. package/src/client/components/settings/categories/omp-settings/PresetBar.tsx +3 -3
  251. package/src/client/components/settings/categories/omp-settings/RoleEditor.tsx +2 -2
  252. package/src/client/components/settings/categories/omp-settings/RowEditor.tsx +2 -2
  253. package/src/client/components/settings/categories/panel-plugins/GitFreshness.tsx +2 -2
  254. package/src/client/components/settings/categories/panel-plugins/InstallForm.tsx +3 -3
  255. package/src/client/components/settings/categories/panel-plugins/InstalledList.tsx +1 -1
  256. package/src/client/components/settings/categories/panel-plugins/Meta.tsx +1 -1
  257. package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +5 -5
  258. package/src/client/components/settings/categories/panel-plugins/ReadmeModal.tsx +1 -1
  259. package/src/client/components/settings/categories/panel-plugins/Registries.tsx +4 -4
  260. package/src/client/components/settings/categories/panel-plugins/Section.tsx +3 -3
  261. package/src/client/components/settings/categories/panel-plugins/SettingsModal.tsx +2 -2
  262. package/src/client/components/settings/categories/panel-plugins/SyncBlockedNotice.tsx +2 -2
  263. package/src/client/components/settings/categories/panel-plugins/Toolbar.tsx +1 -1
  264. package/src/client/components/settings/categories/plugin-settings/DetailPane.tsx +2 -2
  265. package/src/client/components/settings/categories/plugin-settings/MarketplacePane.tsx +4 -4
  266. package/src/client/components/settings/categories/plugin-settings/SettingsSection.tsx +1 -1
  267. package/src/client/components/settings/categories/plugin-settings/SidebarList.tsx +4 -4
  268. package/src/client/components/settings/categories/project-settings/AddProjectModal.tsx +1 -1
  269. package/src/client/components/settings/categories/project-settings/DeleteProjectModal.tsx +3 -3
  270. package/src/client/components/settings/categories/project-settings/DetailsHeader.tsx +1 -1
  271. package/src/client/components/settings/categories/project-settings/IconGrid.tsx +3 -3
  272. package/src/client/components/settings/categories/project-settings/SidebarList.tsx +1 -1
  273. package/src/client/components/settings/categories/project-settings/WorktreeSettings.tsx +2 -2
  274. package/src/client/components/settings/categories/provider-settings/AddModelModal.tsx +3 -3
  275. package/src/client/components/settings/categories/provider-settings/AddProviderModal.tsx +2 -2
  276. package/src/client/components/settings/categories/provider-settings/AuthSection.tsx +3 -3
  277. package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +3 -3
  278. package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +1 -1
  279. package/src/client/components/settings/categories/provider-settings/EntryModal.tsx +2 -2
  280. package/src/client/components/settings/categories/provider-settings/LoginModal.tsx +2 -2
  281. package/src/client/components/settings/categories/provider-settings/LogoutProviderModal.tsx +3 -3
  282. package/src/client/components/settings/categories/provider-settings/ModelCapabilitiesModal.tsx +1 -1
  283. package/src/client/components/settings/categories/provider-settings/PriceFields.tsx +1 -1
  284. package/src/client/components/settings/categories/skill-catalog/GitImportPanel.tsx +1 -1
  285. package/src/client/components/settings/categories/skill-catalog/SkillCard.tsx +1 -1
  286. package/src/client/components/settings/categories/skill-catalog/SourceRail.tsx +1 -1
  287. package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +7 -7
  288. package/src/client/components/settings/categories/skill-settings/DetailPane.tsx +1 -1
  289. package/src/client/components/settings/categories/skill-settings/SidebarList.tsx +2 -2
  290. package/src/client/components/settings/categories/usage-settings/ProviderCard.tsx +1 -1
  291. package/src/client/components/settings/categories/usage-settings/SavedResetsSection.tsx +2 -2
  292. package/src/client/components/settings/categories/usage-settings/SidebarList.tsx +1 -1
  293. package/src/client/components/settings/categories/usage-settings/TokenHarborCard.tsx +1 -1
  294. package/src/client/components/settings/categories/voice-settings/speech/EndpointSection.tsx +2 -2
  295. package/src/client/components/settings/categories/voice-settings/speech/EngineSection.tsx +5 -5
  296. package/src/client/components/settings/categories/voice-settings/speech/ModelsSection.tsx +4 -4
  297. package/src/client/components/workspace/browser-panel/ActivityToasts.tsx +2 -2
  298. package/src/client/components/workspace/browser-panel/EngineNotice.tsx +1 -1
  299. package/src/client/components/workspace/browser-panel/index.tsx +2 -2
  300. package/src/client/components/workspace/browser-toolbar/clusters.tsx +2 -2
  301. package/src/client/components/workspace/btw-panel/Messages.tsx +2 -2
  302. package/src/client/components/workspace/btw-panel/TopicMenu.tsx +1 -1
  303. package/src/client/components/workspace/chat-timeline/AiMessageFooterSheet.tsx +1 -1
  304. package/src/client/components/workspace/chat-timeline/ChangedFilesSummary.tsx +7 -7
  305. package/src/client/components/workspace/chat-timeline/ComposerDock.tsx +2 -2
  306. package/src/client/components/workspace/chat-timeline/IrcNotice.tsx +2 -2
  307. package/src/client/components/workspace/chat-timeline/MessageItem.tsx +3 -3
  308. package/src/client/components/workspace/chat-timeline/OrchestrationNotice.tsx +5 -5
  309. package/src/client/components/workspace/chat-timeline/QueueList.tsx +1 -1
  310. package/src/client/components/workspace/chat-timeline/SubagentControls.tsx +1 -1
  311. package/src/client/components/workspace/chat-timeline/SystemNotice.tsx +5 -5
  312. package/src/client/components/workspace/chat-timeline/TaskResultContent.tsx +1 -1
  313. package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +1 -1
  314. package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +1 -1
  315. package/src/client/components/workspace/chat-timeline/block-chrome.test.tsx +2 -2
  316. package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +1 -1
  317. package/src/client/components/workspace/chat-timeline/chat-input/ComposerNotice.tsx +2 -2
  318. package/src/client/components/workspace/chat-timeline/chat-input/ComposerRows.tsx +1 -1
  319. package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.tsx +11 -11
  320. package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +3 -3
  321. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +2 -2
  322. package/src/client/components/workspace/chat-timeline/chat-input/VoiceNotice.tsx +1 -1
  323. package/src/client/components/workspace/chat-timeline/chat-input/props.ts +3 -3
  324. package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +1 -1
  325. package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +2 -2
  326. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormAsk.tsx +1 -1
  327. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormDialog.tsx +1 -1
  328. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionCard.tsx +2 -2
  329. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/SwipeDeck.tsx +7 -7
  330. package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/ApprovalBody.tsx +1 -1
  331. package/src/client/components/workspace/chat-timeline/tool-renderers/hashline-patch/index.tsx +3 -3
  332. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AstEdit.tsx +5 -5
  333. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +9 -9
  334. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Debug.tsx +5 -5
  335. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Edit.tsx +5 -5
  336. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Eval.tsx +6 -6
  337. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/FileMatches.tsx +2 -2
  338. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Github.tsx +7 -7
  339. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Goal.tsx +5 -5
  340. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/GoalRecord.tsx +5 -5
  341. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Lsp.tsx +9 -9
  342. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ManageSkill.tsx +3 -3
  343. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.tsx +8 -8
  344. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Resolve.tsx +3 -3
  345. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SecurityScan.tsx +6 -6
  346. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/TaskResult.tsx +2 -2
  347. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Todo.tsx +1 -1
  348. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +7 -7
  349. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx +1 -1
  350. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.tsx +2 -2
  351. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/EnvelopeHeader.tsx +3 -3
  352. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolCardShell.tsx +4 -4
  353. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolFactChips.tsx +5 -5
  354. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolRowActions.tsx +1 -1
  355. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/status-glyph.tsx +3 -3
  356. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.test.tsx +35 -9
  357. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +17 -12
  358. package/src/client/components/workspace/context-panel/RawJsonViewer.tsx +2 -2
  359. package/src/client/components/workspace/diff-panel/ConflictBanner.tsx +3 -3
  360. package/src/client/components/workspace/diff-panel/Toolbar.tsx +3 -3
  361. package/src/client/components/workspace/diff-panel/index.tsx +3 -3
  362. package/src/client/components/workspace/diff-panel/toolbar-git-actions.tsx +1 -1
  363. package/src/client/components/workspace/editor/ConflictStrip.tsx +2 -2
  364. package/src/client/components/workspace/editor/ExternalChangeStrip.tsx +2 -2
  365. package/src/client/components/workspace/editor/FilePane.tsx +6 -6
  366. package/src/client/components/workspace/editor/FindWidget.tsx +2 -2
  367. package/src/client/components/workspace/editor/GoToLineModal.tsx +1 -1
  368. package/src/client/components/workspace/editor/SaveAsModal.tsx +3 -3
  369. package/src/client/components/workspace/editor/SaveDeletedFileModal.tsx +2 -2
  370. package/src/client/components/workspace/editor/StatusBar.tsx +1 -1
  371. package/src/client/components/workspace/editor/Tabs.test.ts +3 -3
  372. package/src/client/components/workspace/editor/Tabs.tsx +6 -6
  373. package/src/client/components/workspace/editor/Toolbar.tsx +4 -4
  374. package/src/client/components/workspace/editor/toolbar-clusters.tsx +1 -1
  375. package/src/client/components/workspace/editor/viewers/DataGrid.tsx +1 -1
  376. package/src/client/components/workspace/editor/viewers/GridToolbar.tsx +2 -2
  377. package/src/client/components/workspace/editor/viewers/SheetView.tsx +2 -2
  378. package/src/client/components/workspace/editor/viewers/ViewerError.tsx +2 -2
  379. package/src/client/components/workspace/file-explorer/ArchiveModals.tsx +1 -1
  380. package/src/client/components/workspace/file-explorer/ContextMenu.tsx +3 -3
  381. package/src/client/components/workspace/file-explorer/Modals.tsx +3 -3
  382. package/src/client/components/workspace/file-explorer/RowLabel.test.tsx +2 -2
  383. package/src/client/components/workspace/git-panel/BranchToolbar.tsx +2 -2
  384. package/src/client/components/workspace/git-panel/ChangesList.tsx +3 -3
  385. package/src/client/components/workspace/git-panel/ConflictItem.tsx +3 -3
  386. package/src/client/components/workspace/git-panel/FileItem.tsx +1 -1
  387. package/src/client/components/workspace/git-panel/Modals.tsx +1 -1
  388. package/src/client/components/workspace/git-panel/OperationBar.tsx +4 -4
  389. package/src/client/components/workspace/git-panel/StashSection.tsx +1 -1
  390. package/src/client/components/workspace/git-panel/TreeItem.tsx +2 -2
  391. package/src/client/components/workspace/git-panel/branch-modal/BranchRow.tsx +2 -2
  392. package/src/client/components/workspace/git-panel/branch-modal/DeleteDialog.tsx +2 -2
  393. package/src/client/components/workspace/git-panel/branch-modal/index.tsx +2 -2
  394. package/src/client/components/workspace/model-dropdown/HarnessTabs.tsx +31 -76
  395. package/src/client/components/workspace/model-dropdown/Item.tsx +2 -2
  396. package/src/client/components/workspace/model-dropdown/Panel.tsx +15 -9
  397. package/src/client/components/workspace/model-dropdown/Section.tsx +1 -1
  398. package/src/client/components/workspace/model-dropdown/harness-tabs.test.tsx +12 -83
  399. package/src/client/components/workspace/model-dropdown/index.tsx +2 -2
  400. package/src/client/components/workspace/model-dropdown/picker-close.test.tsx +16 -2
  401. package/src/client/components/workspace/plan-panel/PageView.tsx +2 -2
  402. package/src/client/components/workspace/plan-panel/index.tsx +2 -2
  403. package/src/client/components/workspace/plugin-panel/Error.tsx +1 -1
  404. package/src/client/components/workspace/repo-picker/Modal.tsx +3 -3
  405. package/src/client/components/workspace/repo-picker/Row.tsx +5 -5
  406. package/src/client/components/workspace/search-panel/Body.tsx +2 -2
  407. package/src/client/components/workspace/terminal-panel/Header.tsx +3 -3
  408. package/src/client/components/workspace/terminal-panel/KeyBar.tsx +2 -2
  409. package/src/client/components/workspace/terminal-panel/QuickActions.tsx +1 -1
  410. package/src/client/components/workspace/terminal-panel/RealtimeTerminalView.tsx +1 -1
  411. package/src/client/components/workspace/terminal-panel/index.tsx +1 -1
  412. package/src/client/components/workspace/usage-panel/index.tsx +3 -3
  413. package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +1 -1
  414. package/src/client/components/workspace/wiki-panel/PageView.tsx +2 -2
  415. package/src/client/components/workspace/wiki-panel/index.tsx +2 -2
  416. package/src/client/components/workspace/worktree-modal/index.tsx +1 -1
  417. package/src/client/data/settings/omp-schema.json +27 -7
  418. package/src/client/hooks/chat/timeline/session-harness.ts +2 -1
  419. package/src/client/hooks/editor/use-unload-guard.tsx +2 -2
  420. package/src/client/hooks/models/use-harness-accounts-panel.ts +142 -0
  421. package/src/client/hooks/ui/border-style.test.ts +1 -2
  422. package/src/client/hooks/ui/theme.ts +23 -2
  423. package/src/client/main.tsx +7 -1
  424. package/src/client/tailwind-contrast.test.ts +22 -7
  425. package/src/client/tailwind.css +115 -18
  426. package/src/server/lib/assets/theme-css.server.test.ts +31 -1
  427. package/src/server/lib/assets/theme-css.server.ts +15 -1
  428. package/src/server/lib/harness/accounts.test.ts +5 -3
  429. package/src/server/lib/harness/acp/acp-todos.test.ts +23 -0
  430. package/src/server/lib/omp/session/delete.server.ts +4 -0
  431. package/src/server/lib/realtime/topics/session-data.server.ts +63 -1
  432. package/src/server/lib/realtime/topics/session-data.test.ts +154 -0
  433. package/src/server/lib/tray/runtime.server.ts +5 -0
  434. package/src/server/plugins/ssr.ts +16 -4
  435. package/src/server/routes/settings/root.ts +11 -0
  436. package/src/server/routes/settings/settings-store-routes.test.ts +37 -0
  437. package/src/shared/lib/chat/timeline/block-chrome.ts +2 -2
  438. package/src/shared/lib/chat/todo/flat-list.test.ts +81 -0
  439. package/src/shared/lib/chat/todo/flat-list.ts +29 -0
  440. package/src/shared/lib/chat/todo/parser.ts +7 -53
  441. package/src/shared/lib/chat/todo/progress.test.ts +3 -3
  442. package/src/shared/lib/chat/todo/progress.ts +3 -3
  443. package/src/shared/lib/fs/git-status.test.ts +22 -22
  444. package/src/shared/lib/fs/git-status.ts +31 -31
  445. package/src/shared/lib/icons/icon-paint-authority.ts +5 -4
  446. package/src/shared/lib/omp/config/schema-releases-19-4.test.ts +20 -3
  447. package/src/shared/lib/settings/defaults.ts +1 -0
  448. package/src/shared/lib/theme/catalog.test.ts +42 -0
  449. package/src/shared/lib/theme/catalog.ts +66 -11
  450. package/src/shared/lib/theme/css.ts +25 -1
  451. package/src/shared/lib/theme/custom.test.ts +156 -0
  452. package/src/shared/lib/theme/custom.ts +260 -0
  453. package/src/shared/lib/theme/ink-scale.test.ts +83 -2
  454. package/src/shared/lib/theme/ink-scale.ts +74 -9
  455. package/src/shared/lib/theme/shell-palette.ts +3 -3
  456. package/src/shared/lib/theme/theme.test.ts +28 -13
  457. package/src/shared/types/settings/state.ts +11 -3
  458. package/tsconfig.json +6 -0
  459. package/dist/client/static/js/Body-p6zwk0nx.js +0 -3
  460. package/dist/client/static/js/ImageView-fkfq3fwv.js +0 -1
  461. package/dist/client/static/js/LayoutWrapper-mdb1qm26.js +0 -2
  462. package/dist/client/static/js/MergeDiffView-7kpjxcg9.js +0 -1
  463. package/dist/client/static/js/Modal-0p9cr2tn.js +0 -60
  464. package/dist/client/static/js/SessionsView-gptt0rq8.js +0 -1
  465. package/dist/client/static/js/architecture-7GRP2DOG-3hkq8grc.js +0 -1
  466. package/dist/client/static/js/bash-n7wcmq3s.js +0 -1
  467. package/dist/client/static/js/c-20y64hcp.js +0 -1
  468. package/dist/client/static/js/cpp-ty6n0dg9.js +0 -1
  469. package/dist/client/static/js/css-ncvxaxt0.js +0 -1
  470. package/dist/client/static/js/cynefin-OW5HDTMX-9m18e6m5.js +0 -1
  471. package/dist/client/static/js/eventmodeling-NTZA5JFV-d4egnv9v.js +0 -1
  472. package/dist/client/static/js/flowDiagram-KWPJA3E3-5bvd5k2t.js +0 -1
  473. package/dist/client/static/js/gitGraph-4MIJSDKK-grqv890n.js +0 -1
  474. package/dist/client/static/js/graphql-6rwdfcnf.js +0 -1
  475. package/dist/client/static/js/html-p76eszt9.js +0 -1
  476. package/dist/client/static/js/index-28wv94gz.js +0 -2
  477. package/dist/client/static/js/index-3wgjtp2k.js +0 -9
  478. package/dist/client/static/js/index-7trfm17d.js +0 -2
  479. package/dist/client/static/js/index-cxe75e06.js +0 -2
  480. package/dist/client/static/js/index-dmb1pykr.js +0 -1
  481. package/dist/client/static/js/index-fqc1snjw.js +0 -1
  482. package/dist/client/static/js/index-jsn2kedv.js +0 -1
  483. package/dist/client/static/js/index-pe4d9wht.js +0 -1
  484. package/dist/client/static/js/index-sm8gpk3g.js +0 -4
  485. package/dist/client/static/js/index-st6a8q5z.js +0 -470
  486. package/dist/client/static/js/index-stmwbavz.js +0 -1
  487. package/dist/client/static/js/index-swaveqxg.css +0 -1
  488. package/dist/client/static/js/index-t82q5t6m.js +0 -1
  489. package/dist/client/static/js/index-t9zjfxvc.js +0 -1
  490. package/dist/client/static/js/index-tdbcp70z.js +0 -2
  491. package/dist/client/static/js/index-v38j2zxn.js +0 -2
  492. package/dist/client/static/js/index-x17y7xdr.js +0 -2
  493. package/dist/client/static/js/index-xrb4kjr3.js +0 -1
  494. package/dist/client/static/js/info-A6RAGUB7-rzpg7qk1.js +0 -1
  495. package/dist/client/static/js/ini-kjcpgebh.js +0 -1
  496. package/dist/client/static/js/java-0bcyv1jt.js +0 -1
  497. package/dist/client/static/js/json-xha2drny.js +0 -1
  498. package/dist/client/static/js/jsx-8p6dqgpq.js +0 -1
  499. package/dist/client/static/js/lua-njwwdj4s.js +0 -1
  500. package/dist/client/static/js/markdown-8gbyxxjd.js +0 -1
  501. package/dist/client/static/js/one-dark-pro-sstqnzcf.js +0 -1
  502. package/dist/client/static/js/one-light-6fpxxq2j.js +0 -1
  503. package/dist/client/static/js/packet-AYTQ26CC-eac14hsq.js +0 -1
  504. package/dist/client/static/js/pie-WAS4IAKB-a9xqvysf.js +0 -1
  505. package/dist/client/static/js/properties-d5bwhgwz.js +0 -1
  506. package/dist/client/static/js/python-fdwwjjhh.js +0 -1
  507. package/dist/client/static/js/r-4d2ygtfj.js +0 -1
  508. package/dist/client/static/js/radar-RG4KPBEZ-jv2pm0fe.js +0 -1
  509. package/dist/client/static/js/railroad-74A4TZTK-j74sc0b6.js +0 -1
  510. package/dist/client/static/js/railroad-abnf-HS5TGJTU-eaf19baz.js +0 -1
  511. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-d4j5nq31.js +0 -1
  512. package/dist/client/static/js/railroad-peg-WCYAUIDC-ba862a9p.js +0 -1
  513. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-cx3f29mq.js +0 -8
  514. package/dist/client/static/js/treeView-Q6P3EWNA-e8yb44pd.js +0 -1
  515. package/dist/client/static/js/treemap-WGGIJYW6-zvdv84vp.js +0 -1
  516. package/dist/client/static/js/tsx-dk8rpgtw.js +0 -1
  517. package/dist/client/static/js/typescript-5txwpd9t.js +0 -1
  518. package/dist/client/static/js/wardley-WFR3VGLG-hbv0cg4s.js +0 -1
  519. package/dist/client/static/js/xml-8516fzfp.js +0 -1
  520. package/dist/client/static/js/yaml-6k1tmwtm.js +0 -1
@@ -1 +0,0 @@
1
- import{d,n,o,i,le,e,Le,_e,p,dt,f,E,ue,pt,yn,de,Ke,F,S,U,h,rn,ft,It,Rt,We,Lc,Zm,ua,rt,st,pa,_l,at,Bs,za,jo,Ho,qo,St,ur,Ts,Wo,Ko,Vo,fo,Nl,Ql,Rl,Ll}from"./index-st6a8q5z.js";import{Os,ja,Ur,Pu,Ou,ei,$u,$s,up,SA,TA,zs,Us,Gs,Gr,js,Hs,ti,qs,Ws,Ks,Vs,Mi,ni,Ys,Js,zu,Uu,Gu,ju,Hu,qu,Wu}from"./index-sm8gpk3g.js";import{no,Ed}from"./index-6z30g3ha.js";var ie="shrink-0 w-7 h-7 inline-flex items-center justify-center rounded border transition-colors cursor-pointer",re="border-ink/15 bg-paper text-ink/70 hover:bg-ink/5 hover:text-ink",fe="border-ink/30 bg-ink/10 text-ink";function ye({isSearchVisible:t,searchQuery:c,showArchived:m,optionsOpen:u,sortOption:C,onToggleSearch:N,onSearchChange:v,onToggleArchived:A,onHideArchived:W,onToggleOptions:k,onCloseOptions:I,onSortChange:O,onNewSession:P,onNewWorkspace:x,onScheduler:B,scheduledCount:l,onRefresh:M,refreshing:z,onSelectWorkspaces:L,selecting:b}){let{ref:R,width:_}=$s(SA),H=TA(_),r=new Set(up.slice(0,H)),a=up.slice(H),G=m?"Hide Archive":"Show Archive",j=l>0?`Scheduled tasks (${l} armed)`:"Scheduled tasks",w=[];if(a.includes("new-workspace"))w.push({id:"new-workspace",label:"New Workspace",icon:yn,onSelect:x});if(a.includes("refresh"))w.push({id:"refresh",label:"Refresh sessions",icon:S,onSelect:M});if(a.includes("search"))w.push({id:"search",label:"Search sessions",icon:U,onSelect:N,active:t});if(a.includes("archive"))w.push({id:"archive",label:G,icon:dt,onSelect:A,active:m});if(a.includes("select"))w.push({id:"select",label:b?"Cancel selection":"Select workspaces",icon:Ur,onSelect:L,active:b});if(a.includes("scheduler"))w.push({id:"scheduler",label:j,icon:ja,onSelect:B});return e("div",{className:"p-3 border-b border-ink/10 flex flex-col space-y-3",children:[e("div",{ref:R,className:"flex items-center justify-between gap-2 px-1 text-ink/60",children:[e("div",{className:"flex flex-1 min-w-0 items-center gap-1.5",children:[e("button",{type:"button",title:"New Session","aria-label":"New Session",onClick:P,className:"flex-1 min-w-[52px] h-7 flex items-center justify-center space-x-1.5 px-2 rounded bg-ink text-canvas text-xs font-semibold hover:bg-ink/90 transition-colors cursor-pointer",children:[e(F,{size:14,className:"shrink-0"}),e("span",{className:"truncate",children:"New Session"})]}),r.has("new-workspace")&&e("button",{type:"button",title:"New Workspace","aria-label":"New Workspace",onClick:x,className:`${ie} ${re}`,children:e(yn,{size:14})}),r.has("scheduler")&&e("button",{type:"button",title:j,"aria-label":l>0?`Scheduled tasks, ${l} armed`:"Scheduled tasks",onClick:B,className:`relative ${ie} ${re}`,children:[e(ja,{size:14}),l>0&&e("span",{className:"absolute -top-1 -right-1 min-w-[10px] h-[10px] px-[2px] rounded-full bg-ink text-canvas text-[7px] leading-[10px] text-center font-semibold",children:l>9?"9+":l})]}),r.has("refresh")&&e("button",{type:"button",title:"Refresh sessions",onClick:M,className:`${ie} ${re}`,"aria-label":"Refresh sessions","aria-busy":z,children:e(S,{size:14,className:z?"animate-spin":""})})]}),e("div",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[r.has("search")&&e("button",{type:"button",title:t?"Hide search":"Search sessions","aria-label":t?"Hide search":"Search sessions","aria-pressed":t,onClick:N,className:`${ie} ${t?fe:re}`,children:e(U,{size:14})}),r.has("select")&&e("button",{type:"button",title:b?"Cancel selection":"Select workspaces","aria-label":b?"Cancel selection":"Select workspaces","aria-pressed":b,onClick:L,className:`${ie} ${b?fe:re}`,children:e(Ur,{size:14})}),r.has("archive")&&e("button",{type:"button",title:G,"aria-label":G,"aria-pressed":m,onClick:A,className:`${ie} ${m?fe:re}`,children:e(dt,{size:14})}),r.has("sort")&&e("div",{className:"relative",children:[e("button",{type:"button",title:"Sort workspaces","aria-label":"Sort workspaces","aria-haspopup":"menu","aria-expanded":u,onClick:k,className:`${ie} ${u||C!=="A-Z"?fe:re}`,children:e(Os,{size:14})}),u&&e("div",{className:"glass-popover absolute right-0 top-full mt-2 w-48 bg-paper border border-ink/15 rounded-lg shadow-lg z-50 py-1",onMouseLeave:I,children:e(ei,{variant:"desktop",sortOption:C,onSortChange:O})})]}),w.length>0&&e($u,{actions:w,sortHidden:a.includes("sort"),sortOption:C,onSortChange:O})]})]}),t&&e("div",{className:"pt-1",children:e("input",{type:"text",placeholder:"Search workspaces & sessions...",value:c,onChange:(K)=>v(K.currentTarget.value),autoFocus:!0,className:"w-full bg-ink/5 border border-ink/10 rounded px-2.5 py-1.5 outline-none focus:border-ink/30 text-xs text-ink placeholder-ink/40 transition-colors"})}),m&&e("div",{className:"flex items-center justify-between bg-warning/10 border border-warning/25 text-warning rounded px-2.5 py-1.5 text-[10px] font-medium",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(dt,{size:10}),e("span",{children:"Showing Archived"})]}),e("button",{className:"hover:text-warning-hover",onClick:W,children:e(h,{size:10})})]})]})}var Ce={inset:"px-2",insetPx:8,slotWidth:16,markGap:8,padding:"py-1.5",glyph:st.compact};function Ae({sessionId:t,title:c,harness:m,isActive:u=!1,isArchived:C=!1,status:N,awaitingInput:v=!1,timeAgo:A,timeTitle:W,runStartedAt:k,onClick:I,onArchive:O,onDelete:P,onRename:x,onRenameWithAi:B,expandable:l=!1,isExpanded:M=!1,onToggleExpand:z,isChild:L=!1,folderId:b,waitingFor:R,onCancelWait:_,worktree:H,selectable:r=!1,selected:a=!1,onToggleSelect:G}){let j=za(t),w=Boolean(l&&z),K=Boolean(R),V=w&&!(v||N==="stream"||K)&&!j,J=Boolean(j||v||N)&&!V,{isEditing:q,draft:y,setDraft:T,inputRef:ee,startRename:ae,handleKeyDown:Y,handleBlur:ne}=qo(c,x),Q=Wo(),te=Q.anchor!==null,se=Boolean(x||O||P||_);return e(d,{children:[e("div",{"data-testid":"session-item","data-session-id":String(t),"data-selected":r&&a?"true":void 0,"data-menu-open":te?"true":void 0,onClick:q?void 0:r?G:I,onContextMenu:se&&!q&&!r?Q.openAtCursor:void 0,className:`group/item relative flex items-center w-full rounded-lg px-2 py-1.5 cursor-pointer text-xs transition-colors select-none ${r&&a||te?Ws:u?"bg-ink/10 font-medium text-ink":"text-ink/75 hover:text-ink hover:bg-ink/5"}`,children:[r?e(d,{children:[e(Gr,{checked:a,label:`Select ${c}`,onChange:()=>G?.()}),e("span",{className:"w-2 shrink-0"})]}):e(d,{children:[e("span",{className:"relative w-4 h-4 shrink-0",children:[w&&z&&e("button",{type:"button",onClick:(Z)=>{Z.stopPropagation(),z(Z)},title:M?"Collapse sessions and subagents":"Expand sessions and subagents","aria-expanded":M,className:`peer absolute inset-0 flex items-center justify-center rounded cursor-pointer transition-opacity ${V?"text-ink/60 hover:text-ink":"text-ink/40 hover:text-ink pointer-events-none opacity-0 group-hover/item:pointer-events-auto group-hover/item:opacity-100 focus-visible:opacity-100"}`,children:M?e(E,{size:13}):e(ue,{size:13})}),J&&e("span",{className:`pointer-events-none absolute inset-0 flex items-center justify-center text-ink/60 transition-opacity ${w?"group-hover/item:opacity-0 peer-focus-visible:opacity-0":""}`,children:j?e("span",{role:"status","aria-label":"Generating a name…",children:e(p,{size:12,className:"animate-spin"})}):v?e(Le,{size:12,className:"animate-pulse text-ink/80"}):K?e("span",{role:"status","aria-label":`Waiting for ${R?.title??"another session"}`,children:e(Ke,{size:12,className:"animate-pulse text-ink/60"})}):N==="stream"?e("span",{role:"status","aria-label":"Running",children:e(p,{size:12,className:"animate-spin"})}):e(f,{size:12})}),L&&!w&&!J&&e("span",{"data-testid":"child-indicator","aria-hidden":"true",className:"pointer-events-none absolute inset-0 flex items-center justify-center text-ink/35",children:e(de,{size:12,"aria-hidden":"true"})})]}),e("span",{className:"w-2 shrink-0"})]}),m&&e("span",{className:"mr-1.5 flex shrink-0 items-center",children:e(rt,{harness:m,size:st.compact})}),q?e("input",{ref:ee,autoFocus:!0,value:y,onChange:(Z)=>T(Z.currentTarget.value),onClick:(Z)=>Z.stopPropagation(),onKeyDown:Y,onBlur:ne,className:"flex-1 min-w-0 bg-paper border border-ink/25 rounded px-1 py-0.5 text-xs text-ink outline-none focus:border-ink/50"}):e("span",{className:"flex-1 min-w-0 flex flex-col leading-snug",children:[e("span",{className:"min-w-0 truncate",children:c.charAt(0).toUpperCase()+c.slice(1)}),K&&e("span",{className:"truncate text-[10px] text-ink/40 font-normal",children:["waiting for ",R?.title??"another session"]}),H&&!q&&e(js,{worktree:H})]}),!q&&e(qs,{timeAgo:A,timeTitle:W,runStartedAt:k,className:"shrink-0 ml-2 font-mono text-[10px]"}),!q&&se&&!r&&e("button",{type:"button",onClick:Q.openBelow,title:"Session actions","aria-label":"Session actions","aria-haspopup":"menu","aria-expanded":te,className:"shrink-0 ml-1 p-1 text-ink/40 hover:text-ink hover:bg-ink/10 rounded cursor-pointer",children:e(_e,{size:14})})]}),Q.anchor&&e(Ko,{anchor:Q.anchor,sessionId:t,...m?{harness:m}:{},...b!==void 0?{folderId:b}:{},isArchived:C,onRename:x?ae:void 0,onRenameWithAi:B,onArchive:O,onDelete:P,onCancelWait:_,onClose:Q.close})]})}function Oe({folder:t,isOpen:c,onToggleFolder:m,checkbox:u,batchActive:C,showMenu:N,onToggleMenu:v,onCloseMenu:A,onNewSession:W,onNewWorktreeSession:k,onOpenFolder:I,onSelectSessions:O,confirmDelete:P,onPin:x,onDelete:B,onRequestDelete:l,onCancelDelete:M}){let z=pa(t.icon),[L,b]=n(!1),R=Boolean(k&&t.project_path),_=i(null),[H,r]=n(null);return e("div",{className:"group flex items-center justify-between h-7 text-xs font-semibold text-ink px-2 hover:bg-ink/5 rounded-md transition-colors select-none",children:[e("div",{className:"flex-1 h-full flex items-center cursor-pointer min-w-0",onClick:C?void 0:m,children:[u?e(d,{children:[e(Gr,{size:"md",checked:u.checked,indeterminate:u.indeterminate,label:u.label,onChange:u.onChange}),e("span",{className:"w-2 shrink-0"})]}):e(d,{children:[e("span",{className:"relative w-4 h-4 flex items-center justify-center shrink-0",children:[e("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover:opacity-0 touch-hidden",children:t.customIconUrl?e("img",{src:t.customIconUrl,alt:"",className:"w-[15px] h-[15px] rounded-xs object-contain shrink-0",referrerPolicy:"no-referrer"}):e(z,{size:15,className:"project-accent-mark text-ink/75",style:_l(t.accentColor)})}),e("span",{className:"absolute inset-0 flex items-center justify-center text-ink/60 opacity-0 transition-opacity group-hover:opacity-100 touch-visible",children:c?e(E,{size:13}):e(ue,{size:13})})]}),e("span",{className:"w-2 shrink-0"})]}),t.isPinned&&e(no,{size:11,className:"text-ink/60 shrink-0 mr-1.5"}),e("span",{className:"truncate text-[13px] font-semibold tracking-tight",children:t.name})]}),!C&&e("div",{className:"flex items-center space-x-0.5 pl-1",children:[e("button",{type:"button",title:"New Session","aria-label":`New session in ${t.name}`,className:"w-5 h-5 flex items-center justify-center text-ink/40 hover:text-ink hover:bg-ink/10 rounded cursor-pointer transition-colors",onClick:(a)=>{a.stopPropagation(),W()},children:e(F,{size:12})}),e("div",{className:"relative flex items-center",children:[e("button",{ref:_,type:"button",title:`Options for ${t.name}`,"aria-label":`Options for ${t.name}`,"aria-haspopup":"menu","aria-expanded":N,className:"w-5 h-5 flex items-center justify-center text-ink/40 hover:text-ink hover:bg-ink/10 rounded cursor-pointer transition-colors",onClick:(a)=>{if(a.stopPropagation(),_.current)r(It(_.current));v()},children:e(_e,{size:12})}),e(Rt,{anchor:N?H:null,align:"end",ariaLabel:`Options for ${t.name}`,className:"glass-popover w-44 rounded-md border border-ink/15 bg-paper py-1 text-xs shadow-lg",onClose:A,children:e(Ks,{variant:"desktop",isPinned:t.isPinned,onOpenFolder:I,onSelectSessions:O,onNewWorktree:R?()=>{v(),b(!0)}:void 0,confirmDelete:P,onPin:x,onDelete:B,onRequestDelete:l,onCancelDelete:M})})]})]}),R&&e(Vo,{isOpen:L,onClose:()=>b(!1),root:t.project_path??null,folderId:t.id,folderName:t.name,onCreated:(a)=>{b(!1),k?.(t.id,a.path)}})]})}function Te({folder:t,activeSessionId:c,onSelectSession:m,onNewSessionForFolder:u,onNewWorktreeSession:C,forceExpanded:N=!1,showArchived:v=!1,sessionStatus:A={},onToast:W,batch:k,onStartSessionSelection:I,onCancelWait:O}){let[P,x]=n(t.isExpanded||!1),[B,l]=n(!1),{visibleCount:M,showMore:z,showLess:L,canShowLess:b}=Us(),[R]=le(),_=R.get("subagent"),H=R.get("sessionId"),{expandedSessionIds:r,toggleSession:a}=Ts();o(()=>{if(typeof t.isExpanded==="boolean")x(t.isExpanded)},[t.isExpanded]);let{refresh:G,runStartedAtMap:j}=at(),w=ft(),{confirmDelete:K,requestDelete:oe,cancelDelete:V,handlePin:J,handleDelete:q,handleArchive:y,handleRename:T,handleRenameWithAi:ee,handleOpenFolder:ae}=Gs(t,G,W),Y=jo(),ne=()=>{l(!1),V()},Q=t.sessions,te=()=>{let s=!P;if(x(s),typeof t.id!=="number")return;w.submit({isExpanded:String(s)},{method:"POST",action:`/api/folders/${t.id}/toggle`})},se=()=>{J(),l(!1)},Z=()=>{q(),l(!1)},ge=ae?()=>{ae(),l(!1)}:void 0,he=N||P,me=(Q||[]).filter((s)=>v?s.is_archived===1:s.is_archived!==1),{folderCheckbox:g,sessionCheckboxes:D,folderSummary:ce,toggleFolderSelection:be,rendered:Fe,hiddenCount:ke}=Ys({batch:k,folder:t,sessions:me,showArchived:v,visibleCount:M,activeSessionId:c,sessionStatus:A}),Se=ni(Fe),Ie=he||D,xe=ke>0,we=(s,pe)=>{let X=String(s.id),Ne=c!==null?String(c)===X:s.is_active===1,Me=Ne&&H===X&&Boolean(_),ve=St(X);return e(Ae,{sessionId:s.id,title:s.title,harness:s.harness,folderId:s.folder_id,isActive:Ne&&!Me,isArchived:s.is_archived===1,status:A[X],awaitingInput:Boolean(s.awaitingInput),worktree:s.worktree,timeAgo:Hs(s.updated_at??s.created_at),timeTitle:ti(s.updated_at??s.created_at),runStartedAt:A[X]==="stream"?j[X]:void 0,onClick:()=>m(s.id),onArchive:()=>y(s),onDelete:ve?void 0:()=>Y.requestDelete(s),onRename:ve?void 0:(Ee)=>void T(s,Ee),onRenameWithAi:ve?void 0:()=>void ee(s),expandable:pe.expandable,isChild:pe.isChild,isExpanded:pe.isExpanded,onToggleExpand:pe.onToggleExpand,waitingFor:s.waitingFor?{title:s.waitingFor.title}:void 0,onCancelWait:s.waitingFor?()=>O?.(s.waitingFor.waitId):void 0,selectable:D,selected:Boolean(k?.selected.includes(X)),onToggleSelect:k?()=>k.toggle(X):void 0})},Be=(s)=>Vs(s,Se.childrenOf,r,a);return e("div",{className:"space-y-1",children:[e(Oe,{folder:t,isOpen:he,onToggleFolder:te,checkbox:g&&ce?{checked:ce.all,indeterminate:ce.some,label:`Select ${t.name}`,onChange:be}:null,batchActive:Boolean(k),showMenu:B,onToggleMenu:()=>l(!B),onCloseMenu:ne,onNewSession:()=>u(t.id),onNewWorktreeSession:C,onOpenFolder:ge,onSelectSessions:I?()=>{l(!1),I(t.id)}:void 0,confirmDelete:K,onPin:se,onDelete:Z,onRequestDelete:oe,onCancelDelete:V}),Ie&&e("div",{className:"space-y-0.5",children:[Se.roots.map((s)=>{let pe=String(s.id),X=Be(s);return e("div",{className:"space-y-0.5",children:[we(s,X),X.isExpanded&&e(Mi,{parentId:pe,hasSubagents:Boolean(s.hasSubagents),childrenOf:Se.childrenOf,expandedIds:r,onToggle:a,activeSessionId:c===null?null:String(c),renderSession:we,style:Ce})]},s.id)}),(xe||b)&&!D&&e("div",{className:"flex items-center gap-1",children:[xe&&e("button",{type:"button",onClick:z,className:"flex items-center min-w-0 text-xs text-ink/45 hover:text-ink/80 py-1.5 px-2 rounded-lg hover:bg-ink/5 transition-colors cursor-pointer select-none",children:[e("span",{className:"w-4 h-4 shrink-0 flex items-center justify-center",children:e(E,{size:12})}),e("span",{className:"w-2 shrink-0"}),e("span",{className:"truncate leading-snug",children:["Show more sessions (",ke,")"]})]}),b&&e("button",{type:"button",onClick:L,className:"ml-auto shrink-0 flex items-center gap-1 text-xs text-ink/45 hover:text-ink/80 py-1.5 px-2 rounded-lg hover:bg-ink/5 transition-colors cursor-pointer select-none",children:[e(pt,{size:12}),e("span",{className:"truncate leading-snug",children:"Show less"})]})]}),me.length===0&&e("div",{className:"px-3 py-2 text-[11px] text-ink/40 italic",children:v?"No archived sessions.":"No sessions."})]}),e(Ho,{session:Y.pending,isDeleting:Y.isDeleting,error:Y.error,onClose:Y.cancelDelete,onConfirm:()=>void Y.confirmDelete()})]})}function De({folders:t,activeSessionId:c,searchQuery:m,showArchived:u,harnessFilter:C,sessionStatus:N,onSelectSession:v,onNewSessionForFolder:A,onNewWorktreeSession:W,onToast:k,batch:I,onStartSessionSelection:O,onCancelWait:P}){return e("div",{className:"flex-1 scrollbar-overlay-container p-2 space-y-4",children:t.length===0?e("div",{className:"text-center py-8 text-xs text-muted",children:m?"No results found.":C?`No chats on ${ua(C)}.`:"No workspaces available."}):t.map((x)=>e(Te,{folder:x,activeSessionId:c,onSelectSession:v,onNewSessionForFolder:A,onNewWorktreeSession:W,forceExpanded:m.trim().length>0,showArchived:u,sessionStatus:N,onToast:k,batch:I,onStartSessionSelection:O,onCancelWait:P},x.id))})}var ze=[3,2];function Re(){return e("div",{className:"flex-1 p-2 space-y-4","aria-hidden":"true",children:ze.map((t,c)=>e("div",{className:"space-y-1.5",children:[e("div",{className:"flex items-center gap-2 px-1 py-1.5",children:[e("span",{className:"w-3.5 h-3.5 rounded-sm animate-pulse bg-ink/10"}),e("span",{className:"h-3 w-24 rounded animate-pulse bg-ink/10"})]}),Array.from({length:t},(m,u)=>e("div",{className:"flex items-center gap-2 rounded px-2 py-1.5",children:[e("span",{className:"w-4 h-4 rounded-full animate-pulse bg-ink/10"}),e("span",{className:"h-3 rounded animate-pulse bg-ink/10",style:{width:`${58-u%3*12}%`}})]},u))]},c))})}function Pe({className:t="",folders:c,initializing:m,failed:u,activeSessionId:C,sessionStatus:N,searchQuery:v,onSearchChange:A,showArchived:W,onToggleArchived:k,sortOption:I,optionsOpen:O,onToggleOptions:P,onCloseOptions:x,onSortChange:B,harnessFilter:l,onHarnessFilterChange:M,harnessOptions:z,onRefresh:L,refreshing:b,scheduledCount:R,onNewSession:_,onNewWorkspace:H,onScheduler:r,onSelectSession:a,onNewSessionForFolder:G,onNewWorktreeSession:j,onToast:w,onCancelWait:K,batch:oe,onSelectWorkspaces:V,onStartSessionSelection:J}){let[q,y]=n(!1),T=q||v.length>0,ee=Boolean(oe);return e("div",{className:`flex flex-col ${t}`,children:[e(ye,{isSearchVisible:T,searchQuery:v,showArchived:W,optionsOpen:O,sortOption:I,onToggleSearch:()=>{if(T)y(!1),A("");else y(!0)},onSearchChange:A,onToggleArchived:k,onHideArchived:k,onToggleOptions:P,onCloseOptions:x,onSortChange:B,onNewSession:_,onNewWorkspace:H,onScheduler:r,scheduledCount:R,onRefresh:L,refreshing:b,onSelectWorkspaces:V,selecting:ee}),e("div",{className:"px-3 pt-2 pb-1",children:e(zs,{options:z,value:l,onChange:M})}),u?e(Js,{onRetry:L,refreshing:b}):m?e(Re,{}):e(De,{folders:c,activeSessionId:C,searchQuery:v,showArchived:W,harnessFilter:l,sessionStatus:N,onSelectSession:a,onNewSessionForFolder:G,onNewWorktreeSession:j,onToast:w,batch:oe,onStartSessionSelection:J,onCancelWait:K})]})}function Wn({className:t="",appSettings:c={}}){let{folders:m,initializing:u,failed:C,refreshNow:N,isRefreshing:v,activeSessionId:A,sessionParam:W,searchQuery:k,setSearchQuery:I,showArchived:O,setShowArchived:P,optionsOpen:x,setOptionsOpen:B,sortOption:l,handleSortChange:M,harnessFilter:z,setHarnessFilter:L,harnessOptions:b,processedFolders:R,sessionStatus:_,handleSelectSession:H}=Uu(c,{expandSearchMatches:!0}),[,r]=le(),a=Ed(),[G,j]=n(!1),[w,K]=n(!1),oe=Pu(),{pushToast:V}=We(),J=Ql(V);Gu({onNotice:V});let q=Hu(R,O,N),{selection:y,deleteRun:T,archiveRun:ee,binding:ae,scopeFolder:Y,available:ne,selected:Q}=q,te=()=>{ee.archive(Q).then((g)=>{if(!g)return;let D=ju(g);if(D)V(D.message,D.tone);if(!g.error)y.end()})},se=(g)=>{let D=Nl(m,W,g);if(D)fo(D)},Z=()=>{Zm({replace:!0})},ge=(g,D)=>{se(g);let ce=ur(g);rn(ce,"chat.spawnTarget",{folderId:g,worktreePath:D}),r((be)=>Lc(be,ce,g),{replace:!0})},he=(g)=>{se(g),r((D)=>Lc(D,ur(g),g),{replace:!0})},me={className:`flex-1 min-h-0 w-full ${t}`,folders:R,initializing:u,failed:C,activeSessionId:A,sessionStatus:_,searchQuery:k,onSearchChange:I,showArchived:O,onToggleArchived:()=>P(!O),sortOption:l,optionsOpen:x,onToggleOptions:()=>B(!x),onCloseOptions:()=>B(!1),onSortChange:M,harnessFilter:z,onHarnessFilterChange:L,harnessOptions:b,onRefresh:N,refreshing:v,scheduledCount:oe,onNewSession:Z,onNewWorkspace:()=>j(!0),onScheduler:()=>K(!0),onSelectSession:H,onNewSessionForFolder:he,onNewWorktreeSession:ge,onToast:V,onCancelWait:J,batch:ae,onSelectWorkspaces:q.toggleWorkspaceSelection,onStartSessionSelection:(g)=>y.begin("session",g)};return e(d,{children:[e("div",{className:"flex flex-col h-full",children:[a==="modern"?e(zu,{...me}):e(Pe,{...me}),y.mode&&e(qu,{mode:y.mode,count:Q.length,total:ne.length,busy:T.isDeleting,archiving:ee.isArchiving,scopeLabel:Y?.name,onSelectAll:()=>y.selectAllOf(ne),onUnselectAll:()=>y.unselectAllOf(ne),onDelete:()=>T.request(Q),onArchive:te,onCancel:y.end})]}),e(Wu,{mode:y.mode??"session",count:T.pending.length,scopeLabel:Y?.name,isDeleting:T.isDeleting,progress:T.progress,outcome:T.outcome,onClose:()=>{let g=T.outcome?.refused.length??0;if(T.cancel(),T.outcome&&g===0)y.end()},onConfirm:()=>{let g=y.mode??"session";T.confirm(g).then((D)=>{if(D&&D.refused.length===0)y.end()})}}),e(Bs,{isOpen:G,onClose:()=>j(!1),onCreate:Rl,onClone:Ll}),e(Ou,{isOpen:w,onClose:()=>K(!1),activeSessionId:typeof W==="string"?W:null,onToast:V})]})}export{Wn as SessionsView};
@@ -1 +0,0 @@
1
- import{Eg}from"./index-cwwg7k5f.js";export{Eg as createArchitectureServices};
@@ -1 +0,0 @@
1
- import{Cm}from"./index-kt7c42n7.js";export{Cm as default};
@@ -1 +0,0 @@
1
- import{pi}from"./index-396g4zz4.js";export{pi as default};
@@ -1 +0,0 @@
1
- import{Ec}from"./index-m6eh5g1q.js";import"./index-396g4zz4.js";export{Ec as default};
@@ -1 +0,0 @@
1
- import{np,Ms,tb,nb,rb,ab}from"./index-668fc1df.js";export{tb as css,ab as gss,Ms as keywords,rb as less,np as mkCSS,nb as sCSS};
@@ -1 +0,0 @@
1
- import{yg}from"./index-cwwg7k5f.js";export{yg as createCynefinServices};
@@ -1 +0,0 @@
1
- import{Bg}from"./index-cwwg7k5f.js";export{Bg as createEventModelingServices};
@@ -1 +0,0 @@
1
- import"./index-xfnjwhan.js";import"./index-zynbvm7x.js";import{eb}from"./index-55v3qv04.js";export{eb as diagram};
@@ -1 +0,0 @@
1
- import{vg}from"./index-cwwg7k5f.js";export{vg as createGitGraphServices};
@@ -1 +0,0 @@
1
- import{Hg}from"./index-rbkvw2xs.js";import"./index-j9y4tjk0.js";import"./index-nnqyew8n.js";import"./index-q0k1am0g.js";import"./index-wxs0x3g1.js";export{Hg as default};
@@ -1 +0,0 @@
1
- import{qn}from"./index-60g0e74a.js";import"./index-q0k1am0g.js";import"./index-mpyd7qxj.js";export{qn as default};
@@ -1,2 +0,0 @@
1
- import{n,N,se,bs,aA}from"./index-st6a8q5z.js";var r={left:aA.left,right:aA.right},a="omp:mobile-panel-nav-changed";function s(e,t){return bs(N(r[e],t))}function ug(e,t){if(typeof window>"u")return;window.dispatchEvent(new CustomEvent(a,{detail:{side:e,style:bs(t)}}))}function rp(e){let[t,i]=n(()=>s(e));return se(a,(l)=>{let o=l.detail;if(o?.side!==e)return;i(bs(o.style))}),t}
2
- export{ug,rp};
@@ -1,9 +0,0 @@
1
- import{d,n,o,K,i,u,a,Dr,e,s,ro,_e,ao,p,Kn,Ne,Q,I,dt,f,E,ue,pt,ae,fe,de,Jn,fn,Zn,F,S,Ra,U,La,vn,h,Mr,Lo,sr,Bm,Te,T,_m,Jg,xr,wr,xt,nt,he,_d,Ei,X,mt,ft,On,an,gt,wl,We,be,J}from"./index-st6a8q5z.js";import{wm,Tr}from"./index-cxe75e06.js";var jt={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]},Ve=s(jt);var Ut={name:"list",size:24,node:[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]},Ye=s(Ut);function Xe({message:t,hasStagedChanges:l,isBusy:c=!1,amend:r=!1,seeded:m=!1,isGenerating:g=!1,suggestion:x=null,generated:v=!1,onToggleAmend:N,onChangeMessage:P,onCommit:w,onGenerate:C,onUseSuggestion:R,onDismissSuggestion:G}){let M=t.trim().length>0&&!c&&(r||l),k=(r||l)&&!c&&!g,b=r?"Rewrite the previous commit with this message":l?"Commit staged changes":"Stage changes first",y=g?"Generating…":r||l?"Generate a commit message from the staged changes":"Stage changes first";return e("div",{className:"border-t border-ink/10 bg-canvas/50 p-3 flex flex-col gap-2",children:[x&&e("div",{className:"rounded border border-ink/20 bg-paper p-2.5 space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-ink/45",children:"Generated message"}),e("div",{className:"flex items-center gap-1",children:[e("button",{type:"button",onClick:R,className:"px-2 py-0.5 rounded bg-ink text-canvas text-[10px] font-medium hover:bg-ink/90 transition-colors cursor-pointer",children:"Use"}),e("button",{type:"button",onClick:G,className:"px-2 py-0.5 rounded border border-ink/20 text-ink/70 text-[10px] font-medium hover:bg-ink/5 transition-colors cursor-pointer",children:"Dismiss"})]})]}),e("pre",{className:"whitespace-pre-wrap break-words text-[11px] text-ink/80 font-mono max-h-32 overflow-y-auto",children:x})]}),e("textarea",{value:t,onChange:(L)=>P(L.currentTarget.value),onKeyDown:(L)=>{if(L.key==="Enter"&&(L.metaKey||L.ctrlKey)&&M)L.preventDefault(),w()},placeholder:r?"New message for the previous commit (⌘/Ctrl+Enter to commit)":"Commit message (⌘/Ctrl+Enter to commit)",rows:5,className:"w-full resize-y min-h-[100px] max-h-[200px] bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),v&&t.trim().length>0&&e("div",{className:"flex items-center gap-1 text-[10px] text-ink/40",children:[e(Ne,{size:10})," Generated from staged changes"]}),e("div",{className:"flex flex-wrap items-center gap-2",children:[e("label",{className:"flex items-center gap-1.5 text-[11px] text-ink/70 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:r,onChange:(L)=>N?.(L.currentTarget.checked),className:`${be} accent-ink cursor-pointer`}),"Amend"]}),r&&m&&e("span",{className:"text-[10px] text-ink/40",title:"The previous commit's message, loaded as an editable starting point",children:"previous message loaded"}),e("button",{type:"button",onClick:C,disabled:!k,title:y,"aria-label":"Generate commit message with AI",className:"ml-auto flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[g?e(p,{size:12,className:"animate-spin"}):e(Ne,{size:12}),g?"Generating…":"Generate"]}),e("button",{type:"button",onClick:w,disabled:!M,title:b,className:"flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(f,{size:12}),r?"Amend commit":"Commit"]})]})]})}function Qe({operation:t,conflicts:l,isBusy:c,onAbort:r,onContinue:m}){let g=Lo[t],x=l.length,v=x===0,N=t!=="stash-pop";return e("div",{className:"border-t border-warning/30 bg-warning/5 p-3 flex flex-col gap-2",children:[e("div",{className:"flex items-center gap-2 text-xs text-ink",children:[e(I,{size:13,className:"text-warning flex-shrink-0"}),e("span",{className:"font-medium",children:[g.charAt(0).toUpperCase()+g.slice(1)," in progress"]}),e("span",{className:`font-mono tabular-nums text-[10px] ${v?"text-success":"text-warning"}`,children:v?"all conflicts resolved":`${x} conflict${x===1?"":"s"} left`})]}),!v&&e("div",{className:"max-h-20 overflow-y-auto scrollbar-overlay-container font-mono text-[10px] text-warning/90 space-y-0.5",children:l.map((P)=>e("div",{className:"truncate",title:P,children:P},P))}),e("div",{className:"flex items-stretch gap-2",children:[e("button",{type:"button",onClick:r,disabled:c,title:`Abort the ${g} and restore the previous state`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-error/40 text-error hover:bg-error/10 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(vn,{size:12}),"Abort ",g]}),N&&e("button",{type:"button",onClick:m,disabled:c||!v,title:v?`Conclude the ${g}`:`Resolve all ${x} conflict(s) first`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-transparent bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(Jn,{size:12}),"Continue ",g]})]})]})}function Ze({branchRef:t,showBranchMenu:l,setShowBranchMenu:c,branch:r,branches:m,remoteBranches:g,onCheckout:x,onMerge:v,onOpenBranchPrompt:N,onManageBranches:P,optionsRef:w,showOptions:C,setShowOptions:R,onHistory:G,onGraph:M,viewMode:k,setViewMode:b,isBusy:y=!1,syncCount:L={ahead:0,behind:0},syncing:B=!1,onSync:z,onFetch:q,detached:A=!1}){let[V,Y]=n("");o(()=>{if(!l)Y("")},[l]);let _=V.trim(),H=u(()=>m.filter((D)=>an(D,_)),[m,_]),O=u(()=>g.filter((D)=>an(D,_)),[g,_]);return e("div",{className:"p-3 border-b border-ink/10 bg-canvas/50 flex items-center justify-between",children:[e("div",{className:"relative",ref:t,children:[e("button",{onClick:()=>c(!l),className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 -ml-2 rounded transition-colors text-[11px] text-ink/80 font-medium",title:A?`Detached HEAD at ${r}`:`On branch ${r}`,children:[e(de,{size:12,className:A?"text-warning":"text-ink/60"}),e("span",{className:`truncate max-w-[140px] ${A?"font-mono text-warning":""}`,children:r}),e(E,{size:12,className:"text-ink/40"})]}),l&&e("div",{className:"glass-popover absolute top-full left-0 mt-1 w-64 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:[e(On,{value:V,onChange:Y,ariaLabel:"Search branches",placeholder:"Search branches…"}),e("div",{className:"max-h-48 scrollbar-overlay-container py-1",children:[H.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Local"}),H.map((D)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{x(D),c(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:D}),r===D&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==D&&e("button",{type:"button",onClick:()=>{v(D),c(!1)},title:`Merge ${D} into ${r}`,"aria-label":`Merge ${D} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Jn,{size:12})})]},D))]}),O.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Remote"}),O.map((D)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{x(D),c(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:D}),r===D&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==D&&e("button",{type:"button",onClick:()=>{v(D),c(!1)},title:`Merge ${D} into ${r}`,"aria-label":`Merge ${D} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Jn,{size:12})})]},D))]}),H.length===0&&O.length===0&&e("div",{className:"px-3 py-2 text-ink/40 italic",children:["No match for “",_,"”"]}),e("div",{className:"w-full h-px bg-ink/10 my-1"}),e("button",{onClick:()=>{N(),c(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80 italic",children:[e(F,{size:12}),e("span",{children:"Create new branch..."})]}),e("button",{onClick:P,className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80",children:[e(La,{size:12}),e("span",{children:"Manage branches..."})]})]})]})]}),e("div",{className:"flex items-center space-x-2 text-ink/40 relative",ref:w,children:[e("button",{type:"button",onClick:q,disabled:y,title:"Fetch from all remotes and prune deleted branches","aria-label":"Fetch",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e(ro,{size:13})}),e("button",{type:"button",onClick:z,disabled:y,title:B?"Syncing with upstream…":L.ahead>0&&L.behind>0?`Pull ${L.behind} then push ${L.ahead} commit(s)`:L.ahead>0?`Push ${L.ahead} commit(s)`:L.behind>0?`Pull ${L.behind} commit(s)`:"Up to date — sync anyway","aria-label":"Sync with upstream","aria-busy":B,className:`flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:cursor-not-allowed ${B?"":"disabled:opacity-40"}`,children:[e(S,{size:13,className:B?"animate-spin":"","aria-hidden":"true"}),e("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",L.ahead," ↓",L.behind]})]}),e("button",{type:"button",onClick:G,title:"Commit History","aria-label":"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Kn,{size:13})}),e("button",{type:"button",onClick:M,title:"Git Graph","aria-label":"Git Graph",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Jn,{size:13})}),e("button",{type:"button",onClick:()=>R(!C),title:"View Options","aria-label":"View Options","aria-expanded":C,className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(_e,{size:13})}),C&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-36 bg-paper border border-ink/15 rounded-md shadow-lg z-50 py-1 font-mono text-xs",children:[e("button",{type:"button",onClick:()=>{b("flat"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(Ye,{size:12,className:"text-ink/60"}),e("span",{children:"View as List"})]}),k==="flat"&&e(f,{size:12,className:"text-ink"})]}),e("button",{type:"button",onClick:()=>{b("tree"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(Ve,{size:12,className:"text-ink/60"}),e("span",{children:"View as Tree"})]}),k==="tree"&&e(f,{size:12,className:"text-ink"})]})]})]})]})}function Je({activeRepo:t,repos:l,isRefreshing:c,rootPath:r,reposScanning:m,onSelectRepo:g,onRefresh:x,onRefreshRepos:v}){return e(xt,{left:e(d,{children:[e(wm,{size:12,className:"text-ink/50 flex-shrink-0","aria-hidden":!0}),e(Tr,{rootPath:r,activeRepo:t,onSelectRepo:g,repos:l,scanning:m,onRefreshRepos:v})]}),right:e(nt,{label:"Refresh",onClick:x,busy:c})})}function Fe({change:t,isStaged:l,repo:c,rootPath:r,onAction:m}){let g=sr(t.status,l),{charStatus:x,colorClass:v}=g,N=t.file.split("/"),P=N.pop()||t.file,w=N.length>0?N.join("/"):"";return e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-ink/5 cursor-pointer group text-[11px] transition-colors",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:l,status:x,repo:c||".",root:r}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e("span",{className:`font-bold font-mono text-[10px] w-3 flex-shrink-0 text-center ${v}`,title:`Status: ${g.label}`,children:x}),e(mt,{name:P,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${v}`,title:t.file,children:P}),w&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:w})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:[!l&&e(d,{children:[e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),m("revert",t.file)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(vn,{size:11})}),e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),m("stage",t.file)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(F,{size:11})})]}),l&&e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),m("unstage",t.file)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(fn,{size:11})})]})})]})}function et({change:t,repo:l,rootPath:c,onResolve:r}){let[m,g]=n(!1),[x,v]=n(null),N=t.file.split("/"),P=N.pop()||t.file,w=N.length>0?N.join("/"):"",C=()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:!1,status:t.status,repo:l,root:c}}))},R=async()=>{let k=!m;if(g(k),k&&x===null){let b=new URLSearchParams({conflictMarkers:"1",file:t.file,repo:l||"."});if(c)b.set("root",c);try{let L=await(await fetch(`/api/fs/git?${b.toString()}`)).json();v(L.markers??{})}catch{v({})}}},G=x?.ours||"ours",M=x?.theirs||"theirs";return e("div",{className:"border-b border-warning/20 last:border-b-0",children:[e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-warning/5 cursor-pointer group text-[11px] transition-colors",onClick:C,children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e(ao,{size:11,className:"text-warning flex-shrink-0"}),e(mt,{name:P,size:12,className:"flex-shrink-0"}),e("span",{className:"truncate text-warning",title:t.file,children:P}),w&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:w}),Mr(t.status)&&e("span",{className:"text-[10px] text-warning/70 font-mono flex-shrink-0",children:t.status})]}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),R()},title:m?"Hide resolve actions":"Show resolve actions","aria-label":m?"Hide resolve actions":"Show resolve actions","aria-expanded":m,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors flex-shrink-0",children:m?e(pt,{size:11}):e(E,{size:11})})]}),m&&e("div",{className:"px-3 pb-2 pt-0.5 flex flex-wrap items-center gap-1.5",children:[e("button",{type:"button",onClick:()=>r(t.file,"ours"),title:`Take ${G} — \`git checkout --ours\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",G]}),e("button",{type:"button",onClick:()=>r(t.file,"theirs"),title:`Take ${M} — \`git checkout --theirs\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",M]}),e("button",{type:"button",onClick:()=>r(t.file,""),title:"Mark resolved: the file was edited by hand, this stages it",className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer flex items-center gap-1",children:[e(f,{size:10}),"mark resolved"]})]})]})}function Wt(t){let l={id:"",name:"",path:"",type:"folder",children:[],changeCount:0};for(let r of t){let m=r.file.replace(/^[./]+/,""),g=m.endsWith("/"),x=m.replace(/\/$/,"").split("/").filter(Boolean),v=l,N="";for(let P=0;P<x.length;P++){let w=x[P];N=N?`${N}/${w}`:w;let C=P===x.length-1;if(C&&!g)v.children.push({id:N,name:w,path:N,type:"file",change:r,children:[],changeCount:1});else{let G=v.children.find((M)=>M.type==="folder"&&M.name===w);if(!G)G={id:N,name:w,path:N,type:"folder",children:[],changeCount:0,change:C&&g?r:void 0},v.children.push(G);v=G}}}function c(r){if(r.type==="file")return 1;let m=r.change?1:0;for(let g of r.children)m+=c(g);return r.changeCount=m,r.children.sort((g,x)=>{if(g.type==="folder"&&x.type==="file")return-1;if(g.type==="file"&&x.type==="folder")return 1;return g.name.localeCompare(x.name)}),m}return c(l),l.children}function tt(t){let{sessionId:l,ready:c,read:r}=_m(),m=u(()=>Wt(t),[t]),g=u(()=>{let R=new Set;function G(M){for(let k of M)if(k.type==="folder"){if(R.add(k.id),k.children&&k.children.length>0)G(k.children)}}return G(m),R},[m]),[x,v]=T("git.expandedFolders",[]),N=u(()=>new Set(x),[x]),P=i(null);o(()=>{if(!c||P.current===l)return;if(g.size===0)return;if(P.current=l,r("git.expandedFolders",[]).length>0)return;v(Array.from(g))},[c,l,g,r,v]);let w=a((R)=>{v((G)=>{let M=new Set(G);if(M.has(R))M.delete(R);else M.add(R);return Array.from(M)})},[v]),C=a((R)=>N.has(R),[N]);return{tree:m,expandedFolders:N,toggleFolder:w,isFolderOpen:C,expandAll:()=>v(Array.from(g)),collapseAll:()=>v([])}}function He({node:t,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:m,repo:g,rootPath:x}){let v=t.type==="folder",N=v?c(t.id):!1;if(v)return e("div",{className:"select-none",children:[e("div",{className:"flex items-center justify-between px-2 py-1 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>r(t.id),children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center text-ink/40 flex-shrink-0",children:N?e(E,{size:12}):e(ue,{size:12})}),e(mt,{name:t.name,isFolder:!0,isOpen:N,size:13,className:"flex-shrink-0"}),e("span",{className:"font-medium text-ink truncate",children:t.name}),e("span",{className:"text-[10px] text-ink/40 font-normal px-1 py-0.2 bg-ink/5 rounded-full ml-1",children:t.changeCount})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!l?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("revert",t.path)},title:`Discard changes in ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(vn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("stage",t.path)},title:`Stage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(F,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("unstage",t.path)},title:`Unstage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(fn,{size:11})})})})]}),N&&t.children&&t.children.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:t.children.map((k)=>e(He,{node:k,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:m,repo:g,rootPath:x},k.id))})]});let P=t.change,w=sr(P?.status||"M",l),{charStatus:C,colorClass:R}=w,G=P?P.file:t.path;return e("div",{className:"flex items-center justify-between px-2 py-0.5 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:G,staged:l,status:C,repo:g||".",root:x}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center flex-shrink-0",children:e("span",{className:`font-bold font-mono text-[10px] ${R}`,title:`Status: ${w.label}`,children:C})}),e(mt,{name:t.name,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${R}`,title:G,children:t.name})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!l?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("revert",G)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(vn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("stage",G)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(F,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("unstage",G)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(fn,{size:11})})})})]})}function ze({changes:t,isStaged:l,repo:c,rootPath:r,onAction:m}){let{tree:g,isFolderOpen:x,toggleFolder:v}=tt(t);if(g.length===0)return null;return e("div",{className:"py-0.5",children:g.map((N)=>e(He,{node:N,isStaged:l,isFolderOpen:x,toggleFolder:v,onAction:m,repo:c,rootPath:r},N.id))})}function ot({changes:t,isLoading:l,viewMode:c,repo:r,rootPath:m,onAction:g,onResolve:x}){let[v,N]=T("git.stagedExpanded",!0),[P,w]=T("git.unstagedExpanded",!0),[C,R]=T("git.conflictsExpanded",!0),G=t.filter((b)=>Mr(b.status)),M=t.filter((b)=>{if(Mr(b.status))return!1;let y=b.status;return y&&y[0]!==" "&&y[0]!=="?"}),k=t.filter((b)=>{if(Mr(b.status))return!1;let y=b.status;return y&&y[1]!==" "&&y[1]!=="?"||y==="??"});if(l&&t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"Loading..."})});if(t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"No changes found."})});return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"py-1",children:[G.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-warning/5 cursor-pointer transition-colors",onClick:()=>R(!C),children:e("div",{className:"flex items-center space-x-1 font-semibold text-warning text-xs",children:[e("span",{className:"w-3 text-center",children:C?"▾":"▸"}),e("span",{children:"Conflicts"}),e("span",{className:"text-warning/70 font-normal ml-1 border border-warning/30 rounded-full px-1.5 text-[10px] bg-paper",children:G.length})]})}),C&&G.map((b)=>e(et,{change:b,repo:r,rootPath:m,onResolve:x??(()=>{})},`conflict-${b.file}`))]}),M.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>N(!v),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:v?"▾":"▸"}),e("span",{children:"Staged Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:M.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("button",{type:"button",onClick:(b)=>{b.stopPropagation(),g("unstage_all")},title:"Unstage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(fn,{size:12})})})]}),v&&(c==="tree"?e(ze,{changes:M,isStaged:!0,repo:r,rootPath:m,onAction:g}):M.map((b)=>e(Fe,{change:b,isStaged:!0,repo:r,rootPath:m,onAction:g},b.file+"staged")))]}),k.length>0&&e("div",{children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>w(!P),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:P?"▾":"▸"}),e("span",{children:"Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:k.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:[e("button",{type:"button",onClick:(b)=>{b.stopPropagation(),g("revert_all")},title:"Discard All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(vn,{size:12})}),e("button",{type:"button",onClick:(b)=>{b.stopPropagation(),g("stage_all")},title:"Stage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(F,{size:12})})]})]}),P&&(c==="tree"?e(ze,{changes:k,isStaged:!1,repo:r,rootPath:m,onAction:g}):k.map((b)=>e(Fe,{change:b,isStaged:!1,repo:r,rootPath:m,onAction:g},b.file+"unstaged")))]})]})})}function st({matches:t,loaded:l,total:c,hasMore:r,isFiltering:m}){if(m)return`${t} of ${l} loaded`;if(typeof c==="number"&&c>0)return r||l<c?`${l} of ${c}`:`${c} commits`;return r?`${l}+ commits`:`${l} commits`}function rt({isGraphMode:t,onToggleMode:l,searchQuery:c,onSearchChange:r,onRefresh:m,onClose:g,isRefreshing:x,totalCommits:v,loadedCount:N,totalCount:P,hasMore:w}){let C=st({matches:v,loaded:N,total:P,hasMore:w,isFiltering:c.trim().length>0});return e("div",{className:`flex flex-col gap-2 px-3 lg:px-5 py-3 border-b border-ink/10 bg-paper select-none
2
- pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:[e("div",{className:"flex items-center justify-between gap-2 lg:gap-4",children:[e("div",{className:"flex flex-col min-w-0",children:[e("div",{className:"flex items-center gap-2.5 min-w-0",children:[e("h2",{className:"text-base font-semibold text-ink tracking-tight",children:t?"Graph":"History"}),e("span",{className:"text-[11px] font-mono px-2 py-0.5 rounded-full bg-ink/5 text-ink/80 border border-ink/10 whitespace-nowrap",children:C})]}),e("p",{className:"text-xs text-muted mt-0.5 hidden lg:block",children:t?"Follow branch topology and inspect commits.":"Browse recent commits and inspect changed files."})]}),e("div",{className:"flex items-center gap-1.5 lg:gap-2 flex-shrink-0",children:[e("div",{className:"flex items-center text-xs lg:bg-ink/5 lg:p-0.5 lg:rounded-lg lg:border lg:border-ink/10",children:[e("button",{type:"button",onClick:()=>l(!1),title:"History view","aria-label":"History view","aria-pressed":!t,className:`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${!t?"bg-ink/5 text-ink lg:bg-paper lg:shadow-xs":"text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5"}`,children:[e(Kn,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"History"})]}),e("button",{type:"button",onClick:()=>l(!0),title:"Graph view","aria-label":"Graph view","aria-pressed":t,className:`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${t?"bg-ink/5 text-ink lg:bg-paper lg:shadow-xs":"text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5"}`,children:[e(Jn,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Graph"})]})]}),e("button",{type:"button",onClick:m,disabled:x,className:"tap-target flex items-center justify-center gap-1.5 p-2 rounded-md text-ink/70 transition-colors cursor-pointer text-xs disabled:opacity-40 lg:px-2.5 lg:py-1.5 lg:border lg:border-ink/15 lg:hover:bg-ink/5 lg:hover:text-ink",title:"Refresh commit history","aria-label":"Refresh commit history",children:[e(Ra,{size:13,className:x?"animate-spin text-ink":"","aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Refresh"})]}),e("button",{type:"button",onClick:g,className:"tap-target p-2 -mr-1 rounded-md hover:bg-ink/5 text-muted hover:text-ink transition-colors cursor-pointer",title:"Close modal","aria-label":"Close commit history",children:e(h,{size:16,"aria-hidden":"true"})})]})]}),e("div",{className:"relative mt-1",children:[e(U,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-ink/55","aria-hidden":"true"}),e("input",{type:"text",value:c,onChange:(R)=>r(R.currentTarget.value),placeholder:"Filter commits by message, author, or hash...","aria-label":"Filter commits",className:"w-full bg-ink/[0.03] border border-ink/15 rounded-md pl-8 pr-3 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),c&&e("button",{type:"button",onClick:()=>r(""),"aria-label":"Clear filter",className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-ink/55 hover:text-ink cursor-pointer",children:e(h,{size:12,"aria-hidden":"true"})})]})]})}var le=["#38bdf8","#f97316","#a855f7","#10b981","#ec4899","#eab308","#06b6d4","#6366f1"];function Oe(t,l){if(!t||!l)return!1;if(t===l)return!0;let c=Math.min(t.length,l.length);if(c>=4)return t.substring(0,c)===l.substring(0,c);return!1}function Ge(t){let l=new Map,c=[];for(let r of t){if(typeof r.lane==="number"){l.set(r.hash,r.lane);continue}let m=c.findIndex((x)=>Oe(x,r.hash)||Oe(x,r.shortHash));if(m===-1)if(m=c.indexOf(null),m===-1)m=c.length,c.push(r.hash);else c[m]=r.hash;l.set(r.hash,m);let g=r.parents&&r.parents[0];if(g)c[m]=g;else c[m]=null;if(r.parents&&r.parents.length>1)for(let x=1;x<r.parents.length;x++){let v=r.parents[x];if(!c.some((P)=>Oe(P,v))){let P=c.indexOf(null);if(P===-1)c.push(v);else c[P]=v}}}return l}function it(t,l,c,r){let m=[],g=new Map;t.forEach((x,v)=>{if(g.set(x.hash,v),x.shortHash)g.set(x.shortHash,v);if(x.hash.length>=7)g.set(x.hash.substring(0,7),v)});for(let x of t){let v=l.get(x.hash)??0,N=c[x.hash]??0,P=le[v%le.length];if(!x.parents||x.parents.length===0)continue;for(let w of x.parents){let C=g.get(w);if(typeof C!=="number"&&w.length>=7)C=g.get(w.substring(0,7));if(typeof C==="number"){let R=t[C],G=l.get(R.hash)??v,M=c[R.hash]??N+60;m.push({fromHash:x.hash,toHash:R.hash,fromLane:v,toLane:G,fromY:N,toY:M,color:le[v%le.length]})}else m.push({fromHash:x.hash,toHash:"tail-"+x.hash,fromLane:v,toLane:v,fromY:N,toY:Math.max(N+80,r),color:P})}}return m}function at(t,l,c,r){if(Math.abs(t-c)<1)return`M ${t} ${l} L ${c} ${r}`;let m=r-l,g=l+m*0.45,x=r-m*0.45;return`M ${t} ${l} C ${t} ${g}, ${c} ${x}, ${c} ${r}`}function lt({commits:t,nodePositions:l,expandedHash:c,hoveredHash:r,isGraphMode:m,laneWidth:g=18,paddingLeft:x=16,totalHeight:v}){let N=u(()=>{if(!m){let R=new Map;return t.forEach((G)=>R.set(G.hash,0)),R}return Ge(t)},[t,m]),P=u(()=>{let R=0;return N.forEach((G)=>{if(G>R)R=G}),R},[N]),w=m?(P+1)*g+x*2:36,C=u(()=>{if(!m){let R=[];for(let G=0;G<t.length-1;G++){let M=l[t[G].hash]??G*60+20,k=l[t[G+1].hash]??(G+1)*60+20;R.push({fromHash:t[G].hash,toHash:t[G+1].hash,fromLane:0,toLane:0,fromY:M,toY:k,color:"var(--theme-ink)"})}return R}return it(t,N,l,v)},[t,N,l,v,m]);return e("div",{className:"absolute top-0 left-0 pointer-events-none z-10",style:{width:w,height:v},"aria-hidden":"true",children:e("svg",{className:"w-full h-full overflow-visible",style:{width:w,height:v},children:[C.map((R)=>{let G=m?x+R.fromLane*g:16,M=m?x+R.toLane*g:16,k=m?R.color:"currentColor",b=m?0.95:0.25,y=at(G,R.fromY,M,R.toY);return e("path",{d:y,fill:"none",stroke:k,strokeWidth:m?2.25:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:b},`${R.fromHash}->${R.toHash}`)}),t.map((R)=>{let G=N.get(R.hash)??0,M=m?x+G*g:16,k=l[R.hash]??20,b=c===R.hash||c===R.shortHash,y=r===R.hash||r===R.shortHash,L=m?le[G%le.length]:"var(--theme-success)";return e("g",{"data-commit-node":R.hash,children:[(b||y)&&e("circle",{cx:M,cy:k,r:8,fill:L,fillOpacity:b?0.35:0.2,stroke:L,strokeWidth:1}),e("circle",{"data-commit-dot":"",cx:M,cy:k,r:m?4:4.5,fill:m?"var(--theme-paper)":L,stroke:L,strokeWidth:m?2.5:1.5}),m&&e("circle",{cx:M,cy:k,r:1.8,fill:L})]},`node-${R.hash}`)})]})})}var qt=[{action:"checkout",label:"checkout"},{action:"create_branch_here",label:"create branch here"},{action:"cherry_pick",label:"cherry-pick"},{action:"revert",label:"revert"},{action:"reset",label:"reset..."},{action:"merge",label:"merge into current"},{action:"rebase",label:"rebase onto this"}];function ct({commit:t,onAction:l}){return e("div",{className:"flex flex-wrap items-center gap-1.5 pt-1.5 pb-2",children:qt.map(({action:c,label:r})=>e("button",{type:"button",onClick:(m)=>{m.stopPropagation(),l(c,t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer",children:r},c))})}var Se=3;function Kt(t){let l=[];for(let c=0;c<t.length;c+=1){if(t[c].type!=="context"){l.push({row:t[c],index:c});continue}let r=c;while(r<t.length&&t[r].type==="context")r+=1;let m=r-c;if(m>Se*2+1){for(let g=c;g<c+Se;g+=1)l.push({row:t[g],index:g});l.push({row:{type:"elided",count:m-Se*2},index:-1});for(let g=r-Se;g<r;g+=1)l.push({row:t[g],index:g})}else for(let g=c;g<r;g+=1)l.push({row:t[g],index:g});c=r-1}return l}function ut({diffText:t,isLoading:l,filePath:c,fullContext:r=!1,onToggleContext:m}){let g=Ei(),x=u(()=>{if(!t)return[];let w=[],C=1,R=1,G=t.split(/\r?\n/),k=G.some((b)=>b.startsWith("@@"))?G:[`@@ -0,0 +1,${G.length} @@`,...G.map((b)=>b.startsWith("+")||b.startsWith("-")?b:`+${b}`)];for(let b of k){if(b.startsWith("diff --git")||b.startsWith("index ")||b.startsWith("---")||b.startsWith("+++")||b.startsWith("new file mode")||b.startsWith("deleted file mode")||b.startsWith("similarity index")||b.startsWith("old mode")||b.startsWith("new mode")||b.startsWith("\\ No newline"))continue;if(b.startsWith("@@")){let y=b.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(y)C=parseInt(y[1],10),R=parseInt(y[2],10);w.push({type:"meta",text:b})}else if(b.startsWith("+"))w.push({type:"add",text:b.slice(1),newNum:R++});else if(b.startsWith("-"))w.push({type:"del",text:b.slice(1),oldNum:C++});else{let y=b.startsWith(" ")?b.slice(1):b;w.push({type:"context",text:y,oldNum:C++,newNum:R++})}}return w},[t]),v=gt(c),N=u(()=>{let w=Array(x.length).fill(""),C=-1,R=(G)=>{if(C<0)return;let M=_d(x.slice(C,G).map((k)=>k.text).join(`
3
- `),v);for(let k=C;k<G;k++)w[k]=M[k-C]??"";C=-1};return x.forEach((G,M)=>{if(G.type==="meta")R(M);else if(C<0)C=M}),R(x.length),w},[x,v,g]),P=u(()=>r?x.map((w,C)=>({row:w,index:C})):Kt(x),[x,r]);if(l)return e("div",{className:"my-2 p-4 rounded bg-canvas border border-ink/10 text-muted font-mono text-xs flex items-center justify-center",children:"Loading commit diff..."});if(!t||x.length===0)return e("div",{className:"my-2 p-3 rounded bg-canvas border border-ink/10 text-muted font-mono text-xs text-center",children:"No diff content available for this file."});return e("div",{className:"my-2 rounded border border-ink/15 bg-paper overflow-hidden text-[11px] font-mono leading-relaxed text-ink",children:[e("div",{className:"flex items-center justify-between px-3 py-1.5 bg-canvas border-b border-ink/10 text-ink/70 text-[10.5px]",children:[e("span",{className:"font-semibold text-muted",children:"Diff preview"}),e("button",{type:"button",onClick:m,disabled:!m,className:"hover:text-ink flex items-center gap-1 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-default",title:r?"Show only the changed hunks":"Read the whole file around the change","aria-pressed":r,children:r?e(d,{children:[e(pt,{size:12,"aria-hidden":"true"})," Collapse context"]}):e(d,{children:[e(E,{size:12,"aria-hidden":"true"})," Expand all context"]})})]}),e("div",{className:"overflow-x-auto max-h-72 select-text",children:e("div",{className:"w-max min-w-full divide-y divide-ink/[0.04]",children:P.map(({row:w,index:C},R)=>{if(w.type==="elided")return e("div",{className:"px-3 py-1 bg-canvas text-muted text-[10px] text-center select-none",title:`${w.count} unchanged line(s) hidden`,children:["⋯ ",w.count," unchanged line",w.count===1?"":"s"," hidden ⋯"]},`elided-${R}`);let G=w,M=C;if(G.type==="meta")return e("div",{className:"flex items-center gap-2 px-3 py-1 bg-canvas border-y border-ink/10 text-muted text-[10px] font-semibold",children:[e("span",{children:"↕"}),e("span",{children:G.text})]},M);let k=G.type==="add",b=G.type==="del";return e("div",{className:`flex items-start font-mono ${k?"bg-success/10 hover:bg-success/15":b?"bg-error/10 hover:bg-error/15":"text-ink hover:bg-ink/[0.02]"}`,children:[e("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${b?"bg-error/15 text-ink/80 font-semibold":k?"bg-success/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:G.oldNum??(k?"+":"")}),e("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${k?"bg-success/15 text-ink/80 font-semibold":b?"bg-error/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:G.newNum??(b?"-":"")}),e("div",{className:`w-4 flex-shrink-0 text-center py-0.5 select-none font-bold ${k||b?"text-ink/80":"opacity-0"}`,children:k?"+":b?"-":" "}),e("div",{className:"flex-1 py-0.5 pr-3 whitespace-pre text-ink",children:G.text?e("span",{className:"shiki",dangerouslySetInnerHTML:{__html:N[M]}}):" "})]},M)})})})]})}function ht({commit:t,isExpanded:l,onToggleExpand:c,onAction:r,onToggleFile:m,isExpandedFile:g,isLoadingFile:x,isFullContextFile:v,onToggleContext:N,fileDiffs:P,headerRef:w}){let[C,R]=n(!1),G=t.body?.trim()??"",M=G.length>0,k=t.files??[],b=k.length,y=b>0,L=M||y,B=(A)=>{A.stopPropagation(),navigator.clipboard.writeText(t.hash),R(!0),setTimeout(()=>R(!1),2000)},z=(A,V)=>{A.stopPropagation(),m(t.hash,V)},q=L?"border-b border-ink/5 transition-colors cursor-pointer hover:bg-ink/[0.015]":"border-b border-ink/5";return e("div",{onClick:L?c:void 0,"data-testid":"commit-row","data-commit-hash":t.hash,className:q,children:e("div",{className:"py-2.5 flex flex-col",children:[e("div",{className:"flex flex-col gap-1",children:[t.refs&&t.refs.length>0&&e("div",{className:"flex flex-wrap items-center gap-1.5 pb-0.5",children:t.refs.map((A,V)=>{let Y=A.includes("stash"),_=A.includes("HEAD")||A.includes("main")||A.includes("master");return e("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono border ${Y?"bg-warning/10 text-ink/80 border-warning/25 font-semibold":_?"bg-ink/10 text-ink font-semibold border-ink/20":"bg-canvas text-muted border-ink/10 font-medium"}`,children:A},V)})}),e("div",{ref:w,className:"flex items-start gap-1.5",children:e("button",{type:"button",onClick:L?(A)=>{A.stopPropagation(),c()}:void 0,"aria-expanded":L?l:void 0,className:"flex flex-1 min-w-0 items-start gap-1.5 text-left cursor-pointer rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink/20",children:[e("span",{"data-commit-title":"",className:"text-[13px] font-semibold text-ink leading-snug break-words flex-1 min-w-0",children:t.message}),L&&e("span",{className:"text-ink/55 flex-shrink-0 mt-0.5","aria-hidden":"true",children:l?e(E,{size:13}):e(ue,{size:13})})]})}),M&&l&&e("div",{className:"border-l-2 border-ink/15 pl-3 py-1",children:e(J,{content:G,className:"text-ink/70"})}),e("div",{className:"flex items-center gap-x-2 gap-y-0.5 text-[11px] text-muted font-mono flex-wrap",children:[e("span",{children:t.author}),e("span",{children:t.date}),e("button",{type:"button",onClick:B,title:"Copy commit hash","aria-label":`Copy commit hash ${t.shortHash}`,className:"inline-flex items-center gap-1 hover:text-ink transition-colors cursor-pointer text-ink/70",children:[e("span",{children:t.shortHash}),C?e(f,{size:11,className:"text-success-text","aria-hidden":"true"}):e(ae,{size:11,"aria-hidden":"true"})]}),y&&e("span",{children:[b," ",b===1?"file":"files"]})]})]}),l&&e("div",{className:"mt-2",children:e(ct,{commit:t,onAction:r})}),y&&l&&e("div",{className:"mt-2 flex flex-col gap-1",children:k.map((A,V)=>{let Y=g(t.hash,A.file),_=`${t.hash}:${A.file}`,H=P[_]!==void 0?P[_]:A.diff,O=x(t.hash,A.file),D=A.status==="A"?"text-success-text font-bold":A.status==="D"?"text-error-text font-bold":A.status==="R"?"text-meta-text font-bold":"text-info-text font-bold";return e("div",{className:"flex flex-col",children:[e("button",{type:"button",onClick:(oe)=>z(oe,A),"aria-expanded":Y,className:"flex w-full items-center gap-2 py-1 px-2 rounded text-[11.5px] font-mono text-ink/80 transition-colors group cursor-pointer border border-transparent hover:border-ink/10 text-left",children:[e("span",{className:`w-3.5 text-center flex-shrink-0 text-[11px] ${D}`,children:A.status||"M"}),e("span",{className:"truncate flex-1 min-w-0 text-ink/90 group-hover:text-ink font-medium",children:A.file}),e("span",{className:"flex items-center gap-1 text-[10.5px] tabular-nums flex-shrink-0 font-medium",children:[e("span",{className:"text-success-text",children:["+",A.additions]}),e("span",{className:"text-ink/30",children:"/"}),e("span",{className:"text-error-text",children:["-",A.deletions]})]}),e("span",{className:"text-ink/55 group-hover:text-ink flex-shrink-0",children:Y?e(E,{size:13,"aria-hidden":"true"}):e(ue,{size:13,"aria-hidden":"true"})})]}),Y&&e("div",{className:"pl-4 pr-1",children:e(ut,{diffText:H,isLoading:O,filePath:A.file,fullContext:v(t.hash,A.file),onToggleContext:()=>N(t.hash,A)})})]},V)})})]})})}var xe=50;function Vt(t){if(!Array.isArray(t))return[];let l=[];for(let c of t){if(!c||typeof c!=="object")continue;let r=c;if(typeof r.file!=="string"||!r.file)continue;l.push({file:r.file,status:typeof r.status==="string"?r.status:"M",additions:typeof r.additions==="number"&&Number.isFinite(r.additions)?r.additions:0,deletions:typeof r.deletions==="number"&&Number.isFinite(r.deletions)?r.deletions:0,diff:typeof r.diff==="string"?r.diff:void 0})}return l}function Ie(t){if(!Array.isArray(t))return[];let l=[];for(let c of t){if(!c||typeof c!=="object")continue;let r=c,m=typeof r.hash==="string"&&r.hash?r.hash:"";if(!m)continue;l.push({hash:m,shortHash:typeof r.shortHash==="string"&&r.shortHash?r.shortHash:m.slice(0,8),author:typeof r.author==="string"?r.author:"Unknown",date:typeof r.date==="string"?r.date:typeof r.time==="string"?r.time:"",message:typeof r.message==="string"?r.message:"",body:typeof r.body==="string"?r.body:void 0,parents:Array.isArray(r.parents)?r.parents.filter((g)=>typeof g==="string"):[],refs:Array.isArray(r.refs)?r.refs.filter((g)=>typeof g==="string"):[],files:Vt(r.files),lane:typeof r.lane==="number"?r.lane:void 0})}return l}function bt({output:t,isGraphMode:l,rootPath:c,activeRepo:r}){let[m,g]=n(!1),[x,v]=n(t?.hasMore??t?.data?.length===xe),[N,P]=n(t?.total),w=u(()=>Ie(t?.data),[t?.data]),C=Array.isArray(t?.data)?t.data.length:0,[R,G]=n(w),[M,k]=n(C);o(()=>{if(G(w),k(C),v(t?.hasMore??C===xe),typeof t?.total==="number")P(t.total)},[w,C,t?.hasMore,t?.total]);let b=a(async()=>{if(m||!x)return;g(!0);try{let y=new FormData;if(y.set("actionType",l?"graph":"history"),y.set("limit",String(xe)),y.set("skip",String(M)),c)y.set("root",c);if(r)y.set("repo",r);let B=await(await fetch("/api/fs/git",{method:"POST",body:y})).json();if(B.success&&Array.isArray(B.data)){let z=Ie(B.data),q=B.data.length;if(G((A)=>{let V=new Set(A.map((_)=>_.hash)),Y=z.filter((_)=>!V.has(_.hash));return[...A,...Y]}),k((A)=>A+q),v(Boolean(B.hasMore??q===xe)),typeof B.total==="number")P(B.total)}else v(!1)}catch(y){console.error("Failed to load more commits:",y)}finally{g(!1)}},[m,x,l,M,c,r]);return{commits:R,hasMore:x,totalCount:N,isLoadingMore:m,handleLoadMore:b}}function vt({onExecuteAction:t,rootPath:l,activeRepo:c}){let[r,m]=n({}),[g,x]=n(new Set),[v,N]=n(new Set),[P,w]=n(new Set),C=a(async(k,b,y)=>{let L=`${k}:${b.file}`;N((B)=>new Set(B).add(L));try{let B=new FormData;if(B.set("actionType","commit_diff"),B.set("hash",k),B.set("file",b.file),y)B.set("full","1");if(l)B.set("root",l);if(c&&c!==".")B.set("repo",c);let q=await(await fetch("/api/fs/git",{method:"POST",body:B})).json();if(q&&typeof q.diff==="string")m((A)=>({...A,[L]:q.diff}));else if(q&&q.error)m((A)=>({...A,[L]:`// Error: ${q.error}`}))}catch(B){console.error("Failed to load file diff:",B);let z=B instanceof Error?B.message:"Network error";m((q)=>({...q,[L]:`// Error loading diff: ${z}`}))}finally{N((B)=>{let z=new Set(B);return z.delete(L),z})}},[l,c]),R=a(async(k,b)=>{let y=`${k}:${b.file}`,L=!g.has(y);if(x((B)=>{let z=new Set(B);if(z.has(y))z.delete(y);else z.add(y);return z}),L&&r[y]===void 0&&!b.diff)await C(k,b,!1)},[g,r,C]),G=a(async(k,b)=>{let y=`${k}:${b.file}`,L=!P.has(y);w((B)=>{let z=new Set(B);if(z.has(y))z.delete(y);else z.add(y);return z}),await C(k,b,L)},[P,C]),M=a((k,b)=>{if(!t)return;if(k==="checkout")t("checkout",void 0,{branch:b.hash});else if(k==="create_branch_here"){let y=window.prompt(`Create new branch at commit ${b.shortHash}:`,`branch-${b.shortHash}`);if(y?.trim())t("create_branch_at",void 0,{branch:y.trim(),hash:b.hash})}else if(k==="cherry_pick"){if(window.confirm(`Cherry-pick commit ${b.shortHash} onto current branch?`))t("cherry_pick",void 0,{hash:b.hash})}else if(k==="revert"){if(window.confirm(`Revert commit ${b.shortHash}?`))t("revert_commit",void 0,{hash:b.hash})}else if(k==="reset"){let y=window.prompt(`Reset current branch to ${b.shortHash} (soft, mixed, hard):`,"soft");if(y&&["soft","mixed","hard"].includes(y.toLowerCase()))t("reset_commit",void 0,{hash:b.hash,mode:y.toLowerCase()})}else if(k==="merge"){if(window.confirm(`Merge commit ${b.shortHash} into current branch?`))t("merge_commit",void 0,{hash:b.hash})}else if(k==="rebase"){if(window.confirm(`Rebase current branch onto commit ${b.shortHash}?`))t("rebase_commit",void 0,{hash:b.hash})}},[t]);return{fileDiffs:r,expandedFiles:g,loadingFiles:v,fullContextFiles:P,handleToggleFile:R,handleToggleContext:G,handleCommitAction:M}}function kt(t){let[l,c]=n({page:t,hash:""}),r=l.page===t?l.hash:"",m=a((g)=>{c((x)=>{let v=x.page===t&&x.hash===g;return{page:t,hash:v?"":g}})},[t]);return{expandedHash:r,toggleExpanded:m}}function je({output:t,onClose:l,onRefresh:c,onExecuteAction:r,rootPath:m,activeRepo:g}){if(o(()=>{if(!t)return;let j=(W)=>{if(W.key==="Escape")l()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[t,l]),!t)return null;let[x,v]=n(()=>({title:t.title,graph:t.title.toLowerCase().includes("graph")}));if(x.title!==t.title)v({title:t.title,graph:t.title.toLowerCase().includes("graph")});let N=x.graph,P=(j)=>v((W)=>({...W,graph:j})),[w,C]=n(""),{expandedHash:R,toggleExpanded:G}=kt(t),[M,k]=n(!1),{commits:b,hasMore:y,totalCount:L,isLoadingMore:B,handleLoadMore:z}=bt({output:t,isGraphMode:N,rootPath:m,activeRepo:g}),{fileDiffs:q,expandedFiles:A,loadingFiles:V,fullContextFiles:Y,handleToggleFile:_,handleToggleContext:H,handleCommitAction:O}=vt({onExecuteAction:r,rootPath:m,activeRepo:g}),D=u(()=>{if(!w.trim())return b;let j=w.toLowerCase().trim();return b.filter((W)=>W.message.toLowerCase().includes(j)||W.author.toLowerCase().includes(j)||W.shortHash.toLowerCase().includes(j)||W.hash.toLowerCase().includes(j)||W.refs?.some((ne)=>ne.toLowerCase().includes(j)))},[b,w]),oe=i(null),se=i(null),ve=i(null),me=i({}),[pe,ke]=n({}),[Pe,$e]=n(800);o(()=>{let j=ve.current;if(!j||!y||B||w.trim())return;let W=new IntersectionObserver((ne)=>{if(ne[0].isIntersecting)z()},{root:oe.current,threshold:0.1});return W.observe(j),()=>W.disconnect()},[y,B,w,z]);let re=a(()=>{if(!oe.current||!se.current)return;let j=oe.current.getBoundingClientRect(),W=oe.current.scrollTop,ne={};D.forEach((ge,Ee)=>{let we=me.current[ge.hash];if(we){let ce=we.getBoundingClientRect();ne[ge.hash]=ce.top+ce.height/2-j.top+W}else ne[ge.hash]=Ee*60+20}),ke(ne);let De=se.current.offsetHeight;$e(Math.max(De,oe.current.clientHeight,600))},[D]);K(()=>{re();let j=requestAnimationFrame(()=>{re()});return()=>cancelAnimationFrame(j)},[re,D,q,A,N,R]),o(()=>{let j=se.current;if(!j)return;let W=new ResizeObserver(()=>{re()});W.observe(j);for(let ne of Array.from(j.children))W.observe(ne);return()=>W.disconnect()},[re,D]);let ee=u(()=>Ge(D),[D]),Me=u(()=>{let j=0;return ee.forEach((W)=>{if(W>j)j=W}),j},[ee]),ye=18,Ce=16,Le=N?(Me+1)*ye+Ce*2:36,Ae=()=>{k(!0),c?.(),setTimeout(()=>k(!1),600)};return e("div",{className:"fixed inset-0 z-50 modal-scrim backdrop-blur-xs flex items-center justify-center p-0 lg:p-5",onClick:l,role:"dialog","aria-modal":"true","aria-label":t.title,children:e("div",{className:`glass-overlay bg-paper border-ink/20 shadow-2xl flex flex-col overflow-hidden
4
- w-full h-full rounded-none border-0
5
- lg:w-[min(94vw,1200px)] lg:h-[88vh] lg:rounded-xl lg:border
6
- pt-[env(safe-area-inset-top,0px)] lg:pt-0`,onClick:(j)=>j.stopPropagation(),children:[e(rt,{isGraphMode:N,onToggleMode:P,searchQuery:w,onSearchChange:C,onRefresh:Ae,onClose:l,isRefreshing:M,totalCommits:D.length,loadedCount:b.length,totalCount:L,hasMore:y}),e("div",{ref:oe,className:`flex-1 overflow-y-auto scrollbar-overlay-container relative select-text
7
- px-3 lg:px-5
8
- pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:D.length===0?e("div",{className:"flex flex-col items-center justify-center py-20 text-muted font-mono text-xs",children:w.trim()?"No matching commits found.":"No commits in this branch."}):e("div",{className:"relative min-h-full pb-8",children:[e(lt,{commits:D,nodePositions:pe,expandedHash:R,isGraphMode:N,laneWidth:ye,paddingLeft:Ce,totalHeight:Pe}),e("div",{ref:se,className:"flex flex-col relative z-20",style:{paddingLeft:`${Le}px`},children:[D.map((j)=>e(ht,{commit:j,isExpanded:R===j.hash,onToggleExpand:()=>G(j.hash),onAction:O,onToggleFile:_,isExpandedFile:(W,ne)=>A.has(`${W}:${ne}`),isLoadingFile:(W,ne)=>V.has(`${W}:${ne}`),isFullContextFile:(W,ne)=>Y.has(`${W}:${ne}`),onToggleContext:H,fileDiffs:q,headerRef:(W)=>{me.current[j.hash]=W}},j.hash)),e("div",{ref:ve,className:"pt-3 pb-4 px-4 flex items-center justify-center",children:B?e("div",{className:"flex items-center gap-2 text-xs text-muted font-mono py-2",children:[e(p,{size:14,className:"animate-spin text-info-text","aria-hidden":"true"}),e("span",{children:"Loading more commits..."})]}):y&&!w.trim()?e("button",{type:"button",onClick:z,className:"px-3 py-1.5 text-xs font-mono text-ink/70 hover:text-ink bg-ink/5 hover:bg-ink/10 rounded-md border border-ink/10 transition-colors cursor-pointer",children:"Load more commits..."}):D.length>10?e("div",{className:"text-[11px] font-mono text-muted py-2",children:["End of commit history (",typeof L==="number"&&L>0?L:b.length," commits)"]}):null})]})]})})]})})}function yt({children:t,onClose:l}){return e("div",{className:"fixed inset-0 z-50 modal-scrim flex items-center justify-center modal-safe",onClick:l,role:"dialog","aria-modal":"true",children:e("div",{className:"glass-overlay bg-paper border border-ink/20 rounded-lg shadow-xl flex flex-col overflow-hidden w-[min(94vw,420px)] max-h-[80vh]",onClick:(c)=>c.stopPropagation(),children:t})})}function Ct({modal:t,onClose:l,onConfirm:c}){if(!t)return null;return e(yt,{onClose:l,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(I,{size:16,className:"text-error flex-shrink-0"}),e("h3",{className:"text-sm font-semibold text-ink",children:"Confirm Action"})]}),e("div",{className:"px-4 py-4 text-xs text-ink/80 leading-relaxed",children:t.message}),e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:l,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:c,className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:"Confirm"})]})]})}function Nt({isOpen:t,branchName:l,inputRef:c,onChange:r,onClose:m,onCreate:g}){if(!t)return null;let x=a(()=>{if(l.trim())g()},[l,g]);return e(yt,{onClose:m,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(Jn,{size:16,className:"text-ink/60 flex-shrink-0"}),e("h3",{className:"text-sm font-semibold text-ink",children:"Create New Branch"})]}),e("div",{className:"px-4 py-4",children:e("input",{ref:c,type:"text",value:l,onChange:(v)=>r(v.currentTarget.value),onKeyDown:(v)=>{if(v.key==="Enter")x();if(v.key==="Escape")m()},placeholder:"branch-name",className:"w-full bg-canvas border border-ink/20 rounded px-3 py-2 text-xs focus:outline-none focus:border-ink/40 text-ink placeholder-ink/40 transition-colors"})}),e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:m,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:x,disabled:!l.trim(),className:"px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:"Create"})]})]})}function wt({branch:t,detached:l,onCheckout:c,onMerge:r,onRename:m,onDelete:g}){let x=t.current&&!l;return e("div",{className:"grid grid-cols-[1rem_minmax(0,1fr)_minmax(0,9.5rem)_4.25rem_4rem] items-start gap-x-2 px-4 py-2 border-b border-ink/5 last:border-b-0 hover:bg-ink/[0.02] group/row transition-colors",children:[e("div",{className:"h-5 flex items-center justify-center",children:x&&e(f,{size:12,className:"text-ink","aria-label":"Current branch"})}),e("button",{type:"button",onClick:c,disabled:x,title:x?"Already on this branch":`Check out ${t.name}`,className:"min-w-0 text-left cursor-pointer disabled:cursor-default",children:[e("div",{className:"h-5 flex items-center gap-1.5 min-w-0",children:[e(de,{size:11,className:x?"text-ink/60 flex-shrink-0":"text-ink/40 flex-shrink-0"}),e("span",{className:`truncate text-xs ${x?"font-semibold text-ink":"text-ink/90"}`,children:t.name})]}),t.subject&&e("div",{className:"h-4 flex items-center pl-[18px] min-w-0",children:e("span",{className:"truncate text-[10px] text-ink/40",title:t.subject,children:t.subject})})]}),e("div",{className:"h-5 flex items-center justify-end min-w-0",children:e(Yt,{branch:t})}),e("div",{className:"h-5 flex items-center justify-end",children:t.date&&e("span",{className:"text-[10px] text-ink/40 truncate",children:t.date})}),e("div",{className:"h-5 flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/row:opacity-100",children:[!x&&e("button",{type:"button",onClick:r,title:`Merge ${t.name} into the current branch`,"aria-label":`Merge ${t.name} into the current branch`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jn,{size:11})}),e("button",{type:"button",onClick:m,title:`Rename ${t.name}`,"aria-label":`Rename ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Zn,{size:11})}),!x&&e("button",{type:"button",onClick:g,title:`Delete ${t.name}`,"aria-label":`Delete ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(Q,{size:11})})]})]})}function Yt({branch:t}){if(t.gone)return e("span",{className:"text-[10px] font-mono text-warning border border-warning/30 rounded px-1 truncate",title:`${t.upstream} no longer exists on the remote — fetch --prune to drop it`,children:"gone"});if(!t.upstream)return e("span",{className:"text-[10px] font-mono text-ink/40 truncate",title:"No upstream: this branch has never been published",children:"unpublished"});return e("span",{className:"flex items-center gap-1 text-[10px] font-mono text-ink/50 min-w-0",children:[e("span",{className:"truncate",title:t.upstream,children:t.upstream}),(t.ahead>0||t.behind>0)&&e("span",{className:"tabular-nums text-ink/70 flex-shrink-0",children:[t.ahead>0&&`↑${t.ahead}`,t.behind>0&&`↓${t.behind}`]})]})}function Rt({branch:t,onClose:l,onSubmit:c}){if(!t)return null;return e(Xt,{branch:t,onClose:l,onSubmit:c})}function Xt({branch:t,onClose:l,onSubmit:c}){let[r,m]=n(t.name),[g,x]=n(!1),v=r.trim(),N=v===t.name,P=v.length>0&&!N,w=()=>{if(P)c(t.name,v,g)};return e(X,{onClose:l,maxWidthClass:"max-w-[min(94vw,460px)]",header:e("div",{className:"flex items-center gap-2",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Rename branch"}),e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:t.name})]}),children:[e("div",{className:"px-5 py-4 flex flex-col gap-3",children:[e("div",{children:[e("label",{className:"text-[10px] uppercase tracking-wider text-ink/50 font-semibold",htmlFor:"branch-rename-input",children:"New name"}),e("input",{id:"branch-rename-input",type:"text",value:r,autoFocus:!0,onChange:(C)=>m(C.currentTarget.value),onKeyDown:(C)=>{if(C.key==="Enter")w();if(C.key==="Escape")l()},className:"mt-1 w-full bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs font-mono text-ink focus:outline-none focus:border-ink/40 transition-colors"}),N&&v.length>0&&e("p",{className:"mt-1 text-[10px] text-ink/50",children:"The name is unchanged."})]}),e("div",{className:"text-[10px] font-mono text-ink/60 flex flex-col gap-0.5 border border-ink/10 rounded p-2 bg-canvas/40",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"upstream"}),e("span",{className:"truncate",children:t.upstream||"none (unpublished)"})]}),e("p",{className:"text-ink/40 leading-relaxed mt-0.5",children:"A local rename keeps this upstream unchanged — a plain push afterwards will refuse until the upstream matches the new name, which is what the remote option below does."})]}),e("label",{className:"flex items-start gap-2 text-[11px] text-ink/80 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:g,onChange:(C)=>x(C.currentTarget.checked),className:`${be} accent-ink cursor-pointer mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{children:"Also rename it on the remote"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:["git push -u ",t.upstream?t.upstream.split("/")[0]:"origin"," ",v||"<new>",e("br",{}),"git push ",t.upstream?t.upstream.split("/")[0]:"origin"," --delete ",t.name,e("br",{}),"git fetch --prune"]})]})]})]}),e("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:l,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:w,disabled:!P,className:"px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:"Rename"})]})]})}function Gt({branch:t,force:l,onForceChange:c,onClose:r,onConfirm:m}){if(!t)return null;return e(X,{onClose:r,maxWidthClass:"max-w-[min(94vw,440px)]",header:e("div",{className:"flex items-center gap-2",children:[e(I,{size:15,className:"text-error flex-shrink-0"}),e("h2",{className:"text-sm font-semibold text-ink",children:"Delete branch"})]}),children:[e("div",{className:"px-5 py-4 flex flex-col gap-3 text-xs text-ink/80 leading-relaxed",children:[e("p",{children:["Delete ",e("span",{className:"font-mono font-semibold text-ink",children:t.name}),t.upstream&&e(d,{children:[" ","(tracks ",e("span",{className:"font-mono",children:t.upstream}),")"]}),"?"]}),e("div",{className:"text-[10px] font-mono text-ink/60 border border-ink/10 rounded p-2 bg-canvas/40 flex flex-col gap-0.5",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"last commit"}),e("span",{className:"truncate",children:t.subject||"–"})]}),e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"when"}),e("span",{children:t.date||"–"})]})]}),e("label",{className:"flex items-start gap-2 cursor-pointer select-none text-[11px]",children:[e("input",{type:"checkbox",checked:l,onChange:(g)=>c(g.currentTarget.checked),className:`${be} accent-error cursor-pointer mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{className:"text-error font-medium",children:"Delete even if its commits are not merged"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:["git branch ",l?"-D":"-d"," ",t.name]}),e("span",{className:"text-ink/50",children:"Without this, git refuses when the branch holds commits no other branch has. Leaving it off is the safe default."})]})]})]}),e("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:r,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:()=>m(t.name),className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:["Delete ",l?"(force)":""]})]})]})}function St({isOpen:t,rootPath:l,repo:c,currentBranch:r,detached:m,isBusy:g,onClose:x,onAction:v,onConfirmDelete:N}){let[P,w]=n([]),[C,R]=n(!1),[G,M]=n(null),[k,b]=n(""),[y,L]=n(null),[B,z]=n(null),[q,A]=n(!1),V=a(async()=>{R(!0),M(null);let H=new URLSearchParams({branches:"1",repo:c||"."});if(l)H.set("root",l);try{let O=await fetch(`/api/fs/git?${H.toString()}`),D=await O.json();if(D.success&&Array.isArray(D.branches))w(D.branches);else M(D.error||`Failed to read branches (HTTP ${O.status})`)}catch(O){M(O instanceof Error?O.message:"Failed to read branches")}finally{R(!1)}},[l,c]);o(()=>{if(t)V()},[t,V]);let Y=i(!1);o(()=>{if(!t){Y.current=!1;return}if(Y.current&&!g)V();Y.current=g},[t,g,V]),o(()=>{if(!t)L(null),z(null),A(!1),b("")},[t]);let _=u(()=>{let H=k.trim().toLowerCase();if(!H)return P;return P.filter((O)=>O.name.toLowerCase().includes(H)||O.upstream.toLowerCase().includes(H))},[P,k]);if(!t)return null;return e(d,{children:[e(X,{onClose:x,maxWidthClass:"max-w-[min(96vw,720px)]",header:e("div",{className:"flex items-center gap-2 min-w-0",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Branches"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:m?`detached at ${r}`:`on ${r}`})]}),children:[e("div",{className:"px-5 py-3 flex items-center gap-2 border-b border-ink/10",children:[e(U,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:k,onChange:(H)=>b(H.currentTarget.value),placeholder:"Filter branches…","aria-label":"Filter branches",className:"flex-1 min-w-0 bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),e("button",{type:"button",onClick:()=>void V(),disabled:C,title:"Refresh","aria-label":"Refresh branches",className:"text-ink/40 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 flex-shrink-0",children:e(S,{size:12,className:C?"animate-spin":""})})]}),e("div",{className:"min-h-[40vh] max-h-[60vh] overflow-y-auto scrollbar-overlay-container",children:C&&P.length===0?e("div",{className:"flex items-center justify-center gap-2 py-12 text-xs text-ink/50 font-mono",children:[e(p,{size:14,className:"animate-spin text-info"}),"Loading branches…"]}):G?e("div",{className:"py-12 px-6 text-center text-xs text-error font-mono",children:G}):_.length===0?e("div",{className:"py-12 text-center text-xs text-ink/40 font-mono",children:k.trim()?"No matching branches.":"No branches."}):_.map((H)=>e(wt,{branch:H,detached:m,onCheckout:()=>{v("checkout",{branch:H.name}),x()},onMerge:()=>{v("merge_branch",{branch:H.name}),x()},onRename:()=>L(H),onDelete:()=>{z(H),A(!1)}},H.name))})]}),e(Rt,{branch:y,onClose:()=>L(null),onSubmit:(H,O,D)=>{v("rename_branch",{branch:H,newName:O,...D?{remote:"1"}:{}}),L(null)}},y?.name??"none"),e(Gt,{branch:B,force:q,onForceChange:A,onClose:()=>{z(null),A(!1)},onConfirm:(H)=>{N(H,q),z(null),A(!1)}})]})}function Pt({mounted:t,confirmModal:l,onCloseConfirm:c,onConfirm:r,branchPrompt:m,newBranchName:g,newBranchInputRef:x,onNewBranchNameChange:v,onCloseBranchPrompt:N,onCreateBranch:P,viewingOutput:w,onCloseOutput:C,onRefreshOutput:R,onExecuteAction:G,branchModalOpen:M,onCloseBranchModal:k,rootPath:b,activeRepo:y,currentBranch:L,detached:B,isBusy:z,onBranchAction:q,onConfirmDeleteBranch:A}){if(!t)return null;return e(d,{children:[e(Ct,{modal:l,onClose:c,onConfirm:r}),e(Nt,{isOpen:m,branchName:g,inputRef:x,onChange:v,onClose:N,onCreate:P}),e(je,{output:w,onClose:C,onRefresh:R,onExecuteAction:G,rootPath:b,activeRepo:y}),e(St,{isOpen:M,rootPath:b,repo:y,currentBranch:L,detached:B,isBusy:z,onClose:k,onAction:q,onConfirmDelete:A})]})}function $t({rootPath:t,repo:l,isBusy:c,onAction:r}){let[m,g]=T("git.stashExpanded",!1),[x,v]=n([]),[N,P]=n(!1),[w,C]=n(""),[R,G]=n(!1),M=Dr(),k=a(async()=>{P(!0);let y=new URLSearchParams({stashes:"1",repo:l||"."});if(t)y.set("root",t);try{let B=await(await fetch(`/api/fs/git?${y.toString()}`)).json();v(B.stashes??[])}catch{v([])}finally{P(!1)}},[t,l]);o(()=>{if(m)k()},[m,k,c]);let b=(y,L)=>{if(r(y,L),y==="stash_push")C(""),G(!1)};return e("div",{className:"border-t border-ink/10 bg-canvas/30 flex-shrink-0",children:[e("div",{className:"flex items-center hover:bg-ink/5 transition-colors",children:[e("button",{type:"button",onClick:()=>g(!m),"aria-expanded":m,"aria-controls":M,title:m?"Hide stashes":"Show stashes",className:"flex flex-1 min-w-0 items-center space-x-1 py-1.5 pl-3 pr-2 text-left font-semibold text-xs text-ink transition-colors cursor-pointer",children:[e("span",{className:"w-3 text-center font-mono","aria-hidden":"true",children:m?"▾":"▸"}),e(dt,{size:12}),e("span",{children:"Stash"}),x.length>0&&e("span",{className:"font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] text-ink/50",children:x.length})]}),e("button",{type:"button",onClick:()=>b("stash_push",{...w.trim()?{message:w.trim()}:{},...R?{untracked:"1"}:{}}),disabled:c,title:"Stash the working tree",className:"mr-3 flex flex-shrink-0 items-center gap-1 px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/70 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:[e(F,{size:10}),"Save"]})]}),e("div",{className:"section-reveal","data-expanded":m,id:M,inert:!m,children:e("div",{children:e("div",{className:"px-3 pb-2 flex flex-col gap-1.5",children:[e("div",{className:"flex items-center gap-1.5",children:[e("input",{type:"text",value:w,onChange:(y)=>C(y.currentTarget.value),placeholder:"Stash message (optional)","aria-label":"Stash message",className:"flex-1 min-w-0 bg-paper border border-ink/20 rounded px-2 py-1 text-[11px] text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),e("label",{className:"flex items-center gap-1 text-[10px] text-ink/60 cursor-pointer select-none flex-shrink-0",title:"Also stash untracked files (-u)",children:[e("input",{type:"checkbox",checked:R,onChange:(y)=>G(y.currentTarget.checked),className:`${be} accent-ink cursor-pointer`}),"-u"]})]}),N&&x.length===0?e("div",{className:"text-[10px] text-ink/40 italic py-1",children:"Loading…"}):x.length===0?e("div",{className:"text-[10px] text-ink/40 italic py-1",children:"No stash entries."}):e("div",{className:"max-h-40 overflow-y-auto scrollbar-overlay-container flex flex-col",children:x.map((y)=>e("div",{className:"grid grid-cols-[4rem_minmax(0,1fr)_3.5rem_4.5rem] items-center gap-x-1 group/stash py-0.5",children:[e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:y.ref}),e("span",{className:"min-w-0 truncate text-[10px] text-ink/80",title:y.subject,children:y.subject}),e("span",{className:"text-[10px] text-ink/40 text-right truncate",children:y.date}),e("div",{className:"flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/stash:opacity-100",children:[e("button",{type:"button",onClick:()=>b("stash_apply",{ref:y.ref,pop:"1"}),disabled:c,title:"Pop: apply and remove the entry","aria-label":"Pop stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-40",children:e(fe,{size:10})}),e("button",{type:"button",onClick:()=>b("stash_apply",{ref:y.ref}),disabled:c,title:"Apply: keep the entry","aria-label":"Apply stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-40",children:e(dt,{size:10})}),e("button",{type:"button",onClick:()=>b("stash_drop",{ref:y.ref}),disabled:c,title:"Drop: discard the entry (the stash is not recoverable from the panel)","aria-label":"Drop stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors disabled:opacity-40",children:e(Q,{size:10})})]})]},y.ref))})]})})})]})}function Mt({repo:t,isBusy:l,onInit:c}){let r=t==="."?"this folder":t;return e("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 text-center",children:[e(de,{size:26,className:"text-ink/25","aria-hidden":!0}),e("div",{className:"font-mono space-y-1",children:[e("p",{className:"text-xs text-ink/70",children:"Not a Git repository"}),e("p",{className:"text-[11px] leading-4 text-ink/40",children:["Initialize one in ",r," to track changes, commit and manage branches."]})]}),e("button",{type:"button",onClick:c,disabled:l,"aria-label":"Initialize Git repository",title:`git init in ${r}`,className:"flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(de,{size:12,"aria-hidden":!0}),"Initialize repository"]})]})}function Tt(t,l,c){let r=ft(),{pickedRepo:m,setActiveRepo:g,ready:x}=xr(t),{repos:v,scanning:N,rescan:P}=wr(t,l),w=Jg(m,v),C=i(w);C.current=w;let R=i("");R.current=`${t??""}\x00${w}`;let G=i(""),M=i(""),k=i(void 0);if(r.data!==k.current)k.current=r.data,M.current=G.current;let b=l&&x?Bm(`${t??""}\x00${w}`):null,y=Te(b),L=i(y.refresh);L.current=y.refresh;let B=M.current===R.current?r.data:void 0,z=y.data??B,q=z?.syncCount??B?.syncCount,A=a((_)=>{if(!l)return;let H=_??C.current,O=new URLSearchParams;if(t)O.set("root",t);if(H)O.set("repo",H);O.set("sync","1"),O.set("t",String(Date.now())),G.current=R.current;let D=L.current;r.load(`/api/fs/git?${O.toString()}`).then(()=>D())},[l,t,r.load]);o(()=>{if(!x)return;A()},[c,t,l,x,w,A]);let V=r.state==="loading",Y=V||y.refreshing;return{activeRepo:w,setActiveRepo:g,repos:v,reposScanning:N,refreshRepos:P,isReading:V,isRefreshing:Y,data:z,syncCount:q,loadRepo:A,refreshTopic:y.refresh}}function Lt(t,l){let c=ft(),r=i(null),m=a((g,x,v)=>{r.current={actionType:g,extra:v};let N=new FormData;if(N.append("actionType",g),N.append("repo",l),t)N.append("root",t);if(x)N.append("file",x);if(v)Object.entries(v).forEach(([P,w])=>N.append(P,w));c.submit(N,{method:"POST",action:"/api/fs/git"})},[l,t,c]);return{state:c.state,execute:m,data:c.data,lastAction:r.current}}function At({rootPath:t,repo:l,execute:c}){let{sessionId:r}=_m(),[m,g]=T("git.commitDraft",""),[x,v]=T("git.amend",!1),[N,P]=n(!1),[w,C]=n(null),[R,G]=n(!1),M=i(!1),k=i(null),b=i(m);b.current=m;let y=i(x);y.current=x;let L=i(g);L.current=g;let B=a((_)=>{g(_),G(!1)},[g]),z=a(()=>{if(M.current)return;M.current=!0,P(!0),C(null);let _={...t?{root:t}:{},repo:l,...r?{sessionId:r}:{},...y.current?{amend:!0}:{}};fetch("/api/fs/git-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)}).then(async(H)=>{let O=await H.json().catch(()=>null);if(!H.ok||typeof O?.message!=="string"||!O.message.trim())throw Error(typeof O?.error==="string"?O.error:`Request failed (HTTP ${H.status})`);let D=O.message.trim();if(b.current.trim().length===0)L.current(D),G(!0);else C(D)}).catch((H)=>{wl(H instanceof Error?H.message:String(H),"error")}).finally(()=>{M.current=!1,P(!1)})},[t,l,r]),q=a(()=>{if(w===null)return;g(w),G(!0),C(null)},[w,g]),A=a(()=>C(null),[]);o(()=>{if(!x)return;if(b.current.trim().length>0)return;let _=new URLSearchParams({headMessage:"1"});if(t)_.set("root",t);if(l)_.set("repo",l);let H=!1;return fetch(`/api/fs/git?${_.toString()}`).then((O)=>O.json()).then((O)=>{if(H)return;if(!y.current||b.current.trim().length>0)return;let D=typeof O?.message==="string"?O.message:"";if(D.length===0)return;k.current=D,L.current(D)}).catch(()=>{}),()=>{H=!0}},[x,r,t,l]);let V=a((_)=>{if(_){v(!0);return}if(k.current!==null&&b.current===k.current)g("");k.current=null,v(!1)},[v,g]),Y=a(()=>{c("commit",void 0,{message:b.current,...y.current?{amend:"1"}:{}}),g(""),v(!1),k.current=null,C(null),G(!1)},[c,v,g]);return{message:m,setMessage:B,amend:x,seeded:k.current!==null&&m===k.current,toggleAmend:V,commit:Y,isGenerating:N,suggestion:w,generated:R,generate:z,useSuggestion:q,dismissSuggestion:A}}var Dt=48;function Qt(t,l){let c=l?.branch?.trim()??"",r=(l?.hash??"").slice(0,7),m=l?.ref?.trim()||"stash@{0}";switch(t){case"init":return{done:"Initialized the repository"};case"fetch":return{done:"Fetched every remote"};case"push":return{done:"Pushed to upstream"};case"pull":return{done:"Pulled from upstream",stopped:"Pulled"};case"sync":return{done:"Synced with upstream",stopped:"Pulled, but nothing was pushed"};case"abort_operation":return{done:"Aborted the operation in progress"};case"continue_operation":return{done:"Concluded the operation"};case"commit":{if(l?.amend==="1")return{done:"Amended the last commit"};let g=(l?.message??"").split(`
9
- `)[0].trim();if(!g)return{done:"Commit created"};return{done:`Committed “${g.length>Dt?`${g.slice(0,Dt-1)}…`:g}”`}}case"checkout":return{done:c?`Switched to ${c}`:"Switched branch"};case"create_branch":case"create_branch_at":return{done:c?`Created branch ${c}`:"Created branch"};case"rename_branch":{let g=l?.newName?.trim()??"";return{done:c&&g?`Renamed ${c} to ${g}`:"Renamed branch"}}case"delete_branch":return{done:c?`Deleted branch ${c}`:"Deleted branch"};case"merge_branch":return{done:c?`Merged ${c}`:"Merged branch",stopped:c?`Merging ${c}`:"Merging the branch"};case"merge_commit":return{done:r?`Merged commit ${r}`:"Merged commit",stopped:r?`Merging ${r}`:"Merging the commit"};case"cherry_pick":return{done:r?`Cherry-picked ${r}`:"Cherry-picked commit",stopped:r?`Cherry-picking ${r}`:"Cherry-picking the commit"};case"revert_commit":return{done:r?`Reverted commit ${r}`:"Reverted commit",stopped:r?`Reverting ${r}`:"Reverting the commit"};case"rebase_commit":return{done:r?`Rebased onto ${r}`:"Rebased",stopped:r?`Rebasing onto ${r}`:"Rebasing"};case"reset_commit":{let g=l?.mode??"mixed";return{done:r?`Reset to ${r} (${g})`:`Reset (${g})`}}case"stash_push":return{done:"Stashed your changes"};case"stash_apply":return{done:l?.pop==="1"?`Popped ${m}`:`Applied ${m}`,stopped:l?.pop==="1"?`Popping ${m}`:`Applying ${m}`};case"stash_drop":return{done:`Dropped ${m}`};default:return null}}function Et({actionType:t,extra:l,stopped:c}){let r=Qt(t,l);if(!c)return r?.done??null;let m=Lo[c]??c,g=r?.stopped??r?.done??"",x=t==="sync"?"resolve it above, then Sync again":"resolve it above";return g?`${g} — the ${m} stopped on a conflict; ${x}`:`The ${m} stopped on a conflict; ${x}`}function Bt(t){let{fetcher:l,onPage:c,onReload:r,onSuccess:m,onError:g}=t,x=i(null),v=i({onPage:c,onReload:r,onSuccess:m,onError:g});v.current={onPage:c,onReload:r,onSuccess:m,onError:g},o(()=>{if(l.state!=="idle"||!l.data)return;let N=l.data;if(N===x.current)return;x.current=N;let P=v.current;if(N.type==="history"||N.type==="graph"){P.onPage({title:N.type==="graph"?"Git Graph":"Commit History",data:N.data||[],hasMore:N.hasMore,total:N.total});return}if(!N.success){P.onError(N.error||"Git operation failed");return}P.onReload();let w=l.lastAction,C=w?Et({...w,stopped:N.stopped}):null;if(C)P.onSuccess(C,N.stopped?"warning":"success")},[l.state,l.data,l.lastAction])}function Ft(t,l,c,r){if(t==="revert")return{type:t,file:l,message:`Are you sure you want to discard changes in ${l}?`};if(t==="revert_all")return{type:t,message:"Are you sure you want to discard ALL unstaged changes? This cannot be undone."};if(t==="abort_operation"){let m=r?Lo[r]:"operation";return{type:t,message:`Abort the ${m}? Everything resolved so far is discarded and the working tree returns to its pre-${m} state.`}}if(t==="delete_branch"){let m=c?.branch??"",g=c?.force==="1";return{type:t,extra:{branch:m,...g?{force:"1"}:{}},message:g?`Delete branch ${m} even though its commits are not merged? This cannot be undone from the panel.`:`Delete branch ${m}?`}}if(t==="stash_drop"){let m=c?.ref||"the top entry";return{type:t,extra:{ref:c?.ref??""},message:`Drop ${m}? The stash entry is removed — this cannot be undone from the panel.`}}return null}function Lr({className:t="",enabled:l=!0,rootPath:c,refreshKey:r=0}){let{activeRepo:m,setActiveRepo:g,repos:x,reposScanning:v,refreshRepos:N,isReading:P,isRefreshing:w,data:C,syncCount:R,loadRepo:G,refreshTopic:M}=Tt(c,l,r),k=Lt(c,m),[b,y]=T("git.viewMode","flat"),[L,B]=n(!1),z=i(null),[q,A]=n(!1),V=i(null),[Y,_]=n(null),[H,O]=n(!1),[D,oe]=n(""),se=i(null),[ve,me]=n(!1),[pe,ke]=n(null),[Pe,$e]=n(!1),{pushToast:re}=We();o(()=>{$e(!0)},[]),o(()=>{if(H&&se.current)se.current.focus()},[H]),Bt({fetcher:k,onPage:ke,onReload:G,onSuccess:(Z,te)=>re(Z,te),onError:(Z)=>re(Z,"error")}),he(z,()=>B(!1)),he(V,()=>A(!1));let ee=k.execute,{message:Me,setMessage:ye,amend:Ce,seeded:Le,toggleAmend:Ae,commit:j,isGenerating:W,suggestion:ne,generated:De,generate:ge,useSuggestion:Ee,dismissSuggestion:we}=At({rootPath:c,repo:m,execute:ee}),ce=(Z,te,Re)=>{let Ke=Ft(Z,te,Re,C?.state?.operation??null);if(Ke){_(Ke);return}ee(Z,te,Re)},Ht=(Z,te)=>{ee("resolve_conflict",Z,te?{side:te}:void 0)},Ue=C?.branch||"main",zt=C?.branches||["main"],Ot=C?.remoteBranches||[],qe=C?.changes||[],ie=P||k.state!=="idle",Be=k.state==="idle"?null:k.lastAction?.actionType??null,It=Be==="sync"||Be==="push"||Be==="pull",_t=qe.filter((Z)=>{if(Mr(Z.status))return!1;let te=Z.status;return te&&te[0]!==" "&&te[0]!=="?"});if(!l)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${t}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e("div",{className:`flex flex-col h-full bg-paper relative ${t}`,children:[e(Pt,{mounted:Pe,confirmModal:Y,onCloseConfirm:()=>_(null),onConfirm:()=>{if(Y)ee(Y.type,Y.file,Y.extra),_(null)},branchPrompt:H,newBranchName:D,newBranchInputRef:se,onNewBranchNameChange:oe,onCloseBranchPrompt:()=>{O(!1),oe("")},onCreateBranch:()=>{if(D.trim())ee("create_branch",void 0,{branch:D.trim()}),O(!1),oe("")},viewingOutput:pe,onCloseOutput:()=>ke(null),onRefreshOutput:()=>{if(pe)ee(pe.title.toLowerCase().includes("graph")?"graph":"history")},onExecuteAction:(Z,te,Re)=>ee(Z,te,Re),branchModalOpen:ve,onCloseBranchModal:()=>me(!1),rootPath:c,activeRepo:m,currentBranch:Ue,detached:C?.state?.detached??!1,isBusy:ie,onBranchAction:(Z,te)=>ee(Z,void 0,te),onConfirmDeleteBranch:(Z,te)=>{ee("delete_branch",void 0,{branch:Z,...te?{force:"1"}:{}})}}),e(Je,{activeRepo:m,repos:x,isRefreshing:w,rootPath:c,reposScanning:v,onSelectRepo:(Z)=>{g(Z)},onRefresh:()=>{M(),G()},onRefreshRepos:N}),C?.isRepo===!1?e(Mt,{repo:m,isBusy:ie,onInit:()=>ee("init")}):e(d,{children:[e(Ze,{branchRef:V,showBranchMenu:q,setShowBranchMenu:A,branch:Ue,branches:zt,remoteBranches:Ot,onCheckout:(Z)=>ee("checkout",void 0,{branch:Z}),onMerge:(Z)=>ee("merge_branch",void 0,{branch:Z}),onOpenBranchPrompt:()=>O(!0),onManageBranches:()=>{me(!0),A(!1)},optionsRef:z,showOptions:L,setShowOptions:B,onHistory:()=>ee("history"),onGraph:()=>ee("graph"),viewMode:b,setViewMode:y,isBusy:ie,syncCount:R,syncing:It,onSync:()=>ee("sync"),onFetch:()=>ee("fetch"),detached:C?.state?.detached??!1}),C?.state?.operation?e(Qe,{operation:C.state.operation,conflicts:C.state.conflicts,isBusy:ie,onAbort:()=>ce("abort_operation"),onContinue:()=>ee("continue_operation")}):e(Xe,{message:Me,hasStagedChanges:_t.length>0,isBusy:ie,amend:Ce,seeded:Le,isGenerating:W,suggestion:ne,generated:De,onToggleAmend:Ae,onChangeMessage:ye,onCommit:j,onGenerate:ge,onUseSuggestion:Ee,onDismissSuggestion:we}),e(ot,{changes:qe,isLoading:ie,viewMode:b,repo:m,rootPath:c,onAction:ce,onResolve:Ht}),e($t,{rootPath:c,repo:m,isBusy:ie,onAction:(Z,te)=>ce(Z,void 0,te)})]})]})}export{Lr as GitPanel};
@@ -1,2 +0,0 @@
1
- import{n,o,s,N}from"./index-st6a8q5z.js";import{Wr,ql,fg,gg,HA,Xu}from"./index-ewst55j2.js";var ap="omp:editor-theme-changed";function a(){if(typeof window>"u")return ql;return N("editorTheme")??ql}var p={theme:null,vars:{},themes:gg(null)};function Li(){let[e,t]=n(a);if(o(()=>{let i=(d)=>{let E=d.detail;t(E||a())};return window.addEventListener(ap,i),()=>window.removeEventListener(ap,i)},[]),o(()=>{Xu(e)},[e]),e===Wr)return p;let r=fg(e);return{theme:r,vars:HA(r),themes:gg(e)}}var m={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]},ht=s(m);var op="omp:editor-indent-changed",ip=[2,4,8],Qu={width:2,insertSpaces:!0};function sp(){if(typeof window>"u")return Qu;let e=N("editorIndentWidth"),t=N("editorInsertSpaces");return{width:typeof e==="number"&&ip.includes(e)?e:Qu.width,insertSpaces:typeof t==="boolean"?t:Qu.insertSpaces}}function Ru(e){return e.insertSpaces?" ".repeat(e.width):"\t"}function Lu(){let[e,t]=n(sp);return o(()=>{let r=(i)=>{let d=i.detail;t(d??sp())};return window.addEventListener(op,r),()=>window.removeEventListener(op,r)},[]),e}var lp="omp:editor-typing-changed",Ul={autoCloseBrackets:!0,autocomplete:!0};function Fu(){if(typeof window>"u")return Ul;let e=N("editorAutoCloseBrackets"),t=N("editorAutocomplete");return{autoCloseBrackets:typeof e==="boolean"?e:Ul.autoCloseBrackets,autocomplete:typeof t==="boolean"?t:Ul.autocomplete}}function Mu(){let[e,t]=n(Fu);return o(()=>{let r=(i)=>{let d=i.detail;t(d??Fu())};return window.addEventListener(lp,r),()=>window.removeEventListener(lp,r)},[]),e}var Ps="omp:editor-blame-changed",Gl={enabled:!0,inline:!1};function Fi(){if(typeof window>"u")return Gl;let e=N("editorBlame"),t=N("editorBlameInline");return{enabled:typeof e==="boolean"?e:Gl.enabled,inline:typeof t==="boolean"?t:Gl.inline}}function cp(){let[e,t]=n(Fi);return o(()=>{let r=(i)=>{let d=i.detail;t(d??Fi())};return window.addEventListener(Ps,r),()=>window.removeEventListener(Ps,r)},[]),e}
2
- export{ht,ap,Li,op,ip,Qu,sp,Ru,Lu,lp,Ul,Fu,Mu,Ps,Gl,Fi,cp};
@@ -1,2 +0,0 @@
1
- import{d,n,o,i,u,a,e,s,p,I,ra,rs,f,ae,en,de,S,U,Lo,Nm,X,Bt,eA,Mm,Sd}from"./index-st6a8q5z.js";var q={name:"folder-git-2",size:24,node:[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]},wm=s(q);function O({row:t,active:r,name:l,loading:h,onSelect:c,onCopyPath:g,onReveal:N}){return e("div",{className:"grid grid-cols-[1rem_minmax(0,1fr)_3.5rem] items-start gap-x-2 px-4 py-2 border-b border-ink/5 last:border-b-0 hover:bg-ink/[0.02] group/row transition-colors",children:[e("div",{className:"h-5 flex items-center justify-center",children:r&&e(f,{size:12,className:"text-ink","aria-label":"Selected repository"})}),e("button",{type:"button",onClick:c,disabled:r||!t.isRepo,title:!t.isRepo?t.error??"Not a git repository":r?"Already showing this repository":`Show ${t.path}`,className:"min-w-0 text-left cursor-pointer disabled:cursor-default",children:e("div",{className:"h-5 flex items-center gap-1.5 min-w-0",children:[e(de,{size:11,className:r?"text-ink/60 flex-shrink-0":"text-ink/40 flex-shrink-0"}),e("span",{className:`truncate text-xs ${r?"font-semibold text-ink":"text-ink/90"}`,children:l})]})}),e("div",{className:"h-5 flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/row:opacity-100",children:[e("button",{type:"button",onClick:g,disabled:h,title:`Copy the absolute path of ${t.path}`,"aria-label":`Copy path of ${t.path}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-30 disabled:cursor-default",children:e(ae,{size:11})}),e("button",{type:"button",onClick:N,title:`Reveal ${t.path} in the file manager`,"aria-label":`Reveal ${t.path}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(en,{size:11})})]}),e("div",{className:"col-start-2 col-span-2 flex flex-wrap items-center gap-x-2 gap-y-0.5 min-w-0 mt-0.5",children:[t.isRepo?e(d,{children:[e("span",{className:`text-[10px] font-mono truncate ${t.detached?"text-warning":"text-ink/50"}`,title:t.detached?`Detached HEAD at ${t.branch}`:`On branch ${t.branch}`,children:t.branch}),e("span",{className:"text-[10px] text-ink/25","aria-hidden":!0,children:"·"}),e(Q,{row:t})]}):e("span",{className:"text-[10px] text-ink/40 truncate",children:t.error??"Not a git repository"}),t.isRepo&&t.subject&&e(d,{children:[e("span",{className:"text-[10px] text-ink/25","aria-hidden":!0,children:"·"}),e("span",{className:"text-[10px] text-ink/40 truncate min-w-0",title:t.subject,children:t.subject})]})]})]})}function Q({row:t}){let r=[];if(t.operation)r.push(e("span",{className:"flex flex-shrink-0 items-center gap-0.5 rounded border border-warning/30 px-1 text-[10px] font-mono text-warning",title:t.operation==="stash-pop"?`A stash pop stopped on ${t.conflicts} conflict(s)`:`A ${Lo[t.operation]} is in progress, stopped on ${t.conflicts} conflict(s)`,children:[e(I,{size:9}),Lo[t.operation]]},"operation"));else if(t.conflicts>0)r.push(e("span",{className:"flex flex-shrink-0 items-center gap-0.5 rounded border border-warning/30 px-1 text-[10px] font-mono text-warning",title:`${t.conflicts} conflicted path(s)`,children:[e(I,{size:9}),t.conflicts]},"conflicts"));if(t.changed>0||t.untracked>0)r.push(e("span",{className:"flex-shrink-0 rounded border border-info/30 px-1 text-[10px] font-mono tabular-nums text-info",title:`${t.changed} changed, ${t.untracked} untracked`,children:[t.changed>0?`${t.changed}±`:"",t.changed>0&&t.untracked>0?" ":"",t.untracked>0?`${t.untracked}?`:""]},"dirty"));if(t.gone)r.push(e("span",{className:"flex-shrink-0 rounded border border-warning/30 px-1 text-[10px] font-mono text-warning",title:`${t.upstream} no longer exists on the remote — fetch --prune to drop it`,children:"gone"},"gone"));else if(t.upstream&&(t.ahead>0||t.behind>0))r.push(e("span",{className:"flex flex-shrink-0 items-center gap-0.5 text-[10px] font-mono tabular-nums text-ink/60",title:`${t.ahead} ahead of, ${t.behind} behind ${t.upstream}`,children:[t.ahead>0&&e("span",{className:"flex items-center",children:[e(rs,{size:9}),t.ahead]}),t.behind>0&&e("span",{className:"flex items-center",children:[e(ra,{size:9}),t.behind]})]},"track"));if(r.length===0)return e("span",{className:"text-[10px] font-mono text-ink/30",title:"Nothing to report: clean and in sync",children:"clean, in sync"});return e(d,{children:r})}function H(t){let{open:r,rootPath:l,scanning:h}=t,[c,g]=n([]),[N,k]=n(!1),[C,A]=n(!1),[z,y]=n(null),[D,E]=n(0),j=t.repos.join("\x00"),G=i(!0),b=i(null);o(()=>(G.current=!0,()=>{G.current=!1,b.current?.abort(),b.current=null}),[]);let M=a(async()=>{b.current?.abort();let v=new AbortController;b.current=v,A(!0),k(!0);try{let R=new URLSearchParams({repoDetails:"1"});if(l)R.set("root",l);let w=await fetch(`/api/fs/git?${R.toString()}`,{signal:v.signal}),F=await w.json();if(!G.current||b.current!==v)return;if(!w.ok||!Array.isArray(F.details)){y(F.error||`Failed to read repositories (HTTP ${w.status})`);return}g(F.details),y(null)}catch(R){if(!G.current||b.current!==v)return;if(R instanceof Error&&R.name==="AbortError")return;y(R instanceof Error?R.message:"Failed to read repositories")}finally{if(G.current&&b.current===v)b.current=null,A(!1),k(!1)}},[l]);o(()=>{if(!r){g([]),y(null),k(!1);return}M()},[r,M,j,h,D]);let L=a(()=>E((v)=>v+1),[]);return{details:c,loading:N,reading:C,error:z,refresh:L}}function B(t){let r=new Map;for(let l of t){if(!l||l==="."){if(!r.has(""))r.set("",{key:"",label:null,paths:[]});r.get("").paths.push(".");continue}let h=l.indexOf("/"),c=h===-1?"":l.slice(0,h),g=r.get(c);if(!g)g={key:c,label:c===""?null:c,paths:[]},r.set(c,g);g.paths.push(l)}for(let l of r.values())l.paths.sort((h,c)=>h==="."?-1:c==="."?1:h.localeCompare(c));return[...r.values()].sort((l,h)=>{if(l.key==="")return-1;if(h.key==="")return 1;return l.key.localeCompare(h.key)})}function _(t,r){if(t===".")return"workspace root";if(r==="")return t;return t.slice(r.length+1)}function W({isOpen:t,rootPath:r,activeRepo:l,repos:h,scanning:c,onSelectRepo:g,onRefreshRepos:N,onClose:k}){let[C,A]=n(""),[z,y]=n(null),{details:D,loading:E,reading:j,error:G,refresh:b}=H({open:t,rootPath:r,repos:h,scanning:c});o(()=>{if(!t)A(""),y(null)},[t]);let M=u(()=>{let x=C.trim().toLowerCase();if(!x)return D;return D.filter((m)=>m.path.toLowerCase().includes(x))},[D,C]),L=u(()=>B(M.map((x)=>x.path)),[M]),v=u(()=>{let x=new Map;for(let m of D)x.set(m.path,m);return x},[D]),R=a(()=>{N(),b()},[N,b]),w=a(async(x)=>{let m=r?Sd(r,x==="."?"":x):x,P=await Bt(m);y(P?{text:`Copied ${m}`,kind:"success"}:{text:"Clipboard unavailable",kind:"error"})},[r]),F=a(async(x)=>{let m=new FormData;if(m.append("actionType","open_explorer"),m.append("path","."),m.append("repo",x),r)m.append("root",r);try{let P=await fetch("/api/fs/action",{method:"POST",body:m}),T=await P.json();if(!P.ok||T.error)y({text:T.error||"Could not open the file manager",kind:"error"})}catch{y({text:"Could not open the file manager",kind:"error"})}},[r]);if(!t)return null;return e(X,{onClose:k,maxWidthClass:"max-w-[min(96vw,720px)]",header:e("div",{className:"flex items-center gap-2 min-w-0",children:[e(wm,{size:14,className:"text-ink/60 flex-shrink-0"}),e("h2",{className:"text-sm font-semibold text-ink",children:"Repositories"}),e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:[h.length," in this workspace"]})]}),children:[e("div",{className:"px-5 py-3 flex items-center gap-2 border-b border-ink/10",children:[e(U,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:C,onChange:(x)=>A(x.currentTarget.value),placeholder:"Filter repositories…","aria-label":"Filter repositories",className:"flex-1 min-w-0 bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),e("button",{type:"button",onClick:R,disabled:j||c,title:"Re-discover repositories and re-read their state","aria-label":"Refresh repositories",className:"text-ink/40 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 flex-shrink-0",children:e(S,{size:12,className:j||c?"animate-spin":""})})]}),c&&e("div",{className:"px-5 py-1.5 border-b border-ink/10 text-[10px] font-mono text-ink/50 flex items-center gap-1.5",children:[e(p,{size:10,className:"animate-spin"}),"Still discovering repositories in this workspace…"]}),z&&e("div",{className:`px-5 py-1.5 border-b border-ink/10 text-[10px] font-mono truncate ${z.kind==="error"?"text-error":"text-ink/60"}`,title:z.text,role:"status",children:z.text}),e("div",{className:"min-h-[40vh] max-h-[60vh] overflow-y-auto scrollbar-overlay-container",children:E&&D.length===0?e("div",{className:"flex items-center justify-center gap-2 py-12 text-xs text-ink/50 font-mono",children:[e(p,{size:14,className:"animate-spin text-info"}),"Reading repositories…"]}):G?e("div",{className:"py-12 px-6 text-center text-xs text-error font-mono",children:G}):M.length===0?e("div",{className:"py-12 text-center text-xs text-ink/40 font-mono",children:C.trim()?"No matching repositories.":"No repositories in this workspace."}):L.map((x)=>e("div",{children:[e("div",{className:"px-4 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold bg-canvas/40 border-b border-ink/5 sticky top-0",children:x.label??eA(".",r)}),x.paths.map((m)=>{let P=v.get(m);if(!P)return null;return e(O,{row:P,active:m===l,name:_(m,x.key),loading:j,onSelect:()=>{g(m),k()},onCopyPath:()=>void w(m),onReveal:()=>void F(m)},m)})]},x.key))})]})}function Tr({rootPath:t,activeRepo:r,onSelectRepo:l,repos:h,scanning:c,onRefreshRepos:g}){let[N,k]=n(!1),C=u(()=>({root:t??null,repo:r,rows:Mm(t,h),scanning:c,ready:!0,setRepo:l,refresh:g}),[t,r,h,c,l,g]),A=a(()=>k(!0),[]);return e("div",{className:"relative min-w-0",children:[e(Nm,{scope:C,onManage:A}),e(W,{isOpen:N,rootPath:t,activeRepo:r,repos:h,scanning:c,onSelectRepo:l,onRefreshRepos:g,onClose:()=>k(!1)})]})}
2
- export{wm,Tr};
@@ -1 +0,0 @@
1
- import{d,n,o,i,u,a,Dr,ze,ie,e,s,Kn,Q,dt,E,ue,Ro,ae,Ie,et,hi,yn,bi,ia,S,U,h,sr,k,yh,Te,hl,T,xr,wr,xt,nt,he,Bt,Sd,mt,ft,Dh,Nh,Mo,fs,Td,We,As}from"./index-st6a8q5z.js";import{yd,vd,di,kd,xd}from"./index-zv8wrvha.js";import{Z}from"./index-6z30g3ha.js";import{Tr}from"./index-cxe75e06.js";var Yt={name:"pen",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],aliases:["edit-2"]},Xe=s(Yt);var Jt={name:"copy-plus",size:24,node:[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]},qe=s(Jt);var Zt={name:"package-open",size:24,node:[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]},Be=s(Zt);var en={name:"scissors",size:24,node:[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]},Se=s(en);function Qe({rootPath:t,activeRepo:r,repos:l,reposScanning:c,onRefreshRepos:p,onSelectRepo:f,searchQuery:x,onSearchChange:g,onRefresh:v,refreshing:b}){return e("div",{className:"border-b border-ink/10",children:[e(xt,{className:"border-b-0",left:e(Tr,{rootPath:t,activeRepo:r,onSelectRepo:f,repos:l,scanning:c,onRefreshRepos:p}),right:e(nt,{label:"Refresh",onClick:v,busy:b})}),e("div",{className:"px-3 pb-3",children:e("div",{className:"relative",children:[e(U,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-ink/40"}),e("input",{type:"text",placeholder:"Search files...",value:x,onChange:(m)=>g(m.currentTarget.value),className:"w-full bg-canvas border border-ink/20 rounded pl-8 pr-3 py-1.5 text-xs focus:outline-none focus:border-ink transition-colors text-ink placeholder-ink/40"})]})})]})}function Ye({name:t,path:r,isFolder:l,isOpen:c,ignored:p,selected:f,gitStatus:x,folderStatus:g}){let v=f?"text-ink font-semibold":x?x.colorClass:g?g.colorClass:p?"text-ink/40":"";return e(d,{children:[l?c?e(E,{size:12,className:"flex-shrink-0 text-ink/40"}):e(ue,{size:12,className:"flex-shrink-0 text-ink/40"}):e("span",{className:"w-3 flex-shrink-0"}),e(mt,{name:t,isFolder:l,isOpen:c,size:12,className:`flex-shrink-0${p?" opacity-40":""}`}),e("span",{className:`truncate min-w-0 flex-1 ${v}`,title:p?`${r} — git-ignored`:void 0,children:t}),x&&e("span",{className:`font-mono text-[10px] font-bold px-1 rounded flex-shrink-0 ${x.colorClass}`,title:`Git: ${x.label}`,children:x.charStatus}),g&&e("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${g.dotClass}`,title:`${g.count} changed file${g.count>1?"s":""}`})]})}var tn=28,nn=9,rn=8;function on(t){let{isFolder:r,hasGitStatus:l,pasteLabel:c,busy:p,chainLabel:f,foldable:x,selectionCount:g,isArchive:v}=t,b=[],m=g>1,C=g===1?"":` ${g} items`;if(m)return b.push({kind:"item",id:"cut",label:`Cut${C}`,icon:e(Se,{size:13,className:"text-ink/60"}),disabled:p}),b.push({kind:"item",id:"copy",label:`Copy${C}`,icon:e(ae,{size:13,className:"text-ink/60"}),disabled:p}),b.push({kind:"separator"}),b.push({kind:"item",id:"compress",label:`Compress${C} to…`,icon:e(dt,{size:13,className:"text-ink/60"}),disabled:p}),b.push({kind:"separator"}),b.push({kind:"item",id:"delete",label:`Delete${C}`,icon:e(Q,{size:13,className:"text-error"}),tone:"text-error"}),b;if(r){if(b.push({kind:"item",id:"new_file",label:"New File",icon:e(hi,{size:13,className:"text-ink/60"})}),b.push({kind:"item",id:"new_folder",label:"New Folder",icon:e(yn,{size:13,className:"text-ink/60"})}),f)b.push({kind:"item",id:"unfold",label:"Unfold Folders",icon:e(E,{size:13,className:"text-ink/60"})});if(x)b.push({kind:"item",id:"fold",label:"Fold Folders",icon:e(ue,{size:13,className:"text-ink/60"})});b.push({kind:"separator"})}else{if(b.push({kind:"item",id:"view",label:"View",icon:e(et,{size:13,className:"text-ink/60"})}),v)b.push({kind:"item",id:"extract",label:"Extract…",icon:e(Be,{size:13,className:"text-ink/60"}),disabled:p});if(l)b.push({kind:"item",id:"diff",label:"Open in Diff Panel",icon:e(bi,{size:13,className:"text-warning"}),tone:"font-medium"});b.push({kind:"separator"})}if(b.push({kind:"item",id:"cut",label:"Cut",icon:e(Se,{size:13,className:"text-ink/60"}),disabled:p}),b.push({kind:"item",id:"copy",label:"Copy",icon:e(ae,{size:13,className:"text-ink/60"}),disabled:p}),b.push({kind:"item",id:"compress",label:"Compress to…",icon:e(dt,{size:13,className:"text-ink/60"}),disabled:p}),b.push({kind:"item",id:"duplicate",label:"Duplicate",icon:e(qe,{size:13,className:"text-ink/60"}),disabled:p}),c)b.push({kind:"item",id:"paste",label:c,icon:e(Ro,{size:13,className:"text-ink/60"}),disabled:p});return b.push({kind:"separator"}),b.push({kind:"item",id:"explorer",label:"Go to Explorer",icon:e(Ie,{size:13,className:"text-ink/60"})}),b.push({kind:"item",id:"copy_path",label:"Copy Path",icon:e(ae,{size:13,className:"text-ink/60"})}),b.push({kind:"item",id:"copy_relative",label:"Copy Relative Path",icon:e(ae,{size:13,className:"text-ink/60"})}),b.push({kind:"separator"}),b.push({kind:"item",id:"history",label:"Show Git History",icon:e(Kn,{size:13,className:"text-ink/60"})}),b.push({kind:"separator"}),b.push({kind:"item",id:"rename",label:"Rename",icon:e(Xe,{size:13,className:"text-ink/60"})}),b.push({kind:"item",id:"delete",label:"Delete",icon:e(Q,{size:13,className:"text-error"}),tone:"text-error"}),b}function sn(t){let r=t.filter((c)=>c.kind==="item").length,l=t.length-r;return r*tn+l*nn+rn}function Je({x:t,y:r,isFolder:l,hasGitStatus:c,pasteLabel:p,chainLabel:f,foldable:x,busy:g,selectionCount:v,isArchive:b,onAction:m,menuRef:C}){let N=on({isFolder:l,hasGitStatus:c,pasteLabel:p,busy:g,chainLabel:f,foldable:x,selectionCount:v,isArchive:b}),A=sn(N),F=typeof window<"u"?Math.max(10,Math.min(t,window.innerWidth-210-12)):t,M=typeof window<"u"?Math.max(10,Math.min(r,window.innerHeight-A-12)):r;return ie(e("div",{className:"fixed inset-0 z-50 bg-ink/20",onClick:()=>m("close"),onContextMenu:(D)=>{D.preventDefault(),m("close")},children:e("div",{ref:C,className:"glass-popover fixed z-50 bg-paper border border-ink/15 shadow-2xl rounded-lg py-1 min-w-[185px] text-xs text-ink font-sans",style:{top:M,left:F},onClick:(D)=>D.stopPropagation(),children:N.map((D,w)=>D.kind==="separator"?e("div",{className:"my-1 border-t border-ink/10"},`sep-${w}`):e("button",{type:"button",disabled:D.disabled,onClick:()=>m(D.id),className:`w-full text-left px-3 py-1.5 flex items-center space-x-2 transition-colors ${D.disabled?"opacity-40 cursor-default":"hover:bg-ink/5"} ${D.tone??""}`,children:[D.icon,e("span",{children:D.label})]},D.id))})}),document.body)}function Fe({folderPath:t,kind:r,value:l,error:c,isLoading:p,onChange:f,onCancel:x,onSubmit:g}){let v=r==="folder"?"Folder":"File";return ie(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center modal-safe backdrop-blur-sm",children:e("form",{onSubmit:g,className:"glass-overlay bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans",children:[e("h3",{className:"font-semibold text-ink mb-3 text-sm",children:["New ",v]}),e("div",{className:"flex items-center gap-1 mb-1 text-xs font-mono text-ink/50 min-w-0",children:e("span",{className:"truncate",title:t,children:[t||".","/"]})}),e("input",{autoFocus:!0,type:"text",value:l,onChange:(b)=>f(b.currentTarget.value),placeholder:r==="folder"?"folder name or nested/path":"file name or nested/path","aria-label":`New ${v.toLowerCase()} name`,className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none mb-1 ${c?"border-error":"border-ink/20 focus:border-ink"}`}),e("p",{className:"text-[10px] text-ink/40 mb-2",children:["Nested paths create the folders they need — ",e("span",{className:"font-mono",children:"lib/parse.ts"}),"."]}),c&&e("p",{className:"text-[11px] text-error mb-2",children:c}),e("div",{className:"flex justify-end space-x-2 mt-2",children:[e("button",{type:"button",onClick:x,className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",disabled:p,children:"Cancel"}),e("button",{type:"submit",className:"px-3 py-1.5 text-xs bg-ink text-canvas rounded hover:bg-ink/90 transition-colors flex items-center",disabled:p||!l.trim(),children:p?"Creating...":"Create"})]})]})}),document.body)}function Ze({fileName:t,displayName:r,isFolder:l,count:c=1,isLoading:p,onCancel:f,onConfirm:x}){let g=c>1;return ie(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center modal-safe backdrop-blur-sm",children:e("div",{className:"glass-overlay bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans",children:[e("h3",{className:"font-semibold text-ink mb-2 text-sm",children:["Delete ",g?`${c} Items`:l?"Folder":"File"]}),e("p",{className:"text-xs text-ink/70 mb-4",children:["Are you sure you want to delete ",g?e(d,{children:["the ",c," selected entries"]}):e("span",{className:"font-mono bg-canvas px-1 rounded",children:t}),"? This action cannot be undone."]}),r&&r!==t&&e("p",{className:"text-[11px] text-ink/50 mb-4",children:["The row is ",e("span",{className:"font-mono",children:r}),"; this deletes"," ",e("span",{className:"font-mono",children:t})," only."]}),e("div",{className:"flex justify-end space-x-2",children:[e("button",{onClick:f,className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",disabled:p,children:"Cancel"}),e("button",{onClick:x,className:"px-3 py-1.5 text-xs bg-error text-white rounded hover:bg-error/90 transition-colors flex items-center",disabled:p,children:p?"Deleting...":"Delete"})]})]})}),document.body)}function tt({isFolder:t,renameValue:r,originalPath:l,displayName:c,error:p,isLoading:f,onChange:x,onCancel:g,onSubmit:v}){return ie(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center modal-safe backdrop-blur-sm",children:e("form",{onSubmit:v,className:"glass-overlay bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans",children:[e("h3",{className:"font-semibold text-ink mb-3 text-sm",children:["Rename ",t?"Folder":"File"]}),e("input",{autoFocus:!0,type:"text",value:r,onChange:(b)=>x(b.currentTarget.value),"aria-label":`Rename ${t?"folder":"file"} path`,className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none mb-1 ${p?"border-error":"border-ink/20 focus:border-ink"}`}),e("p",{className:"text-[10px] text-ink/40 mb-2",children:["Paths are relative to the tree — ",e("span",{className:"font-mono",children:"lib/deep/name.ts"})," moves it too."]}),c&&e("p",{className:"text-[11px] text-ink/50 mb-2",children:["The row is ",e("span",{className:"font-mono",children:c}),"; this renames"," ",e("span",{className:"font-mono",children:l}),". Use"," ",e("span",{className:"font-mono",children:"Unfold Folders"})," to rename a folder inside the chain."]}),p&&e("p",{className:"text-[11px] text-error mb-2",children:p}),e("div",{className:"flex justify-end space-x-2",children:[e("button",{type:"button",onClick:g,className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",disabled:f,children:"Cancel"}),e("button",{type:"submit",className:"px-3 py-1.5 text-xs bg-ink text-canvas rounded hover:bg-ink/90 transition-colors flex items-center",disabled:f||!r.trim()||r===l,children:f?"Renaming...":"Rename"})]})]})}),document.body)}function rt({filePath:t,fetcherState:r,fetcherData:l,onClose:c}){let p=l?.type==="history"?l.data:void 0;return ie(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center modal-safe backdrop-blur-sm",children:e("div",{className:"glass-overlay bg-paper rounded-lg shadow-xl w-full max-w-4xl border border-ink/10 flex flex-col max-h-[85vh]",children:[e("div",{className:"flex items-center justify-between p-4 border-b border-ink/10",children:[e("h3",{className:"text-sm font-semibold text-ink flex items-center space-x-2",children:[e(Kn,{size:16,className:"text-ink/60"}),e("span",{children:["Git History: ",e("span",{className:"font-mono font-normal opacity-80",children:t})]})]}),e("button",{onClick:c,className:"p-1 hover:bg-ink/5 rounded text-ink/60 transition-colors",children:e(h,{size:14})})]}),e("div",{className:"flex-1 scrollbar-overlay-container p-2",children:r==="idle"?p?p.length>0?e("table",{className:"w-full text-left border-collapse text-[11px]",children:[e("thead",{className:"bg-canvas sticky top-0 z-10 border-b border-ink/10",children:e("tr",{children:[e("th",{className:"px-3 py-2 font-semibold text-ink/70 rounded-tl",children:"Description"}),e("th",{className:"px-3 py-2 font-semibold text-ink/70 w-32",children:"Date"}),e("th",{className:"px-3 py-2 font-semibold text-ink/70 w-32",children:"Author"}),e("th",{className:"px-3 py-2 font-semibold text-ink/70 w-24 text-right rounded-tr",children:"Commit"})]})}),e("tbody",{className:"divide-y divide-ink/5",children:p.map((f,x)=>e("tr",{className:"hover:bg-ink/[0.03] transition-colors group",children:[e("td",{className:"px-3 py-2 text-ink",children:f.message?e("span",{className:"font-medium text-ink/90 group-hover:text-ink",children:f.message}):null}),e("td",{className:"px-3 py-2 text-ink/60 whitespace-nowrap font-mono text-[10.5px]",children:f.time}),e("td",{className:"px-3 py-2 text-ink/70 whitespace-nowrap truncate max-w-[120px]",children:f.author}),e("td",{className:"px-3 py-2 text-right",children:f.hash?e("span",{className:"font-mono text-ink/50 group-hover:text-ink font-semibold transition-colors bg-canvas px-1.5 py-0.5 rounded border border-ink/10",children:f.hash}):null})]},x))})]}):e("div",{className:"p-8 text-center text-ink/40 font-mono text-xs",children:"No commit history found for this file."}):l?.error?e("div",{className:"p-8 text-center text-error font-mono text-xs",children:l.error}):e("div",{className:"p-8 text-center text-ink/40 font-mono text-xs",children:"Loading history..."}):e("div",{className:"p-8 text-center text-ink/40 font-mono text-xs flex items-center justify-center space-x-2",children:[e(S,{size:14,className:"animate-spin"}),e("span",{children:"Loading history..."})]})})]})}),document.body)}function ot({actions:t,file:r,isFolder:l,chainLabel:c}){let p=t.selectionCount;return e(d,{children:[t.showCreateModal&&e(Fe,{folderPath:r.path,kind:t.createKind,value:t.createName,error:t.createError,isLoading:t.busy,onChange:t.setCreateName,onCancel:t.closeCreate,onSubmit:t.submitCreate}),t.showDeleteModal&&e(Ze,{fileName:r.path,displayName:p>1?void 0:c,isFolder:l,count:p,isLoading:t.busy,onCancel:t.closeDelete,onConfirm:t.submitDelete}),t.showRenameModal&&e(tt,{isFolder:l,renameValue:t.renameValue,originalPath:r.path,displayName:l?c:void 0,error:t.renameError,isLoading:t.busy,onChange:t.setRenameValue,onCancel:t.closeRename,onSubmit:t.submitRename}),t.showHistoryModal&&e(rt,{filePath:r.path,fetcherState:t.fetcherState,fetcherData:t.fetcherData,onClose:t.closeHistory})]})}function Ae(t){let r=t.map(an);return r.some((l,c)=>l!==t[c])?r:t}function an(t){if(t.type!=="folder"||!Array.isArray(t.children))return t;let r=Ae(t.children),l=r===t.children?t:{...t,children:r};while(Array.isArray(l.children)&&l.children.length===1){let c=l.children[0];if(c.type!=="folder")break;l={...l,name:`${l.name}/${c.name}`,path:c.path,children:c.children,ignored:c.ignored??l.ignored}}return l}function Ee(t){return t.type==="folder"&&t.name.includes("/")}function Me(t,r){let l=r.split("/"),c=t.split("/");if(l.length<2||l.length>c.length||l.some((f)=>!f))return null;let p=c.slice(0,c.length-l.length);return l.map((f,x)=>[...p,...l.slice(0,x+1)].join("/"))}function it(t,r){let l=new Map;if(r.size===0)return{nodes:t,roots:l};let c=!1,p=(x)=>x.flatMap((g)=>{if(g.type!=="folder")return[g];let v=Array.isArray(g.children)?p(g.children):g.children,b=v===g.children?g:{...g,children:v},m=r.has(g.path)?Me(g.path,g.name):null;if(!m)return[b];c=!0,l.set(m[0],g.path);let C={...b,name:m[m.length-1].split("/").pop()};for(let y=m.length-1;y>0;y-=1){let N=m[y-1];C={name:N.split("/").pop(),path:N,type:"folder",ignored:b.ignored,children:[C]}}return[C]}),f=p(t);return{nodes:c?f:t,roots:l}}function st(t,r){let l=new Set,c=(x)=>{for(let g of x){if(g.type!=="folder")continue;if(l.add(g.path),Array.isArray(g.children))c(g.children)}};c(t);let p=r.split("/").slice(0,-1),f=[];for(let x=0;x<p.length;x+=1){let g=p.slice(0,x+1).join("/");if(l.has(g))f.push(g)}return f}function Ne({folderPath:t,rootPath:r,repo:l,onCreated:c,onOpenCreated:p}){let f=ft(),[x,g]=n(!1),[v,b]=n("file"),[m,C]=n(""),[y,N]=n(null),A=i(null);return o(()=>{if(f.state!=="idle"||!f.data)return;let F=f.data;if(A.current===F)return;if(A.current=F,F.success&&F.path){let M=F.kind==="folder"?"folder":"file";g(!1),C(""),N(null);let D=F.path.split("/").pop()||F.path;if(c({path:F.path,name:D,kind:M}),M==="file")p?.({path:F.path,name:D})}else N(F.error||`Could not create the ${v}`)},[f.state,f.data]),{open:x,kind:v,name:m,setName:C,error:y,busy:f.state!=="idle",openDialog:(F="file")=>{b(F),C(""),N(null),g(!0)},closeDialog:()=>g(!1),submit:(F)=>{F.preventDefault();let M=m.trim();if(!M)return;N(null);let D=new FormData;if(D.append("actionType","create"),D.append("path",t),D.append("name",M),v==="folder")D.append("kind","folder");if(l&&l!==".")D.append("repo",l);if(r)D.append("root",r);f.submit(D,{method:"post",action:"/api/fs/action"})}}}function we(t){if(!t)return null;if(t.entries.length===1)return t.entries[0].name;return`${t.entries.length} items`}function at(t,r){return`${t??""}\x00${r}`}function Le(t,r){if(r==="folder")return t;let l=t.lastIndexOf("/");return l===-1?".":t.slice(0,l)}function lt(t){let r=t.lastIndexOf("/");return r===-1?".":t.slice(0,r)}function ct(t,r){if(t.path===""||t.path===".")return"The workspace root cannot be moved or copied";if(t.kind==="folder"&&(r===t.path||r.startsWith(`${t.path}/`)))return"Cannot paste a folder into itself";return null}function pt(t,r){let l=ct(t,r);if(l)return l;if(r===lt(t.path))return"Already in this folder";return null}function ut(t,r,l){if(!t||t.entries.length===0)return"Nothing to paste";if(t.scope!==r)return"The clipboard holds an entry from another workspace";if(t.mode==="cut"&&t.entries.some((c)=>l===lt(c.path)))return"Already in this folder";for(let c of t.entries){let p=ct(c,l);if(p)return p}return null}function ht(t){if(typeof t!=="object"||t===null)return null;let r=t;if(typeof r.scope!=="string")return null;if(r.mode!=="copy"&&r.mode!=="cut")return null;let l=Array.isArray(r.entries)?r.entries:typeof r.path==="string"?[{path:r.path,name:r.name,kind:r.kind}]:[],c=[];for(let p of l){let f=ln(p);if(!f)return null;c.push(f)}if(c.length===0)return null;return{scope:r.scope,entries:c,mode:r.mode}}function ln(t){if(typeof t!=="object"||t===null)return null;let r=t;if(typeof r.path!=="string"||typeof r.name!=="string")return null;if(r.kind!=="file"&&r.kind!=="folder")return null;let l=r.path.split("/");if(r.path===""||r.path.startsWith("/")||l.some((c)=>c===""||c==="."||c===".."))return null;return{path:r.path,name:r.name,kind:r.kind}}var $e=[{id:"zip",label:"ZIP",extension:"zip"},{id:"7z",label:"7Z",extension:"7z"},{id:"rar",label:"RAR",extension:"rar"},{id:"tar",label:"TAR",extension:"tar"},{id:"tar.gz",label:"TAR.GZ",extension:"tar.gz"}],gt=[[".tar.gz","tar.gz"],[".tar.bz2","tar.bz2"],[".tar.xz","tar.xz"],[".tgz","tar.gz"],[".tbz2","tar.bz2"],[".txz","tar.xz"],[".tar","tar"],[".zip","zip"],[".7z","7z"],[".rar","rar"],[".gz","gz"],[".bz2","bz2"],[".xz","xz"]];function Oe(t){let r=t.toLowerCase();for(let[l,c]of gt)if(r.endsWith(l))return c;return null}function bt(t){return Oe(t)!==null}function cn(t){return $e.find((r)=>r.id===t)}function dn(t){return cn(t)?.extension??"zip"}function vt(t){let r=t.toLowerCase();for(let[l]of gt)if(r.endsWith(l))return t.slice(0,-l.length);return t}function yt(t){let r=t.lastIndexOf("/");return r===-1?".":t.slice(0,r)||"."}function kt(t){let r=t.lastIndexOf("/");return r===-1?t:t.slice(r+1)}function Ct(t){if(t.length===0)return".";let r=t.map((c)=>yt(c).split("/").filter((p)=>p!==".")),l=r[0]??[];for(let c of r.slice(1)){let p=0;while(p<l.length&&p<c.length&&l[p]===c[p])p+=1;l=l.slice(0,p)}return l.length===0?".":l.join("/")}function De(t,r){let l=dn(r);if(t.length===1){let f=t[0],x=vt(f.name),g=x.lastIndexOf(".");return`${(f.kind==="folder"?f.name:g>0?x.slice(0,g):x)||"archive"}.${l}`}let c=Ct(t.map((f)=>f.path)),p=kt(c);return`${p==="."||p===""?"archive":p}.${l}`}function Ft(t){return Ct(t.map((r)=>r.path))}function Nt(t){let r=yt(t),l=vt(kt(t));if(!l)return r;return r==="."?l:`${r}/${l}`}function wt(t){return t.toUpperCase()}function Dt({file:t,diff:r,onOpenFile:l,onActionComplete:c,onCreated:p,onRenamed:f,onUnfold:x,onFold:g,clipboard:v,isFolder:b,selection:m,selected:C,archive:y}){let N=ft(),[A,F]=n(null),M=i(null),[D,w]=n(!1),[R,I]=n(!1),[_,te]=n(!1),[ne,se]=n(t.path),[H,P]=n(null),{repo:z,rootPath:G}=t,K=Ne({folderPath:t.path,rootPath:G,repo:z,onCreated:(L)=>p?p(L):c(),onOpenCreated:(L)=>l?.({...L,root:G,repo:z||"."})}),re=i(null);o(()=>{if(N.state!=="idle"||!N.data)return;let L=N.data;if(re.current===L)return;if(re.current=L,L.success&&!L.type)if(w(!1),I(!1),P(null),L.previousPath&&L.path&&f)f(L.previousPath,L.path);else c();else if(!L.success&&L.error&&D)P(L.error)},[N.state,N.data]);let q=(L)=>{if(z&&z!==".")L.append("repo",z);if(G)L.append("root",G);N.submit(L,{method:"post",action:"/api/fs/action"})},X=()=>{l?.({path:t.path,name:t.name,root:G,repo:z||"."})},J={path:t.path,name:t.name,kind:b?"folder":"file"},oe=C&&m.length>1?m:[J],ge=bt(t.name),B=v.clip&&!v.refusalFor(J)?`Paste ${we(v.clip)??"item"}`:null,fe=(L)=>{if(F(null),P(null),L==="view")X();else if(L==="diff")window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.path,staged:r?.staged,status:r?.status||"M",repo:z||".",root:G}}));else if(L==="explorer"){let j=new FormData;j.append("actionType","open_explorer"),j.append("path",t.path),q(j)}else if(L==="copy_path")Bt(Sd(t.basePath,t.path));else if(L==="copy_relative")Bt(t.path);else if(L==="history"){te(!0);let j=new FormData;j.append("actionType","git_history"),j.append("path",t.path),q(j)}else if(L==="rename")se(t.path),w(!0);else if(L==="unfold")x?.();else if(L==="fold")g?.();else if(L==="new_file")K.openDialog("file");else if(L==="new_folder")K.openDialog("folder");else if(L==="delete")I(!0);else if(L==="cut")v.cut(oe);else if(L==="copy")v.copy(oe);else if(L==="compress")y.openCompress(oe);else if(L==="extract")y.openExtract(J);else if(L==="duplicate")v.duplicate(J);else if(L==="paste")v.paste(J)},le=(L)=>{L.preventDefault(),P(null);let j=new FormData;j.append("actionType","rename"),j.append("path",t.path),j.append("newPath",ne),q(j)},ve=()=>{let L=new FormData;if(L.append("actionType","delete"),oe.length>1)L.append("paths",JSON.stringify(oe.map((j)=>j.path)));else L.append("path",t.path);q(L)};return{contextMenu:A,contextMenuRef:M,openContextMenu:(L,j)=>F({x:L,y:j}),closeContextMenu:()=>F(null),showRenameModal:D,showDeleteModal:R,showHistoryModal:_,showCreateModal:K.open,createKind:K.kind,createError:K.error,createName:K.name,setCreateName:K.setName,renameValue:ne,setRenameValue:se,renameError:H,busy:N.state!=="idle"||K.busy||v.busy||y.busy,pasteLabel:B,selectionCount:oe.length,isArchive:ge,chainLabel:x!==void 0,foldable:g!==void 0,fetcherState:N.state,fetcherData:N.data,handleAction:fe,submitCreate:K.submit,submitRename:le,submitDelete:ve,closeCreate:K.closeDialog,closeDelete:()=>I(!1),closeRename:()=>w(!1),closeHistory:()=>te(!1)}}function Rt({target:t,dragging:r,clipboard:l,onDragStart:c,onDragEnd:p,onDropOn:f,onHoverAccept:x}){let g=r?.path===t.path,v=Boolean(r)&&!g&&l.moveRefusalFor(r,t)===null,[b,m]=n(!1);return o(()=>{if(!r)m(!1)},[r]),{isDragging:g,acceptsDrop:v,isDropHovered:b&&v,onDragStart:(y)=>{if(y.dataTransfer?.setData("text/plain",t.path),y.dataTransfer)y.dataTransfer.effectAllowed="move";c(t)},onDragEnd:p,onDragOver:(y)=>{if(!r)return;if(y.stopPropagation(),m(v),!v)return;if(y.preventDefault(),y.dataTransfer)y.dataTransfer.dropEffect="move";x?.(t)},onDragLeave:()=>m(!1),onDrop:(y)=>{if(!r)return;if(y.stopPropagation(),!v)return;y.preventDefault(),f(t)}}}function pn(t,r,l){if(r||l)return!1;return!Array.isArray(t.children)}function Pe({file:t,rootPath:r,basePath:l,repo:c,onLoadChildren:p,onOpenFile:f,onActionComplete:x,onCreated:g,onRenamed:v,expandedPaths:b,onToggleFolder:m,gitFileMap:C,gitFolderMap:y,clipboard:N,archive:A,selection:F,selectionTargets:M,dragging:D,onDragStart:w,onDragEnd:R,onDropOn:I,onUnfold:_,onFold:te,foldRoots:ne,touch:se=!1}){let H=t.type==="folder",[P,z]=n(!1),[G,K]=n(!1),[re,q]=n(!1),[X,J]=n(!1),oe=Array.isArray(t.children)?t.children:[],ge=(t.path||"").replace(/^\/+/,""),B=!H?C?.get(ge)||C?.get(t.path):void 0,fe=B?sr(B.status,B.staged):null,le=H?y?.get(ge)||y?.get(t.path):null,ve=Boolean(fe),L=t.ignored===!0,j=b?b.has(t.path):P,ce=t.forceExpanded!==void 0?t.forceExpanded:j;o(()=>{J(!0)},[]),o(()=>{if(H&&b)z(b.has(t.path))},[b,t.path,H]),o(()=>{if(H&&ce&&pn(t,G,re)&&p)q(!0),K(!0),Promise.resolve(p(t.path)).finally(()=>K(!1))},[H,ce,t.children,t.path,p,G,re]);let ke={path:t.path,name:t.name,kind:H?"folder":"file"},xe=F.selected.has(t.path),W=Dt({file:{path:t.path,name:t.name,basePath:l,rootPath:r,repo:c},selection:M,selected:xe,archive:A,diff:{staged:B?.staged||(B?.status?B.status[0]!==" "&&B.status[0]!=="?":!1),status:fe?.charStatus},onOpenFile:f,onActionComplete:x,onCreated:g,onRenamed:v,onUnfold:_&&Ee({type:H?"folder":"file",name:t.name})?()=>_(ke):void 0,onFold:te&&ne?.has(t.path)?()=>te(ne.get(t.path)):void 0,clipboard:N,isFolder:H});he(W.contextMenuRef,W.closeContextMenu);let Y=yd({enabled:se,onLongPress:(V,be)=>W.openContextMenu(V,be)}),Ce=(V)=>{if(V.stopPropagation(),Y.consume())return;let be=F.gestureOf(V);if(be!=="plain"){F.applyGesture(be,t.path);return}if(F.applyGesture("plain",t.path),H){let pe=!ce;if(z(pe),t.forceExpanded!==void 0)t.forceExpanded=void 0;if(m?.(t.path,pe),!pe)q(!1)}else if(f)f({...t,root:r,repo:c||"."})},ye=(V)=>{V.preventDefault(),V.stopPropagation(),F.ensureForContext(t.path),W.openContextMenu(V.clientX,V.clientY)},de=Rt({target:ke,dragging:D,clipboard:N,onDragStart:w,onDragEnd:R,onDropOn:I,onHoverAccept:_});return e("div",{children:[e("div",{className:`flex items-center space-x-1.5 py-1 px-2 cursor-pointer rounded group select-none ${de.isDragging?"opacity-40":""} ${de.isDropHovered?"bg-info/10 ring-1 ring-info/40 ring-inset":xe?"bg-ink/[0.08] ring-1 ring-ink/20 ring-inset":"hover:bg-ink/5"}`,draggable:!se,onClick:Ce,onContextMenu:ye,onDragStart:de.onDragStart,onDragEnd:de.onDragEnd,onDragOver:de.onDragOver,onDragLeave:de.onDragLeave,onDrop:de.onDrop,onTouchStart:Y.onTouchStart,onTouchMove:Y.onTouchMove,onTouchEnd:Y.onTouchEnd,onTouchCancel:Y.onTouchCancel,children:e(Ye,{name:t.name,path:t.path,isFolder:H,isOpen:ce,ignored:L,selected:xe,gitStatus:fe,folderStatus:le})}),ce&&G&&e("div",{className:"ml-3 border-l border-ink/10 pl-3 py-0.5 text-[10px] text-ink/30",children:"Loading…"}),ce&&!G&&oe.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:oe.map((V)=>e(Pe,{file:V,rootPath:r,basePath:l,repo:c,onLoadChildren:p,onOpenFile:f,onActionComplete:x,onCreated:g,onRenamed:v,expandedPaths:b,onToggleFolder:m,gitFileMap:C,gitFolderMap:y,clipboard:N,archive:A,selection:F,selectionTargets:M,dragging:D,onDragStart:w,onDragEnd:R,onDropOn:I,onUnfold:_,onFold:te,foldRoots:ne,touch:se},V.path))}),X&&W.contextMenu&&e(Je,{x:W.contextMenu.x,y:W.contextMenu.y,isFolder:H,hasGitStatus:ve,pasteLabel:W.pasteLabel,chainLabel:W.chainLabel,foldable:W.foldable,busy:W.busy,selectionCount:W.selectionCount,isArchive:W.isArchive,onAction:W.handleAction}),X&&e(ot,{actions:W,file:t,isFolder:H,chainLabel:Ee({type:H?"folder":"file",name:t.name})?t.name:void 0})]})}function St({x:t,y:r,pasteLabel:l,busy:c,onAction:p,menuRef:f}){let g=l?104:76,v=typeof window<"u"?Math.max(10,Math.min(t,window.innerWidth-190-12)):t,b=typeof window<"u"?Math.max(10,Math.min(r,window.innerHeight-g-12)):r;return ie(e("div",{className:"fixed inset-0 z-50 bg-ink/20",onClick:()=>p("close"),onContextMenu:(m)=>{m.preventDefault(),p("close")},children:e("div",{ref:f,className:"glass-popover fixed z-50 bg-paper border border-ink/15 shadow-2xl rounded-lg py-1 min-w-[185px] text-xs text-ink font-sans",style:{top:b,left:v},onClick:(m)=>m.stopPropagation(),children:[e("button",{type:"button",onClick:()=>p("new_file"),className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 flex items-center space-x-2 transition-colors",children:[e(hi,{size:13,className:"text-ink/60"}),e("span",{children:"New File"})]}),e("button",{type:"button",onClick:()=>p("new_folder"),className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 flex items-center space-x-2 transition-colors",children:[e(yn,{size:13,className:"text-ink/60"}),e("span",{children:"New Folder"})]}),l&&e("button",{type:"button",disabled:c,onClick:()=>p("paste"),className:`w-full text-left px-3 py-1.5 flex items-center space-x-2 transition-colors ${c?"opacity-40 cursor-default":"hover:bg-ink/5"}`,children:[e(Ro,{size:13,className:"text-ink/60"}),e("span",{children:l})]})]})}),document.body)}function At({menu:t,menuRef:r,pasteLabel:l,busy:c,onAction:p,create:f}){return e(d,{children:[t&&e(St,{x:t.x,y:t.y,menuRef:r,pasteLabel:l,busy:c,onAction:p}),f.open&&e(Fe,{folderPath:".",kind:f.kind,value:f.name,error:f.error,isLoading:f.busy,onChange:f.setName,onCancel:f.closeDialog,onSubmit:f.submit})]})}function Tt({title:t,subject:r,error:l,busy:c,submitLabel:p,busyLabel:f,onSubmit:x,onCancel:g,children:v}){return ie(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center modal-safe backdrop-blur-sm",children:e("form",{onSubmit:x,className:"glass-overlay bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans",children:[e("h3",{className:"font-semibold text-ink mb-1 text-sm",children:t}),e("p",{className:"text-[11px] text-ink/50 mb-3 break-words",children:r}),v,l&&e("p",{className:"text-[11px] text-error mb-2",children:l}),e("div",{className:"flex justify-end space-x-2 mt-3",children:[e("button",{type:"button",onClick:g,className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",disabled:c,children:"Cancel"}),e("button",{type:"submit",className:"px-3 py-1.5 text-xs bg-ink text-canvas rounded hover:bg-ink/90 transition-colors flex items-center",disabled:c,children:c?f:p})]})]})}),document.body)}function un({entries:t,format:r,name:l,destination:c,formats:p,error:f,busy:x,onFormatChange:g,onNameChange:v,onDestinationChange:b,onCancel:m,onSubmit:C}){let y=t.slice(0,4).map((A)=>A.name).join(", "),N=t.length>4?` +${t.length-4} more`:"";return e(Tt,{title:`Compress ${t.length===1?t[0].name:`${t.length} items`}`,subject:`${y}${N}`,error:f,busy:x,submitLabel:"Compress",busyLabel:"Compressing...",onCancel:m,onSubmit:(A)=>{A.preventDefault(),C()},children:[e("label",{className:"block text-[10px] uppercase tracking-wide text-ink/40 mb-1",children:"Format"}),e(Z,{ariaLabel:"Format",value:r,onChange:(A)=>g(A),placeholder:"Format",searchable:!1,allowEmpty:!1,className:"mb-3 text-xs",options:p.map((A)=>({value:A.id,label:A.available?A.label:`${A.label} — ${A.tool} not installed`,disabled:!A.available}))}),e("label",{className:"block text-[10px] uppercase tracking-wide text-ink/40 mb-1",htmlFor:"archive-name",children:"Archive name"}),e("input",{id:"archive-name",autoFocus:!0,type:"text",value:l,onChange:(A)=>v(A.currentTarget.value),"aria-label":"Archive name",className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none mb-3 ${f?"border-error":"border-ink/20 focus:border-ink"}`}),e("label",{className:"block text-[10px] uppercase tracking-wide text-ink/40 mb-1",htmlFor:"archive-destination",children:"Destination folder"}),e("input",{id:"archive-destination",type:"text",value:c,onChange:(A)=>b(A.currentTarget.value),"aria-label":"Archive destination",className:"w-full bg-paper border border-ink/20 rounded px-2 py-1.5 text-xs font-mono focus:outline-none focus:border-ink"})]})}function fn({archive:t,kindLabel:r,destination:l,error:c,busy:p,onDestinationChange:f,onCancel:x,onSubmit:g}){return e(Tt,{title:`Extract ${t.name}`,subject:`${r} archive · extracts into a folder`,error:c,busy:p,submitLabel:"Extract",busyLabel:"Extracting...",onCancel:x,onSubmit:(v)=>{v.preventDefault(),g()},children:[e("label",{className:"block text-[10px] uppercase tracking-wide text-ink/40 mb-1",htmlFor:"extract-destination",children:"Extract to folder"}),e("input",{id:"extract-destination",autoFocus:!0,type:"text",value:l,onChange:(v)=>f(v.currentTarget.value),"aria-label":"Extract destination",className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none ${c?"border-error":"border-ink/20 focus:border-ink"}`})]})}function Et({archive:t}){if(t.compress)return e(un,{entries:t.compress.entries,format:t.compress.format,name:t.compress.name,destination:t.compress.destination,formats:t.formats,error:t.error,busy:t.busy,onFormatChange:t.setFormat,onNameChange:t.setName,onDestinationChange:t.setCompressDestination,onCancel:t.cancel,onSubmit:t.submitCompress});if(t.extract)return e(fn,{archive:t.extract.archive,kindLabel:wt(Oe(t.extract.archive.name)??"zip"),destination:t.extract.destination,error:t.error,busy:t.busy,onDestinationChange:t.setExtractDestination,onCancel:t.cancel,onSubmit:t.submitExtract});return null}function Mt(){let[t,r]=T("files.outlineExpanded",!1),l=Dr(),c=ze(Nh,Dh),{symbols:p,total:f,truncated:x,notice:g}=xd({content:c.content,language:c.language,state:c.state,note:c.note,path:c.path});if(c.state==="diff")return null;let v=c.preview,b=(m,C)=>{if(!c.path)return;if(v){let y=Td(p,C);if(y)fs({path:c.path,...y});return}Mo({path:c.path,line:m.line,column:m.column,length:m.name.length})};return e("div",{className:"border-t border-ink/10 bg-canvas/30 flex-shrink-0",children:[e("div",{className:"flex items-center hover:bg-ink/5 transition-colors",children:e("button",{type:"button",onClick:()=>r(!t),"aria-expanded":t,"aria-controls":l,"aria-label":"Outline",title:t?"Hide outline":"Show outline",className:"flex flex-1 min-w-0 items-center space-x-1 py-1.5 pl-3 pr-2 text-left font-semibold text-xs text-ink transition-colors cursor-pointer",children:[e("span",{className:"w-3 text-center font-mono","aria-hidden":"true",children:t?"▾":"▸"}),e(ia,{size:12}),e("span",{children:"Outline"}),f>0&&e("span",{className:"font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] text-ink/50",children:x?`${p.length}/${f.toLocaleString()}`:f})]})}),e("div",{className:"section-reveal","data-expanded":t,id:l,inert:!t,children:e("div",{children:e("div",{className:"px-2 pb-2",children:p.length===0?e("div",{className:"px-1 text-[10px] text-ink/40 italic py-1",children:g}):e("div",{className:"max-h-48 overflow-y-auto scrollbar-overlay-container flex flex-col",children:[p.map((m,C)=>e("button",{type:"button",onClick:()=>b(m,C),"aria-label":v?`${di(m.kind)} ${m.name}`:`${di(m.kind)} ${m.name}, line ${m.line}`,title:v?`Jump to ${di(m.kind).toLowerCase()}`:`${di(m.kind)} · line ${m.line}`,className:"flex w-full min-w-0 items-center gap-1.5 rounded px-1 py-0.5 text-left transition-colors hover:bg-ink/5 active:bg-ink/10",style:{paddingLeft:`${4+m.depth*12}px`},children:[e(vd,{kind:m.kind}),e("span",{className:"min-w-0 flex-1 truncate text-[11px] font-mono text-ink/80",children:m.name}),!v&&e("span",{className:"flex-shrink-0 font-mono text-[10px] text-ink/35",children:m.line})]},`${m.line}:${m.kind}:${m.name}`)),x&&e("div",{className:"px-1 py-1 text-[10px] italic text-ink/40",children:kd(f)})]})})})})]})}function He(t,r){return Ae(t.map((l)=>mn(l,r)))}function mn(t,r){if(t.type!=="folder")return t;let l=r[t.path];if(!l)return t;return{...t,children:He(l,r)}}function hn(t){let r=t.lastIndexOf("/");return r===-1?".":t.slice(0,r)}function $t(t){let r=t.lastIndexOf("/");return r===-1?t:t.slice(r+1)}function Lt(t){return[...t].sort((r,l)=>{if(r.type!==l.type)return r.type==="folder"?-1:1;return r.name.localeCompare(l.name)})}function Ge(t,r,l){let c=l.path.split("/"),p=c.slice(0,-1).join("/"),f=[...t],x={...r},g=f,v=null;for(let b=0;b<c.length-1;){let m=c.slice(0,b+1).join("/"),C=g.find((M)=>M.type==="folder"&&M.path===m),y=C?null:g.find((M)=>M.type==="folder"&&M.path.startsWith(`${m}/`)&&(p===M.path||p.startsWith(`${M.path}/`))),N=C??y,A=N?x[N.path]??N.children:null;if(N&&!Array.isArray(A))return{nodes:t,cache:r};if(!N){let M=gn(g,x,m);if(M){g=M;let D=g.find((R)=>R.path===m),w=Array.isArray(D?.children)?[...D.children]:[];x[m]=w,g=w,v=m,b+=1;continue}}let F=Array.isArray(A)?[...A]:[];if(N){x[N.path]=F,g=F,v=N.path,b=N.path.split("/").length;continue}g.push({name:c[b],path:m,type:"folder",ignored:!1}),x[m]=F,g=F,v=m,b+=1}if(g.push(l),v!==null)x[v]=Lt(g);return f=Lt(f),{nodes:f,cache:x}}function gn(t,r,l){let c=t.findIndex((v)=>v.type==="folder"&&v.path.startsWith(`${l}/`));if(c===-1)return null;let p=t[c],f=p.path.slice(l.length+1).split("/"),x=r[p.path]??p.children;if(Array.isArray(x))r[p.path]=x;let g={name:f[f.length-1],path:p.path,type:"folder",ignored:p.ignored,...Array.isArray(x)?{children:x}:{}};for(let v=f.length-2;v>=0;v-=1)g={name:f[v],path:`${l}/${f.slice(0,v+1).join("/")}`,type:"folder",ignored:!1,children:[g]};return t[c]={name:$t(l),path:l,type:"folder",ignored:!1,children:[g]},t}function zt(t,r,l){let c=t.find((m)=>m.path===l);if(c)return{entry:c,nodes:t.filter((m)=>m.path!==l),cache:r};let p=hn(l),f=r[p],x=f?.find((m)=>m.path===l);if(f&&x)return{entry:x,nodes:t,cache:{...r,[p]:f.filter((m)=>m.path!==l)}};let v=Object.keys(r).filter((m)=>l.startsWith(`${m}/`)&&r[m].some((C)=>C.path===l)).sort((m,C)=>C.length-m.length)[0];if(!v)return{entry:null,nodes:t,cache:r};let b=r[v];return{entry:b.find((m)=>m.path===l),nodes:t,cache:{...r,[v]:b.filter((m)=>m.path!==l)}}}function Ot(t,r,l){let c=!1,p=t.map((f)=>{let x=f.path===r||f.path.startsWith(`${r}/`),g=Array.isArray(f.children)?Ot(f.children,r,l):void 0;if(!x&&g===f.children)return f;c=!0;let v=x?f.path===r?l:`${l}${f.path.slice(r.length)}`:f.path,b=x?{...f,path:v,name:$t(v)}:{...f};if(g!==void 0)b.children=g;return b});return c?p:t}function Pt(t,r,l){let c={};for(let[p,f]of Object.entries(t)){let x=p===r?l:p.startsWith(`${r}/`)?`${l}${p.slice(r.length)}`:p;c[x]=x===p?f:Ot(f,r,l)}return c}function It(t,r,l){let c=new Set;for(let p of t)if(p===r)c.add(l);else if(p.startsWith(`${r}/`))c.add(`${l}${p.slice(r.length)}`);else c.add(p);return c}function Ht(t){if(!k(t))return{status:"missing"};if(typeof t.root!=="string"||t.root==="")return{status:"missing"};return{status:"ok",files:Array.isArray(t.files)?t.files.filter((r)=>k(r)):[],root:t.root}}async function Ke(t){try{return Ht(await(await fetch(t)).json())}catch{return{status:"failed"}}}function Gt({enabled:t,rootPath:r,activeRepo:l,expandedPaths:c,onExpansionPruned:p}){let f=`${r??""}\x00${l}`,[x,g]=n({scope:"",files:[],root:""}),[v,b]=n(!1),m=i({}),C=i([]),y=i(f);y.current=f;let N=i(""),A=i(""),F=i(c);F.current=c;let M=(P)=>{let z=new URLSearchParams;if(r)z.set("root",r);if(l&&l!==".")z.set("repo",l);if(P)z.set("path",P);return z.set("t",String(Date.now())),`/api/fs/dir?${z.toString()}`},D=(P,z)=>{N.current=P,A.current=z;let G=He(C.current,m.current);return g({scope:P,files:G,root:z}),G},w=async(P)=>{let z=[...F.current];if(z.length===0)return;let G=await Promise.all(z.map(async(X)=>({path:X,read:await Ke(M(X))})));if(y.current!==P)return;let K=[];for(let{path:X,read:J}of G)if(J.status==="ok")m.current[X]=J.files;else if(J.status==="missing")K.push(X);if(K.length===0)return;let re=new Set(K);for(let X of K)delete m.current[X];let q=new Set([...F.current].filter((X)=>!re.has(X)));F.current=q,p(q)},R=async()=>{if(!t)return;let P=y.current;b(!0);try{let z=await Ke(M());if(y.current!==P)return;if(z.status!=="ok")return;if(N.current!==P)m.current={};if(C.current=z.files,D(P,z.root),await w(P),y.current!==P)return;D(P,z.root)}finally{if(y.current===P)b(!1)}},I=async(P)=>{let z=y.current,G=await Ke(M(P));if(y.current!==z||G.status!=="ok")return;if(m.current[P]=G.files,N.current===z)D(z,A.current)},_=(P)=>{let z=Ht(P);if(z.status!=="ok")return;let G=y.current;if(N.current!==G)m.current={};C.current=z.files,D(G,z.root),w(G).then(()=>{if(y.current===G)D(G,z.root)})},te=()=>{m.current={},C.current=[],N.current="",A.current="",g({scope:"",files:[],root:""})},ne=(P)=>{let z=y.current;if(N.current!==z)return null;let G={name:P.path.slice(P.path.lastIndexOf("/")+1),path:P.path,type:P.kind,ignored:!1},K=Ge(C.current,m.current,G);if(K.nodes===C.current)return null;return C.current=K.nodes,m.current=K.cache,D(z,A.current)},se=(P,z)=>{let G=y.current;if(N.current!==G)return null;let K=zt(C.current,m.current,P);if(!K.entry)return null;m.current=Pt(K.cache,P,z);let re={...K.entry,path:z,name:z.slice(z.lastIndexOf("/")+1)},q=Ge(K.nodes,m.current,re);return C.current=q.nodes,m.current=q.cache,D(G,A.current)},H=x.scope===f;return{scope:f,files:H?x.files:[],root:H?x.root:"",isLoading:v,reload:R,loadChildren:I,adoptRoot:_,insertEntry:ne,moveEntry:se,reset:te}}function Kt({rootPath:t,repo:r,onComplete:l,onError:c}){let p=ft(),[f,x]=T("files.clipboard",null),g=ht(f),v=at(t,r),b=i(!1),m=i(null);o(()=>{if(p.state!=="idle"||!p.data)return;let F=p.data;if(m.current===F)return;m.current=F;let M=b.current;if(b.current=!1,F.success){if(M)x(null);if(F.failures?.length)c(`${F.failures.length} item(s) could not be moved: ${F.failures[0].error}`);l()}else c(F.error||"The transfer did not complete")},[p.state,p.data]);let C=a((F,M)=>{b.current=M;let D=new FormData;for(let[w,R]of Object.entries(F))D.append(w,R);if(r&&r!==".")D.append("repo",r);if(t)D.append("root",t);p.submit(D,{method:"post",action:"/api/fs/action"})},[p,r,t]),y=a((F)=>ut(g,v,Le(F.path,F.kind)),[g,v]),N=a((F,M)=>pt(F,Le(M.path,M.kind)),[]),A=a((F,M,D,w)=>{let R=new FormData;R.append("actionType","paste"),R.append("mode",D),R.append("targetPath",M.path),R.append("targetKind",M.kind);for(let I of F)R.append("sourcePath",I.path);if(r&&r!==".")R.append("repo",r);if(t)R.append("root",t);b.current=w,p.submit(R,{method:"post",action:"/api/fs/action"})},[p,r,t]);return{clip:g,busy:p.state!=="idle",refusalFor:y,moveRefusalFor:N,copy:(F)=>{if(F.length===0)return;x({scope:v,entries:F.map(({path:M,name:D,kind:w})=>({path:M,name:D,kind:w})),mode:"copy"})},cut:(F)=>{if(F.length===0)return;x({scope:v,entries:F.map(({path:M,name:D,kind:w})=>({path:M,name:D,kind:w})),mode:"cut"})},duplicate:(F)=>{C({actionType:"duplicate",path:F.path},!1)},move:(F,M)=>{let D=N(F,M);if(D){c(D);return}A([F],M,"cut",Boolean(g?.mode==="cut"&&g.entries.some((w)=>w.path===F.path)))},paste:(F)=>{if(!g)return;let M=y(F);if(M){c(M);return}A(g.entries.map(({path:D,name:w,kind:R})=>({path:D,name:w,kind:R})),F,g.mode,g.mode==="cut")}}}var bn=$e.map((t)=>({...t,available:!0,tool:t.id}));function jt({rootPath:t,repo:r,onComplete:l}){let c=ft(),[p,f]=n(bn),[x,g]=n(null),[v,b]=n(null),[m,C]=n(null),y=i(null),N=i(null);o(()=>{let w=!1;return(async()=>{try{let I=await(await fetch("/api/fs/archive")).json();if(!w&&Array.isArray(I.formats)&&I.formats.length>0)f(I.formats)}catch{}})(),()=>{w=!0}},[]),o(()=>{if(c.state!=="idle"||!c.data)return;let w=c.data;if(N.current===w)return;N.current=w;let R=y.current;if(y.current=null,w.success){if(C(null),R==="compress")g(null);if(R==="extract")b(null);l()}else if(R)C(w.error||"The archive request failed")},[c.state,c.data]);let A=a((w)=>{let R=new FormData;for(let[I,_]of Object.entries(w))R.append(I,_);if(r&&r!==".")R.append("repo",r);if(t)R.append("root",t);c.submit(R,{method:"post",action:"/api/fs/action"})},[c,r,t]),F=a((w)=>{if(w.length===0)return;let R=p.find((I)=>I.id==="zip"&&I.available)?.id??p.find((I)=>I.available)?.id??"zip";C(null),b(null),g({entries:w.map(({path:I,name:_,kind:te})=>({path:I,name:_,kind:te})),format:R,name:De(w,R),destination:Ft(w)})},[p]),M=a((w)=>{C(null),g(null),b({archive:w,destination:Nt(w.path)})},[]),D=a((w)=>{g((R)=>{if(!R)return R;let I=De(R.entries,R.format),_=R.name===I?De(R.entries,w):R.name;return{...R,format:w,name:_}})},[]);return{formats:p,compress:x,extract:v,error:m,busy:c.state!=="idle",openCompress:F,openExtract:M,setFormat:D,setName:(w)=>g((R)=>R&&{...R,name:w}),setCompressDestination:(w)=>g((R)=>R&&{...R,destination:w}),setExtractDestination:(w)=>b((R)=>R&&{...R,destination:w}),cancel:()=>{g(null),b(null),C(null)},submitCompress:()=>{let w=x;if(!w)return;y.current="compress",C(null),A({actionType:"compress",format:w.format,name:w.name.trim(),destination:w.destination.trim()||".",paths:JSON.stringify(w.entries.map((R)=>R.path))})},submitExtract:()=>{let w=v;if(!w)return;y.current="extract",C(null),A({actionType:"extract",path:w.archive.path,destination:w.destination.trim()||"."})}}}function xn(t){if(t.shiftKey)return"range";if(t.metaKey||t.ctrlKey)return"toggle";return"plain"}function vn(t,r,l){if(!r)return[l];let c=t.indexOf(r),p=t.indexOf(l);if(c===-1||p===-1)return[l];let f=Math.min(c,p),x=Math.max(c,p);return t.slice(f,x+1)}function _t(t){let[r,l]=n(()=>new Set),[c,p]=n(null),f=a((b,m)=>{if(b==="range"){l(new Set(vn(t,c,m)));return}if(p(m),b==="toggle"){l((C)=>{let y=new Set(C);if(y.has(m))y.delete(m);else y.add(m);return y});return}l(new Set([m]))},[c,t]),x=a((b)=>{l((m)=>{if(m.has(b))return m;return new Set([b])}),p(b)},[]),g=a(()=>{l(new Set),p(null)},[]),v=a(xn,[]);return u(()=>({selected:r,count:r.size,anchor:c,gestureOf:v,applyGesture:f,ensureForContext:x,clear:g}),[r,c,v,f,x,g])}function je(t,r,l=0,c=[]){for(let p of t)if(c.push({path:p.path,name:p.name,kind:p.type==="folder"?"folder":"file",depth:l}),p.type==="folder"&&r(p)&&Array.isArray(p.children))je(p.children,r,l+1,c);return c}function Wt({listing:t,setExpandedPaths:r,setStoredExpandedPaths:l,reload:c,onMoved:p}){let f=a((v,b)=>{let m=st(b,v);if(m.length===0)return;r((C)=>{if(m.every((N)=>C.has(N)))return C;let y=new Set(C);for(let N of m)y.add(N);return l(Array.from(y)),y})},[r,l]),x=a((v)=>{let b=t.insertEntry(v);if(!b){c();return}f(v.path,b)},[t,c,f]),g=a((v,b)=>{p?.(v,b),r((C)=>{let y=It(C,v,b);return l(Array.from(y)),y});let m=t.moveEntry(v,b);if(!m){c();return}f(b,m)},[t,c,f,r,l,p]);return{insertCreated:x,moveRenamed:g}}var kn=new Set;function Ut({scope:t,setExpandedPaths:r,setStoredExpandedPaths:l}){let[c,p]=n({scope:t,chains:new Map}),f=a((v)=>{let b=Me(v.path,v.name);if(!b)return;p((C)=>{let y=C.scope===t?C.chains:new Map;if(y.get(v.path)?.length===b.length)return C;let A=new Map(y);return A.set(v.path,b),{scope:t,chains:A}});let m=b.slice(0,-1);r((C)=>{if(m.every((N)=>C.has(N)))return C;let y=new Set(C);for(let N of m)y.add(N);return l(Array.from(y)),y})},[t,r,l]),x=a((v)=>{let b=c.scope===t?c.chains.get(v):void 0;if(!b)return;let m=b.slice(0,-1);p((C)=>{if(C.scope!==t)return C;let y=new Map(C.chains);return y.delete(v),{scope:t,chains:y}}),r((C)=>{if(!m.some((N)=>C.has(N)))return C;let y=new Set(C);for(let N of m)y.delete(N);return l(Array.from(y)),y})},[t,c,r,l]),g=a((v,b)=>{let m=c.scope===t?c.chains:null;if(!m)return;let C=new Map,y=[],N=!1;for(let[A,F]of m){if(F.findIndex((R,I)=>R===v&&I>0&&I<F.length-1)!==-1){N=!0;continue}let D=F.map((R)=>R===v?b:R.startsWith(`${v}/`)?`${b}${R.slice(v.length)}`:R),w=D[D.length-1];if(w!==A||D.some((R,I)=>R!==F[I]))N=!0;C.set(w,D),y.push(...D.slice(0,-1))}if(!N)return;p({scope:t,chains:C}),r((A)=>{if(y.every((M)=>A.has(M)))return A;let F=new Set(A);for(let M of y)F.add(M);return l(Array.from(F)),F})},[t,c,r,l]);return{unfolded:c.scope===t&&c.chains.size>0?new Set(c.chains.keys()):kn,unfold:f,fold:x,rekey:g}}function Vt(t,r){let l=r.trim().toLowerCase();if(!l)return t;let c=(p)=>{let f=p.name.toLowerCase().includes(l);if(p.type==="folder"){let x=(p.children||[]).map(c).filter((g)=>g!==null);if(f||x.length>0)return{...p,children:f&&x.length===0?p.children:x,forceExpanded:!0};return null}return f?p:null};return t.map(c).filter((p)=>p!==null)}function Xt({dragging:t,clipboard:r,target:l}){let c=Boolean(t)&&r.moveRefusalFor(t,l)===null,[p,f]=n(!1);return o(()=>{if(!t)f(!1)},[t]),{accepts:c,highlighted:p&&c,onDragEnter:()=>{if(t)f(!0)},onDragLeave:(x)=>{if(!x.currentTarget.contains(x.relatedTarget))f(!1)},onDragOver:(x)=>{if(!c)return;if(x.preventDefault(),x.dataTransfer)x.dataTransfer.dropEffect="move"},onDrop:(x)=>{if(!c)return;x.preventDefault(),f(!1),r.move(t,l)}}}function ri({className:t="",enabled:r=!0,active:l=!0,rootPath:c,onOpenFile:p,refreshKey:f=0,onRefresh:x}){let[g,v]=T("files.searchQuery",""),[b,m,C]=T("files.expandedPaths",[]),[y,N]=n(()=>new Set(b)),{activeRepo:A,setActiveRepo:F}=xr(c),{repos:M,scanning:D,rescan:w}=wr(c,r),{fileMap:R,folderMap:I,refreshGitStatus:_}=hl(c,A,r),[te,ne]=n(null),se=i(null);o(()=>{if(!C)return;N((O)=>{let ee=new Set(b);if(O.size===ee.size&&Array.from(ee).every((me)=>O.has(me)))return O;return ee})},[C,b]);let H=Gt({enabled:r,rootPath:c,activeRepo:A,expandedPaths:y,onExpansionPruned:(O)=>{N(O),m(Array.from(O))}});o(()=>{if(!C||!l)return;H.reload()},[f,c,r,A,C,l]);let P=r&&C?yh(H.scope):null,z=Te(P);o(()=>{if(z.data)H.adoptRoot(z.data)},[z.data]);let G=(O)=>(_(),H.loadChildren(O)),K=(O,ee)=>{let me=new Set(y);if(ee)me.add(O);else me.delete(O);N(me),m(Array.from(me))},{unfolded:re,unfold:q,fold:X,rekey:J}=Ut({scope:H.scope,setExpandedPaths:N,setStoredExpandedPaths:m}),oe=H.files,ge=it(oe,re),B=Vt(ge.nodes,g),fe=je(B,(O)=>O.forceExpanded!==void 0?O.forceExpanded:y.has(O.path)),le=_t(fe.map((O)=>O.path)),ve=fe.filter((O)=>le.selected.has(O.path)).map(({path:O,name:ee,kind:me})=>({path:O,name:ee,kind:me})),L=(O)=>{if(O===A)return;H.reset(),N(new Set),m([]),le.clear(),F(O)},j=()=>{if(_(),x)x();else H.reload()},{insertCreated:ce,moveRenamed:ke}=Wt({listing:H,setExpandedPaths:N,setStoredExpandedPaths:m,reload:j,onMoved:(O,ee)=>J(O,ee)}),xe=As(),{pushToast:W}=We(),Y=Kt({rootPath:c,repo:A,onComplete:j,onError:(O)=>W(O,"error")}),Ce=jt({rootPath:c,repo:A,onComplete:j}),ye={path:".",name:".",kind:"folder"},de=Y.clip&&!Y.refusalFor(ye)?`Paste ${we(Y.clip)??"item"}`:null,[V,be]=n(null),pe=Xt({dragging:V,clipboard:Y,target:ye}),Re=Ne({folderPath:".",rootPath:c,repo:A,onCreated:ce,onOpenCreated:(O)=>p?.({...O,root:c,repo:A})}),[_e,qt]=n(!1);o(()=>qt(!0),[]);let{count:Ue,clear:Ve}=le;if(o(()=>{if(!l)return;let O=(ee)=>{if(ee.key==="Escape"&&Ue>0)Ve()};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[l,Ue,Ve]),!r)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${t}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});let Qt=H.isLoading||z.refreshing;return e("div",{className:`flex flex-col h-full bg-paper ${t}`,children:[e(Qe,{rootPath:c,activeRepo:A,repos:M,reposScanning:D,onRefreshRepos:w,onSelectRepo:L,searchQuery:g,onSearchChange:v,onRefresh:j,refreshing:Qt}),e("div",{className:`flex-1 scrollbar-overlay-container p-2 font-mono text-[11px] text-ink/80 ${xe?"file-tree-touch":""} ${pe.highlighted?"bg-info/[0.06]":""}`,onContextMenu:(O)=>{O.preventDefault(),ne({x:O.clientX,y:O.clientY})},onDragEnter:pe.onDragEnter,onDragLeave:pe.onDragLeave,onDragOver:pe.onDragOver,onDrop:pe.onDrop,children:H.isLoading&&B.length===0?e("div",{className:"p-4 text-center text-ink/40",children:"Loading files..."}):B.length===0?e("div",{className:"p-4 text-center text-ink/40",children:"No files found"}):B.map((O)=>e(Pe,{file:O,rootPath:c,basePath:H.root,repo:A,onLoadChildren:G,onOpenFile:p,onActionComplete:j,onCreated:ce,onRenamed:ke,expandedPaths:y,onToggleFolder:K,gitFileMap:R,gitFolderMap:I,clipboard:Y,archive:Ce,selection:le,selectionTargets:ve,dragging:V,onDragStart:be,onDragEnd:()=>be(null),onDropOn:(ee)=>{if(!V)return;Y.move(V,ee)},onUnfold:q,onFold:X,foldRoots:ge.roots,touch:xe},O.path))}),e(Mt,{}),_e&&e(At,{menu:te,menuRef:se,pasteLabel:de,busy:Y.busy,create:Re,onAction:(O)=>{if(ne(null),O==="new_file")Re.openDialog("file");if(O==="new_folder")Re.openDialog("folder");if(O==="paste")Y.paste(ye)}}),_e&&e(Et,{archive:Ce})]})}export{ri as FileExplorer};
@@ -1 +0,0 @@
1
- import{d,n,o,i,u,a,le,e,s,f,E,ue,Qo,ae,pe,h,Em,Te,T,xt,so,nt,he,Re,Sh,Ei}from"./index-st6a8q5z.js";var se={name:"chevrons-up-down",size:24,node:[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]},F=s(se);function O(l,r,c=1e6){return{sessionId:l,sessionTitle:r,modelId:"",modelName:"",timestamp:"",contextUsed:0,contextLimit:c,contextPercent:0,messagesCount:0,userCount:0,assistantCount:0,totalCost:0,costFormatted:"$0.00",cacheHitAverage:0,costBreakdown:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0},lastMessage:{input:0,output:0,reasoning:0,cacheRead:0,cacheWrite:0,cacheHitPercent:0},distribution:{userTokens:0,userPercent:0,assistantTokens:0,assistantPercent:0,toolTokens:0,toolPercent:0,otherTokens:0,otherPercent:100},rawMessages:[]}}function J({used:l,limit:r,percent:c}){let b=l.toLocaleString(),x=r.toLocaleString(),m=Math.min(100,Math.max(0,c));return e("div",{className:"bg-canvas border border-ink/10 rounded-xl p-4 transition-all",children:[e("div",{className:"flex items-center justify-between text-xs mb-2",children:[e("span",{className:"font-semibold text-ink/80",children:"Context"}),e("span",{className:"font-mono text-ink/70 text-[11px]",children:[b," / ",x]})]}),e("div",{className:"w-full h-1.5 bg-ink/10 rounded-full overflow-hidden mb-2",children:e("div",{className:"h-full bg-ink/70 rounded-full transition-all duration-500 ease-out",style:{width:`${m}%`}})}),e("div",{className:"text-[11px] font-mono text-ink/50 text-left",children:[m.toFixed(1),"% used"]})]})}function L(l){return l<0.01?"$0.01":`$${l.toFixed(6).replace(/0+$/,"").replace(/\.$/,"")}`}function Z({open:l,onClose:r,breakdown:c,costFormatted:b}){let x=i(null);if(he(x,r),!l)return null;let m=c?[{label:"Total Cost",value:L(c.total),strong:!0},{label:"Input (cache miss)",value:L(c.input)},{label:"Output",value:L(c.output)},{label:"Cache Read (cache hit)",value:L(c.cacheRead)},{label:"Cache Write",value:L(c.cacheWrite)}]:[{label:"Total Cost",value:b??"$0.01",strong:!0}];return e("div",{ref:x,className:"glass-popover absolute top-full right-0 mt-1.5 z-50 w-64 bg-paper border border-ink/10 rounded-lg shadow-lg p-3",role:"dialog","aria-modal":"false",children:[e("div",{className:"flex items-center justify-between mb-2.5",children:[e("span",{className:"text-xs font-semibold text-ink tracking-tight",children:"Cost Breakdown"}),e("button",{type:"button",onClick:r,className:"p-1 rounded hover:bg-ink/5 text-ink/60 hover:text-ink transition-colors","aria-label":"Close cost breakdown",children:e(h,{size:14})})]}),e("div",{className:"space-y-1.5",children:m.map((t)=>e("div",{className:"flex items-center justify-between text-[11px] font-mono border-b border-ink/5 last:border-0 pb-1.5 last:pb-0",children:[e("span",{className:"text-ink/60",children:t.label}),e("span",{className:`${t.strong?"font-semibold text-ink":"text-ink/80"}`,children:t.value})]},t.label))})]})}function V({messagesCount:l,userCount:r,assistantCount:c,costFormatted:b,cacheHitAverage:x,costBreakdown:m}){let[t,v]=n(!1);return e(d,{children:[e("div",{className:"mb-1.5",children:e("span",{className:"text-xs font-semibold text-ink/80",children:"Session Stats"})}),e("div",{className:"flex gap-2 flex-wrap",children:[e(Re,{variant:"compact",label:"Messages",value:l}),e(Re,{variant:"compact",label:"User",value:r}),e(Re,{variant:"compact",label:"Assistant",value:c}),e(Re,{variant:"compact",label:"Cache Hit",value:x!==void 0?`${x.toFixed(1)}%`:"–"}),e("div",{className:"relative bg-canvas border border-ink/10 rounded-lg px-2.5 py-1.5 flex flex-col gap-0.5 flex-1 min-w-0",children:[e("span",{className:"text-[10px] font-medium text-ink/50 flex items-center gap-1",children:["Cost",e("button",{type:"button",onClick:()=>v(!0),className:"p-0.5 rounded text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors","aria-label":"Show cost breakdown",title:"Cost breakdown",children:e(pe,{size:11})})]}),e("span",{className:"text-xs font-semibold font-mono text-ink truncate",children:b}),e(Z,{open:t,onClose:()=>v(!1),breakdown:m,costFormatted:b})]})]})]})}function z({input:l,output:r,reasoning:c,cacheRead:b,cacheWrite:x,cacheHitPercent:m}){return e(d,{children:[e("div",{className:"mb-1.5",children:e("span",{className:"text-xs font-semibold text-ink/80",children:"Last Assistant Message"})}),e("div",{className:"flex gap-2 flex-wrap",children:[e(Re,{variant:"compact",label:"In",value:l.toLocaleString()}),e(Re,{variant:"compact",label:"Out",value:r.toLocaleString()}),e(Re,{variant:"compact",label:"Reason",value:c.toLocaleString()}),e(Re,{variant:"compact",label:"Cache",value:`${b.toLocaleString()}/${x.toLocaleString()}`}),e(Re,{variant:"compact",label:"Hit",value:`${m.toFixed(1)}%`})]})]})}function Q({userPercent:l,assistantPercent:r,toolPercent:c,otherPercent:b}){return e("div",{className:"space-y-2.5",children:[e("div",{className:"w-full h-1.5 rounded-full overflow-hidden flex bg-ink/10",children:[e("div",{className:"h-full bg-emerald-500 transition-all duration-300",style:{width:`${l}%`},title:`User: ${l}%`}),e("div",{className:"h-full bg-sky-500 transition-all duration-300",style:{width:`${r}%`},title:`Assistant: ${r}%`}),e("div",{className:"h-full bg-amber-500 transition-all duration-300",style:{width:`${c}%`},title:`Tool Calls: ${c}%`}),e("div",{className:"h-full bg-slate-400 transition-all duration-300",style:{width:`${b}%`},title:`Other: ${b}%`})]}),e("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-[11px] text-ink/70",children:[e("div",{className:"flex items-center space-x-1.5",children:[e("span",{className:"w-2 h-2 rounded-full bg-emerald-500 flex-shrink-0"}),e("span",{children:["User ",l,"%"]})]}),e("div",{className:"flex items-center space-x-1.5",children:[e("span",{className:"w-2 h-2 rounded-full bg-sky-500 flex-shrink-0"}),e("span",{children:["Assistant ",r,"%"]})]}),e("div",{className:"flex items-center space-x-1.5",children:[e("span",{className:"w-2 h-2 rounded-full bg-amber-500 flex-shrink-0"}),e("span",{children:["Tool Calls ",c,"%"]})]}),e("div",{className:"flex items-center space-x-1.5",children:[e("span",{className:"w-2 h-2 rounded-full bg-slate-400 flex-shrink-0"}),e("span",{children:["Other ",b,"%"]})]})]})]})}function G({data:l}){Ei();let[r,c]=n(!1),b=i(null),x=i(null),m=JSON.stringify(l,null,2),t=Sh(m),v=a((C)=>{let g=x.current;if(!g)return;g.scrollLeft=C.currentTarget.scrollLeft,g.scrollTop=C.currentTarget.scrollTop},[]),y=a(async(C)=>{C.stopPropagation();try{await navigator.clipboard.writeText(m)}catch{let g=document.createElement("textarea");g.value=m,g.style.position="fixed",g.style.opacity="0",document.body.appendChild(g),g.select(),document.execCommand("copy"),document.body.removeChild(g)}c(!0),setTimeout(()=>c(!1),2000)},[m]);return e("div",{className:"relative my-1.5 rounded-lg bg-paper/80 border border-ink/10 overflow-hidden",children:[e("div",{className:"flex items-center justify-between px-2.5 py-1.5 bg-ink/[0.04] border-b border-ink/10",children:[e("span",{className:"text-[10px] font-mono text-ink/50 select-none",children:[Object.keys(l).length," keys · ",m.length," chars"]}),e("button",{type:"button",onClick:y,className:"flex items-center space-x-1 px-2 py-1 rounded bg-canvas hover:bg-paper text-ink/70 hover:text-ink border border-ink/10 text-[10px] transition-colors shadow-xs",title:"Copy Pretty JSON",children:r?e(d,{children:[e(f,{size:11,className:"text-success"}),e("span",{className:"text-success font-sans font-medium",children:"Copied"})]}):e(d,{children:[e(ae,{size:11}),e("span",{className:"font-sans",children:"Copy JSON"})]})})]}),e("div",{className:"relative",children:[e("pre",{ref:x,"aria-hidden":!0,className:"absolute inset-0 p-2.5 m-0 font-mono text-[11px] leading-5 overflow-x-auto overflow-y-auto whitespace-pre pointer-events-none",dangerouslySetInnerHTML:{__html:t}}),e("pre",{ref:b,onScroll:v,className:"relative p-2.5 m-0 font-mono text-[11px] leading-5 overflow-x-auto overflow-y-auto whitespace-pre select-text selection:bg-ink selection:text-canvas",children:e("code",{className:"text-transparent",children:m})})]})]})}var j=["bg-emerald-500","bg-sky-500","bg-amber-500","bg-violet-500","bg-rose-500","bg-teal-500","bg-indigo-500","bg-fuchsia-500","bg-lime-500","bg-cyan-500","bg-orange-500","bg-pink-500","bg-yellow-500","bg-purple-500","bg-red-500","bg-blue-500","bg-green-500","bg-cyan-600","bg-violet-600","bg-amber-600"],_=20;function K(l){let r=0;for(let c=0;c<l.length;c++)r=r*31+l.charCodeAt(c)|0;return Math.abs(r)}function q(l){let r=l.indexOf("/"),c=r>0?l.slice(0,r):l,b=r>0?l.slice(r+1):"";return b?`${c} · ${b}`:c}function Y(l,r){if(r<=7)return Array.from({length:r},(t,v)=>v+1);let c=new Set([1,r,l,l-1,l+1]);if(l<=3)[2,3,4].forEach((t)=>c.add(t));if(l>=r-2)[r-3,r-2,r-1].forEach((t)=>c.add(t));let b=[...c].filter((t)=>t>=1&&t<=r).sort((t,v)=>t-v),x=[],m=0;for(let t of b){if(t-m>1)x.push("…");x.push(t),m=t}return x}function X({sessionId:l,refreshKey:r=0}){let[c,b]=T("context.rawExpandedIds",{}),[x,m]=T("context.rawFilterRole","all"),[t,v]=n(1),[y,C]=n([]),[g,I]=n(0),[W,S]=n(!1),w=i(0),U=i(!1),B=a((p)=>{if(typeof window>"u")return;let k=++w.current;if(!p?.silent)S(!0);let P=new URLSearchParams({page:String(t),pageSize:String(_),role:x});if(l)P.set("sessionId",l);fetch(`/api/telemetry/raw-messages?${P.toString()}`).then((N)=>N.ok?N.json():null).then((N)=>{if(U.current||k!==w.current)return;C(N&&Array.isArray(N.items)?N.items:[]),I(N&&Number.isFinite(N.filteredTotal)?N.filteredTotal:0)}).catch(()=>{if(U.current||k!==w.current)return;C([]),I(0)}).finally(()=>{if(!p?.silent&&k===w.current)S(!1)})},[l,t,x]);o(()=>(U.current=!1,B(),()=>{U.current=!0}),[B,r]);let R=Math.max(1,Math.ceil(g/_)),M=Math.min(t,R),D=(p)=>v(Math.min(Math.max(1,p),R)),ee=(p)=>{b((k)=>({...k,[p]:!k[p]}))},te=()=>{if(y.every((k)=>c[k.id]))b({});else{let k={};y.forEach((P)=>{k[P.id]=!0}),b(k)}},H=u(()=>{let p=[];for(let k of y){let P=k.info.modelID;if(!P||p.includes(P))continue;p.push(P)}return p},[y]),A=(p)=>p?j[K(p)%j.length]:"bg-ink/20";return e("div",{className:"space-y-3",children:[H.length>0&&e("div",{children:[e("div",{className:"mb-1.5",children:e("span",{className:"text-xs font-semibold text-ink/80",children:"Legend"})}),e("div",{className:"bg-canvas border border-ink/10 rounded-xl px-3 py-2",children:e("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] font-mono text-ink/60",children:H.map((p)=>e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:`w-2 h-2 rounded-full ${A(p)}`}),e("span",{children:q(p)})]},p))})})]}),e("div",{className:"flex items-center justify-between",children:[e("div",{className:"flex items-center space-x-2",children:[e("span",{className:"text-xs font-semibold text-ink/80",children:"Raw Messages"}),e("span",{className:"text-[10px] font-mono text-ink/50 bg-ink/5 px-1.5 py-0.5 rounded-full border border-ink/10",children:g})]}),e("div",{className:"flex items-center space-x-1",children:[e("div",{className:"flex items-center bg-canvas border border-ink/10 rounded-lg p-0.5 text-[10px]",children:[e("button",{type:"button",onClick:()=>{m("all"),v(1)},className:`px-1.5 py-0.5 rounded ${x==="all"?"bg-ink text-canvas font-medium":"text-ink/60 hover:text-ink"}`,children:"All"}),e("button",{type:"button",onClick:()=>{m("assistant"),v(1)},className:`px-1.5 py-0.5 rounded ${x==="assistant"?"bg-ink text-canvas font-medium":"text-ink/60 hover:text-ink"}`,children:"AI"}),e("button",{type:"button",onClick:()=>{m("user"),v(1)},className:`px-1.5 py-0.5 rounded ${x==="user"?"bg-ink text-canvas font-medium":"text-ink/60 hover:text-ink"}`,children:"User"})]}),e("button",{type:"button",onClick:te,className:"p-1 rounded text-ink/60 hover:text-ink hover:bg-ink/5 transition-colors text-[10px] flex items-center",title:"Expand / Collapse All",children:e(F,{size:14})})]})]}),e("div",{className:"space-y-1.5",children:!W&&y.length===0?e("div",{className:"p-4 text-center text-xs text-ink/40 italic bg-canvas rounded-xl border border-ink/10",children:"No raw messages recorded yet."}):y.map((p)=>{let k=Boolean(c[p.id]);return e("div",{className:`bg-canvas border border-ink/10 rounded-xl overflow-hidden transition-all duration-200 ${W?"opacity-50":""}`,children:[e("button",{type:"button",onClick:()=>ee(p.id),className:"w-full text-left px-3.5 py-2.5 flex items-center justify-between hover:bg-ink/5 transition-colors cursor-pointer",children:[e("div",{className:"flex items-center space-x-2 min-w-0 flex-1 mr-2",children:[e("span",{className:"text-ink/40 flex-shrink-0",children:k?e(E,{size:14}):e(ue,{size:14})}),e("span",{className:"text-xs font-mono text-ink/90 truncate",children:p.badgeLabel})]}),e("div",{className:"flex items-center space-x-3 text-[11px] font-mono text-ink/50 flex-shrink-0",children:[p.tokenSummary&&e("span",{className:"text-ink/60",children:p.tokenSummary}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:`w-2 h-2 rounded-full ${A(p.info.modelID)}`}),e("span",{children:p.timestamp})]})]})]}),k&&e("div",{className:"px-3.5 pb-3 pt-1 border-t border-ink/5 bg-canvas/60",children:e(G,{data:p.rawPayload})})]},p.id)})}),R>1&&e("div",{className:"flex items-center justify-between pt-1",children:[e("span",{className:"text-[10px] font-mono text-ink/50",children:[(M-1)*_+1,"–",Math.min(M*_,g)," of ",g]}),e("div",{className:"flex items-center gap-0.5",children:[e("button",{type:"button",disabled:M<=1,onClick:()=>D(M-1),className:"p-1 rounded text-ink/60 hover:text-ink hover:bg-ink/5 disabled:opacity-30 disabled:hover:bg-transparent transition-colors",title:"Previous page",children:e(Qo,{size:14})}),Y(M,R).map((p,k)=>p==="…"?e("span",{className:"px-1 text-[10px] font-mono text-ink/40 select-none",children:"…"},`gap-${k}`):e("button",{type:"button",onClick:()=>D(p),className:`min-w-[22px] h-[22px] px-1 rounded text-[10px] font-mono transition-colors ${p===M?"bg-ink text-canvas font-medium":"text-ink/60 hover:text-ink hover:bg-ink/5"}`,children:p},p)),e("button",{type:"button",disabled:M>=R,onClick:()=>D(M+1),className:"p-1 rounded text-ink/60 hover:text-ink hover:bg-ink/5 disabled:opacity-30 disabled:hover:bg-transparent transition-colors",title:"Next page",children:e(ue,{size:14})})]})]})]})}function mt({className:l="",enabled:r=!0,refreshKey:c=0,tabsMode:b=!1}){let[x]=le(),m=x.get("sessionId"),[t,v]=n(()=>O(m||"default","Session not started")),y=i(!1),C=a(()=>{if(typeof window>"u")return;let S=m?`?sessionId=${encodeURIComponent(m)}`:"";fetch(`/api/telemetry/context${S}`).then((w)=>w.ok?w.json():null).then((w)=>{if(!y.current&&w&&w.telemetry)v(w.telemetry)}).catch((w)=>{if(!y.current)console.warn("Failed to fetch context telemetry:",w)})},[m]);o(()=>{if(y.current=!1,!r)return;return C(),()=>{y.current=!0}},[r,c,C]);let g=Te(m?Em(m):null,{enabled:r}),[I,W]=n(0);if(o(()=>{if(g.data)v(g.data),W((S)=>S+1)},[g.data]),!r)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${l}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});if(t.messagesCount===0)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${l}`,children:e("span",{className:"text-xs font-mono",children:"Session not started"})});return e("div",{className:`flex flex-col h-full bg-paper text-ink overflow-hidden select-none ${l}`,children:[e(xt,{left:e(d,{children:[e(so,{id:"context",tabsMode:b,children:e("h2",{className:"text-xs font-medium text-ink tracking-tight truncate",children:t.sessionTitle})}),e("span",{className:"text-[11px] text-ink/50 truncate font-mono",children:t.timestamp})]}),right:e(nt,{label:"Refresh context telemetry",onClick:()=>{g.refresh(),C()},busy:g.refreshing,disabled:!r})}),e("div",{className:"flex-1 scrollbar-overlay-container p-4 space-y-4",children:[e(J,{used:t.contextUsed,limit:t.contextLimit,percent:t.contextPercent}),e(V,{messagesCount:t.messagesCount,userCount:t.userCount,assistantCount:t.assistantCount,costFormatted:t.costFormatted,cacheHitAverage:t.cacheHitAverage,costBreakdown:t.costBreakdown}),e(z,{input:t.lastMessage.input,output:t.lastMessage.output,reasoning:t.lastMessage.reasoning,cacheRead:t.lastMessage.cacheRead,cacheWrite:t.lastMessage.cacheWrite,cacheHitPercent:t.lastMessage.cacheHitPercent}),e(Q,{userPercent:t.distribution.userPercent,assistantPercent:t.distribution.assistantPercent,toolPercent:t.distribution.toolPercent,otherPercent:t.distribution.otherPercent}),e(X,{sessionId:m,refreshKey:c+I})]})]})}export{mt as ContextPanel};