@hienlh/ppm 0.9.0-beta.9 → 0.9.2
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/.claude.bak/agent-memory/tester/MEMORY.md +3 -0
- package/.claude.bak/agent-memory/tester/project-ppm-test-conventions.md +32 -0
- package/CHANGELOG.md +240 -0
- package/bun.lock +17 -0
- package/dist/web/assets/{_basePickBy-3Xe18azI.js → _basePickBy-5PGDJbfF.js} +1 -1
- package/dist/web/assets/{_baseUniq-Yy35llnn.js → _baseUniq-BT4Ow4Kk.js} +1 -1
- package/dist/web/assets/api-settings-BUvk6Saw.js +1 -0
- package/dist/web/assets/{arc-B9n1Gvb5.js → arc-BAOivWpI.js} +1 -1
- package/dist/web/assets/architecture-PBZL5I3N-DEO2f3VD.js +1 -0
- package/dist/web/assets/{architectureDiagram-2XIMDMQ5-DqAZP_F6.js → architectureDiagram-2XIMDMQ5-Z-4eN4za.js} +1 -1
- package/dist/web/assets/arrow-up-BYhx9ckd.js +1 -0
- package/dist/web/assets/{blockDiagram-WCTKOSBZ-h3cDF2vI.js → blockDiagram-WCTKOSBZ-BCLqzhuZ.js} +1 -1
- package/dist/web/assets/browser-tab-CjUzlPYv.js +1 -0
- package/dist/web/assets/{c4Diagram-IC4MRINW--pF1r5lr.js → c4Diagram-IC4MRINW-0Vp0Jeas.js} +1 -1
- package/dist/web/assets/channel-By7bn0Yq.js +1 -0
- package/dist/web/assets/chat-tab-moB4W7-w.js +8 -0
- package/dist/web/assets/chevron-right-5HgK6l7K.js +1 -0
- package/dist/web/assets/{chunk-4BX2VUAB-C3aZvW7B.js → chunk-4BX2VUAB-D4tOov49.js} +1 -1
- package/dist/web/assets/{chunk-55IACEB6-D5cABeB9.js → chunk-55IACEB6-DJ6BynZ4.js} +1 -1
- package/dist/web/assets/{chunk-7E7YKBS2-CkFGv6Zs.js → chunk-7E7YKBS2-CiyUJxNI.js} +1 -1
- package/dist/web/assets/{chunk-7R4GIKGN-Dvbyu4Zw.js → chunk-7R4GIKGN-Dv-4cAYn.js} +2 -2
- package/dist/web/assets/{chunk-C72U2L5F-CtqKiH4q.js → chunk-C72U2L5F-D21mS_6G.js} +1 -1
- package/dist/web/assets/{chunk-EGIJ26TM-Cpr87sBR.js → chunk-EGIJ26TM-DzqmU2Z7.js} +1 -1
- package/dist/web/assets/{chunk-FMBD7UC4-D23YVTOU.js → chunk-FMBD7UC4-DXncblvW.js} +1 -1
- package/dist/web/assets/{chunk-GEFDOKGD-tDjHsAUs.js → chunk-GEFDOKGD-D-pKjlVd.js} +1 -1
- package/dist/web/assets/chunk-GLR3WWYH-DKikpoJM.js +2 -0
- package/dist/web/assets/chunk-HHEYEP7N-C7vxA5i9.js +1 -0
- package/dist/web/assets/{chunk-JSJVCQXG-BBmymCjA.js → chunk-JSJVCQXG-99JzIdPr.js} +1 -1
- package/dist/web/assets/{chunk-KX2RTZJC-DP36BDiU.js → chunk-KX2RTZJC-CRq1OBZv.js} +1 -1
- package/dist/web/assets/{chunk-KYZI473N-Djw13C-3.js → chunk-KYZI473N-Bb0MCaIO.js} +1 -1
- package/dist/web/assets/{chunk-L3YUKLVL-HG_eMj_C.js → chunk-L3YUKLVL-C7qGJrfV.js} +1 -1
- package/dist/web/assets/{chunk-MX3YWQON-C2UEioMs.js → chunk-MX3YWQON-BpS_PtKp.js} +1 -1
- package/dist/web/assets/{chunk-NQ4KR5QH-DXUTQ-BL.js → chunk-NQ4KR5QH-z_blpjxi.js} +1 -1
- package/dist/web/assets/{chunk-O4XLMI2P-BsUWb9d0.js → chunk-O4XLMI2P-nDhi_cVu.js} +1 -1
- package/dist/web/assets/{chunk-OZEHJAEY-rG0P22U9.js → chunk-OZEHJAEY-BXhYx3nO.js} +1 -1
- package/dist/web/assets/{chunk-PQ6SQG4A-DX0xW7kO.js → chunk-PQ6SQG4A-TF58UVMU.js} +1 -1
- package/dist/web/assets/{chunk-PU5JKC2W-C7Gry6md.js → chunk-PU5JKC2W-ek7k4QVB.js} +1 -1
- package/dist/web/assets/chunk-QZHKN3VN-CYaTbeZf.js +1 -0
- package/dist/web/assets/{chunk-R5LLSJPH-CMY0PkRK.js → chunk-R5LLSJPH-CFwSJijQ.js} +1 -1
- package/dist/web/assets/{chunk-WL4C6EOR-CXuQvlyu.js → chunk-WL4C6EOR-ByUrSRin.js} +1 -1
- package/dist/web/assets/{chunk-XIRO2GV7-DRJEb7Zb.js → chunk-XIRO2GV7-Djlmrely.js} +1 -1
- package/dist/web/assets/{chunk-XPW4576I-BPEX8KhL.js → chunk-XPW4576I-BPQQBakK.js} +1 -1
- package/dist/web/assets/{chunk-XZSTWKYB-Cb0iqycX.js → chunk-XZSTWKYB-DxAOx4hG.js} +1 -1
- package/dist/web/assets/{chunk-YBOYWFTD-av5aeHLq.js → chunk-YBOYWFTD-rQG3QH5s.js} +1 -1
- package/dist/web/assets/classDiagram-VBA2DB6C-BA8Nj-_C.js +1 -0
- package/dist/web/assets/classDiagram-v2-RAHNMMFH-DjYu-6mn.js +1 -0
- package/dist/web/assets/clone-LRxlvnMj.js +1 -0
- package/dist/web/assets/code-editor-aQQZUc2m.js +2 -0
- package/dist/web/assets/columns-2-cEVJHYd7.js +1 -0
- package/dist/web/assets/{cose-bilkent-S5V4N54A-qudEiMCT.js → cose-bilkent-S5V4N54A-B_AWZsOP.js} +1 -1
- package/dist/web/assets/createLucideIcon-PuMiQgHl.js +1 -0
- package/dist/web/assets/{csv-preview-DUbHtTAS.js → csv-preview-ncSOnJSC.js} +2 -2
- package/dist/web/assets/{dagre-BFcnKyBF.js → dagre-DHq9bhnd.js} +1 -1
- package/dist/web/assets/{dagre-KLK3FWXG-C3O-MTLf.js → dagre-KLK3FWXG-BdJr7Byp.js} +1 -1
- package/dist/web/assets/database-viewer-ChyP1N3c.js +1 -0
- package/dist/web/assets/{diagram-E7M64L7V-DxPjK7_c.js → diagram-E7M64L7V-_db4pBVA.js} +1 -1
- package/dist/web/assets/{diagram-IFDJBPK2-sqTog_XV.js → diagram-IFDJBPK2-xKoeuiJx.js} +1 -1
- package/dist/web/assets/{diagram-P4PSJMXO-hzmp0GHK.js → diagram-P4PSJMXO-C8tjJsev.js} +1 -1
- package/dist/web/assets/diff-viewer-ktwO5JbX.js +4 -0
- package/dist/web/assets/{dist-CALwEtco.js → dist-DIV6WgAG.js} +1 -1
- package/dist/web/assets/{dist-DGDPTxs1.js → dist-ovWkrgO-.js} +1 -1
- package/dist/web/assets/{erDiagram-INFDFZHY-DLeYhAAT.js → erDiagram-INFDFZHY-BSh2z9Df.js} +1 -1
- package/dist/web/assets/extension-webview-Bx1TlP6q.js +3 -0
- package/dist/web/assets/{flowDiagram-PKNHOUZH-CRxlE9Sr.js → flowDiagram-PKNHOUZH-oYaovqyp.js} +1 -1
- package/dist/web/assets/{ganttDiagram-A5KZAMGK-BdjmoMLS.js → ganttDiagram-A5KZAMGK-DmL26q2P.js} +1 -1
- package/dist/web/assets/git-graph-BIrGMX6e.js +1 -0
- package/dist/web/assets/gitGraph-HDMCJU4V-Bwna3and.js +1 -0
- package/dist/web/assets/{gitGraphDiagram-K3NZZRJ6-BeHSX7kk.js → gitGraphDiagram-K3NZZRJ6-CMoukSrY.js} +1 -1
- package/dist/web/assets/{graphlib-Duh_bWLa.js → graphlib-BcsNnGcW.js} +1 -1
- package/dist/web/assets/index-C6KLr58u.js +37 -0
- package/dist/web/assets/index-DpBKDbIW.css +2 -0
- package/dist/web/assets/info-3K5VOQVL-_vRxVNUm.js +1 -0
- package/dist/web/assets/infoDiagram-LFFYTUFH-DWwumDkq.js +2 -0
- package/dist/web/assets/{isEmpty-B9L-Ge-H.js → isEmpty-bnrF3Qbc.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-PHBUUO56-Cu0Rt1Ok.js → ishikawaDiagram-PHBUUO56-D05_LyL7.js} +1 -1
- package/dist/web/assets/{journeyDiagram-4ABVD52K-CgDI-UG4.js → journeyDiagram-4ABVD52K-B_L20qMe.js} +1 -1
- package/dist/web/assets/jsx-runtime-kMwlnEGE.js +1 -0
- package/dist/web/assets/{kanban-definition-K7BYSVSG-h4g10UHL.js → kanban-definition-K7BYSVSG-CZ535BbZ.js} +1 -1
- package/dist/web/assets/keybindings-store-D3Y5c5uS.js +1 -0
- package/dist/web/assets/{line-B75-Rx70.js → line-CVvo3dRu.js} +1 -1
- package/dist/web/assets/{linear-Bcjv9FQt.js → linear-DP4mkX3m.js} +1 -1
- package/dist/web/assets/{markdown-renderer-VIZB1GXE.js → markdown-renderer-A7J2gdKT.js} +5 -5
- package/dist/web/assets/{mermaid-parser.core-8u2leTXI.js → mermaid-parser.core-C7UwoIh6.js} +2 -2
- package/dist/web/assets/{mindmap-definition-YRQLILUH-BaOBwb-W.js → mindmap-definition-YRQLILUH-x0MTutJp.js} +1 -1
- package/dist/web/assets/{ordinal-LFEjVtwQ.js → ordinal-_K3x1fkz.js} +1 -1
- package/dist/web/assets/packet-RMMSAZCW-DY5PNnZU.js +1 -0
- package/dist/web/assets/pie-UPGHQEXC-BHncZutv.js +1 -0
- package/dist/web/assets/{pieDiagram-SKSYHLDU-At5Kz0KK.js → pieDiagram-SKSYHLDU-C1Gjrtzy.js} +1 -1
- package/dist/web/assets/postgres-viewer-C9-Acry_.js +1 -0
- package/dist/web/assets/{quadrantDiagram-337W2JSQ-CdjGIDfw.js → quadrantDiagram-337W2JSQ-C8bzJCjQ.js} +1 -1
- package/dist/web/assets/radar-KQ55EAFF-DH0AOkUy.js +1 -0
- package/dist/web/assets/{requirementDiagram-Z7DCOOCP-B9F_Cx_p.js → requirementDiagram-Z7DCOOCP-pQyah6WB.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-WA2Y5GQK-RolPi8bU.js → sankeyDiagram-WA2Y5GQK-T6RgG-N8.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-2WXFIKYE-DM-tMAhx.js → sequenceDiagram-2WXFIKYE-BQDJ4CVs.js} +1 -1
- package/dist/web/assets/settings-tab-C17exmRv.js +1 -0
- package/dist/web/assets/sqlite-viewer-Dr5oWCWA.js +1 -0
- package/dist/web/assets/{stateDiagram-RAJIS63D-C4EMl6jf.js → stateDiagram-RAJIS63D-66vhiIuk.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-FVOUBMTO-BGVqj_g9.js +1 -0
- package/dist/web/assets/tab-store-BOgTrqRr.js +1 -0
- package/dist/web/assets/table-DFevCOMd.js +1 -0
- package/dist/web/assets/tag-CXMT0QB6.js +1 -0
- package/dist/web/assets/{terminal-tab-XhKfb4ei.js → terminal-tab-CpyKvyfC.js} +1 -1
- package/dist/web/assets/{timeline-definition-YZTLITO2-A4PN_Efm.js → timeline-definition-YZTLITO2-DwZqB3nn.js} +1 -1
- package/dist/web/assets/treemap-KZPCXAKY-B2Xkyv-K.js +1 -0
- package/dist/web/assets/{use-monaco-theme-0p0-84jJ.js → use-monaco-theme-BjPAik5w.js} +1 -1
- package/dist/web/assets/{vennDiagram-LZ73GAT5-ywK7LMaH.js → vennDiagram-LZ73GAT5-s9Z71fz-.js} +1 -1
- package/dist/web/assets/{xychartDiagram-JWTSCODW-DylHYNtJ.js → xychartDiagram-JWTSCODW-DRa_TH4B.js} +1 -1
- package/dist/web/index.html +10 -9
- package/dist/web/sw.js +1 -1
- package/docs/code-standards.md +128 -1
- package/docs/codebase-summary.md +79 -12
- package/docs/extension-development-guide.md +532 -0
- package/docs/project-changelog.md +51 -1
- package/docs/project-roadmap.md +9 -3
- package/docs/system-architecture.md +432 -3
- package/package.json +6 -3
- package/packages/ext-database/package.json +41 -0
- package/packages/ext-database/src/connection-tree.ts +142 -0
- package/packages/ext-database/src/extension.ts +346 -0
- package/packages/ext-database/src/query-panel.ts +120 -0
- package/packages/ext-database/src/table-viewer-panel.ts +410 -0
- package/packages/ext-database/tsconfig.json +8 -0
- package/packages/vscode-compat/package.json +16 -0
- package/packages/vscode-compat/src/commands.ts +39 -0
- package/packages/vscode-compat/src/context.ts +65 -0
- package/packages/vscode-compat/src/disposable.ts +21 -0
- package/packages/vscode-compat/src/env.ts +20 -0
- package/packages/vscode-compat/src/event-emitter.ts +28 -0
- package/packages/vscode-compat/src/index.ts +93 -0
- package/packages/vscode-compat/src/not-supported.ts +15 -0
- package/packages/vscode-compat/src/types.ts +167 -0
- package/packages/vscode-compat/src/uri.ts +65 -0
- package/packages/vscode-compat/src/window.ts +229 -0
- package/packages/vscode-compat/src/workspace.ts +76 -0
- package/packages/vscode-compat/tsconfig.json +10 -0
- package/src/cli/commands/autostart.ts +1 -1
- package/src/cli/commands/ext-cmd.ts +121 -0
- package/src/cli/commands/restart.ts +9 -1
- package/src/cli/commands/status.ts +19 -0
- package/src/index.ts +5 -3
- package/src/providers/claude-agent-sdk.ts +221 -17
- package/src/providers/cli-provider-base.ts +6 -0
- package/src/server/index.ts +55 -155
- package/src/server/routes/chat.ts +81 -11
- package/src/server/routes/extensions.ts +81 -0
- package/src/server/routes/project-scoped.ts +2 -0
- package/src/server/routes/settings.ts +27 -0
- package/src/server/routes/workspace.ts +35 -0
- package/src/server/ws/chat.ts +9 -3
- package/src/server/ws/extensions.ts +175 -0
- package/src/services/account-selector.service.ts +14 -5
- package/src/services/account.service.ts +7 -7
- package/src/services/claude-usage.service.ts +11 -11
- package/src/services/cloud-ws.service.ts +228 -0
- package/src/services/cloud.service.ts +1 -0
- package/src/services/contribution-registry.ts +110 -0
- package/src/services/db.service.ts +181 -4
- package/src/services/extension-host-worker.ts +160 -0
- package/src/services/extension-installer.ts +112 -0
- package/src/services/extension-manifest.ts +65 -0
- package/src/services/extension-rpc-handlers.ts +235 -0
- package/src/services/extension-rpc.ts +105 -0
- package/src/services/extension.service.ts +228 -0
- package/src/services/mcp-config.service.ts +15 -6
- package/src/services/supervisor.ts +271 -25
- package/src/types/api.ts +1 -0
- package/src/types/chat.ts +4 -0
- package/src/types/extension-messages.ts +64 -0
- package/src/types/extension.ts +131 -0
- package/src/web/app.tsx +69 -48
- package/src/web/components/chat/account-rotation-settings.tsx +163 -0
- package/src/web/components/chat/chat-history-bar.tsx +106 -10
- package/src/web/components/chat/chat-tab.tsx +15 -10
- package/src/web/components/chat/chat-welcome.tsx +148 -0
- package/src/web/components/chat/message-input.tsx +29 -29
- package/src/web/components/chat/message-list.tsx +19 -6
- package/src/web/components/chat/session-picker.tsx +80 -32
- package/src/web/components/chat/usage-badge.tsx +83 -10
- package/src/web/components/extensions/extension-inputbox.tsx +92 -0
- package/src/web/components/extensions/extension-quickpick.tsx +194 -0
- package/src/web/components/extensions/extension-tree-view.tsx +240 -0
- package/src/web/components/extensions/extension-webview.tsx +83 -0
- package/src/web/components/layout/command-palette.tsx +22 -2
- package/src/web/components/layout/editor-panel.tsx +163 -18
- package/src/web/components/layout/mobile-nav.tsx +2 -1
- package/src/web/components/layout/sidebar.tsx +21 -3
- package/src/web/components/layout/status-bar.tsx +64 -0
- package/src/web/components/layout/tab-bar.tsx +2 -0
- package/src/web/components/layout/tab-content.tsx +5 -0
- package/src/web/components/layout/upgrade-banner.tsx +15 -5
- package/src/web/components/settings/change-password-section.tsx +128 -0
- package/src/web/components/settings/extension-manager-section.tsx +214 -0
- package/src/web/components/settings/settings-tab.tsx +9 -2
- package/src/web/components/shared/connection-lost-overlay.tsx +89 -0
- package/src/web/hooks/use-chat.ts +28 -0
- package/src/web/hooks/use-extension-ws.ts +181 -0
- package/src/web/hooks/use-global-keybindings.ts +18 -2
- package/src/web/hooks/use-server-reload.ts +9 -0
- package/src/web/hooks/use-url-sync.ts +173 -21
- package/src/web/stores/connection-store.ts +39 -0
- package/src/web/stores/extension-store.ts +204 -0
- package/src/web/stores/panel-store.ts +63 -9
- package/src/web/stores/panel-utils.ts +145 -3
- package/src/web/stores/settings-store.ts +7 -2
- package/src/web/stores/tab-store.ts +2 -1
- package/tsconfig.json +3 -1
- package/dist/web/assets/api-settings-CEMxVMCV.js +0 -1
- package/dist/web/assets/architecture-PBZL5I3N-CFzkFKEL.js +0 -1
- package/dist/web/assets/arrow-up--LjUXLEt.js +0 -1
- package/dist/web/assets/browser-tab-D1Zua62g.js +0 -1
- package/dist/web/assets/channel-C2fMafck.js +0 -1
- package/dist/web/assets/chat-tab-BnD27Vp9.js +0 -7
- package/dist/web/assets/chevron-right-CHnjJt4E.js +0 -1
- package/dist/web/assets/chunk-GLR3WWYH-DBdWQ3zy.js +0 -2
- package/dist/web/assets/chunk-HHEYEP7N-BBw_z0fW.js +0 -1
- package/dist/web/assets/chunk-QZHKN3VN-DFKFM_C1.js +0 -1
- package/dist/web/assets/classDiagram-VBA2DB6C-Dp4Kk3Yb.js +0 -1
- package/dist/web/assets/classDiagram-v2-RAHNMMFH-D8IvcV_B.js +0 -1
- package/dist/web/assets/clone-B2hUek6n.js +0 -1
- package/dist/web/assets/code-editor-DGRg8stf.js +0 -2
- package/dist/web/assets/columns-2-DbesTfa7.js +0 -1
- package/dist/web/assets/database-viewer-DxCXZQcE.js +0 -1
- package/dist/web/assets/diff-viewer-C1sDJG35.js +0 -4
- package/dist/web/assets/git-graph-BDn-EiGE.js +0 -1
- package/dist/web/assets/gitGraph-HDMCJU4V-CNlas3Rz.js +0 -1
- package/dist/web/assets/index-Bun94AK3.js +0 -37
- package/dist/web/assets/index-Db8uky1a.css +0 -2
- package/dist/web/assets/info-3K5VOQVL-BDzTLc11.js +0 -1
- package/dist/web/assets/infoDiagram-LFFYTUFH-ZZmpgc6t.js +0 -2
- package/dist/web/assets/jsx-runtime-BRW_vwa9.js +0 -1
- package/dist/web/assets/keybindings-store-COmK4Dte.js +0 -1
- package/dist/web/assets/packet-RMMSAZCW-IVa5F-go.js +0 -1
- package/dist/web/assets/pie-UPGHQEXC-CvXHKAzp.js +0 -1
- package/dist/web/assets/postgres-viewer-CvQZ8gkh.js +0 -1
- package/dist/web/assets/radar-KQ55EAFF-Z-Tr5wtS.js +0 -1
- package/dist/web/assets/settings-tab-RCnvZ29H.js +0 -1
- package/dist/web/assets/sqlite-viewer-CEEm2W4C.js +0 -1
- package/dist/web/assets/stateDiagram-v2-FVOUBMTO-B-UjZch3.js +0 -1
- package/dist/web/assets/tab-store-Bjh6bXFP.js +0 -1
- package/dist/web/assets/table-CQVQM2SB.js +0 -1
- package/dist/web/assets/tag-Q2dZiSPX.js +0 -1
- package/dist/web/assets/treemap-KZPCXAKY-C9TYRE0k.js +0 -1
- /package/dist/web/assets/{api-client-BKIT_Qeg.js → api-client-BfBM3I7n.js} +0 -0
- /package/dist/web/assets/{array-DqLCdDFv.js → array-B9UHiPd-.js} +0 -0
- /package/dist/web/assets/{cytoscape.esm-CWPXKqbJ.js → cytoscape.esm-BW-DbntU.js} +0 -0
- /package/dist/web/assets/{defaultLocale-CrJzLgRD.js → defaultLocale-5eAKkKJC.js} +0 -0
- /package/dist/web/assets/{dist-Cep75xXf.js → dist-CSJdAyA9.js} +0 -0
- /package/dist/web/assets/{init-C0r9Gk5G.js → init-DlZdxViB.js} +0 -0
- /package/dist/web/assets/{isArrayLikeObject-CGBoxvCD.js → isArrayLikeObject-B_v2FtYn.js} +0 -0
- /package/dist/web/assets/{katex-DzXRfQ_m.js → katex-Bqvo_ZG0.js} +0 -0
- /package/dist/web/assets/{lib-BeaDXEkP.js → lib-BQ34Db2e.js} +0 -0
- /package/dist/web/assets/{math-y9zN1W-N.js → math-069Z4SuC.js} +0 -0
- /package/dist/web/assets/{path-DIKpVbHL.js → path-6uRLdFF7.js} +0 -0
- /package/dist/web/assets/{rough.esm-nHaDi0Kw.js → rough.esm-JX0wREDd.js} +0 -0
- /package/dist/web/assets/{src-Dw4QhedI.js → src-BqX54PbV.js} +0 -0
- /package/dist/web/assets/{utils-DMiycH3O.js → utils-BNytJOb1.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomId } from "@/lib/utils";
|
|
2
|
-
import type { Tab } from "./tab-store";
|
|
2
|
+
import type { Tab, TabType } from "./tab-store";
|
|
3
3
|
|
|
4
4
|
// ---------------------------------------------------------------------------
|
|
5
5
|
// Panel types
|
|
@@ -69,6 +69,62 @@ export function findPanelPosition(grid: string[][], panelId: string): { row: num
|
|
|
69
69
|
return null;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
// Deterministic tab IDs
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
|
|
76
|
+
/** Derive deterministic tab ID from type + metadata */
|
|
77
|
+
export function deriveTabId(type: TabType, metadata?: Record<string, unknown>): string {
|
|
78
|
+
switch (type) {
|
|
79
|
+
case "editor":
|
|
80
|
+
return `editor:${metadata?.filePath ?? "untitled"}`;
|
|
81
|
+
case "chat": {
|
|
82
|
+
const provider = metadata?.providerId ?? "default";
|
|
83
|
+
return `chat:${provider}/${metadata?.sessionId ?? randomId()}`;
|
|
84
|
+
}
|
|
85
|
+
case "terminal":
|
|
86
|
+
return `terminal:${metadata?.terminalIndex ?? 1}`;
|
|
87
|
+
case "database":
|
|
88
|
+
return `database:${metadata?.connectionId ?? "default"}:${metadata?.tableName ?? ""}`;
|
|
89
|
+
case "sqlite":
|
|
90
|
+
return `sqlite:${metadata?.filePath ?? "default"}`;
|
|
91
|
+
case "postgres":
|
|
92
|
+
return `postgres:${metadata?.connectionId ?? "default"}:${metadata?.tableName ?? ""}`;
|
|
93
|
+
case "git-graph":
|
|
94
|
+
return "git-graph";
|
|
95
|
+
case "git-diff":
|
|
96
|
+
return `git-diff:${metadata?.filePath ?? "unknown"}`;
|
|
97
|
+
case "settings":
|
|
98
|
+
return "settings";
|
|
99
|
+
case "browser":
|
|
100
|
+
return `browser:${metadata?.url ?? "blank"}`;
|
|
101
|
+
default:
|
|
102
|
+
return `${type}:${randomId()}`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Migrate old random tab IDs to deterministic IDs */
|
|
107
|
+
export function migrateTabIds(layout: PanelLayout): PanelLayout {
|
|
108
|
+
const migrated = { ...layout, panels: { ...layout.panels } };
|
|
109
|
+
for (const [panelId, panel] of Object.entries(migrated.panels)) {
|
|
110
|
+
const newTabs = panel.tabs.map((tab) => {
|
|
111
|
+
if (tab.id.startsWith("tab-")) {
|
|
112
|
+
const newId = deriveTabId(tab.type, tab.metadata);
|
|
113
|
+
return { ...tab, id: newId };
|
|
114
|
+
}
|
|
115
|
+
return tab;
|
|
116
|
+
});
|
|
117
|
+
const idMap = new Map<string, string>();
|
|
118
|
+
panel.tabs.forEach((old, i) => {
|
|
119
|
+
if (old.id !== newTabs[i]!.id) idMap.set(old.id, newTabs[i]!.id);
|
|
120
|
+
});
|
|
121
|
+
const newActive = idMap.get(panel.activeTabId ?? "") ?? panel.activeTabId;
|
|
122
|
+
const newHistory = panel.tabHistory.map((h) => idMap.get(h) ?? h);
|
|
123
|
+
migrated.panels[panelId] = { ...panel, tabs: newTabs, activeTabId: newActive, tabHistory: newHistory };
|
|
124
|
+
}
|
|
125
|
+
return migrated;
|
|
126
|
+
}
|
|
127
|
+
|
|
72
128
|
// ---------------------------------------------------------------------------
|
|
73
129
|
// Persistence
|
|
74
130
|
// ---------------------------------------------------------------------------
|
|
@@ -81,20 +137,106 @@ function storageKey(projectName: string): string {
|
|
|
81
137
|
|
|
82
138
|
export function savePanelLayout(projectName: string, layout: PanelLayout): void {
|
|
83
139
|
try {
|
|
84
|
-
|
|
140
|
+
const withTimestamp = { ...layout, updatedAt: new Date().toISOString() };
|
|
141
|
+
localStorage.setItem(storageKey(projectName), JSON.stringify(withTimestamp));
|
|
142
|
+
// Debounced server sync
|
|
143
|
+
syncWorkspaceToServer(projectName, layout);
|
|
85
144
|
} catch { /* ignore */ }
|
|
86
145
|
}
|
|
87
146
|
|
|
88
147
|
export function loadPanelLayout(projectName: string): PanelLayout | null {
|
|
89
148
|
try {
|
|
90
149
|
const raw = localStorage.getItem(storageKey(projectName));
|
|
91
|
-
if (raw)
|
|
150
|
+
if (raw) {
|
|
151
|
+
const layout = JSON.parse(raw) as PanelLayout;
|
|
152
|
+
return migrateTabIds(layout);
|
|
153
|
+
}
|
|
92
154
|
} catch { /* ignore */ }
|
|
93
155
|
|
|
94
156
|
// Migrate from old tab-store format
|
|
95
157
|
return migrateOldTabStore(projectName);
|
|
96
158
|
}
|
|
97
159
|
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
// Server sync
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
|
|
164
|
+
export interface PanelLayoutWithTimestamp extends PanelLayout {
|
|
165
|
+
updatedAt: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** Fetch workspace from server */
|
|
169
|
+
export async function fetchWorkspaceFromServer(
|
|
170
|
+
projectName: string,
|
|
171
|
+
): Promise<PanelLayoutWithTimestamp | null> {
|
|
172
|
+
try {
|
|
173
|
+
const headers: Record<string, string> = {};
|
|
174
|
+
const token = localStorage.getItem("ppm-auth-token");
|
|
175
|
+
if (token) headers["Authorization"] = `Bearer ${token}`;
|
|
176
|
+
|
|
177
|
+
const res = await fetch(`/api/project/${encodeURIComponent(projectName)}/workspace`, { headers });
|
|
178
|
+
if (!res.ok) return null;
|
|
179
|
+
const json = await res.json();
|
|
180
|
+
if (!json.ok || !json.data) return null;
|
|
181
|
+
return { ...json.data.layout, updatedAt: json.data.updatedAt };
|
|
182
|
+
} catch {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** Save workspace to server (debounced per project) */
|
|
188
|
+
const syncTimers = new Map<string, ReturnType<typeof setTimeout>>();
|
|
189
|
+
|
|
190
|
+
function syncWorkspaceToServer(projectName: string, layout: PanelLayout): void {
|
|
191
|
+
const existing = syncTimers.get(projectName);
|
|
192
|
+
if (existing) clearTimeout(existing);
|
|
193
|
+
|
|
194
|
+
syncTimers.set(projectName, setTimeout(async () => {
|
|
195
|
+
syncTimers.delete(projectName);
|
|
196
|
+
try {
|
|
197
|
+
const headers: Record<string, string> = { "Content-Type": "application/json" };
|
|
198
|
+
const token = localStorage.getItem("ppm-auth-token");
|
|
199
|
+
if (token) headers["Authorization"] = `Bearer ${token}`;
|
|
200
|
+
|
|
201
|
+
const res = await fetch(`/api/project/${encodeURIComponent(projectName)}/workspace`, {
|
|
202
|
+
method: "PUT",
|
|
203
|
+
headers,
|
|
204
|
+
body: JSON.stringify({ layout }),
|
|
205
|
+
});
|
|
206
|
+
if (res.ok) {
|
|
207
|
+
const json = await res.json();
|
|
208
|
+
if (json.data?.updatedAt) {
|
|
209
|
+
const key = `${STORAGE_PREFIX}${projectName}`;
|
|
210
|
+
const raw = localStorage.getItem(key);
|
|
211
|
+
if (raw) {
|
|
212
|
+
const local = JSON.parse(raw);
|
|
213
|
+
local.updatedAt = json.data.updatedAt;
|
|
214
|
+
localStorage.setItem(key, JSON.stringify(local));
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
} catch { /* silent fail — localStorage is still the cache */ }
|
|
219
|
+
}, 1500));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** Compare local vs server timestamps, return newer layout */
|
|
223
|
+
export function resolveWorkspaceConflict(
|
|
224
|
+
local: PanelLayoutWithTimestamp | null,
|
|
225
|
+
server: PanelLayoutWithTimestamp | null,
|
|
226
|
+
): PanelLayoutWithTimestamp | null {
|
|
227
|
+
if (!local && !server) return null;
|
|
228
|
+
if (!local) return server!;
|
|
229
|
+
if (!server) return local;
|
|
230
|
+
|
|
231
|
+
const localTime = new Date(local.updatedAt).getTime();
|
|
232
|
+
const serverTime = new Date(server.updatedAt).getTime();
|
|
233
|
+
return serverTime >= localTime ? server : local;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// ---------------------------------------------------------------------------
|
|
237
|
+
// Old format migration
|
|
238
|
+
// ---------------------------------------------------------------------------
|
|
239
|
+
|
|
98
240
|
function migrateOldTabStore(projectName: string): PanelLayout | null {
|
|
99
241
|
try {
|
|
100
242
|
const raw = localStorage.getItem(`${OLD_STORAGE_PREFIX}${projectName}`);
|
|
@@ -2,7 +2,7 @@ import { create } from "zustand";
|
|
|
2
2
|
|
|
3
3
|
export type Theme = "light" | "dark" | "system";
|
|
4
4
|
export type GitStatusViewMode = "flat" | "tree";
|
|
5
|
-
export type SidebarActiveTab = "explorer" | "git" | "settings" | "database" | "search"
|
|
5
|
+
export type SidebarActiveTab = "explorer" | "git" | "settings" | "database" | "search" | `ext:${string}`;
|
|
6
6
|
|
|
7
7
|
const STORAGE_KEY = "ppm-settings";
|
|
8
8
|
|
|
@@ -44,6 +44,11 @@ function loadPersistedSettings(): PersistedSettings {
|
|
|
44
44
|
return {};
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
function isValidSidebarTab(tab: unknown): tab is SidebarActiveTab {
|
|
48
|
+
if (typeof tab !== "string") return false;
|
|
49
|
+
return ["explorer", "git", "settings", "database", "search"].includes(tab) || tab.startsWith("ext:");
|
|
50
|
+
}
|
|
51
|
+
|
|
47
52
|
function persistSettings(update: Partial<PersistedSettings>) {
|
|
48
53
|
const current = loadPersistedSettings();
|
|
49
54
|
localStorage.setItem(STORAGE_KEY, JSON.stringify({ ...current, ...update }));
|
|
@@ -79,7 +84,7 @@ export const useSettingsStore = create<SettingsState>((set, get) => ({
|
|
|
79
84
|
sidebarWidth: _initial.sidebarWidth ?? 280,
|
|
80
85
|
gitStatusViewMode: _initial.gitStatusViewMode === "flat" ? "flat" : "tree",
|
|
81
86
|
wordWrap: _initial.wordWrap ?? false,
|
|
82
|
-
sidebarActiveTab: (
|
|
87
|
+
sidebarActiveTab: isValidSidebarTab(_initial.sidebarActiveTab) ? _initial.sidebarActiveTab : "explorer",
|
|
83
88
|
deviceName: null,
|
|
84
89
|
version: null,
|
|
85
90
|
|
package/tsconfig.json
CHANGED
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
|
|
25
25
|
"baseUrl": ".",
|
|
26
26
|
"paths": {
|
|
27
|
-
"@/*": ["./src/web/*"]
|
|
27
|
+
"@/*": ["./src/web/*"],
|
|
28
|
+
"@ppm/vscode-compat": ["./packages/vscode-compat/src/index.ts"],
|
|
29
|
+
"@ppm/vscode-compat/*": ["./packages/vscode-compat/*"]
|
|
28
30
|
}
|
|
29
31
|
},
|
|
30
32
|
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CFjPhJqf.js";import{t}from"./api-client-BKIT_Qeg.js";var n=e({addAccount:()=>a,exchangeOAuthCode:()=>c,getAISettings:()=>f,getAccounts:()=>r,getActiveAccount:()=>i,getAllAccountUsages:()=>l,getOAuthUrl:()=>s,getProxySettings:()=>m,importAccounts:()=>u,patchAccount:()=>o,updateAISettings:()=>p,updateDeviceName:()=>d,updateProxySettings:()=>h});function r(){return t.get(`/api/accounts`)}function i(){return t.get(`/api/accounts/active`)}function a(e){return t.post(`/api/accounts`,e)}function o(e,n){return t.patch(`/api/accounts/${e}`,n)}function s(){return t.get(`/api/accounts/oauth/url`)}function c(e,n){return t.post(`/api/accounts/oauth/exchange`,{code:e,state:n})}function l(){return t.get(`/api/accounts/usage`)}function u(e){return t.post(`/api/accounts/import`,e)}function d(e){return t.put(`/api/settings/device-name`,{device_name:e})}function f(){return t.get(`/api/settings/ai`)}function p(e){return t.put(`/api/settings/ai`,e)}function m(){return t.get(`/api/settings/proxy`)}function h(e){return t.put(`/api/settings/proxy`,e)}export{r as a,s as c,o as d,p as f,f as i,m as l,n,i as o,h as p,c as r,l as s,a as t,u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk-XZSTWKYB-Cb0iqycX.js";import{n as e}from"./chunk-R5LLSJPH-CMY0PkRK.js";export{e as createArchitectureServices};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./jsx-runtime-BRW_vwa9.js";var t=e(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import{t as n}from"./jsx-runtime-BRW_vwa9.js";import{o as r,t as i}from"./tab-store-Bjh6bXFP.js";import{t as a}from"./api-client-BKIT_Qeg.js";import{$ as o,K as s,Q as c,z as l}from"./index-Bun94AK3.js";var u=e(t(),1),d=n();function f({metadata:e,tabId:t}){let n=e?.port||0,[f,p]=(0,u.useState)(n?String(n):``),[m,h]=(0,u.useState)(null),[g,_]=(0,u.useState)(!1),[v,y]=(0,u.useState)(null),b=(0,u.useRef)(null),x=i(e=>e.updateTab),S=(0,u.useCallback)(async n=>{_(!0),y(null),h(null);try{h((await a.post(`/api/preview/tunnel`,{port:n})).url),t&&x(t,{title:`localhost:${n}`,metadata:{...e,port:n}})}catch(e){y(e.message||`Failed to start tunnel for port ${n}`)}finally{_(!1)}},[t,e,x]),C=(0,u.useCallback)(async()=>{let e=parseInt(f,10);if(e){try{await a.del(`/api/preview/tunnel/${e}`)}catch{}h(null),t&&x(t,{title:`Browser`})}},[f,t,x]);return m?(0,d.jsxs)(`div`,{className:`flex flex-col h-full w-full bg-background`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1.5 border-b border-border bg-surface shrink-0`,children:[(0,d.jsx)(o,{className:`size-4 text-text-subtle shrink-0`}),(0,d.jsxs)(`span`,{className:`text-xs text-text-primary font-medium`,children:[`localhost:`,f]}),(0,d.jsxs)(`span`,{className:`text-xs text-text-subtle truncate ml-1`,children:[`(`,m,`)`]}),(0,d.jsx)(`div`,{className:`flex-1`}),(0,d.jsx)(`button`,{onClick:()=>{if(b.current){let e=b.current.src;b.current.src=``,requestAnimationFrame(()=>{b.current&&(b.current.src=e)})}},className:`p-1.5 rounded hover:bg-surface-elevated transition-colors`,title:`Reload`,children:(0,d.jsx)(s,{className:`size-3.5`})}),(0,d.jsx)(`button`,{onClick:()=>window.open(m,`_blank`),className:`p-1.5 rounded hover:bg-surface-elevated transition-colors`,title:`Open in browser`,children:(0,d.jsx)(r,{className:`size-3.5`})}),(0,d.jsx)(`button`,{onClick:C,className:`p-1.5 rounded hover:bg-surface-elevated text-red-400 transition-colors`,title:`Stop tunnel`,children:(0,d.jsx)(l,{className:`size-3.5`})})]}),(0,d.jsxs)(`div`,{className:`flex-1 relative min-h-0`,children:[(0,d.jsx)(`iframe`,{ref:b,src:m,className:`w-full h-full border-0`,sandbox:`allow-scripts allow-forms allow-same-origin allow-popups allow-modals`,onLoad:()=>_(!1)}),g&&(0,d.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50`,children:(0,d.jsx)(c,{className:`size-5 animate-spin text-text-secondary`})})]})]}):(0,d.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-4 p-6`,children:[(0,d.jsx)(o,{className:`size-12 text-text-subtle`}),(0,d.jsx)(`h2`,{className:`text-lg font-medium text-text-primary`,children:`Open Localhost`}),(0,d.jsx)(`p`,{className:`text-sm text-text-secondary text-center max-w-sm`,children:`Enter the port of your local dev server to preview it here.`}),(0,d.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=parseInt(f,10);t>=1&&t<=65535?S(t):y(`Port must be 1-65535`)},className:`flex items-center gap-2 w-full max-w-xs`,children:[(0,d.jsxs)(`div`,{className:`flex-1 flex items-center gap-2 px-3 py-2.5 rounded-lg bg-surface border border-border focus-within:border-accent/50 transition-colors`,children:[(0,d.jsx)(`span`,{className:`text-sm text-text-subtle shrink-0`,children:`localhost:`}),(0,d.jsx)(`input`,{type:`number`,value:f,onChange:e=>p(e.target.value),placeholder:`3000`,min:1,max:65535,autoFocus:!0,className:`flex-1 bg-transparent text-sm text-text-primary outline-none placeholder:text-text-subtle min-w-0 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none`})]}),(0,d.jsx)(`button`,{type:`submit`,disabled:g||!f,className:`px-4 py-2.5 rounded-lg bg-accent text-white text-sm font-medium hover:bg-accent/90 disabled:opacity-50 transition-colors shrink-0`,children:g?(0,d.jsx)(c,{className:`size-4 animate-spin`}):`Open`})]}),v&&(0,d.jsx)(`p`,{className:`text-sm text-red-400`,children:v}),g&&(0,d.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-text-secondary`,children:[(0,d.jsx)(c,{className:`size-4 animate-spin`}),(0,d.jsx)(`span`,{children:`Starting tunnel... (may take a few seconds)`})]})]})}export{f as BrowserTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{it as e,rt as t}from"./chunk-7R4GIKGN-Dvbyu4Zw.js";var n=(n,r)=>e.lang.round(t.parse(n)[r]);export{n as t};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/api-client-BKIT_Qeg.js","assets/chunk-CFjPhJqf.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import"./react-dom-Bpkvzu3U.js";import{n,t as r}from"./jsx-runtime-BRW_vwa9.js";import{t as i}from"./arrow-up--LjUXLEt.js";import{t as a}from"./chevron-right-CHnjJt4E.js";import{n as o,t as s}from"./markdown-renderer-VIZB1GXE.js";import{t as c}from"./columns-2-DbesTfa7.js";import{n as l,o as u,t as d}from"./tab-store-Bjh6bXFP.js";import{t as f}from"./tag-Q2dZiSPX.js";import{t as p}from"./preload-helper-Bf_JiD2A.js";import"./dist-CALwEtco.js";import{n as m,r as h,t as g}from"./utils-DMiycH3O.js";import{i as _,r as v,t as y}from"./api-client-BKIT_Qeg.js";import{a as b,c as x,d as S,i as C,o as w,r as T,s as E,t as D,u as O}from"./api-settings-CEMxVMCV.js";import{$ as k,B as A,C as j,G as M,H as N,J as P,K as F,L as I,Q as L,R,S as z,W as B,X as ee,Z as V,_ as H,_t as U,a as W,b as te,bt as G,c as ne,ct as K,dt as re,ht as ie,it as ae,j as oe,l as q,mt as J,n as se,nt as ce,o as le,pt as ue,q as de,r as fe,s as pe,st as me,tt as he,ut as ge,v as _e,vt as ve,w as Y,x as ye,y as be,yt as xe,z as Se}from"./index-Bun94AK3.js";import"./chunk-GEFDOKGD-tDjHsAUs.js";import"./src-Dw4QhedI.js";import"./chunk-7R4GIKGN-Dvbyu4Zw.js";import"./chunk-HHEYEP7N-BBw_z0fW.js";import"./dist-Cep75xXf.js";import"./chunk-PU5JKC2W-C7Gry6md.js";import"./chunk-MX3YWQON-C2UEioMs.js";import"./chunk-YBOYWFTD-av5aeHLq.js";import"./chunk-PQ6SQG4A-DX0xW7kO.js";import"./chunk-KYZI473N-Djw13C-3.js";import"./chunk-O4XLMI2P-BsUWb9d0.js";import"./chunk-GLR3WWYH-DBdWQ3zy.js";import"./chunk-XPW4576I-BPEX8KhL.js";var Ce=n(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),we=n(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Te=n(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),Ee=n(`hand`,[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1fvzgz`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`,key:`1kc0my`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`,key:`10h0bg`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`1s1gnw`}]]),De=n(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Oe=n(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),ke=n(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),Ae=n(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),je=n(`mic-off`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]),Me=n(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),Ne=n(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Pe=n(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Fe=n(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),Ie=n(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Le=n(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Re=n(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),X=e(t(),1),ze=3e4,Be=1e3,Ve=class{ws=null;url;handlers=[];reconnectAttempts=0;reconnectTimer=null;intentionalClose=!1;pendingMessages=[];constructor(e){this.url=e}connect(){this.intentionalClose=!1,this.cleanup();let e=window.location.protocol===`https:`?`wss:`:`ws:`,t=this.url.startsWith(`ws`)?this.url:`${e}//${window.location.host}${this.url}`;this.ws=new WebSocket(t),this.ws.onopen=()=>{this.reconnectAttempts=0;try{this.ws?.send(JSON.stringify({type:`ready`}))}catch{}if(this.pendingMessages.length>0){console.log(`[ws] flushing ${this.pendingMessages.length} queued message(s)`);for(let e of this.pendingMessages)try{this.ws?.send(e)}catch{}this.pendingMessages=[]}},this.ws.onmessage=e=>{for(let t of this.handlers)t(e)},this.ws.onclose=()=>{this.intentionalClose||this.scheduleReconnect()},this.ws.onerror=()=>{this.ws?.close()}}disconnect(){this.intentionalClose=!0,this.pendingMessages=[],this.cleanup(),this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null)}send(e){this.ws?.readyState===WebSocket.OPEN?this.ws.send(e):this.ws?.readyState===WebSocket.CONNECTING?(console.warn(`[ws] WS still CONNECTING — queuing message`),this.pendingMessages.push(e)):console.warn(`[ws] message dropped — readyState=${this.ws?.readyState??`no-ws`}`)}onMessage(e){return this.handlers.push(e),()=>{this.handlers=this.handlers.filter(t=>t!==e)}}get isConnected(){return this.ws?.readyState===WebSocket.OPEN}cleanup(){this.ws&&=(this.ws.onopen=null,this.ws.onclose=null,this.ws.onmessage=null,this.ws.onerror=null,(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING)&&this.ws.close(),null)}scheduleReconnect(){let e=Math.min(Be*2**this.reconnectAttempts,ze);this.reconnectAttempts++,this.reconnectTimer=setTimeout(()=>this.connect(),e)}};function He({url:e,onMessage:t,autoConnect:n=!0}){let r=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let i=new Ve(e);return r.current=i,t&&i.onMessage(t),n&&i.connect(),()=>{i.disconnect(),r.current=null}},[e,n]),{send:(0,X.useCallback)(e=>{r.current?.send(e)},[]),connect:(0,X.useCallback)(()=>{r.current?.connect()},[]),disconnect:(0,X.useCallback)(()=>{r.current?.disconnect()},[])}}var Ue=null;function We(){return Ue||=new AudioContext,Ue}function Z(e,t,n,r,i=`sine`){let a=We(),o=a.createOscillator(),s=a.createGain();o.type=i,o.frequency.value=e,s.gain.setValueAtTime(r,n),s.gain.exponentialRampToValueAtTime(.001,n+t),o.connect(s),s.connect(a.destination),o.start(n),o.stop(n+t)}function Ge(){let e=We().currentTime;Z(523,.15,e,.15),Z(659,.2,e+.12,.15)}function Ke(){let e=We().currentTime;Z(880,.12,e,.18,`square`),Z(698,.12,e+.15,.18,`square`),Z(880,.15,e+.3,.15,`square`)}function qe(){let e=We().currentTime;Z(440,.12,e,.12),Z(523,.12,e+.1,.12),Z(659,.18,e+.2,.12)}var Je={done:Ge,approval_request:Ke,question:qe};function Ye(e){try{Je[e]?.()}catch{}}function Xe(e){if(document.hidden)return!1;let{panels:t,focusedPanelId:n}=l.getState(),r=t[n];if(!r)return!1;let i=r.tabs.find(e=>e.id===r.activeTabId);return i?.type===`chat`&&i.metadata?.sessionId===e}function Ze(e,t=`claude`,n=``){let[r,i]=(0,X.useState)([]),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(`idle`),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(0),[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(null),[y,b]=(0,X.useState)(null),[x,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(null),T=(0,X.useRef)(``),E=(0,X.useRef)([]),D=(0,X.useRef)(null),O=(0,X.useRef)(`idle`),k=(0,X.useRef)(null),A=(0,X.useRef)(()=>{}),j=(0,X.useRef)(null),M=(0,X.useRef)(e);M.current=e;let N=(0,X.useRef)(n);N.current=n;let P=s!==`idle`,F=(0,X.useCallback)((e,t)=>{let n=E.current.findIndex(e=>e.type===`tool_use`&&(e.tool===`Agent`||e.tool===`Task`)&&e.toolUseId===t);if(n===-1)return!1;let r=E.current[n];if(r.type!==`tool_use`)return!1;let i=[...r.children??[],e];return E.current[n]={...r,children:i},!0},[]),I=(0,X.useCallback)(()=>{let e=T.current,t=[...E.current],n=D.current;i(r=>{let i=r[r.length-1];return i?.role===`assistant`&&!i.id.startsWith(`final-`)?[...r.slice(0,-1),{...i,content:e,events:t,...n}]:[...r,{id:`streaming-${Date.now()}`,role:`assistant`,content:e,events:t,timestamp:new Date().toISOString(),...n}]})},[]),L=(0,X.useCallback)(e=>{let t=e,n=t?.type;if(n)switch(n){case`account_info`:D.current={accountId:t.accountId,accountLabel:t.accountLabel};break;case`text`:{let e=t.parentToolUseId;if(e&&F(t,e)){I();break}T.current+=t.content,E.current.push(t),I();break}case`thinking`:{let e=t.parentToolUseId;if(e&&F(t,e)){I();break}E.current.push(t),I();break}case`tool_use`:{let e=t.parentToolUseId;if(e&&F(t,e)){I();break}E.current.push(t),I();break}case`tool_result`:{let e=t.parentToolUseId;if(e&&F(t,e)){I();break}E.current.push(t),I();break}case`approval_request`:if(E.current.push(t),m({requestId:t.requestId,tool:t.tool,input:t.input}),M.current&&!Xe(M.current)){let e=t.tool===`AskUserQuestion`?`question`:`approval_request`;oe.getState().addNotification(M.current,e,N.current),Ye(e)}break;case`error`:{E.current.push(t);let e=[...E.current];i(n=>{let r=n[n.length-1];return r?.role===`assistant`?[...n.slice(0,-1),{...r,events:e}]:[...n,{id:`error-${Date.now()}`,role:`system`,content:t.message,events:[t],timestamp:new Date().toISOString()}]});break}case`done`:{if(O.current===`idle`)break;t.contextWindowPct!=null&&g(t.contextWindowPct),M.current&&!Xe(M.current)&&(oe.getState().addNotification(M.current,`done`,N.current),Ye(`done`));let e=T.current,n=[...E.current];i(t=>{let r=t[t.length-1];return r?.role===`assistant`?[...t.slice(0,-1),{...r,id:`final-${Date.now()}`,content:e||r.content,events:n.length>0?n:r.events}]:t}),T.current=``,E.current=[],D.current=null;break}}},[F,I]),R=(0,X.useCallback)(e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(t.type!==`ping`){if(t.type===`session_migrated`){let e=t.newSessionId;e&&w(e);return}if(t.type===`title_updated`){b(t.title??null);return}if(t.type===`phase_changed`){let e=t.phase;c(e),O.current=e,f(e===`connecting`?t.elapsed??0:0);return}if(t.type===`session_state`){S(!0);let e=t,n=e.phase;c(n),O.current=n,e.sessionTitle&&b(e.sessionTitle),e.pendingApproval&&m({requestId:e.pendingApproval.requestId,tool:e.pendingApproval.tool,input:e.pendingApproval.input}),n===`idle`&&(j.current?.(),u(!1));return}if(t.type===`turn_events`){let e=t.events;if(!e?.length){u(!1);return}i(e=>{let t=e.findLastIndex(e=>e.role===`user`);return t>=0?e.slice(0,t+1):e}),T.current=``,E.current=[],D.current=null;let n=0,r=()=>{let t=Math.min(n+100,e.length);for(let r=n;r<t;r++)L(e[r]);n=t,n<e.length?requestAnimationFrame(r):u(!1)};requestAnimationFrame(r);return}L(t)}},[L]),{send:z,connect:B}=He({url:e&&n?`/ws/project/${encodeURIComponent(n)}/chat/${e}`:``,onMessage:R,autoConnect:!!e&&!!n});A.current=z,(0,X.useEffect)(()=>{let r=!1;return c(`idle`),O.current=`idle`,m(null),T.current=``,E.current=[],S(!1),e&&n?(o(!0),fetch(`${_(n)}/chat/sessions/${e}/messages?providerId=${t}`,{headers:{Authorization:`Bearer ${v()}`}}).then(e=>e.json()).then(e=>{r||O.current!==`idle`||(e.ok&&Array.isArray(e.data)&&e.data.length>0?i(e.data):i([]))}).catch(()=>{!r&&O.current===`idle`&&i([])}).finally(()=>{r||o(!1)})):i([]),()=>{r=!0}},[e,t,n]);let ee=(0,X.useCallback)((e,t)=>{if(!e.trim())return;let n=O.current!==`idle`;if(n){let e=T.current,t=[...E.current];i(n=>{let r=n[n.length-1];return r?.role===`assistant`?[...n.slice(0,-1),{...r,id:`final-${Date.now()}`,content:e||r.content,events:t.length>0?t:r.events}]:n})}i(t=>[...t,{id:`user-${Date.now()}`,role:`user`,content:e,timestamp:new Date().toISOString()}]),T.current=``,E.current=[],k.current=null,n?(c(`thinking`),O.current=`thinking`):(c(`initializing`),O.current=`initializing`),m(null),z(JSON.stringify({type:`message`,content:e,permissionMode:t?.permissionMode,priority:t?.priority,images:t?.images}))},[z]),V=(0,X.useCallback)((e,t,n)=>{if(z(JSON.stringify({type:`approval_response`,requestId:e,approved:t,data:n})),t&&n){let t=E.current.find(t=>t.type===`approval_request`&&t.requestId===e&&t.tool===`AskUserQuestion`);if(t){let e=t.input;e&&typeof e==`object`&&(e.answers=n)}i(e=>[...e])}m(null)},[z]),H=(0,X.useCallback)(()=>{if(O.current===`idle`)return;z(JSON.stringify({type:`cancel`}));let e=T.current,t=[...E.current];i(n=>{let r=n[n.length-1];return r?.role===`assistant`?[...n.slice(0,-1),{...r,id:`final-${Date.now()}`,content:e||r.content,events:t.length>0?t:r.events}]:n}),T.current=``,E.current=[],k.current=null,c(`idle`),O.current=`idle`,m(null)},[z]),U=(0,X.useCallback)(()=>{S(!1),u(!0),B()},[B]),W=(0,X.useCallback)(()=>{!e||!n||(o(!0),fetch(`${_(n)}/chat/sessions/${e}/messages?providerId=${t}`,{headers:{Authorization:`Bearer ${v()}`}}).then(e=>e.json()).then(e=>{e.ok&&Array.isArray(e.data)&&e.data.length>0&&(i(e.data),T.current=``,E.current=[])}).catch(()=>{}).finally(()=>o(!1)))},[e,t,n]);return j.current=W,{messages:r,messagesLoading:a,isStreaming:P,phase:s,isReconnecting:l,connectingElapsed:d,pendingApproval:p,contextWindowPct:h,sessionTitle:y,migratedSessionId:C,sendMessage:ee,respondToApproval:V,cancelStreaming:H,reconnect:U,refetchMessages:W,isConnected:x}}var Qe=12e4;function $e(e,t=`claude`){let[n,r]=(0,X.useState)({}),[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(null),c=(0,X.useRef)(null),l=(0,X.useCallback)((n=!1)=>{if(!e)return;a(!0);let i=n?`&refresh=1`:``;fetch(`${_(e)}/chat/usage?providerId=${t}${i}`,{headers:{Authorization:`Bearer ${v()}`}}).then(e=>e.json()).then(e=>{e.ok&&e.data&&(r(t=>({...t,...e.data})),e.data.lastFetchedAt&&s(e.data.lastFetchedAt))}).catch(()=>{}).finally(()=>a(!1))},[e,t]);return(0,X.useEffect)(()=>(l(),c.current=setInterval(()=>l(),Qe),()=>{c.current&&clearInterval(c.current)}),[l]),{usageInfo:n,usageLoading:i,lastFetchedAt:o,refreshUsage:(0,X.useCallback)(()=>l(!0),[l])}}var et={damping:.7,stiffness:.05,mass:1.25},tt=70,nt=1e3/60,rt=350,it=!1;globalThis.document?.addEventListener(`mousedown`,()=>{it=!0}),globalThis.document?.addEventListener(`mouseup`,()=>{it=!1}),globalThis.document?.addEventListener(`click`,()=>{it=!1});var at=(e={})=>{let[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(e.initial!==!1),[a,o]=(0,X.useState)(!1),s=(0,X.useRef)(null);s.current=e;let c=(0,X.useCallback)(()=>{if(!it)return!1;let e=window.getSelection();if(!e||!e.rangeCount)return!1;let t=e.getRangeAt(0);return t.commonAncestorContainer.contains(g.current)||g.current?.contains(t.commonAncestorContainer)},[]),l=(0,X.useCallback)(e=>{d.isAtBottom=e,i(e)},[]),u=(0,X.useCallback)(e=>{d.escapedFromLock=e,n(e)},[]),d=(0,X.useMemo)(()=>{let n;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(e){g.current&&(g.current.scrollTop=e,d.ignoreScrollToTop=g.current.scrollTop)},get targetScrollTop(){return!g.current||!_.current?0:g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!_.current)return 0;let{targetScrollTop:t}=this;if(!e.targetScrollTop)return t;if(n?.targetScrollTop===t)return n.calculatedScrollTop;let r=Math.max(Math.min(e.targetScrollTop(t,{scrollElement:g.current,contentElement:_.current}),t),0);return n={targetScrollTop:t,calculatedScrollTop:r},requestAnimationFrame(()=>{n=void 0}),r},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=tt}}},[]),f=(0,X.useCallback)((e={})=>{typeof e==`string`&&(e={animation:e}),e.preserveScrollPosition||l(!0);let t=Date.now()+(Number(e.wait)||0),n=ct(s.current,e.animation),{ignoreEscapes:r=!1}=e,i,a=d.calculatedTargetScrollTop;e.duration instanceof Promise?e.duration.finally(()=>{i=Date.now()}):i=t+(e.duration??0);let o=async()=>{let e=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;let{scrollTop:l}=d,u=performance.now(),p=(u-(d.lastTick??u))/nt;if(d.animation||={behavior:n,promise:e,ignoreEscapes:r},d.animation.behavior===n&&(d.lastTick=u),c()||t>Date.now())return o();if(l<Math.min(a,d.calculatedTargetScrollTop)){if(d.animation?.behavior===n){if(n===`instant`)return d.scrollTop=d.calculatedTargetScrollTop,o();d.velocity=(n.damping*d.velocity+n.stiffness*d.scrollDifference)/n.mass,d.accumulated+=d.velocity*p,d.scrollTop+=d.accumulated,d.scrollTop!==l&&(d.accumulated=0)}return o()}return i>Date.now()?(a=d.calculatedTargetScrollTop,o()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:ct(s.current,s.current.resize),ignoreEscapes:r,duration:Math.max(0,i-Date.now())||void 0}):d.isAtBottom)});return e.then(e=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),e))};return e.wait!==!0&&(d.animation=void 0),d.animation?.behavior===n?d.animation.promise:o()},[l,c,d]),p=(0,X.useCallback)(()=>{u(!0),l(!1)},[u,l]),m=(0,X.useCallback)(({target:e})=>{if(e!==g.current)return;let{scrollTop:t,ignoreScrollToTop:n}=d,{lastScrollTop:r=t}=d;d.lastScrollTop=t,d.ignoreScrollToTop=void 0,n&&n>t&&(r=n),o(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||t===n)return;if(c()){u(!0),l(!1);return}let e=t>r,i=t<r;if(d.animation?.ignoreEscapes){d.scrollTop=r;return}i&&(u(!0),l(!1)),e&&u(!1),!d.escapedFromLock&&d.isNearBottom&&l(!0)},1)},[u,l,c,d]),h=(0,X.useCallback)(({target:e,deltaY:t})=>{let n=e;for(;![`scroll`,`auto`].includes(getComputedStyle(n).overflow);){if(!n.parentElement)return;n=n.parentElement}n===g.current&&t<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),l(!1))},[u,l,d]),g=ot(e=>{g.current?.removeEventListener(`scroll`,m),g.current?.removeEventListener(`wheel`,h),e?.addEventListener(`scroll`,m,{passive:!0}),e?.addEventListener(`wheel`,h,{passive:!0})},[]),_=ot(e=>{if(d.resizeObserver?.disconnect(),!e)return;let t;d.resizeObserver=new ResizeObserver(([e])=>{let{height:n}=e.contentRect,r=n-(t??n);if(d.resizeDifference=r,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),o(d.isNearBottom),r>=0){let e=ct(s.current,t?s.current.resize:s.current.initial);f({animation:e,wait:!0,preserveScrollPosition:!0,duration:e===`instant`?void 0:rt})}else d.isNearBottom&&(u(!1),l(!0));t=n,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===r&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(e)},[]);return{contentRef:_,scrollRef:g,scrollToBottom:f,stopScroll:p,isAtBottom:r||a,isNearBottom:a,escapedFromLock:t,state:d}};function ot(e,t){let n=(0,X.useCallback)(t=>(n.current=t,e(t)),t);return n}var st=new Map;function ct(...e){let t={...et},n=!1;for(let r of e){if(r===`instant`){n=!0;continue}typeof r==`object`&&(n=!1,t.damping=r.damping??t.damping,t.stiffness=r.stiffness??t.stiffness,t.mass=r.mass??t.mass)}let r=JSON.stringify(t);return st.has(r)||st.set(r,Object.freeze(t)),n?`instant`:st.get(r)}var lt=(0,X.createContext)(null),ut=typeof window<`u`?X.useLayoutEffect:X.useEffect;function dt({instance:e,children:t,resize:n,initial:r,mass:i,damping:a,stiffness:o,targetScrollTop:s,contextRef:c,...l}){let u=(0,X.useRef)(null),d=at({mass:i,damping:a,stiffness:o,resize:n,initial:r,targetScrollTop:X.useCallback((e,t)=>(y?.targetScrollTop??s)?.(e,t)??e,[s])}),{scrollRef:f,contentRef:p,scrollToBottom:m,stopScroll:h,isAtBottom:g,escapedFromLock:_,state:v}=e??d,y=(0,X.useMemo)(()=>({scrollToBottom:m,stopScroll:h,scrollRef:f,isAtBottom:g,escapedFromLock:_,contentRef:p,state:v,get targetScrollTop(){return u.current},set targetScrollTop(e){u.current=e}}),[m,g,p,f,h,_,v]);return(0,X.useImperativeHandle)(c,()=>y,[y]),ut(()=>{f.current&&getComputedStyle(f.current).overflow===`visible`&&(f.current.style.overflow=`auto`)},[]),X.createElement(lt.Provider,{value:y},X.createElement(`div`,{...l},typeof t==`function`?t(y):t))}(function(e){function t({children:e,scrollClassName:t,...n}){let r=ft();return X.createElement(`div`,{ref:r.scrollRef,style:{height:`100%`,width:`100%`,scrollbarGutter:`stable both-edges`},className:t},X.createElement(`div`,{...n,ref:r.contentRef},typeof e==`function`?e(r):e))}e.Content=t})(dt||={});function ft(){let e=(0,X.useContext)(lt);if(!e)throw Error(`use-stick-to-bottom component context must be used within a StickToBottom component`);return e}var Q=r();function pt(e){let t=e.type===`approval_request`;return{toolName:e.type===`tool_use`?e.tool:t?e.tool??`Tool`:`Tool`,input:e.type===`tool_use`?e.input:t?e.input??{}:{}}}function mt({tool:e,result:t,completed:n,projectName:r}){let[i,o]=(0,X.useState)(!1);if(e.type===`error`)return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded bg-red-500/10 border border-red-500/20 px-2 py-1.5 text-xs text-red-400`,children:[(0,Q.jsx)(J,{className:`size-3`}),(0,Q.jsx)(`span`,{children:e.message})]});let{toolName:s,input:c}=pt(e),l=t?.type===`tool_result`,u=l&&!!t.isError,d=s===`AskUserQuestion`&&!!c?.answers,f=(s===`Agent`||s===`Task`)&&e.type===`tool_use`,p=f?e.children:void 0,m=p&&p.length>0;return(0,Q.jsxs)(`div`,{className:`rounded border text-xs ${f?`border-accent/30 bg-accent/5`:`border-border bg-background`}`,children:[(0,Q.jsxs)(`button`,{onClick:()=>o(!i),className:`flex items-center gap-2 px-2 py-1.5 w-full text-left hover:bg-surface transition-colors min-w-0`,children:[i?(0,Q.jsx)(U,{className:`size-3 shrink-0`}):(0,Q.jsx)(a,{className:`size-3 shrink-0`}),u?(0,Q.jsx)(we,{className:`size-3 text-red-400 shrink-0`}):l||d||n?(0,Q.jsx)(ue,{className:`size-3 text-green-400 shrink-0`}):(0,Q.jsx)(L,{className:`size-3 text-yellow-400 shrink-0 animate-spin`}),(0,Q.jsx)(`span`,{className:`truncate text-text-primary`,children:(0,Q.jsx)(ht,{name:s,input:c})}),m&&(0,Q.jsxs)(`span`,{className:`ml-auto text-[10px] text-text-subtle shrink-0`,children:[p.length,` steps`]})]}),i&&(0,Q.jsxs)(`div`,{className:`px-2 pb-2 space-y-1.5`,children:[(e.type===`tool_use`||e.type===`approval_request`)&&(0,Q.jsx)(gt,{name:s,input:c,projectName:r}),m&&(0,Q.jsx)(bt,{events:p,projectName:r}),l&&(0,Q.jsx)(vt,{toolName:s,output:t.output})]})]})}function ht({name:e,input:t}){let n=e=>String(e??``);switch(e){case`Read`:case`Write`:case`Edit`:case`MultiEdit`:case`NotebookEdit`:return(0,Q.jsxs)(Q.Fragment,{children:[e,` `,(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:g(n(t.file_path))})]});case`Bash`:return(0,Q.jsxs)(Q.Fragment,{children:[e,` `,(0,Q.jsx)(`span`,{className:`font-mono text-text-subtle`,children:$(n(t.command),60)})]});case`Glob`:return(0,Q.jsxs)(Q.Fragment,{children:[e,` `,(0,Q.jsx)(`span`,{className:`font-mono text-text-subtle`,children:n(t.pattern)})]});case`Grep`:return(0,Q.jsxs)(Q.Fragment,{children:[e,` `,(0,Q.jsx)(`span`,{className:`font-mono text-text-subtle`,children:$(n(t.pattern),40)})]});case`WebSearch`:return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(B,{className:`size-3 inline`}),` `,e,` `,(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:$(n(t.query),50)})]});case`WebFetch`:return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{className:`size-3 inline`}),` `,e,` `,(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:$(n(t.url),50)})]});case`ToolSearch`:return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(B,{className:`size-3 inline`}),` `,e,` `,(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:$(n(t.query),50)})]});case`Agent`:case`Task`:return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xe,{className:`size-3 inline`}),` `,e,` `,(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:$(n(t.description||t.prompt),60)})]});case`TodoWrite`:{let n=Array.isArray(t.todos)?t.todos:[],r=n.filter(e=>e.status===`completed`).length;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ae,{className:`size-3 inline`}),` `,e,` `,(0,Q.jsxs)(`span`,{className:`text-text-subtle`,children:[r,`/`,n.length,` done`]})]})}case`AskUserQuestion`:{let n=Array.isArray(t.questions)?t.questions:[],r=!!t.answers;return(0,Q.jsxs)(Q.Fragment,{children:[e,` `,(0,Q.jsxs)(`span`,{className:`text-text-subtle`,children:[n.length,` question`,n.length===1?``:`s`,r?` ✓`:``]})]})}default:return(0,Q.jsx)(Q.Fragment,{children:e})}}function gt({name:e,input:t,projectName:n}){let r=e=>String(e??``),{openTab:i}=d(),a=e=>{n&&i({type:`editor`,title:g(e),metadata:{filePath:e,projectName:n},projectId:n,closable:!0})},o=(e,t,r)=>{i({type:`git-diff`,title:`Diff ${g(e)}`,metadata:{filePath:e,projectName:n,original:t,modified:r},projectId:n??null,closable:!0})};switch(e){case`Bash`:return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[!!t.description&&(0,Q.jsx)(`p`,{className:`text-text-subtle italic`,children:r(t.description)}),(0,Q.jsx)(`pre`,{className:`font-mono text-text-secondary overflow-x-auto whitespace-pre-wrap break-all`,children:r(t.command)})]});case`Read`:case`Write`:case`Edit`:case`MultiEdit`:case`NotebookEdit`:{let n=r(t.file_path);return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`font-mono text-text-secondary break-all hover:text-primary hover:underline text-left flex items-center gap-1`,onClick:()=>a(n),title:`Open file in editor`,children:[(0,Q.jsx)(u,{className:`size-3 shrink-0`}),n]}),e===`Edit`&&(!!t.old_string||!!t.new_string)&&(0,Q.jsxs)(`button`,{type:`button`,className:`text-text-subtle hover:text-primary hover:underline text-left flex items-center gap-1`,onClick:()=>o(n,r(t.old_string),r(t.new_string)),title:`View diff in new tab`,children:[(0,Q.jsx)(c,{className:`size-3 shrink-0`}),`View Diff`]}),e===`Write`&&!!t.content&&(0,Q.jsx)(`pre`,{className:`font-mono text-text-subtle overflow-x-auto max-h-32 whitespace-pre-wrap`,children:$(r(t.content),300)})]})}case`Glob`:return(0,Q.jsxs)(`p`,{className:`font-mono text-text-secondary`,children:[r(t.pattern),t.path?` in ${r(t.path)}`:``]});case`Grep`:return(0,Q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Q.jsxs)(`p`,{className:`font-mono text-text-secondary`,children:[`/`,r(t.pattern),`/`]}),!!t.path&&(0,Q.jsxs)(`p`,{className:`text-text-subtle`,children:[`in `,r(t.path)]})]});case`TodoWrite`:return(0,Q.jsx)(_t,{todos:t.todos??[]});case`Agent`:case`Task`:return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[!!t.description&&(0,Q.jsx)(`p`,{className:`text-text-secondary font-medium`,children:r(t.description)}),!!t.subagent_type&&(0,Q.jsxs)(`p`,{className:`text-text-subtle`,children:[`Type: `,r(t.subagent_type)]}),!!t.prompt&&(0,Q.jsx)(xt,{content:r(t.prompt),maxHeight:`max-h-48`})]});case`ToolSearch`:return(0,Q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Q.jsx)(`p`,{className:`font-mono text-text-secondary`,children:r(t.query)}),!!t.max_results&&(0,Q.jsxs)(`p`,{className:`text-text-subtle`,children:[`Max results: `,r(t.max_results)]})]});case`WebFetch`:return(0,Q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Q.jsxs)(`a`,{href:r(t.url),target:`_blank`,rel:`noopener noreferrer`,className:`font-mono text-primary hover:underline break-all flex items-center gap-1`,children:[(0,Q.jsx)(k,{className:`size-3 shrink-0`}),r(t.url)]}),!!t.prompt&&(0,Q.jsx)(`p`,{className:`text-text-subtle`,children:$(r(t.prompt),100)})]});case`AskUserQuestion`:{let e=t.questions??[],n=t.answers??{};return(0,Q.jsx)(`div`,{className:`space-y-2`,children:e.map((e,t)=>(0,Q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Q.jsxs)(`p`,{className:`text-text-primary font-medium`,children:[e.header?`${e.header}: `:``,e.question]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.options.map((t,r)=>(0,Q.jsx)(`span`,{className:`inline-block rounded px-1.5 py-0.5 text-xs border ${(n[e.question]??``).split(`, `).includes(t.label)?`border-accent bg-accent/20 text-text-primary`:`border-border text-text-subtle`}`,children:t.label},r))}),n[e.question]&&(0,Q.jsxs)(`p`,{className:`text-foreground text-xs`,children:[`Answer: `,n[e.question]]})]},t))})}default:return(0,Q.jsx)(`pre`,{className:`overflow-x-auto text-text-secondary font-mono whitespace-pre-wrap break-all`,children:JSON.stringify(t,null,2)})}}function _t({todos:e}){return(0,Q.jsx)(`div`,{className:`space-y-0.5`,children:e.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 mt-0.5 ${e.status===`completed`?`text-green-400`:e.status===`in_progress`?`text-yellow-400`:`text-text-subtle`}`,children:e.status===`completed`?`✓`:e.status===`in_progress`?`▶`:`○`}),(0,Q.jsx)(`span`,{className:e.status===`completed`?`line-through text-text-subtle`:`text-text-secondary`,children:e.content})]},t))})}function vt({toolName:e,output:t}){let[n,r]=(0,X.useState)(!1),i=(0,X.useMemo)(()=>{if(e!==`Agent`&&e!==`Task`)return null;try{let e=JSON.parse(t);if(Array.isArray(e)){let t=e.filter(e=>e.type===`text`&&e.text).map(e=>e.text).join(`
|
|
3
|
-
|
|
4
|
-
`);if(t)return t}if(typeof e==`string`)return e}catch{if(t&&!t.startsWith(`[{`))return t}return null},[e,t]);return i?(0,Q.jsxs)(`div`,{className:`border-t border-border pt-1.5 space-y-1`,children:[(0,Q.jsx)(xt,{content:i,maxHeight:`max-h-60`}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>r(!n),className:`flex items-center gap-1 text-[10px] text-text-subtle hover:text-text-secondary transition-colors`,children:[(0,Q.jsx)(o,{className:`size-3`}),n?`Hide`:`Show`,` raw`]}),n&&(0,Q.jsx)(`pre`,{className:`overflow-x-auto text-text-subtle font-mono max-h-40 whitespace-pre-wrap break-all text-[10px]`,children:t})]}):(0,Q.jsx)(yt,{output:t})}function yt({output:e}){let t=e.split(`
|
|
5
|
-
`).length,n=t>3||e.length>200,[r,i]=(0,X.useState)(n);return(0,Q.jsxs)(`div`,{className:`border-t border-border pt-1.5`,children:[n&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>i(!r),className:`flex items-center gap-1 text-[10px] text-text-subtle hover:text-text-secondary transition-colors mb-1`,children:[r?(0,Q.jsx)(a,{className:`size-3`}):(0,Q.jsx)(U,{className:`size-3`}),`Output (`,t,` lines)`]}),(0,Q.jsx)(`pre`,{className:`overflow-x-auto text-text-subtle font-mono whitespace-pre-wrap break-all ${r?`max-h-16 overflow-hidden`:`max-h-60`}`,children:e})]})}function bt({events:e,projectName:t}){let n=[],r=``;for(let t of e)if(t.type===`text`)r+=t.content;else if(t.type===`tool_use`)r&&=(n.push({kind:`text`,content:r}),``),n.push({kind:`tool`,tool:t});else if(t.type===`tool_result`){let e=t.toolUseId,r=e?n.find(t=>t.kind===`tool`&&t.tool.type===`tool_use`&&t.tool.toolUseId===e&&!t.result):n.findLast(e=>e.kind===`tool`&&!e.result);r&&(r.result=t)}return r&&n.push({kind:`text`,content:r}),(0,Q.jsx)(`div`,{className:`border-l-2 border-accent/20 pl-2 space-y-1 mt-1`,children:n.map((e,n)=>e.kind===`text`?(0,Q.jsx)(`div`,{className:`text-text-secondary text-[11px]`,children:(0,Q.jsx)(xt,{content:e.content,maxHeight:`max-h-24`})},`st-${n}`):(0,Q.jsx)(mt,{tool:e.tool,result:e.result,completed:!!e.result,projectName:t},`sc-${n}`))})}function xt({content:e,maxHeight:t=`max-h-48`}){return(0,Q.jsx)(s,{content:e,className:`text-text-secondary overflow-auto ${t}`})}function $(e,t=50){return e?e.length>t?e.slice(0,t)+`…`:e:``}function St(e){let[t,n]=(0,X.useState)({}),[r,i]=(0,X.useState)({}),[a,o]=(0,X.useState)(0),s=(0,X.useCallback)((e,t)=>{n(n=>({...n,[e]:[t]})),i(t=>({...t,[e]:``}))},[]),c=(0,X.useCallback)((e,t)=>{n(n=>{let r=n[e]||[];return{...n,[e]:r.includes(t)?r.filter(e=>e!==t):[...r,t]}})},[]),l=(0,X.useCallback)((e,t)=>{i(n=>({...n,[e]:t})),t&&n(t=>({...t,[e]:[]}))},[]),u=(0,X.useCallback)(e=>(t[e]?.length??0)>0||(r[e]?.trim().length??0)>0,[t,r]);return{answers:t,customInputs:r,activeTab:a,setActiveTab:o,handleSingleSelect:s,handleMultiSelect:c,handleCustomInput:l,hasAnswer:u,allAnswered:(0,X.useMemo)(()=>e.every((e,t)=>u(t)),[e,u]),getFinalAnswer:(0,X.useCallback)(e=>r[e]?.trim()||(t[e]??[]).join(`, `),[t,r]),goToNextTab:(0,X.useCallback)(()=>o(t=>Math.min(t+1,e.length-1)),[e.length]),goToPrevTab:(0,X.useCallback)(()=>o(e=>Math.max(e-1,0)),[])}}function Ct(e){let[t,n]=(0,X.useState)(0),r=(0,X.useRef)(null);return(0,X.useEffect)(()=>n(0),[e.activeTab]),(0,X.useEffect)(()=>{if(!e.enabled)return;let i=r=>{let i=document.activeElement===e.customInputRef.current;if(!i&&r.key>=`1`&&r.key<=`9`){r.preventDefault();let t=parseInt(r.key)-1;t<e.totalOptions-1&&(n(t),e.onSelectOption(t));return}if(!i&&(r.key===`o`||r.key===`O`||r.key===`0`)){r.preventDefault(),e.customInputRef.current?.focus(),n(e.totalOptions-1);return}if(r.key===`Tab`&&e.questions.length>1){r.preventDefault(),r.shiftKey?e.goToPrevTab():e.goToNextTab();return}if(!i){if(r.key===`ArrowLeft`){r.preventDefault(),e.goToPrevTab();return}if(r.key===`ArrowRight`){r.preventDefault(),e.goToNextTab();return}if(r.key===`ArrowUp`){r.preventDefault(),n(e=>Math.max(0,e-1));return}if(r.key===`ArrowDown`){r.preventDefault(),n(t=>Math.min(e.totalOptions-1,t+1));return}if(r.key===` `){r.preventDefault(),e.onSelectOption(t);return}}if(r.key===`Enter`){r.preventDefault(),e.allAnswered?e.onSubmit():e.hasAnswer(e.activeTab)&&e.goToNextTab();return}r.key===`Escape`&&i&&e.customInputRef.current?.blur()},a=r.current;return a&&(a.addEventListener(`keydown`,i),a.setAttribute(`tabindex`,`0`),a.contains(document.activeElement)||a.focus()),()=>{a?.removeEventListener(`keydown`,i)}},[e,t]),{focusedOption:t,setFocusedOption:n,containerRef:r}}function wt({questions:e,onSubmit:t,onSkip:n}){let r=(0,X.useRef)(null),i=St(e),a=e[i.activeTab],o=a?a.options.length+1:0,s=e.length>1,c=(0,X.useCallback)(()=>{if(!i.allAnswered)return;let n={};e.forEach((e,t)=>{n[e.question]=i.getFinalAnswer(t)}),t(n)},[i.allAnswered,i.getFinalAnswer,e,t]),l=(0,X.useCallback)(e=>{if(!(!a||e<0))if(e<a.options.length){let t=a.options[e]?.label;if(!t)return;a.multiSelect?i.handleMultiSelect(i.activeTab,t):i.handleSingleSelect(i.activeTab,t)}else e===a.options.length&&r.current?.focus()},[a,i]),u=Ct({questions:e,activeTab:i.activeTab,totalOptions:o,allAnswered:i.allAnswered,hasAnswer:i.hasAnswer,onSelectOption:l,goToNextTab:i.goToNextTab,goToPrevTab:i.goToPrevTab,onSubmit:c,customInputRef:r,enabled:!0}),d=(0,X.useCallback)(e=>{l(e),u.setFocusedOption(e)},[l,u.setFocusedOption]);return(0,Q.jsxs)(`div`,{ref:u.containerRef,className:`rounded-lg border-2 border-primary/30 bg-primary/5 p-3 space-y-3 outline-none animate-in slide-in-from-bottom-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-sm font-medium text-text-primary`,children:[(0,Q.jsxs)(`span`,{children:[`AI has `,s?`${e.length} questions`:`a question`]}),(0,Q.jsxs)(`span`,{className:`text-[10px] text-text-secondary font-normal`,children:[s?`←→ tabs · `:``,`↑↓ options · 1-`,Math.min(o-1,9),` select · Enter submit`]})]}),s&&(0,Q.jsx)(`div`,{className:`flex gap-1 p-1 bg-background rounded-md overflow-x-auto border border-border`,children:e.map((e,t)=>(0,Q.jsxs)(`button`,{className:`flex items-center gap-1.5 px-3 py-1.5 rounded text-xs whitespace-nowrap transition-all ${i.activeTab===t?`bg-primary text-primary-foreground`:i.hasAnswer(t)?`text-primary bg-transparent`:`text-text-secondary hover:bg-surface-elevated`}`,onClick:()=>{i.setActiveTab(t),u.setFocusedOption(0)},tabIndex:-1,children:[(0,Q.jsx)(`span`,{className:`flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-semibold ${i.activeTab===t?`bg-white/20`:i.hasAnswer(t)?`bg-primary/20 text-primary`:`bg-surface-elevated text-text-secondary`}`,children:i.hasAnswer(t)?`✓`:t+1}),(0,Q.jsx)(`span`,{className:`max-w-[100px] overflow-hidden text-ellipsis`,children:e.header||`Q${t+1}`})]},t))}),a&&(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[!s&&a.header&&(0,Q.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-text-secondary`,children:a.header}),(0,Q.jsx)(`div`,{className:`text-sm text-text-primary`,children:a.question}),a.multiSelect&&(0,Q.jsx)(`div`,{className:`text-[11px] text-text-secondary`,children:`Select multiple`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[a.options.map((e,t)=>{let n=(i.answers[i.activeTab]||[]).includes(e.label),r=u.focusedOption===t;return(0,Q.jsxs)(`button`,{onClick:()=>d(t),className:`text-left flex items-start gap-2.5 rounded px-2.5 py-2 text-xs border transition-all ${n?`border-primary bg-primary/10 text-text-primary`:`border-border bg-background text-text-secondary hover:border-primary/40 hover:bg-primary/5`} ${r?`ring-2 ring-primary/40 ring-offset-1 ring-offset-background`:``}`,children:[(0,Q.jsx)(`span`,{className:`flex items-center justify-center w-4.5 h-4.5 rounded text-[10px] font-semibold shrink-0 mt-px ${n?`bg-primary/20 text-primary`:`bg-surface-elevated text-text-secondary`}`,children:t+1}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-0.5 flex-1`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-text-primary`,children:e.label}),e.description&&(0,Q.jsx)(`span`,{className:`text-[11px] text-text-secondary`,children:e.description})]})]},t)}),(0,Q.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded px-2.5 py-2 text-xs border border-dashed transition-all border-border bg-transparent ${u.focusedOption===o-1?`ring-2 ring-primary/40 ring-offset-1 ring-offset-background`:``}`,children:[(0,Q.jsx)(`span`,{className:`flex items-center justify-center w-4.5 h-4.5 rounded bg-surface-elevated text-text-secondary text-[10px] font-semibold shrink-0 mt-px`,children:`O`}),(0,Q.jsx)(`input`,{ref:r,type:`text`,className:`flex-1 px-2 py-1 text-xs bg-surface border border-border rounded text-text-primary outline-none placeholder:text-text-subtle focus:border-primary`,placeholder:`Other (press O to type)...`,value:i.customInputs[i.activeTab]||``,onChange:e=>i.handleCustomInput(i.activeTab,e.target.value),onFocus:()=>u.setFocusedOption(o-1)})]})]})]}),(0,Q.jsxs)(`div`,{className:`flex gap-2 justify-end pt-1`,children:[s&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`button`,{className:`px-3 py-1.5 text-xs rounded border border-border bg-background text-text-primary hover:bg-surface-elevated disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,onClick:i.goToPrevTab,disabled:i.activeTab===0,tabIndex:-1,children:`← Prev`}),(0,Q.jsx)(`button`,{className:`px-3 py-1.5 text-xs rounded border border-border bg-background text-text-primary hover:bg-surface-elevated disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,onClick:i.goToNextTab,disabled:i.activeTab===e.length-1,tabIndex:-1,children:`Next →`})]}),(0,Q.jsx)(`button`,{onClick:n,className:`px-4 py-1.5 rounded border border-border bg-background text-text-secondary text-xs hover:bg-surface-elevated transition-colors`,tabIndex:-1,children:`Skip`}),(0,Q.jsxs)(`button`,{onClick:c,disabled:!i.allAnswered,className:`px-4 py-1.5 rounded bg-primary text-primary-foreground text-xs font-medium hover:bg-primary/80 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,tabIndex:-1,children:[`Submit `,i.allAnswered?`✓`:`(${e.filter((e,t)=>i.hasAnswer(t)).length}/${e.length})`]})]})]})}function Tt({messages:e,messagesLoading:t,pendingApproval:n,onApprovalResponse:r,isStreaming:i,phase:a,connectingElapsed:o,projectName:s,onFork:c}){if(t)return(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,Q.jsx)(xe,{className:`size-10 text-text-subtle animate-pulse`}),(0,Q.jsx)(`p`,{className:`text-sm`,children:`Loading messages...`})]});if(e.length===0&&!i)return(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,Q.jsx)(xe,{className:`size-10 text-text-subtle`}),(0,Q.jsx)(`p`,{className:`text-sm`,children:`Send a message to start the conversation`})]});let l=(0,X.useMemo)(()=>e.filter(e=>{let t=e.content&&e.content.trim().length>0,n=e.events&&e.events.length>0;return e.role===`user`?t:t||n}),[e]);return(0,Q.jsx)(`div`,{className:`relative flex-1 overflow-hidden flex flex-col min-h-0`,children:(0,Q.jsxs)(dt,{className:`flex-1 overflow-y-auto overflow-x-hidden`,resize:`smooth`,initial:`instant`,children:[(0,Q.jsxs)(dt.Content,{className:`p-4 space-y-4`,children:[l.map(e=>(0,Q.jsx)(Dt,{message:e,isStreaming:i&&e.id.startsWith(`streaming-`),projectName:s,onFork:e.role===`user`&&c?()=>c(e.content):void 0},e.id)),n&&(n.tool===`AskUserQuestion`?(0,Q.jsx)(Xt,{approval:n,onRespond:r}):(0,Q.jsx)(Yt,{approval:n,onRespond:r})),i&&(0,Q.jsx)(qt,{lastMessage:e[e.length-1],phase:a,elapsed:o})]}),(0,Q.jsx)(Et,{})]})})}function Et(){let{isAtBottom:e,scrollToBottom:t}=ft();return e?null:(0,Q.jsxs)(`button`,{onClick:()=>t(),className:`absolute bottom-4 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-3 py-1 rounded-full bg-surface-elevated border border-border text-xs text-text-secondary hover:text-foreground shadow-lg transition-all`,children:[(0,Q.jsx)(U,{className:`size-3`}),`Scroll to bottom`]})}function Dt({message:e,isStreaming:t,projectName:n,onFork:r}){return e.role===`user`?(0,Q.jsx)(Ft,{content:e.content,projectName:n,onFork:r}):e.role===`system`?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-red-500/10 border border-red-500/20 px-3 py-2 text-sm text-red-400`,children:[(0,Q.jsx)(J,{className:`size-4 shrink-0`}),(0,Q.jsx)(`p`,{children:e.content})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.events&&e.events.length>0?(0,Q.jsx)(Wt,{events:e.events,isStreaming:t,projectName:n}):e.content&&(0,Q.jsx)(`div`,{className:`text-sm text-text-primary`,children:(0,Q.jsx)(Jt,{content:e.content,projectName:n})}),e.accountLabel&&(0,Q.jsxs)(`p`,{className:`text-[10px] select-none`,style:{color:`var(--color-text-subtle)`},children:[`via `,e.accountLabel]})]})}var Ot=new Set([`.png`,`.jpg`,`.jpeg`,`.gif`,`.webp`]),kt={"system-reminder":`Context`,claudeMd:`CLAUDE.md`,gitStatus:`Git Status`,currentDate:`Date`,fast_mode_info:`Fast Mode`,"available-deferred-tools":`Tools`,"task-notification":`Task Result`,environment_details:`Environment`};function At(e){let t=[],n=/<(system-reminder|available-deferred-tools|antml:[\w-]+|fast_mode_info|claudeMd|gitStatus|currentDate|task-notification|environment_details)[^>]*>([\s\S]*?)<\/\1>/g,r;for(;(r=n.exec(e))!==null;){let e=r[1];t.push({name:e,label:kt[e]??e.replace(/^antml:/,``).replace(/-/g,` `),content:r[2].trim()})}return{cleanText:e.replace(n,``).trim(),tags:t}}function jt(e){let t=e.match(/^\[Attached file: (.+?)\]\n\n?/);if(t)return{files:[t[1]],text:e.slice(t[0].length)};let n=e.match(/^\[Attached files:\n([\s\S]+?)\]\n\n?/);return n?{files:n[1].split(`
|
|
6
|
-
`).map(e=>e.trim()).filter(Boolean),text:e.slice(n[0].length)}:{files:[],text:e}}function Mt(e,t){let n=g(e);return`/api/project/${encodeURIComponent(t??`_`)}/chat/uploads/${encodeURIComponent(n)}`}function Nt(e){let t=e.lastIndexOf(`.`);return t===-1?!1:Ot.has(e.slice(t).toLowerCase())}var Pt=new Set([`task-notification`,`environment_details`]);function Ft({content:e,projectName:t,onFork:n}){let{files:r,text:i,tags:a}=(0,X.useMemo)(()=>{let t=jt(e),{cleanText:n,tags:r}=At(t.text);return{files:t.files,text:n,tags:r}},[e]),o=a.some(e=>Pt.has(e.name)),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(!1),d=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=d.current;if(!e)return;let t=()=>u(e.scrollHeight>e.clientHeight+2);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[i]),(0,Q.jsxs)(`div`,{className:m(`group/user relative rounded-lg px-3 py-2 text-sm border shadow-sm`,o?`bg-surface/40 border-border/40 text-text-secondary`:`bg-primary/10 border-primary/15 text-text-primary`),children:[a.length>0&&(0,Q.jsx)(It,{tags:a}),r.length>0&&(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.map((e,n)=>Nt(e)?(0,Q.jsx)(Ut,{filePath:e,projectName:t},n):(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border/60 bg-background/40 px-1.5 py-0.5 text-[11px] text-text-secondary`,children:[(0,Q.jsx)(ae,{className:`size-3 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate max-w-32`,children:g(e)})]},n))}),i&&(0,Q.jsx)(`div`,{ref:d,className:m(`whitespace-pre-wrap break-words transition-all duration-200`,!s&&`line-clamp-2`,s&&`max-h-[50vh] overflow-y-auto`),children:o?(0,Q.jsx)(Vt,{text:i,projectName:t}):i}),(l||s)&&(0,Q.jsx)(`button`,{onClick:()=>c(!s),className:m(`flex items-center gap-1 text-xs mt-1 transition-colors`,o?`text-text-subtle hover:text-text-secondary`:`text-primary/70 hover:text-primary`),children:s?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ie,{className:`size-3`}),`Show less`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{className:`size-3`}),`Show more`]})}),!o&&n&&(0,Q.jsx)(`button`,{onClick:n,title:`Retry from this message (fork session)`,className:`absolute top-1.5 right-1.5 opacity-0 group-hover/user:opacity-100 transition-opacity size-5 flex items-center justify-center rounded text-text-subtle hover:text-text-primary`,children:(0,Q.jsx)(M,{className:`size-3`})})]})}function It({tags:e}){return(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map((e,t)=>(0,Q.jsx)(Lt,{tag:e},t))})}function Lt({tag:e}){let[t,n]=(0,X.useState)(!1);return e.name===`task-notification`?(0,Q.jsx)(zt,{content:e.content}):(0,Q.jsxs)(`div`,{className:`text-xs`,children:[(0,Q.jsxs)(`button`,{onClick:()=>n(!t),className:`flex items-center gap-1 rounded-full border border-border/60 bg-surface/50 px-2 py-0.5 text-text-subtle hover:text-text-secondary hover:bg-surface transition-colors`,children:[(0,Q.jsx)(f,{className:`size-2.5`}),(0,Q.jsx)(`span`,{children:e.label}),(0,Q.jsx)(a,{className:m(`size-2.5 transition-transform`,t&&`rotate-90`)})]}),t&&(0,Q.jsx)(`div`,{className:`mt-1 rounded border border-border/40 bg-surface/30 px-2 py-1.5 text-[11px] text-text-subtle/80 whitespace-pre-wrap max-h-40 overflow-y-auto leading-relaxed`,children:e.content})]})}function Rt(e,t){return e.match(RegExp(`<${t}>([\\s\\S]*?)</${t}>`))?.[1]?.trim()||void 0}function zt({content:e}){let[t,n]=(0,X.useState)(!1),r=Rt(e,`status`),i=Rt(e,`summary`),o=Rt(e,`output-file`),s=Rt(e,`result`);return(0,Q.jsxs)(`div`,{className:`text-xs`,children:[(0,Q.jsxs)(`button`,{onClick:()=>n(!t),className:`flex items-center gap-1.5 rounded-full border border-border/60 bg-surface/50 px-2 py-0.5 text-text-subtle hover:text-text-secondary hover:bg-surface transition-colors`,children:[r===`completed`?(0,Q.jsx)(ue,{className:`size-2.5 text-green-500`}):(0,Q.jsx)(we,{className:`size-2.5 text-yellow-500`}),(0,Q.jsx)(`span`,{className:`truncate max-w-80`,children:i??`Task notification`}),(0,Q.jsx)(a,{className:m(`size-2.5 transition-transform shrink-0`,t&&`rotate-90`)})]}),t&&(0,Q.jsxs)(`div`,{className:`mt-1 rounded border border-border/40 bg-surface/30 px-2 py-1.5 space-y-1.5`,children:[i&&(0,Q.jsx)(`p`,{className:`text-[11px] text-text-secondary`,children:i}),o&&(0,Q.jsx)(Bt,{path:o}),s&&(0,Q.jsx)(`div`,{className:`text-[11px] text-text-subtle/80 max-h-60 overflow-y-auto leading-relaxed`,children:(0,Q.jsx)(Jt,{content:s})})]})]})}function Bt({path:e,projectName:t}){return(0,Q.jsxs)(`button`,{type:`button`,onClick:(0,X.useCallback)(()=>{let n=d.getState().openTab,r=t??I.getState().activeProject?.name,i=g(e),a={filePath:e};r&&(a.projectName=r),y.get(`/api/fs/read?path=${encodeURIComponent(e)}`).then(()=>{n({type:`editor`,title:i,metadata:a,projectId:null,closable:!0})}).catch(()=>{n({type:`editor`,title:i,metadata:a,projectId:null,closable:!0})})},[e,t]),className:`inline-flex items-center gap-1 rounded border border-border/50 bg-surface/50 px-1.5 py-0.5 font-mono text-[10px] text-text-secondary hover:text-text-primary hover:bg-surface transition-colors cursor-pointer`,children:[(0,Q.jsx)(ae,{className:`size-2.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate max-w-60`,children:g(e)}),(0,Q.jsx)(u,{className:`size-2 shrink-0 opacity-50`})]})}function Vt({text:e,projectName:t}){return(0,Q.jsx)(Q.Fragment,{children:(0,X.useMemo)(()=>{let t=/(\/(?:[\w.\-]+\/)+[\w.\-]+)/g,n=[],r=0,i;for(;(i=t.exec(e))!==null;)i.index>r&&n.push({kind:`text`,value:e.slice(r,i.index)}),n.push({kind:`path`,value:i[1]}),r=i.index+i[0].length;return r<e.length&&n.push({kind:`text`,value:e.slice(r)}),n},[e]).map((e,n)=>e.kind===`path`?(0,Q.jsx)(Bt,{path:e.value,projectName:t},n):(0,Q.jsx)(`span`,{children:e.value},n))})}function Ht(e){let[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{let t=!1,r,a=v();return fetch(e,{headers:a?{Authorization:`Bearer ${a}`}:{}}).then(e=>{if(!e.ok)throw Error(`Failed`);return e.blob()}).then(e=>{t||(r=URL.createObjectURL(e),n(r))}).catch(()=>{t||i(!0)}),()=>{t=!0,r&&URL.revokeObjectURL(r)}},[e]),{blobUrl:t,error:r}}function Ut({filePath:e,projectName:t}){let{blobUrl:n,error:r}=Ht(Mt(e,t)),i=se(e=>e.open),a=g(e);return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n&&i(n,a),className:`flex items-center gap-1 rounded-md border border-border/60 bg-background/40 px-1.5 py-0.5 text-[11px] text-text-secondary hover:bg-surface transition-colors cursor-pointer`,children:[n?(0,Q.jsx)(`img`,{src:n,alt:a,className:`size-4 rounded-sm object-cover shrink-0`}):r?(0,Q.jsx)(Oe,{className:`size-3 shrink-0`}):(0,Q.jsx)(`div`,{className:`size-4 rounded-sm bg-surface animate-pulse shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate max-w-32`,children:a})]})}function Wt({events:e,isStreaming:t,projectName:n}){let r=[],i=``,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n.type===`thinking`){i&&=(r.push({kind:`text`,content:i}),``),a+=n.content;continue}a&&=(r.push({kind:`thinking`,content:a}),``),n.type===`text`?i+=n.content:n.type===`tool_use`?(i&&=(r.push({kind:`text`,content:i}),``),r.push({kind:`tool`,tool:n})):n.type===`tool_result`||(i&&=(r.push({kind:`text`,content:i}),``),r.push({kind:`tool`,tool:n}))}a&&r.push({kind:`thinking`,content:a}),i&&r.push({kind:`text`,content:i});let o=e.filter(e=>e.type===`tool_result`);for(let e of o){let t=e.toolUseId;if(t){let n=r.find(e=>e.kind===`tool`&&e.tool.type===`tool_use`&&e.tool.toolUseId===t);if(n){n.result=e;continue}}let n=r.find(e=>e.kind===`tool`&&!e.result);n&&(n.result=e)}for(let e=0;e<r.length;e++){let n=r[e];if(n.kind===`tool`&&!n.result){let i=!1;if(n.tool.type===`tool_use`&&n.tool.tool===`Read`){let t=n.tool.input?.file_path;t&&(i=r.slice(e+1).some(e=>e.kind===`tool`&&e.result&&e.tool.type===`tool_use`&&e.tool.tool===`Edit`&&e.tool.input?.file_path===t))}n.completed=i||!t}}return(0,Q.jsx)(Q.Fragment,{children:r.map((e,i)=>{if(e.kind===`thinking`)return(0,Q.jsx)(Gt,{content:e.content,isStreaming:t&&i===r.length-1},`think-${i}`);if(e.kind===`text`){let a=t&&i===r.length-1;return(0,Q.jsx)(`div`,{className:`text-sm text-text-primary`,children:(0,Q.jsx)(Kt,{content:e.content,animate:a,projectName:n})},`text-${i}`)}return(0,Q.jsx)(mt,{tool:e.tool,result:e.result,completed:e.completed,projectName:n},`tool-${i}`)})})}function Gt({content:e,isStreaming:t}){let[n,r]=(0,X.useState)(t);return(0,X.useEffect)(()=>{!t&&e.length>0&&r(!1)},[t,e.length]),(0,Q.jsxs)(`div`,{className:`rounded border border-border/50 bg-surface/30 text-xs`,children:[(0,Q.jsxs)(`button`,{onClick:()=>r(!n),className:`flex items-center gap-2 px-2 py-1.5 w-full text-left hover:bg-surface transition-colors text-text-subtle`,children:[t?(0,Q.jsx)(L,{className:`size-3 animate-spin`}):(0,Q.jsx)(a,{className:`size-3 transition-transform ${n?`rotate-90`:``}`}),(0,Q.jsxs)(`span`,{children:[`Thinking`,t?`...`:``]}),!t&&(0,Q.jsx)(`span`,{className:`text-text-subtle/50 ml-auto`,children:e.length>100?`${Math.round(e.length/4)} tokens`:``})]}),n&&(0,Q.jsx)(`div`,{className:`px-2 pb-2 text-text-subtle/80 whitespace-pre-wrap max-h-60 overflow-y-auto text-[11px] leading-relaxed`,children:e})]})}function Kt({content:e,animate:t,projectName:n}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Jt,{content:e,projectName:n}),t&&(0,Q.jsx)(`span`,{className:`text-text-subtle text-sm animate-pulse`,children:`Thinking...`})]})}function qt({lastMessage:e,phase:t,elapsed:n}){let r=!e||e.role!==`assistant`,i=e?.events?.length?e.events[e.events.length-1].type===`tool_result`:!1;return!r&&!i?null:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-text-subtle`,children:[(0,Q.jsx)(L,{className:`size-3 animate-spin`}),(0,Q.jsxs)(`span`,{children:[t===`initializing`?`Initializing`:t===`connecting`?`Connecting`:t===`thinking`?`Thinking`:`Processing`,r&&(n??0)>0&&(0,Q.jsxs)(`span`,{className:`text-text-subtle/60`,children:[`... (`,n,`s)`]})]})]}),t===`connecting`&&(n??0)>=30&&(0,Q.jsx)(`p`,{className:`text-xs text-yellow-500/80 ml-5`,children:`Taking longer than usual — may be rate-limited or API slow. Try sending a new message to retry.`})]})}function Jt({content:e,projectName:t}){return(0,Q.jsx)(s,{content:e,projectName:t,codeActions:!0})}function Yt({approval:e,onRespond:t}){return(0,Q.jsxs)(`div`,{className:`rounded-lg border-2 border-yellow-500/40 bg-yellow-500/10 p-3 space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-yellow-400 text-sm font-medium`,children:[(0,Q.jsx)(Pe,{className:`size-4`}),(0,Q.jsx)(`span`,{children:`Tool Approval Required`})]}),(0,Q.jsx)(`div`,{className:`text-xs text-text-primary`,children:(0,Q.jsx)(`span`,{className:`font-medium`,children:e.tool})}),(0,Q.jsx)(`pre`,{className:`text-xs font-mono text-text-secondary overflow-x-auto bg-background rounded p-2 border border-border`,children:JSON.stringify(e.input,null,2)}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`button`,{onClick:()=>t(e.requestId,!0),className:`px-4 py-1.5 rounded bg-green-600 text-white text-xs font-medium hover:bg-green-500 transition-colors`,children:`Allow`}),(0,Q.jsx)(`button`,{onClick:()=>t(e.requestId,!1),className:`px-4 py-1.5 rounded bg-red-600 text-white text-xs font-medium hover:bg-red-500 transition-colors`,children:`Deny`})]})]})}function Xt({approval:e,onRespond:t}){return(0,Q.jsx)(wt,{questions:e.input.questions??[],onSubmit:n=>t(e.requestId,!0,n),onSkip:()=>t(e.requestId,!1)})}function Zt(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition??null}function Qt(e){let[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(``),a=(0,X.useRef)(null),o=(0,X.useRef)(``),s=typeof window<`u`&&Zt()!==null;return{isListening:t,interimText:r,start:(0,X.useCallback)(t=>{let r=Zt();if(!r)return;a.current?.abort();let s=new r;s.lang=e?.lang??`vi-VN`,s.continuous=!0,s.interimResults=!0,o.current=``,s.onresult=e=>{let n=``,r=``;for(let t=0;t<e.results.length;t++){let i=e.results[t];i.isFinal?r+=i[0].transcript:n+=i[0].transcript}r&&(o.current=r);let a=(o.current+` `+n).trim();i(n),t(a,n.length===0&&o.current.length>0)},s.onend=()=>{n(!1),i(``),o.current&&t(o.current.trim(),!0)},s.onerror=e=>{e.error!==`no-speech`&&e.error!==`aborted`&&console.warn(`[voice-input] error:`,e.error),n(!1),i(``)},a.current=s,s.start(),n(!0)},[e?.lang]),stop:(0,X.useCallback)(()=>{a.current?.stop(),a.current=null,n(!1),i(``)},[]),supported:s}}var $t=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),en=new Set([`application/pdf`]),tn=[`text/`,`application/json`,`application/xml`,`application/javascript`,`application/typescript`,`application/x-yaml`,`application/toml`,`application/x-sh`],nn=new Set(`.ts,.tsx,.js,.jsx,.mjs,.cjs,.py,.rb,.go,.rs,.java,.kt,.swift,.c,.cpp,.h,.hpp,.cs,.json,.yaml,.yml,.toml,.xml,.md,.mdx,.txt,.csv,.tsv,.html,.css,.scss,.less,.sass,.sh,.bash,.zsh,.fish,.sql,.graphql,.gql,.env,.ini,.cfg,.conf,.dockerfile,.makefile,.vue,.svelte,.astro,.ipynb`.split(`,`));function rn(e){return $t.has(e.type)}function an(e){if($t.has(e.type)||en.has(e.type)||tn.some(t=>e.type.startsWith(t)))return!0;let t=on(e.name);return!!(t&&nn.has(t))}function on(e){let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t).toLowerCase()}function sn({attachments:e,onRemove:t}){return e.length===0?null:(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1.5 px-2 md:px-4 pt-2`,children:e.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border border-border bg-surface px-2 py-1 text-xs text-text-secondary max-w-48`,children:[e.previewUrl?(0,Q.jsx)(`img`,{src:e.previewUrl,alt:e.name,className:`size-5 rounded object-cover shrink-0`}):e.isImage?(0,Q.jsx)(Oe,{className:`size-3.5 shrink-0 text-text-subtle`}):(0,Q.jsx)(ae,{className:`size-3.5 shrink-0 text-text-subtle`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),e.status===`uploading`?(0,Q.jsx)(L,{className:`size-3 shrink-0 animate-spin text-text-subtle`}):e.status===`error`?(0,Q.jsx)(`span`,{className:`text-red-500 shrink-0`,title:`Upload failed`,children:`!`}):null,(0,Q.jsx)(`button`,{type:`button`,onClick:()=>t(e.id),className:`shrink-0 rounded-sm p-0.5 hover:bg-border/50 transition-colors`,"aria-label":`Remove ${e.name}`,children:(0,Q.jsx)(Se,{className:`size-3`})})]},e.id))})}var cn=[{id:`default`,label:`Ask before edits`,icon:Ee,description:`Claude will ask for approval before making each edit`},{id:`acceptEdits`,label:`Edit automatically`,icon:o,description:`Claude will edit files without asking first`},{id:`plan`,label:`Plan mode`,icon:Te,description:`Claude will present a plan before editing`},{id:`bypassPermissions`,label:`Bypass permissions`,icon:Fe,description:`Claude will not ask before running commands`}];function ln(e){return cn.find(t=>t.id===e)?.label??`Unknown`}function un(e){return cn.find(t=>t.id===e)?.icon??Ee}function dn({value:e,onChange:t,open:n,onOpenChange:r}){let i=(0,X.useRef)(null),a=(0,X.useRef)(0);(0,X.useEffect)(()=>{if(!n)return;let e=e=>{i.current&&!i.current.contains(e.target)&&r(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n,r]),(0,X.useEffect)(()=>{n&&(a.current=cn.findIndex(t=>t.id===e),a.current<0&&(a.current=0))},[n,e]);let o=(0,X.useCallback)(e=>{if(e.key===`Escape`){r(!1);return}if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;a.current=(a.current+t+cn.length)%cn.length,(i.current?.querySelector(`[data-idx="${a.current}"]`))?.focus()}if(e.key===`Enter`){e.preventDefault();let n=cn[a.current];n&&(t(n.id),r(!1))}},[t,r]);return n?(0,Q.jsxs)(`div`,{ref:i,role:`listbox`,"aria-label":`Permission modes`,onKeyDown:o,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:`absolute bottom-full left-0 mb-1 z-50 w-72 md:w-80 rounded-lg border border-border bg-surface shadow-lg`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-text-secondary`,children:`Modes`}),(0,Q.jsx)(`kbd`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-surface-elevated text-text-subtle border border-border`,children:`Shift + Tab`})]}),(0,Q.jsx)(`div`,{className:`py-1`,children:cn.map((n,i)=>{let a=n.icon,o=n.id===e;return(0,Q.jsxs)(`button`,{"data-idx":i,role:`option`,"aria-selected":o,tabIndex:0,onClick:()=>{t(n.id),r(!1)},className:`w-full flex items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-surface-elevated focus:bg-surface-elevated focus:outline-none ${o?`bg-surface-elevated`:``}`,children:[(0,Q.jsx)(a,{className:`size-4 mt-0.5 shrink-0 text-text-secondary`}),(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-text-primary`,children:n.label}),(0,Q.jsx)(`div`,{className:`text-xs text-text-subtle leading-snug`,children:n.description})]}),o&&(0,Q.jsx)(ve,{className:`size-4 mt-0.5 shrink-0 text-primary`})]},n.id)})})]}):null}function fn(e){let t=[];function n(e){for(let r of e)t.push(r),r.children&&n(r.children)}return n(e),t}function pn({items:e,filter:t,onSelect:n,onClose:r,visible:i}){let[a,o]=(0,X.useState)(0),s=(0,X.useRef)(null),c=(()=>{if(!t)return e.slice(0,50);let n=t.toLowerCase();return e.filter(e=>e.path.toLowerCase().includes(n)||e.name.toLowerCase().includes(n)).slice(0,50)})();(0,X.useEffect)(()=>{o(0)},[t]),(0,X.useEffect)(()=>{let e=s.current;e&&e.children[a]?.scrollIntoView({block:`nearest`})},[a]);let l=(0,X.useCallback)(e=>{if(!i||c.length===0)return!1;switch(e.key){case`ArrowUp`:return e.preventDefault(),o(e=>e>0?e-1:c.length-1),!0;case`ArrowDown`:return e.preventDefault(),o(e=>e<c.length-1?e+1:0),!0;case`Enter`:case`Tab`:return e.preventDefault(),c[a]&&n(c[a]),!0;case`Escape`:return e.preventDefault(),r(),!0}return!1},[i,c,a,n,r]);return(0,X.useEffect)(()=>{if(!i)return;let e=e=>{l(e)&&e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[i,l]),!i||c.length===0?null:(0,Q.jsx)(`div`,{className:`max-h-52 overflow-y-auto border-b border-border bg-surface`,children:(0,Q.jsx)(`div`,{ref:s,className:`py-1`,children:c.map((e,t)=>(0,Q.jsxs)(`button`,{className:`flex items-center gap-2 w-full px-3 py-1.5 text-left transition-colors ${t===a?`bg-primary/10 text-primary`:`hover:bg-surface-hover text-text-primary`}`,onMouseEnter:()=>o(t),onClick:()=>n(e),children:[(0,Q.jsx)(`span`,{className:`shrink-0`,children:e.type===`directory`?(0,Q.jsx)(he,{className:`size-4 text-amber-500`}):(0,Q.jsx)(ce,{className:`size-4 text-blue-400`})}),(0,Q.jsx)(`span`,{className:`text-sm truncate`,children:e.path})]},e.path))})})}var mn=(0,X.memo)(function({onSend:e,isStreaming:t,onCancel:n,disabled:r,projectName:a,onSlashStateChange:o,onSlashItemsLoaded:s,slashSelected:c,onFileStateChange:l,onFileItemsLoaded:u,fileSelected:d,externalFiles:f,initialValue:p,autoFocus:m,permissionMode:g,onModeChange:b,providerId:x,onProviderChange:S}){let[C,w]=(0,X.useState)(p??``),[T,E]=(0,X.useState)([]),[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(!1),[j,M]=(0,X.useState)(`next`),N=(0,X.useRef)(null),P=(0,X.useRef)(null),F=(0,X.useRef)(null),I=(0,X.useRef)([]),R=(0,X.useRef)([]),z=Qt(),B=(0,X.useRef)(``),V=(0,X.useCallback)(e=>{let t=B.current;w(t?t+` `+e:e),requestAnimationFrame(()=>{let e=window.matchMedia(`(min-width: 768px)`).matches?N.current:P.current;e&&(e.style.height=`auto`,e.style.height=Math.min(e.scrollHeight,160)+`px`)})},[]),H=(0,X.useCallback)(()=>{z.isListening?z.stop():(B.current=C.trim(),z.start(V))},[z.isListening,z.start,z.stop,C,V]);(0,X.useEffect)(()=>{let e=()=>{z.supported&&H()};return window.addEventListener(`toggle-voice-input`,e),()=>window.removeEventListener(`toggle-voice-input`,e)},[z.supported,H]),(0,X.useEffect)(()=>{p&&(w(p),setTimeout(()=>{let e=N.current;e&&(e.focus(),e.selectionStart=e.selectionEnd=e.value.length)},50))},[p]),(0,X.useEffect)(()=>{m&&setTimeout(()=>{(window.matchMedia(`(min-width: 768px)`).matches?N.current:P.current)?.focus()},100)},[]),(0,X.useEffect)(()=>{if(!a){I.current=[],s?.([]);return}y.get(`${_(a)}/chat/slash-items`).then(e=>{I.current=e,s?.(e)}).catch(()=>{I.current=[],s?.([])})},[a]),(0,X.useEffect)(()=>{if(!a){R.current=[],u?.([]);return}y.get(`${_(a)}/files/tree?depth=5`).then(e=>{let t=fn(e);R.current=t,u?.(t)}).catch(()=>{R.current=[],u?.([])})},[a]),(0,X.useEffect)(()=>{if(!c)return;let e=N.current,t=e?.selectionStart??C.length,n=C.slice(0,t),r=C.slice(t),i=n.replace(/(?:^|\s)\/\S*$/,e=>`${e.startsWith(`/`)?``:e[0]}/${c.name} `);w(i+r),o?.(!1,``),l?.(!1,``),e&&(e.focus(),setTimeout(()=>{e.selectionStart=e.selectionEnd=i.length},0))},[c]),(0,X.useEffect)(()=>{if(!d)return;let e=N.current;if(!e)return;let t=e.selectionStart,n=C.slice(0,t),r=C.slice(t),i=n.match(/@(\S*)$/);if(i){let t=n.length-i[0].length;w(n.slice(0,t)+`@${d.path} `+r);let a=t+d.path.length+2;setTimeout(()=>{e.selectionStart=e.selectionEnd=a,e.focus()},0)}else{let t=C+`@${d.path} `;w(t),setTimeout(()=>{e.selectionStart=e.selectionEnd=t.length,e.focus()},0)}l?.(!1,``)},[d]),(0,X.useEffect)(()=>{!f||f.length===0||W(f)},[f]);let U=(0,X.useCallback)(async e=>{if(!a)return null;try{let t=new FormData;t.append(`files`,e);let n={},r=v();r&&(n.Authorization=`Bearer ${r}`);let i=await(await fetch(`${_(a)}/chat/upload`,{method:`POST`,headers:n,body:t})).json();return i.ok&&Array.isArray(i.data)&&i.data.length>0?i.data[0].path:null}catch{return null}},[a]),W=(0,X.useCallback)(e=>{for(let t of e){if(!an(t)){w(e=>e+(e.length>0&&!e.endsWith(` `)?` `:``)+t.name);continue}let e=h(),n=rn(t),r=n?URL.createObjectURL(t):void 0,i={id:e,name:t.name,file:t,isImage:n,previewUrl:r,status:`uploading`};E(e=>[...e,i]),U(t).then(t=>{E(n=>n.map(n=>n.id===e?{...n,serverPath:t??void 0,status:t?`ready`:`error`}:n))})}(P.current??N.current)?.focus()},[U]),te=(0,X.useCallback)(e=>{E(t=>{let n=t.find(t=>t.id===e);return n?.previewUrl&&URL.revokeObjectURL(n.previewUrl),t.filter(t=>t.id!==e)})},[]),G=(0,X.useCallback)(()=>{let n=C.trim(),r=T.filter(e=>e.status===`ready`);if(!n&&r.length===0){A(!1);return}o?.(!1,``),l?.(!1,``),z.isListening&&z.stop(),e(n,r,t?j:void 0),w(``);for(let e of T)e.previewUrl&&URL.revokeObjectURL(e.previewUrl);E([]),A(!1),M(`next`),N.current&&(N.current.style.height=`auto`),P.current&&(P.current.style.height=`auto`)},[C,T,e,o,l,t,j]),K=(0,X.useCallback)(()=>{if(!r){if(T.some(e=>e.status===`uploading`)){(C.trim()||T.some(e=>e.status!==`error`))&&A(!0);return}G()}},[C,T,r,G]);(0,X.useEffect)(()=>{k&&(T.some(e=>e.status===`uploading`)||G())},[k,T,G]);let re=(0,X.useCallback)(e=>{if(e.key===`Enter`&&!e.shiftKey){e.preventDefault(),K();return}if(e.shiftKey&&e.key===`Tab`){e.preventDefault();let t=[`default`,`acceptEdits`,`plan`,`bypassPermissions`],n=t[(t.indexOf(g??`bypassPermissions`)+1)%t.length];b?.(n)}},[K,g,b]),ie=(0,X.useCallback)((e,t)=>{let n=e.slice(0,t),r=n.match(/(?:^|\s)\/(\S*)$/);if(r&&I.current.length>0){o?.(!0,r[1]??``),l?.(!1,``);return}let i=n.match(/@(\S*)$/);if(i&&R.current.length>0){l?.(!0,i[1]??``),o?.(!1,``);return}o?.(!1,``),l?.(!1,``)},[o,l]),ae=(0,X.useCallback)((e,t)=>{w(e),ie(e,t)},[ie]),oe=(0,X.useCallback)(e=>{let t=e?.target??N.current;t&&(t.style.height=`auto`,t.style.height=Math.min(t.scrollHeight,160)+`px`)},[]),q=(0,X.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e of t)if(e.kind===`file`){let t=e.getAsFile();t&&n.push(t)}n.length>0&&(e.preventDefault(),W(n))},[W]),J=(0,X.useCallback)(e=>{e.preventDefault();let t=Array.from(e.dataTransfer.files);t.length>0&&W(t)},[W]),se=(0,X.useCallback)(e=>{e.preventDefault()},[]),ce=(0,X.useCallback)(()=>{F.current?.click()},[]),le=(0,X.useCallback)(e=>{let t=Array.from(e.target.files??[]);t.length>0&&W(t),e.target.value=``},[W]),ue=C.trim().length>0||T.some(e=>e.status!==`error`),de=t&&!ue;return(0,Q.jsxs)(`div`,{className:`p-2 md:p-3 bg-background`,children:[(0,Q.jsxs)(`div`,{className:`border border-border rounded-xl md:rounded-2xl bg-surface shadow-sm cursor-text`,onClick:e=>{r||e.target instanceof HTMLTextAreaElement||(window.matchMedia(`(min-width: 768px)`).matches?N.current:P.current)?.focus()},children:[(0,Q.jsx)(sn,{attachments:T,onRemove:te}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-2 md:hidden relative`,children:[(0,Q.jsx)(hn,{mode:g??`bypassPermissions`,onClick:()=>O(e=>!e)}),(0,Q.jsx)(dn,{value:g??`bypassPermissions`,onChange:e=>b?.(e),open:D,onOpenChange:O}),S&&a&&(0,Q.jsx)(ne,{value:x??`claude`,onChange:S,projectName:a}),t&&(0,Q.jsx)(_n,{value:j,onChange:M})]}),(0,Q.jsxs)(`div`,{className:`flex items-end gap-1 md:hidden px-2 py-2`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ce()},disabled:r,className:`flex items-center justify-center size-7 shrink-0 rounded-full text-text-subtle hover:text-text-primary transition-colors disabled:opacity-50`,"aria-label":`Attach file`,children:(0,Q.jsx)(Me,{className:`size-4`})}),z.supported&&(0,Q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),H()},disabled:r,className:`flex items-center justify-center size-7 shrink-0 rounded-full transition-colors disabled:opacity-50 ${z.isListening?`bg-red-600 text-white animate-pulse`:`text-text-subtle hover:text-text-primary`}`,"aria-label":z.isListening?`Stop voice input`:`Start voice input`,children:z.isListening?(0,Q.jsx)(je,{className:`size-4`}):(0,Q.jsx)(ee,{className:`size-4`})}),(0,Q.jsx)(`textarea`,{ref:P,value:C,onChange:e=>{ae(e.target.value,e.target.selectionStart),oe(e)},onKeyDown:re,onPaste:q,onDrop:J,onDragOver:se,placeholder:t?`Follow-up...`:`Ask anything...`,disabled:r,rows:1,className:`flex-1 resize-none bg-transparent py-1.5 text-sm text-foreground placeholder:text-text-subtle focus:outline-none disabled:opacity-50 max-h-20`}),de?(0,Q.jsx)(`button`,{onClick:e=>{e.stopPropagation(),n?.()},className:`flex items-center justify-center size-7 shrink-0 rounded-full bg-red-600 text-white hover:bg-red-500 transition-colors`,"aria-label":`Stop`,children:(0,Q.jsx)(Le,{className:`size-3`})}):(0,Q.jsx)(`button`,{onClick:e=>{e.stopPropagation(),k?A(!1):K()},disabled:r||!ue,className:`flex items-center justify-center size-7 shrink-0 rounded-full bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-30 transition-colors`,"aria-label":k?`Cancel queued send`:`Send`,children:k?(0,Q.jsx)(L,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(i,{className:`size-3.5`})})]}),(0,Q.jsxs)(`div`,{className:`hidden md:block`,children:[(0,Q.jsx)(`textarea`,{ref:N,value:C,onChange:e=>{ae(e.target.value,e.target.selectionStart),oe(e)},onKeyDown:re,onPaste:q,onDrop:J,onDragOver:se,placeholder:t?`Follow-up or Stop...`:`Ask anything...`,disabled:r,rows:1,className:`w-full resize-none bg-transparent px-4 pt-3 pb-1 text-sm text-foreground placeholder:text-text-subtle focus:outline-none disabled:opacity-50 max-h-40`}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between px-3 pb-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ce()},disabled:r,className:`flex items-center justify-center size-8 rounded-full text-text-subtle hover:text-text-primary hover:bg-surface-elevated transition-colors disabled:opacity-50`,"aria-label":`Attach file`,children:(0,Q.jsx)(Me,{className:`size-4`})}),z.supported&&(0,Q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),H()},disabled:r,className:`flex items-center justify-center size-8 rounded-full transition-colors disabled:opacity-50 ${z.isListening?`bg-red-600 text-white animate-pulse`:`text-text-subtle hover:text-text-primary hover:bg-surface-elevated`}`,"aria-label":z.isListening?`Stop voice input`:`Start voice input`,children:z.isListening?(0,Q.jsx)(je,{className:`size-4`}):(0,Q.jsx)(ee,{className:`size-4`})}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(hn,{mode:g??`bypassPermissions`,onClick:()=>O(e=>!e)}),(0,Q.jsx)(dn,{value:g??`bypassPermissions`,onChange:e=>b?.(e),open:D,onOpenChange:O})]}),S&&a&&(0,Q.jsx)(ne,{value:x??`claude`,onChange:S,projectName:a}),t&&(0,Q.jsx)(_n,{value:j,onChange:M})]}),(0,Q.jsx)(`div`,{className:`flex items-center gap-1`,children:de?(0,Q.jsx)(`button`,{onClick:e=>{e.stopPropagation(),n?.()},className:`flex items-center justify-center size-8 rounded-full bg-red-600 text-white hover:bg-red-500 transition-colors`,"aria-label":`Stop response`,children:(0,Q.jsx)(Le,{className:`size-3.5`})}):(0,Q.jsx)(`button`,{onClick:e=>{e.stopPropagation(),k?A(!1):K()},disabled:r||!ue,className:`flex items-center justify-center size-8 rounded-full bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":k?`Cancel queued send`:`Send message`,children:k?(0,Q.jsx)(L,{className:`size-4 animate-spin`}):(0,Q.jsx)(i,{className:`size-4`})})})]})]})]}),(0,Q.jsx)(`input`,{ref:F,type:`file`,multiple:!0,className:`hidden`,onChange:le})]})});function hn({mode:e,onClick:t}){let n=un(e),r=ln(e);return(0,Q.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),t()},className:`inline-flex items-center gap-1 px-2 py-1 rounded-md text-[11px] text-text-subtle hover:text-text-primary hover:bg-surface-elevated transition-colors border border-transparent hover:border-border`,"aria-label":`Permission mode: ${r}`,children:[(0,Q.jsx)(n,{className:`size-3`}),(0,Q.jsx)(`span`,{className:`max-w-[100px] truncate`,children:r})]})}var gn=[{value:`now`,label:`Interrupt`,Icon:Re},{value:`next`,label:`Queue`,Icon:ke},{value:`later`,label:`Later`,Icon:re}];function _n({value:e,onChange:t}){let n=(0,X.useCallback)(()=>{let n=[`next`,`later`,`now`];t(n[(n.indexOf(e)+1)%n.length])},[e,t]),r=gn.find(t=>t.value===e)??gn[1],i=r.Icon;return(0,Q.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),n()},className:`inline-flex items-center gap-1 px-2 py-1 rounded-md text-[11px] text-text-subtle hover:text-text-primary hover:bg-surface-elevated transition-colors border border-transparent hover:border-border`,"aria-label":`Message priority: ${r.label}`,title:`Priority: ${r.label} (click to cycle)`,children:[(0,Q.jsx)(i,{className:`size-3`}),(0,Q.jsx)(`span`,{children:r.label})]})}function vn({items:e,filter:t,onSelect:n,onClose:r,visible:i}){let[a,o]=(0,X.useState)(0),s=(0,X.useRef)(null),c=e.filter(e=>{let n=t.toLowerCase();return e.name.toLowerCase().includes(n)||e.description.toLowerCase().includes(n)});(0,X.useEffect)(()=>{o(0)},[t]),(0,X.useEffect)(()=>{let e=s.current;e&&e.children[a]?.scrollIntoView({block:`nearest`})},[a]);let l=(0,X.useCallback)(e=>{if(!i||c.length===0)return!1;switch(e.key){case`ArrowUp`:return e.preventDefault(),o(e=>e>0?e-1:c.length-1),!0;case`ArrowDown`:return e.preventDefault(),o(e=>e<c.length-1?e+1:0),!0;case`Enter`:case`Tab`:return e.preventDefault(),c[a]&&n(c[a]),!0;case`Escape`:return e.preventDefault(),r(),!0}return!1},[i,c,a,n,r]);return(0,X.useEffect)(()=>{if(!i)return;let e=e=>{l(e)&&e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[i,l]),!i||c.length===0?null:(0,Q.jsx)(`div`,{className:`max-h-52 overflow-y-auto border-b border-border bg-surface`,children:(0,Q.jsx)(`div`,{ref:s,className:`py-1`,children:c.map((e,t)=>(0,Q.jsxs)(`button`,{className:`flex items-start gap-3 w-full px-3 py-2 text-left transition-colors ${t===a?`bg-primary/10 text-primary`:`hover:bg-surface-hover text-text-primary`}`,onMouseEnter:()=>o(t),onClick:()=>n(e),children:[(0,Q.jsx)(`span`,{className:`shrink-0 mt-0.5`,children:e.type===`skill`?(0,Q.jsx)(Ie,{className:`size-4 text-amber-500`}):(0,Q.jsx)(N,{className:`size-4 text-blue-500`})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Q.jsxs)(`span`,{className:`font-medium text-sm`,children:[`/`,e.name]}),e.argumentHint&&(0,Q.jsx)(`span`,{className:`text-xs text-text-subtle`,children:e.argumentHint}),(0,Q.jsx)(`span`,{className:`text-xs text-text-subtle capitalize ml-auto`,children:e.scope===`user`?`global`:e.type})]}),e.description&&(0,Q.jsx)(`p`,{className:`text-xs text-text-subtle mt-0.5 line-clamp-2`,children:e.description})]})]},`${e.type}-${e.name}`))})})}var yn=`ppm-hienlh`;function bn({open:e,onOpenChange:t,onSuccess:n}){let[r,i]=(0,X.useState)(``),[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(`idle`);function y(){f(null),m(``),v(`idle`),u(null)}function b(){t(!1),y(),i(``),o(``),u(null)}async function S(){g(!0),u(null);try{let{url:e,state:t}=await x();f(t),v(`waiting`),window.open(e,`_blank`)}catch(e){u(e.message)}g(!1)}async function C(){if(!(!p.trim()||!d)){g(!0),u(null);try{let e=p.trim();e.includes(`#`)&&(e=e.split(`#`)[0]??e),await T(e,d),b(),n(`Account connected via OAuth!`)}catch(e){u(e.message)}g(!1)}}async function w(){if(r.trim()){c(!0),u(null);try{await D({apiKey:r.trim(),label:a.trim()||void 0}),b(),n(`Account added!`)}catch(e){u(e.message)}c(!1)}}let E=r.trim()?r.trim().startsWith(`sk-ant-oat`)?`OAuth token (Claude Max/Pro)`:r.trim().startsWith(`sk-ant-api`)?`API key`:`Unknown format`:``;return(0,Q.jsx)(_e,{open:e,onOpenChange:e=>{e||b()},children:(0,Q.jsxs)(be,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(z,{children:[(0,Q.jsx)(j,{className:`text-sm`,children:`Add Claude Account`}),(0,Q.jsx)(te,{className:`text-xs leading-relaxed`,children:`Connect via OAuth (recommended) or paste a token manually.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`rounded-md border p-3 space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] font-medium`,children:`Recommended: Login with Claude`}),_===`idle`?(0,Q.jsx)(Y,{size:`sm`,className:`w-full h-8 text-xs`,onClick:S,disabled:h,children:h?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(L,{className:`size-3 animate-spin mr-1`}),` Opening...`]}):`Login with Claude`}):(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Authorize in the opened tab, then paste the code:`}),(0,Q.jsx)(H,{placeholder:`Paste code here...`,value:p,onChange:e=>m(e.target.value),className:`text-xs h-8 font-mono`,autoFocus:!0}),(0,Q.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,Q.jsx)(Y,{size:`sm`,className:`flex-1 h-7 text-xs`,onClick:C,disabled:!p.trim()||h,children:h?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(L,{className:`size-3 animate-spin mr-1`}),` Connecting...`]}):`Connect`}),(0,Q.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-7 text-xs`,onClick:y,children:`Cancel`})]})]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:`flex-1 border-t`}),(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`or paste token`}),(0,Q.jsx)(`div`,{className:`flex-1 border-t`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(q,{htmlFor:`add-token`,className:`text-xs`,children:`Token`}),(0,Q.jsx)(H,{id:`add-token`,type:`password`,placeholder:`sk-ant-...`,value:r,onChange:e=>i(e.target.value),className:`text-xs h-8 font-mono`}),E&&(0,Q.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[`Detected: `,E]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(q,{htmlFor:`add-label`,className:`text-xs`,children:`Label (optional)`}),(0,Q.jsx)(H,{id:`add-label`,placeholder:`e.g. Personal, Work`,value:a,onChange:e=>o(e.target.value),className:`text-xs h-8`})]})]}),l&&(0,Q.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-red-500/10 text-red-600`,children:l}),(0,Q.jsxs)(ye,{children:[(0,Q.jsx)(Y,{size:`sm`,variant:`outline`,className:`text-xs h-7`,onClick:b,children:`Cancel`}),(0,Q.jsx)(Y,{size:`sm`,className:`text-xs h-7`,onClick:w,disabled:!r.trim()||s,children:s?`Adding...`:`Add Token`})]})]})})}function xn({open:e,onOpenChange:t,accounts:n,preselectId:r,onMessage:i}){let a=n.filter(e=>e.hasRefreshToken),[o,s]=(0,X.useState)(new Set),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(!1);e&&!g&&(s(r?new Set([r]):new Set(a.map(e=>e.id))),_(!0)),!e&&g&&_(!1);function y(){t(!1),l(``),d(!1),p(!1)}async function b(e){if(o.size===0)return;h(!0);let t=c.trim()||yn;try{let n={"Content-Type":`application/json`},r=v();r&&(n.Authorization=`Bearer ${r}`);let a=await fetch(`/api/accounts/export`,{method:`POST`,headers:n,body:JSON.stringify({password:t,accountIds:[...o],includeRefreshToken:u,refreshBeforeExport:f})});if(!a.ok){let e=await a.json();throw Error(e.error??`Export failed: ${a.status}`)}let s=await a.text();if(e)try{await navigator.clipboard.writeText(s),i?.(`Backup copied to clipboard!`)}catch{Cn(s),i?.(`Backup downloaded.`)}else Cn(s),i?.(`Backup downloaded.`);y()}catch{}h(!1)}let x=o.size>0&&!m;return(0,Q.jsx)(_e,{open:e,onOpenChange:e=>{e||y()},children:(0,Q.jsxs)(be,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(z,{children:[(0,Q.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,Q.jsx)(V,{className:`size-3.5`}),` Export Accounts`]}),(0,Q.jsx)(te,{className:`text-xs`,children:`Select accounts and set a password to protect the backup.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Accounts to export`}),(0,Q.jsx)(`button`,{className:`text-[10px] text-primary hover:underline cursor-pointer`,onClick:()=>s(o.size===a.length?new Set:new Set(a.map(e=>e.id))),children:o.size===a.length?`Deselect all`:`Select all`})]}),a.length===0?(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground p-2 border rounded`,children:`No exportable accounts.`}):(0,Q.jsx)(`div`,{className:`max-h-36 overflow-y-auto space-y-1 border rounded p-2`,children:a.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,id:`exp-${e.id}`,checked:o.has(e.id),onChange:t=>{let n=new Set(o);t.target.checked?n.add(e.id):n.delete(e.id),s(n)},className:`size-3.5 accent-primary cursor-pointer`}),(0,Q.jsx)(`label`,{htmlFor:`exp-${e.id}`,className:`text-xs cursor-pointer truncate`,children:e.label??e.email??e.id.slice(0,8)})]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(q,{className:`text-xs`,children:[`Password `,(0,Q.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,Q.jsx)(H,{type:`password`,placeholder:`Leave empty for default`,value:c,onChange:e=>l(e.target.value),className:`text-xs h-8`,autoComplete:`new-password`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,id:`exp-full`,checked:u,onChange:e=>d(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,Q.jsx)(`label`,{htmlFor:`exp-full`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens (full transfer)`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,id:`exp-refresh`,checked:f,onChange:e=>p(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,Q.jsx)(`label`,{htmlFor:`exp-refresh`,className:`text-[11px] cursor-pointer`,children:`Refresh tokens before export`})]}),u?(0,Q.jsxs)(`div`,{className:`rounded-md border border-red-500/30 bg-red-500/5 p-2.5`,children:[(0,Q.jsx)(`p`,{className:`text-[10px] font-medium text-red-600`,children:`Full transfer — source accounts will expire`}),(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Refresh tokens included. Source machine expires in ~1h after target refreshes.`})]}):f?(0,Q.jsx)(`div`,{className:`rounded-md border border-amber-500/30 bg-amber-500/5 p-2.5`,children:(0,Q.jsx)(`p`,{className:`text-[10px] font-medium text-amber-600`,children:`Refresh before export — invalidates previous shares`})}):(0,Q.jsx)(`div`,{className:`rounded-md border border-green-500/30 bg-green-500/5 p-2.5`,children:(0,Q.jsx)(`p`,{className:`text-[10px] font-medium text-green-600`,children:`Share current token (safe)`})}),(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Encrypted with AES-256-GCM + scrypt.`})]}),(0,Q.jsxs)(ye,{className:`gap-1.5 flex-col sm:flex-row`,children:[(0,Q.jsx)(Y,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:y,children:`Cancel`}),(0,Q.jsxs)(Y,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,disabled:!x,onClick:()=>b(!0),children:[(0,Q.jsx)(ge,{className:`size-3 mr-1`}),` Copy`]}),(0,Q.jsx)(Y,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!x,onClick:()=>b(!1),children:m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(L,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{className:`size-3 mr-1`}),` Download`]})})]})]})})}function Sn({open:e,onOpenChange:t,onSuccess:n}){let[r,i]=(0,X.useState)(``),[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(null);function d(){t(!1),i(``),o(``),u(null)}async function f(){if(r.trim()){c(!0),u(null);try{let e=await O({data:r.trim(),password:a.trim()||yn});d(),n(`Imported ${e.imported} account(s)`)}catch(e){u(e.message||`Import failed`)}c(!1)}}return(0,Q.jsx)(_e,{open:e,onOpenChange:e=>{e||d()},children:(0,Q.jsxs)(be,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(z,{children:[(0,Q.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,Q.jsx)(V,{className:`size-3.5`}),` Import Accounts`]}),(0,Q.jsx)(te,{className:`text-xs`,children:`Paste backup data and enter the export password. Imported accounts are temporary (~1h).`})]}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(q,{className:`text-xs`,children:`Backup data`}),(0,Q.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),placeholder:`Paste backup JSON here...`,rows:4,className:`w-full text-xs p-2 rounded border border-border bg-background font-mono resize-none focus:outline-none focus:ring-1 focus:ring-primary`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(q,{className:`text-xs`,children:[`Password `,(0,Q.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,Q.jsx)(H,{type:`password`,placeholder:`Leave empty for default`,value:a,onChange:e=>o(e.target.value),className:`text-xs h-8`,autoComplete:`current-password`})]})]}),l&&(0,Q.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-red-500/10 text-red-600`,children:l}),(0,Q.jsxs)(ye,{children:[(0,Q.jsx)(Y,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:d,children:`Cancel`}),(0,Q.jsx)(Y,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!r.trim()||s,onClick:f,children:s?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(L,{className:`size-3 animate-spin mr-1`}),` Importing...`]}):`Import`})]})]})})}function Cn(e){let t=new Blob([e],{type:`application/json`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`ppm-accounts-backup.json`,n.click(),URL.revokeObjectURL(n.href)}function wn(e){return e>=90?`text-red-500`:e>=70?`text-amber-500`:`text-green-500`}function Tn(e){return e>=90?`bg-red-500`:e>=70?`bg-amber-500`:`bg-green-500`}function En(e){if(!e)return null;let t=null;if(e.resetsInMinutes!=null)t=e.resetsInMinutes;else if(e.resetsInHours!=null)t=Math.round(e.resetsInHours*60);else if(e.resetsAt){let n=new Date(e.resetsAt).getTime()-Date.now();t=n>0?Math.ceil(n/6e4):0}if(t==null)return null;if(t<=0)return`now`;let n=Math.floor(t/1440),r=Math.floor(t%1440/60),i=t%60;return n>0?i>0?`${n}d ${r}h ${i}m`:r>0?`${n}d ${r}h`:`${n}d`:r>0?i>0?`${r}h ${i}m`:`${r}h`:`${i}m`}function Dn({label:e,bucket:t}){if(!t)return null;let n=Math.round(t.utilization*100),r=En(t);return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-text-primary`,children:e}),r&&(0,Q.jsxs)(`span`,{className:`text-[10px] text-text-subtle`,title:`Resets in`,children:[`↻ `,r]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:`flex-1 h-2 rounded-full bg-border overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full transition-all ${Tn(n)}`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsxs)(`span`,{className:`text-xs font-medium tabular-nums w-10 text-right ${wn(n)}`,children:[n,`%`]})]})]})}function On(e){let t=e-Date.now();if(t<=0)return`expired`;let n=Math.ceil(t/6e4),r=Math.floor(n/60),i=Math.floor(r/24);return i>0?`${i}d ${r%24}h`:r>0?`${r}h ${n%60}m`:`${n}m`}function kn(e){if(!e)return{label:`unknown`,tip:`No account info available`,color:`text-text-subtle`};if(!e.expiresAt)return{label:`key`,tip:`API key (no expiry)`,color:`text-text-subtle`};let t=e.expiresAt*1e3<Date.now();return t&&e.hasRefreshToken?{label:`expired`,tip:`Token expired but has refresh token — will auto-renew`,color:`text-amber-500`}:t?{label:`expired`,tip:`Token expired, no refresh token`,color:`text-red-500`}:e.hasRefreshToken?{label:`long-lived`,tip:`OAuth token with refresh — long-lived`,color:`text-green-500`}:{label:`temp`,tip:`Temporary token without refresh — will expire`,color:`text-amber-500`}}function An(e){if(!e)return null;let t=Math.round((Date.now()-e)/1e3);if(t<5)return`just now`;if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60),i=n%60;return r<24?i>0?`${r}h ${i}m ago`:`${r}h ago`:`${Math.floor(r/24)}d ago`}function jn({entry:e,isActive:t,accountInfo:n,onToggle:r,onExport:i,onViewProfile:a,flash:o}){let{usage:s}=e,c=s.session||s.weekly||s.weeklyOpus||s.weeklySonnet,l=n?.status??e.accountStatus;return(0,Q.jsxs)(`div`,{className:`rounded-md border p-2 space-y-1.5 transition-colors duration-500 min-w-[200px] shrink-0 snap-start ${o?`bg-primary/10 border-primary/40`:``} ${t?`border-primary/30 bg-primary/5`:`border-border/50`}`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium truncate flex-1 min-w-0`,children:e.accountLabel??e.accountId.slice(0,8)}),!e.isOAuth&&(0,Q.jsx)(`span`,{className:`text-[9px] text-text-subtle shrink-0`,children:`API key`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[a&&n?.profileData&&(0,Q.jsx)(`button`,{className:`p-1 rounded cursor-pointer text-text-subtle hover:text-foreground hover:bg-surface-elevated transition-colors`,onClick:()=>a(n.profileData),title:`View profile`,children:(0,Q.jsx)(me,{className:`size-3`})}),i&&e.isOAuth&&(0,Q.jsx)(`button`,{className:`p-1 rounded cursor-pointer text-text-subtle hover:text-blue-500 hover:bg-surface-elevated transition-colors`,onClick:()=>i(e.accountId),title:`Export this account`,children:(0,Q.jsx)(K,{className:`size-3`})}),r&&(0,Q.jsx)(W,{checked:l!==`disabled`,onCheckedChange:()=>r(e.accountId,l),disabled:l===`cooldown`,className:`scale-[0.6] cursor-pointer`})]})]}),c?(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(Dn,{label:`5-Hour Session`,bucket:s.session}),(0,Q.jsx)(Dn,{label:`Weekly`,bucket:s.weekly}),(0,Q.jsx)(Dn,{label:`Weekly (Opus)`,bucket:s.weeklyOpus}),(0,Q.jsx)(Dn,{label:`Weekly (Sonnet)`,bucket:s.weeklySonnet})]}):(0,Q.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:e.isOAuth?`No usage data yet`:`Usage tracking not available for API keys`}),(()=>{let e=kn(n);return(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[9px] text-text-subtle flex-wrap`,children:[s.lastFetchedAt&&(0,Q.jsxs)(`span`,{title:`Last usage data update`,children:[`↻ `,An(new Date(s.lastFetchedAt).getTime())]}),n?.expiresAt&&n.expiresAt*1e3>Date.now()&&(0,Q.jsxs)(`span`,{title:`Token expires in`,children:[`⏱ `,On(n.expiresAt*1e3)]}),(0,Q.jsxs)(`span`,{className:e.color,title:e.tip,children:[`© `,e.label]})]})})()]})}function Mn({usage:e,visible:t,onClose:n,onReload:r,loading:i,lastFetchedAt:a}){let[o,s]=(0,X.useState)([]),[c,l]=(0,X.useState)([]),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(!0),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(new Set),[v,y]=(0,X.useState)(null),[x,C]=(0,X.useState)(!1),[T,D]=(0,X.useState)(!1),[O,k]=(0,X.useState)(!1),[j,M]=(0,X.useState)(null),[N,P]=(0,X.useState)(null),I=(0,X.useRef)(void 0),L=(0,X.useRef)([]);function R(e){I.current&&clearTimeout(I.current),P(e),I.current=setTimeout(()=>P(null),4e3)}function z(e){B(),e&&R(e)}async function B(){let e=o.length>0;e?h(!0):p(!0);let[t,n,r]=await Promise.allSettled([E(),b(),w()]);if(t.status===`fulfilled`){let n=t.value;if(e&&L.current.length>0){let e=new Set,t=new Map(L.current.map(e=>[e.accountId,e]));for(let r of n){let n=t.get(r.accountId);if(!n){e.add(r.accountId);continue}let i=n.usage,a=r.usage;(i.session?.utilization!==a.session?.utilization||i.weekly?.utilization!==a.weekly?.utilization||i.weeklyOpus?.utilization!==a.weeklyOpus?.utilization||i.weeklySonnet?.utilization!==a.weeklySonnet?.utilization)&&e.add(r.accountId)}e.size>0&&(_(e),setTimeout(()=>_(new Set),1500))}L.current=n,s(n)}n.status===`fulfilled`&&l(n.value),r.status===`fulfilled`&&d(r.value?.id??null),p(!1),h(!1)}if((0,X.useEffect)(()=>{t&&B()},[t]),(0,X.useEffect)(()=>{!t||!a||B()},[a]),!t)return null;let ee=new Map(c.map(e=>[e.id,e])),V=e.queryCostUsd!=null||e.totalCostUsd!=null,H=o.length>0;async function U(e,t){await S(e,{status:t===`disabled`?`active`:`disabled`}),B(),r?.()}function W(){M(null),D(!0)}return(0,Q.jsxs)(`div`,{className:`border-b border-border bg-surface px-3 py-2.5 space-y-2.5 max-h-[350px] overflow-y-auto`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-semibold text-text-primary`,children:`Usage & Accounts`}),a&&(0,Q.jsx)(`span`,{className:`text-[10px] text-text-subtle`,children:An(new Date(a).getTime())})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[r&&(0,Q.jsx)(`button`,{onClick:()=>{r(),B()},disabled:i||m,className:`text-xs text-text-subtle hover:text-text-primary px-1 disabled:opacity-50 cursor-pointer`,title:`Refresh`,children:(0,Q.jsx)(F,{className:`size-3 ${i||m?`animate-spin`:``}`})}),(0,Q.jsx)(`button`,{onClick:n,className:`text-xs text-text-subtle hover:text-text-primary px-1 cursor-pointer`,children:(0,Q.jsx)(Se,{className:`size-3`})})]})]}),N&&(0,Q.jsx)(`div`,{className:`text-[11px] p-1.5 rounded bg-green-500/10 text-green-600 text-center animate-in fade-in duration-200`,children:N}),H||f?(0,Q.jsx)(`div`,{className:`flex gap-1.5 overflow-x-auto pb-1 -mx-3 px-3 snap-x snap-mandatory scrollbar-thin`,children:f?(0,Q.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`Loading...`}):o.map(t=>(0,Q.jsx)(jn,{entry:t,isActive:t.accountId===(u??e.activeAccountId),accountInfo:ee.get(t.accountId),onToggle:U,onExport:e=>{M(e),D(!0)},onViewProfile:y,flash:g.has(t.accountId)},t.accountId))}):(0,Q.jsx)(Q.Fragment,{children:e.session||e.weekly||e.weeklyOpus||e.weeklySonnet?(0,Q.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,Q.jsx)(Dn,{label:`5-Hour Session`,bucket:e.session}),(0,Q.jsx)(Dn,{label:`Weekly`,bucket:e.weekly}),(0,Q.jsx)(Dn,{label:`Weekly (Opus)`,bucket:e.weeklyOpus}),(0,Q.jsx)(Dn,{label:`Weekly (Sonnet)`,bucket:e.weeklySonnet})]}):(0,Q.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`No usage data available`})}),V&&(0,Q.jsxs)(`div`,{className:`border-t border-border pt-2 space-y-1`,children:[e.queryCostUsd!=null&&(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:`Last query`}),(0,Q.jsxs)(`span`,{className:`text-text-primary font-medium tabular-nums`,children:[`$`,e.queryCostUsd.toFixed(4)]})]}),e.totalCostUsd!=null&&(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:`Session total`}),(0,Q.jsxs)(`span`,{className:`text-text-primary font-medium tabular-nums`,children:[`$`,e.totalCostUsd.toFixed(4)]})]})]}),v&&(0,Q.jsxs)(`div`,{className:`border-t border-border pt-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,Q.jsx)(`span`,{className:`text-[10px] font-medium text-text-subtle`,children:`Profile`}),(0,Q.jsx)(`button`,{className:`text-text-subtle hover:text-foreground cursor-pointer`,onClick:()=>y(null),children:(0,Q.jsx)(Se,{className:`size-3`})})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-[70px_1fr] gap-x-2 gap-y-0.5 text-[10px]`,children:[v.account?.display_name&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:`Name`}),(0,Q.jsx)(`span`,{children:v.account.display_name})]}),v.account?.email&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:`Email`}),(0,Q.jsx)(`span`,{children:v.account.email})]}),v.organization?.name&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:`Org`}),(0,Q.jsx)(`span`,{children:v.organization.name})]}),v.organization?.organization_type&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:`Type`}),(0,Q.jsx)(`span`,{children:v.organization.organization_type})]}),v.organization?.rate_limit_tier&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:`Tier`}),(0,Q.jsx)(`span`,{children:v.organization.rate_limit_tier})]}),v.organization?.subscription_status&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:`Status`}),(0,Q.jsx)(`span`,{children:v.organization.subscription_status})]})]})]}),(0,Q.jsxs)(`div`,{className:`border-t border-border pt-2 flex gap-1.5`,children:[(0,Q.jsxs)(`button`,{onClick:()=>C(!0),className:`flex-1 flex items-center justify-center gap-1 rounded-md border border-border px-2 py-1 text-[11px] text-text-secondary hover:bg-surface-hover transition-colors cursor-pointer`,children:[(0,Q.jsx)(de,{className:`size-3`}),` Add`]}),(0,Q.jsxs)(`button`,{onClick:W,className:`flex-1 flex items-center justify-center gap-1 rounded-md border border-border px-2 py-1 text-[11px] text-text-secondary hover:bg-surface-hover transition-colors cursor-pointer`,children:[(0,Q.jsx)(K,{className:`size-3`}),` Export`]}),(0,Q.jsxs)(`button`,{onClick:()=>k(!0),className:`flex-1 flex items-center justify-center gap-1 rounded-md border border-border px-2 py-1 text-[11px] text-text-secondary hover:bg-surface-hover transition-colors cursor-pointer`,children:[(0,Q.jsx)(A,{className:`size-3`}),` Import`]})]}),(0,Q.jsx)(bn,{open:x,onOpenChange:C,onSuccess:z}),(0,Q.jsx)(xn,{open:T,onOpenChange:e=>{D(e),e||M(null)},accounts:c,preselectId:j,onMessage:R}),(0,Q.jsx)(Sn,{open:O,onOpenChange:k,onSuccess:z})]})}function Nn(e){try{return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}catch{return``}}function Pn(e){return e>=90?`text-red-500`:e>=70?`text-amber-500`:`text-green-500`}function Fn({projectName:e,usageInfo:t,contextWindowPct:n,usageLoading:r,refreshUsage:i,lastFetchedAt:a,sessionId:o,providerId:s,onSelectSession:c,onBugReport:l,isConnected:u,onReconnect:f}){let[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)([]),[v,b]=(0,X.useState)(!1),x=oe(e=>o?e.notifications.has(o):!1),S=oe(e=>e.clearForSession),[C,w]=(0,X.useState)(``),[T,E]=(0,X.useState)(null),[D,O]=(0,X.useState)(``),k=(0,X.useRef)(null),A=d(e=>e.openTab),j=e=>{m(t=>t===e?null:e)},M=(0,X.useCallback)(async()=>{if(e){b(!0);try{g(await y.get(`${_(e)}/chat/sessions`))}catch{}finally{b(!1)}}},[e]);(0,X.useEffect)(()=>{p===`history`&&h.length===0&&M()},[p]);function N(t){c?(c(t),m(null)):A({type:`chat`,title:t.title||`Chat`,projectId:e??null,metadata:{projectName:e,sessionId:t.id,providerId:t.providerId},closable:!0})}let I=(0,X.useCallback)((e,t)=>{t.stopPropagation(),E(e.id),O(e.title||``),setTimeout(()=>k.current?.select(),0)},[]),R=(0,X.useCallback)(async()=>{if(!T||!D.trim()||!e){E(null);return}try{await y.patch(`${_(e)}/chat/sessions/${T}`,{title:D.trim()}),g(e=>e.map(e=>e.id===T?{...e,title:D.trim()}:e))}catch{}E(null)},[T,D,e]),z=(0,X.useCallback)(()=>E(null),[]),ee=C.trim()?h.filter(e=>(e.title||``).toLowerCase().includes(C.toLowerCase())):h,V=!s||s===`claude`,H=t.fiveHour==null?null:Math.round(t.fiveHour*100),U=t.sevenDay==null?null:Math.round(t.sevenDay*100),W=H!=null||U!=null?Pn(Math.max(H??0,U??0)):`text-text-subtle`;return(0,Q.jsxs)(`div`,{className:`border-b border-border/50`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1`,children:[(0,Q.jsxs)(`button`,{onClick:()=>j(`history`),className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] transition-colors ${p===`history`?`text-primary bg-primary/10`:`text-text-secondary hover:text-foreground hover:bg-surface-elevated`}`,children:[(0,Q.jsx)(De,{className:`size-3`}),(0,Q.jsx)(`span`,{children:`History`})]}),o&&s&&s!==`mock`&&(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 px-1.5 py-0.5 text-[11px] text-text-secondary`,children:[(0,Q.jsx)(pe,{providerId:s}),(0,Q.jsx)(`span`,{className:`capitalize`,children:s})]}),(0,Q.jsx)(`button`,{onClick:()=>j(`config`),className:`p-1 rounded transition-colors ${p===`config`?`text-primary bg-primary/10`:`text-text-subtle hover:text-text-secondary hover:bg-surface-elevated`}`,title:`AI Settings`,children:(0,Q.jsx)(Ne,{className:`size-3`})}),V?(0,Q.jsxs)(`button`,{onClick:()=>j(`usage`),className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] font-medium tabular-nums transition-colors hover:bg-surface-elevated ${p===`usage`?`bg-primary/10`:``} ${W}`,title:`Usage limits`,children:[(0,Q.jsx)(Ce,{className:`size-3`}),t.activeAccountLabel&&(0,Q.jsxs)(`span`,{className:`text-text-secondary font-normal truncate max-w-[60px]`,children:[`[`,t.activeAccountLabel,`]`]}),(0,Q.jsxs)(`span`,{children:[`5h:`,H==null?`--%`:`${H}%`]}),(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:`·`}),(0,Q.jsxs)(`span`,{children:[`Wk:`,U==null?`--%`:`${U}%`]}),n!=null&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:`·`}),(0,Q.jsxs)(`span`,{className:Pn(n),children:[`Ctx:`,n,`%`]})]})]}):n!=null&&(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 px-1.5 py-0.5 text-[11px] font-medium tabular-nums ${Pn(n)}`,children:[(0,Q.jsx)(Ce,{className:`size-3`}),(0,Q.jsxs)(`span`,{children:[`Ctx:`,n,`%`]})]}),(0,Q.jsx)(`div`,{className:`flex-1`}),x&&o&&(0,Q.jsx)(`button`,{onClick:()=>S(o),className:`p-1 rounded text-amber-500 hover:text-amber-400 hover:bg-surface-elevated transition-colors`,title:`Mark as read`,children:(0,Q.jsx)(G,{className:`size-3`})}),f&&(0,Q.jsx)(`button`,{onClick:f,className:`size-4 flex items-center justify-center`,title:u?`Connected`:`Disconnected — click to reconnect`,children:(0,Q.jsx)(`span`,{className:`size-2 rounded-full ${u?`bg-green-500`:`bg-red-500 animate-pulse`}`})})]}),p===`history`&&(0,Q.jsxs)(`div`,{className:`border-t border-border/30 bg-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1 border-b border-border/30`,children:[(0,Q.jsx)(B,{className:`size-3 text-text-subtle shrink-0`}),(0,Q.jsx)(`input`,{type:`text`,value:C,onChange:e=>w(e.target.value),placeholder:`Search sessions...`,className:`flex-1 bg-transparent text-[11px] text-text-primary outline-none placeholder:text-text-subtle`}),(0,Q.jsx)(`button`,{onClick:M,disabled:v,className:`p-0.5 rounded text-text-subtle hover:text-text-secondary transition-colors disabled:opacity-50`,title:`Refresh`,children:(0,Q.jsx)(F,{className:`size-3 ${v?`animate-spin`:``}`})})]}),(0,Q.jsx)(`div`,{className:`max-h-[200px] overflow-y-auto`,children:v&&h.length===0?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,Q.jsx)(L,{className:`size-3.5 animate-spin text-text-subtle`})}):ee.length===0?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-3 text-[11px] text-text-subtle`,children:C?`No matching sessions`:`No sessions yet`}):ee.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 w-full px-3 py-1.5 text-left hover:bg-surface-elevated transition-colors group`,children:[(0,Q.jsx)(pe,{providerId:e.providerId}),T===e.id?(0,Q.jsxs)(`form`,{className:`flex items-center gap-1 flex-1 min-w-0`,onSubmit:e=>{e.preventDefault(),R()},children:[(0,Q.jsx)(`input`,{ref:k,value:D,onChange:e=>O(e.target.value),onBlur:R,onKeyDown:e=>{e.key===`Escape`&&z()},className:`flex-1 min-w-0 bg-surface-elevated text-[11px] text-text-primary px-1 py-0.5 rounded border border-border outline-none focus:border-primary`,autoFocus:!0}),(0,Q.jsx)(`button`,{type:`submit`,className:`p-0.5 text-green-500 hover:text-green-400`,onClick:e=>e.stopPropagation(),children:(0,Q.jsx)(ve,{className:`size-3`})}),(0,Q.jsx)(`button`,{type:`button`,className:`p-0.5 text-text-subtle hover:text-text-secondary`,onClick:e=>{e.stopPropagation(),z()},children:(0,Q.jsx)(Se,{className:`size-3`})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`button`,{onClick:()=>N(e),className:`text-[11px] truncate flex-1 text-left`,children:e.title||`Untitled`}),(0,Q.jsx)(`button`,{onClick:t=>I(e,t),className:`p-0.5 rounded text-text-subtle hover:text-text-secondary opacity-0 group-hover:opacity-100 transition-opacity`,title:`Rename session`,children:(0,Q.jsx)(P,{className:`size-3`})})]}),T!==e.id&&e.updatedAt&&(0,Q.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:Nn(e.updatedAt)})]},e.id))})]}),p===`config`&&(0,Q.jsx)(`div`,{className:`border-t border-border/30 bg-surface px-3 py-2 max-h-[280px] overflow-y-auto`,children:(0,Q.jsx)(le,{compact:!0})}),p===`usage`&&V&&(0,Q.jsx)(Mn,{usage:t,visible:!0,onClose:()=>m(null),onReload:i,loading:r,lastFetchedAt:a})]})}function In({metadata:e,tabId:t}){let[n,r]=(0,X.useState)(e?.sessionId??null),[i,a]=(0,X.useState)(e?.providerId??`claude`),[o,s]=(0,X.useState)([]),[c,u]=(0,X.useState)(!1),[f,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(null),[v,b]=(0,X.useState)([]),[x,S]=(0,X.useState)(!1),[w,T]=(0,X.useState)(``),[E,D]=(0,X.useState)(null),[O,k]=(0,X.useState)(e?.permissionMode??void 0),[j,M]=(0,X.useState)(!1),[N,P]=(0,X.useState)(null),F=(0,X.useRef)(0),I=e?.projectName??``,z=d(e=>e.updateTab),B=R(e=>e.version),{usageInfo:ee,usageLoading:V,lastFetchedAt:H,refreshUsage:U}=$e(I,i);(0,X.useEffect)(()=>{O||C().then(e=>{let t=e.providers[e.default_provider??`claude`];k(t?.permission_mode??`bypassPermissions`)}).catch(()=>{})},[]),(0,X.useEffect)(()=>{!t||!n||z(t,{metadata:{...e,sessionId:n,providerId:i,permissionMode:O}})},[n,i,O]);let{messages:W,messagesLoading:te,isStreaming:G,phase:ne,isReconnecting:K,connectingElapsed:re,pendingApproval:ie,contextWindowPct:ae,sessionTitle:q,migratedSessionId:J,sendMessage:se,respondToApproval:ce,cancelStreaming:le,reconnect:ue,refetchMessages:de,isConnected:pe}=Ze(n,i,I);(0,X.useEffect)(()=>{J&&J!==n&&r(J)},[J]),(0,X.useEffect)(()=>{if(!n||!t)return;let e=()=>{if(document.hidden)return;let{panels:e,focusedPanelId:r}=l.getState();e[r]?.activeTabId===t&&oe.getState().clearForSession(n)};e(),document.addEventListener(`visibilitychange`,e);let r=l.subscribe(e);return()=>{document.removeEventListener(`visibilitychange`,e),r()}},[n,t]),(0,X.useEffect)(()=>{t&&q&&z(t,{title:q})},[q]);let me=(0,X.useRef)(e?.pendingMessage);(0,X.useEffect)(()=>{if(me.current&&pe&&n){let n=me.current;me.current=void 0,t&&z(t,{metadata:{...e,pendingMessage:void 0}}),setTimeout(()=>se(n,{permissionMode:O}),100)}},[pe,n]),(0,X.useCallback)(()=>{d.getState().openTab({type:`chat`,title:`AI Chat`,metadata:{projectName:I,providerId:i},projectId:I||null,closable:!0})},[I,i]);let he=(0,X.useCallback)(e=>{r(e.id),a(e.providerId),t&&z(t,{title:e.title||`Chat`})},[t,z]),ge=(0,X.useCallback)(async e=>{if(!(!n||!I))try{let{api:t,projectUrl:r}=await p(async()=>{let{api:e,projectUrl:t}=await import(`./api-client-BKIT_Qeg.js`).then(e=>e.n);return{api:e,projectUrl:t}},__vite__mapDeps([0,1])),a=await t.post(`${r(I)}/chat/sessions/${n}/fork?providerId=${i}`);d.getState().openTab({type:`chat`,title:`Fork: ${e.slice(0,30)}`,metadata:{projectName:I,sessionId:a.id,providerId:i,pendingMessage:e},projectId:I||null,closable:!0})}catch(e){console.error(`Fork failed:`,e)}},[n,I,i]),_e=(0,X.useCallback)((e,t)=>{if(t.length===0)return e;let n=t.filter(e=>e.serverPath).map(e=>e.serverPath).join(`
|
|
7
|
-
`);return n?(t.length===1?`[Attached file: ${n}]\n\n`:`[Attached files:\n${n}\n]\n\n`)+e:e},[]),ve=(0,X.useCallback)(async(e,t=[],o)=>{let s=_e(e,t);if(s.trim()){if(!n)try{let t=I,n=await y.post(`${_(t)}/chat/sessions`,{providerId:i,title:e.slice(0,50)});r(n.id),a(n.providerId),setTimeout(()=>{se(s,{permissionMode:O})},500);return}catch(e){console.error(`Failed to create session:`,e);return}se(s,{permissionMode:O,priority:o})}},[n,i,I,se,_e,O]),Y=(0,X.useCallback)((e,t)=>{u(e),m(t)},[]),ye=(0,X.useCallback)(e=>{g(e),u(!1),m(``),setTimeout(()=>g(null),50)},[]),be=(0,X.useCallback)(()=>{u(!1),m(``)},[]),xe=(0,X.useCallback)((e,t)=>{S(e),T(t)},[]),Se=(0,X.useCallback)(e=>{D(e),S(!1),T(``),setTimeout(()=>D(null),50)},[]),Ce=(0,X.useCallback)(()=>{S(!1),T(``)},[]);return(0,Q.jsxs)(`div`,{className:`flex flex-col h-full relative`,onDragEnter:(0,X.useCallback)(e=>{e.preventDefault(),F.current++,e.dataTransfer.types.includes(`Files`)&&M(!0)},[]),onDragLeave:(0,X.useCallback)(e=>{e.preventDefault(),F.current--,F.current===0&&M(!1)},[]),onDragOver:(0,X.useCallback)(e=>{e.preventDefault()},[]),onDrop:(0,X.useCallback)(e=>{e.preventDefault(),F.current=0,M(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&(P(t),setTimeout(()=>P(null),100))},[]),children:[j&&(0,Q.jsx)(`div`,{className:`absolute inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm border-2 border-dashed border-primary rounded-lg pointer-events-none`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-primary`,children:[(0,Q.jsx)(A,{className:`size-8`}),(0,Q.jsx)(`span`,{className:`text-sm font-medium`,children:`Drop files to attach`})]})}),K&&(0,Q.jsx)(`div`,{className:`absolute inset-0 z-50 flex items-center justify-center bg-background/60 backdrop-blur-sm`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,Q.jsx)(L,{className:`size-4 animate-spin`}),(0,Q.jsx)(`span`,{children:`Reconnecting...`})]})}),(0,Q.jsx)(Tt,{messages:W,messagesLoading:te,pendingApproval:ie,onApprovalResponse:ce,isStreaming:G,phase:ne,connectingElapsed:re,projectName:I,onFork:G?void 0:ge}),(0,Q.jsxs)(`div`,{className:`border-t border-border bg-background shrink-0`,children:[(0,Q.jsx)(Fn,{projectName:I,usageInfo:ee,contextWindowPct:ae,usageLoading:V,refreshUsage:U,lastFetchedAt:H,sessionId:n,providerId:i,onSelectSession:he,onBugReport:n?()=>fe(B,{sessionId:n,projectName:I}):void 0,isConnected:pe,onReconnect:()=>{pe||ue(),de()}}),(0,Q.jsx)(vn,{items:o,filter:f,onSelect:ye,onClose:be,visible:c}),(0,Q.jsx)(pn,{items:v,filter:w,onSelect:Se,onClose:Ce,visible:x}),(0,Q.jsx)(mn,{onSend:ve,isStreaming:G,onCancel:le,autoFocus:!e?.sessionId,projectName:I,onSlashStateChange:Y,onSlashItemsLoaded:s,slashSelected:h,onFileStateChange:xe,onFileItemsLoaded:b,fileSelected:E,externalFiles:N,permissionMode:O,onModeChange:k,providerId:i,onProviderChange:n?void 0:a})]})]})}export{In as ChatTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./jsx-runtime-BRW_vwa9.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-KLK3FWXG-C3O-MTLf.js","assets/dist-Cep75xXf.js","assets/chunk-CFjPhJqf.js","assets/chunk-PU5JKC2W-C7Gry6md.js","assets/src-Dw4QhedI.js","assets/chunk-GEFDOKGD-tDjHsAUs.js","assets/math-y9zN1W-N.js","assets/chunk-7R4GIKGN-Dvbyu4Zw.js","assets/preload-helper-Bf_JiD2A.js","assets/isArrayLikeObject-CGBoxvCD.js","assets/dagre-BFcnKyBF.js","assets/graphlib-Duh_bWLa.js","assets/isEmpty-B9L-Ge-H.js","assets/_baseUniq-Yy35llnn.js","assets/_basePickBy-3Xe18azI.js","assets/clone-B2hUek6n.js","assets/chunk-KYZI473N-Djw13C-3.js","assets/chunk-PQ6SQG4A-DX0xW7kO.js","assets/chunk-YBOYWFTD-av5aeHLq.js","assets/rough.esm-nHaDi0Kw.js","assets/chunk-MX3YWQON-C2UEioMs.js","assets/chunk-O4XLMI2P-BsUWb9d0.js","assets/line-B75-Rx70.js","assets/path-DIKpVbHL.js","assets/array-DqLCdDFv.js","assets/cose-bilkent-S5V4N54A-qudEiMCT.js","assets/cytoscape.esm-CWPXKqbJ.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./preload-helper-Bf_JiD2A.js";import{u as t}from"./chunk-GEFDOKGD-tDjHsAUs.js";import{g as n,h as r}from"./src-Dw4QhedI.js";import{s as i,y as a}from"./chunk-7R4GIKGN-Dvbyu4Zw.js";import{a as o,i as s,s as c}from"./chunk-KYZI473N-Djw13C-3.js";import{a as l,i as u,n as d,r as f}from"./chunk-O4XLMI2P-BsUWb9d0.js";var p={common:i,getConfig:a,insertCluster:s,insertEdge:d,insertEdgeLabel:f,insertMarkers:u,insertNode:o,interpolateToCurve:t,labelHelper:c,log:n,positionEdgeLabel:l},m={},h=r(e=>{for(let t of e)m[t.name]=t},`registerLayoutLoaders`);r(()=>{h([{name:`dagre`,loader:r(async()=>await e(()=>import(`./dagre-KLK3FWXG-C3O-MTLf.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24])),`loader`)},...[{name:`cose-bilkent`,loader:r(async()=>await e(()=>import(`./cose-bilkent-S5V4N54A-qudEiMCT.js`),__vite__mapDeps([25,2,26,4])),`loader`)}]])},`registerDefaultLayoutLoaders`)();var g=r(async(e,t)=>{if(!(e.layoutAlgorithm in m))throw Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);let n=m[e.layoutAlgorithm];return(await n.loader()).render(e,t,p,{algorithm:n.algorithm})},`render`),_=r((e=``,{fallback:t=`dagre`}={})=>{if(e in m)return e;if(t in m)return n.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw Error(`Both layout algorithms ${e} and ${t} are not registered.`)},`getRegisteredLayoutAlgorithm`);export{h as n,g as r,_ as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e,p as t}from"./src-Dw4QhedI.js";import{b as n}from"./chunk-7R4GIKGN-Dvbyu4Zw.js";var r=e(e=>{let{securityLevel:r}=n(),i=t(`body`);return r===`sandbox`&&(i=t((t(`#i${e}`).node()?.contentDocument??document).body)),i.select(`#${e}`)},`selectSvgElement`);export{r as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e}from"./src-Dw4QhedI.js";var t=class{constructor(e){this.init=e,this.records=this.init()}static{e(this,`ImperativeState`)}reset(){this.records=this.init()}};export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk-GEFDOKGD-tDjHsAUs.js";import{h as e}from"./src-Dw4QhedI.js";import"./chunk-7R4GIKGN-Dvbyu4Zw.js";import"./dist-Cep75xXf.js";import"./chunk-PU5JKC2W-C7Gry6md.js";import"./chunk-FMBD7UC4-D23YVTOU.js";import"./chunk-MX3YWQON-C2UEioMs.js";import"./chunk-YBOYWFTD-av5aeHLq.js";import"./chunk-JSJVCQXG-BBmymCjA.js";import"./chunk-55IACEB6-D5cABeB9.js";import"./chunk-KX2RTZJC-DP36BDiU.js";import"./chunk-PQ6SQG4A-DX0xW7kO.js";import"./chunk-KYZI473N-Djw13C-3.js";import"./chunk-O4XLMI2P-BsUWb9d0.js";import"./chunk-GLR3WWYH-DBdWQ3zy.js";import{i as t,n,r,t as i}from"./chunk-WL4C6EOR-CXuQvlyu.js";var a={parser:n,get db(){return new i},renderer:r,styles:t,init:e(e=>{e.class||={},e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk-GEFDOKGD-tDjHsAUs.js";import{h as e}from"./src-Dw4QhedI.js";import"./chunk-7R4GIKGN-Dvbyu4Zw.js";import"./dist-Cep75xXf.js";import"./chunk-PU5JKC2W-C7Gry6md.js";import"./chunk-FMBD7UC4-D23YVTOU.js";import"./chunk-MX3YWQON-C2UEioMs.js";import"./chunk-YBOYWFTD-av5aeHLq.js";import"./chunk-JSJVCQXG-BBmymCjA.js";import"./chunk-55IACEB6-D5cABeB9.js";import"./chunk-KX2RTZJC-DP36BDiU.js";import"./chunk-PQ6SQG4A-DX0xW7kO.js";import"./chunk-KYZI473N-Djw13C-3.js";import"./chunk-O4XLMI2P-BsUWb9d0.js";import"./chunk-GLR3WWYH-DBdWQ3zy.js";import{i as t,n,r,t as i}from"./chunk-WL4C6EOR-CXuQvlyu.js";var a={parser:n,get db(){return new i},renderer:r,styles:t,init:e(e=>{e.class||={},e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{y as e}from"./_baseUniq-Yy35llnn.js";var t=4;function n(n){return e(n,t)}export{n as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/csv-preview-DUbHtTAS.js","assets/chunk-CFjPhJqf.js","assets/lib-BeaDXEkP.js","assets/react-nm2Ru1Pt.js","assets/jsx-runtime-BRW_vwa9.js","assets/arrow-up--LjUXLEt.js","assets/react-dom-Bpkvzu3U.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import"./react-dom-Bpkvzu3U.js";import{n,t as r}from"./jsx-runtime-BRW_vwa9.js";import{t as i}from"./chevron-right-CHnjJt4E.js";import{n as a,t as o}from"./markdown-renderer-VIZB1GXE.js";import{o as s,t as c}from"./tab-store-Bjh6bXFP.js";import{t as l}from"./table-CQVQM2SB.js";import{i as u,n as d,t as f}from"./use-monaco-theme-0p0-84jJ.js";import{t as p}from"./preload-helper-Bf_JiD2A.js";import"./dist-CALwEtco.js";import{t as m}from"./utils-DMiycH3O.js";import{i as h,r as g,t as _}from"./api-client-BKIT_Qeg.js";import{A as v,Q as y,R as b,at as x,d as S,f as C,g as w,h as T,it as E,m as D,nt as O,ot as k,p as A,rt as j,st as M,tt as N,u as P}from"./index-Bun94AK3.js";import"./chunk-GEFDOKGD-tDjHsAUs.js";import"./src-Dw4QhedI.js";import"./chunk-7R4GIKGN-Dvbyu4Zw.js";import"./chunk-HHEYEP7N-BBw_z0fW.js";import"./dist-Cep75xXf.js";import"./chunk-PU5JKC2W-C7Gry6md.js";import"./chunk-MX3YWQON-C2UEioMs.js";import"./chunk-YBOYWFTD-av5aeHLq.js";import"./chunk-PQ6SQG4A-DX0xW7kO.js";import"./chunk-KYZI473N-Djw13C-3.js";import"./chunk-O4XLMI2P-BsUWb9d0.js";import"./chunk-GLR3WWYH-DBdWQ3zy.js";import"./chunk-XPW4576I-BPEX8KhL.js";var F=n(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),I=e(t(),1),L=r(),R={ts:x,tsx:x,js:x,jsx:x,py:x,rs:x,go:x,html:x,css:x,scss:x,json:k,md:E,txt:E,yaml:j,yml:j};function z(e,t){return t?N:R[e.split(`.`).pop()?.toLowerCase()??``]??O}function B(e,t){let n=[],r=e;for(let e=0;e<t.length;e++){let i=t[e],a=t.slice(0,e+1).join(`/`),o=r.find(e=>e.name===i);if(n.push({name:i,fullPath:a,node:o??null,siblings:r}),o?.children)r=o.children;else{for(let r=e+1;r<t.length;r++)n.push({name:t[r],fullPath:t.slice(0,r+1).join(`/`),node:null,siblings:[]});break}}return n}function V(e){return[...e].sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1)}function H({filePath:e,projectName:t,tabId:n,className:r}){let a=v(e=>e.tree),{updateTab:o,openTab:s}=c(),l=(0,I.useRef)(null),u=(0,I.useMemo)(()=>B(a,e.split(`/`).filter(Boolean)),[a,e]);(0,I.useEffect)(()=>{l.current&&(l.current.scrollLeft=l.current.scrollWidth)},[u]);function d(e,r){let i=m(e);r.metaKey||r.ctrlKey?s({type:`editor`,title:i,metadata:{filePath:e,projectName:t},projectId:t,closable:!0}):o(n,{title:i,metadata:{filePath:e,projectName:t}})}return(0,L.jsx)(`div`,{ref:l,className:r,children:u.map((e,n)=>(0,L.jsxs)(`div`,{className:`flex items-center shrink-0`,children:[n>0&&(0,L.jsx)(i,{className:`size-3 text-muted-foreground shrink-0 mx-0.5`}),e.siblings.length>0?(0,L.jsx)(U,{segment:e,isLast:n===u.length-1,projectName:t,onFileClick:d}):(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground px-1 py-0.5`,children:e.name})]},e.fullPath))})}function U({segment:e,isLast:t,projectName:n,onFileClick:r}){let i=(0,I.useMemo)(()=>V(e.siblings),[e.siblings]);return(0,L.jsxs)(P,{children:[(0,L.jsx)(w,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,className:`text-xs px-1 py-0.5 rounded hover:bg-muted transition-colors truncate max-w-[120px] ${t?`text-foreground font-medium`:`text-muted-foreground`}`,children:e.name})}),(0,L.jsx)(S,{align:`start`,className:`max-h-[300px] p-1`,children:i.map(t=>(0,L.jsx)(W,{node:t,projectName:n,activePath:e.fullPath,onFileClick:r},t.path))})]})}function W({node:e,projectName:t,activePath:n,onFileClick:r}){let i=z(e.name,e.type===`directory`),a=e.path===n;return e.type===`directory`&&e.children&&e.children.length>0?(0,L.jsxs)(A,{children:[(0,L.jsxs)(T,{className:`text-xs gap-1.5 ${a?`bg-muted`:``}`,children:[(0,L.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,L.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,L.jsx)(D,{className:`max-h-[300px] overflow-y-auto p-1`,children:V(e.children).map(e=>(0,L.jsx)(W,{node:e,projectName:t,activePath:n,onFileClick:r},e.path))})]}):(0,L.jsxs)(C,{className:`text-xs gap-1.5 cursor-pointer ${a?`bg-muted`:``}`,onSelect:e=>{},onClick:t=>{e.type!==`directory`&&r(e.path,t)},children:[(0,L.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,L.jsx)(`span`,{className:`truncate`,children:e.name})]})}function G({active:e,onClick:t,icon:n,label:r}){return(0,L.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center gap-1 px-2 py-1 rounded text-xs transition-colors ${e?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[(0,L.jsx)(n,{className:`size-3`}),(0,L.jsx)(`span`,{className:`hidden sm:inline`,children:r})]})}function K({ext:e,mdMode:t,onMdModeChange:n,csvMode:r,onCsvModeChange:i,wordWrap:o,onToggleWordWrap:s,className:c}){return(0,L.jsxs)(`div`,{className:c,children:[(e===`md`||e===`mdx`)&&n&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(G,{active:t===`edit`,onClick:()=>n(`edit`),icon:a,label:`Edit`}),(0,L.jsx)(G,{active:t===`preview`,onClick:()=>n(`preview`),icon:M,label:`Preview`})]}),e===`csv`&&i&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(G,{active:r===`table`,onClick:()=>i(`table`),icon:l,label:`Table`}),(0,L.jsx)(G,{active:r===`raw`,onClick:()=>i(`raw`),icon:a,label:`Raw`})]}),(0,L.jsx)(G,{active:o,onClick:s,icon:u,label:`Wrap`})]})}var q=(0,I.lazy)(()=>p(()=>import(`./csv-preview-DUbHtTAS.js`).then(e=>({default:e.CsvPreview})),__vite__mapDeps([0,1,2,3,4,5,6]))),J=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`]),Y=new Set([`db`,`sqlite`,`sqlite3`]);function X(e){return e.split(`.`).pop()?.toLowerCase()??``}function ee(e){return{js:`javascript`,jsx:`javascript`,ts:`typescript`,tsx:`typescript`,py:`python`,html:`html`,css:`css`,scss:`scss`,json:`json`,md:`markdown`,mdx:`markdown`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`}[X(e)]??`plaintext`}function Z({metadata:e,tabId:t}){let n=e?.filePath,r=e?.projectName,[i,a]=(0,I.useState)(null),[o,s]=(0,I.useState)(`utf-8`),[l,u]=(0,I.useState)(!0),[p,g]=(0,I.useState)(null),[v,x]=(0,I.useState)(!1),S=(0,I.useRef)(null),C=(0,I.useRef)(``),w=(0,I.useRef)(null),{tabs:T,updateTab:E}=c(),{wordWrap:D,toggleWordWrap:O}=b(),k=f(),A=T.find(e=>e.id===t),j=n?X(n):``,M=J.has(j),N=j===`pdf`,P=Y.has(j),R=j===`md`||j===`mdx`,z=j===`csv`,[B,V]=(0,I.useState)(`preview`),[U,W]=(0,I.useState)(`table`);(0,I.useEffect)(()=>{P&&t&&E(t,{type:`sqlite`})},[P,t,E]);let G=n?/^(\/|[A-Za-z]:[/\\])/.test(n):!1;(0,I.useEffect)(()=>{if(!n||!G&&!r)return;if(M||N){u(!1);return}u(!0),g(null);let e=G?`/api/fs/read?path=${encodeURIComponent(n)}`:`${h(r)}/files/read?path=${encodeURIComponent(n)}`;return _.get(e).then(e=>{a(e.content),e.encoding&&s(e.encoding),C.current=e.content,u(!1)}).catch(e=>{g(e instanceof Error?e.message:`Failed to load file`),u(!1)}),()=>{S.current&&clearTimeout(S.current)}},[n,r,M,N,G]),(0,I.useEffect)(()=>{if(!A)return;let e=n?m(n):`Untitled`,t=v?`${e} \u25CF`:e;A.title!==t&&E(A.id,{title:t})},[v]);let Z=(0,I.useCallback)(async e=>{if(n&&!(!G&&!r))try{G?await _.put(`/api/fs/write`,{path:n,content:e}):await _.put(`${h(r)}/files/write`,{path:n,content:e}),x(!1)}catch{}},[n,r,G]);function Q(e){let t=e??``;a(t),C.current=t,x(!0),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>Z(C.current),1e3)}let $=e?.lineNumber,ie=(0,I.useCallback)((e,t)=>{w.current=e,$&&$>0&&setTimeout(()=>{e.revealLineInCenter($),e.setPosition({lineNumber:$,column:1}),e.focus()},100),e.addCommand(t.KeyMod.Alt|t.KeyCode.KeyZ,()=>b.getState().toggleWordWrap()),t.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0,noSuggestionDiagnostics:!0}),t.languages.typescript.javascriptDefaults.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0,noSuggestionDiagnostics:!0})},[]);return!n||!G&&!r?(0,L.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:`No file selected.`}):l?(0,L.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,L.jsx)(y,{className:`size-5 animate-spin`}),(0,L.jsx)(`span`,{className:`text-sm`,children:`Loading file...`})]}):p?(0,L.jsx)(`div`,{className:`flex items-center justify-center h-full text-error text-sm`,children:p}):M?(0,L.jsx)(ne,{filePath:n,projectName:r}):N?(0,L.jsx)(re,{filePath:n,projectName:r}):o===`base64`?(0,L.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,L.jsx)(F,{className:`size-10 text-text-subtle`}),(0,L.jsx)(`p`,{className:`text-sm`,children:`This file is a binary format and cannot be displayed.`}),(0,L.jsx)(`p`,{className:`text-xs text-text-subtle`,children:n})]}):(0,L.jsxs)(`div`,{className:`flex flex-col h-full w-full overflow-hidden`,children:[n&&r&&t&&(0,L.jsxs)(`div`,{className:`hidden md:flex items-center h-7 border-b border-border bg-background shrink-0`,children:[(0,L.jsx)(H,{filePath:n,projectName:r,tabId:t,className:`flex items-center flex-1 min-w-0 overflow-x-auto scrollbar-none px-2 gap-0.5`}),(0,L.jsx)(K,{ext:j,mdMode:B,onMdModeChange:V,csvMode:U,onCsvModeChange:W,wordWrap:D,onToggleWordWrap:O,className:`shrink-0 flex items-center gap-1 px-2`})]}),z&&U===`table`?(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,L.jsx)(y,{className:`size-5 animate-spin text-text-subtle`})}),children:(0,L.jsx)(q,{content:i??``,onContentChange:Q,wordWrap:D})}):R&&B===`preview`?(0,L.jsx)(te,{content:i??``}):(0,L.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,L.jsx)(d,{height:`100%`,language:ee(n),value:i??``,onChange:Q,onMount:ie,theme:k,options:{fontSize:13,fontFamily:`Menlo, Monaco, Consolas, monospace`,wordWrap:D?`on`:`off`,minimap:{enabled:!1},scrollBeyondLastLine:!1,automaticLayout:!0,lineNumbers:`on`,folding:!0,bracketPairColorization:{enabled:!0}},loading:(0,L.jsx)(y,{className:`size-5 animate-spin text-text-subtle`})})})]})}function te({content:e}){return(0,L.jsx)(o,{content:e,className:`flex-1 overflow-auto p-4`})}function ne({filePath:e,projectName:t}){let[n,r]=(0,I.useState)(null),[i,a]=(0,I.useState)(!1);return(0,I.useEffect)(()=>{let n,i=`${h(t)}/files/raw?path=${encodeURIComponent(e)}`,o=g();return fetch(i,{headers:o?{Authorization:`Bearer ${o}`}:{}}).then(e=>{if(!e.ok)throw Error(`Failed`);return e.blob()}).then(e=>{let t=URL.createObjectURL(e);n=t,r(t)}).catch(()=>a(!0)),()=>{n&&URL.revokeObjectURL(n)}},[e,t]),i?(0,L.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,L.jsx)(F,{className:`size-10 text-text-subtle`}),(0,L.jsx)(`p`,{className:`text-sm`,children:`Failed to load image.`})]}):n?(0,L.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 bg-surface overflow-auto`,children:(0,L.jsx)(`img`,{src:n,alt:e,className:`max-w-full max-h-full object-contain`})}):(0,L.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,L.jsx)(y,{className:`size-5 animate-spin text-text-subtle`})})}function re({filePath:e,projectName:t}){let[n,r]=(0,I.useState)(null),[i,a]=(0,I.useState)(!1);(0,I.useEffect)(()=>{let n,i=`${h(t)}/files/raw?path=${encodeURIComponent(e)}`,o=g();return fetch(i,{headers:o?{Authorization:`Bearer ${o}`}:{}}).then(e=>{if(!e.ok)throw Error(`Failed`);return e.blob()}).then(e=>{let t=URL.createObjectURL(new Blob([e],{type:`application/pdf`}));n=t,r(t)}).catch(()=>a(!0)),()=>{n&&URL.revokeObjectURL(n)}},[e,t]);let o=(0,I.useCallback)(()=>{n&&window.open(n,`_blank`)},[n]);return i?(0,L.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,L.jsx)(F,{className:`size-10 text-text-subtle`}),(0,L.jsx)(`p`,{className:`text-sm`,children:`Failed to load PDF.`})]}):n?(0,L.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,L.jsx)(`span`,{className:`text-xs text-text-secondary truncate`,children:e}),(0,L.jsxs)(`button`,{onClick:o,className:`flex items-center gap-1 text-xs text-text-secondary hover:text-text-primary transition-colors`,children:[(0,L.jsx)(s,{className:`size-3`}),` Open in new tab`]})]}),(0,L.jsx)(`iframe`,{src:n,title:e,className:`flex-1 w-full border-none`})]}):(0,L.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,L.jsx)(y,{className:`size-5 animate-spin text-text-subtle`})})}export{Z as CodeEditor};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./jsx-runtime-BRW_vwa9.js";var t=e(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]);export{t};
|