@kabmo-labs/kabmo 0.38.2 → 0.39.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 +565 -537
- package/dist/client/static/js/{CsvGrid-4dpsfdrf.js → CsvGrid-kfcp4sd6.js} +2 -2
- package/dist/client/static/js/{DocxView-crdgc0jd.js → DocxView-atff5w38.js} +4 -4
- package/dist/client/static/js/DrawioView-yfnq4c99.js +5 -0
- package/dist/client/static/js/ImageView-nreh25s0.js +1 -0
- package/dist/client/static/js/LayoutWrapper-0x1q1q5z.js +2 -0
- package/dist/client/static/js/Modal-2xqd3sss.js +38 -0
- package/dist/client/static/js/{PdfView-72c123a9.js → PdfView-mk8paxt1.js} +1 -1
- package/dist/client/static/js/SessionsView-ner25qxn.js +1 -0
- package/dist/client/static/js/{SheetView-8xh69wgk.js → SheetView-s6n3fawm.js} +31 -31
- package/dist/client/static/js/{SvgPreview-z3fm87h6.js → SvgPreview-8bxvz3ez.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-25r2p3vh.js → abnfDiagram-O67JEVCF-tvvz9fha.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-y0zb4vqa.js +1 -0
- package/dist/client/static/js/architectureDiagram-NJMV4G6O-bybv3wg4.js +36 -0
- package/dist/client/static/js/{astro-p3f5p9p2.js → astro-4ybhkc9b.js} +1 -1
- package/dist/client/static/js/bash-k6p3y3pr.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-vzamgz9s.js → blockDiagram-BEXU5L5S-h3fs79x6.js} +8 -8
- package/dist/client/static/js/c-ve09y19q.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-jejafgn0.js → c4Diagram-YGBWAQC7-h8p3h54v.js} +5 -5
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-qfa6mj0q.js → classDiagram-v2-NBCMYWYE-q645r4q6.js} +6 -6
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-9vzdgmk1.js → cose-bilkent-JH36ORCC-p4mm1zcv.js} +1 -1
- package/dist/client/static/js/cpp-vhqp7bcy.js +1 -0
- package/dist/client/static/js/css-77mvf0ca.js +1 -0
- package/dist/client/static/js/css-tys2rrny.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-nt1ed192.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-a3k3w1t5.js → cynefinDiagram-VND7K2PF-v2hbc3aq.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-gf04dvxj.js → dagre-6A5THRUB-4edpda33.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-a9e0a684.js → diagram-22UHCM2B-b6gp813w.js} +19 -19
- package/dist/client/static/js/{diagram-3UASUU5V-fb73gfjd.js → diagram-3UASUU5V-s1f3b0ng.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-yb9n3t30.js → diagram-ATOU4E4O-ga06kjp5.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-adhbhw28.js → diagram-CDSNMT55-wdbmv4td.js} +5 -5
- package/dist/client/static/js/{diagram-MLGK6HIB-v4yxyb8r.js → diagram-MLGK6HIB-fkntefcq.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-94ttsqy2.js → diagram-MPIPVDR6-k2zh7edp.js} +3 -3
- package/dist/client/static/js/{dockerfile-mrranatf.js → dockerfile-srcym0bs.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-jj4f3pyq.js → ebnfDiagram-ZINNZB2B-4vc4vz9c.js} +1 -1
- package/dist/client/static/js/{elixir-jwphgp8j.js → elixir-v9bbxsgg.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-mtnkhyte.js → elk-276RUBZZ-g2ppf1by.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-18qdkhm5.js → erDiagram-OPXOYQCR-rmnwkb5q.js} +9 -9
- package/dist/client/static/js/{erlang-6m6tpt72.js → erlang-55r0skxa.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-v4edaxx7.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-jvrvhb9d.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-vz28h061.js → ganttDiagram-FUAMR5RP-ptfvae64.js} +5 -5
- package/dist/client/static/js/gitGraph-4MIJSDKK-adzhec96.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-cgq3r4rz.js → gitGraphDiagram-X574FWY7-ne9n3cyf.js} +14 -14
- package/dist/client/static/js/graphql-g97hycb3.js +1 -0
- package/dist/client/static/js/html-2syect3n.js +1 -0
- package/dist/client/static/js/{index-3az1w5f8.js → index-0j518hqm.js} +2 -2
- package/dist/client/static/js/index-1jeyjqkh.js +2 -0
- package/dist/client/static/js/{index-t5t71dhp.js → index-1sgad84m.js} +2 -2
- package/dist/client/static/js/{index-z72wf7q4.js → index-270y5r9k.js} +2 -2
- package/dist/client/static/js/{index-sa9cp6km.js → index-2rs03vfy.js} +2 -2
- package/dist/client/static/js/index-3fw3sd10.js +474 -0
- package/dist/client/static/js/{index-xya34x4v.js → index-442mbhwb.js} +2 -2
- package/dist/client/static/js/{index-95t1hwr8.js → index-4pehdq5h.js} +2 -2
- package/dist/client/static/js/{index-dt7e1328.js → index-4wtr5wjp.js} +2 -2
- package/dist/client/static/js/{index-gr6jng0x.js → index-4wvtar0v.js} +2 -2
- package/dist/client/static/js/{index-zdbvm01f.js → index-56w8m083.js} +2 -2
- package/dist/client/static/js/index-5a4w58r2.js +1 -0
- package/dist/client/static/js/{index-4hsxaa87.js → index-5kvvb0zm.js} +2 -2
- package/dist/client/static/js/{index-5v9v41ap.js → index-61qjr1k0.js} +98 -98
- package/dist/client/static/js/{index-6k3e5dph.js → index-72289dgx.js} +2 -2
- package/dist/client/static/js/{index-gbdvr4rt.js → index-7h5n5rz4.js} +2 -2
- package/dist/client/static/js/{index-y5y7smet.js → index-7z63xr1s.js} +1 -1
- package/dist/client/static/js/index-878d61js.js +1 -0
- package/dist/client/static/js/{index-fghst0kd.js → index-8egjccbq.js} +34 -34
- package/dist/client/static/js/index-8qgwj6m8.js +1 -0
- package/dist/client/static/js/{index-kf9t3mzv.js → index-8w2tx2k9.js} +2 -2
- package/dist/client/static/js/{index-x07kp3jz.js → index-9d6x1f3t.js} +2 -2
- package/dist/client/static/js/{index-vb6t44dw.js → index-9gepbvdt.js} +2 -2
- package/dist/client/static/js/index-a7qccdq2.js +1 -0
- package/dist/client/static/js/{index-7fdp9c7m.js → index-b08hx4tw.js} +2 -2
- package/dist/client/static/js/{index-nd4p98mc.js → index-c1be3rva.js} +2 -2
- package/dist/client/static/js/{index-3zc1b0dv.js → index-c36pag9y.js} +2 -2
- package/dist/client/static/js/{index-qkscve6n.js → index-cfnxda13.js} +2 -2
- package/dist/client/static/js/index-cst843zs.css +1 -0
- package/dist/client/static/js/{index-6j9h1fa7.js → index-dmd26a1y.js} +1 -1
- package/dist/client/static/js/{index-1y9r4frb.js → index-drjtwfp5.js} +2 -2
- package/dist/client/static/js/index-dt22v9ns.js +2 -0
- package/dist/client/static/js/{index-h7pn9qw6.js → index-enmh3w27.js} +2 -2
- package/dist/client/static/js/{index-ray2czf6.js → index-fjnkzk12.js} +4 -4
- package/dist/client/static/js/index-gvkc9e32.js +1 -0
- package/dist/client/static/js/{index-d146s9g3.js → index-hh05xd1d.js} +2 -2
- package/dist/client/static/js/{index-qxb8k6py.js → index-jkph8wqq.js} +3 -3
- package/dist/client/static/js/index-k3c3n69j.js +12 -0
- package/dist/client/static/js/{index-dr7nhha9.js → index-k5a6r25s.js} +2 -2
- package/dist/client/static/js/{index-we2ezmn7.js → index-k61tdd4a.js} +2 -2
- package/dist/client/static/js/{index-8acv5b77.js → index-k7sdsmgv.js} +2 -2
- package/dist/client/static/js/{index-s16h2nmv.js → index-m3r0j562.js} +6 -6
- package/dist/client/static/js/{index-njqpkcvw.js → index-mdxnhndy.js} +2 -2
- package/dist/client/static/js/index-me7m3516.js +9 -0
- package/dist/client/static/js/index-mmsszqvn.js +1 -0
- package/dist/client/static/js/index-ntx3bbmb.js +1 -0
- package/dist/client/static/js/index-p89z1qmj.js +1 -0
- package/dist/client/static/js/{index-fqhpxzyb.js → index-pr7gk5eq.js} +13 -13
- package/dist/client/static/js/index-pzqsp5jw.js +4 -0
- package/dist/client/static/js/{index-qn4pkjfh.js → index-q0bph5x0.js} +2 -2
- package/dist/client/static/js/{index-gbfg0anm.js → index-qsrw5c67.js} +2 -2
- package/dist/client/static/js/{index-ashpbfqv.js → index-rj81xrvw.js} +2 -2
- package/dist/client/static/js/{index-b9b2nwdd.js → index-t6gznaxm.js} +2 -2
- package/dist/client/static/js/{index-12p63902.js → index-v8vjh5jj.js} +2 -2
- package/dist/client/static/js/{index-naz3px72.js → index-xdqsqhnn.js} +9 -9
- package/dist/client/static/js/{index-9wd9y6m0.js → index-xrp2zv8z.js} +2 -2
- package/dist/client/static/js/{index-ajtd1q1h.js → index-y2prm0xm.js} +2 -2
- package/dist/client/static/js/{index-y3hdv561.js → index-y3qxrs90.js} +2 -2
- package/dist/client/static/js/index-ymp2wqtc.js +3 -0
- package/dist/client/static/js/index-ywpdhntc.js +1 -0
- package/dist/client/static/js/info-A6RAGUB7-2ye26vqn.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-jjwckbr9.js → infoDiagram-VRGFBTTK-ctfwcm3n.js} +2 -2
- package/dist/client/static/js/ini-7ffv28px.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-qzk5gejf.js → ishikawaDiagram-OU5B5YK6-b0b0pn4y.js} +3 -3
- package/dist/client/static/js/java-4x5yky4a.js +1 -0
- package/dist/client/static/js/javascript-4kw2j9t3.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-maccpg3q.js → journeyDiagram-ZHPQQLJL-kdq12drs.js} +5 -5
- package/dist/client/static/js/json-h3kwpty2.js +1 -0
- package/dist/client/static/js/jsx-jk20f0dr.js +1 -0
- package/dist/client/static/js/{julia-237yk557.js → julia-jhe2vd4f.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-xv2azgws.js → kanban-definition-PNTS6WVX-65x6xn2q.js} +6 -6
- package/dist/client/static/js/lua-k02dpxq8.js +1 -0
- package/dist/client/static/js/markdown-fhhg7ms6.js +1 -0
- package/dist/client/static/js/{mermaid.core-e4ys760s.js → mermaid.core-0fq63jpa.js} +8 -8
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-b779wz81.js → mindmap-definition-NLK3R4M7-p86myex3.js} +6 -6
- package/dist/client/static/js/one-dark-pro-c4q810z4.js +1 -0
- package/dist/client/static/js/one-light-czk9dzya.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-b0j3te0q.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-8sgdmhnw.js → pegDiagram-GJSIUBJH-p2hkk9xb.js} +1 -1
- package/dist/client/static/js/{perl-dvz4y1tb.js → perl-qhj6tk7k.js} +1 -1
- package/dist/client/static/js/{php-n6y7dzhm.js → php-arycc4w7.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-28qq62fn.js +1 -0
- package/dist/client/static/js/pieDiagram-5QR66LMP-bza19wkx.js +39 -0
- package/dist/client/static/js/properties-qhvcxc13.js +1 -0
- package/dist/client/static/js/python-3qsrs510.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-47dpygk5.js → quadrantDiagram-O4NWA36T-bxqec9w1.js} +6 -6
- package/dist/client/static/js/r-z2ng7mza.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-fyrcbpyd.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-9s62qncd.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-f7yjmhrk.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-sfrw8gkz.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-4mm4cern.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-wv0bvwve.js → railroadDiagram-XR7U4H2S-1g3hx3sm.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-w3r8r837.js → requirementDiagram-PLB6GJNP-qbjjm48v.js} +13 -13
- package/dist/client/static/js/{ruby-7zye3g0e.js → ruby-fb6zzevm.js} +1 -1
- package/dist/client/static/js/{rust-42c4h7e4.js → rust-jatm47v6.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-t55rjgad.js → sankeyDiagram-IPEJSGJF-t2ythbh7.js} +6 -6
- package/dist/client/static/js/{sass-m0h9yzfb.js → sass-fzs6a0kr.js} +1 -1
- package/dist/client/static/js/{scss-2pwwfkvn.js → scss-gdb52d0c.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-yfwjwy37.js → sequenceDiagram-PO4LG4MO-mqsfek2j.js} +21 -21
- package/dist/client/static/js/{sizeCapture-INFHLROL-nq6hy7ce.js → sizeCapture-INFHLROL-xj67pgds.js} +1 -1
- package/dist/client/static/js/sql-ypk53ntb.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-4xy0atqh.js → stateDiagram-v2-GCMORJYK-gj4fezak.js} +3 -3
- package/dist/client/static/js/{svelte-x8f8c8hq.js → svelte-8s3k6qjd.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-np47cy1q.js → swimlanes-2SLR337P-pgtdd1pk.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-zk37paj9.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-rb0gnm35.js → timeline-definition-EJHVYXUP-q013vdd1.js} +7 -7
- package/dist/client/static/js/treeView-Q6P3EWNA-a5vgg4gz.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-ctqhajgg.js +1 -0
- package/dist/client/static/js/tsx-zy7hb2hw.js +1 -0
- package/dist/client/static/js/typescript-2hr53c8j.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-gatkznan.js → usecaseDiagram-POWQR4AR-7swsbqnq.js} +51 -51
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-r3f5xjjq.js → vennDiagram-UO4OBE2U-9dygxdxf.js} +5 -5
- package/dist/client/static/js/{vue-myjjd0gd.js → vue-k3f3chre.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-ns7e0fqf.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-tpass65t.js → wardleyDiagram-VNRHLVJA-aaaa9kj3.js} +4 -4
- package/dist/client/static/js/xml-p4742r9b.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-8xkh67cw.js → xychartDiagram-PMCCYNJV-tamf39gx.js} +6 -6
- package/dist/client/static/js/yaml-qbckg671.js +1 -0
- package/marketplace/plugins/command-runner/README.md +5 -0
- package/marketplace/plugins/command-runner/package.json +2 -2
- package/marketplace/plugins/command-runner/src/panel/Output.test.tsx +177 -0
- package/marketplace/plugins/command-runner/src/panel/Output.tsx +53 -2
- package/package.json +3 -1
- package/public/tray-monochrome-dark.png +0 -0
- package/public/tray-monochrome-light.png +0 -0
- package/src/client/App.tsx +4 -0
- package/src/client/components/common/NotificationPermissionDialog.test.tsx +166 -0
- package/src/client/components/common/NotificationPermissionDialog.tsx +167 -0
- package/src/client/components/common/batch-selection/BatchDeleteModal.test.tsx +97 -0
- package/src/client/components/common/batch-selection/BatchDeleteModal.tsx +24 -1
- package/src/client/components/common/context-usage-button/SessionStats.tsx +4 -8
- package/src/client/components/common/context-usage-button/TokenTotals.tsx +51 -0
- package/src/client/components/common/context-usage-button/index.test.tsx +26 -3
- package/src/client/components/common/context-usage-button/index.tsx +2 -0
- package/src/client/components/common/diagram-viewer/index.tsx +11 -235
- package/src/client/components/common/fullscreen-viewer/fullscreen-viewer.test.tsx +108 -0
- package/src/client/components/common/fullscreen-viewer/index.tsx +326 -0
- package/src/client/components/common/header-button/index.test.tsx +97 -0
- package/src/client/components/common/header-button/index.tsx +67 -0
- package/src/client/components/common/header-controls/index.test.tsx +17 -1
- package/src/client/components/common/header-controls/index.tsx +18 -8
- package/src/client/components/common/image-viewer/fullscreen.tsx +64 -0
- package/src/client/components/common/progress-bar/index.tsx +53 -0
- package/src/client/components/common/session-actions-menu/MenuItem.tsx +36 -0
- package/src/client/components/common/session-actions-menu/index.test.tsx +79 -0
- package/src/client/components/common/session-actions-menu/index.tsx +62 -69
- package/src/client/components/common/session-delete-modal/index.tsx +5 -0
- package/src/client/components/common/session-row/TimeCell.tsx +22 -6
- package/src/client/components/common/session-row/TrailingSlot.tsx +3 -3
- package/src/client/components/common/session-row/index.tsx +6 -3
- package/src/client/components/common/session-row/row-state.ts +18 -0
- package/src/client/components/common/session-row/session-row.test.tsx +24 -0
- package/src/client/components/common/session-row/time-cell.test.tsx +110 -0
- package/src/client/components/layout/ActivityBar.test.ts +10 -116
- package/src/client/components/layout/ActivityBar.tsx +138 -134
- package/src/client/components/layout/ActivityBarDrag.test.ts +334 -0
- package/src/client/components/layout/LeftActivityBar.test.ts +30 -5
- package/src/client/components/layout/LeftDock.tsx +19 -1
- package/src/client/components/layout/PanelButton.tsx +93 -0
- package/src/client/components/layout/{PanelVisibilityMenu.tsx → VisibilityMenu.tsx} +37 -18
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +30 -1
- package/src/client/components/layout/desktop-layout/PanelSuspense.tsx +30 -0
- package/src/client/components/layout/desktop-layout/ResizeHandle.tsx +24 -3
- package/src/client/components/layout/desktop-layout/TopNavbar.tsx +62 -6
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +28 -19
- package/src/client/components/layout/desktop-layout/index.tsx +7 -5
- package/src/client/components/layout/desktop-layout/resizer/index.tsx +17 -4
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +4 -2
- package/src/client/components/layout/session-sidebar/Footer.test.tsx +76 -0
- package/src/client/components/layout/session-sidebar/Footer.tsx +13 -9
- package/src/client/components/layout/session-sidebar/SessionItem.batch.test.ts +3 -0
- package/src/client/components/layout/session-sidebar/SessionItem.test.ts +21 -0
- package/src/client/components/layout/session-sidebar/SessionItem.tsx +7 -4
- package/src/client/components/layout/session-sidebar/SessionList.tsx +1 -1
- package/src/client/components/layout/session-sidebar/SessionsView.tsx +1 -0
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +3 -1
- package/src/client/components/layout/session-sidebar/modern/index.tsx +1 -1
- package/src/client/components/layout/session-sidebar/search-results.test.tsx +127 -0
- package/src/client/components/mobile/mobile-session-sidebar/Dialogs.tsx +1 -0
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.test.ts +31 -0
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.tsx +8 -4
- package/src/client/components/mobile/mobile-session-sidebar/use-dock.test.ts +41 -0
- package/src/client/components/mobile/mobile-session-sidebar/use-dock.ts +4 -1
- package/src/client/components/mobile/mobile-session-sidebar/use-drawer.ts +2 -0
- package/src/client/components/mobile/panel-chips.test.tsx +18 -11
- package/src/client/components/settings/categories/AppearanceSettings.tsx +3 -0
- package/src/client/components/settings/categories/HarnessSettings.tsx +3 -1
- package/src/client/components/settings/categories/NotificationSettings.test.tsx +56 -2
- package/src/client/components/settings/categories/NotificationSettings.tsx +46 -6
- package/src/client/components/settings/categories/appearance-settings/TrayIconSection.test.tsx +81 -0
- package/src/client/components/settings/categories/appearance-settings/TrayIconSection.tsx +118 -0
- package/src/client/components/settings/categories/harness-settings/HarnessCard.import.test.tsx +124 -0
- package/src/client/components/settings/categories/harness-settings/HarnessCard.tsx +21 -2
- package/src/client/components/settings/categories/harness-settings/HarnessImportControls.tsx +143 -0
- package/src/client/components/settings/categories/notification-settings/PermissionNotice.tsx +50 -0
- package/src/client/components/settings/categories/panel-plugins/GitFreshness.test.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/LeftDockSettings.test.tsx +107 -0
- package/src/client/components/settings/categories/panel-plugins/LeftDockSettings.tsx +49 -24
- package/src/client/components/settings/categories/panel-plugins/Placement.test.tsx +3 -0
- package/src/client/components/settings/categories/panel-plugins/PluginCard.test.tsx +4 -0
- package/src/client/components/settings/categories/panel-plugins/Section.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/Toolbar.tsx +6 -10
- package/src/client/components/settings/categories/plugin-settings/DetailPane.tsx +45 -38
- package/src/client/components/settings/categories/plugin-settings/MarketplacePane.tsx +20 -18
- package/src/client/components/settings/categories/plugin-settings/PaneHeader.tsx +40 -0
- package/src/client/components/settings/categories/plugin-settings/SidebarList.tsx +6 -9
- package/src/client/components/settings/categories/usage-settings/usage-icons.test.tsx +1 -25
- package/src/client/components/workspace/chat-timeline/GeneratingIndicator.test.ts +9 -1
- package/src/client/components/workspace/chat-timeline/MessageItem.gutter.test.ts +4 -0
- package/src/client/components/workspace/chat-timeline/chat-input/expansion.test.ts +22 -2
- package/src/client/components/workspace/chat-timeline/chat-input/expansion.ts +15 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/wait-parts.tsx +6 -11
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolScreenshots.test.tsx +9 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolScreenshots.tsx +9 -18
- package/src/client/components/workspace/context-panel/index.tsx +18 -19
- package/src/client/components/workspace/editor/SplitColumn.tsx +5 -1
- package/src/client/components/workspace/file-explorer/Toolbar.tsx +40 -28
- package/src/client/components/workspace/git-panel/RepoHeader.tsx +27 -25
- package/src/client/components/workspace/git-panel/commit-modal/CommitActions.tsx +28 -77
- package/src/client/components/workspace/git-panel/commit-modal/CommitDiffViewer.tsx +15 -15
- package/src/client/components/workspace/git-panel/commit-modal/CommitRow.test.ts +79 -5
- package/src/client/components/workspace/git-panel/commit-modal/CommitRow.tsx +66 -45
- package/src/client/components/workspace/git-panel/commit-modal/GraphCanvas.tsx +1 -7
- package/src/client/components/workspace/git-panel/commit-modal/Header.test.tsx +90 -0
- package/src/client/components/workspace/git-panel/commit-modal/Header.tsx +28 -18
- package/src/client/components/workspace/git-panel/commit-modal/index.tsx +24 -7
- package/src/client/components/workspace/git-panel/commit-modal.test.ts +16 -0
- package/src/client/components/workspace/panel-header/index.test.tsx +80 -0
- package/src/client/components/workspace/panel-header/index.tsx +46 -0
- package/src/client/components/workspace/plan-panel/index.tsx +24 -22
- package/src/client/components/workspace/plugin-panel/catalog.tsx +21 -13
- package/src/client/components/workspace/search-panel/Body.tsx +42 -37
- package/src/client/components/workspace/terminal-panel/Header.tsx +37 -38
- package/src/client/components/workspace/terminal-panel/fonts.test.ts +40 -0
- package/src/client/components/workspace/terminal-panel/fonts.ts +27 -0
- package/src/client/components/workspace/terminal-panel/mount.ts +2 -5
- package/src/client/components/workspace/todo-panel/index.tsx +28 -26
- package/src/client/components/workspace/usage-panel/index.test.tsx +91 -0
- package/src/client/components/workspace/usage-panel/index.tsx +31 -55
- package/src/client/components/workspace/wiki-panel/index.tsx +47 -46
- package/src/client/data/context-data/index.ts +16 -0
- package/src/client/data/settings/omp-schema.json +201 -151
- package/src/client/hooks/chat/composer/auto-grow.ts +13 -3
- package/src/client/hooks/chat/omp/session-sidebar-controller.folder-open.test.ts +140 -0
- package/src/client/hooks/chat/omp/session-sidebar-controller.test.ts +33 -203
- package/src/client/hooks/chat/omp/session-sidebar-controller.ts +8 -6
- package/src/client/hooks/chat/timeline/jump-landing.ts +27 -9
- package/src/client/hooks/chat/timeline/jump-rail.ts +1 -0
- package/src/client/hooks/chat/timeline/reader-input.ts +39 -0
- package/src/client/hooks/chat/timeline/restore-history.ts +55 -0
- package/src/client/hooks/chat/timeline/row-window.test.ts +36 -3
- package/src/client/hooks/chat/timeline/row-window.ts +12 -3
- package/src/client/hooks/chat/timeline/scroll-geometry.ts +95 -0
- package/src/client/hooks/chat/timeline/scroll-probe.test-util.ts +17 -4
- package/src/client/hooks/chat/timeline/scroll.test.ts +53 -0
- package/src/client/hooks/chat/timeline/scroll.ts +30 -70
- package/src/client/hooks/chat/timeline/session-load.test.ts +25 -0
- package/src/client/hooks/chat/timeline/session-load.ts +8 -1
- package/src/client/hooks/chat/timeline/session-shapes.ts +3 -0
- package/src/client/hooks/models/use-harnesses-controller.ts +8 -1
- package/src/client/hooks/models/use-harnesses.ts +68 -1
- package/src/client/hooks/ui/navbar-controls.test.ts +50 -0
- package/src/client/hooks/ui/navbar-controls.ts +118 -0
- package/src/client/hooks/ui/pointer-hover.test.ts +94 -0
- package/src/client/hooks/ui/pointer-hover.ts +62 -0
- package/src/client/hooks/ui/ui-sounds.test.ts +4 -0
- package/src/client/hooks/workspace/batch-archive.ts +19 -3
- package/src/client/hooks/workspace/batch-delete-run.ts +15 -3
- package/src/client/hooks/workspace/batch-delete.test.ts +112 -0
- package/src/client/hooks/workspace/batch-delete.ts +51 -5
- package/src/client/hooks/workspace/left-dock.ts +14 -0
- package/src/client/hooks/workspace/panel-drop-target.test.tsx +119 -0
- package/src/client/hooks/workspace/panel-drop-target.ts +76 -0
- package/src/client/hooks/workspace/panel-menu-items.ts +57 -0
- package/src/client/hooks/workspace/panel-reorder.ts +5 -2
- package/src/client/lib/browser/download.ts +12 -1
- package/src/client/lib/notifications/active.ts +26 -0
- package/src/client/lib/notifications/native-banner-sound.test.ts +34 -1
- package/src/client/lib/notifications/native-banner-sound.ts +7 -0
- package/src/client/lib/notifications/os.test.ts +53 -0
- package/src/client/lib/notifications/os.ts +129 -5
- package/src/client/lib/session-export.test.ts +72 -0
- package/src/client/lib/session-export.ts +60 -0
- package/src/client/lib/ui/control-plate.test.ts +29 -0
- package/src/client/lib/ui/control-plate.ts +42 -0
- package/src/client/main.tsx +7 -0
- package/src/client/tailwind.css +18 -7
- package/src/server/lib/changes/attach.test.ts +3 -1
- package/src/server/lib/changes/capture-bash.server.ts +15 -1
- package/src/server/lib/changes/capture.server.ts +2 -0
- package/src/server/lib/changes/capture.test.ts +40 -0
- package/src/server/lib/changes/journal-read.server.ts +204 -0
- package/src/server/lib/changes/reader.server.ts +28 -184
- package/src/server/lib/changes/reader.test.ts +40 -0
- package/src/server/lib/changes/scan.server.ts +86 -12
- package/src/server/lib/changes/scan.test.ts +56 -0
- package/src/server/lib/changes/sessions.server.ts +15 -0
- package/src/server/lib/changes/temp-path.test.ts +45 -0
- package/src/server/lib/changes/temp-path.ts +102 -0
- package/src/server/lib/db/schema.ts +9 -0
- package/src/server/lib/harness/acp/client.ts +12 -6
- package/src/server/lib/harness/acp/frames-replay.test.ts +55 -0
- package/src/server/lib/harness/acp/frames.ts +45 -3
- package/src/server/lib/harness/acp/protocol.ts +29 -0
- package/src/server/lib/harness/acp/replay-transcript.test.ts +47 -0
- package/src/server/lib/harness/acp/replay-transcript.ts +55 -0
- package/src/server/lib/harness/acp/replay.ts +78 -0
- package/src/server/lib/harness/acp/session-config.ts +36 -1
- package/src/server/lib/harness/acp/session-handshake.ts +32 -8
- package/src/server/lib/harness/acp/session-observers.test.ts +2 -2
- package/src/server/lib/harness/acp/session-options.ts +9 -0
- package/src/server/lib/harness/acp/session-start.ts +62 -0
- package/src/server/lib/harness/acp/session.test-util.ts +2 -0
- package/src/server/lib/harness/acp/session.ts +33 -37
- package/src/server/lib/harness/acp/v2.test.ts +44 -0
- package/src/server/lib/harness/acp/v2.ts +38 -0
- package/src/server/lib/harness/acp/verbs.test.ts +37 -1
- package/src/server/lib/harness/acp/verbs.ts +52 -6
- package/src/server/lib/harness/auto-import.server.test.ts +92 -0
- package/src/server/lib/harness/auto-import.server.ts +209 -0
- package/src/server/lib/harness/auto-probe.server.ts +9 -3
- package/src/server/lib/harness/codex/transcript.server.test.ts +67 -0
- package/src/server/lib/harness/codex/transcript.server.ts +222 -0
- package/src/server/lib/harness/schema.server.ts +15 -7
- package/src/server/lib/harness/session-delete.server.test.ts +156 -0
- package/src/server/lib/harness/session-delete.server.ts +198 -0
- package/src/server/lib/harness/session-import.server.ts +177 -0
- package/src/server/lib/harness/session-store.server.test.ts +85 -0
- package/src/server/lib/harness/session-store.server.ts +70 -3
- package/src/server/lib/harness/session-transcript.server.test.ts +183 -0
- package/src/server/lib/harness/session-transcript.server.ts +301 -0
- package/src/server/lib/harness/session.ts +4 -2
- package/src/server/lib/harness/spawn.server.ts +9 -0
- package/src/server/lib/lifecycle/after-listen.ts +11 -5
- package/src/server/lib/model-roles/mock.server.test.ts +35 -0
- package/src/server/lib/model-roles/mock.server.ts +1 -1
- package/src/server/lib/omp/rpc/frame-fold-frames.test.ts +15 -4
- package/src/server/lib/omp/session/delete-flow.server.ts +62 -9
- package/src/server/lib/omp/session/delete.server.ts +6 -0
- package/src/server/lib/omp/session/sidebar-data.harness.test.ts +86 -1
- package/src/server/lib/omp/session/sidebar-data.server.ts +41 -70
- package/src/server/lib/omp/session/sidebar-status.server.ts +82 -0
- package/src/server/lib/omp/session/telemetry/compute.ts +18 -0
- package/src/server/lib/omp/session/telemetry.test.ts +21 -0
- package/src/server/lib/realtime/topics/catalog.server.ts +2 -1
- package/src/server/lib/realtime/topics.server.ts +2 -1
- package/src/server/lib/sessions/deleted-sessions.server.test.ts +49 -0
- package/src/server/lib/sessions/deleted-sessions.server.ts +45 -0
- package/src/server/lib/tray/config.ts +19 -4
- package/src/server/lib/tray/host/darwin.js +6 -1
- package/src/server/lib/tray/host/linux.js +2 -1
- package/src/server/lib/tray/host/win32.ps1 +7 -1
- package/src/server/lib/tray/runtime.server.ts +81 -3
- package/src/server/lib/tray/tray.test.ts +20 -0
- package/src/server/routes/agent/command.ts +4 -0
- package/src/server/routes/agent/harness-command.ts +77 -3
- package/src/server/routes/agent/restore.ts +50 -0
- package/src/server/routes/chat/imported.ts +32 -0
- package/src/server/routes/chat/session.ts +33 -21
- package/src/server/routes/chat/window.ts +25 -0
- package/src/server/routes/folders/batch-delete.ts +3 -4
- package/src/server/routes/harness/root.ts +17 -1
- package/src/server/routes/harness/session-actions.ts +60 -0
- package/src/server/routes/harness/session-import.test.ts +81 -0
- package/src/server/routes/sessions/batch-archive.ts +5 -4
- package/src/server/routes/sessions/batch-delete.ts +23 -12
- package/src/server/routes/sessions/delete-acp.test.ts +70 -0
- package/src/server/routes/sessions/export.test.ts +83 -0
- package/src/server/routes/sessions/export.ts +59 -0
- package/src/server/routes/sessions/index.ts +4 -0
- package/src/server/routes/sessions/list.ts +5 -0
- package/src/server/routes/settings/root.ts +13 -0
- package/src/shared/lib/chat/export-markdown.test.ts +110 -0
- package/src/shared/lib/chat/export-markdown.ts +141 -0
- package/src/shared/lib/omp/config/schema-releases.test.ts +193 -0
- package/src/shared/lib/omp/config/schema.test.ts +0 -117
- package/src/shared/lib/realtime/connection.ts +4 -0
- package/src/shared/lib/sessions/batch-limits.test.ts +51 -0
- package/src/shared/lib/sessions/batch-limits.ts +42 -0
- package/src/shared/lib/settings/defaults.ts +2 -0
- package/src/shared/lib/theme/tray-icon-style.test.ts +43 -0
- package/src/shared/lib/theme/tray-icon-style.ts +69 -0
- package/src/shared/lib/workspace/left-dock-width.ts +23 -3
- package/src/shared/lib/workspace/left-dock.test.ts +38 -10
- package/src/shared/lib/workspace/left-dock.ts +39 -14
- package/src/shared/lib/workspace/panel-drag.test.ts +52 -0
- package/src/shared/lib/workspace/panel-drag.ts +34 -0
- package/src/shared/lib/workspace/panel-open.test.ts +7 -1
- package/src/shared/lib/workspace/session-state/store.ts +0 -1
- package/src/shared/types/context.ts +20 -0
- package/src/shared/types/harness.ts +26 -0
- package/src/shared/types/settings/state.ts +9 -0
- package/src/test-support/fake-acp-delete.ts +63 -0
- package/src/test-support/sidebar-controller-harness.test-util.ts +121 -0
- package/dist/client/static/js/DrawioView-1ts9y0yk.js +0 -5
- package/dist/client/static/js/ImageView-w2hyp129.js +0 -1
- package/dist/client/static/js/LayoutWrapper-pdvfkncm.js +0 -2
- package/dist/client/static/js/Modal-2sx1tgqr.js +0 -38
- package/dist/client/static/js/SessionsView-a8921ysr.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-r8sz34h3.js +0 -1
- package/dist/client/static/js/architectureDiagram-NJMV4G6O-z3n19xwk.js +0 -36
- package/dist/client/static/js/bash-b3rwyg5p.js +0 -1
- package/dist/client/static/js/c-jkdstn33.js +0 -1
- package/dist/client/static/js/cpp-9d3xdpe3.js +0 -1
- package/dist/client/static/js/css-r3wja1ze.js +0 -1
- package/dist/client/static/js/css-sebxkh5f.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-w2f2vev7.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-k5n61zzh.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-zmz4grtx.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-2gf053bx.js +0 -1
- package/dist/client/static/js/graphql-p4cskvad.js +0 -1
- package/dist/client/static/js/html-f26r6vv5.js +0 -1
- package/dist/client/static/js/index-1c7294vk.js +0 -1
- package/dist/client/static/js/index-2mx9ej4k.css +0 -1
- package/dist/client/static/js/index-2xb54jt3.js +0 -4
- package/dist/client/static/js/index-6d5qj0kb.js +0 -1
- package/dist/client/static/js/index-6k2x281j.js +0 -12
- package/dist/client/static/js/index-6rt7gs1j.js +0 -1
- package/dist/client/static/js/index-737w2mqf.js +0 -1
- package/dist/client/static/js/index-a5ptb956.js +0 -3
- package/dist/client/static/js/index-aa6qdgmv.js +0 -1
- package/dist/client/static/js/index-arvqarv3.js +0 -7
- package/dist/client/static/js/index-bgcp21ed.js +0 -1
- package/dist/client/static/js/index-d8kjsgpt.js +0 -474
- package/dist/client/static/js/index-enxfdvdq.js +0 -1
- package/dist/client/static/js/index-hp8kfk9z.js +0 -1
- package/dist/client/static/js/index-r83kr4s5.js +0 -2
- package/dist/client/static/js/index-rtd9frp1.js +0 -2
- package/dist/client/static/js/index-s910y31q.js +0 -1
- package/dist/client/static/js/info-A6RAGUB7-3tr0y3s6.js +0 -1
- package/dist/client/static/js/ini-cg0a5wm3.js +0 -1
- package/dist/client/static/js/java-vcck089n.js +0 -1
- package/dist/client/static/js/javascript-nyf39d5r.js +0 -1
- package/dist/client/static/js/json-j5q8nt57.js +0 -1
- package/dist/client/static/js/jsx-ht9zyzwa.js +0 -1
- package/dist/client/static/js/lua-86fjqj8v.js +0 -1
- package/dist/client/static/js/markdown-gwmsh53r.js +0 -1
- package/dist/client/static/js/one-dark-pro-kckm8epj.js +0 -1
- package/dist/client/static/js/one-light-0v7rg9a7.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-xbsyjzrh.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-j2tpz0cs.js +0 -1
- package/dist/client/static/js/pieDiagram-5QR66LMP-nz6n95d6.js +0 -39
- package/dist/client/static/js/properties-mzvvbqg5.js +0 -1
- package/dist/client/static/js/python-3w64wsyd.js +0 -1
- package/dist/client/static/js/r-32re2zwb.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-m3tsyfv0.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-5p202a4q.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-hj0y9tgn.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-8c5dct8f.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-3tx8z65q.js +0 -1
- package/dist/client/static/js/sql-0e9mnrda.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-56rk9kxv.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-mf0rb2yv.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-0x5gf06b.js +0 -1
- package/dist/client/static/js/tsx-nm94hed6.js +0 -1
- package/dist/client/static/js/typescript-5nmrzgkj.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-x7ej8dms.js +0 -1
- package/dist/client/static/js/xml-3dd1pter.js +0 -1
- package/dist/client/static/js/yaml-yssayv8a.js +0 -1
- package/src/client/components/workspace/usage-panel/ProviderSelect.tsx +0 -229
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n,i,
|
|
2
|
-
${p.url}`,"aria-pressed":w,children:k}),e("button",{type:"button",onClick:()=>l(p.targetId),disabled:d===p.targetId,className:`mr-0.5 p-1 rounded hover:bg-error hover:text-paper transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed ${w?"text-on-ink-muted":"text-ink/40 opacity-0 group-hover:opacity-100 focus-visible:opacity-100"}`,"aria-label":`Tutup tab ${k}`,title:`Tutup tab ${k}`,children:e(b,{size:11})})]},p.targetId)})})}function le(t){let r=atob(t),d=new Uint8Array(r.length);for(let c=0;c<r.length;c++)d[c]=r.charCodeAt(c);return d}function ce(t,r){return new Blob([le(t)],{type:r})}async function K(t,r,d){let c=t.getContext("2d");if(!c)return!1;if(typeof createImageBitmap!=="function")return!1;let l;try{l=await createImageBitmap(ce(r,d))}catch{return!1}try{if(t.width!==l.width||t.height!==l.height)t.width=l.width,t.height=l.height;return c.drawImage(l,0,0),!0}finally{l.close()}}var ue={"agent-offline":{title:"The agent is not running",body:"Start this session so the agent can drive the browser."},"browser-offline":{title:"No browser is open",body:"Ask the agent to open a page; the live view appears here."},"no-tab":{title:"Browser is open, with no tab yet",body:"This session has not opened a tab in the shared browser."}};function J({status:t,url:r,tabs:d,targetId:c,frame:l,actions:u,onSelectTarget:p,onCloseTarget:w,closingTarget:k,zoomLevel:I}){let B=t==="live",L=B?null:ue[t],g=
|
|
1
|
+
import{n,o,i,a,e,Ze,S,s,ne,Sn,m,_,dr,tt,Qe,Ue,Cr,Ln,Yr,Ui,b,Jl}from"./index-3fw3sd10.js";import{gu}from"./index-k61tdd4a.js";import"./index-hh05xd1d.js";var te={name:"mouse-pointer-click",size:24,node:[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]},U=s(te);var re={name:"move-vertical",size:24,node:[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m8 18 4 4 4-4",key:"bh5tu3"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}]]},D=s(re);var oe={live:"Live","agent-offline":"Agent offline","browser-offline":"Browser offline","no-tab":"Tanpa tab"};function j({url:t,status:r,zoomLevel:d=100,onIncludeInChat:c,onReconnect:l,onOpenExternal:u,onZoomIn:p,onZoomOut:w,onResetZoom:k}){return e(gu,{url:t??"",statusDotClass:r==="live"?"bg-success animate-pulse":"bg-ink/25",statusLabel:oe[r],zoomLevel:d,onZoomIn:p,onZoomOut:w,onResetZoom:k,onIncludeInChat:c,onOpenExternal:u,onReconnect:l,openExternalLabel:"Buka di jendela baru",openExternalTitle:t?"Open in new window":"No URL loaded",children:e("div",{className:"flex-1 min-w-0 flex items-center bg-canvas border border-ink/15 rounded-md px-2 py-0.5",children:[e(Qe,{size:12,className:"text-ink/40 mr-1.5 flex-shrink-0"}),e("span",{className:"w-full truncate text-ink/80 font-mono text-[11px]",title:t??"",children:t||"No page open yet"})]})})}var se=[["RAM","~93 MB → ~259 MB untuk satu tab"],["Disk","~346 MB untuk Chrome for Testing bila belum terpasang"],["Idle","Tab Chromium terus melukis; omp membekukannya saat turn selesai"],["Deteksi","Halaman bisa melihat otomasi (navigator.webdriver, CDP)"]];function Z({saving:t,onUseChromium:r}){return e("button",{type:"button",onClick:r,disabled:t,className:"inline-flex items-center gap-1.5 rounded-md border border-ink/15 bg-ink/5 px-2.5 py-1 text-[11px] font-medium text-ink transition-colors hover:bg-ink/10 disabled:cursor-not-allowed disabled:opacity-60",children:[t&&e(m,{size:11,className:"animate-spin"}),t?"Mengaktifkan…":"Pakai Chromium"]})}function z({saving:t,error:r,onUseChromium:d,variant:c}){if(c==="strip")return e("div",{className:"flex items-center justify-between gap-2 border-b border-ink/10 bg-ink/[0.03] px-2.5 py-1.5 flex-shrink-0",children:[e("span",{className:"min-w-0 truncate text-[11px] text-ink/70",children:"Agen memakai WebKit — tab baru tidak akan muncul di panel ini."}),e(Z,{saving:t,onUseChromium:d})]});return e("div",{className:"flex-1 flex flex-col items-center justify-center overflow-y-auto p-6 text-center select-none my-auto",children:[e("div",{className:"w-12 h-12 rounded-xl bg-ink/5 border border-ink/10 flex items-center justify-center text-ink/40 mb-3",children:e(_,{size:24})}),e("h3",{className:"text-sm font-semibold text-ink mb-1",children:"Agen memakai WebKit — panel ini tidak bisa memantulkannya"}),e("p",{className:"text-xs text-ink/60 max-w-sm",children:"WebKit milik omp tidak punya CDP dan tidak mengekspos aliran frame, jadi tab yang dijalankannya tidak bisa ditampilkan di sini. Panel ini hanya bisa memantulkan Chromium."}),e("div",{className:"mt-4 w-full max-w-sm rounded-lg border border-ink/10 bg-paper text-left",children:[e("div",{className:"border-b border-ink/10 px-3 py-1.5 text-[10px] uppercase tracking-wider text-ink/50",children:"Biaya pindah ke Chromium"}),e("dl",{className:"divide-y divide-ink/5",children:se.map(([l,u])=>e("div",{className:"flex gap-2 px-3 py-1.5",children:[e("dt",{className:"w-14 flex-shrink-0 text-[11px] font-medium text-ink/70",children:l}),e("dd",{className:"text-[11px] text-ink/60",children:u})]},l))})]}),e("div",{className:"mt-3 flex flex-col items-center gap-1.5",children:[e(Z,{saving:t,onUseChromium:d}),e("p",{className:"text-[10.5px] text-ink/45 max-w-sm",children:"Berlaku untuk tab yang dibuka berikutnya; sesi tidak perlu di-restart. Tab WebKit yang sudah terbuka tetap tidak terlihat."}),r&&e("p",{role:"alert",className:"text-[11px] text-error max-w-sm",children:r})]})]})}var ae={open:Qe,navigate:Qe,loaded:ne,click:U,type:Yr,press:tt,submit:Ln,wait:Ue,screenshot:dr,scroll:D,upload:Ui,close:Sn,error:Sn};function F({actions:t}){if(t.length===0)return null;return e("div",{className:"absolute bottom-3 left-3 z-20 flex flex-col gap-1.5 pointer-events-none max-w-[320px]",children:t.map((r)=>{let d=ae[r.kind],c=r.kind==="error";return e("div",{className:`flex items-center gap-2 rounded-md border px-2.5 py-1.5 text-[11px] shadow-sm backdrop-blur-sm ${c?"border-error/30 bg-error/10 text-error":"border-ink/15 bg-paper/95 text-ink"}`,children:[e(d,{size:12,className:`flex-shrink-0 ${c?"text-error":"text-ink/60"}`}),e("span",{className:"truncate",children:r.label})]},r.id)})})}function ie(t){return t.title||t.url||t.targetId}function H({tabs:t,targetId:r,closing:d,onSelectTarget:c,onCloseTarget:l}){let u=i(null);return o(()=>{u.current?.scrollIntoView({block:"nearest",inline:"nearest"})},[r,t.length]),e("div",{className:"px-2 py-1 border-b border-ink/10 bg-paper flex items-center gap-1 overflow-x-auto flex-shrink-0",children:t.map((p)=>{let w=p.targetId===r,k=ie(p);return e("div",{ref:w?u:void 0,className:`group flex items-center rounded border transition-colors flex-shrink-0 ${w?"bg-ink text-canvas border-ink":"bg-paper text-ink/70 border-ink/15 hover:border-ink/35 hover:text-ink"}`,children:[e("button",{type:"button",onClick:()=>c(w?"":p.targetId),className:"pl-2 pr-1 py-0.5 text-[11px] font-mono max-w-[220px] truncate cursor-pointer",title:`${k}
|
|
2
|
+
${p.url}`,"aria-pressed":w,children:k}),e("button",{type:"button",onClick:()=>l(p.targetId),disabled:d===p.targetId,className:`mr-0.5 p-1 rounded hover:bg-error hover:text-paper transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed ${w?"text-on-ink-muted":"text-ink/40 opacity-0 group-hover:opacity-100 focus-visible:opacity-100"}`,"aria-label":`Tutup tab ${k}`,title:`Tutup tab ${k}`,children:e(b,{size:11})})]},p.targetId)})})}function le(t){let r=atob(t),d=new Uint8Array(r.length);for(let c=0;c<r.length;c++)d[c]=r.charCodeAt(c);return d}function ce(t,r){return new Blob([le(t)],{type:r})}async function K(t,r,d){let c=t.getContext("2d");if(!c)return!1;if(typeof createImageBitmap!=="function")return!1;let l;try{l=await createImageBitmap(ce(r,d))}catch{return!1}try{if(t.width!==l.width||t.height!==l.height)t.width=l.width,t.height=l.height;return c.drawImage(l,0,0),!0}finally{l.close()}}var ue={"agent-offline":{title:"The agent is not running",body:"Start this session so the agent can drive the browser."},"browser-offline":{title:"No browser is open",body:"Ask the agent to open a page; the live view appears here."},"no-tab":{title:"Browser is open, with no tab yet",body:"This session has not opened a tab in the shared browser."}};function J({status:t,url:r,tabs:d,targetId:c,frame:l,actions:u,onSelectTarget:p,onCloseTarget:w,closingTarget:k,zoomLevel:I}){let B=t==="live",L=B?null:ue[t],g=i(null),[f,x]=n(!1);return o(()=>{let E=g.current;if(!E||!l)return;let y=!1;return K(E,l.data,l.mimeType).then((T)=>{if(T&&!y)x(!0)}),()=>{y=!0}},[l]),o(()=>{if(!B)x(!1)},[B]),e("div",{className:"flex-1 flex flex-col min-h-0 bg-canvas/60 relative overflow-hidden",children:[e(F,{actions:u}),B&&d.length>0&&e(H,{tabs:d,targetId:c,closing:k,onSelectTarget:p,onCloseTarget:w}),e("div",{className:"flex-1 flex items-center justify-center p-2 min-h-0 overflow-auto",children:B?e("div",{className:"relative flex flex-col bg-paper w-full h-full transition-all duration-200",style:{zoom:I!==100?`${I}%`:void 0,transformOrigin:"top center"},children:[e("canvas",{ref:g,"aria-label":r||"Live browser view",className:`w-full h-full object-contain bg-paper ${f?"":"hidden"}`}),!f&&e("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-center p-6 select-none",children:[e(m,{size:20,className:"animate-spin text-ink/40 mb-2"}),e("p",{className:"text-xs text-ink/60",children:"Menunggu frame pertama dari browser…"})]})]}):e("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center select-none my-auto",children:[e("div",{className:"w-12 h-12 rounded-xl bg-ink/5 border border-ink/10 flex items-center justify-center text-ink/40 mb-3",children:t==="agent-offline"?e(Cr,{size:24}):e(Qe,{size:24})}),e("h3",{className:"text-sm font-semibold text-ink mb-1",children:L?.title}),e("p",{className:"text-xs text-ink/60 max-w-sm",children:L?.body})]})})]})}function W(t){if(typeof t!=="object"||t===null||!("error"in t))return null;return typeof t.error==="string"?t.error:null}function X(){let[t,r]=n(null),[d,c]=n(!0),[l,u]=n(!1),[p,w]=n(null),[k,I]=n(0);o(()=>{let g=!1;return c(!0),fetch("/api/browser/engine").then((f)=>f.json()).then((f)=>{if(g)return;let x=W(f);if(x){w(x);return}r(f),w(null)}).catch((f)=>{if(!g)w(f instanceof Error?f.message:String(f))}).finally(()=>{if(!g)c(!1)}),()=>{g=!0}},[k]);let B=a(()=>I((g)=>g+1),[]),L=a(async()=>{u(!0),w(null);try{let g=await fetch("/api/browser/engine",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({webkit:!1})}),f=await g.json().catch(()=>null),x=W(f)??(g.ok?null:`The write answered ${g.status}`);if(x)return w(x),!1;return r(f),!0}catch(g){return w(g instanceof Error?g.message:String(g)),!1}finally{u(!1)}},[]);return{state:t,loading:d,saving:l,error:p,refresh:B,useChromium:L}}var G={status:"agent-offline",tabs:[]},Y=5000,de=4000,me=500,pe=3,q=16;function Q(t=!0){let{sessionId:r,ready:d}=Ze(),[c,l]=n(G),[u,p]=n(null),[w,k]=n([]),[I,B]=n(""),[L,g]=n(0),f=i(null),x=i(null),E=i(void 0),y=i(0),T=i([]),M=a((N)=>{B(N.trim())},[]),O=a(()=>{g((N)=>N+1)},[]);return o(()=>{let N=setInterval(()=>{k((P)=>{let R=Date.now(),A=P.filter((h)=>h.expiresAt>R),C=T.current.shift();if(!C)return A.length===P.length?P:A;return[...A.slice(-(pe-1)),{...C,expiresAt:R+de}]})},me);return()=>clearInterval(N)},[]),o(()=>{l(G),p(null),B(""),T.current=[],k([])},[r]),o(()=>{if(!d||!r||!t)return;let N=!1,P=()=>{if(N)return;let A=I?`?target=${encodeURIComponent(I)}`:"",C=new EventSource(`/api/browser/${encodeURIComponent(r)}/stream${A}`);f.current=C,C.addEventListener("open",()=>{y.current=0}),C.addEventListener("state",(h)=>{try{let v=JSON.parse(h.data);if(E.current=v.targetId,l(v),v.status!=="live")p(null)}catch{}}),C.addEventListener("frame",(h)=>{try{let v=JSON.parse(h.data),V=E.current;if(V&&v.targetId&&v.targetId!==V)return;if(!V&&v.targetId)E.current=v.targetId;p({data:v.data,mimeType:v.mimeType})}catch{}}),C.addEventListener("action",(h)=>{try{let v=JSON.parse(h.data);if(typeof v?.label!=="string"||!v.label)return;if(T.current.push(v),T.current.length>q)T.current.splice(0,T.current.length-q)}catch{}}),C.addEventListener("error",()=>{if(C.readyState===EventSource.CLOSED)R()})},R=()=>{if(N||x.current)return;let A=Math.min(y.current+1,Y/1000);y.current=A,x.current=setTimeout(()=>{x.current=null,f.current?.close(),f.current=null,P()},Math.min(A*1000,Y))};return P(),()=>{if(N=!0,x.current)clearTimeout(x.current),x.current=null;f.current?.close(),f.current=null}},[d,r,I,L,t]),{status:c.status,url:c.url,title:c.title,tabs:c.tabs,targetId:c.targetId,frame:u,actions:w,sessionId:r,selectTarget:M,reconnect:O}}function fe(t){return typeof t==="string"&&t?t:null}function ee(t){let[r,d]=n(null);return{closeTab:a(async(l)=>{if(!t||!l)return{ok:!1,next:null,error:"No tab to close"};d(l);try{let u=await fetch(`/api/browser/${encodeURIComponent(t)}/tabs/close`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({targetId:l})}),p=await u.json().catch(()=>({}));if(!u.ok)return{ok:!1,next:null,error:typeof p.error==="string"&&p.error?p.error:`Close failed (${u.status})`};return{ok:!0,next:fe(p.next)}}catch(u){return{ok:!1,next:null,error:u instanceof Error?u.message:String(u)}}finally{d(null)}},[t]),closing:r}}function it({className:t="",active:r=!0}){let[d,c]=S("browser.zoomLevel",100),{status:l,url:u,title:p,tabs:w,targetId:k,frame:I,actions:B,sessionId:L,selectTarget:g,reconnect:f}=Q(r),{closeTab:x,closing:E}=ee(L),y=X(),[T,M]=n(null),O=y.state?.effective==="webkit"&&!y.state.mock,N=O&&(l==="browser-offline"||l==="no-tab"),P=a(()=>{y.useChromium().then((h)=>{if(h)f()})},[y.useChromium,f]),R=()=>{if(!u)return;let h=u.startsWith("/")&&typeof window<"u"?`${window.location.origin}${u}`:u;window.open(h,"_blank","noopener,noreferrer")},A=a(()=>{if(!u)return;Jl({url:u,title:p})},[u,p]),C=a((h)=>{if(E===h)return;x(h).then((v)=>{if(!v.ok){M(v.error??"The tab could not be closed");return}M(null),g(v.next??"")})},[x,E,g]);return e("div",{className:`flex flex-col h-full w-full bg-paper text-ink overflow-hidden select-none ${t}`,children:[e(j,{url:u,status:l,zoomLevel:d,onIncludeInChat:A,onReconnect:f,onOpenExternal:R,onZoomIn:()=>c((h)=>Math.min(200,h+10)),onZoomOut:()=>c((h)=>Math.max(50,h-10)),onResetZoom:()=>c(100)}),T&&e("div",{role:"alert",className:"px-2.5 py-1 border-b border-error/30 bg-error/5 text-[11px] text-error flex items-center justify-between gap-2 flex-shrink-0",children:[e("span",{className:"truncate",title:T,children:T}),e("button",{type:"button",onClick:()=>M(null),className:"text-[10px] uppercase tracking-wide text-error/80 hover:text-error cursor-pointer flex-shrink-0",children:"Tutup"})]}),O&&l==="live"&&y.state&&e(z,{saving:y.saving,error:y.error,onUseChromium:P,variant:"strip"}),N&&y.state?e(z,{saving:y.saving,error:y.error,onUseChromium:P,variant:"body"}):e(J,{status:l,url:u,tabs:w,targetId:k,frame:I,actions:B,onSelectTarget:g,onCloseTarget:C,closingTarget:E,zoomLevel:d})]})}export{it as BrowserPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d,n,o,i,u,a,br,$e,oe,e,Wn,w,zg,we,Fs,S,lr,cr,s,Dn,L,Xe,B,ie,re,Ce,qe,ei,on,ti,Wr,D,O,b,mt,at,pe,jt,Pu,it,st,Xg,eA,Hi,Wi,Ou,je}from"./index-3fw3sd10.js";import{Du,Ko,Qu,Nu}from"./index-jkph8wqq.js";import{Ns,hr,Ru}from"./index-270y5r9k.js";var Jt={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(Jt);var Zt={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"}]]},Be=s(Zt);var en={name:"package-open",size:24,node:[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]},Qe=s(en);var tn={name:"scissors",size:24,node:[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]},Se=s(tn);function Ye({rootPath:t,activeRepo:r,repos:l,reposScanning:c,onRefreshRepos:p,onSelectRepo:f,searchQuery:x,onSearchChange:h,onRefresh:v,refreshing:g}){return e("div",{className:"border-b border-ink/10",children:[e(mt,{className:"border-b-0",left:e(hr,{rootPath:t,activeRepo:r,onSelectRepo:f,repos:l,scanning:c,onRefreshRepos:p}),right:e(at,{label:"Refresh",onClick:v,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:x,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 Je({name:t,path:r,isFolder:l,isOpen:c,ignored:p,selected:f,gitStatus:x,folderStatus:h}){let v=f?"text-ink font-semibold":x?x.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(ie,{size:12,className:"flex-shrink-0 text-ink/40"}):e("span",{className:"w-3 flex-shrink-0"}),e(it,{name:t,isFolder:l,isOpen:c,size:12,className:`flex-shrink-0${p?" opacity-40":""}`}),e("span",{className:`truncate min-w-0 flex-1 ${v}`,title:p?`${r} — git-ignored`:void 0,children:t}),x&&e("span",{className:`font-mono text-[10px] font-bold px-1 rounded flex-shrink-0 ${x.colorClass}`,title:`Git: ${x.label}`,children:x.charStatus}),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 nn=28,rn=9,sn=8;function an(t){let{isFolder:r,hasGitStatus:l,pasteLabel:c,busy:p,chainLabel:f,foldable:x,selectionCount:h,isArchive:v}=t,g=[],m=h>1,k=h===1?"":` ${h} items`;if(m)return g.push({kind:"item",id:"cut",label:`Cut${k}`,icon:e(Se,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"item",id:"copy",label:`Copy${k}`,icon:e(re,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"separator"}),g.push({kind:"item",id:"compress",label:`Compress${k} to…`,icon:e(Xe,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"separator"}),g.push({kind:"item",id:"delete",label:`Delete${k}`,icon:e(L,{size:13,className:"text-error"}),tone:"text-error"}),g;if(r){if(g.push({kind:"item",id:"new_file",label:"New File",icon:e(ei,{size:13,className:"text-ink/60"})}),g.push({kind:"item",id:"new_folder",label:"New Folder",icon:e(on,{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(x)g.push({kind:"item",id:"fold",label:"Fold Folders",icon:e(ie,{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"})}),v)g.push({kind:"item",id:"extract",label:"Extract…",icon:e(Qe,{size:13,className:"text-ink/60"}),disabled:p});if(l)g.push({kind:"item",id:"diff",label:"Open in Diff Panel",icon:e(ti,{size:13,className:"text-warning"}),tone:"font-medium"});g.push({kind:"separator"})}if(g.push({kind:"item",id:"cut",label:"Cut",icon:e(Se,{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(Xe,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"item",id:"duplicate",label:"Duplicate",icon:e(Be,{size:13,className:"text-ink/60"}),disabled:p}),c)g.push({kind:"item",id:"paste",label:c,icon:e(Ns,{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(Ce,{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(Dn,{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(L,{size:13,className:"text-error"}),tone:"text-error"}),g}function ln(t){let r=t.filter((c)=>c.kind==="item").length,l=t.length-r;return r*nn+l*rn+sn}function Ze({x:t,y:r,isFolder:l,hasGitStatus:c,pasteLabel:p,chainLabel:f,foldable:x,busy:h,selectionCount:v,isArchive:g,onAction:m,menuRef:k}){let F=an({isFolder:l,hasGitStatus:c,pasteLabel:p,busy:h,chainLabel:f,foldable:x,selectionCount:v,isArchive:g}),A=ln(F),C=typeof window<"u"?Math.max(10,Math.min(t,window.innerWidth-210-12)):t,E=typeof window<"u"?Math.max(10,Math.min(r,window.innerHeight-A-12)):r;return oe(e("div",{className:"fixed inset-0 z-50 bg-ink/20",onClick:()=>m("close"),onContextMenu:(R)=>{R.preventDefault(),m("close")},children:e("div",{ref:k,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:E,left:C},onClick:(R)=>R.stopPropagation(),children:F.map((R,N)=>R.kind==="separator"?e("div",{className:"my-1 border-t border-ink/10"},`sep-${N}`):e("button",{type:"button",disabled:R.disabled,onClick:()=>m(R.id),className:`w-full text-left px-3 py-1.5 flex items-center space-x-2 transition-colors ${R.disabled?"opacity-40 cursor-default":"hover:bg-ink/5"} ${R.tone??""}`,children:[R.icon,e("span",{children:R.label})]},R.id))})}),document.body)}function Fe({folderPath:t,kind:r,value:l,error:c,isLoading:p,onChange:f,onCancel:x,onSubmit:h}){let v=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 ",v]}),e("div",{className:"flex items-center gap-1 mb-1 text-xs font-mono text-ink/50 min-w-0",children:e("span",{className:"truncate",title:t,children:[t||".","/"]})}),e("input",{autoFocus:!0,type:"text",value:l,onChange:(g)=>f(g.currentTarget.value),placeholder:r==="folder"?"folder name or nested/path":"file name or nested/path","aria-label":`New ${v.toLowerCase()} name`,className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none mb-1 ${c?"border-error":"border-ink/20 focus:border-ink"}`}),e("p",{className:"text-[10px] text-ink/40 mb-2",children:["Nested paths create the folders they need — ",e("span",{className:"font-mono",children:"lib/parse.ts"}),"."]}),c&&e("p",{className:"text-[11px] text-error mb-2",children:c}),e("div",{className:"flex justify-end space-x-2 mt-2",children:[e("button",{type:"button",onClick:x,className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",disabled:p,children:"Cancel"}),e("button",{type:"submit",className:"px-3 py-1.5 text-xs bg-ink text-canvas rounded hover:bg-ink/90 transition-colors flex items-center",disabled:p||!l.trim(),children:p?"Creating...":"Create"})]})]})}),document.body)}function et({fileName:t,displayName:r,isFolder:l,count:c=1,isLoading:p,onCancel:f,onConfirm:x}){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:x,className:"px-3 py-1.5 text-xs bg-error text-white rounded hover:bg-error/90 transition-colors flex items-center",disabled:p,children:p?"Deleting...":"Delete"})]})]})}),document.body)}function tt({isFolder:t,renameValue:r,originalPath:l,displayName:c,error:p,isLoading:f,onChange:x,onCancel:h,onSubmit:v}){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-3 text-sm",children:["Rename ",t?"Folder":"File"]}),e("input",{autoFocus:!0,type:"text",value:r,onChange:(g)=>x(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 nt({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(Dn,{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,x)=>e("tr",{className:"hover:bg-ink/[0.03] transition-colors group",children:[e("td",{className:"px-3 py-2 text-ink",children:f.message?e("span",{className:"font-medium text-ink/90 group-hover:text-ink",children:f.message}):null}),e("td",{className:"px-3 py-2 text-ink/60 whitespace-nowrap font-mono text-[10.5px]",children:f.time}),e("td",{className:"px-3 py-2 text-ink/70 whitespace-nowrap truncate max-w-[120px]",children:f.author}),e("td",{className:"px-3 py-2 text-right",children:f.hash?e("span",{className:"font-mono text-ink/50 group-hover:text-ink font-semibold transition-colors bg-canvas px-1.5 py-0.5 rounded border border-ink/10",children:f.hash}):null})]},x))})]}):e("div",{className:"p-8 text-center text-ink/40 font-mono text-xs",children:"No commit history found for this file."}):l?.error?e("div",{className:"p-8 text-center text-error font-mono text-xs",children:l.error}):e("div",{className:"p-8 text-center text-ink/40 font-mono text-xs",children:"Loading history..."}):e("div",{className:"p-8 text-center text-ink/40 font-mono text-xs flex items-center justify-center space-x-2",children:[e(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(et,{fileName:r.path,displayName:p>1?void 0:c,isFolder:l,count:p,isLoading:t.busy,onCancel:t.closeDelete,onConfirm:t.submitDelete}),t.showRenameModal&&e(tt,{isFolder:l,renameValue:t.renameValue,originalPath:r.path,displayName:l?c:void 0,error:t.renameError,isLoading:t.busy,onChange:t.setRenameValue,onCancel:t.closeRename,onSubmit:t.submitRename}),t.showHistoryModal&&e(nt,{filePath:r.path,fetcherState:t.fetcherState,fetcherData:t.fetcherData,onClose:t.closeHistory})]})}function Ae(t){let r=t.map(cn);return r.some((l,c)=>l!==t[c])?r:t}function cn(t){if(t.type!=="folder"||!Array.isArray(t.children))return t;let r=Ae(t.children),l=r===t.children?t:{...t,children:r};while(Array.isArray(l.children)&&l.children.length===1){let c=l.children[0];if(c.type!=="folder")break;l={...l,name:`${l.name}/${c.name}`,path:c.path,children:c.children,ignored:c.ignored??l.ignored}}return l}function Ee(t){return t.type==="folder"&&t.name.includes("/")}function Me(t,r){let l=r.split("/"),c=t.split("/");if(l.length<2||l.length>c.length||l.some((f)=>!f))return null;let p=c.slice(0,c.length-l.length);return l.map((f,x)=>[...p,...l.slice(0,x+1)].join("/"))}function ot(t,r){let l=new Map;if(r.size===0)return{nodes:t,roots:l};let c=!1,p=(x)=>x.flatMap((h)=>{if(h.type!=="folder")return[h];let v=Array.isArray(h.children)?p(h.children):h.children,g=v===h.children?h:{...h,children:v},m=r.has(h.path)?Me(h.path,h.name):null;if(!m)return[g];c=!0,l.set(m[0],h.path);let k={...g,name:m[m.length-1].split("/").pop()};for(let y=m.length-1;y>0;y-=1){let F=m[y-1];k={name:F.split("/").pop(),path:F,type:"folder",ignored:g.ignored,children:[k]}}return[k]}),f=p(t);return{nodes:c?f:t,roots:l}}function lt(t,r){let l=new Set,c=(x)=>{for(let h of x){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 x=0;x<p.length;x+=1){let h=p.slice(0,x+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=st(),[x,h]=n(!1),[v,g]=n("file"),[m,k]=n(""),[y,F]=n(null),A=i(null);return o(()=>{if(f.state!=="idle"||!f.data)return;let C=f.data;if(A.current===C)return;if(A.current=C,C.success&&C.path){let E=C.kind==="folder"?"folder":"file";h(!1),k(""),F(null);let R=C.path.split("/").pop()||C.path;if(c({path:C.path,name:R,kind:E}),E==="file")p?.({path:C.path,name:R})}else F(C.error||`Could not create the ${v}`)},[f.state,f.data]),{open:x,kind:v,name:m,setName:k,error:y,busy:f.state!=="idle",openDialog:(C="file")=>{g(C),k(""),F(null),h(!0)},closeDialog:()=>h(!1),submit:(C)=>{C.preventDefault();let E=m.trim();if(!E)return;F(null);let R=new FormData;if(R.append("actionType","create"),R.append("path",t),R.append("name",E),v==="folder")R.append("kind","folder");if(l&&l!==".")R.append("repo",l);if(r)R.append("root",r);f.submit(R,{method:"post",action:"/api/fs/action"})}}}function De(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 ht(t){if(typeof t!=="object"||t===null)return null;let r=t;if(typeof r.scope!=="string")return null;if(r.mode!=="copy"&&r.mode!=="cut")return null;let l=Array.isArray(r.entries)?r.entries:typeof r.path==="string"?[{path:r.path,name:r.name,kind:r.kind}]:[],c=[];for(let p of l){let f=dn(p);if(!f)return null;c.push(f)}if(c.length===0)return null;return{scope:r.scope,entries:c,mode:r.mode}}function dn(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 Oe=[{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 pn(t){return Oe.find((r)=>r.id===t)}function un(t){return pn(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 Re(t,r){let l=un(r);if(t.length===1){let f=t[0],x=xt(f.name),h=x.lastIndexOf(".");return`${(f.kind==="folder"?f.name:h>0?x.slice(0,h):x)||"archive"}.${l}`}let c=kt(t.map((f)=>f.path)),p=yt(c);return`${p==="."||p===""?"archive":p}.${l}`}function Ct(t){return kt(t.map((r)=>r.path))}function Ft(t){let r=vt(t),l=xt(yt(t));if(!l)return r;return r==="."?l:`${r}/${l}`}function Nt(t){return t.toUpperCase()}function wt({file:t,diff:r,onOpenFile:l,onActionComplete:c,onCreated:p,onRenamed:f,onUnfold:x,onFold:h,clipboard:v,isFolder:g,selection:m,selected:k,archive:y}){let F=st(),[A,C]=n(null),E=i(null),[R,N]=n(!1),[T,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:(M)=>p?p(M):c(),onOpenCreated:(M)=>l?.({...M,root:K,repo:z||"."})}),ne=i(null);o(()=>{if(F.state!=="idle"||!F.data)return;let M=F.data;if(ne.current===M)return;if(ne.current=M,M.success&&!M.type)if(N(!1),H(!1),I(null),M.previousPath&&M.path&&f)f(M.previousPath,M.path);else c();else if(!M.success&&M.error&&R)I(M.error)},[F.state,F.data]);let q=(M)=>{if(z&&z!==".")M.append("repo",z);if(K)M.append("root",K);F.submit(M,{method:"post",action:"/api/fs/action"})},V=()=>{l?.({path:t.path,name:t.name,root:K,repo:z||"."})},J={path:t.path,name:t.name,kind:g?"folder":"file"},se=k&&m.length>1?m:[J],he=bt(t.name),Q=v.clip&&!v.refusalFor(J)?`Paste ${De(v.clip)??"item"}`:null,fe=(M)=>{if(C(null),I(null),M==="view")V();else if(M==="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(M==="explorer"){let _=new FormData;_.append("actionType","open_explorer"),_.append("path",t.path),q(_)}else if(M==="copy_path")jt(Pu(t.basePath,t.path));else if(M==="copy_relative")jt(t.path);else if(M==="history"){ee(!0);let _=new FormData;_.append("actionType","git_history"),_.append("path",t.path),q(_)}else if(M==="rename")ae(t.path),N(!0);else if(M==="unfold")x?.();else if(M==="fold")h?.();else if(M==="new_file")j.openDialog("file");else if(M==="new_folder")j.openDialog("folder");else if(M==="delete")H(!0);else if(M==="cut")v.cut(se);else if(M==="copy")v.copy(se);else if(M==="compress")y.openCompress(se);else if(M==="extract")y.openExtract(J);else if(M==="duplicate")v.duplicate(J);else if(M==="paste")v.paste(J)},le=(M)=>{M.preventDefault(),I(null);let _=new FormData;_.append("actionType","rename"),_.append("path",t.path),_.append("newPath",te),q(_)},xe=()=>{let M=new FormData;if(M.append("actionType","delete"),se.length>1)M.append("paths",JSON.stringify(se.map((_)=>_.path)));else M.append("path",t.path);q(M)};return{contextMenu:A,contextMenuRef:E,openContextMenu:(M,_)=>C({x:M,y:_}),closeContextMenu:()=>C(null),showRenameModal:R,showDeleteModal:T,showHistoryModal:W,showCreateModal:j.open,createKind:j.kind,createError:j.error,createName:j.name,setCreateName:j.setName,renameValue:te,setRenameValue:ae,renameError:G,busy:F.state!=="idle"||j.busy||v.busy||y.busy,pasteLabel:Q,selectionCount:se.length,isArchive:he,chainLabel:x!==void 0,foldable:h!==void 0,fetcherState:F.state,fetcherData:F.data,handleAction:fe,submitCreate:j.submit,submitRename:le,submitDelete:xe,closeCreate:j.closeDialog,closeDelete:()=>H(!1),closeRename:()=>N(!1),closeHistory:()=>ee(!1)}}function Dt({target:t,dragging:r,clipboard:l,onDragStart:c,onDragEnd:p,onDropOn:f,onHoverAccept:x}){let h=r?.path===t.path,v=Boolean(r)&&!h&&l.moveRefusalFor(r,t)===null,[g,m]=n(!1);return o(()=>{if(!r)m(!1)},[r]),{isDragging:h,acceptsDrop:v,isDropHovered:g&&v,onDragStart:(y)=>{if(y.dataTransfer?.setData("text/plain",t.path),y.dataTransfer)y.dataTransfer.effectAllowed="move";c(t)},onDragEnd:p,onDragOver:(y)=>{if(!r)return;if(y.stopPropagation(),m(v),!v)return;if(y.preventDefault(),y.dataTransfer)y.dataTransfer.dropEffect="move";x?.(t)},onDragLeave:()=>m(!1),onDrop:(y)=>{if(!r)return;if(y.stopPropagation(),!v)return;y.preventDefault(),f(t)}}}var fn=450,Rt=8,mn=700;function Tt({enabled:t,onLongPress:r}){let l=i(null),c=i(null),p=i(0),f=i(r);f.current=r;let x=a(()=>{if(l.current!==null)clearTimeout(l.current),l.current=null;c.current=null},[]);return o(()=>x,[x]),{onTouchStart:(h)=>{if(!t)return;let v=h.touches[0];if(!v)return;x(),c.current={x:v.clientX,y:v.clientY},l.current=setTimeout(()=>{l.current=null;let g=c.current;if(c.current=null,!g)return;p.current=Date.now(),f.current(g.x,g.y)},fn)},onTouchMove:(h)=>{let v=c.current,g=h.touches[0];if(!v||!g)return;if(Math.abs(g.clientX-v.x)>Rt||Math.abs(g.clientY-v.y)>Rt)x()},onTouchEnd:x,onTouchCancel:x,consume:()=>{if(p.current===0)return!1;let h=Date.now()-p.current<mn;return p.current=0,h}}}function hn(t,r,l){if(r||l)return!1;return!Array.isArray(t.children)}function Pe({file:t,rootPath:r,basePath:l,repo:c,onLoadChildren:p,onOpenFile:f,onActionComplete:x,onCreated:h,onRenamed:v,expandedPaths:g,onToggleFolder:m,gitFileMap:k,gitFolderMap:y,clipboard:F,archive:A,selection:C,selectionTargets:E,dragging:R,onDragStart:N,onDragEnd:T,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),[V,J]=n(!1),se=Array.isArray(t.children)?t.children:[],he=(t.path||"").replace(/^\/+/,""),Q=!G?k?.get(he)||k?.get(t.path):void 0,fe=Q?Wn(Q.status,Q.staged):null,le=G?y?.get(he)||y?.get(t.path):null,xe=Boolean(fe),M=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&&hn(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=C.selected.has(t.path),U=wt({file:{path:t.path,name:t.name,basePath:l,rootPath:r,repo:c},selection:E,selected:be,archive:A,diff:{staged:Q?.staged||(Q?.status?Q.status[0]!==" "&&Q.status[0]!=="?":!1),status:fe?.charStatus},onOpenFile:f,onActionComplete:x,onCreated:h,onRenamed:v,onUnfold:W&&Ee({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:F,isFolder:G});pe(U.contextMenuRef,U.closeContextMenu);let Y=Tt({enabled:ae,onLongPress:(X,ge)=>U.openContextMenu(X,ge)}),ke=(X)=>{if(X.stopPropagation(),Y.consume())return;let ge=C.gestureOf(X);if(ge!=="plain"){C.applyGesture(ge,t.path);return}if(C.applyGesture("plain",t.path),G){let ue=!ce;if(z(ue),t.forceExpanded!==void 0)t.forceExpanded=void 0;if(m?.(t.path,ue),!ue)q(!1)}else if(f)f({...t,root:r,repo:c||"."})},ve=(X)=>{X.preventDefault(),X.stopPropagation(),C.ensureForContext(t.path),U.openContextMenu(X.clientX,X.clientY)},de=Dt({target:ye,dragging:R,clipboard:F,onDragStart:N,onDragEnd:T,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(Je,{name:t.name,path:t.path,isFolder:G,isOpen:ce,ignored:M,selected:be,gitStatus:fe,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&&se.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:se.map((X)=>e(Pe,{file:X,rootPath:r,basePath:l,repo:c,onLoadChildren:p,onOpenFile:f,onActionComplete:x,onCreated:h,onRenamed:v,expandedPaths:g,onToggleFolder:m,gitFileMap:k,gitFolderMap:y,clipboard:F,archive:A,selection:C,selectionTargets:E,dragging:R,onDragStart:N,onDragEnd:T,onDropOn:H,onUnfold:W,onFold:ee,foldRoots:te,touch:ae},X.path))}),V&&U.contextMenu&&e(Ze,{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}),V&&e(rt,{actions:U,file:t,isFolder:G,chainLabel:Ee({type:G?"folder":"file",name:t.name})?t.name:void 0})]})}function St({x:t,y:r,pasteLabel:l,busy:c,onAction:p,menuRef:f}){let h=l?104:76,v=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:v},onClick:(m)=>m.stopPropagation(),children:[e("button",{type:"button",onClick:()=>p("new_file"),className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 flex items-center space-x-2 transition-colors",children:[e(ei,{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(on,{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(Ns,{size:13,className:"text-ink/60"}),e("span",{children:l})]})]})}),document.body)}function At({menu:t,menuRef:r,pasteLabel:l,busy:c,onAction:p,create:f}){return e(d,{children:[t&&e(St,{x:t.x,y:t.y,menuRef:r,pasteLabel:l,busy:c,onAction:p}),f.open&&e(Fe,{folderPath:".",kind:f.kind,value:f.name,error:f.error,isLoading:f.busy,onChange:f.setName,onCancel:f.closeDialog,onSubmit:f.submit})]})}function Et({title:t,subject:r,error:l,busy:c,submitLabel:p,busyLabel:f,onSubmit:x,onCancel:h,children:v}){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:x,className:"glass-overlay bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans",children:[e("h3",{className:"font-semibold text-ink mb-1 text-sm",children:t}),e("p",{className:"text-[11px] text-ink/50 mb-3 break-words",children:r}),v,l&&e("p",{className:"text-[11px] text-error mb-2",children:l}),e("div",{className:"flex justify-end space-x-2 mt-3",children:[e("button",{type:"button",onClick: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 gn({entries:t,format:r,name:l,destination:c,formats:p,error:f,busy:x,onFormatChange:h,onNameChange:v,onDestinationChange:g,onCancel:m,onSubmit:k}){let y=t.slice(0,4).map((A)=>A.name).join(", "),F=t.length>4?` +${t.length-4} more`:"";return e(Et,{title:`Compress ${t.length===1?t[0].name:`${t.length} items`}`,subject:`${y}${F}`,error:f,busy:x,submitLabel:"Compress",busyLabel:"Compressing...",onCancel:m,onSubmit:(A)=>{A.preventDefault(),k()},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:(A)=>h(A.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((A)=>e("option",{value:A.id,disabled:!A.available,children:[A.label,A.available?"":` — ${A.tool} not installed`]},A.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:(A)=>v(A.currentTarget.value),"aria-label":"Archive name",className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none mb-3 ${f?"border-error":"border-ink/20 focus:border-ink"}`}),e("label",{className:"block text-[10px] uppercase tracking-wide text-ink/40 mb-1",htmlFor:"archive-destination",children:"Destination folder"}),e("input",{id:"archive-destination",type:"text",value:c,onChange:(A)=>g(A.currentTarget.value),"aria-label":"Archive destination",className:"w-full bg-paper border border-ink/20 rounded px-2 py-1.5 text-xs font-mono focus:outline-none focus:border-ink"})]})}function bn({archive:t,kindLabel:r,destination:l,error:c,busy:p,onDestinationChange:f,onCancel:x,onSubmit:h}){return e(Et,{title:`Extract ${t.name}`,subject:`${r} archive · extracts into a folder`,error:c,busy:p,submitLabel:"Extract",busyLabel:"Extracting...",onCancel:x,onSubmit:(v)=>{v.preventDefault(),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:(v)=>f(v.currentTarget.value),"aria-label":"Extract destination",className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none ${c?"border-error":"border-ink/20 focus:border-ink"}`})]})}function Mt({archive:t}){if(t.compress)return e(gn,{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(bn,{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 Lt(){let[t,r]=S("files.outlineExpanded",!1),l=br(),c=$e(eA,Xg),{symbols:p,total:f,truncated:x,notice:h}=Nu({content:c.content,language:c.language,state:c.state,note:c.note,path:c.path});if(c.state==="diff")return null;let v=c.preview,g=(m,k)=>{if(!c.path)return;if(v){let y=Ou(p,k);if(y)Wi({path:c.path,...y});return}Hi({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(Wr,{size:12}),e("span",{children:"Outline"}),f>0&&e("span",{className:"font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] text-ink/50",children:x?`${p.length}/${f.toLocaleString()}`:f})]})}),e("div",{className:"section-reveal","data-expanded":t,id:l,inert:!t,children:e("div",{children:e("div",{className:"px-2 pb-2",children:p.length===0?e("div",{className:"px-1 text-[10px] text-ink/40 italic py-1",children:h}):e("div",{className:"max-h-48 overflow-y-auto scrollbar-overlay-container flex flex-col",children:[p.map((m,k)=>e("button",{type:"button",onClick:()=>g(m,k),"aria-label":v?`${Ko(m.kind)} ${m.name}`:`${Ko(m.kind)} ${m.name}, line ${m.line}`,title:v?`Jump to ${Ko(m.kind).toLowerCase()}`:`${Ko(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(Du,{kind:m.kind}),e("span",{className:"min-w-0 flex-1 truncate text-[11px] font-mono text-ink/80",children:m.name}),!v&&e("span",{className:"flex-shrink-0 font-mono text-[10px] text-ink/35",children:m.line})]},`${m.line}:${m.kind}:${m.name}`)),x&&e("div",{className:"px-1 py-1 text-[10px] italic text-ink/40",children:Qu(f)})]})})})})]})}function Ie(t,r){return Ae(t.map((l)=>xn(l,r)))}function xn(t,r){if(t.type!=="folder")return t;let l=r[t.path];if(!l)return t;return{...t,children:Ie(l,r)}}function vn(t){let r=t.lastIndexOf("/");return r===-1?".":t.slice(0,r)}function Ot(t){let r=t.lastIndexOf("/");return r===-1?t:t.slice(r+1)}function $t(t){return[...t].sort((r,l)=>{if(r.type!==l.type)return r.type==="folder"?-1:1;return r.name.localeCompare(l.name)})}function He(t,r,l){let c=l.path.split("/"),p=c.slice(0,-1).join("/"),f=[...t],x={...r},h=f,v=null;for(let g=0;g<c.length-1;){let m=c.slice(0,g+1).join("/"),k=h.find((E)=>E.type==="folder"&&E.path===m),y=k?null:h.find((E)=>E.type==="folder"&&E.path.startsWith(`${m}/`)&&(p===E.path||p.startsWith(`${E.path}/`))),F=k??y,A=F?x[F.path]??F.children:null;if(F&&!Array.isArray(A))return{nodes:t,cache:r};if(!F){let E=yn(h,x,m);if(E){h=E;let R=h.find((T)=>T.path===m),N=Array.isArray(R?.children)?[...R.children]:[];x[m]=N,h=N,v=m,g+=1;continue}}let C=Array.isArray(A)?[...A]:[];if(F){x[F.path]=C,h=C,v=F.path,g=F.path.split("/").length;continue}h.push({name:c[g],path:m,type:"folder",ignored:!1}),x[m]=C,h=C,v=m,g+=1}if(h.push(l),v!==null)x[v]=$t(h);return f=$t(f),{nodes:f,cache:x}}function yn(t,r,l){let c=t.findIndex((v)=>v.type==="folder"&&v.path.startsWith(`${l}/`));if(c===-1)return null;let p=t[c],f=p.path.slice(l.length+1).split("/"),x=r[p.path]??p.children;if(Array.isArray(x))r[p.path]=x;let h={name:f[f.length-1],path:p.path,type:"folder",ignored:p.ignored,...Array.isArray(x)?{children:x}:{}};for(let v=f.length-2;v>=0;v-=1)h={name:f[v],path:`${l}/${f.slice(0,v+1).join("/")}`,type:"folder",ignored:!1,children:[h]};return t[c]={name:Ot(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=vn(l),f=r[p],x=f?.find((m)=>m.path===l);if(f&&x)return{entry:x,nodes:t,cache:{...r,[p]:f.filter((m)=>m.path!==l)}};let v=Object.keys(r).filter((m)=>l.startsWith(`${m}/`)&&r[m].some((k)=>k.path===l)).sort((m,k)=>k.length-m.length)[0];if(!v)return{entry:null,nodes:t,cache:r};let g=r[v];return{entry:g.find((m)=>m.path===l),nodes:t,cache:{...r,[v]:g.filter((m)=>m.path!==l)}}}function Pt(t,r,l){let c=!1,p=t.map((f)=>{let x=f.path===r||f.path.startsWith(`${r}/`),h=Array.isArray(f.children)?Pt(f.children,r,l):void 0;if(!x&&h===f.children)return f;c=!0;let v=x?f.path===r?l:`${l}${f.path.slice(r.length)}`:f.path,g=x?{...f,path:v,name:Ot(v)}:{...f};if(h!==void 0)g.children=h;return g});return c?p:t}function It(t,r,l){let c={};for(let[p,f]of Object.entries(t)){let x=p===r?l:p.startsWith(`${r}/`)?`${l}${p.slice(r.length)}`:p;c[x]=x===p?f:Pt(f,r,l)}return c}function Ht(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 Gt(t){if(!w(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)=>w(r)):[],root:t.root}}async function Ge(t){try{return Gt(await(await fetch(t)).json())}catch{return{status:"failed"}}}function Kt({enabled:t,rootPath:r,activeRepo:l,expandedPaths:c,onExpansionPruned:p}){let f=`${r??""}\x00${l}`,[x,h]=n({scope:"",files:[],root:""}),[v,g]=n(!1),m=i({}),k=i([]),y=i(f);y.current=f;let F=i(""),A=i(""),C=i(c);C.current=c;let E=(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()}`},R=(I,z)=>{F.current=I,A.current=z;let K=Ie(k.current,m.current);return h({scope:I,files:K,root:z}),K},N=async(I)=>{let z=[...C.current];if(z.length===0)return;let K=await Promise.all(z.map(async(V)=>({path:V,read:await Ge(E(V))})));if(y.current!==I)return;let j=[];for(let{path:V,read:J}of K)if(J.status==="ok")m.current[V]=J.files;else if(J.status==="missing")j.push(V);if(j.length===0)return;let ne=new Set(j);for(let V of j)delete m.current[V];let q=new Set([...C.current].filter((V)=>!ne.has(V)));C.current=q,p(q)},T=async()=>{if(!t)return;let I=y.current;g(!0);try{let z=await Ge(E());if(y.current!==I)return;if(z.status!=="ok")return;if(F.current!==I)m.current={};if(k.current=z.files,R(I,z.root),await N(I),y.current!==I)return;R(I,z.root)}finally{if(y.current===I)g(!1)}},H=async(I)=>{let z=y.current,K=await Ge(E(I));if(y.current!==z||K.status!=="ok")return;if(m.current[I]=K.files,F.current===z)R(z,A.current)},W=(I)=>{let z=Gt(I);if(z.status!=="ok")return;let K=y.current;if(F.current!==K)m.current={};k.current=z.files,R(K,z.root),N(K).then(()=>{if(y.current===K)R(K,z.root)})},ee=()=>{m.current={},k.current=[],F.current="",A.current="",h({scope:"",files:[],root:""})},te=(I)=>{let z=y.current;if(F.current!==z)return null;let K={name:I.path.slice(I.path.lastIndexOf("/")+1),path:I.path,type:I.kind,ignored:!1},j=He(k.current,m.current,K);if(j.nodes===k.current)return null;return k.current=j.nodes,m.current=j.cache,R(z,A.current)},ae=(I,z)=>{let K=y.current;if(F.current!==K)return null;let j=zt(k.current,m.current,I);if(!j.entry)return null;m.current=It(j.cache,I,z);let ne={...j.entry,path:z,name:z.slice(z.lastIndexOf("/")+1)},q=He(j.nodes,m.current,ne);return k.current=q.nodes,m.current=q.cache,R(K,A.current)},G=x.scope===f;return{scope:f,files:G?x.files:[],root:G?x.root:"",isLoading:v,reload:T,loadChildren:H,adoptRoot:W,insertEntry:te,moveEntry:ae,reset:ee}}function _t({rootPath:t,repo:r,onComplete:l,onError:c}){let p=st(),[f,x]=S("files.clipboard",null),h=ht(f),v=ct(t,r),g=i(!1),m=i(null);o(()=>{if(p.state!=="idle"||!p.data)return;let C=p.data;if(m.current===C)return;m.current=C;let E=g.current;if(g.current=!1,C.success){if(E)x(null);if(C.failures?.length)c(`${C.failures.length} item(s) could not be moved: ${C.failures[0].error}`);l()}else c(C.error||"The transfer did not complete")},[p.state,p.data]);let k=a((C,E)=>{g.current=E;let R=new FormData;for(let[N,T]of Object.entries(C))R.append(N,T);if(r&&r!==".")R.append("repo",r);if(t)R.append("root",t);p.submit(R,{method:"post",action:"/api/fs/action"})},[p,r,t]),y=a((C)=>ft(h,v,Le(C.path,C.kind)),[h,v]),F=a((C,E)=>ut(C,Le(E.path,E.kind)),[]),A=a((C,E,R,N)=>{let T=new FormData;T.append("actionType","paste"),T.append("mode",R),T.append("targetPath",E.path),T.append("targetKind",E.kind);for(let H of C)T.append("sourcePath",H.path);if(r&&r!==".")T.append("repo",r);if(t)T.append("root",t);g.current=N,p.submit(T,{method:"post",action:"/api/fs/action"})},[p,r,t]);return{clip:h,busy:p.state!=="idle",refusalFor:y,moveRefusalFor:F,copy:(C)=>{if(C.length===0)return;x({scope:v,entries:C.map(({path:E,name:R,kind:N})=>({path:E,name:R,kind:N})),mode:"copy"})},cut:(C)=>{if(C.length===0)return;x({scope:v,entries:C.map(({path:E,name:R,kind:N})=>({path:E,name:R,kind:N})),mode:"cut"})},duplicate:(C)=>{k({actionType:"duplicate",path:C.path},!1)},move:(C,E)=>{let R=F(C,E);if(R){c(R);return}A([C],E,"cut",Boolean(h?.mode==="cut"&&h.entries.some((N)=>N.path===C.path)))},paste:(C)=>{if(!h)return;let E=y(C);if(E){c(E);return}A(h.entries.map(({path:R,name:N,kind:T})=>({path:R,name:N,kind:T})),C,h.mode,h.mode==="cut")}}}var kn=Oe.map((t)=>({...t,available:!0,tool:t.id}));function Wt({rootPath:t,repo:r,onComplete:l}){let c=st(),[p,f]=n(kn),[x,h]=n(null),[v,g]=n(null),[m,k]=n(null),y=i(null),F=i(null);o(()=>{let N=!1;return(async()=>{try{let H=await(await fetch("/api/fs/archive")).json();if(!N&&Array.isArray(H.formats)&&H.formats.length>0)f(H.formats)}catch{}})(),()=>{N=!0}},[]),o(()=>{if(c.state!=="idle"||!c.data)return;let N=c.data;if(F.current===N)return;F.current=N;let T=y.current;if(y.current=null,N.success){if(k(null),T==="compress")h(null);if(T==="extract")g(null);l()}else if(T)k(N.error||"The archive request failed")},[c.state,c.data]);let A=a((N)=>{let T=new FormData;for(let[H,W]of Object.entries(N))T.append(H,W);if(r&&r!==".")T.append("repo",r);if(t)T.append("root",t);c.submit(T,{method:"post",action:"/api/fs/action"})},[c,r,t]),C=a((N)=>{if(N.length===0)return;let T=p.find((H)=>H.id==="zip"&&H.available)?.id??p.find((H)=>H.available)?.id??"zip";k(null),g(null),h({entries:N.map(({path:H,name:W,kind:ee})=>({path:H,name:W,kind:ee})),format:T,name:Re(N,T),destination:Ct(N)})},[p]),E=a((N)=>{k(null),h(null),g({archive:N,destination:Ft(N.path)})},[]),R=a((N)=>{h((T)=>{if(!T)return T;let H=Re(T.entries,T.format),W=T.name===H?Re(T.entries,N):T.name;return{...T,format:N,name:W}})},[]);return{formats:p,compress:x,extract:v,error:m,busy:c.state!=="idle",openCompress:C,openExtract:E,setFormat:R,setName:(N)=>h((T)=>T&&{...T,name:N}),setCompressDestination:(N)=>h((T)=>T&&{...T,destination:N}),setExtractDestination:(N)=>g((T)=>T&&{...T,destination:N}),cancel:()=>{h(null),g(null),k(null)},submitCompress:()=>{let N=x;if(!N)return;y.current="compress",k(null),A({actionType:"compress",format:N.format,name:N.name.trim(),destination:N.destination.trim()||".",paths:JSON.stringify(N.entries.map((T)=>T.path))})},submitExtract:()=>{let N=v;if(!N)return;y.current="extract",k(null),A({actionType:"extract",path:N.archive.path,destination:N.destination.trim()||"."})}}}function Cn(t){if(t.shiftKey)return"range";if(t.metaKey||t.ctrlKey)return"toggle";return"plain"}function Fn(t,r,l){if(!r)return[l];let c=t.indexOf(r),p=t.indexOf(l);if(c===-1||p===-1)return[l];let f=Math.min(c,p),x=Math.max(c,p);return t.slice(f,x+1)}function Ut(t){let[r,l]=n(()=>new Set),[c,p]=n(null),f=a((g,m)=>{if(g==="range"){l(new Set(Fn(t,c,m)));return}if(p(m),g==="toggle"){l((k)=>{let y=new Set(k);if(y.has(m))y.delete(m);else y.add(m);return y});return}l(new Set([m]))},[c,t]),x=a((g)=>{l((m)=>{if(m.has(g))return m;return new Set([g])}),p(g)},[]),h=a(()=>{l(new Set),p(null)},[]),v=a(Cn,[]);return u(()=>({selected:r,count:r.size,anchor:c,gestureOf:v,applyGesture:f,ensureForContext:x,clear:h}),[r,c,v,f,x,h])}function Ke(t,r,l=0,c=[]){for(let p of t)if(c.push({path:p.path,name:p.name,kind:p.type==="folder"?"folder":"file",depth:l}),p.type==="folder"&&r(p)&&Array.isArray(p.children))Ke(p.children,r,l+1,c);return c}function Xt({listing:t,setExpandedPaths:r,setStoredExpandedPaths:l,reload:c,onMoved:p}){let f=a((v,g)=>{let m=lt(g,v);if(m.length===0)return;r((k)=>{if(m.every((F)=>k.has(F)))return k;let y=new Set(k);for(let F of m)y.add(F);return l(Array.from(y)),y})},[r,l]),x=a((v)=>{let g=t.insertEntry(v);if(!g){c();return}f(v.path,g)},[t,c,f]),h=a((v,g)=>{p?.(v,g),r((k)=>{let y=Ht(k,v,g);return l(Array.from(y)),y});let m=t.moveEntry(v,g);if(!m){c();return}f(g,m)},[t,c,f,r,l,p]);return{insertCreated:x,moveRenamed:h}}var Nn=new Set;function Vt({scope:t,setExpandedPaths:r,setStoredExpandedPaths:l}){let[c,p]=n({scope:t,chains:new Map}),f=a((v)=>{let g=Me(v.path,v.name);if(!g)return;p((k)=>{let y=k.scope===t?k.chains:new Map;if(y.get(v.path)?.length===g.length)return k;let A=new Map(y);return A.set(v.path,g),{scope:t,chains:A}});let m=g.slice(0,-1);r((k)=>{if(m.every((F)=>k.has(F)))return k;let y=new Set(k);for(let F of m)y.add(F);return l(Array.from(y)),y})},[t,r,l]),x=a((v)=>{let g=c.scope===t?c.chains.get(v):void 0;if(!g)return;let m=g.slice(0,-1);p((k)=>{if(k.scope!==t)return k;let y=new Map(k.chains);return y.delete(v),{scope:t,chains:y}}),r((k)=>{if(!m.some((F)=>k.has(F)))return k;let y=new Set(k);for(let F of m)y.delete(F);return l(Array.from(y)),y})},[t,c,r,l]),h=a((v,g)=>{let m=c.scope===t?c.chains:null;if(!m)return;let k=new Map,y=[],F=!1;for(let[A,C]of m){if(C.findIndex((T,H)=>T===v&&H>0&&H<C.length-1)!==-1){F=!0;continue}let R=C.map((T)=>T===v?g:T.startsWith(`${v}/`)?`${g}${T.slice(v.length)}`:T),N=R[R.length-1];if(N!==A||R.some((T,H)=>T!==C[H]))F=!0;k.set(N,R),y.push(...R.slice(0,-1))}if(!F)return;p({scope:t,chains:k}),r((A)=>{if(y.every((E)=>A.has(E)))return A;let C=new Set(A);for(let E of y)C.add(E);return l(Array.from(C)),C})},[t,c,r,l]);return{unfolded:c.scope===t&&c.chains.size>0?new Set(c.chains.keys()):Nn,unfold:f,fold:x,rekey:h}}function qt(t,r){let l=r.trim().toLowerCase();if(!l)return t;let c=(p)=>{let f=p.name.toLowerCase().includes(l);if(p.type==="folder"){let x=(p.children||[]).map(c).filter((h)=>h!==null);if(f||x.length>0)return{...p,children:f&&x.length===0?p.children:x,forceExpanded:!0};return null}return f?p:null};return t.map(c).filter((p)=>p!==null)}function Bt({dragging:t,clipboard:r,target:l}){let c=Boolean(t)&&r.moveRefusalFor(t,l)===null,[p,f]=n(!1);return o(()=>{if(!t)f(!1)},[t]),{accepts:c,highlighted:p&&c,onDragEnter:()=>{if(t)f(!0)},onDragLeave:(x)=>{if(!x.currentTarget.contains(x.relatedTarget))f(!1)},onDragOver:(x)=>{if(!c)return;if(x.preventDefault(),x.dataTransfer)x.dataTransfer.dropEffect="move"},onDrop:(x)=>{if(!c)return;x.preventDefault(),f(!1),r.move(t,l)}}}function ci({className:t="",enabled:r=!0,active:l=!0,rootPath:c,onOpenFile:p,refreshKey:f=0,onRefresh:x}){let[h,v]=S("files.searchQuery",""),[g,m,k]=S("files.expandedPaths",[]),[y,F]=n(()=>new Set(g)),{activeRepo:A,setActiveRepo:C}=lr(c),{repos:E,scanning:R,rescan:N}=cr(c,r),{fileMap:T,folderMap:H,refreshGitStatus:W}=Fs(c,A,r),[ee,te]=n(null),ae=i(null);o(()=>{if(!k)return;F((P)=>{let Z=new Set(g);if(P.size===Z.size&&Array.from(Z).every((me)=>P.has(me)))return P;return Z})},[k,g]);let G=Kt({enabled:r,rootPath:c,activeRepo:A,expandedPaths:y,onExpansionPruned:(P)=>{F(P),m(Array.from(P))}});o(()=>{if(!k||!l)return;G.reload()},[f,c,r,A,k,l]);let I=r&&k?zg(G.scope):null,z=we(I);o(()=>{if(z.data)G.adoptRoot(z.data)},[z.data]);let K=(P)=>(W(),G.loadChildren(P)),j=(P,Z)=>{let me=new Set(y);if(Z)me.add(P);else me.delete(P);F(me),m(Array.from(me))},{unfolded:ne,unfold:q,fold:V,rekey:J}=Vt({scope:G.scope,setExpandedPaths:F,setStoredExpandedPaths:m}),se=G.files,he=ot(se,ne),Q=qt(he.nodes,h),fe=Ke(Q,(P)=>P.forceExpanded!==void 0?P.forceExpanded:y.has(P.path)),le=Ut(fe.map((P)=>P.path)),xe=fe.filter((P)=>le.selected.has(P.path)).map(({path:P,name:Z,kind:me})=>({path:P,name:Z,kind:me})),M=(P)=>{if(P===A)return;G.reset(),F(new Set),m([]),le.clear(),C(P)},_=()=>{if(W(),x)x();else G.reload()},{insertCreated:ce,moveRenamed:ye}=Xt({listing:G,setExpandedPaths:F,setStoredExpandedPaths:m,reload:_,onMoved:(P,Z)=>J(P,Z)}),be=Ru(),{pushToast:U}=je(),Y=_t({rootPath:c,repo:A,onComplete:_,onError:(P)=>U(P,"error")}),ke=Wt({rootPath:c,repo:A,onComplete:_}),ve={path:".",name:".",kind:"folder"},de=Y.clip&&!Y.refusalFor(ve)?`Paste ${De(Y.clip)??"item"}`:null,[X,ge]=n(null),ue=Bt({dragging:X,clipboard:Y,target:ve}),Te=Ne({folderPath:".",rootPath:c,repo:A,onCreated:ce,onOpenCreated:(P)=>p?.({...P,root:c,repo:A})}),[_e,Qt]=n(!1);o(()=>Qt(!0),[]);let{count:We,clear:Ue}=le;if(o(()=>{if(!l)return;let P=(Z)=>{if(Z.key==="Escape"&&We>0)Ue()};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[l,We,Ue]),!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 Yt=G.isLoading||z.refreshing;return e("div",{className:`flex flex-col h-full bg-paper ${t}`,children:[e(Ye,{rootPath:c,activeRepo:A,repos:E,reposScanning:R,onRefreshRepos:N,onSelectRepo:M,searchQuery:h,onSearchChange:v,onRefresh:_,refreshing:Yt}),e("div",{className:`flex-1 scrollbar-overlay-container p-2 font-mono text-[11px] text-ink/80 ${be?"file-tree-touch":""} ${ue.highlighted?"bg-info/[0.06]":""}`,onContextMenu:(P)=>{P.preventDefault(),te({x:P.clientX,y:P.clientY})},onDragEnter:ue.onDragEnter,onDragLeave:ue.onDragLeave,onDragOver:ue.onDragOver,onDrop:ue.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(Pe,{file:P,rootPath:c,basePath:G.root,repo:A,onLoadChildren:K,onOpenFile:p,onActionComplete:_,onCreated:ce,onRenamed:ye,expandedPaths:y,onToggleFolder:j,gitFileMap:T,gitFolderMap:H,clipboard:Y,archive:ke,selection:le,selectionTargets:xe,dragging:X,onDragStart:ge,onDragEnd:()=>ge(null),onDropOn:(Z)=>{if(!X)return;Y.move(X,Z)},onUnfold:q,onFold:V,foldRoots:he.roots,touch:be},P.path))}),e(Lt,{}),_e&&e(At,{menu:ee,menuRef:ae,pasteLabel:de,busy:Y.busy,create:Te,onAction:(P)=>{if(te(null),P==="new_file")Te.openDialog("file");if(P==="new_folder")Te.openDialog("folder");if(P==="paste")Y.paste(ve)}}),_e&&e(Mt,{archive:ke})]})}export{ci as FileExplorer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d,n,i,a,e,s,I,C,rt,Me}from"./index-d8kjsgpt.js";var q={name:"ticket",size:24,node:[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]},S=s(q);function P({providerName:t,providerSlug:r,iconUrl:o,credentialSources:l,error:p,note:c,children:m}){return e("section",{className:"bg-paper border border-ink/15 rounded-lg shadow-xs",children:[e("header",{className:"flex items-center justify-between gap-2 px-3.5 py-2.5 border-b border-ink/10",children:[e("span",{className:"flex min-w-0 items-center gap-2",children:[r&&e(Me,{provider:{slug:r,name:t,...o?{iconUrl:o}:{}},size:20}),e("span",{className:"truncate text-xs font-semibold text-ink",children:t})]}),e("span",{className:"text-[10px] font-mono uppercase tracking-wider text-ink/50 truncate",title:`Credentials from ${l.join(", ")}`,children:l.join(" · ")})]}),e("div",{className:"p-3.5 space-y-4",children:[p&&e("p",{className:"flex items-start gap-2 text-error text-xs leading-relaxed",children:[e(I,{size:14,className:"shrink-0 mt-0.5"}),e("span",{className:"break-words",children:p})]}),m,c&&e("p",{className:"text-[10px] text-ink/50 leading-relaxed border-t border-ink/10 pt-2.5",children:c})]})]})}var B=new Intl.NumberFormat("id-ID",{style:"currency",currency:"IDR",maximumFractionDigits:0}),j=new Intl.NumberFormat("id-ID"),y=new Intl.NumberFormat("id-ID",{minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!1}),G=new Intl.DateTimeFormat("id-ID",{dateStyle:"medium",timeStyle:"short"});function x(t){return B.format(t)}function b(t){return j.format(t)}function ea(t){let r=new Date(t);if(Number.isNaN(r.getTime()))return t;return G.format(r)}function L(t,r){if(r<=0)return 0;return Math.min(100,Math.max(0,t/r*100))}function T(t,r){if(r<=0)return"0%";return`${new Intl.NumberFormat("id-ID",{maximumFractionDigits:1}).format(t/r*100)}%`}function k(t){if(!Number.isFinite(t))return"0";let r=Math.abs(t);if(r>=1e9)return`${y.format(t/1e9)}B`;if(r>=1e6)return`${y.format(t/1e6)}M`;if(r>=1000)return`${y.format(t/1000)}K`;return b(t)}function N(t){let r=Number(t);if(t.trim()===""||!Number.isFinite(r))return t;return b(r)}var O=new Intl.NumberFormat("id-ID",{minimumFractionDigits:2,maximumFractionDigits:2});function U(t){if(!Number.isFinite(t))return"$0,00";return`$${O.format(t)}`}function w(t,r){if(!Number.isFinite(t))return"—";switch(r){case"percent":return`${new Intl.NumberFormat("id-ID",{maximumFractionDigits:1}).format(t)}%`;case"usd":return U(t);case"tokens":case"bytes":return k(t);default:return b(t)}}function D(t){if(!Number.isFinite(t))return"0%";return`${new Intl.NumberFormat("id-ID",{maximumFractionDigits:1}).format(t*100)}%`}function z({window:t}){let r=t.usedRp+t.remainingRp,o=L(t.usedRp,r);return e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-[11px] font-semibold text-ink",children:t.label}),e("span",{className:"text-[10px] text-ink/50",children:["Resets ",ea(t.resetsAt)]})]}),e("div",{className:"h-1.5 w-full bg-ink/10 rounded-full overflow-hidden",children:e("div",{className:"h-full bg-ink/80 rounded-full",style:{width:`${o}%`}})}),e("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-0.5 text-[10px] text-ink/60",children:[e("span",{children:["Used ",e("span",{className:"font-semibold text-ink",children:x(t.usedRp)})," ·"," ",T(t.usedRp,r)]}),e("span",{children:["Remaining ",e("span",{className:"font-semibold text-ink",children:x(t.remainingRp)})]})]})]})}function H({coupon:t}){return e("div",{className:"bg-ink/5 border border-ink/10 rounded-lg p-3 shadow-xs",children:[e("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e(S,{size:12,className:"text-ink/60"}),e("span",{className:"text-[11px] font-semibold text-ink",children:["Active coupon · ",t.name]})]}),e("div",{className:"text-[10px] text-ink/60 space-y-0.5",children:[e("div",{children:["Remaining"," ",e("span",{className:"font-semibold text-ink",children:t.remainingRp===null?"Unlimited":x(t.remainingRp)})," ","· Used ",e("span",{className:"font-semibold text-ink",children:x(t.usedRp)})]}),e("div",{children:["Expires ",ea(t.expiresAt)]}),t.scopeModels.length>0&&e("div",{children:["Models: ",t.scopeModels.join(", ")]})]})]})}function A({quota:t}){if(!t)return e("p",{className:"text-[11px] text-ink/50",children:"Quota data is not available for this account."});return e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:"Quota windows"}),t.planName&&e("span",{className:"text-[10px] text-ink/60",children:["Plan ",e("span",{className:"font-semibold text-ink",children:t.planName})]})]}),t.windows.length===0?e("p",{className:"text-[11px] text-ink/50",children:"No quota windows reported."}):e("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2.5",children:t.windows.map((r)=>e(z,{window:r},r.key))}),t.coupon&&e(H,{coupon:t.coupon})]})}function F({usage:t}){if(!t)return e("p",{className:"text-[11px] text-ink/50",children:"The 30-day usage report is not available."});let r=t.rows.reduce((l,p)=>l+p.inputTokens,0),o=t.rows.reduce((l,p)=>l+p.outputTokens,0);return e("div",{className:"space-y-2",children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:"30-day usage by model"}),e("div",{className:"overflow-x-auto border border-ink/15 rounded-lg shadow-xs",children:e("table",{className:"w-full text-[11px]",children:[e("thead",{className:"bg-ink/5 text-ink/60",children:e("tr",{children:[e("th",{className:"text-left font-semibold px-3 py-2 whitespace-nowrap",children:"Model"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Requests"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Input tokens"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Output tokens"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Cost"})]})}),e("tbody",{className:"divide-y divide-ink/10",children:t.rows.length===0?e("tr",{children:e("td",{colSpan:5,className:"px-3 py-3 text-center text-ink/50",children:"No usage recorded in the last 30 days."})}):t.rows.map((l)=>e("tr",{children:[e("td",{className:"px-3 py-1.5 font-mono text-ink whitespace-nowrap",children:l.model}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:b(l.requests)}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:k(l.inputTokens)}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:k(l.outputTokens)}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:x(l.costRp)})]},l.model))}),e("tfoot",{className:"bg-ink/5 border-t border-ink/15 font-semibold text-ink",children:e("tr",{children:[e("td",{className:"px-3 py-2",children:"Total"}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:b(t.totalRequests)}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:k(r)}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:k(o)}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:x(t.totalCostRp)})]})})]})})]})}function E({report:t}){let{balance:r,usage:o,quota:l}=t;if(!r&&!o&&!l)return e("p",{className:"text-[11px] text-ink/50",children:"No kenari data was returned for this account."});let p=r?r.amountRp!==null?x(r.amountRp):r.raw:"–",c=r?r.amountRp!==null?r.raw:"Amount could not be parsed":"Balance unavailable",m=o?o.rows.reduce((g,u)=>g+u.inputTokens+u.outputTokens,0):0;return e(d,{children:[e("div",{className:"@container",children:e("div",{className:"grid grid-cols-3 @[540px]:grid-cols-5 gap-2.5 items-stretch",children:[e(rt,{value:p,label:"Wallet balance",hint:c}),e(rt,{value:l?.planName??"–",label:"Active plan",hint:l?"kenari quota plan":"Quota unavailable"}),e(rt,{value:o?b(o.totalRequests):"–",label:"Requests (30 days)",hint:o?"Across all models":"Usage report unavailable"}),e(rt,{value:o?x(o.totalCostRp):"–",label:"Cost (30 days)",hint:o?"Billed in Rupiah":"Usage report unavailable"}),e(rt,{value:o?k(m):"–",label:"Tokens processed (30 days)",hint:o?"Input + output":"Usage report unavailable",tone:"muted",className:"col-span-2 @[540px]:col-span-1"})]})}),e(A,{quota:l}),e(F,{usage:o})]})}function W({report:t}){let r=t.balance;if(!r)return e("p",{className:"text-[11px] text-ink/50",children:"DeepSeek balance data is not available."});return e(d,{children:[e("div",{className:"@container",children:e("div",{className:"grid grid-cols-3 @[540px]:grid-cols-5 gap-2.5 items-stretch",children:[e(rt,{value:r.isAvailable?"Available":"Unavailable",label:"Prepaid balance",hint:r.isAvailable?"Account can spend":"Top up required",tone:r.isAvailable?"default":"muted"}),e(rt,{value:b(r.entries.length),label:"Currency buckets",hint:r.entries.length>0?"From the balance endpoint":"No entries returned",tone:"muted"})]})}),r.entries.length===0?e("p",{className:"text-[11px] text-ink/50",children:"The balance endpoint returned no currency entries."}):e("div",{className:"grid grid-cols-1 gap-2.5",children:r.entries.map((o)=>e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs",children:[e("div",{className:"flex items-center justify-between gap-2 mb-2",children:[e("span",{className:"text-[11px] font-semibold text-ink",children:o.currency}),e("span",{className:"text-[10px] font-mono uppercase tracking-wider text-ink/40",children:"Balance"})]}),e("dl",{className:"grid grid-cols-3 gap-2 text-[10px]",children:[e("div",{children:[e("dt",{className:"text-ink/50",children:"Total"}),e("dd",{className:"font-semibold text-ink tabular-nums break-words",children:N(o.totalBalance)})]}),e("div",{children:[e("dt",{className:"text-ink/50",children:"Granted"}),e("dd",{className:"font-semibold text-ink tabular-nums break-words",children:N(o.grantedBalance)})]}),e("div",{children:[e("dt",{className:"text-ink/50",children:"Topped up"}),e("dd",{className:"font-semibold text-ink tabular-nums break-words",children:N(o.toppedUpBalance)})]})]})]},o.currency))})]})}function R(t,r,o,l){let p=t.find((c)=>c.id===r);if(p){p.limits.push(l);return}t.push({id:r,title:o,limits:[l]})}function V(t){let r=(t.split(":")[1]??"").toLowerCase();if(r==="google")return{id:"google",title:"Google"};if(r==="anthropic"||r==="openai")return{id:"third-party",title:"Claude & GPT (shared)"};if(r==="default"||r==="")return{id:"default",title:"Usage"};return{id:r,title:r}}function X(t){let r=[];for(let o of t)if(o.id==="anthropic:extra")R(r,"balance","Balance",o);else R(r,"windows","Quota windows",o);return r}function J(t){let r=[];for(let o of t){let l=V(o.id);if(l.id==="third-party"){if(r.find((c)=>c.id==="third-party")?.limits.some((c)=>Z(c,o)))continue}R(r,l.id,l.title,o)}return r}function Z(t,r){return t.unit===r.unit&&t.label===r.label&&t.usedFraction===r.usedFraction&&t.remaining===r.remaining&&t.resetsAt===r.resetsAt}function _(t,r){if(r.length===0)return[];let o=t.trim().toLowerCase();if(o==="anthropic")return X(r);if(o==="google-antigravity")return J(r);return[{id:"all",title:"Quota windows",limits:[...r]}]}function Y({limit:t}){let r=Math.min(100,Math.max(0,(t.usedFraction??0)*100)),o=t.modelId??t.accountId,l=t.used!==void 0?w(t.used,t.unit):void 0,p=t.limit!==void 0?w(t.limit,t.unit):void 0,c=t.remaining!==void 0?w(t.remaining,t.unit):void 0;return e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs space-y-2",children:[e("div",{className:"flex items-start justify-between gap-2",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-[11px] font-semibold text-ink truncate",children:[t.label,t.windowLabel&&e("span",{className:"ml-1.5 rounded border border-ink/15 px-1 py-px font-mono text-[9px] font-normal text-ink/50",children:t.windowLabel})]}),o&&e("div",{className:"text-[10px] text-ink/50 truncate",children:o})]}),e("span",{className:"text-[10px] text-ink/50 flex-shrink-0 whitespace-nowrap",children:t.resetsAt!==void 0?`Resets ${ea(new Date(t.resetsAt).toISOString())}`:""})]}),e("div",{className:"h-1.5 w-full bg-ink/10 rounded-full overflow-hidden",children:e("div",{className:`h-full rounded-full ${t.status==="exhausted"?"bg-error/70":"bg-ink/80"}`,style:{width:`${r}%`}})}),e("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-0.5 text-[10px] text-ink/60",children:[e("span",{children:["Used"," ",e("span",{className:"font-semibold text-ink",children:t.unit==="percent"||!l?D(t.usedFraction??0):l}),t.unit!=="percent"&&l&&p?` of ${p}`:""]}),e("span",{className:"flex items-center gap-2",children:[t.status!=="ok"&&t.status!=="unknown"&&e("span",{className:"text-[10px] font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/70",children:t.status}),c&&e("span",{children:["Remaining ",e("span",{className:"font-semibold text-ink",children:c})]})]})]}),t.notes&&t.notes.length>0&&e("ul",{className:"text-[10px] text-ink/50 leading-relaxed space-y-0.5",children:t.notes.map((m)=>e("li",{children:m},m))})]})}function Q({providerId:t,limits:r,tracked:o,unavailable:l,notes:p}){let c=_(t,r);return e("div",{className:"space-y-2",children:[p&&p.length>0&&e("ul",{className:"text-[10px] text-ink/50 leading-relaxed space-y-0.5",children:p.map((m)=>e("li",{children:m},m))}),c.length===0?e(d,{children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:"Quota windows"}),e("p",{className:"text-[11px] text-ink/50",children:!o?"No quota source for this provider: omp ships no usage adapter for it and it exposes no balance endpoint Kabmo knows.":l?"omp tracks this provider but its usage endpoint returned no data — an invalid or expired credential, an unreachable endpoint, or a plan without quota windows.":"No quota windows were reported for this provider."})]}):c.map((m)=>e("div",{className:"@container space-y-2",children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:m.title}),e("div",{className:"grid grid-cols-1 @[520px]:grid-cols-2 gap-2.5",children:m.limits.map((g)=>e(Y,{limit:g},g.id))})]},m.id))]})}var ee="DeepSeek exposes no usage or quota API — only the prepaid balance (and the web console at platform.deepseek.com) is available.";function ou({summary:t}){let r=Boolean(t.kenari||t.deepseek);return e(P,{providerName:t.name,providerSlug:t.id,iconUrl:t.iconUrl,credentialSources:t.credentialSources,error:t.error,note:t.deepseek?ee:void 0,children:[t.kenari&&e(E,{report:t.kenari}),t.deepseek&&e(W,{report:t.deepseek}),!r&&(t.limits.length>0||!t.error)&&e(Q,{providerId:t.id,limits:t.limits,tracked:t.tracked,unavailable:t.limitsUnavailable,notes:t.notes})]})}function te(t){let r=t.filter((p)=>p.usedFraction!==void 0);if(r.length===0){let p=t.find((c)=>c.unit==="usd"&&c.remaining!==void 0);if(p)return`${U(p.remaining??0)} left`;return t[0]?.label}let o=r.reduce((p,c)=>(c.usedFraction??0)>(p.usedFraction??0)?c:p),l=Math.round((o.usedFraction??0)*100);return o.windowLabel?`${l}% · ${o.windowLabel}`:`${l}% used`}function vs(t){return t.providers.map((r)=>({id:r.id,name:r.name,...r.iconUrl?{iconUrl:r.iconUrl}:{},error:r.error,hint:ne(r),limits:r.limits,tracked:r.tracked,limitsUnavailable:r.limitsUnavailable,summary:r}))}function ne(t){let r=t.kenari?.quota?.planName;if(r)return r;let o=t.deepseek?.balance?.entries[0];if(o)return`${o.currency} ${N(o.totalBalance)}`;return te(t.limits)??"No quota reported"}function ks(t){return t.error?"Error":"Connected"}function K(){let[t,r]=n([]),[o,l]=n(null),[p,c]=n(!0),m=a(()=>{c(!0),fetch("/api/settings/usage/reset").then((u)=>u.json()).then((u)=>{r(Array.isArray(u.accounts)?u.accounts:[]),l(typeof u.error==="string"?u.error:null)}).catch((u)=>{r([]),l(u instanceof Error?u.message:"Failed to load saved resets")}).finally(()=>c(!1))},[]);i(()=>{m()},[m]);let g=a(async(u)=>{try{let h=await(await fetch("/api/settings/usage/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:u})})).json();if(h.ok)m();return{ok:Boolean(h.ok),message:h.message||"No result reported."}}catch(f){return{ok:!1,message:f instanceof Error?f.message:"Failed to spend the saved reset"}}},[m]);return{accounts:t,error:o,isLoading:p,reload:m,spend:g}}function ae({account:t,onSpend:r,spending:o}){let l=`${t.provider}/${t.credentialId}`,p=t.email??t.accountId??t.credentialId,c=t.orgName??t.orgId,m=t.availableCount??t.credits.length,g=t.redeemableCount??0,u=t.error??t.unavailableReason;return e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs space-y-2",children:[e("div",{className:"flex items-start justify-between gap-2",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-[11px] font-semibold text-ink truncate",children:[p,c?e("span",{className:"text-ink/50 font-normal",children:[" · ",c]}):null]}),e("div",{className:"text-[10px] text-ink/50 font-mono truncate",children:l})]}),e("span",{className:"text-[10px] text-ink/60 flex-shrink-0 whitespace-nowrap",children:g>0?`${g} of ${m} usable`:`${m} saved`})]}),t.soonestExpiry!==void 0&&e("div",{className:"text-[10px] text-ink/60",children:["Soonest expires ",ea(new Date(t.soonestExpiry).toISOString())]}),t.credits.length>0&&e("div",{className:"space-y-1",children:t.credits.map((f)=>e("div",{className:"flex items-center justify-between gap-2 text-[10px] text-ink/70",children:[e("span",{className:"truncate",children:f.title??f.program??f.id}),e("span",{className:"flex items-center gap-1.5 flex-shrink-0",children:[f.clears&&f.clears.length>0&&e("span",{className:"font-mono text-ink/50",children:f.clears.join(", ")}),f.usable===!1&&e("span",{className:"font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/60",children:"blocked"})]})]},f.id))}),u&&e("div",{className:"text-[10px] text-ink/60 leading-snug",children:u}),e("button",{type:"button",onClick:()=>r(l),disabled:o||g===0,title:g===0?u??"Nothing to spend on this account right now.":`Spend a saved reset on ${l}`,className:"w-full rounded-md border border-ink/15 px-2 py-1 text-[11px] font-medium text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:o?"Spending…":"Spend saved reset"})]})}function su(){let{accounts:t,error:r,isLoading:o,reload:l,spend:p}=K(),[c,m]=n(null),[g,u]=n(null),f=(v)=>{m(v),u(null),p(v).then((M)=>{u(M),m(null)})},h=!o&&!r&&t.length===0;return e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-[11px] font-semibold text-ink",children:"Saved rate-limit resets"}),e("div",{className:"text-[10px] text-ink/50 leading-snug",children:"Provider-issued resets for Codex and Claude accounts. Spending one clears the window it covers."})]}),e("button",{type:"button",onClick:l,disabled:o,title:"Re-read saved resets",className:"p-1.5 bg-paper border border-ink/15 rounded-md hover:bg-ink/5 text-ink/80 transition-colors disabled:opacity-50 flex-shrink-0",children:e(C,{size:12,className:o?"animate-spin text-ink":""})})]}),r&&e("div",{className:"flex items-start gap-1.5 text-[10px] text-error leading-snug",children:[e(I,{size:12,className:"flex-shrink-0 mt-px"}),e("span",{children:r})]}),t.map((v)=>e(ae,{account:v,onSpend:f,spending:c===`${v.provider}/${v.credentialId}`},`${v.provider}/${v.credentialId}`)),h&&e("p",{className:"text-[10px] text-ink/50 leading-snug",children:"No saved resets on any account."}),g&&e("div",{className:`text-[10px] leading-snug ${g.ok?"text-ink/70":"text-error"}`,children:g.message})]})}function lu(){let[t,r]=n(null),[o,l]=n(!0),[p,c]=n(null),m=a(async(g)=>{if(!g?.silent)l(!0);c(null);try{let u=g?.force?"/api/settings/usage?refresh=1":"/api/settings/usage",f=await fetch(u);if(!f.ok)throw Error(`Usage request failed (${f.status})`);let h=await f.json();r(h)}catch(u){c(u instanceof Error?u.message:"Failed to load provider usage")}finally{if(!g?.silent)l(!1)}},[]);return i(()=>{m()},[m]),{report:t,isLoading:o,error:p,reload:m}}
|
|
2
|
-
export{
|
|
1
|
+
import{d,n,o,a,e,s,E,D,ot,lt}from"./index-3fw3sd10.js";var q={name:"ticket",size:24,node:[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]},S=s(q);function P({providerName:t,providerSlug:r,iconUrl:i,credentialSources:l,error:p,note:c,children:m}){return e("section",{className:"bg-paper border border-ink/15 rounded-lg shadow-xs",children:[e("header",{className:"flex items-center justify-between gap-2 px-3.5 py-2.5 border-b border-ink/10",children:[e("span",{className:"flex min-w-0 items-center gap-2",children:[r&&e(lt,{provider:{slug:r,name:t,...i?{iconUrl:i}:{}},size:20}),e("span",{className:"truncate text-xs font-semibold text-ink",children:t})]}),e("span",{className:"text-[10px] font-mono uppercase tracking-wider text-ink/50 truncate",title:`Credentials from ${l.join(", ")}`,children:l.join(" · ")})]}),e("div",{className:"p-3.5 space-y-4",children:[p&&e("p",{className:"flex items-start gap-2 text-error text-xs leading-relaxed",children:[e(E,{size:14,className:"shrink-0 mt-0.5"}),e("span",{className:"break-words",children:p})]}),m,c&&e("p",{className:"text-[10px] text-ink/50 leading-relaxed border-t border-ink/10 pt-2.5",children:c})]})]})}var B=new Intl.NumberFormat("id-ID",{style:"currency",currency:"IDR",maximumFractionDigits:0}),j=new Intl.NumberFormat("id-ID"),y=new Intl.NumberFormat("id-ID",{minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!1}),G=new Intl.DateTimeFormat("id-ID",{dateStyle:"medium",timeStyle:"short"});function x(t){return B.format(t)}function b(t){return j.format(t)}function ra(t){let r=new Date(t);if(Number.isNaN(r.getTime()))return t;return G.format(r)}function L(t,r){if(r<=0)return 0;return Math.min(100,Math.max(0,t/r*100))}function T(t,r){if(r<=0)return"0%";return`${new Intl.NumberFormat("id-ID",{maximumFractionDigits:1}).format(t/r*100)}%`}function k(t){if(!Number.isFinite(t))return"0";let r=Math.abs(t);if(r>=1e9)return`${y.format(t/1e9)}B`;if(r>=1e6)return`${y.format(t/1e6)}M`;if(r>=1000)return`${y.format(t/1000)}K`;return b(t)}function N(t){let r=Number(t);if(t.trim()===""||!Number.isFinite(r))return t;return b(r)}var O=new Intl.NumberFormat("id-ID",{minimumFractionDigits:2,maximumFractionDigits:2});function U(t){if(!Number.isFinite(t))return"$0,00";return`$${O.format(t)}`}function w(t,r){if(!Number.isFinite(t))return"—";switch(r){case"percent":return`${new Intl.NumberFormat("id-ID",{maximumFractionDigits:1}).format(t)}%`;case"usd":return U(t);case"tokens":case"bytes":return k(t);default:return b(t)}}function C(t){if(!Number.isFinite(t))return"0%";return`${new Intl.NumberFormat("id-ID",{maximumFractionDigits:1}).format(t*100)}%`}function z({window:t}){let r=t.usedRp+t.remainingRp,i=L(t.usedRp,r);return e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-[11px] font-semibold text-ink",children:t.label}),e("span",{className:"text-[10px] text-ink/50",children:["Resets ",ra(t.resetsAt)]})]}),e("div",{className:"h-1.5 w-full bg-ink/10 rounded-full overflow-hidden",children:e("div",{className:"h-full bg-ink/80 rounded-full",style:{width:`${i}%`}})}),e("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-0.5 text-[10px] text-ink/60",children:[e("span",{children:["Used ",e("span",{className:"font-semibold text-ink",children:x(t.usedRp)})," ·"," ",T(t.usedRp,r)]}),e("span",{children:["Remaining ",e("span",{className:"font-semibold text-ink",children:x(t.remainingRp)})]})]})]})}function H({coupon:t}){return e("div",{className:"bg-ink/5 border border-ink/10 rounded-lg p-3 shadow-xs",children:[e("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e(S,{size:12,className:"text-ink/60"}),e("span",{className:"text-[11px] font-semibold text-ink",children:["Active coupon · ",t.name]})]}),e("div",{className:"text-[10px] text-ink/60 space-y-0.5",children:[e("div",{children:["Remaining"," ",e("span",{className:"font-semibold text-ink",children:t.remainingRp===null?"Unlimited":x(t.remainingRp)})," ","· Used ",e("span",{className:"font-semibold text-ink",children:x(t.usedRp)})]}),e("div",{children:["Expires ",ra(t.expiresAt)]}),t.scopeModels.length>0&&e("div",{children:["Models: ",t.scopeModels.join(", ")]})]})]})}function I({quota:t}){if(!t)return e("p",{className:"text-[11px] text-ink/50",children:"Quota data is not available for this account."});return e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:"Quota windows"}),t.planName&&e("span",{className:"text-[10px] text-ink/60",children:["Plan ",e("span",{className:"font-semibold text-ink",children:t.planName})]})]}),t.windows.length===0?e("p",{className:"text-[11px] text-ink/50",children:"No quota windows reported."}):e("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2.5",children:t.windows.map((r)=>e(z,{window:r},r.key))}),t.coupon&&e(H,{coupon:t.coupon})]})}function A({usage:t}){if(!t)return e("p",{className:"text-[11px] text-ink/50",children:"The 30-day usage report is not available."});let r=t.rows.reduce((l,p)=>l+p.inputTokens,0),i=t.rows.reduce((l,p)=>l+p.outputTokens,0);return e("div",{className:"space-y-2",children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:"30-day usage by model"}),e("div",{className:"overflow-x-auto border border-ink/15 rounded-lg shadow-xs",children:e("table",{className:"w-full text-[11px]",children:[e("thead",{className:"bg-ink/5 text-ink/60",children:e("tr",{children:[e("th",{className:"text-left font-semibold px-3 py-2 whitespace-nowrap",children:"Model"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Requests"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Input tokens"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Output tokens"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Cost"})]})}),e("tbody",{className:"divide-y divide-ink/10",children:t.rows.length===0?e("tr",{children:e("td",{colSpan:5,className:"px-3 py-3 text-center text-ink/50",children:"No usage recorded in the last 30 days."})}):t.rows.map((l)=>e("tr",{children:[e("td",{className:"px-3 py-1.5 font-mono text-ink whitespace-nowrap",children:l.model}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:b(l.requests)}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:k(l.inputTokens)}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:k(l.outputTokens)}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:x(l.costRp)})]},l.model))}),e("tfoot",{className:"bg-ink/5 border-t border-ink/15 font-semibold text-ink",children:e("tr",{children:[e("td",{className:"px-3 py-2",children:"Total"}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:b(t.totalRequests)}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:k(r)}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:k(i)}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:x(t.totalCostRp)})]})})]})})]})}function F({report:t}){let{balance:r,usage:i,quota:l}=t;if(!r&&!i&&!l)return e("p",{className:"text-[11px] text-ink/50",children:"No kenari data was returned for this account."});let p=r?r.amountRp!==null?x(r.amountRp):r.raw:"–",c=r?r.amountRp!==null?r.raw:"Amount could not be parsed":"Balance unavailable",m=i?i.rows.reduce((g,u)=>g+u.inputTokens+u.outputTokens,0):0;return e(d,{children:[e("div",{className:"@container",children:e("div",{className:"grid grid-cols-3 @[540px]:grid-cols-5 gap-2.5 items-stretch",children:[e(ot,{value:p,label:"Wallet balance",hint:c}),e(ot,{value:l?.planName??"–",label:"Active plan",hint:l?"kenari quota plan":"Quota unavailable"}),e(ot,{value:i?b(i.totalRequests):"–",label:"Requests (30 days)",hint:i?"Across all models":"Usage report unavailable"}),e(ot,{value:i?x(i.totalCostRp):"–",label:"Cost (30 days)",hint:i?"Billed in Rupiah":"Usage report unavailable"}),e(ot,{value:i?k(m):"–",label:"Tokens processed (30 days)",hint:i?"Input + output":"Usage report unavailable",tone:"muted",className:"col-span-2 @[540px]:col-span-1"})]})}),e(I,{quota:l}),e(A,{usage:i})]})}function W({report:t}){let r=t.balance;if(!r)return e("p",{className:"text-[11px] text-ink/50",children:"DeepSeek balance data is not available."});return e(d,{children:[e("div",{className:"@container",children:e("div",{className:"grid grid-cols-3 @[540px]:grid-cols-5 gap-2.5 items-stretch",children:[e(ot,{value:r.isAvailable?"Available":"Unavailable",label:"Prepaid balance",hint:r.isAvailable?"Account can spend":"Top up required",tone:r.isAvailable?"default":"muted"}),e(ot,{value:b(r.entries.length),label:"Currency buckets",hint:r.entries.length>0?"From the balance endpoint":"No entries returned",tone:"muted"})]})}),r.entries.length===0?e("p",{className:"text-[11px] text-ink/50",children:"The balance endpoint returned no currency entries."}):e("div",{className:"grid grid-cols-1 gap-2.5",children:r.entries.map((i)=>e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs",children:[e("div",{className:"flex items-center justify-between gap-2 mb-2",children:[e("span",{className:"text-[11px] font-semibold text-ink",children:i.currency}),e("span",{className:"text-[10px] font-mono uppercase tracking-wider text-ink/40",children:"Balance"})]}),e("dl",{className:"grid grid-cols-3 gap-2 text-[10px]",children:[e("div",{children:[e("dt",{className:"text-ink/50",children:"Total"}),e("dd",{className:"font-semibold text-ink tabular-nums break-words",children:N(i.totalBalance)})]}),e("div",{children:[e("dt",{className:"text-ink/50",children:"Granted"}),e("dd",{className:"font-semibold text-ink tabular-nums break-words",children:N(i.grantedBalance)})]}),e("div",{children:[e("dt",{className:"text-ink/50",children:"Topped up"}),e("dd",{className:"font-semibold text-ink tabular-nums break-words",children:N(i.toppedUpBalance)})]})]})]},i.currency))})]})}function R(t,r,i,l){let p=t.find((c)=>c.id===r);if(p){p.limits.push(l);return}t.push({id:r,title:i,limits:[l]})}function V(t){let r=(t.split(":")[1]??"").toLowerCase();if(r==="google")return{id:"google",title:"Google"};if(r==="anthropic"||r==="openai")return{id:"third-party",title:"Claude & GPT (shared)"};if(r==="default"||r==="")return{id:"default",title:"Usage"};return{id:r,title:r}}function X(t){let r=[];for(let i of t)if(i.id==="anthropic:extra")R(r,"balance","Balance",i);else R(r,"windows","Quota windows",i);return r}function J(t){let r=[];for(let i of t){let l=V(i.id);if(l.id==="third-party"){if(r.find((c)=>c.id==="third-party")?.limits.some((c)=>Z(c,i)))continue}R(r,l.id,l.title,i)}return r}function Z(t,r){return t.unit===r.unit&&t.label===r.label&&t.usedFraction===r.usedFraction&&t.remaining===r.remaining&&t.resetsAt===r.resetsAt}function _(t,r){if(r.length===0)return[];let i=t.trim().toLowerCase();if(i==="anthropic")return X(r);if(i==="google-antigravity")return J(r);return[{id:"all",title:"Quota windows",limits:[...r]}]}function Y({limit:t}){let r=Math.min(100,Math.max(0,(t.usedFraction??0)*100)),i=t.modelId??t.accountId,l=t.used!==void 0?w(t.used,t.unit):void 0,p=t.limit!==void 0?w(t.limit,t.unit):void 0,c=t.remaining!==void 0?w(t.remaining,t.unit):void 0;return e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs space-y-2",children:[e("div",{className:"flex items-start justify-between gap-2",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-[11px] font-semibold text-ink truncate",children:[t.label,t.windowLabel&&e("span",{className:"ml-1.5 rounded border border-ink/15 px-1 py-px font-mono text-[9px] font-normal text-ink/50",children:t.windowLabel})]}),i&&e("div",{className:"text-[10px] text-ink/50 truncate",children:i})]}),e("span",{className:"text-[10px] text-ink/50 flex-shrink-0 whitespace-nowrap",children:t.resetsAt!==void 0?`Resets ${ra(new Date(t.resetsAt).toISOString())}`:""})]}),e("div",{className:"h-1.5 w-full bg-ink/10 rounded-full overflow-hidden",children:e("div",{className:`h-full rounded-full ${t.status==="exhausted"?"bg-error/70":"bg-ink/80"}`,style:{width:`${r}%`}})}),e("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-0.5 text-[10px] text-ink/60",children:[e("span",{children:["Used"," ",e("span",{className:"font-semibold text-ink",children:t.unit==="percent"||!l?C(t.usedFraction??0):l}),t.unit!=="percent"&&l&&p?` of ${p}`:""]}),e("span",{className:"flex items-center gap-2",children:[t.status!=="ok"&&t.status!=="unknown"&&e("span",{className:"text-[10px] font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/70",children:t.status}),c&&e("span",{children:["Remaining ",e("span",{className:"font-semibold text-ink",children:c})]})]})]}),t.notes&&t.notes.length>0&&e("ul",{className:"text-[10px] text-ink/50 leading-relaxed space-y-0.5",children:t.notes.map((m)=>e("li",{children:m},m))})]})}function Q({providerId:t,limits:r,tracked:i,unavailable:l,notes:p}){let c=_(t,r);return e("div",{className:"space-y-2",children:[p&&p.length>0&&e("ul",{className:"text-[10px] text-ink/50 leading-relaxed space-y-0.5",children:p.map((m)=>e("li",{children:m},m))}),c.length===0?e(d,{children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:"Quota windows"}),e("p",{className:"text-[11px] text-ink/50",children:!i?"No quota source for this provider: omp ships no usage adapter for it and it exposes no balance endpoint Kabmo knows.":l?"omp tracks this provider but its usage endpoint returned no data — an invalid or expired credential, an unreachable endpoint, or a plan without quota windows.":"No quota windows were reported for this provider."})]}):c.map((m)=>e("div",{className:"@container space-y-2",children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:m.title}),e("div",{className:"grid grid-cols-1 @[520px]:grid-cols-2 gap-2.5",children:m.limits.map((g)=>e(Y,{limit:g},g.id))})]},m.id))]})}var ee="DeepSeek exposes no usage or quota API — only the prepaid balance (and the web console at platform.deepseek.com) is available.";function pu({summary:t}){let r=Boolean(t.kenari||t.deepseek);return e(P,{providerName:t.name,providerSlug:t.id,iconUrl:t.iconUrl,credentialSources:t.credentialSources,error:t.error,note:t.deepseek?ee:void 0,children:[t.kenari&&e(F,{report:t.kenari}),t.deepseek&&e(W,{report:t.deepseek}),!r&&(t.limits.length>0||!t.error)&&e(Q,{providerId:t.id,limits:t.limits,tracked:t.tracked,unavailable:t.limitsUnavailable,notes:t.notes})]})}function te(t){let r=t.filter((p)=>p.usedFraction!==void 0);if(r.length===0){let p=t.find((c)=>c.unit==="usd"&&c.remaining!==void 0);if(p)return`${U(p.remaining??0)} left`;return t[0]?.label}let i=r.reduce((p,c)=>(c.usedFraction??0)>(p.usedFraction??0)?c:p),l=Math.round((i.usedFraction??0)*100);return i.windowLabel?`${l}% · ${i.windowLabel}`:`${l}% used`}function Cs(t){return t.providers.map((r)=>({id:r.id,name:r.name,...r.iconUrl?{iconUrl:r.iconUrl}:{},error:r.error,hint:ne(r),limits:r.limits,tracked:r.tracked,limitsUnavailable:r.limitsUnavailable,summary:r}))}function ne(t){let r=t.kenari?.quota?.planName;if(r)return r;let i=t.deepseek?.balance?.entries[0];if(i)return`${i.currency} ${N(i.totalBalance)}`;return te(t.limits)??"No quota reported"}function vg(t){return t.error?"Error":"Connected"}function K(){let[t,r]=n([]),[i,l]=n(null),[p,c]=n(!0),m=a(()=>{c(!0),fetch("/api/settings/usage/reset").then((u)=>u.json()).then((u)=>{r(Array.isArray(u.accounts)?u.accounts:[]),l(typeof u.error==="string"?u.error:null)}).catch((u)=>{r([]),l(u instanceof Error?u.message:"Failed to load saved resets")}).finally(()=>c(!1))},[]);o(()=>{m()},[m]);let g=a(async(u)=>{try{let h=await(await fetch("/api/settings/usage/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:u})})).json();if(h.ok)m();return{ok:Boolean(h.ok),message:h.message||"No result reported."}}catch(f){return{ok:!1,message:f instanceof Error?f.message:"Failed to spend the saved reset"}}},[m]);return{accounts:t,error:i,isLoading:p,reload:m,spend:g}}function ae({account:t,onSpend:r,spending:i}){let l=`${t.provider}/${t.credentialId}`,p=t.email??t.accountId??t.credentialId,c=t.orgName??t.orgId,m=t.availableCount??t.credits.length,g=t.redeemableCount??0,u=t.error??t.unavailableReason;return e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs space-y-2",children:[e("div",{className:"flex items-start justify-between gap-2",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-[11px] font-semibold text-ink truncate",children:[p,c?e("span",{className:"text-ink/50 font-normal",children:[" · ",c]}):null]}),e("div",{className:"text-[10px] text-ink/50 font-mono truncate",children:l})]}),e("span",{className:"text-[10px] text-ink/60 flex-shrink-0 whitespace-nowrap",children:g>0?`${g} of ${m} usable`:`${m} saved`})]}),t.soonestExpiry!==void 0&&e("div",{className:"text-[10px] text-ink/60",children:["Soonest expires ",ra(new Date(t.soonestExpiry).toISOString())]}),t.credits.length>0&&e("div",{className:"space-y-1",children:t.credits.map((f)=>e("div",{className:"flex items-center justify-between gap-2 text-[10px] text-ink/70",children:[e("span",{className:"truncate",children:f.title??f.program??f.id}),e("span",{className:"flex items-center gap-1.5 flex-shrink-0",children:[f.clears&&f.clears.length>0&&e("span",{className:"font-mono text-ink/50",children:f.clears.join(", ")}),f.usable===!1&&e("span",{className:"font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/60",children:"blocked"})]})]},f.id))}),u&&e("div",{className:"text-[10px] text-ink/60 leading-snug",children:u}),e("button",{type:"button",onClick:()=>r(l),disabled:i||g===0,title:g===0?u??"Nothing to spend on this account right now.":`Spend a saved reset on ${l}`,className:"w-full rounded-md border border-ink/15 px-2 py-1 text-[11px] font-medium text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:i?"Spending…":"Spend saved reset"})]})}function mu(){let{accounts:t,error:r,isLoading:i,reload:l,spend:p}=K(),[c,m]=n(null),[g,u]=n(null),f=(v)=>{m(v),u(null),p(v).then((M)=>{u(M),m(null)})},h=!i&&!r&&t.length===0;return e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-[11px] font-semibold text-ink",children:"Saved rate-limit resets"}),e("div",{className:"text-[10px] text-ink/50 leading-snug",children:"Provider-issued resets for Codex and Claude accounts. Spending one clears the window it covers."})]}),e("button",{type:"button",onClick:l,disabled:i,title:"Re-read saved resets",className:"p-1.5 bg-paper border border-ink/15 rounded-md hover:bg-ink/5 text-ink/80 transition-colors disabled:opacity-50 flex-shrink-0",children:e(D,{size:12,className:i?"animate-spin text-ink":""})})]}),r&&e("div",{className:"flex items-start gap-1.5 text-[10px] text-error leading-snug",children:[e(E,{size:12,className:"flex-shrink-0 mt-px"}),e("span",{children:r})]}),t.map((v)=>e(ae,{account:v,onSpend:f,spending:c===`${v.provider}/${v.credentialId}`},`${v.provider}/${v.credentialId}`)),h&&e("p",{className:"text-[10px] text-ink/50 leading-snug",children:"No saved resets on any account."}),g&&e("div",{className:`text-[10px] leading-snug ${g.ok?"text-ink/70":"text-error"}`,children:g.message})]})}function fu(){let[t,r]=n(null),[i,l]=n(!0),[p,c]=n(null),m=a(async(g)=>{if(!g?.silent)l(!0);c(null);try{let u=g?.force?"/api/settings/usage?refresh=1":"/api/settings/usage",f=await fetch(u);if(!f.ok)throw Error(`Usage request failed (${f.status})`);let h=await f.json();r(h)}catch(u){c(u instanceof Error?u.message:"Failed to load provider usage")}finally{if(!g?.silent)l(!1)}},[]);return o(()=>{m()},[m]),{report:t,isLoading:i,error:p,reload:m}}
|
|
2
|
+
export{ra,pu,Cs,vg,mu,fu};
|