termdock 1.4.295 → 1.4.297
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/.desktop-dist/main.js +35 -2
- package/README.en.md +257 -0
- package/README.md +284 -133
- package/dist/client/assets/App-BbqtNY2x.js +177 -0
- package/dist/client/assets/App-BbqtNY2x.js.br +0 -0
- package/dist/client/assets/App-BbqtNY2x.js.gz +0 -0
- package/dist/client/assets/{ChangeWalkthroughPanel-Dv5XRtRh.js → ChangeWalkthroughPanel-CvQJIp_C.js} +1 -1
- package/dist/client/assets/ChangeWalkthroughPanel-CvQJIp_C.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-CvQJIp_C.js.gz +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-B0OgRtyR.js +1 -0
- package/dist/client/assets/CollaborationMainWorkspace-B0OgRtyR.js.br +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-B0OgRtyR.js.gz +0 -0
- package/dist/client/assets/CollaborationTaskContent-C01GXOEq.js +2 -0
- package/dist/client/assets/ComputerControlView-CW1uA133.js +4 -0
- package/dist/client/assets/ComputerControlView-CW1uA133.js.br +0 -0
- package/dist/client/assets/ComputerControlView-CW1uA133.js.gz +0 -0
- package/dist/client/assets/{DagPlayground-mq69dKyr.js → DagPlayground-CdE3tQsl.js} +1 -1
- package/dist/client/assets/DagPlayground-CdE3tQsl.js.br +0 -0
- package/dist/client/assets/DagPlayground-CdE3tQsl.js.gz +0 -0
- package/dist/client/assets/{DiffLab-BqdHYGi5.js → DiffLab-BLGNnazd.js} +1 -1
- package/dist/client/assets/DiffLab-BLGNnazd.js.br +0 -0
- package/dist/client/assets/DiffLab-BLGNnazd.js.gz +0 -0
- package/dist/client/assets/{DiffReview-BvzGxpuc.js → DiffReview-CYw3ASI6.js} +1 -1
- package/dist/client/assets/DiffReview-CYw3ASI6.js.br +0 -0
- package/dist/client/assets/DiffReview-CYw3ASI6.js.gz +0 -0
- package/dist/client/assets/{DiffReviewLab-DrfddB7x.js → DiffReviewLab-CySIuWq_.js} +1 -1
- package/dist/client/assets/DiffReviewLab-CySIuWq_.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-CySIuWq_.js.gz +0 -0
- package/dist/client/assets/{DiffViewer-3bJV_A5s.js → DiffViewer-WsYvN75z.js} +13 -13
- package/dist/client/assets/DiffViewer-WsYvN75z.js.br +0 -0
- package/dist/client/assets/DiffViewer-WsYvN75z.js.gz +0 -0
- package/dist/client/assets/{ModelPreview-CX7VtoJB.js → ModelPreview-Dnlx9ByX.js} +1 -1
- package/dist/client/assets/ModelPreview-Dnlx9ByX.js.br +0 -0
- package/dist/client/assets/ModelPreview-Dnlx9ByX.js.gz +0 -0
- package/dist/client/assets/RightSidebar-Cp5b_y0u.js +1678 -0
- package/dist/client/assets/RightSidebar-Cp5b_y0u.js.br +0 -0
- package/dist/client/assets/RightSidebar-Cp5b_y0u.js.gz +0 -0
- package/dist/client/assets/{abnfDiagram-VCTEODGH-PJwhLTPH.js → abnfDiagram-VCTEODGH-CK1mGFRQ.js} +1 -1
- package/dist/client/assets/abnfDiagram-VCTEODGH-CK1mGFRQ.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-CK1mGFRQ.js.gz +0 -0
- package/dist/client/assets/app-DfACMixk.js +35 -0
- package/dist/client/assets/app-DfACMixk.js.br +0 -0
- package/dist/client/assets/app-DfACMixk.js.gz +0 -0
- package/dist/client/assets/{arc-l3FXjCEl.js → arc-yZE1gqDl.js} +1 -1
- package/dist/client/assets/arc-yZE1gqDl.js.br +0 -0
- package/dist/client/assets/arc-yZE1gqDl.js.gz +0 -0
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-DdNbKi-4.js → architectureDiagram-5GKGNRK7-U5XSC7cY.js} +1 -1
- package/dist/client/assets/architectureDiagram-5GKGNRK7-U5XSC7cY.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-U5XSC7cY.js.gz +0 -0
- package/dist/client/assets/{blockDiagram-I7D4REHJ-Cu63oaxR.js → blockDiagram-I7D4REHJ-pVJnntSG.js} +1 -1
- package/dist/client/assets/blockDiagram-I7D4REHJ-pVJnntSG.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-pVJnntSG.js.gz +0 -0
- package/dist/client/assets/{c4Diagram-7LVT6UL2-DQiV_yk6.js → c4Diagram-7LVT6UL2-Bwz0AJJV.js} +1 -1
- package/dist/client/assets/c4Diagram-7LVT6UL2-Bwz0AJJV.js.br +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-Bwz0AJJV.js.gz +0 -0
- package/dist/client/assets/channel-qqjDJtcZ.js +1 -0
- package/dist/client/assets/{chunk-2Q5K7J3B-COKJ79Ld.js → chunk-2Q5K7J3B-CXJ1kP4X.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-BfV-m7oa.js → chunk-5VM5RSS4-Dpdum_2z.js} +1 -1
- package/dist/client/assets/{chunk-F27PBJKO-sLDCEnU8.js → chunk-F27PBJKO-BCG5Zi_-.js} +1 -1
- package/dist/client/assets/chunk-F27PBJKO-BCG5Zi_-.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-BCG5Zi_-.js.gz +0 -0
- package/dist/client/assets/{chunk-IMKFNOWR-DYu5qS7g.js → chunk-IMKFNOWR-BM-GcNcv.js} +1 -1
- package/dist/client/assets/chunk-IMKFNOWR-BM-GcNcv.js.br +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-BM-GcNcv.js.gz +0 -0
- package/dist/client/assets/{chunk-JWPE2WC7-DixkILcl.js → chunk-JWPE2WC7-BWiXpQT9.js} +1 -1
- package/dist/client/assets/{chunk-POPQ4Y6H-CfW5Vm_-.js → chunk-POPQ4Y6H-vQSslMNv.js} +1 -1
- package/dist/client/assets/{chunk-SVP7TREG-nJnbUFzs.js → chunk-SVP7TREG-Aqfz6nPA.js} +1 -1
- package/dist/client/assets/chunk-SVP7TREG-Aqfz6nPA.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-Aqfz6nPA.js.gz +0 -0
- package/dist/client/assets/{chunk-TICWLB2K-BwyiSQgx.js → chunk-TICWLB2K-DDjekMd0.js} +1 -1
- package/dist/client/assets/chunk-TICWLB2K-DDjekMd0.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-DDjekMd0.js.gz +0 -0
- package/dist/client/assets/{chunk-XXDRQBXY-TCk4c2XN.js → chunk-XXDRQBXY-BegIBcFg.js} +1 -1
- package/dist/client/assets/classDiagram-ZZMXUADV-BDuBrfNz.js +1 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-BDuBrfNz.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-rroo-EOb.js → cose-bilkent-JH36ORCC-B2izFsBY.js} +1 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-B2izFsBY.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-B2izFsBY.js.gz +0 -0
- package/dist/client/assets/{cynefin-OW5HDTMX-CkFeV85k.js → cynefin-OW5HDTMX-C7HA99Zc.js} +1 -1
- package/dist/client/assets/cynefin-OW5HDTMX-C7HA99Zc.js.br +0 -0
- package/dist/client/assets/{cynefin-OW5HDTMX-CkFeV85k.js.gz → cynefin-OW5HDTMX-C7HA99Zc.js.gz} +0 -0
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-hBwpU_bW.js → cynefinDiagram-5FMLGOSQ-vNIzcCYl.js} +1 -1
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-vNIzcCYl.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-vNIzcCYl.js.gz +0 -0
- package/dist/client/assets/{dagre-GXQ25YYZ-B321-hdp.js → dagre-GXQ25YYZ-Bv9WHNT9.js} +1 -1
- package/dist/client/assets/dagre-GXQ25YYZ-Bv9WHNT9.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-Bv9WHNT9.js.gz +0 -0
- package/dist/client/assets/{diagram-S7CK7UJ4-bY87_ptA.js → diagram-S7CK7UJ4-DFg5UNic.js} +1 -1
- package/dist/client/assets/diagram-S7CK7UJ4-DFg5UNic.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-DFg5UNic.js.gz +0 -0
- package/dist/client/assets/{diagram-UQ7AKVKN--cez0H_o.js → diagram-UQ7AKVKN-BFQsCAs7.js} +1 -1
- package/dist/client/assets/diagram-UQ7AKVKN-BFQsCAs7.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-BFQsCAs7.js.gz +0 -0
- package/dist/client/assets/{diagram-VSXAHHWV-BupH_VRK.js → diagram-VSXAHHWV-C4R8TKEv.js} +1 -1
- package/dist/client/assets/diagram-VSXAHHWV-C4R8TKEv.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-C4R8TKEv.js.gz +0 -0
- package/dist/client/assets/{diagram-VX7I27RA-DewqaxvF.js → diagram-VX7I27RA-CL75HIf0.js} +1 -1
- package/dist/client/assets/diagram-VX7I27RA-CL75HIf0.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-CL75HIf0.js.gz +0 -0
- package/dist/client/assets/{diagram-Z3DM3KII-wDumcTuR.js → diagram-Z3DM3KII-CfJampuO.js} +1 -1
- package/dist/client/assets/diagram-Z3DM3KII-CfJampuO.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-CfJampuO.js.gz +0 -0
- package/dist/client/assets/{ebnfDiagram-PWID7BFC-C0OY91We.js → ebnfDiagram-PWID7BFC-Ct53jhNd.js} +1 -1
- package/dist/client/assets/ebnfDiagram-PWID7BFC-Ct53jhNd.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-Ct53jhNd.js.gz +0 -0
- package/dist/client/assets/{erDiagram-RLTQ6QDP-Cw9aNqvJ.js → erDiagram-RLTQ6QDP-BgL2xOOa.js} +1 -1
- package/dist/client/assets/erDiagram-RLTQ6QDP-BgL2xOOa.js.br +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-BgL2xOOa.js.gz +0 -0
- package/dist/client/assets/{flowDiagram-HODETNUW-BC7XUXeI.js → flowDiagram-HODETNUW-Cp4Nu5jY.js} +1 -1
- package/dist/client/assets/{flowDiagram-HODETNUW-BC7XUXeI.js.br → flowDiagram-HODETNUW-Cp4Nu5jY.js.br} +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-Cp4Nu5jY.js.gz +0 -0
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-DovhJIz5.js → ganttDiagram-EL5Y4UJY-DI0rdyPX.js} +1 -1
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-DI0rdyPX.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-DI0rdyPX.js.gz +0 -0
- package/dist/client/assets/{gestureArbiter-wjVok2Lg.js → gestureArbiter-Belsq4xq.js} +1 -1
- package/dist/client/assets/gestureArbiter-Belsq4xq.js.br +0 -0
- package/dist/client/assets/gestureArbiter-Belsq4xq.js.gz +0 -0
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-BmrbbyW1.js → gitGraphDiagram-WWUBYQGX-C0H4loQP.js} +1 -1
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-C0H4loQP.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-C0H4loQP.js.gz +0 -0
- package/dist/client/assets/index-CYmI1EsU.css +1 -0
- package/dist/client/assets/index-CYmI1EsU.css.br +0 -0
- package/dist/client/assets/index-CYmI1EsU.css.gz +0 -0
- package/dist/client/assets/{infoDiagram-27XIBGKW-CQEu4Jwy.js → infoDiagram-27XIBGKW-BN4RpQTL.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-BPqibqsm.js → ishikawaDiagram-5VMMS53U-BZQ5qZB_.js} +1 -1
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-BZQ5qZB_.js.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-BZQ5qZB_.js.gz +0 -0
- package/dist/client/assets/{journeyDiagram-3NMN7TZE-DIkhubnf.js → journeyDiagram-3NMN7TZE-Q8bx0_N4.js} +1 -1
- package/dist/client/assets/journeyDiagram-3NMN7TZE-Q8bx0_N4.js.br +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-Q8bx0_N4.js.gz +0 -0
- package/dist/client/assets/{kanban-definition-UXKFOSKX-CBT0DIUR.js → kanban-definition-UXKFOSKX-D7JhGtpO.js} +1 -1
- package/dist/client/assets/kanban-definition-UXKFOSKX-D7JhGtpO.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-D7JhGtpO.js.gz +0 -0
- package/dist/client/assets/{layout-C1CMlOIU.js → layout-DERUg0xU.js} +1 -1
- package/dist/client/assets/layout-DERUg0xU.js.br +0 -0
- package/dist/client/assets/layout-DERUg0xU.js.gz +0 -0
- package/dist/client/assets/{linear-C4gyqor0.js → linear-lNTe4x00.js} +1 -1
- package/dist/client/assets/linear-lNTe4x00.js.br +0 -0
- package/dist/client/assets/linear-lNTe4x00.js.gz +0 -0
- package/dist/client/assets/{mermaid.core-CMfa4ncd.js → mermaid.core-WHCwLQDQ.js} +5 -5
- package/dist/client/assets/mermaid.core-WHCwLQDQ.js.br +0 -0
- package/dist/client/assets/mermaid.core-WHCwLQDQ.js.gz +0 -0
- package/dist/client/assets/{mindmap-definition-YA3MSWOX-C-JmgKOI.js → mindmap-definition-YA3MSWOX-BouapA4v.js} +1 -1
- package/dist/client/assets/mindmap-definition-YA3MSWOX-BouapA4v.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-BouapA4v.js.gz +0 -0
- package/dist/client/assets/{passwordBootstrap-BmUG2IwA.js → passwordBootstrap-E0piP814.js} +1 -1
- package/dist/client/assets/passwordBootstrap-E0piP814.js.br +0 -0
- package/dist/client/assets/passwordBootstrap-E0piP814.js.gz +0 -0
- package/dist/client/assets/{pegDiagram-XKGWAZYB-IY-AEKQa.js → pegDiagram-XKGWAZYB-Curpo5Rq.js} +1 -1
- package/dist/client/assets/pegDiagram-XKGWAZYB-Curpo5Rq.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-Curpo5Rq.js.gz +0 -0
- package/dist/client/assets/{pieDiagram-E7YTZNPT-9Qq43qED.js → pieDiagram-E7YTZNPT-BLQCHaOG.js} +1 -1
- package/dist/client/assets/pieDiagram-E7YTZNPT-BLQCHaOG.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-BLQCHaOG.js.gz +0 -0
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-BjQncx5i.js → quadrantDiagram-AXDQQJYC-PViFqGao.js} +1 -1
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-PViFqGao.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-PViFqGao.js.gz +0 -0
- package/dist/client/assets/{railroadDiagram-O6MQD6OU-Cr1rL0wZ.js → railroadDiagram-O6MQD6OU-BtHo1LpT.js} +1 -1
- package/dist/client/assets/railroadDiagram-O6MQD6OU-BtHo1LpT.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-BtHo1LpT.js.gz +0 -0
- package/dist/client/assets/rdpSession-O_f9ejOI.js +1 -0
- package/dist/client/assets/rdpSession-O_f9ejOI.js.br +0 -0
- package/dist/client/assets/rdpSession-O_f9ejOI.js.gz +0 -0
- package/dist/client/assets/{referenceLongPress-ConC5-ym.js → referenceLongPress-BZr7Lqzh.js} +1 -1
- package/dist/client/assets/referenceLongPress-BZr7Lqzh.js.br +0 -0
- package/dist/client/assets/referenceLongPress-BZr7Lqzh.js.gz +0 -0
- package/dist/client/assets/{requirementDiagram-BXWQKSXE-DU2q_iZg.js → requirementDiagram-BXWQKSXE-BUm81HUU.js} +1 -1
- package/dist/client/assets/requirementDiagram-BXWQKSXE-BUm81HUU.js.br +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-BUm81HUU.js.gz +0 -0
- package/dist/client/assets/rfb-CxsXsMUX.js +5 -0
- package/dist/client/assets/rfb-CxsXsMUX.js.br +0 -0
- package/dist/client/assets/rfb-CxsXsMUX.js.gz +0 -0
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-BYlx9kXC.js → sankeyDiagram-P5KCCOFB-B-_-aZ_y.js} +1 -1
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-B-_-aZ_y.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-B-_-aZ_y.js.gz +0 -0
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-D_uAKme-.js → sequenceDiagram-WJ2MYXX4-DT6LDIfx.js} +1 -1
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-DT6LDIfx.js.br +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-DT6LDIfx.js.gz +0 -0
- package/dist/client/assets/{sizeCapture-INFHLROL-H_uqscf4.js → sizeCapture-INFHLROL-CTYerd9j.js} +1 -1
- package/dist/client/assets/sizeCapture-INFHLROL-CTYerd9j.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-CTYerd9j.js.gz +0 -0
- package/dist/client/assets/{sparkles-D2z4Ue6G.js → sparkles-CgaUBIwH.js} +1 -1
- package/dist/client/assets/{stateDiagram-D77RDMKH-BvsQjIIW.js → stateDiagram-D77RDMKH-CQbb5x2_.js} +1 -1
- package/dist/client/assets/stateDiagram-D77RDMKH-CQbb5x2_.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-CQbb5x2_.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CJAVXcx1.js +1 -0
- package/dist/client/assets/{swimlanes-42K2YHIH-LmUJag-p.js → swimlanes-42K2YHIH-BHZ4X2Fd.js} +1 -1
- package/dist/client/assets/swimlanes-42K2YHIH-BHZ4X2Fd.js.br +0 -0
- package/dist/client/assets/swimlanes-42K2YHIH-BHZ4X2Fd.js.gz +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-VL2nyI27.js +8 -0
- package/dist/client/assets/{timeline-definition-24CTP7MA-DZ5n0Pim.js → timeline-definition-24CTP7MA-BrjH6R6w.js} +1 -1
- package/dist/client/assets/timeline-definition-24CTP7MA-BrjH6R6w.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-BrjH6R6w.js.gz +0 -0
- package/dist/client/assets/{triangle-alert-Ct6iIBmv.js → triangle-alert-C9IHD_eF.js} +1 -1
- package/dist/client/assets/{vennDiagram-4TSXK5OY-BkTA_Ciz.js → vennDiagram-4TSXK5OY-C9f5jYgk.js} +1 -1
- package/dist/client/assets/{vennDiagram-4TSXK5OY-BkTA_Ciz.js.br → vennDiagram-4TSXK5OY-C9f5jYgk.js.br} +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-C9f5jYgk.js.gz +0 -0
- package/dist/client/assets/{videoCompression-VZIoFnyJ.js → videoCompression-DJaU8exd.js} +1 -1
- package/dist/client/assets/videoCompression-DJaU8exd.js.br +0 -0
- package/dist/client/assets/videoCompression-DJaU8exd.js.gz +0 -0
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-7hzU176j.js → wardleyDiagram-VM6X3IG4-6ljFvtiC.js} +1 -1
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-6ljFvtiC.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-6ljFvtiC.js.gz +0 -0
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-Bx4P96Bb.js → xychartDiagram-S5SC5T6Z-BaR2hm3e.js} +1 -1
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-BaR2hm3e.js.br +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-BaR2hm3e.js.gz +0 -0
- package/dist/client/index.html +2 -2
- package/dist/client/index.html.br +0 -0
- package/dist/client/index.html.gz +0 -0
- package/dist/client/sw.js +1 -1
- package/dist/client/sw.js.br +0 -0
- package/dist/client/sw.js.gz +0 -0
- package/dist/server/agent/collaborationCli.js +45 -4
- package/dist/server/agent/collaborationDeliveryWorker.js +1 -1
- package/dist/server/agent/collaborationGroupRoutes.js +0 -2
- package/dist/server/agent/collaborationPeerTransport.js +8 -2
- package/dist/server/agent/collaborationResultPresentation.js +14 -0
- package/dist/server/agent/collaborationRoutes.js +18 -2
- package/dist/server/agent/collaborationService.js +46 -2
- package/dist/server/agent/collaborationStore.js +12 -21
- package/dist/server/agent/collaborationTaskBundles.js +121 -0
- package/dist/server/agent/collaborationTaskCli.js +54 -0
- package/dist/server/agent/collaborationTaskRoutes.js +58 -0
- package/dist/server/agent/collaborationTaskService.js +355 -0
- package/dist/server/agent/collaborationTaskStore.js +835 -0
- package/dist/server/agent/collaborationTaskTypes.js +1 -0
- package/dist/server/agent/collaborationTaskWorkspace.js +165 -0
- package/dist/server/agent/collaborationTeam.js +16 -0
- package/dist/server/agent/executionArchives.js +52 -0
- package/dist/server/entry.js +17 -2
- package/dist/server/federation/runtime.js +30 -7
- package/dist/server/routes/computer.js +198 -0
- package/dist/server/routes/computerTarget.js +23 -0
- package/dist/server/routes/guacamoleProtocol.js +55 -0
- package/dist/server/routes/rdp.js +162 -0
- package/dist/server/routes/terminal.js +441 -362
- package/dist/server/shared/computerPreferences.js +29 -0
- package/dist/server/utils/computerCredentials.js +88 -0
- package/dist/server/utils/sharedSampling.js +93 -0
- package/dist/server/utils/terminalOutputDelivery.js +8 -1
- package/dist/server/utils/tmuxMetadataWriter.js +61 -0
- package/package.json +4 -1
- package/runtime-manifest.json +4 -4
- package/dist/client/assets/App-D-cerXsD.js +0 -158
- package/dist/client/assets/App-D-cerXsD.js.br +0 -0
- package/dist/client/assets/App-D-cerXsD.js.gz +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-Dv5XRtRh.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-Dv5XRtRh.js.gz +0 -0
- package/dist/client/assets/DagPlayground-mq69dKyr.js.br +0 -0
- package/dist/client/assets/DagPlayground-mq69dKyr.js.gz +0 -0
- package/dist/client/assets/DiffLab-BqdHYGi5.js.br +0 -0
- package/dist/client/assets/DiffLab-BqdHYGi5.js.gz +0 -0
- package/dist/client/assets/DiffReview-BvzGxpuc.js.br +0 -0
- package/dist/client/assets/DiffReview-BvzGxpuc.js.gz +0 -0
- package/dist/client/assets/DiffReviewLab-DrfddB7x.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-DrfddB7x.js.gz +0 -0
- package/dist/client/assets/DiffViewer-3bJV_A5s.js.br +0 -0
- package/dist/client/assets/DiffViewer-3bJV_A5s.js.gz +0 -0
- package/dist/client/assets/ModelPreview-CX7VtoJB.js.br +0 -0
- package/dist/client/assets/ModelPreview-CX7VtoJB.js.gz +0 -0
- package/dist/client/assets/RightSidebar-BK6vWNw3.js +0 -1678
- package/dist/client/assets/RightSidebar-BK6vWNw3.js.br +0 -0
- package/dist/client/assets/RightSidebar-BK6vWNw3.js.gz +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-PJwhLTPH.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-PJwhLTPH.js.gz +0 -0
- package/dist/client/assets/app-C7pXMvSE.js +0 -35
- package/dist/client/assets/app-C7pXMvSE.js.br +0 -0
- package/dist/client/assets/app-C7pXMvSE.js.gz +0 -0
- package/dist/client/assets/arc-l3FXjCEl.js.br +0 -0
- package/dist/client/assets/arc-l3FXjCEl.js.gz +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-DdNbKi-4.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-DdNbKi-4.js.gz +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-Cu63oaxR.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-Cu63oaxR.js.gz +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-DQiV_yk6.js.br +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-DQiV_yk6.js.gz +0 -0
- package/dist/client/assets/channel-CwC957gi.js +0 -1
- package/dist/client/assets/chunk-F27PBJKO-sLDCEnU8.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-sLDCEnU8.js.gz +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-DYu5qS7g.js.br +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-DYu5qS7g.js.gz +0 -0
- package/dist/client/assets/chunk-SVP7TREG-nJnbUFzs.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-nJnbUFzs.js.gz +0 -0
- package/dist/client/assets/chunk-TICWLB2K-BwyiSQgx.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-BwyiSQgx.js.gz +0 -0
- package/dist/client/assets/classDiagram-ZZMXUADV-CmoJ7-rE.js +0 -1
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-CmoJ7-rE.js +0 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-rroo-EOb.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-rroo-EOb.js.gz +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-CkFeV85k.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-hBwpU_bW.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-hBwpU_bW.js.gz +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-B321-hdp.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-B321-hdp.js.gz +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-bY87_ptA.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-bY87_ptA.js.gz +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN--cez0H_o.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN--cez0H_o.js.gz +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-BupH_VRK.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-BupH_VRK.js.gz +0 -0
- package/dist/client/assets/diagram-VX7I27RA-DewqaxvF.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-DewqaxvF.js.gz +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-wDumcTuR.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-wDumcTuR.js.gz +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-C0OY91We.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-C0OY91We.js.gz +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-Cw9aNqvJ.js.br +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-Cw9aNqvJ.js.gz +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-BC7XUXeI.js.gz +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-DovhJIz5.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-DovhJIz5.js.gz +0 -0
- package/dist/client/assets/gestureArbiter-wjVok2Lg.js.br +0 -0
- package/dist/client/assets/gestureArbiter-wjVok2Lg.js.gz +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BmrbbyW1.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BmrbbyW1.js.gz +0 -0
- package/dist/client/assets/index-BeD4iJ6L.css +0 -1
- package/dist/client/assets/index-BeD4iJ6L.css.br +0 -0
- package/dist/client/assets/index-BeD4iJ6L.css.gz +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-BPqibqsm.js.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-BPqibqsm.js.gz +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-DIkhubnf.js.br +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-DIkhubnf.js.gz +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-CBT0DIUR.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-CBT0DIUR.js.gz +0 -0
- package/dist/client/assets/layout-C1CMlOIU.js.br +0 -0
- package/dist/client/assets/layout-C1CMlOIU.js.gz +0 -0
- package/dist/client/assets/linear-C4gyqor0.js.br +0 -0
- package/dist/client/assets/linear-C4gyqor0.js.gz +0 -0
- package/dist/client/assets/mermaid.core-CMfa4ncd.js.br +0 -0
- package/dist/client/assets/mermaid.core-CMfa4ncd.js.gz +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-C-JmgKOI.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-C-JmgKOI.js.gz +0 -0
- package/dist/client/assets/passwordBootstrap-BmUG2IwA.js.br +0 -0
- package/dist/client/assets/passwordBootstrap-BmUG2IwA.js.gz +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-IY-AEKQa.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-IY-AEKQa.js.gz +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-9Qq43qED.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-9Qq43qED.js.gz +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-BjQncx5i.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-BjQncx5i.js.gz +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-Cr1rL0wZ.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-Cr1rL0wZ.js.gz +0 -0
- package/dist/client/assets/referenceLongPress-ConC5-ym.js.br +0 -0
- package/dist/client/assets/referenceLongPress-ConC5-ym.js.gz +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-DU2q_iZg.js.br +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-DU2q_iZg.js.gz +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-BYlx9kXC.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-BYlx9kXC.js.gz +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-D_uAKme-.js.br +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-D_uAKme-.js.gz +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-H_uqscf4.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-H_uqscf4.js.gz +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-BvsQjIIW.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-BvsQjIIW.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-DNgoExtD.js +0 -1
- package/dist/client/assets/swimlanes-42K2YHIH-LmUJag-p.js.br +0 -0
- package/dist/client/assets/swimlanes-42K2YHIH-LmUJag-p.js.gz +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-BRuArMR5.js +0 -8
- package/dist/client/assets/timeline-definition-24CTP7MA-DZ5n0Pim.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-DZ5n0Pim.js.gz +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-BkTA_Ciz.js.gz +0 -0
- package/dist/client/assets/videoCompression-VZIoFnyJ.js.br +0 -0
- package/dist/client/assets/videoCompression-VZIoFnyJ.js.gz +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-7hzU176j.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-7hzU176j.js.gz +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-Bx4P96Bb.js.br +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-Bx4P96Bb.js.gz +0 -0
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/videoCompression-VZIoFnyJ.js","assets/app-C7pXMvSE.js","assets/react-XDCjal2T.js","assets/dnd-BCFAPC0L.js","assets/terminal-C7X98Amf.js","assets/index-BeD4iJ6L.css","assets/RightSidebar-BK6vWNw3.js","assets/gestureArbiter-wjVok2Lg.js","assets/gestureArbiter-C2J0D0kV.css","assets/DiffReview-BvzGxpuc.js","assets/sparkles-D2z4Ue6G.js","assets/DiffViewer-3bJV_A5s.js","assets/referenceLongPress-ConC5-ym.js","assets/DiffViewer-T3uj2-aP.css","assets/triangle-alert-Ct6iIBmv.js","assets/ChangeWalkthroughPanel-Dv5XRtRh.js","assets/RightSidebar-DW-JEgm2.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a7 as Kt,cT as Mr,w as p7,bk as a,a4 as Du,c_ as zo,cQ as ca,cS as ts,aS as $l,$ as id,cw as m7,cR as Bu,ch as ih,aX as So,i as gu,a6 as qc,c8 as ff,cE as g7,aj as jc,bj as su,f as x7,cr as Fd,N as b7,b0 as Ip,bs as Ep,cn as y7,ap as v7,c2 as w7,Z as Hx,c0 as A7,cl as Wx,a2 as T7,a8 as C7,L as _n,C as ua,X as Kn,e as S7,c as Yo,b5 as _7,aR as Np,cY as Hr,br as C1,cX as Zt,au as L7,d3 as k7,r as I7,by as E7,bM as N7,bC as R7,cj as jm,ck as Pm,cm as Om,W as Fm,bL as M7,cx as D7,p as pf,cP as B7,_ as $d,a_ as Q7,h as j7,aP as Ho,T as ko,cW as P7,c3 as O7,af as F7,ac as ah,aN as $7,bJ as U7,bK as z7,P as Gx,V as $m,bz as H7,bm as Vx,l as wi,aC as xu,O as Ud,cF as mf,cV as W7,b4 as Vo,d0 as G7,B as jl,d as Yc,q as V7,ab as q7,G as Rp,ce as Y7,g as Pl,bf as Z7,bg as K7,ah as qx,as as Yx,cD as Zx,bn as X7,bp as Kx,bP as Qu,a0 as Ol,c6 as J7,k as Mp,bQ as e8,co as t8,c9 as r8,bO as n8,an as Um,c4 as s8,bS as i8,bq as zm,cc as ac,ci as a8,bT as Dp,cB as o8,cf as l8,bB as c8,bA as Xx,cb as u8,cp as d8,cq as h8,ao as f8,bo as Hm,ay as p8,aQ as m8,D as g8,ax as Wm,bu as x8,bU as Jx,m as b8,S as y8,bx as v8,bv as w8,bR as A8,cg as T8,n as C8,a as S8,bN as _8,al as L8,ar as k8,at as I8,a$ as A0,b9 as E8,cL as N8,ba as R8,ag as M8,cN as D8,I as B8,aa as Q8,a5 as j8,A as P8,aZ as O8,ai as F8,M as $8,cZ as U8,bD as ql,aW as z8,aT as H8,aU as W8,aV as G8,aL as gf,bE as V8,bY as q8,c5 as Y8,aY as Z8,aO as K8,cC as Gm,ae as X8,a1 as J8,K as e9,cJ as t9,d1 as Bn,cz as r9,aK as n9,b1 as Vm,bX as s9,cv as ad,cI as T0,cM as i9,bZ as a9,cA as o9,cs as l9,cH as xf,ct as c9,cu as u9,cU as d9,ad as h9,cd as C0,x as f9,bt as p9,bi as od,bh as m9,bV as qm,b_ as g9,bW as Tc,b$ as x9,Y as b9,a3 as y9,o as v9}from"./app-C7pXMvSE.js";import{b as y,R as C,r as Ai,a as w9}from"./dnd-BCFAPC0L.js";import{b as A9,c as T9,F as hc,S as C9,e as S9,h as _9,r as L9,y as k9,d as I9,u as E9}from"./gestureArbiter-wjVok2Lg.js";import{L as N9,l as R9}from"./terminal-C7X98Amf.js";import{T as eb,L as Zc,M as M9,G as D9,C as Ym}from"./triangle-alert-Ct6iIBmv.js";import{r as B9}from"./react-XDCjal2T.js";import{u as S1,G as Q9}from"./referenceLongPress-ConC5-ym.js";const j9=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]],P9=Kt("arrow-down-a-z",j9);const O9=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],F9=Kt("arrow-down",O9);const $9=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],tb=Kt("arrow-up",$9);const U9=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],rb=Kt("bell",U9);const z9=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],ju=Kt("bot",z9);const H9=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],W9=Kt("box",H9);const G9=[["path",{d:"M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z",key:"trhst0"}],["path",{d:"M17 21v-2",key:"ds4u3f"}],["path",{d:"M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10",key:"1mo9zo"}],["path",{d:"M21 21v-2",key:"eo0ou"}],["path",{d:"M3 5V3",key:"1k5hjh"}],["path",{d:"M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z",key:"1dd30t"}],["path",{d:"M7 5V3",key:"1t1388"}]],V9=Kt("cable",G9);const q9=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],Y9=Kt("calendar-clock",q9);const Z9=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],K9=Kt("camera",Z9);const X9=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16h8",key:"srdodz"}],["path",{d:"M7 11h12",key:"127s9w"}],["path",{d:"M7 6h3",key:"w9rmul"}]],J9=Kt("chart-bar",X9);const ew=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],tw=Kt("circle-dot",ew);const rw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],oh=Kt("circle-question-mark",rw);const nw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],sw=Kt("circle",nw);const iw=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],aw=Kt("clipboard-paste",iw);const ow=[["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"}]],nb=Kt("clipboard",ow);const lw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],bu=Kt("clock-3",lw);const cw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],uw=Kt("clock",cw);const dw=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],hw=Kt("code",dw);const fw=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],dl=Kt("columns-2",fw);const pw=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],mw=Kt("corner-down-left",pw);const gw=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],yu=Kt("download",gw);const xw=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Rh=Kt("external-link",xw);const bw=[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],yw=Kt("file-code",bw);const vw=[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],ww=Kt("file-up",vw);const Aw=[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],sb=Kt("file",Aw);const Tw=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Hc=Kt("folder-open",Tw);const Cw=[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]],_1=Kt("folder-search",Cw);const Sw=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],_w=Kt("folder-tree",Sw);const Lw=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],Zm=Kt("grid-2x2",Lw);const kw=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Pu=Kt("grip-vertical",kw);const Iw=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Ew=Kt("hash",Iw);const Nw=[["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"}]],sc=Kt("history",Nw);const Rw=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],Mw=Kt("house",Rw);const Dw=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],ib=Kt("keyboard",Dw);const Bw=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],ab=Kt("layers",Bw);const Qw=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Kc=Kt("layout-grid",Qw);const jw=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],Pw=Kt("maximize",jw);const Ow=[["path",{d:"M5 12h14",key:"1ays0h"}]],ob=Kt("minus",Ow);const Fw=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],$w=Kt("minimize",Fw);const Uw=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]],zw=Kt("monitor-smartphone",Uw);const Hw=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],Ww=Kt("moon",Hw);const Gw=[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]],Vw=Kt("move",Gw);const qw=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],Yw=Kt("panel-right-close",qw);const Zw=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Kw=Kt("panel-left",Zw);const Xw=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],Jw=Kt("panel-right-open",Xw);const eA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],lb=Kt("panel-right",eA);const tA=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],rA=Kt("pause",tA);const nA=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],sA=Kt("pen-line",nA);const iA=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],aA=Kt("pencil-line",iA);const oA=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],vu=Kt("pin",oA);const lA=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]],wu=Kt("pin-off",lA);const cA=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Bp=Kt("play",cA);const uA=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],dA=Kt("plug",uA);const hA=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],fA=Kt("power",hA);const pA=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],rs=Kt("refresh-cw",pA);const mA=[["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"}]],cb=Kt("rotate-ccw",mA);const gA=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],xA=Kt("rotate-cw",gA);const bA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],Km=Kt("rows-2",bA);const yA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Mh=Kt("search",yA);const vA=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],wA=Kt("send",vA);const AA=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],TA=Kt("settings",AA);const CA=[["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"}]],SA=Kt("shield-alert",CA);const _A=[["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:"m9 12 2 2 4-4",key:"dzmm74"}]],LA=Kt("shield-check",_A);const kA=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],IA=Kt("sliders-horizontal",kA);const EA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],ub=Kt("square",EA);const NA=[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]],RA=Kt("stethoscope",NA);const MA=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],DA=Kt("sun",MA);const BA=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ri=Kt("trash-2",BA);const QA=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],jA=Kt("type",QA);const PA=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],OA=Kt("unlink",PA);const FA=[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]],db=Kt("unplug",FA);const $A=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],hb=Kt("video",$A);const UA=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]],zA=Kt("volume-1",UA);const HA=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],WA=Kt("volume-2",HA);const GA=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],VA=Kt("wand-sparkles",GA);const qA=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],bf=Kt("workflow",qA);function YA(e,t){return e==="webgl"&&t}function ZA(e){return e.isActive&&e.viewportFocused&&e.documentVisible&&e.windowFocused&&e.streamReady}function KA(e){return e.isActive&&e.documentVisible&&e.streamReady&&(!e.isDesktop||e.windowFocused)}function XA(e){return e.isActive&&!e.isMobile&&e.documentVisible&&!e.activeElementIsEditable}function JA(e,t){return!e&&t}function eT({state:e,onCopy:t,copied:r}){const{t:n}=Mr(),[i,l]=y.useState(null),c=e.caAvailable&&e.onboardingUrl?new URL("/ca",e.onboardingUrl).href:null;return y.useEffect(()=>{let h=!1;return l(null),c&&p7.toDataURL(c,{width:180,margin:2,errorCorrectionLevel:"M"}).then(p=>{h||l(p)}).catch(()=>{}),()=>{h=!0}},[c]),a.jsxs("div",{className:"space-y-3 text-xs leading-relaxed text-muted-foreground",children:[a.jsx("p",{children:n("settings.mobileSetupIntro")}),e.httpsEnabled&&a.jsxs("section",{className:"space-y-3 rounded-xl bg-surface-2 p-3",children:[a.jsx("h3",{className:"font-medium text-foreground",children:n("settings.mobileSetupDownload")}),c?a.jsxs(a.Fragment,{children:[i&&a.jsx("img",{src:i,alt:n("settings.mobileSetupDownload"),className:"h-44 w-44 rounded-lg"}),a.jsxs("button",{type:"button",onClick:()=>t(c),className:"flex w-full items-center justify-between gap-3 rounded-lg bg-surface p-2 text-left",children:[a.jsx("span",{className:"break-all",children:c}),a.jsx("span",{className:"shrink-0 text-primary",children:n(r?"rightSidebar.copied":"common.copy")})]})]}):a.jsx("p",{children:n("settings.caMissing")}),a.jsx("p",{children:n("settings.mobileSetupIos")}),a.jsx("p",{children:n("settings.mobileSetupAndroid")})]}),a.jsx("h3",{className:"font-medium text-foreground",children:e.httpsEnabled?n("settings.mobileSetupConnect"):n("settings.localAccess")}),a.jsx("p",{children:n("settings.mobileSetupConnectHint")})]})}const uu=Du(e=>({collaborationGroups:[],setCollaborationGroups:t=>e(r=>({collaborationGroups:typeof t=="function"?t(r.collaborationGroups):t}))}));function Xm(){const e=zo(),t=e.visualViewport,r=document.documentElement.style,n=g=>g===void 0?"?":Math.round(g),i=g=>r.getPropertyValue(g)||"?";let l=document.activeElement?.parentElement,c=null;for(;l&&!c;)c=l.querySelector('[data-mobile-keyboard="true"]'),l=l.parentElement;const h=c?.getBoundingClientRect(),p=document.getElementById("root")?.getBoundingClientRect();return[`VVP ${n(t?.height)} off ${n(t?.offsetTop)} win ${e.innerHeight}`,`base ${i("--app-base-vh")} kb ${i("--kb-height")} move ${i("--kb-translate-y")}`,`bar ${n(h?.top)}…${n(h?.bottom)} h ${n(h?.height)} root ${n(p?.bottom)}`,`safe ${i("--safe-top-inset")}/${i("--safe-bottom-inset")} frame ${e!==window?"child":"root"} focus ${document.activeElement?.tagName??"?"}`].join(`
|
|
3
|
-
`)}function tT({onClose:e}){const[t,r]=C.useState(Xm);return C.useEffect(()=>{const n=window.setInterval(()=>r(Xm()),200);return()=>window.clearInterval(n)},[]),a.jsxs("div",{className:"pointer-events-none fixed inset-x-2 z-toast rounded-lg border border-border/15 bg-surface p-2 text-foreground md:hidden",style:{top:"calc(var(--safe-top-inset, 0px) + 40px)"},children:[a.jsx("button",{type:"button",className:"pointer-events-auto absolute right-1 top-1 px-2 py-1 text-xs",onPointerDown:n=>n.preventDefault(),onClick:e,"aria-label":"关闭布局诊断",children:"×"}),a.jsx("pre",{className:"pr-5 font-mono text-[10px] leading-tight",children:t})]})}const rT={x:0,y:0,width:1,height:1};function oc(e){return"id"in e?[e.id]:[...oc(e.first),...oc(e.second)]}function Qp(e,t=0,r=new Set){if(!e||typeof e!="object"||t>24)return null;const n=e;if(typeof n.id=="string"&&n.id&&!r.has(n.id))return r.add(n.id),{id:n.id};if(!["x","y"].includes(String(n.axis))||!Number.isFinite(n.ratio))return null;const i=Qp(n.first,t+1,r),l=Qp(n.second,t+1,r);return i&&l?{axis:n.axis,ratio:Math.max(.02,Math.min(.98,Number(n.ratio))),first:i,second:l}:i??l}function Au(e,t){if("id"in e)return t.has(e.id)?e:null;const r=Au(e.first,t),n=Au(e.second,t);return r&&n?{...e,first:r,second:n}:r??n}function lh(e,t,r,n){return"id"in e?e.id===t?{axis:n==="left"||n==="right"?"x":"y",ratio:.5,first:n==="left"||n==="top"?{id:r}:e,second:n==="left"||n==="top"?e:{id:r}}:e:{...e,first:lh(e.first,t,r,n),second:lh(e.second,t,r,n)}}function nT(e,t,r,n){if(t===r||!oc(e).includes(t)||!oc(e).includes(r))return e;if(n==="center"){const i=l=>"id"in l?{id:l.id===t?r:l.id===r?t:l.id}:{...l,first:i(l.first),second:i(l.second)};return i(e)}return lh(Au(e,new Set(oc(e).filter(i=>i!==t))),r,t,n)}function Wc(e,t){if(e.length===1)return{id:e[0]};if(t==="grid"&&e.length>2){const r=Math.ceil(e.length/2);return{axis:"y",ratio:.5,first:Wc(e.slice(0,r),"horizontal"),second:Wc(e.slice(r),"horizontal")}}return{axis:t==="vertical"?"y":"x",ratio:1/e.length,first:{id:e[0]},second:Wc(e.slice(1),t)}}function jp(e,t=rT,r=""){if("id"in e)return{panes:[{id:e.id,rect:t}],dividers:[]};const n={...t},i={...t};e.axis==="x"?(n.width*=e.ratio,i.x+=n.width,i.width-=n.width):(n.height*=e.ratio,i.y+=n.height,i.height-=n.height);const l=jp(e.first,n,r+"0"),c=jp(e.second,i,r+"1");return{panes:[...l.panes,...c.panes],dividers:[{path:r,node:e,rect:t},...l.dividers,...c.dividers]}}function du(e,t,r){return"id"in e?e:t?t[0]==="0"?{...e,first:du(e.first,t.slice(1),r)}:{...e,second:du(e.second,t.slice(1),r)}:{...e,ratio:r}}function fb(e){return"id"in e||"id"in e.first||"id"in e.second||e.first.axis===e.axis||e.second.axis===e.axis||!("id"in e.first.first)||!("id"in e.first.second)||!("id"in e.second.first)||!("id"in e.second.second)?null:e.axis==="y"?{ids:[e.first.first.id,e.first.second.id,e.second.first.id,e.second.second.id],top:e.first.ratio,bottom:e.second.ratio,left:e.ratio,right:e.ratio}:{ids:[e.first.first.id,e.second.first.id,e.first.second.id,e.second.second.id],top:e.ratio,bottom:e.ratio,left:e.first.ratio,right:e.second.ratio}}function yf(e,t,r){const n=fb(e);if(!n)return e;const[i,l,c,h]=n.ids.map(p=>({id:p}));return t==="top"||t==="bottom"?{axis:"y",ratio:(n.left+n.right)/2,first:{axis:"x",ratio:t==="top"?r:n.top,first:i,second:l},second:{axis:"x",ratio:t==="bottom"?r:n.bottom,first:c,second:h}}:{axis:"x",ratio:(n.top+n.bottom)/2,first:{axis:"y",ratio:t==="left"?r:n.left,first:i,second:c},second:{axis:"y",ratio:t==="right"?r:n.right,first:l,second:h}}}function sT(e,t,r,n,i){const l=(p,g,x)=>{if(p.length===1)return p[0];const b=x?.length===p.length&&x.every(w=>Number.isFinite(w)&&w>0)?x:p.map(()=>1);return{axis:g,ratio:b[0]/b.reduce((w,A)=>w+A,0),first:p[0],second:l(p.slice(1),g,b.slice(1))}};if(t!=="grid")return l(e.map(p=>({id:p})),t==="vertical"?"y":"x",r);const c=Math.ceil(Math.sqrt(e.length)),h=[];for(let p=0;p<e.length;p+=c){const g=e.slice(p,p+c).map(b=>({id:b})),x=n?.length===c?n.slice(0,g.length):void 0;x&&g.length<c&&(x[x.length-1]+=n.slice(g.length).reduce((b,w)=>b+w,0)),h.push(l(g,"x",x))}return l(h,"y",i)}let iT;function Dh(){try{const e="termdock-collaboration-panel-client",t=localStorage.getItem(e);if(t)return t;const r=crypto.randomUUID();return localStorage.setItem(e,r),r}catch{return iT??=crypto.randomUUID()}}let Jm=Promise.resolve();function hl(e,t){t&&(e={groups:{[t]:e}});const r=Dh(),n=Jm.catch(()=>{}).then(()=>ca({collaborationPanel:{clientId:r,state:e}}));return Jm=n,n.then(()=>{})}function eg(e,t,r,n,i,l){return{x:i>0?Math.max(0,Math.min(1,(e-r)/i)):.5,y:l>0?Math.max(0,Math.min(1,(t-n)/l)):.5}}function pb(e,t){return t?{...{...e?.floatingGroupId===t?e:{},...e?.groups?.[t]},drafts:e?.drafts}:{drafts:e?.drafts}}function mb(e){const t=Object.entries(e?.groups??{}).filter(([,r])=>r.floatingGroupId).map(([r])=>r);return e?.floatingGroupId&&!e.groups?.[e.floatingGroupId]&&t.push(e.floatingGroupId),t}const aT=e=>e.startsWith("@collaboration:"),tg=e=>({left:`${e.x*100}%`,top:`${e.y*100}%`,width:`${e.width*100}%`,height:`${e.height*100}%`});function oT({groupId:e}){const t=ts(n=>n.setHost),r=y.useCallback(n=>t(e,n),[e,t]);return a.jsx("div",{ref:r,className:"h-full min-h-0 min-w-0 bg-surface"})}function rg({layoutId:e,panes:t,preset:r="grid",initialTree:n,focusId:i,mobile:l=!1}){const c=ts(K=>K.docks),h=JSON.stringify(t.map(K=>K.id)),p=Object.entries(c).filter(([,K])=>t.some(Le=>Le.id===K.sessionId)),g=JSON.stringify(p),x=y.useRef(null),[b,w]=y.useState(()=>n??Wc(t.map(K=>K.id),l?"vertical":r)),A=y.useRef(b);A.current=b;const[k,E]=y.useState(!1),I=ts(K=>K.activePaneId),[M,Q]=y.useState(null),[j,F]=y.useState(null),[V,$]=y.useState(null),te=y.useRef(r),se=y.useRef(t.map(K=>K.id)),qe=y.useRef({}),de=y.useRef(!1),oe=()=>{de.current&&(de.current=!1,hl({layouts:{[e]:A.current}}).catch(()=>{de.current=!0,Q("布局保存失败,调整后重试")}))};y.useEffect(()=>{let K=!1;return $l().then(Le=>{if(K)return;const fe=Le.collaborationPanels?.[Dh()];for(const ze of mb(fe)){const Ee=pb(fe,ze);Ee.mode==="docked"&&Ee.dock&&t.some(ee=>ee.id===Ee.dock.sessionId)&&!ts.getState().docks[ze]&&ts.getState().setDock(ze,Ee.dock)}let $e=Qp(fe?.layouts?.[e]);if($e&&fe?.floatingGroupId){const ze=Ee=>"id"in Ee?{id:Ee.id==="@collaboration"?id(fe.floatingGroupId):Ee.id}:{...Ee,first:ze(Ee.first),second:ze(Ee.second)};$e=ze($e)}$e&&w($e),E(!0)}).catch(()=>{K||Q("布局加载失败,请刷新重试")}),()=>{K=!0}},[e]);const Oe=K=>{de.current=!0,A.current=K,w(K)};y.useLayoutEffect(()=>{if(!k)return;const K=JSON.parse(h),Le=te.current!==r;te.current=r;let fe=Le?Wc(K,r):A.current;const $e=se.current;if(!Le&&$e.length===K.length&&$e.every(ee=>K.includes(ee))&&$e.some((ee,Ke)=>ee!==K[Ke])){const ee=new Map($e.map((wt,tt)=>[wt,K[tt]])),Ke=wt=>"id"in wt?{id:ee.get(wt.id)??wt.id}:{...wt,first:Ke(wt.first),second:Ke(wt.second)};fe=Ke(fe)}se.current=K;const ze=new Set([...K,...p.map(([ee])=>id(ee))]);fe=Au(fe,ze)??Wc(K,r);for(const ee of K)oc(fe).includes(ee)||(fe={axis:"x",ratio:.5,first:fe,second:{id:ee}});const Ee={};for(const[ee,Ke]of p){const wt=id(ee),tt=`${Ke.sessionId}:${Ke.side}`;Ee[ee]=tt,(!oc(fe).includes(wt)||qe.current[ee]&&qe.current[ee]!==tt)&&(fe=Au(fe,new Set([...ze].filter(ge=>ge!==wt))),fe=lh(fe,Ke.sessionId,wt,Ke.side))}qe.current=Ee,JSON.stringify(fe)!==JSON.stringify(A.current)&&(Oe(fe),oe())},[k,h,r,g]),y.useEffect(()=>{const K=()=>oe();return window.addEventListener("pagehide",K),()=>{window.removeEventListener("pagehide",K),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),K()}},[e]);const et=jp(b),ce=fb(b),Be=[...t,...p.map(([K])=>({id:id(K),content:a.jsx(oT,{groupId:K})}))],ot=y.useRef(null),Ie=y.useRef(V);Ie.current=V;const re=y.useRef(null);y.useEffect(()=>{const K=x.current;if(!K||!k)return;const Le=$e=>{if($e.button!==0||!($e.target instanceof Element))return;const ze=$e.target.closest("[data-split-pane-title], [data-panel-drag-title]"),Ee=$e.target.closest("button, a, input, textarea, select");if(!ze||Ee&&Ee!==ze)return;const ee=ze.closest("[data-layout-pane]");if(!ee||!K.contains(ee))return;document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}}));const Ke=ee.getBoundingClientRect();ot.current={id:ee.dataset.layoutPane,x:$e.clientX,y:$e.clientY,moved:!1,originX:$e.clientX-Ke.left,originY:$e.clientY-Ke.top,scale:Math.min(.8,480/Math.max(1,Ke.width),320/Math.max(1,Ke.height))},K.setPointerCapture?.($e.pointerId)},fe=$e=>{const ze=$e.target;if(!(ze instanceof Element))return;const Ee=ze.closest("[data-layout-pane]");if(!(!Ee||!K.contains(Ee))){if($e.type==="pointerdown"&&ts.getState().activePaneId!==Ee.dataset.layoutPane){const ee=document.activeElement;ee instanceof HTMLElement&&ee.closest("[data-layout-pane]")&&!Ee.contains(ee)&&ee.blur();const Ke=window.getSelection();Ke?.anchorNode&&!Ee.contains(Ke.anchorNode)&&Ke.removeAllRanges()}ts.getState().setActivePane(Ee.dataset.layoutPane)}};return K.addEventListener("pointerdown",fe,!0),K.addEventListener("focusin",fe,!0),K.addEventListener("pointerdown",Le,!0),()=>{K.removeEventListener("pointerdown",Le,!0),K.removeEventListener("pointerdown",fe,!0),K.removeEventListener("focusin",fe,!0)}},[k]);const Ue=(K,Le)=>{const fe=x.current?.getBoundingClientRect(),$e=re.current;if(!fe||!$e)return;const ze=$e.axis==="x"?fe.width*$e.rect.width:fe.height*$e.rect.height,Ee=$e.axis==="x"?fe.left+fe.width*$e.rect.x:fe.top+fe.height*$e.rect.y,ee=Math.min(.45,(l?48:120)/Math.max(1,ze)),Ke=Math.max(ee,Math.min(1-ee,(($e.axis==="x"?K:Le)-Ee)/Math.max(1,ze)));Oe($e.side?yf(A.current,$e.side,Ke):du(A.current,$e.path,Ke))},_e=ce?[{key:"top",side:"top",axis:"x",x:ce.top,y:0,length:(ce.left+ce.right)/2},{key:"bottom",side:"bottom",axis:"x",x:ce.bottom,y:(ce.left+ce.right)/2,length:1-(ce.left+ce.right)/2},{key:"left",side:"left",axis:"y",x:0,y:ce.left,length:(ce.top+ce.bottom)/2},{key:"right",side:"right",axis:"y",x:(ce.top+ce.bottom)/2,y:ce.right,length:1-(ce.top+ce.bottom)/2}].map(K=>({...K,rect:{x:0,y:0,width:1,height:1},path:void 0})):et.dividers.map(K=>({key:K.path,path:K.path,side:void 0,axis:K.node.axis,rect:K.rect,x:K.rect.x+(K.node.axis==="x"?K.rect.width*K.node.ratio:0),y:K.rect.y+(K.node.axis==="y"?K.rect.height*K.node.ratio:0),length:K.node.axis==="x"?K.rect.height:K.rect.width}));return a.jsxs("div",{ref:x,"data-split-container":"true",className:"relative h-full min-h-0 min-w-0 flex-1 overflow-hidden bg-border [&_[data-split-pane-title]]:touch-none [&_[data-panel-drag-title]]:touch-none",onPointerMove:K=>{if(re.current){K.preventDefault(),Ue(K.clientX,K.clientY);return}const Le=ot.current,fe=x.current?.getBoundingClientRect();if(!Le||!fe||!Le.moved&&Math.hypot(K.clientX-Le.x,K.clientY-Le.y)<6)return;Le.moved=!0,F({id:Le.id,dx:K.clientX-Le.x,dy:K.clientY-Le.y,originX:Le.originX,originY:Le.originY,scale:Le.scale});const $e=(K.clientX-fe.left)/fe.width,ze=(K.clientY-fe.top)/fe.height,Ee=et.panes.find(ge=>$e>=ge.rect.x&&$e<=ge.rect.x+ge.rect.width&&ze>=ge.rect.y&&ze<=ge.rect.y+ge.rect.height);if(!Ee||Ee.id===Le.id){Ie.current=null,$(null);return}const ee=($e-Ee.rect.x)/Ee.rect.width,Ke=(ze-Ee.rect.y)/Ee.rect.height,wt=Math.min(ee,1-ee,Ke,1-Ke)>.25?"center":ee<1-ee&&ee<=Ke&&ee<=1-Ke?"left":1-ee<=Ke&&1-ee<=1-Ke?"right":Ke<1-Ke?"top":"bottom",tt={id:Ee.id,side:wt};Ie.current=tt,$(tt)},onPointerUp:K=>{re.current&&(re.current=null,oe()),ot.current?.moved&&Ie.current&&(Oe(nT(A.current,ot.current.id,Ie.current.id,Ie.current.side)),oe()),ot.current=null,Ie.current=null,$(null),F(null),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),K.currentTarget.hasPointerCapture?.(K.pointerId)&&K.currentTarget.releasePointerCapture(K.pointerId)},onLostPointerCapture:()=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),re.current=null,ot.current=null,Ie.current=null,$(null),F(null),oe()},onKeyDownCapture:K=>{K.key==="Escape"&&(ot.current=null,Ie.current=null,$(null),F(null),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})))},onPointerCancel:()=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),re.current=null,ot.current=null,Ie.current=null,$(null),F(null),oe()},children:[j&&a.jsx("div",{"aria-hidden":"true","data-drag-placeholder":"true",className:"pointer-events-none absolute border-2 border-dashed border-primary/30 bg-primary/5",style:tg(et.panes.find(K=>K.id===j.id)?.rect??{x:0,y:0,width:0,height:0})}),Be.map(K=>{const Le=et.panes.find($e=>$e.id===K.id)?.rect,fe=!Le||!!i&&K.id!==i;return a.jsxs("div",{"data-layout-pane":K.id,"data-pane-active":I===K.id,className:`${I===K.id?"[&_[data-pane-titlebar]]:bg-surface":""} absolute min-h-0 min-w-0 overflow-hidden bg-[var(--chrome-bg)] ${j?.id===K.id?"pointer-events-none z-30 rounded-lg ring-1 ring-primary/60 opacity-90 shadow-xl":""}`,style:{...tg(i===K.id?{x:0,y:0,width:1,height:1}:Le??{x:0,y:0,width:0,height:0}),padding:Be.length>1?"0.5px":0,transition:"none",visibility:fe?"hidden":void 0,...j?.id===K.id?{transform:`translate(${j.dx}px, ${j.dy}px) scale(${j.scale})`,transformOrigin:`${j.originX}px ${j.originY}px`}:{}},onDragStart:$e=>{$e.target.closest("[data-split-pane-title], [data-panel-drag-title]")&&$e.preventDefault()},children:[K.content,l&&Be.length>1&&!aT(K.id)&&a.jsx("button",{type:"button","data-panel-drag-title":"true","aria-label":"拖动面板到其他区域",className:"swiper-no-swiping absolute right-1 top-1 z-20 rounded bg-surface p-1 text-muted-foreground",children:a.jsx(Pu,{size:14})}),V?.id===K.id&&a.jsx("div",{className:"pointer-events-none absolute z-30 border-2 border-primary bg-primary/20",style:{top:V.side==="bottom"?"50%":0,bottom:V.side==="top"?"50%":0,left:V.side==="right"?"50%":0,right:V.side==="left"?"50%":0}})]},K.id)}),!i&&_e.map(K=>a.jsx("button",{type:"button",role:"separator","aria-label":K.side?`调整${{top:"上",bottom:"下",left:"左",right:"右"}[K.side]}半段分隔线`:"调整分屏大小","aria-orientation":K.axis==="x"?"vertical":"horizontal",disabled:!k,className:`swiper-no-swiping absolute z-10 touch-none bg-border hover:bg-primary focus-visible:bg-primary ${K.axis==="x"?"w-px cursor-col-resize":"h-px cursor-row-resize"}`,style:{left:`${K.x*100}%`,top:`${K.y*100}%`,...K.axis==="x"?{height:`${K.length*100}%`}:{width:`${K.length*100}%`}},onPointerDown:Le=>{Le.preventDefault(),Le.stopPropagation(),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}})),re.current=K,x.current?.setPointerCapture?.(Le.pointerId)},onDoubleClick:()=>{Oe(K.side?yf(A.current,K.side,.5):du(A.current,K.path,.5)),oe()},onKeyDown:Le=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(Le.key))return;Le.preventDefault();const fe=K.side?ce[K.side]:et.dividers.find(ze=>ze.path===K.path).node.ratio,$e=Math.max(.05,Math.min(.95,fe+(["ArrowRight","ArrowDown"].includes(Le.key)?.03:-.03)));Oe(K.side?yf(A.current,K.side,$e):du(A.current,K.path,$e)),oe()},children:a.jsx("span",{"aria-hidden":"true",className:`absolute ${K.axis==="x"?"inset-y-0 -inset-x-1":"inset-x-0 -inset-y-1"}`})},K.key)),M&&a.jsx("div",{role:"alert",className:"absolute bottom-1 left-1 z-20 rounded bg-surface px-2 py-1 text-[10px] text-destructive",children:M})]})}let Pp=0,ng=!1,Fc=0;function lT(){if(ng||typeof window>"u")return;ng=!0;const e=()=>{Pp=performance.now()};window.addEventListener("pointerdown",()=>{Fc+=1,e()},{passive:!0,capture:!0});for(const t of["pointerup","pointercancel"])window.addEventListener(t,()=>{Fc=Math.max(0,Fc-1),e()},{passive:!0,capture:!0});for(const t of["pointermove","wheel","keydown"])window.addEventListener(t,e,{passive:!0,capture:!0});window.addEventListener("blur",()=>{Fc=0,e()})}function L1(e,t=500){lT();let r=!1,n,i;const l=()=>{if(r)return;if(Fc>0||performance.now()-Pp<400){i=setTimeout(l,100);return}const c=()=>{if(!r){if(Fc>0||performance.now()-Pp<400){i=setTimeout(l,100);return}e()}};"requestIdleCallback"in window?n=window.requestIdleCallback(c):i=setTimeout(c,16)};return i=setTimeout(l,t),()=>{r=!0,clearTimeout(i),n!==void 0&&window.cancelIdleCallback(n)}}function cT(e){const[t,r]=y.useState(e);return y.useEffect(()=>L1(()=>r(e),0),[e]),t}function uT(e,t,r){y.useEffect(()=>{e&&m7(e,!0)},[e,r])}const xi=[];for(let e=0;e<256;++e)xi.push((e+256).toString(16).slice(1));function dT(e,t=0){return(xi[e[t+0]]+xi[e[t+1]]+xi[e[t+2]]+xi[e[t+3]]+"-"+xi[e[t+4]]+xi[e[t+5]]+"-"+xi[e[t+6]]+xi[e[t+7]]+"-"+xi[e[t+8]]+xi[e[t+9]]+"-"+xi[e[t+10]]+xi[e[t+11]]+xi[e[t+12]]+xi[e[t+13]]+xi[e[t+14]]+xi[e[t+15]]).toLowerCase()}let vf;const hT=new Uint8Array(16);function fT(){if(!vf){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");vf=crypto.getRandomValues.bind(crypto)}return vf(hT)}const pT=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),sg={randomUUID:pT};function mT(e,t,r){e=e||{};const n=e.random??e.rng?.()??fT();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,dT(n)}function gb(e,t,r){return sg.randomUUID&&!e?sg.randomUUID():mT(e)}const xb="\x1B[?2026h",gT="\x1B[?2026l",bb="\x1Bc";function xT(e){return e.replace(/(?:\x1b\]|\x9d)[\s\S]*?(?:\x07|\x1b\\|\x9c|$)|(?:\x1b[P_X^]|[\x90\x98\x9e\x9f])[\s\S]*?(?:\x1b\\|\x9c|$)|(?:\x1b\[|\x9b)\?([\d;]+)([hl])|(?:\x1b\[|\x9b)[\d;]*!p|\x1bc/g,(t,r,n)=>{if(t===bb||t.endsWith("!p"))return t+xb;if(r===void 0)return t;const i=r.split(";").filter(l=>Number(l)!==2026);return i.length?`\x1B[?${i.join(";")}${n}`:""})}function bT(e){const t=e.filter(n=>n.length>0).join("");if(!t)return[];const r=xT(t.replace(/^(?:\x1bc)+/,""));return[`${bb}${xb}${r}${gT}`]}function yT(e){return[`\x1B[!p\x1B[?2026h\x1B[H\x1B[2J\x1B[3J${e.join("")}\x1B[?2026l`]}function vT(e){return[["10",e.foreground],["11",e.background]].map(([t,r])=>{const n=/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(r);if(!n)return"";const i=n.slice(1).map(l=>l.repeat(2)).join("/");return`\x1B]${t};rgb:${i}\x1B\\`}).join("")}const wT={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},AT={F1:"P",F2:"Q",F3:"R",F4:"S"},TT={Insert:2,Delete:3,PageUp:5,PageDown:6,F5:15,F6:17,F7:18,F8:19,F9:20,F10:21,F11:23,F12:24};function CT(e,t=!1){if(e.metaKey||e.isComposing||e.keyCode===229||e.getModifierState?.("AltGraph"))return null;const{key:r,shiftKey:n,altKey:i,ctrlKey:l}=e,c=1+Number(n)+2*Number(i)+4*Number(l),h=c===1?"":`;${c}`,p=wT[r];if(p)return c!==1?`\x1B[1${h}${p}`:`\x1B${t?"O":"["}${p}`;const g=AT[r];if(g)return c!==1?`\x1B[1${h}${g}`:`\x1BO${g}`;if(r==="Insert"&&!i&&(n||l))return null;const x=TT[r];if(x)return`\x1B[${x}${h}~`;if(r==="Tab")return i?`\x1B${n?"\x1B[Z":" "}`:n?"\x1B[Z":" ";if(r==="Escape")return i?"\x1B\x1B":"\x1B";if(r==="Enter")return i?"\x1B\r":null;if(r==="Backspace")return l||i?`${i?"\x1B":""}${l?"\b":""}`:null;if(r.length!==1)return null;if(l){const b=r.toUpperCase();let w;return/^[A-Z]$/.test(b)?w=b.charCodeAt(0)-64:r===" "||r==="@"||r==="2"?w=0:"[\\]^_".includes(r)?w=r.charCodeAt(0)-64:/^[3-7]$/.test(r)?w=Number(r)+24:r==="?"||r==="8"?w=127:r==="/"&&(w=31),w===void 0?null:`${i?"\x1B":""}${String.fromCharCode(w)}`}return i?`\x1B${r}`:null}class zd extends Error{}async function ST(e){if(!e.type.startsWith("image/")||e.size===0)throw new Error("Clipboard image is empty");const t=e.type==="image/jpeg"?"jpg":e.type.split("/")[1].replace(/[^a-z0-9]/gi,"")||"png",r=new File([e],`termdock-clipboard-${Date.now()}-${crypto.randomUUID()}.${t}`,{type:e.type}),{files:n}=await Bu("/tmp",[r]);if(!n[0]?.path)throw new Error("Upload did not return an image path");return n[0].path}async function ig(e){const t=So();if(t?.readClipboardImage){const r=await t.readClipboardImage();return r?.byteLength?new File([r],"clipboard.png",{type:"image/png"}):null}if(typeof e?.read!="function")return null;for(const r of await e.read()){const n=r.types.find(c=>c.startsWith("image/"));if(!n)continue;const i=await r.getType(n),l=n==="image/jpeg"?"jpg":n.split("/")[1].replace(/[^a-z0-9]/gi,"")||"png";return new File([i],`termdock-clipboard-${Date.now()}.${l}`,{type:n})}return null}async function _T(e){if(typeof e?.read!="function")return[];const t=[],r={"video/mp4":"mp4","video/quicktime":"mov","video/x-m4v":"m4v","video/webm":"webm","video/ogg":"ogv","video/mpeg":"mpeg","video/x-msvideo":"avi","video/x-matroska":"mkv","video/3gpp":"3gp","video/3gpp2":"3g2"};for(const n of await e.read()){const i=n.types.find(p=>p.startsWith("video/"));if(!i)continue;const l=await n.getType(i);if(!l.size)throw new Error("Clipboard video is empty");const c=i.split(";")[0].toLowerCase(),h=r[c]||c.slice(6).replace(/[^a-z0-9]/g,"")||"mp4";t.push(new File([l],`termdock-clipboard-${Date.now()}-${crypto.randomUUID()}.${h}`,{type:i}))}return t}async function LT(){const e=ih()?.targetPeerId;let t;try{t=await So()?.readClipboardFiles?.({localServiceId:e})}catch(i){const l=i instanceof Error?i.message:String(i),c="TERMDOCK_CLIPBOARD_VIDEO_ERROR:",h=l.indexOf(c);if(h!==-1)throw new zd(l.slice(h+c.length).trim());const p=l.match(/execution error: Error: (复制来源未提供可读取的视频数据[^\r\n]*|无法读取剪贴板视频)(?:\s*\(-\d+\))?\s*$/);throw p?new zd(p[1]):i}if(ih()?.targetPeerId!==e)throw new Error("目标服务已切换,请重新粘贴");const r=[],n=[];for(const i of t??[])if(i.path&&e)n.push(i.path);else if(i.bytes){if(i.type?.startsWith("video/")&&i.bytes.byteLength===0)throw new zd("复制来源未提供可读取的视频数据,请重新复制视频或选择文件上传");r.push(new File([i.bytes],i.name,{type:i.type||"application/octet-stream"}))}else throw new Error("剪贴板未提供可读取的文件");return{files:r,paths:n}}async function kT(e){if(!e.length)return[];const{files:t}=await Bu("/tmp",e);if(t.length!==e.length||t.some(r=>!r.path))throw new Error("Upload did not return every file path");return t.map(r=>r.path)}function Ps(e){return{dispose:e}}function IT(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function ET(...e){return Ps(()=>IT(e))}var yb=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.clear()}}clear(){for(let e of this._disposables)e.dispose();this._disposables.clear()}},mc=class{constructor(){this._store=new yb}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};mc.None=Object.freeze({dispose(){}});var S0=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},vb=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),Ou=vb?"node":navigator.userAgent,NT=vb?"node":navigator.platform,RT=Ou.includes("Firefox");Ou.includes("Chrome");var MT=Ou.includes("Edge"),wb=/^((?!chrome|android).)*safari/i.test(Ou);function DT(){if(!wb)return 0;let e=Ou.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1],10)}NT.indexOf("Linux")>=0;var Zs=0,Ks=0,Xs=0,vs=0,ro={css:"#00000000",rgba:0},qi;(e=>{function t(i,l,c,h){return h!==void 0?`#${Yl(i)}${Yl(l)}${Yl(c)}${Yl(h)}`:`#${Yl(i)}${Yl(l)}${Yl(c)}`}e.toCss=t;function r(i,l,c,h=255){return(i<<24|l<<16|c<<8|h)>>>0}e.toRgba=r;function n(i,l,c,h){return{css:e.toCss(i,l,c,h),rgba:e.toRgba(i,l,c,h)}}e.toColor=n})(qi||={});var iu;(e=>{function t(p,g){if(vs=(g.rgba&255)/255,vs===1)return{css:g.css,rgba:g.rgba};let x=g.rgba>>24&255,b=g.rgba>>16&255,w=g.rgba>>8&255,A=p.rgba>>24&255,k=p.rgba>>16&255,E=p.rgba>>8&255;Zs=A+Math.round((x-A)*vs),Ks=k+Math.round((b-k)*vs),Xs=E+Math.round((w-E)*vs);let I=qi.toCss(Zs,Ks,Xs),M=qi.toRgba(Zs,Ks,Xs);return{css:I,rgba:M}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function n(p,g,x){let b=lc.ensureContrastRatio(p.rgba,g.rgba,x);if(b)return qi.toColor(b>>24&255,b>>16&255,b>>8&255)}e.ensureContrastRatio=n;function i(p){let g=(p.rgba|255)>>>0;return[Zs,Ks,Xs]=lc.toChannels(g),{css:qi.toCss(Zs,Ks,Xs),rgba:g}}e.opaque=i;function l(p,g){return vs=Math.round(g*255),[Zs,Ks,Xs]=lc.toChannels(p.rgba),{css:qi.toCss(Zs,Ks,Xs,vs),rgba:qi.toRgba(Zs,Ks,Xs,vs)}}e.opacity=l;function c(p,g){return vs=p.rgba&255,l(p,vs*g/255)}e.multiplyOpacity=c;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(iu||={});var BT;(e=>{let t,r;try{let i=document.createElement("canvas");i.width=1,i.height=1;let l=i.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return Zs=parseInt(i.slice(1,2).repeat(2),16),Ks=parseInt(i.slice(2,3).repeat(2),16),Xs=parseInt(i.slice(3,4).repeat(2),16),qi.toColor(Zs,Ks,Xs);case 5:return Zs=parseInt(i.slice(1,2).repeat(2),16),Ks=parseInt(i.slice(2,3).repeat(2),16),Xs=parseInt(i.slice(3,4).repeat(2),16),vs=parseInt(i.slice(4,5).repeat(2),16),qi.toColor(Zs,Ks,Xs,vs);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let l=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return Zs=parseInt(l[1],10),Ks=parseInt(l[2],10),Xs=parseInt(l[3],10),vs=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),qi.toColor(Zs,Ks,Xs,vs);if(i==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Zs,Ks,Xs,vs]=t.getImageData(0,0,1,1).data,vs!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:qi.toRgba(Zs,Ks,Xs,vs),css:i}}e.toColor=n})(BT||={});var Wi;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,i,l){let c=n/255,h=i/255,p=l/255,g=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),x=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),b=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return g*.2126+x*.7152+b*.0722}e.relativeLuminance2=r})(Wi||={});var lc;(e=>{function t(c,h){if(vs=(h&255)/255,vs===1)return h;let p=h>>24&255,g=h>>16&255,x=h>>8&255,b=c>>24&255,w=c>>16&255,A=c>>8&255;return Zs=b+Math.round((p-b)*vs),Ks=w+Math.round((g-w)*vs),Xs=A+Math.round((x-A)*vs),qi.toRgba(Zs,Ks,Xs)}e.blend=t;function r(c,h,p){let g=Wi.relativeLuminance(c>>8),x=Wi.relativeLuminance(h>>8);if(nl(g,x)<p){if(x<g){let A=n(c,h,p),k=nl(g,Wi.relativeLuminance(A>>8));if(k<p){let E=i(c,h,p),I=nl(g,Wi.relativeLuminance(E>>8));return k>I?A:E}return A}let b=i(c,h,p),w=nl(g,Wi.relativeLuminance(b>>8));if(w<p){let A=n(c,h,p),k=nl(g,Wi.relativeLuminance(A>>8));return w>k?b:A}return b}}e.ensureContrastRatio=r;function n(c,h,p){let g=c>>24&255,x=c>>16&255,b=c>>8&255,w=h>>24&255,A=h>>16&255,k=h>>8&255,E=nl(Wi.relativeLuminance2(w,A,k),Wi.relativeLuminance2(g,x,b));for(;E<p&&(w>0||A>0||k>0);)w-=Math.max(0,Math.ceil(w*.1)),A-=Math.max(0,Math.ceil(A*.1)),k-=Math.max(0,Math.ceil(k*.1)),E=nl(Wi.relativeLuminance2(w,A,k),Wi.relativeLuminance2(g,x,b));return(w<<24|A<<16|k<<8|255)>>>0}e.reduceLuminance=n;function i(c,h,p){let g=c>>24&255,x=c>>16&255,b=c>>8&255,w=h>>24&255,A=h>>16&255,k=h>>8&255,E=nl(Wi.relativeLuminance2(w,A,k),Wi.relativeLuminance2(g,x,b));for(;E<p&&(w<255||A<255||k<255);)w=Math.min(255,w+Math.ceil((255-w)*.1)),A=Math.min(255,A+Math.ceil((255-A)*.1)),k=Math.min(255,k+Math.ceil((255-k)*.1)),E=nl(Wi.relativeLuminance2(w,A,k),Wi.relativeLuminance2(g,x,b));return(w<<24|A<<16|k<<8|255)>>>0}e.increaseLuminance=i;function l(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=l})(lc||={});function Yl(e){let t=e.toString(16);return t.length<2?"0"+t:t}function nl(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Ms(e){if(!e)throw new Error("value must not be falsy");return e}function k1(e){return 57508<=e&&e<=57558}function QT(e){return 57520<=e&&e<=57527}function jT(e){return 57344<=e&&e<=63743}function PT(e){return 9472<=e&&e<=9631}function OT(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function FT(e,t,r,n){return t===1&&r>Math.ceil(n*1.5)&&e!==void 0&&e>255&&!OT(e)&&!k1(e)&&!jT(e)}function Ab(e){return k1(e)||PT(e)}function $T(){return{css:{canvas:ld(),cell:ld()},device:{canvas:ld(),cell:ld(),char:{width:0,height:0,left:0,top:0}}}}function ld(){return{width:0,height:0}}function UT(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var Ce;(e=>(e.LINE_H=Object.freeze({type:2,data:"M0,.5 L1,.5",strokeWidth:1}),e.LINE_V=Object.freeze({type:2,data:"M.5,0 L.5,1",strokeWidth:1}),e.FADE_RIGHT=Object.freeze({type:2,data:"M0,.5 L.28,.5 M.32,.5 L.52,.5 M.60,.5 L.72,.5 M.84,.5 L.90,.5",strokeWidth:1}),e.FADE_LEFT=Object.freeze({type:2,data:"M.10,.5 L.16,.5 M.28,.5 L.40,.5 M.48,.5 L.68,.5 M.72,.5 L1,.5",strokeWidth:1}),e.FADE_DOWN=Object.freeze({type:2,data:"M.5,0 L.5,.28 M.5,.32 L.5,.52 M.5,.60 L.5,.72 M.5,.84 L.5,.90",strokeWidth:1}),e.FADE_UP=Object.freeze({type:2,data:"M.5,.10 L.5,.16 M.5,.28 L.5,.40 M.5,.48 L.5,.68 M.5,.72 L.5,1",strokeWidth:1}),e.CURVE_DOWN_RIGHT=Object.freeze({type:2,data:(t,r)=>`M.5,1 L.5,${.5+r/.15*.5} C.5,${.5+r/.15*.5},.5,.5,1,.5`,strokeWidth:1}),e.CURVE_DOWN_LEFT=Object.freeze({type:2,data:(t,r)=>`M.5,1 L.5,${.5+r/.15*.5} C.5,${.5+r/.15*.5},.5,.5,0,.5`,strokeWidth:1}),e.CURVE_UP_RIGHT=Object.freeze({type:2,data:(t,r)=>`M.5,0 L.5,${.5-r/.15*.5} C.5,${.5-r/.15*.5},.5,.5,1,.5`,strokeWidth:1}),e.CURVE_UP_LEFT=Object.freeze({type:2,data:(t,r)=>`M.5,0 L.5,${.5-r/.15*.5} C.5,${.5-r/.15*.5},.5,.5,0,.5`,strokeWidth:1}),e.NODE_FILL=Object.freeze({type:3,data:"M.85,.5 A.35,.175,0,1,1,.15,.5 A.35,.175,0,1,1,.85,.5"}),e.NODE_STROKE=Object.freeze({type:3,data:"M.85,.5 A.35,.175,0,1,1,.15,.5 A.35,.175,0,1,1,.85,.5",strokeWidth:1}),e.NODE_LINE_RIGHT=Object.freeze({type:3,data:"M1,.5 L.85,.5",strokeWidth:1}),e.NODE_LINE_LEFT=Object.freeze({type:3,data:"M0,.5 L.15,.5",strokeWidth:1}),e.NODE_LINE_DOWN=Object.freeze({type:3,data:"M.5,1 L.5,.7",strokeWidth:1}),e.NODE_LINE_UP=Object.freeze({type:3,data:"M.5,0 L.5,.3",strokeWidth:1})))(Ce||={});var zT={"─":{type:2,data:"M0,.5 L1,.5",strokeWidth:1},"━":{type:2,data:"M0,.5 L1,.5",strokeWidth:3},"│":{type:2,data:"M.5,0 L.5,1",strokeWidth:1},"┃":{type:2,data:"M.5,0 L.5,1",strokeWidth:3},"┄":{type:2,data:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5",strokeWidth:1},"┅":{type:2,data:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5",strokeWidth:3},"┆":{type:2,data:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333",strokeWidth:1},"┇":{type:2,data:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333",strokeWidth:3},"┈":{type:2,data:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5",strokeWidth:1},"┉":{type:2,data:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5",strokeWidth:3},"┊":{type:2,data:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95",strokeWidth:1},"┋":{type:2,data:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95",strokeWidth:3},"┌":{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:1},"┍":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┎":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┏":{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:3},"┐":{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:1},"┑":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┒":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┓":{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:3},"└":{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:1},"┕":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┖":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┗":{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:3},"┘":{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:1},"┙":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┚":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┛":{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:3},"├":{type:2,data:"M.5,0 L.5,1 M.5,.5 L1,.5",strokeWidth:1},"┝":[{type:2,data:"M.5,0 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┞":[{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┟":[{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┠":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1",strokeWidth:3}],"┡":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:3}],"┢":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:3}],"┣":{type:2,data:"M.5,0 L.5,1 M.5,.5 L1,.5",strokeWidth:3},"┤":{type:2,data:"M.5,0 L.5,1 M.5,.5 L0,.5",strokeWidth:1},"┥":[{type:2,data:"M.5,0 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┦":[{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┧":[{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┨":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1",strokeWidth:3}],"┩":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:3}],"┪":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:3}],"┫":{type:2,data:"M.5,0 L.5,1 M.5,.5 L0,.5",strokeWidth:3},"┬":{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,1",strokeWidth:1},"┭":[{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┮":[{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┯":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M0,.5 L1,.5",strokeWidth:3}],"┰":[{type:2,data:"M0,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┱":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:3}],"┲":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:3}],"┳":{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,1",strokeWidth:3},"┴":{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,0",strokeWidth:1},"┵":[{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┶":[{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┷":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M0,.5 L1,.5",strokeWidth:3}],"┸":[{type:2,data:"M0,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┹":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:3}],"┺":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:3}],"┻":{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,0",strokeWidth:3},"┼":{type:2,data:"M0,.5 L1,.5 M.5,0 L.5,1",strokeWidth:1},"┽":[{type:2,data:"M.5,0 L.5,1 M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┾":[{type:2,data:"M.5,0 L.5,1 M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┿":[{type:2,data:"M.5,0 L.5,1",strokeWidth:1},{type:2,data:"M0,.5 L1,.5",strokeWidth:3}],"╀":[{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"╁":[{type:2,data:"M.5,.5 L.5,0 M0,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"╂":[{type:2,data:"M0,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1",strokeWidth:3}],"╃":[{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:3}],"╄":[{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:3}],"╅":[{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:3}],"╆":[{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:3}],"╇":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0 M0,.5 L1,.5",strokeWidth:3}],"╈":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,1",strokeWidth:3}],"╉":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1 M.5,.5 L0,.5",strokeWidth:3}],"╊":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1 M.5,.5 L1,.5",strokeWidth:3}],"╋":{type:2,data:"M0,.5 L1,.5 M.5,0 L.5,1",strokeWidth:3},"╌":{type:2,data:"M.1,.5 L.4,.5 M.6,.5 L.9,.5",strokeWidth:1},"╍":{type:2,data:"M.1,.5 L.4,.5 M.6,.5 L.9,.5",strokeWidth:3},"╎":{type:2,data:"M.5,.1 L.5,.4 M.5,.6 L.5,.9",strokeWidth:1},"╏":{type:2,data:"M.5,.1 L.5,.4 M.5,.6 L.5,.9",strokeWidth:3},"═":{type:2,data:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`,strokeWidth:1},"║":{type:2,data:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`,strokeWidth:1},"╒":{type:2,data:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`,strokeWidth:1},"╓":{type:2,data:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`,strokeWidth:1},"╔":{type:2,data:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`,strokeWidth:1},"╕":{type:2,data:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`,strokeWidth:1},"╖":{type:2,data:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`,strokeWidth:1},"╗":{type:2,data:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`,strokeWidth:1},"╘":{type:2,data:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`,strokeWidth:1},"╙":{type:2,data:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`,strokeWidth:1},"╚":{type:2,data:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`,strokeWidth:1},"╛":{type:2,data:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`,strokeWidth:1},"╜":{type:2,data:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`,strokeWidth:1},"╝":{type:2,data:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`,strokeWidth:1},"╞":{type:2,data:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`,strokeWidth:1},"╟":{type:2,data:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`,strokeWidth:1},"╠":{type:2,data:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`,strokeWidth:1},"╡":{type:2,data:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`,strokeWidth:1},"╢":{type:2,data:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`,strokeWidth:1},"╣":{type:2,data:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`,strokeWidth:1},"╤":{type:2,data:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`,strokeWidth:1},"╥":{type:2,data:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`,strokeWidth:1},"╦":{type:2,data:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`,strokeWidth:1},"╧":{type:2,data:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`,strokeWidth:1},"╨":{type:2,data:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`,strokeWidth:1},"╩":{type:2,data:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`,strokeWidth:1},"╪":{type:2,data:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`,strokeWidth:1},"╫":{type:2,data:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`,strokeWidth:1},"╬":{type:2,data:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`,strokeWidth:1},"╭":{type:2,data:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`,strokeWidth:1},"╮":{type:2,data:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`,strokeWidth:1},"╯":{type:2,data:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`,strokeWidth:1},"╰":{type:2,data:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`,strokeWidth:1},"╱":{type:2,data:"M1,0 L0,1",strokeWidth:1},"╲":{type:2,data:"M0,0 L1,1",strokeWidth:1},"╳":{type:2,data:"M1,0 L0,1 M0,0 L1,1",strokeWidth:1},"╴":{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},"╵":{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},"╶":{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},"╷":{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},"╸":{type:2,data:"M.5,.5 L0,.5",strokeWidth:3},"╹":{type:2,data:"M.5,.5 L.5,0",strokeWidth:3},"╺":{type:2,data:"M.5,.5 L1,.5",strokeWidth:3},"╻":{type:2,data:"M.5,.5 L.5,1",strokeWidth:3},"╼":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"╽":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"╾":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"╿":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"▀":{type:0,data:[{x:0,y:0,w:8,h:4}]},"▁":{type:0,data:[{x:0,y:7,w:8,h:1}]},"▂":{type:0,data:[{x:0,y:6,w:8,h:2}]},"▃":{type:0,data:[{x:0,y:5,w:8,h:3}]},"▄":{type:0,data:[{x:0,y:4,w:8,h:4}]},"▅":{type:0,data:[{x:0,y:3,w:8,h:5}]},"▆":{type:0,data:[{x:0,y:2,w:8,h:6}]},"▇":{type:0,data:[{x:0,y:1,w:8,h:7}]},"█":{type:0,data:[{x:0,y:0,w:8,h:8}]},"▉":{type:0,data:[{x:0,y:0,w:7,h:8}]},"▊":{type:0,data:[{x:0,y:0,w:6,h:8}]},"▋":{type:0,data:[{x:0,y:0,w:5,h:8}]},"▌":{type:0,data:[{x:0,y:0,w:4,h:8}]},"▍":{type:0,data:[{x:0,y:0,w:3,h:8}]},"▎":{type:0,data:[{x:0,y:0,w:2,h:8}]},"▏":{type:0,data:[{x:0,y:0,w:1,h:8}]},"▐":{type:0,data:[{x:4,y:0,w:4,h:8}]},"░":{type:1,data:[[1,0],[0,0]]},"▒":{type:1,data:[[1,0],[0,1]]},"▓":{type:1,data:[[1,1],[1,0]]},"▔":{type:0,data:[{x:0,y:0,w:8,h:1}]},"▕":{type:0,data:[{x:7,y:0,w:1,h:8}]},"▖":{type:0,data:[{x:0,y:4,w:4,h:4}]},"▗":{type:0,data:[{x:4,y:4,w:4,h:4}]},"▘":{type:0,data:[{x:0,y:0,w:4,h:4}]},"▙":{type:0,data:[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}]},"▚":{type:0,data:[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}]},"▛":{type:0,data:[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}]},"▜":{type:0,data:[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}]},"▝":{type:0,data:[{x:4,y:0,w:4,h:4}]},"▞":{type:0,data:[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}]},"▟":{type:0,data:[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}]},"":{type:5,data:{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0}},"":{type:5,data:{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0}},"":{type:5,data:{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0}},"":{type:5,data:{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.7,.03 L.7,.1 L.355,.1 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0}},"":{type:5,data:{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2}},"":{type:5,data:{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2}},"":{type:5,data:{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1}},"":{type:5,data:{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1}},"":{type:5,data:{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1}},"":{type:5,data:{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1}},"":{type:5,data:{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0}},"":{type:5,data:{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0}},"":{type:5,data:{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0}},"":{type:5,data:{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},"":{type:5,data:{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M0.8069,0.6075 Q0.7991,0.612,0.7815,0.6218 T0.7542,0.6369 T0.7282,0.6508 T0.7016,0.6644 T0.6778,0.6758 T0.6551,0.6854 T0.637,0.6911 T0.622,0.6936 Q0.6186,0.6936,0.6128,0.6942 T0.6018,0.6952 T0.5894,0.6956 T0.5757,0.6952 T0.561,0.693 T0.5451,0.6879 Q0.5342,0.6834,0.5193,0.6756 T0.4925,0.6614 T0.4673,0.6485 T0.4436,0.6389 T0.4239,0.6363 T0.4089,0.6422 Q0.4045,0.6467,0.3958,0.6554 T0.3843,0.6669 T0.3748,0.6746 T0.3613,0.683 T0.3442,0.6903 L0.3499,0.6956 Q0.3584,0.7042,0.3679,0.7177 T0.3836,0.7403 T0.4019,0.7583 T0.4295,0.7703 Q0.4688,0.7785,0.5203,0.7605 Q0.4902,0.7817,0.449,0.7911 T0.3696,0.8001 Q0.3567,0.7997,0.341,0.7942 T0.3111,0.7813 T0.2805,0.766 T0.2493,0.753 T0.218,0.7472 T0.187,0.754 Q0.1762,0.7589,0.1653,0.7681 T0.1453,0.7895 T0.1308,0.818 T0.1264,0.8507 L0.1264,0.858 Q0.1453,0.8462,0.1607,0.8433 T0.1899,0.8452 T0.2226,0.8625 Q0.2344,0.8707,0.2485,0.8752 T0.2813,0.8831 T0.3089,0.889 Q0.2981,0.8915,0.2846,0.8956 T0.2603,0.9037 T0.2368,0.9115 T0.2129,0.9174 T0.1894,0.9194 T0.1653,0.9155 Q0.1504,0.9115,0.1328,0.9196 T0.0986,0.9421 T0.0655,0.9708 T0.0317,0.9943 T0,1 Q0.001,0.94,0.0017,0.6508 T0.0024,0.2322 Q0.002,0.2109,0.0007,0.1379 T0,0.0249 Q0.0058,0.0253,0.009,0.0257 T0.0156,0.0288 T0.0203,0.0333 T0.0264,0.0422 T0.0349,0.0539 Q0.044,0.0657,0.0542,0.072 T0.0752,0.0789 T0.096,0.0775 T0.1175,0.0694 T0.1379,0.0573 T0.1579,0.0432 Q0.2141,0,0.2673,0.0318 Q0.2588,0.0318,0.2517,0.033 T0.239,0.0361 T0.2276,0.0424 T0.218,0.0504 T0.2085,0.0612 T0.1997,0.0732 T0.1899,0.0875 T0.1795,0.1028 Q0.1748,0.1093,0.1507,0.1234 T0.1186,0.1448 Q0.0999,0.1612,0.1108,0.1783 Q0.1162,0.1877,0.1238,0.1928 T0.1404,0.1979 T0.158,0.1967 T0.1775,0.1895 T0.1963,0.1791 T0.2151,0.1663 T0.2314,0.1534 T0.2458,0.141 T0.2561,0.1322 Q0.2815,0.1106,0.3017,0.101 T0.344,0.0926 T0.3919,0.1077 Q0.4099,0.1175,0.4265,0.1206 T0.4588,0.1202 T0.488,0.1098 T0.5176,0.0914 Q0.5071,0.1032,0.4963,0.1122 T0.4722,0.1285 T0.4497,0.1401 T0.4223,0.1518 T0.3943,0.1636 Q0.374,0.1726,0.3623,0.1863 T0.3482,0.2162 Q0.3445,0.2403,0.3608,0.2605 T0.4072,0.2876 Q0.4194,0.2909,0.4326,0.2899 T0.457,0.2856 T0.4805,0.2764 T0.5032,0.264 T0.5256,0.2497 T0.5478,0.2352 T0.5698,0.2222 T0.5921,0.2118 Q0.6982,0.173,0.81,0.2436 Q0.833,0.2583,0.8496,0.2674 T0.887,0.2846 T0.925,0.294 T0.9617,0.2911 T1,0.2746 Q0.9817,0.2946,0.96,0.3056 T0.9175,0.3191 T0.8731,0.3209 T0.8277,0.3164 T0.7818,0.3109 T0.7359,0.3101 T0.6907,0.3197 T0.647,0.3448 Q0.6443,0.3472,0.6333,0.3562 T0.6194,0.3674 T0.6076,0.3766 T0.594,0.386 T0.5815,0.3931 T0.5661,0.4007 T0.5501,0.4064 L0.5556,0.4121 Q0.5627,0.4198,0.5722,0.4251 T0.5926,0.4337 T0.6131,0.439 T0.6343,0.4431 T0.6521,0.4468 Q0.6762,0.4529,0.7056,0.4463 Q0.6772,0.4623,0.6543,0.471 T0.604,0.4814 Q0.5962,0.4818,0.5815,0.4825 T0.5591,0.4835 T0.5393,0.4857 T0.519,0.4908 T0.5007,0.4996 T0.4812,0.5141 T0.4627,0.5353 L0.4549,0.5451 L0.4661,0.543 Q0.4759,0.541,0.4909,0.55 T0.5315,0.5796 T0.5684,0.6083 Q0.5799,0.6161,0.5915,0.6212 T0.6181,0.6308 L0.6331,0.6353 Q0.6514,0.6418,0.7004,0.633 T0.8069,0.6075 Z",type:0}},"":{type:5,data:{d:"M0.011,0.0469 Q0.0152,0.0412,0.02,0.0361 T0.0292,0.0281 T0.0365,0.0253 Q0.0426,0.0257,0.0461,0.0263 T0.0534,0.03 T0.0582,0.0345 T0.0645,0.0434 T0.0723,0.0546 Q0.0807,0.0653,0.0897,0.0712 T0.1081,0.0775 T0.1255,0.0765 T0.1438,0.0695 T0.1605,0.0593 T0.1772,0.0473 Q0.2388,0,0.2927,0.0326 L0.2614,0.0767 L0.2581,0.0767 Q0.2494,0.0767,0.2444,0.0773 T0.2359,0.0789 T0.2291,0.0842 T0.2233,0.0922 T0.2146,0.1054 T0.2026,0.1236 Q0.1943,0.1354,0.1843,0.1444 T0.1675,0.1574 T0.1526,0.1654 T0.1429,0.1701 Q0.1436,0.1717,0.1446,0.1733 Q0.1504,0.1823,0.1581,0.1866 T0.1733,0.1915 T0.1909,0.1884 T0.2085,0.1809 T0.2265,0.169 T0.2427,0.1564 T0.2575,0.1436 T0.2688,0.1338 Q0.2969,0.1101,0.3195,0.0995 T0.3643,0.0901 T0.4114,0.1048 Q0.4279,0.1138,0.4426,0.1168 T0.4705,0.117 T0.4945,0.1089 T0.5186,0.0942 L0.5211,0.0926 L0.5289,0.0922 Q0.5411,0.095,0.5189,0.1203 Q0.505,0.1358,0.4913,0.1474 T0.4634,0.167 T0.4389,0.1796 T0.4121,0.1909 T0.3866,0.2011 Q0.3782,0.2047,0.3727,0.2092 Q0.3717,0.2117,0.3714,0.2141 Q0.3695,0.2263,0.3751,0.2388 T0.394,0.2616 T0.4253,0.2761 Q0.4398,0.2785,0.4513,0.2779 T0.4756,0.2724 T0.4987,0.2616 T0.5216,0.2476 T0.5453,0.2321 T0.5703,0.217 T0.5976,0.2043 Q0.7015,0.166,0.8099,0.2345 Q0.8361,0.2512,0.8572,0.2616 T0.9006,0.2779 T0.9432,0.281 T0.9819,0.2663 L0.9887,0.2671 Q1,0.272,0.9768,0.2969 Q0.9558,0.3193,0.9319,0.333 T0.8858,0.3513 T0.8391,0.3569 T0.793,0.3546 T0.7485,0.3497 T0.7065,0.3473 T0.6681,0.3522 T0.6344,0.3699 Q0.5963,0.4005,0.5847,0.4082 Q0.595,0.4139,0.6079,0.4174 T0.6367,0.4237 T0.6586,0.4278 Q0.6793,0.4331,0.7044,0.4278 Q0.7057,0.4278,0.707,0.4274 Q0.7067,0.429,0.7062,0.4313 T0.7036,0.4398 T0.6993,0.4513 T0.6931,0.4619 T0.6851,0.4698 Q0.6573,0.4857,0.6336,0.4947 T0.5831,0.5053 Q0.577,0.5057,0.5615,0.5065 T0.5394,0.508 T0.5221,0.51 T0.5042,0.5139 T0.4905,0.5204 Q0.5008,0.5232,0.515,0.5328 T0.549,0.5585 T0.5799,0.5824 Q0.5905,0.5897,0.6013,0.5946 T0.6262,0.6036 T0.6409,0.6081 Q0.6567,0.6134,0.7035,0.605 T0.8028,0.5816 L0.7974,0.5922 T0.7867,0.6134 L0.7812,0.624 Q0.7799,0.6248,0.7786,0.6252 Q0.7709,0.6297,0.7573,0.6372 T0.7346,0.6499 T0.7123,0.6621 T0.6897,0.6741 T0.6686,0.6847 T0.648,0.6941 T0.6297,0.7013 T0.6129,0.7062 T0.5995,0.7076 Q0.5992,0.7076,0.5831,0.7092 T0.5529,0.7092 T0.525,0.7019 Q0.5105,0.6958,0.4824,0.6811 T0.4356,0.6586 T0.4079,0.6533 Q0.3872,0.6741,0.3827,0.6782 Q0.3872,0.6835,0.3934,0.6929 T0.4037,0.7078 T0.4142,0.7198 T0.4284,0.7304 T0.4466,0.7365 Q0.4824,0.7443,0.5292,0.728 L0.5292,0.7294 T0.529,0.7333 T0.5284,0.7392 T0.5266,0.7463 T0.5236,0.7539 T0.5186,0.7612 T0.5111,0.7679 Q0.5086,0.77,0.5056,0.7716 Q0.4466,0.8104,0.3591,0.8091 Q0.344,0.8091,0.3246,0.802 T0.2893,0.7863 T0.2543,0.77 T0.2206,0.76 T0.1894,0.7643 Q0.1804,0.7684,0.1733,0.7753 Q0.1591,0.7892,0.1601,0.8169 Q0.1784,0.8067,0.1938,0.8053 T0.2212,0.8087 T0.2507,0.825 Q0.2614,0.8324,0.2744,0.8365 T0.3053,0.844 T0.332,0.8499 L0.303,0.894 L0.2998,0.8948 Q0.2904,0.8968,0.278,0.9009 T0.2554,0.9086 T0.233,0.9158 T0.2099,0.9213 T0.1868,0.9229 T0.1633,0.9192 Q0.1517,0.916,0.1367,0.9241 T0.1065,0.9462 T0.0753,0.9737 T0.041,0.9955 T0.0061,1 Q0,0.9984,0.0068,0.9845 Q0.009,0.9804,0.0123,0.9755 Q0.0187,0.9666,0.0261,0.9606 T0.0374,0.9555 Q0.0481,0.958,0.0629,0.949 T0.0931,0.9262 T0.1247,0.8987 T0.1597,0.8777 T0.1949,0.8752 Q0.213,0.8805,0.2343,0.8772 Q0.2249,0.8736,0.2172,0.8683 Q0.1914,0.8511,0.1738,0.8497 T0.1349,0.8617 Q0.1304,0.865,0.1273,0.8646 T0.1242,0.8605 L0.1239,0.8536 Q0.1226,0.8295,0.1354,0.8016 T0.1723,0.7496 Q0.1914,0.7308,0.2104,0.7219 Q0.2259,0.7145,0.2425,0.7141 T0.273,0.7182 T0.3022,0.7296 T0.3301,0.7439 T0.3569,0.7571 T0.3821,0.7643 Q0.373,0.7561,0.3598,0.7367 T0.3382,0.7088 L0.3327,0.7035 Q0.3282,0.699,0.3353,0.6884 T0.3517,0.6692 L0.3611,0.6607 Q0.3711,0.657,0.3751,0.6554 T0.3837,0.6507 T0.3898,0.6458 T0.3979,0.637 T0.4111,0.6236 Q0.4172,0.6175,0.4234,0.6138 Q0.4327,0.6081,0.4439,0.6077 T0.4655,0.6105 T0.4884,0.6201 T0.5113,0.633 T0.5347,0.6468 T0.5573,0.6578 Q0.5705,0.6635,0.5833,0.665 T0.6112,0.665 T0.6286,0.6635 Q0.6421,0.6631,0.6718,0.6501 Q0.626,0.6578,0.6089,0.6517 Q0.6063,0.6509,0.6002,0.6491 T0.5884,0.6454 T0.5757,0.6409 T0.561,0.6344 T0.5466,0.6256 Q0.536,0.6183,0.5108,0.5989 T0.4722,0.5712 T0.4527,0.564 L0.4418,0.5661 Q0.4308,0.5681,0.4366,0.5563 Q0.4401,0.5485,0.4476,0.5392 L0.455,0.5298 Q0.4631,0.5188,0.4714,0.51 T0.4866,0.4947 T0.5021,0.4831 T0.516,0.4749 T0.53,0.4694 T0.5428,0.4657 T0.5558,0.4637 T0.5674,0.4629 T0.5795,0.4625 Q0.5489,0.4543,0.534,0.4384 L0.5286,0.4327 Q0.5244,0.4282,0.5318,0.4174 T0.5486,0.398 L0.5579,0.3899 Q0.567,0.387,0.5749,0.3834 T0.5878,0.3772 T0.6012,0.3687 T0.6126,0.3603 T0.6268,0.3487 T0.6421,0.3361 Q0.6567,0.3242,0.6712,0.3159 T0.7009,0.3034 T0.7277,0.2973 T0.7556,0.2961 T0.7809,0.2977 T0.8074,0.301 Q0.8096,0.3014,0.8109,0.3016 T0.8143,0.302 T0.818,0.3026 Q0.8012,0.2936,0.7767,0.2781 Q0.6718,0.2117,0.5744,0.2476 Q0.5637,0.2516,0.5492,0.2604 T0.5218,0.2779 T0.4923,0.2965 T0.461,0.3124 T0.4282,0.3216 T0.394,0.3206 Q0.3637,0.3136,0.3474,0.2936 T0.3353,0.2459 Q0.3385,0.2247,0.355,0.2023 Q0.3646,0.1892,0.3763,0.179 Q0.3898,0.1672,0.4063,0.1595 Q0.3927,0.1562,0.3785,0.1485 Q0.3604,0.1387,0.3453,0.1354 T0.3161,0.1354 T0.2899,0.1458 T0.2627,0.166 Q0.262,0.1664,0.254,0.1733 T0.2414,0.1841 T0.2267,0.196 T0.2094,0.2086 T0.1915,0.2196 T0.1725,0.2288 T0.1546,0.2337 T0.1373,0.2343 T0.1223,0.228 T0.1097,0.2145 Q0.0962,0.1929,0.1258,0.1582 Q0.131,0.1517,0.1371,0.1464 Q0.1462,0.1387,0.156,0.1321 T0.1752,0.1205 T0.1878,0.1134 Q0.1891,0.1117,0.1947,0.103 T0.2035,0.0899 T0.2125,0.0781 T0.2243,0.064 Q0.1949,0.0616,0.1672,0.0828 Q0.153,0.0934,0.1412,0.1009 T0.1146,0.1146 T0.0873,0.1213 T0.0616,0.116 T0.0374,0.0962 Q0.0339,0.0909,0.0295,0.0846 T0.024,0.0767 T0.0202,0.0728 T0.0148,0.0704 T0.0068,0.0697 Q0.0003,0.0693,0.0058,0.0567 Q0.0077,0.0522,0.011,0.0469 Z",type:0}},"":{type:5,data:{d:"M0.1934,0.6075 Q0.2012,0.612,0.2188,0.6218 T0.2459,0.6369 T0.2718,0.6508 T0.2983,0.6644 T0.322,0.6758 T0.3447,0.6854 T0.363,0.6911 T0.3783,0.6936 Q0.3796,0.6936,0.396,0.6952 T0.4265,0.6952 T0.4548,0.6879 Q0.4656,0.6834,0.4805,0.6756 T0.5073,0.6614 T0.5327,0.6485 T0.5564,0.6389 T0.5759,0.6363 T0.5909,0.6422 Q0.5953,0.6467,0.604,0.6554 T0.6155,0.6669 T0.6251,0.6746 T0.6387,0.683 T0.6556,0.6903 L0.6498,0.6956 Q0.6414,0.7042,0.6319,0.7177 T0.6162,0.7403 T0.5979,0.7583 T0.5703,0.7703 Q0.5313,0.7785,0.4799,0.7605 Q0.5097,0.7817,0.5508,0.7911 T0.6302,0.8001 Q0.6431,0.7997,0.659,0.7942 T0.6888,0.7813 T0.7194,0.766 T0.7506,0.753 T0.7819,0.7472 T0.8131,0.754 Q0.8239,0.7589,0.8346,0.7681 T0.8544,0.7895 T0.8689,0.818 T0.8737,0.8507 L0.8733,0.858 Q0.8591,0.849,0.8474,0.845 T0.8242,0.8421 T0.8021,0.8482 T0.7772,0.8625 Q0.7653,0.8707,0.7513,0.8752 T0.7184,0.8831 T0.6908,0.889 Q0.7017,0.8915,0.7152,0.8956 T0.7396,0.9037 T0.7633,0.9115 T0.7872,0.9174 T0.8107,0.9194 T0.8347,0.9155 Q0.8493,0.9115,0.8671,0.9196 T0.9015,0.9421 T0.9345,0.9708 T0.9682,0.9943 T0.9997,1 Q0.999,0.94,0.9983,0.6508 T0.9976,0.2322 Q0.9976,0.2109,0.9992,0.1379 T1,0.0249 Q0.9949,0.0249,0.9917,0.0257 T0.9863,0.0273 T0.9817,0.0308 T0.9776,0.0357 T0.9721,0.0437 T0.9651,0.0539 Q0.956,0.0657,0.9456,0.072 T0.9247,0.0789 T0.904,0.0775 T0.8823,0.0694 T0.862,0.0573 T0.8422,0.0432 Q0.7856,0,0.7328,0.0318 Q0.7392,0.0318,0.7452,0.0324 T0.756,0.0345 T0.7657,0.0386 T0.7741,0.0437 T0.7821,0.0506 T0.7894,0.0588 T0.7966,0.0683 T0.8039,0.0787 T0.8119,0.0904 T0.8202,0.1028 Q0.8249,0.1093,0.849,0.1234 T0.8811,0.1448 Q0.8998,0.1612,0.8893,0.1783 Q0.8835,0.1877,0.8759,0.1928 T0.8593,0.1979 T0.8417,0.1967 T0.8222,0.1895 T0.8034,0.1791 T0.7848,0.1663 T0.7687,0.1534 T0.7543,0.141 T0.744,0.1322 Q0.7186,0.1106,0.6984,0.101 T0.6559,0.0926 T0.6082,0.1077 Q0.5899,0.1175,0.5733,0.1206 T0.5411,0.1202 T0.5122,0.1098 T0.4822,0.0914 Q0.4927,0.1032,0.5036,0.1122 T0.5276,0.1285 T0.5503,0.1401 T0.5777,0.1518 T0.6055,0.1636 Q0.6258,0.1726,0.6375,0.1863 T0.6519,0.2162 Q0.6556,0.2403,0.6392,0.2605 T0.5926,0.2876 Q0.5804,0.2909,0.5672,0.2899 T0.5428,0.2856 T0.5193,0.2764 T0.4966,0.264 T0.4744,0.2497 T0.4523,0.2352 T0.4301,0.2222 T0.4077,0.2118 Q0.3021,0.173,0.1903,0.2436 Q0.1669,0.2583,0.1504,0.2674 T0.1129,0.2846 T0.075,0.294 T0.0384,0.2911 T0,0.2746 Q0.021,0.297,0.0459,0.3082 T0.0953,0.3207 T0.146,0.3193 T0.1988,0.3131 T0.2508,0.3095 T0.3029,0.3176 T0.3529,0.3448 Q0.3566,0.348,0.3652,0.355 T0.3771,0.3645 T0.3877,0.3731 T0.3993,0.3815 T0.4103,0.3884 T0.4226,0.3953 T0.4352,0.4009 T0.4497,0.4064 L0.4443,0.4121 Q0.4372,0.4198,0.4277,0.4251 T0.4072,0.4337 T0.3867,0.439 T0.3656,0.4431 T0.3481,0.4468 Q0.3241,0.4529,0.2943,0.4463 Q0.3227,0.4623,0.3458,0.471 T0.3959,0.4814 Q0.404,0.4818,0.4187,0.4825 T0.4409,0.4835 T0.4605,0.4857 T0.4809,0.4908 T0.4992,0.4996 T0.5186,0.5141 T0.5371,0.5353 L0.5449,0.5451 L0.5337,0.543 Q0.5242,0.541,0.5091,0.55 T0.4683,0.5796 T0.4314,0.6083 Q0.4203,0.6161,0.4086,0.6212 T0.382,0.6308 T0.3667,0.6353 Q0.3485,0.6418,0.2995,0.633 T0.1934,0.6075 Z",type:0}},"":{type:5,data:{d:"M0.989,0.0469 Q0.9829,0.0379,0.9753,0.0316 T0.9635,0.0253 Q0.9574,0.0257,0.9539,0.0263 T0.9466,0.03 T0.9418,0.0345 T0.9355,0.0434 T0.9277,0.0546 Q0.9193,0.0653,0.9103,0.0712 T0.8919,0.0775 T0.8745,0.0765 T0.8564,0.0695 T0.8396,0.0593 T0.8228,0.0473 Q0.7612,0,0.7073,0.0326 L0.7386,0.0767 L0.7419,0.0767 Q0.7506,0.0767,0.7556,0.0773 T0.7641,0.0789 T0.7709,0.0842 T0.7767,0.0922 T0.7854,0.1054 T0.7974,0.1236 Q0.8057,0.1354,0.8157,0.1444 T0.8325,0.1574 T0.8474,0.1654 T0.8571,0.1701 Q0.8564,0.1717,0.8554,0.1733 Q0.8503,0.1815,0.844,0.186 T0.8301,0.1909 T0.8153,0.1903 T0.7993,0.1845 T0.7836,0.1758 T0.768,0.1648 T0.754,0.1535 T0.741,0.1425 T0.7312,0.1338 Q0.7031,0.1101,0.6805,0.0995 T0.6357,0.0901 T0.5886,0.1048 Q0.5721,0.1138,0.5574,0.1168 T0.5295,0.117 T0.5055,0.1089 T0.4814,0.0942 L0.4789,0.0926 L0.4711,0.0922 Q0.4589,0.095,0.4811,0.1203 Q0.495,0.1358,0.5087,0.1474 T0.5366,0.167 T0.5611,0.1796 T0.5879,0.1909 T0.6134,0.2011 Q0.6218,0.2047,0.6273,0.2092 Q0.6283,0.2117,0.6286,0.2141 Q0.6305,0.2263,0.6249,0.2388 T0.606,0.2616 T0.5747,0.2761 Q0.5602,0.2785,0.5487,0.2779 T0.5245,0.2724 T0.5015,0.2616 T0.4784,0.2476 T0.4547,0.2321 T0.4297,0.217 T0.4024,0.2043 Q0.2985,0.166,0.1901,0.2345 Q0.1694,0.248,0.1523,0.2569 T0.1165,0.2726 T0.0818,0.2812 T0.0494,0.2796 T0.0181,0.2663 L0.0116,0.2671 Q0,0.272,0.0232,0.2969 Q0.0468,0.3222,0.0742,0.3365 T0.1278,0.3542 T0.1807,0.3564 T0.233,0.352 T0.2815,0.3473 T0.3269,0.3509 T0.3656,0.3699 Q0.4037,0.4005,0.4153,0.4082 Q0.405,0.4139,0.3921,0.4174 T0.3633,0.4237 T0.3414,0.4278 Q0.3207,0.4331,0.2956,0.4278 Q0.2943,0.4278,0.293,0.4274 Q0.2933,0.429,0.2938,0.4313 T0.2964,0.4398 T0.3007,0.4513 T0.3069,0.4619 T0.3149,0.4698 Q0.3427,0.4857,0.3664,0.4947 T0.4169,0.5053 Q0.423,0.5057,0.4385,0.5065 T0.4606,0.508 T0.4779,0.51 T0.4958,0.5139 T0.5095,0.5204 Q0.4992,0.5232,0.485,0.5328 T0.451,0.5585 T0.4201,0.5824 Q0.4095,0.5897,0.3987,0.5946 T0.3738,0.6036 T0.3591,0.6081 Q0.3433,0.6134,0.2965,0.605 T0.1972,0.5816 L0.2026,0.5922 T0.2133,0.6134 L0.2188,0.624 Q0.2201,0.6248,0.2214,0.6252 Q0.2291,0.6297,0.2486,0.6405 T0.2786,0.657 T0.3066,0.6721 T0.3353,0.6866 T0.3598,0.6972 T0.383,0.7051 T0.4005,0.7076 Q0.4008,0.7076,0.4169,0.7092 T0.4471,0.7092 T0.475,0.7019 Q0.4895,0.6958,0.5176,0.6811 T0.5644,0.6586 T0.5921,0.6533 Q0.6128,0.6741,0.6173,0.6782 Q0.6131,0.6835,0.6068,0.6929 T0.5963,0.7078 T0.5858,0.7198 T0.5716,0.7304 T0.5534,0.7365 Q0.5179,0.7443,0.4708,0.728 L0.4708,0.7294 T0.471,0.7333 T0.4716,0.7392 T0.4734,0.7463 T0.4764,0.7539 T0.4814,0.7612 T0.4889,0.7679 Q0.4914,0.77,0.4944,0.7716 Q0.5534,0.8104,0.6409,0.8091 Q0.6521,0.8091,0.6654,0.8053 T0.6907,0.7959 T0.7157,0.7838 T0.741,0.772 T0.7652,0.7631 T0.7888,0.7594 T0.8106,0.7643 Q0.8196,0.7684,0.8267,0.7753 Q0.8409,0.7892,0.8399,0.8169 Q0.8216,0.8067,0.8062,0.8053 T0.7788,0.8087 T0.7493,0.825 Q0.7386,0.8324,0.7256,0.8365 T0.6947,0.844 T0.668,0.8499 L0.697,0.894 L0.7002,0.8948 Q0.7099,0.8968,0.7222,0.9009 T0.7446,0.9086 T0.767,0.9158 T0.7901,0.9213 T0.8132,0.9229 T0.8367,0.9192 Q0.8483,0.916,0.8633,0.9241 T0.8937,0.9462 T0.9248,0.9737 T0.959,0.9955 T0.9939,1 Q1,0.9984,0.9932,0.9845 Q0.991,0.9804,0.9877,0.9755 Q0.9813,0.9666,0.9739,0.9606 T0.9626,0.9555 Q0.9519,0.958,0.9372,0.949 T0.9071,0.9262 T0.8753,0.8987 T0.8403,0.8777 T0.8051,0.8752 Q0.787,0.8805,0.7657,0.8772 Q0.7751,0.8736,0.7828,0.8683 Q0.8086,0.8511,0.8262,0.8497 T0.8651,0.8617 Q0.8696,0.865,0.8727,0.8646 T0.8758,0.8605 L0.8761,0.8536 Q0.8774,0.8295,0.8646,0.8016 T0.8277,0.7496 Q0.8086,0.7308,0.7896,0.7219 Q0.7741,0.7145,0.7575,0.7141 T0.727,0.7182 T0.6978,0.7296 T0.6699,0.7439 T0.6433,0.7571 T0.6179,0.7643 Q0.627,0.7561,0.6402,0.7367 T0.6618,0.7088 L0.6673,0.7035 Q0.6718,0.699,0.6647,0.6884 T0.6483,0.6692 L0.6389,0.6607 Q0.6289,0.657,0.6249,0.6554 T0.6163,0.6507 T0.6102,0.6458 T0.6021,0.637 T0.5889,0.6236 Q0.5828,0.6175,0.5766,0.6138 Q0.5673,0.6081,0.5561,0.6077 T0.5345,0.6105 T0.5116,0.6201 T0.4887,0.633 T0.4653,0.6468 T0.4427,0.6578 Q0.4295,0.6635,0.4167,0.665 T0.3888,0.665 T0.3714,0.6635 Q0.3579,0.6631,0.3282,0.6501 Q0.374,0.6578,0.3911,0.6517 Q0.3937,0.6509,0.4024,0.6482 T0.4179,0.6434 T0.4348,0.6364 T0.4534,0.6256 Q0.464,0.6183,0.4892,0.5989 T0.5278,0.5712 T0.5476,0.564 L0.5582,0.5661 Q0.5692,0.5681,0.5634,0.5563 Q0.5599,0.5485,0.5524,0.5392 L0.545,0.5298 Q0.5369,0.5188,0.5286,0.51 T0.5134,0.4947 T0.4979,0.4831 T0.484,0.4749 T0.47,0.4694 T0.4572,0.4657 T0.4442,0.4637 T0.4326,0.4629 T0.4205,0.4625 Q0.4511,0.4543,0.466,0.4384 L0.4714,0.4327 Q0.4795,0.4237,0.4469,0.394 L0.4421,0.3899 Q0.433,0.387,0.4251,0.3834 T0.4122,0.3772 T0.3988,0.3687 T0.3874,0.3603 T0.3732,0.3487 T0.3579,0.3361 Q0.3433,0.3242,0.3288,0.3159 T0.2993,0.3034 T0.2725,0.2973 T0.2446,0.2961 T0.2193,0.2977 T0.1926,0.301 Q0.1855,0.3022,0.182,0.3026 Q0.1991,0.2936,0.2233,0.2781 Q0.3282,0.2117,0.4256,0.2476 Q0.4363,0.2516,0.451,0.2604 T0.4784,0.2779 T0.5077,0.2965 T0.539,0.3124 T0.5718,0.3216 T0.606,0.3206 Q0.6363,0.3136,0.6526,0.2936 T0.6647,0.2459 Q0.6615,0.2247,0.645,0.2023 Q0.6354,0.1892,0.6237,0.179 Q0.6102,0.1672,0.5937,0.1595 Q0.6073,0.1562,0.6215,0.1485 Q0.6396,0.1387,0.6547,0.1354 T0.6839,0.1354 T0.7101,0.1458 T0.7373,0.166 Q0.738,0.1664,0.746,0.1733 T0.7586,0.1841 T0.7733,0.196 T0.7907,0.2086 T0.8086,0.2196 T0.8275,0.2288 T0.8454,0.2337 T0.8627,0.2343 T0.8777,0.228 T0.8903,0.2145 Q0.9038,0.1929,0.8742,0.1582 Q0.869,0.1517,0.8629,0.1464 Q0.8538,0.1387,0.844,0.1321 T0.8248,0.1205 T0.8122,0.1134 Q0.8109,0.1117,0.8053,0.103 T0.7965,0.0899 T0.7875,0.0781 T0.7757,0.064 Q0.8051,0.0616,0.8328,0.0828 Q0.847,0.0934,0.8588,0.1009 T0.8854,0.1146 T0.9127,0.1213 T0.9384,0.116 T0.9626,0.0962 Q0.9664,0.0909,0.9706,0.0846 T0.976,0.0767 T0.9798,0.0728 T0.9852,0.0704 T0.9932,0.0697 Q0.9997,0.0693,0.9942,0.0567 Q0.9923,0.0522,0.989,0.0469 Z",type:0}},"":{type:5,data:{d:"M0.4116,0.0126 L0.4116,0.0776 L0.4871,0.0776 L0.4871,0.0126 L0.4116,0.0126 Z M0.4043,0 L0.4944,0 Q0.4973,0,0.4995,0.0021 T0.5017,0.0063 L0.5017,0.0839 Q0.5017,0.0864,0.4993,0.0883 T0.4944,0.0902 L0.4043,0.0902 Q0.4014,0.0902,0.3992,0.0881 T0.397,0.0839 L0.397,0.0063 Q0.397,0.0038,0.3994,0.0019 T0.4043,0 Z M0.4116,0.0126 L0.4116,0.0776 L0.4871,0.0776 L0.4871,0.0126 L0.4116,0.0126 Z M0.4043,0 L0.4944,0 Q0.4973,0,0.4995,0.0021 T0.5017,0.0063 L0.5017,0.0839 Q0.5017,0.0864,0.4993,0.0883 T0.4944,0.0902 L0.4043,0.0902 Q0.4014,0.0902,0.3992,0.0881 T0.397,0.0839 L0.397,0.0063 Q0.397,0.0038,0.3994,0.0019 T0.4043,0 Z M0.4116,0.0126 L0.4116,0.0776 L0.4871,0.0776 L0.4871,0.0126 L0.4116,0.0126 Z M0.4043,0 L0.4944,0 Q0.4973,0,0.4995,0.0021 T0.5017,0.0063 L0.5017,0.0839 Q0.5017,0.0864,0.4993,0.0883 T0.4944,0.0902 L0.4043,0.0902 Q0.4014,0.0902,0.3992,0.0881 T0.397,0.0839 L0.397,0.0063 Q0.397,0.0038,0.3994,0.0019 T0.4043,0 Z M0.9099,0.0084 L0.9099,0.0818 L0.9951,0.0818 L0.9951,0.0084 L0.9099,0.0084 Z M0.9075,0.0042 L0.9976,0.0042 Q1,0.0042,1,0.0063 L1,0.0839 Q1,0.086,0.9976,0.086 L0.9075,0.086 Q0.905,0.086,0.905,0.0839 L0.905,0.0063 Q0.905,0.0042,0.9075,0.0042 Z M0.9099,0.0084 L0.9099,0.0818 L0.9951,0.0818 L0.9951,0.0084 L0.9099,0.0084 Z M0.9075,0.0042 L0.9976,0.0042 Q1,0.0042,1,0.0063 L1,0.0839 Q1,0.086,0.9976,0.086 L0.9075,0.086 Q0.905,0.086,0.905,0.0839 L0.905,0.0063 Q0.905,0.0042,0.9075,0.0042 Z M0.9099,0.0084 L0.9099,0.0818 L0.9951,0.0818 L0.9951,0.0084 L0.9099,0.0084 Z M0.9075,0.0042 L0.9976,0.0042 Q1,0.0042,1,0.0063 L1,0.0839 Q1,0.086,0.9976,0.086 L0.9075,0.086 Q0.905,0.086,0.905,0.0839 L0.905,0.0063 Q0.905,0.0042,0.9075,0.0042 Z M0.66,0.0063 L0.7501,0.0063 L0.7501,0.0839 L0.66,0.0839 L0.66,0.0063 Z M0.66,0.0063 L0.7501,0.0063 L0.7501,0.0839 L0.66,0.0839 L0.66,0.0063 Z M0.66,0.0063 L0.7501,0.0063 L0.7501,0.0839 L0.66,0.0839 L0.66,0.0063 Z M0.5309,0.0063 L0.621,0.0063 L0.621,0.0839 L0.5309,0.0839 L0.5309,0.0063 Z M0.5309,0.0063 L0.621,0.0063 L0.621,0.0839 L0.5309,0.0839 L0.5309,0.0063 Z M0.5309,0.0063 L0.621,0.0063 L0.621,0.0839 L0.5309,0.0839 L0.5309,0.0063 Z M0.2689,0.0063 L0.359,0.0063 L0.359,0.0839 L0.2689,0.0839 L0.2689,0.0063 Z M0.2689,0.0063 L0.359,0.0063 L0.359,0.0839 L0.2689,0.0839 L0.2689,0.0063 Z M0.2689,0.0063 L0.359,0.0063 L0.359,0.0839 L0.2689,0.0839 L0.2689,0.0063 Z M0.1374,0.0063 L0.2275,0.0063 L0.2275,0.0839 L0.1374,0.0839 L0.1374,0.0063 Z M0.1374,0.0063 L0.2275,0.0063 L0.2275,0.0839 L0.1374,0.0839 L0.1374,0.0063 Z M0.1374,0.0063 L0.2275,0.0063 L0.2275,0.0839 L0.1374,0.0839 L0.1374,0.0063 Z M0,0.0063 L0.0901,0.0063 L0.0901,0.0839 L0,0.0839 L0,0.0063 Z M0,0.0063 L0.0901,0.0063 L0.0901,0.0839 L0,0.0839 L0,0.0063 Z M0,0.0063 L0.0901,0.0063 L0.0901,0.0839 L0,0.0839 L0,0.0063 Z M0.4087,0.9224 L0.4087,0.9958 L0.4939,0.9958 L0.4939,0.9224 L0.4087,0.9224 Z M0.4062,0.9182 L0.4963,0.9182 Q0.4988,0.9182,0.4988,0.9203 L0.4988,0.9979 Q0.4988,1,0.4963,1 L0.4062,1 Q0.4038,1,0.4038,0.9979 L0.4038,0.9203 Q0.4038,0.9182,0.4062,0.9182 Z M0.4087,0.9224 L0.4087,0.9958 L0.4939,0.9958 L0.4939,0.9224 L0.4087,0.9224 Z M0.4062,0.9182 L0.4963,0.9182 Q0.4988,0.9182,0.4988,0.9203 L0.4988,0.9979 Q0.4988,1,0.4963,1 L0.4062,1 Q0.4038,1,0.4038,0.9979 L0.4038,0.9203 Q0.4038,0.9182,0.4062,0.9182 Z M0.4087,0.9224 L0.4087,0.9958 L0.4939,0.9958 L0.4939,0.9224 L0.4087,0.9224 Z M0.4062,0.9182 L0.4963,0.9182 Q0.4988,0.9182,0.4988,0.9203 L0.4988,0.9979 Q0.4988,1,0.4963,1 L0.4062,1 Q0.4038,1,0.4038,0.9979 L0.4038,0.9203 Q0.4038,0.9182,0.4062,0.9182 Z M0.1374,0.9203 L0.2275,0.9203 L0.2275,0.9979 L0.1374,0.9979 L0.1374,0.9203 Z M0.1374,0.9203 L0.2275,0.9203 L0.2275,0.9979 L0.1374,0.9979 L0.1374,0.9203 Z M0.1374,0.9203 L0.2275,0.9203 L0.2275,0.9979 L0.1374,0.9979 L0.1374,0.9203 Z M0,0.9203 L0.0901,0.9203 L0.0901,0.9979 L0,0.9979 L0,0.9203 Z M0,0.9203 L0.0901,0.9203 L0.0901,0.9979 L0,0.9979 L0,0.9203 Z M0,0.9203 L0.0901,0.9203 L0.0901,0.9979 L0,0.9979 L0,0.9203 Z M0.9099,0.1158 L0.9099,0.1888 L0.9951,0.1888 L0.9951,0.1158 L0.9099,0.1158 Z M0.9075,0.1116 L0.9976,0.1116 Q1,0.1116,1,0.1137 L1,0.1909 Q1,0.193,0.9976,0.193 L0.9075,0.193 Q0.905,0.193,0.905,0.1909 L0.905,0.1137 Q0.905,0.1116,0.9075,0.1116 Z M0.7852,0.6086 L0.7852,0.682 L0.8704,0.682 L0.8704,0.6086 L0.7852,0.6086 Z M0.7828,0.6044 L0.8729,0.6044 Q0.8753,0.6044,0.8753,0.6065 L0.8753,0.6841 Q0.8753,0.6862,0.8729,0.6862 L0.7828,0.6862 Q0.7803,0.6862,0.7803,0.6841 L0.7803,0.6065 Q0.7803,0.6044,0.7828,0.6044 Z M0.66,0.1137 L0.7501,0.1137 L0.7501,0.1909 L0.66,0.1909 L0.66,0.1137 Z M0.6624,0.4102 L0.6624,0.4836 L0.7477,0.4836 L0.7477,0.4102 L0.6624,0.4102 Z M0.66,0.406 L0.7501,0.406 Q0.7526,0.406,0.7526,0.4081 L0.7526,0.4857 Q0.7526,0.4878,0.7501,0.4878 L0.66,0.4878 Q0.6576,0.4878,0.6576,0.4857 L0.6576,0.4081 Q0.6576,0.406,0.66,0.406 Z M0.6624,0.7131 L0.6624,0.7865 L0.7477,0.7865 L0.7477,0.7131 L0.6624,0.7131 Z M0.66,0.7089 L0.7501,0.7089 Q0.7526,0.7089,0.7526,0.711 L0.7526,0.7886 Q0.7526,0.7907,0.7501,0.7907 L0.66,0.7907 Q0.6576,0.7907,0.6576,0.7886 L0.6576,0.711 Q0.6576,0.7089,0.66,0.7089 Z M0.5407,0.2227 L0.5407,0.2836 L0.6113,0.2836 L0.6113,0.2227 L0.5407,0.2227 Z M0.5309,0.206 L0.621,0.206 Q0.623,0.206,0.6249,0.2068 T0.6281,0.2089 T0.6301,0.2116 T0.6308,0.2143 L0.6308,0.2919 Q0.6308,0.2957,0.6276,0.298 T0.621,0.3003 L0.5309,0.3003 Q0.5265,0.3003,0.5239,0.2976 T0.5212,0.2919 L0.5212,0.2143 Q0.5212,0.211,0.5244,0.2085 T0.5309,0.206 Z M0.5407,0.3184 L0.5407,0.3792 L0.6113,0.3792 L0.6113,0.3184 L0.5407,0.3184 Z M0.5309,0.3016 L0.621,0.3016 Q0.6254,0.3016,0.6281,0.3043 T0.6308,0.31 L0.6308,0.3876 Q0.6308,0.3914,0.6276,0.3937 T0.621,0.396 L0.5309,0.396 Q0.5265,0.396,0.5239,0.3932 T0.5212,0.3876 L0.5212,0.31 Q0.5212,0.3062,0.5244,0.3039 T0.5309,0.3016 Z M0.5309,0.4081 L0.621,0.4081 L0.621,0.4857 L0.5309,0.4857 L0.5309,0.4081 Z M0.5309,0.5059 L0.621,0.5059 L0.621,0.5835 L0.5309,0.5835 L0.5309,0.5059 Z M0.5407,0.6149 L0.5407,0.6758 L0.6113,0.6758 L0.6113,0.6149 L0.5407,0.6149 Z M0.5309,0.5982 L0.621,0.5982 Q0.6254,0.5982,0.6281,0.6009 T0.6308,0.6065 L0.6308,0.6841 Q0.6308,0.6879,0.6276,0.6902 T0.621,0.6925 L0.5309,0.6925 Q0.5265,0.6925,0.5239,0.6898 T0.5212,0.6841 L0.5212,0.6065 Q0.5212,0.6028,0.5244,0.6005 T0.5309,0.5982 Z M0.4062,0.1137 L0.4963,0.1137 L0.4963,0.1909 L0.4062,0.1909 L0.4062,0.1137 Z M0.4062,0.2143 L0.4963,0.2143 L0.4963,0.2919 L0.4062,0.2919 L0.4062,0.2143 Z M0.4184,0.4186 L0.4184,0.4753 L0.4842,0.4753 L0.4842,0.4186 L0.4184,0.4186 Z M0.4062,0.3977 L0.4963,0.3977 Q0.5017,0.3977,0.5051,0.401 T0.5085,0.4081 L0.5085,0.4857 Q0.5085,0.4904,0.5046,0.4933 T0.4963,0.4962 L0.4062,0.4962 Q0.4009,0.4962,0.3975,0.4929 T0.3941,0.4857 L0.3941,0.4081 Q0.3941,0.4035,0.398,0.4006 T0.4062,0.3977 Z M0.4062,0.5059 L0.4963,0.5059 L0.4963,0.5835 L0.4062,0.5835 L0.4062,0.5059 Z M0.4087,0.7131 L0.4087,0.7865 L0.4939,0.7865 L0.4939,0.7131 L0.4087,0.7131 Z M0.4062,0.7089 L0.4963,0.7089 Q0.4988,0.7089,0.4988,0.711 L0.4988,0.7886 Q0.4988,0.7907,0.4963,0.7907 L0.4062,0.7907 Q0.4038,0.7907,0.4038,0.7886 L0.4038,0.711 Q0.4038,0.7089,0.4062,0.7089 Z M0.2689,0.1137 L0.359,0.1137 L0.359,0.1909 L0.2689,0.1909 L0.2689,0.1137 Z M0.2689,0.2143 L0.359,0.2143 L0.359,0.2919 L0.2689,0.2919 L0.2689,0.2143 Z M0.2689,0.8154 L0.359,0.8154 L0.359,0.8926 L0.2689,0.8926 L0.2689,0.8154 Z M0.2689,0.31 L0.359,0.31 L0.359,0.3876 L0.2689,0.3876 L0.2689,0.31 Z M0.2689,0.8154 L0.359,0.8154 L0.359,0.8926 L0.2689,0.8926 L0.2689,0.8154 Z M0.2689,0.4081 L0.359,0.4081 L0.359,0.4857 L0.2689,0.4857 L0.2689,0.4081 Z M0.2689,0.5059 L0.359,0.5059 L0.359,0.5835 L0.2689,0.5835 L0.2689,0.5059 Z M0.2689,0.711 L0.359,0.711 L0.359,0.7886 L0.2689,0.7886 L0.2689,0.711 Z M0.2689,0.8154 L0.359,0.8154 L0.359,0.8926 L0.2689,0.8926 L0.2689,0.8154 Z M0.1374,0.1137 L0.2275,0.1137 L0.2275,0.1909 L0.1374,0.1909 L0.1374,0.1137 Z M0.1374,0.2143 L0.2275,0.2143 L0.2275,0.2919 L0.1374,0.2919 L0.1374,0.2143 Z M0.1374,0.8154 L0.2275,0.8154 L0.2275,0.8926 L0.1374,0.8926 L0.1374,0.8154 Z M0.1374,0.31 L0.2275,0.31 L0.2275,0.3876 L0.1374,0.3876 L0.1374,0.31 Z M0.1374,0.8154 L0.2275,0.8154 L0.2275,0.8926 L0.1374,0.8926 L0.1374,0.8154 Z M0.1374,0.4081 L0.2275,0.4081 L0.2275,0.4857 L0.1374,0.4857 L0.1374,0.4081 Z M0.1374,0.5059 L0.2275,0.5059 L0.2275,0.5835 L0.1374,0.5835 L0.1374,0.5059 Z M0.1374,0.6065 L0.2275,0.6065 L0.2275,0.6841 L0.1374,0.6841 L0.1374,0.6065 Z M0.1374,0.711 L0.2275,0.711 L0.2275,0.7886 L0.1374,0.7886 L0.1374,0.711 Z M0.1374,0.8154 L0.2275,0.8154 L0.2275,0.8926 L0.1374,0.8926 L0.1374,0.8154 Z M0,0.1137 L0.0901,0.1137 L0.0901,0.1909 L0,0.1909 L0,0.1137 Z M0,0.2143 L0.0901,0.2143 L0.0901,0.2919 L0,0.2919 L0,0.2143 Z M0,0.8154 L0.0901,0.8154 L0.0901,0.8926 L0,0.8926 L0,0.8154 Z M0,0.31 L0.0901,0.31 L0.0901,0.3876 L0,0.3876 L0,0.31 Z M0,0.8154 L0.0901,0.8154 L0.0901,0.8926 L0,0.8926 L0,0.8154 Z M0,0.4081 L0.0901,0.4081 L0.0901,0.4857 L0,0.4857 L0,0.4081 Z M0,0.5059 L0.0901,0.5059 L0.0901,0.5835 L0,0.5835 L0,0.5059 Z M0,0.6065 L0.0901,0.6065 L0.0901,0.6841 L0,0.6841 L0,0.6065 Z M0,0.711 L0.0901,0.711 L0.0901,0.7886 L0,0.7886 L0,0.711 Z M0,0.8154 L0.0901,0.8154 L0.0901,0.8926 L0,0.8926 L0,0.8154 Z",type:0}},"":{type:5,data:{d:"M0.5884,0.0126 L0.5884,0.0776 L0.5129,0.0776 L0.5129,0.0126 L0.5884,0.0126 Z M0.5957,0 L0.5056,0 Q0.5027,0,0.5005,0.0021 T0.4983,0.0063 L0.4983,0.0839 Q0.4983,0.0864,0.5007,0.0883 T0.5056,0.0902 L0.5957,0.0902 Q0.5986,0.0902,0.6008,0.0881 T0.603,0.0839 L0.603,0.0063 Q0.603,0.0038,0.6006,0.0019 T0.5957,0 Z M0.5884,0.0126 L0.5884,0.0776 L0.5129,0.0776 L0.5129,0.0126 L0.5884,0.0126 Z M0.5957,0 L0.5056,0 Q0.5027,0,0.5005,0.0021 T0.4983,0.0063 L0.4983,0.0839 Q0.4983,0.0864,0.5007,0.0883 T0.5056,0.0902 L0.5957,0.0902 Q0.5986,0.0902,0.6008,0.0881 T0.603,0.0839 L0.603,0.0063 Q0.603,0.0038,0.6006,0.0019 T0.5957,0 Z M0.5884,0.0126 L0.5884,0.0776 L0.5129,0.0776 L0.5129,0.0126 L0.5884,0.0126 Z M0.5957,0 L0.5056,0 Q0.5027,0,0.5005,0.0021 T0.4983,0.0063 L0.4983,0.0839 Q0.4983,0.0864,0.5007,0.0883 T0.5056,0.0902 L0.5957,0.0902 Q0.5986,0.0902,0.6008,0.0881 T0.603,0.0839 L0.603,0.0063 Q0.603,0.0038,0.6006,0.0019 T0.5957,0 Z M0.0901,0.0084 L0.0901,0.0818 L0.0049,0.0818 L0.0049,0.0084 L0.0901,0.0084 Z M0.0925,0.0042 L0.0024,0.0042 Q0,0.0042,0,0.0063 L0,0.0839 Q0,0.086,0.0024,0.086 L0.0925,0.086 Q0.095,0.086,0.095,0.0839 L0.095,0.0063 Q0.095,0.0042,0.0925,0.0042 Z M0.0901,0.0084 L0.0901,0.0818 L0.0049,0.0818 L0.0049,0.0084 L0.0901,0.0084 Z M0.0925,0.0042 L0.0024,0.0042 Q0,0.0042,0,0.0063 L0,0.0839 Q0,0.086,0.0024,0.086 L0.0925,0.086 Q0.095,0.086,0.095,0.0839 L0.095,0.0063 Q0.095,0.0042,0.0925,0.0042 Z M0.0901,0.0084 L0.0901,0.0818 L0.0049,0.0818 L0.0049,0.0084 L0.0901,0.0084 Z M0.0925,0.0042 L0.0024,0.0042 Q0,0.0042,0,0.0063 L0,0.0839 Q0,0.086,0.0024,0.086 L0.0925,0.086 Q0.095,0.086,0.095,0.0839 L0.095,0.0063 Q0.095,0.0042,0.0925,0.0042 Z M0.34,0.0063 L0.2499,0.0063 L0.2499,0.0839 L0.34,0.0839 L0.34,0.0063 Z M0.34,0.0063 L0.2499,0.0063 L0.2499,0.0839 L0.34,0.0839 L0.34,0.0063 Z M0.34,0.0063 L0.2499,0.0063 L0.2499,0.0839 L0.34,0.0839 L0.34,0.0063 Z M0.4691,0.0063 L0.379,0.0063 L0.379,0.0839 L0.4691,0.0839 L0.4691,0.0063 Z M0.4691,0.0063 L0.379,0.0063 L0.379,0.0839 L0.4691,0.0839 L0.4691,0.0063 Z M0.4691,0.0063 L0.379,0.0063 L0.379,0.0839 L0.4691,0.0839 L0.4691,0.0063 Z M0.7311,0.0063 L0.641,0.0063 L0.641,0.0839 L0.7311,0.0839 L0.7311,0.0063 Z M0.7311,0.0063 L0.641,0.0063 L0.641,0.0839 L0.7311,0.0839 L0.7311,0.0063 Z M0.7311,0.0063 L0.641,0.0063 L0.641,0.0839 L0.7311,0.0839 L0.7311,0.0063 Z M0.8626,0.0063 L0.7725,0.0063 L0.7725,0.0839 L0.8626,0.0839 L0.8626,0.0063 Z M0.8626,0.0063 L0.7725,0.0063 L0.7725,0.0839 L0.8626,0.0839 L0.8626,0.0063 Z M0.8626,0.0063 L0.7725,0.0063 L0.7725,0.0839 L0.8626,0.0839 L0.8626,0.0063 Z M1,0.0063 L0.9099,0.0063 L0.9099,0.0839 L1,0.0839 L1,0.0063 Z M1,0.0063 L0.9099,0.0063 L0.9099,0.0839 L1,0.0839 L1,0.0063 Z M1,0.0063 L0.9099,0.0063 L0.9099,0.0839 L1,0.0839 L1,0.0063 Z M0.5913,0.9224 L0.5913,0.9958 L0.5061,0.9958 L0.5061,0.9224 L0.5913,0.9224 Z M0.5938,0.9182 L0.5037,0.9182 Q0.5012,0.9182,0.5012,0.9203 L0.5012,0.9979 Q0.5012,1,0.5037,1 L0.5938,1 Q0.5962,1,0.5962,0.9979 L0.5962,0.9203 Q0.5962,0.9182,0.5938,0.9182 Z M0.5913,0.9224 L0.5913,0.9958 L0.5061,0.9958 L0.5061,0.9224 L0.5913,0.9224 Z M0.5938,0.9182 L0.5037,0.9182 Q0.5012,0.9182,0.5012,0.9203 L0.5012,0.9979 Q0.5012,1,0.5037,1 L0.5938,1 Q0.5962,1,0.5962,0.9979 L0.5962,0.9203 Q0.5962,0.9182,0.5938,0.9182 Z M0.5913,0.9224 L0.5913,0.9958 L0.5061,0.9958 L0.5061,0.9224 L0.5913,0.9224 Z M0.5938,0.9182 L0.5037,0.9182 Q0.5012,0.9182,0.5012,0.9203 L0.5012,0.9979 Q0.5012,1,0.5037,1 L0.5938,1 Q0.5962,1,0.5962,0.9979 L0.5962,0.9203 Q0.5962,0.9182,0.5938,0.9182 Z M0.8626,0.9203 L0.7725,0.9203 L0.7725,0.9979 L0.8626,0.9979 L0.8626,0.9203 Z M0.8626,0.9203 L0.7725,0.9203 L0.7725,0.9979 L0.8626,0.9979 L0.8626,0.9203 Z M0.8626,0.9203 L0.7725,0.9203 L0.7725,0.9979 L0.8626,0.9979 L0.8626,0.9203 Z M1,0.9203 L0.9099,0.9203 L0.9099,0.9979 L1,0.9979 L1,0.9203 Z M1,0.9203 L0.9099,0.9203 L0.9099,0.9979 L1,0.9979 L1,0.9203 Z M1,0.9203 L0.9099,0.9203 L0.9099,0.9979 L1,0.9979 L1,0.9203 Z M0.0901,0.1158 L0.0901,0.1888 L0.0049,0.1888 L0.0049,0.1158 L0.0901,0.1158 Z M0.0925,0.1116 L0.0024,0.1116 Q0,0.1116,0,0.1137 L0,0.1909 Q0,0.193,0.0024,0.193 L0.0925,0.193 Q0.095,0.193,0.095,0.1909 L0.095,0.1137 Q0.095,0.1116,0.0925,0.1116 Z M0.2148,0.6086 L0.2148,0.682 L0.1296,0.682 L0.1296,0.6086 L0.2148,0.6086 Z M0.2172,0.6044 L0.1271,0.6044 Q0.1247,0.6044,0.1247,0.6065 L0.1247,0.6841 Q0.1247,0.6862,0.1271,0.6862 L0.2172,0.6862 Q0.2197,0.6862,0.2197,0.6841 L0.2197,0.6065 Q0.2197,0.6044,0.2172,0.6044 Z M0.34,0.1137 L0.2499,0.1137 L0.2499,0.1909 L0.34,0.1909 L0.34,0.1137 Z M0.3376,0.4102 L0.3376,0.4836 L0.2523,0.4836 L0.2523,0.4102 L0.3376,0.4102 Z M0.34,0.406 L0.2499,0.406 Q0.2474,0.406,0.2474,0.4081 L0.2474,0.4857 Q0.2474,0.4878,0.2499,0.4878 L0.34,0.4878 Q0.3424,0.4878,0.3424,0.4857 L0.3424,0.4081 Q0.3424,0.406,0.34,0.406 Z M0.3376,0.7131 L0.3376,0.7865 L0.2523,0.7865 L0.2523,0.7131 L0.3376,0.7131 Z M0.34,0.7089 L0.2499,0.7089 Q0.2474,0.7089,0.2474,0.711 L0.2474,0.7886 Q0.2474,0.7907,0.2499,0.7907 L0.34,0.7907 Q0.3424,0.7907,0.3424,0.7886 L0.3424,0.711 Q0.3424,0.7089,0.34,0.7089 Z M0.4593,0.2227 L0.4593,0.2836 L0.3887,0.2836 L0.3887,0.2227 L0.4593,0.2227 Z M0.4691,0.206 L0.379,0.206 Q0.3746,0.206,0.3719,0.2087 T0.3692,0.2143 L0.3692,0.2919 Q0.3692,0.2957,0.3724,0.298 T0.379,0.3003 L0.4691,0.3003 Q0.4735,0.3003,0.4761,0.2976 T0.4788,0.2919 L0.4788,0.2143 Q0.4788,0.211,0.4756,0.2085 T0.4691,0.206 Z M0.4593,0.3184 L0.4593,0.3792 L0.3887,0.3792 L0.3887,0.3184 L0.4593,0.3184 Z M0.4691,0.3016 L0.379,0.3016 Q0.3746,0.3016,0.3719,0.3043 T0.3692,0.31 L0.3692,0.3876 Q0.3692,0.3914,0.3724,0.3937 T0.379,0.396 L0.4691,0.396 Q0.4735,0.396,0.4761,0.3932 T0.4788,0.3876 L0.4788,0.31 Q0.4788,0.3062,0.4756,0.3039 T0.4691,0.3016 Z M0.4691,0.4081 L0.379,0.4081 L0.379,0.4857 L0.4691,0.4857 L0.4691,0.4081 Z M0.4691,0.5059 L0.379,0.5059 L0.379,0.5835 L0.4691,0.5835 L0.4691,0.5059 Z M0.4593,0.6149 L0.4593,0.6758 L0.3887,0.6758 L0.3887,0.6149 L0.4593,0.6149 Z M0.4691,0.5982 L0.379,0.5982 Q0.3746,0.5982,0.3719,0.6009 T0.3692,0.6065 L0.3692,0.6841 Q0.3692,0.6879,0.3724,0.6902 T0.379,0.6925 L0.4691,0.6925 Q0.4735,0.6925,0.4761,0.6898 T0.4788,0.6841 L0.4788,0.6065 Q0.4788,0.6028,0.4756,0.6005 T0.4691,0.5982 Z M0.5938,0.1137 L0.5037,0.1137 L0.5037,0.1909 L0.5938,0.1909 L0.5938,0.1137 Z M0.5938,0.2143 L0.5037,0.2143 L0.5037,0.2919 L0.5938,0.2919 L0.5938,0.2143 Z M0.5816,0.4186 L0.5816,0.4753 L0.5158,0.4753 L0.5158,0.4186 L0.5816,0.4186 Z M0.5938,0.3977 L0.5037,0.3977 Q0.4983,0.3977,0.4949,0.401 T0.4915,0.4081 L0.4915,0.4857 Q0.4915,0.4904,0.4954,0.4933 T0.5037,0.4962 L0.5938,0.4962 Q0.5991,0.4962,0.6025,0.4929 T0.6059,0.4857 L0.6059,0.4081 Q0.6059,0.4035,0.602,0.4006 T0.5938,0.3977 Z M0.5938,0.5059 L0.5037,0.5059 L0.5037,0.5835 L0.5938,0.5835 L0.5938,0.5059 Z M0.5913,0.7131 L0.5913,0.7865 L0.5061,0.7865 L0.5061,0.7131 L0.5913,0.7131 Z M0.5938,0.7089 L0.5037,0.7089 Q0.5012,0.7089,0.5012,0.711 L0.5012,0.7886 Q0.5012,0.7907,0.5037,0.7907 L0.5938,0.7907 Q0.5962,0.7907,0.5962,0.7886 L0.5962,0.711 Q0.5962,0.7089,0.5938,0.7089 Z M0.7311,0.1137 L0.641,0.1137 L0.641,0.1909 L0.7311,0.1909 L0.7311,0.1137 Z M0.7311,0.2143 L0.641,0.2143 L0.641,0.2919 L0.7311,0.2919 L0.7311,0.2143 Z M0.7311,0.8154 L0.641,0.8154 L0.641,0.8926 L0.7311,0.8926 L0.7311,0.8154 Z M0.7311,0.31 L0.641,0.31 L0.641,0.3876 L0.7311,0.3876 L0.7311,0.31 Z M0.7311,0.8154 L0.641,0.8154 L0.641,0.8926 L0.7311,0.8926 L0.7311,0.8154 Z M0.7311,0.4081 L0.641,0.4081 L0.641,0.4857 L0.7311,0.4857 L0.7311,0.4081 Z M0.7311,0.5059 L0.641,0.5059 L0.641,0.5835 L0.7311,0.5835 L0.7311,0.5059 Z M0.7311,0.711 L0.641,0.711 L0.641,0.7886 L0.7311,0.7886 L0.7311,0.711 Z M0.7311,0.8154 L0.641,0.8154 L0.641,0.8926 L0.7311,0.8926 L0.7311,0.8154 Z M0.8626,0.1137 L0.7725,0.1137 L0.7725,0.1909 L0.8626,0.1909 L0.8626,0.1137 Z M0.8626,0.2143 L0.7725,0.2143 L0.7725,0.2919 L0.8626,0.2919 L0.8626,0.2143 Z M0.8626,0.8154 L0.7725,0.8154 L0.7725,0.8926 L0.8626,0.8926 L0.8626,0.8154 Z M0.8626,0.31 L0.7725,0.31 L0.7725,0.3876 L0.8626,0.3876 L0.8626,0.31 Z M0.8626,0.8154 L0.7725,0.8154 L0.7725,0.8926 L0.8626,0.8926 L0.8626,0.8154 Z M0.8626,0.4081 L0.7725,0.4081 L0.7725,0.4857 L0.8626,0.4857 L0.8626,0.4081 Z M0.8626,0.5059 L0.7725,0.5059 L0.7725,0.5835 L0.8626,0.5835 L0.8626,0.5059 Z M0.8626,0.6065 L0.7725,0.6065 L0.7725,0.6841 L0.8626,0.6841 L0.8626,0.6065 Z M0.8626,0.711 L0.7725,0.711 L0.7725,0.7886 L0.8626,0.7886 L0.8626,0.711 Z M0.8626,0.8154 L0.7725,0.8154 L0.7725,0.8926 L0.8626,0.8926 L0.8626,0.8154 Z M1,0.1137 L0.9099,0.1137 L0.9099,0.1909 L1,0.1909 L1,0.1137 Z M1,0.2143 L0.9099,0.2143 L0.9099,0.2919 L1,0.2919 L1,0.2143 Z M1,0.8154 L0.9099,0.8154 L0.9099,0.8926 L1,0.8926 L1,0.8154 Z M1,0.31 L0.9099,0.31 L0.9099,0.3876 L1,0.3876 L1,0.31 Z M1,0.8154 L0.9099,0.8154 L0.9099,0.8926 L1,0.8926 L1,0.8154 Z M1,0.4081 L0.9099,0.4081 L0.9099,0.4857 L1,0.4857 L1,0.4081 Z M1,0.5059 L0.9099,0.5059 L0.9099,0.5835 L1,0.5835 L1,0.5059 Z M1,0.6065 L0.9099,0.6065 L0.9099,0.6841 L1,0.6841 L1,0.6065 Z M1,0.711 L0.9099,0.711 L0.9099,0.7886 L1,0.7886 L1,0.711 Z M1,0.8154 L0.9099,0.8154 L0.9099,0.8926 L1,0.8926 L1,0.8154 Z",type:0}},"":{type:5,data:{d:"M0.6529,0.018 L0.6529,0.112 L0.7724,0.112 L0.7724,0.018 L0.6529,0.018 Z M0.6411,0 L0.7837,0 Q0.7873,0,0.7902,0.0015 T0.7943,0.005 T0.7956,0.0092 L0.7956,0.1208 Q0.7956,0.125,0.7917,0.1275 T0.7837,0.13 L0.6411,0.13 Q0.6359,0.13,0.6326,0.1271 T0.6292,0.1208 L0.6292,0.0092 Q0.6292,0.005,0.6331,0.0025 T0.6411,0 Z M0.6529,0.018 L0.6529,0.112 L0.7724,0.112 L0.7724,0.018 L0.6529,0.018 Z M0.6411,0 L0.7837,0 Q0.7873,0,0.7902,0.0015 T0.7943,0.005 T0.7956,0.0092 L0.7956,0.1208 Q0.7956,0.125,0.7917,0.1275 T0.7837,0.13 L0.6411,0.13 Q0.6359,0.13,0.6326,0.1271 T0.6292,0.1208 L0.6292,0.0092 Q0.6292,0.005,0.6331,0.0025 T0.6411,0 Z M0.6529,0.018 L0.6529,0.112 L0.7724,0.112 L0.7724,0.018 L0.6529,0.018 Z M0.6411,0 L0.7837,0 Q0.7873,0,0.7902,0.0015 T0.7943,0.005 T0.7956,0.0092 L0.7956,0.1208 Q0.7956,0.125,0.7917,0.1275 T0.7837,0.13 L0.6411,0.13 Q0.6359,0.13,0.6326,0.1271 T0.6292,0.1208 L0.6292,0.0092 Q0.6292,0.005,0.6331,0.0025 T0.6411,0 Z M0.4325,0.0143 L0.4325,0.1158 L0.5628,0.1158 L0.5628,0.0143 L0.4325,0.0143 Z M0.4264,0.0042 L0.5695,0.0042 Q0.5721,0.0042,0.5739,0.0057 T0.5757,0.0092 L0.5757,0.1208 Q0.5757,0.1221,0.5752,0.1231 T0.5736,0.1248 T0.5716,0.1256 T0.5695,0.1258 L0.4264,0.1258 Q0.4238,0.1258,0.422,0.1244 T0.4202,0.1208 L0.4202,0.0092 Q0.4202,0.008,0.4207,0.0069 T0.4222,0.0052 T0.4243,0.0044 T0.4264,0.0042 Z M0.4325,0.0143 L0.4325,0.1158 L0.5628,0.1158 L0.5628,0.0143 L0.4325,0.0143 Z M0.4264,0.0042 L0.5695,0.0042 Q0.5721,0.0042,0.5739,0.0057 T0.5757,0.0092 L0.5757,0.1208 Q0.5757,0.1221,0.5752,0.1231 T0.5736,0.1248 T0.5716,0.1256 T0.5695,0.1258 L0.4264,0.1258 Q0.4238,0.1258,0.422,0.1244 T0.4202,0.1208 L0.4202,0.0092 Q0.4202,0.008,0.4207,0.0069 T0.4222,0.0052 T0.4243,0.0044 T0.4264,0.0042 Z M0.4325,0.0143 L0.4325,0.1158 L0.5628,0.1158 L0.5628,0.0143 L0.4325,0.0143 Z M0.4264,0.0042 L0.5695,0.0042 Q0.5721,0.0042,0.5739,0.0057 T0.5757,0.0092 L0.5757,0.1208 Q0.5757,0.1221,0.5752,0.1231 T0.5736,0.1248 T0.5716,0.1256 T0.5695,0.1258 L0.4264,0.1258 Q0.4238,0.1258,0.422,0.1244 T0.4202,0.1208 L0.4202,0.0092 Q0.4202,0.008,0.4207,0.0069 T0.4222,0.0052 T0.4243,0.0044 T0.4264,0.0042 Z M0.2178,0.0092 L0.3605,0.0092 L0.3605,0.1208 L0.2178,0.1208 L0.2178,0.0092 Z M0.2178,0.0092 L0.3605,0.0092 L0.3605,0.1208 L0.2178,0.1208 L0.2178,0.0092 Z M0.2178,0.0092 L0.3605,0.0092 L0.3605,0.1208 L0.2178,0.1208 L0.2178,0.0092 Z M0,0.0092 L0.1432,0.0092 L0.1432,0.1208 L0,0.1208 L0,0.0092 Z M0,0.0092 L0.1432,0.0092 L0.1432,0.1208 L0,0.1208 L0,0.0092 Z M0,0.0092 L0.1432,0.0092 L0.1432,0.1208 L0,0.1208 L0,0.0092 Z M0.8574,0.3217 L0.8574,0.4098 L0.9691,0.4098 L0.9691,0.3217 L0.8574,0.3217 Z M0.8419,0.2978 L0.9846,0.2978 Q0.9892,0.2978,0.9928,0.2997 T0.9982,0.3043 T1,0.31 L1,0.4216 Q1,0.427,0.9951,0.4304 T0.9846,0.4337 L0.8419,0.4337 Q0.8352,0.4337,0.8308,0.4299 T0.8265,0.4216 L0.8265,0.31 Q0.8265,0.3062,0.829,0.3035 T0.835,0.2993 T0.8419,0.2978 Z M0.8574,0.888 L0.8574,0.9757 L0.9691,0.9757 L0.9691,0.888 L0.8574,0.888 Z M0.8419,0.8637 L0.9846,0.8637 Q0.9892,0.8637,0.9928,0.8658 T0.9982,0.8706 T1,0.8758 L1,0.9878 Q1,0.9929,0.9951,0.9964 T0.9846,1 L0.8419,1 Q0.8352,1,0.8308,0.996 T0.8265,0.9878 L0.8265,0.8758 Q0.8265,0.8708,0.8314,0.8672 T0.8419,0.8637 Z M0.6509,0.169 L0.6509,0.2706 L0.7806,0.2706 L0.7806,0.169 L0.6509,0.169 Z M0.6442,0.159 L0.7868,0.159 Q0.7899,0.159,0.7917,0.1604 T0.7935,0.164 L0.7935,0.2756 Q0.7935,0.2781,0.7915,0.2796 T0.7868,0.281 L0.6442,0.281 Q0.6416,0.281,0.6395,0.2794 T0.6375,0.2756 L0.6375,0.164 Q0.6375,0.1619,0.6398,0.1604 T0.6442,0.159 Z M0.6632,0.6044 L0.6632,0.6858 L0.7678,0.6858 L0.7678,0.6044 L0.6632,0.6044 Z M0.6442,0.5742 L0.7868,0.5742 Q0.7951,0.5742,0.8007,0.5791 T0.8064,0.5893 L0.8064,0.7013 Q0.8064,0.7076,0.8002,0.712 T0.7868,0.7164 L0.6442,0.7164 Q0.6359,0.7164,0.6305,0.7114 T0.6251,0.7013 L0.6251,0.5893 Q0.6251,0.5847,0.6282,0.5812 T0.6357,0.5759 T0.6442,0.5742 Z M0.4264,0.164 L0.5695,0.164 L0.5695,0.2756 L0.4264,0.2756 L0.4264,0.164 Z M0.4325,0.315 L0.4325,0.4165 L0.5628,0.4165 L0.5628,0.315 L0.4325,0.315 Z M0.4264,0.3049 L0.5695,0.3049 Q0.5721,0.3049,0.5739,0.3064 T0.5757,0.31 L0.5757,0.4216 Q0.5757,0.4237,0.5736,0.4251 T0.5695,0.4266 L0.4264,0.4266 Q0.4238,0.4266,0.422,0.4251 T0.4202,0.4216 L0.4202,0.31 Q0.4202,0.3087,0.4207,0.3077 T0.4222,0.306 T0.4243,0.3052 T0.4264,0.3049 Z M0.4264,0.4476 L0.5695,0.4476 L0.5695,0.5596 L0.4264,0.5596 L0.4264,0.4476 Z M0.4392,0.7408 L0.4392,0.8326 L0.5561,0.8326 L0.5561,0.7408 L0.4392,0.7408 Z M0.4264,0.7206 L0.5695,0.7206 Q0.5747,0.7206,0.5783,0.724 T0.5819,0.7307 L0.5819,0.8427 Q0.5819,0.8469,0.5778,0.8498 T0.5695,0.8528 L0.4264,0.8528 Q0.4207,0.8528,0.4171,0.8496 T0.4135,0.8427 L0.4135,0.7307 Q0.4135,0.7265,0.4176,0.7236 T0.4264,0.7206 Z M0.2178,0.164 L0.3605,0.164 L0.3605,0.2756 L0.2178,0.2756 L0.2178,0.164 Z M0.2178,0.31 L0.3605,0.31 L0.3605,0.4216 L0.2178,0.4216 L0.2178,0.31 Z M0.2178,0.5893 L0.3605,0.5893 L0.3605,0.7013 L0.2178,0.7013 L0.2178,0.5893 Z M0.2178,0.7307 L0.3605,0.7307 L0.3605,0.8427 L0.2178,0.8427 L0.2178,0.7307 Z M0.2178,0.8758 L0.3605,0.8758 L0.3605,0.9878 L0.2178,0.9878 L0.2178,0.8758 Z M0,0.164 L0.1432,0.164 L0.1432,0.2756 L0,0.2756 L0,0.164 Z M0,0.31 L0.1432,0.31 L0.1432,0.4216 L0,0.4216 L0,0.31 Z M0,0.4476 L0.1432,0.4476 L0.1432,0.5596 L0,0.5596 L0,0.4476 Z M0,0.5893 L0.1432,0.5893 L0.1432,0.7013 L0,0.7013 L0,0.5893 Z M0,0.7307 L0.1432,0.7307 L0.1432,0.8427 L0,0.8427 L0,0.7307 Z M0,0.8758 L0.1432,0.8758 L0.1432,0.9878 L0,0.9878 L0,0.8758 Z",type:0}},"":{type:5,data:{d:"M0.3476,0.018 L0.3476,0.112 L0.2276,0.112 L0.2276,0.018 L0.3476,0.018 Z M0.3594,0 L0.2163,0 Q0.2132,0,0.2104,0.0015 T0.2062,0.005 T0.2049,0.0092 L0.2049,0.1208 Q0.2049,0.1237,0.2067,0.1258 T0.2111,0.129 T0.2163,0.13 L0.3594,0.13 Q0.3641,0.13,0.3674,0.1271 T0.3708,0.1208 L0.3708,0.0092 Q0.3708,0.005,0.3669,0.0025 T0.3594,0 Z M0.3476,0.018 L0.3476,0.112 L0.2276,0.112 L0.2276,0.018 L0.3476,0.018 Z M0.3594,0 L0.2163,0 Q0.2132,0,0.2104,0.0015 T0.2062,0.005 T0.2049,0.0092 L0.2049,0.1208 Q0.2049,0.1237,0.2067,0.1258 T0.2111,0.129 T0.2163,0.13 L0.3594,0.13 Q0.3641,0.13,0.3674,0.1271 T0.3708,0.1208 L0.3708,0.0092 Q0.3708,0.005,0.3669,0.0025 T0.3594,0 Z M0.3476,0.018 L0.3476,0.112 L0.2276,0.112 L0.2276,0.018 L0.3476,0.018 Z M0.3594,0 L0.2163,0 Q0.2132,0,0.2104,0.0015 T0.2062,0.005 T0.2049,0.0092 L0.2049,0.1208 Q0.2049,0.1237,0.2067,0.1258 T0.2111,0.129 T0.2163,0.13 L0.3594,0.13 Q0.3641,0.13,0.3674,0.1271 T0.3708,0.1208 L0.3708,0.0092 Q0.3708,0.005,0.3669,0.0025 T0.3594,0 Z M0.5675,0.0143 L0.5675,0.1158 L0.4377,0.1158 L0.4377,0.0143 L0.5675,0.0143 Z M0.5736,0.0042 L0.431,0.0042 Q0.4284,0.0042,0.4264,0.0057 T0.4243,0.0092 L0.4243,0.1208 Q0.4243,0.1221,0.4251,0.1231 T0.4269,0.1248 T0.4289,0.1256 T0.431,0.1258 L0.5736,0.1258 Q0.5767,0.1258,0.5785,0.1244 T0.5803,0.1208 L0.5803,0.0092 Q0.5803,0.008,0.5798,0.0069 T0.5783,0.0052 T0.5762,0.0044 T0.5736,0.0042 Z M0.5675,0.0143 L0.5675,0.1158 L0.4377,0.1158 L0.4377,0.0143 L0.5675,0.0143 Z M0.5736,0.0042 L0.431,0.0042 Q0.4284,0.0042,0.4264,0.0057 T0.4243,0.0092 L0.4243,0.1208 Q0.4243,0.1221,0.4251,0.1231 T0.4269,0.1248 T0.4289,0.1256 T0.431,0.1258 L0.5736,0.1258 Q0.5767,0.1258,0.5785,0.1244 T0.5803,0.1208 L0.5803,0.0092 Q0.5803,0.008,0.5798,0.0069 T0.5783,0.0052 T0.5762,0.0044 T0.5736,0.0042 Z M0.5675,0.0143 L0.5675,0.1158 L0.4377,0.1158 L0.4377,0.0143 L0.5675,0.0143 Z M0.5736,0.0042 L0.431,0.0042 Q0.4284,0.0042,0.4264,0.0057 T0.4243,0.0092 L0.4243,0.1208 Q0.4243,0.1221,0.4251,0.1231 T0.4269,0.1248 T0.4289,0.1256 T0.431,0.1258 L0.5736,0.1258 Q0.5767,0.1258,0.5785,0.1244 T0.5803,0.1208 L0.5803,0.0092 Q0.5803,0.008,0.5798,0.0069 T0.5783,0.0052 T0.5762,0.0044 T0.5736,0.0042 Z M0.7827,0.0092 L0.6395,0.0092 L0.6395,0.1208 L0.7827,0.1208 L0.7827,0.0092 Z M0.7827,0.0092 L0.6395,0.0092 L0.6395,0.1208 L0.7827,0.1208 L0.7827,0.0092 Z M0.7827,0.0092 L0.6395,0.0092 L0.6395,0.1208 L0.7827,0.1208 L0.7827,0.0092 Z M1,0.0092 L0.8574,0.0092 L0.8574,0.1208 L1,0.1208 L1,0.0092 Z M1,0.0092 L0.8574,0.0092 L0.8574,0.1208 L1,0.1208 L1,0.0092 Z M1,0.0092 L0.8574,0.0092 L0.8574,0.1208 L1,0.1208 L1,0.0092 Z M0.1432,0.3217 L0.1432,0.4098 L0.0309,0.4098 L0.0309,0.3217 L0.1432,0.3217 Z M0.1586,0.2978 L0.0154,0.2978 Q0.0088,0.2978,0.0044,0.3016 T0,0.31 L0,0.4216 Q0,0.427,0.0049,0.4304 T0.0154,0.4337 L0.1586,0.4337 Q0.1648,0.4337,0.1694,0.4299 T0.174,0.4216 L0.174,0.31 Q0.174,0.3062,0.1715,0.3035 T0.1653,0.2993 T0.1586,0.2978 Z M0.1432,0.888 L0.1432,0.9757 L0.0309,0.9757 L0.0309,0.888 L0.1432,0.888 Z M0.1586,0.8637 L0.0154,0.8637 Q0.0108,0.8637,0.0072,0.8658 T0.0018,0.8706 T0,0.8758 L0,0.9878 Q0,0.9929,0.0049,0.9964 T0.0154,1 L0.1586,1 Q0.1648,1,0.1694,0.996 T0.174,0.9878 L0.174,0.8758 Q0.174,0.8725,0.1715,0.8695 T0.1653,0.8651 T0.1586,0.8637 Z M0.3496,0.169 L0.3496,0.2706 L0.2194,0.2706 L0.2194,0.169 L0.3496,0.169 Z M0.3563,0.159 L0.2132,0.159 Q0.2106,0.159,0.2088,0.1604 T0.207,0.164 L0.207,0.2756 Q0.207,0.2781,0.2091,0.2796 T0.2132,0.281 L0.3563,0.281 Q0.3589,0.281,0.3607,0.2794 T0.3625,0.2756 L0.3625,0.164 Q0.3625,0.1619,0.3605,0.1604 T0.3563,0.159 Z M0.3368,0.6044 L0.3368,0.6858 L0.2327,0.6858 L0.2327,0.6044 L0.3368,0.6044 Z M0.3563,0.5742 L0.2132,0.5742 Q0.2049,0.5742,0.1993,0.5791 T0.1936,0.5893 L0.1936,0.7013 Q0.1936,0.7076,0.2001,0.712 T0.2132,0.7164 L0.3563,0.7164 Q0.3641,0.7164,0.3697,0.7114 T0.3754,0.7013 L0.3754,0.5893 Q0.3754,0.5847,0.3723,0.5812 T0.3648,0.5759 T0.3563,0.5742 Z M0.5736,0.164 L0.431,0.164 L0.431,0.2756 L0.5736,0.2756 L0.5736,0.164 Z M0.5675,0.315 L0.5675,0.4165 L0.4377,0.4165 L0.4377,0.315 L0.5675,0.315 Z M0.5736,0.3049 L0.431,0.3049 Q0.4284,0.3049,0.4264,0.3064 T0.4243,0.31 L0.4243,0.4216 Q0.4243,0.4237,0.4266,0.4251 T0.431,0.4266 L0.5736,0.4266 Q0.5767,0.4266,0.5785,0.4251 T0.5803,0.4216 L0.5803,0.31 Q0.5803,0.3087,0.5798,0.3077 T0.5783,0.306 T0.5762,0.3052 T0.5736,0.3049 Z M0.5736,0.4476 L0.431,0.4476 L0.431,0.5596 L0.5736,0.5596 L0.5736,0.4476 Z M0.5613,0.7408 L0.5613,0.8326 L0.4439,0.8326 L0.4439,0.7408 L0.5613,0.7408 Z M0.5736,0.7206 L0.431,0.7206 Q0.4253,0.7206,0.4217,0.724 T0.4181,0.7307 L0.4181,0.8427 Q0.4181,0.8469,0.4222,0.8498 T0.431,0.8528 L0.5736,0.8528 Q0.5778,0.8528,0.5808,0.8511 T0.5855,0.8471 T0.587,0.8427 L0.587,0.7307 Q0.587,0.7265,0.5826,0.7236 T0.5736,0.7206 Z M0.7827,0.164 L0.6395,0.164 L0.6395,0.2756 L0.7827,0.2756 L0.7827,0.164 Z M0.7827,0.31 L0.6395,0.31 L0.6395,0.4216 L0.7827,0.4216 L0.7827,0.31 Z M0.7827,0.5893 L0.6395,0.5893 L0.6395,0.7013 L0.7827,0.7013 L0.7827,0.5893 Z M0.7827,0.7307 L0.6395,0.7307 L0.6395,0.8427 L0.7827,0.8427 L0.7827,0.7307 Z M0.7827,0.8758 L0.6395,0.8758 L0.6395,0.9878 L0.7827,0.9878 L0.7827,0.8758 Z M1,0.164 L0.8574,0.164 L0.8574,0.2756 L1,0.2756 L1,0.164 Z M1,0.31 L0.8574,0.31 L0.8574,0.4216 L1,0.4216 L1,0.31 Z M1,0.4476 L0.8574,0.4476 L0.8574,0.5596 L1,0.5596 L1,0.4476 Z M1,0.5893 L0.8574,0.5893 L0.8574,0.7013 L1,0.7013 L1,0.5893 Z M1,0.7307 L0.8574,0.7307 L0.8574,0.8427 L1,0.8427 L1,0.7307 Z M1,0.8758 L0.8574,0.8758 L0.8574,0.9878 L1,0.9878 L1,0.8758 Z",type:0}},"":{type:5,data:{d:"M0.0008,0.9979 Q0.0008,1,0.0032,1 Q0.0482,1,0.0602,0.9975 Q0.0667,0.9963,0.0847,0.9917 T0.1084,0.9859 Q0.1124,0.9851,0.1221,0.9851 L0.1253,0.9851 L0.1285,0.9851 Q0.1518,0.9851,0.1655,0.9809 Q0.1695,0.9801,0.1731,0.9788 T0.1791,0.9766 T0.1839,0.9747 T0.1888,0.9732 L0.1936,0.972 T0.1988,0.9712 T0.2048,0.971 L0.2096,0.971 Q0.2201,0.9714,0.2233,0.9714 T0.2345,0.9693 Q0.2386,0.9685,0.2502,0.9674 T0.2715,0.966 L0.2811,0.9656 Q0.2916,0.9647,0.2916,0.9573 Q0.2916,0.954,0.2892,0.9515 T0.2819,0.9486 Q0.2755,0.9482,0.2683,0.9482 Q0.2643,0.9482,0.2582,0.9484 T0.2498,0.9486 Q0.2426,0.9486,0.2402,0.9473 Q0.2386,0.9469,0.2317,0.943 T0.2161,0.937 Q0.2104,0.9357,0.1992,0.933 T0.1831,0.9291 Q0.1807,0.9287,0.1783,0.9285 T0.1739,0.928 T0.1703,0.9276 T0.1675,0.9272 T0.1655,0.9266 T0.1639,0.9253 Q0.1598,0.9216,0.1462,0.9216 L0.143,0.9216 L0.1398,0.9216 L0.1365,0.9216 Q0.1197,0.9195,0.1197,0.9154 L0.1197,0.9154 Q0.1205,0.9121,0.1373,0.9088 T0.1703,0.9054 Q0.1791,0.9054,0.1863,0.904 T0.1984,0.9011 T0.2064,0.8992 Q0.2402,0.8967,0.2506,0.8934 Q0.2538,0.8926,0.2602,0.8899 T0.2707,0.8872 Q0.2715,0.8872,0.2731,0.8876 Q0.2795,0.8884,0.2884,0.8884 Q0.3068,0.8884,0.3092,0.8826 L0.3092,0.8797 Q0.3092,0.8772,0.3076,0.8747 T0.3044,0.8706 T0.3028,0.8681 Q0.3076,0.8656,0.3237,0.8656 Q0.3317,0.8656,0.3622,0.8623 Q0.3655,0.8623,0.3867,0.8617 T0.4217,0.8602 Q0.4241,0.8598,0.4289,0.8598 L0.4345,0.8598 L0.441,0.8598 Q0.4578,0.8598,0.4667,0.8586 Q0.4739,0.8573,0.4851,0.8567 T0.5004,0.8552 Q0.5012,0.8552,0.5108,0.855 T0.5269,0.853 T0.5333,0.8461 Q0.5333,0.8445,0.5325,0.8432 T0.5309,0.8409 T0.5289,0.8391 T0.5261,0.8378 L0.5229,0.837 T0.5185,0.8362 T0.5133,0.8355 T0.5076,0.8349 T0.502,0.8341 Q0.4932,0.8324,0.4859,0.8324 Q0.4827,0.8324,0.4787,0.8328 T0.4731,0.8333 Q0.4707,0.8333,0.4683,0.8324 Q0.4482,0.825,0.4394,0.825 Q0.4369,0.825,0.4345,0.8254 Q0.4225,0.827,0.4153,0.827 Q0.4088,0.827,0.4064,0.8258 Q0.3976,0.8204,0.3751,0.8204 Q0.3703,0.8204,0.3667,0.8214 T0.3622,0.8225 Q0.3598,0.8225,0.3558,0.82 Q0.351,0.8175,0.3402,0.8167 T0.3177,0.8156 T0.3028,0.8146 L0.2956,0.8121 T0.2871,0.8094 T0.2771,0.8073 T0.2635,0.8063 Q0.261,0.8063,0.2586,0.8067 Q0.2378,0.8071,0.2273,0.8071 Q0.2072,0.8071,0.2024,0.8051 Q0.1976,0.8034,0.1932,0.8026 T0.1867,0.8013 T0.1847,0.8001 L0.1847,0.7993 Q0.1855,0.7984,0.1855,0.7978 T0.1859,0.7966 T0.1867,0.7959 T0.188,0.7955 T0.1896,0.7951 T0.1916,0.7949 T0.1944,0.7945 T0.1984,0.7941 T0.2032,0.7939 Q0.212,0.7926,0.2325,0.7918 T0.2562,0.7905 Q0.2691,0.7893,0.2787,0.7847 Q0.2835,0.7827,0.2968,0.7791 T0.3149,0.7756 Q0.3189,0.7756,0.3305,0.7733 T0.3446,0.771 L0.3454,0.771 Q0.3462,0.771,0.3498,0.7721 T0.3574,0.774 T0.3655,0.7748 Q0.3703,0.7748,0.3743,0.7731 T0.3823,0.7708 T0.3916,0.77 T0.3992,0.7694 Q0.4008,0.7694,0.4076,0.7688 T0.4205,0.7675 L0.4305,0.7665 Q0.4345,0.7657,0.4402,0.7617 T0.4458,0.7545 Q0.4458,0.7503,0.4353,0.7487 Q0.4297,0.7478,0.4209,0.7462 T0.4044,0.7433 T0.3904,0.7416 L0.3847,0.7416 Q0.3807,0.7416,0.3747,0.7422 T0.3663,0.7428 T0.3606,0.7424 Q0.3582,0.742,0.3562,0.7418 T0.3522,0.7412 T0.3482,0.7406 T0.3446,0.7401 T0.341,0.7397 T0.3373,0.7393 T0.3341,0.7391 L0.3293,0.7391 Q0.3277,0.7395,0.3253,0.7395 Q0.3205,0.7395,0.3052,0.7387 T0.2835,0.7379 Q0.2755,0.7379,0.253,0.7325 Q0.2506,0.7316,0.2462,0.731 T0.2382,0.7296 T0.2305,0.7271 T0.2181,0.7234 T0.2048,0.7196 T0.2,0.7155 Q0.2,0.7142,0.2016,0.713 Q0.208,0.7059,0.2285,0.6978 T0.2618,0.6898 Q0.2739,0.6898,0.2831,0.6848 T0.2956,0.6794 Q0.3028,0.6786,0.3289,0.6765 T0.3566,0.674 Q0.3582,0.674,0.3855,0.6723 T0.4406,0.6688 T0.4755,0.6653 Q0.5004,0.6607,0.5124,0.6599 L0.5165,0.6599 Q0.5213,0.6599,0.5277,0.6605 T0.5373,0.6611 Q0.543,0.6611,0.5494,0.6599 Q0.592,0.6524,0.6,0.6524 Q0.6064,0.6524,0.61,0.6499 T0.6161,0.6474 Q0.6177,0.6474,0.6261,0.6495 T0.6418,0.6516 L0.6482,0.6516 Q0.653,0.6512,0.6651,0.6506 T0.6876,0.6493 T0.7084,0.6477 T0.7229,0.645 Q0.7269,0.6437,0.7333,0.6437 Q0.7373,0.6437,0.7458,0.6443 T0.7574,0.645 Q0.7614,0.645,0.7631,0.6445 T0.7655,0.6441 Q0.7671,0.6441,0.7723,0.6448 T0.7823,0.6454 Q0.788,0.6454,0.7952,0.6445 Q0.8233,0.6408,0.8723,0.6367 Q0.9012,0.6342,0.9092,0.6342 L0.9165,0.6342 L0.9205,0.6342 Q0.9277,0.6342,0.9382,0.6323 T0.9526,0.6304 Q0.9534,0.6304,0.9594,0.6307 T0.9695,0.6309 Q0.9976,0.6309,0.9992,0.6234 Q1,0.6201,1,0.618 Q1,0.6089,0.9775,0.608 Q0.9703,0.6076,0.9582,0.6076 Q0.9518,0.6076,0.9394,0.6078 T0.9213,0.608 Q0.9036,0.608,0.8972,0.6072 Q0.894,0.6068,0.8871,0.6058 T0.8751,0.6039 T0.8627,0.6024 T0.8506,0.6018 L0.8474,0.6018 Q0.841,0.6022,0.8281,0.6041 T0.8112,0.606 Q0.8096,0.606,0.808,0.6056 Q0.7783,0.6002,0.7647,0.6002 Q0.7598,0.6002,0.7454,0.6006 T0.7261,0.601 Q0.7221,0.601,0.7145,0.6022 T0.7036,0.6035 Q0.6996,0.6035,0.6964,0.6022 Q0.6723,0.5902,0.6442,0.5902 Q0.6426,0.5902,0.6386,0.5904 T0.6337,0.5906 Q0.6273,0.5906,0.6249,0.5894 L0.6177,0.5856 T0.6116,0.5838 T0.6016,0.5825 T0.5855,0.5823 Q0.5719,0.5823,0.5574,0.5798 T0.5373,0.5774 L0.5341,0.5774 Q0.5293,0.5778,0.5213,0.5786 T0.51,0.5794 Q0.5036,0.5794,0.4988,0.5769 Q0.4932,0.574,0.4771,0.574 Q0.4723,0.574,0.4631,0.5745 T0.4498,0.5749 Q0.4418,0.5749,0.4394,0.5736 Q0.4353,0.5724,0.4305,0.5715 T0.4225,0.5707 T0.4145,0.5705 T0.4056,0.5699 Q0.4008,0.5691,0.398,0.5689 T0.394,0.5689 T0.3908,0.5686 T0.3855,0.5674 Q0.3831,0.567,0.3811,0.5662 T0.3779,0.5645 T0.3743,0.563 T0.3695,0.5624 Q0.3655,0.5624,0.3594,0.5635 T0.3494,0.5645 T0.3406,0.5635 T0.3325,0.5624 Q0.3309,0.5624,0.3301,0.5628 L0.3141,0.5628 Q0.2635,0.5628,0.2506,0.5612 Q0.2474,0.5608,0.2434,0.5608 Q0.2402,0.5608,0.2349,0.561 T0.2273,0.5612 Q0.2209,0.5612,0.2177,0.5595 Q0.2145,0.557,0.2145,0.5558 Q0.2169,0.5537,0.2345,0.5521 Q0.2876,0.5475,0.3028,0.5425 Q0.3068,0.5413,0.3149,0.5396 T0.3309,0.5367 T0.3478,0.5338 T0.3606,0.5309 Q0.3631,0.5305,0.3755,0.5259 T0.3968,0.5214 Q0.3992,0.5214,0.4024,0.5218 T0.4096,0.5222 Q0.4161,0.5222,0.4213,0.5209 T0.4313,0.5185 T0.4402,0.5172 Q0.4418,0.5168,0.447,0.5168 L0.4558,0.5168 T0.4639,0.5162 T0.4707,0.5141 T0.4731,0.5102 Q0.4731,0.5089,0.4723,0.5081 Q0.4699,0.5019,0.4627,0.4994 T0.4369,0.4965 Q0.4273,0.4961,0.4193,0.4946 T0.4048,0.4915 T0.3952,0.4894 Q0.392,0.4886,0.388,0.4886 Q0.3847,0.4886,0.3775,0.4892 T0.3647,0.4898 Q0.3598,0.4898,0.355,0.4894 Q0.3165,0.4861,0.3141,0.4853 Q0.2779,0.4774,0.2715,0.4774 Q0.2699,0.4774,0.2683,0.4776 T0.2627,0.4778 Q0.2498,0.4778,0.2281,0.4762 Q0.2241,0.4749,0.2233,0.4737 Q0.2249,0.472,0.2321,0.4708 Q0.2402,0.4695,0.2554,0.4695 L0.2675,0.4695 L0.2795,0.4695 Q0.294,0.4695,0.2996,0.4679 Q0.3141,0.4629,0.3373,0.4616 Q0.3414,0.4612,0.3466,0.4606 T0.3582,0.4589 T0.3687,0.4562 T0.3727,0.4525 Q0.3727,0.4509,0.3703,0.4492 Q0.3639,0.4455,0.3474,0.4419 T0.3213,0.4384 L0.3157,0.4384 L0.31,0.4384 Q0.294,0.4384,0.2859,0.4363 Q0.2795,0.4347,0.2691,0.4347 L0.2618,0.4347 L0.2546,0.4347 Q0.2458,0.4347,0.2394,0.4338 Q0.2257,0.4318,0.2193,0.4303 T0.2092,0.4266 T0.2052,0.4224 T0.2024,0.4154 T0.196,0.4052 Q0.1912,0.3994,0.1867,0.3949 T0.1807,0.3884 T0.1791,0.3849 Q0.1791,0.3824,0.1839,0.3745 Q0.1871,0.3687,0.1944,0.3637 T0.2072,0.3561 T0.2221,0.3501 T0.2321,0.3463 Q0.2353,0.3455,0.241,0.3445 T0.2522,0.3428 T0.2639,0.3411 T0.2731,0.3384 T0.2956,0.3351 T0.3197,0.3326 Q0.3213,0.3322,0.3237,0.3322 T0.3325,0.3331 T0.3414,0.3339 Q0.3478,0.3339,0.3518,0.3314 Q0.3606,0.3264,0.3703,0.3264 Q0.3775,0.3264,0.3847,0.3293 Q0.3888,0.331,0.396,0.331 Q0.4024,0.331,0.4116,0.3295 T0.4265,0.3266 T0.4414,0.3227 T0.4514,0.3202 Q0.4578,0.3181,0.4839,0.3152 T0.5112,0.3123 T0.5177,0.3119 T0.5285,0.3111 T0.5398,0.3096 T0.549,0.3065 T0.5526,0.3015 Q0.5526,0.2999,0.5518,0.2982 Q0.547,0.2903,0.5386,0.2883 T0.5165,0.2862 Q0.5116,0.2862,0.5056,0.2866 T0.4972,0.287 Q0.4884,0.287,0.4787,0.2833 Q0.4594,0.2758,0.4265,0.2758 Q0.4169,0.2758,0.4129,0.2766 Q0.4112,0.2771,0.4104,0.2771 Q0.4088,0.2771,0.4056,0.2748 T0.3968,0.2721 Q0.3695,0.2696,0.359,0.2659 Q0.355,0.2646,0.351,0.2646 T0.3426,0.2661 T0.3365,0.2675 T0.3333,0.2659 Q0.3277,0.2605,0.3116,0.2553 T0.2859,0.2501 L0.2843,0.2501 L0.2819,0.2501 Q0.2779,0.2501,0.2723,0.2493 T0.2586,0.2472 T0.2474,0.2455 Q0.1799,0.236,0.1719,0.236 Q0.1663,0.236,0.1606,0.235 T0.1502,0.2316 T0.1454,0.2265 Q0.1454,0.2223,0.1558,0.2173 Q0.1679,0.2115,0.1859,0.2092 T0.2185,0.207 T0.2353,0.2057 Q0.2369,0.2049,0.2502,0.2041 T0.2799,0.2022 T0.302,0.2007 Q0.3084,0.1999,0.3245,0.1954 T0.347,0.1908 Q0.3502,0.1908,0.3534,0.1916 Q0.3663,0.197,0.388,0.197 Q0.404,0.197,0.4088,0.1929 Q0.4096,0.192,0.4108,0.192 T0.4177,0.1945 T0.4277,0.197 T0.4369,0.1949 Q0.4442,0.1908,0.4843,0.1875 Q0.4892,0.1871,0.4968,0.1839 T0.5084,0.1808 L0.5108,0.1808 Q0.5213,0.1825,0.5454,0.1825 Q0.5823,0.1825,0.5992,0.1779 Q0.6096,0.1746,0.6217,0.1746 Q0.6249,0.1746,0.6309,0.1748 T0.6394,0.175 Q0.6434,0.175,0.6466,0.1746 Q0.6474,0.1746,0.6594,0.1738 T0.6787,0.1713 T0.6892,0.1659 Q0.6924,0.1634,0.6924,0.1593 Q0.6924,0.1547,0.6888,0.151 T0.6795,0.1472 Q0.6779,0.1472,0.6763,0.1477 Q0.6699,0.1493,0.6667,0.1493 Q0.661,0.1493,0.6506,0.1456 Q0.6329,0.1394,0.6129,0.1394 Q0.6048,0.1394,0.5992,0.1377 T0.5888,0.136 T0.5803,0.1377 T0.5751,0.1394 Q0.5711,0.1394,0.5639,0.1369 Q0.5365,0.1273,0.5116,0.1273 Q0.4876,0.1273,0.4667,0.1253 Q0.4627,0.1248,0.4542,0.1211 T0.4337,0.1174 L0.4305,0.1174 Q0.4217,0.1178,0.4153,0.119 T0.408,0.1203 Q0.4056,0.1203,0.4,0.117 Q0.3976,0.1153,0.396,0.1136 T0.3932,0.1112 T0.39,0.1099 T0.3847,0.1095 Q0.3799,0.1095,0.3687,0.1103 Q0.355,0.1112,0.3434,0.1141 T0.3301,0.117 Q0.3261,0.117,0.3229,0.1145 Q0.3181,0.1116,0.3052,0.1087 T0.2787,0.1043 T0.2546,0.1029 Q0.2506,0.1029,0.2474,0.1033 Q0.2418,0.1037,0.2349,0.1054 T0.2249,0.107 Q0.2225,0.107,0.2193,0.1066 Q0.2024,0.1024,0.1863,0.1024 Q0.1823,0.1024,0.1562,0.0971 T0.1269,0.0917 T0.1161,0.0896 T0.106,0.0854 Q0.1076,0.0846,0.11,0.0842 Q0.1173,0.0821,0.1261,0.0821 Q0.1301,0.0821,0.1369,0.0825 T0.1462,0.083 Q0.1494,0.083,0.151,0.0825 T0.1831,0.0813 T0.2201,0.0784 T0.243,0.074 T0.2667,0.0718 Q0.2707,0.0718,0.2755,0.0724 T0.2843,0.073 T0.2936,0.0724 T0.3024,0.0705 T0.3072,0.068 T0.3092,0.0657 T0.3108,0.0647 Q0.3116,0.0643,0.3133,0.0643 L0.3157,0.0643 L0.3181,0.0643 Q0.3446,0.0643,0.3446,0.0556 T0.3205,0.0469 L0.3189,0.0469 Q0.3157,0.0469,0.3157,0.0465 Q0.3084,0.0427,0.2835,0.0386 Q0.2739,0.0369,0.2675,0.0342 T0.2538,0.0299 Q0.249,0.029,0.245,0.029 T0.2378,0.0303 T0.2321,0.0315 Q0.2305,0.0315,0.2273,0.0307 Q0.2201,0.0286,0.2004,0.0272 T0.1775,0.0245 Q0.1735,0.0228,0.1663,0.0226 T0.1522,0.0197 T0.1345,0.0145 T0.1124,0.0079 Q0.0996,0.0033,0.0671,0.0044 T0.0297,0.0041 Q0.0169,0,0.0024,0.0017 Q0,0.0021,0,0.0037 Z M0.0064,0.9954 L0.0056,0.0058 Q0.0177,0.005,0.0281,0.0083 Q0.0345,0.01,0.0675,0.0089 T0.1108,0.012 Q0.1221,0.0162,0.1329,0.0187 T0.1498,0.0236 T0.1606,0.0268 T0.1691,0.0274 T0.1759,0.0286 Q0.1807,0.0303,0.2,0.0315 T0.2257,0.0348 Q0.2305,0.0361,0.2337,0.0361 Q0.2361,0.0361,0.2398,0.0348 T0.2466,0.0336 Q0.249,0.0336,0.2522,0.034 Q0.2586,0.0353,0.2655,0.0382 T0.2827,0.0427 Q0.3068,0.0469,0.3124,0.0502 Q0.3157,0.0523,0.3237,0.0523 L0.3277,0.0523 L0.3309,0.0523 Q0.3398,0.0523,0.3398,0.0556 Q0.3398,0.0581,0.3341,0.0587 T0.3205,0.0593 T0.3092,0.0603 T0.3036,0.0643 T0.2932,0.068 Q0.2884,0.0684,0.2843,0.0684 Q0.2811,0.0684,0.2763,0.0678 T0.2667,0.0672 Q0.2586,0.0672,0.2422,0.0697 T0.2177,0.0747 Q0.2137,0.0759,0.1831,0.0767 T0.1494,0.0784 L0.1474,0.0784 T0.1398,0.078 T0.1285,0.0776 Q0.1173,0.0776,0.1084,0.08 Q0.1004,0.0817,0.1004,0.0846 Q0.1004,0.0867,0.104,0.0888 T0.1124,0.0923 T0.1213,0.0948 T0.1269,0.0958 T0.155,0.1014 T0.1863,0.107 Q0.2016,0.107,0.2185,0.1107 Q0.2217,0.1116,0.2257,0.1116 Q0.2289,0.1116,0.2365,0.1099 T0.2482,0.1074 L0.2538,0.1074 Q0.2683,0.1074,0.2912,0.1107 T0.3197,0.1182 Q0.3245,0.1215,0.3301,0.1215 Q0.3333,0.1215,0.3454,0.1184 T0.3687,0.1145 Q0.3735,0.1141,0.3779,0.1139 T0.3843,0.1134 T0.3871,0.1132 Q0.3896,0.1132,0.39,0.1136 T0.392,0.1161 T0.3968,0.1203 Q0.404,0.1248,0.408,0.1248 Q0.4096,0.1248,0.4165,0.1234 T0.4305,0.1215 L0.4337,0.1215 Q0.4442,0.1215,0.4518,0.1251 T0.4659,0.1294 Q0.4876,0.1319,0.5116,0.1319 T0.5622,0.141 Q0.5703,0.1439,0.5751,0.1439 Q0.5791,0.1439,0.5831,0.1423 T0.5888,0.1406 Q0.592,0.1406,0.5944,0.1412 T0.6012,0.1427 T0.6129,0.1435 Q0.6313,0.1435,0.649,0.1497 Q0.6602,0.1535,0.6667,0.1535 Q0.6715,0.1535,0.6779,0.1522 Q0.6787,0.1518,0.6795,0.1518 Q0.6827,0.1518,0.6847,0.1541 T0.6867,0.1593 Q0.6867,0.1618,0.6851,0.1634 Q0.6835,0.1655,0.6775,0.1667 T0.6598,0.169 T0.6458,0.1705 T0.6402,0.1709 Q0.6378,0.1709,0.6321,0.1705 T0.6225,0.1701 Q0.6096,0.1701,0.5968,0.1738 Q0.5823,0.1779,0.5446,0.1779 Q0.5205,0.1779,0.5116,0.1767 Q0.51,0.1763,0.5084,0.1763 Q0.5028,0.1763,0.4944,0.1796 T0.4835,0.1829 L0.4771,0.1833 T0.4659,0.1844 L0.4546,0.1858 T0.443,0.1881 T0.4337,0.1912 Q0.4321,0.1916,0.4305,0.1916 Q0.4273,0.1916,0.4209,0.1895 T0.412,0.1875 Q0.408,0.1875,0.4056,0.19 Q0.4024,0.1925,0.388,0.1925 Q0.3663,0.1925,0.3558,0.1879 Q0.3518,0.1862,0.3462,0.1862 Q0.3373,0.1862,0.3213,0.191 T0.3012,0.1962 Q0.2964,0.1966,0.2799,0.1976 T0.2494,0.1997 T0.2313,0.2024 L0.2313,0.2024 L0.2293,0.2024 L0.2261,0.2024 L0.2217,0.2024 Q0.204,0.2024,0.1851,0.2047 T0.1526,0.2136 Q0.1406,0.2198,0.1406,0.226 Q0.1406,0.2319,0.1518,0.2362 T0.1719,0.2406 Q0.1791,0.2406,0.2466,0.2497 Q0.2498,0.2501,0.2574,0.2516 T0.2711,0.2538 T0.2819,0.2547 L0.2851,0.2547 Q0.2851,0.2543,0.2859,0.2543 Q0.294,0.2543,0.3096,0.2592 T0.3285,0.2684 Q0.3317,0.2721,0.3373,0.2721 Q0.3406,0.2721,0.3462,0.2708 T0.3542,0.2696 Q0.3558,0.2696,0.3574,0.27 Q0.3679,0.2737,0.3968,0.2762 Q0.3984,0.2766,0.4004,0.2779 L0.4044,0.2804 T0.4096,0.2816 Q0.412,0.2816,0.4145,0.2808 Q0.4177,0.2804,0.4249,0.2804 Q0.4586,0.2804,0.4763,0.287 Q0.4867,0.2912,0.4972,0.2912 Q0.5004,0.2912,0.5064,0.2908 T0.5165,0.2903 Q0.5293,0.2903,0.5361,0.2922 T0.547,0.3003 L0.547,0.3011 Q0.547,0.3036,0.5414,0.3049 T0.5249,0.3067 T0.51,0.3082 Q0.5092,0.3082,0.4831,0.3111 T0.4498,0.3161 Q0.408,0.3264,0.3952,0.3264 Q0.3896,0.3264,0.3863,0.3252 Q0.3783,0.3223,0.3703,0.3223 Q0.359,0.3223,0.3494,0.3277 Q0.347,0.3293,0.343,0.3293 Q0.3414,0.3293,0.3353,0.3285 T0.3253,0.3277 T0.3181,0.3285 Q0.3149,0.3289,0.2952,0.3306 T0.2699,0.3347 Q0.2675,0.3364,0.2598,0.3372 T0.2434,0.3395 T0.2297,0.3426 L0.2205,0.3461 T0.2048,0.3523 T0.1908,0.3606 T0.1791,0.3725 Q0.1743,0.3803,0.1743,0.3845 Q0.1743,0.3874,0.1763,0.3901 T0.1827,0.3976 T0.1912,0.4073 T0.198,0.4189 T0.2032,0.4276 T0.2137,0.4326 T0.2386,0.438 Q0.2458,0.4392,0.2562,0.4392 L0.2639,0.4392 L0.2699,0.4392 Q0.2795,0.4392,0.2843,0.4405 Q0.2932,0.443,0.3092,0.443 L0.3157,0.443 L0.3213,0.443 Q0.3293,0.443,0.3458,0.4463 T0.3671,0.4525 Q0.3598,0.4558,0.3373,0.4571 Q0.3124,0.4587,0.298,0.4637 Q0.294,0.465,0.2811,0.465 L0.2703,0.465 L0.2586,0.465 Q0.241,0.465,0.2305,0.4666 Q0.2185,0.4687,0.2185,0.4728 Q0.2185,0.4745,0.2205,0.4764 T0.2241,0.4791 L0.2265,0.4803 L0.2273,0.4803 Q0.2506,0.4824,0.261,0.4824 Q0.2675,0.4824,0.2699,0.482 Q0.2699,0.4815,0.2707,0.4815 Q0.2771,0.4815,0.3124,0.4898 Q0.3173,0.4907,0.3229,0.4913 T0.3386,0.4925 T0.3542,0.4936 T0.3663,0.494 Q0.3711,0.494,0.3787,0.4936 T0.3888,0.4932 Q0.392,0.4932,0.3944,0.4936 T0.4032,0.4959 T0.4181,0.499 T0.4369,0.5006 Q0.449,0.501,0.455,0.5021 T0.4639,0.5048 T0.4675,0.5093 L0.4675,0.5097 Q0.4675,0.5106,0.4663,0.511 T0.4622,0.5116 L0.4566,0.512 T0.4486,0.5124 T0.4402,0.5127 Q0.4345,0.5131,0.4257,0.5153 T0.4096,0.5176 Q0.4064,0.5176,0.4024,0.5172 L0.3968,0.5172 Q0.3863,0.5172,0.3731,0.522 T0.359,0.5268 Q0.355,0.528,0.3317,0.5321 T0.3004,0.5388 Q0.2867,0.5433,0.2337,0.5479 Q0.2096,0.55,0.2096,0.5562 Q0.2096,0.5591,0.2145,0.5628 Q0.2193,0.5662,0.2289,0.5662 Q0.2313,0.5662,0.2373,0.5657 T0.2458,0.5653 L0.2498,0.5653 Q0.2635,0.5674,0.3124,0.5674 Q0.3261,0.5674,0.3301,0.567 L0.3317,0.567 Q0.3341,0.567,0.3394,0.568 T0.3486,0.5691 Q0.3542,0.5691,0.3606,0.5678 T0.3699,0.5666 T0.3759,0.5686 T0.3839,0.5718 T0.3908,0.573 T0.3964,0.5734 T0.4048,0.5742 T0.4165,0.5751 T0.4277,0.5757 T0.4369,0.5778 Q0.4426,0.5794,0.4538,0.5794 Q0.4586,0.5794,0.4679,0.5792 T0.4811,0.579 Q0.4924,0.579,0.4956,0.5807 Q0.502,0.584,0.5108,0.584 L0.5137,0.584 T0.5173,0.5838 L0.5205,0.5834 L0.5237,0.583 L0.5269,0.5825 T0.5305,0.5821 T0.5341,0.5819 L0.5365,0.5819 Q0.5414,0.5819,0.5562,0.5842 T0.5855,0.5865 Q0.5912,0.5865,0.5948,0.5867 T0.6012,0.5869 T0.6064,0.5873 T0.61,0.5877 T0.6133,0.5886 T0.6157,0.5896 L0.6185,0.591 T0.6217,0.5931 Q0.6265,0.5952,0.6369,0.5952 L0.6418,0.5952 L0.6466,0.5952 Q0.6723,0.5952,0.6932,0.606 Q0.698,0.608,0.7044,0.608 Q0.7084,0.608,0.7161,0.6068 T0.7261,0.6056 Q0.7309,0.6056,0.7454,0.6051 T0.7647,0.6047 Q0.7775,0.6047,0.8072,0.6101 Q0.8096,0.6105,0.812,0.6105 Q0.8177,0.6105,0.8297,0.6085 T0.8474,0.606 L0.8506,0.606 Q0.8562,0.606,0.8647,0.607 T0.8831,0.6095 T0.8964,0.6118 Q0.9036,0.6122,0.9221,0.6122 L0.9406,0.6122 L0.959,0.6122 L0.9767,0.6122 Q0.9952,0.613,0.9952,0.6172 Q0.9952,0.6176,0.9944,0.6221 Q0.9936,0.6259,0.9574,0.6259 L0.955,0.6259 L0.9526,0.6259 Q0.9478,0.6259,0.9373,0.628 T0.9205,0.63 L0.9173,0.63 Q0.9133,0.6296,0.9084,0.6296 Q0.9004,0.6296,0.8715,0.6321 Q0.8233,0.6367,0.7944,0.64 Q0.7888,0.6408,0.7839,0.6408 T0.7739,0.6402 T0.7671,0.6396 Q0.7639,0.6396,0.7622,0.64 Q0.7614,0.6404,0.759,0.6404 Q0.7574,0.6404,0.749,0.6398 T0.7357,0.6392 Q0.7261,0.6392,0.7213,0.6412 Q0.7173,0.6425,0.7032,0.6437 T0.6711,0.6458 T0.6474,0.647 Q0.645,0.6474,0.6418,0.6474 Q0.6353,0.6474,0.6277,0.6454 T0.6161,0.6433 Q0.6104,0.6433,0.6072,0.6456 T0.6,0.6479 Q0.5912,0.6479,0.5486,0.6557 Q0.5422,0.657,0.5373,0.657 Q0.5349,0.657,0.5289,0.6564 T0.5173,0.6557 L0.5124,0.6557 Q0.4996,0.6562,0.4739,0.6611 Q0.4675,0.6624,0.4398,0.6645 T0.3851,0.668 T0.3558,0.6698 Q0.355,0.6698,0.3285,0.6721 T0.2948,0.6752 Q0.2892,0.6761,0.2843,0.6786 T0.2747,0.6831 T0.2618,0.6852 Q0.253,0.6852,0.2394,0.6893 T0.2141,0.6993 T0.1968,0.7105 Q0.1944,0.713,0.1944,0.7155 Q0.1944,0.7196,0.2012,0.7229 T0.2177,0.7285 T0.2281,0.7308 Q0.2321,0.7329,0.2365,0.7339 T0.245,0.7356 T0.2514,0.7366 Q0.2522,0.737,0.2554,0.7379 T0.2614,0.7393 T0.2679,0.7406 T0.2755,0.7416 T0.2835,0.742 Q0.29,0.742,0.3048,0.7428 T0.3253,0.7437 L0.3301,0.7437 L0.3333,0.7437 Q0.3341,0.7437,0.3598,0.7466 Q0.3639,0.7474,0.3671,0.7474 T0.3759,0.7466 T0.3855,0.7457 Q0.388,0.7457,0.3904,0.7462 Q0.3984,0.7466,0.4137,0.7495 T0.4349,0.7532 T0.441,0.7557 Q0.441,0.7599,0.4289,0.7619 Q0.4257,0.7628,0.4197,0.7634 T0.4072,0.7644 T0.3984,0.7652 Q0.3968,0.7652,0.3912,0.7655 T0.3811,0.7665 T0.3719,0.7694 Q0.3695,0.7702,0.3655,0.7702 T0.3546,0.7686 T0.3462,0.7665 L0.3446,0.7665 Q0.3406,0.7665,0.3293,0.769 T0.3149,0.7715 Q0.3084,0.7715,0.2952,0.7748 T0.2763,0.781 Q0.2675,0.7847,0.2554,0.7864 Q0.253,0.7864,0.2325,0.7874 T0.2024,0.7893 Q0.2008,0.7893,0.1984,0.7897 T0.1948,0.7901 T0.1916,0.7903 T0.1888,0.7908 T0.1867,0.7914 T0.1847,0.7922 L0.1831,0.793 T0.1819,0.7943 L0.1811,0.7959 T0.1799,0.7976 Q0.1791,0.7993,0.1791,0.8001 Q0.1791,0.8034,0.1831,0.8051 T0.1932,0.8078 T0.2,0.8092 Q0.2072,0.8117,0.2257,0.8117 Q0.2337,0.8117,0.2586,0.8109 L0.2635,0.8109 Q0.2707,0.8109,0.2767,0.8117 T0.2859,0.8136 T0.2936,0.8163 T0.3012,0.8187 Q0.3068,0.82,0.3277,0.8206 T0.3526,0.8237 Q0.3582,0.8266,0.3622,0.8266 Q0.3647,0.8266,0.3687,0.8258 T0.3751,0.825 Q0.396,0.825,0.404,0.8291 Q0.408,0.8316,0.4161,0.8316 Q0.4217,0.8316,0.4353,0.8295 L0.4394,0.8295 Q0.4466,0.8295,0.4659,0.8366 Q0.4699,0.8378,0.4747,0.8378 Q0.4763,0.8378,0.4807,0.8374 T0.4884,0.837 Q0.494,0.837,0.5004,0.8382 Q0.5052,0.8391,0.5124,0.8399 Q0.5221,0.8411,0.5249,0.8422 T0.5277,0.8461 Q0.5277,0.8482,0.5233,0.849 T0.5112,0.8501 T0.4996,0.8511 Q0.4964,0.8519,0.4851,0.8523 T0.4659,0.8544 Q0.4578,0.8557,0.4402,0.8557 L0.4349,0.8557 L0.4297,0.8557 L0.4209,0.8557 Q0.408,0.8565,0.3867,0.8571 T0.3614,0.8582 Q0.3317,0.8611,0.3237,0.8611 L0.3225,0.8611 L0.3213,0.8611 Q0.2972,0.8611,0.2972,0.8681 Q0.2972,0.8714,0.3008,0.8747 T0.3044,0.8805 Q0.3044,0.881,0.3036,0.8814 Q0.3012,0.8839,0.2851,0.8839 Q0.2779,0.8839,0.2739,0.883 Q0.2723,0.8826,0.2699,0.8826 T0.2643,0.8835 T0.259,0.8853 T0.2542,0.8876 T0.249,0.8893 Q0.2386,0.8922,0.2056,0.8946 Q0.2016,0.8951,0.1916,0.898 T0.1703,0.9009 Q0.1518,0.9009,0.1337,0.9044 T0.1149,0.9146 L0.1149,0.9158 Q0.1149,0.9175,0.1157,0.9187 T0.1173,0.921 T0.1201,0.9226 T0.1233,0.9237 T0.1269,0.9245 L0.1305,0.9251 T0.1337,0.9255 L0.1357,0.9258 Q0.139,0.9262,0.1446,0.9262 T0.1542,0.9266 T0.1598,0.9282 Q0.1614,0.9303,0.1647,0.9314 T0.1739,0.9328 T0.1815,0.9336 Q0.1863,0.9345,0.1976,0.9372 T0.2145,0.9415 Q0.2225,0.9432,0.2285,0.9467 T0.2378,0.9515 Q0.2426,0.9531,0.2514,0.9531 Q0.2538,0.9531,0.2602,0.9529 T0.2707,0.9527 Q0.2763,0.9527,0.2815,0.9531 T0.2867,0.9569 T0.2811,0.9614 Q0.2434,0.9627,0.2329,0.9652 Q0.2249,0.9672,0.2241,0.9672 L0.2096,0.9668 L0.2056,0.9668 Q0.2,0.9668,0.196,0.9672 T0.1884,0.9687 T0.1815,0.9708 T0.1731,0.9737 T0.1639,0.9772 Q0.1518,0.9805,0.1285,0.9805 L0.1253,0.9805 Q0.1124,0.9805,0.1076,0.9818 Q0.1012,0.983,0.0831,0.9876 T0.0594,0.9934 Q0.049,0.9954,0.0064,0.9954 Z M0.0032,0.9979 L0.0024,0.0037 Q0.0161,0.0021,0.0289,0.0062 Q0.0337,0.0075,0.0671,0.0066 T0.1116,0.01 T0.1337,0.0166 T0.151,0.022 Q0.1582,0.0249,0.1659,0.0251 T0.1767,0.0265 Q0.1807,0.0278,0.2,0.0292 T0.2265,0.0328 Q0.2305,0.034,0.2329,0.034 T0.239,0.0326 T0.2458,0.0311 T0.253,0.0319 Q0.2578,0.0332,0.2614,0.0342 T0.2667,0.0363 T0.2723,0.0384 T0.2827,0.0406 Q0.3084,0.0448,0.3141,0.0485 Q0.3149,0.0494,0.3225,0.0494 T0.3361,0.0504 T0.3422,0.0554 T0.3357,0.0606 T0.3205,0.0618 T0.31,0.0626 Q0.3092,0.0626,0.3056,0.0659 T0.2932,0.0701 Q0.2884,0.0709,0.2843,0.0709 Q0.2811,0.0709,0.2759,0.0701 T0.2667,0.0693 Q0.2586,0.0693,0.2422,0.0718 T0.2193,0.0763 Q0.2137,0.0784,0.1831,0.079 T0.1502,0.0805 Q0.1494,0.0809,0.147,0.0809 Q0.1454,0.0809,0.1386,0.0803 T0.1277,0.0796 Q0.1173,0.0796,0.1092,0.0821 Q0.1036,0.0834,0.1036,0.0854 Q0.1036,0.0879,0.1129,0.0908 T0.1269,0.0937 Q0.1293,0.0937,0.1558,0.0991 T0.1863,0.1045 Q0.2016,0.1045,0.2193,0.1087 Q0.2225,0.1091,0.2249,0.1091 Q0.2289,0.1091,0.2357,0.1076 T0.2482,0.1054 Q0.2506,0.1049,0.2546,0.1049 Q0.2699,0.1049,0.2924,0.1085 T0.3213,0.1165 Q0.3253,0.119,0.3301,0.119 Q0.3325,0.119,0.3446,0.1161 T0.3687,0.1124 Q0.3831,0.1112,0.3863,0.1112 T0.3908,0.1118 T0.3936,0.1145 T0.3984,0.1186 Q0.4048,0.1228,0.408,0.1228 Q0.4096,0.1228,0.4161,0.1213 T0.4305,0.1195 L0.4337,0.1195 Q0.4426,0.1195,0.4474,0.1211 T0.4566,0.1246 T0.4667,0.1273 Q0.4876,0.1298,0.5116,0.1298 Q0.5365,0.1298,0.5631,0.1389 Q0.5703,0.1414,0.5751,0.1414 Q0.5783,0.1414,0.5819,0.1398 T0.5888,0.1381 Q0.5928,0.1381,0.5984,0.1398 T0.6129,0.1414 Q0.6321,0.1414,0.6498,0.1477 Q0.661,0.1514,0.6667,0.1514 Q0.6707,0.1514,0.6771,0.1501 Q0.6787,0.1497,0.6795,0.1497 Q0.6835,0.1497,0.6863,0.1526 T0.6892,0.1593 Q0.6892,0.1626,0.6876,0.1647 Q0.6851,0.1672,0.6799,0.1686 T0.6695,0.1705 T0.6566,0.1715 T0.6458,0.1725 Q0.6434,0.173,0.6402,0.173 Q0.6378,0.173,0.6317,0.1727 T0.6225,0.1725 Q0.6096,0.1725,0.5984,0.1759 Q0.5823,0.1804,0.5454,0.1804 Q0.5205,0.1804,0.5116,0.1788 L0.5084,0.1788 Q0.5036,0.1788,0.4956,0.1819 T0.4843,0.185 Q0.4434,0.1887,0.4353,0.1929 Q0.4321,0.1945,0.4289,0.1945 T0.4197,0.1922 T0.4112,0.19 T0.4072,0.1912 Q0.4032,0.1949,0.388,0.1949 Q0.3663,0.1949,0.3542,0.19 Q0.351,0.1883,0.3462,0.1883 Q0.3406,0.1883,0.3321,0.1906 T0.3153,0.1954 T0.302,0.1983 Q0.2972,0.1991,0.2859,0.1997 T0.2643,0.201 T0.245,0.2024 T0.2337,0.2041 Q0.2321,0.2045,0.2181,0.2045 T0.1851,0.207 T0.1542,0.2157 Q0.143,0.2211,0.143,0.226 Q0.143,0.2314,0.153,0.2348 T0.1719,0.2381 Q0.1791,0.2381,0.2474,0.2476 Q0.2506,0.248,0.2558,0.2489 T0.2651,0.2505 T0.2739,0.252 T0.2819,0.2526 Q0.2835,0.2526,0.2851,0.2522 L0.2859,0.2522 Q0.2948,0.2522,0.3104,0.2574 T0.3309,0.2671 Q0.3333,0.2696,0.3365,0.2696 Q0.339,0.2696,0.3442,0.2684 T0.3526,0.2671 T0.3582,0.2679 Q0.3687,0.2717,0.3968,0.2742 Q0.4,0.2746,0.4036,0.2771 T0.4096,0.2796 Q0.4112,0.2796,0.4137,0.2787 Q0.4169,0.2779,0.4257,0.2779 Q0.4594,0.2779,0.4779,0.2849 Q0.4876,0.2891,0.4972,0.2891 Q0.4996,0.2891,0.506,0.2887 T0.5165,0.2883 Q0.5253,0.2883,0.5305,0.2889 T0.541,0.292 T0.5494,0.299 L0.5494,0.3015 Q0.5494,0.3036,0.5466,0.3051 T0.5386,0.3073 T0.5285,0.3086 T0.5181,0.3094 T0.5108,0.3102 Q0.5068,0.3107,0.494,0.3121 L0.4683,0.315 T0.4506,0.3181 Q0.449,0.3181,0.4426,0.32 T0.4313,0.3229 T0.4197,0.3256 T0.4064,0.3281 T0.3952,0.3289 Q0.3888,0.3289,0.3855,0.3273 Q0.3783,0.3243,0.3703,0.3243 Q0.3598,0.3243,0.351,0.3297 Q0.3478,0.3314,0.3422,0.3314 Q0.3398,0.3314,0.3337,0.3306 T0.3245,0.3297 T0.3189,0.3306 Q0.3149,0.3314,0.2956,0.3328 T0.2715,0.3368 Q0.2691,0.338,0.2635,0.3391 T0.2522,0.3407 T0.2406,0.3424 T0.2313,0.3447 Q0.2305,0.3447,0.2213,0.348 T0.206,0.354 T0.1924,0.3621 T0.1815,0.3733 Q0.1767,0.3816,0.1767,0.3849 Q0.1767,0.387,0.1783,0.3893 T0.1847,0.3961 T0.1936,0.4063 T0.2004,0.4181 T0.2052,0.4264 T0.2145,0.4309 T0.2386,0.4359 Q0.2458,0.4372,0.2554,0.4372 Q0.2578,0.4372,0.2627,0.437 T0.2699,0.4367 Q0.2795,0.4367,0.2851,0.4384 Q0.294,0.4409,0.3092,0.4409 Q0.3116,0.4409,0.3157,0.4407 T0.3213,0.4405 Q0.3301,0.4405,0.3466,0.444 T0.3687,0.4509 Q0.3703,0.4517,0.3703,0.4525 Q0.3703,0.4575,0.3373,0.4596 Q0.3133,0.4608,0.2988,0.4658 Q0.294,0.4674,0.2803,0.4674 Q0.2763,0.4674,0.2687,0.4672 T0.257,0.467 Q0.2402,0.467,0.2313,0.4687 Q0.2209,0.4708,0.2209,0.4737 Q0.2209,0.4741,0.2213,0.4749 T0.2229,0.4764 L0.2249,0.4774 T0.2265,0.4778 L0.2273,0.4782 Q0.2498,0.4803,0.2618,0.4803 Q0.2667,0.4803,0.2691,0.4799 Q0.2699,0.4795,0.2715,0.4795 Q0.2779,0.4795,0.3133,0.4873 Q0.3181,0.4886,0.3233,0.4892 T0.3386,0.4905 T0.3542,0.4915 T0.3655,0.4919 Q0.3703,0.4919,0.3779,0.4915 T0.3888,0.4911 T0.3952,0.4915 Q0.3976,0.4919,0.4008,0.4927 L0.4072,0.4944 T0.4149,0.4961 T0.4249,0.4975 T0.4369,0.4985 Q0.449,0.499,0.4554,0.5 T0.4651,0.5031 T0.4699,0.5085 Q0.4707,0.5093,0.4707,0.5097 Q0.4707,0.5114,0.4687,0.5124 T0.4631,0.5139 T0.4562,0.5145 T0.4478,0.5147 L0.4402,0.5147 Q0.4353,0.5151,0.4265,0.5174 T0.4096,0.5197 L0.4024,0.5197 Q0.4,0.5193,0.3968,0.5193 Q0.3896,0.5193,0.3831,0.5209 T0.3703,0.5253 T0.3598,0.5288 Q0.3558,0.5301,0.3321,0.5342 T0.302,0.5409 Q0.2876,0.5454,0.2337,0.55 Q0.2112,0.5521,0.2112,0.5558 Q0.2112,0.5574,0.2161,0.5612 Q0.2201,0.5637,0.2281,0.5637 Q0.2305,0.5637,0.2361,0.5633 T0.2442,0.5628 Q0.2474,0.5628,0.2498,0.5633 Q0.2635,0.5653,0.3133,0.5653 Q0.3261,0.5653,0.3301,0.5649 L0.3325,0.5649 Q0.3349,0.5649,0.3402,0.5657 T0.3494,0.5666 Q0.3542,0.5666,0.3598,0.5657 Q0.3663,0.5645,0.3695,0.5645 Q0.3735,0.5645,0.3775,0.5666 T0.3847,0.5695 Q0.3888,0.5707,0.3912,0.5709 T0.3968,0.5711 T0.4048,0.572 Q0.4096,0.5724,0.4165,0.5726 T0.4281,0.5734 T0.4378,0.5757 Q0.4418,0.5774,0.4522,0.5774 Q0.4562,0.5774,0.4655,0.5769 T0.4795,0.5765 Q0.4932,0.5765,0.4972,0.579 Q0.5028,0.5819,0.51,0.5819 Q0.5141,0.5819,0.5221,0.5809 T0.5341,0.5798 L0.5373,0.5798 Q0.5422,0.5798,0.557,0.5821 T0.5855,0.5844 L0.5936,0.5844 L0.5992,0.5844 T0.604,0.5848 T0.6076,0.5852 T0.6108,0.5859 T0.6137,0.5865 T0.6161,0.5873 T0.6181,0.5881 T0.6209,0.5896 L0.6233,0.591 Q0.6265,0.5927,0.6353,0.5927 L0.6402,0.5927 L0.645,0.5927 Q0.6723,0.5927,0.6948,0.6039 Q0.6988,0.606,0.7036,0.606 Q0.7076,0.606,0.7153,0.6045 T0.7261,0.6031 Q0.7309,0.6031,0.7454,0.6027 T0.7647,0.6022 Q0.7783,0.6022,0.808,0.608 L0.812,0.608 Q0.8169,0.608,0.8293,0.6062 T0.8474,0.6039 L0.8506,0.6039 Q0.857,0.6039,0.8655,0.6049 T0.8835,0.6074 T0.8972,0.6093 Q0.9036,0.6101,0.9213,0.6101 L0.9398,0.6101 L0.959,0.6101 L0.9767,0.6101 Q0.9976,0.6109,0.9976,0.6176 Q0.9976,0.6188,0.9968,0.6226 Q0.9952,0.6284,0.9671,0.6284 L0.959,0.6284 L0.9526,0.6284 Q0.9486,0.6284,0.9382,0.6302 T0.9205,0.6321 L0.9173,0.6321 Q0.9133,0.6317,0.9092,0.6317 Q0.9012,0.6317,0.8715,0.6346 Q0.8233,0.6387,0.7944,0.6421 Q0.7888,0.6429,0.7831,0.6429 Q0.7783,0.6429,0.7731,0.6425 T0.7663,0.6421 L0.7622,0.6421 Q0.7614,0.6425,0.7586,0.6425 T0.7474,0.6421 T0.7349,0.6416 Q0.7261,0.6416,0.7221,0.6429 Q0.7173,0.645,0.7032,0.646 T0.6711,0.6479 T0.6482,0.6491 Q0.645,0.6495,0.6418,0.6495 Q0.6353,0.6495,0.6273,0.6474 T0.6161,0.6454 Q0.612,0.6454,0.6088,0.6477 T0.6,0.6499 Q0.5912,0.6499,0.5494,0.6578 Q0.5422,0.6591,0.5373,0.6591 Q0.5341,0.6591,0.5281,0.6584 T0.5173,0.6578 L0.5124,0.6578 Q0.5004,0.6582,0.4747,0.6632 Q0.4675,0.6649,0.4398,0.6667 T0.3851,0.6703 T0.3566,0.6719 Q0.3534,0.6723,0.3406,0.6734 T0.3141,0.6757 T0.2948,0.6773 Q0.2908,0.6781,0.2819,0.6829 T0.2618,0.6877 Q0.2482,0.6877,0.2273,0.6958 T0.1992,0.7117 Q0.1976,0.7138,0.1976,0.7155 Q0.1976,0.7188,0.2032,0.7213 T0.2181,0.7258 T0.2289,0.7292 Q0.2337,0.7308,0.2378,0.7316 L0.2458,0.7333 T0.2522,0.7345 Q0.2747,0.7399,0.2835,0.7399 Q0.29,0.7399,0.3048,0.7408 T0.3253,0.7416 Q0.3277,0.7416,0.3297,0.7414 T0.3341,0.7412 L0.3598,0.7445 Q0.3639,0.7449,0.3663,0.7449 Q0.3695,0.7449,0.3751,0.7443 T0.3855,0.7437 L0.3904,0.7437 Q0.3984,0.7441,0.4141,0.7472 T0.4353,0.7507 Q0.4434,0.752,0.4434,0.7553 Q0.4434,0.7578,0.439,0.7605 T0.4297,0.764 Q0.4257,0.7648,0.4201,0.7655 T0.4076,0.7665 T0.3984,0.7673 Q0.3968,0.7673,0.3912,0.7677 T0.3815,0.7688 T0.3735,0.771 T0.3655,0.7727 Q0.3606,0.7727,0.3534,0.7708 T0.3458,0.769 L0.3446,0.769 Q0.3414,0.769,0.3297,0.7713 T0.3149,0.7735 Q0.3092,0.7735,0.296,0.7771 T0.2771,0.7831 Q0.2683,0.7872,0.2554,0.7885 Q0.253,0.7889,0.2325,0.7897 T0.2032,0.7914 Q0.2008,0.7918,0.198,0.792 T0.194,0.7924 T0.1912,0.7928 T0.1888,0.793 T0.1867,0.7934 T0.1851,0.7943 T0.1843,0.7953 T0.1835,0.7968 T0.1823,0.7984 T0.1815,0.8001 Q0.1815,0.8022,0.1847,0.8032 T0.1932,0.8053 T0.2008,0.8071 Q0.2072,0.8092,0.2265,0.8092 Q0.2361,0.8092,0.2586,0.8088 L0.2635,0.8088 Q0.2731,0.8088,0.2795,0.8098 T0.2928,0.8134 T0.302,0.8167 Q0.306,0.8179,0.3277,0.8183 T0.3542,0.8221 Q0.359,0.8246,0.3622,0.8246 Q0.3639,0.8246,0.3675,0.8237 T0.3751,0.8229 Q0.3968,0.8229,0.4048,0.8275 Q0.4088,0.8291,0.4161,0.8291 Q0.4225,0.8291,0.4353,0.8275 Q0.4369,0.827,0.4394,0.827 Q0.4474,0.827,0.4675,0.8345 Q0.4707,0.8358,0.4739,0.8358 Q0.4755,0.8358,0.4799,0.8353 T0.4876,0.8349 Q0.494,0.8349,0.5012,0.8362 L0.5076,0.837 T0.5133,0.8376 T0.5181,0.8382 T0.5221,0.8391 L0.5253,0.8399 T0.5277,0.8409 L0.5293,0.8422 T0.5301,0.8438 L0.5301,0.8461 Q0.5301,0.8499,0.5249,0.8511 T0.5112,0.8526 T0.5004,0.8532 Q0.4964,0.854,0.4851,0.8546 T0.4667,0.8565 Q0.4578,0.8577,0.441,0.8577 L0.4345,0.8577 L0.4289,0.8577 L0.4209,0.8577 Q0.4153,0.8582,0.4088,0.8586 T0.3968,0.8592 T0.3855,0.8594 T0.3755,0.8596 T0.3675,0.86 T0.3622,0.8602 Q0.3317,0.8635,0.3237,0.8635 Q0.2996,0.8635,0.2996,0.8681 Q0.2996,0.8698,0.3032,0.8733 T0.3068,0.8797 L0.3068,0.8822 Q0.3052,0.8859,0.2859,0.8859 Q0.2787,0.8859,0.2739,0.8851 L0.2699,0.8851 Q0.2659,0.8851,0.259,0.888 T0.2498,0.8913 Q0.2394,0.8946,0.2056,0.8971 Q0.2032,0.8971,0.1928,0.9002 T0.1703,0.9034 Q0.1526,0.9034,0.1353,0.9067 T0.1173,0.915 L0.1173,0.9158 Q0.1173,0.9166,0.1177,0.9175 T0.1189,0.9191 T0.1205,0.9204 T0.1229,0.9212 T0.1257,0.922 T0.1285,0.9226 T0.1309,0.9231 T0.1337,0.9235 T0.1365,0.9237 L0.1446,0.9237 T0.1554,0.9243 T0.1614,0.9268 T0.1659,0.9293 T0.1743,0.9303 T0.1823,0.9316 Q0.1863,0.932,0.1912,0.9332 T0.2028,0.9361 T0.2153,0.939 Q0.2233,0.9411,0.2297,0.9448 T0.2386,0.9494 Q0.2426,0.9506,0.2506,0.9506 Q0.253,0.9506,0.2594,0.9504 T0.2699,0.9502 Q0.2763,0.9502,0.2819,0.9511 Q0.2851,0.9511,0.2871,0.9529 T0.2892,0.9573 Q0.2892,0.9627,0.2811,0.9635 Q0.2434,0.9652,0.2337,0.9672 Q0.2257,0.9693,0.2241,0.9693 Q0.2217,0.9693,0.2096,0.9689 L0.2056,0.9689 Q0.1976,0.9689,0.1924,0.9699 T0.1787,0.9741 L0.1647,0.9793 Q0.1518,0.983,0.1285,0.983 L0.1261,0.983 L0.1237,0.983 Q0.1124,0.983,0.1076,0.9838 Q0.102,0.9851,0.0839,0.9896 T0.0602,0.9954 T0.0406,0.9971 T0.0153,0.9979 L0.0032,0.9979 Z",type:0}},"":{type:5,data:{d:"M0.9992,0.998 Q0.9992,1,0.9968,1 Q0.9521,1,0.9392,0.998 Q0.9335,0.997,0.9152,0.9921 T0.8913,0.9862 Q0.8873,0.9852,0.8783,0.9852 L0.8747,0.9852 L0.871,0.9852 Q0.8483,0.9852,0.8345,0.9812 Q0.8289,0.9792,0.8228,0.9773 T0.8135,0.9743 T0.8054,0.9723 T0.7948,0.9713 L0.7908,0.9713 L0.777,0.9713 T0.7656,0.9693 Q0.7616,0.9683,0.7498,0.9674 T0.7283,0.9664 L0.7186,0.9654 Q0.708,0.9644,0.708,0.9575 Q0.708,0.9545,0.7109,0.952 T0.7178,0.9486 L0.7315,0.9486 L0.7417,0.9486 L0.7502,0.9486 Q0.7575,0.9486,0.7599,0.9476 Q0.7616,0.9466,0.7685,0.9426 T0.7843,0.9377 Q0.7899,0.9357,0.8009,0.9332 T0.8175,0.9298 Q0.82,0.9288,0.8228,0.9283 T0.8277,0.9278 T0.8313,0.9273 T0.8341,0.9263 T0.8362,0.9258 Q0.8402,0.9219,0.854,0.9219 L0.8569,0.9219 L0.8597,0.9219 L0.8637,0.9219 Q0.88,0.9199,0.88,0.9159 L0.88,0.9149 Q0.88,0.913,0.8719,0.911 T0.852,0.9075 T0.8297,0.906 Q0.8224,0.906,0.8167,0.905 T0.8074,0.9031 T0.8001,0.9006 T0.794,0.8991 Q0.7599,0.8971,0.7494,0.8942 Q0.7461,0.8932,0.7397,0.8902 T0.7299,0.8872 L0.7267,0.8872 Q0.721,0.8882,0.7121,0.8882 Q0.6926,0.8882,0.691,0.8833 L0.691,0.8803 Q0.691,0.8773,0.6922,0.8749 T0.6955,0.8704 L0.6975,0.8684 Q0.6926,0.8655,0.6764,0.8655 Q0.6683,0.8655,0.6375,0.8625 Q0.6358,0.8625,0.629,0.862 T0.6148,0.8615 T0.5973,0.861 T0.5791,0.8605 L0.5718,0.8605 L0.5661,0.8605 L0.5596,0.8605 Q0.5426,0.8605,0.5337,0.8586 Q0.5264,0.8576,0.515,0.8571 T0.4996,0.8556 Q0.498,0.8556,0.4947,0.8551 T0.4882,0.8546 T0.4809,0.8541 T0.474,0.8531 T0.4692,0.8506 T0.4672,0.8467 Q0.4672,0.8437,0.468,0.8422 T0.4704,0.8398 T0.4736,0.8383 T0.4781,0.8368 T0.4838,0.8358 T0.4911,0.8353 T0.4988,0.8338 Q0.5069,0.8328,0.5142,0.8328 Q0.5174,0.8328,0.5215,0.8333 T0.5264,0.8338 Q0.5296,0.8338,0.532,0.8328 Q0.5523,0.8249,0.5604,0.8249 L0.5653,0.8249 Q0.5775,0.8269,0.5848,0.8269 Q0.5912,0.8269,0.5937,0.8259 Q0.6026,0.821,0.6253,0.821 Q0.6294,0.821,0.6334,0.822 T0.6383,0.8229 Q0.6399,0.8229,0.644,0.82 Q0.6504,0.817,0.6723,0.816 T0.6975,0.814 Q0.6999,0.814,0.7048,0.8121 T0.7129,0.8091 T0.7226,0.8071 T0.7372,0.8061 L0.7421,0.8061 Q0.7624,0.8071,0.7721,0.8071 Q0.7924,0.8071,0.7981,0.8051 Q0.8021,0.8032,0.807,0.8027 T0.8135,0.8017 T0.8151,0.8002 L0.8151,0.7992 Q0.8143,0.7962,0.8127,0.7957 T0.8045,0.7943 Q0.7997,0.7943,0.7964,0.7933 Q0.7883,0.7933,0.7676,0.7923 T0.7437,0.7903 Q0.7307,0.7893,0.7218,0.7844 Q0.7194,0.7834,0.7141,0.7819 L0.7036,0.7789 T0.693,0.7765 T0.6853,0.7755 Q0.6805,0.7755,0.6691,0.773 T0.6553,0.7705 Q0.6545,0.7705,0.6545,0.7715 Q0.6537,0.7715,0.65,0.7725 T0.6423,0.774 T0.635,0.7745 Q0.6294,0.7745,0.6257,0.773 T0.618,0.771 T0.6083,0.77 T0.601,0.7695 Q0.5985,0.7695,0.5921,0.769 T0.5795,0.7676 T0.5702,0.7666 Q0.5653,0.7656,0.5596,0.7616 T0.5539,0.7547 Q0.5539,0.7498,0.5645,0.7488 Q0.5693,0.7478,0.5852,0.7448 T0.6099,0.7418 L0.6148,0.7418 Q0.6196,0.7418,0.6253,0.7423 T0.6338,0.7428 L0.6399,0.7428 Q0.6431,0.7418,0.6488,0.7409 T0.6586,0.7394 T0.6659,0.7389 L0.6707,0.7389 Q0.6723,0.7399,0.6748,0.7399 Q0.6796,0.7399,0.6946,0.7389 T0.7161,0.7379 Q0.7251,0.7379,0.7478,0.7319 Q0.7494,0.7319,0.7539,0.7315 T0.762,0.73 T0.7697,0.727 T0.7818,0.723 T0.7948,0.7196 T0.7997,0.7151 Q0.7997,0.7141,0.7989,0.7132 Q0.7924,0.7062,0.7717,0.6978 T0.738,0.6894 Q0.7267,0.6894,0.717,0.6845 T0.7048,0.6795 Q0.6975,0.6785,0.6711,0.6766 T0.6431,0.6746 Q0.6415,0.6736,0.6144,0.6721 T0.5596,0.6686 T0.5247,0.6657 Q0.4996,0.6607,0.4874,0.6597 L0.4834,0.6597 Q0.4785,0.6597,0.4724,0.6607 T0.4631,0.6617 Q0.4574,0.6617,0.4501,0.6597 Q0.4088,0.6518,0.4006,0.6518 Q0.3933,0.6518,0.3901,0.6499 T0.3844,0.6479 T0.3739,0.6499 T0.3585,0.6518 L0.352,0.6518 Q0.3471,0.6508,0.335,0.6503 T0.3122,0.6494 T0.2912,0.6479 T0.2766,0.6449 Q0.2733,0.6439,0.2668,0.6439 Q0.2628,0.6439,0.2543,0.6444 T0.2425,0.6449 T0.2368,0.6439 L0.2344,0.6439 Q0.2336,0.6439,0.2283,0.6444 T0.2182,0.6449 Q0.2117,0.6449,0.2052,0.6439 Q0.1768,0.6409,0.1281,0.637 Q0.0989,0.634,0.0916,0.634 L0.0835,0.634 L0.0795,0.634 Q0.0722,0.634,0.0616,0.632 T0.0479,0.6301 Q0.0462,0.6301,0.0406,0.6306 T0.0308,0.6311 Q0.0032,0.6311,0.0008,0.6231 Q0,0.6202,0,0.6182 Q0,0.6083,0.0227,0.6083 Q0.03,0.6073,0.0422,0.6073 Q0.0487,0.6073,0.0608,0.6078 T0.0787,0.6083 Q0.0973,0.6083,0.103,0.6073 Q0.1062,0.6063,0.1131,0.6053 T0.1253,0.6039 T0.1375,0.6024 T0.1492,0.6014 L0.1533,0.6014 Q0.1598,0.6024,0.1723,0.6044 T0.189,0.6063 Q0.1906,0.6063,0.1922,0.6053 Q0.2214,0.6004,0.236,0.6004 Q0.2409,0.6004,0.2551,0.6009 T0.2741,0.6014 Q0.2782,0.6014,0.2859,0.6024 T0.2968,0.6034 Q0.3009,0.6034,0.3041,0.6024 Q0.3277,0.5905,0.356,0.5905 L0.3613,0.5905 L0.3666,0.5905 Q0.3731,0.5905,0.3755,0.5895 Q0.382,0.5856,0.3844,0.5846 T0.3938,0.5831 T0.4144,0.5826 T0.4428,0.5801 T0.4631,0.5776 L0.4663,0.5776 Q0.4704,0.5776,0.4785,0.5786 T0.4899,0.5796 Q0.4964,0.5796,0.5012,0.5767 Q0.5069,0.5737,0.5223,0.5737 Q0.5272,0.5737,0.5369,0.5742 T0.5499,0.5747 Q0.558,0.5747,0.5612,0.5737 Q0.5661,0.5717,0.5714,0.5712 T0.5835,0.5702 T0.5945,0.5692 T0.6018,0.5687 L0.6062,0.5687 T0.6095,0.5682 T0.6148,0.5678 Q0.6172,0.5668,0.6196,0.5653 T0.6245,0.5633 T0.631,0.5628 T0.6407,0.5638 T0.6504,0.5648 T0.6594,0.5638 T0.6675,0.5628 L0.6707,0.5628 L0.6861,0.5628 Q0.7364,0.5628,0.7494,0.5608 L0.7567,0.5608 L0.7652,0.5608 L0.7729,0.5608 Q0.7794,0.5608,0.7818,0.5589 Q0.7851,0.5569,0.7859,0.5559 Q0.7835,0.5539,0.7656,0.5519 Q0.7121,0.547,0.6975,0.543 Q0.6934,0.541,0.6853,0.5396 L0.6691,0.5366 T0.6525,0.5336 T0.6391,0.5312 Q0.6367,0.5302,0.6245,0.5257 T0.6034,0.5213 L0.5977,0.5213 Q0.5945,0.5223,0.5904,0.5223 Q0.5839,0.5223,0.5787,0.5208 T0.5685,0.5183 T0.5596,0.5173 Q0.558,0.5173,0.5552,0.5168 T0.5495,0.5163 L0.5434,0.5163 T0.5373,0.5158 T0.532,0.5148 T0.5284,0.5129 T0.5272,0.5104 L0.5272,0.5074 Q0.5304,0.5015,0.5377,0.499 T0.5629,0.4965 Q0.5734,0.4955,0.5811,0.4946 T0.5953,0.4916 T0.605,0.4896 Q0.6083,0.4886,0.6123,0.4886 Q0.6148,0.4886,0.6225,0.4891 T0.635,0.4896 L0.6456,0.4896 Q0.6837,0.4857,0.6861,0.4857 Q0.7226,0.4768,0.7283,0.4768 Q0.7307,0.4768,0.732,0.4773 T0.7372,0.4777 Q0.7502,0.4777,0.7721,0.4758 Q0.7753,0.4748,0.777,0.4738 Q0.7745,0.4718,0.768,0.4708 Q0.7599,0.4688,0.7445,0.4688 Q0.7405,0.4688,0.7324,0.4693 T0.721,0.4698 Q0.7056,0.4698,0.6999,0.4679 Q0.6861,0.4629,0.6626,0.4619 Q0.6586,0.4609,0.6533,0.4604 T0.6419,0.459 T0.6314,0.456 T0.6269,0.452 Q0.6269,0.451,0.6302,0.4491 Q0.6358,0.4451,0.6525,0.4416 T0.6788,0.4382 L0.6845,0.4382 L0.6902,0.4382 Q0.7064,0.4382,0.7145,0.4362 Q0.7202,0.4342,0.7307,0.4342 L0.7356,0.4342 L0.7409,0.4342 L0.7453,0.4342 Q0.7543,0.4342,0.7607,0.4332 Q0.7778,0.4313,0.7847,0.4288 T0.7932,0.4248 T0.7972,0.4169 T0.8045,0.4045 L0.8094,0.3986 T0.8135,0.3942 L0.8167,0.3912 T0.8191,0.3887 T0.8204,0.3867 T0.8208,0.3848 Q0.8208,0.3818,0.8167,0.3739 Q0.8127,0.3689,0.8054,0.3635 T0.7924,0.3556 T0.7778,0.3497 T0.768,0.3462 Q0.764,0.3442,0.7478,0.3427 T0.7267,0.3383 Q0.7234,0.3363,0.7044,0.3348 T0.6805,0.3323 L0.6764,0.3323 T0.6679,0.3328 T0.6586,0.3333 Q0.6521,0.3333,0.648,0.3314 Q0.6391,0.3264,0.6294,0.3264 Q0.6229,0.3264,0.6156,0.3294 Q0.6115,0.3304,0.6042,0.3304 Q0.5977,0.3304,0.5888,0.3289 T0.5738,0.3264 T0.5584,0.3225 L0.5491,0.3195 Q0.5418,0.3185,0.5162,0.3155 T0.4895,0.3121 T0.4826,0.3116 T0.4716,0.3111 T0.4607,0.3096 T0.4513,0.3066 T0.4477,0.3017 Q0.4477,0.2997,0.4485,0.2977 Q0.4526,0.2898,0.4611,0.2878 T0.4842,0.2859 Q0.4882,0.2859,0.4943,0.2864 T0.5028,0.2868 Q0.5118,0.2868,0.5215,0.2829 Q0.5401,0.276,0.5734,0.276 Q0.5831,0.276,0.5872,0.277 L0.5904,0.277 T0.5949,0.2745 T0.6034,0.272 Q0.631,0.269,0.6407,0.2661 Q0.6448,0.2641,0.6488,0.2641 T0.6573,0.2656 T0.6634,0.2671 Q0.6659,0.2671,0.6675,0.2651 Q0.6723,0.2601,0.6886,0.2552 T0.7137,0.2502 L0.7153,0.2502 L0.7178,0.2502 Q0.7218,0.2502,0.7279,0.2493 T0.7417,0.2468 T0.7526,0.2453 Q0.8208,0.2354,0.8281,0.2354 Q0.8337,0.2354,0.8394,0.2344 T0.8496,0.2315 T0.854,0.2265 Q0.854,0.2216,0.8443,0.2176 Q0.8354,0.2127,0.8216,0.2102 T0.7972,0.2072 T0.777,0.2067 T0.7648,0.2057 Q0.7632,0.2047,0.7498,0.2038 T0.7202,0.2018 T0.6983,0.1998 Q0.6918,0.1998,0.676,0.1949 T0.6537,0.1899 Q0.6496,0.1899,0.6472,0.1919 Q0.6342,0.1968,0.6123,0.1968 Q0.5961,0.1968,0.5912,0.1929 Q0.5904,0.1919,0.5892,0.1919 T0.5823,0.1944 T0.5722,0.1968 T0.5637,0.1949 Q0.5556,0.1909,0.5158,0.1869 Q0.5109,0.1869,0.5032,0.1835 T0.4915,0.18 Q0.4907,0.18,0.4891,0.181 Q0.4793,0.182,0.455,0.182 Q0.4177,0.182,0.4015,0.1771 Q0.3901,0.1741,0.3779,0.1741 Q0.3747,0.1741,0.369,0.1746 T0.3609,0.1751 Q0.3569,0.1751,0.3536,0.1741 Q0.3512,0.1741,0.3459,0.1736 T0.3358,0.1726 T0.3256,0.1716 T0.3167,0.1696 T0.3106,0.1662 Q0.3082,0.1632,0.3082,0.1592 Q0.3082,0.1543,0.3114,0.1508 T0.3204,0.1474 L0.3236,0.1474 Q0.3301,0.1494,0.3333,0.1494 Q0.339,0.1494,0.3496,0.1454 Q0.3674,0.1385,0.3869,0.1385 Q0.395,0.1385,0.4011,0.137 T0.4116,0.1355 T0.4197,0.1375 T0.425,0.1395 Q0.429,0.1395,0.4355,0.1365 Q0.4631,0.1266,0.4882,0.1266 Q0.5126,0.1266,0.5337,0.1246 Q0.5369,0.1246,0.5458,0.1207 T0.5661,0.1167 L0.5693,0.1167 Q0.5791,0.1177,0.5852,0.1187 T0.5921,0.1197 Q0.5945,0.1197,0.6002,0.1167 Q0.6026,0.1147,0.605,0.1123 T0.6091,0.1093 T0.6156,0.1088 T0.6318,0.1098 Q0.6456,0.1108,0.6569,0.1137 T0.6707,0.1167 Q0.674,0.1167,0.6772,0.1147 Q0.6821,0.1108,0.6946,0.1083 T0.721,0.1044 T0.7453,0.1029 L0.7526,0.1029 Q0.7583,0.1039,0.7652,0.1053 T0.7753,0.1068 Q0.7778,0.1068,0.7802,0.1058 Q0.7981,0.1019,0.8143,0.1019 Q0.8175,0.1019,0.8439,0.0964 T0.8735,0.091 Q0.8759,0.091,0.8836,0.089 T0.8938,0.0851 Q0.8929,0.0841,0.8905,0.0841 Q0.8832,0.0821,0.8735,0.0821 Q0.8694,0.0821,0.8629,0.0826 T0.854,0.0831 Q0.8508,0.0831,0.8491,0.0821 Q0.8475,0.0821,0.8171,0.0811 T0.7802,0.0781 T0.7571,0.0737 T0.7332,0.0712 Q0.7299,0.0712,0.7247,0.0717 T0.7161,0.0722 L0.7064,0.0722 Q0.7032,0.0712,0.7003,0.0707 T0.6959,0.0692 T0.693,0.0678 T0.6914,0.0663 T0.6902,0.0648 T0.689,0.0643 L0.6869,0.0643 L0.6845,0.0643 L0.6821,0.0643 Q0.6553,0.0643,0.6553,0.0554 T0.6796,0.0465 L0.6813,0.0465 L0.6845,0.0465 Q0.6918,0.0425,0.717,0.0376 Q0.7226,0.0366,0.7267,0.0356 T0.7324,0.0336 T0.7376,0.0317 T0.747,0.0297 Q0.7518,0.0287,0.7551,0.0287 T0.762,0.0297 T0.768,0.0307 L0.7729,0.0307 Q0.7802,0.0277,0.7997,0.0267 T0.8224,0.0237 Q0.8273,0.0227,0.8341,0.0223 T0.8475,0.0193 T0.8654,0.0143 T0.8873,0.0079 Q0.9002,0.003,0.9331,0.004 T0.97,0.004 Q0.9838,0,0.9976,0.001 Q1,0.001,1,0.003 Z M0.9935,0.996 L0.9951,0.0049 Q0.9822,0.0049,0.9716,0.0079 Q0.9659,0.0099,0.9327,0.0089 T0.8897,0.0119 Q0.8775,0.0158,0.8666,0.0183 T0.85,0.0237 Q0.8418,0.0267,0.8341,0.0272 T0.8248,0.0277 Q0.82,0.0297,0.8001,0.0312 T0.7745,0.0346 Q0.7697,0.0356,0.7664,0.0356 Q0.764,0.0356,0.7603,0.0341 T0.7534,0.0326 Q0.751,0.0326,0.7478,0.0336 Q0.7429,0.0346,0.7397,0.0356 T0.7344,0.0376 T0.7283,0.0401 T0.7178,0.0425 Q0.6926,0.0465,0.6878,0.0495 Q0.6845,0.0514,0.6764,0.0514 L0.6723,0.0514 L0.6691,0.0514 Q0.6602,0.0514,0.6602,0.0554 Q0.6602,0.0574,0.6659,0.0579 T0.6796,0.0589 T0.691,0.0603 T0.6967,0.0643 T0.7072,0.0673 Q0.7121,0.0682,0.7153,0.0682 T0.7238,0.0678 T0.7332,0.0673 Q0.7413,0.0673,0.7579,0.0692 T0.7818,0.0742 Q0.7867,0.0752,0.8171,0.0762 T0.8508,0.0781 L0.852,0.0781 T0.8601,0.0776 T0.8719,0.0772 Q0.8832,0.0772,0.8921,0.0791 Q0.8994,0.0811,0.8994,0.0841 T0.8933,0.0895 T0.8812,0.094 T0.8735,0.0959 T0.8451,0.1014 T0.8143,0.1068 Q0.7989,0.1068,0.7818,0.1098 Q0.7778,0.1108,0.7745,0.1108 T0.768,0.1103 T0.7603,0.1088 T0.7518,0.1068 L0.7461,0.1068 Q0.7315,0.1068,0.7088,0.1103 T0.6805,0.1177 Q0.6756,0.1207,0.6699,0.1207 Q0.6667,0.1207,0.6545,0.1177 T0.631,0.1147 Q0.6269,0.1137,0.6225,0.1133 T0.616,0.1128 L0.6123,0.1128 T0.6103,0.1133 L0.6083,0.1157 T0.6034,0.1197 Q0.5961,0.1246,0.5921,0.1246 Q0.5904,0.1246,0.5835,0.1231 T0.5693,0.1217 L0.5661,0.1217 Q0.558,0.1217,0.5535,0.1231 T0.5446,0.1266 T0.5345,0.1296 Q0.5126,0.1316,0.4882,0.1316 T0.438,0.1405 Q0.4298,0.1434,0.425,0.1434 Q0.4209,0.1434,0.4173,0.1419 T0.4112,0.1405 T0.4027,0.1419 T0.3869,0.1434 Q0.3682,0.1434,0.3512,0.1494 Q0.3398,0.1533,0.3333,0.1533 Q0.3285,0.1533,0.3228,0.1513 L0.3212,0.1513 Q0.3179,0.1513,0.3155,0.1538 T0.3131,0.1592 Q0.3131,0.1612,0.3147,0.1632 Q0.3171,0.1652,0.3232,0.1667 T0.3406,0.1691 T0.3544,0.1701 L0.3601,0.1701 L0.3678,0.1701 L0.3771,0.1701 Q0.3909,0.1701,0.4031,0.1731 Q0.4177,0.178,0.4558,0.178 Q0.4793,0.178,0.4882,0.1761 L0.4915,0.1761 Q0.498,0.1761,0.5061,0.179 T0.5158,0.183 Q0.5166,0.183,0.5231,0.1835 T0.5341,0.1845 T0.545,0.1855 T0.5572,0.1874 T0.5661,0.1909 Q0.5677,0.1919,0.5702,0.1919 T0.5791,0.1894 T0.588,0.1869 Q0.5921,0.1869,0.5945,0.1899 Q0.5977,0.1919,0.6123,0.1919 Q0.6334,0.1919,0.6448,0.1879 Q0.6488,0.186,0.6537,0.186 Q0.6626,0.186,0.6784,0.1909 T0.6983,0.1958 Q0.704,0.1968,0.7206,0.1973 T0.7506,0.1993 T0.7689,0.2018 L0.7705,0.2018 L0.7741,0.2018 L0.7786,0.2018 Q0.8248,0.2018,0.8475,0.2136 Q0.8597,0.2196,0.8597,0.2255 T0.8483,0.2359 T0.8281,0.2404 Q0.8208,0.2404,0.7534,0.2493 Q0.7502,0.2502,0.7425,0.2512 T0.7287,0.2532 T0.7178,0.2542 L0.7153,0.2542 L0.7137,0.2542 Q0.7064,0.2542,0.6906,0.2591 T0.6715,0.2681 T0.6626,0.272 Q0.6594,0.272,0.6541,0.2705 T0.6464,0.269 T0.6431,0.27 Q0.6318,0.273,0.6034,0.276 Q0.6018,0.276,0.5998,0.2774 T0.5957,0.2799 T0.5904,0.2809 L0.5856,0.2809 Q0.5823,0.2799,0.575,0.2799 Q0.541,0.2799,0.5239,0.2868 Q0.5134,0.2908,0.5028,0.2908 Q0.4996,0.2908,0.4935,0.2903 T0.4842,0.2898 Q0.4704,0.2898,0.4635,0.2918 T0.4534,0.2997 L0.4534,0.3007 Q0.4534,0.3037,0.459,0.3046 T0.4753,0.3066 T0.4899,0.3076 Q0.4907,0.3076,0.5166,0.3106 T0.5507,0.3155 Q0.5921,0.3264,0.605,0.3264 Q0.6107,0.3264,0.6131,0.3254 Q0.6212,0.3225,0.6294,0.3225 Q0.6407,0.3225,0.6513,0.3274 Q0.6529,0.3294,0.6569,0.3294 Q0.6594,0.3294,0.665,0.3284 T0.6748,0.3274 T0.6821,0.3284 Q0.6861,0.3294,0.6967,0.3299 T0.7165,0.3314 T0.7299,0.3343 Q0.7324,0.3363,0.7486,0.3383 T0.7697,0.3422 Q0.7713,0.3432,0.7774,0.3452 T0.7887,0.3492 T0.8005,0.3546 T0.8127,0.3625 T0.8208,0.3719 Q0.8256,0.3798,0.8256,0.3848 Q0.8256,0.3877,0.8236,0.3902 T0.8171,0.3976 T0.809,0.4075 T0.8021,0.4189 T0.7968,0.4273 T0.7867,0.4322 T0.7616,0.4382 Q0.7543,0.4392,0.7437,0.4392 L0.7364,0.4392 L0.7299,0.4392 Q0.7202,0.4392,0.7161,0.4402 Q0.7072,0.4431,0.691,0.4431 L0.6845,0.4431 L0.6788,0.4431 Q0.6707,0.4431,0.6545,0.4461 T0.6334,0.452 Q0.6399,0.456,0.6626,0.457 Q0.6878,0.458,0.7024,0.4639 Q0.7064,0.4649,0.7186,0.4649 L0.7295,0.4649 L0.7413,0.4649 Q0.7591,0.4649,0.7697,0.4669 Q0.7818,0.4688,0.7818,0.4728 Q0.7818,0.4748,0.7798,0.4763 T0.7753,0.4787 L0.7737,0.4797 L0.7729,0.4797 Q0.7494,0.4827,0.7388,0.4827 Q0.7332,0.4827,0.7307,0.4817 L0.7291,0.4817 Q0.7226,0.4817,0.6878,0.4896 Q0.6829,0.4906,0.6772,0.4911 T0.6618,0.4921 T0.646,0.4931 T0.6342,0.4936 T0.6212,0.4931 T0.6115,0.4926 Q0.6083,0.4926,0.6058,0.4931 T0.5969,0.4955 T0.5819,0.499 T0.5629,0.5005 Q0.5572,0.5005,0.5527,0.501 T0.545,0.502 T0.5397,0.503 T0.5361,0.5045 T0.5337,0.5064 T0.5328,0.5094 L0.532,0.5094 Q0.532,0.5104,0.5337,0.5109 T0.5381,0.5114 T0.5438,0.5119 T0.5515,0.5124 L0.5604,0.5124 Q0.5661,0.5134,0.5746,0.5153 T0.5912,0.5173 L0.5977,0.5173 L0.6026,0.5173 Q0.6139,0.5173,0.6273,0.5218 T0.6407,0.5272 Q0.6448,0.5282,0.6683,0.5321 T0.6991,0.5381 Q0.7137,0.543,0.7664,0.548 Q0.7908,0.55,0.7908,0.5559 Q0.7908,0.5589,0.7859,0.5628 Q0.781,0.5658,0.7713,0.5658 Q0.7689,0.5658,0.7628,0.5653 T0.7543,0.5648 T0.7502,0.5658 Q0.7364,0.5678,0.6878,0.5678 Q0.674,0.5678,0.6699,0.5668 L0.6683,0.5668 Q0.6659,0.5668,0.6606,0.5678 T0.6513,0.5687 Q0.6464,0.5687,0.6391,0.5678 Q0.6334,0.5668,0.6302,0.5668 T0.6241,0.5687 T0.6164,0.5717 Q0.6123,0.5727,0.6099,0.5727 L0.6062,0.5727 T0.6022,0.5732 T0.5953,0.5737 Q0.5904,0.5747,0.5839,0.5747 T0.5726,0.5752 T0.5629,0.5776 T0.5458,0.5796 Q0.5418,0.5796,0.5324,0.5791 T0.5191,0.5786 Q0.5077,0.5786,0.5045,0.5806 Q0.498,0.5836,0.4899,0.5836 Q0.4858,0.5836,0.4777,0.5826 T0.4655,0.5816 L0.4631,0.5816 Q0.4582,0.5816,0.4436,0.5841 T0.4144,0.5865 L0.4051,0.5865 L0.3986,0.5865 T0.3933,0.587 T0.3897,0.5875 T0.3869,0.5885 T0.3844,0.5895 T0.3812,0.591 T0.3779,0.5925 Q0.3739,0.5955,0.3633,0.5955 L0.3585,0.5955 L0.3536,0.5955 Q0.3277,0.5955,0.3066,0.6053 Q0.3017,0.6083,0.296,0.6083 Q0.2912,0.6083,0.2839,0.6068 T0.2741,0.6053 Q0.2693,0.6053,0.2547,0.6048 T0.236,0.6044 Q0.2222,0.6044,0.193,0.6103 L0.1882,0.6103 Q0.1825,0.6103,0.1703,0.6083 T0.1525,0.6063 L0.15,0.6063 Q0.1436,0.6063,0.135,0.6073 T0.1168,0.6098 T0.1038,0.6113 Q0.0973,0.6123,0.0787,0.6123 L0.06,0.6123 L0.0414,0.6123 L0.0235,0.6123 Q0.0049,0.6133,0.0049,0.6172 L0.0057,0.6222 Q0.0073,0.6261,0.043,0.6261 L0.0454,0.6261 L0.0479,0.6261 Q0.0527,0.6261,0.0633,0.6281 T0.0803,0.6301 L0.0835,0.6301 L0.0916,0.6301 Q0.0998,0.6301,0.129,0.632 Q0.1768,0.636,0.206,0.64 Q0.2117,0.6409,0.2165,0.6409 Q0.2206,0.6409,0.2263,0.6405 T0.2336,0.64 L0.2384,0.64 L0.2409,0.64 T0.251,0.6395 T0.2644,0.639 Q0.2741,0.639,0.279,0.6409 Q0.283,0.6429,0.2972,0.6439 T0.3293,0.6459 T0.3528,0.6469 L0.3577,0.6469 Q0.3642,0.6469,0.3723,0.6449 T0.3844,0.6429 Q0.3901,0.6429,0.3933,0.6454 T0.4006,0.6479 Q0.4088,0.6479,0.4517,0.6558 Q0.4582,0.6568,0.4623,0.6568 Q0.4655,0.6568,0.4716,0.6563 T0.4826,0.6558 L0.4882,0.6558 Q0.5004,0.6558,0.5255,0.6607 Q0.5328,0.6627,0.5604,0.6647 T0.6152,0.6682 T0.644,0.6696 T0.6719,0.6721 T0.7056,0.6756 Q0.7113,0.6756,0.7198,0.6805 T0.738,0.6855 Q0.7453,0.6855,0.7551,0.6879 T0.7741,0.6939 T0.7912,0.7018 T0.8029,0.7102 Q0.8054,0.7132,0.8054,0.7151 Q0.8054,0.7191,0.8009,0.7216 T0.7908,0.7255 T0.779,0.7285 T0.7721,0.731 Q0.7672,0.7329,0.7632,0.7339 T0.7551,0.7354 T0.7486,0.7369 Q0.7478,0.7369,0.7445,0.7379 T0.7388,0.7394 T0.7324,0.7404 L0.7242,0.7413 T0.7161,0.7418 Q0.7105,0.7418,0.6955,0.7428 T0.6748,0.7438 L0.6699,0.7438 L0.6667,0.7438 Q0.6659,0.7438,0.6407,0.7468 Q0.6367,0.7478,0.6334,0.7478 T0.6245,0.7468 T0.6148,0.7458 L0.6099,0.7458 Q0.6018,0.7468,0.5864,0.7498 T0.5653,0.7532 T0.5596,0.7557 Q0.5596,0.7596,0.571,0.7616 Q0.5742,0.7626,0.5803,0.7631 T0.5929,0.7641 T0.6018,0.7656 L0.6087,0.7656 T0.6192,0.7666 T0.6277,0.7695 Q0.631,0.7705,0.6342,0.7705 Q0.6383,0.7705,0.6452,0.7685 T0.6537,0.7666 L0.6553,0.7666 Q0.6602,0.7666,0.6711,0.769 T0.6853,0.7715 Q0.691,0.7715,0.7048,0.775 T0.7242,0.7814 Q0.7324,0.7854,0.7445,0.7864 Q0.7478,0.7864,0.768,0.7873 T0.7972,0.7893 Q0.7989,0.7893,0.8017,0.7898 T0.8054,0.7903 L0.8082,0.7903 T0.811,0.7908 T0.8131,0.7913 T0.8151,0.7918 L0.8167,0.7928 T0.8179,0.7943 T0.8191,0.7957 T0.8204,0.7977 T0.8208,0.8002 Q0.8208,0.8032,0.8171,0.8051 T0.8074,0.8081 T0.7997,0.8091 Q0.7932,0.8121,0.7737,0.8121 Q0.7664,0.8121,0.7413,0.8111 L0.7364,0.8111 Q0.7275,0.8111,0.7214,0.8121 T0.7084,0.8155 T0.6991,0.819 Q0.6934,0.82,0.6723,0.8205 T0.6472,0.8239 Q0.6423,0.8269,0.6375,0.8269 Q0.6358,0.8269,0.6338,0.8264 T0.6294,0.8254 T0.6253,0.8249 Q0.6042,0.8249,0.5961,0.8289 Q0.5921,0.8318,0.5839,0.8318 Q0.5783,0.8318,0.5645,0.8299 L0.5604,0.8299 Q0.5531,0.8299,0.5337,0.8368 Q0.5296,0.8378,0.5255,0.8378 Q0.5239,0.8378,0.5195,0.8373 T0.5118,0.8368 Q0.5061,0.8368,0.4996,0.8388 Q0.4947,0.8388,0.4882,0.8398 Q0.4777,0.8417,0.4753,0.8427 T0.4728,0.8467 Q0.4728,0.8487,0.4769,0.8492 T0.4886,0.8501 T0.5004,0.8516 Q0.5036,0.8516,0.515,0.8521 T0.5345,0.8546 Q0.5426,0.8556,0.5596,0.8556 L0.5649,0.8556 L0.5702,0.8556 L0.5791,0.8556 Q0.5921,0.8566,0.6135,0.8571 T0.6383,0.8586 Q0.6683,0.8615,0.6764,0.8615 L0.6776,0.8615 L0.6788,0.8615 Q0.7032,0.8615,0.7032,0.8684 Q0.7032,0.8714,0.6995,0.8749 T0.6959,0.8803 L0.6959,0.8813 Q0.6991,0.8843,0.7153,0.8843 Q0.7218,0.8843,0.7259,0.8833 L0.7299,0.8833 Q0.7324,0.8833,0.7348,0.8838 T0.7393,0.8848 T0.7433,0.8863 L0.7474,0.8882 T0.751,0.8892 Q0.7616,0.8922,0.7948,0.8952 Q0.7981,0.8952,0.8082,0.8981 T0.8297,0.9011 T0.8528,0.9026 T0.8747,0.907 T0.8856,0.9149 L0.8856,0.9159 Q0.8856,0.9179,0.8848,0.9189 T0.8828,0.9209 T0.88,0.9228 T0.8767,0.9243 T0.8731,0.9248 T0.8698,0.9253 T0.8666,0.9258 L0.8646,0.9258 Q0.8621,0.9258,0.8577,0.9263 T0.85,0.9268 T0.8439,0.9273 T0.8402,0.9278 Q0.8386,0.9298,0.8358,0.9308 T0.8305,0.9322 T0.8244,0.9332 T0.8183,0.9337 Q0.8135,0.9347,0.8025,0.9372 T0.7859,0.9416 Q0.7778,0.9436,0.7717,0.9471 T0.7624,0.9515 Q0.7575,0.9535,0.7486,0.9535 Q0.7461,0.9535,0.7397,0.953 T0.7291,0.9525 Q0.7234,0.9525,0.7186,0.953 T0.7137,0.957 T0.7194,0.9614 Q0.7567,0.9634,0.7664,0.9654 Q0.7745,0.9674,0.7762,0.9674 L0.7908,0.9674 Q0.7924,0.9664,0.7948,0.9664 Q0.8029,0.9664,0.8082,0.9679 T0.8224,0.9723 T0.8362,0.9773 Q0.8483,0.9812,0.871,0.9812 L0.8751,0.9812 Q0.8873,0.9812,0.8929,0.9822 T0.9165,0.9876 T0.9408,0.9931 Q0.9513,0.996,0.9935,0.996 Z M0.9968,0.998 L0.9976,0.003 Q0.9838,0.002,0.9708,0.0059 Q0.9659,0.0069,0.9327,0.0059 T0.8881,0.0099 Q0.8767,0.0138,0.8658,0.0163 T0.8491,0.0218 Q0.8418,0.0247,0.8341,0.0247 T0.8232,0.0257 Q0.8191,0.0277,0.7997,0.0292 T0.7737,0.0326 Q0.7697,0.0336,0.7672,0.0336 T0.7612,0.0321 T0.7543,0.0307 T0.747,0.0317 Q0.7397,0.0326,0.7336,0.0356 T0.717,0.0406 Q0.6918,0.0445,0.6861,0.0475 Q0.6845,0.0485,0.6772,0.0485 T0.6638,0.05 T0.6577,0.0549 T0.6642,0.0598 T0.6796,0.0613 T0.6902,0.0623 Q0.691,0.0623,0.6946,0.0658 T0.7064,0.0702 L0.7161,0.0702 Q0.7194,0.0702,0.7242,0.0697 T0.7332,0.0692 Q0.7413,0.0692,0.7579,0.0717 T0.781,0.0762 Q0.7867,0.0781,0.8171,0.0786 T0.85,0.0801 L0.8532,0.0801 Q0.8548,0.0801,0.8613,0.0796 T0.8727,0.0791 Q0.8832,0.0791,0.8913,0.0811 Q0.897,0.0831,0.897,0.0851 Q0.897,0.088,0.8873,0.0905 T0.8735,0.093 Q0.871,0.093,0.8447,0.0984 T0.8143,0.1039 Q0.7981,0.1039,0.781,0.1078 Q0.7778,0.1088,0.7745,0.1088 T0.7644,0.1073 T0.7518,0.1048 L0.7453,0.1048 Q0.7299,0.1048,0.7076,0.1083 T0.6788,0.1157 Q0.6748,0.1187,0.6699,0.1187 Q0.6675,0.1187,0.6557,0.1157 T0.6318,0.1118 Q0.6164,0.1108,0.6135,0.1108 T0.6095,0.1113 T0.6067,0.1142 T0.6018,0.1187 Q0.5953,0.1227,0.5921,0.1227 Q0.5904,0.1227,0.5839,0.1212 T0.5693,0.1187 L0.5661,0.1187 Q0.558,0.1187,0.5527,0.1207 T0.5434,0.1246 T0.5337,0.1266 Q0.5126,0.1296,0.4882,0.1296 T0.4371,0.1385 Q0.4298,0.1414,0.425,0.1414 Q0.4225,0.1414,0.4189,0.1395 T0.4112,0.1375 Q0.4079,0.1375,0.4019,0.1395 T0.3869,0.1414 Q0.3682,0.1414,0.3504,0.1474 Q0.3398,0.1513,0.3333,0.1513 Q0.3293,0.1513,0.3228,0.1494 L0.3204,0.1494 Q0.3179,0.1494,0.3155,0.1508 T0.3118,0.1543 T0.3106,0.1592 T0.3127,0.1642 T0.32,0.1677 T0.3305,0.1701 T0.3435,0.1716 T0.3544,0.1721 Q0.3569,0.1731,0.3601,0.1731 Q0.3625,0.1731,0.3686,0.1726 T0.3779,0.1721 Q0.3901,0.1721,0.4023,0.1751 Q0.4177,0.18,0.455,0.18 Q0.4793,0.18,0.4882,0.178 L0.4915,0.178 Q0.4964,0.178,0.5045,0.1815 T0.5158,0.185 Q0.5564,0.1889,0.5645,0.1929 Q0.5677,0.1939,0.571,0.1939 Q0.575,0.1939,0.5807,0.1919 T0.5888,0.1899 T0.5929,0.1909 Q0.5969,0.1949,0.6123,0.1949 Q0.6334,0.1949,0.6456,0.1899 Q0.6488,0.1879,0.6537,0.1879 Q0.661,0.1879,0.6772,0.1929 T0.6983,0.1978 Q0.704,0.1988,0.7206,0.1998 T0.7502,0.2018 T0.7664,0.2038 Q0.7672,0.2038,0.7818,0.2043 T0.8151,0.2067 T0.8459,0.2156 Q0.8573,0.2206,0.8573,0.2255 Q0.8573,0.2295,0.8516,0.2324 T0.8394,0.2369 T0.8281,0.2384 Q0.8208,0.2384,0.7526,0.2473 Q0.7494,0.2483,0.7421,0.2493 T0.7287,0.2512 T0.7178,0.2522 L0.7153,0.2522 L0.7137,0.2522 Q0.7056,0.2522,0.6898,0.2572 T0.6691,0.2671 Q0.6667,0.269,0.6634,0.269 Q0.661,0.269,0.6557,0.2681 T0.6472,0.2671 Q0.6448,0.2671,0.6415,0.2681 Q0.631,0.271,0.6034,0.274 Q0.5994,0.274,0.5961,0.2765 T0.5904,0.2789 L0.5864,0.2789 Q0.5831,0.2779,0.5742,0.2779 Q0.541,0.2779,0.5223,0.2849 Q0.5126,0.2888,0.5028,0.2888 Q0.5004,0.2888,0.4943,0.2883 T0.4842,0.2878 Q0.4704,0.2878,0.4627,0.2898 T0.4509,0.2987 Q0.4501,0.2997,0.4501,0.3007 Q0.4501,0.3046,0.4574,0.3066 T0.4765,0.3091 T0.4899,0.3096 Q0.4931,0.3106,0.5061,0.3121 T0.5316,0.315 T0.5499,0.3175 Q0.5507,0.3175,0.5572,0.3195 T0.5685,0.3225 T0.5803,0.3254 T0.5933,0.3279 T0.605,0.3284 T0.6148,0.3274 Q0.6221,0.3244,0.6294,0.3244 Q0.6399,0.3244,0.6496,0.3294 Q0.6529,0.3314,0.6577,0.3314 Q0.6602,0.3314,0.6663,0.3304 T0.6756,0.3294 T0.6813,0.3304 Q0.6837,0.3304,0.6873,0.3309 L0.6946,0.3318 T0.7024,0.3323 T0.7105,0.3328 T0.7178,0.3338 T0.7238,0.3348 T0.7283,0.3363 Q0.7324,0.3383,0.7482,0.3403 T0.7689,0.3442 Q0.7697,0.3442,0.779,0.3477 T0.794,0.3536 T0.8074,0.3615 T0.8183,0.3729 Q0.8232,0.3808,0.8232,0.3848 Q0.8232,0.3867,0.8216,0.3892 T0.8151,0.3961 T0.8062,0.406 T0.7997,0.4179 T0.7952,0.4263 T0.7855,0.4308 T0.7616,0.4362 Q0.7543,0.4372,0.7445,0.4372 L0.7372,0.4372 L0.7307,0.4372 Q0.7202,0.4372,0.7153,0.4382 Q0.7064,0.4402,0.691,0.4402 L0.6845,0.4402 L0.6788,0.4402 Q0.6699,0.4402,0.6533,0.4436 T0.6318,0.451 Q0.6302,0.451,0.6302,0.452 Q0.6302,0.457,0.6626,0.459 Q0.6869,0.4609,0.7015,0.4659 Q0.7064,0.4669,0.7202,0.4669 L0.7311,0.4669 L0.7429,0.4669 Q0.7599,0.4669,0.7689,0.4688 Q0.7794,0.4708,0.7794,0.4738 L0.7786,0.4748 T0.777,0.4763 T0.7749,0.4773 L0.7737,0.4777 L0.7729,0.4777 Q0.7502,0.4797,0.738,0.4797 L0.7315,0.4797 L0.7291,0.4797 Q0.7226,0.4797,0.6869,0.4876 Q0.6821,0.4886,0.6768,0.4891 T0.6614,0.4901 T0.6456,0.4916 L0.6342,0.4916 Q0.6294,0.4916,0.6217,0.4911 T0.6115,0.4906 Q0.6083,0.4906,0.6054,0.4911 T0.5961,0.4936 T0.5815,0.4965 T0.5629,0.4985 Q0.5507,0.4985,0.5442,0.4995 T0.5345,0.5025 T0.5304,0.5084 L0.5296,0.5094 Q0.5296,0.5114,0.5316,0.5124 T0.5373,0.5138 T0.5442,0.5143 L0.5523,0.5143 L0.5604,0.5143 Q0.5637,0.5153,0.5677,0.5158 T0.5742,0.5173 T0.5811,0.5188 T0.5904,0.5193 L0.5977,0.5193 L0.6026,0.5193 Q0.6107,0.5193,0.6168,0.5208 T0.6294,0.5252 T0.6399,0.5292 Q0.6448,0.5302,0.6679,0.5341 T0.6983,0.541 Q0.7129,0.545,0.7664,0.55 Q0.7883,0.5519,0.7883,0.5559 Q0.7883,0.5579,0.7843,0.5608 T0.7721,0.5638 Q0.7697,0.5638,0.764,0.5633 T0.7559,0.5628 L0.7502,0.5628 Q0.7364,0.5648,0.6869,0.5648 L0.6699,0.5648 L0.6675,0.5648 Q0.665,0.5648,0.6602,0.5658 T0.6513,0.5668 Q0.6464,0.5668,0.6399,0.5658 Q0.6342,0.5648,0.6302,0.5648 T0.6225,0.5668 T0.6156,0.5697 Q0.6107,0.5707,0.6087,0.5707 T0.6034,0.5712 T0.5953,0.5717 Q0.5904,0.5727,0.5835,0.5727 T0.5718,0.5732 T0.562,0.5757 Q0.558,0.5767,0.5483,0.5767 L0.5349,0.5767 L0.5207,0.5767 Q0.5069,0.5767,0.5028,0.5786 Q0.4972,0.5816,0.4899,0.5816 Q0.4858,0.5816,0.4781,0.5806 T0.4663,0.5796 L0.4631,0.5796 Q0.4582,0.5796,0.4432,0.5821 T0.4144,0.5846 L0.4071,0.5846 L0.4011,0.5846 T0.3958,0.5851 T0.3921,0.5856 T0.3889,0.5861 T0.3865,0.5865 T0.384,0.5875 L0.382,0.5885 L0.3796,0.5895 L0.3771,0.5905 Q0.3731,0.5925,0.365,0.5925 L0.3601,0.5925 L0.3552,0.5925 Q0.3277,0.5925,0.3049,0.6044 Q0.3017,0.6053,0.296,0.6053 Q0.292,0.6053,0.2847,0.6044 T0.2741,0.6034 Q0.2693,0.6034,0.2547,0.6029 T0.236,0.6024 Q0.2222,0.6024,0.1922,0.6073 Q0.1906,0.6083,0.1882,0.6083 Q0.1833,0.6083,0.1711,0.6063 T0.1533,0.6044 Q0.1517,0.6034,0.1492,0.6034 Q0.1436,0.6034,0.135,0.6048 T0.1168,0.6078 T0.103,0.6093 Q0.0973,0.6103,0.0787,0.6103 L0.0604,0.6103 L0.0414,0.6103 L0.0235,0.6103 Q0.0024,0.6113,0.0024,0.6172 Q0.0024,0.6192,0.0032,0.6231 Q0.0049,0.6281,0.0333,0.6281 L0.0414,0.6281 L0.0479,0.6281 Q0.0519,0.6281,0.0624,0.6301 T0.0803,0.632 L0.0835,0.632 L0.0916,0.632 Q0.0989,0.632,0.1281,0.634 L0.206,0.6419 Q0.2117,0.6429,0.2174,0.6429 Q0.2214,0.6429,0.2271,0.6424 T0.2344,0.6419 L0.2376,0.6419 Q0.2393,0.6429,0.2417,0.6429 T0.2526,0.6419 T0.2652,0.6409 Q0.2741,0.6409,0.2782,0.6429 T0.2968,0.6459 T0.3293,0.6479 T0.352,0.6489 Q0.3552,0.6499,0.3585,0.6499 Q0.365,0.6499,0.3731,0.6474 T0.3844,0.6449 Q0.3885,0.6449,0.3917,0.6474 T0.4006,0.6499 Q0.4088,0.6499,0.4509,0.6578 Q0.4574,0.6588,0.4631,0.6588 Q0.4655,0.6588,0.4716,0.6583 T0.4834,0.6578 L0.4874,0.6578 Q0.5004,0.6588,0.5255,0.6637 Q0.532,0.6647,0.56,0.6667 T0.6148,0.6701 T0.644,0.6716 Q0.6464,0.6726,0.6594,0.6736 T0.6861,0.6756 T0.7048,0.6775 Q0.7097,0.6775,0.7186,0.6825 T0.738,0.6874 Q0.7518,0.6874,0.7729,0.6958 T0.8005,0.7122 Q0.8029,0.7141,0.8029,0.7151 Q0.8029,0.7191,0.7968,0.7216 T0.7818,0.726 T0.7705,0.729 L0.764,0.731 T0.7583,0.7324 T0.753,0.7334 T0.7486,0.7349 Q0.7251,0.7399,0.7161,0.7399 Q0.7097,0.7399,0.6951,0.7409 T0.6748,0.7418 L0.6703,0.7418 L0.6667,0.7418 Q0.6659,0.7418,0.6399,0.7448 L0.6334,0.7448 Q0.631,0.7448,0.6249,0.7443 T0.6148,0.7438 L0.6099,0.7438 Q0.601,0.7448,0.5856,0.7473 T0.5645,0.7507 Q0.5572,0.7517,0.5572,0.7547 T0.5616,0.7606 T0.5702,0.7646 Q0.5734,0.7646,0.5779,0.7651 T0.5864,0.7661 T0.5949,0.7671 T0.6018,0.7676 L0.6071,0.7676 T0.6135,0.7681 T0.62,0.769 T0.6269,0.771 T0.6342,0.7725 Q0.6391,0.7725,0.6464,0.7705 T0.6541,0.7685 L0.6553,0.7685 Q0.6586,0.7685,0.6699,0.771 T0.6853,0.7735 Q0.6902,0.7735,0.704,0.777 T0.7226,0.7834 Q0.7315,0.7873,0.7445,0.7883 Q0.747,0.7883,0.7676,0.7893 T0.7972,0.7913 Q0.7989,0.7913,0.8017,0.7918 T0.8058,0.7923 T0.809,0.7928 T0.8114,0.7933 T0.8131,0.7938 T0.8147,0.7943 T0.8159,0.7953 L0.8171,0.7967 T0.8175,0.7982 Q0.8183,0.7992,0.8183,0.8002 Q0.8183,0.8022,0.8155,0.8032 T0.807,0.8051 T0.7989,0.8071 Q0.7932,0.8091,0.7737,0.8091 L0.7413,0.8091 L0.7372,0.8091 Q0.7275,0.8091,0.721,0.8101 T0.7072,0.8136 T0.6983,0.817 Q0.6942,0.818,0.6825,0.818 T0.6602,0.819 T0.6456,0.822 Q0.6415,0.8249,0.6375,0.8249 Q0.6367,0.8249,0.6326,0.8239 T0.6253,0.8229 Q0.6034,0.8229,0.5953,0.8279 Q0.5912,0.8289,0.5848,0.8289 Q0.5775,0.8289,0.5645,0.8279 Q0.5629,0.8269,0.5604,0.8269 Q0.5523,0.8269,0.5328,0.8348 Q0.5296,0.8358,0.5264,0.8358 Q0.5247,0.8358,0.5203,0.8353 T0.5126,0.8348 Q0.5061,0.8348,0.4988,0.8358 Q0.4947,0.8368,0.4882,0.8378 Q0.4826,0.8388,0.4797,0.8388 T0.474,0.8398 T0.4704,0.8422 T0.4696,0.8462 T0.472,0.8501 T0.4781,0.8521 T0.4854,0.8526 L0.4935,0.8526 T0.4996,0.8536 Q0.5036,0.8536,0.515,0.8546 T0.5337,0.8566 Q0.5426,0.8576,0.5596,0.8576 L0.5657,0.8576 L0.571,0.8576 L0.5791,0.8576 Q0.5921,0.8586,0.6135,0.8591 T0.6383,0.8605 Q0.6683,0.8635,0.6764,0.8635 Q0.6999,0.8635,0.6999,0.8684 Q0.6999,0.8694,0.6967,0.8734 T0.6934,0.8803 L0.6934,0.8823 Q0.6951,0.8863,0.7137,0.8863 Q0.7218,0.8863,0.7267,0.8853 L0.7299,0.8853 Q0.734,0.8853,0.7409,0.8882 T0.7502,0.8912 Q0.7607,0.8942,0.794,0.8971 Q0.7972,0.8971,0.8078,0.9001 T0.8297,0.9031 Q0.8475,0.9031,0.8646,0.9065 T0.8824,0.9149 L0.8824,0.9159 Q0.8824,0.9169,0.882,0.9179 T0.8808,0.9194 L0.8792,0.9204 T0.8767,0.9214 T0.8743,0.9224 T0.8715,0.9228 L0.8686,0.9228 T0.8662,0.9233 T0.8637,0.9238 L0.8556,0.9238 T0.8447,0.9243 T0.8386,0.9268 Q0.837,0.9278,0.835,0.9288 T0.8305,0.9303 T0.8244,0.9308 T0.8175,0.9318 Q0.8127,0.9327,0.8017,0.9352 T0.7851,0.9397 Q0.777,0.9416,0.7705,0.9451 T0.7616,0.9496 Q0.7575,0.9505,0.7494,0.9505 L0.7405,0.9505 L0.7307,0.9505 Q0.7234,0.9505,0.7178,0.9515 Q0.7145,0.9515,0.7125,0.9535 T0.7105,0.9575 Q0.7105,0.9624,0.7194,0.9634 Q0.7567,0.9654,0.7664,0.9674 Q0.7745,0.9693,0.7762,0.9693 L0.7908,0.9693 L0.7948,0.9693 Q0.8005,0.9693,0.8058,0.9698 T0.8143,0.9718 T0.824,0.9753 T0.8354,0.9792 Q0.8483,0.9832,0.871,0.9832 L0.8739,0.9832 L0.8767,0.9832 Q0.8873,0.9832,0.8921,0.9842 Q0.8978,0.9852,0.9157,0.9896 T0.94,0.996 Q0.9424,0.996,0.9469,0.9965 T0.9566,0.997 T0.9676,0.9975 T0.9781,0.998 L0.9874,0.998 L0.9943,0.998 L0.9968,0.998 Z",type:0}},"":{type:5,data:{d:"M1,0.5071 L0.8623,0.7102 L0.5865,0.7102 L0.4489,0.5071 L0.5865,0.3045 L0.8623,0.3045 Z M0.4135,0.7974 L0.2758,1 L0,1 L0,0.5944 L0.2758,0.5944 Z M0.4135,0.2026 L0.2758,0.4056 L0,0.4056 L0,0 L0.2758,0 Z",type:0}},"":{type:5,data:{d:"M0.9726,0.5071 L0.8451,0.3184 L0.59,0.3184 L0.4624,0.5071 L0.59,0.6955 L0.8451,0.6955 Z M1,0.5071 L0.8588,0.716 L0.5768,0.716 L0.4355,0.5071 L0.5768,0.2982 L0.8588,0.2982 Z M0.401,0.7911 L0.2735,0.6028 L0.0236,0.6028 L0.0236,0.9799 L0.2735,0.9799 Z M0.4284,0.7911 L0.2872,1 L0,1 L0,0.5826 L0.2872,0.5826 Z M0.401,0.2089 L0.2735,0.0201 L0.0236,0.0201 L0.0236,0.3972 L0.2735,0.3972 Z M0.4284,0.2089 L0.2872,0.4174 L0,0.4174 L0,0 L0.2872,0 Z",type:0}},"":{type:5,data:{d:"M1,0.4996 Q1,0.5365,0.9924,0.568 T0.9718,0.6177 T0.9433,0.6363 L0.9425,0.6367 Q0.9355,0.6367,0.9285,0.6326 L0.9308,0.6326 Q0.9129,0.6195,0.9013,0.587 T0.8871,0.5164 T0.8943,0.4373 T0.9254,0.3687 L0.9254,0.3691 Q0.9339,0.3628,0.9425,0.3628 Q0.9584,0.3628,0.9716,0.3811 T0.9924,0.431 T1,0.4996 Z M0.9234,0.6321 L0.8776,0.7169 Q0.8791,0.732,0.8791,0.7441 Q0.8791,0.781,0.8716,0.8123 T0.8508,0.862 T0.8224,0.8809 L0.8216,0.8809 Q0.8154,0.8809,0.8092,0.8775 L0.8088,0.8775 Q0.7905,0.8633,0.7792,0.8297 T0.766,0.7571 T0.775,0.6768 T0.8088,0.6086 L0.7431,0.6065 Q0.719,0.6313,0.7072,0.6705 T0.6965,0.7487 T0.7097,0.823 T0.7423,0.8763 L0.7913,0.8775 L0.7314,0.9895 L0.4648,0.5038 L0.7299,0.0176 L0.7882,0.1229 L0.7404,0.1212 Q0.7244,0.138,0.7136,0.1617 T0.6982,0.2108 T0.6943,0.2632 T0.7003,0.3144 T0.7159,0.3586 T0.7396,0.3909 L0.8072,0.3926 Q0.7894,0.3796,0.7777,0.3479 T0.7635,0.2789 T0.7697,0.2011 T0.7987,0.1326 Q0.8092,0.1225,0.8204,0.1225 Q0.8321,0.1225,0.8426,0.1332 T0.8609,0.1623 T0.8731,0.2062 T0.8776,0.2592 Q0.8776,0.268,0.8768,0.2815 L0.9219,0.3628 L0.8644,0.3612 Q0.8403,0.3855,0.8284,0.4247 T0.8177,0.5029 T0.8309,0.5772 T0.8632,0.6305 Z M0.6759,0.6384 Q0.6576,0.625,0.6457,0.5914 T0.6319,0.5185 T0.6407,0.4375 T0.6751,0.3691 L0.609,0.367 Q0.5849,0.3918,0.5731,0.431 T0.5626,0.509 T0.5758,0.5833 T0.6082,0.6367 Z M0.6459,0.0025 L0.391,0.4551 L0.0035,0.4551 L0.246,0 Z M0.6553,1 L0.2421,1 L0,0.5449 L0.3875,0.5449 Z",type:0}},"":{type:5,data:{d:"M0.4996,0 Q0.5562,0,0.5961,0.0166 T0.6364,0.0566 L0.6368,0.0575 Q0.6368,0.0646,0.6324,0.0713 L0.6324,0.0692 Q0.6196,0.0868,0.5872,0.0986 T0.5166,0.1128 T0.4373,0.1057 T0.3689,0.0747 L0.3694,0.0747 Q0.3627,0.0663,0.3627,0.0575 Q0.3627,0.0336,0.4028,0.0168 T0.4996,0 Z M0.6324,0.0768 L0.717,0.1225 Q0.7321,0.1212,0.744,0.1212 Q0.8007,0.1212,0.8406,0.1378 T0.8809,0.1779 L0.8813,0.1783 Q0.8813,0.1846,0.8778,0.1909 Q0.8636,0.2093,0.8299,0.2208 T0.7573,0.2343 T0.6769,0.2253 T0.6089,0.1913 L0.6067,0.2567 Q0.6315,0.281,0.6707,0.2928 T0.7489,0.3035 T0.8231,0.2903 T0.8764,0.258 L0.8778,0.2085 L0.9898,0.2685 L0.504,0.5352 L0.0177,0.2701 L0.1227,0.2118 L0.1213,0.2596 Q0.1457,0.2836,0.1851,0.2955 T0.2635,0.3062 T0.3377,0.293 T0.3911,0.2605 L0.3928,0.193 Q0.38,0.2106,0.3483,0.2221 T0.2792,0.2364 T0.2013,0.2303 T0.1324,0.2013 Q0.1222,0.1909,0.1222,0.1795 Q0.1222,0.156,0.1623,0.1393 T0.2591,0.1225 Q0.2679,0.1225,0.2817,0.1233 L0.3627,0.078 L0.3609,0.1359 Q0.3857,0.1598,0.4249,0.1718 T0.5031,0.1825 T0.5773,0.1693 T0.6306,0.1367 Z M0.6386,0.3242 Q0.6253,0.3427,0.5917,0.3544 T0.5186,0.3683 T0.4376,0.3595 T0.3689,0.3251 L0.3671,0.3909 Q0.3915,0.4148,0.4309,0.4268 T0.5093,0.4375 T0.5835,0.4243 T0.6368,0.3918 Z M0.0027,0.354 L0.4553,0.6091 L0.4553,0.9962 L0,0.7542 Z M1,0.3448 L1,0.7576 L0.5447,1 L0.5447,0.6128 Z",type:0}},"":{type:5,data:{d:"M0,0.7699 Q0,0.7172,0.0277,0.6731 T0.103,0.6032 T0.2066,0.5774 Q0.2487,0.5774,0.2865,0.5922 T0.3526,0.6339 L0.3935,0.6715 Q0.4218,0.6984,0.438,0.7336 T0.4541,0.8075 Q0.4541,0.8602,0.4264,0.9046 T0.3511,0.9745 T0.2475,1 Q0.2054,1,0.1676,0.9852 T0.1016,0.9435 L0.0606,0.9059 Q0.0317,0.879,0.0159,0.8438 T0,0.7699 Z M0.5459,0.7699 Q0.5459,0.7172,0.5736,0.6731 T0.6489,0.6032 T0.7525,0.5774 Q0.7946,0.5774,0.8324,0.5922 T0.8984,0.6339 L0.9394,0.6715 Q0.9579,0.6892,0.9714,0.7105 T0.9925,0.7567 T1,0.8075 Q1,0.8602,0.9723,0.9046 T0.897,0.9745 T0.7934,1 Q0.7513,1,0.7135,0.9852 T0.6474,0.9435 L0.6065,0.9059 Q0.5776,0.879,0.5617,0.8438 T0.5459,0.7699 Z M0,0.1925 Q0,0.1398,0.0277,0.0957 T0.103,0.0258 T0.2066,0 Q0.2487,0,0.2865,0.0148 T0.3526,0.0565 L0.3935,0.0941 Q0.4218,0.121,0.438,0.1562 T0.4541,0.2301 Q0.4541,0.2828,0.4264,0.3269 T0.3511,0.3968 T0.2475,0.4226 Q0.2054,0.4226,0.1676,0.4078 T0.1016,0.3661 L0.0606,0.3285 Q0.0317,0.3016,0.0159,0.2664 T0,0.1925 Z M0.5459,0.1925 Q0.5459,0.1398,0.5736,0.0957 T0.6489,0.0258 T0.7525,0 Q0.7946,0,0.8324,0.0148 T0.8984,0.0565 L0.9394,0.0941 Q0.9677,0.121,0.9838,0.1562 T1,0.2301 Q1,0.2828,0.9723,0.3269 T0.897,0.3968 T0.7934,0.4226 Q0.7513,0.4226,0.7135,0.4078 T0.6474,0.3661 L0.6065,0.3285 Q0.5874,0.3108,0.5741,0.2895 T0.5534,0.2433 T0.5459,0.1925 Z M0.3301,0.6403 Q0.3306,0.6403,0.3312,0.6409 L0.3272,0.6371 L0.3272,0.6371 Z M0.8759,0.6403 Q0.8765,0.6403,0.8771,0.6409 Q0.8748,0.6387,0.8725,0.6371 L0.8731,0.6371 Z M0.3301,0.0629 Q0.3306,0.0629,0.3312,0.0634 L0.3272,0.0597 L0.3272,0.0602 Z M0.8759,0.0629 Q0.8765,0.0629,0.8771,0.0634 Q0.8748,0.0613,0.8725,0.0597 Q0.8731,0.0597,0.8731,0.0602 Z M0.779,0.4113 L0.7501,0.3849 Q0.7046,0.3844,0.6636,0.3661 Q0.7132,0.407,0.779,0.4113 Z M0.7957,0.4118 Q0.8477,0.4113,0.8918,0.3874 T0.9619,0.3223 T0.9885,0.2323 L0.9585,0.2048 Q0.9538,0.2769,0.8987,0.3282 T0.7657,0.3844 Z M0.9879,0.2167 Q0.9827,0.1554,0.9388,0.1097 Q0.9585,0.1478,0.959,0.1898 Z M0.2331,0.4113 L0.2043,0.3849 Q0.1587,0.3844,0.1177,0.3661 Q0.1673,0.407,0.2331,0.4113 Z M0.2499,0.4118 Q0.2885,0.4118,0.324,0.3973 T0.3852,0.3589 T0.4264,0.3019 T0.4426,0.2323 L0.4126,0.2048 Q0.408,0.2769,0.3529,0.3282 T0.2198,0.3844 Z M0.442,0.2167 Q0.4368,0.1554,0.393,0.1097 Q0.4126,0.1478,0.4132,0.1903 Z M0.779,0.9887 L0.7501,0.9624 Q0.7046,0.9618,0.6636,0.9435 Q0.7132,0.9844,0.779,0.9887 Z M0.7957,0.9892 Q0.8477,0.9887,0.8918,0.9648 T0.9619,0.8997 T0.9885,0.8097 L0.9585,0.7823 Q0.9538,0.8543,0.8987,0.9056 T0.7657,0.9618 Z M0.9879,0.7941 Q0.9827,0.7328,0.9388,0.6871 Q0.9585,0.7253,0.959,0.7672 Z M0.2331,0.9887 L0.2043,0.9624 Q0.1587,0.9618,0.1177,0.9435 Q0.1673,0.9844,0.2331,0.9887 Z M0.2499,0.9892 Q0.3018,0.9887,0.3459,0.9648 T0.416,0.8997 T0.4426,0.8102 L0.4126,0.7823 Q0.408,0.8543,0.3529,0.9056 T0.2198,0.9618 Z M0.442,0.7941 Q0.4368,0.7328,0.393,0.6871 Q0.4126,0.7253,0.4132,0.7672 Z M0.3191,0.6452 Q0.2943,0.622,0.2643,0.6091 T0.2066,0.5962 Q0.1795,0.5962,0.1497,0.6091 T0.0949,0.6441 T0.0537,0.6995 T0.0375,0.7699 Q0.0375,0.8419,0.0941,0.8941 Q0.1189,0.9172,0.1489,0.9304 T0.2066,0.9435 Q0.2337,0.9435,0.2634,0.9304 T0.3182,0.8952 T0.3595,0.8398 T0.3756,0.7699 Q0.3756,0.6978,0.3191,0.6452 Z M0.026,0.7731 L0.026,0.7699 Q0.026,0.6935,0.0854,0.6376 Q0.0658,0.6538,0.0514,0.6739 T0.0289,0.718 T0.0202,0.7677 Z M0.0271,0.7892 L0.0208,0.7833 Q0.0254,0.8419,0.0681,0.886 Q0.0664,0.8828,0.0646,0.879 Q0.0329,0.8382,0.0271,0.7892 Z M0.3866,0.7823 Q0.382,0.8511,0.3278,0.9016 Q0.3843,0.8565,0.3918,0.7871 Z M0.3872,0.7677 L0.393,0.7726 L0.393,0.7699 Q0.393,0.7349,0.3791,0.7038 Q0.3739,0.6973,0.3681,0.6914 Q0.3866,0.7274,0.3872,0.7677 Z M0.865,0.6452 Q0.8402,0.622,0.8102,0.6091 T0.7525,0.5962 Q0.7305,0.5962,0.7072,0.6043 T0.6619,0.628 T0.6223,0.6642 T0.5941,0.7124 T0.5834,0.7699 Q0.5834,0.8419,0.6399,0.8941 Q0.6561,0.9097,0.6757,0.9207 T0.7149,0.9376 T0.7525,0.9435 Q0.7796,0.9435,0.8093,0.9304 T0.8641,0.8952 T0.9054,0.8398 T0.9215,0.7699 Q0.9215,0.6978,0.865,0.6452 Z M0.5718,0.7731 L0.5718,0.7699 Q0.5718,0.6935,0.6313,0.6376 Q0.6013,0.6618,0.584,0.6954 T0.5661,0.7677 Z M0.573,0.7892 L0.5666,0.7833 Q0.5713,0.8419,0.614,0.886 Q0.6122,0.8828,0.6105,0.879 Q0.5788,0.8382,0.573,0.7892 Z M0.9325,0.7823 Q0.9279,0.8511,0.8736,0.9016 Q0.9308,0.8565,0.9377,0.7871 Z M0.9331,0.7672 L0.9388,0.7726 L0.9388,0.7699 Q0.9388,0.7349,0.925,0.7038 Q0.9198,0.6973,0.914,0.6914 Q0.9325,0.7274,0.9331,0.7672 Z M0.3191,0.0677 Q0.2943,0.0446,0.2643,0.0317 T0.2066,0.0188 Q0.1795,0.0188,0.1497,0.0317 T0.0949,0.0667 T0.0537,0.122 T0.0375,0.1925 Q0.0375,0.2645,0.0941,0.3167 Q0.1189,0.3398,0.1489,0.353 T0.2066,0.3661 Q0.2337,0.3661,0.2634,0.353 T0.3182,0.3177 T0.3595,0.2624 T0.3756,0.1925 Q0.3756,0.1204,0.3191,0.0677 Z M0.026,0.1957 L0.026,0.1925 Q0.026,0.1161,0.0854,0.0602 Q0.0554,0.0844,0.0381,0.118 T0.0202,0.1903 Z M0.0271,0.2118 L0.0208,0.2059 Q0.0254,0.2645,0.0681,0.3086 Q0.0664,0.3054,0.0646,0.3016 Q0.0329,0.2608,0.0271,0.2118 Z M0.3866,0.2048 Q0.382,0.2737,0.3278,0.3242 Q0.3849,0.279,0.3918,0.2097 Z M0.3872,0.1903 L0.393,0.1952 L0.393,0.1925 Q0.393,0.1581,0.3791,0.1263 Q0.3739,0.1199,0.3681,0.114 Q0.3866,0.15,0.3872,0.1903 Z M0.865,0.0677 Q0.8402,0.0446,0.8102,0.0317 T0.7525,0.0188 Q0.7253,0.0188,0.6956,0.0317 T0.6408,0.0667 T0.5995,0.122 T0.5834,0.1925 Q0.5834,0.2645,0.6399,0.3167 Q0.6647,0.3398,0.6947,0.353 T0.7525,0.3661 Q0.7796,0.3661,0.8093,0.353 T0.8641,0.3177 T0.9054,0.2624 T0.9215,0.1925 Q0.9215,0.1204,0.865,0.0677 Z M0.5718,0.1957 L0.5718,0.1925 Q0.5718,0.1161,0.6313,0.0602 Q0.6013,0.0844,0.584,0.118 T0.5661,0.1903 Z M0.573,0.2118 L0.5666,0.2059 Q0.5713,0.2645,0.614,0.3086 Q0.6122,0.3054,0.6105,0.3016 Q0.5788,0.2608,0.573,0.2118 Z M0.9325,0.2048 Q0.9279,0.2737,0.8736,0.3242 Q0.9308,0.279,0.9377,0.2097 Z M0.9331,0.1898 L0.9388,0.1952 L0.9388,0.1925 Q0.9388,0.1575,0.925,0.1263 Q0.9198,0.1199,0.914,0.114 Q0.9325,0.15,0.9331,0.1898 Z",type:0}},"":{type:5,data:{d:"M0.7639,0.1974 L0.9593,0.1974 L0.9593,0.1443 L0.7639,0.1443 L0.7639,0.1974 Z M0.7586,0.109 L0.9727,0.109 Q0.9839,0.109,0.992,0.1153 T1,0.1291 L1,0.382 Q1,0.3906,0.9912,0.3964 T0.9727,0.4021 L0.7586,0.4021 Q0.7468,0.4021,0.739,0.3956 T0.7313,0.382 L0.7313,0.1291 Q0.7313,0.1246,0.7339,0.1207 T0.7406,0.1143 T0.7495,0.1104 T0.7586,0.109 Z M0.7639,0.6575 L0.9593,0.6575 L0.9593,0.6044 L0.7639,0.6044 L0.7639,0.6575 Z M0.7313,0.8347 L0.7313,0.5843 Q0.7313,0.5757,0.7401,0.5699 T0.7586,0.5641 L0.9706,0.5641 Q0.9818,0.5641,0.9898,0.5705 T0.9979,0.5843 L0.9979,0.8347 Q0.9979,0.8433,0.989,0.8491 T0.9706,0.8549 L0.7586,0.8549 Q0.7468,0.8549,0.739,0.8483 T0.7313,0.8347 Z M0,1 L0,0 L0.7607,0 L0.7607,1 L0,1 Z",type:0}},"":{type:5,data:{d:"M0.9764,0.0029 L0.3179,0.4552 L0,0.4552 L0,0 Z M1,1 L0,1 L0,0.5448 L0.3091,0.5448 Z",type:0}},"":{type:5,data:{d:"M0.0236,0.0029 L0.6824,0.4552 L1,0.4552 L1,0 Z M0,1 L1,1 L1,0.5448 L0.6912,0.5448 Z",type:0}},"":{type:3,data:"M0,0 L1,0 L1,.05 L.1,.05 L.1,.95 L1,.95 L1,1 L0,1 Z"},"":{type:3,data:"M0,0 L1,0 L1,.05 L0,.05 Z M0,.95 L1,.95 L1,1 L0,1 Z"},"":{type:3,data:"M1,0 L0,0 L0,.05 L.9,.05 L.9,.95 L0,.95 L0,1 L1,1 Z"},"":{type:3,data:"M0,0 L1,0 L1,.05 L.1,.05 L.1,.95 L1,.95 L1,1 L0,1 Z M.25,.15 L1,.15 L1,.85 L.25,.85 Z"},"":{type:3,data:"M0,0 L1,0 L1,.05 L0,.05 Z M0,.95 L1,.95 L1,1 L0,1 Z M0,.15 L1,.15 L1,.85 L0,.85 Z"},"":{type:3,data:"M1,0 L0,0 L0,.05 L.9,.05 L.9,.95 L0,.95 L0,1 L1,1 Z M0,.15 L.75,.15 L.75,.85 L0,.85 Z"},"":{type:5,data:{d:"M0.6574,0.303 Q0.623,0.291,0.5852,0.285 T0.5082,0.279 T0.4311,0.285 T0.359,0.303 L0.3082,0.248 Q0.3525,0.232,0.4041,0.2235 T0.5082,0.215 T0.6123,0.2235 T0.7082,0.248 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.8557,0.582 L0.7656,0.551 Q0.7852,0.53,0.7951,0.507 T0.8049,0.46 Q0.8049,0.424,0.782,0.3905 T0.718,0.332 T0.6221,0.293 T0.5082,0.279 L0.5082,0.215 Q0.5607,0.215,0.6123,0.2235 T0.709,0.248 T0.7918,0.287 T0.8557,0.3375 T0.8959,0.3965 T0.9098,0.46 T0.8959,0.5235 T0.8557,0.582 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.5082,0.705 Q0.482,0.705,0.4557,0.703 T0.4049,0.697 L0.4311,0.635 Q0.4508,0.638,0.4697,0.6395 T0.5082,0.641 Q0.5672,0.641,0.6221,0.627 T0.718,0.588 T0.782,0.5295 T0.8049,0.46 Q0.8049,0.436,0.7951,0.413 T0.7656,0.369 L0.8557,0.338 Q0.882,0.365,0.8959,0.3965 T0.9098,0.46 T0.8959,0.5235 T0.8557,0.5825 T0.7918,0.633 T0.709,0.672 T0.6123,0.6965 T0.5082,0.705 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.5082,0.705 Q0.4557,0.705,0.4041,0.6965 T0.3074,0.672 T0.2246,0.633 T0.1607,0.5825 T0.1205,0.5235 T0.1066,0.46 L0.2115,0.46 Q0.2115,0.496,0.2344,0.5295 T0.2984,0.588 T0.3943,0.627 T0.5082,0.641 T0.6221,0.627 T0.718,0.588 T0.782,0.5295 T0.8049,0.46 L0.9098,0.46 Q0.9098,0.492,0.8959,0.5235 T0.8557,0.5825 T0.7918,0.633 T0.709,0.672 T0.6123,0.6965 T0.5082,0.705 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.5082,0.705 Q0.4557,0.705,0.4041,0.6965 T0.3074,0.672 T0.2246,0.633 T0.1607,0.5825 T0.1205,0.5235 T0.1066,0.46 T0.1205,0.3965 T0.1607,0.338 L0.2508,0.369 Q0.2311,0.39,0.2213,0.413 T0.2115,0.46 Q0.2115,0.496,0.2344,0.5295 T0.2984,0.588 T0.3943,0.627 T0.5082,0.641 Q0.5279,0.641,0.5467,0.6395 T0.5852,0.635 L0.6115,0.697 Q0.5869,0.701,0.5607,0.703 T0.5082,0.705 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.1607,0.582 Q0.1344,0.555,0.1205,0.5235 T0.1066,0.46 T0.1205,0.3965 T0.1607,0.3375 T0.2246,0.287 T0.3074,0.248 T0.4041,0.2235 T0.5082,0.215 L0.5082,0.279 Q0.4492,0.279,0.3943,0.293 T0.2984,0.332 T0.2344,0.3905 T0.2115,0.46 Q0.2115,0.484,0.2213,0.507 T0.2508,0.551 Z",type:0},scaleType:1},"":Ce.LINE_H,"":Ce.LINE_V,"":Ce.FADE_RIGHT,"":Ce.FADE_LEFT,"":Ce.FADE_DOWN,"":Ce.FADE_UP,"":Ce.CURVE_DOWN_RIGHT,"":Ce.CURVE_DOWN_LEFT,"":Ce.CURVE_UP_RIGHT,"":Ce.CURVE_UP_LEFT,"":[Ce.LINE_V,Ce.CURVE_UP_RIGHT],"":[Ce.LINE_V,Ce.CURVE_DOWN_RIGHT],"":[Ce.CURVE_DOWN_RIGHT,Ce.CURVE_UP_RIGHT],"":[Ce.LINE_V,Ce.CURVE_UP_LEFT],"":[Ce.LINE_V,Ce.CURVE_DOWN_LEFT],"":[Ce.CURVE_DOWN_LEFT,Ce.CURVE_UP_LEFT],"":[Ce.LINE_H,Ce.CURVE_DOWN_LEFT],"":[Ce.LINE_H,Ce.CURVE_DOWN_RIGHT],"":[Ce.CURVE_DOWN_LEFT,Ce.CURVE_DOWN_RIGHT],"":[Ce.LINE_H,Ce.CURVE_UP_LEFT],"":[Ce.LINE_H,Ce.CURVE_UP_RIGHT],"":[Ce.CURVE_UP_LEFT,Ce.CURVE_UP_RIGHT],"":[Ce.LINE_V,Ce.CURVE_UP_LEFT,Ce.CURVE_UP_RIGHT],"":[Ce.LINE_V,Ce.CURVE_DOWN_LEFT,Ce.CURVE_DOWN_RIGHT],"":[Ce.LINE_H,Ce.CURVE_DOWN_LEFT,Ce.CURVE_UP_LEFT],"":[Ce.LINE_H,Ce.CURVE_DOWN_RIGHT,Ce.CURVE_UP_RIGHT],"":[Ce.LINE_V,Ce.CURVE_DOWN_RIGHT,Ce.CURVE_UP_LEFT],"":[Ce.LINE_V,Ce.CURVE_DOWN_LEFT,Ce.CURVE_UP_RIGHT],"":[Ce.LINE_H,Ce.CURVE_DOWN_RIGHT,Ce.CURVE_UP_LEFT],"":[Ce.LINE_H,Ce.CURVE_DOWN_LEFT,Ce.CURVE_UP_RIGHT],"":[Ce.NODE_FILL,Ce.NODE_STROKE],"":Ce.NODE_STROKE,"":[Ce.NODE_FILL,Ce.NODE_STROKE,Ce.NODE_LINE_RIGHT],"":[Ce.NODE_STROKE,Ce.NODE_LINE_RIGHT],"":[Ce.NODE_FILL,Ce.NODE_STROKE,Ce.NODE_LINE_LEFT],"":[Ce.NODE_STROKE,Ce.NODE_LINE_LEFT],"":[Ce.NODE_FILL,Ce.NODE_STROKE,Ce.NODE_LINE_LEFT,Ce.NODE_LINE_RIGHT],"":[Ce.NODE_STROKE,Ce.NODE_LINE_LEFT,Ce.NODE_LINE_RIGHT],"":[Ce.NODE_FILL,Ce.NODE_STROKE,Ce.NODE_LINE_DOWN],"":[Ce.NODE_STROKE,Ce.NODE_LINE_DOWN],"":[Ce.NODE_FILL,Ce.NODE_STROKE,Ce.NODE_LINE_UP],"":[Ce.NODE_STROKE,Ce.NODE_LINE_UP],"":[Ce.NODE_FILL,Ce.NODE_STROKE,Ce.NODE_LINE_DOWN,Ce.NODE_LINE_UP],"":[Ce.NODE_STROKE,Ce.NODE_LINE_DOWN,Ce.NODE_LINE_UP],"":[Ce.NODE_FILL,Ce.NODE_STROKE,Ce.NODE_LINE_DOWN,Ce.NODE_LINE_RIGHT],"":[Ce.NODE_STROKE,Ce.NODE_LINE_DOWN,Ce.NODE_LINE_RIGHT],"":[Ce.NODE_FILL,Ce.NODE_STROKE,Ce.NODE_LINE_DOWN,Ce.NODE_LINE_LEFT],"":[Ce.NODE_STROKE,Ce.NODE_LINE_DOWN,Ce.NODE_LINE_LEFT],"":[Ce.NODE_FILL,Ce.NODE_STROKE,Ce.NODE_LINE_UP,Ce.NODE_LINE_RIGHT],"":[Ce.NODE_STROKE,Ce.NODE_LINE_UP,Ce.NODE_LINE_RIGHT],"":[Ce.NODE_FILL,Ce.NODE_STROKE,Ce.NODE_LINE_UP,Ce.NODE_LINE_LEFT],"":[Ce.NODE_STROKE,Ce.NODE_LINE_UP,Ce.NODE_LINE_LEFT],"":[Ce.NODE_FILL,Ce.NODE_STROKE,Ce.NODE_LINE_UP,Ce.NODE_LINE_DOWN,Ce.NODE_LINE_RIGHT],"":[Ce.NODE_STROKE,Ce.NODE_LINE_UP,Ce.NODE_LINE_DOWN,Ce.NODE_LINE_RIGHT],"":[Ce.NODE_FILL,Ce.NODE_STROKE,Ce.NODE_LINE_UP,Ce.NODE_LINE_DOWN,Ce.NODE_LINE_LEFT],"":[Ce.NODE_STROKE,Ce.NODE_LINE_UP,Ce.NODE_LINE_DOWN,Ce.NODE_LINE_LEFT],"":[Ce.NODE_FILL,Ce.NODE_STROKE,Ce.NODE_LINE_DOWN,Ce.NODE_LINE_LEFT,Ce.NODE_LINE_RIGHT],"":[Ce.NODE_STROKE,Ce.NODE_LINE_DOWN,Ce.NODE_LINE_LEFT,Ce.NODE_LINE_RIGHT],"":[Ce.NODE_FILL,Ce.NODE_STROKE,Ce.NODE_LINE_UP,Ce.NODE_LINE_LEFT,Ce.NODE_LINE_RIGHT],"":[Ce.NODE_STROKE,Ce.NODE_LINE_UP,Ce.NODE_LINE_LEFT,Ce.NODE_LINE_RIGHT],"":[Ce.NODE_FILL,Ce.NODE_STROKE,Ce.NODE_LINE_UP,Ce.NODE_LINE_DOWN,Ce.NODE_LINE_LEFT,Ce.NODE_LINE_RIGHT],"":[Ce.NODE_STROKE,Ce.NODE_LINE_UP,Ce.NODE_LINE_DOWN,Ce.NODE_LINE_LEFT,Ce.NODE_LINE_RIGHT],"🬀":br(1),"🬁":br(2),"🬂":br(3),"🬃":br(4),"🬄":br(5),"🬅":br(6),"🬆":br(7),"🬇":br(8),"🬈":br(9),"🬉":br(10),"🬊":br(11),"🬋":br(12),"🬌":br(13),"🬍":br(14),"🬎":br(15),"🬏":br(16),"🬐":br(17),"🬑":br(18),"🬒":br(19),"🬓":br(20),"🬔":br(22),"🬕":br(23),"🬖":br(24),"🬗":br(25),"🬘":br(26),"🬙":br(27),"🬚":br(28),"🬛":br(29),"🬜":br(30),"🬝":br(31),"🬞":br(32),"🬟":br(33),"🬠":br(34),"🬡":br(35),"🬢":br(36),"🬣":br(37),"🬤":br(38),"🬥":br(39),"🬦":br(40),"🬧":br(41),"🬨":br(43),"🬩":br(44),"🬪":br(45),"🬫":br(46),"🬬":br(47),"🬭":br(48),"🬮":br(49),"🬯":br(50),"🬰":br(51),"🬱":br(52),"🬲":br(53),"🬳":br(54),"🬴":br(55),"🬵":br(56),"🬶":br(57),"🬷":br(58),"🬸":br(59),"🬹":br(60),"🬺":br(61),"🬻":br(62),"🬼":{type:3,data:"M0,0.6667 L0,1 L0.5,1 Z"},"🬽":{type:3,data:"M0,0.6667 L0,1 L1,1 Z"},"🬾":{type:3,data:"M0,0.3333 L0,1 L0.5,1 Z"},"🬿":{type:3,data:"M0,0.3333 L0,1 L1,1 Z"},"🭀":{type:3,data:"M0,0 L0,1 L0.5,1 Z"},"🭁":{type:3,data:"M0,0.3333 L0.5,0 L1,0 L1,1 L0,1 Z"},"🭂":{type:3,data:"M0,0.3333 L1,0 L1,1 L0,1 Z"},"🭃":{type:3,data:"M0,0.6667 L0.5,0 L1,0 L1,1 L0,1 Z"},"🭄":{type:3,data:"M0,0.6667 L1,0 L1,1 L0,1 Z"},"🭅":{type:3,data:"M0,1 L0.5,0 L1,0 L1,1 Z"},"🭆":{type:3,data:"M0,0.6667 L1,0.3333 L1,1 L0,1 Z"},"🭇":{type:3,data:"M0.5,1 L1,0.6667 L1,1 Z"},"🭈":{type:3,data:"M0,1 L1,0.6667 L1,1 Z"},"🭉":{type:3,data:"M0.5,1 L1,0.3333 L1,1 Z"},"🭊":{type:3,data:"M0,1 L1,0.3333 L1,1 Z"},"🭋":{type:3,data:"M0.5,1 L1,0 L1,1 Z"},"🭌":{type:3,data:"M0.5,0 L0,0 L0,1 L1,1 L1,0.3333 Z"},"🭍":{type:3,data:"M0,0 L0,1 L1,1 L1,0.3333 Z"},"🭎":{type:3,data:"M0.5,0 L0,0 L0,1 L1,1 L1,0.6667 Z"},"🭏":{type:3,data:"M0,0 L0,1 L1,1 L1,0.6667 Z"},"🭐":{type:3,data:"M0.5,0 L0,0 L0,1 L1,1 Z"},"🭑":{type:3,data:"M0,0.3333 L0,1 L1,1 L1,0.6667 Z"},"🭒":{type:3,data:"M0,0.6667 L0.5,1 L1,1 L1,0 L0,0 Z"},"🭓":{type:3,data:"M0,0.6667 L1,1 L1,0 L0,0 Z"},"🭔":{type:3,data:"M0,0.3333 L0.5,1 L1,1 L1,0 L0,0 Z"},"🭕":{type:3,data:"M0,0.3333 L1,1 L1,0 L0,0 Z"},"🭖":{type:3,data:"M0,0 L0.5,1 L1,1 L1,0 Z"},"🭗":{type:3,data:"M0,0.3333 L0,0 L0.5,0 Z"},"🭘":{type:3,data:"M0,0.3333 L0,0 L1,0 Z"},"🭙":{type:3,data:"M0,0.6667 L0,0 L0.5,0 Z"},"🭚":{type:3,data:"M0,0.6667 L0,0 L1,0 Z"},"🭛":{type:3,data:"M0,1 L0,0 L0.5,0 Z"},"🭜":{type:3,data:"M0,0.6667 L0,0 L1,0 L1,0.3333 Z"},"🭝":{type:3,data:"M0.5,1 L0,1 L0,0 L1,0 L1,0.6667 Z"},"🭞":{type:3,data:"M0,1 L0,0 L1,0 L1,0.6667 Z"},"🭟":{type:3,data:"M0.5,1 L0,1 L0,0 L1,0 L1,0.3333 Z"},"🭠":{type:3,data:"M0,1 L0,0 L1,0 L1,0.3333 Z"},"🭡":{type:3,data:"M0.5,1 L0,1 L0,0 L1,0 Z"},"🭢":{type:3,data:"M0.5,0 L1,0 L1,0.3333 Z"},"🭣":{type:3,data:"M0,0 L1,0 L1,0.3333 Z"},"🭤":{type:3,data:"M0.5,0 L1,0 L1,0.6667 Z"},"🭥":{type:3,data:"M0,0 L1,0 L1,0.6667 Z"},"🭦":{type:3,data:"M0.5,0 L1,0 L1,1 Z"},"🭧":{type:3,data:"M0,0.3333 L1,0.6667 L1,0 L0,0 Z"},"🭨":{type:3,data:"M0,0 L1,0 L1,1 L0,1 L0.5,0.5 Z"},"🭩":{type:3,data:"M0,0 L0.5,0.5 L1,0 L1,1 L0,1 Z"},"🭪":{type:3,data:"M0,0 L1,0 L0.5,0.5 L1,1 L0,1 Z"},"🭫":{type:3,data:"M0,0 L1,0 L1,1 L0.5,0.5 L0,1 Z"},"🭬":{type:3,data:"M0,0 L0.5,0.5 L0,1 Z"},"🭭":{type:3,data:"M0,0 L1,0 L0.5,0.5 Z"},"🭮":{type:3,data:"M1,0 L1,1 L0.5,0.5 Z"},"🭯":{type:3,data:"M0,1 L1,1 L0.5,0.5 Z"},"🭰":{type:0,data:[{x:1,y:0,w:1,h:8}]},"🭱":{type:0,data:[{x:2,y:0,w:1,h:8}]},"🭲":{type:0,data:[{x:3,y:0,w:1,h:8}]},"🭳":{type:0,data:[{x:4,y:0,w:1,h:8}]},"🭴":{type:0,data:[{x:5,y:0,w:1,h:8}]},"🭵":{type:0,data:[{x:6,y:0,w:1,h:8}]},"🭶":{type:0,data:[{x:0,y:1,w:8,h:1}]},"🭷":{type:0,data:[{x:0,y:2,w:8,h:1}]},"🭸":{type:0,data:[{x:0,y:3,w:8,h:1}]},"🭹":{type:0,data:[{x:0,y:4,w:8,h:1}]},"🭺":{type:0,data:[{x:0,y:5,w:8,h:1}]},"🭻":{type:0,data:[{x:0,y:6,w:8,h:1}]},"🭼":{type:0,data:[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}]},"🭽":{type:0,data:[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}]},"🭾":{type:0,data:[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}]},"🭿":{type:0,data:[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}]},"🮀":{type:0,data:[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}]},"🮁":{type:0,data:[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}]},"🮂":{type:0,data:[{x:0,y:0,w:8,h:2}]},"🮃":{type:0,data:[{x:0,y:0,w:8,h:3}]},"🮄":{type:0,data:[{x:0,y:0,w:8,h:5}]},"🮅":{type:0,data:[{x:0,y:0,w:8,h:6}]},"🮆":{type:0,data:[{x:0,y:0,w:8,h:7}]},"🮇":{type:0,data:[{x:6,y:0,w:2,h:8}]},"🮈":{type:0,data:[{x:5,y:0,w:3,h:8}]},"🮉":{type:0,data:[{x:3,y:0,w:5,h:8}]},"🮊":{type:0,data:[{x:2,y:0,w:6,h:8}]},"🮋":{type:0,data:[{x:1,y:0,w:7,h:8}]},"🮌":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L0.5,0 L0.5,1 L0,1 Z"},"🮍":{type:1,data:[[1,0],[0,1]],clipPath:"M0.5,0 L1,0 L1,1 L0.5,1 Z"},"🮎":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L1,0 L1,0.5 L0,0.5 Z"},"🮏":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0.5 L1,0.5 L1,1 L0,1 Z"},"🮐":{type:1,data:[[0,1],[1,0]]},"🮑":[{type:1,data:[[0,1],[1,0]],clipPath:"M0,0.5 L1,0.5 L1,1 L0,1 Z"},{type:0,data:[{x:0,y:0,w:8,h:4}]}],"🮒":[{type:1,data:[[0,1],[1,0]],clipPath:"M0,0 L1,0 L1,0.5 L0,0.5 Z"},{type:0,data:[{x:0,y:4,w:8,h:4}]}],"🮔":[{type:1,data:[[0,1],[1,0]],clipPath:"M0,0 L0.5,0 L0.5,1 L0,1 Z"},{type:0,data:[{x:4,y:0,w:4,h:8}]}],"🮕":{type:0,data:[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}]},"🮖":{type:0,data:[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}]},"🮗":{type:0,data:[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},"🮘":{type:2,data:"M-0.25,-0.25 L1.25,1.25 M-0.25,0 L1,1.25 M-0.25,0.25 L0.75,1.25 M-0.25,0.5 L0.5,1.25 M0,-0.25 L1.25,1 M0.25,-0.25 L1.25,0.75 M0.5,-0.25 L1.25,0.5 M-0.25,0.75 L0.25,1.25 M0.75,-0.25 L1.25,0.25",strokeWidth:1},"🮙":{type:2,data:"M-0.25,0.5 L0.5,-0.25 M-0.25,0.75 L0.75,-0.25 M-0.25,1 L1,-0.25 M-0.25,1.25 L1.25,-0.25 M0,1.25 L1.25,0 M0.25,1.25 L1.25,0.25 M0.5,1.25 L1.25,0.5 M-0.25,0.25 L0.25,-0.25 M0.75,1.25 L1.25,0.75",strokeWidth:1},"🮚":{type:5,data:{d:"M0,0 L.5,.5 L0,1 L1,1 L.5,.5 L1,0",type:0}},"🮛":{type:5,data:{d:"M0,0 L.5,.5 L1,0 L1,1 L.5,.5 L0,1",type:0}},"🮜":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L1,0 L0,1 Z"},"🮝":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L1,0 L1,1 Z"},"🮞":{type:1,data:[[1,0],[0,1]],clipPath:"M1,0 L1,1 L0,1 Z"},"🮟":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L1,1 L0,1 Z"},"🮠":{type:2,data:"M.5,0 L0,.5",strokeWidth:1},"🮡":{type:2,data:"M.5,0 L1,.5",strokeWidth:1},"🮢":{type:2,data:"M0,.5 L.5,1",strokeWidth:1},"🮣":{type:2,data:"M1,.5 L.5,1",strokeWidth:1},"🮤":{type:2,data:"M.5,0 L0,.5 L.5,1",strokeWidth:1},"🮥":{type:2,data:"M.5,0 L1,.5 L.5,1",strokeWidth:1},"🮦":{type:2,data:"M0,.5 L.5,1 L1,.5",strokeWidth:1},"🮧":{type:2,data:"M0,.5 L.5,0 L1,.5",strokeWidth:1},"🮨":{type:2,data:"M.5,0 L0,.5 M1,.5 L.5,1",strokeWidth:1},"🮩":{type:2,data:"M.5,0 L1,.5 M0,.5 L.5,1",strokeWidth:1},"🮪":{type:2,data:"M.5,0 L1,.5 L.5,1 L0,.5",strokeWidth:1},"🮫":{type:2,data:"M.5,0 L0,.5 L.5,1 L1,.5",strokeWidth:1},"🮬":{type:2,data:"M0,.5 L.5,0 L1,.5 L.5,1",strokeWidth:1},"🮭":{type:2,data:"M1,.5 L.5,0 L0,.5 L.5,1",strokeWidth:1},"🮮":{type:2,data:"M.5,0 L1,.5 L.5,1 L0,.5 Z",strokeWidth:1},"🮯":{type:2,data:"M0,.5 L1,.5 M.5,.35 L.5,.65",strokeWidth:1},"🮰":{type:3,data:"M0.1,0.2 L0.1,.8 L.4,.6 L.9,0.6 Z",scaleType:1},"🮱":{type:4,data:{d:"M.1,.525 L.35,.675 L.9,.35",type:1},scaleType:1},"🮲":{type:3,data:"M.29,.27 L0.13,.56 L.22,.59 L.35,0.35 L.67,.35 L.57,.57 L.71,.76 L.22,.76 L.42,1 L.53,.98 L.43,.86 L.9,.86 L.71,.6 L1,.6 L1,.52 L.83,.52 L.92,.36 L1,.36 L1,.27Z M.99,.13 A.12,.12,0,1,1,.75,.13 A.12,.12,0,1,1,.99,.13"},"🮳":{type:3,data:"M0,.27 L.3,.27 L.55,.12 L.63,.18 L.33,.36 L0,.36 M0,.52 L.33,.52 L.59,.89 L.73,.89 L.73,.98 L.53,.98 L.28,.6 L0,.6"},"🮴":{type:4,data:{d:"M.15,.55 L.5,.4 L.5,.45 L.65,.45 L.65,.35 L.85,.35 L.85,.625 L.5,.625 L.5,.7 Z",type:0},scaleType:1},"🮵":[{type:5,data:{d:"M0,0 L1,0 L1,.0625 L0,.0625 Z M0,.9375 L1,.9375 L1,1 L0,1 Z",type:0}},{type:5,data:{d:"M.15,.5 L.5,.35 L.5,.425 L.85,.425 L.85,.575 L.5,.575 L.5,.65 Z",type:0},scaleType:1}],"🮶":[{type:5,data:{d:"M0,0 L1,0 L1,.0625 L0,.0625 Z M0,.9375 L1,.9375 L1,1 L0,1 Z",type:0}},{type:5,data:{d:"M.85,.5 L.5,.35 L.5,.425 L.15,.425 L.15,.575 L.5,.575 L.5,.65 Z",type:0},scaleType:1}],"🮷":[{type:5,data:{d:"M.875,0 L1,0 L1,1 L.875,1 Z",type:0}},{type:5,data:{d:"M.5,.675 L.2,.5 L.35,.5 L.35,.325 L.65,.325 L.65,.5 L.8,.5 Z",type:0},scaleType:1}],"🮸":[{type:5,data:{d:"M.875,0 L1,0 L1,1 L.875,1 Z",type:0}},{type:5,data:{d:"M.5,.325 L.2,.5 L.35,.5 L.35,.675 L.65,.675 L.65,.5 L.8,.5 Z",type:0},scaleType:1}],"🮹":{type:5,data:{d:"M1,.89 L.11,.89 L.11,.37 L.36,.12 L.74,.12 L.96,.34 L1,.34 L1,.405 L.92,.405 L.69,.185 L.41,.185 L.21,.42 L.21,.825 L1,.825 Z",type:0}},"🮺":{type:5,data:{d:"M0,.89 L0,.825 L.78,.825 L.78,.53 L.7,.415 L0,.415 L0,.35 L.75,.35 L.88,.48 L.88,.89 Z",type:0}},"🮻":{type:5,data:{d:"M.31,.275 L.44,.275 L.44,.47 L.05,.47 L.05,.405 L.31,.405 Z M.56,.275 L.69,.275 L.69,.405 L.95,.405 L.95,.47 L.56,.47 Z M.05,.53 L.44,.53 L.44,.725 L.31,.725 L.31,.595 L.05,.595 Z M.56,.53 L.95,.53 L.95,.595 L.69,.595 L.69,.725 L.56,.725 Z",type:0},scaleType:1},"🮼":[{type:3,data:"M0,0 L1,0 L1,1 L0,1 L0,.935 L.885,.935 L.885,.065 L0,.065 Z"},{type:3,data:"M.67,.5 A.17,.085,0,1,1,.33,.5 A.17,.085,0,1,1,.67,.5",scaleType:1}],"🮽":{type:4,data:{d:"M0,0 L.5,.5 L1,0 L1,1 L.5,.5 L0,1 Z",type:1}},"🮾":{type:4,data:{d:"M1,.5 L.5,1",type:1}},"🮿":{type:4,data:{d:"M.5,0 L1,.5 L.5,1 L0,.5 Z",type:1}},"🯀":{type:3,data:"M.16,.445 A.02,.01,0,0,1,.39,.33 L.5,.375 L.61,.33 A.02,.01,0,0,1,.84,.445 L.75,.5 L.84,.555 A.02,.01,0,0,1,.61,.67 L.5,.625 L.39,.67 A.02,.01,0,0,1,.16,.555 L.25,.5 Z M.24,.41 L.39,.5 L.24,.59 L.32,.63 L.5,.555 L.68,.63 L.76,.59 L.61,.5 L.76,.41 L.68,.37 L.5,.445 L.32,.37 Z",scaleType:1},"🯁":{type:3,data:"M0.142308,0.924 Q0.130770,0.924,0.120193,0.922 T0.101924,0.916 T0.089424,0.9065 T0.084616,0.895 V0.025 Q0.084616,0.019,0.089424,0.0135 T0.101924,0.004 T0.120193,-0.002 T0.142308,-0.004 Q0.150000,-0.004,0.157693,-0.003 T0.173078,0.000 L0.430770,0.085 Q0.451924,0.059,0.494232,0.041 T0.587501,0.013 T0.692309,-0.0005 T0.800001,-0.004 H1 V0.055 H0.800001 Q0.771155,0.055,0.742309,0.056 T0.685578,0.060 T0.630770,0.0685 T0.580770,0.0825 T0.543270,0.1045 T0.528847,0.133 V0.647 H0.530770 Q0.596155,0.645,0.659616,0.638 T0.782693,0.6165 T0.893270,0.5805 T1,0.531 V0.623 Q0.934616,0.644,0.880770,0.6595 T0.769232,0.685 T0.650963,0.700 T0.528847,0.707 V0.787 Q0.528847,0.802,0.543270,0.8155 T0.580770,0.8375 T0.630770,0.8515 T0.685578,0.860 T0.742309,0.864 T0.800001,0.865 H1 V0.924 H0.800001 Q0.746155,0.924,0.692309,0.9205 T0.587501,0.907 T0.494232,0.879 T0.430770,0.835 L0.173078,0.920 Q0.165386,0.922,0.157693,0.923 T0.142308,0.924 Z M0.2,0.841 L0.415385,0.770 V0.150 L0.2,0.079 V0.841 Z M1,0.698 Q0.973077,0.694,0.969231,0.6885 T0.965385,0.677 Q0.965385,0.672,0.969231,0.6665 T1,0.657 V0.698 Z"},"🯂":{type:3,data:"M0,0.623 V0.531 Q0.044231,0.512,0.0625,0.4905 T0.092308,0.4465 T0.108654,0.4005 T0.113462,0.354 V0.351 Q0.113462,0.345,0.117308,0.3395 T0.129808,0.3305 T0.148846,0.3245 T0.171154,0.323 H0.501923 Q0.532692,0.323,0.563462,0.3185 T0.617308,0.303 T0.651923,0.2765 T0.663462,0.2435 V0.241 Q0.663462,0.219,0.657692,0.197 T0.639423,0.1545 T0.604808,0.115 T0.549615,0.082 T0.475577,0.0615 T0.392308,0.055 H0 V-0.004 H1 V0.055 H0.667308 Q0.694231,0.071,0.713462,0.09 T0.746154,0.129 T0.766346,0.1705 T0.775,0.213 H1 V0.316 Q0.971154,0.305,0.955769,0.2965 T0.920192,0.2825 T0.876923,0.2745 T0.830769,0.272 H0.773077 Q0.767308,0.297,0.743269,0.319 T0.680769,0.355 T0.595192,0.375 T0.501923,0.381 H0.227308 Q0.223462,0.415,0.211,0.4485 T0.172692,0.5135 T0.108269,0.573 T0,0.623 Z M0.611538,0.924 H0 V0.865 H0.611538 Q0.642308,0.865,0.673077,0.8605 T0.727885,0.845 T0.762308,0.8185 T0.773077,0.787 V0.785 Q0.773077,0.769,0.762308,0.7535 T0.727885,0.727 T0.673077,0.7115 T0.611538,0.707 H0.059615 Q0.048077,0.707,0.037115,0.7045 T0,0.694 V0.653 Q0.026923,0.648,0.037115,0.646 T0.059615,0.644 H0.722692 Q0.753462,0.644,0.784231,0.6395 T0.839038,0.624 T0.873846,0.5975 T0.884615,0.566 V0.564 Q0.884615,0.548,0.873846,0.532 T0.839038,0.5055 T0.784231,0.49 T0.722692,0.4855 H0.392308 Q0.380769,0.4855,0.370192,0.483 T0.351923,0.4765 T0.339423,0.467 T0.334615,0.4555 T0.339423,0.444 T0.351923,0.4345 T0.370192,0.428 T0.392308,0.4255 H0.832692 Q0.855769,0.4255,0.878846,0.4235 T0.922115,0.416 T0.957692,0.4015 T1,0.3815 V0.4685 Q0.975,0.4705,0.966346,0.4725 T0.95,0.4765 Q0.961538,0.4835,0.969231,0.4915 T1,0.5075 V0.6205 Q0.965385,0.6455,0.926923,0.665 T0.84,0.6935 Q0.866923,0.7115,0.877596,0.7345 T0.894231,0.7855 V0.787 Q0.894231,0.815,0.876923,0.8425 T0.820192,0.8895 T0.726923,0.916 T0.611538,0.924 Z"},"🯃":{type:3,data:"M0,0.473 V0.386 Q0.025490,0.378,0.028431,0.3695 T0.031373,0.352 V0.35 Q0.031373,0.342,0.028431,0.333 T0,0.316 V0.213 H0.652941 Q0.684314,0.213,0.715686,0.2085 T0.770588,0.193 T0.804902,0.1665 T0.815686,0.135 V0.133 Q0.815686,0.117,0.804902,0.101 T0.770588,0.0745 T0.715686,0.0595 T0.652941,0.055 H0 V-0.004 H0.652941 Q0.707843,-0.004,0.761765,0.004 T0.856863,0.031 T0.915686,0.0775 T0.933333,0.133 V0.135 Q0.933333,0.163,0.915686,0.1905 T0.856863,0.237 T0.761765,0.264 T0.652941,0.272 H0.109804 Q0.131373,0.29,0.140196,0.31 T0.149020,0.35 V0.352 Q0.149020,0.37,0.142157,0.388 T0.118627,0.4225 T0.076471,0.452 T0,0.473 Z M0,0.625 V0.513 Q0.029412,0.526,0.032353,0.54 T0.035294,0.568 V0.57 Q0.035294,0.584,0.032353,0.598 T0,0.625 Z"},"🯄":{type:3,data:"M0.019231,1.085 V-0.165 H0.980769 V1.085 H0.019231 Z M0.446154,0.527 H0.553846 Q0.553846,0.511,0.5625,0.495 T0.591346,0.466 T0.631731,0.4405 T0.666346,0.4135 T0.688462,0.3825 T0.696154,0.35 Q0.696154,0.33,0.682692,0.311 T0.641346,0.2785 T0.575,0.259 T0.498077,0.253 T0.421154,0.259 T0.356731,0.279 T0.315385,0.3125 T0.301923,0.352 V0.357 H0.409615 V0.354 Q0.409615,0.345,0.414423,0.335 T0.431731,0.318 T0.4625,0.3075 T0.498077,0.304 Q0.517308,0.304,0.534615,0.307 T0.564423,0.3165 T0.582692,0.332 T0.588462,0.35 Q0.588462,0.366,0.572115,0.3805 T0.535577,0.4075 T0.496154,0.4335 T0.465385,0.4625 T0.45,0.4945 T0.446154,0.527 Z M0.5,0.667 Q0.519231,0.667,0.5375,0.664 T0.569231,0.654 T0.588462,0.637 T0.594231,0.617 T0.588462,0.5975 T0.569231,0.581 T0.5375,0.571 T0.5,0.568 T0.4625,0.571 T0.430769,0.581 T0.411538,0.5975 T0.405769,0.617 T0.411538,0.637 T0.430769,0.654 T0.4625,0.664 T0.5,0.667 Z",scaleType:1},"🯅":{type:5,data:{d:"M.44,.425 L.44,.51 L.44,.56 L.19,.685 L.26,.72 L.5,.605 L.74,.72 L.81,.685 L.56,.56 L.56,.51 L.56,.425 Z M.17,.46 L.17,.51 L.83,.51 L.83,.46 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯆":{type:5,data:{d:"M.44,.425 L.44,.46 L.23,.385 L.19,.43 L.44,.51 L.44,.56 L.29,.71 L.38,.735 L.5,.605 L.61,.735 L.7,.71 L.56,.56 L.56,.51 L.81,.43 L.77,.385 L.56,.46 L.56,.425 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯇":{type:5,data:{d:"M.44,.425 L.44,.56 L.29,.71 L.38,.735 L.5,.605 L.74,.72 L.81,.685 L.56,.56 L.56,.425 Z M.18,.53 L.23,.575 L.81,.43 L.77,.385 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯈":{type:5,data:{d:"M.44,.425 L.44,.56 L.19,.685 L.26,.72 L.5,.605 L.62,.735 L.71,.71 L.56,.56 L.56,.425 Z M.23,.385 L.18,.43 L.77,.575 L.81,.53 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯉":{type:5,data:{d:"M.44,.425 L.45,.495 L.15,.645 L.34,.645 L.34,.7 L.44,.7 L.44,.645 L.56,.645 L.56,.7 L.66,.7 L.66,.645 L.84,.645 L.54,.495 L.56,.425 Z M.39,.6 L.5,.55 L.60,.6 Z M.17,.46 L.17,.51 L.83,.51 L.83,.46 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯊":{type:5,data:{d:"M.26,.375 L.5,.255 L.74,.375 L.74,.665 L.5,.55 L.26,.665 Z M.37,.395 L.37,.54 L.5,.475 L.63,.54 L.63,.395 L.5,.33 Z",type:0},scaleType:1},"":{type:5,data:{d:"M.09,.41 L.32,.295 L.5,.375 L.68,.295 L.91,.41 L.75,.5 L.91,.59 L.68,.705 L.5,.625 L.32,.705 L.09,.59 L.25,.5 Z M.24,.41 L.39,.5 L.24,.59 L.32,.63 L.5,.555 L.68,.63 L.76,.59 L.61,.5 L.76,.41 L.68,.37 L.5,.445 L.32,.37 Z",type:0},scaleType:1},"":{type:5,data:{d:"M.55,.305 L.88,.305 L.88,.355 L.65,.355 L.65,.47 L.88,.47 L.88,.52 L.55,.52 Z",type:0},scaleType:1},"":{type:5,data:{d:"M.38,.39 L.5,.33 L.62,.39 L.62,.53 L.5,.47 L.38,.53 Z",type:0},scaleType:1},"":{type:3,data:"M0,0 L0.6667,0 L0.6667,1 L0,1 Z"},"":{type:3,data:"M0,0 L0.3333,0 L0.3333,1 L0,1 Z"},"":{type:2,data:"M1,.5 L0,1",strokeWidth:1},"":{type:2,data:"M1,0 L0,.5",strokeWidth:1},"":{type:2,data:"M0,0 L1,.5",strokeWidth:1},"":{type:2,data:"M0,.5 L1,1",strokeWidth:1},"":{type:2,data:"M0,0 L.5,1",strokeWidth:1},"":{type:2,data:"M.5,0 L1,1",strokeWidth:1},"":{type:2,data:"M1,0 L.5,1",strokeWidth:1},"":{type:2,data:"M.5,0 L0,1",strokeWidth:1},"":{type:2,data:"M0,0 L.5,.5 L1,0",strokeWidth:1},"":{type:2,data:"M1,0 L.5,.5 L1,1",strokeWidth:1},"":{type:2,data:"M0,1 L.5,.5 L1,1",strokeWidth:1},"":{type:2,data:"M0,0 L.5,.5 L0,1",strokeWidth:1},"":{type:2,data:"M0,0 L.5,1 L1,0",strokeWidth:1},"":{type:2,data:"M1,0 L0,.5 L1,1",strokeWidth:1},"":{type:2,data:"M0,1 L.5,0 L1,1",strokeWidth:1},"":{type:2,data:"M0,0 L1,.5 L0,1",strokeWidth:1},"":{type:5,data:{d:"M0,0 C0,.276,.224,.5,.5,.5 C.776,.5,1,.276,1,0",type:1}},"":{type:5,data:{d:"M1,0 C.724,0,.5,.224,.5,.5 C.5,.776,.724,1,1,1",type:1}},"":{type:5,data:{d:"M0,1 C0,.724,.224,.5,.5,.5 C.776,.5,1,.724,1,1",type:1}},"":{type:5,data:{d:"M0,0 C.276,0,.5,.224,.5,.5 C.5,.776,.276,1,0,1",type:1}},"":{type:0,data:[{x:2,y:0,w:4,h:4}]},"":{type:0,data:[{x:2,y:4,w:4,h:4}]},"":{type:0,data:[{x:0,y:2,w:4,h:4}]},"":{type:0,data:[{x:4,y:2,w:4,h:4}]},"":{type:5,data:{d:"M0,0 C0,.276,.224,.5,.5,.5 C.776,.5,1,.276,1,0 Z",type:0}},"":{type:5,data:{d:"M1,0 C.724,0,.5,.224,.5,.5 C.5,.776,.724,1,1,1 Z",type:0}},"":{type:5,data:{d:"M0,1 C0,.724,.224,.5,.5,.5 C.776,.5,1,.724,1,1 Z",type:0}},"":{type:5,data:{d:"M0,0 C.276,0,.5,.224,.5,.5 C.5,.776,.276,1,0,1 Z",type:0}},"":{type:5,data:{d:"M1,0 L.5,0 C.5,.276,.724,.5,1,.5 Z",type:0}},"":{type:5,data:{d:"M0,1 L.5,1 C.5,.724,.276,.5,0,.5 Z",type:0}},"":{type:5,data:{d:"M1,1 L1,.5 C.724,.5,.5,.724,.5,1 Z",type:0}},"":{type:5,data:{d:"M0,0 L0,.5 C.276,.5,.5,.276,.5,0 Z",type:0}},"🯰":{type:5,data:{d:Do(126),type:0},scaleType:1},"🯱":{type:5,data:{d:Do(48),type:0},scaleType:1},"🯲":{type:5,data:{d:Do(109),type:0},scaleType:1},"🯳":{type:5,data:{d:Do(121),type:0},scaleType:1},"🯴":{type:5,data:{d:Do(51),type:0},scaleType:1},"🯵":{type:5,data:{d:Do(91),type:0},scaleType:1},"🯶":{type:5,data:{d:Do(95),type:0},scaleType:1},"🯷":{type:5,data:{d:Do(114),type:0},scaleType:1},"🯸":{type:5,data:{d:Do(127),type:0},scaleType:1},"🯹":{type:5,data:{d:Do(123),type:0},scaleType:1},"":{type:5,data:{d:"M.5,.175 C.2,.175,.15,.305,.15,.435 L.05,.63 L.35,.63 C.35,.682,.42,.76,.5,.76 C.58,.76,.65,.682,.65,.63 L.95,.63 L.85,.435 C.85,.305,.8,.175,.5,.175 Z",type:0},scaleType:1},...Object.fromEntries(Array.from({length:256},(e,t)=>[String.fromCodePoint(10240+t),{type:6,data:t}]))},HT=new Set([9617,9618,9619,129932,129933,129934,129935,129936,129937,129938,129940,129948,129949,129950,129951]);function br(e){return{type:2,data:()=>{let t=[],r=[.375,.25,.375],n=[0,3/8,5/8];for(let i=0;i<3;i++){let l=e>>i*2&1,c=e>>i*2+1&1;l&&c?t.push(`M0,${n[i]} L1,${n[i]} L1,${n[i]+r[i]} L0,${n[i]+r[i]} Z`):l?t.push(`M0,${n[i]} L${.5},${n[i]} L${.5},${n[i]+r[i]} L0,${n[i]+r[i]} Z`):c&&t.push(`M${.5},${n[i]} L1,${n[i]} L1,${n[i]+r[i]} L${.5},${n[i]+r[i]} Z`)}return t.join(" ")}}}function Do(e){let t=[];if(e&64){let r=.21500000000000002,n=.95-.15-.015;t.push(`M${r},${.2125} L${r+.075},${.175} L${n-.075},${.175} L${n},${.2125} L${n-.075},${.25} L${r+.075},${.25} Z`)}if(e&32){let r=.7999999999999999,n=.95-.15/2,i=.95,l=.175+.075+.015,c=.5-.015;t.push(`M${n},${l} L${i},${l+.0375} L${i},${c-.0375} L${n},${c} L${r},${c-.0375} L${r},${l+.0375} Z`)}if(e&16){let r=.7999999999999999,n=.95-.15/2,i=.95,l=.5+.015,c=.825-.075-.015;t.push(`M${n},${l} L${i},${l+.0375} L${i},${c-.0375} L${n},${c} L${r},${c-.0375} L${r},${l+.0375} Z`)}if(e&8){let r=.21500000000000002,n=.95-.15-.015;t.push(`M${r},${.7875} L${r+.075},${.75} L${n-.075},${.75} L${n},${.7875} L${n-.075},${.825} L${r+.075},${.825} Z`)}if(e&4&&t.push(`M${.125},${.515} L${.2},${.515+.0375} L${.2},${.735-.0375} L${.125},${.735} L${.05},${.735-.0375} L${.05},${.515+.0375} Z`),e&2&&t.push(`M${.125},${.265} L${.2},${.265+.0375} L${.2},${.485-.0375} L${.125},${.485} L${.05},${.485-.0375} L${.05},${.265+.0375} Z`),e&1){let r=.21500000000000002,n=.95-.15-.015;t.push(`M${r},${.5} L${r+.075},${.4625} L${n-.075},${.4625} L${n},${.5} L${n-.075},${.5375} L${r+.075},${.5375} Z`)}return t.join(" ")}var pi=0,qs=0,Bo=!1,sl=!1,cd=!1,na,_0=0,WT=class{constructor(e,t,r,n,i,l){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=n,this._coreBrowserService=i,this._themeService=l,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,n,i){this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,qs=0,pi=0,sl=!1,Bo=!1,cd=!1,na=this._themeService.colors,_0=0;let l=e.getCode();if(l!==0&&e.extended.underlineStyle===4){let c=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));_0=t*n%(Math.round(c)*2)}if(_0===0&&HT.has(l)&&(_0=t*n%2*2+r*i%2),this._decorationService.forEachDecorationAtCell(t,r,"bottom",c=>{c.backgroundColorRGB&&(qs=c.backgroundColorRGB.rgba>>8&16777215,sl=!0),c.foregroundColorRGB&&(pi=c.foregroundColorRGB.rgba>>8&16777215,Bo=!0)}),cd=this._selectionRenderModel.isCellSelected(this._terminal,t,r),cd){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:qs=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:qs=(this.result.fg&16777215)<<8|255;break;default:qs=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:qs=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:qs=(this.result.bg&16777215)<<8|255;break}qs=lc.blend(qs,(this._coreBrowserService.isFocused?na.selectionBackgroundOpaque:na.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else qs=(this._coreBrowserService.isFocused?na.selectionBackgroundOpaque:na.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(sl=!0,na.selectionForeground&&(pi=na.selectionForeground.rgba>>8&16777215,Bo=!0),Ab(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)pi=(this._coreBrowserService.isFocused?na.selectionBackgroundOpaque:na.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:pi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:pi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:pi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:pi=(this.result.fg&16777215)<<8|255;break;default:pi=this._themeService.colors.foreground.rgba}pi=lc.blend(pi,(this._coreBrowserService.isFocused?na.selectionBackgroundOpaque:na.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Bo=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",c=>{c.backgroundColorRGB&&(qs=c.backgroundColorRGB.rgba>>8&16777215,sl=!0),c.foregroundColorRGB&&(pi=c.foregroundColorRGB.rgba>>8&16777215,Bo=!0)}),sl&&(cd?qs=e.bg&-16777216&-134217729|qs|50331648:qs=e.bg&-16777216|qs|50331648),Bo&&(pi=e.fg&-16777216&-67108865|pi|50331648),this.result.fg&67108864&&(sl&&!Bo&&((this.result.bg&50331648)===0?pi=this.result.fg&-134217728|na.background.rgba>>8&16777215&16777215|50331648:pi=this.result.fg&-134217728|this.result.bg&67108863,Bo=!0),!sl&&Bo&&((this.result.fg&50331648)===0?qs=this.result.bg&-67108864|na.foreground.rgba>>8&16777215&16777215|50331648:qs=this.result.bg&-67108864|this.result.fg&67108863,sl=!0)),na=void 0,this.result.bg=sl?qs:this.result.bg,this.result.fg=Bo?pi:this.result.fg,this.result.ext&=536870911,this.result.ext|=_0<<29&3758096384}},GT=.5,Tb=RT||MT?"bottom":"ideographic";function VT(e,t,r,n,i,l,c,h,p,g,x,b,w=0){let A=zT[t];if(A){let k=Array.isArray(A)?A:[A];for(let E of k)qT(e,E,r,n,i,l,c,h,p,g,x,b,w);return!0}return!1}function qT(e,t,r,n,i,l,c,h,p,g,x,b,w=0){let A=i,k=l,E=r,I=n;switch(t.scaleType===1&&(A=c,k=h,E=r+(i-c)/2,I=n+(l-h)/2),t.clipPath&&(e.save(),rC(e,t.clipPath,E,I,A,k)),t.type){case 0:YT(e,t.data,E,I,A,k);break;case 1:eC(e,t.data,E,I,A,k,w);break;case 2:tC(e,t.data,E,I,A,k,g,x,t.strokeWidth);break;case 3:KT(e,t.data,E,I,A,k,g,t.strokeWidth);break;case 4:JT(e,t.data,E,I,A,k,g,b);break;case 5:nC(e,t.data,E,I,A,k,p,g,x);break;case 6:ZT(e,t.data,E,I,A,k);break}t.clipPath&&e.restore()}function YT(e,t,r,n,i,l){for(let c=0;c<t.length;c++){let h=t[c],p=i/8,g=l/8;e.fillRect(r+h.x*p,n+h.y*g,h.w*p,h.h*g)}}var ag=new Uint8Array([1,0,1,2,1,4,5,0,5,2,5,4,1,6,5,6]);function ZT(e,t,r,n,i,l){let c=i/8,h=l*.1,p=l*.8/8,g=Math.min(c,p);for(let x=0;x<8;x++)if(t&1<<x){let b=ag[x*2],w=ag[x*2+1],A=r+(b+1)*c,k=n+h+(w+1)*p;e.beginPath(),e.arc(A,k,g,0,Math.PI*2),e.fill()}}function KT(e,t,r,n,i,l,c,h){let p=typeof t=="string"?t:t(0,0);e.beginPath();let g=0,x=0,b=0,w=0,A="";for(let k of p.split(" ")){let E=k[0],I=k.substring(1).split(",");if(E==="Z"){e.closePath(),A=E;continue}if(E==="V"){let Q=n+parseFloat(I[0])*l;e.lineTo(g,Q),x=Q,b=g,w=x,A=E;continue}if(E==="H"){let Q=r+parseFloat(I[0])*i;e.lineTo(Q,x),g=Q,b=g,w=x,A=E;continue}if(!I[0]||!I[1])continue;if(E==="A"){let Q=parseFloat(I[0])*i,j=parseFloat(I[1])*l,F=parseFloat(I[2])*Math.PI/180,V=parseInt(I[3],10),$=parseInt(I[4],10),te=r+parseFloat(I[5])*i,se=n+parseFloat(I[6])*l;XT(e,g,x,Q,j,F,V,$,te,se),g=te,x=se;continue}let M=I.map((Q,j)=>{let F=parseFloat(Q);return j%2===0?r+F*i:n+F*l});if(E==="M")e.moveTo(M[0],M[1]),g=M[0],x=M[1],b=g,w=x;else if(E==="L")e.lineTo(M[0],M[1]),g=M[0],x=M[1],b=g,w=x;else if(E==="Q")e.quadraticCurveTo(M[0],M[1],M[2],M[3]),b=M[0],w=M[1],g=M[2],x=M[3];else if(E==="T"){let Q,j;A==="Q"||A==="T"?(Q=2*g-b,j=2*x-w):(Q=g,j=x),e.quadraticCurveTo(Q,j,M[0],M[1]),b=Q,w=j,g=M[0],x=M[1]}else E==="C"&&(e.bezierCurveTo(M[0],M[1],M[2],M[3],M[4],M[5]),b=M[2],w=M[3],g=M[4],x=M[5]);A=E}h!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=c*h,e.stroke()):e.fill()}function XT(e,t,r,n,i,l,c,h,p,g){if(n===0||i===0){e.lineTo(p,g);return}n=Math.abs(n),i=Math.abs(i);let x=Math.cos(l),b=Math.sin(l),w=(t-p)/2,A=(r-g)/2,k=x*w+b*A,E=-b*w+x*A,I=n*n,M=i*i,Q=k*k,j=E*E,F=Q/I+j/M;if(F>1){let re=Math.sqrt(F);n*=re,i*=re,I=n*n,M=i*i}let V=(I*M-I*j-M*Q)/(I*j+M*Q);V<0&&(V=0);let $=(c===h?-1:1)*Math.sqrt(V),te=$*(n*E/i),se=$*-(i*k/n),qe=x*te-b*se+(t+p)/2,de=b*te+x*se+(r+g)/2,oe=(k-te)/n,Oe=(E-se)/i,et=(-k-te)/n,ce=(-E-se)/i,Be=Math.atan2(Oe,oe),ot=Math.atan2(ce,et)-Be;h===0&&ot>0?ot-=2*Math.PI:h===1&&ot<0&&(ot+=2*Math.PI);let Ie=Be+ot;e.ellipse(qe,de,n,i,l,Be,Ie,h===0)}function JT(e,t,r,n,i,l,c,h){e.save(),e.fillRect(r,n,i,l),h&&(e.fillStyle=h,e.strokeStyle=h),e.lineWidth=c,e.lineCap="square",e.beginPath();for(let p of t.d.split(" ")){let g=p[0],x=p.substring(1).split(",");if(!x[0]||!x[1]){g==="Z"&&e.closePath();continue}let b=x.map((w,A)=>{let k=parseFloat(w);return A%2===0?r+k*i:n+k*l});g==="M"?e.moveTo(b[0],b[1]):g==="L"&&e.lineTo(b[0],b[1])}t.type===1?e.stroke():e.fill(),e.restore()}var og=new Map;function eC(e,t,r,n,i,l,c=0){let h=og.get(t);h||(h=new Map,og.set(t,h));let p=e.fillStyle;if(typeof p!="string")throw new Error(`Unexpected fillStyle type "${p}"`);let g=h.get(p);if(!g){let w=t[0].length,A=t.length,k=e.canvas.ownerDocument.createElement("canvas");k.width=w,k.height=A;let E=Ms(k.getContext("2d")),I=new ImageData(w,A),M,Q,j,F;if(p.startsWith("#"))M=parseInt(p.slice(1,3),16),Q=parseInt(p.slice(3,5),16),j=parseInt(p.slice(5,7),16),F=p.length>7&&parseInt(p.slice(7,9),16)||1;else if(p.startsWith("rgba"))[M,Q,j,F]=p.substring(5,p.length-1).split(",").map(V=>parseFloat(V));else throw new Error(`Unexpected fillStyle color format "${p}" when drawing pattern glyph`);for(let V=0;V<A;V++)for(let $=0;$<w;$++)I.data[(V*w+$)*4]=M,I.data[(V*w+$)*4+1]=Q,I.data[(V*w+$)*4+2]=j,I.data[(V*w+$)*4+3]=t[V][$]*(F*255);E.putImageData(I,0,0),g=Ms(e.createPattern(k,null)),h.set(p,g)}let x=c>>1&1,b=c&1;x!==0||b!==0?g.setTransform(new DOMMatrix().translateSelf(-x,-b)):g.setTransform(new DOMMatrix),e.fillStyle=g,e.fillRect(r,n,i,l)}function tC(e,t,r,n,i,l,c,h,p){e.save(),e.beginPath(),e.rect(r,n,i,l),e.clip(),e.beginPath();let g;if(typeof t=="function"){let b=.15/l*i;g=t(.15,b)}else g=t;let x={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let b of g.split(" ")){let w=b[0];if(w==="Z"){e.closePath(),x.lastCommand=w;continue}let A=Cb[w];if(!A){h.error(`Could not find drawing instructions for "${w}"`);continue}let k=b.substring(1).split(",");!k[0]||!k[1]||(A(e,Sb(k,i,l,r,n,!0,c,0,0,!1),x),x.lastCommand=w)}p!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=c*p,e.stroke()):e.fill(),e.closePath(),e.restore()}function rC(e,t,r,n,i,l){e.beginPath();for(let c of t.split(" ")){let h=c[0];if(h==="Z"){e.closePath();continue}let p=c.substring(1).split(",");if(!p[0]||!p[1])continue;let g=r+parseFloat(p[0])*i,x=n+parseFloat(p[1])*l;h==="M"?e.moveTo(g,x):h==="L"&&e.lineTo(g,x)}e.clip()}function nC(e,t,r,n,i,l,c,h,p){let g=new Path2D;g.rect(r,n,i,l),e.clip(g),e.beginPath();let x=c/12;e.lineWidth=h*x;let b={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let w of t.d.split(" ")){let A=w[0];if(A==="Z"){e.closePath(),b.lastCommand=A;continue}let k=Cb[A];if(!k){p.error(`Could not find drawing instructions for "${A}"`);continue}let E=w.substring(1).split(",");!E[0]||!E[1]||(k(e,Sb(E,i,l,r,n,!1,h,(t.leftPadding??0)*(x/2),(t.rightPadding??0)*(x/2)),b),b.lastCommand=A)}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function lg(e,t,r=0){return Math.max(Math.min(e,t),r)}var Cb={C:(e,t,r)=>{e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),r.lastControlX=t[2],r.lastControlY=t[3],r.currentX=t[4],r.currentY=t[5]},L:(e,t,r)=>{e.lineTo(t[0],t[1]),r.lastControlX=r.currentX=t[0],r.lastControlY=r.currentY=t[1]},M:(e,t,r)=>{e.moveTo(t[0],t[1]),r.lastControlX=r.currentX=t[0],r.lastControlY=r.currentY=t[1]},Q:(e,t,r)=>{e.quadraticCurveTo(t[0],t[1],t[2],t[3]),r.lastControlX=t[0],r.lastControlY=t[1],r.currentX=t[2],r.currentY=t[3]},T:(e,t,r)=>{let n,i;r.lastCommand==="Q"||r.lastCommand==="T"?(n=2*r.currentX-r.lastControlX,i=2*r.currentY-r.lastControlY):(n=r.currentX,i=r.currentY),e.quadraticCurveTo(n,i,t[0],t[1]),r.lastControlX=n,r.lastControlY=i,r.currentX=t[0],r.currentY=t[1]}};function Sb(e,t,r,n,i,l,c,h=0,p=0,g=!0){let x=e.map(b=>parseFloat(b)||parseInt(b));if(x.length<2)throw new Error("Too few arguments for instruction");for(let b=0;b<x.length;b+=2){if(x[b]*=t-h*c-p*c,l&&x[b]!==0){let w=Math.round(x[b]+.5)-.5;x[b]=g?lg(w,t,0):w}x[b]+=n+h*c}for(let b=1;b<x.length;b+=2){if(x[b]*=r,l&&x[b]!==0){let w=Math.round(x[b]+.5)-.5;x[b]=g?lg(w,r,0):w}x[b]+=i}return x}var cg=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},ug=class{constructor(){this._data=new cg}set(e,t,r,n,i){this._data.get(e,t)||this._data.set(e,t,new cg),this._data.get(e,t).set(r,n,i)}get(e,t,r,n){return this._data.get(e,t)?.get(r,n)}clear(){this._data.clear()}},_b=class{constructor(e){this._tasks=[],this._i=0,this._logService=e}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t,r=0,n=e.timeRemaining(),i;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),i=e.timeRemaining(),r*1.5>i){n-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=i}this.clear()}},sC=class extends _b{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let r=performance.now()+t;return{timeRemaining:()=>Math.max(0,r-performance.now())}}},iC=class extends _b{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},aC="requestIdleCallback"in globalThis?iC:sC,$c=class Lb{constructor(){this.fg=0,this.bg=0,this.extended=new kb}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new Lb;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},kb=class Ib{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Ib(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},_o=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,n)=>{if(this._disposed)return Ps(()=>{});let i={fn:t,thisArgs:r};this._listeners.push(i);let l=Ps(()=>{let c=this._listeners.indexOf(i);c!==-1&&this._listeners.splice(c,1)});return n&&(Array.isArray(n)?n.push(l):n.add(l)),l},this._event)}fire(t){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:r,thisArgs:n}=this._listeners[0];r.call(n,t);return}default:{let r=this._listeners.slice();for(let{fn:n,thisArgs:i}of r)n.call(i,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},ic;(e=>{function t(l,c){return l(h=>c.fire(h))}e.forward=t;function r(l,c){return(h,p,g)=>l(x=>h.call(p,c(x)),void 0,g)}e.map=r;function n(...l){return(c,h,p)=>{let g=new yb;for(let x of l)g.add(x(b=>c.call(h,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function i(l,c,h){return c(h),l(p=>c(p))}e.runAndSubscribe=i})(ic||={});var dg={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},L0=2,k0,Nl=class Pc{constructor(t,r,n,i){this._document=t,this._config=r,this._unicodeService=n,this._logService=i,this._didWarmUp=!1,this._cacheMap=new ug,this._cacheMapCombined=new ug,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new $c,this._textureSize=512,this._onAddTextureAtlasCanvas=new _o,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new _o,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=Nb(t,this._config.deviceCellWidth*4+L0*2,this._config.deviceCellHeight+L0*2),this._tmpCtx=Ms(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose(),this._onRemoveTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new aC(this._logService);for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let n=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,n)}})}beginFrame(){let t=this._requestClearModel;return this._requestClearModel=!1,t}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Pc.maxAtlasPages&&this._pages.length>=Math.max(4,Pc.maxAtlasPages)){let r=this._pages.filter(g=>g.canvas.width*2<=(Pc.maxTextureSize||4096)).sort((g,x)=>x.canvas.width!==g.canvas.width?x.canvas.width-g.canvas.width:x.percentageUsed-g.percentageUsed),n=-1,i=0;for(let g=0;g<r.length;g++)if(r[g].canvas.width!==i)n=g,i=r[g].canvas.width;else if(g-n===3)break;let l=r.slice(n,n+4);if(l.length<4||l.some(g=>g.canvas.width!==l[0].canvas.width)){let g=new Zl(this._document,this._textureSize);return this._pages.push(g),this._activePages.push(g),this._onAddTextureAtlasCanvas.fire(g.canvas),g}let c=l.map(g=>g.glyphs[0].texturePage).sort((g,x)=>g-x),h=this.pages.length-l.length,p=this._mergePages(l,h);p.version=++Zl.nextVersion;for(let g=c.length-1;g>=0;g--)this._deletePage(c[g]);this.pages.push(p),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(p.canvas)}let t=new Zl(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let n=t[0].canvas.width*2,i=new Zl(this._document,n,t);for(let[l,c]of t.entries()){let h=l*c.canvas.width%n,p=Math.floor(l/2)*c.canvas.height;i.ctx.drawImage(c.canvas,h,p);for(let x of c.glyphs)x.texturePage=r,x.sizeClipSpace.x=x.size.x/n,x.sizeClipSpace.y=x.size.y/n,x.texturePosition.x+=h,x.texturePosition.y+=p,x.texturePositionClipSpace.x=x.texturePosition.x/n,x.texturePositionClipSpace.y=x.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(c.canvas);let g=this._activePages.indexOf(c);g!==-1&&this._activePages.splice(g,1)}return i}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let n=this._pages[r];for(let i of n.glyphs)i.texturePage--;n.version=++Zl.nextVersion}}getRasterizedGlyphCombinedChar(t,r,n,i,l,c){return this._getFromCacheMap(this._cacheMapCombined,t,r,n,i,l,c)}getRasterizedGlyph(t,r,n,i,l,c){return this._getFromCacheMap(this._cacheMap,t,r,n,i,l,c)}_getFromCacheMap(t,r,n,i,l,c,h){return k0=t.get(r,n,i,l),k0||(k0=this._drawToCache(r,n,i,l,c,h),t.set(r,n,i,l,k0)),k0}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,r,n,i){if(this._config.allowTransparency)return ro;let l;switch(t){case 16777216:case 33554432:l=this._getColorFromAnsiIndex(r);break;case 50331648:let c=$c.toColorRGB(r);l=qi.toColor(c[0],c[1],c[2]);break;default:n?l=iu.opaque(this._config.colors.foreground):l=this._config.colors.background;break}return this._config.allowTransparency||(l=iu.opaque(l)),l}_getForegroundColor(t,r,n,i,l,c,h,p,g,x){let b=this._getMinimumContrastColor(t,r,n,i,l,c,h,g,p,x);if(b)return b;let w;switch(l){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&g&&c<8&&(c+=8),w=this._getColorFromAnsiIndex(c);break;case 50331648:let A=$c.toColorRGB(c);w=qi.toColor(A[0],A[1],A[2]);break;default:h?w=this._config.colors.background:w=this._config.colors.foreground}return this._config.allowTransparency&&(w=iu.opaque(w)),p&&(w=iu.multiplyOpacity(w,GT)),w}_resolveBackgroundRgba(t,r,n){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,n,i){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&i&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,n,i,l,c,h,p,g,x){if(this._config.minimumContrastRatio===1||x)return;let b=this._getContrastCache(g),w=b.getColor(t,i);if(w!==void 0)return w??void 0;let A=this._resolveBackgroundRgba(r,n,h),k=this._resolveForegroundRgba(l,c,h,p),E=lc.ensureContrastRatio(A,k,this._config.minimumContrastRatio/(g?2:1));if(!E){b.setColor(t,i,null);return}let I=qi.toColor(E>>24&255,E>>16&255,E>>8&255);return b.setColor(t,i,I),I}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,n,i,l,c){let h=typeof t=="number"?String.fromCharCode(t):t;c&&this._tmpCanvas.parentElement!==c&&(this._tmpCanvas.style.display="none",c.append(this._tmpCanvas));let p=Math.min(this._config.deviceCellWidth*Math.max(h.length,2)+L0*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<p&&(this._tmpCanvas.width=p);let g=Math.min(this._config.deviceCellHeight+L0*4,this._textureSize);if(this._tmpCanvas.height<g&&(this._tmpCanvas.height=g),this._tmpCtx.save(),this._workAttributeData.fg=n,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=i,!!this._workAttributeData.isInvisible())return dg;let x=!!this._workAttributeData.isBold(),b=!!this._workAttributeData.isInverse(),w=!!this._workAttributeData.isDim(),A=!!this._workAttributeData.isItalic(),k=!!this._workAttributeData.isUnderline(),E=!!this._workAttributeData.isStrikethrough(),I=!!this._workAttributeData.isOverline(),M=this._workAttributeData.getFgColor(),Q=this._workAttributeData.getFgColorMode(),j=this._workAttributeData.getBgColor(),F=this._workAttributeData.getBgColorMode();if(b){let _e=M;M=j,j=_e;let K=Q;Q=F,F=K}let V=this._getBackgroundColor(F,j,b,w);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=V.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let $=x?this._config.fontWeightBold:this._config.fontWeight,te=A?"italic":"";this._tmpCtx.font=`${te} ${$} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=Tb;let se=h.length===1&&k1(h.charCodeAt(0)),qe=h.length===1&&QT(h.charCodeAt(0)),de=this._getForegroundColor(r,F,j,n,Q,M,b,w,x,Ab(h.charCodeAt(0)));this._tmpCtx.fillStyle=de.css;let oe=qe?0:L0*2,Oe=!1;if(this._config.customGlyphs!==!1){let _e=this._workAttributeData.getUnderlineVariantOffset();Oe=VT(this._tmpCtx,h,oe,oe,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.deviceCharWidth,this._config.deviceCharHeight,this._config.fontSize,this._config.devicePixelRatio,this._logService,V.css,_e)}let et=!se,ce;if(typeof t=="number"?ce=this._unicodeService.wcwidth(t):ce=this._unicodeService.getStringCellWidth(t),k){this._tmpCtx.save();let _e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),K=_e%2===1?.5:0;if(this._tmpCtx.lineWidth=_e,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())et=!1,this._tmpCtx.strokeStyle=`rgb(${$c.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{et=!1;let Ke=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Ke<8&&(Ke+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Ke).css}this._tmpCtx.fillStyle=this._tmpCtx.strokeStyle,this._tmpCtx.beginPath();let Le=oe,fe=Math.ceil(oe+this._config.deviceCharHeight)-K-(l?_e*2:0),$e=fe+_e*2,ze=this._workAttributeData.getUnderlineVariantOffset(),Ee=0,ee=0;for(let Ke=0;Ke<ce;Ke++){let wt=!1;this._tmpCtx.save(),Ee=fe,ee=$e;let tt=Le+Ke*this._config.deviceCellWidth,ge=Le+(Ke+1)*this._config.deviceCellWidth;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(tt,fe),this._tmpCtx.lineTo(ge,fe),this._tmpCtx.moveTo(tt,$e),this._tmpCtx.lineTo(ge,$e);break;case 3:Ee=this._config.deviceCharHeight+1,ee=Ee+3*this._config.devicePixelRatio;let it=new Path2D;it.rect(tt,Ee,this._config.deviceCellWidth,ee-Ee),this._tmpCtx.clip(it);let ht=this._config.deviceCellWidth,Y=ee-Ee,be=ht/6,ut=Y/3,le=[[0,2,1,3,2.4,3,0,.6],[5.5,0,2.5,3,1.1,3,4.1,0],[4,0,6,2,6,.6,5.4,0]];for(let Bt of le){this._tmpCtx.beginPath();for(let Wt=0;Wt<Bt.length;Wt+=2){let lr=tt+Bt[Wt]*be,ur=ee-Bt[Wt+1]*ut;Wt===0?this._tmpCtx.moveTo(lr,ur):this._tmpCtx.lineTo(lr,ur)}this._tmpCtx.closePath(),this._tmpCtx.fill()}wt=!0;break;case 4:let pe=ze===0?0:ze>=_e?_e*2-ze:_e-ze;ze>=_e||pe===0?(this._tmpCtx.setLineDash([Math.round(_e),Math.round(_e)]),this._tmpCtx.moveTo(tt+pe,fe),this._tmpCtx.lineTo(ge,fe)):(this._tmpCtx.setLineDash([Math.round(_e),Math.round(_e)]),this._tmpCtx.moveTo(tt,fe),this._tmpCtx.lineTo(tt+pe,fe),this._tmpCtx.moveTo(tt+pe+_e,fe),this._tmpCtx.lineTo(ge,fe)),ze=UT(ge-tt,_e,ze);break;case 5:let je=.6,xt=.3,dt=ge-tt,Dt=Math.floor(je*dt),Xt=Math.floor(xt*dt),Ht=dt-Dt-Xt;this._tmpCtx.setLineDash([Dt,Xt,Ht]),this._tmpCtx.moveTo(tt,fe),this._tmpCtx.lineTo(ge,fe);break;default:this._tmpCtx.moveTo(tt,fe),this._tmpCtx.lineTo(ge,fe);break}wt||this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Oe&&this._config.fontSize>=12&&!this._config.allowTransparency&&h!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Ke=this._tmpCtx.measureText(h);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Ke&&Ke.actualBoundingBoxDescent>0){this._tmpCtx.save();let wt=new Path2D;wt.rect(Le,Ee-Math.ceil(_e/2),this._config.deviceCellWidth*ce,ee-Ee+Math.ceil(_e/2)),this._tmpCtx.clip(wt),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=V.css,this._tmpCtx.strokeText(h,oe,oe+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(I){let _e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),K=_e%2===1?.5:0;this._tmpCtx.lineWidth=_e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(oe,oe+K),this._tmpCtx.lineTo(oe+this._config.deviceCharWidth*ce,oe+K),this._tmpCtx.stroke()}if(Oe||this._tmpCtx.fillText(h,oe,oe+this._config.deviceCharHeight),h==="_"&&!this._config.allowTransparency){let _e=wf(this._tmpCtx.getImageData(oe,oe,this._config.deviceCellWidth,this._config.deviceCellHeight),V,de,et);if(_e)for(let K=1;K<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=V.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(h,oe,oe+this._config.deviceCharHeight-K),_e=wf(this._tmpCtx.getImageData(oe,oe,this._config.deviceCellWidth,this._config.deviceCellHeight),V,de,et),!!_e);K++);}if(E){let _e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),K=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=_e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(oe,oe+Math.floor(this._config.deviceCharHeight/2)-K),this._tmpCtx.lineTo(oe+this._config.deviceCharWidth*ce,oe+Math.floor(this._config.deviceCharHeight/2)-K),this._tmpCtx.stroke()}this._tmpCtx.restore();let Be=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),ot;if(this._config.allowTransparency?ot=oC(Be):ot=wf(Be,V,de,et),ot)return dg;let Ie=this._findGlyphBoundingBox(Be,this._workBoundingBox,p,qe,Oe,oe),re,Ue;for(;;){if(this._activePages.length===0){let _e=this._createNewPage();re=_e,Ue=_e.currentRow,Ue.height=Ie.size.y;break}re=this._activePages[this._activePages.length-1],Ue=re.currentRow;for(let _e of this._activePages)Ie.size.y<=_e.currentRow.height&&(re=_e,Ue=_e.currentRow);for(let _e=this._activePages.length-1;_e>=0;_e--)for(let K of this._activePages[_e].fixedRows)K.height<=Ue.height&&Ie.size.y<=K.height&&(re=this._activePages[_e],Ue=K);if(Ie.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Zl(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),re=this._overflowSizePage,Ue=this._overflowSizePage.currentRow,Ue.x+Ie.size.x>=re.canvas.width&&(Ue.x=0,Ue.y+=Ue.height,Ue.height=0);break}if(Ue.y+Ie.size.y>=re.canvas.height||Ue.height>Ie.size.y+2){let _e=!1;if(re.currentRow.y+re.currentRow.height+Ie.size.y>=re.canvas.height){let K;for(let Le of this._activePages)if(Le.currentRow.y+Le.currentRow.height+Ie.size.y<Le.canvas.height){K=Le;break}if(K)re=K;else if(Pc.maxAtlasPages&&this._pages.length>=Pc.maxAtlasPages&&Ue.y+Ie.size.y<=re.canvas.height&&Ue.height>=Ie.size.y&&Ue.x+Ie.size.x<=re.canvas.width)_e=!0;else{let Le=this._createNewPage();re=Le,Ue=Le.currentRow,Ue.height=Ie.size.y,_e=!0}}_e||(re.currentRow.height>0&&re.fixedRows.push(re.currentRow),Ue={x:0,y:re.currentRow.y+re.currentRow.height,height:Ie.size.y},re.fixedRows.push(Ue),re.currentRow={x:0,y:Ue.y+Ue.height,height:0})}if(Ue.x+Ie.size.x<=re.canvas.width)break;Ue===re.currentRow?(Ue.x=0,Ue.y+=Ue.height,Ue.height=0):re.fixedRows.splice(re.fixedRows.indexOf(Ue),1)}return Ie.texturePage=this._pages.indexOf(re),Ie.texturePosition.x=Ue.x,Ie.texturePosition.y=Ue.y,Ie.texturePositionClipSpace.x=Ue.x/re.canvas.width,Ie.texturePositionClipSpace.y=Ue.y/re.canvas.height,Ie.sizeClipSpace.x/=re.canvas.width,Ie.sizeClipSpace.y/=re.canvas.height,Ue.height=Math.max(Ue.height,Ie.size.y),Ue.x+=Ie.size.x,re.ctx.putImageData(Be,Ie.texturePosition.x-this._workBoundingBox.left,Ie.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,Ie.size.x,Ie.size.y),re.addGlyph(Ie),re.version=++Zl.nextVersion,Ie}_findGlyphBoundingBox(t,r,n,i,l,c){r.top=0;let h=i?this._config.deviceCellHeight:this._tmpCanvas.height,p=i?this._config.deviceCellWidth:n,g=!1;for(let x=0;x<h;x++){for(let b=0;b<p;b++){let w=x*this._tmpCanvas.width*4+b*4+3;if(t.data[w]!==0){r.top=x,g=!0;break}}if(g)break}r.left=0,g=!1;for(let x=0;x<c+p;x++){for(let b=0;b<h;b++){let w=b*this._tmpCanvas.width*4+x*4+3;if(t.data[w]!==0){r.left=x,g=!0;break}}if(g)break}r.right=p,g=!1;for(let x=c+p-1;x>=c;x--){for(let b=0;b<h;b++){let w=b*this._tmpCanvas.width*4+x*4+3;if(t.data[w]!==0){r.right=x,g=!0;break}}if(g)break}r.bottom=h,g=!1;for(let x=h-1;x>=0;x--){for(let b=0;b<p;b++){let w=x*this._tmpCanvas.width*4+b*4+3;if(t.data[w]!==0){r.bottom=x,g=!0;break}}if(g)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:r.right-r.left+1,y:r.bottom-r.top+1},sizeClipSpace:{x:r.right-r.left+1,y:r.bottom-r.top+1},offset:{x:-r.left+c+(i||l?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+c+(i||l?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Eb=class Op{constructor(t,r,n){if(this._usedPixels=0,this._glyphs=[],this.version=++Op.nextVersion,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],this.canvas=Nb(t,r,r),this.ctx=Ms(this.canvas.getContext("2d",{alpha:!0})),n)if(n.length===4)this._glyphs=this._glyphs.concat(n[0].glyphs,n[1].glyphs,n[2].glyphs,n[3].glyphs),this._usedPixels=n[0]._usedPixels+n[1]._usedPixels+n[2]._usedPixels+n[3]._usedPixels;else for(let i=0;i<n.length;++i)this._glyphs=this._glyphs.concat(n[i].glyphs),this._usedPixels+=n[i]._usedPixels}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version=++Op.nextVersion}};Eb.nextVersion=0;var Zl=Eb;function wf(e,t,r,n){let i=t.rgba>>>24,l=t.rgba>>>16&255,c=t.rgba>>>8&255,h=r.rgba>>>24,p=r.rgba>>>16&255,g=r.rgba>>>8&255,x=Math.floor((Math.abs(i-h)+Math.abs(l-p)+Math.abs(c-g))/12),b=!0;for(let w=0;w<e.data.length;w+=4)e.data[w]===i&&e.data[w+1]===l&&e.data[w+2]===c||n&&Math.abs(e.data[w]-i)+Math.abs(e.data[w+1]-l)+Math.abs(e.data[w+2]-c)<x?e.data[w+3]=0:b=!1;return b}function oC(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function Nb(e,t,r){let n=e.createElement("canvas");return n.width=t,n.height=r,n}function lC(e,t,r,n,i,l,c,h,p=!0){let g={foreground:l.foreground,background:l.background,cursor:ro,cursorAccent:ro,selectionForeground:ro,selectionBackgroundTransparent:ro,selectionBackgroundOpaque:ro,selectionInactiveBackgroundTransparent:ro,selectionInactiveBackgroundOpaque:ro,overviewRulerBorder:ro,scrollbarSliderBackground:ro,scrollbarSliderHoverBackground:ro,scrollbarSliderActiveBackground:ro,ansi:l.ansi.slice(),contrastCache:l.contrastCache,halfContrastCache:l.halfContrastCache};return{customGlyphs:p,devicePixelRatio:c,deviceMaxTextureSize:h,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:n,fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontWeightBold:i.fontWeightBold,allowTransparency:i.allowTransparency,drawBoldTextInBrightColors:i.drawBoldTextInBrightColors,minimumContrastRatio:i.minimumContrastRatio,colors:g}}function hg(e,t){for(let r=0;r<e.colors.ansi.length;r++)if(e.colors.ansi[r].rgba!==t.colors.ansi[r].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.deviceMaxTextureSize===t.deviceMaxTextureSize&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCellWidth===t.deviceCellWidth&&e.deviceCellHeight===t.deviceCellHeight&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function cC(e){return(e&50331648)===16777216||(e&50331648)===33554432}var so=[];function Rb(e,t,r,n,i,l,c,h,p,g=!0){let x=lC(n,i,l,c,t,r,h,p,g);for(let k=0;k<so.length;k++){let E=so[k],I=E.ownedBy.indexOf(e);if(I>=0){if(hg(E.config,x))return E.atlas;E.ownedBy.length===1?(E.atlas.dispose(),so.splice(k,1)):E.ownedBy.splice(I,1);break}}for(let k=0;k<so.length;k++){let E=so[k];if(hg(E.config,x))return E.ownedBy.push(e),E.atlas}let b=e._core,w=b._logService,A={atlas:new Nl(document,x,b.unicodeService,w),config:x,ownedBy:[e]};return so.push(A),A.atlas}function fg(e){for(let t=0;t<so.length;t++){let r=so[t].ownedBy.indexOf(e);if(r!==-1){so[t].ownedBy.length===1?(so[t].atlas.dispose(),so.splice(t,1)):so[t].ownedBy.splice(r,1);break}}}var uC=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._isIdlePaused=!1,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&(this._restartInterval(),this._resetIdleTimer())}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0),this._idleTimeout&&(this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0)}restartBlinkAnimation(){this._isIdlePaused&&this._resetIdleTimer(),!this.isPaused&&(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=600-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},e)}pause(){this.isCursorVisible=!0,this._isIdlePaused=!1,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0),this._idleTimeout&&(this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this._resetIdleTimer(),this.restartBlinkAnimation()}_resetIdleTimer(){this._isIdlePaused=!1,this._idleTimeout&&this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=this._coreBrowserService.window.setTimeout(()=>{this._stopBlinkingDueToIdle()},3e5)}_stopBlinkingDueToIdle(){this.isCursorVisible=!0,this._isIdlePaused=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0),this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0,this._renderCallback()}};function pg(e,t,r){let n=new t.ResizeObserver(i=>{let l=i.find(p=>p.target===e);if(!l)return;if(!("devicePixelContentBoxSize"in l)){n?.disconnect(),n=void 0;return}let c=l.devicePixelContentBoxSize[0].inlineSize,h=l.devicePixelContentBoxSize[0].blockSize;c>0&&h>0&&r(c,h)});try{n.observe(e,{box:["device-pixel-content-box"]})}catch{n.disconnect(),n=void 0}return Ps(()=>n?.disconnect())}function dC(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var hC=class Mb extends $c{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new kb,this.combinedData=""}static fromCharData(t){let r=new Mb;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?dC(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(n-55296)*1024+i-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}attributesEquals(t){if(this.getFgColorMode()!==t.getFgColorMode()||this.getFgColor()!==t.getFgColor()||this.getBgColorMode()!==t.getBgColorMode()||this.getBgColor()!==t.getBgColor()||this.isInverse()!==t.isInverse()||this.isBold()!==t.isBold()||this.isUnderline()!==t.isUnderline())return!1;if(this.isUnderline()){if(this.getUnderlineStyle()!==t.getUnderlineStyle())return!1;let r=this.isUnderlineColorDefault(),n=t.isUnderlineColorDefault();if(!(r&&n)&&(r!==n||this.getUnderlineColor()!==t.getUnderlineColor()||this.getUnderlineColorMode()!==t.getUnderlineColorMode()))return!1}return!(this.isOverline()!==t.isOverline()||this.isBlink()!==t.isBlink()||this.isInvisible()!==t.isInvisible()||this.isItalic()!==t.isItalic()||this.isDim()!==t.isDim()||this.isStrikethrough()!==t.isStrikethrough())}},fC=class extends mc{constructor(e,t,r){super(),this._renderCallback=e,this._coreBrowserService=t,this._optionsService=r,this._intervalDuration=0,this._blinkOn=!0,this._needsBlinkInViewport=!1,this._isViewportVisible=!0,this._register(this._optionsService.onSpecificOptionChange("blinkIntervalDuration",n=>{this.setIntervalDuration(n)})),this.setIntervalDuration(this._optionsService.rawOptions.blinkIntervalDuration),this._register(Ps(()=>this._clearInterval()))}get isBlinkOn(){return this._blinkOn}get isEnabled(){return this._intervalDuration>0}setNeedsBlinkInViewport(e){this._needsBlinkInViewport!==e&&(this._needsBlinkInViewport=e,this._updateIntervalState())}setViewportVisible(e){this._isViewportVisible!==e&&(this._isViewportVisible=e,this._updateIntervalState())}setIntervalDuration(e){e!==this._intervalDuration&&(this._intervalDuration=e,this._clearInterval(),this._updateIntervalState())}_updateIntervalState(){if(this._intervalDuration>0&&this._needsBlinkInViewport&&this._isViewportVisible){if(this._interval!==void 0)return;let e=this._blinkOn;this._blinkOn=!0,this._interval=this._coreBrowserService.window.setInterval(()=>{this._blinkOn=!this._blinkOn,this._renderCallback()},this._intervalDuration),e||this._renderCallback();return}this._clearInterval(),this._blinkOn||(this._blinkOn=!0,this._renderCallback())}_clearInterval(){this._interval!==void 0&&(this._coreBrowserService.window.clearInterval(this._interval),this._interval=void 0)}},Db=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function Bb(e,t,r,n){let i=Ms(e.createProgram());if(e.attachShader(i,Ms(mg(e,e.VERTEX_SHADER,t,n))),e.attachShader(i,Ms(mg(e,e.FRAGMENT_SHADER,r,n))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;n.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function mg(e,t,r,n){let i=Ms(e.createShader(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;n.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function pC(e,t){let r=Math.min(e.length*2,t),n=new Float32Array(r);for(let i=0;i<e.length;i++)n[i]=e[i];return n}var mC=class{constructor(t){this.texture=t,this.version=-1}},gC=`#version 300 es
|
|
4
|
-
layout (location = 0) in vec2 a_unitquad;
|
|
5
|
-
layout (location = 1) in vec2 a_cellpos;
|
|
6
|
-
layout (location = 2) in vec2 a_offset;
|
|
7
|
-
layout (location = 3) in vec2 a_size;
|
|
8
|
-
layout (location = 4) in float a_texpage;
|
|
9
|
-
layout (location = 5) in vec2 a_texcoord;
|
|
10
|
-
layout (location = 6) in vec2 a_texsize;
|
|
11
|
-
|
|
12
|
-
uniform mat4 u_projection;
|
|
13
|
-
uniform vec2 u_resolution;
|
|
14
|
-
|
|
15
|
-
out vec2 v_texcoord;
|
|
16
|
-
flat out int v_texpage;
|
|
17
|
-
|
|
18
|
-
void main() {
|
|
19
|
-
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
20
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
21
|
-
v_texpage = int(a_texpage);
|
|
22
|
-
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
23
|
-
}`;function xC(e){let t="";for(let r=1;r<e;r++)t+=` else if (v_texpage == ${r}) { outColor = texture(u_texture[${r}], v_texcoord); }`;return`#version 300 es
|
|
24
|
-
precision lowp float;
|
|
25
|
-
|
|
26
|
-
in vec2 v_texcoord;
|
|
27
|
-
flat in int v_texpage;
|
|
28
|
-
|
|
29
|
-
uniform sampler2D u_texture[${e}];
|
|
30
|
-
|
|
31
|
-
out vec4 outColor;
|
|
32
|
-
|
|
33
|
-
void main() {
|
|
34
|
-
if (v_texpage == 0) {
|
|
35
|
-
outColor = texture(u_texture[0], v_texcoord);
|
|
36
|
-
} ${t}
|
|
37
|
-
}`}var ys=0,as,Af=0,I0=0,bC=class extends mc{constructor(t,r,n,i,l){super(),this._terminal=t,this._gl=r,this._dimensions=n,this._optionsService=i,this._logService=l,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let c=this._gl;Nl.maxAtlasPages===void 0&&(Nl.maxAtlasPages=Math.min(32,Ms(c.getParameter(c.MAX_TEXTURE_IMAGE_UNITS))),Nl.maxTextureSize=Ms(c.getParameter(c.MAX_TEXTURE_SIZE))),this._program=Ms(Bb(c,gC,xC(Nl.maxAtlasPages),this._logService)),this._register(Ps(()=>c.deleteProgram(this._program))),this._projectionLocation=Ms(c.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Ms(c.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Ms(c.getUniformLocation(this._program,"u_texture"));let h=this._vertexArrayObject=c.createVertexArray();this._register(Ps(()=>c.deleteVertexArray(h))),c.bindVertexArray(h);let p=new Float32Array([0,0,1,0,0,1,1,1]),g=c.createBuffer();this._register(Ps(()=>c.deleteBuffer(g))),c.bindBuffer(c.ARRAY_BUFFER,g),c.bufferData(c.ARRAY_BUFFER,p,c.STATIC_DRAW),c.enableVertexAttribArray(0),c.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let x=new Uint8Array([0,1,2,3]),b=c.createBuffer();this._register(Ps(()=>c.deleteBuffer(b))),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,b),c.bufferData(c.ELEMENT_ARRAY_BUFFER,x,c.STATIC_DRAW),this._attributesBuffer=Ms(c.createBuffer()),this._register(Ps(()=>c.deleteBuffer(this._attributesBuffer))),c.bindBuffer(c.ARRAY_BUFFER,this._attributesBuffer),c.enableVertexAttribArray(2),c.vertexAttribPointer(2,2,c.FLOAT,!1,44,0),c.vertexAttribDivisor(2,1),c.enableVertexAttribArray(3),c.vertexAttribPointer(3,2,c.FLOAT,!1,44,2*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(3,1),c.enableVertexAttribArray(4),c.vertexAttribPointer(4,1,c.FLOAT,!1,44,4*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(4,1),c.enableVertexAttribArray(5),c.vertexAttribPointer(5,2,c.FLOAT,!1,44,5*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(5,1),c.enableVertexAttribArray(6),c.vertexAttribPointer(6,2,c.FLOAT,!1,44,7*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(6,1),c.enableVertexAttribArray(1),c.vertexAttribPointer(1,2,c.FLOAT,!1,44,9*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(1,1),c.useProgram(this._program);let w=new Int32Array(Nl.maxAtlasPages);for(let A=0;A<Nl.maxAtlasPages;A++)w[A]=A;c.uniform1iv(this._textureLocation,w),c.uniformMatrix4fv(this._projectionLocation,!1,Db),this._atlasTextures=[];for(let A=0;A<Nl.maxAtlasPages;A++){let k=new mC(Ms(c.createTexture()));this._register(Ps(()=>c.deleteTexture(k.texture))),c.activeTexture(c.TEXTURE0+A),c.bindTexture(c.TEXTURE_2D,k.texture),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,1,1,0,c.RGBA,c.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[A]=k}c.enable(c.BLEND),c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,r,n,i,l,c,h,p,g){this._updateCell(this._vertices.attributes,t,r,n,i,l,c,h,p,g)}_updateCell(t,r,n,i,l,c,h,p,g,x){if(ys=(n*this._terminal.cols+r)*11,i===0||i===void 0){t.fill(0,ys,ys+11-1-2);return}this._atlas&&(p&&p.length>1?as=this._atlas.getRasterizedGlyphCombinedChar(p,l,c,h,!1,this._terminal.element):as=this._atlas.getRasterizedGlyph(i,l,c,h,!1,this._terminal.element),Af=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),l!==x&&as.offset.x>Af?(I0=as.offset.x-Af,t[ys]=-(as.offset.x-I0)+this._dimensions.device.char.left,t[ys+1]=-as.offset.y+this._dimensions.device.char.top,t[ys+2]=(as.size.x-I0)/this._dimensions.device.canvas.width,t[ys+3]=as.size.y/this._dimensions.device.canvas.height,t[ys+4]=as.texturePage,t[ys+5]=as.texturePositionClipSpace.x+I0/this._atlas.pages[as.texturePage].canvas.width,t[ys+6]=as.texturePositionClipSpace.y,t[ys+7]=as.sizeClipSpace.x-I0/this._atlas.pages[as.texturePage].canvas.width,t[ys+8]=as.sizeClipSpace.y):(t[ys]=-as.offset.x+this._dimensions.device.char.left,t[ys+1]=-as.offset.y+this._dimensions.device.char.top,t[ys+2]=as.size.x/this._dimensions.device.canvas.width,t[ys+3]=as.size.y/this._dimensions.device.canvas.height,t[ys+4]=as.texturePage,t[ys+5]=as.texturePositionClipSpace.x,t[ys+6]=as.texturePositionClipSpace.y,t[ys+7]=as.sizeClipSpace.x,t[ys+8]=as.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&FT(i,g,as.size.x,this._dimensions.device.cell.width)&&(t[ys+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,r=t.cols*t.rows*11;this._vertices.count!==r?this._vertices.attributes=new Float32Array(r):this._vertices.attributes.fill(0);let n=0;for(;n<this._vertices.attributesBuffers.length;n++)this._vertices.count!==r?this._vertices.attributesBuffers[n]=new Float32Array(r):this._vertices.attributesBuffers[n].fill(0);this._vertices.count=r,n=0;for(let i=0;i<t.rows;i++)for(let l=0;l<t.cols;l++)this._vertices.attributes[n+9]=l/t.cols,this._vertices.attributes[n+10]=i/t.rows,n+=11}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,this._dimensions.device.canvas.width,this._dimensions.device.canvas.height),t.uniform2f(this._resolutionLocation,this._dimensions.device.canvas.width,this._dimensions.device.canvas.height),this.clear()}render(t){if(!this._atlas)return;let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let n=this._vertices.attributesBuffers[this._activeBuffer],i=0;for(let l=0;l<t.lineLengths.length;l++){let c=l*this._terminal.cols*11,h=this._vertices.attributes.subarray(c,c+t.lineLengths[l]*11);n.set(h,i),i+=h.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,n.subarray(0,i),r.STREAM_DRAW);for(let l=0;l<this._atlas.pages.length;l++)this._atlas.pages[l].version!==this._atlasTextures[l].version&&this._bindAtlasPageTexture(r,this._atlas,l);r.drawElementsInstanced(r.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,i/11)}setAtlas(t){this._atlas=t,this.invalidateAtlasTextures()}invalidateAtlasTextures(){for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(t,r,n){t.activeTexture(t.TEXTURE0+n),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[n].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r.pages[n].canvas),this._atlasTextures[n].version=r.pages[n].version}setDimensions(t){this._dimensions=t}},yC=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,r,n,i=!1){if(this.selectionStart=r,this.selectionEnd=n,!r||!n||r[0]===n[0]&&r[1]===n[1]){this.clear();return}let l=t.buffers.active.ydisp,c=r[1]-l,h=n[1]-l,p=Math.max(c,0),g=Math.min(h,t.rows-1);if(p>=t.rows||g<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=c,this.viewportEndRow=h,this.viewportCappedStartRow=p,this.viewportCappedEndRow=g,this.startCol=r[0],this.endCol=n[0]}isCellSelected(t,r,n){return this.hasSelection?(n-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?r>=this.startCol&&n>=this.viewportCappedStartRow&&r<this.endCol&&n<=this.viewportCappedEndRow:r<this.startCol&&n>=this.viewportCappedStartRow&&r>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&r>=this.startCol&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&r>=this.startCol):!1}};function vC(){return new yC}var wC=2147483648,AC=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=vC()}resize(t,r){let n=t*r*4;n!==this.cells.length&&(this.cells=new Uint32Array(n),this.lineLengths=new Uint32Array(r))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},TC=`#version 300 es
|
|
38
|
-
layout (location = 0) in vec2 a_position;
|
|
39
|
-
layout (location = 1) in vec2 a_size;
|
|
40
|
-
layout (location = 2) in vec4 a_color;
|
|
41
|
-
layout (location = 3) in vec2 a_unitquad;
|
|
42
|
-
|
|
43
|
-
uniform mat4 u_projection;
|
|
44
|
-
|
|
45
|
-
out vec4 v_color;
|
|
46
|
-
|
|
47
|
-
void main() {
|
|
48
|
-
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
49
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
50
|
-
v_color = a_color;
|
|
51
|
-
}`,CC=`#version 300 es
|
|
52
|
-
precision lowp float;
|
|
53
|
-
|
|
54
|
-
in vec4 v_color;
|
|
55
|
-
|
|
56
|
-
out vec4 outColor;
|
|
57
|
-
|
|
58
|
-
void main() {
|
|
59
|
-
outColor = v_color;
|
|
60
|
-
}`,Wo=8,Tf=Wo*Float32Array.BYTES_PER_ELEMENT,SC=20*Wo,gg=class{constructor(){this.attributes=new Float32Array(SC),this.count=0}},il=0,xg=0,bg=0,yg=0,vg=0,wg=0,Ag=0,_C=class extends mc{constructor(t,r,n,i,l){super(),this._terminal=t,this._gl=r,this._dimensions=n,this._themeService=i,this._logService=l,this._vertices=new gg,this._verticesCursor=new gg;let c=this._gl;this._program=Ms(Bb(c,TC,CC,this._logService)),this._register(Ps(()=>c.deleteProgram(this._program))),this._projectionLocation=Ms(c.getUniformLocation(this._program,"u_projection"));let h=this._vertexArrayObject=c.createVertexArray();this._register(Ps(()=>c.deleteVertexArray(h))),c.bindVertexArray(h);let p=new Float32Array([0,0,1,0,0,1,1,1]),g=c.createBuffer();this._register(Ps(()=>c.deleteBuffer(g))),c.bindBuffer(c.ARRAY_BUFFER,g),c.bufferData(c.ARRAY_BUFFER,p,c.STATIC_DRAW),c.enableVertexAttribArray(3),c.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let x=new Uint8Array([0,1,2,3]),b=c.createBuffer();this._register(Ps(()=>c.deleteBuffer(b))),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,b),c.bufferData(c.ELEMENT_ARRAY_BUFFER,x,c.STATIC_DRAW),this._attributesBuffer=Ms(c.createBuffer()),this._register(Ps(()=>c.deleteBuffer(this._attributesBuffer))),c.bindBuffer(c.ARRAY_BUFFER,this._attributesBuffer),c.enableVertexAttribArray(0),c.vertexAttribPointer(0,2,c.FLOAT,!1,Tf,0),c.vertexAttribDivisor(0,1),c.enableVertexAttribArray(1),c.vertexAttribPointer(1,2,c.FLOAT,!1,Tf,2*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(1,1),c.enableVertexAttribArray(2),c.vertexAttribPointer(2,4,c.FLOAT,!1,Tf,4*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(w=>{this._updateCachedColors(w),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),r.uniformMatrix4fv(this._projectionLocation,!1,Db),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,t.attributes,r.DYNAMIC_DRAW),r.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,t.count)}handleResize(){this._updateViewportRectangle()}setDimensions(t){this._dimensions=t}_updateCachedColors(t){this._bgFloat=this._colorToFloat32Array(t.background),this._cursorFloat=this._colorToFloat32Array(t.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(t){let r=this._terminal,n=this._vertices,i=1,l,c,h,p,g,x,b,w,A,k,E;for(l=0;l<r.rows;l++){for(h=-1,p=0,g=0,x=!1,c=0;c<r.cols;c++)b=(l*r.cols+c)*4,w=t.cells[b+1],A=t.cells[b+2],k=!!(A&67108864),(w!==p||A!==g&&(x||k))&&((p!==0||x&&g!==0)&&(E=i++*Wo,this._updateRectangle(n,E,g,p,h,c,l)),h=c,p=w,g=A,x=k);(p!==0||x&&g!==0)&&(E=i++*Wo,this._updateRectangle(n,E,g,p,h,r.cols,l))}n.count=i}updateCursor(t){let r=this._verticesCursor,n=t.cursor;if(!n||n.style==="block"){r.count=0;return}let i,l=0;(n.style==="bar"||n.style==="outline")&&(i=l++*Wo,this._addRectangleFloat(r.attributes,i,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style==="bar"?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style==="underline"||n.style==="outline")&&(i=l++*Wo,this._addRectangleFloat(r.attributes,i,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style==="outline"&&(i=l++*Wo,this._addRectangleFloat(r.attributes,i,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),i=l++*Wo,this._addRectangleFloat(r.attributes,i,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),r.count=l}_updateRectangle(t,r,n,i,l,c,h){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:il=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:il=(n&16777215)<<8;break;default:il=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:il=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:il=(i&16777215)<<8;break;default:il=this._themeService.colors.background.rgba}t.attributes.length<r+Wo&&(t.attributes=pC(t.attributes,(this._terminal.rows*this._terminal.cols+1)*Wo)),xg=l*this._dimensions.device.cell.width,bg=h*this._dimensions.device.cell.height,yg=(il>>24&255)/255,vg=(il>>16&255)/255,wg=(il>>8&255)/255,Ag=1,this._addRectangle(t.attributes,r,xg,bg,(c-l)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,yg,vg,wg,Ag)}_addRectangle(t,r,n,i,l,c,h,p,g,x){t[r]=n/this._dimensions.device.canvas.width,t[r+1]=i/this._dimensions.device.canvas.height,t[r+2]=l/this._dimensions.device.canvas.width,t[r+3]=c/this._dimensions.device.canvas.height,t[r+4]=h,t[r+5]=p,t[r+6]=g,t[r+7]=x}_addRectangleFloat(t,r,n,i,l,c,h){t[r]=n/this._dimensions.device.canvas.width,t[r+1]=i/this._dimensions.device.canvas.height,t[r+2]=l/this._dimensions.device.canvas.width,t[r+3]=c/this._dimensions.device.canvas.height,t[r+4]=h[0],t[r+5]=h[1],t[r+6]=h[2],t[r+7]=h[3]}_colorToFloat32Array(t){return new Float32Array([(t.rgba>>24&255)/255,(t.rgba>>16&255)/255,(t.rgba>>8&255)/255,(t.rgba&255)/255])}},LC=class extends mc{constructor(e,t,r,n,i,l,c,h){super(),this._container=t,this._alpha=i,this._coreBrowserService=l,this._optionsService=c,this._themeService=h,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${r}-layer`),this._canvas.style.zIndex=n.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(p=>{this._refreshCharAtlas(e,p),this.reset(e)})),this._register(Ps(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Ms(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,r){}handleSelectionChanged(e,t,r,n=!1){}_setTransparency(e,t){if(t===this._alpha)return;let r=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Rb(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,r=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,r,n){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,n*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,n*this._deviceCellHeight))}_fillCharTrueColor(e,t,r,n){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=Tb,this._clipCell(r,n,t.getWidth()),this._ctx.fillText(t.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,n*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,r){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,r){let n=t?e.options.fontWeightBold:e.options.fontWeight;return`${r?"italic":""} ${n} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},kC=class extends LC{constructor(t,r,n,i,l,c,h){super(n,t,"link",r,!0,l,c,h),this._register(i.onShowLinkUnderline(p=>this._handleShowLinkUnderline(p))),this._register(i.onHideLinkUnderline(p=>this._handleHideLinkUnderline(p)))}resize(t,r){super.resize(t,r),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&cC(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let r=t.y1+1;r<t.y2;r++)this._fillBottomLineAtCells(0,r,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},IC=class{constructor(t,r,n,i){this._node=t,this._type=r,this._handler=n,this._options=i,t.addEventListener(r,n,i)}dispose(){!this._node||!this._handler||(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Cf(e,t,r,n){return new IC(e,t,r,n)}var EC=class extends mc{constructor(e,t,r,n,i,l,c,h,p,g=!0,x){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=r,this._coreBrowserService=n,this._coreService=i,this._decorationService=l,this._logService=c,this._optionsService=h,this._themeService=p,this._customGlyphs=g,this._cursorBlinkStateManager=this._register(new S0),this._charAtlasDisposable=this._register(new S0),this._observerDisposable=this._register(new S0),this._model=new AC,this._rowHasBlinkingCells=[],this._rowHasBlinkingCellsCount=0,this._workCell=new hC,this._rectangleRenderer=this._register(new S0),this._glyphRenderer=this._register(new S0),this._onChangeTextureAtlas=this._register(new _o),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new _o),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new _o),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new _o),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new _o),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let b={antialias:!1,depth:!1,preserveDrawingBuffer:x};if(this._gl=this._canvas.getContext("webgl2",b),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new WT(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new kC(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,h,this._themeService)],this.dimensions=$T(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(h.onOptionChange(()=>this._handleOptionsChanged())),this._textBlinkStateManager=this._register(new fC(()=>this._requestRedrawViewport(),this._coreBrowserService,this._optionsService)),this._resetBlinkingRowState(),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Cf(this._canvas,"webglcontextlost",w=>{this._logService.debug("webglcontextlost event received"),w.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,this._logService.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(w)},3e3)})),this._register(Cf(this._canvas,"webglcontextrestored",w=>{this._logService.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,fg(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=pg(this._canvas,this._coreBrowserService.window,(w,A)=>this._setCanvasDevicePixelDimensions(w,A)),this._register(this._coreBrowserService.onWindowChange(w=>{this._observerDisposable.value=pg(this._canvas,w,(A,k)=>this._setCanvasDevicePixelDimensions(A,k))})),this._register(Cf(this._coreBrowserService.mainDocument,"mousedown",()=>this._cursorBlinkStateManager.value?.restartBlinkAnimation())),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Ps(()=>{clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0;for(let w of this._renderLayers)w.dispose();this._canvas.parentElement?.removeChild(this._canvas),fg(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows),this._resetBlinkingRowState();for(let r of this._renderLayers)r.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1),this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1,sync:!0})}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleViewportVisibilityChange(e){this._textBlinkStateManager.setViewportVisible(e)}handleSelectionChanged(e,t,r){for(let n of this._renderLayers)n.handleSelectionChanged(this._terminal,e,t,r);this._model.selection.update(this._core,e,t,r),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new _C(this._terminal,this._gl,this.dimensions,this._themeService,this._logService),this._glyphRenderer.value=new bC(this._terminal,this._gl,this.dimensions,this._optionsService,this._logService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=Rb(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize,this._customGlyphs);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=ET(ic.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),ic.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._resetBlinkingRowState(),this._textBlinkStateManager.setNeedsBlinkInViewport(!1),this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,e,t);if(!this._glyphRenderer.value||!this._rectangleRenderer.value)return;this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t);let r=!1,n=0;for(;this._charAtlas&&this._glyphRenderer.value.beginFrame()&&n++<32;)r=!0,this._clearModel(!0),this._updateModel(0,this._terminal.rows-1);r&&this._glyphRenderer.value.invalidateAtlasTextures(),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor()}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new uC(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,n=this._workCell,i,l,c,h,p,g,x,b,w,A,k,E,I,M,Q,j,F;e=Tg(e,r.rows-1,0),t=Tg(t,r.rows-1,0);let V=this._coreService.decPrivateModes.cursorStyle??r.options.cursorStyle??"block",$=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,te=$-r.buffer.ydisp,se=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),qe=-1,de=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let oe=!1;for(l=e;l<=t;l++){c=l+r.buffer.ydisp;let Oe=r.buffer.lines.get(c);if(!Oe){for(this._model.lineLengths[l]=0,j=0;j<r.cols;j++)F=(l*r.cols+j)*4,oe=!0,this._nullModelCell(j,l,F,0,0,0);this._setRowBlinkState(l,!1);continue}h=Oe;let et=!1;for(this._model.lineLengths[l]=0,k=$===c,x=0,p=this._characterJoinerService.getJoinedCharacters(c),j=0;j<r.cols;j++){if(i=this._cellColorResolver.result.bg,h.loadCell(j,n),j===0&&(i=this._cellColorResolver.result.bg),g=!1,b=j>=x,w=j,p.length>0&&j===p[0][0]&&b){A=p.shift();let ce=this._model.selection.isCellSelected(this._terminal,A[0],c);for(Q=A[0]+1;Q<A[1];Q++)b&&=ce===this._model.selection.isCellSelected(this._terminal,Q,c);b&&=!k||se<A[0]||se>=A[1],b?(g=!0,n=new NC(n,h.translateToString(!0,A[0],A[1]),A[1]-A[0]),w=A[1]-1):x=A[1]}if(E=n.getChars(),I=n.getCode(),Q=(l*r.cols+j)*4,!et&&n.isBlink()&&(et=!0),this._cellColorResolver.resolve(n,j,c,this.dimensions.device.cell.width,this.dimensions.device.cell.height),de&&c===$&&(j===se&&(this._model.cursor={x:se,y:te,width:n.getWidth(),style:this._coreBrowserService.isFocused?V:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},qe=se+n.getWidth()-1),j>=se&&j<=qe&&(this._coreBrowserService.isFocused&&V==="block"||this._coreBrowserService.isFocused===!1&&r.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),this._textBlinkStateManager.isEnabled&&!this._textBlinkStateManager.isBlinkOn&&n.isBlink()&&(this._cellColorResolver.result.fg|=1073741824),I!==0&&(this._model.lineLengths[l]=j+1),!(this._model.cells[Q]===I&&this._model.cells[Q+1]===this._cellColorResolver.result.bg&&this._model.cells[Q+2]===this._cellColorResolver.result.fg&&this._model.cells[Q+3]===this._cellColorResolver.result.ext)&&(oe=!0,E.length>1&&(I|=wC),this._model.cells[Q]=I,this._model.cells[Q+1]=this._cellColorResolver.result.bg,this._model.cells[Q+2]=this._cellColorResolver.result.fg,this._model.cells[Q+3]=this._cellColorResolver.result.ext,M=n.getWidth(),this._glyphRenderer.value.updateCell(j,l,I,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,E,M,i),g)){for(n=this._workCell,j++;j<=w;j++)F=(l*r.cols+j)*4,this._nullModelCell(j,l,F,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext);j--}}this._setRowBlinkState(l,et)}oe&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model),this._updateTextBlinkState()}_nullModelCell(e,t,r,n,i,l){this._glyphRenderer.value.updateCell(e,t,0,n,i,l,"",0,0),this._model.cells[r]=0,this._model.cells[r+1]=n,this._model.cells[r+2]=i,this._model.cells[r+3]=l}_resetBlinkingRowState(){this._rowHasBlinkingCells=new Array(this._terminal.rows).fill(!1),this._rowHasBlinkingCellsCount=0}_setRowBlinkState(e,t){this._rowHasBlinkingCells[e]!==t&&(this._rowHasBlinkingCells[e]=t,this._rowHasBlinkingCellsCount+=t?1:-1)}_updateTextBlinkState(){this._textBlinkStateManager.setNeedsBlinkInViewport(this._rowHasBlinkingCellsCount>0)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1,sync:!0}))}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},NC=class extends $c{constructor(t,r,n){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=r,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function Tg(e,t,r=0){return Math.max(Math.min(e,t),r)}var RC=class extends mc{constructor(e){if(wb&&DT()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw new Error("WebGL2 is only supported on Safari 16 and above")}super(),this._onChangeTextureAtlas=this._register(new _o),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new _o),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new _o),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new _o),this.onContextLoss=this._onContextLoss.event,this._customGlyphs=e?.customGlyphs??!0,this._preserveDrawingBuffer=e?.preserveDrawingBuffer}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let r=t.coreService,n=t.optionsService,i=t,l=i._renderService,c=i._characterJoinerService,h=i._charSizeService,p=i._coreBrowserService,g=i._decorationService,x=i._logService,b=i._themeService;this._renderer=this._register(new EC(e,c,h,p,r,g,x,n,b,this._customGlyphs,this._preserveDrawingBuffer)),this._register(ic.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(ic.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(ic.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(ic.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this._register(Ps(()=>{if(this._terminal._core._store._isDisposed)return;let w=this._terminal._core._renderService;w.setRenderer(this._terminal._core._createRenderer()),w.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var MC=class{constructor(t,r,n,i={}){this._terminal=t,this._regex=r,this._handler=n,this._options=i}provideLinks(t,r){let n=BC.computeLink(t,this._regex,this._terminal,this._handler);r(this._addCallbacks(n))}_addCallbacks(t){return t.map(r=>(r.leave=this._options.leave,r.hover=(n,i)=>{if(this._options.hover){let{range:l}=r;this._options.hover(n,i,l)}},r))}};function DC(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var BC=class Hd{static computeLink(t,r,n,i){let l=r.flags.includes("g")?r.flags:`${r.flags}g`,c=new RegExp(r.source,l),[h,p]=Hd._getWindowedLineStrings(t-1,n),g=h.join(""),x,b=[];for(;x=c.exec(g);){let w=x[0];if(!DC(w))continue;let[A,k]=Hd._mapStrIdx(n,p,0,x.index),[E,I]=Hd._mapStrIdx(n,A,k,w.length);if(A===-1||k===-1||E===-1||I===-1)continue;let M={start:{x:k+1,y:A+1},end:{x:I,y:E+1}};b.push({range:M,text:w,activate:i})}return b}static _getWindowedLineStrings(t,r){let n,i=t,l=t,c,h,p=[];if(n=r.buffer.active.getLine(t)){let g=n.translateToString(!0);if(n.isWrapped&&g[0]!==" "){for(c=0;(n=r.buffer.active.getLine(--i))&&c<2048&&(h=n.translateToString(!0),c+=h.length,p.push(h),!(!n.isWrapped||h.indexOf(" ")!==-1)););p.reverse()}for(p.push(g),c=0;(n=r.buffer.active.getLine(++l))&&n.isWrapped&&c<2048&&(h=n.translateToString(!0),c+=h.length,p.push(h),h.indexOf(" ")===-1););}return[p,i]}static _mapStrIdx(t,r,n,i){let l=t.buffer.active,c=l.getNullCell(),h=n;for(;i;){let p=l.getLine(r);if(!p)return[-1,-1];for(let g=h;g<p.length;++g){p.getCell(g,c);let x=c.getChars();if(c.getWidth()&&(i-=x.length||1,g===p.length-1&&x==="")){let b=l.getLine(r+1);b&&b.isWrapped&&(b.getCell(0,c),c.getWidth()===2&&(i+=1))}if(i<0)return[r,g]}r++,h=0}return[r,h]}},QC=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function jC(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var PC=class{constructor(t=jC,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,n=r.urlRegex??QC;this._linkProvider=this._terminal.registerLinkProvider(new MC(this._terminal,n,this._handler,r))}dispose(){this._linkProvider?.dispose()}};function Cg(e){return{dispose:e}}var OC=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.clear()}}clear(){for(let e of this._disposables)e.dispose();this._disposables.clear()}},FC=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,n)=>{if(this._disposed)return Cg(()=>{});let i={fn:t,thisArgs:r};this._listeners.push(i);let l=Cg(()=>{let c=this._listeners.indexOf(i);c!==-1&&this._listeners.splice(c,1)});return n&&(Array.isArray(n)?n.push(l):n.add(l)),l},this._event)}fire(t){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:r,thisArgs:n}=this._listeners[0];r.call(n,t);return}default:{let r=this._listeners.slice();for(let{fn:n,thisArgs:i}of r)n.call(i,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},$C;(e=>{function t(l,c){return l(h=>c.fire(h))}e.forward=t;function r(l,c){return(h,p,g)=>l(x=>h.call(p,c(x)),void 0,g)}e.map=r;function n(...l){return(c,h,p)=>{let g=new OC;for(let x of l)g.add(x(b=>c.call(h,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function i(l,c,h){return c(h),l(p=>c(p))}e.runAndSubscribe=i})($C||={});var Sg=class Wd{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new FC,this.onChange=this._onChange.event}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,n=!1){return(t&16777215)<<3|(r&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t,this._active||(this.activeVersion=t.version)}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,n=0,i=t.length;for(let l=0;l<i;++l){let c=t.charCodeAt(l);if(55296<=c&&c<=56319){if(++l>=i)return r+this.wcwidth(c);let g=t.charCodeAt(l);56320<=g&&g<=57343?c=(c-55296)*1024+g-56320+65536:r+=this.wcwidth(g)}let h=this.charProperties(c,n),p=Wd.extractWidth(h);Wd.extractShouldJoin(h)&&(p-=Wd.extractWidth(n)),r+=p,n=h}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},Sf=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],UC=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],_f=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],zC=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],al;function _g(e,t){let r=0,n=t.length-1,i;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=r;)if(i=r+n>>1,e>t[i][1])r=i+1;else if(e<t[i][0])n=i-1;else return!0;return!1}var HC=class{constructor(){if(this.version="11",!al){al=new Uint8Array(65536),al.fill(1),al[0]=0,al.fill(0,1,32),al.fill(0,127,160);for(let e=0;e<Sf.length;++e)al.fill(0,Sf[e][0],Sf[e][1]+1);for(let e=0;e<_f.length;++e)al.fill(2,_f[e][0],_f[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?al[e]:_g(e,UC)?0:_g(e,zC)?2:1}charProperties(e,t){let r=this.wcwidth(e),n=r===0&&t!==0;if(n){let i=Sg.extractWidth(t);i===0?n=!1:i>r&&(r=i)}return Sg.createPropertyValue(0,r,n)}},WC=class{activate(e){e.unicode.register(new HC)}dispose(){}};function fc(e){return{dispose:e}}function Gd(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function GC(...e){return fc(()=>Gd(e))}var Qb=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(t){return this._isDisposed?t.dispose():this._disposables.add(t),t}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let t of this._disposables)t.dispose();this._disposables.clear()}}clear(){for(let t of this._disposables)t.dispose();this._disposables.clear()}},Fu=class{constructor(){this._store=new Qb}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};Fu.None=Object.freeze({dispose(){}});var ch=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},Fp=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return fc(()=>{});let n={fn:e,thisArgs:t};this._listeners.push(n);let i=fc(()=>{let l=this._listeners.indexOf(n);l!==-1&&this._listeners.splice(l,1)});return r&&(Array.isArray(r)?r.push(i):r.add(i)),i},this._event)}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:r}=this._listeners[0];t.call(r,e);return}default:{let t=this._listeners.slice();for(let{fn:r,thisArgs:n}of t)r.call(n,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},VC;(e=>{function t(l,c){return l(h=>c.fire(h))}e.forward=t;function r(l,c){return(h,p,g)=>l(x=>h.call(p,c(x)),void 0,g)}e.map=r;function n(...l){return(c,h,p)=>{let g=new Qb;for(let x of l)g.add(x(b=>c.call(h,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function i(l,c,h){return c(h),l(p=>c(p))}e.runAndSubscribe=i})(VC||={});function jb(e,t=0,r){let n=setTimeout(()=>{e()},t);return fc(()=>{clearTimeout(n)})}var qC=class extends Fu{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new ch),this._linesCacheDisposables=this._register(new ch),this._lastAccessTimestamp=0,this._register(fc(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=GC(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._lastAccessTimestamp=Date.now(),this._linesCacheTimeout.value||this._scheduleLinesCacheTimeout(15e3)}_destroyLinesCache(){this._linesCache=void 0,this._lastAccessTimestamp=0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}_scheduleLinesCacheTimeout(e){this._linesCacheTimeout.value=jb(()=>{if(!this._linesCache)return;let t=Date.now()-this._lastAccessTimestamp;if(t>=15e3){this._destroyLinesCache();return}this._scheduleLinesCacheTimeout(15e3-t)},e)}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let r=[],n=[0],i=this._terminal.buffer.active.getLine(e);for(;i;){let l=this._terminal.buffer.active.getLine(e+1),c=l?l.isWrapped:!1,h=i.translateToString(!c&&t);if(c&&l){let p=i.getCell(i.length-1);p&&p.getCode()===0&&p.getWidth()===1&&l.getCell(0)?.getWidth()===2&&(h=h.slice(0,-1))}if(r.push(h),c)n.push(n[n.length-1]+h.length);else break;e++,i=l}return[r.join(""),n]}},YC=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(t){this._cachedSearchTerm=t}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(t){this._lastSearchOptions=t}isValidSearchTerm(t){return!!(t&&t.length>0)}didOptionsChange(t){return this._lastSearchOptions?t?this._lastSearchOptions.caseSensitive!==t.caseSensitive||this._lastSearchOptions.regex!==t.regex||this._lastSearchOptions.wholeWord!==t.wholeWord:!1:!0}shouldUpdateHighlighting(t,r){return r?.decorations?this._cachedSearchTerm===void 0||t!==this._cachedSearchTerm||this.didOptionsChange(r):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},ZC=class{constructor(t,r){this._terminal=t,this._lineCache=r}find(t,r,n,i){if(!t||t.length===0){this._terminal.clearSelection();return}if(n>=this._terminal.cols)throw new Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let l={startRow:r,startCol:n},c=this._findInLine(t,l,i);if(!c)for(let h=r+1;h<this._terminal.buffer.active.baseY+this._terminal.rows&&(l.startRow=h,l.startCol=0,c=this._findInLine(t,l,i),!c);h++);return c}findNextWithSelection(t,r,n){if(!t||t.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let l=0,c=0;i&&(n===t?(l=i.end.x,c=i.end.y):(l=i.start.x,c=i.start.y)),this._lineCache.initLinesCache();let h={startRow:c,startCol:l},p=this._findInLine(t,h,r);if(!p)for(let g=c+1;g<this._terminal.buffer.active.baseY+this._terminal.rows&&(h.startRow=g,h.startCol=0,p=this._findInLine(t,h,r),!p);g++);if(!p&&c!==0)for(let g=0;g<c&&(h.startRow=g,h.startCol=0,p=this._findInLine(t,h,r),!p);g++);return!p&&i&&(h.startRow=i.start.y,h.startCol=0,p=this._findInLine(t,h,r)),p}findPreviousWithSelection(t,r,n){if(!t||t.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let l=this._terminal.buffer.active.baseY+this._terminal.rows-1,c=this._terminal.cols,h=!0;this._lineCache.initLinesCache();let p={startRow:l,startCol:c},g;if(i&&(p.startRow=l=i.start.y,p.startCol=i.start.x,n!==t&&(g=this._findInLine(t,p,r,!1),g||(p.startRow=l=i.end.y,p.startCol=i.end.x))),g??=this._findInLine(t,p,r,h),!g){p.startCol=Math.max(p.startCol,this._terminal.cols);for(let x=l-1;x>=0&&(p.startRow=x,g=this._findInLine(t,p,r,h),!g);x--);}if(!g&&l!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let x=this._terminal.buffer.active.baseY+this._terminal.rows-1;x>=l&&(p.startRow=x,g=this._findInLine(t,p,r,h),!g);x--);return g}_isWholeWord(t,r,n){return(t===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(r[t-1]))&&(t+n.length===r.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(r[t+n.length]))}_findInLine(t,r,n={},i=!1){let l=r.startRow,c=r.startCol;if(this._terminal.buffer.active.getLine(l)?.isWrapped){if(i){r.startCol+=this._terminal.cols;return}return r.startRow--,r.startCol+=this._terminal.cols,this._findInLine(t,r,n)}let h=this._lineCache.getLineFromCache(l);h||(h=this._lineCache.translateBufferLineToStringWithWrap(l,!0),this._lineCache.setLineInCache(l,h));let[p,g]=h,x=this._bufferColsToStringOffset(l,c),b=t,w=p;n.regex||(b=n.caseSensitive?t:t.toLowerCase(),w=n.caseSensitive?p:p.toLowerCase());let A=-1;if(n.regex){let k=RegExp(b,n.caseSensitive?"g":"gi"),E;if(i)for(;E=k.exec(w.slice(0,x));)A=k.lastIndex-E[0].length,t=E[0],k.lastIndex-=t.length-1;else E=k.exec(w.slice(x)),E&&E[0].length>0&&(A=x+(k.lastIndex-E[0].length),t=E[0])}else i?x-b.length>=0&&(A=w.lastIndexOf(b,x-b.length)):A=w.indexOf(b,x);if(A>=0){if(n.wholeWord&&!this._isWholeWord(A,w,t))return;let k=0;for(;k<g.length-1&&A>=g[k+1];)k++;let E=k;for(;E<g.length-1&&A+t.length>=g[E+1];)E++;let I=A-g[k],M=A+t.length-g[E],Q=this._stringLengthToBufferSize(l+k,I),j=this._stringLengthToBufferSize(l+E,M)-Q+this._terminal.cols*(E-k);return{term:t,col:Q,row:l+k,size:j}}}_stringLengthToBufferSize(t,r){let n=this._terminal.buffer.active.getLine(t);if(!n)return 0;for(let i=0;i<r;i++){let l=n.getCell(i);if(!l)break;let c=l.getChars();c.length>1&&(r-=c.length-1);let h=n.getCell(i+1);h&&h.getWidth()===0&&r++}return r}_bufferColsToStringOffset(t,r){let n=t,i=0,l=this._terminal.buffer.active.getLine(n);for(;r>0&&l;){for(let c=0;c<r&&c<this._terminal.cols;c++){let h=l.getCell(c);if(!h)break;h.getWidth()&&(i+=h.getCode()===0?1:h.getChars().length)}if(n++,l=this._terminal.buffer.active.getLine(n),l&&!l.isWrapped)break;r-=this._terminal.cols}return i}},KC=class extends Fu{constructor(t){super(),this._terminal=t,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(fc(()=>this.clearHighlightDecorations()))}createHighlightDecorations(t,r){this.clearHighlightDecorations();for(let n of t){let i=this._createResultDecorations(n,r,!1);if(i)for(let l of i)this._storeDecoration(l,n)}}createActiveDecoration(t,r){let n=this._createResultDecorations(t,r,!0);if(n)return{decorations:n,match:t,dispose(){Gd(n)}}}clearHighlightDecorations(){Gd(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(t,r){this._highlightedLines.add(t.marker.line),this._highlightDecorations.push({decoration:t,match:r,dispose(){t.dispose()}})}_applyStyles(t,r,n){t.classList.contains("xterm-find-result-decoration")||(t.classList.add("xterm-find-result-decoration"),r&&(t.style.outline=`1px solid ${r}`)),n&&t.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(t,r,n){let i=[],l=t.col,c=t.size,h=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+t.row;for(;c>0;){let g=Math.min(this._terminal.cols-l,c);i.push([h,l,g]),l=0,c-=g,h++}let p=[];for(let g of i){let x=this._terminal.registerMarker(g[0]),b=this._terminal.registerDecoration({marker:x,x:g[1],width:g[2],layer:n?"top":"bottom",backgroundColor:n?r.activeMatchBackground:r.matchBackground,overviewRulerOptions:this._highlightedLines.has(x.line)?void 0:{color:n?r.activeMatchColorOverviewRuler:r.matchOverviewRuler,position:"center"}});if(b){let w=[];w.push(x),w.push(b.onRender(A=>this._applyStyles(A,n?r.activeMatchBorder:r.matchBorder,!1))),w.push(b.onDispose(()=>Gd(w))),p.push(b)}}return p.length===0?void 0:p}},XC=class extends Fu{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Fp)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(t){this._selectedDecoration=t}updateResults(t,r){this._searchResults=t.slice(0,r)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(t){for(let r=0;r<this._searchResults.length;r++){let n=this._searchResults[r];if(n.row===t.row&&n.col===t.col&&n.size===t.size)return r}return-1}fireResultsChanged(t){if(!t)return;let r=-1;this._selectedDecoration&&(r=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:r,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},JC=class extends Fu{constructor(t){super(),this._highlightTimeout=this._register(new ch),this._lineCache=this._register(new ch),this._state=new YC,this._resultTracker=this._register(new XC),this._onAfterSearch=this._register(new Fp),this.onAfterSearch=this._onAfterSearch.event,this._onBeforeSearch=this._register(new Fp),this.onBeforeSearch=this._onBeforeSearch.event,this._highlightLimit=t?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(t){this._terminal=t,this._lineCache.value=new qC(t),this._engine=new ZC(t,this._lineCache.value),this._decorationManager=new KC(t),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(fc(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=jb(()=>{let t=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(t,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(t){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),t||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(t,r,n){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._onBeforeSearch.fire(),this._state.lastSearchOptions=r,this._state.shouldUpdateHighlighting(t,r)&&this._highlightAllMatches(t,r);let i=this._findNextAndSelect(t,r,n);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),i}_highlightAllMatches(t,r){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(t)){this.clearDecorations();return}this.clearDecorations(!0);let n=[],i,l=this._engine.find(t,0,0,r);for(;l&&(i?.row!==l.row||i?.col!==l.col)&&!(n.length>=this._highlightLimit);){i=l,n.push(i);let c=this._terminal.cols,h=i.col+i.size,p=i.row;h>=c&&(p+=Math.floor(h/c),h=h%c),l=this._engine.find(t,p,h,r)}this._resultTracker.updateResults(n,this._highlightLimit),r.decorations&&this._decorationManager.createHighlightDecorations(n,r.decorations)}_findNextAndSelect(t,r,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findNextWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(i,r?.decorations,n?.noScroll)}findPrevious(t,r,n){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._onBeforeSearch.fire(),this._state.lastSearchOptions=r,this._state.shouldUpdateHighlighting(t,r)&&this._highlightAllMatches(t,r);let i=this._findPreviousAndSelect(t,r,n);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),i}_fireResults(t){this._resultTracker.fireResultsChanged(!!t?.decorations)}_findPreviousAndSelect(t,r,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findPreviousWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(i,r?.decorations,n?.noScroll)}_selectResult(t,r,n){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!t)return this._terminal.clearSelection(),!1;if(this._terminal.select(t.col,t.row,t.size),r){let i=this._decorationManager.createActiveDecoration(t,r);i&&(this._resultTracker.selectedDecoration=i)}if(!n&&(t.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||t.row<this._terminal.buffer.active.viewportY)){let i=t.row-this._terminal.buffer.active.viewportY;i-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(i)}return!0}};var Js=0,ei=0,ti=0,ws=0,Ri;(e=>{function t(i,l,c,h){return h!==void 0?`#${Kl(i)}${Kl(l)}${Kl(c)}${Kl(h)}`:`#${Kl(i)}${Kl(l)}${Kl(c)}`}e.toCss=t;function r(i,l,c,h=255){return(i<<24|l<<16|c<<8|h)>>>0}e.toRgba=r;function n(i,l,c,h){return{css:e.toCss(i,l,c,h),rgba:e.toRgba(i,l,c,h)}}e.toColor=n})(Ri||={});var eS;(e=>{function t(p,g){if(ws=(g.rgba&255)/255,ws===1)return{css:g.css,rgba:g.rgba};let x=g.rgba>>24&255,b=g.rgba>>16&255,w=g.rgba>>8&255,A=p.rgba>>24&255,k=p.rgba>>16&255,E=p.rgba>>8&255;Js=A+Math.round((x-A)*ws),ei=k+Math.round((b-k)*ws),ti=E+Math.round((w-E)*ws);let I=Ri.toCss(Js,ei,ti),M=Ri.toRgba(Js,ei,ti);return{css:I,rgba:M}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function n(p,g,x){let b=Vd.ensureContrastRatio(p.rgba,g.rgba,x);if(b)return Ri.toColor(b>>24&255,b>>16&255,b>>8&255)}e.ensureContrastRatio=n;function i(p){let g=(p.rgba|255)>>>0;return[Js,ei,ti]=Vd.toChannels(g),{css:Ri.toCss(Js,ei,ti),rgba:g}}e.opaque=i;function l(p,g){return ws=Math.round(g*255),[Js,ei,ti]=Vd.toChannels(p.rgba),{css:Ri.toCss(Js,ei,ti,ws),rgba:Ri.toRgba(Js,ei,ti,ws)}}e.opacity=l;function c(p,g){return ws=p.rgba&255,l(p,ws*g/255)}e.multiplyOpacity=c;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(eS||={});var bi;(e=>{let t,r;try{let i=document.createElement("canvas");i.width=1,i.height=1;let l=i.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return Js=parseInt(i.slice(1,2).repeat(2),16),ei=parseInt(i.slice(2,3).repeat(2),16),ti=parseInt(i.slice(3,4).repeat(2),16),Ri.toColor(Js,ei,ti);case 5:return Js=parseInt(i.slice(1,2).repeat(2),16),ei=parseInt(i.slice(2,3).repeat(2),16),ti=parseInt(i.slice(3,4).repeat(2),16),ws=parseInt(i.slice(4,5).repeat(2),16),Ri.toColor(Js,ei,ti,ws);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let l=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return Js=parseInt(l[1],10),ei=parseInt(l[2],10),ti=parseInt(l[3],10),ws=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),Ri.toColor(Js,ei,ti,ws);if(i==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Js,ei,ti,ws]=t.getImageData(0,0,1,1).data,ws!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ri.toRgba(Js,ei,ti,ws),css:i}}e.toColor=n})(bi||={});var Gi;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,i,l){let c=n/255,h=i/255,p=l/255,g=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),x=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),b=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return g*.2126+x*.7152+b*.0722}e.relativeLuminance2=r})(Gi||={});var Vd;(e=>{function t(c,h){if(ws=(h&255)/255,ws===1)return h;let p=h>>24&255,g=h>>16&255,x=h>>8&255,b=c>>24&255,w=c>>16&255,A=c>>8&255;return Js=b+Math.round((p-b)*ws),ei=w+Math.round((g-w)*ws),ti=A+Math.round((x-A)*ws),Ri.toRgba(Js,ei,ti)}e.blend=t;function r(c,h,p){let g=Gi.relativeLuminance(c>>8),x=Gi.relativeLuminance(h>>8);if(ol(g,x)<p){if(x<g){let A=n(c,h,p),k=ol(g,Gi.relativeLuminance(A>>8));if(k<p){let E=i(c,h,p),I=ol(g,Gi.relativeLuminance(E>>8));return k>I?A:E}return A}let b=i(c,h,p),w=ol(g,Gi.relativeLuminance(b>>8));if(w<p){let A=n(c,h,p),k=ol(g,Gi.relativeLuminance(A>>8));return w>k?b:A}return b}}e.ensureContrastRatio=r;function n(c,h,p){let g=c>>24&255,x=c>>16&255,b=c>>8&255,w=h>>24&255,A=h>>16&255,k=h>>8&255,E=ol(Gi.relativeLuminance2(w,A,k),Gi.relativeLuminance2(g,x,b));for(;E<p&&(w>0||A>0||k>0);)w-=Math.max(0,Math.ceil(w*.1)),A-=Math.max(0,Math.ceil(A*.1)),k-=Math.max(0,Math.ceil(k*.1)),E=ol(Gi.relativeLuminance2(w,A,k),Gi.relativeLuminance2(g,x,b));return(w<<24|A<<16|k<<8|255)>>>0}e.reduceLuminance=n;function i(c,h,p){let g=c>>24&255,x=c>>16&255,b=c>>8&255,w=h>>24&255,A=h>>16&255,k=h>>8&255,E=ol(Gi.relativeLuminance2(w,A,k),Gi.relativeLuminance2(g,x,b));for(;E<p&&(w<255||A<255||k<255);)w=Math.min(255,w+Math.ceil((255-w)*.1)),A=Math.min(255,A+Math.ceil((255-A)*.1)),k=Math.min(255,k+Math.ceil((255-k)*.1)),E=ol(Gi.relativeLuminance2(w,A,k),Gi.relativeLuminance2(g,x,b));return(w<<24|A<<16|k<<8|255)>>>0}e.increaseLuminance=i;function l(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=l})(Vd||={});function Kl(e){let t=e.toString(16);return t.length<2?"0"+t:t}function ol(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var tS=Object.freeze((()=>{let e=[bi.toColor("#2e3436"),bi.toColor("#cc0000"),bi.toColor("#4e9a06"),bi.toColor("#c4a000"),bi.toColor("#3465a4"),bi.toColor("#75507b"),bi.toColor("#06989a"),bi.toColor("#d3d7cf"),bi.toColor("#555753"),bi.toColor("#ef2929"),bi.toColor("#8ae234"),bi.toColor("#fce94f"),bi.toColor("#729fcf"),bi.toColor("#ad7fa8"),bi.toColor("#34e2e2"),bi.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=t[r/36%6|0],i=t[r/6%6|0],l=t[r%6];e.push({css:Ri.toCss(n,i,l),rgba:Ri.toRgba(n,i,l)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:Ri.toCss(n,n,n),rgba:Ri.toRgba(n,n,n)})}return e})());function Lg(e,t,r){return Math.max(t,Math.min(e,r))}function rS(e){switch(e){case"&":return"&";case"<":return"<"}return e}var Pb=class{constructor(e){this._buffer=e}serialize(e,t){let r=this._buffer.getNullCell(),n=this._buffer.getNullCell(),i=r,l=e.start.y,c=e.end.y,h=e.start.x,p=e.end.x;this._beforeSerialize(c-l,l,c);for(let g=l;g<=c;g++){let x=this._buffer.getLine(g);if(x){let b=g===e.start.y?h:0,w=g===e.end.y?p:x.length;for(let A=b;A<w;A++){let k=x.getCell(A,i===r?n:r);if(!k){console.warn(`Can't get cell at row=${g}, col=${A}`);continue}this._nextCell(k,i,g,A),i=k}}this._rowEnd(g,g===c)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,r,n){}_rowEnd(e,t){}_beforeSerialize(e,t,r){}_afterSerialize(){}_serializeString(e){return""}};function I1(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Go(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function Ob(e,t){if(!e.isUnderline()&&!t.isUnderline())return!0;if(e.getUnderlineStyle()!==t.getUnderlineStyle())return!1;let r=e.isUnderlineColorDefault(),n=t.isUnderlineColorDefault();return r&&n?!0:r!==n?!1:e.getUnderlineColor()===t.getUnderlineColor()&&e.getUnderlineColorMode()===t.getUnderlineColorMode()}function E1(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&Ob(e,t)&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}function Fb(e,t){let r=e;return typeof r.attributesEquals=="function"?r.attributesEquals(t):I1(e,t)&&Go(e,t)&&E1(e,t)}var nS=class extends Pb{constructor(t,r){super(t),this._terminal=r,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(t,r,n){this._allRows=new Array(t),this._lastContentCursorRow=r,this._lastCursorRow=r,this._firstRow=r}_rowEnd(t,r){this._nullCellCount>0&&!Go(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let n="";if(!r){t-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let i=this._buffer.getLine(t),l=this._buffer.getLine(t+1);if(!l.isWrapped)n=`\r
|
|
61
|
-
`,this._lastCursorRow=t+1,this._lastCursorCol=0;else{n="";let c=i.getCell(i.length-1,this._thisRowLastChar),h=i.getCell(i.length-2,this._thisRowLastSecondChar),p=l.getCell(0,this._nextRowFirstChar),g=p.getWidth()>1,x=!1;(p.getChars()&&g?this._nullCellCount<=1:this._nullCellCount<=0)&&((c.getChars()||c.getWidth()===0)&&Go(c,p)&&(x=!0),g&&(h.getChars()||h.getWidth()===0)&&Go(c,p)&&Go(h,p)&&(x=!0)),x||(n="-".repeat(this._nullCellCount+1),n+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(n+="\x1B[A",n+=`\x1B[${i.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${i.length-this._nullCellCount}D`,n+="\x1B[B"),this._lastContentCursorRow=t+1,this._lastContentCursorCol=0,this._lastCursorRow=t+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow="",this._nullCellCount=0}_diffStyle(t,r){let n=[];if(Fb(t,r))return n;let i=!I1(t,r),l=!Go(t,r),c=!E1(t,r);if(i||l||c)if(t.isAttributeDefault())r.isAttributeDefault()||n.push(0);else{if(i){let h=t.getFgColor();t.isFgRGB()?n.push(38,2,h>>>16&255,h>>>8&255,h&255):t.isFgPalette()?h>=16?n.push(38,5,h):n.push(h&8?90+(h&7):30+(h&7)):n.push(39)}if(l){let h=t.getBgColor();t.isBgRGB()?n.push(48,2,h>>>16&255,h>>>8&255,h&255):t.isBgPalette()?h>=16?n.push(48,5,h):n.push(h&8?100+(h&7):40+(h&7)):n.push(49)}if(c){if(t.isInverse()!==r.isInverse()&&n.push(t.isInverse()?7:27),t.isBold()!==r.isBold()&&n.push(t.isBold()?1:22),Ob(t,r))t.isUnderline()!==r.isUnderline()&&n.push(t.isUnderline()?4:24);else{let h=t.getUnderlineStyle();if(h===0)n.push(24);else if(h===1&&t.isUnderlineColorDefault())n.push(4);else if(n.push("4:"+h),!t.isUnderlineColorDefault()){let p=t.getUnderlineColor();t.isUnderlineColorRGB()?n.push("58:2::"+(p>>>16&255)+":"+(p>>>8&255)+":"+(p&255)):n.push("58:5:"+p)}}t.isOverline()!==r.isOverline()&&n.push(t.isOverline()?53:55),t.isBlink()!==r.isBlink()&&n.push(t.isBlink()?5:25),t.isInvisible()!==r.isInvisible()&&n.push(t.isInvisible()?8:28),t.isItalic()!==r.isItalic()&&n.push(t.isItalic()?3:23),t.isDim()!==r.isDim()&&n.push(t.isDim()?2:22),t.isStrikethrough()!==r.isStrikethrough()&&n.push(t.isStrikethrough()?9:29)}}return n}_nextCell(t,r,n,i){if(t.getWidth()===0)return;let l=t.getChars()==="",c=this._diffStyle(t,this._cursorStyle);if(l?!Go(this._cursorStyle,t):c.length>0){this._nullCellCount>0&&(Go(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=i,this._currentRow+=`\x1B[${c.join(";")}m`;let h=this._buffer.getLine(n);h!==void 0&&(h.getCell(i,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=i)}l?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(Go(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=i+t.getWidth())}_serializeString(t){let r=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(r=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n="";for(let c=0;c<r;c++)n+=this._allRows[c],c+1<r&&(n+=this._allRowSeparators[c]);if(!t){let c=this._buffer.baseY+this._buffer.cursorY,h=this._buffer.cursorX,p=c!==this._lastCursorRow||h!==this._lastCursorCol,g=x=>{x>0?n+=`\x1B[${x}C`:x<0&&(n+=`\x1B[${-x}D`)};p&&((x=>{x>0?n+=`\x1B[${x}B`:x<0&&(n+=`\x1B[${-x}A`)})(c-this._lastCursorRow),g(h-this._lastCursorCol))}let i=this._terminal._core._inputHandler._curAttrData,l=this._diffStyle(i,this._cursorStyle);return l.length>0&&(n+=`\x1B[${l.join(";")}m`),n}},sS=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,r,n){let i=r.length,l=n===void 0?i:Lg(n+t.rows,0,i);return this._serializeBufferByRange(t,r,{start:i-l,end:i-1},!1)}_serializeBufferByRange(t,r,n,i){return new nS(r,t).serialize({start:{x:0,y:typeof n.start=="number"?n.start:n.start.line},end:{x:t.cols,y:typeof n.end=="number"?n.end:n.end.line}},i)}_serializeBufferAsHTML(t,r){let n=t.buffer.active,i=new iS(n,t,r),l=r.onlySelection??!1,c=r.range;if(c)return i.serialize({start:{x:c.startCol,y:(c.startLine,c.startLine)},end:{x:t.cols,y:(c.endLine,c.endLine)}});if(!l){let p=n.length,g=r.scrollback,x=g===void 0?p:Lg(g+t.rows,0,p);return i.serialize({start:{x:0,y:p-x},end:{x:t.cols,y:p-1}})}let h=this._terminal?.getSelectionPosition();return h!==void 0?i.serialize({start:{x:h.start.x,y:h.start.y},end:{x:h.end.x,y:h.end.y}}):""}_serializeScrollRegion(t){let r=t._core.buffer,n=r.scrollTop,i=r.scrollBottom;return n!==0||i!==t.rows-1?`\x1B[${n+1};${i+1}r`:""}_serializeModes(t){let r="",n=t.modes;if(n.applicationCursorKeysMode&&(r+="\x1B[?1h"),n.applicationKeypadMode&&(r+="\x1B[?66h"),n.bracketedPasteMode&&(r+="\x1B[?2004h"),n.insertMode&&(r+="\x1B[4h"),n.originMode&&(r+="\x1B[?6h"),n.reverseWraparoundMode&&(r+="\x1B[?45h"),n.sendFocusMode&&(r+="\x1B[?1004h"),n.wraparoundMode===!1&&(r+="\x1B[?7l"),n.mouseTrackingMode!=="none")switch(n.mouseTrackingMode){case"x10":r+="\x1B[?9h";break;case"vt200":r+="\x1B[?1000h";break;case"drag":r+="\x1B[?1002h";break;case"any":r+="\x1B[?1003h";break}return n.showCursor||(r+="\x1B[?25l"),r}serialize(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let r=t?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,t.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,t?.scrollback);if(!t?.excludeAltBuffer&&this._terminal.buffer.active.type==="alternate"){let n=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);r+=`\x1B[?1049h\x1B[H${n}`}return t?.excludeModes||(r+=this._serializeModes(this._terminal),r+=this._serializeScrollRegion(this._terminal)),r}serializeAsHTML(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,t??{})}dispose(){}},iS=class extends Pb{constructor(t,r,n){super(t),this._terminal=r,this._options=n,this._currentRow="",this._htmlContent="",r._core._themeService?this._ansiColors=r._core._themeService.colors.ansi:this._ansiColors=tS}_beforeSerialize(t,r,n){this._htmlContent+="<html><body><!--StartFragment--><pre>";let i="#000000",l="#ffffff";(this._options.includeGlobalBackground??!1)&&(i=this._terminal.options.theme?.foreground??"#ffffff",l=this._terminal.options.theme?.background??"#000000");let c=[];c.push("color: "+i+";"),c.push("background-color: "+l+";"),c.push("font-family: "+this._terminal.options.fontFamily+";"),c.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+c.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(t,r){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(t,r){let n=r?t.getFgColor():t.getBgColor();if(r?t.isFgRGB():t.isBgRGB())return"#"+[n>>16&255,n>>8&255,n&255].map(i=>i.toString(16).padStart(2,"0")).join("");if(r?t.isFgPalette():t.isBgPalette())return this._ansiColors[n].css}_getUnderlineColor(t){if(t.isUnderlineColorDefault())return;let r=t.getUnderlineColor();return t.isUnderlineColorRGB()?"#"+[r>>16&255,r>>8&255,r&255].map(n=>n.toString(16).padStart(2,"0")).join(""):this._ansiColors[r].css}_getUnderlineStyle(t){switch(t.getUnderlineStyle()){case 1:return"underline";case 2:return"underline double";case 3:return"underline wavy";case 4:return"underline dotted";case 5:return"underline dashed";default:return"underline"}}_diffStyle(t,r){let n=[];if(Fb(t,r))return;let i=!I1(t,r),l=!Go(t,r),c=!E1(t,r);if(i||l||c){let h=this._getHexColor(t,!0);h&&n.push("color: "+h+";");let p=this._getHexColor(t,!1);p&&n.push("background-color: "+p+";"),t.isInverse()&&n.push("color: #000000; background-color: #BFBFBF;"),t.isBold()&&n.push("font-weight: bold;");let g=[];if(t.isUnderline()&&g.push(this._getUnderlineStyle(t)),t.isOverline()&&g.push("overline"),t.isStrikethrough()&&g.push("line-through"),t.isBlink()&&g.push("blink"),g.length>0&&n.push("text-decoration: "+g.join(" ")+";"),t.isUnderline()){let x=this._getUnderlineColor(t);x&&n.push("text-decoration-color: "+x+";")}return t.isInvisible()&&n.push("visibility: hidden;"),t.isItalic()&&n.push("font-style: italic;"),t.isDim()&&n.push("opacity: 0.5;"),n}}_nextCell(t,r,n,i){if(t.getWidth()===0)return;let l=t.getChars()==="",c=this._diffStyle(t,r);c&&(this._currentRow+=c.length===0?"</span><span>":"</span><span style='"+c.join(" ")+"'>"),l?this._currentRow+=" ":this._currentRow+=rS(t.getChars())}_serializeString(){return this._htmlContent}};var aS=class{constructor(e=new oS,t=new $b){this._base64=e,this._provider=t}activate(e){this._terminal=e,this._disposable=e.parser.registerOscHandler(52,t=>this._setOrReportClipboard(t))}dispose(){return this._disposable?.dispose()}_readText(e,t){let r=this._base64.encodeText(t);this._terminal?.input(`\x1B]52;${e};${r}\x07`,!1)}_setOrReportClipboard(e){let t=e.split(";");if(t.length<2)return!0;let r=t[0],n=t[1];if(n==="?"){let c=this._provider.readText(r);return c instanceof Promise?c.then(h=>(this._readText(r,h),!0)):(this._readText(r,c),!0)}let i="";try{i=this._base64.decodeText(n)}catch{}let l=this._provider.writeText(r,i);return l instanceof Promise?l.then(()=>!0):!0}},$b=class{readText(e){return navigator.clipboard.readText()}writeText(e,t){return navigator.clipboard.writeText(t)}},oS=class{encodeText(t){let r=new TextEncoder().encode(t);if(r.toBase64!==void 0)return r.toBase64();let n="";for(let i=0;i<r.length;i++)n+=String.fromCharCode(r[i]);return btoa(n)}decodeText(t){if(Uint8Array.fromBase64!==void 0){try{return new TextDecoder().decode(Uint8Array.fromBase64(t))}catch{}return""}try{let r=atob(t),n=new Uint8Array(r.length);for(let i=0;i<r.length;++i)n[i]=r.charCodeAt(i);return new TextDecoder().decode(n)}catch{}return""}};var lS=Object.create,Ub=Object.defineProperty,cS=Object.getOwnPropertyDescriptor,uS=Object.getOwnPropertyNames,dS=Object.getPrototypeOf,hS=Object.prototype.hasOwnProperty,s0=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},fS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of uS(t))!hS.call(e,i)&&i!==r&&Ub(e,i,{get:()=>t[i],enumerable:!(n=cS(t,i))||n.enumerable});return e},i0=(e,t,r)=>(r=e!=null?lS(dS(e)):{},fS(!e||!e.__esModule?Ub(r,"default",{value:e,enumerable:!0}):r,e)),N1=s0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_FOREGROUND=e.DEFAULT_BACKGROUND=e.PALETTE_ANSI_256=e.PALETTE_VT340_GREY=e.PALETTE_VT340_COLOR=e.normalizeHLS=e.normalizeRGB=e.nearestColorIndex=e.fromRGBA8888=e.toRGBA8888=e.alpha=e.blue=e.green=e.red=e.BIG_ENDIAN=void 0,e.BIG_ENDIAN=new Uint8Array(new Uint32Array([4278190080]).buffer)[0]===255,e.BIG_ENDIAN&&console.warn("BE platform detected. This version of node-sixel works only on LE properly.");function t(A){return A&255}e.red=t;function r(A){return A>>>8&255}e.green=r;function n(A){return A>>>16&255}e.blue=n;function i(A){return A>>>24&255}e.alpha=i;function l(A,k,E,I=255){return((I&255)<<24|(E&255)<<16|(k&255)<<8|A&255)>>>0}e.toRGBA8888=l;function c(A){return[A&255,A>>8&255,A>>16&255,A>>>24]}e.fromRGBA8888=c;function h(A,k){let E=t(A),I=r(A),M=n(A),Q=Number.MAX_SAFE_INTEGER,j=-1;for(let F=0;F<k.length;++F){let V=E-k[F][0],$=I-k[F][1],te=M-k[F][2],se=V*V+$*$+te*te;if(!se)return F;se<Q&&(Q=se,j=F)}return j}e.nearestColorIndex=h;function p(A,k,E){return Math.max(A,Math.min(E,k))}function g(A,k,E){return E<0&&(E+=1),E>1&&(E-=1),E*6<1?k+(A-k)*6*E:E*2<1?A:E*3<2?k+(A-k)*(4-E*6):k}function x(A,k,E){if(!E){let Q=Math.round(k*255);return l(Q,Q,Q)}let I=k<.5?k*(1+E):k+E-k*E,M=2*k-I;return l(p(0,255,Math.round(g(I,M,A+1/3)*255)),p(0,255,Math.round(g(I,M,A)*255)),p(0,255,Math.round(g(I,M,A-1/3)*255)))}function b(A,k,E){return(4278190080|Math.round(E/100*255)<<16|Math.round(k/100*255)<<8|Math.round(A/100*255))>>>0}e.normalizeRGB=b;function w(A,k,E){return x((A+240%360)/360,k/100,E/100)}e.normalizeHLS=w,e.PALETTE_VT340_COLOR=new Uint32Array([b(0,0,0),b(20,20,80),b(80,13,13),b(20,80,20),b(80,20,80),b(20,80,80),b(80,80,20),b(53,53,53),b(26,26,26),b(33,33,60),b(60,26,26),b(33,60,33),b(60,33,60),b(33,60,60),b(60,60,33),b(80,80,80)]),e.PALETTE_VT340_GREY=new Uint32Array([b(0,0,0),b(13,13,13),b(26,26,26),b(40,40,40),b(6,6,6),b(20,20,20),b(33,33,33),b(46,46,46),b(0,0,0),b(13,13,13),b(26,26,26),b(40,40,40),b(6,6,6),b(20,20,20),b(33,33,33),b(46,46,46)]),e.PALETTE_ANSI_256=(()=>{let A=[l(0,0,0),l(205,0,0),l(0,205,0),l(205,205,0),l(0,0,238),l(205,0,205),l(0,250,205),l(229,229,229),l(127,127,127),l(255,0,0),l(0,255,0),l(255,255,0),l(92,92,255),l(255,0,255),l(0,255,255),l(255,255,255)],k=[0,95,135,175,215,255];for(let E=0;E<6;++E)for(let I=0;I<6;++I)for(let M=0;M<6;++M)A.push(l(k[E],k[I],k[M]));for(let E=8;E<=238;E+=10)A.push(l(E,E,E));return new Uint32Array(A)})(),e.DEFAULT_BACKGROUND=l(0,0,0,255),e.DEFAULT_FOREGROUND=l(255,255,255,255)}),zb=s0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InWasm=r;var t=n=>{if(Uint8Array.fromBase64)return Uint8Array.fromBase64(n);if(typeof Buffer<"u")return Buffer.from(n,"base64");let i=atob(n),l=new Uint8Array(i.length);for(let c=0;c<l.length;++c)l[c]=i.charCodeAt(c);return l};function r(n){if(n.d){let{t:i,s:l,d:c}=n,h,p,g=WebAssembly;return i===0?l?x=>new g.Instance(p||(p=new g.Module(h||(h=t(c)))),x):x=>p?g.instantiate(p,x):g.instantiate(h||(h=t(c)),x).then(b=>(p=b.module)&&b.instance):i===1?l?()=>p||(p=new g.Module(h||(h=t(c)))):()=>p?Promise.resolve(p):g.compile(h||(h=t(c))).then(x=>p=x):l?()=>h||(h=t(c)):()=>Promise.resolve(h||(h=t(c)))}if(typeof _wasmCtx>"u")throw new Error('must run "inwasm"');_wasmCtx.add(n)}}),Hb=s0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=zb(),r=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABBQFgAAF/Ag8BA2VudgZtZW1vcnkCAAEDAwIAAAcNAgNkZWMAAANlbmQAAQqLBgKZBAEKf0GIKCgCAEGgKGohAUGEKCgCACIDQaAoaiEAQYAoKAIAQQFrQXxxIgRBoChqIQUgBEEQayADSgRAIARBkChqIQMDQCABIABBA2otAABBAnQoAoAgIABBAmotAABBAnQoAoAYIABBAWotAABBAnQoAoAQIAAtAABBAnQoAoAIcnJyIgY2AgAgAUEDaiAAQQdqLQAAQQJ0KAKAICAAQQZqLQAAQQJ0KAKAGCAAQQVqLQAAQQJ0KAKAECAAQQRqLQAAQQJ0KAKACHJyciIHNgIAIAFBBmogAEELai0AAEECdCgCgCAgAEEKai0AAEECdCgCgBggAEEJai0AAEECdCgCgBAgAEEIai0AAEECdCgCgAhycnIiCDYCACABQQlqIABBD2otAABBAnQoAoAgIABBDmotAABBAnQoAoAYIABBDWotAABBAnQoAoAQIABBDGotAABBAnQoAoAIcnJyIgk2AgAgAiAGciAHciAIciAJciECIAFBDGohASAAQRBqIgAgA0kNAAsLIAAgBUkEQANAIAEgAEEDai0AAEECdCgCgCAgAEECai0AAEECdCgCgBggAEEBai0AAEECdCgCgBAgAC0AAEECdCgCgAhycnIiAzYCACACIANyIQIgAUEDaiEBIABBBGoiACAFSQ0ACwtBfyEAIAJB////B00Ef0GEKCAENgIAQYgoIAFBoChrNgIAQQAFQX8LC+0BAQR/AkBBgCgoAgAiAUGEKCgCACIAa0EFTgRAQX8hAxAADQFBgCgoAgAhAUGEKCgCACEAC0F/IQMgASAAayIBQQJIDQAgAC0AoShBAnQoAoAQIAAtAKAoQQJ0KAKACHIhAgJ/IAFBBEYEQEEDQQQgAC0AoyhBPUYbIAAtAKIoQT1GayEBC0EBIAFBA0kNABogAC0AoihBAnQoAoAYIAJyIQJBAiABQQRHDQAaIAAtAKMoQQJ0KAKAICACciECQQMLIQEgAkH///8HSw0AQQAhA0GIKCgCACIAIAI2AKAoQYgoIAAgAWo2AgALIAML"}),n=new Uint8Array("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").map(h=>h.charCodeAt(0))),i=new Uint32Array(1024);i.fill(4278190080);for(let h=0;h<n.length;++h)i[n[h]]=h<<2;for(let h=0;h<n.length;++h)i[256+n[h]]=h>>4|(h<<4&255)<<8;for(let h=0;h<n.length;++h)i[512+n[h]]=h>>2<<8|(h<<6&255)<<16;for(let h=0;h<n.length;++h)i[768+n[h]]=h<<16;var l=new Uint8Array(0),c=class{constructor(h,p,g){if(this._inst=null,this._ended=!0,this._bytes=0,this.keepSize=h??1048576,this.maxBytes=p??4294901760,this._bytes=g??32768,this._bytes>this.maxBytes||this.maxBytes>4294901760)throw new Error("invalid byte settings")}get data8(){return this._inst?this._d.subarray(0,this._m32[1282]):l}release(){this._inst&&(this._bytes>this.keepSize?this._inst=this._m32=this._d=this._mem=null:(this._m32[1280]=0,this._m32[1281]=0,this._m32[1282]=0))}init(h,p){if(this.maxBytes=h??this.maxBytes,this._bytes=p??Math.min(this._bytes,this.maxBytes),this._bytes>this.maxBytes||this.maxBytes>4294901760)throw Error("invalid byte settings");let g=this._m32,x=this._bytes+5152;this._inst?this._mem.buffer.byteLength<x&&(this._mem.grow(Math.ceil((x-this._mem.buffer.byteLength)/65536)),g=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)):(this._mem=new WebAssembly.Memory({initial:Math.ceil(x/65536)}),this._inst=r({env:{memory:this._mem}}),g=new Uint32Array(this._mem.buffer,0),g.set(i,256),this._d=new Uint8Array(this._mem.buffer,5152)),g[1280]=0,g[1281]=0,g[1282]=0,this._m32=g,this._ended=!1}_realloc(h){let p=this._m32[1280]+h;if(this._bytes<p){if(p>this.maxBytes)return-3;let g=this._bytes;for(;(g*=2)<p;);if(g=Math.min(g,this.maxBytes),g<p)return-3;if(g+5152>this._mem.buffer.byteLength){let x=Math.ceil((g+5152-this._mem.buffer.byteLength)/65536);this._mem.grow(x),this._m32=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)}this._bytes=g}return 0}put(h){if(!this._inst||this._ended)return-2;if(this._realloc(h.length))return-3;let p=this._m32;return this._d.set(h,p[1280]),p[1280]+=h.length,p[1280]-p[1281]>=131072?this._inst.exports.dec():0}end(){return this._ended=!0,this._inst?this._inst.exports.end():-2}get loadedBytes(){return this._inst?this._m32[1280]:0}get freeBytes(){return this._inst?this.maxBytes-this._m32[1280]:0}};e.default=c}),pS=s0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=zb(),r=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABCgJgAABgA39/fwACDwEDZW52Bm1lbW9yeQIAAQMDAgABBwcBA2RlYwABCAEACu4EAgwAQQBBAEGAAvwLAAveBAEJf0EAQQBBgAL8CwAgAUEXTgRAIAAgAWpBCGshCkGACCEBIAJBAnRBgAhqIQsgAEEOaiEDQf8BIQZBACECA0AgA0EBaiEHIAMtAAAiCEE/cSEAAkACQCAIQcABcSIJRQRAIABBAnQiAC0AAyEGIAAtAAIhBCAALQABIQUgAC0AACECIAchAwwBCwJAIAhB/QFLDQAgCUHAAUcNACAFQQVsIAJBA2xqIARBB2xqIAZBC2xqQT9xQQJ0IgMgBDoAAiADIAU6AAEgAyACOgAAIANBA2ogBjoAAANAIAEgAjoAACABQQNqIAY6AAAgAUECaiAEOgAAIAFBAWogBToAACABQQRqIQEgAEUEQCAHIQMMBAsgAEEBayEAIAEgC0kNAAsgByEDDAILAn8CQAJAAkAgCEH+AWsOAgABAgsgAy0AAyEEIAMtAAIhBSADLQABIQIgA0EEagwCCyADKAIBIgJBGHYhBiACQRB2IQQgAkEIdiEFIANBBWoMAQsgCUGAAUcEQCAHIAlBwABHDQEaIAQgCEEDcWpBAmshBCACIABBBHZqQQJrIQIgBSAIQQJ2QQNxakECayEFIAcMAQsgBCAAQShrIgkgAy0AASIHQQ9xamohBCACIAdBBHYgCWpqIQIgACAFakEgayEFIANBAmoLIQMgBUEFbCACQQNsaiAEQQdsaiAGQQtsakE/cUECdCIAIAQ6AAIgACAFOgABIAAgAjoAACAAQQNqIAY6AAALIAEgBjoAAyABIAQ6AAIgASAFOgABIAEgAjoAACABQQRqIQELIAMgCkkNAAsLCw=="}),n=class{constructor(i){this.keepSize=i,this.width=0,this.height=0}decode(i){this.width=i[4]<<24|i[5]<<16|i[6]<<8|i[7],this.height=i[8]<<24|i[9]<<16|i[10]<<8|i[11];let l=this.width*this.height,c=l*4,h=i.length,p=Math.max(c,h)+(Math.min(c,h)>>1)+4096;this._inst?this._mem.buffer.byteLength<p&&(this._mem.grow(Math.ceil((p-this._mem.buffer.byteLength)/65536)),this._d=null):(this._mem=new WebAssembly.Memory({initial:Math.ceil(p/65536)}),this._inst=r({env:{memory:this._mem}})),this._d||(this._d=new Uint8Array(this._mem.buffer));let g=this._mem.buffer.byteLength-h&-256;return this._d.set(i,g),this._inst.exports.dec(g,h,l),this._d.subarray(1024,1024+c)}release(){this._inst&&this._mem.buffer.byteLength>this.keepSize&&(this._inst=this._d=this._mem=null)}};e.default=n}),mS=s0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LIMITS=void 0,e.LIMITS={CHUNK_SIZE:16384,PALETTE_SIZE:4096,MAX_WIDTH:16384,BYTES:"AGFzbQEAAAABJAdgAAF/YAJ/fwBgA39/fwF/YAF/AX9gAABgBH9/f38AYAF/AAIlAgNlbnYLaGFuZGxlX2JhbmQAAwNlbnYLbW9kZV9wYXJzZWQAAwMTEgQAAAAAAQQBAQUBAAACAgAGAwQFAXABBwcFBAEBBwcGCAF/AUGAihoLB9wBDgZtZW1vcnkCABFnZXRfc3RhdGVfYWRkcmVzcwADEWdldF9jaHVua19hZGRyZXNzAAQOZ2V0X3AwX2FkZHJlc3MABRNnZXRfcGFsZXR0ZV9hZGRyZXNzAAYEaW5pdAALBmRlY29kZQAMDWN1cnJlbnRfd2lkdGgADQ5jdXJyZW50X2hlaWdodAAOGV9faW5kaXJlY3RfZnVuY3Rpb25fdGFibGUBAAtfaW5pdGlhbGl6ZQACCXN0YWNrU2F2ZQARDHN0YWNrUmVzdG9yZQASCnN0YWNrQWxsb2MAEwkMAQBBAQsGCgcJDxACDAEBCq5UEgMAAQsFAEGgCAsGAEGQiQELBgBBsIkCCwUAQZAJC+okAQh/QeQIKAIAIQVB4AgoAgAhA0HoCCgCACEIIAFBkIkBaiIJQf8BOgAAIAAgAUgEQCAAQZCJAWohBgNAIAMhBCAGQQFqIQECQCAGLQAAQf8AcSIDQTBrQQlLBEAgASEGDAELQewIKAIAQQJ0QewIaiICKAIAIQADQCACIAMgAEEKbGpBMGsiADYCACABLQAAIQMgAUEBaiIGIQEgA0H/AHEiA0Ewa0EKSQ0ACwsCQAJAAkACQAJAAkACQAJ/AkACQCADQT9rIgBBP00EQCAERQ0BIARBIUYEQAJAQfAIKAIAIgFBASABGyIHIAhqIgFB1AgoAgAiA0gNACADQf//AEoNAANAIANBAnQiAkGgiQJqIgRBoAgpAwA3AwAgAkGoiQJqQaAIKQMANwMAIAJBsIkCakGgCCkDADcDACACQbiJAmpBoAgpAwA3AwAgAkHAiQJqQaAIKQMANwMAIAJByIkCakGgCCkDADcDACACQdCJAmpBoAgpAwA3AwAgAkHYiQJqQaAIKQMANwMAIAJB4IkCakGgCCkDADcDACACQeiJAmpBoAgpAwA3AwAgAkHwiQJqQaAIKQMANwMAIAJB+IkCakGgCCkDADcDACACQYCKAmpBoAgpAwA3AwAgAkGIigJqQaAIKQMANwMAIAJBkIoCakGgCCkDADcDACACQZiKAmpBoAgpAwA3AwAgAkGgigJqQaAIKQMANwMAIAJBqIoCakGgCCkDADcDACACQbCKAmpBoAgpAwA3AwAgAkG4igJqQaAIKQMANwMAIAJBwIoCakGgCCkDADcDACACQciKAmpBoAgpAwA3AwAgAkHQigJqQaAIKQMANwMAIAJB2IoCakGgCCkDADcDACACQeCKAmpBoAgpAwA3AwAgAkHoigJqQaAIKQMANwMAIAJB8IoCakGgCCkDADcDACACQfiKAmpBoAgpAwA3AwAgAkGAiwJqQaAIKQMANwMAIAJBiIsCakGgCCkDADcDACACQZCLAmpBoAgpAwA3AwAgAkGYiwJqQaAIKQMANwMAIAJBoIsCakGgCCkDADcDACACQaiLAmpBoAgpAwA3AwAgAkGwiwJqQaAIKQMANwMAIAJBuIsCakGgCCkDADcDACACQcCLAmpBoAgpAwA3AwAgAkHIiwJqQaAIKQMANwMAIAJB0IsCakGgCCkDADcDACACQdiLAmpBoAgpAwA3AwAgAkHgiwJqQaAIKQMANwMAIAJB6IsCakGgCCkDADcDACACQfCLAmpBoAgpAwA3AwAgAkH4iwJqQaAIKQMANwMAIAJBgIwCakGgCCkDADcDACACQYiMAmpBoAgpAwA3AwAgAkGQjAJqQaAIKQMANwMAIAJBmIwCakGgCCkDADcDACACQaCMAmpBoAgpAwA3AwAgAkGojAJqQaAIKQMANwMAIAJBsIwCakGgCCkDADcDACACQbiMAmpBoAgpAwA3AwAgAkHAjAJqQaAIKQMANwMAIAJByIwCakGgCCkDADcDACACQdCMAmpBoAgpAwA3AwAgAkHYjAJqQaAIKQMANwMAIAJB4IwCakGgCCkDADcDACACQeiMAmpBoAgpAwA3AwAgAkHwjAJqQaAIKQMANwMAIAJB+IwCakGgCCkDADcDACACQYCNAmpBoAgpAwA3AwAgAkGIjQJqQaAIKQMANwMAIAJBkI0CakGgCCkDADcDACACQZiNAmpBoAgpAwA3AwAgAkGwiQZqIARBgAT8CgAAQdQIKAIAQQJ0QcCJCmogBEGABPwKAABB1AgoAgBBAnRB0IkOaiAEQYAE/AoAAEHUCCgCAEECdEHgiRJqIARBgAT8CgAAQdQIKAIAQQJ0QfCJFmogBEGABPwKAABB1AhB1AgoAgAiAkGAAWoiAzYCACABIANIDQEgAkGA/wBIDQALCwJAIABFDQAgCEH//wBLDQBBgIABIAhrIAcgAUH//wBLGyECAkAgAEEBcUUNACACRQ0AIAhBAnRBoIkCaiEDIAIhBCACQQdxIgcEQANAIAMgBTYCACADQQRqIQMgBEEBayEEIAdBAWsiBw0ACwsgAkEBa0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgBEEIayIEDQALCwJAIABBAnFFDQAgAkUNACAIQQJ0QbCJBmohAyACIQQgAkEHcSIHBEADQCADIAU2AgAgA0EEaiEDIARBAWshBCAHQQFrIgcNAAsLIAJBAWtBB0kNAANAIAMgBTYCHCADIAU2AhggAyAFNgIUIAMgBTYCECADIAU2AgwgAyAFNgIIIAMgBTYCBCADIAU2AgAgA0EgaiEDIARBCGsiBA0ACwsCQCAAQQRxRQ0AIAJFDQAgCEECdEHAiQpqIQMgAiEEIAJBB3EiBwRAA0AgAyAFNgIAIANBBGohAyAEQQFrIQQgB0EBayIHDQALCyACQQFrQQdJDQADQCADIAU2AhwgAyAFNgIYIAMgBTYCFCADIAU2AhAgAyAFNgIMIAMgBTYCCCADIAU2AgQgAyAFNgIAIANBIGohAyAEQQhrIgQNAAsLAkAgAEEIcUUNACACRQ0AIAhBAnRB0IkOaiEDIAIhBCACQQdxIgcEQANAIAMgBTYCACADQQRqIQMgBEEBayEEIAdBAWsiBw0ACwsgAkEBa0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgBEEIayIEDQALCwJAIABBEHFFDQAgAkUNACAIQQJ0QeCJEmohAyACIQQgAkEHcSIHBEADQCADIAU2AgAgA0EEaiEDIARBAWshBCAHQQFrIgcNAAsLIAJBAWtBB0kNAANAIAMgBTYCHCADIAU2AhggAyAFNgIUIAMgBTYCECADIAU2AgwgAyAFNgIIIAMgBTYCBCADIAU2AgAgA0EgaiEDIARBCGsiBA0ACwsgAEEgcUUNACACRQ0AIAJBAWshByAIQQJ0QfCJFmohAyACQQdxIgQEQANAIAMgBTYCACADQQRqIQMgAkEBayECIARBAWsiBA0ACwsgB0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgAkEIayICDQALC0HcCEHcCCgCACAAcjYCACAGQQFqIgIgBi0AAEH/AHEiA0E/ayIAQT9LDQQaDAMLAkBB7AgoAgAiBEEBRgRAQfAIKAIAIgNBzAgoAgAiAUkNASADIAFwIQMMAQtB+AgoAgAhAkH0CCgCACEBAkACQCAEQQVHDQAgAUEBRw0AIAJB6QJODQQMAQsgAkHkAEoNA0H8CCgCAEHkAEoNA0GACSgCAEHkAEoNAwsCQCABRQ0AIAFBAkoNACACQfwIKAIAQYAJKAIAIAFBAnRBiAhqKAIAEQIAIQFB8AgoAgAiA0HMCCgCACICTwR/IAMgAnAFIAMLQQJ0QZAJaiABNgIAC0HwCCgCACIDQcwIKAIAIgFJDQAgAyABcCEDCyADQQJ0QZAJaigCACEFDAELIANB/QBxQSFHBEAgCCEBIAYhAgwECyAEQSNHDQQCQEHsCCgCACICQQFGBEBB8AgoAgAiAUHMCCgCACIASQ0BIAEgAHAhAQwBC0H4CCgCACEBQfQIKAIAIQACQAJAIAJBBUcNACAAQQFHDQAgAUHpAkgNAQwHCyABQeQASg0GQfwIKAIAQeQASg0GQYAJKAIAQeQASg0GCwJAIABFDQAgAEECSg0AIAFB/AgoAgBBgAkoAgAgAEECdEGICGooAgARAgAhAEHwCCgCACIBQcwIKAIAIgJPBH8gASACcAUgAQtBAnRBkAlqIAA2AgALQfAIKAIAIgFBzAgoAgAiAEkNACABIABwIQELIAFBAnRBkAlqKAIAIQUMBAsgCCEBIAYhAgtB1AgoAgAhBgNAAkAgASAGSA0AIAZB//8ASg0AIAZBAnQiBEGgiQJqIgZBoAgpAwA3AwAgBEGoiQJqQaAIKQMANwMAIARBsIkCakGgCCkDADcDACAEQbiJAmpBoAgpAwA3AwAgBEHAiQJqQaAIKQMANwMAIARByIkCakGgCCkDADcDACAEQdCJAmpBoAgpAwA3AwAgBEHYiQJqQaAIKQMANwMAIARB4IkCakGgCCkDADcDACAEQeiJAmpBoAgpAwA3AwAgBEHwiQJqQaAIKQMANwMAIARB+IkCakGgCCkDADcDACAEQYCKAmpBoAgpAwA3AwAgBEGIigJqQaAIKQMANwMAIARBkIoCakGgCCkDADcDACAEQZiKAmpBoAgpAwA3AwAgBEGgigJqQaAIKQMANwMAIARBqIoCakGgCCkDADcDACAEQbCKAmpBoAgpAwA3AwAgBEG4igJqQaAIKQMANwMAIARBwIoCakGgCCkDADcDACAEQciKAmpBoAgpAwA3AwAgBEHQigJqQaAIKQMANwMAIARB2IoCakGgCCkDADcDACAEQeCKAmpBoAgpAwA3AwAgBEHoigJqQaAIKQMANwMAIARB8IoCakGgCCkDADcDACAEQfiKAmpBoAgpAwA3AwAgBEGAiwJqQaAIKQMANwMAIARBiIsCakGgCCkDADcDACAEQZCLAmpBoAgpAwA3AwAgBEGYiwJqQaAIKQMANwMAIARBoIsCakGgCCkDADcDACAEQaiLAmpBoAgpAwA3AwAgBEGwiwJqQaAIKQMANwMAIARBuIsCakGgCCkDADcDACAEQcCLAmpBoAgpAwA3AwAgBEHIiwJqQaAIKQMANwMAIARB0IsCakGgCCkDADcDACAEQdiLAmpBoAgpAwA3AwAgBEHgiwJqQaAIKQMANwMAIARB6IsCakGgCCkDADcDACAEQfCLAmpBoAgpAwA3AwAgBEH4iwJqQaAIKQMANwMAIARBgIwCakGgCCkDADcDACAEQYiMAmpBoAgpAwA3AwAgBEGQjAJqQaAIKQMANwMAIARBmIwCakGgCCkDADcDACAEQaCMAmpBoAgpAwA3AwAgBEGojAJqQaAIKQMANwMAIARBsIwCakGgCCkDADcDACAEQbiMAmpBoAgpAwA3AwAgBEHAjAJqQaAIKQMANwMAIARByIwCakGgCCkDADcDACAEQdCMAmpBoAgpAwA3AwAgBEHYjAJqQaAIKQMANwMAIARB4IwCakGgCCkDADcDACAEQeiMAmpBoAgpAwA3AwAgBEHwjAJqQaAIKQMANwMAIARB+IwCakGgCCkDADcDACAEQYCNAmpBoAgpAwA3AwAgBEGIjQJqQaAIKQMANwMAIARBkI0CakGgCCkDADcDACAEQZiNAmpBoAgpAwA3AwAgBEGwiQZqIAZBgAT8CgAAQdQIKAIAQQJ0QcCJCmogBkGABPwKAABB1AgoAgBBAnRB0IkOaiAGQYAE/AoAAEHUCCgCAEECdEHgiRJqIAZBgAT8CgAAQdQIKAIAQQJ0QfCJFmogBkGABPwKAABB1AhB1AgoAgBBgAFqIgY2AgALIAFB//8ATQRAIABBAXEgAWxBAnRBoIkCaiAFNgIAIABBAXZBAXEgAWxBAnRBsIkGaiAFNgIAIABBAnZBAXEgAWxBAnRBwIkKaiAFNgIAIABBA3ZBAXEgAWxBAnRB0IkOaiAFNgIAIABBBHZBAXEgAWxBAnRB4IkSaiAFNgIAIABBBXYgAWxBAnRB8IkWaiAFNgIAQdQIKAIAIQYLIAFBAWohAUHcCEHcCCgCACAAcjYCACACLQAAIQAgAkEBaiIEIQIgAEH/AHEiA0E/ayIAQcAASQ0ACyAECyECQQAhBCACIQYgASEIIANB/QBxQSFGDQELIANBJGsOCgEDAwMDAwMDAwIDC0HsCEIBNwIADAQLQdgIIAFB2AgoAgAiACAAIAFIGyIAQYCAASAAQYCAAUgbNgIADAILQegIIAFB2AgoAgAiACAAIAFIGyIAQYCAASAAQYCAAUgbIgA2AgBB2AggADYCACAAQQRrEAAEQEHoCEEENgIAQdgIQQQ2AgBB0AhBATYCAA8LEAgMAQsCQCADQTtHDQBB7AgoAgAiAEEHSg0AQewIIABBAWo2AgAgAEECdEHwCGpBADYCAAsgAiEGIAQhAyABIQgMAQtBBCEIIAIhBiAEIQMLIAYgCUkNAAsLQeQIIAU2AgBB4AggAzYCAEHoCCAINgIAC9ELAgF+CH9B2AhCBDcDAEGojQJBoAgpAwAiADcDAEGgjQIgADcDAEGYjQIgADcDAEGQjQIgADcDAEGIjQIgADcDAEGAjQIgADcDAEH4jAIgADcDAEHwjAIgADcDAEHojAIgADcDAEHgjAIgADcDAEHYjAIgADcDAEHQjAIgADcDAEHIjAIgADcDAEHAjAIgADcDAEG4jAIgADcDAEGwjAIgADcDAEGojAIgADcDAEGgjAIgADcDAEGYjAIgADcDAEGQjAIgADcDAEGIjAIgADcDAEGAjAIgADcDAEH4iwIgADcDAEHwiwIgADcDAEHoiwIgADcDAEHgiwIgADcDAEHYiwIgADcDAEHQiwIgADcDAEHIiwIgADcDAEHAiwIgADcDAEG4iwIgADcDAEGwiwIgADcDAEGoiwIgADcDAEGgiwIgADcDAEGYiwIgADcDAEGQiwIgADcDAEGIiwIgADcDAEGAiwIgADcDAEH4igIgADcDAEHwigIgADcDAEHoigIgADcDAEHgigIgADcDAEHYigIgADcDAEHQigIgADcDAEHIigIgADcDAEHAigIgADcDAEG4igIgADcDAEGwigIgADcDAEGoigIgADcDAEGgigIgADcDAEGYigIgADcDAEGQigIgADcDAEGIigIgADcDAEGAigIgADcDAEH4iQIgADcDAEHwiQIgADcDAEHoiQIgADcDAEHgiQIgADcDAEHYiQIgADcDAEHQiQIgADcDAEHIiQIgADcDAEHAiQIgADcDAEG4iQIgADcDAEGwiQIgADcDAEGoCCgCACIEQf8AakGAAW0hCAJAIARBgQFIDQBBASEBIAhBAiAIQQJKG0EBayICQQFxIQMgBEGBAk4EQCACQX5xIQIDQCABQQl0IgdBEHJBoIkCakGwiQJBgAT8CgAAIAdBsI0CakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsLIANFDQAgAUEJdEEQckGgiQJqQbCJAkGABPwKAAALAkAgBEEBSA0AIAhBASAIQQFKGyIDQQFxIQUCQCADQQFrIgdFBEBBACEBDAELIANB/v///wdxIQJBACEBA0AgAUEJdCIGQRByQbCJBmpBsIkCQYAE/AoAACAGQZAEckGwiQZqQbCJAkGABPwKAAAgAUECaiEBIAJBAmsiAg0ACwsgBQRAIAFBCXRBEHJBsIkGakGwiQJBgAT8CgAACyAEQQFIDQAgA0EBcSEFIAcEfyADQf7///8HcSECQQAhAQNAIAFBCXQiBkEQckHAiQpqQbCJAkGABPwKAAAgBkGQBHJBwIkKakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsgAUEHdEEEcgVBBAshASAFBEAgAUECdEHAiQpqQbCJAkGABPwKAAALIARBAUgNACADQQFxIQUgBwR/IANB/v///wdxIQJBACEBA0AgAUEJdCIGQRByQdCJDmpBsIkCQYAE/AoAACAGQZAEckHQiQ5qQbCJAkGABPwKAAAgAUECaiEBIAJBAmsiAg0ACyABQQd0QQRyBUEECyEBIAUEQCABQQJ0QdCJDmpBsIkCQYAE/AoAAAsgBEEBSA0AIANBAXEhBSAHBH8gA0H+////B3EhAkEAIQEDQCABQQl0IgZBEHJB4IkSakGwiQJBgAT8CgAAIAZBkARyQeCJEmpBsIkCQYAE/AoAACABQQJqIQEgAkECayICDQALIAFBB3RBBHIFQQQLIQEgBQRAIAFBAnRB4IkSakGwiQJBgAT8CgAACyAEQQFIDQAgA0EBcSEEIAcEfyADQf7///8HcSECQQAhAQNAIAFBCXQiA0EQckHwiRZqQbCJAkGABPwKAAAgA0GQBHJB8IkWakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsgAUEHdEEEcgVBBAshASAERQ0AIAFBAnRB8IkWakGwiQJBgAT8CgAAC0HUCCAIQQd0QQRyNgIAC58TAgh/AX5B5AgoAgAhA0HgCCgCACECQegIKAIAIQcgAUGQiQFqIglB/wE6AAAgACABSARAIABBkIkBaiEIA0AgAiEEIAhBAWohAQJAIAgtAABB/wBxIgJBMGtBCUsEQCABIQgMAQtB7AgoAgBBAnRB7AhqIgUoAgAhAANAIAUgAiAAQQpsakEwayIANgIAIAEtAAAhAiABQQFqIgghASACQf8AcSICQTBrQQpJDQALCwJAAkACQAJAAkACQAJ/AkAgAkE/ayIAQT9NBEAgBEUNASAEQSFGBEBB8AgoAgAiAUEBIAEbIgQgB2ohAQJAIABFDQAgB0H//wBLDQBBgIABIAdrIAQgAUH//wBLGyEFAkAgAEEBcUUNACAHQQJ0QaCJAmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEECcUUNACAHQQJ0QbCJBmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEEcUUNACAHQQJ0QcCJCmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEIcUUNACAHQQJ0QdCJDmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEQcUUNACAHQQJ0QeCJEmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLIABBIHFFDQAgBUEBayEEIAdBAnRB8IkWaiEAIAVBB3EiAgRAA0AgACADNgIAIABBBGohACAFQQFrIQUgAkEBayICDQALCyAEQQdJDQADQCAAIAM2AhwgACADNgIYIAAgAzYCFCAAIAM2AhAgACADNgIMIAAgAzYCCCAAIAM2AgQgACADNgIAIABBIGohACAFQQhrIgUNAAsLIAhBAWoiBSAILQAAQf8AcSICQT9rIgBBP00NAxoMBAsCQEHsCCgCACIFQQFGBEBB8AgoAgAiAUHMCCgCACIESQ0BIAEgBHAhAQwBC0H4CCgCACEEQfQIKAIAIQECQAJAIAVBBUcNACABQQFHDQAgBEHpAk4NBAwBCyAEQeQASg0DQfwIKAIAQeQASg0DQYAJKAIAQeQASg0DCwJAIAFFDQAgAUECSg0AIARB/AgoAgBBgAkoAgAgAUECdEGICGooAgARAgAhBEHwCCgCACIBQcwIKAIAIgVPBH8gASAFcAUgAQtBAnRBkAlqIAQ2AgALQfAIKAIAIgFBzAgoAgAiBEkNACABIARwIQELIAFBAnRBkAlqKAIAIQMMAQsgAkH9AHFBIUcEQCAHIQEgAiEADAQLIARBI0cNBAJAQewIKAIAIgRBAUYEQEHwCCgCACIBQcwIKAIAIgBJDQEgASAAcCEBDAELQfgIKAIAIQFB9AgoAgAhAAJAAkAgBEEFRw0AIABBAUcNACABQekCSA0BDAcLIAFB5ABKDQZB/AgoAgBB5ABKDQZBgAkoAgBB5ABKDQYLAkAgAEUNACAAQQJKDQAgAUH8CCgCAEGACSgCACAAQQJ0QYgIaigCABECACEAQfAIKAIAIgFBzAgoAgAiBE8EfyABIARwBSABC0ECdEGQCWogADYCAAtB8AgoAgAiAUHMCCgCACIASQ0AIAEgAHAhAQsgAUECdEGQCWooAgAhAwwECyAHIQEgCAshBQNAIAFB//8ATQRAIABBAXEgAWxBAnRBoIkCaiADNgIAIABBAXZBAXEgAWxBAnRBsIkGaiADNgIAIABBAnZBAXEgAWxBAnRBwIkKaiADNgIAIABBA3ZBAXEgAWxBAnRB0IkOaiADNgIAIABBBHZBAXEgAWxBAnRB4IkSaiADNgIAIABBBXYgAWxBAnRB8IkWaiADNgIACyABQQFqIQEgBS0AACEAIAVBAWoiBCEFIABB/wBxIgJBP2siAEHAAEkNAAsgBCEFC0EAIQQgBSEIIAEhByACIQAgAkH9AHFBIUYNAQtBBCEHIAQhAiAAQSRrDgoDAgICAgICAgIBAgtB7AhCATcCAAwCC0GoCCgCAEEEaxAABEBB0AhBATYCAA8LAkBBqAgoAgAiBkEFSA0AQaAIKQMAIQogBkEDa0EBdiIBQQdxIQJBACEAIAFBAWtBB08EQCABQfj///8HcSEFA0AgAEEDdCIBQbCJAmogCjcDACABQQhyQbCJAmogCjcDACABQRByQbCJAmogCjcDACABQRhyQbCJAmogCjcDACABQSByQbCJAmogCjcDACABQShyQbCJAmogCjcDACABQTByQbCJAmogCjcDACABQThyQbCJAmogCjcDACAAQQhqIQAgBUEIayIFDQALCyACRQ0AA0AgAEEDdEGwiQJqIAo3AwAgAEEBaiEAIAJBAWsiAg0ACwtBwIkGQbCJAiAGQQJ0IgD8CgAAQdCJCkGwiQIgAPwKAABB4IkOQbCJAiAA/AoAAEHwiRJBsIkCIAD8CgAAQYCKFkGwiQIgAPwKAAAgBCECDAELAkAgAEE7Rw0AQewIKAIAIgBBB0oNAEHsCCAAQQFqNgIAIABBAnRB8AhqQQA2AgALIAEhBwsgCCAJSQ0ACwtB5AggAzYCAEHgCCACNgIAQegIIAc2AgAL4gcCBX8BfgJAQdAIAn8CQAJAIAAgAU4NACABQZCJAWohBiAAQZCJAWohBQNAIAUtAAAiA0H/AHEhAgJAAkACQAJAAkACQAJAQeAIKAIAIgRBIkcEQCAEDQcgAkEiRgRAQewIQgE3AgBB4AhBIjYCAAwICyACQT9rQcAASQ0GIANBIWsiAkEMTQ0BDAULAkAgAkEwayIEQQlNBEBB7AgoAgBBAnRB7AhqIgIgBCACKAIAQQpsajYCAAwBC0HsCCgCACEEIAJBO0YEQCAEQQdKDQFB7AggBEEBajYCACAEQQJ0QfAIakEANgIADAELIARBBEYEQEHECEECNgIAQbAIQfAIKQMANwMAQbgIQfgIKAIAIgI2AgBBvAhB/AgoAgAiBDYCAEHICEECQQFBwAgoAgAiAxs2AgBBrAggBEEAIAMbNgIAQagIIAJBgIABIAJBgIABSBtBBGpBACADGzYCAEHgCEEANgIADAoLIAJBP2tBwABJDQQLIANBIWsiAkEMTQ0BDAILQQEgAnRBjSBxRQ0DDAQLQQEgAnRBjSBxDQELIANBoQFrIgJBDEsNA0EBIAJ0QY0gcUUNAwtBxAhCgYCAgBA3AgBBsAhB8AgoAgBBAEHsCCgCACICQQBKGzYCAEG0CEH0CCgCAEEAIAJBAUobNgIAQbgIQfgIKAIAQQAgAkECShs2AgBB4AhBADYCAEG8CEEANgIADAQLIANBoQFrIgJBDEsNAUEBIAJ0QY0gcUUNAQtBxAhCgYCAgBA3AgBBsAhCADcDAEG4CEIANwMADAMLIAVBAWoiBSAGSQ0ACwsCQEHICCgCAA4DAwEAAQsCQEGoCCgCACIFQQVIDQBBoAgpAwAhByAFQQNrQQF2IgNBB3EhBEEAIQIgA0EBa0EHTwRAIANB+P///wdxIQYDQCACQQN0IgNBsIkCaiAHNwMAIANBCHJBsIkCaiAHNwMAIANBEHJBsIkCaiAHNwMAIANBGHJBsIkCaiAHNwMAIANBIHJBsIkCaiAHNwMAIANBKHJBsIkCaiAHNwMAIANBMHJBsIkCaiAHNwMAIANBOHJBsIkCaiAHNwMAIAJBCGohAiAGQQhrIgYNAAsLIARFDQADQCACQQN0QbCJAmogBzcDACACQQFqIQIgBEEBayIEDQALC0HAiQZBsIkCIAVBAnQiA/wKAABB0IkKQbCJAiAD/AoAAEHgiQ5BsIkCIAP8CgAAQfCJEkGwiQIgA/wKAABBgIoWQbCJAiAD/AoAAEECDAELEAhByAgoAgALEAEiAjYCACACDQAgACABQcgIKAIAQQJ0QYAIaigCABEBAAsLdABB6AhBBDYCAEHkCCAANgIAQewIQgE3AgBBxAhCADcCAEHACCADNgIAQdwIQgA3AgBBqAhCADcDAEGwCEIANwMAQbgIQgA3AwBBzAggAkGAICACQYAgSRs2AgBBoAggAa1CgYCAgBB+NwMAQdAIQQA2AgALIwBB0AgoAgBFBEAgACABQcgIKAIAQQJ0QYAIaigCABEBAAsLWgECfwJAAkACQEHICCgCAEEBaw4CAAECC0HYCEHoCCgCACIAQdgIKAIAIgEgACABShsiAEGAgAEgAEGAgAFIGyIANgIAIABBBGsPC0GoCCgCAEEEayEACyAAC0IBAX8Cf0EGQdwIKAIAIgBBIHENABpBBSAAQRBxDQAaQQQgAEEIcQ0AGkEDIABBBHENABpBAiAAQQFxIABBAnEbCwu9BQEFfQJ/IAJFBEAgAUH/AWxBMmpB5ABtIgBBCHQgAHIgAEEQdHIMAQsgArJDAADIQpUhBiAAQfABarJDAAC0Q5UhBQJ9IAGyQwAAyEKVIgNDAAAAP10EQCADIAZDAACAP5KUDAELIAYgA0MAAIA/IAaTlJILIQcgAyADkiEGAkAgBUOrqqo+kiIEQwAAAABdBEAgBEMAAIA/kiEEDAELIARDAACAP15FDQAgBEMAAIC/kiEECyAGIAeTIQMgBUMAAAAAXSEAAn8CfSADIAcgA5NDAADAQJQgBJSSIARDq6oqPl0NABogByAEQwAAAD9dDQAaIAMgBEOrqio/XUUNABogAyAHIAOTIARDAADAwJRDAACAQJKUkgtDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALIQECQCAABEAgBUMAAIA/kiEEDAELIAUiBEMAAIA/XkUNACAFQwAAgL+SIQQLIAVDq6qqvpIiBUMAAAAAXSECAn8CfSADIAcgA5NDAADAQJQgBJSSIARDq6oqPl0NABogByAEQwAAAD9dDQAaIAMgBEOrqio/XUUNABogAyAHIAOTIARDAADAwJRDAACAQJKUkgtDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALIQACQCACBEAgBUMAAIA/kiEFDAELIAVDAACAP15FDQAgBUMAAIC/kiEFCwJAIAVDq6oqPl0EQCADIAcgA5NDAADAQJQgBZSSIQcMAQsgBUMAAAA/XQ0AIAVDq6oqP11FBEAgAyEHDAELIAMgByADkyAFQwAAwMCUQwAAgECSlJIhBwsgAEEIdAJ/IAdDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALQRB0ciABcgtBgICAeHILNwAgAEH/AWxBMmpB5ABtIAFB/wFsQTJqQeQAbUEIdHIgAkH/AWxBMmpB5ABtQRB0ckGAgIB4cgsEACMACwYAIAAkAAsQACMAIABrQXBxIgAkACAACwsYAQBBgAgLEQEAAAACAAAAAwAAAAQAAAAF"}}),gS=s0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAsync=e.decode=e.Decoder=e.DecoderAsync=void 0;var t=N1(),r=mS();function n(A){if(typeof Buffer<"u")return Buffer.from(A,"base64");let k=atob(A),E=new Uint8Array(k.length);for(let I=0;I<E.length;++I)E[I]=k.charCodeAt(I);return E}var i=n(r.LIMITS.BYTES),l,c=new Uint32Array,h=class{constructor(){this.bandHandler=A=>1,this.modeHandler=A=>1}handle_band(A){return this.bandHandler(A)}mode_parsed(A){return this.modeHandler(A)}},p={memoryLimit:2048*65536,sixelColor:t.DEFAULT_FOREGROUND,fillColor:t.DEFAULT_BACKGROUND,palette:t.PALETTE_VT340_COLOR,paletteLimit:r.LIMITS.PALETTE_SIZE,truncate:!0};function g(A){let k=new h,E={env:{handle_band:k.handle_band.bind(k),mode_parsed:k.mode_parsed.bind(k)}};return WebAssembly.instantiate(l||i,E).then(I=>(l=l||I.module,new x(A,I.instance||I,k)))}e.DecoderAsync=g;var x=class{constructor(A,k,E){if(this._PIXEL_OFFSET=r.LIMITS.MAX_WIDTH+4,this._canvas=c,this._bandWidths=[],this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0,this._opts=Object.assign({},p,A),this._opts.paletteLimit>r.LIMITS.PALETTE_SIZE)throw new Error(`DecoderOptions.paletteLimit must not exceed ${r.LIMITS.PALETTE_SIZE}`);if(k)E.bandHandler=this._handle_band.bind(this),E.modeHandler=this._initCanvas.bind(this);else{let I=l||(l=new WebAssembly.Module(i));k=new WebAssembly.Instance(I,{env:{handle_band:this._handle_band.bind(this),mode_parsed:this._initCanvas.bind(this)}})}this._instance=k,this._wasm=this._instance.exports,this._chunk=new Uint8Array(this._wasm.memory.buffer,this._wasm.get_chunk_address(),r.LIMITS.CHUNK_SIZE),this._states=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_state_address(),12),this._palette=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_palette_address(),r.LIMITS.PALETTE_SIZE),this._palette.set(this._opts.palette),this._pSrc=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_p0_address()),this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}get _fillColor(){return this._states[0]}get _truncate(){return this._states[8]}get _rasterWidth(){return this._states[6]}get _rasterHeight(){return this._states[7]}get _width(){return this._states[2]?this._states[2]-4:0}get _height(){return this._states[3]}get _level(){return this._states[9]}get _mode(){return this._states[10]}get _paletteLimit(){return this._states[11]}_initCanvas(A){if(A===2){let k=this.width*this.height;if(k>this._canvas.length){if(this._opts.memoryLimit&&k*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(k)}this._maxWidth=this._width}else if(A===1)if(this._level===2){let k=Math.min(this._rasterWidth,r.LIMITS.MAX_WIDTH)*this._rasterHeight;if(k>this._canvas.length){if(this._opts.memoryLimit&&k*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(k)}}else this._canvas.length<65536&&(this._canvas=new Uint32Array(65536));return 0}_realloc(A,k){let E=A+k;if(E>this._canvas.length){if(this._opts.memoryLimit&&E*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");let I=new Uint32Array(Math.ceil(E/65536)*65536);I.set(this._canvas),this._canvas=I}}_handle_band(A){let k=this._PIXEL_OFFSET,E=this._lastOffset;if(this._mode===2){let I=this.height-this._currentHeight,M=0;for(;M<6&&I>0;)this._canvas.set(this._pSrc.subarray(k*M,k*M+A),E+A*M),M++,I--;this._lastOffset+=A*M,this._currentHeight+=M}else if(this._mode===1){this._realloc(E,A*6),this._maxWidth=Math.max(this._maxWidth,A),this._minWidth=Math.min(this._minWidth,A);for(let I=0;I<6;++I)this._canvas.set(this._pSrc.subarray(k*I,k*I+A),E+A*I);this._bandWidths.push(A),this._lastOffset+=A*6,this._currentHeight+=6}return 0}get width(){return this._mode!==1?this._width:Math.max(this._maxWidth,this._wasm.current_width())}get height(){return this._mode!==1?this._height:this._wasm.current_width()?this._bandWidths.length*6+this._wasm.current_height():this._bandWidths.length*6}get palette(){return this._palette.subarray(0,this._paletteLimit)}get memoryUsage(){return this._canvas.byteLength+this._wasm.memory.buffer.byteLength+8*this._bandWidths.length}get properties(){return{width:this.width,height:this.height,mode:this._mode,level:this._level,truncate:!!this._truncate,paletteLimit:this._paletteLimit,fillColor:this._fillColor,memUsage:this.memoryUsage,rasterAttributes:{numerator:this._states[4],denominator:this._states[5],width:this._rasterWidth,height:this._rasterHeight}}}init(A=this._opts.fillColor,k=this._opts.palette,E=this._opts.paletteLimit,I=this._opts.truncate){this._wasm.init(this._opts.sixelColor,A,E,I?1:0),k&&this._palette.set(k.subarray(0,r.LIMITS.PALETTE_SIZE)),this._bandWidths.length=0,this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0}decode(A,k=0,E=A.length){let I=k;for(;I<E;){let M=Math.min(E-I,r.LIMITS.CHUNK_SIZE);this._chunk.set(A.subarray(I,I+=M)),this._wasm.decode(0,M)}}decodeString(A,k=0,E=A.length){let I=k;for(;I<E;){let M=Math.min(E-I,r.LIMITS.CHUNK_SIZE);for(let Q=0,j=I;Q<M;++Q,++j)this._chunk[Q]=A.charCodeAt(j);I+=M,this._wasm.decode(0,M)}}get data32(){if(this._mode===0||!this.width||!this.height)return c;let A=this._wasm.current_width();if(this._mode===2){let k=this.height-this._currentHeight;if(k>0){let E=this._PIXEL_OFFSET,I=this._lastOffset,M=0;for(;M<6&&k>0;)this._canvas.set(this._pSrc.subarray(E*M,E*M+A),I+A*M),M++,k--;k&&this._canvas.fill(this._fillColor,I+A*M)}return this._canvas.subarray(0,this.width*this.height)}if(this._mode===1){if(this._minWidth===this._maxWidth){let M=!1;if(A)if(A!==this._minWidth)M=!0;else{let Q=this._PIXEL_OFFSET,j=this._lastOffset;this._realloc(j,A*6);for(let F=0;F<6;++F)this._canvas.set(this._pSrc.subarray(Q*F,Q*F+A),j+A*F)}if(!M)return this._canvas.subarray(0,this.width*this.height)}let k=new Uint32Array(this.width*this.height);k.fill(this._fillColor);let E=0,I=0;for(let M=0;M<this._bandWidths.length;++M){let Q=this._bandWidths[M];for(let j=0;j<6;++j)k.set(this._canvas.subarray(I,I+=Q),E),E+=this.width}if(A){let M=this._PIXEL_OFFSET,Q=this._wasm.current_height();for(let j=0;j<Q;++j)k.set(this._pSrc.subarray(M*j,M*j+A),E+this.width*j)}return k}return c}get data8(){return new Uint8ClampedArray(this.data32.buffer,0,this.width*this.height*4)}release(){this._canvas=c,this._bandWidths.length=0,this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}};e.Decoder=x;function b(A,k){let E=new x(k);return E.init(),typeof A=="string"?E.decodeString(A):E.decode(A),{width:E.width,height:E.height,data32:E.data32,data8:E.data8}}e.decode=b;async function w(A,k){let E=await g(k);return E.init(),typeof A=="string"?E.decodeString(A):E.decode(A),{width:E.width,height:E.height,data32:E.data32,data8:E.data8}}e.decodeAsync=w});function $p(e){return{dispose:e}}var Wb=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.clear()}}clear(){for(let e of this._disposables)e.dispose();this._disposables.clear()}},Gb=class{constructor(){this._store=new Wb}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};Gb.None=Object.freeze({dispose(){}});var xS=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},bS=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return $p(()=>{});let n={fn:e,thisArgs:t};this._listeners.push(n);let i=$p(()=>{let l=this._listeners.indexOf(n);l!==-1&&this._listeners.splice(l,1)});return r&&(Array.isArray(r)?r.push(i):r.add(i)),i},this._event)}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:r}=this._listeners[0];t.call(r,e);return}default:{let t=this._listeners.slice();for(let{fn:r,thisArgs:n}of t)r.call(n,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},yS;(e=>{function t(l,c){return l(h=>c.fire(h))}e.forward=t;function r(l,c){return(h,p,g)=>l(x=>h.call(p,c(x)),void 0,g)}e.map=r;function n(...l){return(c,h,p)=>{let g=new Wb;for(let x of l)g.add(x(b=>c.call(h,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function i(l,c,h){return c(h),l(p=>c(p))}e.runAndSubscribe=i})(yS||={});var kg=i0(N1()),Xc=class Rl extends Gb{constructor(t){super(),this._terminal=t,this._layers=new Map,this._optionsRefresh=this._register(new xS),this._oldOpen=this._terminal._core.open,this._terminal._core.open=r=>{this._oldOpen?.call(this._terminal._core,r),this._open()},this._terminal._core.screenElement&&this._open(),this._optionsRefresh.value=this._terminal._core.optionsService.onOptionChange(r=>{r==="fontSize"&&(this.rescaleCanvas(),this._renderService?.refreshRows(0,this._terminal.rows))}),this._register($p(()=>{this.removeLayerFromDom(),this.removeLayerFromDom("bottom"),this._terminal._core&&this._oldOpen&&(this._terminal._core.open=this._oldOpen,this._oldOpen=void 0),this._renderService&&this._oldSetRenderer&&(this._renderService.setRenderer=this._oldSetRenderer,this._oldSetRenderer=void 0),this._renderService=void 0,this._layers.clear(),this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0}))}get canvas(){return this._layers.get("top")?.canvas}static createCanvas(t,r,n){let i=(t??document).createElement("canvas");return i.width=r|0,i.height=n|0,i}static createImageData(t,r,n,i){if(typeof ImageData!="function"){let l=t.createImageData(r,n);return i&&l.data.set(new Uint8ClampedArray(i,0,r*n*4)),l}return i?new ImageData(new Uint8ClampedArray(i,0,r*n*4),r,n):new ImageData(r,n)}static createImageBitmap(t){return typeof createImageBitmap!="function"?Promise.resolve(void 0):createImageBitmap(t)}showPlaceholder(t){t?!this._placeholder&&this.cellSize.height!==-1&&this._createPlaceHolder(Math.max(this.cellSize.height+1,24)):(this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0),this._renderService?.refreshRows(0,this._terminal.rows)}get dimensions(){return this._terminal.dimensions}get cellSize(){return{width:this.dimensions?.css.cell.width||-1,height:this.dimensions?.css.cell.height||-1}}clearLines(t,r,n){let i=t*(this.dimensions?.css.cell.height||0),l=this.dimensions?.css.canvas.width||0,c=(r+1-t)*(this.dimensions?.css.cell.height||0);(!n||n==="top")&&this._layers.get("top")?.clearRect(0,i,l,c),(!n||n==="bottom")&&this._layers.get("bottom")?.clearRect(0,i,l,c)}clearAll(t){if(!t||t==="top"){let r=this._layers.get("top");r?.clearRect(0,0,r.canvas.width,r.canvas.height)}if(!t||t==="bottom"){let r=this._layers.get("bottom");r?.clearRect(0,0,r.canvas.width,r.canvas.height)}}draw(t,r,n,i,l=1){let c=this._layers.get(t.layer);if(!c)return;let{width:h,height:p}=this.cellSize;if(h===-1||p===-1)return;this._rescaleImage(t,h,p);let g=t.actual,x=Math.ceil(g.width/h),b=r%x*h,w=Math.floor(r/x)*p,A=n*h,k=i*p,E=l*h+b>g.width?g.width-b:l*h,I=w+p>g.height?g.height-w:p;c.drawImage(g,Math.floor(b),Math.floor(w),Math.ceil(E),Math.ceil(I),Math.floor(A),Math.floor(k),Math.ceil(E),Math.ceil(I))}extractTile(t,r){let{width:n,height:i}=this.cellSize;if(n===-1||i===-1)return;this._rescaleImage(t,n,i);let l=t.actual,c=Math.ceil(l.width/n),h=r%c*n,p=Math.floor(r/c)*i,g=n+h>l.width?l.width-h:n,x=p+i>l.height?l.height-p:i,b=Rl.createCanvas(this.document,g,x),w=b.getContext("2d");if(w)return w.drawImage(l,Math.floor(h),Math.floor(p),Math.floor(g),Math.floor(x),0,0,Math.floor(g),Math.floor(x)),b}drawPlaceholder(t,r,n=1){let i=this._layers.get("top");if(i){let{width:l,height:c}=this.cellSize;if(l===-1||c===-1||(this._placeholder?c>=this._placeholder.height&&this._createPlaceHolder(c+1):this._createPlaceHolder(Math.max(c+1,24)),!this._placeholder))return;i.drawImage(this._placeholderBitmap??this._placeholder,t*l,r*c%2?0:1,l*n,c,t*l,r*c,l*n,c)}}rescaleCanvas(){let t=this.dimensions?.css.canvas.width||0,r=this.dimensions?.css.canvas.height||0;for(let n of this._layers.values())(n.canvas.width!==t||n.canvas.height!==r)&&(n.canvas.width=t,n.canvas.height=r)}_rescaleImage(t,r,n){if(r===t.actualCellSize.width&&n===t.actualCellSize.height)return;let{width:i,height:l}=t.origCellSize;if(r===i&&n===l){t.actual=t.orig,t.actualCellSize.width=i,t.actualCellSize.height=l;return}let c=Rl.createCanvas(this.document,Math.ceil(t.orig.width*r/i),Math.ceil(t.orig.height*n/l)),h=c.getContext("2d");h&&(h.drawImage(t.orig,0,0,c.width,c.height),t.actual=c,t.actualCellSize.width=r,t.actualCellSize.height=n)}_open(){this._renderService=this._terminal._core._renderService,this._oldSetRenderer=this._renderService.setRenderer.bind(this._renderService),this._renderService.setRenderer=t=>{for(let r of[...this._layers.keys()])this.removeLayerFromDom(r);this._oldSetRenderer?.call(this._renderService,t)}}insertLayerToDom(t="top"){if(!this.document||!this._terminal._core.screenElement){console.warn("image addon: cannot insert output canvas to DOM, missing document or screenElement");return}if(this._layers.has(t))return;let r=Rl.createCanvas(this.document,this.dimensions?.css.canvas.width||0,this.dimensions?.css.canvas.height||0);r.classList.add(`xterm-image-layer-${t}`);let n=this._terminal._core.screenElement;n.style.isolation="isolate",t==="bottom"?(r.style.zIndex="-1",n.insertBefore(r,n.firstChild)):(r.style.zIndex="0",n.appendChild(r));let i=r.getContext("2d",{alpha:!0});if(!i){r.remove();return}this._layers.set(t,i),this.clearAll(t)}removeLayerFromDom(t="top"){let r=this._layers.get(t);r&&(r.canvas.remove(),this._layers.delete(t))}hasLayer(t){return this._layers.has(t)}_createPlaceHolder(t=24){this._placeholderBitmap?.close(),this._placeholderBitmap=void 0;let r=32,n=Rl.createCanvas(this.document,r,t),i=n.getContext("2d",{alpha:!1});if(!i)return;let l=Rl.createImageData(i,r,t),c=new Uint32Array(l.data.buffer),h=(0,kg.toRGBA8888)(0,0,0),p=(0,kg.toRGBA8888)(255,255,255);c.fill(h);for(let b=0;b<t;++b){let w=b%2,A=b*r;for(let k=0;k<r;k+=2)c[A+k+w]=p}i.putImageData(l,0,0);let g=screen.width+r-1&-32||4096;this._placeholder=Rl.createCanvas(this.document,g,t);let x=this._placeholder.getContext("2d",{alpha:!1});if(!x){this._placeholder=void 0;return}for(let b=0;b<g;b+=r)x.drawImage(n,b,0);Rl.createImageBitmap(this._placeholder).then(b=>this._placeholderBitmap=b)}get document(){return this._terminal._core._coreBrowserService?.window.document}},fl={width:7,height:14},Up=class Vb{constructor(t=0,r=0,n=-1,i=-1){this.imageId=n,this.tileId=i,this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}get urlId(){return this._urlId}set urlId(t){this._urlId=t}clone(){return new Vb(this._ext,this._urlId,this.imageId,this.tileId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0&&this.imageId===-1}},ud=new Up,vS=class{constructor(e,t,r){this._terminal=e,this._renderer=t,this._opts=r,this._images=new Map,this._lastId=0,this._lowestId=0,this._fullyCleared=!1,this._needsFullClear=!1,this._pixelLimit=25e5;try{this.setLimit(this._opts.storageLimit)}catch(n){n instanceof Error&&console.error(n.message),console.warn(`storageLimit is set to ${this.getLimit()} MB`)}this._viewportMetrics={cols:this._terminal.cols,rows:this._terminal.rows}}dispose(){this.reset()}reset(){for(let e of this._images.values())e.marker?.dispose();this._images.clear(),this._renderer.clearAll()}getLimit(){return this._pixelLimit*4/1e6}setLimit(e){if(e<.5||e>1e3)throw RangeError("invalid storageLimit, should be at least 0.5 MB and not exceed 1G");this._pixelLimit=e/4*1e6>>>0,this._evictOldest(0)}getUsage(){return this._getStoredPixels()*4/1e6}_getStoredPixels(){let e=0;for(let t of this._images.values())t.orig&&(e+=t.orig.width*t.orig.height,t.actual&&t.actual!==t.orig&&(e+=t.actual.width*t.actual.height));return e}_delImg(e){let t=this._images.get(e);t&&(this._images.delete(e),window.ImageBitmap&&t.orig instanceof ImageBitmap&&t.orig.close(),this.onImageDeleted?.(e))}wipeAlternate(){let e=[];for(let[t,r]of this._images.entries())r.bufferType==="alternate"&&(r.marker?.dispose(),e.push(t));for(let t of e)this._delImg(t);this._needsFullClear=!0,this._fullyCleared=!1}deleteImage(e){let t=this._images.get(e);t&&(t.marker?.dispose(),this._delImg(e))}addImage(e,t){this._evictOldest(e.width*e.height);let r=this._renderer.cellSize;(r.width===-1||r.height===-1)&&(r=fl);let n=Math.ceil(e.width/r.width),i=Math.ceil(e.height/r.height),l=++this._lastId,c=this._terminal._core.buffer,h=this._terminal.cols,p=this._terminal.rows,g=c.x,x=c.y,b=g,w=0;t.scrolling||(c.x=0,c.y=0,b=0),this._terminal._core._inputHandler._dirtyRowTracker.markDirty(c.y);for(let I=0;I<i;++I){let M=c.lines.get(c.y+c.ybase);for(let Q=0;Q<n&&!(b+Q>=h);++Q)this._writeToCell(M,b+Q,l,I*n+Q),w++;if(t.scrolling)I<i-1&&this._terminal._core._inputHandler.lineFeed();else if(++c.y>=p)break;c.x=b}this._terminal._core._inputHandler._dirtyRowTracker.markDirty(c.y),t.scrolling?t.cursorPos==="iip"?c.x=Math.min(b+n,h):c.x=b:(c.x=g,c.y=x);let A=[];for(let[I,M]of this._images.entries())M.tileCount<1&&(M.marker?.dispose(),A.push(I));for(let I of A)this._delImg(I);let k=this._terminal.registerMarker(0);k?.onDispose(()=>{this._images.get(l)&&this._delImg(l)}),this._terminal.buffer.active.type==="alternate"&&this._evictOnAlternate();let E={orig:e,origCellSize:r,actual:e,actualCellSize:{...r},marker:k||void 0,tileCount:w,bufferType:this._terminal.buffer.active.type,layer:t.layer,zIndex:t.zIndex};return this._images.set(l,E),this.onImageAdded?.(),l}render(e){let t=!1,r=!1;for(let g of this._images.values())if(g.layer==="bottom"?r=!0:t=!0,t&&r)break;if(t&&!this._renderer.hasLayer("top")&&(this._renderer.insertLayerToDom("top"),!this._renderer.hasLayer("top")))return;if(r&&!this._renderer.hasLayer("bottom")&&this._renderer.insertLayerToDom("bottom"),this._renderer.rescaleCanvas(),!this._images.size){this._fullyCleared||(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1),this._renderer.hasLayer("top")&&this._renderer.removeLayerFromDom("top"),this._renderer.hasLayer("bottom")&&this._renderer.removeLayerFromDom("bottom");return}!t&&this._renderer.hasLayer("top")&&(this._renderer.clearAll("top"),this._renderer.removeLayerFromDom("top")),!r&&this._renderer.hasLayer("bottom")&&(this._renderer.clearAll("bottom"),this._renderer.removeLayerFromDom("bottom")),this._needsFullClear&&(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1);let{start:n,end:i}=e,l=this._terminal._core.buffer,c=this._terminal._core.cols;this._renderer.clearLines(n,i);let h=[],p=[];for(let g=n;g<=i;++g){let x=l.lines.get(g+l.ydisp);if(!x)return;for(let b=0;b<c;++b){let w;if(x.getBg(b)&268435456)w=x._extendedAttrs[b]??ud;else{let E=x._extendedAttrs[b];if(!E||E.imageId===void 0||E.imageId===-1)continue;w=E}let A=w.imageId;if(A===void 0||A===-1)continue;let k=this._images.get(A);if(w.tileId!==-1){let E=w.tileId,I=b,M=1;for(;++b<c;){let Q=x._extendedAttrs[b];if(!Q||Q.imageId!==A||Q.tileId!==E+M)break;M++}b--,k?k.actual&&h.push({imgSpec:k,tileId:E,col:I,row:g,count:M}):this._opts.showPlaceholder&&p.push({col:I,row:g,count:M}),this._fullyCleared=!1}}}h.sort((g,x)=>g.imgSpec.zIndex-x.imgSpec.zIndex);for(let g of p)this._renderer.drawPlaceholder(g.col,g.row,g.count);for(let g of h)this._renderer.draw(g.imgSpec,g.tileId,g.col,g.row,g.count)}viewportResize(e){if(!this._images.size){this._viewportMetrics=e;return}if(this._viewportMetrics.cols>=e.cols){this._viewportMetrics=e;return}let t=this._terminal._core.buffer,r=t.lines.length,n=this._viewportMetrics.cols-1;for(let i=0;i<r;++i){let l=t.lines.get(i);if(l.getBg(n)&268435456){let c=l._extendedAttrs[n]??ud,h=c.imageId;if(h===void 0||h===-1)continue;let p=this._images.get(h);if(!p)continue;let g=Math.ceil((p.actual?.width||0)/p.actualCellSize.width);if(c.tileId%g+1>=g)continue;let x=!1;for(let A=n+1;A>e.cols;++A)if(l._data[A*3+0]&4194303){x=!0;break}if(x)continue;let b=Math.min(e.cols,g-c.tileId%g+n),w=c.tileId;for(let A=n+1;A<b;++A)this._writeToCell(l,A,h,++w),p.tileCount++}}this._viewportMetrics=e}getImageAtBufferCell(e,t){let r=this._terminal._core.buffer.lines.get(t);if(r&&r.getBg(e)&268435456){let n=r._extendedAttrs[e]??ud;if(n.imageId&&n.imageId!==-1){let i=this._images.get(n.imageId)?.orig;if(window.ImageBitmap&&i instanceof ImageBitmap){let l=Xc.createCanvas(window.document,i.width,i.height);return l.getContext("2d")?.drawImage(i,0,0,i.width,i.height),l}return i}}}extractTileAtBufferCell(e,t){let r=this._terminal._core.buffer.lines.get(t);if(r&&r.getBg(e)&268435456){let n=r._extendedAttrs[e]??ud;if(n.imageId&&n.imageId!==-1&&n.tileId!==-1){let i=this._images.get(n.imageId);if(i)return this._renderer.extractTile(i,n.tileId)}}}_evictOldest(e){let t=this._getStoredPixels(),r=t;for(;this._pixelLimit<r+e&&this._images.size;){let n=this._images.get(++this._lowestId);n&&n.orig&&(r-=n.orig.width*n.orig.height,n.actual&&n.orig!==n.actual&&(r-=n.actual.width*n.actual.height),n.marker?.dispose(),this._delImg(this._lowestId))}return t-r}_writeToCell(e,t,r,n){if(e._data[t*3+2]&268435456){let i=e._extendedAttrs[t];if(i){if(i.imageId!==void 0){let l=this._images.get(i.imageId);l&&l.tileCount--,i.imageId=r,i.tileId=n;return}e._extendedAttrs[t]=new Up(i.ext,i.urlId,r,n);return}}e._data[t*3+2]|=268435456,e._extendedAttrs[t]=new Up(0,0,r,n)}_evictOnAlternate(){for(let r of this._images.values())r.bufferType==="alternate"&&(r.tileCount=0);let e=this._terminal._core.buffer;for(let r=0;r<this._terminal.rows;++r){let n=e.lines.get(r);if(n){for(let i=0;i<this._terminal.cols;++i)if(n._data[i*3+2]&268435456){let l=n._extendedAttrs[i]?.imageId;if(l){let c=this._images.get(l);c&&c.tileCount++}}}}let t=[];for(let[r,n]of this._images.entries())n.bufferType==="alternate"&&!n.tileCount&&(n.marker?.dispose(),t.push(r));for(let r of t)this._delImg(r)}},wS=i0(Hb()),AS=i0(pS());function uh(e){let t="";for(let r=0;r<e.length;++r)t+=String.fromCharCode(e[r]);return t}function Lf(e){let t=0;for(let r=0;r<e.length;++r){if(e[r]<48||e[r]>57)throw new Error("illegal char");t=t*10+e[r]-48}return t}function Ig(e){let t=uh(e);if(!t.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/))throw new Error("illegal size");return t}function TS(e){if(typeof Buffer<"u")return Buffer.from(uh(e),"base64").toString();let t=atob(uh(e)),r=new Uint8Array(t.length);for(let n=0;n<r.length;++n)r[n]=t.charCodeAt(n);return new TextDecoder().decode(r)}var Eg={inline:Lf,size:Lf,name:TS,width:Ig,height:Ig,preserveAspectRatio:Lf},Ng=[70,105,108,101],Rg=[77,117,108,116,105,112,97,114,116,70,105,108,101],kf=[70,105,108,101,80,97,114,116],If=[70,105,108,101,69,110,100],Ef=[82,101,112,111,114,116,67,101,108,108,83,105,122,101],Nf=1024,CS=class{constructor(){this.state=0,this._buffer=new Uint32Array(Nf),this._position=0,this._key="",this.fields={}}reset(){this._buffer.fill(0),this.state=0,this._position=0,this.fields={},this._key=""}end(){if(this.state===0){if(this._position===If.length){for(let t=0;t<If.length;++t)if(this._buffer[t]!==If[t])return this._a();return this.fields.type=4,this.state=4,0}if(this._position===Ef.length){for(let t=0;t<Ef.length;++t)if(this._buffer[t]!==Ef[t])return this._a();return this.fields.type=5,this.state=4,0}return this._a()}return this.state===4?0:this.state===3&&this.fields.type===2?this._storeValue(this._position)?(this.state=4,0):this._a():this._a()}parse(t,r,n){let i=this.state,l=this._position,c=this._buffer;if(i===1||i===4||i===0&&l>14)return-1;for(let h=r;h<n;++h){let p=t[h];switch(p){case 59:if(!this._storeValue(l))return this._a();i=2,l=0;break;case 61:if(i===0){if(c[0]===70){let g=0;for(;g<Ng.length;++g)if(c[g]!==Ng[g])return this._a();if(this.fields.type=1,l===kf.length){for(;g<kf.length;++g)if(c[g]!==kf[g])return this._a();return this.fields.type=3,this.state=4,h+1}}else if(c[0]===77){for(let g=0;g<Rg.length;++g)if(c[g]!==Rg[g])return this._a();this.fields.type=2}else return this._a();i=2,l=0}else if(i===2){if(!this._storeKey(l))return this._a();i=3,l=0}else if(i===3){if(l>=Nf)return this._a();c[l++]=p}break;case 58:return i===3&&!this._storeValue(l)?this._a():(this.state=4,h+1);default:if(l>=Nf)return this._a();c[l++]=p}}return this.state=i,this._position=l,-2}_a(){return this.fields.type=0,this.state=1,-1}_storeKey(t){let r=uh(this._buffer.subarray(0,t));return r?(this._key=r,this.fields[r]=null,!0):!1}_storeValue(t){if(this._key){try{let r=this._buffer.slice(0,t);this.fields[this._key]=Eg[this._key]?Eg[this._key](r):r}catch{return!1}return!0}return!1}},dh={mime:"unsupported",width:0,height:0};function SS(e){if(e.length<24)return dh;let t=new Uint32Array(e.buffer,e.byteOffset,6);if(t[0]===1196314761&&t[1]===169478669&&t[3]===1380206665)return{mime:"image/png",width:e[16]<<24|e[17]<<16|e[18]<<8|e[19],height:e[20]<<24|e[21]<<16|e[22]<<8|e[23]};if(e[0]===255&&e[1]===216&&e[2]===255){let[r,n]=_S(e);return{mime:"image/jpeg",width:r,height:n}}return t[0]===944130375&&(e[4]===55||e[4]===57)&&e[5]===97?{mime:"image/gif",width:e[7]<<8|e[6],height:e[9]<<8|e[8]}:t[0]===1718185841?{mime:"image/qoi",width:e[4]<<24|e[5]<<16|e[6]<<8|e[7],height:e[8]<<24|e[9]<<16|e[10]<<8|e[11]}:dh}function _S(e){let t=e.length,r=4,n=e[r]<<8|e[r+1];for(;;){if(r+=n,r>=t)return[0,0];if(e[r]!==255)return[0,0];if(e[r+1]===192||e[r+1]===194)return r+8<t?[e[r+7]<<8|e[r+8],e[r+5]<<8|e[r+6]]:[0,0];r+=2,n=e[r]<<8|e[r+1]}}var Rf={type:0,name:"Unnamed file",size:0,width:"auto",height:"auto",preserveAspectRatio:1,inline:0},LS=class{constructor(e,t,r,n){this._opts=e,this._renderer=t,this._storage=r,this._coreTerminal=n,this._aborted=!1,this._hp=new CS,this._header=Rf,this._metrics=dh,this._isMultipart=!1,this._abortMulti=!1;let i=Math.ceil(this._opts.iipSizeLimit*4/3),l=Math.min(1048576,i);this._dec=new wS.default(4194304,i,l),this._qoiDec=new AS.default(4194304)}reset(){this._hp.reset(),this._dec.release(),this._qoiDec.release()}start(){this._aborted=!1,this._metrics=dh,this._hp.reset()}put(e,t,r){if(!this._aborted)if(this._hp.state===4)this._dec.put(e.subarray(t,r))!==0&&(this._dec.release(),this._aborted=!0);else{let n=this._hp.parse(e,t,r);if(n===-1){this._aborted=!0;return}if(n>0){if(this._hp.fields.type===1){if(this._isMultipart&&(this._isMultipart=!1,this._abortMulti=!1,this._dec.release()),this._header=Object.assign({},Rf,this._hp.fields),!this._header.inline){this._aborted=!0;return}this._dec.init()}else if(this._abortMulti){this._aborted=!0;return}this._dec.put(e.subarray(n,r))!==0&&(this._dec.release(),this._aborted=!0,this._isMultipart&&(this._abortMulti=!0))}}}end(e){if(this._aborted||this._hp.state!==4&&this._hp.end())return!0;let t=this._hp.fields.type;if(t===3)return!0;if(t===5){let c=fl.width,h=fl.height;this._renderer.dimensions&&(c=this._renderer.dimensions.css.canvas.width/this._coreTerminal.cols,h=this._renderer.dimensions.css.canvas.height/this._coreTerminal.rows);let p=this._coreTerminal._core._coreBrowserService?.dpr??1,g=`\x1B]1337;ReportCellSize=${h.toFixed(3)};${c.toFixed(3)};${p.toFixed(3)}\x1B\\`;return this._coreTerminal.input(g,!1),!0}if(t===2)return this._header=Object.assign({},Rf,this._hp.fields),this._isMultipart=!0,this._abortMulti=!1,this._dec.release(),this._dec.init(),!0;if(t===4&&(!this._isMultipart||(this._isMultipart=!1,this._abortMulti||this._header.type!==2)))return!0;let r=0,n=0,i;if((i=e)&&(i=!this._dec.end())&&(this._metrics=SS(this._dec.data8),(i=this._metrics.mime!=="unsupported")&&(r=this._metrics.width,n=this._metrics.height,(i=r&&n&&r*n<this._opts.pixelLimit)&&([r,n]=this._resize(r,n).map(Math.floor),i=r&&n&&r*n<this._opts.pixelLimit))),!i)return this._dec.release(),!0;let l;if(this._metrics.mime==="image/qoi"){let c=this._qoiDec.decode(this._dec.data8);if(l=new ImageData(new Uint8ClampedArray(c.buffer,c.byteOffset,c.byteLength),this._qoiDec.width,this._qoiDec.height),this._qoiDec.release(),r===this._qoiDec.width&&n===this._qoiDec.height){this._dec.release();let h=Xc.createCanvas(void 0,this._qoiDec.width,this._qoiDec.height);return h.getContext("2d")?.putImageData(l,0,0),this._storage.addImage(h),!0}}else l=new Blob([this._dec.data8],{type:this._metrics.mime});return this._dec.release(),createImageBitmap(l,{resizeWidth:r,resizeHeight:n}).then(c=>(this._storage.addImage(c),!0))}_resize(e,t){let r=this._renderer.dimensions?.css.cell.width||fl.width,n=this._renderer.dimensions?.css.cell.height||fl.height,i=this._renderer.dimensions?.css.canvas.width||r*this._coreTerminal.cols,l=this._renderer.dimensions?.css.canvas.height||n*this._coreTerminal.rows,c=this._dim(this._header.width,i,r),h=this._dim(this._header.height,l,n);if(!c&&!h){let p=i/e,g=(l-n)/t,x=Math.min(p,g);return x<1?[e*x,t*x]:[e,t]}return c?this._header.preserveAspectRatio||!c||!h?[c,t*c/e]:[c,h]:[e*h/t,h]}_dim(e,t,r){return e==="auto"?0:e.endsWith("%")?parseInt(e.slice(0,-1),10)*t/100:e.endsWith("px")?parseInt(e.slice(0,-2),10):parseInt(e,10)*r}},kS=i0(Hb());function Mg(e){let t={},r=e.split(",");for(let n of r){let i=n.indexOf("=");if(i===-1)continue;let l=n.substring(0,i),c=n.substring(i+1);if(l==="a"){t.action=c;continue}if(l==="o"){t.compression=c;continue}if(l==="t"){t.transmission=c;continue}if(l==="d"){t.deleteSelector=c;continue}let h=parseInt(c,10);switch(l){case"f":t.format=h;break;case"i":t.id=h;break;case"I":t.imageNumber=h;break;case"s":t.width=h;break;case"v":t.height=h;break;case"x":t.x=h;break;case"y":t.y=h;break;case"w":t.sourceWidth=h;break;case"h":t.sourceHeight=h;break;case"X":t.xOffset=h;break;case"Y":t.yOffset=h;break;case"c":t.columns=h;break;case"r":t.rows=h;break;case"m":t.more=h;break;case"q":t.quiet=h;break;case"C":t.cursorMovement=h;break;case"z":t.zIndex=h;break;case"p":t.placementId=h;break}}return t}var Dg=0,IS=class{constructor(e,t,r,n){this._opts=e,this._renderer=t,this._kittyStorage=r,this._coreTerminal=n,this._aborted=!1,this._decodeError=!1,this._activeDecoder=null,this._inControlData=!0,this._controlData=new Uint32Array(512),this._controlLength=0,this._encodedSizeLimit=0,this._totalEncodedSize=0,this._parsedCommand=null,this._pendingTransmissions=new Map,this._maxEncodedBytes=Math.ceil(this._opts.kittySizeLimit*4/3),this._initialEncodedBytes=Math.min(4194304,this._maxEncodedBytes)}reset(){this._cleanupAllPending(),this._activeDecoder&&(this._activeDecoder.release(),this._activeDecoder=null),this._kittyStorage.reset()}dispose(){this.reset()}_removePendingEntry(e){this._pendingTransmissions.delete(e),this._lastPendingKey===e&&(this._lastPendingKey=void 0)}_cleanupAllPending(){for(let e of this._pendingTransmissions.values())e.decoder.release();this._pendingTransmissions.clear(),this._lastPendingKey=void 0}start(){this._aborted=!1,this._decodeError=!1,this._inControlData=!0,this._controlLength=0,this._parsedCommand=null,this._encodedSizeLimit=this._maxEncodedBytes,this._totalEncodedSize=0,this._activeDecoder=null}put(e,t,r){if(!this._aborted)if(!this._inControlData)this._streamPayload(e,t,r);else{let n=r;for(let l=t;l<r;l++)if(e[l]===59){this._inControlData=!1,n=l;break}let i=n-t;if(this._controlLength+i>512){this._aborted=!0;return}if(this._controlData.set(e.subarray(t,n),this._controlLength),this._controlLength+=i,!this._inControlData){if(this._parsedCommand=Mg(this._parseControlDataString()),this._parsedCommand.id!==void 0&&this._parsedCommand.imageNumber!==void 0){this._sendResponse(this._parsedCommand.id,"EINVAL:cannot specify both i and I keys",this._parsedCommand.quiet??0),this._aborted=!0;return}if(this._parsedCommand.action==="d")return;let l=n+1;l<r&&this._streamPayload(e,l,r)}}}_streamPayload(e,t,r){if(this._aborted)return;let n=this._parsedCommand?.id??this._lastPendingKey??0,i=this._pendingTransmissions.get(n),l=i?.totalEncodedSize??0;if(this._totalEncodedSize+=r-t,l+this._totalEncodedSize>this._encodedSizeLimit){let c=this._activeDecoder??i?.decoder;c&&c.release(),this._activeDecoder=null,i&&this._removePendingEntry(n),this._aborted=!0;return}this._decodeError||(i?.decoder&&!this._activeDecoder&&(this._activeDecoder=i.decoder),this._activeDecoder||(this._activeDecoder=new kS.default(4194304,this._maxEncodedBytes,this._initialEncodedBytes),this._activeDecoder.init()),this._activeDecoder.put(e.subarray(t,r))!==Dg&&(this._activeDecoder.release(),this._activeDecoder=null,this._decodeError=!0,i&&this._removePendingEntry(n)))}end(e){if(this._aborted||!e)return this._activeDecoder&&(this._activeDecoder.release(),this._activeDecoder=null),!0;if(this._inControlData)return this._handleNoPayloadCommand();let t=this._parsedCommand;if(t.action==="d")return this._handleDelete(t);let r=t.id??this._lastPendingKey??0,n=t.more===1,i=this._pendingTransmissions.get(r);if(n)return this._activeDecoder&&(i?(i.totalEncodedSize+=this._totalEncodedSize,i.decodeError=i.decodeError||this._decodeError):this._pendingTransmissions.set(r,{cmd:{...t},decoder:this._activeDecoder,totalEncodedSize:this._totalEncodedSize,decodeError:this._decodeError}),this._lastPendingKey=r,this._activeDecoder=null),!0;i&&(this._lastPendingKey=void 0);let l=this._decodeError,c=t,h=this._activeDecoder;i&&(c=i.cmd,h=i.decoder,l=l||i.decodeError,this._pendingTransmissions.delete(r));let p=new Uint8Array(0);h&&(h.end()!==Dg&&(l=!0),p=h.data8),this._activeDecoder=null;let g=this._handleCommandWithBytesAndCmd(c,p,l);return h&&h.release(),g}_parseControlDataString(){let e="";for(let t=0;t<this._controlLength;t++)e+=String.fromCodePoint(this._controlData[t]);return e}_handleNoPayloadCommand(){let e=Mg(this._parseControlDataString());if(e.id!==void 0&&e.imageNumber!==void 0)return this._sendResponse(e.id,"EINVAL:cannot specify both i and I keys",e.quiet??0),!0;switch(e.action??"t"){case"d":return this._handleDelete(e);case"q":return this._sendResponse(e.id??0,"OK",e.quiet??0),!0;case"p":return this._handlePlacement(e);default:return e.id!==void 0&&this._sendResponse(e.id,"EINVAL:unsupported action",e.quiet??0),!0}}_handleCommandWithBytesAndCmd(e,t,r){switch(e.action??"t"){case"t":{let n=this._handleTransmit(e,t,r);return(e.transmission??"d")==="d"&&e.id!==void 0&&(r?this._sendResponse(e.id,"EINVAL:invalid base64 data",e.quiet??0):t.length>0&&this._sendResponse(e.id,"OK",e.quiet??0)),n}case"T":return this._handleTransmitDisplay(e,t,r);case"q":return this._handleQuery(e,t,r);case"p":return this._handlePlacement(e);default:return e.id!==void 0&&this._sendResponse(e.id,"EINVAL:unsupported action",e.quiet??0),!0}}_handlePlacement(e){if(e.id===void 0)return!0;let t=e.id,r=this._kittyStorage.getImage(t);return r?this._displayImage(r,e).then(n=>(this._sendResponse(t,n?"OK":"EINVAL:image rendering failed",e.quiet??0,e.placementId),!0)):(this._sendResponse(t,"ENOENT:image not found",e.quiet??0,e.placementId),!0)}_handleTransmit(e,t,r){return(e.transmission??"d")!=="d"?(e.id!==void 0&&this._sendResponse(e.id,"EINVAL:unsupported transmission medium",e.quiet??0),!0):(r||t.length===0||this._kittyStorage.storeImage(e.id,{data:new Blob([t]),width:e.width??0,height:e.height??0,format:e.format??32,compression:e.compression??""}),!0)}_handleTransmitDisplay(e,t,r){if(r)return e.id!==void 0&&this._sendResponse(e.id,"EINVAL:invalid base64 data",e.quiet??0),!0;this._handleTransmit(e,t,r);let n=e.id??this._kittyStorage.lastImageId,i=this._kittyStorage.getImage(n);if(i){let l=this._displayImage(i,e);return e.id!==void 0?l.then(c=>(this._sendResponse(n,c?"OK":"EINVAL:image rendering failed",e.quiet??0),!0)):l.then(()=>!0)}return!0}_handleQuery(e,t,r){let n=e.id??0,i=e.quiet??0;if((e.transmission??"d")!=="d")return this._sendResponse(n,"EINVAL:unsupported transmission medium",i),!0;if(r)return this._sendResponse(n,"EINVAL:invalid base64 data",i),!0;if(t.length===0)return this._sendResponse(n,"OK",i),!0;let l=e.format??32;if(l===100)this._sendResponse(n,"OK",i);else{let c=e.width??0,h=e.height??0;if(!c||!h)return this._sendResponse(n,"EINVAL:width and height required for raw pixel data",i),!0;let p=l===32?4:3,g=c*h*p;if(t.length<g)return this._sendResponse(n,"EINVAL:insufficient pixel data",i),!0;this._sendResponse(n,"OK",i)}return!0}_handleDelete(e){switch(e.deleteSelector??"a"){case"a":case"A":this._cleanupAllPending(),this._kittyStorage.deleteAll();break;case"i":case"I":if(e.id!==void 0){let t=this._pendingTransmissions.get(e.id);t&&t.decoder.release(),this._removePendingEntry(e.id),this._kittyStorage.deleteById(e.id)}break}return!0}_sendResponse(e,t,r,n){let i=t==="OK";if(i&&r>=1||!i&&r>=2)return;let l=n?`,p=${n}`:"",c=`\x1B_Gi=${e}${l};${t}\x1B\\`;this._coreTerminal._core.coreService.triggerDataEvent(c)}_displayImage(e,t){return this._decodeAndDisplay(e,t).then(()=>!0).catch(()=>!1)}async _decodeAndDisplay(e,t){let r=await this._createBitmap(e);try{let n=Math.max(0,t.x??0),i=Math.max(0,t.y??0),l=t.sourceWidth||r.width-n,c=t.sourceHeight||r.height-i,h=Math.max(0,r.width-n),p=Math.max(0,r.height-i),g=Math.max(0,Math.min(l,h)),x=Math.max(0,Math.min(c,p));if(g===0||x===0)throw new Error("invalid source rectangle");if(n!==0||i!==0||g!==r.width||x!==r.height){let qe=await createImageBitmap(r,n,i,g,x);r.close(),r=qe}let b=this._renderer.dimensions?.css.cell.width||fl.width,w=this._renderer.dimensions?.css.cell.height||fl.height,A,k;t.columns!==void 0&&t.rows!==void 0?(A=t.columns,k=t.rows):t.columns!==void 0?(A=t.columns,k=Math.max(1,Math.ceil(r.height/r.width*(A*b)/w))):t.rows!==void 0?(k=t.rows,A=Math.max(1,Math.ceil(r.width/r.height*(k*w)/b))):(A=Math.ceil(r.width/b),k=Math.ceil(r.height/w));let E=r.width,I=r.height;if((t.columns!==void 0||t.rows!==void 0)&&(E=Math.round(A*b),I=Math.round(k*w)),E*I>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");let M=this._coreTerminal._core.buffer,Q=M.x,j=M.y,F=M.ybase,V=t.zIndex!==void 0&&t.zIndex<0?"bottom":"top";if(E!==r.width||I!==r.height){let qe=await createImageBitmap(r,{resizeWidth:E,resizeHeight:I});r.close(),r=qe}let $=Math.min(Math.max(0,t.xOffset??0),b-1),te=Math.min(Math.max(0,t.yOffset??0),w-1);if($!==0||te!==0){let qe=t.columns!==void 0?Math.round(A*b):r.width+$,de=t.rows!==void 0?Math.round(k*w):r.height+te,oe=Xc.createCanvas(window.document,qe,de),Oe=oe.getContext("2d");if(!Oe)throw new Error("Failed to create offset canvas context");Oe.drawImage(r,$,te);let et=await createImageBitmap(oe);if(oe.width=oe.height=0,r.close(),r=et,E=r.width,I=r.height,E*I>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");t.columns===void 0&&(A=Math.ceil(r.width/b)),t.rows===void 0&&(k=Math.ceil(r.height/w))}let se=t.zIndex??0;if(this._kittyStorage.addImage(e.id,r,!0,V,se),r=void 0,t.cursorMovement===1){let qe=M.ybase-F;M.x=Q,M.y=Math.max(j-qe,0)}else M.x=Math.min(Q+A,this._coreTerminal.cols)}catch(n){throw r?.close(),n}}async _createBitmap(e){let t=new Uint8Array(await e.data.arrayBuffer());if(e.compression==="z"&&(t=await this._decompressZlib(t)),e.format===100){let E=new Blob([t],{type:"image/png"});if(!window.createImageBitmap){let I=URL.createObjectURL(E),M=new Image;return new Promise((Q,j)=>{M.addEventListener("load",()=>{URL.revokeObjectURL(I);let F=Xc.createCanvas(window.document,M.width,M.height);F.getContext("2d")?.drawImage(M,0,0),createImageBitmap(F).then(Q).catch(j)}),M.addEventListener("error",()=>{URL.revokeObjectURL(I),j(new Error("Failed to load image"))}),M.src=I})}return createImageBitmap(E)}let r=e.width,n=e.height;if(!r||!n)throw new Error("Width and height required for raw pixel data");let i=e.format===32?4:3,l=r*n*i;if(t.length<l)throw new Error("Insufficient pixel data");let c=r*n;if(e.format===32)return createImageBitmap(new ImageData(new Uint8ClampedArray(t.buffer,t.byteOffset,c*4),r,n));let h=new Uint8ClampedArray(c*4),p=new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),g=new Uint32Array(h.buffer),x=c&-4,b=0,w=0;for(let E=0;E<x;E+=4){let I=p[b++],M=p[b++],Q=p[b++];g[w++]=4278190080|I,g[w++]=4278190080|I>>>24|M<<8,g[w++]=4278190080|M>>>16|Q<<16,g[w++]=4278190080|Q>>>8}let A=x*3,k=x*4;for(let E=x;E<c;E++)h[k]=t[A],h[k+1]=t[A+1],h[k+2]=t[A+2],h[k+3]=255,A+=3,k+=4;return createImageBitmap(new ImageData(h,r,n))}async _decompressZlib(e){try{return await this._decompress(e,"deflate")}catch{return await this._decompress(e,"deflate-raw")}}async _decompress(e,t){let r=new DecompressionStream(t),n=r.writable.getWriter();n.write(e),n.close();let i=[],l=r.readable.getReader();for(;;){let{done:g,value:x}=await l.read();if(g)break;i.push(x)}let c=i.reduce((g,x)=>g+x.length,0),h=new Uint8Array(c),p=0;for(let g of i)h.set(g,p),p+=g.length;return h}get images(){return this._kittyStorage.images}get _kittyIdToStorageId(){return this._kittyStorage.kittyIdToStorageId}get pendingTransmissions(){return this._pendingTransmissions}},qb=class zp{constructor(t){this._storage=t,this._nextImageId=1,this._images=new Map,this._kittyIdToStorageId=new Map,this._storageIdToKittyId=new Map,this._handleStorageImageDeleted=r=>{let n=this._storageIdToKittyId.get(r);n!==void 0&&(this._kittyIdToStorageId.delete(n),this._storageIdToKittyId.delete(r),this._images.delete(n))},this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"},this._previousOnImageDeleted=this._storage.onImageDeleted,this._wrappedOnImageDeleted=r=>{this._previousOnImageDeleted?.(r),this._handleStorageImageDeleted(r)},this._storage.onImageDeleted=this._wrappedOnImageDeleted}reset(){this._nextImageId=1,this._images.clear(),this._kittyIdToStorageId.clear(),this._storageIdToKittyId.clear()}dispose(){this.reset(),this._storage.onImageDeleted===this._wrappedOnImageDeleted&&(this._storage.onImageDeleted=this._previousOnImageDeleted)}storeImage(t,r){let n=t??this._nextImageId++,i=this._kittyIdToStorageId.get(n);return i!==void 0&&(this._storage.deleteImage(i),this._kittyIdToStorageId.delete(n),this._storageIdToKittyId.delete(i)),!this._images.has(n)&&this._images.size>=zp._maxStoredImages&&this._evictUndisplayedImages(),this._images.set(n,{...r,id:n}),n}addImage(t,r,n,i,l){let c=this._kittyIdToStorageId.get(t);c!==void 0&&this._storageIdToKittyId.delete(c),this._addImageOpts.scrolling=n,this._addImageOpts.layer=i,this._addImageOpts.zIndex=l;let h=this._storage.addImage(r,this._addImageOpts);this._kittyIdToStorageId.set(t,h),this._storageIdToKittyId.set(h,t)}getImage(t){return this._images.get(t)}deleteById(t){this._images.delete(t);let r=this._kittyIdToStorageId.get(t);r!==void 0&&(this._storage.deleteImage(r),this._kittyIdToStorageId.delete(t),this._storageIdToKittyId.delete(r))}deleteAll(){this._images.clear();for(let t of this._kittyIdToStorageId.values())this._storage.deleteImage(t);this._kittyIdToStorageId.clear(),this._storageIdToKittyId.clear()}get images(){return this._images}get kittyIdToStorageId(){return this._kittyIdToStorageId}get lastImageId(){return this._nextImageId-1}_evictUndisplayedImages(){for(let[t]of this._images){if(this._images.size<=zp._maxStoredImages/2)break;this._kittyIdToStorageId.has(t)||this._images.delete(t)}}};qb._maxStoredImages=256;var ES=qb,Tu=i0(N1()),NS=i0(gS()),RS=4194304,Hp=Tu.PALETTE_ANSI_256;Hp.set(Tu.PALETTE_VT340_COLOR);var MS=class{constructor(e,t,r){this._opts=e,this._storage=t,this._coreTerminal=r,this._size=0,this._aborted=!1,(0,NS.DecoderAsync)({memoryLimit:this._opts.pixelLimit*4,palette:Hp,paletteLimit:this._opts.sixelPaletteLimit}).then(n=>this._dec=n)}reset(){this._dec&&(this._dec.release(),this._dec._palette.fill(0),this._dec.init(0,Hp,this._opts.sixelPaletteLimit))}hook(e){if(this._size=0,this._aborted=!1,this._dec){let t=e.params[1]===1?0:DS(this._coreTerminal._core._inputHandler._curAttrData,this._coreTerminal._core._themeService?.colors);this._dec.init(t,null,this._opts.sixelPaletteLimit)}}put(e,t,r){if(!(this._aborted||!this._dec)){if(this._size+=r-t,this._size>this._opts.sixelSizeLimit){console.warn("SIXEL: too much data, aborting"),this._aborted=!0,this._dec.release();return}try{this._dec.decode(e,t,r)}catch(n){console.warn(`SIXEL: error while decoding image - ${n}`),this._aborted=!0,this._dec.release()}}}unhook(e){if(this._aborted||!e||!this._dec)return!0;let t=this._dec.width,r=this._dec.height;if(!t||!r)return r&&this._storage.advanceCursor(r),!0;let n=Xc.createCanvas(void 0,t,r);return n.getContext("2d")?.putImageData(new ImageData(this._dec.data8,t,r),0,0),this._dec.memoryUsage>RS&&this._dec.release(),this._storage.addImage(n),!0}};function DS(e,t){let r=0;if(!t)return r;if(e.isInverse())if(e.isFgDefault())r=dd(t.foreground.rgba);else if(e.isFgRGB()){let n=e.constructor.toColorRGB(e.getFgColor());r=(0,Tu.toRGBA8888)(...n)}else r=dd(t.ansi[e.getFgColor()].rgba);else if(e.isBgDefault())r=dd(t.background.rgba);else if(e.isBgRGB()){let n=e.constructor.toColorRGB(e.getBgColor());r=(0,Tu.toRGBA8888)(...n)}else r=dd(t.ansi[e.getBgColor()].rgba);return r}function dd(e){return Tu.BIG_ENDIAN?e:(e&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255}var BS=class{constructor(e,t,r,n){this._storage=e,this._opts=t,this._renderer=r,this._terminal=n,this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"vt340"}}addImage(e){this._addImageOpts.scrolling=this._opts.sixelScrolling,this._storage.addImage(e,this._addImageOpts)}advanceCursor(e){if(this._opts.sixelScrolling){let t=this._renderer.cellSize;(t.width===-1||t.height===-1)&&(t=fl);let r=Math.ceil(e/t.height);for(let n=1;n<r;++n)this._terminal._core._inputHandler.lineFeed()}}},QS=class{constructor(e){this._storage=e,this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"}}addImage(e){this._storage.addImage(e,this._addImageOpts)}},Bg={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:4096,sixelSizeLimit:33554432,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:33554432,kittySupport:!0,kittySizeLimit:33554432},Qg=4096,jS=class{constructor(t){this._disposables=[],this._handlers=new Map,this._onImageAdded=new bS,this.onImageAdded=this._onImageAdded.event,this._opts=Object.assign({},Bg,t),this._defaultOpts=Object.assign({},Bg,t)}dispose(){for(let t of this._disposables)t.dispose();this._disposables.length=0,this._handlers.clear(),this._onImageAdded.dispose()}_disposeLater(...t){for(let r of t)this._disposables.push(r)}activate(t){if(this._terminal=t,this._renderer=new Xc(t),this._storage=new vS(t,this._renderer,this._opts),this._storage.onImageAdded=()=>this._onImageAdded.fire(),this._opts.enableSizeReports){let r=t.options.windowOptions??{};r.getWinSizePixels=!0,r.getCellSizePixels=!0,r.getWinSizeChars=!0,t.options.windowOptions=r}if(this._disposeLater(this._renderer,this._storage,t.parser.registerCsiHandler({prefix:"?",final:"h"},r=>this._decset(r)),t.parser.registerCsiHandler({prefix:"?",final:"l"},r=>this._decrst(r)),t.parser.registerCsiHandler({final:"c"},r=>this._da1(r)),t.parser.registerCsiHandler({prefix:"?",final:"S"},r=>this._xtermGraphicsAttributes(r)),t.onRender(r=>this._storage?.render(r)),t.parser.registerCsiHandler({intermediates:"!",final:"p"},()=>this.reset()),t.parser.registerEscHandler({final:"c"},()=>this.reset()),t._core._inputHandler.onRequestReset(()=>this.reset()),t.buffer.onBufferChange(()=>this._storage?.wipeAlternate()),t.onResize(r=>this._storage?.viewportResize(r))),this._opts.sixelSupport){let r=new BS(this._storage,this._opts,this._renderer,t),n=new MS(this._opts,r,t);this._handlers.set("sixel",n),this._disposeLater(t._core._inputHandler._parser.registerDcsHandler({final:"q"},n))}if(this._opts.iipSupport){let r=new QS(this._storage),n=new LS(this._opts,this._renderer,r,t);this._handlers.set("iip",n),this._disposeLater(t._core._inputHandler._parser.registerOscHandler(1337,n))}if(this._opts.kittySupport){let r=new ES(this._storage),n=new IS(this._opts,this._renderer,r,t);this._handlers.set("kitty",n),this._disposeLater(r,n,t._core._inputHandler._parser.registerApcHandler({final:"G"},n))}}reset(){this._opts.sixelScrolling=this._defaultOpts.sixelScrolling,this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._storage?.reset();for(let t of this._handlers.values())t.reset();return!1}get storageLimit(){return this._storage?.getLimit()||-1}set storageLimit(t){this._storage?.setLimit(t),this._opts.storageLimit=t}get storageUsage(){return this._storage?this._storage.getUsage():-1}get showPlaceholder(){return this._opts.showPlaceholder}set showPlaceholder(t){this._opts.showPlaceholder=t,this._renderer?.showPlaceholder(t)}getImageAtBufferCell(t,r){return this._storage?.getImageAtBufferCell(t,r)}extractTileAtBufferCell(t,r){return this._storage?.extractTileAtBufferCell(t,r)}_report(t){this._terminal?._core.input(t,!1)}_decset(t){for(let r=0;r<t.length;++r)t[r]===80&&(this._opts.sixelScrolling=!1);return!1}_decrst(t){for(let r=0;r<t.length;++r)t[r]===80&&(this._opts.sixelScrolling=!0);return!1}_da1(t){return t[0]?!0:this._opts.sixelSupport?(this._report("\x1B[?62;4;9;22c"),!0):!1}_xtermGraphicsAttributes(t){if(t.length<2)return!0;if(t[0]===1)switch(t[1]){case 1:return this._report(`\x1B[?${t[0]};0;${this._opts.sixelPaletteLimit}S`),!0;case 2:this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._report(`\x1B[?${t[0]};0;${this._opts.sixelPaletteLimit}S`);for(let r of this._handlers.values())r.reset();return!0;case 3:return t.length>2&&!(t[2]instanceof Array)&&t[2]<=Qg?(this._opts.sixelPaletteLimit=t[2],this._report(`\x1B[?${t[0]};0;${this._opts.sixelPaletteLimit}S`)):this._report(`\x1B[?${t[0]};2S`),!0;case 4:return this._report(`\x1B[?${t[0]};0;${Qg}S`),!0;default:return this._report(`\x1B[?${t[0]};2S`),!0}if(t[0]===2)switch(t[1]){case 1:let r=this._renderer?.dimensions?.css.canvas.width,n=this._renderer?.dimensions?.css.canvas.height;if(!r||!n){let l=fl;r=(this._terminal?.cols||80)*l.width,n=(this._terminal?.rows||24)*l.height}if(r*n<this._opts.pixelLimit)this._report(`\x1B[?${t[0]};0;${r.toFixed(0)};${n.toFixed(0)}S`);else{let l=Math.floor(Math.sqrt(this._opts.pixelLimit));this._report(`\x1B[?${t[0]};0;${l};${l}S`)}return!0;case 4:let i=Math.floor(Math.sqrt(this._opts.pixelLimit));return this._report(`\x1B[?${t[0]};0;${i};${i}S`),!0;default:return this._report(`\x1B[?${t[0]};2S`),!0}return this._report(`\x1B[?${t[0]};1S`),!0}};const Cc=new Map;function Oc(e){return{name:e,get hasSubscribers(){return(Cc.get(e)?.size??0)>0},publish(t){const r=Cc.get(e);if(r)for(const n of r)n(t,e)},subscribe(t){const r=Cc.get(e)??new Set;r.add(t),Cc.set(e,r)},unsubscribe(t){const r=Cc.get(e);if(!r)return!1;const n=r.delete(t);return r.size===0&&Cc.delete(e),n}}}function PS(e){const t={start:`${e}:start`,end:`${e}:end`,asyncStart:`${e}:asyncStart`,asyncEnd:`${e}:asyncEnd`,error:`${e}:error`},r={start:Oc(t.start),end:Oc(t.end),asyncStart:Oc(t.asyncStart),asyncEnd:Oc(t.asyncEnd),error:Oc(t.error),traceSync(n,i,l,...c){r.start.publish(i);try{const h=n.apply(l,c);return r.end.publish(i),h}catch(h){throw r.error.publish(h),h}},async tracePromise(n,i,l,...c){r.asyncStart.publish(i);try{const h=await n.apply(l,c);return r.asyncEnd.publish(i),h}catch(h){throw r.error.publish(h),h}},traceCallback(n,i,l,c,...h){r.start.publish(l);try{const p=n.apply(c,h);return r.end.publish(l),p}catch(p){throw r.error.publish(p),p}}};return r}var OS=Object.create,R1=Object.defineProperty,FS=Object.getOwnPropertyDescriptor,$S=Object.getOwnPropertyNames,US=Object.getPrototypeOf,zS=Object.prototype.hasOwnProperty,Yb=e=>{throw TypeError(e)},HS=(e,t,r)=>t in e?R1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,WS=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},GS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $S(t))!zS.call(e,i)&&i!==r&&R1(e,i,{get:()=>t[i],enumerable:!(n=FS(t,i))||n.enumerable});return e},VS=(e,t,r)=>(r=e!=null?OS(US(e)):{},GS(!e||!e.__esModule?R1(r,"default",{value:e,enumerable:!0}):r,e)),js=(e,t,r)=>HS(e,typeof t!="symbol"?t+"":t,r),M1=(e,t,r)=>t.has(e)||Yb("Cannot "+r),Z=(e,t,r)=>(M1(e,t,"read from private field"),r?r.call(e):t.get(e)),dn=(e,t,r)=>t.has(e)?Yb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Tr=(e,t,r,n)=>(M1(e,t,"write to private field"),t.set(e,r),r),Vt=(e,t,r)=>(M1(e,t,"access private method"),r),Mf=(e,t,r,n)=>({set _(i){Tr(e,t,i)},get _(){return Z(e,t,n)}}),qS=WS((e,t)=>{var r=(()=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,h=(s,o)=>{for(var u in o)n(s,u,{get:o[u],enumerable:!0})},p=(s,o,u,d)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of l(o))!c.call(s,f)&&f!==u&&n(s,f,{get:()=>o[f],enumerable:!(d=i(o,f))||d.enumerable});return s},g=s=>p(n({},"__esModule",{value:!0}),s),x={};h(x,{BoundingBox:()=>K,Font:()=>Rm,Glyph:()=>fs,Path:()=>Ke,_parse:()=>st,load:()=>d7,loadSync:()=>h7,parse:()=>u7});var b=0,w=-3;function A(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function k(s,o){this.source=s,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=o,this.destLen=0,this.ltree=new A,this.dtree=new A}var E=new A,I=new A,M=new Uint8Array(30),Q=new Uint16Array(30),j=new Uint8Array(30),F=new Uint16Array(30),V=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$=new A,te=new Uint8Array(320);function se(s,o,u,d){var f,m;for(f=0;f<u;++f)s[f]=0;for(f=0;f<30-u;++f)s[f+u]=f/u|0;for(m=d,f=0;f<30;++f)o[f]=m,m+=1<<s[f]}function qe(s,o){var u;for(u=0;u<7;++u)s.table[u]=0;for(s.table[7]=24,s.table[8]=152,s.table[9]=112,u=0;u<24;++u)s.trans[u]=256+u;for(u=0;u<144;++u)s.trans[24+u]=u;for(u=0;u<8;++u)s.trans[168+u]=280+u;for(u=0;u<112;++u)s.trans[176+u]=144+u;for(u=0;u<5;++u)o.table[u]=0;for(o.table[5]=32,u=0;u<32;++u)o.trans[u]=u}var de=new Uint16Array(16);function oe(s,o,u,d){var f,m;for(f=0;f<16;++f)s.table[f]=0;for(f=0;f<d;++f)s.table[o[u+f]]++;for(s.table[0]=0,m=0,f=0;f<16;++f)de[f]=m,m+=s.table[f];for(f=0;f<d;++f)o[u+f]&&(s.trans[de[o[u+f]]++]=f)}function Oe(s){s.bitcount--||(s.tag=s.source[s.sourceIndex++],s.bitcount=7);var o=s.tag&1;return s.tag>>>=1,o}function et(s,o,u){if(!o)return u;for(;s.bitcount<24;)s.tag|=s.source[s.sourceIndex++]<<s.bitcount,s.bitcount+=8;var d=s.tag&65535>>>16-o;return s.tag>>>=o,s.bitcount-=o,d+u}function ce(s,o){for(;s.bitcount<24;)s.tag|=s.source[s.sourceIndex++]<<s.bitcount,s.bitcount+=8;var u=0,d=0,f=0,m=s.tag;do d=2*d+(m&1),m>>>=1,++f,u+=o.table[f],d-=o.table[f];while(d>=0);return s.tag=m,s.bitcount-=f,o.trans[u+d]}function Be(s,o,u){var d,f,m,v,T,_;for(d=et(s,5,257),f=et(s,5,1),m=et(s,4,4),v=0;v<19;++v)te[v]=0;for(v=0;v<m;++v){var R=et(s,3,0);te[V[v]]=R}for(oe($,te,0,19),T=0;T<d+f;){var N=ce(s,$);switch(N){case 16:var G=te[T-1];for(_=et(s,2,3);_;--_)te[T++]=G;break;case 17:for(_=et(s,3,3);_;--_)te[T++]=0;break;case 18:for(_=et(s,7,11);_;--_)te[T++]=0;break;default:te[T++]=N;break}}oe(o,te,0,d),oe(u,te,d,f)}function ot(s,o,u){for(;;){var d=ce(s,o);if(d===256)return b;if(d<256)s.dest[s.destLen++]=d;else{var f,m,v,T;for(d-=257,f=et(s,M[d],Q[d]),m=ce(s,u),v=s.destLen-et(s,j[m],F[m]),T=v;T<v+f;++T)s.dest[s.destLen++]=s.dest[T]}}}function Ie(s){for(var o,u,d;s.bitcount>8;)s.sourceIndex--,s.bitcount-=8;if(o=s.source[s.sourceIndex+1],o=256*o+s.source[s.sourceIndex],u=s.source[s.sourceIndex+3],u=256*u+s.source[s.sourceIndex+2],o!==(~u&65535))return w;for(s.sourceIndex+=4,d=o;d;--d)s.dest[s.destLen++]=s.source[s.sourceIndex++];return s.bitcount=0,b}function re(s,o){var u=new k(s,o),d,f,m;do{switch(d=Oe(u),f=et(u,2,0),f){case 0:m=Ie(u);break;case 1:m=ot(u,E,I);break;case 2:Be(u,u.ltree,u.dtree),m=ot(u,u.ltree,u.dtree);break;default:m=w}if(m!==b)throw new Error("Data error")}while(!d);return u.destLen<u.dest.length?typeof u.dest.slice=="function"?u.dest.slice(0,u.destLen):u.dest.subarray(0,u.destLen):u.dest}qe(E,I),se(M,Q,4,3),se(j,F,2,1),M[28]=0,Q[28]=258;function Ue(s,o,u,d,f){return Math.pow(1-f,3)*s+3*Math.pow(1-f,2)*f*o+3*(1-f)*Math.pow(f,2)*u+Math.pow(f,3)*d}function _e(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}_e.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},_e.prototype.addPoint=function(s,o){typeof s=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=s,this.x2=s),s<this.x1&&(this.x1=s),s>this.x2&&(this.x2=s)),typeof o=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=o,this.y2=o),o<this.y1&&(this.y1=o),o>this.y2&&(this.y2=o))},_e.prototype.addX=function(s){this.addPoint(s,null)},_e.prototype.addY=function(s){this.addPoint(null,s)},_e.prototype.addBezier=function(s,o,u,d,f,m,v,T){let _=[s,o],R=[u,d],N=[f,m],G=[v,T];this.addPoint(s,o),this.addPoint(v,T);for(let W=0;W<=1;W++){let he=6*_[W]-12*R[W]+6*N[W],ie=-3*_[W]+9*R[W]-9*N[W]+3*G[W],ye=3*R[W]-3*_[W];if(ie===0){if(he===0)continue;let Cr=-ye/he;0<Cr&&Cr<1&&(W===0&&this.addX(Ue(_[W],R[W],N[W],G[W],Cr)),W===1&&this.addY(Ue(_[W],R[W],N[W],G[W],Cr)));continue}let Je=Math.pow(he,2)-4*ye*ie;if(Je<0)continue;let gr=(-he+Math.sqrt(Je))/(2*ie);0<gr&&gr<1&&(W===0&&this.addX(Ue(_[W],R[W],N[W],G[W],gr)),W===1&&this.addY(Ue(_[W],R[W],N[W],G[W],gr)));let or=(-he-Math.sqrt(Je))/(2*ie);0<or&&or<1&&(W===0&&this.addX(Ue(_[W],R[W],N[W],G[W],or)),W===1&&this.addY(Ue(_[W],R[W],N[W],G[W],or)))}},_e.prototype.addQuad=function(s,o,u,d,f,m){let v=s+.6666666666666666*(u-s),T=o+2/3*(d-o),_=v+1/3*(f-s),R=T+1/3*(m-o);this.addBezier(s,o,v,T,_,R,f,m)};var K=_e;function Le(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}var fe={};function $e(s,o){let u=Math.floor(s),d=s-u;if(fe[o]||(fe[o]={}),fe[o][d]!==void 0){let m=fe[o][d];return u+m}let f=+(Math.round(d+"e+"+o)+"e-"+o);return fe[o][d]=f,u+f}function ze(s){let o=[[]],u=0,d=0;for(let f=0;f<s.length;f+=1){let m=o[o.length-1],v=s[f],T=m[0],_=m[1],R=m[m.length-1],N=s[f+1];m.push(v),v.type==="M"?(u=v.x,d=v.y):v.type==="L"&&(!N||N.type==="Z")?Math.abs(v.x-u)>1||Math.abs(v.y-d)>1||m.pop():v.type==="L"&&R&&R.x===v.x&&R.y===v.y?m.pop():v.type==="Z"&&(T&&_&&R&&T.type==="M"&&_.type==="L"&&R.type==="L"&&R.x===T.x&&R.y===T.y&&(m.shift(),m[0].type="M"),f+1<s.length&&o.push([]))}return s=[].concat.apply([],o),s}function Ee(s){return Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0,scale:1,x:0,y:0},s)}function ee(s){return parseInt(s)===s&&(s={decimalPlaces:s,flipY:!1}),Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0},s)}Le.prototype.fromSVG=function(s,o={}){typeof SVGPathElement<"u"&&s instanceof SVGPathElement&&(s=s.getAttribute("d")),o=Ee(o),this.commands=[];let u="0123456789",d="MmLlQqCcZzHhVv",f="SsTtAa",m="-+",v={},T=[""],_=!1;function R(ie){return ie.filter(ye=>ye.length).map(ye=>{let Je=parseFloat(ye);return(o.decimalPlaces||o.decimalPlaces===0)&&(Je=$e(Je,o.decimalPlaces)),Je})}function N(ie){if(!this.commands.length)return ie;let ye=this.commands[this.commands.length-1];for(let Je=0;Je<ie.length;Je++)ie[Je]+=ye[Je&1?"y":"x"];return ie}function G(){if(v.type===void 0)return;let ie=v.type.toUpperCase(),ye=ie!=="Z"&&v.type.toUpperCase()!==v.type,Je=R(T);if(T=[""],!Je.length&&ie!=="Z")return;ye&&ie!=="H"&&ie!=="V"&&(Je=N.apply(this,[Je]));let gr=this.commands.length&&this.commands[this.commands.length-1].x||0,or=this.commands.length&&this.commands[this.commands.length-1].y||0;switch(ie){case"M":this.moveTo(...Je);break;case"L":this.lineTo(...Je);break;case"V":for(let Cr=0;Cr<Je.length;Cr++){let Yr=0;ye&&(Yr=this.commands.length&&this.commands[this.commands.length-1].y||0),this.lineTo(gr,Je[Cr]+Yr)}break;case"H":for(let Cr=0;Cr<Je.length;Cr++){let Yr=0;ye&&(Yr=this.commands.length&&this.commands[this.commands.length-1].x||0),this.lineTo(Je[Cr]+Yr,or)}break;case"C":this.bezierCurveTo(...Je);break;case"Q":this.quadraticCurveTo(...Je);break;case"Z":(this.commands.length<1||this.commands[this.commands.length-1].type!=="Z")&&this.close();break}if(this.commands.length)for(let Cr in this.commands[this.commands.length-1])this.commands[this.commands.length-1][Cr]===void 0&&(this.commands[this.commands.length-1][Cr]=0)}for(let ie=0;ie<s.length;ie++){let ye=s.charAt(ie),Je=T[T.length-1];if(u.indexOf(ye)>-1)T[T.length-1]+=ye;else if(m.indexOf(ye)>-1)if(!v.type&&!this.commands.length&&(v.type="L"),ye==="-")!v.type||Je.indexOf("-")>0?_=!0:Je.length?T.push("-"):T[T.length-1]=ye;else if(!v.type||Je.length>0)_=!0;else continue;else if(d.indexOf(ye)>-1)v.type?(G.apply(this),v={type:ye}):v.type=ye;else{if(f.indexOf(ye)>-1)throw new Error("Unsupported path command: "+ye+". Currently supported commands are "+d.split("").join(", ")+".");` ,
|
|
62
|
-
\r\f\v`.indexOf(ye)>-1?T.push(""):ye==="."?!v.type||Je.indexOf(ye)>-1?_=!0:T[T.length-1]+=ye:_=!0}if(_)throw new Error("Unexpected character: "+ye+" at offset "+ie)}G.apply(this),o.optimize&&(this.commands=ze(this.commands));let W=o.flipY,he=o.flipYBase;if(W===!0&&o.flipYBase===void 0){let ie=this.getBoundingBox();he=ie.y1+ie.y2}for(let ie in this.commands){let ye=this.commands[ie];for(let Je in ye)["x","x1","x2"].includes(Je)?this.commands[ie][Je]=o.x+ye[Je]*o.scale:["y","y1","y2"].includes(Je)&&(this.commands[ie][Je]=o.y+(W?he-ye[Je]:ye[Je])*o.scale)}return this},Le.fromSVG=function(s,o){return new Le().fromSVG(s,o)},Le.prototype.moveTo=function(s,o){this.commands.push({type:"M",x:s,y:o})},Le.prototype.lineTo=function(s,o){this.commands.push({type:"L",x:s,y:o})},Le.prototype.curveTo=Le.prototype.bezierCurveTo=function(s,o,u,d,f,m){this.commands.push({type:"C",x1:s,y1:o,x2:u,y2:d,x:f,y:m})},Le.prototype.quadTo=Le.prototype.quadraticCurveTo=function(s,o,u,d){this.commands.push({type:"Q",x1:s,y1:o,x:u,y:d})},Le.prototype.close=Le.prototype.closePath=function(){this.commands.push({type:"Z"})},Le.prototype.extend=function(s){if(s.commands)s=s.commands;else if(s instanceof K){let o=s;this.moveTo(o.x1,o.y1),this.lineTo(o.x2,o.y1),this.lineTo(o.x2,o.y2),this.lineTo(o.x1,o.y2),this.close();return}Array.prototype.push.apply(this.commands,s)},Le.prototype.getBoundingBox=function(){let s=new K,o=0,u=0,d=0,f=0;for(let m=0;m<this.commands.length;m++){let v=this.commands[m];switch(v.type){case"M":s.addPoint(v.x,v.y),o=d=v.x,u=f=v.y;break;case"L":s.addPoint(v.x,v.y),d=v.x,f=v.y;break;case"Q":s.addQuad(d,f,v.x1,v.y1,v.x,v.y),d=v.x,f=v.y;break;case"C":s.addBezier(d,f,v.x1,v.y1,v.x2,v.y2,v.x,v.y),d=v.x,f=v.y;break;case"Z":d=o,f=u;break;default:throw new Error("Unexpected path command "+v.type)}}return s.isEmpty()&&s.addPoint(0,0),s},Le.prototype.draw=function(s){let o=this._layers;if(o&&o.length){for(let d=0;d<o.length;d++)this.draw.call(o[d],s);return}let u=this._image;if(u){s.drawImage(u.image,u.x,u.y,u.width,u.height);return}s.beginPath();for(let d=0;d<this.commands.length;d+=1){let f=this.commands[d];f.type==="M"?s.moveTo(f.x,f.y):f.type==="L"?s.lineTo(f.x,f.y):f.type==="C"?s.bezierCurveTo(f.x1,f.y1,f.x2,f.y2,f.x,f.y):f.type==="Q"?s.quadraticCurveTo(f.x1,f.y1,f.x,f.y):f.type==="Z"&&this.stroke&&this.strokeWidth&&s.closePath()}this.fill&&(s.fillStyle=this.fill,s.fill()),this.stroke&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeWidth,s.stroke())},Le.prototype.toPathData=function(s){s=ee(s);function o(T){let _=$e(T,s.decimalPlaces);return Math.round(T)===_?""+_:_.toFixed(s.decimalPlaces)}function u(){let T="";for(let _=0;_<arguments.length;_+=1){let R=arguments[_];R>=0&&_>0&&(T+=" "),T+=o(R)}return T}let d=this.commands;s.optimize&&(d=JSON.parse(JSON.stringify(this.commands)),d=ze(d));let f=s.flipY,m=s.flipYBase;if(f===!0&&m===void 0){let T=new Le;T.extend(d);let _=T.getBoundingBox();m=_.y1+_.y2}let v="";for(let T=0;T<d.length;T+=1){let _=d[T];_.type==="M"?v+="M"+u(_.x,f?m-_.y:_.y):_.type==="L"?v+="L"+u(_.x,f?m-_.y:_.y):_.type==="C"?v+="C"+u(_.x1,f?m-_.y1:_.y1,_.x2,f?m-_.y2:_.y2,_.x,f?m-_.y:_.y):_.type==="Q"?v+="Q"+u(_.x1,f?m-_.y1:_.y1,_.x,f?m-_.y:_.y):_.type==="Z"&&(v+="Z")}return v},Le.prototype.toSVG=function(s,o){this._layers&&this._layers.length&&console.warn("toSVG() does not support colr font layers yet"),this._image&&console.warn("toSVG() does not support SVG glyphs yet"),o||(o=this.toPathData(s));let u='<path d="';return u+=o,u+='"',this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?u+=' fill="none"':u+=' fill="'+this.fill+'"'),this.stroke&&(u+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),u+="/>",u},Le.prototype.toDOMElement=function(s,o){this._layers&&this._layers.length&&console.warn("toDOMElement() does not support colr font layers yet"),o||(o=this.toPathData(s));let u=document.createElementNS("http://www.w3.org/2000/svg","path");return u.setAttribute("d",o),this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?u.setAttribute("fill","none"):u.setAttribute("fill",this.fill)),this.stroke&&(u.setAttribute("stroke",this.stroke),u.setAttribute("stroke-width",this.strokeWidth)),u};var Ke=Le;function wt(s){throw new Error(s)}function tt(s,o){s||wt(o)}var ge={fail:wt,argument:tt,assert:tt},it=32768,ht=2147483648,Y=-32768,be=32767+1/65536,ut={},le={},pe={};function je(s){return function(){return s}}le.BYTE=function(s){return ge.argument(s>=0&&s<=255,"Byte value should be between 0 and 255."),[s]},pe.BYTE=je(1),le.CHAR=function(s){return[s.charCodeAt(0)]},pe.CHAR=je(1),le.CHARARRAY=function(s){(s===null||typeof s>"u")&&(s="",console.warn("CHARARRAY with undefined or null value encountered and treated as an empty string. This is probably caused by a missing glyph name."));let o=[];for(let u=0;u<s.length;u+=1)o[u]=s.charCodeAt(u);return o},pe.CHARARRAY=function(s){return typeof s>"u"?0:s.length},le.USHORT=function(s){return[s>>8&255,s&255]},pe.USHORT=je(2),le.SHORT=function(s){return s>=it&&(s=-(2*it-s)),[s>>8&255,s&255]},pe.SHORT=je(2),le.UINT24=function(s){return[s>>16&255,s>>8&255,s&255]},pe.UINT24=je(3),le.ULONG=function(s){return[s>>24&255,s>>16&255,s>>8&255,s&255]},pe.ULONG=je(4),le.LONG=function(s){return s>=ht&&(s=-(2*ht-s)),[s>>24&255,s>>16&255,s>>8&255,s&255]},pe.LONG=je(4),le.FLOAT=function(s){if(s>be||s<Y)throw new Error(`Value ${s} is outside the range of representable values in 16.16 format`);let o=Math.round(s*65536)<<0;return le.ULONG(o)},pe.FLOAT=pe.ULONG,le.FIXED=le.ULONG,pe.FIXED=pe.ULONG,le.FWORD=le.SHORT,pe.FWORD=pe.SHORT,le.UFWORD=le.USHORT,pe.UFWORD=pe.USHORT,le.F2DOT14=function(s){return le.USHORT(s*16384)},pe.F2DOT14=pe.USHORT,le.LONGDATETIME=function(s){return[0,0,0,0,s>>24&255,s>>16&255,s>>8&255,s&255]},pe.LONGDATETIME=je(8),le.TAG=function(s){return ge.argument(s.length===4,"Tag should be exactly 4 ASCII characters."),[s.charCodeAt(0),s.charCodeAt(1),s.charCodeAt(2),s.charCodeAt(3)]},pe.TAG=je(4),le.Card8=le.BYTE,pe.Card8=pe.BYTE,le.Card16=le.USHORT,pe.Card16=pe.USHORT,le.OffSize=le.BYTE,pe.OffSize=pe.BYTE,le.SID=le.USHORT,pe.SID=pe.USHORT,le.NUMBER=function(s){return s>=-107&&s<=107?[s+139]:s>=108&&s<=1131?(s=s-108,[(s>>8)+247,s&255]):s>=-1131&&s<=-108?(s=-s-108,[(s>>8)+251,s&255]):s>=-32768&&s<=32767?le.NUMBER16(s):le.NUMBER32(s)},pe.NUMBER=function(s){return le.NUMBER(s).length},le.NUMBER16=function(s){return[28,s>>8&255,s&255]},pe.NUMBER16=je(3),le.NUMBER32=function(s){return[29,s>>24&255,s>>16&255,s>>8&255,s&255]},pe.NUMBER32=je(5),le.REAL=function(s){let o=s.toString(),u=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(o);if(u){let m=parseFloat("1e"+((u[2]?+u[2]:0)+u[1].length));o=(Math.round(s*m)/m).toString()}let d="";for(let m=0,v=o.length;m<v;m+=1){let T=o[m];T==="e"?d+=o[++m]==="-"?"c":"b":T==="."?d+="a":T==="-"?d+="e":d+=T}d+=d.length&1?"f":"ff";let f=[30];for(let m=0,v=d.length;m<v;m+=2)f.push(parseInt(d.substr(m,2),16));return f},pe.REAL=function(s){return le.REAL(s).length},le.NAME=le.CHARARRAY,pe.NAME=pe.CHARARRAY,le.STRING=le.CHARARRAY,pe.STRING=pe.CHARARRAY,ut.UTF8=function(s,o,u){let d=[],f=u;for(let m=0;m<f;m++,o+=1)d[m]=s.getUint8(o);return String.fromCharCode.apply(null,d)},ut.UTF16=function(s,o,u){let d=[],f=u/2;for(let m=0;m<f;m++,o+=2)d[m]=s.getUint16(o);return String.fromCharCode.apply(null,d)},le.UTF16=function(s){let o=[];for(let u=0;u<s.length;u+=1){let d=s.charCodeAt(u);o[o.length]=d>>8&255,o[o.length]=d&255}return o},pe.UTF16=function(s){return s.length*2};var xt={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};ut.MACSTRING=function(s,o,u,d){let f=xt[d];if(f===void 0)return;let m="";for(let v=0;v<u;v++){let T=s.getUint8(o+v);T<=127?m+=String.fromCharCode(T):m+=f[T&127]}return m};var dt=typeof WeakMap=="function"&&new WeakMap,Dt,Xt=function(s){if(!Dt){Dt={};for(let f in xt)Dt[f]=new String(f)}let o=Dt[s];if(o===void 0)return;if(dt){let f=dt.get(o);if(f!==void 0)return f}let u=xt[s];if(u===void 0)return;let d={};for(let f=0;f<u.length;f++)d[u.charCodeAt(f)]=f+128;return dt&&dt.set(o,d),d};le.MACSTRING=function(s,o){let u=Xt(o);if(u===void 0)return;let d=[];for(let f=0;f<s.length;f++){let m=s.charCodeAt(f);if(m>=128&&(m=u[m],m===void 0))return;d[f]=m}return d},pe.MACSTRING=function(s,o){let u=le.MACSTRING(s,o);return u!==void 0?u.length:0};function Ht(s){return s>=-128&&s<=127}function Bt(s,o,u){let d=0,f=s.length;for(;o<f&&d<64&&s[o]===0;)++o,++d;return u.push(128|d-1),o}function Wt(s,o,u){let d=0,f=s.length,m=o;for(;m<f&&d<64;){let v=s[m];if(!Ht(v)||v===0&&m+1<f&&s[m+1]===0)break;++m,++d}u.push(d-1);for(let v=o;v<m;++v)u.push(s[v]+256&255);return m}function lr(s,o,u){let d=0,f=s.length,m=o;for(;m<f&&d<64;){let v=s[m];if(v===0||Ht(v)&&m+1<f&&Ht(s[m+1]))break;++m,++d}u.push(64|d-1);for(let v=o;v<m;++v){let T=s[v];u.push(T+65536>>8&255,T+256&255)}return m}le.VARDELTAS=function(s){let o=0,u=[];for(;o<s.length;){let d=s[o];d===0?o=Bt(s,o,u):d>=-128&&d<=127?o=Wt(s,o,u):o=lr(s,o,u)}return u},le.INDEX=function(s){let o=1,u=[o],d=[];for(let T=0;T<s.length;T+=1){let _=le.OBJECT(s[T]);Array.prototype.push.apply(d,_),o+=_.length,u.push(o)}if(d.length===0)return[0,0];let f=[],m=1+Math.floor(Math.log(o)/Math.log(2))/8|0,v=[void 0,le.BYTE,le.USHORT,le.UINT24,le.ULONG][m];for(let T=0;T<u.length;T+=1){let _=v(u[T]);Array.prototype.push.apply(f,_)}return Array.prototype.concat(le.Card16(s.length),le.OffSize(m),f,d)},pe.INDEX=function(s){return le.INDEX(s).length},le.DICT=function(s){let o=[],u=Object.keys(s),d=u.length;for(let f=0;f<d;f+=1){let m=parseInt(u[f],0),v=s[m],T=le.OPERAND(v.value,v.type),_=le.OPERATOR(m);for(let R=0;R<T.length;R++)o.push(T[R]);for(let R=0;R<_.length;R++)o.push(_[R])}return o},pe.DICT=function(s){return le.DICT(s).length},le.OPERATOR=function(s){return s<1200?[s]:[12,s-1200]},le.OPERAND=function(s,o){let u=[];if(Array.isArray(o))for(let d=0;d<o.length;d+=1){ge.argument(s.length===o.length,"Not enough arguments given for type"+o);let f=le.OPERAND(s[d],o[d]);for(let m=0;m<f.length;m++)u.push(f[m])}else if(o==="SID"){let d=le.NUMBER(s);for(let f=0;f<d.length;f++)u.push(d[f])}else if(o==="offset"){let d=le.NUMBER32(s);for(let f=0;f<d.length;f++)u.push(d[f])}else if(o==="number"){let d=le.NUMBER(s);for(let f=0;f<d.length;f++)u.push(d[f])}else if(o==="real"){let d=le.REAL(s);for(let f=0;f<d.length;f++)u.push(d[f])}else throw new Error("Unknown operand type "+o);return u},le.OP=le.BYTE,pe.OP=pe.BYTE;var ur=typeof WeakMap=="function"&&new WeakMap;le.CHARSTRING=function(s){if(ur){let d=ur.get(s);if(d!==void 0)return d}let o=[],u=s.length;for(let d=0;d<u;d+=1){let f=s[d],m=le[f.type](f.value);for(let v=0;v<m.length;v++)o.push(m[v])}return ur&&ur.set(s,o),o},pe.CHARSTRING=function(s){return le.CHARSTRING(s).length},le.OBJECT=function(s){let o=le[s.type];return ge.argument(o!==void 0,"No encoding function for type "+s.type),o(s.value)},pe.OBJECT=function(s){let o=pe[s.type];return ge.argument(o!==void 0,"No sizeOf function for type "+s.type),o(s.value)},le.TABLE=function(s){let o=[],u=(s.fields||[]).length,d=[],f=[];for(let m=0;m<u;m+=1){let v=s.fields[m],T=le[v.type];ge.argument(T!==void 0,"No encoding function for field type "+v.type+" ("+v.name+")");let _=s[v.name];_===void 0&&(_=v.value);let R=T(_);if(v.type==="TABLE")_.fields!==null&&(f.push(o.length),d.push(R)),o.push(0,0);else for(let N=0;N<R.length;N++)o.push(R[N])}for(let m=0;m<d.length;m+=1){let v=f[m],T=o.length;ge.argument(T<65536,"Table "+s.tableName+" too big."),o[v]=T>>8,o[v+1]=T&255;for(let _=0;_<d[m].length;_++)o.push(d[m][_])}return o},pe.TABLE=function(s){let o=0,u=(s.fields||[]).length;for(let d=0;d<u;d+=1){let f=s.fields[d],m=pe[f.type];ge.argument(m!==void 0,"No sizeOf function for field type "+f.type+" ("+f.name+")");let v=s[f.name];v===void 0&&(v=f.value),o+=m(v),f.type==="TABLE"&&(o+=2)}return o},le.RECORD=le.TABLE,pe.RECORD=pe.TABLE,le.LITERAL=function(s){return s},pe.LITERAL=function(s){return s.length};function Jt(s,o,u){if(o&&o.length)for(let d=0;d<o.length;d+=1){let f=o[d];this[f.name]=f.value}if(this.tableName=s,this.fields=o,u){let d=Object.keys(u);for(let f=0;f<d.length;f+=1){let m=d[f],v=u[m];this[m]!==void 0&&(this[m]=v)}}}Jt.prototype.encode=function(){return le.TABLE(this)},Jt.prototype.sizeOf=function(){return pe.TABLE(this)};function Er(s,o,u){u===void 0&&(u=o.length);let d=new Array(o.length+1);d[0]={name:s+"Count",type:"USHORT",value:u};for(let f=0;f<o.length;f++)d[f+1]={name:s+f,type:"USHORT",value:o[f]};return d}function X(s,o,u){let d=o.length,f=new Array(d+1);f[0]={name:s+"Count",type:"USHORT",value:d};for(let m=0;m<d;m++)f[m+1]={name:s+m,type:"TABLE",value:u(o[m],m)};return f}function Re(s,o,u){let d=o.length,f=[];f[0]={name:s+"Count",type:"USHORT",value:d};for(let m=0;m<d;m++)f=f.concat(u(o[m],m));return f}function We(s){s.format===1?Jt.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(Er("glyph",s.glyphs))):s.format===2?Jt.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(Re("rangeRecord",s.ranges,function(o,u){return[{name:"startGlyphID"+u,type:"USHORT",value:o.start},{name:"endGlyphID"+u,type:"USHORT",value:o.end},{name:"startCoverageIndex"+u,type:"USHORT",value:o.index}]}))):ge.assert(!1,"Coverage format must be 1 or 2.")}We.prototype=Object.create(Jt.prototype),We.prototype.constructor=We;function Qt(s){Jt.call(this,"scriptListTable",Re("scriptRecord",s,function(o,u){let d=o.script,f=d.defaultLangSys;return ge.assert(!!f,"Unable to write GSUB: script "+o.tag+" has no default language system."),[{name:"scriptTag"+u,type:"TAG",value:o.tag},{name:"script"+u,type:"TABLE",value:new Jt("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new Jt("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:f.reqFeatureIndex}].concat(Er("featureIndex",f.featureIndexes)))}].concat(Re("langSys",d.langSysRecords,function(m,v){let T=m.langSys;return[{name:"langSysTag"+v,type:"TAG",value:m.tag},{name:"langSys"+v,type:"TABLE",value:new Jt("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:T.reqFeatureIndex}].concat(Er("featureIndex",T.featureIndexes)))}]})))}]}))}Qt.prototype=Object.create(Jt.prototype),Qt.prototype.constructor=Qt;function It(s){Jt.call(this,"featureListTable",Re("featureRecord",s,function(o,u){let d=o.feature;return[{name:"featureTag"+u,type:"TAG",value:o.tag},{name:"feature"+u,type:"TABLE",value:new Jt("featureTable",[{name:"featureParams",type:"USHORT",value:d.featureParams}].concat(Er("lookupListIndex",d.lookupListIndexes)))}]}))}It.prototype=Object.create(Jt.prototype),It.prototype.constructor=It;function ar(s,o){Jt.call(this,"lookupListTable",X("lookup",s,function(u){let d=o[u.lookupType];return ge.assert(!!d,"Unable to write GSUB lookup type "+u.lookupType+" tables."),new Jt("lookupTable",[{name:"lookupType",type:"USHORT",value:u.lookupType},{name:"lookupFlag",type:"USHORT",value:u.lookupFlag}].concat(X("subtable",u.subtables,d)))}))}ar.prototype=Object.create(Jt.prototype),ar.prototype.constructor=ar;function Ot(s){s.format===1?Jt.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:1},{name:"startGlyphID",type:"USHORT",value:s.startGlyph}].concat(Er("glyph",s.classes))):s.format===2?Jt.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:2}].concat(Re("rangeRecord",s.ranges,function(o,u){return[{name:"startGlyphID"+u,type:"USHORT",value:o.start},{name:"endGlyphID"+u,type:"USHORT",value:o.end},{name:"class"+u,type:"USHORT",value:o.classId}]}))):ge.assert(!1,"Class format must be 1 or 2.")}Ot.prototype=Object.create(Jt.prototype),Ot.prototype.constructor=Ot;var Fe={Table:Jt,Record:Jt,Coverage:We,ClassDef:Ot,ScriptList:Qt,FeatureList:It,LookupList:ar,ushortList:Er,tableList:X,recordList:Re};function yr(s,o){return s.getUint8(o)}function He(s,o){return s.getUint16(o,!1)}function Se(s,o){return s.getInt16(o,!1)}function Ve(s,o){return(s.getUint16(o)<<8)+s.getUint8(o+2)}function Ct(s,o){return s.getUint32(o,!1)}function jr(s,o){return s.getInt32(o,!1)}function ft(s,o){let u=s.getInt16(o,!1),d=s.getUint16(o+2,!1);return u+d/65535}function Br(s,o){let u="";for(let d=o;d<o+4;d+=1)u+=String.fromCharCode(s.getInt8(d));return u}function Wn(s,o,u){let d=0;for(let f=0;f<u;f+=1)d<<=8,d+=s.getUint8(o+f);return d}function an(s,o,u){let d=[];for(let f=o;f<u;f+=1)d.push(s.getUint8(f));return d}function ke(s){let o="";for(let u=0;u<s.length;u+=1)o+=String.fromCharCode(s[u]);return o}var St={byte:1,uShort:2,f2dot14:2,short:2,uInt24:3,uLong:4,fixed:4,longDateTime:8,tag:4},kt={LONG_WORDS:32768,WORD_DELTA_COUNT_MASK:32767,SHARED_POINT_NUMBERS:32768,COUNT_MASK:4095,EMBEDDED_PEAK_TUPLE:32768,INTERMEDIATE_REGION:16384,PRIVATE_POINT_NUMBERS:8192,TUPLE_INDEX_MASK:4095,POINTS_ARE_WORDS:128,POINT_RUN_COUNT_MASK:127,DELTAS_ARE_ZERO:128,DELTAS_ARE_WORDS:64,DELTA_RUN_COUNT_MASK:63,INNER_INDEX_BIT_COUNT_MASK:15,MAP_ENTRY_SIZE_MASK:48};function ue(s,o){this.data=s,this.offset=o,this.relativeOffset=0}ue.prototype.parseByte=function(){let s=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,s},ue.prototype.parseChar=function(){let s=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,s},ue.prototype.parseCard8=ue.prototype.parseByte,ue.prototype.parseUShort=function(){let s=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,s},ue.prototype.parseCard16=ue.prototype.parseUShort,ue.prototype.parseSID=ue.prototype.parseUShort,ue.prototype.parseOffset16=ue.prototype.parseUShort,ue.prototype.parseShort=function(){let s=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,s},ue.prototype.parseF2Dot14=function(){let s=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,s},ue.prototype.parseUInt24=function(){let s=Ve(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=3,s},ue.prototype.parseULong=function(){let s=Ct(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,s},ue.prototype.parseLong=function(){let s=jr(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,s},ue.prototype.parseOffset32=ue.prototype.parseULong,ue.prototype.parseFixed=function(){let s=ft(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,s},ue.prototype.parseString=function(s){let o=this.data,u=this.offset+this.relativeOffset,d="";this.relativeOffset+=s;for(let f=0;f<s;f++)d+=String.fromCharCode(o.getUint8(u+f));return d},ue.prototype.parseTag=function(){return this.parseString(4)},ue.prototype.parseLongDateTime=function(){let s=Ct(this.data,this.offset+this.relativeOffset+4);return s-=2082844800,this.relativeOffset+=8,s},ue.prototype.parseVersion=function(s){let o=He(this.data,this.offset+this.relativeOffset),u=He(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,s===void 0&&(s=4096),o+u/s/10},ue.prototype.skip=function(s,o){o===void 0&&(o=1),this.relativeOffset+=St[s]*o},ue.prototype.parseULongList=function(s){s===void 0&&(s=this.parseULong());let o=new Array(s),u=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<s;f++)o[f]=u.getUint32(d),d+=4;return this.relativeOffset+=s*4,o},ue.prototype.parseOffset16List=ue.prototype.parseUShortList=function(s){s===void 0&&(s=this.parseUShort());let o=new Array(s),u=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<s;f++)o[f]=u.getUint16(d),d+=2;return this.relativeOffset+=s*2,o},ue.prototype.parseShortList=function(s){let o=new Array(s),u=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<s;f++)o[f]=u.getInt16(d),d+=2;return this.relativeOffset+=s*2,o},ue.prototype.parseByteList=function(s){let o=new Array(s),u=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<s;f++)o[f]=u.getUint8(d++);return this.relativeOffset+=s,o},ue.prototype.parseList=function(s,o){o||(o=s,s=this.parseUShort());let u=new Array(s);for(let d=0;d<s;d++)u[d]=o.call(this);return u},ue.prototype.parseList32=function(s,o){o||(o=s,s=this.parseULong());let u=new Array(s);for(let d=0;d<s;d++)u[d]=o.call(this);return u},ue.prototype.parseRecordList=function(s,o){o||(o=s,s=this.parseUShort());let u=new Array(s),d=Object.keys(o);for(let f=0;f<s;f++){let m={};for(let v=0;v<d.length;v++){let T=d[v],_=o[T];m[T]=_.call(this)}u[f]=m}return u},ue.prototype.parseRecordList32=function(s,o){o||(o=s,s=this.parseULong());let u=new Array(s),d=Object.keys(o);for(let f=0;f<s;f++){let m={};for(let v=0;v<d.length;v++){let T=d[v],_=o[T];m[T]=_.call(this)}u[f]=m}return u},ue.prototype.parseTupleRecords=function(s,o){let u=[];for(let d=0;d<s;d++){let f=[];for(let m=0;m<o;m++)f.push(this.parseF2Dot14());u.push(f)}return u},ue.prototype.parseStruct=function(s){if(typeof s=="function")return s.call(this);{let o=Object.keys(s),u={};for(let d=0;d<o.length;d++){let f=o[d],m=s[f];u[f]=m.call(this)}return u}},ue.prototype.parseValueRecord=function(s){if(s===void 0&&(s=this.parseUShort()),s===0)return;let o={};return s&1&&(o.xPlacement=this.parseShort()),s&2&&(o.yPlacement=this.parseShort()),s&4&&(o.xAdvance=this.parseShort()),s&8&&(o.yAdvance=this.parseShort()),s&16&&(o.xPlaDevice=void 0,this.parseShort()),s&32&&(o.yPlaDevice=void 0,this.parseShort()),s&64&&(o.xAdvDevice=void 0,this.parseShort()),s&128&&(o.yAdvDevice=void 0,this.parseShort()),o},ue.prototype.parseValueRecordList=function(){let s=this.parseUShort(),o=this.parseUShort(),u=new Array(o);for(let d=0;d<o;d++)u[d]=this.parseValueRecord(s);return u},ue.prototype.parsePointer=function(s){let o=this.parseOffset16();if(o>0)return new ue(this.data,this.offset+o).parseStruct(s)},ue.prototype.parsePointer32=function(s){let o=this.parseOffset32();if(o>0)return new ue(this.data,this.offset+o).parseStruct(s)},ue.prototype.parseListOfLists=function(s){let o=this.parseOffset16List(),u=o.length,d=this.relativeOffset,f=new Array(u);for(let m=0;m<u;m++){let v=o[m];if(v===0){f[m]=void 0;continue}if(this.relativeOffset=v,s){let T=this.parseOffset16List(),_=new Array(T.length);for(let R=0;R<T.length;R++)this.relativeOffset=v+T[R],_[R]=s.call(this);f[m]=_}else f[m]=this.parseUShortList()}return this.relativeOffset=d,f},ue.prototype.parseCoverage=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort(),u=this.parseUShort();if(o===1)return{format:1,glyphs:this.parseUShortList(u)};if(o===2){let d=new Array(u);for(let f=0;f<u;f++)d[f]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:d}}throw new Error("0x"+s.toString(16)+": Coverage format must be 1 or 2.")},ue.prototype.parseClassDef=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();return o===1?{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:o===2?{format:2,ranges:this.parseRecordList({start:ue.uShort,end:ue.uShort,classId:ue.uShort})}:(console.warn(`0x${s.toString(16)}: This font file uses an invalid ClassDef format of ${o}. It might be corrupted and should be reacquired if it doesn't display as intended.`),{format:o})},ue.list=function(s,o){return function(){return this.parseList(s,o)}},ue.list32=function(s,o){return function(){return this.parseList32(s,o)}},ue.recordList=function(s,o){return function(){return this.parseRecordList(s,o)}},ue.recordList32=function(s,o){return function(){return this.parseRecordList32(s,o)}},ue.pointer=function(s){return function(){return this.parsePointer(s)}},ue.pointer32=function(s){return function(){return this.parsePointer32(s)}},ue.tag=ue.prototype.parseTag,ue.byte=ue.prototype.parseByte,ue.uShort=ue.offset16=ue.prototype.parseUShort,ue.uShortList=ue.prototype.parseUShortList,ue.uInt24=ue.prototype.parseUInt24,ue.uLong=ue.offset32=ue.prototype.parseULong,ue.uLongList=ue.prototype.parseULongList,ue.fixed=ue.prototype.parseFixed,ue.f2Dot14=ue.prototype.parseF2Dot14,ue.struct=ue.prototype.parseStruct,ue.coverage=ue.prototype.parseCoverage,ue.classDef=ue.prototype.parseClassDef;var Nr={reserved:ue.uShort,reqFeatureIndex:ue.uShort,featureIndexes:ue.uShortList};ue.prototype.parseScriptList=function(){return this.parsePointer(ue.recordList({tag:ue.tag,script:ue.pointer({defaultLangSys:ue.pointer(Nr),langSysRecords:ue.recordList({tag:ue.tag,langSys:ue.pointer(Nr)})})}))||[]},ue.prototype.parseFeatureList=function(){return this.parsePointer(ue.recordList({tag:ue.tag,feature:ue.pointer({featureParams:ue.offset16,lookupListIndexes:ue.uShortList})}))||[]},ue.prototype.parseLookupList=function(s){return this.parsePointer(ue.list(ue.pointer(function(){let o=this.parseUShort();ge.argument(1<=o&&o<=9,"GPOS/GSUB lookup type "+o+" unknown.");let u=this.parseUShort(),d=u&16;return{lookupType:o,lookupFlag:u,subtables:this.parseList(ue.pointer(s[o])),markFilteringSet:d?this.parseUShort():void 0}})))||[]},ue.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){let s=this.parseUShort(),o=this.parseUShort();return ge.argument(s===1&&o<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:ue.offset32,featureTableSubstitutionOffset:ue.offset32})})||[]},ue.prototype.parseVariationStore=function(){let s=this.relativeOffset,o=this.parseUShort(),u={itemVariationStore:this.parseItemVariationStore()};return this.relativeOffset=s+o+2,u},ue.prototype.parseItemVariationStore=function(){let s=this.relativeOffset,o={format:this.parseUShort(),variationRegions:[],itemVariationSubtables:[]},u=this.parseOffset32(),d=this.parseUShort(),f=this.parseULongList(d);this.relativeOffset=s+u,o.variationRegions=this.parseVariationRegionList();for(let m=0;m<d;m++){let v=f[m];this.relativeOffset=s+v,o.itemVariationSubtables.push(this.parseItemVariationSubtable())}return o},ue.prototype.parseVariationRegionList=function(){let s=this.parseUShort(),o=this.parseUShort();return this.parseRecordList(o,{regionAxes:ue.recordList(s,{startCoord:ue.f2Dot14,peakCoord:ue.f2Dot14,endCoord:ue.f2Dot14})})},ue.prototype.parseItemVariationSubtable=function(){let s=this.parseUShort(),o=this.parseUShort(),u=this.parseUShortList(),d=u.length;return{regionIndexes:u,deltaSets:s&&d?this.parseDeltaSets(s,o,d):[]}},ue.prototype.parseDeltaSetIndexMap=function(){let s=this.parseByte(),o=this.parseByte(),u=[],d=0;switch(s){case 0:d=this.parseUShort();break;case 1:d=this.parseULong();break;default:console.error(`unsupported DeltaSetIndexMap format ${s}`)}if(!d)return{format:s,entryFormat:o};let f=(o&kt.INNER_INDEX_BIT_COUNT_MASK)+1,m=((o&kt.MAP_ENTRY_SIZE_MASK)>>4)+1;for(let v=0;v<d;v++){let T;if(m===1)T=this.parseByte();else if(m===2)T=this.parseUShort();else if(m===3)T=this.parseUInt24();else if(m===4)T=this.parseULong();else throw new Error(`Invalid entry size of ${m}`);let _=T>>f,R=T&(1<<f)-1;u.push({outerIndex:_,innerIndex:R})}return{format:s,entryFormat:o,map:u}},ue.prototype.parseDeltaSets=function(s,o,u){let d=Array.from({length:s},()=>[]),f=o&kt.LONG_WORDS,m=o&kt.WORD_DELTA_COUNT_MASK;if(m>u)throw Error("wordCount must be less than or equal to regionIndexCount");let v=(f?this.parseLong:this.parseShort).bind(this),T=(f?this.parseShort:this.parseChar).bind(this);for(let _=0;_<s;_++)for(let R=0;R<u;R++)R<m?d[_].push(v()):d[_].push(T());return d},ue.prototype.parseTupleVariationStoreList=function(s,o,u){let d=this.parseUShort(),f=this.parseUShort()&1,m=this.parseOffset32(),v=(f?this.parseULong:this.parseUShort).bind(this),T={},_=v();f||(_*=2);let R;for(let N=0;N<d;N++){R=v(),f||(R*=2);let G=R-_;T[N]=G?this.parseTupleVariationStore(m+_,s,o,u,N):void 0,_=R}return T},ue.prototype.parseTupleVariationStore=function(s,o,u,d,f){let m=this.relativeOffset;this.relativeOffset=s,u==="cvar"&&(this.relativeOffset+=4);let v=this.parseUShort(),T=!!(v&kt.SHARED_POINT_NUMBERS),_=v&kt.COUNT_MASK,R=this.parseOffset16(),N=[],G=[];for(let ie=0;ie<_;ie++){let ye=this.parseTupleVariationHeader(o,u);N.push(ye)}this.relativeOffset!==s+R&&(console.warn(`Unexpected offset after parsing tuple variation headers! Expected ${s+R}, actually ${this.relativeOffset}`),this.relativeOffset=s+R),T&&(G=this.parsePackedPointNumbers());let W=this.relativeOffset;for(let ie=0;ie<_;ie++){let ye=N[ie];ye.privatePoints=[],this.relativeOffset=W,u==="cvar"&&!ye.peakTuple&&console.warn("An embedded peak tuple is required in TupleVariationHeaders for the cvar table."),ye.flags.privatePointNumbers&&(ye.privatePoints=this.parsePackedPointNumbers()),delete ye.flags;let Je=this.offset,gr=this.relativeOffset,or=Cr=>{let Yr,Dn,zn=()=>{let Hn=0;if(u==="gvar"){if(Hn=ye.privatePoints.length||G.length,!Hn){let Ns=d.get(f);Ns.path,Hn=Ns.points.length,Hn+=4}}else u==="cvar"&&(Hn=d.length);this.offset=Je,this.relativeOffset=gr,Yr=this.parsePackedDeltas(Hn),u==="gvar"&&(Dn=this.parsePackedDeltas(Hn))};return{configurable:!0,get:function(){return Yr===void 0&&zn(),Cr==="deltasY"?Dn:Yr},set:function(Hn){Yr===void 0&&zn(),Cr==="deltasY"?Dn=Hn:Yr=Hn}}};Object.defineProperty(ye,"deltas",or.call(this,"deltas")),u==="gvar"&&Object.defineProperty(ye,"deltasY",or.call(this,"deltasY")),W+=ye.variationDataSize,delete ye.variationDataSize}this.relativeOffset=m;let he={headers:N};return he.sharedPoints=G,he},ue.prototype.parseTupleVariationHeader=function(s,o){let u=this.parseUShort(),d=this.parseUShort(),f=!!(d&kt.EMBEDDED_PEAK_TUPLE),m=!!(d&kt.INTERMEDIATE_REGION),v=!!(d&kt.PRIVATE_POINT_NUMBERS),T=f?void 0:d&kt.TUPLE_INDEX_MASK,_=f?this.parseTupleRecords(1,s)[0]:void 0,R=m?this.parseTupleRecords(1,s)[0]:void 0,N=m?this.parseTupleRecords(1,s)[0]:void 0,G={variationDataSize:u,peakTuple:_,intermediateStartTuple:R,intermediateEndTuple:N,flags:{embeddedPeakTuple:f,intermediateRegion:m,privatePointNumbers:v}};return o==="gvar"&&(G.sharedTupleRecordsIndex=T),G},ue.prototype.parsePackedPointNumbers=function(){let s=this.parseByte(),o=[],u=s;if(s>=128){let f=this.parseByte();u=(s&kt.POINT_RUN_COUNT_MASK)<<8|f}let d=0;for(;o.length<u;){let f=this.parseByte(),m=!!(f&kt.POINTS_ARE_WORDS),v=(f&kt.POINT_RUN_COUNT_MASK)+1;for(let T=0;T<v&&o.length<u;T++){let _;m?_=this.parseUShort():_=this.parseByte(),d=d+_,o.push(d)}}return o},ue.prototype.parsePackedDeltas=function(s){let o=[];for(;o.length<s;){let u=this.parseByte(),d=!!(u&kt.DELTAS_ARE_ZERO),f=!!(u&kt.DELTAS_ARE_WORDS),m=(u&kt.DELTA_RUN_COUNT_MASK)+1;for(let v=0;v<m&&o.length<s;v++)d?o.push(0):f?o.push(this.parseShort()):o.push(this.parseChar())}return o};var st={getByte:yr,getCard8:yr,getUShort:He,getCard16:He,getShort:Se,getUInt24:Ve,getULong:Ct,getFixed:ft,getTag:Br,getOffset:Wn,getBytes:an,bytesToString:ke,Parser:ue},Gt=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],Ur={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},gn={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},Ln={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function wn(s,o,u){switch(s){case 0:if(o===65535)return"und";if(u)return u[o];break;case 1:return Ur[o];case 3:return Ln[o]}}var sr="utf-16",yn={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},Ts={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function Xr(s,o,u){switch(s){case 0:return sr;case 1:return Ts[u]||yn[o];case 3:if(o===1||o===10)return sr;break}}var Wr={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function on(s){return Wr[s]}function An(s,o,u){let d={},f=new st.Parser(s,o),m=f.parseUShort(),v=f.parseUShort(),T=f.offset+f.parseUShort();for(let _=0;_<v;_++){let R=f.parseUShort(),N=f.parseUShort(),G=f.parseUShort(),W=f.parseUShort(),he=Gt[W]||W,ie=f.parseUShort(),ye=f.parseUShort(),Je=wn(R,G,u),gr=Xr(R,N,G),or=on(R);if(gr!==void 0&&Je!==void 0&&or!==void 0){let Cr;if(gr===sr?Cr=ut.UTF16(s,T+ye,ie):Cr=ut.MACSTRING(s,T+ye,ie,gr),Cr){let Yr=d[or];Yr===void 0&&(Yr=d[or]={});let Dn=Yr[he];Dn===void 0&&(Dn=Yr[he]={}),Dn[Je]=Cr}}}return m===1&&f.parseUShort(),d}function jn(s){let o={};for(let u in s)o[s[u]]=parseInt(u);return o}function Gn(s,o,u,d,f,m){return new Fe.Record("NameRecord",[{name:"platformID",type:"USHORT",value:s},{name:"encodingID",type:"USHORT",value:o},{name:"languageID",type:"USHORT",value:u},{name:"nameID",type:"USHORT",value:d},{name:"length",type:"USHORT",value:f},{name:"offset",type:"USHORT",value:m}])}function Pn(s,o){let u=s.length,d=o.length-u+1;e:for(let f=0;f<d;f++)for(;f<d;f++){for(let m=0;m<u;m++)if(o[f+m]!==s[m])continue e;return f}return-1}function hn(s,o){let u=Pn(s,o);if(u<0){u=o.length;let d=0,f=s.length;for(;d<f;++d)o.push(s[d])}return u}function kn(s,o){let u=jn(Wr),d=jn(Ur),f=jn(Ln),m=[],v=[];for(let _ in s){let R,N=[],G={},W=jn(Gt),he=u[_];for(let ie in s[_]){let ye=W[ie];if(ye===void 0&&(ye=ie),R=parseInt(ye),isNaN(R))throw new Error('Name table entry "'+ie+'" does not exist, see nameTableNames for complete list.');G[R]=s[_][ie],N.push(R)}for(let ie=0;ie<N.length;ie++){R=N[ie];let ye=G[R];for(let Je in ye){let gr=ye[Je];if(he===1||he===0){let or=d[Je],Cr=gn[or],Yr=Xr(he,Cr,or),Dn=le.MACSTRING(gr,Yr);if(he===0&&(or=o.indexOf(Je),or<0&&(or=o.length,o.push(Je)),Cr=4,Dn=le.UTF16(gr)),Dn!==void 0){let zn=hn(Dn,v);m.push(Gn(he,Cr,or,R,Dn.length,zn))}}if(he===3){let or=f[Je];if(or!==void 0){let Cr=le.UTF16(gr),Yr=hn(Cr,v);m.push(Gn(3,1,or,R,Cr.length,Yr))}}}}}m.sort(function(_,R){return _.platformID-R.platformID||_.encodingID-R.encodingID||_.languageID-R.languageID||_.nameID-R.nameID});let T=new Fe.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:m.length},{name:"stringOffset",type:"USHORT",value:6+m.length*12}]);for(let _=0;_<m.length;_++)T.fields.push({name:"record_"+_,type:"RECORD",value:m[_]});return T.fields.push({name:"strings",type:"LITERAL",value:v}),T}function Tn(s,o,u=[]){if(o<256&&o in Gt){if(u.length&&!u.includes(parseInt(o)))return;o=Gt[o]}for(let d in s)for(let f in s[d])if(f===o||parseInt(f)===o)return s[d][f]}var rn={parse:An,make:kn,getNameByID:Tn};function Dr(s,o,u,d){s.length=o.parseUShort(),s.language=o.parseUShort()-1;let f=o.parseByteList(s.length),m=Object.assign({},f),v=Xr(u,d,s.language),T=xt[v];for(let _=0;_<T.length;_++)m[T.charCodeAt(_)]=f[128+_];s.glyphIndexMap=m}function ns(s,o,u){o.parseUShort(),s.length=o.parseULong(),s.language=o.parseULong();let d;s.groupCount=d=o.parseULong(),s.glyphIndexMap={};for(let f=0;f<d;f+=1){let m=o.parseULong(),v=o.parseULong(),T=o.parseULong();for(let _=m;_<=v;_+=1)s.glyphIndexMap[_]=T,u===12&&T++}}function Mt(s,o,u,d,f){s.length=o.parseUShort(),s.language=o.parseUShort();let m;s.segCount=m=o.parseUShort()>>1,o.skip("uShort",3),s.glyphIndexMap={};let v=new st.Parser(u,d+f+14),T=new st.Parser(u,d+f+16+m*2),_=new st.Parser(u,d+f+16+m*4),R=new st.Parser(u,d+f+16+m*6),N=d+f+16+m*8;for(let G=0;G<m-1;G+=1){let W,he=v.parseUShort(),ie=T.parseUShort(),ye=_.parseShort(),Je=R.parseUShort();for(let gr=ie;gr<=he;gr+=1)Je!==0?(N=R.offset+R.relativeOffset-2,N+=Je,N+=(gr-ie)*2,W=st.getUShort(u,N),W!==0&&(W=W+ye&65535)):W=gr+ye&65535,s.glyphIndexMap[gr]=W}}function q(s,o){let u={};o.skip("uLong");let d=o.parseULong();for(let f=0;f<d;f+=1){let m=o.parseUInt24(),v={varSelector:m},T=o.parseOffset32(),_=o.parseOffset32(),R=o.relativeOffset;T&&(o.relativeOffset=T,v.defaultUVS=o.parseStruct({ranges:function(){return o.parseRecordList32({startUnicodeValue:o.parseUInt24,additionalCount:o.parseByte})}})),_&&(o.relativeOffset=_,v.nonDefaultUVS=o.parseStruct({uvsMappings:function(){let N={},G=o.parseRecordList32({unicodeValue:o.parseUInt24,glyphID:o.parseUShort});for(let W=0;W<G.length;W+=1)N[G[W].unicodeValue]=G[W];return N}})),u[m]=v,o.relativeOffset=R}s.varSelectorList=u}function Ye(s,o){let u={};u.version=st.getUShort(s,o),ge.argument(u.version===0,"cmap table version should be 0."),u.numTables=st.getUShort(s,o+2);let d=null,f=-1,m=-1,v=null,T=null,_=[0,1,2,3,4,6],R=[0,1,10];for(let G=u.numTables-1;G>=0;G-=1)if(v=st.getUShort(s,o+4+G*8),T=st.getUShort(s,o+4+G*8+2),v===3&&R.includes(T)||v===0&&_.includes(T)||v===1&&T===0){if(m>0)continue;if(m=st.getULong(s,o+4+G*8+4),d)break}else if(v===0&&T===5){if(f=st.getULong(s,o+4+G*8+4),d=new st.Parser(s,o+f),d.parseUShort()!==14)f=-1,d=null;else if(m>0)break}if(m===-1)throw new Error("No valid cmap sub-tables found.");let N=new st.Parser(s,o+m);if(u.format=N.parseUShort(),u.format===0)Dr(u,N,v,T);else if(u.format===12||u.format===13)ns(u,N,u.format);else if(u.format===4)Mt(u,N,s,o,m);else throw new Error("Only format 0 (platformId 1, encodingId 0), 4, 12 and 14 cmap tables are supported (found format "+u.format+", platformId "+v+", encodingId "+T+").");return d&&q(u,d),u}function Lt(s,o,u){s.segments.push({end:o,start:o,delta:-(o-u),offset:0,glyphIndex:u})}function wr(s){s.segments.push({end:65535,start:65535,delta:1,offset:0})}function Et(s){if(s.length===0)return s;let o=[s[0]];for(let u=1;u<s.length;u++){let d=o[o.length-1],f=s[u];d.end+1===f.start&&d.delta===f.delta&&f.end!==65535?d.end=f.end:o.push(f)}return o}function hr(s){let o=!0,u;for(u=s.length-1;u>0;u-=1)if(s.get(u).unicode>65535){o=!1;break}let d=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:o?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:o?12:20}];o||d.push({name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}),d.push({name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0});let f=new Fe.Table("cmap",d);for(f.segments=[],u=0;u<s.length;u+=1){let he=s.get(u);for(let ie=0;ie<he.unicodes.length;ie+=1)Lt(f,he.unicodes[ie],u)}f.segments.sort(function(he,ie){return he.start-ie.start}),f.segments=Et(f.segments),wr(f);let m=f.segments.length,v=0,T=[],_=[],R=[],N=[],G=[],W=[];for(u=0;u<m;u+=1){let he=f.segments[u];he.end<=65535&&he.start<=65535?(T.push({name:"end_"+u,type:"USHORT",value:he.end}),_.push({name:"start_"+u,type:"USHORT",value:he.start}),R.push({name:"idDelta_"+u,type:"SHORT",value:he.delta}),N.push({name:"idRangeOffset_"+u,type:"USHORT",value:he.offset}),he.glyphId!==void 0&&G.push({name:"glyph_"+u,type:"USHORT",value:he.glyphId})):v+=1,!o&&he.glyphIndex!==void 0&&(W.push({name:"cmap12Start_"+u,type:"ULONG",value:he.start}),W.push({name:"cmap12End_"+u,type:"ULONG",value:he.end}),W.push({name:"cmap12Glyph_"+u,type:"ULONG",value:he.glyphIndex}))}f.segCountX2=(m-v)*2,f.searchRange=Math.pow(2,Math.floor(Math.log(m-v)/Math.log(2)))*2,f.entrySelector=Math.log(f.searchRange/2)/Math.log(2),f.rangeShift=f.segCountX2-f.searchRange;for(let he=0;he<T.length;he++)f.fields.push(T[he]);f.fields.push({name:"reservedPad",type:"USHORT",value:0});for(let he=0;he<_.length;he++)f.fields.push(_[he]);for(let he=0;he<R.length;he++)f.fields.push(R[he]);for(let he=0;he<N.length;he++)f.fields.push(N[he]);for(let he=0;he<G.length;he++)f.fields.push(G[he]);if(f.cmap4Length=14+T.length*2+2+_.length*2+R.length*2+N.length*2+G.length*2,!o){let he=16+W.length*4;f.cmap12Offset=20+f.cmap4Length,f.fields.push({name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:he},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:W.length/3});for(let ie=0;ie<W.length;ie++)f.fields.push(W[ie])}return f}var Sr={parse:Ye,make:hr},Ir=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],ln=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],zr=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Vn=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"],Gr=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],qn=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],In=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function cn(s){this.font=s}cn.prototype.charToGlyphIndex=function(s){let o=s.codePointAt(0),u=this.font.glyphs;if(u)for(let d=0;d<u.length;d+=1){let f=u.get(d);for(let m=0;m<f.unicodes.length;m+=1)if(f.unicodes[m]===o)return d}return null};function H(s){this.cmap=s}H.prototype.charToGlyphIndex=function(s){return this.cmap.glyphIndexMap[s.codePointAt(0)]||0};function we(s,o){this.encoding=s,this.charset=o}we.prototype.charToGlyphIndex=function(s){let o=s.codePointAt(0),u=this.encoding[o];return this.charset.indexOf(u)};function Pe(s){switch(s.version){case 1:this.names=In.slice();break;case 2:this.names=new Array(s.numberOfGlyphs);for(let o=0;o<s.numberOfGlyphs;o++)s.glyphNameIndex[o]<In.length?this.names[o]=In[s.glyphNameIndex[o]]:this.names[o]=s.names[s.glyphNameIndex[o]-In.length];break;case 2.5:this.names=new Array(s.numberOfGlyphs);for(let o=0;o<s.numberOfGlyphs;o++)this.names[o]=In[o+s.glyphNameIndex[o]];break;case 3:this.names=[];break;default:this.names=[];break}}Pe.prototype.nameToGlyphIndex=function(s){return this.names.indexOf(s)},Pe.prototype.glyphIndexToName=function(s){return this.names[s]};function Ge(s){let o,u=s.tables.cmap.glyphIndexMap,d=Object.keys(u);for(let f=0;f<d.length;f+=1){let m=d[f],v=u[m];o=s.glyphs.get(v),o.addUnicode(parseInt(m))}for(let f=0;f<s.glyphs.length;f+=1)o=s.glyphs.get(f),s.cffEncoding?o.name=s.cffEncoding.charset[f]:s.glyphNames.names&&(o.name=s.glyphNames.glyphIndexToName(f))}function ve(s){s._IndexToUnicodeMap={};let o=s.tables.cmap.glyphIndexMap,u=Object.keys(o);for(let d=0;d<u.length;d+=1){let f=u[d],m=o[f];s._IndexToUnicodeMap[m]===void 0?s._IndexToUnicodeMap[m]={unicodes:[parseInt(f)]}:s._IndexToUnicodeMap[m].unicodes.push(parseInt(f))}}function lt(s,o){o.lowMemory?ve(s):Ge(s)}function Nt(s,o,u,d,f){s.beginPath(),s.moveTo(o,u),s.lineTo(d,f),s.stroke()}var At={line:Nt};function ct(s,o){let u=new ue(s,o),d=u.parseShort();d!==0&&console.warn("Only CPALv0 is currently fully supported.");let f=u.parseShort(),m=u.parseShort(),v=u.parseShort(),T=u.parseOffset32(),_=u.parseUShortList(m);u.relativeOffset=T;let R=u.parseULongList(v);return u.relativeOffset=T,{version:d,numPaletteEntries:f,colorRecords:R,colorRecordIndices:_}}function _t({version:s=0,numPaletteEntries:o=0,colorRecords:u=[],colorRecordIndices:d=[0]}){return ge.argument(s===0,"Only CPALv0 are supported."),ge.argument(u.length,"No colorRecords given."),ge.argument(d.length,"No colorRecordIndices given."),d.length>1&&ge.argument(o,"Can't infer numPaletteEntries on multiple colorRecordIndices"),new Fe.Table("CPAL",[{name:"version",type:"USHORT",value:s},{name:"numPaletteEntries",type:"USHORT",value:o||u.length},{name:"numPalettes",type:"USHORT",value:d.length},{name:"numColorRecords",type:"USHORT",value:u.length},{name:"colorRecordsArrayOffset",type:"ULONG",value:12+2*d.length},...d.map((f,m)=>({name:"colorRecordIndices_"+m,type:"USHORT",value:f})),...u.map((f,m)=>({name:"colorRecords_"+m,type:"ULONG",value:f}))])}function _r(s){var o=(s&4278190080)>>24,u=(s&16711680)>>16,d=(s&65280)>>8,f=s&255;return o=o+256&255,u=u+256&255,d=d+256&255,f=(f+256&255)/255,{b:o,g:u,r:d,a:f}}function jt(s,o,u=0,d="hexa"){if(o==65535)return"currentColor";let f=s&&s.tables&&s.tables.cpal;if(!f)return"currentColor";if(u>f.colorRecordIndices.length-1)throw new Error(`Palette index out of range (colorRecordIndices.length: ${f.colorRecordIndices.length}, index: ${o})`);if(o>f.numPaletteEntries)throw new Error(`Color index out of range (numPaletteEntries: ${f.numPaletteEntries}, index: ${o})`);let m=f.colorRecordIndices[u]+o;if(m>f.colorRecords)throw new Error(`Color index out of range (colorRecords.length: ${f.colorRecords.length}, lookupIndex: ${m})`);let v=_r(f.colorRecords[m]);return d==="bgra"?v:Rr(v,d)}function tr(s){return("0"+parseInt(s).toString(16)).slice(-2)}function vt(s){let o=s.r/255,u=s.g/255,d=s.b/255,f=Math.max(o,u,d),m=Math.min(o,u,d),v,T,_=(f+m)/2;if(f===m)v=T=0;else{let R=f-m;switch(T=_>.5?R/(2-f-m):R/(f+m),f){case o:v=(u-d)/R+(u<d?6:0);break;case u:v=(d-o)/R+2;break;case d:v=(o-u)/R+4;break}v/=6}return{h:v*360,s:T*100,l:_*100}}function Tt(s){let{h:o,s:u,l:d,a:f}=s;o=o%360,u/=100,d/=100;let m=(1-Math.abs(2*d-1))*u,v=m*(1-Math.abs(o/60%2-1)),T=d-m/2,_=0,R=0,N=0;return 0<=o&&o<60?(_=m,R=v,N=0):60<=o&&o<120?(_=v,R=m,N=0):120<=o&&o<180?(_=0,R=m,N=v):180<=o&&o<240?(_=0,R=v,N=m):240<=o&&o<300?(_=v,R=0,N=m):300<=o&&o<=360&&(_=m,R=0,N=v),{r:Math.round((_+T)*255),g:Math.round((R+T)*255),b:Math.round((N+T)*255),a:f}}function fr(s){return parseInt(`0x${tr(s.b)}${tr(s.g)}${tr(s.r)}${tr(s.a*255)}`,16)}function at(s,o="hexa"){let u=o=="raw"||o=="cpal",d=Number.isInteger(s),f=!0;if(d&&u||s==="currentColor")return s;if(typeof s=="object"){if(o=="bgra")return s;if(u)return fr(s)}else if(!d&&/^#([a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})$/i.test(s.trim())){switch(s=s.trim().substring(1),s.length){case 3:s={r:parseInt(s[0].repeat(2),16),g:parseInt(s[1].repeat(2),16),b:parseInt(s[2].repeat(2),16),a:1};break;case 4:s={r:parseInt(s[0].repeat(2),16),g:parseInt(s[1].repeat(2),16),b:parseInt(s[2].repeat(2),16),a:parseInt(s[3].repeat(2),16)/255};break;case 6:s={r:parseInt(s[0]+s[1],16),g:parseInt(s[2]+s[3],16),b:parseInt(s[4]+s[5],16),a:1};break;case 8:s={r:parseInt(s[0]+s[1],16),g:parseInt(s[2]+s[3],16),b:parseInt(s[4]+s[5],16),a:parseInt(s[6]+s[7],16)/255};break}if(o=="bgra")return s}else if(typeof document<"u"&&/^[a-z]+$/i.test(s)){let m=document.createElement("canvas").getContext("2d");m.fillStyle=s;let v=Rr(m.fillStyle,"hexa");v==="#000000ff"&&s.toLowerCase()!=="black"?f=!1:s=v}else{s=s.trim();let m=/rgba?\(\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:,|\s*)\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:,|\s*)\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:(?:,|\s|\/)\s*(?:(0*(?:\.\d+)?()|0*1(?:\.0+)?())|(?:\.\d+)|(\d+)(%)|(\d*\.\d+)(%)))?\s*\)/;if(m.test(s)){let v=s.match(m).filter(T=>typeof T<"u");s={r:Math.round(parseFloat(v[1])/(v[2]?.39215686274509803:1)),g:Math.round(parseFloat(v[3])/(v[4]?.39215686274509803:1)),b:Math.round(parseFloat(v[5])/(v[6]?.39215686274509803:1)),a:v[7]?parseFloat(v[7])/(v[8]?100:1):1}}else{let v=/hsla?\(\s*(?:(\d*\.\d+|\d+)(deg|turn|))\s*(?:,|\s*)\s*(?:(\d*\.\d+)%?|(\d+)%?)\s*(?:,|\s*)\s*(?:(\d*\.\d+)%?|(\d+)%?)\s*(?:(?:,|\s|\/)\s*(?:(0*(?:\.\d+)?()|0*1(?:\.0+)?())|(?:\.\d+)|(\d+)(%)|(\d*\.\d+)(%)))?\s*\)/;if(v.test(s)){let T=s.match(v).filter(_=>typeof _<"u");s=Tt({h:parseFloat(T[1])*(T[2]==="turn"?360:1),s:parseFloat(T[3]),l:parseFloat(T[4]),a:T[5]?parseFloat(T[5])/(T[6]?100:1):1})}else f=!1}}if(!f)throw new Error(`Invalid color format: ${s}`);return Rr(s,o)}function Rr(s,o="hexa"){if(s==="currentColor")return s;if(Number.isInteger(s)){if(o=="raw"||o=="cpal")return s;s=_r(s)}else typeof s!="object"&&(s=at(s,"bgra"));let u=["hsl","hsla"].includes(o)?vt(s):null;switch(o){case"rgba":return`rgba(${s.r}, ${s.g}, ${s.b}, ${parseFloat(s.a.toFixed(3))})`;case"rgb":return`rgb(${s.r}, ${s.g}, ${s.b})`;case"hex":case"hex6":case"hex-6":return`#${tr(s.r)}${tr(s.g)}${tr(s.b)}`;case"hexa":case"hex8":case"hex-8":return`#${tr(s.r)}${tr(s.g)}${tr(s.b)}${tr(s.a*255)}`;case"hsl":return`hsl(${u.h.toFixed(2)}, ${u.s.toFixed(2)}%, ${u.l.toFixed(2)}%)`;case"hsla":return`hsla(${u.h.toFixed(2)}, ${u.s.toFixed(2)}%, ${u.l.toFixed(2)}%, ${parseFloat(s.a.toFixed(3))})`;case"bgra":return s;case"raw":case"cpal":return fr(s);default:throw new Error("Unknown color format: "+o)}}var Vr={parse:ct,make:_t,getPaletteColor:jt,parseColor:at,formatColor:Rr};function Nn(s,o){let u=o||new Ke;return{configurable:!0,get:function(){return typeof u=="function"&&(u=u()),u},set:function(d){u=d}}}function nn(s){this.bindConstructorValues(s)}nn.prototype.bindConstructorValues=function(s){if(this.index=s.index||0,s.name===".notdef"?s.unicode=void 0:s.name===".null"&&(s.unicode=0),s.unicode===0&&s.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=s.name||null,this.unicode=s.unicode,this.unicodes=s.unicodes||(s.unicode!==void 0?[s.unicode]:[]),"xMin"in s&&(this.xMin=s.xMin),"yMin"in s&&(this.yMin=s.yMin),"xMax"in s&&(this.xMax=s.xMax),"yMax"in s&&(this.yMax=s.yMax),"advanceWidth"in s&&(this.advanceWidth=s.advanceWidth),"leftSideBearing"in s&&(this.leftSideBearing=s.leftSideBearing),"points"in s&&(this.points=s.points),Object.defineProperty(this,"path",Nn(this,s.path))},nn.prototype.addUnicode=function(s){this.unicodes.length===0&&(this.unicode=s),this.unicodes.push(s)},nn.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},nn.prototype.getPath=function(s,o,u,d,f){s=s!==void 0?s:0,o=o!==void 0?o:0,u=u!==void 0?u:72,d=Object.assign({},f&&f.defaultRenderOptions,d);let m,v,T=d.xScale,_=d.yScale,R=1/(this.path.unitsPerEm||1e3)*u,N=this;f&&f.variation&&(N=f.variation.getTransform(this,d.variation),m=N.path.commands),d.hinting&&f&&f.hinting&&(v=N.path&&f.hinting.exec(N,u,d)),v?(m=f.hinting.getCommands(v),s=Math.round(s),o=Math.round(o),T=_=1):(m=N.path.commands,T===void 0&&(T=R),_===void 0&&(_=R));let G=new Ke;if(d.drawSVG){let W=this.getSvgImage(f);if(W){let he=new Ke;return he._image={image:W.image,x:s+W.leftSideBearing*R,y:o-W.baseline*R,width:W.image.width*R,height:W.image.height*R},G._layers=[he],G}}if(d.drawLayers){let W=this.getLayers(f);if(W&&W.length){G._layers=[];for(let he=0;he<W.length;he+=1){let ie=W[he],ye=jt(f,ie.paletteIndex,d.usePalette);ye==="currentColor"?ye=d.fill||"black":ye=Rr(ye,d.colorFormat||"rgba"),d=Object.assign({},d,{fill:ye}),G._layers.push(this.getPath.call(ie.glyph,s,o,u,d,f))}return G}}G.fill=d.fill||this.path.fill,G.stroke=this.path.stroke,G.strokeWidth=this.path.strokeWidth*R;for(let W=0;W<m.length;W+=1){let he=m[W];he.type==="M"?G.moveTo(s+he.x*T,o+-he.y*_):he.type==="L"?G.lineTo(s+he.x*T,o+-he.y*_):he.type==="Q"?G.quadraticCurveTo(s+he.x1*T,o+-he.y1*_,s+he.x*T,o+-he.y*_):he.type==="C"?G.curveTo(s+he.x1*T,o+-he.y1*_,s+he.x2*T,o+-he.y2*_,s+he.x*T,o+-he.y*_):he.type==="Z"&&G.stroke&&G.strokeWidth&&G.closePath()}return G},nn.prototype.getLayers=function(s){if(!s)throw new Error("The font object is required to read the colr/cpal tables in order to get the layers.");return s.layers.get(this.index)},nn.prototype.getSvgImage=function(s){if(!s)throw new Error("The font object is required to read the svg table in order to get the image.");return s.svgImages.get(this.index)},nn.prototype.getContours=function(s=null){if(this.points===void 0&&!s)return[];let o=[],u=[],d=s||this.points;for(let f=0;f<d.length;f+=1){let m=d[f];u.push(m),m.lastPointOfContour&&(o.push(u),u=[])}return ge.argument(u.length===0,"There are still points left in the current contour."),o},nn.prototype.getMetrics=function(){let s=this.path.commands,o=[],u=[];for(let f=0;f<s.length;f+=1){let m=s[f];m.type!=="Z"&&(o.push(m.x),u.push(m.y)),(m.type==="Q"||m.type==="C")&&(o.push(m.x1),u.push(m.y1)),m.type==="C"&&(o.push(m.x2),u.push(m.y2))}let d={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,u),xMax:Math.max.apply(null,o),yMax:Math.max.apply(null,u),leftSideBearing:this.leftSideBearing};return isFinite(d.xMin)||(d.xMin=0),isFinite(d.xMax)||(d.xMax=this.advanceWidth),isFinite(d.yMin)||(d.yMin=0),isFinite(d.yMax)||(d.yMax=0),d.rightSideBearing=this.advanceWidth-d.leftSideBearing-(d.xMax-d.xMin),d},nn.prototype.draw=function(s,o,u,d,f,m){f=Object.assign({},m&&m.defaultRenderOptions,f),this.getPath(o,u,d,f,m).draw(s)},nn.prototype.drawPoints=function(s,o,u,d,f,m){if(f=Object.assign({},m&&m.defaultRenderOptions,f),f.drawLayers){let G=this.getLayers(m);if(G&&G.length){for(let W=0;W<G.length;W+=1)G[W].glyph.index!==this.index&&this.drawPoints.call(G[W].glyph,s,o,u,d);return}}function v(G,W,he,ie){s.beginPath();for(let ye=0;ye<G.length;ye+=1)s.moveTo(W+G[ye].x*ie,he+G[ye].y*ie),s.arc(W+G[ye].x*ie,he+G[ye].y*ie,2,0,Math.PI*2,!1);s.fill()}o=o!==void 0?o:0,u=u!==void 0?u:0,d=d!==void 0?d:24;let T=1/this.path.unitsPerEm*d,_=[],R=[],N=this.path.commands;m&&m.variation&&(N=m.variation.getTransform(this,f.variation).path.commands);for(let G=0;G<N.length;G+=1){let W=N[G];W.x!==void 0&&_.push({x:W.x,y:-W.y}),W.x1!==void 0&&R.push({x:W.x1,y:-W.y1}),W.x2!==void 0&&R.push({x:W.x2,y:-W.y2})}s.fillStyle="blue",v(_,o,u,T),s.fillStyle="red",v(R,o,u,T)},nn.prototype.drawMetrics=function(s,o,u,d){let f;o=o!==void 0?o:0,u=u!==void 0?u:0,d=d!==void 0?d:24,f=1/this.path.unitsPerEm*d,s.lineWidth=1,s.strokeStyle="black",At.line(s,o,-1e4,o,1e4),At.line(s,-1e4,u,1e4,u);let m=this.xMin||0,v=this.yMin||0,T=this.xMax||0,_=this.yMax||0,R=this.advanceWidth||0;s.strokeStyle="blue",At.line(s,o+m*f,-1e4,o+m*f,1e4),At.line(s,o+T*f,-1e4,o+T*f,1e4),At.line(s,-1e4,u+-v*f,1e4,u+-v*f),At.line(s,-1e4,u+-_*f,1e4,u+-_*f),s.strokeStyle="green",At.line(s,o+R*f,-1e4,o+R*f,1e4)},nn.prototype.toPathData=function(s,o){s=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},s);let u=this;o&&o.variation&&(u=o.variation.getTransform(this,s.variation));let d=u.points&&s.pointsTransform?s.pointsTransform(u.points):u.path;return s.pathTransform&&(d=s.pathTransform(d)),d.toPathData(s)},nn.prototype.fromSVG=function(s,o={}){return this.path.fromSVG(s,o)},nn.prototype.toSVG=function(s,o){let u=this.toPathData.apply(this,[s,o]);return this.path.toSVG(s,u)},nn.prototype.toDOMElement=function(s,o){s=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},s);let u=this.path;return o&&o.variation&&(u=o.variation.getTransform(this,s.variation).path),u.toDOMElement(s)};var fs=nn;function On(s,o,u){Object.defineProperty(s,o,{get:function(){return typeof s[u]>"u"&&s.path,s[u]},set:function(d){s[u]=d},enumerable:!0,configurable:!0})}function ls(s,o){if(this.font=s,this.glyphs={},Array.isArray(o))for(let u=0;u<o.length;u++){let d=o[u];d.path.unitsPerEm=s.unitsPerEm,this.glyphs[u]=d}this.length=o&&o.length||0}typeof Symbol<"u"&&Symbol.iterator&&(ls.prototype[Symbol.iterator]=function(){let s=-1;return{next:(function(){s++;let o=s>=this.length-1;return{value:this.get(s),done:o}}).bind(this)}}),ls.prototype.get=function(s){if(this.font._push&&this.glyphs[s]===void 0){this.font._push(s),typeof this.glyphs[s]=="function"&&(this.glyphs[s]=this.glyphs[s]());let o=this.glyphs[s],u=this.font._IndexToUnicodeMap[s];if(u)for(let d=0;d<u.unicodes.length;d++)o.addUnicode(u.unicodes[d]);this.font.cffEncoding?o.name=this.font.cffEncoding.charset[s]:this.font.glyphNames.names&&(o.name=this.font.glyphNames.glyphIndexToName(s)),this.glyphs[s].advanceWidth=this.font._hmtxTableData[s].advanceWidth,this.glyphs[s].leftSideBearing=this.font._hmtxTableData[s].leftSideBearing}else typeof this.glyphs[s]=="function"&&(this.glyphs[s]=this.glyphs[s]());return this.glyphs[s]},ls.prototype.push=function(s,o){this.glyphs[s]=o,this.length++};function Bs(s,o){return new fs({index:o,font:s})}function ii(s,o,u,d,f,m){return function(){let v=new fs({index:o,font:s});return v.path=function(){u(v,d,f);let T=m(s.glyphs,v);return T.unitsPerEm=s.unitsPerEm,T},On(v,"numberOfContours","_numberOfContours"),On(v,"xMin","_xMin"),On(v,"xMax","_xMax"),On(v,"yMin","_yMin"),On(v,"yMax","_yMax"),On(v,"points","_points"),v}}function Os(s,o,u,d,f){return function(){let m=new fs({index:o,font:s});return m.path=function(){let v=u(s,m,d,f);return v.unitsPerEm=s.unitsPerEm,v},m}}var Pr={GlyphSet:ls,glyphLoader:Bs,ttfGlyphLoader:ii,cffGlyphLoader:Os};function Jr(s,o){if(s===o)return!0;if(Array.isArray(s)&&Array.isArray(o)){if(s.length!==o.length)return!1;for(let u=0;u<s.length;u+=1)if(!Jr(s[u],o[u]))return!1;return!0}else return!1}var $n=10;function U(s){let o;return s.length<1240?o=107:s.length<33900?o=1131:o=32768,o}function ne(s,o,u,d){let f=[],m=[],v=d>1?st.getULong(s,o):st.getCard16(s,o),T=d>1?4:2,_,R;if(v!==0){let N=st.getByte(s,o+T);_=o+(v+1)*N+T;let G=o+T+1;for(let W=0;W<v+1;W+=1)f.push(st.getOffset(s,G,N)),G+=N;R=_+f[v]}else R=o+T;for(let N=0;N<f.length-1;N+=1){let G=st.getBytes(s,_+f[N],_+f[N+1]);u&&(G=u(G,s,o,d)),m.push(G)}return{objects:m,startOffset:o,endOffset:R}}function me(s,o,u){let d=[],f=u>1?st.getULong(s,o):st.getCard16(s,o),m=u>1?4:2,v,T;if(f!==0){let _=st.getByte(s,o+m);v=o+(f+1)*_+m;let R=o+m+1;for(let N=0;N<f+1;N+=1)d.push(st.getOffset(s,R,_)),R+=_;T=v+d[f]}else T=o+m;return{offsets:d,startOffset:o,endOffset:T}}function Me(s,o,u,d,f,m){let v=m>1?st.getULong(u,d):st.getCard16(u,d),T=m>1?4:2,_=0;if(v!==0){let N=st.getByte(u,d+T);_=d+(v+1)*N+T}let R=st.getBytes(u,_+o[s],_+o[s+1]);return f&&(R=f(R)),R}function Ut(s){let o="",u=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){let d=s.parseByte(),f=d>>4,m=d&15;if(f===15||(o+=u[f],m===15))break;o+=u[m]}return parseFloat(o)}function Pt(s,o){let u,d,f,m;if(o===28)return u=s.parseByte(),d=s.parseByte(),u<<8|d;if(o===29)return u=s.parseByte(),d=s.parseByte(),f=s.parseByte(),m=s.parseByte(),u<<24|d<<16|f<<8|m;if(o===30)return Ut(s);if(o>=32&&o<=246)return o-139;if(o>=247&&o<=250)return u=s.parseByte(),(o-247)*256+u+108;if(o>=251&&o<=254)return u=s.parseByte(),-(o-251)*256-u-108;throw new Error("Invalid b0 "+o)}function rr(s){let o={};for(let u=0;u<s.length;u+=1){let d=s[u][0],f=s[u][1],m;if(f.length===1?m=f[0]:m=f,Object.prototype.hasOwnProperty.call(o,d)&&!isNaN(o[d]))throw new Error("Object "+o+" already has key "+d);o[d]=m}return o}function er(s,o,u,d){o=o!==void 0?o:0;let f=new st.Parser(s,o),m=[],v=[];u=u!==void 0?u:s.byteLength;let T=d<2?22:28;for(;f.relativeOffset<u;){let _=f.parseByte();if(_<T){if(_===12&&(_=1200+f.parseByte()),d>1&&_===23){ai(v);continue}m.push([_,v]),v=[]}else v.push(Pt(f,_,d))}return rr(m)}function Or(s,o){return o<=390?o=Ir[o]:s?o=s[o-391]:o=void 0,o}function fn(s,o,u){let d={},f;for(let m=0;m<o.length;m+=1){let v=o[m];if(Array.isArray(v.type)){let T=[];T.length=v.type.length;for(let _=0;_<v.type.length;_++)f=s[v.op]!==void 0?s[v.op][_]:void 0,f===void 0&&(f=v.value!==void 0&&v.value[_]!==void 0?v.value[_]:null),v.type[_]==="SID"&&(f=Or(u,f)),T[_]=f;d[v.name]=T}else f=s[v.op],f===void 0&&(f=v.value!==void 0?v.value:null),v.type==="SID"&&(f=Or(u,f)),d[v.name]=f}return d}function P(s,o){let u={};if(u.formatMajor=st.getCard8(s,o),u.formatMinor=st.getCard8(s,o+1),u.formatMajor>2)throw new Error(`Unsupported CFF table version ${u.formatMajor}.${u.formatMinor}`);return u.size=st.getCard8(s,o+2),u.formatMajor<2?(u.offsetSize=st.getCard8(s,o+3),u.startOffset=o,u.endOffset=o+4):(u.topDictLength=st.getCard16(s,o+3),u.endOffset=o+8),u}var xe=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],Ae=[{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"charStrings",op:17,type:"offset"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"vstore",op:24,type:"offset"}],rt=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}],pt=[{name:"blueValues",op:6,type:"delta"},{name:"otherBlues",op:7,type:"delta"},{name:"familyBlues",op:7,type:"delta"},{name:"familyBlues",op:8,type:"delta"},{name:"familyOtherBlues",op:9,type:"delta"},{name:"blueScale",op:1209,type:"number",value:.039625},{name:"blueShift",op:1210,type:"number",value:7},{name:"blueFuzz",op:1211,type:"number",value:1},{name:"stdHW",op:10,type:"number"},{name:"stdVW",op:11,type:"number"},{name:"stemSnapH",op:1212,type:"number"},{name:"stemSnapV",op:1213,type:"number"},{name:"languageGroup",op:1217,type:"number",value:0},{name:"expansionFactor",op:1218,type:"number",value:.06},{name:"vsindex",op:22,type:"number",value:0},{name:"subrs",op:19,type:"offset"}],dr=[{name:"private",op:18,type:["number","offset"],value:[0,0]}];function qt(s,o,u,d){let f=er(s,o,s.byteLength,d);return fn(f,d>1?Ae:xe,u)}function Rt(s,o,u,d,f){let m=er(s,o,u,f);return fn(m,f>1?pt:rt,d)}function Fr(s,o,u){let d=er(s,o,void 0,u);return fn(d,dr)}function Rn(s,o,u){let d=[];for(let f=0;f<u.length;f++){let m=new DataView(new Uint8Array(u[f]).buffer),v=Fr(m,0,2),T=v.private[0],_=v.private[1];if(T!==0&&_!==0){let R=Rt(s,_+o,T,[],2);if(R.subrs){let N=_+R.subrs,G=ne(s,N+o,void 0,2);v._subrs=G.objects,v._subrsBias=U(v._subrs)}v._privateDict=R}d.push(v)}return d}function xs(s,o,u,d,f){let m=[];for(let v=0;v<u.length;v+=1){let T=new DataView(new Uint8Array(u[v]).buffer),_=qt(T,0,d,f);_._subrs=[],_._subrsBias=0,_._defaultWidthX=0,_._nominalWidthX=0;let R=f<2?_.private[0]:0,N=f<2?_.private[1]:0;if(R!==0&&N!==0){let G=Rt(s,N+o,R,d,f);if(_._defaultWidthX=G.defaultWidthX,_._nominalWidthX=G.nominalWidthX,G.subrs!==0){let W=N+G.subrs,he=ne(s,W+o,void 0,f);_._subrs=he.objects,_._subrsBias=U(_._subrs)}_._privateDict=G}m.push(_)}return m}function Mi(s,o,u,d,f){let m,v,T=new st.Parser(s,o);u-=1;let _=[".notdef"],R=T.parseCard8();if(R===0)for(let N=0;N<u;N+=1)m=T.parseSID(),f?_.push(m):_.push(Or(d,m)||m);else if(R===1)for(;_.length<=u;){m=T.parseSID(),v=T.parseCard8();for(let N=0;N<=v;N+=1)f?_.push("cid"+("00000"+m).slice(-5)):_.push(Or(d,m)||m),m+=1}else if(R===2)for(;_.length<=u;){m=T.parseSID(),v=T.parseCard16();for(let N=0;N<=v;N+=1)f?_.push("cid"+("00000"+m).slice(-5)):_.push(Or(d,m)||m),m+=1}else throw new Error("Unknown charset format "+R);return _}function ss(s,o){let u,d={},f=new st.Parser(s,o),m=f.parseCard8();if(m===0){let v=f.parseCard8();for(let T=0;T<v;T+=1)u=f.parseCard8(),d[u]=T}else if(m===1){let v=f.parseCard8();u=1;for(let T=0;T<v;T+=1){let _=f.parseCard8(),R=f.parseCard8();for(let N=_;N<=_+R;N+=1)d[N]=u,u+=1}}else throw new Error("Unknown encoding format "+m);return d}function ai(s){let o=s.pop();for(;s.length>o;)s.pop()}function oi(s,o){let u=s.tables.cff&&s.tables.cff.topDict&&s.tables.cff.topDict.paintType||0;return u===2&&(o.fill=null,o.stroke="black",o.strokeWidth=s.tables.cff.topDict.strokeWidth||0),u}function da(s,o,u,d,f){let m,v,T,_,R=new Ke,N=[],G=0,W=!1,he=!1,ie=0,ye=0,Je,gr,or,Cr,Yr=0,Dn=[],zn,Hn=0,Ns=s.tables.cff2||s.tables.cff;if(or=Ns.topDict._defaultWidthX,Cr=Ns.topDict._nominalWidthX,f=f||s.variation&&s.variation.get(),o.getBlendPath||(o.getBlendPath=function(nr){return da(s,o,u,d,nr)}),s.isCIDFont||d>1){let nr=Ns.topDict._fdSelect?Ns.topDict._fdSelect[o.index]:0,ir=Ns.topDict._fdArray[nr];Je=ir._subrs,gr=ir._subrsBias,d>1?(Dn=Ns.topDict._vstore.itemVariationStore,Yr=ir._privateDict.vsindex):(or=ir._defaultWidthX,Cr=ir._nominalWidthX)}else Je=Ns.topDict._subrs,gr=Ns.topDict._subrsBias;let yo=oi(s,R),Zr=or;function Ia(nr,ir){he&&yo!==2&&R.closePath(),R.moveTo(nr,ir),he=!0}function Oi(){let nr;nr=(N.length&1)!==0,nr&&!W&&(Zr=N.shift()+Cr),G+=N.length>>1,N.length=0,W=!0}function xr(nr){let ir,Ei,_l,rd,Gl,vo,Fi,Ga,Ni,Ea,$i,Ui,Ls=0;for(;Ls<nr.length;){let qa=nr[Ls];switch(Ls+=1,qa){case 1:Oi();break;case 3:Oi();break;case 4:N.length>1&&!W&&(Zr=N.shift()+Cr,W=!0),ye+=N.pop(),Ia(ie,ye);break;case 5:for(;N.length>0;)ie+=N.shift(),ye+=N.shift(),R.lineTo(ie,ye);break;case 6:for(;N.length>0&&(ie+=N.shift(),R.lineTo(ie,ye),N.length!==0);)ye+=N.shift(),R.lineTo(ie,ye);break;case 7:for(;N.length>0&&(ye+=N.shift(),R.lineTo(ie,ye),N.length!==0);)ie+=N.shift(),R.lineTo(ie,ye);break;case 8:for(;N.length>0;)m=ie+N.shift(),v=ye+N.shift(),T=m+N.shift(),_=v+N.shift(),ie=T+N.shift(),ye=_+N.shift(),R.curveTo(m,v,T,_,ie,ye);break;case 10:if(Gl=N.pop()+gr,vo=Je[Gl],vo){if(Hn>=$n){console.warn("CFF charstring subroutine call depth exceeded, skipping callsubr");break}Hn++,xr(vo),Hn--}break;case 11:if(d>1){console.error("CFF CharString operator return (11) is not supported in CFF2");break}return;case 12:switch(qa=nr[Ls],Ls+=1,qa){case 35:m=ie+N.shift(),v=ye+N.shift(),T=m+N.shift(),_=v+N.shift(),Fi=T+N.shift(),Ga=_+N.shift(),Ni=Fi+N.shift(),Ea=Ga+N.shift(),$i=Ni+N.shift(),Ui=Ea+N.shift(),ie=$i+N.shift(),ye=Ui+N.shift(),N.shift(),R.curveTo(m,v,T,_,Fi,Ga),R.curveTo(Ni,Ea,$i,Ui,ie,ye);break;case 34:m=ie+N.shift(),v=ye,T=m+N.shift(),_=v+N.shift(),Fi=T+N.shift(),Ga=_,Ni=Fi+N.shift(),Ea=_,$i=Ni+N.shift(),Ui=ye,ie=$i+N.shift(),R.curveTo(m,v,T,_,Fi,Ga),R.curveTo(Ni,Ea,$i,Ui,ie,ye);break;case 36:m=ie+N.shift(),v=ye+N.shift(),T=m+N.shift(),_=v+N.shift(),Fi=T+N.shift(),Ga=_,Ni=Fi+N.shift(),Ea=_,$i=Ni+N.shift(),Ui=Ea+N.shift(),ie=$i+N.shift(),R.curveTo(m,v,T,_,Fi,Ga),R.curveTo(Ni,Ea,$i,Ui,ie,ye);break;case 37:m=ie+N.shift(),v=ye+N.shift(),T=m+N.shift(),_=v+N.shift(),Fi=T+N.shift(),Ga=_+N.shift(),Ni=Fi+N.shift(),Ea=Ga+N.shift(),$i=Ni+N.shift(),Ui=Ea+N.shift(),Math.abs($i-ie)>Math.abs(Ui-ye)?ie=$i+N.shift():ye=Ui+N.shift(),R.curveTo(m,v,T,_,Fi,Ga),R.curveTo(Ni,Ea,$i,Ui,ie,ye);break;default:console.log("Glyph "+o.index+": unknown operator 1200"+qa),N.length=0}break;case 14:if(d>1){console.error("CFF CharString operator endchar (14) is not supported in CFF2");break}if(N.length>=4){let Vl=Gr[N.pop()],Ac=Gr[N.pop()],nd=N.pop(),sd=N.pop();if(Vl&&Ac){o.isComposite=!0,o.components=[];let Bm=s.cffEncoding.charset.indexOf(Vl),Qm=s.cffEncoding.charset.indexOf(Ac);o.components.push({glyphIndex:Qm,dx:0,dy:0}),o.components.push({glyphIndex:Bm,dx:sd,dy:nd}),R.extend(s.glyphs.get(Qm).path);let f7=s.glyphs.get(Bm),df=JSON.parse(JSON.stringify(f7.path.commands));for(let hf=0;hf<df.length;hf+=1){let Mo=df[hf];Mo.type!=="Z"&&(Mo.x+=sd,Mo.y+=nd),(Mo.type==="Q"||Mo.type==="C")&&(Mo.x1+=sd,Mo.y1+=nd),Mo.type==="C"&&(Mo.x2+=sd,Mo.y2+=nd)}R.extend(df)}}else N.length>0&&!W&&(Zr=N.shift()+Cr,W=!0);he&&yo!==2&&(R.closePath(),he=!1);break;case 15:if(d<2){console.error("CFF2 CharString operator vsindex (15) is not supported in CFF");break}Yr=N.pop();break;case 16:if(d<2){console.error("CFF2 CharString operator blend (16) is not supported in CFF");break}zn||(zn=s.variation&&f&&s.variation.process.getBlendVector(Dn,Yr,f));var Zn=N.pop(),ra=zn?zn.length:Dn.itemVariationSubtables[Yr].regionIndexes.length,Va=Zn*ra,wo=N.length-Va,rl=wo-Zn;if(zn)for(let Vl=0;Vl<Zn;Vl++){var Dm=N[rl+Vl];for(let Ac=0;Ac<ra;Ac++)Dm+=zn[Ac]*N[wo++];N[rl+Vl]=Dm}for(;Va--;)N.pop();break;case 18:Oi();break;case 19:case 20:Oi(),Ls+=G+7>>3;break;case 21:N.length>2&&!W&&(Zr=N.shift()+Cr,W=!0),ye+=N.pop(),ie+=N.pop(),Ia(ie,ye);break;case 22:N.length>1&&!W&&(Zr=N.shift()+Cr,W=!0),ie+=N.pop(),Ia(ie,ye);break;case 23:Oi();break;case 24:for(;N.length>2;)m=ie+N.shift(),v=ye+N.shift(),T=m+N.shift(),_=v+N.shift(),ie=T+N.shift(),ye=_+N.shift(),R.curveTo(m,v,T,_,ie,ye);ie+=N.shift(),ye+=N.shift(),R.lineTo(ie,ye);break;case 25:for(;N.length>6;)ie+=N.shift(),ye+=N.shift(),R.lineTo(ie,ye);m=ie+N.shift(),v=ye+N.shift(),T=m+N.shift(),_=v+N.shift(),ie=T+N.shift(),ye=_+N.shift(),R.curveTo(m,v,T,_,ie,ye);break;case 26:for(N.length&1&&(ie+=N.shift());N.length>0;)m=ie,v=ye+N.shift(),T=m+N.shift(),_=v+N.shift(),ie=T,ye=_+N.shift(),R.curveTo(m,v,T,_,ie,ye);break;case 27:for(N.length&1&&(ye+=N.shift());N.length>0;)m=ie+N.shift(),v=ye,T=m+N.shift(),_=v+N.shift(),ie=T+N.shift(),ye=_,R.curveTo(m,v,T,_,ie,ye);break;case 28:ir=nr[Ls],Ei=nr[Ls+1],N.push((ir<<24|Ei<<16)>>16),Ls+=2;break;case 29:if(Gl=N.pop()+s.gsubrsBias,vo=s.gsubrs[Gl],vo){if(Hn>=$n){console.warn("CFF charstring subroutine call depth exceeded, skipping callgsubr");break}Hn++,xr(vo),Hn--}break;case 30:for(;N.length>0&&(m=ie,v=ye+N.shift(),T=m+N.shift(),_=v+N.shift(),ie=T+N.shift(),ye=_+(N.length===1?N.shift():0),R.curveTo(m,v,T,_,ie,ye),N.length!==0);)m=ie+N.shift(),v=ye,T=m+N.shift(),_=v+N.shift(),ye=_+N.shift(),ie=T+(N.length===1?N.shift():0),R.curveTo(m,v,T,_,ie,ye);break;case 31:for(;N.length>0&&(m=ie+N.shift(),v=ye,T=m+N.shift(),_=v+N.shift(),ye=_+N.shift(),ie=T+(N.length===1?N.shift():0),R.curveTo(m,v,T,_,ie,ye),N.length!==0);)m=ie,v=ye+N.shift(),T=m+N.shift(),_=v+N.shift(),ie=T+N.shift(),ye=_+(N.length===1?N.shift():0),R.curveTo(m,v,T,_,ie,ye);break;default:qa<32?console.log("Glyph "+o.index+": unknown operator "+qa):qa<247?N.push(qa-139):qa<251?(ir=nr[Ls],Ls+=1,N.push((qa-247)*256+ir+108)):qa<255?(ir=nr[Ls],Ls+=1,N.push(-(qa-251)*256-ir-108)):(ir=nr[Ls],Ei=nr[Ls+1],_l=nr[Ls+2],rd=nr[Ls+3],Ls+=4,N.push((ir<<24|Ei<<16|_l<<8|rd)/65536))}}}return xr(u),s.variation&&f&&(R.commands=R.commands.map(nr=>{let ir=Object.keys(nr);for(let Ei=0;Ei<ir.length;Ei++){let _l=ir[Ei];_l!=="type"&&(nr[_l]=Math.round(nr[_l]))}return nr})),W&&(o.advanceWidth=Zr),R}function pn(s,o,u,d,f){let m=[],v,T=new st.Parser(s,o),_=T.parseCard8();if(_===0)for(let R=0;R<u;R++){if(v=T.parseCard8(),v>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+v+" (FD count "+d+")");m.push(v)}else if(_===3||f>1&&_===4){let R=_===4?T.parseULong():T.parseCard16(),N=_===4?T.parseULong():T.parseCard16();if(N!==0)throw new Error(`CFF Table CID Font FDSelect format ${_} range has bad initial GID ${N}`);let G;for(let W=0;W<R;W++){if(v=_===4?T.parseUShort():T.parseCard8(),G=_===4?T.parseULong():T.parseCard16(),v>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+v+" (FD count "+d+")");if(G>u)throw new Error(`CFF Table CID Font FDSelect format ${f} range has bad GID ${G}`);for(;N<G;N++)m.push(v);N=G}if(G!==u)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final (Sentinal) GID "+G)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+_);return m}function cs(s,o,u,d){let f,m=P(s,o);m.formatMajor===2?f=u.tables.cff2={}:f=u.tables.cff={};let v=m.formatMajor>1?null:ne(s,m.endOffset,st.bytesToString),T=m.formatMajor>1?null:ne(s,v.endOffset),_=m.formatMajor>1?null:ne(s,T.endOffset,st.bytesToString),R=ne(s,m.formatMajor>1?o+m.size+m.topDictLength:_.endOffset,void 0,m.formatMajor);u.gsubrs=R.objects,u.gsubrsBias=U(u.gsubrs);let N;if(m.formatMajor>1){let W=o+m.size,he=st.getBytes(s,W,W+m.topDictLength);N=xs(s,0,[he],void 0,m.formatMajor)[0]}else{let W=xs(s,o,T.objects,_.objects,m.formatMajor);if(W.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+W.length);N=W[0]}if(f.topDict=N,N._privateDict&&(u.defaultWidthX=N._privateDict.defaultWidthX,u.nominalWidthX=N._privateDict.nominalWidthX),m.formatMajor<2&&N.ros[0]!==void 0&&N.ros[1]!==void 0&&(u.isCIDFont=!0),m.formatMajor>1){let W=N.fdArray,he=N.fdSelect;if(!W)throw new Error("This is a CFF2 font, but FDArray information is missing");let ie=ne(s,o+W,null,m.formatMajor),ye=Rn(s,o,ie.objects);N._fdArray=ye,he&&(N._fdSelect=pn(s,o+he,u.numGlyphs,ye.length,m.formatMajor))}else if(u.isCIDFont){let W=N.fdArray,he=N.fdSelect;if(W===0||he===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");W+=o;let ie=ne(s,W),ye=xs(s,o,ie.objects,_.objects,m.formatMajor);N._fdArray=ye,he+=o,N._fdSelect=pn(s,he,u.numGlyphs,ye.length,m.formatMajor)}if(m.formatMajor<2){let W=o+N.private[1],he=Rt(s,W,N.private[0],_.objects,m.formatMajor);if(u.defaultWidthX=he.defaultWidthX,u.nominalWidthX=he.nominalWidthX,he.subrs!==0){let ie=W+he.subrs,ye=ne(s,ie);u.subrs=ye.objects,u.subrsBias=U(u.subrs)}else u.subrs=[],u.subrsBias=0}let G;if(d.lowMemory?(G=me(s,o+N.charStrings,m.formatMajor),u.nGlyphs=G.offsets.length-(m.formatMajor>1?1:0)):(G=ne(s,o+N.charStrings,null,m.formatMajor),u.nGlyphs=G.objects.length),m.formatMajor>1&&u.tables.maxp&&u.nGlyphs!==u.tables.maxp.numGlyphs&&console.error(`Glyph count in the CFF2 table (${u.nGlyphs}) must correspond to the glyph count in the maxp table (${u.tables.maxp.numGlyphs})`),m.formatMajor<2){let W=[],he=[];N.charset===0?W=ln:N.charset===1?W=zr:N.charset===2?W=Vn:W=Mi(s,o+N.charset,u.nGlyphs,_.objects,u.isCIDFont),N.encoding===0?he=Gr:N.encoding===1?he=qn:he=ss(s,o+N.encoding),u.cffEncoding=new we(he,W),u.encoding=u.encoding||u.cffEncoding}if(u.glyphs=new Pr.GlyphSet(u),d.lowMemory)u._push=function(W){let he=Me(W,G.offsets,s,o+N.charStrings,void 0,m.formatMajor);u.glyphs.push(W,Pr.cffGlyphLoader(u,W,da,he,m.formatMajor))};else for(let W=0;W<u.nGlyphs;W+=1){let he=G.objects[W];u.glyphs.push(W,Pr.cffGlyphLoader(u,W,da,he,m.formatMajor))}if(N.vstore){let W=new st.Parser(s,o+N.vstore);N._vstore=W.parseVariationStore()}}function ks(s,o){let u,d=Ir.indexOf(s);return d>=0&&(u=d),d=o.indexOf(s),d>=0?u=d+Ir.length:(u=Ir.length+o.length,o.push(s)),u}function Ba(){return new Fe.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function Ci(s){let o=new Fe.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);o.names=[];for(let u=0;u<s.length;u+=1)o.names.push({name:"name_"+u,type:"NAME",value:s[u]});return o}function lo(s,o,u){let d={};for(let f=0;f<s.length;f+=1){let m=s[f],v=o[m.name];v!==void 0&&!Jr(v,m.value)&&(m.type==="SID"&&(v=ks(v,u)),d[m.op]={name:m.name,type:m.type,value:v})}return d}function ha(s,o,u){let d=new Fe.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=lo(u>1?Ae:xe,s,o),d}function un(s){let o=new Fe.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return o.topDicts=[{name:"topDict_0",type:"TABLE",value:s}],o}function fa(s){let o=new Fe.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);o.strings=[];for(let u=0;u<s.length;u+=1)o.strings.push({name:"string_"+u,type:"STRING",value:s[u]});return o}function Is(){return new Fe.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function Zo(s,o){let u=new Fe.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let d=0;d<s.length;d+=1){let f=s[d],m=ks(f,o);u.fields.push({name:"glyph_"+d,type:"SID",value:m})}return u}function Si(s,o){let u=[],d=s.path;o<2&&u.push({name:"width",type:"NUMBER",value:s.advanceWidth});let f=0,m=0;for(let v=0;v<d.commands.length;v+=1){let T,_,R=d.commands[v];if(R.type==="Q"){let N=.3333333333333333,G=2/3;R={type:"C",x:R.x,y:R.y,x1:Math.round(N*f+G*R.x1),y1:Math.round(N*m+G*R.y1),x2:Math.round(N*R.x+G*R.x1),y2:Math.round(N*R.y+G*R.y1)}}if(R.type==="M")T=Math.round(R.x-f),_=Math.round(R.y-m),u.push({name:"dx",type:"NUMBER",value:T}),u.push({name:"dy",type:"NUMBER",value:_}),u.push({name:"rmoveto",type:"OP",value:21}),f=Math.round(R.x),m=Math.round(R.y);else if(R.type==="L")T=Math.round(R.x-f),_=Math.round(R.y-m),u.push({name:"dx",type:"NUMBER",value:T}),u.push({name:"dy",type:"NUMBER",value:_}),u.push({name:"rlineto",type:"OP",value:5}),f=Math.round(R.x),m=Math.round(R.y);else if(R.type==="C"){let N=Math.round(R.x1-f),G=Math.round(R.y1-m),W=Math.round(R.x2-R.x1),he=Math.round(R.y2-R.y1);T=Math.round(R.x-R.x2),_=Math.round(R.y-R.y2),u.push({name:"dx1",type:"NUMBER",value:N}),u.push({name:"dy1",type:"NUMBER",value:G}),u.push({name:"dx2",type:"NUMBER",value:W}),u.push({name:"dy2",type:"NUMBER",value:he}),u.push({name:"dx",type:"NUMBER",value:T}),u.push({name:"dy",type:"NUMBER",value:_}),u.push({name:"rrcurveto",type:"OP",value:8}),f=Math.round(R.x),m=Math.round(R.y)}}return o<2&&u.push({name:"endchar",type:"OP",value:14}),u}function co(s,o){let u=new Fe.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let d=0;d<s.length;d+=1){let f=s.get(d),m=Si(f,o);u.charStrings.push({name:f.name,type:"CHARSTRING",value:m})}return u}function Qa(s,o,u){let d=new Fe.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=lo(u>1?pt:rt,s,o),d}function pa(s,o){let u=new Fe.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),d=1/o.unitsPerEm,f={version:o.version,fullName:o.fullName,familyName:o.familyName,weight:o.weightName,fontBBox:o.fontBBox||[0,0,0,0],fontMatrix:[d,0,0,d,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},m=o&&o.topDict||{};m.paintType&&(f.paintType=m.paintType,f.strokeWidth=m.strokeWidth||0);let v={},T=[],_;for(let W=1;W<s.length;W+=1)_=s.get(W),T.push(_.name);let R=[];u.header=Ba(),u.nameIndex=Ci([o.postScriptName]);let N=ha(f,R);u.topDictIndex=un(N),u.globalSubrIndex=Is(),u.charsets=Zo(T,R),u.charStringsIndex=co(s,1),u.privateDict=Qa(v,R),u.stringIndex=fa(R);let G=u.header.sizeOf()+u.nameIndex.sizeOf()+u.topDictIndex.sizeOf()+u.stringIndex.sizeOf()+u.globalSubrIndex.sizeOf();return f.charset=G,f.encoding=0,f.charStrings=f.charset+u.charsets.sizeOf(),f.private[1]=f.charStrings+u.charStringsIndex.sizeOf(),N=ha(f,R),u.topDictIndex=un(N),u}var Yi={parse:cs,make:pa};function ja(s,o){let u={},d=new st.Parser(s,o);return u.version=d.parseVersion(),u.fontRevision=Math.round(d.parseFixed()*1e3)/1e3,u.checkSumAdjustment=d.parseULong(),u.magicNumber=d.parseULong(),ge.argument(u.magicNumber===1594834165,"Font header has wrong magic number."),u.flags=d.parseUShort(),u.unitsPerEm=d.parseUShort(),u.created=d.parseLongDateTime(),u.modified=d.parseLongDateTime(),u.xMin=d.parseShort(),u.yMin=d.parseShort(),u.xMax=d.parseShort(),u.yMax=d.parseShort(),u.macStyle=d.parseUShort(),u.lowestRecPPEM=d.parseUShort(),u.fontDirectionHint=d.parseShort(),u.indexToLocFormat=d.parseShort(),u.glyphDataFormat=d.parseShort(),u}function li(s){let o=Math.round(new Date().getTime()/1e3)+2082844800,u=o,d=s.macStyle||0;return s.createdTimestamp&&(u=s.createdTimestamp+2082844800),new Fe.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:u},{name:"modified",type:"LONGDATETIME",value:o},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:d},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],s)}var us={parse:ja,make:li};function Cn(s,o){let u={},d=new st.Parser(s,o);return u.version=d.parseVersion(),u.ascender=d.parseShort(),u.descender=d.parseShort(),u.lineGap=d.parseShort(),u.advanceWidthMax=d.parseUShort(),u.minLeftSideBearing=d.parseShort(),u.minRightSideBearing=d.parseShort(),u.xMaxExtent=d.parseShort(),u.caretSlopeRise=d.parseShort(),u.caretSlopeRun=d.parseShort(),u.caretOffset=d.parseShort(),d.relativeOffset+=8,u.metricDataFormat=d.parseShort(),u.numberOfHMetrics=d.parseUShort(),u}function ma(s){return new Fe.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],s)}var Xn={parse:Cn,make:ma};function ci(s,o,u,d,f){let m,v,T=new st.Parser(s,o);for(let _=0;_<d;_+=1){_<u&&(m=T.parseUShort(),v=T.parseShort());let R=f.get(_);R.advanceWidth=m,R.leftSideBearing=v}}function _i(s,o,u,d,f){s._hmtxTableData={};let m,v,T=new st.Parser(o,u);for(let _=0;_<f;_+=1)_<d&&(m=T.parseUShort(),v=T.parseShort()),s._hmtxTableData[_]={advanceWidth:m,leftSideBearing:v}}function Zi(s,o,u,d,f,m,v){v.lowMemory?_i(s,o,u,d,f):ci(o,u,d,f,m)}function Pa(s){let o=new Fe.Table("hmtx",[]);for(let u=0;u<s.length;u+=1){let d=s.get(u),f=d.advanceWidth||0,m=d.leftSideBearing||0;o.fields.push({name:"advanceWidth_"+u,type:"USHORT",value:f}),o.fields.push({name:"leftSideBearing_"+u,type:"SHORT",value:m})}return o}var Oa={parse:Zi,make:Pa};function uo(s){let o=new Fe.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:s.length}]),u="",d=12+s.length*4;for(let f=0;f<s.length;++f){let m=u.indexOf(s[f]);m<0&&(m=u.length,u+=s[f]),o.fields.push({name:"offset "+f,type:"USHORT",value:d+m}),o.fields.push({name:"length "+f,type:"USHORT",value:s[f].length})}return o.fields.push({name:"stringPool",type:"CHARARRAY",value:u}),o}function ml(s,o){let u=new st.Parser(s,o),d=u.parseULong();ge.argument(d===1,"Unsupported ltag table version."),u.skip("uLong",1);let f=u.parseULong(),m=[];for(let v=0;v<f;v++){let T="",_=o+u.parseUShort(),R=u.parseUShort();for(let N=_;N<_+R;++N)T+=String.fromCharCode(s.getInt8(N));m.push(T)}return m}var Ko={make:uo,parse:ml};function Io(s,o){let u={},d=new st.Parser(s,o);return u.version=d.parseVersion(),u.numGlyphs=d.parseUShort(),u.version===1&&(u.maxPoints=d.parseUShort(),u.maxContours=d.parseUShort(),u.maxCompositePoints=d.parseUShort(),u.maxCompositeContours=d.parseUShort(),u.maxZones=d.parseUShort(),u.maxTwilightPoints=d.parseUShort(),u.maxStorage=d.parseUShort(),u.maxFunctionDefs=d.parseUShort(),u.maxInstructionDefs=d.parseUShort(),u.maxStackElements=d.parseUShort(),u.maxSizeOfInstructions=d.parseUShort(),u.maxComponentElements=d.parseUShort(),u.maxComponentDepth=d.parseUShort()),u}function Fs(s){return new Fe.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:s}])}var Eo={parse:Io,make:Fs},ga=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function xa(s){for(let o=0;o<ga.length;o+=1){let u=ga[o];if(s>=u.begin&&s<u.end)return o}return-1}function ba(s,o){let u={},d=new st.Parser(s,o);u.version=d.parseUShort(),u.xAvgCharWidth=d.parseShort(),u.usWeightClass=d.parseUShort(),u.usWidthClass=d.parseUShort(),u.fsType=d.parseUShort(),u.ySubscriptXSize=d.parseShort(),u.ySubscriptYSize=d.parseShort(),u.ySubscriptXOffset=d.parseShort(),u.ySubscriptYOffset=d.parseShort(),u.ySuperscriptXSize=d.parseShort(),u.ySuperscriptYSize=d.parseShort(),u.ySuperscriptXOffset=d.parseShort(),u.ySuperscriptYOffset=d.parseShort(),u.yStrikeoutSize=d.parseShort(),u.yStrikeoutPosition=d.parseShort(),u.sFamilyClass=d.parseShort(),u.panose=[];for(let f=0;f<10;f++)u.panose[f]=d.parseByte();return u.ulUnicodeRange1=d.parseULong(),u.ulUnicodeRange2=d.parseULong(),u.ulUnicodeRange3=d.parseULong(),u.ulUnicodeRange4=d.parseULong(),u.achVendID=String.fromCharCode(d.parseByte(),d.parseByte(),d.parseByte(),d.parseByte()),u.fsSelection=d.parseUShort(),u.usFirstCharIndex=d.parseUShort(),u.usLastCharIndex=d.parseUShort(),u.sTypoAscender=d.parseShort(),u.sTypoDescender=d.parseShort(),u.sTypoLineGap=d.parseShort(),u.usWinAscent=d.parseUShort(),u.usWinDescent=d.parseUShort(),u.version>=1&&(u.ulCodePageRange1=d.parseULong(),u.ulCodePageRange2=d.parseULong()),u.version>=2&&(u.sxHeight=d.parseShort(),u.sCapHeight=d.parseShort(),u.usDefaultChar=d.parseUShort(),u.usBreakChar=d.parseUShort(),u.usMaxContent=d.parseUShort()),u}function ps(s){return new Fe.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],s)}var Li={parse:ba,make:ps,unicodeRanges:ga,getUnicodeRange:xa};function ho(s,o){let u={},d=new st.Parser(s,o);switch(u.version=d.parseVersion(),u.italicAngle=d.parseFixed(),u.underlinePosition=d.parseShort(),u.underlineThickness=d.parseShort(),u.isFixedPitch=d.parseULong(),u.minMemType42=d.parseULong(),u.maxMemType42=d.parseULong(),u.minMemType1=d.parseULong(),u.maxMemType1=d.parseULong(),u.version){case 1:u.names=In.slice();break;case 2:u.numberOfGlyphs=d.parseUShort(),u.glyphNameIndex=new Array(u.numberOfGlyphs);for(let f=0;f<u.numberOfGlyphs;f++)u.glyphNameIndex[f]=d.parseUShort();u.names=[];for(let f=0;f<u.numberOfGlyphs;f++)if(u.glyphNameIndex[f]>=In.length){let m=d.parseChar();u.names.push(d.parseString(m))}break;case 2.5:u.numberOfGlyphs=d.parseUShort(),u.offset=new Array(u.numberOfGlyphs);for(let f=0;f<u.numberOfGlyphs;f++)u.offset[f]=d.parseChar();break}return u}function fo(s){let{italicAngle:o=Math.round((s.italicAngle||0)*65536),underlinePosition:u=0,underlineThickness:d=0,isFixedPitch:f=0,minMemType42:m=0,maxMemType42:v=0,minMemType1:T=0,maxMemType1:_=0}=s.tables.post||{};return new Fe.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:o},{name:"underlinePosition",type:"FWORD",value:u},{name:"underlineThickness",type:"FWORD",value:d},{name:"isFixedPitch",type:"ULONG",value:f},{name:"minMemType42",type:"ULONG",value:m},{name:"maxMemType42",type:"ULONG",value:v},{name:"minMemType1",type:"ULONG",value:T},{name:"maxMemType1",type:"ULONG",value:_}])}var po={parse:ho,make:fo},$s=new Array(9);$s[1]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(ue.coverage),deltaGlyphId:this.parseShort()};if(o===2)return{substFormat:2,coverage:this.parsePointer(ue.coverage),substitute:this.parseOffset16List()};ge.assert(!1,"0x"+s.toString(16)+": lookup type 1 format must be 1 or 2.")},$s[2]=function(){let s=this.parseUShort();return ge.argument(s===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:s,coverage:this.parsePointer(ue.coverage),sequences:this.parseListOfLists()}},$s[3]=function(){let s=this.parseUShort();return ge.argument(s===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:s,coverage:this.parsePointer(ue.coverage),alternateSets:this.parseListOfLists()}},$s[4]=function(){let s=this.parseUShort();return ge.argument(s===1,"GSUB ligature table identifier-format must be 1"),{substFormat:s,coverage:this.parsePointer(ue.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var Us={sequenceIndex:ue.uShort,lookupListIndex:ue.uShort};$s[5]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:o,coverage:this.parsePointer(ue.coverage),ruleSets:this.parseListOfLists(function(){let u=this.parseUShort(),d=this.parseUShort();return{input:this.parseUShortList(u-1),lookupRecords:this.parseRecordList(d,Us)}})};if(o===2)return{substFormat:o,coverage:this.parsePointer(ue.coverage),classDef:this.parsePointer(ue.classDef),classSets:this.parseListOfLists(function(){let u=this.parseUShort(),d=this.parseUShort();return{classes:this.parseUShortList(u-1),lookupRecords:this.parseRecordList(d,Us)}})};if(o===3){let u=this.parseUShort(),d=this.parseUShort();return{substFormat:o,coverages:this.parseList(u,ue.pointer(ue.coverage)),lookupRecords:this.parseRecordList(d,Us)}}ge.assert(!1,"0x"+s.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},$s[6]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(ue.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Us)}})};if(o===2)return{substFormat:2,coverage:this.parsePointer(ue.coverage),backtrackClassDef:this.parsePointer(ue.classDef),inputClassDef:this.parsePointer(ue.classDef),lookaheadClassDef:this.parsePointer(ue.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Us)}})};if(o===3)return{substFormat:3,backtrackCoverage:this.parseList(ue.pointer(ue.coverage)),inputCoverage:this.parseList(ue.pointer(ue.coverage)),lookaheadCoverage:this.parseList(ue.pointer(ue.coverage)),lookupRecords:this.parseRecordList(Us)};ge.assert(!1,"0x"+s.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},$s[7]=function(){let s=this.parseUShort();ge.argument(s===1,"GSUB Extension Substitution subtable identifier-format must be 1");let o=this.parseUShort(),u=new ue(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:o,extension:$s[o].call(u)}},$s[8]=function(){let s=this.parseUShort();return ge.argument(s===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:s,coverage:this.parsePointer(ue.coverage),backtrackCoverage:this.parseList(ue.pointer(ue.coverage)),lookaheadCoverage:this.parseList(ue.pointer(ue.coverage)),substitutes:this.parseUShortList()}};function No(s,o){o=o||0;let u=new ue(s,o),d=u.parseVersion(1);return ge.argument(d===1||d===1.1,"Unsupported GSUB table version."),d===1?{version:d,scripts:u.parseScriptList(),features:u.parseFeatureList(),lookups:u.parseLookupList($s)}:{version:d,scripts:u.parseScriptList(),features:u.parseFeatureList(),lookups:u.parseLookupList($s),variations:u.parseFeatureVariationsList()}}var Yn=new Array(9);Yn[1]=function(s){if(s.substFormat===1)return new Fe.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Fe.Coverage(s.coverage)},{name:"deltaGlyphID",type:"SHORT",value:s.deltaGlyphId}]);if(s.substFormat===2)return new Fe.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new Fe.Coverage(s.coverage)}].concat(Fe.ushortList("substitute",s.substitute)));ge.fail("Lookup type 1 substFormat must be 1 or 2.")},Yn[2]=function(s){return ge.assert(s.substFormat===1,"Lookup type 2 substFormat must be 1."),new Fe.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Fe.Coverage(s.coverage)}].concat(Fe.tableList("seqSet",s.sequences,function(o){return new Fe.Table("sequenceSetTable",Fe.ushortList("sequence",o))})))},Yn[3]=function(s){return ge.assert(s.substFormat===1,"Lookup type 3 substFormat must be 1."),new Fe.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Fe.Coverage(s.coverage)}].concat(Fe.tableList("altSet",s.alternateSets,function(o){return new Fe.Table("alternateSetTable",Fe.ushortList("alternate",o))})))},Yn[4]=function(s){return ge.assert(s.substFormat===1,"Lookup type 4 substFormat must be 1."),new Fe.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Fe.Coverage(s.coverage)}].concat(Fe.tableList("ligSet",s.ligatureSets,function(o){return new Fe.Table("ligatureSetTable",Fe.tableList("ligature",o,function(u){return new Fe.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:u.ligGlyph}].concat(Fe.ushortList("component",u.components,u.components.length+1)))}))})))},Yn[5]=function(s){if(s.substFormat===1)return new Fe.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:s.substFormat},{name:"coverage",type:"TABLE",value:new Fe.Coverage(s.coverage)}].concat(Fe.tableList("sequenceRuleSet",s.ruleSets,function(o){return o?new Fe.Table("sequenceRuleSetTable",Fe.tableList("sequenceRule",o,function(u){let d=Fe.ushortList("seqLookup",[],u.lookupRecords.length).concat(Fe.ushortList("inputSequence",u.input,u.input.length+1));[d[0],d[1]]=[d[1],d[0]];for(let f=0;f<u.lookupRecords.length;f++){let m=u.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new Fe.Table("sequenceRuleTable",d)})):new Fe.Table("NULL",null)})));if(s.substFormat===2)return new Fe.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:s.substFormat},{name:"coverage",type:"TABLE",value:new Fe.Coverage(s.coverage)},{name:"classDef",type:"TABLE",value:new Fe.ClassDef(s.classDef)}].concat(Fe.tableList("classSeqRuleSet",s.classSets,function(o){return o?new Fe.Table("classSeqRuleSetTable",Fe.tableList("classSeqRule",o,function(u){let d=Fe.ushortList("classes",u.classes,u.classes.length+1).concat(Fe.ushortList("seqLookupCount",[],u.lookupRecords.length));for(let f=0;f<u.lookupRecords.length;f++){let m=u.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new Fe.Table("classSeqRuleTable",d)})):new Fe.Table("NULL",null)})));if(s.substFormat===3){let o=[{name:"substFormat",type:"USHORT",value:s.substFormat}];o.push({name:"inputGlyphCount",type:"USHORT",value:s.coverages.length}),o.push({name:"substitutionCount",type:"USHORT",value:s.lookupRecords.length});for(let u=0;u<s.coverages.length;u++){let d=s.coverages[u];o.push({name:"inputCoverage"+u,type:"TABLE",value:new Fe.Coverage(d)})}for(let u=0;u<s.lookupRecords.length;u++){let d=s.lookupRecords[u];o=o.concat({name:"sequenceIndex"+u,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+u,type:"USHORT",value:d.lookupListIndex})}return new Fe.Table("contextualSubstitutionTable",o)}ge.assert(!1,"lookup type 5 format must be 1, 2 or 3.")},Yn[6]=function(s){if(s.substFormat===1)return new Fe.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:s.substFormat},{name:"coverage",type:"TABLE",value:new Fe.Coverage(s.coverage)}].concat(Fe.tableList("chainRuleSet",s.chainRuleSets,function(o){return new Fe.Table("chainRuleSetTable",Fe.tableList("chainRule",o,function(u){let d=Fe.ushortList("backtrackGlyph",u.backtrack,u.backtrack.length).concat(Fe.ushortList("inputGlyph",u.input,u.input.length+1)).concat(Fe.ushortList("lookaheadGlyph",u.lookahead,u.lookahead.length)).concat(Fe.ushortList("substitution",[],u.lookupRecords.length));for(let f=0;f<u.lookupRecords.length;f++){let m=u.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new Fe.Table("chainRuleTable",d)}))})));if(s.substFormat===2)ge.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(s.substFormat===3){let o=[{name:"substFormat",type:"USHORT",value:s.substFormat}];o.push({name:"backtrackGlyphCount",type:"USHORT",value:s.backtrackCoverage.length});for(let u=0;u<s.backtrackCoverage.length;u++){let d=s.backtrackCoverage[u];o.push({name:"backtrackCoverage"+u,type:"TABLE",value:new Fe.Coverage(d)})}o.push({name:"inputGlyphCount",type:"USHORT",value:s.inputCoverage.length});for(let u=0;u<s.inputCoverage.length;u++){let d=s.inputCoverage[u];o.push({name:"inputCoverage"+u,type:"TABLE",value:new Fe.Coverage(d)})}o.push({name:"lookaheadGlyphCount",type:"USHORT",value:s.lookaheadCoverage.length});for(let u=0;u<s.lookaheadCoverage.length;u++){let d=s.lookaheadCoverage[u];o.push({name:"lookaheadCoverage"+u,type:"TABLE",value:new Fe.Coverage(d)})}o.push({name:"substitutionCount",type:"USHORT",value:s.lookupRecords.length});for(let u=0;u<s.lookupRecords.length;u++){let d=s.lookupRecords[u];o=o.concat({name:"sequenceIndex"+u,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+u,type:"USHORT",value:d.lookupListIndex})}return new Fe.Table("chainContextTable",o)}ge.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function is(s){return new Fe.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Fe.ScriptList(s.scripts)},{name:"features",type:"TABLE",value:new Fe.FeatureList(s.features)},{name:"lookups",type:"TABLE",value:new Fe.LookupList(s.lookups,Yn)}])}var ui={parse:No,make:is};function Di(s,o){let u=new st.Parser(s,o),d=u.parseULong();ge.argument(d===1,"Unsupported META table version."),u.parseULong(),u.parseULong();let f=u.parseULong(),m={};for(let v=0;v<f;v++){let T=u.parseTag(),_=u.parseULong(),R=u.parseULong();if(T==="appl"||T==="bild")continue;let N=ut.UTF8(s,o+_,R);m[T]=N}return m}function Bi(s){let o=Object.keys(s).length,u="",d=16+o*12,f=new Fe.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:d},{name:"numTags",type:"ULONG",value:o}]);for(let m in s){let v=u.length;u+=s[m],f.fields.push({name:"tag "+m,type:"TAG",value:m}),f.fields.push({name:"offset "+m,type:"ULONG",value:d+v}),f.fields.push({name:"length "+m,type:"ULONG",value:s[m].length})}return f.fields.push({name:"stringPool",type:"CHARARRAY",value:u}),f}var zs={parse:Di,make:Bi};function mo(s,o){let u=new ue(s,o),d=u.parseUShort();d!==0&&console.warn("Only COLRv0 is currently fully supported. A subset of color glyphs might be available in this font if provided in the v0 format.");let f=u.parseUShort(),m=u.parseOffset32(),v=u.parseOffset32(),T=u.parseUShort();u.relativeOffset=m;let _=u.parseRecordList(f,{glyphID:ue.uShort,firstLayerIndex:ue.uShort,numLayers:ue.uShort});u.relativeOffset=v;let R=u.parseRecordList(T,{glyphID:ue.uShort,paletteIndex:ue.uShort});return{version:d,baseGlyphRecords:_,layerRecords:R}}function Hs({version:s=0,baseGlyphRecords:o=[],layerRecords:u=[]}){ge.argument(s===0,"Only COLRv0 supported.");let d=14,f=d+o.length*6;return new Fe.Table("COLR",[{name:"version",type:"USHORT",value:s},{name:"numBaseGlyphRecords",type:"USHORT",value:o.length},{name:"baseGlyphRecordsOffset",type:"ULONG",value:d},{name:"layerRecordsOffset",type:"ULONG",value:f},{name:"numLayerRecords",type:"USHORT",value:u.length},...o.map((m,v)=>[{name:"glyphID_"+v,type:"USHORT",value:m.glyphID},{name:"firstLayerIndex_"+v,type:"USHORT",value:m.firstLayerIndex},{name:"numLayers_"+v,type:"USHORT",value:m.numLayers}]).flat(),...u.map((m,v)=>[{name:"LayerGlyphID_"+v,type:"USHORT",value:m.glyphID},{name:"paletteIndex_"+v,type:"USHORT",value:m.paletteIndex}]).flat()])}var di={parse:mo,make:Hs};function Kr(s,o){return[{name:"tag_"+s,type:"TAG",value:o.tag},{name:"minValue_"+s,type:"FIXED",value:o.minValue<<16},{name:"defaultValue_"+s,type:"FIXED",value:o.defaultValue<<16},{name:"maxValue_"+s,type:"FIXED",value:o.maxValue<<16},{name:"flags_"+s,type:"USHORT",value:0},{name:"nameID_"+s,type:"USHORT",value:o.axisNameID}]}function ya(s,o,u){let d={},f=new st.Parser(s,o);d.tag=f.parseTag(),d.minValue=f.parseFixed(),d.defaultValue=f.parseFixed(),d.maxValue=f.parseFixed(),f.skip("uShort",1);let m=f.parseUShort();return d.axisNameID=m,d.name=Tn(u,m),d}function Ws(s,o,u,d={}){let f=[{name:"nameID_"+s,type:"USHORT",value:o.subfamilyNameID},{name:"flags_"+s,type:"USHORT",value:0}];for(let m=0;m<u.length;++m){let v=u[m].tag;f.push({name:"axis_"+s+" "+v,type:"FIXED",value:o.coordinates[v]<<16})}return d&&d.postScriptNameID&&f.push({name:"postScriptNameID_",type:"USHORT",value:o.postScriptNameID!==void 0?o.postScriptNameID:65535}),f}function Ki(s,o,u,d,f){let m={},v=new st.Parser(s,o),T=v.parseUShort();m.subfamilyNameID=T,m.name=Tn(d,T,[2,17]),v.skip("uShort",1),m.coordinates={};for(let R=0;R<u.length;++R)m.coordinates[u[R].tag]=v.parseFixed();if(v.relativeOffset===f)return m.postScriptNameID=void 0,m.postScriptName=void 0,m;let _=v.parseUShort();return m.postScriptNameID=_==65535?void 0:_,m.postScriptName=m.postScriptNameID!==void 0?Tn(d,_,[6]):"",m}function va(s,o){let u=new Fe.Table("fvar",[{name:"version",type:"ULONG",value:65536},{name:"offsetToData",type:"USHORT",value:0},{name:"countSizePairs",type:"USHORT",value:2},{name:"axisCount",type:"USHORT",value:s.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:s.instances.length},{name:"instanceSize",type:"USHORT",value:4+s.axes.length*4}]);u.offsetToData=u.sizeOf();for(let f=0;f<s.axes.length;f++)u.fields=u.fields.concat(Kr(f,s.axes[f],o));let d={};for(let f=0;f<s.instances.length;f++)if(s.instances[f].postScriptNameID!==void 0){u.instanceSize+=2,d.postScriptNameID=!0;break}for(let f=0;f<s.instances.length;f++)u.fields=u.fields.concat(Ws(f,s.instances[f],s.axes,d));return u}function wa(s,o,u){let d=new st.Parser(s,o),f=d.parseULong();ge.argument(f===65536,"Unsupported fvar table version.");let m=d.parseOffset16();d.skip("uShort",1);let v=d.parseUShort(),T=d.parseUShort(),_=d.parseUShort(),R=d.parseUShort(),N=[];for(let he=0;he<v;he++)N.push(ya(s,o+m+he*T,u));let G=[],W=o+m+v*T;for(let he=0;he<_;he++)G.push(Ki(s,W+he*R,N,u,R));return{axes:N,instances:G}}var hi={make:va,parse:wa},Xi={tag:ue.tag,nameID:ue.uShort,ordering:ue.uShort},Cs=new Array(5);Cs[1]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed()}},Cs[2]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),nominalValue:this.parseFixed(),rangeMinValue:this.parseFixed(),rangeMaxValue:this.parseFixed()}},Cs[3]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed(),linkedValue:this.parseFixed()}},Cs[4]=function(){let s=this.parseUShort();return{flags:this.parseUShort(),valueNameID:this.parseUShort(),axisValues:this.parseList(s,function(){return{axisIndex:this.parseUShort(),value:this.parseFixed()}})}};function Aa(){let s=this.parseUShort(),o=Cs[s],u={format:s};return o===void 0?(console.warn(`Unknown axis value table format ${s}`),u):Object.assign(u,this.parseStruct(o.bind(this)))}function Fa(s,o,u){o||(o=0);let d=new st.Parser(s,o),f=d.parseUShort(),m=d.parseUShort();f!==1&&console.warn(`Unsupported STAT table version ${f}.${m}`);let v=[f,m],T=d.parseUShort(),_=d.parseUShort(),R=d.parseOffset32(),N=d.parseUShort(),G=d.parseOffset32(),W=f>1||m>0?d.parseUShort():void 0;u!==void 0&&ge.argument(_>=u.axes.length,"STAT axis count must be greater than or equal to fvar axis count"),N>0&&ge.argument(_>=0,"STAT axis count must be greater than 0 if STAT axis value count is greater than 0");let he=[];for(let Je=0;Je<_;Je++)d.offset=o+R,d.relativeOffset=Je*T,he.push(d.parseStruct(Xi));d.offset=o,d.relativeOffset=G;let ie=d.parseUShortList(N),ye=[];for(let Je=0;Je<N;Je++)d.offset=o+G,d.relativeOffset=ie[Je],ye.push(Aa.apply(d));return{version:v,axes:he,values:ye,elidedFallbackNameID:W}}var Jn=new Array(5);Jn[1]=function(s,o){return[{name:`format${s}`,type:"USHORT",value:1},{name:`axisIndex${s}`,type:"USHORT",value:o.axisIndex},{name:`flags${s}`,type:"USHORT",value:o.flags},{name:`valueNameID${s}`,type:"USHORT",value:o.valueNameID},{name:`value${s}`,type:"FLOAT",value:o.value}]},Jn[2]=function(s,o){return[{name:`format${s}`,type:"USHORT",value:2},{name:`axisIndex${s}`,type:"USHORT",value:o.axisIndex},{name:`flags${s}`,type:"USHORT",value:o.flags},{name:`valueNameID${s}`,type:"USHORT",value:o.valueNameID},{name:`nominalValue${s}`,type:"FLOAT",value:o.nominalValue},{name:`rangeMinValue${s}`,type:"FLOAT",value:o.rangeMinValue},{name:`rangeMaxValue${s}`,type:"FLOAT",value:o.rangeMaxValue}]},Jn[3]=function(s,o){return[{name:`format${s}`,type:"USHORT",value:3},{name:`axisIndex${s}`,type:"USHORT",value:o.axisIndex},{name:`flags${s}`,type:"USHORT",value:o.flags},{name:`valueNameID${s}`,type:"USHORT",value:o.valueNameID},{name:`value${s}`,type:"FLOAT",value:o.value},{name:`linkedValue${s}`,type:"FLOAT",value:o.linkedValue}]},Jn[4]=function(s,o){let u=[{name:`format${s}`,type:"USHORT",value:4},{name:`axisCount${s}`,type:"USHORT",value:o.axisValues.length},{name:`flags${s}`,type:"USHORT",value:o.flags},{name:`valueNameID${s}`,type:"USHORT",value:o.valueNameID}];for(let d=0;d<o.axisValues.length;d++)u=u.concat([{name:`format${s}axisIndex${d}`,type:"USHORT",value:o.axisValues[d].axisIndex},{name:`format${s}value${d}`,type:"FLOAT",value:o.axisValues[d].value}]);return u};function ms(s,o){return new Fe.Record("axisRecord_"+s,[{name:"axisTag_"+s,type:"TAG",value:o.tag},{name:"axisNameID_"+s,type:"USHORT",value:o.nameID},{name:"axisOrdering_"+s,type:"USHORT",value:o.ordering}])}function Ta(s,o){let u=o.format,d=Jn[u];ge.argument(d!==void 0,`Unknown axis value table format ${u}`);let f=d(s,o);return new Fe.Table("axisValueTable_"+s,f)}function Xo(s){let o=new Fe.Table("STAT",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:2},{name:"designAxisSize",type:"USHORT",value:8},{name:"designAxisCount",type:"USHORT",value:s.axes.length},{name:"designAxesOffset",type:"ULONG",value:0},{name:"axisValueCount",type:"USHORT",value:s.values.length},{name:"offsetToAxisValueOffsets",type:"ULONG",value:0},{name:"elidedFallbackNameID",type:"USHORT",value:s.elidedFallbackNameID}]);o.designAxesOffset=o.offsetToAxisValueOffsets=o.sizeOf();for(let m=0;m<s.axes.length;m++){let v=ms(m,s.axes[m]);o.offsetToAxisValueOffsets+=v.sizeOf(),o.fields=o.fields.concat(v.fields)}let u=[],d=[],f=s.values.length*2;for(let m=0;m<s.values.length;m++){let v=Ta(m,s.values[m]);u.push({name:"offset_"+m,type:"USHORT",value:f}),f+=v.sizeOf(),d=d.concat(v.fields)}return o.fields=o.fields.concat(u),o.fields=o.fields.concat(d),o}var Qi={make:Xo,parse:Fa};function go(s,o){return new Fe.Record("axisValueMap_"+s,[{name:"fromCoordinate_"+s,type:"F2DOT14",value:o.fromCoordinate},{name:"toCoordinate_"+s,type:"F2DOT14",value:o.toCoordinate}])}function $a(s,o){let u=new Fe.Record("segmentMap_"+s,[{name:"positionMapCount_"+s,type:"USHORT",value:o.axisValueMaps.length}]),d=[];for(let f=0;f<o.axisValueMaps.length;f++){let m=go(`${s}_${f}`,o.axisValueMaps[f]);d=d.concat(m.fields)}return u.fields=u.fields.concat(d),u}function Jo(s,o){ge.argument(s.axisSegmentMaps.length===o.axes.length,"avar axis count must correspond to fvar axis count");let u=new Fe.Table("avar",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:0},{name:"reserved",type:"USHORT",value:0},{name:"axisCount",type:"USHORT",value:s.axisSegmentMaps.length}]);for(let d=0;d<s.axisSegmentMaps.length;d++){let f=$a(d,s.axisSegmentMaps[d]);u.fields=u.fields.concat(f.fields)}return u}function Ua(s,o,u){o||(o=0);let d=new ue(s,o),f=d.parseUShort(),m=d.parseUShort();f!==1&&console.warn(`Unsupported avar table version ${f}.${m}`),d.skip("uShort",1);let v=d.parseUShort();ge.argument(v===u.axes.length,"avar axis count must correspond to fvar axis count");let T=[];for(let _=0;_<v;_++){let R=[],N=d.parseUShort();for(let G=0;G<N;G++){let W=d.parseF2Dot14(),he=d.parseF2Dot14();R.push({fromCoordinate:W,toCoordinate:he})}T.push({axisValueMaps:R})}return{version:[f,m],axisSegmentMaps:T}}var Ca={make:Jo,parse:Ua};function J(s,o,u,d){let f=new st.Parser(s,o),m=f.parseTupleVariationStore(f.relativeOffset,u.axes.length,"cvar",d),v=f.parseUShort(),T=f.parseUShort();return v!==1&&console.warn(`Unsupported cvar table version ${v}.${T}`),{version:[v,T],...m}}function Qe(){console.warn("Writing of cvar tables is not yet supported.")}var mt={make:Qe,parse:J};function gt(s,o,u,d){let f=new st.Parser(s,o),m=f.parseUShort(),v=f.parseUShort();m!==1&&console.warn(`Unsupported gvar table version ${m}.${v}`);let T=f.parseUShort();T!==u.axes.length&&console.warn(`axisCount ${T} in gvar table does not match the number of axes ${u.axes.length} in the fvar table!`);let _=f.parseUShort(),R=f.parsePointer32(function(){return this.parseTupleRecords(_,T)}),N=f.parseTupleVariationStoreList(T,"gvar",d);return{version:[m,v],sharedTuples:R,glyphVariations:N}}function De(){console.warn("Writing of gvar tables is not yet supported.")}var yt={make:De,parse:gt};function pr(s,o){let u={},d=new st.Parser(s,o);u.version=d.parseUShort(),ge.argument(u.version<=1,"Unsupported gasp table version."),u.numRanges=d.parseUShort(),u.gaspRanges=[];for(let f=0;f<u.numRanges;f++)u.gaspRanges[f]={rangeMaxPPEM:d.parseUShort(),rangeGaspBehavior:d.parseUShort()};return u}function Qr(s){let o=new Fe.Table("gasp",[{name:"version",type:"USHORT",value:1},{name:"numRanges",type:"USHORT",value:s.numRanges}]);for(let u in s.gaspRanges)o.fields.push({name:"rangeMaxPPEM",type:"USHORT",value:s.gaspRanges[u].rangeMaxPPEM}),o.fields.push({name:"rangeGaspBehavior",type:"USHORT",value:s.gaspRanges[u].rangeGaspBehavior});return o}var L={parse:pr,make:Qr};function B(s,o){let u=new Map,d=s.buffer,f=new ue(s,o);if(f.parseUShort()!==0)return u;f.relativeOffset=f.parseOffset32();let m=s.byteOffset+o+f.relativeOffset,v=f.parseUShort(),T=new Map;for(let _=0;_<v;_++){let R=f.parseUShort(),N=f.parseUShort(),G=m+f.parseOffset32(),W=f.parseULong(),he=T.get(G);he===void 0&&(he=new Uint8Array(d,G,W),T.set(G,he));for(let ie=R;ie<=N;ie++)u.set(ie,he)}return u}function O(s){let o=Array.from(s.keys()).sort(),u=[],d=[],f=new Map,m=0,v={endGlyphID:null};for(let W=0,he=o.length;W<he;W++){let ie=o[W],ye=s.get(ie),Je=f.get(ye);Je===void 0&&(Je=m,d.push(ye),f.set(ye,Je),m+=ye.byteLength),ie-1===v.endGlyphID&&Je===v.svgDocOffset?v.endGlyphID=ie:(v={startGlyphID:ie,endGlyphID:ie,svgDocOffset:Je,svgDocLength:ye.byteLength},u.push(v))}let T=u.length,_=d.length,R=2+T*12,N=new Array(4+T*4+_),G=0;N[G++]={name:"version",type:"USHORT",value:0},N[G++]={name:"svgDocumentListOffset",type:"ULONG",value:10},N[G++]={name:"reserved",type:"ULONG",value:0},N[G++]={name:"numEntries",type:"USHORT",value:T};for(let W=0;W<T;W++){let he="documentRecord_"+W,{startGlyphID:ie,endGlyphID:ye,svgDocOffset:Je,svgDocLength:gr}=u[W];N[G++]={name:he+"_startGlyphID",type:"USHORT",value:ie},N[G++]={name:he+"_endGlyphID",type:"USHORT",value:ye},N[G++]={name:he+"_svgDocOffset",type:"ULONG",value:R+Je},N[G++]={name:he+"_svgDocLength",type:"ULONG",value:gr}}for(let W=0;W<_;W++)N[G++]={name:"svgDoc_"+W,type:"LITERAL",value:d[W]};return new Fe.Table("SVG ",N)}var z={make:O,parse:B};function Ne(s){return Math.log(s)/Math.log(2)|0}function Te(s){for(;s.length%4!==0;)s.push(0);let o=0;for(let u=0;u<s.length;u+=4)o+=(s[u]<<24)+(s[u+1]<<16)+(s[u+2]<<8)+s[u+3];return o%=Math.pow(2,32),o}function Xe(s,o,u,d){return new Fe.Record("Table Record",[{name:"tag",type:"TAG",value:s!==void 0?s:""},{name:"checkSum",type:"ULONG",value:o!==void 0?o:0},{name:"offset",type:"ULONG",value:u!==void 0?u:0},{name:"length",type:"ULONG",value:d!==void 0?d:0}])}function nt(s){let o=new Fe.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);o.tables=s,o.numTables=s.length;let u=Math.pow(2,Ne(o.numTables));o.searchRange=16*u,o.entrySelector=Ne(u),o.rangeShift=o.numTables*16-o.searchRange;let d=[],f=[],m=o.sizeOf()+Xe().sizeOf()*o.numTables;for(;m%4!==0;)m+=1,f.push({name:"padding",type:"BYTE",value:0});for(let v=0;v<s.length;v+=1){let T=s[v];ge.argument(T.tableName.length===4,"Table name"+T.tableName+" is invalid.");let _=T.sizeOf(),R=Xe(T.tableName,Te(T.encode()),m,_);for(d.push({name:R.tag+" Table Record",type:"RECORD",value:R}),f.push({name:T.tableName+" table",type:"RECORD",value:T}),m+=_,ge.argument(!isNaN(m),"Something went wrong calculating the offset.");m%4!==0;)m+=1,f.push({name:"padding",type:"BYTE",value:0})}return d.sort(function(v,T){return v.value.tag>T.value.tag?1:-1}),o.fields=o.fields.concat(d),o.fields=o.fields.concat(f),o}function $t(s,o,u){for(let d=0;d<o.length;d+=1){let f=s.charToGlyphIndex(o[d]);if(f>0)return s.glyphs.get(f).getMetrics()}return u}function mr(s){let o=0;for(let u=0;u<s.length;u+=1)o+=s[u];return o/s.length}function en(s){let o=[],u=[],d=[],f=[],m=[],v=[],T=[],_,R=0,N=0,G=0,W=0,he=0;for(let Zn=0;Zn<s.glyphs.length;Zn+=1){let ra=s.glyphs.get(Zn),Va=ra.unicode|0;if(isNaN(ra.advanceWidth))throw new Error("Glyph "+ra.name+" ("+Zn+"): advanceWidth is not a number.");(_>Va||_===void 0)&&Va>0&&(_=Va),R<Va&&(R=Va);let wo=Li.getUnicodeRange(Va);if(wo<32)N|=1<<wo;else if(wo<64)G|=1<<wo-32;else if(wo<96)W|=1<<wo-64;else if(wo<123)he|=1<<wo-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(ra.name===".notdef")continue;let rl=ra.getMetrics();o.push(rl.xMin),u.push(rl.yMin),d.push(rl.xMax),f.push(rl.yMax),v.push(rl.leftSideBearing),T.push(rl.rightSideBearing),m.push(ra.advanceWidth)}let ie={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,u),xMax:Math.max.apply(null,d),yMax:Math.max.apply(null,f),advanceWidthMax:Math.max.apply(null,m),advanceWidthAvg:mr(m),minLeftSideBearing:Math.min.apply(null,v),maxLeftSideBearing:Math.max.apply(null,v),minRightSideBearing:Math.min.apply(null,T)};ie.ascender=s.ascender,ie.descender=s.descender;let ye=0;s.weightClass>=600&&(ye|=s.macStyleValues.BOLD),s.italicAngle<0&&(ye|=s.macStyleValues.ITALIC);let Je=us.make({flags:3,unitsPerEm:s.unitsPerEm,xMin:ie.xMin,yMin:ie.yMin,xMax:ie.xMax,yMax:ie.yMax,lowestRecPPEM:3,macStyle:ye,createdTimestamp:s.createdTimestamp}),gr=Xn.make({ascender:ie.ascender,descender:ie.descender,advanceWidthMax:ie.advanceWidthMax,minLeftSideBearing:ie.minLeftSideBearing,minRightSideBearing:ie.minRightSideBearing,xMaxExtent:ie.maxLeftSideBearing+(ie.xMax-ie.xMin),numberOfHMetrics:s.glyphs.length}),or=Eo.make(s.glyphs.length),Cr=Li.make(Object.assign({xAvgCharWidth:Math.round(ie.advanceWidthAvg),usFirstCharIndex:_,usLastCharIndex:R,ulUnicodeRange1:N,ulUnicodeRange2:G,ulUnicodeRange3:W,ulUnicodeRange4:he,sTypoAscender:ie.ascender,sTypoDescender:ie.descender,sTypoLineGap:0,usWinAscent:ie.yMax,usWinDescent:Math.abs(ie.yMin),ulCodePageRange1:1,sxHeight:$t(s,"xyvw",{yMax:Math.round(ie.ascender/2)}).yMax,sCapHeight:$t(s,"HIKLEFJMNTZBDPRAGOQSUVWXY",ie).yMax,usDefaultChar:s.hasChar(" ")?32:0,usBreakChar:s.hasChar(" ")?32:0},s.tables.os2)),Yr=Oa.make(s.glyphs),Dn=Sr.make(s.glyphs),zn=s.getEnglishName("fontFamily"),Hn=s.getEnglishName("fontSubfamily"),Ns=zn+" "+Hn,yo=s.getEnglishName("postScriptName");yo||(yo=zn.replace(/\s/g,"")+"-"+Hn);let Zr={};for(let Zn in s.names)Zr[Zn]=s.names[Zn];Zr.unicode=Zr.unicode||{},Zr.macintosh=Zr.macintosh||{},Zr.windows=Zr.windows||{};let Ia=s.names.unicode||{},Oi=s.names.macintosh||{},xr=s.names.windows||{};for(let Zn in Zr){if(Zr[Zn]=Zr[Zn]||{},!Zr[Zn].uniqueID){let ra=s.getEnglishName("manufacturer")||"";Zr[Zn].uniqueID={en:`${ra}: ${Ns}`}}Zr[Zn].postScriptName||(Zr[Zn].postScriptName={en:yo})}Zr.unicode.preferredFamily||(Zr.unicode.preferredFamily=Ia.fontFamily||Oi.fontFamily||xr.fontFamily),Zr.macintosh.preferredFamily||(Zr.macintosh.preferredFamily=Oi.fontFamily||Ia.fontFamily||xr.fontFamily),Zr.windows.preferredFamily||(Zr.windows.preferredFamily=xr.fontFamily||Ia.fontFamily||Oi.fontFamily),Zr.unicode.preferredSubfamily||(Zr.unicode.preferredSubfamily=Ia.fontSubfamily||Oi.fontSubfamily||xr.fontSubfamily),Zr.macintosh.preferredSubfamily||(Zr.macintosh.preferredSubfamily=Oi.fontSubfamily||Ia.fontSubfamily||xr.fontSubfamily),Zr.windows.preferredSubfamily||(Zr.windows.preferredSubfamily=xr.fontSubfamily||Ia.fontSubfamily||Oi.fontSubfamily);let nr=[],ir=rn.make(Zr,nr),Ei=nr.length>0?Ko.make(nr):void 0,_l=po.make(s),rd=Yi.make(s.glyphs,{version:s.getEnglishName("version"),fullName:Ns,familyName:zn,weightName:Hn,postScriptName:yo,unitsPerEm:s.unitsPerEm,fontBBox:[0,ie.yMin,ie.ascender,ie.advanceWidthMax],topDict:s.tables.cff&&s.tables.cff.topDict||{}}),Gl=s.metas&&Object.keys(s.metas).length>0?zs.make(s.metas):void 0,vo=[Je,gr,or,Cr,ir,Dn,_l,rd,Yr];Ei&&vo.push(Ei);let Fi={gsub:ui,cpal:Vr,colr:di,stat:Qi,avar:Ca,cvar:mt,fvar:hi,gvar:yt,gasp:L,svg:z},Ga={avar:[s.tables.fvar],fvar:[s.names]};for(let Zn in Fi){let ra=s.tables[Zn];if(ra){let Va=Fi[Zn].make.call(s,ra,...Ga[Zn]||[]);Va&&vo.push(Va)}}Gl&&vo.push(Gl);let Ni=nt(vo),Ea=Ni.encode(),$i=Te(Ea),Ui=Ni.fields,Ls=!1;for(let Zn=0;Zn<Ui.length;Zn+=1)if(Ui[Zn].name==="head table"){Ui[Zn].value.checkSumAdjustment=2981146554-$i,Ls=!0;break}if(!Ls)throw new Error("Could not find head table with checkSum to adjust.");return Ni}var Mn={make:nt,fontToTable:en,computeCheckSum:Te};function Sn(s,o){let u=0,d=s.length-1;for(;u<=d;){let f=u+d>>>1,m=s[f].tag;if(m===o)return f;m<o?u=f+1:d=f-1}return-u-1}function Un(s,o){let u=0,d=s.length-1;for(;u<=d;){let f=u+d>>>1,m=s[f];if(m===o)return f;m<o?u=f+1:d=f-1}return-u-1}function Lr(s,o){let u,d=0,f=s.length-1;for(;d<=f;){let m=d+f>>>1;u=s[m];let v=u.start;if(v===o)return u;v<o?d=m+1:f=m-1}if(d>0)return u=s[d-1],o>u.end?0:u}function xn(s,o){this.font=s,this.tableName=o}xn.prototype={searchTag:Sn,binSearch:Un,getTable:function(s){let o=this.font.tables[this.tableName];return!o&&s&&(o=this.font.tables[this.tableName]=this.createDefaultTable()),o},getScriptNames:function(){let s=this.getTable();return s?s.scripts.map(function(o){return o.tag}):[]},getDefaultScriptName:function(){let s=this.getTable();if(!s)return;let o=!1;for(let u=0;u<s.scripts.length;u++){let d=s.scripts[u].tag;if(d==="DFLT")return d;d==="latn"&&(o=!0)}if(o)return"latn"},getScriptTable:function(s,o){let u=this.getTable(o);if(u){s=s||"DFLT";let d=u.scripts,f=Sn(u.scripts,s);if(f>=0)return d[f].script;if(o){let m={tag:s,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return d.splice(-1-f,0,m),m.script}}},getLangSysTable:function(s,o,u){let d=this.getScriptTable(s,u);if(d){if(!o||o==="dflt"||o==="DFLT")return d.defaultLangSys;let f=Sn(d.langSysRecords,o);if(f>=0)return d.langSysRecords[f].langSys;if(u){let m={tag:o,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return d.langSysRecords.splice(-1-f,0,m),m.langSys}}},getFeatureTable:function(s,o,u,d){let f=this.getLangSysTable(s,o,d);if(f){let m,v=f.featureIndexes,T=this.font.tables[this.tableName].features;for(let _=0;_<v.length;_++)if(m=T[v[_]],m.tag===u)return m.feature;if(d){let _=T.length;return ge.assert(_===0||u>=T[_-1].tag,"Features must be added in alphabetical order."),m={tag:u,feature:{params:0,lookupListIndexes:[]}},T.push(m),v.push(_),m.feature}}},getLookupTables:function(s,o,u,d,f){let m=this.getFeatureTable(s,o,u,f),v=[];if(m){let T,_=m.lookupListIndexes,R=this.font.tables[this.tableName].lookups;for(let N=0;N<_.length;N++)T=R[_[N]],T.lookupType===d&&v.push(T);if(v.length===0&&f){T={lookupType:d,lookupFlag:0,subtables:[],markFilteringSet:void 0};let N=R.length;return R.push(T),_.push(N),[T]}}return v},getGlyphClass:function(s,o){switch(s.format){case 1:return s.startGlyph<=o&&o<s.startGlyph+s.classes.length?s.classes[o-s.startGlyph]:0;case 2:{let u=Lr(s.ranges,o);return u?u.classId:0}}},getCoverageIndex:function(s,o){switch(s.format){case 1:{let u=Un(s.glyphs,o);return u>=0?u:-1}case 2:{let u=Lr(s.ranges,o);return u?u.index+o-u.start:-1}}},expandCoverage:function(s){if(s.format===1)return s.glyphs;{let o=[],u=s.ranges;for(let d=0;d<u.length;d++){let f=u[d],m=f.start,v=f.end;for(let T=m;T<=v;T++)o.push(T)}return o}}};var vn=xn;function Gs(s){vn.call(this,s,"gpos")}Gs.prototype=vn.prototype,Gs.prototype.init=function(){let s=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(s)},Gs.prototype.getKerningValue=function(s,o,u){for(let d=0;d<s.length;d++){let f=s[d].subtables;for(let m=0;m<f.length;m++){let v=f[m],T=this.getCoverageIndex(v.coverage,o);if(!(T<0))switch(v.posFormat){case 1:{let _=v.pairSets[T];for(let R=0;R<_.length;R++){let N=_[R];if(N.secondGlyph===u)return N.value1&&N.value1.xAdvance||0}break}case 2:{let _=this.getGlyphClass(v.classDef1,o),R=this.getGlyphClass(v.classDef2,u),N=v.classRecords[_][R];return N.value1&&N.value1.xAdvance||0}}}}return 0},Gs.prototype.getKerningTables=function(s,o){if(this.font.tables.gpos)return this.getLookupTables(s,o,"kern",2)};var Sa=Gs;function ds(s,o){let u=s.length;if(u!==o.length)return!1;for(let d=0;d<u;d++)if(s[d]!==o[d])return!1;return!0}function Ul(s,o,u){let d=0,f=s.length-1,m=null;for(;d<=f;){let v=Math.floor((d+f)/2),T=s[v],_=T[o];if(_<u)d=v+1;else if(_>u)f=v-1;else{m=T;break}}return m}function Ss(s,o,u){let d=0,f=s.length-1;for(;d<=f;){let m=Math.floor((d+f)/2),v=s[m];if(v[o]<u)d=m+1;else if(v[o]>u)f=m-1;else return m}return-1}function Ro(s,o,u){let d=0,f=s.length,m=(v,T)=>v[o]-T[o];for(;d<f;){let v=d+f>>>1;m(s[v],u)<0?d=v+1:f=v}return s.splice(d,0,u),d}function gl(s){return s[0]===31&&s[1]===139&&s[2]===8}function bc(s){let o=new DataView(s.buffer,s.byteOffset,s.byteLength),u=10,d=s.byteLength-8,f=o.getInt8(3);if(f&4&&(u+=2+o.getUint16(u,!0)),f&8)for(;u<d&&s[u++]!==0;);if(f&16)for(;u<d&&s[u++]!==0;);if(f&2&&(u+=2),u>=d)throw new Error("Can't find compressed blocks");let m=o.getUint32(o.byteLength-4,!0);return re(s.subarray(u,d),new Uint8Array(m))}function ki(s){return{x:s.x,y:s.y,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour}}function _a(s){return{glyphIndex:s.glyphIndex,xScale:s.xScale,scale01:s.scale01,scale10:s.scale10,yScale:s.yScale,dx:s.dx,dy:s.dy}}function Es(s){vn.call(this,s,"gsub")}function xl(s,o,u){let d=s.subtables;for(let f=0;f<d.length;f++){let m=d[f];if(m.substFormat===o)return m}if(u)return d.push(u),u}Es.prototype=vn.prototype,Es.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Es.prototype.getSingle=function(s,o,u){let d=[],f=this.getLookupTables(o,u,s,1);for(let m=0;m<f.length;m++){let v=f[m].subtables;for(let T=0;T<v.length;T++){let _=v[T],R=this.expandCoverage(_.coverage),N;if(_.substFormat===1){let G=_.deltaGlyphId;for(N=0;N<R.length;N++){let W=R[N];d.push({sub:W,by:W+G})}}else{let G=_.substitute;for(N=0;N<R.length;N++)d.push({sub:R[N],by:G[N]})}}}return d},Es.prototype.getMultiple=function(s,o,u){let d=[],f=this.getLookupTables(o,u,s,2);for(let m=0;m<f.length;m++){let v=f[m].subtables;for(let T=0;T<v.length;T++){let _=v[T],R=this.expandCoverage(_.coverage),N;for(N=0;N<R.length;N++){let G=R[N],W=_.sequences[N];d.push({sub:G,by:W})}}}return d},Es.prototype.getAlternates=function(s,o,u){let d=[],f=this.getLookupTables(o,u,s,3);for(let m=0;m<f.length;m++){let v=f[m].subtables;for(let T=0;T<v.length;T++){let _=v[T],R=this.expandCoverage(_.coverage),N=_.alternateSets;for(let G=0;G<R.length;G++)d.push({sub:R[G],by:N[G]})}}return d},Es.prototype.getLigatures=function(s,o,u){let d=[],f=this.getLookupTables(o,u,s,4);for(let m=0;m<f.length;m++){let v=f[m].subtables;for(let T=0;T<v.length;T++){let _=v[T],R=this.expandCoverage(_.coverage),N=_.ligatureSets;for(let G=0;G<R.length;G++){let W=R[G],he=N[G];for(let ie=0;ie<he.length;ie++){let ye=he[ie];d.push({sub:[W].concat(ye.components),by:ye.ligGlyph})}}}}return d},Es.prototype.addSingle=function(s,o,u,d){let f=this.getLookupTables(u,d,s,1,!0)[0],m=xl(f,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});ge.assert(m.coverage.format===1,"Single: unable to modify coverage table format "+m.coverage.format);let v=o.sub,T=this.binSearch(m.coverage.glyphs,v);T<0&&(T=-1-T,m.coverage.glyphs.splice(T,0,v),m.substitute.splice(T,0,0)),m.substitute[T]=o.by},Es.prototype.addMultiple=function(s,o,u,d){ge.assert(o.by instanceof Array&&o.by.length>1,'Multiple: "by" must be an array of two or more ids');let f=this.getLookupTables(u,d,s,2,!0)[0],m=xl(f,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});ge.assert(m.coverage.format===1,"Multiple: unable to modify coverage table format "+m.coverage.format);let v=o.sub,T=this.binSearch(m.coverage.glyphs,v);T<0&&(T=-1-T,m.coverage.glyphs.splice(T,0,v),m.sequences.splice(T,0,0)),m.sequences[T]=o.by},Es.prototype.addAlternate=function(s,o,u,d){let f=this.getLookupTables(u,d,s,3,!0)[0],m=xl(f,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});ge.assert(m.coverage.format===1,"Alternate: unable to modify coverage table format "+m.coverage.format);let v=o.sub,T=this.binSearch(m.coverage.glyphs,v);T<0&&(T=-1-T,m.coverage.glyphs.splice(T,0,v),m.alternateSets.splice(T,0,0)),m.alternateSets[T]=o.by},Es.prototype.addLigature=function(s,o,u,d){let f=this.getLookupTables(u,d,s,4,!0)[0],m=f.subtables[0];m||(m={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},f.subtables[0]=m),ge.assert(m.coverage.format===1,"Ligature: unable to modify coverage table format "+m.coverage.format);let v=o.sub[0],T=o.sub.slice(1),_={ligGlyph:o.by,components:T},R=this.binSearch(m.coverage.glyphs,v);if(R>=0){let N=m.ligatureSets[R];for(let G=0;G<N.length;G++)if(ds(N[G].components,T))return;N.push(_)}else R=-1-R,m.coverage.glyphs.splice(R,0,v),m.ligatureSets.splice(R,0,[_])},Es.prototype.getFeature=function(s,o,u){if(/ss\d\d/.test(s))return this.getSingle(s,o,u);switch(s){case"aalt":case"salt":return this.getSingle(s,o,u).concat(this.getAlternates(s,o,u));case"dlig":case"liga":case"rlig":return this.getLigatures(s,o,u);case"ccmp":return this.getMultiple(s,o,u).concat(this.getLigatures(s,o,u));case"stch":return this.getMultiple(s,o,u)}},Es.prototype.add=function(s,o,u,d){if(/ss\d\d/.test(s))return this.addSingle(s,o,u,d);switch(s){case"aalt":case"salt":return typeof o.by=="number"?this.addSingle(s,o,u,d):this.addAlternate(s,o,u,d);case"dlig":case"liga":case"rlig":return this.addLigature(s,o,u,d);case"ccmp":return o.by instanceof Array?this.addMultiple(s,o,u,d):this.addLigature(s,o,u,d)}};var Zh=Es,Wu=class{constructor(s){this.defaultValue=255,this.font=s}cpal(){return this.font.tables&&this.font.tables.cpal?this.font.tables.cpal:!1}getAll(s){let o=[],u=this.cpal();if(!u)return o;for(let d=0;d<u.colorRecordIndices.length;d++){let f=u.colorRecordIndices[d],m=[];for(let v=f;v<f+u.numPaletteEntries;v++)m.push(Rr(u.colorRecords[v],s||"hexa"));o.push(m)}return o}toCPALcolor(s){return Array.isArray(s)?s.map(o=>at(o,"raw")):at(s,"raw")}fillPalette(s,o=[],u=this.cpal().numPaletteEntries){return s=Number.isInteger(s)?this.get(s,"raw"):s,Object.assign(Array(u).fill(this.defaultValue),this.toCPALcolor(s).concat(this.toCPALcolor(o)))}extend(s){if(this.ensureCPAL(Array(s).fill(this.defaultValue)))return;let o=this.cpal(),u=o.numPaletteEntries+s,d=this.getAll().map(f=>this.fillPalette(f,[],u));o.numPaletteEntries=u,o.colorRecords=this.toCPALcolor(d.flat()),this.updateIndices()}get(s,o="hexa"){return this.getAll(o)[s]||null}getColor(s,o=0,u="hexa"){return jt(this.font,s,o,u)}setColor(s,o,u=0){s=parseInt(s),u=parseInt(u);let d=this.getAll("raw"),f=d[u];if(!f)throw Error(`paletteIndex ${u} out of range`);let m=this.cpal(),v=m.numPaletteEntries;Array.isArray(o)||(o=[o]),o.length+s>v&&(this.extend(o.length+s-v),d=this.getAll("raw"),f=d[u]);for(let T=0;T<o.length;T++)f[T+s]=this.toCPALcolor(o[T]);m.colorRecords=d.flat(),this.updateIndices()}add(s){if(this.ensureCPAL(s))return;let o=this.cpal(),u=o.numPaletteEntries;s&&s.length?(s=this.toCPALcolor(s),s.length>u?this.extend(s.length-u):s.length<u&&(s=this.fillPalette(s)),o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...s)):(o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...Array(u).fill(this.defaultValue)))}delete(s){let o=this.getAll("raw");delete o[s];let u=this.cpal();u.colorRecordIndices.pop(),u.colorRecords=o.flat()}deleteColor(s,o){if(s===o)throw Error("replacementIndex cannot be the same as colorIndex");let u=this.cpal(),d=this.getAll("raw"),f=[];if(o>u.numPaletteEntries-1)throw Error(`Replacement index out of range: numPaletteEntries after deletion: ${u.numPaletteEntries-1}, replacementIndex: ${o})`);for(let T=0;T<d.length;T++){let _=d[T].filter((R,N)=>N!==s);f.push(_)}let m=this.font.tables.colr;if(m){let T=m.layerRecords;for(let _=0;_<T.length;_++){let R=T[_].paletteIndex;if(R>s)T[_].paletteIndex-=1;else if(R===s){let N=0;for(let G=0;G<d.length;G++)if(o>s&&o<=s+d[G].length){N++;break}T[_].paletteIndex=o-N}}this.font.tables.colr={...m,layerRecords:T}}let v=f.flat();for(let T=0;T<d.length;T++)u.colorRecordIndices[T]-=T;u.numPaletteEntries=Math.max(0,u.numPaletteEntries-1),u.colorRecords=this.toCPALcolor(v)}ensureCPAL(s){return this.cpal()?!1:(!s||!s.length?s=[this.defaultValue]:s=this.toCPALcolor(s),this.font.tables.cpal={version:0,numPaletteEntries:s.length,colorRecords:s,colorRecordIndices:[0]},!0)}updateIndices(){let s=this.cpal(),o=Math.ceil(s.colorRecords.length/s.numPaletteEntries);s.colorRecordIndices=[];for(let u=0;u<o;u++)s.colorRecordIndices.push(u*s.numPaletteEntries)}},Kh=class{constructor(s){this.font=s}ensureCOLR(){return this.font.tables.colr||(this.font.tables.colr={version:0,baseGlyphRecords:[],layerRecords:[]}),this.font}get(s){let o=this.font,u=[],d=o.tables.colr,f=o.tables.cpal;if(!d||!f)return u;let m=Ul(d.baseGlyphRecords,"glyphID",s);if(!m)return u;let v=m.firstLayerIndex,T=m.numLayers;for(let _=0;_<T;_++){let R=d.layerRecords[v+_];u.push({glyph:o.glyphs.get(R.glyphID),paletteIndex:R.paletteIndex})}return u}add(s,o,u){let d=this.get(s);o=Array.isArray(o)?o:[o],u===void 0||u===1/0||u>d.length?u=d.length:u<0&&(u=d.length+1+u%(d.length+1),u>=d.length+1&&(u-=d.length+1));let f=[];for(let m=0;m<u;m++){let v=Number.isInteger(d[m].glyph)?d[m].glyph:d[m].glyph.index;f.push({glyphID:v,paletteIndex:d[m].paletteIndex})}for(let m of o){let v=Number.isInteger(m.glyph)?m.glyph:m.glyph.index;f.push({glyphID:v,paletteIndex:m.paletteIndex})}for(let m=u;m<d.length;m++){let v=Number.isInteger(d[m].glyph)?d[m].glyph:d[m].glyph.index;f.push({glyphID:v,paletteIndex:d[m].paletteIndex})}this.updateColrTable(s,f)}setPaletteIndex(s,o,u){let d=this.get(s);d[o]?(d=d.map((f,m)=>({glyphID:f.glyph.index,paletteIndex:m===o?u:f.paletteIndex})),this.updateColrTable(s,d)):console.error("Invalid layer index")}remove(s,o,u=o){let d=this.get(s);d=d.map(f=>({glyphID:f.glyph.index,paletteIndex:f.paletteIndex})),d.splice(o,u-o+1),this.updateColrTable(s,d)}updateColrTable(s,o){this.ensureCOLR();let u=this.font.tables.colr,d=Ss(u.baseGlyphRecords,"glyphID",s);if(d===-1){let _={glyphID:s,firstLayerIndex:u.layerRecords.length,numLayers:0};d=Ro(u.baseGlyphRecords,"glyphID",_)}let f=u.baseGlyphRecords[d],m=f.numLayers,v=o.length,T=v-m;if(T>0){let _=o.slice(m).map(R=>({glyphID:R.glyphID,paletteIndex:R.paletteIndex}));u.layerRecords.splice(f.firstLayerIndex+m,0,..._)}else T<0&&u.layerRecords.splice(f.firstLayerIndex+v,-T);for(let _=0;_<Math.min(m,v);_++)u.layerRecords[f.firstLayerIndex+_]={glyphID:o[_].glyphID,paletteIndex:o[_].paletteIndex};if(f.numLayers=v,T!==0)for(let _=0;_<u.baseGlyphRecords.length;_++){let R=u.baseGlyphRecords[_];_===d||R.firstLayerIndex<f.firstLayerIndex||(u.baseGlyphRecords[_].firstLayerIndex+=T)}}},Xh=class{constructor(s){this.font=s,this.cache=new WeakMap}get(s){let o=this.getOrCreateSvgImageCacheEntry(s);return o&&o.image}getAsync(s){let o=this.getOrCreateSvgImageCacheEntry(s);return o&&o.promise}getOrCreateSvgImageCacheEntry(s){let o=this.font.tables.svg;if(o===void 0)return;let u=o.get(s);if(u===void 0)return;let d=this.cache.get(u);d===void 0&&(d=xo(u),this.cache.set(u,d));let f=d.images.get(s);return f===void 0&&(f=el(this.font,d.template,s),f.promise.then(m=>{if(f.image=m,typeof this.font.onGlyphUpdated=="function")try{this.font.onGlyphUpdated(s)}catch(v){console.error("font.onGlyphUpdated",s,v)}}),d.images.set(s,f)),f}};function xo(s){return{template:Jh(s).then(Vu),images:new Map}}function el(s,o,u){return{promise:o.then(d=>{let f;typeof d=="string"?f=d:(d[4]=u,f=d.join(""));let m=qu(f,s.unitsPerEm);return m.image.decode().then(()=>m)}),image:void 0}}var Jh=typeof DecompressionStream=="function"?Gu:zl;function zl(s){try{return Promise.resolve(new TextDecoder().decode(gl(s)?bc(s):s))}catch(o){return Promise.reject(o)}}function Gu(s){if(gl(s))return new Response(new Response(s).body.pipeThrough(new DecompressionStream("gzip"))).text();try{return Promise.resolve(new TextDecoder().decode(s))}catch(o){return Promise.reject(o)}}function Vu(s){let o=s.indexOf("<svg"),u=s.indexOf(">",o+4)+1;if(/ id=['"]glyph\d+['"]/.test(s.substring(o,u)))return s;let d=s.lastIndexOf("</svg>");return[s.substring(0,u),"<defs>",s.substring(u,d),'</defs><use href="#glyph',"",'"/>',s.substring(d)]}function qu(s,o){let u=new DOMParser().parseFromString(s,"image/svg+xml").documentElement,d=u.viewBox.baseVal,f=u.width.baseVal,m=u.height.baseVal,v=1,T=1;d.width>0&&d.height>0&&(f.unitType===1?(v=f.valueInSpecifiedUnits/d.width,T=m.unitType===1?m.valueInSpecifiedUnits/d.height:v):m.unitType===1?(T=m.valueInSpecifiedUnits/d.height,v=T):o&&(v=o/d.width,T=o/d.height));let _=document.createElement("div");_.style.position="fixed",_.style.visibility="hidden",_.appendChild(u),document.body.appendChild(_);let R=u.getBBox();document.body.removeChild(_);let N=(R.x-d.x)*v,G=(d.y-R.y)*T,W=R.width*v,he=R.height*T;u.setAttribute("viewBox",[R.x,R.y,R.width,R.height].join(" ")),v!==1&&u.setAttribute("width",W),T!==1&&u.setAttribute("height",he);let ie=new Image(W,he);return ie.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(u.outerHTML),{leftSideBearing:N,baseline:G,image:ie}}var yc=new WeakMap;function c0(s,o,u,d,f){let m;return(o&d)>0?(m=s.parseByte(),(o&f)===0&&(m=-m),m=u+m):(o&f)>0?m=u:m=u+s.parseShort(),m}function bl(s,o,u){let d=new st.Parser(o,u);s._numberOfContours=d.parseShort(),s._xMin=d.parseShort(),s._yMin=d.parseShort(),s._xMax=d.parseShort(),s._yMax=d.parseShort();let f,m;if(s._numberOfContours>0){let v=s.endPointIndices=[];for(let _=0;_<s._numberOfContours;_+=1)v.push(d.parseUShort());s.instructionLength=d.parseUShort(),s.instructions=[];for(let _=0;_<s.instructionLength;_+=1)s.instructions.push(d.parseByte());let T=v[v.length-1]+1;f=[];for(let _=0;_<T;_+=1)if(m=d.parseByte(),f.push(m),(m&8)>0){let R=d.parseByte();for(let N=0;N<R;N+=1)f.push(m),_+=1}if(ge.argument(f.length===T,"Bad flags."),v.length>0){let _=[],R;if(T>0){for(let W=0;W<T;W+=1)m=f[W],R={},R.onCurve=!!(m&1),R.lastPointOfContour=v.indexOf(W)>=0,_.push(R);let N=0;for(let W=0;W<T;W+=1)m=f[W],R=_[W],R.x=c0(d,m,N,2,16),N=R.x;let G=0;for(let W=0;W<T;W+=1)m=f[W],R=_[W],R.y=c0(d,m,G,4,32),G=R.y}s.points=_}else s.points=[]}else if(s._numberOfContours===0)s.points=[];else{s.isComposite=!0,s.points=[],s.components=[];let v=!0;for(;v;){f=d.parseUShort();let T={glyphIndex:d.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(f&1)>0?(f&2)>0?(T.dx=d.parseShort(),T.dy=d.parseShort()):T.matchedPoints=[d.parseUShort(),d.parseUShort()]:(f&2)>0?(T.dx=d.parseChar(),T.dy=d.parseChar()):T.matchedPoints=[d.parseByte(),d.parseByte()],(f&8)>0?T.xScale=T.yScale=d.parseF2Dot14():(f&64)>0?(T.xScale=d.parseF2Dot14(),T.yScale=d.parseF2Dot14()):(f&128)>0&&(T.xScale=d.parseF2Dot14(),T.scale01=d.parseF2Dot14(),T.scale10=d.parseF2Dot14(),T.yScale=d.parseF2Dot14()),s.components.push(T),v=!!(f&32)}if(f&256){s.instructionLength=d.parseUShort(),s.instructions=[];for(let T=0;T<s.instructionLength;T+=1)s.instructions.push(d.parseByte())}}}function ji(s,o){let u=[];for(let d=0;d<s.length;d+=1){let f=s[d],m={x:o.xScale*f.x+o.scale10*f.y+o.dx,y:o.scale01*f.x+o.yScale*f.y+o.dy,onCurve:f.onCurve,lastPointOfContour:f.lastPointOfContour};u.push(m)}return u}function u0(s){let o=[],u=[];for(let d=0;d<s.length;d+=1){let f=s[d];u.push(f),f.lastPointOfContour&&(o.push(u),u=[])}return ge.argument(u.length===0,"There are still points left in the current contour."),o}function d0(s){let o=new Ke;if(!s)return o;let u=u0(s);for(let d=0;d<u.length;++d){let f=u[d],m=f[f.length-1],v=f[0];if(m.onCurve)o.moveTo(m.x,m.y);else if(v.onCurve)o.moveTo(v.x,v.y);else{let T={x:(m.x+v.x)*.5,y:(m.y+v.y)*.5};o.moveTo(T.x,T.y)}for(let T=0;T<f.length;++T)if(m=v,v=f[(T+1)%f.length],m.onCurve)o.lineTo(m.x,m.y);else{let _=v;v.onCurve||(_={x:(m.x+v.x)*.5,y:(m.y+v.y)*.5}),o.quadraticCurveTo(m.x,m.y,_.x,_.y)}o.closePath()}return o}function h0(s,o){if(o.isComposite){yc.has(s)||yc.set(s,new Set);let u=yc.get(s);u.add(o.index);try{for(let d=0;d<o.components.length;d+=1){let f=o.components[d];if(u.has(f.glyphIndex))continue;let m=s.get(f.glyphIndex);if(m.getPath(),m.points){let v;if(f.matchedPoints===void 0)v=ji(m.points,f);else{if(f.matchedPoints[0]>o.points.length-1||f.matchedPoints[1]>m.points.length-1)throw Error("Matched points out of range in "+o.name);let T=o.points[f.matchedPoints[0]],_=m.points[f.matchedPoints[1]],R={xScale:f.xScale,scale01:f.scale01,scale10:f.scale10,yScale:f.yScale,dx:0,dy:0};_=ji([_],R)[0],R.dx=T.x-_.x,R.dy=T.y-_.y,v=ji(m.points,R)}o.points=o.points.concat(v)}}}finally{u.delete(o.index)}}return d0(o.points)}function f0(s,o,u,d){let f=new Pr.GlyphSet(d);for(let m=0;m<u.length-1;m+=1){let v=u[m],T=u[m+1];v!==T?f.push(m,Pr.ttfGlyphLoader(d,m,bl,s,o+v,h0)):f.push(m,Pr.glyphLoader(d,m))}return f}function p0(s,o,u,d){let f=new Pr.GlyphSet(d);return d._push=function(m){let v=u[m],T=u[m+1];v!==T?f.push(m,Pr.ttfGlyphLoader(d,m,bl,s,o+v,h0)):f.push(m,Pr.glyphLoader(d,m))},f}function ef(s,o,u,d,f){return f.lowMemory?p0(s,o,u,d):f0(s,o,u,d)}var m0={getPath:d0,parse:ef},g0=class{constructor(s){this.font=s}normalizeCoordTags(s){for(let o in s)if(o.length<4){let u=o.padEnd(4," ");s[u]===void 0&&(s[u]=s[o]),delete s[o]}}getNormalizedCoords(s){s||(s=this.font.variation.get());let o=[];this.normalizeCoordTags(s);for(let u=0;u<this.fvar().axes.length;u++){let d=this.fvar().axes[u],f=s[d.tag];f===void 0&&(f=d.defaultValue),f<d.defaultValue?o.push((f-d.defaultValue+Number.EPSILON)/(d.defaultValue-d.minValue+Number.EPSILON)):o.push((f-d.defaultValue+Number.EPSILON)/(d.maxValue-d.defaultValue+Number.EPSILON))}if(this.avar())for(let u=0;u<this.avar().axisSegmentMaps.length;u++){let d=this.avar().axisSegmentMaps[u];for(let f=0;f<d.axisValueMaps.length;f++){let m=d.axisValueMaps[f];if(f>=1&&o[u]<m.fromCoordinate){let v=d.axisValueMaps[f-1];o[u]=((o[u]-v.fromCoordinate)*(m.toCoordinate-v.toCoordinate)+Number.EPSILON)/(m.fromCoordinate-v.fromCoordinate+Number.EPSILON)+v.toCoordinate;break}}}return o}interpolatePoints(s,o,u){if(s.length===0)return;let d=0;for(;d<s.length;){let f=d,m=d,v=s[m];for(;!v.lastPointOfContour;)v=s[++m];for(;d<=m&&!u[d];)d++;if(d>m)continue;let T=d,_=d;for(d++;d<=m;)u[d]&&(this.deltaInterpolate(_+1,d-1,_,d,o,s),_=d),d++;_===T?this.deltaShift(f,m,_,o,s):(this.deltaInterpolate(_+1,m,_,T,o,s),T>0&&this.deltaInterpolate(f,T-1,_,T,o,s)),d=m+1}}deltaInterpolate(s,o,u,d,f,m){if(s>o)return;let v=["x","y"];for(let _=0;_<v.length;_++){let R=v[_];if(f[u][R]>f[d][R]){var T=u;u=d,d=T}let N=f[u][R],G=f[d][R],W=m[u][R],he=m[d][R];if(N!==G||W===he){let ie=N===G?0:(he-W)/(G-N);for(let ye=s;ye<=o;ye++){let Je=f[ye][R];Je<=N?Je+=W-N:Je>=G?Je+=he-G:Je=W+(Je-N)*ie,m[ye][R]=Je}}}}deltaShift(s,o,u,d,f){let m=f[u].x-d[u].x,v=f[u].y-d[u].y;if(!(m===0&&v===0))for(let T=s;T<=o;T++)T!==u&&(f[T].x+=m,f[T].y+=v)}transformComponents(s,o,u,d,f,m){let v=0;for(let T=0;T<s.components.length;T++){let _=s.components[T],R=this.font.glyphs.get(_.glyphIndex),N=_a(_),G=d.indexOf(T);G>-1&&(N.dx+=Math.round(f.deltas[G]*m),N.dy+=Math.round(f.deltasY[G]*m));let W=ji(this.getTransform(R,u).points,N);o.splice(v,W.length,...W),v+=R.points.length}}applyTupleVariationStore(s,o,u,d="gvar",f={}){u||(u=this.font.variation.get());let m=this.getNormalizedCoords(u),{headers:v,sharedPoints:T}=s,_=this.fvar().axes.length,R;d==="gvar"?R=o.map(ki):d==="cvar"&&(R=[...o]);for(let N=0;N<v.length;N++){let G=v[N],W=1;for(let ie=0;ie<_;ie++){let ye=[0];switch(d){case"gvar":ye=G.peakTuple?G.peakTuple:this.gvar().sharedTuples[G.sharedTupleRecordsIndex];break;case"cvar":ye=G.peakTuple;break}if(ye[ie]!==0){if(m[ie]===0){W=0;break}if(G.intermediateStartTuple)if(m[ie]<G.intermediateStartTuple[ie]||m[ie]>G.intermediateEndTuple[ie]){W=0;break}else m[ie]<ye[ie]?W=W*(m[ie]-G.intermediateStartTuple[ie]+Number.EPSILON)/(ye[ie]-G.intermediateStartTuple[ie]+Number.EPSILON):W=W*(G.intermediateEndTuple[ie]-m[ie]+Number.EPSILON)/(G.intermediateEndTuple[ie]-ye[ie]+Number.EPSILON);else{if(m[ie]<Math.min(0,ye[ie])||m[ie]>Math.max(0,ye[ie])){W=0;break}W=(W*m[ie]+Number.EPSILON)/(ye[ie]+Number.EPSILON)}}}if(W===0)continue;let he=G.privatePoints.length?G.privatePoints:T;if(d==="gvar"&&f.glyph&&f.glyph.isComposite)this.transformComponents(f.glyph,R,u,he,G,W);else if(he.length===0)for(let ie=0;ie<R.length;ie++){let ye=R[ie];d==="gvar"?R[ie]={x:Math.round(ye.x+G.deltas[ie]*W),y:Math.round(ye.y+G.deltasY[ie]*W),onCurve:ye.onCurve,lastPointOfContour:ye.lastPointOfContour}:d==="cvar"&&(R[ie]=Math.round(ye+G.deltas[ie]*W))}else{let ie;d==="gvar"?ie=R.map(ki):d==="cvar"&&(ie=R);let ye=Array(o.length).fill(!1);for(let Je=0;Je<he.length;Je++){let gr=he[Je];if(gr<o.length){let or=ie[gr];d==="gvar"?(ye[gr]=!0,or.x+=G.deltas[Je]*W,or.y+=G.deltasY[Je]*W):d==="cvar"&&(R[gr]=Math.round(or+G.deltas[Je]*W))}}if(d==="gvar"){this.interpolatePoints(ie,R,ye);for(let Je=0;Je<o.length;Je++){let gr=ie[Je].x-R[Je].x,or=ie[Je].y-R[Je].y;R[Je].x=Math.round(R[Je].x+gr),R[Je].y=Math.round(R[Je].y+or)}}}}return R}getTransform(s,o){Number.isInteger(s)&&(s=this.font.glyphs.get(s));let u=s.getBlendPath,d=!!(s.points&&s.points.length),f=s;if(u||d){if(o||(o=this.font.variation.get()),d){let m=this.gvar()&&this.gvar().glyphVariations[s.index];if(m){let v=s.points,T=this.applyTupleVariationStore(m,v,o,"gvar",{glyph:s});f=new fs(Object.assign({},s,{points:T,path:d0(T)}))}}else if(u){let m=s.getBlendPath(o);f=new fs(Object.assign({},s,{path:m}))}}return this.font.tables.hvar&&(s._advanceWidth=typeof s._advanceWidth<"u"?s._advanceWidth:s.advanceWidth,s.advanceWidth=f.advanceWidth=Math.round(s._advanceWidth+this.getVariableAdjustment(f.index,"hvar","advanceWidth",o)),s._leftSideBearing=typeof s._leftSideBearing<"u"?s._leftSideBearing:s.leftSideBearing,s.leftSideBearing=f.leftSideBearing=Math.round(s._leftSideBearing+this.getVariableAdjustment(f.index,"hvar","lsb",o))),f}getCvarTransform(s){let o=this.font.tables.cvt,u=this.cvar();return!o||!o.length||!u||!u.headers.length?o:this.applyTupleVariationStore(u,o,s,"cvar")}getVariableAdjustment(s,o,u,d){d=d||this.font.variation.get();let f,m,v=this.font.tables[o];if(!v)throw Error(`trying to get variation adjustment from non-existent table "${v}"`);if(!v.itemVariationStore)throw Error(`trying to get variation adjustment from table "${v}" which does not have an itemVariationStore`);let T=v[u]&&v[u].map.length;if(T){let _=s;_>=T&&(_=T-1),{outerIndex:f,innerIndex:m}=v[u].map[_]}else f=0,m=s;return this.getDelta(v.itemVariationStore,f,m,d)}getDelta(s,o,u,d){if(o>=s.itemVariationSubtables.length)return 0;let f=s.itemVariationSubtables[o];if(u>=f.deltaSets.length)return 0;let m=f.deltaSets[u],v=this.getBlendVector(s,o,d),T=0;for(let _=0;_<f.regionIndexes.length;_++)T+=m[_]*v[_];return T}getBlendVector(s,o,u){u||(u=this.font.variation.get());let d=s.itemVariationSubtables[o],f=this.getNormalizedCoords(u),m=[];for(let v=0;v<d.regionIndexes.length;v++){let T=1,_=d.regionIndexes[v],R=s.variationRegions[_].regionAxes;for(let N=0;N<R.length;N++){let G=R[N],W;G.startCoord>G.peakCoord||G.peakCoord>G.endCoord||G.startCoord<0&&G.endCoord>0&&G.peakCoord!==0||G.peakCoord===0?W=1:f[N]<G.startCoord||f[N]>G.endCoord?W=0:f[N]===G.peakCoord?W=1:f[N]<G.peakCoord?W=(f[N]-G.startCoord+Number.EPSILON)/(G.peakCoord-G.startCoord+Number.EPSILON):W=(G.endCoord-f[N]+Number.EPSILON)/(G.endCoord-G.peakCoord+Number.EPSILON),T*=W}m[v]=T}return m}avar(){return this.font.tables.avar}cvar(){return this.font.tables.cvar}fvar(){return this.font.tables.fvar}gvar(){return this.font.tables.gvar}hvar(){return this.font.tables.hvar}},Yu=class{constructor(s){this.font=s,this.process=new g0(this.font),this.activateDefaultVariation(),this.getTransform=this.process.getTransform.bind(this.process)}activateDefaultVariation(){let s=this.getDefaultInstanceIndex();s>-1?this.set(s):this.set(this.getDefaultCoordinates())}getDefaultCoordinates(){return this.fvar().axes.reduce((s,o)=>(s[o.tag]=o.defaultValue,s),{})}getDefaultInstanceIndex(){let s=this.getDefaultCoordinates(),o=this.getInstanceIndex(s);return o<0&&(o=this.fvar().instances.findIndex(u=>u.name&&u.name.en==="Regular")),o}getInstanceIndex(s){return this.fvar().instances.findIndex(o=>Object.keys(s).every(u=>o.coordinates[u]===s[u]))}getInstance(s){return this.fvar().instances&&this.fvar().instances[s]}set(s){let o;if(Number.isInteger(s)){let u=this.getInstance(s);if(!u)throw Error(`Invalid instance index ${s}`);o={...u.coordinates}}else o=s,this.process.normalizeCoordTags(o);o=Object.assign({},this.font.defaultRenderOptions.variation,o),this.font.defaultRenderOptions=Object.assign({},this.font.defaultRenderOptions,{variation:o})}get(){return Object.assign({},this.font.defaultRenderOptions.variation)}avar(){return this.font.tables.avar}cvar(){return this.font.tables.cvar}fvar(){return this.font.tables.fvar}gvar(){return this.font.tables.gvar}hvar(){return this.font.tables.hvar}},Ji=1e6,tl=64,yl=1e4,Hl,ea,_s,x0;function b0(s){this.font=s,this.getCommands=function(o){return m0.getPath(o).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function tf(s){return s}function y0(s){return Math.sign(s)*Math.round(Math.abs(s))}function Zu(s){return Math.sign(s)*Math.round(Math.abs(s*2))/2}function S(s){return Math.sign(s)*(Math.round(Math.abs(s)+.5)-.5)}function D(s){return Math.sign(s)*Math.ceil(Math.abs(s))}function ae(s){return Math.sign(s)*Math.floor(Math.abs(s))}var Ze=function(s){let o=this.srPeriod,u=this.srPhase,d=this.srThreshold,f=1;return s<0&&(s=-s,f=-1),s+=d-u,s=Math.trunc(s/o)*o,s+=u,s<0?u*f:s*f},bt={x:1,y:0,axis:"x",distance:function(s,o,u,d){return(u?s.xo:s.x)-(d?o.xo:o.x)},interpolate:function(s,o,u,d){let f,m,v,T,_,R,N;if(!d||d===this){if(f=s.xo-o.xo,m=s.xo-u.xo,_=o.x-o.xo,R=u.x-u.xo,v=Math.abs(f),T=Math.abs(m),N=v+T,N===0){s.x=s.xo+(_+R)/2;return}s.x=s.xo+(_*T+R*v)/N;return}if(f=d.distance(s,o,!0,!0),m=d.distance(s,u,!0,!0),_=d.distance(o,o,!1,!0),R=d.distance(u,u,!1,!0),v=Math.abs(f),T=Math.abs(m),N=v+T,N===0){bt.setRelative(s,s,(_+R)/2,d,!0);return}bt.setRelative(s,s,(_*T+R*v)/N,d,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(s,o,u,d,f){if(!d||d===this){s.x=(f?o.xo:o.x)+u;return}let m=f?o.xo:o.x,v=f?o.yo:o.y,T=m+u*d.x,_=v+u*d.y;s.x=T+(s.y-_)/d.normalSlope},slope:0,touch:function(s){s.xTouched=!0},touched:function(s){return s.xTouched},untouch:function(s){s.xTouched=!1}},Yt={x:0,y:1,axis:"y",distance:function(s,o,u,d){return(u?s.yo:s.y)-(d?o.yo:o.y)},interpolate:function(s,o,u,d){let f,m,v,T,_,R,N;if(!d||d===this){if(f=s.yo-o.yo,m=s.yo-u.yo,_=o.y-o.yo,R=u.y-u.yo,v=Math.abs(f),T=Math.abs(m),N=v+T,N===0){s.y=s.yo+(_+R)/2;return}s.y=s.yo+(_*T+R*v)/N;return}if(f=d.distance(s,o,!0,!0),m=d.distance(s,u,!0,!0),_=d.distance(o,o,!1,!0),R=d.distance(u,u,!1,!0),v=Math.abs(f),T=Math.abs(m),N=v+T,N===0){Yt.setRelative(s,s,(_+R)/2,d,!0);return}Yt.setRelative(s,s,(_*T+R*v)/N,d,!0)},normalSlope:0,setRelative:function(s,o,u,d,f){if(!d||d===this){s.y=(f?o.yo:o.y)+u;return}let m=f?o.xo:o.x,v=f?o.yo:o.y,T=m+u*d.x,_=v+u*d.y;s.y=_+d.normalSlope*(s.x-T)},slope:Number.POSITIVE_INFINITY,touch:function(s){s.yTouched=!0},touched:function(s){return s.yTouched},untouch:function(s){s.yTouched=!1}};Object.freeze(bt),Object.freeze(Yt);function Ar(s,o){this.x=s,this.y=o,this.axis=void 0,this.slope=o/s,this.normalSlope=-s/o,Object.freeze(this)}Ar.prototype.distance=function(s,o,u,d){return this.x*bt.distance(s,o,u,d)+this.y*Yt.distance(s,o,u,d)},Ar.prototype.interpolate=function(s,o,u,d){let f,m,v,T,_,R,N;if(v=d.distance(s,o,!0,!0),T=d.distance(s,u,!0,!0),f=d.distance(o,o,!1,!0),m=d.distance(u,u,!1,!0),_=Math.abs(v),R=Math.abs(T),N=_+R,N===0){this.setRelative(s,s,(f+m)/2,d,!0);return}this.setRelative(s,s,(f*R+m*_)/N,d,!0)},Ar.prototype.setRelative=function(s,o,u,d,f){d=d||this;let m=f?o.xo:o.x,v=f?o.yo:o.y,T=m+u*d.x,_=v+u*d.y,R=d.normalSlope,N=this.slope,G=s.x,W=s.y;s.x=(N*G-R*T+_-W)/(N-R),s.y=N*(s.x-G)+W},Ar.prototype.touch=function(s){s.xTouched=!0,s.yTouched=!0};function sn(s,o){let u=Math.sqrt(s*s+o*o);return s/=u,o/=u,s===1&&o===0?bt:s===0&&o===1?Yt:new Ar(s,o)}function tn(s,o,u,d){this.x=this.xo=Math.round(s*64)/64,this.y=this.yo=Math.round(o*64)/64,this.lastPointOfContour=u,this.onCurve=d,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}tn.prototype.nextTouched=function(s){let o=this.nextPointOnContour;for(;!s.touched(o)&&o!==this;)o=o.nextPointOnContour;return o},tn.prototype.prevTouched=function(s){let o=this.prevPointOnContour;for(;!s.touched(o)&&o!==this;)o=o.prevPointOnContour;return o};var mn=Object.freeze(new tn(0,0)),Ii={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function qr(s,o){switch(this.env=s,this.stack=[],this.prog=o,s){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=bt,this.round=y0}}b0.prototype.exec=function(s,o){if(typeof o!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;let u=this.font,d=this._prepState;if(!d||d.ppem!==o){let f=this._fpgmState;if(!f){qr.prototype=Ii,f=this._fpgmState=new qr("fpgm",u.tables.fpgm),f.funcs=[],f.font=u,f.instructionCount=0,f.callDepth=0;try{ea(f)}catch(v){console.log("Hinting error in FPGM:"+v),this._errorState=3;return}}qr.prototype=f,d=this._prepState=new qr("prep",u.tables.prep),d.ppem=o,d.instructionCount=0,d.callDepth=0;let m=u.variation&&u.variation.process.getCvarTransform()||u.tables.cvt;if(m){let v=d.cvt=new Array(m.length),T=o/u.unitsPerEm;for(let _=0;_<m.length;_++)v[_]=m[_]*T}else d.cvt=[];try{ea(d)}catch(v){this._errorState<2&&console.log("Hinting error in PREP:"+v),this._errorState=2}}if(!(this._errorState>1))try{return _s(s,d)}catch(f){this._errorState<1&&(console.log("Hinting error:"+f),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}},_s=function(s,o){let u=o.ppem/o.font.unitsPerEm,d=u,f=s.components,m,v,T;if(qr.prototype=o,!f)T=new qr("glyf",s.instructions),T.instructionCount=0,T.callDepth=0,x0(s,T,u,d),v=T.gZone;else{let _=o.font;v=[],m=[];for(let R=0;R<f.length;R++){let N=f[R],G=_.glyphs.get(N.glyphIndex);T=new qr("glyf",G.instructions),T.instructionCount=0,T.callDepth=0,x0(G,T,u,d);let W=Math.round(N.dx*u),he=Math.round(N.dy*d),ie=T.gZone,ye=T.contours;for(let gr=0;gr<ie.length;gr++){let or=ie[gr];or.xTouched=or.yTouched=!1,or.xo=or.x=or.x+W,or.yo=or.y=or.y+he}let Je=v.length;v.push.apply(v,ie);for(let gr=0;gr<ye.length;gr++)m.push(ye[gr]+Je)}s.instructions&&!T.inhibitGridFit&&(T=new qr("glyf",s.instructions),T.gZone=T.z0=T.z1=T.z2=v,T.contours=m,v.push(new tn(0,0),new tn(Math.round(s.advanceWidth*u),0)),ea(T),v.length-=2)}return v},x0=function(s,o,u,d){let f=s.points||[],m=f.length,v=o.gZone=o.z0=o.z1=o.z2=[],T=o.contours=[],_;for(let G=0;G<m;G++)_=f[G],v[G]=new tn(_.x*u,_.y*d,_.lastPointOfContour,_.onCurve);let R,N;for(let G=0;G<m;G++)_=v[G],R||(R=_,T.push(G)),_.lastPointOfContour?(_.nextPointOnContour=R,R.prevPointOnContour=_,R=void 0):(N=v[G+1],_.nextPointOnContour=N,N.prevPointOnContour=_);o.inhibitGridFit||(v.push(new tn(0,0),new tn(Math.round(s.advanceWidth*u),0)),ea(o),v.length-=2)},ea=function(s){let o=s.prog;if(!o)return;let u=o.length,d;for(s.ip=0;s.ip<u;s.ip++){if(++s.instructionCount>Ji)throw new Error("Hinting instructions exceeded maximum of "+Ji);if(d=Hl[o[s.ip]],!d)throw new Error("unknown instruction: 0x"+Number(o[s.ip]).toString(16));d(s)}};function Vs(s){let o=s.tZone=new Array(s.gZone.length);for(let u=0;u<o.length;u++)o[u]=new tn(0,0)}function za(s,o){let u=s.prog,d=s.ip,f=1,m;do if(m=u[++d],m===88)f++;else if(m===89)f--;else if(m===64)d+=u[d+1]+1;else if(m===65)d+=2*u[d+1]+1;else if(m>=176&&m<=183)d+=m-176+1;else if(m>=184&&m<=191)d+=(m-184+1)*2;else if(o&&f===1&&m===27)break;while(f>0);s.ip=d}function Ha(s,o){o.fv=o.pv=o.dpv=s}function ta(s,o){o.pv=o.dpv=s}function fi(s,o){o.fv=s}function La(s,o){let u=o.stack,d=u.pop(),f=u.pop(),m=o.z2[d],v=o.z1[f],T,_;s?(T=m.y-v.y,_=v.x-m.x):(T=v.x-m.x,_=v.y-m.y),o.pv=o.dpv=sn(T,_)}function Ku(s,o){let u=o.stack,d=u.pop(),f=u.pop(),m=o.z2[d],v=o.z1[f],T,_;s?(T=m.y-v.y,_=v.x-m.x):(T=v.x-m.x,_=v.y-m.y),o.fv=sn(T,_)}function v0(s){let o=s.stack,u=o.pop(),d=o.pop();s.pv=s.dpv=sn(d,u)}function fy(s){let o=s.stack,u=o.pop(),d=o.pop();s.fv=sn(d,u)}function py(s){let o=s.stack,u=s.pv;o.push(u.x*16384),o.push(u.y*16384)}function my(s){let o=s.stack,u=s.fv;o.push(u.x*16384),o.push(u.y*16384)}function gy(s){s.fv=s.pv}function xy(s){let o=s.stack,u=o.pop(),d=o.pop(),f=o.pop(),m=o.pop(),v=o.pop(),T=s.z0,_=s.z1,R=T[u],N=T[d],G=_[f],W=_[m],he=s.z2[v],ie=R.x,ye=R.y,Je=N.x,gr=N.y,or=G.x,Cr=G.y,Yr=W.x,Dn=W.y,zn=(ie-Je)*(Cr-Dn)-(ye-gr)*(or-Yr),Hn=ie*gr-ye*Je,Ns=or*Dn-Cr*Yr;he.x=(Hn*(or-Yr)-Ns*(ie-Je))/zn,he.y=(Hn*(Cr-Dn)-Ns*(ye-gr))/zn}function by(s){s.rp0=s.stack.pop()}function yy(s){s.rp1=s.stack.pop()}function vy(s){s.rp2=s.stack.pop()}function wy(s){let o=s.stack.pop();switch(s.zp0=o,o){case 0:s.tZone||Vs(s),s.z0=s.tZone;break;case 1:s.z0=s.gZone;break;default:throw new Error("Invalid zone pointer")}}function Ay(s){let o=s.stack.pop();switch(s.zp1=o,o){case 0:s.tZone||Vs(s),s.z1=s.tZone;break;case 1:s.z1=s.gZone;break;default:throw new Error("Invalid zone pointer")}}function Ty(s){let o=s.stack.pop();switch(s.zp2=o,o){case 0:s.tZone||Vs(s),s.z2=s.tZone;break;case 1:s.z2=s.gZone;break;default:throw new Error("Invalid zone pointer")}}function Cy(s){let o=s.stack.pop();switch(s.zp0=s.zp1=s.zp2=o,o){case 0:s.tZone||Vs(s),s.z0=s.z1=s.z2=s.tZone;break;case 1:s.z0=s.z1=s.z2=s.gZone;break;default:throw new Error("Invalid zone pointer")}}function Sy(s){s.loop=s.stack.pop(),s.loop>yl&&(s.loop=yl)}function _y(s){s.round=y0}function Ly(s){s.round=S}function ky(s){let o=s.stack.pop();s.minDis=o/64}function Iy(s){za(s,!1)}function Ey(s){let o=s.stack.pop();s.ip+=o-1}function Ny(s){let o=s.stack.pop();s.cvCutIn=o/64}function Ry(s){let o=s.stack;o.push(o[o.length-1])}function rf(s){s.stack.pop()}function My(s){s.stack.length=0}function Dy(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(u),o.push(d)}function By(s){let o=s.stack;o.push(o.length)}function Qy(s){let o=s.stack,u=o.pop(),d=o.pop();if(d>yl&&(d=yl),++s.callDepth>tl)throw new Error("Hinting call depth exceeded maximum of "+tl);let f=s.ip,m=s.prog;s.prog=s.funcs[u];for(let v=0;v<d;v++)ea(s);s.ip=f,s.prog=m,s.callDepth--}function jy(s){let o=s.stack.pop();if(++s.callDepth>tl)throw new Error("Hinting call depth exceeded maximum of "+tl);let u=s.ip,d=s.prog;s.prog=s.funcs[o],ea(s),s.ip=u,s.prog=d,s.callDepth--}function Py(s){let o=s.stack,u=o.pop();o.push(o[o.length-u])}function Oy(s){let o=s.stack,u=o.pop();o.push(o.splice(o.length-u,1)[0])}function Fy(s){if(s.env!=="fpgm")throw new Error("FDEF not allowed here");let o=s.stack,u=s.prog,d=s.ip,f=o.pop(),m=d;for(;u[++d]!==45;);s.ip=d,s.funcs[f]=u.slice(m+1,d)}function pm(s,o){let u=o.stack.pop(),d=o.z0[u],f=o.fv,m=o.pv,v=m.distance(d,mn);s&&(v=o.round(v)),f.setRelative(d,mn,v,m),f.touch(d),o.rp0=o.rp1=u}function mm(s,o){let u=o.z2,d=u.length-2,f,m,v;for(let T=0;T<d;T++)f=u[T],!s.touched(f)&&(m=f.prevTouched(s),m!==f&&(v=f.nextTouched(s),m===v&&s.setRelative(f,f,s.distance(m,m,!1,!0),s,!0),s.interpolate(f,m,v,s)))}function gm(s,o){let u=o.stack,d=s?o.rp1:o.rp2,f=(s?o.z0:o.z1)[d],m=o.fv,v=o.pv,T=o.loop,_=o.z2;for(;T--;){let R=u.pop(),N=_[R],G=v.distance(f,f,!1,!0);m.setRelative(N,N,G,v),m.touch(N)}o.loop=1}function xm(s,o){let u=o.stack,d=s?o.rp1:o.rp2,f=(s?o.z0:o.z1)[d],m=o.fv,v=o.pv,T=u.pop(),_=o.z2[o.contours[T]],R=_,N=v.distance(f,f,!1,!0);do R!==f&&m.setRelative(R,R,N,v),R=R.nextPointOnContour;while(R!==_)}function bm(s,o){let u=o.stack,d=s?o.rp1:o.rp2,f=(s?o.z0:o.z1)[d],m=o.fv,v=o.pv,T=u.pop(),_;switch(T){case 0:_=o.tZone;break;case 1:_=o.gZone;break;default:throw new Error("Invalid zone")}let R,N=v.distance(f,f,!1,!0),G=_.length-2;for(let W=0;W<G;W++)R=_[W],m.setRelative(R,R,N,v)}function $y(s){let o=s.stack,u=s.loop,d=s.fv,f=o.pop()/64,m=s.z2;for(;u--;){let v=o.pop(),T=m[v];d.setRelative(T,T,f),d.touch(T)}s.loop=1}function Uy(s){let o=s.stack,u=s.rp1,d=s.rp2,f=s.loop,m=s.z0[u],v=s.z1[d],T=s.fv,_=s.dpv,R=s.z2;for(;f--;){let N=o.pop(),G=R[N];T.interpolate(G,m,v,_),T.touch(G)}s.loop=1}function ym(s,o){let u=o.stack,d=u.pop()/64,f=u.pop(),m=o.z1[f],v=o.z0[o.rp0],T=o.fv,_=o.pv;T.setRelative(m,v,d,_),T.touch(m),o.rp1=o.rp0,o.rp2=f,s&&(o.rp0=f)}function zy(s){let o=s.stack,u=s.rp0,d=s.z0[u],f=s.loop,m=s.fv,v=s.pv,T=s.z1;for(;f--;){let _=o.pop(),R=T[_];m.setRelative(R,d,0,v),m.touch(R)}s.loop=1}function Hy(s){s.round=Zu}function vm(s,o){let u=o.stack,d=u.pop(),f=u.pop(),m=o.z0[f],v=o.fv,T=o.pv,_=o.cvt[d],R=T.distance(m,mn);s&&(Math.abs(R-_)<o.cvCutIn&&(R=_),R=o.round(R)),v.setRelative(m,mn,R,T),o.zp0===0&&(m.xo=m.x,m.yo=m.y),v.touch(m),o.rp0=o.rp1=f}function Wy(s){let o=s.prog,u=s.ip,d=s.stack,f=o[++u];for(let m=0;m<f;m++)d.push(o[++u]);s.ip=u}function Gy(s){let o=s.ip,u=s.prog,d=s.stack,f=u[++o];for(let m=0;m<f;m++){let v=u[++o]<<8|u[++o];v&32768&&(v=-((v^65535)+1)),d.push(v)}s.ip=o}function Vy(s){let o=s.stack,u=s.store;u||(u=s.store=[]);let d=o.pop(),f=o.pop();u[f]=d}function qy(s){let o=s.stack,u=s.store,d=o.pop(),f=u&&u[d]||0;o.push(f)}function Yy(s){let o=s.stack,u=o.pop(),d=o.pop();s.cvt[d]=u/64}function Zy(s){let o=s.stack,u=o.pop();o.push(s.cvt[u]*64)}function wm(s,o){let u=o.stack,d=u.pop(),f=o.z2[d];u.push(o.dpv.distance(f,mn,s,!1)*64)}function Am(s,o){let u=o.stack,d=u.pop(),f=u.pop(),m=o.z1[d],v=o.z0[f],T=o.dpv.distance(v,m,s,s);o.stack.push(Math.round(T*64))}function Ky(s){s.stack.push(s.ppem)}function Xy(s){s.autoFlip=!0}function Jy(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(d<u?1:0)}function e4(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(d<=u?1:0)}function t4(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(d>u?1:0)}function r4(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(d>=u?1:0)}function n4(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(u===d?1:0)}function s4(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(u!==d?1:0)}function i4(s){let o=s.stack,u=o.pop();o.push(Math.trunc(u)&1?1:0)}function a4(s){let o=s.stack,u=o.pop();o.push(Math.trunc(u)&1?0:1)}function o4(s){let o=s.stack.pop(),u;o||za(s,!0)}function l4(s){}function c4(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(u&&d?1:0)}function u4(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(u||d?1:0)}function d4(s){let o=s.stack,u=o.pop();o.push(u?0:1)}function nf(s,o){let u=o.stack,d=u.pop(),f=o.fv,m=o.pv,v=o.ppem,T=o.deltaBase+(s-1)*16,_=o.deltaShift,R=o.z0;for(let N=0;N<d;N++){let G=u.pop(),W=u.pop();if(T+((W&240)>>4)!==v)continue;let he=(W&15)-8;he>=0&&he++;let ie=R[G];f.setRelative(ie,ie,he*_,m)}}function h4(s){let o=s.stack.pop();s.deltaBase=o}function f4(s){let o=s.stack.pop();s.deltaShift=Math.pow(.5,o)}function p4(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(d+u)}function m4(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(d-u)}function g4(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(d*64/u)}function x4(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(d*u/64)}function b4(s){let o=s.stack,u=o.pop();o.push(Math.abs(u))}function y4(s){let o=s.stack,u=o.pop();o.push(-u)}function v4(s){let o=s.stack,u=o.pop();o.push(Math.floor(u/64)*64)}function w4(s){let o=s.stack,u=o.pop();o.push(Math.ceil(u/64)*64)}function Xu(s,o){let u=o.stack,d=u.pop();u.push(o.round(d/64)*64)}function A4(s){let o=s.stack,u=o.pop(),d=o.pop();s.cvt[d]=u*s.ppem/s.font.unitsPerEm}function sf(s,o){let u=o.stack,d=u.pop(),f=o.ppem,m=o.deltaBase+(s-1)*16,v=o.deltaShift;for(let T=0;T<d;T++){let _=u.pop(),R=u.pop();if(m+((R&240)>>4)!==f)continue;let N=(R&15)-8;N>=0&&N++;let G=N*v;o.cvt[_]+=G}}function T4(s){let o=s.stack.pop();s.round=Ze;let u;switch(o&192){case 0:u=.5;break;case 64:u=1;break;case 128:u=2;break;default:throw new Error("invalid SROUND value")}switch(s.srPeriod=u,o&48){case 0:s.srPhase=0;break;case 16:s.srPhase=.25*u;break;case 32:s.srPhase=.5*u;break;case 48:s.srPhase=.75*u;break;default:throw new Error("invalid SROUND value")}o&=15,o===0?s.srThreshold=0:s.srThreshold=(o/8-.5)*u}function C4(s){let o=s.stack.pop();s.round=Ze;let u;switch(o&192){case 0:u=Math.sqrt(2)/2;break;case 64:u=Math.sqrt(2);break;case 128:u=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(s.srPeriod=u,o&48){case 0:s.srPhase=0;break;case 16:s.srPhase=.25*u;break;case 32:s.srPhase=.5*u;break;case 48:s.srPhase=.75*u;break;default:throw new Error("invalid S45ROUND value")}o&=15,o===0?s.srThreshold=0:s.srThreshold=(o/8-.5)*u}function S4(s){s.round=tf}function _4(s){s.round=D}function L4(s){s.round=ae}function k4(s){let o=s.stack.pop()}function Tm(s,o){let u=o.stack,d=u.pop(),f=u.pop(),m=o.z2[d],v=o.z1[f],T,_;s?(T=m.y-v.y,_=v.x-m.x):(T=v.x-m.x,_=v.y-m.y),o.dpv=sn(T,_)}function I4(s){let o=s.stack,u=o.pop(),d=0;u&1&&(d=35),u&32&&(d|=4096),o.push(d)}function E4(s){let o=s.stack,u=o.pop(),d=o.pop(),f=o.pop();o.push(d),o.push(u),o.push(f)}function N4(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(Math.max(d,u))}function R4(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(Math.min(d,u))}function M4(s){let o=s.stack.pop()}function D4(s){let o=s.stack.pop(),u=s.stack.pop();switch(o){case 1:s.inhibitGridFit=!!u;return;case 2:s.ignoreCvt=!!u;return;default:throw new Error("invalid INSTCTRL[] selector")}}function vl(s,o){let u=o.stack,d=o.prog,f=o.ip;for(let m=0;m<s;m++)u.push(d[++f]);o.ip=f}function wl(s,o){let u=o.ip,d=o.prog,f=o.stack;for(let m=0;m<s;m++){let v=d[++u]<<8|d[++u];v&32768&&(v=-((v^65535)+1)),f.push(v)}o.ip=u}function cr(s,o,u,d,f,m){let v=m.stack,T=s&&v.pop(),_=v.pop(),R=m.rp0,N=m.z0[R],G=m.z1[_],W=m.minDis,he=m.fv,ie=m.dpv,ye,Je,gr,or;Je=ye=ie.distance(G,N,!0,!0),gr=Je>=0?1:-1,Je=Math.abs(Je),s&&(or=m.cvt[T],d&&Math.abs(Je-or)<m.cvCutIn&&(Je=or)),u&&Je<W&&(Je=W),d&&(Je=m.round(Je)),he.setRelative(G,N,gr*Je,ie),he.touch(G),m.rp1=m.rp0,m.rp2=_,o&&(m.rp0=_)}Hl=[Ha.bind(void 0,Yt),Ha.bind(void 0,bt),ta.bind(void 0,Yt),ta.bind(void 0,bt),fi.bind(void 0,Yt),fi.bind(void 0,bt),La.bind(void 0,0),La.bind(void 0,1),Ku.bind(void 0,0),Ku.bind(void 0,1),v0,fy,py,my,gy,xy,by,yy,vy,wy,Ay,Ty,Cy,Sy,_y,Ly,ky,Iy,Ey,Ny,void 0,void 0,Ry,rf,My,Dy,By,Py,Oy,void 0,void 0,void 0,Qy,jy,Fy,void 0,pm.bind(void 0,0),pm.bind(void 0,1),mm.bind(void 0,Yt),mm.bind(void 0,bt),gm.bind(void 0,0),gm.bind(void 0,1),xm.bind(void 0,0),xm.bind(void 0,1),bm.bind(void 0,0),bm.bind(void 0,1),$y,Uy,ym.bind(void 0,0),ym.bind(void 0,1),zy,Hy,vm.bind(void 0,0),vm.bind(void 0,1),Wy,Gy,Vy,qy,Yy,Zy,wm.bind(void 0,0),wm.bind(void 0,1),void 0,Am.bind(void 0,0),Am.bind(void 0,1),Ky,void 0,Xy,void 0,void 0,Jy,e4,t4,r4,n4,s4,i4,a4,o4,l4,c4,u4,d4,nf.bind(void 0,1),h4,f4,p4,m4,g4,x4,b4,y4,v4,w4,Xu.bind(void 0,0),Xu.bind(void 0,1),Xu.bind(void 0,2),Xu.bind(void 0,3),void 0,void 0,void 0,void 0,A4,nf.bind(void 0,2),nf.bind(void 0,3),sf.bind(void 0,1),sf.bind(void 0,2),sf.bind(void 0,3),T4,C4,void 0,void 0,S4,void 0,_4,L4,rf,rf,void 0,void 0,void 0,void 0,void 0,k4,Tm.bind(void 0,0),Tm.bind(void 0,1),I4,void 0,E4,N4,R4,M4,D4,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,vl.bind(void 0,1),vl.bind(void 0,2),vl.bind(void 0,3),vl.bind(void 0,4),vl.bind(void 0,5),vl.bind(void 0,6),vl.bind(void 0,7),vl.bind(void 0,8),wl.bind(void 0,1),wl.bind(void 0,2),wl.bind(void 0,3),wl.bind(void 0,4),wl.bind(void 0,5),wl.bind(void 0,6),wl.bind(void 0,7),wl.bind(void 0,8),cr.bind(void 0,0,0,0,0,0),cr.bind(void 0,0,0,0,0,1),cr.bind(void 0,0,0,0,0,2),cr.bind(void 0,0,0,0,0,3),cr.bind(void 0,0,0,0,1,0),cr.bind(void 0,0,0,0,1,1),cr.bind(void 0,0,0,0,1,2),cr.bind(void 0,0,0,0,1,3),cr.bind(void 0,0,0,1,0,0),cr.bind(void 0,0,0,1,0,1),cr.bind(void 0,0,0,1,0,2),cr.bind(void 0,0,0,1,0,3),cr.bind(void 0,0,0,1,1,0),cr.bind(void 0,0,0,1,1,1),cr.bind(void 0,0,0,1,1,2),cr.bind(void 0,0,0,1,1,3),cr.bind(void 0,0,1,0,0,0),cr.bind(void 0,0,1,0,0,1),cr.bind(void 0,0,1,0,0,2),cr.bind(void 0,0,1,0,0,3),cr.bind(void 0,0,1,0,1,0),cr.bind(void 0,0,1,0,1,1),cr.bind(void 0,0,1,0,1,2),cr.bind(void 0,0,1,0,1,3),cr.bind(void 0,0,1,1,0,0),cr.bind(void 0,0,1,1,0,1),cr.bind(void 0,0,1,1,0,2),cr.bind(void 0,0,1,1,0,3),cr.bind(void 0,0,1,1,1,0),cr.bind(void 0,0,1,1,1,1),cr.bind(void 0,0,1,1,1,2),cr.bind(void 0,0,1,1,1,3),cr.bind(void 0,1,0,0,0,0),cr.bind(void 0,1,0,0,0,1),cr.bind(void 0,1,0,0,0,2),cr.bind(void 0,1,0,0,0,3),cr.bind(void 0,1,0,0,1,0),cr.bind(void 0,1,0,0,1,1),cr.bind(void 0,1,0,0,1,2),cr.bind(void 0,1,0,0,1,3),cr.bind(void 0,1,0,1,0,0),cr.bind(void 0,1,0,1,0,1),cr.bind(void 0,1,0,1,0,2),cr.bind(void 0,1,0,1,0,3),cr.bind(void 0,1,0,1,1,0),cr.bind(void 0,1,0,1,1,1),cr.bind(void 0,1,0,1,1,2),cr.bind(void 0,1,0,1,1,3),cr.bind(void 0,1,1,0,0,0),cr.bind(void 0,1,1,0,0,1),cr.bind(void 0,1,1,0,0,2),cr.bind(void 0,1,1,0,0,3),cr.bind(void 0,1,1,0,1,0),cr.bind(void 0,1,1,0,1,1),cr.bind(void 0,1,1,0,1,2),cr.bind(void 0,1,1,0,1,3),cr.bind(void 0,1,1,1,0,0),cr.bind(void 0,1,1,1,0,1),cr.bind(void 0,1,1,1,0,2),cr.bind(void 0,1,1,1,0,3),cr.bind(void 0,1,1,1,1,0),cr.bind(void 0,1,1,1,1,1),cr.bind(void 0,1,1,1,1,2),cr.bind(void 0,1,1,1,1,3)];var B4=b0;function vc(s){this.char=s,this.state={},this.activeState=null}function af(s,o,u){this.contextName=u,this.startIndex=s,this.endOffset=o}function Q4(s,o,u){this.contextName=s,this.openRange=null,this.ranges=[],this.checkStart=o,this.checkEnd=u}function Pi(s,o){this.context=s,this.index=o,this.length=s.length,this.current=s[o],this.backtrack=s.slice(0,o),this.lookahead=s.slice(o+1)}function Ju(s){this.eventId=s,this.subscribers=[]}function j4(s){let o=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];for(let d=0;d<o.length;d++){let f=o[d];Object.defineProperty(this.events,f,{value:new Ju(f)})}if(s)for(let d=0;d<o.length;d++){let f=o[d],m=s[f];typeof m=="function"&&this.events[f].subscribe(m)}let u=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];for(let d=0;d<u.length;d++){let f=u[d];this.events[f].subscribe(this.updateContextsRanges)}}function bs(s){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],j4.call(this,s)}vc.prototype.setState=function(s,o){return this.state[s]=o,this.activeState={key:s,value:this.state[s]},this.activeState},vc.prototype.getState=function(s){return this.state[s]||null},bs.prototype.inboundIndex=function(s){return s>=0&&s<this.tokens.length},bs.prototype.composeRUD=function(s){let o=s.map(d=>this[d[0]].apply(this,d.slice(1).concat(!0))),u=d=>typeof d=="object"&&Object.prototype.hasOwnProperty.call(d,"FAIL");if(o.every(u))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:o.filter(u)};this.dispatch("composeRUD",[o.filter(d=>!u(d))])},bs.prototype.replaceRange=function(s,o,u,d){o=o!==null?o:this.tokens.length;let f=u.every(m=>m instanceof vc);if(!isNaN(s)&&this.inboundIndex(s)&&f){let m=this.tokens.splice.apply(this.tokens,[s,o].concat(u));return d||this.dispatch("replaceToken",[s,o,u]),[m,u]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},bs.prototype.replaceToken=function(s,o,u){if(!isNaN(s)&&this.inboundIndex(s)&&o instanceof vc){let d=this.tokens.splice(s,1,o);return u||this.dispatch("replaceToken",[s,o]),[d[0],o]}else return{FAIL:"replaceToken: invalid token or index."}},bs.prototype.removeRange=function(s,o,u){o=isNaN(o)?this.tokens.length:o;let d=this.tokens.splice(s,o);return u||this.dispatch("removeRange",[d,s,o]),d},bs.prototype.removeToken=function(s,o){if(!isNaN(s)&&this.inboundIndex(s)){let u=this.tokens.splice(s,1);return o||this.dispatch("removeToken",[u,s]),u}else return{FAIL:"removeToken: invalid token index."}},bs.prototype.insertToken=function(s,o,u){return s.every(d=>d instanceof vc)?(this.tokens.splice.apply(this.tokens,[o,0].concat(s)),u||this.dispatch("insertToken",[s,o]),s):{FAIL:"insertToken: invalid token(s)."}},bs.prototype.registerModifier=function(s,o,u){this.events.newToken.subscribe(function(d,f){let m=[d,f],v=o===null||o.apply(this,m)===!0,T=[d,f];if(v){let _=u.apply(this,T);d.setState(s,_)}}),this.registeredModifiers.push(s)},Ju.prototype.subscribe=function(s){return typeof s=="function"?this.subscribers.push(s)-1:{FAIL:`invalid '${this.eventId}' event handler`}},Ju.prototype.unsubscribe=function(s){this.subscribers.splice(s,1)},Pi.prototype.setCurrentIndex=function(s){this.index=s,this.current=this.context[s],this.backtrack=this.context.slice(0,s),this.lookahead=this.context.slice(s+1)},Pi.prototype.get=function(s){switch(!0){case s===0:return this.current;case(s<0&&Math.abs(s)<=this.backtrack.length):return this.backtrack.slice(s)[0];case(s>0&&s<=this.lookahead.length):return this.lookahead[s-1];default:return null}},bs.prototype.rangeToText=function(s){if(s instanceof af)return this.getRangeTokens(s).map(o=>o.char).join("")},bs.prototype.getText=function(){return this.tokens.map(s=>s.char).join("")},bs.prototype.getContext=function(s){return this.registeredContexts[s]||null},bs.prototype.on=function(s,o){let u=this.events[s];return u?u.subscribe(o):null},bs.prototype.dispatch=function(s,o){let u=this.events[s];if(u instanceof Ju)for(let d=0;d<u.subscribers.length;d++)u.subscribers[d].apply(this,o||[])},bs.prototype.registerContextChecker=function(s,o,u){if(this.getContext(s))return{FAIL:`context name '${s}' is already registered.`};if(typeof o!="function")return{FAIL:"missing context start check."};if(typeof u!="function")return{FAIL:"missing context end check."};let d=new Q4(s,o,u);return this.registeredContexts[s]=d,this.contextCheckers.push(d),d},bs.prototype.getRangeTokens=function(s){let o=s.startIndex+s.endOffset;return[].concat(this.tokens.slice(s.startIndex,o))},bs.prototype.getContextRanges=function(s){let o=this.getContext(s);return o?o.ranges:{FAIL:`context checker '${s}' is not registered.`}},bs.prototype.resetContextsRanges=function(){let s=this.registeredContexts;for(let o in s)if(Object.prototype.hasOwnProperty.call(s,o)){let u=s[o];u.ranges=[]}},bs.prototype.updateContextsRanges=function(){this.resetContextsRanges();let s=this.tokens.map(o=>o.char);for(let o=0;o<s.length;o++){let u=new Pi(s,o);this.runContextCheck(u)}this.dispatch("updateContextsRanges",[this.registeredContexts])},bs.prototype.setEndOffset=function(s,o){let u=this.getContext(o).openRange.startIndex,d=new af(u,s,o),f=this.getContext(o).ranges;return d.rangeId=`${o}.${f.length}`,f.push(d),this.getContext(o).openRange=null,d},bs.prototype.runContextCheck=function(s){let o=s.index;for(let u=0;u<this.contextCheckers.length;u++){let d=this.contextCheckers[u],f=d.contextName,m=this.getContext(f).openRange;if(!m&&d.checkStart(s)&&(m=new af(o,null,f),this.getContext(f).openRange=m,this.dispatch("contextStart",[f,o])),m&&d.checkEnd(s)){let v=o-m.startIndex+1,T=this.setEndOffset(v,f);this.dispatch("contextEnd",[f,T])}}},bs.prototype.tokenize=function(s){this.tokens=[],this.resetContextsRanges();let o=Array.from(s);this.dispatch("start");for(let u=0;u<o.length;u++){let d=o[u],f=new Pi(o,u);this.dispatch("next",[f]),this.runContextCheck(f);let m=new vc(d);this.tokens.push(m),this.dispatch("newToken",[m,f])}return this.dispatch("end",[this.tokens]),this.tokens};var P4=bs;function Al(s){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(s)}function Cm(s){return/[\u0630\u0690\u0621\u0631\u0661\u0671\u0622\u0632\u0672\u0692\u06C2\u0623\u0673\u0693\u06C3\u0624\u0694\u06C4\u0625\u0675\u0695\u06C5\u06E5\u0676\u0696\u06C6\u0627\u0677\u0697\u06C7\u0648\u0688\u0698\u06C8\u0689\u0699\u06C9\u068A\u06CA\u066B\u068B\u06CB\u068C\u068D\u06CD\u06FD\u068E\u06EE\u06FE\u062F\u068F\u06CF\u06EF]/.test(s)}function Tl(s){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(s)}function ed(s){return/[\u0E00-\u0E7F]/.test(s)}function td(s){return/[A-z]/.test(s)}function O4(s){return/\s/.test(s)}function ka(s){this.font=s,this.features={}}function Cl(s){this.id=s.id,this.tag=s.tag,this.substitution=s.substitution}function Sl(s,o){if(!s)return-1;switch(o.format){case 1:return o.glyphs.indexOf(s);case 2:{let u=o.ranges;for(let d=0;d<u.length;d++){let f=u[d];if(s>=f.start&&s<=f.end){let m=s-f.start;return f.index+m}}break}default:return-1}return-1}function F4(s,o){return Sl(s,o.coverage)===-1?null:s+o.deltaGlyphId}function $4(s,o){let u=Sl(s,o.coverage);return u===-1?null:o.substitute[u]}function of(s,o){let u=[];for(let d=0;d<s.length;d++){let f=s[d],m=o.current;m=Array.isArray(m)?m[0]:m;let v=Sl(m,f);v!==-1&&u.push(v)}return u.length!==s.length?-1:u}function U4(s,o){let u=o.inputCoverage.length+o.lookaheadCoverage.length+o.backtrackCoverage.length;if(s.context.length<u)return[];let d=of(o.inputCoverage,s);if(d===-1)return[];let f=o.inputCoverage.length-1;if(s.lookahead.length<o.lookaheadCoverage.length)return[];let m=s.lookahead.slice(f);for(;m.length&&Tl(m[0].char);)m.shift();let v=new Pi(m,0),T=of(o.lookaheadCoverage,v),_=[].concat(s.backtrack);for(_.reverse();_.length&&Tl(_[0].char);)_.shift();if(_.length<o.backtrackCoverage.length)return[];let R=new Pi(_,0),N=of(o.backtrackCoverage,R),G=d.length===o.inputCoverage.length&&T.length===o.lookaheadCoverage.length&&N.length===o.backtrackCoverage.length,W=[];if(G)for(let he=0;he<o.lookupRecords.length;he++){let ie=o.lookupRecords[he],ye=ie.lookupListIndex,Je=this.getLookupByIndex(ye);for(let gr=0;gr<Je.subtables.length;gr++){let or=Je.subtables[gr],Cr,Yr=this.getSubstitutionType(Je,or);if(Yr==="71"?(Yr=this.getSubstitutionType(or,or.extension),Cr=this.getLookupMethod(or,or.extension),or=or.extension):Cr=this.getLookupMethod(Je,or),Yr==="12"){let Dn=s.get(ie.sequenceIndex),zn=Cr(Dn);zn&&W.push(zn)}else if(Yr==="21"){let Dn=s.get(ie.sequenceIndex),zn=Cr(Dn);zn&&W.push(zn)}else throw new Error(`Substitution type ${Yr} is not supported in chaining substitution`)}}return W}function z4(s,o){let u=s.current,d=Sl(u,o.coverage);if(d===-1)return null;let f,m=o.ligatureSets[d];for(let v=0;v<m.length;v++){f=m[v];for(let T=0;T<f.components.length;T++){let _=s.lookahead[T],R=f.components[T];if(_!==R)break;if(T===f.components.length-1)return f}}return null}function H4(s,o){let u=s.current;if(Sl(u,o.coverage)===-1)return null;for(let d of o.ruleSets)for(let f of d){let m=!0;for(let v=0;v<f.input.length;v++)if(s.lookahead[v]!==f.input[v]){m=!1;break}if(m){let v=[];v.push(u);for(let _=0;_<f.input.length;_++)v.push(f.input[_]);let T=(_,R)=>{let{lookupListIndex:N,sequenceIndex:G}=R,{subtables:W}=this.getLookupByIndex(N);for(let he of W)Sl(_[G],he.coverage)!==-1&&(_[G]=he.deltaGlyphId)};for(let _=0;_<f.lookupRecords.length;_++){let R=f.lookupRecords[_];T(v,R)}return v}}return null}function W4(s,o){if(s.context.length<o.coverages.length)return[];for(let d=0;d<o.coverages.length;d++){let f=s.get(d);if(f=Array.isArray(f)?f[0]:f,Sl(f,o.coverages[d])===-1)return[]}let u=[];for(let d=0;d<o.lookupRecords.length;d++){let f=o.lookupRecords[d],m=f.lookupListIndex,v=this.getLookupByIndex(m);for(let T=0;T<v.subtables.length;T++){let _=v.subtables[T],R,N=this.getSubstitutionType(v,_);if(N==="71"?(N=this.getSubstitutionType(_,_.extension),R=this.getLookupMethod(_,_.extension),_=_.extension):R=this.getLookupMethod(v,_),N==="12"){let G=s.get(f.sequenceIndex),W=R(G);W&&u.push(W)}else if(N==="21"){let G=s.get(f.sequenceIndex),W=R(G);W&&u.push(W)}}}return u}function G4(s,o){let u=Sl(s,o.coverage);return u===-1?null:o.sequences[u]}ka.prototype.getDefaultScriptFeaturesIndexes=function(){let s=this.font.tables.gsub.scripts;for(let o=0;o<s.length;o++){let u=s[o];if(u.tag==="DFLT")return u.script.defaultLangSys.featureIndexes}return[]},ka.prototype.getScriptFeaturesIndexes=function(s){if(!this.font.tables.gsub)return[];if(!s)return this.getDefaultScriptFeaturesIndexes();let o=this.font.tables.gsub.scripts;for(let u=0;u<o.length;u++){let d=o[u];if(d.tag===s&&d.script.defaultLangSys)return d.script.defaultLangSys.featureIndexes;{let f=d.langSysRecords;if(f)for(let m=0;m<f.length;m++){let v=f[m];if(v.tag===s)return v.langSys.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},ka.prototype.mapTagsToFeatures=function(s,o){let u={};for(let d=0;d<s.length;d++){let f=s[d].tag,m=s[d].feature;u[f]=m}this.features[o].tags=u},ka.prototype.getScriptFeatures=function(s){let o=this.features[s];if(Object.prototype.hasOwnProperty.call(this.features,s))return o;let u=this.getScriptFeaturesIndexes(s);if(!u)return null;let d=this.font.tables.gsub;return o=u.map(f=>d.features[f]),this.features[s]=o,this.mapTagsToFeatures(o,s),o},ka.prototype.getSubstitutionType=function(s,o){let u=s.lookupType.toString(),d=o.substFormat.toString();return u+d},ka.prototype.getLookupMethod=function(s,o){let u=this.getSubstitutionType(s,o);switch(u){case"11":return d=>F4.apply(this,[d,o]);case"12":return d=>$4.apply(this,[d,o]);case"63":return d=>U4.apply(this,[d,o]);case"41":return d=>z4.apply(this,[d,o]);case"21":return d=>G4.apply(this,[d,o]);case"51":return d=>H4.apply(this,[d,o]);case"53":return d=>W4.apply(this,[d,o]);default:throw new Error(`substitutionType : ${u} lookupType: ${s.lookupType} - substFormat: ${o.substFormat} is not yet supported`)}},ka.prototype.lookupFeature=function(s){let o=s.contextParams,u=o.index,d=this.getFeature({tag:s.tag,script:s.script});if(!d)return new Error(`font '${(this.font.names.unicode||this.font.names.windows||this.font.names.macintosh).fullName.en}' doesn't support feature '${s.tag}' for script '${s.script}'.`);let f=this.getFeatureLookups(d),m=[].concat(o.context);for(let v=0;v<f.length;v++){let T=f[v],_=this.getLookupSubtables(T);for(let R=0;R<_.length;R++){let N=_[R],G=this.getSubstitutionType(T,N),W;G==="71"?(G=this.getSubstitutionType(N,N.extension),W=this.getLookupMethod(N,N.extension),N=N.extension):W=this.getLookupMethod(T,N);let he;switch(G){case"11":he=W(o.current),he&&m.splice(u,1,new Cl({id:11,tag:s.tag,substitution:he}));break;case"12":he=W(o.current),he&&m.splice(u,1,new Cl({id:12,tag:s.tag,substitution:he}));break;case"63":he=W(o),Array.isArray(he)&&he.length&&m.splice(u,1,new Cl({id:63,tag:s.tag,substitution:he}));break;case"41":he=W(o),he&&m.splice(u,1,new Cl({id:41,tag:s.tag,substitution:he}));break;case"21":he=W(o.current),he&&m.splice(u,1,new Cl({id:21,tag:s.tag,substitution:he}));break;case"51":case"53":he=W(o),Array.isArray(he)&&he.length&&m.splice(u,1,new Cl({id:parseInt(G),tag:s.tag,substitution:he}));break}o=new Pi(m,u),!(Array.isArray(he)&&!he.length)&&(he=null)}}return m.length?m:null},ka.prototype.supports=function(s){if(!s.script)return!1;this.getScriptFeatures(s.script);let o=Object.prototype.hasOwnProperty.call(this.features,s.script);if(!s.tag)return o;let u=this.features[s.script].some(d=>d.tag===s.tag);return o&&u},ka.prototype.getLookupSubtables=function(s){return s.subtables||null},ka.prototype.getLookupByIndex=function(s){return this.font.tables.gsub.lookups[s]||null},ka.prototype.getFeatureLookups=function(s){return s.lookupListIndexes.map(this.getLookupByIndex.bind(this))},ka.prototype.getFeature=function(s){if(!this.font)return{FAIL:"No font was found"};Object.prototype.hasOwnProperty.call(this.features,s.script)||this.getScriptFeatures(s.script);let o=this.features[s.script];return o?o.tags[s.tag]?this.features[s.script].tags[s.tag]:null:{FAIL:`No feature for script ${s.script}`}};var V4=ka;function q4(s){let o=s.current,u=s.get(-1);return u===null&&Al(o)||!Al(u)&&Al(o)}function Y4(s){let o=s.get(1);return o===null||!Al(o)}var Z4={startCheck:q4,endCheck:Y4};function K4(s){let o=s.current,u=s.get(-1);return(Al(o)||Tl(o))&&!Al(u)}function X4(s){let o=s.get(1);switch(!0){case o===null:return!0;case(!Al(o)&&!Tl(o)):{let u=O4(o);if(!u)return!0;if(u){let d=!1;if(d=s.lookahead.some(f=>Al(f)||Tl(f)),!d)return!0}break}default:return!1}}var J4={startCheck:K4,endCheck:X4};function ev(s,o,u){o[u].setState(s.tag,s.substitution)}function tv(s,o,u){o[u].setState(s.tag,s.substitution)}function lf(s,o,u){for(let d=0;d<s.substitution.length;d++){let f=s.substitution[d],m=o[u+d];if(Array.isArray(f)){f.length?m.setState(s.tag,f[0]):m.setState("deleted",!0);continue}m.setState(s.tag,f)}}function rv(s,o,u){let d=o[u];d.setState(s.tag,s.substitution.ligGlyph);let f=s.substitution.components.length;for(let m=0;m<f;m++)d=o[u+m+1],d.setState("deleted",!0)}var Sm={11:ev,12:tv,63:lf,41:rv,51:lf,53:lf};function nv(s,o,u){s instanceof Cl&&Sm[s.id]&&Sm[s.id](s,o,u)}var Wl=nv;function sv(s){let o=[].concat(s.backtrack);for(let u=o.length-1;u>=0;u--){let d=o[u],f=Cm(d),m=Tl(d);if(!f&&!m)return!0;if(f)return!1}return!1}function iv(s){if(Cm(s.current))return!1;for(let o=0;o<s.lookahead.length;o++){let u=s.lookahead[o];if(!Tl(u))return!0}return!1}function av(s){let o="arab",u=this.featuresTags[o],d=this.tokenizer.getRangeTokens(s);if(d.length===1)return;let f=new Pi(d.map(v=>v.getState("glyphIndex")),0),m=new Pi(d.map(v=>v.char),0);for(let v=0;v<d.length;v++){let T=d[v];if(Tl(T.char))continue;f.setCurrentIndex(v),m.setCurrentIndex(v);let _=0;sv(m)&&(_|=1),iv(m)&&(_|=2);let R;switch(_){case 1:R="fina";break;case 2:R="init";break;case 3:R="medi";break}if(u.indexOf(R)===-1)continue;let N=this.query.lookupFeature({tag:R,script:o,contextParams:f});if(N instanceof Error){console.info(N.message);continue}for(let G=0;G<N.length;G++){let W=N[G];W instanceof Cl&&(Wl(W,d,G),f.context[G]=W.substitution)}}}var ov=av;function _m(s,o){let u=s.map(d=>d.activeState.value);return new Pi(u,o||0)}function lv(s){let o="arab",u=this.tokenizer.getRangeTokens(s),d=_m(u);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"rlig",script:o,contextParams:d});if(m.length){for(let v=0;v<m.length;v++){let T=m[v];Wl(T,u,f)}d=_m(u)}}}var cv=lv;function uv(s){return s.index===0&&s.context.length>1}function dv(s){return s.index===s.context.length-1}var hv={startCheck:uv,endCheck:dv};function Lm(s,o){let u=s.map(d=>d.activeState.value);return new Pi(u,o||0)}function fv(s){let o="delf",u="ccmp",d=this.tokenizer.getRangeTokens(s),f=Lm(d);for(let m=0;m<f.context.length;m++){if(!this.query.getFeature({tag:u,script:o,contextParams:f}))continue;f.setCurrentIndex(m);let v=this.query.lookupFeature({tag:u,script:o,contextParams:f});if(v.length){for(let T=0;T<v.length;T++){let _=v[T];Wl(_,d,m)}f=Lm(d)}}}var pv=fv;function mv(s){let o=s.current,u=s.get(-1);return u===null&&td(o)||!td(u)&&td(o)}function gv(s){let o=s.get(1);return o===null||!td(o)}var xv={startCheck:mv,endCheck:gv};function km(s,o){let u=s.map(d=>d.activeState.value);return new Pi(u,o||0)}function bv(s){let o="latn",u=this.tokenizer.getRangeTokens(s),d=km(u);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"liga",script:o,contextParams:d});if(m.length){for(let v=0;v<m.length;v++){let T=m[v];Wl(T,u,f)}d=km(u)}}}var yv=bv;function vv(s){let o=s.current,u=s.get(-1);return u===null&&ed(o)||!ed(u)&&ed(o)}function wv(s){let o=s.get(1);return o===null||!ed(o)}var Av={startCheck:vv,endCheck:wv};function Im(s,o){let u=s.map(d=>d.activeState.value);return new Pi(u,o||0)}function Tv(s){let o="thai",u=this.tokenizer.getRangeTokens(s),d=Im(u,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"ccmp",script:o,contextParams:d});if(m.length){for(let v=0;v<m.length;v++){let T=m[v];Wl(T,u,f)}d=Im(u,f)}}}var Cv=Tv;function Em(s,o){let u=s.map(d=>d.activeState.value);return new Pi(u,o||0)}function Sv(s){let o="thai",u=this.tokenizer.getRangeTokens(s),d=Em(u,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"liga",script:o,contextParams:d});if(m.length){for(let v=0;v<m.length;v++){let T=m[v];Wl(T,u,f)}d=Em(u,f)}}}var _v=Sv;function Nm(s,o){let u=s.map(d=>d.activeState.value);return new Pi(u,o||0)}function Lv(s){let o="thai",u=this.tokenizer.getRangeTokens(s),d=Nm(u,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"rlig",script:o,contextParams:d});if(m.length){for(let v=0;v<m.length;v++){let T=m[v];Wl(T,u,f)}d=Nm(u,f)}}}var kv=Lv;function cf(s){if(s===null)return!1;let o=s.codePointAt(0);return o>=6155&&o<=6157||o>=65024&&o<=65039||o>=917760&&o<=917999}function Iv(s){let o=s.current,u=s.get(1);return u===null&&cf(o)||cf(u)}function Ev(s){let o=s.get(1);return o===null||!cf(o)}var Nv={startCheck:Iv,endCheck:Ev};function Rv(s){let o=this.query.font,u=this.tokenizer.getRangeTokens(s);if(u[1].setState("deleted",!0),o.tables.cmap&&o.tables.cmap.varSelectorList){let d=u[0].char.codePointAt(0),f=u[1].char.codePointAt(0),m=o.tables.cmap.varSelectorList[f];if(m!==void 0&&m.nonDefaultUVS){let v=m.nonDefaultUVS.uvsMappings;if(v[d]){let T=v[d].glyphID;o.glyphs.glyphs[T]!==void 0&&u[0].setState("glyphIndex",T)}}}}var Mv=Rv;function Wa(s){this.baseDir=s||"ltr",this.tokenizer=new P4,this.featuresTags={}}Wa.prototype.setText=function(s){this.text=s},Wa.prototype.contextChecks={ccmpReplacementCheck:hv,latinWordCheck:xv,arabicWordCheck:Z4,arabicSentenceCheck:J4,thaiWordCheck:Av,unicodeVariationSequenceCheck:Nv};function wc(s){let o=this.contextChecks[`${s}Check`];return this.tokenizer.registerContextChecker(s,o.startCheck,o.endCheck)}function Dv(){return wc.call(this,"ccmpReplacement"),wc.call(this,"latinWord"),wc.call(this,"arabicWord"),wc.call(this,"arabicSentence"),wc.call(this,"thaiWord"),wc.call(this,"unicodeVariationSequence"),this.tokenizer.tokenize(this.text)}function Bv(){let s=this.tokenizer.getContextRanges("arabicSentence");for(let o=0;o<s.length;o++){let u=s[o],d=this.tokenizer.getRangeTokens(u);this.tokenizer.replaceRange(u.startIndex,u.endOffset,d.reverse())}}Wa.prototype.registerFeatures=function(s,o){let u=o.filter(d=>this.query.supports({script:s,tag:d}));Object.prototype.hasOwnProperty.call(this.featuresTags,s)?this.featuresTags[s]=this.featuresTags[s].concat(u):this.featuresTags[s]=u},Wa.prototype.applyFeatures=function(s,o){if(!s)throw new Error("No valid font was provided to apply features");this.query||(this.query=new V4(s));for(let u=0;u<o.length;u++){let d=o[u];this.query.supports({script:d.script})&&this.registerFeatures(d.script,d.tags)}},Wa.prototype.registerModifier=function(s,o,u){this.tokenizer.registerModifier(s,o,u)};function w0(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function Qv(){if(!Object.prototype.hasOwnProperty.call(this.featuresTags,"arab"))return;w0.call(this);let s=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<s.length;o++){let u=s[o];ov.call(this,u)}}function jv(){w0.call(this);let s=this.tokenizer.getContextRanges("ccmpReplacement");for(let o=0;o<s.length;o++){let u=s[o];pv.call(this,u)}}function Pv(){if(!this.hasFeatureEnabled("arab","rlig"))return;w0.call(this);let s=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<s.length;o++){let u=s[o];cv.call(this,u)}}function Ov(){if(!this.hasFeatureEnabled("latn","liga"))return;w0.call(this);let s=this.tokenizer.getContextRanges("latinWord");for(let o=0;o<s.length;o++){let u=s[o];yv.call(this,u)}}function Fv(){let s=this.tokenizer.getContextRanges("unicodeVariationSequence");for(let o=0;o<s.length;o++){let u=s[o];Mv.call(this,u)}}function $v(){w0.call(this);let s=this.tokenizer.getContextRanges("thaiWord");for(let o=0;o<s.length;o++){let u=s[o];this.hasFeatureEnabled("thai","liga")&&_v.call(this,u),this.hasFeatureEnabled("thai","rlig")&&kv.call(this,u),this.hasFeatureEnabled("thai","ccmp")&&Cv.call(this,u)}}Wa.prototype.checkContextReady=function(s){return!!this.tokenizer.getContext(s)},Wa.prototype.applyFeaturesToContexts=function(){this.checkContextReady("ccmpReplacement")&&jv.call(this),this.checkContextReady("arabicWord")&&(Qv.call(this),Pv.call(this)),this.checkContextReady("latinWord")&&Ov.call(this),this.checkContextReady("arabicSentence")&&Bv.call(this),this.checkContextReady("thaiWord")&&$v.call(this),this.checkContextReady("unicodeVariationSequence")&&Fv.call(this)},Wa.prototype.hasFeatureEnabled=function(s,o){return(this.featuresTags[s]||[]).indexOf(o)!==-1},Wa.prototype.processText=function(s){(!this.text||this.text!==s)&&(this.setText(s),Dv.call(this),this.applyFeaturesToContexts())},Wa.prototype.getBidiText=function(s){return this.processText(s),this.tokenizer.getText()},Wa.prototype.getTextGlyphs=function(s){this.processText(s);let o=[];for(let u=0;u<this.tokenizer.tokens.length;u++){let d=this.tokenizer.tokens[u];if(d.state.deleted)continue;let f=d.activeState.value;o.push(Array.isArray(f)?f[0]:f)}return o};var Uv=Wa;function uf(s){return{fontFamily:{en:s.familyName||" "},fontSubfamily:{en:s.styleName||" "},fullName:{en:s.fullName||s.familyName+" "+s.styleName},postScriptName:{en:s.postScriptName||(s.familyName+s.styleName).replace(/\s/g,"")},designer:{en:s.designer||" "},designerURL:{en:s.designerURL||" "},manufacturer:{en:s.manufacturer||" "},manufacturerURL:{en:s.manufacturerURL||" "},license:{en:s.license||" "},licenseURL:{en:s.licenseURL||" "},version:{en:s.version||"Version 0.1"},description:{en:s.description||" "},copyright:{en:s.copyright||" "},trademark:{en:s.trademark||" "}}}function Fn(s){if(s=s||{},s.tables=s.tables||{},!s.empty){if(!s.familyName)throw new Error("When creating a new Font object, familyName is required.");if(!s.styleName)throw new Error("When creating a new Font object, styleName is required.");if(!s.unitsPerEm)throw new Error("When creating a new Font object, unitsPerEm is required.");if(!s.ascender)throw new Error("When creating a new Font object, ascender is required.");if(s.descender>0)throw new Error("When creating a new Font object, negative descender value is required.");this.names={},this.names.unicode=uf(s),this.names.macintosh=uf(s),this.names.windows=uf(s),this.unitsPerEm=s.unitsPerEm||1e3,this.ascender=s.ascender,this.descender=s.descender,this.createdTimestamp=s.createdTimestamp,this.italicAngle=s.italicAngle||0,this.weightClass=s.weightClass||0;let o=0;s.fsSelection?o=s.fsSelection:(this.italicAngle<0?o|=this.fsSelectionValues.ITALIC:this.italicAngle>0&&(o|=this.fsSelectionValues.OBLIQUE),this.weightClass>=600&&(o|=this.fsSelectionValues.BOLD),o===0&&(o=this.fsSelectionValues.REGULAR)),(!s.panose||!Array.isArray(s.panose))&&(s.panose=[0,0,0,0,0,0,0,0,0]),this.tables=Object.assign(s.tables,{os2:Object.assign({usWeightClass:s.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:s.widthClass||this.usWidthClasses.MEDIUM,bFamilyType:s.panose[0]||0,bSerifStyle:s.panose[1]||0,bWeight:s.panose[2]||0,bProportion:s.panose[3]||0,bContrast:s.panose[4]||0,bStrokeVariation:s.panose[5]||0,bArmStyle:s.panose[6]||0,bLetterform:s.panose[7]||0,bMidline:s.panose[8]||0,bXHeight:s.panose[9]||0,fsSelection:o},s.tables.os2)})}this.supported=!0,this.glyphs=new Pr.GlyphSet(this,s.glyphs||[]),this.encoding=new cn(this),this.position=new Sa(this),this.substitution=new Zh(this),this.tables=this.tables||{},this.tables=new Proxy(this.tables,{set:(o,u,d)=>(o[u]=d,o.fvar&&(o.gvar||o.cff2)&&!this.variation&&(this.variation=new Yu(this)),!0)}),this.palettes=new Wu(this),this.layers=new Kh(this),this.svgImages=new Xh(this),this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:this.outlinesFormat==="truetype"?this._hinting=new B4(this):null}})}Fn.prototype.hasChar=function(s){return this.encoding.charToGlyphIndex(s)>0},Fn.prototype.charToGlyphIndex=function(s){return this.encoding.charToGlyphIndex(s)},Fn.prototype.charToGlyph=function(s){let o=this.charToGlyphIndex(s),u=this.glyphs.get(o);return u||(u=this.glyphs.get(0)),u},Fn.prototype.updateFeatures=function(s){return this.defaultRenderOptions.features.map(o=>o.script==="latn"?{script:"latn",tags:o.tags.filter(u=>s[u])}:o)},Fn.prototype.stringToGlyphIndexes=function(s,o){let u=new Uv,d=m=>this.charToGlyphIndex(m.char);u.registerModifier("glyphIndex",null,d);let f=o?this.updateFeatures(o.features):this.defaultRenderOptions.features;return u.applyFeatures(this,f),u.getTextGlyphs(s)},Fn.prototype.stringToGlyphs=function(s,o){let u=this.stringToGlyphIndexes(s,o),d=u.length,f=new Array(d),m=this.glyphs.get(0);for(let v=0;v<d;v+=1)f[v]=this.glyphs.get(u[v])||m;return f},Fn.prototype.nameToGlyphIndex=function(s){return this.glyphNames.nameToGlyphIndex(s)},Fn.prototype.nameToGlyph=function(s){let o=this.nameToGlyphIndex(s),u=this.glyphs.get(o);return u||(u=this.glyphs.get(0)),u},Fn.prototype.glyphIndexToName=function(s){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(s):""},Fn.prototype.getKerningValue=function(s,o){s=s.index||s,o=o.index||o;let u=this.position.defaultKerningTables;return u?this.position.getKerningValue(u,s,o):this.kerningPairs[s+","+o]||0},Fn.prototype.defaultRenderOptions={kerning:!0,features:[{script:"arab",tags:["init","medi","fina","rlig"]},{script:"latn",tags:["liga","rlig"]},{script:"thai",tags:["liga","rlig","ccmp"]}],hinting:!1,usePalette:0,drawLayers:!0,drawSVG:!0},Fn.prototype.forEachGlyph=function(s,o,u,d,f,m){o=o!==void 0?o:0,u=u!==void 0?u:0,d=d!==void 0?d:72,f=Object.assign({},this.defaultRenderOptions,f);let v=1/this.unitsPerEm*d,T=this.stringToGlyphs(s,f),_;if(f.kerning){let R=f.script||this.position.getDefaultScriptName();_=this.position.getKerningTables(R,f.language)}for(let R=0;R<T.length;R+=1){let N=T[R];if(m.call(this,N,o,u,d,f),N.advanceWidth&&(o+=N.advanceWidth*v),f.kerning&&R<T.length-1){let G=_?this.position.getKerningValue(_,N.index,T[R+1].index):this.getKerningValue(N,T[R+1]);o+=G*v}f.letterSpacing?o+=f.letterSpacing*d:f.tracking&&(o+=f.tracking/1e3*d)}return o},Fn.prototype.getPath=function(s,o,u,d,f){f=Object.assign({},this.defaultRenderOptions,f);let m=new Ke;if(m._layers=[],oi(this,m,d),m.stroke){let v=1/(m.unitsPerEm||1e3)*d;m.strokeWidth*=v}return this.forEachGlyph(s,o,u,d,f,(v,T,_,R)=>{let N=v.getPath(T,_,R,f,this);if(f.drawSVG||f.drawLayers){let G=N._layers;if(G&&G.length){for(let W=0;W<G.length;W++){let he=G[W];m._layers.push(he)}return}}m.extend(N)}),m},Fn.prototype.getPaths=function(s,o,u,d,f){f=Object.assign({},this.defaultRenderOptions,f);let m=[];return this.forEachGlyph(s,o,u,d,f,function(v,T,_,R){let N=v.getPath(T,_,R,f,this);m.push(N)}),m},Fn.prototype.getAdvanceWidth=function(s,o,u){return u=Object.assign({},this.defaultRenderOptions,u),this.forEachGlyph(s,0,0,o,u,function(){})},Fn.prototype.draw=function(s,o,u,d,f,m){this.getPath(o,u,d,f,m).draw(s)},Fn.prototype.drawPoints=function(s,o,u,d,f,m){m=Object.assign({},this.defaultRenderOptions,m),this.forEachGlyph(o,u,d,f,m,function(v,T,_,R){v.drawPoints(s,T,_,R,m,this)})},Fn.prototype.drawMetrics=function(s,o,u,d,f,m){m=Object.assign({},this.defaultRenderOptions,m),this.forEachGlyph(o,u,d,f,m,function(v,T,_,R){v.drawMetrics(s,T,_,R)})},Fn.prototype.getEnglishName=function(s){let o=(this.names.unicode||this.names.macintosh||this.names.windows)[s];if(o)return o.en},Fn.prototype.validate=function(){let s=[],o=this;function u(f,m){f||(console.warn(`[opentype.js] ${m}`),s.push(m))}function d(f){let m=o.getEnglishName(f);u(m&&m.trim().length>0,"No English "+f+" specified.")}if(d("fontFamily"),d("weightName"),d("manufacturer"),d("copyright"),d("version"),u(this.unitsPerEm>0,"No unitsPerEm specified."),this.tables.colr){let f=this.tables.colr.baseGlyphRecords,m=-1;for(let v=0;v<f.length;v++){let T=f[v].glyphID;if(u(m<f[v].glyphID,`baseGlyphs must be sorted by GlyphID in ascending order, but glyphID ${T} comes after ${m}`),m>f[v].glyphID)break;m=T}}return s},Fn.prototype.toTables=function(){return Mn.fontToTable(this)},Fn.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},Fn.prototype.toArrayBuffer=function(){let s=this.toTables().encode(),o=new ArrayBuffer(s.length),u=new Uint8Array(o);for(let d=0;d<s.length;d++)u[d]=s[d];return o},Fn.prototype.download=function(){console.error("DEPRECATED: platform-specific actions are to be implemented on user-side")},Fn.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},Fn.prototype.macStyleValues={BOLD:1,ITALIC:2,UNDERLINE:4,OUTLINED:8,SHADOW:16,CONDENSED:32,EXTENDED:64},Fn.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},Fn.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};var Rm=Fn;function zv(s,o){let u=new st.Parser(s,o),d=u.parseUShort(),f=u.parseUShort();d!==1&&console.warn(`Unsupported hvar table version ${d}.${f}`);let m=[d,f],v=u.parsePointer32(function(){return this.parseItemVariationStore()}),T=u.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),_=u.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),R=u.parsePointer32(function(){return this.parseDeltaSetIndexMap()});return{version:m,itemVariationStore:v,advanceWidth:T,lsb:_,rsb:R}}function Hv(){console.warn("Writing of hvar tables is not yet supported.")}var Wv={make:Hv,parse:zv},Gv=function(){return{coverage:this.parsePointer(ue.coverage),attachPoints:this.parseList(ue.pointer(ue.uShortList))}},Vv=function(){var s=this.parseUShort();if(ge.argument(s===1||s===2||s===3,"Unsupported CaretValue table version."),s===1)return{coordinate:this.parseShort()};if(s===2)return{pointindex:this.parseShort()};if(s===3)return{coordinate:this.parseShort()}},qv=function(){return this.parseList(ue.pointer(Vv))},Yv=function(){return{coverage:this.parsePointer(ue.coverage),ligGlyphs:this.parseList(ue.pointer(qv))}},Zv=function(){return this.parseUShort(),this.parseList(ue.pointer(ue.coverage))};function Kv(s,o){o=o||0;let u=new ue(s,o),d=u.parseVersion(1);ge.argument(d===1||d===1.2||d===1.3,"Unsupported GDEF table version.");var f={version:d,classDef:u.parsePointer(ue.classDef),attachList:u.parsePointer(Gv),ligCaretList:u.parsePointer(Yv),markAttachClassDef:u.parsePointer(ue.classDef)};return d>=1.2&&(f.markGlyphSets=u.parsePointer(Zv)),f}var Xv={parse:Kv},bo=new Array(10);bo[1]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{posFormat:1,coverage:this.parsePointer(ue.coverage),value:this.parseValueRecord()};if(o===2)return{posFormat:2,coverage:this.parsePointer(ue.coverage),values:this.parseValueRecordList()};ge.assert(!1,"0x"+s.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},bo[2]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();ge.assert(o===1||o===2,"0x"+s.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");let u=this.parsePointer(ue.coverage),d=this.parseUShort(),f=this.parseUShort();if(o===1)return{posFormat:o,coverage:u,valueFormat1:d,valueFormat2:f,pairSets:this.parseList(ue.pointer(ue.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(d),value2:this.parseValueRecord(f)}})))};if(o===2){let m=this.parsePointer(ue.classDef),v=this.parsePointer(ue.classDef),T=this.parseUShort(),_=this.parseUShort();return{posFormat:o,coverage:u,valueFormat1:d,valueFormat2:f,classDef1:m,classDef2:v,class1Count:T,class2Count:_,classRecords:this.parseList(T,ue.list(_,function(){return{value1:this.parseValueRecord(d),value2:this.parseValueRecord(f)}}))}}},bo[3]=function(){return{error:"GPOS Lookup 3 not supported"}},bo[4]=function(){return{error:"GPOS Lookup 4 not supported"}},bo[5]=function(){return{error:"GPOS Lookup 5 not supported"}},bo[6]=function(){return{error:"GPOS Lookup 6 not supported"}},bo[7]=function(){return{error:"GPOS Lookup 7 not supported"}},bo[8]=function(){return{error:"GPOS Lookup 8 not supported"}},bo[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function Jv(s,o){o=o||0;let u=new ue(s,o),d=u.parseVersion(1);return ge.argument(d===1||d===1.1,"Unsupported GPOS table version "+d),d===1?{version:d,scripts:u.parseScriptList(),features:u.parseFeatureList(),lookups:u.parseLookupList(bo)}:{version:d,scripts:u.parseScriptList(),features:u.parseFeatureList(),lookups:u.parseLookupList(bo),variations:u.parseFeatureVariationsList()}}var e7=new Array(10);function t7(s){return new Fe.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Fe.ScriptList(s.scripts)},{name:"features",type:"TABLE",value:new Fe.FeatureList(s.features)},{name:"lookups",type:"TABLE",value:new Fe.LookupList(s.lookups,e7)}])}var r7={parse:Jv,make:t7};function n7(s){let o={};s.skip("uShort");let u=s.parseUShort();ge.argument(u===0,"Unsupported kern sub-table version."),s.skip("uShort",2);let d=s.parseUShort();s.skip("uShort",3);for(let f=0;f<d;f+=1){let m=s.parseUShort(),v=s.parseUShort(),T=s.parseShort();o[m+","+v]=T}return o}function s7(s){let o={};s.skip("uShort"),s.parseULong()>1&&console.warn("Only the first kern subtable is supported."),s.skip("uLong");let u=s.parseUShort()&255;if(s.skip("uShort"),u===0){let d=s.parseUShort();s.skip("uShort",3);for(let f=0;f<d;f+=1){let m=s.parseUShort(),v=s.parseUShort(),T=s.parseShort();o[m+","+v]=T}}return o}function i7(s,o){let u=new st.Parser(s,o),d=u.parseUShort();if(d===0)return n7(u);if(d===1)return s7(u);throw new Error("Unsupported kern table version ("+d+").")}var a7={parse:i7};function o7(s,o,u,d){let f=new st.Parser(s,o),m=d?f.parseUShort:f.parseULong,v=[];for(let T=0;T<u+1;T+=1){let _=m.call(f);d&&(_*=2),v.push(_)}return v}var l7={parse:o7};function Mm(s,o){let u=[],d=12;for(let f=0;f<o;f+=1){let m=st.getTag(s,d),v=st.getULong(s,d+4),T=st.getULong(s,d+8),_=st.getULong(s,d+12);u.push({tag:m,checksum:v,offset:T,length:_,compression:!1}),d+=16}return u}function c7(s,o){let u=[],d=44;for(let f=0;f<o;f+=1){let m=st.getTag(s,d),v=st.getULong(s,d+4),T=st.getULong(s,d+8),_=st.getULong(s,d+12),R;T<_?R="WOFF":R=!1,u.push({tag:m,offset:v,compression:R,compressedLength:T,length:_}),d+=20}return u}function En(s,o){if(o.compression==="WOFF"){let u=new Uint8Array(s.buffer,o.offset+2,o.compressedLength-2),d=new Uint8Array(o.length);if(re(u,d),d.byteLength!==o.length)throw new Error("Decompression error: "+o.tag+" decompressed length doesn't match recorded length");return{data:new DataView(d.buffer,0),offset:0}}else return{data:s,offset:o.offset}}function u7(s,o={}){let u,d,f=new Rm({empty:!0});s.constructor!==ArrayBuffer&&(s=new Uint8Array(s).buffer);let m=new DataView(s,0),v,T=[],_=st.getTag(m,0);if(_==="\0\0\0"||_==="true"||_==="typ1")f.outlinesFormat="truetype",v=st.getUShort(m,4),T=Mm(m,v);else if(_==="OTTO")f.outlinesFormat="cff",v=st.getUShort(m,4),T=Mm(m,v);else if(_==="wOFF"){let xr=st.getTag(m,4);if(xr==="\0\0\0")f.outlinesFormat="truetype";else if(xr==="OTTO")f.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+_);v=st.getUShort(m,12),T=c7(m,v)}else if(_==="wOF2"){let xr="https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025";throw new Error("WOFF2 require an external decompressor library, see examples at: "+xr)}else throw new Error("Unsupported OpenType signature "+_);let R,N,G,W,he,ie,ye,Je,gr,or,Cr,Yr,Dn,zn,Hn,Ns,yo,Zr;for(let xr=0;xr<v;xr+=1){let nr=T[xr],ir;switch(nr.tag){case"avar":ye=nr;break;case"cmap":ir=En(m,nr),f.tables.cmap=Sr.parse(ir.data,ir.offset),f.encoding=new H(f.tables.cmap);break;case"cvt ":ir=En(m,nr),Zr=new st.Parser(ir.data,ir.offset),f.tables.cvt=Zr.parseShortList(nr.length/2);break;case"fvar":G=nr;break;case"STAT":W=nr;break;case"gvar":he=nr;break;case"cvar":ie=nr;break;case"fpgm":ir=En(m,nr),Zr=new st.Parser(ir.data,ir.offset),f.tables.fpgm=Zr.parseByteList(nr.length);break;case"head":ir=En(m,nr),f.tables.head=us.parse(ir.data,ir.offset),f.unitsPerEm=f.tables.head.unitsPerEm,u=f.tables.head.indexToLocFormat;break;case"hhea":ir=En(m,nr),f.tables.hhea=Xn.parse(ir.data,ir.offset),f.ascender=f.tables.hhea.ascender,f.descender=f.tables.hhea.descender,f.numberOfHMetrics=f.tables.hhea.numberOfHMetrics;break;case"HVAR":Dn=nr;break;case"hmtx":Yr=nr;break;case"ltag":ir=En(m,nr),d=Ko.parse(ir.data,ir.offset);break;case"COLR":ir=En(m,nr),f.tables.colr=di.parse(ir.data,ir.offset);break;case"CPAL":ir=En(m,nr),f.tables.cpal=Vr.parse(ir.data,ir.offset);break;case"maxp":ir=En(m,nr),f.tables.maxp=Eo.parse(ir.data,ir.offset),f.numGlyphs=f.tables.maxp.numGlyphs;break;case"name":Ns=nr;break;case"OS/2":ir=En(m,nr),f.tables.os2=Li.parse(ir.data,ir.offset);break;case"post":ir=En(m,nr),f.tables.post=po.parse(ir.data,ir.offset),f.glyphNames=new Pe(f.tables.post);break;case"prep":ir=En(m,nr),Zr=new st.Parser(ir.data,ir.offset),f.tables.prep=Zr.parseByteList(nr.length);break;case"glyf":Je=nr;break;case"loca":Hn=nr;break;case"CFF ":R=nr;break;case"CFF2":N=nr;break;case"kern":zn=nr;break;case"GDEF":gr=nr;break;case"GPOS":or=nr;break;case"GSUB":Cr=nr;break;case"meta":yo=nr;break;case"gasp":try{ir=En(m,nr),f.tables.gasp=L.parse(ir.data,ir.offset)}catch(Ei){console.warn("Failed to parse gasp table, skipping."),console.warn(Ei)}break;case"SVG ":ir=En(m,nr),f.tables.svg=z.parse(ir.data,ir.offset);break;default:break}}let Ia=En(m,Ns);if(f.tables.name=rn.parse(Ia.data,Ia.offset,d),f.names=f.tables.name,Je&&Hn){let xr=u===0,nr=En(m,Hn),ir=l7.parse(nr.data,nr.offset,f.numGlyphs,xr),Ei=En(m,Je);f.glyphs=m0.parse(Ei.data,Ei.offset,ir,f,o)}else if(R){let xr=En(m,R);Yi.parse(xr.data,xr.offset,f,o)}else if(N){let xr=En(m,N);Yi.parse(xr.data,xr.offset,f,o)}else throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");let Oi=En(m,Yr);if(Oa.parse(f,Oi.data,Oi.offset,f.numberOfHMetrics,f.numGlyphs,f.glyphs,o),lt(f,o),zn){let xr=En(m,zn);f.kerningPairs=a7.parse(xr.data,xr.offset)}else f.kerningPairs={};if(gr){let xr=En(m,gr);f.tables.gdef=Xv.parse(xr.data,xr.offset)}if(or){let xr=En(m,or);f.tables.gpos=r7.parse(xr.data,xr.offset),f.position.init()}if(Cr){let xr=En(m,Cr);f.tables.gsub=ui.parse(xr.data,xr.offset)}if(G){let xr=En(m,G);f.tables.fvar=hi.parse(xr.data,xr.offset,f.names)}if(W){let xr=En(m,W);f.tables.stat=Qi.parse(xr.data,xr.offset,f.tables.fvar)}if(he){G||console.warn("This font provides a gvar table, but no fvar table, which is required for variable fonts."),Je||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let xr=En(m,he);f.tables.gvar=yt.parse(xr.data,xr.offset,f.tables.fvar,f.glyphs)}if(ie){G||console.warn("This font provides a cvar table, but no fvar table, which is required for variable fonts."),f.tables.cvt||console.warn("This font provides a cvar table, but no cvt table which could be made variable."),Je||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let xr=En(m,ie);f.tables.cvar=mt.parse(xr.data,xr.offset,f.tables.fvar,f.tables.cvt||[])}if(ye){G||console.warn("This font provides an avar table, but no fvar table, which is required for variable fonts.");let xr=En(m,ye);f.tables.avar=Ca.parse(xr.data,xr.offset,f.tables.fvar)}if(Dn){G||console.warn("This font provides an HVAR table, but no fvar table, which is required for variable fonts."),Yr||console.warn("This font provides an HVAR table, but no hmtx table to vary.");let xr=En(m,Dn);f.tables.hvar=Wv.parse(xr.data,xr.offset,f.tables.fvar)}if(yo){let xr=En(m,yo);f.tables.meta=zs.parse(xr.data,xr.offset),f.metas=f.tables.meta}return f.palettes=new Wu(f),f}function d7(){console.error("DEPRECATED! migrate to: opentype.parse(buffer, opt) See: https://github.com/opentypejs/opentype.js/issues/675")}function h7(){console.error('DEPRECATED! migrate to: opentype.parse(require("fs").readFileSync(url), opt)')}return g(x)})();(function(n,i){typeof define=="function"&&define.amd?define(i):typeof t=="object"&&t.exports?t.exports=i():n.opentype=i()})(typeof self<"u"?self:e,()=>({...r,default:r}))}),YS=VS(qS()),yi=Oc("lru-cache:metrics"),au=PS("lru-cache"),ZS=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Df=()=>yi.hasSubscribers||au.hasSubscribers,Zb=new Set,jg=typeof process=="object"&&process?process:{},KS=(e,t,r,n)=>{typeof jg.emitWarning=="function"?jg.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)},XS=e=>!Zb.has(e),Ml=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),Kb=e=>Ml(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?qd:null:null,qd=class extends Array{constructor(e){super(e),this.fill(0)}},Xl,E0,JS=(Xl=class{constructor(e,t){if(js(this,"heap"),js(this,"length"),!Z(Xl,E0))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){let t=Kb(e);if(!t)return[];Tr(Xl,E0,!0);let r=new Xl(e,t);return Tr(Xl,E0,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},E0=new WeakMap,dn(Xl,E0,!1),Xl),Pg,Og,Ao,Ya,Qo,Sc,jo,N0,R0,Po,Ys,Za,Qs,hs,$r,sa,Ka,zi,mi,Oo,gi,Fo,$o,Xa,Ja,Uo,M0,ia,_c,zt,Bf,Lc,Ll,hd,eo,Fg,kc,D0,fd,kl,Il,Qf,Ic,pd,$g,Ug,md,es,jf,zg,Hg,B0,Pf,Q0,El,Of,Ff,e_=(Ff=class{constructor(e){dn(this,zt),dn(this,Ao),dn(this,Ya),dn(this,Qo),dn(this,Sc),dn(this,jo),dn(this,N0),dn(this,R0),dn(this,Po),js(this,"ttl"),js(this,"ttlResolution"),js(this,"ttlAutopurge"),js(this,"updateAgeOnGet"),js(this,"updateAgeOnHas"),js(this,"allowStale"),js(this,"noDisposeOnSet"),js(this,"noUpdateTTL"),js(this,"maxEntrySize"),js(this,"sizeCalculation"),js(this,"noDeleteOnFetchRejection"),js(this,"noDeleteOnStaleGet"),js(this,"allowStaleOnFetchAbort"),js(this,"allowStaleOnFetchRejection"),js(this,"ignoreFetchAbort"),js(this,"backgroundFetchSize"),dn(this,Ys),dn(this,Za),dn(this,Qs),dn(this,hs),dn(this,$r),dn(this,sa),dn(this,Ka),dn(this,zi),dn(this,mi),dn(this,Oo),dn(this,gi),dn(this,Fo),dn(this,$o),dn(this,Xa),dn(this,Ja),dn(this,Uo),dn(this,M0),dn(this,ia),dn(this,_c),dn(this,Lc,()=>{}),dn(this,Ll,()=>{}),dn(this,hd,()=>{}),dn(this,eo,()=>!1),dn(this,kc,de=>{}),dn(this,D0,(de,oe,Oe)=>{}),dn(this,fd,(de,oe,Oe,et)=>{if(Oe||et)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0}),js(this,Pg,"LRUCache");let{max:t=0,ttl:r,ttlResolution:n=1,ttlAutopurge:i,updateAgeOnGet:l,updateAgeOnHas:c,allowStale:h,dispose:p,onInsert:g,disposeAfter:x,noDisposeOnSet:b,noUpdateTTL:w,maxSize:A=0,maxEntrySize:k=0,sizeCalculation:E,fetchMethod:I,memoMethod:M,noDeleteOnFetchRejection:Q,noDeleteOnStaleGet:j,allowStaleOnFetchRejection:F,allowStaleOnFetchAbort:V,ignoreFetchAbort:$,backgroundFetchSize:te=1,perf:se}=e;if(this.backgroundFetchSize=te,se!==void 0&&typeof se?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(Tr(this,Po,se??ZS),t!==0&&!Ml(t))throw new TypeError("max option must be a nonnegative integer");let qe=t?Kb(t):Array;if(!qe)throw new Error("invalid max value: "+t);if(Tr(this,Ao,t),Tr(this,Ya,A),this.maxEntrySize=k||Z(this,Ya),this.sizeCalculation=E,this.sizeCalculation){if(!Z(this,Ya)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(M!==void 0&&typeof M!="function")throw new TypeError("memoMethod must be a function if defined");if(Tr(this,R0,M),I!==void 0&&typeof I!="function")throw new TypeError("fetchMethod must be a function if specified");if(Tr(this,N0,I),Tr(this,M0,!!I),Tr(this,Qs,new Map),Tr(this,hs,Array.from({length:t}).fill(void 0)),Tr(this,$r,Array.from({length:t}).fill(void 0)),Tr(this,sa,new qe(t)),Tr(this,Ka,new qe(t)),Tr(this,zi,0),Tr(this,mi,0),Tr(this,Oo,JS.create(t)),Tr(this,Ys,0),Tr(this,Za,0),typeof p=="function"&&Tr(this,Qo,p),typeof g=="function"&&Tr(this,Sc,g),typeof x=="function"?(Tr(this,jo,x),Tr(this,gi,[])):(Tr(this,jo,void 0),Tr(this,gi,void 0)),Tr(this,Uo,!!Z(this,Qo)),Tr(this,_c,!!Z(this,Sc)),Tr(this,ia,!!Z(this,jo)),this.noDisposeOnSet=!!b,this.noUpdateTTL=!!w,this.noDeleteOnFetchRejection=!!Q,this.allowStaleOnFetchRejection=!!F,this.allowStaleOnFetchAbort=!!V,this.ignoreFetchAbort=!!$,this.maxEntrySize!==0){if(Z(this,Ya)!==0&&!Ml(Z(this,Ya)))throw new TypeError("maxSize must be a positive integer if specified");if(!Ml(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Vt(this,zt,Fg).call(this)}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!j,this.updateAgeOnGet=!!l,this.updateAgeOnHas=!!c,this.ttlResolution=Ml(n)||n===0?n:1,this.ttlAutopurge=!!i,this.ttl=r||0,this.ttl){if(!Ml(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Vt(this,zt,Bf).call(this)}if(Z(this,Ao)===0&&this.ttl===0&&Z(this,Ya)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!Z(this,Ao)&&!Z(this,Ya)){let de="LRU_CACHE_UNBOUNDED";XS(de)&&(Zb.add(de),KS("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",de,Ff))}}get perf(){return Z(this,Po)}static unsafeExposeInternals(e){return{starts:Z(e,$o),ttls:Z(e,Xa),autopurgeTimers:Z(e,Ja),sizes:Z(e,Fo),keyMap:Z(e,Qs),keyList:Z(e,hs),valList:Z(e,$r),next:Z(e,sa),prev:Z(e,Ka),get head(){return Z(e,zi)},get tail(){return Z(e,mi)},free:Z(e,Oo),isBackgroundFetch:t=>{var r;return Vt(r=e,zt,es).call(r,t)},backgroundFetch:(t,r,n,i)=>{var l;return Vt(l=e,zt,md).call(l,t,r,n,i)},moveToTail:t=>{var r;return Vt(r=e,zt,Q0).call(r,t)},indexes:t=>{var r;return Vt(r=e,zt,kl).call(r,t)},rindexes:t=>{var r;return Vt(r=e,zt,Il).call(r,t)},isStale:t=>{var r;return Z(r=e,eo).call(r,t)}}}get max(){return Z(this,Ao)}get maxSize(){return Z(this,Ya)}get calculatedSize(){return Z(this,Za)}get size(){return Z(this,Ys)}get fetchMethod(){return Z(this,N0)}get memoMethod(){return Z(this,R0)}get dispose(){return Z(this,Qo)}get onInsert(){return Z(this,Sc)}get disposeAfter(){return Z(this,jo)}getRemainingTTL(e){return Z(this,Qs).has(e)?1/0:0}*entries(){for(let e of Vt(this,zt,kl).call(this))Z(this,$r)[e]!==void 0&&Z(this,hs)[e]!==void 0&&!Vt(this,zt,es).call(this,Z(this,$r)[e])&&(yield[Z(this,hs)[e],Z(this,$r)[e]])}*rentries(){for(let e of Vt(this,zt,Il).call(this))Z(this,$r)[e]!==void 0&&Z(this,hs)[e]!==void 0&&!Vt(this,zt,es).call(this,Z(this,$r)[e])&&(yield[Z(this,hs)[e],Z(this,$r)[e]])}*keys(){for(let e of Vt(this,zt,kl).call(this)){let t=Z(this,hs)[e];t!==void 0&&!Vt(this,zt,es).call(this,Z(this,$r)[e])&&(yield t)}}*rkeys(){for(let e of Vt(this,zt,Il).call(this)){let t=Z(this,hs)[e];t!==void 0&&!Vt(this,zt,es).call(this,Z(this,$r)[e])&&(yield t)}}*values(){for(let e of Vt(this,zt,kl).call(this))Z(this,$r)[e]!==void 0&&!Vt(this,zt,es).call(this,Z(this,$r)[e])&&(yield Z(this,$r)[e])}*rvalues(){for(let e of Vt(this,zt,Il).call(this))Z(this,$r)[e]!==void 0&&!Vt(this,zt,es).call(this,Z(this,$r)[e])&&(yield Z(this,$r)[e])}[(Og=Symbol.iterator,Pg=Symbol.toStringTag,Og)](){return this.entries()}find(e,t={}){for(let r of Vt(this,zt,kl).call(this)){let n=Z(this,$r)[r],i=Vt(this,zt,es).call(this,n)?n.__staleWhileFetching:n;if(i!==void 0&&e(i,Z(this,hs)[r],this))return Vt(this,zt,B0).call(this,Z(this,hs)[r],t)}}forEach(e,t=this){for(let r of Vt(this,zt,kl).call(this)){let n=Z(this,$r)[r],i=Vt(this,zt,es).call(this,n)?n.__staleWhileFetching:n;i!==void 0&&e.call(t,i,Z(this,hs)[r],this)}}rforEach(e,t=this){for(let r of Vt(this,zt,Il).call(this)){let n=Z(this,$r)[r],i=Vt(this,zt,es).call(this,n)?n.__staleWhileFetching:n;i!==void 0&&e.call(t,i,Z(this,hs)[r],this)}}purgeStale(){let e=!1;for(let t of Vt(this,zt,Il).call(this,{allowStale:!0}))Z(this,eo).call(this,t)&&(Vt(this,zt,El).call(this,Z(this,hs)[t],"expire"),e=!0);return e}info(e){let t=Z(this,Qs).get(e);if(t===void 0)return;let r=Z(this,$r)[t],n=Vt(this,zt,es).call(this,r)?r.__staleWhileFetching:r;if(n===void 0)return;let i={value:n};if(Z(this,Xa)&&Z(this,$o)){let l=Z(this,Xa)[t],c=Z(this,$o)[t];if(l&&c){let h=l-(Z(this,Po).now()-c);i.ttl=h,i.start=Date.now()}}return Z(this,Fo)&&(i.size=Z(this,Fo)[t]),i}dump(){let e=[];for(let t of Vt(this,zt,kl).call(this,{allowStale:!0})){let r=Z(this,hs)[t],n=Z(this,$r)[t],i=Vt(this,zt,es).call(this,n)?n.__staleWhileFetching:n;if(i===void 0||r===void 0)continue;let l={value:i};if(Z(this,Xa)&&Z(this,$o)){l.ttl=Z(this,Xa)[t];let c=Z(this,Po).now()-Z(this,$o)[t];l.start=Math.floor(Date.now()-c)}Z(this,Fo)&&(l.size=Z(this,Fo)[t]),e.unshift([r,l])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let n=Date.now()-r.start;r.start=Z(this,Po).now()-n}Vt(this,zt,Ic).call(this,t,r.value,r)}}set(e,t,r={}){let{status:n=yi.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="set",n.key=e,t!==void 0&&(n.value=t),n.cache=this);let i=Vt(this,zt,Ic).call(this,e,t,r);return n&&yi.hasSubscribers&&yi.publish(n),i}pop(){var e;try{for(;Z(this,Ys);){let t=Z(this,$r)[Z(this,zi)];if(Vt(this,zt,pd).call(this,!0),Vt(this,zt,es).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(Z(this,ia)&&Z(this,gi)){let t=Z(this,gi),r;for(;r=t?.shift();)(e=Z(this,jo))==null||e.call(this,...r)}}}has(e,t={}){let{status:r=yi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="has",r.key=e,r.cache=this);let n=Vt(this,zt,$g).call(this,e,t);return yi.hasSubscribers&&yi.publish(r),n}peek(e,t={}){let{status:r=Df()?{}:void 0}=t;r&&(r.op="peek",r.key=e,r.cache=this),t.status=r;let n=Vt(this,zt,Ug).call(this,e,t);return yi.hasSubscribers&&yi.publish(r),n}fetch(e,t={}){let r=au.hasSubscribers,{status:n=Df()?{}:void 0}=t;t.status=n,n&&t.context&&(n.context=t.context);let i=Vt(this,zt,jf).call(this,e,t);return n&&r&&(n.trace=!0,au.tracePromise(()=>i,n).catch(()=>{})),i}forceFetch(e,t={}){let r=au.hasSubscribers,{status:n=Df()?{}:void 0}=t;t.status=n,n&&t.context&&(n.context=t.context);let i=Vt(this,zt,zg).call(this,e,t);return n&&r&&(n.trace=!0,au.tracePromise(()=>i,n).catch(()=>{})),i}memo(e,t={}){let{status:r=yi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="memo",r.key=e,t.context&&(r.context=t.context),r.cache=this);let n=Vt(this,zt,Hg).call(this,e,t);return r&&(r.value=n),yi.hasSubscribers&&yi.publish(r),n}get(e,t={}){let{status:r=yi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="get",r.key=e,r.cache=this);let n=Vt(this,zt,B0).call(this,e,t);return r&&(n!==void 0&&(r.value=n),yi.hasSubscribers&&yi.publish(r)),n}delete(e){return Vt(this,zt,El).call(this,e,"delete")}clear(){return Vt(this,zt,Of).call(this,"delete")}},Ao=new WeakMap,Ya=new WeakMap,Qo=new WeakMap,Sc=new WeakMap,jo=new WeakMap,N0=new WeakMap,R0=new WeakMap,Po=new WeakMap,Ys=new WeakMap,Za=new WeakMap,Qs=new WeakMap,hs=new WeakMap,$r=new WeakMap,sa=new WeakMap,Ka=new WeakMap,zi=new WeakMap,mi=new WeakMap,Oo=new WeakMap,gi=new WeakMap,Fo=new WeakMap,$o=new WeakMap,Xa=new WeakMap,Ja=new WeakMap,Uo=new WeakMap,M0=new WeakMap,ia=new WeakMap,_c=new WeakMap,zt=new WeakSet,Bf=function(){let e=new qd(Z(this,Ao)),t=new qd(Z(this,Ao));Tr(this,Xa,e),Tr(this,$o,t);let r=this.ttlAutopurge?Array.from({length:Z(this,Ao)}):void 0;Tr(this,Ja,r),Tr(this,hd,(c,h,p=Z(this,Po).now())=>{t[c]=h!==0?p:0,e[c]=h,n(c,h)}),Tr(this,Lc,c=>{t[c]=e[c]!==0?Z(this,Po).now():0,n(c,e[c])});let n=this.ttlAutopurge?(c,h)=>{if(r?.[c]&&(clearTimeout(r[c]),r[c]=void 0),h&&h!==0&&r){let p=setTimeout(()=>{Z(this,eo).call(this,c)&&Vt(this,zt,El).call(this,Z(this,hs)[c],"expire")},h+1);p.unref&&p.unref(),r[c]=p}}:()=>{};Tr(this,Ll,(c,h)=>{if(e[h]){let p=e[h],g=t[h];if(!p||!g)return;c.ttl=p,c.start=g,c.now=i||l();let x=c.now-g;c.remainingTTL=p-x}});let i=0,l=()=>{let c=Z(this,Po).now();if(this.ttlResolution>0){i=c;let h=setTimeout(()=>i=0,this.ttlResolution);h.unref&&h.unref()}return c};this.getRemainingTTL=c=>{let h=Z(this,Qs).get(c);if(h===void 0)return 0;let p=e[h],g=t[h];if(!p||!g)return 1/0;let x=(i||l())-g;return p-x},Tr(this,eo,c=>{let h=t[c],p=e[c];return!!p&&!!h&&(i||l())-h>p})},Lc=new WeakMap,Ll=new WeakMap,hd=new WeakMap,eo=new WeakMap,Fg=function(){let e=new qd(Z(this,Ao));Tr(this,Za,0),Tr(this,Fo,e),Tr(this,kc,t=>{Tr(this,Za,Z(this,Za)-e[t]),e[t]=0}),Tr(this,fd,(t,r,n,i)=>{if(!Ml(n)){if(Vt(this,zt,es).call(this,r))return this.backgroundFetchSize;if(i){if(typeof i!="function")throw new TypeError("sizeCalculation must be a function");if(n=i(r,t),!Ml(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return n}),Tr(this,D0,(t,r,n)=>{if(e[t]=r,Z(this,Ya)){let i=Z(this,Ya)-e[t];for(;Z(this,Za)>i;)Vt(this,zt,pd).call(this,!0)}Tr(this,Za,Z(this,Za)+e[t]),n&&(n.entrySize=r,n.totalCalculatedSize=Z(this,Za))})},kc=new WeakMap,D0=new WeakMap,fd=new WeakMap,kl=function*({allowStale:e=this.allowStale}={}){if(Z(this,Ys))for(let t=Z(this,mi);Vt(this,zt,Qf).call(this,t)&&((e||!Z(this,eo).call(this,t))&&(yield t),t!==Z(this,zi));)t=Z(this,Ka)[t]},Il=function*({allowStale:e=this.allowStale}={}){if(Z(this,Ys))for(let t=Z(this,zi);Vt(this,zt,Qf).call(this,t)&&((e||!Z(this,eo).call(this,t))&&(yield t),t!==Z(this,mi));)t=Z(this,sa)[t]},Qf=function(e){return e!==void 0&&Z(this,Qs).get(Z(this,hs)[e])===e},Ic=function(e,t,r,n){var i,l,c,h;let{ttl:p=this.ttl,start:g,noDisposeOnSet:x=this.noDisposeOnSet,sizeCalculation:b=this.sizeCalculation,status:w}=r,A=Vt(this,zt,es).call(this,t);if(t===void 0)return w&&(w.set="deleted"),this.delete(e),this;let{noUpdateTTL:k=this.noUpdateTTL}=r;w&&!A&&(w.value=t);let E=Z(this,fd).call(this,e,t,r.size||0,b,w);if(this.maxEntrySize&&E>this.maxEntrySize)return Vt(this,zt,El).call(this,e,"set"),w&&(w.set="miss",w.maxEntrySizeExceeded=!0),this;let I=Z(this,Ys)===0?void 0:Z(this,Qs).get(e);if(I===void 0)I=Z(this,Ys)===0?Z(this,mi):Z(this,Oo).length!==0?Z(this,Oo).pop():Z(this,Ys)===Z(this,Ao)?Vt(this,zt,pd).call(this,!1):Z(this,Ys),Z(this,hs)[I]=e,Z(this,$r)[I]=t,Z(this,Qs).set(e,I),Z(this,sa)[Z(this,mi)]=I,Z(this,Ka)[I]=Z(this,mi),Tr(this,mi,I),Mf(this,Ys)._++,Z(this,D0).call(this,I,E,w),w&&(w.set="add"),k=!1,Z(this,_c)&&!A&&((i=Z(this,Sc))==null||i.call(this,t,e,"add"));else{Vt(this,zt,Q0).call(this,I);let M=Z(this,$r)[I];if(t!==M){if(!x)if(Vt(this,zt,es).call(this,M)){M!==n&&M.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Q}=M;Q!==void 0&&Q!==t&&(Z(this,Uo)&&((l=Z(this,Qo))==null||l.call(this,Q,e,"set")),Z(this,ia)&&Z(this,gi)?.push([Q,e,"set"]))}else Z(this,Uo)&&((c=Z(this,Qo))==null||c.call(this,M,e,"set")),Z(this,ia)&&Z(this,gi)?.push([M,e,"set"]);if(Z(this,kc).call(this,I),Z(this,D0).call(this,I,E,w),Z(this,$r)[I]=t,!A){let Q=M&&Vt(this,zt,es).call(this,M)?M.__staleWhileFetching:M,j=Q===void 0?"add":t!==Q?"replace":"update";w&&(w.set=j,Q!==void 0&&(w.oldValue=Q)),Z(this,_c)&&this.onInsert?.(t,e,j)}}else A||(w&&(w.set="update"),Z(this,_c)&&this.onInsert?.(t,e,"update"))}if(p!==0&&!Z(this,Xa)&&Vt(this,zt,Bf).call(this),Z(this,Xa)&&(k||Z(this,hd).call(this,I,p,g),w&&Z(this,Ll).call(this,w,I)),!x&&Z(this,ia)&&Z(this,gi)){let M=Z(this,gi),Q;for(;Q=M?.shift();)(h=Z(this,jo))==null||h.call(this,...Q)}return this},pd=function(e){var t;let r=Z(this,zi),n=Z(this,hs)[r],i=Z(this,$r)[r],l=Vt(this,zt,es).call(this,i);l&&i.__abortController.abort(new Error("evicted"));let c=l?i.__staleWhileFetching:i;return(Z(this,Uo)||Z(this,ia))&&c!==void 0&&(Z(this,Uo)&&((t=Z(this,Qo))==null||t.call(this,c,n,"evict")),Z(this,ia)&&Z(this,gi)?.push([c,n,"evict"])),Z(this,kc).call(this,r),Z(this,Ja)?.[r]&&(clearTimeout(Z(this,Ja)[r]),Z(this,Ja)[r]=void 0),e&&(Z(this,hs)[r]=void 0,Z(this,$r)[r]=void 0,Z(this,Oo).push(r)),Z(this,Ys)===1?(Tr(this,zi,Tr(this,mi,0)),Z(this,Oo).length=0):Tr(this,zi,Z(this,sa)[r]),Z(this,Qs).delete(n),Mf(this,Ys)._--,r},$g=function(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,i=Z(this,Qs).get(e);if(i!==void 0){let l=Z(this,$r)[i];if(Vt(this,zt,es).call(this,l)&&l.__staleWhileFetching===void 0)return!1;if(Z(this,eo).call(this,i))n&&(n.has="stale",Z(this,Ll).call(this,n,i));else return r&&Z(this,Lc).call(this,i),n&&(n.has="hit",Z(this,Ll).call(this,n,i)),!0}else n&&(n.has="miss");return!1},Ug=function(e,t){let{status:r,allowStale:n=this.allowStale}=t,i=Z(this,Qs).get(e);if(i===void 0||!n&&Z(this,eo).call(this,i)){r&&(r.peek=i===void 0?"miss":"stale");return}let l=Z(this,$r)[i],c=Vt(this,zt,es).call(this,l)?l.__staleWhileFetching:l;return r&&(c!==void 0?(r.peek="hit",r.value=c):r.peek="miss"),c},md=function(e,t,r,n){let i=t===void 0?void 0:Z(this,$r)[t];if(Vt(this,zt,es).call(this,i))return i;let l=new AbortController,{signal:c}=r;c?.addEventListener("abort",()=>l.abort(c.reason),{signal:l.signal});let h={signal:l.signal,options:r,context:n},p=(k,E=!1)=>{let{aborted:I}=l.signal,M=r.ignoreFetchAbort&&k!==void 0,Q=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&k!==void 0);if(r.status&&(I&&!E?(r.status.fetchAborted=!0,r.status.fetchError=l.signal.reason,M&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),I&&!M&&!E)return x(l.signal.reason,Q);let j=w,F=Z(this,$r)[t];return(F===w||F===void 0&&M&&E)&&(k===void 0?j.__staleWhileFetching!==void 0?Z(this,$r)[t]=j.__staleWhileFetching:Vt(this,zt,El).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),Vt(this,zt,Ic).call(this,e,k,h.options,j))),k},g=k=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=k),x(k,!1)),x=(k,E)=>{let{aborted:I}=l.signal,M=I&&r.allowStaleOnFetchAbort,Q=M||r.allowStaleOnFetchRejection,j=Q||r.noDeleteOnFetchRejection,F=w;if(Z(this,$r)[t]===w&&(!j||!E&&F.__staleWhileFetching===void 0?Vt(this,zt,El).call(this,e,"fetch"):M||(Z(this,$r)[t]=F.__staleWhileFetching)),Q)return r.status&&F.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),F.__staleWhileFetching;if(F.__returned===F)throw k},b=(k,E)=>{var I;let M=(I=Z(this,N0))==null?void 0:I.call(this,e,i,h);l.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(k(void 0),r.allowStaleOnFetchAbort&&(k=Q=>p(Q,!0)))}),M&&M instanceof Promise?M.then(Q=>k(Q===void 0?void 0:Q),E):M!==void 0&&k(M)};r.status&&(r.status.fetchDispatched=!0);let w=new Promise(b).then(p,g),A=Object.assign(w,{__abortController:l,__staleWhileFetching:i,__returned:void 0});return t===void 0?(Vt(this,zt,Ic).call(this,e,A,{...h.options,status:void 0}),t=Z(this,Qs).get(e)):Z(this,$r)[t]=A,A},es=function(e){if(!Z(this,M0))return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController},jf=async function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:l=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:h=0,sizeCalculation:p=this.sizeCalculation,noUpdateTTL:g=this.noUpdateTTL,noDeleteOnFetchRejection:x=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:b=this.allowStaleOnFetchRejection,ignoreFetchAbort:w=this.ignoreFetchAbort,allowStaleOnFetchAbort:A=this.allowStaleOnFetchAbort,context:k,forceRefresh:E=!1,status:I,signal:M}=t;if(I&&(I.op="fetch",I.key=e,E&&(I.forceRefresh=!0),I.cache=this),!Z(this,M0))return I&&(I.fetch="get"),Vt(this,zt,B0).call(this,e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,status:I});let Q={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,ttl:l,noDisposeOnSet:c,size:h,sizeCalculation:p,noUpdateTTL:g,noDeleteOnFetchRejection:x,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:A,ignoreFetchAbort:w,status:I,signal:M},j=Z(this,Qs).get(e);if(j===void 0){I&&(I.fetch="miss");let F=Vt(this,zt,md).call(this,e,j,Q,k);return F.__returned=F}else{let F=Z(this,$r)[j];if(Vt(this,zt,es).call(this,F)){let se=r&&F.__staleWhileFetching!==void 0;return I&&(I.fetch="inflight",se&&(I.returnedStale=!0)),se?F.__staleWhileFetching:F.__returned=F}let V=Z(this,eo).call(this,j);if(!E&&!V)return I&&(I.fetch="hit"),Vt(this,zt,Q0).call(this,j),n&&Z(this,Lc).call(this,j),I&&Z(this,Ll).call(this,I,j),F;let $=Vt(this,zt,md).call(this,e,j,Q,k),te=$.__staleWhileFetching!==void 0&&r;return I&&(I.fetch=V?"stale":"refresh",te&&V&&(I.returnedStale=!0)),te?$.__staleWhileFetching:$.__returned=$}},zg=async function(e,t={}){let r=await Vt(this,zt,jf).call(this,e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r},Hg=function(e,t={}){let r=Z(this,R0);if(!r)throw new Error("no memoMethod provided to constructor");let{context:n,status:i,forceRefresh:l,...c}=t;i&&l&&(i.forceRefresh=!0);let h=Vt(this,zt,B0).call(this,e,c),p=l||h===void 0;if(i&&(i.memo=p?"miss":"hit",p||(i.value=h)),!p)return h;let g=r(e,h,{options:c,context:n});return i&&(i.value=g),Vt(this,zt,Ic).call(this,e,g,c),g},B0=function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:l}=t,c=Z(this,Qs).get(e);if(c===void 0){l&&(l.get="miss");return}let h=Z(this,$r)[c],p=Vt(this,zt,es).call(this,h);return l&&Z(this,Ll).call(this,l,c),Z(this,eo).call(this,c)?p?(l&&(l.get="stale-fetching"),r&&h.__staleWhileFetching!==void 0?(l&&(l.returnedStale=!0),h.__staleWhileFetching):void 0):(i||Vt(this,zt,El).call(this,e,"expire"),l&&(l.get="stale"),r?(l&&(l.returnedStale=!0),h):void 0):(l&&(l.get=p?"fetching":"hit"),Vt(this,zt,Q0).call(this,c),n&&Z(this,Lc).call(this,c),p?h.__staleWhileFetching:h)},Pf=function(e,t){Z(this,Ka)[t]=e,Z(this,sa)[e]=t},Q0=function(e){e!==Z(this,mi)&&(e===Z(this,zi)?Tr(this,zi,Z(this,sa)[e]):Vt(this,zt,Pf).call(this,Z(this,Ka)[e],Z(this,sa)[e]),Vt(this,zt,Pf).call(this,Z(this,mi),e),Tr(this,mi,e))},El=function(e,t){var r,n;yi.hasSubscribers&&yi.publish({op:"delete",delete:t,key:e,cache:this});let i=!1;if(Z(this,Ys)!==0){let l=Z(this,Qs).get(e);if(l!==void 0)if(Z(this,Ja)?.[l]&&(clearTimeout(Z(this,Ja)?.[l]),Z(this,Ja)[l]=void 0),i=!0,Z(this,Ys)===1)Vt(this,zt,Of).call(this,t);else{Z(this,kc).call(this,l);let c=Z(this,$r)[l];if(Vt(this,zt,es).call(this,c)?c.__abortController.abort(new Error("deleted")):(Z(this,Uo)||Z(this,ia))&&(Z(this,Uo)&&((r=Z(this,Qo))==null||r.call(this,c,e,t)),Z(this,ia)&&Z(this,gi)?.push([c,e,t])),Z(this,Qs).delete(e),Z(this,hs)[l]=void 0,Z(this,$r)[l]=void 0,l===Z(this,mi))Tr(this,mi,Z(this,Ka)[l]);else if(l===Z(this,zi))Tr(this,zi,Z(this,sa)[l]);else{let h=Z(this,Ka)[l];Z(this,sa)[h]=Z(this,sa)[l];let p=Z(this,sa)[l];Z(this,Ka)[p]=Z(this,Ka)[l]}Mf(this,Ys)._--,Z(this,Oo).push(l)}}if(Z(this,ia)&&Z(this,gi)?.length){let l=Z(this,gi),c;for(;c=l?.shift();)(n=Z(this,jo))==null||n.call(this,...c)}return i},Of=function(e){var t,r;for(let n of Vt(this,zt,Il).call(this,{allowStale:!0})){let i=Z(this,$r)[n];if(Vt(this,zt,es).call(this,i))i.__abortController.abort(new Error("deleted"));else{let l=Z(this,hs)[n];Z(this,Uo)&&((t=Z(this,Qo))==null||t.call(this,i,l,e)),Z(this,ia)&&Z(this,gi)?.push([i,l,e])}}if(Z(this,Qs).clear(),Z(this,$r).fill(void 0),Z(this,hs).fill(void 0),Z(this,Xa)&&Z(this,$o)){Z(this,Xa).fill(0),Z(this,$o).fill(0);for(let n of Z(this,Ja)??[])n!==void 0&&clearTimeout(n);Z(this,Ja)?.fill(void 0)}if(Z(this,Fo)&&Z(this,Fo).fill(0),Tr(this,zi,0),Tr(this,mi,0),Z(this,Oo).length=0,Tr(this,Za,0),Tr(this,Ys,0),Z(this,ia)&&Z(this,gi)){let n=Z(this,gi),i;for(;i=n?.shift();)(r=Z(this,jo))==null||r.call(this,...i)}},Ff);function Xb(e){let t={individual:{},range:[]},r=new WeakMap;for(let n of e)Wp(t,n,r);return t}function Wp(e,t,r){for(let[n,i]of Object.entries(t.individual))if(e.individual[n])Ec(e.individual[n],i,r);else{let l=!1;for(let[c,{range:h,entry:p}]of e.range.entries()){let g=$f(Number(n),h);if(g.both!==null){l=!0,e.individual[n]=i,Ec(e.individual[n],vi(p),r),e.range.splice(c,1);for(let x of g.second)Array.isArray(x)?e.range.push({range:x,entry:vi(p)}):e.individual[x]=vi(p)}}l||(e.individual[n]=i)}for(let{range:n,entry:i}of t.range){let l=[n];for(let c=0;c<e.range.length;c++){let{range:h,entry:p}=e.range[c];for(let[g,x]of l.entries())if(Array.isArray(x)){let b=t_(x,h);if(b.both===null)continue;e.range.splice(c,1),c--;let w=vi(p);Array.isArray(b.both)?e.range.push({range:b.both,entry:w}):e.individual[b.both]=w,Ec(w,vi(i),r);for(let A of b.second)Array.isArray(A)?e.range.push({range:A,entry:vi(p)}):e.individual[A]=vi(p);l=b.first}else{let b=$f(x,h);if(b.both===null)continue;e.individual[x]=vi(i),Ec(e.individual[x],vi(p),r),e.range.splice(c,1),c--;for(let w of b.second)Array.isArray(w)?e.range.push({range:w,entry:vi(p)}):e.individual[w]=vi(p);l.splice(g,1,...b.first);break}}for(let c of Object.keys(e.individual))for(let[h,p]of l.entries())if(Array.isArray(p)){let g=$f(Number(c),p);if(g.both===null)continue;Ec(e.individual[c],vi(i),r),l.splice(h,1,...g.second);break}else if(Number(c)===p){Ec(e.individual[c],vi(i),r);break}for(let c of l)Array.isArray(c)?e.range.push({range:c,entry:vi(i)}):e.individual[c]=vi(i)}}function Ec(e,t,r){let n=r.get(e);n?.has(t)||(n||(n=new Set,r.set(e,n)),n.add(t),t.lookup&&(!e.lookup||e.lookup.index>t.lookup.index||e.lookup.index===t.lookup.index&&e.lookup.subIndex>t.lookup.subIndex)&&(e.lookup=t.lookup),t.forward&&(e.forward?Wp(e.forward,t.forward,r):e.forward=t.forward),t.reverse&&(e.reverse?Wp(e.reverse,t.reverse,r):e.reverse=t.reverse))}function t_(e,t){let r={first:[],second:[],both:null};if(e[0]<t[1]&&t[0]<e[1]){let n=Math.max(e[0],t[0]),i=Math.min(e[1],t[1]);r.both=nc(n,i)}if(e[0]<t[0]){let n=e[0],i=Math.min(t[0],e[1]);r.first.push(nc(n,i))}else if(t[0]<e[0]){let n=t[0],i=Math.min(t[1],e[0]);r.second.push(nc(n,i))}if(e[1]>t[1]){let n=Math.max(e[0],t[1]),i=e[1];r.first.push(nc(n,i))}else if(t[1]>e[1]){let n=Math.max(e[1],t[0]),i=t[1];r.second.push(nc(n,i))}return r}function $f(e,t){if(e<t[0]||e>t[1])return{first:[e],second:[t],both:null};let r={first:[],second:[],both:e};return t[0]<e&&r.second.push(nc(t[0],e)),t[1]>e&&r.second.push(nc(e+1,t[1])),r}function nc(e,t){return t-e===1?e:[e,t]}function vi(e,t=new Map){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=Wg(e.forward,t)),e.reverse&&(r.reverse=Wg(e.reverse,t)),e.lookup&&(r.lookup={contextRange:e.lookup.contextRange.slice(),index:e.lookup.index,length:e.lookup.length,subIndex:e.lookup.subIndex,substitutions:e.lookup.substitutions.slice()}),r}function Wg(e,t=new Map){let r={};for(let[n,i]of Object.entries(e.individual))r[n]=vi(i,t);return{individual:r,range:e.range.map(({range:n,entry:i})=>({range:n.slice(),entry:vi(i,t)}))}}function Gp(e,t,r,n){let i=t[n],l=e[i];if(!l)return;let c=l.lookup;if(l.reverse){let p=r_(l.reverse,t,r);(!c&&p||p&&c&&(c.index>p.index||c.index===p.index&&c.subIndex>p.subIndex))&&(c=p)}if(++n>=t.length||!l.forward)return c;let h=Gp(l.forward,t,r,n);return(!c&&h||h&&c&&(c.index>h.index||c.index===h.index&&c.subIndex>h.subIndex))&&(c=h),c}function r_(e,t,r){let n=e[t[--r]],i=n&&n.lookup;for(;n&&((!i&&n.lookup||n.lookup&&i&&i.index>n.lookup.index)&&(i=n.lookup),!(--r<0||!n.reverse));)n=n.reverse[t[r]];return i}function Gg(e,t,r){let n=!1;for(let i=0;i<e.length;i++){let l=e[i];if(n){if(r<=l[0])return e[i-1][1]=r,e;if(r<=l[1])return e[i-1][1]=Math.max(r,l[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(r<=l[0])return e.splice(i,0,[t,r]),e;if(r<=l[1])return l[0]=Math.min(t,l[0]),e;if(t<l[1])l[0]=Math.min(t,l[0]),n=!0;else continue}}return n?e[e.length-1][1]=r:e.push([t,r]),e}function n_(e,t){switch(e.format){case 1:let r=e.glyphs.indexOf(t);return r!==-1?r:null;case 2:let n=e.ranges.find(i=>i.start<=t&&i.end>=t);return n?n.index:null}}function pl(e){switch(e.format){case 1:return e.glyphs.map((r,n)=>({glyphId:r,index:n}));case 2:let t=[];for(let[r,n]of e.ranges.entries())n.end===n.start?t.push({glyphId:n.start,index:r}):t.push({glyphId:[n.start,n.end+1],index:r});return t}}function s_(e,t){let r=t[0],n=Vp(e,r),i=t[0]+1,l=new Map;for(;i<t[1];)Vp(e,i)!==n&&(i-r<=1?l.set(r,n):l.set([r,i],n)),i++;return i-r<=1?l.set(r,n):l.set([r,i],n),l}function Vp(e,t){let r=n_(e.coverage,t);if(r===null)return null;switch(e.substFormat){case 1:return(t+e.deltaGlyphId)%2**16;case 2:return e.substitute[r]??null}}function D1(e,t,r,n,i){let l=[];for(let c of r){c.entry.forward={individual:{},range:[]};for(let h of e)l.push(...jh(c.entry.forward,n,i,t,h).map(({entry:p,substitution:g})=>({entry:p,substitutions:[...c.substitutions,g]})))}return l}function Bh(e,t){let r=[],n=new Set;for(let i of t){if(n.has(i.entry))continue;n.add(i.entry),i.entry.forward??={individual:{},range:[]};let l={};for(let c of e)Array.isArray(c)?i.entry.forward.range.push({entry:l,range:c}):i.entry.forward.individual[c]=l;r.push({entry:l,substitutions:i.substitutions})}return r}function Qh(e,t){let r=[],n=new Set;for(let i of t){if(n.has(i.entry))continue;n.add(i.entry),i.entry.reverse??={individual:{},range:[]};let l={};for(let c of e)Array.isArray(c)?i.entry.reverse.range.push({entry:l,range:c}):i.entry.reverse.individual[c]=l;r.push({entry:l,substitutions:i.substitutions})}return r}function jh(e,t,r,n,i){let l=[];if(!Array.isArray(i))e.individual[i]={},l.push({entry:e.individual[i],substitution:a_(t,r,n,i)});else{let c=i_(t,r,n,i);for(let[h,p]of c){let g={};Array.isArray(h)?e.range.push({range:h,entry:g}):e.individual[h]={},l.push({entry:g,substitution:p})}}return l}function i_(e,t,r,n){for(let i of e.filter(l=>l.sequenceIndex===r))for(let l of t[i.lookupListIndex].subtables){let c=s_(l,n);if(!Array.from(c.values()).every(h=>h!==null))return c}return new Map([[n,null]])}function a_(e,t,r,n){for(let i of e.filter(l=>l.sequenceIndex===r))for(let l of t[i.lookupListIndex].subtables){let c=Vp(l,n);if(c!==null)return c}return null}function o_(e,t,r){let n={individual:{},range:[]},i=pl(e.coverage);for(let{glyphId:l,index:c}of i){let h=e.chainRuleSets[c];if(h)for(let[p,g]of h.entries()){let x=jh(n,g.lookupRecords,t,0,l).map(({entry:b,substitution:w})=>({entry:b,substitutions:[w]}));for(let[b,w]of g.input.entries())x=D1([w],b+1,x,g.lookupRecords,t);for(let b of g.lookahead)x=Bh([b],x);for(let b of g.backtrack)x=Qh([b],x);for(let{entry:b,substitutions:w}of x)b.lookup={substitutions:w,length:g.input.length+1,index:r,subIndex:p,contextRange:[-1*g.backtrack.length,1+g.input.length+g.lookahead.length]}}}return n}function l_(e,t){return e.format===2?Array.isArray(t)?c_(e,t):new Map([[t,qp(e,t)]]):new Map([[t,null]])}function c_(e,t){let r=t[0],n=qp(e,r),i=t[0]+1,l=new Map;for(;i<t[1];)qp(e,i)!==n&&(i-r<=1?l.set(r,n):l.set([r,i],n)),i++;return i-r<=1?l.set(r,n):l.set([r,i],n),l}function qp(e,t){for(let r of e.ranges)if(r.start<=t&&r.end>=t)return r.classId;return null}function Uf(e,t){switch(e.format){case 2:let r=[];for(let n of e.ranges)n.classId===t&&(n.end===n.start?r.push(n.start):r.push([n.start,n.end+1]));return r;default:return[]}}function u_(e,t,r){let n=[],i=pl(e.coverage);for(let{glyphId:l}of i){let c=l_(e.inputClassDef,l);for(let[h,p]of c.entries()){if(p===null)continue;let g=e.chainClassSet[p];if(g)for(let[x,b]of g.entries()){let w={individual:{},range:[]},A=jh(w,b.lookupRecords,t,0,h).map(({entry:k,substitution:E})=>({entry:k,substitutions:[E]}));for(let[k,E]of b.input.entries())A=D1(Uf(e.inputClassDef,E),k+1,A,b.lookupRecords,t);for(let k of b.lookahead)A=Bh(Uf(e.lookaheadClassDef,k),A);for(let k of b.backtrack)A=Qh(Uf(e.backtrackClassDef,k),A);for(let{entry:k,substitutions:E}of A)k.lookup={substitutions:E,index:r,subIndex:x,length:b.input.length+1,contextRange:[-1*b.backtrack.length,1+b.input.length+b.lookahead.length]};n.push(w)}}}return Xb(n)}function d_(e,t,r){let n={individual:{},range:[]},i=pl(e.inputCoverage[0]);for(let{glyphId:l}of i){let c=jh(n,e.lookupRecords,t,0,l).map(({entry:h,substitution:p})=>({entry:h,substitutions:[p]}));for(let[h,p]of e.inputCoverage.slice(1).entries())c=D1(pl(p).map(g=>g.glyphId),h+1,c,e.lookupRecords,t);for(let h of e.lookaheadCoverage)c=Bh(pl(h).map(p=>p.glyphId),c);for(let h of e.backtrackCoverage)c=Qh(pl(h).map(p=>p.glyphId),c);for(let{entry:h,substitutions:p}of c)h.lookup={substitutions:p,index:r,subIndex:0,length:e.inputCoverage.length,contextRange:[-1*e.backtrackCoverage.length,e.inputCoverage.length+e.lookaheadCoverage.length]}}return n}function h_(e,t){let r={individual:{},range:[]},n=pl(e.coverage);for(let{glyphId:i,index:l}of n){let c={};Array.isArray(i)?r.range.push({entry:c,range:i}):r.individual[i]=c;let h=[{entry:c,substitutions:[e.substitutes[l]]}];for(let p of e.lookaheadCoverage)h=Bh(pl(p).map(g=>g.glyphId),h);for(let p of e.backtrackCoverage)h=Qh(pl(p).map(g=>g.glyphId),h);for(let{entry:p,substitutions:g}of h)p.lookup={substitutions:g,index:t,subIndex:0,length:1,contextRange:[-1*e.backtrackCoverage.length,1+e.lookaheadCoverage.length]}}return r}function Yp(e,t=new Map){let r={};for(let[n,i]of Object.entries(e.individual))r[n]=Vg(i,t);for(let{range:n,entry:i}of e.range){let l=Vg(i,t);for(let c=n[0];c<n[1];c++)r[c]=l}return r}function Vg(e,t){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=Yp(e.forward,t)),e.reverse&&(r.reverse=Yp(e.reverse,t)),e.lookup&&(r.lookup=e.lookup),r}var f_=class{constructor(e,t){this._lookupTrees=[],this._glyphLookups={},this._font=e,t.cacheSize>0&&(this._cache=new e_({maxSize:t.cacheSize,sizeCalculation:((l,c)=>c.length)}));let r=(this._font.tables.gsub&&this._font.tables.gsub.features.filter(l=>l.tag==="calt")||[]).reduce((l,c)=>[...l,...c.feature.lookupListIndexes],[]),n=this._font.tables.gsub&&this._font.tables.gsub.lookups||[],i=n.filter((l,c)=>r.some(h=>h===c));for(let[l,c]of i.entries()){let h=[];switch(c.lookupType){case 6:for(let[g,x]of c.subtables.entries())switch(x.substFormat){case 1:h.push(o_(x,n,g));break;case 2:h.push(u_(x,n,g));break;case 3:h.push(d_(x,n,g));break}break;case 8:for(let[g,x]of c.subtables.entries())h.push(h_(x,g));break}let p=Yp(Xb(h));this._lookupTrees.push({tree:p,processForward:c.lookupType!==8});for(let g of Object.keys(p))this._glyphLookups[g]||(this._glyphLookups[g]=[]),this._glyphLookups[g].push(l)}}findLigatures(e){let t=this._cache&&this._cache.get(e);if(t&&!Array.isArray(t))return t;let r=[];for(let l of e)r.push(this._font.charToGlyphIndex(l));if(this._lookupTrees.length===0)return{inputGlyphs:r,outputGlyphs:r,contextRanges:[]};let n=this._findInternal(r.slice()),i={inputGlyphs:r,outputGlyphs:n.sequence,contextRanges:n.ranges};return this._cache&&this._cache.set(e,i),i}findLigatureRanges(e){if(this._lookupTrees.length===0)return[];let t=this._cache&&this._cache.get(e);if(t)return Array.isArray(t)?t:t.contextRanges;let r=[];for(let i of e)r.push(this._font.charToGlyphIndex(i));let n=this._findInternal(r);return this._cache&&this._cache.set(e,n.ranges),n.ranges}_findInternal(e){let t=[],r=this._getNextLookup(e,0);for(;r.index!==null;){let n=this._lookupTrees[r.index];if(n.processForward){let i=r.last;for(let l=r.first;l<i;l++){let c=Gp(n.tree,e,l,l);if(c){for(let h=0;h<c.substitutions.length;h++){let p=c.substitutions[h];p!==null&&(e[l+h]=p)}Gg(t,c.contextRange[0]+l,c.contextRange[1]+l),l+c.length>=i&&(i=l+c.length+1),l+=c.length-1}}}else for(let i=r.last-1;i>=r.first;i--){let l=Gp(n.tree,e,i,i);if(l){for(let c=0;c<l.substitutions.length;c++){let h=l.substitutions[c];h!==null&&(e[i+c]=h)}Gg(t,l.contextRange[0]+i,l.contextRange[1]+i),i-=l.length-1}}r=this._getNextLookup(e,r.index+1)}return{sequence:e,ranges:t}}_getNextLookup(e,t){let r={index:null,first:1/0,last:-1};for(let n=0;n<e.length;n++){let i=this._glyphLookups[e[n]];if(i)for(let l=0;l<i.length;l++){let c=i[l];if(c>=t){(r.index===null||c<=r.index)&&(r.index=c,r.first>n&&(r.first=n),r.last=n+1);break}}}return r}};function p_(e,t){let r=YS.parse(e);return new f_(r,{cacheSize:0,...t})}function m_(e){if(typeof e!="string")throw new Error("Font family must be a string");let t={input:e,offset:0},r=[],n="";for(;t.offset<t.input.length;){let i=t.input[t.offset++];switch(i){case"'":case'"':n+=g_(t,i);break;case",":r.push(n),n="";break;default:/\s/.test(i)||(t.offset--,n+=x_(t),r.push(n),n="")}}return r}function g_(e,t){let r="",n=!1;for(;e.offset<e.input.length;){let i=e.input[e.offset++];if(n)/[\dA-Fa-f]/.test(i)?(e.offset--,r+=Jb(e)):i!==`
|
|
63
|
-
`&&(r+=i),n=!1;else switch(i){case t:return r;case"\\":n=!0;break;default:r+=i}}throw new Error("Unterminated string")}function x_(e){let t="",r=!1;for(;e.offset<e.input.length;){let n=e.input[e.offset++];if(r)/[\dA-Fa-f]/.test(n)?(e.offset--,t+=Jb(e)):t+=n,r=!1;else switch(n){case"\\":r=!0;break;case",":return t;default:/\s/.test(n)?t.endsWith(" ")||(t+=" "):t+=n}}return t}function Jb(e){let t="";for(;e.offset<e.input.length;){let r=e.input[e.offset++];if(/\s/.test(r))return zf(t);if(t.length>=6||!/[\dA-Fa-f]/.test(r))return e.offset--,zf(t);t+=r}return zf(t)}function zf(e){return String.fromCodePoint(parseInt(e,16))}var j0;async function b_(e,t){if(!j0){if(typeof navigator<"u"&&"fonts"in navigator){try{let i=await navigator.permissions.request?.({name:"local-fonts"});if(i&&i.state!=="granted")throw new Error("Permission to access local fonts not granted.")}catch(i){if(i instanceof Error&&i.name!=="TypeError")throw i}let n={};try{let i=await navigator.fonts.query();for(let l of i)n.hasOwnProperty(l.family)||(n[l.family]=[]),n[l.family].push(l);j0=Promise.resolve(n)}catch(i){i instanceof Error&&console.error(i.name,i.message)}}else if(typeof window<"u"&&"queryLocalFonts"in window){let n={};try{let i=await window.queryLocalFonts();for(let l of i)n.hasOwnProperty(l.family)||(n[l.family]=[]),n[l.family].push(l);j0=Promise.resolve(n)}catch(i){i instanceof Error&&console.error(i.name,i.message)}}j0??=Promise.resolve({})}let r=await j0;for(let n of m_(e)){if(y_.includes(n))return;if(r.hasOwnProperty(n)&&r[n].length>0){let i=r[n][0];if("blob"in i){let l=await(await i.blob()).arrayBuffer();return p_(l,{cacheSize:t})}return}}}var y_=["serif","sans-serif","cursive","fantasy","monospace","system-ui","emoji","math","fangsong"],v_=1e5;function w_(e,t=[]){let r,n,i=0,l;return e.registerCharacterJoiner(c=>{let h=e.options.fontFamily;if(h&&(i===0||r!==h)){n=void 0,i=1,r=h;let p=r;b_(p,v_).then(g=>{p===e.options.fontFamily&&(i=2,n=g,g&&e.refresh(0,e.rows-1))}).catch(g=>{p===e.options.fontFamily&&(i=3,e.options.logLevel==="debug"&&console.debug(l,new Error("Failure while loading font")),n=void 0,l=g)})}return n&&i===2?n.findLigatureRanges(c).map(p=>[p[0],p[1]]):A_(c,t)})}function A_(e,t){let r=[];for(let n=0;n<e.length;n++)for(let i=0;i<t.length;i++)if(e.startsWith(t[i],n)){r.push([n,n+t[i].length]),n+=t[i].length-1;break}return r}var T_=class{constructor(e){this._fallbackLigatures=(e?.fallbackLigatures??["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!===","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"]).sort((t,r)=>r.length-t.length),this._fontFeatureSettings=e?.fontFeatureSettings}activate(e){if(!e.element)throw new Error("Cannot activate LigaturesAddon before open is called");this._terminal=e,this._characterJoinerId=w_(e,this._fallbackLigatures),e.element.style.fontFeatureSettings=this._fontFeatureSettings??'"calt" on'}dispose(){this._characterJoinerId!==void 0&&(this._terminal?.deregisterCharacterJoiner(this._characterJoinerId),this._characterJoinerId=void 0),this._terminal?.element&&(this._terminal.element.style.fontFeatureSettings="")}};function qg(e){let t=0;for(let r=0;r<e.length;++r){let n=e.charCodeAt(r);if(n<48||57<n)return-1;t=t*10+n-48}return t}var C_=class{constructor(){this._st=0,this._pr=0}dispose(){this._seqHandler?.dispose(),this._onChange?.dispose()}activate(e){this._seqHandler=e.parser.registerOscHandler(9,t=>{if(!t.startsWith("4;"))return!1;let r=t.split(";");if(r.length>3)return!0;r.length===2&&r.push("");let n=qg(r[1]),i=qg(r[2]);switch(n){case 0:this.progress={state:n,value:0};break;case 1:if(i<0)return!0;this.progress={state:n,value:i};break;case 2:case 4:if(i<0)return!0;this.progress={state:n,value:i||this._pr};break;case 3:this.progress={state:n,value:this._pr};break}return!0}),this._onChange=new e._core._onData.constructor,this.onChange=this._onChange.event}get progress(){return{state:this._st,value:this._pr}}set progress(e){if(e.state<0||e.state>4){console.warn("progress state out of bounds, not applied");return}this._st=e.state,this._pr=Math.min(Math.max(e.value,0),100),this._onChange?.fire({state:this._st,value:this._pr})}};function e3(e,t){const r=Math.max(e.left,t.left),n=Math.max(e.top,t.top),i=Math.min(e.right,t.right),l=Math.min(e.bottom,t.bottom);return i>r&&l>n?{left:r,top:n,right:i,bottom:l}:null}function Yg(e,t){const r=e3(e,t);return r?(r.right-r.left)*(r.bottom-r.top):0}function cc(e){const t=e.element;if(!t||!e.cols||!e.rows)return null;const n=(t.querySelector?.(".xterm-screen")??null??t).getBoundingClientRect();if(!n.width||!n.height)return null;const i=e.dimensions?.css?.cell?.height,l=n.width/e.cols,c=i&&i>0?i:n.height/e.rows;return{originLeft:n.left,originTop:n.top,cellW:l,cellH:c}}function Yd(e,t){const r=cc(e);if(!r)return null;const n=t.row-e.buffer.active.viewportY;if(n<0||n>=e.rows)return null;const i=Math.max(0,Math.min(e.cols-1,t.col));return{x:r.originLeft+(i+.5)*r.cellW,y:r.originTop+n*r.cellH}}function S_(e,t){const r=Math.max(0,e.buffer.active.baseY+e.rows-1);return{col:Math.max(0,Math.min(e.cols-1,t.col)),row:Math.max(0,Math.min(r,t.row))}}function hh(e,t,r){const n=e.row*r+e.col,i=t.row*r+t.col;return n<=i?{start:e,end:t}:{start:t,end:e}}function __(e,t,r){const n=cc(e);if(!n)return null;const{start:i,end:l}=hh(t,r,e.cols),c=e.buffer.active.viewportY,h=c+e.rows-1;if(l.row<c||i.row>h)return null;const p=Math.max(i.row,c),g=Math.min(l.row,h),x=n.originTop+(p-c)*n.cellH,b=n.originTop+(g-c+1)*n.cellH;return i.row===l.row?{left:n.originLeft+i.col*n.cellW,top:x,right:n.originLeft+(l.col+1)*n.cellW,bottom:b}:{left:n.originLeft,top:x,right:n.originLeft+e.cols*n.cellW,bottom:b}}function L_(e){const t=Math.max(e.viewport.left,e.terminal.left),r=Math.max(e.viewport.top,e.terminal.top),n=Math.min(e.viewport.right,e.terminal.right),i=Math.min(e.viewport.bottom,e.terminal.bottom),l=t+e.margin,c=r+e.margin,h=Math.max(l,n-e.width-e.margin),p=Math.max(c,i-e.height-e.margin),g=se=>Math.max(l,Math.min(se,h)),x=se=>Math.max(c,Math.min(se,p)),b=e.selection?e3(e.selection,{left:t,top:r,right:n,bottom:i}):null;if(!b){const se=g(e.clientX-e.width/2),qe=e.clientY-e.height-e.fingerGap,de=e.clientY+e.fingerGap,oe=x(qe>=c?qe:de);return{left:Math.round(se),top:Math.round(oe)}}const w=(b.left+b.right)/2,A=(b.top+b.bottom)/2,k=e.preference?.alignX??w,E=e.selectionGap??e.fingerGap,I=b.top-e.height-E,M=b.bottom+E,Q=e.preference?.vertical==="below"?M:I,j=e.preference?.vertical==="below"?I:M,F=[{left:l,top:c},{left:h,top:c},{left:l,top:p},{left:h,top:p}];e.preference&&F.sort((se,qe)=>{const de=oe=>{const Oe=oe.left+e.width/2,et=oe.top+e.height/2;return Math.hypot(Oe-e.preference.focusX,et-e.preference.focusY)};return de(qe)-de(se)});const V=[{left:k-e.width/2,top:Q},{left:w-e.width/2,top:Q},{left:k-e.width/2,top:j},{left:w-e.width/2,top:j},{left:b.left-e.width-e.fingerGap,top:A-e.height/2},{left:b.right+e.fingerGap,top:A-e.height/2},...F].map(se=>({left:g(se.left),top:x(se.top)}));let $=V[0],te=Number.POSITIVE_INFINITY;return V.forEach((se,qe)=>{const de={left:se.left,top:se.top,right:se.left+e.width,bottom:se.top+e.height},oe=(e.avoid??[]).reduce((et,ce)=>et+Yg(de,ce),0),Oe=(oe>0?1e6:0)+oe*100+Yg(de,b)*10+qe*.01;Oe<te&&($=se,te=Oe)}),{left:Math.round($.left),top:Math.round($.top)}}function k_(e){const t=e.willChange.split(",").map(n=>n.trim()),r=(n,i)=>!!(n&&n!==i);return r(e.transform,"none")||r(e.perspective,"none")||r(e.filter,"none")||r(e.backdropFilter,"none")||r(e.containerType,"normal")||e.contain.includes("layout")||e.contain.includes("paint")||e.contain.includes("strict")||e.contain.includes("content")||t.includes("transform")||t.includes("perspective")||t.includes("filter")}function I_(e){let t=e.parentElement;for(;t;){if(k_(window.getComputedStyle(t)))return t;t=t.parentElement}return null}function E_(e,t,r,n){const i=e.getBoundingClientRect();let l=0,c=0;if(t){const h=t.getBoundingClientRect();l=h.left+t.clientLeft,c=h.top+t.clientTop}return{x:i.left-l+r,y:i.top-c+n}}function N_(e,t){const r=e.replace(/\r?\n/g,"\r");return`\x1B[200~${(t&&r.endsWith("\r")?r.slice(0,-1):r).replace(/\x1b/g,"␛")}\x1B[201~${t?"\r":""}`}function R_(e,t,r){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n+=1;let i=0;const l=e.length-n,c=t.length-n;for(;i<l&&i<c&&e[e.length-1-i]===t[t.length-1-i];)i+=1;const h=t.slice(n,t.length-i);return h&&(r==="insertFromPaste"||r==="insertFromPasteAsQuotation"||/[\r\n]/.test(h))?h:null}const Zg=2,M_=new Set(["mount","init-fit","resize","dpr-change","session-key-change","session-reset","tmux-layout"]);function D_(e){const t=e.reason.replace(/^refresh:/,""),r=M_.has(t),n=Math.abs(e.proposedCols-e.currentCols),i=Math.abs(e.proposedRows-e.currentRows);return{accept:r?n>0||i>0:n>=Zg||i>=Zg,isRealResize:r,colsDelta:n,rowsDelta:i}}function B_(e){return e.before.cols!==e.after.cols||e.before.rows!==e.after.rows||e.lastServerSize===null||e.reconcileServerSize===!0&&(e.lastServerSize.cols!==e.after.cols||e.lastServerSize.rows!==e.after.rows)}function Q_(e,t){return!e||t}function j_(e,t,r){return e!=="alternate"&&r>=t}function P_(e,t){return e?"none":t?"single":"settled"}function O_(e,t,r){return!r&&(e||t)}function F_(e){let t,r,n=!1,i=0;const l=e.parser.registerCsiHandler({prefix:"?",final:"l"},h=>(t&&h.some(p=>p===2026)&&(n=!0),!1)),c=h=>{const p=t;if(!p)return;const g=r;if(t=void 0,r=void 0,n=!1,p(),h){const x=e._core?._renderService?._renderer?.value;g&&x?.handleResize(...g),x?.renderRows(0,e.rows-1),e.refresh(0,e.rows-1)}};return{begin(){if(i++,n=!1,t)return;const h=e._core?._renderService?._renderer?.value;if(!h||typeof h.handleResize!="function"||typeof h.renderRows!="function"||typeof h.clear!="function")return;const p=h.handleResize,g=h.renderRows,x=h.clear;h.handleResize=(b,w)=>{r=[b,w]},h.renderRows=()=>{},h.clear=()=>{},t=()=>{h.handleResize=p,h.renderRows=g,h.clear=x}},get generation(){return i},written(h){h===i&&n&&!e.modes.synchronizedOutputMode&&c(!0)},cancel(){c(!0)},dispose(){c(!1),l.dispose()}}}function Hf(){return{confirmed:null,pending:null,nextSeq:1}}function Kg(e,t){return e?.cols===t.cols&&e.rows===t.rows}function B1(e,t,r){const n={...t,seq:e.nextSeq,attempt:r};return{state:{...e,pending:n,nextSeq:e.nextSeq+1},request:n}}function $_(e,t){return Kg(e.pending,t)||!e.pending&&Kg(e.confirmed,t)?{state:e,request:null}:B1(e,t,0)}function U_(e,t){return B1(e,t,0)}function z_(e,t){const r=e.pending;if(!r||t.seq!==r.seq)return{state:e,accepted:!1};const n=t.ok&&Number.isFinite(t.cols)&&Number.isFinite(t.rows)&&(t.cols??0)>0&&(t.rows??0)>0?{cols:Math.floor(t.cols),rows:Math.floor(t.rows)}:null;return{state:{...e,confirmed:n,pending:null},accepted:!0}}function Xg(e,t,r=1){const n=e.pending;return!n||n.seq!==t?{state:e,request:null,exhausted:!1}:n.attempt>=r?{state:{...e,confirmed:null,pending:null},request:null,exhausted:!0}:{...B1(e,n,n.attempt+1),exhausted:!1}}function H_(e,t){return!Number.isFinite(t.cols)||!Number.isFinite(t.rows)||t.cols<=0||t.rows<=0?e:{...e,confirmed:{cols:Math.floor(t.cols),rows:Math.floor(t.rows)}}}function W_(e){return{...e,pending:null}}const G_=150;function Jg(e=0){return{lastPushAt:e}}function V_(e,t,r=G_){return t-e.lastPushAt>=r?(e.lastPushAt=t,{action:"send"}):{action:"hold",readyAt:e.lastPushAt+r}}function q_(e){return{lastPushAt:e}}const Zp="termdock-settings",Y_=6,Z_=100,K_='"calt" on',X_=["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!==","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"];function J_(){if(typeof window>"u")return 13;const e=window.matchMedia("(max-width: 767px)").matches,t=window.matchMedia("(pointer: coarse)").matches;return e||t?10:13}function Q1(){return{fontFamily:"var(--font-mono)",fontSize:J_(),rendererMode:"auto",fontWeight:"normal",fontWeightBold:"bold",letterSpacing:1,lineHeight:1.05,minimumContrastRatio:4.5,drawBoldTextInBrightColors:!0,unicodeVersion:"11",customGlyphs:!0,rescaleOverlappingGlyphs:!1,fontLigatures:!0,enableImages:!0,smoothScrolling:!0}}function gd(e,t,r,n){return typeof e=="number"&&Number.isFinite(e)?Math.max(t,Math.min(r,e)):n}function e2(e,t){return e==="normal"||e==="bold"?e:typeof e=="number"&&Number.isFinite(e)?Math.max(1,Math.min(1e3,Math.round(e))):t}function Gc(e){const t=Q1(),r=e&&typeof e=="object"?e:{},n=r.rendererMode??r.renderer;return{fontFamily:typeof r.fontFamily=="string"&&r.fontFamily.trim()?r.fontFamily.trim():t.fontFamily,fontSize:gd(r.fontSize,Y_,Z_,t.fontSize),rendererMode:n==="auto"||n==="webgl"||n==="canvas"?n:t.rendererMode,fontWeight:e2(r.fontWeight,t.fontWeight),fontWeightBold:e2(r.fontWeightBold,t.fontWeightBold),letterSpacing:Math.round(gd(r.letterSpacing,-5,10,t.letterSpacing)),lineHeight:gd(r.lineHeight,1,2,t.lineHeight),minimumContrastRatio:gd(r.minimumContrastRatio,1,21,t.minimumContrastRatio),drawBoldTextInBrightColors:t.drawBoldTextInBrightColors,unicodeVersion:t.unicodeVersion,customGlyphs:t.customGlyphs,rescaleOverlappingGlyphs:t.rescaleOverlappingGlyphs,fontLigatures:t.fontLigatures,enableImages:t.enableImages,smoothScrolling:t.smoothScrolling}}function xd(e){return e.pointerType==="touch"||e.pointerType==="pen"}class eL{handlers=new Map;active=new Map;pointerStates=new Map;sorted=[];sortedDirty=!1;listenersRegistered=!1;changeListeners=new Set;constructor(){this.ensureListeners()}register(t){return this.handlers.has(t.name)&&this.log("replace",t.name),this.handlers.set(t.name,t),this.sortedDirty=!0,this.log("register",t.name,`prio=${t.priority}`),()=>{this.unregister(t.name)}}unregister(t){this.handlers.delete(t),this.sortedDirty=!0;for(const[r,n]of this.active)n===t&&(this.active.delete(r),this.pointerStates.delete(r));this.log("unregister",t)}getHandlers(){return this.sortedHandlers().map(t=>({name:t.name,priority:t.priority,hasContainer:t.container!=null}))}getClaimedHandler(t){return this.active.get(t)??null}isClaimedBy(t,r){return this.active.get(t)===r}isAnyPointerClaimed(){return this.active.size>0}onChange(t){return this.changeListeners.add(t),()=>{this.changeListeners.delete(t)}}emitChange(t,r,n){this.changeListeners.size!==0&&this.changeListeners.forEach(i=>{try{i({type:t,pointerId:r,handler:n})}catch{}})}log(t,r,n=""){if(typeof window<"u"&&window.__TERMDOCK_GESTURE_DEBUG__){const i=performance.now().toFixed(0);console.debug(`[GestureManager ${i}] ${t} ${r} ${n}`)}}sortedHandlers(){return this.sortedDirty&&(this.sorted=[...this.handlers.values()].sort((t,r)=>r.priority-t.priority),this.sortedDirty=!1),this.sorted}ensureListeners(){this.listenersRegistered||(this.listenersRegistered=!0,document.addEventListener("pointerdown",this.handlePointerDown,{capture:!0,passive:!1}),document.addEventListener("pointermove",this.handlePointerMove,{capture:!0,passive:!1}),document.addEventListener("pointerup",this.handlePointerUp,{capture:!0,passive:!1}),document.addEventListener("pointercancel",this.handlePointerCancel,{capture:!0,passive:!1}))}handlePointerDown=t=>{if(!xd(t))return;const r={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,startTime:performance.now()};this.pointerStates.set(t.pointerId,r);let n=!1;for(const i of this.sortedHandlers()){if(!this.handlerMatchesContainer(i,t)){this.log("skip-container",i.name);continue}i.onPointerDown(t,r)&&!n&&(this.active.set(t.pointerId,i.name),n=!0,this.log("claim",i.name,`pid=${t.pointerId} onPointerDown`),this.emitChange("claim",t.pointerId,i.name))}n&&t.preventDefault()};handlePointerMove=t=>{if(!xd(t)||!this.pointerStates.has(t.pointerId))return;let r=!1;for(const n of this.sortedHandlers()){if(!this.handlerMatchesContainer(n,t))continue;const i=this.active.get(t.pointerId)===n.name,l=n.onPointerMove(t,i);if(l==="claim"&&!r){const c=this.active.get(t.pointerId)??null;this.active.set(t.pointerId,n.name),r=!0,t.preventDefault(),c&&c!==n.name&&this.log("handoff",`${c}->${n.name}`,`pid=${t.pointerId}`),this.log("claim",n.name,`pid=${t.pointerId} onPointerMove`),this.emitChange("claim",t.pointerId,n.name)}if(l==="release"&&i&&!r){const c=this.active.get(t.pointerId);this.active.delete(t.pointerId),this.log("release",n.name,`pid=${t.pointerId}`),this.emitChange("release",t.pointerId,c??null)}}};handlePointerUp=t=>{if(!xd(t))return;for(const n of this.sortedHandlers())this.handlerMatchesContainer(n,t)&&n.onPointerUp(t);const r=this.active.get(t.pointerId)??null;this.active.delete(t.pointerId),this.pointerStates.delete(t.pointerId),this.emitChange("complete",t.pointerId,r)};handlePointerCancel=t=>{if(!xd(t))return;for(const n of this.sortedHandlers())this.handlerMatchesContainer(n,t)&&n.onPointerCancel(t);const r=this.active.get(t.pointerId)??null;this.active.delete(t.pointerId),this.pointerStates.delete(t.pointerId),this.emitChange("complete",t.pointerId,r)};handlerMatchesContainer(t,r){return t.container?t.container.contains(r.target):!0}}const t3=new eL,tL=90,rL=80,nL=70,sL=(e,t)=>{const{scrollMultiplier:r=1.2,maxScrollBoost:n=.8,boostDenominator:i=50,velocityAlpha:l=.15,maxVelocity:c=15,minVelocity:h=.3,decelerationRate:p=.998,enableKinetic:g=!0,shouldCaptureTouch:x,canStartScrollGesture:b,onScroll:w,onScrollWithCoords:A,onTap:k,onClickWithCoords:E,onClaimChange:I,tapThreshold:M=10,gestureName:Q="normal-scroll"}=t,j=1.06,F=C.useRef({lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1,pointerId:null,isCurrentlyScrolling:!1,gestureAxis:null}),V=C.useRef(0),$=C.useRef(0),te=C.useRef(0),se=C.useRef(null),qe=C.useRef(0),de=C.useRef(!1),oe=C.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),Oe=C.useCallback(()=>{se.current=null,V.current!==0&&(A&&$.current>0&&te.current>0?A(V.current,$.current,te.current):w&&w(V.current),V.current=0,$.current=0,te.current=0)},[w,A]),et=C.useCallback(()=>{se.current===null&&typeof window<"u"&&(se.current=window.requestAnimationFrame(Oe))},[Oe]),ce=C.useCallback((Ee,ee,Ke)=>{V.current+=Ee,ee!==void 0&&Ke!==void 0&&($.current=ee,te.current=Ke),et()},[et]),Be=C.useCallback(Ee=>{if(!Ee||!w)return!1;const ee=w(Ee);return ee?qe.current=0:qe.current++,ee},[w]),ot=C.useCallback(Ee=>{de.current!==Ee&&(de.current=Ee,I?.(Ee))},[I]),Ie=C.useCallback(()=>{const Ee=F.current;Ee.rafId!==null&&typeof window<"u"&&window.cancelAnimationFrame(Ee.rafId),Ee.rafId=null,se.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(se.current),se.current=null,V.current=0},[]),re=C.useRef(k);re.current=k;const Ue=C.useRef(E);Ue.current=E;const _e=C.useRef(x);_e.current=x;const K=C.useCallback(()=>{const Ee=e.current;if(!Ee||!("PointerEvent"in window))return()=>{};const ee=F.current,Ke={name:Q,priority:nL,get container(){return e.current??void 0},onPointerDown:(ge,it)=>(ge.pointerType!=="touch"||(ee.pointerId=ge.pointerId,ee.startX=it.startX,ee.startY=it.startY,ee.didMove=!1,ee.gestureAxis=null,ee.lastY=ge.clientY,ee.lastTime=oe(),ee.velocity=0,Ie()),!1),onPointerMove:(ge,it)=>{if(ge.pointerType!=="touch"||ee.pointerId!==ge.pointerId||!ee.lastY||!ee.lastTime)return"neutral";const ht=ge.clientX,Y=ge.clientY,be=oe(),ut=be-ee.lastTime,le=Y-ee.lastY;if(ee.startX!==null&&ee.startY!==null){const je=ht-ee.startX,xt=Y-ee.startY;if(!ee.didMove&&Math.hypot(je,xt)>=M&&(ee.didMove=!0),ee.gestureAxis===null&&ee.didMove){const dt=Math.abs(je),Dt=Math.abs(xt);dt>Dt*j?ee.gestureAxis="x":Dt>dt*j&&(ee.gestureAxis="y")}if(ee.gestureAxis==="x")return ee.isCurrentlyScrolling=!1,ot(!1),ee.lastY=Y,ee.lastTime=be,it?"release":"neutral";if(ee.gestureAxis===null)return ee.lastY=Y,ee.lastTime=be,"neutral"}if(ee.gestureAxis==="y"&&!it&&!(b?.()??!0))return ee.lastY=Y,ee.lastTime=be,ot(!1),"neutral";const pe=le/Math.max(ut,1);if(ee.velocity=ee.velocity*(1-l)+pe*l,ee.velocity=Math.max(-c,Math.min(c,ee.velocity)),Math.abs(le)>1){if(!it)return ot(!0),ee.lastY=Y,ee.lastTime=be,"claim";ee.isCurrentlyScrolling=!0;const je=r+Math.min(n,Math.abs(le)/i),xt=-le*je;ce(xt,ht,Y),ot(!0)}return ee.lastY=Y,ee.lastTime=be,it?"claim":"neutral"},onPointerUp:ge=>{if(ge.pointerType!=="touch"||ee.pointerId!==ge.pointerId)return;const it=ee.isCurrentlyScrolling;ee.isCurrentlyScrolling=!1,ot(!1);const ht=ee.rafId!==null||se.current!==null;!ee.didMove&&!ht&&ee.startX!==null&&ee.startY!==null&&re.current?.(ee.startX,ee.startY),!ee.didMove&&!ht&&ee.startX!==null&&ee.startY!==null&&Ue.current?.(ee.startX,ee.startY),ee.pointerId=null,ee.startX=null,ee.startY=null;const Y=ee.gestureAxis==="x";if(ee.gestureAxis=null,g&&it&&!Y&&Math.abs(ee.velocity)>h&&ee.didMove){const be=()=>{const ut=oe(),le=ut-(ee.lastTime||ut);if(ee.lastTime=ut,ee.velocity*=Math.pow(p,le),Math.abs(ee.velocity)<h){ee.velocity=0,Ie();return}if(!Be(-ee.velocity*le)&&qe.current>2){ee.velocity=0,Ie();return}ee.rafId=requestAnimationFrame(be)};ee.rafId=requestAnimationFrame(be)}},onPointerCancel:ge=>{ge.pointerType!=="touch"||ee.pointerId!==ge.pointerId||(ee.isCurrentlyScrolling=!1,ot(!1),ee.pointerId=null,ee.startX=null,ee.startY=null,ee.gestureAxis=null,Ie())}},wt=t3.register(Ke),tt=Ee.style.touchAction;return Ee.style.touchAction="none",()=>{ot(!1),wt(),Ee.style.touchAction=tt,Ie()}},[e,Q,r,n,i,l,c,h,p,oe,Ie,Be,ce,M,g,ot,b]),Le=C.useCallback(()=>{const Ee=e.current;if(!Ee)return()=>{};const ee=F.current,Ke=it=>{it.touches.length===1&&((x?.()??!0)&&it.cancelable&&it.preventDefault(),ee.isCurrentlyScrolling=!1,ee.gestureAxis=null,ee.lastY=it.touches[0].clientY,ee.startX=it.touches[0].clientX,ee.startY=it.touches[0].clientY,ee.didMove=!1,ee.velocity=0,Ie())},wt=it=>{if(it.touches.length!==1)return;const ht=it.touches[0].clientX,Y=it.touches[0].clientY;if(ee.startX!==null&&ee.startY!==null){const ut=ht-ee.startX,le=Y-ee.startY;if(!ee.didMove&&Math.hypot(ut,le)>=M&&(ee.didMove=!0),ee.gestureAxis===null&&ee.didMove){const pe=Math.abs(ut),je=Math.abs(le);pe>je*j?ee.gestureAxis="x":je>pe*j&&(ee.gestureAxis="y")}if(ee.gestureAxis==="x"){ee.isCurrentlyScrolling=!1,ee.lastY=Y;return}if(ee.gestureAxis===null){(x?.()??!1)&&it.cancelable&&it.preventDefault(),ee.lastY=Y;return}}if(it.preventDefault(),!ee.lastY){ee.lastY=Y;return}const be=Y-ee.lastY;if(Math.abs(be)>1){ee.isCurrentlyScrolling=!0;const ut=r+Math.min(n,Math.abs(be)/i),le=-be*ut;ce(le,ht,Y)}ee.lastY=Y},tt=it=>{if(!it.changedTouches?.[0])return;const Y=ee.isCurrentlyScrolling;ee.isCurrentlyScrolling=!1;const be=ee.rafId!==null||se.current!==null;!ee.didMove&&!be&&k&&ee.startX!==null&&ee.startY!==null&&k(ee.startX,ee.startY),!ee.didMove&&!be&&E&&ee.startX!==null&&ee.startY!==null&&E(ee.startX,ee.startY),ee.startX=null,ee.startY=null;const ut=ee.gestureAxis==="x";if(ee.gestureAxis=null,g&&Y&&!ut&&ee.didMove&&Math.abs(ee.velocity)>h){const le=()=>{if(ee.velocity*=Math.pow(p,16),Math.abs(ee.velocity)<h){ee.velocity=0,Ie();return}if(!Be(-ee.velocity*16)&&qe.current>2){ee.velocity=0,Ie();return}ee.rafId=requestAnimationFrame(le)};ee.rafId=requestAnimationFrame(le)}};Ee.addEventListener("touchstart",Ke,{passive:!1}),Ee.addEventListener("touchmove",wt,{passive:!1}),Ee.addEventListener("touchend",tt,{passive:!1}),Ee.addEventListener("touchcancel",tt,{passive:!1});const ge=Ee.style.touchAction;return Ee.style.touchAction="none",()=>{Ee.removeEventListener("touchstart",Ke),Ee.removeEventListener("touchmove",wt),Ee.removeEventListener("touchend",tt),Ee.removeEventListener("touchcancel",tt),Ee.style.touchAction=ge,Ie()}},[e,r,n,i,h,p,Ie,Be,ce,k,E,M,x,g]),fe=C.useCallback(()=>{Ie();const Ee=typeof window<"u"&&"PointerEvent"in window,ee=Ee?K():()=>{},Ke=Ee?()=>{}:Le();return()=>{ee(),Ke(),Ie()}},[K,Le,Ie]),$e=C.useCallback(()=>F.current.isCurrentlyScrolling||F.current.rafId!==null||se.current!==null,[]),ze=C.useCallback(()=>{Ie();const Ee=F.current;Ee.isCurrentlyScrolling=!1,Ee.velocity=0,Ee.lastY=null,Ee.lastTime=null,Ee.startX=null,Ee.startY=null,Ee.pointerId=null,Ee.didMove=!1,Ee.gestureAxis=null},[Ie]);return{setupTouchScroll:fe,isScrolling:$e,stopAllScroll:ze}};function t2(e){const{name:t,priority:r}=e,n=y.useRef(e.onPointerDown),i=y.useRef(e.onPointerMove),l=y.useRef(e.onPointerUp),c=y.useRef(e.onPointerCancel),h=y.useRef(e.container);n.current=e.onPointerDown,i.current=e.onPointerMove,l.current=e.onPointerUp,c.current=e.onPointerCancel,h.current=e.container,y.useEffect(()=>{const p={name:t,priority:r,get container(){const x=h.current;return typeof x=="function"?x():x},onPointerDown(x,b){return n.current?.(x,b)??!1},onPointerMove(x,b){return i.current?.(x,b)??"neutral"},onPointerUp(x){l.current?.(x)},onPointerCancel(x){c.current?.(x)}};return t3.register(p)},[t,r])}var Ds;(function(e){e.Light="light",e.Medium="medium",e.Heavy="heavy",e.Success="success",e.Warning="warning",e.Error="error"})(Ds||(Ds={}));Ds.Light,Ds.Medium,Ds.Heavy,Ds.Success,Ds.Warning,Ds.Error;Ds.Light,Ds.Medium,Ds.Heavy,Ds.Success,Ds.Warning,Ds.Error;Ds.Light,Ds.Medium,Ds.Heavy,Ds.Success,Ds.Warning,Ds.Error;const iL=()=>typeof navigator<"u"&&typeof navigator.vibrate=="function",aL=()=>typeof document<"u"&&!!document.body,oL=()=>{if(aL())try{const e=document.createElement("label");e.setAttribute("aria-hidden","true"),e.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0;";const t=document.createElement("input");t.type="checkbox",t.setAttribute("switch",""),e.appendChild(t),document.body.appendChild(e),e.click(),document.body.removeChild(e)}catch{}},r2=e=>Array.isArray(e)?[...e]:[e],lL=e=>{if(iL()){try{const i=r2(e),l=i.length===1?i[0]:i;navigator.vibrate(l)}catch{}return}const t=r2(e),r=Array.from({length:Math.ceil(t.length/2)},(i,l)=>[t[l*2]??0,t[l*2+1]??0]);let n=0;for(const[i,l]of r)i>0&&setTimeout(oL,n),n+=i+l},no=e=>lL(e);function r3({message:e}){const{t}=Mr();return a.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center px-4",children:a.jsx(gu,{dots:!0,label:e??t("terminal.loading"),className:"max-w-full rounded-full bg-surface-2 px-4 py-2 text-center shadow-sm"})})}function cL(){const{t:e}=Mr();return a.jsx(r3,{message:e("terminal.initializing")})}const uL=({message:e,onRetry:t})=>{const{t:r}=Mr();return a.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-4",children:a.jsxs("div",{className:"flex flex-col items-center gap-3 text-center max-w-md",children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-destructive/10 flex items-center justify-center",children:a.jsxs("svg",{className:"w-6 h-6 text-destructive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,role:"img","aria-label":r("terminal.error"),children:[a.jsx("title",{children:r("terminal.error")}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})]})}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("h3",{className:"font-medium text-foreground",children:r("terminal.failedToLoad")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e||r("terminal.unknownError")})]}),t&&a.jsx("button",{type:"button",onClick:t,className:"mt-2 px-5 py-2.5 bg-primary text-primary-foreground text-sm font-medium rounded-full hover:bg-primary/90 active:scale-[0.97] transition-all shadow-sm",children:r("common.retry")})]})})};function Zd(e){return Array.from(e)}function n2(e,t,r){return Math.max(t,Math.min(r,e))}function dL(e,t,r,n){const i=Zd(e),l=Zd(t);let c=n2(r,0,i.length);const h=n2(n,0,l.length);let p=0;for(;p<i.length&&p<l.length&&i[p]===l[p];)p++;let g=0;for(;g<i.length-p&&g<l.length-p&&i[i.length-1-g]===l[l.length-1-g];)g++;const x=i.length-p-g,b=l.slice(p,l.length-g).join(""),w=[];if(x>0||b){const A=p+x;c>A?w.push({left:c-A}):c<A&&w.push({right:A-c}),c=A,x>0&&(w.push({backspace:x}),c=p),b&&(w.push({insert:b}),c+=Zd(b).length)}return c>h?w.push({left:c-h}):c<h&&w.push({right:h-c}),c=h,{ops:w,cursor:c}}function s2(e){const t=e.value,r=e.selectionStart??t.length;return Zd(t.slice(0,r)).length}const fh=16,hL=10,i2=1.5,fL=1.8,a2=240,pL=125,mL=92;function gL(e,t,r){const n=Math.hypot(e,t),i=Math.abs(e),l=Math.abs(t),c=()=>i>=l*i2?e>0?"right":"left":l>=i*i2?t>0?"down":"up":"";if(r==="")return n>fh?c():"";if(n<hL)return"";if(n<=fh)return r;const h=c();if(h===""||h===r)return r;if(r==="left"&&h==="right"||r==="right"&&h==="left"||r==="up"&&h==="down"||r==="down"&&h==="up")return h;const g=r==="left"||r==="right";return(g?l:i)>=(g?i:l)*fL?h:r}function xL(e){const t=mL-fh,r=Math.min(Math.max((e-fh)/t,0),1);return a2-r*(a2-pL)}const bL="termdock-open-terminal-directory",Kp=/(?:\\[ \t]|[^\s`"'<>|()[\]{}=,:;!?:,;!?。、“”‘’])+/gu,yL=new RegExp(`^( *)(${Kp.source})`,"u"),vL=/[,;:!?]+$/u,wL=/^[a-z][a-z\d+.-]*:\/\//iu;function AL(e){return!e||e==="/"||wL.test(e)||e.startsWith("//")?!1:e.startsWith("/")||e.startsWith("~/")||e.startsWith("./")||e.startsWith("../")?!0:e.endsWith("/")||/^[^/:]+\/[^/:]+\/(?:[^/:]+\/?)+$/u.test(e)}function n3(e){const t=[];Kp.lastIndex=0;let r;for(;(r=Kp.exec(e))!==null;){const i=r[0].replace(vL,"");if(!AL(i))continue;const l=e.slice(r.index+i.length).match(/^:(\d+)(?::\d+)?(?=$|[\s:,,;;。!!??)\]}`])/u),c=l?Number(l[1]):void 0,h=c!==void 0&&Number.isSafeInteger(c)&&c>0;t.push({text:i,...h?{line:c}:{},startIndex:r.index,endIndex:r.index+i.length+(h?l[0].length:0)})}return t}function Wf(e){const t=[];for(const r of e.split("/"))!r||r==="."||(r===".."?t.pop():t.push(r));return`/${t.join("/")}`}function TL(e){return e.match(/^\/(?:home|Users)\/[^/]+/u)?.[0]??null}function CL(e,t){const r=e.replace(/\\([ \t])/gu,"$1").replace(/\/+$/u,"")||"/";if(r.startsWith("/"))return Wf(r);if(r==="~"||r.startsWith("~/")){const n=t?TL(t):null;return n?Wf(`${n}/${r.slice(2)}`):null}return t?.startsWith("/")?Wf(`${t}/${r}`):null}function bd(e,t){const r=e.buffer.active.getLine(t-1),n=e.buffer.active.getLine(t);if(!r||!n||n.isWrapped)return null;const i=r.translateToString(!0).trimEnd(),l=n.translateToString(!0),c=n3(i).at(-1),h=l.match(yL);if(!c||c.endIndex!==i.length||!c.text.endsWith("/")||!h||/^[~./]/u.test(h[2]))return null;const p=h[2];if(!p.includes("/")&&!/^[^/:]+\.[\p{L}\p{N}_-]+$/u.test(p))return null;let g=r.length-1;for(;g>=0&&!(r.getCell(g)?.getChars()||"").trim();)g-=1;const x=h[1].length;let b=0;for(let E=x;E<n.length;E+=1){const I=n.getCell(E);if(I?.getWidth()!==0){if(!I||/[\s/:]/u.test(I.getChars()||" "))break;b+=I.getWidth()}}if(r.length-g-1>=Math.max(8,x+2,b))return null;const A=r.getCell(g),k=n.getCell(x);return!A||!k||A.isFgDefault()||k.isFgDefault()||A.getFgColorMode()!==k.getFgColorMode()||A.getFgColor()!==k.getFgColor()?null:x}function SL(e,t){const r=e.buffer.active;let n=t-1;if(!r.getLine(n))return null;for(;n>0&&(r.getLine(n)?.isWrapped||bd(e,n)!==null);)n-=1;let i=t-1;for(;i+1<r.length&&(r.getLine(i+1)?.isWrapped||bd(e,i+1)!==null);)i+=1;let l="";const c=[],h=[];for(let g=n;g<=i&&l.length<=2048;g+=1){const x=r.getLine(g);if(!x)break;const b=g>n?bd(e,g)??0:0;let w=x.length;if(g<i&&bd(e,g+1)!==null)for(;w>0&&!(x.getCell(w-1)?.getChars()||"").trim();)w-=1;for(let A=b;A<w;A+=1){const k=x.getCell(A);if(!k||k.getWidth()===0)continue;const E=k.getChars()||" ";l+=E;for(let I=0;I<E.length;I+=1)c.push({x:A+1,y:g+1}),h.push({x:A+Math.max(1,k.getWidth()),y:g+1})}}const p=l.trimEnd().length;return{text:l.slice(0,p),startPositions:c.slice(0,p),endPositions:h.slice(0,p)}}function _L(e,t){return{provideLinks(r,n){const i=SL(e,r);if(!i){n(void 0);return}const l=n3(i.text).map(c=>({text:c.text,range:{start:i.startPositions[c.startIndex]??{x:c.startIndex+1,y:r},end:i.endPositions[c.endIndex-1]??{x:c.endIndex,y:r}},activate:()=>c.line===void 0?t(c.text):t(c.text,c.line)}));n(l.length>0?l:void 0)}}}function o2(e,t){if(!e||e.lines.length===0||!Number.isFinite(t)||t<=0)return 0;const r=Math.floor(t),n=Number.isFinite(e.lines.maxLength)&&e.lines.maxLength>0?Math.floor(e.lines.maxLength):null;let i=0;if(n!==null){const p=Math.max(0,n-r);e.ybase>p&&(e.ybase=p,Number.isFinite(e.ydisp)&&(e.ydisp=Math.min(e.ydisp,p)),i++)}let l=Math.max(0,Math.floor(e.ybase)+r),c=n===null?l:Math.min(l,n),h=Math.max(0,c-e.lines.length);if(h>r){const p=Math.max(0,e.lines.length-r);e.ybase>p&&(e.ybase=p,Number.isFinite(e.ydisp)&&(e.ydisp=Math.min(e.ydisp,p)),i++),l=Math.max(0,Math.floor(e.ybase)+r),c=n===null?l:Math.min(l,n),h=Math.max(0,c-e.lines.length)}for(let p=0;p<h;p++){const g=e.lines.length;if(e.lines.push(e.getBlankLine(void 0)),e.lines.length<=g)break;i++}return i}function l2(e,t=e.rows){const n=e._core?._bufferService?.buffers;return n?o2(n.normal,t)+o2(n.alt,t):0}function yd(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:0}function LL(e,t,r){const n=yd(e.fontBoundingBoxAscent)+yd(e.fontBoundingBoxDescent),i=yd(e.actualBoundingBoxAscent)+yd(e.actualBoundingBoxDescent);return Math.max(1,Math.floor(Math.ceil(n||i||t)*r))}const Jl=8,vd=36,c2=10,kL=1.08,IL=1.16,wd=6,EL=.94,NL=.08,RL=.12,ML=88,DL=36,BL=10,QL=14,jL=52;function P0(e){return e?e.replace(/\r\n|\r|\n/g,"\r").replace(/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g," ").replace(/[\u200B-\u200D\uFEFF]/g,""):""}const PL=80,OL=8;function Ad(e,t){return e.modes?.applicationCursorKeysMode===!0?`\x1BO${t}`:`\x1B[${t}`}function FL(e){return e.nativeEvent.isComposing||e.isComposing===!0||e.keyCode===229}function $L(e){try{const t=atob(e),r=Uint8Array.from(t,n=>n.charCodeAt(0));return new TextDecoder("utf-8").decode(r)}catch{return null}}function UL(e){const t="\x1B]52;";let r=0,n="";for(;r<e.length;){const i=e.indexOf(t,r);if(i===-1)return n+=e.slice(r),{cleaned:n,remainder:""};n+=e.slice(r,i);let l=-1,c=1;for(let g=i+t.length;g<e.length;g+=1){const x=e.charCodeAt(g);if(x===7){l=g,c=1;break}if(x===27&&g+1<e.length&&e[g+1]==="\\"){l=g,c=2;break}}if(l===-1)return{cleaned:n,remainder:e.slice(i)};const h=e.slice(i+t.length,l),p=h.indexOf(";");if(p>=0){const g=h.slice(p+1);if(g&&g!=="?"){const x=$L(g);x!==null&&navigator.clipboard?.writeText(x).catch(()=>{})}}r=l+c}return{cleaned:n,remainder:""}}function zL(e){if(typeof window>"u")return null;const t=[e,...Array.from(e.querySelectorAll("*"))];let r=null;for(const n of t){const l=window.getComputedStyle(n).overflowY;if(!(l!=="auto"&&l!=="scroll")){if(n.scrollHeight-n.clientHeight>2)return n;r||(r=n)}}return r}const HL=new Set(["visibility","bfcache","online"]),WL=5e5,GL=1e5,O0=260,F0=140,u2=80;function VL(e){return!e}let Nc=null;const qL=[{font:'400 13px "Termdock Mono"',text:"Termdock 0123456789 ~!@#$%^&*()[]{}"},{font:'700 13px "Termdock Mono"',text:"Termdock 0123456789 ~!@#$%^&*()[]{}"},{font:'400 13px "Noto Sans Mono CJK SC"',text:"终端中文路径"},{font:'700 13px "Noto Sans Mono CJK SC"',text:"终端中文路径"},{font:'400 13px "Termdock Star Symbol"',text:"✦✧"},{font:'400 13px "Noto Sans Symbols 2"',text:"⏺⏸⏹✓✗"}],YL=()=>{if(Nc)return Nc;if(typeof document>"u"||!("fonts"in document))return Nc=Promise.resolve(),Nc;const e=document.fonts;return Nc=Promise.allSettled(qL.map(({font:r,text:n})=>e.load(r,n))).then(()=>e.ready).then(()=>{}).catch(()=>{}),Nc},d2=e=>{if((!e||e.includes("var("))&&typeof window<"u"){const t=getComputedStyle(document.documentElement).getPropertyValue("--font-mono").trim();if(t)return t}return e};function h2(e){return e==="normal"||e==="bold"?e:Math.max(1,Math.min(1e3,Math.round(e)))}function ec(e,t,r){const n=e?.dimensions?.css.cell.height;return Math.max(8,Math.round(n||t*r))}function ZL(e){return{background:e.background,foreground:e.foreground,cursor:e.cursor||e.foreground,cursorAccent:e.cursorAccent||e.background,selectionBackground:e.selectionBackground||"rgba(0, 0, 0, 0.3)",selectionForeground:e.selectionForeground||e.foreground,black:e.black||"#6F6E69",red:e.red||"#AF3029",green:e.green||"#66800B",yellow:e.yellow||"#AD8301",blue:e.blue||"#205EA6",magenta:e.magenta||"#A02F6F",cyan:e.cyan||"#24837B",white:e.white||"#CECDC3",brightBlack:e.brightBlack||"#6F6E69",brightRed:e.brightRed||"#D14D41",brightGreen:e.brightGreen||"#879A39",brightYellow:e.brightYellow||"#D0A215",brightBlue:e.brightBlue||"#4385BE",brightMagenta:e.brightMagenta||"#CE5D97",brightCyan:e.brightCyan||"#3AA99F",brightWhite:e.brightWhite||"#FFFCF0"}}const f2=new Map;function KL(e,t,r,n,i){if(typeof window>"u"||typeof document>"u")return null;const l=e.getBoundingClientRect();if(l.width<24||l.height<24)return null;const c=window.devicePixelRatio||1,h=`${r}::${n}::${i}::${c}::${t}`;let p=f2.get(h);if(!p)try{const w=document.createElement("canvas").getContext("2d");if(!w)return null;w.font=`${r}px ${t}`;const A=w.measureText("M"),E=(Math.floor(A.width*c)+Math.round(n))/c,I=LL(A,r,i);E>=1&&I>=1&&(p={cellWidth:E,cellHeight:I},f2.set(h,p))}catch{return null}if(!p)return null;const g=Math.max(2,Math.floor(l.width/p.cellWidth)),x=Math.max(2,Math.floor(l.height/p.cellHeight));return!Number.isFinite(g)||!Number.isFinite(x)?null:{cols:g,rows:x}}async function p2(e){if(!e)return!1;try{if(!navigator.clipboard?.writeText)throw new Error("Clipboard API unavailable");return await navigator.clipboard.writeText(e),!0}catch{try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-9999px",t.style.top="0",document.body.appendChild(t),t.select();const r=document.execCommand("copy");return t.remove(),r}catch{return!1}}}function XL(e){const t=e.buffer.active,r=t.viewportY,n=Math.min(t.length,r+e.rows),i=[];for(let l=r;l<n;l+=1){const c=t.getLine(l);c&&i.push(c.translateToString(!0))}return i.join(`
|
|
64
|
-
`).replace(/\s+$/g,"")}function $0(e,t,r){const n=cc(e);if(!n)return null;const i=Math.max(0,Math.min(e.cols-1,Math.floor((t-n.originLeft)/n.cellW))),l=Math.max(0,Math.min(e.rows-1,Math.floor((r-n.originTop)/n.cellH)));return{col:i,row:e.buffer.active.viewportY+l}}function Gf(e,t,r){const n=t.row*e.cols+t.col,i=r.row*e.cols+r.col;if(n===i)return e.clearSelection(),!1;const l=Math.min(n,i),c=Math.max(n,i)+1,h=l%e.cols,p=Math.floor(l/e.cols);return e.select(h,p,c-l),!0}function m2(e){if(typeof document>"u")return 0;const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e)||"0");return Number.isFinite(t)?t:0}function JL(e,t,r,n,i=!0){if(typeof window>"u")return{left:0,top:0};const l=window.visualViewport,c=l?.offsetLeft??0,h=l?.offsetTop??0,p=l?.width??window.innerWidth,g=l?.height??window.innerHeight,x=m2("--safe-top-inset"),b=m2("--safe-bottom-inset"),w=n?__(n.terminal,n.anchor,n.focus):null,A=[];let k;if(i&&A.push({left:e-32,top:t-32,right:e+32,bottom:t+32}),n){const I=cc(n.terminal),{start:M,end:Q}=hh(n.anchor,n.focus,n.terminal.cols),j=Yd(n.terminal,M),F=Yd(n.terminal,Q);if(j&&A.push({left:j.x-24,top:j.y-48,right:j.x+24,bottom:j.y+4}),F&&I){const V=F.y+I.cellH;A.push({left:F.x-24,top:V-4,right:F.x+24,bottom:V+48})}if(w){const V=n.anchor.row*n.terminal.cols+n.anchor.col,$=n.focus.row*n.terminal.cols+n.focus.col,te=V<=$,se=w.right-w.left,de=n.anchor.row===n.focus.row?te?w.left+se*.25:w.right-se*.25:(w.left+w.right)/2,oe=Yd(n.terminal,n.focus),Oe=oe&&I?oe.y+I.cellH/2:t;k={vertical:n.focus.row<n.anchor.row?"below":"above",alignX:de,focusX:oe?.x??e,focusY:Oe}}}const E=L_({clientX:e,clientY:t,viewport:{left:c,top:h+x,right:c+p,bottom:h+g-b},terminal:r,width:ML,height:DL,margin:BL,fingerGap:QL,selection:w,avoid:A,preference:k,selectionGap:jL});return{left:E.left-r.left,top:E.top-r.top}}const s3=C.forwardRef(({sessionKey:e,sessionId:t,isLayoutVisible:r=!0,chunks:n,onInput:i,onResize:l,onFlowControl:c,onTmuxScroll:h,tmuxScrollSensitivity:p=.55,onDoubleTap:g,onInputFocusChange:x,onMobileLongPressCopyResult:b,onMobilePasteResult:w,onReadyChange:A,onSizeSynchronizedChange:k,onWritesSettled:E,onWriteProgress:I,onCursorPositionChange:M,onDirectoryLinkActivate:Q,terminalSettings:j,theme:F,className:V,enableTouchScroll:$,mobileLongPressMode:te="arrows",autoFocus:se=!0,cursorVisible:qe=!0,suppressSmoothScroll:de=!1},oe)=>{const{t:Oe}=Mr(),et=C.useRef(null),ce=C.useRef(null),Be=C.useRef(null),ot=C.useRef(null),Ie=C.useRef(null),re=C.useRef(de);re.current=de;const Ue=C.useRef(null),_e=C.useRef(i),K=C.useRef(l),Le=C.useRef(x),fe=C.useRef(c),$e=C.useRef(A);$e.current=A;const ze=C.useRef(k);ze.current=k;const Ee=C.useRef(E);Ee.current=E;const ee=C.useRef(I);ee.current=I;const Ke=C.useRef(M);Ke.current=M;const wt=C.useRef(Q);wt.current=Q;const tt=C.useRef(j.rendererMode),ge=C.useRef(""),it=C.useRef(0),ht=C.useRef(!1),Y=C.useRef(null),be=C.useRef(0),ut=C.useRef(0),le=C.useRef(!1),pe=C.useRef(null),je=C.useRef(null),xt=C.useRef(null),dt=C.useRef(!1),Dt=C.useRef(null),Xt=C.useRef(()=>{}),Ht=C.useRef(null),Bt=C.useRef(null),Wt=C.useRef(void 0),lr=C.useRef(null),ur=C.useRef(!1),Jt=C.useRef(0),Er=C.useRef(""),X=C.useRef(null),Re=C.useRef(null),We=C.useRef(!1),Qt=C.useRef(typeof window<"u"?window.devicePixelRatio:1),It=C.useRef(!1),ar=C.useRef(!1),Ot=C.useRef(null),Fe=C.useRef(""),yr=C.useRef(0),He=C.useRef(null),Se=C.useRef(null),Ve=C.useRef(null),Ct=C.useRef(0),jr=C.useRef(0),ft=C.useRef(0),Br=C.useRef(null),Wn=C.useRef(0),an=C.useRef(0),ke=C.useRef(!1),St=C.useRef(0),[,kt]=C.useReducer(L=>L+1,0),[ue,Nr]=C.useReducer(L=>L+1,0),[st,Gt]=C.useState("loading"),[Ur,gn]=C.useState(null),[Ln,wn]=C.useState(null);C.useEffect(()=>{const L=B=>{(B.target instanceof Element?B.target.closest("[data-termdock-terminal-dropzone]"):null)?.dataset.termdockTerminalDropzone===e&&wn(String(B.detail))};return window.addEventListener("termdock:file-drop-error",L),()=>window.removeEventListener("termdock:file-drop-error",L)},[e]);const sr=C.useMemo(()=>qc("terminal"),[]),[yn,Ts]=C.useState(!0),[Xr,Wr]=C.useState(!1);C.useEffect(()=>{if(!yn&&st!=="loading"){Wr(!1);return}const L=window.setTimeout(()=>Wr(!0),160);return()=>window.clearTimeout(L)},[yn,st]);const[on,An]=C.useState(!1),[jn,Gn]=C.useState({visible:!1,activeDir:""}),[Pn,hn]=C.useState(null),kn=C.useRef(null),Tn=C.useRef(!1),rn=C.useRef({active:!1,anchor:null,focus:null,dragging:null}),[Dr,ns]=C.useState(null),[Mt,q]=C.useState({x:0,y:0,cellW:8,cellH:17,cursorX:0}),Ye=C.useRef(Mt);Ye.current=Mt;const Lt=C.useRef(null),[wr,Et]=C.useState({active:!1,text:""}),hr=C.useRef(null),Sr=C.useRef(null);_e.current=i,K.current=l,Le.current=x,fe.current=c,tt.current=j.rendererMode;const Ir=C.useRef(se);Ir.current=se;const ln=C.useRef(qe);ln.current=qe;const zr=C.useRef($);zr.current=$;const Vn=C.useRef(r);Vn.current=r;const qn=VL(!!h),{rendererMode:In,fontFamily:cn,fontSize:H,fontWeight:we,fontWeightBold:Pe,letterSpacing:Ge,lineHeight:ve,minimumContrastRatio:lt,drawBoldTextInBrightColors:Nt,unicodeVersion:At,customGlyphs:ct,rescaleOverlappingGlyphs:_t,fontLigatures:_r,enableImages:jt,smoothScrolling:tr}=j,vt=In==="webgl",Tt=C.useCallback(()=>{kn.current!==null&&(clearTimeout(kn.current),kn.current=null),hn(null)},[]),fr=C.useCallback((L,B)=>{kn.current!==null&&(clearTimeout(kn.current),kn.current=null),Tn.current=!1,hn(L),!B?.persistent&&(kn.current=setTimeout(()=>{kn.current=null,hn(null)},3e3))},[]);C.useEffect(()=>{if(!Pn)return;const L=()=>{rn.current.active||Tt()},B=()=>Tt();return window.addEventListener("scroll",L,!0),window.addEventListener("resize",B),document.addEventListener("visibilitychange",B),()=>{window.removeEventListener("scroll",L,!0),window.removeEventListener("resize",B),document.removeEventListener("visibilitychange",B)}},[Tt,Pn]),C.useEffect(()=>()=>{kn.current!==null&&(clearTimeout(kn.current),kn.current=null)},[]);const at=C.useCallback(()=>{const L=Be.current,B=et.current,O=rn.current;if(!L||!B||!O.active||!O.anchor||!O.focus){ns(null);return}const z=B.getBoundingClientRect(),Ne=cc(L)?.cellH??16,{start:Te,end:Xe}=hh(O.anchor,O.focus,L.cols),nt=O.dragging==="start"?O.focus:O.dragging==="end"?O.anchor:Te,$t=O.dragging==="end"?O.focus:O.dragging==="start"?O.anchor:Xe,mr=(en,Mn)=>{const Sn=Yd(L,en);return Sn?{left:Sn.x-z.left,top:Mn?Sn.y-z.top:Sn.y+Ne-z.top}:null};ns({start:mr(nt,!0),end:mr($t,!1)})},[]),Rr=C.useCallback(L=>{const B=Be.current,O=et.current,z=rn.current;if(!B||!O||!z.active||!z.anchor||!z.focus)return;if(z.dragging){Tt();return}const Ne=O.getBoundingClientRect(),Te={x:(Ne.left+Ne.right)/2,y:(Ne.top+Ne.bottom)/2};fr(JL(L?.x??Te.x,L?.y??Te.y,Ne,{terminal:B,anchor:z.anchor,focus:z.focus},L!==void 0),{persistent:!0})},[Tt,fr]),Vr=C.useCallback(()=>{const L=rn.current;L.active=!1,L.anchor=null,L.focus=null,L.dragging=null,ns(null),Tt()},[Tt]);C.useEffect(()=>{if(!Dr)return;const L=Be.current;if(!L)return;const B=L.onScroll(()=>{at(),Rr()}),O=L.onResize(()=>Vr());return()=>{B.dispose(),O.dispose()}},[Dr,at,Rr,Vr]),C.useEffect(()=>{$||Le.current?.(!1)},[$]);const Nn=C.useCallback((L,B,O)=>{const z=(O.element?.offsetWidth||0)/O.cols||8,Ne=(O.element?.offsetHeight||0)/O.rows||16,Te=Math.max(1,Math.min(O.cols,Math.floor(L/z)+1)),Xe=Math.max(1,Math.min(O.rows,Math.floor(B/Ne)+1));return{x:Te,y:Xe}},[]),nn=C.useCallback((L,B,O)=>{const z=Be.current;if(!z)return!1;const Ne=L>0?-1:1;if(z.modes?.mouseTrackingMode!=="none"){let Te,Xe;if(B!==void 0&&O!==void 0){const mr=Nn(B,O,z);Te=mr.x,Xe=mr.y}else Te=z.buffer.active.cursorX+1,Xe=z.buffer.active.cursorY+1;const $t=`\x1B[<${Ne>0?64:65};${Te};${Xe}M`;return _e.current($t),!0}if(z.buffer.active.type==="alternate"){const Te=Ne>0?"\x1B[A":"\x1B[B";return _e.current(Te),!0}return null},[Nn]),fs=C.useCallback(L=>{const B=Be.current;if(!B)return!1;const O=ec(Be.current,H,ve),z=Jt.current+L,Ne=Math.trunc(z/O);return Jt.current=z-Ne*O,Ne!==0?(B.scrollLines(Ne),!0):!1},[H,ve]),On=C.useCallback(L=>{if(!Be.current)return!1;const z=ec(Be.current,H,ve)/Math.max(.1,p),Ne=Jt.current+L;let Te=Math.trunc(Ne/z);if(Jt.current=Ne-Te*z,Te===0&&Math.abs(Ne)>=z/3&&(Te=Ne>0?1:-1,Jt.current=0),Te===0)return!1;const Xe=Te>0?"down":"up",nt=Math.max(1,Math.min(Math.abs(Te),10));return h(Xe,nt),!0},[H,ve,h,p]),ls=C.useRef(nn);ls.current=nn;const Bs=C.useRef(fs);Bs.current=fs;const ii=C.useRef(On);ii.current=On;const Os=C.useRef(h);Os.current=h;const Pr=C.useRef({pointerId:null,tmuxActiveAtDown:!1});C.useEffect(()=>{if(!$)return;const L=et.current;if(!L)return;const B=z=>{z.pointerType==="touch"&&(Pr.current.pointerId=z.pointerId,Pr.current.tmuxActiveAtDown=!!Os.current)},O=z=>{z.pointerType==="touch"&&Pr.current.pointerId===z.pointerId&&(Pr.current.pointerId=null,Pr.current.tmuxActiveAtDown=!1)};return L.addEventListener("pointerdown",B,{capture:!0,passive:!0}),L.addEventListener("pointerup",O,{capture:!0,passive:!0}),L.addEventListener("pointercancel",O,{capture:!0,passive:!0}),()=>{L.removeEventListener("pointerdown",B,!0),L.removeEventListener("pointerup",O,!0),L.removeEventListener("pointercancel",O,!0)}},[$]);const Jr=C.useCallback(()=>{if(ke.current)return!1;const L=Pr.current;return L.pointerId!==null?!L.tmuxActiveAtDown:!Os.current},[]),$n=C.useCallback((L,B,O)=>{const z=ls.current(L,B,O);return z!==null?z:Os.current?ii.current(L):Bs.current(L)},[]),U=C.useCallback((L,B)=>{if(performance.now()<=an.current){an.current=0;return}const O=Be.current;if(O&&O.modes?.mouseTrackingMode!=="none"){const z=Nn(L,B,O),Ne=z.x,Te=z.y,Xe=`\x1B[<0;${Ne};${Te}M`,nt=`\x1B[<0;${Ne};${Te}m`;_e.current(Xe),_e.current(nt)}},[Nn]),ne=C.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),me=C.useCallback((L=700)=>{Br.current=null,Wn.current=ne()+L},[ne]),Me=C.useCallback(()=>zr.current&&ne()<=Wn.current,[ne]),Ut=C.useCallback(()=>{const L=Bt.current;return!L||typeof document>"u"?!1:document.activeElement===L},[]),Pt=C.useCallback(()=>{if(typeof window>"u")return!1;const L=nt=>{if(typeof document>"u")return 0;const $t=Number.parseFloat(document.documentElement.style.getPropertyValue(nt)||"0");return Number.isFinite($t)?$t:0},B=L("--kb-height");if(B>0)return B>=u2;const O=window.visualViewport;if(!O)return!1;const z=L("--app-base-vh")||window.innerHeight,Ne=L("--safe-bottom-inset"),Te=O.height+O.offsetTop;return Math.max(0,Math.round(z-Te-Ne))>=u2},[]),rr=C.useCallback(()=>{He.current!==null&&(clearTimeout(He.current),He.current=null),Se.current=null},[]),er=C.useCallback(L=>{const B=Be.current;let O="";for(const z of L)z.left&&(O+=(B?Ad(B,"D"):"\x1B[D").repeat(z.left)),z.right&&(O+=(B?Ad(B,"C"):"\x1B[C").repeat(z.right)),z.backspace&&(O+="".repeat(z.backspace)),z.insert&&(O+=z.insert);return O},[]),Or=C.useCallback(L=>{const B=L.value,O=P0(B),z=Fe.current;if(!(zr.current&&!O.includes("\r")&&!z.includes("\r"))){if(O===z)return;let mr=0;for(;mr<z.length&&mr<O.length&&z[mr]===O[mr];)mr++;const en=z.length-mr;en>0&&_e.current("".repeat(en));const Mn=O.slice(mr);if(Mn){try{Be.current?.clearSelection()}catch{}_e.current(Mn)}Fe.current=O,yr.current=Array.from(O).length;return}const Te=s2(L),{ops:Xe,cursor:nt}=dL(z,O,yr.current,Te),$t=er(Xe);if($t){if(Xe.some(mr=>mr.insert))try{Be.current?.clearSelection()}catch{}_e.current($t)}Fe.current=O,yr.current=nt},[er]),fn=C.useCallback((L,B)=>{const O=L.value,z=P0(O),Ne=Fe.current;if(z===Ne){rr();return}let Te=0;for(;Te<Ne.length&&Te<z.length&&Ne[Te]===z[Te];)Te++;const Xe=Ne.length-Te;if($&&!B?.immediate&&Xe>=OL){Se.current=L,He.current!==null&&clearTimeout(He.current),He.current=setTimeout(()=>{He.current=null;const $t=Se.current;Se.current=null,$t&&Or($t)},PL);return}rr(),Or(L)},[rr,$,Or]),P=C.useCallback(L=>{fn(L,{immediate:!0}),_e.current("\r"),L.value="",Fe.current="",yr.current=0},[fn]),xe=C.useCallback((L,B,O)=>{if(!L)return;rr();const z=B??Bt.current;z&&(z.value=""),Fe.current="",yr.current=0;try{Be.current?.clearSelection()}catch{}if(Vr(),O?.paste&&/[\r\n]/.test(L)){const Ne=O.submitAfterPaste??L.endsWith("\r"),Te=N_(L,Ne);return _e.current(Te,{skipModifierTransform:!0,consumeModifier:O?.consumeModifier,targeted:O?.targeted})}return _e.current(L,{skipModifierTransform:!0,consumeModifier:O?.consumeModifier,targeted:O?.targeted})},[rr]),Ae=C.useCallback((L,B)=>{const O=P0(L);return O?(wn(null),ff(O)||(xe(O,B,{paste:!0,submitAfterPaste:!1}),Tt()),!0):!1},[Tt,xe]);C.useEffect(()=>g7(L=>{if(L.sessionKey!==e||L.paths.length===0)return;const B=L.paths.map(jc).join(" ");xe(`${B} `);try{Bt.current?.focus({preventScroll:!0})}catch{}}),[xe,e]);const rt=C.useCallback(async(L,B)=>{wn(null);try{const O=await ST(L);return ff(`${jc(O)} `)||(xe(`${jc(O)} `,B),Tt()),!0}catch(O){return wn(O instanceof Error?O.message:"Image upload failed"),!1}},[Tt,xe]),pt=C.useCallback(async(L,B)=>{wn(null);try{const O=await kT(L);if(!O.length)return!1;const z=`${O.map(jc).join(" ")} `;return ff(z)||(xe(z,B),Tt()),!0}catch(O){return wn(O instanceof Error?O.message:"File upload failed"),!1}},[Tt,xe]),dr=C.useCallback(async(L,B)=>{wn(null);try{const O=ih()?.targetPeerId;let z;if(So()?.readClipboardFiles){try{const{files:Xe,paths:nt}=await LT();if(nt.length)return Ae(`${nt.map(jc).join(" ")} `,L);if(Xe.length)return pt(Xe,L)}catch(Xe){if(Xe instanceof zd)throw Xe;z=Xe}if(ih()?.targetPeerId!==O)throw new Error("目标服务已切换,请重新粘贴")}if(B?.files.length){const Xe=B.files[0];return B.files.length===1&&Xe.type.startsWith("image/")?rt(Xe,L):pt(B.files,L)}if(B?.text)return Ae(B.text,L);if(!So()?.readClipboardImage){if(typeof navigator.clipboard?.read=="function"){const Xe=await navigator.clipboard.read(),nt=await _T({read:async()=>Xe});if(nt.length)return pt(nt,L);const $t=await ig({read:async()=>Xe});if($t)return rt($t,L);for(const mr of Xe){if(!mr.types.includes("text/plain"))continue;const en=await(await mr.getType("text/plain")).text();return Ae(en,L)}return wn("剪贴板未提供可读取的文字、图片或视频;视频可通过文件按钮选择上传。"),!1}return navigator.clipboard?.readText?Ae(await navigator.clipboard.readText(),L):!1}const Ne=await ig(navigator.clipboard);if(Ne)return rt(Ne,L);if(!navigator.clipboard?.readText){if(z)throw z;return!1}const Te=await navigator.clipboard.readText();if(!Te&&z)throw z;return Ae(Te,L)}catch(O){return wn(O instanceof Error?O.message:"Clipboard read failed"),!1}},[pt,rt,Ae]),qt=C.useCallback(L=>{if(Lt.current&&!L?.repositionFrozen)return null;const B=Be.current;if(!B||!B.element)return null;const O=cc(B),Ne=B.element.querySelector(".xterm-screen")??B.element,Te=Ne.getBoundingClientRect(),Xe=O?.cellW??(Te.width>0&&B.cols>0?Te.width/B.cols:8),nt=O?.cellH??(Te.height>0&&B.rows>0?Te.height/B.rows:17),$t=Bt.current;let mr=Wt.current;$t&&(mr===void 0||mr!==null&&(!mr.isConnected||!mr.contains($t)))&&(mr=I_($t),Wt.current=mr);const en=B.buffer.active,Mn=en.cursorX*Xe,Sn=en.cursorY*nt,Un=E_(Ne,mr??null,Mn,Sn),Lr=Math.round(Un.x),xn=Math.round(Un.y),vn={x:Lr,y:xn,cellW:Xe,cellH:nt,cursorX:en.cursorX};return Ye.current=vn,Lt.current&&L?.repositionFrozen&&(Lt.current={...vn}),q(Gs=>Math.abs(Gs.x-Lr)<.5&&Math.abs(Gs.y-xn)<.5&&Math.abs(Gs.cellW-Xe)<.5&&Math.abs(Gs.cellH-nt)<.5&&Gs.cursorX===en.cursorX?Gs:vn),vn},[]),Rt=C.useRef(qt);Rt.current=qt,C.useEffect(()=>{if(!$)return;let L=null,B=null;const O=()=>{L!==null&&window.cancelAnimationFrame(L),B!==null&&window.cancelAnimationFrame(B),L=window.requestAnimationFrame(()=>{L=null,B=window.requestAnimationFrame(()=>{B=null,Rt.current({repositionFrozen:!0})})})};return window.visualViewport?.addEventListener("resize",O),window.visualViewport?.addEventListener("scroll",O),document.addEventListener("termdock:viewport-keyboard-change",O),()=>{L!==null&&window.cancelAnimationFrame(L),B!==null&&window.cancelAnimationFrame(B),window.visualViewport?.removeEventListener("resize",O),window.visualViewport?.removeEventListener("scroll",O),document.removeEventListener("termdock:viewport-keyboard-change",O)}},[$]);const Fr=C.useCallback(L=>{let B=0;for(const O of L){const z=O.codePointAt(0)??0,Ne=z>=4352&&z<=4447||z>=11904&&z<=12350||z>=12353&&z<=13311||z>=13312&&z<=19903||z>=19968&&z<=40959||z>=40960&&z<=42191||z>=44032&&z<=55203||z>=63744&&z<=64255||z>=65072&&z<=65103||z>=65280&&z<=65376||z>=65504&&z<=65510||z>=127744&&z<=129791;B+=Ne?2:1}return B},[]),Rn=C.useCallback(L=>{const B=Be.current,{cellW:O,cellH:z}=Mt;if(!B||!L)return{width:Math.max(1,Math.round(O)),height:Math.max(1,Math.round(z)),whiteSpace:"pre"};const Te=Lt.current?.cursorX??B.buffer.active.cursorX,Xe=Math.max(1,B.cols),nt=Math.max(1,Fr(L)),$t=Math.max(1,Xe-Te);if(nt<=$t)return{width:Math.max(1,Math.round(nt*O)),height:Math.max(1,Math.round(z)),whiteSpace:"pre"};const mr=nt-$t,Mn=1+Math.ceil(mr/Xe);return{width:Math.max(1,Math.round($t*O)),height:Math.max(1,Math.round(Mn*z)),whiteSpace:"pre-wrap"}},[Mt,Fr]),xs=C.useCallback(()=>{Wt.current=void 0;const L=Rt.current();Lt.current={...L??Ye.current}},[]),Mi=C.useCallback(()=>{Lt.current=null},[]),ss=C.useCallback(L=>{if(!It.current&&Lt.current===null)return!1;if(It.current=!1,Lt.current=null,rr(),Ot.current!==null&&(clearTimeout(Ot.current),Ot.current=null),ar.current=!1,L){L.value=Fe.current;try{L.setSelectionRange(L.value.length,L.value.length)}catch{}}return Et(B=>B.active||B.text?{active:!1,text:""}:B),!0},[rr]),ai=C.useCallback((L,B)=>{const O=Bt.current;if(O)try{O.removeAttribute("readonly");const Ne=typeof document<"u"&&document.activeElement===O&&!Pt(),Te=ne(),Xe=Te-St.current;St.current=Te,Ne&&Xe>600?(O.blur(),O.removeAttribute("readonly"),O.focus(),St.current=ne()):O.focus()}catch{}},[Pt,ne]),oi=C.useCallback(L=>{jr.current=ne()+L},[ne]),da=C.useCallback(()=>$?ne()<=jr.current:!1,[$,ne]),pn=C.useCallback(L=>{oi(L),ft.current=ne()},[oi,ne]),cs=C.useCallback(()=>{$&&Bt.current?.removeAttribute("readonly")},[$]),ks=C.useCallback(L=>L instanceof HTMLElement&&(L.closest('[data-terminal-copy-popover="true"]')!==null||L.closest('[data-mobile-copy-button="true"]')!==null||L.closest("[data-selection-handle]")!==null),[]),Ba=C.useCallback(L=>{if(cs(),pn(O0),!$||L.pointerType!=="touch"){Br.current=null;return}const B=L.target;if(ks(B)){me();return}Pn&&!(B instanceof HTMLElement&&B.closest('[data-terminal-copy-popover="true"]'))&&Tt(),Br.current={pointerId:L.pointerId,startX:L.clientX,startY:L.clientY,moved:!1}},[Tt,$,pn,ks,Pn,cs,me]),Ci=C.useCallback(L=>{pn(O0);const B=Br.current;!B||B.pointerId!==L.pointerId||Math.hypot(L.clientX-B.startX,L.clientY-B.startY)>12&&(B.moved=!0)},[pn]),lo=C.useCallback(L=>{pn(F0);const B=Br.current;Br.current=null,!(!$||L.pointerType!=="touch")&&(!B||B.pointerId!==L.pointerId||B.moved||Me()||ai(L.clientX,L.clientY))},[$,pn,ai,Me]),ha=C.useCallback(()=>{Br.current=null,pn(F0)},[pn]),un=C.useMemo(()=>({enableKinetic:!0}),[]),fa=C.useRef(()=>!1),Is=C.useRef(ai);Is.current=ai;const Zo=C.useCallback((L,B)=>{Me()||Is.current(L,B)},[Me]),Si=C.useRef(g);Si.current=g;const co=C.useRef(b);co.current=b;const Qa=C.useRef(w);Qa.current=w;const pa=C.useCallback(()=>{if(Tn.current)return;Tn.current=!0,me();const L=Be.current,B=L?.hasSelection()?L.getSelection():"";try{L?.clearSelection()}catch{}Ai.flushSync(()=>{Vr()}),(async()=>{const O=await p2(B);co.current?.(O)})()},[Vr,me]),Yi=C.useCallback(L=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:L}}))},[]),{setupTouchScroll:ja,stopAllScroll:li}=sL(et,{...un,shouldCaptureTouch:fa.current,canStartScrollGesture:Jr,onScroll:$n,onScrollWithCoords:$n,onClickWithCoords:U,onTap:Zo,onClaimChange:Yi,tapThreshold:12,gestureName:`normal-scroll:${e}`});C.useEffect(()=>{if(!$)return;Bt.current?.setAttribute("readonly","");const L=ja();return()=>{L()}},[$,ja]),C.useEffect(()=>{if(!$)return;let L=Pt();const B=()=>{const O=Pt();if(L&&!O){const z=Bt.current;z&&typeof document<"u"&&document.activeElement===z&&(z.setAttribute("readonly",""),z.blur())}L=O};return window.visualViewport?.addEventListener("resize",B),window.visualViewport?.addEventListener("scroll",B),document.addEventListener("termdock:viewport-keyboard-change",B),()=>{window.visualViewport?.removeEventListener("resize",B),window.visualViewport?.removeEventListener("scroll",B),document.removeEventListener("termdock:viewport-keyboard-change",B)}},[$,Pt]),C.useEffect(()=>{if(!$)return;const L=et.current;if(!L)return;const B=z=>{const Te=z.sourceCapabilities?.firesTouchEvents===!0,Xe=ne()-ft.current<=1200;return!Te&&!Xe?!1:L.contains(z.target)},O=z=>{B(z)&&(z.cancelable&&z.preventDefault(),z.stopImmediatePropagation(),z.stopPropagation())};return L.addEventListener("mousedown",O,{capture:!0,passive:!1}),L.addEventListener("mouseup",O,{capture:!0,passive:!1}),L.addEventListener("click",O,{capture:!0,passive:!1}),document.addEventListener("mouseup",O,{capture:!0,passive:!1}),()=>{L.removeEventListener("mousedown",O,!0),L.removeEventListener("mouseup",O,!0),L.removeEventListener("click",O,!0),document.removeEventListener("mouseup",O,!0)}},[$,ne]);const us=C.useRef({pointerId:null,lastX:null,lastY:null,startX:null,startY:null,gestureAxis:null,remainder:0,didScroll:!1,rafId:null,velocity:0,instantSpeed:0}),Cn=C.useCallback(()=>{const L=us.current;L.rafId!==null&&(cancelAnimationFrame(L.rafId),L.rafId=null)},[]),ma=C.useCallback((L,B,O)=>{const z=Be.current;if(!z||!z.element||!z.cols||!z.rows)return null;const Ne=us.current,Te=z.element.getBoundingClientRect(),Xe=B??Ne.lastX??Te.left+Te.width/2,nt=O??Ne.lastY??Te.top+Te.height/2,$t=Xe-Te.left,mr=nt-Te.top,en=z.element.offsetWidth/z.cols||8,Mn=z.element.offsetHeight/z.rows||16,Sn=Math.max(1,Math.min(z.cols,Math.floor($t/en)+1)),Un=Math.max(1,Math.min(z.rows,Math.floor(mr/Mn)+1));return`\x1B[<${L==="up"?64:65};${Sn};${Un}M`},[]),Xn=C.useCallback((L,B,O,z)=>{if(B<=0)return;const Ne=ma(L,O,z);Ne&&_e.current(B===1?Ne:Ne.repeat(B))},[ma]),ci=C.useRef(Xn);ci.current=Xn;const _i=C.useRef(()=>{}),Zi=C.useCallback(()=>{const B=ec(Be.current,H,ve)/Math.max(.1,p),O=1+us.current.instantSpeed*.1;return B/Math.min(6,O)},[H,ve,p]),Pa=C.useCallback(()=>{const L=us.current;L.rafId=null;const B=Zi();let O=0,z=0;for(;O+z<wd&&L.remainder>=B;)L.remainder-=B,z++;for(;O+z<wd&&L.remainder<=-B;)L.remainder+=B,O++;if(z>0&&Xn("down",z),O>0&&Xn("up",O),O+z>0)L.rafId=requestAnimationFrame(Pa);else if(L.pointerId!==null&&Math.abs(L.remainder)>=B/3){const Te=L.remainder>0?"down":"up";L.remainder=0,Xn(Te,1),L.rafId=requestAnimationFrame(Pa)}},[Zi,Xn]),Oa=C.useCallback(()=>{const L=us.current;L.rafId===null&&typeof requestAnimationFrame<"u"&&(L.rafId=requestAnimationFrame(Pa))},[Pa]),uo=C.useCallback(L=>{if(L.pointerType!=="touch")return!1;Cn();const B=us.current;return B.pointerId=L.pointerId,B.lastX=L.clientX,B.lastY=L.clientY,B.startX=L.clientX,B.startY=L.clientY,B.gestureAxis=null,B.remainder=0,B.velocity=0,B.instantSpeed=0,B.didScroll=!1,!1},[Cn]),ml=C.useCallback((L,B)=>{if(ke.current)return B?"release":"neutral";if(performance.now()<=an.current)return"neutral";const O=us.current;if(L.pointerType!=="touch"||L.pointerId!==O.pointerId||O.lastY==null)return"neutral";if(O.gestureAxis===null&&O.startX!==null&&O.startY!==null){const Te=Math.abs(L.clientX-O.startX),Xe=Math.abs(L.clientY-O.startY);if(Te>c2||Xe>c2){if(Te>Xe*kL)return O.gestureAxis="x","release";Xe>Te*IL&&(O.gestureAxis="y")}}if(O.gestureAxis==="x")return O.lastX=L.clientX,O.lastY=L.clientY,"release";if(O.gestureAxis===null)return O.lastX=L.clientX,O.lastY=L.clientY,"neutral";const z=L.clientY-O.lastY;O.lastX=L.clientX,O.lastY=L.clientY;const Ne=-z;if(O.remainder+=Ne,O.instantSpeed=Math.abs(Ne),O.velocity=O.velocity*.45+Ne*.55,B){const Xe=ec(Be.current,H,ve)/Math.max(.1,p);Math.abs(O.remainder)>=Xe/3&&(O.didScroll=!0,Oa())}return"claim"},[H,ve,p,Oa]),Ko=C.useCallback(L=>{const B=us.current;if(L.pointerType!=="touch"||L.pointerId!==B.pointerId)return;if(Cn(),B.pointerId=null,B.lastX=null,B.lastY=null,B.startX=null,B.startY=null,B.instantSpeed=0,B.gestureAxis==="x"){B.gestureAxis=null;return}B.gestureAxis=null;const z=ec(Be.current,H,ve)/Math.max(.1,p);if(B.didScroll&&Math.abs(B.velocity)>z*NL){const Ne=()=>{B.velocity*=EL,B.remainder+=B.velocity;const Te=1+Math.abs(B.velocity)*.1,Xe=z/Math.min(6,Te);if(Math.abs(B.velocity)<z*RL){if(Math.abs(B.remainder)>=Xe/3){const mr=B.remainder>0?"down":"up";Xn(mr,1),B.remainder=0}B.velocity=0,B.rafId=null;return}let nt=0,$t=0;for(;nt+$t<wd&&B.remainder>=Xe;)B.remainder-=Xe,$t++;for(;nt+$t<wd&&B.remainder<=-Xe;)B.remainder+=Xe,nt++;$t>0&&Xn("down",$t),nt>0&&Xn("up",nt),B.rafId=requestAnimationFrame(Ne)};B.rafId=requestAnimationFrame(Ne)}else Math.abs(B.remainder)>=z/3&&Oa();B.didScroll&&L.stopImmediatePropagation()},[Cn,Xn,Oa,p,H,ve]),Io=C.useCallback(L=>{const B=us.current;L.pointerType!=="touch"||L.pointerId!==B.pointerId||(Cn(),B.pointerId=null,B.lastX=null,B.lastY=null,B.startX=null,B.startY=null,B.gestureAxis=null,B.remainder=0,B.velocity=0,B.didScroll=!1)},[Cn]);t2({name:`tmux-scroll:${e}`,priority:rL,container:()=>et.current,onPointerDown:$&&h?uo:void 0,onPointerMove:$&&h?ml:void 0,onPointerUp:$&&h?Ko:void 0,onPointerCancel:$&&h?Io:void 0});const Fs=C.useRef({pointerId:null,originX:0,originY:0,holdTimer:null,mode:"idle",longPressMode:"arrows",copyStart:null,copyDidSelect:!1,edgeScrollTimer:null,edgeScrollDir:0,edgeScrollLines:0,edgeClientX:0,edgeClientY:0,gestureLocked:!1,joystickDir:"",joystickRepeatTimer:null,repeatIntervalMs:260,lastHapticTime:0,lastTapTime:0,lastTapX:0,lastTapY:0,tapStartX:0,tapStartY:0,tapDidMove:!1}),Eo=C.useRef(null);Eo.current=et.current;const ga=Eo,xa=_e,ba=C.useRef(te);ba.current=te;const ps=C.useCallback(L=>{const B=Fs.current;B.gestureLocked!==L&&(B.gestureLocked=L,Yi(L))},[Yi]),Li=C.useCallback(()=>{const L=Fs.current;L.edgeScrollTimer!==null&&(clearInterval(L.edgeScrollTimer),L.edgeScrollTimer=null),L.edgeScrollDir=0},[]),ho=C.useCallback(L=>{const B=Be.current,O=Fs.current;if(B){if(O.mode==="copy"&&O.copyStart){O.copyDidSelect=Gf(B,O.copyStart,L)||O.copyDidSelect;return}if(O.mode==="adjust"){const z=rn.current;if(!z.active||!z.anchor)return;z.focus=S_(B,L),Gf(B,z.anchor,z.focus),at()}}},[at]),fo=C.useCallback((L,B)=>{const O=Be.current,z=Fs.current;if(!O)return;const Ne=cc(O);if(!Ne)return;const Te=Ne.originTop,Xe=Ne.originTop+O.rows*Ne.cellH,nt=Math.max(28,Ne.cellH*1.5),$t=B-Te,mr=Xe-B;let en=0,Mn=0;if($t<nt?(en=-1,Mn=Math.min(1,(nt-$t)/nt)):mr<nt&&(en=1,Mn=Math.min(1,(nt-mr)/nt)),z.edgeClientX=L,z.edgeClientY=B,en===0){Li();return}z.edgeScrollDir=en,z.edgeScrollLines=1+Math.round(Mn*5),z.edgeScrollTimer===null&&(z.edgeScrollTimer=setInterval(()=>{const Sn=Be.current,Un=Fs.current;if(!Sn||Un.edgeScrollDir===0)return;if(Un.mode!=="copy"&&Un.mode!=="adjust"){Li();return}Sn.scrollLines(Un.edgeScrollDir*Un.edgeScrollLines);const Lr=$0(Sn,Un.edgeClientX,Un.edgeClientY-vd);Lr&&ho(Lr)},60))},[ho,Li]),po=C.useCallback(L=>{if(L.pointerType!=="touch")return!1;const B=ga.current;if(!B)return!1;const O=L.target;if(!(O instanceof HTMLElement)||!B.contains(O)||O.closest('[data-mobile-keyboard="true"]'))return!1;const z=Fs.current;z.longPressMode=ba.current;const Ne=rn.current;if(Ne.active&&z.pointerId===null){const Te=O.closest("[data-selection-handle]");if(Te instanceof HTMLElement){const Xe=Be.current,nt=Te.dataset.selectionHandle==="start"?"start":"end";if(Xe&&Ne.anchor&&Ne.focus){const $t=hh(Ne.anchor,Ne.focus,Xe.cols);return Ne.anchor=nt==="start"?$t.end:$t.start,Ne.focus=nt==="start"?$t.start:$t.end,Ne.dragging=nt,Tt(),z.pointerId=L.pointerId,z.tapStartX=L.clientX,z.tapStartY=L.clientY,z.tapDidMove=!1,z.mode="adjust",ke.current=!0,me(1800),Bt.current?.setAttribute("readonly",""),li(),Cn(),no(Jl),ps(!0),!0}}if(!O.closest("[data-terminal-copy-popover]")){Vr();try{Be.current?.clearSelection()}catch{}}}if(z.pointerId!==null)return!0;if(ke.current=!1,Si.current){const Te=performance.now(),Xe=L.clientX,nt=L.clientY;if(z.lastTapTime!==0&&Te-z.lastTapTime<=300&&Math.hypot(Xe-z.lastTapX,nt-z.lastTapY)<=25)return no(Jl),an.current=performance.now()+500,Si.current?.(),An(!0),Sr.current&&clearTimeout(Sr.current),Sr.current=setTimeout(()=>An(!1),400),z.lastTapTime=0,!0}return z.holdTimer!==null&&(clearTimeout(z.holdTimer),z.holdTimer=null),z.joystickRepeatTimer!==null&&(clearTimeout(z.joystickRepeatTimer),z.joystickRepeatTimer=null),z.joystickDir="",z.copyStart=null,z.copyDidSelect=!1,z.pointerId=L.pointerId,z.originX=L.clientX,z.originY=L.clientY,z.tapStartX=L.clientX,z.tapStartY=L.clientY,z.tapDidMove=!1,z.mode="holding",z.longPressMode==="copy"&&ps(!0),z.holdTimer=setTimeout(()=>{if(z.holdTimer=null,z.mode==="holding"){if(z.longPressMode==="copy"){const Te=Be.current,Xe=Te?$0(Te,z.tapStartX,z.tapStartY):null;if(!Te||!Xe){z.mode="idle";return}z.mode="copy",ke.current=!0,me(1800),Bt.current?.setAttribute("readonly",""),z.copyStart=Xe,z.copyDidSelect=!1,li(),Cn(),Te.clearSelection(),no(Jl),ps(!0);return}z.mode="arrow",ke.current=!0,me(1e3),li(),Cn(),no(Jl),ps(!0),requestAnimationFrame(()=>{Gn({visible:!0,activeDir:""})})}},350),!0},[ps,Tt,Vr]),$s=C.useCallback((L,B)=>{if(L.pointerType!=="touch")return"neutral";const O=Fs.current;if(O.mode==="arrow"&&L.pointerId!==O.pointerId||O.mode==="copy"&&L.pointerId!==O.pointerId||O.mode!=="arrow"&&O.mode!=="copy"&&L.pointerId!==O.pointerId)return"neutral";const z=L.clientX-O.tapStartX,Ne=L.clientY-O.tapStartY;if(Math.hypot(z,Ne)>10&&(O.tapDidMove=!0),O.mode==="holding"){if(!B)return O.holdTimer!==null&&(clearTimeout(O.holdTimer),O.holdTimer=null),ps(!1),ke.current=!1,O.mode="idle","neutral";const Te=L.clientX-O.originX,Xe=L.clientY-O.originY;return O.longPressMode==="copy"&&Math.hypot(Te,Xe)>20?(O.holdTimer!==null&&(clearTimeout(O.holdTimer),O.holdTimer=null),ps(!1),ke.current=!1,O.mode="idle","release"):Math.hypot(Te,Xe)>20?(O.holdTimer!==null&&(clearTimeout(O.holdTimer),O.holdTimer=null),ps(!1),O.mode="idle","release"):"claim"}if(O.mode==="adjust"){if(!B)return"claim";li();const Te=Be.current,Xe=rn.current;if(!Te||!Xe.active||!Xe.anchor||!Xe.focus)return"claim";const nt=$0(Te,L.clientX,L.clientY-vd);return nt&&(ho(nt),fo(L.clientX,L.clientY)),"claim"}if(O.mode==="copy"){if(!B)return"claim";li();const Te=Be.current;if(!Te||!O.copyStart)return"claim";const Xe=$0(Te,L.clientX,L.clientY-vd);return Xe&&(ho(Xe),fo(L.clientX,L.clientY)),"claim"}if(O.mode==="arrow"){if(!B)return"claim";const Te={up:"\x1B[A",down:"\x1B[B",left:"\x1B[D",right:"\x1B[C"},Xe=L.clientX-O.tapStartX,nt=L.clientY-O.tapStartY,$t=gL(Xe,nt,O.joystickDir);if($t&&$t!==O.joystickDir&&(O.originX=L.clientX,O.originY=L.clientY),$t){const mr=L.clientX-O.originX,en=L.clientY-O.originY,Mn=Math.hypot(mr,en);if(O.repeatIntervalMs=xL(Mn),$t!==O.joystickDir){O.joystickRepeatTimer!==null&&clearTimeout(O.joystickRepeatTimer);const Sn=O.joystickDir==="";O.joystickDir=$t,xa.current(Te[$t]);const Un=performance.now();Un-O.lastHapticTime>120&&(no(Jl),O.lastHapticTime=Un);const Lr=Sn?400:300;O.joystickRepeatTimer=setTimeout(function xn(){if(O.joystickDir!==$t)return;xa.current(Te[$t]);const vn=performance.now();vn-O.lastHapticTime>120&&(no(Jl),O.lastHapticTime=vn),O.joystickRepeatTimer=setTimeout(xn,O.repeatIntervalMs)},Lr)}Gn({visible:!0,activeDir:$t})}else O.joystickRepeatTimer!==null&&(clearTimeout(O.joystickRepeatTimer),O.joystickRepeatTimer=null),O.joystickDir="",Gn({visible:!0,activeDir:""});return"claim"}return"neutral"},[ps,ho,fo]),Us=C.useCallback(L=>{if(L.pointerType!=="touch"||L.pointerId!==Fs.current.pointerId)return;const B=Fs.current;if(B.mode==="copy"){li(),Cn(),Li(),ps(!1);const z=Be.current;let Ne=null;if(z&&B.copyStart&&(Ne=$0(z,L.clientX,L.clientY-vd),Ne&&(B.copyDidSelect=Gf(z,B.copyStart,Ne)||B.copyDidSelect)),z&&B.copyDidSelect&&z.hasSelection()&&B.copyStart){const Te=rn.current;Te.active=!0,Te.anchor=B.copyStart,Te.focus=Ne??B.copyStart,Te.dragging=null,at(),Rr({x:L.clientX,y:L.clientY}),me(1800),no(Jl)}else co.current?.(!1);B.holdTimer!==null&&(clearTimeout(B.holdTimer),B.holdTimer=null),B.copyStart=null,B.copyDidSelect=!1,B.pointerId=null,B.mode="idle",ke.current=!1;return}if(B.mode==="adjust"){li(),Cn(),Li(),ps(!1),rn.current.dragging=null,at(),Rr({x:L.clientX,y:L.clientY}),me(1800),B.pointerId=null,B.mode="idle",ke.current=!1;return}if(B.mode==="arrow"){li(),Cn(),ps(!1),Gn({visible:!1,activeDir:""}),B.holdTimer!==null&&(clearTimeout(B.holdTimer),B.holdTimer=null),B.joystickRepeatTimer!==null&&(clearTimeout(B.joystickRepeatTimer),B.joystickRepeatTimer=null),B.joystickDir="",B.pointerId=null,B.mode="idle",ke.current=!1;return}const O=ga.current;if(O&&!B.tapDidMove){const z=L.target;z instanceof HTMLElement&&O.contains(z)&&!z.closest('[data-mobile-keyboard="true"]')&&(B.lastTapTime=performance.now(),B.lastTapX=L.clientX,B.lastTapY=L.clientY)}else B.tapDidMove&&(B.lastTapTime=0);B.holdTimer!==null&&(clearTimeout(B.holdTimer),B.holdTimer=null),B.joystickRepeatTimer!==null&&(clearTimeout(B.joystickRepeatTimer),B.joystickRepeatTimer=null),B.joystickDir="",ps(!1),ke.current=!1,B.copyStart=null,B.copyDidSelect=!1,B.pointerId=null,B.mode="idle"},[ps,li,me,Li,at,Rr]),No=C.useCallback(()=>{const L=Fs.current;ps(!1),Li(),L.mode==="arrow"&&Gn({visible:!1,activeDir:""}),L.mode==="adjust"&&(rn.current.dragging=null,at(),Rr()),L.holdTimer!==null&&(clearTimeout(L.holdTimer),L.holdTimer=null),L.joystickRepeatTimer!==null&&(clearTimeout(L.joystickRepeatTimer),L.joystickRepeatTimer=null),L.joystickDir="",ke.current=!1,L.copyStart=null,L.copyDidSelect=!1,L.pointerId=null,L.tapDidMove=!1,L.mode="idle"},[ps,Li,at,Rr]);t2({name:`long-press:${e}`,priority:tL,container:()=>et.current,onPointerDown:$?po:void 0,onPointerMove:$?$s:void 0,onPointerUp:$?Us:void 0,onPointerCancel:$?No:void 0});const Yn=C.useCallback((L={})=>{ut.current+=1,ge.current="",je.current=null,it.current=0,dt.current=!1,Dt.current=null,ht.current&&(ht.current=!1,L.notifyFlowResume===!0&&fe.current?.(!1)),Y.current=null,le.current=!1,pe.current=null,Er.current=""},[]),is=C.useCallback((L="unknown")=>{const B=Ue.current,O=Be.current,z=et.current;if(!B||!O||!z||!O.element||!O.cols||!O.rows)return;const Ne=z.getBoundingClientRect();if(Ne.width<24||Ne.height<24){sr("skip fit: container too small",{reason:L,width:Math.round(Ne.width),height:Math.round(Ne.height)});return}try{const Te={cols:O.cols,rows:O.rows},Xe=O.buffer.active,nt=j_(Xe.type,Xe.baseY,Xe.viewportY),$t=B.proposeDimensions();if(!$t||$t.cols<=0||$t.rows<=0)return;const mr=l2(O,Te.rows),en=D_({reason:L,currentCols:Te.cols,currentRows:Te.rows,proposedCols:$t.cols,proposedRows:$t.rows});let Mn=0;if(en.accept){hi.current&&Os.current&&(Te.cols!==$t.cols||Te.rows!==$t.rows)&&Ie.current?.begin();const Un=O.options.smoothScrollDuration;try{O.options.smoothScrollDuration=0,O.resize($t.cols,$t.rows),Mn=l2(O,$t.rows),nt&&O.scrollToBottom()}finally{O.options.smoothScrollDuration=Un}Jt.current=0}(mr>0||Mn>0)&&(O.refresh(0,Math.max(0,O.rows-1)),sr("xterm buffer invariant repaired",{reason:L,before:mr,after:Mn,cols:O.cols,rows:O.rows}));const Sn={cols:O.cols,rows:O.rows};sr("fit",{reason:L,backend:"xterm",width:Math.round(Ne.width),height:Math.round(Ne.height),before:Te,proposed:$t,next:Sn,hysteresis:en,changed:Te.cols!==Sn.cols||Te.rows!==Sn.rows})}catch{Ie.current?.cancel()}},[sr]),ui=C.useCallback(L=>{const B=Be.current;if(B)try{B.refresh(0,Math.max(0,B.rows-1)),sr("terminal refreshed (sync)",{reason:L,cols:B.cols,rows:B.rows,hasWebgl:!!X.current})}catch(O){sr("terminal refresh (sync) failed",{reason:L,error:O})}},[sr]),Di=C.useCallback(L=>{const B=Re.current;if(B){try{B.dispose()}catch{}Re.current=null}const O=X.current;if(!O)return!1;Ie.current?.cancel();try{O.dispose()}catch{}return X.current=null,sr("renderer disposed",{type:"webgl",reason:L}),!0},[sr]),Bi=C.useCallback((L,B)=>{if(X.current)return!0;try{const O=new RC({customGlyphs:ct});return Re.current=O.onContextLoss(()=>{sr("webgl context loss",{reason:"onContextLoss"}),We.current=!0,typeof window<"u"&&window.setTimeout(()=>{gt("webgl-context-loss",{forceRendererRecreate:!0})},0)}),Ie.current?.cancel(),L.loadAddon(O),X.current=O,We.current=!1,sr("renderer",{type:"webgl",reason:B,mobile:$,mode:tt.current}),ui(`webgl-enabled:${B}`),is(`webgl-enabled:${B}`),wa.current=!0,!0}catch(O){return sr("webgl load failed, fallback to dom renderer",{reason:B,error:O,mobile:$,mode:tt.current}),!1}},[sr,ct,$,is,ui]),zs=200,mo=C.useRef(0),Hs=C.useRef(new Map),di=C.useRef(new Map),Kr=C.useRef(Hf()),ya=C.useRef(null),Ws=C.useRef(null),Ki=C.useRef(-1),va=C.useRef(new Map),wa=C.useRef(!1),hi=C.useRef(!1),Xi=C.useRef(Jg()),Cs=C.useRef(null),Aa=C.useRef(null),Fa=C.useCallback(()=>{Cs.current!==null&&(clearTimeout(Cs.current),Cs.current=null),Aa.current=null},[]),Jn=C.useCallback(()=>{const L=Hs.current;L.forEach(B=>cancelAnimationFrame(B)),L.clear(),di.current.clear()},[]),ms=C.useCallback(()=>{ya.current!==null&&(window.clearTimeout(ya.current),ya.current=null)},[]),Ta=C.useRef(()=>{}),Xo=C.useCallback(L=>{ms(),ze.current?.(!1),K.current(L.cols,L.rows,L.seq),ya.current=window.setTimeout(()=>{ya.current=null;const B=Xg(Kr.current,L.seq);Kr.current=B.state,B.request&&hi.current?(sr("resize ack timeout; retrying",{seq:L.seq,retrySeq:B.request.seq,cols:B.request.cols,rows:B.request.rows}),Ta.current(B.request)):B.exhausted&&(Ie.current?.cancel(),sr("resize ack timeout; leaving size unconfirmed",{seq:L.seq,cols:L.cols,rows:L.rows}))},1200)},[ms,sr]);Ta.current=Xo;const Qi=C.useCallback((L,B)=>{if(!hi.current)return;const O=$_(Kr.current,{cols:L,rows:B});Kr.current=O.state,O.request&&Xo(O.request)},[Xo]),go=C.useCallback((L,B)=>{const O=V_(Xi.current,Date.now());if(O.action==="send"){Aa.current=null,Qi(L,B);return}Aa.current={cols:L,rows:B},Cs.current===null&&(Cs.current=setTimeout(()=>{Cs.current=null;const z=Aa.current;Aa.current=null,z&&(Xi.current=q_(Date.now()),Qi(z.cols,z.rows))},Math.max(0,O.readyAt-Date.now())))},[Qi]),$a=1500,Jo=400,Ua=C.useRef(0),Ca=C.useRef(0),J=C.useCallback((L,B,O)=>{if(!Number.isFinite(L)||!Number.isFinite(B)||L<=0||B<=0)return;const z=Math.floor(L),Ne=Math.floor(B);Kr.current=H_(Kr.current,{cols:z,rows:Ne}),Ua.current=Date.now(),sr("pty-size broadcast received",{cols:z,rows:Ne,source:O??"unknown"})},[sr]),Qe=C.useCallback(L=>{const B=Be.current;if(!B||!B.cols||!B.rows||!hi.current||typeof document<"u"&&(document.visibilityState!=="visible"||!su()))return;const O=Date.now();if(O-Ua.current<$a||O-Ca.current<Jo)return;const z=B.cols,Ne=B.rows,Te=Kr.current.confirmed;Te&&Te.cols===z&&Te.rows===Ne||(Ca.current=O,sr("ensureSizeMatches push",{reason:L,cols:z,rows:Ne,lastServerSize:Te}),Qi(z,Ne))},[sr,Qi]),mt=C.useCallback((L,B)=>{const O=Be.current,z=Ue.current;if(!O||!z)return;if(!wa.current){sr("refresh skipped: renderer not ready",{reason:L});return}if(B.dedupeKey!==void 0){if(va.current.get(L)===B.dedupeKey){sr("refresh deduped",{reason:L,dedupeKey:B.dedupeKey});return}va.current.set(L,B.dedupeKey)}sr("refresh",{reason:L,options:B});const Ne=B.forceRendererRecreate===!0||We.current||vt&&!!X.current&&HL.has(L)&&/Android/i.test(navigator.userAgent);let Te=!1;Ne&&(We.current=!1,vt?(Di(`refresh:${L}`),Bi(O,`refresh:${L}`)||ui(`refresh:${L}:webgl-fallback`),Te=!0):(ui(`refresh:${L}`),Te=!0)),O_(B.forceRedraw===!0,L==="dpr-change",Te)?ui(`refresh:${L}`):Te||sr("terminal redraw skipped: fit/write already repaints",{reason:L});const Xe={cols:O.cols,rows:O.rows};is(`refresh:${L}`);const nt={cols:O.cols,rows:O.rows};if(B.skipResizePush||B_({before:Xe,after:nt,lastServerSize:Kr.current.confirmed,reconcileServerSize:B.reconcileServerSize})&&go(nt.cols,nt.rows),!B.skipScrollToBottom&&L!=="resize"&&L!=="dpr-change"){const mr=requestAnimationFrame(()=>{const Sn=Be.current;if(Sn&&Sn.buffer.active.type!=="alternate")try{Sn.scrollToBottom()}catch{}}),en=Hs.current,Mn=en.get(L);Mn!==void 0&&cancelAnimationFrame(Mn),en.set(L,mr)}},[sr,vt,Di,Bi,ui,is,go]),gt=C.useCallback((L,B={})=>{if(Be.current,L==="session-key-change"&&(Kr.current=Hf(),ms(),Fa(),Xi.current=Jg(),va.current.clear(),Jn()),!B.force&&(L==="visibility"||L==="bfcache"||L==="online")){const z=Date.now();if(z-mo.current<zs){sr("refresh throttled",{reason:L});return}mo.current=z}if(di.current.set(L,B),Hs.current.has(L))return;const O=requestAnimationFrame(()=>{const z=di.current.get(L)??{};Hs.current.delete(L),di.current.delete(L),mt(L,z)});Hs.current.set(L,O)},[sr,Jn,ms,Fa,mt]),De=C.useCallback(L=>{const B=Hs.current.get(L);if(B===void 0)return;const O=di.current.get(L)??{};cancelAnimationFrame(B),Hs.current.delete(L),di.current.delete(L),mt(L,O)},[mt]);_i.current=()=>De("resize"),C.useEffect(()=>()=>{Jn(),lr.current!==null&&(window.clearTimeout(lr.current),lr.current=null)},[e,Jn]),C.useEffect(()=>{Kr.current=Hf(),ms(),va.current.clear()},[e,ms]);const yt=C.useCallback(()=>{if(le.current)return;const L=Be.current;if(!L){Yn();return}if(!ge.current)return;const B=ge.current,O=B.length,z=je.current,Ne=dt.current;ge.current="",je.current=null,dt.current=!1,le.current=!0;let Te=null;Ne&&(Te=Dt.current??{depth:0},Dt.current=Te,Te.depth+=1);const Xe=Ie.current,nt=Xe?.generation;L.write(B,()=>{if(Te&&(Te.depth-=1),nt!==void 0&&Xe?.written(nt),le.current=!1,it.current-=O,it.current<0&&(it.current=0),z!==null&&ee.current?.(z),ht.current&&it.current<GL&&(ht.current=!1,fe.current?.(!1)),ge.current){yt();return}const $t=++ut.current,mr=()=>{if($t!==ut.current||le.current||ge.current)return;const en=L.buffer.active;Ee.current?.({x:en.cursorX,y:en.cursorY,rows:L.rows,lastProcessedChunkId:pe.current})};typeof window>"u"?mr():window.requestAnimationFrame(()=>{window.requestAnimationFrame(mr)})})},[Yn]);Xt.current=yt;const pr=C.useCallback(()=>{if(Y.current!==null)return;const L=++be.current;Y.current=L,queueMicrotask(()=>{Y.current===L&&(Y.current=null,yt())})},[yt]),Qr=C.useCallback((L,B,O=!1)=>{if(!L)return;ut.current+=1,ge.current+=L,je.current=B,dt.current=dt.current||O,it.current+=L.length;const z=xt.current;(z===null||B>z)&&(xt.current=B),!ht.current&&it.current>=WL&&(ht.current=!0,fe.current?.(!0)),pr()},[pr]);return C.useEffect(()=>{let L=!1,B=null,O=null,z=[];const Ne=et.current;return Ne?(Ne.tabIndex=$?-1:0,(async()=>{if($e.current?.(!1),Gt("loading"),gn(null),Ts(!0),await YL(),!L)try{const Xe=KL(Ne,d2(cn),H,Ge,ve),nt=new N9({...Xe?{cols:Xe.cols,rows:Xe.rows}:{},allowProposedApi:!0,fontFamily:d2(cn),fontSize:H,fontWeight:h2(we),fontWeightBold:h2(Pe),theme:ZL(F),logLevel:"off",cursorBlink:!vt,cursorStyle:"block",cursorInactiveStyle:ln.current?"bar":"none",scrollback:h?2e3:5e3,scrollbar:{showScrollbar:!1},allowTransparency:YA(In,jt),convertEol:qn,drawBoldTextInBrightColors:Nt,rescaleOverlappingGlyphs:_t,minimumContrastRatio:lt,letterSpacing:Ge,lineHeight:ve,smoothScrollDuration:tr&&!re.current?125:0,scrollOnEraseInDisplay:!0,tabStopWidth:8,vtExtensions:{kittyKeyboard:!0},windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0}}),$t=new R9;nt.loadAddon($t),nt.loadAddon(new PC),nt.registerLinkProvider(_L(nt,(Lr,xn)=>{wt.current?.(Lr,xn)}));const mr=new WC;nt.loadAddon(mr),nt.unicode.activeVersion=At,nt.loadAddon(new JC({highlightLimit:1e3}));const en=new sS;nt.loadAddon(en),ot.current=en,nt.loadAddon(new C_);try{nt.loadAddon(new aS(void 0,new $b))}catch(Lr){sr("clipboard addon skipped",{error:Lr})}B=nt,Be.current=nt,Ue.current=$t,Qt.current=typeof window<"u"?window.devicePixelRatio:1,nt.open(Ne),Ie.current=F_(nt),_r&&nt.loadAddon(new T_({fontFeatureSettings:K_,fallbackLigatures:X_}));try{const Lr=nt._core;Lr?.coreService&&(Lr.coreService.isCursorInitialized=!0),nt.refresh(0,nt.rows-1)}catch{}vt?(Bi(nt,"init"),wa.current=!0):(sr("renderer",{type:"dom",reason:"renderer-mode-dom-fallback",mobile:$,mode:In}),wa.current=!0),Ts(!1),Nr();const Mn=Lr=>{if(Lr.ctrlKey||Lr.metaKey){Lr.preventDefault();const xn=Lr.deltaY>0?-1:1;Fd(t,H+xn)}};if(Ve.current=Mn,Ne.addEventListener("wheel",Mn,{passive:!1}),!$){let Lr=0,xn=null,vn=null,Gs=null;const Sa=()=>{Gs=null,_i.current();const ds=ec(Be.current,H,ve),Ul=Ct.current+Lr;Lr=0;const Ss=Math.trunc(Ul/ds);if(Ct.current=Ul-Ss*ds,Ss!==0){const Ro=Ss>0?"down":"up",gl=Be.current,bc=Math.max(3,Math.floor((gl?.rows??24)/2)),ki=Math.abs(Ss);ki>bc&&(Ct.current=0),ci.current(Ro,Math.min(ki,bc),xn??void 0,vn??void 0)}};nt.attachCustomWheelEventHandler(ds=>{if(ds.ctrlKey||ds.metaKey||ds.shiftKey)return!0;if(ds.deltaY===0)return!1;if(!Be.current||!Os.current)return!0;const Ss=ec(Be.current,H,ve);let Ro=ds.deltaY;return ds.deltaMode===1?Ro=ds.deltaY*Ss:ds.deltaMode===2&&(Ro=ds.deltaY*(Ne.clientHeight||Ss*20)),Lr+=Ro,xn=ds.clientX,vn=ds.clientY,Gs===null&&(Gs=requestAnimationFrame(Sa)),ds.preventDefault(),!1})}const Sn=zL(Ne);if(Sn?(Sn.classList.add("overlay-scrollbar-target","overlay-scrollbar-container"),ce.current=Sn,kt()):ce.current=null,gt("mount",{skipResizePush:!0,skipScrollToBottom:!0}),Ir.current&&($?nt.focus():Bt.current?.focus({preventScroll:!0})),$||Rt.current(),z.push(nt.onRender(()=>{const Lr=nt.buffer.active;Ke.current?.({x:Lr.cursorX,y:Lr.cursorY,rows:nt.rows}),$||Rt.current()})),!$){try{const Lr=nt.textarea;if(Lr){Lr.tabIndex=-1,Lr.setAttribute("aria-hidden","true"),Lr.setAttribute("readonly",""),Lr.value="";const xn=()=>{Bt.current?.focus({preventScroll:!0})};Lr.addEventListener("focus",xn),z.push({dispose:()=>Lr.removeEventListener("focus",xn)})}}catch{}try{z.push(nt.onCursorMove(()=>Rt.current())),z.push(nt.onResize(()=>Rt.current()))}catch{}}z.push(nt.onData(Lr=>{const xn=Dt.current;xn!==null&&xn.depth>0||_e.current(Lr)}));const Un=Lr=>{const xn=typeof window<"u"?window.devicePixelRatio:1,vn=Math.abs(xn-Qt.current)>.001;return vn&&(Qt.current=xn,sr("device pixel ratio changed",{value:xn,source:Lr})),vn};if(O=new ResizeObserver(Lr=>{if(!Q_(!!zr.current,Vn.current)){sr("resize observer skipped: hidden mobile session");return}Wt.current=void 0;const xn=Lr[0];xn&&sr("resize observer",{width:Math.round(xn.contentRect.width),height:Math.round(xn.contentRect.height)});const vn=Un("resize-observer");gt(vn?"dpr-change":"resize")}),O.observe(Ne),typeof window<"u"){const Lr=()=>{Un("window-resize")&>("dpr-change")};window.addEventListener("resize",Lr),z.push({dispose:()=>window.removeEventListener("resize",Lr)});const xn=window.visualViewport;if(xn){const vn=()=>{Un("visual-viewport-resize")&>("dpr-change")};xn.addEventListener("resize",vn),z.push({dispose:()=>xn.removeEventListener("resize",vn)})}}is("init-fit"),Gt("ready"),$e.current?.(!0)}catch(Xe){console.error("Failed to initialize terminal:",Xe),Ts(!1),Gt("error"),gn(Xe instanceof Error?Xe.message:"Failed to load terminal")}})(),()=>{$e.current?.(!1),L=!0,Le.current?.(!1),Ht.current?.(),Ht.current=null,It.current=!1,Ot.current!==null&&(clearTimeout(Ot.current),Ot.current=null),ar.current=!1,Lt.current=null,rr(),Et({active:!1,text:""});for(const Xe of z)Xe.dispose();O?.disconnect(),Ve.current&&(Ne.removeEventListener("wheel",Ve.current),Ve.current=null),Ie.current?.dispose(),Ie.current=null,Di("component-unmount"),B?.dispose(),Be.current=null,Ue.current=null,ce.current=null,Yn({notifyFlowResume:!0}),ms(),Fa()}):void 0},[is,cn,H,we,Pe,Ge,ve,lt,Nt,At,ct,_t,_r,jt,tr,F,Yn,rr,$,Bi,Di,sr,ms,Fa]),C.useEffect(()=>{const L=Be.current;L&&(L.options.smoothScrollDuration=tr&&!de?125:0)},[tr,de,ue]),C.useEffect(()=>{const L=Be.current;L&&(L.options.cursorInactiveStyle=qe?"bar":"none",qe||L.blur())},[qe,ue]),C.useEffect(()=>{const L=Be.current;if(L){if(vt){if(L.options.cursorBlink=!1,Bi(L,"renderer-mode-change")&&jt&&!ur.current)try{L.loadAddon(new jS({storageLimit:64,pixelLimit:1<<24,sixelSupport:!0,iipSupport:!0,kittySupport:!0})),ur.current=!0}catch(O){sr("image addon skipped",{error:O})}return}L.options.cursorBlink=!0,Di("renderer-mode-change")&&(ui("renderer-mode-change:webgl-disabled"),is("renderer-mode-change:webgl-disabled"))}},[vt,jt,Bi,Di,ui,is,sr]),C.useEffect(()=>{const L=Be.current;L&&(pe.current!==null&&L.reset(),Yn(),Fe.current="",yr.current=0,Bt.current&&(Bt.current.value=""),gt("session-reset",{skipScrollToBottom:!0}),Ir.current&&(zr.current?L.focus():Bt.current?.focus({preventScroll:!0})))},[e,ue,gt,Yn]),C.useEffect(()=>{if(!$||typeof document>"u")return;let L=null;const B=()=>{L=null;const z=Bt.current;if(!z||document.activeElement!==z||It.current)return;const Ne=Fe.current,Te=P0(z.value);if(Te!==Ne||Te.includes("\r")||!Pt())return;const Xe=Math.min(s2(z),Array.from(Te).length),nt=Xe-yr.current;if(nt===0)return;const $t=Be.current,mr=nt<0?($t?Ad($t,"D"):"\x1B[D").repeat(-nt):($t?Ad($t,"C"):"\x1B[C").repeat(nt);_e.current(mr),yr.current=Xe},O=()=>{L===null&&(L=requestAnimationFrame(B))};return document.addEventListener("selectionchange",O),()=>{document.removeEventListener("selectionchange",O),L!==null&&cancelAnimationFrame(L)}},[$,Pt]),C.useEffect(()=>{if(!$)return;const L=ja();return Ht.current=L,()=>{L(),Ht.current=null}},[$,ja]),C.useEffect(()=>{const L=Be.current;if(L)try{L.options.scrollback=h?0:1e3}catch{}},[h,ue]),C.useEffect(()=>{const L=Be.current;if(!L)return;if(n.length===0){pe.current!==null&&(L.reset(),Yn(),gt("buffer-reset",{skipResizePush:!0,skipScrollToBottom:!0}));return}const B=pe.current;let O,z=!1;if(B===null)O=n;else{const Ne=n.findIndex(Te=>Te.id===B);Ne>=0?O=n.slice(Ne+1):(O=n,z=!0)}if(O.length>0){const Ne=O.map(en=>en.data).join(""),Te=Er.current+Ne,{cleaned:Xe,remainder:nt}=UL(Te);Er.current=nt;const $t=xt.current,mr=$t!==null&&(O[0].id<=$t||z);Xe?Qr(Xe,O[O.length-1].id,mr):ee.current?.(O[O.length-1].id)}pe.current=n[n.length-1].id},[n,ue,Qr,gt,Yn]),C.useImperativeHandle(oe,()=>({serializeSnapshot:()=>Be.current?ot.current?.serialize({scrollback:100})??null:null,focus:()=>{if(zr.current){ai();return}Bt.current?.focus({preventScroll:!0})},blur:()=>{const L=Bt.current;ss(L),L&&typeof document<"u"&&document.activeElement===L&&L.blur(),zr.current&&L?.setAttribute("readonly",""),Le.current?.(!1)},clear:()=>{const L=Be.current;L&&(L.reset(),Yn(),gt("clear",{skipResizePush:!0,skipScrollToBottom:!0}))},prepareScreenReplacement:()=>{Yn({notifyFlowResume:!0})},copySelectionOrViewport:async()=>{const L=Be.current;if(!L)return!1;const B=L.hasSelection()?L.getSelection():XL(L),O=await p2(B);return O&&L.hasSelection()&&Tt(),O},pasteClipboardText:async()=>{me();const L=await dr(Bt.current);return Qa.current?.(L),L},sendSequence:(L,B)=>xe(L,null,B),getDimensions:()=>{const L=Be.current;return!L||!L.cols||!L.rows?null:{cols:L.cols,rows:L.rows}},requestRefresh:gt,setSessionReady:L=>{hi.current=L,L||(Ie.current?.cancel(),ms(),Kr.current=W_(Kr.current),Ws.current=null,Ki.current=-1,ze.current?.(!1))},acknowledgeResize:L=>{if(!L.ok&&typeof L.seq=="number"){const Te=Xg(Kr.current,L.seq);if(!Te.request&&!Te.exhausted)return;ms(),Kr.current=Te.state,Te.request&&hi.current?Ta.current(Te.request):Te.exhausted&&Ie.current?.cancel();return}const B=z_(Kr.current,L);if(!B.accepted)return;ms(),Kr.current=B.state,sr("resize acknowledged",{seq:L.seq,ok:L.ok,cols:L.cols,rows:L.rows,screenSyncPending:L.screenSyncPending===!0,screenSyncGeneration:L.screenSyncGeneration});const O=Be.current,z=B.state.confirmed;if(!!!(O&&z&&O.cols===z.cols&&O.rows===z.rows)){ze.current?.(!1);return}if(L.screenSyncPending&&typeof L.screenSyncGeneration=="number"){Ws.current=L.screenSyncGeneration;const Te=Ki.current>=L.screenSyncGeneration;ze.current?.(Te),Te&&(Ws.current=null);return}Ws.current=null,ze.current?.(!0)},notifyScreenSynchronized:L=>{if(!Number.isFinite(L))return;Ki.current=Math.max(Ki.current,L);const B=Ws.current;if(B===null||L<B)return;Ws.current=null;const O=Be.current,z=Kr.current.confirmed;ze.current?.(!!(O&&z&&O.cols===z.cols&&O.rows===z.rows))},notifyServerSize:J,ensureSizeMatches:Qe,requestPtyRedraw:()=>{const L=Be.current;if(!L||!hi.current||Kr.current.pending||Ws.current!==null)return;const B=U_(Kr.current,{cols:L.cols,rows:L.rows});Kr.current=B.state,Ta.current(B.request)}}),[$,ss,ai,Yn,dr,xe,gt,ms,sr,Qi,J,Qe]),a.jsxs("div",{ref:et,"data-termdock-terminal-dropzone":e,className:`relative h-full w-full terminal-viewport-container ${V||""}`,style:{backgroundColor:F.background,touchAction:jn.visible?"none":void 0},role:"button",tabIndex:-1,onPointerDownCapture:Ba,onPointerMoveCapture:Ci,onPointerUpCapture:lo,onPointerCancelCapture:ha,onTouchStartCapture:L=>{if(ks(L.target)){me(),pn(O0);return}cs(),pn(O0)},onTouchMoveCapture:()=>pn(O0),onTouchEndCapture:()=>pn(F0),onTouchCancelCapture:()=>pn(F0),onMouseDown:L=>{$||L.button===0&&(lr.current!==null&&(window.clearTimeout(lr.current),lr.current=null),requestAnimationFrame(()=>{try{Bt.current?.focus({preventScroll:!0})}catch{}}))},onMouseUp:L=>{$||L.button===0&&(lr.current!==null&&window.clearTimeout(lr.current),lr.current=window.setTimeout(()=>{lr.current=null;try{Bt.current?.focus({preventScroll:!0})}catch{}},0))},children:[Ln&&a.jsx("button",{type:"button",role:"alert",onClick:()=>wn(null),className:"absolute bottom-2 left-2 right-2 z-20 rounded-md border border-border bg-surface-2 px-3 py-2 text-left text-sm text-foreground",children:Ln}),Pn&&a.jsxs("button",{type:"button","data-terminal-copy-popover":"true",className:"absolute z-30 inline-flex h-9 w-[88px] select-none items-center justify-center gap-1.5 rounded-full border border-white/15 bg-[rgb(28_28_30_/_0.92)] px-3 text-[13px] font-semibold text-white shadow-[0_10px_28px_rgb(0_0_0_/_0.32),0_2px_8px_rgb(0_0_0_/_0.18)] backdrop-blur-xl transition-transform duration-100 ease-out active:scale-[0.96]",style:{left:Pn.left,top:Pn.top,WebkitBackdropFilter:"blur(18px)"},onPointerDown:L=>{me(),L.stopPropagation()},onPointerUp:L=>{L.preventDefault(),L.stopPropagation(),pa()},onTouchStart:L=>{me(),L.stopPropagation()},onTouchEnd:L=>{L.preventDefault(),L.stopPropagation(),pa()},onClick:L=>{L.preventDefault(),L.stopPropagation(),pa()},children:[a.jsx(x7,{size:14,strokeWidth:2.4}),a.jsx("span",{children:Oe("common.copy")})]}),Dr?.start&&a.jsx("div",{"data-selection-handle":"start",className:"absolute z-30 h-11 w-11 select-none",style:{left:Dr.start.left,top:Dr.start.top,transform:"translate(-50%, -100%)",touchAction:"none"},onPointerDown:L=>L.stopPropagation(),children:a.jsxs("div",{className:"pointer-events-none absolute bottom-0 left-1/2 flex -translate-x-1/2 flex-col items-center",children:[a.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-[var(--accent)] shadow-[0_1px_4px_rgb(0_0_0_/_0.4)]"}),a.jsx("div",{className:"h-3 w-0.5 bg-[var(--accent)]"})]})}),Dr?.end&&a.jsx("div",{"data-selection-handle":"end",className:"absolute z-30 h-11 w-11 select-none",style:{left:Dr.end.left,top:Dr.end.top,transform:"translate(-50%, 0)",touchAction:"none"},onPointerDown:L=>L.stopPropagation(),children:a.jsxs("div",{className:"pointer-events-none absolute left-1/2 top-0 flex -translate-x-1/2 flex-col items-center",children:[a.jsx("div",{className:"h-3 w-0.5 bg-[var(--accent)]"}),a.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-[var(--accent)] shadow-[0_1px_4px_rgb(0_0_0_/_0.4)]"})]})}),Xr&&yn&&a.jsx(cL,{}),Xr&&st==="loading"&&!yn&&a.jsx(r3,{}),st==="error"&&a.jsx(uL,{message:Ur||void 0,onRetry:()=>{window.location.reload()}}),st==="ready"&&a.jsxs(a.Fragment,{children:[a.jsx("textarea",{ref:Bt,"aria-label":Oe("terminal.input"),"data-terminal-input-anchor":"true",inputMode:"text",enterKeyHint:"enter",autoCapitalize:"off",autoComplete:"nope",autoCorrect:"off",spellCheck:!1,tabIndex:-1,style:{position:"absolute",opacity:0,zIndex:20,background:"transparent",color:"transparent",caretColor:"transparent",resize:"none",overflow:"hidden",border:"none",padding:0,margin:0,outline:"none",...$?{inset:0,touchAction:"none",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",pointerEvents:"auto",fontSize:"16px"}:(()=>{const L=Mt.x,B=Mt.y,O={position:"fixed",left:L,top:B,pointerEvents:"none",touchAction:"auto",fontSize:`${H}px`,fontFamily:cn,lineHeight:"1",whiteSpace:"pre",boxSizing:"content-box",width:Math.max(1,Math.round(Mt.cellW)),height:Math.max(1,Math.round(Mt.cellH))};if(!wr.active)return O;const z=Rn(wr.text);return{...O,opacity:1,color:"transparent",WebkitTextFillColor:"transparent",background:"transparent",transition:"none",caretColor:"transparent",textDecorationColor:"transparent",wordBreak:"break-all",zIndex:20,width:z.width,height:z.height,whiteSpace:z.whiteSpace}})()},onContextMenu:L=>{L.preventDefault()},onFocus:()=>{sr("input anchor focus"),Wt.current=void 0,Rt.current(),gt("focus",{skipResizePush:!0,skipScrollToBottom:!0}),Le.current?.(!0)},onBlur:L=>{$||ss(L.currentTarget);const B=da(),O=typeof document<"u"?document.activeElement:null;if(sr("input anchor blur",{guarded:B,activeTag:O?.tagName??null,activeClass:O?.className??null}),!B){$&&Bt.current?.setAttribute("readonly",""),Le.current?.(!1);return}if(typeof window>"u"){Le.current?.(!1);return}window.setTimeout(()=>{Ut()||Pt()||($&&Bt.current?.setAttribute("readonly",""),Le.current?.(!1))},F0)},onBeforeInput:L=>{if(It.current)return;const B=L.nativeEvent;if(B instanceof InputEvent){if(B.inputType==="insertFromPaste"||B.inputType==="insertFromPasteAsQuotation"){const O=B.dataTransfer?.getData("text/plain")||B.data;if(O){L.preventDefault();const z=Ae(O,L.currentTarget);$&&Qa.current?.(z)}return}if(B.inputType==="insertLineBreak"){if(ar.current){ar.current=!1,Ot.current!==null&&(clearTimeout(Ot.current),Ot.current=null),L.preventDefault();return}L.preventDefault(),P(L.currentTarget);return}if(B.inputType==="deleteContentBackward"||B.inputType==="deleteContentForward"||B.inputType==="deleteByCut"){if(!L.currentTarget.value){L.preventDefault(),_e.current("");return}if(B.inputType==="deleteContentBackward"&&L.currentTarget.selectionStart===0&&L.currentTarget.selectionEnd===0){L.preventDefault(),_e.current("");return}return}}},onInput:L=>{if(It.current)return;const B=L.nativeEvent,O=R_(Fe.current,P0(L.currentTarget.value),B.inputType);if(O){const z=Ae(O,L.currentTarget);$&&Qa.current?.(z);return}fn(L.currentTarget)},onPaste:L=>{const B=L.clipboardData.files.length?Array.from(L.clipboardData.files):Array.from(L.clipboardData.items).filter(Te=>Te.kind==="file").map(Te=>Te.getAsFile()).filter(Te=>Te!==null),O=L.clipboardData.getData("text/plain");if(window.termdockDesktop?.readClipboardFiles){L.preventDefault(),dr(L.currentTarget,{files:B,text:O});return}if(B.length&&(B.length>1||!B[0].type.startsWith("image/"))){L.preventDefault(),pt(B,L.currentTarget);return}const z=B[0];if(z){L.preventDefault(),rt(z,L.currentTarget);return}if(!O){(window.termdockDesktop||typeof navigator.clipboard?.read=="function")&&(L.preventDefault(),dr(L.currentTarget));return}L.preventDefault();const Ne=Ae(O,L.currentTarget);$&&Qa.current?.(Ne)},onKeyDown:L=>{const B=FL(L);if(!B&&!It.current){if(L.getModifierState("AltGraph"))return;const O=Be.current,z=L.metaKey,Ne=L.ctrlKey,Te=L.altKey,Xe=L.shiftKey,nt=L.key;if(z&&!Ne&&!Te&&!Xe&&nt==="Enter"){L.preventDefault(),P(L.currentTarget);return}if((z||Ne)&&!Te&&!Xe&&(nt==="v"||nt==="V"))return;if(z&&!Ne&&!Te&&!Xe&&(nt==="c"||nt==="C")){L.preventDefault();const mr=O?.hasSelection()?O.getSelection():"";mr&&navigator.clipboard?.writeText(mr).catch(()=>{});return}if((z||Ne)&&!Te&&!Xe&&(nt==="k"||nt==="K")){L.preventDefault(),O&&(O.reset(),Yn(),gt("clear",{skipResizePush:!0,skipScrollToBottom:!0})),L.currentTarget.value="",Fe.current="",yr.current=0;return}if(z&&!Ne&&!Te&&!Xe&&nt==="Backspace"){L.preventDefault(),xe("",L.currentTarget);return}if(z&&!Ne&&!Te&&!Xe&&nt==="Delete"){L.preventDefault(),xe("\v",L.currentTarget);return}if(z&&!Ne&&!Te&&!Xe&&nt==="ArrowLeft"){L.preventDefault(),xe("",L.currentTarget);return}if(z&&!Ne&&!Te&&!Xe&&nt==="ArrowRight"){L.preventDefault(),xe("",L.currentTarget);return}if(z)return;if(Te&&!Ne&&!z&&!Xe&&nt==="Backspace"){L.preventDefault(),xe("\x1B",L.currentTarget);return}if(Te&&!Ne&&!z&&!Xe&&nt==="Delete"){L.preventDefault(),xe("\x1Bd",L.currentTarget);return}if(Te&&!Ne&&!z&&!Xe&&nt==="ArrowLeft"){L.preventDefault(),xe("\x1Bb",L.currentTarget);return}if(Te&&!Ne&&!z&&!Xe&&nt==="ArrowRight"){L.preventDefault(),xe("\x1Bf",L.currentTarget);return}const $t=CT(L,O?.modes?.applicationCursorKeysMode===!0);if($t!==null){L.preventDefault(),xe($t,L.currentTarget);return}}if(L.key==="Enter"||L.key==="Go"||L.key==="done"||L.key==="send"){if(B||It.current){L.preventDefault();return}if(ar.current){ar.current=!1,Ot.current!==null&&(clearTimeout(Ot.current),Ot.current=null),L.preventDefault();return}L.preventDefault(),P(L.currentTarget);return}if(L.key==="Backspace"){if(B||It.current)return;if(!L.currentTarget.value){L.preventDefault(),_e.current("");return}if(L.currentTarget.selectionStart===0&&L.currentTarget.selectionEnd===0){L.preventDefault(),_e.current("");return}}},onCompositionStart:()=>{It.current=!0,xs(),Et({active:!0,text:""})},onCompositionUpdate:L=>{It.current=!0;const B=L.data??L.currentTarget.value;Et(O=>O.active&&O.text===B?O:{active:!0,text:B})},onCompositionEnd:L=>{It.current=!1,ar.current=!0,Ot.current!==null&&clearTimeout(Ot.current),Ot.current=setTimeout(()=>{ar.current=!1,Ot.current=null},50),Et({active:!1,text:""}),fn(L.currentTarget),Mi()}}),wr.active&&(()=>{const L=Rn(wr.text);return a.jsx("div",{"aria-hidden":"true","data-terminal-ime-composition":"true",style:{position:"fixed",left:Mt.x,top:Mt.y,zIndex:21,pointerEvents:"none",overflow:"hidden",boxSizing:"content-box",width:L.width,height:L.height,margin:0,padding:0,color:F.foreground,background:F.background,boxShadow:`-1px 0 0 1px ${F.background}`,fontSize:`${H}px`,fontFamily:cn,lineHeight:"1",textDecorationLine:"underline",textDecorationStyle:"solid",textDecorationColor:F.foreground,wordBreak:"break-all",whiteSpace:L.whiteSpace,transition:"none"},children:wr.text})})(),a.jsx("div",{"aria-hidden":!0,className:`absolute left-1/2 -translate-x-1/2 top-6 z-30 pointer-events-none
|
|
65
|
-
rounded-full bg-[var(--surface-elevated)] px-4 py-1.5 text-sm font-semibold text-foreground
|
|
66
|
-
shadow-lg transition-all duration-150 ease-out`,style:{opacity:on?1:0,transform:on?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:"Tab"}),a.jsx("div",{ref:hr,"aria-hidden":!0,className:"absolute left-1/2 top-6 z-30 pointer-events-none transition-opacity duration-150 ease-out",style:{opacity:jn.visible?1:0,transform:jn.visible?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:jn.visible&&(()=>{const{activeDir:L}=jn,B=O=>L===O;return a.jsxs("div",{className:"flex flex-col items-center gap-0.5 rounded-xl bg-[var(--overlay-background)] backdrop-blur-sm shadow-lg px-1.5 py-1.5",children:[a.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${B("up")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 19V5M7 11l5-5 5 5"})})}),a.jsxs("div",{className:"flex items-center gap-0.5",children:[a.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${B("left")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}),a.jsx("div",{className:"w-7 h-7 flex items-center justify-center rounded-lg text-[rgb(var(--overlay-foreground-rgb)_/_0.18)]",children:a.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("circle",{cx:"12",cy:"12",r:"4"})})}),a.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${B("right")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})})})]}),a.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${B("down")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 5v14M19 12l-7 7-7-7"})})})]})})()})]})]})});s3.displayName="TerminalViewport";const ek=s3,tk=e=>{const t=e?.retry;return{maxRetries:t?.maxRetries??3,initialRetryDelay:t?.initialDelayMs??1e3,maxRetryDelay:t?.maxDelayMs??8e3,connectionTimeout:e?.connectionTimeoutMs??1e4}},rk=()=>({async createSession(e){return C7(e)},connect(e,t,r){const n=T7(e,t.onEvent,t.onError,{...tk(r),getDimensions:r?.getDimensions});return{close:()=>n()}},async sendInput(e,t){await Wx(e,t)},async resize(e){await A7(e.sessionId,e.cols,e.rows,e.seq)},async close(e){await Hx(e)},async restartSession(e,t){return w7(e,{cols:t.cols,rows:t.rows,mode:t.mode,tmuxSessionName:t.tmuxSessionName})},async forceKill(e){await v7(e)},async tmuxAction(e,t){return y7(e,t)},async listTmuxSessions(){return Ep()},async getTmuxStatus(){return Ip()},async checkHealth(e){return b7(e)}}),nk="\x1B",sk=/\x1b\[[IO]/g,ik=/\x1b\[<[0-9]+;[0-9]+;[0-9]+[mM]/y,ak=/\x1b\[[0-9]+;[0-9]+;[0-9]+M/y;function g2(e,t,r){return e.lastIndex=r,e.exec(t)?e.lastIndex:-1}function ok(e){const t=e.replace(sk,"");if(t.length===0)return e.length>0;let r=0;for(;r<t.length;){let n=g2(ik,t,r);if(n<0&&(n=g2(ak,t,r)),n<0&&t.startsWith("\x1B[M",r)&&t.length>=r+6&&(n=r+6),n<0)return!1;r=n}return!0}function lk(e){return e===nk}function Xp(e,t){return e.label.trim().length>0?e.label:`Key ${t+1}`}const ou=15;function ck(){return i3.map(e=>e.id)}const i3=[{id:"default",label:"Base",programs:[],includeAlt:!0,rowLayout:[3,3,3],actions:[],showOnDesktop:!1},{id:"opencode",label:"Code",programs:["opencode"],includeAlt:!1,rowLayout:[6],actions:[{id:"opencode-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo||\r"},{id:"opencode-new",label:"/new",sequence:"/new",doubleTapSequence:"/new||\r"},{id:"opencode-models",label:"/models",sequence:"/models",doubleTapSequence:"/models||\r"},{id:"opencode-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact||\r"}],showOnDesktop:!0},{id:"claude",label:"Claude",programs:["claude","claude-code"],includeAlt:!1,rowLayout:[6],actions:[{id:"claude-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo\r"},{id:"claude-clear",label:"/clear",sequence:"/clear",doubleTapSequence:"/clear\r"},{id:"claude-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact\r"}],showOnDesktop:!0},{id:"kimi",label:"Kimi",programs:["kimi","kimi-code"],includeAlt:!1,rowLayout:[6],actions:[{id:"kimi-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo\r"},{id:"kimi-new",label:"/new",sequence:"/new",doubleTapSequence:"/new\r"},{id:"kimi-sessions",label:"/sessions",sequence:"/sessions",doubleTapSequence:"/sessions\r"},{id:"kimi-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact\r"},{id:"kimi-goal",label:"/goal",sequence:"/goal",doubleTapSequence:"/goal\r"}],showOnDesktop:!0},{id:"codex",label:"Codex",programs:["codex"],includeAlt:!1,rowLayout:[6],actions:[{id:"codex-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo\r"},{id:"codex-clear",label:"/clear",sequence:"/clear",doubleTapSequence:"/clear\r"},{id:"codex-model",label:"/model",sequence:"/model",doubleTapSequence:"/model\r"},{id:"codex-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact\r"},{id:"codex-resume",label:"/resume",sequence:"/resume",doubleTapSequence:"/resume\r"}],showOnDesktop:!0},{id:"coco",label:"Coco",programs:["coco"],includeAlt:!1,rowLayout:[6],actions:[{id:"coco-undo",label:"/undo",sequence:"/||undo ",doubleTapSequence:"/||undo ||\r"},{id:"coco-clear",label:"/clear",sequence:"/||clear ",doubleTapSequence:"/||clear ||\r"},{id:"coco-model",label:"/model",sequence:"/||model ",doubleTapSequence:"/||model ||\r"},{id:"coco-resume",label:"/resume",sequence:"/||resume ",doubleTapSequence:"/||resume ||\r"}],showOnDesktop:!0},{id:"traex",label:"TraeX",programs:["traex","traecli"],includeAlt:!1,rowLayout:[6],actions:[{id:"traex-undo",label:"/undo",sequence:"/||undo ",doubleTapSequence:"/||undo ||\r"},{id:"traex-clear",label:"/clear",sequence:"/||clear ",doubleTapSequence:"/||clear ||\r"},{id:"traex-compact",label:"/compact",sequence:"/||compact ",doubleTapSequence:"/||compact ||\r"},{id:"traex-model",label:"/model",sequence:"/||model ",doubleTapSequence:"/||model ||\r"},{id:"traex-resume",label:"/resume",sequence:"/||resume ",doubleTapSequence:"/||resume ||\r"}],showOnDesktop:!0}];function Cu(){return i3.map(e=>({...e,programs:[...e.programs],includeAlt:e.includeAlt,rowLayout:[...e.rowLayout],actions:e.actions.map(t=>({...t})),showOnDesktop:e.showOnDesktop}))}function j1(e){const t=Array.isArray(e)?e.map(r=>Math.min(20,Math.max(2,Math.floor(r)))).filter(r=>Number.isFinite(r)):[];return t.length>0?t:[3,3]}function a3(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.length>0?t:null}const P1=/^\/(.+)\/([gimsuy]*)$/;function x2(e){return P1.test(e.trim())}function ph(e){const t=e.trim().match(P1);if(!t)return null;try{return new RegExp(t[1]??"",t[2]??"")}catch{return null}}function o3(e){if(typeof e!="string")return null;const t=e.trim();return t?P1.test(t)?ph(t)?t:null:t.toLowerCase():null}function b2(e){return e.replace(/\\u([0-9a-fA-F]{4})/g,(t,r)=>String.fromCharCode(Number.parseInt(r,16))).replace(/\\r/g,"\r").replace(/\\n/g,`
|
|
67
|
-
`).replace(/\\t/g," ")}const y2="||",uk=120;function dk(e){return e.includes(y2)?e.split(y2).filter(t=>t.length>0):[e]}function Uc(e){const t=new Set,r=e.map((i,l)=>{const c=typeof i.id=="string"&&i.id.trim().length>0?i.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):`preset-${l+1}`,h=t.has(c)?`${c}-${l+1}`:c;return t.add(h),{id:h,label:typeof i.label=="string"&&i.label.trim().length>0?i.label.trim():"Preset",programs:Array.isArray(i.programs)?i.programs.map(p=>o3(p)).filter(p=>!!p):[],includeAlt:typeof i.includeAlt=="boolean"?!!i.includeAlt:!1,rowLayout:j1(i.rowLayout),showOnDesktop:typeof i.showOnDesktop=="boolean"?!!i.showOnDesktop:!1,actions:Array.isArray(i.actions)?i.actions.map((p,g)=>{const x={id:typeof p.id=="string"&&p.id.trim().length>0?p.id:`${h}-action-${g+1}`,label:typeof p.label=="string"?p.label:`Key ${g+1}`,sequence:typeof p.sequence=="string"?p.sequence:""};return typeof p.doubleTapSequence=="string"&&(x.doubleTapSequence=p.doubleTapSequence),x}):[]}}).filter(i=>i.id!=="auto"),n=Cu()[0];return n&&!r.some(i=>i.id==="default")&&r.unshift(n),r}function hk(e,t){const r=a3(e);if(!r)return"default";for(const n of t)if(n.id!=="default")for(const i of n.programs){const l=ph(i);if(l){if(l.test(r))return n.id}else if(r.includes(i))return n.id}return"default"}function v2(e,t){return e.find(r=>r.id===t)??e.find(r=>r.id==="default")??Cu()[0]}function fk(e){return[{id:"auto",label:"Auto"},...e.map(t=>({id:t.id,label:t.label}))]}function pk(e){return[{id:"auto",label:"Auto"},...e.filter(t=>t.id==="default"||t.showOnDesktop===!0).map(t=>({id:t.id,label:t.label}))]}function l3(e,t){const r=j1(t),n=[];let i=0,l=0;for(;i<e.length;){const c=r[Math.min(l,r.length-1)]??3;n.push({columns:c,items:e.slice(i,i+c)}),i+=c,l+=1}return n}const c3=28,u3=({mode:e,presetLabel:t,title:r,ariaLabel:n,disabled:i,onPointerDown:l,buttonRef:c})=>a.jsx("button",{ref:c,type:"button",onPointerDown:l,tabIndex:-1,disabled:i,className:"h-7 w-7 rounded-full bg-surface-2 shadow-sm text-[11px] font-medium active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",title:r,"aria-label":n??r,children:e==="auto"?a.jsx(VA,{size:14}):(t.charAt(0)||"?").toUpperCase()}),mk={esc:"\x1B",enter:"\r",home:"\x1B[H",end:"\x1B[F","ctrl-c":"","ctrl-d":"","ctrl-w":"","ctrl-u":""},U0=8;function gk(e,t){return mk[e]??null}const xk=({visible:e,interactive:t=!0,presentation:r="mobile",activeModifier:n,lockedModifier:i,disabled:l,defaultShowExtended:c=!1,presetLabel:h,presetModeLabel:p,presetMode:g,presetOptions:x,includeAlt:b,presetRowLayout:w,extraActions:A,onKeyPress:k,onTextPress:E,onPastePress:I,onFilePress:M,onFileLongPress:Q,fileUploadState:j="idle",fileUploadProgress:F=0,longPressMode:V="arrows",copyFeedback:$="idle",onLongPressModeToggle:te,onModifierToggle:se,onPresetSelect:qe,onExpandedChange:de})=>{const{t:oe}=Mr(),[Oe,et]=C.useState(c),[ce,Be]=C.useState(!1),ot=C.useRef(null),Ie=r==="desktop-actions",re=Ie||Oe,[Ue,_e]=C.useState(!1),[K,Le]=C.useState(null),fe=l||!e||!t,$e=l||!e,ze=C.useRef(null),Ee=C.useRef(null),ee=C.useRef(null),Ke=C.useRef(null),wt=C.useRef(null),tt=C.useRef($),ge=C.useRef(null),it=C.useRef(0),ht=C.useRef(null),Y=C.useRef(!1),be=C.useCallback(He=>{if(fe)return;const Se=He.target;if(!(Se instanceof Element))return;const Ve=Se.closest("button"),Ct=Ve?.hasAttribute("data-mobile-native-action")===!0;Ve&&!Ct?(He.preventDefault(),no(U0)):Ve&&no(U0)},[fe]),ut=C.useCallback(He=>{He.preventDefault()},[]),le=C.useCallback(He=>{const Se=He.target;fe||Se instanceof HTMLElement&&Se.closest("button")&&Se.blur()},[fe]);C.useEffect(()=>{et(c)},[c]),C.useEffect(()=>{Ie||de?.(Oe)},[Ie,de,Oe]),C.useEffect(()=>{fe&&(ge.current!==null&&(window.clearTimeout(ge.current.timer),ge.current=null),_e(!1),Le(null))},[fe]),C.useEffect(()=>{e||(_e(!1),Le(null))},[e]),C.useEffect(()=>{if(!Ue)return;const He=()=>{const Se=ze.current?.getBoundingClientRect();Se&&Le({left:Math.max(8,Se.left),top:Math.max(8,Se.top-8)})};return He(),window.addEventListener("resize",He),window.addEventListener("scroll",He,!0),()=>{window.removeEventListener("resize",He),window.removeEventListener("scroll",He,!0)}},[Ue]),C.useEffect(()=>{const He=tt.current;if(tt.current=$,$==="idle"||$===He)return;if(wt.current!==null&&window.clearTimeout(wt.current),!(typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches))if($==="copied"){Ee.current?.animate?.([{transform:"scale(1)"},{transform:"scale(1.16)",offset:.28},{transform:"scale(0.96)",offset:.62},{transform:"scale(1)"}],{duration:720,easing:"cubic-bezier(0.16, 1, 0.3, 1)"});const Ve=[{opacity:0,transform:"scale(0.65)"},{opacity:.75,transform:"scale(0.9)",offset:.18},{opacity:0,transform:"scale(1.65)"}];ee.current?.animate?.(Ve,{duration:760,easing:"ease-out"}),Ke.current?.animate?.(Ve,{duration:760,delay:130,easing:"ease-out"})}else Ee.current?.animate?.([{transform:"translateX(0)"},{transform:"translateX(-2px)"},{transform:"translateX(2px)"},{transform:"translateX(0)"}],{duration:280,easing:"ease-out"});no(U0),$==="copied"&&(wt.current=window.setTimeout(()=>{no(U0),wt.current=null},90),V==="copy"&&te?.())},[$,V,te]),C.useEffect(()=>()=>{wt.current!==null&&window.clearTimeout(wt.current)},[]);const pe=C.useCallback((He,Se)=>{fe||(He.preventDefault(),k(Se))},[k,fe]),je=C.useCallback((He,Se)=>{fe||(He.preventDefault(),se(Se))},[se,fe]),xt=C.useCallback(He=>{fe||(He.preventDefault(),et(Se=>{const Ve=!Se;return Ve&&(Be(!0),ot.current!==null&&window.clearTimeout(ot.current),ot.current=window.setTimeout(()=>{Be(!1),ot.current=null},350)),Ve}))},[fe]),dt=C.useCallback(()=>{const He=typeof performance<"u"?performance.now():Date.now();He-it.current<350||(it.current=He,I?.())},[I]),Dt=C.useCallback(He=>{fe||(He.stopPropagation(),He.pointerType!=="touch"&&(He.preventDefault(),dt()))},[fe,dt]),Xt=C.useCallback(He=>{fe||(He.preventDefault(),He.stopPropagation(),dt())},[fe,dt]),Ht=C.useCallback(He=>{fe||j==="uploading"||!M||(He.preventDefault(),He.stopPropagation(),Y.current||M(),Y.current=!1)},[j,M,fe]),Bt=C.useCallback(()=>{ht.current!==null&&window.clearTimeout(ht.current),ht.current=null},[]),Wt=C.useCallback(He=>{He.stopPropagation(),!(fe||j==="uploading"||!Q)&&(Y.current=!1,ht.current=window.setTimeout(()=>{ht.current=null,Y.current=!0,no(U0),Q()},500))},[j,Q,fe]);C.useEffect(()=>()=>Bt(),[Bt]);const lr=C.useCallback(He=>{fe||He.stopPropagation()},[fe]),ur=250,Jt=C.useCallback(()=>{ge.current!==null&&(window.clearTimeout(ge.current.timer),ge.current=null)},[]);C.useEffect(()=>()=>{Jt(),ot.current!==null&&(window.clearTimeout(ot.current),ot.current=null)},[Jt]);const Er=C.useCallback((He,Se)=>{if(fe)return;if(He.preventDefault(),!Se.doubleTapSequence){E(Se.sequence);return}const Ve=ge.current;if(Ve!==null&&Ve.actionId===Se.id){window.clearTimeout(Ve.timer),ge.current=null,E(Se.doubleTapSequence);return}Jt();const Ct=window.setTimeout(()=>{ge.current=null,E(Se.sequence)},ur);ge.current={actionId:Se.id,timer:Ct}},[Jt,E,fe]),X=C.useCallback(He=>{fe||(He.preventDefault(),He.stopPropagation(),te?.())},[te,fe]),Re=C.useCallback(He=>{fe||He.stopPropagation()},[fe]),We=C.useCallback(He=>{if(fe)return;He.preventDefault();const Se=He.currentTarget.getBoundingClientRect();Le({left:Math.max(8,Se.left),top:Math.max(8,Se.top-8)}),_e(Ve=>!Ve)},[fe]),Qt=C.useCallback((He,Se)=>{fe||(He.preventDefault(),_e(!1),Le(null),qe(Se))},[qe,fe]),It=A.length>0,ar=C.useMemo(()=>{const He=[{id:"preset",kind:"preset"}];if(!Ie&&b&&He.push({id:"alt",kind:"alt"}),It){const Se=A.map(Ve=>({id:Ve.id,kind:"text",action:Ve}));return He.concat(Se)}return Ie?He.concat([{id:"esc",kind:"key",keyName:"esc"},{id:"ctrl-c",kind:"key",keyName:"ctrl-c"},{id:"ctrl-d",kind:"key",keyName:"ctrl-d"},{id:"home",kind:"key",keyName:"home"},{id:"end",kind:"key",keyName:"end"}]):He.concat([{id:"home",kind:"key",keyName:"home"},{id:"end",kind:"key",keyName:"end"},{id:"ctrl-d",kind:"key",keyName:"ctrl-d"}])},[A,It,b,Ie]),Ot=C.useMemo(()=>l3(ar,Ie&&!It?[6]:w),[ar,It,Ie,w]),Fe=`${Ie?"space-y-1":"mt-1 space-y-1"}${ce?" pointer-events-none":""}`,yr=Ue&&K?Ai.createPortal(a.jsx("div",{className:"fixed z-popover min-w-28 -translate-y-full rounded-2xl bg-surface-elevated p-1.5 shadow-xl border border-border/15",style:{left:K.left,top:K.top},children:a.jsx("div",{className:"grid gap-1",children:x.map(He=>a.jsx("button",{type:"button",onPointerDown:Se=>Qt(Se,He.id),tabIndex:-1,disabled:$e,className:`h-7 rounded-full px-3 text-left text-xs font-medium transition-colors disabled:opacity-50 ${He.id===g?"bg-primary text-primary-foreground":"bg-surface-2 hover:bg-surface-elevated text-muted-foreground hover:text-foreground"}`,children:He.label},He.id))})}),document.body):null;return a.jsxs(a.Fragment,{children:[yr,a.jsx("div",{"data-mobile-keyboard":"true",className:`z-chrome select-none overflow-hidden app-chrome-bg transition-all duration-150 ease-out px-1 py-0 ${e?Ie?"max-h-24":"max-h-40":"max-h-0"} ${e?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"} ${t?"":"[&_button]:pointer-events-none"}`,onMouseDownCapture:be,onPointerDownCapture:be,onContextMenuCapture:ut,onFocusCapture:le,children:a.jsxs("div",{className:"rounded-2xl bg-surface-elevated p-0.5 space-y-0.5",children:[!Ie&&a.jsxs("div",{"data-mobile-keyboard-primary-row":"true",className:"grid grid-cols-10 gap-1",children:[a.jsx("button",{type:"button",onPointerDown:He=>pe(He,"esc"),tabIndex:-1,disabled:$e,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:"Esc"}),a.jsx("button",{type:"button",onPointerDown:He=>je(He,"ctrl"),tabIndex:-1,disabled:$e,className:`h-7 w-full rounded-full shadow-sm text-xs disabled:opacity-50 flex items-center justify-center transition-all ${n==="ctrl"?"bg-primary text-primary-foreground scale-105 shadow-md shadow-primary/40":"bg-surface-2"} ${i==="ctrl"?"ring-2 ring-accent":""}`,children:a.jsx("span",{className:"font-medium",children:i==="ctrl"?"Ctrl*":"Ctrl"})}),a.jsx("button",{type:"button",onPointerDown:He=>pe(He,"ctrl-c"),tabIndex:-1,disabled:$e,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:"C-C"}),a.jsx("button",{type:"button",onPointerDown:He=>pe(He,"ctrl-u"),tabIndex:-1,disabled:$e,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:"C-U"}),a.jsxs("button",{type:"button",onPointerDown:Wt,onPointerUp:Bt,onPointerCancel:Bt,onClick:Ht,tabIndex:-1,disabled:$e||!M||j==="uploading",title:j==="uploading"?`${oe("rightSidebar.uploading")} ${Math.round(F)}%`:oe(j==="inserted"?"rightSidebar.inserted":j==="failed"?"rightSidebar.uploadFailed":"rightSidebar.insertLocalFile"),"aria-label":oe("rightSidebar.insertLocalFile"),className:`relative h-7 w-full overflow-hidden rounded-full shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center ${j==="inserted"?"bg-primary/15 text-primary":j==="failed"?"bg-destructive/15 text-destructive":"bg-surface-2"}`,children:[j==="uploading"&&a.jsx("span",{"aria-hidden":"true","data-file-upload-progress":"true",className:"absolute inset-y-0 left-0 bg-primary/25 transition-[width] duration-150 ease-out",style:{width:`${Math.max(0,Math.min(100,F))}%`}}),a.jsx("span",{className:"relative z-10 flex items-center justify-center",children:j==="uploading"?a.jsx(_n,{size:15,className:"animate-spin"}):j==="inserted"?a.jsx(ua,{size:15}):j==="failed"?a.jsx(Kn,{size:15}):a.jsx(ww,{size:15})}),j!=="idle"&&a.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:j==="uploading"?`${oe("rightSidebar.uploading")} ${Math.round(F)}%`:oe(j==="inserted"?"rightSidebar.inserted":"rightSidebar.uploadFailed")})]}),a.jsx("button",{type:"button",onPointerDown:()=>E("/"),tabIndex:-1,disabled:$e,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:"/"}),a.jsx("button",{type:"button",onPointerDown:He=>pe(He,"enter"),tabIndex:-1,disabled:$e,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",children:a.jsx(mw,{size:16})}),a.jsxs("button",{ref:Ee,type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:Re,onTouchStart:Re,onClick:X,tabIndex:-1,disabled:$e,title:oe($==="copied"?"terminal.copied":$==="failed"?"terminal.copyFailed":V==="copy"?"terminal.longPressSelectsText":"terminal.longPressSendsArrows"),"aria-label":oe(V==="copy"?"terminal.switchLongPressToArrows":"terminal.switchLongPressToCopy"),className:`relative isolate h-7 w-full overflow-visible rounded-full shadow-sm active:bg-accent active:text-accent-foreground transition-colors keyboard-button-active disabled:opacity-50 flex items-center justify-center ${$==="copied"?"bg-primary/15 text-primary":$==="failed"?"bg-destructive/15 text-destructive":V==="copy"?"bg-primary/15 text-primary":"bg-surface-2"}`,children:[a.jsx("span",{ref:ee,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/70 opacity-0"}),a.jsx("span",{ref:Ke,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/40 opacity-0"}),a.jsxs("span",{className:"relative z-10 h-4 w-4","aria-hidden":"true",children:[a.jsx(ua,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${$==="copied"?"scale-100 rotate-0 opacity-100":"scale-50 -rotate-45 opacity-0"}`}),a.jsx(Kn,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-200 ease-out motion-reduce:transition-none ${$==="failed"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),a.jsx(nb,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${$==="idle"&&V==="copy"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),a.jsx(Vw,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${$==="idle"&&V==="arrows"?"scale-100 rotate-0 opacity-100":"scale-50 rotate-45 opacity-0"}`})]}),$!=="idle"&&a.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:$==="copied"?`${oe("terminal.copied")} · ${oe("terminal.longPressSendsArrows")}`:`${oe("terminal.copyFailed")} · ${oe("terminal.longPressSelectsText")}`})]}),a.jsx("button",{type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:Dt,onPointerUp:lr,onTouchStart:lr,onTouchEnd:lr,onClick:Xt,tabIndex:-1,disabled:$e,title:oe("terminal.paste"),"aria-label":oe("terminal.paste"),className:"h-7 w-full rounded-full bg-surface-2 shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",children:a.jsx(aw,{size:15})}),a.jsx("button",{type:"button",onPointerDown:xt,tabIndex:-1,disabled:$e,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",children:Oe?a.jsx(S7,{size:16}):a.jsx(Yo,{size:16})})]}),re&&a.jsx("div",{className:Fe,children:Ot.map((He,Se)=>{const Ve=He.items[0]?.kind==="preset",Ct=Math.max(2,He.columns),jr=Ve?`${c3}px repeat(${Math.max(1,Ct-1)}, minmax(0, 1fr))`:`repeat(${Ct}, minmax(0, 1fr))`;return a.jsx("div",{className:"relative grid gap-1",style:{gridTemplateColumns:jr},children:He.items.map(ft=>ft.kind==="preset"?a.jsx(u3,{buttonRef:ft.id==="preset"?ze:void 0,mode:g,presetLabel:h,title:p,disabled:$e,onPointerDown:We},ft.id):ft.kind==="alt"?a.jsx("button",{type:"button",onPointerDown:Br=>je(Br,"alt"),tabIndex:-1,disabled:$e,className:`h-7 w-full rounded-full shadow-sm text-xs disabled:opacity-50 flex items-center justify-center transition-all ${n==="alt"?"bg-primary text-primary-foreground scale-105 shadow-md shadow-primary/40":"bg-surface-2"} ${i==="alt"?"ring-2 ring-accent":""}`,children:a.jsx("span",{className:"font-medium",children:i==="alt"?"Alt*":"Alt"})},ft.id):ft.kind==="text"?a.jsxs("button",{type:"button",onPointerDown:Br=>Er(Br,ft.action),tabIndex:-1,disabled:$e,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm px-1 text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 relative",children:[ft.action.label,ft.action.doubleTapSequence&&a.jsx("span",{className:"absolute top-0.5 right-1.5 h-1 w-1 rounded-full bg-accent/60"})]},ft.id):a.jsx("button",{type:"button",onPointerDown:Br=>pe(Br,ft.keyName),tabIndex:-1,disabled:$e,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:ft.keyName==="esc"?"Esc":ft.keyName==="ctrl-c"?"Ctrl-C":ft.keyName==="ctrl-d"?"Ctrl-D":ft.keyName==="home"?"Home":"End"},ft.id))},`row-${Se}`)})})]})})]})},bk=({isMobile:e,isInputFocused:t,isIOS:r,isConnecting:n,connectionError:i,terminalSessionId:l})=>{if(typeof window>"u")return null;const c=window.visualViewport?Math.max(0,Math.round(window.innerHeight-window.visualViewport.height-window.visualViewport.offsetTop)):0;return a.jsxs("div",{className:"px-3 py-2 bg-surface text-foreground text-xs border-b border-border/15",children:[a.jsx("div",{className:"font-bold mb-2",children:"Debug Info"}),a.jsxs("div",{className:"grid grid-cols-2 gap-1 font-mono",children:[a.jsxs("div",{children:["isMobile: ",a.jsx("span",{className:e?"text-accent":"text-destructive",children:String(e)})]}),a.jsxs("div",{children:["touchPoints: ",navigator.maxTouchPoints]}),a.jsxs("div",{children:["innerWidth: ",window.innerWidth]}),a.jsxs("div",{children:["innerHeight: ",window.innerHeight]}),a.jsxs("div",{children:["viewportH:"," ",window.visualViewport?Math.round(window.visualViewport.height):"N/A"]}),a.jsxs("div",{children:["inputFocused: ",String(t)]}),a.jsxs("div",{children:["keyboard~: ",c,"px"]}),a.jsxs("div",{children:["connecting:"," ",a.jsx("span",{className:n?"text-muted-foreground":"text-accent",children:String(n)})]}),a.jsxs("div",{children:["sessionId:"," ",a.jsx("span",{className:l?"text-accent":"text-destructive",children:l?"✓":"✗"})]}),a.jsxs("div",{children:["error:"," ",a.jsx("span",{className:i?"text-destructive":"text-accent",children:i?"Yes":"No"})]}),a.jsxs("div",{children:["isIOS:"," ",a.jsx("span",{className:r?"text-muted-foreground":"text-accent",children:String(r)})]})]}),a.jsx("div",{className:"mt-2 pt-2 border-t border-border/15",children:a.jsx("div",{children:"Tip: Tap the status bar 3 times to toggle debug panel"})})]})},yk=/^Reconnecting/i,vk=({connectionError:e,isFatalError:t,isRestarting:r,isConnecting:n,onHardRestart:i})=>{const{t:l}=Mr(),c=!!e&&yk.test(e),h=!!(n&&!e||c),[p,g]=C.useState(!1);return C.useEffect(()=>{if(!h){g(!1);return}const x=setTimeout(()=>g(!0),1500);return()=>clearTimeout(x)},[h]),h?p?a.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2 pointer-events-none",children:a.jsx(gu,{dots:!0,label:l("connection.reconnecting"),className:"rounded-full bg-surface-2 px-3 py-1 text-[11px]"})}):null:e?a.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-destructive/70",children:[a.jsx("span",{children:e}),t&&a.jsx("button",{type:"button",onClick:i,disabled:r,className:"text-[11px] text-destructive/90 hover:text-destructive underline underline-offset-2 transition-colors disabled:opacity-40",children:l("common.retry")})]})}):null};let lu=[],Vf=!1;function la(e,t,r={}){typeof window>"u"||(lu.push(JSON.stringify({level:e,message:t,data:{ts:Date.now(),...r}})),wk())}async function wk(){if(!Vf){Vf=!0;try{for(;lu.length>0;){const e=lu[0];try{await fetch("/api/client-log",{method:"POST",headers:{"Content-Type":"application/json"},body:e,keepalive:!0}),lu.shift()}catch{lu=[];break}}}finally{Vf=!1}}}const Ak=120,Tk=80,Ck=400;function w2(){if(typeof window>"u"||document.visibilityState!=="visible"||!_7())return 0;const e=Number.parseFloat(document.documentElement.style.getPropertyValue("--kb-height")||"0");if(Number.isFinite(e)&&e>0)return Math.round(e);const t=zo().visualViewport;if(!t)return 0;const r=Number.parseFloat(document.documentElement.style.getPropertyValue("--app-base-vh")||"0")||window.innerHeight,n=Number.parseFloat(document.documentElement.style.getPropertyValue("--safe-bottom-inset")||"0")||0,i=t.height+t.offsetTop;return Math.max(0,Math.round(r-i-n))}function d3(e){const{enabled:t,openThresholdPx:r=Ak,closeThresholdPx:n=Tk,settleDelayMs:i=Ck}=e,l=C.useMemo(()=>qc("keyboard"),[]),c=C.useRef(!1),h=C.useRef(null),p=C.useRef(0),[g,x]=C.useState({isOpen:!1,isSettled:!1,keyboardHeight:0});return C.useEffect(()=>{if(typeof window>"u"||!t){c.current=!1,h.current!==null&&(clearTimeout(h.current),h.current=null),x($=>!$.isOpen&&!$.isSettled&&$.keyboardHeight===0?$:{isOpen:!1,isSettled:!1,keyboardHeight:0});return}let b=null;const w=()=>{b=null;const $=w2();let te=c.current;if($>=r?te=!0:$<=n&&(te=!1),c.current=te,te){const se=Math.abs($-p.current);p.current=$,se>10&&(h.current!==null&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,x(qe=>qe.isSettled?qe:{...qe,isSettled:!0})},i))}else h.current!==null&&(clearTimeout(h.current),h.current=null);x(se=>{const qe=te?se.isSettled:!1;return se.isOpen===te&&se.keyboardHeight===$&&se.isSettled===qe?se:(l("sync",{keyboardHeight:$,isOpen:te,isSettled:qe,visualViewport:zo().visualViewport?{width:Math.round(zo().visualViewport.width),height:Math.round(zo().visualViewport.height),offsetTop:Math.round(zo().visualViewport.offsetTop)}:null}),{isOpen:te,isSettled:qe,keyboardHeight:$})})},A=($="event")=>{($.includes("visibilitychange")||$.includes("pageshow"))&&l("schedule",{source:$}),b===null&&(b=window.requestAnimationFrame(w))};A("mount");const k=()=>A("resize"),E=()=>A("orientationchange"),I=()=>A("visualViewport.resize"),M=()=>A("visualViewport.scroll"),Q=()=>A("viewport-keyboard-change");window.addEventListener("resize",k),window.addEventListener("orientationchange",E),zo().visualViewport?.addEventListener("resize",I),zo().visualViewport?.addEventListener("scroll",M),document.addEventListener("termdock:viewport-keyboard-change",Q);const j=$=>{l("resume",{source:$,keyboardHeight:w2(),hidden:document.hidden}),A(`${$}:now`),window.setTimeout(()=>A(`${$}:50ms`),50),window.setTimeout(()=>A(`${$}:200ms`),200)},F=()=>{document.hidden||j("visibilitychange")},V=()=>j("pageshow");return document.addEventListener("visibilitychange",F),window.addEventListener("pageshow",V),()=>{window.removeEventListener("resize",k),window.removeEventListener("orientationchange",E),zo().visualViewport?.removeEventListener("resize",I),zo().visualViewport?.removeEventListener("scroll",M),document.removeEventListener("termdock:viewport-keyboard-change",Q),document.removeEventListener("visibilitychange",F),window.removeEventListener("pageshow",V),b!==null&&window.cancelAnimationFrame(b),h.current!==null&&(clearTimeout(h.current),h.current=null)}},[l,t,r,n,i]),g}const Kd=300,Sk=120,_k=2e3,Lk=250,kk=6e4;function Ik(e){const t=new Set(e.slides.flat()),r=new Set([...e.visibleSessionIds].filter(c=>t.has(c)));e.foregroundSessionId&&t.has(e.foregroundSessionId)&&r.add(e.foregroundSessionId);const n=e.slides.findIndex(c=>c.some(h=>r.has(h)));if(n<0)return r;const i=e.slides[n-1]??[],l=e.slides[n+1]??[];for(let c=0;c<Math.max(i.length,l.length)&&r.size<3;c+=1)for(const h of[i[c],l[c]])h&&r.size<3&&r.add(h);return r}function qf(e,t){return t?e.find(r=>r.id===t||r.backendSessionId===t)?.id??null:null}function Td(e){return e.prioritySessionId??e.activeSessionId??e.persistedActiveSessionId??e.firstSessionId}function Ek(e){return e.foregroundSessionId===null||e.isVisible===!0||e.sessionId===e.foregroundSessionId||e.foregroundReady}function Nk(e){return e.sessionId===e.foregroundSessionId||e.visibleSessionIds.has(e.sessionId)||e.deferredViewportSessionIds.has(e.sessionId)}function Rk(e){return e.isMobile&&(!e.viewportReady||!e.streamReady||!e.contentReady)}function Mk(e){return e.writtenChunkId!==null&&e.initialTargetChunkId!==null&&e.writtenChunkId>=e.initialTargetChunkId}function Dk(e){return!e.initialConnectionPending}function Bk(e){return!e}function Qk(e){return e.requestToken===0||e.isVisible===!0||e.foregroundSessionId===null||e.isVisible===void 0&&e.sessionId===e.foregroundSessionId||e.foregroundCompletedToken===e.requestToken}function jk(e,t){return[...e].every(r=>t.has(r))}function Pk(e,t){return e===null||t-e>=Lk}function Ok(e){return!1}function Fk(e){return!e.isActive||e.isStreamReady||e.reconnectStartedAt===null?null:Math.max(0,kk-(e.now-e.reconnectStartedAt))}function $k(e,t){const r=new Map;let n=0;for(const i of e)if(!r.has(i)){if(t.has(i)){r.set(i,0);continue}r.set(i,Kd+n*Sk),n+=1}return r}const Uk="Session not found on server",Xd="Terminal session not found",zk="STALE_SESSION_RESTORE_REJECTED";function A2(e){return Jp(e)?!1:e?.message===Uk||e?.status===404&&e.message===Xd}function Jp(e){return e?.code===zk}function Hk(e,t){if(!e||e.startsWith("/"))return e;const r=e.replace(/^\.\//,"");return t?`${t.replace(/\/+$/,"")}/${r}`:r}function h3(e,t){return Hk(e,t).replace(/ /g,"\\ ")}function f3(e,t){return`${h3(e,t)} `}function T2(e,t){return h3(e,t)}function KO(e,t,r){if(!r)return T2(e,t);const n=r.start===r.end?`${r.start}`:`${r.start}-${r.end}`;return`${T2(e,t)}:${n}`}const Wk="/tmp";async function p3(e,t,r){const i=(await t(Wk,[e])).files[0];if(!i?.path)throw new Error("Upload did not return a file path");return r(i.path),i}const XO=p3,m3=[640,960,1280,1600,2048,2560,3072,4096],g3=[240,360,480,540,720,1080,1440,2160],hu={min:.1,max:1,step:.01},fu={min:25e4,max:2e7,step:25e4},O1="termdock:mobile-media-compression-v1",Rc={imageEnabled:!1,imageMaxDimension:2048,imageQuality:.8,videoEnabled:!1,videoMaxHeight:720,videoBitrate:25e5};function x3(){try{const e=JSON.parse(localStorage.getItem(O1)||"null");return!e||typeof e!="object"?Rc:{imageEnabled:e.imageEnabled===!0,imageMaxDimension:m3.includes(e.imageMaxDimension)?e.imageMaxDimension:Rc.imageMaxDimension,imageQuality:typeof e.imageQuality=="number"&&e.imageQuality>=hu.min&&e.imageQuality<=hu.max?e.imageQuality:Rc.imageQuality,videoEnabled:e.videoEnabled===!0,videoMaxHeight:g3.includes(e.videoMaxHeight)?e.videoMaxHeight:Rc.videoMaxHeight,videoBitrate:typeof e.videoBitrate=="number"&&e.videoBitrate>=fu.min&&e.videoBitrate<=fu.max?e.videoBitrate:Rc.videoBitrate}}catch{return Rc}}const b3=Du((e,t)=>({preferences:x3(),saveFailed:!1,update:r=>{const n={...t().preferences,...r};let i=!1;try{localStorage.setItem(O1,JSON.stringify(n))}catch{i=!0}e({preferences:n,saveFailed:i})}}));typeof window<"u"&&window.addEventListener("storage",e=>{(e.key===O1||e.key===null)&&b3.setState({preferences:x3(),saveFailed:!1})});function Cd(e){if(e<1024)return`${e} B`;const t=["B","KB","MB","GB","TB"],r=Math.min(t.length-1,Math.floor(Math.log(e)/Math.log(1024)));return`${Number((e/1024**r).toFixed(1))} ${t[r]}`}function Gk({result:e,message:t,onClose:r}){const{locale:n}=Mr(),i=n==="zh",l=y.useRef(null),[c,h]=y.useState(null),[p,g]=y.useState(!1);return y.useEffect(()=>{const x=URL.createObjectURL(e.file);return h(x),g(!1),()=>URL.revokeObjectURL(x)},[e.file]),y.useEffect(()=>{const x=l.current;return x?.showModal(),()=>x?.close()},[]),a.jsx("dialog",{ref:l,"aria-label":i?"上传结果预览":"Uploaded media preview",onCancel:x=>{x.preventDefault(),r()},onClick:x=>{x.target===x.currentTarget&&r()},onKeyDown:x=>x.stopPropagation(),onKeyUp:x=>x.stopPropagation(),className:"fixed inset-0 z-modal-panel m-0 h-[100dvh] max-h-none w-screen max-w-none bg-transparent p-3 text-foreground backdrop:bg-[var(--app-backdrop)] open:flex open:items-center open:justify-center",children:a.jsxs("section",{className:"flex max-h-[calc(100dvh-env(safe-area-inset-top,0px)-env(safe-area-inset-bottom,0px)-1.5rem)] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface shadow-xl",children:[a.jsxs("header",{className:"flex shrink-0 items-start gap-3 border-b border-border/15 p-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-sm font-semibold",children:i?"上传结果预览":"Uploaded media preview"}),a.jsx("p",{className:"mt-1 break-words text-xs text-muted-foreground",children:t}),a.jsx("p",{className:"mt-1 truncate text-[11px] text-muted-foreground",children:e.file.name})]}),a.jsx("button",{type:"button",autoFocus:!0,onClick:r,"aria-label":i?"关闭预览":"Close preview",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-surface-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",children:a.jsx(Kn,{size:18})})]}),a.jsx("div",{className:"min-h-0 overflow-auto p-2",children:p?a.jsx("p",{role:"alert",className:"p-4 text-sm text-muted-foreground",children:i?"文件已上传,但当前浏览器无法预览此格式。":"File uploaded, but this browser cannot preview this format."}):c&&(e.kind==="image"?a.jsx("img",{src:c,alt:e.file.name,onError:()=>g(!0),className:"mx-auto block max-h-[65dvh] max-w-full object-contain"}):a.jsx("video",{src:c,controls:!0,playsInline:!0,preload:"metadata",onError:()=>g(!0),className:"mx-auto block max-h-[65dvh] w-full"}))})]})})}function Vk({result:e,onDismiss:t}){const{locale:r}=Mr(),n=r==="zh",[i,l]=y.useState(null);y.useEffect(()=>{if(!e)return;const k=window.setTimeout(t,2e3);return()=>window.clearTimeout(k)},[e,t]);const c=e??i?.result;if(!c)return null;const h=c.originalSize-c.uploadedSize,p=c.originalSize>0?Math.abs(h)/c.originalSize*100:0,g=p<1?"<1%":`${Math.floor(p)}%`,x=c.kind==="image"?n?"图片":"Image":n?"视频":"Video",b=h>0?n?"已压缩上传":"Compressed upload":n?"已处理上传":"Processed upload",w=h>0?n?`省 ${g}`:`${g} saved`:h<0?`+${g}`:n?"体积未变":"Size unchanged",A=c.originalRetained?n?`已尝试压缩 · 保留原图 ${Cd(c.uploadedSize)},已上传`:`Compression tried · original ${Cd(c.uploadedSize)} uploaded`:`${b} · ${Cd(c.originalSize)} → ${Cd(c.uploadedSize)} · ${w}`;return a.jsxs(a.Fragment,{children:[e&&a.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"pointer-events-none absolute left-1/2 top-1/2 z-30 w-max max-w-[calc(100%-1.5rem)] -translate-x-1/2 -translate-y-1/2 motion-safe:animate-[fade-in_0.15s_ease-out]",children:a.jsxs("button",{type:"button","aria-label":`${x}:${A} · ${n?"点击预览":"Preview"}`,onClick:()=>{l({result:e,message:A}),t()},className:"pointer-events-auto flex max-w-full select-none items-center gap-1.5 rounded-full border border-border/15 bg-surface-elevated px-3 py-2 text-[11px] leading-4 text-foreground shadow-md focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",children:[a.jsx(ua,{size:13,strokeWidth:2.5,className:"shrink-0 text-primary","aria-hidden":"true"}),a.jsx("span",{className:"truncate tabular-nums",children:A}),a.jsx("span",{className:"shrink-0 text-muted-foreground",children:n?"预览 ›":"Preview ›"})]})}),i&&Ai.createPortal(a.jsx(Gk,{result:i.result,message:i.message,onClose:()=>l(null)}),document.body)]})}const qk=320,C2="termdock:mobile-keyboard-expanded",S2="termdock:mobile-keyboard-preset-mode",_2="termdock:mobile-long-press-mode",Yk=80;function Zk(e){return/\.(?:jpe?g|png|heic|heif)$/i.test(e.name)||/^(?:image\/jpeg|image\/png|image\/heic|image\/heif)$/i.test(e.type)}function L2(e){const t=(e instanceof Error?e.message:String(e)).slice(0,3e3);return/importing a module script failed|dynamically imported module|loading chunk/i.test(t)?`压缩模块加载失败,可能是页面版本过旧或网络中断。请更新页面后重试,无需清除转码器缓存。
|
|
68
|
-
${t}`:t}function Kk(e){switch(e?.phase){case"loading":return`正在加载转码器… ${e.progress??0}%(优先使用浏览器缓存)`;case"saving":return"加载完成,正在保存到本机…";case"initializing":return e.source==="local"?"已找到本机缓存,正在初始化转码器…":"正在初始化本地转码器…";case"ready":return e.source==="local"?"已从本机缓存加载,转码器已就绪。":e.saved?"转码器已就绪,已保存到本机供下次使用。":"转码器已就绪。";default:return"正在检查本机转码器缓存…"}}function Yf(){return typeof window>"u"?!1:(navigator.maxTouchPoints>0||"ontouchstart"in window)&&window.innerWidth<768}const Xk={retry:{maxRetries:60,initialDelayMs:1e3,maxDelayMs:2e4},connectionTimeoutMs:15e3},Jk=({sessionId:e,mode:t,tmuxSessionName:r=null,terminalSettings:n=Q1(),colorTheme:i="dark",toolbarPresets:l=[],isActive:c=!0,focusSuspended:h=!1,deferCursorUntilPositioned:p=!1,isLayoutVisible:g=!0,focusRequestToken:x=0,resumeRequestToken:b=0,resumeRequestReason:w="visibility",resumeRequestDelayMs:A=0,forceResumeReconnect:k=!1,initialConnectDelayMs:E=0,initialConnectEnabled:I=!0,resumeRequestEnabled:M=!0,onStreamReadyChange:Q,onStreamConnected:j,onViewportReadyChange:F,onContentReadyChange:V,onKeyboardVisibilityChange:$,suppressKeyboard:te=!1,keyboardPortalTarget:se=null,sharedMobileKeyboardLayout:qe=!1,suppressPageFlipRefresh:de=!1,showDebug:oe,onStatusChange:Oe})=>{const{t:et}=Mr(),[ce]=C.useState(e||gb()),[Be,ot]=C.useState(()=>(e?Np(e):null)??n.fontSize),Ie=C.useMemo(()=>rk(),[]),re=C.useMemo(()=>qc("session"),[]),Ue=C.useMemo(()=>qc("keyboard"),[]),_e=C.useRef(null),K=C.useRef(null);C.useEffect(()=>{Np(ce)===null&&ot(n.fontSize)},[n.fontSize,ce]);const Le=C.useMemo(()=>({...n,fontSize:Be}),[n,Be]),[fe,$e]=C.useState(Yf),[ze,Ee]=C.useState(!1),[ee,Ke]=C.useState(!1),[wt,tt]=C.useState(!1),[ge,it]=C.useState(()=>typeof document>"u"?!0:!document.hidden&&su()),[ht,Y]=C.useState(()=>typeof document>"u"?!0:document.hasFocus()),[be,ut]=C.useState(!1),[le,pe]=C.useState(!1),[je,xt]=C.useState(!1),[dt,Dt]=C.useState(!1),[Xt,Ht]=C.useState(!0),{isOpen:Bt,keyboardHeight:Wt}=d3({enabled:fe&&c}),[lr,ur]=C.useState(null),[Jt,Er]=C.useState(null),[X,Re]=C.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(C2)==="true"),[We,Qt]=C.useState(()=>{if(typeof window>"u")return"auto";const J=window.localStorage.getItem(S2);return J&&J.length>0?J:"auto"}),[It,ar]=C.useState(()=>typeof window>"u"?"arrows":window.localStorage.getItem(_2)==="copy"?"copy":"arrows"),[Ot,Fe]=C.useState("idle"),[yr,He]=C.useState("idle"),[Se,Ve]=C.useState(0),[Ct,jr]=C.useState(null),[ft,Br]=C.useState(null),Wn=C.useCallback(()=>Br(null),[]),{preferences:an,update:ke,saveFailed:St}=b3(),{videoEnabled:kt,videoMaxHeight:ue,videoBitrate:Nr,imageEnabled:st,imageMaxDimension:Gt,imageQuality:Ur}=an,[gn,Ln]=C.useState(!1),[wn,sr]=C.useState(null),[yn,Ts]=C.useState(null),Xr=Hr(J=>J.sessions.get(ce)),{setTerminalSession:Wr,setConnecting:on,appendToBuffer:An,replaceBuffer:jn,clearTerminalSession:Gn,removeTerminalSession:Pn,clearBuffer:hn,setSessionActiveProgram:kn,setSessionCwd:Tn,setSessionCopyMode:rn,setSessionAgentStatus:Dr,setSessionShellTitle:ns,setSessionPromptState:Mt,clearAgentNeedsReview:q}=Hr.getState(),Ye=C.useMemo(()=>`wt-${ce.replace(/[^a-zA-Z0-9_-]/g,"").slice(0,12)}`,[ce]),Lt=Xr?.terminalSessionId??null,wr=Xr?.mode??"shell",Et=Xr?.activeProgram??null,hr=C.useMemo(()=>Uc(l),[l]),Sr=wr==="tmux",Ir=Xr?.bufferChunks??[],ln=Xr?.isConnecting??!1,zr=Lt,Vn=C.useCallback(async(J,Qe)=>{const mt=CL(J,Xr?.cwd||Xr?.directory);if(!mt)return;let gt=mt,De="directory";try{gt=(await C1(mt)).path}catch(yt){if(!(yt instanceof Error)||yt.message!=="Path is not a directory")return;De="file"}try{const yt=Zt.getState();yt.setRightTab("files"),yt.openRight(),window.dispatchEvent(new CustomEvent(bL,{detail:{path:gt,kind:De,line:Qe}}))}catch{}},[Xr?.cwd,Xr?.directory]),Gr=t??Xr?.mode??"shell",qn=Gr==="tmux"?r??Xr?.tmuxSessionName??null:null,[In,cn]=C.useState(null),H=C.useRef(!1),[we,Pe]=C.useState(!1),[Ge,ve]=C.useState(!1),[lt,Nt]=C.useState(null),[At,ct]=C.useState(0),[_t,_r]=C.useState(null),jt=oe!==void 0?oe:!1,tr=C.useRef(null),vt=C.useRef(null),Tt=C.useRef(null),fr=C.useRef(null),at=C.useRef(null),Rr=C.useRef(!1),Vr=C.useRef(null),Nn=C.useRef([]),nn=C.useRef(0),fs=C.useRef(!1),On=C.useRef(null),ls=C.useRef(null),Bs=C.useRef(-1),ii=C.useRef(null),Os=C.useRef(0),Pr=C.useRef(null),Jr=C.useRef(null),$n=C.useRef(0),U=C.useRef(0),ne=C.useRef(!1),me=C.useRef(null),Me=C.useRef(null),Ut=C.useRef(!1),Pt=C.useRef(0),rr=C.useRef(!1),er=C.useRef(!1),Or=C.useRef(!1),fn=C.useRef(null),P=C.useRef(null),xe=C.useRef(null),Ae=C.useRef(c);Ae.current=c;const rt=C.useRef(h);rt.current=h;const pt=C.useRef(fe),dr=C.useRef(null),qt=C.useRef(null),Rt=C.useRef(null),Fr=C.useRef(null),Rn=C.useRef(null),xs=C.useRef(null),Mi=C.useRef(null),ss=C.useCallback(()=>{const J=++Pt.current,Qe=()=>{J===Pt.current&&pe(!0)};if(typeof window>"u"){Qe();return}window.requestAnimationFrame(()=>window.requestAnimationFrame(Qe))},[]),ai=C.useCallback(J=>{if(rr.current){if(P.current!==null&&(window.clearTimeout(P.current),P.current=null),J.x===0&&J.y>=J.rows-1){Ht(!1);return}P.current=window.setTimeout(()=>{P.current=null,Ht(!0)},Yk)}},[]),oi=C.useRef(null);C.useEffect(()=>()=>{oi.current?.()},[]);const da=C.useCallback(()=>{oi.current||(oi.current=L1(()=>{oi.current=null;const J=Hr.getState(),Qe=Tt.current,mt=J.getTerminalSession(ce);if(!Qe||mt?.mode!=="shell"||J.hasPendingBufferWrites(ce))return;const gt=L7(Qe),De=at.current?.getDimensions();if(!gt||!De)return;const yt=at.current?.serializeSnapshot();yt&&k7({id:Qe,version:1,...gt,...De,data:yt,savedAt:Date.now()})},2e3))},[ce]),pn=C.useCallback(J=>{const Qe=Hr.getState(),mt=Qe.getTerminalSession(ce)?.bufferChunks.at(-1)?.id;if(Tt.current&&mt!==void 0&&mt<=J&&!Qe.hasPendingBufferWrites(ce)&&(I7(Tt.current),da()),!ne.current||!Mk({writtenChunkId:J,initialTargetChunkId:me.current}))return;const gt=Me.current;Me.current=null,gt!==null&&at.current?.notifyScreenSynchronized(gt),ne.current=!1,me.current=null,ss()},[ss,da,ce]),cs=C.useCallback(J=>{if(!rr.current)return;const Qe=fn.current;Qe&&Qe.x===J.x&&Qe.y===J.y&&Qe.rows===J.rows||(fn.current=J,P.current!==null&&(window.clearTimeout(P.current),P.current=null),J.x===0&&J.y>=J.rows-1&&Ht(!1))},[]);C.useEffect(()=>{if(!p){er.current=!1;return}er.current||(er.current=!0,Or.current=!1,rr.current=!0,fn.current=null,Ht(!1),P.current!==null&&(window.clearTimeout(P.current),P.current=null),xe.current!==null&&window.clearTimeout(xe.current),xe.current=window.setTimeout(()=>{xe.current=null,P.current!==null&&typeof window<"u"&&window.clearTimeout(P.current),P.current=null,rr.current=!1,Ht(!0)},15e3))},[p]);const ks=C.useCallback(()=>{Fr.current=null;const J=Rt.current;Rt.current=null,J&&ns(J.sessionId,J.title)},[ns]),Ba=C.useCallback((J,Qe)=>{if(Rt.current={sessionId:J,title:Qe},Fr.current===null){if(typeof window>"u"){ks();return}Fr.current=window.requestAnimationFrame(ks)}},[ks]),Ci=C.useCallback(()=>{Fr.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(Fr.current),Fr.current=null,Rt.current=null},[]),lo=C.useCallback(async()=>{const J=Gr;return(await E7({preferredFrontendSessionId:ce,mode:J,tmuxSessionName:J==="tmux"?qn||Ye:void 0,termType:"xterm-256color",requireExisting:!0})).terminalSession},[Gr,qn,Ye,ce]),ha=C.useRef(c);C.useEffect(()=>{if(!c){at.current?.blur(),ha.current=!1;return}if(ha.current)return;ha.current=!0;const J=P_(fe,de);if(J==="single"){at.current?.requestRefresh("focus",{skipResizePush:!0,skipScrollToBottom:!0});return}J!=="none"&&at.current?.requestRefresh("page-flip",{reconcileServerSize:!0,skipScrollToBottom:!0})},[c,fe,de,zr]),C.useEffect(()=>{pt.current=fe},[fe]);const un=C.useCallback(()=>{!Ae.current||rt.current||at.current?.focus()},[]);C.useLayoutEffect(()=>{h&&at.current?.blur()},[h]),C.useEffect(()=>{if(!c||h||Xt||Or.current)return;Or.current=!0;const J=window.requestAnimationFrame(()=>{at.current?.requestPtyRedraw()});return()=>window.cancelAnimationFrame(J)},[h,c,Xt]);const fa=C.useCallback(J=>{typeof window>"u"||typeof document>"u"||!Ae.current||rt.current||pt.current||document.hidden||!su()||(dr.current!==null&&window.clearTimeout(dr.current),dr.current=window.setTimeout(()=>{if(dr.current=null,!Ae.current||rt.current||pt.current||document.hidden||!su())return;const Qe=document.activeElement,mt=Qe?.getAttribute("data-terminal-input-anchor")==="true";if((Qe instanceof HTMLInputElement||Qe instanceof HTMLTextAreaElement||Qe instanceof HTMLSelectElement||Qe?.isContentEditable===!0)&&!mt){Ue("desktop resume focus skipped: editable active",{reason:J});return}Ue("desktop resume focus",{reason:J}),at.current?.requestRefresh("focus",{force:!0,forceRedraw:!0,skipResizePush:!0,skipScrollToBottom:!0}),at.current?.focus()},50))},[Ue]);C.useEffect(()=>()=>{dr.current!==null&&typeof window<"u"&&window.clearTimeout(dr.current),dr.current=null,qt.current!==null&&typeof window<"u"&&window.clearTimeout(qt.current),qt.current=null,Rn.current!==null&&typeof window<"u"&&window.clearTimeout(Rn.current),Rn.current=null,xs.current!==null&&typeof window<"u"&&window.clearTimeout(xs.current),xs.current=null,xe.current!==null&&typeof window<"u"&&window.clearTimeout(xe.current),xe.current=null,P.current!==null&&typeof window<"u"&&window.clearTimeout(P.current),P.current=null},[]),C.useEffect(()=>{if(typeof document>"u"||typeof window>"u")return;const J=()=>{qt.current!==null&&window.clearTimeout(qt.current),qt.current=window.setTimeout(()=>{qt.current=null;const Qe=document.activeElement,gt=!(Qe?.getAttribute("data-terminal-input-anchor")==="true")&&!!(Qe&&(Qe instanceof HTMLInputElement||Qe instanceof HTMLTextAreaElement||Qe instanceof HTMLSelectElement||Qe.isContentEditable));XA({isActive:Ae.current&&!rt.current,isMobile:pt.current,documentVisible:!document.hidden,activeElementIsEditable:gt})&&un()},0)};return document.addEventListener("pointerup",J),()=>{document.removeEventListener("pointerup",J),qt.current!==null&&(window.clearTimeout(qt.current),qt.current=null)}},[un]);const Is=C.useCallback(()=>{Xn.current=!1,ct(J=>J+1)},[]),Zo=C.useCallback((J,Qe,mt)=>{const gt=Tt.current,De=Date.now();if(gt&&Qe&&N7(gt)){K.current={startedAt:De,strategy:"reconnect",reason:J},la("info","PWA_RESUME terminal-start",{frontendSessionId:ce,backendSessionId:gt,strategy:"reconnect",reason:J,active:Ae.current});return}if(gt&&R7(gt,()=>{const yt=K.current;la("info","PWA_RESUME terminal-responsive",{frontendSessionId:ce,backendSessionId:gt,durationMs:yt?Date.now()-yt.startedAt:null,strategy:yt?.strategy??"probe",reason:yt?.reason??J}),K.current=null,j?.(ce)},{visible:mt})){K.current={startedAt:De,strategy:"probe",reason:J},la("info","PWA_RESUME terminal-start",{frontendSessionId:ce,backendSessionId:gt,strategy:"probe",reason:J,active:Ae.current}),re("[Terminal] resume probe sent",{reason:J,backendSessionId:gt,active:Ae.current});return}if(re("[Terminal] resume probe missing connection, restarting ensureSession",{reason:J,backendSessionId:gt,active:Ae.current}),!Dk({initialConnectionPending:Ut.current})){re("[Terminal] resume probe deferred during initial websocket handshake",{reason:J,backendSessionId:gt});return}Is()},[re,j,Is,ce]),Si=C.useCallback((J,Qe)=>{const mt=Tt.current;mt&&Vr.current!==J&&(Vr.current=J,jm(mt,J,Qe),re("[Terminal] flow-control state sent",{backendSessionId:mt,paused:J,reason:Qe}))},[re]),co=C.useCallback((J,Qe)=>{const mt=Tt.current;mt&&Pr.current!==J&&(Pr.current=J,Pm(mt,J,Qe),re("[Terminal] focus state sent",{backendSessionId:mt,focused:J,reason:Qe}))},[re]),Qa=C.useCallback((J,Qe)=>{const mt=Tt.current;mt&&Jr.current!==J&&(Jr.current=J,Om(mt,J,Qe),re("[Terminal] viewing state sent",{backendSessionId:mt,viewing:J,reason:Qe}))},[re]),pa=ZA({isActive:c&&!h,viewportFocused:wt,documentVisible:ge,windowFocused:ht,streamReady:be}),Yi=KA({isActive:c,documentVisible:ge,windowFocused:ht,streamReady:be,isDesktop:So()!==null}),ja=C.useRef(pa),li=C.useRef(Yi);C.useEffect(()=>{ja.current=pa,co(pa,"logical-focus-change")},[pa,co,zr]),C.useEffect(()=>{li.current=Yi,Qa(Yi,"logical-viewing-change")},[Yi,Qa,zr]),uT(zr,ge,be),C.useEffect(()=>{const J=Qe=>{const mt=Qe.detail;!mt||mt.sessionId!==ce||ot(mt.fontSize??n.fontSize)};return window.addEventListener("termfontchange",J),()=>window.removeEventListener("termfontchange",J)},[ce,n.fontSize]),C.useEffect(()=>{const J=()=>{const De=!document.hidden&&su();it(De),De&&c&&fa("visibility")},Qe=De=>{c&&fa(De.persisted?"bfcache":"pageshow")},mt=()=>{Y(!0),fa("window-focus")},gt=()=>Y(!1);return document.addEventListener("visibilitychange",J),window.addEventListener(Fm,J),window.addEventListener("pageshow",Qe),window.addEventListener("focus",mt),window.addEventListener("blur",gt),()=>{document.removeEventListener("visibilitychange",J),window.removeEventListener(Fm,J),window.removeEventListener("pageshow",Qe),window.removeEventListener("focus",mt),window.removeEventListener("blur",gt)}},[c,fa]),C.useEffect(()=>{if(!b||!M||!ci.current)return;const J=A,Qe=J<=0,mt=_e.current;if(mt?.token===b&&(mt.visible||!Qe))return;const gt=()=>{_e.current={token:b,visible:Qe},at.current?.requestRefresh(w,{skipScrollToBottom:!0}),Zo(J>0?"global-resume-background":"global-resume-visible",J<=0&&k,Qe)};if(J<=0){gt();return}const De=window.setTimeout(gt,J);return()=>window.clearTimeout(De)},[b,w,M,A,k,Zo]);const us=C.useRef(0);C.useEffect(()=>{if(be){us.current=0;return}if(!we||In==="Authentication required"||In===Xd)return;const J=us.current,Qe=Math.min(2e3*Math.pow(2,Math.min(J,4)),3e4),mt=setTimeout(()=>{us.current+=1,re("[Terminal] fatal self-heal: auto restarting ensureSession",{attempt:us.current,backendSessionId:Tt.current}),cn("Reconnecting..."),Pe(!1),Is()},Qe);return()=>clearTimeout(mt)},[In,we,be,At,re,Is]),C.useEffect(()=>{if(typeof window>"u"){Ee(!1);return}const J=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;Ee(J)},[]),C.useEffect(()=>{(!c||!fe)&&Ke(!1),c||tt(!1)},[c,fe]),C.useEffect(()=>{Tt.current=zr,Bs.current=-1,Me.current=null,Pr.current=null,Jr.current=null,Vr.current=null},[zr]),C.useEffect(()=>{Q?.(ce,be)},[be,Q,ce]),C.useEffect(()=>{V?.(ce,be&&le&&je)},[le,je,be,V,ce]),C.useEffect(()=>{Sr||(fs.current=!1,On.current=null,ls.current&&(clearTimeout(ls.current),ls.current=null))},[Sr]),C.useEffect(()=>{zr&&at.current?.requestRefresh("session-key-change",{force:!0})},[zr]),C.useEffect(()=>{const J=c&&fe&&Bt;Ue("visibility signal",{sessionId:ce,isActive:c,isMobile:fe,isInputFocused:ee,isViewportKeyboardOpen:Bt,viewportKeyboardHeight:Wt,visible:J}),$?.(ce,J)},[$,ce,c,fe,Bt,Wt,Ue]),C.useEffect(()=>{c&&x&&x!==Os.current&&(Os.current=x,un())},[x,un,c]),C.useEffect(()=>{fr.current=ce},[ce]),C.useEffect(()=>{!fe&&(lr!==null||Jt!==null)&&(ur(null),Er(null),ii.current=null)},[fe,lr,Jt]),C.useEffect(()=>{!zr&&(lr!==null||Jt!==null)&&(ur(null),Er(null),ii.current=null)},[zr,lr,Jt]),C.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(C2,X?"true":"false")},[X]),C.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(S2,We)},[We]),C.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(_2,It)},[It]),C.useEffect(()=>{$e(Yf());const J=()=>{$e(Yf())};return window.addEventListener("resize",J),()=>window.removeEventListener("resize",J)},[]);const Cn=C.useCallback(()=>{$n.current+=1,U.current+=1,ks(),Ci();const J=tr.current;tr.current=null,vt.current=null,Ut.current=!1,ut(!1),at.current?.setSessionReady(!1);const Qe=Tt.current;Qe&&jm(Qe,!1,"stream-disconnect"),Rr.current=!1,Vr.current=null,Nn.current=[],J?.()},[Ci,ks]),ma=C.useCallback(async J=>{if(vt.current===J){re(`[startStream] Skipping - already connected to ${J}`);return}re(`[startStream] Starting stream for frontendSessionId=${ce} backendSessionId=${J}`),Nt(null),Pt.current+=1,ne.current=!1,me.current=null,pe(!1),xt(!1),Cn();const Qe=$n.current+1;$n.current=Qe,Ut.current=!0;const mt=Hr.getState().getTerminalSession(ce);if(mt?.mode==="shell"&&!mt.bufferChunks.length){const De=await Promise.race([M7(J),new Promise(yt=>window.setTimeout(()=>yt(null),75))]);if($n.current!==Qe||fr.current!==ce)return;if(De&&!Hr.getState().getTerminalSession(ce)?.bufferChunks.length){Hr.getState().replaceBuffer(ce,[De.data]);const yt=at.current?.getDimensions();yt?.cols===De.cols&&yt.rows===De.rows&&D7(J,De.seq,De.epoch)}}const gt=Ie.connect(J,{onEvent:De=>{if($n.current!==Qe)return;const yt=ce;if(yt)switch(De.type){case"connected":{U.current+=1,Ut.current=!1;const pr=K.current;pr&&(la("info","PWA_RESUME terminal-connected",{frontendSessionId:yt,backendSessionId:Tt.current,durationMs:Date.now()-pr.startedAt,strategy:pr.strategy,reason:pr.reason}),K.current=null),j?.(yt),(De.runtime||De.ptyBackend)&&re(`[Terminal] connected frontendSessionId=${yt} backendSessionId=${Tt.current} runtime=${De.runtime??"unknown"} pty=${De.ptyBackend??"unknown"} cwd=${De.cwd??"unknown"}`),on(yt,!1),cn(null),Pe(!1),Nt(null),ut(!0),Tt.current&&(Pm(Tt.current,ja.current,"stream-connected"),Om(Tt.current,li.current,"stream-connected")),at.current?.setSessionReady(!0),Vr.current=null,Si(Rr.current,"stream-connected"),De.tuiProgress!==void 0&&Hr.getState().setSessionTuiProgress(yt,De.tuiProgress??null),De.shellTitle!==void 0&&Hr.getState().setSessionShellTitle(yt,De.shellTitle??null),De.promptState!==void 0&&De.promptState!==null&&Hr.getState().setSessionPromptState(yt,De.promptState);const Qr=Hr.getState().getTerminalSession(yt);if(Qr?.terminalSessionId&&De.mode&&Hr.getState().setTerminalSession(yt,{sessionId:Qr.terminalSessionId,cols:80,rows:24,mode:De.mode,tmuxSessionName:De.tmuxSessionName??null,cwd:De.cwd??null}),De.activeProgram!==void 0&&kn(yt,De.activeProgram??null,De.activeProgramSource??null,De.activeProgramRaw??null),at.current?.requestRefresh("connected",{force:!0,reconcileServerSize:Ae.current}),De.mode!=="tmux"&&(_r(null),rn(yt,!1)),re("[Terminal] Connected event received:",{frontendSessionId:yt,backendSessionId:Tt.current,storeHasState:!!Qr,storeTerminalId:Qr?.terminalSessionId,hasHistoryInStore:!!Qr?.history?.length,historyLength:Qr?.history?.length??0}),Qr?.history&&Qr.history.length>0){re(`[Terminal] Restoring ${Qr.history.length} history chunks to frontend session ${yt}`);const O=Qr.history.reduce((Ne,Te)=>Ne+Te.length,0),z=Math.max(300,Math.min(2e3,Math.ceil(O/200)));nn.current=Date.now()+z,Qr.history.forEach(Ne=>{An(yt,Ne,{markActivity:!1})}),Hr.getState().setSessionHistory(yt,[]),re(`[Terminal] History restoration complete for ${yt}`)}else re(`[Terminal] No history to restore for ${yt}`);const L=De.replayChunks,B=!!Qr?.history?.length||!!L?.length;if(B?ne.current=!0:ss(),L&&L.length>0){let O=null;if(De.replayOutOfWindow)re(`[Terminal] Replay out-of-window, atomically replacing buffer (${L.length} chunks)`),O=jn(yt,bT(L));else{re(`[Terminal] Replay incremental: ${L.length} chunks`);for(const Te of L)An(yt,Te)}const z=L.reduce((Te,Xe)=>Te+Xe.length,0),Ne=Math.max(200,Math.min(1500,Math.ceil(z/200)));nn.current=Math.max(nn.current,Date.now()+Ne),me.current=O}B&&me.current===null&&(me.current=Hr.getState().flushPendingBufferWrites(yt),me.current===null&&(ne.current=!1,ss()));break}case"reconnecting":{Nt(pr=>pr??Date.now()),cn("Reconnecting..."),Pe(!1);break}case"data":{De.data&&(Rr.current?Nn.current.push(De.data):An(yt,De.data));break}case"tmux-layout":{_r(De.layout??null),De.layout&&rn(yt,De.layout.inCopyMode);break}case"tmux-screen-sync":{const pr=De.generation??0;if(pr<Bs.current)break;Bs.current=pr,Pt.current+=1,ne.current=!0,pe(!1),Nn.current=[],at.current?.prepareScreenReplacement(),Me.current=pr,me.current=jn(yt,yT(De.chunks??[])),me.current===null&&(Me.current=null,at.current?.notifyScreenSynchronized(pr),ne.current=!1,ss()),typeof De.cols=="number"&&typeof De.rows=="number"&&at.current?.notifyServerSize(De.cols,De.rows,"tmux-screen-sync");break}case"active-program":{kn(yt,De.activeProgram??null,De.activeProgramSource??null,De.activeProgramRaw??null);break}case"cwd":{Tn(yt,De.cwd??null);break}case"agent-status":{Dr(yt,{agentStatus:De.agentStatus??null,agentIndicator:De.agentIndicator??null,agentStatusDetail:De.agentStatusDetail??null,agent:De.agent??null,agentMessage:De.agentMessage??null,agentNativeSessionId:De.agentNativeSessionId??null,agentResumeRecovered:De.agentResumeRecovered===!0,agentRich:De.agentRich===!0,agentActivity:De.agentActivity??0,agentCwd:De.agentCwd??null,reviewed:De.reviewed??null});break}case"git-status":{Hr.getState().setSessionGitStatus(yt,De.gitStatus??null);break}case"focus-mode":{re("[Terminal] focus tracking mode",{backendSessionId:Tt.current,requested:De.focusTrackingRequested===!0});break}case"resize-ack":{at.current?.acknowledgeResize({seq:De.seq,ok:De.ok!==!1,cols:De.cols,rows:De.rows,screenSyncPending:De.screenSyncPending,screenSyncGeneration:De.screenSyncGeneration});break}case"pty-size":{typeof De.cols=="number"&&typeof De.rows=="number"&&at.current?.notifyServerSize(De.cols,De.rows,De.source);break}case"shell-title":{Ba(yt,De.title??null);break}case"prompt-state":{Mt(yt,De.state??"idle",De.exitCode??null);break}case"tui-progress":{Hr.getState().setSessionTuiProgress(yt,De.tuiProgress??null);break}case"exit":{const pr=typeof De.exitCode=="number"?De.exitCode:null,Qr=typeof De.signal=="number"?De.signal:null;An(yt,`\r
|
|
69
|
-
[Process exited${pr!==null?` with code ${pr}`:""}${Qr!==null?` (signal ${Qr})`:""}]\r
|
|
70
|
-
`),Gn(yt),on(yt,!1),cn("Terminal session ended"),ut(!1),Pe(!1),Nt(null),_r(null),rn(yt,!1),Cn();break}}},onError:(De,yt)=>{if($n.current!==Qe)return;const pr=ce;if(!pr)return;Ut.current=!1;const Qr=yt&&De.message==="Authentication required",L=A2(De),B=Qr?De.message:L||yt?"Reconnecting...":De.message||"Terminal stream connection error";console.error(`[Terminal] Stream error (fatal=${yt}):`,B),L&&console.warn("[Terminal] SESSION_NOT_FOUND_DETECTED",{terminalIdAtError:Tt.current,frontendSessionId:pr,isActive:c,isMobile:fe,fatal:yt,stack:new Error().stack}),cn(B),Pe(!!yt),yt&&(Nt(null),on(pr,!1),Cn(),L&&(re("[onError] Session lost, auto-recreating"),cn("Reconnecting..."),Pe(!1),Gn(pr),hn(pr),Tt.current=null,Xn.current=!1,Is()))}},{...Xk,getDimensions:()=>at.current?.getDimensions()??null});tr.current=()=>{gt.close(),$n.current===Qe&&(vt.current=null)},vt.current=J},[An,hn,Gn,re,Cn,ss,j,Si,Is,Ba,on,kn,Dr,rn,Tn,Mt,Ie,ce]);C.useEffect(()=>{const J=Fk({isActive:c,isStreamReady:be,reconnectStartedAt:lt,now:Date.now()});if(J===null)return;const Qe=window.setTimeout(()=>{re("[Terminal] visible reconnect watchdog expired",{backendSessionId:Tt.current,reconnectStartedAt:lt}),Cn(),on(ce,!1),cn("Reconnecting..."),Pe(!1),Nt(Date.now()),Is()},J);return()=>window.clearTimeout(Qe)},[re,Cn,c,be,lt,Is,ce,on]);const Xn=C.useRef(!1),ci=C.useRef(!1),_i=C.useRef(0);C.useEffect(()=>()=>{_i.current+=1,Xn.current=!1,Cn()},[Cn]);const Zi=C.useRef(Gr),Pa=C.useRef(qn);C.useEffect(()=>{const J=Zi.current,Qe=Pa.current;Zi.current=Gr,Pa.current=qn,fr.current===ce&&(J===Gr&&Qe===qn||(Xn.current=!1,Cn(),ct(mt=>mt+1)))},[Gr,qn,Cn,ce]),C.useEffect(()=>{if(fr.current!==ce&&(re(`[useEffect] sessionId changed from ${fr.current} to ${ce}, allowing reinitialization`),Xn.current=!1,ci.current=!1),Xn.current&&fr.current===ce){re(`[useEffect] Already initialized for sessionId=${ce}, skipping`);return}if(!dt)return;const J=async yt=>{if(re(`[ensureSession] Starting for sessionId=${ce}, runId=${yt}`),!fr.current||fr.current!==ce){re(`[ensureSession] SessionId mismatch or stale run (current=${fr.current}, target=${ce}), skipping`);return}if(yt!==_i.current){re(`[ensureSession] Stale run detected (runId=${yt}, currentRunId=${_i.current}), skipping`);return}const pr=Hr.getState(),Qr=pr.getTerminalSession(ce),L=Qr?.mode??Gr;re("[ensureSession] Current state from store:",{terminalSessionId:Qr?.terminalSessionId,mode:Qr?.mode,tmuxSessionName:Qr?.tmuxSessionName,isConnecting:Qr?.isConnecting});let B=Qr?.terminalSessionId??null,O=!B;if(B&&L!==Gr?(re(`[ensureSession] Store mode mismatch for ${B}: current=${L} desired=${Gr}, will create new session`),O=!0,pr.clearTerminalSession(ce),B=null):B&&Gr==="tmux"&&qn&&Qr?.tmuxSessionName!==qn&&(re(`[ensureSession] Store tmux name mismatch for ${B}: current=${Qr?.tmuxSessionName} desired=${qn}, will create new session`),O=!0,pr.clearTerminalSession(ce),B=null),B&&Ie.checkHealth&&!Ae.current){re(`[ensureSession] Checking health of existing session ${B}`);try{const z=await Ie.checkHealth(B);if(re("[ensureSession] Health check result:",z),!z.healthy)re(`[ensureSession] Session ${B} is NOT healthy (healthy=${z.healthy}), will create new session`),re("[ensureSession] Health check details:",z),O=!0,z.mode&&Qr?.terminalSessionId&&pr.setTerminalSession(ce,{sessionId:Qr.terminalSessionId,cols:80,rows:24,mode:z.mode,tmuxSessionName:z.tmuxSessionName??null}),pr.clearTerminalSession(ce),re("[ensureSession] Cleared unhealthy session from store");else{re(`[ensureSession] Session ${B} is healthy, reusing it, cwd=${z.cwd}, clients=${z.clients}, lastActivity=${Date.now()-(z.lastActivity||0)}ms ago`),z.mode&&Qr?.terminalSessionId&&pr.setTerminalSession(ce,{sessionId:Qr.terminalSessionId,cols:80,rows:24,mode:z.mode,tmuxSessionName:z.tmuxSessionName??null}),re(`[ensureSession] Setting terminalIdRef to ${B} and starting stream`),Tt.current=B,ma(B),re(`[ensureSession] Successfully reused healthy session ${B}, returning early`);return}}catch(z){re(`[ensureSession] Failed to check health of session ${B}:`,z),re("[ensureSession] Health check API call failed, proceeding as if session might be unhealthy")}}if(re(`[ensureSession] Decision: shouldCreateNewSession=${O}, terminalId=${B}`),O){re(`[ensureSession] Creating new session, shouldCreateNewSession=${O}, runId=${yt}`),cn(null),Pe(!1),pr.setConnecting(ce,!0);const Ne=Hr.getState().getTerminalSession(ce),Xe=(Ne?.mode??Gr)===Gr&&(Gr!=="tmux"||!qn||Ne?.tmuxSessionName===qn);if(Ne?.terminalSessionId&&Xe)re(`[ensureSession] Race condition avoided: another instance already created session ${Ne.terminalSessionId}`),pr.setConnecting(ce,!1),B=Ne.terminalSessionId,O=!1;else try{const nt=await lo();if(re(`[ensureSession] Opened managed backend session ${nt.sessionId}`),yt!==_i.current){re(`[ensureSession] Stale run after session creation (runId=${yt}, currentRunId=${_i.current}), leaving ${nt.sessionId} for sibling`);return}pr.setTerminalSession(ce,nt),re(`[ensureSession] Updated store with new session ${nt.sessionId}`),B=nt.sessionId}catch(nt){if(yt!==_i.current){re("[ensureSession] Stale run after session creation failed, skipping error handling");return}if(nt instanceof pf&&Jp(nt)){re("[ensureSession] Confirmed missing persisted session:",{sessionId:ce,error:nt.message}),pr.clearTerminalSession(ce),cn(Xd),Pe(!0),pr.setConnecting(ce,!1);return}cn("Reconnecting..."),Pe(!0),pr.setConnecting(ce,!1);return}}if(yt!==_i.current){re(`[ensureSession] Stale run before starting stream (runId=${yt}, currentRunId=${_i.current}), skipping`);return}if(!B){re(`[ensureSession] No terminalId, terminalId=${B}`);return}re(`[ensureSession] Starting stream for session ${B}`),Tt.current=B,ma(B),re(`[ensureSession] ensureSession completed for sessionId=${ce}, terminalId=${B}`)};let Qe=null,mt=null;const gt=()=>{mt=null,!(Xn.current&&fr.current===ce)&&(re(`[useEffect] Running ensureSession for sessionId=${ce}, hasInitialized=${Xn.current}`),Xn.current=!0,ci.current=!0,Qe=++_i.current,J(Qe))};if(!I&&!ci.current){re(`[useEffect] Holding background connection until the selected session is ready: ${ce}`);return}const De=ci.current?0:Math.max(0,E);return De>0?(re(`[useEffect] Delaying initial connection for sessionId=${ce} by ${De}ms`),mt=window.setTimeout(gt,De)):gt(),()=>{mt!==null&&window.clearTimeout(mt),re(`[useEffect] Cleanup for sessionId=${ce}, runId=${Qe??"pending"}`)}},[ce,At,ma,Cn,Ie,re,Gr,qn,Ye,E,I,dt]);const Oa=C.useCallback(async()=>{if(ce&&!Ge){ve(!0),cn(null),Pe(!1),Nt(null),Cn();try{Ie.forceKill&&await Ie.forceKill({sessionId:ce})}catch{}Pn(ce),hn(ce),at.current?.clear(),await new Promise(J=>setTimeout(J,100));try{on(ce,!0);const J=await lo();Wr(ce,J),Tt.current=J.sessionId,ma(J.sessionId)}catch(J){cn(J instanceof pf&&Jp(J)?Xd:"Reconnecting..."),Pe(!0),on(ce,!1)}finally{ve(!1)}}},[ce,Ge,Cn,Ie,Pn,hn,on,Wr,ma,lo]),uo=C.useCallback((J,Qe,mt,gt)=>{if(!(Tt.current!==Qe||U.current!==mt)){if(J instanceof pf&&A2(J)){re("[Terminal] operation backend missing, recovering",{terminalId:Qe,sessionId:ce}),cn("Reconnecting..."),Pe(!1),Cn(),Gn(ce),Tt.current=null,on(ce,!0),Is();return}cn(J instanceof Error?J.message:gt)}},[Gn,re,Cn,Is,ce,on]),ml=C.useCallback((J,Qe)=>{if(!Ae.current&&!Qe?.targeted||!J)return;const mt=ok(J),gt=/^(\x1b\[<6[45];[0-9]+;[0-9]+M)+$/.test(J);if(Sr&>&&(fs.current=!0),Date.now()<nn.current)return;let De=J,yt=Qe?.consumeModifier??!1;if(!Qe?.skipModifierTransform&&lr&&J.length>0){const O=J[0];if(O.length===1&&/[a-zA-Z]/.test(O)){const z=O.toUpperCase();lr==="ctrl"?(De=String.fromCharCode(z.charCodeAt(0)&31),yt=!0):lr==="alt"&&(De=`\x1B${J}`,yt=!0)}yt||(lr==="alt"&&(De=`\x1B${J}`),yt=!0)}const pr=Tt.current;if(!pr)return;const Qr=U.current,B=(async()=>{try{if(Sr&&!mt&&fs.current&&Ie.tmuxAction){fs.current=!1;try{await Ie.tmuxAction(pr,{action:"copy-mode",enabled:!1})}catch{}if(Tt.current!==pr||U.current!==Qr)return!1;if(lk(De))return!0}return await Ie.sendInput(pr,De),q(ce),!0}catch(O){return uo(O,pr,Qr,"Failed to send input"),!1}})();return yt&&(Jt||ur(null),un()),B},[lr,q,un,uo,Sr,Jt,ce,Ie]);C.useEffect(()=>{const J=Qe=>{const mt=Qe,gt=mt.detail?.sessionId;if(gt?gt!==ce:!Ae.current)return;const De=mt.detail?.text;if(!De)return;const yt=mt.detail?.nonce;if(H.current||!at.current){yt&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:yt,ok:!1}}));return}const pr=at.current?.sendSequence(De,{paste:mt.detail?.paste,targeted:!!gt});yt&&Promise.resolve(pr).then(Qr=>{window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:yt,ok:Qr===!0}}))},()=>{window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:yt,ok:!1}}))}),JA(pt.current,mt.detail?.focus!==!1)&&un()};return window.addEventListener("termdock-insert-reference",J),()=>window.removeEventListener("termdock-insert-reference",J)},[un,ce]);const Ko=C.useCallback((J,Qe,mt)=>{const gt=Tt.current;if(!gt){Ue("xterm resize push skipped: no terminalId",{cols:J,rows:Qe});return}Ue("xterm resize push",{cols:J,rows:Qe}),Ie.resize({sessionId:gt,cols:J,rows:Qe,seq:mt}).catch(De=>{at.current?.acknowledgeResize({seq:mt,ok:!1}),De&&/session not found/i.test(String(De.message||De))&&console.warn("[Terminal] resize 404 session not found",{sessionId:gt,cols:J,rows:Qe,stack:new Error().stack})})},[Ie,Ue]),Io=C.useCallback(async J=>{const Qe=Tt.current;if(!Qe||!Ie.tmuxAction)return;const mt=U.current;try{const gt=await Ie.tmuxAction(Qe,J);if(Tt.current!==Qe||U.current!==mt)return;gt.layout&&(_r(gt.layout),J.action==="switch-session"&&(Wr(ce,{sessionId:Qe,cols:80,rows:24,mode:"tmux",tmuxSessionName:gt.layout.sessionName}),B7(ce,{tmuxSessionName:gt.layout.sessionName}).catch(De=>{console.warn("[Terminal] failed to update inventory after tmux switch",De)})))}catch(gt){uo(gt,Qe,mt,"Failed to execute tmux action")}},[uo,ce,Wr,Ie]);C.useEffect(()=>{if(!_t||!zr)return;const Qe=_t.windows.find(mt=>mt.id===_t.activeWindowId)?.panes.find(mt=>mt.id===_t.activePaneId);Qe&&at.current?.requestRefresh("tmux-layout",{skipScrollToBottom:!0,dedupeKey:`${zr}:${_t.sessionId}:${Qe.id}:${Qe.width}x${Qe.height}`})},[_t,zr]);const Fs=C.useCallback((J,Qe=5)=>{const mt=Math.max(1,Math.min(Math.floor(Qe)||1,40));fs.current=!0;const gt=On.current;if(gt&>.direction===J){gt.lines+=mt;return}gt&&Io({action:"scroll",direction:gt.direction,lines:gt.lines}).finally(()=>{un()}),On.current={direction:J,lines:mt},ls.current&&clearTimeout(ls.current),ls.current=setTimeout(()=>{const De=On.current;De&&(On.current=null,Io({action:"scroll",direction:De.direction,lines:De.lines}).finally(()=>{un()}))},0)},[un,Io]),Eo=C.useCallback(J=>{const Qe=Date.now(),mt=ii.current,gt=mt!==null&&mt.modifier===J&&Qe-mt.timestamp<=qk;if(ii.current={modifier:J,timestamp:Qe},Jt===J){Er(null),ur(null);return}if(gt){Er(J),ur(J);return}Jt!==null&&Jt!==J&&Er(null),ur(De=>De===J?null:J)},[Jt]),ga=C.useCallback(J=>{if(tt(J&&Ae.current),Ue("input focus changed",{focused:J,isActive:Ae.current,isMobile:pt.current}),!pt.current||!Ae.current){Ke(!1);return}Ke(Qe=>Qe===J?Qe:J)},[Ue]),xa=C.useCallback(J=>{if(Rr.current=J,Si(J,"viewport-watermark"),!J&&Nn.current.length>0){const Qe=ce;if(Qe){const mt=Nn.current;Nn.current=[];for(const gt of mt)An(Qe,gt)}}},[An,Si,ce]),ba=C.useCallback(J=>{Ae.current&&at.current?.ensureSizeMatches(J)},[]),ps=C.useRef(null);C.useEffect(()=>{if(!c)return;const J=ps.current;if(!J)return;const Qe=()=>ba("pointerdown"),mt=()=>ba("keydown"),gt=()=>ba("touchstart"),De=()=>ba("wheel");return J.addEventListener("pointerdown",Qe),J.addEventListener("keydown",mt),J.addEventListener("touchstart",gt,{passive:!0}),J.addEventListener("wheel",De,{passive:!0}),()=>{J.removeEventListener("pointerdown",Qe),J.removeEventListener("keydown",mt),J.removeEventListener("touchstart",gt),J.removeEventListener("wheel",De)}},[c,ba]);const Li=C.useCallback(J=>{at.current=J},[]),ho=C.useCallback(J=>{Dt(J),F?.(ce,J)},[F,ce]),fo=C.useCallback(J=>{const Qe=gk(J);if(!Qe)return;const mt=lr!==null;at.current?.sendSequence(Qe,{consumeModifier:mt})},[lr]),po=C.useCallback(J=>{const Qe=dk(J);if(Qe.length===0)return;const mt=lr!==null;at.current?.sendSequence(b2(Qe[0]),{consumeModifier:mt});for(let gt=1;gt<Qe.length;gt+=1){const De=Qe[gt];window.setTimeout(()=>{at.current?.sendSequence(b2(De))},uk*gt)}},[lr]),$s=C.useCallback(()=>{at.current?.pasteClipboardText()},[]),Us=C.useCallback(J=>{xs.current!==null&&(window.clearTimeout(xs.current),xs.current=null),He(J),(J==="inserted"||J==="failed")&&(xs.current=window.setTimeout(()=>{xs.current=null,He("idle")},1400))},[]),No=C.useCallback(()=>{Us("idle"),Ve(0),Mi.current?.click()},[Us]),Yn=C.useCallback(()=>{Ln(!0)},[]),is=C.useCallback(J=>{const Qe=J.currentTarget.files?.[0];if(J.currentTarget.value="",!Qe)return;jr(null),Br(null),Ve(0),Us("uploading");const mt=kt&&Qe.type.startsWith("video/")?{maxHeight:ue,videoBitrate:Nr,onProgress:Ve}:null,gt=st&&Zk(Qe)?{maxDimension:Gt,quality:Ur}:null;let De=mt?"视频压缩":gt?"图片压缩":"文件上传";(async()=>{const yt=mt?await(await $d(async()=>{const{compressVideoLocally:pr}=await import("./videoCompression-VZIoFnyJ.js");return{compressVideoLocally:pr}},__vite__mapDeps([0,1,2,3,4,5]))).compressVideoLocally(Qe,mt):gt?await(await $d(async()=>{const{compressImageLocally:pr}=await import("./imageCompression-DaUBNTq-.js");return{compressImageLocally:pr}},[])).compressImageLocally(Qe,gt):Qe;De="文件上传",await p3(yt,(pr,Qr)=>Bu(pr,Qr,void 0,Ve),pr=>{if(De="插入终端",!Ae.current||H.current)throw new Error(`终端暂不可用,文件已上传至 ${pr}`);window.dispatchEvent(new CustomEvent("termdock-insert-reference",{detail:{text:f3(pr,null),focus:!0}}))}),(mt||gt)&&Br({file:yt,kind:mt?"video":"image",originalSize:Qe.size,uploadedSize:yt.size,originalRetained:yt===Qe})})().then(()=>Us("inserted"),yt=>{const pr=L2(yt);jr({stage:De,detail:pr}),Ln(!0),Us("failed"),la("warn","MOBILE_MEDIA_UPLOAD failed",{stage:De,detail:pr})})},[Nr,kt,ue,st,Gt,Ur,Us]);C.useEffect(()=>{if(!gn||!kt)return;let J=!0;return Ts(null),sr({phase:"checking-cache"}),$d(async()=>{const{prepareLocalVideoCompression:Qe}=await import("./videoCompression-VZIoFnyJ.js");return{prepareLocalVideoCompression:Qe}},__vite__mapDeps([0,1,2,3,4,5])).then(({prepareLocalVideoCompression:Qe})=>{if(J)return Qe(mt=>{J&&sr(mt)})}).catch(Qe=>{J&&Ts(L2(Qe))}),()=>{J=!1}},[gn,kt]);const ui=ln||In!==null;H.current=ui;const Di=C.useRef(Et);ui||(Di.current=Et);const Bi=ui?Di.current:Et,zs=C.useMemo(()=>hk(Bi,hr),[Bi,hr]),mo=C.useMemo(()=>v2(hr,We),[We,hr]),Hs=!fe&&We!=="auto"&&mo.id!=="default"&&mo.showOnDesktop!==!0?"auto":We,di=Hs==="auto"?zs:Hs,Kr=C.useMemo(()=>v2(hr,di),[di,hr]),ya=C.useMemo(()=>Kr.actions.filter(J=>J.sequence.trim().length>0).map((J,Qe)=>({...J,label:Xp(J,Qe)})),[Kr.actions]),Ws=C.useMemo(()=>a3(Et),[Et]),Ki=Kr.label,va=C.useMemo(()=>Hs!=="auto"?`Manual preset: ${Kr.label}`:Ws?`Auto preset · ${Kr.label} (${Ws})`:"Auto preset",[Ws,Hs,Kr.label]),wa=C.useCallback(J=>{Qt(J)},[]),hi=C.useCallback(()=>{ar(J=>J==="copy"?"arrows":"copy"),Fe("idle")},[]),Xi=C.useCallback(()=>{typeof window>"u"||(Rn.current!==null&&window.clearTimeout(Rn.current),Rn.current=window.setTimeout(()=>{Rn.current=null,Fe("idle")},1200))},[]),Cs=C.useCallback(J=>{Rn.current!==null&&typeof window<"u"&&(window.clearTimeout(Rn.current),Rn.current=null),Fe(J?"copied":"failed"),Xi()},[Xi]),Aa=C.useCallback(J=>{Re(J)},[]),Fa=C.useMemo(()=>fe?fk(hr):pk(hr),[fe,hr]),Jn=C.useMemo(()=>Q7(i),[i]);C.useEffect(()=>{if(!Sr||!be||!dt||!zr)return;const J=vT(Jn);J&&Ie.sendInput(zr,J).catch(Qe=>{console.warn("[Terminal] Failed to synchronize tmux default colors:",Qe)})},[Sr,be,dt,zr,Ie,Jn]);const ms=C.useMemo(()=>`terminal::${ce}`,[ce]);C.useEffect(()=>{Oe?.({isConnecting:ln,isRestarting:Ge,hasError:!!In,sessionId:zr})},[ln,Ge,In,zr,Oe]);const Ta=!zr||ln||Ge,Xo=C.useCallback((J,Qe)=>{if(Ta)return;const mt=Math.max(1,Math.min(Math.floor(Qe)||1,40));Fs(J,mt)},[Fs,Ta]);C.useEffect(()=>{if(!c||!fe)return;at.current?.requestRefresh("resize",{skipScrollToBottom:!Bt,force:!0})},[c,fe,Bt,Wt,ce]),C.useEffect(()=>{if(!c||!fe)return;const J=Qe=>{const mt=Qe.detail;at.current?.requestRefresh("resize",{skipScrollToBottom:mt?.isOpen!==!0,force:!0})};return document.addEventListener("termdock:viewport-keyboard-change",J),()=>{document.removeEventListener("termdock:viewport-keyboard-change",J)}},[c,fe,ce]);const Qi=!te&&(fe||Kr.id==="default"||Kr.showOnDesktop===!0),go=c,$a=fe&&!qe?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,Jo=fe&&!qe?{marginTop:"var(--kb-margin-top, 0px)",transition:"none"}:void 0,Ua=a.jsx(xk,{visible:Qi,interactive:go,presentation:fe?"mobile":"desktop-actions",activeModifier:lr,lockedModifier:Jt,disabled:Ta,defaultShowExtended:X,presetLabel:Ki,presetModeLabel:va,presetMode:Hs,presetOptions:Fa,includeAlt:Kr.includeAlt,presetRowLayout:Kr.rowLayout,extraActions:ya,onKeyPress:fo,onTextPress:po,onPastePress:fe?$s:void 0,onFilePress:fe?No:void 0,onFileLongPress:fe?Yn:void 0,fileUploadState:yr,fileUploadProgress:Se,longPressMode:It,copyFeedback:Ot,onLongPressModeToggle:hi,onModifierToggle:Eo,onPresetSelect:wa,onExpandedChange:Aa}),Ca=typeof window<"u"&&(navigator.maxTouchPoints>0||"ontouchstart"in window);return a.jsxs("div",{className:"relative flex h-full min-h-0 flex-col overflow-hidden",style:$a,children:[a.jsx("input",{ref:Mi,type:"file",className:"hidden",onChange:is}),gn&&Ai.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop cursor-default bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:()=>Ln(!1),"aria-label":et("common.close")}),a.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"mobile-video-compression-title",className:"fixed bottom-[max(0.75rem,env(safe-area-inset-bottom,0px))] left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] z-modal-panel max-h-[calc(100dvh-1.5rem)] overflow-y-auto rounded-2xl border border-border/15 bg-surface p-4 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:left-1/2 sm:right-auto sm:w-[min(28rem,calc(100vw-2rem))] sm:-translate-x-1/2",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h2",{id:"mobile-video-compression-title",className:"text-sm font-semibold text-foreground",children:"本地媒体压缩"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"按文件类型选择压缩方式,处理完成后才上传。"})]}),a.jsx("button",{type:"button",className:"min-h-10 rounded-lg bg-surface-2 px-3 text-xs",onClick:()=>Ln(!1),children:et("common.close")})]}),Ct&&a.jsxs("div",{role:"alert",className:"mt-3 rounded-lg bg-destructive/10 p-3 text-xs text-destructive",children:[a.jsxs("p",{children:[Ct.stage,"失败。",Ct.stage.endsWith("压缩")?"原文件未上传。":Ct.stage==="插入终端"?"文件已上传,路径见详情。":""]}),a.jsxs("details",{className:"mt-2",children:[a.jsx("summary",{className:"cursor-pointer",children:"错误详情"}),a.jsx("p",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words",children:Ct.detail})]})]}),St&&a.jsx("p",{className:"mt-2 text-[11px] text-destructive",children:"本机未能保存设置,重新打开后可能恢复默认值。"}),a.jsxs("label",{className:"mt-4 flex min-h-11 items-center justify-between rounded-xl bg-surface-elevated px-3 text-sm",children:[a.jsx("span",{children:"压缩图片后上传"}),a.jsx("input",{type:"checkbox",checked:st,onChange:J=>ke({imageEnabled:J.target.checked}),className:"h-4 w-4 accent-primary"})]}),st&&a.jsxs("div",{className:"mt-3 space-y-3",children:[a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["图片最长边",a.jsx("select",{value:Gt,onChange:J=>ke({imageMaxDimension:Number(J.target.value)}),className:"mt-1 block min-h-10 w-full rounded-lg bg-surface-2 px-3 text-sm text-foreground",children:m3.map(J=>a.jsxs("option",{value:J,children:[J," px",J===640?" · 最省流量":J===2048?" · 推荐":J===4096?" · 保留更多细节":""]},J))})]}),a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["图片画质:",Math.round(Ur*100),"%",a.jsx("input",{type:"range",min:hu.min,max:hu.max,step:hu.step,value:Ur,onChange:J=>ke({imageQuality:Number(J.target.value)}),className:"mt-2 h-1 w-full accent-primary"})]}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"支持 JPEG、PNG、HEIC 照片;GIF、SVG 等保持原文件。压缩后未变小也会保留原图。"})]}),a.jsx("div",{className:"mt-4 border-t border-border/15 pt-1"}),a.jsxs("label",{className:"mt-4 flex min-h-11 items-center justify-between rounded-xl bg-surface-elevated px-3 text-sm",children:[a.jsx("span",{children:"压缩视频后上传"}),a.jsx("input",{type:"checkbox",checked:kt,onChange:J=>ke({videoEnabled:J.target.checked}),className:"h-4 w-4 accent-primary"})]}),kt&&a.jsxs("div",{className:"mt-4 space-y-4",children:[a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["视频最长边(像素)",a.jsx("select",{value:ue,onChange:J=>ke({videoMaxHeight:Number(J.target.value)}),className:"mt-1 block min-h-10 w-full rounded-lg bg-surface-2 px-3 text-sm text-foreground",children:g3.map(J=>a.jsxs("option",{value:J,children:[J," px",J===240?" · 最省流量":J===720?" · 推荐":J>=1440?" · 手机处理较慢":""]},J))})]}),a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["目标视频码率:",Nr/1e6," Mbps",a.jsx("input",{type:"range",min:fu.min,max:fu.max,step:fu.step,value:Nr,onChange:J=>ke({videoBitrate:Number(J.target.value)}),className:"mt-2 h-1 w-full accent-primary"})]}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"保持比例,不放大原视频。尺寸越小通常处理越快;码率越低体积通常越小,过高可能比原片更大。"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",role:"status","aria-live":"polite",children:yn?"本地转码器准备失败,请关闭开关后重试。":Kk(wn)}),wn?.saved===!1&&a.jsx("p",{className:"text-[11px] text-destructive",children:"本机未能保存转码器,重新打开后可能需要重新下载。"}),yn&&a.jsx("p",{className:"text-[11px] text-destructive",children:yn})]})]})]}),document.body),jt&&a.jsx(bk,{isMobile:fe,isInputFocused:ee,isIOS:ze,isConnecting:ln,connectionError:In,terminalSessionId:zr}),a.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden",style:{backgroundColor:Jn.background,...Jo},children:[a.jsx("div",{ref:ps,className:"h-full w-full box-border",children:a.jsx(j7,{fallback:a.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:a.jsxs("div",{className:"flex flex-col items-center gap-3 text-center rounded-2xl bg-surface-2 px-6 py-5 shadow-sm",children:[a.jsx("div",{className:"w-10 h-10 rounded-full bg-destructive/15 flex items-center justify-center",children:a.jsx("svg",{className:"w-5 h-5 text-destructive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),a.jsx("span",{className:"text-sm text-muted-foreground",children:et("terminal.componentFailed")})]})}),children:a.jsx(ek,{ref:Li,sessionKey:ms,sessionId:ce,isLayoutVisible:g,chunks:Ir,onInput:ml,onResize:Ko,onFlowControl:xa,onTmuxScroll:Sr?Xo:void 0,tmuxScrollSensitivity:.38,onDoubleTap:fe?()=>{at.current?.sendSequence(" ")}:void 0,onInputFocusChange:ga,onMobileLongPressCopyResult:Cs,onReadyChange:ho,onSizeSynchronizedChange:xt,onWritesSettled:ai,onWriteProgress:pn,onCursorPositionChange:cs,onDirectoryLinkActivate:Vn,terminalSettings:Le,theme:Jn,enableTouchScroll:fe,mobileLongPressMode:It,autoFocus:!h&&!fe&&!Ca,cursorVisible:!h&&Xt,suppressSmoothScroll:!le||!je,className:h||!Xt?"terminal-focus-suspended":void 0},ms)})}),a.jsx(Vk,{result:ft,onDismiss:Wn}),a.jsx(vk,{connectionError:In,isFatalError:we,isRestarting:Ge,isConnecting:ln,onHardRestart:Oa})]}),se?te?null:Ai.createPortal(Ua,se):Ua]})};function eI({session:e,active:t,onActivate:r,onToggleRightSidebar:n}){const{t:i}=Mr(),l=Hr(c=>{const h=c.sessions.get(e.id);return Ho(e,h?.activeProgram??null,h?.cwd??null,void 0,h?.shellTitle??null,h?.promptState??null).primary});return a.jsxs("div",{"data-pane-titlebar":"true",className:"swiper-no-swiping flex h-6 min-h-6 shrink-0 items-center border-b border-border app-chrome-bg",children:[a.jsxs("button",{type:"button","data-split-pane-title":e.id,draggable:!1,onDragStart:c=>c.preventDefault(),"aria-pressed":t,title:`${l} · 拖动标题移动,边缘拆分,中央交换`,onClick:r,className:"split-pane-drag-handle flex h-full min-w-0 cursor-grab active:cursor-grabbing flex-1 items-center gap-1.5 overflow-hidden px-2 text-left text-[12px] font-medium leading-none text-foreground hover:bg-surface focus-visible:outline focus-visible:outline-1 focus-visible:outline-primary focus-visible:-outline-offset-1",children:[a.jsx(ko,{size:11,className:`shrink-0 ${t?"text-primary":"text-muted-foreground"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:l}),a.jsx(Pu,{size:12,"aria-hidden":"true",className:"shrink-0 text-muted-foreground"}),t&&a.jsx("span",{"aria-hidden":"true",className:"h-1 w-1 shrink-0 rounded-full bg-primary"})]}),n&&a.jsx("button",{type:"button",onClick:n,"aria-label":i("tab.explorerTitle"),title:i("tab.explorerTitle"),className:"inline-flex h-full w-7 shrink-0 items-center justify-center text-muted-foreground hover:bg-surface hover:text-foreground focus-visible:outline focus-visible:outline-1 focus-visible:outline-primary focus-visible:-outline-offset-1",children:a.jsx(lb,{size:14})})]})}const tI="termdock:startup:";function zc(e){if(typeof performance>"u"||typeof performance.mark!="function")return;const t=`${tI}${e}`;performance.getEntriesByName(t,"mark").length>0||performance.mark(t)}function k2(e,t){e||Ai.flushSync(t)}const e1="horizontal";function Vc(e){return e<=0?[]:Array.from({length:e},()=>1/e)}function Jd(e,t){if(!Array.isArray(e)||e.length!==t)return Vc(t);const r=e.map(Number);if(r.some(i=>!Number.isFinite(i)||i<=0))return Vc(t);const n=r.reduce((i,l)=>i+l,0);return n<=0?Vc(t):r.map(i=>i/n)}function rI(e){const t=Math.max(1,Math.ceil(Math.sqrt(Math.max(1,e))));return{columns:t,rows:Math.max(1,Math.ceil(Math.max(1,e)/t))}}function nI(e){return e==="horizontal"||e==="vertical"||e==="grid"}function sI(e){if(!Array.isArray(e))return[];const t=new Set,r=new Set,n=[];for(const i of e){if(!i||typeof i!="object")continue;const l=i;if(typeof l.id!="string"||!l.id||r.has(l.id))continue;const c=Array.isArray(l.sessionIds)?l.sessionIds.filter(g=>typeof g=="string"&&!!g&&!t.has(g)):[],h=[...new Set(c)];if(h.length<2)continue;const p=rI(h.length);h.forEach(g=>t.add(g)),r.add(l.id),n.push({id:l.id,...typeof l.name=="string"&&l.name.trim()?{name:l.name.trim().slice(0,80)}:{},sessionIds:h,layout:nI(l.layout)?l.layout:e1,ratios:Jd(l.ratios,h.length),...l.gridColumnRatios!==void 0?{gridColumnRatios:Jd(l.gridColumnRatios,p.columns)}:{},...l.gridRowRatios!==void 0?{gridRowRatios:Jd(l.gridRowRatios,p.rows)}:{}})}return n}function iI(e,t){const r=new Set(t);return e.flatMap(n=>{const i=n.sessionIds.filter(l=>r.has(l));return i.length<2?[]:[{...n,sessionIds:i,ratios:i.length===n.sessionIds.length?Jd(n.ratios,i.length):Vc(i.length)}]})}function Su(e,t){if(t)return e.find(r=>r.sessionIds.includes(t))}function Zf(e,t,r){if(!t||!r||t===r)return e;const n=Su(e,t),i=Su(e,r);if(n&&n.id===i?.id)return e;const l=[...n?.sessionIds??[t],...i?.sessionIds??[r]],c=[...new Set(l)],h={id:n?.id??`split:${t}`,...n?.name?{name:n.name}:{},sessionIds:c,layout:c.length>2&&(!n||n.layout===e1)?"grid":n?.layout??e1,ratios:Vc(c.length)},p=new Set([n?.id,i?.id].filter(Boolean)),g=e.filter(b=>!p.has(b.id)),x=n?Math.max(0,e.findIndex(b=>b.id===n.id)):g.length;return g.splice(Math.min(x,g.length),0,h),g}function aI(e,t){const r=Su(e,t);if(!r||!t)return e;if(r.sessionIds.length<=2)return e.filter(i=>i.id!==r.id);const n=r.sessionIds.filter(i=>i!==t);return e.map(i=>i.id===r.id?{...i,sessionIds:n,ratios:Vc(n.length)}:i)}function oI(e,t){const r=Su(e,t);return r?e.filter(n=>n.id!==r.id):e}function lI(e,t,r){return e.map(n=>{if(n.id!==t)return n;const i=[...new Set(r)],l=new Set(n.sessionIds);return i.length===n.sessionIds.length&&i.every(h=>l.has(h))?{...n,sessionIds:i}:n})}function cI(e,t,r){const n=r.trim().slice(0,80);return e.map(i=>i.id===t?{...i,...n?{name:n}:{name:void 0}}:i)}const t1=320,y3=1,uI=t1+120,r1="termdock:split-workspaces:v2",v3="termdock:split-workspace:v1",dI=.1,hI=.9;function Kf(){if(typeof window>"u")return{mobile:!1,landscape:!1};const t=(navigator.maxTouchPoints>0||"ontouchstart"in window)&&Math.min(window.innerWidth,window.innerHeight)<768;return{mobile:t,landscape:t&&window.innerWidth>window.innerHeight}}function fI(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(r1);if(e)return sI(JSON.parse(e));const t=JSON.parse(window.localStorage.getItem(v3)||"null");if(t&&typeof t.primaryId=="string"&&typeof t.secondaryId=="string"&&t.primaryId!==t.secondaryId){const r=Math.min(hI,Math.max(dI,typeof t.ratio=="number"?t.ratio:.5));return[{id:`split:${t.primaryId}`,sessionIds:[t.primaryId,t.secondaryId],layout:t.direction==="vertical"?"vertical":"horizontal",ratios:[r,1-r]}]}}catch{}return[]}function pI(e,t){const r=new Map(e.map(c=>[c.id,c])),n=new Map;t.forEach(c=>c.sessionIds.forEach(h=>n.set(h,c)));const i=new Set,l=[];for(const c of e){const h=n.get(c.id);if(!h){l.push({key:c.id,sessions:[c]});continue}if(i.has(h.id))continue;i.add(h.id);const p=h.sessionIds.flatMap(g=>{const x=r.get(g);return x?[x]:[]});p.length>=2&&l.push({key:h.id,sessions:p,workspace:h})}return l}function I2(e){const t=e.wrapperEl;if(t)try{t.getAnimations().forEach(r=>r.cancel())}catch{}}function Sd(e,t){const r=mh(e,t);if(r===null)return;const n=e.wrapperEl;I2(e),n&&(n.style.transitionDuration="0ms");try{const i=e;i.setTransition?.(0),i.setTranslate?.(r),I2(e),n&&(n.style.transitionDuration="0ms",n.style.transform=`translate3d(${r}px, 0px, 0px)`)}catch{n&&(n.style.transitionDuration="0ms",n.style.transform=`translate3d(${r}px, 0px, 0px)`)}}function n1(e){try{const t=typeof e.getTranslate=="function"?e.getTranslate():e.translate;return typeof t=="number"&&Number.isFinite(t)?t:null}catch{return typeof e.translate=="number"&&Number.isFinite(e.translate)?e.translate:null}}function mh(e,t){const r=e.snapGrid,n=Array.isArray(r)?r[t]:void 0;return typeof n!="number"||!Number.isFinite(n)?null:-n}function mI(e,t){const r=n1(e),n=mh(e,t);return r!==null&&n!==null&&Math.abs(r-n)<=y3}function gI(e){const t=[],r=new Map,n=new Map,i=new Map;for(const l of e){const c=r.get(l.id)??[];if(c.push(l.id),r.set(l.id,c),l.sessionId){const h=n.get(l.sessionId)??[];h.push(l.id),n.set(l.sessionId,h)}if(l.mode==="tmux"&&l.tmuxSessionName){const h=i.get(l.tmuxSessionName)??[];h.push(l.id),i.set(l.tmuxSessionName,h)}}for(const[l,c]of r)c.length>1&&t.push({kind:"frontend",key:l,sessionIds:c});for(const[l,c]of n)c.length>1&&t.push({kind:"backend",key:l,sessionIds:c});for(const[l,c]of i)c.length>1&&t.push({kind:"tmux",key:l,sessionIds:c});return t}function w3(e){const t=new Map;for(const r of e)t.set(r.id,r);return Array.from(t.values())}function A3(e){return{id:e.sessionId,name:e.name,customName:e.customName===!0,sessionId:e.backendSessionId,mode:e.mode==="tmux"||e.mode==="shell"?e.mode:"shell",tmuxSessionName:e.tmuxSessionName??null}}function xI(e,t){const r=w3(e),n=r.findIndex(i=>i.id===t.id);if(n>=0){const i=[...r];return i[n]=t,i}return[...r,t]}function E2(e,t){const r=new Map(e.map(n=>[n.id,n]));return t.map(n=>{const i=r.get(n.sessionId);return{...A3(n),history:i?.history}})}function N2(e,t){return e.length===0?null:t&&e.some(r=>r.sessionId===t)?t:e[0]?.sessionId??null}function R2(e){if(!e||typeof e!="object")return"unknown";const t=e;if(typeof t.pointerType=="string"&&t.pointerType)return t.pointerType;if(typeof t.type=="string"){if(t.type.startsWith("touch"))return"touch";if(t.type.startsWith("mouse"))return"mouse";if(t.type.startsWith("pointer"))return"pointer"}return"unknown"}function M2(e){const t=new Map;for(const[r,n]of e)t.set(r,n.cwd??null);return t}function bI(e,t){if(e.size!==t.size)return!1;for(const[r,n]of t)if(e.get(r)!==n)return!1;return!0}function yI(e){const t="".toLowerCase().replace(/[^a-z0-9_-]/g,"").slice(0,12);if(t)return`wt-${t}`;const r=Date.now().toString(36),n=Math.random().toString(36).slice(2,8);return`wt-${r}${n}`}const vI=({terminalSettings:e=Q1(),colorTheme:t="dark",toolbarPresets:r=[],showDebug:n,terminalFocusAvailable:i=!0,defaultSessionMode:l="shell",defaultTmuxSessionName:c="",connectionPrioritySessionId:h=null,connectionPriorityReady:p=!0,desktopRightSidebarEnabled:g=!1,onToggleRightSidebar:x,desktopFloatingTitle:b=!1,desktopPinnedLeftSidebarWidth:w=0,desktopViewportWidth:A=0,onStatusChange:k,onSessionDataUpdate:E,onInitialViewportReady:I,onInitialRecoveryRequired:M})=>{const{t:Q}=Mr(),j=y.useMemo(()=>qc("session"),[]),F=y.useMemo(()=>qc("terminal"),[]),[V,$]=y.useState([]),[te,se]=y.useState(null),qe=ts(U=>U.activePaneId);y.useEffect(()=>{ts.getState().setActivePane(te)},[te]);const[de,oe]=y.useState(null),[Oe,et]=y.useState(!0),[ce,Be]=y.useState({token:0,reason:"visibility",forceForegroundReconnect:!1}),[ot,Ie]=y.useState(()=>new Set),[re,Ue]=y.useState(()=>({token:0,completed:new Set})),[_e,K]=y.useState(0),[Le,fe]=y.useState(()=>new Set),[$e,ze]=y.useState(()=>new Set),Ee=y.useRef(new Map),[ee,Ke]=y.useState(()=>new Set),wt=y.useRef(!1),tt=y.useRef(null),ge=y.useRef({}),[it,ht]=y.useState(null),[Y,be]=y.useState(()=>fI()),[ut,le]=y.useState(!1),[pe,je]=y.useState(null),[xt,dt]=y.useState(null),[Dt,Xt]=y.useState(null),[Ht,Bt]=y.useState(!1),[Wt,lr]=y.useState(()=>Kf().mobile),[ur,Jt]=y.useState(()=>Kf().landscape),[Er,X]=y.useState(null),[Re,We]=y.useState(null),Qt=y.useRef(i),It=y.useRef(!1),ar=y.useRef(!1),Ot=y.useRef(null),Fe=y.useRef(null),yr=y.useRef(Wt),He=y.useRef(null),Se=y.useRef(0),Ve=y.useRef([]),Ct=y.useRef(0),jr=y.useRef(null),ft=y.useRef(!1),Br=y.useRef(!0),Wn=y.useRef(null),an=y.useRef(""),ke=y.useRef(0);y.useEffect(()=>{if(typeof window>"u")return;const U=()=>{const ne=Kf();yr.current=ne.mobile,lr(ne.mobile),Jt(ne.landscape)};return U(),window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[]);const{sessions:St,inventory:kt,activeSessionId:ue,isLoading:Nr,openSession:st,setActiveSession:Gt,removeSession:Ur,renameSession:gn,resetSessionCustomName:Ln,reorderSessions:wn,restoreSessions:sr}=P7(),yn=kt?.tmuxRecovery??null;y.useEffect(()=>{yn&&M?.()},[yn,M]),y.useEffect(()=>{Xt(null),dt(null)},[yn?.id]);const Ts=y.useCallback(async()=>{dt("restore"),Xt(null);try{const U=await O7();await sr(),U.failed>0&&Xt(Q("tab.tmuxRecoveryPartial",{restored:U.restored,failed:U.failed}))}catch{Xt(Q("tab.tmuxRecoveryFailed"))}finally{dt(null)}},[sr,Q]),Xr=y.useCallback(async()=>{dt("dismiss"),Xt(null);try{await F7(),await sr()}catch{Xt(Q("tab.tmuxRecoveryDismissFailed"))}finally{dt(null)}},[sr,Q]),Wr=Zt(U=>U.groupByFolder),on=uu(U=>U.collaborationGroups),An=Zt(U=>U.leftOpen||U.rightOpen),jn=Zt(U=>U.rightSidebarWidthContextKey),Gn=Zt(U=>U.rightSidebarWidth),Pn=Zt(U=>U.rightPinned),[hn,kn]=y.useState(()=>M2(Hr.getState().sessions));y.useEffect(()=>Hr.subscribe(U=>{const ne=M2(U.sessions);kn(me=>bI(me,ne)?me:ne)}),[]);const{arranged:Tn}=y.useMemo(()=>ah(V,U=>hn.get(U.id)??null,Wr,"",Y,on),[V,hn,Wr,Y,on]),rn=y.useRef(Tn);rn.current=Tn;const Dr=y.useMemo(()=>pI(Tn,Y),[Tn,Y]),ns=y.useRef(Dr);ns.current=Dr;const Mt=y.useMemo(()=>Su(Y,te),[te,Y]),q=y.useMemo(()=>{const U=Dr.find(ne=>ne.sessions.some(me=>me.id===te));return new Set(U?.sessions.map(ne=>ne.id)??[])},[te,Dr]),Ye=y.useMemo(()=>{const U=new Map;if(!g||A<=0)return U;for(const ne of Dr){const me=ne.sessions[0];if(!me)continue;const Me=$7(me.id,hn.get(me.id)??null,ne.workspace?.id??null);if(!(Me===jn?Pn:U7(me.id,hn.get(me.id)??null,ne.workspace?.id??null)))continue;const Pt=Me===jn?Gn:z7(me.id,hn.get(me.id)??null,ne.workspace?.id??null),rr=Ud(Pt,A,w);U.set(ne.key,rr+Gx)}return U},[hn,w,g,Pn,jn,Gn,A,Dr]),Lt=y.useMemo(()=>qf(V.map(U=>({id:U.id,backendSessionId:U.sessionId})),h),[h,V]),wr=y.useMemo(()=>N2(St,ue),[ue,St]),Et=Td({prioritySessionId:Lt,activeSessionId:de??te,persistedActiveSessionId:wr,firstSessionId:V[0]?.id??null}),hr=y.useMemo(()=>$k(Dr.flatMap(U=>U.sessions.map(ne=>ne.id)),q),[q,Dr]),Sr=Et!==null&&ot.has(Et),Ir=y.useMemo(()=>{const U=new Set(q);return de&&U.add(de),!U.size&&Et&&U.add(Et),U},[q,de,Et]),ln=re.token===ce.token&&jk(Ir,re.completed),zr=ln||_e===ce.token?ce.token:-1;y.useEffect(()=>{if(!ce.token||ln)return;const U=window.setTimeout(()=>K(ce.token),_k);return()=>window.clearTimeout(U)},[ce.token,ln]);const Vn=y.useCallback((U,ne)=>{Ie(me=>{if(me.has(U)===ne)return me;const Ut=new Set(me);return ne?Ut.add(U):Ut.delete(U),Ut})},[]),Gr=y.useCallback(U=>{const ne=Se.current;Ue(Me=>{if(Me.token===ne&&Me.completed.has(U))return Me;const Ut=new Set(Me.token===ne?Me.completed:[]);return Ut.add(U),{token:ne,completed:Ut}});const me=Lt??de??He.current;U===me&&zc("foreground-stream-connected")},[de,Lt]),qn=y.useCallback((U,ne)=>{fe(me=>{if(me.has(U)===ne)return me;const Me=new Set(me);return ne?Me.add(U):Me.delete(U),Me})},[]),In=y.useCallback((U,ne)=>{ze(me=>{if(me.has(U)===ne)return me;const Me=new Set(me);return ne?Me.add(U):Me.delete(U),Me})},[]);y.useEffect(()=>{for(const[U,ne]of Ee.current){const me=V.find(Me=>Me.id===U);if(!me||me.sessionId!==ne.backendSessionId){Ee.current.delete(U);continue}!ot.has(U)||!Le.has(U)||!$e.has(U)||(Ee.current.delete(U),Wx(ne.backendSessionId,`${ne.command}\r`).catch(Me=>{console.error("[Session] Failed to send startup command:",Me)}))}},[V,ot,Le,$e]);const cn=Et!==null&&Le.has(Et),H=Et!==null&&$e.has(Et);y.useEffect(()=>{cn&&zc("foreground-viewport-ready")},[cn]),y.useEffect(()=>{H&&zc("foreground-content-ready")},[H]),y.useEffect(()=>{if(!I)return;if(!Oe&&V.length===0){I();return}if(!cn||!Sr||!H)return;const U=[...q].every(Pt=>Le.has(Pt)&&ot.has(Pt)&&$e.has(Pt));let ne=0,me=0;const Me=()=>{ne=requestAnimationFrame(()=>{me=requestAnimationFrame(()=>{zc("initial-viewport-presented"),I()})})};U&&Me();const Ut=U?void 0:window.setTimeout(Me,8e3);return()=>{cancelAnimationFrame(ne),cancelAnimationFrame(me),clearTimeout(Ut)}},[Sr,H,cn,Oe,I,V.length,q,Le,ot,$e]);const we=y.useMemo(()=>Wt?Ik({slides:Dr.map(U=>U.sessions.map(ne=>ne.id)),visibleSessionIds:q,foregroundSessionId:Et}):ee,[Wt,Dr,q,Et,ee]);y.useEffect(()=>{if(Wt||q.size===0)return;const U=new Set(q),ne=Dr.findIndex(me=>me.sessions.some(Me=>q.has(Me.id)));for(let me=-2;me<=2;me+=1)me!==0&&Dr[ne+me]?.sessions.forEach(Me=>U.add(Me.id));Ke(me=>{let Me=!1;const Ut=new Set(me);for(const Pt of U)Ut.has(Pt)||(Ut.add(Pt),Me=!0);return Me?Ut:me})},[Wt,q,Dr]);const Pe=cT(we);y.useEffect(()=>{if(!de)return;if(!V.some(ne=>ne.id===de)){oe(null);return}if(!Le.has(de)||!ot.has(de)||!$e.has(de))return;const U=window.setTimeout(()=>{oe(ne=>ne===de?null:ne),Qt.current&&!yr.current&&ht({sessionId:de,token:Date.now()})},80);return()=>window.clearTimeout(U)},[$e,de,ot,V,Le]),y.useEffect(()=>{typeof window>"u"||(Y.length>0?(window.localStorage.setItem(r1,JSON.stringify(Y)),window.localStorage.removeItem(v3)):window.localStorage.removeItem(r1))},[Y]),y.useEffect(()=>{Nr||Oe||Y.length===0||be(U=>iI(U,V.map(ne=>ne.id)))},[Nr,Oe,V,Y.length]),y.useEffect(()=>{if(!pe)return;const U=window.setTimeout(()=>je(null),3200);return()=>window.clearTimeout(U)},[pe]),He.current=te,Se.current=ce.token,Ve.current=V,jr.current=ue,ft.current=Nr,Br.current=Oe,Qt.current=i;const Ge=y.useCallback((U=tt.current)=>{const ne=Ct.current,me=typeof window<"u"?window.visualViewport:null,Me=U?n1(U):null,Ut=U?mh(U,ne):null;return{sessionsLength:Ve.current.length,workspaceSlidesLength:ns.current.length,sessionIds:Ve.current.map(Pt=>Pt.id),activeSessionId:He.current,activeSessionIndex:ne,persistedActiveId:jr.current,isLoading:ft.current,isRestoring:Br.current,activeIndex:U?.activeIndex??null,previousIndex:U?.previousIndex??null,animating:U?.animating??null,allowTouchMove:U?.allowTouchMove??null,width:U?.width??null,translate:Me,targetTranslate:Ut,translateDelta:Me!==null&&Ut!==null?Me-Ut:null,snapGridLength:U?.snapGrid?.length??null,targetSnap:U?.snapGrid?.[ne]??null,visualViewport:me?{width:Math.round(me.width),height:Math.round(me.height),offsetTop:Math.round(me.offsetTop)}:null}},[]),ve=y.useCallback((U,ne)=>{j(U,{...Ge(),...ne})},[j,Ge]);y.useEffect(()=>{Nr||Oe||te!==ue&&Gt(te)},[te,Nr,Oe,ue,Gt]);const lt=y.useMemo(()=>{if(Tn.length===0||!te)return 0;const U=Dr.findIndex(ne=>ne.sessions.some(me=>me.id===te));return U>=0?U:0},[Dr,te]);Ct.current=lt;const Nt=y.useCallback(()=>{Ot.current&&(clearTimeout(Ot.current),Ot.current=null)},[]),At=y.useCallback(U=>{Nt(),Ot.current=setTimeout(()=>{Ot.current=null,It.current=!1,ve("[swiper:touch-guard-clear]",{reason:U})},uI)},[Nt,ve]),ct=y.useCallback((U,ne={})=>{const me=tt.current,Me=Ct.current,Ut=ns.current;if(!me||Ut.length===0||Me<0||Me>=Ut.length)return;if(It.current){ve("[swiper:sync-skip-touch]",{reason:U});return}if(me.animating){ve("[swiper:sync-skip-animating]",{reason:U});return}const Pt=n1(me),rr=mh(me,Me),er=Pt!==null&&rr!==null&&Math.abs(Pt-rr)<=y3,Or=me.activeIndex===Me;if(ve("[swiper:sync-check]",{reason:U,activeIndexAligned:Or,translateAligned:er,immediate:ne.immediate===!0}),!(Or&&er)){if(Or){Sd(me,Me),ve("[swiper:sync-forced-active]",{reason:U,translateAligned:er,immediate:ne.immediate===!0});return}ne.immediate?(Sd(me,Me),me.slideTo(Me,0,!1),Sd(me,Me)):me.slideTo(Me,t1,!1),ve("[swiper:sync-applied]",{reason:U,activeIndexAligned:Or,translateAligned:er,immediate:ne.immediate===!0})}},[ve]);y.useEffect(()=>{const U=ne=>{const me=ne;tt.current&&(tt.current.allowTouchMove=!me.detail.locked),ve("[swiper:gesture-lock]",{locked:me.detail.locked})};return document.addEventListener("termdock:gesture-lock",U),()=>document.removeEventListener("termdock:gesture-lock",U)},[ve]),y.useEffect(()=>{if(V.length===0){te!==null&&se(null);return}if(!te){if(!p)return;se(Td({prioritySessionId:Lt,activeSessionId:null,persistedActiveSessionId:wr,firstSessionId:V[0]?.id??null}));return}V.some(ne=>ne.id===te)||se(V[0].id)},[V,te,p,Lt,wr]);const _t=y.useCallback((U,ne)=>{if(ne&&Date.now()<ke.current){ge.current[U]=!1;return}ge.current[U]=ne,We(me=>ne?U:me===U?null:me)},[]),_r=y.useCallback(U=>{if(!It.current&&U.activeIndex!==Ct.current){ve("[swiper:slide-change-ignored-layout]",{instanceActiveIndex:U.activeIndex,expectedActiveIndex:Ct.current}),requestAnimationFrame(()=>ct("ignored-layout-slide-change",{immediate:!0}));return}const ne=ns.current[U.activeIndex],me=ne?.sessions.some(Pt=>Pt.id===te)?te:ne?.sessions[0]?.id;if(ve("[swiper:slide-change]",{nextSessionId:me??null,instanceActiveIndex:U.activeIndex}),!me||me===te)return;const Me=!!te&&ge.current[te]===!0,Ut=Qt.current&&(!yr.current||Me);if(Fe.current=me,se(me),Ut){ht({sessionId:me,token:Date.now()});return}ht(null)},[V,te,ve,ct]);y.useLayoutEffect(()=>{if(Fe.current===te){ve("[swiper:sync-skip-swiper-driven]",{activeSessionId:te}),Fe.current=null;return}ct("active-session-index",{immediate:!0})},[te,lt,V.length,ct,ve]),y.useEffect(()=>{const U=tt.current;if(!U)return;const ne=Dr.length>1&&!An&&!ut;U.allowTouchMove!==ne&&(U.allowTouchMove=ne,ve("[swiper:allow-touch-sync]",{nextAllow:ne,sidebarOverlayOpen:An}))},[Dr.length,ve,An,ut]);const jt=y.useCallback(U=>{const ne=tt.current;if(!ne)return;const me=ne.el;if(ve("[swiper:layout-before]",{reason:U,scrollLeft:me?.scrollLeft??null}),me&&(me.scrollLeft=0),ne.updateSize(),ne.updateSlides(),ne.updateProgress(),ne.updateSlidesClasses(),me&&(me.scrollLeft=0),ve("[swiper:layout-after]",{reason:U,scrollLeft:me?.scrollLeft??null}),It.current||ne.animating){ve("[swiper:layout-skip-sync-motion]",{reason:U});return}ct(`layout:${U}`,{immediate:!0}),requestAnimationFrame(()=>{const Me=tt.current;Me&&(It.current||Me.animating||Sd(Me,Ct.current))})},[ve,ct]);y.useEffect(()=>()=>Nt(),[Nt]);const tr=Dr.map(U=>U.key).join("\0");y.useEffect(()=>{requestAnimationFrame(()=>jt("group-change"))},[Wr,tr,jt]),y.useEffect(()=>{let U=null,ne="mount";const me=er=>{ne=er,U===null&&(U=requestAnimationFrame(()=>{U=null,jt(`viewport-change:${ne}`)}))},Me=()=>me("window-resize"),Ut=()=>me("visual-viewport-resize"),Pt=()=>me("visual-viewport-scroll"),rr=er=>{me(`measured:${er.detail?.source??"unknown"}`)};return window.addEventListener("resize",Me),window.visualViewport?.addEventListener("resize",Ut),window.visualViewport?.addEventListener("scroll",Pt),document.addEventListener($m,rr),me("mount"),()=>{window.removeEventListener("resize",Me),window.visualViewport?.removeEventListener("resize",Ut),window.visualViewport?.removeEventListener("scroll",Pt),document.removeEventListener($m,rr),U!==null&&cancelAnimationFrame(U)}},[jt]),y.useEffect(()=>{if(typeof document>"u")return;let U=null,ne=null;const me=Or=>{if(Or!=="online"&&document.hidden)return;const fn=performance.now();if(!Pk(ne,fn))return;ne=fn;const P=Or==="bfcache"||Or==="online"?Or:"visibility",xe=Ok();mf(),la("info","PWA_RESUME scheduled",{source:Or,forceForegroundReconnect:xe,activeSessionId:He.current}),Be(Ae=>({token:Ae.token+1,reason:P,forceForegroundReconnect:xe})),requestAnimationFrame(()=>jt(`resume:${Or}:raf`)),U&&clearTimeout(U),U=setTimeout(()=>{U=null,jt(`resume:${Or}:settled`)},320)},Me=()=>{if(document.hidden){mf();return}me("visibility")},Ut=()=>{mf()},Pt=Or=>{me(Or.persisted?"bfcache":"pageshow")},rr=()=>me("online"),er=()=>me("focus");return document.addEventListener("visibilitychange",Me),window.addEventListener("pagehide",Ut),window.addEventListener("pageshow",Pt),window.addEventListener("online",rr),window.addEventListener("focus",er),()=>{document.removeEventListener("visibilitychange",Me),window.removeEventListener("pagehide",Ut),window.removeEventListener("pageshow",Pt),window.removeEventListener("online",rr),window.removeEventListener("focus",er),U&&clearTimeout(U)}},[jt]),y.useLayoutEffect(()=>{if(!Bk(Oe))return;const U=gI(V),ne=JSON.stringify(U);U.length>0&&ne!==an.current?(an.current=ne,console.warn("[session-invariant] duplicate mapping detected",U)):U.length===0&&an.current&&(an.current=""),E?.({sessions:V.map(me=>({id:me.id,name:me.name,customName:me.customName,mode:me.mode,tmuxSessionName:me.tmuxSessionName})),activeSessionId:te,splitWorkspaces:Y.map(({id:me,name:Me,sessionIds:Ut,layout:Pt})=>({id:me,...Me?{name:Me}:{},sessionIds:Ut,layout:Pt}))})},[V,te,Y,E,Oe]),y.useEffect(()=>{if(Nr||wt.current)return;wt.current=!0;const U=qf(St.map(Pt=>({id:Pt.sessionId,backendSessionId:Pt.backendSessionId??null})),h),ne=N2(St,ue),me=Td({prioritySessionId:p?U:null,activeSessionId:null,persistedActiveSessionId:ne,firstSessionId:St[0]?.sessionId??null}),Me=w3(St.map(A3));if(j("[Session] Restoring",Me.length,"persisted sessions (one-shot)"),ve("[swiper:restore-start]",{persistedSessionIds:St.map(Pt=>Pt.sessionId),nextActiveSessionId:me}),Me.length>0){const Pt=Hr.getState();Me.forEach(er=>{er.sessionId&&Pt.setTerminalSession(er.id,{sessionId:er.sessionId,cols:80,rows:24,mode:er.mode,tmuxSessionName:er.tmuxSessionName,history:er.history})}),St.forEach(er=>{er.agent!==void 0&&Pt.setSessionAgentIdentity(er.sessionId,er.agent),er.activeProgram!=null&&Pt.setSessionActiveProgram(er.sessionId,er.activeProgram),er.cwd!=null&&Pt.setSessionCwd(er.sessionId,er.cwd),er.shellTitle!=null&&Pt.setSessionShellTitle(er.sessionId,er.shellTitle)}),$(Me);const rr=me||Me[0]?.id||null;se(rr),ve("[swiper:restore-complete]",{restoredSessionIds:Me.map(er=>er.id),nextActiveSessionId:rr})}(async()=>(Me.length===0&&await Wn.current?.({createIfEmpty:!0}),et(!1),requestAnimationFrame(()=>ct("restore-finished",{immediate:!0}))))()},[Nr,St,ue,j,ve,ct,p,h]),y.useEffect(()=>{if(!p||Oe||V.length===0)return;const U=qf(V.map(me=>({id:me.id,backendSessionId:me.sessionId})),h),ne=Td({prioritySessionId:U,activeSessionId:He.current,persistedActiveSessionId:wr,firstSessionId:V[0]?.id??null});ne&&ne!==He.current&&se(ne)},[p,h,Oe,wr,V]);const vt=y.useRef([]),Tt=y.useRef(!1);He.current=te,y.useEffect(()=>{if(Oe)return;const U=vt.current,ne=St,me=new Map(U.map(P=>[P.sessionId,P])),Me=Hr.getState();for(const P of ne){const xe=me.get(P.sessionId),Ae=Hr.getState().sessions.get(P.sessionId);P.agent!==void 0&&JSON.stringify(P.agent)!==JSON.stringify(Ae?.agent)&&(Ae?.agent==null||JSON.stringify(P.agent)!==JSON.stringify(xe?.agent))&&Me.setSessionAgentIdentity(P.sessionId,P.agent),P.activeProgram!=null&&P.activeProgram!==Ae?.activeProgram&&(Ae?.activeProgram==null||P.activeProgram!==xe?.activeProgram)&&Me.setSessionActiveProgram(P.sessionId,P.activeProgram),P.cwd!=null&&P.cwd!==Ae?.cwd&&(Ae?.cwd==null||P.cwd!==xe?.cwd)&&Me.setSessionCwd(P.sessionId,P.cwd),P.shellTitle!=null&&P.shellTitle!==Ae?.shellTitle&&(Ae?.shellTitle==null||P.shellTitle!==xe?.shellTitle)&&Me.setSessionShellTitle(P.sessionId,P.shellTitle)}if(!Tt.current){$(P=>E2(P,ne)),vt.current=ne,Tt.current=!0;return}const Ut=new Set(U.map(P=>P.sessionId)),Pt=new Set(ne.map(P=>P.sessionId)),rr=new Map(U.map(P=>[P.sessionId,P.name]));vt.current=ne,$(P=>{const xe=E2(P,ne);return(!He.current||!xe.some(Ae=>Ae.id===He.current))&&se(xe[0]?.id??null),xe});const er=ne.filter(P=>!Ut.has(P.sessionId)),Or=[...Ut].filter(P=>!Pt.has(P)),fn=ne.filter(P=>Ut.has(P.sessionId)&&rr.get(P.sessionId)!==P.name);(er.length>0||Or.length>0||fn.length>0)&&j("[Session] Synced persisted sessions:",{newSessionIds:er.map(P=>P.sessionId),removedSessionIds:Or,renamedSessionIds:fn.map(P=>P.sessionId),currentSessionIds:ne.map(P=>P.sessionId)});for(const P of ne){if(!P.backendSessionId)continue;Hr.getState().setTerminalSession(P.sessionId,{sessionId:P.backendSessionId,cols:80,rows:24,mode:P.mode,tmuxSessionName:P.tmuxSessionName})}},[St,Oe,j]);const fr=y.useCallback(async U=>{try{const ne=Zt.getState(),me=te?{rightOpen:ne.rightOpen,rightPinned:ne.rightPinned,rightSidebarWidth:ne.rightSidebarWidth,rightTab:ne.rightTab}:null,Me=U?.mode==="tmux"||U?.mode==="shell"?U.mode:l,Ut=(U?.tmuxSessionName||"").trim(),Pt=c.trim(),rr=Me==="tmux"?Ut||Pt||yI():null,er=typeof U?.cwd=="string"?U.cwd:null,Or=te?Hr.getState().sessions.get(te)?.cwd??null:null,fn=typeof er=="string"&&er.trim().length>0?er:typeof Or=="string"&&Or.trim().length>0?Or:void 0,P=await st({mode:Me,tmuxSessionName:rr,cwd:fn,termType:"xterm-256color",createIfEmpty:U?.createIfEmpty===!0}),xe=P.session,Ae=P.terminalSession;!P.reused&&me&&Zt.getState().initializeRightSidebarForSession(xe.sessionId,Ae.cwd??fn??null,me);const rt={id:xe.sessionId,name:xe.name,customName:xe.customName===!0,sessionId:Ae.sessionId,mode:Ae.mode??xe.mode,tmuxSessionName:Ae.tmuxSessionName??xe.tmuxSessionName},pt=U?.command?.trim();return pt&&Ee.current.set(rt.id,{backendSessionId:Ae.sessionId,command:pt}),$(qt=>xI(qt,rt)),se(rt.id),Hr.getState().setTerminalSession(rt.id,{sessionId:Ae.sessionId,cols:80,rows:24,mode:rt.mode,tmuxSessionName:rt.tmuxSessionName,activeProgram:Ae.activeProgram,activeProgramRaw:Ae.activeProgramRaw,activeProgramSource:Ae.activeProgramSource,cwd:Ae.cwd}),j("[Session] Inventory opened session:",{frontendSessionId:rt.id,backendSessionId:Ae.sessionId,reused:P.reused,mode:rt.mode,tmuxSessionName:rt.tmuxSessionName}),rt.id}catch(ne){return console.error("[Session] Failed to create new session:",ne),null}},[l,c,te,st,j]);Wn.current=fr;const at=y.useCallback((U,ne={})=>{ts.getState().setActivePane(U);const me=He.current,Me=!!me&&ge.current[me]===!0;if(se(U),yr.current&&ne.preserveMobileKeyboard===!1){ke.current=Date.now()+600,me&&(ge.current[me]=!1),We(null),ht(null);const Ut=document.activeElement;Ut instanceof HTMLTextAreaElement&&Ut.closest(".terminal-viewport-container")&&Ut.blur();return}Me&&yr.current&&We(U),Qt.current&&(!yr.current||Me)&&ht({sessionId:U,token:Date.now()})},[]),Rr=y.useCallback(U=>{se(U),le(!0),je(null)},[]),Vr=y.useCallback(U=>{const ne=He.current;!ne||ne===U||(be(me=>Zf(me,ne,U)),le(!1),at(ne,{preserveMobileKeyboard:!1}))},[at]),Nn=y.useCallback(async()=>{const U=He.current;if(!U||Ht)return;Bt(!0);const ne=Hr.getState().sessions.get(U)?.cwd??void 0,me=await fr({cwd:ne||void 0,mode:l});if(Bt(!1),!me){je(Q("common.error"));return}be(Me=>Zf(Me,U,me)),le(!1),at(U,{preserveMobileKeyboard:!1})},[at,l,fr,Ht,Q]),nn=y.useCallback(U=>{be(ne=>oI(ne,U)),U&&at(U,{preserveMobileKeyboard:!1})},[at]),fs=y.useCallback(U=>{be(ne=>aI(ne,U)),at(U,{preserveMobileKeyboard:!1})},[at]),On=y.useCallback(U=>{if(V.find(me=>me.id===U)){if(ts.getState().setActivePane(U),U===He.current)return;if(se(U),!Rk({isMobile:yr.current,viewportReady:Le.has(U),streamReady:ot.has(U),contentReady:$e.has(U)})){oe(null),Qt.current&&ht({sessionId:U,token:Date.now()}),j("[Session] Switched to session:",U);return}Ke(Me=>{if(Me.has(U))return Me;const Ut=new Set(Me);return Ut.add(U),Ut}),oe(U),j("[Session] Switched to session:",U)}},[$e,j,ot,V,Le]),ls=y.useCallback((U,ne)=>{ne.trim()&&($(me=>me.map(Me=>Me.id===U?{...Me,name:ne.trim(),customName:!0}:Me)),gn(U,ne.trim()))},[gn]),Bs=y.useCallback(U=>{$(ne=>ne.map(me=>me.id===U?{...me,customName:!1}:me)),Ln(U)},[Ln]),ii=y.useCallback(U=>{$(ne=>{const me=new Map(ne.map(rr=>[rr.id,rr])),Me=U.map(rr=>me.get(rr)).filter(rr=>rr!==void 0),Ut=new Set(U),Pt=ne.filter(rr=>!Ut.has(rr.id));return[...Me,...Pt]}),wn(U),j("[Session] Reordered sessions:",U),requestAnimationFrame(()=>{tt.current?.update()})},[wn,j]),Os=y.useCallback(async U=>{const ne=typeof U=="string"?U:U.sessionId,me=typeof U=="string"?"auto":U.closeMode??"auto",Me=V.find(Pt=>Pt.id===ne);if(!Me)return;const Ut=H7(Tn,ne,Pt=>Pt.id);try{me==="destroy"&&Me.mode==="tmux"&&Me.tmuxSessionName?(await Vx(Me.tmuxSessionName),j("[Session] Destroyed tmux session:",{frontendSessionId:Me.id,tmuxSessionName:Me.tmuxSessionName})):Me.sessionId&&(await Hx(Me.sessionId),j("[Session] Closed backend terminal:",Me.sessionId))}catch(Pt){console.error("[Session] Failed to close backend terminal:",Pt);return}$(Pt=>{const rr=Pt.filter(er=>er.id!==ne);return se(Ut),rr}),Ur(ne,Ut),delete ge.current[ne],j("[Session] Closed session:",{sessionId:ne,closeMode:me})},[V,Tn,Ur,j]),Pr=y.useCallback(U=>{if(!U)return;const ne=V.filter(me=>me.sessionId===U);if(ne.length!==0){ne.length>1&&console.warn("[session-invariant] backend matched multiple frontend sessions during cleanup",{backendSessionId:U,frontendSessionIds:ne.map(me=>me.id)}),$(me=>{const Me=me.filter(Ut=>Ut.sessionId!==U);return Me.length!==me.length&&!Me.some(Pt=>Pt.id===te)&&se(Me.length>0?Me[0].id:null),Me});for(const me of ne)Ur(me.id),delete ge.current[me.id];j("[Session] Backend gone, dropped local session(s):",ne.map(me=>me.id))}},[V,te,Ur,j]);y.useEffect(()=>{const U=qt=>{fr(qt.detail)},ne=qt=>{On(qt.detail)},me=()=>{const qt=He.current;!qt||yr.current||ht({sessionId:qt,token:Date.now()})},Me=qt=>{const Rt=qt;Rt.detail&&Rr(Rt.detail)},Ut=qt=>{const Rt=qt.detail;nn(Rt??He.current??void 0)},Pt=qt=>{const Rt=qt.detail;Rt&&fs(Rt)},rr=qt=>{const Rt=qt.detail,Fr=typeof Rt=="string"?Rt:Rt?.layout,Rn=typeof Rt=="string"?He.current:Rt?.sessionId;Fr!=="horizontal"&&Fr!=="vertical"&&Fr!=="grid"||be(xs=>xs.map(Mi=>Mi.sessionIds.includes(Rn??"")?{...Mi,layout:Fr}:Mi))},er=qt=>{const Fr=qt.detail?.direction;if(Fr!=="prev"&&Fr!=="next")return;const Rn=rn.current;if(Rn.length<=1)return;const xs=He.current,Mi=xs?Rn.findIndex(pn=>pn.id===xs):-1,oi=((Mi>=0?Mi:0)+(Fr==="next"?1:-1)+Rn.length)%Rn.length,da=Rn[oi]?.id;da&&da!==xs&&On(da)},Or=qt=>{Os(qt.detail)},fn=qt=>{Pr(qt.detail)},P=qt=>{const Rt=qt;!Rt.detail?.sessionId||!Rt.detail?.name||ls(Rt.detail.sessionId,Rt.detail.name)},xe=qt=>{const Rt=qt;Rt.detail?.sessionId&&Bs(Rt.detail.sessionId)},Ae=qt=>{const Rt=qt;Rt.detail?.sessionIds&&ii(Rt.detail.sessionIds)},rt=qt=>{const Rt=qt.detail;!Rt?.workspaceId||!Array.isArray(Rt.sessionIds)||be(Fr=>lI(Fr,Rt.workspaceId,Rt.sessionIds))},pt=qt=>{const Rt=qt.detail;!Rt?.workspaceId||typeof Rt.name!="string"||be(Fr=>cI(Fr,Rt.workspaceId,Rt.name))},dr=qt=>{const Rt=qt.detail;!Rt?.primaryId||!Rt.secondaryId||Rt.primaryId===Rt.secondaryId||(be(Fr=>Zf(Fr,Rt.primaryId,Rt.secondaryId)),at(Rt.primaryId,{preserveMobileKeyboard:!1}))};return window.addEventListener("new-terminal-session",U),window.addEventListener("switch-terminal-session",ne),window.addEventListener("focus-active-terminal-session",me),window.addEventListener("open-terminal-split-chooser",Me),window.addEventListener("close-terminal-split",Ut),window.addEventListener("remove-terminal-split-pane",Pt),window.addEventListener("set-terminal-split-direction",rr),window.addEventListener("cycle-terminal-session",er),window.addEventListener("close-terminal-session",Or),window.addEventListener("close-terminal-session-by-backend",fn),window.addEventListener("rename-terminal-session",P),window.addEventListener("reset-terminal-session-name",xe),window.addEventListener("reorder-terminal-session",Ae),window.addEventListener("reorder-terminal-split-workspace",rt),window.addEventListener("rename-terminal-split-workspace",pt),window.addEventListener("combine-terminal-split-sessions",dr),()=>{window.removeEventListener("new-terminal-session",U),window.removeEventListener("switch-terminal-session",ne),window.removeEventListener("focus-active-terminal-session",me),window.removeEventListener("open-terminal-split-chooser",Me),window.removeEventListener("close-terminal-split",Ut),window.removeEventListener("remove-terminal-split-pane",Pt),window.removeEventListener("set-terminal-split-direction",rr),window.removeEventListener("cycle-terminal-session",er),window.removeEventListener("close-terminal-session",Or),window.removeEventListener("close-terminal-session-by-backend",fn),window.removeEventListener("rename-terminal-session",P),window.removeEventListener("reset-terminal-session-name",xe),window.removeEventListener("reorder-terminal-session",Ae),window.removeEventListener("reorder-terminal-split-workspace",rt),window.removeEventListener("rename-terminal-split-workspace",pt),window.removeEventListener("combine-terminal-split-sessions",dr)}},[at,fr,On,Rr,nn,fs,Os,Pr,ls,Bs,ii]),y.useEffect(()=>{if(!Mt||Wt)return;const U=ne=>{if(!(ne.ctrlKey||ne.metaKey)||!ne.shiftKey)return;if(Mt.layout==="horizontal"?ne.key==="ArrowLeft"||ne.key==="ArrowRight":Mt.layout==="vertical"?ne.key==="ArrowUp"||ne.key==="ArrowDown":ne.key.startsWith("Arrow")){ne.preventDefault(),ne.stopPropagation();const Me=Mt.sessionIds.indexOf(He.current??""),Ut=ne.key==="ArrowLeft"||ne.key==="ArrowUp"?-1:1,Pt=(Math.max(0,Me)+Ut+Mt.sessionIds.length)%Mt.sessionIds.length,rr=Mt.sessionIds[Pt];if(!rr)return;at(rr);return}ne.key==="Backspace"&&(ne.preventDefault(),ne.stopPropagation(),nn(He.current??void 0))};return window.addEventListener("keydown",U,!0),()=>window.removeEventListener("keydown",U,!0)},[at,Mt,nn,Wt]);const Jr=U=>{const ne=Hr.getState().sessions.get(U.id);return Ho(U,ne?.activeProgram??null,ne?.cwd??null,void 0,ne?.shellTitle??null,ne?.promptState??null)},$n=(U,ne={})=>{const me=U.id===te&&!qe?.startsWith("@collaboration:"),Me=q.has(U.id)&&!ne.hidden,Ut=p&&Nk({sessionId:U.id,foregroundSessionId:Et,visibleSessionIds:q,deferredViewportSessionIds:Wt?Pe:we}),Pt=Ek({sessionId:U.id,foregroundSessionId:Et,foregroundReady:Sr,isVisible:Me})&&p,rr=Qk({sessionId:U.id,foregroundSessionId:Et,requestToken:ce.token,foregroundCompletedToken:zr,isVisible:Ir.has(U.id)})&&p,er=Me||U.id===Et||we.has(U.id)?0:hr.get(U.id)??Kd;return a.jsxs("div",{className:`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden ${ne.hidden?"invisible pointer-events-none":""}`,style:ne.containerStyle,"aria-hidden":ne.hidden||void 0,onPointerDownCapture:()=>{Me&&k2(me,()=>at(U.id))},onWheelCapture:()=>{k2(me,()=>at(U.id))},children:[ne.showPaneTitle&&a.jsx(eI,{session:U,active:me,onActivate:()=>at(U.id),onToggleRightSidebar:me?x:void 0}),a.jsx("div",{className:"min-h-0 flex-1 app-chrome-bg",children:Ut&&a.jsx(Jk,{sessionId:U.id,mode:U.mode,tmuxSessionName:U.tmuxSessionName,terminalSettings:e,colorTheme:t,toolbarPresets:r,isActive:me,focusSuspended:de!==null,deferCursorUntilPositioned:de===U.id||U.mode==="tmux"&&!$e.has(U.id),isLayoutVisible:Me,initialConnectEnabled:Pt&&rr,resumeRequestEnabled:rr,suppressKeyboard:ne.suppressKeyboard,keyboardPortalTarget:ne.keyboardPortalTarget,sharedMobileKeyboardLayout:ne.sharedMobileKeyboardLayout,suppressPageFlipRefresh:ne.suppressPageFlipRefresh,focusRequestToken:it?.sessionId===U.id?it.token:0,resumeRequestToken:ce.token,resumeRequestReason:ce.reason,forceResumeReconnect:ce.forceForegroundReconnect&&Ir.has(U.id),resumeRequestDelayMs:Ir.has(U.id)?0:ne.hidden?Kd:hr.get(U.id)??Kd,initialConnectDelayMs:er,onStreamReadyChange:Vn,onStreamConnected:Gr,onViewportReadyChange:qn,onContentReadyChange:In,onKeyboardVisibilityChange:_t,showDebug:n,onStatusChange:me?k:void 0})})]},U.id)};return a.jsxs("div",{className:"relative h-full flex flex-col",children:[yn&&a.jsx("section",{className:"fixed inset-x-3 top-[calc(var(--safe-top-inset)+0.75rem)] z-toast mx-auto max-w-lg rounded-2xl border border-warning/30 bg-surface-elevated px-4 py-3.5 shadow-[0_20px_60px_var(--app-shadow-strong)]",role:"alert","aria-live":"assertive",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("span",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-warning/15 text-warning",children:a.jsx(eb,{size:18})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-[13px] font-semibold text-foreground",children:Q("tab.tmuxRecoveryTitle",{count:yn.sessions.length})}),a.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:Q("tab.tmuxRecoveryHint")}),a.jsx("p",{className:"mt-1.5 truncate text-[10px] text-foreground/70",children:yn.sessions.map(U=>U.name).join(" · ")}),Dt&&a.jsx("p",{className:"mt-2 text-[10px] text-destructive",children:Dt}),a.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[a.jsxs("button",{type:"button",disabled:xt!==null,onClick:()=>{Ts()},className:"inline-flex min-h-9 items-center gap-1.5 rounded-lg bg-primary px-3 text-[11px] font-medium text-primary-foreground transition active:opacity-80 disabled:opacity-50",children:[a.jsx(cb,{size:13,className:xt==="restore"?"animate-spin":""}),Q(xt==="restore"?"tab.tmuxRecoveryRestoring":"tab.tmuxRecoveryRestoreAll")]}),a.jsx("button",{type:"button",disabled:xt!==null,onClick:()=>{Xr()},className:"inline-flex min-h-9 items-center rounded-lg px-3 text-[11px] text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:opacity-50",children:Q("tab.tmuxRecoveryDismiss")})]})]})]})}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(A9,{onSwiper:U=>{tt.current=U,U.allowTouchMove=Dr.length>1&&!An&&!ut,ve("[swiper:on-swiper]",{allowTouchMove:U.allowTouchMove}),requestAnimationFrame(()=>jt("on-swiper"))},onSlideChange:_r,onTouchStart:(U,ne)=>{const me=R2(ne),Me=me==="touch"||me==="pen"||me==="unknown";F("[swipe:touch-start]",{pointerType:me,allowed:Me}),ve("[swiper:touch-start]",{pointerType:me,allowed:Me}),Me&&(Nt(),ar.current=!0,It.current=!0)},onTouchEnd:(U,ne)=>{const me=R2(ne),Me=me==="touch"||me==="pen"||me==="unknown";F("[swipe:touch-end]",{pointerType:me,allowed:Me}),ve("[swiper:touch-end]",{pointerType:me,allowed:Me}),Me&&(ar.current=!1,At("touch-end"))},onTransitionEnd:()=>{const U=tt.current;if(ar.current){ve("[swiper:transition-end-during-touch]");return}if(It.current&&U&&!mI(U,Ct.current)){ve("[swiper:transition-end-deferred]");return}Nt(),It.current=!1,ve("[swiper:transition-end]")},initialSlide:Math.max(0,lt),speed:t1,slidesPerView:1,resistanceRatio:.82,threshold:8,longSwipesRatio:.2,touchAngle:45,touchStartPreventDefault:!1,simulateTouch:!1,noSwiping:!0,noSwipingSelector:"[data-mobile-keyboard='true']",className:"terminal-session-swiper h-full",children:Dr.map(U=>{const ne=U.workspace,me=!!ne&&U.sessions.length>=2,Me=Wt?ur?"horizontal":"vertical":ne?.layout??"horizontal",Ut=Wt&&Re?U.sessions.some(rr=>rr.id===Re):!1,Pt=U.sessions.some(rr=>rr.id===te)?te:U.sessions[0]?.id;return a.jsx(T9,{className:"h-full",children:a.jsx("div",{className:"h-full min-w-0","data-pinned-right-sidebar-inset":Ye.get(U.key)??0,style:{paddingRight:Ye.get(U.key)??0,paddingTop:b&&!me?"2.5rem":void 0},children:me?a.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--chrome-bg)]",style:Wt?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,children:[a.jsx(rg,{layoutId:U.key,preset:ne?.layout??"horizontal",initialTree:sT(U.sessions.map(rr=>rr.id),Me,ne?.ratios,ne?.gridColumnRatios,ne?.gridRowRatios),mobile:Wt,focusId:Ut?Re:null,panes:U.sessions.map(rr=>({id:rr.id,content:$n(rr,{showPaneTitle:!Wt,suppressKeyboard:Wt&&rr.id!==Pt,keyboardPortalTarget:Wt?Er:null,sharedMobileKeyboardLayout:Wt,suppressPageFlipRefresh:!0})}))}),Wt&&a.jsx("div",{ref:X,className:"relative shrink-0 app-chrome-bg","data-split-keyboard-host":"true"})]}):a.jsx(rg,{layoutId:U.key,preset:ne?.layout??"horizontal",mobile:Wt,panes:[{id:U.sessions[0].id,content:$n(U.sessions[0])}]})})},U.key)})})}),ut&&te&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop-soft)] backdrop-blur-sm",onClick:()=>le(!1),"aria-label":Q("common.close")}),a.jsxs("section",{className:"fixed inset-x-3 bottom-3 z-modal-panel mx-auto max-h-[min(78svh,620px)] max-w-md overflow-hidden rounded-2xl border border-border/20 bg-surface shadow-[0_24px_70px_var(--app-shadow-strong)] sm:bottom-auto sm:top-1/2 sm:-translate-y-1/2",style:{paddingBottom:"var(--safe-bottom-inset)"},role:"dialog","aria-modal":"true","aria-label":Q("tab.splitTitle"),children:[a.jsxs("header",{className:"flex items-start gap-3 border-b border-border/20 px-4 py-3.5",children:[a.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary",children:a.jsx(dl,{size:17})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:Q("tab.splitTitle")}),a.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-muted-foreground",children:Q("tab.splitExistingHint")})]}),a.jsx("button",{type:"button",className:"inline-flex h-8 w-8 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground",onClick:()=>le(!1),"aria-label":Q("common.close"),children:a.jsx(Kn,{size:16})})]}),a.jsxs("div",{className:"max-h-[calc(min(78svh,620px)-72px)] overflow-y-auto overscroll-contain p-2",children:[a.jsxs("button",{type:"button",disabled:Ht,onClick:()=>{Nn()},className:"flex w-full items-center gap-3 rounded-xl px-3 py-3 text-left transition hover:bg-surface-2 active:bg-surface-elevated disabled:opacity-60",children:[a.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary",children:a.jsx(wi,{size:17})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block text-[13px] font-medium text-foreground",children:Q("tab.splitNew")}),a.jsx("span",{className:"mt-0.5 block text-[11px] text-muted-foreground",children:Q("tab.splitNewHint")})]})]}),Y.filter(U=>U.id!==Mt?.id).length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:Q("tab.splitExistingGroups")}),Y.filter(U=>U.id!==Mt?.id).map((U,ne)=>{const me=U.sessionIds.flatMap(Pt=>{const rr=V.find(er=>er.id===Pt);return rr?[rr]:[]});if(me.length<2)return null;const Me=U.name||`${Q("tab.splitWorkspace")} ${ne+1}`,Ut=me.map(Pt=>Jr(Pt).primary).join(" · ");return a.jsxs("button",{type:"button",onClick:()=>Vr(me[0].id),className:"group flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left transition hover:bg-surface-2 active:bg-surface-elevated",children:[a.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:a.jsx(dl,{size:15})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium text-foreground",children:Me}),a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium text-primary",children:Q("tab.splitOccupied")})]}),a.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[Q("tab.sessionCount",{count:me.length})," · ",Ut]})]}),a.jsx(ua,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},U.id)})]}),a.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:Q("tab.splitAvailableSessions")}),V.filter(U=>!Y.some(ne=>ne.sessionIds.includes(U.id))&&U.id!==te).length===0&&Y.filter(U=>U.id!==Mt?.id).length===0?a.jsx("p",{className:"px-3 py-4 text-[12px] text-muted-foreground",children:Q("tab.splitNoOtherSessions")}):V.filter(U=>!Y.some(ne=>ne.sessionIds.includes(U.id))&&U.id!==te).map(U=>{const ne=hn.get(U.id)??null,me=Jr(U);return a.jsxs("button",{type:"button",onClick:()=>Vr(U.id),className:"group flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left transition hover:bg-surface-2 active:bg-surface-elevated",children:[a.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground",children:ne?a.jsx(hc,{size:15}):a.jsx(dl,{size:15})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-[12px] font-medium text-foreground",children:me.primary}),a.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:ne?xu(ne)??ne:U.name})]}),a.jsx(ua,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},U.id)})]})]})]}),pe&&a.jsx("div",{className:"fixed inset-x-3 bottom-4 z-toast mx-auto max-w-md rounded-xl border border-border/20 bg-surface-elevated px-4 py-3 text-center text-[12px] text-foreground shadow-lg",children:pe})]})},wI={sm:"h-4 w-7",md:"h-6 w-10"},AI={sm:"h-3 w-3",md:"h-5 w-5"},TI={sm:"translate-x-3",md:"translate-x-4"};function qo({checked:e,disabled:t=!1,size:r="md",className:n=""}){return a.jsx("span",{"aria-hidden":"true",className:`inline-flex shrink-0 items-center rounded-full transition ${wI[r]} ${e?"bg-primary":"bg-surface-elevated"} ${t?"opacity-50":""} ${n}`,children:a.jsx("span",{className:`mx-0.5 inline-block rounded-full bg-[var(--background)] shadow transition ${AI[r]} ${e?TI[r]:""}`})})}function Vi(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var CI=typeof Symbol=="function"&&Symbol.observable||"@@observable",D2=CI,B2=()=>Math.random().toString(36).substring(7).split("").join("."),SI={INIT:`@@redux/INIT${B2()}`,REPLACE:`@@redux/REPLACE${B2()}`},Q2=SI;function _I(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function T3(e,t,r){if(typeof e!="function")throw new Error(Vi(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Vi(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Vi(1));return r(T3)(e,t)}let n=e,i=t,l=new Map,c=l,h=0,p=!1;function g(){c===l&&(c=new Map,l.forEach((I,M)=>{c.set(M,I)}))}function x(){if(p)throw new Error(Vi(3));return i}function b(I){if(typeof I!="function")throw new Error(Vi(4));if(p)throw new Error(Vi(5));let M=!0;g();const Q=h++;return c.set(Q,I),function(){if(M){if(p)throw new Error(Vi(6));M=!1,g(),c.delete(Q),l=null}}}function w(I){if(!_I(I))throw new Error(Vi(7));if(typeof I.type>"u")throw new Error(Vi(8));if(typeof I.type!="string")throw new Error(Vi(17));if(p)throw new Error(Vi(9));try{p=!0,i=n(i,I)}finally{p=!1}return(l=c).forEach(Q=>{Q()}),I}function A(I){if(typeof I!="function")throw new Error(Vi(10));n=I,w({type:Q2.REPLACE})}function k(){const I=b;return{subscribe(M){if(typeof M!="object"||M===null)throw new Error(Vi(11));function Q(){const F=M;F.next&&F.next(x())}return Q(),{unsubscribe:I(Q)}},[D2](){return this}}}return w({type:Q2.INIT}),{dispatch:w,subscribe:b,getState:x,replaceReducer:A,[D2]:k}}function j2(e,t){return function(...r){return t(e.apply(this,r))}}function P2(e,t){if(typeof e=="function")return j2(e,t);if(typeof e!="object"||e===null)throw new Error(Vi(16));const r={};for(const n in e){const i=e[n];typeof i=="function"&&(r[n]=j2(i,t))}return r}function C3(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function LI(...e){return t=>(r,n)=>{const i=t(r,n);let l=()=>{throw new Error(Vi(15))};const c={getState:i.getState,dispatch:(p,...g)=>l(p,...g)},h=e.map(p=>p(c));return l=C3(...h)(i.dispatch),{...i,dispatch:l}}}var Xf={exports:{}},Jf={};var O2;function kI(){if(O2)return Jf;O2=1;var e=B9();function t(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var r=typeof Object.is=="function"?Object.is:t,n=e.useSyncExternalStore,i=e.useRef,l=e.useEffect,c=e.useMemo,h=e.useDebugValue;return Jf.useSyncExternalStoreWithSelector=function(p,g,x,b,w){var A=i(null);if(A.current===null){var k={hasValue:!1,value:null};A.current=k}else k=A.current;A=c(function(){function I(V){if(!M){if(M=!0,Q=V,V=b(V),w!==void 0&&k.hasValue){var $=k.value;if(w($,V))return j=$}return j=V}if($=j,r(Q,V))return $;var te=b(V);return w!==void 0&&w($,te)?(Q=V,$):(Q=V,j=te)}var M=!1,Q,j,F=x===void 0?null:x;return[function(){return I(g())},F===null?void 0:function(){return I(F())}]},[g,x,b,w]);var E=n(p,A[0],A[1]);return l(function(){k.hasValue=!0,k.value=E},[E]),h(E),E},Jf}var F2;function II(){return F2||(F2=1,Xf.exports=kI()),Xf.exports}II();var EI=y.version.startsWith("19"),NI=Symbol.for(EI?"react.transitional.element":"react.element"),RI=Symbol.for("react.portal"),MI=Symbol.for("react.fragment"),DI=Symbol.for("react.strict_mode"),BI=Symbol.for("react.profiler"),QI=Symbol.for("react.consumer"),jI=Symbol.for("react.context"),S3=Symbol.for("react.forward_ref"),PI=Symbol.for("react.suspense"),OI=Symbol.for("react.suspense_list"),F1=Symbol.for("react.memo"),FI=Symbol.for("react.lazy"),$I=S3,UI=F1;function zI(e){if(typeof e=="object"&&e!==null){const{$$typeof:t}=e;switch(t){case NI:switch(e=e.type,e){case MI:case BI:case DI:case PI:case OI:return e;default:switch(e=e&&e.$$typeof,e){case jI:case S3:case FI:case F1:return e;case QI:return e;default:return t}}case RI:return t}}}function HI(e){return zI(e)===F1}function WI(e,t,r,n,{areStatesEqual:i,areOwnPropsEqual:l,areStatePropsEqual:c}){let h=!1,p,g,x,b,w;function A(Q,j){return p=Q,g=j,x=e(p,g),b=t(n,g),w=r(x,b,g),h=!0,w}function k(){return x=e(p,g),t.dependsOnOwnProps&&(b=t(n,g)),w=r(x,b,g),w}function E(){return e.dependsOnOwnProps&&(x=e(p,g)),t.dependsOnOwnProps&&(b=t(n,g)),w=r(x,b,g),w}function I(){const Q=e(p,g),j=!c(Q,x);return x=Q,j&&(w=r(x,b,g)),w}function M(Q,j){const F=!l(j,g),V=!i(Q,p,j,g);return p=Q,g=j,F&&V?k():F?E():V?I():w}return function(j,F){return h?M(j,F):A(j,F)}}function GI(e,{initMapStateToProps:t,initMapDispatchToProps:r,initMergeProps:n,...i}){const l=t(e,i),c=r(e,i),h=n(e,i);return WI(l,c,h,e,i)}function VI(e,t){const r={};for(const n in e){const i=e[n];typeof i=="function"&&(r[n]=(...l)=>t(i(...l)))}return r}function s1(e){return function(r){const n=e(r);function i(){return n}return i.dependsOnOwnProps=!1,i}}function $2(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:e.length!==1}function _3(e,t){return function(n,{displayName:i}){const l=function(h,p){return l.dependsOnOwnProps?l.mapToProps(h,p):l.mapToProps(h,void 0)};return l.dependsOnOwnProps=!0,l.mapToProps=function(h,p){l.mapToProps=e,l.dependsOnOwnProps=$2(e);let g=l(h,p);return typeof g=="function"&&(l.mapToProps=g,l.dependsOnOwnProps=$2(g),g=l(h,p)),g},l}}function $1(e,t){return(r,n)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${n.wrappedComponentName}.`)}}function qI(e){return e&&typeof e=="object"?s1(t=>VI(e,t)):e?typeof e=="function"?_3(e):$1(e,"mapDispatchToProps"):s1(t=>({dispatch:t}))}function YI(e){return e?typeof e=="function"?_3(e):$1(e,"mapStateToProps"):s1(()=>({}))}function ZI(e,t,r){return{...r,...e,...t}}function KI(e){return function(r,{displayName:n,areMergedPropsEqual:i}){let l=!1,c;return function(p,g,x){const b=e(p,g,x);return l?i(b,c)||(c=b):(l=!0,c=b),c}}}function XI(e){return e?typeof e=="function"?KI(e):$1(e,"mergeProps"):()=>ZI}function JI(e){e()}function eE(){let e=null,t=null;return{clear(){e=null,t=null},notify(){JI(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const i=t={callback:r,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!n||e===null||(n=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var U2={notify(){},get:()=>[]};function L3(e,t){let r,n=U2,i=0,l=!1;function c(E){x();const I=n.subscribe(E);let M=!1;return()=>{M||(M=!0,I(),b())}}function h(){n.notify()}function p(){k.onStateChange&&k.onStateChange()}function g(){return l}function x(){i++,r||(r=t?t.addNestedSub(p):e.subscribe(p),n=eE())}function b(){i--,r&&i===0&&(r(),r=void 0,n.clear(),n=U2)}function w(){l||(l=!0,x())}function A(){l&&(l=!1,b())}const k={addNestedSub:c,notifyNestedSubs:h,handleChangeWrapper:p,isSubscribed:g,trySubscribe:w,tryUnsubscribe:A,getListeners:()=>n};return k}var tE=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",rE=tE(),nE=()=>typeof navigator<"u"&&navigator.product==="ReactNative",sE=nE(),iE=()=>rE||sE?y.useLayoutEffect:y.useEffect,gh=iE();function z2(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function ep(e,t){if(z2(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i=0;i<r.length;i++)if(!Object.prototype.hasOwnProperty.call(t,r[i])||!z2(e[r[i]],t[r[i]]))return!1;return!0}var aE={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},oE={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},lE={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},k3={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},cE={[$I]:lE,[UI]:k3};function H2(e){return HI(e)?k3:cE[e.$$typeof]||aE}var uE=Object.defineProperty,dE=Object.getOwnPropertyNames,W2=Object.getOwnPropertySymbols,hE=Object.getOwnPropertyDescriptor,fE=Object.getPrototypeOf,G2=Object.prototype;function i1(e,t){if(typeof t!="string"){if(G2){const l=fE(t);l&&l!==G2&&i1(e,l)}let r=dE(t);W2&&(r=r.concat(W2(t)));const n=H2(e),i=H2(t);for(let l=0;l<r.length;++l){const c=r[l];if(!oE[c]&&!(i&&i[c])&&!(n&&n[c])){const h=hE(t,c);try{uE(e,c,h)}catch{}}}}return e}var pE=Symbol.for("react-redux-context"),mE=typeof globalThis<"u"?globalThis:{};function gE(){if(!y.createContext)return{};const e=mE[pE]??=new Map;let t=e.get(y.createContext);return t||(t=y.createContext(null),e.set(y.createContext,t)),t}var I3=gE(),xE=[null,null];function bE(e,t,r){gh(()=>e(...t),r)}function yE(e,t,r,n,i,l){e.current=n,r.current=!1,i.current&&(i.current=null,l())}function vE(e,t,r,n,i,l,c,h,p,g,x){if(!e)return()=>{};let b=!1,w=null;const A=()=>{if(b||!h.current)return;const E=t.getState();let I,M;try{I=n(E,i.current)}catch(Q){M=Q,w=Q}M||(w=null),I===l.current?c.current||g():(l.current=I,p.current=I,c.current=!0,x())};return r.onStateChange=A,r.trySubscribe(),A(),()=>{if(b=!0,r.tryUnsubscribe(),r.onStateChange=null,w)throw w}}function wE(e,t){return e===t}function AE(e,t,r,{pure:n,areStatesEqual:i=wE,areOwnPropsEqual:l=ep,areStatePropsEqual:c=ep,areMergedPropsEqual:h=ep,forwardRef:p=!1,context:g=I3}={}){const x=g,b=YI(e),w=qI(t),A=XI(r),k=!!e;return I=>{const M=I.displayName||I.name||"Component",Q=`Connect(${M})`,j={shouldHandleStateChanges:k,displayName:Q,wrappedComponentName:M,WrappedComponent:I,initMapStateToProps:b,initMapDispatchToProps:w,initMergeProps:A,areStatesEqual:i,areStatePropsEqual:c,areOwnPropsEqual:l,areMergedPropsEqual:h};function F(te){const[se,qe,de]=y.useMemo(()=>{const{reactReduxForwardedRef:it,...ht}=te;return[te.context,it,ht]},[te]),oe=y.useMemo(()=>{let it=x;return se?.Consumer,it},[se,x]),Oe=y.useContext(oe),et=!!te.store&&!!te.store.getState&&!!te.store.dispatch,ce=!!Oe&&!!Oe.store,Be=et?te.store:Oe.store,ot=ce?Oe.getServerState:Be.getState,Ie=y.useMemo(()=>GI(Be.dispatch,j),[Be]),[re,Ue]=y.useMemo(()=>{if(!k)return xE;const it=L3(Be,et?void 0:Oe.subscription),ht=it.notifyNestedSubs.bind(it);return[it,ht]},[Be,et,Oe]),_e=y.useMemo(()=>et?Oe:{...Oe,subscription:re},[et,Oe,re]),K=y.useRef(void 0),Le=y.useRef(de),fe=y.useRef(void 0),$e=y.useRef(!1),ze=y.useRef(!1),Ee=y.useRef(void 0);gh(()=>(ze.current=!0,()=>{ze.current=!1}),[]);const ee=y.useMemo(()=>()=>fe.current&&de===Le.current?fe.current:Ie(Be.getState(),de),[Be,de]),Ke=y.useMemo(()=>ht=>re?vE(k,Be,re,Ie,Le,K,$e,ze,fe,Ue,ht):()=>{},[re]);bE(yE,[Le,K,$e,de,fe,Ue]);let wt;try{wt=y.useSyncExternalStore(Ke,ee,ot?()=>Ie(ot(),de):ee)}catch(it){throw Ee.current&&(it.message+=`
|
|
71
|
-
The error may be correlated with this previous error:
|
|
72
|
-
${Ee.current.stack}
|
|
73
|
-
|
|
74
|
-
`),it}gh(()=>{Ee.current=void 0,fe.current=void 0,K.current=wt});const tt=y.useMemo(()=>y.createElement(I,{...wt,ref:qe}),[qe,I,wt]);return y.useMemo(()=>k?y.createElement(oe.Provider,{value:_e},tt):tt,[oe,tt,_e])}const $=y.memo(F);if($.WrappedComponent=I,$.displayName=F.displayName=Q,p){const se=y.forwardRef(function(de,oe){return y.createElement($,{...de,reactReduxForwardedRef:oe})});return se.displayName=Q,se.WrappedComponent=I,i1(se,I)}return i1($,I)}}var E3=AE;function TE(e){const{children:t,context:r,serverState:n,store:i}=e,l=y.useMemo(()=>{const p=L3(i);return{store:i,subscription:p,getServerState:n?()=>n:void 0}},[i,n]),c=y.useMemo(()=>i.getState(),[i]);gh(()=>{const{subscription:p}=l;return p.onStateChange=p.notifyNestedSubs,p.trySubscribe(),c!==i.getState()&&p.notifyNestedSubs(),()=>{p.tryUnsubscribe(),p.onStateChange=void 0}},[l,c]);const h=r||I3;return y.createElement(h.Provider,{value:l},t)}var CE=TE,SE="Invariant failed";function _E(e,t){throw new Error(SE)}var Lo=function(t){var r=t.top,n=t.right,i=t.bottom,l=t.left,c=n-l,h=i-r,p={top:r,right:n,bottom:i,left:l,width:c,height:h,x:l,y:r,center:{x:(n+l)/2,y:(i+r)/2}};return p},U1=function(t,r){return{top:t.top-r.top,left:t.left-r.left,bottom:t.bottom+r.bottom,right:t.right+r.right}},V2=function(t,r){return{top:t.top+r.top,left:t.left+r.left,bottom:t.bottom-r.bottom,right:t.right-r.right}},LE=function(t,r){return{top:t.top+r.y,left:t.left+r.x,bottom:t.bottom+r.y,right:t.right+r.x}},tp={top:0,right:0,bottom:0,left:0},z1=function(t){var r=t.borderBox,n=t.margin,i=n===void 0?tp:n,l=t.border,c=l===void 0?tp:l,h=t.padding,p=h===void 0?tp:h,g=Lo(U1(r,i)),x=Lo(V2(r,c)),b=Lo(V2(x,p));return{marginBox:g,borderBox:Lo(r),paddingBox:x,contentBox:b,margin:i,border:c,padding:p}},to=function(t){var r=t.slice(0,-2),n=t.slice(-2);if(n!=="px")return 0;var i=Number(r);return isNaN(i)&&_E(),i},kE=function(){return{x:window.pageXOffset,y:window.pageYOffset}},xh=function(t,r){var n=t.borderBox,i=t.border,l=t.margin,c=t.padding,h=LE(n,r);return z1({borderBox:h,border:i,margin:l,padding:c})},bh=function(t,r){return r===void 0&&(r=kE()),xh(t,r)},N3=function(t,r){var n={top:to(r.marginTop),right:to(r.marginRight),bottom:to(r.marginBottom),left:to(r.marginLeft)},i={top:to(r.paddingTop),right:to(r.paddingRight),bottom:to(r.paddingBottom),left:to(r.paddingLeft)},l={top:to(r.borderTopWidth),right:to(r.borderRightWidth),bottom:to(r.borderBottomWidth),left:to(r.borderLeftWidth)};return z1({borderBox:t,margin:n,padding:i,border:l})},R3=function(t){var r=t.getBoundingClientRect(),n=window.getComputedStyle(t);return N3(r,n)},_u=function(t){var r=[],n=null,i=function(){for(var c=arguments.length,h=new Array(c),p=0;p<c;p++)h[p]=arguments[p];r=h,!n&&(n=requestAnimationFrame(function(){n=null,t.apply(void 0,r)}))};return i.cancel=function(){n&&(cancelAnimationFrame(n),n=null)},i};function yh(){return yh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},yh.apply(null,arguments)}function M3(e,t){}M3.bind(null,"warn");M3.bind(null,"error");function Bl(){}function IE(e,t){return{...e,...t}}function ao(e,t,r){const n=t.map(i=>{const l=IE(r,i.options);return e.addEventListener(i.eventName,i.fn,l),function(){e.removeEventListener(i.eventName,i.fn,l)}});return function(){n.forEach(l=>{l()})}}const EE="Invariant failed";class vh extends Error{}vh.prototype.toString=function(){return this.message};function Ft(e,t){throw new vh(EE)}class NE extends C.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=Bl,this.onWindowError=r=>{const n=this.getCallbacks();n.isDragging()&&n.tryAbort(),r.error instanceof vh&&r.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=r=>{this.callbacks=r}}componentDidMount(){this.unbind=ao(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof vh){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const RE=`
|
|
75
|
-
Press space bar to start a drag.
|
|
76
|
-
When dragging you can use the arrow keys to move the item around and escape to cancel.
|
|
77
|
-
Some screen readers may require you to be in focus mode or to use your pass through key
|
|
78
|
-
`,wh=e=>e+1,ME=e=>`
|
|
79
|
-
You have lifted an item in position ${wh(e.source.index)}
|
|
80
|
-
`,D3=(e,t)=>{const r=e.droppableId===t.droppableId,n=wh(e.index),i=wh(t.index);return r?`
|
|
81
|
-
You have moved the item from position ${n}
|
|
82
|
-
to position ${i}
|
|
83
|
-
`:`
|
|
84
|
-
You have moved the item from position ${n}
|
|
85
|
-
in list ${e.droppableId}
|
|
86
|
-
to list ${t.droppableId}
|
|
87
|
-
in position ${i}
|
|
88
|
-
`},B3=(e,t,r)=>t.droppableId===r.droppableId?`
|
|
89
|
-
The item ${e}
|
|
90
|
-
has been combined with ${r.draggableId}`:`
|
|
91
|
-
The item ${e}
|
|
92
|
-
in list ${t.droppableId}
|
|
93
|
-
has been combined with ${r.draggableId}
|
|
94
|
-
in list ${r.droppableId}
|
|
95
|
-
`,DE=e=>{const t=e.destination;if(t)return D3(e.source,t);const r=e.combine;return r?B3(e.draggableId,e.source,r):"You are over an area that cannot be dropped on"},q2=e=>`
|
|
96
|
-
The item has returned to its starting position
|
|
97
|
-
of ${wh(e.index)}
|
|
98
|
-
`,BE=e=>{if(e.reason==="CANCEL")return`
|
|
99
|
-
Movement cancelled.
|
|
100
|
-
${q2(e.source)}
|
|
101
|
-
`;const t=e.destination,r=e.combine;return t?`
|
|
102
|
-
You have dropped the item.
|
|
103
|
-
${D3(e.source,t)}
|
|
104
|
-
`:r?`
|
|
105
|
-
You have dropped the item.
|
|
106
|
-
${B3(e.draggableId,e.source,r)}
|
|
107
|
-
`:`
|
|
108
|
-
The item has been dropped while not over a drop area.
|
|
109
|
-
${q2(e.source)}
|
|
110
|
-
`},eh={dragHandleUsageInstructions:RE,onDragStart:ME,onDragUpdate:DE,onDragEnd:BE};function QE(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function Q3(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!QE(e[r],t[r]))return!1;return!0}function bn(e,t){const r=y.useState(()=>({inputs:t,result:e()}))[0],n=y.useRef(!0),i=y.useRef(r),c=n.current||!!(t&&i.current.inputs&&Q3(t,i.current.inputs))?i.current:{inputs:t,result:e()};return y.useEffect(()=>{n.current=!1,i.current=c},[c]),c.result}function vr(e,t){return bn(()=>e,t)}const si={x:0,y:0},Ti=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),Na=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),Ql=(e,t)=>e.x===t.x&&e.y===t.y,a0=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),pc=(e,t,r=0)=>e==="x"?{x:t,y:r}:{x:r,y:t},Lu=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),Y2=(e,t)=>Math.min(...t.map(r=>Lu(e,r))),j3=e=>t=>({x:e(t.x),y:e(t.y)});var jE=(e,t)=>{const r=Lo({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return r.width<=0||r.height<=0?null:r};const $u=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),Z2=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],PE={top:0,right:0,bottom:0,left:0},OE=(e,t)=>t?$u(e,t.scroll.diff.displacement):e,FE=(e,t,r)=>r&&r.increasedBy?{...e,[t.end]:e[t.end]+r.increasedBy[t.line]}:e,$E=(e,t)=>t&&t.shouldClipSubject?jE(t.pageMarginBox,e):Lo(e);var Jc=({page:e,withPlaceholder:t,axis:r,frame:n})=>{const i=OE(e.marginBox,n),l=FE(i,r,t),c=$E(l,n);return{page:e,withPlaceholder:t,active:c}},H1=(e,t)=>{e.frame||Ft();const r=e.frame,n=Na(t,r.scroll.initial),i=a0(n),l={...r,scroll:{initial:r.scroll.initial,current:t,diff:{value:n,displacement:i},max:r.scroll.max}},c=Jc({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:l});return{...e,frame:l,subject:c}};function ni(e,t=Q3){let r=null;function n(...i){if(r&&r.lastThis===this&&t(i,r.lastArgs))return r.lastResult;const l=e.apply(this,i);return r={lastResult:l,lastArgs:i,lastThis:this},l}return n.clear=function(){r=null},n}const P3=ni(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),O3=ni(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),Ph=ni(e=>Object.values(e)),UE=ni(e=>Object.values(e));var o0=ni((e,t)=>UE(t).filter(n=>e===n.descriptor.droppableId).sort((n,i)=>n.descriptor.index-i.descriptor.index));function W1(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function Oh(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var Fh=ni((e,t)=>t.filter(r=>r.descriptor.id!==e.descriptor.id)),zE=({isMovingForward:e,draggable:t,destination:r,insideDestination:n,previousImpact:i})=>{if(!r.isCombineEnabled||!W1(i))return null;function c(A){const k={type:"COMBINE",combine:{draggableId:A,droppableId:r.descriptor.id}};return{...i,at:k}}const h=i.displaced.all,p=h.length?h[0]:null;if(e)return p?c(p):null;const g=Fh(t,n);if(!p){if(!g.length)return null;const A=g[g.length-1];return c(A.descriptor.id)}const x=g.findIndex(A=>A.descriptor.id===p);x===-1&&Ft();const b=x-1;if(b<0)return null;const w=g[b];return c(w.descriptor.id)},l0=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const F3={point:si,value:0},ku={invisible:{},visible:{},all:[]},HE={displaced:ku,displacedBy:F3,at:null};var oo=(e,t)=>r=>e<=r&&r<=t,$3=e=>{const t=oo(e.top,e.bottom),r=oo(e.left,e.right);return n=>{if(t(n.top)&&t(n.bottom)&&r(n.left)&&r(n.right))return!0;const l=t(n.top)||t(n.bottom),c=r(n.left)||r(n.right);if(l&&c)return!0;const p=n.top<e.top&&n.bottom>e.bottom,g=n.left<e.left&&n.right>e.right;return p&&g?!0:p&&c||g&&l}},WE=e=>{const t=oo(e.top,e.bottom),r=oo(e.left,e.right);return n=>t(n.top)&&t(n.bottom)&&r(n.left)&&r(n.right)};const G1={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},U3={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var GE=e=>t=>{const r=oo(t.top,t.bottom),n=oo(t.left,t.right);return i=>e===G1?r(i.top)&&r(i.bottom):n(i.left)&&n(i.right)};const VE=(e,t)=>{const r=t.frame?t.frame.scroll.diff.displacement:si;return $u(e,r)},qE=(e,t,r)=>t.subject.active?r(t.subject.active)(e):!1,YE=(e,t,r)=>r(t)(e),V1=({target:e,destination:t,viewport:r,withDroppableDisplacement:n,isVisibleThroughFrameFn:i})=>{const l=n?VE(e,t):e;return qE(l,t,i)&&YE(l,r,i)},ZE=e=>V1({...e,isVisibleThroughFrameFn:$3}),z3=e=>V1({...e,isVisibleThroughFrameFn:WE}),KE=e=>V1({...e,isVisibleThroughFrameFn:GE(e.destination.axis)}),XE=(e,t,r)=>{if(typeof r=="boolean")return r;if(!t)return!0;const{invisible:n,visible:i}=t;if(n[e])return!1;const l=i[e];return l?l.shouldAnimate:!0};function JE(e,t){const r=e.page.marginBox,n={top:t.point.y,right:0,bottom:0,left:t.point.x};return Lo(U1(r,n))}function Iu({afterDragging:e,destination:t,displacedBy:r,viewport:n,forceShouldAnimate:i,last:l}){return e.reduce(function(h,p){const g=JE(p,r),x=p.descriptor.id;if(h.all.push(x),!ZE({target:g,destination:t,viewport:n,withDroppableDisplacement:!0}))return h.invisible[p.descriptor.id]=!0,h;const w=XE(x,l,i),A={draggableId:x,shouldAnimate:w};return h.visible[x]=A,h},{all:[],visible:{},invisible:{}})}function eN(e,t){if(!e.length)return 0;const r=e[e.length-1].descriptor.index;return t.inHomeList?r:r+1}function K2({insideDestination:e,inHomeList:t,displacedBy:r,destination:n}){const i=eN(e,{inHomeList:t});return{displaced:ku,displacedBy:r,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:i}}}}function Ah({draggable:e,insideDestination:t,destination:r,viewport:n,displacedBy:i,last:l,index:c,forceShouldAnimate:h}){const p=l0(e,r);if(c==null)return K2({insideDestination:t,inHomeList:p,displacedBy:i,destination:r});const g=t.find(k=>k.descriptor.index===c);if(!g)return K2({insideDestination:t,inHomeList:p,displacedBy:i,destination:r});const x=Fh(e,t),b=t.indexOf(g),w=x.slice(b);return{displaced:Iu({afterDragging:w,destination:r,displacedBy:i,last:l,viewport:n.frame,forceShouldAnimate:h}),displacedBy:i,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:c}}}}function Fl(e,t){return!!t.effected[e]}var tN=({isMovingForward:e,destination:t,draggables:r,combine:n,afterCritical:i})=>{if(!t.isCombineEnabled)return null;const l=n.draggableId,h=r[l].descriptor.index;return Fl(l,i)?e?h:h-1:e?h+1:h},rN=({isMovingForward:e,isInHomeList:t,insideDestination:r,location:n})=>{if(!r.length)return null;const i=n.index,l=e?i+1:i-1,c=r[0].descriptor.index,h=r[r.length-1].descriptor.index,p=t?h:h+1;return l<c||l>p?null:l},nN=({isMovingForward:e,isInHomeList:t,draggable:r,draggables:n,destination:i,insideDestination:l,previousImpact:c,viewport:h,afterCritical:p})=>{const g=c.at;if(g||Ft(),g.type==="REORDER"){const b=rN({isMovingForward:e,isInHomeList:t,location:g.destination,insideDestination:l});return b==null?null:Ah({draggable:r,insideDestination:l,destination:i,viewport:h,last:c.displaced,displacedBy:c.displacedBy,index:b})}const x=tN({isMovingForward:e,destination:i,displaced:c.displaced,draggables:n,combine:g.combine,afterCritical:p});return x==null?null:Ah({draggable:r,insideDestination:l,destination:i,viewport:h,last:c.displaced,displacedBy:c.displacedBy,index:x})},sN=({displaced:e,afterCritical:t,combineWith:r,displacedBy:n})=>{const i=!!(e.visible[r]||e.invisible[r]);return Fl(r,t)?i?si:a0(n.point):i?n.point:si},iN=({afterCritical:e,impact:t,draggables:r})=>{const n=Oh(t);n||Ft();const i=n.draggableId,l=r[i].page.borderBox.center,c=sN({displaced:t.displaced,afterCritical:e,combineWith:i,displacedBy:t.displacedBy});return Ti(l,c)};const H3=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,aN=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,q1=(e,t,r)=>t[e.crossAxisStart]+r.margin[e.crossAxisStart]+r.borderBox[e.crossAxisSize]/2,X2=({axis:e,moveRelativeTo:t,isMoving:r})=>pc(e.line,t.marginBox[e.end]+H3(e,r),q1(e,t.marginBox,r)),J2=({axis:e,moveRelativeTo:t,isMoving:r})=>pc(e.line,t.marginBox[e.start]-aN(e,r),q1(e,t.marginBox,r)),oN=({axis:e,moveInto:t,isMoving:r})=>pc(e.line,t.contentBox[e.start]+H3(e,r),q1(e,t.contentBox,r));var lN=({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:i})=>{const l=o0(n.descriptor.id,r),c=t.page,h=n.axis;if(!l.length)return oN({axis:h,moveInto:n.page,isMoving:c});const{displaced:p,displacedBy:g}=e,x=p.all[0];if(x){const w=r[x];if(Fl(x,i))return J2({axis:h,moveRelativeTo:w.page,isMoving:c});const A=xh(w.page,g.point);return J2({axis:h,moveRelativeTo:A,isMoving:c})}const b=l[l.length-1];if(b.descriptor.id===t.descriptor.id)return c.borderBox.center;if(Fl(b.descriptor.id,i)){const w=xh(b.page,a0(i.displacedBy.point));return X2({axis:h,moveRelativeTo:w,isMoving:c})}return X2({axis:h,moveRelativeTo:b.page,isMoving:c})},a1=(e,t)=>{const r=e.frame;return r?Ti(t,r.scroll.diff.displacement):t};const cN=({impact:e,draggable:t,droppable:r,draggables:n,afterCritical:i})=>{const l=t.page.borderBox.center,c=e.at;return!r||!c?l:c.type==="REORDER"?lN({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:i}):iN({impact:e,draggables:n,afterCritical:i})};var $h=e=>{const t=cN(e),r=e.droppable;return r?a1(r,t):t},W3=(e,t)=>{const r=Na(t,e.scroll.initial),n=a0(r);return{frame:Lo({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:r,displacement:n}}}};function e5(e,t){return e.map(r=>t[r])}function uN(e,t){for(let r=0;r<t.length;r++){const n=t[r].visible[e];if(n)return n}return null}var dN=({impact:e,viewport:t,destination:r,draggables:n,maxScrollChange:i})=>{const l=W3(t,Ti(t.scroll.current,i)),c=r.frame?H1(r,Ti(r.frame.scroll.current,i)):r,h=e.displaced,p=Iu({afterDragging:e5(h.all,n),destination:r,displacedBy:e.displacedBy,viewport:l.frame,last:h,forceShouldAnimate:!1}),g=Iu({afterDragging:e5(h.all,n),destination:c,displacedBy:e.displacedBy,viewport:t.frame,last:h,forceShouldAnimate:!1}),x={},b={},w=[h,p,g];return h.all.forEach(k=>{const E=uN(k,w);if(E){b[k]=E;return}x[k]=!0}),{...e,displaced:{all:h.all,invisible:x,visible:b}}},hN=(e,t)=>Ti(e.scroll.diff.displacement,t),Y1=({pageBorderBoxCenter:e,draggable:t,viewport:r})=>{const n=hN(r,e),i=Na(n,t.page.borderBox.center);return Ti(t.client.borderBox.center,i)},G3=({draggable:e,destination:t,newPageBorderBoxCenter:r,viewport:n,withDroppableDisplacement:i,onlyOnMainAxis:l=!1})=>{const c=Na(r,e.page.borderBox.center),p={target:$u(e.page.borderBox,c),destination:t,withDroppableDisplacement:i,viewport:n};return l?KE(p):z3(p)},fN=({isMovingForward:e,draggable:t,destination:r,draggables:n,previousImpact:i,viewport:l,previousPageBorderBoxCenter:c,previousClientSelection:h,afterCritical:p})=>{if(!r.isEnabled)return null;const g=o0(r.descriptor.id,n),x=l0(t,r),b=zE({isMovingForward:e,draggable:t,destination:r,insideDestination:g,previousImpact:i})||nN({isMovingForward:e,isInHomeList:x,draggable:t,draggables:n,destination:r,insideDestination:g,previousImpact:i,viewport:l,afterCritical:p});if(!b)return null;const w=$h({impact:b,draggable:t,droppable:r,draggables:n,afterCritical:p});if(G3({draggable:t,destination:r,newPageBorderBoxCenter:w,viewport:l.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:Y1({pageBorderBoxCenter:w,draggable:t,viewport:l}),impact:b,scrollJumpRequest:null};const k=Na(w,c),E=dN({impact:b,viewport:l,destination:r,draggables:n,maxScrollChange:k});return{clientSelection:h,impact:E,scrollJumpRequest:k}};const Hi=e=>{const t=e.subject.active;return t||Ft(),t};var pN=({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:n,viewport:i})=>{const l=r.subject.active;if(!l)return null;const c=r.axis,h=oo(l[c.start],l[c.end]),p=Ph(n).filter(x=>x!==r).filter(x=>x.isEnabled).filter(x=>!!x.subject.active).filter(x=>$3(i.frame)(Hi(x))).filter(x=>{const b=Hi(x);return e?l[c.crossAxisEnd]<b[c.crossAxisEnd]:b[c.crossAxisStart]<l[c.crossAxisStart]}).filter(x=>{const b=Hi(x),w=oo(b[c.start],b[c.end]);return h(b[c.start])||h(b[c.end])||w(l[c.start])||w(l[c.end])}).sort((x,b)=>{const w=Hi(x)[c.crossAxisStart],A=Hi(b)[c.crossAxisStart];return e?w-A:A-w}).filter((x,b,w)=>Hi(x)[c.crossAxisStart]===Hi(w[0])[c.crossAxisStart]);if(!p.length)return null;if(p.length===1)return p[0];const g=p.filter(x=>oo(Hi(x)[c.start],Hi(x)[c.end])(t[c.line]));return g.length===1?g[0]:g.length>1?g.sort((x,b)=>Hi(x)[c.start]-Hi(b)[c.start])[0]:p.sort((x,b)=>{const w=Y2(t,Z2(Hi(x))),A=Y2(t,Z2(Hi(b)));return w!==A?w-A:Hi(x)[c.start]-Hi(b)[c.start]})[0]};const t5=(e,t)=>{const r=e.page.borderBox.center;return Fl(e.descriptor.id,t)?Na(r,t.displacedBy.point):r},mN=(e,t)=>{const r=e.page.borderBox;return Fl(e.descriptor.id,t)?$u(r,a0(t.displacedBy.point)):r};var gN=({pageBorderBoxCenter:e,viewport:t,destination:r,insideDestination:n,afterCritical:i})=>n.filter(c=>z3({target:mN(c,i),destination:r,viewport:t.frame,withDroppableDisplacement:!0})).sort((c,h)=>{const p=Lu(e,a1(r,t5(c,i))),g=Lu(e,a1(r,t5(h,i)));return p<g?-1:g<p?1:c.descriptor.index-h.descriptor.index})[0]||null,Uu=ni(function(t,r){const n=r[t.line];return{value:n,point:pc(t.line,n)}});const xN=(e,t,r)=>{const n=e.axis;if(e.descriptor.mode==="virtual")return pc(n.line,t[n.line]);const i=e.subject.page.contentBox[n.size],p=o0(e.descriptor.id,r).reduce((g,x)=>g+x.client.marginBox[n.size],0)+t[n.line]-i;return p<=0?null:pc(n.line,p)},V3=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),q3=(e,t,r)=>{const n=e.frame;l0(t,e)&&Ft(),e.subject.withPlaceholder&&Ft();const i=Uu(e.axis,t.displaceBy).point,l=xN(e,i,r),c={placeholderSize:i,increasedBy:l,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!n){const x=Jc({page:e.subject.page,withPlaceholder:c,axis:e.axis,frame:e.frame});return{...e,subject:x}}const h=l?Ti(n.scroll.max,l):n.scroll.max,p=V3(n,h),g=Jc({page:e.subject.page,withPlaceholder:c,axis:e.axis,frame:p});return{...e,subject:g,frame:p}},bN=e=>{const t=e.subject.withPlaceholder;t||Ft();const r=e.frame;if(!r){const c=Jc({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:c}}const n=t.oldFrameMaxScroll;n||Ft();const i=V3(r,n),l=Jc({page:e.subject.page,axis:e.axis,frame:i,withPlaceholder:null});return{...e,subject:l,frame:i}};var yN=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:r,draggable:n,draggables:i,destination:l,viewport:c,afterCritical:h})=>{if(!t){if(r.length)return null;const b={displaced:ku,displacedBy:F3,at:{type:"REORDER",destination:{droppableId:l.descriptor.id,index:0}}},w=$h({impact:b,draggable:n,droppable:l,draggables:i,afterCritical:h}),A=l0(n,l)?l:q3(l,n,i);return G3({draggable:n,destination:A,newPageBorderBoxCenter:w,viewport:c.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?b:null}const p=e[l.axis.line]<=t.page.borderBox.center[l.axis.line],g=(()=>{const b=t.descriptor.index;return t.descriptor.id===n.descriptor.id||p?b:b+1})(),x=Uu(l.axis,n.displaceBy);return Ah({draggable:n,insideDestination:r,destination:l,viewport:c,displacedBy:x,last:ku,index:g})},vN=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:r,isOver:n,draggables:i,droppables:l,viewport:c,afterCritical:h})=>{const p=pN({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:l,viewport:c});if(!p)return null;const g=o0(p.descriptor.id,i),x=gN({pageBorderBoxCenter:t,viewport:c,destination:p,insideDestination:g,afterCritical:h}),b=yN({previousPageBorderBoxCenter:t,destination:p,draggable:r,draggables:i,moveRelativeTo:x,insideDestination:g,viewport:c,afterCritical:h});if(!b)return null;const w=$h({impact:b,draggable:r,droppable:p,draggables:i,afterCritical:h});return{clientSelection:Y1({pageBorderBoxCenter:w,draggable:r,viewport:c}),impact:b,scrollJumpRequest:null}},Ma=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const wN=(e,t)=>{const r=Ma(e);return r?t[r]:null};var AN=({state:e,type:t})=>{const r=wN(e.impact,e.dimensions.droppables),n=!!r,i=e.dimensions.droppables[e.critical.droppable.id],l=r||i,c=l.axis.direction,h=c==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||c==="horizontal"&&(t==="MOVE_LEFT"||t==="MOVE_RIGHT");if(h&&!n)return null;const p=t==="MOVE_DOWN"||t==="MOVE_RIGHT",g=e.dimensions.draggables[e.critical.draggable.id],x=e.current.page.borderBoxCenter,{draggables:b,droppables:w}=e.dimensions;return h?fN({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:g,destination:l,draggables:b,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):vN({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:g,isOver:l,draggables:b,droppables:w,viewport:e.viewport,afterCritical:e.afterCritical})};function rc(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function Y3(e){const t=oo(e.top,e.bottom),r=oo(e.left,e.right);return function(i){return t(i.y)&&r(i.x)}}function TN(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function CN({pageBorderBox:e,draggable:t,candidates:r}){const n=t.page.borderBox.center,i=r.map(l=>{const c=l.axis,h=pc(l.axis.line,e.center[c.line],l.page.borderBox.center[c.crossAxisLine]);return{id:l.descriptor.id,distance:Lu(n,h)}}).sort((l,c)=>c.distance-l.distance);return i[0]?i[0].id:null}function SN({pageBorderBox:e,draggable:t,droppables:r}){const n=Ph(r).filter(i=>{if(!i.isEnabled)return!1;const l=i.subject.active;if(!l||!TN(e,l))return!1;if(Y3(l)(e.center))return!0;const c=i.axis,h=l.center[c.crossAxisLine],p=e[c.crossAxisStart],g=e[c.crossAxisEnd],x=oo(l[c.crossAxisStart],l[c.crossAxisEnd]),b=x(p),w=x(g);return!b&&!w?!0:b?p<h:g>h});return n.length?n.length===1?n[0].descriptor.id:CN({pageBorderBox:e,draggable:t,candidates:n}):null}const Z3=(e,t)=>Lo($u(e,t));var _N=(e,t)=>{const r=e.frame;return r?Z3(t,r.scroll.diff.value):t};function K3({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function LN({draggable:e,closest:t,inHomeList:r}){return t?r&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var kN=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:r,insideDestination:n,last:i,viewport:l,afterCritical:c})=>{const h=r.axis,p=Uu(r.axis,t.displaceBy),g=p.value,x=e[h.start],b=e[h.end],A=Fh(t,n).find(E=>{const I=E.descriptor.id,M=E.page.borderBox.center[h.line],Q=Fl(I,c),j=K3({displaced:i,id:I});return Q?j?b<=M:x<M-g:j?b<=M+g:x<M})||null,k=LN({draggable:t,closest:A,inHomeList:l0(t,r)});return Ah({draggable:t,insideDestination:n,destination:r,viewport:l,last:i,displacedBy:p,index:k})};const IN=4;var EN=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:r,destination:n,insideDestination:i,afterCritical:l})=>{if(!n.isCombineEnabled)return null;const c=n.axis,h=Uu(n.axis,e.displaceBy),p=h.value,g=t[c.start],x=t[c.end],w=Fh(e,i).find(k=>{const E=k.descriptor.id,I=k.page.borderBox,Q=I[c.size]/IN,j=Fl(E,l),F=K3({displaced:r.displaced,id:E});return j?F?x>I[c.start]+Q&&x<I[c.end]-Q:g>I[c.start]-p+Q&&g<I[c.end]-p-Q:F?x>I[c.start]+p+Q&&x<I[c.end]+p-Q:g>I[c.start]+Q&&g<I[c.end]-Q});return w?{displacedBy:h,displaced:r.displaced,at:{type:"COMBINE",combine:{draggableId:w.descriptor.id,droppableId:n.descriptor.id}}}:null},X3=({pageOffset:e,draggable:t,draggables:r,droppables:n,previousImpact:i,viewport:l,afterCritical:c})=>{const h=Z3(t.page.borderBox,e),p=SN({pageBorderBox:h,draggable:t,droppables:n});if(!p)return HE;const g=n[p],x=o0(g.descriptor.id,r),b=_N(g,h);return EN({pageBorderBoxWithDroppableScroll:b,draggable:t,previousImpact:i,destination:g,insideDestination:x,afterCritical:c})||kN({pageBorderBoxWithDroppableScroll:b,draggable:t,destination:g,insideDestination:x,last:i.displaced,viewport:l,afterCritical:c})},Z1=(e,t)=>({...e,[t.descriptor.id]:t});const NN=({previousImpact:e,impact:t,droppables:r})=>{const n=Ma(e),i=Ma(t);if(!n||n===i)return r;const l=r[n];if(!l.subject.withPlaceholder)return r;const c=bN(l);return Z1(r,c)};var RN=({draggable:e,draggables:t,droppables:r,previousImpact:n,impact:i})=>{const l=NN({previousImpact:n,impact:i,droppables:r}),c=Ma(i);if(!c)return l;const h=r[c];if(l0(e,h)||h.subject.withPlaceholder)return l;const p=q3(h,e,t);return Z1(l,p)},pu=({state:e,clientSelection:t,dimensions:r,viewport:n,impact:i,scrollJumpRequest:l})=>{const c=n||e.viewport,h=r||e.dimensions,p=t||e.current.client.selection,g=Na(p,e.initial.client.selection),x={offset:g,selection:p,borderBoxCenter:Ti(e.initial.client.borderBoxCenter,g)},b={selection:Ti(x.selection,c.scroll.current),borderBoxCenter:Ti(x.borderBoxCenter,c.scroll.current),offset:Ti(x.offset,c.scroll.diff.value)},w={client:x,page:b};if(e.phase==="COLLECTING")return{...e,dimensions:h,viewport:c,current:w};const A=h.draggables[e.critical.draggable.id],k=i||X3({pageOffset:b.offset,draggable:A,draggables:h.draggables,droppables:h.droppables,previousImpact:e.impact,viewport:c,afterCritical:e.afterCritical}),E=RN({draggable:A,impact:k,previousImpact:e.impact,draggables:h.draggables,droppables:h.droppables});return{...e,current:w,dimensions:{draggables:h.draggables,droppables:E},impact:k,viewport:c,scrollJumpRequest:l||null,forceShouldAnimate:l?!1:null}};function MN(e,t){return e.map(r=>t[r])}var J3=({impact:e,viewport:t,draggables:r,destination:n,forceShouldAnimate:i})=>{const l=e.displaced,c=MN(l.all,r),h=Iu({afterDragging:c,destination:n,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:i,last:l});return{...e,displaced:h}},e6=({impact:e,draggable:t,droppable:r,draggables:n,viewport:i,afterCritical:l})=>{const c=$h({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:l});return Y1({pageBorderBoxCenter:c,draggable:t,viewport:i})},t6=({state:e,dimensions:t,viewport:r})=>{e.movementMode!=="SNAP"&&Ft();const n=e.impact,i=r||e.viewport,l=t||e.dimensions,{draggables:c,droppables:h}=l,p=c[e.critical.draggable.id],g=Ma(n);g||Ft();const x=h[g],b=J3({impact:n,viewport:i,destination:x,draggables:c}),w=e6({impact:b,draggable:p,droppable:x,draggables:c,viewport:i,afterCritical:e.afterCritical});return pu({impact:b,clientSelection:w,state:e,dimensions:l,viewport:i})},DN=e=>({index:e.index,droppableId:e.droppableId}),r6=({draggable:e,home:t,draggables:r,viewport:n})=>{const i=Uu(t.axis,e.displaceBy),l=o0(t.descriptor.id,r),c=l.indexOf(e);c===-1&&Ft();const h=l.slice(c+1),p=h.reduce((w,A)=>(w[A.descriptor.id]=!0,w),{}),g={inVirtualList:t.descriptor.mode==="virtual",displacedBy:i,effected:p};return{impact:{displaced:Iu({afterDragging:h,destination:t,displacedBy:i,last:null,viewport:n.frame,forceShouldAnimate:!1}),displacedBy:i,at:{type:"REORDER",destination:DN(e.descriptor)}},afterCritical:g}},BN=(e,t)=>({draggables:e.draggables,droppables:Z1(e.droppables,t)}),QN=({draggable:e,offset:t,initialWindowScroll:r})=>{const n=xh(e.client,t),i=bh(n,r);return{...e,placeholder:{...e.placeholder,client:n},client:n,page:i}},jN=e=>{const t=e.frame;return t||Ft(),t},PN=({additions:e,updatedDroppables:t,viewport:r})=>{const n=r.scroll.diff.value;return e.map(i=>{const l=i.descriptor.droppableId,c=t[l],p=jN(c).scroll.diff.value,g=Ti(n,p);return QN({draggable:i,offset:g,initialWindowScroll:r.scroll.initial})})},ON=({state:e,published:t})=>{const r=t.modified.map(M=>{const Q=e.dimensions.droppables[M.droppableId];return H1(Q,M.scroll)}),n={...e.dimensions.droppables,...P3(r)},i=O3(PN({additions:t.additions,updatedDroppables:n,viewport:e.viewport})),l={...e.dimensions.draggables,...i};t.removals.forEach(M=>{delete l[M]});const c={droppables:n,draggables:l},h=Ma(e.impact),p=h?c.droppables[h]:null,g=c.draggables[e.critical.draggable.id],x=c.droppables[e.critical.droppable.id],{impact:b,afterCritical:w}=r6({draggable:g,home:x,draggables:l,viewport:e.viewport}),A=p&&p.isCombineEnabled?e.impact:b,k=X3({pageOffset:e.current.page.offset,draggable:c.draggables[e.critical.draggable.id],draggables:c.draggables,droppables:c.droppables,previousImpact:A,viewport:e.viewport,afterCritical:w}),E={...e,phase:"DRAGGING",impact:k,onLiftImpact:b,dimensions:c,afterCritical:w,forceShouldAnimate:!1};return e.phase==="COLLECTING"?E:{...E,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const o1=e=>e.movementMode==="SNAP",rp=(e,t,r)=>{const n=BN(e.dimensions,t);return!o1(e)||r?pu({state:e,dimensions:n}):t6({state:e,dimensions:n})};function np(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const r5={phase:"IDLE",completed:null,shouldFlush:!1};var FN=(e=r5,t)=>{if(t.type==="FLUSH")return{...r5,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&Ft();const{critical:r,clientSelection:n,viewport:i,dimensions:l,movementMode:c}=t.payload,h=l.draggables[r.draggable.id],p=l.droppables[r.droppable.id],g={selection:n,borderBoxCenter:h.client.borderBox.center,offset:si},x={client:g,page:{selection:Ti(g.selection,i.scroll.initial),borderBoxCenter:Ti(g.selection,i.scroll.initial),offset:Ti(g.selection,i.scroll.diff.value)}},b=Ph(l.droppables).every(E=>!E.isFixedOnPage),{impact:w,afterCritical:A}=r6({draggable:h,home:p,draggables:l.draggables,viewport:i});return{phase:"DRAGGING",isDragging:!0,critical:r,movementMode:c,dimensions:l,initial:x,current:x,isWindowScrollAllowed:b,impact:w,afterCritical:A,onLiftImpact:w,viewport:i,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&Ft(),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||Ft(),ON({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;rc(e)||Ft();const{client:r}=t.payload;return Ql(r,e.current.client.selection)?e:pu({state:e,clientSelection:r,impact:o1(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return np(e);rc(e)||Ft();const{id:r,newScroll:n}=t.payload,i=e.dimensions.droppables[r];if(!i)return e;const l=H1(i,n);return rp(e,l,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;rc(e)||Ft();const{id:r,isEnabled:n}=t.payload,i=e.dimensions.droppables[r];i||Ft(),i.isEnabled===n&&Ft();const l={...i,isEnabled:n};return rp(e,l,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;rc(e)||Ft();const{id:r,isCombineEnabled:n}=t.payload,i=e.dimensions.droppables[r];i||Ft(),i.isCombineEnabled===n&&Ft();const l={...i,isCombineEnabled:n};return rp(e,l,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;rc(e)||Ft(),e.isWindowScrollAllowed||Ft();const r=t.payload.newScroll;if(Ql(e.viewport.scroll.current,r))return np(e);const n=W3(e.viewport,r);return o1(e)?t6({state:e,viewport:n}):pu({state:e,viewport:n})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!rc(e))return e;const r=t.payload.maxScroll;if(Ql(r,e.viewport.scroll.max))return e;const n={...e.viewport,scroll:{...e.viewport.scroll,max:r}};return{...e,viewport:n}}if(t.type==="MOVE_UP"||t.type==="MOVE_DOWN"||t.type==="MOVE_LEFT"||t.type==="MOVE_RIGHT"){if(e.phase==="COLLECTING"||e.phase==="DROP_PENDING")return e;e.phase!=="DRAGGING"&&Ft();const r=AN({state:e,type:t.type});return r?pu({state:e,impact:r.impact,clientSelection:r.clientSelection,scrollJumpRequest:r.scrollJumpRequest}):e}if(t.type==="DROP_PENDING"){const r=t.payload.reason;return e.phase!=="COLLECTING"&&Ft(),{...e,phase:"DROP_PENDING",isWaiting:!0,reason:r}}if(t.type==="DROP_ANIMATE"){const{completed:r,dropDuration:n,newHomeClientOffset:i}=t.payload;return e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||Ft(),{phase:"DROP_ANIMATING",completed:r,dropDuration:n,newHomeClientOffset:i,dimensions:e.dimensions}}if(t.type==="DROP_COMPLETE"){const{completed:r}=t.payload;return{phase:"IDLE",completed:r,shouldFlush:!1}}return e};function Qn(e,t){return e instanceof Object&&"type"in e&&e.type===t}const $N=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),UN=e=>({type:"LIFT",payload:e}),zN=e=>({type:"INITIAL_PUBLISH",payload:e}),HN=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),WN=()=>({type:"COLLECTION_STARTING",payload:null}),GN=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),VN=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),qN=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),n6=e=>({type:"MOVE",payload:e}),YN=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),ZN=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),KN=()=>({type:"MOVE_UP",payload:null}),XN=()=>({type:"MOVE_DOWN",payload:null}),JN=()=>({type:"MOVE_RIGHT",payload:null}),eR=()=>({type:"MOVE_LEFT",payload:null}),K1=()=>({type:"FLUSH",payload:null}),tR=e=>({type:"DROP_ANIMATE",payload:e}),X1=e=>({type:"DROP_COMPLETE",payload:e}),s6=e=>({type:"DROP",payload:e}),rR=e=>({type:"DROP_PENDING",payload:e}),i6=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var nR=e=>({getState:t,dispatch:r})=>n=>i=>{if(!Qn(i,"LIFT")){n(i);return}const{id:l,clientSelection:c,movementMode:h}=i.payload,p=t();p.phase==="DROP_ANIMATING"&&r(X1({completed:p.completed})),t().phase!=="IDLE"&&Ft(),r(K1()),r($N({draggableId:l,movementMode:h}));const x={draggableId:l,scrollOptions:{shouldPublishImmediately:h==="SNAP"}},{critical:b,dimensions:w,viewport:A}=e.startPublishing(x);r(zN({critical:b,dimensions:w,clientSelection:c,movementMode:h,viewport:A}))},sR=e=>()=>t=>r=>{Qn(r,"INITIAL_PUBLISH")&&e.dragging(),Qn(r,"DROP_ANIMATE")&&e.dropping(r.payload.completed.result.reason),(Qn(r,"FLUSH")||Qn(r,"DROP_COMPLETE"))&&e.resting(),t(r)};const J1={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},Eu={opacity:{drop:0,combining:.7},scale:{drop:.75}},a6={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},tc=`${a6.outOfTheWay}s ${J1.outOfTheWay}`,mu={fluid:`opacity ${tc}`,snap:`transform ${tc}, opacity ${tc}`,drop:e=>{const t=`${e}s ${J1.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${tc}`,placeholder:`height ${tc}, width ${tc}, margin ${tc}`},n5=e=>Ql(e,si)?void 0:`translate(${e.x}px, ${e.y}px)`,l1={moveTo:n5,drop:(e,t)=>{const r=n5(e);if(r)return t?`${r} scale(${Eu.scale.drop})`:r}},{minDropTime:c1,maxDropTime:o6}=a6,iR=o6-c1,s5=1500,aR=.6;var oR=({current:e,destination:t,reason:r})=>{const n=Lu(e,t);if(n<=0)return c1;if(n>=s5)return o6;const i=n/s5,l=c1+iR*i,c=r==="CANCEL"?l*aR:l;return Number(c.toFixed(2))},lR=({impact:e,draggable:t,dimensions:r,viewport:n,afterCritical:i})=>{const{draggables:l,droppables:c}=r,h=Ma(e),p=h?c[h]:null,g=c[t.descriptor.droppableId],x=e6({impact:e,draggable:t,draggables:l,afterCritical:i,droppable:p||g,viewport:n});return Na(x,t.client.borderBox.center)},cR=({draggables:e,reason:t,lastImpact:r,home:n,viewport:i,onLiftImpact:l})=>!r.at||t!=="DROP"?{impact:J3({draggables:e,impact:l,destination:n,viewport:i,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:r.at.type==="REORDER"?{impact:r,didDropInsideDroppable:!0}:{impact:{...r,displaced:ku},didDropInsideDroppable:!0};const uR=({getState:e,dispatch:t})=>r=>n=>{if(!Qn(n,"DROP")){r(n);return}const i=e(),l=n.payload.reason;if(i.phase==="COLLECTING"){t(rR({reason:l}));return}if(i.phase==="IDLE")return;i.phase==="DROP_PENDING"&&i.isWaiting&&Ft(),i.phase==="DRAGGING"||i.phase==="DROP_PENDING"||Ft();const h=i.critical,p=i.dimensions,g=p.draggables[i.critical.draggable.id],{impact:x,didDropInsideDroppable:b}=cR({reason:l,lastImpact:i.impact,afterCritical:i.afterCritical,onLiftImpact:i.onLiftImpact,home:i.dimensions.droppables[i.critical.droppable.id],viewport:i.viewport,draggables:i.dimensions.draggables}),w=b?W1(x):null,A=b?Oh(x):null,k={index:h.draggable.index,droppableId:h.droppable.id},E={draggableId:g.descriptor.id,type:g.descriptor.type,source:k,reason:l,mode:i.movementMode,destination:w,combine:A},I=lR({impact:x,draggable:g,dimensions:p,viewport:i.viewport,afterCritical:i.afterCritical}),M={critical:i.critical,afterCritical:i.afterCritical,result:E,impact:x};if(!(!Ql(i.current.client.offset,I)||!!E.combine)){t(X1({completed:M}));return}const j=oR({current:i.current.client.offset,destination:I,reason:l});t(tR({newHomeClientOffset:I,dropDuration:j,completed:M}))};var l6=()=>({x:window.pageXOffset,y:window.pageYOffset});function dR(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function hR({onWindowScroll:e}){function t(){e(l6())}const r=_u(t),n=dR(r);let i=Bl;function l(){return i!==Bl}function c(){l()&&Ft(),i=ao(window,[n])}function h(){l()||Ft(),r.cancel(),i(),i=Bl}return{start:c,stop:h,isActive:l}}const fR=e=>Qn(e,"DROP_COMPLETE")||Qn(e,"DROP_ANIMATE")||Qn(e,"FLUSH"),pR=e=>{const t=hR({onWindowScroll:r=>{e.dispatch(YN({newScroll:r}))}});return r=>n=>{!t.isActive()&&Qn(n,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&fR(n)&&t.stop(),r(n)}};var mR=e=>{let t=!1,r=!1;const n=setTimeout(()=>{r=!0}),i=l=>{t||r||(t=!0,e(l),clearTimeout(n))};return i.wasCalled=()=>t,i},gR=()=>{const e=[],t=i=>{const l=e.findIndex(h=>h.timerId===i);l===-1&&Ft();const[c]=e.splice(l,1);c.callback()};return{add:i=>{const l=setTimeout(()=>t(l)),c={timerId:l,callback:i};e.push(c)},flush:()=>{if(!e.length)return;const i=[...e];e.length=0,i.forEach(l=>{clearTimeout(l.timerId),l.callback()})}}};const xR=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,bR=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,yR=(e,t)=>{if(e===t)return!0;const r=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,n=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return r&&n},z0=(e,t)=>{t()},_d=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function sp(e,t,r,n){if(!e){r(n(t));return}const i=mR(r);e(t,{announce:i}),i.wasCalled()||r(n(t))}var vR=(e,t)=>{const r=gR();let n=null;const i=(b,w)=>{n&&Ft(),z0("onBeforeCapture",()=>{const A=e().onBeforeCapture;A&&A({draggableId:b,mode:w})})},l=(b,w)=>{n&&Ft(),z0("onBeforeDragStart",()=>{const A=e().onBeforeDragStart;A&&A(_d(b,w))})},c=(b,w)=>{n&&Ft();const A=_d(b,w);n={mode:w,lastCritical:b,lastLocation:A.source,lastCombine:null},r.add(()=>{z0("onDragStart",()=>sp(e().onDragStart,A,t,eh.onDragStart))})},h=(b,w)=>{const A=W1(w),k=Oh(w);n||Ft();const E=!yR(b,n.lastCritical);E&&(n.lastCritical=b);const I=!xR(n.lastLocation,A);I&&(n.lastLocation=A);const M=!bR(n.lastCombine,k);if(M&&(n.lastCombine=k),!E&&!I&&!M)return;const Q={..._d(b,n.mode),combine:k,destination:A};r.add(()=>{z0("onDragUpdate",()=>sp(e().onDragUpdate,Q,t,eh.onDragUpdate))})},p=()=>{n||Ft(),r.flush()},g=b=>{n||Ft(),n=null,z0("onDragEnd",()=>sp(e().onDragEnd,b,t,eh.onDragEnd))};return{beforeCapture:i,beforeStart:l,start:c,update:h,flush:p,drop:g,abort:()=>{if(!n)return;const b={..._d(n.lastCritical,n.mode),combine:null,destination:null,reason:"CANCEL"};g(b)}}},wR=(e,t)=>{const r=vR(e,t);return n=>i=>l=>{if(Qn(l,"BEFORE_INITIAL_CAPTURE")){r.beforeCapture(l.payload.draggableId,l.payload.movementMode);return}if(Qn(l,"INITIAL_PUBLISH")){const h=l.payload.critical;r.beforeStart(h,l.payload.movementMode),i(l),r.start(h,l.payload.movementMode);return}if(Qn(l,"DROP_COMPLETE")){const h=l.payload.completed.result;r.flush(),i(l),r.drop(h);return}if(i(l),Qn(l,"FLUSH")){r.abort();return}const c=n.getState();c.phase==="DRAGGING"&&r.update(c.critical,c.impact)}};const AR=e=>t=>r=>{if(!Qn(r,"DROP_ANIMATION_FINISHED")){t(r);return}const n=e.getState();n.phase!=="DROP_ANIMATING"&&Ft(),e.dispatch(X1({completed:n.completed}))},TR=e=>{let t=null,r=null;function n(){r&&(cancelAnimationFrame(r),r=null),t&&(t(),t=null)}return i=>l=>{if((Qn(l,"FLUSH")||Qn(l,"DROP_COMPLETE")||Qn(l,"DROP_ANIMATION_FINISHED"))&&n(),i(l),!Qn(l,"DROP_ANIMATE"))return;const c={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(i6())}};r=requestAnimationFrame(()=>{r=null,t=ao(window,[c])})}};var CR=e=>()=>t=>r=>{(Qn(r,"DROP_COMPLETE")||Qn(r,"FLUSH")||Qn(r,"DROP_ANIMATE"))&&e.stopPublishing(),t(r)},SR=e=>{let t=!1;return()=>r=>n=>{if(Qn(n,"INITIAL_PUBLISH")){t=!0,e.tryRecordFocus(n.payload.critical.draggable.id),r(n),e.tryRestoreFocusRecorded();return}if(r(n),!!t){if(Qn(n,"FLUSH")){t=!1,e.tryRestoreFocusRecorded();return}if(Qn(n,"DROP_COMPLETE")){t=!1;const i=n.payload.completed.result;i.combine&&e.tryShiftRecord(i.draggableId,i.combine.draggableId),e.tryRestoreFocusRecorded()}}}};const _R=e=>Qn(e,"DROP_COMPLETE")||Qn(e,"DROP_ANIMATE")||Qn(e,"FLUSH");var LR=e=>t=>r=>n=>{if(_R(n)){e.stop(),r(n);return}if(Qn(n,"INITIAL_PUBLISH")){r(n);const i=t.getState();i.phase!=="DRAGGING"&&Ft(),e.start(i);return}r(n),e.scroll(t.getState())};const kR=e=>t=>r=>{if(t(r),!Qn(r,"PUBLISH_WHILE_DRAGGING"))return;const n=e.getState();n.phase==="DROP_PENDING"&&(n.isWaiting||e.dispatch(s6({reason:n.reason})))},IR=C3;var ER=({dimensionMarshal:e,focusMarshal:t,styleMarshal:r,getResponders:n,announce:i,autoScroller:l})=>T3(FN,IR(LI(sR(r),CR(e),nR(e),uR,AR,TR,kR,LR(l),pR,SR(t),wR(n,i))));const ip=()=>({additions:{},removals:{},modified:{}});function NR({registry:e,callbacks:t}){let r=ip(),n=null;const i=()=>{n||(t.collectionStarting(),n=requestAnimationFrame(()=>{n=null;const{additions:p,removals:g,modified:x}=r,b=Object.keys(p).map(k=>e.draggable.getById(k).getDimension(si)).sort((k,E)=>k.descriptor.index-E.descriptor.index),w=Object.keys(x).map(k=>{const I=e.droppable.getById(k).callbacks.getScrollWhileDragging();return{droppableId:k,scroll:I}}),A={additions:b,removals:Object.keys(g),modified:w};r=ip(),t.publish(A)}))};return{add:p=>{const g=p.descriptor.id;r.additions[g]=p,r.modified[p.descriptor.droppableId]=!0,r.removals[g]&&delete r.removals[g],i()},remove:p=>{const g=p.descriptor;r.removals[g.id]=!0,r.modified[g.droppableId]=!0,r.additions[g.id]&&delete r.additions[g.id],i()},stop:()=>{n&&(cancelAnimationFrame(n),n=null,r=ip())}}}var c6=({scrollHeight:e,scrollWidth:t,height:r,width:n})=>{const i=Na({x:t,y:e},{x:n,y:r});return{x:Math.max(0,i.x),y:Math.max(0,i.y)}},u6=()=>{const e=document.documentElement;return e||Ft(),e},d6=()=>{const e=u6();return c6({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},RR=()=>{const e=l6(),t=d6(),r=e.y,n=e.x,i=u6(),l=i.clientWidth,c=i.clientHeight,h=n+l,p=r+c;return{frame:Lo({top:r,left:n,right:h,bottom:p}),scroll:{initial:e,current:e,max:t,diff:{value:si,displacement:si}}}},MR=({critical:e,scrollOptions:t,registry:r})=>{const n=RR(),i=n.scroll.current,l=e.droppable,c=r.droppable.getAllByType(l.type).map(x=>x.callbacks.getDimensionAndWatchScroll(i,t)),h=r.draggable.getAllByType(e.draggable.type).map(x=>x.getDimension(i));return{dimensions:{draggables:O3(h),droppables:P3(c)},critical:e,viewport:n}};function i5(e,t,r){return!(r.descriptor.id===t.id||r.descriptor.type!==t.type||e.droppable.getById(r.descriptor.droppableId).descriptor.mode!=="virtual")}var DR=(e,t)=>{let r=null;const n=NR({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),i=(w,A)=>{e.droppable.exists(w)||Ft(),r&&t.updateDroppableIsEnabled({id:w,isEnabled:A})},l=(w,A)=>{r&&(e.droppable.exists(w)||Ft(),t.updateDroppableIsCombineEnabled({id:w,isCombineEnabled:A}))},c=(w,A)=>{r&&(e.droppable.exists(w)||Ft(),t.updateDroppableScroll({id:w,newScroll:A}))},h=(w,A)=>{r&&e.droppable.getById(w).callbacks.scroll(A)},p=()=>{if(!r)return;n.stop();const w=r.critical.droppable;e.droppable.getAllByType(w.type).forEach(A=>A.callbacks.dragStopped()),r.unsubscribe(),r=null},g=w=>{r||Ft();const A=r.critical.draggable;w.type==="ADDITION"&&i5(e,A,w.value)&&n.add(w.value),w.type==="REMOVAL"&&i5(e,A,w.value)&&n.remove(w.value)};return{updateDroppableIsEnabled:i,updateDroppableIsCombineEnabled:l,scrollDroppable:h,updateDroppableScroll:c,startPublishing:w=>{r&&Ft();const A=e.draggable.getById(w.draggableId),k=e.droppable.getById(A.descriptor.droppableId),E={draggable:A.descriptor,droppable:k.descriptor},I=e.subscribe(g);return r={critical:E,unsubscribe:I},MR({critical:E,registry:e,scrollOptions:w.scrollOptions})},stopPublishing:p}},h6=(e,t)=>e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP",BR=e=>{window.scrollBy(e.x,e.y)};const QR=ni(e=>Ph(e).filter(t=>!(!t.isEnabled||!t.frame))),jR=(e,t)=>QR(t).find(n=>(n.frame||Ft(),Y3(n.frame.pageMarginBox)(e)))||null;var PR=({center:e,destination:t,droppables:r})=>{if(t){const i=r[t];return i.frame?i:null}return jR(e,r)};const Nu={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>e**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var OR=(e,t,r=()=>Nu)=>{const n=r(),i=e[t.size]*n.startFromPercentage,l=e[t.size]*n.maxScrollAtPercentage;return{startScrollingFrom:i,maxScrollValueAt:l}},f6=({startOfRange:e,endOfRange:t,current:r})=>{const n=t-e;return n===0?0:(r-e)/n},em=1,FR=(e,t,r=()=>Nu)=>{const n=r();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return n.maxPixelScroll;if(e===t.startScrollingFrom)return em;const l=1-f6({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),c=n.maxPixelScroll*n.ease(l);return Math.ceil(c)},$R=(e,t,r)=>{const n=r(),i=n.durationDampening.accelerateAt,l=n.durationDampening.stopDampeningAt,c=t,h=l,g=Date.now()-c;if(g>=l)return e;if(g<i)return em;const x=f6({startOfRange:i,endOfRange:h,current:g}),b=e*n.ease(x);return Math.ceil(b)},a5=({distanceToEdge:e,thresholds:t,dragStartTime:r,shouldUseTimeDampening:n,getAutoScrollerOptions:i})=>{const l=FR(e,t,i);return l===0?0:n?Math.max($R(l,r,i),em):l},o5=({container:e,distanceToEdges:t,dragStartTime:r,axis:n,shouldUseTimeDampening:i,getAutoScrollerOptions:l})=>{const c=OR(e,n,l);return t[n.end]<t[n.start]?a5({distanceToEdge:t[n.end],thresholds:c,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:l}):-1*a5({distanceToEdge:t[n.start],thresholds:c,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:l})},UR=({container:e,subject:t,proposedScroll:r})=>{const n=t.height>e.height,i=t.width>e.width;return!i&&!n?r:i&&n?null:{x:i?0:r.x,y:n?0:r.y}};const zR=j3(e=>e===0?0:e);var p6=({dragStartTime:e,container:t,subject:r,center:n,shouldUseTimeDampening:i,getAutoScrollerOptions:l})=>{const c={top:n.y-t.top,right:t.right-n.x,bottom:t.bottom-n.y,left:n.x-t.left},h=o5({container:t,distanceToEdges:c,dragStartTime:e,axis:G1,shouldUseTimeDampening:i,getAutoScrollerOptions:l}),p=o5({container:t,distanceToEdges:c,dragStartTime:e,axis:U3,shouldUseTimeDampening:i,getAutoScrollerOptions:l}),g=zR({x:p,y:h});if(Ql(g,si))return null;const x=UR({container:t,subject:r,proposedScroll:g});return x?Ql(x,si)?null:x:null};const HR=j3(e=>e===0?0:e>0?1:-1),tm=(()=>{const e=(t,r)=>t<0?t:t>r?t-r:0;return({current:t,max:r,change:n})=>{const i=Ti(t,n),l={x:e(i.x,r.x),y:e(i.y,r.y)};return Ql(l,si)?null:l}})(),m6=({max:e,current:t,change:r})=>{const n={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},i=HR(r),l=tm({max:n,current:t,change:i});return!l||i.x!==0&&l.x===0||i.y!==0&&l.y===0},rm=(e,t)=>m6({current:e.scroll.current,max:e.scroll.max,change:t}),WR=(e,t)=>{if(!rm(e,t))return null;const r=e.scroll.max,n=e.scroll.current;return tm({current:n,max:r,change:t})},nm=(e,t)=>{const r=e.frame;return r?m6({current:r.scroll.current,max:r.scroll.max,change:t}):!1},GR=(e,t)=>{const r=e.frame;return!r||!nm(e,t)?null:tm({current:r.scroll.current,max:r.scroll.max,change:t})};var VR=({viewport:e,subject:t,center:r,dragStartTime:n,shouldUseTimeDampening:i,getAutoScrollerOptions:l})=>{const c=p6({dragStartTime:n,container:e.frame,subject:t,center:r,shouldUseTimeDampening:i,getAutoScrollerOptions:l});return c&&rm(e,c)?c:null},qR=({droppable:e,subject:t,center:r,dragStartTime:n,shouldUseTimeDampening:i,getAutoScrollerOptions:l})=>{const c=e.frame;if(!c)return null;const h=p6({dragStartTime:n,container:c.pageMarginBox,subject:t,center:r,shouldUseTimeDampening:i,getAutoScrollerOptions:l});return h&&nm(e,h)?h:null},l5=({state:e,dragStartTime:t,shouldUseTimeDampening:r,scrollWindow:n,scrollDroppable:i,getAutoScrollerOptions:l})=>{const c=e.current.page.borderBoxCenter,p=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const b=e.viewport,w=VR({dragStartTime:t,viewport:b,subject:p,center:c,shouldUseTimeDampening:r,getAutoScrollerOptions:l});if(w){n(w);return}}const g=PR({center:c,destination:Ma(e.impact),droppables:e.dimensions.droppables});if(!g)return;const x=qR({dragStartTime:t,droppable:g,subject:p,center:c,shouldUseTimeDampening:r,getAutoScrollerOptions:l});x&&i(g.descriptor.id,x)},YR=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:r=()=>Nu})=>{const n=_u(e),i=_u(t);let l=null;const c=g=>{l||Ft();const{shouldUseTimeDampening:x,dragStartTime:b}=l;l5({state:g,scrollWindow:n,scrollDroppable:i,dragStartTime:b,shouldUseTimeDampening:x,getAutoScrollerOptions:r})};return{start:g=>{l&&Ft();const x=Date.now();let b=!1;const w=()=>{b=!0};l5({state:g,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:w,scrollDroppable:w,getAutoScrollerOptions:r}),l={dragStartTime:x,shouldUseTimeDampening:b},b&&c(g)},stop:()=>{l&&(n.cancel(),i.cancel(),l=null)},scroll:c}},ZR=({move:e,scrollDroppable:t,scrollWindow:r})=>{const n=(h,p)=>{const g=Ti(h.current.client.selection,p);e({client:g})},i=(h,p)=>{if(!nm(h,p))return p;const g=GR(h,p);if(!g)return t(h.descriptor.id,p),null;const x=Na(p,g);return t(h.descriptor.id,x),Na(p,x)},l=(h,p,g)=>{if(!h||!rm(p,g))return g;const x=WR(p,g);if(!x)return r(g),null;const b=Na(g,x);return r(b),Na(g,b)};return h=>{const p=h.scrollJumpRequest;if(!p)return;const g=Ma(h.impact);g||Ft();const x=i(h.dimensions.droppables[g],p);if(!x)return;const b=h.viewport,w=l(h.isWindowScrollAllowed,b,x);w&&n(h,w)}},KR=({scrollDroppable:e,scrollWindow:t,move:r,getAutoScrollerOptions:n})=>{const i=YR({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:n}),l=ZR({move:r,scrollWindow:t,scrollDroppable:e});return{scroll:p=>{if(!(n().disabled||p.phase!=="DRAGGING")){if(p.movementMode==="FLUID"){i.scroll(p);return}p.scrollJumpRequest&&l(p)}},start:i.start,stop:i.stop}};const e0="data-rfd",t0=(()=>{const e=`${e0}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),u1=(()=>{const e=`${e0}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),XR=(()=>{const e=`${e0}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),c5={contextId:`${e0}-scroll-container-context-id`},JR=e=>t=>`[${t}="${e}"]`,H0=(e,t)=>e.map(r=>{const n=r.styles[t];return n?`${r.selector} { ${n} }`:""}).join(" "),eM="pointer-events: none;";var tM=e=>{const t=JR(e),r=(()=>{const h=`
|
|
111
|
-
cursor: -webkit-grab;
|
|
112
|
-
cursor: grab;
|
|
113
|
-
`;return{selector:t(t0.contextId),styles:{always:`
|
|
114
|
-
-webkit-touch-callout: none;
|
|
115
|
-
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
|
116
|
-
touch-action: manipulation;
|
|
117
|
-
`,resting:h,dragging:eM,dropAnimating:h}}})(),n=(()=>{const h=`
|
|
118
|
-
transition: ${mu.outOfTheWay};
|
|
119
|
-
`;return{selector:t(u1.contextId),styles:{dragging:h,dropAnimating:h,userCancel:h}}})(),i={selector:t(XR.contextId),styles:{always:"overflow-anchor: none;"}},c=[n,r,i,{selector:"body",styles:{dragging:`
|
|
120
|
-
cursor: grabbing;
|
|
121
|
-
cursor: -webkit-grabbing;
|
|
122
|
-
user-select: none;
|
|
123
|
-
-webkit-user-select: none;
|
|
124
|
-
-moz-user-select: none;
|
|
125
|
-
-ms-user-select: none;
|
|
126
|
-
overflow-anchor: none;
|
|
127
|
-
`}}];return{always:H0(c,"always"),resting:H0(c,"resting"),dragging:H0(c,"dragging"),dropAnimating:H0(c,"dropAnimating"),userCancel:H0(c,"userCancel")}};const Da=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?y.useLayoutEffect:y.useEffect,ap=()=>{const e=document.querySelector("head");return e||Ft(),e},u5=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function rM(e,t){const r=bn(()=>tM(e),[e]),n=y.useRef(null),i=y.useRef(null),l=vr(ni(b=>{const w=i.current;w||Ft(),w.textContent=b}),[]),c=vr(b=>{const w=n.current;w||Ft(),w.textContent=b},[]);Da(()=>{!n.current&&!i.current||Ft();const b=u5(t),w=u5(t);return n.current=b,i.current=w,b.setAttribute(`${e0}-always`,e),w.setAttribute(`${e0}-dynamic`,e),ap().appendChild(b),ap().appendChild(w),c(r.always),l(r.resting),()=>{const A=k=>{const E=k.current;E||Ft(),ap().removeChild(E),k.current=null};A(n),A(i)}},[t,c,l,r.always,r.resting,e]);const h=vr(()=>l(r.dragging),[l,r.dragging]),p=vr(b=>{if(b==="DROP"){l(r.dropAnimating);return}l(r.userCancel)},[l,r.dropAnimating,r.userCancel]),g=vr(()=>{i.current&&l(r.resting)},[l,r.resting]);return bn(()=>({dragging:h,dropping:p,resting:g}),[h,p,g])}function g6(e,t){return Array.from(e.querySelectorAll(t))}var x6=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function Uh(e){return e instanceof x6(e).HTMLElement}function nM(e,t){const r=`[${t0.contextId}="${e}"]`,n=g6(document,r);if(!n.length)return null;const i=n.find(l=>l.getAttribute(t0.draggableId)===t);return!i||!Uh(i)?null:i}function sM(e){const t=y.useRef({}),r=y.useRef(null),n=y.useRef(null),i=y.useRef(!1),l=vr(function(w,A){const k={id:w,focus:A};return t.current[w]=k,function(){const I=t.current;I[w]!==k&&delete I[w]}},[]),c=vr(function(w){const A=nM(e,w);A&&A!==document.activeElement&&A.focus()},[e]),h=vr(function(w,A){r.current===w&&(r.current=A)},[]),p=vr(function(){n.current||i.current&&(n.current=requestAnimationFrame(()=>{n.current=null;const w=r.current;w&&c(w)}))},[c]),g=vr(function(w){r.current=null;const A=document.activeElement;A&&A.getAttribute(t0.draggableId)===w&&(r.current=w)},[]);return Da(()=>(i.current=!0,function(){i.current=!1;const w=n.current;w&&cancelAnimationFrame(w)}),[]),bn(()=>({register:l,tryRecordFocus:g,tryRestoreFocusRecorded:p,tryShiftRecord:h}),[l,g,p,h])}function iM(){const e={draggables:{},droppables:{}},t=[];function r(b){return t.push(b),function(){const A=t.indexOf(b);A!==-1&&t.splice(A,1)}}function n(b){t.length&&t.forEach(w=>w(b))}function i(b){return e.draggables[b]||null}function l(b){const w=i(b);return w||Ft(),w}const c={register:b=>{e.draggables[b.descriptor.id]=b,n({type:"ADDITION",value:b})},update:(b,w)=>{const A=e.draggables[w.descriptor.id];A&&A.uniqueId===b.uniqueId&&(delete e.draggables[w.descriptor.id],e.draggables[b.descriptor.id]=b)},unregister:b=>{const w=b.descriptor.id,A=i(w);A&&b.uniqueId===A.uniqueId&&(delete e.draggables[w],e.droppables[b.descriptor.droppableId]&&n({type:"REMOVAL",value:b}))},getById:l,findById:i,exists:b=>!!i(b),getAllByType:b=>Object.values(e.draggables).filter(w=>w.descriptor.type===b)};function h(b){return e.droppables[b]||null}function p(b){const w=h(b);return w||Ft(),w}const g={register:b=>{e.droppables[b.descriptor.id]=b},unregister:b=>{const w=h(b.descriptor.id);w&&b.uniqueId===w.uniqueId&&delete e.droppables[b.descriptor.id]},getById:p,findById:h,exists:b=>!!h(b),getAllByType:b=>Object.values(e.droppables).filter(w=>w.descriptor.type===b)};function x(){e.draggables={},e.droppables={},t.length=0}return{draggable:c,droppable:g,subscribe:r,clean:x}}function aM(){const e=bn(iM,[]);return y.useEffect(()=>function(){e.clean()},[e]),e}var sm=C.createContext(null),Th=()=>{const e=document.body;return e||Ft(),e};const oM={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},lM=e=>`rfd-announcement-${e}`;function cM(e){const t=bn(()=>lM(e),[e]),r=y.useRef(null);return y.useEffect(function(){const l=document.createElement("div");return r.current=l,l.id=t,l.setAttribute("aria-live","assertive"),l.setAttribute("aria-atomic","true"),yh(l.style,oM),Th().appendChild(l),function(){setTimeout(function(){const p=Th();p.contains(l)&&p.removeChild(l),l===r.current&&(r.current=null)})}},[t]),vr(i=>{const l=r.current;if(l){l.textContent=i;return}},[])}const uM={separator:"::"};function im(e,t=uM){const r=C.useId();return bn(()=>`${e}${t.separator}${r}`,[t.separator,e,r])}function dM({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function hM({contextId:e,text:t}){const r=im("hidden-text",{separator:"-"}),n=bn(()=>dM({contextId:e,uniqueId:r}),[r,e]);return y.useEffect(function(){const l=document.createElement("div");return l.id=n,l.textContent=t,l.style.display="none",Th().appendChild(l),function(){const h=Th();h.contains(l)&&h.removeChild(l)}},[n,t]),n}var zh=C.createContext(null);function b6(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),t}function fM(){let e=null;function t(){return!!e}function r(c){return c===e}function n(c){e&&Ft();const h={abandon:c};return e=h,h}function i(){e||Ft(),e=null}function l(){e&&(e.abandon(),i())}return{isClaimed:t,isActive:r,claim:n,release:i,tryAbandon:l}}function Ru(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const pM=9,mM=13,am=27,y6=32,gM=33,xM=34,bM=35,yM=36,vM=37,wM=38,AM=39,TM=40,CM={[mM]:!0,[pM]:!0};var v6=e=>{CM[e.keyCode]&&e.preventDefault()};const Hh=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(n=>`on${n}`in document)||e})(),w6=0,d5=5;function SM(e,t){return Math.abs(t.x-e.x)>=d5||Math.abs(t.y-e.y)>=d5}const h5={type:"IDLE"};function _M({cancel:e,completed:t,getPhase:r,setPhase:n}){return[{eventName:"mousemove",fn:i=>{const{button:l,clientX:c,clientY:h}=i;if(l!==w6)return;const p={x:c,y:h},g=r();if(g.type==="DRAGGING"){i.preventDefault(),g.actions.move(p);return}g.type!=="PENDING"&&Ft();const x=g.point;if(!SM(x,p))return;i.preventDefault();const b=g.actions.fluidLift(p);n({type:"DRAGGING",actions:b})}},{eventName:"mouseup",fn:i=>{const l=r();if(l.type!=="DRAGGING"){e();return}i.preventDefault(),l.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:i=>{r().type==="DRAGGING"&&i.preventDefault(),e()}},{eventName:"keydown",fn:i=>{if(r().type==="PENDING"){e();return}if(i.keyCode===am){i.preventDefault(),e();return}v6(i)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{r().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:i=>{const l=r();if(l.type==="IDLE"&&Ft(),l.actions.shouldRespectForcePress()){e();return}i.preventDefault()}},{eventName:Hh,fn:e}]}function LM(e){const t=y.useRef(h5),r=y.useRef(Bl),n=bn(()=>({eventName:"mousedown",fn:function(b){if(b.defaultPrevented||b.button!==w6||b.ctrlKey||b.metaKey||b.shiftKey||b.altKey)return;const w=e.findClosestDraggableId(b);if(!w)return;const A=e.tryGetLock(w,c,{sourceEvent:b});if(!A)return;b.preventDefault();const k={x:b.clientX,y:b.clientY};r.current(),g(A,k)}}),[e]),i=bn(()=>({eventName:"webkitmouseforcewillbegin",fn:x=>{if(x.defaultPrevented)return;const b=e.findClosestDraggableId(x);if(!b)return;const w=e.findOptionsForDraggable(b);w&&(w.shouldRespectForcePress||e.canGetLock(b)&&x.preventDefault())}}),[e]),l=vr(function(){const b={passive:!1,capture:!0};r.current=ao(window,[i,n],b)},[i,n]),c=vr(()=>{t.current.type!=="IDLE"&&(t.current=h5,r.current(),l())},[l]),h=vr(()=>{const x=t.current;c(),x.type==="DRAGGING"&&x.actions.cancel({shouldBlockNextClick:!0}),x.type==="PENDING"&&x.actions.abort()},[c]),p=vr(function(){const b={capture:!0,passive:!1},w=_M({cancel:h,completed:c,getPhase:()=>t.current,setPhase:A=>{t.current=A}});r.current=ao(window,w,b)},[h,c]),g=vr(function(b,w){t.current.type!=="IDLE"&&Ft(),t.current={type:"PENDING",point:w,actions:b},p()},[p]);Da(function(){return l(),function(){r.current()}},[l])}function kM(){}const IM={[xM]:!0,[gM]:!0,[yM]:!0,[bM]:!0};function EM(e,t){function r(){t(),e.cancel()}function n(){t(),e.drop()}return[{eventName:"keydown",fn:i=>{if(i.keyCode===am){i.preventDefault(),r();return}if(i.keyCode===y6){i.preventDefault(),n();return}if(i.keyCode===TM){i.preventDefault(),e.moveDown();return}if(i.keyCode===wM){i.preventDefault(),e.moveUp();return}if(i.keyCode===AM){i.preventDefault(),e.moveRight();return}if(i.keyCode===vM){i.preventDefault(),e.moveLeft();return}if(IM[i.keyCode]){i.preventDefault();return}v6(i)}},{eventName:"mousedown",fn:r},{eventName:"mouseup",fn:r},{eventName:"click",fn:r},{eventName:"touchstart",fn:r},{eventName:"resize",fn:r},{eventName:"wheel",fn:r,options:{passive:!0}},{eventName:Hh,fn:r}]}function NM(e){const t=y.useRef(kM),r=bn(()=>({eventName:"keydown",fn:function(l){if(l.defaultPrevented||l.keyCode!==y6)return;const c=e.findClosestDraggableId(l);if(!c)return;const h=e.tryGetLock(c,x,{sourceEvent:l});if(!h)return;l.preventDefault();let p=!0;const g=h.snapLift();t.current();function x(){p||Ft(),p=!1,t.current(),n()}t.current=ao(window,EM(g,x),{capture:!0,passive:!1})}}),[e]),n=vr(function(){const l={passive:!1,capture:!0};t.current=ao(window,[r],l)},[r]);Da(function(){return n(),function(){t.current()}},[n])}const op={type:"IDLE"},RM=120,MM=.15;function DM({cancel:e,getPhase:t}){return[{eventName:"orientationchange",fn:e},{eventName:"resize",fn:e},{eventName:"contextmenu",fn:r=>{r.preventDefault()}},{eventName:"keydown",fn:r=>{if(t().type!=="DRAGGING"){e();return}r.keyCode===am&&r.preventDefault(),e()}},{eventName:Hh,fn:e}]}function BM({cancel:e,completed:t,getPhase:r}){return[{eventName:"touchmove",options:{capture:!1},fn:n=>{const i=r();if(i.type!=="DRAGGING"){e();return}i.hasMoved=!0;const{clientX:l,clientY:c}=n.touches[0],h={x:l,y:c};n.preventDefault(),i.actions.move(h)}},{eventName:"touchend",fn:n=>{const i=r();if(i.type!=="DRAGGING"){e();return}n.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:n=>{if(r().type!=="DRAGGING"){e();return}n.preventDefault(),e()}},{eventName:"touchforcechange",fn:n=>{const i=r();i.type==="IDLE"&&Ft();const l=n.touches[0];if(!l||!(l.force>=MM))return;const h=i.actions.shouldRespectForcePress();if(i.type==="PENDING"){h&&e();return}if(h){if(i.hasMoved){n.preventDefault();return}e();return}n.preventDefault()}},{eventName:Hh,fn:e}]}function QM(e){const t=y.useRef(op),r=y.useRef(Bl),n=vr(function(){return t.current},[]),i=vr(function(A){t.current=A},[]),l=bn(()=>({eventName:"touchstart",fn:function(A){if(A.defaultPrevented)return;const k=e.findClosestDraggableId(A);if(!k)return;const E=e.tryGetLock(k,h,{sourceEvent:A});if(!E)return;const I=A.touches[0],{clientX:M,clientY:Q}=I,j={x:M,y:Q};r.current(),b(E,j)}}),[e]),c=vr(function(){const A={capture:!0,passive:!1};r.current=ao(window,[l],A)},[l]),h=vr(()=>{const w=t.current;w.type!=="IDLE"&&(w.type==="PENDING"&&clearTimeout(w.longPressTimerId),i(op),r.current(),c())},[c,i]),p=vr(()=>{const w=t.current;h(),w.type==="DRAGGING"&&w.actions.cancel({shouldBlockNextClick:!0}),w.type==="PENDING"&&w.actions.abort()},[h]),g=vr(function(){const A={capture:!0,passive:!1},k={cancel:p,completed:h,getPhase:n},E=ao(window,BM(k),A),I=ao(window,DM(k),A);r.current=function(){E(),I()}},[p,n,h]),x=vr(function(){const A=n();A.type!=="PENDING"&&Ft();const k=A.actions.fluidLift(A.point);i({type:"DRAGGING",actions:k,hasMoved:!1})},[n,i]),b=vr(function(A,k){n().type!=="IDLE"&&Ft();const E=setTimeout(x,RM);i({type:"PENDING",point:k,actions:A,longPressTimerId:E}),g()},[g,n,i,x]);Da(function(){return c(),function(){r.current();const k=n();k.type==="PENDING"&&(clearTimeout(k.longPressTimerId),i(op))}},[n,c,i]),Da(function(){return ao(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const jM=["input","button","textarea","select","option","optgroup","video","audio"];function A6(e,t){if(t==null)return!1;if(jM.includes(t.tagName.toLowerCase()))return!0;const n=t.getAttribute("contenteditable");return n==="true"||n===""?!0:t===e?!1:A6(e,t.parentElement)}function PM(e,t){const r=t.target;return Uh(r)?A6(e,r):!1}var OM=e=>Lo(e.getBoundingClientRect()).center;function FM(e){return e instanceof x6(e).Element}const $M=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(n=>n in Element.prototype)||e})();function T6(e,t){return e==null?null:e[$M](t)?e:T6(e.parentElement,t)}function UM(e,t){return e.closest?e.closest(t):T6(e,t)}function zM(e){return`[${t0.contextId}="${e}"]`}function HM(e,t){const r=t.target;if(!FM(r))return null;const n=zM(e),i=UM(r,n);return!i||!Uh(i)?null:i}function WM(e,t){const r=HM(e,t);return r?r.getAttribute(t0.draggableId):null}function GM(e,t){const r=`[${u1.contextId}="${e}"]`,i=g6(document,r).find(l=>l.getAttribute(u1.id)===t);return!i||!Uh(i)?null:i}function VM(e){e.preventDefault()}function Ld({expected:e,phase:t,isLockActive:r,shouldWarn:n}){return!(!r()||e!==t)}function C6({lockAPI:e,store:t,registry:r,draggableId:n}){if(e.isClaimed())return!1;const i=r.draggable.findById(n);return!(!i||!i.options.isEnabled||!h6(t.getState(),n))}function qM({lockAPI:e,contextId:t,store:r,registry:n,draggableId:i,forceSensorStop:l,sourceEvent:c}){if(!C6({lockAPI:e,store:r,registry:n,draggableId:i}))return null;const p=n.draggable.getById(i),g=GM(t,p.descriptor.id);if(!g||c&&!p.options.canDragInteractiveElements&&PM(g,c))return null;const x=e.claim(l||Bl);let b="PRE_DRAG";function w(){return p.options.shouldRespectForcePress}function A(){return e.isActive(x)}function k(V,$){Ld({expected:V,phase:b,isLockActive:A,shouldWarn:!0})&&r.dispatch($())}const E=k.bind(null,"DRAGGING");function I(V){function $(){e.release(),b="COMPLETED"}b!=="PRE_DRAG"&&($(),Ft()),r.dispatch(UN(V.liftActionArgs)),b="DRAGGING";function te(se,qe={shouldBlockNextClick:!1}){if(V.cleanup(),qe.shouldBlockNextClick){const de=ao(window,[{eventName:"click",fn:VM,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(de)}$(),r.dispatch(s6({reason:se}))}return{isActive:()=>Ld({expected:"DRAGGING",phase:b,isLockActive:A,shouldWarn:!1}),shouldRespectForcePress:w,drop:se=>te("DROP",se),cancel:se=>te("CANCEL",se),...V.actions}}function M(V){const $=_u(se=>{E(()=>n6({client:se}))});return{...I({liftActionArgs:{id:i,clientSelection:V,movementMode:"FLUID"},cleanup:()=>$.cancel(),actions:{move:$}}),move:$}}function Q(){const V={moveUp:()=>E(KN),moveRight:()=>E(JN),moveDown:()=>E(XN),moveLeft:()=>E(eR)};return I({liftActionArgs:{id:i,clientSelection:OM(g),movementMode:"SNAP"},cleanup:Bl,actions:V})}function j(){Ld({expected:"PRE_DRAG",phase:b,isLockActive:A,shouldWarn:!0})&&e.release()}return{isActive:()=>Ld({expected:"PRE_DRAG",phase:b,isLockActive:A,shouldWarn:!1}),shouldRespectForcePress:w,fluidLift:M,snapLift:Q,abort:j}}const YM=[LM,NM,QM];function ZM({contextId:e,store:t,registry:r,customSensors:n,enableDefaultSensors:i}){const l=[...i?YM:[],...n||[]],c=y.useState(()=>fM())[0],h=vr(function(I,M){Ru(I)&&!Ru(M)&&c.tryAbandon()},[c]);Da(function(){let I=t.getState();return t.subscribe(()=>{const Q=t.getState();h(I,Q),I=Q})},[c,t,h]),Da(()=>c.tryAbandon,[c.tryAbandon]);const p=vr(E=>C6({lockAPI:c,registry:r,store:t,draggableId:E}),[c,r,t]),g=vr((E,I,M)=>qM({lockAPI:c,registry:r,contextId:e,store:t,draggableId:E,forceSensorStop:I||null,sourceEvent:M&&M.sourceEvent?M.sourceEvent:null}),[e,c,r,t]),x=vr(E=>WM(e,E),[e]),b=vr(E=>{const I=r.draggable.findById(E);return I?I.options:null},[r.draggable]),w=vr(function(){c.isClaimed()&&(c.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(K1()))},[c,t]),A=vr(()=>c.isClaimed(),[c]),k=bn(()=>({canGetLock:p,tryGetLock:g,findClosestDraggableId:x,findOptionsForDraggable:b,tryReleaseLock:w,isLockClaimed:A}),[p,g,x,b,w,A]);for(let E=0;E<l.length;E++)l[E](k)}const KM=e=>({onBeforeCapture:t=>{const r=()=>{e.onBeforeCapture&&e.onBeforeCapture(t)};Ai.flushSync(r)},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),XM=e=>({...Nu,...e.autoScrollerOptions,durationDampening:{...Nu.durationDampening,...e.autoScrollerOptions}});function W0(e){return e.current||Ft(),e.current}function JM(e){const{contextId:t,setCallbacks:r,sensors:n,nonce:i,dragHandleUsageInstructions:l}=e,c=y.useRef(null),h=b6(e),p=vr(()=>KM(h.current),[h]),g=vr(()=>XM(h.current),[h]),x=cM(t),b=hM({contextId:t,text:l}),w=rM(t,i),A=vr(de=>{W0(c).dispatch(de)},[]),k=bn(()=>P2({publishWhileDragging:HN,updateDroppableScroll:GN,updateDroppableIsEnabled:VN,updateDroppableIsCombineEnabled:qN,collectionStarting:WN},A),[A]),E=aM(),I=bn(()=>DR(E,k),[E,k]),M=bn(()=>KR({scrollWindow:BR,scrollDroppable:I.scrollDroppable,getAutoScrollerOptions:g,...P2({move:n6},A)}),[I.scrollDroppable,A,g]),Q=sM(t),j=bn(()=>ER({announce:x,autoScroller:M,dimensionMarshal:I,focusMarshal:Q,getResponders:p,styleMarshal:w}),[x,M,I,Q,p,w]);c.current=j;const F=vr(()=>{const de=W0(c);de.getState().phase!=="IDLE"&&de.dispatch(K1())},[]),V=vr(()=>{const de=W0(c).getState();return de.phase==="DROP_ANIMATING"?!0:de.phase==="IDLE"?!1:de.isDragging},[]),$=bn(()=>({isDragging:V,tryAbort:F}),[V,F]);r($);const te=vr(de=>h6(W0(c).getState(),de),[]),se=vr(()=>rc(W0(c).getState()),[]),qe=bn(()=>({marshal:I,focus:Q,contextId:t,canLift:te,isMovementAllowed:se,dragHandleUsageInstructionsId:b,registry:E}),[t,I,b,Q,te,se,E]);return ZM({contextId:t,store:j,registry:E,customSensors:n||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),y.useEffect(()=>F,[F]),C.createElement(zh.Provider,{value:qe},C.createElement(CE,{context:sm,store:j},e.children))}function eD(){return C.useId()}function Ch(e){const t=eD(),r=e.dragHandleUsageInstructions||eh.dragHandleUsageInstructions;return C.createElement(NE,null,n=>C.createElement(JM,{nonce:e.nonce,contextId:t,setCallbacks:n,dragHandleUsageInstructions:r,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd,autoScrollerOptions:e.autoScrollerOptions},e.children))}const f5={dragging:5e3,dropAnimating:4500},tD=(e,t)=>t?mu.drop(t.duration):e?mu.snap:mu.fluid,rD=(e,t)=>{if(e)return t?Eu.opacity.drop:Eu.opacity.combining},nD=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function sD(e){const r=e.dimension.client,{offset:n,combineWith:i,dropping:l}=e,c=!!i,h=nD(e),p=!!l,g=p?l1.drop(n,c):l1.moveTo(n);return{position:"fixed",top:r.marginBox.top,left:r.marginBox.left,boxSizing:"border-box",width:r.borderBox.width,height:r.borderBox.height,transition:tD(h,l),transform:g,opacity:rD(c,p),zIndex:p?f5.dropAnimating:f5.dragging,pointerEvents:"none"}}function iD(e){return{transform:l1.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function aD(e){return e.type==="DRAGGING"?sD(e):iD(e)}function oD(e,t,r=si){const n=window.getComputedStyle(t),i=t.getBoundingClientRect(),l=N3(i,n),c=bh(l,r),h={client:l,tagName:t.tagName.toLowerCase(),display:n.display},p={x:l.marginBox.width,y:l.marginBox.height};return{descriptor:e,placeholder:h,displaceBy:p,client:l,page:c}}function lD(e){const t=im("draggable"),{descriptor:r,registry:n,getDraggableRef:i,canDragInteractiveElements:l,shouldRespectForcePress:c,isEnabled:h}=e,p=bn(()=>({canDragInteractiveElements:l,shouldRespectForcePress:c,isEnabled:h}),[l,h,c]),g=vr(A=>{const k=i();return k||Ft(),oD(r,k,A)},[r,i]),x=bn(()=>({uniqueId:t,descriptor:r,options:p,getDimension:g}),[r,g,p,t]),b=y.useRef(x),w=y.useRef(!0);Da(()=>(n.draggable.register(b.current),()=>n.draggable.unregister(b.current)),[n.draggable]),Da(()=>{if(w.current){w.current=!1;return}const A=b.current;b.current=x,n.draggable.update(x,A)},[x,n.draggable])}var om=C.createContext(null);function Sh(e){const t=y.useContext(e);return t||Ft(),t}function cD(e){e.preventDefault()}const uD=e=>{const t=y.useRef(null),r=vr(($=null)=>{t.current=$},[]),n=vr(()=>t.current,[]),{contextId:i,dragHandleUsageInstructionsId:l,registry:c}=Sh(zh),{type:h,droppableId:p}=Sh(om),g=bn(()=>({id:e.draggableId,index:e.index,type:h,droppableId:p}),[e.draggableId,e.index,h,p]),{children:x,draggableId:b,isEnabled:w,shouldRespectForcePress:A,canDragInteractiveElements:k,isClone:E,mapped:I,dropAnimationFinished:M}=e;if(!E){const $=bn(()=>({descriptor:g,registry:c,getDraggableRef:n,canDragInteractiveElements:k,shouldRespectForcePress:A,isEnabled:w}),[g,c,n,k,A,w]);lD($)}const Q=bn(()=>w?{tabIndex:0,role:"button","aria-describedby":l,"data-rfd-drag-handle-draggable-id":b,"data-rfd-drag-handle-context-id":i,draggable:!1,onDragStart:cD}:null,[i,l,b,w]),j=vr($=>{I.type==="DRAGGING"&&I.dropping&&$.propertyName==="transform"&&Ai.flushSync(M)},[M,I]),F=bn(()=>{const $=aD(I),te=I.type==="DRAGGING"&&I.dropping?j:void 0;return{innerRef:r,draggableProps:{"data-rfd-draggable-context-id":i,"data-rfd-draggable-id":b,style:$,onTransitionEnd:te},dragHandleProps:Q}},[i,Q,b,I,j,r]),V=bn(()=>({draggableId:g.id,type:g.type,source:{index:g.index,droppableId:g.droppableId}}),[g.droppableId,g.id,g.index,g.type]);return C.createElement(C.Fragment,null,x(F,I.snapshot,V))};var S6=(e,t)=>e===t,_6=e=>{const{combine:t,destination:r}=e;return r?r.droppableId:t?t.droppableId:null};const dD=e=>e.combine?e.combine.draggableId:null,hD=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function fD(){const e=ni((i,l)=>({x:i,y:l})),t=ni((i,l,c=null,h=null,p=null)=>({isDragging:!0,isClone:l,isDropAnimating:!!p,dropAnimation:p,mode:i,draggingOver:c,combineWith:h,combineTargetFor:null})),r=ni((i,l,c,h,p=null,g=null,x=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:p,combineWith:g,mode:l,offset:i,dimension:c,forceShouldAnimate:x,snapshot:t(l,h,p,g,null)}}));return(i,l)=>{if(Ru(i)){if(i.critical.draggable.id!==l.draggableId)return null;const c=i.current.client.offset,h=i.dimensions.draggables[l.draggableId],p=Ma(i.impact),g=hD(i.impact),x=i.forceShouldAnimate;return r(e(c.x,c.y),i.movementMode,h,l.isClone,p,g,x)}if(i.phase==="DROP_ANIMATING"){const c=i.completed;if(c.result.draggableId!==l.draggableId)return null;const h=l.isClone,p=i.dimensions.draggables[l.draggableId],g=c.result,x=g.mode,b=_6(g),w=dD(g),k={duration:i.dropDuration,curve:J1.drop,moveTo:i.newHomeClientOffset,opacity:w?Eu.opacity.drop:null,scale:w?Eu.scale.drop:null};return{mapped:{type:"DRAGGING",offset:i.newHomeClientOffset,dimension:p,dropping:k,draggingOver:b,combineWith:w,mode:x,forceShouldAnimate:null,snapshot:t(x,h,b,w,k)}}}return null}}function L6(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const pD={mapped:{type:"SECONDARY",offset:si,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:L6(null)}};function mD(){const e=ni((c,h)=>({x:c,y:h})),t=ni(L6),r=ni((c,h=null,p)=>({mapped:{type:"SECONDARY",offset:c,combineTargetFor:h,shouldAnimateDisplacement:p,snapshot:t(h)}})),n=c=>c?r(si,c,!0):null,i=(c,h,p,g)=>{const x=p.displaced.visible[c],b=!!(g.inVirtualList&&g.effected[c]),w=Oh(p),A=w&&w.draggableId===c?h:null;if(!x){if(!b)return n(A);if(p.displaced.invisible[c])return null;const I=a0(g.displacedBy.point),M=e(I.x,I.y);return r(M,A,!0)}if(b)return n(A);const k=p.displacedBy.point,E=e(k.x,k.y);return r(E,A,x.shouldAnimate)};return(c,h)=>{if(Ru(c))return c.critical.draggable.id===h.draggableId?null:i(h.draggableId,c.critical.draggable.id,c.impact,c.afterCritical);if(c.phase==="DROP_ANIMATING"){const p=c.completed;return p.result.draggableId===h.draggableId?null:i(h.draggableId,p.result.draggableId,p.impact,p.afterCritical)}return null}}const gD=()=>{const e=fD(),t=mD();return(n,i)=>e(n,i)||t(n,i)||pD},xD={dropAnimationFinished:i6},bD=E3(gD,xD,null,{context:sm,areStatePropsEqual:S6})(uD);function k6(e){return Sh(om).isUsingCloneFor===e.draggableId&&!e.isClone?null:C.createElement(bD,e)}function cl(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,r=!!e.disableInteractiveElementBlocking,n=!!e.shouldRespectForcePress;return C.createElement(k6,yh({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:r,shouldRespectForcePress:n}))}const I6=e=>t=>e===t,yD=I6("scroll"),vD=I6("auto"),p5=(e,t)=>t(e.overflowX)||t(e.overflowY),wD=e=>{const t=window.getComputedStyle(e),r={overflowX:t.overflowX,overflowY:t.overflowY};return p5(r,yD)||p5(r,vD)},AD=()=>!1,E6=e=>e==null?null:e===document.body?AD()?e:null:e===document.documentElement?null:wD(e)?e:E6(e.parentElement);var d1=e=>({x:e.scrollLeft,y:e.scrollTop});const N6=e=>e?window.getComputedStyle(e).position==="fixed"?!0:N6(e.parentElement):!1;var TD=e=>{const t=E6(e),r=N6(e);return{closestScrollable:t,isFixedOnPage:r}},CD=({descriptor:e,isEnabled:t,isCombineEnabled:r,isFixedOnPage:n,direction:i,client:l,page:c,closest:h})=>{const p=(()=>{if(!h)return null;const{scrollSize:w,client:A}=h,k=c6({scrollHeight:w.scrollHeight,scrollWidth:w.scrollWidth,height:A.paddingBox.height,width:A.paddingBox.width});return{pageMarginBox:h.page.marginBox,frameClient:A,scrollSize:w,shouldClipSubject:h.shouldClipSubject,scroll:{initial:h.scroll,current:h.scroll,max:k,diff:{value:si,displacement:si}}}})(),g=i==="vertical"?G1:U3,x=Jc({page:c,withPlaceholder:null,axis:g,frame:p});return{descriptor:e,isCombineEnabled:r,isFixedOnPage:n,axis:g,isEnabled:t,client:l,page:c,frame:p,subject:x}};const SD=(e,t)=>{const r=R3(e);if(!t||e!==t)return r;const n=r.paddingBox.top-t.scrollTop,i=r.paddingBox.left-t.scrollLeft,l=n+t.scrollHeight,c=i+t.scrollWidth,p=U1({top:n,right:c,bottom:l,left:i},r.border);return z1({borderBox:p,margin:r.margin,border:r.border,padding:r.padding})};var _D=({ref:e,descriptor:t,env:r,windowScroll:n,direction:i,isDropDisabled:l,isCombineEnabled:c,shouldClipSubject:h})=>{const p=r.closestScrollable,g=SD(e,p),x=bh(g,n),b=(()=>{if(!p)return null;const A=R3(p),k={scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth};return{client:A,page:bh(A,n),scroll:d1(p),scrollSize:k,shouldClipSubject:h}})();return CD({descriptor:t,isEnabled:!l,isCombineEnabled:c,isFixedOnPage:r.isFixedOnPage,direction:i,client:g,page:x,closest:b})};const LD={passive:!1},kD={passive:!0};var m5=e=>e.shouldPublishImmediately?LD:kD;const kd=e=>e&&e.env.closestScrollable||null;function ID(e){const t=y.useRef(null),r=Sh(zh),n=im("droppable"),{registry:i,marshal:l}=r,c=b6(e),h=bn(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),p=y.useRef(h),g=bn(()=>ni((F,V)=>{t.current||Ft();const $={x:F,y:V};l.updateDroppableScroll(h.id,$)}),[h.id,l]),x=vr(()=>{const F=t.current;return!F||!F.env.closestScrollable?si:d1(F.env.closestScrollable)},[]),b=vr(()=>{const F=x();g(F.x,F.y)},[x,g]),w=bn(()=>_u(b),[b]),A=vr(()=>{const F=t.current,V=kd(F);if(F&&V||Ft(),F.scrollOptions.shouldPublishImmediately){b();return}w()},[w,b]),k=vr((F,V)=>{t.current&&Ft();const $=c.current,te=$.getDroppableRef();te||Ft();const se=TD(te),qe={ref:te,descriptor:h,env:se,scrollOptions:V};t.current=qe;const de=_D({ref:te,descriptor:h,env:se,windowScroll:F,direction:$.direction,isDropDisabled:$.isDropDisabled,isCombineEnabled:$.isCombineEnabled,shouldClipSubject:!$.ignoreContainerClipping}),oe=se.closestScrollable;return oe&&(oe.setAttribute(c5.contextId,r.contextId),oe.addEventListener("scroll",A,m5(qe.scrollOptions))),de},[r.contextId,h,A,c]),E=vr(()=>{const F=t.current,V=kd(F);return F&&V||Ft(),d1(V)},[]),I=vr(()=>{const F=t.current;F||Ft();const V=kd(F);t.current=null,V&&(w.cancel(),V.removeAttribute(c5.contextId),V.removeEventListener("scroll",A,m5(F.scrollOptions)))},[A,w]),M=vr(F=>{const V=t.current;V||Ft();const $=kd(V);$||Ft(),$.scrollTop+=F.y,$.scrollLeft+=F.x},[]),Q=bn(()=>({getDimensionAndWatchScroll:k,getScrollWhileDragging:E,dragStopped:I,scroll:M}),[I,k,E,M]),j=bn(()=>({uniqueId:n,descriptor:h,callbacks:Q}),[Q,h,n]);Da(()=>(p.current=j.descriptor,i.droppable.register(j),()=>{t.current&&I(),i.droppable.unregister(j)}),[Q,h,I,j,l,i.droppable]),Da(()=>{t.current&&l.updateDroppableIsEnabled(p.current.id,!e.isDropDisabled)},[e.isDropDisabled,l]),Da(()=>{t.current&&l.updateDroppableIsCombineEnabled(p.current.id,e.isCombineEnabled)},[e.isCombineEnabled,l])}function lp(){}const g5={width:0,height:0,margin:PE},ED=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>e||r==="close"?g5:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},ND=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>{const n=ED({isAnimatingOpenOnMount:e,placeholder:t,animate:r});return{display:t.display,boxSizing:"border-box",width:n.width,height:n.height,marginTop:n.margin.top,marginRight:n.margin.right,marginBottom:n.margin.bottom,marginLeft:n.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:r!=="none"?mu.placeholder:null}},RD=e=>{const t=y.useRef(null),r=vr(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:n,onTransitionEnd:i,onClose:l,contextId:c}=e,[h,p]=y.useState(e.animate==="open");y.useEffect(()=>h?n!=="open"?(r(),p(!1),lp):t.current?lp:(t.current=setTimeout(()=>{t.current=null,p(!1)}),r):lp,[n,h,r]);const g=vr(b=>{b.propertyName==="height"&&(i(),n==="close"&&l())},[n,l,i]),x=ND({isAnimatingOpenOnMount:h,animate:e.animate,placeholder:e.placeholder});return C.createElement(e.placeholder.tagName,{style:x,"data-rfd-placeholder-context-id":c,onTransitionEnd:g,ref:e.innerRef})};var MD=C.memo(RD);class DD extends C.PureComponent{constructor(...t){super(...t),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(t,r){return t.shouldAnimate?t.on?{isVisible:!0,data:t.on,animate:"open"}:r.isVisible?{isVisible:!0,data:r.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!t.on,data:t.on,animate:"none"}}render(){if(!this.state.isVisible)return null;const t={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(t)}}const BD=e=>{const t=y.useContext(zh);t||Ft();const{contextId:r,isMovementAllowed:n}=t,i=y.useRef(null),l=y.useRef(null),{children:c,droppableId:h,type:p,mode:g,direction:x,ignoreContainerClipping:b,isDropDisabled:w,isCombineEnabled:A,snapshot:k,useClone:E,updateViewportMaxScroll:I,getContainerForClone:M}=e,Q=vr(()=>i.current,[]),j=vr((oe=null)=>{i.current=oe},[]);vr(()=>l.current,[]);const F=vr((oe=null)=>{l.current=oe},[]),V=vr(()=>{n()&&I({maxScroll:d6()})},[n,I]);ID({droppableId:h,type:p,mode:g,direction:x,isDropDisabled:w,isCombineEnabled:A,ignoreContainerClipping:b,getDroppableRef:Q});const $=bn(()=>C.createElement(DD,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:oe,data:Oe,animate:et})=>C.createElement(MD,{placeholder:Oe,onClose:oe,innerRef:F,animate:et,contextId:r,onTransitionEnd:V})),[r,V,e.placeholder,e.shouldAnimatePlaceholder,F]),te=bn(()=>({innerRef:j,placeholder:$,droppableProps:{"data-rfd-droppable-id":h,"data-rfd-droppable-context-id":r}}),[r,h,$,j]),se=E?E.dragging.draggableId:null,qe=bn(()=>({droppableId:h,type:p,isUsingCloneFor:se}),[h,se,p]);function de(){if(!E)return null;const{dragging:oe,render:Oe}=E,et=C.createElement(k6,{draggableId:oe.draggableId,index:oe.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(ce,Be)=>Oe(ce,Be,oe));return w9.createPortal(et,M())}return C.createElement(om.Provider,{value:qe},c(te,k),de())};function QD(){return document.body||Ft(),document.body}const x5={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:QD},R6=e=>{let t={...e},r;for(r in x5)e[r]===void 0&&(t={...t,[r]:x5[r]});return t},cp=(e,t)=>e===t.droppable.type,b5=(e,t)=>t.draggables[e.draggable.id],jD=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},r=ni(l=>({draggableId:l.id,type:l.type,source:{index:l.index,droppableId:l.droppableId}})),n=ni((l,c,h,p,g,x)=>{const b=g.descriptor.id;if(g.descriptor.droppableId===l){const k=x?{render:x,dragging:r(g.descriptor)}:null,E={isDraggingOver:h,draggingOverWith:h?b:null,draggingFromThisWith:b,isUsingPlaceholder:!0};return{placeholder:g.placeholder,shouldAnimatePlaceholder:!1,snapshot:E,useClone:k}}if(!c)return t;if(!p)return e;const A={isDraggingOver:h,draggingOverWith:b,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:g.placeholder,shouldAnimatePlaceholder:!0,snapshot:A,useClone:null}});return(l,c)=>{const h=R6(c),p=h.droppableId,g=h.type,x=!h.isDropDisabled,b=h.renderClone;if(Ru(l)){const w=l.critical;if(!cp(g,w))return t;const A=b5(w,l.dimensions),k=Ma(l.impact)===p;return n(p,x,k,k,A,b)}if(l.phase==="DROP_ANIMATING"){const w=l.completed;if(!cp(g,w.critical))return t;const A=b5(w.critical,l.dimensions);return n(p,x,_6(w.result)===p,Ma(w.impact)===p,A,b)}if(l.phase==="IDLE"&&l.completed&&!l.shouldFlush){const w=l.completed;if(!cp(g,w.critical))return t;const A=Ma(w.impact)===p,k=!!(w.impact.at&&w.impact.at.type==="COMBINE"),E=w.critical.droppable.id===p;return A?k?e:t:E?e:t}return t}},PD={updateViewportMaxScroll:ZN},ul=E3(jD,PD,(e,t,r)=>({...R6(r),...e,...t}),{context:sm,areStatePropsEqual:S6})(BD);function OD(){if(typeof window>"u")return Gc(void 0);try{const e=window.localStorage.getItem(Zp);return Gc(e?JSON.parse(e):void 0)}catch{return Gc(void 0)}}function up(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(Zp),r=t?JSON.parse(t):{},n=Gc({...r,...e});window.localStorage.setItem(Zp,JSON.stringify(n))}catch{}}function FD(){const[e,t]=C.useState(OD);C.useEffect(()=>{up(e)},[e]);const r=C.useCallback(i=>{t(l=>{const c=Gc({...l,...i});return up(c),c})},[]),n=C.useCallback(()=>{const i=Gc(void 0);t(i),up(i)},[]);return{terminalSettings:e,updateTerminalSettings:r,resetTerminalSettings:n}}const h1="termdock-settings";function $D(e){return e==="shell"||e==="tmux"}function UD(){if(typeof window>"u")return{mode:"shell",tmuxName:"",userSelectedMode:null};try{const e=window.localStorage.getItem(h1);if(!e)return{mode:"shell",tmuxName:"",userSelectedMode:null};const t=JSON.parse(e),r=t.newSessionModeUserSelected===!0&&$D(t.newSessionMode)?t.newSessionMode:null,n=r??"shell",i=typeof t.newSessionTmuxName=="string"?t.newSessionTmuxName:"";return{mode:n,tmuxName:i,userSelectedMode:r}}catch{return{mode:"shell",tmuxName:"",userSelectedMode:null}}}function y5(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(h1),n={...t?JSON.parse(t):{},...e};window.localStorage.setItem(h1,JSON.stringify(n))}catch{}}function zD(){const[e,t]=C.useState(UD),r=C.useCallback((i,l)=>{const c=l?.userInitiated!==!1;t(h=>({...h,mode:i,userSelectedMode:c?i:h.userSelectedMode})),c&&y5({newSessionMode:i,newSessionModeUserSelected:!0})},[]),n=C.useCallback(i=>{t(l=>({...l,tmuxName:i})),y5({newSessionTmuxName:i})},[]);return{newSessionMode:e.mode,newSessionTmuxName:e.tmuxName,userSelectedNewSessionMode:e.userSelectedMode,setNewSessionMode:r,setNewSessionTmuxName:n}}const HD=550,WD=10;function M6(){const e=y.useRef(null),t=y.useRef(null),r=y.useRef(!1),n=y.useRef(!1),i=y.useRef(null),l=y.useCallback(()=>{e.current!=null&&(window.clearTimeout(e.current),e.current=null)},[]),c=y.useCallback(()=>{l(),t.current=null},[l]);return y.useCallback(p=>({onPointerDown:g=>{g.pointerType!=="touch"&&g.pointerType!=="pen"||(c(),r.current=!1,t.current={pointerId:g.pointerId,startX:g.clientX,startY:g.clientY},e.current=window.setTimeout(()=>{e.current=null,t.current&&(r.current=!0,p())},HD))},onPointerMove:g=>{const x=t.current;if(!x||x.pointerId!==g.pointerId||r.current)return;const b=g.clientX-x.startX,w=g.clientY-x.startY;Math.hypot(b,w)>WD&&c()},onPointerUp:g=>{r.current&&(g.preventDefault(),r.current=!1,n.current=!0,i.current!=null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{n.current=!1,i.current=null},600)),c()},onPointerCancel:c,onPointerLeave:g=>{t.current?.pointerId===g.pointerId&&!r.current&&c()},onClickCapture:g=>{n.current&&(n.current=!1,i.current!=null&&(window.clearTimeout(i.current),i.current=null),g.preventDefault(),g.stopPropagation())}}),[c])}function v5({mode:e,activeProgram:t,promptState:r,shellNames:n}){return e!=="tmux"?!1:r==="running"?!0:r==="idle"?!1:t===null||!n.has(t.toLowerCase())}function GD(e,t,r){return!!(e&&t===e&&!r)}function w5({sessionIds:e}){const t=W7(i=>e.reduce((l,c)=>l+(i.unread[c]?.length??0),0)),{locale:r}=Mr();if(!t)return null;const n=r==="zh"?`${t} 条未读进展`:`${t} unread progress updates`;return a.jsx("span",{title:n,"aria-label":n,className:"inline-flex h-4 min-w-4 shrink-0 items-center justify-center rounded-full bg-primary/15 px-1 text-[10px] font-medium text-primary",children:t>99?"99+":t})}function VD(e){if(!e.startsWith("remote:"))return null;const t=e.slice(7).split(":");if(t.length!==2)return null;try{const r=decodeURIComponent(t[0]),n=decodeURIComponent(t[1]),i=new URL(r);return!["https:","http:"].includes(i.protocol)||i.origin!==r||!n?null:{origin:r,sessionId:n}}catch{return null}}async function D6(e){const t=VD(e);if(!t)throw new Error("远端会话标识无效");if(window.termdockDesktop?.collaborationFocus)try{if(await window.termdockDesktop.collaborationFocus(e))return}catch{}window.dispatchEvent(new CustomEvent("termdock:open-remote-session",{detail:t}))}function qD(e,t,r){return Math.max(t,Math.min(e,r))}const os={toVector(e,t){return e===void 0&&(e=t),Array.isArray(e)?e:[e,e]},add(e,t){return[e[0]+t[0],e[1]+t[1]]},sub(e,t){return[e[0]-t[0],e[1]-t[1]]},addTo(e,t){e[0]+=t[0],e[1]+=t[1]},subTo(e,t){e[0]-=t[0],e[1]-=t[1]}};function A5(e,t,r){return t===0||Math.abs(t)===1/0?Math.pow(e,r*5):e*t*r/(t+r*e)}function T5(e,t,r,n=.15){return n===0?qD(e,t,r):e<t?-A5(t-e,r-t,n)+t:e>r?+A5(e-r,r-t,n)+r:e}function YD(e,[t,r],[n,i]){const[[l,c],[h,p]]=e;return[T5(t,l,c,n),T5(r,h,p,i)]}function ZD(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function KD(e){var t=ZD(e,"string");return typeof t=="symbol"?t:String(t)}function Rs(e,t,r){return t=KD(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function C5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function gs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?C5(Object(r),!0).forEach(function(n){Rs(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C5(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}const B6={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function S5(e){return e?e[0].toUpperCase()+e.slice(1):""}const XD=["enter","leave"];function JD(e=!1,t){return e&&!XD.includes(t)}function eB(e,t="",r=!1){const n=B6[e],i=n&&n[t]||t;return"on"+S5(e)+S5(i)+(JD(r,i)?"Capture":"")}const tB=["gotpointercapture","lostpointercapture"];function rB(e){let t=e.substring(2).toLowerCase();const r=!!~t.indexOf("passive");r&&(t=t.replace("passive",""));const n=tB.includes(t)?"capturecapture":"capture",i=!!~t.indexOf(n);return i&&(t=t.replace("capture","")),{device:t,capture:i,passive:r}}function nB(e,t=""){const r=B6[e],n=r&&r[t]||t;return e+n}function Wh(e){return"touches"in e}function Q6(e){return Wh(e)?"touch":"pointerType"in e?e.pointerType:"mouse"}function sB(e){return Array.from(e.touches).filter(t=>{var r,n;return t.target===e.currentTarget||((r=e.currentTarget)===null||r===void 0||(n=r.contains)===null||n===void 0?void 0:n.call(r,t.target))})}function iB(e){return e.type==="touchend"||e.type==="touchcancel"?e.changedTouches:e.targetTouches}function j6(e){return Wh(e)?iB(e)[0]:e}function f1(e,t){try{const r=t.clientX-e.clientX,n=t.clientY-e.clientY,i=(t.clientX+e.clientX)/2,l=(t.clientY+e.clientY)/2,c=Math.hypot(r,n);return{angle:-(Math.atan2(r,n)*180)/Math.PI,distance:c,origin:[i,l]}}catch{}return null}function aB(e){return sB(e).map(t=>t.identifier)}function _5(e,t){const[r,n]=Array.from(e.touches).filter(i=>t.includes(i.identifier));return f1(r,n)}function dp(e){const t=j6(e);return Wh(e)?t.identifier:t.pointerId}function r0(e){const t=j6(e);return[t.clientX,t.clientY]}const L5=40,k5=800;function P6(e){let{deltaX:t,deltaY:r,deltaMode:n}=e;return n===1?(t*=L5,r*=L5):n===2&&(t*=k5,r*=k5),[t,r]}function oB(e){var t,r;const{scrollX:n,scrollY:i,scrollLeft:l,scrollTop:c}=e.currentTarget;return[(t=n??l)!==null&&t!==void 0?t:0,(r=i??c)!==null&&r!==void 0?r:0]}function lB(e){const t={};if("buttons"in e&&(t.buttons=e.buttons),"shiftKey"in e){const{shiftKey:r,altKey:n,metaKey:i,ctrlKey:l}=e;Object.assign(t,{shiftKey:r,altKey:n,metaKey:i,ctrlKey:l})}return t}function _h(e,...t){return typeof e=="function"?e(...t):e}function cB(){}function uB(...e){return e.length===0?cB:e.length===1?e[0]:function(){let t;for(const r of e)t=r.apply(this,arguments)||t;return t}}function I5(e,t){return Object.assign({},t,e||{})}const dB=32;class O6{constructor(t,r,n){this.ctrl=t,this.args=r,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(t){this.ctrl.state[this.key]=t}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:t,shared:r,ingKey:n,args:i}=this;r[n]=t._active=t.active=t._blocked=t._force=!1,t._step=[!1,!1],t.intentional=!1,t._movement=[0,0],t._distance=[0,0],t._direction=[0,0],t._delta=[0,0],t._bounds=[[-1/0,1/0],[-1/0,1/0]],t.args=i,t.axis=void 0,t.memo=void 0,t.elapsedTime=t.timeDelta=0,t.direction=[0,0],t.distance=[0,0],t.overflow=[0,0],t._movementBound=[!1,!1],t.velocity=[0,0],t.movement=[0,0],t.delta=[0,0],t.timeStamp=0}start(t){const r=this.state,n=this.config;r._active||(this.reset(),this.computeInitial(),r._active=!0,r.target=t.target,r.currentTarget=t.currentTarget,r.lastOffset=n.from?_h(n.from,r):r.offset,r.offset=r.lastOffset,r.startTime=r.timeStamp=t.timeStamp)}computeValues(t){const r=this.state;r._values=t,r.values=this.config.transform(t)}computeInitial(){const t=this.state;t._initial=t._values,t.initial=t.values}compute(t){const{state:r,config:n,shared:i}=this;r.args=this.args;let l=0;if(t&&(r.event=t,n.preventDefault&&t.cancelable&&r.event.preventDefault(),r.type=t.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,lB(t)),i.down=i.pressed=i.buttons%2===1||i.touches>0,l=t.timeStamp-r.timeStamp,r.timeStamp=t.timeStamp,r.elapsedTime=r.timeStamp-r.startTime),r._active){const $=r._delta.map(Math.abs);os.addTo(r._distance,$)}this.axisIntent&&this.axisIntent(t);const[c,h]=r._movement,[p,g]=n.threshold,{_step:x,values:b}=r;if(n.hasCustomTransform?(x[0]===!1&&(x[0]=Math.abs(c)>=p&&b[0]),x[1]===!1&&(x[1]=Math.abs(h)>=g&&b[1])):(x[0]===!1&&(x[0]=Math.abs(c)>=p&&Math.sign(c)*p),x[1]===!1&&(x[1]=Math.abs(h)>=g&&Math.sign(h)*g)),r.intentional=x[0]!==!1||x[1]!==!1,!r.intentional)return;const w=[0,0];if(n.hasCustomTransform){const[$,te]=b;w[0]=x[0]!==!1?$-x[0]:0,w[1]=x[1]!==!1?te-x[1]:0}else w[0]=x[0]!==!1?c-x[0]:0,w[1]=x[1]!==!1?h-x[1]:0;this.restrictToAxis&&!r._blocked&&this.restrictToAxis(w);const A=r.offset,k=r._active&&!r._blocked||r.active;k&&(r.first=r._active&&!r.active,r.last=!r._active&&r.active,r.active=i[this.ingKey]=r._active,t&&(r.first&&("bounds"in n&&(r._bounds=_h(n.bounds,r)),this.setup&&this.setup()),r.movement=w,this.computeOffset()));const[E,I]=r.offset,[[M,Q],[j,F]]=r._bounds;r.overflow=[E<M?-1:E>Q?1:0,I<j?-1:I>F?1:0],r._movementBound[0]=r.overflow[0]?r._movementBound[0]===!1?r._movement[0]:r._movementBound[0]:!1,r._movementBound[1]=r.overflow[1]?r._movementBound[1]===!1?r._movement[1]:r._movementBound[1]:!1;const V=r._active?n.rubberband||[0,0]:[0,0];if(r.offset=YD(r._bounds,r.offset,V),r.delta=os.sub(r.offset,A),this.computeMovement(),k&&(!r.last||l>dB)){r.delta=os.sub(r.offset,A);const $=r.delta.map(Math.abs);os.addTo(r.distance,$),r.direction=r.delta.map(Math.sign),r._direction=r._delta.map(Math.sign),!r.first&&l>0&&(r.velocity=[$[0]/l,$[1]/l],r.timeDelta=l)}}emit(){const t=this.state,r=this.shared,n=this.config;if(t._active||this.clean(),(t._blocked||!t.intentional)&&!t._force&&!n.triggerAllEvents)return;const i=this.handler(gs(gs(gs({},r),t),{},{[this.aliasKey]:t.values}));i!==void 0&&(t.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function hB([e,t],r){const n=Math.abs(e),i=Math.abs(t);if(n>i&&n>r)return"x";if(i>n&&i>r)return"y"}class zu extends O6{constructor(...t){super(...t),Rs(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=os.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=os.sub(this.state.offset,this.state.lastOffset)}axisIntent(t){const r=this.state,n=this.config;if(!r.axis&&t){const i=typeof n.axisThreshold=="object"?n.axisThreshold[Q6(t)]:n.axisThreshold;r.axis=hB(r._movement,i)}r._blocked=(n.lockDirection||!!n.axis)&&!r.axis||!!n.axis&&n.axis!==r.axis}restrictToAxis(t){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":t[1]=0;break;case"y":t[0]=0;break}}}const fB=e=>e,E5=.15,F6={enabled(e=!0){return e},eventOptions(e,t,r){return gs(gs({},r.shared.eventOptions),e)},preventDefault(e=!1){return e},triggerAllEvents(e=!1){return e},rubberband(e=0){switch(e){case!0:return[E5,E5];case!1:return[0,0];default:return os.toVector(e)}},from(e){if(typeof e=="function")return e;if(e!=null)return os.toVector(e)},transform(e,t,r){const n=e||r.shared.transform;return this.hasCustomTransform=!!n,n||fB},threshold(e){return os.toVector(e,0)}},pB=0,gc=gs(gs({},F6),{},{axis(e,t,{axis:r}){if(this.lockDirection=r==="lock",!this.lockDirection)return r},axisThreshold(e=pB){return e},bounds(e={}){if(typeof e=="function")return l=>gc.bounds(e(l));if("current"in e)return()=>e.current;if(typeof HTMLElement=="function"&&e instanceof HTMLElement)return e;const{left:t=-1/0,right:r=1/0,top:n=-1/0,bottom:i=1/0}=e;return[[t,r],[n,i]]}}),N5={ArrowRight:(e,t=1)=>[e*t,0],ArrowLeft:(e,t=1)=>[-1*e*t,0],ArrowUp:(e,t=1)=>[0,-1*e*t],ArrowDown:(e,t=1)=>[0,e*t]};class mB extends zu{constructor(...t){super(...t),Rs(this,"ingKey","dragging")}reset(){super.reset();const t=this.state;t._pointerId=void 0,t._pointerActive=!1,t._keyboardActive=!1,t._preventScroll=!1,t._delayed=!1,t.swipe=[0,0],t.tap=!1,t.canceled=!1,t.cancel=this.cancel.bind(this)}setup(){const t=this.state;if(t._bounds instanceof HTMLElement){const r=t._bounds.getBoundingClientRect(),n=t.currentTarget.getBoundingClientRect(),i={left:r.left-n.left+t.offset[0],right:r.right-n.right+t.offset[0],top:r.top-n.top+t.offset[1],bottom:r.bottom-n.bottom+t.offset[1]};t._bounds=gc.bounds(i)}}cancel(){const t=this.state;t.canceled||(t.canceled=!0,t._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(t){const r=this.config,n=this.state;if(t.buttons!=null&&(Array.isArray(r.pointerButtons)?!r.pointerButtons.includes(t.buttons):r.pointerButtons!==-1&&r.pointerButtons!==t.buttons))return;const i=this.ctrl.setEventIds(t);r.pointerCapture&&t.target.setPointerCapture(t.pointerId),!(i&&i.size>1&&n._pointerActive)&&(this.start(t),this.setupPointer(t),n._pointerId=dp(t),n._pointerActive=!0,this.computeValues(r0(t)),this.computeInitial(),r.preventScrollAxis&&Q6(t)!=="mouse"?(n._active=!1,this.setupScrollPrevention(t)):r.delay>0?(this.setupDelayTrigger(t),r.triggerAllEvents&&(this.compute(t),this.emit())):this.startPointerDrag(t))}startPointerDrag(t){const r=this.state;r._active=!0,r._preventScroll=!0,r._delayed=!1,this.compute(t),this.emit()}pointerMove(t){const r=this.state,n=this.config;if(!r._pointerActive)return;const i=dp(t);if(r._pointerId!==void 0&&i!==r._pointerId)return;const l=r0(t);if(document.pointerLockElement===t.target?r._delta=[t.movementX,t.movementY]:(r._delta=os.sub(l,r._values),this.computeValues(l)),os.addTo(r._movement,r._delta),this.compute(t),r._delayed&&r.intentional){this.timeoutStore.remove("dragDelay"),r.active=!1,this.startPointerDrag(t);return}if(n.preventScrollAxis&&!r._preventScroll)if(r.axis)if(r.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){r._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(t);return}else return;this.emit()}pointerUp(t){this.ctrl.setEventIds(t);try{this.config.pointerCapture&&t.target.hasPointerCapture(t.pointerId)&&t.target.releasePointerCapture(t.pointerId)}catch{}const r=this.state,n=this.config;if(!r._active||!r._pointerActive)return;const i=dp(t);if(r._pointerId!==void 0&&i!==r._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(t);const[l,c]=r._distance;if(r.tap=l<=n.tapsThreshold&&c<=n.tapsThreshold,r.tap&&n.filterTaps)r._force=!0;else{const[h,p]=r._delta,[g,x]=r._movement,[b,w]=n.swipe.velocity,[A,k]=n.swipe.distance,E=n.swipe.duration;if(r.elapsedTime<E){const I=Math.abs(h/r.timeDelta),M=Math.abs(p/r.timeDelta);I>b&&Math.abs(g)>A&&(r.swipe[0]=Math.sign(h)),M>w&&Math.abs(x)>k&&(r.swipe[1]=Math.sign(p))}}this.emit()}pointerClick(t){!this.state.tap&&t.detail>0&&(t.preventDefault(),t.stopPropagation())}setupPointer(t){const r=this.config,n=r.device;r.pointerLock&&t.currentTarget.requestPointerLock(),r.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(t){this.state._preventScroll&&t.cancelable&&t.preventDefault()}setupScrollPrevention(t){this.state._preventScroll=!1,gB(t);const r=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",r),this.eventStore.add(this.sharedConfig.window,"touch","cancel",r),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,t)}setupDelayTrigger(t){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(t)},this.config.delay)}keyDown(t){const r=N5[t.key];if(r){const n=this.state,i=t.shiftKey?10:t.altKey?.1:1;this.start(t),n._delta=r(this.config.keyboardDisplacement,i),n._keyboardActive=!0,os.addTo(n._movement,n._delta),this.compute(t),this.emit()}}keyUp(t){t.key in N5&&(this.state._keyboardActive=!1,this.setActive(),this.compute(t),this.emit())}bind(t){const r=this.config.device;t(r,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(t(r,"change",this.pointerMove.bind(this)),t(r,"end",this.pointerUp.bind(this)),t(r,"cancel",this.pointerUp.bind(this)),t("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(t("key","down",this.keyDown.bind(this)),t("key","up",this.keyUp.bind(this))),this.config.filterTaps&&t("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function gB(e){"persist"in e&&typeof e.persist=="function"&&e.persist()}const Hu=typeof window<"u"&&window.document&&window.document.createElement;function $6(){return Hu&&"ontouchstart"in window}function xB(){return $6()||Hu&&window.navigator.maxTouchPoints>1}function bB(){return Hu&&"onpointerdown"in window}function yB(){return Hu&&"exitPointerLock"in window.document}function vB(){try{return"constructor"in GestureEvent}catch{return!1}}const io={isBrowser:Hu,gesture:vB(),touch:$6(),touchscreen:xB(),pointer:bB(),pointerLock:yB()},wB=250,AB=180,TB=.5,CB=50,SB=250,_B=10,R5={mouse:0,touch:0,pen:8},LB=gs(gs({},gc),{},{device(e,t,{pointer:{touch:r=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&io.pointerLock,io.touch&&r?"touch":this.pointerLock?"mouse":io.pointer&&!i?"pointer":io.touch?"touch":"mouse"},preventScrollAxis(e,t,{preventScroll:r}){if(this.preventScrollDelay=typeof r=="number"?r:r||r===void 0&&e?wB:void 0,!(!io.touchscreen||r===!1))return e||(r!==void 0?"y":void 0)},pointerCapture(e,t,{pointer:{capture:r=!0,buttons:n=1,keys:i=!0}={}}){return this.pointerButtons=n,this.keys=i,!this.pointerLock&&this.device==="pointer"&&r},threshold(e,t,{filterTaps:r=!1,tapsThreshold:n=3,axis:i=void 0}){const l=os.toVector(e,r?n:i?1:0);return this.filterTaps=r,this.tapsThreshold=n,l},swipe({velocity:e=TB,distance:t=CB,duration:r=SB}={}){return{velocity:this.transform(os.toVector(e)),distance:this.transform(os.toVector(t)),duration:r}},delay(e=0){switch(e){case!0:return AB;case!1:return 0;default:return e}},axisThreshold(e){return e?gs(gs({},R5),e):R5},keyboardDisplacement(e=_B){return e}});function U6(e){const[t,r]=e.overflow,[n,i]=e._delta,[l,c]=e._direction;(t<0&&n>0&&l<0||t>0&&n<0&&l>0)&&(e._movement[0]=e._movementBound[0]),(r<0&&i>0&&c<0||r>0&&i<0&&c>0)&&(e._movement[1]=e._movementBound[1])}const kB=30,IB=100;class EB extends O6{constructor(...t){super(...t),Rs(this,"ingKey","pinching"),Rs(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const t=this.state;t._touchIds=[],t.canceled=!1,t.cancel=this.cancel.bind(this),t.turns=0}computeOffset(){const{type:t,movement:r,lastOffset:n}=this.state;t==="wheel"?this.state.offset=os.add(r,n):this.state.offset=[(1+r[0])*n[0],r[1]+n[1]]}computeMovement(){const{offset:t,lastOffset:r}=this.state;this.state.movement=[t[0]/r[0],t[1]-r[1]]}axisIntent(){const t=this.state,[r,n]=t._movement;if(!t.axis){const i=Math.abs(r)*kB-Math.abs(n);i<0?t.axis="angle":i>0&&(t.axis="scale")}}restrictToAxis(t){this.config.lockDirection&&(this.state.axis==="scale"?t[1]=0:this.state.axis==="angle"&&(t[0]=0))}cancel(){const t=this.state;t.canceled||setTimeout(()=>{t.canceled=!0,t._active=!1,this.compute(),this.emit()},0)}touchStart(t){this.ctrl.setEventIds(t);const r=this.state,n=this.ctrl.touchIds;if(r._active&&r._touchIds.every(l=>n.has(l))||n.size<2)return;this.start(t),r._touchIds=Array.from(n).slice(0,2);const i=_5(t,r._touchIds);i&&this.pinchStart(t,i)}pointerStart(t){if(t.buttons!=null&&t.buttons%2!==1)return;this.ctrl.setEventIds(t),t.target.setPointerCapture(t.pointerId);const r=this.state,n=r._pointerEvents,i=this.ctrl.pointerIds;if(r._active&&Array.from(n.keys()).every(c=>i.has(c))||(n.size<2&&n.set(t.pointerId,t),r._pointerEvents.size<2))return;this.start(t);const l=f1(...Array.from(n.values()));l&&this.pinchStart(t,l)}pinchStart(t,r){const n=this.state;n.origin=r.origin,this.computeValues([r.distance,r.angle]),this.computeInitial(),this.compute(t),this.emit()}touchMove(t){if(!this.state._active)return;const r=_5(t,this.state._touchIds);r&&this.pinchMove(t,r)}pointerMove(t){const r=this.state._pointerEvents;if(r.has(t.pointerId)&&r.set(t.pointerId,t),!this.state._active)return;const n=f1(...Array.from(r.values()));n&&this.pinchMove(t,n)}pinchMove(t,r){const n=this.state,i=n._values[1],l=r.angle-i;let c=0;Math.abs(l)>270&&(c+=Math.sign(l)),this.computeValues([r.distance,r.angle-360*c]),n.origin=r.origin,n.turns=c,n._movement=[n._values[0]/n._initial[0]-1,n._values[1]-n._initial[1]],this.compute(t),this.emit()}touchEnd(t){this.ctrl.setEventIds(t),this.state._active&&this.state._touchIds.some(r=>!this.ctrl.touchIds.has(r))&&(this.state._active=!1,this.compute(t),this.emit())}pointerEnd(t){const r=this.state;this.ctrl.setEventIds(t);try{t.target.releasePointerCapture(t.pointerId)}catch{}r._pointerEvents.has(t.pointerId)&&r._pointerEvents.delete(t.pointerId),r._active&&r._pointerEvents.size<2&&(r._active=!1,this.compute(t),this.emit())}gestureStart(t){t.cancelable&&t.preventDefault();const r=this.state;r._active||(this.start(t),this.computeValues([t.scale,t.rotation]),r.origin=[t.clientX,t.clientY],this.compute(t),this.emit())}gestureMove(t){if(t.cancelable&&t.preventDefault(),!this.state._active)return;const r=this.state;this.computeValues([t.scale,t.rotation]),r.origin=[t.clientX,t.clientY];const n=r._movement;r._movement=[t.scale-1,t.rotation],r._delta=os.sub(r._movement,n),this.compute(t),this.emit()}gestureEnd(t){this.state._active&&(this.state._active=!1,this.compute(t),this.emit())}wheel(t){const r=this.config.modifierKey;r&&(Array.isArray(r)?!r.find(n=>t[n]):!t[r])||(this.state._active?this.wheelChange(t):this.wheelStart(t),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(t){this.start(t),this.wheelChange(t)}wheelChange(t){"uv"in t||t.cancelable&&t.preventDefault();const n=this.state;n._delta=[-P6(t)[1]/IB*n.offset[0],0],os.addTo(n._movement,n._delta),U6(n),this.state.origin=[t.clientX,t.clientY],this.compute(t),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(t){const r=this.config.device;r&&(t(r,"start",this[r+"Start"].bind(this)),t(r,"change",this[r+"Move"].bind(this)),t(r,"end",this[r+"End"].bind(this)),t(r,"cancel",this[r+"End"].bind(this)),t("lostPointerCapture","",this[r+"End"].bind(this))),this.config.pinchOnWheel&&t("wheel","",this.wheel.bind(this),{passive:!1})}}const NB=gs(gs({},F6),{},{device(e,t,{shared:r,pointer:{touch:n=!1}={}}){if(r.target&&!io.touch&&io.gesture)return"gesture";if(io.touch&&n)return"touch";if(io.touchscreen){if(io.pointer)return"pointer";if(io.touch)return"touch"}},bounds(e,t,{scaleBounds:r={},angleBounds:n={}}){const i=c=>{const h=I5(_h(r,c),{min:-1/0,max:1/0});return[h.min,h.max]},l=c=>{const h=I5(_h(n,c),{min:-1/0,max:1/0});return[h.min,h.max]};return typeof r!="function"&&typeof n!="function"?[i(),l()]:c=>[i(c),l(c)]},threshold(e,t,r){return this.lockDirection=r.axis==="lock",os.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey(e){return e===void 0?"ctrlKey":e},pinchOnWheel(e=!0){return e}});class RB extends zu{constructor(...t){super(...t),Rs(this,"ingKey","moving")}move(t){this.config.mouseOnly&&t.pointerType!=="mouse"||(this.state._active?this.moveChange(t):this.moveStart(t),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(t){this.start(t),this.computeValues(r0(t)),this.compute(t),this.computeInitial(),this.emit()}moveChange(t){if(!this.state._active)return;const r=r0(t),n=this.state;n._delta=os.sub(r,n._values),os.addTo(n._movement,n._delta),this.computeValues(r),this.compute(t),this.emit()}moveEnd(t){this.state._active&&(this.state._active=!1,this.compute(t),this.emit())}bind(t){t("pointer","change",this.move.bind(this)),t("pointer","leave",this.moveEnd.bind(this))}}const MB=gs(gs({},gc),{},{mouseOnly:(e=!0)=>e});class DB extends zu{constructor(...t){super(...t),Rs(this,"ingKey","scrolling")}scroll(t){this.state._active||this.start(t),this.scrollChange(t),this.timeoutStore.add("scrollEnd",this.scrollEnd.bind(this))}scrollChange(t){t.cancelable&&t.preventDefault();const r=this.state,n=oB(t);r._delta=os.sub(n,r._values),os.addTo(r._movement,r._delta),this.computeValues(n),this.compute(t),this.emit()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(t){t("scroll","",this.scroll.bind(this))}}const BB=gc;class QB extends zu{constructor(...t){super(...t),Rs(this,"ingKey","wheeling")}wheel(t){this.state._active||this.start(t),this.wheelChange(t),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(t){const r=this.state;r._delta=P6(t),os.addTo(r._movement,r._delta),U6(r),this.compute(t),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(t){t("wheel","",this.wheel.bind(this))}}const jB=gc;class PB extends zu{constructor(...t){super(...t),Rs(this,"ingKey","hovering")}enter(t){this.config.mouseOnly&&t.pointerType!=="mouse"||(this.start(t),this.computeValues(r0(t)),this.compute(t),this.emit())}leave(t){if(this.config.mouseOnly&&t.pointerType!=="mouse")return;const r=this.state;if(!r._active)return;r._active=!1;const n=r0(t);r._movement=r._delta=os.sub(n,r._values),this.computeValues(n),this.compute(t),r.delta=r.movement,this.emit()}bind(t){t("pointer","enter",this.enter.bind(this)),t("pointer","leave",this.leave.bind(this))}}const OB=gs(gs({},gc),{},{mouseOnly:(e=!0)=>e}),lm=new Map,p1=new Map;function z6(e){lm.set(e.key,e.engine),p1.set(e.key,e.resolver)}const H6={key:"drag",engine:mB,resolver:LB},FB={key:"hover",engine:PB,resolver:OB},$B={key:"move",engine:RB,resolver:MB},UB={key:"pinch",engine:EB,resolver:NB},zB={key:"scroll",engine:DB,resolver:BB},HB={key:"wheel",engine:QB,resolver:jB};function WB(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,l;for(l=0;l<n.length;l++)i=n[l],!(t.indexOf(i)>=0)&&(r[i]=e[i]);return r}function GB(e,t){if(e==null)return{};var r=WB(e,t),n,i;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(i=0;i<l.length;i++)n=l[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}const VB={target(e){if(e)return()=>"current"in e?e.current:e},enabled(e=!0){return e},window(e=io.isBrowser?window:void 0){return e},eventOptions({passive:e=!0,capture:t=!1}={}){return{passive:e,capture:t}},transform(e){return e}},qB=["target","eventOptions","window","enabled","transform"];function th(e={},t){const r={};for(const[n,i]of Object.entries(t))switch(typeof i){case"function":r[n]=i.call(r,e[n],n,e);break;case"object":r[n]=th(e[n],i);break;case"boolean":i&&(r[n]=e[n]);break}return r}function YB(e,t,r={}){const n=e,{target:i,eventOptions:l,window:c,enabled:h,transform:p}=n,g=GB(n,qB);if(r.shared=th({target:i,eventOptions:l,window:c,enabled:h,transform:p},VB),t){const x=p1.get(t);r[t]=th(gs({shared:r.shared},g),x)}else for(const x in g){const b=p1.get(x);b&&(r[x]=th(gs({shared:r.shared},g[x]),b))}return r}class W6{constructor(t,r){Rs(this,"_listeners",new Set),this._ctrl=t,this._gestureKey=r}add(t,r,n,i,l){const c=this._listeners,h=nB(r,n),p=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},g=gs(gs({},p),l);t.addEventListener(h,i,g);const x=()=>{t.removeEventListener(h,i,g),c.delete(x)};return c.add(x),x}clean(){this._listeners.forEach(t=>t()),this._listeners.clear()}}class ZB{constructor(){Rs(this,"_timeouts",new Map)}add(t,r,n=140,...i){this.remove(t),this._timeouts.set(t,window.setTimeout(r,n,...i))}remove(t){const r=this._timeouts.get(t);r&&window.clearTimeout(r)}clean(){this._timeouts.forEach(t=>{window.clearTimeout(t)}),this._timeouts.clear()}}class KB{constructor(t){Rs(this,"gestures",new Set),Rs(this,"_targetEventStore",new W6(this)),Rs(this,"gestureEventStores",{}),Rs(this,"gestureTimeoutStores",{}),Rs(this,"handlers",{}),Rs(this,"config",{}),Rs(this,"pointerIds",new Set),Rs(this,"touchIds",new Set),Rs(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),XB(this,t)}setEventIds(t){if(Wh(t))return this.touchIds=new Set(aB(t)),this.touchIds;if("pointerId"in t)return t.type==="pointerup"||t.type==="pointercancel"?this.pointerIds.delete(t.pointerId):t.type==="pointerdown"&&this.pointerIds.add(t.pointerId),this.pointerIds}applyHandlers(t,r){this.handlers=t,this.nativeHandlers=r}applyConfig(t,r){this.config=YB(t,r,this.config)}clean(){this._targetEventStore.clean();for(const t of this.gestures)this.gestureEventStores[t].clean(),this.gestureTimeoutStores[t].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...t){const r=this.config.shared,n={};let i;if(!(r.target&&(i=r.target(),!i))){if(r.enabled){for(const c of this.gestures){const h=this.config[c],p=M5(n,h.eventOptions,!!i);if(h.enabled){const g=lm.get(c);new g(this,t,c).bind(p)}}const l=M5(n,r.eventOptions,!!i);for(const c in this.nativeHandlers)l(c,"",h=>this.nativeHandlers[c](gs(gs({},this.state.shared),{},{event:h,args:t})),void 0,!0)}for(const l in n)n[l]=uB(...n[l]);if(!i)return n;for(const l in n){const{device:c,capture:h,passive:p}=rB(l);this._targetEventStore.add(i,c,"",n[l],{capture:h,passive:p})}}}}function Mc(e,t){e.gestures.add(t),e.gestureEventStores[t]=new W6(e,t),e.gestureTimeoutStores[t]=new ZB}function XB(e,t){t.drag&&Mc(e,"drag"),t.wheel&&Mc(e,"wheel"),t.scroll&&Mc(e,"scroll"),t.move&&Mc(e,"move"),t.pinch&&Mc(e,"pinch"),t.hover&&Mc(e,"hover")}const M5=(e,t,r)=>(n,i,l,c={},h=!1)=>{var p,g;const x=(p=c.capture)!==null&&p!==void 0?p:t.capture,b=(g=c.passive)!==null&&g!==void 0?g:t.passive;let w=h?n:eB(n,i,x);r&&b&&(w+="Passive"),e[w]=e[w]||[],e[w].push(l)},JB=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function eQ(e){const t={},r={},n=new Set;for(let i in e)JB.test(i)?(n.add(RegExp.lastMatch),r[i]=e[i]):t[i]=e[i];return[r,t,n]}function Dc(e,t,r,n,i,l){if(!e.has(r)||!lm.has(n))return;const c=r+"Start",h=r+"End",p=g=>{let x;return g.first&&c in t&&t[c](g),r in t&&(x=t[r](g)),g.last&&h in t&&t[h](g),x};i[n]=p,l[n]=l[n]||{}}function tQ(e,t){const[r,n,i]=eQ(e),l={};return Dc(i,r,"onDrag","drag",l,t),Dc(i,r,"onWheel","wheel",l,t),Dc(i,r,"onScroll","scroll",l,t),Dc(i,r,"onPinch","pinch",l,t),Dc(i,r,"onMove","move",l,t),Dc(i,r,"onHover","hover",l,t),{handlers:l,config:t,nativeHandlers:n}}function G6(e,t={},r,n){const i=C.useMemo(()=>new KB(e),[]);if(i.applyHandlers(e,n),i.applyConfig(t,r),C.useEffect(i.effect.bind(i)),C.useEffect(()=>i.clean.bind(i),[]),t.target===void 0)return i.bind.bind(i)}function D5(e,t){return z6(H6),G6({drag:e},t||{},"drag")}function rQ(e){return e.forEach(z6),function(r,n){const{handlers:i,nativeHandlers:l,config:c}=tQ(r,n||{});return G6(i,c,void 0,l)}}function JO(e,t){return rQ([H6,UB,zB,HB,$B,FB])(e,t||{})}const B5={dampingRatio:.8,response:.3},nQ=.998;function sQ(e,t,r,n){const i=2*Math.PI/Math.max(e.response,.001),l=t-n,c=r,h=e.dampingRatio;if(Math.abs(h-1)<1e-4){const A=l,k=c+i*l;return{value:E=>n+(A+k*E)*Math.exp(-i*E),velocity:E=>(k-i*(A+k*E))*Math.exp(-i*E)}}if(h<1){const A=i*Math.sqrt(1-h*h),k=l,E=(c+h*i*l)/A;return{value:I=>n+Math.exp(-h*i*I)*(k*Math.cos(A*I)+E*Math.sin(A*I)),velocity:I=>Math.exp(-h*i*I)*((E*A-h*i*k)*Math.cos(A*I)-(k*A+h*i*E)*Math.sin(A*I))}}const p=i*Math.sqrt(h*h-1),g=-h*i+p,x=-h*i-p,b=(c-x*l)/(g-x),w=l-b;return{value:A=>n+b*Math.exp(g*A)+w*Math.exp(x*A),velocity:A=>b*g*Math.exp(g*A)+w*x*Math.exp(x*A)}}function iQ(e,t=nQ){return e/1e3*(t/(1-t))}function Q5(e,t,r=.55){return e*t*r/(t+r*Math.abs(e))}function aQ(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const oQ=.1,lQ=5;function cQ(e,t,r,n,i){const l=sQ(e,t,r,n),c=1e3/60,h=240,p=[];for(let g=0;g<h;g++){const x=g*c/1e3,b=l.value(x),w=l.velocity(x);if(p.push(i?i(b):b),g>0&&Math.abs(b-n)<oQ&&Math.abs(w)<lQ)break}return p.push(i?i(n):n),{frames:p,durationMs:(p.length-1)*c,solver:l}}const uQ='input:not([type="hidden"]), textarea, select, [contenteditable]:not([contenteditable="false"])';function dQ(){if(typeof document>"u")return;const e=document.activeElement;e instanceof HTMLElement&&e.matches(uQ)&&e.blur()}const hQ=18,j5=8,P5={touch:j5,pen:j5},fQ=500,hp=200,O5=50,pQ=`[${C9}]`;function fp(e,t,r){return Math.min(r,Math.max(t,e))}function F5(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.pointerType=="string"?t.pointerType==="touch"||t.pointerType==="pen":typeof t.type=="string"&&t.type.startsWith("touch")}function $5(e){if(!e||typeof e!="object")return!1;const t=e.target;return t instanceof Element&&!!t.closest(pQ)}function G0(...e){typeof window<"u"&&window.__SIDEBAR_DEBUG__&&console.log("[Sidebar]",...e)}const V6=C.forwardRef(function({side:t,isOpen:r,drawerWidthPx:n,onClose:i,onOpen:l,children:c,pinned:h=!1},p){const{t:g}=Mr(),x=t==="left",b=x?-n:n,w=y.useRef(null),A=y.useRef(null),k=y.useRef(r?0:b),E=y.useRef(null),I=y.useRef(null),M=y.useRef(0),Q=y.useRef(null),j=y.useRef(null),F=y.useRef(!1),V=y.useRef(null),$=y.useRef(!1),te=y.useRef([]),se=y.useRef(null),qe=y.useRef(k.current),de=y.useRef(r?1:0),oe=y.useRef(r);oe.current=r;const Oe=y.useRef(b);Oe.current=b;const et=y.useRef(n);et.current=n;const ce=y.useRef(x);ce.current=x;const Be=y.useRef(i);Be.current=i;const ot=y.useRef(l);ot.current=l;const Ie=y.useCallback(pe=>{w.current=pe,typeof p=="function"?p(pe):p&&(p.current=pe)},[p]),re=y.useCallback(()=>{I.current!==null&&(window.cancelAnimationFrame(I.current),I.current=null),E.current=null},[]),Ue=y.useCallback(pe=>{const je=et.current;return ce.current?(pe+je)/je:(je-pe)/je},[]),_e=y.useCallback(pe=>{const je=A.current;je&&(je.style.opacity=String(fp(Ue(pe),0,1)))},[Ue]),K=y.useCallback(pe=>{k.current=pe;const je=w.current;je&&(je.style.transform=`translateX(${pe}px)`,_e(pe))},[_e]),Le=y.useCallback(pe=>{E.current=pe,I.current===null&&(I.current=window.requestAnimationFrame(()=>{I.current=null;const je=E.current;E.current=null,je!==null&&K(je)}))},[K]),fe=y.useCallback(()=>{I.current!==null&&(window.cancelAnimationFrame(I.current),I.current=null);const pe=E.current;E.current=null,pe!==null&&K(pe)},[K]),$e=y.useCallback(pe=>{const je=Oe.current;return fp(pe,Math.min(0,je),Math.max(0,je))},[]),ze=y.useCallback(()=>{const pe=Q.current;if(!pe)return null;Q.current=null;const je=(performance.now()-pe.startTime)/1e3,xt={value:pe.solver.value(je),velocity:pe.solver.velocity(je)};return pe.animations.forEach(dt=>dt.cancel()),xt},[]),Ee=y.useCallback(()=>{j.current!==null&&(window.clearTimeout(j.current),j.current=null)},[]),ee=y.useCallback(()=>{se.current?.(),se.current=null},[]),Ke=y.useCallback(()=>{fe(),Ee();const pe=ze();pe&&K($e(pe.value));const je=w.current,xt=A.current;je?.getAnimations().forEach(dt=>dt.cancel()),je&&(je.style.transition="none",je.style.opacity="1"),xt?.getAnimations().forEach(dt=>dt.cancel()),xt&&(xt.style.transition="none")},[K,Ee,$e,fe,ze]),wt=y.useCallback((pe,je)=>{fe(),Ee();const xt=w.current,dt=A.current,Dt=pe?0:Oe.current;dt&&(dt.style.pointerEvents=pe?"auto":"none");const Xt=ze(),Ht=Xt?$e(Xt.value):k.current,Bt=je?.velocity??Xt?.velocity??0;if(aQ())return k.current=Dt,xt&&(xt.style.transition=`opacity ${hp}ms ease`,xt.style.opacity=pe?"1":"0",xt.style.transform=`translateX(${Dt}px)`),dt&&(dt.style.transition=`opacity ${hp}ms ease`,dt.style.opacity=pe?"1":"0"),hp;xt&&(xt.style.transition="none",xt.style.opacity="1"),dt&&(dt.style.transition="none");const Wt=Math.abs(je?.velocity??0)>fQ,{frames:lr,durationMs:ur,solver:Jt}=cQ({dampingRatio:Wt?B5.dampingRatio:1,response:B5.response},Ht,Bt,Dt,$e);if(!xt||Math.abs(Ht-Dt)<.5&&Math.abs(Bt)<5)return K(Dt),0;const Er=xt.animate(lr.map(Re=>({transform:`translateX(${Re}px)`})),{duration:ur,easing:"linear",fill:"forwards"}),X=[Er];return dt&&X.push(dt.animate(lr.map(Re=>({opacity:String(fp(Ue(Re),0,1))})),{duration:ur,easing:"linear",fill:"forwards"})),Q.current={solver:Jt,startTime:performance.now(),target:Dt,animations:X},G0("spring start",{startX:Ht,startVelocity:Bt,targetX:Dt,frames:lr.length,durationMs:ur}),Er.onfinish=()=>{const Re=Q.current;!Re||!Re.animations.includes(Er)||(Q.current=null,K(Dt),Re.animations.forEach(We=>We.cancel()),G0("spring finish",{targetX:Dt}))},ur},[K,Ee,$e,fe,Ue,ze]),tt=y.useCallback(pe=>{fe();const je=pe,xt=0,dt=Oe.current,Dt=k.current+iQ(je),Xt=Math.abs(Dt-xt)<=Math.abs(Dt-dt);G0("decideSnap",{velocity:je,currentX:k.current,projected:Dt,shouldOpen:Xt});const Ht=wt(Xt,{velocity:je});return Xt&&!oe.current?j.current=window.setTimeout(()=>{j.current=null,ot.current?.()},Ht+O5):!Xt&&oe.current&&(j.current=window.setTimeout(()=>{j.current=null,Be.current()},Ht+O5)),Xt},[wt,fe]),ge=y.useCallback(pe=>{const je=Oe.current,xt=Math.min(0,je),dt=Math.max(0,je),Dt=et.current;return pe<xt?xt-Q5(xt-pe,Dt):pe>dt?dt+Q5(pe-dt,Dt):pe},[]),it=y.useCallback(pe=>{const je=te.current,xt=performance.now();je.push({t:xt,x:pe});const dt=xt-120;for(;je.length>0&&je[0].t<dt;)je.shift()},[]),ht=y.useCallback(()=>{const pe=te.current;if(pe.length<2)return 0;const je=pe[pe.length-1];if(performance.now()-je.t>60)return 0;const xt=pe[0],dt=(je.t-xt.t)/1e3;return dt<.016?0:(je.x-xt.x)/dt},[]);y.useEffect(()=>{Ee();const pe=Q.current,je=r?0:Oe.current;pe&&pe.target===je||wt(r)},[r,wt,Ee]),y.useEffect(()=>{Ke(),Le(oe.current?0:b)},[b,Ke,Le]),y.useEffect(()=>()=>{re(),Ee(),ze(),ee()},[Ee,re,ee,ze]);const Y=D5(({active:pe,cancel:je,first:xt,last:dt,movement:[Dt],event:Xt})=>{if(G0("bindPanel",{active:pe,first:xt,last:dt,mx:Dt}),!F5(Xt)){je();return}if(xt){if(ee(),F.current=!1,V.current=null,te.current=[],$5(Xt)){je();return}const Ht=w.current,Bt=Ht?S9(Xt.target,Ht):null;if(!Bt||_9()){je();return}const Wt=L9(Bt,Dt,ce.current?-1:1);if(G0("arbitrate",{owner:Wt.kind,mx:Dt}),Wt.kind==="swiper"){se.current=k9(Wt.instance),je();return}if(Wt.kind==="scroller"){const lr=I9(Wt.element);if(lr)V.current=lr;else{je();return}}V.current||(F.current=!0,Ke(),M.current=k.current)}if(!pe){V.current=null,F.current&&(F.current=!1,tt(ht()));return}if(V.current){E9(V.current,Dt);return}if(F.current){const Ht=ge(M.current+Dt);it(Ht),Le(Ht)}},{axis:"x",axisThreshold:P5,filterTaps:!0,pointer:{touch:!0}}),be=D5(({active:pe,cancel:je,first:xt,movement:[dt],event:Dt})=>{if(!F5(Dt)){je();return}if(oe.current){je();return}if(xt&&($.current=!0,te.current=[],Ke(),M.current=k.current),!pe){$.current&&($.current=!1,tt(ht())&&dQ());return}if($.current){const Xt=ge(M.current+dt);it(Xt),Le(Xt)}},{axis:"x",axisThreshold:P5,filterTaps:!0,pointer:{touch:!0}}),ut=y.useCallback(pe=>{pe.preventDefault(),pe.stopPropagation(),oe.current||ot.current?.()},[]);if(h)return a.jsx("aside",{ref:Ie,"data-sidebar":t,"data-sidebar-pinned":"true",className:"relative flex h-full min-h-0 w-full flex-col app-chrome-bg",children:c});const le=Y();return a.jsxs(a.Fragment,{children:[a.jsx("div",{...be(),style:{position:"fixed",top:"1.5rem",bottom:"10rem",...x?{left:0}:{right:0},width:hQ,zIndex:"var(--z-chrome-hint)",touchAction:"none",pointerEvents:r?"none":"auto"},onClick:ut,"aria-label":g(x?"sidebar.openLeftSidebar":"sidebar.openRightSidebar")}),a.jsx("div",{ref:A,"data-sidebar-backdrop":t,className:"fixed inset-0 z-sidebar-backdrop bg-[var(--app-backdrop)] cursor-default",style:{opacity:de.current,pointerEvents:r?"auto":"none",transition:"none",willChange:"opacity"},onClick:i,"aria-label":g("sidebar.closeSidebar")}),a.jsx("aside",{...le,onClickCapture:pe=>{$5(pe)||le.onClickCapture?.(pe)},ref:Ie,"data-sidebar":t,className:`fixed inset-y-0 z-sidebar-panel flex flex-col chrome-glow-panel will-change-transform ${x?"border-r border-border":"border-l border-border/15"}`,style:{...x?{left:0}:{right:0},width:n,maxWidth:x?"94vw":"95vw",transform:`translateX(${qe.current}px)`,transition:"none",touchAction:"pan-y",pointerEvents:r?"auto":"none",paddingTop:"var(--safe-top-inset, env(safe-area-inset-top, 0px))",paddingBottom:"var(--safe-bottom-inset, env(safe-area-inset-bottom, 0px))",...x?{paddingLeft:"var(--safe-left-inset, env(safe-area-inset-left, 0px))"}:{paddingRight:"var(--safe-right-inset, env(safe-area-inset-right, 0px))"}},children:c})]})}),mQ={activeKey:"root",items:[]},gQ=()=>()=>{},xQ=()=>mQ;function bQ(e){const t=Vo(),r=y.useSyncExternalStore(t?.subscribe??gQ,t?.snapshot??xQ),n=G7(),i=r.items.map(l=>l.key===n?{...l,reviewCount:e}:l).filter(l=>l.reviewCount>0);return{host:t,groups:i,currentKey:n,active:!t||r.activeKey===n,total:t?e+i.reduce((l,c)=>l+(c.key===n?0:c.reviewCount),0):e,hasOtherAttention:i.some(l=>l.key!==n)}}function yQ({groups:e,currentKey:t,onClose:r}){const{t:n}=Mr(),i=y.useId(),l=y.useRef(null),c=y.useRef(null),h=y.useRef(r);h.current=r;const p=y.useRef(!0),[g,x]=y.useState(""),b=e.reduce((k,E)=>k+E.reviewCount,0);y.useEffect(()=>{const k=document.activeElement;c.current?.focus({preventScroll:!0});const E=I=>{if(I.key==="Escape"&&(I.preventDefault(),I.stopImmediatePropagation(),h.current()),I.key!=="Tab")return;const M=Array.from(l.current?.querySelectorAll("button:not(:disabled)")??[]),Q=M[0],j=M[M.length-1],F=!l.current?.contains(document.activeElement);I.shiftKey&&(document.activeElement===Q||F)?(I.preventDefault(),j?.focus()):!I.shiftKey&&(document.activeElement===j||F)&&(I.preventDefault(),Q?.focus())};return document.addEventListener("keydown",E,!0),()=>{document.removeEventListener("keydown",E,!0),p.current&&k?.isConnected&&!k.closest("[inert]")&&k.focus({preventScroll:!0})}},[]);const w=(k,E)=>{const I=Vo(),M=I?.snapshot().items.find(j=>j.key===k.key);if(!M?.reviewCount||E&&!M.attentionSessions?.some(j=>j.id===E)){x(n("serviceAttention.changed"));return}p.current=!1;let Q=!1;E&&k.key===t?(window.dispatchEvent(new CustomEvent("termdock:focus-session",{detail:E})),Q=!0):E&&M.service?.targetPeerId?Q=I?.focusSession(M.service.targetPeerId,E)??!1:M.service&&(Q=I?.activate(M.service,!0)??!1),Q?r():(p.current=!0,x(n("serviceAttention.unavailable")))},A=k=>k.phase==="offline"?n("serviceAttention.offline"):k.phase==="login"?n("serviceAttention.login"):k.phase==="connecting"||k.phase==="reconnecting"?n("connection.reconnecting"):null;return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button","aria-label":n("common.close"),tabIndex:-1,className:"fixed inset-0 z-modal-backdrop cursor-default bg-[var(--app-backdrop)]",onClick:r}),a.jsx("div",{className:"pointer-events-none fixed inset-0 z-modal-panel flex items-end justify-center p-3 sm:items-center sm:p-6",style:{paddingTop:"max(12px, var(--safe-top-inset, env(safe-area-inset-top, 0px)))",paddingBottom:"max(12px, var(--safe-bottom-inset, env(safe-area-inset-bottom, 0px)))"},children:a.jsxs("section",{ref:l,role:"dialog","aria-modal":"true","aria-labelledby":i,"data-sidebar-gesture-ignore":!0,onKeyDown:k=>k.stopPropagation(),className:"pointer-events-auto flex max-h-full w-full max-w-md flex-col overflow-hidden rounded-2xl border border-border bg-surface text-foreground shadow-xl",children:[a.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[a.jsx(jl,{size:20,className:"shrink-0 text-[color:var(--warning)]","aria-hidden":"true"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{id:i,className:"text-sm font-semibold",children:n("serviceAttention.title")}),a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:n("serviceAttention.summary",{services:e.length,count:b})})]}),a.jsx("button",{ref:c,type:"button","aria-label":n("common.close"),onClick:r,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl text-muted-foreground hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:a.jsx(Kn,{size:18})})]}),a.jsxs("div",{className:"min-h-0 overflow-y-auto overscroll-contain p-2",children:[e.length===0&&a.jsx("p",{role:"status",className:"px-4 py-8 text-center text-sm text-muted-foreground",children:n("serviceAttention.empty")}),e.map(k=>a.jsxs("section",{className:"mb-2 last:mb-0",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-3 pb-1 pt-2 text-xs",children:[a.jsx("h3",{className:"min-w-0 flex-1 truncate font-medium",title:k.service?.label,children:k.service?.label||n("serviceAttention.currentService")}),k.key===t&&a.jsx("span",{className:"shrink-0 text-muted-foreground",children:n("agent.currentSession")}),a.jsx("span",{className:"shrink-0 tabular-nums text-[color:var(--warning)]",children:k.reviewCount})]}),A(k)&&a.jsx("p",{className:"px-3 pb-1 text-xs text-[color:var(--warning)]",children:A(k)}),k.attentionSessions?.length?k.attentionSessions.map(E=>a.jsxs("button",{type:"button",onClick:()=>w(k,E.id),className:"flex min-h-14 w-full items-center gap-3 rounded-xl px-3 py-2 text-left hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"line-clamp-2 break-words text-sm",title:E.label,children:E.label}),a.jsx("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:E.waiting?n("serviceAttention.waiting"):n("agent.needsReview")})]}),a.jsx(Yc,{size:16,className:"shrink-0 text-muted-foreground","aria-hidden":"true"})]},E.id)):a.jsx("button",{type:"button",onClick:()=>w(k),className:"min-h-11 w-full rounded-xl px-3 py-2 text-left text-sm hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",children:n("serviceAttention.viewService")})]},k.key))]}),a.jsxs("footer",{className:"shrink-0 border-t border-border px-4 py-3 text-xs text-muted-foreground",children:[g&&a.jsx("p",{role:"alert",className:"mb-1 text-[color:var(--warning)]",children:g}),n("serviceAttention.scope")]})]})})]})}function vQ(e){const t=e.icon&&e.isPlugin?`/api/terminal/agent-plugin-icon/${encodeURIComponent(e.slug)}${e.iconVersion?`?v=${Math.floor(e.iconVersion)}`:""}`:void 0,[r,n]=y.useState();if(y.useEffect(()=>{if(n(void 0),!t)return;const i=new AbortController;let l;return fetch(t,{signal:i.signal}).then(async c=>{if(!c.ok)throw new Error(`Icon request failed: ${c.status}`);const h=await c.blob();i.signal.aborted||(l=URL.createObjectURL(h),n({endpoint:t,src:l}))}).catch(()=>{}),()=>{i.abort(),l&&URL.revokeObjectURL(l)}},[t]),!!e.icon)return e.isPlugin?r?.endpoint===t?r?.src:void 0:`/icons/agents/${e.icon}.svg`}function wQ(e){return e.agentStatus==="waiting"||e.agentNeedsReview===!0}function AQ(e,t,r,n="next"){if(e.length===0)return null;const i=t?e.findIndex(l=>l.sessionId===t):-1;for(let l=1;l<=e.length;l+=1){const c=n==="next"?l:-l,h=(i+c+e.length)%e.length,p=e[h];if(p&&r(p))return p.sessionId}return null}function TQ(e,t,r="next"){return AQ(e,t,wQ,r)}const Ra=42,Lh=20,CQ=10;function m1(e,t,r){return Math.min(r,Math.max(t,e))}function Gh(e){const t=Math.max(0,e.safeTop??0),r=Math.max(0,e.safeRight??0),n=Math.max(0,e.safeBottom??0),i=Math.max(0,e.safeLeft??0),l=Math.max(0,e.bottomClearance??72),c=i+Lh,h=Math.max(c,e.width-r-Lh-Ra),p=Math.max(t+12,52),g=Math.max(p,e.height-n-l-Ra);return{minX:c,maxX:h,minY:p,maxY:g}}function U5(e,t){const r=Gh(e),n=m1(t.yRatio,0,1);return{x:t.side==="left"?r.minX:r.maxX,y:r.minY+(r.maxY-r.minY)*n}}function uc(e,t){const r=Gh(e);return{x:m1(t.x,r.minX,r.maxX),y:m1(t.y,r.minY,r.maxY)}}function z5(e,t){const r=Gh(e),n=uc(e,t),i=(r.minX+r.maxX+Ra)/2,l=n.x+Ra/2<i?"left":"right",c=r.maxY-r.minY;return{position:{x:l==="left"?r.minX:r.maxX,y:n.y},preference:{side:l,yRatio:c>0?(n.y-r.minY)/c:0}}}function H5(e,t,r){const n=uc(e,t),i=Ra+CQ,l=g=>Math.abs(g.x-r.x)<i&&Math.abs(g.y-r.y)<i;if(!l(n))return n;const c=[{...n,y:r.y-i},{...n,y:r.y+i}].map(g=>uc(e,g)).filter(g=>!l(g)).sort((g,x)=>Math.abs(g.y-n.y)-Math.abs(x.y-n.y));if(c[0])return c[0];const h=Gh(e);return[{...n,x:h.minX},{...n,x:h.maxX}].map(g=>uc(e,g)).filter(g=>!l(g)).sort((g,x)=>Math.abs(g.x-n.x)-Math.abs(x.x-n.x))[0]??n}const pp="var(--warning)",SQ="var(--success)",W5="var(--tmux)",G5="termdock:mobile-attention-position:v1",V5="termdock:running-session-position:v1",_Q={side:"right",yRatio:.68},LQ={side:"right",yRatio:.54};function q5(e,t){if(typeof window>"u")return t;try{const r=JSON.parse(window.localStorage.getItem(e)??"null");if(r&&(r.side==="left"||r.side==="right")&&typeof r.yRatio=="number"&&Number.isFinite(r.yRatio))return{side:r.side,yRatio:Math.min(1,Math.max(0,r.yRatio))}}catch{}return t}function kQ(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function Id(e){if(typeof document>"u")return 0;const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e));return Number.isFinite(t)?Math.max(0,t):0}function IQ(e,t,r={}){if(typeof window>"u")return{width:390,height:664};const n=window.visualViewport,i=n?.width??window.innerWidth,l=n?.height??window.innerHeight,c=t?.getBoundingClientRect(),h=!!(c&&c.width>0&&c.height>0);return{width:i,height:l,safeTop:Math.max(Id("--safe-top-inset"),(h?Math.max(0,c.top):0)+Math.max(0,r.top??0)),safeRight:Math.max(Id("--safe-right-inset"),(h?Math.max(0,i-c.right):0)+Math.max(0,r.right??0)),safeBottom:Math.max(Id("--safe-bottom-inset"),(h?Math.max(0,l-c.bottom):0)+Math.max(0,r.bottom??0)),safeLeft:Math.max(Id("--safe-left-inset"),(h?Math.max(0,c.left):0)+Math.max(0,r.left??0)),bottomClearance:e?Lh:72}}function q6(){const e=Hr.getState(),t=Array.from(e.sessions.values()),r=TQ(t,e.activeSessionId);if(!r)return;const n=e.activeSessionId?e.sessions.get(e.activeSessionId):void 0;n?.agentNeedsReview&&e.clearAgentNeedsReview(n.sessionId),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:r}))}function Y5(e){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e}))}function Y6(e){switch(e){case"success":return"var(--success)";case"warning":return"var(--warning)";case"danger":return"var(--destructive)";case"info":case"accent":return"var(--accent)";default:return"var(--muted-foreground)"}}function EQ({indicator:e,tone:t,size:r}){const n=Y6(t);switch(e){case"spinner":return a.jsx(_n,{size:r,className:"shrink-0 animate-spin",style:{color:n}});case"question":return a.jsx(oh,{size:r,className:"shrink-0 animate-bounce-y",style:{color:n}});case"badge":return a.jsx(jl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:n}});case"terminal":return a.jsx(ko,{size:r,className:"shrink-0",style:{color:n}});case"pulse":return a.jsx(tw,{size:r,className:"shrink-0 animate-pulse",style:{color:n}});case"ring":return a.jsx("span",{className:"block shrink-0 rounded-full border-2",style:{width:r,height:r,borderColor:n}});case"dot":return a.jsx("span",{className:"block shrink-0 rounded-full",style:{width:Math.max(5,r-4),height:Math.max(5,r-4),backgroundColor:n}})}}function dc({agent:e,size:t=12}){const r=t-4,n=vQ(e);return n?e.iconMode==="native"?a.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t},title:e.displayName,children:a.jsx("img",{src:n,alt:e.displayName,style:{width:r,height:r}})}):a.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t,backgroundColor:e.accentColor},title:e.displayName,children:a.jsx("span",{className:"block bg-white",style:{width:r,height:r,WebkitMask:`url(${n}) center / contain no-repeat`,mask:`url(${n}) center / contain no-repeat`}})}):a.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t,backgroundColor:e.accentColor},title:e.displayName,children:a.jsx(ju,{size:r,className:"text-white"})})}function NQ({sessionMode:e,state:t,size:r=11}){const n=t?.agent?a.jsx(dc,{agent:t.agent,size:r+1}):e==="tmux"?a.jsx(Kc,{size:r,className:"shrink-0"}):a.jsx(ko,{size:r,className:"shrink-0"});return t?.agentStatusDetail&&t.agentIndicator&&!(t.agentStatus==="done"&&t.agentNeedsReview)?a.jsx("span",{title:t.agentMessage??t.agentStatusDetail.label,"aria-label":t.agentStatusDetail.label,children:a.jsx(EQ,{indicator:t.agentIndicator,tone:t.agentStatusDetail.tone,size:r})}):t?.agentStatus==="working"?a.jsx("span",{title:t.agentMessage??t.agent?.displayName,children:a.jsx(_n,{size:r,className:"shrink-0 animate-spin",style:{color:SQ}})}):t?.agentStatus==="waiting"?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(oh,{size:r,className:"shrink-0 animate-bounce-y",style:{color:pp}})}):t?.agentStatus==="done"&&t.agentNeedsReview?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(jl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:pp}})}):t?.agentNeedsReview?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(jl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:pp}})}):t?.inCopyMode?e==="tmux"?a.jsx(Kc,{size:r,className:"shrink-0 animate-pulse",style:{color:W5}}):a.jsx(ko,{size:r,className:"shrink-0 animate-pulse",style:{color:W5}}):n}function RQ({status:e,detail:t,needsReview:r,inCopyMode:n}){const{t:i}=Mr();return t&&!r?a.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full ring-2 ring-surface animate-pulse",style:{backgroundColor:Y6(t.tone)},title:t.label}):e==="working"?a.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--success)] ring-2 ring-surface shadow-[0_0_6px_rgb(var(--success-rgb)_/_0.50)] animate-pulse",title:i("agent.aiRunning")}):e==="waiting"||r?a.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--warning)] ring-2 ring-surface shadow-[0_0_0_1px_rgb(var(--warning-rgb)_/_0.24)] animate-pulse",title:i(r?"agent.finishedReview":"agent.aiWaiting")}):e==="done"&&r?a.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--warning)] ring-2 ring-surface shadow-[0_0_0_1px_rgb(var(--warning-rgb)_/_0.24)] animate-pulse",title:i("agent.finishedReview")}):n?a.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-[2px] bg-[var(--tmux)] ring-2 ring-surface",title:i("agent.copyMode")}):null}function Z6({count:e,tone:t,title:r}){const{t:n}=Mr();if(e<=0)return null;const i=t==="running"?"inline-flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.12)] px-1.5 py-0.5 text-[10px] font-medium text-[color:var(--success)]":"inline-flex min-h-6 items-center gap-1 rounded-full bg-[rgb(var(--warning-rgb)_/_0.14)] px-2 py-0.5 text-[10px] font-semibold text-[color:var(--warning)] ring-1 ring-[rgb(var(--warning-rgb)_/_0.24)] transition hover:bg-[rgb(var(--warning-rgb)_/_0.22)] active:scale-[0.97]",l=t==="running"?"h-1.5 w-1.5 rounded-full bg-[var(--success)] animate-pulse":"h-1.5 w-1.5 rounded-full bg-[var(--warning)] animate-pulse";if(t==="review"){const c=r??n("agent.jumpToNext");return a.jsxs("button",{type:"button",className:i,title:`${c} · ${n("agent.jumpToNext")}`,"aria-label":`${c}: ${e}. ${n("agent.jumpToNext")}`,onClick:q6,children:[a.jsx(jl,{size:11,className:"shrink-0"}),a.jsx("span",{children:n("agent.needsReview")}),a.jsx("span",{className:"tabular-nums",children:e})]})}return a.jsxs("span",{className:i,title:r,children:[a.jsx("span",{className:l}),e]})}function MQ({runningCount:e,reviewCount:t,className:r=""}){const n=[];return e>0&&n.push({key:"running",count:e,className:"bg-[var(--success)] text-[color:var(--success-foreground)]"}),t>0&&n.push({key:"review",count:t,className:"bg-[var(--warning)] text-[color:var(--warning-foreground)]"}),n.length===0?null:a.jsx("span",{"aria-hidden":"true",className:`pointer-events-none absolute -right-1 ${n.length>1?"top-0.5 flex flex-col gap-0.5":"-top-1"} ${r}`,children:n.map(i=>a.jsx("span",{className:`flex h-3 min-w-3 items-center justify-center rounded-full px-0.5 text-[7px] font-bold leading-3 shadow-sm ring-1 ring-background ${i.className}`,children:i.count>9?"9+":i.count},i.key))})}const DQ=380,Z5=10,Ed=10,mp=52,BQ=104;function QQ(e,t,r){const n=Math.max(0,t.safeLeft??0),i=t.width-Math.max(0,t.safeRight??0),l=Math.max(0,t.safeTop??0),c=t.height-Math.max(0,t.safeBottom??0),h=Lh,p=e.x+Ra/2>=n+(i-n)/2,g=p?e.x-Ed-n-h:i-h-e.x-Ra-Ed,x=Math.max(1,Math.min(Math.max(0,g),Math.max(168,r*BQ))),b=p?e.x-Ed-x:e.x+Ra+Ed,w=Math.min(Math.max(b,n+h),Math.max(n+h,i-h-x)),A=e.y+Ra/2-mp/2,k=Math.min(Math.max(A,l+h),Math.max(l+h,c-h-mp));return{left:w,top:k,width:x,height:mp,itemWidth:x/Math.max(1,r),side:p?"left":"right"}}function K5(e,t,r,n){return t<e.left||t>e.left+e.width||r<e.top-14||r>e.top+e.height+14?null:Math.min(n-1,Math.max(0,Math.floor((t-e.left)/e.itemWidth)))}function jQ(e,t){if(e.length===0)return null;const r=t?e.findIndex(n=>n.id===t):-1;return e[(r+1)%e.length]?.id??null}function PQ({reviewCount:e,runningSessions:t,activeSessionId:r,runningButtonEnabled:n,attentionButtonEnabled:i=!0,isDesktopLayout:l,containerElement:c,occlusionInsets:h}){const{t:p}=Mr(),g=Zt(Y=>Y.leftOpen),x=Zt(Y=>Y.rightOpen),{isOpen:b}=d3({enabled:!l}),w=l||!g&&!x&&!b,A=bQ(e),[k,E]=C.useState(!1);C.useEffect(()=>{(!A.active||!w)&&E(!1)},[A.active,w]);const I=i&&A.total>0&&w,M=t.length>1||t.length===1&&t[0]?.id!==r,Q=n&&t.length>0&&M&&w,j=Math.max(0,h?.top??0),F=Math.max(0,h?.right??0),V=Math.max(0,h?.bottom??0),$=Math.max(0,h?.left??0),te=C.useCallback(()=>IQ(l,c,{top:j,right:F,bottom:V,left:$}),[c,l,V,$,F,j]),se=C.useRef({attention:q5(G5,_Q),running:q5(V5,LQ)}),qe=C.useCallback(()=>{const Y=te(),be=U5(Y,se.current.attention),ut=U5(Y,se.current.running);return{attention:be,running:I&&Q?H5(Y,ut,be):ut}},[I,te,Q]),[de,oe]=C.useState(()=>qe()),Oe=C.useRef(de);Oe.current=de;const[et,ce]=C.useState(null),Be=C.useRef(null),[ot,Ie]=C.useState("idle"),[re,Ue]=C.useState(null),_e=C.useRef(null),K=C.useRef({attention:!1,running:!1});C.useEffect(()=>()=>{const Y=_e.current?.longPressTimer;Y!=null&&window.clearTimeout(Y)},[]),C.useEffect(()=>{if(Q)return;const Y=_e.current?.longPressTimer;Y!=null&&window.clearTimeout(Y),_e.current=null,Ie("idle"),Ue(null)},[Q]),C.useLayoutEffect(()=>{const Y=()=>{const ut=qe();Oe.current=ut,oe(ut)};Y(),window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y),window.visualViewport?.addEventListener("resize",Y);const be=typeof ResizeObserver>"u"?null:new ResizeObserver(Y);return c&&be?.observe(c),()=>{window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),window.visualViewport?.removeEventListener("resize",Y),be?.disconnect()}},[c,qe]);const Le=C.useCallback(Y=>Y==="attention"?Q:I,[I,Q]),fe=C.useCallback((Y,be)=>{if(!Le(Y))return be;const ut=Y==="attention"?"running":"attention";return H5(te(),be,Oe.current[ut])},[te,Le]),$e=C.useCallback((Y,be,ut,le)=>{const pe=te(),je=be.moved?uc(pe,{x:be.startX+(ut-be.originX),y:be.startY+(le-be.originY)}):Oe.current[Y],xt=z5(pe,je),dt=fe(Y,xt.position),Dt=z5(pe,dt);se.current[Y]=Dt.preference,kQ(Y==="attention"?G5:V5,Dt.preference);const Xt={...Oe.current,[Y]:Dt.position};Oe.current=Xt,oe(Xt)},[fe,te]),ze=C.useCallback(Y=>{K.current[Y]=!0,window.setTimeout(()=>{K.current[Y]=!1},0)},[]),Ee=C.useCallback(Y=>{const be=Be.current;!be||be.kind!=="attention"||be.pointerId!==Y.pointerId||(Be.current=null,ce(null),$e("attention",be,Y.clientX,Y.clientY),be.moved&&ze("attention"))},[$e,ze]),ee={onPointerDown:Y=>{Y.stopPropagation(),Y.currentTarget.setPointerCapture(Y.pointerId),Be.current={kind:"attention",pointerId:Y.pointerId,originX:Y.clientX,originY:Y.clientY,startX:de.attention.x,startY:de.attention.y,moved:!1}},onPointerMove:Y=>{const be=Be.current;if(!be||be.kind!=="attention"||be.pointerId!==Y.pointerId)return;const ut=Y.clientX-be.originX,le=Y.clientY-be.originY;if(!be.moved&&Math.hypot(ut,le)<5)return;be.moved=!0,ce("attention");const pe=te(),je=fe("attention",uc(pe,{x:be.startX+ut,y:be.startY+le})),xt={...Oe.current,attention:je};Oe.current=xt,oe(xt)},onPointerUp:Ee,onPointerCancel:Ee},Ke=c?QQ(de.running,te(),t.length):null,wt=Y=>{Y.longPressTimer!==null&&(window.clearTimeout(Y.longPressTimer),Y.longPressTimer=null)},tt={onPointerDown:Y=>{Y.stopPropagation(),Y.currentTarget.setPointerCapture(Y.pointerId);const be=Y.pointerId,ut={pointerId:be,originX:Y.clientX,originY:Y.clientY,startX:de.running.x,startY:de.running.y,mode:"pressing",moved:!1,selectedIndex:null,longPressTimer:null};ut.longPressTimer=window.setTimeout(()=>{const le=_e.current;!le||le.pointerId!==be||le.mode!=="pressing"||(le.longPressTimer=null,le.mode="dragging",K.current.running=!0,Ie("dragging"))},DQ),_e.current=ut,Ie("pressing"),Ue(null)},onPointerMove:Y=>{const be=_e.current;if(!be||be.pointerId!==Y.pointerId)return;const ut=Y.clientX-be.originX,le=Y.clientY-be.originY;if(be.mode==="pressing")if(Math.abs(ut)>=Z5&&Math.abs(ut)>=Math.abs(le))wt(be),be.mode="selecting",K.current.running=!0,Ie("selecting");else if(Math.hypot(ut,le)>=Z5){wt(be),be.mode="cancelled",K.current.running=!0,Ie("idle");return}else return;if(be.mode==="selecting"){const dt=Ke?K5(Ke,Y.clientX,Y.clientY,t.length):null;be.selectedIndex=dt,Ue(dt);return}if(be.mode!=="dragging"||!be.moved&&Math.hypot(ut,le)<5)return;be.moved=!0;const pe=te(),je=fe("running",uc(pe,{x:be.startX+ut,y:be.startY+le})),xt={...Oe.current,running:je};Oe.current=xt,oe(xt)},onPointerUp:Y=>{const be=_e.current;if(!be||be.pointerId!==Y.pointerId)return;wt(be);const ut=be.mode;if(ut==="selecting"){const le=Ke?K5(Ke,Y.clientX,Y.clientY,t.length):be.selectedIndex,pe=le===null?null:t[le]?.id;pe&&Y5(pe)}else ut==="dragging"&&$e("running",be,Y.clientX,Y.clientY);_e.current=null,Ie("idle"),Ue(null),ut!=="pressing"&&ze("running")},onPointerCancel:Y=>{const be=_e.current;!be||be.pointerId!==Y.pointerId||(wt(be),_e.current=null,Ie("idle"),Ue(null),ze("running"))}},ge=(Y,be)=>a.jsx("span",{className:`pointer-events-none absolute -right-1 -top-1 z-10 flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-surface px-1 text-[9px] font-bold tabular-nums ring-2 ring-[var(--chrome-bg)] ${be==="attention"?"text-[color:var(--warning)]":"text-[color:var(--success)]"}`,children:Y>9?"9+":Y}),it=()=>{const Y=A.hasOtherAttention?p("serviceAttention.title"):p("agent.jumpToNext"),be=de.attention,ut=et==="attention";return a.jsxs("button",{type:"button","data-attention-button":!0,"data-mobile-attention-button":!0,...ee,onClick:le=>{le.stopPropagation(),!K.current.attention&&(A.hasOtherAttention?E(!0):q6())},className:`fixed z-chrome-hint inline-flex items-center justify-center rounded-full bg-[var(--warning)] text-[color:var(--warning-foreground)] shadow-[0_8px_24px_var(--app-shadow-strong)] ring-1 ring-[rgb(var(--warning-rgb)_/_0.35)] animate-fade-in ${ut?"cursor-grabbing scale-[1.04] shadow-[0_12px_30px_var(--app-shadow-strong)]":"cursor-grab transition-[left,top,transform,box-shadow] duration-200 active:scale-95"}`,style:{display:k?"none":void 0,left:be.x,top:be.y,width:Ra,height:Ra,touchAction:"none"},"aria-label":`${Y}: ${A.total}`,"aria-haspopup":A.hasOtherAttention?"dialog":void 0,title:Y,children:[a.jsx(jl,{size:17,className:"shrink-0"}),ge(A.total,"attention")]},"attention")},ht=()=>{const Y=t.length,be=de.running,ut=ot==="selecting",le=ot==="dragging";return a.jsxs(C.Fragment,{children:[a.jsxs("button",{type:"button","data-running-session-button":!0,"data-running-session-gesture":ot,...tt,onClick:pe=>{if(pe.stopPropagation(),K.current.running)return;const je=jQ(t,r);je&&Y5(je)},className:`fixed z-chrome-hint inline-flex select-none items-center justify-center rounded-full bg-[var(--success)] text-[color:var(--success-foreground)] shadow-[0_8px_24px_var(--app-shadow-strong)] ring-1 ring-[rgb(var(--success-rgb)_/_0.35)] animate-fade-in ${le?"cursor-grabbing scale-[1.04] shadow-[0_12px_30px_var(--app-shadow-strong)]":ut?"cursor-ew-resize scale-[1.04] ring-2 ring-[rgb(var(--success-rgb)_/_0.55)]":"cursor-grab transition-[left,top,transform,box-shadow] duration-200 active:scale-95"}`,style:{left:be.x,top:be.y,width:Ra,height:Ra,touchAction:"none"},"aria-label":`${p("agent.jumpToNextRunning")}: ${Y}`,title:p("agent.runningSessionGestureHint"),children:[a.jsx(_n,{size:18,className:"shrink-0 animate-spin"}),ge(Y,"running")]}),ut&&Ke&&a.jsx("div",{role:"listbox","data-running-session-rail":!0,"data-side":Ke.side,"aria-label":p("agent.selectRunningSession"),className:"pointer-events-none fixed z-popover flex overflow-hidden rounded-full border border-border/15 bg-surface/95 p-1 shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in",style:{left:Ke.left,top:Ke.top,width:Ke.width,height:Ke.height},children:t.map((pe,je)=>{const xt=je===re,dt=pe.id===r,Dt=`${pe.label}${pe.detail?` · ${pe.detail}`:""}${dt?` · ${p("agent.currentSession")}`:""}`;return a.jsxs("div",{role:"option","aria-selected":xt,"data-running-session-option":pe.id,"data-selected":xt?"true":"false",title:Dt,className:`relative flex min-w-0 flex-1 items-center justify-center gap-1.5 rounded-full px-2 transition-[background-color,color,transform] duration-100 ${xt?"scale-[1.02] bg-[var(--success)] text-[color:var(--success-foreground)]":dt?"bg-primary/15 text-primary ring-1 ring-primary/30":"text-foreground"}`,children:[a.jsx("span",{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-[9px] font-bold tabular-nums ${xt?"bg-surface/25":"bg-surface-2 text-muted-foreground"}`,children:je+1}),a.jsx("span",{className:"truncate text-[10px] font-medium",children:pe.label})]},pe.id)})})]},"running")};return!I&&!Q&&!k||c===null||typeof document>"u"?null:a.jsxs(V7,{children:[I&&it(),Q&&!k&&ht(),k&&A.active&&w&&a.jsx(yQ,{groups:A.groups,currentKey:A.currentKey,onClose:()=>E(!1)})]})}function OQ(){const{t:e}=Mr();return a.jsxs("div",{role:"status",className:"td-loading-skeleton overflow-hidden px-3 py-2",children:[a.jsx("span",{className:"sr-only",children:e("common.loading")}),a.jsx("div",{"aria-hidden":"true",children:["w-2/5","w-3/5","w-1/3","w-1/2","w-2/5","w-1/3"].map((t,r)=>a.jsxs("div",{className:"flex h-8 items-center gap-2",style:{paddingLeft:r>1&&r<5?20:0},children:[a.jsx("div",{className:"h-3 w-3 shrink-0 rounded-sm bg-surface-2"}),a.jsx("div",{className:`h-2 rounded bg-surface-2 ${t}`})]},r))})]})}const FQ=new Set([".ts",".tsx",".js",".jsx",".py",".rs",".go",".java",".c",".cpp",".h",".rb",".php",".swift",".kt",".sh",".css",".scss",".html",".json",".yaml",".yml",".toml",".md"]),X5=120,J5=120,$Q=new Set,UQ=[],zQ={added:{label:"A",className:"text-[color:var(--diff-insert-strong)]",title:"Added"},modified:{label:"M",className:"text-[color:var(--diff-hunk-accent)]",title:"Modified"},deleted:{label:"D",className:"text-[color:var(--diff-delete-strong)]",title:"Deleted"},renamed:{label:"R",className:"text-muted-foreground",title:"Renamed"},copied:{label:"C",className:"text-[color:var(--diff-insert-strong)]",title:"Copied"},untracked:{label:"U",className:"text-[color:var(--diff-insert-strong)]",title:"Untracked (new file)"},conflicted:{label:"!",className:"text-destructive",title:"Conflicted"},unknown:{label:"?",className:"text-muted-foreground",title:"Unknown"}};function cm(e,t){if(t==="directory")return null;if(Z7(e))return a.jsx(W9,{size:14});if(K7(e))return a.jsx(hb,{size:14});const r=e.lastIndexOf(".")>=0?e.slice(e.lastIndexOf(".")):"";return FQ.has(r)?a.jsx(yw,{size:14}):a.jsx(sb,{size:14})}function K6({path:e}){const r=Zt(i=>i.changedFiles.get(e))?.status;if(!r)return null;const n=zQ[r]??{label:"?",className:"text-muted-foreground",title:r};return a.jsx("span",{className:`w-4 shrink-0 text-center text-[10px] font-mono font-bold ${n.className}`,title:n.title,children:n.label})}function n0(e){return e?"ml-1 w-6 opacity-100":"ml-1 w-6 opacity-100 sm:ml-0 sm:w-0 sm:overflow-hidden sm:opacity-0 sm:group-hover:ml-1 sm:group-hover:w-6 sm:group-hover:opacity-100"}function um(e){return n0(e)}const HQ=y.memo(function({path:t}){const{t:r}=Mr(),[n,i]=y.useState("idle"),[l,c]=y.useState(null),h=y.useCallback(async p=>{if(p.stopPropagation(),n!=="pending"){i("pending"),c(null);try{await qx(t),i("idle")}catch(g){i("error"),c(g instanceof Error?g.message:r("rightSidebar.downloadFailed"))}}},[t,n,r]);return a.jsx("span",{role:"button",tabIndex:-1,onClick:p=>{h(p)},className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${n0(n==="pending")} ${n==="pending"?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:n==="error"?l??r("rightSidebar.downloadFailed"):r("rightSidebar.downloadFile"),children:n==="pending"?a.jsx(_n,{size:12,className:"animate-spin"}):a.jsx(yu,{size:12})})});function X6(){const{t:e}=Mr(),[t,r]=y.useState({status:"idle"}),n=y.useCallback(async i=>{r({status:"pending"});try{await qx(i),r({status:"idle"})}catch(l){r({status:"error",message:l instanceof Error?l.message:e("rightSidebar.downloadFailed")})}},[e]);return{state:t,run:n}}function g1(e){return e instanceof DOMException&&e.name==="AbortError"}function kh(){if(typeof window>"u")return!1;const e=window.getSelection();return!!(e&&!e.isCollapsed&&e.toString().trim())}function J6(e){return e.button===2||e.ctrlKey}const WQ=176,GQ=160,V0=8;function ex(e,t,r,n){const i=window.visualViewport,l=i?.offsetLeft??0,c=i?.offsetTop??0,h=l+(i?.width??window.innerWidth),p=c+(i?.height??window.innerHeight),g=l+V0,x=c+V0,b=Math.max(g,h-r-V0),w=Math.max(x,p-n-V0),A=t+n<=p-V0?t:t-n;return{anchorX:e,anchorY:t,left:Math.min(Math.max(e,g),b),top:Math.min(Math.max(A,x),w)}}function ey(e){const[t,r]=y.useState(null),n=y.useRef(null),i=y.useCallback((l,c)=>{r(ex(l,c,WQ,GQ))},[]);return y.useLayoutEffect(()=>{if(!e||!t||!n.current)return;const l=n.current.getBoundingClientRect();if(l.width<=0||l.height<=0)return;const c=ex(t.anchorX,t.anchorY,l.width,l.height);c.left===t.left&&c.top===t.top||r(c)},[e,t]),{position:t,menuRef:n,openAt:i,clearPosition:()=>r(null)}}function ty(e,t){return t&&typeof document<"u"?Ai.createPortal(e,document.body):e}function VQ(e,t){return t?`${e.name} ${e.path}`.toLowerCase().includes(t):!0}function dm(e,t,r){if(!t||VQ(e,t))return!0;const n=r.get(e.path);return n?n.some(i=>dm(i,t,r)):!1}function x1(e){return e.map(t=>({name:t.name,path:t.path,type:t.type,isSymlink:t.isSymlink,modified:t.modified,expanded:!1,loaded:!1,children:t.type==="directory"?[]:void 0}))}function b1(e,t){return!e||!t.startsWith(e)?t:t.slice(e.length).replace(/^\/+/,"")||t}const qQ=y.memo(function e({node:t,depth:r,onFileSelect:n,directoriesOnly:i=!1,onPathReference:l,getReferenceText:c,onReferenceCopied:h,insertedReferenceKey:p,copiedReferenceKey:g,onDirectoryRoot:x,onSearchFromDirectory:b,onDirectoryPinToggle:w,onFilePinToggle:A,onOpenInFileBrowser:k,canOpenInFileBrowser:E,pinnedPaths:I,selectedFilePath:M,queryLower:Q,onDirectoryDropFiles:j,onFileDeleteRequest:F,deletingFilePath:V,revealedDirectoryPath:$,gitIgnoreRoot:te}){const{t:se}=Mr(),qe=Zt(Ve=>Ve.expandedPaths.has(t.path)),de=Zt(Ve=>Ve.directoryCache.get(t.path)),oe=Zt(Ve=>Ve.showHiddenFiles),Oe=Zt(Ve=>Ve.toggleExpanded),et=Zt(Ve=>Ve.setDirectoryCache),ce=Zt(Ve=>Ve.fileSortModes[t.path]??"name"),Be=Zt(Ve=>Ve.setDirectorySortMode),[ot,Ie]=y.useState(!1),[re,Ue]=y.useState(!1),{position:_e,menuRef:K,openAt:Le,clearPosition:fe}=ey(re),[$e,ze]=y.useState(!1),Ee=y.useRef(0),ee=y.useRef(null),Ke=y.useRef(null),wt=t.path===M||t.path===$,tt=t.type==="directory"&&(qe||!!Q),ge=t.type==="directory",it=I.has(t.path),ht=!ge&&!!A,Y=!!(E&&k),be=`path:${t.path}`,ut=p===be,le=g===be,pe=c?.(t.path)??t.path,je=S1(h),{state:xt,run:dt}=X6(),Dt=V===t.path,Xt=ge&&!i&&!!(x||b||w||Y),Ht=y.useMemo(()=>{if(!de)return;if(!Q)return de;const Ve=Zt.getState().directoryCache;return de.filter(Ct=>(!i||Ct.type==="directory")&&dm(Ct,Q,Ve))},[de,i,Q]),Bt=y.useCallback(async()=>{if(!Zt.getState().directoryCache.has(t.path)&&!ot){const Ct=`file-tree:${t.path}`;ee.current?.abort(),Rp(Ct);const jr=new AbortController;ee.current=jr,Ie(!0);try{const ft=await C1(t.path,jr.signal,oe,"expand_directory",Ct,ce,te);if(jr.signal.aborted)return;const Br=x1(ft.entries);et(t.path,Br)}catch(ft){g1(ft)}finally{ee.current===jr&&(ee.current=null),Ie(!1)}}},[t.path,ot,et,oe,ce,te]),Wt=y.useCallback(async()=>{if(t.type!=="directory"){n(t.path);return}if(i&&x){x(t.path);return}const Ve=!Zt.getState().expandedPaths.has(t.path);Oe(t.path),Ve&&await Bt()},[i,t.path,t.type,Bt,x,Oe,n]);y.useEffect(()=>{t.type==="directory"&&qe&&!de&&!ot&&Bt()},[de,qe,Bt,ot,t.type]);const lr=y.useCallback(Ve=>{Ve.stopPropagation(),l?.(t.path,be)},[l,t.path,be]),ur=y.useCallback(Ve=>{Ve.stopPropagation(),x?.(t.path),Ue(!1)},[t.path,x]),Jt=y.useCallback(Ve=>{Ve.stopPropagation(),b?.(t.path),Ue(!1)},[t.path,b]),Er=y.useCallback(Ve=>{Ve.stopPropagation(),w?.(t.path),Ue(!1)},[t.path,w]),X=y.useCallback(Ve=>{Ve.stopPropagation(),Be(t.path,ce==="modified"?"name":"modified"),Ue(!1)},[t.path,Be,ce]),Re=y.useCallback(Ve=>{Ve.stopPropagation(),A?.(t.path),Ue(!1)},[t.path,A]),We=y.useCallback(Ve=>{Ve.stopPropagation(),Ue(!1),dt(t.path)},[t.path,dt]),Qt=y.useCallback(Ve=>{Ve.stopPropagation(),Ue(!1),F(t)},[t,F]),It=y.useCallback(Ve=>{Ve.stopPropagation(),k?.(t.path),Ue(!1)},[t.path,k]),ar=y.useCallback(Ve=>{!ge||!j||!Ve.dataTransfer.types.includes("Files")||(Ve.preventDefault(),Ve.stopPropagation(),Ee.current+=1,ze(!0))},[ge,j]),Ot=y.useCallback(Ve=>{!ge||!j||!Ve.dataTransfer.types.includes("Files")||(Ve.preventDefault(),Ve.stopPropagation(),Ve.dataTransfer.dropEffect="copy",ze(!0))},[ge,j]),Fe=y.useCallback(Ve=>{!ge||!j||(Ve.preventDefault(),Ve.stopPropagation(),Ee.current-=1,Ee.current<=0&&(Ee.current=0,ze(!1)))},[ge,j]),yr=y.useCallback(Ve=>{if(!ge||!j)return;Ve.preventDefault(),Ve.stopPropagation(),Ee.current=0,ze(!1);const Ct=Array.from(Ve.dataTransfer.files);Ct.length>0&&j(t.path,Ct)},[ge,t.path,j]),He=y.useCallback(Ve=>{Ve.stopPropagation(),fe(),Ue(Ct=>!Ct)},[fe]),Se=y.useCallback(Ve=>{!Xt||!J6(Ve)||(Ve.preventDefault(),Ve.stopPropagation(),Le(Ve.clientX,Ve.clientY),Ue(!0))},[Xt,Le]);return y.useEffect(()=>{if(!re)return;const Ve=jr=>{const ft=jr.target;ft instanceof Node&&(Ke.current?.contains(ft)||K.current?.contains(ft))||Ue(!1)},Ct=jr=>{jr.key==="Escape"&&Ue(!1)};return document.addEventListener("pointerdown",Ve),document.addEventListener("keydown",Ct),()=>{document.removeEventListener("pointerdown",Ve),document.removeEventListener("keydown",Ct)}},[re,K]),y.useEffect(()=>()=>{ee.current?.abort()},[]),a.jsxs("div",{style:!tt&&!re?{contentVisibility:"auto",containIntrinsicSize:"auto 32px"}:void 0,children:[a.jsxs("div",{ref:Ke,className:"relative",children:[je.popoverNode,a.jsxs("div",{"data-file-tree-path":t.path,"data-sort-mode":ce,role:"button",tabIndex:0,onClick:()=>{kh()||Wt()},onContextMenu:Se,onKeyDown:Ve=>{Ve.key!=="Enter"&&Ve.key!==" "||(Ve.preventDefault(),Wt())},onDragEnter:ar,onDragOver:Ot,onDragLeave:Fe,onDrop:yr,className:`group relative flex w-full cursor-pointer items-center gap-1 rounded px-2 py-1 text-[13px] transition ${$e?"scale-[1.015] bg-primary/15 text-foreground shadow-[0_0_0_1px_rgb(var(--primary-rgb)_/_0.45)]":wt?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[r>0&&a.jsx("span",{"aria-hidden":"true",className:"shrink-0",style:{width:`${r*14-4}px`}}),$e&&a.jsx("span",{className:"pointer-events-none absolute right-2 top-1/2 z-10 -translate-y-1/2 rounded-full bg-primary px-2 py-0.5 text-[10px] font-semibold text-primary-foreground shadow-md",children:se("fileTree.dropToUploadHere")}),t.type==="directory"?a.jsxs(a.Fragment,{children:[tt?a.jsx(Yo,{size:14,className:"shrink-0 text-muted-foreground/80"}):a.jsx(Yc,{size:14,className:"shrink-0 text-muted-foreground/80"}),tt?a.jsx(Hc,{size:14,className:"shrink-0 text-[color:var(--folder)]"}):a.jsx(hc,{size:14,className:"shrink-0 text-[color:var(--folder)]"})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-[14px] shrink-0"}),a.jsx("span",{className:wt?"text-primary":"text-muted-foreground/80",children:cm(t.name,t.type)})]}),a.jsxs("span",{className:`flex-1 select-text whitespace-nowrap text-left leading-snug ${wt?"font-medium":""}`,children:[t.name,ce==="modified"&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-primary",title:se("fileTree.sortedByModified"),"aria-label":se("fileTree.sortedByModified"),children:a.jsx(bu,{size:11})}),t.isSymlink&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:se("fileTree.symbolicLink"),children:a.jsx(Zc,{size:11})})]}),a.jsxs("div",{className:`sticky right-0 z-20 flex shrink-0 items-center rounded pl-1 ${wt?"bg-surface-elevated":"bg-surface group-hover:bg-surface-2"}`,onClick:Ve=>Ve.stopPropagation(),onKeyDown:Ve=>Ve.stopPropagation(),children:[ot&&a.jsx(_n,{size:12,className:"shrink-0 animate-spin text-muted-foreground"}),a.jsx(K6,{path:t.path}),Xt&&a.jsx("span",{onClick:He,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${n0(re)} ${re?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:se("fileTree.moreDirActions"),children:a.jsx(Pl,{size:13})}),!ge&&a.jsx("span",{onClick:He,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${n0(re||xt.status==="pending"||Dt||it)} ${re?"bg-surface-elevated text-foreground":it?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:xt.status==="error"?xt.message??se("rightSidebar.downloadFailed"):se("fileTree.moreFileActions"),children:xt.status==="pending"||Dt?a.jsx(_n,{size:13,className:"animate-spin"}):a.jsx(Pl,{size:13})}),l&&a.jsx("span",{onClick:lr,...je(pe,be),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${um(ut||le)} ${ut||le?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":se(le?"rightSidebar.copied":ut?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:se(le?"rightSidebar.copied":ut?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:le||ut?a.jsx(ua,{size:12}):a.jsx(Zc,{size:12})}),Xt&&re&&ty(a.jsxs("div",{ref:K,className:`${_e?"fixed z-menu-panel":"absolute right-2 top-[calc(100%+2px)] z-30"} w-44 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in`,style:_e?{left:_e.left,top:_e.top}:void 0,children:[Y&&a.jsxs("button",{type:"button",onClick:It,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:se("fileTree.openInFileBrowserTitle"),children:[a.jsx(Hc,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:se("fileTree.openInFileBrowser")})]}),x&&a.jsxs("button",{type:"button",onClick:ur,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:se("fileTree.openDirRootTitle"),children:[a.jsx(Hc,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:se("fileTree.openDirRoot")})]}),b&&a.jsxs("button",{type:"button",onClick:Jt,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:se("fileTree.searchFromDirTitle"),children:[a.jsx(_1,{size:13,className:"shrink-0 text-primary"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:se("fileTree.searchFromDir")})]}),w&&a.jsxs("button",{type:"button",onClick:Er,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium transition active:scale-[0.99] ${it?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:se(it?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[it?a.jsx(wu,{size:13,className:"shrink-0"}):a.jsx(vu,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:se(it?"fileTree.unpinDir":"fileTree.pinDir")})]}),a.jsxs("button",{type:"button",onClick:X,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",children:[ce==="modified"?a.jsx(P9,{size:13,className:"shrink-0"}):a.jsx(bu,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:se(ce==="modified"?"fileTree.sortByName":"fileTree.sortByModified")})]})]}),!!_e),!ge&&re&&a.jsxs("div",{className:"absolute right-2 top-[calc(100%+2px)] z-30 w-44 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in",children:[Y&&a.jsxs("button",{type:"button",onClick:It,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:se("fileTree.openInFileBrowserTitle"),children:[a.jsx(sb,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:se("fileTree.openInFileBrowser")})]}),a.jsxs("button",{type:"button",onClick:We,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:se("rightSidebar.downloadFile"),children:[a.jsx(yu,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:se("rightSidebar.downloadFile")})]}),ht&&a.jsxs("button",{type:"button",onClick:Re,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium transition active:scale-[0.99] ${it?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:se(it?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[it?a.jsx(wu,{size:13,className:"shrink-0"}):a.jsx(vu,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:se(it?"fileTree.unpinFile":"fileTree.pinFile")})]}),a.jsxs("button",{type:"button",onClick:Qt,disabled:Dt,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-destructive transition hover:bg-destructive/10 active:scale-[0.99] disabled:opacity-50",title:se("fileTree.deleteFile"),children:[Dt?a.jsx(_n,{size:13,className:"shrink-0 animate-spin"}):a.jsx(ri,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:se("fileTree.deleteFile")})]})]})]})]})]}),tt&&Ht&&Ht.length>0&&a.jsx("div",{className:r===0?"mt-0.5":"",children:Ht.map(Ve=>a.jsx(e,{node:Ve,depth:r+1,onFileSelect:n,directoriesOnly:i,onPathReference:l,getReferenceText:c,onReferenceCopied:h,onDirectoryRoot:x,onSearchFromDirectory:b,onDirectoryPinToggle:w,onFilePinToggle:A,onOpenInFileBrowser:k,canOpenInFileBrowser:E,pinnedPaths:I,selectedFilePath:M,queryLower:Q,insertedReferenceKey:p,copiedReferenceKey:g,onDirectoryDropFiles:j,onFileDeleteRequest:F,deletingFilePath:V,gitIgnoreRoot:te,revealedDirectoryPath:$},Ve.path))})]})}),YQ=y.memo(function({node:t,rootPath:r,onFileSelect:n,onPathReference:i,getReferenceText:l,onReferenceCopied:c,insertedReferenceKey:h,copiedReferenceKey:p,onDirectoryRoot:g,onSearchFromDirectory:x,onDirectoryPinToggle:b,onFilePinToggle:w,pinnedPaths:A,selectedFilePath:k,onFileDeleteRequest:E,deletingFilePath:I}){const{t:M}=Mr(),Q=t.path===k,j=t.type==="directory",F=A.has(t.path),V=!j&&!!w,$=`path:${t.path}`,te=h===$,se=p===$,qe=l?.(t.path)??t.path,de=S1(c),{state:oe,run:Oe}=X6(),[et,ce]=y.useState(!1),{position:Be,menuRef:ot,openAt:Ie,clearPosition:re}=ey(et),Ue=y.useRef(null),_e=I===t.path,K=j&&!!(g||x||b),Le=y.useCallback(()=>{kh()||(t.type==="directory"?g?.(t.path):n(t.path))},[t.path,t.type,g,n]),fe=y.useCallback(tt=>{tt.stopPropagation(),i?.(t.path,$)},[i,t.path,$]),$e=y.useCallback(tt=>{tt.stopPropagation(),b?.(t.path),ce(!1)},[t.path,b]),ze=y.useCallback(tt=>{tt.stopPropagation(),w?.(t.path),ce(!1)},[t.path,w]),Ee=y.useCallback(tt=>{tt.stopPropagation(),ce(!1),Oe(t.path)},[t.path,Oe]),ee=y.useCallback(tt=>{tt.stopPropagation(),ce(!1),E(t)},[t,E]),Ke=y.useCallback(tt=>{tt.stopPropagation(),re(),ce(ge=>!ge)},[re]),wt=y.useCallback(tt=>{!K||!J6(tt)||(tt.preventDefault(),tt.stopPropagation(),Ie(tt.clientX,tt.clientY),ce(!0))},[K,Ie]);return y.useEffect(()=>{if(!et)return;const tt=it=>{const ht=it.target;ht instanceof Node&&(Ue.current?.contains(ht)||ot.current?.contains(ht))||ce(!1)},ge=it=>{it.key==="Escape"&&ce(!1)};return document.addEventListener("pointerdown",tt),document.addEventListener("keydown",ge),()=>{document.removeEventListener("pointerdown",tt),document.removeEventListener("keydown",ge)}},[et,ot]),a.jsxs("div",{ref:Ue,className:"relative border-b border-border/10 last:border-b-0",children:[de.popoverNode,a.jsxs("div",{role:"button",tabIndex:0,onClick:Le,onContextMenu:wt,onKeyDown:tt=>{tt.key!=="Enter"&&tt.key!==" "||(tt.preventDefault(),Le())},className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-left text-[13px] transition ${Q?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[t.type==="directory"?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-[14px] shrink-0"}),a.jsx(hc,{size:14,className:"shrink-0 text-[color:var(--folder)]"})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-[14px] shrink-0"}),a.jsx("span",{className:Q?"text-primary":"text-muted-foreground/80",children:cm(t.name,t.type)})]}),a.jsxs("span",{className:"min-w-0 flex-1 select-text",children:[a.jsxs("span",{className:`block whitespace-normal break-all font-medium leading-snug ${Q?"text-primary":"text-foreground"}`,children:[t.name,t.isSymlink&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:M("fileTree.symbolicLink"),children:a.jsx(Zc,{size:11})})]}),a.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-muted-foreground/80",children:b1(r,t.path)})]}),a.jsx(K6,{path:t.path}),t.type==="directory"&&(b||x)&&a.jsx("span",{onClick:Ke,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${n0(et)} ${et?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:M("fileTree.moreDirActions"),children:a.jsx(Pl,{size:13})}),!j&&a.jsx("span",{onClick:Ke,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${n0(et||oe.status==="pending"||_e||F)} ${et?"bg-surface-elevated text-foreground":F?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:oe.status==="error"?oe.message??M("rightSidebar.downloadFailed"):M("fileTree.moreFileActions"),children:oe.status==="pending"||_e?a.jsx(_n,{size:13,className:"animate-spin"}):a.jsx(Pl,{size:13})}),i&&a.jsx("span",{onClick:fe,...de(qe,$),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${um(te||se)} ${te||se?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":M(se?"rightSidebar.copied":te?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:M(se?"rightSidebar.copied":te?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:se||te?a.jsx(ua,{size:12}):a.jsx(Zc,{size:12})})]}),K&&et&&ty(a.jsxs("div",{ref:ot,className:`${Be?"fixed z-menu-panel":"absolute right-2 top-[calc(100%+2px)] z-30"} w-44 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in`,style:Be?{left:Be.left,top:Be.top}:void 0,children:[g&&a.jsxs("button",{type:"button",onClick:tt=>{tt.stopPropagation(),g(t.path),ce(!1)},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:M("fileTree.openDirRootTitle"),children:[a.jsx(Hc,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("fileTree.openDirRoot")})]}),x&&a.jsxs("button",{type:"button",onClick:tt=>{tt.stopPropagation(),x(t.path),ce(!1)},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",children:[a.jsx(_1,{size:13,className:"shrink-0 text-primary"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("fileTree.searchFromDir")})]}),b&&a.jsxs("button",{type:"button",onClick:$e,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium transition active:scale-[0.99] ${F?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:M(F?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[F?a.jsx(wu,{size:13,className:"shrink-0"}):a.jsx(vu,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M(F?"fileTree.unpinDir":"fileTree.pinDir")})]})]}),!!Be),!j&&et&&a.jsxs("div",{className:"absolute right-2 top-[calc(100%+2px)] z-30 w-44 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in",children:[a.jsxs("button",{type:"button",onClick:Ee,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:M("rightSidebar.downloadFile"),children:[a.jsx(yu,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("rightSidebar.downloadFile")})]}),V&&a.jsxs("button",{type:"button",onClick:ze,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium transition active:scale-[0.99] ${F?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:M(F?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[F?a.jsx(wu,{size:13,className:"shrink-0"}):a.jsx(vu,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M(F?"fileTree.unpinFile":"fileTree.pinFile")})]}),a.jsxs("button",{type:"button",onClick:ee,disabled:_e,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-destructive transition hover:bg-destructive/10 active:scale-[0.99] disabled:opacity-50",title:M("fileTree.deleteFile"),children:[_e?a.jsx(_n,{size:13,className:"shrink-0 animate-spin"}):a.jsx(ri,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("fileTree.deleteFile")})]})]})]})}),ZQ=60,tx=60,KQ=20;function rx({count:e,loading:t,engine:r,limited:n,scope:i,content:l}){const{t:c}=Mr();return a.jsxs("div",{className:"sticky top-0 z-10 -mx-2 -mt-2 mb-2 border-b border-border/15 bg-surface/95 px-3 py-2.5 backdrop-blur",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2 text-[12px] font-semibold text-foreground",children:[a.jsx(_1,{size:14,className:"shrink-0 text-primary"}),a.jsx("span",{children:l?c("fileTree.contentMatchesCount",{count:e}):c("fileTree.searchResults",{count:e})})]}),r&&a.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[9px] uppercase tracking-[0.12em] text-muted-foreground",children:[t&&a.jsx(_n,{size:9,className:"animate-spin"}),r,n?" · limited":""]})]}),a.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-[10px] text-muted-foreground",children:[a.jsx("span",{className:"shrink-0",children:c("fileTree.searchScope")}),a.jsx("span",{className:"min-w-0 truncate font-mono text-foreground/75",title:i,children:i}),t&&a.jsx("span",{className:"ml-auto shrink-0",children:c("fileTree.searching")})]})]})}function XQ(e,t){if(!t)return e;const r=e.toLowerCase(),n=t.toLowerCase(),i=[];let l=0,c=r.indexOf(n,l),h=0;for(;c>=0&&n;)c>l&&i.push(e.slice(l,c)),i.push(a.jsx("mark",{className:"rounded-sm bg-[rgb(var(--warning-rgb)_/_0.30)] px-0.5 text-foreground",children:e.slice(c,c+n.length)},`m-${h++}`)),l=c+n.length,c=r.indexOf(n,l);return l<e.length&&i.push(e.slice(l)),i.length>0?i:e}const JQ=y.memo(function({entry:t,rootPath:r,selectedFilePath:n,query:i,onContentMatchSelect:l,onPathReference:c,getReferenceText:h,onReferenceCopied:p,insertedReferenceKey:g,copiedReferenceKey:x}){const{t:b}=Mr(),[w,A]=y.useState(!0),k=t.path===n,E=w?t.matches.slice(0,KQ):[],I=t.matches.length-E.length,M=`path:${t.path}`,Q=g===M,j=x===M,F=h?.(t.path)??t.path,V=S1(p);return a.jsxs("div",{className:"border-b border-border/10 last:border-b-0",children:[V.popoverNode,a.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{kh()||A($=>!$)},onKeyDown:$=>{$.key!=="Enter"&&$.key!==" "||($.preventDefault(),A(te=>!te))},className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-left text-[13px] transition ${k?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[w?a.jsx(Yo,{size:14,className:"shrink-0 text-muted-foreground/80"}):a.jsx(Yc,{size:14,className:"shrink-0 text-muted-foreground/80"}),a.jsx("span",{className:k?"text-primary":"text-muted-foreground/80",children:cm(t.name,"file")}),a.jsxs("span",{className:"min-w-0 flex-1 select-text",children:[a.jsx("span",{className:"block whitespace-normal break-all font-medium leading-snug",children:t.name}),a.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-muted-foreground/80",children:b1(r,t.path)})]}),a.jsx("span",{className:"shrink-0 select-none rounded-full bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:t.matches.length}),a.jsx(HQ,{path:t.path}),c&&a.jsx("span",{onClick:$=>{$.stopPropagation(),c(t.path,M)},...V(F,M),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${um(Q||j)} ${Q||j?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":b(j?"rightSidebar.copied":Q?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:b(j?"rightSidebar.copied":Q?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:j||Q?a.jsx(ua,{size:12}):a.jsx(Zc,{size:12})})]}),w&&a.jsxs("div",{className:"mb-1 ml-3 border-l border-border/20 pl-1",children:[E.map(($,te)=>a.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{kh()||l?.(t.path,$.line)},onKeyDown:se=>{se.key!=="Enter"&&se.key!==" "||(se.preventDefault(),l?.(t.path,$.line))},className:"flex w-full cursor-pointer items-start gap-2 rounded px-2 py-1 text-left font-mono text-[11px] text-muted-foreground transition hover:bg-surface-2 hover:text-foreground",title:`${b1(r,t.path)}:${$.line}`,children:[a.jsx("span",{className:"shrink-0 select-none tabular-nums text-muted-foreground/60",children:$.line}),a.jsx("span",{className:"min-w-0 flex-1 truncate whitespace-pre select-text",children:XQ($.text,i)})]},`${$.line}-${te}`)),I>0&&a.jsx("div",{className:"px-2 py-1 text-[10px] text-muted-foreground/70",children:b("fileTree.moreMatches",{count:I})})]})]})});function ej({rootPath:e,onFileSelect:t,directoriesOnly:r=!1,onPathReference:n,getReferenceText:i,onReferenceCopied:l,insertedReferenceKey:c,copiedReferenceKey:h,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:b,onOpenInFileBrowser:w,canOpenInFileBrowser:A=!1,pinnedPaths:k=$Q,selectedFilePath:E,query:I="",searchRootPath:M,searchOptions:Q={},searchMode:j="name",onContentMatchSelect:F,onDirectoryDropFiles:V,revealDirectory:$}){const{t:te}=Mr(),se=Zt(X=>e?X.directoryCache.get(e):void 0),qe=Zt(X=>X.setDirectoryCache),de=Zt(X=>X.showHiddenFiles),oe=Zt(X=>X.fileSortModesHydrated),Oe=Zt(X=>X.fileSortModes[e]??"name"),et=Zt(X=>X.hydrateFileSortModes),ce=Zt(X=>X.hydrateHideGitIgnoredRoots),Be=Zt(X=>!!X.hideGitIgnoredRoots[e]),ot=Zt(X=>X.hideGitIgnoredRootsHydrated),Ie=Zt(X=>JSON.stringify(X.gitIgnoreExceptions[e]??[])),re=Zt(X=>X.invalidateDirectoryCache);y.useLayoutEffect(()=>{e&&re(e,!0)},[e,Be,Ie,re]);const[Ue,_e]=y.useState(!1),[K,Le]=y.useState(null),[fe,$e]=y.useState(!1),[ze,Ee]=y.useState(!1),[ee,Ke]=y.useState(null),[wt,tt]=y.useState(oe&&ot),ge=oe&&ot||wt;y.useEffect(()=>{let X=!1;return Promise.all([et(),ce()]).catch(()=>{}).finally(()=>{X||tt(!0)}),()=>{X=!0}},[et,ce]);const[it,ht]=y.useState([]),[Y,be]=y.useState(null),[ut,le]=y.useState(X5),[pe,je]=y.useState([]),[xt,dt]=y.useState(null),Dt=y.useRef(null),Xt=y.useRef(0),Ht=I.trim().toLowerCase(),Bt=j==="content",Wt=M||e,lr=Q.excludePatterns??UQ,ur=lr.join(`
|
|
128
|
-
`);y.useEffect(()=>{const X=$?.path;if(!X||!X.startsWith(`${e}/`)&&X!==e)return;const Re=X.slice(e.length).replace(/^\/+/,""),We=Re?Re.split("/"):[],Qt=We.map((Se,Ve)=>`${e}/${We.slice(0,Ve+1).join("/")}`),It=Zt.getState(),ar=Qt.filter(Se=>!It.expandedPaths.has(Se));ar.length>0&&Zt.setState(Se=>({expandedPaths:new Set([...Se.expandedPaths,...ar])}));let Ot=!1,Fe=0;const yr=()=>{if(Ot)return;const Se=Array.from(document.querySelectorAll("[data-file-tree-path]")).find(Ve=>Ve.dataset.fileTreePath===X);if(Se){Se.scrollIntoView({block:"center",behavior:"smooth"});return}Fe+=1,Fe<80&&window.setTimeout(yr,50)},He=window.requestAnimationFrame(yr);return()=>{Ot=!0,window.cancelAnimationFrame(He)}},[$?.nonce,$?.path,e]);const Jt=y.useCallback(async X=>{if(!(xt||X.type==="directory")&&window.confirm(te("fileTree.deleteFileConfirm",{name:X.name}))){dt(X.path);try{await q7(X.path),Zt.getState().applyFileWatchEvents([{type:"deleted",path:X.path}]),ht(Re=>Re.filter(We=>We.path!==X.path)),je(Re=>Re.filter(We=>We.path!==X.path)),k.has(X.path)&&b?.(X.path)}catch(Re){const We=Re instanceof Error?Re.message:String(Re);window.alert(te("fileTree.deleteFileFailed",{message:We}))}finally{dt(null)}}},[xt,b,k,te]);y.useEffect(()=>{if(!e||!ge)return;if(Ht){_e(!1);return}if(Zt.getState().directoryCache.has(e)){_e(!1);return}let X=!1;const Re=new AbortController;return _e(!0),Le(null),C1(e,Re.signal,de,"load_file_tree_root",`file-tree-root:${e}`,Oe,e).then(We=>{if(X)return;const Qt=x1(We.entries);$e(!!We.truncated),qe(e,Qt)}).catch(We=>{X||g1(We)||Le(We instanceof Error?We.message:"Failed to load directory")}).finally(()=>{X||_e(!1)}),()=>{X=!0,Re.abort(),Rp(`file-tree-root:${e}`)}},[Ht,se,e,Oe,qe,de,ge,Be,Ie]),y.useEffect(()=>{if(!Wt||!Ht){Ee(!1),Ke(null),ht([]),je([]),be(null);return}let X=!1;const Re=new AbortController,We=new Set;Ee(!0),Ke(null),ht([]),je([]),le(Bt?ZQ:X5),be({truncated:!1,total:0,engine:"rg",limited:!1,done:!1});const Qt=`file-search:${Wt}:${++Xt.current}`;return Y7(Wt,I.trim(),It=>{if(!X){if(It.engine&&be(ar=>({truncated:ar?.truncated??!1,total:ar?.total??0,engine:It.engine,limited:It.limited??ar?.limited??!1,done:ar?.done??!1})),It.entries?.length){const ar=It.entries.filter(Ot=>We.has(Ot.path)?!1:(We.add(Ot.path),!0));ar.length>0&&(ht(Ot=>[...Ot,...x1(ar)]),be(Ot=>Ot?{...Ot,total:We.size}:{truncated:!1,total:We.size,engine:"rg",limited:!1,done:!1}))}if(It.contentEntries?.length){const ar=It.contentEntries.filter(Ot=>We.has(Ot.path)?!1:(We.add(Ot.path),!0));ar.length>0&&(je(Ot=>[...Ot,...ar]),be(Ot=>Ot?{...Ot,total:We.size}:{truncated:!1,total:We.size,engine:"rg",limited:!1,done:!1}))}It.done&&be(ar=>({truncated:!!It.truncated,total:typeof It.total=="number"?It.total:We.size,engine:It.engine??ar?.engine??"rg",limited:!!It.limited,done:!0}))}},Re.signal,de,j,Qt,{excludePatterns:lr,caseSensitive:Q.caseSensitive,wholeWord:Q.wholeWord,regex:Q.regex}).catch(It=>{X||g1(It)||(Ke(It instanceof Error?It.message:"Failed to search files"),ht([]),je([]),be(null))}).finally(()=>{X||Ee(!1)}),()=>{X=!0,Re.abort(),Rp(Qt)}},[Wt,ur,Bt,I,Ht,j,Q.caseSensitive,Q.regex,Q.wholeWord,de]),y.useEffect(()=>{if(!Ht)return;const X=Dt.current;if(!X)return;const Re=Bt?pe.length:it.length,We=Bt?tx:J5,Qt=new IntersectionObserver(It=>{It.some(ar=>ar.isIntersecting)&&le(ar=>Math.min(ar+We,Re))},{rootMargin:"160px 0px"});return Qt.observe(X),()=>Qt.disconnect()},[Ht,it.length,pe.length,Bt]);const Er=y.useMemo(()=>{if(!se)return;if(!Ht)return r?se.filter(Re=>Re.type==="directory"):se;const X=Zt.getState().directoryCache;return se.filter(Re=>(!r||Re.type==="directory")&&dm(Re,Ht,X))},[r,Ht,se]);if(!e)return a.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:te("fileTree.noWorkingDir")});if(Ue||!ge)return a.jsx(OQ,{});if(Ht&&Bt){const X=Y?.total??pe.length,Re=pe.slice(0,ut),We=ut<pe.length;return a.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[a.jsx(rx,{count:X,loading:ze,engine:Y?.engine,limited:Y?.limited,scope:Wt,content:!0}),ee?a.jsxs("div",{className:"mx-1 mt-3 rounded-xl border border-border/15 bg-surface-2 px-4 py-5 text-center text-sm text-muted-foreground",children:[te("fileTree.contentSearchNeedsRipgrep"),a.jsx("div",{className:"mt-1 break-words text-[11px] text-muted-foreground/70",children:ee})]}):ze&&pe.length===0?a.jsx(gu,{label:te("fileTree.searching"),className:"py-8"}):pe.length===0?a.jsx("div",{className:"mx-1 mt-3 overflow-hidden rounded-xl border border-border/15 bg-surface-2 px-4 py-8 text-center text-sm text-muted-foreground",children:te("fileTree.noContentMatches")}):a.jsxs(a.Fragment,{children:[Y?.limited&&a.jsx("div",{className:"mb-2 rounded-xl bg-[rgb(var(--warning-rgb)_/_0.12)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:te("fileTree.searchTruncatedHint",{count:Y.total})}),Re.map(Qt=>a.jsx(JQ,{entry:Qt,rootPath:Wt,selectedFilePath:E,query:I.trim(),onContentMatchSelect:F,onPathReference:n,getReferenceText:i,onReferenceCopied:l,insertedReferenceKey:c,copiedReferenceKey:h},Qt.path)),a.jsx("div",{ref:Dt,className:"py-2 text-center text-[11px] text-muted-foreground",children:We?a.jsx("button",{type:"button",onClick:()=>le(Qt=>Math.min(Qt+tx,pe.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:te("fileTree.loadMoreSearchResults",{shown:Re.length,total:pe.length})}):ze?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(_n,{size:10,className:"animate-spin"}),te("fileTree.searchStillRunning")]}):Re.length>0?a.jsx("span",{children:te("fileTree.showingSearchResults",{shown:Re.length,total:X})}):null})]})]})}if(Ht){const X=Y?.total??it.length,Re=it.slice(0,ut),We=ut<it.length;return a.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[a.jsx(rx,{count:X,loading:ze,engine:Y?.engine,limited:Y?.limited,scope:Wt,content:!1}),ze&&it.length===0?a.jsx(gu,{label:te("fileTree.searching"),className:"py-8"}):ee?a.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:ee}):it.length===0?a.jsx("div",{className:"mx-1 mt-3 overflow-hidden rounded-xl border border-border/15 bg-surface-2 px-4 py-8 text-center text-sm text-muted-foreground",children:te("fileTree.noMatchingFiles")}):a.jsxs(a.Fragment,{children:[Y?.limited&&a.jsx("div",{className:"mb-2 rounded-xl bg-[rgb(var(--warning-rgb)_/_0.12)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:te("fileTree.searchTruncatedHint",{count:Y.total})}),Re.map(Qt=>a.jsx(YQ,{node:Qt,rootPath:Wt,onFileSelect:t,onPathReference:n,getReferenceText:i,onReferenceCopied:l,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:b,pinnedPaths:k,selectedFilePath:E,insertedReferenceKey:c,copiedReferenceKey:h,onFileDeleteRequest:Jt,deletingFilePath:xt},Qt.path)),a.jsx("div",{ref:Dt,className:"py-2 text-center text-[11px] text-muted-foreground",children:We?a.jsx("button",{type:"button",onClick:()=>le(Qt=>Math.min(Qt+J5,it.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:te("fileTree.loadMoreSearchResults",{shown:Re.length,total:it.length})}):ze?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(_n,{size:10,className:"animate-spin"}),te("fileTree.searchStillRunning")]}):Re.length>0?a.jsx("span",{children:te("fileTree.showingSearchResults",{shown:Re.length,total:X})}):null})]})]})}return K?a.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:K}):!se||se.length===0?a.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:te("fileTree.emptyDir")}):!Er||Er.length===0?a.jsx("div",{className:"mx-3 mt-3 overflow-hidden rounded-xl border border-border/15 bg-surface-2 px-4 py-8 text-center text-sm text-muted-foreground",children:te("fileTree.noMatchingFiles")}):a.jsxs("div",{className:"termdock-native-select w-max min-w-full space-y-px px-2 py-2",children:[fe&&a.jsx("div",{className:"mb-2 rounded-xl bg-[rgb(var(--warning-rgb)_/_0.12)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:te("fileTree.truncatedHint")}),Er.map(X=>a.jsx(qQ,{node:X,gitIgnoreRoot:e,depth:0,onFileSelect:t,directoriesOnly:r,onPathReference:n,getReferenceText:i,onReferenceCopied:l,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:b,onOpenInFileBrowser:w,canOpenInFileBrowser:A,pinnedPaths:k,selectedFilePath:E,queryLower:Ht,insertedReferenceKey:c,copiedReferenceKey:h,onDirectoryDropFiles:V,onFileDeleteRequest:Jt,deletingFilePath:xt,revealedDirectoryPath:$?.path},X.path))]})}function y1(e){return e.trim().replace(/\/+$/,"")||"/"}function tj(e){const t=y1(e);if(t==="/")return"/";const r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}function hm({open:e,initialPath:t,title:r,labels:n,onCancel:i,onConfirm:l}){const{t:c}=Mr(),h={hint:n?.hint??c("sidebar.directoryPickerHint"),cancel:n?.cancel??c("common.cancel"),confirm:n?.confirm??c("sidebar.useThisFolder"),close:n?.close??c("common.close"),parent:n?.parent??c("rightSidebar.parentFolder")},[p,g]=y.useState(()=>y1(t));return y.useEffect(()=>{e&&g(y1(t))},[t,e]),y.useEffect(()=>{if(!e)return;const x=document.body.style.overflow,b=w=>{w.key==="Escape"&&(w.preventDefault(),w.stopPropagation(),i())};return document.body.style.overflow="hidden",document.addEventListener("keydown",b,!0),()=>{document.body.style.overflow=x,document.removeEventListener("keydown",b,!0)}},[i,e]),e?Ai.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop cursor-default bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:i,"aria-label":h.cancel}),a.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"directory-picker-title",className:"fixed bottom-[max(0.75rem,env(safe-area-inset-bottom,0px))] left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(0.75rem,env(safe-area-inset-top,0px))] z-modal-panel flex flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:bottom-auto sm:left-1/2 sm:right-auto sm:top-1/2 sm:h-[min(72svh,36rem)] sm:w-[min(36rem,calc(100vw-2rem))] sm:-translate-x-1/2 sm:-translate-y-1/2",children:[a.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border/15 px-4 py-3",children:[a.jsx("span",{className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/15 text-primary",children:a.jsx(_w,{size:15})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{id:"directory-picker-title",className:"text-[13px] font-semibold text-foreground",children:r}),a.jsx("p",{className:"mt-0.5 text-[10px] text-muted-foreground",children:h.hint})]}),a.jsx("button",{type:"button",autoFocus:!0,onClick:i,className:"inline-flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":h.close,children:a.jsx(Kn,{size:15})})]}),a.jsxs("div",{className:"flex min-h-11 shrink-0 items-center gap-2 border-b border-border/15 px-3 py-1.5",children:[a.jsx("button",{type:"button",disabled:p==="/",onClick:()=>g(tj(p)),className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:opacity-30","aria-label":h.parent,children:a.jsx(tb,{size:14})}),a.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10.5px] text-foreground",title:p,children:p})]}),a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain py-1",children:a.jsx(ej,{rootPath:p,directoriesOnly:!0,onFileSelect:()=>{},onDirectoryRoot:g,selectedFilePath:t||null})}),a.jsxs("footer",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border/15 bg-surface-elevated px-3 py-3",children:[a.jsx("button",{type:"button",onClick:i,className:"min-h-10 rounded-lg bg-surface-2 px-4 text-[11px] font-medium text-foreground transition hover:bg-surface",children:h.cancel}),a.jsxs("button",{type:"button",onClick:()=>l(p),className:"inline-flex min-h-10 items-center gap-1.5 rounded-lg bg-primary px-4 text-[11px] font-semibold text-primary-foreground transition hover:bg-primary/90",children:[a.jsx(ua,{size:13}),h.confirm]})]})]})]}),document.body):null}const v1="termdock:new-session-commands:v1",Dl="__saved_command__:";function Nd(e){return[...new Set(Object.entries(e).filter(([t])=>t.startsWith(Dl)||t==="__custom__"||t==="__terminal__").map(([,t])=>t.trim()).filter(Boolean))]}function q0(){try{const e=JSON.parse(localStorage.getItem(v1)||"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="string"))}catch{return{}}}function rj({directories:e,tmuxAvailable:t,options:r,agents:n,selectedAgent:i,detecting:l,resumeHistory:c,resumeHistoryLoading:h,resumeHistoryPendingId:p,resumeHistoryError:g,onRefreshAgents:x,onSelectAgent:b,onLaunchAgent:w,onResumeHistory:A,onRemoveResumeHistory:k,onClose:E,onOptionsChange:I,additionalContent:M,footerActions:Q}){const{t:j,locale:F}=Mr(),V=y.useRef(null),[$,te]=y.useState(i),[se,qe]=y.useState(!1),[de,oe]=y.useState(!1),[Oe,et]=y.useState(q0),[ce,Be]=y.useState(()=>Nd(q0())),[ot,Ie]=y.useState(null),[re,Ue]=y.useState("idle"),_e=de?"__custom__":$?.slug??"__terminal__",K=$?.command??"",Le=de?Oe.__custom__??Oe.__terminal__??"":$?Oe[_e]??K:"",fe=()=>{const Y=Le.trim()||K;if(!(de&&!Y))try{const be={...q0(),[_e]:Y};if(de){for(const ut of Nd(q0()))be[Dl+ut]=ut;be[Dl+Y]=Y}localStorage.setItem(v1,JSON.stringify(be)),Be(Nd(be)),de&&Ie(Y),Ue("saved")}catch{Ue("error")}},$e=()=>{if(ot)try{const Y=q0();for(const[be,ut]of Object.entries(Y))(be.startsWith(Dl)||be==="__custom__"||be==="__terminal__")&&ut.trim()===ot&&delete Y[be];localStorage.setItem(v1,JSON.stringify(Y)),Be(Nd(Y)),et(be=>({...be,__custom__:""})),Ie(null),Ue("idle")}catch{Ue("error")}},ze=()=>{const Y=Le.trim()||K;de&&!Y||(fe(),w($,Y))},Ee=y.useMemo(()=>[...new Set(e.filter(Boolean))].slice(0,5),[e]),ee=de?ot?Dl+ot:"__custom__":$?.slug??"__terminal__",Ke=Y=>{Ue("idle");const be=Y.startsWith(Dl)?Y.slice(Dl.length):null;Ie(be),oe(Y==="__custom__"||be!==null),(be!==null||Y==="__custom__")&&et(ut=>({...ut,__custom__:be??""})),te(n.find(ut=>ut.slug===Y)??null)},wt=de?ot??j("sidebar.customStartupCommand"):$?.displayName??"Terminal",tt=i?.displayName??"Terminal",ge=!de&&($===null?i===null:i?.slug===$.slug);y.useEffect(()=>{const Y=be=>{be.key!=="Escape"||be.defaultPrevented||se||E()};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[se,E]),y.useEffect(()=>{if(se)return;const Y=be=>{be.target instanceof Node&&(V.current?.contains(be.target)||be.target instanceof Element&&be.target.closest("[data-sidebar-composer-popover]")?.getAttribute("data-sidebar-composer-popover")===V.current?.id||be.target instanceof Element&&be.target.closest('[aria-controls="sidebar-launch-options"]')||E())};return document.addEventListener("pointerdown",Y,!0),()=>document.removeEventListener("pointerdown",Y,!0)},[se,E]);const it=Y=>{I({...r,cwd:Y}),qe(!1)},ht=Y=>new Intl.DateTimeFormat(F==="zh"?"zh-CN":"en",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(Y));return a.jsxs("section",{ref:V,id:"sidebar-launch-options",className:`absolute inset-x-3 bottom-3 z-30 flex flex-col overflow-hidden rounded-2xl border border-border bg-surface shadow-[0_18px_50px_var(--app-shadow-strong),0_4px_14px_var(--app-shadow-soft)] animate-slide-down ${Q?"max-h-[min(70svh,42rem,calc(100%_-_4.5rem))]":"max-h-[min(56svh,36rem,calc(100%_-_4.5rem))]"}`,"aria-label":j("sidebar.newSessionComposerTitle"),children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 px-3 py-1.5",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[a.jsx("span",{className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground",children:a.jsx(ko,{size:14})}),a.jsx("div",{className:"min-w-0",children:a.jsx("div",{className:"text-[12px] font-semibold text-foreground",children:j("sidebar.newSessionComposerTitle")})})]}),a.jsx("button",{type:"button",onClick:E,className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":j("common.close"),children:a.jsx(Kn,{size:14})})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 pb-1",children:[a.jsxs("div",{className:"flex min-h-11 items-center justify-between gap-3",children:[a.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:j("sidebar.sessionMode")}),a.jsx("div",{className:"grid grid-cols-2 gap-1 rounded-lg bg-surface p-0.5",children:["shell","tmux"].map(Y=>a.jsx("button",{type:"button",disabled:Y==="tmux"&&!t,onClick:()=>I({...r,mode:Y}),"aria-pressed":r.mode===Y,title:Y==="tmux"?j(t?"sidebar.tmuxKeepsRunning":"sidebar.newTmuxDisabled"):void 0,className:`min-h-9 rounded-md px-4 text-[11px] font-medium transition ${r.mode===Y?"bg-surface-2 text-foreground":"text-muted-foreground hover:text-foreground"} disabled:cursor-not-allowed disabled:opacity-40`,children:j(Y==="shell"?"sidebar.newShell":"sidebar.newTmux")},Y))})]}),a.jsxs("div",{className:"mt-1 flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:j("sidebar.startupCommand")}),a.jsx("button",{type:"button",onClick:x,disabled:l,className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface hover:text-foreground disabled:opacity-50",title:j("sidebar.detectAgents"),"aria-label":j("sidebar.detectAgents"),children:a.jsx(rs,{size:12,className:l?"animate-spin":""})})]}),a.jsxs("div",{role:"radiogroup","aria-label":j("sidebar.startupCommand"),className:"flex flex-wrap gap-1",children:[n.map(Y=>{const be=!de&&$?.slug===Y.slug;return a.jsxs("button",{type:"button",role:"radio","aria-checked":be,onClick:()=>Ke(Y.slug),className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 text-[10.5px] font-medium transition ${be?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(dc,{agent:Y,size:12}),a.jsx("span",{className:"max-w-[9rem] truncate",children:Y.displayName}),i?.slug===Y.slug&&a.jsx("span",{className:"ml-0.5 text-[9px] text-muted-foreground",children:j("sidebar.defaultAgent")})]},Y.slug)}),ce.map(Y=>{const be=de&&ot===Y;return a.jsxs("button",{type:"button",role:"radio","aria-checked":be,onClick:()=>Ke(Dl+Y),title:Y,className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 transition ${be?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(sc,{size:10,className:"shrink-0"}),a.jsx("span",{className:"max-w-[9rem] truncate font-mono text-[10px]",children:Y})]},Y)}),a.jsxs("button",{type:"button",role:"radio","aria-checked":ee==="__terminal__",onClick:()=>Ke("__terminal__"),className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 text-[10.5px] font-medium transition ${ee==="__terminal__"?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(ko,{size:11,className:"shrink-0"}),a.jsx("span",{children:"Terminal"}),i===null&&a.jsx("span",{className:"ml-0.5 text-[9px] font-normal text-muted-foreground",children:j("sidebar.defaultAgent")})]}),a.jsxs("button",{type:"button",role:"radio","aria-checked":ee==="__custom__",onClick:()=>Ke("__custom__"),className:`inline-flex min-h-7 items-center gap-0.5 rounded-md px-2 text-[10.5px] font-medium transition ${ee==="__custom__"?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(wi,{size:10,className:"shrink-0"}),a.jsx("span",{children:j("sidebar.addStartupCommand")})]})]}),!ge&&!de&&a.jsxs("div",{className:"mt-1 flex min-h-8 items-center justify-between gap-2 px-0.5 text-[10px]",children:[a.jsx("span",{className:"truncate text-muted-foreground",children:j("sidebar.currentDefaultAgent",{name:tt})}),a.jsx("button",{type:"button",onClick:()=>b($),className:"relative z-10 shrink-0 rounded-md px-2 py-1.5 font-medium text-primary transition hover:bg-primary/10",children:j("sidebar.makeDefault")})]}),re==="error"&&a.jsx("p",{role:"alert",className:"text-[10px] text-destructive",children:j("sidebar.saveStartupCommandFailed")}),($||de)&&a.jsxs("details",{open:de&&!ot||void 0,className:"group/command mt-0.5",children:[a.jsxs("summary",{className:"ml-auto flex min-h-8 w-fit cursor-pointer list-none items-center gap-1 rounded-md px-1 text-[10px] text-muted-foreground transition hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/50 [&::-webkit-details-marker]:hidden",children:[j(de&&!ot?"sidebar.customStartupCommand":"sidebar.changeStartupCommand"),a.jsx(Yo,{size:11,className:"transition-transform group-open/command:rotate-180"})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("label",{htmlFor:"new-session-command",className:"sr-only",children:j("sidebar.startupCommand")}),$&&Le!==K&&a.jsx("button",{type:"button",onClick:()=>{et(Y=>({...Y,[_e]:K})),Ue("idle")},className:"min-h-8 rounded-md px-2 text-[10px] text-primary transition hover:bg-primary/10",children:j("sidebar.resetStartupCommand")})]}),a.jsx("input",{id:"new-session-command",value:Le,onChange:Y=>{et(be=>({...be,[_e]:Y.target.value})),Ue("idle")},placeholder:K||j("sidebar.startupCommandPlaceholder"),autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,autoComplete:"off",className:"min-h-10 w-full rounded-lg border-0 bg-surface px-3 font-mono text-[16px] text-foreground outline-none ring-1 ring-inset ring-border transition focus:ring-primary/50 sm:text-[11px]"}),a.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2","aria-live":"polite",children:[de&&ot&&a.jsxs("button",{type:"button",onClick:$e,className:"mr-auto inline-flex min-h-9 items-center gap-1 rounded-md px-2 text-[10px] text-muted-foreground transition hover:text-destructive","aria-label":j("sidebar.deleteStartupCommand"),children:[a.jsx(ri,{size:11}),j("sidebar.deleteStartupCommand")]}),a.jsx("button",{type:"button",onClick:fe,disabled:re==="saved"||de&&!Le.trim(),className:"min-h-8 rounded-md px-2 text-[10px] font-medium text-primary transition hover:bg-primary/10 disabled:cursor-default disabled:opacity-50",children:j(re==="saved"?"sidebar.startupCommandSaved":"sidebar.saveStartupCommand")})]}),a.jsx("p",{className:"mb-2 mt-1.5 px-0.5 text-[10px] leading-relaxed text-muted-foreground",children:j($?"sidebar.agentStartupCommandHint":"sidebar.terminalStartupCommandHint")})]},ot??_e),a.jsx("label",{htmlFor:"new-session-directory",className:"mt-2 block text-[11px] text-muted-foreground",children:j("sidebar.workingDirectory")}),a.jsxs("button",{id:"new-session-directory",type:"button","aria-haspopup":"dialog",onClick:()=>qe(!0),className:"mt-1 flex min-h-11 w-full items-center gap-2 rounded-lg border border-transparent bg-surface px-2.5 font-mono text-[11px] text-foreground outline-none transition hover:bg-surface-2 focus-visible:border-primary",children:[a.jsx(hc,{size:12,className:"shrink-0 text-muted-foreground"}),a.jsx("span",{className:`min-w-0 flex-1 truncate text-left ${r.cwd?"":"text-muted-foreground"}`,children:r.cwd||j("sidebar.directoryPlaceholder")})]}),Ee.length>0&&a.jsx("div",{className:"mt-1.5 flex gap-1 overflow-x-auto pb-0.5","aria-label":j("sidebar.recentDirectories"),children:Ee.map(Y=>a.jsx("button",{type:"button",onClick:()=>it(Y),title:Y,className:"min-h-8 shrink-0 rounded-md px-2 text-[10px] text-muted-foreground transition hover:bg-surface hover:text-foreground",children:xu(Y)||Y},Y))}),(c.length>0||g)&&a.jsxs("details",{className:"mt-1",children:[a.jsxs("summary",{className:"flex min-h-9 cursor-pointer list-none items-center gap-2 rounded-md px-1 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground transition hover:text-foreground",children:[a.jsx(sc,{size:11}),a.jsx("span",{className:"flex-1",children:j("sidebar.resumeHistory")}),h&&a.jsx(_n,{size:10,className:"animate-spin"}),c.length>0&&a.jsx("span",{className:"normal-case tracking-normal",children:j("sidebar.resumeHistoryCount",{n:c.length})}),a.jsx(Yo,{size:11})]}),c.length>0&&a.jsx("div",{className:"mt-1 divide-y divide-border overflow-hidden rounded-lg border border-border bg-surface",children:c.slice(0,6).map(Y=>{const be=p===Y.id;return a.jsxs("div",{className:"group flex min-w-0 items-stretch transition hover:bg-surface-2",children:[a.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>A(Y),className:"flex min-h-11 min-w-0 flex-1 items-center gap-2.5 px-2.5 py-2 text-left disabled:cursor-wait disabled:opacity-60","aria-label":j("sidebar.resumeHistoryAction",{title:Y.title}),children:[a.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:be?a.jsx(_n,{size:13,className:"animate-spin"}):a.jsx(dc,{agent:Y.agent,size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-[11px] font-semibold text-foreground",children:Y.title}),a.jsxs("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[Y.agent.displayName," · ",ht(Y.closedAt)]})]}),a.jsx(cb,{size:12,className:"shrink-0 text-muted-foreground transition group-hover:text-primary"})]}),a.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>k(Y.id),className:"relative inline-flex w-11 shrink-0 items-center justify-center text-muted-foreground transition hover:text-destructive disabled:opacity-40","aria-label":j("sidebar.resumeHistoryRemove",{title:Y.title}),children:[a.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-2 left-0 w-px bg-border opacity-30"}),a.jsx(ri,{size:12})]})]},Y.id)})}),g&&a.jsx("div",{role:"alert",className:"mt-1.5 px-1 text-[10px] text-destructive",children:g})]}),M]}),a.jsxs("div",{className:"shrink-0 bg-surface px-3 pb-3 pt-2",children:[a.jsxs("button",{type:"button",onClick:ze,disabled:de&&!Le.trim(),className:"flex min-h-11 w-full items-center justify-center gap-2 rounded-lg bg-primary px-3 text-[12px] font-semibold text-primary-foreground transition hover:brightness-110 active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-40","aria-label":j("sidebar.launchSessionWith",{name:wt}),children:[$?a.jsx(dc,{agent:$,size:15}):a.jsx(ko,{size:14}),a.jsx("span",{className:"truncate",children:j("sidebar.launchSessionWith",{name:wt})})]}),Q]}),a.jsx(hm,{open:se,initialPath:r.cwd?.trim()||Ee[0]||"/",title:j("sidebar.chooseDirectory"),onCancel:()=>qe(!1),onConfirm:it})]})}const ry="termdock:new-session-agent:v1";function nj(){if(typeof window>"u")return null;try{const e=JSON.parse(window.localStorage.getItem(ry)||"null");return!e||typeof e.slug!="string"||typeof e.command!="string"?null:{slug:e.slug,command:e.command,displayName:typeof e.displayName=="string"?e.displayName:e.slug,capabilities:Array.isArray(e.capabilities)?e.capabilities.filter(t=>typeof t=="string"):void 0,accentColor:typeof e.accentColor=="string"?e.accentColor:"var(--muted-foreground)",icon:typeof e.icon=="string"?e.icon:null,isPlugin:e.isPlugin===!0,iconMode:e.iconMode==="native"?"native":e.iconMode==="mask"?"mask":void 0,iconVersion:typeof e.iconVersion=="number"?e.iconVersion:void 0}}catch{return null}}function gp(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ry,JSON.stringify(e))}catch{}}function sj(e,t){return e?t.find(r=>r.slug===e)??null:null}function ij(){const[e,t]=y.useState(nj),[r,n]=y.useState([]),[i,l]=y.useState(!0),c=y.useCallback(async()=>{l(!0);try{const[p,g]=await Promise.all([$l(),Yx()]),x=sj(p.newSessionAgentSlug,g);n(g),t(x),gp(x)}finally{l(!1)}},[]);y.useEffect(()=>{const p=()=>{c().catch(()=>{})};if(performance.getEntriesByName("termdock:startup:initial-viewport-presented").length>0){p();return}return window.addEventListener("termdock:initial-viewport-presented",p,{once:!0}),()=>window.removeEventListener("termdock:initial-viewport-presented",p)},[c]);const h=y.useCallback(async p=>{const g=e;t(p),gp(p);try{await ca({newSessionAgentSlug:p?.slug??null})}catch(x){throw t(g),gp(g),x}},[e]);return{preference:e,agents:r,detecting:i,refresh:c,selectAgent:h}}function aj(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)?e.slice(0,10):e}function rh(e,t){try{const r=`termdock-workbench:${window.location.origin}:${e}`;return t!==void 0&&localStorage.setItem(r,t),localStorage.getItem(r)}catch{return null}}function oj(){const e=rh("tab");return e==="automation"||e==="search"?e:"collaboration"}const As="w-full rounded-lg border border-border/20 bg-surface-2 px-3 py-2 text-[12px] text-foreground outline-none transition focus:border-primary/60",w1="inline-flex min-h-7 items-center justify-center rounded-md border px-2 py-1 text-[11px] leading-4 font-medium transition",kr="inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-[12px] font-medium transition disabled:cursor-not-allowed disabled:opacity-40";function nx(e){const[t,r]=y.useState(null),[n,i]=y.useState(!1),[l,c]=y.useState({}),h=y.useCallback(x=>c(b=>({...x,...b})),[]),p=y.useCallback((x,b)=>c(w=>JSON.stringify(w[x])===JSON.stringify(b)?w:{...w,[x]:b}),[]),g={drafts:l,loadDrafts:h,updateDraft:p};return a.jsxs(a.Fragment,{children:[!n&&a.jsx(sx,{...e,...g,onOpenOverlay:r,onClose:()=>{t?i(!0):e.onClose()}}),t&&a.jsx(sx,{...e,...g,overlayOnly:!0,initialFloating:t==="floating",onFloatingChange:void 0,onOpenOverlay:r,onClose:()=>{r(null),n&&e.onClose()}})]})}function sx({activeSessionId:e,initialCollaborationGroupId:t=null,initialFloating:r=!1,onFloatingChange:n,defaultSessionMode:i="shell",onClose:l,onNewSession:c,overlayOnly:h=!1,onOpenOverlay:p,drafts:g,loadDrafts:x,updateDraft:b}){const[w,A]=y.useState(r);y.useEffect(()=>{A(r)},[r]);const[k,E]=y.useState(!1),[I,M]=y.useState(t),Q=ts(ke=>ke.docks[t??"workbench"]),j=ts(ke=>ke.hosts[t??"workbench"]),[F,V]=y.useState("floating"),[$,te]=y.useState(null),[se,qe]=y.useState({x:16,y:80}),de=y.useRef(null),oe=y.useRef({x:.5,y:.5}),[Oe,et]=y.useState(null),[ce,Be]=y.useState(null);y.useEffect(()=>{let ke=!1;return $l().then(St=>{if(ke)return;const kt=pb(St.collaborationPanels?.[Dh()],t);kt.position&&(oe.current=kt.position),kt.size&&te(kt.size),x(kt.drafts??{}),h||V(kt.mode??"floating"),et(kt)}).catch(()=>{ke||Be("面板草稿加载失败,请重新打开面板重试")}),()=>{ke=!0}},[]);const[ot,Ie]=y.useState(null);y.useEffect(()=>{const ke=St=>Be(String(St.detail));return window.addEventListener("termdock-panel-save-error",ke),()=>{window.removeEventListener("termdock-panel-save-error",ke),h||ts.getState().setDock(t??"workbench",null)}},[]);const re=!h&&w&&F==="docked"&&!!j;y.useEffect(()=>{!h&&!w&&ts.getState().setDock(t??"workbench",null)},[w]);const Ue=async ke=>{if(h||k||ke==="docked"&&!e)return;const St={sessionId:e,side:"right"};E(!0);try{await hl({mode:ke,...ke==="docked"?{dock:St}:{}},t),V(ke),ts.getState().setDock(t??"workbench",ke==="docked"?St:null)}catch{Be("面板布局保存失败,请重试")}finally{E(!1)}},_e=y.useRef(!1),K=y.useRef(null),Le=y.useCallback((ke,St)=>{const kt=de.current?.getBoundingClientRect(),ue=window.visualViewport,Nr=(ue?.offsetLeft??0)+12,st=(ue?.offsetTop??0)+12;return{x:Math.max(Nr,Math.min(ke,Nr+(ue?.width??window.innerWidth)-(kt?.width??440)-24)),y:Math.max(st,Math.min(St,st+(ue?.height??window.innerHeight)-(kt?.height??340)-24))}},[]),[fe,$e]=y.useState(()=>t?"collaboration":oj()),[ze,Ee]=y.useState(()=>new Set([fe])),ee=ke=>{$e(ke),Ee(St=>new Set([...St,ke])),dt(null),Xt(null),!t&&!h&&rh("tab",ke)},[Ke,wt]=y.useState([]),[tt,ge]=y.useState([]),[it,ht]=y.useState([]),[Y,be]=y.useState([]),[ut,le]=y.useState([]),[pe,je]=y.useState(null),[xt,dt]=y.useState(null),[Dt,Xt]=y.useState(null),[Ht,Bt]=y.useState("loading"),[Wt,lr]=y.useState("loading"),[ur,Jt]=y.useState(null),[Er,X]=y.useState(null),[Re,We]=y.useState(),[Qt,It]=y.useState(null),ar=y.useRef(null),Ot=y.useRef(null),Fe=y.useRef(null),yr=t?Y.find(ke=>ke.id===t)??null:null,He=y.useRef(!1);y.useEffect(()=>{if(t||Ht!=="loaded"||He.current)return;He.current=!0;const ke=rh("group"),St=Y.find(kt=>kt.id===ke)??Y.find(kt=>e&&kt.sessionIds.includes(e))??Y[0];M(kt=>kt??St?.id??null)},[t,Ht,Y,e]),y.useEffect(()=>{!t&&!h&&I&&Y.some(ke=>ke.id===I)&&rh("group",I)},[I,Y,t,h]);const Se=I?Y.find(ke=>ke.id===I)??null:Y[0]??null,Ve=!!t&&Ht==="loaded"&&!yr,Ct=!!Oe||!!ce,jr=!h&&F==="docked"&&!!yr&&!!(Q??Oe?.dock)&&!j,ft=Ct&&!jr&&!!e&&(!!Se?.sessionIds.includes(e)||!!t&&(Ht!=="loading"&&!yr||!!ce));y.useLayoutEffect(()=>{if(!w||re||!ft)return;const ke=()=>{const kt=window.visualViewport;Ie(kt?.height??window.innerHeight);const ue=de.current?.getBoundingClientRect();!ue?.width||!ue.height||_e.current||qe(Le((kt?.offsetLeft??0)+12+Math.max(0,(kt?.width??window.innerWidth)-ue.width-24)*oe.current.x,(kt?.offsetTop??0)+12+Math.max(0,(kt?.height??window.innerHeight)-ue.height-24)*oe.current.y))},St=new ResizeObserver(ke);return de.current&&St.observe(de.current),window.addEventListener("resize",ke),window.visualViewport?.addEventListener("resize",ke),ke(),()=>{St.disconnect(),window.removeEventListener("resize",ke),window.visualViewport?.removeEventListener("resize",ke)}},[w,re,ft,Le,Oe,$]),y.useEffect(()=>{if(h)return;const ke=t??"workbench",St=ts.getState();Ve?St.docks[ke]&&St.setDock(ke,null):yr&&w&&F==="docked"&&Oe?.dock&&!St.docks[ke]&&St.setDock(ke,Oe.dock)},[Ve,yr,w,F,Oe,t,Q]);const Br=async(ke,St=!1)=>{if(!(k||ke&&!Se)){if(!h&&!ke&&!St&&Q){p("full");return}if(h){St?l():(A(ke),p(ke?"floating":"full"));return}E(!0);try{await n?.(ke?Se.id:null),A(ke),ke&&F==="docked"&&e&&ts.getState().setDock(t??"workbench",{sessionId:e,side:Q?.side??Oe?.dock?.side??"right"}),St&&l()}catch(kt){dt(`常驻浮窗状态保存失败,请重试:${kt instanceof Error?kt.message:"连接失败"}`)}finally{E(!1)}}},Wn=y.useCallback(ke=>{be(ke.groups),le(ke.sessions),We(ke.peers),X(null),Bt("loaded")},[]);y.useEffect(()=>Zx(Wn),[Wn]);const an=y.useCallback(async(ke={})=>{ke.silent||dt(null),Ot.current||(Ot.current=X7().then(St=>{wt(St.automations),ge(St.runs),lr("loaded"),Jt(null)}).catch(St=>{lr("error"),Jt(St instanceof Error?St.message:"自动任务加载失败")}).finally(()=>{Ot.current=null})),Fe.current||(Fe.current=Yx().then(St=>{ht(St),It(null)}).catch(()=>{It("Agent 命令检测失败;已有会话可继续协作。")}).finally(()=>{Fe.current=null})),ar.current||(Bt(St=>St==="error"?"loading":St),ar.current=Kx().then(Wn).catch(St=>{Bt("error"),X(`协作会话加载失败:${St instanceof Error?St.message:"请重试"}`)}).finally(()=>{ar.current=null})),await Promise.all([ar.current,Ot.current])},[Wn]);return y.useEffect(()=>{an();const ke=window.setInterval(()=>{an({silent:!0})},1e4);return()=>window.clearInterval(ke)},[an]),y.useEffect(()=>{const ke=St=>{St.key==="Escape"&&!St.defaultPrevented&&!w&&l()};return window.addEventListener("keydown",ke),()=>window.removeEventListener("keydown",ke)},[l,w]),Ai.createPortal(a.jsxs(a.Fragment,{children:[!w&&a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:l,"aria-label":"关闭 Agent 工作台"}),a.jsxs("section",{onPointerDown:ke=>{re&&ke.stopPropagation()},ref:de,"aria-label":re?"工作组消息分屏":w?"工作组消息浮窗":"Agent 工作台",style:w&&!re?{display:ft?void 0:"none",left:se.x,top:se.y,...$?{width:`min(calc(100vw - 24px), max(280px, ${$.width*100}vw))`,height:`min(calc(100dvh - 24px), max(220px, ${$.height*100}dvh))`}:{},maxHeight:ot?ot-24:"calc(100dvh - 24px)"}:void 0,className:re?"flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden bg-surface":w?"fixed z-menu-panel flex w-[min(400px,calc(100vw-24px))] flex-col overflow-hidden rounded-2xl border border-border/20 bg-surface shadow-xl":"fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,var(--app-vv-offset-top,0px),env(safe-area-inset-top,0px))] h-[calc(var(--app-visible-vh,100dvh)-max(1.5rem,var(--app-vv-offset-top,0px),env(safe-area-inset-top,0px))-max(1.5rem,env(safe-area-inset-bottom,0px)))] z-modal-panel mx-auto flex max-w-3xl flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:top-[calc(var(--app-visible-vh,100dvh)*0.08)] sm:h-[calc(var(--app-visible-vh,100dvh)*0.84)]",children:[a.jsxs("header",{"data-pane-titlebar":re?"true":void 0,"data-panel-drag-title":re?"true":void 0,onDragStart:ke=>ke.preventDefault(),className:`flex items-center gap-2 border-b border-border/15 ${re?"h-6 min-h-6 shrink-0 cursor-grab select-none bg-[var(--chrome-bg)] px-2 active:cursor-grabbing":w?"px-3 py-2 cursor-move touch-none select-none":"px-4 py-3"}`,onPointerDown:ke=>{!w||re||ke.button!==0||ke.target.closest("button")||(K.current={x:ke.clientX,y:ke.clientY,left:se.x,top:se.y},ke.currentTarget.setPointerCapture?.(ke.pointerId))},onPointerMove:ke=>{K.current&&qe(Le(K.current.left+ke.clientX-K.current.x,K.current.top+ke.clientY-K.current.y))},onPointerUp:()=>{if(!K.current)return;K.current=null;const ke=de.current?.getBoundingClientRect(),St=window.visualViewport;ke&&(oe.current=eg(se.x,se.y,(St?.offsetLeft??0)+12,(St?.offsetTop??0)+12,(St?.width??window.innerWidth)-ke.width-24,(St?.height??window.innerHeight)-ke.height-24),hl({position:oe.current},t).catch(()=>Be("浮窗位置保存失败,请重新拖动重试")))},onPointerCancel:()=>{K.current=null},children:[a.jsx(ju,{size:re?13:17,className:"shrink-0 text-primary"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:`${w?"truncate text-[12px]":"text-[14px]"} font-semibold text-foreground`,title:re?"拖动标题移动面板;放在边缘拆分,中央交换":yr?.name,children:yr?`${yr.name} · 协作消息`:t?"协作消息":"Agent 工作台"}),!re&&a.jsx("p",{className:"text-[10px] text-muted-foreground",children:w?"引用、文件路径和粘贴优先加入此处":yr?"选择成员,发送协作消息":"自动任务、会话协作与历史搜索"})]}),!re&&fe==="collaboration"&&Y.length>0&&a.jsx("button",{className:`${kr} shrink-0 text-primary hover:bg-primary/10`,disabled:k,onClick:()=>{Br(!w)},children:w?"完整面板":"常驻浮窗"}),re&&a.jsxs(a.Fragment,{children:[a.jsx(Pu,{size:14,"aria-hidden":"true",className:"shrink-0 text-muted-foreground"}),a.jsx("button",{type:"button","aria-label":"打开完整弹窗",title:"打开完整弹窗",disabled:k,className:"rounded p-1 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:()=>p("full"),children:a.jsx(M9,{size:14})}),a.jsx("button",{type:"button","aria-label":"切换为小浮窗",title:"切换为小浮窗",disabled:k,className:"rounded p-1 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:()=>{Ue("floating")},children:a.jsx(Rh,{size:14})})]}),a.jsx("button",{className:`${re?"rounded p-1":"rounded-lg p-2"} text-muted-foreground hover:bg-surface-2 hover:text-foreground`,disabled:k,onClick:()=>{w?Br(!1,!0):l()},"aria-label":"关闭",children:a.jsx(Kn,{size:16})})]}),w&&!re&&!h&&a.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-border/15 px-3 py-1.5",children:[a.jsx("button",{type:"button",disabled:k,"aria-pressed":F==="floating",className:`${w1} ${F==="floating"?"border-primary/40 text-primary":"border-transparent text-muted-foreground"}`,onClick:()=>{Ue("floating")},children:"浮窗"}),a.jsx("button",{type:"button",disabled:k||!e||Ve,"aria-pressed":F==="docked",className:`${w1} ${F==="docked"?"border-primary/40 text-primary":"border-transparent text-muted-foreground"}`,onClick:()=>{Ue("docked")},children:"占用分屏"})]}),!w&&a.jsx("nav",{"aria-label":"工作台功能",className:"grid shrink-0 grid-cols-3 gap-1 border-b border-border/15 px-3 py-2",children:[["collaboration",Zc,"会话协作"],["automation",bu,"自动任务"],["search",Mh,"历史搜索"]].map(([ke,St,kt])=>a.jsxs("button",{type:"button","aria-pressed":fe===ke,"aria-controls":`workbench-${ke}`,onClick:()=>ee(ke),className:`${kr} ${fe===ke?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(St,{size:14}),kt]},ke))}),fe==="collaboration"&&Er&&a.jsxs("div",{role:"alert",className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:[Er,a.jsx("button",{className:`${kr} ml-2`,onClick:()=>{an()},children:"重新加载会话"})]}),!w&&fe==="collaboration"&&Re&&a.jsx(hj,{peers:Re,currentGroupId:Se?.id,busy:pe,setBusy:je,setError:dt,setNotice:Xt,onSelectGroup:M}),fe!=="search"&&Qt&&a.jsx("div",{className:"mx-4 mt-3 text-[11px] text-muted-foreground",children:Qt}),xt&&a.jsx("div",{className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:xt}),Dt&&!w&&a.jsxs("div",{className:"mx-4 mt-3 flex items-center gap-2 rounded-lg bg-primary/10 px-3 py-2 text-[11px] text-primary",children:[a.jsx(ua,{size:13}),Dt]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[ze.has("automation")&&a.jsx("div",{id:"workbench-automation",className:fe==="automation"?"h-full min-h-0 p-4":"hidden",children:a.jsx(lj,{automations:Ke,runs:tt,agents:it,sessions:ut.filter(ke=>!Qu(ke.sessionId)),activeSessionId:e,loading:Wt==="loading",loadError:ur,busy:pe,setBusy:je,setError:dt,setNotice:Xt,refresh:an,onClose:l})}),ze.has("collaboration")&&a.jsxs("div",{id:"workbench-collaboration",className:fe==="collaboration"?`h-full min-h-0 overflow-x-hidden overflow-y-auto overscroll-y-contain ${w?"p-3":"p-4"}`:"hidden",children:[!Oe&&!ce&&a.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"正在恢复消息面板…"}),t&&!yr&&a.jsxs("div",{role:"status",className:"space-y-2 text-[11px] text-muted-foreground",children:[a.jsx("p",{children:Ht==="loading"?"正在加载协作组…":Ht==="error"?"协作组加载失败,恢复连接后可重试。":"此协作组暂不可用,已释放分屏位置。草稿和布局偏好仍保留。"}),Ht!=="loading"&&a.jsx("button",{className:kr,onClick:()=>{an()},children:"重新加载"})]}),ce&&a.jsx("p",{role:"alert",className:"text-[11px] text-destructive",children:ce}),Oe&&(!t||yr)&&a.jsx(uj,{active:fe==="collaboration",notice:Dt,initialDrafts:g,onDraftChange:b,docked:re,inputKeySuffix:h?":overlay":"",selectedGroupId:I,setSelectedGroupId:M,floatingVisible:ft,floating:w,sessionsState:Ht,groups:Y,sessions:ut,agents:it,activeSessionId:e,initialGroupId:t,onOpenSession:async ke=>{await gj(ke),w||l()},defaultSessionMode:i,busy:pe,setBusy:je,setError:dt,setNotice:Xt,refresh:an})]}),ze.has("search")&&a.jsx("div",{id:"workbench-search",className:fe==="search"?"h-full min-h-0 overflow-y-auto overscroll-y-contain p-4":"hidden",children:a.jsx(wj,{active:fe==="search",onClose:l,onNewSession:c,setError:dt})})]}),w&&!re&&a.jsx("button",{type:"button","aria-label":"调整协作浮窗大小",className:"absolute bottom-0 right-0 h-4 w-4 cursor-nwse-resize touch-none text-muted-foreground hover:text-primary",onPointerDown:ke=>{ke.preventDefault(),_e.current=!0,ke.currentTarget.setPointerCapture(ke.pointerId)},onPointerMove:ke=>{if(!ke.currentTarget.hasPointerCapture(ke.pointerId))return;const St=window.visualViewport,kt=St?.width??window.innerWidth,ue=St?.height??window.innerHeight;te({width:Math.min(1,Math.max(280,ke.clientX-se.x)/kt),height:Math.min(1,Math.max(220,ke.clientY-se.y)/ue)})},onPointerUp:()=>{_e.current=!1;const ke=de.current?.getBoundingClientRect(),St=window.visualViewport;ke&&(oe.current=eg(se.x,se.y,(St?.offsetLeft??0)+12,(St?.offsetTop??0)+12,(St?.width??window.innerWidth)-ke.width-24,(St?.height??window.innerHeight)-ke.height-24)),$&&hl({size:$,position:oe.current},t).catch(()=>Be("浮窗大小保存失败,请重新调整重试"))},onPointerCancel:()=>{_e.current=!1},onKeyDown:ke=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(ke.key))return;ke.preventDefault();const St=de.current?.getBoundingClientRect(),kt={width:Math.max(.15,Math.min(1,($?.width??(St?.width??400)/window.innerWidth)+(ke.key==="ArrowRight"?.03:ke.key==="ArrowLeft"?-.03:0))),height:Math.max(.15,Math.min(1,($?.height??(St?.height??300)/window.innerHeight)+(ke.key==="ArrowDown"?.03:ke.key==="ArrowUp"?-.03:0)))};te(kt),hl({size:kt},t).catch(()=>Be("浮窗大小保存失败,请重试"))},children:a.jsx("span",{"aria-hidden":"true",children:"⌟"})})]})]}),re?j:document.body)}function lj({automations:e,runs:t,agents:r,sessions:n,activeSessionId:i,loading:l,loadError:c,busy:h,setBusy:p,setError:g,setNotice:x,refresh:b,onClose:w}){const[A,k]=y.useState(null),[E,I]=y.useState(!1),[M,Q]=y.useState(null),j=async(F,V,$)=>{p(F),g(null),x(null);try{await V(),await b(),x($)}catch(te){g(te instanceof Error?te.message:"操作失败")}finally{p(null)}};return E?a.jsx(cj,{agents:r,sessions:n,activeSessionId:i,initial:A,onCancel:()=>{k(null),I(!1),g(null)},onSaved:async(F,V)=>{k(null),I(!1),await b(),x(A?`“${F}”已更新`:V?`“${F}”已创建,将按计划自动运行`:`“${F}”已创建,当前未启用`)},setError:g},A?.id??"new"):a.jsxs("div",{className:"h-full space-y-4 overflow-y-auto overscroll-y-contain",children:[c&&a.jsxs("div",{role:"alert",className:"rounded-lg bg-destructive/10 p-3 text-[11px] text-destructive",children:["自动任务同步失败:",c,a.jsx("button",{className:kr,onClick:()=>{b()},children:"重新加载"})]}),a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"自动任务"}),a.jsx("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-muted-foreground",children:"定时发送任务,打开运行会话查看输出。"})]}),!E&&e.length>0&&a.jsxs("button",{className:`${kr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{k(null),I(!0),x(null)},children:[a.jsx(wi,{size:13}),"新建任务"]})]}),l&&a.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"正在加载自动任务…"}),!l&&!c&&e.length===0&&a.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[a.jsx(Y9,{size:24,className:"mx-auto text-primary"}),a.jsx("p",{className:"mt-3 text-[13px] font-medium text-foreground",children:"把重复工作交给 Agent"}),a.jsx("p",{className:"mx-auto mt-1 max-w-sm text-[11px] leading-relaxed text-muted-foreground",children:"写清任务内容,选择运行频率。创建后可以先手动运行一次确认效果。"}),a.jsxs("button",{className:`${kr} mt-4 bg-primary text-primary-foreground`,onClick:()=>I(!0),children:[a.jsx(wi,{size:13}),"创建第一个任务"]})]}),a.jsx("div",{className:"space-y-2",children:e.map(F=>{const V=t.filter(te=>te.automationId===F.id).sort((te,se)=>se.startedAt-te.startedAt)[0],$=r.find(te=>te.command===F.command);return a.jsxs("article",{className:"rounded-xl border border-border/15 bg-surface-2/40 p-3 transition hover:border-border/30",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:F.name}),a.jsx("span",{className:`rounded-full px-2 py-0.5 text-[9px] ${F.enabled?"bg-primary/10 text-primary":"bg-surface-elevated text-muted-foreground"}`,children:F.enabled?"已启用":"已停用"}),F.lastRunStatus&&a.jsx("span",{className:`text-[10px] ${_j(F.lastRunStatus)}`,children:Sj(F.lastRunStatus)})]}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-muted-foreground",children:[a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(bu,{size:11}),Tj(F)]}),a.jsx("span",{children:F.enabled&&F.nextRunAt?`下次 ${Eh(F.nextRunAt)}`:"不会自动运行"})]}),a.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:F.targetSessionId?`发送到 ${n.find(te=>te.sessionId===F.targetSessionId)?.name??"指定会话"}`:`新建 ${$?.displayName??"Agent"} 会话 · ${F.cwd}`}),a.jsx("p",{className:"mt-2 line-clamp-2 text-[11px] leading-relaxed text-foreground/80",children:F.prompt}),F.lastRunAt&&a.jsxs("p",{className:"mt-2 text-[10px] text-muted-foreground",children:["上次 ",Eh(F.lastRunAt),F.lastRunMessage?` · ${F.lastRunMessage}`:""]})]}),a.jsx("button",{"aria-label":`编辑 ${F.name}`,title:"编辑",className:"rounded-lg p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",onClick:()=>{k(F),I(!0),x(null)},children:a.jsx(Mp,{size:13})})]}),a.jsx("div",{className:"mt-3 flex flex-wrap items-center justify-end gap-2 border-t border-border/10 pt-3",children:M===F.id?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"mr-auto text-[10px] text-destructive",children:"删除后不会再自动运行"}),a.jsx("button",{className:`${kr} bg-surface-elevated text-foreground`,onClick:()=>Q(null),children:"取消"}),a.jsxs("button",{disabled:h!==null,className:`${kr} bg-destructive text-destructive-foreground`,onClick:()=>{j(`delete:${F.id}`,()=>e8(F.id),`“${F.name}”已删除`).then(()=>Q(null))},children:[h===`delete:${F.id}`?a.jsx(rs,{size:13,className:"animate-spin"}):a.jsx(ri,{size:13}),"确认删除"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:`${kr} mr-auto px-2 text-destructive hover:bg-destructive/10`,onClick:()=>Q(F.id),children:[a.jsx(ri,{size:13}),"删除"]}),a.jsxs("button",{disabled:h!==null,className:`${kr} ${F.enabled?"bg-surface-elevated text-foreground":"bg-primary/15 text-primary"}`,onClick:()=>{j(`toggle:${F.id}`,()=>t8(F.id,!F.enabled),F.enabled?`“${F.name}”已暂停,不会自动运行`:`“${F.name}”已恢复,将按原计划运行`)},children:[h===`toggle:${F.id}`?a.jsx(rs,{size:13,className:"animate-spin"}):F.enabled?a.jsx(rA,{size:13}):a.jsx(Bp,{size:13}),F.enabled?"暂停":"恢复"]}),V?.frontendSessionId&&a.jsxs("button",{className:`${kr} bg-surface-elevated text-foreground`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:V.frontendSessionId})),w()},children:[a.jsx(Rh,{size:13}),"打开上次会话"]}),a.jsxs("button",{disabled:h!==null,className:`${kr} bg-primary/15 text-primary`,onClick:()=>{j(`run:${F.id}`,()=>r8(F.id),`“${F.name}”已投递,可打开会话查看进度`)},children:[h===`run:${F.id}`?a.jsx(rs,{size:13,className:"animate-spin"}):a.jsx(Bp,{size:13}),"立即运行"]})]})})]},F.id)})})]})}function cj({agents:e,sessions:t,activeSessionId:r,initial:n,onCancel:i,onSaved:l,setError:c}){const[h,p]=y.useState(n?.name??""),g=t.find(le=>le.sessionId===r),x=n?.cwd??g?.cwd??t[0]?.cwd??"",[b,w]=y.useState(x),A=y.useRef(!1),[k,E]=y.useState(!1),[I,M]=y.useState(()=>e.find(le=>le.command===n?.command)?.slug??""),[Q,j]=y.useState(n?.prompt??""),[F,V]=y.useState(n?.targetSessionId??""),[$,te]=y.useState(n?.targetSessionId?"existing":"new"),[se,qe]=y.useState(n?.schedule.kind??"interval"),[de,oe]=y.useState(n?.schedule.kind==="interval"?n.schedule.everyMinutes:60),[Oe,et]=y.useState(n?.schedule.kind==="daily"?n.schedule.time:"09:00"),[ce,Be]=y.useState(n?.schedule.kind==="daily"?n.schedule.weekdays:[1,2,3,4,5]),[ot,Ie]=y.useState(()=>n?.schedule.kind==="interval"?![15,60,1440].includes(n.schedule.everyMinutes):!!n&&!["1,2,3,4,5","0,1,2,3,4,5,6"].includes([...n.schedule.weekdays].sort().join())),[re,Ue]=y.useState(!1),[_e,K]=y.useState(n?.enabled??!0),[Le,fe]=y.useState(!1),$e=e.find(le=>le.slug===I)??null,ze=$e?.command??n?.command??"";y.useEffect(()=>{if(!I){const le=n?e.find(pe=>pe.command===n.command):e[0];le&&M(le.slug)}},[e,n,I]),y.useEffect(()=>{!n&&!A.current&&x&&w(x)},[n,x]);const Ee=h.trim()||Array.from(Q.trim().split(`
|
|
129
|
-
`)[0].trim()).slice(0,40).join(""),ee=t.find(le=>le.sessionId===F),Ke=ot?`custom-${se}`:se==="interval"?String(de):ce.length===7?"daily":"workdays",wt=le=>{Ie(le.startsWith("custom-")),["15","60","1440","custom-interval"].includes(le)?(qe("interval"),le!=="custom-interval"&&oe(Number(le))):(qe("daily"),le==="daily"&&Be([0,1,2,3,4,5,6]),le==="workdays"&&Be([1,2,3,4,5]))},tt=async()=>{if(!(Le||!ut)){fe(!0),c(null);try{await u8({id:n?.id,name:Ee,cwd:b,command:$==="new"?ze:"",prompt:Q,targetSessionId:$==="existing"&&F||null,enabled:_e,schedule:se==="interval"?{kind:se,everyMinutes:de}:{kind:se,time:Oe,weekdays:ce}}),await l(Ee,_e)}catch(le){c(le instanceof Error?le.message:"保存失败")}finally{fe(!1)}}},ge=se==="interval"?{kind:se,everyMinutes:de}:{kind:se,time:Oe,weekdays:ce},[it,ht]=Oe.split(":"),Y=(le,pe)=>et(`${le}:${pe}`),be=Q.trim()?$==="existing"&&!t.some(le=>le.sessionId===F)?"请选择当前服务的可用会话":$==="new"&&!ze?"请选择可启动的 Agent":se==="interval"&&(!Number.isInteger(de)||de<1||de>43200)?"间隔需要是 1–43200 分钟的整数":se==="daily"&&!ce.length?"至少选择一天":"":"请填写任务内容",ut=!be;return a.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 pb-3",children:[a.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:n?"编辑自动任务":"创建自动任务"}),a.jsx("button",{disabled:Le,className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground disabled:opacity-40",onClick:i,"aria-label":"关闭任务表单",children:a.jsx(Kn,{size:14})})]}),a.jsx("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-y-contain pb-4",children:a.jsxs("fieldset",{disabled:Le,className:"min-w-0 space-y-4",children:[a.jsxs("label",{className:"block space-y-1.5 text-[11px] text-muted-foreground",children:["任务内容",a.jsx("textarea",{autoFocus:!0,className:`${As} min-h-24 resize-y`,rows:3,value:Q,onChange:le=>j(le.target.value),placeholder:"例如:检查当前项目的待办,整理需要我处理的问题。"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{className:"block space-y-1.5 text-[11px] text-muted-foreground",children:["运行频率",a.jsxs("select",{className:As,value:Ke,onChange:le=>wt(le.target.value),children:[a.jsx("option",{value:"15",children:"每 15 分钟"}),a.jsx("option",{value:"60",children:"每小时"}),a.jsx("option",{value:"1440",children:"每 24 小时"}),a.jsx("option",{value:"daily",children:"每天定时"}),a.jsx("option",{value:"workdays",children:"工作日定时"}),a.jsx("option",{value:"custom-interval",children:"自定义间隔"}),a.jsx("option",{value:"custom-daily",children:"自定义星期"})]})]}),se==="interval"&&ot&&a.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:["每隔多少分钟",a.jsx("input",{className:`${As} min-w-0 flex-1`,type:"number",min:1,max:43200,value:de,onChange:le=>oe(Number(le.target.value))})]}),se==="daily"&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center rounded-lg border border-border/20 bg-surface-2 px-3 py-1.5 focus-within:border-primary/60",children:[a.jsx(bu,{size:14,className:"mr-2 shrink-0 text-primary"}),a.jsx(ix,{label:"小时",value:it,options:24,onChange:le=>Y(le,ht)}),a.jsx("span",{"aria-hidden":"true",className:"px-2 text-[16px] text-muted-foreground",children:":"}),a.jsx(ix,{label:"分钟",value:ht,options:60,onChange:le=>Y(it,le)}),a.jsx("span",{className:"ml-2 shrink-0 text-[10px] text-muted-foreground",children:"24 小时制"})]}),ot&&a.jsx("div",{className:"grid grid-cols-7 gap-1",children:["日","一","二","三","四","五","六"].map((le,pe)=>{const je=ce.includes(pe);return a.jsx("button",{type:"button","aria-pressed":je,"aria-label":`星期${le}`,className:`rounded-lg py-2.5 text-[11px] transition ${je?"bg-primary text-primary-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,onClick:()=>Be(xt=>je?xt.filter(dt=>dt!==pe):[...xt,pe].sort()),children:le},pe)})}),ce.length===0&&a.jsx("p",{className:"text-[10px] text-destructive",children:"至少选择一天"})]})]}),a.jsxs("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[a.jsxs("p",{className:"flex items-center gap-1.5",children:[a.jsx(ju,{size:13,className:"shrink-0"}),$==="new"?`每次新建会话 · ${$e?.displayName??(n?.command?"原 Agent":"暂无可用 Agent")}`:`发送到现有会话 · ${ee?.name??"目标会话不可用"}`]}),a.jsx("p",{className:"break-all pl-[19px] text-[10px]",children:$==="new"?b||"默认使用当前目录":"直接写入终端,目标会话需保持在线"})]}),a.jsxs("div",{className:"border-t border-border/15 pt-2",children:[a.jsxs("button",{type:"button","aria-expanded":re,"aria-controls":"automation-more-settings",className:`${kr} -ml-2 px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>Ue(le=>!le),children:[a.jsx(Yo,{size:13,className:`transition-transform ${re?"rotate-180":""}`}),"更多设置"]}),re&&a.jsxs("div",{id:"automation-more-settings",className:"space-y-3 pt-2",children:[a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["任务名称(可选)",a.jsx("input",{className:As,value:h,onChange:le=>p(le.target.value),placeholder:Ee||"留空则从任务内容自动生成"})]}),a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["运行方式",a.jsxs("select",{className:As,value:$,onChange:le=>{const pe=le.target.value;te(pe),pe==="existing"&&!F&&V(g?.sessionId??t[0]?.sessionId??"")},children:[a.jsx("option",{value:"new",children:"每次新建会话"}),a.jsx("option",{value:"existing",disabled:t.length===0,children:"发送到现有会话"})]})]}),$==="new"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("label",{className:"min-w-0 space-y-1 text-[10px] text-muted-foreground",children:["Agent / Plugin",a.jsxs("select",{className:As,value:I,onChange:le=>M(le.target.value),children:[n&&!e.some(le=>le.command===n.command)&&a.jsx("option",{value:"",children:"原 Agent 当前不可用"}),e.map(le=>a.jsxs("option",{value:le.slug,children:[le.displayName,le.isPlugin?" · Plugin":""]},le.slug))]})]}),a.jsxs("label",{className:"min-w-0 space-y-1 text-[10px] text-muted-foreground",children:["工作目录",a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{className:`${As} min-w-0`,value:b,onChange:le=>{A.current=!0,w(le.target.value)},placeholder:"默认使用当前目录"}),a.jsxs("button",{type:"button","aria-haspopup":"dialog",className:`${kr} shrink-0 bg-surface-2 text-foreground`,onClick:()=>E(!0),children:[a.jsx(Hc,{size:13}),"选择"]})]})]})]}),e.length===0&&a.jsx("p",{className:"text-[10px] text-destructive",children:"没有检测到可启动的 Agent。请先在 Plugin 设置中安装或配置 Agent。"})]}):a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["目标会话",a.jsxs("select",{className:As,value:F,onChange:le=>V(le.target.value),children:[!ee&&a.jsx("option",{value:F,children:F?"原目标会话不可用,请重新选择":"请选择会话"}),t.map(le=>a.jsxs("option",{value:le.sessionId,children:[le.name," · ",nh(le)]},le.sessionId))]}),a.jsx("span",{className:"block leading-relaxed",children:"仅支持当前服务的会话。运行时会直接写入终端,请确保目标会话保持在线。"})]}),a.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:_e,onChange:le=>K(le.target.checked)}),"保存后启用"]})]})]})]})}),a.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-border/15 pt-3",children:[a.jsx("p",{role:"status",className:"mr-auto min-w-0 flex-[1_1_160px] text-[10px] text-muted-foreground",children:be||(_e?`${n?"下次运行":"首次运行"}:${Eh(Cj(ge,Date.now(),n?.createdAt))}`:"保存后暂停,不会自动运行")}),a.jsx("button",{disabled:Le,className:`${kr} bg-surface-2 text-foreground`,onClick:i,children:"取消"}),a.jsx("button",{title:be||void 0,disabled:Le||!ut,className:`${kr} bg-primary text-primary-foreground`,onClick:()=>{tt()},children:Le?"保存中…":n?"保存修改":"创建任务"})]}),a.jsx(hm,{open:k,initialPath:b||x||"/",title:"选择工作目录",labels:{hint:"进入文件夹,确认后才会更改工作目录。",cancel:"取消",confirm:"使用此目录",close:"关闭",parent:"上一级目录"},onCancel:()=>E(!1),onConfirm:le=>{A.current=!0,w(le),E(!1)}})]})}function ix({label:e,value:t,options:r,onChange:n}){return a.jsxs("label",{className:"relative min-w-0 flex-1",children:[a.jsx("span",{className:"sr-only",children:e}),a.jsx("select",{"aria-label":e,className:"w-full appearance-none bg-transparent py-1 pl-1 pr-7 text-center text-[18px] font-semibold tabular-nums text-foreground outline-none",value:t,onChange:i=>n(i.target.value),children:Array.from({length:r},(i,l)=>{const c=String(l).padStart(2,"0");return a.jsx("option",{value:c,children:c},c)})}),a.jsx(Yo,{"aria-hidden":"true",size:13,className:"pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground"})]})}function uj({active:e,notice:t,initialDrafts:r,onDraftChange:n,docked:i,inputKeySuffix:l,selectedGroupId:c,setSelectedGroupId:h,floatingVisible:p,floating:g,sessionsState:x,groups:b,sessions:w,agents:A,activeSessionId:k,initialGroupId:E,onOpenSession:I,defaultSessionMode:M,busy:Q,setBusy:j,setError:F,setNotice:V,refresh:$}){const[te,se]=y.useState(""),[qe,de]=y.useState(()=>new Set(k?[k]:[])),[oe,Oe]=y.useState(""),[et,ce]=y.useState(()=>new Set),[Be,ot]=y.useState(!1),[Ie,re]=y.useState(),[Ue,_e]=y.useState([]),[K,Le]=y.useState(!1),[fe,$e]=y.useState(null),[ze,Ee]=y.useState("all"),[ee,Ke]=y.useState(!1),[wt,tt]=y.useState(new Set),[ge,it]=y.useState(null),[ht,Y]=y.useState(""),[be,ut]=y.useState(!1),[le,pe]=y.useState(!1),[je,xt]=y.useState(null),[dt,Dt]=y.useState(new Set),[Xt,Ht]=y.useState(),[Bt,Wt]=y.useState({}),[lr,ur]=y.useState(!1),[Jt,Er]=y.useState(""),[X,Re]=y.useState(""),[We,Qt]=y.useState(""),[It,ar]=y.useState(""),Ot=y.useRef(null),Fe=i,yr=(c??b[0]?.id??"")+l,He=y.useRef(!1),Se=c==="new"?null:(c?b.find(q=>q.id===c):b[0])??null,[Ve,Ct]=y.useState(0),jr=y.useRef(new Map(Object.entries(r??{}))),ft=y.useRef(void 0),Br=y.useRef(!1),Wn=y.useRef(ge);Wn.current=ge;const an=y.useRef(ht);an.current=ht,y.useLayoutEffect(()=>{if(ft.current===Se?.id)return;if(ft.current){const Ye={content:an.current,targets:ge};jr.current.set(ft.current,Ye),hl({drafts:{[ft.current]:Ye}}).catch(()=>F("草稿保存失败,请返回该组重试"))}ft.current=Se?.id,Br.current=!0;const q=jr.current.get(Se?.id??"");Y(q?.content??""),it(q?.targets??null)},[Se?.id]),y.useEffect(()=>{xt(null)},[Se?.id]);const ke=y.useRef(null),St=y.useRef(r);y.useLayoutEffect(()=>{if(St.current===r)return;St.current=r;for(const[Ye,Lt]of Object.entries(r??{}))jr.current.set(Ye,Lt);const q=r?.[Se?.id??""];!q||q.content===an.current&&JSON.stringify(q.targets)===JSON.stringify(Wn.current)||(Br.current=!0,ke.current=null,Y(q.content),it(q.targets))},[r,Se?.id]);const kt=y.useCallback(q=>{hl(q).catch(()=>F("草稿保存失败,请保持面板打开,修改内容后重试"))},[F]);y.useEffect(()=>{if(Br.current){Br.current=!1;return}if(!Se||ft.current!==Se.id)return;const q={drafts:{[Se.id]:{content:ht,targets:ge}}};n(Se.id,q.drafts[Se.id]),ke.current=q;const Ye=setTimeout(()=>{ke.current=null,kt(q)},400);return()=>{clearTimeout(Ye)}},[Se?.id,ht,ge,kt]),y.useEffect(()=>{const q=()=>{ke.current&&(kt(ke.current),ke.current=null)},Ye=()=>{document.visibilityState==="hidden"&&q()};return document.addEventListener("visibilitychange",Ye),window.addEventListener("pagehide",q),()=>{document.removeEventListener("visibilitychange",Ye),window.removeEventListener("pagehide",q),q()}},[kt]),y.useEffect(()=>{if(!(!g||!p||!Se))return n8(q=>{Y(Ye=>Ye+(Ye&&!/\s$/.test(Ye)?`
|
|
130
|
-
`:"")+q.replace(/\r\n?/g,`
|
|
131
|
-
`))},yr,Fe)},[g,p,Se?.id,Fe,yr]),y.useEffect(()=>{const q=Ot.current;if(!g||!q)return;const Ye=Lt=>F(String(Lt.detail));return q.addEventListener("termdock:file-drop-error",Ye),()=>q.removeEventListener("termdock:file-drop-error",Ye)},[g,Se?.id,F]);const ue=async q=>{const Ye=Se?.id;F(null),Ct(Lt=>Lt+1);try{const Lt=await Bu("/tmp",q);if(Lt.files.length!==q.length||Lt.files.some(Et=>!Et.path))throw new Error("文件路径准备失败,请重试");const wr=Lt.files.map(Et=>jc(Et.path)).join(" ")+" ";if(ft.current===Ye)Y(Et=>Et+(Et&&!/\s$/.test(Et)?`
|
|
132
|
-
`:"")+wr);else if(Ye){const Et=jr.current.get(Ye)??{content:"",targets:null},hr={...Et,content:Et.content+`
|
|
133
|
-
`+wr};jr.current.set(Ye,hr),kt({drafts:{[Ye]:hr}})}}catch(Lt){F(Lt instanceof Error?Lt.message:"文件上传失败")}finally{Ct(Lt=>Lt-1)}},Nr=new Set(w.filter(xp).map(q=>q.sessionId)),st=qe.size,Gt=[...qe].filter(q=>!Nr.has(q)),Ur=mj(Se,w),gn=oe.trim().toLocaleLowerCase(),Ln=w.filter(q=>!gn||[q.name,q.serviceLabel??"",q.cwd,yp(q.currentTask)].some(Ye=>Ye.toLocaleLowerCase().includes(gn))),wn=ax(Ln),sr=ax(Ur),yn=q=>!gn&&et.has(q),Ts=q=>ce(Ye=>{const Lt=new Set(Ye);return Lt.has(q)?Lt.delete(q):Lt.add(q),Lt});y.useEffect(()=>{ut(!1),pe(!1),ur(!1),ot(!1),Wt({});try{tt(new Set(JSON.parse(localStorage.getItem(`collab-seen:${Se?.id}`)??"[]")))}catch{tt(new Set)}Dt(new Set(Se?.sessionIds??[]))},[Se?.id]),y.useEffect(()=>{!Jt&&A[0]&&Er(A[0].slug)},[A,Jt]),y.useEffect(()=>{_e([]),$e(null)},[Se?.id]),y.useEffect(()=>{if(!e||g&&!p||!Se){Le(!1);return}Le(!0);let q=!1,Ye=0;const Lt=()=>{const Et=++Ye;zm(Se.id).then(hr=>{!q&&Et===Ye&&(_e(hr.messages),$e(null))}).catch(hr=>{!q&&Et===Ye&&$e(hr instanceof Error?hr.message:"消息加载失败")}).finally(()=>{!q&&Et===Ye&&Le(!1)})};Lt();const wr=window.setInterval(Lt,3e3);return()=>{q=!0,window.clearInterval(wr)}},[Se?.id,e,g,p]),y.useEffect(()=>{!E||Se?.id!==E||He.current||(He.current=!0,Ot.current?.scrollIntoView?.({block:"nearest"}))},[E,Se?.id]);const Xr=async()=>{j("create-group"),F(null),V(null);try{if(Gt.length)throw new Error("所选会话已变化,请先清除不可用选择");const q=await ac({name:te,sessionIds:[...qe]});se(""),Oe(""),h(q.group.id),await $(),V(`“${q.group.name}”已创建,${q.group.sessionIds.length} 个会话可以开始协作`)}catch(q){F(q instanceof Error?q.message:"创建失败")}finally{j(null)}},Wr=Se?.sessionIds.filter(q=>ge===null||ge.includes(q))??[],on=async()=>{if(!Se||Q||Ve||!ht.trim()||!Wr.length)return;const q=ht,Ye=Se.id;j("send-message"),F(null),V(null);try{const Lt=await a8(Se.id,{fromSessionId:null,toSessionIds:ge===null?void 0:Wr,kind:"message",content:ht});if(ft.current===Ye){const Sr=an.current,Ir=Sr===q?"":Sr.startsWith(q)?Sr.slice(q.length).replace(/^\n/,""):Sr;Y(Ir),kt({drafts:{[Ye]:{content:Ir,targets:Wn.current}}})}else{const Sr=jr.current.get(Ye);if(Sr){const Ir={...Sr,content:Sr.content===q?"":Sr.content.startsWith(q)?Sr.content.slice(q.length).replace(/^\n/,""):Sr.content};jr.current.set(Ye,Ir),kt({drafts:{[Ye]:Ir}})}}const wr=await zm(Ye).catch(()=>null);wr&&ft.current===Ye&&_e(wr.messages);const Et=Lt.deliveries?.filter(Sr=>Sr.serviceUnavailable).length??0,hr=Lt.deliveries?.filter(Sr=>Sr.pending>0).length??0;V(Et>0?`已保存消息;${Et} 个接收成员的服务不可达,尚未送达,等待重连`:hr>0?`已保存消息;${hr} 个成员等待投递确认`:`消息已送达 ${Lt.messages.length} 个会话`)}catch(Lt){F(Lt instanceof Error?Lt.message:"发送失败")}finally{j(null)}},An=async()=>{if(!Se)return;j(`delete:${Se.id}`),F(null),V(null);const q=Se.name;try{await Dp(Se.id,Ie),h(null),ot(!1),await $(),V(`“${q}”已删除`)}catch(Ye){F(Ye instanceof Error?Ye.message:"删除失败")}finally{j(null)}},jn=async()=>{if(!Se)return;const q=[...dt];j("save-members"),F(null),V(null);try{const Ye=await ac({id:Se.id,name:Se.name,sessionIds:q,expectedUpdatedAt:Xt});h(Ye.group.id),ut(!1),await $(),V(`“${Se.name}”成员已更新,共 ${q.length} 个会话`)}catch(Ye){F(Ye instanceof Error?Ye.message:"成员更新失败")}finally{j(null)}},Gn=async q=>{if(!Se||!Se.sessionIds.includes(q)){xt(null);return}const Ye=w.find(Et=>Et.sessionId===q)?.name??q,Lt=Se.name,wr=Se.sessionIds.length<=2;j(`remove-member:${q}`),F(null),V(null);try{wr?await Dp(Se.id,Se.updatedAt):await ac({id:Se.id,name:Lt,sessionIds:Se.sessionIds.filter(Et=>Et!==q),expectedUpdatedAt:Se.updatedAt}),xt(null),Dt(Et=>new Set([...Et].filter(hr=>hr!==q))),Wt(Et=>Object.fromEntries(Object.entries(Et).filter(([hr])=>hr!==q))),wr&&h(null),await $(),V(wr?`“${Lt}”已删除:移出“${Ye}”后不足两个成员`:`已把“${Ye}”移出“${Lt}”`)}catch(Et){F(Et instanceof Error?Et.message:wr?"删除协作组失败":"移出成员失败")}finally{j(null)}},Pn=async q=>{if(!Se)return;const Ye=Bt[q]??"";j(`role:${q}`),F(null),V(null);try{await h8(Se.id,q,Ye.trim()||null),await $(),V(Ye.trim()?"定位已保存,该成员每次收到消息都会看到":"定位已清除")}catch(Lt){F(Lt instanceof Error?Lt.message:"定位保存失败")}finally{j(null)}},hn=()=>{const q=w.find(Ye=>Ye.sessionId===k)?.cwd??w.find(Ye=>Se?.sessionIds.includes(Ye.sessionId))?.cwd??"";Qt(q),Re(""),ar(""),ur(!0),ut(!1)},kn=async()=>{if(!(!Se||!Jt)){j("spawn-agent"),F(null),V(null);try{const q=await o8(Se.id,{agentSlug:Jt,name:X.trim()||void 0,cwd:We.trim()||void 0,task:It.trim()||void 0,mode:M});ur(!1),await $(),V(`“${q.session.name}”已创建并加入“${q.group.name}”`)}catch(q){F(q instanceof Error?q.message:"Agent Session 创建失败")}finally{j(null)}}},Tn=Ue.filter(q=>(!ee||!wt.has(q.id))&&(ze==="all"||q.responseKind===ze)),rn=yj(Tn,w),Dr=()=>{const q=new Set([...wt,...Tn.map(Ye=>Ye.id)].slice(-1e4));try{localStorage.setItem(`collab-seen:${Se?.id}`,JSON.stringify([...q]))}catch{F("无法保存已看记录,请检查浏览器存储空间");return}tt(q)},ns=q=>a.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-2 py-2.5 transition hover:bg-surface-2",children:[a.jsx("input",{className:"mt-0.5",type:"checkbox",disabled:!xp(q),checked:qe.has(q.sessionId),onChange:()=>de(Ye=>{const Lt=new Set(Ye);return Lt.has(q.sessionId)?Lt.delete(q.sessionId):Lt.add(q.sessionId),Lt})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"truncate text-[12px] text-foreground",children:q.name}),a.jsx(bp,{session:q}),a.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:nh(q)})]}),a.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:q.currentTask?`${yp(q.currentTask)} · ${q.cwd}`:q.cwd||q.capability||"终端会话"})]})]},q.sessionId),Mt=q=>{const Ye=Bt[q.sessionId]??"",Lt=Se?.roles?.[q.sessionId]??"";return a.jsxs("div",{className:"px-2 py-2 transition hover:bg-surface-2",children:[a.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[a.jsx("input",{type:"checkbox",disabled:!Se?.sessionIds.includes(q.sessionId)&&!xp(q),checked:dt.has(q.sessionId),onChange:()=>Dt(wr=>{const Et=new Set(wr);return Et.has(q.sessionId)?Et.delete(q.sessionId):Et.add(q.sessionId),Et})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-[11px] text-foreground",children:q.name}),a.jsx(bp,{session:q}),a.jsxs("span",{className:"block truncate text-[9px] text-muted-foreground",children:[nh(q)," · ",q.cwd]})]})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-2 pl-7",children:[a.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:"定位"}),a.jsx("input",{"aria-label":`${q.name} 的定位`,className:`${As} min-h-8 py-1 text-[10px]`,value:Ye,maxLength:200,placeholder:"成员收到的定位;清空后保存可移除",onChange:wr=>Wt(Et=>({...Et,[q.sessionId]:wr.target.value}))}),a.jsx("button",{"aria-label":`保存 ${q.name} 的定位`,title:Ye.trim()===Lt?"定位未变化":"保存此成员的定位",disabled:Q!==null||Ye.trim()===Lt,className:`${kr} min-h-8 shrink-0 px-2 text-muted-foreground`,onClick:()=>{Pn(q.sessionId)},children:Q===`role:${q.sessionId}`?a.jsx(rs,{size:12,className:"animate-spin"}):a.jsx(ua,{size:12})})]})]},q.sessionId)};return a.jsxs("div",{className:g?"space-y-0":"space-y-5",children:[fe&&a.jsxs("p",{role:"alert",className:"mb-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:["消息同步暂时失败,正在自动重试:",fe]}),a.jsxs("div",{hidden:g,children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"会话协作"}),a.jsx("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-muted-foreground",children:"给单个成员或全组发消息,查看交接记录与明确回复。"})]}),Se&&a.jsxs("div",{className:"flex shrink-0 flex-wrap justify-end gap-1",children:[a.jsxs("button",{type:"button","aria-expanded":le,className:`${kr} bg-surface-2 text-foreground`,onClick:()=>{pe(q=>!q),F(null),V(null)},children:[a.jsx(Mp,{size:13}),"组设置"]}),a.jsxs("button",{className:`${kr} bg-primary text-primary-foreground`,onClick:()=>{h("new"),ot(!1),V(null)},children:[a.jsx(wi,{size:13}),"新建组"]})]})]}),b.length>4&&a.jsxs("label",{className:"mt-3 block space-y-1 text-[10px] text-muted-foreground",children:["选择协作组",a.jsxs("select",{className:As,value:Se?.id??"new",onChange:q=>h(q.target.value),children:[!Se&&a.jsx("option",{value:"new",children:"正在创建新协作组"}),b.map(q=>a.jsxs("option",{value:q.id,children:[q.name," · ",q.sessionIds.length," 个成员"]},q.id))]})]}),b.length>0&&b.length<=4&&a.jsx("div",{className:"mt-3 flex gap-2 overflow-x-auto border-b border-border/15 pb-3",children:b.map(q=>a.jsxs("button",{"aria-pressed":Se?.id===q.id,onClick:()=>h(q.id),className:`${kr} shrink-0 ${Se?.id===q.id?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground"}`,children:[q.name,a.jsx("span",{className:"text-[9px] opacity-70",children:q.sessionIds.length})]},q.id))}),le&&Se&&a.jsx(dj,{group:Se,activeSessionId:k,sessions:w,busy:Q,setBusy:j,setError:F,setNotice:V,refresh:$,onClose:()=>pe(!1)},Se.id),!Se&&a.jsxs("section",{className:"border-y border-border/15 py-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-[12px] font-medium text-foreground",children:"创建协作组"}),a.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-muted-foreground",children:"至少选择两个会话。离线成员会在重新上线后收到消息;成员发生变化时会提示你重新选择。"})]}),a.jsxs("span",{className:`shrink-0 text-[10px] ${st>=2?"text-primary":"text-muted-foreground"}`,children:["已选 ",st," 个"]})]}),a.jsxs("label",{className:"mt-4 block space-y-1 text-[10px] text-muted-foreground",children:["协作组名称",a.jsx("input",{className:As,value:te,onChange:q=>se(q.target.value),placeholder:"例如:发布准备"})]}),w.length>5&&a.jsxs("label",{className:"relative mt-3 block",children:[a.jsx("span",{className:"sr-only",children:"筛选会话"}),a.jsx(Mh,{size:13,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{className:`${As} pl-8`,value:oe,onChange:q=>Oe(q.target.value),placeholder:"按名称、目录或当前任务筛选"})]}),a.jsxs("div",{className:"mt-3 max-h-64 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:[wn.length<=1?Ln.map(ns):wn.map(q=>{const Ye=yn(q.key);return a.jsxs("div",{children:[a.jsx(ox,{label:q.label,count:q.sessions.length,collapsed:Ye,onToggle:()=>Ts(q.key)}),!Ye&&a.jsx("div",{className:"divide-y divide-border/10",children:q.sessions.map(ns)})]},q.key)}),w.length===0&&a.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:x==="loading"?"正在加载会话…":x==="error"?"会话加载失败,请重试":"先从会话侧栏启动至少两个会话,再回来创建协作组"}),w.length>0&&Ln.length===0&&a.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:"没有符合筛选条件的会话"})]}),Gt.length>0&&a.jsxs("div",{role:"alert",className:"mt-2 text-[11px] text-destructive",children:["有 ",Gt.length," 个所选会话暂不可用。",a.jsx("button",{className:kr,onClick:()=>de(q=>new Set([...q].filter(Ye=>Nr.has(Ye)))),children:"清除不可用选择"})]}),a.jsxs("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row sm:items-center",children:[a.jsx("p",{className:`min-w-0 flex-1 text-[10px] ${st<2?"text-muted-foreground":"text-primary"}`,children:st<2?`还需选择 ${2-st} 个会话`:te.trim()?"成员已满足要求,可以创建":"请填写协作组名称"}),a.jsxs("div",{className:"flex justify-end gap-2",children:[b.length>0&&a.jsx("button",{className:`${kr} bg-surface-2 text-foreground`,onClick:()=>h(b[0]?.id??null),children:"取消"}),a.jsxs("button",{disabled:Q!==null||x!=="loaded"||!te.trim()||st<2||Gt.length>0,className:`${kr} bg-primary text-primary-foreground`,onClick:()=>{Xr()},children:[Q==="create-group"?a.jsx(rs,{size:13,className:"animate-spin"}):a.jsx(wi,{size:13}),"创建协作组"]})]})]})]})]}),Se&&a.jsxs(a.Fragment,{children:[a.jsxs("section",{onFocusCapture:()=>Um(yr),onPointerDownCapture:()=>Um(yr),"data-termdock-terminal-dropzone":g?k??"collaboration-composer":void 0,onDragOver:q=>{g&&q.preventDefault()},onDrop:q=>{if(!g)return;const Ye=Array.from(q.dataTransfer.files);if(!(Ye.length&&So()))if(q.preventDefault(),q.stopPropagation(),Ye.length)ue(Ye);else{const Lt=q.dataTransfer.getData("text/plain")||q.dataTransfer.getData("text/uri-list");Lt&&Y(wr=>wr+(wr?`
|
|
134
|
-
`:"")+Lt)}},ref:Ot,className:g?"":"rounded-xl border border-primary/20 bg-primary/5 px-3 py-3",children:[!g&&a.jsxs("h4",{className:"truncate text-[12px] font-medium text-foreground",children:[Se.name," · 发送给成员"]}),a.jsx("div",{className:g?"space-y-2":"mt-2 space-y-2",children:a.jsxs("fieldset",{className:"min-w-0",children:[a.jsx("legend",{className:"mb-1 text-[10px] text-muted-foreground",children:"接收人(可多选)"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:[{id:"*",label:"全组成员"},...Se.sessionIds.map(q=>({id:q,label:ny(w.find(Ye=>Ye.sessionId===q),w.filter(Ye=>Se.sessionIds.includes(Ye.sessionId)))??`${q.slice(0,8)}(离线)`}))].map(({id:q,label:Ye})=>{const Lt=q==="*"?ge===null:ge?.includes(q)??!1,wr=w.find(Et=>Et.sessionId===q);return a.jsxs("span",{className:"inline-flex max-w-full items-center gap-0.5",children:[a.jsxs("button",{type:"button","aria-pressed":Lt,onClick:()=>it(Et=>q==="*"?null:Et?.includes(q)?Et.filter(hr=>hr!==q):[...Et??[],q]),className:`${w1} min-h-9 min-w-0 gap-1 sm:min-h-7 ${Lt?"border-primary/40 bg-primary/15 text-primary":"border-border/20 bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[Lt&&a.jsx(ua,{size:12,"aria-hidden":"true",className:"shrink-0"}),a.jsx("span",{className:"break-words text-left",children:Ye})]}),wr&&a.jsx("button",{type:"button","aria-label":`打开 ${Ye} 的终端`,title:`打开 ${Ye} 的终端`,className:"inline-flex h-9 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-surface-2 hover:text-primary sm:h-7 sm:w-6",onClick:()=>{I(wr).catch(Et=>F(Et instanceof Error?Et.message:"无法打开会话"))},children:a.jsx(Rh,{size:12})})]},q)})})]})}),a.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["内容",a.jsx("textarea",{onKeyDown:q=>{q.key==="Enter"&&(q.metaKey||q.ctrlKey)&&!q.nativeEvent.isComposing&&q.keyCode!==229&&(q.preventDefault(),on())},onPaste:q=>{const Ye=Array.from(q.clipboardData.files);Ye.length&&(q.preventDefault(),ue(Ye))},className:`${As} min-h-16 max-h-48 resize-y`,value:ht,onChange:q=>Y(q.target.value),placeholder:"输入消息,可粘贴引用或文件…"})]}),a.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3",children:[a.jsx("p",{role:"status","aria-live":"polite",title:g&&t?t:void 0,className:`min-w-0 flex-1 text-[9px] leading-relaxed ${g?"truncate":""} ${g&&t?"text-primary":"text-muted-foreground"}`,children:Ve>0?"正在准备文件路径…":g&&t?t:Se.federated?"消息由服务端后台投递,可查看送达结果;无需保持客户端在线。":"在线成员立即入队;离线成员上线后送达。"}),a.jsxs("button",{disabled:Q!==null||Ve>0||!ht.trim()||!Wr.length,className:`${kr} shrink-0 bg-primary text-primary-foreground`,title:"发送(⌘ / Ctrl + Enter)",onClick:()=>{on()},children:[Q==="send-message"?a.jsx(rs,{size:13,className:"animate-spin"}):null,"发送"]})]})]}),a.jsxs("div",{hidden:g,children:[a.jsxs("details",{className:"mt-4 rounded-xl border border-border/15",children:[a.jsxs("summary",{className:"cursor-pointer px-3 py-3 text-[11px] font-medium text-foreground",children:["管理成员、角色与删除 · ",Se.sessionIds.length," 个成员"]}),a.jsxs("section",{className:"border-t border-border/15 p-3",children:[a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h4",{className:"text-[13px] font-medium text-foreground",children:Se.name}),a.jsxs("p",{className:"mt-1 text-[10px] text-muted-foreground",children:[Se.sessionIds.length," 个成员 · 组 ID:",a.jsx("span",{className:"break-all font-mono",children:aj(Se.id)})]})]}),Be?a.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[a.jsx("button",{className:`${kr} bg-surface-2 px-2 text-foreground`,onClick:()=>ot(!1),children:"取消"}),a.jsxs("button",{disabled:Q!==null,className:`${kr} bg-destructive px-2 text-destructive-foreground`,onClick:()=>{An()},children:[Q===`delete:${Se.id}`?a.jsx(rs,{size:13,className:"animate-spin"}):null,"确认删除"]})]}):a.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[a.jsxs("button",{className:`${kr} px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>{Dt(new Set(Se.sessionIds)),Ht(Se.updatedAt);const q=!be;ut(q),q&&Wt(Object.fromEntries(Se.sessionIds.map(Ye=>[Ye,Se.roles?.[Ye]??""]))),ur(!1)},children:[a.jsx(Mp,{size:13}),"管理成员"]}),a.jsxs("button",{className:`${kr} px-2 text-primary hover:bg-primary/10`,onClick:hn,children:[a.jsx(wi,{size:13}),"新建 Agent"]}),a.jsx("button",{"aria-label":`删除协作组 ${Se.name}`,title:"删除协作组",disabled:Q!==null,className:"rounded-lg p-2 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",onClick:()=>{re(Se.updatedAt),ot(!0)},children:a.jsx(ri,{size:14})})]})]}),Be&&a.jsxs("p",{role:"alert",className:"mt-2 rounded-lg bg-destructive/10 px-3 py-2 text-[10px] leading-relaxed text-destructive",children:["将删除“",Se.name,"”协作组及其协作记录,",Se.sessionIds.length," 个成员的终端会话会保留。"]}),a.jsx("div",{className:"mt-3 grid divide-y divide-border/10 border-y border-border/10 sm:grid-cols-2 sm:divide-x sm:divide-y-0",children:Se.sessionIds.map(q=>{const Ye=w.find(hr=>hr.sessionId===q),Lt=Se.roles?.[q],wr=Ye?.name??q,Et=Se.sessionIds.length<=2;return a.jsxs("div",{className:`flex min-w-0 items-stretch transition ${je===q?"bg-destructive/5":"hover:bg-surface-2"}`,children:[a.jsxs("button",{disabled:!Ye,onClick:()=>Ye&&void I(Ye).catch(hr=>F(hr instanceof Error?hr.message:"无法打开会话")),className:"min-w-0 flex-1 px-3 py-2.5 text-left disabled:cursor-default",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${Ye&&["ready","shell","service-reachable","working","idle","done"].includes(Ye.status)&&Ye.serviceConnected!==!1?"bg-[var(--success)]":"bg-muted-foreground"}`}),a.jsx("span",{className:"truncate text-[11px] text-foreground",children:wr}),Ye&&a.jsx(bp,{session:Ye}),a.jsx("span",{className:"ml-auto shrink-0 text-[9px] text-muted-foreground",children:Ye?nh(Ye):"已离线"})]}),a.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-1 text-[9px] text-muted-foreground",children:[Lt?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"min-w-0 truncate font-medium text-primary/80",children:["定位:",Lt]}),a.jsx("span",{className:"shrink-0 text-muted-foreground/50",children:"·"})]}):null,Ye?a.jsx("span",{className:"min-w-0 truncate",children:yp(Ye.currentTask)}):a.jsx("span",{className:"shrink-0",children:"重新上线后可继续接收消息"})]})]}),a.jsx("button",{"aria-label":`把 ${wr} 移出协作组`,"aria-expanded":je===q,title:Et?"移出后不足两个成员,将删除协作组":"移出协作组",disabled:Q!==null,className:`mr-1 shrink-0 self-center rounded-lg p-2 transition ${je===q?"text-destructive":"text-muted-foreground hover:bg-destructive/10 hover:text-destructive"}`,onClick:()=>xt(je===q?null:q),children:a.jsx(ri,{size:13})})]},q)})}),je&&Se.sessionIds.includes(je)&&(()=>{const q=w.find(wr=>wr.sessionId===je)?.name??je,Ye=Se.sessionIds.length<=2,Lt=Q===`remove-member:${je}`;return a.jsxs("div",{role:"group","aria-label":`确认移除成员 ${q}`,className:"flex flex-wrap items-center gap-x-3 gap-y-2 border-y border-destructive/25 bg-destructive/5 px-3 py-2.5",children:[a.jsx("p",{className:"min-w-0 flex-1 text-[10px] leading-relaxed text-destructive",children:Ye?`移出“${q}”后组内不足两个成员,协作组“${Se.name}”和它的 ${Ue.length} 条协作记录会一并删除`:`把“${q}”移出“${Se.name}”?移出后它不再收到这个组的消息,可以随时重新加入`}),a.jsxs("div",{className:"flex shrink-0 gap-2",children:[a.jsx("button",{className:`${kr} min-h-8 bg-surface-2 px-2 text-[10px] text-foreground`,onClick:()=>xt(null),children:"取消"}),a.jsxs("button",{disabled:Q!==null,className:`${kr} min-h-8 px-2 text-[10px] bg-destructive text-destructive-foreground`,onClick:()=>{Gn(je)},children:[Lt?a.jsx(rs,{size:12,className:"animate-spin"}):a.jsx(ri,{size:12}),Ye?"删除协作组":"移出"]})]})]})})(),be&&a.jsxs("div",{className:"mt-4 border-t border-border/15 pt-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h5",{className:"text-[11px] font-medium text-foreground",children:"管理成员"}),a.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:"暂不可用的原成员会保留,只有取消勾选才会移出;定位(角色)在每行独立保存,成员收到消息时会看到自己的定位。"})]}),a.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["已选 ",dt.size]})]}),a.jsx("div",{className:"mt-3 max-h-72 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:sr.length<=1?Ur.map(Mt):sr.map(q=>{const Ye=yn(q.key);return a.jsxs("div",{children:[a.jsx(ox,{label:q.label,count:q.sessions.length,collapsed:Ye,onToggle:()=>Ts(q.key)}),!Ye&&a.jsx("div",{className:"divide-y divide-border/10",children:q.sessions.map(Mt)})]},q.key)})}),a.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[a.jsx("button",{className:`${kr} bg-surface-2 text-foreground`,onClick:()=>{ut(!1),Wt({})},children:"取消"}),a.jsxs("button",{disabled:Q!==null||x!=="loaded"||dt.size<2,className:`${kr} bg-primary text-primary-foreground`,onClick:()=>{jn()},children:[Q==="save-members"?a.jsx(rs,{size:13,className:"animate-spin"}):a.jsx(ua,{size:13}),"保存成员"]})]})]}),lr&&a.jsxs("div",{className:"mt-4 border-t border-primary/20 pt-4",children:[a.jsxs("div",{children:[a.jsx("h5",{className:"text-[11px] font-medium text-foreground",children:"创建 Agent Session"}),a.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:"新会话启动后自动加入本组,并收到初始任务和成员信息。"})]}),a.jsxs("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[a.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["Agent / Plugin",a.jsx("select",{"aria-label":"新 Agent 类型",className:As,value:Jt,onChange:q=>Er(q.target.value),children:A.map(q=>a.jsxs("option",{value:q.slug,children:[q.displayName,q.isPlugin?" · Plugin":""]},q.slug))})]}),a.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["会话名称",a.jsx("input",{"aria-label":"新 Agent 会话名称",className:As,value:X,onChange:q=>Re(q.target.value),placeholder:"留空则自动命名"})]})]}),a.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["工作目录",a.jsx("input",{"aria-label":"新 Agent 工作目录",className:As,value:We,onChange:q=>Qt(q.target.value),placeholder:"默认继承当前会话"})]}),a.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["初始任务",a.jsx("textarea",{"aria-label":"新 Agent 初始任务",className:`${As} min-h-16 resize-y`,value:It,onChange:q=>ar(q.target.value),placeholder:"说明它加入后要先完成什么"})]}),a.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[a.jsx("button",{className:`${kr} bg-surface-2 text-foreground`,onClick:()=>ur(!1),children:"取消"}),a.jsxs("button",{disabled:Q!==null||!Jt,className:`${kr} bg-primary text-primary-foreground`,onClick:()=>{kn()},children:[Q==="spawn-agent"?a.jsx(rs,{size:13,className:"animate-spin"}):a.jsx(ju,{size:13}),"创建并加入"]})]})]})]})]},Se.id),a.jsxs("section",{className:"mt-4",children:[a.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[a.jsx("h4",{className:"text-[11px] font-medium text-foreground",children:"协作记录"}),a.jsxs("span",{className:"text-[9px] text-muted-foreground",children:[rn.length," 条"]})]}),a.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[a.jsxs("select",{"aria-label":"筛选回复类型",className:`${As} w-auto`,value:ze,onChange:q=>Ee(q.target.value),children:[a.jsx("option",{value:"all",children:"全部类型"}),a.jsx("option",{value:"ack",children:"收到确认"}),a.jsx("option",{value:"progress",children:"进展"}),a.jsx("option",{value:"result",children:"结果与证据"})]}),a.jsxs("label",{className:"flex min-h-9 items-center gap-2 text-[11px] text-muted-foreground",children:[a.jsx("input",{type:"checkbox",checked:ee,onChange:q=>Ke(q.target.checked)}),"只看新记录"]}),a.jsx("button",{className:`${kr} min-h-9 text-muted-foreground`,disabled:!Tn.length,onClick:Dr,children:"标记当前记录已看"})]}),a.jsxs("div",{className:"divide-y divide-border/10 border-y border-border/10 [overflow-wrap:anywhere]",children:[rn.map(q=>a.jsxs("div",{className:"px-2 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[9px] text-muted-foreground",children:[a.jsx("span",{className:"font-medium text-primary",children:q.responseKind==="ack"?"收到确认":q.responseKind==="progress"?"进展":q.responseKind==="result"?"结果":bj(q.kind)}),a.jsx("span",{children:q.fromName}),a.jsx("span",{children:"→"}),a.jsx("span",{className:"truncate",children:q.toNames.join("、")}),a.jsx("span",{className:"ml-auto shrink-0",children:new Date(q.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),a.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[11px] leading-relaxed text-foreground",children:q.content}),a.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:q.status==="pending"?"已入队 · 等待投递":q.status==="failed"?"投递失败":q.status==="expired"?"消息已过期,未继续投递":"已写入接收方终端 · 等待接手确认"}),(q.task||q.failureReason)&&a.jsxs("details",{className:"mt-2 text-[10px] text-muted-foreground",children:[a.jsx("summary",{className:"cursor-pointer",children:"任务详情与证据"}),a.jsx("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap break-words",children:JSON.stringify(q.task??{failure_reason:q.failureReason},null,2)})]})]},q.key)),rn.length===0&&a.jsx(Lj,{text:K?"正在加载协作记录…":Ue.length?"没有符合筛选条件的新记录。可切换类型或取消“只看新记录”。":"还没有消息。可以先发一个任务或问题。"})]})]})]})]})]})}function dj({group:e,activeSessionId:t,sessions:r,busy:n,setBusy:i,setError:l,setNotice:c,refresh:h,onClose:p}){const[g,x]=y.useState(e),[b,w]=y.useState(e.name),[A,k]=y.useState(e.instructions?.text??""),[E,I]=y.useState(e.instructions?.version??""),[M,Q]=y.useState(e.instructions?.text??""),j=r.filter(oe=>e.sessionIds.includes(oe.sessionId)&&!Qu(oe.sessionId)),[F,V]=y.useState(()=>t&&j.some(oe=>oe.sessionId===t)?t:""),$=new TextEncoder().encode(A).length,te=j.some(oe=>oe.sessionId===F),se=async()=>{if(!(n||!b.trim())){i("group-name"),l(null),c(null);try{const oe=await ac({id:g.id,name:b.trim(),sessionIds:g.sessionIds,expectedUpdatedAt:g.updatedAt});x(oe.group),w(oe.group.name),A===M&&(k(oe.group.instructions?.text??""),Q(oe.group.instructions?.text??""),I(oe.group.instructions?.version??"")),await h(),c("协作组名称已更新")}catch(oe){l(oe instanceof Error?oe.message:"改名失败")}finally{i(null)}}},qe=async()=>{if(!(n||!te||$>8192)){i("group-rules"),l(null),c(null);try{const oe=await d8(g.id,{sessionId:F,text:A,expectedVersion:E});b===g.name&&w(oe.group.name),x(oe.group),Q(oe.group.instructions?.text??""),I(oe.group.instructions?.version??""),await h(),c(A.trim()?"群规已保存,变更通知已入队":"群规已清空,变更通知已入队")}catch(oe){l(oe instanceof Error?oe.message:"群规保存失败")}finally{i(null)}}},de=()=>{x(e),w(e.name),k(e.instructions?.text??""),Q(e.instructions?.text??""),I(e.instructions?.version??""),l(null)};return a.jsxs("section",{"aria-label":"协作组设置",className:"mt-3 rounded-xl border border-border/20 bg-surface-2 p-3",children:[a.jsxs("div",{className:"mb-3 flex items-center justify-between gap-2",children:[a.jsx("h4",{className:"text-[12px] font-medium text-foreground",children:"组设置"}),a.jsx("button",{type:"button",disabled:!!n,"aria-label":"关闭组设置",className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-elevated",onClick:p,children:a.jsx(Kn,{size:14})})]}),a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["协作组名称",a.jsx("input",{autoFocus:!0,className:As,value:b,maxLength:240,disabled:!!n,onChange:oe=>w(oe.target.value)})]}),a.jsx("div",{className:"mt-2 flex justify-end",children:a.jsx("button",{type:"button",disabled:!!n||!b.trim()||b.trim()===g.name,className:`${kr} min-h-9 bg-primary text-primary-foreground`,onClick:()=>{se()},children:n==="group-name"?"保存中…":"保存名称"})}),a.jsxs("div",{className:"mt-3 space-y-2 border-t border-border/15 pt-3",children:[a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["由本组成员发布群规变更",a.jsxs("select",{className:As,value:F,disabled:!!n||!j.length,onChange:oe=>V(oe.target.value),children:[a.jsx("option",{value:"",children:"选择当前服务的一个成员"}),!j.some(oe=>oe.sessionId===F)&&F&&a.jsx("option",{value:F,children:"原成员已不在组内,请重新选择"}),j.map(oe=>a.jsx("option",{value:oe.sessionId,children:oe.name},oe.sessionId))]})]}),a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["群规与协作约定",a.jsx("textarea",{className:`${As} min-h-24 resize-y`,value:A,maxLength:8192,disabled:!!n,onChange:oe=>k(oe.target.value),placeholder:"例如:说明分工、交接要求和结果格式。清空后保存可移除群规。"})]})]}),!te&&a.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:j.length?"选择发布变更的成员后即可保存,不需要关闭工作台。":"当前服务没有本组成员,请先添加成员或切换到成员所在的服务。已有群规可在此查看。"}),a.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[a.jsx("p",{className:`text-[9px] ${$>8192?"text-destructive":"text-muted-foreground"}`,children:$>8192?"内容过长,请缩短群规":"保存或清空群规会通知本组其他成员"}),a.jsx("button",{type:"button",disabled:!!n||!te||$>8192||A===M,className:`${kr} min-h-9 shrink-0 bg-primary text-primary-foreground`,onClick:()=>{qe()},children:n==="group-rules"?"保存中…":A.trim()?"保存群规":"清空群规"})]}),a.jsxs("div",{className:"mt-3 flex justify-between gap-2 border-t border-border/15 pt-2",children:[a.jsxs("button",{type:"button",disabled:!!n,className:`${kr} min-h-9 text-muted-foreground hover:bg-surface-elevated`,onClick:de,children:[a.jsx(rs,{size:12}),"重新载入",(b!==g.name||A!==M)&&"(放弃草稿)"]}),a.jsx("button",{type:"button",disabled:!!n,className:`${kr} min-h-9 bg-surface text-foreground`,onClick:p,children:"完成"})]})]})}function hj({peers:e,currentGroupId:t,busy:r,setBusy:n,setError:i,setNotice:l,onSelectGroup:c}){const[h,p]=y.useState(null),[g,x]=y.useState(!1),b=e.services??[],w=e.removedServices??[],A=b.filter(I=>!I.connected),k=A.some(I=>I.groups?.some(M=>M.id===t)),E=async(I,M)=>{if(!r){n(`peer:${I}`),i(null),l(null);try{M?await s8(I):await i8(I),p(null),x(!1),l(M?"协作连接已恢复,正在连接服务":"协作连接已移除,不会再自动重连;已有会话和消息保留")}catch(Q){i(Q instanceof Error?Q.message:M?"重新连接失败":"移除连接失败")}finally{n(null)}}};return a.jsxs("details",{className:"mx-4 mt-3 shrink-0 rounded-lg border border-border/15",open:k||void 0,children:[a.jsxs("summary",{className:"cursor-pointer px-3 py-2.5 text-[11px] text-muted-foreground",children:[a.jsx("span",{className:"font-medium text-foreground",children:"协作连接与管理"}),a.jsx("span",{className:"ml-2",children:e.state==="loading"?"正在加载…":`${b.length-A.length} 个已连接${A.length?` · ${A.length} 个离线`:""}`})]}),a.jsxs("div",{className:"max-h-64 overflow-y-auto border-t border-border/15 px-3 py-2",children:[b.length>0&&a.jsx("p",{className:"mb-1 text-[10px] leading-relaxed text-muted-foreground",children:"与以下服务进行跨服务协作,名称与服务切换器一致。"}),A.length>0&&a.jsx("p",{className:"mb-2 text-[10px] leading-relaxed text-muted-foreground",children:k?"当前协作组的部分服务不可达,消息会保留并等待重连。":"其他服务暂时离线;当前服务内的协作可以继续。不再使用的连接可移除。"}),e.error&&a.jsx("p",{role:"status",className:"mb-2 break-words text-[10px] text-destructive",children:e.error}),e.state==="unsupported"&&a.jsx("p",{className:"mb-2 text-[10px] text-muted-foreground",children:"请更新客户端以管理跨服务连接。"}),a.jsx("div",{className:"divide-y divide-border/10",children:b.map(I=>a.jsxs("div",{className:"py-2.5",children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("p",{className:"text-[11px] text-foreground",children:[Ol({serviceLabel:I.label,serviceOrigin:I.origin}),a.jsx("span",{className:`ml-2 text-[9px] ${I.connected?"text-[var(--success)]":"text-muted-foreground"}`,children:I.connected?"已连接":I.error==="CONNECTING"?"连接中":"暂时离线"})]}),a.jsx(fj,{service:I})]}),I.serviceId&&a.jsxs("button",{type:"button",disabled:!!r,"aria-label":`移除协作连接 ${I.origin}`,className:`${kr} min-h-9 shrink-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,onClick:()=>p(h===I.serviceId?null:I.serviceId),children:[a.jsx(ri,{size:12}),"移除"]})]}),!!I.groups?.length&&a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1 text-[9px] text-muted-foreground",children:[a.jsx("span",{children:"用于"}),I.groups.map(M=>a.jsx("button",{type:"button",className:"rounded px-1.5 py-1 text-primary hover:bg-primary/10",onClick:()=>c(M.id),children:M.name},M.id))]}),!I.connected&&I.error&&I.error!=="CONNECTING"&&a.jsxs("details",{className:"mt-1 text-[9px] text-muted-foreground",children:[a.jsx("summary",{className:"cursor-pointer",children:vj(I.error)}),a.jsx("p",{className:"mt-1 select-text break-words",children:I.error})]}),h===I.serviceId&&a.jsxs("div",{role:"group","aria-label":"确认移除协作连接",className:"mt-2 rounded-lg bg-surface-2 p-2.5",children:[a.jsx("p",{className:"text-[10px] leading-relaxed text-foreground",children:I.groups?.length?"请先处理上方协作组的成员,再移除这条连接。":"移除后停止与该服务协作,保留已有会话和消息;以后可重新连接。"}),a.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[a.jsx("button",{type:"button",disabled:!!r,className:`${kr} min-h-9 text-muted-foreground`,onClick:()=>p(null),children:"取消"}),a.jsx("button",{type:"button",disabled:!!r||!!I.groups?.length,className:`${kr} min-h-9 bg-destructive text-destructive-foreground`,onClick:()=>{E(I.serviceId,!1)},children:r===`peer:${I.serviceId}`?"正在移除…":"确认移除"})]})]})]},I.serviceId||I.origin))}),b.length===0&&e.state==="ready"&&a.jsx("p",{className:"py-2 text-[10px] text-muted-foreground",children:"当前没有其他协作服务,当前服务内仍可创建协作组。"}),A.length>0&&a.jsxs("button",{type:"button",className:`${kr} mt-1 min-h-9 text-primary hover:bg-primary/10`,onClick:J7,children:[a.jsx(rs,{size:12}),"重试连接"]}),w.length>0&&a.jsxs("div",{className:"mt-2 border-t border-border/15 pt-1",children:[a.jsx("button",{type:"button","aria-expanded":g,className:`${kr} min-h-9 text-muted-foreground hover:bg-surface-2`,onClick:()=>x(I=>!I),children:g?"收起恢复列表":"恢复已移除连接"}),g&&a.jsxs("section",{"aria-label":"恢复已移除连接",className:"mt-1 rounded-lg bg-surface-2 px-2.5 py-2",children:[a.jsx("p",{className:"text-[10px] leading-relaxed text-muted-foreground",children:"以下是恢复记录,连接已停用,不会自动重连。点击恢复后才会重新启用协作。"}),a.jsx("div",{className:"mt-1 divide-y divide-border/10",children:w.map(I=>a.jsxs("div",{className:"flex items-start gap-2 py-2",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("p",{className:"break-words text-[10px] text-foreground",children:[Ol({serviceLabel:I.label,serviceOrigin:I.origin}),a.jsx("span",{className:"ml-2 text-[9px] text-muted-foreground",children:"已停用"})]}),a.jsx("p",{className:"mt-0.5 select-text break-all text-[9px] text-muted-foreground",children:I.accessUrl||I.origin})]}),a.jsx("button",{type:"button",disabled:!!r||!I.serviceId,className:`${kr} min-h-9 shrink-0 text-primary hover:bg-primary/10`,onClick:()=>{E(I.serviceId,!0)},children:r===`peer:${I.serviceId}`?"恢复中…":"恢复连接"})]},I.serviceId||I.origin))})]})]})]})]},k?"affected":"other")}function fj({service:e}){let t=!1;try{t=["localhost","127.0.0.1","[::1]"].includes(new URL(e.origin).hostname)}catch{}const r=e.accessUrl||(t?"":e.origin);return a.jsxs("details",{className:"mt-1 text-[9px] text-muted-foreground",children:[a.jsx("summary",{className:"w-fit cursor-pointer py-1",children:"连接详情"}),a.jsxs("dl",{className:"mt-1 space-y-1 select-text break-all",children:[a.jsxs("div",{children:[a.jsx("dt",{className:"inline",children:"服务地址:"}),a.jsx("dd",{className:"inline",children:r||"暂未获取,请在服务切换器中查看"})]}),e.serviceId&&a.jsxs("div",{children:[a.jsx("dt",{className:"inline",children:"服务身份:"}),a.jsx("dd",{className:"inline",children:e.serviceId})]})]})]})}function xp(e){return!Qu(e.sessionId)||e.serviceConnected!==!1}function pj(e){return e.serviceOrigin?e.serviceOrigin===window.location.origin?"":e.serviceOrigin:Qu(e.sessionId)?.origin??""}function ax(e){const t=new Map;for(const r of e){const n=pj(r),i=t.get(n)??{key:n,label:n?Ol(r):"本机服务",sessions:[]};n&&i.label==="远端服务"&&(i.label=Ol(r)),i.sessions.push(r),t.set(n,i)}return[...t.values()].sort((r,n)=>(r.key?1:0)-(n.key?1:0)||r.label.localeCompare(n.label))}function ox({label:e,count:t,collapsed:r,onToggle:n}){return a.jsxs("button",{type:"button","aria-expanded":!r,onClick:n,className:"flex w-full items-center gap-1.5 bg-surface-2/50 px-2 py-1.5 text-left text-muted-foreground transition hover:bg-surface-elevated",children:[a.jsx(Yo,{size:12,className:`shrink-0 transition-transform ${r?"-rotate-90":""}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-[10px] font-semibold uppercase tracking-wide",children:e}),a.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground/70",children:t})]})}function mj(e,t){const r=new Map(t.map(n=>[n.sessionId,n]));for(const n of e?.sessionIds??[]){if(r.has(n))continue;const i=e?.remoteSessions?.find(l=>l.sessionId===n);r.set(n,i?{...i,status:"offline",serviceConnected:!1}:{sessionId:n,name:n,backendSessionId:null,cwd:"",agent:null,status:"offline",capability:"",currentTask:"暂不可用,保留成员身份",updatedAt:0,...Qu(n)?{serviceConnected:!1}:{}})}return[...r.values()]}function bp({session:e}){return!e.serviceOrigin||e.serviceOrigin===window.location.origin?null:a.jsxs("span",{className:"inline-flex max-w-28 shrink-0 items-center gap-1 rounded border border-border/20 px-1 py-0.5 text-[9px] text-muted-foreground",children:[a.jsx(Rh,{size:9}),a.jsx("span",{className:"truncate",children:Ol(e)})]})}function nh(e){return e.serviceConnected===!1?"服务不可达":xj(e.status)}function ny(e,t=[]){if(!e)return;const r=t.some(i=>i.sessionId!==e.sessionId&&i.name.trim()===e.name.trim()),n=e.sessionId.startsWith("remote:")?Ol(e):"本机服务";return r?`${e.name} · ${n}`:e.name}async function gj(e){e.sessionId.startsWith("remote:")?await D6(e.sessionId):window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e.sessionId}))}function xj(e){return{ready:"终端可达",shell:"Shell 终端",recovering:"正在恢复连接",detached:"终端未连接","agent-exited":"Agent 已退出",offline:"已离线",ambiguous:"需确认目标终端","identity-mismatch":"终端身份已变化",unavailable:"终端暂不可达","service-reachable":"服务可达","service-unreachable":"服务不可达"}[e]??"在线"}function yp(e){if(!e)return"暂无任务摘要";try{const t=JSON.parse(e);if(typeof t.prompt=="string")return Ih(t.prompt)||"暂无任务摘要"}catch{}return Ih(e)||"暂无任务摘要"}function bj(e){return{message:"消息",ask:"问题",reply:"回复",task:"任务",handoff:"交接",done:"完成"}[e]}function yj(e,t){const r=new Map(t.map(i=>[i.sessionId,ny(i,t)])),n=new Map;for(const i of e){const l=`${i.threadId}:${i.createdAt}:${i.fromSessionId??"user"}:${i.kind}:${i.responseKind??""}:${JSON.stringify(i.task??null)}:${i.content}`,c=n.get(l),h=r.get(i.toSessionId)??i.toSessionId.slice(0,8);if(c){c.toNames.push(h);const p={failed:-2,expired:-1,pending:0,delivered:1,read:2};p[i.status]<p[c.status]&&(c.status=i.status);continue}n.set(l,{key:l,kind:i.kind,content:i.content,createdAt:i.createdAt,fromName:i.fromSessionId?r.get(i.fromSessionId)??i.fromSessionId.slice(0,8):"你",toNames:[h],status:i.status,responseKind:i.responseKind,task:i.task,failureReason:i.failureReason})}return[...n.values()].sort((i,l)=>l.createdAt-i.createdAt)}function vj(e){return/timeout|timed out|超时|operation was aborted/i.test(e)?"连接超时,暂时无法访问该服务。请确认远端服务已启动,并检查网络或 VPN 连接。":/ECONNREFUSED|connection refused/i.test(e)?"远端拒绝连接,请确认服务已启动且端口正确。":/ENOTFOUND|EHOSTUNREACH|ENETUNREACH/i.test(e)?"无法访问远端地址,请检查地址和网络连接。":/certificate|fingerprint|TLS|证书/i.test(e)?"远端证书校验失败,请检查服务连接授权。":"服务连接暂时不可用,可查看连接详情并重试。"}function vp({value:e,query:t}){const r=t.trim().toLocaleLowerCase();if(!r)return a.jsx(a.Fragment,{children:e});const n=e.toLocaleLowerCase(),i=[];let l=0,c;for(;(c=n.indexOf(r,l))>=0;)i.push(e.slice(l,c)),i.push(a.jsx("mark",{className:"rounded bg-primary/15 text-primary",children:e.slice(c,c+r.length)},c)),l=c+r.length;return i.push(e.slice(l)),a.jsx(a.Fragment,{children:i})}function wj({active:e,onClose:t,onNewSession:r,setError:n}){const[i,l]=y.useState(""),[c,h]=y.useState([]),[p,g]=y.useState(0),[x,b]=y.useState(),[w,A]=y.useState(50),[k,E]=y.useState(0),[I,M]=y.useState(!1),[Q,j]=y.useState(null),[F,V]=y.useState(null),$=y.useRef(null),te=y.useRef(0);y.useEffect(()=>{e&&$.current?.focus({preventScroll:!0})},[e]),y.useEffect(()=>{if(!e)return;const de=++te.current,oe=new AbortController;let Oe;j(null),M(!0);const et=async()=>{try{const ce=await l8(i.trim(),w,oe.signal);if(de!==te.current)return;h(ce.results),g(ce.total??ce.results.length),b(ce.index),ce.index?.building&&(Oe=window.setTimeout(()=>{et()},2500))}catch(ce){de===te.current&&!oe.signal.aborted&&j(ce instanceof Error?ce.message:"搜索失败")}finally{de===te.current&&M(!1)}};return Oe=window.setTimeout(()=>{et()},i.trim()?250:0),()=>{window.clearTimeout(Oe),oe.abort(),++te.current}},[e,i,w,k]);const se=de=>{n(null),l(de),h([]),g(0),A(50)},qe=async de=>{if(!F){if(de.live){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:de.sessionId})),t();return}if(!(!de.nativeKey&&!de.resumeHistoryId)){V(de.sessionId),n(null);try{const oe=de.nativeKey?await c8(de.nativeKey):await Xx(de.resumeHistoryId);if("sessionId"in oe&&oe.sessionId)window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:oe.sessionId}));else if(oe.command)r({mode:"shell",cwd:oe.cwd,command:oe.command});else throw new Error("这条会话暂时无法恢复,请重新搜索");t()}catch(oe){n(oe instanceof Error?oe.message:"恢复失败")}finally{V(null)}}}};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"sticky -top-4 z-20 -mx-4 -mt-4 border-b border-border/15 bg-surface px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"历史会话搜索"}),a.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-muted-foreground",children:"搜索当前服务的 Codex、Claude 历史对话和 Termdock 终端记录,未启动的会话也能找到并恢复。"})]}),a.jsxs("label",{className:"relative mt-3 block",children:[a.jsx("span",{className:"sr-only",children:"搜索历史会话"}),a.jsx(Mh,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{ref:$,maxLength:512,className:`${As} pl-9 pr-9`,value:i,onChange:de=>se(de.target.value),placeholder:"搜索会话名称、对话关键词、目录或 session ID"}),I?a.jsx(rs,{size:13,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"}):i&&a.jsx("button",{type:"button","aria-label":"清空搜索",className:"absolute right-1.5 top-1/2 -translate-y-1/2 rounded-md p-1.5 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:()=>se(""),children:a.jsx(Kn,{size:13})})]}),x?.building&&a.jsxs("div",{role:"status",className:"mt-2 text-[10px] text-muted-foreground",children:["正在建立历史索引:",x.indexed,"/",x.total," 个会话。可以先搜名称和目录,对话结果会自动补齐。"]}),x?.warning&&a.jsx("p",{role:"status",className:"mt-2 text-[10px] text-destructive",children:x.warning}),!!x?.failed&&a.jsxs("p",{role:"status",className:"mt-2 text-[10px] text-destructive",children:[x.failed," 个会话暂未完成索引,其余结果可正常使用。请稍后刷新重试。"]})]}),a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("p",{className:"text-[11px] text-foreground",children:[i.trim()?`找到 ${p} 个会话`:"最近的会话",p>c.length?` · 显示 ${c.length} 个`:""]}),a.jsxs("button",{type:"button",disabled:I,className:`${kr} text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>E(de=>de+1),children:[a.jsx(rs,{size:12}),"刷新"]})]}),!i.trim()&&a.jsx("p",{className:"text-[10px] text-muted-foreground",children:"记得之前讨论过什么?输入一句话中的关键词,就能找到对应会话。历史对话与索引保存在当前服务机器上。"}),a.jsx("div",{className:"divide-y divide-border/10 border-y border-border/10",children:c.map(de=>{const oe=de.live||!!(de.nativeKey||de.resumeHistoryId),Oe=F===de.sessionId?"正在恢复…":de.live?"打开会话":oe?"恢复会话":"仅供查阅",et=de.source==="codex"||de.source==="claude"?de.snippet:Aj(de),ce=de.source==="codex"?"Codex 历史":de.source==="claude"?"Claude 历史":"终端记录",Be=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"break-words text-[12px] font-medium text-foreground",children:a.jsx(vp,{value:de.title,query:i})}),a.jsx("p",{className:"mt-0.5 break-all text-[9px] text-muted-foreground",children:a.jsx(vp,{value:de.cwd||"项目目录待索引",query:i})})]}),a.jsx("span",{className:`shrink-0 text-[10px] ${de.live?"text-[var(--success)]":oe?"text-primary":"text-muted-foreground"}`,children:Oe})]}),et&&a.jsx("p",{className:"mt-2 line-clamp-3 break-words text-[10px] leading-relaxed text-foreground/75",children:a.jsx(vp,{value:et,query:i})}),a.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:[ce," · ",Eh(de.updatedAt),i.trim()?` · ${de.matchCount>=999?"999+":de.matchCount} 处匹配`:"",oe?"":" · 没有可恢复记录"]}),de.agentNativeSessionId&&a.jsx("p",{className:"mt-1 select-text break-all text-[9px] text-muted-foreground",children:de.agentNativeSessionId})]});return oe?a.jsx("button",{disabled:!!F,onClick:()=>{qe(de)},className:"block w-full px-2 py-3 text-left transition hover:bg-surface-2 focus-visible:bg-surface-2 focus-visible:outline-none",children:Be},de.nativeKey||de.sessionId):a.jsx("article",{className:"px-2 py-3",children:Be},de.sessionId)})}),p>c.length&&w<5e3&&a.jsx("button",{type:"button",disabled:I,className:`${kr} w-full bg-surface-2 text-foreground`,onClick:()=>A(de=>de+50),children:I?"正在加载…":"加载更多会话"}),Q&&a.jsxs("div",{role:"alert",className:"rounded-lg bg-destructive/10 p-3 text-[11px] text-destructive",children:["搜索失败:",Q,a.jsx("button",{type:"button",className:`${kr} ml-2`,onClick:()=>E(de=>de+1),children:"重试"})]}),!I&&!Q&&c.length===0&&a.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[a.jsx("p",{className:"text-[12px] text-foreground",children:x?.building?"历史对话仍在索引,请稍候":x?.warning||x?.failed?"暂未找到结果,部分历史记录尚不可搜索":i.trim()?`没有找到“${i.trim()}”`:"当前服务还没有可搜索的历史会话"}),a.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:x?.building?"新结果会自动显示,也可以先搜会话名称或目录。":"可尝试更短的关键词、项目目录或 session ID;其他机器的历史需切换到对应服务搜索。"}),i.trim()&&a.jsx("button",{className:`${kr} mt-3 bg-surface-2 text-foreground`,onClick:()=>se(""),children:"查看最近会话"})]})]})}function Ih(e){return e.replace(/\u001B\][^\u0007]*(?:\u0007|\u001B\\)/g," ").replace(/\u001B\[[0-?]*[ -/]*[@-~]/g," ").replace(/\(B/g," ").replace(/<[^>]{1,120}>/g," ").replace(/[─━│┃┄┅┆┇┈┉┊┋┌┐└┘├┤┬┴┼╭╮╯╰═║╔╗╚╝╠╣╦╩╬]+/g," ").replace(/([^\p{L}\p{N}\s])\1{3,}/gu," ").replace(/([A-Za-z])\1{12,}/g," ").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g," ").replace(/\s+/g," ").trim().slice(0,280)}function Aj(e){let t=Ih(e.snippet);for(const r of[e.title,e.cwd,e.agentSlug])r&&(t=t.split(r).join(" "));return Ih(t)}function Tj(e){if(e.schedule.kind==="interval")return e.schedule.everyMinutes===60?"每小时":e.schedule.everyMinutes===1440?"每天":`每 ${e.schedule.everyMinutes} 分钟`;const t=["日","一","二","三","四","五","六"];return`${e.schedule.weekdays.length===7?"每天":e.schedule.weekdays.map(n=>`周${t[n]}`).join("、")} ${e.schedule.time}`}function Cj(e,t=Date.now(),r=t){if(e.kind==="interval"){const l=e.everyMinutes*6e4,c=Math.max(0,t-r);return r+(Math.floor(c/l)+1)*l}const[n,i]=e.time.split(":").map(Number);for(let l=0;l<=7;l+=1){const c=new Date(t);if(c.setDate(c.getDate()+l),c.setHours(n,i,0,0),c.getTime()>t&&e.weekdays.includes(c.getDay()))return c.getTime()}return t}function Eh(e){return new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)}function Sj(e){return e==="running"?"投递中":e==="success"?"已投递":e==="failed"?"投递失败":""}function _j(e){return e==="running"?"text-[var(--warning)]":e==="success"?"text-[var(--success)]":e==="failed"?"text-destructive":"text-muted-foreground"}function Lj({text:e}){return a.jsx("div",{className:"rounded-xl border border-dashed border-border/20 px-4 py-8 text-center text-[11px] text-muted-foreground",children:e})}function kj({onOpenSettings:e,serverAttention:t,actions:r}){const{t:n}=Mr(),[i,l]=y.useState(!1),c=y.useRef(null),h=y.useRef(null),p=y.useRef(null),g=y.useId();return y.useLayoutEffect(()=>{if(!i)return;const x=c.current,b=p.current;if(!x||!b)return;const w=window.visualViewport,A=()=>{const E=x.getBoundingClientRect(),I=(w?.offsetLeft??0)+8,M=(w?.offsetTop??0)+8,Q=(w?.width??window.innerWidth)-16,j=(w?.offsetTop??0)+(w?.height??window.innerHeight)-8,F=Math.max(0,Math.min(256,Q)),V=Math.max(0,E.top-M-4),$=Math.max(0,j-E.bottom-4),te=V>=180||V>=$;Object.assign(b.style,{width:`${F}px`,left:`${Math.max(I,Math.min(E.right-F,I+Q-F))}px`,top:`${te?E.top-4:E.bottom+4}px`,maxHeight:`${te?V:$}px`,transform:te?"translateY(-100%)":"none"})};A();const k=typeof ResizeObserver>"u"?null:new ResizeObserver(A);return k?.observe(x),window.addEventListener("resize",A),window.addEventListener("scroll",A,!0),w?.addEventListener("resize",A),w?.addEventListener("scroll",A),()=>{k?.disconnect(),window.removeEventListener("resize",A),window.removeEventListener("scroll",A,!0),w?.removeEventListener("resize",A),w?.removeEventListener("scroll",A)}},[i]),y.useEffect(()=>{if(!i)return;p.current?.querySelector('[role="menuitem"]')?.focus({preventScroll:!0});const x=b=>{b.target instanceof Node&&!c.current?.contains(b.target)&&!p.current?.contains(b.target)&&l(!1)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[i]),a.jsxs("div",{ref:c,role:"group","data-sidebar-gesture-ignore":!0,"aria-label":n("sidebar.moreActions"),className:"relative z-20 mt-2 flex items-center justify-between gap-2",onKeyDown:x=>{i&&x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),l(!1),h.current?.focus({preventScroll:!0}))},children:[a.jsxs("button",{type:"button",onClick:e,title:t?n("sidebar.serverAttention"):void 0,className:"inline-flex min-h-9 items-center gap-1.5 whitespace-nowrap rounded-lg px-2 text-[11px] text-muted-foreground transition hover:bg-surface-2 hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",children:[a.jsx(TA,{size:14,className:t?"text-destructive":void 0}),a.jsx("span",{children:n("sidebar.settings")})]}),a.jsxs("button",{ref:h,type:"button","aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?g:void 0,onClick:()=>l(x=>!x),onKeyDown:x=>{(x.key==="ArrowDown"||x.key==="ArrowUp")&&(x.preventDefault(),l(!0))},className:`inline-flex min-h-9 items-center gap-1.5 whitespace-nowrap rounded-lg px-2 text-[11px] transition focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${i?"bg-surface-2 text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(Pl,{size:15}),a.jsx("span",{children:n("sidebar.moreActions")})]}),i&&Ai.createPortal(a.jsx("div",{ref:p,id:g,role:"menu","data-sidebar-gesture-ignore":!0,"data-sidebar-composer-popover":"sidebar-launch-options","aria-label":n("sidebar.moreActions"),className:"fixed z-popover overflow-y-auto overscroll-contain rounded-xl border border-border/15 bg-surface p-1 shadow-[0_12px_32px_var(--app-shadow-soft)] animate-fade-in",onKeyDown:x=>{const b=[...x.currentTarget.querySelectorAll('[role="menuitem"]')],w=b.indexOf(document.activeElement);let A;if(x.key==="ArrowDown")A=(w+1)%b.length;else if(x.key==="ArrowUp")A=(w-1+b.length)%b.length;else if(x.key==="Home")A=0;else if(x.key==="End")A=b.length-1;else if(x.key==="Tab"){l(!1);return}else return;x.preventDefault(),b[A]?.focus({preventScroll:!0})},children:r.map(({label:x,icon:b,onSelect:w,separated:A})=>a.jsxs("div",{role:"none",children:[A&&a.jsx("div",{role:"separator",className:"mx-2 my-1 h-px bg-border/40"}),a.jsxs("button",{type:"button",role:"menuitem",tabIndex:-1,onClick:()=>{l(!1),w()},className:"flex min-h-10 w-full items-center gap-2.5 whitespace-nowrap rounded-lg px-2.5 text-left text-[12px] text-foreground transition hover:bg-surface-2 focus:bg-surface-2 focus:outline-none",children:[a.jsx(b,{size:15,className:"shrink-0 text-muted-foreground"}),a.jsx("span",{children:x})]})]},x))}),document.body)]})}function Ij(e,t){return w8(e,t)}function Rd(e,t){const r=new Set(e),n=t.filter(l=>l.sessionIds.length>=2&&l.sessionIds.every(c=>r.has(c))),i=new Set;return e.flatMap(l=>{const c=n.find(h=>h.sessionIds.includes(l));return c?i.has(c.id)?[]:(i.add(c.id),[{sessionIds:c.sessionIds,workspace:c}]):[{sessionIds:[l]}]})}function Y0(e,t,r,n=[]){const i=new Map,l=new Map,c=new Set(e.map(x=>x.id));for(const x of n){const b=x.sessionIds.filter(A=>c.has(A));if(b.length<(x.federated?1:2))continue;const w=b.length===x.sessionIds.length?x:{...x,sessionIds:b};b.forEach(A=>i.set(A,w))}for(const x of t)if(!(x.sessionIds.length<2||!x.sessionIds.every(b=>c.has(b)))&&!x.sessionIds.some(b=>i.has(b)))for(const b of x.sessionIds)l.set(b,x);const h=new Set,p=new Set,g=[];for(const x of e){const b=i.get(x.id);if(b){if(h.has(b.id))continue;h.add(b.id);const k=b.sessionIds.flatMap(E=>{const I=r.get(E);return I?[I]:[]});g.push({kind:"collaboration",id:`collaboration:${b.id}`,group:b,members:k,sessionIds:b.sessionIds});continue}const w=l.get(x.id);if(!w){g.push({kind:"session",id:`session:${x.id}`,session:x,sessionIds:[x.id]});continue}if(p.has(w.id))continue;p.add(w.id);const A=w.sessionIds.flatMap(k=>{const E=r.get(k);return E?[E]:[]});g.push({kind:"workspace",id:`workspace:${w.id}`,workspace:w,members:A,sessionIds:w.sessionIds})}return g}function lx(e,t,r){const n=Math.min(e.length,Math.max(0,r)),i=e.slice(0,n).flatMap(c=>c.sessionIds.filter(h=>h!==t)),l=e.slice(n).flatMap(c=>c.sessionIds.filter(h=>h!==t));return[...i,t,...l]}function Ej({status:e,detail:t,needsReview:r,inCopyMode:n}){return a.jsx(RQ,{status:e,detail:t,needsReview:r,inCopyMode:n})}function cx({isOpen:e,drawerWidthPx:t,onClose:r,onOpen:n,sessions:i,activeSessionId:l,sessionStates:c,onJumpToNextAttention:h,onNewSession:p,onCloseSession:g,onSplitSession:x,onCloseSplit:b,onRemoveFromSplit:w,splitWorkspaces:A,onSetSplitLayout:k,onReorderSplitWorkspace:E,onCombineSplitSessions:I,onReorderSessions:M,onSessionMenu:Q,onOpenSettings:j,onOpenQuota:F,updateState:V,updateActionPending:$=!1,onConfirmUpdateRestart:te,onRetryUpdate:se,serverHealthState:qe,tmuxAvailable:de=!0,defaultSessionMode:oe="shell",push:Oe,pinned:et,onTogglePinned:ce,recoverableTmuxSessions:Be=[],recoverableTmuxSessionsLoading:ot=!1,onRefreshRecoverableTmuxSessions:Ie}){const{t:re}=Mr(),[,Ue]=y.useState(0),[_e,K]=y.useState(null),[Le,fe]=y.useState(!1),[$e,ze]=y.useState(!1),[Ee,ee]=y.useState({}),Ke=$e||Object.keys(Ee).length>0,wt=y.useRef(!1);y.useEffect(()=>{let H=!1;return $l().then(we=>{H||wt.current||ee(Object.fromEntries(mb(we.collaborationPanels?.[Dh()]).map(Pe=>[Pe,!0])))}).catch(()=>{}),()=>{H=!0}},[]);const tt=async(H,we)=>{wt.current=!0,await hl({floatingGroupId:we},H),ee(Pe=>({...Pe,[H]:we!==null}))},[ge,it]=y.useState([]),[ht,Y]=y.useState(!1),[be,ut]=y.useState(null),[le,pe]=y.useState(null),[je,xt]=y.useState(null),[dt,Dt]=y.useState(null),Xt=async H=>{if(wt.current=!0,!H){ze(!0);return}const we=uu.getState().collaborationGroups.find(ve=>ve.id===H),Pe=ts.getState().docks[H]?.sessionId,Ge=i.find(ve=>ve.id===Pe)??i.find(ve=>ve.id===l&&we?.sessionIds.includes(ve.id))??i.find(ve=>we?.sessionIds.includes(ve.id));if(Ge&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:Ge.id})),Ee[H]===void 0)try{await hl({floatingGroupId:H},H),ee(ve=>({...ve,[H]:!0}))}catch{Dt("协作面板打开失败,请重试")}},Ht=uu(H=>H.collaborationGroups),Bt=uu(H=>H.setCollaborationGroups),[Wt,lr]=y.useState({mode:oe}),{preference:ur,agents:Jt,detecting:Er,refresh:X,selectAgent:Re}=ij(),We=y.useRef(null),Qt=!!(V?.latestVersion&&["installing","ready","restarting","error"].includes(V.status)),It=!!qe?.attention,ar=[re("sidebar.moreActions"),It?re("sidebar.serverAttention"):null,Qt&&V?.latestVersion?re("sidebar.updateAvailable",{version:V.latestVersion}):null].filter(Boolean).join(": "),Ot=Zt(H=>H.groupByFolder),Fe=Zt(H=>H.collapsedGroups),yr=Zt(H=>H.toggleGroupCollapsed),He=y.useRef(null),Se=y.useRef(null),Ve=y.useRef(null),Ct=y.useRef(0),jr=y.useRef(!1),ft=y.useRef(null),Br=y.useRef(null),[Wn,an]=y.useState(!1),ke=y.useRef([]),St=y.useRef(null),kt=y.useRef(null),ue=y.useRef(new Set),Nr=y.useRef(null),st=y.useMemo(()=>new Set(A.flatMap(H=>H.sessionIds)),[A]),Gt=y.useMemo(()=>new Map(i.map(H=>[H.id,H])),[i]),Ur=y.useMemo(()=>Ij(Ht,new Set(Gt.keys())),[Ht,Gt]),gn=y.useCallback(async()=>{const H=++Ct.current;try{const we=await Kx();if(H!==Ct.current)return;Bt(Array.isArray(we.groups)?we.groups:[])}catch{}},[]);y.useEffect(()=>Zx(H=>Bt(H.groups)),[]),y.useEffect(()=>{gn();const H=window.setInterval(()=>{gn()},1e4),we=()=>{gn()};return window.addEventListener("focus",we),()=>{Ct.current+=1,window.clearInterval(H),window.removeEventListener("focus",we)}},[gn]),y.useEffect(()=>{(e||!Ke)&&gn()},[Ke,e,gn]);const Ln=y.useCallback(()=>{ke.current=Array.from(document.querySelectorAll("[data-collaboration-member], [data-collaboration-background]")).flatMap(H=>{const we=H.dataset.collaborationMember??"",Pe=H.hasAttribute("data-collaboration-background"),Ge=H.closest("[data-collaboration-group]")?.dataset.collaborationGroup;if(!we&&!Pe||!Ge)return[];const ve=[];for(let lt=H.parentElement;lt;lt=lt.parentElement)ve.push({element:lt,top:lt.scrollTop,left:lt.scrollLeft});return[{element:H,sessionId:we,groupId:Ge,background:Pe,rect:H.getBoundingClientRect(),scrollParents:ve}]})},[]),wn=y.useCallback((H,we)=>{if(!jr.current)return;document.querySelectorAll("[data-split-exit-drop-index]").forEach(vt=>vt.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(vt=>vt.removeAttribute("data-drop-active"));const Ge=document.elementsFromPoint(H,we).map(vt=>vt.closest("[data-collaboration-background]")).find(Boolean)?.closest("[data-collaboration-group]");if(Ge?.dataset.collaborationGroup){Ge.dataset.dropActive="true",kt.current={kind:"collaboration",groupId:Ge.dataset.collaborationGroup,background:!0};return}const ve=ke.current.find(vt=>{if(vt.sessionId===Br.current||!vt.element.isConnected)return!1;const Tt=vt.scrollParents.reduce((at,Rr)=>at+Rr.element.scrollLeft-Rr.left,0),fr=vt.scrollParents.reduce((at,Rr)=>at+Rr.element.scrollTop-Rr.top,0);return H>=vt.rect.left-Tt&&H<=vt.rect.right-Tt&&we>=vt.rect.top-fr+vt.rect.height*.25&&we<=vt.rect.bottom-fr-vt.rect.height*.25});if(ve?.background){ve.element.closest("[data-collaboration-group]")?.setAttribute("data-drop-active","true"),kt.current={kind:"collaboration",groupId:ve.groupId,background:!0};return}if(ve&&!A.find(Tt=>Tt.sessionIds.includes(ve.sessionId))?.sessionIds.includes(Br.current??"")){ve.element.dataset.dropActive="true",kt.current={kind:"split",sessionId:ve.sessionId,groupId:ve.groupId};return}const lt=document.elementsFromPoint(H,we).filter(vt=>{const Tt=vt.closest("[data-rfd-draggable-id]");return!Tt||!["session:","split-member:","collaboration-member:"].some(fr=>Tt.dataset.rfdDraggableId===`${fr}${Br.current}`)}),Nt=lt.map(vt=>vt.closest("[data-collaboration-group]")).find(vt=>vt?.dataset.collaborationGroup);if(Nt?.dataset.collaborationGroup){const vt=Nt.dataset.collaborationGroup,Tt=lt.map(Vr=>Vr.closest("[data-collaboration-split]")).find(Boolean),fr=lt.map(Vr=>Vr.closest("[data-collaboration-member]")).find(Boolean),at=fr?.dataset.collaborationMember??Tt?.dataset.splitAnchor,Rr=vt===ft.current&&A.some(Vr=>Vr.sessionIds.includes(at??"")&&Vr.sessionIds.includes(Br.current??""));if(at&&!Rr&&(vt!==ft.current||!fr&&Tt)){Nt.dataset.dropActive="true";const Vr=fr??Tt;Vr&&(Vr.dataset.dropActive="true"),kt.current={kind:"split",sessionId:at,groupId:vt}}else{const Vr=lt.some(Nn=>Nn.closest("[data-collaboration-background]"));(vt!==ft.current||Vr)&&(Nt.dataset.dropActive="true"),kt.current={kind:"collaboration",groupId:vt,background:Vr}}return}const ct=Array.from(document.querySelectorAll("[data-sidebar-entity-list-id]")).filter(vt=>vt.dataset.sidebarEntityListId===St.current).find(vt=>{const Tt=vt.getBoundingClientRect();return H>=Tt.left&&H<=Tt.right&&we>=Tt.top-8&&we<=Tt.bottom+8});if(!ct){kt.current=null;return}const _t=Array.from(ct.children).filter(vt=>vt instanceof HTMLElement&&vt.hasAttribute("data-sidebar-entity-index")),_r=_t.findIndex(vt=>{const Tt=vt.getBoundingClientRect();return we<Tt.top+Tt.height/2}),jt=_r<0?_t.length:_r;kt.current={kind:"list",listId:ct.dataset.sidebarEntityListId??"",index:jt};const tr=Array.from(ct.querySelectorAll(":scope > [data-sidebar-entity-index] > [data-split-exit-drop-index]")).find(vt=>vt.dataset.splitExitDropIndex===String(jt));tr instanceof HTMLElement&&(tr.dataset.active="true")},[A]);y.useEffect(()=>{const H=Pe=>wn(Pe.clientX,Pe.clientY),we=Pe=>{const Ge=Pe.touches[0];Ge&&wn(Ge.clientX,Ge.clientY)};return window.addEventListener("pointermove",H),window.addEventListener("touchmove",we,{passive:!0}),()=>{window.removeEventListener("pointermove",H),window.removeEventListener("touchmove",we)}},[wn]);const sr=y.useCallback((H,we)=>{try{H(we)}finally{document.querySelectorAll("[data-sidebar-dragging]").forEach(Pe=>{delete Pe.dataset.sidebarDragging}),jr.current=!1,ke.current=[],an(!1),ft.current=null,Br.current=null,St.current=null,kt.current=null,document.querySelectorAll("[data-split-exit-drop-index]").forEach(Pe=>Pe.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(Pe=>Pe.removeAttribute("data-drop-active"))}},[]),yn=y.useMemo(()=>i.filter(H=>!st.has(H.id)),[i,st]),Ts=y.useMemo(()=>{let H=0;for(const we of i)c.get(we.id)?.agentStatus==="working"&&(H+=1);return H},[i,c]);y.useLayoutEffect(()=>{const H=He.current,we=Se.current;if(!e||!H||!we){Ve.current=null;return}const Pe=we.getBoundingClientRect(),Ge=H.getBoundingClientRect(),ve={item:H,top:Math.round(Ge.top-Pe.top+we.scrollTop),height:Math.round(Ge.height),viewportHeight:we.clientHeight},lt=Ve.current;if(Ve.current=ve,lt?.item===ve.item&<.top===ve.top&<.height===ve.height&<.viewportHeight===ve.viewportHeight||jr.current||we.clientHeight===0)return;const Nt=8,At=Ge.top-Pe.top,ct=Ge.bottom-Pe.top;At<Nt?we.scrollTop+=At-Nt:ct>we.clientHeight-Nt&&(we.scrollTop+=ct-we.clientHeight+Nt)});const Xr=y.useMemo(()=>{if(!Ot||!l)return null;const H=c.get(l)?.cwd??null;return f8(H)},[Ot,l,c]);y.useEffect(()=>{if(!Ot){Nr.current=null,ue.current.clear();return}if(!l){Nr.current=null;return}const H=Zt.getState(),we=ue.current,Pe=Nr.current,Ge=Xr;Pe!==null&&Pe!==Ge&&we.has(Pe)&&(H.collapsedGroups.has(Pe)||H.toggleGroupCollapsed(Pe),we.delete(Pe)),Ge!==null&&Ge!==""&&H.collapsedGroups.has(Ge)&&(H.toggleGroupCollapsed(Ge),we.add(Ge)),Nr.current=Ge},[Ot,l,Xr]),y.useEffect(()=>{e||fe(!1)},[e]),y.useEffect(()=>{lr(H=>({...H,command:ur?.command}))},[ur]),y.useEffect(()=>{if(!Le)return;let H=!1;return Y(!0),pe(null),Hm().then(we=>{H||it(we)}).catch(()=>{H||pe(re("sidebar.resumeHistoryLoadFailed"))}).finally(()=>{H||Y(!1)}),()=>{H=!0}},[Le,re]),y.useEffect(()=>{if(!_e)return;const H=we=>{we instanceof KeyboardEvent&&we.key!=="Escape"||we instanceof PointerEvent&&we.target instanceof Node&&We.current?.contains(we.target)||K(null)};return window.addEventListener("pointerdown",H),window.addEventListener("keydown",H),()=>{window.removeEventListener("pointerdown",H),window.removeEventListener("keydown",H)}},[_e]);const Wr=()=>{!Oe&&!et&&r()},on=oe==="tmux"&&!de?"shell":oe,An=()=>{p({mode:on}),Wr()},jn=()=>{ur&&(p({mode:on,command:ur.command}),Wr())},Gn=H=>{xt(H.name),p({mode:"tmux",tmuxSessionName:H.name,cwd:H.cwd??void 0}),Wr()};y.useEffect(()=>{je&&(Be.some(H=>H.name===je)||xt(null))},[je,Be]);const Pn=(H,we)=>{p({...Wt,cwd:Wt.cwd?.trim()||void 0,command:we??H?.command}),fe(!1),Wr()},hn=async H=>{ut(H.id),pe(null);try{const we=await Xx(H.id);p({mode:"shell",cwd:we.cwd,command:we.command}),fe(!1),Wr()}catch(we){const Pe=we&&typeof we=="object"&&"code"in we?String(we.code??""):"";pe(re(Pe==="AGENT_SESSION_ACTIVE_ELSEWHERE"?"tab.resumeAgentConflict":"sidebar.resumeHistoryFailed"))}finally{ut(null)}},kn=async H=>{it(we=>we.filter(Pe=>Pe.id!==H));try{await A8(H)}catch{pe(re("sidebar.resumeHistoryRemoveFailed")),Hm().then(it).catch(()=>{})}},Tn=()=>{if(Le){fe(!1);return}lr({mode:oe==="tmux"&&!de?"shell":oe,cwd:l?c.get(l)?.cwd??void 0:void 0,command:ur?.command}),fe(!0)},rn=y.useCallback(H=>{const we=c.get(H);return we?.agentStatus==="waiting"||we?.agentNeedsReview?"bg-[rgb(var(--warning-rgb)_/_0.10)] text-foreground":we?.agentStatus==="working"?"bg-[rgb(var(--success-rgb)_/_0.08)] text-foreground":we?.inCopyMode?"bg-[rgb(var(--tmux-rgb)_/_0.08)] text-foreground":null},[c]),Dr=M6(),ns=y.useCallback((H,we,Pe,Ge)=>{const ve=H.id===l,lt=st.has(H.id),Nt=!!(Pe&<),At=c.get(H.id),ct=xu(At?.cwd??null),_t=At?.shellTitle??p8(H.id),_r=_t===At?.cwd||_t===ct?null:_t,jt=m8(H,At?.activeProgram??null,null,g8,_r,At?.promptState??null),tr=!!(At?.tuiProgress&&At.tuiProgress.state!=="remove"),Tt=At?.promptState==="running"||At?.agentStatus==="working"||tr?"bg-[var(--success)]":At?.agentStatus==="waiting"||At?.agentNeedsReview?"bg-[var(--warning)]":At?.inCopyMode?"bg-[var(--tmux)]":"bg-primary";return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:ve?He:null,type:"button",...we??{},onContextMenu:fr=>{Q&&(fr.preventDefault(),Q(H.id,{x:fr.clientX,y:fr.clientY}))},onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:H.id})),Wr()},className:`sidebar-session-primary relative min-w-0 flex flex-1 items-center overflow-hidden text-left ${we?"cursor-grab active:cursor-grabbing ":""}${Pe?"gap-1.5 py-0.5 pl-1.5 pr-0.5":"gap-1.5 py-1 pl-2 pr-1"}`,title:At?.cwd??H.name,children:[ve&&a.jsx("span",{className:`absolute inset-y-2 left-0 w-0.5 rounded-full ${Tt}`}),a.jsxs("span",{className:`relative inline-flex shrink-0 items-center justify-center rounded-md ${Pe?"h-5 w-[22px]":"h-[22px] w-[22px]"} ${ve?H.mode==="tmux"?"bg-[rgb(var(--tmux-rgb)_/_0.15)] text-[color:var(--tmux)]":"bg-primary/15 text-primary":H.mode==="tmux"?"bg-surface text-[rgb(var(--tmux-rgb)_/_0.80)]":"bg-surface text-muted-foreground"}`,children:[At?.isConnecting||tr&&!At?.agentStatus?a.jsx(_n,{size:Pe?10:11,className:"animate-spin"}):At?.agent??Wm(H.id)?a.jsx(dc,{agent:At?.agent??Wm(H.id),size:Pe?13:15}):H.mode==="tmux"?a.jsx(Kc,{size:Pe?10:11}):a.jsx(ko,{size:Pe?10:11}),a.jsx(Ej,{status:At?.agentStatus??null,detail:At?.agentStatusDetail,needsReview:At?.agentNeedsReview,inCopyMode:At?.inCopyMode})]}),a.jsx("span",{className:`min-w-0 flex-1 truncate leading-tight ${Pe?"text-[11px]":"text-[12px]"} ${ve?"font-medium text-foreground":""} ${At?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:jt}),a.jsx(w5,{sessionIds:[H.id]})]}),Ge,a.jsx("button",{type:"button",onClick:fr=>{fr.stopPropagation(),Nt?w(H.id):lt?b(H.id):x(H.id)},className:`sidebar-session-action inline-flex shrink-0 items-center justify-center rounded-md transition hover:bg-primary/15 hover:text-primary active:scale-95 ${Pe?"h-6 w-6":"h-[26px] w-[26px]"} ${lt?"bg-primary/15 text-primary":"text-muted-foreground/70"}`,"aria-label":`${re(Nt?"tab.splitRemovePane":lt?"tab.splitClose":"tab.split")} ${jt}`,title:re(Nt?"tab.splitRemovePane":lt?"tab.splitClose":"tab.split"),children:Nt?a.jsx(OA,{size:11}):a.jsx(dl,{size:12})}),a.jsx("button",{type:"button",onClick:fr=>{fr.stopPropagation(),g(H.id,fr)},className:`sidebar-session-action inline-flex shrink-0 items-center justify-center rounded-md text-muted-foreground/70 transition hover:bg-destructive/15 hover:text-destructive active:scale-95 ${Pe?"h-6 w-6":"h-[26px] w-[26px]"}`,"aria-label":re("sidebar.closeSession",{name:jt}),title:re("common.close"),children:a.jsx(Kn,{size:Pe?11:12})})]})},[l,st,c,g,x,b,w,Q,re]),Mt=y.useMemo(()=>ah(i,H=>c.get(H.id)?.cwd??null,Ot,re("sidebar.ungrouped"),A,Ur).groups,[Ur,Ot,i,c,A,re]),q=y.useMemo(()=>Y0(i,A,Gt,Ur),[Ur,i,Gt,A]),Ye=y.useCallback(H=>{an(H.draggableId.startsWith("collaboration:")||H.draggableId.startsWith("workspace:"));const we=H.draggableId.replace(/^split-member:/,"");Br.current=H.draggableId.replace(/^(?:session|split-member|collaboration-member):/,"");const Pe=H.type==="split-member"?A.find(At=>At.sessionIds.includes(we)):null,Ge=H.type==="collaboration-member"?H.source.droppableId.replace(/^collaboration-members:/,""):null,ve=Ge?Ur.find(At=>At.id===Ge):null;jr.current=!!(Pe||ve||H.type==="session"&&H.draggableId.startsWith("session:")),jr.current&&document.querySelectorAll("[data-collaboration-group]").forEach(At=>{At.dataset.sidebarDragging="true"}),ft.current=ve?.id??null;const lt=Pe?.sessionIds??ve?.sessionIds??[],Nt=lt.length>0?Mt.find(At=>lt.every(ct=>At.sessions.some(_t=>_t.id===ct))):null;St.current=Ot?Nt?`group-sessions:${Nt.key}`:null:lt.length>0?"sidebar-entities":null,kt.current=null},[Ur,Mt,Ot,A]),Lt=y.useCallback((H,we,Pe)=>{if(we===Pe)return;const Ge=we?Ht.find(ct=>ct.id===we):null,ve=Pe?Ht.find(ct=>ct.id===Pe):null;if(Pe&&!ve)return;if(ve){const ct=i.map(_r=>_r.id).filter(_r=>_r!==H);let _t=-1;ct.forEach((_r,jt)=>{ve.sessionIds.includes(_r)&&(_t=jt)}),_t>=0&&(ct.splice(_t+1,0,H),M(ct))}const lt=Ge?.sessionIds.filter(ct=>ct!==H)??[],Nt=ve?[...ve.sessionIds.filter(ct=>ct!==H),H]:[];Bt(ct=>ct.flatMap(_t=>_t.id===we?lt.length>=2?[{..._t,sessionIds:lt}]:[]:_t.id===Pe?[{..._t,sessionIds:Nt}]:[_t])),Dt(null),(Ge&&ve?x8({sourceGroupId:Ge.id,targetGroupId:ve.id,sessionId:H,expectedSourceUpdatedAt:Ge.updatedAt,expectedTargetUpdatedAt:ve.updatedAt}):Ge?lt.length>=2?ac({id:Ge.id,name:Ge.name,sessionIds:lt,expectedUpdatedAt:Ge.updatedAt}):Dp(Ge.id,Ge.updatedAt):ve?ac({id:ve.id,name:ve.name,sessionIds:Nt,expectedUpdatedAt:ve.updatedAt}):Promise.resolve()).then(()=>gn(),ct=>(Dt(ct instanceof Error?ct.message:"协作成员移动失败"),gn()))},[Ht,gn,i,M]),wr=y.useCallback((H,we,Pe)=>{const Ge=Ht.find(ct=>ct.id===H);if(!Ge||we===Pe)return;const ve=Ge.sessionIds.filter(ct=>!ct.startsWith("remote:")),lt=Rd(ve,A).flatMap(ct=>ct.sessionIds),[Nt]=lt.splice(we,1);if(!Nt)return;lt.splice(Pe,0,Nt);const At=A.find(ct=>ct.sessionIds.includes(Nt));if(At&&At.sessionIds.every(ct=>Ge.sessionIds.includes(ct))){const ct=lt.filter(_t=>At.sessionIds.includes(_t));E(At.id,ct)}lt.push(...Ge.sessionIds.filter(ct=>ct.startsWith("remote:"))),Bt(ct=>ct.map(_t=>_t.id===H?{..._t,sessionIds:lt}:_t)),Dt(null),ac({id:Ge.id,name:Ge.name,sessionIds:lt,expectedUpdatedAt:Ge.updatedAt}).then(()=>gn(),ct=>(Dt(ct instanceof Error?ct.message:"成员排序失败"),gn()))},[Ht,gn,A,E]);y.useEffect(()=>{const H=we=>{const{sourceId:Pe,targetId:Ge}=we.detail;if(!Pe||!Ge||Pe===Ge)return;const ve=ah(i,at=>c.get(at.id)?.cwd??null,Ot,"",A,Ur).arranged.map(at=>at.id),lt=ve.indexOf(Pe),Nt=ve.indexOf(Ge);if(lt<0||Nt<0)return;const At=Ur.find(at=>at.sessionIds.includes(Pe));if(At?.sessionIds.includes(Ge)){const at=Rd(At.sessionIds,A).flatMap(Rr=>Rr.sessionIds);wr(At.id,at.indexOf(Pe),at.indexOf(Ge));return}const ct=A.filter(at=>at.sessionIds.length>=2&&at.sessionIds.every(Rr=>Gt.has(Rr))&&!Ur.some(Rr=>at.sessionIds.some(Vr=>Rr.sessionIds.includes(Vr)))),_t=ct.find(at=>at.sessionIds.includes(Pe));if(_t?.sessionIds.includes(Ge)){const at=[..._t.sessionIds];at.splice(at.indexOf(Pe),1),at.splice(_t.sessionIds.indexOf(Ge),0,Pe),E(_t.id,at);return}const _r=at=>Ur.find(Rr=>Rr.sessionIds.includes(at))?.sessionIds??ct.find(Rr=>Rr.sessionIds.includes(at))?.sessionIds??[at],jt=new Set(_r(Pe)),tr=new Set(_r(Ge)),vt=ve.filter(at=>!jt.has(at)),Tt=vt.flatMap((at,Rr)=>tr.has(at)?[Rr]:[]),fr=lt<Nt?Math.max(...Tt)+1:Math.min(...Tt);vt.splice(fr,0,...ve.filter(at=>jt.has(at))),M(vt)};return window.addEventListener("reorder-navigation-session",H),()=>window.removeEventListener("reorder-navigation-session",H)},[i,c,Ot,A,Ur,Gt,wr,E,M]);const Et=y.useCallback(H=>{if(H.type!=="collaboration-member")return!1;if(H.reason==="CANCEL")return!0;const we=H.source.droppableId.replace(/^collaboration-members:/,""),Pe=H.draggableId.replace(/^collaboration-member:/,""),Ge=kt.current;if(Ge?.kind==="split")return Lt(Pe,we,Ge.groupId),I(Ge.sessionId,Pe),!0;if(Ge?.kind==="collaboration"&&Ge.groupId!==we)return Lt(Pe,we,Ge.groupId),!0;if(Ge?.kind==="collaboration"&&Ge.background)return st.has(Pe)&&w(Pe),!0;if(H.destination&&H.destination.droppableId!==H.source.droppableId){const ve=H.destination.droppableId.replace(/^collaboration-members:/,"");if(Ur.some(lt=>lt.id===ve))return Lt(Pe,we,ve),!0}if(H.combine){const ve=H.combine.droppableId.replace(/^collaboration-members:/,"");ve!==we&&Lt(Pe,we,ve);const lt=H.combine.draggableId.replace(/^collaboration-member:/,"");if(A.find(At=>At.sessionIds.includes(Pe))?.sessionIds.includes(lt)){const At=Ur.find(_t=>_t.id===we),ct=At?Rd(At.sessionIds,A).flatMap(_t=>_t.sessionIds).indexOf(lt):-1;ct>=0&&wr(we,H.source.index,ct)}else Gt.has(lt)&&I(lt,Pe);return!0}if(H.destination?.droppableId===H.source.droppableId)return wr(we,H.source.index,H.destination.index),!0;if(Ge?.kind!=="list")return!0;if(Ge?.kind==="list"){const ve=Mt.find(Nt=>`group-sessions:${Nt.key}`===Ge.listId),lt=Ge.listId==="sidebar-entities"?q:ve?Y0(ve.sessions,A,Gt,Ur):null;if(lt){const Nt=lx(lt,Pe,Ge.index);Ge.listId==="sidebar-entities"?M(Nt):ve&&M(Mt.flatMap(At=>At.key===ve.key?Nt:At.sessions.map(ct=>ct.id)))}}return Lt(Pe,we,null),!0},[Ur,q,Mt,Lt,M,wr,Gt,A,st,w,I]),hr=y.useCallback(H=>{if(H.type!=="split-member")return!1;if(H.reason==="CANCEL")return!0;const we=H.draggableId.replace(/^split-member:/,""),Pe=A.find(ct=>ct.sessionIds.includes(we));if(!Pe?.sessionIds.includes(we))return!0;const Ge=Pe.id,ve=kt.current;if(ve?.kind==="split")return Lt(we,null,ve.groupId),I(ve.sessionId,we),!0;if(ve?.kind==="collaboration")return Lt(we,null,ve.groupId),!0;if(!H.destination&&ve?.kind==="list"){const ct=Mt.find(jt=>`group-sessions:${jt.key}`===ve.listId),_t=ve.listId==="sidebar-entities"?q:ct?Y0(ct.sessions,A,Gt,Ur):null;if(!_t)return!0;const _r=lx(_t,we,ve.index);return w(we),ve.listId==="sidebar-entities"?M(_r):ct&&M(Mt.flatMap(jt=>jt.key===ct.key?_r:jt.sessions.map(tr=>tr.id))),!0}if(!H.destination)return!0;const lt=H.destination.droppableId.replace(/^split-members:/,"");if(lt!==Ge){const _t=A.find(_r=>_r.id===lt)?.sessionIds[0];return _t&&I(_t,we),!0}if(H.source.index===H.destination.index)return!0;const Nt=[...Pe.sessionIds],[At]=Nt.splice(H.source.index,1);return At&&(Nt.splice(H.destination.index,0,At),E(Ge,Nt)),!0},[Ur,q,Mt,Lt,I,w,M,E,Gt,A]),Sr=(H,we="top")=>a.jsx("div",{"data-split-exit-drop-index":H,className:`group/split-exit pointer-events-none absolute inset-x-0 z-10 h-2 ${we==="top"?"-top-1":"-bottom-1"}`,children:a.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-1 top-1/2 h-px -translate-y-1/2 rounded-full bg-transparent transition-colors group-data-[active=true]/split-exit:bg-primary"})}),Ir=y.useCallback((H,we,Pe)=>{if(Et(H)||hr(H)||H.reason==="CANCEL")return;const Ge=we.find(ct=>ct.id===H.draggableId);if(!Ge)return;const ve=kt.current;if(ve?.kind==="split"&&Ge.kind==="session"){Lt(Ge.session.id,null,ve.groupId),I(ve.sessionId,Ge.session.id);return}if(ve?.kind==="collaboration"&&Ge.kind==="session"){Lt(Ge.session.id,null,ve.groupId);return}if(H.combine&&Ge.kind!=="session"){const ct=we.findIndex(_t=>_t.id===H.combine?.draggableId);if(ct<0)return;H={...H,combine:null,destination:{...H.source,index:ct}}}if(H.combine){const ct=we.find(vt=>vt.id===H.combine?.draggableId);if(!ct)return;const _t=ct.kind==="workspace"?ct:Ge.kind==="workspace"?Ge:ct,_r=_t===Ge?ct:Ge,jt=_t.sessionIds[0],tr=_r.sessionIds[0];jt&&tr&&jt!==tr&&I(jt,tr);return}if(!H.destination||H.source.index===H.destination.index)return;const lt=[...we],[Nt]=lt.splice(H.source.index,1);if(!Nt)return;lt.splice(H.destination.index,0,Nt);const At=lt.flatMap(ct=>ct.sessionIds);if(Pe===void 0){M(At);return}M(Mt.flatMap(ct=>ct.key===Pe?At:ct.sessions.map(_t=>_t.id)))},[Mt,Et,hr,Lt,I,M]),ln=y.useCallback(H=>{if(H.reason==="CANCEL"||Et(H)||hr(H))return;if(H.type==="group"){if(!H.destination||H.source.index===H.destination.index)return;M(Jx(Mt,H.source.index,H.destination.index));return}const we=H.source.droppableId.replace(/^group-sessions:/,""),Pe=Mt.find(ve=>ve.key===we);if(!Pe)return;const Ge=Y0(Pe.sessions,A,Gt,Ur);if(H.combine||kt.current?.kind==="collaboration"||kt.current?.kind==="split"){Ir(H,Ge,we);return}!H.destination||H.destination.droppableId!==H.source.droppableId||Ir(H,Ge,we)},[Ur,Mt,Gt,A,Et,Ir,hr,M]),zr=H=>{const we=_e===H.id,Pe=[{layout:"horizontal",label:re("tab.splitHorizontal"),icon:dl},{layout:"vertical",label:re("tab.splitVertical"),icon:Km},...H.sessionIds.length>=3||H.layout==="grid"?[{layout:"grid",label:re("tab.splitGrid"),icon:Zm}]:[]],Ge=H.layout==="vertical"?Km:H.layout==="grid"?Zm:dl,ve=Pe.find(lt=>lt.layout===H.layout)?.label??re("tab.splitHorizontal");return a.jsxs("div",{ref:we?We:void 0,className:"relative shrink-0",onPointerDown:lt=>lt.stopPropagation(),children:[a.jsx("button",{type:"button",className:`sidebar-session-action inline-flex h-6 w-6 items-center justify-center rounded-md transition active:scale-95 ${we?"bg-primary/15 text-primary":"text-muted-foreground/70 hover:bg-surface-2 hover:text-foreground"}`,"aria-label":`${re("tab.splitLayout")}: ${ve}`,"aria-haspopup":"menu","aria-expanded":we,title:re("tab.splitLayout"),onClick:lt=>{lt.stopPropagation(),K(Nt=>Nt===H.id?null:H.id)},children:a.jsx(Ge,{size:12})}),we&&a.jsx("div",{role:"menu","aria-label":re("tab.splitLayout"),className:"absolute right-0 top-full z-30 mt-1 flex gap-0.5 rounded-md border border-border bg-surface-elevated p-1 shadow-lg",children:Pe.map(lt=>{const Nt=lt.icon,At=lt.layout===H.layout;return a.jsx("button",{type:"button",role:"menuitemradio","aria-checked":At,"aria-label":lt.label,title:lt.label,className:`sidebar-session-action inline-flex h-7 w-7 items-center justify-center rounded-sm transition active:scale-95 ${At?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,onClick:ct=>{ct.stopPropagation(),k(H.sessionIds[0],lt.layout),K(null)},children:a.jsx(Nt,{size:13})},lt.layout)})})]})},Vn=(H,we)=>we&&a.jsx("button",{type:"button",...we,"aria-label":H,title:H,onClick:Pe=>Pe.stopPropagation(),className:"absolute -left-2 inset-y-0 z-10 flex w-3 cursor-grab items-start justify-center pt-1.5 text-muted-foreground/60 transition hover:text-foreground focus-visible:text-foreground active:cursor-grabbing",children:a.jsx(Pu,{size:10})}),Gr=(H,we,Pe=!1,Ge=!1,ve)=>{if(we.length<2)return null;const lt=we.some(jt=>jt.id===l),Nt=[],At=[],ct=[];for(const jt of we){const tr=c.get(jt.id);tr?.agentStatus==="waiting"||tr?.agentNeedsReview?Nt.push(jt):tr?.agentStatus==="working"?At.push(jt):tr?.inCopyMode&&ct.push(jt)}const _t=H.name?.trim()||`${re("tab.splitWorkspace")} ${A.findIndex(jt=>jt.id===H.id)+1}`,_r=_e===H.id;return a.jsxs("section",{"data-split-workspace":H.id,"aria-label":_t,className:`group/split relative rounded-md p-0.5 before:pointer-events-none before:absolute before:inset-0 before:rounded-md before:border before:border-border transition-colors ${Ge?"bg-primary/15 ring-1 ring-primary/40":Pe?"bg-surface-elevated opacity-90 shadow-lg":Nt.length>0?"bg-[rgb(var(--warning-rgb)_/_0.08)] hover:bg-[rgb(var(--warning-rgb)_/_0.12)]":At.length>0?"bg-[rgb(var(--success-rgb)_/_0.06)] hover:bg-[rgb(var(--success-rgb)_/_0.10)]":ct.length>0?"bg-[rgb(var(--tmux-rgb)_/_0.07)] hover:bg-[rgb(var(--tmux-rgb)_/_0.11)]":lt?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[Vn(`移动分屏组 ${_t}`,ve),a.jsx(ul,{droppableId:`split-members:${H.id}`,type:"split-member",direction:"vertical",children:(jt,tr)=>a.jsxs("div",{ref:jt.innerRef,...jt.droppableProps,"data-split-members":!0,className:tr.isDraggingOver?"rounded-sm bg-primary/10 ring-1 ring-primary/40":"",children:[we.map((vt,Tt)=>a.jsx(cl,{draggableId:`split-member:${vt.id}`,index:Tt,disableInteractiveElementBlocking:!0,children:(fr,at)=>a.jsx("div",{ref:fr.innerRef,...fr.draggableProps,...Q?Dr(()=>Q(vt.id)):{},className:`${Tt===0&&_r?"relative z-20 ":"relative "}flex items-center rounded-sm pr-0.5 transition-colors ${at.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${rn(vt.id)??(vt.id===l?"bg-surface-elevated/80 text-foreground":"text-muted-foreground hover:bg-surface-2")}`,children:ns(vt,fr.dragHandleProps,!0,Tt===0?zr(H):void 0)})},vt.id)),jt.placeholder]})})]})},qn=(H,we,Pe,Ge=!1,ve=!1)=>{if(we.length<(H.federated?1:2))return null;const lt=we.some(_t=>_t.id===l),Nt=Rd(H.sessionIds,A),At=Nt.flatMap(_t=>_t.sessionIds),ct=Nt.length===1?Nt[0]?.workspace:void 0;return a.jsxs("section",{"data-collaboration-group":H.id,"data-collaboration-group-name":H.name,"aria-label":`Agent 工作组:${H.name}`,className:`group/collaboration relative rounded-md p-0.5 before:pointer-events-none before:absolute before:inset-0 before:rounded-md before:border before:border-border transition-colors data-[drop-active=true]:bg-primary/15 data-[drop-active=true]:ring-1 data-[drop-active=true]:ring-primary/40 ${ve?"bg-primary/15 ring-1 ring-primary/40":Ge?"bg-surface-elevated opacity-90 shadow-lg":lt?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[Vn(`移动工作组 ${H.name}`,Pe),a.jsx("button",{type:"button",className:"absolute -right-1 top-1.5 z-10 inline-flex h-4 w-4 items-center justify-center rounded-sm bg-[var(--chrome-bg)] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",title:`打开 ${H.name} 的协作消息`,"aria-label":`打开 Agent 工作组消息:${H.name}`,onClick:_t=>{_t.stopPropagation(),Xt(H.id)},children:a.jsx(bf,{size:9})}),a.jsx(ul,{droppableId:`collaboration-members:${H.id}`,type:"collaboration-member",direction:"vertical",isCombineEnabled:!0,children:(_t,_r)=>a.jsxs("div",{ref:_t.innerRef,..._t.droppableProps,"data-collaboration-members":!0,className:`${_r.isDraggingOver?"rounded-sm bg-primary/10":""}`,children:[Nt.map(jt=>a.jsx("div",{"data-collaboration-split":jt.workspace?.id,"data-split-anchor":jt.workspace?.sessionIds[0],role:jt.workspace?"region":void 0,"aria-label":jt.workspace?`${re("tab.splitWorkspace")} · ${jt.sessionIds.length}`:void 0,className:jt.workspace&&!ct?`relative my-0.5 rounded-sm before:pointer-events-none before:absolute before:inset-0 before:rounded-sm before:border before:border-border data-[drop-active=true]:ring-1 data-[drop-active=true]:ring-primary/40 ${jt.sessionIds.includes(l??"")?"bg-primary/[0.07]":"bg-surface/35"}`:void 0,children:jt.sessionIds.map(tr=>{const vt=Gt.get(tr);return vt?a.jsx(cl,{draggableId:`collaboration-member:${vt.id}`,index:At.indexOf(vt.id),disableInteractiveElementBlocking:!0,children:(Tt,fr)=>a.jsxs("div",{ref:Tt.innerRef,...Tt.draggableProps,"data-collaboration-member":vt.id,"data-split-member":st.has(vt.id)?"true":void 0,...Q?Dr(()=>Q(vt.id)):{},className:`${jt.workspace&&tr===jt.sessionIds[0]&&_e===jt.workspace.id?"z-20 ":""}relative flex items-center rounded-sm pr-0.5 transition-colors data-[drop-active=true]:bg-primary/15 data-[drop-active=true]:ring-1 data-[drop-active=true]:ring-primary/40 ${fr.combineTargetFor?"bg-primary/15 ring-1 ring-primary/40 ":fr.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${rn(vt.id)??(vt.id===l?"bg-surface-elevated/80 text-foreground":st.has(vt.id)?"bg-primary/[0.05] text-muted-foreground hover:bg-primary/[0.09]":"text-muted-foreground hover:bg-surface-2")}`,children:[ns(vt,Tt.dragHandleProps,!0,jt.workspace&&tr===jt.sessionIds[0]?zr(jt.workspace):void 0),!jt.workspace&&st.has(vt.id)&&a.jsx("button",{type:"button",className:"shrink-0 px-1 text-[10px] text-primary",title:`与 ${A.find(at=>at.sessionIds.includes(vt.id))?.sessionIds.filter(at=>at!==vt.id).map(at=>Gt.get(at)?.name??at).join("、")} 分屏`,"aria-label":`查看 ${vt.name} 的跨组分屏`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:vt.id})),Wr()},children:a.jsx(dl,{size:10})})]})},vt.id):null})},jt.workspace?.id??jt.sessionIds[0])),_t.placeholder]})}),H.remoteSessions?.map(_t=>a.jsxs("button",{type:"button",title:`${Ol(_t)} · ${_t.serviceConnected===!1?"服务不可达,消息尚未送达":_t.status}`,className:"flex w-full min-w-0 items-center gap-1.5 rounded-sm px-2 py-1 text-left text-[11px] text-muted-foreground hover:bg-surface-2",onClick:()=>{D6(_t.sessionId).catch(()=>{Xt(H.id)})},children:[a.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${_t.serviceConnected===!1?"bg-muted-foreground":"bg-primary"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:_t.name}),a.jsx("span",{className:"max-w-20 truncate rounded border border-border/20 px-1 text-[9px]",children:Ol(_t)}),_t.serviceConnected===!1&&a.jsx("span",{className:"shrink-0 text-[9px]",children:"不可达"})]},_t.sessionId)),a.jsx("div",{"data-collaboration-background":!0,className:"h-1.5"})]})},In=(H,we,Pe)=>a.jsx(Ch,{onBeforeCapture:Ln,onDragStart:Ye,onDragEnd:Ge=>sr(ve=>Ir(ve,H,Pe),Ge),children:a.jsx(ul,{droppableId:we,direction:"vertical",isCombineEnabled:!Wn,children:Ge=>a.jsxs("div",{ref:Ge.innerRef,...Ge.droppableProps,"data-sidebar-entity-list-id":we,className:"flex-1 space-y-0.5",children:[H.map((ve,lt)=>a.jsx(cl,{draggableId:ve.id,index:lt,disableInteractiveElementBlocking:!0,children:(Nt,At)=>a.jsxs("div",{ref:Nt.innerRef,...Nt.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":lt,className:"relative",children:[Sr(lt),lt===H.length-1&&Sr(H.length,"bottom"),ve.kind==="workspace"?Gr(ve.workspace,ve.members,At.isDragging,!!At.combineTargetFor,Nt.dragHandleProps):ve.kind==="collaboration"?qn(ve.group,ve.members,Nt.dragHandleProps,At.isDragging,!!At.combineTargetFor):a.jsx("div",{...Q?Dr(()=>Q(ve.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${At.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":At.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":rn(ve.session.id)??(ve.session.id===l?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:ns(ve.session,Nt.dragHandleProps)})]})},ve.id)),Ge.placeholder]})})}),cn=a.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[a.jsxs("div",{"data-session-sidebar-header":!0,className:"relative z-20 shrink-0 px-3 py-0.5",children:[a.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-3 bottom-0 z-10 h-px bg-border opacity-40"}),a.jsxs("div",{className:"flex w-full items-center gap-1.5",children:[a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:re("sidebar.sessions")}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:i.length}),Ts>0&&a.jsx("span",{className:"ml-0.5 flex items-center",children:a.jsx(Z6,{count:Ts,tone:"running",title:re("agent.aiRunning")})})]})}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[a.jsx("button",{"data-session-sidebar-header-action":!0,type:"button",onClick:()=>{fe(!1),Xt(null)},className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-primary/15 hover:text-primary active:scale-95","aria-label":"Agent 工作台",title:"Agent 工作台",children:a.jsx(bf,{size:16})}),(!Oe||et)&&a.jsx("button",{"data-session-sidebar-header-action":!0,type:"button",onClick:r,className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-destructive/20 hover:text-destructive active:scale-95","aria-label":re("common.close"),children:a.jsx(Kn,{size:16})})]})]})]}),dt&&a.jsxs("div",{role:"alert",className:"mx-2 mt-2 flex items-start gap-2 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:[a.jsx("span",{className:"min-w-0 flex-1",children:dt}),a.jsx("button",{type:"button","aria-label":"关闭协作错误提示",className:"shrink-0",onClick:()=>Dt(null),children:a.jsx(Kn,{size:14})})]}),a.jsxs("div",{ref:Se,className:"relative z-10 flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain px-1.5 pt-0.5 pb-1.5",children:[Be.length>0&&a.jsxs("section",{className:"mb-2 shrink-0 rounded-lg bg-[rgb(var(--tmux-rgb)_/_0.07)] p-1","aria-label":re("sidebar.recoverableSessions"),children:[a.jsxs("div",{className:"flex min-h-8 items-center gap-2 px-2 text-[10.5px] font-semibold text-[color:var(--tmux)]",children:[a.jsx(sc,{size:12,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:re("sidebar.recoverableSessions")}),a.jsx("span",{className:"text-muted-foreground",children:Be.length}),Ie&&a.jsx("button",{type:"button",onClick:Ie,disabled:ot,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-label":re("sidebar.refreshRecoverableSessions"),title:re("sidebar.refreshRecoverableSessions"),children:a.jsx(rs,{size:11,className:ot?"animate-spin":""})})]}),a.jsx("div",{className:"space-y-0.5",children:Be.slice(0,4).map(H=>{const we=H.friendlyName?.trim()||H.label?.trim()||H.name,Pe=xu(H.cwd??null),Ge=je===H.name;return a.jsxs("button",{type:"button",disabled:je!==null,onClick:()=>Gn(H),className:"group flex min-h-10 w-full min-w-0 items-center gap-2 rounded-md px-2 text-left text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:cursor-wait disabled:opacity-60","aria-label":re("sidebar.restoreRecoverableSession",{name:we}),title:H.cwd||H.name,children:[a.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-[rgb(var(--tmux-rgb)_/_0.11)] text-[color:var(--tmux)]",children:Ge?a.jsx(_n,{size:12,className:"animate-spin"}):a.jsx(Kc,{size:12})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-[11.5px] font-semibold text-foreground",children:we}),a.jsx("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[H.program,Pe].filter(Boolean).join(" · ")||`tmux:${H.name}`})]}),a.jsx("span",{className:"shrink-0 text-[10px] font-medium text-[color:var(--tmux)] group-hover:text-foreground",children:re(Ge?"sidebar.restoringRecoverableSession":"sidebar.restore")})]},H.name)})})]}),i.length===0?a.jsxs("div",{className:"rounded-xl bg-surface-2/60 px-4 py-8 text-center",children:[a.jsx(ko,{size:26,className:"mx-auto mb-2 text-muted-foreground"}),a.jsx("p",{className:"text-[12px] text-muted-foreground",children:re("sidebar.noSessions")})]}):yn.length===0&&A.length===0?a.jsx("div",{className:"rounded-xl bg-surface-2/60 px-4 py-6 text-center",children:a.jsx("p",{className:"text-[12px] text-muted-foreground",children:re("sidebar.noMatchingSessions")})}):Ot?a.jsx("div",{className:"flex flex-1 flex-col",children:a.jsx(Ch,{onBeforeCapture:Ln,onDragStart:Ye,onDragEnd:H=>sr(ln,H),children:a.jsx(ul,{droppableId:"sidebar-groups",type:"group",direction:"vertical",children:H=>a.jsxs("div",{ref:H.innerRef,...H.droppableProps,className:"flex flex-1 flex-col space-y-1.5",children:[Mt.map((we,Pe)=>{const Ge=Fe.has(we.key),ve=!Ge&&Pe===Mt.length-1,lt=Y0(we.sessions,A,Gt,Ur);let Nt=0,At=0;for(const _t of we.sessions){const _r=c.get(_t.id);_r?.agentStatus==="working"&&(Nt+=1),(_r?.agentStatus==="waiting"||_r?.agentNeedsReview)&&(At+=1)}const ct=we.key==="";return a.jsx(cl,{draggableId:`sidebar-group:${we.key||"__ungrouped__"}`,index:Pe,isDragDisabled:ct,disableInteractiveElementBlocking:!0,children:(_t,_r)=>a.jsxs("div",{ref:_t.innerRef,..._t.draggableProps,className:`shrink-0 rounded-md transition-colors ${ve?"flex flex-1 flex-col ":""}${_r.isDragging?"bg-surface-elevated shadow-lg opacity-90":""}`,children:[a.jsxs("button",{type:"button",...ct?{}:_t.dragHandleProps,onClick:()=>{yr(we.key),ue.current.delete(we.key)},className:`flex w-full shrink-0 items-center gap-1.5 rounded-md px-1.5 py-1 text-left text-muted-foreground transition hover:bg-surface-2 ${ct?"":"cursor-grab active:cursor-grabbing"}`,title:we.key||we.label,children:[a.jsx(Yc,{size:13,className:`shrink-0 transition-transform ${Ge?"":"rotate-90"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold uppercase tracking-wide",children:we.label}),Nt>0&&a.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)] animate-pulse"}),At>0&&a.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] animate-pulse"}),a.jsx(w5,{sessionIds:we.sessions.map(jt=>jt.id)}),a.jsx("span",{className:"shrink-0 text-[10.5px] text-muted-foreground/70",children:we.sessions.length})]}),!Ge&&a.jsx("div",{className:`mt-0.5 pl-2 ${ve?"flex flex-1 flex-col":""}`,children:a.jsx(ul,{droppableId:`group-sessions:${we.key}`,type:"session",direction:"vertical",isCombineEnabled:!Wn,children:jt=>a.jsxs("div",{ref:jt.innerRef,...jt.droppableProps,"data-sidebar-entity-list-id":`group-sessions:${we.key}`,className:`${ve?"flex-1 ":""}space-y-0.5`,children:[lt.map((tr,vt)=>a.jsx(cl,{draggableId:tr.id,index:vt,disableInteractiveElementBlocking:!0,children:(Tt,fr)=>a.jsxs("div",{ref:Tt.innerRef,...Tt.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":vt,className:"relative",children:[Sr(vt),vt===lt.length-1&&Sr(lt.length,"bottom"),tr.kind==="workspace"?Gr(tr.workspace,tr.members,fr.isDragging,!!fr.combineTargetFor,Tt.dragHandleProps):tr.kind==="collaboration"?qn(tr.group,tr.members,Tt.dragHandleProps,fr.isDragging,!!fr.combineTargetFor):a.jsx("div",{...Q?Dr(()=>Q(tr.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${fr.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":fr.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":rn(tr.session.id)??(tr.session.id===l?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:ns(tr.session,Tt.dragHandleProps)})]})},tr.id)),jt.placeholder]})})})]})},we.key||"__ungrouped__")}),H.placeholder]})})})}):In(q,"sidebar-entities")]}),a.jsx(b8,{onReselect:()=>{h&&(Ve.current=null,Ue(H=>H+1),h())}}),Le&&a.jsx(rj,{directories:i.flatMap(H=>{const we=c.get(H.id)?.cwd;return we?[we]:[]}),tmuxAvailable:de,options:Wt,agents:Jt,selectedAgent:ur,detecting:Er,resumeHistory:ge,resumeHistoryLoading:ht,resumeHistoryPendingId:be,resumeHistoryError:le,onRefreshAgents:()=>{X().catch(()=>{})},onSelectAgent:H=>{Re(H).catch(()=>{})},onLaunchAgent:Pn,onResumeHistory:H=>{hn(H)},onRemoveResumeHistory:H=>{kn(H)},onClose:()=>fe(!1),onOptionsChange:lr,additionalContent:Qt&&V?.latestVersion&&a.jsxs("div",{className:"mb-1 rounded-lg bg-[rgb(var(--warning-rgb)_/_0.10)] px-2.5 py-2.5 text-foreground",children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]",children:a.jsx(rs,{size:13,className:V.status==="installing"||V.status==="restarting"?"animate-spin":""})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-semibold",children:re("sidebar.updateAvailable",{version:V.latestVersion})}),a.jsx("span",{className:"mt-0.5 block text-[10.5px] leading-relaxed text-muted-foreground",children:V.status==="installing"?re("sidebar.updateInstalling"):V.status==="ready"?re("sidebar.updateReady"):V.status==="restarting"?re("sidebar.updateRestarting"):re("sidebar.updateFailed")})]})]}),V.status==="ready"&&te&&a.jsx("button",{type:"button",disabled:$,onClick:te,className:"mt-2 flex w-full items-center justify-center rounded-md bg-[var(--warning)] px-2 py-1.5 text-[11px] font-semibold text-[color:var(--bg)] transition hover:opacity-90 disabled:cursor-wait disabled:opacity-60",children:re("sidebar.updateRestart")}),V.status==="error"&&se&&a.jsx("button",{type:"button",disabled:$,onClick:se,className:"mt-2 flex w-full items-center justify-center rounded-md bg-surface-elevated px-2 py-1.5 text-[11px] font-semibold text-foreground transition hover:bg-surface-2 disabled:cursor-wait disabled:opacity-60",children:re("sidebar.updateRetry")})]}),footerActions:a.jsx(kj,{serverAttention:It,onOpenSettings:()=>{fe(!1),j()},actions:[...F?[{label:re("sidebar.subscriptionQuota"),icon:J9,onSelect:()=>{fe(!1),F()}}]:[],{label:"Agent 工作台",icon:bf,onSelect:()=>{fe(!1),Xt(null)}},{label:"服务与设备",icon:y8,onSelect:()=>{fe(!1),v8()}},...ce?[{label:re(et?"sidebar.unpinSidebar":"sidebar.pinSidebar"),icon:et?wu:vu,separated:!0,onSelect:()=>{fe(!1),ce()}}]:[]]})}),$e&&a.jsx(nx,{onFloatingChange:async H=>{H&&(await Xt(H),ze(!1))},activeSessionId:l,defaultSessionMode:oe,onClose:()=>ze(!1),onNewSession:H=>p(H)}),Object.entries(Ee).map(([H,we])=>a.jsx(nx,{activeSessionId:l,initialCollaborationGroupId:H,initialFloating:we,onFloatingChange:Pe=>tt(H,Pe),defaultSessionMode:oe,onClose:()=>{wt.current=!0,ee(Pe=>{const Ge={...Pe};return delete Ge[H],Ge})},onNewSession:Pe=>p(Pe)},H)),!Le&&a.jsx("div",{className:"relative z-10 shrink-0 bg-[var(--chrome-bg)] px-3 pb-3 pt-1 md:border-t md:border-border md:p-2",children:a.jsxs("div",{className:`grid gap-1.5 [&>button]:min-h-11 [&>button]:shadow-none [&>button]:ring-0 md:[&>button]:min-h-0 ${ur?"grid-cols-[minmax(0,1fr)_minmax(0,1fr)_2.5rem]":"grid-cols-[minmax(0,1fr)_2.5rem]"}`,children:[a.jsxs("button",{type:"button",onClick:An,className:`flex min-w-0 items-center justify-center gap-2 rounded-lg px-2 py-2.5 text-[12px] font-semibold transition active:scale-[0.99] ${ur?"bg-surface-elevated text-foreground ring-1 ring-border/30 hover:bg-surface-2":"bg-primary text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 hover:bg-primary/90"}`,title:re("sidebar.newSession"),"aria-label":re("sidebar.newSession"),children:[a.jsx(ko,{size:15,className:"shrink-0"}),a.jsx("span",{className:"truncate",children:"Terminal"})]}),ur&&a.jsxs("button",{type:"button",onClick:jn,className:"flex min-w-0 items-center justify-center gap-2 rounded-lg bg-primary px-2 py-2.5 text-[12px] font-semibold text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 transition hover:bg-primary/90 active:scale-[0.99]",title:re("sidebar.newSessionWithAgent",{agent:ur.displayName}),"aria-label":re("sidebar.newSessionWithAgent",{agent:ur.displayName}),children:[a.jsx(dc,{agent:ur,size:15}),a.jsx("span",{className:"truncate",children:ur.displayName})]}),a.jsxs("button",{type:"button",onClick:Tn,className:"relative inline-flex w-10 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-[0.97]",title:ar,"aria-label":ar,"aria-expanded":Le,"aria-controls":"sidebar-launch-options",children:[a.jsx(Pl,{size:15}),It&&a.jsx("span",{className:"absolute right-0.5 top-0.5 h-2 w-2 rounded-full bg-destructive ring-2 ring-[var(--chrome-bg)]","aria-hidden":"true"}),Qt&&a.jsx("span",{className:`absolute top-0.5 h-2 w-2 rounded-full bg-[var(--warning)] ring-2 ring-[var(--chrome-bg)] ${It?"right-3.5":"right-0.5"}`,"aria-hidden":"true"})]})]})})]});return et?a.jsx("div",{"data-session-sidebar-pinned":!0,className:"h-full flex flex-col app-chrome-bg border-r border-border",children:cn}):a.jsx(V6,{side:"left",isOpen:e,drawerWidthPx:t,onClose:r,onOpen:n,push:Oe,children:cn})}function Nj(){const{t:e}=Mr();return a.jsxs("div",{role:"status","aria-label":e("rightSidebar.loadingGitChanges"),className:"td-loading-skeleton flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[a.jsx("span",{className:"sr-only",children:e("rightSidebar.loadingGitChanges")}),a.jsxs("div",{"aria-hidden":"true",className:"shrink-0 border-b border-border/15 px-3 py-2",children:[a.jsxs("div",{className:"mb-2 flex h-5 items-center gap-1",children:[a.jsx("div",{className:"h-4 w-16 rounded bg-surface-2"}),a.jsx("div",{className:"h-4 w-7 rounded bg-surface-2"}),a.jsx("div",{className:"h-4 w-12 rounded bg-surface-2"})]}),a.jsxs("div",{className:"flex h-[15px] items-center justify-between",children:[a.jsx("div",{className:"h-2 w-14 rounded bg-surface-2"}),a.jsx("div",{className:"h-2 w-6 rounded bg-surface-2"})]}),a.jsxs("div",{className:"mt-2 flex h-7 items-center gap-1.5",children:[a.jsx("div",{className:"h-7 w-12 rounded-full bg-surface-2"}),a.jsx("div",{className:"h-7 w-16 rounded-full bg-surface-2"}),a.jsx("div",{className:"h-3 w-24 max-w-[30%] rounded bg-surface-2"}),a.jsx("div",{className:"ml-auto h-4 w-4 rounded-full bg-surface-2"})]})]}),a.jsxs("div",{"aria-hidden":"true",className:"overflow-hidden px-3 py-2",children:[a.jsxs("div",{className:"flex h-8 items-center gap-2",children:[a.jsx("div",{className:"h-3 w-3 rounded-sm bg-surface-2"}),a.jsx("div",{className:"h-2 w-32 max-w-[55%] rounded bg-surface-2"})]}),["w-3/5","w-2/5","w-1/2","w-1/3"].map((t,r)=>a.jsxs("div",{className:"flex h-9 items-center gap-2 pl-5",style:{opacity:1-r*.15},children:[a.jsx("div",{className:"h-3 w-3 shrink-0 rounded-sm bg-surface-2"}),a.jsx("div",{className:`h-2 rounded bg-surface-2 ${t}`})]},t))]})]})}function Rj({slow:e=!1}){const{t}=Mr();return a.jsxs("div",{role:"status","aria-label":t("rightSidebar.loadingGitChanges"),className:"td-loading-skeleton relative h-full min-h-0 overflow-hidden bg-surface px-3",children:[a.jsx("span",{className:"sr-only",children:t("rightSidebar.loadingGitChanges")}),a.jsxs("div",{"aria-hidden":"true",children:[a.jsxs("div",{className:"flex h-[76px] items-center gap-2 border-b border-border/40 px-2",children:[a.jsx("div",{className:"h-6 w-6 rounded-md bg-surface-2"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"h-3 w-16 rounded bg-surface-2"}),a.jsx("div",{className:"h-2 w-12 rounded bg-surface-2"})]})]}),a.jsxs("div",{className:"flex h-11 items-center gap-2 px-1 pt-3",children:[a.jsx("div",{className:"h-6 w-6 rounded-md bg-surface-2"}),a.jsx("div",{className:"h-3 w-16 rounded bg-surface-2"}),a.jsx("div",{className:"ml-auto h-4 w-12 rounded-full bg-surface-2"})]}),[!1,!0].map(r=>a.jsxs("div",{className:"border-b border-border/40 px-1 py-4",children:[a.jsxs("div",{className:"mb-2 flex h-8 items-center justify-between",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"h-3 w-14 rounded bg-surface-2"}),r&&a.jsx("div",{className:"h-2 w-28 rounded bg-surface-2"})]}),a.jsx("div",{className:"h-8 w-12 rounded-md bg-surface-2"})]}),a.jsx("div",{className:"h-10 rounded-md bg-surface-2"})]},String(r))),a.jsx("div",{className:"flex h-[69px] items-center border-b border-border/40 px-2",children:a.jsx("div",{className:"h-3 w-16 rounded bg-surface-2"})}),a.jsxs("div",{className:"space-y-2 px-1 py-4",children:[a.jsxs("div",{className:"flex h-8 items-center justify-between",children:[a.jsx("div",{className:"h-3 w-14 rounded bg-surface-2"}),a.jsx("div",{className:"h-8 w-28 rounded-md bg-surface-2"})]}),a.jsx("div",{className:"h-7 rounded-md bg-surface-2"}),a.jsx("div",{className:"h-10 rounded-md bg-surface-2"})]})]}),e&&a.jsx("div",{className:"absolute inset-x-3 bottom-3 rounded-md bg-surface-elevated px-3 py-2 text-xs text-muted-foreground",children:t("rightSidebar.loadingGitChangesSlow")})]})}const sy=()=>$d(()=>import("./RightSidebar-BK6vWNw3.js").then(e=>e.R),__vite__mapDeps([6,1,2,3,4,5,7,8,9,10,11,12,13,14,15,16])).then(e=>({default:e.RightSidebar})),Mj=y.lazy(sy);function ux(e){const t=y.useRef(!1);y.useEffect(()=>{const p=navigator.connection;if(!(p?.saveData||/2g|3g/.test(p?.effectiveType??"")))return L1(()=>{sy().catch(()=>{})},3e3)},[]);const{t:r}=Mr(),n=Zt(p=>p.rootPath),i=Zt(p=>p.rightTab),l=Zt(p=>p.setRightTab),c=n?.replace(/\/+$/,"").split("/").pop()||r("rightSidebar.workspace");(e.isOpen||e.pinned)&&(t.current=!0);const h=a.jsx(V6,{side:"right",isOpen:e.isOpen,drawerWidthPx:e.drawerWidthPx,onClose:e.onClose,onOpen:e.onOpen,pinned:e.pinned,children:a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[a.jsxs("div",{className:"shrink-0 border-b border-border/15 bg-surface px-2 pt-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"min-w-0 flex-1 px-1",children:a.jsx("div",{className:"flex min-h-[1.25rem] items-baseline gap-1.5",children:a.jsx("span",{className:"truncate text-[13px] font-semibold text-foreground",children:c})})}),a.jsx("div",{"aria-hidden":"true",className:"flex items-center gap-1.5",children:[Mh,aA,Pl].map((p,g)=>a.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-full bg-surface-2 text-muted-foreground",children:a.jsx(p,{size:14})},g))}),a.jsx("button",{type:"button",onClick:e.onClose,"aria-label":r("common.close"),className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",children:a.jsx(Kn,{size:14})})]}),a.jsx("div",{className:"mt-2 grid grid-cols-3 gap-0.5 rounded-md bg-surface-2 p-0.5",children:[["git",D9,"rightSidebar.tabGit"],["diff",Q9,"rightSidebar.tabChanges"],["files",hc,"rightSidebar.tabFiles"]].map(([p,g,x])=>a.jsxs("button",{type:"button",onClick:()=>l(p),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium ${i===p?"bg-surface-elevated text-foreground":"text-muted-foreground"}`,children:[a.jsx(g,{size:12}),r(x)]},p))}),a.jsx("div",{className:"h-2"})]}),a.jsx("div",{className:"min-h-0 flex-1 bg-surface",children:i==="git"?a.jsx(Rj,{}):a.jsx(Nj,{})})]})});return t.current?a.jsx(y.Suspense,{fallback:h,children:a.jsx(Mj,{...e})}):h}const dx=Du(e=>({overlay:"off",setOverlay:t=>e({overlay:t})}));function Dj(e){let t=1,r="terminal";for(;;){let n=!1;for(const i of e.values())if(i.name===r){n=!0;break}if(!n)break;r=`terminal-${t}`,t++}return r}const Bj=Du((e,t)=>({sessions:new Map,activeSessionId:null,nextSessionNumber:1,createSession:r=>{const n=gb(),i=Date.now(),l=t().sessions,c=Dj(l),h={id:n,cwd:r,sessionId:null,name:c,customName:!1,createdAt:i,lastActivity:i};return e(p=>{const g=new Map(p.sessions);return g.set(n,h),{sessions:g,activeSessionId:p.activeSessionId??n,nextSessionNumber:p.nextSessionNumber+1}}),n},closeSession:r=>{e(n=>{const i=new Map(n.sessions),l=n.activeSessionId===r;i.delete(r);let c=n.activeSessionId;if(l){const h=Array.from(i.keys());c=h.length>0?h[0]:null}return{sessions:i,activeSessionId:c}})},switchSession:r=>{e(n=>n.sessions.has(r)?{activeSessionId:r}:n)},updateSession:(r,n)=>{e(i=>{const l=i.sessions.get(r);if(!l)return i;const c=new Map(i.sessions);return c.set(r,{...l,...n,lastActivity:Date.now()}),{sessions:c}})},setTerminalSession:(r,n)=>{t().updateSession(r,{sessionId:n.sessionId})},getActiveSession:()=>{const r=t();if(r.activeSessionId)return r.sessions.get(r.activeSessionId)},getSessionCount:()=>t().sessions.size,clearAllSessions:()=>{e({sessions:new Map,activeSessionId:null,nextSessionNumber:1})}})),Qj=[7e5,1e6,14e5,18e5,24e5,32e5,4e6,5e6,6e6,8e6,1e7,12e6].map(e=>({id:"auto",maxSize:1600,bitRate:e,maxFps:30}));class jj{level=6;badSince=null;goodSince=null;connectedAt=0;lastSample=-1/0;lastChange=-1/0;lastUpgrade=-1/0;upgradeAfter=0;failedProbes=0;baselineRtt=1/0;get quality(){return Qj[this.level]}connected(t){this.connectedAt=t,this.badSince=this.goodSince=null,this.lastSample=-1/0}sample(t,r,n=1600){if(r-this.lastSample>2500&&(this.badSince=this.goodSince=null),this.lastSample=r,t.rttMs!==null&&(this.baselineRtt=Math.min(this.baselineRtt,t.rttMs)),r-this.connectedAt<3e3)return null;const i=t.rttMs!==null&&t.rttMs>this.baselineRtt+150,l=t.deliveryDelayMs>250||t.decodeQueue>=4||i&&t.frames>0&&t.deliveryDelayMs>100,c=t.deliveryDelayMs>800||t.decodeQueue>=8,h=t.rttMs!==null&&t.rttMs<this.baselineRtt+100&&t.deliveryDelayMs<80&&t.decodeQueue<=1;this.badSince=l?this.badSince??r:null,this.goodSince=h?this.goodSince??r:null;const p=n<=1080?7:n<=1600?9:11;if(this.badSince!==null&&r-this.badSince>=(c?1e3:2e3)&&r-this.lastChange>=(c?2e3:3e3)&&this.level>0){this.level=Math.max(0,this.level-(c?2:1));const g=r-this.lastUpgrade<2e4;this.failedProbes=g?this.failedProbes+1:0,this.upgradeAfter=r+(g?Math.min(3e4,8e3*2**(this.failedProbes-1)):5e3),this.lastUpgrade=-1/0}else if(this.goodSince!==null&&r-this.goodSince>=3e3&&r-this.lastChange>=4e3&&r>=this.upgradeAfter&&this.level<p)this.level++,this.lastUpgrade=r;else return null;return this.lastChange=r,this.badSince=this.goodSince=null,this.quality}}async function xc(e,t){const r=await fetch(e,{...t,headers:{"Content-Type":"application/json",Accept:"application/json",...t?.headers??{}}}),n=await r.json().catch(()=>null);if(!r.ok||!n){const i=n?.error||n?.code||`ANDROID_REQUEST_FAILED_${r.status}`;throw new Error(i)}return n}async function Pj(){return xc("/api/android/devices")}async function Oj(e){return xc("/api/android/connect",{method:"POST",body:JSON.stringify({address:e})})}const Nh=[{id:"low",maxSize:720,bitRate:12e5,maxFps:30},{id:"medium",maxSize:1080,bitRate:4e6,maxFps:30},{id:"high",maxSize:1600,bitRate:8e6,maxFps:60}],Mu=Nh[1];function A1(e){if(!e||typeof e!="object")return Mu;const t=e;if(t.id==="auto")return{id:"auto",maxSize:1600,bitRate:4e6,maxFps:30};const r=Nh.find(c=>c.id===t.id);if(r)return r;if(t.id!=="custom")return Mu;const n=typeof t.maxSize=="number"?Math.max(360,Math.min(2160,Math.round(t.maxSize))):1080,i=typeof t.bitRate=="number"?Math.max(3e5,Math.min(3e7,Math.round(t.bitRate))):4e6,l=typeof t.maxFps=="number"?Math.max(0,Math.min(60,Math.round(t.maxFps))):30;return{id:"custom",maxSize:n,bitRate:i,maxFps:l}}function Fj(e,t){if(!/^[0-9a-zA-Z_.:\-]{1,128}$/.test(e))throw new Error("INVALID_SERIAL");const r=new URLSearchParams;t&&(r.set("max_size",String(t.maxSize)),r.set("bit_rate",String(t.bitRate)),t.maxFps>0&&r.set("max_fps",String(t.maxFps)));const n=r.toString();return`/api/android/${e}/ws${n?`?${n}`:""}`}function hx(e){const t={ADB_UNAVAILABLE:"本机没有可用的 adb,请先安装 Android platform-tools。",ADB_NOT_FOUND:"找不到 adb 可执行文件,可用 TERMDOCK_ADB_BIN 指定路径。",SCRCPY_NOT_FOUND:"本机没有 scrcpy,请先安装(含 scrcpy-server)。",SCRCPY_SERVER_NOT_FOUND:"找不到 scrcpy-server,可用 TERMDOCK_SCRCPY_SERVER 指定路径。",SCRCPY_VERSION_UNKNOWN:"无法读取 scrcpy 版本,请确认 scrcpy --version 可执行。",SCRCPY_CONNECT_TIMEOUT:"设备连接超时,请确认已授权 USB 调试并保持解锁。",SCRCPY_UNSUPPORTED_CODEC:"设备返回了不支持的视频编码。",INVALID_ADDRESS:"地址格式不正确,应为 ip:port。",API_NOT_ALLOWED:"当前设备权限不足:投屏需要全权服务授权。"};for(const[r,n]of Object.entries(t))if(e.includes(r))return n;return e}function $j(e){return xc(`/api/android/recordings?serial=${encodeURIComponent(e)}`)}function Uj(e){return xc("/api/android/recordings",{method:"POST",body:JSON.stringify({serial:e})})}function zj(e){return xc(`/api/android/recordings/${encodeURIComponent(e)}/stop`,{method:"POST"})}function Hj(e,t){return xc(`/api/android/recordings/${encodeURIComponent(e)}/save`,{method:"POST",body:JSON.stringify({directory:t})})}function Wj(e){return xc(`/api/android/recordings/${encodeURIComponent(e)}`,{method:"DELETE"})}const Gj=0,Vj=1,qj=2,Yj=3,Zj=4,Kj=5,Xj=7,Jj=10,eP=11,tP=16,fx=17,px=0,wp=1,rP=2,mx=3,Ap=0,gx=1,xx=1,Bc=0xffffffffffffffffn,Md=0xfffffffffffffffen,Z0={HOME:3,APP_SWITCH:187,POWER:26,VOLUME_UP:24,VOLUME_DOWN:25};function iy(e,t,r){e.setUint32(t,Math.max(0,Math.round(r.x))&4294967295),e.setUint32(t+4,Math.max(0,Math.round(r.y))&4294967295),e.setUint16(t+8,Math.min(65535,Math.round(r.screenWidth))),e.setUint16(t+10,Math.min(65535,Math.round(r.screenHeight)))}function nP(e,t,r,n,i,l){const c=new Uint8Array(32),h=new DataView(c.buffer);return h.setUint8(0,qj),h.setUint8(1,e),h.setBigUint64(2,t),iy(h,10,r),h.setUint16(22,Math.max(0,Math.min(65535,Math.round(n*65536)))),h.setUint32(24,i>>>0),h.setUint32(28,l>>>0),c}function Tp(e,t,r=0,n=0){const i=new Uint8Array(14),l=new DataView(i.buffer);return l.setUint8(0,Gj),l.setUint8(1,e),l.setUint32(2,t>>>0),l.setUint32(6,r>>>0),l.setUint32(10,n>>>0),i}function sP(e,t,r,n=0){const i=new Uint8Array(21),l=new DataView(i.buffer);l.setUint8(0,Yj),iy(l,1,e);const c=h=>Math.max(-32768,Math.min(32767,Math.round(Math.max(-1,Math.min(1,h/16))*32768)));return l.setInt16(13,c(t)),l.setInt16(15,c(r)),l.setUint32(17,n>>>0),i}function iP(e){const t=new TextEncoder().encode(e);if(!t.length)return null;const r=t.subarray(0,300),n=new Uint8Array(5+r.length),i=new DataView(n.buffer);return i.setUint8(0,Vj),i.setUint32(1,r.length),n.set(r,5),n}function aP(e){const t=new TextEncoder().encode(e);if(!t.length||t.length>255)return null;const r=new Uint8Array(2+t.length);return r[0]=tP,r[1]=t.length,r.set(t,2),r}function K0(e){return new Uint8Array([e])}function bx(e){return new Uint8Array([Zj,e])}function oP(e){return new Uint8Array([Jj,e?1:0])}function lP(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)}function cP(e){const t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Cp(e){return e.toString(16).padStart(2,"0")}function ay(e,t,r){for(let n=0;n+4<e.length;n++){const i=e[n]===0&&e[n+1]===0&&e[n+2]===1,c=e[n]===0&&e[n+1]===0&&e[n+2]===0&&e[n+3]===1?n+4:i?n+3:-1;if(c<0||c>=e.length)continue;if((r?e[c]>>1&63:e[c]&31)!==t){n=c-1;continue}let p=c+1;for(;p+2<e.length&&!(e[p]===0&&e[p+1]===0&&(e[p+2]===1||e[p+2]===0&&e[p+3]===1));)p++;return e.subarray(c,Math.min(e.length,p))}return null}function uP(e){const t=e?ay(e,7,!1):null;return t&&t.length>=4?`avc1.${Cp(t[1])}${Cp(t[2])}${Cp(t[3])}`:"avc1.42e01e"}function dP(e){const t=e?ay(e,32,!0):null;if(t&&t.length>=13){const r=t[1]>>6&3,n=t[1]&31,i=t[12];return`hev1.${r}.${n}.L${i}.B0`}return"hev1.1.6.L120.B0"}class hP{constructor(t,r){this.canvas=t,this.callbacks=r}canvas;callbacks;liveBitrate=!1;bitrateFailureDetail;get lastBitrateFailure(){return this.bitrateFailureDetail}bitrateRequestId=0;bitratePending=null;get supportsLiveBitrate(){return this.liveBitrate}get canSetBitrate(){return this.liveBitrate&&!this.bitratePending&&this.socket?.readyState===1}setBitrate(t){return!this.canSetBitrate||!Number.isInteger(t)||t<3e5||t>3e7?Promise.resolve(!1):new Promise(r=>{const n=++this.bitrateRequestId,i=setTimeout(()=>this.finishBitrate(!1,`BITRATE_CLIENT_TIMEOUT: requested=${t} bps; no server confirmation within 4000ms`),4e3);this.bitratePending={id:n,value:t,resolve:r,timer:i},this.send({type:"bitrate",requestId:n,bitRate:t})})}finishBitrate(t,r){const n=this.bitratePending;n&&(this.bitratePending=null,clearTimeout(n.timer),t||(this.liveBitrate=!1,this.bitrateFailureDetail=r??this.bitrateFailureDetail??"BITRATE_REASON_UNAVAILABLE: server rejected adjustment without a diagnostic",this.closedByUser||this.callbacks.onBitrateSupport?.(!1,this.bitrateFailureDetail)),n.resolve(t))}socket=null;decoder=null;configured=!1;configData=null;header=null;closedByUser=!1;lastMessageAt=0;lastFrameAt=0;lastResetAt=0;heartbeat=null;statsTimer=null;stallTimer=null;pendingConfig=null;needsKeyframe=!1;frameCount=0;receivedFrames=0;decodedFrames=0;controlsSent=0;lastSeq=0;lastType="";bytesSinceSample=0;warnedUnsupported=!1;lastSampleAt=0;serial="";autoQuality=!1;pingAt=null;rttMs=null;rttAt=0;minimumFrameOffset=1/0;deliveryDelayMs=0;peakDecodeQueue=0;sampleFrames=0;get currentHeader(){return this.header}connect(t,r){this.liveBitrate=!1,this.bitrateFailureDetail=void 0,this.serial=t,this.autoQuality=r?.id==="auto",this.closedByUser=!1,this.callbacks.onState("connecting");let n;try{n=T8(Fj(t,r))}catch(i){this.callbacks.onState("error",i instanceof Error?i.message:"ANDROID_STREAM_FAILED");return}this.socket=n,n.onopen=()=>{this.lastMessageAt=Date.now()},n.onmessage=i=>{this.closedByUser||this.handleMessage(i.data)},n.onerror=()=>{this.closedByUser||this.callbacks.onState("error","SCRCPY_CONNECTION_LOST")},n.onclose=()=>{this.finishBitrate(!1,"BITRATE_CONNECTION_CLOSED: preview connection closed"),this.liveBitrate=!1,this.teardownTimers(),this.closedByUser?this.callbacks.onState("idle"):this.callbacks.onState("error","SCRCPY_CONNECTION_CLOSED")},this.startTimers()}disconnect(){this.closedByUser=!0,this.finishBitrate(!1),this.liveBitrate=!1,this.teardownTimers();try{this.decoder?.close()}catch{}this.decoder=null,this.configured=!1;try{this.socket?.close()}catch{}this.socket=null,this.callbacks.onState("idle")}teardownTimers(){this.heartbeat&&clearInterval(this.heartbeat),this.statsTimer&&clearInterval(this.statsTimer),this.stallTimer&&clearInterval(this.stallTimer),this.heartbeat=null,this.statsTimer=null,this.stallTimer=null}startTimers(){this.lastSampleAt=Date.now(),this.heartbeat=setInterval(()=>{if(!(!this.socket||this.socket.readyState!==1)){if(Date.now()-this.lastMessageAt>45e3){try{this.socket.close()}catch{}return}this.pingAt===null&&(this.pingAt=performance.now(),this.send({type:"ping"}))}},this.autoQuality?2e3:15e3),this.stallTimer=setInterval(()=>{if(!this.header||this.closedByUser)return;const t=Date.now();t-this.lastFrameAt>8e3&&t-this.lastResetAt>8e3&&(this.lastResetAt=t,console.warn("[android] no frames for 8s; requesting keyframe reset"),this.sendControl(K0(fx)))},2e3),this.statsTimer=setInterval(()=>{const t=Date.now(),r=(t-this.lastSampleAt)/1e3;r<=0||(this.callbacks.onStats({fps:Math.round(this.frameCount/r*10)/10,kbps:Math.round(this.bytesSinceSample*8/r/1e3),width:this.header?.width??0,height:this.header?.height??0,received:this.receivedFrames,decoded:this.decodedFrames,controls:this.controlsSent,last:this.lastType,adaptation:this.autoQuality?{rttMs:this.pingAt!==null&&performance.now()-this.pingAt>2e3?performance.now()-this.pingAt:performance.now()-this.rttAt<6e3?this.rttMs:null,deliveryDelayMs:this.sampleFrames?this.deliveryDelayMs:0,decodeQueue:Math.max(this.peakDecodeQueue,this.decoder?.decodeQueueSize??0),frames:this.sampleFrames}:void 0}),this.sampleFrames=0,this.peakDecodeQueue=0,this.frameCount=0,this.bytesSinceSample=0,this.lastSampleAt=t)},1e3)}send(t){if(!(!this.socket||this.socket.readyState!==1))try{this.socket.send(JSON.stringify(t))}catch{}}sendControl(t){t&&(this.controlsSent++,this.send({type:"control",data:lP(t)}))}ack(){this.send({type:"ack",seq:this.lastSeq})}handleMessage(t){if(typeof t!="string")return;this.lastMessageAt=Date.now();let r;try{r=JSON.parse(t)}catch{return}this.lastType=`${r.type??"?"}${r.config?":cfg":""}${r.key?":key":""}`;try{this.dispatchMessage(r)}catch(n){console.warn("[android] message handling failed",n),this.callbacks.onWarning(`处理消息失败:${n instanceof Error?n.message:String(n)}`)}}dispatchMessage(t){switch(t.type){case"bitrate-support":this.liveBitrate=t.supported===!0,this.bitrateFailureDetail=this.liveBitrate?void 0:typeof t.detail=="string"?t.detail.slice(0,4096):"BITRATE_REASON_UNAVAILABLE: server did not provide diagnostics",this.liveBitrate||this.finishBitrate(!1,this.bitrateFailureDetail),this.callbacks.onBitrateSupport?.(this.liveBitrate,this.bitrateFailureDetail);break;case"bitrate-result":t.requestId===this.bitratePending?.id&&this.finishBitrate(t.applied===!0&&t.bitRate===this.bitratePending?.value,typeof t.detail=="string"?t.detail.slice(0,4096):void 0);break;case"header":this.header={deviceName:t.deviceName??this.serial,codec:t.codec??"h264",width:t.width??0,height:t.height??0},this.lastFrameAt=Date.now(),this.callbacks.onHeader(this.header),this.callbacks.onState("streaming");break;case"frame":this.handleFrame(t);break;case"error":this.callbacks.onState("error",t.message||"SCRCPY_ERROR");break;case"closed":this.callbacks.onState("error","SCRCPY_SESSION_CLOSED");break;case"pong":this.pingAt!==null&&(this.rttMs=performance.now()-this.pingAt,this.rttAt=performance.now(),this.pingAt=null);break}}handleFrame(t){if(typeof t.data!="string")return;typeof t.seq=="number"&&(this.lastSeq=t.seq);const r=cP(t.data);if(this.bytesSinceSample+=t.data.length,this.receivedFrames++,this.lastFrameAt=Date.now(),this.decoder?.state==="closed"&&(this.decoder=null,this.configured=!1),t.config){this.configData=r,this.pendingConfig=r,this.configureDecoder(),this.ack();return}this.sampleFrames++;const n=Number(t.pts);if(t.pts!==void 0&&Number.isFinite(n)){const c=performance.now()-n/1e3;this.minimumFrameOffset=Math.min(this.minimumFrameOffset,c),this.deliveryDelayMs=Math.max(0,c-this.minimumFrameOffset)}this.configured||this.configureDecoder();const i=t.key===!0;if(this.needsKeyframe&&!i){this.ack();return}let l=r;this.pendingConfig&&(l=new Uint8Array(this.pendingConfig.length+r.length),l.set(this.pendingConfig,0),l.set(r,this.pendingConfig.length),this.pendingConfig=null),i&&(this.needsKeyframe=!1),this.decode(l,i,t.pts),this.ack()}configureDecoder(){const t=this.header?.codec??"h264";if(!this.decoder||this.decoder.state==="closed"){if(typeof VideoDecoder>"u"){this.warnedUnsupported||(this.warnedUnsupported=!0,this.callbacks.onWarning("当前浏览器不支持 WebCodecs(VideoDecoder),无法解码投屏画面。")),this.callbacks.onState("error","VIDEO_DECODER_UNSUPPORTED");return}try{this.decoder=new VideoDecoder({output:l=>this.onDecodedFrame(l),error:l=>{this.configured=!1,console.warn("[android] video decoder error",l),this.callbacks.onState("error",l instanceof Error?l.message:"VIDEO_DECODER_ERROR"),this.sendControl(K0(fx))}})}catch(l){console.warn("[android] VideoDecoder unavailable",l),this.callbacks.onWarning(`创建 VideoDecoder 失败:${l instanceof Error?l.message:String(l)}`),this.callbacks.onState("error","VIDEO_DECODER_UNSUPPORTED");return}}const r={codec:"avc1.42e01e",optimizeForLatency:!0};let n;t==="h264"?(n=[uP(this.configData),"avc1.42e01e","avc1.4d401e","avc1.64001f"].filter((c,h,p)=>p.indexOf(c)===h),r.avc={format:"annexb"}):t==="h265"?(n=[dP(this.configData),"hev1.1.6.L120.B0","hvc1.1.6.L120.B0"],r.hevc={format:"annexb"}):n=["av01.0.04M.08"];const i=[];for(const l of n)try{this.decoder.configure({...r,codec:l}),this.configured=!0,this.needsKeyframe=!0,l!==n[0]&&console.warn("[android] decoder configured with fallback codec",l);return}catch(c){i.push(`${l}: ${c instanceof Error?c.message:String(c)}`),console.warn("[android] decoder configure failed",l,c)}this.callbacks.onWarning(`解码器配置失败(${i.join(";")})`),this.callbacks.onState("error","VIDEO_DECODER_UNSUPPORTED")}decode(t,r,n){if(!(!this.decoder||this.decoder.state!=="configured"))try{this.decoder.decode(new EncodedVideoChunk({type:r?"key":"delta",timestamp:n?Number(n):this.lastTimestamp+1,data:t})),this.peakDecodeQueue=Math.max(this.peakDecodeQueue,this.decoder.decodeQueueSize),this.lastTimestamp=n?Number(n):this.lastTimestamp+1}catch(i){this.decodeFailureCount++<3&&(console.warn("[android] decode threw",i),this.callbacks.onWarning(`送入解码器失败:${i instanceof Error?i.message:String(i)}`))}}decodeFailureCount=0;lastTimestamp=0;onDecodedFrame(t){this.frameCount++,this.decodedFrames++;const r=t.displayWidth||t.codedWidth,n=t.displayHeight||t.codedHeight,i=this.canvas;(i.width!==r||i.height!==n)&&(i.width=r,i.height=n,this.header&&(this.header={...this.header,width:r,height:n},this.callbacks.onHeader(this.header)));const l=i.getContext("2d");l&&l.drawImage(t,0,0,i.width,i.height),t.close()}pointerPoint(t,r){return{x:t,y:r,screenWidth:this.header?.width??0,screenHeight:this.header?.height??0}}touch(t,r,n,i){const l=t===wp||t===mx,c=l?0:1,h=i===Bc&&!l?xx:0,p=(t===px||t===wp)&&i===Bc?xx:0;this.sendControl(nP(t,i,this.pointerPoint(r,n),c,p,h))}pointerDown(t,r,n){this.touch(px,t,r,n==="mouse"?Bc:Md)}pointerMove(t,r,n){this.touch(rP,t,r,n==="mouse"?Bc:Md)}pointerUp(t,r,n){this.touch(wp,t,r,n==="mouse"?Bc:Md)}pointerCancel(t,r,n){this.touch(mx,t,r,n==="mouse"?Bc:Md)}scroll(t,r,n,i){this.sendControl(sP(this.pointerPoint(t,r),n,i))}key(t,r=Ap){this.sendControl(Tp(r,t))}tapKey(t){this.sendControl(Tp(Ap,t)),this.sendControl(Tp(gx,t))}back(){this.sendControl(bx(Ap)),this.sendControl(bx(gx))}home(){this.tapKey(Z0.HOME)}recents(){this.tapKey(Z0.APP_SWITCH)}power(){this.tapKey(Z0.POWER)}volumeUp(){this.tapKey(Z0.VOLUME_UP)}volumeDown(){this.tapKey(Z0.VOLUME_DOWN)}rotate(){this.sendControl(K0(eP))}expandNotifications(){this.sendControl(K0(Kj))}collapsePanels(){this.sendControl(K0(Xj))}setDisplayPower(t){this.sendControl(oP(t))}sendText(t){this.sendControl(iP(t))}startApp(t){this.sendControl(aP(t))}}function fP(){try{return crypto.randomUUID().slice(0,8)}catch{return Math.random().toString(36).slice(2,10)}}function pP(){return`termdock-mirror-shot-${new Date().toISOString().replace(/[-:T]/g,"").slice(0,14)}-${fP()}.png`}function yx(e){const t=Math.max(0,Math.floor(e/1e3)),r=Math.floor(t/60),n=t%60;return`${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`}async function mP(e,t=pP()){const r=e.width,n=e.height;if(!r||!n)throw new Error("投屏画面尚未就绪");const i=document.createElement("canvas");i.width=r,i.height=n;const l=i.getContext("2d");if(!l)throw new Error("无法读取投屏画面");l.drawImage(e,0,0);const c=await new Promise(h=>i.toBlob(h,"image/png"));if(!c||c.size===0)throw new Error("截图失败,请重试");return new File([c],t,{type:"image/png"})}function oy(e,t,r){const n=r.contentWidth*(t-1)/2,i=r.contentHeight*(t-1)/2;return{x:Math.max(-n,Math.min(n,e.x)),y:Math.max(-i,Math.min(i,e.y))}}function vx(e,t,r,n,i){const l=Math.max(1,Math.min(8,e.zoom*i)),c=l/e.zoom;return{zoom:l,pan:oy({x:n.x-t.cx-(r.x-t.cx-e.pan.x)*c,y:n.y-t.cy-(r.y-t.cy-e.pan.y)*c},l,t)}}function ly(e,t){return t?new Promise((r,n)=>{const i=crypto.randomUUID(),l=p=>{window.clearTimeout(h),window.removeEventListener("termdock-insert-reference-ack",c),p?r():n(new Error("目标终端不可用,内容尚未插入,请连接终端后重试"))},c=p=>{const g=p.detail;g?.nonce===i&&l(g.ok===!0)},h=window.setTimeout(()=>l(!1),1e4);window.addEventListener("termdock-insert-reference-ack",c),window.dispatchEvent(new CustomEvent("termdock-insert-reference",{detail:{text:e,sessionId:t,nonce:i,focus:!1,paste:!0}}))}):Promise.reject(new Error("没有可接收内容的终端"))}function wx(e,t){return ly(f3(e,null),t)}const Sp=Du(e=>({pending:[],enqueue:(t,r,n="/",i)=>e(l=>l.pending.some(c=>c.file.id===t.id)?l:{pending:[...l.pending,{file:t,sessionId:r,initialPath:n,insert:i}]}),remove:t=>e(r=>({pending:r.pending.filter(n=>n.file.id!==t)}))}));function gP({file:e,initialPath:t,onInsert:r,onDone:n}){const{t:i}=Mr(),[l,c]=y.useState(!1),[h,p]=y.useState(!1),[g,x]=y.useState(!1),[b,w]=y.useState(!1),[A,k]=y.useState(null),E=y.useRef(!1),I=y.useRef(null),M=async()=>{if(!E.current){E.current=!0,p(!0),w(!0);try{await Wj(e.id),n()}catch(j){k(j instanceof Error?j.message:String(j))}finally{E.current=!1,p(!1),w(!1)}}};y.useEffect(()=>{if(l)return;I.current?.focus();const j=F=>{if(F.stopPropagation(),F.key==="Escape"&&F.preventDefault(),F.key!=="Tab")return;const V=Array.from(I.current?.querySelectorAll("button:not(:disabled)")??[]),$=V[0],te=V.at(-1);F.shiftKey&&(document.activeElement===$||document.activeElement===I.current)?(F.preventDefault(),te?.focus()):!F.shiftKey&&document.activeElement===te&&(F.preventDefault(),$?.focus())};return document.addEventListener("keydown",j,!0),()=>document.removeEventListener("keydown",j,!0)},[l]);const Q=async j=>{if(!E.current){E.current=!0,p(!0),x(j!==void 0),c(!1),k(null);try{const F=await Hj(e.id,j);j===void 0&&await r(F.path),n()}catch(F){k(F instanceof Error?F.message:String(F))}finally{E.current=!1,p(!1)}}};return l?a.jsx(hm,{open:!0,initialPath:t||"/",title:i("android.recordingSave"),onCancel:()=>c(!1),onConfirm:j=>{Q(j)}}):Ai.createPortal(a.jsx("div",{className:"fixed inset-0 z-modal-panel flex items-center justify-center bg-[var(--app-backdrop)] p-4",children:a.jsxs("div",{ref:I,role:"dialog","aria-modal":"true","aria-labelledby":"recording-save-title",tabIndex:-1,"aria-busy":h,className:"w-full max-w-sm rounded-xl border border-border bg-surface p-4 text-foreground shadow-xl outline-none",children:[a.jsx("h2",{id:"recording-save-title",className:"text-sm font-semibold",children:i("android.recordingConfirm")}),a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:i("android.recordingSaveHint")}),a.jsxs("p",{className:"mt-2 break-all text-xs text-muted-foreground",children:[e.name," · ",(e.size/1024/1024).toFixed(1)," MB"]}),(A||e.error)&&a.jsx("p",{role:"alert",className:"mt-3 break-words text-xs text-destructive",children:A||e.error}),h&&a.jsxs("p",{role:"status",className:"mt-3 flex items-center gap-2 text-sm text-primary",children:[a.jsx(_n,{size:16,className:"animate-spin"}),b?`${i("android.recordingDiscard")}…`:i(g?"android.recordingSaving":"android.captureInserting")]}),a.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[a.jsx("button",{type:"button",disabled:h||e.status!=="ready",onClick:()=>{Q()},className:"min-h-10 rounded-lg bg-primary px-3 text-sm text-primary-foreground disabled:opacity-40",children:i("android.recordingInsert")}),a.jsx("button",{type:"button",disabled:h||e.status!=="ready",onClick:()=>c(!0),className:"min-h-10 rounded-lg bg-surface-2 px-3 text-sm disabled:opacity-40",children:i("android.recordingSave")}),a.jsx("button",{type:"button",disabled:h,onClick:()=>{M()},className:"min-h-10 rounded-lg px-3 text-sm text-muted-foreground disabled:opacity-40",children:i("android.recordingDiscard")})]})]})}),document.body)}const cu="android-mirror",X0=cu,cy="termdock:android:quality:v1",_p=176,xP=204,ll=1,sh=8,Ax=[1,1.25,1.5,2,2.5,3,4,6,8],bP=e=>Math.max(ll,Math.min(sh,e));function yP(e){return`${Number.isInteger(e)?e:e.toFixed(1)}×`}function Dd(e){const t=e.parentElement;if(!t)return null;const r=t.getBoundingClientRect(),n=getComputedStyle(t),i=parseFloat(n.paddingLeft)||0,l=parseFloat(n.paddingTop)||0,c=t.clientWidth-i-(parseFloat(n.paddingRight)||0),h=t.clientHeight-l-(parseFloat(n.paddingBottom)||0);return{cx:r.left+t.clientLeft+i+c/2,cy:r.top+t.clientTop+l+h/2,width:c,height:h,contentWidth:e.offsetWidth,contentHeight:e.offsetHeight}}function vP(e,t){try{e.setPointerCapture?.(t)}catch{}}function Tx(e,t){try{e.releasePointerCapture?.(t)}catch{}}const Cx=e=>typeof requestAnimationFrame=="function"?requestAnimationFrame(e):window.setTimeout(e,16),Bd=e=>{typeof cancelAnimationFrame=="function"?cancelAnimationFrame(e):window.clearTimeout(e)},Lp={auto:"android.qualityAuto",low:"android.qualityLow",medium:"android.qualityMedium",high:"android.qualityHigh",custom:"android.qualityCustom"},wP=()=>{try{const e=localStorage.getItem(cy);return e?A1(JSON.parse(e)):Mu}catch{return Mu}},J0=e=>{try{localStorage.setItem(cy,JSON.stringify(e))}catch{}};function AP({sessionId:e,dockOnly:t=!1,onInsertPrompt:r,onInsertFile:n,onRecordingComplete:i,onCloseTab:l}){const{t:c}=Mr(),h=dx(P=>P.overlay),p=dx(P=>P.setOverlay),g=y.useRef(null),x=y.useRef(null),b=y.useRef(null),w=y.useMemo(wP,[]),A=y.useRef(w),k=y.useRef(null),E=y.useRef(null),[I,M]=y.useState(4e6),Q=y.useRef(null),j=y.useRef(new Map),F=y.useRef(null),V=y.useRef(!1),[$,te]=y.useState(ll),se=y.useRef($),qe=y.useRef({x:0,y:0}),de=y.useRef(null),oe=y.useRef(0),Oe=y.useRef(0),et=y.useRef(null),ce=y.useRef(0),[Be,ot]=y.useState(null),[Ie,re]=y.useState(null),[Ue,_e]=y.useState(!0),[K,Le]=y.useState(""),[fe,$e]=y.useState(w.id),[ze,Ee]=y.useState([]),[ee,Ke]=y.useState(null),[wt,tt]=y.useState(""),[ge,it]=y.useState(!0),[ht,Y]=y.useState({maxSize:w.maxSize,bitRate:w.bitRate,maxFps:w.maxFps}),[be,ut]=y.useState("idle"),[le,pe]=y.useState(null),[je,xt]=y.useState(null),[dt,Dt]=y.useState({fps:0,kbps:0,width:0,height:0,received:0,decoded:0,controls:0,last:""}),[Xt,Ht]=y.useState(null),[Bt,Wt]=y.useState(null),[lr,ur]=y.useState(!1),[Jt,Er]=y.useState([]),[X,Re]=y.useState(null),[We,Qt]=y.useState([]),[It,ar]=y.useState(!1),Ot=y.useRef(null),Fe=y.useRef(0),yr=y.useRef([]),[He,Se]=y.useState(!1),[Ve,Ct]=y.useState(""),[jr,ft]=y.useState(!1),[Br,Wn]=y.useState(!1),[an,ke]=y.useState(""),[St,kt]=y.useState(null),[ue,Nr]=y.useState(null),[st,Gt]=y.useState(!1),[Ur,gn]=y.useState(0),Ln=y.useRef(null),[wn,sr]=y.useState(!1),yn=y.useRef(!1),Ts=y.useRef(new Set),Xr=y.useRef(null),Wr=y.useRef(null),on=y.useRef(!1),[An,jn]=y.useState(!1),Gn=y.useRef(i);Gn.current=i;const[Pn,hn]=y.useState(!1),[kn,Tn]=y.useState(null),rn=y.useRef(null),Dr=y.useRef(null),ns=Bj(P=>P.activeSessionId??P.sessions.keys().next().value??null),Mt=e??ns,q=ts(P=>!!P.docks[X0]),Ye=ts(P=>P.hosts[X0]),Lt=ts(P=>P.setDock),wr=y.useCallback(async()=>{_e(!0);try{const P=await Pj();ot(P),re(null)}catch(P){re(P instanceof Error?P.message:"ADB_UNAVAILABLE")}finally{_e(!1)}},[]);y.useEffect(()=>{wr()},[wr]);const Et=Be?.devices??[],hr=Et.find(P=>P.serial===K)??null,Sr=!!(Ie&&/ADB_NOT_FOUND|ADB_UNAVAILABLE/i.test(Ie)),Ir=!!(Be?.adbAvailable&&!Be.scrcpyVersion),ln=y.useCallback(()=>{const P=Q.current,xe=[...j.current.keys()];Q.current=null,j.current.clear(),F.current=null,V.current=!1,Ot.current=null,Bd(oe.current),oe.current=0,P&&x.current?.pointerCancel(P.x,P.y,P.type);const Ae=g.current;if(Ae)for(const rt of xe)Tx(Ae,rt);Re(null),ar(!1),Qt([]),te(se.current)},[]);y.useEffect(()=>{const P=rt=>{j.current.has(rt.pointerId)&&(rt.type==="pointercancel"||rt.target!==g.current)&&ln()},xe=()=>ln(),Ae=()=>{document.hidden&&ln()};return window.addEventListener("pointerup",P,!0),window.addEventListener("pointercancel",P,!0),window.addEventListener("blur",xe),document.addEventListener("visibilitychange",Ae),()=>{window.removeEventListener("pointerup",P,!0),window.removeEventListener("pointercancel",P,!0),window.removeEventListener("blur",xe),document.removeEventListener("visibilitychange",Ae),ln()}},[ln]);const zr=y.useCallback(()=>{ln(),x.current?.disconnect(),x.current=null,ut("idle"),pe(null),xt(null)},[ln]),Vn=y.useCallback((P,xe=!1)=>{const Ae=g.current;if(!Ae||!P)return;ln(),x.current?.disconnect(),pe(null),!xe&&b.current!==P&&xt(null),b.current=P,Wt(null),Ht(null);const rt=new hP(Ae,{onBitrateSupport:(dr,qt)=>{x.current!==rt||A.current.id!=="auto"||Ht(dr?null:qt??"BITRATE_REASON_UNAVAILABLE")},onState:(dr,qt)=>{x.current===rt&&(ut(dr),pe(qt??null))},onHeader:dr=>{x.current===rt&&xt(dr)},onStats:dr=>{x.current===rt&&Dt(dr)},onWarning:dr=>{x.current===rt&&Wt(dr)}});x.current=rt;let pt=A.current;pt.id==="auto"?(k.current?.serial!==P&&(k.current={serial:P,policy:new jj}),k.current.policy.connected(performance.now()),pt=k.current.policy.quality,M(pt.bitRate)):k.current=null,E.current=pt,rt.connect(P,pt)},[ln]);y.useEffect(()=>{if(fe!=="auto"||A.current.id!=="auto"||be!=="streaming"||!dt.adaptation||document.hidden)return;const P=k.current,xe=x.current;if(!P||P.serial!==K||!xe?.canSetBitrate)return;const Ae=g.current,rt=Ae?Math.max(Ae.clientWidth,Ae.clientHeight)*(window.devicePixelRatio||1)*se.current:1600,pt=P.policy.sample(dt.adaptation,performance.now(),rt||1600);pt&&xe.setBitrate(pt.bitRate).then(dr=>{dr&&x.current===xe&&(E.current=pt,M(pt.bitRate))})},[dt,fe,be,K,Vn]);const Gr=y.useCallback(P=>{const xe={...P.quality?{quality:{id:P.quality.id,maxSize:P.quality.maxSize,bitRate:P.quality.bitRate,maxFps:P.quality.maxFps}}:{},...P.activePresetId!==void 0?{activePresetId:P.activePresetId}:{},...P.presets!==void 0?{presets:P.presets}:{},...P.docked!==void 0?{docked:P.docked}:{},...P.deviceSerial!==void 0?{deviceSerial:P.deviceSerial}:{}};ca({androidPanel:xe}).catch(()=>{})},[]);y.useEffect(()=>{let P=!1;return $l().then(xe=>{if(P)return;const Ae=xe.androidPanel;if(Ae?.quality){const rt=A1(Ae.quality);A.current=rt,$e(rt.id),Y({maxSize:rt.maxSize,bitRate:rt.bitRate,maxFps:rt.maxFps}),J0(rt)}Ee(Ae?.presets??[]),Ke(Ae?.activePresetId??null),Ae?.deviceSerial&&(et.current=Ae.deviceSerial,Le(Ae.deviceSerial))}).catch(()=>{}),()=>{P=!0}},[]);const qn=y.useCallback(P=>{const xe=++Fe.current;Er(rt=>[...rt,{id:xe,left:P.left,top:P.top}]);const Ae=window.setTimeout(()=>{Er(rt=>rt.filter(pt=>pt.id!==xe)),yr.current=yr.current.filter(rt=>rt!==Ae)},300);yr.current.push(Ae)},[]),In=y.useCallback((P,xe)=>{const Ae=x.current,rt=E.current;Ae?.supportsLiveBitrate&&b.current===P&&rt&&rt.maxSize===xe.maxSize&&rt.maxFps===xe.maxFps?Ae.setBitrate(xe.bitRate).then(pt=>{x.current===Ae&&(pt?(E.current=xe,Ht(null)):Ht(Ae.lastBitrateFailure??"BITRATE_REASON_UNAVAILABLE"))}):Vn(P)},[Vn,c]),cn=y.useCallback(P=>{if(k.current=null,P.startsWith("user:")){const Ae=ze.find(pt=>pt.id===P.slice(5));if(!Ae)return;const rt={id:"custom",maxSize:Ae.maxSize,bitRate:Ae.bitRate,maxFps:Ae.maxFps};A.current=rt,$e("custom"),Ke(Ae.id),Y({maxSize:Ae.maxSize,bitRate:Ae.bitRate,maxFps:Ae.maxFps}),it(!0),J0(rt),Gr({quality:rt,activePresetId:Ae.id}),K&&Vn(K);return}if(P==="custom"){const Ae=A.current;$e("custom"),Ke(null),Y({maxSize:Ae.maxSize,bitRate:Ae.bitRate,maxFps:Ae.maxFps}),it(!0);return}const xe=P==="auto"?A1({id:"auto"}):Nh.find(Ae=>Ae.id===P)??Mu;A.current=xe,$e(xe.id),Ke(null),J0(xe),Gr({quality:xe,activePresetId:null}),K&&Vn(K)},[Vn,K,ze,Gr]),H=y.useCallback(()=>{const P={id:"custom",maxSize:ht.maxSize,bitRate:ht.bitRate,maxFps:ht.maxFps};A.current=P,J0(P),Gr({quality:P,activePresetId:null}),$e("custom"),Ke(null),K&&In(K,P)},[In,K,ht,Gr]),we=y.useCallback(()=>{const P=wt.trim();if(!P)return;const xe=`p${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,Ae={id:xe,name:P,maxSize:ht.maxSize,bitRate:ht.bitRate,maxFps:ht.maxFps},rt=[...ze.filter(dr=>dr.name!==P),Ae].slice(-12),pt={id:"custom",maxSize:ht.maxSize,bitRate:ht.bitRate,maxFps:ht.maxFps};Ee(rt),tt(""),Ke(xe),$e("custom"),A.current=pt,J0(pt),Gr({quality:pt,activePresetId:xe,presets:rt}),K&&In(K,pt)},[wt,ht,ze,K,In,Gr]),Pe=y.useCallback(()=>{if(!ee)return;const P=ze.filter(xe=>xe.id!==ee);Ee(P),Ke(null),Gr({activePresetId:null,presets:P})},[ee,ze,Gr]);y.useEffect(()=>()=>{x.current?.disconnect(),x.current=null;for(const P of yr.current)window.clearTimeout(P);yr.current=[]},[]),y.useEffect(()=>{if(h==="off")return;const P=xe=>{xe.key==="Escape"&&p("off")};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[h,p]),y.useEffect(()=>{const P=Et.filter(Ae=>Ae.state==="device");if(K||P.length!==1)return;const xe=P[0].serial;et.current!==xe&&(et.current=xe,Le(xe))},[Et,K]),y.useEffect(()=>{K&&Vn(K)},[K,Vn]),y.useEffect(()=>{if(be==="streaming"){ce.current=0,ur(!1);return}if(be!=="error"||!K||!CP(le??""))return;const P=Math.min(8e3,700*2**ce.current);ce.current+=1,ur(!0);const xe=window.setTimeout(()=>{ur(!1),Vn(K)},P);return()=>window.clearTimeout(xe)},[be,le,K,Vn]);const Ge=y.useCallback((P,xe,Ae)=>{const rt=g.current,pt=Ae??(rt?Dd(rt):null);return!rt||!pt?{x:0,y:0}:oy(P,xe,pt)},[]),ve=y.useCallback(()=>{const P=g.current;if(!P)return;const{x:xe,y:Ae}=qe.current,rt=se.current,pt=rt===ll&&xe===0&&Ae===0?"":`translate3d(${xe}px, ${Ae}px, 0) scale(${rt})`;P.style.transform!==pt&&(P.style.transform=pt);const dr=de.current;dr&&(dr.textContent=rt>ll?yP(rt):"")},[]),lt=y.useCallback((P,xe,Ae=!0)=>{const rt=g.current,pt=se.current,dr=bP(P);if(!rt||dr===pt)return;const qt=Dd(rt);if(!qt)return;const Rt=xe??{x:qt.cx,y:qt.cy},Fr=vx({zoom:pt,pan:qe.current},qt,Rt,Rt,dr/pt);se.current=Fr.zoom,qe.current=Fr.pan,Ae&&ve()},[ve]),Nt=y.useCallback(()=>{const P=se.current;te(xe=>xe<=ll+.01==P<=ll+.01&&xe>=sh-.01==P>=sh-.01?xe:P)},[]);y.useEffect(()=>()=>{Bd(oe.current),Bd(Oe.current)},[]);const At=()=>{let P=0,xe=0;for(const rt of j.current.values())P+=rt.x,xe+=rt.y;const Ae=j.current.size;return Ae?{x:P/Ae,y:xe/Ae}:null},ct=()=>{const[P,xe]=Array.from(j.current.values());return P&&xe?Math.hypot(P.x-xe.x,P.y-xe.y):0},_t=()=>{const P=At(),xe=g.current?Dd(g.current):null;!P||!xe||(F.current={startCentroid:P,startDistance:ct(),box:xe})},_r=y.useCallback(()=>{const P=F.current,xe=At();if(!P||!xe)return;const Ae=ct(),rt=P.startDistance>0&&Ae>0?Ae/P.startDistance:1,pt=vx({zoom:se.current,pan:qe.current},P.box,P.startCentroid,xe,rt);se.current=pt.zoom,qe.current=pt.pan,P.startCentroid=xe,P.startDistance=Ae},[]),jt=y.useCallback(()=>{oe.current||(oe.current=Cx(()=>{oe.current=0,_r(),ve()}))},[_r,ve]),tr=y.useCallback(()=>{oe.current&&(Bd(oe.current),oe.current=0,_r(),ve())},[_r,ve]);y.useEffect(()=>{const P=g.current;if(!P)return;const xe=P.parentElement;if(!xe)return;const Ae=pt=>{if(pt.ctrlKey||pt.metaKey){if(pt.preventDefault(),!pt.deltaY||F.current)return;const Rt=pt.deltaMode===1?16:pt.deltaMode===2?P.parentElement?.clientHeight||600:1,Fr=Math.max(-600,Math.min(600,pt.deltaY*Rt));lt(se.current*Math.exp(-Fr*.002),{x:pt.clientX,y:pt.clientY},!1),Oe.current||(Oe.current=Cx(()=>{Oe.current=0,ve(),Nt()}));return}const dr=x.current;if(!dr||pt.target!==P)return;pt.preventDefault();const qt=jd(P,pt.clientX,pt.clientY);dr.scroll(qt.x,qt.y,pt.deltaX,pt.deltaY)},rt=pt=>pt.preventDefault();return xe.addEventListener("wheel",Ae,{passive:!1}),xe.addEventListener("gesturestart",rt,{passive:!1}),xe.addEventListener("gesturechange",rt,{passive:!1}),()=>{xe.removeEventListener("wheel",Ae),xe.removeEventListener("gesturestart",rt),xe.removeEventListener("gesturechange",rt)}},[lt,ve,Nt]),y.useEffect(()=>{const P=g.current,xe=P?.parentElement;if(!P||!xe||typeof ResizeObserver>"u")return;const Ae=new ResizeObserver(()=>{F.current&&(F.current.box=Dd(P));const rt=Ge(qe.current,se.current);rt.x===qe.current.x&&rt.y===qe.current.y||(qe.current=rt,ve())});return Ae.observe(P),Ae.observe(xe),()=>Ae.disconnect()},[Ge,ve]),y.useLayoutEffect(()=>{ve()});const vt=P=>{const xe=x.current,Ae=g.current;if(!xe||!Ae)return;if(P.pointerType==="mouse"&&P.button!==0){P.preventDefault(),P.button===2?xe.back():P.button===1&&xe.home();return}P.preventDefault(),Ae.closest(".android-mirror-panel")?.focus({preventScroll:!0}),ve(),Nt(),tr(),vP(Ae,P.pointerId),j.current.set(P.pointerId,{x:P.clientX,y:P.clientY});const rt=P.pointerType==="mouse"&&P.altKey;if(j.current.size>=2||rt){const qt=Q.current;qt&&(xe.pointerCancel(qt.x,qt.y,qt.type),Q.current=null,Ot.current=null,Re(null),ar(!1),Qt([])),V.current=!0,_t();return}if(V.current)return;const pt=jd(Ae,P.clientX,P.clientY);Q.current={id:P.pointerId,type:P.pointerType,x:pt.x,y:pt.y},xe.pointerDown(pt.x,pt.y,P.pointerType);const dr=Ix(Ae,P.clientX,P.clientY);dr&&(Ot.current={left:dr.left,top:dr.top},Qt([]),ar(!1),Re(dr))},Tt=P=>{const xe=x.current,Ae=g.current;if(!Ae||!j.current.has(P.pointerId))return;if(P.pointerType==="mouse"){const Rt=Ae.getBoundingClientRect(),Fr=Ae.parentElement?.getBoundingClientRect()??Rt;if(!(P.buttons&1)||P.clientX<Math.max(Rt.left,Fr.left)||P.clientX>=Math.min(Rt.right,Fr.right)||P.clientY<Math.max(Rt.top,Fr.top)||P.clientY>=Math.min(Rt.bottom,Fr.bottom)){ln();return}}if(P.preventDefault(),j.current.set(P.pointerId,{x:P.clientX,y:P.clientY}),F.current){jt();return}const rt=Q.current;if(!xe||!rt||rt.id!==P.pointerId)return;const pt=jd(Ae,P.clientX,P.clientY);rt.x=pt.x,rt.y=pt.y,xe.pointerMove(pt.x,pt.y,rt.type);const dr=Ix(Ae,P.clientX,P.clientY),qt=Ot.current;!dr||!qt||(Re(dr),Math.hypot(dr.left-qt.left,dr.top-qt.top)>=6&&(ar(!0),Qt(Rt=>{const Fr=Rt[Rt.length-1];if(Fr&&Math.hypot(dr.left-Fr.x,dr.top-Fr.y)<4)return Rt;const Rn=[...Rt,{x:dr.left,y:dr.top}];return Rn.length>12?Rn.slice(Rn.length-12):Rn})))},fr=P=>{const xe=x.current,Ae=g.current;if(!Ae||!j.current.has(P.pointerId))return;if(tr(),j.current.delete(P.pointerId),Tx(Ae,P.pointerId),j.current.size===0&&(V.current=!1),F.current){j.current.size===0?(F.current=null,te(se.current)):_t();return}const rt=Q.current;if(!rt||rt.id!==P.pointerId)return;const pt=jd(Ae,P.clientX,P.clientY);xe?.pointerUp(pt.x,pt.y,rt.type),X&&qn(X),Re(null),ar(!1),window.setTimeout(()=>Qt([]),200),Q.current=null,Ot.current=null},at=P=>{if(Pn||He||Br)return;const xe=x.current;xe&&(P.key==="Backspace"?(P.preventDefault(),xe.key(67)):P.key==="Escape"?(P.preventDefault(),xe.back()):P.key==="Enter"&&(P.preventDefault(),xe.key(66)))},Rr=async()=>{const P=Ve.trim();if(P){ft(!0);try{const xe=await Oj(P);Ct(""),Se(!1),await wr(),Le(xe.serial)}catch(xe){re(xe instanceof Error?xe.message:"ADB_CONNECT_FAILED")}finally{ft(!1)}}},Vr=()=>{const P=x.current,xe=an;!P||!xe||(P.sendText(xe),ke(""))},Nn=y.useCallback(P=>{kt(P),Wr.current!==null&&window.clearTimeout(Wr.current),Wr.current=window.setTimeout(()=>{Wr.current=null,kt(null)},2500)},[]),nn=y.useCallback(P=>{const xe=se.current,Ae=P==="in"?Ax.find(rt=>rt>xe+.01):[...Ax].reverse().find(rt=>rt<xe-.01);Ae!==void 0&&(xe<=ll&&Ae>ll&&Nn(c("android.zoomPanHint")),tr(),lt(Ae),te(Ae))},[lt,tr,Nn,c]),fs=P=>{Promise.resolve().then(()=>r?.(P)).catch(xe=>{Nr(xe instanceof Error?xe.message:String(xe))})},On=y.useCallback(async(P,xe)=>{try{if(!n)throw new Error(c("android.captureUnavailable"));await n(P),Nn(xe)}catch(Ae){Nr(c("android.captureFailed")+(Ae instanceof Error?`:${Ae.message}`:""))}},[n,Nn,c]),ls=async()=>{const P=g.current;if(!(!P||on.current)){on.current=!0,jn(!0),Nr(null);try{const xe=await mP(P);await On(xe,c("android.captureInserted"))}catch(xe){Nr(xe instanceof Error?xe.message:String(xe))}finally{on.current=!1,jn(!1)}}},Bs=y.useCallback(P=>{(P.status==="ready"||P.status==="error")&&Gn.current&&!Ts.current.has(P.id)&&(Ts.current.add(P.id),Gn.current?.(P))},[]),ii=y.useCallback(async P=>{const xe=Ln.current;if(!(!xe||yn.current)){yn.current=!0,sr(!0),Nr(null);try{const Ae=await zj(xe.id);Ln.current=null,Gt(!1),Bs(Ae)}catch(Ae){Nr(Ae instanceof Error?Ae.message:String(Ae))}finally{yn.current=!1,sr(!1)}}},[Bs]),Os=async()=>{if(!(!K||yn.current||Ln.current)){yn.current=!0,sr(!0),Nr(null);try{const P=await Uj(K);P.status==="recording"||P.status==="starting"||P.status==="stopping"?(Ln.current=P,Gt(!0),gn(Math.max(0,Date.now()-P.startedAt))):Bs(P)}catch(P){Nr(P instanceof Error?P.message:String(P))}finally{yn.current=!1,sr(!1)}}};y.useEffect(()=>{let P=!1,xe=!1;Ln.current=null,Gt(!1);const Ae=async()=>{if(!(!K||xe||yn.current)){xe=!0;try{const{recordings:pt}=await $j(K);if(P||yn.current)return;const dr=pt.find(qt=>["starting","recording","stopping"].includes(qt.status));Ln.current=dr??null,Gt(!!dr);for(const qt of pt)Bs(qt)}catch{}finally{xe=!1}}};Ae();const rt=window.setInterval(()=>{Ae()},2e3);return Xr.current=window.setInterval(()=>{Ln.current&&gn(Math.max(0,Date.now()-Ln.current.startedAt))},500),()=>{P=!0,window.clearInterval(rt),Xr.current!==null&&window.clearInterval(Xr.current)}},[K,Bs]),y.useEffect(()=>{if(!Pn)return;const P=()=>hn(!1),xe=rt=>{const pt=rt.target;pt instanceof Node&&(rn.current?.contains(pt)||Dr.current?.contains(pt)||P())},Ae=rt=>{rt.key==="Escape"&&(rt.preventDefault(),rt.stopPropagation(),P())};return document.addEventListener("pointerdown",xe,!0),document.addEventListener("keydown",Ae,!0),window.addEventListener("resize",P),()=>{document.removeEventListener("pointerdown",xe,!0),document.removeEventListener("keydown",Ae,!0),window.removeEventListener("resize",P)}},[Pn]),y.useEffect(()=>()=>{Wr.current!==null&&window.clearTimeout(Wr.current)},[]);const Pr=be==="streaming",Jr=q,$n=Jr?"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded hover:bg-surface-2 disabled:opacity-40":"rounded p-1.5 hover:bg-surface-2 disabled:opacity-40",U=hr?(hr.model||hr.serial)+Ex(hr,c):Et.length?c("android.selectDevice"):c("android.noDevices"),me=(ee?ze.find(P=>P.id===ee):null)?.name??(fe==="auto"?`${c("android.qualityAuto")} · ${I/1e6} Mbps`:c(Lp[fe])),Me=Jr?"relative flex h-5 min-w-0 items-center rounded bg-surface-2 focus-within:ring-1 focus-within:ring-primary/50":"relative flex h-7 min-w-0 items-center rounded bg-surface-2 focus-within:ring-1 focus-within:ring-primary/50",Ut=Jr?"pointer-events-none block min-w-0 truncate px-1 text-[10px] leading-none text-foreground":"pointer-events-none block min-w-0 truncate px-2 text-[11px] leading-none text-foreground",Pt="absolute inset-0 h-full w-full cursor-pointer opacity-0",rr=()=>{const P=rn.current?.getBoundingClientRect();P&&Tn({left:Math.max(8,Math.min(P.right-_p,window.innerWidth-_p-8)),top:Math.min(P.bottom+4,Math.max(8,window.innerHeight-xP-8))}),hn(!0)},er=()=>{if(q){Lt(X0,null),Gr({docked:null});return}if(!Mt)return;const P={sessionId:Mt,side:"right"};Lt(X0,P),Gr({docked:P})},Or=He||q||h!=="off",fn=a.jsxs("div",{className:"android-mirror-panel flex h-full min-h-0 min-w-0 flex-col bg-surface text-foreground","data-sidebar-gesture-ignore":"true",onKeyDown:at,tabIndex:-1,children:[a.jsxs("div",{"data-panel-drag-title":q?"true":void 0,className:Jr?"flex h-6 min-h-6 shrink-0 flex-nowrap items-center gap-1 overflow-hidden border-b border-border/15 bg-[var(--chrome-bg)] px-1.5 cursor-grab select-none active:cursor-grabbing":"flex flex-wrap items-center gap-1.5 border-b border-border px-2 py-2",children:[q&&a.jsx("span",{"data-panel-drag-title":"true",role:"button","aria-label":c("android.splitDrag"),title:c("android.splitDrag"),className:"flex h-4 w-4 shrink-0 cursor-grab items-center justify-center rounded text-muted-foreground hover:text-foreground active:cursor-grabbing",children:a.jsx(Pu,{size:12})}),a.jsx(C8,{size:Jr?12:14,className:"shrink-0 text-muted-foreground"}),a.jsxs("div",{className:`${Me} flex-1`,children:[a.jsx("span",{"aria-hidden":"true",className:`${Ut} w-full`,children:U}),a.jsxs("select",{value:K,onChange:P=>{const xe=P.target.value;Le(xe),et.current=xe,xe&&Gr({deviceSerial:xe})},className:Pt,"aria-label":c("android.device"),children:[a.jsx("option",{value:"",children:Et.length?c("android.selectDevice"):c("android.noDevices")}),Et.map(P=>a.jsx("option",{value:P.serial,children:(P.model||P.serial)+Ex(P,c)},P.serial))]})]}),a.jsxs("div",{className:`${Me} max-w-[45%] shrink-0`,children:[a.jsx("span",{"aria-hidden":"true",className:Ut,children:me}),a.jsxs("select",{value:ee?`user:${ee}`:fe,onChange:P=>cn(P.target.value),className:Pt,title:c(fe==="auto"?"android.qualityAutoHint":"android.quality"),"aria-label":c("android.quality"),children:[a.jsxs("option",{value:"auto",children:[c("android.qualityAuto"),fe==="auto"?` · ${I/1e6} Mbps`:""]}),Nh.map(P=>a.jsx("option",{value:P.id,children:c(Lp[P.id])},P.id)),ze.map(P=>a.jsx("option",{value:`user:${P.id}`,children:P.name},P.id)),a.jsx("option",{value:"custom",children:c(Lp.custom)})]})]}),a.jsx("button",{type:"button",onClick:()=>{wr()},className:`${$n} text-muted-foreground`,title:c("android.refresh"),children:Ue?a.jsx(_n,{size:13,className:"animate-spin"}):a.jsx(rs,{size:13})}),Pr?a.jsx("button",{type:"button",onClick:zr,className:`${$n} text-destructive`,title:c("android.disconnect"),children:a.jsx(db,{size:13})}):a.jsx("button",{type:"button",onClick:()=>K&&Vn(K),disabled:!K,className:`${$n} text-primary`,title:c("android.connect"),children:a.jsx(dA,{size:13})}),(Pr||st)&&a.jsx("button",{type:"button",onClick:()=>{ls()},disabled:!n||An,className:`${$n} text-muted-foreground`,title:c(n?"android.screenshot":"android.captureUnavailable"),"aria-label":c("android.screenshot"),children:An?a.jsx(_n,{size:Jr?12:13,className:"animate-spin"}):a.jsx(K9,{size:Jr?12:13})}),(Pr||st)&&a.jsx("button",{type:"button",onClick:()=>{st?ii("manual"):Os()},disabled:wn||!st&&!i,className:`${$n} ${st?"text-destructive":"text-muted-foreground"}`,title:c(st?"android.recordingStop":i?"android.recordingStart":"android.captureUnavailable"),"aria-label":c(st?"android.recordingStop":"android.recordingStart"),children:wn?a.jsx(_n,{className:"animate-spin",size:13}):st?a.jsx(ub,{size:Jr?10:11,fill:"currentColor"}):a.jsx(hb,{size:Jr?12:13})}),a.jsx("button",{ref:rn,type:"button",onClick:()=>Pn?hn(!1):rr(),"aria-haspopup":"menu","aria-expanded":Pn,className:`${$n} ${Or?"text-primary":"text-muted-foreground"}`,title:c("android.more"),"aria-label":c("android.more"),children:a.jsx(Pl,{size:Jr?13:14})}),l&&!t&&a.jsx("button",{type:"button",onClick:()=>{hn(!1),p("off"),l()},className:`${$n} text-muted-foreground hover:bg-destructive/20 hover:text-destructive`,title:c("android.closeTab"),"aria-label":c("android.closeTab"),children:a.jsx(Kn,{size:14})})]}),Pn&&kn&&Ai.createPortal(a.jsxs("div",{ref:Dr,role:"menu","aria-label":c("android.more"),style:{left:kn.left,top:kn.top,width:_p},className:"fixed z-popover overflow-hidden rounded-md border border-border bg-surface-elevated py-1 text-[11px] shadow-lg",children:[a.jsx(Qd,{icon:a.jsx(Yo,{size:13}),label:c("android.addDevice"),active:He,onSelect:()=>{Se(P=>!P),hn(!1)}}),a.jsx(Qd,{icon:q?a.jsx(Kn,{size:13}):a.jsx(dl,{size:13}),label:c(q?"android.splitClose":"android.splitOpen"),active:q,disabled:!q&&!Mt,onSelect:()=>{er(),hn(!1)}}),a.jsx(Qd,{icon:h==="window"?a.jsx($w,{size:13}):a.jsx(Pw,{size:13}),label:c(h==="window"?"android.exitFullscreen":"android.fullscreen"),active:h==="window",onSelect:()=>{p(h==="window"?"off":"window"),hn(!1)}}),!t&&a.jsx(Qd,{icon:h==="sidebar"?a.jsx(Yw,{size:13}):a.jsx(Jw,{size:13}),label:c(h==="sidebar"?"android.exitFullscreen":"android.fillSidebar"),active:h==="sidebar",onSelect:()=>{p(h==="sidebar"?"off":"sidebar"),hn(!1)}}),je&&a.jsxs("div",{className:"mt-1 border-t border-border px-3 py-2 text-[10px] leading-4 tabular-nums text-muted-foreground",children:[a.jsx("div",{className:"truncate",children:`${dt.fps} fps · ${dt.kbps} kbps`}),a.jsx("div",{className:"truncate",children:`${dt.width}×${dt.height}`})]})]}),document.body),(fe==="custom"||ee)&&a.jsxs("div",{className:"border-b border-border bg-surface-2/40 px-2 py-2 text-[11px]",children:[a.jsxs("button",{type:"button",onClick:()=>it(P=>!P),"aria-expanded":ge,className:"flex w-full items-center gap-1 rounded text-muted-foreground hover:text-foreground",children:[a.jsx(Yo,{size:12,className:`transition-transform ${ge?"":"-rotate-90"}`}),a.jsxs("span",{children:[c("android.quality"),ee?` · ${ze.find(P=>P.id===ee)?.name??""}`:""]})]}),ge&&a.jsxs("div",{className:"mt-2 grid gap-2",children:[a.jsx(kx,{label:c("android.qualityResolution"),display:`${ht.maxSize}px`,min:360,max:2160,step:8,value:ht.maxSize,onChange:P=>Y(xe=>({...xe,maxSize:P}))}),a.jsx(kx,{label:c("android.qualityBitRate"),display:`${(ht.bitRate/1e6).toFixed(1)} Mbps`,min:.5,max:20,step:.5,value:ht.bitRate/1e6,onChange:P=>Y(xe=>({...xe,bitRate:Math.round(P*1e6)}))}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-14 shrink-0 text-muted-foreground",children:c("android.qualityFrameRate")}),a.jsxs("div",{className:"flex gap-1",children:[[15,30,60].map(P=>a.jsx("button",{type:"button",onClick:()=>Y(xe=>({...xe,maxFps:P})),className:`rounded px-2 py-0.5 ${ht.maxFps===P?"bg-surface-elevated text-primary":"text-muted-foreground hover:bg-surface-2"}`,children:P},P)),a.jsx("button",{type:"button",onClick:()=>Y(P=>({...P,maxFps:0})),className:`rounded px-2 py-0.5 ${ht.maxFps===0?"bg-surface-elevated text-primary":"text-muted-foreground hover:bg-surface-2"}`,children:c("android.qualityAuto")})]}),a.jsx("button",{type:"button",onClick:H,disabled:!K,className:"ml-auto rounded bg-primary/15 px-2 py-1 text-primary disabled:opacity-40",children:c("android.qualityApply")})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{value:wt,onChange:P=>tt(P.target.value),onKeyDown:P=>{P.key==="Enter"&&!P.nativeEvent.isComposing&&we()},placeholder:c("android.presetNamePlaceholder"),maxLength:40,className:"min-w-0 flex-1 rounded bg-surface-2 px-2 py-1 text-[11px] outline-none placeholder:text-muted-foreground"}),a.jsx("button",{type:"button",onClick:we,disabled:!wt.trim(),className:"shrink-0 rounded bg-surface-2 px-2 py-1 text-primary disabled:opacity-40",children:c("android.presetSave")}),ee&&a.jsx("button",{type:"button",onClick:Pe,className:"shrink-0 rounded px-2 py-1 text-destructive hover:bg-surface-2",children:c("android.presetDelete")})]})]})]}),He&&a.jsxs("div",{className:"flex items-center gap-1.5 border-b border-border px-2 py-2",children:[a.jsx("input",{value:Ve,onChange:P=>Ct(P.target.value),onKeyDown:P=>{P.key==="Enter"&&Rr()},placeholder:c("android.addressPlaceholder"),className:"min-w-0 flex-1 rounded bg-surface-2 px-2 py-1 text-[11px] outline-none placeholder:text-muted-foreground"}),a.jsx("button",{type:"button",onClick:()=>{Rr()},disabled:jr,className:"rounded bg-surface-2 px-2 py-1 text-[11px] text-primary disabled:opacity-40",children:jr?a.jsx(_n,{size:12,className:"animate-spin"}):c("android.connect")})]}),Sr&&a.jsxs("div",{className:"flex items-start gap-2 border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:[a.jsx("span",{className:"min-w-0 flex-1",children:c("android.adbUnavailable")}),a.jsx(_x,{label:c("android.insertFixPrompt"),onClick:()=>fs(Lx("adb",Ie??"")),enabled:!!r})]}),!Sr&&Ir&&a.jsxs("div",{className:"flex items-start gap-2 border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:[a.jsx("span",{className:"min-w-0 flex-1",children:c("android.scrcpyUnavailable")}),a.jsx(_x,{label:c("android.insertFixPrompt"),onClick:()=>fs(Lx("scrcpy","")),enabled:!!r})]}),hr&&hr.state!=="device"&&a.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:SP(hr,c)}),Ie&&!Sr&&a.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:hx(Ie)}),Xt&&a.jsxs("details",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:[a.jsxs("summary",{className:"cursor-pointer",children:[c("android.qualityAutoUnavailable")," ",c(Xt.startsWith("SCRCPY_VERSION")?"android.qualityAutoVersionError":Xt.startsWith("SCRCPY_BUILD")?"android.qualityAutoBuildError":/EXTENSION|SERVER_READ|PUSH/.test(Xt.split(":")[0])?"android.qualityAutoExtensionError":/TIMEOUT/.test(Xt.split(":")[0])?"android.qualityAutoTimeoutError":/ENCODER_REJECTED/.test(Xt.split(":")[0])?"android.qualityAutoEncoderError":/CHANNEL|TUNNEL|LISTEN|PROTOCOL|CONNECTION/.test(Xt.split(":")[0])?"android.qualityAutoChannelError":"android.qualityAutoUnknownError")]}),a.jsx("pre",{className:"mt-1 select-text whitespace-pre-wrap break-all text-[10px]",children:Xt})]}),Bt&&a.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:Bt}),ue&&a.jsx("div",{role:"alert",className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:ue}),a.jsxs("div",{className:"relative flex min-h-0 min-w-0 flex-1 touch-none items-center justify-center overflow-hidden bg-[var(--chrome-bg)] p-1",children:[a.jsx("canvas",{ref:g,className:"max-h-full max-w-full touch-none select-none rounded",style:{display:Pr||je?"block":"none",transformOrigin:"center",transition:"none"},onPointerDown:vt,onPointerMove:Tt,onPointerUp:fr,onPointerCancel:()=>ln(),onLostPointerCapture:P=>{j.current.has(P.pointerId)&&ln()},onPointerLeave:P=>{j.current.has(P.pointerId)&&!P.currentTarget.hasPointerCapture?.(P.pointerId)&&ln()},onContextMenu:P=>P.preventDefault()}),X&&a.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full border border-primary/80 bg-primary/35",style:{left:X.left,top:X.top}}),We.length>1&&a.jsx("svg",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 h-full w-full",style:{opacity:It?1:0,transition:"opacity 160ms linear"},children:We.slice(1).map((P,xe)=>{const Ae=We[xe],rt=(xe+1)/(We.length-1);return a.jsx("line",{x1:Ae.x,y1:Ae.y,x2:P.x,y2:P.y,stroke:"var(--primary)",strokeWidth:1+1.6*rt,strokeLinecap:"round",opacity:.06+.45*rt},xe)})}),Jt.map(P=>a.jsx("span",{"aria-hidden":"true",className:"termdock-tap-fade pointer-events-none absolute h-4 w-4 rounded-full bg-primary",style:{left:P.left,top:P.top}},P.id)),!Pr&&a.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 text-center text-[11px] text-muted-foreground",children:[be==="connecting"&&a.jsxs(a.Fragment,{children:[a.jsx(_n,{size:18,className:"animate-spin"}),a.jsx("span",{children:c("android.connecting")})]}),be==="error"&&a.jsxs(a.Fragment,{children:[a.jsx(sw,{size:14,className:"text-destructive"}),a.jsx("span",{className:"max-w-[80%] text-destructive",children:lr?c("android.reconnecting"):hx(le||"")}),K&&a.jsx("button",{type:"button",onClick:()=>{ce.current=0,Vn(K)},className:"rounded bg-surface-2 px-2 py-1 text-foreground",children:c("android.retry")})]}),be==="idle"&&!Sr&&!Ir&&a.jsxs(a.Fragment,{children:[a.jsx(zw,{size:22,className:"opacity-60"}),a.jsx("span",{children:Et.length?c("android.idleHint"):c("android.noDevicesHint")})]})]})]}),a.jsxs("div",{className:`flex flex-wrap items-center gap-1 border-t border-border ${Jr?"px-1.5 py-0.5":"px-2 py-1.5"}`,children:[a.jsx(To,{compact:Jr,label:c("android.back"),onClick:()=>x.current?.back(),disabled:!Pr,children:a.jsx(S8,{size:14})}),a.jsx(To,{compact:Jr,label:c("android.home"),onClick:()=>x.current?.home(),disabled:!Pr,children:a.jsx(Mw,{size:14})}),a.jsx(To,{compact:Jr,label:c("android.recents"),onClick:()=>x.current?.recents(),disabled:!Pr,children:a.jsx(ab,{size:14})}),a.jsx(To,{compact:Jr,label:c("android.notifications"),onClick:()=>x.current?.expandNotifications(),disabled:!Pr,children:a.jsx(rb,{size:14})}),a.jsx(To,{compact:Jr,label:c("android.rotate"),onClick:()=>x.current?.rotate(),disabled:!Pr,children:a.jsx(xA,{size:14})}),a.jsx(To,{compact:Jr,label:c("android.volumeDown"),onClick:()=>x.current?.volumeDown(),disabled:!Pr,children:a.jsx(zA,{size:14})}),a.jsx(To,{compact:Jr,label:c("android.volumeUp"),onClick:()=>x.current?.volumeUp(),disabled:!Pr,children:a.jsx(WA,{size:14})}),a.jsx(To,{compact:Jr,label:c("android.power"),onClick:()=>x.current?.power(),disabled:!Pr,children:a.jsx(fA,{size:14})}),a.jsx(To,{compact:Jr,label:c("android.inputText"),active:Br,onClick:()=>Wn(P=>!P),disabled:!Pr,children:a.jsx(ib,{size:14})}),a.jsx(To,{compact:Jr,label:c("android.zoomIn"),onClick:()=>nn("in"),disabled:!Pr||$>=sh-.01,children:a.jsx(wi,{size:14})}),a.jsx(To,{compact:Jr,label:c("android.zoomOut"),onClick:()=>nn("out"),disabled:!Pr||$<=ll+.01,children:a.jsx(ob,{size:14})}),a.jsxs("div",{className:"relative ml-auto h-5 w-24 min-w-0 max-w-full shrink-0","data-mirror-capture-status":!0,children:[a.jsx("span",{"aria-hidden":st||!!St||An,className:`block truncate text-right text-[10px] leading-5 tabular-nums text-muted-foreground ${st||St||An?"invisible":""}`,children:je?a.jsx(a.Fragment,{children:a.jsx("span",{ref:de})}):""}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-end overflow-hidden",children:a.jsx(TP,{recording:st,elapsed:Ur,status:An?c("android.captureInserting"):St,stopLabel:c("android.recordingStop"),onStop:()=>{ii("manual")}})})]})]}),Br&&a.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border px-2 py-1.5",children:[a.jsx("input",{value:an,onChange:P=>ke(P.target.value),onKeyDown:P=>{P.key==="Enter"&&!P.nativeEvent.isComposing&&(P.preventDefault(),Vr())},placeholder:c("android.inputPlaceholder"),className:"min-w-0 flex-1 rounded bg-surface-2 px-2 py-1 text-[11px] outline-none placeholder:text-muted-foreground",autoFocus:!0}),a.jsx("button",{type:"button",onClick:Vr,disabled:!an,className:"rounded bg-surface-2 p-1.5 text-primary disabled:opacity-40",title:c("android.send"),children:a.jsx(wA,{size:13})})]})]});return h==="window"?Ai.createPortal(a.jsx("div",{className:"fixed inset-0 z-modal-panel flex flex-col bg-[var(--chrome-bg)]",style:{paddingTop:"var(--safe-top-inset, env(safe-area-inset-top, 0px))",paddingBottom:"var(--safe-bottom-inset, env(safe-area-inset-bottom, 0px))"},children:fn}),document.body):t?q&&Ye?Ai.createPortal(fn,Ye):null:q&&Ye?a.jsxs(a.Fragment,{children:[Ai.createPortal(fn,Ye),a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center text-[11px] text-muted-foreground",children:[a.jsx(dl,{size:18,className:"opacity-60"}),a.jsx("span",{children:c("android.splitDockedHint")}),a.jsx("button",{type:"button",onClick:()=>{Lt(X0,null),Gr({docked:null})},className:"rounded bg-surface-2 px-2 py-1 text-foreground",children:c("android.splitClose")})]})]}):fn}function Qd({icon:e,label:t,active:r=!1,disabled:n=!1,onSelect:i}){return a.jsxs("button",{type:"button",role:"menuitem",disabled:n,onClick:i,className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left transition hover:bg-surface-2 disabled:opacity-40 disabled:hover:bg-transparent ${r?"text-primary":"text-foreground"}`,children:[a.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:e}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),r&&a.jsx(ua,{size:12,className:"shrink-0"})]})}function TP({recording:e,elapsed:t,status:r,stopLabel:n,onStop:i}){return e?a.jsxs("span",{role:"status","aria-live":"polite",className:"ml-auto inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded bg-destructive/15 px-1.5 py-0.5 text-[10px] tabular-nums text-destructive",children:[a.jsx("span",{"aria-hidden":"true",className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-destructive"}),yx(t),a.jsx("button",{type:"button",onClick:i,title:n,"aria-label":`${n} · ${yx(t)}`,className:"ml-0.5 inline-flex h-4 w-4 items-center justify-center rounded hover:bg-destructive/25",children:a.jsx(ub,{size:8,fill:"currentColor"})})]}):r?a.jsx("span",{role:"status","aria-live":"polite",title:r,className:"ml-auto truncate text-[10px] text-primary",children:r}):null}function Sx({sessionId:e}){const t=ts(x=>x.docks[cu]),r=!!t,n=t?.sessionId??e??null,l=Sp(x=>x.pending)[0],c=y.useCallback(async x=>{if(!n)throw new Error("没有可接收截图的终端");const w=(await Bu("/tmp",[x])).files[0]?.path;if(!w)throw new Error("截图上传未返回文件路径");await wx(w,n)},[n]),h=y.useCallback(x=>{Sp.getState().enqueue(x,n)},[n]),p=ts(x=>!!x.hosts[cu]),g=y.useRef(!1);return y.useEffect(()=>{g.current||(g.current=!0,$l().then(x=>{const b=x.androidPanel?.docked;b&&(ts.getState().docks[cu]||ts.getState().setDock(cu,b))}).catch(()=>{}))},[]),a.jsxs(a.Fragment,{children:[r&&p&&a.jsx(AP,{sessionId:n,dockOnly:!0,onInsertFile:n?c:void 0,onInsertPrompt:n?x=>ly(x,n):void 0,onRecordingComplete:h}),l&&a.jsx(gP,{file:l.file,initialPath:l.initialPath,onInsert:x=>l.insert?l.insert(x):wx(x,l.sessionId),onDone:()=>Sp.getState().remove(l.file.id)},l.file.id)]})}function _x({label:e,onClick:t,enabled:r}){return r?a.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded bg-surface px-1.5 py-0.5 text-[10px] text-foreground hover:bg-surface-elevated",children:e}):null}function Lx(e,t){return[`Termdock 的“设备投屏”在当前服务端不可用:未找到 ${e==="adb"?"adb(Android platform-tools)":"scrcpy / scrcpy-server"}${t?`(错误:${t})`:""}。`,"请在本机安装并让 Termdock 恢复可用:","1) 安装依赖:"," - macOS: brew install android-platform-tools scrcpy"," - Ubuntu/Debian: sudo apt install adb scrcpy"," - Windows: winget install Google.PlatformTools && winget install Genymobile.scrcpy","2) 若不在 PATH,请在 ~/.termdock/.env 指定 TERMDOCK_ADB_BIN / TERMDOCK_SCRCPY_BIN / TERMDOCK_SCRCPY_SERVER。","3) 完成后重启 Termdock 服务,并用 adb version、scrcpy --version 验证。","边界:只做本机环境安装与配置,不要改动 Termdock 仓库代码。"].join(`
|
|
135
|
-
`)}function kx({label:e,display:t,min:r,max:n,step:i,value:l,onChange:c}){return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-14 shrink-0 text-muted-foreground",children:e}),a.jsx("input",{type:"range",min:r,max:n,step:i,value:l,onChange:h=>c(Number(h.target.value)),className:"h-1 min-w-0 flex-1 accent-primary","aria-label":e}),a.jsx("span",{className:"w-16 shrink-0 text-right tabular-nums text-muted-foreground",children:t})]})}function To({label:e,onClick:t,disabled:r,active:n,compact:i,children:l}){return a.jsx("button",{type:"button",onClick:t,disabled:r,title:e,"aria-label":e,className:`${i?"inline-flex h-5 w-5 items-center justify-center":"p-1.5"} rounded transition active:scale-95 disabled:opacity-30 ${n?"bg-surface-elevated text-primary":"text-muted-foreground hover:bg-surface-2"}`,children:l})}function Ix(e,t,r){const n=e.parentElement;if(!n)return null;const i=e.getBoundingClientRect(),l=n.getBoundingClientRect();return{left:i.left-l.left+(t-i.left),top:i.top-l.top+(r-i.top)}}function jd(e,t,r){const n=e.getBoundingClientRect(),i=e.width||n.width,l=e.height||n.height,c=n.width?(t-n.left)/n.width*i:0,h=n.height?(r-n.top)/n.height*l:0;return{x:Math.max(0,Math.min(i,c)),y:Math.max(0,Math.min(l,h))}}function CP(e){return!(/ADB_NOT_FOUND|SCRCPY_NOT_FOUND|SCRCPY_SERVER_NOT_FOUND|SCRCPY_VERSION_UNKNOWN|SCRCPY_UNSUPPORTED_CODEC|VIDEO_DECODER_UNSUPPORTED|decoder|decode/i.test(e)||/INVALID_SERIAL|INVALID_ADDRESS|API_NOT_ALLOWED|AUTHORIZATION_DENIED/i.test(e))}function Ex(e,t){return e.state==="device"?e.androidVersion?` · Android ${e.androidVersion}`:"":e.state==="unauthorized"?` · ${t("android.stateUnauthorized")}`:e.state==="offline"?` · ${t("android.stateOffline")}`:` · ${t("android.stateUnknown")}`}function SP(e,t){return e.state==="unauthorized"?t("android.unauthorizedHint"):e.state==="offline"?t("android.offlineHint"):t("android.stateUnknown")}function _P(e){return e>=90?"var(--destructive)":e>=70?"var(--warning)":"var(--success)"}function LP(e){return e>=90?"var(--destructive)/0.15":e>=70?"var(--warning)/0.15":"var(--success)/0.12"}function kP(e){if(!e)return"";const t=new Date(e),r=Date.now(),n=t.getTime()-r;if(n<=0)return"";const i=Math.floor(n/6e4),l=Math.floor(i/60),c=Math.floor(l/24),h=l%24,p=i%60,g=t.toLocaleDateString(void 0,{month:"short",day:"numeric"}),x=t.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});let b;return c>0?b=`${c}d ${h}h`:h>0?b=`${h}h ${p}m`:p>0?b=`${p}m`:b="soon",`resets in ${b} (${g} ${x})`}function IP(e){return{claude:"🧠",codex:"✨",kimi:"🌙",copilot:"🐙",grok:"🚀",gemini:"💎"}[e]||"📊"}function EP({result:e}){const{t}=Mr(),r=e.windows.filter(h=>h.percent===0&&!h.resetAt),n=e.windows.filter(h=>h.percent>0||h.resetAt),i=r.length>0?r.map(h=>h.label).join(" · "):"",l=!!e.error;let c=null;return!l&&e.entitlement&&(e.usagePercent>=90?c=t("quota.exhausted"):e.remaining!==void 0&&e.remaining<e.entitlement?c=t("quota.left",{n:e.remaining}):c=`${Math.round(e.usagePercent)}%`),a.jsxs("div",{className:"rounded-xl border border-border/15 bg-surface-2 p-3 sm:p-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[13px] font-semibold text-foreground",children:[a.jsx("span",{className:"shrink-0",children:IP(e.slug)}),a.jsx("span",{className:"truncate",children:e.displayName}),i&&a.jsx("span",{className:"shrink-0 rounded-full bg-surface-elevated px-2 py-0.5 text-[10px] font-normal text-muted-foreground",children:i})]}),c&&a.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:c})]}),n.length>0?a.jsx("div",{className:"mt-2.5 space-y-2",children:n.map(h=>{const p=Math.max(0,Math.min(100,h.percent));return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 text-[12px]",children:[a.jsx("span",{className:"w-14 shrink-0 truncate text-muted-foreground sm:w-16",children:h.label}),a.jsx("div",{className:"flex-1",children:a.jsx("div",{className:"h-2 rounded-full",style:{background:LP(h.percent)},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${p}%`,background:_P(h.percent)}})})}),a.jsxs("span",{className:"w-9 shrink-0 text-right tabular-nums font-medium text-foreground",children:[Math.round(h.percent),"%"]})]}),h.resetAt&&a.jsx("p",{className:"mt-1 pl-14 text-[10px] text-muted-foreground sm:pl-16",children:kP(h.resetAt)})]},h.label)})}):l?a.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:e.error}):null]})}function NP({isOpen:e,onClose:t}){const{t:r}=Mr(),[n,i]=y.useState([]),[l,c]=y.useState(!1),h=async(x=!1)=>{c(!0);try{const b=x?await _8():await L8();i(b.providers||[])}catch{}finally{c(!1)}};if(y.useEffect(()=>{e&&h()},[e]),y.useEffect(()=>{if(!e)return;const x=b=>{const w=b.detail;Array.isArray(w)&&i(w)};return window.addEventListener("termdock:quota-update",x),()=>{window.removeEventListener("termdock:quota-update",x)}},[e]),!e)return null;const p=n.filter(x=>!x.error),g=p.length>0?new Date(Math.max(...p.map(x=>x.fetchedAt||0))):null;return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:t}),a.jsxs("div",{className:"fixed inset-x-3 z-modal-panel mx-auto flex max-w-lg flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)]",style:{top:"max(1.5rem, env(safe-area-inset-top, 0px))",bottom:"max(1.5rem, env(safe-area-inset-bottom, 0px))"},children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-3 py-2.5 sm:px-6 sm:py-3",children:[a.jsx("h2",{className:"text-[14px] font-semibold text-foreground sm:text-base",children:r("quota.title")}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{type:"button",onClick:()=>h(!0),disabled:l,className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-label":r("quota.refresh"),children:a.jsx(rs,{size:15,className:l?"animate-spin":""})}),a.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":r("quota.close"),children:a.jsx(Kn,{size:17})})]})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-3 sm:p-5",children:[l&&p.length===0?a.jsx(gu,{label:r("common.loading"),className:"py-12"}):p.length===0?a.jsxs("div",{className:"py-8 text-center text-[13px] text-muted-foreground",children:[a.jsx("p",{children:r("quota.noProviders")}),a.jsx("p",{className:"mt-1.5 text-[11px]",children:r("quota.noProvidersHint")})]}):a.jsx("div",{className:"space-y-2.5",children:p.map(x=>a.jsx(EP,{result:x},x.slug))}),g&&a.jsx("p",{className:"mt-3 text-center text-[10px] text-muted-foreground",children:r("quota.updated",{time:g.toLocaleTimeString()})})]})]})]})}const Nx=[{label:"Esc",sequence:"\\u001b"},{label:"Tab",sequence:"\\t"},{label:"Enter",sequence:"\\r"},{label:"S-Tab",sequence:"\\u001b[Z"},{label:"C-c",sequence:"\\u0003"},{label:"C-d",sequence:"\\u0004"},{label:"C-l",sequence:"\\u000c"},{label:"C-r",sequence:"\\u0012"},{label:"C-z",sequence:"\\u001a"},{label:"C-w",sequence:"\\u0017"},{label:"Up",sequence:"\\u001b[A"},{label:"Down",sequence:"\\u001b[B"},{label:"Left",sequence:"\\u001b[D"},{label:"Right",sequence:"\\u001b[C"},{label:"PgUp",sequence:"\\u001b[5~"},{label:"PgDn",sequence:"\\u001b[6~"}],RP=2,MP=20;function DP({label:e}){return a.jsx("div",{className:"h-7 rounded-full bg-surface-2 px-3 text-[11px] leading-7 text-center text-muted-foreground truncate",children:e})}function BP({value:e,onChange:t,placeholder:r}){const{t:n}=Mr(),[i,l]=C.useState(""),c=b=>{const w=[];let A="",k=!1;const E=()=>{const M=A.trim();M&&w.push(M),A=""};for(let M=0;M<b.length;M+=1){const Q=b[M];if(!k&&Q==="/"&&A.trim().length===0){k=!0,A+=Q;continue}if(k){if(A+=Q,Q==="/"&&b[M-1]!=="\\"&&A.length>1){for(;M+1<b.length&&/[gimsuy]/.test(b[M+1]??"");)M+=1,A+=b[M];E(),k=!1}continue}if(Q===","||/\s/.test(Q)){E();continue}A+=Q}if(E(),w.length===0)return;const I=[...e];for(const M of w){const Q=o3(M);Q&&(I.includes(Q)||I.push(Q))}t(I),l("")},h=b=>{t(e.filter(w=>w!==b))},p=i.trim(),g=p.length>0&&x2(p),x=g&&!ph(p);return a.jsx("div",{className:"rounded-2xl bg-surface px-3 py-2 ring-1 ring-border/15 focus-within:ring-accent/40",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(b=>{const w=x2(b),A=w&&!ph(b);return a.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] ${A?"bg-destructive/15 text-destructive":w?"bg-accent/15 font-mono text-accent":"bg-surface-elevated text-foreground"}`,title:w?A?n("settings.invalidRegex"):"Regex match":"Substring match (case-insensitive)",children:[w&&a.jsx("span",{className:"text-[10px] opacity-70",children:"re"}),b,a.jsx("button",{type:"button",onClick:()=>h(b),className:"rounded-full p-0.5 text-muted-foreground hover:bg-destructive/20 hover:text-destructive","aria-label":n("toolbarPresets.removeAction",{name:b}),children:a.jsx(Kn,{size:12})})]},b)}),a.jsx("input",{type:"text",value:i,onChange:b=>l(b.target.value),onKeyDown:b=>{b.key==="Enter"||b.key===","&&!g?(b.preventDefault(),c(i)):b.key==="Backspace"&&i.length===0&&e.length>0&&h(e[e.length-1])},onBlur:()=>c(i),placeholder:e.length===0?r:"",className:`min-w-[8ch] flex-1 bg-transparent py-1 text-sm outline-none placeholder:text-muted/60 ${g?"font-mono":""} ${x?"text-destructive":""}`,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off"})]})})}function QP({value:e,min:t,max:r,onChange:n}){const{t:i}=Mr();return a.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full bg-surface px-1 py-1 ring-1 ring-border/15",children:[a.jsx("button",{type:"button",onClick:()=>n(Math.max(t,e-1)),disabled:e<=t,className:"h-7 w-7 rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-40 inline-flex items-center justify-center","aria-label":i("common.decrease"),children:a.jsx(ob,{size:14})}),a.jsx("span",{className:"w-6 text-center text-sm font-medium tabular-nums text-foreground",children:e}),a.jsx("button",{type:"button",onClick:()=>n(Math.min(r,e+1)),disabled:e>=r,className:"h-7 w-7 rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-40 inline-flex items-center justify-center","aria-label":i("common.increase"),children:a.jsx(wi,{size:14})})]})}const jP=({presets:e,selectedPresetId:t,onSelectPreset:r,onUpdatePreset:n,onAddPreset:i,onRemovePreset:l,onResetDefaults:c})=>{const{t:h}=Mr(),p=e.find(M=>M.id===t)??e[0]??null,[g,x]=C.useState(null);if(!p)return null;const b=p.actions.length>0,w=[{id:"preview-auto",label:p.label,kind:"preset"},...p.includeAlt?[{id:"preview-alt",label:"Alt"}]:[],...b?p.actions.map((M,Q)=>({id:M.id,label:Xp(M,Q)})):["Enter","Home","End","Ctrl-C","Ctrl-D"].map(M=>({id:M,label:M}))],A=l3(w,p.rowLayout),k=(M,Q)=>{n(p.id,j=>{const F=j.actions.findIndex(te=>te.id===M);if(F===-1)return j;const V=F+Q;if(V<0||V>=j.actions.length)return j;const $=[...j.actions];return[$[F],$[V]]=[$[V],$[F]],{...j,actions:$}})},E=p.rowLayout.reduce((M,Q)=>M+Q,0),I=1+(p.includeAlt?1:0);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"sticky top-[-1rem] sm:top-[-1.5rem] z-10 -mx-4 -mt-4 sm:-mx-6 sm:-mt-6 border-b border-border/15 bg-surface/95 backdrop-blur px-4 py-3 sm:px-6",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.preview")}),a.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[p.actions.length," button",p.actions.length===1?"":"s"," · ",E," slot",E===1?"":"s"]})]}),a.jsx("div",{className:"space-y-1 rounded-2xl bg-surface-2/60 p-2",children:A.map((M,Q)=>{const j=M.items[0]?.kind==="preset",F=Math.max(2,M.columns),V=j?`${c3}px repeat(${Math.max(1,F-1)}, minmax(0, 1fr))`:`repeat(${F}, minmax(0, 1fr))`;return a.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:V},children:M.items.map($=>$.kind==="preset"?a.jsx(u3,{mode:"auto",presetLabel:$.label,title:`Auto preset · ${$.label}`,disabled:!0},$.id):a.jsx(DP,{label:$.label},$.id))},`preview-row-${Q}`)})}),p.actions.length>E-I&&a.jsx("p",{className:"mt-1.5 text-[10px] text-muted-foreground",children:h("toolbarPresets.overCapacityHint")})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.presets")}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("button",{type:"button",onClick:i,className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-2 text-xs font-medium hover:bg-surface-elevated transition",children:[a.jsx(wi,{size:14}),h("toolbarPresets.new")]}),a.jsxs("button",{type:"button",onClick:c,className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-2 text-xs font-medium hover:bg-surface-elevated transition",children:[a.jsx(rs,{size:14}),h("toolbarPresets.reset")]})]})]}),a.jsx("div",{className:"-mx-1 flex flex-wrap gap-1.5 px-1",children:e.map(M=>a.jsxs("button",{type:"button",onClick:()=>r(M.id),className:`rounded-full px-3 py-2 text-xs font-medium transition ${M.id===p.id?"bg-primary/20 text-primary ring-1 ring-primary/30":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,children:[M.label,M.actions.length>0&&a.jsx("span",{className:"ml-1.5 text-[10px] text-muted-foreground",children:M.actions.length})]},M.id))})]}),a.jsxs("div",{className:"space-y-4 rounded-2xl bg-surface p-4 ring-1 ring-border/10",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.label")}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:p.label,onChange:M=>n(p.id,Q=>({...Q,label:M.target.value})),className:"flex-1 rounded-full bg-surface-2 px-4 py-2.5 text-sm placeholder:text-muted/60 outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.presetLabelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"}),p.id!=="default"&&a.jsx("button",{type:"button",onClick:()=>l(p.id),className:"shrink-0 rounded-full bg-surface-2 px-3 py-2.5 text-destructive hover:bg-destructive/15","aria-label":h("toolbarPresets.deletePreset",{name:p.label}),children:a.jsx(ri,{size:14})})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.matchPrograms")}),a.jsx("span",{className:"text-[10px] text-muted-foreground",children:h("toolbarPresets.typeEnterHint")})]}),a.jsx(BP,{value:p.programs,onChange:M=>n(p.id,Q=>({...Q,programs:M})),placeholder:h("toolbarPresets.programsPlaceholder")}),a.jsx("p",{className:"text-[10px] text-muted-foreground",children:h("toolbarPresets.programsHelp")})]}),a.jsxs("button",{type:"button",onClick:()=>n(p.id,M=>({...M,includeAlt:!M.includeAlt})),className:"flex w-full items-center justify-between rounded-2xl bg-surface-2 px-4 py-3 text-sm transition hover:bg-surface-elevated",children:[a.jsxs("span",{children:[a.jsx("span",{className:"block font-medium text-foreground",children:h("toolbarPresets.altSlot")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:h("toolbarPresets.altSlotHint")})]}),a.jsx(qo,{checked:p.includeAlt})]}),a.jsxs("button",{type:"button",onClick:()=>n(p.id,M=>({...M,showOnDesktop:!M.showOnDesktop})),className:"flex w-full items-center justify-between rounded-2xl bg-surface-2 px-4 py-3 text-sm transition hover:bg-surface-elevated",children:[a.jsxs("span",{children:[a.jsx("span",{className:"block font-medium text-foreground",children:h("toolbarPresets.desktopVisibility")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:h("toolbarPresets.desktopVisibilityHint")})]}),a.jsx(qo,{checked:p.showOnDesktop===!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.rowLayout")}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:h("toolbarPresets.rowLayoutHint")})]}),a.jsxs("button",{type:"button",onClick:()=>n(p.id,M=>({...M,rowLayout:[...j1(M.rowLayout),3]})),className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-1.5 text-xs font-medium hover:bg-surface-elevated",children:[a.jsx(wi,{size:12}),h("toolbarPresets.addRow")]})]}),a.jsx("div",{className:"space-y-2",children:p.rowLayout.map((M,Q)=>a.jsxs("div",{className:"flex items-center gap-3 rounded-2xl bg-surface-2 px-3 py-2",children:[a.jsx("span",{className:"w-12 shrink-0 text-xs text-muted-foreground",children:h("toolbarPresets.rowN",{n:Q+1})}),a.jsx("div",{className:"flex-1"}),a.jsx(QP,{value:M,min:RP,max:MP,onChange:j=>n(p.id,F=>({...F,rowLayout:F.rowLayout.map((V,$)=>$===Q?j:V)}))}),p.rowLayout.length>1&&a.jsx("button",{type:"button",onClick:()=>n(p.id,j=>({...j,rowLayout:j.rowLayout.filter((F,V)=>V!==Q)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":h("toolbarPresets.removeRow",{n:Q+1}),children:h("toolbarPresets.del")})]},`row-${Q}`))})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.buttons")}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:h("toolbarPresets.buttonsHint")})]}),a.jsxs("button",{type:"button",onClick:()=>{const M=`${p.id}-action-${Date.now()}`;n(p.id,Q=>({...Q,actions:[...Q.actions,{id:M,label:`Key ${Q.actions.length+1}`,sequence:""}]})),x(M)},className:"inline-flex items-center gap-1 rounded-full bg-primary/15 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/25",children:[a.jsx(wi,{size:12}),h("toolbarPresets.addButton")]})]}),p.actions.length===0&&a.jsx("div",{className:"rounded-2xl bg-surface-2/60 px-4 py-6 text-center text-[11px] text-muted-foreground",children:h("toolbarPresets.noCustomButtons")}),p.actions.map((M,Q)=>{const j=g===M.id;return a.jsxs("div",{className:`rounded-2xl bg-surface-2 transition ${j?"ring-1 ring-accent/40":""}`,children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[a.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.jsx("button",{type:"button",onClick:()=>k(M.id,-1),disabled:Q===0,className:"h-6 w-6 rounded-full bg-surface text-muted-foreground hover:bg-surface-elevated disabled:opacity-30 inline-flex items-center justify-center","aria-label":h("toolbarPresets.moveUp"),children:a.jsx(tb,{size:12})}),a.jsx("button",{type:"button",onClick:()=>k(M.id,1),disabled:Q===p.actions.length-1,className:"h-6 w-6 rounded-full bg-surface text-muted-foreground hover:bg-surface-elevated disabled:opacity-30 inline-flex items-center justify-center","aria-label":h("toolbarPresets.moveDown"),children:a.jsx(F9,{size:12})})]}),a.jsxs("button",{type:"button",onClick:()=>x(j?null:M.id),className:"min-w-0 flex-1 text-left",children:[a.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:Xp(M,Q)}),a.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:[M.sequence?M.sequence:h("toolbarPresets.noSequence"),M.doubleTapSequence&&a.jsxs("span",{className:"ml-1 text-accent/70",children:["· 2× ",M.doubleTapSequence]})]})]}),a.jsx("button",{type:"button",onClick:()=>n(p.id,F=>({...F,actions:F.actions.filter(V=>V.id!==M.id)})),className:"shrink-0 rounded-full bg-surface p-2 text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":h("toolbarPresets.removeAction",{name:M.label}),children:a.jsx(ri,{size:14})})]}),j&&a.jsxs("div",{className:"space-y-3 border-t border-border/10 px-3 py-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.labelField")}),a.jsx("input",{type:"text",value:M.label,onChange:F=>n(p.id,V=>({...V,actions:V.actions.map($=>$.id===M.id?{...$,label:F.target.value}:$)})),className:"w-full rounded-full bg-surface px-4 py-2.5 text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.labelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.sequence")}),a.jsx("input",{type:"text",value:M.sequence,onChange:F=>n(p.id,V=>({...V,actions:V.actions.map($=>$.id===M.id?{...$,sequence:F.target.value}:$)})),className:"w-full rounded-full bg-surface px-4 py-2.5 font-mono text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.sequencePlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),a.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:Nx.map(F=>a.jsx("button",{type:"button",onClick:()=>n(p.id,V=>({...V,actions:V.actions.map($=>$.id===M.id?{...$,sequence:F.sequence}:$)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:F.label},F.label))})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.doubleTap")}),!M.doubleTapSequence&&a.jsx("button",{type:"button",onClick:()=>n(p.id,F=>({...F,actions:F.actions.map(V=>V.id===M.id?{...V,doubleTapSequence:""}:V)})),className:"text-[10px] text-accent hover:text-accent/80",children:h("toolbarPresets.doubleTapAdd")})]}),M.doubleTapSequence!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"text",value:M.doubleTapSequence,onChange:F=>n(p.id,V=>({...V,actions:V.actions.map($=>$.id===M.id?{...$,doubleTapSequence:F.target.value}:$)})),className:"w-full rounded-full bg-surface px-4 py-2.5 font-mono text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.doubleTapPlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[Nx.map(F=>a.jsx("button",{type:"button",onClick:()=>n(p.id,V=>({...V,actions:V.actions.map($=>$.id===M.id?{...$,doubleTapSequence:($.doubleTapSequence??"")+F.sequence}:$)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:F.label},F.label)),a.jsx("button",{type:"button",onClick:()=>n(p.id,F=>({...F,actions:F.actions.map(V=>{if(V.id!==M.id)return V;const{doubleTapSequence:$,...te}=V;return te})})),className:"rounded-full bg-destructive/10 px-2.5 py-1 text-[11px] font-medium text-destructive/70 hover:bg-destructive/20 hover:text-destructive",children:h("toolbarPresets.remove")})]})]})]})]})]},M.id)})]})]})]})},PP={installed:"text-[color:var(--success)]",outdated:"text-[color:var(--warning)]","needs-approval":"text-[color:var(--warning)]","not-installed":"text-muted-foreground"};function OP(){const{t:e}=Mr(),[t,r]=C.useState(null),[n,i]=C.useState(null),[l,c]=C.useState(null),[h,p]=C.useState(null),[g,x]=C.useState(!1),[b,w]=C.useState(!1),[A,k]=C.useState(""),[E,I]=C.useState(""),[M,Q]=C.useState(null),[j,F]=C.useState([]),[V,$]=C.useState([]),[te,se]=C.useState(null),[qe,de]=C.useState(new Set),[oe,Oe]=C.useState(null),[et,ce]=C.useState("auto"),[Be,ot]=C.useState({}),[Ie,re]=C.useState(null),[Ue,_e]=C.useState(null),[K,Le]=C.useState(10),[fe,$e]=C.useState(""),[ze,Ee]=C.useState(""),[ee,Ke]=C.useState(12e3),[wt,tt]=C.useState(null),[ge,it]=C.useState(null),ht=C.useCallback(async()=>{const[X,Re,We,Qt]=await Promise.allSettled([k8(),I8(),$l(),A0()]);if(r(X.status==="fulfilled"?X.value:[]),Re.status==="fulfilled"){const It=Re.value;F(It.plugins??[]),$(It.errors??[])}else F([]),$([]);if(We.status==="fulfilled"){const It=We.value;de(new Set(It.autoRenameAgents??[])),ce(It.autoRenameNamer??"auto"),ot(It.autoRenameModels??{}),Le(It.autoRenameIntervalMinutes??10),$e(It.autoRenamePromptPreference??""),Ee(It.autoRenamePromptPreference??""),Ke(It.autoRenamePromptPayloadChars??12e3)}else de(new Set);re(Qt.status==="fulfilled"?Qt.value:[])},[]);C.useEffect(()=>{ht()},[ht]);const Y=async(X,Re)=>{i(X),c(null);try{Re==="install"?(await E8(X)).devMode&&p(X):(await N8(X),h===X&&p(null)),await ht()}catch(We){c(We instanceof Error?We.message:String(We))}finally{i(null)}},be=X=>e(X==="installed"?"settings.agentHooksInstalled":X==="outdated"?"settings.agentHooksOutdated":X==="needs-approval"?"settings.agentHooksNeedsApproval":"settings.agentHooksNotInstalled"),ut=async()=>{Q(null);let X;try{X=JSON.parse(E)}catch{Q("Invalid JSON");return}try{await j8(X),I(""),x(!1),await ht()}catch(Re){if(Re instanceof P8&&Re.migration){$(We=>[{slug:typeof X.slug=="string"?X.slug:"manifest.json",errors:Re.message.split(`
|
|
136
|
-
`),code:Re.code,migration:Re.migration},...We.filter(Qt=>Qt.slug!==X.slug)]);return}Q(Re instanceof Error?Re.message:String(Re))}},le=async()=>{const X=A.trim();if(X){tt("install"),Q(null);try{await R8(X),k(""),w(!1),await ht()}catch(Re){Q(Re instanceof Error?Re.message:String(Re))}finally{tt(null)}}},pe=async X=>{tt(`remove:${X}`);try{await Q8(X),it(Re=>Re?.slug===X?null:Re),await ht()}catch(Re){c(Re instanceof Error?Re.message:String(Re))}finally{tt(null)}},je=async X=>{tt(`check:${X}`),c(null);try{await B8(X),await ht()}catch(Re){c(Re instanceof Error?Re.message:String(Re))}finally{tt(null)}},xt=async X=>{tt(`update:${X}`),c(null);try{const Re=await D8(X),We=[Re.hookWarning,Re.titleWarning].filter(Boolean).join(" ");We&&c(We),it(Qt=>Qt?.slug===X?null:Qt),await ht()}catch(Re){c(Re instanceof Error?Re.message:String(Re))}finally{tt(null)}},dt=async X=>{tt(`doctor:${X}`),c(null),it(null);try{const Re=await M8(X);it(Re),re(await A0())}catch(Re){c(Re instanceof Error?Re.message:String(Re))}finally{tt(null)}},Dt=async X=>{const Re=X.migration?.aiPrompt??X.errors.join(`
|
|
137
|
-
`);try{await navigator.clipboard.writeText(Re),se(X.slug),window.setTimeout(()=>se(We=>We===X.slug?null:We),1800)}catch{Q(Re)}},Xt=async X=>{if(oe)return;const Re=qe,We=new Set(Re);We.has(X)?We.delete(X):We.add(X),de(We),Oe(X),c(null);try{const Qt=await ca({autoRenameAgents:[...We]});de(new Set(Qt.autoRenameAgents??[])),re(await A0(!0))}catch(Qt){de(Re),c(Qt instanceof Error?Qt.message:String(Qt))}finally{Oe(null)}},Ht=async X=>{const Re=et;ce(X),_e("namer"),c(null);try{const We=await ca({autoRenameNamer:X});ce(We.autoRenameNamer??"auto"),re(await A0(!0))}catch(We){ce(Re),c(We instanceof Error?We.message:String(We))}finally{_e(null)}},Bt=async(X,Re)=>{const We=Be,Qt={...We};Re?Qt[X]=Re:delete Qt[X],ot(Qt),_e(X),c(null);try{const It=await ca({autoRenameModels:Qt});ot(It.autoRenameModels??{})}catch(It){ot(We),c(It instanceof Error?It.message:String(It))}finally{_e(null)}},Wt=async X=>{const Re=K;Le(X),_e("interval"),c(null);try{const We=await ca({autoRenameIntervalMinutes:X});Le(We.autoRenameIntervalMinutes??10)}catch(We){Le(Re),c(We instanceof Error?We.message:String(We))}finally{_e(null)}},lr=async()=>{const X=fe.trim();if(X!==ze){_e("preference"),c(null);try{const We=(await ca({autoRenamePromptPreference:X})).autoRenamePromptPreference??"";$e(We),Ee(We)}catch(Re){$e(ze),c(Re instanceof Error?Re.message:String(Re))}finally{_e(null)}}},ur=async X=>{const Re=Math.max(1e3,Math.min(64e3,Math.round(X||12e3))),We=ee;Ke(Re),_e("payload-limit"),c(null);try{const Qt=await ca({autoRenamePromptPayloadChars:Re});Ke(Qt.autoRenamePromptPayloadChars??12e3)}catch(Qt){Ke(We),c(Qt instanceof Error?Qt.message:String(Qt))}finally{_e(null)}},Jt=new Set(j.map(X=>X.slug)),Er=ge?{ok:e("settings.agentPluginDoctorStatusOk"),"missing-title-namer":e("settings.agentPluginDoctorStatusMissing"),"cli-default":e("settings.agentPluginDoctorStatusCliDefault"),"no-models":e("settings.agentPluginDoctorStatusNoModels"),"probe-failed":e("settings.agentPluginDoctorStatusFailed")}[ge.status]:"";return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentAutoRename")}),a.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameHint")}),a.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameNamer")}),a.jsxs("select",{value:et,disabled:Ue!==null,onChange:X=>{Ht(X.target.value)},className:"min-w-0 rounded-lg bg-surface px-2.5 py-1.5 text-[11px] text-foreground outline-none disabled:opacity-50",children:[a.jsx("option",{value:"auto",children:e("settings.agentAutoRenameFollow")}),Ie?.filter(X=>X.available).map(X=>a.jsx("option",{value:X.slug,children:X.displayName},X.slug))]})]}),a.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameInterval")}),a.jsx("select",{value:K,disabled:Ue!==null,onChange:X=>{Wt(Number(X.target.value))},className:"min-w-0 rounded-lg bg-surface px-2.5 py-1.5 text-[11px] text-foreground outline-none disabled:opacity-50",children:[5,10,30,60].map(X=>a.jsxs("option",{value:X,children:[X," ",e("settings.agentAutoRenameMinutes")]},X))})]}),a.jsxs("details",{className:"mt-2 border-t border-border/40 pt-2",children:[a.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentAutoRenameAdvanced")}),a.jsxs("label",{className:"mt-2 block",children:[a.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePreference")}),a.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePreferenceHint")}),a.jsx("textarea",{value:fe,maxLength:2e3,rows:3,disabled:Ue!==null,placeholder:e("settings.agentAutoRenamePreferencePlaceholder"),onChange:X=>$e(X.target.value),onBlur:()=>{lr()},className:"mt-1.5 w-full resize-y rounded-lg bg-surface px-2.5 py-2 text-[11px] text-foreground outline-none placeholder:text-muted-foreground/70 focus:ring-1 focus:ring-primary/50 disabled:opacity-50"}),a.jsx("span",{className:"mt-1 block text-right text-[10px] text-muted-foreground",children:Ue==="preference"?e("settings.saving"):`${fe.length}/2000`})]}),a.jsxs("label",{className:"mt-2 block",children:[a.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePayloadLimit")}),a.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePayloadLimitHint")}),a.jsx("input",{type:"number",min:1e3,max:64e3,step:1e3,value:ee,disabled:Ue!==null,onChange:X=>Ke(Number(X.target.value)),onBlur:X=>{ur(Number(X.target.value))},className:"mt-1.5 w-full rounded-lg bg-surface px-2.5 py-2 text-[11px] text-foreground outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50"})]})]}),a.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/40 pt-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameModelsFromCli")}),a.jsx("button",{type:"button",onClick:async()=>{re(null);try{re(await A0(!0))}catch{re([])}},className:"rounded p-1 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",title:e("settings.agentAutoRenameRefreshModels"),children:a.jsx(rs,{size:11,className:Ie===null?"animate-spin":""})})]}),Ie?.filter(X=>X.available).map(X=>{const Re=X.models.find(We=>We.id===X.recommendedModel);return a.jsxs("label",{className:"flex items-center justify-between gap-3",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:X.displayName}),a.jsxs("select",{value:Be[X.slug]??"",disabled:Ue!==null,onChange:We=>{Bt(X.slug,We.target.value)},className:"min-w-0 max-w-[68%] rounded-lg bg-surface px-2.5 py-1.5 text-[11px] text-foreground outline-none disabled:opacity-50",children:[a.jsx("option",{value:"",children:Re?`${e("settings.agentAutoRenameAutomatic")} · ${Re.displayName}`:e("settings.agentAutoRenameCliDefault")}),X.models.map(We=>a.jsx("option",{value:We.id,children:We.displayName},We.id))]})]},X.slug)}),Ie?.length===0&&a.jsx("div",{className:"text-[10px] text-[color:var(--warning)]",children:e("settings.agentAutoRenameNoCli")})]})]}),t===null&&a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[a.jsx(_n,{size:12,className:"animate-spin"})," …"]}),t?.map(X=>{const Re=n===X.slug,We=X.state!=="not-installed",Qt=Jt.has(X.slug);return a.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-surface-2 px-3 py-2.5",children:[a.jsx(dc,{agent:{slug:X.slug,displayName:X.displayName,accentColor:X.accentColor??"#878580",icon:X.icon,isPlugin:Qt,iconMode:X.iconMode,iconVersion:X.iconVersion??void 0},size:18}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[13px] font-medium text-foreground",children:X.displayName}),Qt&&a.jsx("span",{className:"rounded bg-[rgb(var(--success-rgb)_/_0.12)] px-1 py-px text-[9px] font-medium text-[color:var(--success)]",children:"plugin"}),a.jsxs("span",{className:`text-[10px] ${PP[X.state]}`,children:[X.state==="installed"&&a.jsx(Ym,{size:10,className:"mr-0.5 inline"}),(X.state==="outdated"||X.state==="needs-approval")&&a.jsx(eb,{size:10,className:"mr-0.5 inline"}),be(X.state)]})]}),a.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",title:X.targetDisplay,children:[e("settings.agentHooksTarget")," ",X.targetDisplay]}),h===X.slug&&a.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksDevMode")}),X.state==="needs-approval"&&a.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksApprovalHint")})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("button",{type:"button",disabled:oe!==null,onClick:()=>{Xt(X.slug)},className:"flex shrink-0 items-center gap-1.5 rounded-full px-2 py-1 text-[10px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-pressed":qe.has(X.slug),title:e("settings.agentAutoRenameToggle"),children:[a.jsx("span",{children:e("settings.agentAutoRenameShort")}),a.jsx(qo,{checked:qe.has(X.slug),disabled:oe!==null,size:"sm"})]}),a.jsxs("button",{type:"button",disabled:Re,onClick:()=>{Y(X.slug,We?"uninstall":"install")},className:`flex shrink-0 items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition ${We?"bg-surface text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)]"} disabled:opacity-50`,children:[Re?a.jsx(_n,{size:11,className:"animate-spin"}):We?a.jsx(ri,{size:11}):X.state==="outdated"?a.jsx(rs,{size:11}):a.jsx(yu,{size:11}),Re?"…":We?e("settings.agentHooksUninstall"):X.state==="outdated"?e("settings.agentHooksReinstall"):e("settings.agentHooksInstall")]})]})]},X.slug)}),l&&a.jsx("div",{className:"rounded-xl bg-[rgb(var(--warning-rgb)_/_0.10)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:l}),a.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentPlugins")}),a.jsxs("button",{type:"button",onClick:()=>w(!b),className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-2.5 py-1 text-[11px] font-medium text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)] transition",children:[a.jsx(wi,{size:11}),e("settings.agentPluginAdd")]})]}),a.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentPluginHint")}),b&&a.jsxs("div",{className:"mt-2 space-y-2",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{value:A,onChange:X=>k(X.target.value),onKeyDown:X=>{X.key==="Enter"&&le()},className:"min-w-0 flex-1 rounded-lg bg-surface px-3 py-2 font-mono text-[11px] text-foreground placeholder:text-muted-foreground outline-none",placeholder:e("settings.agentPluginSourcePlaceholder")}),a.jsxs("button",{type:"button",disabled:!A.trim()||wt!==null,onClick:()=>{le()},className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-3 py-1 text-[11px] font-medium text-[color:var(--success)] transition hover:bg-[rgb(var(--success-rgb)_/_0.22)] disabled:opacity-50",children:[wt==="install"?a.jsx(_n,{size:11,className:"animate-spin"}):a.jsx(yu,{size:11}),e("settings.agentPluginInstallPackage")]})]}),a.jsx("button",{type:"button",onClick:()=>x(!g),className:"text-[10px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentPluginAdvancedManifest")})]}),j.map(X=>{const Re=X.revision?.slice(0,8),We=wt?.endsWith(`:${X.slug}`)===!0;return a.jsxs("div",{className:"mt-2 flex items-center gap-2 border-t border-border/40 pt-2",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-medium text-foreground",children:[a.jsx("span",{className:"truncate",children:X.displayName}),X.updateAvailable&&a.jsx("span",{className:"text-[9px] text-[color:var(--warning)]",children:e("settings.agentPluginUpdateAvailable")})]}),a.jsxs("div",{className:"truncate text-[9px] text-muted-foreground",title:X.source??void 0,children:[X.source??e("settings.agentPluginManualSource"),Re?` · ${Re}`:""]})]}),a.jsxs("button",{type:"button",disabled:wt!==null,onClick:()=>{dt(X.slug)},className:"flex items-center gap-1 rounded-full bg-surface px-2 py-1 text-[10px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50",title:e("settings.agentPluginDoctorHint"),children:[wt===`doctor:${X.slug}`?a.jsx(_n,{size:10,className:"animate-spin"}):a.jsx(RA,{size:10}),e("settings.agentPluginDoctor")]}),X.updateSupported&&a.jsxs("button",{type:"button",disabled:wt!==null,onClick:()=>{X.updateAvailable?xt(X.slug):je(X.slug)},className:"flex items-center gap-1 rounded-full bg-surface px-2 py-1 text-[10px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50",children:[We?a.jsx(_n,{size:10,className:"animate-spin"}):a.jsx(rs,{size:10}),X.updateAvailable?e("settings.agentPluginUpdate"):e("settings.agentPluginCheck")]}),a.jsx("button",{type:"button",disabled:wt!==null,onClick:()=>{pe(X.slug)},className:"rounded-full p-1 text-muted-foreground transition hover:bg-surface-elevated hover:text-[color:var(--warning)] disabled:opacity-50",title:e("settings.agentPluginDelete"),children:a.jsx(ri,{size:11})})]},X.slug)}),ge&&a.jsxs("div",{className:`mt-2 rounded-lg px-3 py-2 text-[10px] ${ge.status==="ok"||ge.status==="cli-default"?"bg-[rgb(var(--success-rgb)_/_0.10)] text-[color:var(--success)]":"bg-[rgb(var(--warning-rgb)_/_0.10)] text-[color:var(--warning)]"}`,children:[a.jsxs("div",{className:"font-medium",children:[ge.displayName,": ",Er]}),a.jsx("div",{className:"mt-1 text-muted-foreground",children:ge.models.length>0?`${ge.models.length} ${e("settings.agentPluginDoctorModels")}${ge.recommendedModel?` · ${e("settings.agentPluginDoctorAutomatic")} ${ge.recommendedModel}`:""}`:e("settings.agentPluginDoctorCliDefault")}),ge.error&&a.jsx("div",{className:"mt-1 break-words",children:ge.error}),ge.warnings.length>0&&a.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:ge.warnings.map(X=>a.jsxs("div",{children:["• ",X]},X))}),ge.nextSteps.length>0&&a.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:ge.nextSteps.map(X=>a.jsxs("div",{children:["→ ",X]},X))})]}),V.map(X=>a.jsxs("div",{className:"mt-2 rounded-lg bg-[rgb(var(--warning-rgb)_/_0.10)] px-3 py-2 text-[10px] text-[color:var(--warning)]",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("span",{className:"font-medium",children:[X.slug,": ",X.code??e("settings.agentPluginInvalid")]}),a.jsxs("button",{type:"button",onClick:()=>{Dt(X)},className:"flex shrink-0 items-center gap-1 rounded-full bg-[rgb(var(--warning-rgb)_/_0.14)] px-2 py-1 font-medium transition hover:bg-[rgb(var(--warning-rgb)_/_0.22)]",children:[te===X.slug?a.jsx(Ym,{size:10}):a.jsx(nb,{size:10}),te===X.slug?e("settings.agentPluginCopied"):e("settings.agentPluginCopyAiPrompt")]})]}),a.jsx("div",{className:"mt-1 whitespace-pre-wrap break-words text-muted-foreground",children:X.errors.join(`
|
|
138
|
-
`)}),X.migration?.guideCommand&&a.jsx("code",{className:"mt-1 block select-all text-foreground",children:X.migration.guideCommand})]},X.slug)),b&&g&&a.jsxs("div",{className:"mt-2 space-y-2",children:[a.jsx("textarea",{value:E,onChange:X=>I(X.target.value),rows:10,className:"w-full rounded-lg bg-surface px-3 py-2 font-mono text-[11px] text-foreground placeholder:text-muted-foreground outline-none resize-y",placeholder:`{
|
|
139
|
-
"version": 2,
|
|
140
|
-
"slug": "my-agent",
|
|
141
|
-
"displayName": "My Agent",
|
|
142
|
-
"aliases": ["my-agent"],
|
|
143
|
-
"accentColor": "#4385BE",
|
|
144
|
-
"statuses": [
|
|
145
|
-
{ "id": "thinking", "phase": "working", "label": "Thinking", "indicator": "spinner", "tone": "info" },
|
|
146
|
-
{ "id": "approval", "phase": "waiting", "label": "Needs approval", "indicator": "question", "tone": "warning" },
|
|
147
|
-
{ "id": "complete", "phase": "done", "label": "Complete", "indicator": "badge", "tone": "success" }
|
|
148
|
-
],
|
|
149
|
-
"hooks": {
|
|
150
|
-
"target": "~/.my-agent/settings.json",
|
|
151
|
-
"events": [
|
|
152
|
-
{ "hook": "UserPromptSubmit", "event": "prompt-submit", "status": "thinking" },
|
|
153
|
-
{ "hook": "PermissionRequest", "event": "permission-request", "status": "approval" },
|
|
154
|
-
{ "hook": "Stop", "event": "stop", "status": "complete" }
|
|
155
|
-
]
|
|
156
|
-
}
|
|
157
|
-
}`}),M&&a.jsx("div",{className:"whitespace-pre-wrap break-words text-[10px] text-[color:var(--warning)]",children:M}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>{ut()},className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-3 py-1 text-[11px] font-medium text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)] transition",children:[a.jsx(hw,{size:11}),e("settings.agentPluginCreate")]}),a.jsx("button",{type:"button",onClick:()=>{x(!1),I(""),Q(null)},className:"rounded-full px-3 py-1 text-[11px] text-muted-foreground hover:text-foreground transition",children:e("common.cancel")})]})]})]})]})}function FP({state:e,pending:t,onCheck:r,onConfirmRestart:n,desktopState:i,desktopPending:l=!1,desktopSnapshot:c,desktopActions:h,onCheckDesktop:p,onInstallDesktop:g}){const{t:x}=Mr(),b=e?.status??"idle",w=t||b==="checking"||b==="installing"||b==="restarting",A=b==="ready"&&!!e?.latestVersion,k=b==="checking"?x("settings.updateChecking"):b==="installing"?x("sidebar.updateInstalling"):b==="ready"?x("sidebar.updateReady"):b==="restarting"?x("sidebar.updateRestarting"):b==="current"?x("settings.updateCurrent"):b==="error"?e?.error||x("sidebar.updateFailed"):x("settings.updateHint"),E=i?.currentVersion||c?.appVersion,I=i?.status??"idle",M=l||I==="checking"||I==="downloading"||I==="installing",Q=I==="ready",j=i?.error||(I==="unsupported"?x("settings.desktopUpdateUnsupported"):I==="checking"?x("settings.desktopUpdateChecking"):I==="current"?x("settings.desktopUpdateCurrent"):I==="downloading"?x("settings.desktopUpdateDownloading"):I==="ready"?x("settings.desktopUpdateReady"):I==="installing"?x("settings.desktopUpdateInstalling"):I==="error"&&i?.error||x("settings.desktopUpdateHint"));return a.jsxs("section",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2","aria-labelledby":"termdock-update-title",children:[a.jsx("div",{id:"termdock-update-title",className:"px-3 pt-3 text-[12px] font-semibold text-foreground",children:x("settings.updateTitle")}),a.jsxs("div",{className:"flex items-start justify-between gap-3 px-3 py-3",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[a.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${A?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:a.jsx(rs,{size:15,className:w?"animate-spin":""})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground",children:x("settings.updateRuntimeTitle")}),a.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:k}),e&&a.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:A&&e.latestVersion?`${e.currentVersion} → ${e.latestVersion}`:`v${e.currentVersion}`})]})]}),A?a.jsx("button",{type:"button",disabled:w,onClick:n,className:"shrink-0 rounded-full bg-[var(--warning)] px-3 py-1.5 text-[11px] font-semibold text-[color:var(--bg)] transition hover:opacity-90 disabled:cursor-wait disabled:opacity-60",children:x("sidebar.updateRestart")}):a.jsx("button",{type:"button",disabled:w,onClick:r,className:"shrink-0 rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated disabled:cursor-wait disabled:opacity-60",children:x(b==="checking"?"settings.updateCheckingShort":b==="installing"?"settings.updateInstallingShort":b==="error"?"sidebar.updateRetry":b==="current"?"settings.updateCheckAgain":"settings.updateCheck")})]}),(i||h)&&a.jsxs("div",{className:"flex items-start justify-between gap-3 border-t border-border/10 px-3 py-3",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[a.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${Q?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:a.jsx(rs,{size:15,className:M?"animate-spin":""})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground",children:x("settings.desktopUpdateTitle")}),a.jsx("div",{className:`mt-0.5 text-[10px] leading-relaxed ${i?.error?"text-destructive":"text-muted-foreground"}`,role:i?.error?"alert":void 0,children:i?j:x(p?"settings.desktopStatusLoading":"settings.desktopUpdateUnsupported")}),a.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:Q&&i?.latestVersion?`${i.currentVersion} → ${i.latestVersion}`:E?`v${E}`:null})]})]}),Q?a.jsx("button",{type:"button",disabled:M||!g,onClick:g,className:"shrink-0 rounded-full bg-[var(--warning)] px-3 py-1.5 text-[11px] font-semibold text-[color:var(--bg)] transition hover:opacity-90 disabled:cursor-wait disabled:opacity-60",children:x("settings.desktopUpdateRestart")}):a.jsx("button",{type:"button",disabled:!i||M||I==="unsupported"||!p,onClick:p,className:"shrink-0 rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated disabled:cursor-wait disabled:opacity-60",children:x(I==="installing"?"settings.updateInstallingShort":I==="downloading"?"settings.desktopUpdateDownloadingShort":I==="checking"?"settings.updateCheckingShort":I==="current"||I==="error"?"settings.desktopUpdateCheckAgain":"settings.desktopUpdateCheck")})]}),h]})}function $P({quality:e}){const{locale:t}=Mr(),r=(h,p)=>t==="zh"?h:p,n=h=>h==null||!Number.isFinite(h)?"—":`${h.toFixed(1)} ms`,i=e?.diagnostics,l=h=>a.jsx("dl",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-x-3 gap-y-1.5 tabular-nums",children:h.map(([p,g])=>a.jsxs(C.Fragment,{children:[a.jsx("dt",{children:p}),a.jsx("dd",{className:"text-right text-foreground break-all",children:g})]},p))}),c=(h,p)=>a.jsxs("section",{className:"mt-3 border-t border-border/30 pt-3",children:[a.jsx("h3",{className:"mb-2 font-medium text-foreground",children:h}),p]});return a.jsxs("div",{className:"text-[11px] leading-relaxed",children:[c(r("往返统计","Round-trip statistics"),a.jsxs(a.Fragment,{children:[l([[r("平均延迟","Average latency"),n(e?.average)],["P95",n(e?.p95)],[r("服务端回包处理","Server reply handler"),n(e?.handlerMs)]]),a.jsx("p",{className:"mt-2",children:r("8 秒未响应计为超时,不等于网络丢包。回包处理仅含消息解析至构造回复,不含解密、排队和发包。","A probe times out after 8s; this is not packet loss. Handler timing covers parsing through reply creation, excluding decryption, queues and transmission.")})]})),c(r("当前发送与排队","Current buffers and queues"),i?a.jsxs(a.Fragment,{children:[l([[r("传输层发送缓冲","Transport send buffer"),`${i.bufferedBytes} B`],[r("加密通道待发送","Channel writes pending"),i.pendingWrites?r("有","Yes"):r("无","No")],[r("进行中的非终端请求","Active non-terminal requests"),i.activeRequests],[r("等待通道的请求","Requests waiting for capacity"),i.waitingRequests]]),a.jsx("p",{className:"mt-2",children:r("属于此服务共用的连接,包含文件等其他请求。","Shared by this service, including file transfers and other requests.")})]}):a.jsx("p",{children:r("尚无连接记录。","No connection record yet.")})),c(r("本次连接建立 · 历史耗时","Connection setup · recorded timings"),a.jsxs(a.Fragment,{children:[l([[r("传输通道就绪","Transport ready"),n(i?.transportOpenMs)],...i?.relay?[[r("其中:连上入口 WebSocket","Within transport: entry WebSocket"),n(i.relay.entryOpenMs)],[r("其中:请求中转至通道打开","Within transport: relay open request"),n(i.relay.routeOpenMs)]]:[],[r("Noise 加密握手","Noise handshake"),n(i?.handshakeMs)],[r("终端逻辑通道就绪","Terminal logical channel ready"),n(i?.socketOpenMs)],[r("其中:等待本地通道名额","Within logical open: local capacity wait"),n(i?.socketQueueMs)]]),a.jsx("p",{className:"mt-2",children:r("这是建链时的历史耗时,不代表当前延迟。“其中”为子项,不能重复相加;中转耗时含处理和建链,不含之前的授权。","Recorded setup timings, not live latency. “Within” rows are subsets, not additive. Relay timing includes processing and setup, excluding earlier authorization.")})]}))]})}function UP({backendSessionId:e}){const{locale:t}=Mr(),r=t==="zh",[n,i]=C.useState(null),[l,c]=C.useState(!1);C.useEffect(()=>{if(i(null),!l||!e)return;const b=()=>i(O8(e));b();const w=setInterval(b,1e3);return document.addEventListener("visibilitychange",b),()=>{clearInterval(w),document.removeEventListener("visibilitychange",b)}},[e,l]);const h=n?.diagnostics,p=n?.rtt,g=n?.connected?n.waiting?r?"等待响应…":"Waiting for reply…":p==null?r?"测量中…":"Measuring…":`${p} ms · ${p<150?r?"流畅":"Low latency":p<300?r?"有延迟":"Moderate latency":r?"高延迟":"High latency"}`:r?"未连接":"Disconnected",x=b=>b==null?"—":`${Math.round(b)} ms`;return a.jsxs("div",{className:"mt-3 rounded-xl bg-surface-2 px-3 text-muted-foreground",children:[a.jsxs("button",{type:"button","aria-expanded":l,onClick:()=>c(b=>!b),className:"flex min-h-11 w-full items-center gap-2 py-2 text-[12px] tabular-nums hover:text-foreground","aria-label":`${r?"连接质量":"Connection quality"}${l?`: ${g}`:""}`,children:[a.jsx("span",{"aria-hidden":"true",className:`h-1.5 w-1.5 rounded-full ${l&&n&&(!n.connected||n.waiting||p!=null&&p>=300)?"bg-destructive":"bg-current"}`}),a.jsxs("span",{className:"flex-1 text-left",children:[r?"连接质量":"Connection quality",l?` · ${g}`:""]}),a.jsx("span",{"aria-hidden":"true",children:l?"▾":"▸"})]}),l&&a.jsxs("div",{className:"pb-3 text-[11px] leading-relaxed",children:[!e&&a.jsx("p",{children:r?"请先打开一个终端会话,再查看连接质量。":"Open a terminal session to measure connection quality."}),a.jsxs("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-2 tabular-nums",children:[a.jsx("dt",{children:r?"近期延迟":"Recent latency"}),a.jsx("dd",{className:"text-right text-foreground",children:n?.minimum==null?"—":`${Math.round(n.minimum)}–${Math.round(n.maximum??n.minimum)} ms`}),a.jsx("dt",{children:r?"波动":"Jitter"}),a.jsx("dd",{className:"text-right text-foreground",children:x(n?.jitter)}),a.jsx("dt",{children:r?"探测超时":"Probe timeouts"}),a.jsx("dd",{className:"text-right text-foreground",children:n?.samples?`${n.timeouts} / ${n.samples}`:"—"}),a.jsx("dt",{children:r?"连接路径":"Connection route"}),a.jsx("dd",{className:"text-right text-foreground break-words",children:h?`${h.path==="relay"?r?"经入口中转":"Via relay":r?"直连":"Direct"} · ${h.endpoint}`:"—"})]}),a.jsx("p",{className:"mt-2",children:r?"每 5 秒更新,统计最近 20 次;波动越小越稳定。":"Updates every 5s, using the last 20 probes. Lower jitter means more consistent latency."}),a.jsxs("details",{className:"mt-3 border-t border-border/30 pt-2",children:[a.jsx("summary",{className:"cursor-pointer py-1 hover:text-foreground",children:r?"诊断详情":"Diagnostics"}),a.jsx($P,{quality:n})]})]})]})}const Rx={"startup-failure":"settings.serverHealthEventStartupFailure",crash:"settings.serverHealthEventCrash","crash-native":"settings.serverHealthEventCrashNative",killed:"settings.serverHealthEventKilled",wedge:"settings.serverHealthEventWedge","port-conflict":"settings.serverHealthEventPortConflict","gave-up":"settings.serverHealthEventGaveUp","exit-zero-unexpected":"settings.serverHealthEventExitZero","terminated-externally":"settings.serverHealthEventTerminated","supervisor-lost":"settings.serverHealthEventSupervisorLost","uncaught-exception":"settings.serverHealthEventUncaughtException","unhandled-rejection":"settings.serverHealthEventUnhandledRejection","exit-nonzero":"settings.serverHealthEventExitNonzero"};function zP(e){return e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:e<36e5?`${Math.round(e/6e4)}m`:`${Math.round(e/36e5)}h`}function HP({state:e,onDismiss:t}){const{t:r}=Mr(),[n,i]=y.useState(!1),[l,c]=y.useState(!1),h=y.useRef(!1),p=y.useRef(!0);y.useEffect(()=>(p.current=!0,()=>{p.current=!1}),[]),y.useEffect(()=>{e?.supervised&&(h.current=!1,i(!1),c(!1))},[e?.supervised]),y.useEffect(()=>{if(!n)return;const j=window.setTimeout(()=>{h.current=!1,i(!1),c(!0)},45e3);return()=>window.clearTimeout(j)},[n]);const g=async()=>{if(!h.current){h.current=!0,c(!1),i(!0);try{await F8()}catch{if(!p.current)return;h.current=!1,i(!1),c(!0)}}};if(!e)return null;const x=e.incident,b=!e.supervised&&e.supervisor?.phase==="gave-up",w=!e.supervised&&e.supervisor!==null&&!e.supervisor.alive,A=b||w||e.attention,k=e.supervised&&e.supervisor?.alive&&e.supervisor.phase==="running",E=b?r("settings.serverHealthGaveUp",{count:e.supervisor?.consecutiveCrashes??0}):w?r("settings.serverHealthSupervisorLost"):e.supervised?r("settings.serverHealthSupervised"):r("settings.serverHealthUnsupervised"),I=x?r(Rx[x.event]??"settings.serverHealthUnknownEvent"):"",M=x?.causeEvent?r(Rx[x.causeEvent]??"settings.serverHealthUnknownEvent"):"",Q=x?[new Date(x.at).toLocaleString(),x.uptimeMs!==null?r("settings.serverHealthUptime",{duration:zP(x.uptimeMs)}):null,x.signal?`signal ${x.signal}`:null,x.exitCode!==null?`exit ${x.exitCode}`:null].filter(Boolean).join(" · "):"";return a.jsxs("section",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2","aria-labelledby":"server-health-title",children:[a.jsx("div",{id:"server-health-title",className:"px-3 pt-3 text-[12px] font-semibold text-foreground",children:r("settings.serverHealthTitle")}),a.jsxs("div",{className:"flex items-start justify-between gap-3 px-3 py-3",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[a.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${A?"bg-destructive/15 text-destructive":"bg-primary/15 text-primary"}`,children:A?a.jsx(SA,{size:15}):a.jsx(LA,{size:15})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground",children:E}),a.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:x?`${r(k?"settings.serverHealthHistory":"settings.serverHealthLastIncident")}: ${I}${M?` · ${M}`:""}`:r("settings.serverHealthClean")}),x&&k&&a.jsx("div",{className:"mt-1 text-[11px] text-primary",children:r("settings.serverHealthRunningNow")}),x&&a.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:Q}),x?.detail&&a.jsx("div",{className:"mt-1 break-words text-[10px] text-muted-foreground/75",children:x.detail}),x?.oomSuspect&&a.jsx("div",{className:"mt-1 text-[10px] text-[color:var(--warning)]",children:r("settings.serverHealthOomNote")}),e.supervisor&&e.supervisor.restarts>0&&!b&&a.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:r("settings.serverHealthRestarted",{count:e.supervisor.restarts})})]})]}),e.attention&&a.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated",children:r("settings.serverHealthDismiss")})]}),!e.supervised&&a.jsxs("div",{className:"border-t border-border px-3 py-3",children:[a.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:e.canEnableSupervision?r("settings.serverHealthEnableHint"):r("settings.serverHealthEnableUnavailable")}),e.canEnableSupervision&&a.jsx("button",{type:"button",onClick:g,disabled:n,className:"mt-2 min-h-11 rounded-lg bg-primary px-3 text-[12px] font-medium text-primary-foreground disabled:opacity-60",children:r(n?"settings.serverHealthEnabling":"settings.serverHealthEnable")}),n&&a.jsx("p",{role:"status",className:"mt-2 text-[11px] text-muted-foreground",children:r("settings.serverHealthEnablePending")}),l&&a.jsx("p",{role:"alert",className:"mt-2 text-[11px] text-destructive",children:r("settings.serverHealthEnableError")})]})]})}const WP=()=>()=>{},GP=()=>1/0;function VP(){const{t:e}=Mr(),t=y.useId(),r=Vo(),n=y.useSyncExternalStore(r?.subscribe??WP,r?.retentionLimit??GP);if(!r)return null;const i=$8+1,l=n===1/0?e("settings.workspaceUnlimited"):String(n);return a.jsxs("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("label",{htmlFor:t,className:"shrink-0 text-[12px] font-medium text-foreground/90",children:e("settings.workspaceLimit")}),a.jsx("input",{id:t,type:"range",min:3,max:i,step:1,value:n===1/0?i:n,"aria-valuetext":l,"aria-describedby":`${t}-hint`,onChange:c=>{const h=Number(c.target.value);r.setRetentionLimit(h===i?1/0:h)},className:"h-8 min-w-0 flex-1"}),a.jsx("output",{htmlFor:t,className:"min-w-12 shrink-0 text-right text-[11px] tabular-nums text-muted-foreground",children:l})]}),a.jsx("p",{id:`${t}-hint`,className:"text-[11px] leading-relaxed text-muted-foreground",children:e("settings.workspaceLimitHint")})]})}const T1="mobile-session-destroy";function qP(e,t){return t&&e.type==="session"&&e.destination?.droppableId===T1}const aa="termdock-program-rules-cache",Pd="termdock-toolbar-presets-cache",eu="termdock-settings-cache",Mx="termdock-color-theme",Dx="termdock:right-sidebar:file-preview-open-by-session:v2",tu="termdock:running-session-button-enabled:v1",ru="termdock:attention-button-enabled:v1",YP=60,Bx=320,Qx=420,Co=8;function jx(e,t,r){return Math.min(Math.max(e,t),r)}function Px(e){if(typeof window>"u")return{left:Co,top:Co};const t=window.innerWidth/2,r=Math.min(64,window.innerHeight/4),n=e?.x??t,i=e?.y??r,l=Math.max(Co,window.innerWidth-Bx-Co),c=Math.max(Co,window.innerHeight-Qx-Co);return{left:jx(n+Co,Co,l),top:jx(i+Co,Co,c),width:Bx,maxHeight:`min(${Qx}px, calc(100vh - ${Co*2}px))`}}function ZP(e){return e==="dark"||e==="light"}function KP(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.entries(e).every(([t,r])=>{if(!t||!r||typeof r!="object"||Array.isArray(r))return!1;const n=r;return typeof n.updatedAt=="number"&&Number.isFinite(n.updatedAt)})}function kp(e){const t=Object.entries(e).filter(([r,n])=>r&&Number.isFinite(n.updatedAt)).sort(([,r],[,n])=>n.updatedAt-r.updatedAt).slice(0,YP);return Object.fromEntries(t)}function XP(e){return Array.isArray(e)&&e.every(t=>{if(!t||typeof t!="object")return!1;const r=t;return typeof r.id=="string"&&typeof r.pattern=="string"&&typeof r.output=="string"&&(r.matchType==="exact"||r.matchType==="includes"||r.matchType==="prefix"||r.matchType==="regex")})}function JP(e){return typeof e=="object"&&e!==null&&typeof e.version=="number"&&Array.isArray(e.presets)}function eO(e,t){const r=Cu(),n=new Set(ck()),i=Array.isArray(e)?e:[],l=Uc(i),c=t<ou;if(l.length===0)return r;if(c){const p=new Map(l.map(w=>[w.id,w])),g=new Map(i.map(w=>[typeof w.id=="string"?w.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):"",w])),x=l.filter(w=>!n.has(w.id));return[...r.map(w=>{const A=p.get(w.id),k=g.get(w.id);return A?{...w,rowLayout:A.rowLayout,showOnDesktop:typeof k?.showOnDesktop=="boolean"?k.showOnDesktop:w.showOnDesktop}:w}),...x]}const h=new Set(l.map(p=>p.id));return[...l,...r.filter(p=>!h.has(p.id))]}function tO(e){return typeof e=="object"&&e!==null&&typeof e.preventSleep=="boolean"&&typeof e.networkAvailable=="boolean"}const rO={name:"",source:"auto",hostname:"",fallbackHostname:"",url:"",fallbackUrl:"",onboardingUrl:null,status:"disabled",reason:null,httpsEnabled:!1,caAvailable:!1,lanAddresses:[],interfaces:[]},Vh="__termdockOverlay",qh="__termdockBaseAnchor",Yh="__termdockBaseGuard",nO=3,Ox=250,sO="termdock-notification-target-v1",Fx="/__termdock-notification-target",$x=3e4;function iO(e){return e==="left-sidebar"||e==="right-sidebar"||e==="right-sidebar-repo-picker"||e==="right-sidebar-file-preview"||e==="settings"||e==="markdown-outline"||e==="markdown-image-lightbox"}function Qc(e){if(!e||typeof e!="object")return null;const t=e[Vh];return iO(t)?t:null}function fm(e){return e&&typeof e=="object"?{...e}:{}}function uy(e){const t=fm(e);return delete t[Vh],t}function aO(e){const t=uy(e);return delete t[Yh],{...t,[qh]:!0}}function oO(){typeof window>"u"||window.history.pushState({...uy(window.history.state),[qh]:!0,[Yh]:!0},"",window.location.href)}function dy(){for(let e=0;e<nO;e+=1)oO()}function Od(){typeof window>"u"||(window.history.replaceState(aO(window.history.state),"",window.location.href),dy())}function nu(e){typeof window>"u"||window.history.pushState({...fm(window.history.state),[qh]:!0,[Vh]:e,[Yh]:!1},"",window.location.href)}function lO(e){typeof window>"u"||window.history.replaceState({...fm(window.history.state),[qh]:!0,[Vh]:e,[Yh]:!1},"",window.location.href)}const hy=["bash","zsh","fish","sh","dash","ksh","tcsh","csh","nu"];let oa=new Set(hy);function Ux(e){const t=new Map;for(const[r,n]of e)t.set(r,{cwd:n.cwd,activeProgram:n.activeProgram,activeProgramRaw:n.activeProgramRaw,inCopyMode:n.inCopyMode,isConnecting:n.isConnecting,agentStatus:n.agentStatus,agentIndicator:n.agentIndicator,agentStatusDetail:n.agentStatusDetail,agent:n.agent,agentMessage:n.agentMessage,agentNativeSessionId:n.agentNativeSessionId,agentResumeRecovered:n.agentResumeRecovered,terminalSessionId:n.terminalSessionId,agentNeedsReview:n.agentNeedsReview,gitStatus:n.gitStatus,shellTitle:n.shellTitle,promptState:n.promptState,tuiProgress:n.tuiProgress});return t}function cO(e,t){if(e.size!==t.size)return!1;for(const[r,n]of t){const i=e.get(r);if(!i||i.cwd!==n.cwd||i.activeProgram!==n.activeProgram||i.activeProgramRaw!==n.activeProgramRaw||i.inCopyMode!==n.inCopyMode||i.isConnecting!==n.isConnecting||i.agentStatus!==n.agentStatus||i.agentIndicator!==n.agentIndicator||i.agentStatusDetail!==n.agentStatusDetail||i.agent!==n.agent||i.agentMessage!==n.agentMessage||i.agentNativeSessionId!==n.agentNativeSessionId||i.agentResumeRecovered!==n.agentResumeRecovered||i.terminalSessionId!==n.terminalSessionId||i.agentNeedsReview!==n.agentNeedsReview||i.gitStatus!==n.gitStatus||i.shellTitle!==n.shellTitle||i.promptState!==n.promptState||i.tuiProgress?.state!==n.tuiProgress?.state||i.tuiProgress?.progress!==n.tuiProgress?.progress)return!1}return!0}function zx(e,t){return a.jsx(NQ,{sessionMode:e,state:t})}function uO(e,t){const r=new Map(e.map(c=>[c.id,c])),n=t.map(c=>r.get(c)).filter(c=>c!==void 0),i=new Set(t),l=e.filter(c=>!i.has(c.id));return[...n,...l]}function dO(){const{t:e,locale:t,setLocale:r}=Mr(),n="env(safe-area-inset-top, 0px)",i="env(safe-area-inset-bottom, 0px)";U8();const l=C.useMemo(()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,[]),[c,h]=C.useState(!1),[p,g]=C.useState(()=>ql(Mx,ZP)??"dark"),x=C.useRef(ql(eu,tO)).current,[b,w]=C.useState(x?.preventSleep??!1),[A,k]=C.useState(x?.networkAvailable??!0),[E,I]=C.useState(z8),[M,Q]=C.useState(H8),[j,F]=C.useState(W8),[V,$]=C.useState(G8),[te,se]=C.useState(gf),[qe,de]=C.useState(x?.localAccess??rO),[oe,Oe]=C.useState(x?.localAccess?.name??""),[et,ce]=C.useState(!1),[Be,ot]=C.useState(null),[Ie,re]=C.useState(null),[Ue,_e]=C.useState(null),[K,Le]=C.useState(!1),[fe,$e]=C.useState(null),ze=C.useMemo(()=>So(),[]),Ee=!!(ze?.desktopUpdateState&&ze.checkDesktopUpdate&&ze.installDesktopUpdate),[ee,Ke]=C.useState(null),[wt,tt]=C.useState(null),[ge,it]=C.useState(!1),[ht,Y]=C.useState(null),[be,ut]=C.useState(!1),[le,pe]=C.useState(()=>kp(ql(Dx,KP)??{})),[je,xt]=C.useState(0),[dt,Dt]=C.useState(!1),[Xt,Ht]=C.useState(0),[Bt,Wt]=C.useState(!1),[lr,ur]=C.useState(0),[Jt,Er]=C.useState(!1),[X,Re]=C.useState(0),We=C.useRef(null),[Qt,It]=C.useState({}),{terminalSettings:ar,updateTerminalSettings:Ot}=FD(),Fe=ar.fontSize,yr=ar.rendererMode,[He,Se]=C.useState(!1),Ve=C.useRef(V8()).current,[Ct,jr]=y.useState(()=>Ve.sessions.map(S=>({id:S.sessionId,name:S.name,customName:S.customName,mode:S.mode,tmuxSessionName:S.tmuxSessionName}))),[ft,Br]=C.useState(Ve.activeSessionId),[Wn,an]=C.useState(!1);C.useEffect(()=>{Wn&&q8({rendered:!0})},[Wn]);const[ke,St]=C.useState(null),[kt,ue]=C.useState(null),[Nr,st]=C.useState([]),[Gt,Ur]=y.useState(()=>{const S=Hr.getState();return Ve.sessions.forEach(D=>{D.backendSessionId&&S.setTerminalSession(D.sessionId,{sessionId:D.backendSessionId,cols:80,rows:24,mode:D.mode,tmuxSessionName:D.tmuxSessionName}),D.activeProgram!=null&&S.setSessionActiveProgram(D.sessionId,D.activeProgram),D.cwd!=null&&S.setSessionCwd(D.sessionId,D.cwd),D.shellTitle!=null&&S.setSessionShellTitle(D.sessionId,D.shellTitle)}),zc("session-chrome-hydrated"),Ux(Hr.getState().sessions)});y.useEffect(()=>{!ze||!He||Promise.all([ze.snapshot(),ze.desktopUpdateState?.()??Promise.resolve(null)]).then(([S,D])=>{Ke(S),tt(D)}).catch(S=>Y(S instanceof Error?S.message:String(S)))},[ze,He]),y.useEffect(()=>{ze?.onDesktopUpdateState&&ze.onDesktopUpdateState(tt)},[ze]),y.useEffect(()=>Hr.subscribe(S=>{const D=Ux(S.sessions);Ur(ae=>cO(ae,D)?ae:D)}),[]);const gn=y.useCallback(async(S,D)=>{ue(null),St({sessionId:S,status:"submitting",error:null});try{await Y8(D),St(ae=>ae?.sessionId===S?{...ae,status:"waiting",error:null}:ae)}catch(ae){const bt=(ae&&typeof ae=="object"&&"code"in ae?String(ae.code??""):"")==="AGENT_SESSION_ACTIVE_ELSEWHERE"?e("tab.resumeAgentConflict"):ae instanceof Error&&/busy/i.test(ae.message)?e("tab.resumeAgentBusy"):e("tab.resumeAgentFailed");St(Yt=>Yt?.sessionId===S?{...Yt,error:bt}:Yt),ue({tone:"error",message:bt})}},[e]);y.useEffect(()=>{if(!ke||ke.status!=="waiting")return;const S=Gt.get(ke.sessionId);if(!S||S.agentResumeRecovered||S.agentStatus===null&&!S.agent)return;const D=S.agent?.displayName??"Agent";St(null),ue({tone:"success",message:e("tab.resumeAgentSuccess",{agent:D})})},[ke,Gt,e]),y.useEffect(()=>{if(!ke||ke.status!=="waiting"||ke.error)return;const S=ke.sessionId,D=window.setTimeout(()=>{const ae=e("tab.resumeAgentTimeout");St(Ze=>Ze?.sessionId===S&&Ze.status==="waiting"?{...Ze,error:ae}:Ze),ue({tone:"error",message:ae})},15e3);return()=>window.clearTimeout(D)},[ke,e]),y.useEffect(()=>{if(kt?.tone!=="success")return;const S=window.setTimeout(()=>ue(null),3200);return()=>window.clearTimeout(S)},[kt]),y.useEffect(()=>{let S=!1;Z8().then(ae=>{S||_e(ae)}).catch(()=>{}),K8().then(ae=>{S||$e(ae)}).catch(()=>{});const D=Gm(ae=>{S||(ae.type==="update-state"?_e(ae.state):ae.type==="server-health"&&$e(ae.state))});return()=>{S=!0,D()}},[]);const Ln=y.useCallback(async()=>{try{$e(await X8())}catch(S){window.alert(S instanceof Error?S.message:String(S))}},[]),wn=y.useCallback(async()=>{const S=Ue?.latestVersion;if(!(!S||K)&&window.confirm(e("sidebar.updateRestartConfirm",{version:S}))){Le(!0);try{_e(await J8())}catch(D){window.alert(D instanceof Error?D.message:String(D))}finally{Le(!1)}}},[Ue?.latestVersion,e,K]),sr=y.useCallback(async()=>{if(!K){Le(!0);try{_e(await e9())}catch(S){window.alert(S instanceof Error?S.message:String(S))}finally{Le(!1)}}},[K]),yn=y.useCallback(async()=>{if(!(!ze?.checkDesktopUpdate||ge)){it(!0);try{tt(await ze.checkDesktopUpdate())}catch(S){Y(S instanceof Error?S.message:String(S))}finally{it(!1)}}},[ze,ge]),Ts=y.useCallback(async()=>{if(!(!ze?.installDesktopUpdate||ge||wt?.status!=="ready")&&window.confirm(e("settings.desktopUpdateRestartConfirm"))){it(!0);try{tt(await ze.installDesktopUpdate())}catch(S){Y(S instanceof Error?S.message:String(S))}finally{it(!1)}}},[ze,ge,wt?.status,e]);y.useEffect(()=>{document.documentElement.dataset.theme=p,t9(p),Bn(Mx,p)},[p]),y.useEffect(()=>{Bn(Dx,kp(le))},[le]);const Xr=Zt(S=>S.leftOpen),Wr=Zt(S=>S.rightOpen),on=Zt(S=>S.leftPinned),An=Zt(S=>S.leftSidebarWidth),jn=Zt(S=>S.rightPinned),Gn=Zt(S=>S.rightSidebarWidth),Pn=Zt(S=>S.rootPath),hn=Zt(S=>S.contextKey),kn=Zt(S=>S.selectedFilePath),Tn=Zt(S=>S.groupByFolder),rn=uu(S=>S.collaborationGroups),Dr=Zt(S=>S.collapsedGroups),ns=Zt(S=>S.toggleGroupCollapsed),[Mt,q]=y.useState(()=>typeof window>"u"?!0:window.matchMedia("(min-width: 1024px)").matches),[Ye,Lt]=y.useState(()=>typeof window>"u"?1024:window.innerWidth),[wr,Et]=y.useState(()=>typeof window>"u"?!1:window.matchMedia("(orientation: landscape)").matches),[hr,Sr]=y.useState([]),[Ir,ln]=y.useState({available:!0,version:null,reason:null}),[zr,Vn]=y.useState(!1),[Gr,qn]=y.useState(null),[In,cn]=y.useState(null),[H,we]=y.useState(null),[Pe,Ge]=y.useState(null),[ve,lt]=y.useState(null),[Nt,At]=y.useState(null),[ct,_t]=y.useState(null),[,_r]=y.useState(0),[jt,tr]=y.useState(null),[vt,Tt]=y.useState(null),[fr,at]=y.useState(null),[Rr,Vr]=y.useState(!1),[Nn,nn]=y.useState(()=>ql(tu,S=>typeof S=="boolean")??!1),fs=y.useCallback(async S=>{const D=Nn;nn(S),Bn(tu,S);try{const ae=await ca({runningSessionButtonEnabled:S});nn(ae.runningSessionButtonEnabled),Bn(tu,ae.runningSessionButtonEnabled)}catch{nn(D),Bn(tu,D)}},[Nn]),[On,ls]=y.useState(()=>ql(ru,S=>typeof S=="boolean")??!0),Bs=y.useCallback(async S=>{const D=On;ls(S),Bn(ru,S);try{const ae=await ca({attentionButtonEnabled:S});ls(ae.attentionButtonEnabled),Bn(ru,ae.attentionButtonEnabled)}catch{ls(D),Bn(ru,D)}},[On]),[ii,Os]=y.useState(null),Pr=y.useCallback(S=>{Os(S)},[]),Jr=y.useRef(!1),[$n,U]=y.useState(null),[ne,me]=y.useState(null),Me=C.useRef(null),Ut=C.useRef(!1),Pt=C.useRef(null),rr=C.useRef(!1),er=y.useCallback(()=>{At(null),_t(null)},[]),Or=C.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("session")),[fn,P]=C.useState(Or.current),[xe,Ae]=C.useState(!0),rt=C.useRef(Or.current),pt=C.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("_notifTrace"));y.useEffect(()=>{if(typeof window>"u")return;const S=window.matchMedia("(min-width: 1024px)"),D=()=>{q(S.matches),Lt(window.innerWidth)};return D(),S.addEventListener("change",D),window.addEventListener("resize",D),()=>{S.removeEventListener("change",D),window.removeEventListener("resize",D)}},[]),y.useEffect(()=>{if(typeof window>"u")return;const S=window.matchMedia("(orientation: landscape)"),D=()=>Et(S.matches);return D(),S.addEventListener("change",D),()=>S.removeEventListener("change",D)},[]);const dr=C.useMemo(()=>ft?Nr.find(S=>S.sessionIds.includes(ft))??null:null,[ft,Nr]),qt=dr?.id??null,Rt=dr?.sessionIds[0]??ft,Fr=C.useRef([]);C.useLayoutEffect(()=>{const S=Fr.current;if(Fr.current=Nr,S.length===0)return;const D=new Set(Nr.flatMap(ae=>ae.sessionIds));for(const ae of S){const Ze=ae.sessionIds.filter(bt=>!D.has(bt)).map(bt=>({sessionId:bt,rootPath:Hr.getState().sessions.get(bt)?.cwd??null}));Ze.length>0&&Zt.getState().inheritRightSidebarStateFromSplitWorkspace(ae.id,Ze)}},[Nr]),C.useLayoutEffect(()=>((()=>{const D=Rt?Hr.getState().sessions.get(Rt)?.cwd??null:null;Zt.getState().setRootPath(D,Rt,qt)})(),Hr.subscribe((D,ae)=>{const Ze=Rt?D.sessions.get(Rt)?.cwd??null:null,bt=Rt?ae.sessions.get(Rt)?.cwd??null:null;Ze!==bt&&Zt.getState().setRootPath(Ze,Rt,qt)})),[qt,Rt]);const Rn=Mt||wr,xs=Ye*.95,Mi=Rn?Math.min(Math.max(Ye*.22,280),340):Math.min(Ye*.86,380),ss=ft&&Pn?`${ft}\0${Pn}`:"",ai=!!(ss&&kn&&le[ss]),oi=y.useCallback(S=>{ss&&(S&&!Zt.getState().selectedFilePath||pe(D=>{if(!!D[ss]===S)return D;if(S)return kp({...D,[ss]:{updatedAt:Date.now()}});const Ze={...D};return delete Ze[ss],Ze}))},[ss]);y.useEffect(()=>{GD(ss,hn,kn)&&pe(S=>{if(!S[ss])return S;const D={...S};return delete D[ss],D})},[ss,hn,kn]);const pn=Jt?"markdown-image-lightbox":Bt?"markdown-outline":dt?"right-sidebar-repo-picker":Wr&&ai?"right-sidebar-file-preview":He?"settings":Wr&&!(jn&&Mt)?"right-sidebar":Xr&&!(on&&Mt)?"left-sidebar":null,cs=C.useRef(pn),ks=C.useRef(pn),Ba=C.useRef(!1),Ci=C.useRef(!1),lo=y.useCallback(()=>{if(typeof window>"u")return;const S=window.matchMedia("(hover: hover) and (pointer: fine)").matches;!Mt||!S||navigator.maxTouchPoints>0||window.setTimeout(()=>{window.dispatchEvent(new CustomEvent("focus-active-terminal-session"))},0)},[Mt]),ha=y.useCallback(S=>{if(S==="markdown-image-lightbox"){Er(!1),Re(D=>D+1);return}if(S==="markdown-outline"){Wt(!1),ur(D=>D+1);return}if(S==="right-sidebar-file-preview"){Wt(!1),ur(D=>D+1),oi(!1),xt(D=>D+1);return}if(S==="right-sidebar-repo-picker"){Dt(!1),Ht(D=>D+1);return}if(S==="settings"){Se(!1),Ki(!1),Xi(!1),Ca(!1);return}if(S==="left-sidebar"){Zt.getState().closeLeft();return}Wt(!1),ur(D=>D+1),Dt(!1),Ht(D=>D+1),Er(!1),Re(D=>D+1),Zt.getState().closeRight()},[oi]),un=y.useCallback(S=>{if(!l&&typeof window<"u"&&cs.current===S&&Qc(window.history.state)===S){window.history.back();return}ha(S)},[ha,l]),fa=y.useCallback(()=>{Se(!1);const S=Zt.getState();S.closeRight(),S.openLeft()},[]),Is=y.useCallback(()=>{Se(!1);const S=Zt.getState();S.closeLeft(),S.openRight()},[]),Zo=y.useCallback(()=>{Se(!1);const S=Zt.getState();S.closeLeft(),S.openRight(),S.setRightTab("files"),S.openRightSearch()},[]),Si=y.useCallback(()=>{const S=Zt.getState();if(S.leftPinned){S.setLeftPinned(!1),S.closeLeft();return}if(Xr){un("left-sidebar");return}fa()},[fa,un,Xr]),co=y.useCallback(()=>{const S=Zt.getState();S.leftPinned?(S.setLeftPinned(!1),S.openLeft()):(S.setLeftPinned(!0),S.openLeft())},[]),Qa=y.useCallback(()=>{const S=Zt.getState();S.setLeftPinned(!1),S.closeLeft()},[]),pa=y.useCallback(()=>{const S=Zt.getState();S.rightPinned?(S.setRightPinned(!1),S.openRight()):(S.setRightPinned(!0),S.openRight())},[]),Yi=y.useCallback(()=>{const S=Zt.getState();S.setRightPinned(!1),S.closeRight()},[]),ja=y.useRef(0),li=y.useRef(0),us=y.useRef(null),Cn=y.useCallback(S=>{S.preventDefault(),ja.current=S.clientX,li.current=Zt.getState().leftSidebarWidth;const D=Ze=>{us.current===null&&(us.current=requestAnimationFrame(()=>{us.current=null;const bt=Ze.clientX-ja.current;Zt.getState().setLeftSidebarWidth(li.current+bt)}))},ae=()=>{window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",ae),us.current!==null&&(cancelAnimationFrame(us.current),us.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",D),window.addEventListener("mouseup",ae)},[]),ma=y.useRef(0),Xn=y.useRef(0),ci=y.useRef(null),_i=y.useCallback(S=>{S.preventDefault(),ma.current=S.clientX;const D=Zt.getState(),ae=D.leftPinned?D.leftSidebarWidth:0;Xn.current=Ud(D.rightSidebarWidth,window.innerWidth,ae);const Ze=Yt=>{ci.current===null&&(ci.current=requestAnimationFrame(()=>{ci.current=null;const Ar=ma.current-Yt.clientX,sn=Zt.getState(),tn=sn.leftPinned?sn.leftSidebarWidth:0;sn.setRightSidebarWidth(Ud(Xn.current+Ar,window.innerWidth,tn))}))},bt=()=>{window.removeEventListener("mousemove",Ze),window.removeEventListener("mouseup",bt),ci.current!==null&&(cancelAnimationFrame(ci.current),ci.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",Ze),window.addEventListener("mouseup",bt)},[]),Zi=y.useCallback(()=>{const S=Zt.getState();if(S.rightPinned){S.setRightPinned(!1),S.closeRight();return}if(Wr){un("right-sidebar");return}Is()},[Is,un,Wr]),Pa=y.useCallback(()=>{!ai&&!l&&typeof window<"u"&&cs.current==="right-sidebar"&&Qc(window.history.state)==="right-sidebar"&&(nu("right-sidebar-file-preview"),ks.current="right-sidebar-file-preview"),oi(!0)},[ai,l,oi]),Oa=y.useCallback(()=>{un("right-sidebar-file-preview")},[un]),uo=y.useCallback(()=>{!dt&&!l&&typeof window<"u"&&cs.current==="right-sidebar"&&Qc(window.history.state)==="right-sidebar"&&(nu("right-sidebar-repo-picker"),ks.current="right-sidebar-repo-picker"),Dt(!0)},[dt,l]),ml=y.useCallback(()=>{un("right-sidebar-repo-picker")},[un]),Ko=y.useCallback(()=>{!Bt&&!l&&typeof window<"u"&&cs.current&&Qc(window.history.state)===cs.current&&(nu("markdown-outline"),ks.current="markdown-outline"),Wt(!0)},[Bt,l]),Io=y.useCallback(()=>{un("markdown-outline")},[un]),Fs=y.useCallback(()=>{!l&&typeof window<"u"&&cs.current&&Qc(window.history.state)===cs.current&&(nu("markdown-image-lightbox"),ks.current="markdown-image-lightbox"),Er(!0)},[l]),Eo=y.useCallback(()=>{un("markdown-image-lightbox")},[un]),ga=y.useCallback(()=>{!l&&typeof window<"u"&&cs.current&&Qc(window.history.state)===cs.current&&(lO("settings"),ks.current="settings"),Zt.getState().closeAll(),Se(!0)},[l]),xa=y.useCallback(()=>{un("settings")},[un]);y.useEffect(()=>{if(!ze)return;const S=()=>ga();return window.addEventListener("termdock:open-settings",S),()=>window.removeEventListener("termdock:open-settings",S)},[ze,ga]);const ba=y.useCallback(()=>{ut(!0),We.current!==null&&(window.clearTimeout(We.current),We.current=null)},[]),ps=y.useCallback(()=>{We.current!==null&&(window.clearTimeout(We.current),We.current=null),ut(!1),Ci.current=!0,Od(),Ci.current},[]);y.useEffect(()=>()=>{We.current!==null&&window.clearTimeout(We.current)},[]),y.useEffect(()=>{l||Od()},[l]),y.useEffect(()=>{if(typeof window>"u"||l)return;let S=null;const D=()=>{S!==null&&(window.clearTimeout(S),S=null)},ae=sn=>{if(cs.current,Ci.current,cs.current){cs.current;return}!sn?.force&&Ci.current||(sn?.userActivated&&(Ci.current=!0),Od(),Ci.current,void 0)},Ze=()=>{D(),S=window.setTimeout(()=>{S=null,ae({force:!0})},Ox)},bt=()=>{ae({userActivated:!0})},Yt=()=>{Ze()},Ar=()=>{document.visibilityState==="visible"&&Ze()};return window.addEventListener("pointerdown",bt,{capture:!0,passive:!0}),window.addEventListener("touchstart",bt,{capture:!0,passive:!0}),window.addEventListener("keydown",bt,{capture:!0}),window.addEventListener("pageshow",Yt),document.addEventListener("visibilitychange",Ar),()=>{D(),window.removeEventListener("pointerdown",bt,{capture:!0}),window.removeEventListener("touchstart",bt,{capture:!0}),window.removeEventListener("keydown",bt,{capture:!0}),window.removeEventListener("pageshow",Yt),document.removeEventListener("visibilitychange",Ar)}},[l]),y.useEffect(()=>{cs.current=pn},[pn]),y.useEffect(()=>{if(typeof window>"u"||pn||l)return;const S=window.setTimeout(()=>{cs.current?(cs.current,void 0):Od()},Ox);return()=>window.clearTimeout(S)},[pn,l]),y.useEffect(()=>{if(typeof window>"u"||l)return;const S=ks.current;Ba.current,pn&&pn!==S&&!Ba.current&&nu(pn),!pn&&S&&lo(),ks.current=pn,!pn&&Ba.current&&window.setTimeout(()=>{Ba.current=!1},0)},[pn,l,lo]),y.useEffect(()=>{if(typeof window>"u"||l)return;const S=()=>{const D=cs.current;if(Ci.current,!D){Ci.current=!1,Ci.current,ba(),dy();return}Ba.current=!0,ha(D)};return window.addEventListener("popstate",S),()=>window.removeEventListener("popstate",S)},[ha,ba,l]),y.useEffect(()=>{const S=D=>{const ae=D.metaKey||D.ctrlKey;if(ae&&D.key==="b"&&!D.shiftKey&&(D.preventDefault(),Si()),ae&&D.shiftKey&&D.key==="E"&&(D.preventDefault(),Zi()),ae&&D.shiftKey&&D.key==="P"&&(D.preventDefault(),Zo()),ae&&!D.shiftKey&&D.altKey&&(D.key==="ArrowLeft"||D.key==="ArrowRight")){D.preventDefault();const Ze=D.key==="ArrowRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:Ze}}));return}if(ae&&D.shiftKey&&!D.altKey&&(D.code==="BracketLeft"||D.code==="BracketRight")){D.preventDefault();const Ze=D.code==="BracketRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:Ze}}));return}};return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[Si,Zi,Zo]);const Li=y.useCallback(async()=>{ce(!0),ot(null);try{const S=await ca({localAccess:{name:oe}});de(S.localAccess),Oe(S.localAccess.name),Bn(eu,{preventSleep:S.preventSleep,networkAvailable:S.networkAvailable,localAccess:S.localAccess})}catch(S){ot(S instanceof Error?S.message:"Failed to save local access name")}finally{ce(!1)}},[oe]),ho=y.useCallback(async()=>{ce(!0),ot(null);try{const S=await ca({localAccess:{reset:!0}});de(S.localAccess),Oe(S.localAccess.name),Bn(eu,{preventSleep:S.preventSleep,networkAvailable:S.networkAvailable,localAccess:S.localAccess})}catch(S){ot(S instanceof Error?S.message:"Failed to reset local access name")}finally{ce(!1)}},[]),fo=y.useCallback(async(S,D="url")=>{if(S)try{if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(S);else{const ae=document.createElement("textarea");ae.value=S,ae.style.position="fixed",ae.style.left="-9999px",document.body.appendChild(ae),ae.focus(),ae.select(),document.execCommand("copy"),document.body.removeChild(ae)}re(D),window.setTimeout(()=>re(ae=>ae===D?null:ae),1600)}catch{re(null)}},[]),po=y.useCallback(S=>{const D=uO(Ct,S);D.map(ae=>ae.id).join("\0")!==Ct.map(ae=>ae.id).join("\0")&&(jr(D),window.dispatchEvent(new CustomEvent("reorder-terminal-session",{detail:{sessionIds:D.map(ae=>ae.id)}})))},[Ct]),$s=y.useCallback(S=>{Mt||S.type!=="session"||(Jr.current=!1,Vr(!1),at(S.draggableId))},[Mt]),Us=y.useCallback(S=>{if(Mt||S.type!=="session")return;const D=S.destination?.droppableId===T1;D!==Jr.current&&(Jr.current=D,Vr(D),D&&navigator.vibrate?.(20))},[Mt]),No=y.useCallback(S=>{const D=qP(S,!Mt);if(Jr.current=!1,Vr(!1),at(null),!D)return!1;const ae=Ct.find(bt=>bt.id===S.draggableId),Ze=ae?Gt.get(ae.id):null;return ae&&v5({mode:ae.mode,activeProgram:Ze?.activeProgram??null,promptState:Ze?.promptState??null,shellNames:oa})?(me(null),U(ae.id),we(null)):ae&&window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:{sessionId:ae.id,source:"other",closeMode:ae.mode==="tmux"?"destroy":"auto"}})),!0},[Mt,Ct,Gt]),{groups:Yn,arranged:is}=C.useMemo(()=>ah(Ct,S=>Gt.get(S.id)?.cwd??null,Tn,e("sidebar.ungrouped"),Nr,rn),[Ct,Gt,Tn,e,Nr,rn]),ui=y.useCallback(S=>{No(S)||!S.destination||S.source.index===S.destination.index||window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:is[S.source.index]?.id,targetId:is[S.destination.index]?.id}}))},[No,is]),Di=y.useCallback((S,D)=>{const ae=D.trim();ae&&window.dispatchEvent(new CustomEvent("rename-terminal-session",{detail:{sessionId:S,name:ae}}))},[]),Bi=y.useCallback(S=>{window.dispatchEvent(new CustomEvent("reset-terminal-session-name",{detail:{sessionId:S}}))},[]),{newSessionMode:zs,newSessionTmuxName:mo,userSelectedNewSessionMode:Hs,setNewSessionMode:di}=zD(),[Kr,ya]=y.useState(null),[Ws,Ki]=C.useState(!1),[va,wa]=C.useState(!1),[hi,Xi]=C.useState(!1),[Cs,Aa]=C.useState("idle"),Fa=C.useRef(ql(Pd,JP)).current,[Jn,ms]=C.useState(()=>{const S=Fa?.presets;if(S&&S.length>0){const D=Uc(S);if(D.length>0)return D}return Cu()}),[Ta,Xo]=C.useState(!1),[Qi,go]=C.useState("default"),$a=C.useRef(typeof Fa?.updatedAt=="number"?Fa.updatedAt:null),Jo=C.useRef(!1),[Ua,Ca]=C.useState(!1),[J,Qe]=C.useState(!1),mt=C.useRef(ql(aa,XP)).current,[gt,De]=C.useState(mt??[]),[yt,pr]=C.useState(mt!==null),[Qr,L]=C.useState(!1),B=!pn&&!va&&!hi&&!Ws&&!Ua&&!J&&!Nt&&!$n&&!Kr,O=C.useCallback(S=>{const D=typeof S.version=="number"?S.version:0,ae=eO(Array.isArray(S.presets)?S.presets:[],D);$a.current=typeof S.updatedAt=="number"?S.updatedAt:null,ms(Ze=>r9(Ze,ae)?Ze:(Jo.current=!0,ae)),Bn(Pd,{version:ou,presets:ae,updatedAt:$a.current??void 0})},[]);y.useEffect(()=>{const S=D=>{if(D.key!=="Escape")return;if(va){D.preventDefault(),wa(!1);return}if(hi){D.preventDefault(),Xi(!1);return}if(Ws){D.preventDefault(),Ki(!1);return}if(Ua){D.preventDefault(),Ca(!1);return}if(J){D.preventDefault(),Qe(!1);return}if(Nt){D.preventDefault(),er();return}if(jt){D.preventDefault(),lt(null),tr(null);return}if(He){D.preventDefault(),xa();return}if(Wr&&!(jn&&Mt)){D.preventDefault(),un("right-sidebar");return}Xr&&!(on&&Mt)&&(D.preventDefault(),un("left-sidebar"))};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[va,hi,Ws,Ua,Nt,er,He,Wr,jn,Xr,on,Mt,xa,un]),y.useEffect(()=>{pr(!0)},[]);const[z,Ne]=C.useState({genericProgramNames:[],wrapperScriptNames:[],shellNames:hy}),[,Te]=C.useState(!1),Xe=C.useCallback(()=>n9().then(S=>{Ne(S),oa=new Set(S.shellNames),Te(!0)}).catch(()=>{}),[]);y.useEffect(()=>{Xe()},[Xe]),y.useEffect(()=>Gm(S=>{if(S.type==="config-updated"){if(S.key==="toolbar-presets"){Vm().then(D=>O(D)).catch(D=>{console.warn("[toolbar-presets] Failed to refresh after remote update:",D)});return}S.key==="program-detection"&&Xe()}}),[O,Xe]),y.useEffect(()=>{let S=!1;return(async()=>{try{const D=await Vm();if(S)return;O(D)}catch(D){console.warn("[toolbar-presets] Failed to load from server:",D)}finally{S||Xo(!0)}})(),()=>{S=!0}},[O]),y.useEffect(()=>{if(Ta){if(Jo.current){Jo.current=!1;return}Bn(Pd,{version:ou,presets:Jn,updatedAt:$a.current??void 0}),s9({version:ou,presets:Jn,baseUpdatedAt:$a.current??void 0}).then(S=>{$a.current=typeof S.updatedAt=="number"?S.updatedAt:null,Bn(Pd,{version:ou,presets:Jn,updatedAt:$a.current??void 0})}).catch(S=>{const D=S instanceof Error&&"current"in S?S.current:null;D&&typeof D=="object"&&O(D),console.warn("[toolbar-presets] Failed to save to server:",S)})}},[O,Jn,Ta]),y.useEffect(()=>{$l().then(S=>{w(D=>D===S.preventSleep?D:S.preventSleep),k(D=>D===S.networkAvailable?D:S.networkAvailable),de(S.localAccess),Oe(S.localAccess.name),nn(S.runningSessionButtonEnabled),Bn(tu,S.runningSessionButtonEnabled),ls(S.attentionButtonEnabled),Bn(ru,S.attentionButtonEnabled),Bn(eu,{preventSleep:S.preventSleep,networkAvailable:S.networkAvailable,localAccess:S.localAccess})}).catch(()=>{})},[]),y.useEffect(()=>{if(!E)return;const S=gf();se(S),S!=="granted"&&(I(!1),ad(!1))},[E]),y.useEffect(()=>{if(!E)return;T0();const S=()=>{document.visibilityState==="visible"&&(T0(),b9())},D=window.setInterval(()=>{T0()},360*60*1e3);return document.addEventListener("visibilitychange",S),window.addEventListener("focus",S),()=>{window.clearInterval(D),document.removeEventListener("visibilitychange",S),window.removeEventListener("focus",S)}},[E]);const nt=y.useCallback(async()=>{if(E){I(!1),ad(!1),i9(),se(gf());return}const S=await a9();if(se(S),S!=="granted"){I(!1),ad(!1);return}I(!0),ad(!0),await T0(!0,!0),Aa("idle")},[E]),$t=y.useCallback(async()=>{Aa("checking"),await So()?.prepareNotificationTest?.();const S=await o9({title:"Termdock",body:e("settings.notificationsTestBody"),tag:"termdock-notification-test",requireHidden:!1,data:{url:"/"}});Aa(S?"delivered":"failed")},[e]),mr=y.useCallback(S=>{Q(S),l9(S),xf()},[]),en=y.useCallback(S=>{F(S),c9(S),xf()},[]),Mn=y.useCallback(S=>{$(S),u9(S),xf()},[]);y.useEffect(()=>{Jn.some(S=>S.id===Qi)||go(Jn[0]?.id??"default")},[Qi,Jn]),y.useEffect(()=>{if(!Ir.available&&zs==="tmux"){di("shell",{userInitiated:!1});return}Ir.available&&Hs!=="shell"&&zs!=="tmux"&&di("tmux",{userInitiated:!1})},[zs,Ir.available,Hs,di]),y.useEffect(()=>{ya(null)},[He,zs,Ir.available]),y.useEffect(()=>{const S={};typeof navigator<"u"&&(S.userAgent=navigator.userAgent,S.platform=navigator.platform,S.maxTouchPoints=navigator.maxTouchPoints,S.hasTouch=navigator.maxTouchPoints>0||"ontouchstart"in window,S.vendor=navigator.vendor),typeof window<"u"&&(S.screenWidth=window.innerWidth,S.screenHeight=window.innerHeight,S.pixelRatio=window.devicePixelRatio,S.orientation=window.screen?.orientation?.type||"unknown",S.hasVisualViewport=!!window.visualViewport,S.visualViewportHeight=window.visualViewport?.height,S.visualViewportWidth=window.visualViewport?.width,S.location=window.location.href),S.timestamp=new Date().toISOString(),S.isIOS=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,S.isAndroid=/Android/.test(navigator.userAgent),It(S)},[]);const Sn=y.useCallback(S=>{if(No(S)||!S.destination)return;if(S.type==="group"){if(S.source.index===S.destination.index)return;po(Jx(Yn,S.source.index,S.destination.index));return}if(S.source.droppableId!==S.destination.droppableId||S.source.index===S.destination.index)return;const D=S.source.droppableId.replace(/^group-sessions:/,""),ae=Yn.find(Ze=>Ze.key===D);ae&&window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:ae.sessions[S.source.index]?.id,targetId:ae.sessions[S.destination.index]?.id}}))},[Yn,po,No]),Un=C.useMemo(()=>is.flatMap(S=>{const D=Gt.get(S.id);if(D?.agentStatus!=="working")return[];const{primary:ae,secondary:Ze}=Ho(S,D?.activeProgram??null,D?.cwd??null,oa,D?.shellTitle??null,D?.promptState??null);return[{id:S.id,label:ae,detail:Ze}]}),[is,Gt]),Lr=ft?is.findIndex(S=>S.id===ft):-1,xn=is.length>0&&Lr>=0?`${Lr+1}/${is.length}`:`${is.length}`,vn=C.useMemo(()=>{let S=0;for(const D of Ct){const ae=Gt.get(D.id);(ae?.agentStatus==="waiting"||ae?.agentNeedsReview)&&(S+=1)}return{running:Un.length,review:S}},[Un.length,Ct,Gt]),Gs=C.useMemo(()=>is.flatMap(S=>{const D=Gt.get(S.id);if(D?.agentStatus!=="waiting"&&!D?.agentNeedsReview)return[];const{primary:ae}=Ho(S,D.activeProgram,D.cwd,oa,D.shellTitle,D.promptState);return[{id:D.terminalSessionId??S.id,label:ae,waiting:D.agentStatus==="waiting"}]}),[is,Gt]);d9(vn.running,vn.review,Gs);const Sa=ft?Ct.find(S=>S.id===ft)??null:null,ds=Sa?Gt.get(Sa.id):void 0,Ul=!!(Sa&&ds?.agentResumeRecovered&&ds.agentNativeSessionId&&ds.terminalSessionId),Ss=Sa&&ke?.sessionId===Sa.id?ke:null;C.useLayoutEffect(()=>{if(!xe)return;const S=Pt.current;if(!S)return;const D=!rr.current;S.scrollIntoView({inline:"nearest",block:"nearest",behavior:D?"auto":"smooth"}),rr.current=!0,D&&zc("active-tab-positioned")},[ft,xe]),y.useEffect(()=>{ve&&Me.current&&(Me.current.scrollIntoView({block:"nearest",inline:"nearest"}),Me.current.focus(),Me.current.select()),ve||(Ut.current=!1)},[ve]);const Ro=y.useCallback(S=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:S}))},[]),gl=y.useCallback((S,D)=>{_t(D??null),At(S)},[]),bc=M6(),ki=y.useCallback(S=>{if(!S)return;P(S),pt.current&&la("info","PWA_NOTIFICATION_CLICK app-focus-request",{traceId:pt.current,requestedSessionId:S,activeSessionId:ft,sessions:Ct.map(ae=>({id:ae.id,terminalSessionId:Gt.get(ae.id)?.terminalSessionId??null}))}),h9(S);const D=Ct.find(ae=>ae.id===S||Gt.get(ae.id)?.terminalSessionId===S);D?(rt.current=null,pt.current&&la("info","PWA_NOTIFICATION_CLICK app-focus-dispatch",{traceId:pt.current,requestedSessionId:S,targetSessionId:D.id}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D.id}))):(rt.current=S,pt.current&&la("info","PWA_NOTIFICATION_CLICK app-focus-pending",{traceId:pt.current,requestedSessionId:S}))},[ft,Ct,Gt]);y.useEffect(()=>{if(typeof window>"u"||typeof caches>"u")return;let S=!1;const D=async()=>{if(window.parent!==window&&Vo()){Ae(!0);return}try{const Ze=await caches.open(sO),bt=await Ze.match(Fx);if(!bt)return;await Ze.delete(Fx);const Yt=await bt.json();if(S)return;const Ar=typeof Yt.sessionId=="string"?Yt.sessionId:null,sn=typeof Yt.traceId=="string"?Yt.traceId:null,tn=typeof Yt.clickedAt=="number"?Yt.clickedAt:0,mn=Date.now()-tn;la("info","PWA_NOTIFICATION_CLICK app-cache-consumed",{traceId:sn,sessionId:Ar,ageMs:mn,valid:!!(Ar&&mn>=0&&mn<=$x),visibilityState:document.visibilityState}),Ar&&mn>=0&&mn<=$x&&(pt.current=sn,typeof Yt.targetPeerId=="string"&&Yt.targetPeerId!==C0()?.targetPeerId?Vo()?.focusSession(Yt.targetPeerId,Ar):ki(Ar))}catch(Ze){la("warn","PWA_NOTIFICATION_CLICK app-cache-failed",{error:Ze instanceof Error?Ze.message:String(Ze)})}finally{S||Ae(!0)}},ae=()=>{document.visibilityState==="visible"&&D()};return D(),document.addEventListener("visibilitychange",ae),window.addEventListener("pageshow",D),()=>{S=!0,document.removeEventListener("visibilitychange",ae),window.removeEventListener("pageshow",D)}},[ki]),y.useEffect(()=>{if(typeof window>"u")return;const S=new URLSearchParams(window.location.search),D=S.get("session");if(!D)return;la("info","PWA_NOTIFICATION_CLICK app-url-received",{traceId:pt.current,targetSessionId:D,href:window.location.href,visibilityState:document.visibilityState});const ae=S.get("service");ae&&ae!==C0()?.targetPeerId?Vo()?.focusSession(ae,D):rt.current=D,S.delete("service"),S.delete("session"),S.delete("_notifTrace");const Ze=S.toString(),bt=`${window.location.pathname}${Ze?`?${Ze}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",bt)},[]),y.useEffect(()=>{if(typeof window>"u")return;const S=new URLSearchParams(window.location.search);if(S.get("_notif")!=="1")return;const D=S.get("session");S.delete("_notif");const ae=S.toString(),Ze=`${window.location.pathname}${ae?`?${ae}`:""}${window.location.hash}`;if(window.history.replaceState(window.history.state,"",Ze),window.parent!==window&&Vo())return;const bt=new BroadcastChannel("termdock:notif");let Yt=!1;const Ar=tn=>{tn.data?.type==="termdock:notif-pong"&&!Yt&&(Yt=!0,bt.close(),window.close())};bt.addEventListener("message",Ar),bt.postMessage({type:"termdock:notif-ping",sessionId:D,targetPeerId:S.get("service")});const sn=setTimeout(()=>{Yt||bt.close()},500);return()=>{clearTimeout(sn),Yt||bt.close()}},[]),y.useEffect(()=>{if(typeof window>"u"||window.parent!==window&&Vo())return;const S=new BroadcastChannel("termdock:notif"),D=ae=>{ae.data?.type==="termdock:notif-ping"&&(S.postMessage({type:"termdock:notif-pong"}),typeof ae.data.sessionId=="string"&&(typeof ae.data.targetPeerId=="string"&&ae.data.targetPeerId!==C0()?.targetPeerId?Vo()?.focusSession(ae.data.targetPeerId,ae.data.sessionId):ki(ae.data.sessionId)))};return S.addEventListener("message",D),()=>S.close()},[ki]),y.useEffect(()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return;const S=D=>{const ae=D.data;if(ae&&ae.type==="termdock:focus-session"&&typeof ae.sessionId=="string"){if(typeof ae.targetPeerId=="string"&&ae.targetPeerId!==C0()?.targetPeerId){Vo()?.focusSession(ae.targetPeerId,ae.sessionId)&&D.ports[0]?.postMessage({type:"termdock:focus-session-ack"});return}D.ports[0]?.postMessage({type:"termdock:focus-session-ack"}),ki(ae.sessionId)}else ae?.type==="termdock:push-subscription-changed"?T0(!0):ae?.type};return navigator.serviceWorker.addEventListener("message",S),()=>navigator.serviceWorker.removeEventListener("message",S)},[ki]),y.useEffect(()=>{const S=D=>{const ae=D.detail;typeof ae=="string"&&ki(ae)};return window.addEventListener("termdock:focus-session",S),()=>window.removeEventListener("termdock:focus-session",S)},[ki]),y.useEffect(()=>{const S=()=>{const D=y9(C0()?.targetPeerId);D&&ki(D)};return S(),window.addEventListener("termdock:workspace-session",S),()=>window.removeEventListener("termdock:workspace-session",S)},[ki]),y.useEffect(()=>{const S=rt.current;if(!S)return;const D=Ct.find(ae=>ae.id===S||Gt.get(ae.id)?.terminalSessionId===S);D?(rt.current=null,pt.current&&la("info","PWA_NOTIFICATION_CLICK app-pending-dispatch",{traceId:pt.current,requestedSessionId:S,targetSessionId:D.id,activeSessionId:ft}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D.id}))):pt.current&&la("info","PWA_NOTIFICATION_CLICK app-pending-unmatched",{traceId:pt.current,requestedSessionId:S,activeSessionId:ft,sessions:Ct.map(ae=>({id:ae.id,terminalSessionId:Gt.get(ae.id)?.terminalSessionId??null}))})},[ft,Ct,Gt]);const _a=C.useMemo(()=>{const S=[];for(const D of Ct){const ae=Gt.get(D.id);(ae?.agentStatus==="waiting"||ae?.agentNeedsReview)&&S.push(D.id)}return S},[Ct,Gt]),Es=y.useCallback(()=>{if(_a.length===0)return;ft&&Hr.getState().clearAgentNeedsReview(ft);const S=ft?Ct.findIndex(ae=>ae.id===ft):-1,D=_a.find(ae=>Ct.findIndex(Ze=>Ze.id===ae)>S)??_a[0];D&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D}))},[_a,Ct,ft]),xl=y.useCallback(()=>{if(_a.length===0)return;ft&&Hr.getState().clearAgentNeedsReview(ft);const S=ft?Ct.findIndex(ae=>ae.id===ft):Ct.length,D=[..._a].reverse().find(ae=>Ct.findIndex(Ze=>Ze.id===ae)<S)??_a[_a.length-1];D&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D}))},[_a,Ct,ft]);y.useEffect(()=>{const S=D=>{!D.altKey||!D.shiftKey||D.metaKey||D.ctrlKey||D.key!=="ArrowUp"&&D.key!=="ArrowDown"||(D.preventDefault(),D.key==="ArrowUp"?xl():Es())};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[Es,xl]);const Zh=y.useCallback(async S=>{const ae=Hr.getState().sessions.get(S)?.cwd;if(ae)try{await navigator.clipboard?.writeText(ae),Tt(ae),window.setTimeout(()=>{Tt(Ze=>Ze===ae?null:Ze)},1400)}catch{}},[]),Wu=y.useCallback(S=>{jr(S.sessions),Br(S.activeSessionId),st(S.splitWorkspaces),Hr.getState().setActiveSessionId(S.activeSessionId)},[]),Kh=y.useCallback(()=>{an(!0)},[]),Xh=y.useCallback(()=>{an(!0),window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("termdock:initial-viewport-presented"))})},[]);y.useEffect(()=>{if(!fn||!ft)return;Ct.find(D=>D.id===fn||Gt.get(D.id)?.terminalSessionId===fn)?.id===ft&&P(null)},[ft,fn,Ct,Gt]);const xo=y.useCallback(S=>{const D=S?.mode??zs,ae=D==="tmux"&&(S?.tmuxSessionName?.trim()||mo.trim())||void 0,Ze=S?.cwd||(ft?Hr.getState().sessions.get(ft)?.cwd:void 0);window.dispatchEvent(new CustomEvent("new-terminal-session",{detail:{mode:D,tmuxSessionName:ae,cwd:Ze,command:S?.command}}))},[zs,mo,ft]),el=y.useCallback(async()=>{Vn(!0);try{const S=await Ip();if(ln(S),!S.available){Sr([]);return}const D=await Ep();Sr(D)}catch{ln({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),Sr([])}finally{Vn(!1)}},[]),Jh=y.useCallback(async S=>{cn(S),we(null);try{const{cleanedSessions:D}=await Vx(S);for(const ae of D)window.dispatchEvent(new CustomEvent("close-terminal-session-by-backend",{detail:ae}));qn(null),await el()}catch(D){we(D instanceof Error?D.message:"Failed to kill tmux session")}finally{cn(null)}},[el]);y.useEffect(()=>{if(!Pe)return;if(hr.find(ae=>ae.name===Pe&&(ae.connected||ae.boundFrontendSessionId))){Ge(null);return}const D=setTimeout(()=>Ge(null),1e4);return()=>clearTimeout(D)},[Pe,hr]);const zl=y.useCallback(S=>{window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:S}))},[]),Gu=y.useCallback(S=>{const D=S??ft;D&&window.dispatchEvent(new CustomEvent("open-terminal-split-chooser",{detail:D}))},[ft]),Vu=y.useCallback((S,D)=>{window.dispatchEvent(new CustomEvent("set-terminal-split-direction",{detail:{sessionId:S,layout:D}}))},[]),qu=y.useCallback((S,D)=>{window.dispatchEvent(new CustomEvent("reorder-terminal-split-workspace",{detail:{workspaceId:S,sessionIds:D}}))},[]),yc=y.useCallback((S,D)=>{window.dispatchEvent(new CustomEvent("rename-terminal-split-workspace",{detail:{workspaceId:S,name:D}}))},[]),c0=y.useCallback((S,D)=>{window.dispatchEvent(new CustomEvent("combine-terminal-split-sessions",{detail:{primaryId:S,secondaryId:D}}))},[]),bl=y.useCallback((S,D)=>{const ae=Ct.find(bt=>bt.id===S);if(!ae)return;const Ze=Gt.get(S);if(!v5({mode:ae.mode,activeProgram:Ze?.activeProgram??null,promptState:Ze?.promptState??null,shellNames:oa})){zl({sessionId:S,source:"sidebar",closeMode:ae.mode==="tmux"?"destroy":"auto"});return}me(D?{x:D.clientX,y:D.clientY}:null),U(S),we(null)},[Ct,Gt,zl]);y.useEffect(()=>{if(!ze)return;const S=D=>{const ae=D.detail;ae==="new-session"?xo():ae==="close-session"?ft&&bl(ft):ae==="previous-session"||ae==="next-session"?window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:ae==="next-session"?"next":"prev"}})):ae==="toggle-left-sidebar"?Si():ae==="toggle-right-sidebar"?Zi():ae==="previous-attention"?xl():ae==="next-attention"&&Es()};return window.addEventListener("termdock:native-command",S),()=>window.removeEventListener("termdock:native-command",S)},[ft,ze,xo,bl,Si,Zi,Es,xl]);const ji=C.useMemo(()=>Ct.find(S=>S.id===$n)??null,[Ct,$n]),u0=y.useCallback(()=>{ji&&(zl({sessionId:ji.id,source:"sidebar",closeMode:"destroy"}),U(null),me(null))},[ji,zl]);y.useEffect(()=>{if(!ji)return;const S=D=>{if(D.key==="Escape"){D.preventDefault(),D.stopImmediatePropagation(),U(null),me(null),we(null);return}D.key!=="Enter"||D.isComposing||D.keyCode===229||D.altKey||D.ctrlKey||D.metaKey||D.shiftKey||(D.preventDefault(),D.stopImmediatePropagation(),D.repeat||u0())};return window.addEventListener("keydown",S,!0),()=>window.removeEventListener("keydown",S,!0)},[ji,u0]);const d0=C.useMemo(()=>{if(!ji)return"";const S=Gt.get(ji.id);return Ho(ji,S?.activeProgram??null,S?.cwd??null,oa,S?.shellTitle??null,S?.promptState??null).primary},[ji,Gt]);y.useEffect(()=>{if(!He)return;let S=!1,D=!1;const ae=async()=>{if(!D)try{const bt=await Ip();if(S||ln(bt),!bt.available){S||Sr([]);return}const Yt=await Ep();S||Sr(Yt)}catch{D=!0,S||(ln({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),Sr([]))}};ae();const Ze=setInterval(()=>{ae()},4e3);return()=>{S=!0,clearInterval(Ze)}},[He]);const h0=Kr??zs,f0=h0==="shell",p0=h0==="tmux"&&Ir.available,ef=C.useMemo(()=>f9(hr.map(S=>({...S,id:S.name})),S=>S.cwd??null,e("sidebar.ungrouped")),[hr,e]),m0=C.useMemo(()=>hr.filter(S=>S.recoveryCandidate===!0&&!S.connected&&!S.boundFrontendSessionId).sort((S,D)=>(D.lastActiveAt??D.createdAt??0)-(S.lastActiveAt??S.createdAt??0)),[hr]);y.useEffect(()=>{!Xr&&!(on&&Mt)||el()},[Xr,on,Mt,Ct.length,el]);const g0=(S,D,ae,Ze=!1)=>{const bt=S.id===ft,Yt=S.id===ve,Ar=Gt.get(S.id),{primary:sn,secondary:tn}=Ho(S,Ar?.activeProgram??null,Ar?.cwd??null,oa,Ar?.shellTitle??null,Ar?.promptState??null),mn=xu(Ar?.cwd??null),Ii=D?tn??(mn&&mn!==sn?mn:null):null,qr=Ar?.gitStatus,Vs=`${Ar?.cwd||S.name}${qr?`
|
|
158
|
-
⎇ ${qr.branch} +${qr.added} −${qr.removed}`:""}`,za=!!(Ar?.tuiProgress&&Ar.tuiProgress.state!=="remove"),Ha=Ar?.agentStatus==="working"||za?"var(--success)":Ar?.agentStatus==="waiting"||Ar?.agentNeedsReview?"var(--warning)":Ar?.inCopyMode?"var(--tmux)":null;if(Yt&&Mt&&!jt){const ta=S.customName?S.name:sn,fi=(La,Ku)=>{const v0=Ku.trim();v0?v0!==ta&&Di(La,v0):Bi(La),lt(null)};return a.jsx("input",{ref:La=>{Me.current=La},type:"text",defaultValue:ta,className:"h-8 shrink-0 rounded-md bg-surface-elevated px-2 text-[12px] leading-none text-foreground outline-none ring-1 ring-primary/50 sm:h-8 min-w-[5rem]",style:{width:`${Math.max(ta.length,5)}ch`},onKeyDown:La=>{La.key==="Enter"?fi(S.id,La.target.value):La.key==="Escape"&<(null)},onBlur:La=>fi(S.id,La.target.value)})}return a.jsx("div",{ref:bt?Pt:null,onContextMenu:ta=>{ta.preventDefault(),_t({x:ta.clientX,y:ta.clientY}),At(S.id)},...bc(()=>gl(S.id)),className:Ze?`group relative inline-flex h-5 shrink-0 items-center rounded-sm text-[11px] leading-none transition ${bt?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:bg-surface-elevated/40 hover:text-foreground"}`:`group relative inline-flex h-8 shrink-0 items-center rounded-md text-[12px] leading-none transition sm:h-8 ${bt?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:bg-surface-elevated/50 hover:text-foreground"}`,style:!Ze&&bt&&Ha?{boxShadow:`inset 2px 0 0 0 ${Ha}`}:!Ze&&bt?{boxShadow:"inset 2px 0 0 0 rgb(var(--primary-rgb, 99 102 241))"}:void 0,title:Vs,children:a.jsx("button",{type:"button",...ae??{},onClick:()=>Ro(S.id),className:`inline-flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-left ${Ze?"px-1":"py-1 pl-1 pr-1.5 sm:pl-1.5 sm:pr-2"} ${ae?"cursor-grab active:cursor-grabbing":""}`,title:Vs,children:a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 overflow-hidden",children:[a.jsxs("span",{className:"inline-flex shrink-0 items-center",children:[zx(S.mode,Ar),Ar?.agentResumeRecovered&&a.jsx(sc,{size:Ze?9:10,className:"-ml-0.5 shrink-0 text-[color:var(--warning)]","aria-label":e("tab.resumeAgentAvailable")}),za&&!Ar?.agentStatus&&a.jsx(_n,{size:Ze?9:10,className:"-ml-0.5 shrink-0 animate-spin text-[color:var(--success)]"})]}),Ii?a.jsxs("span",{className:"flex min-w-0 flex-col justify-center leading-[0.82rem] sm:leading-[0.85rem]",children:[a.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${Ar?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:sn}),a.jsx("span",{className:"truncate text-[9px] text-muted-foreground/80 sm:text-[9.5px]",children:Ii})]}):a.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${Ar?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:sn})]})})})},Yu=()=>a.jsx(ul,{droppableId:T1,type:"session",isDropDisabled:Mt,children:(S,D)=>{const ae=Rr||D.isDraggingOver;return a.jsxs("div",{ref:S.innerRef,...S.droppableProps,className:"pointer-events-none fixed left-1/2 top-[42%] z-toast flex h-32 w-32 -translate-x-1/2 -translate-y-1/2 items-center justify-center",role:"status","aria-live":"polite","aria-hidden":!fr,"data-mobile-session-destroy-target":"","data-active":ae?"true":"false",children:[a.jsxs("div",{className:`flex h-28 w-28 flex-col items-center justify-center gap-2 rounded-full border bg-surface-elevated/95 shadow-2xl backdrop-blur transition duration-200 ${fr?ae?"scale-110 border-destructive bg-destructive text-destructive-foreground opacity-100":"scale-100 border-destructive/50 text-destructive opacity-100":"scale-75 border-transparent opacity-0"}`,children:[a.jsx(ri,{size:28,strokeWidth:1.8}),a.jsx("span",{className:"px-2 text-center text-[11px] font-semibold leading-tight",children:e(ae?"tab.releaseToClose":"tab.dragToClose")})]}),S.placeholder]})}}),Ji=on&&Mt,tl=jn&&Mt,yl=Ud(Gn,Ye,Ji?An:0),Hl=tl?yl+Gx:0,ea=Ji?Ct.find(S=>S.id===ft):null,_s=ea?Gt.get(ea.id):void 0,x0=ea?Ho(ea,_s?.activeProgram??null,_s?.cwd??null,oa,_s?.shellTitle??null,_s?.promptState??null).primary:"",b0=Mt?dr:null,tf=Ji&&!b0&&_s?_s.agentStatus==="working"?"bg-gradient-to-r from-[rgb(var(--success-rgb)_/_0.08)] to-transparent":_s.agentStatus==="waiting"?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.14)] to-transparent":_s.agentNeedsReview?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.08)] to-transparent":_s.inCopyMode?"bg-gradient-to-r from-[rgb(var(--tmux-rgb)_/_0.07)] to-transparent":"":"",y0=a.jsxs("div",{className:"w-full h-full flex flex-col app-chrome-bg text-foreground",children:[a.jsx("main",{className:"relative min-h-0 flex-1 overflow-visible px-0 pb-0 pt-0",children:a.jsxs("div",{className:"relative flex h-full w-full min-h-0 flex-col overflow-visible app-chrome-bg",children:[a.jsxs("div",{className:`${Mt?"absolute inset-x-0 top-0 z-20":"relative"} shrink-0 items-center gap-1 app-chrome-bg px-1 sm:px-1.5 transition-colors duration-500 ${Ji?"flex justify-end":"flex justify-between"} ${Tn?"h-10 sm:h-10":"h-9 sm:h-10"} ${tf}`,style:{position:Mt?"absolute":void 0,marginRight:Hl||void 0,display:b0?"none":void 0},children:[!Ji&&a.jsxs("button",{type:"button",onClick:Si,className:"relative inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground ring-1 ring-border/10 transition hover:bg-surface-elevated hover:text-foreground sm:h-8 sm:w-8","aria-label":e("tab.sessionsTitle"),title:`${e("tab.sessionsTitle")} · ${e("agent.aiRunning")}: ${vn.running} · ${e("agent.needsReview")}: ${vn.review}`,children:[a.jsx(Kw,{size:14}),a.jsx(MQ,{runningCount:vn.running,reviewCount:vn.review,className:"sm:hidden"})]}),Ji?a.jsx("div",{className:"absolute left-1/2 flex max-w-[40%] min-w-0 -translate-x-1/2 items-center justify-center gap-1.5 overflow-hidden",children:ea?a.jsxs(a.Fragment,{children:[zx(ea.mode,_s),a.jsx("span",{className:`truncate text-[12px] font-medium ${_s?.inCopyMode?"text-[color:var(--tmux)]":"text-foreground"}`,children:x0}),_s?.agentStatus==="working"&&a.jsx("span",{title:_s?.agentMessage??void 0,children:a.jsx(_n,{size:12,className:"shrink-0 animate-spin text-[color:var(--success)]"})}),_s?.agentStatus==="waiting"&&a.jsx("span",{title:_s?.agentMessage??void 0,children:a.jsx(oh,{size:12,className:"shrink-0 animate-bounce-y text-[color:var(--warning)]"})}),!_s?.agentStatus&&_s?.agentNeedsReview&&a.jsx("span",{title:_s?.agentMessage??void 0,children:a.jsx(jl,{size:13,className:"shrink-0 animate-pulse text-[color:var(--warning)]"})})]}):a.jsx("span",{className:"truncate px-2 text-[12px] text-muted-foreground",children:e("sidebar.sessions")})}):Tn?a.jsxs(Ch,{onDragStart:$s,onDragUpdate:Us,onDragEnd:Sn,children:[Yu(),a.jsx(ul,{droppableId:"groups",type:"group",direction:"horizontal",children:S=>a.jsxs("div",{ref:S.innerRef,...S.droppableProps,className:"scrollbar-hidden flex h-full min-w-0 flex-1 items-center gap-1 overflow-x-auto overflow-y-hidden whitespace-nowrap px-0.5 py-0.5",style:{touchAction:"pan-x"},children:[Yn.map((D,ae)=>{let Ze=0,bt=0;for(const tn of D.sessions){const mn=Gt.get(tn.id);mn?.agentStatus==="working"&&(Ze+=1),(mn?.agentStatus==="waiting"||mn?.agentNeedsReview)&&(bt+=1)}const Yt=D.sessions.some(tn=>tn.id===ft),Ar=Dr.has(D.key),sn=D.key==="";return a.jsx(cl,{draggableId:`group-${D.key||"__ungrouped__"}`,index:ae,isDragDisabled:sn,disableInteractiveElementBlocking:!0,children:(tn,mn)=>a.jsxs("div",{ref:tn.innerRef,...tn.draggableProps,className:`flex w-fit shrink-0 flex-col justify-center gap-px rounded-md py-0.5 px-1 ring-1 transition-colors ${mn.isDragging?"bg-surface-elevated ring-primary/30 shadow-lg opacity-90":Yt?"bg-primary/[0.06] ring-primary/20":"bg-surface-2/40 ring-border/10"}`,children:[a.jsxs("button",{type:"button",...sn?{}:tn.dragHandleProps,onClick:()=>ns(D.key),className:`flex ${Ar?"":D.sessions.length>1?"w-0 min-w-full":""} items-center gap-0.5 rounded text-[9px] font-semibold uppercase tracking-[0.08em] leading-none transition hover:bg-surface-elevated/40 ${sn?"":"cursor-grab active:cursor-grabbing"} ${Yt?"text-primary/80":"text-muted-foreground/55"}`,title:D.key||D.label,children:[a.jsx(Yc,{size:9,className:`shrink-0 opacity-70 transition-transform ${Ar?"":"rotate-90"}`}),a.jsx("span",{className:"min-w-0 truncate",children:D.label}),Ze>0&&a.jsx("span",{className:"ml-auto h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)]"}),bt>0&&a.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] ${Ze>0?"":"ml-auto"}`})]}),Ar?a.jsx("span",{className:"flex h-5 items-center text-[10px] leading-none text-muted-foreground/50",children:e("tab.sessionCount",{count:D.sessions.length})}):a.jsx(ul,{droppableId:`group-sessions:${D.key}`,type:"session",direction:"horizontal",children:Ii=>a.jsxs("div",{ref:Ii.innerRef,...Ii.droppableProps,className:"flex items-center gap-px",children:[D.sessions.map((qr,Vs)=>a.jsx(cl,{draggableId:qr.id,index:Vs,disableInteractiveElementBlocking:!0,children:(za,Ha)=>a.jsx("div",{ref:za.innerRef,...za.draggableProps,className:`flex shrink-0 items-center ${Ha.isDragging?"opacity-70":""}`,children:g0(qr,!1,za.dragHandleProps,!0)})},qr.id)),Ii.placeholder]})})]})},D.key||"__ungrouped__")}),S.placeholder,a.jsx("button",{type:"button",onClick:()=>xo(),className:"my-auto inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground ring-1 ring-border/10 transition hover:bg-primary/15 hover:text-primary active:scale-95","aria-label":e("tab.new"),title:e("tab.new"),children:a.jsx(wi,{size:14})})]})})]}):a.jsxs(Ch,{onDragStart:$s,onDragUpdate:Us,onDragEnd:ui,children:[Yu(),a.jsx(ul,{droppableId:"tabs",type:"session",direction:"horizontal",children:S=>a.jsxs("div",{ref:S.innerRef,...S.droppableProps,className:"scrollbar-hidden flex h-full min-w-0 flex-1 items-center gap-1 overflow-x-auto overflow-y-hidden whitespace-nowrap",style:{touchAction:"pan-x"},children:[is.map((D,ae)=>D.id===ve?a.jsx(C.Fragment,{children:a.jsx(cl,{draggableId:D.id,index:ae,isDragDisabled:!0,children:bt=>a.jsx("div",{ref:bt.innerRef,...bt.draggableProps,className:"flex h-full items-center",children:g0(D,!0)})})},D.id):a.jsx(C.Fragment,{children:a.jsx(cl,{draggableId:D.id,index:ae,disableInteractiveElementBlocking:!0,children:(bt,Yt)=>a.jsx("div",{ref:bt.innerRef,...bt.draggableProps,className:`flex h-full shrink-0 items-center ${Yt.isDragging?"opacity-70":""}`,children:g0(D,!0,bt.dragHandleProps)})})},D.id)),a.jsx("button",{type:"button",onClick:()=>xo(),className:"ml-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground ring-1 ring-border/10 transition hover:bg-primary/15 hover:text-primary active:scale-95","aria-label":e("tab.new"),title:e("tab.new"),children:a.jsx(wi,{size:14})}),S.placeholder]})})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[!Ji&&vn.running>0&&a.jsx("span",{className:"hidden items-center gap-1 sm:inline-flex",children:a.jsx(Z6,{count:vn.running,tone:"running",title:e("agent.aiRunning")})}),!Ji&&Ct.length>0&&a.jsx("span",{className:"inline-flex shrink-0 items-center px-1 text-[10px] uppercase tracking-[0.16em] text-muted-foreground sm:text-[11px]",title:`Session ${Lr+1} of ${Ct.length}`,children:xn}),!tl&&a.jsx("button",{type:"button",onClick:Zi,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground ring-1 ring-border/10 transition hover:bg-surface-elevated hover:text-foreground sm:h-8 sm:w-8","aria-label":e("tab.explorerTitle"),title:e("tab.explorerTitle"),children:a.jsx(lb,{size:14})})]})]}),Ul&&Sa&&ds?.terminalSessionId&&a.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/15 bg-surface/80 px-3 py-2 animate-fade-in sm:px-4",style:{marginRight:Hl||void 0},role:"status","data-testid":"agent-resume-recovery-banner",children:[a.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-[rgb(var(--warning-rgb)_/_0.14)] text-[color:var(--warning)]",children:!Ss?.error&&(Ss?.status==="submitting"||Ss?.status==="waiting")?a.jsx(_n,{size:14,className:"animate-spin"}):a.jsx(sc,{size:14})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"truncate text-[12px] font-medium text-foreground",children:e("tab.resumeAgentRecoveredTitle",{agent:ds.agent?.displayName??"Agent"})}),a.jsx("div",{className:`truncate text-[10px] sm:text-[11px] ${Ss?.error?"text-destructive":"text-muted-foreground"}`,children:Ss?.error??(Ss?.status==="submitting"?e("tab.resumeAgentSubmitting"):Ss?.status==="waiting"?e("tab.resumeAgentWaiting"):e("tab.resumeAgentRecoveredHint"))})]}),a.jsx("button",{type:"button",disabled:!Ss?.error&&(Ss?.status==="submitting"||Ss?.status==="waiting"),onClick:()=>{gn(Sa.id,ds.terminalSessionId)},className:"shrink-0 rounded-full bg-primary px-3 py-1.5 text-[11px] font-semibold text-primary-foreground transition hover:opacity-90 active:scale-95 disabled:cursor-wait disabled:opacity-60 sm:text-[12px]",children:Ss?.error?e("common.retry"):e("tab.resumeAgentNow")}),a.jsx("button",{type:"button",onClick:()=>{Hr.getState().setAgentResumeRecovered(Sa.id,!1),St(S=>S?.sessionId===Sa.id?null:S)},className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":e("tab.resumeAgentLater"),title:e("tab.resumeAgentLater"),children:a.jsx(Kn,{size:13})})]}),a.jsx("div",{ref:Pr,className:"min-h-0 flex-1 flex overflow-hidden app-chrome-bg",children:a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:a.jsx(vI,{terminalSettings:ar,colorTheme:p,toolbarPresets:Jn,showDebug:c&&Mt,terminalFocusAvailable:B,defaultSessionMode:zs,defaultTmuxSessionName:mo,connectionPrioritySessionId:fn,connectionPriorityReady:xe,desktopRightSidebarEnabled:Mt,onToggleRightSidebar:Zi,desktopFloatingTitle:Mt,desktopPinnedLeftSidebarWidth:Ji?An:0,desktopViewportWidth:Ye,onSessionDataUpdate:Wu,onInitialViewportReady:Xh,onInitialRecoveryRequired:Kh})})})]})}),a.jsx(PQ,{reviewCount:vn.review,runningSessions:Un,activeSessionId:ft,runningButtonEnabled:Nn,attentionButtonEnabled:On,isDesktopLayout:Mt,containerElement:ii,occlusionInsets:{right:Hl}}),He&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-drawer-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm animate-fade-in cursor-default",onClick:xa,"aria-label":e("settings.closeSettings")}),a.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-dialog-title",className:"pointer-events-none fixed inset-0 z-drawer-panel flex items-stretch justify-center p-0 animate-fade-in sm:p-4 md:p-6",children:a.jsxs("div",{className:"pointer-events-auto flex h-full w-full max-w-5xl flex-col overflow-hidden bg-surface shadow-[0_28px_90px_var(--app-shadow-strong),0_14px_34px_var(--app-shadow-soft)] sm:max-h-[calc(100dvh-3rem)] sm:rounded-3xl sm:border sm:border-border/15",style:{paddingTop:n,paddingBottom:i},children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border/15 px-4 py-3 sm:px-6 sm:py-4",children:[a.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-full bg-primary/15 text-primary sm:h-9 sm:w-9",children:a.jsx(IA,{size:15})}),a.jsx("h2",{id:"settings-dialog-title",className:"text-[15px] font-semibold text-foreground sm:text-[16px]",children:e("settings.title")})]}),a.jsx("button",{type:"button",onClick:xa,className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-destructive/20 hover:text-destructive","aria-label":e("common.close"),children:a.jsx(Kn,{size:16})})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto bg-background/25 px-3 py-3 sm:px-6 sm:py-5 md:px-8",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.font")}),a.jsx("button",{type:"button",onClick:()=>Ot({fontSize:Math.max(8,Fe-1)}),className:"h-8 w-8 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",children:"−"}),a.jsx("input",{type:"range",min:"8",max:"32",value:Fe,onChange:S=>Ot({fontSize:parseInt(S.target.value,10)}),className:"min-w-0 flex-1","aria-label":e("settings.font")}),a.jsx("button",{type:"button",onClick:()=>Ot({fontSize:Math.min(32,Fe+1)}),className:"h-8 w-8 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",children:"+"}),a.jsxs("span",{className:"w-8 shrink-0 text-right text-[11px] tabular-nums text-muted-foreground",children:[Fe,"px"]})]}),a.jsx(VP,{}),a.jsx("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.render")}),a.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:["auto","webgl","canvas"].map(S=>{const D=yr===S;return a.jsx("button",{type:"button",onClick:()=>Ot({rendererMode:S}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${D?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:e(S==="auto"?"settings.auto":S==="webgl"?"settings.webgl":"settings.canvas")},S)})})]})}),a.jsx("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.theme")}),a.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:[["dark",Ww,e("settings.darkTheme")],["light",DA,e("settings.lightTheme")]].map(([S,D,ae])=>{const Ze=p===S;return a.jsxs("button",{type:"button",onClick:()=>g(S),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition ${Ze?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:[a.jsx(D,{size:12}),a.jsx("span",{children:ae})]},S)})})]})}),a.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.newTab")}),a.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:["shell","tmux"].map(S=>{const D=zs===S,ae=S==="tmux"&&!Ir.available;return a.jsx("button",{type:"button",disabled:ae,onClick:()=>di(S,{userInitiated:!0}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${D?"bg-primary/20 text-primary":ae?"cursor-not-allowed text-muted-foreground/40":"text-muted-foreground hover:bg-surface-elevated"}`,title:ae?Ir.reason||e("settings.installTmuxHint"):void 0,children:e(S==="shell"?"settings.shell":"settings.tmux")},S)})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>h(!c),className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${c?"bg-primary/15 text-primary":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,children:[a.jsx("span",{className:"font-medium",children:e("settings.debug")}),a.jsx(qo,{checked:c,size:"sm"})]}),a.jsxs("button",{type:"button",onClick:async()=>{const S=!b;w(S);try{const D=await ca({preventSleep:S});w(D.preventSleep),k(D.networkAvailable),de(D.localAccess),Bn(eu,{preventSleep:D.preventSleep,networkAvailable:D.networkAvailable,localAccess:D.localAccess})}catch{w(!S)}},className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${b?"bg-[rgb(var(--success-rgb)_/_0.15)] text-[color:var(--success)]":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:!A&&b?e("settings.noSleepUnavailable"):void 0,children:[a.jsx("span",{className:"font-medium truncate",children:e("settings.noSleep")}),a.jsx(qo,{checked:b,size:"sm"})]})]})]}),a.jsxs("div",{className:"mt-3 space-y-2",children:[a.jsxs("button",{type:"button",role:"switch","aria-checked":Nn,"aria-label":e("sidebar.runningSessionButton"),onClick:()=>{fs(!Nn)},className:"flex w-full items-center gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[a.jsx(Bp,{size:14,className:Nn?"shrink-0 text-[color:var(--success)]":"shrink-0 text-muted-foreground"}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium text-foreground",children:e("sidebar.runningSessionButton")}),a.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:e("sidebar.runningSessionButtonHint")})]}),a.jsx(qo,{checked:Nn,size:"sm"})]}),a.jsxs("button",{type:"button",role:"switch","aria-checked":On,"aria-label":e("sidebar.attentionButton"),onClick:()=>{Bs(!On)},className:"flex w-full items-center gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[a.jsx(jl,{size:14,className:On?"shrink-0 text-[color:var(--warning)]":"shrink-0 text-muted-foreground"}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium text-foreground",children:e("sidebar.attentionButton")}),a.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:e("sidebar.attentionButtonHint")})]}),a.jsx(qo,{checked:On,size:"sm"})]})]}),a.jsxs("button",{type:"button",onClick:()=>Xi(!0),className:"mt-3 flex w-full items-center justify-between gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[a.jsx(rb,{size:14,className:E?"shrink-0 text-primary":"shrink-0 text-muted-foreground"}),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block font-medium text-foreground",children:e("settings.notifications")}),a.jsx("span",{className:"block truncate text-[10px] text-muted-foreground",children:e(E?M&&j?"settings.notificationsBothOnSummary":M?"settings.notificationsAiOnSummary":j?"settings.notificationsExitOnSummary":"settings.notificationsNoEventsSummary":"settings.notificationsOffSummary")})]})]}),a.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[11px] text-muted-foreground",children:[a.jsx("span",{children:e(E?"common.on":"common.off")}),a.jsx("span",{children:"›"})]})]}),a.jsxs("button",{type:"button",onClick:()=>wa(!0),className:"mt-3 flex w-full items-center justify-between gap-3 rounded-xl bg-surface-2 px-3 py-3 text-left transition hover:bg-surface-elevated",children:[a.jsxs("span",{children:[a.jsx("span",{className:"block text-[12px] font-medium text-foreground/90",children:e("settings.localAccess")}),a.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.localAccessHint")})]}),a.jsx(Yc,{size:16,className:"shrink-0 text-muted-foreground"})]}),a.jsx(FP,{state:Ue,pending:K,onCheck:()=>{sr()},onConfirmRestart:()=>{wn()},desktopState:Ee?wt:void 0,desktopPending:ge,onCheckDesktop:Ee?()=>{yn()}:void 0,onInstallDesktop:()=>{Ts()},desktopSnapshot:ee,desktopActions:ze?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-1 gap-px border-t border-border/10 bg-border/10 sm:grid-cols-2",children:[a.jsxs("button",{type:"button",onClick:()=>{ze.showConnectionCenter()},className:"flex items-center gap-2 bg-surface-2 px-3 py-2.5 text-left text-[11px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:[a.jsx(V9,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopSwitchService")]}),a.jsxs("button",{type:"button",onClick:()=>{Y(null),ze.revealDataDirectory().catch(S=>Y(S instanceof Error?S.message:String(S)))},className:"flex items-center gap-2 bg-surface-2 px-3 py-2.5 text-left text-[11px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:[a.jsx(Hc,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopOpenDataDirectory")]})]}),ht&&a.jsx("div",{className:"border-t border-border/10 px-3 py-2 text-[10px] text-muted-foreground",children:ht})]}):void 0}),a.jsx(UP,{backendSessionId:ft?Gt.get(ft)?.terminalSessionId??null:null}),a.jsx(HP,{state:fe,onDismiss:()=>{Ln()}}),a.jsxs("div",{className:"mt-3 flex gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>{ya(null),xo({mode:"shell"}),xa()},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${f0?"flex-[2.7] bg-primary px-3 py-2.5 text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 hover:bg-primary/90":"flex-[0.78] bg-surface-2 px-2 py-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,title:e(Kr==="shell"?"sidebar.confirmNewShell":"settings.shell"),children:[a.jsx(wi,{size:14,className:f0?"shrink-0":"hidden"}),a.jsx(ko,{size:12}),a.jsx("span",{className:f0?"whitespace-nowrap":"hidden",children:e(Kr==="shell"?"sidebar.confirmNewShell":"settings.shell")})]}),a.jsxs("button",{type:"button",disabled:!Ir.available,onClick:()=>{Ir.available&&(ya(null),xo({mode:"tmux"}),xa())},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${Ir.available?p0?"flex-[2.7] bg-primary px-3 py-2.5 text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 hover:bg-primary/90":"flex-[0.78] bg-surface-2 px-2 py-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"flex-1 bg-surface-2/50 text-muted-foreground/50 cursor-not-allowed"}`,title:Ir.available?e(Kr==="tmux"?"sidebar.confirmNewTmux":"settings.tmux"):Ir.reason||e("settings.installTmuxHint"),children:[a.jsx(wi,{size:14,className:p0?"shrink-0":"hidden"}),a.jsx(Kc,{size:12}),a.jsx("span",{className:p0?"whitespace-nowrap":"hidden",children:e(Kr==="tmux"?"sidebar.confirmNewTmux":"settings.tmux")})]})]}),(Ir.available||hr.length>0)&&a.jsxs("details",{className:"mt-3 group rounded-xl bg-surface-2 [&[open]]:bg-surface-2",children:[a.jsxs("summary",{className:"flex cursor-pointer items-center justify-between rounded-xl px-3 py-2.5 text-[13px] hover:bg-surface-elevated",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`inline-flex h-2 w-2 rounded-full ${Ir.available?"bg-primary":"bg-destructive"}`}),a.jsx("span",{className:"font-medium",children:e("settings.tmuxServer")}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:Ir.available?e("settings.sessions",{n:hr.length}):e("settings.tmuxUnavailable")})]}),a.jsx("button",{type:"button",onClick:S=>{S.preventDefault(),el()},disabled:zr,className:"inline-flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-label":e("settings.refresh"),children:a.jsx(rs,{size:12,className:zr?"animate-spin":""})})]}),a.jsx("div",{className:"px-2 pb-2",children:Ir.available?hr.length===0?a.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:e("settings.noTmuxSessions")}):a.jsxs("div",{className:"space-y-2",children:[ef.map(S=>a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-1.5 py-1 text-[10px] text-muted-foreground",children:[a.jsx(hc,{size:11,className:"shrink-0 text-muted-foreground/70"}),a.jsx("span",{className:"shrink-0 font-medium text-foreground/75",children:S.label}),a.jsx("span",{className:"shrink-0 text-muted-foreground/70",children:e("settings.sessions",{n:S.sessions.length})}),S.key&&a.jsx("span",{className:"min-w-0 truncate text-muted-foreground/60",children:S.key})]}),S.sessions.map(D=>{const ae=D.boundFrontendSessionId??null,Ze=!!(D.connected||ae),bt=ae?Ct.find(fi=>fi.id===ae)??null:null,Yt=D.friendlyName?.trim()||null,Ar=D.label&&D.label!==D.name?D.label:null,sn=Yt||Ar||D.name,tn=Yt||Ar?`tmux:${D.name}`:null,mn=D.clientCount&&D.clientCount>0?t==="zh"?`网页连接 ${D.clientCount}`:`Web clients ${D.clientCount}`:null,Ii=D.attached>0?t==="zh"?`原生 tmux ${D.attached}`:`Native tmux ${D.attached}`:null,qr=[tn,Ze?D.restorable?e("settings.restorable"):e("settings.attached"):null,mn,Ii].filter(fi=>!!fi),Vs=[e("settings.windows",{n:D.windows}),D.createdAt?new Date(D.createdAt).toLocaleDateString():null].filter(fi=>!!fi),za=Gr===D.name,Ha=In===D.name,ta=Pe===D.name;return a.jsxs("div",{className:`flex items-start gap-2 rounded-lg px-2.5 py-2 ${za?"bg-destructive/10 ring-1 ring-destructive/40":"bg-surface"}`,children:[a.jsx(Kc,{size:13,className:Ze?"mt-0.5 shrink-0 text-primary":"mt-0.5 shrink-0 text-muted-foreground"}),a.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[a.jsx("div",{className:"truncate text-[12px] font-semibold text-foreground",children:sn}),D.friendlyName&&a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium text-primary",children:t==="zh"?"自定义":"custom"})]}),qr.length>0&&a.jsx("div",{className:"flex min-w-0 flex-wrap gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground",children:qr.map(fi=>a.jsx("span",{className:"max-w-full truncate",children:fi},fi))}),(D.program||D.cwd)&&a.jsxs("div",{className:"grid min-w-0 gap-0.5 text-[10px] text-muted-foreground",children:[D.program&&a.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[a.jsx(Ew,{size:10,className:"shrink-0 text-muted-foreground/70"}),a.jsx("span",{className:"truncate text-foreground/75",children:D.program})]}),D.cwd&&a.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[a.jsx(hc,{size:10,className:"shrink-0 text-muted-foreground/70"}),a.jsx("span",{className:"truncate",children:D.cwd})]})]}),a.jsx("div",{className:"flex min-w-0 flex-wrap gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground/80",children:Vs.map(fi=>a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(uw,{size:10,className:"shrink-0 text-muted-foreground/60"}),fi]},fi))})]}),za?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",disabled:Ha,onClick:()=>{Jh(D.name)},className:"shrink-0 rounded-full bg-destructive/90 px-2.5 py-1 text-[11px] font-medium text-destructive-foreground transition hover:bg-destructive disabled:opacity-50",children:Ha?"…":e("settings.destroy")}),a.jsx("button",{type:"button",disabled:Ha,onClick:()=>{qn(null),we(null)},className:"shrink-0 rounded-full bg-surface-2 px-2.5 py-1 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated",children:e("common.cancel")})]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>{bt?Ro(bt.id):(Ge(D.name),xo({mode:"tmux",tmuxSessionName:D.name}))},disabled:ta,className:`shrink-0 inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition disabled:opacity-50 ${Ze?"bg-surface text-foreground hover:bg-surface-elevated":ta?"bg-primary/10 text-primary":"bg-primary/15 text-primary hover:bg-primary/25"}`,children:ta?a.jsxs(a.Fragment,{children:[a.jsx(_n,{size:10,className:"animate-spin"}),e("settings.attaching")]}):e(Ze?"settings.attached":"settings.attach")}),a.jsx("button",{type:"button",disabled:Ha,onClick:()=>{we(null),qn(D.name)},className:"shrink-0 inline-flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground transition hover:bg-destructive/15 hover:text-destructive","aria-label":`Kill tmux session ${D.name}`,children:a.jsx(ri,{size:12})})]})]},D.name)})]},S.key||"__ungrouped_tmux__")),H&&a.jsx("p",{className:"px-2 text-[11px] text-destructive",children:H})]}):a.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:Ir.reason||e("settings.installTmuxHint")})})]}),a.jsxs("button",{type:"button",onClick:()=>Ki(!0),className:"mt-2 flex w-full items-center justify-between gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(ib,{size:14,className:"text-muted-foreground"}),a.jsx("span",{className:"font-medium text-foreground",children:e("settings.keyboardToolbar")})]}),a.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[a.jsx("span",{children:e("settings.sessions",{n:Jn.length})}),a.jsx("span",{children:"›"})]})]}),a.jsxs("button",{type:"button",onClick:()=>Ca(!0),className:"mt-2 flex w-full items-center justify-between gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(ju,{size:14,className:"text-muted-foreground"}),a.jsx("span",{className:"font-medium text-foreground",children:e("settings.aiAgentDetection")})]}),a.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[a.jsx("span",{children:"hooks"}),a.jsx("span",{children:"›"})]})]}),a.jsxs("div",{className:"mt-3 flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.language")}),a.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:[{code:"en",label:"English"},{code:"zh",label:"中文"}].map(S=>{const D=t===S.code;return a.jsx("button",{type:"button",onClick:()=>r(S.code),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${D?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:S.label},S.code)})})]}),a.jsxs("button",{type:"button",onClick:async()=>{try{await p9()}catch{}window.dispatchEvent(new CustomEvent("auth:unauthorized"))},className:"mt-3 flex w-full items-center justify-center gap-2 rounded-xl bg-destructive/10 px-3 py-2.5 text-[13px] font-medium text-destructive transition hover:bg-destructive/20 active:scale-[0.98]",children:[a.jsx(db,{size:14}),e("settings.signOut")]})]})]})})]}),ji&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop bg-[var(--app-backdrop-soft)] backdrop-blur-sm cursor-default animate-fade-in",onClick:()=>{U(null),me(null),we(null)},"aria-label":e("common.close")}),a.jsxs("div",{className:`fixed z-menu-panel rounded-2xl bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in ${ne&&Mt?"":"inset-x-3 bottom-6 mx-auto max-w-sm sm:bottom-auto sm:top-[15%]"}`,style:ne&&Mt?{...Px(ne),paddingBottom:i}:{paddingBottom:i},children:[a.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.closeChooserTitle")}),a.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:d0}),a.jsx("div",{className:"mt-0.5 text-[11px] text-muted-foreground/80",children:e("tab.closeChooserDescription")})]}),a.jsxs("div",{className:"flex flex-col py-1",children:[a.jsxs("button",{type:"button",onClick:u0,className:"flex items-center gap-3 px-4 py-3 text-left text-[13px] text-destructive transition hover:bg-destructive/10",children:[a.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full bg-destructive/15 text-destructive",children:a.jsx(ri,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.confirmDestroySession")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.destroySessionHint")})]})]}),H&&a.jsx("p",{className:"px-4 py-2 text-[11px] text-destructive",children:H})]}),a.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:a.jsx("button",{type:"button",onClick:()=>{U(null),me(null),we(null)},className:"w-full rounded-full bg-surface-2 px-3 py-2 text-[12px] font-medium text-muted-foreground transition hover:bg-surface hover:text-foreground",children:e("common.cancel")})})]})]}),Nt&&(()=>{const S=Ct.find(mn=>mn.id===Nt);if(!S)return null;const D=Gt.get(S.id),{primary:ae}=Ho(S,D?.activeProgram??null,D?.cwd??null,oa),Ze=Mt,bt=Ze?Px(ct):{paddingBottom:i},Yt=Ze?"fixed z-menu-panel overflow-y-auto overflow-x-hidden rounded-lg bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in":"fixed inset-x-3 bottom-6 z-menu-panel mx-auto max-w-sm rounded-2xl bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in sm:bottom-auto sm:top-[15%]",Ar=Ze?"border-b border-border/15 px-3 py-2":"border-b border-border/15 px-4 py-3",sn=Ze?"flex items-center gap-2 px-3 py-2 text-left text-[12px] transition":"flex items-center gap-3 px-4 py-3 text-left text-[13px] transition",tn=Ze?"inline-flex h-6 w-6 items-center justify-center rounded-md":"inline-flex h-7 w-7 items-center justify-center rounded-full";return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:`fixed inset-0 z-menu-backdrop cursor-default animate-fade-in ${Ze?"bg-transparent":"bg-[var(--app-backdrop-soft)] backdrop-blur-sm"}`,onClick:er,"aria-label":"Close menu"}),a.jsxs("div",{className:Yt,style:bt,children:[a.jsxs("div",{className:Ar,children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),a.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:ae}),D?.cwd&&a.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/80",children:D.cwd})]}),a.jsxs("div",{className:"flex flex-col py-1",children:[a.jsxs("button",{type:"button",onClick:()=>{const mn=ct;er(),tr(mn),lt(S.id)},className:`${sn} text-foreground hover:bg-surface-2`,children:[a.jsx("span",{className:`${tn} bg-primary/15 text-primary`,children:a.jsx(sA,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.rename")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.renameHint")})]})]}),a.jsxs("button",{type:"button",disabled:!D?.cwd,onClick:()=>{Zh(S.id),er()},className:`${sn} ${D?.cwd?"text-foreground hover:bg-surface-2":"text-muted-foreground/50 cursor-not-allowed"}`,children:[a.jsx("span",{className:`${tn} bg-surface-2 text-muted-foreground`,children:a.jsx(ab,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.copyCwd")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.copyCwdHint")})]}),vt&&vt===D?.cwd&&a.jsx("span",{className:"ml-auto text-[11px] text-primary",children:e("tab.copied")})]}),(()=>{const mn=Np(S.id),Ii=mn??Fe;return a.jsxs("div",{className:`${sn} text-foreground`,children:[a.jsx("span",{className:`${tn} bg-surface-2 text-muted-foreground`,children:a.jsx(jA,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.fontSize")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.fontSizeHint")})]}),a.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[a.jsx("button",{type:"button",onClick:()=>{Fd(S.id,Ii-1),_r(qr=>qr+1)},className:"h-7 w-7 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95","aria-label":`${e("tab.fontSize")} -1`,children:"−"}),a.jsxs("span",{className:"w-8 text-center text-[11px] tabular-nums text-muted-foreground",children:[Ii,"px"]}),a.jsx("button",{type:"button",onClick:()=>{Fd(S.id,Ii+1),_r(qr=>qr+1)},className:"h-7 w-7 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95","aria-label":`${e("tab.fontSize")} +1`,children:"+"}),mn!==null&&a.jsx("button",{type:"button",onClick:()=>{Fd(S.id,null),_r(qr=>qr+1)},className:"ml-1 shrink-0 rounded-md px-1.5 py-1 text-[11px] text-primary transition hover:bg-primary/10",children:e("tab.fontSizeReset")})]})]})})(),D?.agentNativeSessionId&&D.agentStatus!=="working"&&D.agentStatus!=="waiting"&&D.terminalSessionId&&a.jsxs("button",{type:"button",onClick:()=>{const mn=D.terminalSessionId;mn&&(er(),gn(S.id,mn))},className:`${sn} text-foreground hover:bg-surface-2`,children:[a.jsx("span",{className:`${tn} bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)]`,children:a.jsx(sc,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"block font-medium",children:[e("tab.resumeAgent"),D.agent?.displayName?` · ${D.agent.displayName}`:""]}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.resumeAgentHint")})]})]}),a.jsx("div",{className:"my-1 border-t border-border/15"}),S.mode==="tmux"?a.jsxs("button",{type:"button",onClick:()=>{er(),bl(S.id)},className:`${sn} text-destructive hover:bg-destructive/10`,children:[a.jsx("span",{className:`${tn} bg-destructive/15 text-destructive`,children:a.jsx(ri,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.destroySession")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.destroySessionHint")})]})]}):a.jsxs("button",{type:"button",onClick:()=>{er(),zl({sessionId:S.id,source:"tab-menu",closeMode:"auto"})},className:`${sn} text-destructive hover:bg-destructive/10`,children:[a.jsx("span",{className:`${tn} bg-destructive/15 text-destructive`,children:a.jsx(Kn,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.close")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.closeHint")})]})]}),!Ze&&a.jsx("button",{type:"button",className:"flex items-center justify-center px-4 py-2 text-[11px] text-muted-foreground/80 transition hover:text-foreground",onClick:()=>{er()},children:e("tab.longPressTip")})]}),!Ze&&a.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:a.jsx("button",{type:"button",onClick:er,className:"w-full rounded-full bg-surface-2 px-3 py-2 text-[12px] font-medium text-muted-foreground transition hover:bg-surface hover:text-foreground",children:e("common.cancel")})})]})]})})(),ve&&jt&&Mt&&(()=>{const S=Ct.find(qr=>qr.id===ve);if(!S)return null;const D=Gt.get(S.id),{primary:ae}=Ho(S,D?.activeProgram??null,D?.cwd??null,oa,D?.shellTitle??null,D?.promptState??null),Ze=S.customName?S.name:ae,bt=qr=>{const Vs=qr.trim();Vs?Vs!==Ze&&Di(S.id,Vs):Bi(S.id),lt(null),tr(null)},Yt=300,Ar=160,sn=jt.x,tn=jt.y,mn=Math.min(Math.max(sn-Yt/2,12),window.innerWidth-Yt-12),Ii=tn+Ar+20>window.innerHeight?Math.max(tn-Ar-12,12):tn+12;return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop cursor-default animate-fade-in bg-transparent",onClick:()=>{lt(null),tr(null)},"aria-label":e("common.cancel")}),a.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":e("tab.rename"),className:"fixed z-menu-panel w-[300px] rounded-xl bg-surface-elevated border border-border/15 shadow-[0_12px_36px_var(--app-shadow-soft)] animate-fade-in",style:{left:`${mn}px`,top:`${Ii}px`},children:[a.jsxs("div",{className:"border-b border-border/15 px-3 py-2.5",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.rename")}),a.jsx("div",{className:"mt-0.5 truncate text-[13px] font-medium text-foreground",children:ae}),D?.cwd&&a.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/70",children:D.cwd})]}),a.jsxs("form",{className:"px-3 py-2.5",onSubmit:qr=>{qr.preventDefault();const Vs=new FormData(qr.currentTarget).get("session-name");bt(typeof Vs=="string"?Vs:"")},children:[a.jsx("input",{ref:qr=>{Me.current=qr,qr&&!Ut.current&&(Ut.current=!0,qr.focus({preventScroll:!0}),qr.select())},type:"text",name:"session-name",defaultValue:Ze,placeholder:e("tab.renamePlaceholder"),autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,className:"w-full rounded-lg bg-surface-2 px-3 py-2 text-[13px] leading-snug text-foreground outline-none ring-1 ring-primary/40 placeholder:text-muted-foreground/60 focus:ring-primary/70",onKeyDown:qr=>{qr.key==="Escape"&&(qr.stopPropagation(),lt(null),tr(null))}}),a.jsxs("div",{className:"mt-2.5 flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{lt(null),tr(null)},className:"flex-1 rounded-full bg-surface-2 px-3 py-1.5 text-[12px] font-medium text-muted-foreground transition hover:bg-surface hover:text-foreground",children:e("common.cancel")}),a.jsx("button",{type:"submit",className:"flex-1 rounded-full bg-primary px-3 py-1.5 text-[12px] font-semibold text-primary-foreground transition hover:bg-primary/90 active:scale-[0.97]",children:e("common.save")})]})]})]})]})})(),ve&&!Mt&&(()=>{const S=Ct.find(Yt=>Yt.id===ve);if(!S)return null;const D=Gt.get(S.id),{primary:ae}=Ho(S,D?.activeProgram??null,D?.cwd??null,oa,D?.shellTitle??null,D?.promptState??null),Ze=S.customName?S.name:ae,bt=Yt=>{const Ar=Yt.trim();Ar?Ar!==Ze&&Di(S.id,Ar):Bi(S.id),lt(null)};return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop cursor-default animate-fade-in bg-[var(--app-backdrop-soft)] backdrop-blur-sm",onClick:()=>lt(null),"aria-label":e("common.cancel")}),a.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":e("tab.rename"),className:"fixed inset-x-3 z-menu-panel mx-auto max-w-sm rounded-2xl bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in",style:{top:`calc(${n} + 3.5rem)`},children:[a.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),a.jsx("div",{className:"mt-0.5 text-[14px] font-medium text-foreground",children:e("tab.rename")})]}),a.jsxs("form",{className:"px-4 py-3",onSubmit:Yt=>{Yt.preventDefault();const Ar=new FormData(Yt.currentTarget).get("session-name");bt(typeof Ar=="string"?Ar:"")},children:[a.jsx("input",{ref:Yt=>{Me.current=Yt,Yt&&!Ut.current&&(Ut.current=!0,Yt.focus({preventScroll:!0}),Yt.select())},type:"text",name:"session-name",defaultValue:Ze,placeholder:e("tab.renamePlaceholder"),autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,enterKeyHint:"done",className:"w-full rounded-lg bg-surface-2 px-3 py-2.5 text-[16px] leading-snug text-foreground outline-none ring-1 ring-primary/40 placeholder:text-muted-foreground/60 focus:ring-primary/70",onKeyDown:Yt=>{Yt.key==="Escape"&&(Yt.stopPropagation(),lt(null))}}),a.jsxs("div",{className:"mt-3 flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>lt(null),className:"flex-1 rounded-full bg-surface-2 px-3 py-2 text-[12px] font-medium text-muted-foreground transition hover:bg-surface hover:text-foreground",children:e("common.cancel")}),a.jsx("button",{type:"submit",className:"flex-1 rounded-full bg-primary/20 px-3 py-2 text-[12px] font-medium text-primary transition hover:bg-primary/30",children:e("common.save")})]})]})]})]})})(),va&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button","aria-label":e("common.close"),className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:()=>wa(!1)}),a.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"local-access-title",className:"fixed inset-x-3 top-[max(1.5rem,env(safe-area-inset-top,0px))] bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto flex max-w-xl flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface sm:top-[10%] sm:bottom-auto sm:max-h-[80vh]",children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 p-4",children:[a.jsx("h2",{id:"local-access-title",className:"section-title",children:e("settings.localAccess")}),a.jsx("button",{autoFocus:!0,type:"button","aria-label":e("common.close"),onClick:()=>wa(!1),className:"rounded-full bg-surface-2 p-2 text-muted-foreground",children:a.jsx(Kn,{size:18})})]}),a.jsxs("div",{className:"overflow-y-auto overscroll-contain p-4",children:[a.jsx(eT,{state:qe,onCopy:S=>{fo(S,"setup")},copied:Ie==="setup"}),a.jsxs("div",{className:"mt-3 flex items-center overflow-hidden rounded-lg bg-surface ring-1 ring-border/10 focus-within:ring-primary/40",children:[a.jsx("input",{value:oe,onChange:S=>Oe(S.target.value.toLowerCase()),className:"min-w-0 flex-1 bg-transparent px-2.5 py-2 text-[12px] text-foreground outline-none",placeholder:"jovn",spellCheck:!1}),a.jsx("span",{className:"shrink-0 border-l border-border/10 px-2.5 py-2 text-[11px] text-muted-foreground",children:".termdock.local"})]}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[a.jsx("button",{type:"button",disabled:et,onClick:()=>{Li()},className:"rounded-full bg-primary/15 px-3 py-1.5 text-[11px] font-medium text-primary transition hover:bg-primary/25 disabled:opacity-50",children:e(et?"settings.saving":"common.save")}),a.jsx("button",{type:"button",disabled:et,onClick:()=>{ho()},className:"rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-50",children:e("settings.resetAutoName")})]}),a.jsxs("div",{className:"mt-3 space-y-1.5 text-[11px]",children:[qe.url&&a.jsxs("button",{type:"button",onClick:()=>{fo(qe.url,"lan")},className:"flex w-full items-center justify-between gap-2 rounded-lg bg-surface px-2.5 py-2 text-left text-muted-foreground transition hover:bg-surface-elevated",children:[a.jsxs("span",{className:"min-w-0 truncate",children:["Branded: ",qe.url]}),a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium",children:Ie==="lan"?"Copied":e("common.copy")})]}),qe.interfaces.length>0&&a.jsxs("details",{className:"rounded-lg bg-surface px-2.5 py-2 text-muted-foreground",open:!1,children:[a.jsx("summary",{className:"cursor-pointer text-[11px] font-medium text-foreground/80",children:"IP fallback addresses"}),a.jsx("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-2",children:qe.interfaces.map(S=>{const D=S.url??`${qe.httpsEnabled?"https":"http"}://${S.address}:9834`;return a.jsxs("div",{className:"rounded-lg bg-surface-2 p-2",children:[a.jsxs("div",{className:"text-[11px] font-medium text-foreground/85",children:[S.label," (",S.name,")"]}),a.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:S.address}),S.qrDataUrl&&a.jsx("div",{className:"mt-2 inline-block rounded-lg bg-[var(--background)] p-1.5",children:a.jsx("img",{src:S.qrDataUrl,alt:`QR code for ${D}`,className:"h-28 w-28"})}),a.jsxs("button",{type:"button",onClick:()=>{fo(D,`ip-${S.address}`)},className:"mt-2 flex w-full items-center justify-between gap-2 rounded-md bg-surface px-2 py-1.5 text-left text-[11px] transition hover:bg-surface-elevated",children:[a.jsx("span",{className:"min-w-0 truncate",children:D}),a.jsx("span",{className:"shrink-0 text-[10px]",children:Ie===`ip-${S.address}`?"Copied":e("common.copy")})]})]},`${S.name}-${S.address}`)})})]}),a.jsxs("div",{className:"text-muted-foreground",children:[qe.httpsEnabled?e("settings.httpsActive"):e("settings.httpsInactive"),!qe.caAvailable&&` · ${e("settings.caMissing")}`]}),qe.reason&&a.jsx("div",{className:"text-[color:var(--warning)]",children:qe.reason}),Be&&a.jsx("div",{className:"text-destructive",children:Be})]})]})]})]}),hi&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>Xi(!1)}),a.jsxs("div",{className:"fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,env(safe-area-inset-top,0px))] bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto flex max-w-xl flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:top-[10%] sm:bottom-auto sm:max-h-[80vh]",children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"ui-kicker",children:e("settings.notifications")}),a.jsx("h2",{className:"section-title mt-1",children:e("settings.notificationsTitle")})]}),a.jsx("button",{type:"button",onClick:()=>Xi(!1),className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":"Close notifications settings",children:a.jsx(Kn,{size:18})})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:[a.jsx("p",{className:"text-[12px] leading-relaxed text-muted-foreground",children:e("settings.notificationsPageHint")}),a.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsMaster")}),a.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:te==="denied"?e("settings.notificationsDenied"):od()?e("settings.notificationsMasterHint"):e("settings.notificationsUnsupported")}),od()&&!m9()&&a.jsx("div",{className:"mt-1.5 text-[11px] leading-relaxed text-[var(--warning)]",children:e("settings.notificationsIOSInstallHint")})]}),a.jsx("button",{type:"button",onClick:()=>{nt()},disabled:!od()||te==="denied",className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":E,children:a.jsx(qo,{checked:E,disabled:!od()||te==="denied"})})]}),a.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-[11px]",children:[a.jsxs("span",{className:`rounded-full px-2 py-0.5 ${te==="granted"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:[e("settings.notificationsPermission"),": ",So()?e("settings.notificationsPermissionSystem"):te]}),a.jsx("button",{type:"button",disabled:!E||te!=="granted"||Cs==="checking",onClick:()=>{$t()},className:"rounded-full bg-surface px-3 py-1.5 font-medium text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:e(Cs==="checking"?"settings.notificationsTestChecking":"settings.notificationsTest")}),So()?.openNotificationSettings&&a.jsx("button",{type:"button",onClick:()=>{So()?.openNotificationSettings?.()},className:"rounded-full bg-surface px-3 py-1.5 font-medium text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:e("settings.notificationsOpenSystemSettings")})]}),Cs!=="idle"&&Cs!=="checking"&&a.jsx("div",{className:`mt-2 text-[11px] leading-relaxed ${Cs==="delivered"?"text-primary":"text-[var(--warning)]"}`,children:e(Cs==="delivered"?"settings.notificationsTestDelivered":"settings.notificationsTestFailed")})]}),a.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[a.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAlertStyle")}),a.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAlertStyleHint")}),a.jsx("div",{className:"mt-3 grid grid-cols-3 gap-1 rounded-xl bg-surface p-1",children:[["normal",e("settings.notificationsStyleNormal"),e("settings.notificationsStyleNormalHint")],["quiet",e("settings.notificationsStyleQuiet"),e("settings.notificationsStyleQuietHint")],["persistent",e("settings.notificationsStylePersistent"),e("settings.notificationsStylePersistentHint")]].map(([S,D,ae])=>{const Ze=V===S;return a.jsxs("button",{type:"button",disabled:!E,onClick:()=>Mn(S),className:`min-w-0 rounded-lg px-2 py-2 text-left transition ${Ze&&E?"bg-primary/15 text-primary":E?"text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"cursor-not-allowed text-muted-foreground/40"}`,title:ae,children:[a.jsx("span",{className:"block truncate text-[11px] font-semibold",children:D}),a.jsx("span",{className:"mt-0.5 block truncate text-[9px] opacity-80",children:ae})]},S)})})]}),a.jsxs("div",{className:"mt-4",children:[a.jsx("div",{className:"ui-kicker",children:e("settings.notificationsEvents")}),a.jsxs("div",{className:"mt-2 rounded-2xl bg-surface-2 p-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAiFinished")}),a.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAiFinishedHint")})]}),a.jsx("button",{type:"button",disabled:!E,onClick:()=>mr(!M),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":M&&E,children:a.jsx(qo,{checked:M&&E,disabled:!E})})]}),a.jsxs("div",{className:"mt-3 flex items-start justify-between gap-3 border-t border-border/10 pt-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsSessionExited")}),a.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsSessionExitedHint")})]}),a.jsx("button",{type:"button",disabled:!E,onClick:()=>en(!j),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":j&&E,children:a.jsx(qo,{checked:j&&E,disabled:!E})})]})]}),a.jsx("p",{className:"mt-2 text-[10px] text-muted-foreground",children:e("settings.notificationsFutureHint")})]})]})]})]}),Ws&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>Ki(!1)}),a.jsxs("div",{className:"fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,env(safe-area-inset-top,0px))] bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto flex max-w-4xl flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)]",children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"ui-kicker",children:e("settings.mobileKeyboard")}),a.jsx("h2",{className:"section-title mt-1",children:e("settings.toolbarPresets")})]}),a.jsx("button",{type:"button",onClick:()=>Ki(!1),className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":"Close toolbar presets",children:a.jsx(Kn,{size:18})})]}),a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:a.jsx(jP,{presets:Jn,selectedPresetId:Qi,onSelectPreset:go,onUpdatePreset:(S,D)=>{ms(ae=>Uc(ae.map(Ze=>Ze.id===S?D(Ze):Ze)))},onAddPreset:()=>{const S=`preset-${Date.now()}`;ms(D=>Uc([...D,{id:S,label:`Preset ${D.length}`,programs:[],includeAlt:!1,rowLayout:[3,3],actions:[],showOnDesktop:!1}])),go(S)},onRemovePreset:S=>{ms(D=>Uc(D.filter(ae=>ae.id!==S)))},onResetDefaults:()=>{ms(Cu()),go("default")}})})]})]}),Ua&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>Ca(!1)}),a.jsxs("div",{className:"fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,env(safe-area-inset-top,0px))] bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto flex max-w-4xl flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)]",children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"ui-kicker",children:e("settings.aiAgentDetection")}),a.jsx("h2",{className:"section-title mt-1",children:e("settings.detectionRules")})]}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("button",{type:"button",onClick:()=>Ca(!1),className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":"Close agent rules",children:a.jsx(Kn,{size:18})})})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:[a.jsx("p",{className:"mb-4 text-[11px] text-muted-foreground",children:e("settings.agentHooksHint")}),a.jsx(OP,{}),a.jsxs("div",{className:"mt-6 border-t border-border/15 pt-4",children:[a.jsx("div",{className:"ui-kicker",children:e("settings.programLabelResolution")}),a.jsx("h3",{className:"mt-1 text-sm font-semibold text-foreground",children:e("settings.rawCommandMapping")}),a.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:e("settings.rawCommandMappingHint")}),a.jsx("div",{className:"mt-3 space-y-2 rounded-xl bg-surface-2 p-3",children:Ct.map(S=>{const D=Gt.get(S.id),ae=D?.activeProgramRaw??null,Ze=D?.activeProgram??null;return a.jsxs("div",{className:"rounded-lg bg-surface/60 px-2.5 py-2",children:[a.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:S.name}),a.jsxs("div",{className:"mt-0.5 text-[11px] text-foreground",children:[a.jsx("span",{className:"text-muted-foreground",children:"display:"})," ",Ze||"—"]}),a.jsxs("div",{className:"mt-0.5 break-all font-mono text-[10px] text-muted-foreground",children:[a.jsx("span",{className:"text-muted-foreground/80",children:"raw:"})," ",ae||"—"]})]},`raw-${S.id}`)})}),a.jsxs("div",{className:"mt-3 space-y-3",children:[[{key:"genericProgramNames",label:e("settings.genericProgramNames"),hint:e("settings.genericProgramNamesHint")},{key:"wrapperScriptNames",label:e("settings.wrapperScriptNames"),hint:e("settings.wrapperScriptNamesHint")},{key:"shellNames",label:e("settings.shellNamesConfig"),hint:e("settings.shellNamesHint")}].map(({key:S,label:D,hint:ae})=>a.jsxs("div",{children:[a.jsx("div",{className:"mb-0.5 text-[11px] font-medium text-foreground",children:D}),a.jsx("div",{className:"text-[10px] text-muted-foreground",children:ae}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[z[S].map(Ze=>a.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded-full bg-surface-2 px-2 py-0.5 text-[11px] font-mono text-foreground",children:[Ze,a.jsx("button",{type:"button",onClick:()=>{const bt={...z,[S]:z[S].filter(Yt=>Yt!==Ze)};Ne(bt),S==="shellNames"&&(oa=new Set(bt.shellNames)),qm(bt).catch(()=>{})},className:"ml-0.5 text-muted-foreground hover:text-destructive",children:"×"})]},Ze)),a.jsx("input",{placeholder:e("settings.addTag"),className:"w-16 rounded bg-surface px-1.5 py-0.5 text-[11px] font-mono",onKeyDown:Ze=>{if(Ze.key!=="Enter")return;const bt=Ze.target.value.trim().toLowerCase();if(!bt||z[S].includes(bt))return;const Yt={...z,[S]:[...z[S],bt]};Ne(Yt),S==="shellNames"&&(oa=new Set(Yt.shellNames)),Ze.target.value="",qm(Yt).catch(()=>{})}})]})]},S)),a.jsx("button",{type:"button",onClick:()=>{g9().then(S=>{Ne(S),oa=new Set(S.shellNames)}).catch(()=>{})},className:"rounded-full bg-surface-2 px-3 py-1 text-[11px] text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:e("settings.resetDefaults")})]}),a.jsxs("div",{className:"mt-3",children:[a.jsx("div",{className:"mb-1 text-[11px] font-medium text-foreground",children:e("settings.customRules")}),gt.map((S,D)=>a.jsx("div",{className:"mb-2 rounded-lg bg-surface-2 p-2.5",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("input",{type:"checkbox",checked:S.enabled!==!1,onChange:ae=>{const Ze=gt.map((bt,Yt)=>Yt===D?{...bt,enabled:ae.target.checked}:bt);De(Ze),Bn(aa,Ze),L(!0),Tc(Ze).then(bt=>{De(bt),Bn(aa,bt)}).catch(()=>{}).finally(()=>L(!1))}}),a.jsxs("select",{value:S.matchType,onChange:ae=>{const Ze=gt.map((bt,Yt)=>Yt===D?{...bt,matchType:ae.target.value}:bt);De(Ze),Bn(aa,Ze),L(!0),Tc(Ze).then(bt=>{De(bt),Bn(aa,bt)}).catch(()=>{}).finally(()=>L(!1))},className:"rounded bg-surface px-2 py-1 text-[11px]",children:[a.jsx("option",{value:"includes",children:"includes"}),a.jsx("option",{value:"exact",children:"exact"}),a.jsx("option",{value:"prefix",children:"prefix"}),a.jsx("option",{value:"regex",children:"regex"})]}),a.jsx("input",{value:S.pattern,onChange:ae=>{const Ze=gt.map((bt,Yt)=>Yt===D?{...bt,pattern:ae.target.value}:bt);De(Ze),Bn(aa,Ze)},onBlur:()=>{L(!0),Tc(gt).then(ae=>{De(ae),Bn(aa,ae)}).catch(()=>{}).finally(()=>L(!1))},placeholder:"pattern",className:"min-w-[180px] flex-1 rounded bg-surface px-2 py-1 text-[11px] font-mono"}),a.jsx("input",{value:S.output,onChange:ae=>{const Ze=gt.map((bt,Yt)=>Yt===D?{...bt,output:ae.target.value}:bt);De(Ze),Bn(aa,Ze)},onBlur:()=>{L(!0),Tc(gt).then(ae=>{De(ae),Bn(aa,ae)}).catch(()=>{}).finally(()=>L(!1))},placeholder:"output",className:"w-28 rounded bg-surface px-2 py-1 text-[11px]"}),a.jsx("button",{type:"button",onClick:()=>{const ae=gt.filter((Ze,bt)=>bt!==D);De(ae),Bn(aa,ae),L(!0),Tc(ae).then(Ze=>{De(Ze),Bn(aa,Ze)}).catch(()=>{}).finally(()=>L(!1))},className:"rounded bg-surface px-2 py-1 text-[11px] text-muted-foreground hover:text-destructive",children:e("common.delete")})]})},S.id)),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{const S=[...gt,{id:`rule-${Date.now()}`,enabled:!0,priority:100,matchType:"includes",pattern:"",output:""}];De(S),Bn(aa,S),L(!0),Tc(S).then(D=>{De(D),Bn(aa,D)}).catch(()=>{}).finally(()=>L(!1))},className:"rounded-full bg-primary/15 px-3 py-1.5 text-[11px] font-medium text-primary hover:bg-primary/25",children:e("settings.addRule")}),a.jsx("button",{type:"button",onClick:()=>{L(!0),x9().then(S=>{De(S),Bn(aa,S)}).catch(()=>{}).finally(()=>L(!1))},className:"rounded-full bg-surface-2 px-3 py-1.5 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:e("settings.resetDefaults")}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:Qr?e("settings.saving"):yt?`${gt.length} rules`:"…"})]})]})]})]})]})]}),J&&a.jsx(NP,{isOpen:J,onClose:()=>Qe(!1)}),!Ji&&a.jsx(cx,{isOpen:Xr,drawerWidthPx:Mi,onClose:()=>un("left-sidebar"),onOpen:fa,sessions:Ct,activeSessionId:ft,sessionStates:Gt,onNewSession:S=>xo(S),recoverableTmuxSessions:m0,recoverableTmuxSessionsLoading:zr,onRefreshRecoverableTmuxSessions:()=>{el()},onCloseSession:bl,onSplitSession:Gu,onCloseSplit:S=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:S})),onRemoveFromSplit:S=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:S})),splitWorkspaces:Nr,onSetSplitLayout:Vu,onReorderSplitWorkspace:qu,onRenameSplitWorkspace:yc,onCombineSplitSessions:c0,onReorderSessions:po,onSessionMenu:gl,onOpenSettings:ga,onJumpToNextAttention:_a.length>0?Es:void 0,onOpenQuota:()=>Qe(!0),updateState:Ue,updateActionPending:K,onConfirmUpdateRestart:wn,onRetryUpdate:sr,serverHealthState:fe,tmuxAvailable:Ir.available,defaultSessionMode:zs,onTogglePinned:Mt?co:void 0}),!tl&&a.jsx(ux,{isOpen:Wr,sessionId:ft,drawerWidthPx:xs,onClose:()=>un("right-sidebar"),onOpen:Is,rightSidebarFilePreviewOpen:ai,rightSidebarFilePreviewCloseSignal:je,onOpenRightSidebarFilePreview:Pa,onCloseRightSidebarFilePreview:Oa,rightSidebarRepoPickerOpen:dt,rightSidebarRepoPickerCloseSignal:Xt,onOpenRightSidebarRepoPicker:uo,onCloseRightSidebarRepoPicker:ml,markdownOutlineOpen:Bt,markdownOutlineCloseSignal:lr,onOpenMarkdownOutline:Ko,onCloseMarkdownOutline:Io,markdownImageLightboxOpen:Jt,markdownImageLightboxCloseSignal:X,onOpenMarkdownImageLightbox:Fs,onCloseMarkdownImageLightbox:Eo,onTogglePinned:Mt?pa:void 0}),be&&!l&&a.jsx("button",{type:"button",onClick:ps,className:"fixed inset-0 z-toast flex cursor-default items-center justify-center bg-[var(--app-backdrop-soft)] px-6 text-left backdrop-blur-[1px]","aria-label":t==="zh"?"继续使用 Termdock":"Continue using Termdock",children:a.jsxs("div",{className:"max-w-[18rem] rounded-2xl border border-border/15 bg-surface/95 px-5 py-4 text-center shadow-[0_18px_50px_var(--app-shadow-strong)] backdrop-blur animate-fade-in",children:[a.jsx("div",{className:"text-[14px] font-semibold text-foreground",children:t==="zh"?"建议使用 Home":"Use Home instead"}),a.jsx("div",{className:"mt-1.5 text-[12px] leading-relaxed text-muted-foreground",children:t==="zh"?"按 Home 退后台,点任意位置继续。":"Use Home to leave. Tap anywhere to continue."}),a.jsx("div",{className:"mt-3 text-[11px] font-medium text-muted-foreground/80",children:t==="zh"?"轻点关闭提示":"Tap to dismiss"})]})}),kt&&a.jsxs("div",{className:`fixed inset-x-3 bottom-4 z-toast mx-auto flex max-w-md items-center gap-2 rounded-xl border px-4 py-3 text-[12px] shadow-lg animate-fade-in ${kt.tone==="success"?"border-[rgb(var(--success-rgb)_/_0.24)] bg-surface-elevated text-foreground":"border-destructive/30 bg-surface-elevated text-destructive"}`,role:kt.tone==="error"?"alert":"status",children:[kt.tone==="success"?a.jsx(sc,{size:14,className:"shrink-0 text-[color:var(--success)]"}):a.jsx(oh,{size:14,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1",children:kt.message}),a.jsx("button",{type:"button",onClick:()=>ue(null),className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":e("common.close"),children:a.jsx(Kn,{size:12})})]}),c&&a.jsxs(a.Fragment,{children:[!Mt&&a.jsx(tT,{onClose:()=>h(!1)}),a.jsxs("div",{className:"fixed bottom-0 left-0 right-0 z-toast hidden max-h-48 overflow-y-auto border-t border-border/15 bg-surface p-3 animate-fade-in md:block",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h4",{className:"ui-kicker",children:"Debug Info"}),a.jsx("button",{type:"button",onClick:()=>h(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Close"})]}),a.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify(Qt,null,2)})]})]})]}),Zu=Wn?null:a.jsx(v9,{className:"z-modal-panel",status:"正在恢复终端…"});return Mt?a.jsxs("div",{className:"w-screen h-full flex flex-row",children:[Ji&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{width:An,flexShrink:0,height:"100%"},children:a.jsx(cx,{isOpen:Xr,drawerWidthPx:An,onClose:Qa,onOpen:fa,sessions:Ct,activeSessionId:ft,sessionStates:Gt,onNewSession:S=>xo(S),recoverableTmuxSessions:m0,recoverableTmuxSessionsLoading:zr,onRefreshRecoverableTmuxSessions:()=>{el()},onCloseSession:bl,onSplitSession:Gu,onCloseSplit:S=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:S})),onRemoveFromSplit:S=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:S})),splitWorkspaces:Nr,onSetSplitLayout:Vu,onReorderSplitWorkspace:qu,onRenameSplitWorkspace:yc,onCombineSplitSessions:c0,onReorderSessions:po,onSessionMenu:gl,onOpenSettings:ga,onJumpToNextAttention:_a.length>0?Es:void 0,onOpenQuota:()=>Qe(!0),updateState:Ue,updateActionPending:K,onConfirmUpdateRestart:wn,onRetryUpdate:sr,serverHealthState:fe,tmuxAvailable:Ir.available,defaultSessionMode:zs,pinned:!0,onTogglePinned:co})}),a.jsx("div",{role:"separator",tabIndex:-1,className:"shrink-0 w-[5px] h-full cursor-col-resize bg-border/10 hover:bg-primary/30 active:bg-primary/50 transition-colors",onMouseDown:Cn})]}),a.jsxs("div",{className:"relative flex-1 min-w-0 h-full overflow-hidden",children:[y0,tl&&a.jsxs("div",{className:"absolute inset-y-0 right-0 z-20 flex",style:{width:Hl},children:[a.jsx("div",{role:"separator",tabIndex:-1,className:"h-full w-[5px] shrink-0 cursor-col-resize bg-border/10 transition-colors hover:bg-primary/30 active:bg-primary/50",onMouseDown:_i}),a.jsx("div",{style:{width:yl,flexShrink:0,height:"100%"},children:a.jsx(ux,{isOpen:!0,sessionId:ft,drawerWidthPx:yl,onClose:Yi,onOpen:Is,pinned:!0,onTogglePinned:pa,rightSidebarFilePreviewOpen:ai,rightSidebarFilePreviewCloseSignal:je,onOpenRightSidebarFilePreview:Pa,onCloseRightSidebarFilePreview:Oa,rightSidebarRepoPickerOpen:dt,rightSidebarRepoPickerCloseSignal:Xt,onOpenRightSidebarRepoPicker:uo,onCloseRightSidebarRepoPicker:ml,markdownOutlineOpen:Bt,markdownOutlineCloseSignal:lr,onOpenMarkdownOutline:Ko,onCloseMarkdownOutline:Io,markdownImageLightboxOpen:Jt,markdownImageLightboxCloseSignal:X,onOpenMarkdownImageLightbox:Fs,onCloseMarkdownImageLightbox:Eo})})]})]}),a.jsx(Sx,{sessionId:ft}),Zu]}):a.jsxs(a.Fragment,{children:[y0,a.jsx(Sx,{sessionId:ft}),Zu]})}const eF=Object.freeze(Object.defineProperty({__proto__:null,default:dO},Symbol.toStringTag,{value:"Module"}));export{cu as A,f3 as B,Nj as C,yu as D,wx as E,sb as F,Rj as G,Mw as H,Hk as I,XO as J,dx as K,ab as L,Pw as M,Sp as N,JO as O,rA as P,Bj as Q,rs as R,Mh as S,bL as T,gb as U,WA as V,AP as a,eF as b,F9 as c,P9 as d,tb as e,bu as f,mw as g,ej as h,_1 as i,$w as j,Ww as k,sA as l,aA as m,vu as n,wu as o,Bp as p,cb as q,xA as r,wA as s,V6 as t,IA as u,DA as v,ri as w,h3 as x,KO as y,T2 as z};
|