@band-app/server 0.21.2 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/DockviewBrowserContainer-c5TBCFK6.js +5 -0
- package/dist/client/assets/DockviewTerminalContainer-De1DHQ5S.js +2 -0
- package/dist/client/assets/TerminalPanel-DR6CDpEJ.js +5 -0
- package/dist/client/assets/{_basePickBy-D17RbSpA.js → _basePickBy-DjS8T81h.js} +1 -1
- package/dist/client/assets/{_baseUniq-9xolxnuZ.js → _baseUniq-BoA3Q22r.js} +1 -1
- package/dist/client/assets/{arc-CrFKrBMt.js → arc-DzFH-F6i.js} +1 -1
- package/dist/client/assets/{architectureDiagram-VXUJARFQ-Ke3p_Mqb.js → architectureDiagram-VXUJARFQ-DpWdRDqh.js} +1 -1
- package/dist/client/assets/{blockDiagram-VD42YOAC-TqBKFyqZ.js → blockDiagram-VD42YOAC-In-FvNuA.js} +1 -1
- package/dist/client/assets/{c4Diagram-YG6GDRKO-BEH8KTZ4.js → c4Diagram-YG6GDRKO-uWim35od.js} +1 -1
- package/dist/client/assets/channel-BwZLW4yW.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-CtLV-I7X.js → chunk-4BX2VUAB-uNqF21Qn.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-DNYJbC9p.js → chunk-55IACEB6-BEB0DppO.js} +1 -1
- package/dist/client/assets/{chunk-B4BG7PRW-C9SV78wP.js → chunk-B4BG7PRW-Csf_UWBG.js} +1 -1
- package/dist/client/assets/{chunk-DI55MBZ5-BA6YDHhu.js → chunk-DI55MBZ5-ehQAiitH.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-xclQ8Cf4.js → chunk-FMBD7UC4-Ddw3wom4.js} +1 -1
- package/dist/client/assets/{chunk-QN33PNHL-CbKttxM9.js → chunk-QN33PNHL-ICAdKyID.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-Bx8-ojjW.js → chunk-QZHKN3VN-CWKRx0Nc.js} +1 -1
- package/dist/client/assets/{chunk-TZMSLE5B-C2ws4lNY.js → chunk-TZMSLE5B-DEAJFNe9.js} +1 -1
- package/dist/client/assets/classDiagram-2ON5EDUG-CVjdMCqG.js +1 -0
- package/dist/client/assets/classDiagram-v2-WZHVMYZB-CVjdMCqG.js +1 -0
- package/dist/client/assets/clone-Dj_6A90e.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-CvTq6GKB.js → cose-bilkent-S5V4N54A-CbS4okPK.js} +1 -1
- package/dist/client/assets/{dagre-6UL2VRFP-CvAkVLYR.js → dagre-6UL2VRFP-BsLKz8AK.js} +1 -1
- package/dist/client/assets/{diagram-PSM6KHXK-CjqPnfjV.js → diagram-PSM6KHXK-M6PnJuei.js} +1 -1
- package/dist/client/assets/{diagram-QEK2KX5R-CAbD5at_.js → diagram-QEK2KX5R-B__5YbI4.js} +1 -1
- package/dist/client/assets/{diagram-S2PKOQOG-npaoXBaA.js → diagram-S2PKOQOG-DKHL_M-B.js} +1 -1
- package/dist/client/assets/{erDiagram-Q2GNP2WA-B7Ii4ixk.js → erDiagram-Q2GNP2WA-BfFW0JbE.js} +1 -1
- package/dist/client/assets/{flowDiagram-NV44I4VS-CWJlEjhJ.js → flowDiagram-NV44I4VS-DjhRrkWq.js} +1 -1
- package/dist/client/assets/{ganttDiagram-JELNMOA3-DpzdgJxa.js → ganttDiagram-JELNMOA3-COYeUCef.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-V2S2FVAM-6unjAycz.js → gitGraphDiagram-V2S2FVAM-BxnB-BVL.js} +1 -1
- package/dist/client/assets/{graph-VXOljtS_.js → graph-B6AmaXta.js} +1 -1
- package/dist/client/assets/{highlighted-body-B3W2YXNL-Dr38PYps.js → highlighted-body-B3W2YXNL-wXSbO2Nz.js} +1 -1
- package/dist/client/assets/{index-Gsci2MjP.js → index-B-xrNHzx.js} +1 -1
- package/dist/client/assets/{index-B5eNC7JU.js → index-BR4JJgox.js} +1 -1
- package/dist/client/assets/{index-B-If-Bxk.js → index-B_tLkjtQ.js} +1 -1
- package/dist/client/assets/{index-Cyigja8G.js → index-Bu4tJzS5.js} +1 -1
- package/dist/client/assets/{index-BeL8lEkE.js → index-C5FWnSNO.js} +1 -1
- package/dist/client/assets/{index-sO-gKrgS.js → index-C9my7XIp.js} +1 -1
- package/dist/client/assets/{index-GAorhXcd.js → index-CFh_QYgy.js} +1 -1
- package/dist/client/assets/{index-BH6O4VK4.js → index-CXAmq9J9.js} +1 -1
- package/dist/client/assets/{index-C8JM5Fw6.js → index-DKFuGU2w.js} +1 -1
- package/dist/client/assets/{index-C5S6lhjM.js → index-DOipD6Mc.js} +1 -1
- package/dist/client/assets/{index-1bfqbPx4.js → index-DPAcHZUY.js} +1 -1
- package/dist/client/assets/{index-D7HqwOng.js → index-DQcyjj1n.js} +1 -1
- package/dist/client/assets/{index-CDZv1r4Q.js → index-DjFJyRsb.js} +1 -1
- package/dist/client/assets/{index-0smwvcI5.js → index-YemckZzk.js} +1 -1
- package/dist/client/assets/index-baLsgCNJ.js +1 -0
- package/dist/client/assets/{index-vsxjm_hQ.js → index-dPGgxYg7.js} +1 -1
- package/dist/client/assets/{index-Dt4yFYKg.js → index-e6iwsWag.js} +1 -1
- package/dist/client/assets/{index-WAvNcNBw.js → index-oWFAyhhb.js} +1 -1
- package/dist/client/assets/{infoDiagram-HS3SLOUP-CSXE28ng.js → infoDiagram-HS3SLOUP-8jgZTWHc.js} +1 -1
- package/dist/client/assets/{journeyDiagram-XKPGCS4Q-C22Q_X0X.js → journeyDiagram-XKPGCS4Q-C7UnOrYP.js} +1 -1
- package/dist/client/assets/{kanban-definition-3W4ZIXB7-DY-wTFE4.js → kanban-definition-3W4ZIXB7-BfAJ2XMs.js} +1 -1
- package/dist/client/assets/{layout-Dc5Px3_i.js → layout-BFiS4INQ.js} +1 -1
- package/dist/client/assets/{main-3W4_bdX9.js → main-SDku1HcN.js} +215 -215
- package/dist/client/assets/main-tmFPjHOC.css +1 -0
- package/dist/client/assets/{mindmap-definition-VGOIOE7T-DjlIeb28.js → mindmap-definition-VGOIOE7T-CHJqgPgK.js} +1 -1
- package/dist/client/assets/{pieDiagram-ADFJNKIX-CAYazJeR.js → pieDiagram-ADFJNKIX-v1PBCyig.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-AYHSOK5B-DqOUuCMa.js → quadrantDiagram-AYHSOK5B-BmSciYlO.js} +1 -1
- package/dist/client/assets/{requirementDiagram-UZGBJVZJ-ga9OYiX3.js → requirementDiagram-UZGBJVZJ-Cpc8-ItX.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-TZEHDZUN-DT4gli4B.js → sankeyDiagram-TZEHDZUN-BimDWo8J.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-WL72ISMW-DaZ5nFau.js → sequenceDiagram-WL72ISMW-CL72CIvP.js} +1 -1
- package/dist/client/assets/{square-terminal-DH5KC33k.js → square-terminal-DAh77hNm.js} +1 -1
- package/dist/client/assets/{stateDiagram-FKZM4ZOC-CKKdKiLu.js → stateDiagram-FKZM4ZOC-DPD5YOcB.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-4FDKWEC3-BAf0jK91.js +1 -0
- package/dist/client/assets/{timeline-definition-IT6M3QCI-BwdepkjX.js → timeline-definition-IT6M3QCI-UujIEPPc.js} +1 -1
- package/dist/client/assets/{treemap-GDKQZRPO-CHiLww4s.js → treemap-GDKQZRPO-CnxwYqSA.js} +1 -1
- package/dist/client/assets/{workspace._workspaceId-D1BWy1Ur.js → workspace._workspaceId--WY7ydFH.js} +1 -1
- package/dist/client/assets/{workspace._workspaceId-Quiswnjw.js → workspace._workspaceId-jpBhz8sr.js} +2 -2
- package/dist/client/assets/{xychartDiagram-PRI3JC2R-DawkS0Sm.js → xychartDiagram-PRI3JC2R-QNPzTKdU.js} +1 -1
- package/dist/openapi.json +158 -0
- package/dist/server/assets/{DockviewBrowserContainer-SjtAFOaO.js → DockviewBrowserContainer-B8W-NI5l.js} +16 -3
- package/dist/server/assets/{DockviewTerminalContainer-D6-3suIN.js → DockviewTerminalContainer-D6ZTAITZ.js} +29 -6
- package/dist/server/assets/{TerminalPanel-DA2GjlrE.js → TerminalPanel-D1qOucYL.js} +73 -2
- package/dist/server/assets/{_basePickBy-mQwpcWuA.js → _basePickBy-DCBLSYIo.js} +2 -2
- package/dist/server/assets/{_baseUniq-BqTMAIfp.js → _baseUniq-D6dm-LAQ.js} +1 -1
- package/dist/server/assets/_tanstack-start-manifest_v-BffwvUC-.js +4 -0
- package/dist/server/assets/{arc-CfotX0XO.js → arc-BAoORaWl.js} +1 -1
- package/dist/server/assets/{architecture-7HQA4BMR-w7SRxWR3.js → architecture-7HQA4BMR-bh4pvUjy.js} +6 -6
- package/dist/server/assets/{architectureDiagram-VXUJARFQ-DJFhyyCh.js → architectureDiagram-VXUJARFQ-B6S0AQBn.js} +6 -6
- package/dist/server/assets/{blockDiagram-VD42YOAC-6rxJggh1.js → blockDiagram-VD42YOAC-DLnnO4-n.js} +6 -6
- package/dist/server/assets/{c4Diagram-YG6GDRKO-D3y86IYm.js → c4Diagram-YG6GDRKO-CqN2DKBx.js} +2 -2
- package/dist/server/assets/{channel-BvsPpLae.js → channel-f3Ahc3R0.js} +1 -1
- package/dist/server/assets/{chunk-4BX2VUAB-BhVS4SR2.js → chunk-4BX2VUAB-CuDavVBE.js} +1 -1
- package/dist/server/assets/{chunk-55IACEB6-DKZQfAUk.js → chunk-55IACEB6-D_qe5s0S.js} +1 -1
- package/dist/server/assets/{chunk-B4BG7PRW-CTFHJOgm.js → chunk-B4BG7PRW-C0ML39A6.js} +4 -4
- package/dist/server/assets/{chunk-DI55MBZ5-D4oMyPFU.js → chunk-DI55MBZ5-DGj3ha0C.js} +3 -3
- package/dist/server/assets/{chunk-FMBD7UC4-C--TorDk.js → chunk-FMBD7UC4-D-f7FIcf.js} +1 -1
- package/dist/server/assets/{chunk-QN33PNHL-Bq5t-J27.js → chunk-QN33PNHL-DSo_m7vF.js} +1 -1
- package/dist/server/assets/{chunk-QZHKN3VN-D9QKIA24.js → chunk-QZHKN3VN-gT8icS8l.js} +1 -1
- package/dist/server/assets/{chunk-TZMSLE5B-DsPVSWvD.js → chunk-TZMSLE5B-CoUTe4U3.js} +1 -1
- package/dist/server/assets/{classDiagram-v2-WZHVMYZB-BDvFA_gY.js → classDiagram-2ON5EDUG-CbQuH3ni.js} +5 -5
- package/dist/server/assets/{classDiagram-2ON5EDUG-BDvFA_gY.js → classDiagram-v2-WZHVMYZB-CbQuH3ni.js} +5 -5
- package/dist/server/assets/{clone-CCgsMGyI.js → clone-DhkQMQiL.js} +1 -1
- package/dist/server/assets/{cose-bilkent-S5V4N54A-6FhE7VMC.js → cose-bilkent-S5V4N54A-Q7Nl8Zqm.js} +1 -1
- package/dist/server/assets/{dagre-6UL2VRFP-B2XCzgyl.js → dagre-6UL2VRFP-RuiqkM_u.js} +6 -6
- package/dist/server/assets/{diagram-PSM6KHXK-C3a4H4k4.js → diagram-PSM6KHXK-mvCbaKci.js} +7 -7
- package/dist/server/assets/{diagram-QEK2KX5R-Cr2uQFcl.js → diagram-QEK2KX5R-B30M6IEM.js} +6 -6
- package/dist/server/assets/{diagram-S2PKOQOG-B02qDgDh.js → diagram-S2PKOQOG-BapZgpGh.js} +6 -6
- package/dist/server/assets/{erDiagram-Q2GNP2WA-COfTfgT3.js → erDiagram-Q2GNP2WA-LKD5sOpF.js} +4 -4
- package/dist/server/assets/{flowDiagram-NV44I4VS-DMHyjH0P.js → flowDiagram-NV44I4VS-Cg70kWHZ.js} +5 -5
- package/dist/server/assets/{ganttDiagram-JELNMOA3-tZWVaeIh.js → ganttDiagram-JELNMOA3-CpgS7Gbo.js} +1 -1
- package/dist/server/assets/{gitGraph-G5XIXVHT-CZ_Z3kfk.js → gitGraph-G5XIXVHT-BX-0wA2S.js} +6 -6
- package/dist/server/assets/{gitGraphDiagram-V2S2FVAM-BE9qq2Q5.js → gitGraphDiagram-V2S2FVAM-BNe2zRpL.js} +7 -7
- package/dist/server/assets/{graph-BzW4XaDV.js → graph-BohWfDeQ.js} +2 -2
- package/dist/server/assets/{highlighted-body-B3W2YXNL-D0yX7NC8.js → highlighted-body-B3W2YXNL-DpfzVM5P.js} +1 -1
- package/dist/server/assets/{index-BkVmoV0_.js → index-B6FFge5B.js} +2 -2
- package/dist/server/assets/{index-BjZusA5s.js → index-BMCwJ6BW.js} +2 -2
- package/dist/server/assets/{index-D3IdMBz4.js → index-C4lG0OWB.js} +2 -2
- package/dist/server/assets/{index-DLYVbCsD.js → index-CE_oTIBT.js} +2 -2
- package/dist/server/assets/{index-BddxWcBo.js → index-CTCq_dqo.js} +4 -4
- package/dist/server/assets/{index-GYPGaDq3.js → index-CUej4Ihg.js} +2 -2
- package/dist/server/assets/{index-CSJXca8g.js → index-CWhqy8Ta.js} +2 -2
- package/dist/server/assets/{index-BhGU4xre.js → index-CnNg602B.js} +2 -2
- package/dist/server/assets/{index-BHpOY7Dw.js → index-Cvf2IVNx.js} +5 -5
- package/dist/server/assets/{index-BXnk_LSs.js → index-Cvmi6T35.js} +1 -1
- package/dist/server/assets/{index-Dgiv8n6K.js → index-Cyz3st2N.js} +2 -2
- package/dist/server/assets/{index-DHC4nyMa.js → index-Cznd5qP8.js} +5 -5
- package/dist/server/assets/{index-CEEnohTX.js → index-DF9DvOkv.js} +2 -2
- package/dist/server/assets/{index-DXdGHSqq.js → index-DoAhyHsE.js} +3 -3
- package/dist/server/assets/{index-WDxgib-p.js → index-DsRToCeg.js} +1 -23
- package/dist/server/assets/{index-BNF8mJRP.js → index-W2MLsk-k.js} +2 -2
- package/dist/server/assets/{index-DSjoHOQR.js → index-y6X09Ksj.js} +2 -2
- package/dist/server/assets/{index-DrE9X1gh.js → index-z7NiBua9.js} +3 -3
- package/dist/server/assets/{info-VBDWY6EO-DaBZazBe.js → info-VBDWY6EO-BQ8N2eDS.js} +6 -6
- package/dist/server/assets/{infoDiagram-HS3SLOUP-Bu1EpnUn.js → infoDiagram-HS3SLOUP-I1ZLYjFY.js} +5 -5
- package/dist/server/assets/{journeyDiagram-XKPGCS4Q-C2IfyEys.js → journeyDiagram-XKPGCS4Q-lFTyhPiV.js} +4 -4
- package/dist/server/assets/{kanban-definition-3W4ZIXB7-Dmos0qrE.js → kanban-definition-3W4ZIXB7-BEr5w27W.js} +2 -2
- package/dist/server/assets/{layout-B_sWGtIR.js → layout-2KXyirN2.js} +4 -4
- package/dist/server/assets/{mermaid-3ZIDBTTL-BW1cNMu3.js → mermaid-3ZIDBTTL-BfFd_m4-.js} +1 -1
- package/dist/server/assets/{mermaid-parser.core-C0KGu9_Y.js → mermaid-parser.core-SoqLW9t8.js} +11 -11
- package/dist/server/assets/{mindmap-definition-VGOIOE7T-C_mzYt-R.js → mindmap-definition-VGOIOE7T-D9ZbRdf_.js} +3 -3
- package/dist/server/assets/{packet-DYOGHKS2-DYttG_nQ.js → packet-DYOGHKS2-B2EvMQj5.js} +6 -6
- package/dist/server/assets/{pie-VRWISCQL-BuhC4M0x.js → pie-VRWISCQL-YRbpkB5e.js} +6 -6
- package/dist/server/assets/{pieDiagram-ADFJNKIX-DexUC2dZ.js → pieDiagram-ADFJNKIX-Bat_eWvt.js} +7 -7
- package/dist/server/assets/{quadrantDiagram-AYHSOK5B-I-ZcwW4o.js → quadrantDiagram-AYHSOK5B-CtqGnRnF.js} +1 -1
- package/dist/server/assets/{radar-ZZBFDIW7-CotKU5eu.js → radar-ZZBFDIW7-DvOi2qX_.js} +6 -6
- package/dist/server/assets/{requirementDiagram-UZGBJVZJ-Ea8SMq7y.js → requirementDiagram-UZGBJVZJ-CtysqbZ4.js} +3 -3
- package/dist/server/assets/{router-Cp26PX4S.js → router-ChvYGLZB.js} +28144 -27943
- package/dist/server/assets/{sankeyDiagram-TZEHDZUN-qAb9c_VI.js → sankeyDiagram-TZEHDZUN-BTLsDOUO.js} +1 -1
- package/dist/server/assets/{sequenceDiagram-WL72ISMW-DhHw376S.js → sequenceDiagram-WL72ISMW-CK0kbINT.js} +3 -3
- package/dist/server/assets/{square-terminal-urq6IDN2.js → square-terminal-BLO1pEjb.js} +1 -1
- package/dist/server/assets/{stateDiagram-FKZM4ZOC-AZXk6dET.js → stateDiagram-FKZM4ZOC-D5FS7RFa.js} +8 -8
- package/dist/server/assets/{stateDiagram-v2-4FDKWEC3-C8Sgtsj6.js → stateDiagram-v2-4FDKWEC3-DoCLlTuy.js} +4 -4
- package/dist/server/assets/{timeline-definition-IT6M3QCI-D34GNHxa.js → timeline-definition-IT6M3QCI-jFqO_Cet.js} +2 -2
- package/dist/server/assets/{treemap-GDKQZRPO-CfD3pUzb.js → treemap-GDKQZRPO-CuHJYOCT.js} +6 -6
- package/dist/server/assets/{workspace._workspaceId-D87t1HVW.js → workspace._workspaceId-B0M_Sxj3.js} +1 -1
- package/dist/server/assets/{workspace._workspaceId-CweIY_H0.js → workspace._workspaceId-CGq293LY.js} +3 -3
- package/dist/server/assets/{xychartDiagram-PRI3JC2R-CWxcKTdW.js → xychartDiagram-PRI3JC2R-DPvU_7PC.js} +1 -1
- package/dist/server/server.js +2 -2
- package/dist/start-server.mjs +388 -247
- package/package.json +4 -4
- package/dist/client/assets/DockviewBrowserContainer-6vGRAPMq.js +0 -5
- package/dist/client/assets/DockviewTerminalContainer-COlPnAN7.js +0 -2
- package/dist/client/assets/TerminalPanel-DNBLPQEb.js +0 -5
- package/dist/client/assets/channel-Cx_aQUiM.js +0 -1
- package/dist/client/assets/classDiagram-2ON5EDUG-CDZ4gS0y.js +0 -1
- package/dist/client/assets/classDiagram-v2-WZHVMYZB-CDZ4gS0y.js +0 -1
- package/dist/client/assets/clone-CNiiW5Ay.js +0 -1
- package/dist/client/assets/index-CN_mH_uK.js +0 -1
- package/dist/client/assets/main-BgcIGjy5.css +0 -1
- package/dist/client/assets/stateDiagram-v2-4FDKWEC3-CSXqjPLc.js +0 -1
- package/dist/server/assets/_tanstack-start-manifest_v-PthNKGfG.js +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@band-app/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"band-server": "./bin/band-server.mjs"
|
|
@@ -117,9 +117,9 @@
|
|
|
117
117
|
"ws": "^8.18.0",
|
|
118
118
|
"zod": "^3.25.67",
|
|
119
119
|
"zustand": "^5.0.0",
|
|
120
|
-
"@band-app/
|
|
121
|
-
"@band-app/ui": "^0.
|
|
122
|
-
"@band-app/
|
|
120
|
+
"@band-app/logger": "^0.23.0",
|
|
121
|
+
"@band-app/ui": "^0.23.0",
|
|
122
|
+
"@band-app/coding-agent": "^0.23.0"
|
|
123
123
|
},
|
|
124
124
|
"scripts": {
|
|
125
125
|
"dev": "NODE_ENV=development tsx watch start-server.ts",
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{m as be,r as t,bU as B,cs as z,ct as K,cu as Re,p as U,cv as De,cw as Pe,j as o,cx as ie,cm as Ae,cy as Te,cz as Ee,cA as Ie,cB as Be,cC as Fe,cD as Ue,cE as qe,cF as Le,cG as Me,cH as J,cI as ze,b_ as Oe,cg as Ke,X as me,cJ as $e,u as Ge,n as He,o as Ve,q as Qe,v as we,w as We,x as Je,y as Xe,z as Ye,A as Ze,H as ce,J as le,B as et,C as tt,E as rt,F as nt,G as st}from"./main-3W4_bdX9.js";const ot=[["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"}]],at=be("history",ot);const it=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],ct=be("wrench",it);function lt(e,n){if(!n||n.size===0||typeof e!="object"||e===null)return e;const r=e.panels;if(typeof r!="object"||r===null)return e;let l=!1;const d={};for(const[c,b]of Object.entries(r)){const x=n.get(c);if(x&&typeof b=="object"&&b!==null&&typeof b.params=="object"&&b.params!==null){const y=b.params;if(!y.initialUrl){d[c]={...b,params:{...y,initialUrl:x}},l=!0;continue}}d[c]=b}return l?{...e,panels:d}:e}const ut={caseSensitive:!1,wholeWord:!1,regex:!1};function dt({key:e,keyName:n}){const[r,l]=t.useState(!1),[d,c]=t.useState(""),[b,x]=t.useState(ut),[y,N]=t.useState(null),j=t.useRef(null),_=t.useRef(e);_.current=e;const F=t.useRef(null),k=t.useCallback(R=>n==="browserId"?R.browser_id:R.workspace_id,[n]),T=t.useCallback((R={})=>({[n]:_.current,...R}),[n]),E=t.useCallback(()=>{requestAnimationFrame(()=>{j.current?.focus(),j.current?.select()})},[]),C=t.useCallback(async(R,f={})=>{if(B){if(!R){N(null),F.current=null;try{await z("browser_stop_find_in_page",T({action:"clearSelection"}))}catch{}return}(f.findNext??!1)||(N(null),F.current=null);try{const s=await z("browser_find_in_page",T({text:R,options:{matchCase:b.caseSensitive,findNext:f.findNext??!1,forward:f.forward??!0}}));typeof s=="number"&&(F.current=s)}catch(s){console.error("browser_find_in_page failed:",s)}}},[T,b.caseSensitive]),I=t.useCallback(()=>{l(!1),c(""),N(null),F.current=null,B&&z("browser_stop_find_in_page",T({action:"clearSelection"})).catch(()=>{})},[T]),v=t.useCallback(()=>{l(!0),E()},[E]);t.useEffect(()=>{r&&C(d)},[d,r,C]),t.useEffect(()=>{if(!B)return;let R;return(async()=>R=await K("browser-found-in-page",f=>{k(f.payload)===_.current&&(F.current!==null&&f.payload.request_id!==F.current||N({total:f.payload.matches,current:f.payload.active_match_ordinal}))}))(),()=>R?.()},[k]),t.useEffect(()=>{if(!B)return;let R;return(async()=>R=await K("browser-find-shortcut",f=>{k(f.payload)===_.current&&(l(!0),E())}))(),()=>R?.()},[E,k]),t.useEffect(()=>{if(!B)return;let R;return(async()=>R=await K("browser-url-changed",f=>{k(f.payload)===_.current&&f.payload.loading&&I()}))(),()=>R?.()},[I,k]);const S=t.useCallback(()=>{d&&C(d,{findNext:!0,forward:!0})},[d,C]),O=t.useCallback(()=>{d&&C(d,{findNext:!0,forward:!1})},[d,C]);return{isOpen:r,open:v,close:I,query:d,setQuery:c,options:b,setOptions:x,matchInfo:y,findNext:S,findPrevious:O,searchBarRef:j}}const ft=50,pt=100;function ht(e){const{key:n,keyName:r,workspaceId:l,currentUrlRef:d,setInputUrl:c,inputUrl:b,onNavigate:x}=e,y=dt({key:n,keyName:r}),N=t.useRef(!1),[j,_]=t.useState([]),[F,k]=t.useState(!1),[T,E]=t.useState(0);Re(F);const C=t.useCallback(()=>{k(!1),_([]),E(0)},[]);t.useEffect(()=>{if(!N.current)return;const f=b.trim();if(f===""){C();return}if(f===d.current.trim()){C();return}let s=!1;const u=setTimeout(()=>{U.history.search.query({workspaceId:l,query:f,limit:8}).then(p=>{if(!s){if(p.entries.length===0){C();return}_(p.entries),k(!0),E(0)}}).catch(()=>{s||C()})},ft);return()=>{s=!0,clearTimeout(u)}},[b,l,C,d]);const I=t.useCallback(f=>{N.current=!0,f.target.select()},[]),v=t.useCallback(()=>{N.current=!1,c(d.current),setTimeout(()=>{N.current||C()},pt)},[d,c,C]),S=t.useCallback(f=>{if(F){if(f.key==="ArrowDown"){f.preventDefault(),E(s=>Math.min(s+1,j.length-1));return}if(f.key==="ArrowUp"){f.preventDefault(),E(s=>Math.max(s-1,0));return}if(f.key==="Enter"){const s=j[T];if(s){f.preventDefault(),C(),x(s.url);return}}if(f.key==="Escape"){f.preventDefault(),C();return}}if(f.key==="Enter"){f.preventDefault(),C(),x(b);return}if(f.key==="Escape"){f.preventDefault(),c(d.current);const s=f.currentTarget;requestAnimationFrame(()=>{s.isConnected&&s.select()})}},[b,x,c,d,F,j,T,C]),O=t.useCallback(f=>{f.key.toLowerCase()!=="f"||f.shiftKey||f.altKey||!(/mac/i.test(navigator.userAgent)?f.metaKey&&!f.ctrlKey:f.ctrlKey&&!f.metaKey)||(f.preventDefault(),f.stopPropagation(),y.open())},[y]),R=t.useCallback(async()=>{if(B)try{await z("browser_toggle_dev_tools",{[r]:n})}catch(f){console.error("browser_toggle_dev_tools failed:",f)}},[n,r]);return{find:y,addressInputFocusedRef:N,handleAddressFocus:I,handleAddressBlur:v,handleAddressKeyDown:S,handlePaneKeyDown:O,handleToggleDevTools:R,autocomplete:{isOpen:F,items:j,selectedIndex:T,close:C,setSelectedIndex:E},paneDataAttrs:{"data-band-browser-pane":"","data-band-browser-pane-key":n,"data-band-browser-pane-keyname":r}}}function ue(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}function bt(e){const{created:n,visible:r,ipcKeyRef:l}=e,d=De(),[c,b]=t.useState(null),x=t.useRef(!1);return t.useEffect(()=>{if(!B||!n)return;let y=!1;if(d){if(!r)return;const N=l.current;(async()=>{try{const j=await z("browser_capture_page",N);!y&&j&&(Pe.flushSync(()=>b(j)),await ue())}catch{}y||(x.current=!0,z("browser_pause_media",N).catch(()=>{}),z("browser_hide",N).catch(()=>{}))})()}else{const N=x.current;if(x.current=!1,N&&r){const j=l.current;z("browser_show",j).catch(()=>{}),z("browser_resume_media",j).catch(()=>{}),(async()=>(await ue(),y||b(null)))()}else b(null)}return()=>{y=!0}},[d,n,r,l]),{snapshot:c}}let Q=new Set;const te=new Set;let Y=!1;function mt(e){const n=e(Q);if(n!==Q){Q=n;for(const r of te)r()}}function de(e){const n=e.toLowerCase();!n||Q.has(n)||mt(r=>{const l=new Set(r);return l.add(n),l})}function wt(){Y||B&&(Y=!0,K("browser-host-overridden",e=>{e.payload.host&&de(e.payload.host)}).catch(e=>{console.error("browser-host-overridden listen failed:",e),Y=!1}),z("browser_get_overridden_hosts").then(e=>{if(Array.isArray(e))for(const n of e)de(n)}).catch(e=>{console.error("browser_get_overridden_hosts failed:",e)}))}function yt(e){return wt(),te.add(e),()=>{te.delete(e)}}function fe(){return Q}function gt(){const e=t.useSyncExternalStore(yt,fe,fe);return{isOverriddenHost:t.useCallback(r=>{if(!r)return!1;let l;try{l=new URL(r).hostname.toLowerCase()}catch{return!1}return e.has(l)},[e])}}function xt({state:e,onSelect:n}){return!e.isOpen||e.items.length===0?null:o.jsx("div",{className:"absolute top-full left-0 right-0 z-20 mx-2 mt-1 overflow-hidden rounded-md border border-border bg-popover shadow-md",onMouseDown:r=>{r.preventDefault()},children:o.jsx("ul",{className:"max-h-80 overflow-y-auto py-1",children:e.items.map((r,l)=>{const d=l===e.selectedIndex;return o.jsx("li",{children:o.jsxs("button",{type:"button",onMouseDown:c=>{c.preventDefault(),n(r.url),e.close()},onMouseEnter:()=>e.setSelectedIndex(l),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors ${d?"bg-accent text-foreground":"text-foreground hover:bg-accent/60"}`,children:[r.faviconUrl?o.jsx("img",{src:r.faviconUrl,alt:"",className:"size-4 shrink-0 rounded-sm",onError:c=>{c.currentTarget.style.display="none"}}):o.jsx(ie,{className:"size-4 shrink-0 text-muted-foreground"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.title?o.jsx("span",{className:"truncate font-medium leading-tight",children:r.title}):null,o.jsx("span",{className:`truncate text-xs leading-tight ${r.title?"text-muted-foreground":"text-foreground"}`,children:r.url})]})]})},r.id)})})})}function vt({find:e}){return e.isOpen?o.jsx(Ae,{ref:e.searchBarRef,query:e.query,onQueryChange:e.setQuery,options:e.options,onOptionsChange:e.setOptions,placeholder:"Find in page",matchInfo:e.matchInfo??void 0,onNext:e.findNext,onPrevious:e.findPrevious,onClose:e.close,visibleOptions:["caseSensitive"]}):null}const jt=150,Ct=200;function Nt(e){const n=new Map,r=[];for(const l of e){const d=re(l.lastVisitedAt);let c=n.get(d);c||(c={label:_t(d),entries:[]},n.set(d,c),r.push(d)),c.entries.push(l)}return r.map(l=>n.get(l))}function re(e){const n=new Date(e),r=n.getFullYear(),l=String(n.getMonth()+1).padStart(2,"0"),d=String(n.getDate()).padStart(2,"0");return`${r}-${l}-${d}`}function _t(e){const n=new Date,r=re(n.getTime()),l=new Date(n.getFullYear(),n.getMonth(),n.getDate()-1),d=re(l.getTime());if(e===r)return"Today";if(e===d)return"Yesterday";const[c,b,x]=e.split("-").map(Number),y=new Date(c,b-1,x);return Math.floor((Date.now()-y.getTime())/(1440*60*1e3))<=7?y.toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"}):y.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function St(e){return new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function kt({workspaceId:e,onNavigate:n}){const r=t.useId(),[l,d]=t.useState(!1),[c,b]=t.useState(""),[x,y]=t.useState([]),[N,j]=t.useState(!1),[_,F]=t.useState(0),k=t.useCallback(()=>{F(v=>v+1)},[]);t.useEffect(()=>{if(!l)return;let v=!1;j(!0);const S=c.trim(),f=setTimeout(()=>{(S?U.history.search.query({workspaceId:e,query:S,limit:50}):U.history.list.query({workspaceId:e,limit:Ct})).then(u=>{v||y(u.entries)}).catch(()=>{v||y([])}).finally(()=>{v||j(!1)})},S?jt:0);return()=>{v=!0,clearTimeout(f)}},[l,c,e,_]);const T=t.useMemo(()=>Nt(x),[x]),E=t.useCallback(v=>{n(v),d(!1)},[n]),C=t.useCallback(async v=>{await U.history.delete.mutate({id:v,workspaceId:e}).catch(()=>{}),k()},[k,e]),I=t.useCallback(async v=>{await U.history.clear.mutate({workspaceId:e,range:v}).catch(()=>{}),k()},[k,e]);return o.jsxs(Te,{open:l,onOpenChange:d,children:[o.jsx(Ee,{asChild:!0,children:o.jsx("button",{type:"button",className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",title:"History","aria-label":"Browser history",children:o.jsx(at,{className:"size-4"})})}),o.jsxs(Ie,{align:"end",sideOffset:6,className:"w-[440px] p-0",onOpenAutoFocus:v=>{v.preventDefault();const S=document.getElementById(r);S&&S.focus()},children:[o.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[o.jsx(Be,{className:"size-4 shrink-0 text-muted-foreground"}),o.jsx("input",{id:r,type:"text",value:c,onChange:v=>b(v.target.value),placeholder:"Search history",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),o.jsx("div",{className:"max-h-[420px] overflow-y-auto",children:N&&x.length===0?o.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Loading…"}):T.length===0?o.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:c?"No matching history":"No history yet"}):T.map(v=>o.jsxs("div",{children:[o.jsx("div",{className:"sticky top-0 z-10 border-b border-border bg-popover px-3 py-1 text-xs font-medium text-muted-foreground",children:v.label}),o.jsx("ul",{children:v.entries.map(S=>o.jsxs("li",{className:"group relative flex min-w-0 items-center gap-2 py-1.5 pl-3 pr-2 hover:bg-accent/60",children:[S.faviconUrl?o.jsx("img",{src:S.faviconUrl,alt:"",className:"size-4 shrink-0 rounded-sm",onError:O=>{O.currentTarget.style.display="none"}}):o.jsx(ie,{className:"size-4 shrink-0 text-muted-foreground"}),o.jsxs("button",{type:"button",onClick:()=>E(S.url),className:"flex min-w-0 flex-1 flex-col items-stretch gap-0.5 overflow-hidden pr-6 text-left",children:[o.jsx("span",{className:"block truncate text-sm font-medium leading-tight text-foreground",children:S.title||S.url}),o.jsxs("span",{className:"flex min-w-0 items-baseline gap-2 leading-tight",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:S.url}),o.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground tabular-nums",children:St(S.lastVisitedAt)})]})]}),o.jsx("button",{type:"button",onClick:()=>C(S.id),className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-0.5 text-muted-foreground opacity-0 transition-opacity hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:"Delete entry","aria-label":"Delete entry",children:o.jsx(Fe,{className:"size-3.5"})})]},S.id))})]},v.label))}),o.jsx("div",{className:"flex items-center justify-end border-t border-border px-3 py-2",children:o.jsxs(Ue,{children:[o.jsx(qe,{asChild:!0,children:o.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:["Clear ",o.jsx(Le,{className:"size-3"})]})}),o.jsxs(Me,{align:"end",children:[o.jsx(J,{onSelect:()=>I("hour"),children:"Last hour"}),o.jsx(J,{onSelect:()=>I("day"),children:"Last 24 hours"}),o.jsx(J,{onSelect:()=>I("week"),children:"Last week"}),o.jsx(J,{onSelect:()=>I("all"),children:"All time"})]})]})})]})]})}function Rt(){return o.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-destructive/10 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-destructive",title:"The certificate for this site was overridden for the current session. Use with caution.","data-testid":"cert-not-secure-badge",children:[o.jsx(ze,{className:"size-3","aria-hidden":!0}),"Not secure"]})}const pe="",G="about:blank",ne=new Map,se=new Set;function Dt(e,n){if(ne.get(e)!==n){ne.set(e,n);for(const r of se)r()}}function Pt(e){return se.add(e),()=>{se.delete(e)}}function At(e){return t.useSyncExternalStore(Pt,()=>ne.get(e))}function Tt({params:e,api:n}){const{browserId:r,initialUrl:l,workspaceId:d}=e,[c,b]=t.useState(()=>l??pe),[x,y]=t.useState(()=>l??pe),[N,j]=t.useState(!1),[_,F]=t.useState(!1),k=t.useRef(!1),T=t.useRef(null),E=t.useRef(!1),C=t.useRef(null),I=t.useRef(r);I.current=r;const v=t.useRef(c);v.current=c;const[S,O]=t.useState(d??""),R=t.useRef(S);R.current=S;const f=t.useRef({browserId:r});f.current={browserId:r};const{snapshot:s}=bt({created:_,visible:n.isVisible&&e.wsActive!==!1,ipcKeyRef:f}),{isOverriddenHost:u}=gt(),p=t.useCallback(()=>{const g=T.current;if(!g)return null;const m=g.getBoundingClientRect();return{x:m.left+1,y:m.top,width:Math.max(0,m.width-2),height:m.height}},[]),a=t.useCallback(async(g,m)=>{if(B)return z(g,m)},[]);t.useEffect(()=>{if(!r||l)return;let g=!1;return U.browsers.get.query({browserId:r}).then(m=>{if(g)return;const w=m.browser?.workspaceId;w&&!R.current&&O(w);const P=m.browser?.url;!P||P===""||P===G||(b(P),y(P),k.current?a("browser_navigate",{browserId:r,url:P}).catch(()=>{}):C.current=P)}).catch(()=>{}),()=>{g=!0}},[r,l,a]),t.useEffect(()=>{if(!B||_||E.current)return;const g=T.current;if(!g)return;let m=!1;const w=async()=>{if(m||k.current||E.current)return;const $=p();if(!(!$||$.width===0||$.height===0)){P.disconnect(),E.current=!0;try{await a("browser_create",{browserId:r,...$,url:v.current||G}),k.current=!0,F(!0);const W=C.current;W&&(C.current=null,await a("browser_navigate",{browserId:I.current,url:W}))}catch(W){console.error("Failed to create browser webview:",W)}finally{E.current=!1}}},P=new ResizeObserver(()=>{w()});P.observe(g);const L=setTimeout(w,50);return()=>{m=!0,clearTimeout(L),P.disconnect()}},[_,p,a,r]);const i=t.useRef(null);t.useEffect(()=>{if(!B)return;let g,m;return(async()=>(g=await K("browser-url-changed",w=>{if(w.payload.browser_id!==I.current)return;const P=w.payload.url;if(j(w.payload.loading),P===G)return;b(P),xe.current||y(P),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{U.browsers.navigate.mutate({browserId:I.current,url:P}).catch(()=>{})},500);let L;try{L=`${new URL(P).origin}/favicon.ico`,Dt(I.current,L)}catch{}!w.payload.loading&&R.current&&U.history.record.mutate({workspaceId:R.current,url:P,faviconUrl:L}).catch(()=>{})}),m=await K("browser-title-changed",w=>{if(w.payload.browser_id===I.current&&w.payload.title){n.setTitle(w.payload.title);const P=v.current;P&&P!==G&&R.current&&U.history.updateMeta.mutate({workspaceId:R.current,url:P,title:w.payload.title}).catch(()=>{})}})))(),()=>{if(g?.(),m?.(),i.current){clearTimeout(i.current),i.current=null;const w=v.current;w&&w!==G&&U.browsers.navigate.mutate({browserId:I.current,url:w}).catch(()=>{})}}},[n]),t.useEffect(()=>{if(!B||!_)return;const g=L=>$=>console.error(`[BrowserPane] ${L} failed`,$),m=()=>{const L=p();L&&L.width>0&&L.height>0&&a("browser_set_bounds",{browserId:r,...L}).catch(g("browser_set_bounds")),a("browser_show",{browserId:r}).catch(g("browser_show"))},w=()=>{a("browser_hide",{browserId:r}).catch(g("browser_hide"))},P=n.onDidVisibilityChange(L=>{L.isVisible?m():w()});return()=>{P.dispose()}},[n,_,p,a,r]),t.useEffect(()=>{if(!B||!_)return;const g=e.wsActive!==!1,m=w=>P=>console.error(`[BrowserPane] ${w} failed`,P);if(!g)a("browser_hide",{browserId:r}).catch(m("browser_hide"));else if(n.isVisible){const w=p();w&&w.width>0&&w.height>0&&a("browser_set_bounds",{browserId:r,...w}).catch(m("browser_set_bounds")),a("browser_show",{browserId:r}).catch(m("browser_show"))}},[e.wsActive,n,_,p,a,r]),t.useEffect(()=>{if(!B||!_)return;const g=T.current;if(!g)return;const m=new ResizeObserver(()=>{const w=p();!w||w.width===0||w.height===0||a("browser_set_bounds",{browserId:r,...w}).catch(()=>{})});return m.observe(g),()=>m.disconnect()},[_,p,a,r]),t.useEffect(()=>()=>{if(B){const g=I.current;z("browser_destroy",{browserId:g}).catch(()=>{})}},[]);const h=t.useCallback(async g=>{let m=g.trim();if(!m){if(b(""),y(""),j(!1),k.current)try{await a("browser_navigate",{browserId:r,url:G})}catch(w){console.error("browser_navigate failed:",w)}else C.current=G;return}if(!m.startsWith("http://")&&!m.startsWith("https://")&&(m.includes(".")&&!m.includes(" ")?m=`https://${m}`:m=`https://www.google.com/search?q=${encodeURIComponent(m)}`),b(m),y(m),j(!0),k.current)try{await a("browser_navigate",{browserId:r,url:m})}catch(w){console.error("browser_navigate failed:",w)}else C.current=m},[a,r]),D=t.useCallback(async()=>{try{await a("browser_go_back",{browserId:r})}catch(g){console.error("browser_go_back failed:",g)}},[a,r]),A=t.useCallback(async()=>{try{await a("browser_go_forward",{browserId:r})}catch(g){console.error("browser_go_forward failed:",g)}},[a,r]),q=t.useCallback(async()=>{try{j(!0),await a("browser_reload",{browserId:r})}catch(g){console.error("browser_reload failed:",g)}},[a,r]),M=t.useCallback(async()=>{try{await a("browser_eval",{browserId:r,js:"window.stop()"}),j(!1)}catch{j(!1)}},[a,r]),{find:X,addressInputFocusedRef:xe,handleAddressFocus:ve,handleAddressBlur:je,handleAddressKeyDown:Ce,handlePaneKeyDown:Ne,handleToggleDevTools:_e,autocomplete:Se,paneDataAttrs:ke}=ht({key:r,keyName:"browserId",workspaceId:S,currentUrlRef:v,setInputUrl:y,inputUrl:x,onNavigate:h});return r?B?o.jsxs("div",{className:"flex h-full w-full flex-col",onKeyDown:Ne,...ke,children:[o.jsx("style",{children:`@keyframes browser-bar-slide {
|
|
2
|
-
0% { transform: translateX(-100%); }
|
|
3
|
-
50% { transform: translateX(200%); }
|
|
4
|
-
100% { transform: translateX(-100%); }
|
|
5
|
-
}`}),o.jsxs("div",{className:"relative flex h-10 shrink-0 items-center gap-1 border-b border-border bg-background px-2",children:[o.jsx("button",{type:"button",onClick:D,className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",title:"Back",children:o.jsx(Oe,{className:"size-4"})}),o.jsx("button",{type:"button",onClick:A,className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",title:"Forward",children:o.jsx(Ke,{className:"size-4"})}),N?o.jsx("button",{type:"button",onClick:M,className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",title:"Stop",children:o.jsx(me,{className:"size-4"})}):o.jsx("button",{type:"button",onClick:q,className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",title:"Reload",children:o.jsx($e,{className:"size-4"})}),u(c)?o.jsx(Rt,{}):null,o.jsx("input",{type:"text",value:x,onChange:g=>y(g.target.value),onKeyDown:Ce,onFocus:ve,onBlur:je,className:"min-w-0 flex-1 rounded border border-transparent bg-muted/50 px-3 py-1.5 text-sm text-foreground outline-none transition-colors focus:border-border",placeholder:"Enter URL or search...","data-band-address-input":""}),S?o.jsx(kt,{workspaceId:S,onNavigate:h}):null,o.jsx("button",{type:"button",onClick:_e,className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",title:"Toggle DevTools",children:o.jsx(ct,{className:"size-4"})}),N&&o.jsx("div",{className:"absolute inset-x-0 bottom-0 h-0.5 overflow-hidden bg-blue-500/10",children:o.jsx("div",{className:"h-full w-2/5 rounded-full bg-blue-500",style:{animation:"browser-bar-slide 1.4s ease-in-out infinite"}})}),o.jsx(xt,{state:Se,onSelect:h})]}),o.jsx(vt,{find:X}),o.jsx("div",{ref:T,className:"relative min-h-0 flex-1",children:s?o.jsx("img",{src:s,alt:"",className:"pointer-events-none absolute inset-0 size-full object-contain object-top",draggable:!1}):null})]}):o.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"Browser panel is only available in the desktop app"}):null}const ye=new Set;function he(e){ye.add(e)}function Ot(e){return ye.delete(e)}function Et(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();const e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;const n=Array.from(e,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function oe(){return`browser_${Et()}`}function ae(e){return["browserLayout",e]}const Z=new Map;function It(e){if(typeof e=="object"&&e!==null){const n=e.panels;if(typeof n=="object"&&n!==null)return new Set(Object.keys(n))}return new Set}function ee(e,n,r){if(r?.queryClient){const d=r.queryClient.getQueryData(ae(e));r.queryClient.setQueryData(ae(e),{layout:n,browserIds:It(n),urls:d?.urls??new Map})}const l=Z.get(e);l&&clearTimeout(l),Z.set(e,setTimeout(()=>{Z.delete(e),U.browserLayout.save.mutate({workspaceId:e,tree:n}).catch(d=>{console.error("[DockviewBrowserContainer] failed to persist layout:",d)})},500))}function Bt(e){if(typeof e!="object"||e===null)return!1;const n=e;return typeof n.grid=="object"&&typeof n.panels=="object"}const Ft={name:"band",className:"dockview-theme-band dockview-browser-tabs"};function Ut({params:e,api:n}){const{visible:r}=st();if(!e.workspaceId||!e.browserId)return null;const l={workspaceId:e.workspaceId,browserId:e.browserId,wsActive:r,initialUrl:e.initialUrl};return o.jsx("div",{className:"flex h-full w-full flex-col overflow-hidden","data-testid":`dockview-browser-tab__visible-${r?"true":"false"}`,children:o.jsx(Tt,{params:l,api:n})})}function ge(e){const[n,r]=t.useState(e.api.title??"New Tab"),[l,d]=t.useState(!1),c=e.params.browserId,b=At(c),x=t.useRef(b);b!==x.current&&(x.current=b,l&&d(!1)),t.useEffect(()=>{const _=e.api.onDidTitleChange(()=>r(e.api.title??"New Tab"));return()=>_.dispose()},[e.api]);const y=e.containerApi,N=t.useCallback(_=>{_.stopPropagation(),H.get(y.id)?.current?.onClose(c)},[y,c]),j=b&&!l;return o.jsxs("div",{className:"dv-default-tab",children:[o.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[j?o.jsx("img",{src:b,alt:"",className:"size-3.5 shrink-0",onError:()=>d(!0)}):o.jsx(ie,{className:"size-3.5 shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:n})]}),o.jsx("button",{type:"button",className:"ml-1 inline-flex size-4 items-center justify-center rounded-sm opacity-60 hover:opacity-100 hover:bg-accent transition-colors",onClick:N,title:"Close tab",children:o.jsx(me,{className:"size-3"})})]})}const H=new Map,qt=et.memo(function(n){const r=(n.location?.type??"grid")==="grid",l=n.containerApi.id,d=n.group.id;return o.jsxs("div",{className:"flex h-full w-full items-center justify-center","data-testid":r?"dockview-browser__toolbar":void 0,children:[r&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",onClick:()=>H.get(l)?.current?.onSplit(d,"right"),title:"Split right",children:o.jsx(tt,{className:"size-3.5"})}),o.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",onClick:()=>H.get(l)?.current?.onSplit(d,"below"),title:"Split down",children:o.jsx(rt,{className:"size-3.5"})})]}),o.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",onClick:()=>H.get(l)?.current?.onAdd(d),title:"New browser tab",children:o.jsx(nt,{className:"size-4"})})]})}),Lt={browserTab:Ut},Mt={browserTab:ge};function Kt({workspaceId:e,visible:n,wsActive:r}){const l=Ge(),d=He(),c=t.useRef(null),b=t.useRef(!1),x=t.useRef(null),y=t.useRef(null),N=t.useRef(null),{data:j}=Ve({queryKey:ae(e),queryFn:async()=>{const[{tree:s},{browsers:u}]=await Promise.all([U.browserLayout.get.query({workspaceId:e}).catch(()=>({tree:null})),U.browsers.list.query({workspaceId:e}).catch(()=>({browsers:[]}))]),p=new Map;for(const a of u)a.url&&a.url!=="about:blank"&&p.set(a.id,a.url);return{layout:s,browserIds:new Set(u.map(a=>a.id)),urls:p}},staleTime:Number.POSITIVE_INFINITY}),_=t.useRef(d);_.current=d;const F=t.useCallback(()=>{if(b.current)return;const s=c.current;s&&ee(e,s.toJSON(),{queryClient:_.current})},[e]),k=t.useCallback(async(s,u)=>{const p=c.current;if(!p)return;const a=oe();he(a);const i=u?.initialUrl,h={id:a,component:"browserTab",tabComponent:"browserTab",title:"New Tab",params:{workspaceId:e,browserId:a,...i?{initialUrl:i}:{}}};s&&(h.position={referenceGroup:s}),p.addPanel(h);try{await U.browsers.create.mutate({workspaceId:e,id:a,...i?{url:i}:{}})}catch(D){console.error("[DockviewBrowserContainer] error pre-creating browser:",D)}},[e]),T=t.useCallback(async(s,u)=>{const p=c.current;if(!p)return;const a=oe();he(a);try{p.addPanel({id:a,component:"browserTab",tabComponent:"browserTab",title:"New Tab",params:{workspaceId:e,browserId:a},position:{referenceGroup:s,direction:u}})}catch(i){console.error("[DockviewBrowserContainer] split addPanel threw:",i);return}try{await U.browsers.create.mutate({workspaceId:e,id:a})}catch(i){console.error("[DockviewBrowserContainer] error creating split browser:",i)}},[e]),E=t.useCallback(s=>{const u=c.current;if(!u)return;Qe(u,s);const p=u.getPanel(s);p&&u.removePanel(p),u.panels.length===0&&V(u,e),requestAnimationFrame(()=>{const a=u.activePanel;a&&a.view.content.element.querySelector("[data-band-address-input]")?.focus()}),U.browsers.remove.mutate({browserId:s}).catch(a=>{console.error("[DockviewBrowserContainer] failed to remove browser:",a)})},[e]);t.useEffect(()=>{if(!n)return;const s=()=>{const i=c.current?.activePanel;i&&i.view.content.element.querySelector("[data-band-address-input]")?.focus()},u=i=>{ce(c.current,i,()=>{requestAnimationFrame(s)})},p=i=>{le(c.current,i,()=>{requestAnimationFrame(s)})},a=i=>{if(!x.current?.contains(document.activeElement))return;const h=i.key.toLowerCase();if(i.ctrlKey&&!i.metaKey&&h==="tab"){i.preventDefault(),i.stopPropagation(),u(i.shiftKey?-1:1);return}if(i.metaKey||i.ctrlKey){if(i.shiftKey&&(h==="["||h==="]")){i.preventDefault(),i.stopPropagation(),u(h==="]"?1:-1);return}if(!i.shiftKey&&(h==="["||h==="]")){i.preventDefault(),i.stopPropagation(),p(h==="]"?1:-1);return}if(h==="t"&&!i.shiftKey)i.preventDefault(),i.stopPropagation(),k().then(()=>{requestAnimationFrame(()=>{const A=c.current?.activePanel;A&&A.view.content.element.querySelector("[data-band-address-input]")?.focus()})});else if(h==="w"&&!i.shiftKey){const A=c.current;if(!A)return;i.preventDefault(),i.stopPropagation();const q=A.activePanel;q&&E(q.id)}else if(h==="d"){i.preventDefault(),i.stopPropagation();const A=c.current;if(!A)return;const q=A.activeGroup;if(!q)return;const M=i.shiftKey?"below":"right";T(q.id,M)}else if(h==="r"&&!i.shiftKey&&B){const A=c.current;if(!A)return;const M=A.activePanel?.params?.browserId;if(!M)return;i.preventDefault(),i.stopPropagation(),z("browser_reload",{browserId:M}).catch(X=>{console.error("[DockviewBrowserContainer] browser_reload failed:",X)})}}};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[n,E,T,k]),t.useLayoutEffect(()=>{if(!n)return;const s=c.current,u=x.current;if(!s||!u)return;const p=u.getBoundingClientRect();if(p.width>0&&p.height>0){s.layout(Math.round(p.width),Math.round(p.height),!0);return}const a=new ResizeObserver(i=>{const h=i[0];if(!h)return;const{width:D,height:A}=h.contentRect;D<=0||A<=0||(a.disconnect(),s.layout(Math.round(D),Math.round(A),!0))});return a.observe(u),()=>a.disconnect()},[n]),t.useEffect(()=>{if(!n)return;const s=requestAnimationFrame(()=>{const u=c.current?.activePanel;u&&u.view.content.element.querySelector("[data-band-address-input]")?.focus()});return()=>cancelAnimationFrame(s)},[n]),t.useEffect(()=>{if(!B)return;let s;return(async()=>s=await K("browser-new-tab-shortcut",u=>{const p=c.current;if(!p)return;const a=u.payload.browser_id;!a||!p.getPanel(a)||k().then(()=>{requestAnimationFrame(()=>{c.current?.activePanel?.view.content.element.querySelector("[data-band-address-input]")?.focus()})})}))(),()=>s?.()},[k]),t.useEffect(()=>{if(!B)return;let s,u=!1;return(async()=>{const p=await K("browser-open-window",a=>{const i=c.current;if(!i)return;const h=a.payload.browser_id,D=h?i.getPanel(h):void 0;if(!D)return;const A=D.group?.id,q=a.payload.url;q&&k(A,{initialUrl:q}).then(()=>{requestAnimationFrame(()=>{c.current?.activePanel?.view.content.element.querySelector("[data-band-address-input]")?.focus()})}).catch(M=>{console.error("[DockviewBrowserContainer] browser-open-window add-tab failed:",M)})});u?p():s=p})(),()=>{u=!0,s?.()}},[k]),t.useEffect(()=>{if(!B)return;const s=[];let u=!1;const p=()=>{c.current?.activePanel?.view.content.element.querySelector("[data-band-address-input]")?.focus()};return(async()=>{const a=await Promise.all([K("browser-split-shortcut",i=>{const h=c.current;if(!h)return;const D=h.getPanel(i.payload.browser_id);D?.group&&T(D.group.id,i.payload.direction)}),K("browser-close-shortcut",i=>{const h=c.current;if(!h)return;const D=i.payload.browser_id;h.getPanel(D)&&E(D)}),K("browser-cycle-shortcut",i=>{const h=c.current;if(!h)return;const D=h.getPanel(i.payload.browser_id);if(!D)return;D.api.setActive();const A=()=>requestAnimationFrame(p);i.payload.target==="tabs"?ce(c.current,i.payload.direction,A):le(c.current,i.payload.direction,A)})]);if(u)for(const i of a)i();else s.push(...a)})(),()=>{u=!0;for(const a of s)a()}},[T,E]),t.useEffect(()=>{const s=()=>{const u=x.current;if(!u||u.offsetParent===null)return;const p=u.querySelectorAll("[data-band-address-input]");for(const a of p)if(a.offsetParent!==null){a.focus({preventScroll:!0});return}};return window.addEventListener("band:focus-browser",s),()=>window.removeEventListener("band:focus-browser",s)},[]),t.useEffect(()=>l.subscribeStatusEvents(s=>{if(s.workspaceId!==e)return;const u=c.current;if(u){if(s.kind==="browser-created"&&typeof s.browserId=="string"){if(u.getPanel(s.browserId))return;u.addPanel({id:s.browserId,component:"browserTab",tabComponent:"browserTab",title:"New Tab",params:{workspaceId:e,browserId:s.browserId},position:we(u)})}else if(s.kind==="browser-removed"&&typeof s.browserId=="string"){const p=u.getPanel(s.browserId);p&&(u.removePanel(p),u.panels.length===0&&V(u,e))}}}),[l,e]);const C=t.useRef({onAdd:()=>{},onSplit:()=>{},onClose:()=>{}});C.current={onAdd:k,onSplit:T,onClose:E},t.useEffect(()=>()=>{const s=c.current;s&&H.delete(s.id),y.current?.(),y.current=null,N.current?.(),N.current=null},[]);const I=t.useRef(null);I.current=j?.layout??null;const v=t.useRef(null);v.current=j?.browserIds??null;const S=t.useRef(null);S.current=j?.urls??null;const O=t.useRef(n);O.current=n;const R=t.useCallback(s=>{const u=c.current;u&&u.id!==s.api.id&&H.delete(u.id),c.current=s.api,H.set(s.api.id,C);const p=I.current,a=v.current,i=S.current;if(p&&Bt(p)){b.current=!0;const D=lt(p,i);try{s.api.fromJSON(D)}catch(q){console.error("[DockviewBrowserContainer] fromJSON failed, creating default:",q),V(s.api,e)}let A=0;if(a){const q=s.api.panels.filter(M=>!a.has(M.id));for(const M of q)s.api.removePanel(M),A++;s.api.panels.length===0&&(V(s.api,e),A++)}setTimeout(()=>{b.current=!1},0),A>0&&ee(e,s.api.toJSON(),{queryClient:_.current})}else V(s.api,e),ee(e,s.api.toJSON(),{queryClient:_.current});We(s.api),y.current?.(),y.current=Je(s.api),N.current?.(),x.current&&(N.current=Xe(x.current,s.api));const h=()=>F();if(s.api.onDidLayoutChange(h),s.api.onDidAddPanel(h),s.api.onDidRemovePanel(h),s.api.onDidActivePanelChange(h),s.api.onDidAddGroup(h),s.api.onDidRemoveGroup(h),O.current&&x.current){const D=x.current.getBoundingClientRect();D.width>0&&D.height>0&&s.api.layout(Math.round(D.width),Math.round(D.height),!0)}},[e,F]),f=t.useMemo(()=>({visible:n&&r!==!1,wsActive:r!==!1}),[n,r]);return j?o.jsx("div",{ref:x,className:"flex h-full w-full flex-col overflow-hidden",children:o.jsx(Ye.Provider,{value:f,children:o.jsx(Ze,{theme:Ft,className:"h-full",components:Lt,tabComponents:Mt,defaultTabComponent:ge,onReady:R,rightHeaderActionsComponent:qt})})}):o.jsx("div",{className:"flex h-full w-full items-center justify-center"})}function V(e,n){const r=oe();U.browsers.create.mutate({workspaceId:n,id:r}).catch(l=>{console.error("[DockviewBrowserContainer] error creating default browser:",l)}),e.addPanel({id:r,component:"browserTab",tabComponent:"browserTab",title:"Browser",params:{workspaceId:n,browserId:r},position:we(e)})}export{Kt as DockviewBrowserContainer,Ot as consumeBrowserFresh,he as markBrowserFresh,oe as newBrowserId};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPanel-DNBLPQEb.js","assets/main-3W4_bdX9.js","assets/main-BgcIGjy5.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{u as J,n as $,r as l,o as B,p as b,q as U,v as K,w as H,x as Q,y as X,j as f,z as Y,A as W,B as Z,C as ee,E as te,F as ne,X as re,G as ie,H as ae,J as oe,_ as le}from"./main-3W4_bdX9.js";import{S as ce}from"./square-terminal-DH5KC33k.js";const se=l.lazy(()=>le(()=>import("./TerminalPanel-DNBLPQEb.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.TerminalPanel})));function ue(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();const e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;const r=Array.from(e,o=>o.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function j(){return ue()}function z(e){return["terminalLayout",e]}const q=new Map;function fe(e){if(typeof e=="object"&&e!==null){const r=e.panels;if(typeof r=="object"&&r!==null)return new Set(Object.keys(r))}return new Set}function E(e,r,o){o?.queryClient&&o.queryClient.setQueryData(z(e),{layout:r,terminalIds:fe(r)});const a=q.get(e);a&&clearTimeout(a),q.set(e,setTimeout(()=>{q.delete(e),b.terminalLayout.save.mutate({workspaceId:e,tree:r}).catch(d=>{console.error("[DockviewTerminalContainer] failed to persist layout:",d)})},500))}function me(e){if(typeof e!="object"||e===null)return!1;const r=e;return typeof r.grid=="object"&&typeof r.panels=="object"}const de={name:"band",className:"dockview-theme-band dockview-terminal-tabs"};function pe({params:e,api:r}){const{visible:o}=ie(),a=l.useCallback(c=>{r.setTitle(c)},[r]);if(!e.workspaceId||!e.terminalId)return null;const d=e.command||e.cwd||e.env?{command:e.command,cwd:e.cwd,env:e.env}:void 0;return f.jsx("div",{className:"flex h-full w-full flex-col overflow-hidden","data-testid":`dockview-terminal-tab__visible-${o?"true":"false"}`,children:f.jsx(l.Suspense,{fallback:null,children:f.jsx(se,{workspaceId:e.workspaceId,terminalId:e.terminalId,visible:o,paneMetadata:d,autoFocus:e.autoFocus,onTitleChange:a})})})}function I(e){const[r,o]=l.useState(e.api.title??"Terminal"),[a,d]=l.useState(e.containerApi.panels.length);l.useEffect(()=>{const y=e.api.onDidTitleChange(()=>{o(e.api.title??"Terminal")});return()=>y.dispose()},[e.api]),l.useEffect(()=>{const y=e.containerApi,x=()=>d(y.panels.length),P=y.onDidAddPanel(x),D=y.onDidRemovePanel(x);return()=>{P.dispose(),D.dispose()}},[e.containerApi]);const c=e.containerApi,p=e.params.terminalId,h=l.useCallback(y=>{y.stopPropagation(),T.get(c.id)?.current?.onClose(p)},[c,p]),C=a>1;return f.jsxs("div",{className:"dv-default-tab",children:[f.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[f.jsx(ce,{className:"size-3.5 shrink-0 text-muted-foreground"}),f.jsx("span",{className:"truncate",children:r})]}),C&&f.jsx("button",{type:"button",className:"ml-1 inline-flex size-4 items-center justify-center rounded-sm opacity-60 hover:opacity-100 hover:bg-accent transition-colors",onClick:h,title:"Close terminal",children:f.jsx(re,{className:"size-3"})})]})}const T=new Map,ye=Z.memo(function(r){const o=(r.location?.type??"grid")==="grid",a=r.containerApi.id,d=r.group.id;return f.jsxs("div",{className:"flex h-full w-full items-center justify-center","data-testid":o?"dockview-terminal__toolbar":void 0,children:[o&&f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button",className:"inline-flex size-7 items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",onClick:()=>T.get(a)?.current?.onSplit(d,"right"),title:"Split right",children:f.jsx(ee,{className:"size-3.5"})}),f.jsx("button",{type:"button",className:"inline-flex size-7 items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",onClick:()=>T.get(a)?.current?.onSplit(d,"below"),title:"Split down",children:f.jsx(te,{className:"size-3.5"})})]}),f.jsx("button",{type:"button",className:"inline-flex size-7 items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",onClick:()=>T.get(a)?.current?.onAdd(d),title:"New terminal",children:f.jsx(ne,{className:"size-4"})})]})}),he={terminalTab:pe},ge={terminalTab:I};function Ce({workspaceId:e,visible:r,wsActive:o}){const a=J(),d=$(),c=l.useRef(null),p=l.useRef(!1),h=l.useRef(null),C=l.useRef(null),y=l.useRef(null),{data:x}=B({queryKey:z(e),queryFn:async()=>{const[{tree:t},{terminals:i}]=await Promise.all([b.terminalLayout.get.query({workspaceId:e}).catch(()=>({tree:null})),b.terminal.list.query({workspaceId:e}).catch(()=>({terminals:[]}))]);return{layout:t,terminalIds:new Set(i.map(s=>s.terminalId))}},staleTime:Number.POSITIVE_INFINITY}),P=l.useRef(d);P.current=d;const D=l.useCallback(()=>{if(p.current)return;const t=c.current;t&&E(e,t.toJSON(),{queryClient:P.current})},[e]),A=l.useCallback(async t=>{const i=c.current;if(!i)return;const s=j(),m={id:s,component:"terminalTab",tabComponent:"terminalTab",title:"Terminal",params:{workspaceId:e,terminalId:s,autoFocus:!0}};t&&(m.position={referenceGroup:t}),i.addPanel(m);try{await b.terminal.create.mutate({workspaceId:e,id:s})}catch(n){console.error("[DockviewTerminalContainer] error creating terminal:",n)}},[e]),N=l.useCallback(async(t,i)=>{const s=c.current;if(!s)return;const m=j();s.addPanel({id:m,component:"terminalTab",tabComponent:"terminalTab",title:"Terminal",params:{workspaceId:e,terminalId:m,autoFocus:!0},position:{referenceGroup:t,direction:i}});try{await b.terminal.create.mutate({workspaceId:e,id:m})}catch(n){console.error("[DockviewTerminalContainer] error creating split terminal:",n)}},[e]),S=l.useCallback(t=>{const i=c.current;if(!i||i.panels.length<=1)return;U(i,t);const s=i.getPanel(t);s&&i.removePanel(s),requestAnimationFrame(()=>{const m=i.activePanel;m&&m.view.content.element.querySelector(".xterm-helper-textarea")?.focus()}),b.terminal.kill.mutate({terminalId:t}).catch(m=>{console.error("[DockviewTerminalContainer] failed to kill terminal:",m)})},[]);l.useEffect(()=>{if(!r)return;const t=()=>{const n=c.current?.activePanel;n&&n.view.content.element.querySelector(".xterm-helper-textarea")?.focus()},i=n=>{ae(c.current,n,()=>{requestAnimationFrame(t)})},s=n=>{oe(c.current,n,()=>{requestAnimationFrame(t)})},m=n=>{if(!h.current?.contains(document.activeElement))return;const u=n.key.toLowerCase();if(n.ctrlKey&&!n.metaKey&&u==="tab"){n.preventDefault(),n.stopPropagation(),i(n.shiftKey?-1:1);return}if(!(n.metaKey||n.ctrlKey))return;if(n.shiftKey&&(u==="["||u==="]")){n.preventDefault(),n.stopPropagation(),i(u==="]"?1:-1);return}if(!n.shiftKey&&(u==="["||u==="]")){n.preventDefault(),n.stopPropagation(),s(u==="]"?1:-1);return}const g=()=>{const w=c.current;if(!w||w.panels.length<=1)return!1;const _=w.activePanel;return _?(S(_.id),!0):!1};if(u==="t"&&!n.shiftKey)n.preventDefault(),n.stopPropagation(),A();else if(u==="w"&&!n.shiftKey)g()&&(n.preventDefault(),n.stopPropagation());else if(u==="d")if(n.metaKey&&!n.ctrlKey){n.preventDefault(),n.stopPropagation();const w=c.current?.activeGroup;if(!w)return;N(w.id,n.shiftKey?"below":"right")}else n.ctrlKey&&!n.metaKey&&!n.shiftKey?g()&&(n.preventDefault(),n.stopPropagation()):(n.preventDefault(),n.stopPropagation())};return window.addEventListener("keydown",m,!0),()=>window.removeEventListener("keydown",m,!0)},[r,S,N,A]),l.useLayoutEffect(()=>{if(!r)return;const t=c.current,i=h.current;if(!t||!i)return;const s=i.getBoundingClientRect();if(s.width>0&&s.height>0){t.layout(Math.round(s.width),Math.round(s.height),!0);return}const m=new ResizeObserver(n=>{const u=n[0];if(!u)return;const{width:v,height:g}=u.contentRect;v<=0||g<=0||(m.disconnect(),t.layout(Math.round(v),Math.round(g),!0))});return m.observe(i),()=>m.disconnect()},[r]),l.useEffect(()=>{if(!r)return;const t=requestAnimationFrame(()=>{const i=c.current?.activePanel;i&&i.view.content.element.querySelector(".xterm-helper-textarea")?.focus()});return()=>cancelAnimationFrame(t)},[r]),l.useEffect(()=>a.subscribeStatusEvents(t=>{if(t.workspaceId!==e)return;const i=c.current;if(i){if(t.kind==="terminal-created"&&typeof t.terminalId=="string"){if(i.getPanel(t.terminalId))return;i.addPanel({id:t.terminalId,component:"terminalTab",tabComponent:"terminalTab",title:"Terminal",params:{workspaceId:e,terminalId:t.terminalId},position:K(i)})}else if(t.kind==="terminal-killed"&&typeof t.terminalId=="string"){const s=i.getPanel(t.terminalId);s&&(i.removePanel(s),i.panels.length===0&&R(i,e))}}}),[a,e]);const k=l.useRef({onAdd:()=>{},onSplit:()=>{},onClose:()=>{}});k.current={onAdd:A,onSplit:N,onClose:S},l.useEffect(()=>()=>{const t=c.current;t&&T.delete(t.id),C.current?.(),C.current=null,y.current?.(),y.current=null},[]);const F=l.useRef(null);F.current=x?.layout??null;const G=l.useRef(null);G.current=x?.terminalIds??null;const L=l.useRef(r);L.current=r;const O=l.useCallback(t=>{const i=c.current;i&&i.id!==t.api.id&&T.delete(i.id),c.current=t.api,T.set(t.api.id,k);const s=F.current,m=G.current;if(s&&me(s)){p.current=!0;try{t.api.fromJSON(s)}catch(v){console.error("[DockviewTerminalContainer] fromJSON failed, creating default:",v),R(t.api,e)}let u=0;if(m){const v=t.api.panels.filter(g=>!m.has(g.id));for(const g of v)t.api.removePanel(g),u++;t.api.panels.length===0&&(R(t.api,e),u++)}setTimeout(()=>{p.current=!1},0),u>0&&E(e,t.api.toJSON(),{queryClient:P.current})}else be(t.api,e,P.current);H(t.api),C.current?.(),C.current=Q(t.api),y.current?.(),h.current&&(y.current=X(h.current,t.api));const n=()=>D();if(t.api.onDidLayoutChange(n),t.api.onDidAddPanel(n),t.api.onDidRemovePanel(n),t.api.onDidActivePanelChange(n),t.api.onDidAddGroup(n),t.api.onDidRemoveGroup(n),L.current&&h.current){const u=h.current.getBoundingClientRect();u.width>0&&u.height>0&&t.api.layout(Math.round(u.width),Math.round(u.height),!0)}},[e,D]),V=l.useMemo(()=>({visible:r&&o!==!1,wsActive:o!==!1}),[r,o]);return x?f.jsx("div",{ref:h,className:"flex h-full w-full flex-col overflow-hidden",children:f.jsx(Y.Provider,{value:V,children:f.jsx(W,{theme:de,className:"h-full",components:he,tabComponents:ge,defaultTabComponent:I,onReady:O,rightHeaderActionsComponent:ye})})}):f.jsx("div",{className:"flex h-full w-full items-center justify-center"})}function R(e,r){const o=j();e.addPanel({id:o,component:"terminalTab",tabComponent:"terminalTab",title:"Terminal",params:{workspaceId:r,terminalId:o},position:K(e)}),b.terminal.create.mutate({workspaceId:r,id:o}).catch(a=>{console.error("[DockviewTerminalContainer] error creating default terminal:",a)})}async function be(e,r,o){try{const{config:a}=await b.workspace.getTerminalConfig.query({workspaceId:r});if(a?.layout){const d=M(a.layout);if(d.length>0){for(const c of d)try{const p=j();e.addPanel({id:p,component:"terminalTab",tabComponent:"terminalTab",title:c.name??"Terminal",params:{workspaceId:r,terminalId:p,command:c.command,cwd:c.cwd,env:c.env},position:K(e)}),await b.terminal.create.mutate({workspaceId:r,id:p,command:c.command,cwd:c.cwd,env:c.env})}catch(p){console.error("[DockviewTerminalContainer] error creating terminal from config:",p)}E(r,e.toJSON(),{queryClient:o});return}}}catch{}R(e,r)}function M(e,r=0){if(r>10||typeof e!="object"||e===null)return[];const o=e;if("pane"in o&&typeof o.pane=="object"&&o.pane!==null){const a=o.pane;return[{name:typeof a.name=="string"?a.name:void 0,command:typeof a.command=="string"?a.command:void 0,cwd:typeof a.cwd=="string"?a.cwd:void 0,env:typeof a.env=="object"&&a.env!==null?a.env:void 0}]}if("children"in o&&Array.isArray(o.children)){const a=[];for(const d of o.children)a.push(...M(d,r+1));return a}return[]}export{Ce as DockviewTerminalContainer,j as newTerminalId};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/xterm-AZ511Krh.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{m as Se,r as n,cc as Dt,cd as Mt,b_ as Qe,ce as Ue,cf as Ve,cg as Ze,j as c,ch as jt,X as It,ci as Bt,c6 as Wt,_ as H,cj as zt,ck as Ht,cl as qt,cm as Kt,cn as Ft}from"./main-3W4_bdX9.js";const Gt=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],Xt=Se("corner-down-left",Gt);const Yt=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],Qt=Se("slash",Yt);const Ut=[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]],Vt=Se("text-cursor-input",Ut),Zt=49,$e="(hover: none) and (pointer: coarse)";function nt(){const[t,a]=n.useState(()=>typeof window>"u"?!1:window.matchMedia($e).matches),[r,i]=n.useState(0);return n.useEffect(()=>{if(typeof window>"u")return;const l=window.matchMedia($e),w=h=>a(h.matches);return a(l.matches),l.addEventListener("change",w),()=>l.removeEventListener("change",w)},[]),n.useEffect(()=>{if(typeof window>"u")return;if(!t){i(0);return}const l=window.visualViewport;if(!l)return;const w=()=>{const h=Math.max(0,window.innerHeight-(l.offsetTop+l.height));i(h)};return w(),l.addEventListener("resize",w),l.addEventListener("scroll",w),window.addEventListener("resize",w),()=>{l.removeEventListener("resize",w),l.removeEventListener("scroll",w),window.removeEventListener("resize",w)}},[t]),{enabled:t,bottomOffset:r,contentBottomInset:t?Zt:0}}const xe=/[A-Za-z0-9_./:\-+@~]/;function $t(t,a,r,i){const l=i.getBoundingClientRect();if(l.width<=0||l.height<=0||r.cols<=0||r.rows<=0)return{col:0,row:r.buffer.active.viewportY};const w=l.width/r.cols,h=l.height/r.rows,p=ye(Math.floor((t-l.left)/w),0,r.cols-1),S=ye(Math.floor((a-l.top)/h),0,r.rows-1);return{col:p,row:r.buffer.active.viewportY+S}}function Jt(t,a){if(a<0||a>=t.length||!xe.test(t[a])){const l=ye(a,0,Math.max(0,t.length));return{start:l,end:l+1}}let r=a;for(;r>0&&xe.test(t[r-1]);)r--;let i=a+1;for(;i<t.length&&xe.test(t[i]);)i++;return{start:r,end:i}}function en(t,a){return t.buffer.active.getLine(a)?.translateToString(!1)??""}function tn(t,a,r){const i=r.cols,l=Math.max(0,r.buffer.active.length-1);switch(a){case"left":return t.col>0?{col:t.col-1,row:t.row}:t.row>0?{col:i-1,row:t.row-1}:t;case"right":return t.col<i-1?{col:t.col+1,row:t.row}:t.row<l?{col:0,row:t.row+1}:t;case"up":return t.row>0?{col:t.col,row:t.row-1}:t;case"down":return t.row<l?{col:t.col,row:t.row+1}:t}}function ce(t,a,r){const i=t.cols;if(i<=0)return;const l=a.row*i+a.col,w=r.row*i+r.col,h=Math.min(l,w),S=Math.max(l,w)-h+1,E=Math.floor(h/i),R=h-E*i;t.select(R,E,S)}function nn(t,a){const{start:r,end:i}=Jt(a,t.col);return{anchor:{col:r,row:t.row},head:{col:Math.max(r,i-1),row:t.row}}}function ye(t,a,r){return t<a?a:t>r?r:t}const rn="\x1B",on=" ",sn="\r",cn="/",an="\x1B[A",ln="\x1B[B",un="\x1B[C",dn="\x1B[D",_=t=>a=>{a.preventDefault(),t()};function fn({terminal:t,sendInput:a,pendingCtrl:r,onToggleCtrl:i,selectionMode:l,onExtendSelection:w,onExitSelection:h,onSelectAll:p}){const{enabled:S,bottomOffset:E}=nt(),R=n.useCallback(async()=>{if(!t.hasSelection())return;const v=t.getSelection();if(!v)return;await Dt(v)||console.warn("[TerminalToolbar] clipboard write failed")},[t]),g=n.useCallback(async()=>{await R(),h()},[R,h]),q=n.useCallback(async()=>{const v=await Mt();v&&a(v)},[a]),N=n.useMemo(()=>[{label:"Esc",seq:rn,ariaLabel:"Send Escape"},{label:"Tab",seq:on,ariaLabel:"Send Tab"}],[]),K=n.useMemo(()=>[{Icon:Qe,seq:dn,ariaLabel:"Arrow Left"},{Icon:Ue,seq:an,ariaLabel:"Arrow Up"},{Icon:Ve,seq:ln,ariaLabel:"Arrow Down"},{Icon:Ze,seq:un,ariaLabel:"Arrow Right"}],[]),F=n.useMemo(()=>[{Icon:Qe,dir:"left",ariaLabel:"Extend selection left"},{Icon:Ue,dir:"up",ariaLabel:"Extend selection up"},{Icon:Ve,dir:"down",ariaLabel:"Extend selection down"},{Icon:Ze,dir:"right",ariaLabel:"Extend selection right"}],[]);return S?c.jsx("div",{"data-testid":"terminal-toolbar","data-mode":l?"selection":"idle",role:"toolbar","aria-label":l?"Terminal selection controls":"Terminal accessory keys",style:{bottom:E},className:"fixed inset-x-0 z-50 flex justify-center border-t border-border bg-background/95 shadow-lg backdrop-blur-md",children:c.jsxs("div",{className:"flex w-full max-w-3xl items-center gap-1 px-2 py-1.5",children:[c.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:l?c.jsxs(c.Fragment,{children:[c.jsxs(A,{ariaLabel:"Copy selection and exit",title:"Copy",onPointerDown:_(g),variant:"primary",children:[c.jsx(jt,{className:"size-4"}),c.jsx("span",{className:"text-xs",children:"Copy"})]}),c.jsxs(A,{ariaLabel:"Exit selection mode",title:"Done",onPointerDown:_(h),children:[c.jsx(It,{className:"size-4"}),c.jsx("span",{className:"text-xs",children:"Done"})]}),c.jsx("div",{className:"mx-1 h-6 w-px shrink-0 bg-border","aria-hidden":"true"}),c.jsx("span",{className:"mr-1 shrink-0 select-none text-xs font-medium uppercase tracking-wide text-muted-foreground","aria-hidden":"true",children:"Extend"}),F.map(({Icon:v,dir:L,ariaLabel:y})=>c.jsx(A,{ariaLabel:y,title:y,onPointerDown:_(()=>w(L)),children:c.jsx(v,{className:"size-4"})},L))]}):c.jsxs(c.Fragment,{children:[c.jsxs(A,{ariaLabel:"Paste from clipboard",title:"Paste",onPointerDown:_(q),children:[c.jsx(Bt,{className:"size-4"}),c.jsx("span",{className:"text-xs",children:"Paste"})]}),c.jsxs(A,{ariaLabel:"Select all",title:"Select all",onPointerDown:_(p),children:[c.jsx(Vt,{className:"size-4"}),c.jsx("span",{className:"text-xs",children:"All"})]}),c.jsx("div",{className:"mx-1 h-6 w-px shrink-0 bg-border","aria-hidden":"true"}),N.map(({label:v,seq:L,ariaLabel:y})=>c.jsx(A,{ariaLabel:y,title:v,onPointerDown:_(()=>a(L)),children:c.jsx("span",{className:"text-xs font-medium",children:v})},v)),c.jsx(A,{ariaLabel:"Send slash",title:"Slash command",onPointerDown:_(()=>a(cn)),children:c.jsx(Qt,{className:"size-4"})}),c.jsx(A,{ariaLabel:r?"Cancel pending Ctrl":"Arm Ctrl modifier",title:"Ctrl (sticky — taps the next key as Ctrl+key)",onPointerDown:_(i),active:r,children:c.jsx("span",{className:"text-xs font-medium",children:"Ctrl"})}),c.jsx("div",{className:"mx-1 h-6 w-px shrink-0 bg-border","aria-hidden":"true"}),K.map(({Icon:v,seq:L,ariaLabel:y})=>c.jsx(A,{ariaLabel:y,title:y,onPointerDown:_(()=>a(L)),children:c.jsx(v,{className:"size-4"})},y))]})}),c.jsx("div",{className:"h-6 w-px shrink-0 bg-border","aria-hidden":"true"}),c.jsx(A,{ariaLabel:"Send Enter",title:"Enter",onPointerDown:_(()=>a(sn)),variant:"primary",children:c.jsx(Xt,{className:"size-4"})})]})}):null}function A({ariaLabel:t,title:a,onPointerDown:r,active:i,variant:l="default",disabled:w,children:h}){const p=i?"bg-primary text-primary-foreground":l==="primary"?"bg-primary text-primary-foreground hover:bg-primary/90":"bg-muted/60 hover:bg-muted active:bg-muted";return c.jsx("button",{type:"button","aria-label":t,"aria-pressed":i,title:a,onPointerDown:r,disabled:w,className:["inline-flex h-9 min-w-9 shrink-0 items-center justify-center gap-1 rounded-md px-2","text-foreground transition-colors",p,"disabled:opacity-40"].join(" "),children:h})}const Je=13,hn=500,et=10,mn={matchBackground:"#515c6a",activeMatchBackground:"#a9913680",matchOverviewRuler:"#a9913680",activeMatchColorOverviewRuler:"#a99136"},wn={caseSensitive:!1,wholeWord:!1,regex:!1};function Ee(t){return{caseSensitive:t.caseSensitive,wholeWord:t.wholeWord,regex:t.regex,decorations:mn}}const pn={background:"#1e1e1e",foreground:"#e8e8e8",cursor:"#e8e8e8",selectionBackground:"rgba(255, 255, 255, 0.2)",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#e5e5e5"},bn={background:"#ffffff",foreground:"#1e1e1e",cursor:"#1e1e1e",cursorAccent:"#ffffff",selectionBackground:"rgba(0, 0, 0, 0.15)",black:"#000000",red:"#cd3131",green:"#0a8043",yellow:"#946800",blue:"#0451a5",magenta:"#bc05bc",cyan:"#0598bc",white:"#555555",brightBlack:"#666666",brightRed:"#cd3131",brightGreen:"#0a8043",brightYellow:"#946800",brightBlue:"#0451a5",brightMagenta:"#bc05bc",brightCyan:"#0598bc",brightWhite:"#1e1e1e"};function vn(){return document.documentElement.classList.contains("dark")}function tt(){return vn()?pn:bn}function yn({workspaceId:t,terminalId:a,visible:r,paneMetadata:i,autoFocus:l,onTitleChange:w}){const h=n.useRef(null),p=n.useRef(null),S=n.useRef(null),E=n.useRef(null),R=n.useRef(null),g=n.useRef(null),q=n.useRef(null),N=n.useRef(!1),K=n.useRef(r);K.current=r;const F=n.useRef(w);F.current=w;const{settings:v}=Wt(),L=v.useWebGLTerminalRenderer??!0,y=n.useRef(L);y.current=L;const[rt,Re]=n.useState(!1),[C,Le]=n.useState(""),[O,ot]=n.useState(wn),[st,ae]=n.useState({total:0,current:0}),ie=n.useRef(null),Ce=n.useRef(()=>{}),_e=n.useRef(()=>{}),[ct,Ae]=n.useState(!1),j=n.useRef(!1),[at,J]=n.useState(!1),it=n.useCallback(()=>{const d=!j.current;j.current=d,J(d)},[]),T=n.useRef(null),k=n.useRef(null),[lt,G]=n.useState(!1),ut=n.useCallback(()=>{T.current=null,k.current=null,G(!1),p.current?.clearSelection()},[]),dt=n.useCallback(d=>{const m=p.current,x=T.current,P=k.current;if(!m||!x||!P)return;const te=tn(P,d,m);k.current=te,ce(m,x,te)},[]),ft=n.useCallback(()=>{const d=p.current;if(!d)return;const m={col:0,row:0},x=Math.max(0,d.buffer.active.length-1),P={col:Math.max(0,d.cols-1),row:x};ce(d,m,P),T.current=m,k.current=P,G(!0),d.blur()},[]);n.useEffect(()=>{if(!h.current)return;let d=!1,m;return Promise.all([H(()=>import("./xterm-iwIWEtGc.js"),[]),H(()=>import("./addon-fit-DX4qG4td.js"),[]),H(()=>import("./addon-web-links-DIbG5aQx.js"),[]),H(()=>import("./addon-search-DCE88ROn.js"),[]),H(()=>import("./addon-webgl-CeRvQWkA.js"),[])]).then(([x,P,te,vt,gt])=>{const{Terminal:xt}=x,{FitAddon:Et}=P,{WebLinksAddon:yt}=te,{SearchAddon:St}=vt,{WebglAddon:Rt}=gt;if(d||!h.current)return;const Te=y.current;H(()=>Promise.resolve({}),__vite__mapDeps([0]));const o=new xt({allowProposedApi:!0,cursorBlink:!0,fontSize:Je*zt(),fontFamily:"'SF Mono', Menlo, Monaco, 'Courier New', monospace",lineHeight:Te?1.2:1,macOptionIsMeta:!0,scrollback:1e4,theme:tt()}),ke=new MutationObserver(()=>{o.options.theme=tt()});ke.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]});const Y=new Et;o.loadAddon(Y),o.loadAddon(new yt((e,s)=>Ht(s))),o.open(h.current);let le;const ue=()=>{try{const e=new Rt({customGlyphs:!0});o.loadAddon(e);const u=h.current?.querySelector(".xterm-screen")?.querySelector(":scope > canvas:last-of-type");return u&&(u.style.pointerEvents="none",u.style.touchAction="none"),R.current=e,le?.dispose(),le=e.onContextLoss(()=>{console.warn("[TerminalPanel] WebGL context lost, reattaching addon"),e.dispose(),R.current=null,ue()}),!0}catch(e){return console.warn("[TerminalPanel] WebGL renderer unavailable, falling back to DOM",e),!1}};Te&&ue();const de=new St;o.loadAddon(de);const Lt=de.onDidChangeResults(e=>{ae({total:e.resultCount,current:e.resultIndex>=0?e.resultIndex+1:0})});o.attachCustomKeyEventHandler(e=>{if(e.type==="keydown"){if(j.current&&e.key.length===1&&!e.metaKey&&!e.altKey&&!e.ctrlKey){const u=e.key.toLowerCase().charCodeAt(0);if(u>=97&&u<=122)return o.input(String.fromCharCode(u-96)),j.current=!1,J(!1),e.preventDefault(),!1;j.current=!1,J(!1)}if((e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey&&e.key.toLowerCase()==="f")return e.preventDefault(),Ce.current(),!1;if(e.key==="Enter"&&e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey)return e.preventDefault(),o.input(`
|
|
3
|
-
`),!1;if(e.altKey&&!e.metaKey&&!e.ctrlKey){if(e.key==="ArrowLeft")return o.input("\x1Bb"),!1;if(e.key==="ArrowRight")return o.input("\x1Bf"),!1}}return!0}),p.current=o,S.current=Y,E.current=de,Ae(!0);const f=h.current;let Q=null;const Ne=e=>{Q=e.touches.length===1?e.touches[0].clientY:null},Oe=e=>{if(e.touches.length!==1||Q===null)return;const s=e.touches[0].clientY,u=Q-s,b=f.querySelector(".xterm-viewport"),M=b&&o.rows>0?b.clientHeight/o.rows:17,$=Math.trunc(u/M);$!==0&&(o.scrollLines($),Q=s+(u-$*M),e.preventDefault())},ne=()=>{Q=null};f.addEventListener("touchstart",Ne,{passive:!0}),f.addEventListener("touchmove",Oe,{passive:!1}),f.addEventListener("touchend",ne,{passive:!0}),f.addEventListener("touchcancel",ne,{passive:!0});let U=null,I=null;const D=()=>{U!==null&&(window.clearTimeout(U),U=null),I=null},Pe=e=>{if(D(),e.touches.length!==1)return;const s=e.touches[0];I={x:s.clientX,y:s.clientY},U=window.setTimeout(()=>{U=null;const u=I;if(!u)return;const b=f.querySelector(".xterm-screen");if(!b)return;const M=$t(u.x,u.y,o,b),$=en(o,M.row),{anchor:Xe,head:Ye}=nn(M,$);if(ce(o,Xe,Ye),T.current=Xe,k.current=Ye,G(!0),B=null,W=null,o.blur(),typeof navigator.vibrate=="function")try{navigator.vibrate(15)}catch{}},hn)},De=e=>{if(!I||e.touches.length!==1)return;const s=e.touches[0],u=Math.abs(s.clientX-I.x),b=Math.abs(s.clientY-I.y);(u>et||b>et)&&D()};f.addEventListener("touchstart",Pe,{passive:!0}),f.addEventListener("touchmove",De,{passive:!0}),f.addEventListener("touchend",D,{passive:!0}),f.addEventListener("touchcancel",D,{passive:!0});let B=null,W=null;const Me=e=>{e.touches.length===1?(B=e.touches[0].clientX,W=e.touches[0].clientY):(B=null,W=null)},je=e=>{const s=B,u=W;if(B=null,W=null,s===null||u===null||e.changedTouches.length!==1)return;const b=Math.abs(e.changedTouches[0].clientX-s),M=Math.abs(e.changedTouches[0].clientY-u);b<10&&M<10&&(T.current!==null&&(T.current=null,k.current=null,G(!1),o.clearSelection()),o.focus())},Ie=()=>{B=null,W=null};f.addEventListener("touchstart",Me,{passive:!0}),f.addEventListener("touchend",je,{passive:!0}),f.addEventListener("touchcancel",Ie,{passive:!0});const Ct=`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/terminal?workspaceId=${encodeURIComponent(t)}&terminalId=${encodeURIComponent(a)}`,_t=1e4,At=2e4,Tt=500,Be=1e4;let V=!1,fe=!1,re=0,z=null,oe=null,he=0;const me=()=>{z!==null&&(clearTimeout(z),z=null)},we=()=>{oe!==null&&(clearInterval(oe),oe=null)},We=()=>{const e=g.current;if(!(!e||e.readyState!==WebSocket.OPEN)){if(Date.now()-he>At){e.close();return}try{e.send(JSON.stringify({type:"ping"}))}catch{e.close()}}},kt=()=>{if(V||z!==null)return;const e=Math.min(Tt*2**re,Be);e<Be&&(re+=1),z=setTimeout(()=>{z=null,pe()},e)};function pe(){if(V)return;me();const e=fe,s=new WebSocket(Ct);g.current=s,s.binaryType="arraybuffer",s.onopen=()=>{if(re=0,he=Date.now(),e&&o.reset(),!fe&&i&&(i.command||i.cwd||i.env)){const u={type:"init"};i.command&&(u.command=i.command),i.cwd&&(u.cwd=i.cwd),i.env&&(u.env=i.env),s.send(JSON.stringify(u))}fe=!0,Y.fit(),s.send(JSON.stringify({type:"resize",cols:o.cols,rows:o.rows})),l&&!e&&o.focus(),we(),oe=setInterval(We,_t),_e.current()},s.onmessage=u=>{if(u.data instanceof ArrayBuffer)o.write(new Uint8Array(u.data));else try{const b=JSON.parse(u.data);b.type==="pong"?he=Date.now():b.type==="title"&&typeof b.title=="string"&&F.current?.(b.title)}catch{o.write(u.data)}},s.onclose=()=>{g.current===s&&(we(),!V&&(o.write(`\r
|
|
4
|
-
\x1B[90m[Reconnecting…]\x1B[0m\r
|
|
5
|
-
`),kt()))}}const be=()=>{if(V)return;const e=g.current;!e||e.readyState===WebSocket.CLOSED||e.readyState===WebSocket.CLOSING?(re=0,me(),pe()):e.readyState===WebSocket.OPEN&&We()},ze=()=>{document.hidden||be()};window.addEventListener("online",be),document.addEventListener("visibilitychange",ze),pe(),o.onData(e=>{const s=g.current;s&&s.readyState===WebSocket.OPEN&&s.send(e)}),o.onTitleChange(e=>{F.current?.(e)});let Z=null;const Nt=()=>{Z===null&&(!T.current||!k.current||(Z=requestAnimationFrame(()=>{Z=null;const e=T.current,s=k.current;e&&s&&ce(o,e,s)})))},Ot=o.onResize(Nt);let He=window.devicePixelRatio;const qe=()=>{const e=g.current;!e||e.readyState!==WebSocket.OPEN||o.cols<=0||o.rows<=0||e.send(JSON.stringify({type:"resize",cols:o.cols,rows:o.rows}))},ve=(e={})=>{const{newFontSize:s}=e;if(s!==void 0)o.options.fontSize!==s&&(o.options.fontSize=s);else{const b=o.options.fontSize;typeof b=="number"&&(o.options.fontSize=b+1,o.options.fontSize=b)}const u=R.current;u&&(u.dispose(),R.current=null,ue()),Y.fit(),K.current||(N.current=!1)};q.current=()=>ve(),N.current=K.current;const Ke=()=>{const e=window.devicePixelRatio;return e===He?!1:(He=e,ve(),!0)},Fe=new ResizeObserver(e=>{const s=e[0];if(!s||s.contentRect.width===0||s.contentRect.height===0)return;Ke()||Y.fit(),qe()});Fe.observe(h.current);const Pt=qt(e=>{const s=Math.round(Je*e*100)/100;o.options.fontSize!==s&&(ve({newFontSize:s}),qe())});let se;const Ge=()=>{se=window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),se.addEventListener("change",ge)},ge=()=>{Ke(),se?.removeEventListener("change",ge),Ge()};Ge(),m=()=>{V=!0,me(),we(),window.removeEventListener("online",be),document.removeEventListener("visibilitychange",ze),ke.disconnect(),Fe.disconnect(),Lt.dispose(),Ot.dispose(),Z!==null&&cancelAnimationFrame(Z),le?.dispose(),se?.removeEventListener("change",ge),Pt(),D(),f.removeEventListener("touchstart",Ne),f.removeEventListener("touchmove",Oe),f.removeEventListener("touchend",ne),f.removeEventListener("touchcancel",ne),f.removeEventListener("touchstart",Pe),f.removeEventListener("touchmove",De),f.removeEventListener("touchend",D),f.removeEventListener("touchcancel",D),f.removeEventListener("touchstart",Me),f.removeEventListener("touchend",je),f.removeEventListener("touchcancel",Ie),g.current?.close(),o.dispose(),p.current=null,S.current=null,E.current=null,R.current=null,q.current=null,N.current=!1,g.current=null,T.current=null,k.current=null,j.current=!1,G(!1),J(!1),Ae(!1)}}),()=>{d=!0,m?.()}},[a,t,i,l]),n.useEffect(()=>{r&&S.current&&requestAnimationFrame(()=>{const d=q.current;d&&!N.current?d():S.current?.fit(),N.current=!0;const m=p.current,x=g.current;m&&x?.readyState===WebSocket.OPEN&&m.cols>0&&m.rows>0&&x.send(JSON.stringify({type:"resize",cols:m.cols,rows:m.rows}))})},[r]),n.useEffect(()=>{const d=()=>{r&&p.current?.focus()};return window.addEventListener("band:focus-terminal",d),()=>window.removeEventListener("band:focus-terminal",d)},[r]);const ee=n.useRef(null),X=n.useCallback(()=>{const d=ee.current;if(!d)return;const m=g.current;m?.readyState===WebSocket.OPEN&&(m.send(d),ee.current=null,p.current?.focus())},[]);_e.current=X,n.useEffect(()=>{r?X():ee.current=null},[r,X]),n.useEffect(()=>{const d=m=>{const x=m.detail;!x?.reference||x.workspaceId!==t||(ee.current=x.reference,r&&X())};return window.addEventListener("band:terminal-insert",d),()=>window.removeEventListener("band:terminal-insert",d)},[r,t,X]);const ht=n.useCallback(()=>{Re(!0),requestAnimationFrame(()=>{ie.current?.focus(),ie.current?.select()})},[]);Ce.current=ht;const mt=n.useCallback(()=>{E.current?.clearDecorations(),Re(!1),Le(""),ae({total:0,current:0}),p.current?.focus()},[]),wt=n.useCallback(()=>{C&&E.current?.findNext(C,Ee(O))},[C,O]),pt=n.useCallback(()=>{C&&E.current?.findPrevious(C,Ee(O))},[C,O]);n.useEffect(()=>{const d=E.current;if(d){if(!C){d.clearDecorations(),ae({total:0,current:0});return}d.findNext(C,Ee(O))}},[C,O]);const{contentBottomInset:bt}=nt();return c.jsxs("div",{className:"relative flex h-full w-full flex-col",children:[rt&&c.jsx(Kt,{ref:ie,query:C,onQueryChange:Le,options:O,onOptionsChange:ot,placeholder:"Find in terminal...",matchInfo:st,onNext:wt,onPrevious:pt,onClose:mt}),c.jsx("div",{className:"relative min-h-0 flex-1",children:c.jsx("div",{ref:h,className:"absolute inset-x-2 top-2 overflow-hidden",style:{bottom:8+bt,zoom:`calc(1 / var(${Ft}, 1))`}})}),ct&&p.current&&c.jsx(fn,{terminal:p.current,sendInput:d=>{const m=g.current;m?.readyState===WebSocket.OPEN&&m.send(d)},pendingCtrl:at,onToggleCtrl:it,selectionMode:lt,onExtendSelection:dt,onExitSelection:ut,onSelectAll:ft})]})}export{yn as TerminalPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{am as n,an as o}from"./main-3W4_bdX9.js";const t=(a,r)=>n.lang.round(o.parse(a)[r]);export{t as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-B4BG7PRW-C9SV78wP.js";import{W as i}from"./main-3W4_bdX9.js";import"./chunk-FMBD7UC4-xclQ8Cf4.js";import"./chunk-55IACEB6-DNYJbC9p.js";import"./chunk-QN33PNHL-CbKttxM9.js";var u={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{u as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-B4BG7PRW-C9SV78wP.js";import{W as i}from"./main-3W4_bdX9.js";import"./chunk-FMBD7UC4-xclQ8Cf4.js";import"./chunk-55IACEB6-DNYJbC9p.js";import"./chunk-QN33PNHL-CbKttxM9.js";var u={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{u as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as r}from"./_baseUniq-9xolxnuZ.js";var e=4;function a(o){return r(o,e)}export{a as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,j as e,bM as m,bN as n,bO as d,bP as p,bQ as S,bR as u,bS as i,bT as l,bU as b}from"./main-3W4_bdX9.js";const f="band:sidebar-width";function j(){try{const t=localStorage.getItem(f);if(t){const s=Number.parseFloat(t);if(!Number.isNaN(s)&&s>0&&s<100)return s}}catch{}return null}function g(t){try{localStorage.setItem(f,String(t))}catch{}}const c="15rem",v="60%";function N({toolbarMenuItems:t}){const s=j(),x=s?{sidebar:s,main:100-s}:void 0,r=o.useRef(!0),h=o.useCallback(a=>{if(r.current){r.current=!1;return}a.sidebar!=null&&g(a.sidebar)},[]);return e.jsx("div",{className:"flex h-full w-full overflow-hidden bg-background text-foreground",children:e.jsxs(m,{orientation:"horizontal",defaultLayout:x,onLayoutChanged:h,children:[e.jsx(n,{id:"sidebar",defaultSize:c,minSize:c,maxSize:v,collapsible:!0,collapsedSize:"0%",children:e.jsx("div",{className:"h-full border-r border-border overflow-hidden",children:e.jsx(d,{toolbarMenuItems:t})})}),e.jsx(p,{className:"w-[3px] bg-transparent hover:bg-accent-foreground/20 active:bg-accent-foreground/30 transition-colors cursor-col-resize"}),e.jsx(n,{id:"main",minSize:"20%",children:e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-center px-8",children:[e.jsx(S,{className:"size-8 text-muted-foreground/30"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a workspace to get started"})]})})})})]})})}function D(){return u()||b?e.jsx(i,{children:e.jsx(N,{toolbarMenuItems:e.jsx(l,{})})}):e.jsx(i,{children:e.jsx(d,{toolbarMenuItems:e.jsx(l,{})})})}function k(){return u()||b?null:e.jsx("div",{className:"h-dvh pb-4 standalone:pb-[env(safe-area-inset-bottom)]",children:e.jsx(D,{})})}export{k as component};
|