@kabmo-labs/kabmo 0.45.1 → 0.46.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 +412 -412
- package/dist/client/static/js/{CsvGrid-eqmctwyq.js → CsvGrid-br4j001k.js} +2 -2
- package/dist/client/static/js/{DocxView-rjrshmzf.js → DocxView-kmtkbmmw.js} +3 -3
- package/dist/client/static/js/{DrawioView-za569srw.js → DrawioView-3df0g3jr.js} +2 -2
- package/dist/client/static/js/ImageView-2r8p5z3y.js +1 -0
- package/dist/client/static/js/LayoutWrapper-rq3d2a4e.js +2 -0
- package/dist/client/static/js/Modal-tmxhxd6q.js +59 -0
- package/dist/client/static/js/{PdfView-2m78d4jz.js → PdfView-p5z7c7eg.js} +1 -1
- package/dist/client/static/js/{SessionsView-54awmse0.js → SessionsView-t06h6zfx.js} +1 -1
- package/dist/client/static/js/{SheetView-xfvjdh24.js → SheetView-agw459v2.js} +19 -19
- package/dist/client/static/js/{SvgPreview-yfjrfb40.js → SvgPreview-b9rfy1h6.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-tmsa3b36.js → abnfDiagram-O67JEVCF-wbnhzcnj.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-pvb4d65d.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-a5effrpz.js → architectureDiagram-NJMV4G6O-t2sgevea.js} +3 -3
- package/dist/client/static/js/{astro-56b0as3q.js → astro-hyj5wege.js} +1 -1
- package/dist/client/static/js/bash-8d8z8zrg.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-3q2kf22c.js → blockDiagram-BEXU5L5S-v2nzp54a.js} +5 -5
- package/dist/client/static/js/c-acmn1zc9.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-mkw3jvf6.js → c4Diagram-YGBWAQC7-7h03146b.js} +3 -3
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-fw9bs1za.js → classDiagram-v2-NBCMYWYE-m57e9kp1.js} +7 -7
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-eqjrpps4.js → cose-bilkent-JH36ORCC-c4tnh4mg.js} +1 -1
- package/dist/client/static/js/cpp-620mvjkk.js +1 -0
- package/dist/client/static/js/css-bt76kxbq.js +1 -0
- package/dist/client/static/js/css-drfs4n12.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-gmx4vean.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-4w61hq3e.js → cynefinDiagram-VND7K2PF-mjf6njey.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-t52jdfr1.js → dagre-6A5THRUB-6yma9ch3.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-448hyxaz.js → diagram-22UHCM2B-1q4ce2gb.js} +18 -18
- package/dist/client/static/js/{diagram-3UASUU5V-350k213a.js → diagram-3UASUU5V-0ttps29p.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-9davjeyb.js → diagram-ATOU4E4O-1mzexgv1.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-034wwghk.js → diagram-CDSNMT55-4ae89t23.js} +4 -4
- package/dist/client/static/js/{diagram-MLGK6HIB-kzzd4ecm.js → diagram-MLGK6HIB-057jaqvh.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-rsky4e3s.js → diagram-MPIPVDR6-p6yyq5sx.js} +2 -2
- package/dist/client/static/js/{dockerfile-68b0e6b6.js → dockerfile-00hqsk9c.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-7bm1e394.js → ebnfDiagram-ZINNZB2B-bsk7dvm4.js} +1 -1
- package/dist/client/static/js/{elixir-12pgbgtq.js → elixir-80wq7gak.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-4xjp4rgh.js → elk-276RUBZZ-dsq91er5.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-v52qmcrv.js → erDiagram-OPXOYQCR-p7p13mbh.js} +9 -9
- package/dist/client/static/js/{erlang-811btv6p.js → erlang-814e8qy5.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-vrnheyh7.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-7b4w6phx.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-1r1fn18p.js → ganttDiagram-FUAMR5RP-bwgnttyk.js} +4 -4
- package/dist/client/static/js/gitGraph-4MIJSDKK-n6wnc8st.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-zt5cwg83.js → gitGraphDiagram-X574FWY7-ca0gj5am.js} +13 -13
- package/dist/client/static/js/graphql-j1a6zp7m.js +1 -0
- package/dist/client/static/js/html-m0megrvb.js +1 -0
- package/dist/client/static/js/index-064vdkrs.js +2 -0
- package/dist/client/static/js/{index-x0kgnkv3.js → index-16sd19f0.js} +2 -2
- package/dist/client/static/js/{index-qt9jc4ck.js → index-19x11s5w.js} +2 -2
- package/dist/client/static/js/{index-2b1wnvez.js → index-1c2jvnyh.js} +2 -2
- package/dist/client/static/js/{index-127se1a3.js → index-29npynva.js} +19 -19
- package/dist/client/static/js/{index-gcwmpfr4.js → index-2ks0m8ss.js} +2 -2
- package/dist/client/static/js/{index-pfj3sd1n.js → index-33qxg79j.js} +7 -7
- package/dist/client/static/js/index-3bf7r7z4.js +12 -0
- package/dist/client/static/js/index-3qnjdjg2.js +1 -0
- package/dist/client/static/js/index-4bqssvt6.js +2 -0
- package/dist/client/static/js/{index-03j5j1j0.js → index-561gkvve.js} +2 -2
- package/dist/client/static/js/{index-xgv501v0.js → index-5gf52a6d.js} +2 -2
- package/dist/client/static/js/{index-84vmdg3k.js → index-5h8y54t6.js} +1 -1
- package/dist/client/static/js/{index-f51jxezc.js → index-5wz0y88c.js} +2 -2
- package/dist/client/static/js/{index-x2wvq4ae.js → index-64sqfr4a.js} +2 -2
- package/dist/client/static/js/{index-528x5x8c.js → index-7055hdx1.js} +1 -1
- package/dist/client/static/js/index-8pksqzwq.js +1 -0
- package/dist/client/static/js/index-95kese1h.js +1 -0
- package/dist/client/static/js/{index-tkfxnnr5.js → index-9d3n04vb.js} +2 -2
- package/dist/client/static/js/{index-ga6492qc.js → index-aagt3382.js} +1 -1
- package/dist/client/static/js/{index-gzafyqsr.js → index-abs635a1.js} +56 -56
- package/dist/client/static/js/{index-q36gq3yz.js → index-amys498v.js} +198 -198
- package/dist/client/static/js/{index-9zwtpazh.js → index-bafe7hmd.js} +2 -2
- package/dist/client/static/js/{index-mnh8nptt.js → index-bjv5ga2e.js} +2 -2
- package/dist/client/static/js/{index-fbct0jcf.js → index-d23eacf2.js} +2 -2
- package/dist/client/static/js/{index-wqrdgt1g.js → index-dn7hg4em.js} +2 -2
- package/dist/client/static/js/index-dpy3ewrn.css +1 -0
- package/dist/client/static/js/{index-2tmnqqzt.js → index-dr5hca5b.js} +3 -3
- package/dist/client/static/js/{index-3h2mr90j.js → index-dxvtjn6a.js} +2 -2
- package/dist/client/static/js/index-eqhjs1yv.js +4 -0
- package/dist/client/static/js/{index-cza9mnxx.js → index-ex5dtdx2.js} +6 -6
- package/dist/client/static/js/{index-8ps5gdwz.js → index-f7te27n5.js} +5 -5
- package/dist/client/static/js/{index-6sqmhdyv.js → index-fj5rsp5v.js} +2 -2
- package/dist/client/static/js/{index-n1ga63de.js → index-g7s0wsag.js} +2 -2
- package/dist/client/static/js/index-gq5w5w8x.js +2 -0
- package/dist/client/static/js/{index-jaqjvk22.js → index-hkz2mz34.js} +2 -2
- package/dist/client/static/js/{index-gzp4j2h5.js → index-hnb66d3s.js} +2 -2
- package/dist/client/static/js/{index-bcpyxt97.js → index-j718pxb3.js} +2 -2
- package/dist/client/static/js/{index-0gmw2bt3.js → index-jkay7aw7.js} +2 -2
- package/dist/client/static/js/{index-ex3w7t7s.js → index-k5zfzgez.js} +2 -2
- package/dist/client/static/js/{index-vgcm2g0g.js → index-kty4ncsr.js} +2 -2
- package/dist/client/static/js/{index-2zntn964.js → index-ncpwteyt.js} +2 -2
- package/dist/client/static/js/{index-pxq4v81r.js → index-nw5mvcaj.js} +2 -2
- package/dist/client/static/js/{index-j50y0z44.js → index-pwe6chtp.js} +1 -1
- package/dist/client/static/js/{index-8dtp7mt0.js → index-qf3y3ahx.js} +2 -2
- package/dist/client/static/js/{index-as1wptfa.js → index-qfxn7yh5.js} +2 -2
- package/dist/client/static/js/{index-snjtkfkq.js → index-qn200x1b.js} +6 -6
- package/dist/client/static/js/index-red856x6.js +1 -0
- package/dist/client/static/js/{index-e6any867.js → index-sa1675y0.js} +2 -2
- package/dist/client/static/js/{index-m9s7r4z9.js → index-ta6gpcpw.js} +3 -3
- package/dist/client/static/js/{index-ehg2ftnp.js → index-trvqvb1v.js} +2 -2
- package/dist/client/static/js/{index-2gbfke1a.js → index-twsbv1yn.js} +1 -1
- package/dist/client/static/js/{index-1nwwvv29.js → index-vjmg7kn5.js} +2 -2
- package/dist/client/static/js/{index-nzhwd6t3.js → index-wbws16ag.js} +2 -2
- package/dist/client/static/js/{index-frqq7yen.js → index-x1fqhhpp.js} +64 -64
- package/dist/client/static/js/{index-mhnwyra0.js → index-y2z8nsvw.js} +2 -2
- package/dist/client/static/js/{index-t0yv1375.js → index-z0fkfphe.js} +2 -2
- package/dist/client/static/js/{index-dmv2zasz.js → index-z4530r3c.js} +2 -2
- package/dist/client/static/js/{index-zwx3vbf0.js → index-zedt16w7.js} +1 -1
- package/dist/client/static/js/{index-c7vbr57m.js → index-zq0qxb17.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-1xtdxjz2.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-yd4zwrtv.js → infoDiagram-VRGFBTTK-7q58qdf1.js} +2 -2
- package/dist/client/static/js/ini-5f4zqtqr.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-7sjp09d4.js → ishikawaDiagram-OU5B5YK6-9jmeszag.js} +3 -3
- package/dist/client/static/js/java-jj41mty3.js +1 -0
- package/dist/client/static/js/javascript-n9w9p97f.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-qh9jk7qk.js → journeyDiagram-ZHPQQLJL-0d7xe845.js} +5 -5
- package/dist/client/static/js/json-rnh2h17x.js +1 -0
- package/dist/client/static/js/jsx-4gecrt29.js +1 -0
- package/dist/client/static/js/{julia-mgsev9df.js → julia-yv2j8qd0.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-cjc8k0jk.js → kanban-definition-PNTS6WVX-7p83rwdn.js} +5 -5
- package/dist/client/static/js/lua-zszaw2f7.js +1 -0
- package/dist/client/static/js/markdown-nm6gw4v4.js +1 -0
- package/dist/client/static/js/{mermaid.core-vw0b7r0k.js → mermaid.core-hwhzw0wv.js} +7 -7
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-jyhtpt1z.js → mindmap-definition-NLK3R4M7-hy0rtr7t.js} +8 -8
- package/dist/client/static/js/one-dark-pro-4b8er03c.js +1 -0
- package/dist/client/static/js/one-light-e6r3vsz4.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-zm1r82x5.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-80ygdd29.js → pegDiagram-GJSIUBJH-kd8t53tx.js} +1 -1
- package/dist/client/static/js/{perl-6n93vjsa.js → perl-917pjq5a.js} +1 -1
- package/dist/client/static/js/{php-w23nmbtc.js → php-hwz75qzt.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-sqa7321j.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-6vgh7ntn.js → pieDiagram-5QR66LMP-h3x03f80.js} +3 -3
- package/dist/client/static/js/properties-rkptax7r.js +1 -0
- package/dist/client/static/js/python-qf1se1mj.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-k5byajmm.js → quadrantDiagram-O4NWA36T-y2b1ncbg.js} +6 -6
- package/dist/client/static/js/r-ms0cygq2.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-z3z82syp.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-z6swcqq2.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-33km6py4.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-1zbf1xmq.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-wte1xzzy.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-qffrkk7g.js → railroadDiagram-XR7U4H2S-x188rcxf.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-r80w7tdp.js → requirementDiagram-PLB6GJNP-g5e9fk17.js} +10 -10
- package/dist/client/static/js/{ruby-ag3b3t9t.js → ruby-er7ayhte.js} +1 -1
- package/dist/client/static/js/{rust-a9jcfy2e.js → rust-1v8xbxn9.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-g9qdy74b.js → sankeyDiagram-IPEJSGJF-y9ht91gf.js} +4 -4
- package/dist/client/static/js/{sass-x0eez0kp.js → sass-n47tt136.js} +1 -1
- package/dist/client/static/js/{scss-qycakpjn.js → scss-kvev49ga.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-nywg1eq3.js → sequenceDiagram-PO4LG4MO-pp8s63rt.js} +19 -19
- package/dist/client/static/js/{sizeCapture-INFHLROL-m5pks027.js → sizeCapture-INFHLROL-k6dhfxex.js} +1 -1
- package/dist/client/static/js/sql-hd42h8wx.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-xzzv780w.js → stateDiagram-v2-GCMORJYK-y3akpsm4.js} +3 -3
- package/dist/client/static/js/{svelte-tg19by0f.js → svelte-2pmz35vx.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-n4q5ad13.js → swimlanes-2SLR337P-89081dr3.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-3q2a15wc.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-j9pde7sa.js → timeline-definition-EJHVYXUP-tz6r8g3q.js} +6 -6
- package/dist/client/static/js/treeView-Q6P3EWNA-pvgx6n22.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-3n9zm628.js +1 -0
- package/dist/client/static/js/tsx-gx7td06z.js +1 -0
- package/dist/client/static/js/typescript-1a808spn.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-ehnc0600.js → usecaseDiagram-POWQR4AR-yq2y1b09.js} +44 -44
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-cp4kj6kw.js → vennDiagram-UO4OBE2U-qdmjf6x3.js} +7 -7
- package/dist/client/static/js/{vue-mhj4sme0.js → vue-d5gpjfgn.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-7m07ewc4.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-eegf1jpw.js → wardleyDiagram-VNRHLVJA-3n2sm7rj.js} +3 -3
- package/dist/client/static/js/xml-3117mxd9.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-zkkqfyex.js → xychartDiagram-PMCCYNJV-d7n2av2t.js} +5 -5
- package/dist/client/static/js/yaml-dmvh8vyt.js +1 -0
- package/extensions/kabmo-modes/index.ts +1 -1
- package/extensions/kabmo-modes/parked.test.ts +2 -2
- package/extensions/kabmo-modes/parked.ts +10 -9
- package/extensions/kabmo-modes/plan.test.ts +4 -4
- package/extensions/kabmo-modes/plan.ts +6 -6
- package/extensions/kabmo-modes/session.ts +2 -2
- package/package.json +1 -1
- package/src/client/components/common/FolderPicker.tsx +1 -1
- package/src/client/components/common/Modal.tsx +8 -3
- package/src/client/components/common/NotificationPermissionDialog.test.tsx +8 -3
- package/src/client/components/common/NotificationPermissionDialog.tsx +7 -9
- package/src/client/components/common/PWAInstallButton.tsx +1 -1
- package/src/client/components/common/header-panel-buttons/index.tsx +5 -1
- package/src/client/components/common/shell-update-button/Modal.tsx +31 -36
- package/src/client/components/common/shell-update-button/index.test.tsx +5 -2
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +15 -0
- package/src/client/components/layout/desktop-layout/RightColumn.tsx +16 -0
- package/src/client/components/layout/session-sidebar/OverflowMenu.tsx +1 -1
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +4 -6
- package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +1 -1
- package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +1 -1
- package/src/client/components/mobile/LayoutWrapper.tsx +9 -43
- package/src/client/components/mobile/RightSidebar.tsx +27 -10
- package/src/client/components/mobile/SessionSidebar.tsx +112 -137
- package/src/client/components/mobile/drawer-strip.tsx +85 -0
- package/src/client/components/mobile/left-drawer-nav.test.tsx +350 -0
- package/src/client/components/mobile/mobile-drawer-reveals.test.tsx +194 -0
- package/src/client/components/mobile/mobile-drawer-reveals.ts +138 -0
- package/src/client/components/mobile/mobile-main-view/Header.tsx +12 -24
- package/src/client/components/mobile/mobile-right-sidebar/Action.tsx +57 -0
- package/src/client/components/mobile/mobile-right-sidebar/Chrome.tsx +14 -87
- package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +2 -7
- package/src/client/components/mobile/mobile-right-sidebar/Header.test.tsx +157 -0
- package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +109 -105
- package/src/client/components/mobile/mobile-right-sidebar/OutlineButton.tsx +1 -1
- package/src/client/components/mobile/mobile-right-sidebar/Overflow.tsx +95 -0
- package/src/client/components/mobile/mobile-session-sidebar/Body.tsx +212 -0
- package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +7 -9
- package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +2 -2
- package/src/client/components/mobile/mobile-session-sidebar/use-dock.ts +29 -8
- package/src/client/components/mobile/mobile-session-sidebar/use-drawer-tabs.ts +96 -0
- package/src/client/components/settings/Band.test.tsx +83 -0
- package/src/client/components/settings/Band.tsx +96 -0
- package/src/client/components/settings/Modal.tsx +44 -69
- package/src/client/components/settings/apply-side-effects.ts +15 -4
- package/src/client/components/settings/band-height.test.tsx +16 -3
- package/src/client/components/settings/categories/AppearanceSettings.test.tsx +35 -9
- package/src/client/components/settings/categories/AppearanceSettings.tsx +2 -0
- package/src/client/components/settings/categories/ChatSettings.test.tsx +32 -9
- package/src/client/components/settings/categories/ChatSettings.tsx +2 -0
- package/src/client/components/settings/categories/NotificationSettings.tsx +1 -1
- package/src/client/components/settings/categories/appearance-settings/PanelNavSection.tsx +40 -223
- package/src/client/components/settings/categories/appearance-settings/nav-choice.tsx +176 -0
- package/src/client/components/settings/categories/appearance-settings/nav-miniatures.tsx +93 -0
- package/src/client/components/settings/categories/connect-settings/PairDialog.tsx +1 -1
- package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +1 -1
- package/src/client/components/settings/categories/notification-settings/PermissionNotice.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/LogoutProviderModal.tsx +1 -1
- package/src/client/components/settings/drill.tsx +113 -0
- package/src/client/components/settings/master-detail/GroupDetail.tsx +14 -6
- package/src/client/components/settings/master-detail/GroupSidebar.tsx +9 -1
- package/src/client/components/settings/master-detail/index.tsx +45 -25
- package/src/client/components/workspace/chat-timeline/MobileTurnJump.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/SystemNotice.tsx +4 -0
- package/src/client/components/workspace/chat-timeline/ToolCallingSection.test.ts +23 -6
- package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +19 -2
- package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/index.tsx +5 -9
- package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormAsk.test.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormDialog.test.tsx +127 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormDialog.tsx +225 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks.test.tsx +5 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/PluginPendingInteractions.test.ts +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.test.ts +4 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +40 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/Footer.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/index.tsx +5 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AstEdit.tsx +8 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Lsp.tsx +5 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.tsx +16 -7
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Resolve.tsx +16 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/registry.ts +37 -12
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.ts +4 -3
- package/src/client/components/workspace/diff-panel/index.tsx +1 -1
- package/src/client/components/workspace/editor/SaveDeletedFileModal.tsx +1 -1
- package/src/client/components/workspace/file-explorer/ArchiveModals.tsx +1 -1
- package/src/client/components/workspace/file-explorer/Modals.tsx +4 -4
- package/src/client/components/workspace/git-panel/Modals.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/CloseButton.tsx +38 -0
- package/src/client/components/workspace/model-dropdown/Fullscreen.tsx +16 -25
- package/src/client/components/workspace/model-dropdown/HarnessTabs.tsx +30 -9
- package/src/client/components/workspace/model-dropdown/Header.tsx +33 -21
- package/src/client/components/workspace/model-dropdown/Panel.tsx +19 -4
- package/src/client/components/workspace/model-dropdown/picker-close.test.tsx +139 -0
- package/src/client/components/workspace/model-dropdown/placement.test.tsx +9 -7
- package/src/client/components/workspace/terminal-panel/RealtimeTerminalView.tsx +1 -1
- package/src/client/components/workspace/wiki-panel/NavModal.tsx +1 -1
- package/src/client/data/settings/omp-schema.json +103 -42
- package/src/client/hooks/chat/timeline/ask-form-frame.ts +33 -0
- package/src/client/hooks/chat/timeline/ask-frame-asks.ts +68 -0
- package/src/client/hooks/chat/timeline/ask-frame-buckets.ts +77 -0
- package/src/client/hooks/chat/timeline/ask-frames-context.ts +68 -0
- package/src/client/hooks/chat/timeline/ask-frames-form.test.ts +170 -0
- package/src/client/hooks/chat/timeline/ask-frames.test.ts +1 -1
- package/src/client/hooks/chat/timeline/ask-frames.ts +36 -93
- package/src/client/hooks/workspace/left-dock.ts +19 -0
- package/src/client/hooks/workspace/mobile-panel-nav.ts +90 -0
- package/src/client/hooks/workspace/panel-nav.test.ts +42 -21
- package/src/client/hooks/workspace/panel-tabs-reveal.test.tsx +283 -0
- package/src/client/hooks/workspace/panel-tabs-reveal.ts +162 -0
- package/src/client/hooks/workspace/panel-tabs.ts +19 -2
- package/src/client/lib/ui/phone-row.test.ts +52 -0
- package/src/client/lib/ui/phone-row.ts +71 -0
- package/src/client/press-state.test.ts +179 -0
- package/src/client/tailwind.css +146 -0
- package/src/server/lib/bundler/titlebar-css.test.ts +10 -1
- package/src/server/lib/omp/rpc/constants.test.ts +6 -1
- package/src/shared/lib/chat/ask-form/data.ts +155 -0
- package/src/shared/lib/chat/ask-form/fields.ts +4 -0
- package/src/shared/lib/chat/ask-form/index.ts +8 -0
- package/src/shared/lib/chat/ask-form/types.ts +12 -0
- package/src/shared/lib/chat/timeline/tool-verbs.ts +28 -1
- package/src/shared/lib/chat/tool/tool-commands.test.ts +102 -0
- package/src/shared/lib/chat/tool/tool-commands.ts +124 -0
- package/src/shared/lib/omp/config/schema-releases.test.ts +34 -1
- package/src/shared/lib/omp/dialog-methods.ts +6 -0
- package/src/shared/lib/omp/session/wait-idle.ts +7 -3
- package/src/shared/lib/settings/defaults.ts +3 -2
- package/src/shared/lib/workspace/panel-nav.test.ts +26 -19
- package/src/shared/lib/workspace/panel-nav.ts +20 -9
- package/src/shared/types/omp/agent.ts +20 -3
- package/src/shared/types/settings/state.ts +17 -5
- package/dist/client/static/js/ImageView-6ksvyzqv.js +0 -1
- package/dist/client/static/js/LayoutWrapper-px60417t.js +0 -2
- package/dist/client/static/js/Modal-yv1718s1.js +0 -59
- package/dist/client/static/js/architecture-7GRP2DOG-bch3nye9.js +0 -1
- package/dist/client/static/js/bash-mevzaywf.js +0 -1
- package/dist/client/static/js/c-y1y6v00q.js +0 -1
- package/dist/client/static/js/cpp-wk9z0c5g.js +0 -1
- package/dist/client/static/js/css-3w3p9s67.js +0 -1
- package/dist/client/static/js/css-g85rwzty.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-vqy5jtnk.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-65ph4s3m.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-hekt0qsb.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-t45ekjb6.js +0 -1
- package/dist/client/static/js/graphql-027z8sc0.js +0 -1
- package/dist/client/static/js/html-fqda6wxx.js +0 -1
- package/dist/client/static/js/index-252br0k2.js +0 -1
- package/dist/client/static/js/index-6bm4pw90.css +0 -1
- package/dist/client/static/js/index-80qxk9hx.js +0 -1
- package/dist/client/static/js/index-9674dxb4.js +0 -1
- package/dist/client/static/js/index-9k4121z4.js +0 -4
- package/dist/client/static/js/index-b6454rme.js +0 -12
- package/dist/client/static/js/index-ck0fd3aj.js +0 -2
- package/dist/client/static/js/index-jdf1tks1.js +0 -2
- package/dist/client/static/js/index-q58e8x6j.js +0 -1
- package/dist/client/static/js/info-A6RAGUB7-mw29xbwf.js +0 -1
- package/dist/client/static/js/ini-3cx6tmv4.js +0 -1
- package/dist/client/static/js/java-zs6qh1dm.js +0 -1
- package/dist/client/static/js/javascript-b9mkygak.js +0 -1
- package/dist/client/static/js/json-qn73s8xb.js +0 -1
- package/dist/client/static/js/jsx-gahhfczw.js +0 -1
- package/dist/client/static/js/lua-d8enp14s.js +0 -1
- package/dist/client/static/js/markdown-qetaj4vp.js +0 -1
- package/dist/client/static/js/one-dark-pro-axkq0m3s.js +0 -1
- package/dist/client/static/js/one-light-pncb08qd.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-md85wpjq.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-4grcqnp8.js +0 -1
- package/dist/client/static/js/properties-g6tpq003.js +0 -1
- package/dist/client/static/js/python-cy06fzhg.js +0 -1
- package/dist/client/static/js/r-vw8berfv.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-7j9prhg1.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-g8x2jps1.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-cbg7k68h.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-xfvjk9f8.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-7w97805z.js +0 -1
- package/dist/client/static/js/sql-bwnasywx.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-253nz20y.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-xhf1r6c3.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-4n3j7ekq.js +0 -1
- package/dist/client/static/js/tsx-3dzv8h6k.js +0 -1
- package/dist/client/static/js/typescript-44vs0wn4.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-fb0py35r.js +0 -1
- package/dist/client/static/js/xml-yvv5fn3k.js +0 -1
- package/dist/client/static/js/yaml-avewh7n5.js +0 -1
- package/src/client/hooks/workspace/mobile-right-panel-nav.ts +0 -63
- package/src/shared/lib/ui/safe-area.test.ts +0 -28
- package/src/shared/lib/ui/safe-area.ts +0 -42
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d,u,le,e,E,B,se,Er,
|
|
1
|
+
import{d,u,le,e,E,B,se,Er,gA,Ie,nl,bt,yg,st,od,cm,JA,um,dm}from"./index-amys498v.js";function g({phase:t,index:s,collapsed:r,currentKey:f,onToggle:i}){let m=um(t),x=t.tasks.length>0&&m===t.tasks.length;return e("div",{className:"overflow-hidden rounded-lg border border-ink/10 bg-paper",children:[e("button",{type:"button",onClick:i,"aria-expanded":!r,className:"flex w-full items-center gap-1.5 border-b border-ink/8 bg-canvas/40 px-2.5 py-1.5 text-left hover:bg-ink/5",children:[r?e(se,{size:12,className:"shrink-0 text-ink/40"}):e(B,{size:12,className:"shrink-0 text-ink/40"}),e("span",{className:`min-w-0 flex-1 truncate text-[10px] font-semibold uppercase tracking-wider ${x?"text-ink/35":"text-ink/60"}`,title:t.name,children:[s+1,". ",t.name]}),e("span",{className:"shrink-0 font-mono text-[10px] text-ink/40",children:[m,"/",t.tasks.length]})]}),!r&&e("div",{className:"divide-y divide-ink/[0.05] p-0.5",children:t.tasks.length===0?e("div",{className:"px-2.5 py-1.5 text-[11px] text-ink/40",children:"No tasks in this phase"}):t.tasks.map((n,l)=>e(dm,{task:n,current:f===`${s}:${l}`},`${l}-${n.content}`))})]})}function q({className:t="",active:s=!0,tabsMode:r=!1}){let[f]=le(),i=f.get("sessionId"),[m,x]=nl("todo.collapsedPhases",{}),{data:n,isLoading:l,refreshing:k,stale:b,refresh:v}=Ie(i?gA(i):null,{enabled:s}),o=n?.snapshot??null,p=n?.progress??null,N=u(()=>{let a=JA(o?.phases??[]);return a?`${a.phase}:${a.task}`:null},[o]);if(!i)return e("div",{className:`flex h-full flex-col items-center justify-center bg-paper text-ink/40 ${t}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e("div",{className:`flex h-full w-full min-w-0 flex-col overflow-hidden bg-paper text-ink ${t}`,children:[yg("todo",r)?e(bt,{left:e(d,{children:[e("h2",{className:"text-xs font-semibold uppercase tracking-wider text-ink",children:"Todos"}),o&&e("span",{className:"truncate font-mono text-[10.5px] text-ink/50",title:od(p),children:od(p)}),n?.isMock&&e("span",{className:"flex-shrink-0 rounded border border-ink/15 bg-ink/5 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-ink/60",children:"Mock"})]}),right:e(st,{label:"Refresh todos",onClick:v,busy:l||k,disabled:l})}):null,p&&p.total>0&&e("div",{className:"flex-shrink-0 border-b border-ink/10 px-3.5 py-2.5",children:e("div",{className:"h-1.5 overflow-hidden rounded-full bg-ink/8",children:e("div",{className:"h-full rounded-full bg-success transition-all duration-300",style:{width:`${cm(p)}%`}})})}),e("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto scrollbar-overlay-container p-3.5",children:[b&&e("div",{className:"flex items-start gap-2 rounded-lg border border-ink/15 bg-ink/5 px-3 py-2 text-[11px] text-ink/60",children:[e(E,{size:13,className:"mt-[1px] shrink-0"}),e("span",{className:"min-w-0 break-words",children:"Reconnecting: this list may be out of date."})]}),!o?e("div",{className:"flex flex-col items-center justify-center gap-2 py-12 text-center text-ink/40",children:[e(Er,{size:20}),e("p",{className:"max-w-[240px] text-[11.5px] leading-relaxed",children:["No todo list in this session. The agent writes one with the ",e("span",{className:"font-mono",children:"todo"})," tool when a task is worth planning."]})]}):e(d,{children:[o.phases.map((a,c)=>e(g,{phase:a,index:c,collapsed:Boolean(m[String(c)]),currentKey:N,onToggle:()=>x((h)=>({...h,[String(c)]:!h[String(c)]}))},`${c}-${a.name}`)),e("p",{className:"pt-1 text-[10.5px] leading-relaxed text-ink/35",children:["Read from this session's transcript",o.updatedAt?` · updated ${y(o.updatedAt)}`:"",o.source==="custom"?" · edited by hand":"","."]})]})]})]})}function y(t){let s=new Date(t);if(Number.isNaN(s.getTime()))return t;return s.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}export{q as TodoPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d,n,o,i,u,a,e,E,m,an,on,Be,Yr,U,bA,Ie,S,gr,Ar,bt,st,Z,J}from"./index-amys498v.js";import{kr}from"./index-k5zfzgez.js";function B({sections:c,selected:t,onSelect:l}){let[r,f]=n(""),x=u(()=>{let p=r.trim().toLowerCase();if(!p)return c;return c.map((h)=>({...h,links:h.links.filter((s)=>s.label.toLowerCase().includes(p)||(s.path??s.target).toLowerCase().includes(p))})).filter((h)=>h.links.length>0)},[c,r]),k=c.some((p)=>p.links.length>0);return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-canvas/40",children:[e("div",{className:"flex items-center gap-1.5 border-b border-ink/10 px-2 py-1.5 flex-shrink-0",children:[e(U,{size:11,className:"flex-shrink-0 text-ink/40"}),e("input",{type:"text",value:r,onChange:(p)=>f(p.currentTarget.value),placeholder:"Filter pages…",title:"Filter wiki pages",className:"w-full min-w-0 bg-transparent text-xs text-ink outline-none placeholder-ink/40"}),r&&e("button",{type:"button",onClick:()=>f(""),title:"Clear filter",className:"flex-shrink-0 text-ink/40 hover:text-ink",children:"×"})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:x.length===0?e("p",{className:"px-3 py-2 text-[11px] italic text-ink/40",children:k?"No page matches the filter":"This wiki has no pages"}):x.map((p,h)=>e("div",{className:"py-0.5",children:[p.title&&e("div",{className:"px-2.5 py-1 text-[10px] font-semibold uppercase tracking-wider text-ink/40",children:p.title}),p.links.map((s,g)=>{let b=s.path!==null&&s.path===t,w=`${s.path??s.target}-${g}`;if(s.path)return e("button",{type:"button",onClick:()=>l(s.path),title:s.path,"aria-current":b?"page":void 0,className:`flex w-full items-center gap-1 px-2.5 py-1 text-left text-xs transition-colors ${b?"bg-ink/8 font-medium text-ink":"text-ink/70 hover:bg-ink/5 hover:text-ink"}`,children:e("span",{className:"truncate",children:s.label})},w);if(s.url)return e("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",title:s.url,className:"flex w-full items-center gap-1 px-2.5 py-1 text-left text-xs text-ink/70 hover:bg-ink/5 hover:text-ink",children:[e("span",{className:"truncate",children:s.label}),e(Be,{size:10,className:"flex-shrink-0 text-ink/30"})]},w);return e("div",{title:`Not in this wiki: ${s.target}`,className:"flex w-full items-center px-2.5 py-1 text-left text-xs text-ink/35 line-through decoration-ink/20",children:e("span",{className:"truncate",children:s.label})},w)}),p.notes.map((s,g)=>e("p",{className:"px-2.5 py-0.5 text-[10px] leading-snug text-ink/50",children:s},`note-${g}`))]},`${p.title??"links"}-${h}`))})]})}function j({open:c,onClick:t}){return e("button",{type:"button",onClick:t,title:"Browse wiki pages","aria-label":"Browse wiki pages","aria-expanded":c,className:"absolute bottom-3 right-3 z-20 flex h-9 w-9 items-center justify-center rounded-full border border-ink/20 bg-paper text-ink/60 shadow-sm transition-all hover:bg-ink/5 hover:text-ink",children:e(Yr,{size:16})})}function V({open:c,sections:t,selected:l,onSelect:r,onClose:f}){if(o(()=>{if(!c)return;let x=(k)=>{if(k.key==="Escape")f()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[c,f]),!c)return null;return e(Z,{onClose:f,maxWidthClass:"max-w-sm",zClass:"z-[70]",ariaLabel:"Wiki pages",header:e("div",{className:"flex min-w-0 items-center gap-2",children:[e(Yr,{size:15,className:"flex-shrink-0 text-ink/50"}),e("span",{className:"text-sm font-medium",children:"Wiki pages"})]}),children:e("div",{className:"flex h-[60vh] min-h-0 flex-col",children:e(B,{sections:t,selected:l,onSelect:(x)=>{r(x),f()}})})})}function re(c,t){if(!c.webUrl)return null;let r=(t.split("/").pop()??t).replace(/\.(md|markdown)$/i,"");return c.provider==="gitlab"?`${c.webUrl.replace(/\/home$/,"")}/${encodeURIComponent(t.replace(/\.(md|markdown)$/i,""))}`:`${c.webUrl}/${encodeURIComponent(r)}`}function G({repo:c,entries:t,path:l,page:r,isLoading:f,error:x,rootPath:k,repoScope:p,onNavigate:h,onBack:s}){let g=re(c,l),b=u(()=>({path:l,entries:t,root:k,repo:p}),[l,t,k,p]);return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-paper",children:[e("div",{className:"flex flex-shrink-0 items-center gap-1.5 border-b border-ink/10 px-2.5 py-1.5",children:[s&&e("button",{type:"button",onClick:s,title:"Back to the page list","aria-label":"Back to the page list",className:"flex-shrink-0 rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink @[520px]:hidden",children:e(an,{size:13})}),e("span",{className:"min-w-0 flex-1 truncate text-[11px] text-ink/50",title:l,children:l}),f&&e(m,{size:12,className:"flex-shrink-0 animate-spin text-ink/40"}),g&&e("a",{href:g,target:"_blank",rel:"noopener noreferrer",title:"Open this page on the wiki host","aria-label":"Open this page on the wiki host",className:"flex-shrink-0 rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink",children:e(Be,{size:13})})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:x?e("div",{className:"flex flex-col items-center gap-2 px-6 py-8 text-center",children:[e(E,{size:16,className:"text-error"}),e("p",{className:"text-xs text-error",children:x})]}):!r?e("div",{className:"px-6 py-8 text-center text-xs text-ink/40",children:f?"Loading page…":"No page selected"}):e("article",{className:"mx-auto max-w-4xl px-5 py-4",children:[e(J,{content:r.content,className:"max-w-none",wikiScope:b,onWikiNavigate:h}),r.truncated&&e("p",{className:"mt-4 border-t border-ink/10 pt-2 text-[11px] text-ink/50",children:"This page is longer than the reader's budget and was cut off."})]})})]})}function O(c,t){return`${c??""}\x00${t}`}function H(c,t){let l=new URLSearchParams;if(c)l.set("root",c);if(t&&t!==".")l.set("repo",t);return l}function X(c){let{rootPath:t,repo:l,enabled:r,active:f,revisionKey:x=0}=c,k=O(t,l),[p,h]=n(null),s=i(k);s.current=k;let g=Ie(bA(k),{enabled:r&&f}),{refresh:b}=g;o(()=>{h(null)},[k]);let w=a((R)=>{if(!r)return;if(!R?.force){b();return}let W=s.current,L=H(t,l);L.set("refresh","1"),fetch(`/api/wiki?${L.toString()}`).then(async(N)=>{let y=await N.json();if(!N.ok)throw Error(y?.error||`Wiki request failed (${N.status})`)}).then(()=>{if(s.current!==W)return;h(null),b()}).catch((N)=>{if(s.current!==W)return;h(N instanceof Error?N.message:"Failed to load the wiki")})},[r,t,l,b]);return o(()=>{if(x>0)b()},[x]),{data:g.data,isLoading:g.isLoading,refreshing:g.refreshing,error:p,reload:w}}function Q(c){let{rootPath:t,repo:l,path:r,enabled:f,active:x,revisionKey:k=0}=c,p=`${O(t,l)}\x00${r??""}`,[h,s]=n({scope:p,data:null}),[g,b]=n(!1),[w,R]=n(null),W=i(0);return o(()=>{if(!f||!x||!r){s({scope:p,data:null}),R(null);return}let L=++W.current;b(!0);let N=H(t,l);N.set("path",r),fetch(`/api/wiki/page?${N.toString()}`).then(async(y)=>{let _=await y.json();if(!y.ok)throw Error(_?.error||`Page request failed (${y.status})`);return _}).then((y)=>{if(W.current!==L)return;s({scope:p,data:y}),R(null)}).catch((y)=>{if(W.current!==L)return;R(y instanceof Error?y.message:"Failed to load the page")}).finally(()=>{if(W.current===L)b(!1)})},[p,t,l,r,f,x,k]),{data:h.scope===p?h.data:null,isLoading:g,error:w}}function Y(c){let t=[];for(let l of c){if(!l.isMarkdown)continue;let r=t[t.length-1],f={label:l.title,target:l.path,path:l.path,url:null};if(r&&r.title===(l.folder||"Pages")){r.links.push(f);continue}t.push({title:l.folder||"Pages",links:[f],notes:[]})}return t}var oe={"no-remote":"This repository has no origin remote, so there is no wiki to find.","unsupported-remote":"The origin remote is not a URL a wiki can be derived from.","no-wiki":"This project has no wiki (or Kabmo cannot read it).",unreachable:"The wiki could not be reached."};function qe({className:c="",enabled:t=!0,active:l=!0,rootPath:r,refreshKey:f=0,layout:x="desktop"}){let k=x==="phone",{activeRepo:p,setActiveRepo:h}=gr(r),{repos:s,scanning:g,rescan:b}=Ar(r,t),w=O(r,p),[R,W]=S("wiki.selectedPage",null),[L,N]=n(!1),[y,_]=n(!1),[ee,te]=n(0),v=X({rootPath:r,repo:p,enabled:t,active:l,revisionKey:f}),M=v.data?.entries??[],z=u(()=>M.filter((C)=>C.isMarkdown),[M]),I=u(()=>v.data?.sidebar??Y(M),[v.data?.sidebar,M]),ie=u(()=>I.some((C)=>C.links.length>0),[I]),A=R&&R.scope===w?R.path:null,T=u(()=>{if(A&&z.some((F)=>F.path===A))return A;return(z.find((F)=>F.title.toLowerCase()==="home")??z[0])?.path??null},[A,z]),D=Q({rootPath:r,repo:p,path:T,enabled:t,active:l,revisionKey:ee});o(()=>{if(!T||T===A)return;W({scope:w,path:T})},[T,A,w,W]),o(()=>{N(!1),_(!1)},[w]);let q=(C)=>{if(W({scope:w,path:C}),!k)_(!0)},ne=()=>{v.reload({force:!0}),te((C)=>C+1)},P=v.data?.repo??null,K=v.data&&!P?v.data:null;if(!t)return e("div",{className:`flex h-full flex-col items-center justify-center bg-paper text-ink/40 ${c}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e("div",{className:`@container flex h-full min-h-0 w-full flex-col bg-paper text-xs text-ink ${c}`,children:[e(bt,{left:e(d,{children:[e(kr,{rootPath:r,activeRepo:p,onSelectRepo:h,repos:s,scanning:g,onRefreshRepos:b}),P&&e("span",{className:"flex-shrink-0 rounded border border-ink/15 bg-ink/5 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-ink/60",title:`${P.host}/${P.slug} · ${P.revision.slice(0,8)}`,children:P.provider})]}),right:e(d,{children:[P?.webUrl&&e("a",{href:P.webUrl,target:"_blank",rel:"noopener noreferrer",title:"Open the wiki on its host","aria-label":"Open the wiki on its host",className:"rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink",children:e(Be,{size:13})}),e(st,{label:"Re-fetch the wiki",onClick:ne,busy:v.isLoading||v.refreshing,disabled:v.isLoading})]})}),v.error&&!v.data?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(E,{size:16,className:"text-error"}),e("p",{className:"text-error",children:v.error}),e("button",{type:"button",onClick:()=>v.reload(),className:"text-[11px] font-semibold text-ink/70 underline underline-offset-2 hover:text-ink",children:"Try again"})]}):!v.data?e("div",{className:"flex flex-1 items-center justify-center gap-2 text-ink/40",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Reading the wiki…"})]}):K?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(on,{size:18,className:"text-ink/30"}),e("p",{className:"max-w-sm text-[11px] leading-relaxed text-ink/60",children:oe[K.reason??"no-wiki"]}),K.detail&&e("p",{className:"max-w-sm break-words font-mono text-[10px] text-ink/40",children:K.detail})]}):e("div",{className:"flex min-h-0 flex-1 flex-col @[520px]:flex-row-reverse",children:[e("div",{className:`${k?"hidden":y?"hidden @[520px]:flex":"flex"} min-h-0 w-full flex-col @[520px]:w-52 @[520px]:flex-shrink-0 @[520px]:border-l @[520px]:border-ink/10`,children:e(B,{sections:I,selected:T,onSelect:q})}),e("div",{className:`relative min-w-0 min-h-0 flex-1 ${k?"flex":y?"flex":"hidden @[520px]:flex"} flex-col`,children:[P&&T?e(G,{repo:P,entries:M,path:T,page:D.data,isLoading:D.isLoading,error:D.error,rootPath:r,repoScope:p,onNavigate:q,onBack:k?void 0:()=>_(!1)}):e("div",{className:"flex h-full items-center justify-center px-6 text-center text-[11px] text-ink/40",children:"This wiki has no markdown pages."}),k&&ie&&e(j,{open:L,onClick:()=>N(!0)}),e(V,{open:L,sections:I,selected:T,onSelect:q,onClose:()=>N(!1)})]})]})]})}export{qe as WikiPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d,n,o,K,i,u,a,tn,e,Ce,qi,f,Ki,Vi,Yi,U,Zi,b,S,gr,Ar,bt,Wa,ue,di,rl,ct,ut,yt,rd,mc}from"./index-amys498v.js";import{kr}from"./index-k5zfzgez.js";var me=2000,W=new Map;function ge(s){if(s.length===0)return"";let r="";for(let t of s)r+=`${t.start}-${t.end},`;return r}function ee(s,r,t){let c=di(r),p=`${r}\x00${ge(t)}\x00${s}`;if(c){let v=W.get(p);if(v!==void 0)return W.delete(p),W.set(p,v),v}let l=rl(s,r,{marks:t});if(!c)return l;if(W.set(p,l),W.size>me){let v=W.keys().next();if(!v.done)W.delete(v.value)}return l}function te(s,r,t){let c=[],p=0;for(let l of r){if(l.start<p||l.end<=l.start||l.end>s.length)continue;if(l.start>p)c.push({text:s.slice(p,l.start),kind:"plain"});if(c.push({text:s.slice(l.start,l.end),kind:"removed"}),t)c.push({text:t,kind:"inserted"});p=l.end}if(p<s.length)c.push({text:s.slice(p),kind:"plain"});return c}function xe({file:s,result:r,replacement:t,showReplacePreview:c,onOpen:p}){let l=r.ranges??[],v=c&&t.length>0;return e("button",{type:"button",onClick:()=>p(r),className:"flex w-full items-start gap-2 rounded px-1 py-0.5 text-left hover:bg-ink/5 cursor-pointer",title:`Open ${s}:${r.line}`,children:[e("span",{className:"w-6 flex-shrink-0 text-right font-mono text-ink/40",children:r.line}),v?e("span",{className:"min-w-0 truncate font-mono text-ink",children:te(r.content,l,t).map((R,g)=>R.kind==="plain"?e("span",{children:R.text},g):R.kind==="removed"?e("del",{className:"search-replace-old",children:R.text},g):e("ins",{className:"search-replace-new",children:R.text},g))}):e("span",{className:"min-w-0 truncate font-mono text-ink",dangerouslySetInnerHTML:{__html:ee(r.content,yt(s),l)}})]})}var re=tn(xe);var Z={header:4,hit:4,group:16},ne={headerBox:16,hitBox:20},se=5000;function oe(s){let r=[],t=null;for(let c of s){if(!t||t.file!==c.file)t={file:c.file,results:[]},r.push(t);t.results.push(c)}return r}function ie(s){let r=[];for(let t of s){r.push({kind:"group",file:t.file,count:t.results.length});for(let c=0;c<t.results.length;c++)r.push({kind:"hit",file:t.file,result:t.results[c],last:c===t.results.length-1})}return r}function be(s,r){if(s.kind==="group")return r.headerBox+Z.header;return r.hitBox+(s.last?Z.group:Z.hit)}function ae(s,r){let t=Array(s.length),c=Array(s.length),p=0;for(let l=0;l<s.length;l++){let v=be(s[l],r);t[l]=p,c[l]=v,p+=v}return{offsets:t,heights:c,total:p}}function le(s,r,t,c,p=240){if(s.length===0)return{start:0,end:0};let l=Math.max(0,t),v=l-p,R=l+c+p,g=0,x=s.length-1;while(g<x){let m=g+x>>1;if(s[m]+r[m]>v)x=m;else g=m+1}let M=g;g=M,x=s.length;while(g<x){let m=g+x>>1;if(s[m]>=R)x=m;else g=m+1}return{start:M,end:g}}var Se=8,ve=8;function ce({groups:s,replacement:r,showReplacePreview:t,onOpen:c,onReplaceFile:p,replaceBusy:l}){let v=i(null),R=i(null),g=u(()=>ie(s),[s]),[x,M]=n(ne),m=u(()=>ae(g,x),[g,x]),[O,w]=n(()=>({start:0,end:Math.min(g.length,60)})),F=a((h)=>{v.current=h},[]),k=a(()=>{let h=v.current;if(!h)return;let N=le(m.offsets,m.heights,h.scrollTop,h.clientHeight);w((I)=>I.start===N.start&&I.end===N.end?I:N)},[m]),y=a(()=>{k()},[k]);K(()=>{let h=R.current;if(!h)return;let N=h.querySelector("[data-search-header] > div")?.offsetHeight??0,I=h.querySelector("[data-search-hit] > button")?.offsetHeight??0;if(N>0&&N!==x.headerBox)M((C)=>({...C,headerBox:N}));if(I>0&&I!==x.hitBox)M((C)=>({...C,hitBox:I}))},[O,x,g]),K(()=>{k()},[k]),K(()=>{let h=v.current;if(!h||typeof ResizeObserver>"u")return;let N=new ResizeObserver(()=>k());return N.observe(h),()=>N.disconnect()},[k]);let H=g.length===0?0:Math.min(O.start,g.length-1),A=Math.min(O.end,g.length),L=g.slice(H,A),_=A<g.length?m.total-m.offsets[A]:0;return e("div",{ref:F,onScroll:y,className:"flex-1 scrollbar-overlay-container px-3 text-xs",style:{overflowAnchor:"none"},children:[e("div",{style:{height:Se+(m.offsets[H]??0)},"aria-hidden":"true"}),e("div",{ref:R,children:L.map((h,N)=>{let I=H+N,C=m.heights[I];if(h.kind==="group")return e("div",{"data-search-header":"",style:{height:C},children:e("div",{className:"font-semibold text-ink/80 flex items-center justify-between group",children:[e("div",{className:"flex items-center min-w-0",children:[e(ct,{name:h.file,size:12,className:"mr-1.5 flex-shrink-0"}),e("span",{className:"truncate",children:h.file}),e("span",{className:"ml-2 bg-ink/10 text-[10px] px-1.5 py-0.5 rounded-full flex-shrink-0",children:h.count})]}),e("button",{onClick:()=>p(h.file),disabled:l,className:"touch-visible opacity-0 group-hover:opacity-100 p-1 text-ink/40 hover:text-ink rounded hover:bg-ink/5 disabled:opacity-50 flex-shrink-0",title:"Replace in this file",children:e(Yi,{size:12})})]})},`group:${h.file}`);return e("div",{"data-search-hit":"",style:{height:C},children:e(re,{file:h.file,result:h.result,replacement:r,showReplacePreview:t,onOpen:c})},`hit:${h.file}:${h.result.line}:${I}`)})}),e("div",{style:{height:ve+_},"aria-hidden":"true"})]})}function he({className:s,query:r,setQuery:t,replaceQuery:c,setReplaceQuery:p,matchCase:l,setMatchCase:v,wholeWord:R,setWholeWord:g,useRegex:x,setUseRegex:M,includeFiles:m,setIncludeFiles:O,showIncludeField:w,setShowIncludeField:F,showMenu:k,setShowMenu:y,menuRef:H,rootPath:A,activeRepo:L,setActiveRepo:_,repos:h,reposScanning:N,rescanRepos:I,results:C,isSearching:G,truncated:q,error:T,onOpenFile:z,handleReplace:D,replaceBusy:J,tabsMode:Y=!1}){let Q=u(()=>oe(C),[C]),P=i(null),X=i(null),B=a(()=>{t(""),P.current?.focus()},[t]),j=a(()=>{p(""),X.current?.focus()},[p]),V=u(()=>({matchCase:l,wholeWord:R,isRegex:x,inSelection:!1}),[l,R,x]),pe=a((E)=>{rd({path:E.file,line:Number(E.line),query:r,options:V}),z?.({path:E.file,name:E.file.split("/").pop()||E.file,root:A,repo:L})},[r,V,A,L,z]),fe=a((E)=>D(E),[D]);return e("div",{className:`flex flex-col h-full bg-paper ${s}`,children:[e(bt,{left:e(d,{children:[e(Wa,{id:"search",tabsMode:Y,children:e("h2",{className:"text-xs font-semibold text-ink uppercase tracking-wider",children:"Search"})}),e(kr,{rootPath:A,activeRepo:L,onSelectRepo:_,repos:h,scanning:N,onRefreshRepos:I})]}),right:e("div",{className:"relative",ref:H,children:[e("button",{onClick:()=>y(!k),className:`p-1 rounded hover:bg-ink/5 transition-colors ${k||w?"text-ink":"text-ink/40"}`,title:"Search Options",children:e(Ce,{size:14})}),k&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-48 bg-paper border border-ink/10 rounded shadow-lg z-10 py-1",children:e("button",{onClick:()=>{if(F(!w),w)O("");y(!1)},className:"w-full px-3 py-1.5 text-left text-xs text-ink hover:bg-ink/5 flex items-center justify-between",children:[e("span",{children:"Files to include"}),w&&e(f,{size:12,className:"text-ink/60"})]})})]})}),e("div",{className:"p-3 flex flex-col gap-2.5 border-b border-ink/10",children:[e("div",{className:"relative",children:e("div",{className:"flex items-center border border-ink/20 rounded bg-paper focus-within:border-ink/40 focus-within:ring-1 focus-within:ring-ink/10 transition-all",children:[e(U,{size:14,className:"ml-2 text-ink/40 flex-shrink-0"}),e("input",{ref:P,type:"text",placeholder:"Search",value:r,onChange:(E)=>t(E.currentTarget.value),className:"w-full bg-transparent border-none text-xs px-2 py-1.5 focus:outline-none text-ink placeholder-ink/35 min-w-0"}),r&&e("button",{type:"button",onClick:B,title:"Clear search","aria-label":"Clear search",className:"p-1 mr-0.5 rounded text-ink/40 hover:text-ink hover:bg-ink/5 flex-shrink-0",children:e(b,{size:12})}),e("div",{className:"flex items-center space-x-0.5 pr-1 text-ink/40 flex-shrink-0",children:[e("button",{onClick:()=>v(!l),className:`p-1 rounded hover:text-ink ${l?"bg-ink/10 text-ink":"hover:bg-ink/5"}`,title:"Match Case",children:e(qi,{size:14})}),e("button",{onClick:()=>g(!R),className:`p-1 rounded hover:text-ink ${R?"bg-ink/10 text-ink":"hover:bg-ink/5"}`,title:"Match Whole Word",children:e(Zi,{size:14})}),e("button",{onClick:()=>M(!x),className:`p-1 rounded hover:text-ink ${x?"bg-ink/10 text-ink":"hover:bg-ink/5"}`,title:"Use Regular Expression",children:e(Ki,{size:14})})]})]})}),e("div",{className:"relative flex items-center space-x-1",children:[e("div",{className:"flex flex-1 min-w-0 items-center border border-ink/20 rounded bg-paper focus-within:border-ink/40 focus-within:ring-1 focus-within:ring-ink/10 transition-all",children:[e("input",{ref:X,type:"text",placeholder:"Replace",value:c,onChange:(E)=>p(E.currentTarget.value),className:"flex-1 min-w-0 bg-transparent border-none text-xs px-2 py-1.5 focus:outline-none text-ink placeholder-ink/35"}),c&&e("button",{type:"button",onClick:j,title:"Clear replace","aria-label":"Clear replace",className:"p-1 mr-0.5 rounded text-ink/40 hover:text-ink hover:bg-ink/5 flex-shrink-0",children:e(b,{size:12})})]}),e("button",{onClick:()=>D(),disabled:C.length===0||J,className:"p-1.5 rounded border border-ink/20 text-ink/60 hover:text-ink hover:bg-ink/5 disabled:opacity-50 disabled:cursor-not-allowed bg-paper",title:"Replace All",children:e(Vi,{size:14})})]}),w&&e("div",{className:"relative",children:e("input",{type:"text",value:m,onChange:(E)=>O(E.currentTarget.value),placeholder:"Files to include (e.g. *.js, src/*)",className:"w-full bg-paper border border-ink/20 rounded text-xs px-2 py-1.5 focus:outline-none focus:border-ink/40 focus:ring-1 focus:ring-ink/10 transition-all text-ink placeholder-ink/40"})})]}),T&&C.length===0?e("div",{className:"flex-1 px-3 py-3",role:"alert",children:e("div",{className:"rounded border border-error/30 bg-error/5 px-2.5 py-2",children:[e("div",{className:"text-[11px] font-semibold text-error",children:"Search failed"}),e("div",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-[10.5px] text-ink/70",children:T}),x&&e("div",{className:"mt-1 text-[10.5px] text-ink/50",children:["Regex is on — escape metacharacters such as ",e("code",{className:"font-mono",children:"( ) [ ] * ? +"})," or turn it off to search literally."]})]})}):G&&C.length===0?e("div",{className:"flex-1 text-ink/40 italic text-center py-4",children:"Searching..."}):r.trim().length<=2?e("div",{className:"flex-1 text-ink/40 italic text-center py-4",children:"Type at least 3 characters to search."}):C.length===0?e("div",{className:"flex-1 text-ink/40 italic text-center py-4",children:"No results found."}):e(d,{children:[T&&e("div",{className:"px-3 pt-2 text-[10.5px] text-error",role:"alert",children:["Search failed: ",e("span",{className:"font-mono",children:T})]}),G&&e("div",{className:"px-3 pt-2 text-ink/40 italic",children:"Searching…"}),q&&e("div",{className:"px-3 pt-2 text-ink/50 italic",children:["Showing the first ",se," matches — refine the query to see the rest."]}),e(ce,{groups:Q,replacement:c,showReplacePreview:c.length>0,onOpen:pe,onReplaceFile:fe,replaceBusy:J})]})]})}function de(s){let[r,t]=n({scope:s,results:[],truncated:!1,error:null}),[c,p]=n(!1),l=i(null),v=i(!0),R=i(s);R.current=s,o(()=>(v.current=!0,()=>{v.current=!1,l.current?.abort(),l.current=null}),[]);let g=a(async(x)=>{l.current?.abort();let M=new AbortController;l.current=M;let m=R.current;t({scope:m,results:[],truncated:!1,error:null}),p(!0);try{let O=await fetch("/api/fs/search",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams(x),signal:M.signal});await mc(O,(w,F)=>{if(R.current!==m)return;if(w==="done"){let k=!1;try{k=JSON.parse(F)?.truncated===!0}catch{}t((y)=>y.scope===m?{...y,truncated:k}:y);return}if(w==="error"){let k="Search failed";try{k=JSON.parse(F)?.error||k}catch{}t((y)=>y.scope===m?{...y,error:k}:y);return}if(w!=="matches")return;try{let k=JSON.parse(F);if(Array.isArray(k))t((y)=>y.scope===m?{...y,results:[...y.results,...k]}:y)}catch{}},M.signal)}catch{}finally{if(v.current&&l.current===M)l.current=null,p(!1)}},[]);return{results:r.scope===s?r.results:[],isSearching:c&&r.scope===s,truncated:r.scope===s&&r.truncated,error:r.scope===s?r.error:null,start:g}}function it({className:s="",enabled:r=!0,rootPath:t,onOpenFile:c,tabsMode:p=!1}){let[l,v]=S("search.query",""),[R,g]=S("search.replaceQuery",""),[x,M]=S("search.matchCase",!1),[m,O]=S("search.wholeWord",!1),[w,F]=S("search.useRegex",!1),[k,y]=S("search.includeFiles",""),[H,A]=n(!1),[L,_]=S("search.showIncludeField",!1),{activeRepo:h,setActiveRepo:N}=gr(t),{repos:I,scanning:C,rescan:G}=Ar(t,r),q=i(null),T=ut(),{results:z,isSearching:D,truncated:J,error:Y,start:Q}=de(`${t??""}\x00${h}`);ue(q,()=>A(!1));let P=a(()=>{if(!r)return;if(l.trim().length>2)return Q({q:l,matchCase:String(x),wholeWord:String(m),useRegex:String(w),includeFiles:L?k:"",...t?{root:t}:{},...h!=="."?{repo:h}:{}})},[r,l,x,m,w,L,k,t,h,Q]);o(()=>{let B=setTimeout(()=>{P()},300);return()=>clearTimeout(B)},[P]);let X=a((B)=>{if(!l)return;let j=B?[B]:Array.from(new Set(z.map((V)=>V.file)));if(j.length===0)return;T.submit({q:l,replaceWith:R,matchCase:String(x),wholeWord:String(m),useRegex:String(w),files:JSON.stringify(j),...t?{root:t}:{},...h!=="."?{repo:h}:{}},{method:"POST",action:"/api/fs/replace"})},[l,R,x,m,w,z,t,h,T]);if(o(()=>{if(T.state==="idle"&&T.data?.success)P()},[T.state,T.data,P]),!r)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${s}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e(he,{className:s,tabsMode:p,query:l,setQuery:v,replaceQuery:R,setReplaceQuery:g,matchCase:x,setMatchCase:M,wholeWord:m,setWholeWord:O,useRegex:w,setUseRegex:F,includeFiles:k,setIncludeFiles:y,showIncludeField:L,setShowIncludeField:_,showMenu:H,setShowMenu:A,menuRef:q,rootPath:t,activeRepo:h,setActiveRepo:N,repos:I,reposScanning:C,rescanRepos:G,results:z,isSearching:D,truncated:J,error:Y,onOpenFile:c,handleReplace:X,replaceBusy:T.state!=="idle"})}export{it as SearchPanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d,n,o,i,a,e,m,L,
|
|
2
|
-
${I}`:y,className:`pl-2 pr-1 py-0.5 text-[11px] font-mono max-w-[150px] truncate ${be}`,children:y}),e("button",{type:"button",onClick:()=>c(p.id),"aria-label":`Tutup tab ${y}`,title:`Tutup tab ${y}`,className:`mr-0.5 p-1 rounded hover:bg-error hover:text-paper ${be} ${g?"text-on-ink-muted":"text-ink/40 opacity-0 group-hover:opacity-100 focus-visible:opacity-100"}`,children:e(b,{size:11})})]},p.id)})}),e("button",{type:"button",onClick:u,disabled:!s,"aria-label":"Tab baru",title:s?"Tab baru":`Maksimal ${W} tab`,className:"p-1 rounded hover:bg-ink/5 text-ink/60 hover:text-ink disabled:opacity-30 disabled:hover:bg-transparent disabled:cursor-not-allowed cursor-pointer transition-colors flex-shrink-0",children:e(P,{size:13})})]})}var xe="w-full min-w-0 bg-canvas border border-ink/15 rounded px-2 py-1 text-[11px] font-mono text-ink placeholder:text-ink/35 focus:outline-none focus:border-ink/40";function De(t){if(!t||t.ok)return null;if(t.reason==="cross-origin")return"This page is cross-origin, so its elements cannot be read. Name the part and add a note instead.";if(t.reason==="no-frame")return"The page has not loaded, so its elements cannot be read yet.";return"There is no element at this point (empty space). Name the part instead."}function we({shape:t,index:r,readability:s,onLabel:l,onNote:c}){let u=De(s),f=t.element;return e("div",{className:"flex items-start gap-1.5 min-w-0",children:[e("span",{className:"text-[11px] font-mono text-ink/45 pt-1 flex-shrink-0",children:[Xu[t.tool]," #",r]}),e("div",{className:"flex-1 min-w-0 space-y-1",children:[e("div",{className:"flex items-center gap-1 flex-wrap",children:[e("span",{className:"text-[10px] uppercase font-mono text-ink/40",children:"bagian"}),UA.map((p)=>{let g=t.label===p;return e("button",{type:"button",onClick:()=>l(g?"":p),"aria-pressed":g,className:`px-1.5 py-0.5 rounded-full border text-[10px] font-mono transition-colors cursor-pointer ${g?"bg-ink text-canvas border-ink":"bg-canvas text-ink/65 border-ink/15 hover:border-ink/40"}`,children:p},p)}),e("input",{value:t.label,onInput:(p)=>l(p.currentTarget.value),placeholder:"or type your own…","aria-label":"Name of the marked part",spellcheck:!1,className:`${xe} flex-1 min-w-[110px]`})]}),e("textarea",{value:t.note,onInput:(p)=>c(p.currentTarget.value),placeholder:"What is wrong with this part? (e.g. the Pay button looks disabled)",rows:2,"aria-label":"Annotation note",className:`${xe} resize-y`}),f?e("p",{className:"text-[10px] font-mono text-ink/45 truncate",title:f.path,children:["elemen: ",f.path,f.state?` · ${f.state}`:""]}):null,u?e("p",{className:"text-[10px] text-ink/40",children:u}):null]})]})}var Ge=["box","pin","arrow"],Ve="px-2 py-1 rounded text-[11px] font-mono border transition-colors cursor-pointer",q="flex items-center gap-1 px-2 py-1 rounded text-[11px] border border-ink/15 hover:border-ink/40 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed";function ve({tool:t,shapes:r,selectedId:s,readability:l,onTool:c,onLabel:u,onNote:f,onRemove:p,onReset:g,onCancel:y,onSend:I}){let S=r.find((B)=>B.id===s)??null,w=r.length>0;return e("div",{className:"flex-shrink-0 border-b border-ink/10 bg-paper px-2.5 py-1.5 space-y-1.5 select-none",children:[e("div",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-[10px] uppercase font-mono text-ink/50 mr-1",children:"Anotasi"}),Ge.map((B)=>e("button",{type:"button",onClick:()=>c(B),"aria-pressed":t===B,className:`${Ve} ${t===B?"bg-ink text-canvas border-ink":"bg-canvas text-ink/70 border-ink/15 hover:border-ink/40"}`,children:Xu[B]},B)),e("span",{className:"text-[11px] font-mono text-ink/45 ml-1",children:r.length>0?`${r.length} mark${r.length===1?"":"s"}`:"drag on the page to mark a part"}),e("div",{className:"flex-1"}),e("button",{type:"button",onClick:g,disabled:!w,className:q,title:"Clear all marks",children:[e(L,{size:12})," Bersihkan"]}),e("button",{type:"button",onClick:I,disabled:!w,className:q,title:"Kirim anotasi ke draft chat",children:[e($n,{size:12})," Kirim ke chat"]}),e("button",{type:"button",onClick:y,className:q,title:"Tutup mode anotasi",children:e(b,{size:12})})]}),S?e("div",{className:"flex items-start gap-1.5",children:[e("div",{className:"flex-1 min-w-0",children:e(we,{shape:S,index:r.indexOf(S)+1,readability:l,onLabel:(B)=>u(S.id,B),onNote:(B)=>f(S.id,B)})}),e("button",{type:"button",onClick:()=>p(S.id),className:q,title:"Remove this mark",children:e(L,{size:12})})]}):e("p",{className:"text-[11px] text-ink/45",children:"This page cannot be screenshotted, so what gets sent is the area, the part name and your note."})]})}var ye=0;function Te(){return ye+=1,`annot-${Date.now().toString(36)}-${ye}`}function ke(t){let[r,s]=n(!1),[l,c]=n("box"),[u,f]=n([]),[p,g]=n(null);o(()=>{f([]),g(null)},[t]);let y=a(()=>{s((E)=>!E),g(null)},[]),I=a(()=>{g(null),s(!1)},[]),S=a((E)=>{f((C)=>[...C,E]),g(E.id)},[]),w=a((E,C)=>{f((x)=>x.map((T)=>T.id===E?{...T,note:C}:T))},[]),B=a((E,C)=>{f((x)=>x.map((T)=>T.id===E?{...T,label:C}:T))},[]),h=a((E)=>{f((C)=>C.filter((x)=>x.id!==E)),g((C)=>C===E?null:C)},[]),F=a(()=>{f([]),g(null)},[]);return{active:r,tool:l,shapes:u,selectedId:p,setTool:c,toggle:y,close:I,add:S,setNote:w,setLabel:B,select:g,remove:h,reset:F}}var Xe=4,X="var(--theme-error)";function Ae({shapes:t,tool:r,selectedId:s,onMeasure:l,onAdd:c,onSelect:u}){let f=i(null),p=i(null),[g,y]=n(null),[I,S]=n({width:0,height:0});o(()=>{let x=f.current;if(!x)return;let T=()=>{let k=x.getBoundingClientRect();if(k.width<=0||k.height<=0)return;S((z)=>z.width===k.width&&z.height===k.height?z:{width:k.width,height:k.height}),l({width:k.width,height:k.height})};if(T(),typeof ResizeObserver!=="function")return;let U=new ResizeObserver(T);return U.observe(x),()=>U.disconnect()},[l]);let w=(x)=>{let T=f.current;if(!T)return null;let U=T.getBoundingClientRect(),k={x:x.clientX-U.left,y:x.clientY-U.top};return{normalized:zA(U,k),px:k.x,py:k.y}},B=(x)=>{if(x.button!==0)return;let T=w(x);if(!T)return;x.preventDefault(),u(null),x.currentTarget.setPointerCapture?.(x.pointerId);let U={id:Te(),tool:r,start:T.normalized,end:T.normalized,label:"",note:""};p.current=U,y(U)},h=(x)=>{let T=p.current;if(!T)return;let U=w(x);if(!U)return;let k={...T,end:U.normalized};p.current=k,y(k)},F=(x)=>{let T=p.current;if(!T)return;let U=w(x),k=U?{...T,end:U.normalized}:T;if(p.current=null,y(null),x.currentTarget.releasePointerCapture?.(x.pointerId),k.tool!=="pin"){let z=f.current?.getBoundingClientRect();if((z?Math.hypot((k.end.x-k.start.x)*z.width,(k.end.y-k.start.y)*z.height):0)<Xe)return}c(k)},E=()=>{p.current=null,y(null)},C=g?[...t,g]:t;return e("div",{ref:f,className:"absolute inset-0 cursor-crosshair touch-none",onPointerDown:B,onPointerMove:h,onPointerUp:F,onPointerCancel:E,children:e("svg",{className:"absolute inset-0 w-full h-full",viewBox:`0 0 ${Math.max(1,I.width)} ${Math.max(1,I.height)}`,preserveAspectRatio:"none","aria-label":"Page annotation area",children:C.map((x,T)=>e(We,{shape:x,index:T+1,box:I,selected:x.id===s,onSelect:()=>u(x.id)},x.id))})})}function We({shape:t,index:r,box:s,selected:l,onSelect:c}){let u={x:t.start.x*s.width,y:t.start.y*s.height},f={x:t.end.x*s.width,y:t.end.y*s.height},p=nm(t),g=l?3:2,y=String(r);return e("g",{onPointerDown:(S)=>{S.stopPropagation(),S.preventDefault(),c()},className:"cursor-pointer",children:[t.tool==="box"&&e("rect",{x:p.x*s.width,y:p.y*s.height,width:Math.max(1,p.width*s.width),height:Math.max(1,p.height*s.height),fill:X,fillOpacity:l?0.16:0.1,stroke:X,strokeWidth:g,vectorEffect:"non-scaling-stroke",rx:3}),t.tool==="arrow"&&e(d,{children:[e("line",{x1:u.x,y1:u.y,x2:f.x,y2:f.y,stroke:X,strokeWidth:g,vectorEffect:"non-scaling-stroke"}),e("circle",{cx:f.x,cy:f.y,r:4,fill:X})]}),t.tool==="pin"&&e("circle",{cx:u.x,cy:u.y,r:7,fill:X,fillOpacity:l?0.5:0.3,stroke:X,strokeWidth:g}),e("circle",{cx:u.x,cy:u.y,r:9,fill:X}),e("text",{x:u.x,y:u.y,textAnchor:"middle",dominantBaseline:"central",fontSize:11,fontWeight:700,fill:"var(--theme-paper)",children:y})]})}function Be(t){let r=t.trim();if(!r)return r;let s=/^[a-z][a-z0-9+.-]*:/i.test(r)?r:`https://${r}`,l=new URL(s);if(l.protocol!=="http:"&&l.protocol!=="https:")throw Error("Only http and https URLs are allowed");return l.toString()}var Ee="userBrowser.tabs",Ne="userBrowser.activeTabId",Ze="userBrowser.inputUrl",Ye="userBrowser.history",je="userBrowser.historyIndex";function Se(){let[t,r]=_(Ee,[]),[s,l]=_(Ne,null),[c,u]=_(Ze,""),[f,p]=n(null),[g,y]=n(void 0),{sessionId:I,ready:S}=Oe(),w=i(null),B=(N,A)=>Ce(I,N)??A,h=me(t,s),F=K(h);o(()=>{if(!S||w.current===I)return;w.current=I;let N=B(Ee,[]),A=se(N);if(A.length>0){if(JSON.stringify(A)!==JSON.stringify(N))r(A);let Y=B(Ne,null);if(!A.some((v)=>v.id===Y))l(A[A.length-1].id);return}let[M]=se([{id:Z(),history:B(Ye,[]),index:B(je,-1),frameKey:0}]),R=M&&M.history.length>0?M:j(Z());r([R]),l(R.id)},[S,I,r,l]);let E=a((N,A)=>{r((M)=>M.map((R)=>R.id===N?A(R):R))},[r]),C=a((N)=>{let A=N.trim();if(!A)return;let M;try{M=Be(A)}catch(R){y(R instanceof Error?R.message:"Alamat tidak valid");return}if(y(void 0),u(M),!h){let R=j(Z(),M);r([R]),l(R.id),p(R.id);return}p(h.id),E(h.id,(R)=>ue(R,M))},[h,l,u,r,E]),x=a(()=>{if(!h||!te(h))return;p(h.id),E(h.id,(N)=>oe(N,-1))},[h,E]),T=a(()=>{if(!h||!ne(h))return;p(h.id),E(h.id,(N)=>oe(N,1))},[h,E]),U=a(()=>{if(!h||!F)return;p(h.id),E(h.id,re)},[h,F,E]),k=a((N)=>{p((A)=>A===N?null:A)},[]),z=a(()=>{if(t.length>=W)return;let N=j(Z());r((A)=>[...A,N]),l(N.id),u(""),y(void 0)},[l,u,r,t.length]),G=a((N)=>{let A=t.find((M)=>M.id===N);if(!A)return;l(N),u(K(A)),y(void 0)},[l,u,t]),V=a((N)=>{let A=pe(t,s,N);if(A.tabs.length===0){let M=j(Z());r([M]),l(M.id),u("");return}if(r(A.tabs),A.activeId!==s){l(A.activeId);let M=A.tabs.find((R)=>R.id===A.activeId);u(K(M)),y(void 0)}},[s,l,u,r,t]);return{tabs:t,activeTab:h,activeTabId:h?.id??null,url:F,input:c,setInput:u,frameKey:h?.frameKey??0,loading:f!==null&&f===h?.id,error:g,canGoBack:te(h),canGoForward:ne(h),canOpenTab:t.length<W,submit:C,goBack:x,goForward:T,reload:U,markLoaded:k,openTab:z,selectTab:G,closeTab:V}}function qe(t){if(!t)return"no-frame";try{return t.contentDocument?"readable":"cross-origin"}catch{return"cross-origin"}}function J(t){let r=t.replace(/\s+/g," ").trim();return r.length>60?`${r.slice(0,59)}…`:r}function Je(t){let r=t.tagName.toLowerCase();if(t.id)return`${r}#${t.id}`;for(let l of["data-testid","data-test","aria-label"]){let c=t.getAttribute(l);if(c)return`${r}[${l}="${J(c)}"]`}let s=t.getAttribute("role");if(s)return`${r}[role="${s}"]`;return r}function Qe(t){let r=[],s=t;while(s&&r.length<4){if(s.tagName.toLowerCase()==="html")break;r.unshift(Je(s)),s=s.parentElement}return r.join(" > ")}function et(t){let r=[];if(t.disabled)r.push("nonaktif");if(t instanceof HTMLSelectElement||t.tagName.toLowerCase()==="select"){let s=t,c=s.selectedOptions?.[0]?.textContent?.trim()||s.value;if(c)r.push(`nilai "${J(c)}"`);let u=s.options?.length??0;if(u>0)r.push(`${u} opsi`)}else if(t.tagName.toLowerCase()==="input"){let s=t;if(s.type)r.push(`tipe ${s.type}`);if(s.type!=="password"&&s.placeholder)r.push(`placeholder "${J(s.placeholder)}"`)}return r.length>0?r.join(", "):void 0}function tt(t){let r={path:Qe(t),tag:t.tagName.toLowerCase()},s=t.getAttribute("role");if(s)r.role=s;let l=J(t.innerText??t.textContent??"");if(l)r.text=l;let c=et(t);if(c)r.state=c;return r}function Me(t,r){let s=qe(t);if(s!=="readable")return{ok:!1,reason:s};let{contentWindow:l,contentDocument:c}=t;if(!l||!c)return{ok:!1,reason:"cross-origin"};try{let u=Math.min(Math.max(r.x,0),1)*l.innerWidth,f=Math.min(Math.max(r.y,0),1)*l.innerHeight,p=c.elementFromPoint(u,f);if(!p||p===c.documentElement||p===c.body)return{ok:!1,reason:"no-element"};return{ok:!0,element:tt(p)}}catch{return{ok:!1,reason:"cross-origin"}}}function rn({className:t="",active:r=!0}){let[s,l]=_("userBrowser.viewportMode","responsive"),[c,u]=_("userBrowser.zoomLevel",100),[f,p]=n(null),[g,y]=n(null),[I,S]=n(null),{tabs:w,activeTabId:B,url:h,input:F,setInput:E,loading:C,error:x,canGoBack:T,canGoForward:U,canOpenTab:k,submit:z,goBack:G,goForward:V,reload:N,markLoaded:A,openTab:M,selectTab:R,closeTab:Y}=Se(),v=ke(`${B??""}:${w.find((O)=>O.id===B)?.frameKey??0}`),Le=a(()=>{if(!h)return;window.open(h,"_blank","noopener,noreferrer")},[h]),Ie=a(()=>{if(!h)return;uc({url:h})},[h]),Ue=a((O)=>{p((H)=>H&&H.width===O.width&&H.height===O.height?H:O)},[]),Re=a((O)=>{let H=Me(g,O.start);S(H),v.add(H.ok?{...O,element:H.element}:O)},[v,g]),Pe=a(()=>{if(!h||v.shapes.length===0)return;let O=c/100;uc({url:h,annotations:v.shapes,panel:{width:(f?.width??0)/O,height:(f?.height??0)/O,viewportMode:s,zoom:c}}),v.close()},[h,v,f,s,c]),Q=v.active&&Boolean(h),_e=C?B??null:null;return e("div",{"data-user-browser-panel":"",className:`flex flex-col h-full w-full bg-paper text-ink overflow-hidden ${t}`,children:[e(ge,{tabs:w,activeTabId:B,canOpenTab:k,onSelect:R,onClose:Y,onNewTab:M}),e(ae,{url:h,input:F,loading:C,error:x,canGoBack:T,canGoForward:U,viewportMode:s,zoomLevel:c,onInputChange:E,onSubmit:z,onBack:G,onForward:V,onReload:N,onOpenExternal:Le,onIncludeInChat:Ie,onChangeViewport:l,onZoomIn:()=>u((O)=>Math.min(200,O+10)),onZoomOut:()=>u((O)=>Math.max(50,O-10)),onResetZoom:()=>u(100),onSetZoom:u,focusKey:B??void 0,annotate:{active:Q,count:v.shapes.length,onToggle:v.toggle}}),Q&&e(ve,{tool:v.tool,shapes:v.shapes,selectedId:v.selectedId,readability:I,onTool:v.setTool,onLabel:v.setLabel,onNote:v.setNote,onRemove:v.remove,onReset:v.reset,onCancel:v.close,onSend:Pe}),e(he,{tabs:w,activeTabId:B,loadingTabId:_e,viewportMode:s,zoomLevel:c,onLoad:A,onFrame:y,active:r,overlay:Q?e(Ae,{shapes:v.shapes,tool:v.tool,selectedId:v.selectedId,onMeasure:Ue,onAdd:Re,onSelect:v.select}):null})]})}export{rn as UserBrowserPanel};
|
|
1
|
+
import{d,n,o,i,a,e,m,L,an,ya,Fe,P,D,Un,b,Oe,Ee,S,VA,lm,ad,YA,Ac}from"./index-amys498v.js";import{Nu}from"./index-bjv5ga2e.js";import"./index-zq0qxb17.js";var $e={idle:"Kosong",loading:"Memuat",ready:"Siap"},ee="p-1 rounded hover:bg-ink/5 disabled:opacity-25 disabled:hover:bg-transparent text-ink/70 hover:text-ink cursor-pointer disabled:cursor-not-allowed transition-colors";function ae({url:t,input:r,loading:s,error:l,canGoBack:c,canGoForward:u,viewportMode:f,zoomLevel:p,onInputChange:g,onSubmit:y,onBack:U,onForward:M,onReload:w,onOpenExternal:B,onIncludeInChat:h,onChangeViewport:F,onZoomIn:E,onZoomOut:_,onResetZoom:x,onSetZoom:T,annotate:R,focusKey:k}){let z=i(void 0),G=i(null),V=i(null);o(()=>{if(z.current===t)return;z.current=t;let v=V.current;if(V.current=null,!t)return;if(v!==null&&v!==r)return;g(t)},[t,r,g]);let N=i(k);o(()=>{if(k===void 0||N.current===k)return;if(N.current=k,t)return;G.current?.focus()},[k,t]);let A=(v)=>{V.current=v,g(v)},I=!t?"idle":s?"loading":"ready",C=I==="ready"?"bg-success animate-pulse":I==="loading"?"bg-ink/40 animate-pulse":"bg-ink/25",Y=e("div",{className:"flex items-center bg-canvas border border-ink/10 rounded-md p-0.5 space-x-0.5 flex-shrink-0",children:[e("button",{type:"button",onClick:U,disabled:!c,"aria-label":"Back",title:"Back",className:ee,children:e(an,{size:12})}),e("button",{type:"button",onClick:M,disabled:!u,"aria-label":"Maju",title:"Maju",className:ee,children:e(ya,{size:12})}),e("button",{type:"button",onClick:w,disabled:!t,"aria-label":"Reload",title:"Reload",className:ee,children:e(D,{size:12,className:s?"animate-spin":void 0})})]});return e(Nu,{twoRows:!0,url:t,statusDotClass:C,statusLabel:$e[I],viewportMode:f,zoomLevel:p,onChangeViewport:F,onZoomIn:E,onZoomOut:_,onResetZoom:x,onSetZoom:T,annotate:R,onIncludeInChat:h,onOpenExternal:B,openExternalLabel:"Buka di tab baru",openExternalTitle:"Buka di tab baru (untuk situs yang menolak iframe)",children:e("div",{className:"flex items-center flex-1 min-w-0 space-x-1.5",children:[Y,e("form",{className:`flex-1 min-w-0 flex items-center bg-canvas border rounded-md px-2 py-1 space-x-1 focus-within:border-ink/40 ${l?"border-error":"border-ink/15"}`,onSubmit:(v)=>{v.preventDefault(),y(r)},children:[e(Fe,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{ref:G,type:"text",value:r,onChange:(v)=>A(v.currentTarget.value),placeholder:"Type an address (e.g. localhost:5173) and press Enter…","aria-label":"Browser address","aria-invalid":l!==void 0&&l!==null,title:l??void 0,spellcheck:!1,autoComplete:"off",className:`w-full min-w-0 bg-transparent outline-none font-mono text-[11px] placeholder:text-ink/35 ${l?"text-error":"text-ink/90"}`})]})]})})}var ie={"desktop-16-9":"w-full max-w-[1280px] aspect-video max-h-full border border-ink/20 rounded-lg shadow-md overflow-hidden my-auto",laptop:"w-[1024px] max-w-full h-[768px] max-h-full border border-ink/20 rounded-lg shadow-md overflow-hidden my-auto",tablet:"w-[768px] max-w-full h-[1024px] max-h-full border border-ink/20 rounded-lg shadow-md overflow-hidden my-auto",mobile:"w-[375px] max-w-full h-[667px] max-h-full border border-ink/20 rounded-xl shadow-md overflow-hidden my-auto","mobile-lg":"w-[414px] max-w-full h-[896px] max-h-full border border-ink/20 rounded-xl shadow-md overflow-hidden my-auto",responsive:"w-full h-full border-0"};function le(t){let r=t.trim();if(!r)return"";try{let s=new URL(r),l=s.pathname==="/"?"":s.pathname;return`${s.hostname}${l}`.slice(0,64)}catch{return r.slice(0,64)}}var W=12,ce=60,ze=8192,de=0;function Z(){return de+=1,`tab-${Date.now().toString(36)}-${de}`}function j(t,r=""){return r?{id:t,history:[r],index:0,frameKey:0}:{id:t,history:[],index:-1,frameKey:0}}function K(t){if(!t||t.index<0)return"";return t.history[t.index]??""}function te(t){return Boolean(t)&&t.index>0}function ne(t){return Boolean(t)&&t.index>=0&&t.index<t.history.length-1}function ue(t,r){if(K(t)===r)return re(t);let s=[...t.history.slice(0,t.index+1),r],l=Math.max(0,s.length-ce),c=l>0?s.slice(l):s;return{...t,history:c,index:c.length-1,frameKey:t.frameKey+1}}function oe(t,r){let s=t.index+r;if(s<0||s>=t.history.length)return t;return{...t,index:s}}function re(t){return{...t,frameKey:t.frameKey+1}}function pe(t,r,s){let l=t.findIndex((f)=>f.id===s);if(l===-1)return{tabs:t,activeId:r};let c=t.filter((f)=>f.id!==s);if(r!==s)return{tabs:c,activeId:r};let u=c[Math.min(l,c.length-1)]??null;return{tabs:c,activeId:u?u.id:null}}function me(t,r){return t.find((s)=>s.id===r)??t[t.length-1]??null}function Ke(t){if(!Array.isArray(t))return[];let r=[];for(let s of t){if(typeof s!=="string")continue;let l=s.trim();if(!l||l.length>ze)continue;if(r.push(l),r.length>=ce)break}return r}function se(t){if(!Array.isArray(t))return[];let r=[],s=new Set;for(let l of t){if(typeof l!=="object"||l===null)continue;let c=l,u=typeof c.id==="string"?c.id.trim():"";if(!u||s.has(u))continue;let f=Ke(c.history),p=typeof c.index==="number"&&Number.isFinite(c.index)?Math.trunc(c.index):-1,g=f.length===0?-1:Math.min(f.length-1,Math.max(0,p===-1?0:p)),y=typeof c.frameKey==="number"&&Number.isFinite(c.frameKey)?Math.trunc(c.frameKey):0;if(s.add(u),r.push({id:u,history:f,index:g,frameKey:Math.max(0,y)}),r.length>=W)break}return r}function fe(t){return le(K(t))||"Tab baru"}var He="clipboard-read; clipboard-write; fullscreen";function he({tabs:t,activeTabId:r,loadingTabId:s,viewportMode:l,zoomLevel:c,onLoad:u,active:f=!0,overlay:p,onFrame:g}){let y=i(new Map),U=t.map((w)=>`${w.id}:${w.frameKey}`).join("|");if(o(()=>{g?.(r?y.current.get(r)??null:null)},[r,g,U]),!f)return null;let M=t.filter((w)=>K(w)!=="");if(M.length===0)return e("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center select-none",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(Fe,{size:22})}),e("h3",{className:"text-sm font-semibold text-ink mb-1",children:"Browser Anda"}),e("p",{className:"text-xs text-ink/60 max-w-sm",children:"Type an address above and press Enter. The page loads inside this panel."}),e("p",{className:"text-[11px] text-ink/45 max-w-sm mt-2",children:"Sebagian situs (Google, GitHub) menolak ditampilkan dalam iframe — pakai tombol buka di tab baru."})]});return e("div",{className:"flex-1 min-h-0 relative flex items-center justify-center p-2 overflow-auto bg-canvas/60",children:M.map((w)=>{let B=K(w),h=w.id===r,F=w.id===s;return e("div",{"data-user-browser-tab":w.id,className:h?"relative flex-1 min-h-0 flex items-center justify-center":"hidden",children:[F?e("div",{className:"absolute inset-0 z-10 flex items-center justify-center pointer-events-none",children:e("div",{className:"flex items-center space-x-2 px-3 py-1.5 rounded-md bg-paper border border-ink/15",children:[e(m,{size:13,className:"animate-spin text-ink/50"}),e("span",{className:"text-[11px] font-mono text-ink/60",children:"Memuat…"})]})}):null,e("div",{className:`relative flex flex-col bg-white ${ie[l]} transition-all duration-200`,style:{zoom:c!==100?`${c}%`:void 0,transformOrigin:"top center"},children:[e("iframe",{ref:(E)=>{if(E)y.current.set(w.id,E);else y.current.delete(w.id)},src:B,title:`Browser pengguna ${w.id}`,onLoad:()=>u(w.id),referrerPolicy:"no-referrer",allow:He,className:"w-full h-full bg-white border-0",style:h&&p?{pointerEvents:"none"}:void 0},`${w.id}:${w.frameKey}`),h?p:null]})]},w.id)})})}var be="cursor-pointer transition-colors";function ge({tabs:t,activeTabId:r,canOpenTab:s,onSelect:l,onClose:c,onNewTab:u}){let f=i(null);return o(()=>{f.current?.scrollIntoView({block:"nearest",inline:"nearest"})},[r,t.length]),e("div",{"data-toolbar-band":"strip",className:"h-8 px-1.5 border-b border-ink/10 bg-paper flex items-center gap-1 flex-shrink-0 select-none",children:[e("div",{className:"flex-1 min-w-0 flex items-center gap-1 overflow-x-auto",children:t.map((p)=>{let g=p.id===r,y=fe(p),U=K(p);return e("div",{ref:g?f:void 0,className:`group flex items-center rounded border flex-shrink-0 ${g?"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:()=>l(p.id),"aria-pressed":g,"aria-label":`Tab ${y}`,title:U?`${y}
|
|
2
|
+
${U}`:y,className:`pl-2 pr-1 py-0.5 text-[11px] font-mono max-w-[150px] truncate ${be}`,children:y}),e("button",{type:"button",onClick:()=>c(p.id),"aria-label":`Tutup tab ${y}`,title:`Tutup tab ${y}`,className:`mr-0.5 p-1 rounded hover:bg-error hover:text-paper ${be} ${g?"text-on-ink-muted":"text-ink/40 opacity-0 group-hover:opacity-100 focus-visible:opacity-100"}`,children:e(b,{size:11})})]},p.id)})}),e("button",{type:"button",onClick:u,disabled:!s,"aria-label":"Tab baru",title:s?"Tab baru":`Maksimal ${W} tab`,className:"p-1 rounded hover:bg-ink/5 text-ink/60 hover:text-ink disabled:opacity-30 disabled:hover:bg-transparent disabled:cursor-not-allowed cursor-pointer transition-colors flex-shrink-0",children:e(P,{size:13})})]})}var xe="w-full min-w-0 bg-canvas border border-ink/15 rounded px-2 py-1 text-[11px] font-mono text-ink placeholder:text-ink/35 focus:outline-none focus:border-ink/40";function De(t){if(!t||t.ok)return null;if(t.reason==="cross-origin")return"This page is cross-origin, so its elements cannot be read. Name the part and add a note instead.";if(t.reason==="no-frame")return"The page has not loaded, so its elements cannot be read yet.";return"There is no element at this point (empty space). Name the part instead."}function we({shape:t,index:r,readability:s,onLabel:l,onNote:c}){let u=De(s),f=t.element;return e("div",{className:"flex items-start gap-1.5 min-w-0",children:[e("span",{className:"text-[11px] font-mono text-ink/45 pt-1 flex-shrink-0",children:[ad[t.tool]," #",r]}),e("div",{className:"flex-1 min-w-0 space-y-1",children:[e("div",{className:"flex items-center gap-1 flex-wrap",children:[e("span",{className:"text-[10px] uppercase font-mono text-ink/40",children:"bagian"}),YA.map((p)=>{let g=t.label===p;return e("button",{type:"button",onClick:()=>l(g?"":p),"aria-pressed":g,className:`px-1.5 py-0.5 rounded-full border text-[10px] font-mono transition-colors cursor-pointer ${g?"bg-ink text-canvas border-ink":"bg-canvas text-ink/65 border-ink/15 hover:border-ink/40"}`,children:p},p)}),e("input",{value:t.label,onInput:(p)=>l(p.currentTarget.value),placeholder:"or type your own…","aria-label":"Name of the marked part",spellcheck:!1,className:`${xe} flex-1 min-w-[110px]`})]}),e("textarea",{value:t.note,onInput:(p)=>c(p.currentTarget.value),placeholder:"What is wrong with this part? (e.g. the Pay button looks disabled)",rows:2,"aria-label":"Annotation note",className:`${xe} resize-y`}),f?e("p",{className:"text-[10px] font-mono text-ink/45 truncate",title:f.path,children:["elemen: ",f.path,f.state?` · ${f.state}`:""]}):null,u?e("p",{className:"text-[10px] text-ink/40",children:u}):null]})]})}var Ge=["box","pin","arrow"],Ve="px-2 py-1 rounded text-[11px] font-mono border transition-colors cursor-pointer",q="flex items-center gap-1 px-2 py-1 rounded text-[11px] border border-ink/15 hover:border-ink/40 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed";function ve({tool:t,shapes:r,selectedId:s,readability:l,onTool:c,onLabel:u,onNote:f,onRemove:p,onReset:g,onCancel:y,onSend:U}){let M=r.find((B)=>B.id===s)??null,w=r.length>0;return e("div",{className:"flex-shrink-0 border-b border-ink/10 bg-paper px-2.5 py-1.5 space-y-1.5 select-none",children:[e("div",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-[10px] uppercase font-mono text-ink/50 mr-1",children:"Anotasi"}),Ge.map((B)=>e("button",{type:"button",onClick:()=>c(B),"aria-pressed":t===B,className:`${Ve} ${t===B?"bg-ink text-canvas border-ink":"bg-canvas text-ink/70 border-ink/15 hover:border-ink/40"}`,children:ad[B]},B)),e("span",{className:"text-[11px] font-mono text-ink/45 ml-1",children:r.length>0?`${r.length} mark${r.length===1?"":"s"}`:"drag on the page to mark a part"}),e("div",{className:"flex-1"}),e("button",{type:"button",onClick:g,disabled:!w,className:q,title:"Clear all marks",children:[e(L,{size:12})," Bersihkan"]}),e("button",{type:"button",onClick:U,disabled:!w,className:q,title:"Kirim anotasi ke draft chat",children:[e(Un,{size:12})," Kirim ke chat"]}),e("button",{type:"button",onClick:y,className:q,title:"Tutup mode anotasi",children:e(b,{size:12})})]}),M?e("div",{className:"flex items-start gap-1.5",children:[e("div",{className:"flex-1 min-w-0",children:e(we,{shape:M,index:r.indexOf(M)+1,readability:l,onLabel:(B)=>u(M.id,B),onNote:(B)=>f(M.id,B)})}),e("button",{type:"button",onClick:()=>p(M.id),className:q,title:"Remove this mark",children:e(L,{size:12})})]}):e("p",{className:"text-[11px] text-ink/45",children:"This page cannot be screenshotted, so what gets sent is the area, the part name and your note."})]})}var ye=0;function Te(){return ye+=1,`annot-${Date.now().toString(36)}-${ye}`}function ke(t){let[r,s]=n(!1),[l,c]=n("box"),[u,f]=n([]),[p,g]=n(null);o(()=>{f([]),g(null)},[t]);let y=a(()=>{s((E)=>!E),g(null)},[]),U=a(()=>{g(null),s(!1)},[]),M=a((E)=>{f((_)=>[..._,E]),g(E.id)},[]),w=a((E,_)=>{f((x)=>x.map((T)=>T.id===E?{...T,note:_}:T))},[]),B=a((E,_)=>{f((x)=>x.map((T)=>T.id===E?{...T,label:_}:T))},[]),h=a((E)=>{f((_)=>_.filter((x)=>x.id!==E)),g((_)=>_===E?null:_)},[]),F=a(()=>{f([]),g(null)},[]);return{active:r,tool:l,shapes:u,selectedId:p,setTool:c,toggle:y,close:U,add:M,setNote:w,setLabel:B,select:g,remove:h,reset:F}}var Xe=4,X="var(--theme-error)";function Ae({shapes:t,tool:r,selectedId:s,onMeasure:l,onAdd:c,onSelect:u}){let f=i(null),p=i(null),[g,y]=n(null),[U,M]=n({width:0,height:0});o(()=>{let x=f.current;if(!x)return;let T=()=>{let k=x.getBoundingClientRect();if(k.width<=0||k.height<=0)return;M((z)=>z.width===k.width&&z.height===k.height?z:{width:k.width,height:k.height}),l({width:k.width,height:k.height})};if(T(),typeof ResizeObserver!=="function")return;let R=new ResizeObserver(T);return R.observe(x),()=>R.disconnect()},[l]);let w=(x)=>{let T=f.current;if(!T)return null;let R=T.getBoundingClientRect(),k={x:x.clientX-R.left,y:x.clientY-R.top};return{normalized:VA(R,k),px:k.x,py:k.y}},B=(x)=>{if(x.button!==0)return;let T=w(x);if(!T)return;x.preventDefault(),u(null),x.currentTarget.setPointerCapture?.(x.pointerId);let R={id:Te(),tool:r,start:T.normalized,end:T.normalized,label:"",note:""};p.current=R,y(R)},h=(x)=>{let T=p.current;if(!T)return;let R=w(x);if(!R)return;let k={...T,end:R.normalized};p.current=k,y(k)},F=(x)=>{let T=p.current;if(!T)return;let R=w(x),k=R?{...T,end:R.normalized}:T;if(p.current=null,y(null),x.currentTarget.releasePointerCapture?.(x.pointerId),k.tool!=="pin"){let z=f.current?.getBoundingClientRect();if((z?Math.hypot((k.end.x-k.start.x)*z.width,(k.end.y-k.start.y)*z.height):0)<Xe)return}c(k)},E=()=>{p.current=null,y(null)},_=g?[...t,g]:t;return e("div",{ref:f,className:"absolute inset-0 cursor-crosshair touch-none",onPointerDown:B,onPointerMove:h,onPointerUp:F,onPointerCancel:E,children:e("svg",{className:"absolute inset-0 w-full h-full",viewBox:`0 0 ${Math.max(1,U.width)} ${Math.max(1,U.height)}`,preserveAspectRatio:"none","aria-label":"Page annotation area",children:_.map((x,T)=>e(We,{shape:x,index:T+1,box:U,selected:x.id===s,onSelect:()=>u(x.id)},x.id))})})}function We({shape:t,index:r,box:s,selected:l,onSelect:c}){let u={x:t.start.x*s.width,y:t.start.y*s.height},f={x:t.end.x*s.width,y:t.end.y*s.height},p=lm(t),g=l?3:2,y=String(r);return e("g",{onPointerDown:(M)=>{M.stopPropagation(),M.preventDefault(),c()},className:"cursor-pointer",children:[t.tool==="box"&&e("rect",{x:p.x*s.width,y:p.y*s.height,width:Math.max(1,p.width*s.width),height:Math.max(1,p.height*s.height),fill:X,fillOpacity:l?0.16:0.1,stroke:X,strokeWidth:g,vectorEffect:"non-scaling-stroke",rx:3}),t.tool==="arrow"&&e(d,{children:[e("line",{x1:u.x,y1:u.y,x2:f.x,y2:f.y,stroke:X,strokeWidth:g,vectorEffect:"non-scaling-stroke"}),e("circle",{cx:f.x,cy:f.y,r:4,fill:X})]}),t.tool==="pin"&&e("circle",{cx:u.x,cy:u.y,r:7,fill:X,fillOpacity:l?0.5:0.3,stroke:X,strokeWidth:g}),e("circle",{cx:u.x,cy:u.y,r:9,fill:X}),e("text",{x:u.x,y:u.y,textAnchor:"middle",dominantBaseline:"central",fontSize:11,fontWeight:700,fill:"var(--theme-paper)",children:y})]})}function Be(t){let r=t.trim();if(!r)return r;let s=/^[a-z][a-z0-9+.-]*:/i.test(r)?r:`https://${r}`,l=new URL(s);if(l.protocol!=="http:"&&l.protocol!=="https:")throw Error("Only http and https URLs are allowed");return l.toString()}var Ne="userBrowser.tabs",Se="userBrowser.activeTabId",Ze="userBrowser.inputUrl",Ye="userBrowser.history",je="userBrowser.historyIndex";function Me(){let[t,r]=S(Ne,[]),[s,l]=S(Se,null),[c,u]=S(Ze,""),[f,p]=n(null),[g,y]=n(void 0),{sessionId:U,ready:M}=Oe(),w=i(null),B=(N,A)=>Ee(U,N)??A,h=me(t,s),F=K(h);o(()=>{if(!M||w.current===U)return;w.current=U;let N=B(Ne,[]),A=se(N);if(A.length>0){if(JSON.stringify(A)!==JSON.stringify(N))r(A);let Y=B(Se,null);if(!A.some((v)=>v.id===Y))l(A[A.length-1].id);return}let[I]=se([{id:Z(),history:B(Ye,[]),index:B(je,-1),frameKey:0}]),C=I&&I.history.length>0?I:j(Z());r([C]),l(C.id)},[M,U,r,l]);let E=a((N,A)=>{r((I)=>I.map((C)=>C.id===N?A(C):C))},[r]),_=a((N)=>{let A=N.trim();if(!A)return;let I;try{I=Be(A)}catch(C){y(C instanceof Error?C.message:"Alamat tidak valid");return}if(y(void 0),u(I),!h){let C=j(Z(),I);r([C]),l(C.id),p(C.id);return}p(h.id),E(h.id,(C)=>ue(C,I))},[h,l,u,r,E]),x=a(()=>{if(!h||!te(h))return;p(h.id),E(h.id,(N)=>oe(N,-1))},[h,E]),T=a(()=>{if(!h||!ne(h))return;p(h.id),E(h.id,(N)=>oe(N,1))},[h,E]),R=a(()=>{if(!h||!F)return;p(h.id),E(h.id,re)},[h,F,E]),k=a((N)=>{p((A)=>A===N?null:A)},[]),z=a(()=>{if(t.length>=W)return;let N=j(Z());r((A)=>[...A,N]),l(N.id),u(""),y(void 0)},[l,u,r,t.length]),G=a((N)=>{let A=t.find((I)=>I.id===N);if(!A)return;l(N),u(K(A)),y(void 0)},[l,u,t]),V=a((N)=>{let A=pe(t,s,N);if(A.tabs.length===0){let I=j(Z());r([I]),l(I.id),u("");return}if(r(A.tabs),A.activeId!==s){l(A.activeId);let I=A.tabs.find((C)=>C.id===A.activeId);u(K(I)),y(void 0)}},[s,l,u,r,t]);return{tabs:t,activeTab:h,activeTabId:h?.id??null,url:F,input:c,setInput:u,frameKey:h?.frameKey??0,loading:f!==null&&f===h?.id,error:g,canGoBack:te(h),canGoForward:ne(h),canOpenTab:t.length<W,submit:_,goBack:x,goForward:T,reload:R,markLoaded:k,openTab:z,selectTab:G,closeTab:V}}function qe(t){if(!t)return"no-frame";try{return t.contentDocument?"readable":"cross-origin"}catch{return"cross-origin"}}function J(t){let r=t.replace(/\s+/g," ").trim();return r.length>60?`${r.slice(0,59)}…`:r}function Je(t){let r=t.tagName.toLowerCase();if(t.id)return`${r}#${t.id}`;for(let l of["data-testid","data-test","aria-label"]){let c=t.getAttribute(l);if(c)return`${r}[${l}="${J(c)}"]`}let s=t.getAttribute("role");if(s)return`${r}[role="${s}"]`;return r}function Qe(t){let r=[],s=t;while(s&&r.length<4){if(s.tagName.toLowerCase()==="html")break;r.unshift(Je(s)),s=s.parentElement}return r.join(" > ")}function et(t){let r=[];if(t.disabled)r.push("nonaktif");if(t instanceof HTMLSelectElement||t.tagName.toLowerCase()==="select"){let s=t,c=s.selectedOptions?.[0]?.textContent?.trim()||s.value;if(c)r.push(`nilai "${J(c)}"`);let u=s.options?.length??0;if(u>0)r.push(`${u} opsi`)}else if(t.tagName.toLowerCase()==="input"){let s=t;if(s.type)r.push(`tipe ${s.type}`);if(s.type!=="password"&&s.placeholder)r.push(`placeholder "${J(s.placeholder)}"`)}return r.length>0?r.join(", "):void 0}function tt(t){let r={path:Qe(t),tag:t.tagName.toLowerCase()},s=t.getAttribute("role");if(s)r.role=s;let l=J(t.innerText??t.textContent??"");if(l)r.text=l;let c=et(t);if(c)r.state=c;return r}function Le(t,r){let s=qe(t);if(s!=="readable")return{ok:!1,reason:s};let{contentWindow:l,contentDocument:c}=t;if(!l||!c)return{ok:!1,reason:"cross-origin"};try{let u=Math.min(Math.max(r.x,0),1)*l.innerWidth,f=Math.min(Math.max(r.y,0),1)*l.innerHeight,p=c.elementFromPoint(u,f);if(!p||p===c.documentElement||p===c.body)return{ok:!1,reason:"no-element"};return{ok:!0,element:tt(p)}}catch{return{ok:!1,reason:"cross-origin"}}}function on({className:t="",active:r=!0}){let[s,l]=S("userBrowser.viewportMode","responsive"),[c,u]=S("userBrowser.zoomLevel",100),[f,p]=n(null),[g,y]=n(null),[U,M]=n(null),{tabs:w,activeTabId:B,url:h,input:F,setInput:E,loading:_,error:x,canGoBack:T,canGoForward:R,canOpenTab:k,submit:z,goBack:G,goForward:V,reload:N,markLoaded:A,openTab:I,selectTab:C,closeTab:Y}=Me(),v=ke(`${B??""}:${w.find((O)=>O.id===B)?.frameKey??0}`),Ie=a(()=>{if(!h)return;window.open(h,"_blank","noopener,noreferrer")},[h]),Ue=a(()=>{if(!h)return;Ac({url:h})},[h]),Re=a((O)=>{p((H)=>H&&H.width===O.width&&H.height===O.height?H:O)},[]),Pe=a((O)=>{let H=Le(g,O.start);M(H),v.add(H.ok?{...O,element:H.element}:O)},[v,g]),Ce=a(()=>{if(!h||v.shapes.length===0)return;let O=c/100;Ac({url:h,annotations:v.shapes,panel:{width:(f?.width??0)/O,height:(f?.height??0)/O,viewportMode:s,zoom:c}}),v.close()},[h,v,f,s,c]),Q=v.active&&Boolean(h),_e=_?B??null:null;return e("div",{"data-user-browser-panel":"",className:`flex flex-col h-full w-full bg-paper text-ink overflow-hidden ${t}`,children:[e(ge,{tabs:w,activeTabId:B,canOpenTab:k,onSelect:C,onClose:Y,onNewTab:I}),e(ae,{url:h,input:F,loading:_,error:x,canGoBack:T,canGoForward:R,viewportMode:s,zoomLevel:c,onInputChange:E,onSubmit:z,onBack:G,onForward:V,onReload:N,onOpenExternal:Ie,onIncludeInChat:Ue,onChangeViewport:l,onZoomIn:()=>u((O)=>Math.min(200,O+10)),onZoomOut:()=>u((O)=>Math.max(50,O-10)),onResetZoom:()=>u(100),onSetZoom:u,focusKey:B??void 0,annotate:{active:Q,count:v.shapes.length,onToggle:v.toggle}}),Q&&e(ve,{tool:v.tool,shapes:v.shapes,selectedId:v.selectedId,readability:U,onTool:v.setTool,onLabel:v.setLabel,onNote:v.setNote,onRemove:v.remove,onReset:v.reset,onCancel:v.close,onSend:Ce}),e(he,{tabs:w,activeTabId:B,loadingTabId:_e,viewportMode:s,zoomLevel:c,onLoad:A,onFrame:y,active:r,overlay:Q?e(Ae,{shapes:v.shapes,tool:v.tool,selectedId:v.selectedId,onMeasure:Re,onAdd:Pe,onSelect:v.select}):null})]})}export{on as UserBrowserPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d,n,o,i,u,a,le,e,s,f,B,se,va,re,ce,b,Mp,Be,_,At,Ha,ot,me,it,yA,pi}from"./index-q36gq3yz.js";var ae={name:"chevrons-up-down",size:24,node:[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]},F=s(ae);function O(l,r,c=1e6){return{sessionId:l,sessionTitle:r,modelId:"",modelName:"",timestamp:"",contextUsed:0,contextLimit:c,contextPercent:0,messagesCount:0,userCount:0,assistantCount:0,totalCost:0,costFormatted:"$0.00",cacheHitAverage:0,costBreakdown:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0},lastMessage:{input:0,output:0,reasoning:0,cacheRead:0,cacheWrite:0,cacheHitPercent:0},distribution:{userTokens:0,userPercent:0,assistantTokens:0,assistantPercent:0,toolTokens:0,toolPercent:0,otherTokens:0,otherPercent:100},rawMessages:[]}}function J({used:l,limit:r,percent:c}){let h=l.toLocaleString(),x=r.toLocaleString(),m=Math.min(100,Math.max(0,c));return e("div",{className:"bg-canvas border border-ink/10 rounded-xl p-4 transition-all",children:[e("div",{className:"flex items-center justify-between text-xs mb-2",children:[e("span",{className:"font-semibold text-ink/80",children:"Context"}),e("span",{className:"font-mono text-ink/70 text-[11px]",children:[h," / ",x]})]}),e("div",{className:"w-full h-1.5 bg-ink/10 rounded-full overflow-hidden mb-2",children:e("div",{className:"h-full bg-ink/70 rounded-full transition-all duration-500 ease-out",style:{width:`${m}%`}})}),e("div",{className:"text-[11px] font-mono text-ink/50 text-left",children:[m.toFixed(1),"% used"]})]})}function T(l){return l<0.01?"$0.01":`$${l.toFixed(6).replace(/0+$/,"").replace(/\.$/,"")}`}function Z({open:l,onClose:r,breakdown:c,costFormatted:h}){let x=i(null);if(me(x,r),!l)return null;let m=c?[{label:"Total Cost",value:T(c.total),strong:!0},{label:"Input (cache miss)",value:T(c.input)},{label:"Output",value:T(c.output)},{label:"Cache Read (cache hit)",value:T(c.cacheRead)},{label:"Cache Write",value:T(c.cacheWrite)}]:[{label:"Total Cost",value:h??"$0.01",strong:!0}];return e("div",{ref:x,className:"glass-popover absolute top-full right-0 mt-1.5 z-50 w-64 bg-paper border border-ink/10 rounded-lg shadow-lg p-3",role:"dialog","aria-modal":"false",children:[e("div",{className:"flex items-center justify-between mb-2.5",children:[e("span",{className:"text-xs font-semibold text-ink tracking-tight",children:"Cost Breakdown"}),e("button",{type:"button",onClick:r,className:"p-1 rounded hover:bg-ink/5 text-ink/60 hover:text-ink transition-colors","aria-label":"Close cost breakdown",children:e(b,{size:14})})]}),e("div",{className:"space-y-1.5",children:m.map((t)=>e("div",{className:"flex items-center justify-between text-[11px] font-mono border-b border-ink/5 last:border-0 pb-1.5 last:pb-0",children:[e("span",{className:"text-ink/60",children:t.label}),e("span",{className:`${t.strong?"font-semibold text-ink":"text-ink/80"}`,children:t.value})]},t.label))})]})}function V({messagesCount:l,userCount:r,assistantCount:c,costFormatted:h,cacheHitAverage:x,costBreakdown:m}){let[t,v]=n(!1);return e(d,{children:[e("div",{className:"mb-1.5",children:e("span",{className:"text-xs font-semibold text-ink/80",children:"Session Stats"})}),e("div",{className:"flex gap-2 flex-wrap",children:[e(it,{variant:"compact",label:"Messages",value:l}),e(it,{variant:"compact",label:"User",value:r}),e(it,{variant:"compact",label:"Assistant",value:c}),e(it,{variant:"compact",label:"Cache Hit",value:x!==void 0?`${x.toFixed(1)}%`:"–"}),e("div",{className:"relative bg-canvas border border-ink/10 rounded-lg px-2.5 py-1.5 flex flex-col gap-0.5 flex-1 min-w-0",children:[e("span",{className:"text-[10px] font-medium text-ink/50 flex items-center gap-1",children:["Cost",e("button",{type:"button",onClick:()=>v(!0),className:"p-0.5 rounded text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors","aria-label":"Show cost breakdown",title:"Cost breakdown",children:e(ce,{size:11})})]}),e("span",{className:"text-xs font-semibold font-mono text-ink truncate",children:h}),e(Z,{open:t,onClose:()=>v(!1),breakdown:m,costFormatted:h})]})]})]})}function z({input:l,output:r,reasoning:c,cacheRead:h,cacheWrite:x,cacheHitPercent:m}){return e(d,{children:[e("div",{className:"mb-1.5",children:e("span",{className:"text-xs font-semibold text-ink/80",children:"Last Assistant Message"})}),e("div",{className:"flex gap-2 flex-wrap",children:[e(it,{variant:"compact",label:"In",value:l.toLocaleString()}),e(it,{variant:"compact",label:"Out",value:r.toLocaleString()}),e(it,{variant:"compact",label:"Reason",value:c.toLocaleString()}),e(it,{variant:"compact",label:"Cache",value:`${h.toLocaleString()}/${x.toLocaleString()}`}),e(it,{variant:"compact",label:"Hit",value:`${m.toFixed(1)}%`})]})]})}function Q({userPercent:l,assistantPercent:r,toolPercent:c,otherPercent:h}){return e("div",{className:"space-y-2.5",children:[e("div",{className:"w-full h-1.5 rounded-full overflow-hidden flex bg-ink/10",children:[e("div",{className:"h-full bg-emerald-500 transition-all duration-300",style:{width:`${l}%`},title:`User: ${l}%`}),e("div",{className:"h-full bg-sky-500 transition-all duration-300",style:{width:`${r}%`},title:`Assistant: ${r}%`}),e("div",{className:"h-full bg-amber-500 transition-all duration-300",style:{width:`${c}%`},title:`Tool Calls: ${c}%`}),e("div",{className:"h-full bg-slate-400 transition-all duration-300",style:{width:`${h}%`},title:`Other: ${h}%`})]}),e("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-[11px] text-ink/70",children:[e("div",{className:"flex items-center space-x-1.5",children:[e("span",{className:"w-2 h-2 rounded-full bg-emerald-500 flex-shrink-0"}),e("span",{children:["User ",l,"%"]})]}),e("div",{className:"flex items-center space-x-1.5",children:[e("span",{className:"w-2 h-2 rounded-full bg-sky-500 flex-shrink-0"}),e("span",{children:["Assistant ",r,"%"]})]}),e("div",{className:"flex items-center space-x-1.5",children:[e("span",{className:"w-2 h-2 rounded-full bg-amber-500 flex-shrink-0"}),e("span",{children:["Tool Calls ",c,"%"]})]}),e("div",{className:"flex items-center space-x-1.5",children:[e("span",{className:"w-2 h-2 rounded-full bg-slate-400 flex-shrink-0"}),e("span",{children:["Other ",h,"%"]})]})]})]})}function G({data:l}){pi();let[r,c]=n(!1),h=i(null),x=i(null),m=JSON.stringify(l,null,2),t=yA(m),v=a((C)=>{let g=x.current;if(!g)return;g.scrollLeft=C.currentTarget.scrollLeft,g.scrollTop=C.currentTarget.scrollTop},[]),y=a(async(C)=>{C.stopPropagation();try{await navigator.clipboard.writeText(m)}catch{let g=document.createElement("textarea");g.value=m,g.style.position="fixed",g.style.opacity="0",document.body.appendChild(g),g.select(),document.execCommand("copy"),document.body.removeChild(g)}c(!0),setTimeout(()=>c(!1),2000)},[m]);return e("div",{className:"relative my-1.5 rounded-lg bg-paper/80 border border-ink/10 overflow-hidden",children:[e("div",{className:"flex items-center justify-between px-2.5 py-1.5 bg-ink/[0.04] border-b border-ink/10",children:[e("span",{className:"text-[10px] font-mono text-ink/50 select-none",children:[Object.keys(l).length," keys · ",m.length," chars"]}),e("button",{type:"button",onClick:y,className:"flex items-center space-x-1 px-2 py-1 rounded bg-canvas hover:bg-paper text-ink/70 hover:text-ink border border-ink/10 text-[10px] transition-colors shadow-xs",title:"Copy Pretty JSON",children:r?e(d,{children:[e(f,{size:11,className:"text-success"}),e("span",{className:"text-success font-sans font-medium",children:"Copied"})]}):e(d,{children:[e(re,{size:11}),e("span",{className:"font-sans",children:"Copy JSON"})]})})]}),e("div",{className:"relative",children:[e("pre",{ref:x,"aria-hidden":!0,className:"absolute inset-0 p-2.5 m-0 font-mono text-[11px] leading-5 overflow-x-auto overflow-y-auto whitespace-pre pointer-events-none",dangerouslySetInnerHTML:{__html:t}}),e("pre",{ref:h,onScroll:v,className:"relative p-2.5 m-0 font-mono text-[11px] leading-5 overflow-x-auto overflow-y-auto whitespace-pre select-text selection:bg-ink selection:text-canvas",children:e("code",{className:"text-transparent",children:m})})]})]})}var D=["bg-emerald-500","bg-sky-500","bg-amber-500","bg-violet-500","bg-rose-500","bg-teal-500","bg-indigo-500","bg-fuchsia-500","bg-lime-500","bg-cyan-500","bg-orange-500","bg-pink-500","bg-yellow-500","bg-purple-500","bg-red-500","bg-blue-500","bg-green-500","bg-cyan-600","bg-violet-600","bg-amber-600"],L=20;function K(l){let r=0;for(let c=0;c<l.length;c++)r=r*31+l.charCodeAt(c)|0;return Math.abs(r)}function q(l){let r=l.indexOf("/"),c=r>0?l.slice(0,r):l,h=r>0?l.slice(r+1):"";return h?`${c} · ${h}`:c}function Y(l,r){if(r<=7)return Array.from({length:r},(t,v)=>v+1);let c=new Set([1,r,l,l-1,l+1]);if(l<=3)[2,3,4].forEach((t)=>c.add(t));if(l>=r-2)[r-3,r-2,r-1].forEach((t)=>c.add(t));let h=[...c].filter((t)=>t>=1&&t<=r).sort((t,v)=>t-v),x=[],m=0;for(let t of h){if(t-m>1)x.push("…");x.push(t),m=t}return x}function X({sessionId:l,refreshKey:r=0}){let[c,h]=_("context.rawExpandedIds",{}),[x,m]=_("context.rawFilterRole","all"),[t,v]=n(1),[y,C]=n([]),[g,I]=n(0),[W,S]=n(!1),w=i(0),E=i(!1),j=a((p)=>{if(typeof window>"u")return;let k=++w.current;if(!p?.silent)S(!0);let P=new URLSearchParams({page:String(t),pageSize:String(L),role:x});if(l)P.set("sessionId",l);fetch(`/api/telemetry/raw-messages?${P.toString()}`).then((N)=>N.ok?N.json():null).then((N)=>{if(E.current||k!==w.current)return;C(N&&Array.isArray(N.items)?N.items:[]),I(N&&Number.isFinite(N.filteredTotal)?N.filteredTotal:0)}).catch(()=>{if(E.current||k!==w.current)return;C([]),I(0)}).finally(()=>{if(!p?.silent&&k===w.current)S(!1)})},[l,t,x]);o(()=>(E.current=!1,j(),()=>{E.current=!0}),[j,r]);let R=Math.max(1,Math.ceil(g/L)),M=Math.min(t,R),U=(p)=>v(Math.min(Math.max(1,p),R)),ee=(p)=>{h((k)=>({...k,[p]:!k[p]}))},te=()=>{if(y.every((k)=>c[k.id]))h({});else{let k={};y.forEach((P)=>{k[P.id]=!0}),h(k)}},H=u(()=>{let p=[];for(let k of y){let P=k.info.modelID;if(!P||p.includes(P))continue;p.push(P)}return p},[y]),A=(p)=>p?D[K(p)%D.length]:"bg-ink/20";return e("div",{className:"space-y-3",children:[H.length>0&&e("div",{children:[e("div",{className:"mb-1.5",children:e("span",{className:"text-xs font-semibold text-ink/80",children:"Legend"})}),e("div",{className:"bg-canvas border border-ink/10 rounded-xl px-3 py-2",children:e("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] font-mono text-ink/60",children:H.map((p)=>e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:`w-2 h-2 rounded-full ${A(p)}`}),e("span",{children:q(p)})]},p))})})]}),e("div",{className:"flex items-center justify-between",children:[e("div",{className:"flex items-center space-x-2",children:[e("span",{className:"text-xs font-semibold text-ink/80",children:"Raw Messages"}),e("span",{className:"text-[10px] font-mono text-ink/50 bg-ink/5 px-1.5 py-0.5 rounded-full border border-ink/10",children:g})]}),e("div",{className:"flex items-center space-x-1",children:[e("div",{className:"flex items-center bg-canvas border border-ink/10 rounded-lg p-0.5 text-[10px]",children:[e("button",{type:"button",onClick:()=>{m("all"),v(1)},className:`px-1.5 py-0.5 rounded ${x==="all"?"bg-ink text-canvas font-medium":"text-ink/60 hover:text-ink"}`,children:"All"}),e("button",{type:"button",onClick:()=>{m("assistant"),v(1)},className:`px-1.5 py-0.5 rounded ${x==="assistant"?"bg-ink text-canvas font-medium":"text-ink/60 hover:text-ink"}`,children:"AI"}),e("button",{type:"button",onClick:()=>{m("user"),v(1)},className:`px-1.5 py-0.5 rounded ${x==="user"?"bg-ink text-canvas font-medium":"text-ink/60 hover:text-ink"}`,children:"User"})]}),e("button",{type:"button",onClick:te,className:"p-1 rounded text-ink/60 hover:text-ink hover:bg-ink/5 transition-colors text-[10px] flex items-center",title:"Expand / Collapse All",children:e(F,{size:14})})]})]}),e("div",{className:"space-y-1.5",children:!W&&y.length===0?e("div",{className:"p-4 text-center text-xs text-ink/40 italic bg-canvas rounded-xl border border-ink/10",children:"No raw messages recorded yet."}):y.map((p)=>{let k=Boolean(c[p.id]);return e("div",{className:`bg-canvas border border-ink/10 rounded-xl overflow-hidden transition-all duration-200 ${W?"opacity-50":""}`,children:[e("button",{type:"button",onClick:()=>ee(p.id),className:"w-full text-left px-3.5 py-2.5 flex items-center justify-between hover:bg-ink/5 transition-colors cursor-pointer",children:[e("div",{className:"flex items-center space-x-2 min-w-0 flex-1 mr-2",children:[e("span",{className:"text-ink/40 flex-shrink-0",children:k?e(B,{size:14}):e(se,{size:14})}),e("span",{className:"text-xs font-mono text-ink/90 truncate",children:p.badgeLabel})]}),e("div",{className:"flex items-center space-x-3 text-[11px] font-mono text-ink/50 flex-shrink-0",children:[p.tokenSummary&&e("span",{className:"text-ink/60",children:p.tokenSummary}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:`w-2 h-2 rounded-full ${A(p.info.modelID)}`}),e("span",{children:p.timestamp})]})]})]}),k&&e("div",{className:"px-3.5 pb-3 pt-1 border-t border-ink/5 bg-canvas/60",children:e(G,{data:p.rawPayload})})]},p.id)})}),R>1&&e("div",{className:"flex items-center justify-between pt-1",children:[e("span",{className:"text-[10px] font-mono text-ink/50",children:[(M-1)*L+1,"–",Math.min(M*L,g)," of ",g]}),e("div",{className:"flex items-center gap-0.5",children:[e("button",{type:"button",disabled:M<=1,onClick:()=>U(M-1),className:"p-1 rounded text-ink/60 hover:text-ink hover:bg-ink/5 disabled:opacity-30 disabled:hover:bg-transparent transition-colors",title:"Previous page",children:e(va,{size:14})}),Y(M,R).map((p,k)=>p==="…"?e("span",{className:"px-1 text-[10px] font-mono text-ink/40 select-none",children:"…"},`gap-${k}`):e("button",{type:"button",onClick:()=>U(p),className:`min-w-[22px] h-[22px] px-1 rounded text-[10px] font-mono transition-colors ${p===M?"bg-ink text-canvas font-medium":"text-ink/60 hover:text-ink hover:bg-ink/5"}`,children:p},p)),e("button",{type:"button",disabled:M>=R,onClick:()=>U(M+1),className:"p-1 rounded text-ink/60 hover:text-ink hover:bg-ink/5 disabled:opacity-30 disabled:hover:bg-transparent transition-colors",title:"Next page",children:e(se,{size:14})})]})]})]})}function mt({className:l="",enabled:r=!0,refreshKey:c=0,tabsMode:h=!1}){let[x]=le(),m=x.get("sessionId"),[t,v]=n(()=>O(m||"default","Session not started")),y=i(!1),C=a(()=>{if(typeof window>"u")return;let S=m?`?sessionId=${encodeURIComponent(m)}`:"";fetch(`/api/telemetry/context${S}`).then((w)=>w.ok?w.json():null).then((w)=>{if(!y.current&&w&&w.telemetry)v(w.telemetry)}).catch((w)=>{if(!y.current)console.warn("Failed to fetch context telemetry:",w)})},[m]);o(()=>{if(y.current=!1,!r)return;return C(),()=>{y.current=!0}},[r,c,C]);let g=Be(m?Mp(m):null,{enabled:r}),[I,W]=n(0);if(o(()=>{if(g.data)v(g.data),W((S)=>S+1)},[g.data]),!r)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${l}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});if(t.messagesCount===0)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${l}`,children:e("span",{className:"text-xs font-mono",children:"Session not started"})});return e("div",{className:`flex flex-col h-full bg-paper text-ink overflow-hidden select-none ${l}`,children:[e(At,{left:e(d,{children:[e(Ha,{id:"context",tabsMode:h,children:e("h2",{className:"text-xs font-medium text-ink tracking-tight truncate",children:t.sessionTitle})}),e("span",{className:"text-[11px] text-ink/50 truncate font-mono",children:t.timestamp})]}),right:e(ot,{label:"Refresh context telemetry",onClick:()=>{g.refresh(),C()},busy:g.refreshing,disabled:!r})}),e("div",{className:"flex-1 scrollbar-overlay-container p-4 space-y-4",children:[e(J,{used:t.contextUsed,limit:t.contextLimit,percent:t.contextPercent}),e(V,{messagesCount:t.messagesCount,userCount:t.userCount,assistantCount:t.assistantCount,costFormatted:t.costFormatted,cacheHitAverage:t.cacheHitAverage,costBreakdown:t.costBreakdown}),e(z,{input:t.lastMessage.input,output:t.lastMessage.output,reasoning:t.lastMessage.reasoning,cacheRead:t.lastMessage.cacheRead,cacheWrite:t.lastMessage.cacheWrite,cacheHitPercent:t.lastMessage.cacheHitPercent}),e(Q,{userPercent:t.distribution.userPercent,assistantPercent:t.distribution.assistantPercent,toolPercent:t.distribution.toolPercent,otherPercent:t.distribution.otherPercent}),e(X,{sessionId:m,refreshKey:c+I})]})]})}export{mt as ContextPanel};
|
|
1
|
+
import{d,n,o,i,u,a,le,e,s,f,B,se,vo,re,ce,b,Gp,Ie,S,bt,Wa,st,ue,lt,IA,mi}from"./index-amys498v.js";var ae={name:"chevrons-up-down",size:24,node:[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]},F=s(ae);function O(l,r,c=1e6){return{sessionId:l,sessionTitle:r,modelId:"",modelName:"",timestamp:"",contextUsed:0,contextLimit:c,contextPercent:0,messagesCount:0,userCount:0,assistantCount:0,totalCost:0,costFormatted:"$0.00",cacheHitAverage:0,costBreakdown:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0},lastMessage:{input:0,output:0,reasoning:0,cacheRead:0,cacheWrite:0,cacheHitPercent:0},distribution:{userTokens:0,userPercent:0,assistantTokens:0,assistantPercent:0,toolTokens:0,toolPercent:0,otherTokens:0,otherPercent:100},rawMessages:[]}}function J({used:l,limit:r,percent:c}){let h=l.toLocaleString(),x=r.toLocaleString(),m=Math.min(100,Math.max(0,c));return e("div",{className:"bg-canvas border border-ink/10 rounded-xl p-4 transition-all",children:[e("div",{className:"flex items-center justify-between text-xs mb-2",children:[e("span",{className:"font-semibold text-ink/80",children:"Context"}),e("span",{className:"font-mono text-ink/70 text-[11px]",children:[h," / ",x]})]}),e("div",{className:"w-full h-1.5 bg-ink/10 rounded-full overflow-hidden mb-2",children:e("div",{className:"h-full bg-ink/70 rounded-full transition-all duration-500 ease-out",style:{width:`${m}%`}})}),e("div",{className:"text-[11px] font-mono text-ink/50 text-left",children:[m.toFixed(1),"% used"]})]})}function L(l){return l<0.01?"$0.01":`$${l.toFixed(6).replace(/0+$/,"").replace(/\.$/,"")}`}function Z({open:l,onClose:r,breakdown:c,costFormatted:h}){let x=i(null);if(ue(x,r),!l)return null;let m=c?[{label:"Total Cost",value:L(c.total),strong:!0},{label:"Input (cache miss)",value:L(c.input)},{label:"Output",value:L(c.output)},{label:"Cache Read (cache hit)",value:L(c.cacheRead)},{label:"Cache Write",value:L(c.cacheWrite)}]:[{label:"Total Cost",value:h??"$0.01",strong:!0}];return e("div",{ref:x,className:"glass-popover absolute top-full right-0 mt-1.5 z-50 w-64 bg-paper border border-ink/10 rounded-lg shadow-lg p-3",role:"dialog","aria-modal":"false",children:[e("div",{className:"flex items-center justify-between mb-2.5",children:[e("span",{className:"text-xs font-semibold text-ink tracking-tight",children:"Cost Breakdown"}),e("button",{type:"button",onClick:r,className:"p-1 rounded hover:bg-ink/5 text-ink/60 hover:text-ink transition-colors","aria-label":"Close cost breakdown",children:e(b,{size:14})})]}),e("div",{className:"space-y-1.5",children:m.map((t)=>e("div",{className:"flex items-center justify-between text-[11px] font-mono border-b border-ink/5 last:border-0 pb-1.5 last:pb-0",children:[e("span",{className:"text-ink/60",children:t.label}),e("span",{className:`${t.strong?"font-semibold text-ink":"text-ink/80"}`,children:t.value})]},t.label))})]})}function V({messagesCount:l,userCount:r,assistantCount:c,costFormatted:h,cacheHitAverage:x,costBreakdown:m}){let[t,v]=n(!1);return e(d,{children:[e("div",{className:"mb-1.5",children:e("span",{className:"text-xs font-semibold text-ink/80",children:"Session Stats"})}),e("div",{className:"flex gap-2 flex-wrap",children:[e(lt,{variant:"compact",label:"Messages",value:l}),e(lt,{variant:"compact",label:"User",value:r}),e(lt,{variant:"compact",label:"Assistant",value:c}),e(lt,{variant:"compact",label:"Cache Hit",value:x!==void 0?`${x.toFixed(1)}%`:"–"}),e("div",{className:"relative bg-canvas border border-ink/10 rounded-lg px-2.5 py-1.5 flex flex-col gap-0.5 flex-1 min-w-0",children:[e("span",{className:"text-[10px] font-medium text-ink/50 flex items-center gap-1",children:["Cost",e("button",{type:"button",onClick:()=>v(!0),className:"p-0.5 rounded text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors","aria-label":"Show cost breakdown",title:"Cost breakdown",children:e(ce,{size:11})})]}),e("span",{className:"text-xs font-semibold font-mono text-ink truncate",children:h}),e(Z,{open:t,onClose:()=>v(!1),breakdown:m,costFormatted:h})]})]})]})}function z({input:l,output:r,reasoning:c,cacheRead:h,cacheWrite:x,cacheHitPercent:m}){return e(d,{children:[e("div",{className:"mb-1.5",children:e("span",{className:"text-xs font-semibold text-ink/80",children:"Last Assistant Message"})}),e("div",{className:"flex gap-2 flex-wrap",children:[e(lt,{variant:"compact",label:"In",value:l.toLocaleString()}),e(lt,{variant:"compact",label:"Out",value:r.toLocaleString()}),e(lt,{variant:"compact",label:"Reason",value:c.toLocaleString()}),e(lt,{variant:"compact",label:"Cache",value:`${h.toLocaleString()}/${x.toLocaleString()}`}),e(lt,{variant:"compact",label:"Hit",value:`${m.toFixed(1)}%`})]})]})}function Q({userPercent:l,assistantPercent:r,toolPercent:c,otherPercent:h}){return e("div",{className:"space-y-2.5",children:[e("div",{className:"w-full h-1.5 rounded-full overflow-hidden flex bg-ink/10",children:[e("div",{className:"h-full bg-emerald-500 transition-all duration-300",style:{width:`${l}%`},title:`User: ${l}%`}),e("div",{className:"h-full bg-sky-500 transition-all duration-300",style:{width:`${r}%`},title:`Assistant: ${r}%`}),e("div",{className:"h-full bg-amber-500 transition-all duration-300",style:{width:`${c}%`},title:`Tool Calls: ${c}%`}),e("div",{className:"h-full bg-slate-400 transition-all duration-300",style:{width:`${h}%`},title:`Other: ${h}%`})]}),e("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-[11px] text-ink/70",children:[e("div",{className:"flex items-center space-x-1.5",children:[e("span",{className:"w-2 h-2 rounded-full bg-emerald-500 flex-shrink-0"}),e("span",{children:["User ",l,"%"]})]}),e("div",{className:"flex items-center space-x-1.5",children:[e("span",{className:"w-2 h-2 rounded-full bg-sky-500 flex-shrink-0"}),e("span",{children:["Assistant ",r,"%"]})]}),e("div",{className:"flex items-center space-x-1.5",children:[e("span",{className:"w-2 h-2 rounded-full bg-amber-500 flex-shrink-0"}),e("span",{children:["Tool Calls ",c,"%"]})]}),e("div",{className:"flex items-center space-x-1.5",children:[e("span",{className:"w-2 h-2 rounded-full bg-slate-400 flex-shrink-0"}),e("span",{children:["Other ",h,"%"]})]})]})]})}function G({data:l}){mi();let[r,c]=n(!1),h=i(null),x=i(null),m=JSON.stringify(l,null,2),t=IA(m),v=a((C)=>{let g=x.current;if(!g)return;g.scrollLeft=C.currentTarget.scrollLeft,g.scrollTop=C.currentTarget.scrollTop},[]),y=a(async(C)=>{C.stopPropagation();try{await navigator.clipboard.writeText(m)}catch{let g=document.createElement("textarea");g.value=m,g.style.position="fixed",g.style.opacity="0",document.body.appendChild(g),g.select(),document.execCommand("copy"),document.body.removeChild(g)}c(!0),setTimeout(()=>c(!1),2000)},[m]);return e("div",{className:"relative my-1.5 rounded-lg bg-paper/80 border border-ink/10 overflow-hidden",children:[e("div",{className:"flex items-center justify-between px-2.5 py-1.5 bg-ink/[0.04] border-b border-ink/10",children:[e("span",{className:"text-[10px] font-mono text-ink/50 select-none",children:[Object.keys(l).length," keys · ",m.length," chars"]}),e("button",{type:"button",onClick:y,className:"flex items-center space-x-1 px-2 py-1 rounded bg-canvas hover:bg-paper text-ink/70 hover:text-ink border border-ink/10 text-[10px] transition-colors shadow-xs",title:"Copy Pretty JSON",children:r?e(d,{children:[e(f,{size:11,className:"text-success"}),e("span",{className:"text-success font-sans font-medium",children:"Copied"})]}):e(d,{children:[e(re,{size:11}),e("span",{className:"font-sans",children:"Copy JSON"})]})})]}),e("div",{className:"relative",children:[e("pre",{ref:x,"aria-hidden":!0,className:"absolute inset-0 p-2.5 m-0 font-mono text-[11px] leading-5 overflow-x-auto overflow-y-auto whitespace-pre pointer-events-none",dangerouslySetInnerHTML:{__html:t}}),e("pre",{ref:h,onScroll:v,className:"relative p-2.5 m-0 font-mono text-[11px] leading-5 overflow-x-auto overflow-y-auto whitespace-pre select-text selection:bg-ink selection:text-canvas",children:e("code",{className:"text-transparent",children:m})})]})]})}var D=["bg-emerald-500","bg-sky-500","bg-amber-500","bg-violet-500","bg-rose-500","bg-teal-500","bg-indigo-500","bg-fuchsia-500","bg-lime-500","bg-cyan-500","bg-orange-500","bg-pink-500","bg-yellow-500","bg-purple-500","bg-red-500","bg-blue-500","bg-green-500","bg-cyan-600","bg-violet-600","bg-amber-600"],_=20;function K(l){let r=0;for(let c=0;c<l.length;c++)r=r*31+l.charCodeAt(c)|0;return Math.abs(r)}function q(l){let r=l.indexOf("/"),c=r>0?l.slice(0,r):l,h=r>0?l.slice(r+1):"";return h?`${c} · ${h}`:c}function Y(l,r){if(r<=7)return Array.from({length:r},(t,v)=>v+1);let c=new Set([1,r,l,l-1,l+1]);if(l<=3)[2,3,4].forEach((t)=>c.add(t));if(l>=r-2)[r-3,r-2,r-1].forEach((t)=>c.add(t));let h=[...c].filter((t)=>t>=1&&t<=r).sort((t,v)=>t-v),x=[],m=0;for(let t of h){if(t-m>1)x.push("…");x.push(t),m=t}return x}function X({sessionId:l,refreshKey:r=0}){let[c,h]=S("context.rawExpandedIds",{}),[x,m]=S("context.rawFilterRole","all"),[t,v]=n(1),[y,C]=n([]),[g,I]=n(0),[W,R]=n(!1),w=i(0),E=i(!1),j=a((p)=>{if(typeof window>"u")return;let k=++w.current;if(!p?.silent)R(!0);let P=new URLSearchParams({page:String(t),pageSize:String(_),role:x});if(l)P.set("sessionId",l);fetch(`/api/telemetry/raw-messages?${P.toString()}`).then((N)=>N.ok?N.json():null).then((N)=>{if(E.current||k!==w.current)return;C(N&&Array.isArray(N.items)?N.items:[]),I(N&&Number.isFinite(N.filteredTotal)?N.filteredTotal:0)}).catch(()=>{if(E.current||k!==w.current)return;C([]),I(0)}).finally(()=>{if(!p?.silent&&k===w.current)R(!1)})},[l,t,x]);o(()=>(E.current=!1,j(),()=>{E.current=!0}),[j,r]);let T=Math.max(1,Math.ceil(g/_)),M=Math.min(t,T),U=(p)=>v(Math.min(Math.max(1,p),T)),ee=(p)=>{h((k)=>({...k,[p]:!k[p]}))},te=()=>{if(y.every((k)=>c[k.id]))h({});else{let k={};y.forEach((P)=>{k[P.id]=!0}),h(k)}},H=u(()=>{let p=[];for(let k of y){let P=k.info.modelID;if(!P||p.includes(P))continue;p.push(P)}return p},[y]),A=(p)=>p?D[K(p)%D.length]:"bg-ink/20";return e("div",{className:"space-y-3",children:[H.length>0&&e("div",{children:[e("div",{className:"mb-1.5",children:e("span",{className:"text-xs font-semibold text-ink/80",children:"Legend"})}),e("div",{className:"bg-canvas border border-ink/10 rounded-xl px-3 py-2",children:e("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] font-mono text-ink/60",children:H.map((p)=>e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:`w-2 h-2 rounded-full ${A(p)}`}),e("span",{children:q(p)})]},p))})})]}),e("div",{className:"flex items-center justify-between",children:[e("div",{className:"flex items-center space-x-2",children:[e("span",{className:"text-xs font-semibold text-ink/80",children:"Raw Messages"}),e("span",{className:"text-[10px] font-mono text-ink/50 bg-ink/5 px-1.5 py-0.5 rounded-full border border-ink/10",children:g})]}),e("div",{className:"flex items-center space-x-1",children:[e("div",{className:"flex items-center bg-canvas border border-ink/10 rounded-lg p-0.5 text-[10px]",children:[e("button",{type:"button",onClick:()=>{m("all"),v(1)},className:`px-1.5 py-0.5 rounded ${x==="all"?"bg-ink text-canvas font-medium":"text-ink/60 hover:text-ink"}`,children:"All"}),e("button",{type:"button",onClick:()=>{m("assistant"),v(1)},className:`px-1.5 py-0.5 rounded ${x==="assistant"?"bg-ink text-canvas font-medium":"text-ink/60 hover:text-ink"}`,children:"AI"}),e("button",{type:"button",onClick:()=>{m("user"),v(1)},className:`px-1.5 py-0.5 rounded ${x==="user"?"bg-ink text-canvas font-medium":"text-ink/60 hover:text-ink"}`,children:"User"})]}),e("button",{type:"button",onClick:te,className:"p-1 rounded text-ink/60 hover:text-ink hover:bg-ink/5 transition-colors text-[10px] flex items-center",title:"Expand / Collapse All",children:e(F,{size:14})})]})]}),e("div",{className:"space-y-1.5",children:!W&&y.length===0?e("div",{className:"p-4 text-center text-xs text-ink/40 italic bg-canvas rounded-xl border border-ink/10",children:"No raw messages recorded yet."}):y.map((p)=>{let k=Boolean(c[p.id]);return e("div",{className:`bg-canvas border border-ink/10 rounded-xl overflow-hidden transition-all duration-200 ${W?"opacity-50":""}`,children:[e("button",{type:"button",onClick:()=>ee(p.id),className:"w-full text-left px-3.5 py-2.5 flex items-center justify-between hover:bg-ink/5 transition-colors cursor-pointer",children:[e("div",{className:"flex items-center space-x-2 min-w-0 flex-1 mr-2",children:[e("span",{className:"text-ink/40 flex-shrink-0",children:k?e(B,{size:14}):e(se,{size:14})}),e("span",{className:"text-xs font-mono text-ink/90 truncate",children:p.badgeLabel})]}),e("div",{className:"flex items-center space-x-3 text-[11px] font-mono text-ink/50 flex-shrink-0",children:[p.tokenSummary&&e("span",{className:"text-ink/60",children:p.tokenSummary}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:`w-2 h-2 rounded-full ${A(p.info.modelID)}`}),e("span",{children:p.timestamp})]})]})]}),k&&e("div",{className:"px-3.5 pb-3 pt-1 border-t border-ink/5 bg-canvas/60",children:e(G,{data:p.rawPayload})})]},p.id)})}),T>1&&e("div",{className:"flex items-center justify-between pt-1",children:[e("span",{className:"text-[10px] font-mono text-ink/50",children:[(M-1)*_+1,"–",Math.min(M*_,g)," of ",g]}),e("div",{className:"flex items-center gap-0.5",children:[e("button",{type:"button",disabled:M<=1,onClick:()=>U(M-1),className:"p-1 rounded text-ink/60 hover:text-ink hover:bg-ink/5 disabled:opacity-30 disabled:hover:bg-transparent transition-colors",title:"Previous page",children:e(vo,{size:14})}),Y(M,T).map((p,k)=>p==="…"?e("span",{className:"px-1 text-[10px] font-mono text-ink/40 select-none",children:"…"},`gap-${k}`):e("button",{type:"button",onClick:()=>U(p),className:`min-w-[22px] h-[22px] px-1 rounded text-[10px] font-mono transition-colors ${p===M?"bg-ink text-canvas font-medium":"text-ink/60 hover:text-ink hover:bg-ink/5"}`,children:p},p)),e("button",{type:"button",disabled:M>=T,onClick:()=>U(M+1),className:"p-1 rounded text-ink/60 hover:text-ink hover:bg-ink/5 disabled:opacity-30 disabled:hover:bg-transparent transition-colors",title:"Next page",children:e(se,{size:14})})]})]})]})}function mt({className:l="",enabled:r=!0,refreshKey:c=0,tabsMode:h=!1}){let[x]=le(),m=x.get("sessionId"),[t,v]=n(()=>O(m||"default","Session not started")),y=i(!1),C=a(()=>{if(typeof window>"u")return;let R=m?`?sessionId=${encodeURIComponent(m)}`:"";fetch(`/api/telemetry/context${R}`).then((w)=>w.ok?w.json():null).then((w)=>{if(!y.current&&w&&w.telemetry)v(w.telemetry)}).catch((w)=>{if(!y.current)console.warn("Failed to fetch context telemetry:",w)})},[m]);o(()=>{if(y.current=!1,!r)return;return C(),()=>{y.current=!0}},[r,c,C]);let g=Ie(m?Gp(m):null,{enabled:r}),[I,W]=n(0);if(o(()=>{if(g.data)v(g.data),W((R)=>R+1)},[g.data]),!r)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${l}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});if(t.messagesCount===0)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${l}`,children:e("span",{className:"text-xs font-mono",children:"Session not started"})});return e("div",{className:`flex flex-col h-full bg-paper text-ink overflow-hidden select-none ${l}`,children:[e(bt,{left:e(d,{children:[e(Wa,{id:"context",tabsMode:h,children:e("h2",{className:"text-xs font-medium text-ink tracking-tight truncate",children:t.sessionTitle})}),e("span",{className:"text-[11px] text-ink/50 truncate font-mono",children:t.timestamp})]}),right:e(st,{label:"Refresh context telemetry",onClick:()=>{g.refresh(),C()},busy:g.refreshing,disabled:!r})}),e("div",{className:"flex-1 scrollbar-overlay-container p-4 space-y-4",children:[e(J,{used:t.contextUsed,limit:t.contextLimit,percent:t.contextPercent}),e(V,{messagesCount:t.messagesCount,userCount:t.userCount,assistantCount:t.assistantCount,costFormatted:t.costFormatted,cacheHitAverage:t.cacheHitAverage,costBreakdown:t.costBreakdown}),e(z,{input:t.lastMessage.input,output:t.lastMessage.output,reasoning:t.lastMessage.reasoning,cacheRead:t.lastMessage.cacheRead,cacheWrite:t.lastMessage.cacheWrite,cacheHitPercent:t.lastMessage.cacheHitPercent}),e(Q,{userPercent:t.distribution.userPercent,assistantPercent:t.distribution.assistantPercent,toolPercent:t.distribution.toolPercent,otherPercent:t.distribution.otherPercent}),e(X,{sessionId:m,refreshKey:c+I})]})]})}export{mt as ContextPanel};
|