@kabmo-labs/kabmo 0.43.1 → 0.45.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.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +337 -337
- package/dist/client/static/js/{CsvGrid-g67pk2zy.js → CsvGrid-z74weshk.js} +2 -2
- package/dist/client/static/js/{DocxView-pyh6p2kb.js → DocxView-dpe5x9ab.js} +5 -5
- package/dist/client/static/js/{DrawioView-g48r6y2m.js → DrawioView-ftzwjf8v.js} +2 -2
- package/dist/client/static/js/ImageView-vchn6wyq.js +1 -0
- package/dist/client/static/js/LayoutWrapper-1x0gnppc.js +2 -0
- package/dist/client/static/js/{Modal-edw446r8.js → Modal-tteg7vtb.js} +20 -20
- package/dist/client/static/js/{PdfView-6z3cgj37.js → PdfView-vjec8z3z.js} +1 -1
- package/dist/client/static/js/SessionsView-g7z3fxbp.js +1 -0
- package/dist/client/static/js/{SheetView-64076z1j.js → SheetView-hhtfkdhe.js} +25 -25
- package/dist/client/static/js/{SvgPreview-dmpgavgd.js → SvgPreview-48n3ex6p.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-nfz5z1vw.js → abnfDiagram-O67JEVCF-bpvzdara.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-bch3nye9.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-jra2jyzw.js → architectureDiagram-NJMV4G6O-xw62cr7j.js} +11 -11
- package/dist/client/static/js/{astro-dpfdhc5e.js → astro-56b0as3q.js} +1 -1
- package/dist/client/static/js/bash-mevzaywf.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-3szktxam.js → blockDiagram-BEXU5L5S-x3a6cgar.js} +6 -6
- package/dist/client/static/js/c-y1y6v00q.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-xe9vbppt.js → c4Diagram-YGBWAQC7-katvaxbj.js} +6 -6
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-egzhj1xn.js → classDiagram-v2-NBCMYWYE-bjz4mqqh.js} +5 -5
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-dfrk1wnr.js → cose-bilkent-JH36ORCC-fsn80psf.js} +1 -1
- package/dist/client/static/js/cpp-wk9z0c5g.js +1 -0
- package/dist/client/static/js/css-3w3p9s67.js +1 -0
- package/dist/client/static/js/css-g85rwzty.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-vqy5jtnk.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-xefpcmpg.js → cynefinDiagram-VND7K2PF-cfhbsnkm.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-vtzjnrt9.js → dagre-6A5THRUB-j2wt7ns6.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-4vvn790v.js → diagram-22UHCM2B-abrdj714.js} +21 -21
- package/dist/client/static/js/{diagram-3UASUU5V-tmht3bew.js → diagram-3UASUU5V-dbn15bxn.js} +2 -2
- package/dist/client/static/js/{diagram-ATOU4E4O-p5wa5ztx.js → diagram-ATOU4E4O-y79pwf7w.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-8myesjfc.js → diagram-CDSNMT55-f8ryt86n.js} +4 -4
- package/dist/client/static/js/{diagram-MLGK6HIB-9t3x2d5f.js → diagram-MLGK6HIB-ws7wn3q9.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-8ahgnmhy.js → diagram-MPIPVDR6-zmznrg13.js} +2 -2
- package/dist/client/static/js/{dockerfile-x8aa0543.js → dockerfile-qgc921kw.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-5semw111.js → ebnfDiagram-ZINNZB2B-y5q7hy1v.js} +1 -1
- package/dist/client/static/js/{elixir-5ewfhvfh.js → elixir-12pgbgtq.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-jmhs58ww.js → elk-276RUBZZ-vddwbn6q.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-31wvbpdr.js → erDiagram-OPXOYQCR-qdqcx4g4.js} +6 -6
- package/dist/client/static/js/{erlang-jqqa3ehb.js → erlang-811btv6p.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-65ph4s3m.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-nh2tb65b.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-c2dycjrf.js → ganttDiagram-FUAMR5RP-763hk9rm.js} +4 -4
- package/dist/client/static/js/gitGraph-4MIJSDKK-t45ekjb6.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-y4k4pdd8.js → gitGraphDiagram-X574FWY7-bgx1q5nw.js} +10 -10
- package/dist/client/static/js/graphql-027z8sc0.js +1 -0
- package/dist/client/static/js/html-fqda6wxx.js +1 -0
- package/dist/client/static/js/{index-38v0781h.js → index-03j5j1j0.js} +2 -2
- package/dist/client/static/js/{index-3588r3wg.js → index-05hx4ftf.js} +2 -2
- package/dist/client/static/js/index-0vk6v4y4.js +2 -0
- package/dist/client/static/js/{index-7dp90ad1.js → index-1nwwvv29.js} +2 -2
- package/dist/client/static/js/{index-aar68x31.js → index-228yzebd.js} +5 -5
- package/dist/client/static/js/{index-xf36nmbm.js → index-2b1wnvez.js} +2 -2
- package/dist/client/static/js/index-34ff2vq6.js +2 -0
- package/dist/client/static/js/{index-6fpd55cq.js → index-3d21hpk7.js} +2 -2
- package/dist/client/static/js/{index-181p91hf.js → index-3h2mr90j.js} +2 -2
- package/dist/client/static/js/{index-efra065v.js → index-3sqndc9n.js} +2 -2
- package/dist/client/static/js/{index-kc5znr75.js → index-47wn2gjx.js} +2 -2
- package/dist/client/static/js/{index-nt7nhchn.js → index-4b5b6g0k.js} +1 -1
- package/dist/client/static/js/index-5b2vsbcf.js +1 -0
- package/dist/client/static/js/index-5mrqfs82.js +12 -0
- package/dist/client/static/js/{index-m94f4ngb.js → index-61j9qkck.js} +3 -3
- package/dist/client/static/js/index-6bm4pw90.css +1 -0
- package/dist/client/static/js/{index-qhytrsyb.js → index-6sqmhdyv.js} +2 -2
- package/dist/client/static/js/{index-jz93j0at.js → index-8dtp7mt0.js} +2 -2
- package/dist/client/static/js/index-a11ptyzf.js +1 -0
- package/dist/client/static/js/index-acphtw1r.js +2 -0
- package/dist/client/static/js/{index-s78n0dtv.js → index-as1wptfa.js} +2 -2
- package/dist/client/static/js/index-cj39b26c.js +1 -0
- package/dist/client/static/js/index-dgjerk4w.js +3 -0
- package/dist/client/static/js/{index-sesghshh.js → index-dmv2zasz.js} +2 -2
- package/dist/client/static/js/index-dn6pqym4.js +9 -0
- package/dist/client/static/js/{index-ynaxep06.js → index-ehg2ftnp.js} +2 -2
- package/dist/client/static/js/{index-e7yf273s.js → index-f51jxezc.js} +2 -2
- package/dist/client/static/js/index-f7paep2f.js +2 -0
- package/dist/client/static/js/index-f98dhbt4.js +4 -0
- package/dist/client/static/js/{index-ys0xpw3q.js → index-fbct0jcf.js} +2 -2
- package/dist/client/static/js/index-fqatn0vh.js +1 -0
- package/dist/client/static/js/{index-bvjct7sp.js → index-gcwmpfr4.js} +2 -2
- package/dist/client/static/js/{index-cgzw43bc.js → index-gmq5pbcv.js} +67 -67
- package/dist/client/static/js/{index-q81rxwh7.js → index-gzafyqsr.js} +43 -43
- package/dist/client/static/js/{index-gmnmnfm0.js → index-gzp4j2h5.js} +2 -2
- package/dist/client/static/js/{index-cjhvtzdd.js → index-h0rmkz9n.js} +2 -2
- package/dist/client/static/js/{index-sk9ej289.js → index-jaqjvk22.js} +2 -2
- package/dist/client/static/js/{index-pt8440xh.js → index-jpp0zm7t.js} +15 -15
- package/dist/client/static/js/index-kg2sk8cf.js +1 -0
- package/dist/client/static/js/index-mrw7qweg.js +1 -0
- package/dist/client/static/js/index-mwm8aptp.js +1 -0
- package/dist/client/static/js/{index-yvgbr7ek.js → index-n1ga63de.js} +2 -2
- package/dist/client/static/js/{index-cqnpsw2m.js → index-nzhwd6t3.js} +2 -2
- package/dist/client/static/js/{index-vyw4tbn8.js → index-p21mvqc2.js} +2 -2
- package/dist/client/static/js/{index-fjnkzk12.js → index-pfj3sd1n.js} +3 -3
- package/dist/client/static/js/{index-fg965t62.js → index-pxq4v81r.js} +2 -2
- package/dist/client/static/js/index-q76jfb54.js +1 -0
- package/dist/client/static/js/{index-m9s9rg5k.js → index-qt9jc4ck.js} +2 -2
- package/dist/client/static/js/{index-48pb18zj.js → index-r6e44vkx.js} +2 -2
- package/dist/client/static/js/{index-2cbnjc32.js → index-szk3vk8h.js} +2 -2
- package/dist/client/static/js/{index-ycks7gyg.js → index-t0yv1375.js} +2 -2
- package/dist/client/static/js/{index-0c6vpk89.js → index-vgcm2g0g.js} +2 -2
- package/dist/client/static/js/{index-f7djda1g.js → index-vkerrwpa.js} +2 -2
- package/dist/client/static/js/{index-dkwhs38j.js → index-w57zbym7.js} +2 -2
- package/dist/client/static/js/{index-n9scbxy5.js → index-wqrdgt1g.js} +2 -2
- package/dist/client/static/js/{index-j17h4z6f.js → index-x2wvq4ae.js} +2 -2
- package/dist/client/static/js/{index-2b46dzw8.js → index-x7rfmwg8.js} +4 -4
- package/dist/client/static/js/{index-f77c3ag0.js → index-xkwybnf3.js} +200 -200
- package/dist/client/static/js/info-A6RAGUB7-mw29xbwf.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-z3pqx7w8.js → infoDiagram-VRGFBTTK-e66pw8d9.js} +1 -1
- package/dist/client/static/js/ini-3cx6tmv4.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-f5v6z8yr.js → ishikawaDiagram-OU5B5YK6-ehc0q24d.js} +3 -3
- package/dist/client/static/js/java-zs6qh1dm.js +1 -0
- package/dist/client/static/js/javascript-b9mkygak.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-js1yxatk.js → journeyDiagram-ZHPQQLJL-hye05qtd.js} +5 -5
- package/dist/client/static/js/json-qn73s8xb.js +1 -0
- package/dist/client/static/js/jsx-gahhfczw.js +1 -0
- package/dist/client/static/js/{julia-0h9krgsd.js → julia-mgsev9df.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-m0a6069c.js → kanban-definition-PNTS6WVX-vce614m8.js} +7 -7
- package/dist/client/static/js/lua-d8enp14s.js +1 -0
- package/dist/client/static/js/markdown-qetaj4vp.js +1 -0
- package/dist/client/static/js/{mermaid.core-6xvbnm63.js → mermaid.core-gc79re5p.js} +7 -7
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-a9f9yzc0.js → mindmap-definition-NLK3R4M7-ft1whaf5.js} +3 -3
- package/dist/client/static/js/one-dark-pro-rvg5xm1a.js +1 -0
- package/dist/client/static/js/one-light-2b5w3ksh.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-md85wpjq.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-4v4pf1h1.js → pegDiagram-GJSIUBJH-2s4ykhaa.js} +1 -1
- package/dist/client/static/js/{perl-rptyx23q.js → perl-6n93vjsa.js} +1 -1
- package/dist/client/static/js/{php-sagvq3wz.js → php-w23nmbtc.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-4grcqnp8.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-a54yrmfm.js → pieDiagram-5QR66LMP-7h8dp0z3.js} +2 -2
- package/dist/client/static/js/properties-g6tpq003.js +1 -0
- package/dist/client/static/js/python-cy06fzhg.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-1twhvnp2.js → quadrantDiagram-O4NWA36T-pteyxjxr.js} +6 -6
- package/dist/client/static/js/r-vw8berfv.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-7j9prhg1.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-g8x2jps1.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-cbg7k68h.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-xfvjk9f8.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-7w97805z.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-83tqfdcy.js → railroadDiagram-XR7U4H2S-68z9wdt0.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-73e3pzw6.js → requirementDiagram-PLB6GJNP-c08nmey6.js} +4 -4
- package/dist/client/static/js/{ruby-9qyx7knh.js → ruby-ag3b3t9t.js} +1 -1
- package/dist/client/static/js/{rust-jds4e4r7.js → rust-ke5ec0w5.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-1bzwj6sb.js → sankeyDiagram-IPEJSGJF-2r3kvjs5.js} +5 -5
- package/dist/client/static/js/{sass-07rteya0.js → sass-x0eez0kp.js} +1 -1
- package/dist/client/static/js/{scss-e2dndbfa.js → scss-qycakpjn.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-yh3h988k.js → sequenceDiagram-PO4LG4MO-ctjycd88.js} +19 -19
- package/dist/client/static/js/{sizeCapture-INFHLROL-1n121yp6.js → sizeCapture-INFHLROL-97ndea95.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-0tdrzn06.js → stateDiagram-v2-GCMORJYK-aqnmsb96.js} +5 -5
- package/dist/client/static/js/{svelte-w365cpwa.js → svelte-tg19by0f.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-77n1ttdw.js → swimlanes-2SLR337P-v50cx1nx.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-e227mz39.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-b6r0k3e8.js → timeline-definition-EJHVYXUP-1ggrtdcj.js} +7 -7
- package/dist/client/static/js/treeView-Q6P3EWNA-xhf1r6c3.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-4n3j7ekq.js +1 -0
- package/dist/client/static/js/tsx-3dzv8h6k.js +1 -0
- package/dist/client/static/js/typescript-44vs0wn4.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-efq58m3m.js → usecaseDiagram-POWQR4AR-ybcwhpzs.js} +39 -39
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-ad4gvd5r.js → vennDiagram-UO4OBE2U-p9ggrt07.js} +8 -8
- package/dist/client/static/js/{vue-d6cesny1.js → vue-mhj4sme0.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-fb0py35r.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-v89tys2p.js → wardleyDiagram-VNRHLVJA-v79nb9kx.js} +4 -4
- package/dist/client/static/js/xml-yvv5fn3k.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-xtgzmknw.js → xychartDiagram-PMCCYNJV-43thqscz.js} +5 -5
- package/dist/client/static/js/yaml-avewh7n5.js +1 -0
- package/marketplace/marketplace.json +7 -0
- package/marketplace/plugins/github-actions/README.md +142 -0
- package/marketplace/plugins/github-actions/icon.svg +12 -0
- package/marketplace/plugins/github-actions/package.json +30 -0
- package/marketplace/plugins/github-actions/settings-schema.json +27 -0
- package/marketplace/plugins/github-actions/src/app.tsx +32 -0
- package/marketplace/plugins/github-actions/src/panel/Actions.tsx +105 -0
- package/marketplace/plugins/github-actions/src/panel/LogView.tsx +76 -0
- package/marketplace/plugins/github-actions/src/panel/Row.tsx +59 -0
- package/marketplace/plugins/github-actions/src/panel/RunView.tsx +197 -0
- package/marketplace/plugins/github-actions/src/panel/format.ts +74 -0
- package/marketplace/plugins/github-actions/src/panel/index.test.tsx +86 -0
- package/marketplace/plugins/github-actions/src/panel/index.tsx +256 -0
- package/marketplace/plugins/github-actions/src/panel/picker.test.tsx +68 -0
- package/marketplace/plugins/github-actions/src/panel/test-fixtures.ts +98 -0
- package/marketplace/plugins/github-actions/src/panel/test-harness.tsx +175 -0
- package/marketplace/plugins/github-actions/src/protocol.ts +156 -0
- package/marketplace/plugins/github-actions/src/server/github.test.ts +264 -0
- package/marketplace/plugins/github-actions/src/server/github.ts +309 -0
- package/marketplace/plugins/github-actions/src/server/http.test.ts +150 -0
- package/marketplace/plugins/github-actions/src/server/http.ts +202 -0
- package/marketplace/plugins/github-actions/src/server/json.ts +44 -0
- package/marketplace/plugins/github-actions/src/server/logtext.test.ts +84 -0
- package/marketplace/plugins/github-actions/src/server/logtext.ts +59 -0
- package/marketplace/plugins/github-actions/src/server/progress.test.ts +96 -0
- package/marketplace/plugins/github-actions/src/server/progress.ts +62 -0
- package/marketplace/plugins/github-actions/src/server/remote.ts +84 -0
- package/marketplace/plugins/github-actions/src/server/scope.ts +51 -0
- package/marketplace/plugins/github-actions/src/server/token.ts +84 -0
- package/marketplace/plugins/github-actions/src/server.ts +163 -0
- package/marketplace/plugins/github-actions/src/state.test.ts +55 -0
- package/marketplace/plugins/github-actions/src/state.ts +63 -0
- package/marketplace/plugins/github-actions/tsconfig.json +16 -0
- package/marketplace/plugins/stats/package.json +2 -2
- package/marketplace/plugins/stats/src/proc/identity.ts +4 -3
- package/package.json +2 -2
- package/src/client/App.tsx +1 -1
- package/src/client/borders.css +143 -0
- package/src/client/components/common/context-usage-button/Ring.tsx +34 -9
- package/src/client/components/common/context-usage-button/index.test.tsx +19 -2
- package/src/client/components/common/context-usage-button/index.tsx +4 -4
- package/src/client/components/common/header-controls/index.test.tsx +26 -59
- package/src/client/components/common/header-controls/index.tsx +41 -52
- package/src/client/components/common/header-controls/phone-row.test.tsx +265 -0
- package/src/client/components/common/header-controls/plugin-entry.test.tsx +25 -3
- package/src/client/components/common/header-controls/shell-chrome.test.tsx +2 -2
- package/src/client/components/layout/LeftDock.tsx +7 -0
- package/src/client/components/layout/desktop-layout/DesktopOverlays.tsx +51 -0
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +117 -15
- package/src/client/components/layout/desktop-layout/RightColumn.tsx +257 -0
- package/src/client/components/layout/desktop-layout/TopNavbar.tsx +23 -24
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +50 -78
- package/src/client/components/layout/desktop-layout/index.tsx +73 -73
- package/src/client/components/layout/session-sidebar/Footer.test.tsx +20 -0
- package/src/client/components/layout/session-sidebar/Footer.tsx +24 -2
- package/src/client/components/layout/session-sidebar/Header.test.ts +10 -0
- package/src/client/components/layout/session-sidebar/Header.tsx +2 -2
- package/src/client/components/mobile/RightSidebar.tsx +164 -66
- package/src/client/components/mobile/header-titlebar.test.tsx +92 -0
- package/src/client/components/mobile/mobile-main-view/Header.test.tsx +2 -3
- package/src/client/components/mobile/mobile-main-view/Header.tsx +12 -10
- package/src/client/components/mobile/mobile-right-sidebar/Chrome.tsx +179 -0
- package/src/client/components/mobile/panel-chips.test.tsx +12 -0
- package/src/client/components/mobile/panel-chips.tsx +5 -1
- package/src/client/components/mobile/right-drawer-nav.test.tsx +258 -0
- package/src/client/components/settings/Modal.tsx +14 -9
- package/src/client/components/settings/ProjectSelectorDropdown.tsx +18 -6
- package/src/client/components/settings/SettingsSidebarList.tsx +2 -1
- package/src/client/components/settings/Sidebar.tsx +6 -4
- package/src/client/components/settings/apply-side-effects.test.ts +17 -0
- package/src/client/components/settings/apply-side-effects.ts +32 -5
- package/src/client/components/settings/band-height.test.tsx +122 -0
- package/src/client/components/settings/categories/AppearanceSettings.test.tsx +144 -0
- package/src/client/components/settings/categories/AppearanceSettings.tsx +81 -39
- package/src/client/components/settings/categories/ChatSettings.tsx +9 -15
- package/src/client/components/settings/categories/UsageSettings.tsx +2 -1
- package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.test.tsx +101 -0
- package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.tsx +134 -0
- package/src/client/components/settings/categories/appearance-settings/EditorBlameSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/EditorFontSection.tsx +5 -5
- package/src/client/components/settings/categories/appearance-settings/EditorIndentSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.tsx +6 -6
- package/src/client/components/settings/categories/appearance-settings/EditorTypingSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/PanelNavSection.tsx +288 -0
- package/src/client/components/settings/categories/appearance-settings/SidebarStyleSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/ThemeSection.tsx +42 -0
- package/src/client/components/settings/categories/appearance-settings/TrayIconSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/groups.test.ts +47 -0
- package/src/client/components/settings/categories/appearance-settings/groups.ts +95 -0
- package/src/client/components/settings/categories/chat-settings/LayoutSection.tsx +31 -14
- package/src/client/components/settings/categories/mcp-settings/SidebarList.tsx +2 -1
- package/src/client/components/settings/categories/project-settings/SidebarList.tsx +2 -1
- package/src/client/components/settings/categories/provider-settings/SidebarList.tsx +2 -1
- package/src/client/components/settings/categories/usage-settings/SidebarList.tsx +2 -1
- package/src/client/components/settings/master-detail/GroupDetail.tsx +38 -0
- package/src/client/components/settings/{categories/chat-settings/SidebarList.tsx → master-detail/GroupSidebar.tsx} +35 -12
- package/src/client/components/settings/master-detail/index.tsx +3 -1
- package/src/client/components/settings/pane-header.ts +25 -0
- package/src/client/components/workspace/browser-toolbar/index.test.tsx +39 -1
- package/src/client/components/workspace/browser-toolbar/index.tsx +53 -17
- package/src/client/components/workspace/chat-timeline/ColumnResizeHandle.tsx +107 -0
- package/src/client/components/workspace/chat-timeline/ComposerDockFrame.tsx +9 -3
- package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +35 -26
- package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +6 -0
- package/src/client/components/workspace/chat-timeline/column-resize.test.tsx +292 -0
- package/src/client/components/workspace/chat-timeline/composer-dock-frame.test.tsx +5 -3
- package/src/client/components/workspace/context-panel/index.tsx +10 -4
- package/src/client/components/workspace/editor/EditorHideButton.tsx +41 -0
- package/src/client/components/workspace/editor/EmptyEditor.tsx +11 -2
- package/src/client/components/workspace/editor/PluginColumn.tsx +11 -1
- package/src/client/components/workspace/editor/Tabs.tsx +8 -0
- package/src/client/components/workspace/editor/editor-hide-button.test.ts +144 -0
- package/src/client/components/workspace/editor/index.tsx +8 -2
- package/src/client/components/workspace/editor/props.ts +9 -0
- package/src/client/components/workspace/file-explorer/RowLabel.test.tsx +90 -0
- package/src/client/components/workspace/file-explorer/RowLabel.tsx +1 -4
- package/src/client/components/workspace/git-panel/commit-modal/CommitRow.test.ts +52 -46
- package/src/client/components/workspace/git-panel/commit-modal/CommitRow.tsx +41 -21
- package/src/client/components/workspace/git-panel/commit-modal/GraphCanvas.tsx +6 -5
- package/src/client/components/workspace/git-panel/commit-modal/index.tsx +19 -22
- package/src/client/components/workspace/panel-header/title-policy.test.tsx +62 -0
- package/src/client/components/workspace/panel-header/title-policy.tsx +83 -0
- package/src/client/components/workspace/panel-tabs/Home.density.test.tsx +122 -0
- package/src/client/components/workspace/panel-tabs/Home.test.tsx +137 -0
- package/src/client/components/workspace/panel-tabs/Home.tsx +118 -0
- package/src/client/components/workspace/panel-tabs/TabChip.tsx +173 -0
- package/src/client/components/workspace/panel-tabs/TabStrip.test.tsx +339 -0
- package/src/client/components/workspace/panel-tabs/TabStrip.tsx +302 -0
- package/src/client/components/workspace/panel-tabs/index.tsx +105 -0
- package/src/client/components/workspace/panels/builtin.tsx +9 -0
- package/src/client/components/workspace/plan-panel/index.tsx +7 -2
- package/src/client/components/workspace/repo-picker/Modal.tsx +1 -1
- package/src/client/components/workspace/repo-picker/index.test.tsx +32 -8
- package/src/client/components/workspace/repo-picker/index.tsx +2 -2
- package/src/client/components/workspace/search-panel/Body.tsx +7 -1
- package/src/client/components/workspace/search-panel/index.tsx +2 -1
- package/src/client/components/workspace/terminal-panel/Header.tsx +10 -3
- package/src/client/components/workspace/terminal-panel/index.tsx +4 -1
- package/src/client/components/workspace/todo-panel/index.tsx +6 -1
- package/src/client/components/workspace/usage-panel/index.tsx +7 -2
- package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +43 -4
- package/src/client/components/workspace/user-browser-panel/Frame.tsx +101 -45
- package/src/client/components/workspace/user-browser-panel/TabStrip.tsx +107 -0
- package/src/client/components/workspace/user-browser-panel/index.tsx +31 -6
- package/src/client/glass.test.ts +1 -1
- package/src/client/hooks/browser/use-annotate.ts +6 -5
- package/src/client/hooks/browser/use-user-browser.test.tsx +279 -0
- package/src/client/hooks/browser/use-user-browser.ts +190 -44
- package/src/client/hooks/chat/timeline/column-drag.ts +171 -0
- package/src/client/hooks/chat/timeline/width-mode.test.ts +112 -11
- package/src/client/hooks/chat/timeline/width-mode.ts +91 -18
- package/src/client/hooks/ui/border-style.test.ts +172 -0
- package/src/client/hooks/ui/border-style.ts +60 -0
- package/src/client/hooks/ui/navbar-controls.test.ts +27 -1
- package/src/client/hooks/ui/navbar-controls.ts +95 -20
- package/src/client/hooks/ui/style-attributes.test.ts +2 -0
- package/src/client/hooks/workspace/active-project.ts +46 -0
- package/src/client/hooks/workspace/commit-expansion.test.ts +135 -0
- package/src/client/hooks/workspace/commit-expansion.ts +56 -0
- package/src/client/hooks/workspace/mobile-right-panel-nav.ts +63 -0
- package/src/client/hooks/workspace/panel-nav.test.ts +140 -0
- package/src/client/hooks/workspace/panel-nav.ts +95 -0
- package/src/client/hooks/workspace/panel-tabs.session.test.tsx +235 -0
- package/src/client/hooks/workspace/panel-tabs.ts +194 -0
- package/src/client/hooks/workspace/right-open-request.ts +53 -0
- package/src/client/hooks/workspace/right-side.test.ts +204 -0
- package/src/client/hooks/workspace/right-side.ts +142 -0
- package/src/client/lib/ui/control-plate.ts +33 -0
- package/src/client/main.tsx +9 -4
- package/src/client/tailwind.css +6 -0
- package/src/server/lib/assets/shell-attributes.server.ts +26 -10
- package/src/server/lib/assets/shell-attributes.test.ts +26 -0
- package/src/server/lib/bundler/titlebar-css.test.ts +5 -3
- package/src/server/lib/harness/acp/background-replay.test.ts +16 -1
- package/src/server/lib/harness/acp/background-replay.ts +6 -1
- package/src/server/lib/harness/acp/background-work.ts +44 -31
- package/src/server/lib/harness/acp/session-turns.ts +4 -3
- package/src/server/lib/harness/acp/session-wiring.test.ts +53 -0
- package/src/server/lib/harness/acp/session-wiring.ts +11 -2
- package/src/server/lib/harness/session-lease.server.ts +3 -2
- package/src/server/lib/omp/session/lease-probe.server.test.ts +82 -0
- package/src/server/lib/omp/session/lease-probe.server.ts +180 -0
- package/src/server/lib/omp/session/ownership.server.test.ts +17 -6
- package/src/server/lib/omp/session/ownership.server.ts +7 -5
- package/src/server/plugins/ssr.ts +6 -3
- package/src/shared/lib/browser/user-tabs.test.ts +165 -0
- package/src/shared/lib/browser/user-tabs.ts +172 -0
- package/src/shared/lib/chat/timeline/width-mode.test.ts +34 -2
- package/src/shared/lib/chat/timeline/width-mode.ts +71 -22
- package/src/shared/lib/commands/catalog.ts +2 -2
- package/src/shared/lib/fs/git-status.test.ts +23 -0
- package/src/shared/lib/fs/git-status.ts +15 -0
- package/src/shared/lib/icons/tint-hues.generated.ts +20 -20
- package/src/shared/lib/settings/defaults.ts +8 -1
- package/src/shared/lib/theme/border-style.test.ts +83 -0
- package/src/shared/lib/theme/border-style.ts +122 -0
- package/src/shared/lib/workspace/keymap.ts +2 -1
- package/src/shared/lib/workspace/panel-nav.test.ts +198 -0
- package/src/shared/lib/workspace/panel-nav.ts +148 -0
- package/src/shared/lib/workspace/panel-tabs-close.test.ts +154 -0
- package/src/shared/lib/workspace/panel-tabs.ts +105 -0
- package/src/shared/lib/workspace/session-state/cache.ts +22 -0
- package/src/shared/lib/workspace/session-state/merge.ts +6 -0
- package/src/shared/lib/workspace/session-state/store.ts +23 -0
- package/src/shared/types/settings/state.ts +58 -3
- package/src/test-support/header-controls-harness.ts +22 -0
- package/src/test-support/peer-harness.ts +2 -2
- package/dist/client/static/js/ImageView-rnzf5tve.js +0 -1
- package/dist/client/static/js/LayoutWrapper-rekrgth6.js +0 -2
- package/dist/client/static/js/SessionsView-e84tjbcr.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-7j23x20s.js +0 -1
- package/dist/client/static/js/bash-vv2ysp0a.js +0 -1
- package/dist/client/static/js/c-8jf64j6h.js +0 -1
- package/dist/client/static/js/cpp-vh94zee0.js +0 -1
- package/dist/client/static/js/css-a13jmmnc.js +0 -1
- package/dist/client/static/js/css-p57h1fme.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-me5xnx6a.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-5zbvjj84.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-36ygrbvm.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-tjhkv71w.js +0 -1
- package/dist/client/static/js/graphql-kesh8gk0.js +0 -1
- package/dist/client/static/js/html-sxpfydga.js +0 -1
- package/dist/client/static/js/index-0q2qfcjn.js +0 -1
- package/dist/client/static/js/index-48gh56ka.js +0 -3
- package/dist/client/static/js/index-4rv388z7.js +0 -2
- package/dist/client/static/js/index-52xmdeh2.js +0 -1
- package/dist/client/static/js/index-8kqepehd.js +0 -12
- package/dist/client/static/js/index-cje5gg45.js +0 -1
- package/dist/client/static/js/index-fbcg8y95.js +0 -1
- package/dist/client/static/js/index-g3shdymf.js +0 -1
- package/dist/client/static/js/index-h5n1btqy.js +0 -1
- package/dist/client/static/js/index-m1n4v0z7.js +0 -9
- package/dist/client/static/js/index-rn8w29pv.js +0 -2
- package/dist/client/static/js/index-s00j9042.js +0 -2
- package/dist/client/static/js/index-s7rfbydk.js +0 -4
- package/dist/client/static/js/index-sg6sz3g8.js +0 -1
- package/dist/client/static/js/index-vcrh95gf.css +0 -1
- package/dist/client/static/js/index-w5rw8f7w.js +0 -1
- package/dist/client/static/js/index-x6v37h3j.js +0 -1
- package/dist/client/static/js/info-A6RAGUB7-m6qz24p8.js +0 -1
- package/dist/client/static/js/ini-1x0ad976.js +0 -1
- package/dist/client/static/js/java-3944nq02.js +0 -1
- package/dist/client/static/js/javascript-zegm06a1.js +0 -1
- package/dist/client/static/js/json-g5ggnd94.js +0 -1
- package/dist/client/static/js/jsx-f6p72qpc.js +0 -1
- package/dist/client/static/js/lua-edn2b3wn.js +0 -1
- package/dist/client/static/js/markdown-9dhg1fax.js +0 -1
- package/dist/client/static/js/one-dark-pro-hteqzfb0.js +0 -1
- package/dist/client/static/js/one-light-dapnh0rs.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-ng6wq5xj.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-rf6jhxf6.js +0 -1
- package/dist/client/static/js/properties-fcmj08pv.js +0 -1
- package/dist/client/static/js/python-532d8ezm.js +0 -1
- package/dist/client/static/js/r-ptmdxs2a.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-ygp6hxq4.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-rxgnrb2g.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-xkv52a2p.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-bvcktbqh.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-9c3v7jsq.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-akjqm31r.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-fb58a7z1.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-ej4qhksx.js +0 -1
- package/dist/client/static/js/tsx-zfy727zs.js +0 -1
- package/dist/client/static/js/typescript-683kkkaw.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-mkp0kanv.js +0 -1
- package/dist/client/static/js/xml-6ct32gys.js +0 -1
- package/dist/client/static/js/yaml-1d5m3bfj.js +0 -1
- package/src/server/lib/omp/session/lease-flock.server.ts +0 -117
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d,n,o,i,u,a,br,Ue,oe,e,Kn,x,Wg,Ce,$s,S,cr,ur,s,Rn,F,nt,B,se,bo,re,Ee,qe,ni,ln,ri,Kr,D,O,b,ht,ot,me,wt,ju,st,lt,aA,oA,Yi,Ji,qu,je,Xi}from"./index-f77c3ag0.js";import{Mu,Pu,Yo,Ou,$u}from"./index-m94f4ngb.js";import{hr}from"./index-3588r3wg.js";var Qt={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(Qt);var Yt={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(Yt);var Jt={name:"package-open",size:24,node:[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]},Be=s(Jt);var Zt={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"}]]},Te=s(Zt);function Qe({rootPath:t,activeRepo:r,repos:l,reposScanning:c,onRefreshRepos:p,onSelectRepo:f,searchQuery:v,onSearchChange:h,onRefresh:y,refreshing:g}){return e("div",{className:"border-b border-ink/10",children:[e(ht,{className:"border-b-0",left:e(hr,{rootPath:t,activeRepo:r,onSelectRepo:f,repos:l,scanning:c,onRefreshRepos:p}),right:e(ot,{label:"Refresh",onClick:y,busy:g})}),e("div",{className:"px-3 pb-3",children:e("div",{className:"relative",children:[e(O,{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:v,onChange:(m)=>h(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:v,folderStatus:h}){let y=f?"text-ink font-semibold":v?v.colorClass:h?h.colorClass:p?"text-ink/40":"";return e(d,{children:[l?c?e(B,{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(st,{name:t,isFolder:l,isOpen:c,size:12,className:`flex-shrink-0${p?" opacity-40":""}`}),e("span",{className:`truncate min-w-0 flex-1 ${y}`,title:p?`${r} — git-ignored`:void 0,children:t}),v&&e("span",{className:`font-mono text-[10px] font-bold px-1 rounded flex-shrink-0 ${v.colorClass}`,title:`Git: ${v.label}`,children:v.charStatus}),h&&e("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${h.hasDeleted?"bg-error":h.hasModified||h.hasStaged?"bg-info":"bg-success"}`,title:`${h.count} changed file${h.count>1?"s":""}`})]})}var en=28,tn=9,nn=8;function rn(t){let{isFolder:r,hasGitStatus:l,pasteLabel:c,busy:p,chainLabel:f,foldable:v,selectionCount:h,isArchive:y}=t,g=[],m=h>1,C=h===1?"":` ${h} items`;if(m)return g.push({kind:"item",id:"cut",label:`Cut${C}`,icon:e(Te,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"item",id:"copy",label:`Copy${C}`,icon:e(re,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"separator"}),g.push({kind:"item",id:"compress",label:`Compress${C} to…`,icon:e(nt,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"separator"}),g.push({kind:"item",id:"delete",label:`Delete${C}`,icon:e(F,{size:13,className:"text-error"}),tone:"text-error"}),g;if(r){if(g.push({kind:"item",id:"new_file",label:"New File",icon:e(ni,{size:13,className:"text-ink/60"})}),g.push({kind:"item",id:"new_folder",label:"New Folder",icon:e(ln,{size:13,className:"text-ink/60"})}),f)g.push({kind:"item",id:"unfold",label:"Unfold Folders",icon:e(B,{size:13,className:"text-ink/60"})});if(v)g.push({kind:"item",id:"fold",label:"Fold Folders",icon:e(se,{size:13,className:"text-ink/60"})});g.push({kind:"separator"})}else{if(g.push({kind:"item",id:"view",label:"View",icon:e(qe,{size:13,className:"text-ink/60"})}),y)g.push({kind:"item",id:"extract",label:"Extract…",icon:e(Be,{size:13,className:"text-ink/60"}),disabled:p});if(l)g.push({kind:"item",id:"diff",label:"Open in Diff Panel",icon:e(ri,{size:13,className:"text-warning"}),tone:"font-medium"});g.push({kind:"separator"})}if(g.push({kind:"item",id:"cut",label:"Cut",icon:e(Te,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"item",id:"copy",label:"Copy",icon:e(re,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"item",id:"compress",label:"Compress to…",icon:e(nt,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"item",id:"duplicate",label:"Duplicate",icon:e(Xe,{size:13,className:"text-ink/60"}),disabled:p}),c)g.push({kind:"item",id:"paste",label:c,icon:e(bo,{size:13,className:"text-ink/60"}),disabled:p});return g.push({kind:"separator"}),g.push({kind:"item",id:"explorer",label:"Go to Explorer",icon:e(Ee,{size:13,className:"text-ink/60"})}),g.push({kind:"item",id:"copy_path",label:"Copy Path",icon:e(re,{size:13,className:"text-ink/60"})}),g.push({kind:"item",id:"copy_relative",label:"Copy Relative Path",icon:e(re,{size:13,className:"text-ink/60"})}),g.push({kind:"separator"}),g.push({kind:"item",id:"history",label:"Show Git History",icon:e(Rn,{size:13,className:"text-ink/60"})}),g.push({kind:"separator"}),g.push({kind:"item",id:"rename",label:"Rename",icon:e(Ve,{size:13,className:"text-ink/60"})}),g.push({kind:"item",id:"delete",label:"Delete",icon:e(F,{size:13,className:"text-error"}),tone:"text-error"}),g}function on(t){let r=t.filter((c)=>c.kind==="item").length,l=t.length-r;return r*en+l*tn+nn}function Je({x:t,y:r,isFolder:l,hasGitStatus:c,pasteLabel:p,chainLabel:f,foldable:v,busy:h,selectionCount:y,isArchive:g,onAction:m,menuRef:C}){let w=rn({isFolder:l,hasGitStatus:c,pasteLabel:p,busy:h,chainLabel:f,foldable:v,selectionCount:y,isArchive:g}),E=on(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 oe(e("div",{className:"fixed inset-0 z-50 bg-ink/20",onClick:()=>m("close"),onContextMenu:(T)=>{T.preventDefault(),m("close")},children:e("div",{ref:C,className:"glass-popover fixed z-50 bg-paper border border-ink/15 shadow-2xl rounded-lg py-1 min-w-[185px] text-xs text-ink font-sans",style:{top:M,left:N},onClick:(T)=>T.stopPropagation(),children:w.map((T,R)=>T.kind==="separator"?e("div",{className:"my-1 border-t border-ink/10"},`sep-${R}`):e("button",{type:"button",disabled:T.disabled,onClick:()=>m(T.id),className:`w-full text-left px-3 py-1.5 flex items-center space-x-2 transition-colors ${T.disabled?"opacity-40 cursor-default":"hover:bg-ink/5"} ${T.tone??""}`,children:[T.icon,e("span",{children:T.label})]},T.id))})}),document.body)}function Fe({folderPath:t,kind:r,value:l,error:c,isLoading:p,onChange:f,onCancel:v,onSubmit:h}){let y=r==="folder"?"Folder":"File";return oe(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center p-4 backdrop-blur-sm",children:e("form",{onSubmit:h,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 ",y]}),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:(g)=>f(g.currentTarget.value),placeholder:r==="folder"?"folder name or nested/path":"file name or nested/path","aria-label":`New ${y.toLowerCase()} name`,className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none mb-1 ${c?"border-error":"border-ink/20 focus:border-ink"}`}),e("p",{className:"text-[10px] text-ink/40 mb-2",children:["Nested paths create the folders they need — ",e("span",{className:"font-mono",children:"lib/parse.ts"}),"."]}),c&&e("p",{className:"text-[11px] text-error mb-2",children:c}),e("div",{className:"flex justify-end space-x-2 mt-2",children:[e("button",{type:"button",onClick:v,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:v}){let h=c>1;return oe(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center p-4 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 ",h?`${c} Items`:l?"Folder":"File"]}),e("p",{className:"text-xs text-ink/70 mb-4",children:["Are you sure you want to delete ",h?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:v,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:v,onCancel:h,onSubmit:y}){return oe(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center p-4 backdrop-blur-sm",children:e("form",{onSubmit:y,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:(g)=>v(g.currentTarget.value),"aria-label":`Rename ${t?"folder":"file"} path`,className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none mb-1 ${p?"border-error":"border-ink/20 focus:border-ink"}`}),e("p",{className:"text-[10px] text-ink/40 mb-2",children:["Paths are relative to the tree — ",e("span",{className:"font-mono",children:"lib/deep/name.ts"})," moves it too."]}),c&&e("p",{className:"text-[11px] text-ink/50 mb-2",children:["The row is ",e("span",{className:"font-mono",children:c}),"; this renames"," ",e("span",{className:"font-mono",children:l}),". Use"," ",e("span",{className:"font-mono",children:"Unfold Folders"})," to rename a folder inside the chain."]}),p&&e("p",{className:"text-[11px] text-error mb-2",children:p}),e("div",{className:"flex justify-end space-x-2",children:[e("button",{type:"button",onClick:h,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 oe(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center p-4 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(Rn,{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(b,{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,v)=>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})]},v))})]}):e("div",{className:"p-8 text-center text-ink/40 font-mono text-xs",children:"No commit history found for this file."}):l?.error?e("div",{className:"p-8 text-center text-error font-mono text-xs",children:l.error}):e("div",{className:"p-8 text-center text-ink/40 font-mono text-xs",children:"Loading history..."}):e("div",{className:"p-8 text-center text-ink/40 font-mono text-xs flex items-center justify-center space-x-2",children:[e(D,{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(Fe,{folderPath:r.path,kind:t.createKind,value:t.createName,error:t.createError,isLoading:t.busy,onChange:t.setCreateName,onCancel:t.closeCreate,onSubmit:t.submitCreate}),t.showDeleteModal&&e(Ze,{fileName:r.path,displayName:p>1?void 0:c,isFolder:l,count:p,isLoading:t.busy,onCancel:t.closeDelete,onConfirm:t.submitDelete}),t.showRenameModal&&e(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(sn);return r.some((l,c)=>l!==t[c])?r:t}function sn(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 Se(t){return t.type==="folder"&&t.name.includes("/")}function Me(t,r){let l=r.split("/"),c=t.split("/");if(l.length<2||l.length>c.length||l.some((f)=>!f))return null;let p=c.slice(0,c.length-l.length);return l.map((f,v)=>[...p,...l.slice(0,v+1)].join("/"))}function it(t,r){let l=new Map;if(r.size===0)return{nodes:t,roots:l};let c=!1,p=(v)=>v.flatMap((h)=>{if(h.type!=="folder")return[h];let y=Array.isArray(h.children)?p(h.children):h.children,g=y===h.children?h:{...h,children:y},m=r.has(h.path)?Me(h.path,h.name):null;if(!m)return[g];c=!0,l.set(m[0],h.path);let C={...g,name:m[m.length-1].split("/").pop()};for(let k=m.length-1;k>0;k-=1){let w=m[k-1];C={name:w.split("/").pop(),path:w,type:"folder",ignored:g.ignored,children:[C]}}return[C]}),f=p(t);return{nodes:c?f:t,roots:l}}function at(t,r){let l=new Set,c=(v)=>{for(let h of v){if(h.type!=="folder")continue;if(l.add(h.path),Array.isArray(h.children))c(h.children)}};c(t);let p=r.split("/").slice(0,-1),f=[];for(let v=0;v<p.length;v+=1){let h=p.slice(0,v+1).join("/");if(l.has(h))f.push(h)}return f}function Ne({folderPath:t,rootPath:r,repo:l,onCreated:c,onOpenCreated:p}){let f=lt(),[v,h]=n(!1),[y,g]=n("file"),[m,C]=n(""),[k,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";h(!1),C(""),w(null);let T=N.path.split("/").pop()||N.path;if(c({path:N.path,name:T,kind:M}),M==="file")p?.({path:N.path,name:T})}else w(N.error||`Could not create the ${y}`)},[f.state,f.data]),{open:v,kind:y,name:m,setName:C,error:k,busy:f.state!=="idle",openDialog:(N="file")=>{g(N),C(""),w(null),h(!0)},closeDialog:()=>h(!1),submit:(N)=>{N.preventDefault();let M=m.trim();if(!M)return;w(null);let T=new FormData;if(T.append("actionType","create"),T.append("path",t),T.append("name",M),y==="folder")T.append("kind","folder");if(l&&l!==".")T.append("repo",l);if(r)T.append("root",r);f.submit(T,{method:"post",action:"/api/fs/action"})}}}function we(t){if(!t)return null;if(t.entries.length===1)return t.entries[0].name;return`${t.entries.length} items`}function ct(t,r){return`${t??""}\x00${r}`}function Le(t,r){if(r==="folder")return t;let l=t.lastIndexOf("/");return l===-1?".":t.slice(0,l)}function dt(t){let r=t.lastIndexOf("/");return r===-1?".":t.slice(0,r)}function pt(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 ut(t,r){let l=pt(t,r);if(l)return l;if(r===dt(t.path))return"Already in this folder";return null}function ft(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===dt(c.path)))return"Already in this folder";for(let c of t.entries){let p=pt(c,l);if(p)return p}return null}function mt(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=an(p);if(!f)return null;c.push(f)}if(c.length===0)return null;return{scope:r.scope,entries:c,mode:r.mode}}function an(t){if(typeof t!=="object"||t===null)return null;let r=t;if(typeof r.path!=="string"||typeof r.name!=="string")return null;if(r.kind!=="file"&&r.kind!=="folder")return null;let l=r.path.split("/");if(r.path===""||r.path.startsWith("/")||l.some((c)=>c===""||c==="."||c===".."))return null;return{path:r.path,name:r.name,kind:r.kind}}var $e=[{id:"zip",label:"ZIP",extension:"zip"},{id:"7z",label:"7Z",extension:"7z"},{id:"rar",label:"RAR",extension:"rar"},{id:"tar",label:"TAR",extension:"tar"},{id:"tar.gz",label:"TAR.GZ",extension:"tar.gz"}],gt=[[".tar.gz","tar.gz"],[".tar.bz2","tar.bz2"],[".tar.xz","tar.xz"],[".tgz","tar.gz"],[".tbz2","tar.bz2"],[".txz","tar.xz"],[".tar","tar"],[".zip","zip"],[".7z","7z"],[".rar","rar"],[".gz","gz"],[".bz2","bz2"],[".xz","xz"]];function ze(t){let r=t.toLowerCase();for(let[l,c]of gt)if(r.endsWith(l))return c;return null}function bt(t){return ze(t)!==null}function cn(t){return $e.find((r)=>r.id===t)}function dn(t){return cn(t)?.extension??"zip"}function xt(t){let r=t.toLowerCase();for(let[l]of gt)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 De(t,r){let l=dn(r);if(t.length===1){let f=t[0],v=xt(f.name),h=v.lastIndexOf(".");return`${(f.kind==="folder"?f.name:h>0?v.slice(0,h):v)||"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 Dt({file:t,diff:r,onOpenFile:l,onActionComplete:c,onCreated:p,onRenamed:f,onUnfold:v,onFold:h,clipboard:y,isFolder:g,selection:m,selected:C,archive:k}){let w=lt(),[E,N]=n(null),M=i(null),[T,R]=n(!1),[A,H]=n(!1),[W,ee]=n(!1),[te,ae]=n(t.path),[G,I]=n(null),{repo:z,rootPath:K}=t,j=Ne({folderPath:t.path,rootPath:K,repo:z,onCreated:(L)=>p?p(L):c(),onOpenCreated:(L)=>l?.({...L,root:K,repo:z||"."})}),ne=i(null);o(()=>{if(w.state!=="idle"||!w.data)return;let L=w.data;if(ne.current===L)return;if(ne.current=L,L.success&&!L.type)if(R(!1),H(!1),I(null),L.previousPath&&L.path&&f)f(L.previousPath,L.path);else c();else if(!L.success&&L.error&&T)I(L.error)},[w.state,w.data]);let q=(L)=>{if(z&&z!==".")L.append("repo",z);if(K)L.append("root",K);w.submit(L,{method:"post",action:"/api/fs/action"})},X=()=>{l?.({path:t.path,name:t.name,root:K,repo:z||"."})},J={path:t.path,name:t.name,kind:g?"folder":"file"},ie=C&&m.length>1?m:[J],he=bt(t.name),Q=y.clip&&!y.refusalFor(J)?`Paste ${we(y.clip)??"item"}`:null,ue=(L)=>{if(N(null),I(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:K}}));else if(L==="explorer"){let _=new FormData;_.append("actionType","open_explorer"),_.append("path",t.path),q(_)}else if(L==="copy_path")wt(ju(t.basePath,t.path));else if(L==="copy_relative")wt(t.path);else if(L==="history"){ee(!0);let _=new FormData;_.append("actionType","git_history"),_.append("path",t.path),q(_)}else if(L==="rename")ae(t.path),R(!0);else if(L==="unfold")v?.();else if(L==="fold")h?.();else if(L==="new_file")j.openDialog("file");else if(L==="new_folder")j.openDialog("folder");else if(L==="delete")H(!0);else if(L==="cut")y.cut(ie);else if(L==="copy")y.copy(ie);else if(L==="compress")k.openCompress(ie);else if(L==="extract")k.openExtract(J);else if(L==="duplicate")y.duplicate(J);else if(L==="paste")y.paste(J)},le=(L)=>{L.preventDefault(),I(null);let _=new FormData;_.append("actionType","rename"),_.append("path",t.path),_.append("newPath",te),q(_)},xe=()=>{let L=new FormData;if(L.append("actionType","delete"),ie.length>1)L.append("paths",JSON.stringify(ie.map((_)=>_.path)));else L.append("path",t.path);q(L)};return{contextMenu:E,contextMenuRef:M,openContextMenu:(L,_)=>N({x:L,y:_}),closeContextMenu:()=>N(null),showRenameModal:T,showDeleteModal:A,showHistoryModal:W,showCreateModal:j.open,createKind:j.kind,createError:j.error,createName:j.name,setCreateName:j.setName,renameValue:te,setRenameValue:ae,renameError:G,busy:w.state!=="idle"||j.busy||y.busy||k.busy,pasteLabel:Q,selectionCount:ie.length,isArchive:he,chainLabel:v!==void 0,foldable:h!==void 0,fetcherState:w.state,fetcherData:w.data,handleAction:ue,submitCreate:j.submit,submitRename:le,submitDelete:xe,closeCreate:j.closeDialog,closeDelete:()=>H(!1),closeRename:()=>R(!1),closeHistory:()=>ee(!1)}}function Rt({target:t,dragging:r,clipboard:l,onDragStart:c,onDragEnd:p,onDropOn:f,onHoverAccept:v}){let h=r?.path===t.path,y=Boolean(r)&&!h&&l.moveRefusalFor(r,t)===null,[g,m]=n(!1);return o(()=>{if(!r)m(!1)},[r]),{isDragging:h,acceptsDrop:y,isDropHovered:g&&y,onDragStart:(k)=>{if(k.dataTransfer?.setData("text/plain",t.path),k.dataTransfer)k.dataTransfer.effectAllowed="move";c(t)},onDragEnd:p,onDragOver:(k)=>{if(!r)return;if(k.stopPropagation(),m(y),!y)return;if(k.preventDefault(),k.dataTransfer)k.dataTransfer.dropEffect="move";v?.(t)},onDragLeave:()=>m(!1),onDrop:(k)=>{if(!r)return;if(k.stopPropagation(),!y)return;k.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:v,onCreated:h,onRenamed:y,expandedPaths:g,onToggleFolder:m,gitFileMap:C,gitFolderMap:k,clipboard:w,archive:E,selection:N,selectionTargets:M,dragging:T,onDragStart:R,onDragEnd:A,onDropOn:H,onUnfold:W,onFold:ee,foldRoots:te,touch:ae=!1}){let G=t.type==="folder",[I,z]=n(!1),[K,j]=n(!1),[ne,q]=n(!1),[X,J]=n(!1),ie=Array.isArray(t.children)?t.children:[],he=(t.path||"").replace(/^\/+/,""),Q=!G?C?.get(he)||C?.get(t.path):void 0,ue=Q?Kn(Q.status,Q.staged):null,le=G?k?.get(he)||k?.get(t.path):null,xe=Boolean(ue),L=t.ignored===!0,_=g?g.has(t.path):I,ce=t.forceExpanded!==void 0?t.forceExpanded:_;o(()=>{J(!0)},[]),o(()=>{if(G&&g)z(g.has(t.path))},[g,t.path,G]),o(()=>{if(G&&ce&&pn(t,K,ne)&&p)q(!0),j(!0),Promise.resolve(p(t.path)).finally(()=>j(!1))},[G,ce,t.children,t.path,p,K,ne]);let ye={path:t.path,name:t.name,kind:G?"folder":"file"},be=N.selected.has(t.path),U=Dt({file:{path:t.path,name:t.name,basePath:l,rootPath:r,repo:c},selection:M,selected:be,archive:E,diff:{staged:Q?.staged||(Q?.status?Q.status[0]!==" "&&Q.status[0]!=="?":!1),status:ue?.charStatus},onOpenFile:f,onActionComplete:v,onCreated:h,onRenamed:y,onUnfold:W&&Se({type:G?"folder":"file",name:t.name})?()=>W(ye):void 0,onFold:ee&&te?.has(t.path)?()=>ee(te.get(t.path)):void 0,clipboard:w,isFolder:G});me(U.contextMenuRef,U.closeContextMenu);let Y=Mu({enabled:ae,onLongPress:(V,ge)=>U.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),G){let pe=!ce;if(z(pe),t.forceExpanded!==void 0)t.forceExpanded=void 0;if(m?.(t.path,pe),!pe)q(!1)}else if(f)f({...t,root:r,repo:c||"."})},ve=(V)=>{V.preventDefault(),V.stopPropagation(),N.ensureForContext(t.path),U.openContextMenu(V.clientX,V.clientY)},de=Rt({target:ye,dragging:T,clipboard:w,onDragStart:R,onDragEnd:A,onDropOn:H,onHoverAccept:W});return e("div",{children:[e("div",{className:`flex items-center space-x-1.5 py-1 px-2 cursor-pointer rounded group select-none ${de.isDragging?"opacity-40":""} ${de.isDropHovered?"bg-info/10 ring-1 ring-info/40 ring-inset":be?"bg-ink/[0.08] ring-1 ring-ink/20 ring-inset":"hover:bg-ink/5"}`,draggable:!ae,onClick:ke,onContextMenu:ve,onDragStart:de.onDragStart,onDragEnd:de.onDragEnd,onDragOver:de.onDragOver,onDragLeave:de.onDragLeave,onDrop:de.onDrop,onTouchStart:Y.onTouchStart,onTouchMove:Y.onTouchMove,onTouchEnd:Y.onTouchEnd,onTouchCancel:Y.onTouchCancel,children:e(Ye,{name:t.name,path:t.path,isFolder:G,isOpen:ce,ignored:L,selected:be,gitStatus:ue,folderStatus:le})}),ce&&K&&e("div",{className:"ml-3 border-l border-ink/10 pl-3 py-0.5 text-[10px] text-ink/30",children:"Loading…"}),ce&&!K&&ie.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:ie.map((V)=>e(Oe,{file:V,rootPath:r,basePath:l,repo:c,onLoadChildren:p,onOpenFile:f,onActionComplete:v,onCreated:h,onRenamed:y,expandedPaths:g,onToggleFolder:m,gitFileMap:C,gitFolderMap:k,clipboard:w,archive:E,selection:N,selectionTargets:M,dragging:T,onDragStart:R,onDragEnd:A,onDropOn:H,onUnfold:W,onFold:ee,foldRoots:te,touch:ae},V.path))}),X&&U.contextMenu&&e(Je,{x:U.contextMenu.x,y:U.contextMenu.y,isFolder:G,hasGitStatus:xe,pasteLabel:U.pasteLabel,chainLabel:U.chainLabel,foldable:U.foldable,busy:U.busy,selectionCount:U.selectionCount,isArchive:U.isArchive,onAction:U.handleAction}),X&&e(rt,{actions:U,file:t,isFolder:G,chainLabel:Se({type:G?"folder":"file",name:t.name})?t.name:void 0})]})}function Tt({x:t,y:r,pasteLabel:l,busy:c,onAction:p,menuRef:f}){let h=l?104:76,y=typeof window<"u"?Math.max(10,Math.min(t,window.innerWidth-190-12)):t,g=typeof window<"u"?Math.max(10,Math.min(r,window.innerHeight-h-12)):r;return oe(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:g,left:y},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(ni,{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(ln,{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(bo,{size:13,className:"text-ink/60"}),e("span",{children:l})]})]})}),document.body)}function At({menu:t,menuRef:r,pasteLabel:l,busy:c,onAction:p,create:f}){return e(d,{children:[t&&e(Tt,{x:t.x,y:t.y,menuRef:r,pasteLabel:l,busy:c,onAction:p}),f.open&&e(Fe,{folderPath:".",kind:f.kind,value:f.name,error:f.error,isLoading:f.busy,onChange:f.setName,onCancel:f.closeDialog,onSubmit:f.submit})]})}function St({title:t,subject:r,error:l,busy:c,submitLabel:p,busyLabel:f,onSubmit:v,onCancel:h,children:y}){return oe(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center p-4 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-1 text-sm",children:t}),e("p",{className:"text-[11px] text-ink/50 mb-3 break-words",children:r}),y,l&&e("p",{className:"text-[11px] text-error mb-2",children:l}),e("div",{className:"flex justify-end space-x-2 mt-3",children:[e("button",{type:"button",onClick:h,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:v,onFormatChange:h,onNameChange:y,onDestinationChange:g,onCancel:m,onSubmit:C}){let k=t.slice(0,4).map((E)=>E.name).join(", "),w=t.length>4?` +${t.length-4} more`:"";return e(St,{title:`Compress ${t.length===1?t[0].name:`${t.length} items`}`,subject:`${k}${w}`,error:f,busy:v,submitLabel:"Compress",busyLabel:"Compressing...",onCancel:m,onSubmit:(E)=>{E.preventDefault(),C()},children:[e("label",{className:"block text-[10px] uppercase tracking-wide text-ink/40 mb-1",htmlFor:"archive-format",children:"Format"}),e("select",{id:"archive-format",value:r,onChange:(E)=>h(E.currentTarget.value),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 mb-3",children:p.map((E)=>e("option",{value:E.id,disabled:!E.available,children:[E.label,E.available?"":` — ${E.tool} not installed`]},E.id))}),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)=>y(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)=>g(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:v,onSubmit:h}){return e(St,{title:`Extract ${t.name}`,subject:`${r} archive · extracts into a folder`,error:c,busy:p,submitLabel:"Extract",busyLabel:"Extracting...",onCancel:v,onSubmit:(y)=>{y.preventDefault(),h()},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:(y)=>f(y.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]=S("files.outlineExpanded",!1),l=br(),c=Ue(oA,aA),{symbols:p,total:f,truncated:v,notice:h}=$u({content:c.content,language:c.language,state:c.state,note:c.note,path:c.path});if(c.state==="diff")return null;let y=c.preview,g=(m,C)=>{if(!c.path)return;if(y){let k=qu(p,C);if(k)Ji({path:c.path,...k});return}Yi({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(Kr,{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:v?`${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:h}):e("div",{className:"max-h-48 overflow-y-auto scrollbar-overlay-container flex flex-col",children:[p.map((m,C)=>e("button",{type:"button",onClick:()=>g(m,C),"aria-label":y?`${Yo(m.kind)} ${m.name}`:`${Yo(m.kind)} ${m.name}, line ${m.line}`,title:y?`Jump to ${Yo(m.kind).toLowerCase()}`:`${Yo(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(Pu,{kind:m.kind}),e("span",{className:"min-w-0 flex-1 truncate text-[11px] font-mono text-ink/80",children:m.name}),!y&&e("span",{className:"flex-shrink-0 font-mono text-[10px] text-ink/35",children:m.line})]},`${m.line}:${m.kind}:${m.name}`)),v&&e("div",{className:"px-1 py-1 text-[10px] italic text-ink/40",children:Ou(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],v={...r},h=f,y=null;for(let g=0;g<c.length-1;){let m=c.slice(0,g+1).join("/"),C=h.find((M)=>M.type==="folder"&&M.path===m),k=C?null:h.find((M)=>M.type==="folder"&&M.path.startsWith(`${m}/`)&&(p===M.path||p.startsWith(`${M.path}/`))),w=C??k,E=w?v[w.path]??w.children:null;if(w&&!Array.isArray(E))return{nodes:t,cache:r};if(!w){let M=gn(h,v,m);if(M){h=M;let T=h.find((A)=>A.path===m),R=Array.isArray(T?.children)?[...T.children]:[];v[m]=R,h=R,y=m,g+=1;continue}}let N=Array.isArray(E)?[...E]:[];if(w){v[w.path]=N,h=N,y=w.path,g=w.path.split("/").length;continue}h.push({name:c[g],path:m,type:"folder",ignored:!1}),v[m]=N,h=N,y=m,g+=1}if(h.push(l),y!==null)v[y]=Lt(h);return f=Lt(f),{nodes:f,cache:v}}function gn(t,r,l){let c=t.findIndex((y)=>y.type==="folder"&&y.path.startsWith(`${l}/`));if(c===-1)return null;let p=t[c],f=p.path.slice(l.length+1).split("/"),v=r[p.path]??p.children;if(Array.isArray(v))r[p.path]=v;let h={name:f[f.length-1],path:p.path,type:"folder",ignored:p.ignored,...Array.isArray(v)?{children:v}:{}};for(let y=f.length-2;y>=0;y-=1)h={name:f[y],path:`${l}/${f.slice(0,y+1).join("/")}`,type:"folder",ignored:!1,children:[h]};return t[c]={name:$t(l),path:l,type:"folder",ignored:!1,children:[h]},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],v=f?.find((m)=>m.path===l);if(f&&v)return{entry:v,nodes:t,cache:{...r,[p]:f.filter((m)=>m.path!==l)}};let y=Object.keys(r).filter((m)=>l.startsWith(`${m}/`)&&r[m].some((C)=>C.path===l)).sort((m,C)=>C.length-m.length)[0];if(!y)return{entry:null,nodes:t,cache:r};let g=r[y];return{entry:g.find((m)=>m.path===l),nodes:t,cache:{...r,[y]:g.filter((m)=>m.path!==l)}}}function Ot(t,r,l){let c=!1,p=t.map((f)=>{let v=f.path===r||f.path.startsWith(`${r}/`),h=Array.isArray(f.children)?Ot(f.children,r,l):void 0;if(!v&&h===f.children)return f;c=!0;let y=v?f.path===r?l:`${l}${f.path.slice(r.length)}`:f.path,g=v?{...f,path:y,name:$t(y)}:{...f};if(h!==void 0)g.children=h;return g});return c?p:t}function Pt(t,r,l){let c={};for(let[p,f]of Object.entries(t)){let v=p===r?l:p.startsWith(`${r}/`)?`${l}${p.slice(r.length)}`:p;c[v]=v===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(!x(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)=>x(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}`,[v,h]=n({scope:"",files:[],root:""}),[y,g]=n(!1),m=i({}),C=i([]),k=i(f);k.current=f;let w=i(""),E=i(""),N=i(c);N.current=c;let M=(I)=>{let z=new URLSearchParams;if(r)z.set("root",r);if(l&&l!==".")z.set("repo",l);if(I)z.set("path",I);return z.set("t",String(Date.now())),`/api/fs/dir?${z.toString()}`},T=(I,z)=>{w.current=I,E.current=z;let K=Pe(C.current,m.current);return h({scope:I,files:K,root:z}),K},R=async(I)=>{let z=[...N.current];if(z.length===0)return;let K=await Promise.all(z.map(async(X)=>({path:X,read:await He(M(X))})));if(k.current!==I)return;let j=[];for(let{path:X,read:J}of K)if(J.status==="ok")m.current[X]=J.files;else if(J.status==="missing")j.push(X);if(j.length===0)return;let ne=new Set(j);for(let X of j)delete m.current[X];let q=new Set([...N.current].filter((X)=>!ne.has(X)));N.current=q,p(q)},A=async()=>{if(!t)return;let I=k.current;g(!0);try{let z=await He(M());if(k.current!==I)return;if(z.status!=="ok")return;if(w.current!==I)m.current={};if(C.current=z.files,T(I,z.root),await R(I),k.current!==I)return;T(I,z.root)}finally{if(k.current===I)g(!1)}},H=async(I)=>{let z=k.current,K=await He(M(I));if(k.current!==z||K.status!=="ok")return;if(m.current[I]=K.files,w.current===z)T(z,E.current)},W=(I)=>{let z=Ht(I);if(z.status!=="ok")return;let K=k.current;if(w.current!==K)m.current={};C.current=z.files,T(K,z.root),R(K).then(()=>{if(k.current===K)T(K,z.root)})},ee=()=>{m.current={},C.current=[],w.current="",E.current="",h({scope:"",files:[],root:""})},te=(I)=>{let z=k.current;if(w.current!==z)return null;let K={name:I.path.slice(I.path.lastIndexOf("/")+1),path:I.path,type:I.kind,ignored:!1},j=Ie(C.current,m.current,K);if(j.nodes===C.current)return null;return C.current=j.nodes,m.current=j.cache,T(z,E.current)},ae=(I,z)=>{let K=k.current;if(w.current!==K)return null;let j=zt(C.current,m.current,I);if(!j.entry)return null;m.current=Pt(j.cache,I,z);let ne={...j.entry,path:z,name:z.slice(z.lastIndexOf("/")+1)},q=Ie(j.nodes,m.current,ne);return C.current=q.nodes,m.current=q.cache,T(K,E.current)},G=v.scope===f;return{scope:f,files:G?v.files:[],root:G?v.root:"",isLoading:y,reload:A,loadChildren:H,adoptRoot:W,insertEntry:te,moveEntry:ae,reset:ee}}function Kt({rootPath:t,repo:r,onComplete:l,onError:c}){let p=lt(),[f,v]=S("files.clipboard",null),h=mt(f),y=ct(t,r),g=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=g.current;if(g.current=!1,N.success){if(M)v(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 C=a((N,M)=>{g.current=M;let T=new FormData;for(let[R,A]of Object.entries(N))T.append(R,A);if(r&&r!==".")T.append("repo",r);if(t)T.append("root",t);p.submit(T,{method:"post",action:"/api/fs/action"})},[p,r,t]),k=a((N)=>ft(h,y,Le(N.path,N.kind)),[h,y]),w=a((N,M)=>ut(N,Le(M.path,M.kind)),[]),E=a((N,M,T,R)=>{let A=new FormData;A.append("actionType","paste"),A.append("mode",T),A.append("targetPath",M.path),A.append("targetKind",M.kind);for(let H of N)A.append("sourcePath",H.path);if(r&&r!==".")A.append("repo",r);if(t)A.append("root",t);g.current=R,p.submit(A,{method:"post",action:"/api/fs/action"})},[p,r,t]);return{clip:h,busy:p.state!=="idle",refusalFor:k,moveRefusalFor:w,copy:(N)=>{if(N.length===0)return;v({scope:y,entries:N.map(({path:M,name:T,kind:R})=>({path:M,name:T,kind:R})),mode:"copy"})},cut:(N)=>{if(N.length===0)return;v({scope:y,entries:N.map(({path:M,name:T,kind:R})=>({path:M,name:T,kind:R})),mode:"cut"})},duplicate:(N)=>{C({actionType:"duplicate",path:N.path},!1)},move:(N,M)=>{let T=w(N,M);if(T){c(T);return}E([N],M,"cut",Boolean(h?.mode==="cut"&&h.entries.some((R)=>R.path===N.path)))},paste:(N)=>{if(!h)return;let M=k(N);if(M){c(M);return}E(h.entries.map(({path:T,name:R,kind:A})=>({path:T,name:R,kind:A})),N,h.mode,h.mode==="cut")}}}var bn=$e.map((t)=>({...t,available:!0,tool:t.id}));function jt({rootPath:t,repo:r,onComplete:l}){let c=lt(),[p,f]=n(bn),[v,h]=n(null),[y,g]=n(null),[m,C]=n(null),k=i(null),w=i(null);o(()=>{let R=!1;return(async()=>{try{let H=await(await fetch("/api/fs/archive")).json();if(!R&&Array.isArray(H.formats)&&H.formats.length>0)f(H.formats)}catch{}})(),()=>{R=!0}},[]),o(()=>{if(c.state!=="idle"||!c.data)return;let R=c.data;if(w.current===R)return;w.current=R;let A=k.current;if(k.current=null,R.success){if(C(null),A==="compress")h(null);if(A==="extract")g(null);l()}else if(A)C(R.error||"The archive request failed")},[c.state,c.data]);let E=a((R)=>{let A=new FormData;for(let[H,W]of Object.entries(R))A.append(H,W);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((R)=>{if(R.length===0)return;let A=p.find((H)=>H.id==="zip"&&H.available)?.id??p.find((H)=>H.available)?.id??"zip";C(null),g(null),h({entries:R.map(({path:H,name:W,kind:ee})=>({path:H,name:W,kind:ee})),format:A,name:De(R,A),destination:Ct(R)})},[p]),M=a((R)=>{C(null),h(null),g({archive:R,destination:Ft(R.path)})},[]),T=a((R)=>{h((A)=>{if(!A)return A;let H=De(A.entries,A.format),W=A.name===H?De(A.entries,R):A.name;return{...A,format:R,name:W}})},[]);return{formats:p,compress:v,extract:y,error:m,busy:c.state!=="idle",openCompress:N,openExtract:M,setFormat:T,setName:(R)=>h((A)=>A&&{...A,name:R}),setCompressDestination:(R)=>h((A)=>A&&{...A,destination:R}),setExtractDestination:(R)=>g((A)=>A&&{...A,destination:R}),cancel:()=>{h(null),g(null),C(null)},submitCompress:()=>{let R=v;if(!R)return;k.current="compress",C(null),E({actionType:"compress",format:R.format,name:R.name.trim(),destination:R.destination.trim()||".",paths:JSON.stringify(R.entries.map((A)=>A.path))})},submitExtract:()=>{let R=y;if(!R)return;k.current="extract",C(null),E({actionType:"extract",path:R.archive.path,destination:R.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),v=Math.max(c,p);return t.slice(f,v+1)}function _t(t){let[r,l]=n(()=>new Set),[c,p]=n(null),f=a((g,m)=>{if(g==="range"){l(new Set(vn(t,c,m)));return}if(p(m),g==="toggle"){l((C)=>{let k=new Set(C);if(k.has(m))k.delete(m);else k.add(m);return k});return}l(new Set([m]))},[c,t]),v=a((g)=>{l((m)=>{if(m.has(g))return m;return new Set([g])}),p(g)},[]),h=a(()=>{l(new Set),p(null)},[]),y=a(xn,[]);return u(()=>({selected:r,count:r.size,anchor:c,gestureOf:y,applyGesture:f,ensureForContext:v,clear:h}),[r,c,y,f,v,h])}function Ge(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))Ge(p.children,r,l+1,c);return c}function Wt({listing:t,setExpandedPaths:r,setStoredExpandedPaths:l,reload:c,onMoved:p}){let f=a((y,g)=>{let m=at(g,y);if(m.length===0)return;r((C)=>{if(m.every((w)=>C.has(w)))return C;let k=new Set(C);for(let w of m)k.add(w);return l(Array.from(k)),k})},[r,l]),v=a((y)=>{let g=t.insertEntry(y);if(!g){c();return}f(y.path,g)},[t,c,f]),h=a((y,g)=>{p?.(y,g),r((C)=>{let k=It(C,y,g);return l(Array.from(k)),k});let m=t.moveEntry(y,g);if(!m){c();return}f(g,m)},[t,c,f,r,l,p]);return{insertCreated:v,moveRenamed:h}}var yn=new Set;function Ut({scope:t,setExpandedPaths:r,setStoredExpandedPaths:l}){let[c,p]=n({scope:t,chains:new Map}),f=a((y)=>{let g=Me(y.path,y.name);if(!g)return;p((C)=>{let k=C.scope===t?C.chains:new Map;if(k.get(y.path)?.length===g.length)return C;let E=new Map(k);return E.set(y.path,g),{scope:t,chains:E}});let m=g.slice(0,-1);r((C)=>{if(m.every((w)=>C.has(w)))return C;let k=new Set(C);for(let w of m)k.add(w);return l(Array.from(k)),k})},[t,r,l]),v=a((y)=>{let g=c.scope===t?c.chains.get(y):void 0;if(!g)return;let m=g.slice(0,-1);p((C)=>{if(C.scope!==t)return C;let k=new Map(C.chains);return k.delete(y),{scope:t,chains:k}}),r((C)=>{if(!m.some((w)=>C.has(w)))return C;let k=new Set(C);for(let w of m)k.delete(w);return l(Array.from(k)),k})},[t,c,r,l]),h=a((y,g)=>{let m=c.scope===t?c.chains:null;if(!m)return;let C=new Map,k=[],w=!1;for(let[E,N]of m){if(N.findIndex((A,H)=>A===y&&H>0&&H<N.length-1)!==-1){w=!0;continue}let T=N.map((A)=>A===y?g:A.startsWith(`${y}/`)?`${g}${A.slice(y.length)}`:A),R=T[T.length-1];if(R!==E||T.some((A,H)=>A!==N[H]))w=!0;C.set(R,T),k.push(...T.slice(0,-1))}if(!w)return;p({scope:t,chains:C}),r((E)=>{if(k.every((M)=>E.has(M)))return E;let N=new Set(E);for(let M of k)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()):yn,unfold:f,fold:v,rekey:h}}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 v=(p.children||[]).map(c).filter((h)=>h!==null);if(f||v.length>0)return{...p,children:f&&v.length===0?p.children:v,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:(v)=>{if(!v.currentTarget.contains(v.relatedTarget))f(!1)},onDragOver:(v)=>{if(!c)return;if(v.preventDefault(),v.dataTransfer)v.dataTransfer.dropEffect="move"},onDrop:(v)=>{if(!c)return;v.preventDefault(),f(!1),r.move(t,l)}}}function oi({className:t="",enabled:r=!0,active:l=!0,rootPath:c,onOpenFile:p,refreshKey:f=0,onRefresh:v}){let[h,y]=S("files.searchQuery",""),[g,m,C]=S("files.expandedPaths",[]),[k,w]=n(()=>new Set(g)),{activeRepo:E,setActiveRepo:N}=cr(c),{repos:M,scanning:T,rescan:R}=ur(c,r),{fileMap:A,folderMap:H,refreshGitStatus:W}=$s(c,E,r),[ee,te]=n(null),ae=i(null);o(()=>{if(!C)return;w((P)=>{let Z=new Set(g);if(P.size===Z.size&&Array.from(Z).every((fe)=>P.has(fe)))return P;return Z})},[C,g]);let G=Gt({enabled:r,rootPath:c,activeRepo:E,expandedPaths:k,onExpansionPruned:(P)=>{w(P),m(Array.from(P))}});o(()=>{if(!C||!l)return;G.reload()},[f,c,r,E,C,l]);let I=r&&C?Wg(G.scope):null,z=Ce(I);o(()=>{if(z.data)G.adoptRoot(z.data)},[z.data]);let K=(P)=>(W(),G.loadChildren(P)),j=(P,Z)=>{let fe=new Set(k);if(Z)fe.add(P);else fe.delete(P);w(fe),m(Array.from(fe))},{unfolded:ne,unfold:q,fold:X,rekey:J}=Ut({scope:G.scope,setExpandedPaths:w,setStoredExpandedPaths:m}),ie=G.files,he=it(ie,ne),Q=Vt(he.nodes,h),ue=Ge(Q,(P)=>P.forceExpanded!==void 0?P.forceExpanded:k.has(P.path)),le=_t(ue.map((P)=>P.path)),xe=ue.filter((P)=>le.selected.has(P.path)).map(({path:P,name:Z,kind:fe})=>({path:P,name:Z,kind:fe})),L=(P)=>{if(P===E)return;G.reset(),w(new Set),m([]),le.clear(),N(P)},_=()=>{if(W(),v)v();else G.reload()},{insertCreated:ce,moveRenamed:ye}=Wt({listing:G,setExpandedPaths:w,setStoredExpandedPaths:m,reload:_,onMoved:(P,Z)=>J(P,Z)}),be=Xi(),{pushToast:U}=je(),Y=Kt({rootPath:c,repo:E,onComplete:_,onError:(P)=>U(P,"error")}),ke=jt({rootPath:c,repo:E,onComplete:_}),ve={path:".",name:".",kind:"folder"},de=Y.clip&&!Y.refusalFor(ve)?`Paste ${we(Y.clip)??"item"}`:null,[V,ge]=n(null),pe=Xt({dragging:V,clipboard:Y,target:ve}),Re=Ne({folderPath:".",rootPath:c,repo:E,onCreated:ce,onOpenCreated:(P)=>p?.({...P,root:c,repo:E})}),[Ke,qt]=n(!1);o(()=>qt(!0),[]);let{count:_e,clear:We}=le;if(o(()=>{if(!l)return;let P=(Z)=>{if(Z.key==="Escape"&&_e>0)We()};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[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 Bt=G.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:T,onRefreshRepos:R,onSelectRepo:L,searchQuery:h,onSearchChange:y,onRefresh:_,refreshing:Bt}),e("div",{className:`flex-1 scrollbar-overlay-container p-2 font-mono text-[11px] text-ink/80 ${be?"file-tree-touch":""} ${pe.highlighted?"bg-info/[0.06]":""}`,onContextMenu:(P)=>{P.preventDefault(),te({x:P.clientX,y:P.clientY})},onDragEnter:pe.onDragEnter,onDragLeave:pe.onDragLeave,onDragOver:pe.onDragOver,onDrop:pe.onDrop,children:G.isLoading&&Q.length===0?e("div",{className:"p-4 text-center text-ink/40",children:"Loading files..."}):Q.length===0?e("div",{className:"p-4 text-center text-ink/40",children:"No files found"}):Q.map((P)=>e(Oe,{file:P,rootPath:c,basePath:G.root,repo:E,onLoadChildren:K,onOpenFile:p,onActionComplete:_,onCreated:ce,onRenamed:ye,expandedPaths:k,onToggleFolder:j,gitFileMap:A,gitFolderMap:H,clipboard:Y,archive:ke,selection:le,selectionTargets:xe,dragging:V,onDragStart:ge,onDragEnd:()=>ge(null),onDropOn:(Z)=>{if(!V)return;Y.move(V,Z)},onUnfold:q,onFold:X,foldRoots:he.roots,touch:be},P.path))}),e(Mt,{}),Ke&&e(At,{menu:ee,menuRef:ae,pasteLabel:de,busy:Y.busy,create:Re,onAction:(P)=>{if(te(null),P==="new_file")Re.openDialog("file");if(P==="new_folder")Re.openDialog("folder");if(P==="paste")Y.paste(ve)}}),Ke&&e(Et,{archive:ke})]})}export{oi as FileExplorer};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{d,n,o,K,i,u,a,br,e,yr,fo,Kn,Np,Ce,S,Rp,Zf,cr,ur,s,za,Ie,Ua,m,Rn,_e,F,_,nt,f,B,se,rt,re,ge,pe,Ln,rn,Mn,W,D,Ea,O,xo,un,b,ht,ot,me,Gu,ci,Z,st,lt,bt,Vs,je,he,J}from"./index-f77c3ag0.js";import{Sp,hr}from"./index-3588r3wg.js";var _t={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]},Ve=s(_t);var jt={name:"list",size:24,node:[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]},Ye=s(jt);function Xe({message:t,hasStagedChanges:l,isBusy:c=!1,amend:r=!1,seeded:p=!1,isGenerating:h=!1,suggestion:g=null,generated:v=!1,onToggleAmend:w,onChangeMessage:P,onCommit:R,onGenerate:C,onUseSuggestion:N,onDismissSuggestion:G}){let M=t.trim().length>0&&!c&&(r||l),y=(r||l)&&!c&&!h,x=r?"Rewrite the previous commit with this message":l?"Commit staged changes":"Stage changes first",k=h?"Generating…":r||l?"Generate a commit message from the staged changes":"Stage changes first";return e("div",{className:"border-t border-ink/10 bg-canvas/50 p-3 flex flex-col gap-2",children:[g&&e("div",{className:"rounded border border-ink/20 bg-paper p-2.5 space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-ink/45",children:"Generated message"}),e("div",{className:"flex items-center gap-1",children:[e("button",{type:"button",onClick:N,className:"px-2 py-0.5 rounded bg-ink text-canvas text-[10px] font-medium hover:bg-ink/90 transition-colors cursor-pointer",children:"Use"}),e("button",{type:"button",onClick:G,className:"px-2 py-0.5 rounded border border-ink/20 text-ink/70 text-[10px] font-medium hover:bg-ink/5 transition-colors cursor-pointer",children:"Dismiss"})]})]}),e("pre",{className:"whitespace-pre-wrap break-words text-[11px] text-ink/80 font-mono max-h-32 overflow-y-auto",children:g})]}),e("textarea",{value:t,onChange:(T)=>P(T.currentTarget.value),onKeyDown:(T)=>{if(T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&M)T.preventDefault(),R()},placeholder:r?"New message for the previous commit (⌘/Ctrl+Enter to commit)":"Commit message (⌘/Ctrl+Enter to commit)",rows:5,className:"w-full resize-y min-h-[100px] max-h-[200px] bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),v&&t.trim().length>0&&e("div",{className:"flex items-center gap-1 text-[10px] text-ink/40",children:[e(_e,{size:10})," Generated from staged changes"]}),e("div",{className:"flex flex-wrap items-center gap-2",children:[e("label",{className:"flex items-center gap-1.5 text-[11px] text-ink/70 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:r,onChange:(T)=>w?.(T.currentTarget.checked),className:`${he} accent-ink cursor-pointer`}),"Amend"]}),r&&p&&e("span",{className:"text-[10px] text-ink/40",title:"The previous commit's message, loaded as an editable starting point",children:"previous message loaded"}),e("button",{type:"button",onClick:C,disabled:!y,title:k,"aria-label":"Generate commit message with AI",className:"ml-auto flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[h?e(m,{size:12,className:"animate-spin"}):e(_e,{size:12}),h?"Generating…":"Generate"]}),e("button",{type:"button",onClick:R,disabled:!M,title:x,className:"flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(f,{size:12}),r?"Amend commit":"Commit"]})]})]})}function Ze({operation:t,conflicts:l,isBusy:c,onAbort:r,onContinue:p}){let h=fo[t],g=l.length,v=g===0,w=t!=="stash-pop";return e("div",{className:"border-t border-warning/30 bg-warning/5 p-3 flex flex-col gap-2",children:[e("div",{className:"flex items-center gap-2 text-xs text-ink",children:[e(_,{size:13,className:"text-warning flex-shrink-0"}),e("span",{className:"font-medium",children:[h.charAt(0).toUpperCase()+h.slice(1)," in progress"]}),e("span",{className:`font-mono tabular-nums text-[10px] ${v?"text-success":"text-warning"}`,children:v?"all conflicts resolved":`${g} conflict${g===1?"":"s"} left`})]}),!v&&e("div",{className:"max-h-20 overflow-y-auto scrollbar-overlay-container font-mono text-[10px] text-warning/90 space-y-0.5",children:l.map((P)=>e("div",{className:"truncate",title:P,children:P},P))}),e("div",{className:"flex items-stretch gap-2",children:[e("button",{type:"button",onClick:r,disabled:c,title:`Abort the ${h} and restore the previous state`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-error/40 text-error hover:bg-error/10 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(un,{size:12}),"Abort ",h]}),w&&e("button",{type:"button",onClick:p,disabled:c||!v,title:v?`Conclude the ${h}`:`Resolve all ${g} conflict(s) first`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-transparent bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(Ln,{size:12}),"Continue ",h]})]})]})}function Qe({branchRef:t,showBranchMenu:l,setShowBranchMenu:c,branch:r,branches:p,remoteBranches:h,onCheckout:g,onMerge:v,onOpenBranchPrompt:w,onManageBranches:P,optionsRef:R,showOptions:C,setShowOptions:N,onHistory:G,onGraph:M,viewMode:y,setViewMode:x,isBusy:k=!1,syncCount:T={ahead:0,behind:0},syncing:L=!1,onSync:H,onFetch:A,detached:I=!1}){return e("div",{className:"p-3 border-b border-ink/10 bg-canvas/50 flex items-center justify-between",children:[e("div",{className:"relative",ref:t,children:[e("button",{onClick:()=>c(!l),className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 -ml-2 rounded transition-colors text-[11px] text-ink/80 font-medium",title:I?`Detached HEAD at ${r}`:`On branch ${r}`,children:[e(pe,{size:12,className:I?"text-warning":"text-ink/60"}),e("span",{className:`truncate max-w-[140px] ${I?"font-mono text-warning":""}`,children:r}),e(B,{size:12,className:"text-ink/40"})]}),l&&e("div",{className:"glass-popover absolute top-full left-0 mt-1 w-56 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:e("div",{className:"max-h-48 scrollbar-overlay-container py-1",children:[p.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Local"}),p.map((E)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(E),c(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:E}),r===E&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==E&&e("button",{type:"button",onClick:()=>{v(E),c(!1)},title:`Merge ${E} into ${r}`,"aria-label":`Merge ${E} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Ln,{size:12})})]},E))]}),h.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Remote"}),h.map((E)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(E),c(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:E}),r===E&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==E&&e("button",{type:"button",onClick:()=>{v(E),c(!1)},title:`Merge ${E} into ${r}`,"aria-label":`Merge ${E} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Ln,{size:12})})]},E))]}),e("div",{className:"w-full h-px bg-ink/10 my-1"}),e("button",{onClick:()=>{w(),c(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80 italic",children:[e(W,{size:12}),e("span",{children:"Create new branch..."})]}),e("button",{onClick:P,className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80",children:[e(xo,{size:12}),e("span",{children:"Manage branches..."})]})]})})]}),e("div",{className:"flex items-center space-x-2 text-ink/40 relative",ref:R,children:[e("button",{type:"button",onClick:A,disabled:k,title:"Fetch from all remotes and prune deleted branches","aria-label":"Fetch",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e(za,{size:13})}),e("button",{type:"button",onClick:H,disabled:k,title:L?"Syncing with upstream…":T.ahead>0&&T.behind>0?`Pull ${T.behind} then push ${T.ahead} commit(s)`:T.ahead>0?`Push ${T.ahead} commit(s)`:T.behind>0?`Pull ${T.behind} commit(s)`:"Up to date — sync anyway","aria-label":"Sync with upstream","aria-busy":L,className:`flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:cursor-not-allowed ${L?"":"disabled:opacity-40"}`,children:[e(D,{size:13,className:L?"animate-spin":"","aria-hidden":"true"}),e("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",T.ahead," ↓",T.behind]})]}),e("button",{type:"button",onClick:G,title:"Commit History","aria-label":"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Rn,{size:13})}),e("button",{type:"button",onClick:M,title:"Git Graph","aria-label":"Git Graph",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Ln,{size:13})}),e("button",{type:"button",onClick:()=>N(!C),title:"View Options","aria-label":"View Options","aria-expanded":C,className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Ie,{size:13})}),C&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-36 bg-paper border border-ink/15 rounded-md shadow-lg z-50 py-1 font-mono text-xs",children:[e("button",{type:"button",onClick:()=>{x("flat"),N(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(Ye,{size:12,className:"text-ink/60"}),e("span",{children:"View as List"})]}),y==="flat"&&e(f,{size:12,className:"text-ink"})]}),e("button",{type:"button",onClick:()=>{x("tree"),N(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(Ve,{size:12,className:"text-ink/60"}),e("span",{children:"View as Tree"})]}),y==="tree"&&e(f,{size:12,className:"text-ink"})]})]})]})]})}function Je({activeRepo:t,repos:l,isRefreshing:c,rootPath:r,reposScanning:p,onSelectRepo:h,onRefresh:g,onRefreshRepos:v}){return e(ht,{left:e(d,{children:[e(Sp,{size:12,className:"text-ink/50 flex-shrink-0","aria-hidden":!0}),e(hr,{rootPath:r,activeRepo:t,onSelectRepo:h,repos:l,scanning:p,onRefreshRepos:v})]}),right:e(ot,{label:"Refresh",onClick:g,busy:c})})}function Fe({change:t,isStaged:l,repo:c,rootPath:r,onAction:p}){let h=Kn(t.status,l),{charStatus:g,colorClass:v}=h,w=t.file.split("/"),P=w.pop()||t.file,R=w.length>0?w.join("/"):"";return e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-ink/5 cursor-pointer group text-[11px] transition-colors",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:l,status:g,repo:c||".",root:r}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e("span",{className:`font-bold font-mono text-[10px] w-3 flex-shrink-0 text-center ${v}`,title:`Status: ${h.label}`,children:g}),e(st,{name:P,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${v}`,title:t.file,children:P}),R&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:R})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:[!l&&e(d,{children:[e("button",{type:"button",onClick:(N)=>{N.stopPropagation(),p("revert",t.file)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(un,{size:11})}),e("button",{type:"button",onClick:(N)=>{N.stopPropagation(),p("stage",t.file)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(W,{size:11})})]}),l&&e("button",{type:"button",onClick:(N)=>{N.stopPropagation(),p("unstage",t.file)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(rn,{size:11})})]})})]})}function et({change:t,repo:l,rootPath:c,onResolve:r}){let[p,h]=n(!1),[g,v]=n(null),w=t.file.split("/"),P=w.pop()||t.file,R=w.length>0?w.join("/"):"",C=()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:!1,status:t.status,repo:l,root:c}}))},N=async()=>{let y=!p;if(h(y),y&&g===null){let x=new URLSearchParams({conflictMarkers:"1",file:t.file,repo:l||"."});if(c)x.set("root",c);try{let T=await(await fetch(`/api/fs/git?${x.toString()}`)).json();v(T.markers??{})}catch{v({})}}},G=g?.ours||"ours",M=g?.theirs||"theirs";return e("div",{className:"border-b border-warning/20 last:border-b-0",children:[e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-warning/5 cursor-pointer group text-[11px] transition-colors",onClick:C,children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e(Ua,{size:11,className:"text-warning flex-shrink-0"}),e(st,{name:P,size:12,className:"flex-shrink-0"}),e("span",{className:"truncate text-warning",title:t.file,children:P}),R&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:R}),yr(t.status)&&e("span",{className:"text-[10px] text-warning/70 font-mono flex-shrink-0",children:t.status})]}),e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),N()},title:p?"Hide resolve actions":"Show resolve actions","aria-label":p?"Hide resolve actions":"Show resolve actions","aria-expanded":p,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors flex-shrink-0",children:p?e(rt,{size:11}):e(B,{size:11})})]}),p&&e("div",{className:"px-3 pb-2 pt-0.5 flex flex-wrap items-center gap-1.5",children:[e("button",{type:"button",onClick:()=>r(t.file,"ours"),title:`Take ${G} — \`git checkout --ours\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",G]}),e("button",{type:"button",onClick:()=>r(t.file,"theirs"),title:`Take ${M} — \`git checkout --theirs\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",M]}),e("button",{type:"button",onClick:()=>r(t.file,""),title:"Mark resolved: the file was edited by hand, this stages it",className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer flex items-center gap-1",children:[e(f,{size:10}),"mark resolved"]})]})]})}function Ut(t){let l={id:"",name:"",path:"",type:"folder",children:[],changeCount:0};for(let r of t){let p=r.file.replace(/^[./]+/,""),h=p.endsWith("/"),g=p.replace(/\/$/,"").split("/").filter(Boolean),v=l,w="";for(let P=0;P<g.length;P++){let R=g[P];w=w?`${w}/${R}`:R;let C=P===g.length-1;if(C&&!h)v.children.push({id:w,name:R,path:w,type:"file",change:r,children:[],changeCount:1});else{let G=v.children.find((M)=>M.type==="folder"&&M.name===R);if(!G)G={id:w,name:R,path:w,type:"folder",children:[],changeCount:0,change:C&&h?r:void 0},v.children.push(G);v=G}}}function c(r){if(r.type==="file")return 1;let p=r.change?1:0;for(let h of r.children)p+=c(h);return r.changeCount=p,r.children.sort((h,g)=>{if(h.type==="folder"&&g.type==="file")return-1;if(h.type==="file"&&g.type==="folder")return 1;return h.name.localeCompare(g.name)}),p}return c(l),l.children}function tt(t){let{sessionId:l,ready:c,read:r}=Rp(),p=u(()=>Ut(t),[t]),h=u(()=>{let N=new Set;function G(M){for(let y of M)if(y.type==="folder"){if(N.add(y.id),y.children&&y.children.length>0)G(y.children)}}return G(p),N},[p]),[g,v]=S("git.expandedFolders",[]),w=u(()=>new Set(g),[g]),P=i(null);o(()=>{if(!c||P.current===l)return;if(h.size===0)return;if(P.current=l,r("git.expandedFolders",[]).length>0)return;v(Array.from(h))},[c,l,h,r,v]);let R=a((N)=>{v((G)=>{let M=new Set(G);if(M.has(N))M.delete(N);else M.add(N);return Array.from(M)})},[v]),C=a((N)=>w.has(N),[w]);return{tree:p,expandedFolders:w,toggleFolder:R,isFolderOpen:C,expandAll:()=>v(Array.from(h)),collapseAll:()=>v([])}}function Ee({node:t,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:p,repo:h,rootPath:g}){let v=t.type==="folder",w=v?c(t.id):!1;if(v)return e("div",{className:"select-none",children:[e("div",{className:"flex items-center justify-between px-2 py-1 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>r(t.id),children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center text-ink/40 flex-shrink-0",children:w?e(B,{size:12}):e(se,{size:12})}),e(st,{name:t.name,isFolder:!0,isOpen:w,size:13,className:"flex-shrink-0"}),e("span",{className:"font-medium text-ink truncate",children:t.name}),e("span",{className:"text-[10px] text-ink/40 font-normal px-1 py-0.2 bg-ink/5 rounded-full ml-1",children:t.changeCount})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!l?e(d,{children:[e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("revert",t.path)},title:`Discard changes in ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(un,{size:11})}),e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("stage",t.path)},title:`Stage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(W,{size:11})})]}):e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("unstage",t.path)},title:`Unstage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(rn,{size:11})})})})]}),w&&t.children&&t.children.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:t.children.map((y)=>e(Ee,{node:y,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:p,repo:h,rootPath:g},y.id))})]});let P=t.change,R=Kn(P?.status||"M",l),{charStatus:C,colorClass:N}=R,G=P?P.file:t.path;return e("div",{className:"flex items-center justify-between px-2 py-0.5 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:G,staged:l,status:C,repo:h||".",root:g}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center flex-shrink-0",children:e("span",{className:`font-bold font-mono text-[10px] ${N}`,title:`Status: ${R.label}`,children:C})}),e(st,{name:t.name,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${N}`,title:G,children:t.name})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!l?e(d,{children:[e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("revert",G)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(un,{size:11})}),e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("stage",G)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(W,{size:11})})]}):e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("unstage",G)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(rn,{size:11})})})})]})}function ze({changes:t,isStaged:l,repo:c,rootPath:r,onAction:p}){let{tree:h,isFolderOpen:g,toggleFolder:v}=tt(t);if(h.length===0)return null;return e("div",{className:"py-0.5",children:h.map((w)=>e(Ee,{node:w,isStaged:l,isFolderOpen:g,toggleFolder:v,onAction:p,repo:c,rootPath:r},w.id))})}function it({changes:t,isLoading:l,viewMode:c,repo:r,rootPath:p,onAction:h,onResolve:g}){let[v,w]=S("git.stagedExpanded",!0),[P,R]=S("git.unstagedExpanded",!0),[C,N]=S("git.conflictsExpanded",!0),G=t.filter((x)=>yr(x.status)),M=t.filter((x)=>{if(yr(x.status))return!1;let k=x.status;return k&&k[0]!==" "&&k[0]!=="?"}),y=t.filter((x)=>{if(yr(x.status))return!1;let k=x.status;return k&&k[1]!==" "&&k[1]!=="?"||k==="??"});if(l&&t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"Loading..."})});if(t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"No changes found."})});return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"py-1",children:[G.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-warning/5 cursor-pointer transition-colors",onClick:()=>N(!C),children:e("div",{className:"flex items-center space-x-1 font-semibold text-warning text-xs",children:[e("span",{className:"w-3 text-center",children:C?"▾":"▸"}),e("span",{children:"Conflicts"}),e("span",{className:"text-warning/70 font-normal ml-1 border border-warning/30 rounded-full px-1.5 text-[10px] bg-paper",children:G.length})]})}),C&&G.map((x)=>e(et,{change:x,repo:r,rootPath:p,onResolve:g??(()=>{})},`conflict-${x.file}`))]}),M.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>w(!v),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:v?"▾":"▸"}),e("span",{children:"Staged Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:M.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("unstage_all")},title:"Unstage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(rn,{size:12})})})]}),v&&(c==="tree"?e(ze,{changes:M,isStaged:!0,repo:r,rootPath:p,onAction:h}):M.map((x)=>e(Fe,{change:x,isStaged:!0,repo:r,rootPath:p,onAction:h},x.file+"staged")))]}),y.length>0&&e("div",{children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>R(!P),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:P?"▾":"▸"}),e("span",{children:"Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:y.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:[e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("revert_all")},title:"Discard All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(un,{size:12})}),e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("stage_all")},title:"Stage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(W,{size:12})})]})]}),P&&(c==="tree"?e(ze,{changes:y,isStaged:!1,repo:r,rootPath:p,onAction:h}):y.map((x)=>e(Fe,{change:x,isStaged:!1,repo:r,rootPath:p,onAction:h},x.file+"unstaged")))]})]})})}function at({matches:t,loaded:l,total:c,hasMore:r,isFiltering:p}){if(p)return`${t} of ${l} loaded`;if(typeof c==="number"&&c>0)return r||l<c?`${l} of ${c}`:`${c} commits`;return r?`${l}+ commits`:`${l} commits`}function ct({isGraphMode:t,onToggleMode:l,searchQuery:c,onSearchChange:r,onRefresh:p,onClose:h,isRefreshing:g,totalCommits:v,loadedCount:w,totalCount:P,hasMore:R}){let C=at({matches:v,loaded:w,total:P,hasMore:R,isFiltering:c.trim().length>0});return e("div",{className:`flex flex-col gap-2 px-3 lg:px-5 py-3 border-b border-ink/10 bg-paper select-none
|
|
2
|
-
pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:[e("div",{className:"flex items-center justify-between gap-2 lg:gap-4",children:[e("div",{className:"flex flex-col min-w-0",children:[e("div",{className:"flex items-center gap-2.5 min-w-0",children:[e("h2",{className:"text-base font-semibold text-ink tracking-tight",children:t?"Graph":"History"}),e("span",{className:"text-[11px] font-mono px-2 py-0.5 rounded-full bg-ink/5 text-ink/80 border border-ink/10 whitespace-nowrap",children:C})]}),e("p",{className:"text-xs text-muted mt-0.5 hidden lg:block",children:t?"Follow branch topology and inspect commits.":"Browse recent commits and inspect changed files."})]}),e("div",{className:"flex items-center gap-1.5 lg:gap-2 flex-shrink-0",children:[e("div",{className:"flex items-center text-xs lg:bg-ink/5 lg:p-0.5 lg:rounded-lg lg:border lg:border-ink/10",children:[e("button",{type:"button",onClick:()=>l(!1),title:"History view","aria-label":"History view","aria-pressed":!t,className:`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${!t?"bg-ink/5 text-ink lg:bg-paper lg:shadow-xs":"text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5"}`,children:[e(Rn,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"History"})]}),e("button",{type:"button",onClick:()=>l(!0),title:"Graph view","aria-label":"Graph view","aria-pressed":t,className:`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${t?"bg-ink/5 text-ink lg:bg-paper lg:shadow-xs":"text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5"}`,children:[e(Ln,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Graph"})]})]}),e("button",{type:"button",onClick:p,disabled:g,className:"tap-target flex items-center justify-center gap-1.5 p-2 rounded-md text-ink/70 transition-colors cursor-pointer text-xs disabled:opacity-40 lg:px-2.5 lg:py-1.5 lg:border lg:border-ink/15 lg:hover:bg-ink/5 lg:hover:text-ink",title:"Refresh commit history","aria-label":"Refresh commit history",children:[e(Ea,{size:13,className:g?"animate-spin text-ink":"","aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Refresh"})]}),e("button",{type:"button",onClick:h,className:"tap-target p-2 -mr-1 rounded-md hover:bg-ink/5 text-muted hover:text-ink transition-colors cursor-pointer",title:"Close modal","aria-label":"Close commit history",children:e(b,{size:16,"aria-hidden":"true"})})]})]}),e("div",{className:"relative mt-1",children:[e(O,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-ink/55","aria-hidden":"true"}),e("input",{type:"text",value:c,onChange:(N)=>r(N.currentTarget.value),placeholder:"Filter commits by message, author, or hash...","aria-label":"Filter commits",className:"w-full bg-ink/[0.03] border border-ink/15 rounded-md pl-8 pr-3 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),c&&e("button",{type:"button",onClick:()=>r(""),"aria-label":"Clear filter",className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-ink/55 hover:text-ink cursor-pointer",children:e(b,{size:12,"aria-hidden":"true"})})]})]})}var ce=["#38bdf8","#f97316","#a855f7","#10b981","#ec4899","#eab308","#06b6d4","#6366f1"];function He(t,l){if(!t||!l)return!1;if(t===l)return!0;let c=Math.min(t.length,l.length);if(c>=4)return t.substring(0,c)===l.substring(0,c);return!1}function Ge(t){let l=new Map,c=[];for(let r of t){if(typeof r.lane==="number"){l.set(r.hash,r.lane);continue}let p=c.findIndex((g)=>He(g,r.hash)||He(g,r.shortHash));if(p===-1)if(p=c.indexOf(null),p===-1)p=c.length,c.push(r.hash);else c[p]=r.hash;l.set(r.hash,p);let h=r.parents&&r.parents[0];if(h)c[p]=h;else c[p]=null;if(r.parents&&r.parents.length>1)for(let g=1;g<r.parents.length;g++){let v=r.parents[g];if(!c.some((P)=>He(P,v))){let P=c.indexOf(null);if(P===-1)c.push(v);else c[P]=v}}}return l}function dt(t,l,c,r){let p=[],h=new Map;t.forEach((g,v)=>{if(h.set(g.hash,v),g.shortHash)h.set(g.shortHash,v);if(g.hash.length>=7)h.set(g.hash.substring(0,7),v)});for(let g of t){let v=l.get(g.hash)??0,w=c[g.hash]??0,P=ce[v%ce.length];if(!g.parents||g.parents.length===0)continue;for(let R of g.parents){let C=h.get(R);if(typeof C!=="number"&&R.length>=7)C=h.get(R.substring(0,7));if(typeof C==="number"){let N=t[C],G=l.get(N.hash)??v,M=c[N.hash]??w+60;p.push({fromHash:g.hash,toHash:N.hash,fromLane:v,toLane:G,fromY:w,toY:M,color:ce[v%ce.length]})}else p.push({fromHash:g.hash,toHash:"tail-"+g.hash,fromLane:v,toLane:v,fromY:w,toY:Math.max(w+80,r),color:P})}}return p}function pt(t,l,c,r){if(Math.abs(t-c)<1)return`M ${t} ${l} L ${c} ${r}`;let p=r-l,h=l+p*0.45,g=r-p*0.45;return`M ${t} ${l} C ${t} ${h}, ${c} ${g}, ${c} ${r}`}function mt({commits:t,nodePositions:l,selectedHash:c,hoveredHash:r,isGraphMode:p,laneWidth:h=18,paddingLeft:g=16,totalHeight:v}){let w=u(()=>{if(!p){let N=new Map;return t.forEach((G)=>N.set(G.hash,0)),N}return Ge(t)},[t,p]),P=u(()=>{let N=0;return w.forEach((G)=>{if(G>N)N=G}),N},[w]),R=p?(P+1)*h+g*2:36,C=u(()=>{if(!p){let N=[];for(let G=0;G<t.length-1;G++){let M=l[t[G].hash]??G*60+20,y=l[t[G+1].hash]??(G+1)*60+20;N.push({fromHash:t[G].hash,toHash:t[G+1].hash,fromLane:0,toLane:0,fromY:M,toY:y,color:"var(--theme-ink)"})}return N}return dt(t,w,l,v)},[t,w,l,v,p]);return e("div",{className:"absolute top-0 left-0 pointer-events-none z-10",style:{width:R,height:v},"aria-hidden":"true",children:e("svg",{className:"w-full h-full overflow-visible",style:{width:R,height:v},children:[C.map((N)=>{let G=p?g+N.fromLane*h:16,M=p?g+N.toLane*h:16,y=p?N.color:"currentColor",x=p?0.95:0.25,k=pt(G,N.fromY,M,N.toY);return e("path",{d:k,fill:"none",stroke:y,strokeWidth:p?2.25:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:x},`${N.fromHash}->${N.toHash}`)}),t.map((N)=>{let G=w.get(N.hash)??0,M=p?g+G*h:16,y=l[N.hash]??20,x=c===N.hash||c===N.shortHash,k=r===N.hash||r===N.shortHash,T=p?ce[G%ce.length]:"var(--theme-success)";return e("g",{"data-commit-node":N.hash,children:[(x||k)&&e("circle",{cx:M,cy:y,r:8,fill:T,fillOpacity:x?0.35:0.2,stroke:T,strokeWidth:1}),e("circle",{"data-commit-dot":"",cx:M,cy:y,r:p?4:4.5,fill:p?"var(--theme-paper)":T,stroke:T,strokeWidth:p?2.5:1.5}),p&&e("circle",{cx:M,cy:y,r:1.8,fill:T})]},`node-${N.hash}`)})]})})}var Wt=[{action:"checkout",label:"checkout"},{action:"create_branch_here",label:"create branch here"},{action:"cherry_pick",label:"cherry-pick"},{action:"revert",label:"revert"},{action:"reset",label:"reset..."},{action:"merge",label:"merge into current"},{action:"rebase",label:"rebase onto this"}];function ut({commit:t,onAction:l}){return e("div",{className:"flex flex-wrap items-center gap-1.5 pt-1.5 pb-2",children:Wt.map(({action:c,label:r})=>e("button",{type:"button",onClick:(p)=>{p.stopPropagation(),l(c,t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer",children:r},c))})}var Se=3;function qt(t){let l=[];for(let c=0;c<t.length;c+=1){if(t[c].type!=="context"){l.push({row:t[c],index:c});continue}let r=c;while(r<t.length&&t[r].type==="context")r+=1;let p=r-c;if(p>Se*2+1){for(let h=c;h<c+Se;h+=1)l.push({row:t[h],index:h});l.push({row:{type:"elided",count:p-Se*2},index:-1});for(let h=r-Se;h<r;h+=1)l.push({row:t[h],index:h})}else for(let h=c;h<r;h+=1)l.push({row:t[h],index:h});c=r-1}return l}function ft({diffText:t,isLoading:l,filePath:c,fullContext:r=!1,onToggleContext:p}){let h=ci(),g=u(()=>{if(!t)return[];let R=[],C=1,N=1,G=t.split(/\r?\n/),y=G.some((x)=>x.startsWith("@@"))?G:[`@@ -0,0 +1,${G.length} @@`,...G.map((x)=>x.startsWith("+")||x.startsWith("-")?x:`+${x}`)];for(let x of y){if(x.startsWith("diff --git")||x.startsWith("index ")||x.startsWith("---")||x.startsWith("+++")||x.startsWith("new file mode")||x.startsWith("deleted file mode")||x.startsWith("similarity index")||x.startsWith("old mode")||x.startsWith("new mode")||x.startsWith("\\ No newline"))continue;if(x.startsWith("@@")){let k=x.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(k)C=parseInt(k[1],10),N=parseInt(k[2],10);R.push({type:"meta",text:x})}else if(x.startsWith("+"))R.push({type:"add",text:x.slice(1),newNum:N++});else if(x.startsWith("-"))R.push({type:"del",text:x.slice(1),oldNum:C++});else{let k=x.startsWith(" ")?x.slice(1):x;R.push({type:"context",text:k,oldNum:C++,newNum:N++})}}return R},[t]),v=bt(c),w=u(()=>{let R=Array(g.length).fill(""),C=-1,N=(G)=>{if(C<0)return;let M=Gu(g.slice(C,G).map((y)=>y.text).join(`
|
|
3
|
-
`),v);for(let y=C;y<G;y++)R[y]=M[y-C]??"";C=-1};return g.forEach((G,M)=>{if(G.type==="meta")N(M);else if(C<0)C=M}),N(g.length),R},[g,v,h]),P=u(()=>r?g.map((R,C)=>({row:R,index:C})):qt(g),[g,r]);if(l)return e("div",{className:"my-2 p-4 rounded bg-canvas border border-ink/10 text-muted font-mono text-xs flex items-center justify-center",children:"Loading commit diff..."});if(!t||g.length===0)return e("div",{className:"my-2 p-3 rounded bg-canvas border border-ink/10 text-muted font-mono text-xs text-center",children:"No diff content available for this file."});return e("div",{className:"my-2 rounded border border-ink/15 bg-paper overflow-hidden text-[11px] font-mono leading-relaxed text-ink",children:[e("div",{className:"flex items-center justify-between px-3 py-1.5 bg-canvas border-b border-ink/10 text-ink/70 text-[10.5px]",children:[e("span",{className:"font-semibold text-muted",children:"Diff preview"}),e("button",{type:"button",onClick:p,disabled:!p,className:"hover:text-ink flex items-center gap-1 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-default",title:r?"Show only the changed hunks":"Read the whole file around the change","aria-pressed":r,children:r?e(d,{children:[e(rt,{size:12,"aria-hidden":"true"})," Collapse context"]}):e(d,{children:[e(B,{size:12,"aria-hidden":"true"})," Expand all context"]})})]}),e("div",{className:"overflow-x-auto max-h-72 select-text",children:e("div",{className:"w-max min-w-full divide-y divide-ink/[0.04]",children:P.map(({row:R,index:C},N)=>{if(R.type==="elided")return e("div",{className:"px-3 py-1 bg-canvas text-muted text-[10px] text-center select-none",title:`${R.count} unchanged line(s) hidden`,children:["⋯ ",R.count," unchanged line",R.count===1?"":"s"," hidden ⋯"]},`elided-${N}`);let G=R,M=C;if(G.type==="meta")return e("div",{className:"flex items-center gap-2 px-3 py-1 bg-canvas border-y border-ink/10 text-muted text-[10px] font-semibold",children:[e("span",{children:"↕"}),e("span",{children:G.text})]},M);let y=G.type==="add",x=G.type==="del";return e("div",{className:`flex items-start font-mono ${y?"bg-success/10 hover:bg-success/15":x?"bg-error/10 hover:bg-error/15":"text-ink hover:bg-ink/[0.02]"}`,children:[e("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${x?"bg-error/15 text-ink/80 font-semibold":y?"bg-success/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:G.oldNum??(y?"+":"")}),e("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${y?"bg-success/15 text-ink/80 font-semibold":x?"bg-error/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:G.newNum??(x?"-":"")}),e("div",{className:`w-4 flex-shrink-0 text-center py-0.5 select-none font-bold ${y||x?"text-ink/80":"opacity-0"}`,children:y?"+":x?"-":" "}),e("div",{className:"flex-1 py-0.5 pr-3 whitespace-pre text-ink",children:G.text?e("span",{className:"shiki",dangerouslySetInnerHTML:{__html:w[M]}}):" "})]},M)})})})]})}function gt({commit:t,isSelected:l,onSelect:c,onAction:r,onToggleFile:p,isExpandedFile:h,isLoadingFile:g,isFullContextFile:v,onToggleContext:w,fileDiffs:P,headerRef:R}){let[C,N]=n(!1),G=t.body?.trim()??"",M=G.length>0,y=t.files??[],x=y.length,k=x>0,T=M||k,L=(A)=>{A.stopPropagation(),navigator.clipboard.writeText(t.hash),N(!0),setTimeout(()=>N(!1),2000)},H=(A,I)=>{A.stopPropagation(),p(t.hash,I)};return e("div",{onClick:()=>c(t),"data-testid":"commit-row","data-commit-hash":t.hash,className:"border-b border-ink/5 transition-colors cursor-pointer hover:bg-ink/[0.015]",children:e("div",{className:"py-2.5 flex flex-col",children:[e("div",{className:"flex flex-col gap-1",children:[t.refs&&t.refs.length>0&&e("div",{className:"flex flex-wrap items-center gap-1.5 pb-0.5",children:t.refs.map((A,I)=>{let E=A.includes("stash"),Q=A.includes("HEAD")||A.includes("main")||A.includes("master");return e("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono border ${E?"bg-warning/10 text-ink/80 border-warning/25 font-semibold":Q?"bg-ink/10 text-ink font-semibold border-ink/20":"bg-canvas text-muted border-ink/10 font-medium"}`,children:A},I)})}),e("div",{ref:R,className:"flex items-start gap-1.5",children:e("button",{type:"button",onClick:(A)=>{A.stopPropagation(),c(t)},"aria-expanded":T?l:void 0,className:"flex flex-1 min-w-0 items-start gap-1.5 text-left cursor-pointer rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink/20",children:[e("span",{"data-commit-title":"",className:"text-[13px] font-semibold text-ink leading-snug break-words flex-1 min-w-0",children:t.message}),T&&e("span",{className:"text-ink/55 flex-shrink-0 mt-0.5","aria-hidden":"true",children:l?e(B,{size:13}):e(se,{size:13})})]})}),M&&l&&e("div",{className:"border-l-2 border-ink/15 pl-3 py-1",children:e(J,{content:G,className:"text-ink/70"})}),e("div",{className:"flex items-center gap-x-2 gap-y-0.5 text-[11px] text-muted font-mono flex-wrap",children:[e("span",{children:t.author}),e("span",{children:t.date}),e("button",{type:"button",onClick:L,title:"Copy commit hash","aria-label":`Copy commit hash ${t.shortHash}`,className:"inline-flex items-center gap-1 hover:text-ink transition-colors cursor-pointer text-ink/70",children:[e("span",{children:t.shortHash}),C?e(f,{size:11,className:"text-success-text","aria-hidden":"true"}):e(re,{size:11,"aria-hidden":"true"})]}),k&&e("span",{children:[x," ",x===1?"file":"files"]})]})]}),l&&e("div",{className:"mt-2",children:e(ut,{commit:t,onAction:r})}),k&&l&&e("div",{className:"mt-2 flex flex-col gap-1",children:y.map((A,I)=>{let E=h(t.hash,A.file),Q=`${t.hash}:${A.file}`,Y=P[Q]!==void 0?P[Q]:A.diff,z=g(t.hash,A.file),j=A.status==="A"?"text-success-text font-bold":A.status==="D"?"text-error-text font-bold":A.status==="R"?"text-meta-text font-bold":"text-info-text font-bold";return e("div",{className:"flex flex-col",children:[e("button",{type:"button",onClick:(q)=>H(q,A),"aria-expanded":E,className:"flex w-full items-center gap-2 py-1 px-2 rounded text-[11.5px] font-mono text-ink/80 transition-colors group cursor-pointer border border-transparent hover:border-ink/10 text-left",children:[e("span",{className:`w-3.5 text-center flex-shrink-0 text-[11px] ${j}`,children:A.status||"M"}),e("span",{className:"truncate flex-1 min-w-0 text-ink/90 group-hover:text-ink font-medium",children:A.file}),e("span",{className:"flex items-center gap-1 text-[10.5px] tabular-nums flex-shrink-0 font-medium",children:[e("span",{className:"text-success-text",children:["+",A.additions]}),e("span",{className:"text-ink/30",children:"/"}),e("span",{className:"text-error-text",children:["-",A.deletions]})]}),e("span",{className:"text-ink/55 group-hover:text-ink flex-shrink-0",children:E?e(B,{size:13,"aria-hidden":"true"}):e(se,{size:13,"aria-hidden":"true"})})]}),E&&e("div",{className:"pl-4 pr-1",children:e(ft,{diffText:Y,isLoading:z,filePath:A.file,fullContext:v(t.hash,A.file),onToggleContext:()=>w(t.hash,A)})})]},I)})})]})})}var be=50;function Kt(t){if(!Array.isArray(t))return[];let l=[];for(let c of t){if(!c||typeof c!=="object")continue;let r=c;if(typeof r.file!=="string"||!r.file)continue;l.push({file:r.file,status:typeof r.status==="string"?r.status:"M",additions:typeof r.additions==="number"&&Number.isFinite(r.additions)?r.additions:0,deletions:typeof r.deletions==="number"&&Number.isFinite(r.deletions)?r.deletions:0,diff:typeof r.diff==="string"?r.diff:void 0})}return l}function Oe(t){if(!Array.isArray(t))return[];let l=[];for(let c of t){if(!c||typeof c!=="object")continue;let r=c,p=typeof r.hash==="string"&&r.hash?r.hash:"";if(!p)continue;l.push({hash:p,shortHash:typeof r.shortHash==="string"&&r.shortHash?r.shortHash:p.slice(0,8),author:typeof r.author==="string"?r.author:"Unknown",date:typeof r.date==="string"?r.date:typeof r.time==="string"?r.time:"",message:typeof r.message==="string"?r.message:"",body:typeof r.body==="string"?r.body:void 0,parents:Array.isArray(r.parents)?r.parents.filter((h)=>typeof h==="string"):[],refs:Array.isArray(r.refs)?r.refs.filter((h)=>typeof h==="string"):[],files:Kt(r.files),lane:typeof r.lane==="number"?r.lane:void 0})}return l}function xt({output:t,isGraphMode:l,rootPath:c,activeRepo:r}){let[p,h]=n(!1),[g,v]=n(t?.hasMore??t?.data?.length===be),[w,P]=n(t?.total),R=u(()=>Oe(t?.data),[t?.data]),C=Array.isArray(t?.data)?t.data.length:0,[N,G]=n(R),[M,y]=n(C);o(()=>{if(G(R),y(C),v(t?.hasMore??C===be),typeof t?.total==="number")P(t.total)},[R,C,t?.hasMore,t?.total]);let x=a(async()=>{if(p||!g)return;h(!0);try{let k=new FormData;if(k.set("actionType",l?"graph":"history"),k.set("limit",String(be)),k.set("skip",String(M)),c)k.set("root",c);if(r)k.set("repo",r);let L=await(await fetch("/api/fs/git",{method:"POST",body:k})).json();if(L.success&&Array.isArray(L.data)){let H=Oe(L.data),A=L.data.length;if(G((I)=>{let E=new Set(I.map((Y)=>Y.hash)),Q=H.filter((Y)=>!E.has(Y.hash));return[...I,...Q]}),y((I)=>I+A),v(Boolean(L.hasMore??A===be)),typeof L.total==="number")P(L.total)}else v(!1)}catch(k){console.error("Failed to load more commits:",k)}finally{h(!1)}},[p,g,l,M,c,r]);return{commits:N,hasMore:g,totalCount:w,isLoadingMore:p,handleLoadMore:x}}function vt({onExecuteAction:t,rootPath:l,activeRepo:c}){let[r,p]=n({}),[h,g]=n(new Set),[v,w]=n(new Set),[P,R]=n(new Set),C=a(async(y,x,k)=>{let T=`${y}:${x.file}`;w((L)=>new Set(L).add(T));try{let L=new FormData;if(L.set("actionType","commit_diff"),L.set("hash",y),L.set("file",x.file),k)L.set("full","1");if(l)L.set("root",l);if(c&&c!==".")L.set("repo",c);let A=await(await fetch("/api/fs/git",{method:"POST",body:L})).json();if(A&&typeof A.diff==="string")p((I)=>({...I,[T]:A.diff}));else if(A&&A.error)p((I)=>({...I,[T]:`// Error: ${A.error}`}))}catch(L){console.error("Failed to load file diff:",L);let H=L instanceof Error?L.message:"Network error";p((A)=>({...A,[T]:`// Error loading diff: ${H}`}))}finally{w((L)=>{let H=new Set(L);return H.delete(T),H})}},[l,c]),N=a(async(y,x)=>{let k=`${y}:${x.file}`,T=!h.has(k);if(g((L)=>{let H=new Set(L);if(H.has(k))H.delete(k);else H.add(k);return H}),T&&r[k]===void 0&&!x.diff)await C(y,x,!1)},[h,r,C]),G=a(async(y,x)=>{let k=`${y}:${x.file}`,T=!P.has(k);R((L)=>{let H=new Set(L);if(H.has(k))H.delete(k);else H.add(k);return H}),await C(y,x,T)},[P,C]),M=a((y,x)=>{if(!t)return;if(y==="checkout")t("checkout",void 0,{branch:x.hash});else if(y==="create_branch_here"){let k=window.prompt(`Create new branch at commit ${x.shortHash}:`,`branch-${x.shortHash}`);if(k?.trim())t("create_branch_at",void 0,{branch:k.trim(),hash:x.hash})}else if(y==="cherry_pick"){if(window.confirm(`Cherry-pick commit ${x.shortHash} onto current branch?`))t("cherry_pick",void 0,{hash:x.hash})}else if(y==="revert"){if(window.confirm(`Revert commit ${x.shortHash}?`))t("revert_commit",void 0,{hash:x.hash})}else if(y==="reset"){let k=window.prompt(`Reset current branch to ${x.shortHash} (soft, mixed, hard):`,"soft");if(k&&["soft","mixed","hard"].includes(k.toLowerCase()))t("reset_commit",void 0,{hash:x.hash,mode:k.toLowerCase()})}else if(y==="merge"){if(window.confirm(`Merge commit ${x.shortHash} into current branch?`))t("merge_commit",void 0,{hash:x.hash})}else if(y==="rebase"){if(window.confirm(`Rebase current branch onto commit ${x.shortHash}?`))t("rebase_commit",void 0,{hash:x.hash})}},[t]);return{fileDiffs:r,expandedFiles:h,loadingFiles:v,fullContextFiles:P,handleToggleFile:N,handleToggleContext:G,handleCommitAction:M}}function Ue({output:t,onClose:l,onRefresh:c,onExecuteAction:r,rootPath:p,activeRepo:h}){if(o(()=>{if(!t)return;let U=(V)=>{if(V.key==="Escape")l()};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[t,l]),!t)return null;let[g,v]=n(()=>({title:t.title,graph:t.title.toLowerCase().includes("graph")}));if(g.title!==t.title)v({title:t.title,graph:t.title.toLowerCase().includes("graph")});let w=g.graph,P=(U)=>v((V)=>({...V,graph:U})),[R,C]=n(""),[N,G]=n(""),[M,y]=n(!1),{commits:x,hasMore:k,totalCount:T,isLoadingMore:L,handleLoadMore:H}=xt({output:t,isGraphMode:w,rootPath:p,activeRepo:h}),{fileDiffs:A,expandedFiles:I,loadingFiles:E,fullContextFiles:Q,handleToggleFile:Y,handleToggleContext:z,handleCommitAction:j}=vt({onExecuteAction:r,rootPath:p,activeRepo:h});o(()=>{if(x.length>0&&!N)G(x[0].hash)},[x,N]);let q=u(()=>{if(!R.trim())return x;let U=R.toLowerCase().trim();return x.filter((V)=>V.message.toLowerCase().includes(U)||V.author.toLowerCase().includes(U)||V.shortHash.toLowerCase().includes(U)||V.hash.toLowerCase().includes(U)||V.refs?.some((ne)=>ne.toLowerCase().includes(U)))},[x,R]),oe=i(null),ie=i(null),ve=i(null),ue=i({}),[fe,ye]=n({}),[$e,Pe]=n(800);o(()=>{let U=ve.current;if(!U||!k||L||R.trim())return;let V=new IntersectionObserver((ne)=>{if(ne[0].isIntersecting)H()},{root:oe.current,threshold:0.1});return V.observe(U),()=>V.disconnect()},[k,L,R,H]);let ae=a(()=>{if(!oe.current||!ie.current)return;let U=oe.current.getBoundingClientRect(),V=oe.current.scrollTop,ne={};q.forEach((xe,De)=>{let we=ue.current[xe.hash];if(we){let de=we.getBoundingClientRect();ne[xe.hash]=de.top+de.height/2-U.top+V}else ne[xe.hash]=De*60+20}),ye(ne);let Le=ie.current.offsetHeight;Pe(Math.max(Le,oe.current.clientHeight,600))},[q]);K(()=>{ae();let U=requestAnimationFrame(()=>{ae()});return()=>cancelAnimationFrame(U)},[ae,q,A,I,w,N]),o(()=>{let U=ie.current;if(!U)return;let V=new ResizeObserver(()=>{ae()});V.observe(U);for(let ne of Array.from(U.children))V.observe(ne);return()=>V.disconnect()},[ae,q]);let ee=u(()=>Ge(q),[q]),Me=u(()=>{let U=0;return ee.forEach((V)=>{if(V>U)U=V}),U},[ee]),ke=18,Ne=16,Te=w?(Me+1)*ke+Ne*2:36,Ae=()=>{y(!0),c?.(),setTimeout(()=>y(!1),600)};return e("div",{className:"fixed inset-0 z-50 modal-scrim backdrop-blur-xs flex items-center justify-center p-0 lg:p-5",onClick:l,role:"dialog","aria-modal":"true","aria-label":t.title,children:e("div",{className:`glass-overlay bg-paper border-ink/20 shadow-2xl flex flex-col overflow-hidden
|
|
4
|
-
w-full h-full rounded-none border-0
|
|
5
|
-
lg:w-[min(94vw,1200px)] lg:h-[88vh] lg:rounded-xl lg:border
|
|
6
|
-
pt-[env(safe-area-inset-top,0px)] lg:pt-0`,onClick:(U)=>U.stopPropagation(),children:[e(ct,{isGraphMode:w,onToggleMode:P,searchQuery:R,onSearchChange:C,onRefresh:Ae,onClose:l,isRefreshing:M,totalCommits:q.length,loadedCount:x.length,totalCount:T,hasMore:k}),e("div",{ref:oe,className:`flex-1 overflow-y-auto scrollbar-overlay-container relative select-text
|
|
7
|
-
px-3 lg:px-5
|
|
8
|
-
pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:q.length===0?e("div",{className:"flex flex-col items-center justify-center py-20 text-muted font-mono text-xs",children:R.trim()?"No matching commits found.":"No commits in this branch."}):e("div",{className:"relative min-h-full pb-8",children:[e(mt,{commits:q,nodePositions:fe,selectedHash:N,isGraphMode:w,laneWidth:ke,paddingLeft:Ne,totalHeight:$e}),e("div",{ref:ie,className:"flex flex-col relative z-20",style:{paddingLeft:`${Te}px`},children:[q.map((U)=>e(gt,{commit:U,isSelected:N===U.hash,onSelect:(V)=>G(V.hash),onAction:j,onToggleFile:Y,isExpandedFile:(V,ne)=>I.has(`${V}:${ne}`),isLoadingFile:(V,ne)=>E.has(`${V}:${ne}`),isFullContextFile:(V,ne)=>Q.has(`${V}:${ne}`),onToggleContext:z,fileDiffs:A,headerRef:(V)=>{ue.current[U.hash]=V}},U.hash)),e("div",{ref:ve,className:"pt-3 pb-4 px-4 flex items-center justify-center",children:L?e("div",{className:"flex items-center gap-2 text-xs text-muted font-mono py-2",children:[e(m,{size:14,className:"animate-spin text-info-text","aria-hidden":"true"}),e("span",{children:"Loading more commits..."})]}):k&&!R.trim()?e("button",{type:"button",onClick:H,className:"px-3 py-1.5 text-xs font-mono text-ink/70 hover:text-ink bg-ink/5 hover:bg-ink/10 rounded-md border border-ink/10 transition-colors cursor-pointer",children:"Load more commits..."}):q.length>10?e("div",{className:"text-[11px] font-mono text-muted py-2",children:["End of commit history (",typeof T==="number"&&T>0?T:x.length," commits)"]}):null})]})]})})]})})}function yt({children:t,onClose:l}){return e("div",{className:"fixed inset-0 z-50 modal-scrim flex items-center justify-center p-4",onClick:l,role:"dialog","aria-modal":"true",children:e("div",{className:"glass-overlay bg-paper border border-ink/20 rounded-lg shadow-xl flex flex-col overflow-hidden w-[min(94vw,420px)] max-h-[80vh]",onClick:(c)=>c.stopPropagation(),children:t})})}function kt({modal:t,onClose:l,onConfirm:c}){if(!t)return null;return e(yt,{onClose:l,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(_,{size:16,className:"text-error flex-shrink-0"}),e("h3",{className:"text-sm font-semibold text-ink",children:"Confirm Action"})]}),e("div",{className:"px-4 py-4 text-xs text-ink/80 leading-relaxed",children:t.message}),e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:l,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:c,className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:"Confirm"})]})]})}function Ct({isOpen:t,branchName:l,inputRef:c,onChange:r,onClose:p,onCreate:h}){if(!t)return null;let g=a(()=>{if(l.trim())h()},[l,h]);return e(yt,{onClose:p,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(Ln,{size:16,className:"text-ink/60 flex-shrink-0"}),e("h3",{className:"text-sm font-semibold text-ink",children:"Create New Branch"})]}),e("div",{className:"px-4 py-4",children:e("input",{ref:c,type:"text",value:l,onChange:(v)=>r(v.currentTarget.value),onKeyDown:(v)=>{if(v.key==="Enter")g();if(v.key==="Escape")p()},placeholder:"branch-name",className:"w-full bg-canvas border border-ink/20 rounded px-3 py-2 text-xs focus:outline-none focus:border-ink/40 text-ink placeholder-ink/40 transition-colors"})}),e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:p,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:g,disabled:!l.trim(),className:"px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:"Create"})]})]})}function Nt({branch:t,detached:l,onCheckout:c,onMerge:r,onRename:p,onDelete:h}){let g=t.current&&!l;return e("div",{className:"grid grid-cols-[1rem_minmax(0,1fr)_minmax(0,9.5rem)_4.25rem_4rem] items-start gap-x-2 px-4 py-2 border-b border-ink/5 last:border-b-0 hover:bg-ink/[0.02] group/row transition-colors",children:[e("div",{className:"h-5 flex items-center justify-center",children:g&&e(f,{size:12,className:"text-ink","aria-label":"Current branch"})}),e("button",{type:"button",onClick:c,disabled:g,title:g?"Already on this branch":`Check out ${t.name}`,className:"min-w-0 text-left cursor-pointer disabled:cursor-default",children:[e("div",{className:"h-5 flex items-center gap-1.5 min-w-0",children:[e(pe,{size:11,className:g?"text-ink/60 flex-shrink-0":"text-ink/40 flex-shrink-0"}),e("span",{className:`truncate text-xs ${g?"font-semibold text-ink":"text-ink/90"}`,children:t.name})]}),t.subject&&e("div",{className:"h-4 flex items-center pl-[18px] min-w-0",children:e("span",{className:"truncate text-[10px] text-ink/40",title:t.subject,children:t.subject})})]}),e("div",{className:"h-5 flex items-center justify-end min-w-0",children:e(Vt,{branch:t})}),e("div",{className:"h-5 flex items-center justify-end",children:t.date&&e("span",{className:"text-[10px] text-ink/40 truncate",children:t.date})}),e("div",{className:"h-5 flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/row:opacity-100",children:[!g&&e("button",{type:"button",onClick:r,title:`Merge ${t.name} into the current branch`,"aria-label":`Merge ${t.name} into the current branch`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Ln,{size:11})}),e("button",{type:"button",onClick:p,title:`Rename ${t.name}`,"aria-label":`Rename ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Mn,{size:11})}),!g&&e("button",{type:"button",onClick:h,title:`Delete ${t.name}`,"aria-label":`Delete ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(F,{size:11})})]})]})}function Vt({branch:t}){if(t.gone)return e("span",{className:"text-[10px] font-mono text-warning border border-warning/30 rounded px-1 truncate",title:`${t.upstream} no longer exists on the remote — fetch --prune to drop it`,children:"gone"});if(!t.upstream)return e("span",{className:"text-[10px] font-mono text-ink/40 truncate",title:"No upstream: this branch has never been published",children:"unpublished"});return e("span",{className:"flex items-center gap-1 text-[10px] font-mono text-ink/50 min-w-0",children:[e("span",{className:"truncate",title:t.upstream,children:t.upstream}),(t.ahead>0||t.behind>0)&&e("span",{className:"tabular-nums text-ink/70 flex-shrink-0",children:[t.ahead>0&&`↑${t.ahead}`,t.behind>0&&`↓${t.behind}`]})]})}function wt({branch:t,onClose:l,onSubmit:c}){if(!t)return null;return e(Yt,{branch:t,onClose:l,onSubmit:c})}function Yt({branch:t,onClose:l,onSubmit:c}){let[r,p]=n(t.name),[h,g]=n(!1),v=r.trim(),w=v===t.name,P=v.length>0&&!w,R=()=>{if(P)c(t.name,v,h)};return e(Z,{onClose:l,maxWidthClass:"max-w-[min(94vw,460px)]",header:e("div",{className:"flex items-center gap-2",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Rename branch"}),e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:t.name})]}),children:[e("div",{className:"px-5 py-4 flex flex-col gap-3",children:[e("div",{children:[e("label",{className:"text-[10px] uppercase tracking-wider text-ink/50 font-semibold",htmlFor:"branch-rename-input",children:"New name"}),e("input",{id:"branch-rename-input",type:"text",value:r,autoFocus:!0,onChange:(C)=>p(C.currentTarget.value),onKeyDown:(C)=>{if(C.key==="Enter")R();if(C.key==="Escape")l()},className:"mt-1 w-full bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs font-mono text-ink focus:outline-none focus:border-ink/40 transition-colors"}),w&&v.length>0&&e("p",{className:"mt-1 text-[10px] text-ink/50",children:"The name is unchanged."})]}),e("div",{className:"text-[10px] font-mono text-ink/60 flex flex-col gap-0.5 border border-ink/10 rounded p-2 bg-canvas/40",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"upstream"}),e("span",{className:"truncate",children:t.upstream||"none (unpublished)"})]}),e("p",{className:"text-ink/40 leading-relaxed mt-0.5",children:"A local rename keeps this upstream unchanged — a plain push afterwards will refuse until the upstream matches the new name, which is what the remote option below does."})]}),e("label",{className:"flex items-start gap-2 text-[11px] text-ink/80 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:h,onChange:(C)=>g(C.currentTarget.checked),className:`${he} accent-ink cursor-pointer mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{children:"Also rename it on the remote"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:["git push -u ",t.upstream?t.upstream.split("/")[0]:"origin"," ",v||"<new>",e("br",{}),"git push ",t.upstream?t.upstream.split("/")[0]:"origin"," --delete ",t.name,e("br",{}),"git fetch --prune"]})]})]})]}),e("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:l,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:R,disabled:!P,className:"px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:"Rename"})]})]})}function Rt({branch:t,force:l,onForceChange:c,onClose:r,onConfirm:p}){if(!t)return null;return e(Z,{onClose:r,maxWidthClass:"max-w-[min(94vw,440px)]",header:e("div",{className:"flex items-center gap-2",children:[e(_,{size:15,className:"text-error flex-shrink-0"}),e("h2",{className:"text-sm font-semibold text-ink",children:"Delete branch"})]}),children:[e("div",{className:"px-5 py-4 flex flex-col gap-3 text-xs text-ink/80 leading-relaxed",children:[e("p",{children:["Delete ",e("span",{className:"font-mono font-semibold text-ink",children:t.name}),t.upstream&&e(d,{children:[" ","(tracks ",e("span",{className:"font-mono",children:t.upstream}),")"]}),"?"]}),e("div",{className:"text-[10px] font-mono text-ink/60 border border-ink/10 rounded p-2 bg-canvas/40 flex flex-col gap-0.5",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"last commit"}),e("span",{className:"truncate",children:t.subject||"–"})]}),e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"when"}),e("span",{children:t.date||"–"})]})]}),e("label",{className:"flex items-start gap-2 cursor-pointer select-none text-[11px]",children:[e("input",{type:"checkbox",checked:l,onChange:(h)=>c(h.currentTarget.checked),className:`${he} accent-error cursor-pointer mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{className:"text-error font-medium",children:"Delete even if its commits are not merged"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:["git branch ",l?"-D":"-d"," ",t.name]}),e("span",{className:"text-ink/50",children:"Without this, git refuses when the branch holds commits no other branch has. Leaving it off is the safe default."})]})]})]}),e("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:r,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:()=>p(t.name),className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:["Delete ",l?"(force)":""]})]})]})}function Gt({isOpen:t,rootPath:l,repo:c,currentBranch:r,detached:p,isBusy:h,onClose:g,onAction:v,onConfirmDelete:w}){let[P,R]=n([]),[C,N]=n(!1),[G,M]=n(null),[y,x]=n(""),[k,T]=n(null),[L,H]=n(null),[A,I]=n(!1),E=a(async()=>{N(!0),M(null);let z=new URLSearchParams({branches:"1",repo:c||"."});if(l)z.set("root",l);try{let j=await fetch(`/api/fs/git?${z.toString()}`),q=await j.json();if(q.success&&Array.isArray(q.branches))R(q.branches);else M(q.error||`Failed to read branches (HTTP ${j.status})`)}catch(j){M(j instanceof Error?j.message:"Failed to read branches")}finally{N(!1)}},[l,c]);o(()=>{if(t)E()},[t,E]);let Q=i(!1);o(()=>{if(!t){Q.current=!1;return}if(Q.current&&!h)E();Q.current=h},[t,h,E]),o(()=>{if(!t)T(null),H(null),I(!1),x("")},[t]);let Y=u(()=>{let z=y.trim().toLowerCase();if(!z)return P;return P.filter((j)=>j.name.toLowerCase().includes(z)||j.upstream.toLowerCase().includes(z))},[P,y]);if(!t)return null;return e(d,{children:[e(Z,{onClose:g,maxWidthClass:"max-w-[min(96vw,720px)]",header:e("div",{className:"flex items-center gap-2 min-w-0",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Branches"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:p?`detached at ${r}`:`on ${r}`})]}),children:[e("div",{className:"px-5 py-3 flex items-center gap-2 border-b border-ink/10",children:[e(O,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:y,onChange:(z)=>x(z.currentTarget.value),placeholder:"Filter branches…","aria-label":"Filter branches",className:"flex-1 min-w-0 bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),e("button",{type:"button",onClick:()=>void E(),disabled:C,title:"Refresh","aria-label":"Refresh branches",className:"text-ink/40 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 flex-shrink-0",children:e(D,{size:12,className:C?"animate-spin":""})})]}),e("div",{className:"min-h-[40vh] max-h-[60vh] overflow-y-auto scrollbar-overlay-container",children:C&&P.length===0?e("div",{className:"flex items-center justify-center gap-2 py-12 text-xs text-ink/50 font-mono",children:[e(m,{size:14,className:"animate-spin text-info"}),"Loading branches…"]}):G?e("div",{className:"py-12 px-6 text-center text-xs text-error font-mono",children:G}):Y.length===0?e("div",{className:"py-12 text-center text-xs text-ink/40 font-mono",children:y.trim()?"No matching branches.":"No branches."}):Y.map((z)=>e(Nt,{branch:z,detached:p,onCheckout:()=>{v("checkout",{branch:z.name}),g()},onMerge:()=>{v("merge_branch",{branch:z.name}),g()},onRename:()=>T(z),onDelete:()=>{H(z),I(!1)}},z.name))})]}),e(wt,{branch:k,onClose:()=>T(null),onSubmit:(z,j,q)=>{v("rename_branch",{branch:z,newName:j,...q?{remote:"1"}:{}}),T(null)}},k?.name??"none"),e(Rt,{branch:L,force:A,onForceChange:I,onClose:()=>{H(null),I(!1)},onConfirm:(z)=>{w(z,A),H(null),I(!1)}})]})}function St({mounted:t,confirmModal:l,onCloseConfirm:c,onConfirm:r,branchPrompt:p,newBranchName:h,newBranchInputRef:g,onNewBranchNameChange:v,onCloseBranchPrompt:w,onCreateBranch:P,viewingOutput:R,onCloseOutput:C,onRefreshOutput:N,onExecuteAction:G,branchModalOpen:M,onCloseBranchModal:y,rootPath:x,activeRepo:k,currentBranch:T,detached:L,isBusy:H,onBranchAction:A,onConfirmDeleteBranch:I}){if(!t)return null;return e(d,{children:[e(kt,{modal:l,onClose:c,onConfirm:r}),e(Ct,{isOpen:p,branchName:h,inputRef:g,onChange:v,onClose:w,onCreate:P}),e(Ue,{output:R,onClose:C,onRefresh:N,onExecuteAction:G,rootPath:x,activeRepo:k}),e(Gt,{isOpen:M,rootPath:x,repo:k,currentBranch:T,detached:L,isBusy:H,onClose:y,onAction:A,onConfirmDelete:I})]})}function $t({rootPath:t,repo:l,isBusy:c,onAction:r}){let[p,h]=S("git.stashExpanded",!1),[g,v]=n([]),[w,P]=n(!1),[R,C]=n(""),[N,G]=n(!1),M=br(),y=a(async()=>{P(!0);let k=new URLSearchParams({stashes:"1",repo:l||"."});if(t)k.set("root",t);try{let L=await(await fetch(`/api/fs/git?${k.toString()}`)).json();v(L.stashes??[])}catch{v([])}finally{P(!1)}},[t,l]);o(()=>{if(p)y()},[p,y,c]);let x=(k,T)=>{if(r(k,T),k==="stash_push")C(""),G(!1)};return e("div",{className:"border-t border-ink/10 bg-canvas/30 flex-shrink-0",children:[e("div",{className:"flex items-center hover:bg-ink/5 transition-colors",children:[e("button",{type:"button",onClick:()=>h(!p),"aria-expanded":p,"aria-controls":M,title:p?"Hide stashes":"Show stashes",className:"flex flex-1 min-w-0 items-center space-x-1 py-1.5 pl-3 pr-2 text-left font-semibold text-xs text-ink transition-colors cursor-pointer",children:[e("span",{className:"w-3 text-center font-mono","aria-hidden":"true",children:p?"▾":"▸"}),e(nt,{size:12}),e("span",{children:"Stash"}),g.length>0&&e("span",{className:"font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] text-ink/50",children:g.length})]}),e("button",{type:"button",onClick:()=>x("stash_push",{...R.trim()?{message:R.trim()}:{},...N?{untracked:"1"}:{}}),disabled:c,title:"Stash the working tree",className:"mr-3 flex flex-shrink-0 items-center gap-1 px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/70 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:[e(W,{size:10}),"Save"]})]}),e("div",{className:"section-reveal","data-expanded":p,id:M,inert:!p,children:e("div",{children:e("div",{className:"px-3 pb-2 flex flex-col gap-1.5",children:[e("div",{className:"flex items-center gap-1.5",children:[e("input",{type:"text",value:R,onChange:(k)=>C(k.currentTarget.value),placeholder:"Stash message (optional)","aria-label":"Stash message",className:"flex-1 min-w-0 bg-paper border border-ink/20 rounded px-2 py-1 text-[11px] text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),e("label",{className:"flex items-center gap-1 text-[10px] text-ink/60 cursor-pointer select-none flex-shrink-0",title:"Also stash untracked files (-u)",children:[e("input",{type:"checkbox",checked:N,onChange:(k)=>G(k.currentTarget.checked),className:`${he} accent-ink cursor-pointer`}),"-u"]})]}),w&&g.length===0?e("div",{className:"text-[10px] text-ink/40 italic py-1",children:"Loading…"}):g.length===0?e("div",{className:"text-[10px] text-ink/40 italic py-1",children:"No stash entries."}):e("div",{className:"max-h-40 overflow-y-auto scrollbar-overlay-container flex flex-col",children:g.map((k)=>e("div",{className:"grid grid-cols-[4rem_minmax(0,1fr)_3.5rem_4.5rem] items-center gap-x-1 group/stash py-0.5",children:[e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:k.ref}),e("span",{className:"min-w-0 truncate text-[10px] text-ink/80",title:k.subject,children:k.subject}),e("span",{className:"text-[10px] text-ink/40 text-right truncate",children:k.date}),e("div",{className:"flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/stash:opacity-100",children:[e("button",{type:"button",onClick:()=>x("stash_apply",{ref:k.ref,pop:"1"}),disabled:c,title:"Pop: apply and remove the entry","aria-label":"Pop stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-40",children:e(ge,{size:10})}),e("button",{type:"button",onClick:()=>x("stash_apply",{ref:k.ref}),disabled:c,title:"Apply: keep the entry","aria-label":"Apply stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-40",children:e(nt,{size:10})}),e("button",{type:"button",onClick:()=>x("stash_drop",{ref:k.ref}),disabled:c,title:"Drop: discard the entry (the stash is not recoverable from the panel)","aria-label":"Drop stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors disabled:opacity-40",children:e(F,{size:10})})]})]},k.ref))})]})})})]})}function Pt({repo:t,isBusy:l,onInit:c}){let r=t==="."?"this folder":t;return e("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 text-center",children:[e(pe,{size:26,className:"text-ink/25","aria-hidden":!0}),e("div",{className:"font-mono space-y-1",children:[e("p",{className:"text-xs text-ink/70",children:"Not a Git repository"}),e("p",{className:"text-[11px] leading-4 text-ink/40",children:["Initialize one in ",r," to track changes, commit and manage branches."]})]}),e("button",{type:"button",onClick:c,disabled:l,"aria-label":"Initialize Git repository",title:`git init in ${r}`,className:"flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(pe,{size:12,"aria-hidden":!0}),"Initialize repository"]})]})}function Mt(t,l,c){let r=lt(),{pickedRepo:p,setActiveRepo:h,ready:g}=cr(t),{repos:v,scanning:w,rescan:P}=ur(t,l),R=Zf(p,v),C=i(R);C.current=R;let N=i("");N.current=`${t??""}\x00${R}`;let G=i(""),M=i(""),y=i(void 0);if(r.data!==y.current)y.current=r.data,M.current=G.current;let x=l&&g?Np(`${t??""}\x00${R}`):null,k=Ce(x),T=i(k.refresh);T.current=k.refresh;let L=M.current===N.current?r.data:void 0,H=k.data??L,A=H?.syncCount??L?.syncCount,I=a((Y)=>{if(!l)return;let z=Y??C.current,j=new URLSearchParams;if(t)j.set("root",t);if(z)j.set("repo",z);j.set("sync","1"),j.set("t",String(Date.now())),G.current=N.current;let q=T.current;r.load(`/api/fs/git?${j.toString()}`).then(()=>q())},[l,t,r.load]);o(()=>{if(!g)return;I()},[c,t,l,g,R,I]);let E=r.state==="loading",Q=E||k.refreshing;return{activeRepo:R,setActiveRepo:h,repos:v,reposScanning:w,refreshRepos:P,isReading:E,isRefreshing:Q,data:H,syncCount:A,loadRepo:I,refreshTopic:k.refresh}}function Tt(t,l){let c=lt(),r=i(null),p=a((h,g,v)=>{r.current={actionType:h,extra:v};let w=new FormData;if(w.append("actionType",h),w.append("repo",l),t)w.append("root",t);if(g)w.append("file",g);if(v)Object.entries(v).forEach(([P,R])=>w.append(P,R));c.submit(w,{method:"POST",action:"/api/fs/git"})},[l,t,c]);return{state:c.state,execute:p,data:c.data,lastAction:r.current}}function At({rootPath:t,repo:l,execute:c}){let{sessionId:r}=Rp(),[p,h]=S("git.commitDraft",""),[g,v]=S("git.amend",!1),[w,P]=n(!1),[R,C]=n(null),[N,G]=n(!1),M=i(!1),y=i(null),x=i(p);x.current=p;let k=i(g);k.current=g;let T=i(h);T.current=h;let L=a((Y)=>{h(Y),G(!1)},[h]),H=a(()=>{if(M.current)return;M.current=!0,P(!0),C(null);let Y={...t?{root:t}:{},repo:l,...r?{sessionId:r}:{},...k.current?{amend:!0}:{}};fetch("/api/fs/git-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Y)}).then(async(z)=>{let j=await z.json().catch(()=>null);if(!z.ok||typeof j?.message!=="string"||!j.message.trim())throw Error(typeof j?.error==="string"?j.error:`Request failed (HTTP ${z.status})`);let q=j.message.trim();if(x.current.trim().length===0)T.current(q),G(!0);else C(q)}).catch((z)=>{Vs(z instanceof Error?z.message:String(z),"error")}).finally(()=>{M.current=!1,P(!1)})},[t,l,r]),A=a(()=>{if(R===null)return;h(R),G(!0),C(null)},[R,h]),I=a(()=>C(null),[]);o(()=>{if(!g)return;if(x.current.trim().length>0)return;let Y=new URLSearchParams({headMessage:"1"});if(t)Y.set("root",t);if(l&&l!==".")Y.set("repo",l);let z=!1;return fetch(`/api/fs/git?${Y.toString()}`).then((j)=>j.json()).then((j)=>{if(z)return;if(!k.current||x.current.trim().length>0)return;let q=typeof j?.message==="string"?j.message:"";if(q.length===0)return;y.current=q,T.current(q)}).catch(()=>{}),()=>{z=!0}},[g,r,t,l]);let E=a((Y)=>{if(Y){v(!0);return}if(y.current!==null&&x.current===y.current)h("");y.current=null,v(!1)},[v,h]),Q=a(()=>{c("commit",void 0,{message:x.current,...k.current?{amend:"1"}:{}}),h(""),v(!1),y.current=null,C(null),G(!1)},[c,v,h]);return{message:p,setMessage:L,amend:g,seeded:y.current!==null&&p===y.current,toggleAmend:E,commit:Q,isGenerating:w,suggestion:R,generated:N,generate:H,useSuggestion:A,dismissSuggestion:I}}var Lt=48;function Xt(t,l){let c=l?.branch?.trim()??"",r=(l?.hash??"").slice(0,7),p=l?.ref?.trim()||"stash@{0}";switch(t){case"init":return{done:"Initialized the repository"};case"fetch":return{done:"Fetched every remote"};case"push":return{done:"Pushed to upstream"};case"pull":return{done:"Pulled from upstream",stopped:"Pulled"};case"sync":return{done:"Synced with upstream",stopped:"Pulled, but nothing was pushed"};case"abort_operation":return{done:"Aborted the operation in progress"};case"continue_operation":return{done:"Concluded the operation"};case"commit":{if(l?.amend==="1")return{done:"Amended the last commit"};let h=(l?.message??"").split(`
|
|
9
|
-
`)[0].trim();if(!h)return{done:"Commit created"};return{done:`Committed “${h.length>Lt?`${h.slice(0,Lt-1)}…`:h}”`}}case"checkout":return{done:c?`Switched to ${c}`:"Switched branch"};case"create_branch":case"create_branch_at":return{done:c?`Created branch ${c}`:"Created branch"};case"rename_branch":{let h=l?.newName?.trim()??"";return{done:c&&h?`Renamed ${c} to ${h}`:"Renamed branch"}}case"delete_branch":return{done:c?`Deleted branch ${c}`:"Deleted branch"};case"merge_branch":return{done:c?`Merged ${c}`:"Merged branch",stopped:c?`Merging ${c}`:"Merging the branch"};case"merge_commit":return{done:r?`Merged commit ${r}`:"Merged commit",stopped:r?`Merging ${r}`:"Merging the commit"};case"cherry_pick":return{done:r?`Cherry-picked ${r}`:"Cherry-picked commit",stopped:r?`Cherry-picking ${r}`:"Cherry-picking the commit"};case"revert_commit":return{done:r?`Reverted commit ${r}`:"Reverted commit",stopped:r?`Reverting ${r}`:"Reverting the commit"};case"rebase_commit":return{done:r?`Rebased onto ${r}`:"Rebased",stopped:r?`Rebasing onto ${r}`:"Rebasing"};case"reset_commit":{let h=l?.mode??"mixed";return{done:r?`Reset to ${r} (${h})`:`Reset (${h})`}}case"stash_push":return{done:"Stashed your changes"};case"stash_apply":return{done:l?.pop==="1"?`Popped ${p}`:`Applied ${p}`,stopped:l?.pop==="1"?`Popping ${p}`:`Applying ${p}`};case"stash_drop":return{done:`Dropped ${p}`};default:return null}}function Dt({actionType:t,extra:l,stopped:c}){let r=Xt(t,l);if(!c)return r?.done??null;let p=fo[c]??c,h=r?.stopped??r?.done??"",g=t==="sync"?"resolve it above, then Sync again":"resolve it above";return h?`${h} — the ${p} stopped on a conflict; ${g}`:`The ${p} stopped on a conflict; ${g}`}function Bt(t){let{fetcher:l,onPage:c,onReload:r,onSuccess:p,onError:h}=t,g=i(null),v=i({onPage:c,onReload:r,onSuccess:p,onError:h});v.current={onPage:c,onReload:r,onSuccess:p,onError:h},o(()=>{if(l.state!=="idle"||!l.data)return;let w=l.data;if(w===g.current)return;g.current=w;let P=v.current;if(w.type==="history"||w.type==="graph"){P.onPage({title:w.type==="graph"?"Git Graph":"Commit History",data:w.data||[],hasMore:w.hasMore,total:w.total});return}if(!w.success){P.onError(w.error||"Git operation failed");return}P.onReload();let R=l.lastAction,C=R?Dt({...R,stopped:w.stopped}):null;if(C)P.onSuccess(C,w.stopped?"warning":"success")},[l.state,l.data,l.lastAction])}function Ft(t,l,c,r){if(t==="revert")return{type:t,file:l,message:`Are you sure you want to discard changes in ${l}?`};if(t==="revert_all")return{type:t,message:"Are you sure you want to discard ALL unstaged changes? This cannot be undone."};if(t==="abort_operation"){let p=r?fo[r]:"operation";return{type:t,message:`Abort the ${p}? Everything resolved so far is discarded and the working tree returns to its pre-${p} state.`}}if(t==="delete_branch"){let p=c?.branch??"",h=c?.force==="1";return{type:t,extra:{branch:p,...h?{force:"1"}:{}},message:h?`Delete branch ${p} even though its commits are not merged? This cannot be undone from the panel.`:`Delete branch ${p}?`}}if(t==="stash_drop"){let p=c?.ref||"the top entry";return{type:t,extra:{ref:c?.ref??""},message:`Drop ${p}? The stash entry is removed — this cannot be undone from the panel.`}}return null}function wr({className:t="",enabled:l=!0,rootPath:c,refreshKey:r=0}){let{activeRepo:p,setActiveRepo:h,repos:g,reposScanning:v,refreshRepos:w,isReading:P,isRefreshing:R,data:C,syncCount:N,loadRepo:G,refreshTopic:M}=Mt(c,l,r),y=Tt(c,p),[x,k]=S("git.viewMode","flat"),[T,L]=n(!1),H=i(null),[A,I]=n(!1),E=i(null),[Q,Y]=n(null),[z,j]=n(!1),[q,oe]=n(""),ie=i(null),[ve,ue]=n(!1),[fe,ye]=n(null),[$e,Pe]=n(!1),{pushToast:ae}=je();o(()=>{Pe(!0)},[]),o(()=>{if(z&&ie.current)ie.current.focus()},[z]),Bt({fetcher:y,onPage:ye,onReload:G,onSuccess:(X,te)=>ae(X,te),onError:(X)=>ae(X,"error")}),me(H,()=>L(!1)),me(E,()=>I(!1));let ee=y.execute,{message:Me,setMessage:ke,amend:Ne,seeded:Te,toggleAmend:Ae,commit:U,isGenerating:V,suggestion:ne,generated:Le,generate:xe,useSuggestion:De,dismissSuggestion:we}=At({rootPath:c,repo:p,execute:ee}),de=(X,te,Re)=>{let Ke=Ft(X,te,Re,C?.state?.operation??null);if(Ke){Y(Ke);return}ee(X,te,Re)},Et=(X,te)=>{ee("resolve_conflict",X,te?{side:te}:void 0)},We=C?.branch||"main",zt=C?.branches||["main"],Ht=C?.remoteBranches||[],qe=C?.changes||[],le=P||y.state!=="idle",Be=y.state==="idle"?null:y.lastAction?.actionType??null,Ot=Be==="sync"||Be==="push"||Be==="pull",It=qe.filter((X)=>{if(yr(X.status))return!1;let te=X.status;return te&&te[0]!==" "&&te[0]!=="?"});if(!l)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${t}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e("div",{className:`flex flex-col h-full bg-paper relative ${t}`,children:[e(St,{mounted:$e,confirmModal:Q,onCloseConfirm:()=>Y(null),onConfirm:()=>{if(Q)ee(Q.type,Q.file,Q.extra),Y(null)},branchPrompt:z,newBranchName:q,newBranchInputRef:ie,onNewBranchNameChange:oe,onCloseBranchPrompt:()=>{j(!1),oe("")},onCreateBranch:()=>{if(q.trim())ee("create_branch",void 0,{branch:q.trim()}),j(!1),oe("")},viewingOutput:fe,onCloseOutput:()=>ye(null),onRefreshOutput:()=>{if(fe)ee(fe.title.toLowerCase().includes("graph")?"graph":"history")},onExecuteAction:(X,te,Re)=>ee(X,te,Re),branchModalOpen:ve,onCloseBranchModal:()=>ue(!1),rootPath:c,activeRepo:p,currentBranch:We,detached:C?.state?.detached??!1,isBusy:le,onBranchAction:(X,te)=>ee(X,void 0,te),onConfirmDeleteBranch:(X,te)=>{ee("delete_branch",void 0,{branch:X,...te?{force:"1"}:{}})}}),e(Je,{activeRepo:p,repos:g,isRefreshing:R,rootPath:c,reposScanning:v,onSelectRepo:(X)=>{if(X!==p)h(X)},onRefresh:()=>{M(),G()},onRefreshRepos:w}),C?.isRepo===!1?e(Pt,{repo:p,isBusy:le,onInit:()=>ee("init")}):e(d,{children:[e(Qe,{branchRef:E,showBranchMenu:A,setShowBranchMenu:I,branch:We,branches:zt,remoteBranches:Ht,onCheckout:(X)=>ee("checkout",void 0,{branch:X}),onMerge:(X)=>ee("merge_branch",void 0,{branch:X}),onOpenBranchPrompt:()=>j(!0),onManageBranches:()=>{ue(!0),I(!1)},optionsRef:H,showOptions:T,setShowOptions:L,onHistory:()=>ee("history"),onGraph:()=>ee("graph"),viewMode:x,setViewMode:k,isBusy:le,syncCount:N,syncing:Ot,onSync:()=>ee("sync"),onFetch:()=>ee("fetch"),detached:C?.state?.detached??!1}),C?.state?.operation?e(Ze,{operation:C.state.operation,conflicts:C.state.conflicts,isBusy:le,onAbort:()=>de("abort_operation"),onContinue:()=>ee("continue_operation")}):e(Xe,{message:Me,hasStagedChanges:It.length>0,isBusy:le,amend:Ne,seeded:Te,isGenerating:V,suggestion:ne,generated:Le,onToggleAmend:Ae,onChangeMessage:ke,onCommit:U,onGenerate:xe,onUseSuggestion:De,onDismissSuggestion:we}),e(it,{changes:qe,isLoading:le,viewMode:x,repo:p,rootPath:c,onAction:de,onResolve:Et}),e($t,{rootPath:c,repo:p,isBusy:le,onAction:(X,te)=>de(X,void 0,te)})]})]})}export{wr as GitPanel};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n,o,s,j,Xr,uc,ag,og,zA,lm}from"./index-f77c3ag0.js";var p={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]},pt=s(p);var xd="omp:editor-theme-changed";function a(){if(typeof window>"u")return uc;return j("editorTheme")??uc}var m={theme:null,vars:{},themes:og(null)};function Ai(){let[e,t]=n(a);if(o(()=>{let i=(d)=>{let E=d.detail;t(E||a())};return window.addEventListener(xd,i),()=>window.removeEventListener(xd,i)},[]),o(()=>{lm(e)},[e]),e===Xr)return m;let r=ag(e);return{theme:r,vars:zA(r),themes:og(e)}}var wd="omp:editor-indent-changed",Cd=[2,4,8],ru={width:2,insertSpaces:!0};function Ed(){if(typeof window>"u")return ru;let e=j("editorIndentWidth"),t=j("editorInsertSpaces");return{width:typeof e==="number"&&Cd.includes(e)?e:ru.width,insertSpaces:typeof t==="boolean"?t:ru.insertSpaces}}function au(e){return e.insertSpaces?" ".repeat(e.width):"\t"}function ou(){let[e,t]=n(Ed);return o(()=>{let r=(i)=>{let d=i.detail;t(d??Ed())};return window.addEventListener(wd,r),()=>window.removeEventListener(wd,r)},[]),e}var Bd="omp:editor-typing-changed",vl={autoCloseBrackets:!0,autocomplete:!0};function iu(){if(typeof window>"u")return vl;let e=j("editorAutoCloseBrackets"),t=j("editorAutocomplete");return{autoCloseBrackets:typeof e==="boolean"?e:vl.autoCloseBrackets,autocomplete:typeof t==="boolean"?t:vl.autocomplete}}function su(){let[e,t]=n(iu);return o(()=>{let r=(i)=>{let d=i.detail;t(d??iu())};return window.addEventListener(Bd,r),()=>window.removeEventListener(Bd,r)},[]),e}var As="omp:editor-blame-changed",kl={enabled:!0,inline:!1};function hi(){if(typeof window>"u")return kl;let e=j("editorBlame"),t=j("editorBlameInline");return{enabled:typeof e==="boolean"?e:kl.enabled,inline:typeof t==="boolean"?t:kl.inline}}function Id(){let[e,t]=n(hi);return o(()=>{let r=(i)=>{let d=i.detail;t(d??hi())};return window.addEventListener(As,r),()=>window.removeEventListener(As,r)},[]),e}
|
|
2
|
-
export{pt,xd,Ai,wd,Cd,ru,Ed,au,ou,Bd,vl,iu,su,As,kl,hi,Id};
|