@kabmo-labs/kabmo 0.58.1 → 0.59.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 (391) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +513 -495
  3. package/dist/client/static/js/{Body-ysmhxbvk.js → Body-jqq4654r.js} +3 -3
  4. package/dist/client/static/js/{CsvGrid-w90pxyn2.js → CsvGrid-avw0taqb.js} +2 -2
  5. package/dist/client/static/js/{DocxView-evxn6kaq.js → DocxView-d221vr6g.js} +3 -3
  6. package/dist/client/static/js/{DrawioView-tmdevwf4.js → DrawioView-gjsy7p01.js} +2 -2
  7. package/dist/client/static/js/{HtmlPreview-bpsn2z9p.js → HtmlPreview-949393v1.js} +1 -1
  8. package/dist/client/static/js/ImageView-pan9pqtm.js +1 -0
  9. package/dist/client/static/js/LayoutWrapper-p0qmghgt.js +2 -0
  10. package/dist/client/static/js/MergeDiffView-swt467g7.js +1 -0
  11. package/dist/client/static/js/Modal-4spmcn44.js +60 -0
  12. package/dist/client/static/js/{PdfView-txxn6qff.js → PdfView-dzj2s6rj.js} +1 -1
  13. package/dist/client/static/js/SessionsView-b6szjdg5.js +1 -0
  14. package/dist/client/static/js/{SheetView-52b33e6f.js → SheetView-jpc178g5.js} +11 -11
  15. package/dist/client/static/js/{SvgPreview-hrk4pfm1.js → SvgPreview-94fap32p.js} +1 -1
  16. package/dist/client/static/js/{abnfDiagram-O67JEVCF-at77sybc.js → abnfDiagram-O67JEVCF-a6eyfzrj.js} +1 -1
  17. package/dist/client/static/js/architecture-7GRP2DOG-bwn1drdz.js +1 -0
  18. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-raw33jgg.js → architectureDiagram-NJMV4G6O-pgmyfncy.js} +3 -3
  19. package/dist/client/static/js/{astro-qha7sceh.js → astro-ryr2ajmg.js} +1 -1
  20. package/dist/client/static/js/bash-zknkkwkw.js +1 -0
  21. package/dist/client/static/js/{blockDiagram-BEXU5L5S-b6e90fbk.js → blockDiagram-BEXU5L5S-rf51jyb2.js} +4 -4
  22. package/dist/client/static/js/c-0w02jkxb.js +1 -0
  23. package/dist/client/static/js/{c4Diagram-YGBWAQC7-msg9y1c6.js → c4Diagram-YGBWAQC7-0faj48jp.js} +2 -2
  24. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-jmrd1h8r.js → classDiagram-v2-NBCMYWYE-bvzsws8x.js} +4 -4
  25. package/dist/client/static/js/{cose-bilkent-JH36ORCC-na65ebq3.js → cose-bilkent-JH36ORCC-j1amnd3m.js} +1 -1
  26. package/dist/client/static/js/cpp-p5b4vean.js +1 -0
  27. package/dist/client/static/js/css-9jzbvdyz.js +1 -0
  28. package/dist/client/static/js/css-sn00sq6v.js +1 -0
  29. package/dist/client/static/js/cynefin-OW5HDTMX-jbc50ks8.js +1 -0
  30. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-9xkkw71m.js → cynefinDiagram-VND7K2PF-f73w6zzz.js} +2 -2
  31. package/dist/client/static/js/{dagre-6A5THRUB-p59f19tv.js → dagre-6A5THRUB-a5vgvjsg.js} +2 -2
  32. package/dist/client/static/js/{diagram-22UHCM2B-2e2rcvn7.js → diagram-22UHCM2B-6y9efamp.js} +9 -9
  33. package/dist/client/static/js/{diagram-3UASUU5V-r9ds8vgr.js → diagram-3UASUU5V-2mycy7xm.js} +1 -1
  34. package/dist/client/static/js/{diagram-ATOU4E4O-jgwxv7v8.js → diagram-ATOU4E4O-10zgjb66.js} +3 -3
  35. package/dist/client/static/js/{diagram-CDSNMT55-20m35eqq.js → diagram-CDSNMT55-bewa52yf.js} +4 -4
  36. package/dist/client/static/js/{diagram-MLGK6HIB-vt3kxt2m.js → diagram-MLGK6HIB-mh3b7gd3.js} +1 -1
  37. package/dist/client/static/js/{diagram-MPIPVDR6-c47rgxf1.js → diagram-MPIPVDR6-gvdrbdm5.js} +2 -2
  38. package/dist/client/static/js/{dockerfile-gtcyey0q.js → dockerfile-6bn19kg0.js} +1 -1
  39. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-aszw3xy3.js → ebnfDiagram-ZINNZB2B-2prre93c.js} +1 -1
  40. package/dist/client/static/js/{elixir-w92v180e.js → elixir-fyxw6d70.js} +1 -1
  41. package/dist/client/static/js/{elk-276RUBZZ-gbvr3gry.js → elk-276RUBZZ-9t6t9kc6.js} +2 -2
  42. package/dist/client/static/js/{erDiagram-OPXOYQCR-1hqca8qe.js → erDiagram-OPXOYQCR-etcggr5n.js} +6 -6
  43. package/dist/client/static/js/{erlang-v7344938.js → erlang-97ayje6m.js} +1 -1
  44. package/dist/client/static/js/eventmodeling-NTZA5JFV-b37ey01t.js +1 -0
  45. package/dist/client/static/js/flowDiagram-KWPJA3E3-7c2ncsw7.js +1 -0
  46. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-07v22te5.js → ganttDiagram-FUAMR5RP-cdc4mwhs.js} +3 -3
  47. package/dist/client/static/js/gitGraph-4MIJSDKK-mvqq7tcs.js +1 -0
  48. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-y068jtz9.js → gitGraphDiagram-X574FWY7-55d0fa7x.js} +8 -8
  49. package/dist/client/static/js/graphql-xzykn0ba.js +1 -0
  50. package/dist/client/static/js/html-2zc3shky.js +1 -0
  51. package/dist/client/static/js/{index-r8d4bk86.js → index-10vzyga1.js} +2 -2
  52. package/dist/client/static/js/{index-8d8ce00v.js → index-27gwghmp.js} +2 -2
  53. package/dist/client/static/js/{index-zhgh7a31.js → index-2f6afhze.js} +2 -2
  54. package/dist/client/static/js/{index-nptbz7sv.js → index-3akjcs82.js} +1 -1
  55. package/dist/client/static/js/{index-fhtnvqgf.js → index-3j2he86h.js} +2 -2
  56. package/dist/client/static/js/index-461ga40v.js +2 -0
  57. package/dist/client/static/js/{index-9qf2h9jb.js → index-51rbgeh9.js} +12 -12
  58. package/dist/client/static/js/{index-s4dpkds5.js → index-537m8a3x.js} +2 -2
  59. package/dist/client/static/js/{index-tdg7hz80.js → index-58z2hatp.js} +2 -2
  60. package/dist/client/static/js/{index-4tbdws4r.js → index-5e4e18tg.js} +2 -2
  61. package/dist/client/static/js/{index-gqrt766t.js → index-60cxxnpk.js} +61 -61
  62. package/dist/client/static/js/{index-th61y26d.js → index-69mnn71v.js} +2 -2
  63. package/dist/client/static/js/{index-e0kahttb.js → index-6bsez5n6.js} +1 -1
  64. package/dist/client/static/js/{index-gaa39w5q.js → index-8tzt0dek.js} +2 -2
  65. package/dist/client/static/js/{index-zs7kw0be.js → index-8z9aqgf3.js} +4 -4
  66. package/dist/client/static/js/{index-ewryzs4g.js → index-92h38pwg.js} +2 -2
  67. package/dist/client/static/js/{index-f61c25vn.js → index-9rvjegmy.js} +3 -3
  68. package/dist/client/static/js/{index-80kx6dm6.js → index-a3bpmw2r.js} +2 -2
  69. package/dist/client/static/js/{index-xmg1x6zv.js → index-a5ecn5yx.js} +5 -5
  70. package/dist/client/static/js/{index-azz46nwc.js → index-ax8gaayq.js} +2 -2
  71. package/dist/client/static/js/{index-wn28m9h7.js → index-c253x7vt.js} +8 -8
  72. package/dist/client/static/js/{index-y0f3wbc3.js → index-d9sfavx1.js} +2 -2
  73. package/dist/client/static/js/{index-5hvt233n.js → index-db6s66jr.js} +2 -2
  74. package/dist/client/static/js/index-eggbcdwx.js +481 -0
  75. package/dist/client/static/js/{index-e4nge3f4.js → index-f13ern5e.js} +1 -1
  76. package/dist/client/static/js/index-f6t91mpp.js +2 -0
  77. package/dist/client/static/js/{index-wxqcnsrq.js → index-fr91ghwb.js} +2 -2
  78. package/dist/client/static/js/{index-tq3t3qm4.js → index-fsa18ns9.js} +2 -2
  79. package/dist/client/static/js/{index-fv7nybnf.js → index-fyt8m8ah.js} +2 -2
  80. package/dist/client/static/js/{index-007sewcn.js → index-gcad7b6g.js} +2 -2
  81. package/dist/client/static/js/{index-rxt8sf9a.js → index-h1xbx74w.js} +2 -2
  82. package/dist/client/static/js/{index-medk4f18.js → index-j1ksa4x2.js} +2 -2
  83. package/dist/client/static/js/{index-sxag9ptg.js → index-jct0jryd.js} +2 -2
  84. package/dist/client/static/js/{index-qefssj0m.js → index-jpvng27a.js} +1 -1
  85. package/dist/client/static/js/{index-vw8b29ek.js → index-me0b6wkw.js} +1 -1
  86. package/dist/client/static/js/{index-6x0kn8pb.js → index-mhrkjbjq.js} +2 -2
  87. package/dist/client/static/js/{index-fe92hqmb.js → index-mngpcca7.js} +4 -4
  88. package/dist/client/static/js/index-mttx9327.css +1 -0
  89. package/dist/client/static/js/{index-5xxbbzqa.js → index-mx5y9vt9.js} +7 -7
  90. package/dist/client/static/js/{index-3ymw778n.js → index-ndqtff48.js} +2 -2
  91. package/dist/client/static/js/{index-cmjyet7w.js → index-nf4hq5tg.js} +27 -27
  92. package/dist/client/static/js/{index-cpp43af3.js → index-njhrm5qa.js} +9 -9
  93. package/dist/client/static/js/index-nnwcbp2d.js +2 -0
  94. package/dist/client/static/js/{index-3p732mvs.js → index-np2rfq06.js} +2 -2
  95. package/dist/client/static/js/{index-2s17netq.js → index-nwbr15b3.js} +2 -2
  96. package/dist/client/static/js/{index-an7fq7f6.js → index-pa70qj4p.js} +1 -1
  97. package/dist/client/static/js/index-pe5f2gmn.js +1 -0
  98. package/dist/client/static/js/{index-1e0rt7c6.js → index-pgy7ree5.js} +5 -5
  99. package/dist/client/static/js/index-pzwf6hwe.js +4 -0
  100. package/dist/client/static/js/{index-7sq6cjt1.js → index-q3k8r0ms.js} +11 -11
  101. package/dist/client/static/js/{index-j830qk07.js → index-rw84kefb.js} +2 -2
  102. package/dist/client/static/js/{index-94d416ee.js → index-s9ts6qbj.js} +2 -2
  103. package/dist/client/static/js/{index-vny4ymjf.js → index-sg65xdey.js} +1 -1
  104. package/dist/client/static/js/{index-hb7a7m9m.js → index-skvfxcd8.js} +1 -1
  105. package/dist/client/static/js/{index-1e710snk.js → index-sx2yz2wx.js} +1 -1
  106. package/dist/client/static/js/{index-kzzvrqnv.js → index-trq7bdvk.js} +2 -2
  107. package/dist/client/static/js/{index-v8xhgfeq.js → index-vs2y8gxr.js} +2 -2
  108. package/dist/client/static/js/index-wwyjzhgs.js +2 -0
  109. package/dist/client/static/js/{index-374xq5a4.js → index-xe447cw3.js} +1 -1
  110. package/dist/client/static/js/index-y09de44h.js +2 -0
  111. package/dist/client/static/js/{index-jxsha63v.js → index-y4cx8cqf.js} +2 -2
  112. package/dist/client/static/js/{index-c9aqx3ht.js → index-yg38s8t3.js} +1 -1
  113. package/dist/client/static/js/{index-dxq1tbwm.js → index-yh7gngsh.js} +2 -2
  114. package/dist/client/static/js/{index-3m1dksmy.js → index-yrwm437g.js} +2 -2
  115. package/dist/client/static/js/{index-7ynf3s2w.js → index-z82nd2bd.js} +2 -2
  116. package/dist/client/static/js/info-A6RAGUB7-zkv4crz7.js +1 -0
  117. package/dist/client/static/js/{infoDiagram-VRGFBTTK-1x83h4k4.js → infoDiagram-VRGFBTTK-9xph6cr5.js} +2 -2
  118. package/dist/client/static/js/ini-62r3vxaf.js +1 -0
  119. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-et6z3c28.js → ishikawaDiagram-OU5B5YK6-3gshs3v8.js} +2 -2
  120. package/dist/client/static/js/java-kacycary.js +1 -0
  121. package/dist/client/static/js/javascript-zc1qnyyp.js +1 -0
  122. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-sw669e7a.js → journeyDiagram-ZHPQQLJL-fa8x56mf.js} +2 -2
  123. package/dist/client/static/js/json-yrwpn6bd.js +1 -0
  124. package/dist/client/static/js/jsx-b40ag8q1.js +1 -0
  125. package/dist/client/static/js/{julia-z14p8jsx.js → julia-agc5kfvg.js} +1 -1
  126. package/dist/client/static/js/{kanban-definition-PNTS6WVX-aqxg95kx.js → kanban-definition-PNTS6WVX-fybp2hh4.js} +6 -6
  127. package/dist/client/static/js/lua-bk961f37.js +1 -0
  128. package/dist/client/static/js/markdown-b7rgzgd6.js +1 -0
  129. package/dist/client/static/js/mermaid.core-jjh5ggp0.js +12 -0
  130. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-530anpc4.js → mindmap-definition-NLK3R4M7-gtfbg619.js} +4 -4
  131. package/dist/client/static/js/one-dark-pro-vht9rv39.js +1 -0
  132. package/dist/client/static/js/one-light-arxc5whh.js +1 -0
  133. package/dist/client/static/js/packet-AYTQ26CC-dgpge627.js +1 -0
  134. package/dist/client/static/js/{pegDiagram-GJSIUBJH-5zar6hvy.js → pegDiagram-GJSIUBJH-1a51sbqv.js} +1 -1
  135. package/dist/client/static/js/{perl-1na2x6yd.js → perl-v5vbtzgf.js} +1 -1
  136. package/dist/client/static/js/{php-x75tt7w3.js → php-83qwy98t.js} +1 -1
  137. package/dist/client/static/js/pie-WAS4IAKB-b8pgsqrd.js +1 -0
  138. package/dist/client/static/js/{pieDiagram-5QR66LMP-3bx8syvw.js → pieDiagram-5QR66LMP-zd9svyyn.js} +3 -3
  139. package/dist/client/static/js/properties-k8gbzggp.js +1 -0
  140. package/dist/client/static/js/python-343tspad.js +1 -0
  141. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-yaarpr2e.js → quadrantDiagram-O4NWA36T-5gtw2m6s.js} +2 -2
  142. package/dist/client/static/js/r-ycdwmv8g.js +1 -0
  143. package/dist/client/static/js/radar-RG4KPBEZ-fmfe5y27.js +1 -0
  144. package/dist/client/static/js/railroad-74A4TZTK-b5tks4ce.js +1 -0
  145. package/dist/client/static/js/railroad-abnf-HS5TGJTU-0sf4m0ze.js +1 -0
  146. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-pjfy3pt7.js +1 -0
  147. package/dist/client/static/js/railroad-peg-WCYAUIDC-nr8ngt42.js +1 -0
  148. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-ag41q4nt.js → railroadDiagram-XR7U4H2S-3ccwpfzz.js} +1 -1
  149. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-g8sr48h4.js → requirementDiagram-PLB6GJNP-sasndrrp.js} +3 -3
  150. package/dist/client/static/js/{ruby-3h22qahv.js → ruby-994n5j6e.js} +1 -1
  151. package/dist/client/static/js/{rust-r27demr5.js → rust-n9z2c9m3.js} +1 -1
  152. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-t1wbd1hh.js → sankeyDiagram-IPEJSGJF-2ahb4sda.js} +3 -3
  153. package/dist/client/static/js/{sass-8bq5r2tz.js → sass-p6g7qdv2.js} +1 -1
  154. package/dist/client/static/js/{scss-c04ezwnn.js → scss-4j4t3r6y.js} +1 -1
  155. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-407mjqty.js → sequenceDiagram-PO4LG4MO-bfj90kz1.js} +7 -7
  156. package/dist/client/static/js/{sizeCapture-INFHLROL-w38zb9ky.js → sizeCapture-INFHLROL-5tygxmtc.js} +1 -1
  157. package/dist/client/static/js/sql-kwpd5w07.js +1 -0
  158. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-4cvgymkc.js → stateDiagram-v2-GCMORJYK-533xw76e.js} +3 -3
  159. package/dist/client/static/js/{svelte-egg3x4tw.js → svelte-bek3h1sz.js} +1 -1
  160. package/dist/client/static/js/{swimlanes-2SLR337P-w7ts2rzw.js → swimlanes-2SLR337P-gd3d04pk.js} +1 -1
  161. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-xxmvdyg4.js +8 -0
  162. package/dist/client/static/js/{timeline-definition-EJHVYXUP-nq46nzy9.js → timeline-definition-EJHVYXUP-fvqvgqvg.js} +3 -3
  163. package/dist/client/static/js/treeView-Q6P3EWNA-23r9fa68.js +1 -0
  164. package/dist/client/static/js/treemap-WGGIJYW6-mxxzdrj6.js +1 -0
  165. package/dist/client/static/js/tsx-gjxfjnbk.js +1 -0
  166. package/dist/client/static/js/typescript-4dchbnya.js +1 -0
  167. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-q144snzb.js → usecaseDiagram-POWQR4AR-tm1f0m4x.js} +15 -15
  168. package/dist/client/static/js/{vennDiagram-UO4OBE2U-2wemak2p.js → vennDiagram-UO4OBE2U-2vdvv1hd.js} +4 -4
  169. package/dist/client/static/js/{vue-d7p4wv35.js → vue-y44m889c.js} +1 -1
  170. package/dist/client/static/js/wardley-WFR3VGLG-cbqtax1x.js +1 -0
  171. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-bb2qvvgr.js → wardleyDiagram-VNRHLVJA-7avcjznx.js} +4 -4
  172. package/dist/client/static/js/xml-xs6qz3ya.js +1 -0
  173. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-9dr05fdq.js → xychartDiagram-PMCCYNJV-g39y526n.js} +4 -4
  174. package/dist/client/static/js/yaml-174nk5bn.js +1 -0
  175. package/package.json +7 -7
  176. package/src/client/borders.css +15 -3
  177. package/src/client/components/common/ComposerTextarea.test.tsx +13 -1
  178. package/src/client/components/common/ComposerTextarea.tsx +8 -2
  179. package/src/client/components/common/MarkdownRenderer.tsx +11 -2
  180. package/src/client/components/common/harness-glyph/harness-glyph.test.ts +0 -4
  181. package/src/client/components/common/harness-glyph/index.tsx +4 -5
  182. package/src/client/components/common/markdown-inline-file.test.tsx +90 -15
  183. package/src/client/components/common/session-actions-menu/index.test.tsx +45 -0
  184. package/src/client/components/common/session-actions-menu/index.tsx +6 -1
  185. package/src/client/components/layout/desktop-layout/RightColumn.tsx +4 -1
  186. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +28 -35
  187. package/src/client/components/layout/desktop-layout/index.tsx +5 -3
  188. package/src/client/components/layout/desktop-layout/resizer/index.tsx +13 -3
  189. package/src/client/components/layout/desktop-layout/resizer/panel.test.ts +41 -0
  190. package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +21 -1
  191. package/src/client/components/layout/session-sidebar/CategoryHeader.worktree.test.tsx +1 -0
  192. package/src/client/components/layout/session-sidebar/CategoryItem.tsx +8 -2
  193. package/src/client/components/layout/session-sidebar/ClassicView.tsx +2 -0
  194. package/src/client/components/layout/session-sidebar/SessionList.tsx +4 -0
  195. package/src/client/components/layout/session-sidebar/SessionsView.tsx +22 -1
  196. package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +45 -28
  197. package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +9 -3
  198. package/src/client/components/layout/session-sidebar/modern/index.tsx +2 -0
  199. package/src/client/components/layout/session-sidebar/modern/workspace-header.test.tsx +27 -11
  200. package/src/client/components/layout/session-sidebar/search-results.test.tsx +29 -16
  201. package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +1 -0
  202. package/src/client/components/layout/session-sidebar/variant-props.ts +2 -0
  203. package/src/client/components/mobile/LayoutWrapper.tsx +9 -0
  204. package/src/client/components/mobile/SessionSidebar.tsx +4 -0
  205. package/src/client/components/mobile/left-drawer-nav.test.tsx +1 -1
  206. package/src/client/components/mobile/mobile-session-sidebar/Body.tsx +4 -0
  207. package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +3 -0
  208. package/src/client/components/mobile/mobile-session-sidebar/Item.test.tsx +85 -0
  209. package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +30 -14
  210. package/src/client/components/mobile/mobile-session-sidebar/List.tsx +4 -0
  211. package/src/client/components/settings/apply-side-effects.test.ts +31 -0
  212. package/src/client/components/settings/apply-side-effects.ts +7 -0
  213. package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.tsx +3 -2
  214. package/src/client/components/settings/categories/appearance-settings/SidebarStyleSection.test.tsx +95 -0
  215. package/src/client/components/settings/categories/appearance-settings/SidebarStyleSection.tsx +35 -0
  216. package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +1 -0
  217. package/src/client/components/workspace/chat-timeline/MessageItem.gutter.test.ts +26 -0
  218. package/src/client/components/workspace/chat-timeline/MessageItem.tsx +6 -3
  219. package/src/client/components/workspace/chat-timeline/ThinkingSection.test.tsx +17 -0
  220. package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +9 -3
  221. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.test.ts +39 -2
  222. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +19 -4
  223. package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +28 -21
  224. package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.wait.test.tsx +48 -0
  225. package/src/client/components/workspace/chat-timeline/chat-input/ComposerRows.tsx +44 -21
  226. package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.test.ts +24 -0
  227. package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.tsx +44 -18
  228. package/src/client/components/workspace/chat-timeline/chat-input/GoalSurfaces.tsx +2 -1
  229. package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.test.ts +35 -0
  230. package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.tsx +33 -12
  231. package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.test.tsx +24 -0
  232. package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.tsx +14 -3
  233. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +24 -1
  234. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +78 -135
  235. package/src/client/components/workspace/chat-timeline/chat-input/VoiceButton.tsx +58 -0
  236. package/src/client/components/workspace/chat-timeline/chat-input/action-base.ts +42 -0
  237. package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +1 -0
  238. package/src/client/components/workspace/chat-timeline/chat-input/mode-icons.test.ts +108 -0
  239. package/src/client/components/workspace/chat-timeline/chat-input/mode-icons.tsx +122 -0
  240. package/src/client/components/workspace/chat-timeline/chat-input/narrow.test.tsx +78 -20
  241. package/src/client/components/workspace/chat-timeline/chat-input/styles/index.tsx +11 -5
  242. package/src/client/components/workspace/chat-timeline/chat-input/styles.test.tsx +19 -0
  243. package/src/client/components/workspace/chat-timeline/composer-dock-frame.test.tsx +9 -0
  244. package/src/client/components/workspace/chat-timeline/index.tsx +1 -1
  245. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OptionRow.test.tsx +125 -0
  246. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OptionRow.tsx +84 -27
  247. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.test.tsx +18 -0
  248. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.tsx +14 -5
  249. package/src/client/components/workspace/model-dropdown/HarnessTabs.tsx +31 -10
  250. package/src/client/components/workspace/model-dropdown/Header.tsx +13 -5
  251. package/src/client/components/workspace/model-dropdown/Panel.tsx +18 -0
  252. package/src/client/components/workspace/model-dropdown/ThinkingLevels.tsx +51 -0
  253. package/src/client/components/workspace/model-dropdown/Trigger.tsx +99 -0
  254. package/src/client/components/workspace/model-dropdown/bands.ts +51 -0
  255. package/src/client/components/workspace/model-dropdown/harness-tabs.test.tsx +21 -5
  256. package/src/client/components/workspace/model-dropdown/index.tsx +20 -47
  257. package/src/client/components/workspace/model-dropdown/thinking-levels.test.tsx +108 -0
  258. package/src/client/components/workspace/model-dropdown/trigger.test.ts +54 -8
  259. package/src/client/hooks/chat/composer/attachments.test.ts +12 -0
  260. package/src/client/hooks/chat/composer/attachments.ts +16 -4
  261. package/src/client/hooks/chat/composer/pipeline.test.ts +14 -0
  262. package/src/client/hooks/chat/composer/pipeline.ts +15 -6
  263. package/src/client/hooks/chat/omp/session-list.activity.test.ts +20 -0
  264. package/src/client/hooks/chat/omp/session-merges.ts +18 -6
  265. package/src/client/hooks/chat/omp/session-sidebar-controller.ts +4 -0
  266. package/src/client/hooks/chat/timeline/scope.test.ts +17 -0
  267. package/src/client/hooks/chat/timeline/scope.ts +6 -1
  268. package/src/client/hooks/chat/timeline/send-refusal.test.ts +19 -0
  269. package/src/client/hooks/chat/timeline/send-steer.test.ts +17 -0
  270. package/src/client/hooks/chat/timeline/send.ts +17 -0
  271. package/src/client/hooks/editor/quick-open.ts +41 -0
  272. package/src/client/hooks/ui/border-style.test.ts +13 -0
  273. package/src/client/hooks/ui/markdown-render.ts +11 -6
  274. package/src/client/hooks/ui/open-inline-file.test.ts +16 -0
  275. package/src/client/hooks/ui/open-inline-file.ts +4 -2
  276. package/src/client/hooks/ui/show-more.ts +11 -1
  277. package/src/client/hooks/ui/ui-feedback.test.ts +11 -0
  278. package/src/client/hooks/ui/verified-inline-files.test.tsx +143 -0
  279. package/src/client/hooks/ui/verified-inline-files.ts +165 -0
  280. package/src/client/hooks/workspace/mobile-workspace-panels.test.tsx +116 -0
  281. package/src/client/hooks/workspace/mobile-workspace-panels.ts +73 -0
  282. package/src/client/hooks/workspace/panel-resize.test.ts +127 -0
  283. package/src/client/hooks/workspace/panel-resize.ts +81 -0
  284. package/src/client/hooks/workspace/session-list-limit.test.ts +80 -0
  285. package/src/client/hooks/workspace/session-list-limit.ts +69 -0
  286. package/src/client/hooks/workspace/session-pin.ts +58 -0
  287. package/src/client/hooks/workspace/workspace-panels-mode.test.tsx +87 -0
  288. package/src/client/hooks/workspace/workspace-panels-mode.ts +76 -0
  289. package/src/client/lib/router/branch-params.test.ts +17 -1
  290. package/src/client/lib/router/branch-params.ts +18 -0
  291. package/src/client/lib/ui/pressed.ts +15 -0
  292. package/src/client/tailwind.css +30 -10
  293. package/src/server/lib/connect/cloudflared.lifecycle.test.ts +25 -9
  294. package/src/server/lib/db/schema.test.ts +1 -1
  295. package/src/server/lib/db/schema.ts +17 -0
  296. package/src/server/lib/harness/activity.server.test.ts +81 -0
  297. package/src/server/lib/harness/activity.server.ts +55 -0
  298. package/src/server/lib/harness/spawn.server.ts +9 -0
  299. package/src/server/lib/omp/session/delete.server.ts +4 -2
  300. package/src/server/lib/omp/session/sidebar-activity.server.test.ts +24 -2
  301. package/src/server/lib/omp/session/sidebar-data.canonical.test.ts +14 -0
  302. package/src/server/lib/sessions/last-opened.server.test.ts +17 -0
  303. package/src/server/lib/sessions/last-opened.server.ts +18 -1
  304. package/src/server/routes/sessions/index.ts +3 -2
  305. package/src/server/routes/sessions/routes.test.ts +29 -46
  306. package/src/server/routes/sessions/session.ts +40 -62
  307. package/src/server/routes/sessions/state.test.ts +89 -0
  308. package/src/server/routes/sessions/state.ts +86 -0
  309. package/src/shared/lib/chat/attachment-budget.test.ts +74 -0
  310. package/src/shared/lib/chat/attachment-budget.ts +111 -0
  311. package/src/shared/lib/chat/attachments.test.ts +0 -17
  312. package/src/shared/lib/chat/attachments.ts +0 -53
  313. package/src/shared/lib/chat/timeline/block-chrome.test.ts +35 -0
  314. package/src/shared/lib/chat/timeline/block-chrome.ts +21 -0
  315. package/src/shared/lib/markdown/degenerate-emphasis.test.ts +64 -0
  316. package/src/shared/lib/markdown/degenerate-emphasis.ts +90 -0
  317. package/src/shared/lib/markdown/inline-file.test.ts +79 -22
  318. package/src/shared/lib/markdown/inline-file.ts +57 -25
  319. package/src/shared/lib/markdown/marked.ts +5 -1
  320. package/src/shared/lib/settings/defaults.ts +2 -0
  321. package/src/shared/lib/theme/border-style.ts +1 -1
  322. package/src/shared/lib/workspace/active-project.test.ts +17 -1
  323. package/src/shared/lib/workspace/active-project.ts +9 -0
  324. package/src/shared/lib/workspace/project-settings-delete.test.ts +97 -0
  325. package/src/shared/lib/workspace/project-settings.test.ts +2 -34
  326. package/src/shared/lib/workspace/project-settings.ts +6 -0
  327. package/src/shared/lib/workspace/session-list-limit.test.ts +31 -0
  328. package/src/shared/lib/workspace/session-list-limit.ts +32 -0
  329. package/src/shared/lib/workspace/sidebar-sort.test.ts +21 -0
  330. package/src/shared/lib/workspace/workspace-panel-widths.ts +1 -1
  331. package/src/shared/lib/workspace/workspace-session.test.ts +34 -0
  332. package/src/shared/lib/workspace/workspace-session.ts +40 -0
  333. package/src/shared/types/settings/state.ts +10 -0
  334. package/dist/client/static/js/ImageView-ssazqckj.js +0 -1
  335. package/dist/client/static/js/LayoutWrapper-qwpfq4dq.js +0 -2
  336. package/dist/client/static/js/MergeDiffView-en6aazw8.js +0 -1
  337. package/dist/client/static/js/Modal-zjnhj9nb.js +0 -60
  338. package/dist/client/static/js/SessionsView-eryjtmb2.js +0 -1
  339. package/dist/client/static/js/architecture-7GRP2DOG-v05ap4e3.js +0 -1
  340. package/dist/client/static/js/bash-n5d0esqg.js +0 -1
  341. package/dist/client/static/js/c-pk766wx0.js +0 -1
  342. package/dist/client/static/js/cpp-3pt91jvm.js +0 -1
  343. package/dist/client/static/js/css-q2k6afe3.js +0 -1
  344. package/dist/client/static/js/css-sp1cgdbr.js +0 -1
  345. package/dist/client/static/js/cynefin-OW5HDTMX-sqv0ze38.js +0 -1
  346. package/dist/client/static/js/eventmodeling-NTZA5JFV-t4dzf5s7.js +0 -1
  347. package/dist/client/static/js/flowDiagram-KWPJA3E3-c16xmjyv.js +0 -1
  348. package/dist/client/static/js/gitGraph-4MIJSDKK-0jq8y0qd.js +0 -1
  349. package/dist/client/static/js/graphql-qx4tt6ze.js +0 -1
  350. package/dist/client/static/js/html-5e0g8664.js +0 -1
  351. package/dist/client/static/js/index-4ddgpqm0.css +0 -1
  352. package/dist/client/static/js/index-5g2j626a.js +0 -1
  353. package/dist/client/static/js/index-cc7qbfvn.js +0 -477
  354. package/dist/client/static/js/index-f27wvdky.js +0 -4
  355. package/dist/client/static/js/index-m5n0zsft.js +0 -2
  356. package/dist/client/static/js/index-rqt8mem9.js +0 -2
  357. package/dist/client/static/js/index-s9k82stc.js +0 -2
  358. package/dist/client/static/js/index-skwem10a.js +0 -2
  359. package/dist/client/static/js/index-tv9rn2nd.js +0 -2
  360. package/dist/client/static/js/info-A6RAGUB7-szttx3v5.js +0 -1
  361. package/dist/client/static/js/ini-bdk46a3d.js +0 -1
  362. package/dist/client/static/js/java-3g3925cf.js +0 -1
  363. package/dist/client/static/js/javascript-av46zx4c.js +0 -1
  364. package/dist/client/static/js/json-hdyzmffz.js +0 -1
  365. package/dist/client/static/js/jsx-y8r9mrdq.js +0 -1
  366. package/dist/client/static/js/lua-wf5k6p3r.js +0 -1
  367. package/dist/client/static/js/markdown-9bf16dx7.js +0 -1
  368. package/dist/client/static/js/mermaid.core-6cgqsgcf.js +0 -12
  369. package/dist/client/static/js/one-dark-pro-9hnhtkpr.js +0 -1
  370. package/dist/client/static/js/one-light-2n5y8592.js +0 -1
  371. package/dist/client/static/js/packet-AYTQ26CC-401149bv.js +0 -1
  372. package/dist/client/static/js/pie-WAS4IAKB-bgfv8tfz.js +0 -1
  373. package/dist/client/static/js/properties-xk4dn00p.js +0 -1
  374. package/dist/client/static/js/python-7sgz05n4.js +0 -1
  375. package/dist/client/static/js/r-w4qxm0pv.js +0 -1
  376. package/dist/client/static/js/radar-RG4KPBEZ-pw720590.js +0 -1
  377. package/dist/client/static/js/railroad-74A4TZTK-n2a30ngs.js +0 -1
  378. package/dist/client/static/js/railroad-abnf-HS5TGJTU-rn5rx9qt.js +0 -1
  379. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-t4yryhtd.js +0 -1
  380. package/dist/client/static/js/railroad-peg-WCYAUIDC-c4ebgvrr.js +0 -1
  381. package/dist/client/static/js/sql-sd00wgem.js +0 -1
  382. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-v82nym6b.js +0 -8
  383. package/dist/client/static/js/treeView-Q6P3EWNA-bxgt5yhm.js +0 -1
  384. package/dist/client/static/js/treemap-WGGIJYW6-hh3595m0.js +0 -1
  385. package/dist/client/static/js/tsx-h5yzg80q.js +0 -1
  386. package/dist/client/static/js/typescript-qy1sbhea.js +0 -1
  387. package/dist/client/static/js/wardley-WFR3VGLG-6bza7h1b.js +0 -1
  388. package/dist/client/static/js/xml-mrk4xakv.js +0 -1
  389. package/dist/client/static/js/yaml-xaza6dra.js +0 -1
  390. package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.test.tsx +0 -110
  391. package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +0 -86
@@ -1 +1 @@
1
- import{d,n,o,i,u,a,Nr,Ge,ie,e,s,Vn,Q,mt,C,se,Mo,ae,Be,nt,yi,yn,ki,ia,S,U,h,sr,k,Sh,Se,bl,T,xr,wr,Ct,at,$e,_t,Qd,gt,At,zh,Uh,Oo,As,Rd,Ve,bs}from"./index-cc7qbfvn.js";import{wd,Cd,mi,Ed,Bd}from"./index-f61c25vn.js";import{Z}from"./index-m5n0zsft.js";import{Dr}from"./index-s4dpkds5.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"]},Ue=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"}]]},Xe=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"}]]},qe=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"}]]},Re=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(Ct,{className:"border-b-0",left:e(Dr,{rootPath:t,activeRepo:r,onSelectRepo:f,repos:l,scanning:c,onRefreshRepos:p}),right:e(at,{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(C,{size:12,className:"flex-shrink-0 text-ink/40"}):e(se,{size:12,className:"flex-shrink-0 text-ink/40"}):e("span",{className:"w-3 flex-shrink-0"}),e(gt,{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,F=g===1?"":` ${g} items`;if(m)return b.push({kind:"item",id:"cut",label:`Cut${F}`,icon:e(Re,{size:13,className:"text-ink/60"}),disabled:p}),b.push({kind:"item",id:"copy",label:`Copy${F}`,icon:e(ae,{size:13,className:"text-ink/60"}),disabled:p}),b.push({kind:"separator"}),b.push({kind:"item",id:"compress",label:`Compress${F} to…`,icon:e(mt,{size:13,className:"text-ink/60"}),disabled:p}),b.push({kind:"separator"}),b.push({kind:"item",id:"delete",label:`Delete${F}`,icon:e(Q,{size:13,className:"text-error-text"}),tone:"text-error-text"}),b;if(r){if(b.push({kind:"item",id:"new_file",label:"New File",icon:e(yi,{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(C,{size:13,className:"text-ink/60"})});if(x)b.push({kind:"item",id:"fold",label:"Fold Folders",icon:e(se,{size:13,className:"text-ink/60"})});b.push({kind:"separator"})}else{if(b.push({kind:"item",id:"view",label:"View",icon:e(nt,{size:13,className:"text-ink/60"})}),v)b.push({kind:"item",id:"extract",label:"Extract…",icon:e(qe,{size:13,className:"text-ink/60"}),disabled:p});if(l)b.push({kind:"item",id:"diff",label:"Open in Diff Panel",icon:e(ki,{size:13,className:"text-warning-text"}),tone:"font-medium"});b.push({kind:"separator"})}if(b.push({kind:"item",id:"cut",label:"Cut",icon:e(Re,{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(mt,{size:13,className:"text-ink/60"}),disabled:p}),b.push({kind:"item",id:"duplicate",label:"Duplicate",icon:e(Xe,{size:13,className:"text-ink/60"}),disabled:p}),c)b.push({kind:"item",id:"paste",label:c,icon:e(Mo,{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(Be,{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(Vn,{size:13,className:"text-ink/60"})}),b.push({kind:"separator"}),b.push({kind:"item",id:"rename",label:"Rename",icon:e(Ue,{size:13,className:"text-ink/60"})}),b.push({kind:"item",id:"delete",label:"Delete",icon:e(Q,{size:13,className:"text-error-text"}),tone:"text-error-text"}),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:F}){let w=on({isFolder:l,hasGitStatus:c,pasteLabel:p,busy:g,chainLabel:f,foldable:x,selectionCount:v,isArchive:b}),E=sn(w),N=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-E-12)):r;return ie(e("div",{className:"fixed inset-0 z-50 bg-ink/20",onClick:()=>m("close"),onContextMenu:(R)=>{R.preventDefault(),m("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:M,left:N},onClick:(R)=>R.stopPropagation(),children:w.map((R,D)=>R.kind==="separator"?e("div",{className:"my-1 border-t border-ink/10"},`sep-${D}`):e("button",{type:"button",disabled:R.disabled,onClick:()=>m(R.id),className:`w-full text-left px-3 py-1.5 flex items-center space-x-2 transition-colors ${R.disabled?"opacity-40 cursor-default":"hover:bg-ink/5"} ${R.tone??""}`,children:[R.icon,e("span",{children:R.label})]},R.id))})}),document.body)}function Ce({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-text 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 et({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-text 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 tt({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(Vn,{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-text 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 rt({actions:t,file:r,isFolder:l,chainLabel:c}){let p=t.selectionCount;return e(d,{children:[t.showCreateModal&&e(Ce,{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(et,{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(tt,{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 Te(t){return t.type==="folder"&&t.name.includes("/")}function Ee(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 ot(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)?Ee(g.path,g.name):null;if(!m)return[b];c=!0,l.set(m[0],g.path);let F={...b,name:m[m.length-1].split("/").pop()};for(let y=m.length-1;y>0;y-=1){let w=m[y-1];F={name:w.split("/").pop(),path:w,type:"folder",ignored:b.ignored,children:[F]}}return[F]}),f=p(t);return{nodes:c?f:t,roots:l}}function it(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 Fe({folderPath:t,rootPath:r,repo:l,onCreated:c,onOpenCreated:p}){let f=At(),[x,g]=n(!1),[v,b]=n("file"),[m,F]=n(""),[y,w]=n(null),E=i(null);return o(()=>{if(f.state!=="idle"||!f.data)return;let N=f.data;if(E.current===N)return;if(E.current=N,N.success&&N.path){let M=N.kind==="folder"?"folder":"file";g(!1),F(""),w(null);let R=N.path.split("/").pop()||N.path;if(c({path:N.path,name:R,kind:M}),M==="file")p?.({path:N.path,name:R})}else w(N.error||`Could not create the ${v}`)},[f.state,f.data]),{open:x,kind:v,name:m,setName:F,error:y,busy:f.state!=="idle",openDialog:(N="file")=>{b(N),F(""),w(null),g(!0)},closeDialog:()=>g(!1),submit:(N)=>{N.preventDefault();let M=m.trim();if(!M)return;w(null);let R=new FormData;if(R.append("actionType","create"),R.append("path",t),R.append("name",M),v==="folder")R.append("kind","folder");if(l&&l!==".")R.append("repo",l);if(r)R.append("root",r);f.submit(R,{method:"post",action:"/api/fs/action"})}}}function Ne(t){if(!t)return null;if(t.entries.length===1)return t.entries[0].name;return`${t.entries.length} items`}function st(t,r){return`${t??""}\x00${r}`}function Me(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 dt(t,r){let l=ct(t,r);if(l)return l;if(r===lt(t.path))return"Already in this folder";return null}function pt(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 ut(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 Le=[{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"}],ft=[[".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 ze(t){let r=t.toLowerCase();for(let[l,c]of ft)if(r.endsWith(l))return c;return null}function ht(t){return ze(t)!==null}function cn(t){return Le.find((r)=>r.id===t)}function dn(t){return cn(t)?.extension??"zip"}function bt(t){let r=t.toLowerCase();for(let[l]of ft)if(r.endsWith(l))return t.slice(0,-l.length);return t}function xt(t){let r=t.lastIndexOf("/");return r===-1?".":t.slice(0,r)||"."}function vt(t){let r=t.lastIndexOf("/");return r===-1?t:t.slice(r+1)}function yt(t){if(t.length===0)return".";let r=t.map((c)=>xt(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 we(t,r){let l=dn(r);if(t.length===1){let f=t[0],x=bt(f.name),g=x.lastIndexOf(".");return`${(f.kind==="folder"?f.name:g>0?x.slice(0,g):x)||"archive"}.${l}`}let c=yt(t.map((f)=>f.path)),p=vt(c);return`${p==="."||p===""?"archive":p}.${l}`}function kt(t){return yt(t.map((r)=>r.path))}function Ft(t){let r=xt(t),l=bt(vt(t));if(!l)return r;return r==="."?l:`${r}/${l}`}function Nt(t){return t.toUpperCase()}function wt({file:t,diff:r,onOpenFile:l,onActionComplete:c,onCreated:p,onRenamed:f,onUnfold:x,onFold:g,clipboard:v,isFolder:b,selection:m,selected:F,archive:y}){let w=At(),[E,N]=n(null),M=i(null),[R,D]=n(!1),[A,I]=n(!1),[_,te]=n(!1),[ne,le]=n(t.path),[H,P]=n(null),{repo:z,rootPath:G}=t,K=Fe({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(w.state!=="idle"||!w.data)return;let L=w.data;if(re.current===L)return;if(re.current=L,L.success&&!L.type)if(D(!1),I(!1),P(null),L.previousPath&&L.path&&f)f(L.previousPath,L.path);else c();else if(!L.success&&L.error&&R)P(L.error)},[w.state,w.data]);let q=(L)=>{if(z&&z!==".")L.append("repo",z);if(G)L.append("root",G);w.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=F&&m.length>1?m:[J],he=ht(t.name),B=v.clip&&!v.refusalFor(J)?`Paste ${Ne(v.clip)??"item"}`:null,fe=(L)=>{if(N(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")_t(Qd(t.basePath,t.path));else if(L==="copy_relative")_t(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")le(t.path),D(!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)},ce=(L)=>{L.preventDefault(),P(null);let j=new FormData;j.append("actionType","rename"),j.append("path",t.path),j.append("newPath",ne),q(j)},xe=()=>{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:E,contextMenuRef:M,openContextMenu:(L,j)=>N({x:L,y:j}),closeContextMenu:()=>N(null),showRenameModal:R,showDeleteModal:A,showHistoryModal:_,showCreateModal:K.open,createKind:K.kind,createError:K.error,createName:K.name,setCreateName:K.setName,renameValue:ne,setRenameValue:le,renameError:H,busy:w.state!=="idle"||K.busy||v.busy||y.busy,pasteLabel:B,selectionCount:oe.length,isArchive:he,chainLabel:x!==void 0,foldable:g!==void 0,fetcherState:w.state,fetcherData:w.data,handleAction:fe,submitCreate:K.submit,submitRename:ce,submitDelete:xe,closeCreate:K.closeDialog,closeDelete:()=>I(!1),closeRename:()=>D(!1),closeHistory:()=>te(!1)}}function Dt({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 Oe({file:t,rootPath:r,basePath:l,repo:c,onLoadChildren:p,onOpenFile:f,onActionComplete:x,onCreated:g,onRenamed:v,expandedPaths:b,onToggleFolder:m,gitFileMap:F,gitFolderMap:y,clipboard:w,archive:E,selection:N,selectionTargets:M,dragging:R,onDragStart:D,onDragEnd:A,onDropOn:I,onUnfold:_,onFold:te,foldRoots:ne,touch:le=!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:[],he=(t.path||"").replace(/^\/+/,""),B=!H?F?.get(he)||F?.get(t.path):void 0,fe=B?sr(B.status,B.staged):null,ce=H?y?.get(he)||y?.get(t.path):null,xe=Boolean(fe),L=t.ignored===!0,j=b?b.has(t.path):P,de=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&&de&&pn(t,G,re)&&p)q(!0),K(!0),Promise.resolve(p(t.path)).finally(()=>K(!1))},[H,de,t.children,t.path,p,G,re]);let ye={path:t.path,name:t.name,kind:H?"folder":"file"},be=N.selected.has(t.path),W=wt({file:{path:t.path,name:t.name,basePath:l,rootPath:r,repo:c},selection:M,selected:be,archive:E,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:_&&Te({type:H?"folder":"file",name:t.name})?()=>_(ye):void 0,onFold:te&&ne?.has(t.path)?()=>te(ne.get(t.path)):void 0,clipboard:w,isFolder:H});$e(W.contextMenuRef,W.closeContextMenu);let Y=wd({enabled:le,onLongPress:(V,ge)=>W.openContextMenu(V,ge)}),ke=(V)=>{if(V.stopPropagation(),Y.consume())return;let ge=N.gestureOf(V);if(ge!=="plain"){N.applyGesture(ge,t.path);return}if(N.applyGesture("plain",t.path),H){let ue=!de;if(z(ue),t.forceExpanded!==void 0)t.forceExpanded=void 0;if(m?.(t.path,ue),!ue)q(!1)}else if(f)f({...t,root:r,repo:c||"."})},ve=(V)=>{V.preventDefault(),V.stopPropagation(),N.ensureForContext(t.path),W.openContextMenu(V.clientX,V.clientY)},pe=Dt({target:ye,dragging:R,clipboard:w,onDragStart:D,onDragEnd:A,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 ${pe.isDragging?"opacity-40":""} ${pe.isDropHovered?"bg-info/10 ring-1 ring-info/40 ring-inset":be?"bg-ink/[0.08] ring-1 ring-ink/20 ring-inset":"hover:bg-ink/5"}`,draggable:!le,onClick:ke,onContextMenu:ve,onDragStart:pe.onDragStart,onDragEnd:pe.onDragEnd,onDragOver:pe.onDragOver,onDragLeave:pe.onDragLeave,onDrop:pe.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:de,ignored:L,selected:be,gitStatus:fe,folderStatus:ce})}),de&&G&&e("div",{className:"ml-3 border-l border-ink/10 pl-3 py-0.5 text-[10px] text-ink/30",children:"Loading…"}),de&&!G&&oe.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:oe.map((V)=>e(Oe,{file:V,rootPath:r,basePath:l,repo:c,onLoadChildren:p,onOpenFile:f,onActionComplete:x,onCreated:g,onRenamed:v,expandedPaths:b,onToggleFolder:m,gitFileMap:F,gitFolderMap:y,clipboard:w,archive:E,selection:N,selectionTargets:M,dragging:R,onDragStart:D,onDragEnd:A,onDropOn:I,onUnfold:_,onFold:te,foldRoots:ne,touch:le},V.path))}),X&&W.contextMenu&&e(Je,{x:W.contextMenu.x,y:W.contextMenu.y,isFolder:H,hasGitStatus:xe,pasteLabel:W.pasteLabel,chainLabel:W.chainLabel,foldable:W.foldable,busy:W.busy,selectionCount:W.selectionCount,isArchive:W.isArchive,onAction:W.handleAction}),X&&e(rt,{actions:W,file:t,isFolder:H,chainLabel:Te({type:H?"folder":"file",name:t.name})?t.name:void 0})]})}function Rt({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(yi,{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(Mo,{size:13,className:"text-ink/60"}),e("span",{children:l})]})]})}),document.body)}function St({menu:t,menuRef:r,pasteLabel:l,busy:c,onAction:p,create:f}){return e(d,{children:[t&&e(Rt,{x:t.x,y:t.y,menuRef:r,pasteLabel:l,busy:c,onAction:p}),f.open&&e(Ce,{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-text 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:F}){let y=t.slice(0,4).map((E)=>E.name).join(", "),w=t.length>4?` +${t.length-4} more`:"";return e(Tt,{title:`Compress ${t.length===1?t[0].name:`${t.length} items`}`,subject:`${y}${w}`,error:f,busy:x,submitLabel:"Compress",busyLabel:"Compressing...",onCancel:m,onSubmit:(E)=>{E.preventDefault(),F()},children:[e("label",{className:"block text-[10px] uppercase tracking-wide text-ink/40 mb-1",children:"Format"}),e(Z,{ariaLabel:"Format",value:r,onChange:(E)=>g(E),placeholder:"Format",searchable:!1,allowEmpty:!1,className:"mb-3 text-xs",options:p.map((E)=>({value:E.id,label:E.available?E.label:`${E.label} — ${E.tool} not installed`,disabled:!E.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:(E)=>v(E.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:(E)=>b(E.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:Nt(ze(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=Nr(),c=Ge(Uh,zh),{symbols:p,total:f,truncated:x,notice:g}=Bd({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,F)=>{if(!c.path)return;if(v){let y=Rd(p,F);if(y)As({path:c.path,...y});return}Oo({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,F)=>e("button",{type:"button",onClick:()=>b(m,F),"aria-label":v?`${mi(m.kind)} ${m.name}`:`${mi(m.kind)} ${m.name}, line ${m.line}`,title:v?`Jump to ${mi(m.kind).toLowerCase()}`:`${mi(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(Cd,{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:Ed(f)})]})})})})]})}function Pe(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:Pe(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 Ie(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("/"),F=g.find((M)=>M.type==="folder"&&M.path===m),y=F?null:g.find((M)=>M.type==="folder"&&M.path.startsWith(`${m}/`)&&(p===M.path||p.startsWith(`${M.path}/`))),w=F??y,E=w?x[w.path]??w.children:null;if(w&&!Array.isArray(E))return{nodes:t,cache:r};if(!w){let M=gn(g,x,m);if(M){g=M;let R=g.find((A)=>A.path===m),D=Array.isArray(R?.children)?[...R.children]:[];x[m]=D,g=D,v=m,b+=1;continue}}let N=Array.isArray(E)?[...E]:[];if(w){x[w.path]=N,g=N,v=w.path,b=w.path.split("/").length;continue}g.push({name:c[b],path:m,type:"folder",ignored:!1}),x[m]=N,g=N,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((F)=>F.path===l)).sort((m,F)=>F.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 He(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({}),F=i([]),y=i(f);y.current=f;let w=i(""),E=i(""),N=i(c);N.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()}`},R=(P,z)=>{w.current=P,E.current=z;let G=Pe(F.current,m.current);return g({scope:P,files:G,root:z}),G},D=async(P)=>{let z=[...N.current];if(z.length===0)return;let G=await Promise.all(z.map(async(X)=>({path:X,read:await He(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([...N.current].filter((X)=>!re.has(X)));N.current=q,p(q)},A=async()=>{if(!t)return;let P=y.current;b(!0);try{let z=await He(M());if(y.current!==P)return;if(z.status!=="ok")return;if(w.current!==P)m.current={};if(F.current=z.files,R(P,z.root),await D(P),y.current!==P)return;R(P,z.root)}finally{if(y.current===P)b(!1)}},I=async(P)=>{let z=y.current,G=await He(M(P));if(y.current!==z||G.status!=="ok")return;if(m.current[P]=G.files,w.current===z)R(z,E.current)},_=(P)=>{let z=Ht(P);if(z.status!=="ok")return;let G=y.current;if(w.current!==G)m.current={};F.current=z.files,R(G,z.root),D(G).then(()=>{if(y.current===G)R(G,z.root)})},te=()=>{m.current={},F.current=[],w.current="",E.current="",g({scope:"",files:[],root:""})},ne=(P)=>{let z=y.current;if(w.current!==z)return null;let G={name:P.path.slice(P.path.lastIndexOf("/")+1),path:P.path,type:P.kind,ignored:!1},K=Ie(F.current,m.current,G);if(K.nodes===F.current)return null;return F.current=K.nodes,m.current=K.cache,R(z,E.current)},le=(P,z)=>{let G=y.current;if(w.current!==G)return null;let K=zt(F.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=Ie(K.nodes,m.current,re);return F.current=q.nodes,m.current=q.cache,R(G,E.current)},H=x.scope===f;return{scope:f,files:H?x.files:[],root:H?x.root:"",isLoading:v,reload:A,loadChildren:I,adoptRoot:_,insertEntry:ne,moveEntry:le,reset:te}}function Kt({rootPath:t,repo:r,onComplete:l,onError:c}){let p=At(),[f,x]=T("files.clipboard",null),g=ut(f),v=st(t,r),b=i(!1),m=i(null);o(()=>{if(p.state!=="idle"||!p.data)return;let N=p.data;if(m.current===N)return;m.current=N;let M=b.current;if(b.current=!1,N.success){if(M)x(null);if(N.failures?.length)c(`${N.failures.length} item(s) could not be moved: ${N.failures[0].error}`);l()}else c(N.error||"The transfer did not complete")},[p.state,p.data]);let F=a((N,M)=>{b.current=M;let R=new FormData;for(let[D,A]of Object.entries(N))R.append(D,A);if(r&&r!==".")R.append("repo",r);if(t)R.append("root",t);p.submit(R,{method:"post",action:"/api/fs/action"})},[p,r,t]),y=a((N)=>pt(g,v,Me(N.path,N.kind)),[g,v]),w=a((N,M)=>dt(N,Me(M.path,M.kind)),[]),E=a((N,M,R,D)=>{let A=new FormData;A.append("actionType","paste"),A.append("mode",R),A.append("targetPath",M.path),A.append("targetKind",M.kind);for(let I of N)A.append("sourcePath",I.path);if(r&&r!==".")A.append("repo",r);if(t)A.append("root",t);b.current=D,p.submit(A,{method:"post",action:"/api/fs/action"})},[p,r,t]);return{clip:g,busy:p.state!=="idle",refusalFor:y,moveRefusalFor:w,copy:(N)=>{if(N.length===0)return;x({scope:v,entries:N.map(({path:M,name:R,kind:D})=>({path:M,name:R,kind:D})),mode:"copy"})},cut:(N)=>{if(N.length===0)return;x({scope:v,entries:N.map(({path:M,name:R,kind:D})=>({path:M,name:R,kind:D})),mode:"cut"})},duplicate:(N)=>{F({actionType:"duplicate",path:N.path},!1)},move:(N,M)=>{let R=w(N,M);if(R){c(R);return}E([N],M,"cut",Boolean(g?.mode==="cut"&&g.entries.some((D)=>D.path===N.path)))},paste:(N)=>{if(!g)return;let M=y(N);if(M){c(M);return}E(g.entries.map(({path:R,name:D,kind:A})=>({path:R,name:D,kind:A})),N,g.mode,g.mode==="cut")}}}var bn=Le.map((t)=>({...t,available:!0,tool:t.id}));function jt({rootPath:t,repo:r,onComplete:l}){let c=At(),[p,f]=n(bn),[x,g]=n(null),[v,b]=n(null),[m,F]=n(null),y=i(null),w=i(null);o(()=>{let D=!1;return(async()=>{try{let I=await(await fetch("/api/fs/archive")).json();if(!D&&Array.isArray(I.formats)&&I.formats.length>0)f(I.formats)}catch{}})(),()=>{D=!0}},[]),o(()=>{if(c.state!=="idle"||!c.data)return;let D=c.data;if(w.current===D)return;w.current=D;let A=y.current;if(y.current=null,D.success){if(F(null),A==="compress")g(null);if(A==="extract")b(null);l()}else if(A)F(D.error||"The archive request failed")},[c.state,c.data]);let E=a((D)=>{let A=new FormData;for(let[I,_]of Object.entries(D))A.append(I,_);if(r&&r!==".")A.append("repo",r);if(t)A.append("root",t);c.submit(A,{method:"post",action:"/api/fs/action"})},[c,r,t]),N=a((D)=>{if(D.length===0)return;let A=p.find((I)=>I.id==="zip"&&I.available)?.id??p.find((I)=>I.available)?.id??"zip";F(null),b(null),g({entries:D.map(({path:I,name:_,kind:te})=>({path:I,name:_,kind:te})),format:A,name:we(D,A),destination:kt(D)})},[p]),M=a((D)=>{F(null),g(null),b({archive:D,destination:Ft(D.path)})},[]),R=a((D)=>{g((A)=>{if(!A)return A;let I=we(A.entries,A.format),_=A.name===I?we(A.entries,D):A.name;return{...A,format:D,name:_}})},[]);return{formats:p,compress:x,extract:v,error:m,busy:c.state!=="idle",openCompress:N,openExtract:M,setFormat:R,setName:(D)=>g((A)=>A&&{...A,name:D}),setCompressDestination:(D)=>g((A)=>A&&{...A,destination:D}),setExtractDestination:(D)=>b((A)=>A&&{...A,destination:D}),cancel:()=>{g(null),b(null),F(null)},submitCompress:()=>{let D=x;if(!D)return;y.current="compress",F(null),E({actionType:"compress",format:D.format,name:D.name.trim(),destination:D.destination.trim()||".",paths:JSON.stringify(D.entries.map((A)=>A.path))})},submitExtract:()=>{let D=v;if(!D)return;y.current="extract",F(null),E({actionType:"extract",path:D.archive.path,destination:D.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 Wt(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((F)=>{let y=new Set(F);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 Ke(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))Ke(p.children,r,l+1,c);return c}function Ut({listing:t,setExpandedPaths:r,setStoredExpandedPaths:l,reload:c,onMoved:p}){let f=a((v,b)=>{let m=it(b,v);if(m.length===0)return;r((F)=>{if(m.every((w)=>F.has(w)))return F;let y=new Set(F);for(let w of m)y.add(w);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((F)=>{let y=It(F,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 Vt({scope:t,setExpandedPaths:r,setStoredExpandedPaths:l}){let[c,p]=n({scope:t,chains:new Map}),f=a((v)=>{let b=Ee(v.path,v.name);if(!b)return;p((F)=>{let y=F.scope===t?F.chains:new Map;if(y.get(v.path)?.length===b.length)return F;let E=new Map(y);return E.set(v.path,b),{scope:t,chains:E}});let m=b.slice(0,-1);r((F)=>{if(m.every((w)=>F.has(w)))return F;let y=new Set(F);for(let w of m)y.add(w);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((F)=>{if(F.scope!==t)return F;let y=new Map(F.chains);return y.delete(v),{scope:t,chains:y}}),r((F)=>{if(!m.some((w)=>F.has(w)))return F;let y=new Set(F);for(let w of m)y.delete(w);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 F=new Map,y=[],w=!1;for(let[E,N]of m){if(N.findIndex((A,I)=>A===v&&I>0&&I<N.length-1)!==-1){w=!0;continue}let R=N.map((A)=>A===v?b:A.startsWith(`${v}/`)?`${b}${A.slice(v.length)}`:A),D=R[R.length-1];if(D!==E||R.some((A,I)=>A!==N[I]))w=!0;F.set(D,R),y.push(...R.slice(0,-1))}if(!w)return;p({scope:t,chains:F}),r((E)=>{if(y.every((M)=>E.has(M)))return E;let N=new Set(E);for(let M of y)N.add(M);return l(Array.from(N)),N})},[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 Xt(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 qt({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,F]=T("files.expandedPaths",[]),[y,w]=n(()=>new Set(b)),{activeRepo:E,setActiveRepo:N}=xr(c),{repos:M,scanning:R,rescan:D}=wr(c,r),{fileMap:A,folderMap:I,refreshGitStatus:_}=bl(c,E,r),[te,ne]=n(null),le=i(null);o(()=>{if(!F)return;w((O)=>{let ee=new Set(b);if(O.size===ee.size&&Array.from(ee).every((me)=>O.has(me)))return O;return ee})},[F,b]);let H=Gt({enabled:r,rootPath:c,activeRepo:E,expandedPaths:y,onExpansionPruned:(O)=>{w(O),m(Array.from(O))}});o(()=>{if(!F||!l)return;H.reload()},[f,c,r,E,F,l]);let P=r&&F?Sh(H.scope):null,z=Se(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);w(me),m(Array.from(me))},{unfolded:re,unfold:q,fold:X,rekey:J}=Vt({scope:H.scope,setExpandedPaths:w,setStoredExpandedPaths:m}),oe=H.files,he=ot(oe,re),B=Xt(he.nodes,g),fe=Ke(B,(O)=>O.forceExpanded!==void 0?O.forceExpanded:y.has(O.path)),ce=Wt(fe.map((O)=>O.path)),xe=fe.filter((O)=>ce.selected.has(O.path)).map(({path:O,name:ee,kind:me})=>({path:O,name:ee,kind:me})),L=(O)=>{if(O===E)return;H.reset(),w(new Set),m([]),ce.clear(),N(O)},j=()=>{if(_(),x)x();else H.reload()},{insertCreated:de,moveRenamed:ye}=Ut({listing:H,setExpandedPaths:w,setStoredExpandedPaths:m,reload:j,onMoved:(O,ee)=>J(O,ee)}),be=bs(),{pushToast:W}=Ve(),Y=Kt({rootPath:c,repo:E,onComplete:j,onError:(O)=>W(O,"error")}),ke=jt({rootPath:c,repo:E,onComplete:j}),ve={path:".",name:".",kind:"folder"},pe=Y.clip&&!Y.refusalFor(ve)?`Paste ${Ne(Y.clip)??"item"}`:null,[V,ge]=n(null),ue=qt({dragging:V,clipboard:Y,target:ve}),De=Fe({folderPath:".",rootPath:c,repo:E,onCreated:de,onOpenCreated:(O)=>p?.({...O,root:c,repo:E})}),[je,Bt]=n(!1);o(()=>Bt(!0),[]);let{count:_e,clear:We}=ce;if(o(()=>{if(!l)return;let O=(ee)=>{if(ee.key==="Escape"&&_e>0)We()};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[l,_e,We]),!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:E,repos:M,reposScanning:R,onRefreshRepos:D,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 ${be?"file-tree-touch":""} ${ue.highlighted?"bg-info/[0.06]":""}`,onContextMenu:(O)=>{O.preventDefault(),ne({x:O.clientX,y:O.clientY})},onDragEnter:ue.onDragEnter,onDragLeave:ue.onDragLeave,onDragOver:ue.onDragOver,onDrop:ue.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(Oe,{file:O,rootPath:c,basePath:H.root,repo:E,onLoadChildren:G,onOpenFile:p,onActionComplete:j,onCreated:de,onRenamed:ye,expandedPaths:y,onToggleFolder:K,gitFileMap:A,gitFolderMap:I,clipboard:Y,archive:ke,selection:ce,selectionTargets:xe,dragging:V,onDragStart:ge,onDragEnd:()=>ge(null),onDropOn:(ee)=>{if(!V)return;Y.move(V,ee)},onUnfold:q,onFold:X,foldRoots:he.roots,touch:be},O.path))}),e(Mt,{}),je&&e(St,{menu:te,menuRef:le,pasteLabel:pe,busy:Y.busy,create:De,onAction:(O)=>{if(ne(null),O==="new_file")De.openDialog("file");if(O==="new_folder")De.openDialog("folder");if(O==="paste")Y.paste(ve)}}),je&&e(Et,{archive:ke})]})}export{ri as FileExplorer};
1
+ import{d,n,o,i,u,a,Rr,He,se,e,s,Vn,Q,ft,C,le,Oo,ae,Be,at,Ci,yn,Ei,ca,S,U,h,lr,k,zh,Se,Bl,T,wr,Cr,Bt,it,$e,Tt,Od,ht,bt,Xh,e0,Uo,ks,$d,Ue,ws}from"./index-eggbcdwx.js";import{Sd,Td,hi,Dd,Nd}from"./index-9rvjegmy.js";import{Z}from"./index-nnwcbp2d.js";import{Qr}from"./index-537m8a3x.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"]},Ve=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"}]]},Xe=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"}]]},qe=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"}]]},Re=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(Bt,{className:"border-b-0",left:e(Qr,{rootPath:t,activeRepo:r,onSelectRepo:f,repos:l,scanning:c,onRefreshRepos:p}),right:e(it,{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(C,{size:12,className:"flex-shrink-0 text-ink/40"}):e(le,{size:12,className:"flex-shrink-0 text-ink/40"}):e("span",{className:"w-3 flex-shrink-0"}),e(ht,{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,F=g===1?"":` ${g} items`;if(m)return b.push({kind:"item",id:"cut",label:`Cut${F}`,icon:e(Re,{size:13,className:"text-ink/60"}),disabled:p}),b.push({kind:"item",id:"copy",label:`Copy${F}`,icon:e(ae,{size:13,className:"text-ink/60"}),disabled:p}),b.push({kind:"separator"}),b.push({kind:"item",id:"compress",label:`Compress${F} to…`,icon:e(ft,{size:13,className:"text-ink/60"}),disabled:p}),b.push({kind:"separator"}),b.push({kind:"item",id:"delete",label:`Delete${F}`,icon:e(Q,{size:13,className:"text-error-text"}),tone:"text-error-text"}),b;if(r){if(b.push({kind:"item",id:"new_file",label:"New File",icon:e(Ci,{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(C,{size:13,className:"text-ink/60"})});if(x)b.push({kind:"item",id:"fold",label:"Fold Folders",icon:e(le,{size:13,className:"text-ink/60"})});b.push({kind:"separator"})}else{if(b.push({kind:"item",id:"view",label:"View",icon:e(at,{size:13,className:"text-ink/60"})}),v)b.push({kind:"item",id:"extract",label:"Extract…",icon:e(qe,{size:13,className:"text-ink/60"}),disabled:p});if(l)b.push({kind:"item",id:"diff",label:"Open in Diff Panel",icon:e(Ei,{size:13,className:"text-warning-text"}),tone:"font-medium"});b.push({kind:"separator"})}if(b.push({kind:"item",id:"cut",label:"Cut",icon:e(Re,{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(ft,{size:13,className:"text-ink/60"}),disabled:p}),b.push({kind:"item",id:"duplicate",label:"Duplicate",icon:e(Xe,{size:13,className:"text-ink/60"}),disabled:p}),c)b.push({kind:"item",id:"paste",label:c,icon:e(Oo,{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(Be,{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(Vn,{size:13,className:"text-ink/60"})}),b.push({kind:"separator"}),b.push({kind:"item",id:"rename",label:"Rename",icon:e(Ve,{size:13,className:"text-ink/60"})}),b.push({kind:"item",id:"delete",label:"Delete",icon:e(Q,{size:13,className:"text-error-text"}),tone:"text-error-text"}),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:F}){let w=on({isFolder:l,hasGitStatus:c,pasteLabel:p,busy:g,chainLabel:f,foldable:x,selectionCount:v,isArchive:b}),E=sn(w),N=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-E-12)):r;return se(e("div",{className:"fixed inset-0 z-50 bg-ink/20",onClick:()=>m("close"),onContextMenu:(R)=>{R.preventDefault(),m("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:M,left:N},onClick:(R)=>R.stopPropagation(),children:w.map((R,D)=>R.kind==="separator"?e("div",{className:"my-1 border-t border-ink/10"},`sep-${D}`):e("button",{type:"button",disabled:R.disabled,onClick:()=>m(R.id),className:`w-full text-left px-3 py-1.5 flex items-center space-x-2 transition-colors ${R.disabled?"opacity-40 cursor-default":"hover:bg-ink/5"} ${R.tone??""}`,children:[R.icon,e("span",{children:R.label})]},R.id))})}),document.body)}function Ce({folderPath:t,kind:r,value:l,error:c,isLoading:p,onChange:f,onCancel:x,onSubmit:g}){let v=r==="folder"?"Folder":"File";return se(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-text 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 se(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 et({isFolder:t,renameValue:r,originalPath:l,displayName:c,error:p,isLoading:f,onChange:x,onCancel:g,onSubmit:v}){return se(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-text 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 tt({filePath:t,fetcherState:r,fetcherData:l,onClose:c}){let p=l?.type==="history"?l.data:void 0;return se(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(Vn,{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-text 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 nt({actions:t,file:r,isFolder:l,chainLabel:c}){let p=t.selectionCount;return e(d,{children:[t.showCreateModal&&e(Ce,{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(et,{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(tt,{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 Te(t){return t.type==="folder"&&t.name.includes("/")}function Ee(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 rt(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)?Ee(g.path,g.name):null;if(!m)return[b];c=!0,l.set(m[0],g.path);let F={...b,name:m[m.length-1].split("/").pop()};for(let y=m.length-1;y>0;y-=1){let w=m[y-1];F={name:w.split("/").pop(),path:w,type:"folder",ignored:b.ignored,children:[F]}}return[F]}),f=p(t);return{nodes:c?f:t,roots:l}}function ot(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 Fe({folderPath:t,rootPath:r,repo:l,onCreated:c,onOpenCreated:p}){let f=bt(),[x,g]=n(!1),[v,b]=n("file"),[m,F]=n(""),[y,w]=n(null),E=i(null);return o(()=>{if(f.state!=="idle"||!f.data)return;let N=f.data;if(E.current===N)return;if(E.current=N,N.success&&N.path){let M=N.kind==="folder"?"folder":"file";g(!1),F(""),w(null);let R=N.path.split("/").pop()||N.path;if(c({path:N.path,name:R,kind:M}),M==="file")p?.({path:N.path,name:R})}else w(N.error||`Could not create the ${v}`)},[f.state,f.data]),{open:x,kind:v,name:m,setName:F,error:y,busy:f.state!=="idle",openDialog:(N="file")=>{b(N),F(""),w(null),g(!0)},closeDialog:()=>g(!1),submit:(N)=>{N.preventDefault();let M=m.trim();if(!M)return;w(null);let R=new FormData;if(R.append("actionType","create"),R.append("path",t),R.append("name",M),v==="folder")R.append("kind","folder");if(l&&l!==".")R.append("repo",l);if(r)R.append("root",r);f.submit(R,{method:"post",action:"/api/fs/action"})}}}function Ne(t){if(!t)return null;if(t.entries.length===1)return t.entries[0].name;return`${t.entries.length} items`}function st(t,r){return`${t??""}\x00${r}`}function Me(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 dt(t,r){let l=ct(t,r);if(l)return l;if(r===lt(t.path))return"Already in this folder";return null}function pt(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 ut(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 Le=[{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"}],mt=[[".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 ze(t){let r=t.toLowerCase();for(let[l,c]of mt)if(r.endsWith(l))return c;return null}function gt(t){return ze(t)!==null}function cn(t){return Le.find((r)=>r.id===t)}function dn(t){return cn(t)?.extension??"zip"}function xt(t){let r=t.toLowerCase();for(let[l]of mt)if(r.endsWith(l))return t.slice(0,-l.length);return t}function vt(t){let r=t.lastIndexOf("/");return r===-1?".":t.slice(0,r)||"."}function yt(t){let r=t.lastIndexOf("/");return r===-1?t:t.slice(r+1)}function kt(t){if(t.length===0)return".";let r=t.map((c)=>vt(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 we(t,r){let l=dn(r);if(t.length===1){let f=t[0],x=xt(f.name),g=x.lastIndexOf(".");return`${(f.kind==="folder"?f.name:g>0?x.slice(0,g):x)||"archive"}.${l}`}let c=kt(t.map((f)=>f.path)),p=yt(c);return`${p==="."||p===""?"archive":p}.${l}`}function Ct(t){return kt(t.map((r)=>r.path))}function Ft(t){let r=vt(t),l=xt(yt(t));if(!l)return r;return r==="."?l:`${r}/${l}`}function Nt(t){return t.toUpperCase()}function wt({file:t,diff:r,onOpenFile:l,onActionComplete:c,onCreated:p,onRenamed:f,onUnfold:x,onFold:g,clipboard:v,isFolder:b,selection:m,selected:F,archive:y}){let w=bt(),[E,N]=n(null),M=i(null),[R,D]=n(!1),[A,I]=n(!1),[_,te]=n(!1),[ne,ie]=n(t.path),[H,P]=n(null),{repo:z,rootPath:G}=t,K=Fe({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(w.state!=="idle"||!w.data)return;let L=w.data;if(re.current===L)return;if(re.current=L,L.success&&!L.type)if(D(!1),I(!1),P(null),L.previousPath&&L.path&&f)f(L.previousPath,L.path);else c();else if(!L.success&&L.error&&R)P(L.error)},[w.state,w.data]);let q=(L)=>{if(z&&z!==".")L.append("repo",z);if(G)L.append("root",G);w.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=F&&m.length>1?m:[J],he=gt(t.name),B=v.clip&&!v.refusalFor(J)?`Paste ${Ne(v.clip)??"item"}`:null,fe=(L)=>{if(N(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")Tt(Od(t.basePath,t.path));else if(L==="copy_relative")Tt(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")ie(t.path),D(!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)},ce=(L)=>{L.preventDefault(),P(null);let j=new FormData;j.append("actionType","rename"),j.append("path",t.path),j.append("newPath",ne),q(j)},xe=()=>{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:E,contextMenuRef:M,openContextMenu:(L,j)=>N({x:L,y:j}),closeContextMenu:()=>N(null),showRenameModal:R,showDeleteModal:A,showHistoryModal:_,showCreateModal:K.open,createKind:K.kind,createError:K.error,createName:K.name,setCreateName:K.setName,renameValue:ne,setRenameValue:ie,renameError:H,busy:w.state!=="idle"||K.busy||v.busy||y.busy,pasteLabel:B,selectionCount:oe.length,isArchive:he,chainLabel:x!==void 0,foldable:g!==void 0,fetcherState:w.state,fetcherData:w.data,handleAction:fe,submitCreate:K.submit,submitRename:ce,submitDelete:xe,closeCreate:K.closeDialog,closeDelete:()=>I(!1),closeRename:()=>D(!1),closeHistory:()=>te(!1)}}function Dt({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 Oe({file:t,rootPath:r,basePath:l,repo:c,onLoadChildren:p,onOpenFile:f,onActionComplete:x,onCreated:g,onRenamed:v,expandedPaths:b,onToggleFolder:m,gitFileMap:F,gitFolderMap:y,clipboard:w,archive:E,selection:N,selectionTargets:M,dragging:R,onDragStart:D,onDragEnd:A,onDropOn:I,onUnfold:_,onFold:te,foldRoots:ne,touch:ie=!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:[],he=(t.path||"").replace(/^\/+/,""),B=!H?F?.get(he)||F?.get(t.path):void 0,fe=B?lr(B.status,B.staged):null,ce=H?y?.get(he)||y?.get(t.path):null,xe=Boolean(fe),L=t.ignored===!0,j=b?b.has(t.path):P,de=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&&de&&pn(t,G,re)&&p)q(!0),K(!0),Promise.resolve(p(t.path)).finally(()=>K(!1))},[H,de,t.children,t.path,p,G,re]);let ye={path:t.path,name:t.name,kind:H?"folder":"file"},be=N.selected.has(t.path),W=wt({file:{path:t.path,name:t.name,basePath:l,rootPath:r,repo:c},selection:M,selected:be,archive:E,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:_&&Te({type:H?"folder":"file",name:t.name})?()=>_(ye):void 0,onFold:te&&ne?.has(t.path)?()=>te(ne.get(t.path)):void 0,clipboard:w,isFolder:H});$e(W.contextMenuRef,W.closeContextMenu);let Y=Sd({enabled:ie,onLongPress:(V,ge)=>W.openContextMenu(V,ge)}),ke=(V)=>{if(V.stopPropagation(),Y.consume())return;let ge=N.gestureOf(V);if(ge!=="plain"){N.applyGesture(ge,t.path);return}if(N.applyGesture("plain",t.path),H){let ue=!de;if(z(ue),t.forceExpanded!==void 0)t.forceExpanded=void 0;if(m?.(t.path,ue),!ue)q(!1)}else if(f)f({...t,root:r,repo:c||"."})},ve=(V)=>{V.preventDefault(),V.stopPropagation(),N.ensureForContext(t.path),W.openContextMenu(V.clientX,V.clientY)},pe=Dt({target:ye,dragging:R,clipboard:w,onDragStart:D,onDragEnd:A,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 ${pe.isDragging?"opacity-40":""} ${pe.isDropHovered?"bg-info/10 ring-1 ring-info/40 ring-inset":be?"bg-ink/[0.08] ring-1 ring-ink/20 ring-inset":"hover:bg-ink/5"}`,draggable:!ie,onClick:ke,onContextMenu:ve,onDragStart:pe.onDragStart,onDragEnd:pe.onDragEnd,onDragOver:pe.onDragOver,onDragLeave:pe.onDragLeave,onDrop:pe.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:de,ignored:L,selected:be,gitStatus:fe,folderStatus:ce})}),de&&G&&e("div",{className:"ml-3 border-l border-ink/10 pl-3 py-0.5 text-[10px] text-ink/30",children:"Loading…"}),de&&!G&&oe.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:oe.map((V)=>e(Oe,{file:V,rootPath:r,basePath:l,repo:c,onLoadChildren:p,onOpenFile:f,onActionComplete:x,onCreated:g,onRenamed:v,expandedPaths:b,onToggleFolder:m,gitFileMap:F,gitFolderMap:y,clipboard:w,archive:E,selection:N,selectionTargets:M,dragging:R,onDragStart:D,onDragEnd:A,onDropOn:I,onUnfold:_,onFold:te,foldRoots:ne,touch:ie},V.path))}),X&&W.contextMenu&&e(Je,{x:W.contextMenu.x,y:W.contextMenu.y,isFolder:H,hasGitStatus:xe,pasteLabel:W.pasteLabel,chainLabel:W.chainLabel,foldable:W.foldable,busy:W.busy,selectionCount:W.selectionCount,isArchive:W.isArchive,onAction:W.handleAction}),X&&e(nt,{actions:W,file:t,isFolder:H,chainLabel:Te({type:H?"folder":"file",name:t.name})?t.name:void 0})]})}function Rt({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 se(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(Ci,{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(Oo,{size:13,className:"text-ink/60"}),e("span",{children:l})]})]})}),document.body)}function St({menu:t,menuRef:r,pasteLabel:l,busy:c,onAction:p,create:f}){return e(d,{children:[t&&e(Rt,{x:t.x,y:t.y,menuRef:r,pasteLabel:l,busy:c,onAction:p}),f.open&&e(Ce,{folderPath:".",kind:f.kind,value:f.name,error:f.error,isLoading:f.busy,onChange:f.setName,onCancel:f.closeDialog,onSubmit:f.submit})]})}function At({title:t,subject:r,error:l,busy:c,submitLabel:p,busyLabel:f,onSubmit:x,onCancel:g,children:v}){return se(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-text 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:F}){let y=t.slice(0,4).map((E)=>E.name).join(", "),w=t.length>4?` +${t.length-4} more`:"";return e(At,{title:`Compress ${t.length===1?t[0].name:`${t.length} items`}`,subject:`${y}${w}`,error:f,busy:x,submitLabel:"Compress",busyLabel:"Compressing...",onCancel:m,onSubmit:(E)=>{E.preventDefault(),F()},children:[e("label",{className:"block text-[10px] uppercase tracking-wide text-ink/40 mb-1",children:"Format"}),e(Z,{ariaLabel:"Format",value:r,onChange:(E)=>g(E),placeholder:"Format",searchable:!1,allowEmpty:!1,className:"mb-3 text-xs",options:p.map((E)=>({value:E.id,label:E.available?E.label:`${E.label} — ${E.tool} not installed`,disabled:!E.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:(E)=>v(E.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:(E)=>b(E.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(At,{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:Nt(ze(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=Rr(),c=He(e0,Xh),{symbols:p,total:f,truncated:x,notice:g}=Nd({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,F)=>{if(!c.path)return;if(v){let y=$d(p,F);if(y)ks({path:c.path,...y});return}Uo({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(ca,{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,F)=>e("button",{type:"button",onClick:()=>b(m,F),"aria-label":v?`${hi(m.kind)} ${m.name}`:`${hi(m.kind)} ${m.name}, line ${m.line}`,title:v?`Jump to ${hi(m.kind).toLowerCase()}`:`${hi(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(Td,{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:Dd(f)})]})})})})]})}function Pe(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:Pe(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 Ie(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("/"),F=g.find((M)=>M.type==="folder"&&M.path===m),y=F?null:g.find((M)=>M.type==="folder"&&M.path.startsWith(`${m}/`)&&(p===M.path||p.startsWith(`${M.path}/`))),w=F??y,E=w?x[w.path]??w.children:null;if(w&&!Array.isArray(E))return{nodes:t,cache:r};if(!w){let M=gn(g,x,m);if(M){g=M;let R=g.find((A)=>A.path===m),D=Array.isArray(R?.children)?[...R.children]:[];x[m]=D,g=D,v=m,b+=1;continue}}let N=Array.isArray(E)?[...E]:[];if(w){x[w.path]=N,g=N,v=w.path,b=w.path.split("/").length;continue}g.push({name:c[b],path:m,type:"folder",ignored:!1}),x[m]=N,g=N,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((F)=>F.path===l)).sort((m,F)=>F.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 Ge(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({}),F=i([]),y=i(f);y.current=f;let w=i(""),E=i(""),N=i(c);N.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()}`},R=(P,z)=>{w.current=P,E.current=z;let G=Pe(F.current,m.current);return g({scope:P,files:G,root:z}),G},D=async(P)=>{let z=[...N.current];if(z.length===0)return;let G=await Promise.all(z.map(async(X)=>({path:X,read:await Ge(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([...N.current].filter((X)=>!re.has(X)));N.current=q,p(q)},A=async()=>{if(!t)return;let P=y.current;b(!0);try{let z=await Ge(M());if(y.current!==P)return;if(z.status!=="ok")return;if(w.current!==P)m.current={};if(F.current=z.files,R(P,z.root),await D(P),y.current!==P)return;R(P,z.root)}finally{if(y.current===P)b(!1)}},I=async(P)=>{let z=y.current,G=await Ge(M(P));if(y.current!==z||G.status!=="ok")return;if(m.current[P]=G.files,w.current===z)R(z,E.current)},_=(P)=>{let z=Ht(P);if(z.status!=="ok")return;let G=y.current;if(w.current!==G)m.current={};F.current=z.files,R(G,z.root),D(G).then(()=>{if(y.current===G)R(G,z.root)})},te=()=>{m.current={},F.current=[],w.current="",E.current="",g({scope:"",files:[],root:""})},ne=(P)=>{let z=y.current;if(w.current!==z)return null;let G={name:P.path.slice(P.path.lastIndexOf("/")+1),path:P.path,type:P.kind,ignored:!1},K=Ie(F.current,m.current,G);if(K.nodes===F.current)return null;return F.current=K.nodes,m.current=K.cache,R(z,E.current)},ie=(P,z)=>{let G=y.current;if(w.current!==G)return null;let K=zt(F.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=Ie(K.nodes,m.current,re);return F.current=q.nodes,m.current=q.cache,R(G,E.current)},H=x.scope===f;return{scope:f,files:H?x.files:[],root:H?x.root:"",isLoading:v,reload:A,loadChildren:I,adoptRoot:_,insertEntry:ne,moveEntry:ie,reset:te}}function Kt({rootPath:t,repo:r,onComplete:l,onError:c}){let p=bt(),[f,x]=T("files.clipboard",null),g=ut(f),v=st(t,r),b=i(!1),m=i(null);o(()=>{if(p.state!=="idle"||!p.data)return;let N=p.data;if(m.current===N)return;m.current=N;let M=b.current;if(b.current=!1,N.success){if(M)x(null);if(N.failures?.length)c(`${N.failures.length} item(s) could not be moved: ${N.failures[0].error}`);l()}else c(N.error||"The transfer did not complete")},[p.state,p.data]);let F=a((N,M)=>{b.current=M;let R=new FormData;for(let[D,A]of Object.entries(N))R.append(D,A);if(r&&r!==".")R.append("repo",r);if(t)R.append("root",t);p.submit(R,{method:"post",action:"/api/fs/action"})},[p,r,t]),y=a((N)=>pt(g,v,Me(N.path,N.kind)),[g,v]),w=a((N,M)=>dt(N,Me(M.path,M.kind)),[]),E=a((N,M,R,D)=>{let A=new FormData;A.append("actionType","paste"),A.append("mode",R),A.append("targetPath",M.path),A.append("targetKind",M.kind);for(let I of N)A.append("sourcePath",I.path);if(r&&r!==".")A.append("repo",r);if(t)A.append("root",t);b.current=D,p.submit(A,{method:"post",action:"/api/fs/action"})},[p,r,t]);return{clip:g,busy:p.state!=="idle",refusalFor:y,moveRefusalFor:w,copy:(N)=>{if(N.length===0)return;x({scope:v,entries:N.map(({path:M,name:R,kind:D})=>({path:M,name:R,kind:D})),mode:"copy"})},cut:(N)=>{if(N.length===0)return;x({scope:v,entries:N.map(({path:M,name:R,kind:D})=>({path:M,name:R,kind:D})),mode:"cut"})},duplicate:(N)=>{F({actionType:"duplicate",path:N.path},!1)},move:(N,M)=>{let R=w(N,M);if(R){c(R);return}E([N],M,"cut",Boolean(g?.mode==="cut"&&g.entries.some((D)=>D.path===N.path)))},paste:(N)=>{if(!g)return;let M=y(N);if(M){c(M);return}E(g.entries.map(({path:R,name:D,kind:A})=>({path:R,name:D,kind:A})),N,g.mode,g.mode==="cut")}}}var bn=Le.map((t)=>({...t,available:!0,tool:t.id}));function jt({rootPath:t,repo:r,onComplete:l}){let c=bt(),[p,f]=n(bn),[x,g]=n(null),[v,b]=n(null),[m,F]=n(null),y=i(null),w=i(null);o(()=>{let D=!1;return(async()=>{try{let I=await(await fetch("/api/fs/archive")).json();if(!D&&Array.isArray(I.formats)&&I.formats.length>0)f(I.formats)}catch{}})(),()=>{D=!0}},[]),o(()=>{if(c.state!=="idle"||!c.data)return;let D=c.data;if(w.current===D)return;w.current=D;let A=y.current;if(y.current=null,D.success){if(F(null),A==="compress")g(null);if(A==="extract")b(null);l()}else if(A)F(D.error||"The archive request failed")},[c.state,c.data]);let E=a((D)=>{let A=new FormData;for(let[I,_]of Object.entries(D))A.append(I,_);if(r&&r!==".")A.append("repo",r);if(t)A.append("root",t);c.submit(A,{method:"post",action:"/api/fs/action"})},[c,r,t]),N=a((D)=>{if(D.length===0)return;let A=p.find((I)=>I.id==="zip"&&I.available)?.id??p.find((I)=>I.available)?.id??"zip";F(null),b(null),g({entries:D.map(({path:I,name:_,kind:te})=>({path:I,name:_,kind:te})),format:A,name:we(D,A),destination:Ct(D)})},[p]),M=a((D)=>{F(null),g(null),b({archive:D,destination:Ft(D.path)})},[]),R=a((D)=>{g((A)=>{if(!A)return A;let I=we(A.entries,A.format),_=A.name===I?we(A.entries,D):A.name;return{...A,format:D,name:_}})},[]);return{formats:p,compress:x,extract:v,error:m,busy:c.state!=="idle",openCompress:N,openExtract:M,setFormat:R,setName:(D)=>g((A)=>A&&{...A,name:D}),setCompressDestination:(D)=>g((A)=>A&&{...A,destination:D}),setExtractDestination:(D)=>b((A)=>A&&{...A,destination:D}),cancel:()=>{g(null),b(null),F(null)},submitCompress:()=>{let D=x;if(!D)return;y.current="compress",F(null),E({actionType:"compress",format:D.format,name:D.name.trim(),destination:D.destination.trim()||".",paths:JSON.stringify(D.entries.map((A)=>A.path))})},submitExtract:()=>{let D=v;if(!D)return;y.current="extract",F(null),E({actionType:"extract",path:D.archive.path,destination:D.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((F)=>{let y=new Set(F);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 Ke(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))Ke(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=ot(b,v);if(m.length===0)return;r((F)=>{if(m.every((w)=>F.has(w)))return F;let y=new Set(F);for(let w of m)y.add(w);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((F)=>{let y=It(F,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=Ee(v.path,v.name);if(!b)return;p((F)=>{let y=F.scope===t?F.chains:new Map;if(y.get(v.path)?.length===b.length)return F;let E=new Map(y);return E.set(v.path,b),{scope:t,chains:E}});let m=b.slice(0,-1);r((F)=>{if(m.every((w)=>F.has(w)))return F;let y=new Set(F);for(let w of m)y.add(w);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((F)=>{if(F.scope!==t)return F;let y=new Map(F.chains);return y.delete(v),{scope:t,chains:y}}),r((F)=>{if(!m.some((w)=>F.has(w)))return F;let y=new Set(F);for(let w of m)y.delete(w);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 F=new Map,y=[],w=!1;for(let[E,N]of m){if(N.findIndex((A,I)=>A===v&&I>0&&I<N.length-1)!==-1){w=!0;continue}let R=N.map((A)=>A===v?b:A.startsWith(`${v}/`)?`${b}${A.slice(v.length)}`:A),D=R[R.length-1];if(D!==E||R.some((A,I)=>A!==N[I]))w=!0;F.set(D,R),y.push(...R.slice(0,-1))}if(!w)return;p({scope:t,chains:F}),r((E)=>{if(y.every((M)=>E.has(M)))return E;let N=new Set(E);for(let M of y)N.add(M);return l(Array.from(N)),N})},[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,F]=T("files.expandedPaths",[]),[y,w]=n(()=>new Set(b)),{activeRepo:E,setActiveRepo:N}=wr(c),{repos:M,scanning:R,rescan:D}=Cr(c,r),{fileMap:A,folderMap:I,refreshGitStatus:_}=Bl(c,E,r),[te,ne]=n(null),ie=i(null);o(()=>{if(!F)return;w((O)=>{let ee=new Set(b);if(O.size===ee.size&&Array.from(ee).every((me)=>O.has(me)))return O;return ee})},[F,b]);let H=Gt({enabled:r,rootPath:c,activeRepo:E,expandedPaths:y,onExpansionPruned:(O)=>{w(O),m(Array.from(O))}});o(()=>{if(!F||!l)return;H.reload()},[f,c,r,E,F,l]);let P=r&&F?zh(H.scope):null,z=Se(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);w(me),m(Array.from(me))},{unfolded:re,unfold:q,fold:X,rekey:J}=Ut({scope:H.scope,setExpandedPaths:w,setStoredExpandedPaths:m}),oe=H.files,he=rt(oe,re),B=Vt(he.nodes,g),fe=Ke(B,(O)=>O.forceExpanded!==void 0?O.forceExpanded:y.has(O.path)),ce=_t(fe.map((O)=>O.path)),xe=fe.filter((O)=>ce.selected.has(O.path)).map(({path:O,name:ee,kind:me})=>({path:O,name:ee,kind:me})),L=(O)=>{if(O===E)return;H.reset(),w(new Set),m([]),ce.clear(),N(O)},j=()=>{if(_(),x)x();else H.reload()},{insertCreated:de,moveRenamed:ye}=Wt({listing:H,setExpandedPaths:w,setStoredExpandedPaths:m,reload:j,onMoved:(O,ee)=>J(O,ee)}),be=ws(),{pushToast:W}=Ue(),Y=Kt({rootPath:c,repo:E,onComplete:j,onError:(O)=>W(O,"error")}),ke=jt({rootPath:c,repo:E,onComplete:j}),ve={path:".",name:".",kind:"folder"},pe=Y.clip&&!Y.refusalFor(ve)?`Paste ${Ne(Y.clip)??"item"}`:null,[V,ge]=n(null),ue=Xt({dragging:V,clipboard:Y,target:ve}),De=Fe({folderPath:".",rootPath:c,repo:E,onCreated:de,onOpenCreated:(O)=>p?.({...O,root:c,repo:E})}),[je,qt]=n(!1);o(()=>qt(!0),[]);let{count:_e,clear:We}=ce;if(o(()=>{if(!l)return;let O=(ee)=>{if(ee.key==="Escape"&&_e>0)We()};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[l,_e,We]),!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:E,repos:M,reposScanning:R,onRefreshRepos:D,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 ${be?"file-tree-touch":""} ${ue.highlighted?"bg-info/[0.06]":""}`,onContextMenu:(O)=>{O.preventDefault(),ne({x:O.clientX,y:O.clientY})},onDragEnter:ue.onDragEnter,onDragLeave:ue.onDragLeave,onDragOver:ue.onDragOver,onDrop:ue.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(Oe,{file:O,rootPath:c,basePath:H.root,repo:E,onLoadChildren:G,onOpenFile:p,onActionComplete:j,onCreated:de,onRenamed:ye,expandedPaths:y,onToggleFolder:K,gitFileMap:A,gitFolderMap:I,clipboard:Y,archive:ke,selection:ce,selectionTargets:xe,dragging:V,onDragStart:ge,onDragEnd:()=>ge(null),onDropOn:(ee)=>{if(!V)return;Y.move(V,ee)},onUnfold:q,onFold:X,foldRoots:he.roots,touch:be},O.path))}),e(Mt,{}),je&&e(St,{menu:te,menuRef:ie,pasteLabel:pe,busy:Y.busy,create:De,onAction:(O)=>{if(ne(null),O==="new_file")De.openDialog("file");if(O==="new_folder")De.openDialog("folder");if(O==="paste")Y.paste(ve)}}),je&&e(Et,{archive:ke})]})}export{ri as FileExplorer};
@@ -1 +1 @@
1
- import{n,o,K,i,a,Ge,Pe,_e,ie,e,s,p,B,C,tt,ki,ir,h,sr,We,xe,T,rt,Ei,$e,X,gt,zo,jo,q0,ob,Kf,Xo,Ri,cg,IA}from"./index-cc7qbfvn.js";import"./index-zhgh7a31.js";import{Fi}from"./index-skwem10a.js";import"./index-7sq6cjt1.js";import{QA,Bu,Fs,Iu,_u,Su,Tu,Du,Nu,Qu,Ru,Lu}from"./index-wn28m9h7.js";var vt={name:"panel-right-close",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]},be=s(vt);var z=new Set,ae=new Set,ge=new Set;function ve(){ge=new Set(z);for(let t of[...ae])t()}function he(t){let r=new Set(t);if(r.size===z.size){let l=!0;for(let d of r)if(!z.has(d)){l=!1;break}if(l)return}z.clear();for(let l of r)z.add(l);ve()}function ye(t){let r=new Set(t),l=!1;for(let d of[...z])if(!r.has(d))z.delete(d),l=!0;if(l)ve()}function Ce(t){return z.has(t)}function ke(){return z.size>0}function ht(t){return ae.add(t),()=>{ae.delete(t)}}var xt=ht;function Se(){return Ge(xt,()=>ge)}function we({x:t,y:r,rows:l,onAction:d,onClose:u}){let x=i(null),[m,c]=n({left:t,top:r});return K(()=>{let b=x.current;if(!b)return;let{width:S,height:g}=b.getBoundingClientRect();c({left:Math.min(t,Math.max(0,window.innerWidth-S-8)),top:Math.min(r,Math.max(0,window.innerHeight-g-8))})},[t,r,l.length]),ie(e("div",{className:"fixed inset-0 z-[70]",onClick:u,onContextMenu:(b)=>{b.preventDefault(),u()},children:e("div",{ref:x,role:"menu","aria-label":"Tab actions",className:"glass-popover absolute w-52 bg-paper border border-ink/15 rounded-md shadow-xl py-1 text-xs text-ink",style:{left:`${m.left}px`,top:`${m.top}px`},onClick:(b)=>b.stopPropagation(),children:l.map((b)=>e("button",{type:"button",role:"menuitem",onClick:()=>{d(b.action),u()},className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 transition-colors cursor-pointer",children:b.label},b.action))})}),document.body)}var ee={rightFileId:null,fraction:0.5};function ne(t,r,l){if(t===null)return!1;if(t===r)return!1;return l.includes(t)}function Ee(t,r){for(let l=r.length-1;l>=0;l-=1){let d=r[l];if(d!==t)return d}return null}function Te(t,r){if(t.rightFileId===null)return t;if(t.rightFileId!==r)return t;return{...t,rightFileId:null}}function Y(t){if(!Number.isFinite(t))return ee.fraction;return Math.max(0.2,Math.min(0.8,t))}function Ne(t,r){if(typeof t!=="object"||t===null)return ee;let l=t,d=typeof l.fraction==="number"?Y(l.fraction):ee.fraction,u=typeof l.rightFileId==="string"||typeof l.rightFileId==="number"?l.rightFileId:null;if(u===null||!r.includes(u))return{rightFileId:null,fraction:d};return{rightFileId:u,fraction:d}}function Me({tab:t,openedFiles:r,dirtyIds:l,reopenable:d,activeFileId:u,splitRightFileId:x}){let m=r.filter((g)=>g.id!==t.id),c=r.filter((g)=>!l.has(g.id)),b=r.map((g)=>g.id);return[{action:"split-right",label:"Split right",enabled:ne(t.id,u,b)},{action:"unsplit",label:"Unsplit",enabled:x!==null},{action:"close",label:"Close",enabled:!0},{action:"close-others",label:"Close others",enabled:m.length>0},{action:"close-all",label:"Close all",enabled:r.length>0},{action:"close-saved",label:"Close saved",enabled:c.some((g)=>g.id!==t.id)},{action:"copy-path",label:"Copy path",enabled:Boolean(t.path)},{action:"reveal-in-files",label:"Reveal in Files",enabled:Boolean(t.path)&&!t.isDiff},{action:"reopen-closed",label:"Reopen closed tab",enabled:d>0}].filter((g)=>g.enabled)}function Z({onHide:t}){let r=Xo("toggleEditorPanel","Hide Editor Panel");return e("button",{type:"button",onClick:t,className:"p-1.5 mx-1 rounded transition-colors cursor-pointer text-ink/60 hover:bg-ink/10 hover:text-ink flex-shrink-0",title:r,"aria-label":r,children:e(be,{size:14})})}function Re({openedFiles:t,activeFileId:r,onSelectFile:l,onCloseFile:d,missingIds:u,onCopyPath:x,onRevealInFiles:m,onReopenClosed:c,reopenableCount:b,onSplitTo:S,onUnsplit:g,splitRightFileId:y=null,onHide:R}){let M=Se(),P=i(null),F=i(null),[D,O]=n(5),[I,A]=n(!1),[f,Q]=n(null);$e(F,()=>A(!1)),o(()=>{let v=new ResizeObserver((E)=>{for(let w of E){let q=w.contentRect.width,H=Math.max(1,Math.floor((q-60)/150));O(H)}});if(P.current)v.observe(P.current);return()=>v.disconnect()},[]);let U=Ee(r,t.map((v)=>v.id)),j=[],G=[];if(t.length<=D)j=t;else{let v=t.findIndex((w)=>w.id===r),E=new Set;if(v!==-1&&r!==null)E.add(r);for(let w=t.length-1;w>=0;w--){if(E.size>=D)break;E.add(t[w].id)}j=t.filter((w)=>E.has(w.id)),G=t.filter((w)=>!E.has(w.id))}return e("div",{className:`${Ei.desktop} flex bg-ink/10 w-full relative border-b border-ink/10`,ref:P,children:[e("div",{className:"flex overflow-hidden",children:j.map((v)=>{let E=v.id===r,w=Boolean(v.isDiff),q=w?sr(v.diffStatus||"M",v.diffStaged):null,H=Boolean(u?.has(v.id));return e("div",{onClick:()=>l(v.id),onContextMenu:(_)=>{_.preventDefault(),Q({tab:v,x:_.clientX,y:_.clientY})},className:`flex items-center space-x-1.5 px-3 py-1.5 cursor-pointer border-r border-ink/10 min-w-[120px] max-w-[210px] group ${E?"bg-paper border-t-2 border-t-ink text-ink":"bg-transparent border-t-2 border-t-transparent text-ink/60 hover:bg-paper/50"}`,title:H?`${v.path} — file no longer exists`:v.path,children:[w?e(ki,{size:14,className:E?"text-info-text flex-shrink-0":"text-info-text flex-shrink-0"}):e(gt,{name:v.name,size:14,className:`flex-shrink-0${E||H?"":" opacity-60"}${H?" text-error-text":""}`}),e("span",{className:`text-xs font-mono truncate flex-1${H?" text-error-text line-through":""}`,children:v.name}),q&&e("span",{className:`px-1 text-[10px] font-mono font-bold rounded ${q.badgeBgClass}`,children:q.charStatus}),e(De,{dirty:M.has(v.id),active:E,label:`Close ${v.name}`,onClose:()=>d(v.id)})]},v.id)})}),f?e(we,{x:f.x,y:f.y,rows:Me({tab:f.tab,openedFiles:t,dirtyIds:M,reopenable:b?.()??0,activeFileId:r,splitRightFileId:y}),onAction:(v)=>{let E=f.tab;switch(v){case"close":d(E.id);return;case"close-others":for(let w of[...t].reverse())if(w.id!==E.id)d(w.id);l(E.id);return;case"close-all":for(let w of[...t].reverse())d(w.id);return;case"close-saved":for(let w of[...t].reverse())if(!M.has(w.id))d(w.id);return;case"copy-path":x?.(E);return;case"reveal-in-files":m?.(E);return;case"reopen-closed":c?.();return;case"split-right":S?.(E.id);return;case"unsplit":g?.();return}},onClose:()=>Q(null)}):null,e("div",{className:"ml-auto flex items-center",children:[e("button",{type:"button",onClick:()=>y!==null?g?.():S?.(U),disabled:y===null&&U===null,"aria-pressed":y!==null,"aria-label":"Split editor",title:y!==null?"Close the split pane (the tab stays open)":U===null?"Open another file to split the editor":"Split the editor and show the newest other file",className:`p-1.5 mx-1 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-default ${y!==null?"bg-ink/10 text-ink":"text-ink/60 hover:bg-ink/10"}`,children:e(ir,{size:14})}),R&&e(Z,{onHide:R})]}),G.length>0&&e("div",{className:"relative flex items-center bg-ink/10",ref:F,children:[e("button",{className:`p-1.5 mx-1 rounded hover:bg-ink/10 text-ink/60 ${I?"bg-ink/10 text-ink":""}`,onClick:()=>A(!I),title:"More open files",children:e(C,{size:14})}),I&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-52 bg-paper border border-ink/10 rounded shadow-lg z-50 py-1",children:[e("div",{className:"px-3 py-1 text-[10px] uppercase font-mono text-ink/40 border-b border-ink/10 mb-1",children:"Older Tabs"}),G.map((v)=>{let E=Boolean(u?.has(v.id));return e("div",{onClick:()=>{l(v.id),A(!1)},className:"flex items-center space-x-2 px-3 py-1.5 hover:bg-ink/5 cursor-pointer group",children:[v.isDiff?e(ki,{size:14,className:"text-info-text"}):e(gt,{name:v.name,size:14,className:E?"text-error-text":"opacity-60"}),e("span",{className:`text-xs font-mono truncate flex-1 ${E?"text-error-text line-through":"text-ink/80"}`,children:v.name}),e(De,{dirty:M.has(v.id),active:!1,label:`Close ${v.name}`,onClose:()=>{if(d(v.id),G.length===1)A(!1)}})]},v.id)})]})]})]})}function De({dirty:t,active:r,label:l,onClose:d}){return e("div",{role:"button",tabIndex:-1,"aria-label":l,title:t?`${l} — unsaved changes`:l,className:`p-0.5 rounded hover:bg-ink/10 touch-visible ${r||t?"opacity-100":"opacity-0 group-hover:opacity-100"}`,onClick:(u)=>{u.stopPropagation(),d()},children:t?e("span",{className:"block w-2 h-2 rounded-full bg-current mx-0.5","data-tab-dirty":"","aria-hidden":"true"}):e(h,{size:12})})}function Oe({pluginId:t,Component:r,sessionId:l,className:d="",onHide:u}){return e("div",{className:`flex flex-col h-full bg-canvas ${d}`,children:[u&&e("div",{className:"flex justify-end flex-shrink-0 border-b border-ink/10",children:e(Z,{onHide:u})}),e(rt,{pluginId:t,children:e(r,{sessionId:l,workspacePath:null})})]})}function Ie({className:t="",onHide:r}){return e("div",{className:`relative flex flex-col h-full bg-canvas items-center justify-center text-muted ${t}`,children:[r&&e("div",{className:"absolute top-0 right-0 flex items-center",children:e(Z,{onHide:r})}),e(gt,{name:"placeholder.txt",size:48,className:"mb-4 opacity-20"}),e("p",{className:"font-mono text-sm",children:"Select a file to open"})]})}function Ae({searchReveal:t,revealMatch:r}){let l=i(r);l.current=r;let d=i(null);o(()=>{if(!t||d.current===t.request)return;d.current=t.request,l.current({query:t.request.query,options:t.request.options,line:t.request.line})},[t])}function Fe({openedFiles:t,dirtyKeys:r,activeFile:l,previewReady:d,setPreviewMode:u,sessionId:x}){o(()=>{let m=new Set(t.filter((c)=>!c.isDiff&&c.content===void 0).map((c)=>c.id));he([...r].filter((c)=>m.has(c)))},[r,t]),o(()=>{if(!d)return;let m=l?.id;if(!l||m===void 0||m===null)return;if(!Bu(Fs(l.name)))return;let c=xe(x,"editor.previewMode");if(c&&c[m]!==void 0)return;u((b)=>b[m]===void 0?{...b,[m]:!0}:b)},[d,l])}function Le({activeFile:t,externalChange:r,conflict:l,onReload:d,onKeepMine:u}){if(!t)return null;if(l)return e(Qu,{diskMtimeMs:l.diskMtimeMs,fileName:t.name,onReload:d,onKeepMine:u});if(r)return e(Nu,{fileName:t.name,onReload:d,onKeepMine:u});return null}async function Be(t){let r=t.name.trim();if(!r)return{status:"failed",reason:"Enter a file name."};let l=new FormData;if(l.append("actionType","saveAs"),l.append("path",t.parent),l.append("name",r),l.append("content",t.content),l.append("eol",t.eol),t.root)l.append("root",t.root);if(t.repo&&t.repo!==".")l.append("repo",t.repo);try{let d=await fetch("/api/fs/action",{method:"POST",body:l}),u=await d.json().catch(()=>null),x=typeof u?.error==="string"?u.error:null;if(d.status===409)return{status:"exists",reason:x??`${r} already exists.`};if(d.ok&&u?.success&&typeof u.path==="string")return{status:"written",path:u.path};return{status:"failed",reason:x??"The file could not be written."}}catch{return{status:"failed",reason:"The file could not be written."}}}function Ke(t){let r=t.lastIndexOf(".");if(r<=0)return`${t} copy`;return`${t.slice(0,r)} copy${t.slice(r)}`}function ze(t){let r=t.trim();if(!r)return!1;if(r==="."||r==="..")return!1;return!r.includes("/")&&!r.includes("\\")}function yt(t){let r=t.lastIndexOf("/");return r===-1?"":t.slice(0,r)}function He({fileName:t,filePath:r,content:l,eol:d,root:u,repo:x,onSaved:m,onClose:c}){let[b,S]=n(()=>yt(r)),[g,y]=n(()=>Ke(t)),[R,M]=n(!1),[P,F]=n(null),D=i(null);o(()=>{D.current?.focus(),D.current?.select()},[]);let O=ze(g),I=async()=>{if(!O||R)return;M(!0),F(null);let f=await Be({parent:b,name:g,content:l,eol:d,root:u,repo:x});if(M(!1),f.status==="written"){m({path:f.path});return}F(f.reason)},A=(f)=>{if(f.key==="Enter"){f.preventDefault(),I();return}if(f.key==="Escape")f.preventDefault(),c()};return e(X,{onClose:c,maxWidthClass:"max-w-md",header:e("span",{className:"text-sm font-semibold text-ink",children:"Save as"}),footer: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:c,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer",children:"Cancel"}),e("button",{type:"button",onClick:()=>void I(),disabled:!O||R,className:"flex items-center gap-1.5 px-3 py-1.5 rounded bg-ink text-paper disabled:opacity-40 disabled:cursor-default cursor-pointer",children:[R?e(p,{size:12,className:"animate-spin"}):e(tt,{size:12}),"Save"]})]}),children:e("div",{className:"px-4 py-3 space-y-2 text-xs",children:[e("label",{className:"block",children:[e("span",{className:"block text-[10px] uppercase tracking-wide text-ink/50 mb-1",children:"Folder"}),e("input",{value:b,onInput:(f)=>S(f.target.value),onKeyDown:A,placeholder:"(workspace root)","aria-label":"Destination folder",className:"w-full bg-paper border border-ink/20 rounded px-2 py-1 font-mono text-ink outline-none focus:border-ink/40"})]}),e("label",{className:"block",children:[e("span",{className:"block text-[10px] uppercase tracking-wide text-ink/50 mb-1",children:"Name"}),e("input",{ref:D,value:g,onInput:(f)=>y(f.target.value),onKeyDown:A,"aria-label":"File name","aria-invalid":!O,className:`w-full bg-paper border rounded px-2 py-1 font-mono text-ink outline-none ${O?"border-ink/20 focus:border-ink/40":"border-error text-error-text"}`})]}),!O?e("div",{className:"text-[10px] text-error-text font-mono",children:"Enter a file name without a path separator"}):null,P?e("div",{className:"text-[10px] text-error-text font-mono",children:P}):null,e("div",{className:"text-[10px] text-ink/40",children:"The original file stays where it is, and its tab stays open."})]})})}function Ue(){o(()=>{let t=(r)=>{if(!ke())return;r.preventDefault(),r.returnValue=""};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[])}function qe({fileName:t,onAnswer:r}){return e(X,{onClose:()=>r("cancel"),header:e("div",{className:"flex items-center gap-2",children:[e(B,{size:15,className:"text-warning-text"}),e("span",{className:"text-sm font-semibold text-ink",children:"Unsaved changes"})]}),footer: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:()=>r("cancel"),className:"px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer",children:"Cancel"}),e("button",{type:"button",onClick:()=>r("discard"),className:"px-3 py-1.5 rounded border border-error/40 text-error-text hover:bg-error/10 transition-colors cursor-pointer",children:"Discard"}),e("button",{type:"button",onClick:()=>r("save"),className:"px-3 py-1.5 rounded bg-ink text-paper hover:bg-ink/90 transition-colors cursor-pointer",children:"Save & close"})]}),children:e("div",{className:"px-4 py-3 text-xs text-ink/80",children:[e("span",{className:"font-mono text-ink",children:t})," has changes that are not on disk.",e("div",{className:"mt-1 text-ink/50",children:"Discarding them cannot be undone."})]})})}function Ve({closeGuard:t,activeFile:r,saveMissingConfirm:l,onCancelSaveMissing:d,onConfirmSaveMissing:u}){if(t.pending)return e(qe,{fileName:t.pending.name,onAnswer:t.answer});if(l&&r)return e(Ru,{fileName:r.name,filePath:r.path,onClose:d,onConfirm:u});return null}function Xe({className:t="",isMaximized:r,onKeyDownCapture:l,onFocusCapture:d,asSplitPane:u,tabs:x,activeFile:m,editor:c,externalChange:b,conflict:S,onReload:g,onKeepMine:y,body:R,saveAsOpen:M,onSaveAsClose:P,onSavedAs:F,closeGuard:D}){let O=r?"fixed inset-0 z-50 flex flex-col bg-canvas":`flex flex-col h-full bg-canvas ${t}`;return e("div",{className:O,onKeyDownCapture:l,onFocusCapture:d,children:[u?null:x,e(Le,{activeFile:m,externalChange:b,conflict:S,onReload:g,onKeepMine:y}),R,M&&m?e(He,{fileName:m.name,filePath:m.path,content:c.content,eol:c.eol,root:m.root,repo:m.repo,onSaved:({path:I})=>F(I),onClose:P}):null,e(Ve,{closeGuard:D,activeFile:m,saveMissingConfirm:c.saveMissingConfirm,onCancelSaveMissing:c.cancelSaveMissing,onConfirmSaveMissing:c.confirmSaveMissing})]})}function Je({fileName:t,onClose:r,children:l}){return e("div",{className:"flex flex-col h-full min-w-0","data-split-pane":"",children:[e("div",{className:"flex items-center justify-between gap-2 px-3 py-1 border-b border-ink/10 bg-canvas flex-shrink-0",children:[e("span",{className:"text-[11px] font-mono text-ink/60 truncate",title:t,children:t}),e("button",{type:"button",onClick:r,className:"p-0.5 rounded hover:bg-ink/10 text-ink/50 hover:text-ink transition-colors cursor-pointer flex-shrink-0",title:"Close this pane (the tab stays open)","aria-label":"Close split pane",children:e(h,{size:12})})]}),e("div",{className:"flex-1 min-h-0",children:l})]})}function Ye({fraction:t,onFraction:r,rightPaneName:l,onClosePane:d,rightPane:u,children:x}){let m=i(null),c=i(null),b=Kf(c),S=(g)=>{let y=g.currentTarget,R=m.current;if(!y||!R)return;y.setPointerCapture(g.pointerId);let M=(F)=>{let D=R.getBoundingClientRect();if(D.width===0)return;r(Y((F.clientX-D.left)/D.width))},P=()=>{y.releasePointerCapture(g.pointerId),y.removeEventListener("pointermove",M),y.removeEventListener("pointerup",P)};y.addEventListener("pointermove",M),y.addEventListener("pointerup",P)};return e("div",{ref:m,className:"flex w-full h-full","data-split-column":"",children:[e("div",{className:"flex flex-col min-w-0 h-full",style:{width:`${Math.round(Y(t)*100)}%`},children:x}),e("div",{ref:c,className:`w-[3px] flex-shrink-0 cursor-col-resize transition-colors active:bg-ink/40 ${b?"bg-ink/40":"bg-ink/10"}`,role:"separator","aria-orientation":"vertical","aria-label":"Resize split panes",onPointerDown:S}),e("div",{className:"flex-1 min-w-0 h-full",children:e(Je,{fileName:l,onClose:d,children:u})})]})}function Ze({openedFiles:t,activeFileId:r,enabled:l}){let[d,u]=T("editor.split",ee),x=t.map((y)=>y.id),m=Te(Ne(d,x),r),c=l&&m.rightFileId!==null?t.find((y)=>y.id===m.rightFileId)??null:null,b=a((y)=>{if(y!==null&&!ne(y,r,x))return;u({...m,rightFileId:y})},[m,u,r,x]),S=a(()=>u({...m,rightFileId:null}),[m,u]),g=a((y)=>u({...m,fraction:Y(y)}),[m,u]);return{rightFile:c,fraction:m.fraction,splitTo:b,close:S,setFraction:g}}function Qe({find:t,runCommand:r,reopenClosed:l}){let d=i(t);d.current=t;let u=i(r);u.current=r;let x=i(l);return x.current=l,{onKeyDownCapture:a((c)=>{let b=d.current;if(c.key==="Escape"){if(!b.open)return;c.preventDefault(),c.stopPropagation(),b.close();return}if((c.metaKey||c.ctrlKey)&&c.shiftKey&&c.code==="KeyT"){if(x.current?.())c.preventDefault(),c.stopPropagation();return}let S=q0(Ri,c);if(!S||!cg(S))return;c.preventDefault(),c.stopPropagation(),u.current(S)},[])}}function je(t){let r=i(t);r.current=t;let l=i(null);if(!l.current)l.current={saveNow:()=>r.current.saveNow(),runCommand:(u)=>r.current.runCommand(u)};return o(()=>{let u=l.current;if(!u)return;return IA(u)},[]),{onFocusCapture:a(()=>{if(l.current)IA(l.current)},[])}}function et({openedFiles:t,activeFileId:r,onSelectFile:l,onCloseFile:d,saveNow:u}){let[x,m]=n(null);Ue();let c=a((S)=>{let g=t.find((y)=>y.id===S);if(g&&Ce(S)){m(g);return}d(S)},[t,d]),b=a((S)=>{let g=x;if(!g)return;if(S==="cancel"){m(null);return}if(S==="save"){if(g.id!==r)l(g.id);u()}m(null),d(g.id)},[x,r,l,u,d]);return{requestClose:c,pending:x,answer:b}}function nt(){let[t,r]=n(0),[l,d]=n(!1),u=a(()=>r((x)=>x+1),[]);return{goToLineRequest:t,openGoToLine:u,saveAsOpen:l,setSaveAsOpen:d}}var Ct=_e(()=>import("./Body-ysmhxbvk.js").then((t)=>({default:t.EditorBody})));function ot(t){return e(Pe,{fallback:e("div",{className:"h-full w-full"}),children:e(Ct,{...t})})}function kt({className:t="",openedFiles:r,activeFileId:l,onSelectFile:d,onCloseFile:u,onConvertDiffToEditor:x,refreshKey:m=0,onFileSaved:c,onOpenPath:b,onReopenClosed:S,reopenableCount:g,onCopyPath:y,onRevealInFiles:R,rootPath:M=null,repoPath:P=null,activeEditorPanelKey:F=null,forcedActiveFileId:D=null,asSplitPane:O=!1,onHidePanel:I}){let A=O?D:l,f=r.find((k)=>k.id===A),[Q,U,j]=T("editor.previewMode",{}),G=Lu(String(A??"")),[v,E]=T("editor.zoomLevel",zo),[w,q]=n(!1),[H,_]=T("editor.wordWrap",!0),J=nt(),{sessionId:le}=We(),L=Ze({openedFiles:r,activeFileId:A,enabled:!O}),W=i(null),it=jo(),st=Fi(),de=Iu(r,m),ue=Boolean(f&&de.has(f.id)),N=_u(f??null,{reportSaveError:!0,onFileSaved:c,missing:ue}),at=QA({path:f?.path??"",content:N.content,language:N.language}),lt=N.diskChange,pe=et({openedFiles:r,activeFileId:A,onSelectFile:d,onCloseFile:u,saveNow:N.saveNow}),te=Su({text:N.content,documentKey:`${f?.id??""}\x00${N.language}`,readSelection:()=>W.current?.getSelection()??null,select:(k,V,se=!0)=>W.current?.select(k,V,se),reveal:(k)=>W.current?.revealOffset(k),applyDocument:(k,V,se)=>W.current?.applyDocument(k,V,se),toggleWordWrap:()=>_((k)=>!k)}),ce=Tu(f?.path??null,N.content,N.loaded&&!N.loadError);Ae({searchReveal:ce,revealMatch:te.revealMatch}),Du({file:f,editor:N,surfaceRef:W,isPreview:f?Q[f.id]===!0:!1,exitPreview:()=>{let k=f?.id;if(k===void 0||k===null)return;U((V)=>({...V,[k]:!1}))}}),o(()=>{if(m>0)N.reset()},[m]),o(()=>{N.retain(r.map((k)=>k.id)),ye(r.map((k)=>k.id))},[r]),Fe({openedFiles:r,dirtyKeys:N.dirtyKeys,activeFile:f,previewReady:j,setPreviewMode:U,sessionId:le});let dt=()=>{if(!f)return;U((k)=>({...k,[f.id]:!k[f.id]}))},oe=(k)=>{if(cg(k)){te.runCommand(k);return}if(k==="toggleWordWrap"){_((V)=>!V);return}if(k==="goToLine"){J.openGoToLine();return}W.current?.runCommand(k)},ut=Qe({find:te,runCommand:oe,reopenClosed:S}),pt=je({saveNow:N.saveNow,runCommand:oe}),re=ob(F);if(re)return e(Oe,{pluginId:re.pluginId,Component:re.Component,sessionId:le,className:t,onHide:I});if(r.length===0)return e(Ie,{className:t,onHide:I});let ct=N.viewerKind,me=f?Q[f.id]:!1,mt={activeFile:f,editor:N,find:te,surfaceRef:W,pluginFileView:at,wordWrap:H,setWordWrap:_,viewerKind:ct,isPreview:Boolean(me),isReviewing:Boolean(me)&&G.active,onToggleReview:G.toggle,isMaximized:w,setIsMaximized:q,zoomLevel:v,setZoomLevel:E,goToLineRequest:J.goToLineRequest,onSaveAs:()=>J.setSaveAsOpen(!0),onOpenPath:b,rootPath:M,repoPath:P,runCommand:oe,editorFontFamily:it,editorTheme:st,togglePreview:dt,revealActive:Boolean(ce),missing:ue,onConvertDiffToEditor:x,onFileSaved:c},ft=(k)=>({openedFiles:r,activeFileId:l,onSelectFile:d,onCloseFile:u,onConvertDiffToEditor:x,refreshKey:m,onFileSaved:c,onOpenPath:b,rootPath:M,repoPath:P,forcedActiveFileId:k,asSplitPane:!0}),bt=e(Re,{openedFiles:r,activeFileId:l,onSelectFile:d,onCloseFile:pe.requestClose,missingIds:de,onCopyPath:y,onRevealInFiles:R,onReopenClosed:S,reopenableCount:g,onSplitTo:L.splitTo,onUnsplit:L.close,splitRightFileId:L.rightFile?.id??null,onHide:I}),fe=e(Xe,{className:t,isMaximized:w,onKeyDownCapture:ut.onKeyDownCapture,onFocusCapture:pt.onFocusCapture,asSplitPane:O,tabs:bt,activeFile:f,editor:N,externalChange:lt,conflict:N.conflict,onReload:N.resolveConflictByReload,onKeepMine:N.keepMineAgainstDisk,body:e(ot,{...mt}),saveAsOpen:J.saveAsOpen,onSaveAsClose:()=>J.setSaveAsOpen(!1),onSavedAs:(k)=>{J.setSaveAsOpen(!1),b?.(k)},closeGuard:pe});if(!L.rightFile)return fe;return e(Ye,{fraction:L.fraction,onFraction:L.setFraction,rightPaneName:L.rightFile.name,onClosePane:L.close,rightPane:e(kt,{...ft(L.rightFile.id)}),children:fe})}export{kt as Editor};
1
+ import{n,o,K,i,a,He,Fe,_e,se,e,s,p,B,C,rt,Ei,ir,h,lr,Oe,fe,T,ot,Si,$e,X,ht,Ho,Ko,ab,vb,ng,ri,Pi,hg,FA}from"./index-eggbcdwx.js";import"./index-2f6afhze.js";import{zi}from"./index-wwyjzhgs.js";import"./index-q3k8r0ms.js";import{GA,Nu,Us,Qu,Ru,Lu,Mu,Fu,Pu,Ou,$u,zu}from"./index-c253x7vt.js";var gt={name:"panel-right-close",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]},ge=s(gt);var z=new Set,ae=new Set,ve=new Set;function he(){ve=new Set(z);for(let t of[...ae])t()}function xe(t){let r=new Set(t);if(r.size===z.size){let l=!0;for(let d of r)if(!z.has(d)){l=!1;break}if(l)return}z.clear();for(let l of r)z.add(l);he()}function ye(t){let r=new Set(t),l=!1;for(let d of[...z])if(!r.has(d))z.delete(d),l=!0;if(l)he()}function Ce(t){return z.has(t)}function ke(){return z.size>0}function vt(t){return ae.add(t),()=>{ae.delete(t)}}var xt=vt;function Se(){return He(xt,()=>ve)}function we({x:t,y:r,rows:l,onAction:d,onClose:u}){let x=i(null),[m,c]=n({left:t,top:r});return K(()=>{let b=x.current;if(!b)return;let{width:S,height:g}=b.getBoundingClientRect();c({left:Math.min(t,Math.max(0,window.innerWidth-S-8)),top:Math.min(r,Math.max(0,window.innerHeight-g-8))})},[t,r,l.length]),se(e("div",{className:"fixed inset-0 z-[70]",onClick:u,onContextMenu:(b)=>{b.preventDefault(),u()},children:e("div",{ref:x,role:"menu","aria-label":"Tab actions",className:"glass-popover absolute w-52 bg-paper border border-ink/15 rounded-md shadow-xl py-1 text-xs text-ink",style:{left:`${m.left}px`,top:`${m.top}px`},onClick:(b)=>b.stopPropagation(),children:l.map((b)=>e("button",{type:"button",role:"menuitem",onClick:()=>{d(b.action),u()},className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 transition-colors cursor-pointer",children:b.label},b.action))})}),document.body)}var ee={rightFileId:null,fraction:0.5};function ne(t,r,l){if(t===null)return!1;if(t===r)return!1;return l.includes(t)}function Ee(t,r){for(let l=r.length-1;l>=0;l-=1){let d=r[l];if(d!==t)return d}return null}function Te(t,r){if(t.rightFileId===null)return t;if(t.rightFileId!==r)return t;return{...t,rightFileId:null}}function Y(t){if(!Number.isFinite(t))return ee.fraction;return Math.max(0.2,Math.min(0.8,t))}function Ne(t,r){if(typeof t!=="object"||t===null)return ee;let l=t,d=typeof l.fraction==="number"?Y(l.fraction):ee.fraction,u=typeof l.rightFileId==="string"||typeof l.rightFileId==="number"?l.rightFileId:null;if(u===null||!r.includes(u))return{rightFileId:null,fraction:d};return{rightFileId:u,fraction:d}}function Me({tab:t,openedFiles:r,dirtyIds:l,reopenable:d,activeFileId:u,splitRightFileId:x}){let m=r.filter((g)=>g.id!==t.id),c=r.filter((g)=>!l.has(g.id)),b=r.map((g)=>g.id);return[{action:"split-right",label:"Split right",enabled:ne(t.id,u,b)},{action:"unsplit",label:"Unsplit",enabled:x!==null},{action:"close",label:"Close",enabled:!0},{action:"close-others",label:"Close others",enabled:m.length>0},{action:"close-all",label:"Close all",enabled:r.length>0},{action:"close-saved",label:"Close saved",enabled:c.some((g)=>g.id!==t.id)},{action:"copy-path",label:"Copy path",enabled:Boolean(t.path)},{action:"reveal-in-files",label:"Reveal in Files",enabled:Boolean(t.path)&&!t.isDiff},{action:"reopen-closed",label:"Reopen closed tab",enabled:d>0}].filter((g)=>g.enabled)}function Z({onHide:t}){let r=ri("toggleEditorPanel","Hide Editor Panel");return e("button",{type:"button",onClick:t,className:"p-1.5 mx-1 rounded transition-colors cursor-pointer text-ink/60 hover:bg-ink/10 hover:text-ink flex-shrink-0",title:r,"aria-label":r,children:e(ge,{size:14})})}function De({openedFiles:t,activeFileId:r,onSelectFile:l,onCloseFile:d,missingIds:u,onCopyPath:x,onRevealInFiles:m,onReopenClosed:c,reopenableCount:b,onSplitTo:S,onUnsplit:g,splitRightFileId:y=null,onHide:R}){let M=Se(),P=i(null),F=i(null),[D,O]=n(5),[I,A]=n(!1),[f,Q]=n(null);$e(F,()=>A(!1)),o(()=>{let v=new ResizeObserver((E)=>{for(let w of E){let q=w.contentRect.width,H=Math.max(1,Math.floor((q-60)/150));O(H)}});if(P.current)v.observe(P.current);return()=>v.disconnect()},[]);let U=Ee(r,t.map((v)=>v.id)),j=[],G=[];if(t.length<=D)j=t;else{let v=t.findIndex((w)=>w.id===r),E=new Set;if(v!==-1&&r!==null)E.add(r);for(let w=t.length-1;w>=0;w--){if(E.size>=D)break;E.add(t[w].id)}j=t.filter((w)=>E.has(w.id)),G=t.filter((w)=>!E.has(w.id))}return e("div",{className:`${Si.desktop} flex bg-ink/10 w-full relative border-b border-ink/10`,ref:P,children:[e("div",{className:"flex overflow-hidden",children:j.map((v)=>{let E=v.id===r,w=Boolean(v.isDiff),q=w?lr(v.diffStatus||"M",v.diffStaged):null,H=Boolean(u?.has(v.id));return e("div",{onClick:()=>l(v.id),onContextMenu:(_)=>{_.preventDefault(),Q({tab:v,x:_.clientX,y:_.clientY})},className:`flex items-center space-x-1.5 px-3 py-1.5 cursor-pointer border-r border-ink/10 min-w-[120px] max-w-[210px] group ${E?"bg-paper border-t-2 border-t-ink text-ink":"bg-transparent border-t-2 border-t-transparent text-ink/60 hover:bg-paper/50"}`,title:H?`${v.path} — file no longer exists`:v.path,children:[w?e(Ei,{size:14,className:E?"text-info-text flex-shrink-0":"text-info-text flex-shrink-0"}):e(ht,{name:v.name,size:14,className:`flex-shrink-0${E||H?"":" opacity-60"}${H?" text-error-text":""}`}),e("span",{className:`text-xs font-mono truncate flex-1${H?" text-error-text line-through":""}`,children:v.name}),q&&e("span",{className:`px-1 text-[10px] font-mono font-bold rounded ${q.badgeBgClass}`,children:q.charStatus}),e(Pe,{dirty:M.has(v.id),active:E,label:`Close ${v.name}`,onClose:()=>d(v.id)})]},v.id)})}),f?e(we,{x:f.x,y:f.y,rows:Me({tab:f.tab,openedFiles:t,dirtyIds:M,reopenable:b?.()??0,activeFileId:r,splitRightFileId:y}),onAction:(v)=>{let E=f.tab;switch(v){case"close":d(E.id);return;case"close-others":for(let w of[...t].reverse())if(w.id!==E.id)d(w.id);l(E.id);return;case"close-all":for(let w of[...t].reverse())d(w.id);return;case"close-saved":for(let w of[...t].reverse())if(!M.has(w.id))d(w.id);return;case"copy-path":x?.(E);return;case"reveal-in-files":m?.(E);return;case"reopen-closed":c?.();return;case"split-right":S?.(E.id);return;case"unsplit":g?.();return}},onClose:()=>Q(null)}):null,e("div",{className:"ml-auto flex items-center",children:[e("button",{type:"button",onClick:()=>y!==null?g?.():S?.(U),disabled:y===null&&U===null,"aria-pressed":y!==null,"aria-label":"Split editor",title:y!==null?"Close the split pane (the tab stays open)":U===null?"Open another file to split the editor":"Split the editor and show the newest other file",className:`p-1.5 mx-1 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-default ${y!==null?"bg-ink/10 text-ink":"text-ink/60 hover:bg-ink/10"}`,children:e(ir,{size:14})}),R&&e(Z,{onHide:R})]}),G.length>0&&e("div",{className:"relative flex items-center bg-ink/10",ref:F,children:[e("button",{className:`p-1.5 mx-1 rounded hover:bg-ink/10 text-ink/60 ${I?"bg-ink/10 text-ink":""}`,onClick:()=>A(!I),title:"More open files",children:e(C,{size:14})}),I&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-52 bg-paper border border-ink/10 rounded shadow-lg z-50 py-1",children:[e("div",{className:"px-3 py-1 text-[10px] uppercase font-mono text-ink/40 border-b border-ink/10 mb-1",children:"Older Tabs"}),G.map((v)=>{let E=Boolean(u?.has(v.id));return e("div",{onClick:()=>{l(v.id),A(!1)},className:"flex items-center space-x-2 px-3 py-1.5 hover:bg-ink/5 cursor-pointer group",children:[v.isDiff?e(Ei,{size:14,className:"text-info-text"}):e(ht,{name:v.name,size:14,className:E?"text-error-text":"opacity-60"}),e("span",{className:`text-xs font-mono truncate flex-1 ${E?"text-error-text line-through":"text-ink/80"}`,children:v.name}),e(Pe,{dirty:M.has(v.id),active:!1,label:`Close ${v.name}`,onClose:()=>{if(d(v.id),G.length===1)A(!1)}})]},v.id)})]})]})]})}function Pe({dirty:t,active:r,label:l,onClose:d}){return e("div",{role:"button",tabIndex:-1,"aria-label":l,title:t?`${l} — unsaved changes`:l,className:`p-0.5 rounded hover:bg-ink/10 touch-visible ${r||t?"opacity-100":"opacity-0 group-hover:opacity-100"}`,onClick:(u)=>{u.stopPropagation(),d()},children:t?e("span",{className:"block w-2 h-2 rounded-full bg-current mx-0.5","data-tab-dirty":"","aria-hidden":"true"}):e(h,{size:12})})}function Re({pluginId:t,Component:r,sessionId:l,className:d="",onHide:u}){return e("div",{className:`flex flex-col h-full bg-canvas ${d}`,children:[u&&e("div",{className:"flex justify-end flex-shrink-0 border-b border-ink/10",children:e(Z,{onHide:u})}),e(ot,{pluginId:t,children:e(r,{sessionId:l,workspacePath:null})})]})}function Ie({className:t="",onHide:r}){return e("div",{className:`relative flex flex-col h-full bg-canvas items-center justify-center text-muted ${t}`,children:[r&&e("div",{className:"absolute top-0 right-0 flex items-center",children:e(Z,{onHide:r})}),e(ht,{name:"placeholder.txt",size:48,className:"mb-4 opacity-20"}),e("p",{className:"font-mono text-sm",children:"Select a file to open"})]})}function Ae({searchReveal:t,revealMatch:r}){let l=i(r);l.current=r;let d=i(null);o(()=>{if(!t||d.current===t.request)return;d.current=t.request,l.current({query:t.request.query,options:t.request.options,line:t.request.line})},[t])}function Le({openedFiles:t,dirtyKeys:r,activeFile:l,previewReady:d,setPreviewMode:u,sessionId:x}){o(()=>{let m=new Set(t.filter((c)=>!c.isDiff&&c.content===void 0).map((c)=>c.id));xe([...r].filter((c)=>m.has(c)))},[r,t]),o(()=>{if(!d)return;let m=l?.id;if(!l||m===void 0||m===null)return;if(!Nu(Us(l.name)))return;let c=fe(x,"editor.previewMode");if(c&&c[m]!==void 0)return;u((b)=>b[m]===void 0?{...b,[m]:!0}:b)},[d,l])}function Be({activeFile:t,externalChange:r,conflict:l,onReload:d,onKeepMine:u}){if(!t)return null;if(l)return e(Ou,{diskMtimeMs:l.diskMtimeMs,fileName:t.name,onReload:d,onKeepMine:u});if(r)return e(Pu,{fileName:t.name,onReload:d,onKeepMine:u});return null}async function Ke(t){let r=t.name.trim();if(!r)return{status:"failed",reason:"Enter a file name."};let l=new FormData;if(l.append("actionType","saveAs"),l.append("path",t.parent),l.append("name",r),l.append("content",t.content),l.append("eol",t.eol),t.root)l.append("root",t.root);if(t.repo&&t.repo!==".")l.append("repo",t.repo);try{let d=await fetch("/api/fs/action",{method:"POST",body:l}),u=await d.json().catch(()=>null),x=typeof u?.error==="string"?u.error:null;if(d.status===409)return{status:"exists",reason:x??`${r} already exists.`};if(d.ok&&u?.success&&typeof u.path==="string")return{status:"written",path:u.path};return{status:"failed",reason:x??"The file could not be written."}}catch{return{status:"failed",reason:"The file could not be written."}}}function ze(t){let r=t.lastIndexOf(".");if(r<=0)return`${t} copy`;return`${t.slice(0,r)} copy${t.slice(r)}`}function Ue(t){let r=t.trim();if(!r)return!1;if(r==="."||r==="..")return!1;return!r.includes("/")&&!r.includes("\\")}function yt(t){let r=t.lastIndexOf("/");return r===-1?"":t.slice(0,r)}function Ge({fileName:t,filePath:r,content:l,eol:d,root:u,repo:x,onSaved:m,onClose:c}){let[b,S]=n(()=>yt(r)),[g,y]=n(()=>ze(t)),[R,M]=n(!1),[P,F]=n(null),D=i(null);o(()=>{D.current?.focus(),D.current?.select()},[]);let O=Ue(g),I=async()=>{if(!O||R)return;M(!0),F(null);let f=await Ke({parent:b,name:g,content:l,eol:d,root:u,repo:x});if(M(!1),f.status==="written"){m({path:f.path});return}F(f.reason)},A=(f)=>{if(f.key==="Enter"){f.preventDefault(),I();return}if(f.key==="Escape")f.preventDefault(),c()};return e(X,{onClose:c,maxWidthClass:"max-w-md",header:e("span",{className:"text-sm font-semibold text-ink",children:"Save as"}),footer: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:c,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer",children:"Cancel"}),e("button",{type:"button",onClick:()=>void I(),disabled:!O||R,className:"flex items-center gap-1.5 px-3 py-1.5 rounded bg-ink text-paper disabled:opacity-40 disabled:cursor-default cursor-pointer",children:[R?e(p,{size:12,className:"animate-spin"}):e(rt,{size:12}),"Save"]})]}),children:e("div",{className:"px-4 py-3 space-y-2 text-xs",children:[e("label",{className:"block",children:[e("span",{className:"block text-[10px] uppercase tracking-wide text-ink/50 mb-1",children:"Folder"}),e("input",{value:b,onInput:(f)=>S(f.target.value),onKeyDown:A,placeholder:"(workspace root)","aria-label":"Destination folder",className:"w-full bg-paper border border-ink/20 rounded px-2 py-1 font-mono text-ink outline-none focus:border-ink/40"})]}),e("label",{className:"block",children:[e("span",{className:"block text-[10px] uppercase tracking-wide text-ink/50 mb-1",children:"Name"}),e("input",{ref:D,value:g,onInput:(f)=>y(f.target.value),onKeyDown:A,"aria-label":"File name","aria-invalid":!O,className:`w-full bg-paper border rounded px-2 py-1 font-mono text-ink outline-none ${O?"border-ink/20 focus:border-ink/40":"border-error text-error-text"}`})]}),!O?e("div",{className:"text-[10px] text-error-text font-mono",children:"Enter a file name without a path separator"}):null,P?e("div",{className:"text-[10px] text-error-text font-mono",children:P}):null,e("div",{className:"text-[10px] text-ink/40",children:"The original file stays where it is, and its tab stays open."})]})})}function qe(){o(()=>{let t=(r)=>{if(!ke())return;r.preventDefault(),r.returnValue=""};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[])}function We({fileName:t,onAnswer:r}){return e(X,{onClose:()=>r("cancel"),header:e("div",{className:"flex items-center gap-2",children:[e(B,{size:15,className:"text-warning-text"}),e("span",{className:"text-sm font-semibold text-ink",children:"Unsaved changes"})]}),footer: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:()=>r("cancel"),className:"px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer",children:"Cancel"}),e("button",{type:"button",onClick:()=>r("discard"),className:"px-3 py-1.5 rounded border border-error/40 text-error-text hover:bg-error/10 transition-colors cursor-pointer",children:"Discard"}),e("button",{type:"button",onClick:()=>r("save"),className:"px-3 py-1.5 rounded bg-ink text-paper hover:bg-ink/90 transition-colors cursor-pointer",children:"Save & close"})]}),children:e("div",{className:"px-4 py-3 text-xs text-ink/80",children:[e("span",{className:"font-mono text-ink",children:t})," has changes that are not on disk.",e("div",{className:"mt-1 text-ink/50",children:"Discarding them cannot be undone."})]})})}function Ve({closeGuard:t,activeFile:r,saveMissingConfirm:l,onCancelSaveMissing:d,onConfirmSaveMissing:u}){if(t.pending)return e(We,{fileName:t.pending.name,onAnswer:t.answer});if(l&&r)return e($u,{fileName:r.name,filePath:r.path,onClose:d,onConfirm:u});return null}function Xe({className:t="",isMaximized:r,onKeyDownCapture:l,onFocusCapture:d,asSplitPane:u,tabs:x,activeFile:m,editor:c,externalChange:b,conflict:S,onReload:g,onKeepMine:y,body:R,saveAsOpen:M,onSaveAsClose:P,onSavedAs:F,closeGuard:D}){let O=r?"fixed inset-0 z-50 flex flex-col bg-canvas":`flex flex-col h-full bg-canvas ${t}`;return e("div",{className:O,onKeyDownCapture:l,onFocusCapture:d,children:[u?null:x,e(Be,{activeFile:m,externalChange:b,conflict:S,onReload:g,onKeepMine:y}),R,M&&m?e(Ge,{fileName:m.name,filePath:m.path,content:c.content,eol:c.eol,root:m.root,repo:m.repo,onSaved:({path:I})=>F(I),onClose:P}):null,e(Ve,{closeGuard:D,activeFile:m,saveMissingConfirm:c.saveMissingConfirm,onCancelSaveMissing:c.cancelSaveMissing,onConfirmSaveMissing:c.confirmSaveMissing})]})}function Je({fileName:t,onClose:r,children:l}){return e("div",{className:"flex flex-col h-full min-w-0","data-split-pane":"",children:[e("div",{className:"flex items-center justify-between gap-2 px-3 py-1 border-b border-ink/10 bg-canvas flex-shrink-0",children:[e("span",{className:"text-[11px] font-mono text-ink/60 truncate",title:t,children:t}),e("button",{type:"button",onClick:r,className:"p-0.5 rounded hover:bg-ink/10 text-ink/50 hover:text-ink transition-colors cursor-pointer flex-shrink-0",title:"Close this pane (the tab stays open)","aria-label":"Close split pane",children:e(h,{size:12})})]}),e("div",{className:"flex-1 min-h-0",children:l})]})}function Ye({fraction:t,onFraction:r,rightPaneName:l,onClosePane:d,rightPane:u,children:x}){let m=i(null),c=i(null),b=ng(c),S=(g)=>{let y=g.currentTarget,R=m.current;if(!y||!R)return;y.setPointerCapture(g.pointerId);let M=(F)=>{let D=R.getBoundingClientRect();if(D.width===0)return;r(Y((F.clientX-D.left)/D.width))},P=()=>{y.releasePointerCapture(g.pointerId),y.removeEventListener("pointermove",M),y.removeEventListener("pointerup",P)};y.addEventListener("pointermove",M),y.addEventListener("pointerup",P)};return e("div",{ref:m,className:"flex w-full h-full","data-split-column":"",children:[e("div",{className:"flex flex-col min-w-0 h-full",style:{width:`${Math.round(Y(t)*100)}%`},children:x}),e("div",{ref:c,className:`w-[3px] flex-shrink-0 cursor-col-resize transition-colors active:bg-ink/40 ${b?"bg-ink/40":"bg-ink/10"}`,role:"separator","aria-orientation":"vertical","aria-label":"Resize split panes",onPointerDown:S}),e("div",{className:"flex-1 min-w-0 h-full",children:e(Je,{fileName:l,onClose:d,children:u})})]})}function Ze({openedFiles:t,activeFileId:r,enabled:l}){let[d,u]=T("editor.split",ee),x=t.map((y)=>y.id),m=Te(Ne(d,x),r),c=l&&m.rightFileId!==null?t.find((y)=>y.id===m.rightFileId)??null:null,b=a((y)=>{if(y!==null&&!ne(y,r,x))return;u({...m,rightFileId:y})},[m,u,r,x]),S=a(()=>u({...m,rightFileId:null}),[m,u]),g=a((y)=>u({...m,fraction:Y(y)}),[m,u]);return{rightFile:c,fraction:m.fraction,splitTo:b,close:S,setFraction:g}}function Qe({find:t,runCommand:r,reopenClosed:l}){let d=i(t);d.current=t;let u=i(r);u.current=r;let x=i(l);return x.current=l,{onKeyDownCapture:a((c)=>{let b=d.current;if(c.key==="Escape"){if(!b.open)return;c.preventDefault(),c.stopPropagation(),b.close();return}if((c.metaKey||c.ctrlKey)&&c.shiftKey&&c.code==="KeyT"){if(x.current?.())c.preventDefault(),c.stopPropagation();return}let S=ab(Pi,c);if(!S||!hg(S))return;c.preventDefault(),c.stopPropagation(),u.current(S)},[])}}function je(t){let r=i(t);r.current=t;let l=i(null);if(!l.current)l.current={saveNow:()=>r.current.saveNow(),runCommand:(u)=>r.current.runCommand(u)};return o(()=>{let u=l.current;if(!u)return;return FA(u)},[]),{onFocusCapture:a(()=>{if(l.current)FA(l.current)},[])}}function et({openedFiles:t,activeFileId:r,onSelectFile:l,onCloseFile:d,saveNow:u}){let[x,m]=n(null);qe();let c=a((S)=>{let g=t.find((y)=>y.id===S);if(g&&Ce(S)){m(g);return}d(S)},[t,d]),b=a((S)=>{let g=x;if(!g)return;if(S==="cancel"){m(null);return}if(S==="save"){if(g.id!==r)l(g.id);u()}m(null),d(g.id)},[x,r,l,u,d]);return{requestClose:c,pending:x,answer:b}}function tt(){let[t,r]=n(0),[l,d]=n(!1),u=a(()=>r((x)=>x+1),[]);return{goToLineRequest:t,openGoToLine:u,saveAsOpen:l,setSaveAsOpen:d}}var Ct=_e(()=>import("./Body-jqq4654r.js").then((t)=>({default:t.EditorBody})));function nt(t){return e(Fe,{fallback:e("div",{className:"h-full w-full"}),children:e(Ct,{...t})})}function kt({className:t="",openedFiles:r,activeFileId:l,onSelectFile:d,onCloseFile:u,onConvertDiffToEditor:x,refreshKey:m=0,onFileSaved:c,onOpenPath:b,onReopenClosed:S,reopenableCount:g,onCopyPath:y,onRevealInFiles:R,rootPath:M=null,repoPath:P=null,activeEditorPanelKey:F=null,forcedActiveFileId:D=null,asSplitPane:O=!1,onHidePanel:I}){let A=O?D:l,f=r.find((k)=>k.id===A),[Q,U,j]=T("editor.previewMode",{}),G=zu(String(A??"")),[v,E]=T("editor.zoomLevel",Ho),[w,q]=n(!1),[H,_]=T("editor.wordWrap",!0),J=tt(),{sessionId:le}=Oe(),L=Ze({openedFiles:r,activeFileId:A,enabled:!O}),W=i(null),it=Ko(),st=zi(),de=Qu(r,m),ue=Boolean(f&&de.has(f.id)),N=Ru(f??null,{reportSaveError:!0,onFileSaved:c,missing:ue}),at=GA({path:f?.path??"",content:N.content,language:N.language}),lt=N.diskChange,pe=et({openedFiles:r,activeFileId:A,onSelectFile:d,onCloseFile:u,saveNow:N.saveNow}),te=Lu({text:N.content,documentKey:`${f?.id??""}\x00${N.language}`,readSelection:()=>W.current?.getSelection()??null,select:(k,V,ie=!0)=>W.current?.select(k,V,ie),reveal:(k)=>W.current?.revealOffset(k),applyDocument:(k,V,ie)=>W.current?.applyDocument(k,V,ie),toggleWordWrap:()=>_((k)=>!k)}),ce=Mu(f?.path??null,N.content,N.loaded&&!N.loadError);Ae({searchReveal:ce,revealMatch:te.revealMatch}),Fu({file:f,editor:N,surfaceRef:W,isPreview:f?Q[f.id]===!0:!1,exitPreview:()=>{let k=f?.id;if(k===void 0||k===null)return;U((V)=>({...V,[k]:!1}))}}),o(()=>{if(m>0)N.reset()},[m]),o(()=>{N.retain(r.map((k)=>k.id)),ye(r.map((k)=>k.id))},[r]),Le({openedFiles:r,dirtyKeys:N.dirtyKeys,activeFile:f,previewReady:j,setPreviewMode:U,sessionId:le});let dt=()=>{if(!f)return;U((k)=>({...k,[f.id]:!k[f.id]}))},oe=(k)=>{if(hg(k)){te.runCommand(k);return}if(k==="toggleWordWrap"){_((V)=>!V);return}if(k==="goToLine"){J.openGoToLine();return}W.current?.runCommand(k)},ut=Qe({find:te,runCommand:oe,reopenClosed:S}),pt=je({saveNow:N.saveNow,runCommand:oe}),re=vb(F);if(re)return e(Re,{pluginId:re.pluginId,Component:re.Component,sessionId:le,className:t,onHide:I});if(r.length===0)return e(Ie,{className:t,onHide:I});let ct=N.viewerKind,me=f?Q[f.id]:!1,mt={activeFile:f,editor:N,find:te,surfaceRef:W,pluginFileView:at,wordWrap:H,setWordWrap:_,viewerKind:ct,isPreview:Boolean(me),isReviewing:Boolean(me)&&G.active,onToggleReview:G.toggle,isMaximized:w,setIsMaximized:q,zoomLevel:v,setZoomLevel:E,goToLineRequest:J.goToLineRequest,onSaveAs:()=>J.setSaveAsOpen(!0),onOpenPath:b,rootPath:M,repoPath:P,runCommand:oe,editorFontFamily:it,editorTheme:st,togglePreview:dt,revealActive:Boolean(ce),missing:ue,onConvertDiffToEditor:x,onFileSaved:c},ft=(k)=>({openedFiles:r,activeFileId:l,onSelectFile:d,onCloseFile:u,onConvertDiffToEditor:x,refreshKey:m,onFileSaved:c,onOpenPath:b,rootPath:M,repoPath:P,forcedActiveFileId:k,asSplitPane:!0}),bt=e(De,{openedFiles:r,activeFileId:l,onSelectFile:d,onCloseFile:pe.requestClose,missingIds:de,onCopyPath:y,onRevealInFiles:R,onReopenClosed:S,reopenableCount:g,onSplitTo:L.splitTo,onUnsplit:L.close,splitRightFileId:L.rightFile?.id??null,onHide:I}),be=e(Xe,{className:t,isMaximized:w,onKeyDownCapture:ut.onKeyDownCapture,onFocusCapture:pt.onFocusCapture,asSplitPane:O,tabs:bt,activeFile:f,editor:N,externalChange:lt,conflict:N.conflict,onReload:N.resolveConflictByReload,onKeepMine:N.keepMineAgainstDisk,body:e(nt,{...mt}),saveAsOpen:J.saveAsOpen,onSaveAsClose:()=>J.setSaveAsOpen(!1),onSavedAs:(k)=>{J.setSaveAsOpen(!1),b?.(k)},closeGuard:pe});if(!L.rightFile)return be;return e(Ye,{fraction:L.fraction,onFraction:L.setFraction,rightPaneName:L.rightFile.name,onClosePane:L.close,rightPane:e(kt,{...ft(L.rightFile.id)}),children:be})}export{kt as Editor};
@@ -1,2 +1,2 @@
1
- import{n,o,K,i,ie,e,s,Ie}from"./index-cc7qbfvn.js";var _={name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]},Wa=s(_);var M={name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]},Ka=s(M);function O({widths:r,pinned:a,available:c}){if(!(c>0)||r.length===0)return r.map(()=>!0);if(r.reduce((d,u)=>d+u,0)+4*(r.length-1)<=c)return r.map(()=>!0);let m=r.map(()=>!1),v=0,f=0;r.forEach((d,u)=>{if(!a[u])return;v+=d+(f>0?4:0),f+=1,m[u]=!0});let t=c-v-30-4;return r.forEach((d,u)=>{if(a[u])return;let x=d+(f>0?4:0);if(x>t)return;t-=x,f+=1,m[u]=!0}),m}function R(r){return r.some((a)=>!a)}function ii({clusters:r,className:a="",available:c}){let b=i(null),[m,v]=n(null),[f,t]=n(0),[d,u]=n(0),x=c??f,y=r.map((l)=>`${l.id}:${l.pinned?1:0}`).join("|"),h=m?.signature===y,g=h?m.widths:[],k=r.map((l)=>l.pinned===!0),w=c===0?r.map(()=>!1):g.length>0?O({widths:g,pinned:k,available:x}):r.map(()=>!0);K(()=>{let l=b.current;if(!l)return;if(!h){let p=[...l.querySelectorAll("[data-toolbar-cluster]")];if(p.length===r.length){let T=p.map((E)=>E.getBoundingClientRect().width);if(T.some((E)=>E>0))v({signature:y,widths:T})}}if(c===void 0)t(l.clientWidth)},[c,h,y,r.length,d]),o(()=>{let l=b.current;if(!l||typeof ResizeObserver>"u")return;let p=new ResizeObserver(()=>{t(l.clientWidth),u((T)=>T+1)});return p.observe(l),()=>p.disconnect()},[]);let L=r.filter((l,p)=>!w[p]).flatMap((l)=>l.actions);return e("div",{ref:b,style:c===void 0?void 0:{maxWidth:`${c}px`},className:`flex ${c===void 0?"flex-1":"flex-none"} min-w-0 flex-nowrap items-center justify-end gap-x-1 overflow-hidden ${a}`,children:[r.map((l,p)=>w[p]?e("div",{"data-toolbar-cluster":"",className:"flex items-center flex-shrink-0",children:l.children},l.id):null),R(w)&&e(A,{actions:L})]})}function A({actions:r}){let[a,c]=n(!1),[b,m]=n(null),v=i(null),f=i(null);return o(()=>{if(!a)return;let t=(d)=>{let u=d.target;if(v.current?.contains(u)||f.current?.contains(u))return;c(!1)};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}},[a]),o(()=>{if(!a)return;let t=(d)=>{if(d.key==="Escape")c(!1)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[a]),K(()=>{if(!a)return;let t=v.current?.firstElementChild,d=f.current;if(!t||!d)return;let u=t.getBoundingClientRect(),{width:x,height:y}=d.getBoundingClientRect(),h=8,g=u.bottom+4,k=g+y+h<=window.innerHeight?g:Math.max(h,u.top-y-4),w=Math.max(h,Math.min(u.right-x,window.innerWidth-x-h));m({top:k,left:w})},[a,r.length]),e("div",{className:"relative flex-shrink-0",ref:v,children:[e("button",{type:"button",title:"More actions","aria-label":"More actions","aria-haspopup":"menu","aria-expanded":a,onClick:()=>{m(null),c(!a)},className:`flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer ${a?"bg-ink/10 text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,children:e(Ie,{size:14})}),a&&ie(e("div",{ref:f,role:"menu",style:{top:b?.top??0,left:b?.left??0,visibility:b?"visible":"hidden"},className:"glass-popover fixed z-[80] w-52 bg-paper border border-ink/15 rounded-lg shadow-lg py-1 text-xs",children:r.map((t)=>e("button",{type:"button",role:"menuitem",disabled:t.disabled,"aria-pressed":t.active,onClick:()=>{c(!1),t.onSelect()},className:`w-full text-left flex items-center gap-2 px-3 py-1.5 transition-colors disabled:cursor-default disabled:opacity-40 ${t.active?"bg-ink/5 text-ink font-medium":"text-ink/75 hover:bg-ink/5 hover:text-ink"}`,children:[e(t.icon,{size:13,className:"flex-shrink-0"}),e("span",{className:"truncate",children:t.label})]},t.label))}),document.body)]})}
2
- export{Wa,Ka,ii};
1
+ import{n,o,K,i,se,e,s,Ie}from"./index-eggbcdwx.js";var _={name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]},Ya=s(_);var M={name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]},Ja=s(M);function O({widths:r,pinned:a,available:c}){if(!(c>0)||r.length===0)return r.map(()=>!0);if(r.reduce((d,u)=>d+u,0)+4*(r.length-1)<=c)return r.map(()=>!0);let m=r.map(()=>!1),v=0,f=0;r.forEach((d,u)=>{if(!a[u])return;v+=d+(f>0?4:0),f+=1,m[u]=!0});let t=c-v-30-4;return r.forEach((d,u)=>{if(a[u])return;let x=d+(f>0?4:0);if(x>t)return;t-=x,f+=1,m[u]=!0}),m}function R(r){return r.some((a)=>!a)}function ui({clusters:r,className:a="",available:c}){let b=i(null),[m,v]=n(null),[f,t]=n(0),[d,u]=n(0),x=c??f,y=r.map((l)=>`${l.id}:${l.pinned?1:0}`).join("|"),h=m?.signature===y,g=h?m.widths:[],k=r.map((l)=>l.pinned===!0),w=c===0?r.map(()=>!1):g.length>0?O({widths:g,pinned:k,available:x}):r.map(()=>!0);K(()=>{let l=b.current;if(!l)return;if(!h){let p=[...l.querySelectorAll("[data-toolbar-cluster]")];if(p.length===r.length){let T=p.map((E)=>E.getBoundingClientRect().width);if(T.some((E)=>E>0))v({signature:y,widths:T})}}if(c===void 0)t(l.clientWidth)},[c,h,y,r.length,d]),o(()=>{let l=b.current;if(!l||typeof ResizeObserver>"u")return;let p=new ResizeObserver(()=>{t(l.clientWidth),u((T)=>T+1)});return p.observe(l),()=>p.disconnect()},[]);let L=r.filter((l,p)=>!w[p]).flatMap((l)=>l.actions);return e("div",{ref:b,style:c===void 0?void 0:{maxWidth:`${c}px`},className:`flex ${c===void 0?"flex-1":"flex-none"} min-w-0 flex-nowrap items-center justify-end gap-x-1 overflow-hidden ${a}`,children:[r.map((l,p)=>w[p]?e("div",{"data-toolbar-cluster":"",className:"flex items-center flex-shrink-0",children:l.children},l.id):null),R(w)&&e(A,{actions:L})]})}function A({actions:r}){let[a,c]=n(!1),[b,m]=n(null),v=i(null),f=i(null);return o(()=>{if(!a)return;let t=(d)=>{let u=d.target;if(v.current?.contains(u)||f.current?.contains(u))return;c(!1)};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}},[a]),o(()=>{if(!a)return;let t=(d)=>{if(d.key==="Escape")c(!1)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[a]),K(()=>{if(!a)return;let t=v.current?.firstElementChild,d=f.current;if(!t||!d)return;let u=t.getBoundingClientRect(),{width:x,height:y}=d.getBoundingClientRect(),h=8,g=u.bottom+4,k=g+y+h<=window.innerHeight?g:Math.max(h,u.top-y-4),w=Math.max(h,Math.min(u.right-x,window.innerWidth-x-h));m({top:k,left:w})},[a,r.length]),e("div",{className:"relative flex-shrink-0",ref:v,children:[e("button",{type:"button",title:"More actions","aria-label":"More actions","aria-haspopup":"menu","aria-expanded":a,onClick:()=>{m(null),c(!a)},className:`flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer ${a?"bg-ink/10 text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,children:e(Ie,{size:14})}),a&&se(e("div",{ref:f,role:"menu",style:{top:b?.top??0,left:b?.left??0,visibility:b?"visible":"hidden"},className:"glass-popover fixed z-[80] w-52 bg-paper border border-ink/15 rounded-lg shadow-lg py-1 text-xs",children:r.map((t)=>e("button",{type:"button",role:"menuitem",disabled:t.disabled,"aria-pressed":t.active,onClick:()=>{c(!1),t.onSelect()},className:`w-full text-left flex items-center gap-2 px-3 py-1.5 transition-colors disabled:cursor-default disabled:opacity-40 ${t.active?"bg-ink/5 text-ink font-medium":"text-ink/75 hover:bg-ink/5 hover:text-ink"}`,children:[e(t.icon,{size:13,className:"flex-shrink-0"}),e("span",{className:"truncate",children:t.label})]},t.label))}),document.body)]})}
2
+ export{Ya,Ja,ui};