termdock 1.4.281 → 1.4.283
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/App-DIYNv8nX.js +157 -0
- package/dist/client/assets/App-DIYNv8nX.js.br +0 -0
- package/dist/client/assets/App-DIYNv8nX.js.gz +0 -0
- package/dist/client/assets/{ChangeWalkthroughPanel-CpJIxJoa.js → ChangeWalkthroughPanel-D3P0LWfU.js} +1 -1
- package/dist/client/assets/ChangeWalkthroughPanel-D3P0LWfU.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-D3P0LWfU.js.gz +0 -0
- package/dist/client/assets/{DagPlayground-DsZ_TzMA.js → DagPlayground-DHLTKfYe.js} +1 -1
- package/dist/client/assets/DagPlayground-DHLTKfYe.js.br +0 -0
- package/dist/client/assets/DagPlayground-DHLTKfYe.js.gz +0 -0
- package/dist/client/assets/{DiffLab-DVzd5Djx.js → DiffLab-DyapQhFp.js} +1 -1
- package/dist/client/assets/DiffLab-DyapQhFp.js.br +0 -0
- package/dist/client/assets/DiffLab-DyapQhFp.js.gz +0 -0
- package/dist/client/assets/{DiffReview-5MLGwl3s.js → DiffReview-CtlVXUuM.js} +1 -1
- package/dist/client/assets/DiffReview-CtlVXUuM.js.br +0 -0
- package/dist/client/assets/DiffReview-CtlVXUuM.js.gz +0 -0
- package/dist/client/assets/{DiffReviewLab-B53N-9cX.js → DiffReviewLab-CcATFm0V.js} +1 -1
- package/dist/client/assets/DiffReviewLab-CcATFm0V.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-CcATFm0V.js.gz +0 -0
- package/dist/client/assets/{DiffViewer-PrcRXQq0.js → DiffViewer-DbAcE-rO.js} +2 -2
- package/dist/client/assets/DiffViewer-DbAcE-rO.js.br +0 -0
- package/dist/client/assets/DiffViewer-DbAcE-rO.js.gz +0 -0
- package/dist/client/assets/{ModelPreview-C98dbuUF.js → ModelPreview-DFsugreu.js} +161 -161
- package/dist/client/assets/ModelPreview-DFsugreu.js.br +0 -0
- package/dist/client/assets/ModelPreview-DFsugreu.js.gz +0 -0
- package/dist/client/assets/{RightSidebar-B52JGGs9.js → RightSidebar-BljTZjyo.js} +39 -39
- package/dist/client/assets/RightSidebar-BljTZjyo.js.br +0 -0
- package/dist/client/assets/RightSidebar-BljTZjyo.js.gz +0 -0
- package/dist/client/assets/{abnfDiagram-VCTEODGH-B5gA9_Ty.js → abnfDiagram-VCTEODGH-C6Qn78Kl.js} +1 -1
- package/dist/client/assets/abnfDiagram-VCTEODGH-C6Qn78Kl.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-C6Qn78Kl.js.gz +0 -0
- package/dist/client/assets/app-BT_37rUb.js +35 -0
- package/dist/client/assets/app-BT_37rUb.js.br +0 -0
- package/dist/client/assets/app-BT_37rUb.js.gz +0 -0
- package/dist/client/assets/{arc-Bq6Y_399.js → arc-DlrdXzuL.js} +1 -1
- package/dist/client/assets/arc-DlrdXzuL.js.br +0 -0
- package/dist/client/assets/arc-DlrdXzuL.js.gz +0 -0
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-D7bXmRrP.js → architectureDiagram-5GKGNRK7-yDm6ZlLB.js} +1 -1
- package/dist/client/assets/architectureDiagram-5GKGNRK7-yDm6ZlLB.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-yDm6ZlLB.js.gz +0 -0
- package/dist/client/assets/{blockDiagram-I7D4REHJ-vmiTllrb.js → blockDiagram-I7D4REHJ-CQ_ev6HF.js} +1 -1
- package/dist/client/assets/blockDiagram-I7D4REHJ-CQ_ev6HF.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-CQ_ev6HF.js.gz +0 -0
- package/dist/client/assets/{c4Diagram-7LVT6UL2-C6ThUVSU.js → c4Diagram-7LVT6UL2-Xc0eRnWn.js} +1 -1
- package/dist/client/assets/c4Diagram-7LVT6UL2-Xc0eRnWn.js.br +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-Xc0eRnWn.js.gz +0 -0
- package/dist/client/assets/channel-JBVMoCs6.js +1 -0
- package/dist/client/assets/{chunk-2Q5K7J3B-DR-yB9IL.js → chunk-2Q5K7J3B-DOea--M6.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-B1nK9YvE.js → chunk-5VM5RSS4-5BTB5aOY.js} +1 -1
- package/dist/client/assets/{chunk-F27PBJKO-C7W0s-qY.js → chunk-F27PBJKO-D4bPuUCL.js} +1 -1
- package/dist/client/assets/chunk-F27PBJKO-D4bPuUCL.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-D4bPuUCL.js.gz +0 -0
- package/dist/client/assets/{chunk-IMKFNOWR-CTjPfIKT.js → chunk-IMKFNOWR-CcpsYCGR.js} +1 -1
- package/dist/client/assets/chunk-IMKFNOWR-CcpsYCGR.js.br +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-CcpsYCGR.js.gz +0 -0
- package/dist/client/assets/{chunk-JWPE2WC7-DdFiULME.js → chunk-JWPE2WC7-DrVzbPfl.js} +1 -1
- package/dist/client/assets/{chunk-POPQ4Y6H-7D3Xkf9O.js → chunk-POPQ4Y6H-D2vQ6I_d.js} +1 -1
- package/dist/client/assets/{chunk-SVP7TREG-CCuDpBKr.js → chunk-SVP7TREG-BK9PycPu.js} +1 -1
- package/dist/client/assets/chunk-SVP7TREG-BK9PycPu.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-BK9PycPu.js.gz +0 -0
- package/dist/client/assets/{chunk-TICWLB2K-DtYX2TNH.js → chunk-TICWLB2K-LPhjhi7S.js} +1 -1
- package/dist/client/assets/chunk-TICWLB2K-LPhjhi7S.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-LPhjhi7S.js.gz +0 -0
- package/dist/client/assets/{chunk-XXDRQBXY-DhzCdSBY.js → chunk-XXDRQBXY-qujR76f5.js} +1 -1
- package/dist/client/assets/classDiagram-ZZMXUADV-BkraiclO.js +1 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-BkraiclO.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-CyoiG3NB.js → cose-bilkent-JH36ORCC-BArSIiIO.js} +1 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-BArSIiIO.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-BArSIiIO.js.gz +0 -0
- package/dist/client/assets/{cynefin-OW5HDTMX-SeWSNPvK.js → cynefin-OW5HDTMX-CCs1or7w.js} +1 -1
- package/dist/client/assets/cynefin-OW5HDTMX-CCs1or7w.js.br +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-CCs1or7w.js.gz +0 -0
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-C6Z9w461.js → cynefinDiagram-5FMLGOSQ-CZtiCwpH.js} +1 -1
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-CZtiCwpH.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-CZtiCwpH.js.gz +0 -0
- package/dist/client/assets/{dagre-GXQ25YYZ-DgQ7oSI3.js → dagre-GXQ25YYZ-sxi6dz48.js} +1 -1
- package/dist/client/assets/dagre-GXQ25YYZ-sxi6dz48.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-sxi6dz48.js.gz +0 -0
- package/dist/client/assets/{diagram-S7CK7UJ4-BrFJNnZh.js → diagram-S7CK7UJ4-CqA9RxCi.js} +1 -1
- package/dist/client/assets/diagram-S7CK7UJ4-CqA9RxCi.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-CqA9RxCi.js.gz +0 -0
- package/dist/client/assets/{diagram-UQ7AKVKN-DW2EFMOu.js → diagram-UQ7AKVKN-DI6HGWgF.js} +1 -1
- package/dist/client/assets/diagram-UQ7AKVKN-DI6HGWgF.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-DI6HGWgF.js.gz +0 -0
- package/dist/client/assets/{diagram-VSXAHHWV-C5lTJcKk.js → diagram-VSXAHHWV-CMZi8lNh.js} +1 -1
- package/dist/client/assets/diagram-VSXAHHWV-CMZi8lNh.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-CMZi8lNh.js.gz +0 -0
- package/dist/client/assets/{diagram-VX7I27RA-CObqcJqB.js → diagram-VX7I27RA-C7C5Wauj.js} +1 -1
- package/dist/client/assets/diagram-VX7I27RA-C7C5Wauj.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-C7C5Wauj.js.gz +0 -0
- package/dist/client/assets/{diagram-Z3DM3KII-br3lGnhW.js → diagram-Z3DM3KII-5gZWUza2.js} +1 -1
- package/dist/client/assets/diagram-Z3DM3KII-5gZWUza2.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-5gZWUza2.js.gz +0 -0
- package/dist/client/assets/{ebnfDiagram-PWID7BFC-CkXxS9Pq.js → ebnfDiagram-PWID7BFC-_UeIqZQ9.js} +1 -1
- package/dist/client/assets/ebnfDiagram-PWID7BFC-_UeIqZQ9.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-_UeIqZQ9.js.gz +0 -0
- package/dist/client/assets/{erDiagram-RLTQ6QDP-CMBJEKp-.js → erDiagram-RLTQ6QDP-Xmw2qbA7.js} +1 -1
- package/dist/client/assets/erDiagram-RLTQ6QDP-Xmw2qbA7.js.br +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-Xmw2qbA7.js.gz +0 -0
- package/dist/client/assets/{flowDiagram-HODETNUW-CuO0cLki.js → flowDiagram-HODETNUW-KRYKHFDk.js} +1 -1
- package/dist/client/assets/flowDiagram-HODETNUW-KRYKHFDk.js.br +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-KRYKHFDk.js.gz +0 -0
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-BIt0Y40Q.js → ganttDiagram-EL5Y4UJY-UcoHnpCx.js} +1 -1
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-UcoHnpCx.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-UcoHnpCx.js.gz +0 -0
- package/dist/client/assets/{gestureArbiter--6cZMOnD.js → gestureArbiter-B6OZhQjV.js} +1 -1
- package/dist/client/assets/gestureArbiter-B6OZhQjV.js.br +0 -0
- package/dist/client/assets/gestureArbiter-B6OZhQjV.js.gz +0 -0
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-C1ljbYw7.js → gitGraphDiagram-WWUBYQGX-Evwvg64n.js} +1 -1
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-Evwvg64n.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-Evwvg64n.js.gz +0 -0
- package/dist/client/assets/imageCompression-DaUBNTq-.js +1 -0
- package/dist/client/assets/index-607UPNXL.js +1 -0
- package/dist/client/assets/index-607UPNXL.js.br +0 -0
- package/dist/client/assets/index-607UPNXL.js.gz +0 -0
- package/dist/client/assets/index-CUxsIblL.js +1 -0
- package/dist/client/assets/index-CUxsIblL.js.br +0 -0
- package/dist/client/assets/index-CUxsIblL.js.gz +0 -0
- package/dist/client/assets/{index-DeTcW7aT.css → index-IknuJMxJ.css} +1 -1
- package/dist/client/assets/index-IknuJMxJ.css.br +0 -0
- package/dist/client/assets/index-IknuJMxJ.css.gz +0 -0
- package/dist/client/assets/{infoDiagram-27XIBGKW-CrOPvG9H.js → infoDiagram-27XIBGKW-CdTYa6sH.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-Ch5ze9LB.js → ishikawaDiagram-5VMMS53U-D1-1rWNL.js} +1 -1
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-D1-1rWNL.js.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-D1-1rWNL.js.gz +0 -0
- package/dist/client/assets/{journeyDiagram-3NMN7TZE-C3vqa0wB.js → journeyDiagram-3NMN7TZE-DNF2Xeph.js} +1 -1
- package/dist/client/assets/journeyDiagram-3NMN7TZE-DNF2Xeph.js.br +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-DNF2Xeph.js.gz +0 -0
- package/dist/client/assets/{kanban-definition-UXKFOSKX-rEL2pKx0.js → kanban-definition-UXKFOSKX-nNy4MKl1.js} +1 -1
- package/dist/client/assets/kanban-definition-UXKFOSKX-nNy4MKl1.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-nNy4MKl1.js.gz +0 -0
- package/dist/client/assets/{layout-CeDdQRYz.js → layout-eOsGqyyy.js} +1 -1
- package/dist/client/assets/layout-eOsGqyyy.js.br +0 -0
- package/dist/client/assets/layout-eOsGqyyy.js.gz +0 -0
- package/dist/client/assets/{linear-C9xkTlXu.js → linear-BvPFVZ5r.js} +1 -1
- package/dist/client/assets/linear-BvPFVZ5r.js.br +0 -0
- package/dist/client/assets/linear-BvPFVZ5r.js.gz +0 -0
- package/dist/client/assets/{mermaid.core-CIW1IDpX.js → mermaid.core-xgi3W3HJ.js} +5 -5
- package/dist/client/assets/mermaid.core-xgi3W3HJ.js.br +0 -0
- package/dist/client/assets/mermaid.core-xgi3W3HJ.js.gz +0 -0
- package/dist/client/assets/{mindmap-definition-YA3MSWOX-CT9M_dpw.js → mindmap-definition-YA3MSWOX-C0Y8K-f6.js} +1 -1
- package/dist/client/assets/mindmap-definition-YA3MSWOX-C0Y8K-f6.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-C0Y8K-f6.js.gz +0 -0
- package/dist/client/assets/{passwordBootstrap-B8awl9Cz.js → passwordBootstrap-dH2p1UXM.js} +1 -1
- package/dist/client/assets/passwordBootstrap-dH2p1UXM.js.br +0 -0
- package/dist/client/assets/passwordBootstrap-dH2p1UXM.js.gz +0 -0
- package/dist/client/assets/{pegDiagram-XKGWAZYB-BkaUHxk6.js → pegDiagram-XKGWAZYB-DDphzW5Y.js} +1 -1
- package/dist/client/assets/pegDiagram-XKGWAZYB-DDphzW5Y.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-DDphzW5Y.js.gz +0 -0
- package/dist/client/assets/{pieDiagram-E7YTZNPT-Di_VEsZA.js → pieDiagram-E7YTZNPT-GDu--HqE.js} +1 -1
- package/dist/client/assets/pieDiagram-E7YTZNPT-GDu--HqE.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-GDu--HqE.js.gz +0 -0
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-B--Y1EgY.js → quadrantDiagram-AXDQQJYC-NSIlEYZd.js} +1 -1
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-NSIlEYZd.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-NSIlEYZd.js.gz +0 -0
- package/dist/client/assets/{railroadDiagram-O6MQD6OU-CTTF__yz.js → railroadDiagram-O6MQD6OU-BMr8_470.js} +1 -1
- package/dist/client/assets/railroadDiagram-O6MQD6OU-BMr8_470.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-BMr8_470.js.gz +0 -0
- package/dist/client/assets/{referenceLongPress-jOxtSE5l.js → referenceLongPress-5KOTIE_2.js} +1 -1
- package/dist/client/assets/referenceLongPress-5KOTIE_2.js.br +0 -0
- package/dist/client/assets/referenceLongPress-5KOTIE_2.js.gz +0 -0
- package/dist/client/assets/{requirementDiagram-BXWQKSXE-DI0C2RWw.js → requirementDiagram-BXWQKSXE-BYfx-BnY.js} +1 -1
- package/dist/client/assets/requirementDiagram-BXWQKSXE-BYfx-BnY.js.br +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-BYfx-BnY.js.gz +0 -0
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-W5HRSQpx.js → sankeyDiagram-P5KCCOFB-Sjw1moBs.js} +1 -1
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-Sjw1moBs.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-Sjw1moBs.js.gz +0 -0
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-BKkAIBat.js → sequenceDiagram-WJ2MYXX4-BdB4bAuv.js} +1 -1
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-BdB4bAuv.js.br +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-BdB4bAuv.js.gz +0 -0
- package/dist/client/assets/{sizeCapture-INFHLROL-DXBwqyIS.js → sizeCapture-INFHLROL-Bqjs5SmV.js} +1 -1
- package/dist/client/assets/sizeCapture-INFHLROL-Bqjs5SmV.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-Bqjs5SmV.js.gz +0 -0
- package/dist/client/assets/{sparkles-DceTfvKw.js → sparkles-BqYxpm2T.js} +1 -1
- package/dist/client/assets/{stateDiagram-D77RDMKH-BBVi-dyW.js → stateDiagram-D77RDMKH-CeGiiS-A.js} +1 -1
- package/dist/client/assets/stateDiagram-D77RDMKH-CeGiiS-A.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-CeGiiS-A.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-DAcs8J97.js +1 -0
- package/dist/client/assets/{swimlanes-42K2YHIH-DwJjgXte.js → swimlanes-42K2YHIH-CfKdzOcE.js} +1 -1
- package/dist/client/assets/swimlanes-42K2YHIH-CfKdzOcE.js.br +0 -0
- package/dist/client/assets/swimlanes-42K2YHIH-CfKdzOcE.js.gz +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-ByPh86Cc.js +8 -0
- package/dist/client/assets/{timeline-definition-24CTP7MA-COX39iJ6.js → timeline-definition-24CTP7MA-BQHm94LP.js} +1 -1
- package/dist/client/assets/timeline-definition-24CTP7MA-BQHm94LP.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-BQHm94LP.js.gz +0 -0
- package/dist/client/assets/{triangle-alert-DjtUXw4T.js → triangle-alert-9JebA9Zi.js} +1 -1
- package/dist/client/assets/{vennDiagram-4TSXK5OY-46HA9L0l.js → vennDiagram-4TSXK5OY-CiDKvpY7.js} +1 -1
- package/dist/client/assets/vennDiagram-4TSXK5OY-CiDKvpY7.js.br +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-CiDKvpY7.js.gz +0 -0
- package/dist/client/assets/videoCompression-BZCAJl_H.js +3 -0
- package/dist/client/assets/videoCompression-BZCAJl_H.js.br +0 -0
- package/dist/client/assets/videoCompression-BZCAJl_H.js.gz +0 -0
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-DfkGMObP.js → wardleyDiagram-VM6X3IG4-DOUAhlES.js} +1 -1
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-DOUAhlES.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-DOUAhlES.js.gz +0 -0
- package/dist/client/assets/worker-BAOIWoxA.js +1 -0
- package/dist/client/assets/worker-BAOIWoxA.js.br +0 -0
- package/dist/client/assets/worker-BAOIWoxA.js.gz +0 -0
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-vlKat3e7.js → xychartDiagram-S5SC5T6Z-BV7ihxFK.js} +1 -1
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-BV7ihxFK.js.br +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-BV7ihxFK.js.gz +0 -0
- package/dist/client/index.html +44 -4
- package/dist/client/index.html.br +0 -0
- package/dist/client/index.html.gz +0 -0
- package/dist/client/licenses/loading-dev.txt +21 -0
- package/dist/client/licenses/loading-dev.txt.br +0 -0
- package/dist/client/licenses/loading-dev.txt.gz +0 -0
- package/dist/client/sw-encrypted-background.js +1 -1
- package/dist/client/sw-encrypted-background.js.br +0 -0
- package/dist/client/sw-encrypted-background.js.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/entry.js +38 -1
- package/dist/server/routes/terminal.js +2 -1
- package/dist/server/utils/runtimeClient.js +34 -0
- package/package.json +4 -1
- package/runtime-manifest.json +4 -4
- package/dist/client/assets/App-VGKzpPWO.js +0 -156
- package/dist/client/assets/App-VGKzpPWO.js.br +0 -0
- package/dist/client/assets/App-VGKzpPWO.js.gz +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-CpJIxJoa.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-CpJIxJoa.js.gz +0 -0
- package/dist/client/assets/DagPlayground-DsZ_TzMA.js.br +0 -0
- package/dist/client/assets/DagPlayground-DsZ_TzMA.js.gz +0 -0
- package/dist/client/assets/DiffLab-DVzd5Djx.js.br +0 -0
- package/dist/client/assets/DiffLab-DVzd5Djx.js.gz +0 -0
- package/dist/client/assets/DiffReview-5MLGwl3s.js.br +0 -0
- package/dist/client/assets/DiffReview-5MLGwl3s.js.gz +0 -0
- package/dist/client/assets/DiffReviewLab-B53N-9cX.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-B53N-9cX.js.gz +0 -0
- package/dist/client/assets/DiffViewer-PrcRXQq0.js.br +0 -0
- package/dist/client/assets/DiffViewer-PrcRXQq0.js.gz +0 -0
- package/dist/client/assets/ModelPreview-C98dbuUF.js.br +0 -0
- package/dist/client/assets/ModelPreview-C98dbuUF.js.gz +0 -0
- package/dist/client/assets/RightSidebar-B52JGGs9.js.br +0 -0
- package/dist/client/assets/RightSidebar-B52JGGs9.js.gz +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-B5gA9_Ty.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-B5gA9_Ty.js.gz +0 -0
- package/dist/client/assets/app-DnjpR35Q.js +0 -35
- package/dist/client/assets/app-DnjpR35Q.js.br +0 -0
- package/dist/client/assets/app-DnjpR35Q.js.gz +0 -0
- package/dist/client/assets/arc-Bq6Y_399.js.br +0 -0
- package/dist/client/assets/arc-Bq6Y_399.js.gz +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-D7bXmRrP.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-D7bXmRrP.js.gz +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-vmiTllrb.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-vmiTllrb.js.gz +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-C6ThUVSU.js.br +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-C6ThUVSU.js.gz +0 -0
- package/dist/client/assets/channel-DLM_eD7J.js +0 -1
- package/dist/client/assets/chunk-F27PBJKO-C7W0s-qY.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-C7W0s-qY.js.gz +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-CTjPfIKT.js.br +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-CTjPfIKT.js.gz +0 -0
- package/dist/client/assets/chunk-SVP7TREG-CCuDpBKr.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-CCuDpBKr.js.gz +0 -0
- package/dist/client/assets/chunk-TICWLB2K-DtYX2TNH.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-DtYX2TNH.js.gz +0 -0
- package/dist/client/assets/classDiagram-ZZMXUADV-C1zXUzCS.js +0 -1
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-C1zXUzCS.js +0 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-CyoiG3NB.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-CyoiG3NB.js.gz +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-SeWSNPvK.js.br +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-SeWSNPvK.js.gz +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-C6Z9w461.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-C6Z9w461.js.gz +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-DgQ7oSI3.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-DgQ7oSI3.js.gz +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-BrFJNnZh.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-BrFJNnZh.js.gz +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-DW2EFMOu.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-DW2EFMOu.js.gz +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-C5lTJcKk.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-C5lTJcKk.js.gz +0 -0
- package/dist/client/assets/diagram-VX7I27RA-CObqcJqB.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-CObqcJqB.js.gz +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-br3lGnhW.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-br3lGnhW.js.gz +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-CkXxS9Pq.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-CkXxS9Pq.js.gz +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-CMBJEKp-.js.br +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-CMBJEKp-.js.gz +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-CuO0cLki.js.br +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-CuO0cLki.js.gz +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-BIt0Y40Q.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-BIt0Y40Q.js.gz +0 -0
- package/dist/client/assets/gestureArbiter--6cZMOnD.js.br +0 -0
- package/dist/client/assets/gestureArbiter--6cZMOnD.js.gz +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-C1ljbYw7.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-C1ljbYw7.js.gz +0 -0
- package/dist/client/assets/index-DeTcW7aT.css.br +0 -0
- package/dist/client/assets/index-DeTcW7aT.css.gz +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-Ch5ze9LB.js.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-Ch5ze9LB.js.gz +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-C3vqa0wB.js.br +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-C3vqa0wB.js.gz +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-rEL2pKx0.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-rEL2pKx0.js.gz +0 -0
- package/dist/client/assets/layout-CeDdQRYz.js.br +0 -0
- package/dist/client/assets/layout-CeDdQRYz.js.gz +0 -0
- package/dist/client/assets/linear-C9xkTlXu.js.br +0 -0
- package/dist/client/assets/linear-C9xkTlXu.js.gz +0 -0
- package/dist/client/assets/mermaid.core-CIW1IDpX.js.br +0 -0
- package/dist/client/assets/mermaid.core-CIW1IDpX.js.gz +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-CT9M_dpw.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-CT9M_dpw.js.gz +0 -0
- package/dist/client/assets/passwordBootstrap-B8awl9Cz.js.br +0 -0
- package/dist/client/assets/passwordBootstrap-B8awl9Cz.js.gz +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-BkaUHxk6.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-BkaUHxk6.js.gz +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-Di_VEsZA.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-Di_VEsZA.js.gz +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-B--Y1EgY.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-B--Y1EgY.js.gz +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-CTTF__yz.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-CTTF__yz.js.gz +0 -0
- package/dist/client/assets/referenceLongPress-jOxtSE5l.js.br +0 -0
- package/dist/client/assets/referenceLongPress-jOxtSE5l.js.gz +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-DI0C2RWw.js.br +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-DI0C2RWw.js.gz +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-W5HRSQpx.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-W5HRSQpx.js.gz +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-BKkAIBat.js.br +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-BKkAIBat.js.gz +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-DXBwqyIS.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-DXBwqyIS.js.gz +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-BBVi-dyW.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-BBVi-dyW.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-DjAtlfPn.js +0 -1
- package/dist/client/assets/swimlanes-42K2YHIH-DwJjgXte.js.br +0 -0
- package/dist/client/assets/swimlanes-42K2YHIH-DwJjgXte.js.gz +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-BRWkDBH5.js +0 -8
- package/dist/client/assets/timeline-definition-24CTP7MA-COX39iJ6.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-COX39iJ6.js.gz +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-46HA9L0l.js.br +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-46HA9L0l.js.gz +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-DfkGMObP.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-DfkGMObP.js.gz +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-vlKat3e7.js.br +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-vlKat3e7.js.gz +0 -0
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RightSidebar-B52JGGs9.js","assets/app-DnjpR35Q.js","assets/react-XDCjal2T.js","assets/dnd-BCFAPC0L.js","assets/terminal-C7X98Amf.js","assets/index-DeTcW7aT.css","assets/gestureArbiter--6cZMOnD.js","assets/gestureArbiter-C2J0D0kV.css","assets/DiffReview-5MLGwl3s.js","assets/sparkles-DceTfvKw.js","assets/DiffViewer-PrcRXQq0.js","assets/referenceLongPress-jOxtSE5l.js","assets/DiffViewer-T3uj2-aP.css","assets/triangle-alert-DjtUXw4T.js","assets/ChangeWalkthroughPanel-CpJIxJoa.js","assets/RightSidebar-DW-JEgm2.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a6 as Wt,cM as Jr,v as Zv,bi as a,a3 as bh,cT as Mo,cJ as ra,cL as ss,aR as Bl,Z as Ku,cp as Kv,cK as _u,aW as fo,a5 as Kc,c3 as Xh,cx as Xv,ai as K0,bh as X0,f as Jv,ck as Nd,K as e7,a_ as pp,bq as mp,ch as t7,ao as r7,b_ as n7,Y as Ix,bY as s7,cf as Ex,a1 as i7,a7,L as cn,C as ya,X as gs,e as o7,c as Oo,b3 as l7,aQ as gp,cR as Vr,bp as a1,cQ as Jt,at as c7,cY as u7,q as d7,bw as h7,bJ as f7,bz as p7,cd as vm,ce as wm,cg as Am,W as Tm,bI as m7,cq as g7,o as Cm,cI as x7,aY as b7,h as y7,aO as Do,T as Ga,cP as v7,b$ as w7,ae as A7,ab as Gd,aM as T7,bG as C7,bH as S7,P as Rx,V as Sm,bx as _7,bk as Nx,k as bi,aB as lu,N as Md,cy as Jh,cO as L7,b2 as jo,cV as k7,B as Ml,d as Xc,p as I7,aa as E7,F as xp,c9 as R7,g as ac,bd as N7,be as M7,ag as Mx,ar as Dx,cw as Bx,bl as D7,bn as Qx,$ as oc,c1 as B7,j as jx,bN as Q7,ci as j7,c4 as P7,bL as O7,am as _m,ca as F7,bM as o1,bo as Lm,c7 as Gc,bP as bp,cu as U7,cc as $7,by as Px,c6 as z7,cj as H7,an as W7,bm as km,ax as G7,aP as V7,D as q7,aw as Im,bs as Y7,bQ as Ox,S as Z7,bv as K7,l as X7,bt as J7,bO as e8,_ as t8,cb as r8,m as n8,a as s8,bK as i8,ak as a8,aq as o8,as as l8,aZ as g0,b7 as c8,cE as u8,b8 as d8,af as h8,cG as f8,H as p8,a9 as m8,a4 as g8,A as x8,ah as b8,M as y8,cS as v8,bA as zl,aV as w8,aS as A8,aT as T8,aU as C8,aK as ef,bB as S8,bU as _8,c0 as L8,aX as k8,aN as I8,cv as Em,ad as E8,a0 as R8,J as N8,cC as M8,cW as Bn,cs as D8,aJ as B8,a$ as Rm,bT as Q8,co as Xu,cB as x0,cF as j8,bV as P8,ct as O8,cl as F8,cA as tf,cm as U8,cn as $8,cN as z8,ac as H8,c8 as b0,w as W8,br as G8,bg as Ju,bf as V8,bR as Nm,bW as q8,bS as Lc,bX as Y8,U as Z8,a2 as K8,n as X8}from"./app-DnjpR35Q.js";import{b as y,R as S,r as na,a as J8}from"./dnd-BCFAPC0L.js";import{b as e9,c as t9,F as lc,S as r9,e as n9,h as s9,r as i9,y as a9,d as o9,u as l9}from"./gestureArbiter--6cZMOnD.js";import{L as c9,l as u9}from"./terminal-C7X98Amf.js";import{T as Fx,L as Jc,M as d9,G as h9,C as Mm}from"./triangle-alert-DjtUXw4T.js";import{r as f9}from"./react-XDCjal2T.js";import{u as l1,G as p9}from"./referenceLongPress-jOxtSE5l.js";const m9=[["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"}]],g9=Wt("arrow-down-a-z",m9);const x9=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],b9=Wt("arrow-down",x9);const y9=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ux=Wt("arrow-up",y9);const v9=[["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"}]],$x=Wt("bell",v9);const w9=[["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"}]],yh=Wt("bot",w9);const A9=[["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"}]],T9=Wt("box",A9);const C9=[["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"}]],S9=Wt("cable",C9);const _9=[["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"}]],L9=Wt("calendar-clock",_9);const k9=[["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"}]],I9=Wt("camera",k9);const E9=[["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"}]],R9=Wt("chart-bar",E9);const N9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],M9=Wt("circle-dot",N9);const D9=[["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"}]],Vd=Wt("circle-question-mark",D9);const B9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Q9=Wt("circle",B9);const j9=[["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"}]],P9=Wt("clipboard-paste",j9);const O9=[["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"}]],zx=Wt("clipboard",O9);const F9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],cu=Wt("clock-3",F9);const U9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],$9=Wt("clock",U9);const z9=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],H9=Wt("code",z9);const W9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],al=Wt("columns-2",W9);const G9=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],V9=Wt("corner-down-left",G9);const q9=[["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"}]],uu=Wt("download",q9);const Y9=[["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"}]],c1=Wt("external-link",Y9);const Z9=[["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"}]],K9=Wt("file-code",Z9);const X9=[["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"}]],J9=Wt("file-up",X9);const ew=[["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"}]],Hx=Wt("file",ew);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"}]],Vc=Wt("folder-open",tw);const rw=[["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"}]],u1=Wt("folder-search",rw);const nw=[["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"}]],sw=Wt("folder-tree",nw);const iw=[["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"}]],Dm=Wt("grid-2x2",iw);const aw=[["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"}]],Lu=Wt("grip-vertical",aw);const ow=[["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"}]],lw=Wt("hash",ow);const cw=[["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"}]],Jl=Wt("history",cw);const uw=[["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"}]],dw=Wt("house",uw);const hw=[["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"}]],Wx=Wt("keyboard",hw);const fw=[["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"}]],Gx=Wt("layers",fw);const pw=[["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"}]],e0=Wt("layout-grid",pw);const mw=[["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"}]],gw=Wt("maximize",mw);const xw=[["path",{d:"M5 12h14",key:"1ays0h"}]],Vx=Wt("minus",xw);const bw=[["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"}]],yw=Wt("minimize",bw);const vw=[["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"}]],ww=Wt("monitor-smartphone",vw);const Aw=[["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"}]],Tw=Wt("moon",Aw);const Cw=[["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"}]],Sw=Wt("move",Cw);const _w=[["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"}]],Lw=Wt("panel-right-close",_w);const kw=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Iw=Wt("panel-left",kw);const Ew=[["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"}]],Rw=Wt("panel-right-open",Ew);const Nw=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],qx=Wt("panel-right",Nw);const Mw=[["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"}]],Dw=Wt("pause",Mw);const Bw=[["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"}]],Qw=Wt("pen-line",Bw);const jw=[["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"}]],Pw=Wt("pencil-line",jw);const Ow=[["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"}]],du=Wt("pin",Ow);const Fw=[["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"}]],hu=Wt("pin-off",Fw);const Uw=[["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"}]],Bm=Wt("play",Uw);const $w=[["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"}]],zw=Wt("plug",$w);const Hw=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],Ww=Wt("power",Hw);const Gw=[["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"}]],xs=Wt("refresh-cw",Gw);const Vw=[["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"}]],Yx=Wt("rotate-ccw",Vw);const qw=[["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"}]],Yw=Wt("rotate-cw",qw);const Zw=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],Qm=Wt("rows-2",Zw);const Kw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],fu=Wt("search",Kw);const Xw=[["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"}]],Jw=Wt("send",Xw);const eA=[["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=Wt("settings",eA);const rA=[["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"}]],nA=Wt("shield-alert",rA);const sA=[["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"}]],iA=Wt("shield-check",sA);const aA=[["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"}]],oA=Wt("sliders-horizontal",aA);const lA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Zx=Wt("square",lA);const cA=[["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"}]],uA=Wt("stethoscope",cA);const dA=[["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"}]],hA=Wt("sun",dA);const fA=[["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"}]],yi=Wt("trash-2",fA);const pA=[["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"}]],mA=Wt("type",pA);const gA=[["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"}]],xA=Wt("unlink",gA);const bA=[["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"}]],Kx=Wt("unplug",bA);const yA=[["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"}]],Xx=Wt("video",yA);const vA=[["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"}]],wA=Wt("volume-1",vA);const AA=[["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"}]],TA=Wt("volume-2",AA);const CA=[["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"}]],SA=Wt("wand-sparkles",CA);const _A=[["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"}]],jm=Wt("workflow",_A);function LA(e,t){return e==="webgl"&&t}function kA(e){return e.isActive&&e.viewportFocused&&e.documentVisible&&e.windowFocused&&e.streamReady}function IA(e){return e.isActive&&e.documentVisible&&e.streamReady&&(!e.isDesktop||e.windowFocused)}function EA(e){return e.isActive&&!e.isMobile&&e.documentVisible&&!e.activeElementIsEditable}function RA(e,t){return!e&&t}function NA({state:e,onCopy:t,copied:r}){const{t:n}=Jr(),[i,l]=y.useState(null),u=e.caAvailable&&e.onboardingUrl?new URL("/ca",e.onboardingUrl).href:null;return y.useEffect(()=>{let h=!1;return l(null),u&&Zv.toDataURL(u,{width:180,margin:2,errorCorrectionLevel:"M"}).then(p=>{h||l(p)}).catch(()=>{}),()=>{h=!0}},[u]),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")}),u?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(u),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:u}),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 su=bh(e=>({collaborationGroups:[],setCollaborationGroups:t=>e(r=>({collaborationGroups:typeof t=="function"?t(r.collaborationGroups):t}))}));function Pm(){const e=Mo(),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,u=null;for(;l&&!u;)u=l.querySelector('[data-mobile-keyboard="true"]'),l=l.parentElement;const h=u?.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 MA({onClose:e}){const[t,r]=S.useState(Pm);return S.useEffect(()=>{const n=window.setInterval(()=>r(Pm()),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 DA={x:0,y:0,width:1,height:1};function tc(e){return"id"in e?[e.id]:[...tc(e.first),...tc(e.second)]}function yp(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=yp(n.first,t+1,r),l=yp(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 pu(e,t){if("id"in e)return t.has(e.id)?e:null;const r=pu(e.first,t),n=pu(e.second,t);return r&&n?{...e,first:r,second:n}:r??n}function qd(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:qd(e.first,t,r,n),second:qd(e.second,t,r,n)}}function BA(e,t,r,n){if(t===r||!tc(e).includes(t)||!tc(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 qd(pu(e,new Set(tc(e).filter(i=>i!==t))),r,t,n)}function qc(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:qc(e.slice(0,r),"horizontal"),second:qc(e.slice(r),"horizontal")}}return{axis:t==="vertical"?"y":"x",ratio:1/e.length,first:{id:e[0]},second:qc(e.slice(1),t)}}function vp(e,t=DA,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=vp(e.first,n,r+"0"),u=vp(e.second,i,r+"1");return{panes:[...l.panes,...u.panes],dividers:[{path:r,node:e,rect:t},...l.dividers,...u.dividers]}}function iu(e,t,r){return"id"in e?e:t?t[0]==="0"?{...e,first:iu(e.first,t.slice(1),r)}:{...e,second:iu(e.second,t.slice(1),r)}:{...e,ratio:r}}function Jx(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 rf(e,t,r){const n=Jx(e);if(!n)return e;const[i,l,u,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:u,second:h}}:{axis:"x",ratio:(n.top+n.bottom)/2,first:{axis:"y",ratio:t==="left"?r:n.left,first:i,second:u},second:{axis:"y",ratio:t==="right"?r:n.right,first:l,second:h}}}function QA(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 u=Math.ceil(Math.sqrt(e.length)),h=[];for(let p=0;p<e.length;p+=u){const g=e.slice(p,p+u).map(b=>({id:b})),x=n?.length===u?n.slice(0,g.length):void 0;x&&g.length<u&&(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 jA;function vh(){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 jA??=crypto.randomUUID()}}let Om=Promise.resolve();function ol(e,t){t&&(e={groups:{[t]:e}});const r=vh(),n=Om.catch(()=>{}).then(()=>ra({collaborationPanel:{clientId:r,state:e}}));return Om=n,n.then(()=>{})}function Fm(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 e3(e,t){return t?{...{...e?.floatingGroupId===t?e:{},...e?.groups?.[t]},drafts:e?.drafts}:{drafts:e?.drafts}}function t3(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 PA=e=>e.startsWith("@collaboration:"),Um=e=>({left:`${e.x*100}%`,top:`${e.y*100}%`,width:`${e.width*100}%`,height:`${e.height*100}%`});function OA({groupId:e}){const t=ss(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 $m({layoutId:e,panes:t,preset:r="grid",initialTree:n,focusId:i,mobile:l=!1}){const u=ss(te=>te.docks),h=JSON.stringify(t.map(te=>te.id)),p=Object.entries(u).filter(([,te])=>t.some(re=>re.id===te.sessionId)),g=JSON.stringify(p),x=y.useRef(null),[b,w]=y.useState(()=>n??qc(t.map(te=>te.id),l?"vertical":r)),A=y.useRef(b);A.current=b;const[k,I]=y.useState(!1),N=ss(te=>te.activePaneId),[R,D]=y.useState(null),[O,q]=y.useState(null),[Y,U]=y.useState(null),V=y.useRef(r),me=y.useRef(t.map(te=>te.id)),Je=y.useRef({}),ve=y.useRef(!1),_e=()=>{ve.current&&(ve.current=!1,ol({layouts:{[e]:A.current}}).catch(()=>{ve.current=!0,D("布局保存失败,调整后重试")}))};y.useEffect(()=>{let te=!1;return Bl().then(re=>{if(te)return;const ge=re.collaborationPanels?.[vh()];for(const Ke of t3(ge)){const Ae=e3(ge,Ke);Ae.mode==="docked"&&Ae.dock&&t.some(z=>z.id===Ae.dock.sessionId)&&!ss.getState().docks[Ke]&&ss.getState().setDock(Ke,Ae.dock)}let ze=yp(ge?.layouts?.[e]);if(ze&&ge?.floatingGroupId){const Ke=Ae=>"id"in Ae?{id:Ae.id==="@collaboration"?Ku(ge.floatingGroupId):Ae.id}:{...Ae,first:Ke(Ae.first),second:Ke(Ae.second)};ze=Ke(ze)}ze&&w(ze),I(!0)}).catch(()=>{te||D("布局加载失败,请刷新重试")}),()=>{te=!0}},[e]);const Ze=te=>{ve.current=!0,A.current=te,w(te)};y.useLayoutEffect(()=>{if(!k)return;const te=JSON.parse(h),re=V.current!==r;V.current=r;let ge=re?qc(te,r):A.current;const ze=me.current;if(!re&&ze.length===te.length&&ze.every(z=>te.includes(z))&&ze.some((z,Oe)=>z!==te[Oe])){const z=new Map(ze.map((nt,Re)=>[nt,te[Re]])),Oe=nt=>"id"in nt?{id:z.get(nt.id)??nt.id}:{...nt,first:Oe(nt.first),second:Oe(nt.second)};ge=Oe(ge)}me.current=te;const Ke=new Set([...te,...p.map(([z])=>Ku(z))]);ge=pu(ge,Ke)??qc(te,r);for(const z of te)tc(ge).includes(z)||(ge={axis:"x",ratio:.5,first:ge,second:{id:z}});const Ae={};for(const[z,Oe]of p){const nt=Ku(z),Re=`${Oe.sessionId}:${Oe.side}`;Ae[z]=Re,(!tc(ge).includes(nt)||Je.current[z]&&Je.current[z]!==Re)&&(ge=pu(ge,new Set([...Ke].filter(X=>X!==nt))),ge=qd(ge,Oe.sessionId,nt,Oe.side))}Je.current=Ae,JSON.stringify(ge)!==JSON.stringify(A.current)&&(Ze(ge),_e())},[k,h,r,g]),y.useEffect(()=>{const te=()=>_e();return window.addEventListener("pagehide",te),()=>{window.removeEventListener("pagehide",te),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),te()}},[e]);const Ve=vp(b),ce=Jx(b),ke=[...t,...p.map(([te])=>({id:Ku(te),content:a.jsx(OA,{groupId:te})}))],ot=y.useRef(null),Ie=y.useRef(Y);Ie.current=Y;const de=y.useRef(null);y.useEffect(()=>{const te=x.current;if(!te||!k)return;const re=ze=>{if(ze.button!==0||!(ze.target instanceof Element))return;const Ke=ze.target.closest("[data-split-pane-title], [data-panel-drag-title]"),Ae=ze.target.closest("button, a, input, textarea, select");if(!Ke||Ae&&Ae!==Ke)return;const z=Ke.closest("[data-layout-pane]");if(!z||!te.contains(z))return;document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}}));const Oe=z.getBoundingClientRect();ot.current={id:z.dataset.layoutPane,x:ze.clientX,y:ze.clientY,moved:!1,originX:ze.clientX-Oe.left,originY:ze.clientY-Oe.top,scale:Math.min(.8,480/Math.max(1,Oe.width),320/Math.max(1,Oe.height))},te.setPointerCapture?.(ze.pointerId)},ge=ze=>{const Ke=ze.target;if(!(Ke instanceof Element))return;const Ae=Ke.closest("[data-layout-pane]");if(!(!Ae||!te.contains(Ae))){if(ze.type==="pointerdown"&&ss.getState().activePaneId!==Ae.dataset.layoutPane){const z=document.activeElement;z instanceof HTMLElement&&z.closest("[data-layout-pane]")&&!Ae.contains(z)&&z.blur();const Oe=window.getSelection();Oe?.anchorNode&&!Ae.contains(Oe.anchorNode)&&Oe.removeAllRanges()}ss.getState().setActivePane(Ae.dataset.layoutPane)}};return te.addEventListener("pointerdown",ge,!0),te.addEventListener("focusin",ge,!0),te.addEventListener("pointerdown",re,!0),()=>{te.removeEventListener("pointerdown",re,!0),te.removeEventListener("pointerdown",ge,!0),te.removeEventListener("focusin",ge,!0)}},[k]);const qe=(te,re)=>{const ge=x.current?.getBoundingClientRect(),ze=de.current;if(!ge||!ze)return;const Ke=ze.axis==="x"?ge.width*ze.rect.width:ge.height*ze.rect.height,Ae=ze.axis==="x"?ge.left+ge.width*ze.rect.x:ge.top+ge.height*ze.rect.y,z=Math.min(.45,(l?48:120)/Math.max(1,Ke)),Oe=Math.max(z,Math.min(1-z,((ze.axis==="x"?te:re)-Ae)/Math.max(1,Ke)));Ze(ze.side?rf(A.current,ze.side,Oe):iu(A.current,ze.path,Oe))},xe=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(te=>({...te,rect:{x:0,y:0,width:1,height:1},path:void 0})):Ve.dividers.map(te=>({key:te.path,path:te.path,side:void 0,axis:te.node.axis,rect:te.rect,x:te.rect.x+(te.node.axis==="x"?te.rect.width*te.node.ratio:0),y:te.rect.y+(te.node.axis==="y"?te.rect.height*te.node.ratio:0),length:te.node.axis==="x"?te.rect.height:te.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:te=>{if(de.current){te.preventDefault(),qe(te.clientX,te.clientY);return}const re=ot.current,ge=x.current?.getBoundingClientRect();if(!re||!ge||!re.moved&&Math.hypot(te.clientX-re.x,te.clientY-re.y)<6)return;re.moved=!0,q({id:re.id,dx:te.clientX-re.x,dy:te.clientY-re.y,originX:re.originX,originY:re.originY,scale:re.scale});const ze=(te.clientX-ge.left)/ge.width,Ke=(te.clientY-ge.top)/ge.height,Ae=Ve.panes.find(X=>ze>=X.rect.x&&ze<=X.rect.x+X.rect.width&&Ke>=X.rect.y&&Ke<=X.rect.y+X.rect.height);if(!Ae||Ae.id===re.id){Ie.current=null,U(null);return}const z=(ze-Ae.rect.x)/Ae.rect.width,Oe=(Ke-Ae.rect.y)/Ae.rect.height,nt=Math.min(z,1-z,Oe,1-Oe)>.25?"center":z<1-z&&z<=Oe&&z<=1-Oe?"left":1-z<=Oe&&1-z<=1-Oe?"right":Oe<1-Oe?"top":"bottom",Re={id:Ae.id,side:nt};Ie.current=Re,U(Re)},onPointerUp:te=>{de.current&&(de.current=null,_e()),ot.current?.moved&&Ie.current&&(Ze(BA(A.current,ot.current.id,Ie.current.id,Ie.current.side)),_e()),ot.current=null,Ie.current=null,U(null),q(null),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),te.currentTarget.hasPointerCapture?.(te.pointerId)&&te.currentTarget.releasePointerCapture(te.pointerId)},onLostPointerCapture:()=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),de.current=null,ot.current=null,Ie.current=null,U(null),q(null),_e()},onKeyDownCapture:te=>{te.key==="Escape"&&(ot.current=null,Ie.current=null,U(null),q(null),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})))},onPointerCancel:()=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),de.current=null,ot.current=null,Ie.current=null,U(null),q(null),_e()},children:[O&&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:Um(Ve.panes.find(te=>te.id===O.id)?.rect??{x:0,y:0,width:0,height:0})}),ke.map(te=>{const re=Ve.panes.find(ze=>ze.id===te.id)?.rect,ge=!re||!!i&&te.id!==i;return a.jsxs("div",{"data-layout-pane":te.id,"data-pane-active":N===te.id,className:`${N===te.id?"[&_[data-pane-titlebar]]:bg-surface":""} absolute min-h-0 min-w-0 overflow-hidden bg-[var(--chrome-bg)] ${O?.id===te.id?"pointer-events-none z-30 rounded-lg ring-1 ring-primary/60 opacity-90 shadow-xl":""}`,style:{...Um(i===te.id?{x:0,y:0,width:1,height:1}:re??{x:0,y:0,width:0,height:0}),padding:ke.length>1?"0.5px":0,transition:"none",visibility:ge?"hidden":void 0,...O?.id===te.id?{transform:`translate(${O.dx}px, ${O.dy}px) scale(${O.scale})`,transformOrigin:`${O.originX}px ${O.originY}px`}:{}},onDragStart:ze=>{ze.target.closest("[data-split-pane-title], [data-panel-drag-title]")&&ze.preventDefault()},children:[te.content,l&&ke.length>1&&!PA(te.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(Lu,{size:14})}),Y?.id===te.id&&a.jsx("div",{className:"pointer-events-none absolute z-30 border-2 border-primary bg-primary/20",style:{top:Y.side==="bottom"?"50%":0,bottom:Y.side==="top"?"50%":0,left:Y.side==="right"?"50%":0,right:Y.side==="left"?"50%":0}})]},te.id)}),!i&&xe.map(te=>a.jsx("button",{type:"button",role:"separator","aria-label":te.side?`调整${{top:"上",bottom:"下",left:"左",right:"右"}[te.side]}半段分隔线`:"调整分屏大小","aria-orientation":te.axis==="x"?"vertical":"horizontal",disabled:!k,className:`swiper-no-swiping absolute z-10 touch-none bg-border hover:bg-primary focus-visible:bg-primary ${te.axis==="x"?"w-px cursor-col-resize":"h-px cursor-row-resize"}`,style:{left:`${te.x*100}%`,top:`${te.y*100}%`,...te.axis==="x"?{height:`${te.length*100}%`}:{width:`${te.length*100}%`}},onPointerDown:re=>{re.preventDefault(),re.stopPropagation(),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}})),de.current=te,x.current?.setPointerCapture?.(re.pointerId)},onDoubleClick:()=>{Ze(te.side?rf(A.current,te.side,.5):iu(A.current,te.path,.5)),_e()},onKeyDown:re=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(re.key))return;re.preventDefault();const ge=te.side?ce[te.side]:Ve.dividers.find(Ke=>Ke.path===te.path).node.ratio,ze=Math.max(.05,Math.min(.95,ge+(["ArrowRight","ArrowDown"].includes(re.key)?.03:-.03)));Ze(te.side?rf(A.current,te.side,ze):iu(A.current,te.path,ze)),_e()},children:a.jsx("span",{"aria-hidden":"true",className:`absolute ${te.axis==="x"?"inset-y-0 -inset-x-1":"inset-x-0 -inset-y-1"}`})},te.key)),R&&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:R})]})}let wp=0,zm=!1,$c=0;function FA(){if(zm||typeof window>"u")return;zm=!0;const e=()=>{wp=performance.now()};window.addEventListener("pointerdown",()=>{$c+=1,e()},{passive:!0,capture:!0});for(const t of["pointerup","pointercancel"])window.addEventListener(t,()=>{$c=Math.max(0,$c-1),e()},{passive:!0,capture:!0});for(const t of["pointermove","wheel","keydown"])window.addEventListener(t,e,{passive:!0,capture:!0});window.addEventListener("blur",()=>{$c=0,e()})}function d1(e,t=500){FA();let r=!1,n,i;const l=()=>{if(r)return;if($c>0||performance.now()-wp<400){i=setTimeout(l,100);return}const u=()=>{if(!r){if($c>0||performance.now()-wp<400){i=setTimeout(l,100);return}e()}};"requestIdleCallback"in window?n=window.requestIdleCallback(u):i=setTimeout(u,16)};return i=setTimeout(l,t),()=>{r=!0,clearTimeout(i),n!==void 0&&window.cancelIdleCallback(n)}}function UA(e){const[t,r]=y.useState(e);return y.useEffect(()=>d1(()=>r(e),0),[e]),t}function $A(e,t,r){y.useEffect(()=>{e&&Kv(e,!0)},[e,r])}const pi=[];for(let e=0;e<256;++e)pi.push((e+256).toString(16).slice(1));function zA(e,t=0){return(pi[e[t+0]]+pi[e[t+1]]+pi[e[t+2]]+pi[e[t+3]]+"-"+pi[e[t+4]]+pi[e[t+5]]+"-"+pi[e[t+6]]+pi[e[t+7]]+"-"+pi[e[t+8]]+pi[e[t+9]]+"-"+pi[e[t+10]]+pi[e[t+11]]+pi[e[t+12]]+pi[e[t+13]]+pi[e[t+14]]+pi[e[t+15]]).toLowerCase()}let nf;const HA=new Uint8Array(16);function WA(){if(!nf){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");nf=crypto.getRandomValues.bind(crypto)}return nf(HA)}const GA=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hm={randomUUID:GA};function VA(e,t,r){e=e||{};const n=e.random??e.rng?.()??WA();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,zA(n)}function r3(e,t,r){return Hm.randomUUID&&!e?Hm.randomUUID():VA(e)}const n3="\x1B[?2026h",qA="\x1B[?2026l",s3="\x1Bc";function YA(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===s3||t.endsWith("!p"))return t+n3;if(r===void 0)return t;const i=r.split(";").filter(l=>Number(l)!==2026);return i.length?`\x1B[?${i.join(";")}${n}`:""})}function ZA(e){const t=e.filter(n=>n.length>0).join("");if(!t)return[];const r=YA(t.replace(/^(?:\x1bc)+/,""));return[`${s3}${n3}${r}${qA}`]}function KA(e){return[`\x1B[!p\x1B[?2026h\x1B[H\x1B[2J\x1B[3J${e.join("")}\x1B[?2026l`]}const XA={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},JA={F1:"P",F2:"Q",F3:"R",F4:"S"},eT={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 tT(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,u=1+Number(n)+2*Number(i)+4*Number(l),h=u===1?"":`;${u}`,p=XA[r];if(p)return u!==1?`\x1B[1${h}${p}`:`\x1B${t?"O":"["}${p}`;const g=JA[r];if(g)return u!==1?`\x1B[1${h}${g}`:`\x1BO${g}`;if(r==="Insert"&&!i&&(n||l))return null;const x=eT[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}async function rT(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 _u("/tmp",[r]);if(!n[0]?.path)throw new Error("Upload did not return an image path");return n[0].path}async function Wm(e){const t=fo();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(u=>u.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 nT(){return(await fo()?.readClipboardFiles?.()??[]).map(t=>new File([t.bytes],t.name,{type:"application/octet-stream"}))}async function sT(e){if(!e.length)return[];const{files:t}=await _u("/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 Gs(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 aT(...e){return Gs(()=>iT(e))}var i3=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()}},dc=class{constructor(){this._store=new i3}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};dc.None=Object.freeze({dispose(){}});var y0=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}},a3=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),ku=a3?"node":navigator.userAgent,oT=a3?"node":navigator.platform,lT=ku.includes("Firefox");ku.includes("Chrome");var cT=ku.includes("Edge"),o3=/^((?!chrome|android).)*safari/i.test(ku);function uT(){if(!o3)return 0;let e=ku.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1],10)}oT.indexOf("Linux")>=0;var Xs=0,Js=0,ei=0,Ss=0,$a={css:"#00000000",rgba:0},Ui;(e=>{function t(i,l,u,h){return h!==void 0?`#${Hl(i)}${Hl(l)}${Hl(u)}${Hl(h)}`:`#${Hl(i)}${Hl(l)}${Hl(u)}`}e.toCss=t;function r(i,l,u,h=255){return(i<<24|l<<16|u<<8|h)>>>0}e.toRgba=r;function n(i,l,u,h){return{css:e.toCss(i,l,u,h),rgba:e.toRgba(i,l,u,h)}}e.toColor=n})(Ui||={});var J0;(e=>{function t(p,g){if(Ss=(g.rgba&255)/255,Ss===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,I=p.rgba>>8&255;Xs=A+Math.round((x-A)*Ss),Js=k+Math.round((b-k)*Ss),ei=I+Math.round((w-I)*Ss);let N=Ui.toCss(Xs,Js,ei),R=Ui.toRgba(Xs,Js,ei);return{css:N,rgba:R}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function n(p,g,x){let b=rc.ensureContrastRatio(p.rgba,g.rgba,x);if(b)return Ui.toColor(b>>24&255,b>>16&255,b>>8&255)}e.ensureContrastRatio=n;function i(p){let g=(p.rgba|255)>>>0;return[Xs,Js,ei]=rc.toChannels(g),{css:Ui.toCss(Xs,Js,ei),rgba:g}}e.opaque=i;function l(p,g){return Ss=Math.round(g*255),[Xs,Js,ei]=rc.toChannels(p.rgba),{css:Ui.toCss(Xs,Js,ei,Ss),rgba:Ui.toRgba(Xs,Js,ei,Ss)}}e.opacity=l;function u(p,g){return Ss=p.rgba&255,l(p,Ss*g/255)}e.multiplyOpacity=u;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(J0||={});var dT;(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 Xs=parseInt(i.slice(1,2).repeat(2),16),Js=parseInt(i.slice(2,3).repeat(2),16),ei=parseInt(i.slice(3,4).repeat(2),16),Ui.toColor(Xs,Js,ei);case 5:return Xs=parseInt(i.slice(1,2).repeat(2),16),Js=parseInt(i.slice(2,3).repeat(2),16),ei=parseInt(i.slice(3,4).repeat(2),16),Ss=parseInt(i.slice(4,5).repeat(2),16),Ui.toColor(Xs,Js,ei,Ss);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 Xs=parseInt(l[1],10),Js=parseInt(l[2],10),ei=parseInt(l[3],10),Ss=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),Ui.toColor(Xs,Js,ei,Ss);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),[Xs,Js,ei,Ss]=t.getImageData(0,0,1,1).data,Ss!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ui.toRgba(Xs,Js,ei,Ss),css:i}}e.toColor=n})(dT||={});var Pi;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,i,l){let u=n/255,h=i/255,p=l/255,g=u<=.03928?u/12.92:Math.pow((u+.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})(Pi||={});var rc;(e=>{function t(u,h){if(Ss=(h&255)/255,Ss===1)return h;let p=h>>24&255,g=h>>16&255,x=h>>8&255,b=u>>24&255,w=u>>16&255,A=u>>8&255;return Xs=b+Math.round((p-b)*Ss),Js=w+Math.round((g-w)*Ss),ei=A+Math.round((x-A)*Ss),Ui.toRgba(Xs,Js,ei)}e.blend=t;function r(u,h,p){let g=Pi.relativeLuminance(u>>8),x=Pi.relativeLuminance(h>>8);if(Xo(g,x)<p){if(x<g){let A=n(u,h,p),k=Xo(g,Pi.relativeLuminance(A>>8));if(k<p){let I=i(u,h,p),N=Xo(g,Pi.relativeLuminance(I>>8));return k>N?A:I}return A}let b=i(u,h,p),w=Xo(g,Pi.relativeLuminance(b>>8));if(w<p){let A=n(u,h,p),k=Xo(g,Pi.relativeLuminance(A>>8));return w>k?b:A}return b}}e.ensureContrastRatio=r;function n(u,h,p){let g=u>>24&255,x=u>>16&255,b=u>>8&255,w=h>>24&255,A=h>>16&255,k=h>>8&255,I=Xo(Pi.relativeLuminance2(w,A,k),Pi.relativeLuminance2(g,x,b));for(;I<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)),I=Xo(Pi.relativeLuminance2(w,A,k),Pi.relativeLuminance2(g,x,b));return(w<<24|A<<16|k<<8|255)>>>0}e.reduceLuminance=n;function i(u,h,p){let g=u>>24&255,x=u>>16&255,b=u>>8&255,w=h>>24&255,A=h>>16&255,k=h>>8&255,I=Xo(Pi.relativeLuminance2(w,A,k),Pi.relativeLuminance2(g,x,b));for(;I<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)),I=Xo(Pi.relativeLuminance2(w,A,k),Pi.relativeLuminance2(g,x,b));return(w<<24|A<<16|k<<8|255)>>>0}e.increaseLuminance=i;function l(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=l})(rc||={});function Hl(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Xo(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Ps(e){if(!e)throw new Error("value must not be falsy");return e}function h1(e){return 57508<=e&&e<=57558}function hT(e){return 57520<=e&&e<=57527}function fT(e){return 57344<=e&&e<=63743}function pT(e){return 9472<=e&&e<=9631}function mT(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 gT(e,t,r,n){return t===1&&r>Math.ceil(n*1.5)&&e!==void 0&&e>255&&!mT(e)&&!h1(e)&&!fT(e)}function l3(e){return h1(e)||pT(e)}function xT(){return{css:{canvas:ed(),cell:ed()},device:{canvas:ed(),cell:ed(),char:{width:0,height:0,left:0,top:0}}}}function ed(){return{width:0,height:0}}function bT(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var we;(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})))(we||={});var yT={"─":{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},"":we.LINE_H,"":we.LINE_V,"":we.FADE_RIGHT,"":we.FADE_LEFT,"":we.FADE_DOWN,"":we.FADE_UP,"":we.CURVE_DOWN_RIGHT,"":we.CURVE_DOWN_LEFT,"":we.CURVE_UP_RIGHT,"":we.CURVE_UP_LEFT,"":[we.LINE_V,we.CURVE_UP_RIGHT],"":[we.LINE_V,we.CURVE_DOWN_RIGHT],"":[we.CURVE_DOWN_RIGHT,we.CURVE_UP_RIGHT],"":[we.LINE_V,we.CURVE_UP_LEFT],"":[we.LINE_V,we.CURVE_DOWN_LEFT],"":[we.CURVE_DOWN_LEFT,we.CURVE_UP_LEFT],"":[we.LINE_H,we.CURVE_DOWN_LEFT],"":[we.LINE_H,we.CURVE_DOWN_RIGHT],"":[we.CURVE_DOWN_LEFT,we.CURVE_DOWN_RIGHT],"":[we.LINE_H,we.CURVE_UP_LEFT],"":[we.LINE_H,we.CURVE_UP_RIGHT],"":[we.CURVE_UP_LEFT,we.CURVE_UP_RIGHT],"":[we.LINE_V,we.CURVE_UP_LEFT,we.CURVE_UP_RIGHT],"":[we.LINE_V,we.CURVE_DOWN_LEFT,we.CURVE_DOWN_RIGHT],"":[we.LINE_H,we.CURVE_DOWN_LEFT,we.CURVE_UP_LEFT],"":[we.LINE_H,we.CURVE_DOWN_RIGHT,we.CURVE_UP_RIGHT],"":[we.LINE_V,we.CURVE_DOWN_RIGHT,we.CURVE_UP_LEFT],"":[we.LINE_V,we.CURVE_DOWN_LEFT,we.CURVE_UP_RIGHT],"":[we.LINE_H,we.CURVE_DOWN_RIGHT,we.CURVE_UP_LEFT],"":[we.LINE_H,we.CURVE_DOWN_LEFT,we.CURVE_UP_RIGHT],"":[we.NODE_FILL,we.NODE_STROKE],"":we.NODE_STROKE,"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_RIGHT],"":[we.NODE_STROKE,we.NODE_LINE_RIGHT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_LEFT],"":[we.NODE_STROKE,we.NODE_LINE_LEFT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_LEFT,we.NODE_LINE_RIGHT],"":[we.NODE_STROKE,we.NODE_LINE_LEFT,we.NODE_LINE_RIGHT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_DOWN],"":[we.NODE_STROKE,we.NODE_LINE_DOWN],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_UP],"":[we.NODE_STROKE,we.NODE_LINE_UP],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_DOWN,we.NODE_LINE_UP],"":[we.NODE_STROKE,we.NODE_LINE_DOWN,we.NODE_LINE_UP],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_DOWN,we.NODE_LINE_RIGHT],"":[we.NODE_STROKE,we.NODE_LINE_DOWN,we.NODE_LINE_RIGHT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_DOWN,we.NODE_LINE_LEFT],"":[we.NODE_STROKE,we.NODE_LINE_DOWN,we.NODE_LINE_LEFT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_RIGHT],"":[we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_RIGHT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_LEFT],"":[we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_LEFT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_DOWN,we.NODE_LINE_RIGHT],"":[we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_DOWN,we.NODE_LINE_RIGHT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_DOWN,we.NODE_LINE_LEFT],"":[we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_DOWN,we.NODE_LINE_LEFT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_DOWN,we.NODE_LINE_LEFT,we.NODE_LINE_RIGHT],"":[we.NODE_STROKE,we.NODE_LINE_DOWN,we.NODE_LINE_LEFT,we.NODE_LINE_RIGHT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_LEFT,we.NODE_LINE_RIGHT],"":[we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_LEFT,we.NODE_LINE_RIGHT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_DOWN,we.NODE_LINE_LEFT,we.NODE_LINE_RIGHT],"":[we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_DOWN,we.NODE_LINE_LEFT,we.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:Co(126),type:0},scaleType:1},"🯱":{type:5,data:{d:Co(48),type:0},scaleType:1},"🯲":{type:5,data:{d:Co(109),type:0},scaleType:1},"🯳":{type:5,data:{d:Co(121),type:0},scaleType:1},"🯴":{type:5,data:{d:Co(51),type:0},scaleType:1},"🯵":{type:5,data:{d:Co(91),type:0},scaleType:1},"🯶":{type:5,data:{d:Co(95),type:0},scaleType:1},"🯷":{type:5,data:{d:Co(114),type:0},scaleType:1},"🯸":{type:5,data:{d:Co(127),type:0},scaleType:1},"🯹":{type:5,data:{d:Co(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}]))},vT=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,u=e>>i*2+1&1;l&&u?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`):u&&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 Co(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,u=.5-.015;t.push(`M${n},${l} L${i},${l+.0375} L${i},${u-.0375} L${n},${u} L${r},${u-.0375} L${r},${l+.0375} Z`)}if(e&16){let r=.7999999999999999,n=.95-.15/2,i=.95,l=.5+.015,u=.825-.075-.015;t.push(`M${n},${l} L${i},${l+.0375} L${i},${u-.0375} L${n},${u} L${r},${u-.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 di=0,Zs=0,So=!1,Jo=!1,td=!1,Ki,v0=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,Zs=0,di=0,Jo=!1,So=!1,td=!1,Ki=this._themeService.colors,v0=0;let l=e.getCode();if(l!==0&&e.extended.underlineStyle===4){let u=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));v0=t*n%(Math.round(u)*2)}if(v0===0&&vT.has(l)&&(v0=t*n%2*2+r*i%2),this._decorationService.forEachDecorationAtCell(t,r,"bottom",u=>{u.backgroundColorRGB&&(Zs=u.backgroundColorRGB.rgba>>8&16777215,Jo=!0),u.foregroundColorRGB&&(di=u.foregroundColorRGB.rgba>>8&16777215,So=!0)}),td=this._selectionRenderModel.isCellSelected(this._terminal,t,r),td){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Zs=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Zs=(this.result.fg&16777215)<<8|255;break;default:Zs=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Zs=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Zs=(this.result.bg&16777215)<<8|255;break}Zs=rc.blend(Zs,(this._coreBrowserService.isFocused?Ki.selectionBackgroundOpaque:Ki.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Zs=(this._coreBrowserService.isFocused?Ki.selectionBackgroundOpaque:Ki.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Jo=!0,Ki.selectionForeground&&(di=Ki.selectionForeground.rgba>>8&16777215,So=!0),l3(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)di=(this._coreBrowserService.isFocused?Ki.selectionBackgroundOpaque:Ki.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:di=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:di=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:di=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:di=(this.result.fg&16777215)<<8|255;break;default:di=this._themeService.colors.foreground.rgba}di=rc.blend(di,(this._coreBrowserService.isFocused?Ki.selectionBackgroundOpaque:Ki.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}So=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",u=>{u.backgroundColorRGB&&(Zs=u.backgroundColorRGB.rgba>>8&16777215,Jo=!0),u.foregroundColorRGB&&(di=u.foregroundColorRGB.rgba>>8&16777215,So=!0)}),Jo&&(td?Zs=e.bg&-16777216&-134217729|Zs|50331648:Zs=e.bg&-16777216|Zs|50331648),So&&(di=e.fg&-16777216&-67108865|di|50331648),this.result.fg&67108864&&(Jo&&!So&&((this.result.bg&50331648)===0?di=this.result.fg&-134217728|Ki.background.rgba>>8&16777215&16777215|50331648:di=this.result.fg&-134217728|this.result.bg&67108863,So=!0),!Jo&&So&&((this.result.fg&50331648)===0?Zs=this.result.bg&-67108864|Ki.foreground.rgba>>8&16777215&16777215|50331648:Zs=this.result.bg&-67108864|this.result.fg&67108863,Jo=!0)),Ki=void 0,this.result.bg=Jo?Zs:this.result.bg,this.result.fg=So?di:this.result.fg,this.result.ext&=536870911,this.result.ext|=v0<<29&3758096384}},AT=.5,c3=lT||cT?"bottom":"ideographic";function TT(e,t,r,n,i,l,u,h,p,g,x,b,w=0){let A=yT[t];if(A){let k=Array.isArray(A)?A:[A];for(let I of k)CT(e,I,r,n,i,l,u,h,p,g,x,b,w);return!0}return!1}function CT(e,t,r,n,i,l,u,h,p,g,x,b,w=0){let A=i,k=l,I=r,N=n;switch(t.scaleType===1&&(A=u,k=h,I=r+(i-u)/2,N=n+(l-h)/2),t.clipPath&&(e.save(),NT(e,t.clipPath,I,N,A,k)),t.type){case 0:ST(e,t.data,I,N,A,k);break;case 1:ET(e,t.data,I,N,A,k,w);break;case 2:RT(e,t.data,I,N,A,k,g,x,t.strokeWidth);break;case 3:LT(e,t.data,I,N,A,k,g,t.strokeWidth);break;case 4:IT(e,t.data,I,N,A,k,g,b);break;case 5:MT(e,t.data,I,N,A,k,p,g,x);break;case 6:_T(e,t.data,I,N,A,k);break}t.clipPath&&e.restore()}function ST(e,t,r,n,i,l){for(let u=0;u<t.length;u++){let h=t[u],p=i/8,g=l/8;e.fillRect(r+h.x*p,n+h.y*g,h.w*p,h.h*g)}}var Gm=new Uint8Array([1,0,1,2,1,4,5,0,5,2,5,4,1,6,5,6]);function _T(e,t,r,n,i,l){let u=i/8,h=l*.1,p=l*.8/8,g=Math.min(u,p);for(let x=0;x<8;x++)if(t&1<<x){let b=Gm[x*2],w=Gm[x*2+1],A=r+(b+1)*u,k=n+h+(w+1)*p;e.beginPath(),e.arc(A,k,g,0,Math.PI*2),e.fill()}}function LT(e,t,r,n,i,l,u,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 I=k[0],N=k.substring(1).split(",");if(I==="Z"){e.closePath(),A=I;continue}if(I==="V"){let D=n+parseFloat(N[0])*l;e.lineTo(g,D),x=D,b=g,w=x,A=I;continue}if(I==="H"){let D=r+parseFloat(N[0])*i;e.lineTo(D,x),g=D,b=g,w=x,A=I;continue}if(!N[0]||!N[1])continue;if(I==="A"){let D=parseFloat(N[0])*i,O=parseFloat(N[1])*l,q=parseFloat(N[2])*Math.PI/180,Y=parseInt(N[3],10),U=parseInt(N[4],10),V=r+parseFloat(N[5])*i,me=n+parseFloat(N[6])*l;kT(e,g,x,D,O,q,Y,U,V,me),g=V,x=me;continue}let R=N.map((D,O)=>{let q=parseFloat(D);return O%2===0?r+q*i:n+q*l});if(I==="M")e.moveTo(R[0],R[1]),g=R[0],x=R[1],b=g,w=x;else if(I==="L")e.lineTo(R[0],R[1]),g=R[0],x=R[1],b=g,w=x;else if(I==="Q")e.quadraticCurveTo(R[0],R[1],R[2],R[3]),b=R[0],w=R[1],g=R[2],x=R[3];else if(I==="T"){let D,O;A==="Q"||A==="T"?(D=2*g-b,O=2*x-w):(D=g,O=x),e.quadraticCurveTo(D,O,R[0],R[1]),b=D,w=O,g=R[0],x=R[1]}else I==="C"&&(e.bezierCurveTo(R[0],R[1],R[2],R[3],R[4],R[5]),b=R[2],w=R[3],g=R[4],x=R[5]);A=I}h!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=u*h,e.stroke()):e.fill()}function kT(e,t,r,n,i,l,u,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,I=-b*w+x*A,N=n*n,R=i*i,D=k*k,O=I*I,q=D/N+O/R;if(q>1){let de=Math.sqrt(q);n*=de,i*=de,N=n*n,R=i*i}let Y=(N*R-N*O-R*D)/(N*O+R*D);Y<0&&(Y=0);let U=(u===h?-1:1)*Math.sqrt(Y),V=U*(n*I/i),me=U*-(i*k/n),Je=x*V-b*me+(t+p)/2,ve=b*V+x*me+(r+g)/2,_e=(k-V)/n,Ze=(I-me)/i,Ve=(-k-V)/n,ce=(-I-me)/i,ke=Math.atan2(Ze,_e),ot=Math.atan2(ce,Ve)-ke;h===0&&ot>0?ot-=2*Math.PI:h===1&&ot<0&&(ot+=2*Math.PI);let Ie=ke+ot;e.ellipse(Je,ve,n,i,l,ke,Ie,h===0)}function IT(e,t,r,n,i,l,u,h){e.save(),e.fillRect(r,n,i,l),h&&(e.fillStyle=h,e.strokeStyle=h),e.lineWidth=u,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 Vm=new Map;function ET(e,t,r,n,i,l,u=0){let h=Vm.get(t);h||(h=new Map,Vm.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 I=Ps(k.getContext("2d")),N=new ImageData(w,A),R,D,O,q;if(p.startsWith("#"))R=parseInt(p.slice(1,3),16),D=parseInt(p.slice(3,5),16),O=parseInt(p.slice(5,7),16),q=p.length>7&&parseInt(p.slice(7,9),16)||1;else if(p.startsWith("rgba"))[R,D,O,q]=p.substring(5,p.length-1).split(",").map(Y=>parseFloat(Y));else throw new Error(`Unexpected fillStyle color format "${p}" when drawing pattern glyph`);for(let Y=0;Y<A;Y++)for(let U=0;U<w;U++)N.data[(Y*w+U)*4]=R,N.data[(Y*w+U)*4+1]=D,N.data[(Y*w+U)*4+2]=O,N.data[(Y*w+U)*4+3]=t[Y][U]*(q*255);I.putImageData(N,0,0),g=Ps(e.createPattern(k,null)),h.set(p,g)}let x=u>>1&1,b=u&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 RT(e,t,r,n,i,l,u,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=u3[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,d3(k,i,l,r,n,!0,u,0,0,!1),x),x.lastCommand=w)}p!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=u*p,e.stroke()):e.fill(),e.closePath(),e.restore()}function NT(e,t,r,n,i,l){e.beginPath();for(let u of t.split(" ")){let h=u[0];if(h==="Z"){e.closePath();continue}let p=u.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 MT(e,t,r,n,i,l,u,h,p){let g=new Path2D;g.rect(r,n,i,l),e.clip(g),e.beginPath();let x=u/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=u3[A];if(!k){p.error(`Could not find drawing instructions for "${A}"`);continue}let I=w.substring(1).split(",");!I[0]||!I[1]||(k(e,d3(I,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 qm(e,t,r=0){return Math.max(Math.min(e,t),r)}var u3={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 d3(e,t,r,n,i,l,u,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*u-p*u,l&&x[b]!==0){let w=Math.round(x[b]+.5)-.5;x[b]=g?qm(w,t,0):w}x[b]+=n+h*u}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?qm(w,r,0):w}x[b]+=i}return x}var Ym=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={}}},Zm=class{constructor(){this._data=new Ym}set(e,t,r,n,i){this._data.get(e,t)||this._data.set(e,t,new Ym),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()}},h3=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()}},DT=class extends h3{_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())}}},BT=class extends h3{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},QT="requestIdleCallback"in globalThis?BT:DT,zc=class f3{constructor(){this.fg=0,this.bg=0,this.extended=new p3}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 f3;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}},p3=class m3{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 m3(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},po=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,n)=>{if(this._disposed)return Gs(()=>{});let i={fn:t,thisArgs:r};this._listeners.push(i);let l=Gs(()=>{let u=this._listeners.indexOf(i);u!==-1&&this._listeners.splice(u,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)}},ec;(e=>{function t(l,u){return l(h=>u.fire(h))}e.forward=t;function r(l,u){return(h,p,g)=>l(x=>h.call(p,u(x)),void 0,g)}e.map=r;function n(...l){return(u,h,p)=>{let g=new i3;for(let x of l)g.add(x(b=>u.call(h,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function i(l,u,h){return u(h),l(p=>u(p))}e.runAndSubscribe=i})(ec||={});var Km={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}},w0=2,A0,Ll=class Fc{constructor(t,r,n,i){this._document=t,this._config=r,this._unicodeService=n,this._logService=i,this._didWarmUp=!1,this._cacheMap=new Zm,this._cacheMapCombined=new Zm,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new zc,this._textureSize=512,this._onAddTextureAtlasCanvas=new po,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new po,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=x3(t,this._config.deviceCellWidth*4+w0*2,this._config.deviceCellHeight+w0*2),this._tmpCtx=Ps(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 QT(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(Fc.maxAtlasPages&&this._pages.length>=Math.max(4,Fc.maxAtlasPages)){let r=this._pages.filter(g=>g.canvas.width*2<=(Fc.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 Wl(this._document,this._textureSize);return this._pages.push(g),this._activePages.push(g),this._onAddTextureAtlasCanvas.fire(g.canvas),g}let u=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=++Wl.nextVersion;for(let g=u.length-1;g>=0;g--)this._deletePage(u[g]);this.pages.push(p),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(p.canvas)}let t=new Wl(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 Wl(this._document,n,t);for(let[l,u]of t.entries()){let h=l*u.canvas.width%n,p=Math.floor(l/2)*u.canvas.height;i.ctx.drawImage(u.canvas,h,p);for(let x of u.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(u.canvas);let g=this._activePages.indexOf(u);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=++Wl.nextVersion}}getRasterizedGlyphCombinedChar(t,r,n,i,l,u){return this._getFromCacheMap(this._cacheMapCombined,t,r,n,i,l,u)}getRasterizedGlyph(t,r,n,i,l,u){return this._getFromCacheMap(this._cacheMap,t,r,n,i,l,u)}_getFromCacheMap(t,r,n,i,l,u,h){return A0=t.get(r,n,i,l),A0||(A0=this._drawToCache(r,n,i,l,u,h),t.set(r,n,i,l,A0)),A0}_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 $a;let l;switch(t){case 16777216:case 33554432:l=this._getColorFromAnsiIndex(r);break;case 50331648:let u=zc.toColorRGB(r);l=Ui.toColor(u[0],u[1],u[2]);break;default:n?l=J0.opaque(this._config.colors.foreground):l=this._config.colors.background;break}return this._config.allowTransparency||(l=J0.opaque(l)),l}_getForegroundColor(t,r,n,i,l,u,h,p,g,x){let b=this._getMinimumContrastColor(t,r,n,i,l,u,h,g,p,x);if(b)return b;let w;switch(l){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&g&&u<8&&(u+=8),w=this._getColorFromAnsiIndex(u);break;case 50331648:let A=zc.toColorRGB(u);w=Ui.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=J0.opaque(w)),p&&(w=J0.multiplyOpacity(w,AT)),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,u,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,u,h,p),I=rc.ensureContrastRatio(A,k,this._config.minimumContrastRatio/(g?2:1));if(!I){b.setColor(t,i,null);return}let N=Ui.toColor(I>>24&255,I>>16&255,I>>8&255);return b.setColor(t,i,N),N}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,n,i,l,u){let h=typeof t=="number"?String.fromCharCode(t):t;u&&this._tmpCanvas.parentElement!==u&&(this._tmpCanvas.style.display="none",u.append(this._tmpCanvas));let p=Math.min(this._config.deviceCellWidth*Math.max(h.length,2)+w0*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<p&&(this._tmpCanvas.width=p);let g=Math.min(this._config.deviceCellHeight+w0*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 Km;let x=!!this._workAttributeData.isBold(),b=!!this._workAttributeData.isInverse(),w=!!this._workAttributeData.isDim(),A=!!this._workAttributeData.isItalic(),k=!!this._workAttributeData.isUnderline(),I=!!this._workAttributeData.isStrikethrough(),N=!!this._workAttributeData.isOverline(),R=this._workAttributeData.getFgColor(),D=this._workAttributeData.getFgColorMode(),O=this._workAttributeData.getBgColor(),q=this._workAttributeData.getBgColorMode();if(b){let xe=R;R=O,O=xe;let te=D;D=q,q=te}let Y=this._getBackgroundColor(q,O,b,w);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=Y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let U=x?this._config.fontWeightBold:this._config.fontWeight,V=A?"italic":"";this._tmpCtx.font=`${V} ${U} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=c3;let me=h.length===1&&h1(h.charCodeAt(0)),Je=h.length===1&&hT(h.charCodeAt(0)),ve=this._getForegroundColor(r,q,O,n,D,R,b,w,x,l3(h.charCodeAt(0)));this._tmpCtx.fillStyle=ve.css;let _e=Je?0:w0*2,Ze=!1;if(this._config.customGlyphs!==!1){let xe=this._workAttributeData.getUnderlineVariantOffset();Ze=TT(this._tmpCtx,h,_e,_e,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.deviceCharWidth,this._config.deviceCharHeight,this._config.fontSize,this._config.devicePixelRatio,this._logService,Y.css,xe)}let Ve=!me,ce;if(typeof t=="number"?ce=this._unicodeService.wcwidth(t):ce=this._unicodeService.getStringCellWidth(t),k){this._tmpCtx.save();let xe=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),te=xe%2===1?.5:0;if(this._tmpCtx.lineWidth=xe,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Ve=!1,this._tmpCtx.strokeStyle=`rgb(${zc.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Ve=!1;let Oe=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Oe<8&&(Oe+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Oe).css}this._tmpCtx.fillStyle=this._tmpCtx.strokeStyle,this._tmpCtx.beginPath();let re=_e,ge=Math.ceil(_e+this._config.deviceCharHeight)-te-(l?xe*2:0),ze=ge+xe*2,Ke=this._workAttributeData.getUnderlineVariantOffset(),Ae=0,z=0;for(let Oe=0;Oe<ce;Oe++){let nt=!1;this._tmpCtx.save(),Ae=ge,z=ze;let Re=re+Oe*this._config.deviceCellWidth,X=re+(Oe+1)*this._config.deviceCellWidth;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Re,ge),this._tmpCtx.lineTo(X,ge),this._tmpCtx.moveTo(Re,ze),this._tmpCtx.lineTo(X,ze);break;case 3:Ae=this._config.deviceCharHeight+1,z=Ae+3*this._config.devicePixelRatio;let Be=new Path2D;Be.rect(Re,Ae,this._config.deviceCellWidth,z-Ae),this._tmpCtx.clip(Be);let st=this._config.deviceCellWidth,be=z-Ae,je=st/6,wt=be/3,Te=[[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 yt of Te){this._tmpCtx.beginPath();for(let bt=0;bt<yt.length;bt+=2){let _t=Re+yt[bt]*je,Qt=z-yt[bt+1]*wt;bt===0?this._tmpCtx.moveTo(_t,Qt):this._tmpCtx.lineTo(_t,Qt)}this._tmpCtx.closePath(),this._tmpCtx.fill()}nt=!0;break;case 4:let pe=Ke===0?0:Ke>=xe?xe*2-Ke:xe-Ke;Ke>=xe||pe===0?(this._tmpCtx.setLineDash([Math.round(xe),Math.round(xe)]),this._tmpCtx.moveTo(Re+pe,ge),this._tmpCtx.lineTo(X,ge)):(this._tmpCtx.setLineDash([Math.round(xe),Math.round(xe)]),this._tmpCtx.moveTo(Re,ge),this._tmpCtx.lineTo(Re+pe,ge),this._tmpCtx.moveTo(Re+pe+xe,ge),this._tmpCtx.lineTo(X,ge)),Ke=bT(X-Re,xe,Ke);break;case 5:let $e=.6,pt=.3,Tt=X-Re,Ct=Math.floor($e*Tt),rr=Math.floor(pt*Tt),ir=Tt-Ct-rr;this._tmpCtx.setLineDash([Ct,rr,ir]),this._tmpCtx.moveTo(Re,ge),this._tmpCtx.lineTo(X,ge);break;default:this._tmpCtx.moveTo(Re,ge),this._tmpCtx.lineTo(X,ge);break}nt||this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Ze&&this._config.fontSize>=12&&!this._config.allowTransparency&&h!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Oe=this._tmpCtx.measureText(h);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Oe&&Oe.actualBoundingBoxDescent>0){this._tmpCtx.save();let nt=new Path2D;nt.rect(re,Ae-Math.ceil(xe/2),this._config.deviceCellWidth*ce,z-Ae+Math.ceil(xe/2)),this._tmpCtx.clip(nt),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=Y.css,this._tmpCtx.strokeText(h,_e,_e+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(N){let xe=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),te=xe%2===1?.5:0;this._tmpCtx.lineWidth=xe,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(_e,_e+te),this._tmpCtx.lineTo(_e+this._config.deviceCharWidth*ce,_e+te),this._tmpCtx.stroke()}if(Ze||this._tmpCtx.fillText(h,_e,_e+this._config.deviceCharHeight),h==="_"&&!this._config.allowTransparency){let xe=sf(this._tmpCtx.getImageData(_e,_e,this._config.deviceCellWidth,this._config.deviceCellHeight),Y,ve,Ve);if(xe)for(let te=1;te<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=Y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(h,_e,_e+this._config.deviceCharHeight-te),xe=sf(this._tmpCtx.getImageData(_e,_e,this._config.deviceCellWidth,this._config.deviceCellHeight),Y,ve,Ve),!!xe);te++);}if(I){let xe=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),te=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=xe,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(_e,_e+Math.floor(this._config.deviceCharHeight/2)-te),this._tmpCtx.lineTo(_e+this._config.deviceCharWidth*ce,_e+Math.floor(this._config.deviceCharHeight/2)-te),this._tmpCtx.stroke()}this._tmpCtx.restore();let ke=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),ot;if(this._config.allowTransparency?ot=jT(ke):ot=sf(ke,Y,ve,Ve),ot)return Km;let Ie=this._findGlyphBoundingBox(ke,this._workBoundingBox,p,Je,Ze,_e),de,qe;for(;;){if(this._activePages.length===0){let xe=this._createNewPage();de=xe,qe=xe.currentRow,qe.height=Ie.size.y;break}de=this._activePages[this._activePages.length-1],qe=de.currentRow;for(let xe of this._activePages)Ie.size.y<=xe.currentRow.height&&(de=xe,qe=xe.currentRow);for(let xe=this._activePages.length-1;xe>=0;xe--)for(let te of this._activePages[xe].fixedRows)te.height<=qe.height&&Ie.size.y<=te.height&&(de=this._activePages[xe],qe=te);if(Ie.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Wl(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),de=this._overflowSizePage,qe=this._overflowSizePage.currentRow,qe.x+Ie.size.x>=de.canvas.width&&(qe.x=0,qe.y+=qe.height,qe.height=0);break}if(qe.y+Ie.size.y>=de.canvas.height||qe.height>Ie.size.y+2){let xe=!1;if(de.currentRow.y+de.currentRow.height+Ie.size.y>=de.canvas.height){let te;for(let re of this._activePages)if(re.currentRow.y+re.currentRow.height+Ie.size.y<re.canvas.height){te=re;break}if(te)de=te;else if(Fc.maxAtlasPages&&this._pages.length>=Fc.maxAtlasPages&&qe.y+Ie.size.y<=de.canvas.height&&qe.height>=Ie.size.y&&qe.x+Ie.size.x<=de.canvas.width)xe=!0;else{let re=this._createNewPage();de=re,qe=re.currentRow,qe.height=Ie.size.y,xe=!0}}xe||(de.currentRow.height>0&&de.fixedRows.push(de.currentRow),qe={x:0,y:de.currentRow.y+de.currentRow.height,height:Ie.size.y},de.fixedRows.push(qe),de.currentRow={x:0,y:qe.y+qe.height,height:0})}if(qe.x+Ie.size.x<=de.canvas.width)break;qe===de.currentRow?(qe.x=0,qe.y+=qe.height,qe.height=0):de.fixedRows.splice(de.fixedRows.indexOf(qe),1)}return Ie.texturePage=this._pages.indexOf(de),Ie.texturePosition.x=qe.x,Ie.texturePosition.y=qe.y,Ie.texturePositionClipSpace.x=qe.x/de.canvas.width,Ie.texturePositionClipSpace.y=qe.y/de.canvas.height,Ie.sizeClipSpace.x/=de.canvas.width,Ie.sizeClipSpace.y/=de.canvas.height,qe.height=Math.max(qe.height,Ie.size.y),qe.x+=Ie.size.x,de.ctx.putImageData(ke,Ie.texturePosition.x-this._workBoundingBox.left,Ie.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,Ie.size.x,Ie.size.y),de.addGlyph(Ie),de.version=++Wl.nextVersion,Ie}_findGlyphBoundingBox(t,r,n,i,l,u){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<u+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=u+p-1;x>=u;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+u+(i||l?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+u+(i||l?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},g3=class Ap{constructor(t,r,n){if(this._usedPixels=0,this._glyphs=[],this.version=++Ap.nextVersion,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],this.canvas=x3(t,r,r),this.ctx=Ps(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=++Ap.nextVersion}};g3.nextVersion=0;var Wl=g3;function sf(e,t,r,n){let i=t.rgba>>>24,l=t.rgba>>>16&255,u=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(u-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]===u||n&&Math.abs(e.data[w]-i)+Math.abs(e.data[w+1]-l)+Math.abs(e.data[w+2]-u)<x?e.data[w+3]=0:b=!1;return b}function jT(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function x3(e,t,r){let n=e.createElement("canvas");return n.width=t,n.height=r,n}function PT(e,t,r,n,i,l,u,h,p=!0){let g={foreground:l.foreground,background:l.background,cursor:$a,cursorAccent:$a,selectionForeground:$a,selectionBackgroundTransparent:$a,selectionBackgroundOpaque:$a,selectionInactiveBackgroundTransparent:$a,selectionInactiveBackgroundOpaque:$a,overviewRulerBorder:$a,scrollbarSliderBackground:$a,scrollbarSliderHoverBackground:$a,scrollbarSliderActiveBackground:$a,ansi:l.ansi.slice(),contrastCache:l.contrastCache,halfContrastCache:l.halfContrastCache};return{customGlyphs:p,devicePixelRatio:u,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 Xm(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 OT(e){return(e&50331648)===16777216||(e&50331648)===33554432}var za=[];function b3(e,t,r,n,i,l,u,h,p,g=!0){let x=PT(n,i,l,u,t,r,h,p,g);for(let k=0;k<za.length;k++){let I=za[k],N=I.ownedBy.indexOf(e);if(N>=0){if(Xm(I.config,x))return I.atlas;I.ownedBy.length===1?(I.atlas.dispose(),za.splice(k,1)):I.ownedBy.splice(N,1);break}}for(let k=0;k<za.length;k++){let I=za[k];if(Xm(I.config,x))return I.ownedBy.push(e),I.atlas}let b=e._core,w=b._logService,A={atlas:new Ll(document,x,b.unicodeService,w),config:x,ownedBy:[e]};return za.push(A),A.atlas}function Jm(e){for(let t=0;t<za.length;t++){let r=za[t].ownedBy.indexOf(e);if(r!==-1){za[t].ownedBy.length===1?(za[t].atlas.dispose(),za.splice(t,1)):za[t].ownedBy.splice(r,1);break}}}var FT=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 eg(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 u=l.devicePixelContentBoxSize[0].inlineSize,h=l.devicePixelContentBoxSize[0].blockSize;u>0&&h>0&&r(u,h)});try{n.observe(e,{box:["device-pixel-content-box"]})}catch{n.disconnect(),n=void 0}return Gs(()=>n?.disconnect())}function UT(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var $T=class y3 extends zc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new p3,this.combinedData=""}static fromCharData(t){let r=new y3;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?UT(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())}},zT=class extends dc{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(Gs(()=>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)}},v3=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function w3(e,t,r,n){let i=Ps(e.createProgram());if(e.attachShader(i,Ps(tg(e,e.VERTEX_SHADER,t,n))),e.attachShader(i,Ps(tg(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 tg(e,t,r,n){let i=Ps(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 HT(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 WT=class{constructor(t){this.texture=t,this.version=-1}},GT=`#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 VT(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 Cs=0,ls,af=0,T0=0,qT=class extends dc{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 u=this._gl;Ll.maxAtlasPages===void 0&&(Ll.maxAtlasPages=Math.min(32,Ps(u.getParameter(u.MAX_TEXTURE_IMAGE_UNITS))),Ll.maxTextureSize=Ps(u.getParameter(u.MAX_TEXTURE_SIZE))),this._program=Ps(w3(u,GT,VT(Ll.maxAtlasPages),this._logService)),this._register(Gs(()=>u.deleteProgram(this._program))),this._projectionLocation=Ps(u.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Ps(u.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Ps(u.getUniformLocation(this._program,"u_texture"));let h=this._vertexArrayObject=u.createVertexArray();this._register(Gs(()=>u.deleteVertexArray(h))),u.bindVertexArray(h);let p=new Float32Array([0,0,1,0,0,1,1,1]),g=u.createBuffer();this._register(Gs(()=>u.deleteBuffer(g))),u.bindBuffer(u.ARRAY_BUFFER,g),u.bufferData(u.ARRAY_BUFFER,p,u.STATIC_DRAW),u.enableVertexAttribArray(0),u.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let x=new Uint8Array([0,1,2,3]),b=u.createBuffer();this._register(Gs(()=>u.deleteBuffer(b))),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,b),u.bufferData(u.ELEMENT_ARRAY_BUFFER,x,u.STATIC_DRAW),this._attributesBuffer=Ps(u.createBuffer()),this._register(Gs(()=>u.deleteBuffer(this._attributesBuffer))),u.bindBuffer(u.ARRAY_BUFFER,this._attributesBuffer),u.enableVertexAttribArray(2),u.vertexAttribPointer(2,2,u.FLOAT,!1,44,0),u.vertexAttribDivisor(2,1),u.enableVertexAttribArray(3),u.vertexAttribPointer(3,2,u.FLOAT,!1,44,2*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(3,1),u.enableVertexAttribArray(4),u.vertexAttribPointer(4,1,u.FLOAT,!1,44,4*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(4,1),u.enableVertexAttribArray(5),u.vertexAttribPointer(5,2,u.FLOAT,!1,44,5*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(5,1),u.enableVertexAttribArray(6),u.vertexAttribPointer(6,2,u.FLOAT,!1,44,7*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(6,1),u.enableVertexAttribArray(1),u.vertexAttribPointer(1,2,u.FLOAT,!1,44,9*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(1,1),u.useProgram(this._program);let w=new Int32Array(Ll.maxAtlasPages);for(let A=0;A<Ll.maxAtlasPages;A++)w[A]=A;u.uniform1iv(this._textureLocation,w),u.uniformMatrix4fv(this._projectionLocation,!1,v3),this._atlasTextures=[];for(let A=0;A<Ll.maxAtlasPages;A++){let k=new WT(Ps(u.createTexture()));this._register(Gs(()=>u.deleteTexture(k.texture))),u.activeTexture(u.TEXTURE0+A),u.bindTexture(u.TEXTURE_2D,k.texture),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[A]=k}u.enable(u.BLEND),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,r,n,i,l,u,h,p,g){this._updateCell(this._vertices.attributes,t,r,n,i,l,u,h,p,g)}_updateCell(t,r,n,i,l,u,h,p,g,x){if(Cs=(n*this._terminal.cols+r)*11,i===0||i===void 0){t.fill(0,Cs,Cs+11-1-2);return}this._atlas&&(p&&p.length>1?ls=this._atlas.getRasterizedGlyphCombinedChar(p,l,u,h,!1,this._terminal.element):ls=this._atlas.getRasterizedGlyph(i,l,u,h,!1,this._terminal.element),af=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),l!==x&&ls.offset.x>af?(T0=ls.offset.x-af,t[Cs]=-(ls.offset.x-T0)+this._dimensions.device.char.left,t[Cs+1]=-ls.offset.y+this._dimensions.device.char.top,t[Cs+2]=(ls.size.x-T0)/this._dimensions.device.canvas.width,t[Cs+3]=ls.size.y/this._dimensions.device.canvas.height,t[Cs+4]=ls.texturePage,t[Cs+5]=ls.texturePositionClipSpace.x+T0/this._atlas.pages[ls.texturePage].canvas.width,t[Cs+6]=ls.texturePositionClipSpace.y,t[Cs+7]=ls.sizeClipSpace.x-T0/this._atlas.pages[ls.texturePage].canvas.width,t[Cs+8]=ls.sizeClipSpace.y):(t[Cs]=-ls.offset.x+this._dimensions.device.char.left,t[Cs+1]=-ls.offset.y+this._dimensions.device.char.top,t[Cs+2]=ls.size.x/this._dimensions.device.canvas.width,t[Cs+3]=ls.size.y/this._dimensions.device.canvas.height,t[Cs+4]=ls.texturePage,t[Cs+5]=ls.texturePositionClipSpace.x,t[Cs+6]=ls.texturePositionClipSpace.y,t[Cs+7]=ls.sizeClipSpace.x,t[Cs+8]=ls.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&gT(i,g,ls.size.x,this._dimensions.device.cell.width)&&(t[Cs+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 u=l*this._terminal.cols*11,h=this._vertices.attributes.subarray(u,u+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}},YT=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,u=r[1]-l,h=n[1]-l,p=Math.max(u,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=u,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 ZT(){return new YT}var KT=2147483648,XT=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=ZT()}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)}},JT=`#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
|
-
}`,eC=`#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
|
-
}`,Bo=8,of=Bo*Float32Array.BYTES_PER_ELEMENT,tC=20*Bo,rg=class{constructor(){this.attributes=new Float32Array(tC),this.count=0}},el=0,ng=0,sg=0,ig=0,ag=0,og=0,lg=0,rC=class extends dc{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 rg,this._verticesCursor=new rg;let u=this._gl;this._program=Ps(w3(u,JT,eC,this._logService)),this._register(Gs(()=>u.deleteProgram(this._program))),this._projectionLocation=Ps(u.getUniformLocation(this._program,"u_projection"));let h=this._vertexArrayObject=u.createVertexArray();this._register(Gs(()=>u.deleteVertexArray(h))),u.bindVertexArray(h);let p=new Float32Array([0,0,1,0,0,1,1,1]),g=u.createBuffer();this._register(Gs(()=>u.deleteBuffer(g))),u.bindBuffer(u.ARRAY_BUFFER,g),u.bufferData(u.ARRAY_BUFFER,p,u.STATIC_DRAW),u.enableVertexAttribArray(3),u.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let x=new Uint8Array([0,1,2,3]),b=u.createBuffer();this._register(Gs(()=>u.deleteBuffer(b))),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,b),u.bufferData(u.ELEMENT_ARRAY_BUFFER,x,u.STATIC_DRAW),this._attributesBuffer=Ps(u.createBuffer()),this._register(Gs(()=>u.deleteBuffer(this._attributesBuffer))),u.bindBuffer(u.ARRAY_BUFFER,this._attributesBuffer),u.enableVertexAttribArray(0),u.vertexAttribPointer(0,2,u.FLOAT,!1,of,0),u.vertexAttribDivisor(0,1),u.enableVertexAttribArray(1),u.vertexAttribPointer(1,2,u.FLOAT,!1,of,2*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(1,1),u.enableVertexAttribArray(2),u.vertexAttribPointer(2,4,u.FLOAT,!1,of,4*Float32Array.BYTES_PER_ELEMENT),u.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,v3),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,u,h,p,g,x,b,w,A,k,I;for(l=0;l<r.rows;l++){for(h=-1,p=0,g=0,x=!1,u=0;u<r.cols;u++)b=(l*r.cols+u)*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)&&(I=i++*Bo,this._updateRectangle(n,I,g,p,h,u,l)),h=u,p=w,g=A,x=k);(p!==0||x&&g!==0)&&(I=i++*Bo,this._updateRectangle(n,I,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++*Bo,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++*Bo,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++*Bo,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++*Bo,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,u,h){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:el=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:el=(n&16777215)<<8;break;default:el=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:el=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:el=(i&16777215)<<8;break;default:el=this._themeService.colors.background.rgba}t.attributes.length<r+Bo&&(t.attributes=HT(t.attributes,(this._terminal.rows*this._terminal.cols+1)*Bo)),ng=l*this._dimensions.device.cell.width,sg=h*this._dimensions.device.cell.height,ig=(el>>24&255)/255,ag=(el>>16&255)/255,og=(el>>8&255)/255,lg=1,this._addRectangle(t.attributes,r,ng,sg,(u-l)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,ig,ag,og,lg)}_addRectangle(t,r,n,i,l,u,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]=u/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,u,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]=u/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])}},nC=class extends dc{constructor(e,t,r,n,i,l,u,h){super(),this._container=t,this._alpha=i,this._coreBrowserService=l,this._optionsService=u,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(Gs(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Ps(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=b3(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=c3,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}`}},sC=class extends nC{constructor(t,r,n,i,l,u,h){super(n,t,"link",r,!0,l,u,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&&OT(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 lf(e,t,r,n){return new iC(e,t,r,n)}var aC=class extends dc{constructor(e,t,r,n,i,l,u,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=u,this._optionsService=h,this._themeService=p,this._customGlyphs=g,this._cursorBlinkStateManager=this._register(new y0),this._charAtlasDisposable=this._register(new y0),this._observerDisposable=this._register(new y0),this._model=new XT,this._rowHasBlinkingCells=[],this._rowHasBlinkingCellsCount=0,this._workCell=new $T,this._rectangleRenderer=this._register(new y0),this._glyphRenderer=this._register(new y0),this._onChangeTextureAtlas=this._register(new po),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new po),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new po),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new po),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new po),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 sC(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,h,this._themeService)],this.dimensions=xT(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(h.onOptionChange(()=>this._handleOptionsChanged())),this._textBlinkStateManager=this._register(new zT(()=>this._requestRedrawViewport(),this._coreBrowserService,this._optionsService)),this._resetBlinkingRowState(),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(lf(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(lf(this._canvas,"webglcontextrestored",w=>{this._logService.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Jm(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=eg(this._canvas,this._coreBrowserService.window,(w,A)=>this._setCanvasDevicePixelDimensions(w,A)),this._register(this._coreBrowserService.onWindowChange(w=>{this._observerDisposable.value=eg(this._canvas,w,(A,k)=>this._setCanvasDevicePixelDimensions(A,k))})),this._register(lf(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(Gs(()=>{clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0;for(let w of this._renderLayers)w.dispose();this._canvas.parentElement?.removeChild(this._canvas),Jm(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 rC(this._terminal,this._gl,this.dimensions,this._themeService,this._logService),this._glyphRenderer.value=new qT(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=b3(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=aT(ec.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),ec.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 FT(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,n=this._workCell,i,l,u,h,p,g,x,b,w,A,k,I,N,R,D,O,q;e=cg(e,r.rows-1,0),t=cg(t,r.rows-1,0);let Y=this._coreService.decPrivateModes.cursorStyle??r.options.cursorStyle??"block",U=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,V=U-r.buffer.ydisp,me=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),Je=-1,ve=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let _e=!1;for(l=e;l<=t;l++){u=l+r.buffer.ydisp;let Ze=r.buffer.lines.get(u);if(!Ze){for(this._model.lineLengths[l]=0,O=0;O<r.cols;O++)q=(l*r.cols+O)*4,_e=!0,this._nullModelCell(O,l,q,0,0,0);this._setRowBlinkState(l,!1);continue}h=Ze;let Ve=!1;for(this._model.lineLengths[l]=0,k=U===u,x=0,p=this._characterJoinerService.getJoinedCharacters(u),O=0;O<r.cols;O++){if(i=this._cellColorResolver.result.bg,h.loadCell(O,n),O===0&&(i=this._cellColorResolver.result.bg),g=!1,b=O>=x,w=O,p.length>0&&O===p[0][0]&&b){A=p.shift();let ce=this._model.selection.isCellSelected(this._terminal,A[0],u);for(D=A[0]+1;D<A[1];D++)b&&=ce===this._model.selection.isCellSelected(this._terminal,D,u);b&&=!k||me<A[0]||me>=A[1],b?(g=!0,n=new oC(n,h.translateToString(!0,A[0],A[1]),A[1]-A[0]),w=A[1]-1):x=A[1]}if(I=n.getChars(),N=n.getCode(),D=(l*r.cols+O)*4,!Ve&&n.isBlink()&&(Ve=!0),this._cellColorResolver.resolve(n,O,u,this.dimensions.device.cell.width,this.dimensions.device.cell.height),ve&&u===U&&(O===me&&(this._model.cursor={x:me,y:V,width:n.getWidth(),style:this._coreBrowserService.isFocused?Y:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},Je=me+n.getWidth()-1),O>=me&&O<=Je&&(this._coreBrowserService.isFocused&&Y==="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),N!==0&&(this._model.lineLengths[l]=O+1),!(this._model.cells[D]===N&&this._model.cells[D+1]===this._cellColorResolver.result.bg&&this._model.cells[D+2]===this._cellColorResolver.result.fg&&this._model.cells[D+3]===this._cellColorResolver.result.ext)&&(_e=!0,I.length>1&&(N|=KT),this._model.cells[D]=N,this._model.cells[D+1]=this._cellColorResolver.result.bg,this._model.cells[D+2]=this._cellColorResolver.result.fg,this._model.cells[D+3]=this._cellColorResolver.result.ext,R=n.getWidth(),this._glyphRenderer.value.updateCell(O,l,N,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,I,R,i),g)){for(n=this._workCell,O++;O<=w;O++)q=(l*r.cols+O)*4,this._nullModelCell(O,l,q,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext);O--}}this._setRowBlinkState(l,Ve)}_e&&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})}},oC=class extends zc{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 cg(e,t,r=0){return Math.max(Math.min(e,t),r)}var lC=class extends dc{constructor(e){if(o3&&uT()<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 po),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new po),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new po),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new po),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,u=i._characterJoinerService,h=i._charSizeService,p=i._coreBrowserService,g=i._decorationService,x=i._logService,b=i._themeService;this._renderer=this._register(new aC(e,u,h,p,r,g,x,n,b,this._customGlyphs,this._preserveDrawingBuffer)),this._register(ec.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(ec.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(ec.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(ec.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this._register(Gs(()=>{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 cC=class{constructor(t,r,n,i={}){this._terminal=t,this._regex=r,this._handler=n,this._options=i}provideLinks(t,r){let n=dC.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 uC(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 dC=class Dd{static computeLink(t,r,n,i){let l=r.flags.includes("g")?r.flags:`${r.flags}g`,u=new RegExp(r.source,l),[h,p]=Dd._getWindowedLineStrings(t-1,n),g=h.join(""),x,b=[];for(;x=u.exec(g);){let w=x[0];if(!uC(w))continue;let[A,k]=Dd._mapStrIdx(n,p,0,x.index),[I,N]=Dd._mapStrIdx(n,A,k,w.length);if(A===-1||k===-1||I===-1||N===-1)continue;let R={start:{x:k+1,y:A+1},end:{x:N,y:I+1}};b.push({range:R,text:w,activate:i})}return b}static _getWindowedLineStrings(t,r){let n,i=t,l=t,u,h,p=[];if(n=r.buffer.active.getLine(t)){let g=n.translateToString(!0);if(n.isWrapped&&g[0]!==" "){for(u=0;(n=r.buffer.active.getLine(--i))&&u<2048&&(h=n.translateToString(!0),u+=h.length,p.push(h),!(!n.isWrapped||h.indexOf(" ")!==-1)););p.reverse()}for(p.push(g),u=0;(n=r.buffer.active.getLine(++l))&&n.isWrapped&&u<2048&&(h=n.translateToString(!0),u+=h.length,p.push(h),h.indexOf(" ")===-1););}return[p,i]}static _mapStrIdx(t,r,n,i){let l=t.buffer.active,u=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,u);let x=u.getChars();if(u.getWidth()&&(i-=x.length||1,g===p.length-1&&x==="")){let b=l.getLine(r+1);b&&b.isWrapped&&(b.getCell(0,u),u.getWidth()===2&&(i+=1))}if(i<0)return[r,g]}r++,h=0}return[r,h]}},hC=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function fC(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=fC,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,n=r.urlRegex??hC;this._linkProvider=this._terminal.registerLinkProvider(new cC(this._terminal,n,this._handler,r))}dispose(){this._linkProvider?.dispose()}};function ug(e){return{dispose:e}}var mC=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()}},gC=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,n)=>{if(this._disposed)return ug(()=>{});let i={fn:t,thisArgs:r};this._listeners.push(i);let l=ug(()=>{let u=this._listeners.indexOf(i);u!==-1&&this._listeners.splice(u,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)}},xC;(e=>{function t(l,u){return l(h=>u.fire(h))}e.forward=t;function r(l,u){return(h,p,g)=>l(x=>h.call(p,u(x)),void 0,g)}e.map=r;function n(...l){return(u,h,p)=>{let g=new mC;for(let x of l)g.add(x(b=>u.call(h,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function i(l,u,h){return u(h),l(p=>u(p))}e.runAndSubscribe=i})(xC||={});var dg=class Bd{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new gC,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 u=t.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=i)return r+this.wcwidth(u);let g=t.charCodeAt(l);56320<=g&&g<=57343?u=(u-55296)*1024+g-56320+65536:r+=this.wcwidth(g)}let h=this.charProperties(u,n),p=Bd.extractWidth(h);Bd.extractShouldJoin(h)&&(p-=Bd.extractWidth(n)),r+=p,n=h}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},cf=[[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]],bC=[[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]],uf=[[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]],yC=[[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]],tl;function hg(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 vC=class{constructor(){if(this.version="11",!tl){tl=new Uint8Array(65536),tl.fill(1),tl[0]=0,tl.fill(0,1,32),tl.fill(0,127,160);for(let e=0;e<cf.length;++e)tl.fill(0,cf[e][0],cf[e][1]+1);for(let e=0;e<uf.length;++e)tl.fill(2,uf[e][0],uf[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?tl[e]:hg(e,bC)?0:hg(e,yC)?2:1}charProperties(e,t){let r=this.wcwidth(e),n=r===0&&t!==0;if(n){let i=dg.extractWidth(t);i===0?n=!1:i>r&&(r=i)}return dg.createPropertyValue(0,r,n)}},wC=class{activate(e){e.unicode.register(new vC)}dispose(){}};function cc(e){return{dispose:e}}function Qd(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function AC(...e){return cc(()=>Qd(e))}var A3=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()}},Iu=class{constructor(){this._store=new A3}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};Iu.None=Object.freeze({dispose(){}});var Yd=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}},Tp=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return cc(()=>{});let n={fn:e,thisArgs:t};this._listeners.push(n);let i=cc(()=>{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)}},TC;(e=>{function t(l,u){return l(h=>u.fire(h))}e.forward=t;function r(l,u){return(h,p,g)=>l(x=>h.call(p,u(x)),void 0,g)}e.map=r;function n(...l){return(u,h,p)=>{let g=new A3;for(let x of l)g.add(x(b=>u.call(h,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function i(l,u,h){return u(h),l(p=>u(p))}e.runAndSubscribe=i})(TC||={});function T3(e,t=0,r){let n=setTimeout(()=>{e()},t);return cc(()=>{clearTimeout(n)})}var CC=class extends Iu{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Yd),this._linesCacheDisposables=this._register(new Yd),this._lastAccessTimestamp=0,this._register(cc(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=AC(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=T3(()=>{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),u=l?l.isWrapped:!1,h=i.translateToString(!u&&t);if(u&&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),u)n.push(n[n.length-1]+h.length);else break;e++,i=l}return[r.join(""),n]}},SC=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}},_C=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},u=this._findInLine(t,l,i);if(!u)for(let h=r+1;h<this._terminal.buffer.active.baseY+this._terminal.rows&&(l.startRow=h,l.startCol=0,u=this._findInLine(t,l,i),!u);h++);return u}findNextWithSelection(t,r,n){if(!t||t.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let l=0,u=0;i&&(n===t?(l=i.end.x,u=i.end.y):(l=i.start.x,u=i.start.y)),this._lineCache.initLinesCache();let h={startRow:u,startCol:l},p=this._findInLine(t,h,r);if(!p)for(let g=u+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&&u!==0)for(let g=0;g<u&&(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,u=this._terminal.cols,h=!0;this._lineCache.initLinesCache();let p={startRow:l,startCol:u},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,u=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,u),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"),I;if(i)for(;I=k.exec(w.slice(0,x));)A=k.lastIndex-I[0].length,t=I[0],k.lastIndex-=t.length-1;else I=k.exec(w.slice(x)),I&&I[0].length>0&&(A=x+(k.lastIndex-I[0].length),t=I[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 I=k;for(;I<g.length-1&&A+t.length>=g[I+1];)I++;let N=A-g[k],R=A+t.length-g[I],D=this._stringLengthToBufferSize(l+k,N),O=this._stringLengthToBufferSize(l+I,R)-D+this._terminal.cols*(I-k);return{term:t,col:D,row:l+k,size:O}}}_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 u=l.getChars();u.length>1&&(r-=u.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 u=0;u<r&&u<this._terminal.cols;u++){let h=l.getCell(u);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}},LC=class extends Iu{constructor(t){super(),this._terminal=t,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(cc(()=>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(){Qd(n)}}}clearHighlightDecorations(){Qd(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,u=t.size,h=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+t.row;for(;u>0;){let g=Math.min(this._terminal.cols-l,u);i.push([h,l,g]),l=0,u-=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(()=>Qd(w))),p.push(b)}}return p.length===0?void 0:p}},kC=class extends Iu{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Tp)}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()}},IC=class extends Iu{constructor(t){super(),this._highlightTimeout=this._register(new Yd),this._lineCache=this._register(new Yd),this._state=new SC,this._resultTracker=this._register(new kC),this._onAfterSearch=this._register(new Tp),this.onAfterSearch=this._onAfterSearch.event,this._onBeforeSearch=this._register(new Tp),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 CC(t),this._engine=new _C(t,this._lineCache.value),this._decorationManager=new LC(t),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(cc(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=T3(()=>{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 u=this._terminal.cols,h=i.col+i.size,p=i.row;h>=u&&(p+=Math.floor(h/u),h=h%u),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 ti=0,ri=0,ni=0,_s=0,ki;(e=>{function t(i,l,u,h){return h!==void 0?`#${Gl(i)}${Gl(l)}${Gl(u)}${Gl(h)}`:`#${Gl(i)}${Gl(l)}${Gl(u)}`}e.toCss=t;function r(i,l,u,h=255){return(i<<24|l<<16|u<<8|h)>>>0}e.toRgba=r;function n(i,l,u,h){return{css:e.toCss(i,l,u,h),rgba:e.toRgba(i,l,u,h)}}e.toColor=n})(ki||={});var EC;(e=>{function t(p,g){if(_s=(g.rgba&255)/255,_s===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,I=p.rgba>>8&255;ti=A+Math.round((x-A)*_s),ri=k+Math.round((b-k)*_s),ni=I+Math.round((w-I)*_s);let N=ki.toCss(ti,ri,ni),R=ki.toRgba(ti,ri,ni);return{css:N,rgba:R}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function n(p,g,x){let b=jd.ensureContrastRatio(p.rgba,g.rgba,x);if(b)return ki.toColor(b>>24&255,b>>16&255,b>>8&255)}e.ensureContrastRatio=n;function i(p){let g=(p.rgba|255)>>>0;return[ti,ri,ni]=jd.toChannels(g),{css:ki.toCss(ti,ri,ni),rgba:g}}e.opaque=i;function l(p,g){return _s=Math.round(g*255),[ti,ri,ni]=jd.toChannels(p.rgba),{css:ki.toCss(ti,ri,ni,_s),rgba:ki.toRgba(ti,ri,ni,_s)}}e.opacity=l;function u(p,g){return _s=p.rgba&255,l(p,_s*g/255)}e.multiplyOpacity=u;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(EC||={});var mi;(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 ti=parseInt(i.slice(1,2).repeat(2),16),ri=parseInt(i.slice(2,3).repeat(2),16),ni=parseInt(i.slice(3,4).repeat(2),16),ki.toColor(ti,ri,ni);case 5:return ti=parseInt(i.slice(1,2).repeat(2),16),ri=parseInt(i.slice(2,3).repeat(2),16),ni=parseInt(i.slice(3,4).repeat(2),16),_s=parseInt(i.slice(4,5).repeat(2),16),ki.toColor(ti,ri,ni,_s);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 ti=parseInt(l[1],10),ri=parseInt(l[2],10),ni=parseInt(l[3],10),_s=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),ki.toColor(ti,ri,ni,_s);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),[ti,ri,ni,_s]=t.getImageData(0,0,1,1).data,_s!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ki.toRgba(ti,ri,ni,_s),css:i}}e.toColor=n})(mi||={});var Oi;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,i,l){let u=n/255,h=i/255,p=l/255,g=u<=.03928?u/12.92:Math.pow((u+.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})(Oi||={});var jd;(e=>{function t(u,h){if(_s=(h&255)/255,_s===1)return h;let p=h>>24&255,g=h>>16&255,x=h>>8&255,b=u>>24&255,w=u>>16&255,A=u>>8&255;return ti=b+Math.round((p-b)*_s),ri=w+Math.round((g-w)*_s),ni=A+Math.round((x-A)*_s),ki.toRgba(ti,ri,ni)}e.blend=t;function r(u,h,p){let g=Oi.relativeLuminance(u>>8),x=Oi.relativeLuminance(h>>8);if(rl(g,x)<p){if(x<g){let A=n(u,h,p),k=rl(g,Oi.relativeLuminance(A>>8));if(k<p){let I=i(u,h,p),N=rl(g,Oi.relativeLuminance(I>>8));return k>N?A:I}return A}let b=i(u,h,p),w=rl(g,Oi.relativeLuminance(b>>8));if(w<p){let A=n(u,h,p),k=rl(g,Oi.relativeLuminance(A>>8));return w>k?b:A}return b}}e.ensureContrastRatio=r;function n(u,h,p){let g=u>>24&255,x=u>>16&255,b=u>>8&255,w=h>>24&255,A=h>>16&255,k=h>>8&255,I=rl(Oi.relativeLuminance2(w,A,k),Oi.relativeLuminance2(g,x,b));for(;I<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)),I=rl(Oi.relativeLuminance2(w,A,k),Oi.relativeLuminance2(g,x,b));return(w<<24|A<<16|k<<8|255)>>>0}e.reduceLuminance=n;function i(u,h,p){let g=u>>24&255,x=u>>16&255,b=u>>8&255,w=h>>24&255,A=h>>16&255,k=h>>8&255,I=rl(Oi.relativeLuminance2(w,A,k),Oi.relativeLuminance2(g,x,b));for(;I<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)),I=rl(Oi.relativeLuminance2(w,A,k),Oi.relativeLuminance2(g,x,b));return(w<<24|A<<16|k<<8|255)>>>0}e.increaseLuminance=i;function l(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=l})(jd||={});function Gl(e){let t=e.toString(16);return t.length<2?"0"+t:t}function rl(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var RC=Object.freeze((()=>{let e=[mi.toColor("#2e3436"),mi.toColor("#cc0000"),mi.toColor("#4e9a06"),mi.toColor("#c4a000"),mi.toColor("#3465a4"),mi.toColor("#75507b"),mi.toColor("#06989a"),mi.toColor("#d3d7cf"),mi.toColor("#555753"),mi.toColor("#ef2929"),mi.toColor("#8ae234"),mi.toColor("#fce94f"),mi.toColor("#729fcf"),mi.toColor("#ad7fa8"),mi.toColor("#34e2e2"),mi.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:ki.toCss(n,i,l),rgba:ki.toRgba(n,i,l)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:ki.toCss(n,n,n),rgba:ki.toRgba(n,n,n)})}return e})());function fg(e,t,r){return Math.max(t,Math.min(e,r))}function NC(e){switch(e){case"&":return"&";case"<":return"<"}return e}var C3=class{constructor(e){this._buffer=e}serialize(e,t){let r=this._buffer.getNullCell(),n=this._buffer.getNullCell(),i=r,l=e.start.y,u=e.end.y,h=e.start.x,p=e.end.x;this._beforeSerialize(u-l,l,u);for(let g=l;g<=u;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===u)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,r,n){}_rowEnd(e,t){}_beforeSerialize(e,t,r){}_afterSerialize(){}_serializeString(e){return""}};function f1(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Qo(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function S3(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 p1(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&S3(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 _3(e,t){let r=e;return typeof r.attributesEquals=="function"?r.attributesEquals(t):f1(e,t)&&Qo(e,t)&&p1(e,t)}var MC=class extends C3{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&&!Qo(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 u=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)&&((u.getChars()||u.getWidth()===0)&&Qo(u,p)&&(x=!0),g&&(h.getChars()||h.getWidth()===0)&&Qo(u,p)&&Qo(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(_3(t,r))return n;let i=!f1(t,r),l=!Qo(t,r),u=!p1(t,r);if(i||l||u)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(u){if(t.isInverse()!==r.isInverse()&&n.push(t.isInverse()?7:27),t.isBold()!==r.isBold()&&n.push(t.isBold()?1:22),S3(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()==="",u=this._diffStyle(t,this._cursorStyle);if(l?!Qo(this._cursorStyle,t):u.length>0){this._nullCellCount>0&&(Qo(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[${u.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&&(Qo(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 u=0;u<r;u++)n+=this._allRows[u],u+1<r&&(n+=this._allRowSeparators[u]);if(!t){let u=this._buffer.baseY+this._buffer.cursorY,h=this._buffer.cursorX,p=u!==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`)})(u-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}},DC=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,r,n){let i=r.length,l=n===void 0?i:fg(n+t.rows,0,i);return this._serializeBufferByRange(t,r,{start:i-l,end:i-1},!1)}_serializeBufferByRange(t,r,n,i){return new MC(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 BC(n,t,r),l=r.onlySelection??!1,u=r.range;if(u)return i.serialize({start:{x:u.startCol,y:(u.startLine,u.startLine)},end:{x:t.cols,y:(u.endLine,u.endLine)}});if(!l){let p=n.length,g=r.scrollback,x=g===void 0?p:fg(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(){}},BC=class extends C3{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=RC}_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 u=[];u.push("color: "+i+";"),u.push("background-color: "+l+";"),u.push("font-family: "+this._terminal.options.fontFamily+";"),u.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+u.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(_3(t,r))return;let i=!f1(t,r),l=!Qo(t,r),u=!p1(t,r);if(i||l||u){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()==="",u=this._diffStyle(t,r);u&&(this._currentRow+=u.length===0?"</span><span>":"</span><span style='"+u.join(" ")+"'>"),l?this._currentRow+=" ":this._currentRow+=NC(t.getChars())}_serializeString(){return this._htmlContent}};var QC=class{constructor(e=new jC,t=new L3){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 u=this._provider.readText(r);return u instanceof Promise?u.then(h=>(this._readText(r,h),!0)):(this._readText(r,u),!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}},L3=class{readText(e){return navigator.clipboard.readText()}writeText(e,t){return navigator.clipboard.writeText(t)}},jC=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 PC=Object.create,k3=Object.defineProperty,OC=Object.getOwnPropertyDescriptor,FC=Object.getOwnPropertyNames,UC=Object.getPrototypeOf,$C=Object.prototype.hasOwnProperty,o0=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},zC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of FC(t))!$C.call(e,i)&&i!==r&&k3(e,i,{get:()=>t[i],enumerable:!(n=OC(t,i))||n.enumerable});return e},l0=(e,t,r)=>(r=e!=null?PC(UC(e)):{},zC(!e||!e.__esModule?k3(r,"default",{value:e,enumerable:!0}):r,e)),m1=o0(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,I,N=255){return((N&255)<<24|(I&255)<<16|(k&255)<<8|A&255)>>>0}e.toRGBA8888=l;function u(A){return[A&255,A>>8&255,A>>16&255,A>>>24]}e.fromRGBA8888=u;function h(A,k){let I=t(A),N=r(A),R=n(A),D=Number.MAX_SAFE_INTEGER,O=-1;for(let q=0;q<k.length;++q){let Y=I-k[q][0],U=N-k[q][1],V=R-k[q][2],me=Y*Y+U*U+V*V;if(!me)return q;me<D&&(D=me,O=q)}return O}e.nearestColorIndex=h;function p(A,k,I){return Math.max(A,Math.min(I,k))}function g(A,k,I){return I<0&&(I+=1),I>1&&(I-=1),I*6<1?k+(A-k)*6*I:I*2<1?A:I*3<2?k+(A-k)*(4-I*6):k}function x(A,k,I){if(!I){let D=Math.round(k*255);return l(D,D,D)}let N=k<.5?k*(1+I):k+I-k*I,R=2*k-N;return l(p(0,255,Math.round(g(N,R,A+1/3)*255)),p(0,255,Math.round(g(N,R,A)*255)),p(0,255,Math.round(g(N,R,A-1/3)*255)))}function b(A,k,I){return(4278190080|Math.round(I/100*255)<<16|Math.round(k/100*255)<<8|Math.round(A/100*255))>>>0}e.normalizeRGB=b;function w(A,k,I){return x((A+240%360)/360,k/100,I/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 I=0;I<6;++I)for(let N=0;N<6;++N)for(let R=0;R<6;++R)A.push(l(k[I],k[N],k[R]));for(let I=8;I<=238;I+=10)A.push(l(I,I,I));return new Uint32Array(A)})(),e.DEFAULT_BACKGROUND=l(0,0,0,255),e.DEFAULT_FOREGROUND=l(255,255,255,255)}),I3=o0(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 u=0;u<l.length;++u)l[u]=i.charCodeAt(u);return l};function r(n){if(n.d){let{t:i,s:l,d:u}=n,h,p,g=WebAssembly;return i===0?l?x=>new g.Instance(p||(p=new g.Module(h||(h=t(u)))),x):x=>p?g.instantiate(p,x):g.instantiate(h||(h=t(u)),x).then(b=>(p=b.module)&&b.instance):i===1?l?()=>p||(p=new g.Module(h||(h=t(u)))):()=>p?Promise.resolve(p):g.compile(h||(h=t(u))).then(x=>p=x):l?()=>h||(h=t(u)):()=>Promise.resolve(h||(h=t(u)))}if(typeof _wasmCtx>"u")throw new Error('must run "inwasm"');_wasmCtx.add(n)}}),E3=o0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=I3(),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),u=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=u}),HC=o0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=I3(),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,u=l*4,h=i.length,p=Math.max(u,h)+(Math.min(u,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+u)}release(){this._inst&&this._mem.buffer.byteLength>this.keepSize&&(this._inst=this._d=this._mem=null)}};e.default=n}),WC=o0(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"}}),GC=o0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAsync=e.decode=e.Decoder=e.DecoderAsync=void 0;var t=m1(),r=WC();function n(A){if(typeof Buffer<"u")return Buffer.from(A,"base64");let k=atob(A),I=new Uint8Array(k.length);for(let N=0;N<I.length;++N)I[N]=k.charCodeAt(N);return I}var i=n(r.LIMITS.BYTES),l,u=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,I={env:{handle_band:k.handle_band.bind(k),mode_parsed:k.mode_parsed.bind(k)}};return WebAssembly.instantiate(l||i,I).then(N=>(l=l||N.module,new x(A,N.instance||N,k)))}e.DecoderAsync=g;var x=class{constructor(A,k,I){if(this._PIXEL_OFFSET=r.LIMITS.MAX_WIDTH+4,this._canvas=u,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)I.bandHandler=this._handle_band.bind(this),I.modeHandler=this._initCanvas.bind(this);else{let N=l||(l=new WebAssembly.Module(i));k=new WebAssembly.Instance(N,{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 I=A+k;if(I>this._canvas.length){if(this._opts.memoryLimit&&I*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");let N=new Uint32Array(Math.ceil(I/65536)*65536);N.set(this._canvas),this._canvas=N}}_handle_band(A){let k=this._PIXEL_OFFSET,I=this._lastOffset;if(this._mode===2){let N=this.height-this._currentHeight,R=0;for(;R<6&&N>0;)this._canvas.set(this._pSrc.subarray(k*R,k*R+A),I+A*R),R++,N--;this._lastOffset+=A*R,this._currentHeight+=R}else if(this._mode===1){this._realloc(I,A*6),this._maxWidth=Math.max(this._maxWidth,A),this._minWidth=Math.min(this._minWidth,A);for(let N=0;N<6;++N)this._canvas.set(this._pSrc.subarray(k*N,k*N+A),I+A*N);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,I=this._opts.paletteLimit,N=this._opts.truncate){this._wasm.init(this._opts.sixelColor,A,I,N?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,I=A.length){let N=k;for(;N<I;){let R=Math.min(I-N,r.LIMITS.CHUNK_SIZE);this._chunk.set(A.subarray(N,N+=R)),this._wasm.decode(0,R)}}decodeString(A,k=0,I=A.length){let N=k;for(;N<I;){let R=Math.min(I-N,r.LIMITS.CHUNK_SIZE);for(let D=0,O=N;D<R;++D,++O)this._chunk[D]=A.charCodeAt(O);N+=R,this._wasm.decode(0,R)}}get data32(){if(this._mode===0||!this.width||!this.height)return u;let A=this._wasm.current_width();if(this._mode===2){let k=this.height-this._currentHeight;if(k>0){let I=this._PIXEL_OFFSET,N=this._lastOffset,R=0;for(;R<6&&k>0;)this._canvas.set(this._pSrc.subarray(I*R,I*R+A),N+A*R),R++,k--;k&&this._canvas.fill(this._fillColor,N+A*R)}return this._canvas.subarray(0,this.width*this.height)}if(this._mode===1){if(this._minWidth===this._maxWidth){let R=!1;if(A)if(A!==this._minWidth)R=!0;else{let D=this._PIXEL_OFFSET,O=this._lastOffset;this._realloc(O,A*6);for(let q=0;q<6;++q)this._canvas.set(this._pSrc.subarray(D*q,D*q+A),O+A*q)}if(!R)return this._canvas.subarray(0,this.width*this.height)}let k=new Uint32Array(this.width*this.height);k.fill(this._fillColor);let I=0,N=0;for(let R=0;R<this._bandWidths.length;++R){let D=this._bandWidths[R];for(let O=0;O<6;++O)k.set(this._canvas.subarray(N,N+=D),I),I+=this.width}if(A){let R=this._PIXEL_OFFSET,D=this._wasm.current_height();for(let O=0;O<D;++O)k.set(this._pSrc.subarray(R*O,R*O+A),I+this.width*O)}return k}return u}get data8(){return new Uint8ClampedArray(this.data32.buffer,0,this.width*this.height*4)}release(){this._canvas=u,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 I=new x(k);return I.init(),typeof A=="string"?I.decodeString(A):I.decode(A),{width:I.width,height:I.height,data32:I.data32,data8:I.data8}}e.decode=b;async function w(A,k){let I=await g(k);return I.init(),typeof A=="string"?I.decodeString(A):I.decode(A),{width:I.width,height:I.height,data32:I.data32,data8:I.data8}}e.decodeAsync=w});function Cp(e){return{dispose:e}}var R3=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()}},N3=class{constructor(){this._store=new R3}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};N3.None=Object.freeze({dispose(){}});var VC=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}},qC=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return Cp(()=>{});let n={fn:e,thisArgs:t};this._listeners.push(n);let i=Cp(()=>{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)}},YC;(e=>{function t(l,u){return l(h=>u.fire(h))}e.forward=t;function r(l,u){return(h,p,g)=>l(x=>h.call(p,u(x)),void 0,g)}e.map=r;function n(...l){return(u,h,p)=>{let g=new R3;for(let x of l)g.add(x(b=>u.call(h,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function i(l,u,h){return u(h),l(p=>u(p))}e.runAndSubscribe=i})(YC||={});var pg=l0(m1()),t0=class kl extends N3{constructor(t){super(),this._terminal=t,this._layers=new Map,this._optionsRefresh=this._register(new VC),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(Cp(()=>{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,u=(r+1-t)*(this.dimensions?.css.cell.height||0);(!n||n==="top")&&this._layers.get("top")?.clearRect(0,i,l,u),(!n||n==="bottom")&&this._layers.get("bottom")?.clearRect(0,i,l,u)}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 u=this._layers.get(t.layer);if(!u)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,I=l*h+b>g.width?g.width-b:l*h,N=w+p>g.height?g.height-w:p;u.drawImage(g,Math.floor(b),Math.floor(w),Math.ceil(I),Math.ceil(N),Math.floor(A),Math.floor(k),Math.ceil(I),Math.ceil(N))}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,u=Math.ceil(l.width/n),h=r%u*n,p=Math.floor(r/u)*i,g=n+h>l.width?l.width-h:n,x=p+i>l.height?l.height-p:i,b=kl.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:u}=this.cellSize;if(l===-1||u===-1||(this._placeholder?u>=this._placeholder.height&&this._createPlaceHolder(u+1):this._createPlaceHolder(Math.max(u+1,24)),!this._placeholder))return;i.drawImage(this._placeholderBitmap??this._placeholder,t*l,r*u%2?0:1,l*n,u,t*l,r*u,l*n,u)}}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 u=kl.createCanvas(this.document,Math.ceil(t.orig.width*r/i),Math.ceil(t.orig.height*n/l)),h=u.getContext("2d");h&&(h.drawImage(t.orig,0,0,u.width,u.height),t.actual=u,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=kl.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=kl.createCanvas(this.document,r,t),i=n.getContext("2d",{alpha:!1});if(!i)return;let l=kl.createImageData(i,r,t),u=new Uint32Array(l.data.buffer),h=(0,pg.toRGBA8888)(0,0,0),p=(0,pg.toRGBA8888)(255,255,255);u.fill(h);for(let b=0;b<t;++b){let w=b%2,A=b*r;for(let k=0;k<r;k+=2)u[A+k+w]=p}i.putImageData(l,0,0);let g=screen.width+r-1&-32||4096;this._placeholder=kl.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);kl.createImageBitmap(this._placeholder).then(b=>this._placeholderBitmap=b)}get document(){return this._terminal._core._coreBrowserService?.window.document}},ll={width:7,height:14},Sp=class M3{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 M3(this._ext,this._urlId,this.imageId,this.tileId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0&&this.imageId===-1}},rd=new Sp,ZC=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=ll);let n=Math.ceil(e.width/r.width),i=Math.ceil(e.height/r.height),l=++this._lastId,u=this._terminal._core.buffer,h=this._terminal.cols,p=this._terminal.rows,g=u.x,x=u.y,b=g,w=0;t.scrolling||(u.x=0,u.y=0,b=0),this._terminal._core._inputHandler._dirtyRowTracker.markDirty(u.y);for(let N=0;N<i;++N){let R=u.lines.get(u.y+u.ybase);for(let D=0;D<n&&!(b+D>=h);++D)this._writeToCell(R,b+D,l,N*n+D),w++;if(t.scrolling)N<i-1&&this._terminal._core._inputHandler.lineFeed();else if(++u.y>=p)break;u.x=b}this._terminal._core._inputHandler._dirtyRowTracker.markDirty(u.y),t.scrolling?t.cursorPos==="iip"?u.x=Math.min(b+n,h):u.x=b:(u.x=g,u.y=x);let A=[];for(let[N,R]of this._images.entries())R.tileCount<1&&(R.marker?.dispose(),A.push(N));for(let N of A)this._delImg(N);let k=this._terminal.registerMarker(0);k?.onDispose(()=>{this._images.get(l)&&this._delImg(l)}),this._terminal.buffer.active.type==="alternate"&&this._evictOnAlternate();let I={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,I),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,u=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<u;++b){let w;if(x.getBg(b)&268435456)w=x._extendedAttrs[b]??rd;else{let I=x._extendedAttrs[b];if(!I||I.imageId===void 0||I.imageId===-1)continue;w=I}let A=w.imageId;if(A===void 0||A===-1)continue;let k=this._images.get(A);if(w.tileId!==-1){let I=w.tileId,N=b,R=1;for(;++b<u;){let D=x._extendedAttrs[b];if(!D||D.imageId!==A||D.tileId!==I+R)break;R++}b--,k?k.actual&&h.push({imgSpec:k,tileId:I,col:N,row:g,count:R}):this._opts.showPlaceholder&&p.push({col:N,row:g,count:R}),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 u=l._extendedAttrs[n]??rd,h=u.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(u.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-u.tileId%g+n),w=u.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]??rd;if(n.imageId&&n.imageId!==-1){let i=this._images.get(n.imageId)?.orig;if(window.ImageBitmap&&i instanceof ImageBitmap){let l=t0.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]??rd;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 Sp(i.ext,i.urlId,r,n);return}}e._data[t*3+2]|=268435456,e._extendedAttrs[t]=new Sp(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 u=this._images.get(l);u&&u.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)}},KC=l0(E3()),XC=l0(HC());function Zd(e){let t="";for(let r=0;r<e.length;++r)t+=String.fromCharCode(e[r]);return t}function df(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 mg(e){let t=Zd(e);if(!t.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/))throw new Error("illegal size");return t}function JC(e){if(typeof Buffer<"u")return Buffer.from(Zd(e),"base64").toString();let t=atob(Zd(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 gg={inline:df,size:df,name:JC,width:mg,height:mg,preserveAspectRatio:df},xg=[70,105,108,101],bg=[77,117,108,116,105,112,97,114,116,70,105,108,101],hf=[70,105,108,101,80,97,114,116],ff=[70,105,108,101,69,110,100],pf=[82,101,112,111,114,116,67,101,108,108,83,105,122,101],mf=1024,eS=class{constructor(){this.state=0,this._buffer=new Uint32Array(mf),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===ff.length){for(let t=0;t<ff.length;++t)if(this._buffer[t]!==ff[t])return this._a();return this.fields.type=4,this.state=4,0}if(this._position===pf.length){for(let t=0;t<pf.length;++t)if(this._buffer[t]!==pf[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,u=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(u[0]===70){let g=0;for(;g<xg.length;++g)if(u[g]!==xg[g])return this._a();if(this.fields.type=1,l===hf.length){for(;g<hf.length;++g)if(u[g]!==hf[g])return this._a();return this.fields.type=3,this.state=4,h+1}}else if(u[0]===77){for(let g=0;g<bg.length;++g)if(u[g]!==bg[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>=mf)return this._a();u[l++]=p}break;case 58:return i===3&&!this._storeValue(l)?this._a():(this.state=4,h+1);default:if(l>=mf)return this._a();u[l++]=p}}return this.state=i,this._position=l,-2}_a(){return this.fields.type=0,this.state=1,-1}_storeKey(t){let r=Zd(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]=gg[this._key]?gg[this._key](r):r}catch{return!1}return!0}return!1}},Kd={mime:"unsupported",width:0,height:0};function tS(e){if(e.length<24)return Kd;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]=rS(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]}:Kd}function rS(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 gf={type:0,name:"Unnamed file",size:0,width:"auto",height:"auto",preserveAspectRatio:1,inline:0},nS=class{constructor(e,t,r,n){this._opts=e,this._renderer=t,this._storage=r,this._coreTerminal=n,this._aborted=!1,this._hp=new eS,this._header=gf,this._metrics=Kd,this._isMultipart=!1,this._abortMulti=!1;let i=Math.ceil(this._opts.iipSizeLimit*4/3),l=Math.min(1048576,i);this._dec=new KC.default(4194304,i,l),this._qoiDec=new XC.default(4194304)}reset(){this._hp.reset(),this._dec.release(),this._qoiDec.release()}start(){this._aborted=!1,this._metrics=Kd,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({},gf,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 u=ll.width,h=ll.height;this._renderer.dimensions&&(u=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)};${u.toFixed(3)};${p.toFixed(3)}\x1B\\`;return this._coreTerminal.input(g,!1),!0}if(t===2)return this._header=Object.assign({},gf,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=tS(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 u=this._qoiDec.decode(this._dec.data8);if(l=new ImageData(new Uint8ClampedArray(u.buffer,u.byteOffset,u.byteLength),this._qoiDec.width,this._qoiDec.height),this._qoiDec.release(),r===this._qoiDec.width&&n===this._qoiDec.height){this._dec.release();let h=t0.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(u=>(this._storage.addImage(u),!0))}_resize(e,t){let r=this._renderer.dimensions?.css.cell.width||ll.width,n=this._renderer.dimensions?.css.cell.height||ll.height,i=this._renderer.dimensions?.css.canvas.width||r*this._coreTerminal.cols,l=this._renderer.dimensions?.css.canvas.height||n*this._coreTerminal.rows,u=this._dim(this._header.width,i,r),h=this._dim(this._header.height,l,n);if(!u&&!h){let p=i/e,g=(l-n)/t,x=Math.min(p,g);return x<1?[e*x,t*x]:[e,t]}return u?this._header.preserveAspectRatio||!u||!h?[u,t*u/e]:[u,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}},sS=l0(E3());function yg(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),u=n.substring(i+1);if(l==="a"){t.action=u;continue}if(l==="o"){t.compression=u;continue}if(l==="t"){t.transmission=u;continue}if(l==="d"){t.deleteSelector=u;continue}let h=parseInt(u,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 vg=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=yg(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 u=this._activeDecoder??i?.decoder;u&&u.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 sS.default(4194304,this._maxEncodedBytes,this._initialEncodedBytes),this._activeDecoder.init()),this._activeDecoder.put(e.subarray(t,r))!==vg&&(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,u=t,h=this._activeDecoder;i&&(u=i.cmd,h=i.decoder,l=l||i.decodeError,this._pendingTransmissions.delete(r));let p=new Uint8Array(0);h&&(h.end()!==vg&&(l=!0),p=h.data8),this._activeDecoder=null;let g=this._handleCommandWithBytesAndCmd(u,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=yg(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(u=>(this._sendResponse(n,u?"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 u=e.width??0,h=e.height??0;if(!u||!h)return this._sendResponse(n,"EINVAL:width and height required for raw pixel data",i),!0;let p=l===32?4:3,g=u*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}`:"",u=`\x1B_Gi=${e}${l};${t}\x1B\\`;this._coreTerminal._core.coreService.triggerDataEvent(u)}_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,u=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(u,p));if(g===0||x===0)throw new Error("invalid source rectangle");if(n!==0||i!==0||g!==r.width||x!==r.height){let Je=await createImageBitmap(r,n,i,g,x);r.close(),r=Je}let b=this._renderer.dimensions?.css.cell.width||ll.width,w=this._renderer.dimensions?.css.cell.height||ll.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 I=r.width,N=r.height;if((t.columns!==void 0||t.rows!==void 0)&&(I=Math.round(A*b),N=Math.round(k*w)),I*N>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");let R=this._coreTerminal._core.buffer,D=R.x,O=R.y,q=R.ybase,Y=t.zIndex!==void 0&&t.zIndex<0?"bottom":"top";if(I!==r.width||N!==r.height){let Je=await createImageBitmap(r,{resizeWidth:I,resizeHeight:N});r.close(),r=Je}let U=Math.min(Math.max(0,t.xOffset??0),b-1),V=Math.min(Math.max(0,t.yOffset??0),w-1);if(U!==0||V!==0){let Je=t.columns!==void 0?Math.round(A*b):r.width+U,ve=t.rows!==void 0?Math.round(k*w):r.height+V,_e=t0.createCanvas(window.document,Je,ve),Ze=_e.getContext("2d");if(!Ze)throw new Error("Failed to create offset canvas context");Ze.drawImage(r,U,V);let Ve=await createImageBitmap(_e);if(_e.width=_e.height=0,r.close(),r=Ve,I=r.width,N=r.height,I*N>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 me=t.zIndex??0;if(this._kittyStorage.addImage(e.id,r,!0,Y,me),r=void 0,t.cursorMovement===1){let Je=R.ybase-q;R.x=D,R.y=Math.max(O-Je,0)}else R.x=Math.min(D+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 I=new Blob([t],{type:"image/png"});if(!window.createImageBitmap){let N=URL.createObjectURL(I),R=new Image;return new Promise((D,O)=>{R.addEventListener("load",()=>{URL.revokeObjectURL(N);let q=t0.createCanvas(window.document,R.width,R.height);q.getContext("2d")?.drawImage(R,0,0),createImageBitmap(q).then(D).catch(O)}),R.addEventListener("error",()=>{URL.revokeObjectURL(N),O(new Error("Failed to load image"))}),R.src=N})}return createImageBitmap(I)}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 u=r*n;if(e.format===32)return createImageBitmap(new ImageData(new Uint8ClampedArray(t.buffer,t.byteOffset,u*4),r,n));let h=new Uint8ClampedArray(u*4),p=new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),g=new Uint32Array(h.buffer),x=u&-4,b=0,w=0;for(let I=0;I<x;I+=4){let N=p[b++],R=p[b++],D=p[b++];g[w++]=4278190080|N,g[w++]=4278190080|N>>>24|R<<8,g[w++]=4278190080|R>>>16|D<<16,g[w++]=4278190080|D>>>8}let A=x*3,k=x*4;for(let I=x;I<u;I++)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 u=i.reduce((g,x)=>g+x.length,0),h=new Uint8Array(u),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}},D3=class _p{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>=_p._maxStoredImages&&this._evictUndisplayedImages(),this._images.set(n,{...r,id:n}),n}addImage(t,r,n,i,l){let u=this._kittyIdToStorageId.get(t);u!==void 0&&this._storageIdToKittyId.delete(u),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<=_p._maxStoredImages/2)break;this._kittyIdToStorageId.has(t)||this._images.delete(t)}}};D3._maxStoredImages=256;var aS=D3,mu=l0(m1()),oS=l0(GC()),lS=4194304,Lp=mu.PALETTE_ANSI_256;Lp.set(mu.PALETTE_VT340_COLOR);var cS=class{constructor(e,t,r){this._opts=e,this._storage=t,this._coreTerminal=r,this._size=0,this._aborted=!1,(0,oS.DecoderAsync)({memoryLimit:this._opts.pixelLimit*4,palette:Lp,paletteLimit:this._opts.sixelPaletteLimit}).then(n=>this._dec=n)}reset(){this._dec&&(this._dec.release(),this._dec._palette.fill(0),this._dec.init(0,Lp,this._opts.sixelPaletteLimit))}hook(e){if(this._size=0,this._aborted=!1,this._dec){let t=e.params[1]===1?0:uS(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=t0.createCanvas(void 0,t,r);return n.getContext("2d")?.putImageData(new ImageData(this._dec.data8,t,r),0,0),this._dec.memoryUsage>lS&&this._dec.release(),this._storage.addImage(n),!0}};function uS(e,t){let r=0;if(!t)return r;if(e.isInverse())if(e.isFgDefault())r=nd(t.foreground.rgba);else if(e.isFgRGB()){let n=e.constructor.toColorRGB(e.getFgColor());r=(0,mu.toRGBA8888)(...n)}else r=nd(t.ansi[e.getFgColor()].rgba);else if(e.isBgDefault())r=nd(t.background.rgba);else if(e.isBgRGB()){let n=e.constructor.toColorRGB(e.getBgColor());r=(0,mu.toRGBA8888)(...n)}else r=nd(t.ansi[e.getBgColor()].rgba);return r}function nd(e){return mu.BIG_ENDIAN?e:(e&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255}var dS=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=ll);let r=Math.ceil(e/t.height);for(let n=1;n<r;++n)this._terminal._core._inputHandler.lineFeed()}}},hS=class{constructor(e){this._storage=e,this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"}}addImage(e){this._storage.addImage(e,this._addImageOpts)}},wg={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:4096,sixelSizeLimit:33554432,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:33554432,kittySupport:!0,kittySizeLimit:33554432},Ag=4096,fS=class{constructor(t){this._disposables=[],this._handlers=new Map,this._onImageAdded=new qC,this.onImageAdded=this._onImageAdded.event,this._opts=Object.assign({},wg,t),this._defaultOpts=Object.assign({},wg,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 t0(t),this._storage=new ZC(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 dS(this._storage,this._opts,this._renderer,t),n=new cS(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 hS(this._storage),n=new nS(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 aS(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]<=Ag?(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;${Ag}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=ll;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 kc=new Map;function Uc(e){return{name:e,get hasSubscribers(){return(kc.get(e)?.size??0)>0},publish(t){const r=kc.get(e);if(r)for(const n of r)n(t,e)},subscribe(t){const r=kc.get(e)??new Set;r.add(t),kc.set(e,r)},unsubscribe(t){const r=kc.get(e);if(!r)return!1;const n=r.delete(t);return r.size===0&&kc.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:Uc(t.start),end:Uc(t.end),asyncStart:Uc(t.asyncStart),asyncEnd:Uc(t.asyncEnd),error:Uc(t.error),traceSync(n,i,l,...u){r.start.publish(i);try{const h=n.apply(l,u);return r.end.publish(i),h}catch(h){throw r.error.publish(h),h}},async tracePromise(n,i,l,...u){r.asyncStart.publish(i);try{const h=await n.apply(l,u);return r.asyncEnd.publish(i),h}catch(h){throw r.error.publish(h),h}},traceCallback(n,i,l,u,...h){r.start.publish(l);try{const p=n.apply(u,h);return r.end.publish(l),p}catch(p){throw r.error.publish(p),p}}};return r}var mS=Object.create,g1=Object.defineProperty,gS=Object.getOwnPropertyDescriptor,xS=Object.getOwnPropertyNames,bS=Object.getPrototypeOf,yS=Object.prototype.hasOwnProperty,B3=e=>{throw TypeError(e)},vS=(e,t,r)=>t in e?g1(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}},AS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of xS(t))!yS.call(e,i)&&i!==r&&g1(e,i,{get:()=>t[i],enumerable:!(n=gS(t,i))||n.enumerable});return e},TS=(e,t,r)=>(r=e!=null?mS(bS(e)):{},AS(!e||!e.__esModule?g1(r,"default",{value:e,enumerable:!0}):r,e)),Ws=(e,t,r)=>vS(e,typeof t!="symbol"?t+"":t,r),x1=(e,t,r)=>t.has(e)||B3("Cannot "+r),K=(e,t,r)=>(x1(e,t,"read from private field"),r?r.call(e):t.get(e)),ln=(e,t,r)=>t.has(e)?B3("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Lr=(e,t,r,n)=>(x1(e,t,"write to private field"),t.set(e,r),r),Ft=(e,t,r)=>(x1(e,t,"access private method"),r),xf=(e,t,r,n)=>({set _(i){Lr(e,t,i)},get _(){return K(e,t,n)}}),CS=wS((e,t)=>{var r=(()=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.prototype.hasOwnProperty,h=(s,o)=>{for(var c in o)n(s,c,{get:o[c],enumerable:!0})},p=(s,o,c,d)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of l(o))!u.call(s,f)&&f!==c&&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:()=>te,Font:()=>mm,Glyph:()=>at,Path:()=>Oe,_parse:()=>ft,load:()=>Vv,loadSync:()=>qv,parse:()=>Gv});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 I=new A,N=new A,R=new Uint8Array(30),D=new Uint16Array(30),O=new Uint8Array(30),q=new Uint16Array(30),Y=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),U=new A,V=new Uint8Array(320);function me(s,o,c,d){var f,m;for(f=0;f<c;++f)s[f]=0;for(f=0;f<30-c;++f)s[f+c]=f/c|0;for(m=d,f=0;f<30;++f)o[f]=m,m+=1<<s[f]}function Je(s,o){var c;for(c=0;c<7;++c)s.table[c]=0;for(s.table[7]=24,s.table[8]=152,s.table[9]=112,c=0;c<24;++c)s.trans[c]=256+c;for(c=0;c<144;++c)s.trans[24+c]=c;for(c=0;c<8;++c)s.trans[168+c]=280+c;for(c=0;c<112;++c)s.trans[176+c]=144+c;for(c=0;c<5;++c)o.table[c]=0;for(o.table[5]=32,c=0;c<32;++c)o.trans[c]=c}var ve=new Uint16Array(16);function _e(s,o,c,d){var f,m;for(f=0;f<16;++f)s.table[f]=0;for(f=0;f<d;++f)s.table[o[c+f]]++;for(s.table[0]=0,m=0,f=0;f<16;++f)ve[f]=m,m+=s.table[f];for(f=0;f<d;++f)o[c+f]&&(s.trans[ve[o[c+f]]++]=f)}function Ze(s){s.bitcount--||(s.tag=s.source[s.sourceIndex++],s.bitcount=7);var o=s.tag&1;return s.tag>>>=1,o}function Ve(s,o,c){if(!o)return c;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+c}function ce(s,o){for(;s.bitcount<24;)s.tag|=s.source[s.sourceIndex++]<<s.bitcount,s.bitcount+=8;var c=0,d=0,f=0,m=s.tag;do d=2*d+(m&1),m>>>=1,++f,c+=o.table[f],d-=o.table[f];while(d>=0);return s.tag=m,s.bitcount-=f,o.trans[c+d]}function ke(s,o,c){var d,f,m,v,T,_;for(d=Ve(s,5,257),f=Ve(s,5,1),m=Ve(s,4,4),v=0;v<19;++v)V[v]=0;for(v=0;v<m;++v){var M=Ve(s,3,0);V[Y[v]]=M}for(_e(U,V,0,19),T=0;T<d+f;){var E=ce(s,U);switch(E){case 16:var G=V[T-1];for(_=Ve(s,2,3);_;--_)V[T++]=G;break;case 17:for(_=Ve(s,3,3);_;--_)V[T++]=0;break;case 18:for(_=Ve(s,7,11);_;--_)V[T++]=0;break;default:V[T++]=E;break}}_e(o,V,0,d),_e(c,V,d,f)}function ot(s,o,c){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=Ve(s,R[d],D[d]),m=ce(s,c),v=s.destLen-Ve(s,O[m],q[m]),T=v;T<v+f;++T)s.dest[s.destLen++]=s.dest[T]}}}function Ie(s){for(var o,c,d;s.bitcount>8;)s.sourceIndex--,s.bitcount-=8;if(o=s.source[s.sourceIndex+1],o=256*o+s.source[s.sourceIndex],c=s.source[s.sourceIndex+3],c=256*c+s.source[s.sourceIndex+2],o!==(~c&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 de(s,o){var c=new k(s,o),d,f,m;do{switch(d=Ze(c),f=Ve(c,2,0),f){case 0:m=Ie(c);break;case 1:m=ot(c,I,N);break;case 2:ke(c,c.ltree,c.dtree),m=ot(c,c.ltree,c.dtree);break;default:m=w}if(m!==b)throw new Error("Data error")}while(!d);return c.destLen<c.dest.length?typeof c.dest.slice=="function"?c.dest.slice(0,c.destLen):c.dest.subarray(0,c.destLen):c.dest}Je(I,N),me(R,D,4,3),me(O,q,2,1),R[28]=0,D[28]=258;function qe(s,o,c,d,f){return Math.pow(1-f,3)*s+3*Math.pow(1-f,2)*f*o+3*(1-f)*Math.pow(f,2)*c+Math.pow(f,3)*d}function xe(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}xe.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},xe.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))},xe.prototype.addX=function(s){this.addPoint(s,null)},xe.prototype.addY=function(s){this.addPoint(null,s)},xe.prototype.addBezier=function(s,o,c,d,f,m,v,T){let _=[s,o],M=[c,d],E=[f,m],G=[v,T];this.addPoint(s,o),this.addPoint(v,T);for(let H=0;H<=1;H++){let oe=6*_[H]-12*M[H]+6*E[H],J=-3*_[H]+9*M[H]-9*E[H]+3*G[H],fe=3*M[H]-3*_[H];if(J===0){if(oe===0)continue;let Ir=-fe/oe;0<Ir&&Ir<1&&(H===0&&this.addX(qe(_[H],M[H],E[H],G[H],Ir)),H===1&&this.addY(qe(_[H],M[H],E[H],G[H],Ir)));continue}let Xe=Math.pow(oe,2)-4*fe*J;if(Xe<0)continue;let gr=(-oe+Math.sqrt(Xe))/(2*J);0<gr&&gr<1&&(H===0&&this.addX(qe(_[H],M[H],E[H],G[H],gr)),H===1&&this.addY(qe(_[H],M[H],E[H],G[H],gr)));let or=(-oe-Math.sqrt(Xe))/(2*J);0<or&&or<1&&(H===0&&this.addX(qe(_[H],M[H],E[H],G[H],or)),H===1&&this.addY(qe(_[H],M[H],E[H],G[H],or)))}},xe.prototype.addQuad=function(s,o,c,d,f,m){let v=s+.6666666666666666*(c-s),T=o+2/3*(d-o),_=v+1/3*(f-s),M=T+1/3*(m-o);this.addBezier(s,o,v,T,_,M,f,m)};var te=xe;function re(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}var ge={};function ze(s,o){let c=Math.floor(s),d=s-c;if(ge[o]||(ge[o]={}),ge[o][d]!==void 0){let m=ge[o][d];return c+m}let f=+(Math.round(d+"e+"+o)+"e-"+o);return ge[o][d]=f,c+f}function Ke(s){let o=[[]],c=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],M=m[m.length-1],E=s[f+1];m.push(v),v.type==="M"?(c=v.x,d=v.y):v.type==="L"&&(!E||E.type==="Z")?Math.abs(v.x-c)>1||Math.abs(v.y-d)>1||m.pop():v.type==="L"&&M&&M.x===v.x&&M.y===v.y?m.pop():v.type==="Z"&&(T&&_&&M&&T.type==="M"&&_.type==="L"&&M.type==="L"&&M.x===T.x&&M.y===T.y&&(m.shift(),m[0].type="M"),f+1<s.length&&o.push([]))}return s=[].concat.apply([],o),s}function Ae(s){return Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0,scale:1,x:0,y:0},s)}function z(s){return parseInt(s)===s&&(s={decimalPlaces:s,flipY:!1}),Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0},s)}re.prototype.fromSVG=function(s,o={}){typeof SVGPathElement<"u"&&s instanceof SVGPathElement&&(s=s.getAttribute("d")),o=Ae(o),this.commands=[];let c="0123456789",d="MmLlQqCcZzHhVv",f="SsTtAa",m="-+",v={},T=[""],_=!1;function M(J){return J.filter(fe=>fe.length).map(fe=>{let Xe=parseFloat(fe);return(o.decimalPlaces||o.decimalPlaces===0)&&(Xe=ze(Xe,o.decimalPlaces)),Xe})}function E(J){if(!this.commands.length)return J;let fe=this.commands[this.commands.length-1];for(let Xe=0;Xe<J.length;Xe++)J[Xe]+=fe[Xe&1?"y":"x"];return J}function G(){if(v.type===void 0)return;let J=v.type.toUpperCase(),fe=J!=="Z"&&v.type.toUpperCase()!==v.type,Xe=M(T);if(T=[""],!Xe.length&&J!=="Z")return;fe&&J!=="H"&&J!=="V"&&(Xe=E.apply(this,[Xe]));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(J){case"M":this.moveTo(...Xe);break;case"L":this.lineTo(...Xe);break;case"V":for(let Ir=0;Ir<Xe.length;Ir++){let Kr=0;fe&&(Kr=this.commands.length&&this.commands[this.commands.length-1].y||0),this.lineTo(gr,Xe[Ir]+Kr)}break;case"H":for(let Ir=0;Ir<Xe.length;Ir++){let Kr=0;fe&&(Kr=this.commands.length&&this.commands[this.commands.length-1].x||0),this.lineTo(Xe[Ir]+Kr,or)}break;case"C":this.bezierCurveTo(...Xe);break;case"Q":this.quadraticCurveTo(...Xe);break;case"Z":(this.commands.length<1||this.commands[this.commands.length-1].type!=="Z")&&this.close();break}if(this.commands.length)for(let Ir in this.commands[this.commands.length-1])this.commands[this.commands.length-1][Ir]===void 0&&(this.commands[this.commands.length-1][Ir]=0)}for(let J=0;J<s.length;J++){let fe=s.charAt(J),Xe=T[T.length-1];if(c.indexOf(fe)>-1)T[T.length-1]+=fe;else if(m.indexOf(fe)>-1)if(!v.type&&!this.commands.length&&(v.type="L"),fe==="-")!v.type||Xe.indexOf("-")>0?_=!0:Xe.length?T.push("-"):T[T.length-1]=fe;else if(!v.type||Xe.length>0)_=!0;else continue;else if(d.indexOf(fe)>-1)v.type?(G.apply(this),v={type:fe}):v.type=fe;else{if(f.indexOf(fe)>-1)throw new Error("Unsupported path command: "+fe+". Currently supported commands are "+d.split("").join(", ")+".");` ,
|
|
62
|
-
\r\f\v`.indexOf(fe)>-1?T.push(""):fe==="."?!v.type||Xe.indexOf(fe)>-1?_=!0:T[T.length-1]+=fe:_=!0}if(_)throw new Error("Unexpected character: "+fe+" at offset "+J)}G.apply(this),o.optimize&&(this.commands=Ke(this.commands));let H=o.flipY,oe=o.flipYBase;if(H===!0&&o.flipYBase===void 0){let J=this.getBoundingBox();oe=J.y1+J.y2}for(let J in this.commands){let fe=this.commands[J];for(let Xe in fe)["x","x1","x2"].includes(Xe)?this.commands[J][Xe]=o.x+fe[Xe]*o.scale:["y","y1","y2"].includes(Xe)&&(this.commands[J][Xe]=o.y+(H?oe-fe[Xe]:fe[Xe])*o.scale)}return this},re.fromSVG=function(s,o){return new re().fromSVG(s,o)},re.prototype.moveTo=function(s,o){this.commands.push({type:"M",x:s,y:o})},re.prototype.lineTo=function(s,o){this.commands.push({type:"L",x:s,y:o})},re.prototype.curveTo=re.prototype.bezierCurveTo=function(s,o,c,d,f,m){this.commands.push({type:"C",x1:s,y1:o,x2:c,y2:d,x:f,y:m})},re.prototype.quadTo=re.prototype.quadraticCurveTo=function(s,o,c,d){this.commands.push({type:"Q",x1:s,y1:o,x:c,y:d})},re.prototype.close=re.prototype.closePath=function(){this.commands.push({type:"Z"})},re.prototype.extend=function(s){if(s.commands)s=s.commands;else if(s instanceof te){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)},re.prototype.getBoundingBox=function(){let s=new te,o=0,c=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,c=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=c;break;default:throw new Error("Unexpected path command "+v.type)}}return s.isEmpty()&&s.addPoint(0,0),s},re.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 c=this._image;if(c){s.drawImage(c.image,c.x,c.y,c.width,c.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())},re.prototype.toPathData=function(s){s=z(s);function o(T){let _=ze(T,s.decimalPlaces);return Math.round(T)===_?""+_:_.toFixed(s.decimalPlaces)}function c(){let T="";for(let _=0;_<arguments.length;_+=1){let M=arguments[_];M>=0&&_>0&&(T+=" "),T+=o(M)}return T}let d=this.commands;s.optimize&&(d=JSON.parse(JSON.stringify(this.commands)),d=Ke(d));let f=s.flipY,m=s.flipYBase;if(f===!0&&m===void 0){let T=new re;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"+c(_.x,f?m-_.y:_.y):_.type==="L"?v+="L"+c(_.x,f?m-_.y:_.y):_.type==="C"?v+="C"+c(_.x1,f?m-_.y1:_.y1,_.x2,f?m-_.y2:_.y2,_.x,f?m-_.y:_.y):_.type==="Q"?v+="Q"+c(_.x1,f?m-_.y1:_.y1,_.x,f?m-_.y:_.y):_.type==="Z"&&(v+="Z")}return v},re.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 c='<path d="';return c+=o,c+='"',this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?c+=' fill="none"':c+=' fill="'+this.fill+'"'),this.stroke&&(c+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),c+="/>",c},re.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 c=document.createElementNS("http://www.w3.org/2000/svg","path");return c.setAttribute("d",o),this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?c.setAttribute("fill","none"):c.setAttribute("fill",this.fill)),this.stroke&&(c.setAttribute("stroke",this.stroke),c.setAttribute("stroke-width",this.strokeWidth)),c};var Oe=re;function nt(s){throw new Error(s)}function Re(s,o){s||nt(o)}var X={fail:nt,argument:Re,assert:Re},Be=32768,st=2147483648,be=-32768,je=32767+1/65536,wt={},Te={},pe={};function $e(s){return function(){return s}}Te.BYTE=function(s){return X.argument(s>=0&&s<=255,"Byte value should be between 0 and 255."),[s]},pe.BYTE=$e(1),Te.CHAR=function(s){return[s.charCodeAt(0)]},pe.CHAR=$e(1),Te.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 c=0;c<s.length;c+=1)o[c]=s.charCodeAt(c);return o},pe.CHARARRAY=function(s){return typeof s>"u"?0:s.length},Te.USHORT=function(s){return[s>>8&255,s&255]},pe.USHORT=$e(2),Te.SHORT=function(s){return s>=Be&&(s=-(2*Be-s)),[s>>8&255,s&255]},pe.SHORT=$e(2),Te.UINT24=function(s){return[s>>16&255,s>>8&255,s&255]},pe.UINT24=$e(3),Te.ULONG=function(s){return[s>>24&255,s>>16&255,s>>8&255,s&255]},pe.ULONG=$e(4),Te.LONG=function(s){return s>=st&&(s=-(2*st-s)),[s>>24&255,s>>16&255,s>>8&255,s&255]},pe.LONG=$e(4),Te.FLOAT=function(s){if(s>je||s<be)throw new Error(`Value ${s} is outside the range of representable values in 16.16 format`);let o=Math.round(s*65536)<<0;return Te.ULONG(o)},pe.FLOAT=pe.ULONG,Te.FIXED=Te.ULONG,pe.FIXED=pe.ULONG,Te.FWORD=Te.SHORT,pe.FWORD=pe.SHORT,Te.UFWORD=Te.USHORT,pe.UFWORD=pe.USHORT,Te.F2DOT14=function(s){return Te.USHORT(s*16384)},pe.F2DOT14=pe.USHORT,Te.LONGDATETIME=function(s){return[0,0,0,0,s>>24&255,s>>16&255,s>>8&255,s&255]},pe.LONGDATETIME=$e(8),Te.TAG=function(s){return X.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=$e(4),Te.Card8=Te.BYTE,pe.Card8=pe.BYTE,Te.Card16=Te.USHORT,pe.Card16=pe.USHORT,Te.OffSize=Te.BYTE,pe.OffSize=pe.BYTE,Te.SID=Te.USHORT,pe.SID=pe.USHORT,Te.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?Te.NUMBER16(s):Te.NUMBER32(s)},pe.NUMBER=function(s){return Te.NUMBER(s).length},Te.NUMBER16=function(s){return[28,s>>8&255,s&255]},pe.NUMBER16=$e(3),Te.NUMBER32=function(s){return[29,s>>24&255,s>>16&255,s>>8&255,s&255]},pe.NUMBER32=$e(5),Te.REAL=function(s){let o=s.toString(),c=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(o);if(c){let m=parseFloat("1e"+((c[2]?+c[2]:0)+c[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 Te.REAL(s).length},Te.NAME=Te.CHARARRAY,pe.NAME=pe.CHARARRAY,Te.STRING=Te.CHARARRAY,pe.STRING=pe.CHARARRAY,wt.UTF8=function(s,o,c){let d=[],f=c;for(let m=0;m<f;m++,o+=1)d[m]=s.getUint8(o);return String.fromCharCode.apply(null,d)},wt.UTF16=function(s,o,c){let d=[],f=c/2;for(let m=0;m<f;m++,o+=2)d[m]=s.getUint16(o);return String.fromCharCode.apply(null,d)},Te.UTF16=function(s){let o=[];for(let c=0;c<s.length;c+=1){let d=s.charCodeAt(c);o[o.length]=d>>8&255,o[o.length]=d&255}return o},pe.UTF16=function(s){return s.length*2};var pt={"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":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};wt.MACSTRING=function(s,o,c,d){let f=pt[d];if(f===void 0)return;let m="";for(let v=0;v<c;v++){let T=s.getUint8(o+v);T<=127?m+=String.fromCharCode(T):m+=f[T&127]}return m};var Tt=typeof WeakMap=="function"&&new WeakMap,Ct,rr=function(s){if(!Ct){Ct={};for(let f in pt)Ct[f]=new String(f)}let o=Ct[s];if(o===void 0)return;if(Tt){let f=Tt.get(o);if(f!==void 0)return f}let c=pt[s];if(c===void 0)return;let d={};for(let f=0;f<c.length;f++)d[c.charCodeAt(f)]=f+128;return Tt&&Tt.set(o,d),d};Te.MACSTRING=function(s,o){let c=rr(o);if(c===void 0)return;let d=[];for(let f=0;f<s.length;f++){let m=s.charCodeAt(f);if(m>=128&&(m=c[m],m===void 0))return;d[f]=m}return d},pe.MACSTRING=function(s,o){let c=Te.MACSTRING(s,o);return c!==void 0?c.length:0};function ir(s){return s>=-128&&s<=127}function yt(s,o,c){let d=0,f=s.length;for(;o<f&&d<64&&s[o]===0;)++o,++d;return c.push(128|d-1),o}function bt(s,o,c){let d=0,f=s.length,m=o;for(;m<f&&d<64;){let v=s[m];if(!ir(v)||v===0&&m+1<f&&s[m+1]===0)break;++m,++d}c.push(d-1);for(let v=o;v<m;++v)c.push(s[v]+256&255);return m}function _t(s,o,c){let d=0,f=s.length,m=o;for(;m<f&&d<64;){let v=s[m];if(v===0||ir(v)&&m+1<f&&ir(s[m+1]))break;++m,++d}c.push(64|d-1);for(let v=o;v<m;++v){let T=s[v];c.push(T+65536>>8&255,T+256&255)}return m}Te.VARDELTAS=function(s){let o=0,c=[];for(;o<s.length;){let d=s[o];d===0?o=yt(s,o,c):d>=-128&&d<=127?o=bt(s,o,c):o=_t(s,o,c)}return c},Te.INDEX=function(s){let o=1,c=[o],d=[];for(let T=0;T<s.length;T+=1){let _=Te.OBJECT(s[T]);Array.prototype.push.apply(d,_),o+=_.length,c.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,Te.BYTE,Te.USHORT,Te.UINT24,Te.ULONG][m];for(let T=0;T<c.length;T+=1){let _=v(c[T]);Array.prototype.push.apply(f,_)}return Array.prototype.concat(Te.Card16(s.length),Te.OffSize(m),f,d)},pe.INDEX=function(s){return Te.INDEX(s).length},Te.DICT=function(s){let o=[],c=Object.keys(s),d=c.length;for(let f=0;f<d;f+=1){let m=parseInt(c[f],0),v=s[m],T=Te.OPERAND(v.value,v.type),_=Te.OPERATOR(m);for(let M=0;M<T.length;M++)o.push(T[M]);for(let M=0;M<_.length;M++)o.push(_[M])}return o},pe.DICT=function(s){return Te.DICT(s).length},Te.OPERATOR=function(s){return s<1200?[s]:[12,s-1200]},Te.OPERAND=function(s,o){let c=[];if(Array.isArray(o))for(let d=0;d<o.length;d+=1){X.argument(s.length===o.length,"Not enough arguments given for type"+o);let f=Te.OPERAND(s[d],o[d]);for(let m=0;m<f.length;m++)c.push(f[m])}else if(o==="SID"){let d=Te.NUMBER(s);for(let f=0;f<d.length;f++)c.push(d[f])}else if(o==="offset"){let d=Te.NUMBER32(s);for(let f=0;f<d.length;f++)c.push(d[f])}else if(o==="number"){let d=Te.NUMBER(s);for(let f=0;f<d.length;f++)c.push(d[f])}else if(o==="real"){let d=Te.REAL(s);for(let f=0;f<d.length;f++)c.push(d[f])}else throw new Error("Unknown operand type "+o);return c},Te.OP=Te.BYTE,pe.OP=pe.BYTE;var Qt=typeof WeakMap=="function"&&new WeakMap;Te.CHARSTRING=function(s){if(Qt){let d=Qt.get(s);if(d!==void 0)return d}let o=[],c=s.length;for(let d=0;d<c;d+=1){let f=s[d],m=Te[f.type](f.value);for(let v=0;v<m.length;v++)o.push(m[v])}return Qt&&Qt.set(s,o),o},pe.CHARSTRING=function(s){return Te.CHARSTRING(s).length},Te.OBJECT=function(s){let o=Te[s.type];return X.argument(o!==void 0,"No encoding function for type "+s.type),o(s.value)},pe.OBJECT=function(s){let o=pe[s.type];return X.argument(o!==void 0,"No sizeOf function for type "+s.type),o(s.value)},Te.TABLE=function(s){let o=[],c=(s.fields||[]).length,d=[],f=[];for(let m=0;m<c;m+=1){let v=s.fields[m],T=Te[v.type];X.argument(T!==void 0,"No encoding function for field type "+v.type+" ("+v.name+")");let _=s[v.name];_===void 0&&(_=v.value);let M=T(_);if(v.type==="TABLE")_.fields!==null&&(f.push(o.length),d.push(M)),o.push(0,0);else for(let E=0;E<M.length;E++)o.push(M[E])}for(let m=0;m<d.length;m+=1){let v=f[m],T=o.length;X.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,c=(s.fields||[]).length;for(let d=0;d<c;d+=1){let f=s.fields[d],m=pe[f.type];X.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},Te.RECORD=Te.TABLE,pe.RECORD=pe.TABLE,Te.LITERAL=function(s){return s},pe.LITERAL=function(s){return s.length};function Et(s,o,c){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,c){let d=Object.keys(c);for(let f=0;f<d.length;f+=1){let m=d[f],v=c[m];this[m]!==void 0&&(this[m]=v)}}}Et.prototype.encode=function(){return Te.TABLE(this)},Et.prototype.sizeOf=function(){return pe.TABLE(this)};function Ht(s,o,c){c===void 0&&(c=o.length);let d=new Array(o.length+1);d[0]={name:s+"Count",type:"USHORT",value:c};for(let f=0;f<o.length;f++)d[f+1]={name:s+f,type:"USHORT",value:o[f]};return d}function ne(s,o,c){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:c(o[m],m)};return f}function Pe(s,o,c){let d=o.length,f=[];f[0]={name:s+"Count",type:"USHORT",value:d};for(let m=0;m<d;m++)f=f.concat(c(o[m],m));return f}function it(s){s.format===1?Et.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(Ht("glyph",s.glyphs))):s.format===2?Et.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(Pe("rangeRecord",s.ranges,function(o,c){return[{name:"startGlyphID"+c,type:"USHORT",value:o.start},{name:"endGlyphID"+c,type:"USHORT",value:o.end},{name:"startCoverageIndex"+c,type:"USHORT",value:o.index}]}))):X.assert(!1,"Coverage format must be 1 or 2.")}it.prototype=Object.create(Et.prototype),it.prototype.constructor=it;function jt(s){Et.call(this,"scriptListTable",Pe("scriptRecord",s,function(o,c){let d=o.script,f=d.defaultLangSys;return X.assert(!!f,"Unable to write GSUB: script "+o.tag+" has no default language system."),[{name:"scriptTag"+c,type:"TAG",value:o.tag},{name:"script"+c,type:"TABLE",value:new Et("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new Et("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:f.reqFeatureIndex}].concat(Ht("featureIndex",f.featureIndexes)))}].concat(Pe("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 Et("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:T.reqFeatureIndex}].concat(Ht("featureIndex",T.featureIndexes)))}]})))}]}))}jt.prototype=Object.create(Et.prototype),jt.prototype.constructor=jt;function ue(s){Et.call(this,"featureListTable",Pe("featureRecord",s,function(o,c){let d=o.feature;return[{name:"featureTag"+c,type:"TAG",value:o.tag},{name:"feature"+c,type:"TABLE",value:new Et("featureTable",[{name:"featureParams",type:"USHORT",value:d.featureParams}].concat(Ht("lookupListIndex",d.lookupListIndexes)))}]}))}ue.prototype=Object.create(Et.prototype),ue.prototype.constructor=ue;function Nt(s,o){Et.call(this,"lookupListTable",ne("lookup",s,function(c){let d=o[c.lookupType];return X.assert(!!d,"Unable to write GSUB lookup type "+c.lookupType+" tables."),new Et("lookupTable",[{name:"lookupType",type:"USHORT",value:c.lookupType},{name:"lookupFlag",type:"USHORT",value:c.lookupFlag}].concat(ne("subtable",c.subtables,d)))}))}Nt.prototype=Object.create(Et.prototype),Nt.prototype.constructor=Nt;function qt(s){s.format===1?Et.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:1},{name:"startGlyphID",type:"USHORT",value:s.startGlyph}].concat(Ht("glyph",s.classes))):s.format===2?Et.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:2}].concat(Pe("rangeRecord",s.ranges,function(o,c){return[{name:"startGlyphID"+c,type:"USHORT",value:o.start},{name:"endGlyphID"+c,type:"USHORT",value:o.end},{name:"class"+c,type:"USHORT",value:o.classId}]}))):X.assert(!1,"Class format must be 1 or 2.")}qt.prototype=Object.create(Et.prototype),qt.prototype.constructor=qt;var Se={Table:Et,Record:Et,Coverage:it,ClassDef:qt,ScriptList:jt,FeatureList:ue,LookupList:Nt,ushortList:Ht,tableList:ne,recordList:Pe};function Ce(s,o){return s.getUint8(o)}function ut(s,o){return s.getUint16(o,!1)}function Ge(s,o){return s.getInt16(o,!1)}function dr(s,o){return(s.getUint16(o)<<8)+s.getUint8(o+2)}function Rt(s,o){return s.getUint32(o,!1)}function un(s,o){return s.getInt32(o,!1)}function It(s,o){let c=s.getInt16(o,!1),d=s.getUint16(o+2,!1);return c+d/65535}function jn(s,o){let c="";for(let d=o;d<o+4;d+=1)c+=String.fromCharCode(s.getInt8(d));return c}function is(s,o,c){let d=0;for(let f=0;f<c;f+=1)d<<=8,d+=s.getUint8(o+f);return d}function Pn(s,o,c){let d=[];for(let f=o;f<c;f+=1)d.push(s.getUint8(f));return d}function Tr(s){let o="";for(let c=0;c<s.length;c+=1)o+=String.fromCharCode(s[c]);return o}var In={byte:1,uShort:2,f2dot14:2,short:2,uInt24:3,uLong:4,fixed:4,longDateTime:8,tag:4},Br={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 ie(s,o){this.data=s,this.offset=o,this.relativeOffset=0}ie.prototype.parseByte=function(){let s=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,s},ie.prototype.parseChar=function(){let s=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,s},ie.prototype.parseCard8=ie.prototype.parseByte,ie.prototype.parseUShort=function(){let s=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,s},ie.prototype.parseCard16=ie.prototype.parseUShort,ie.prototype.parseSID=ie.prototype.parseUShort,ie.prototype.parseOffset16=ie.prototype.parseUShort,ie.prototype.parseShort=function(){let s=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,s},ie.prototype.parseF2Dot14=function(){let s=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,s},ie.prototype.parseUInt24=function(){let s=dr(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=3,s},ie.prototype.parseULong=function(){let s=Rt(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,s},ie.prototype.parseLong=function(){let s=un(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,s},ie.prototype.parseOffset32=ie.prototype.parseULong,ie.prototype.parseFixed=function(){let s=It(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,s},ie.prototype.parseString=function(s){let o=this.data,c=this.offset+this.relativeOffset,d="";this.relativeOffset+=s;for(let f=0;f<s;f++)d+=String.fromCharCode(o.getUint8(c+f));return d},ie.prototype.parseTag=function(){return this.parseString(4)},ie.prototype.parseLongDateTime=function(){let s=Rt(this.data,this.offset+this.relativeOffset+4);return s-=2082844800,this.relativeOffset+=8,s},ie.prototype.parseVersion=function(s){let o=ut(this.data,this.offset+this.relativeOffset),c=ut(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,s===void 0&&(s=4096),o+c/s/10},ie.prototype.skip=function(s,o){o===void 0&&(o=1),this.relativeOffset+=In[s]*o},ie.prototype.parseULongList=function(s){s===void 0&&(s=this.parseULong());let o=new Array(s),c=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<s;f++)o[f]=c.getUint32(d),d+=4;return this.relativeOffset+=s*4,o},ie.prototype.parseOffset16List=ie.prototype.parseUShortList=function(s){s===void 0&&(s=this.parseUShort());let o=new Array(s),c=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<s;f++)o[f]=c.getUint16(d),d+=2;return this.relativeOffset+=s*2,o},ie.prototype.parseShortList=function(s){let o=new Array(s),c=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<s;f++)o[f]=c.getInt16(d),d+=2;return this.relativeOffset+=s*2,o},ie.prototype.parseByteList=function(s){let o=new Array(s),c=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<s;f++)o[f]=c.getUint8(d++);return this.relativeOffset+=s,o},ie.prototype.parseList=function(s,o){o||(o=s,s=this.parseUShort());let c=new Array(s);for(let d=0;d<s;d++)c[d]=o.call(this);return c},ie.prototype.parseList32=function(s,o){o||(o=s,s=this.parseULong());let c=new Array(s);for(let d=0;d<s;d++)c[d]=o.call(this);return c},ie.prototype.parseRecordList=function(s,o){o||(o=s,s=this.parseUShort());let c=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)}c[f]=m}return c},ie.prototype.parseRecordList32=function(s,o){o||(o=s,s=this.parseULong());let c=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)}c[f]=m}return c},ie.prototype.parseTupleRecords=function(s,o){let c=[];for(let d=0;d<s;d++){let f=[];for(let m=0;m<o;m++)f.push(this.parseF2Dot14());c.push(f)}return c},ie.prototype.parseStruct=function(s){if(typeof s=="function")return s.call(this);{let o=Object.keys(s),c={};for(let d=0;d<o.length;d++){let f=o[d],m=s[f];c[f]=m.call(this)}return c}},ie.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},ie.prototype.parseValueRecordList=function(){let s=this.parseUShort(),o=this.parseUShort(),c=new Array(o);for(let d=0;d<o;d++)c[d]=this.parseValueRecord(s);return c},ie.prototype.parsePointer=function(s){let o=this.parseOffset16();if(o>0)return new ie(this.data,this.offset+o).parseStruct(s)},ie.prototype.parsePointer32=function(s){let o=this.parseOffset32();if(o>0)return new ie(this.data,this.offset+o).parseStruct(s)},ie.prototype.parseListOfLists=function(s){let o=this.parseOffset16List(),c=o.length,d=this.relativeOffset,f=new Array(c);for(let m=0;m<c;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 M=0;M<T.length;M++)this.relativeOffset=v+T[M],_[M]=s.call(this);f[m]=_}else f[m]=this.parseUShortList()}return this.relativeOffset=d,f},ie.prototype.parseCoverage=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort(),c=this.parseUShort();if(o===1)return{format:1,glyphs:this.parseUShortList(c)};if(o===2){let d=new Array(c);for(let f=0;f<c;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.")},ie.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:ie.uShort,end:ie.uShort,classId:ie.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})},ie.list=function(s,o){return function(){return this.parseList(s,o)}},ie.list32=function(s,o){return function(){return this.parseList32(s,o)}},ie.recordList=function(s,o){return function(){return this.parseRecordList(s,o)}},ie.recordList32=function(s,o){return function(){return this.parseRecordList32(s,o)}},ie.pointer=function(s){return function(){return this.parsePointer(s)}},ie.pointer32=function(s){return function(){return this.parsePointer32(s)}},ie.tag=ie.prototype.parseTag,ie.byte=ie.prototype.parseByte,ie.uShort=ie.offset16=ie.prototype.parseUShort,ie.uShortList=ie.prototype.parseUShortList,ie.uInt24=ie.prototype.parseUInt24,ie.uLong=ie.offset32=ie.prototype.parseULong,ie.uLongList=ie.prototype.parseULongList,ie.fixed=ie.prototype.parseFixed,ie.f2Dot14=ie.prototype.parseF2Dot14,ie.struct=ie.prototype.parseStruct,ie.coverage=ie.prototype.parseCoverage,ie.classDef=ie.prototype.parseClassDef;var $r={reserved:ie.uShort,reqFeatureIndex:ie.uShort,featureIndexes:ie.uShortList};ie.prototype.parseScriptList=function(){return this.parsePointer(ie.recordList({tag:ie.tag,script:ie.pointer({defaultLangSys:ie.pointer($r),langSysRecords:ie.recordList({tag:ie.tag,langSys:ie.pointer($r)})})}))||[]},ie.prototype.parseFeatureList=function(){return this.parsePointer(ie.recordList({tag:ie.tag,feature:ie.pointer({featureParams:ie.offset16,lookupListIndexes:ie.uShortList})}))||[]},ie.prototype.parseLookupList=function(s){return this.parsePointer(ie.list(ie.pointer(function(){let o=this.parseUShort();X.argument(1<=o&&o<=9,"GPOS/GSUB lookup type "+o+" unknown.");let c=this.parseUShort(),d=c&16;return{lookupType:o,lookupFlag:c,subtables:this.parseList(ie.pointer(s[o])),markFilteringSet:d?this.parseUShort():void 0}})))||[]},ie.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){let s=this.parseUShort(),o=this.parseUShort();return X.argument(s===1&&o<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:ie.offset32,featureTableSubstitutionOffset:ie.offset32})})||[]},ie.prototype.parseVariationStore=function(){let s=this.relativeOffset,o=this.parseUShort(),c={itemVariationStore:this.parseItemVariationStore()};return this.relativeOffset=s+o+2,c},ie.prototype.parseItemVariationStore=function(){let s=this.relativeOffset,o={format:this.parseUShort(),variationRegions:[],itemVariationSubtables:[]},c=this.parseOffset32(),d=this.parseUShort(),f=this.parseULongList(d);this.relativeOffset=s+c,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},ie.prototype.parseVariationRegionList=function(){let s=this.parseUShort(),o=this.parseUShort();return this.parseRecordList(o,{regionAxes:ie.recordList(s,{startCoord:ie.f2Dot14,peakCoord:ie.f2Dot14,endCoord:ie.f2Dot14})})},ie.prototype.parseItemVariationSubtable=function(){let s=this.parseUShort(),o=this.parseUShort(),c=this.parseUShortList(),d=c.length;return{regionIndexes:c,deltaSets:s&&d?this.parseDeltaSets(s,o,d):[]}},ie.prototype.parseDeltaSetIndexMap=function(){let s=this.parseByte(),o=this.parseByte(),c=[],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&Br.INNER_INDEX_BIT_COUNT_MASK)+1,m=((o&Br.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,M=T&(1<<f)-1;c.push({outerIndex:_,innerIndex:M})}return{format:s,entryFormat:o,map:c}},ie.prototype.parseDeltaSets=function(s,o,c){let d=Array.from({length:s},()=>[]),f=o&Br.LONG_WORDS,m=o&Br.WORD_DELTA_COUNT_MASK;if(m>c)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 M=0;M<c;M++)M<m?d[_].push(v()):d[_].push(T());return d},ie.prototype.parseTupleVariationStoreList=function(s,o,c){let d=this.parseUShort(),f=this.parseUShort()&1,m=this.parseOffset32(),v=(f?this.parseULong:this.parseUShort).bind(this),T={},_=v();f||(_*=2);let M;for(let E=0;E<d;E++){M=v(),f||(M*=2);let G=M-_;T[E]=G?this.parseTupleVariationStore(m+_,s,o,c,E):void 0,_=M}return T},ie.prototype.parseTupleVariationStore=function(s,o,c,d,f){let m=this.relativeOffset;this.relativeOffset=s,c==="cvar"&&(this.relativeOffset+=4);let v=this.parseUShort(),T=!!(v&Br.SHARED_POINT_NUMBERS),_=v&Br.COUNT_MASK,M=this.parseOffset16(),E=[],G=[];for(let J=0;J<_;J++){let fe=this.parseTupleVariationHeader(o,c);E.push(fe)}this.relativeOffset!==s+M&&(console.warn(`Unexpected offset after parsing tuple variation headers! Expected ${s+M}, actually ${this.relativeOffset}`),this.relativeOffset=s+M),T&&(G=this.parsePackedPointNumbers());let H=this.relativeOffset;for(let J=0;J<_;J++){let fe=E[J];fe.privatePoints=[],this.relativeOffset=H,c==="cvar"&&!fe.peakTuple&&console.warn("An embedded peak tuple is required in TupleVariationHeaders for the cvar table."),fe.flags.privatePointNumbers&&(fe.privatePoints=this.parsePackedPointNumbers()),delete fe.flags;let Xe=this.offset,gr=this.relativeOffset,or=Ir=>{let Kr,Dn,qn=()=>{let Yn=0;if(c==="gvar"){if(Yn=fe.privatePoints.length||G.length,!Yn){let Qs=d.get(f);Qs.path,Yn=Qs.points.length,Yn+=4}}else c==="cvar"&&(Yn=d.length);this.offset=Xe,this.relativeOffset=gr,Kr=this.parsePackedDeltas(Yn),c==="gvar"&&(Dn=this.parsePackedDeltas(Yn))};return{configurable:!0,get:function(){return Kr===void 0&&qn(),Ir==="deltasY"?Dn:Kr},set:function(Yn){Kr===void 0&&qn(),Ir==="deltasY"?Dn=Yn:Kr=Yn}}};Object.defineProperty(fe,"deltas",or.call(this,"deltas")),c==="gvar"&&Object.defineProperty(fe,"deltasY",or.call(this,"deltasY")),H+=fe.variationDataSize,delete fe.variationDataSize}this.relativeOffset=m;let oe={headers:E};return oe.sharedPoints=G,oe},ie.prototype.parseTupleVariationHeader=function(s,o){let c=this.parseUShort(),d=this.parseUShort(),f=!!(d&Br.EMBEDDED_PEAK_TUPLE),m=!!(d&Br.INTERMEDIATE_REGION),v=!!(d&Br.PRIVATE_POINT_NUMBERS),T=f?void 0:d&Br.TUPLE_INDEX_MASK,_=f?this.parseTupleRecords(1,s)[0]:void 0,M=m?this.parseTupleRecords(1,s)[0]:void 0,E=m?this.parseTupleRecords(1,s)[0]:void 0,G={variationDataSize:c,peakTuple:_,intermediateStartTuple:M,intermediateEndTuple:E,flags:{embeddedPeakTuple:f,intermediateRegion:m,privatePointNumbers:v}};return o==="gvar"&&(G.sharedTupleRecordsIndex=T),G},ie.prototype.parsePackedPointNumbers=function(){let s=this.parseByte(),o=[],c=s;if(s>=128){let f=this.parseByte();c=(s&Br.POINT_RUN_COUNT_MASK)<<8|f}let d=0;for(;o.length<c;){let f=this.parseByte(),m=!!(f&Br.POINTS_ARE_WORDS),v=(f&Br.POINT_RUN_COUNT_MASK)+1;for(let T=0;T<v&&o.length<c;T++){let _;m?_=this.parseUShort():_=this.parseByte(),d=d+_,o.push(d)}}return o},ie.prototype.parsePackedDeltas=function(s){let o=[];for(;o.length<s;){let c=this.parseByte(),d=!!(c&Br.DELTAS_ARE_ZERO),f=!!(c&Br.DELTAS_ARE_WORDS),m=(c&Br.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 ft={getByte:Ce,getCard8:Ce,getUShort:ut,getCard16:ut,getShort:Ge,getUInt24:dr,getULong:Rt,getFixed:It,getTag:jn,getOffset:is,getBytes:Pn,bytesToString:Tr,Parser:ie},hr=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],Ls={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"},Un={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},as={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 Pr(s,o,c){switch(s){case 0:if(o===65535)return"und";if(c)return c[o];break;case 1:return Ls[o];case 3:return as[o]}}var Yt="utf-16",Xn={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"},dn={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 kr(s,o,c){switch(s){case 0:return Yt;case 1:return dn[c]||Xn[o];case 3:if(o===1||o===10)return Yt;break}}var Or={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function Ur(s){return Or[s]}function qr(s,o,c){let d={},f=new ft.Parser(s,o),m=f.parseUShort(),v=f.parseUShort(),T=f.offset+f.parseUShort();for(let _=0;_<v;_++){let M=f.parseUShort(),E=f.parseUShort(),G=f.parseUShort(),H=f.parseUShort(),oe=hr[H]||H,J=f.parseUShort(),fe=f.parseUShort(),Xe=Pr(M,G,c),gr=kr(M,E,G),or=Ur(M);if(gr!==void 0&&Xe!==void 0&&or!==void 0){let Ir;if(gr===Yt?Ir=wt.UTF16(s,T+fe,J):Ir=wt.MACSTRING(s,T+fe,J,gr),Ir){let Kr=d[or];Kr===void 0&&(Kr=d[or]={});let Dn=Kr[oe];Dn===void 0&&(Dn=Kr[oe]={}),Dn[Xe]=Ir}}}return m===1&&f.parseUShort(),d}function An(s){let o={};for(let c in s)o[s[c]]=parseInt(c);return o}function Yr(s,o,c,d,f,m){return new Se.Record("NameRecord",[{name:"platformID",type:"USHORT",value:s},{name:"encodingID",type:"USHORT",value:o},{name:"languageID",type:"USHORT",value:c},{name:"nameID",type:"USHORT",value:d},{name:"length",type:"USHORT",value:f},{name:"offset",type:"USHORT",value:m}])}function jr(s,o){let c=s.length,d=o.length-c+1;e:for(let f=0;f<d;f++)for(;f<d;f++){for(let m=0;m<c;m++)if(o[f+m]!==s[m])continue e;return f}return-1}function En(s,o){let c=jr(s,o);if(c<0){c=o.length;let d=0,f=s.length;for(;d<f;++d)o.push(s[d])}return c}function Z(s,o){let c=An(Or),d=An(Ls),f=An(as),m=[],v=[];for(let _ in s){let M,E=[],G={},H=An(hr),oe=c[_];for(let J in s[_]){let fe=H[J];if(fe===void 0&&(fe=J),M=parseInt(fe),isNaN(M))throw new Error('Name table entry "'+J+'" does not exist, see nameTableNames for complete list.');G[M]=s[_][J],E.push(M)}for(let J=0;J<E.length;J++){M=E[J];let fe=G[M];for(let Xe in fe){let gr=fe[Xe];if(oe===1||oe===0){let or=d[Xe],Ir=Un[or],Kr=kr(oe,Ir,or),Dn=Te.MACSTRING(gr,Kr);if(oe===0&&(or=o.indexOf(Xe),or<0&&(or=o.length,o.push(Xe)),Ir=4,Dn=Te.UTF16(gr)),Dn!==void 0){let qn=En(Dn,v);m.push(Yr(oe,Ir,or,M,Dn.length,qn))}}if(oe===3){let or=f[Xe];if(or!==void 0){let Ir=Te.UTF16(gr),Kr=En(Ir,v);m.push(Yr(3,1,or,M,Ir.length,Kr))}}}}}m.sort(function(_,M){return _.platformID-M.platformID||_.encodingID-M.encodingID||_.languageID-M.languageID||_.nameID-M.nameID});let T=new Se.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 He(s,o,c=[]){if(o<256&&o in hr){if(c.length&&!c.includes(parseInt(o)))return;o=hr[o]}for(let d in s)for(let f in s[d])if(f===o||parseInt(f)===o)return s[d][f]}var xt={parse:qr,make:Z,getNameByID:He};function cr(s,o,c,d){s.length=o.parseUShort(),s.language=o.parseUShort()-1;let f=o.parseByteList(s.length),m=Object.assign({},f),v=kr(c,d,s.language),T=pt[v];for(let _=0;_<T.length;_++)m[T.charCodeAt(_)]=f[128+_];s.glyphIndexMap=m}function Gt(s,o,c){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,c===12&&T++}}function At(s,o,c,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 ft.Parser(c,d+f+14),T=new ft.Parser(c,d+f+16+m*2),_=new ft.Parser(c,d+f+16+m*4),M=new ft.Parser(c,d+f+16+m*6),E=d+f+16+m*8;for(let G=0;G<m-1;G+=1){let H,oe=v.parseUShort(),J=T.parseUShort(),fe=_.parseShort(),Xe=M.parseUShort();for(let gr=J;gr<=oe;gr+=1)Xe!==0?(E=M.offset+M.relativeOffset-2,E+=Xe,E+=(gr-J)*2,H=ft.getUShort(c,E),H!==0&&(H=H+fe&65535)):H=gr+fe&65535,s.glyphIndexMap[gr]=H}}function hn(s,o){let c={};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(),M=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 E={},G=o.parseRecordList32({unicodeValue:o.parseUInt24,glyphID:o.parseUShort});for(let H=0;H<G.length;H+=1)E[G[H].unicodeValue]=G[H];return E}})),c[m]=v,o.relativeOffset=M}s.varSelectorList=c}function nn(s,o){let c={};c.version=ft.getUShort(s,o),X.argument(c.version===0,"cmap table version should be 0."),c.numTables=ft.getUShort(s,o+2);let d=null,f=-1,m=-1,v=null,T=null,_=[0,1,2,3,4,6],M=[0,1,10];for(let G=c.numTables-1;G>=0;G-=1)if(v=ft.getUShort(s,o+4+G*8),T=ft.getUShort(s,o+4+G*8+2),v===3&&M.includes(T)||v===0&&_.includes(T)||v===1&&T===0){if(m>0)continue;if(m=ft.getULong(s,o+4+G*8+4),d)break}else if(v===0&&T===5){if(f=ft.getULong(s,o+4+G*8+4),d=new ft.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 E=new ft.Parser(s,o+m);if(c.format=E.parseUShort(),c.format===0)cr(c,E,v,T);else if(c.format===12||c.format===13)Gt(c,E,c.format);else if(c.format===4)At(c,E,s,o,m);else throw new Error("Only format 0 (platformId 1, encodingId 0), 4, 12 and 14 cmap tables are supported (found format "+c.format+", platformId "+v+", encodingId "+T+").");return d&&hn(c,d),c}function On(s,o,c){s.segments.push({end:o,start:o,delta:-(o-c),offset:0,glyphIndex:c})}function rn(s){s.segments.push({end:65535,start:65535,delta:1,offset:0})}function Tn(s){if(s.length===0)return s;let o=[s[0]];for(let c=1;c<s.length;c++){let d=o[o.length-1],f=s[c];d.end+1===f.start&&d.delta===f.delta&&f.end!==65535?d.end=f.end:o.push(f)}return o}function Cn(s){let o=!0,c;for(c=s.length-1;c>0;c-=1)if(s.get(c).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 Se.Table("cmap",d);for(f.segments=[],c=0;c<s.length;c+=1){let oe=s.get(c);for(let J=0;J<oe.unicodes.length;J+=1)On(f,oe.unicodes[J],c)}f.segments.sort(function(oe,J){return oe.start-J.start}),f.segments=Tn(f.segments),rn(f);let m=f.segments.length,v=0,T=[],_=[],M=[],E=[],G=[],H=[];for(c=0;c<m;c+=1){let oe=f.segments[c];oe.end<=65535&&oe.start<=65535?(T.push({name:"end_"+c,type:"USHORT",value:oe.end}),_.push({name:"start_"+c,type:"USHORT",value:oe.start}),M.push({name:"idDelta_"+c,type:"SHORT",value:oe.delta}),E.push({name:"idRangeOffset_"+c,type:"USHORT",value:oe.offset}),oe.glyphId!==void 0&&G.push({name:"glyph_"+c,type:"USHORT",value:oe.glyphId})):v+=1,!o&&oe.glyphIndex!==void 0&&(H.push({name:"cmap12Start_"+c,type:"ULONG",value:oe.start}),H.push({name:"cmap12End_"+c,type:"ULONG",value:oe.end}),H.push({name:"cmap12Glyph_"+c,type:"ULONG",value:oe.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 oe=0;oe<T.length;oe++)f.fields.push(T[oe]);f.fields.push({name:"reservedPad",type:"USHORT",value:0});for(let oe=0;oe<_.length;oe++)f.fields.push(_[oe]);for(let oe=0;oe<M.length;oe++)f.fields.push(M[oe]);for(let oe=0;oe<E.length;oe++)f.fields.push(E[oe]);for(let oe=0;oe<G.length;oe++)f.fields.push(G[oe]);if(f.cmap4Length=14+T.length*2+2+_.length*2+M.length*2+E.length*2+G.length*2,!o){let oe=16+H.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:oe},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:H.length/3});for(let J=0;J<H.length;J++)f.fields.push(H[J])}return f}var $n={parse:nn,make:Cn},ar=[".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"],us=[".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"],yr=[".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"],Qr=[".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"],Cr=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],ds=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Ln=[".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 Rn(s){this.font=s}Rn.prototype.charToGlyphIndex=function(s){let o=s.codePointAt(0),c=this.font.glyphs;if(c)for(let d=0;d<c.length;d+=1){let f=c.get(d);for(let m=0;m<f.unicodes.length;m+=1)if(f.unicodes[m]===o)return d}return null};function zr(s){this.cmap=s}zr.prototype.charToGlyphIndex=function(s){return this.cmap.glyphIndexMap[s.codePointAt(0)]||0};function Jn(s,o){this.encoding=s,this.charset=o}Jn.prototype.charToGlyphIndex=function(s){let o=s.codePointAt(0),c=this.encoding[o];return this.charset.indexOf(c)};function es(s){switch(s.version){case 1:this.names=Ln.slice();break;case 2:this.names=new Array(s.numberOfGlyphs);for(let o=0;o<s.numberOfGlyphs;o++)s.glyphNameIndex[o]<Ln.length?this.names[o]=Ln[s.glyphNameIndex[o]]:this.names[o]=s.names[s.glyphNameIndex[o]-Ln.length];break;case 2.5:this.names=new Array(s.numberOfGlyphs);for(let o=0;o<s.numberOfGlyphs;o++)this.names[o]=Ln[o+s.glyphNameIndex[o]];break;case 3:this.names=[];break;default:this.names=[];break}}es.prototype.nameToGlyphIndex=function(s){return this.names.indexOf(s)},es.prototype.glyphIndexToName=function(s){return this.names[s]};function ur(s){let o,c=s.tables.cmap.glyphIndexMap,d=Object.keys(c);for(let f=0;f<d.length;f+=1){let m=d[f],v=c[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 Hr(s){s._IndexToUnicodeMap={};let o=s.tables.cmap.glyphIndexMap,c=Object.keys(o);for(let d=0;d<c.length;d+=1){let f=c[d],m=o[f];s._IndexToUnicodeMap[m]===void 0?s._IndexToUnicodeMap[m]={unicodes:[parseInt(f)]}:s._IndexToUnicodeMap[m].unicodes.push(parseInt(f))}}function on(s,o){o.lowMemory?Hr(s):ur(s)}function Ms(s,o,c,d,f){s.beginPath(),s.moveTo(o,c),s.lineTo(d,f),s.stroke()}var yn={line:Ms};function $(s,o){let c=new ie(s,o),d=c.parseShort();d!==0&&console.warn("Only CPALv0 is currently fully supported.");let f=c.parseShort(),m=c.parseShort(),v=c.parseShort(),T=c.parseOffset32(),_=c.parseUShortList(m);c.relativeOffset=T;let M=c.parseULongList(v);return c.relativeOffset=T,{version:d,numPaletteEntries:f,colorRecords:M,colorRecordIndices:_}}function he({version:s=0,numPaletteEntries:o=0,colorRecords:c=[],colorRecordIndices:d=[0]}){return X.argument(s===0,"Only CPALv0 are supported."),X.argument(c.length,"No colorRecords given."),X.argument(d.length,"No colorRecordIndices given."),d.length>1&&X.argument(o,"Can't infer numPaletteEntries on multiple colorRecordIndices"),new Se.Table("CPAL",[{name:"version",type:"USHORT",value:s},{name:"numPaletteEntries",type:"USHORT",value:o||c.length},{name:"numPalettes",type:"USHORT",value:d.length},{name:"numColorRecords",type:"USHORT",value:c.length},{name:"colorRecordsArrayOffset",type:"ULONG",value:12+2*d.length},...d.map((f,m)=>({name:"colorRecordIndices_"+m,type:"USHORT",value:f})),...c.map((f,m)=>({name:"colorRecords_"+m,type:"ULONG",value:f}))])}function De(s){var o=(s&4278190080)>>24,c=(s&16711680)>>16,d=(s&65280)>>8,f=s&255;return o=o+256&255,c=c+256&255,d=d+256&255,f=(f+256&255)/255,{b:o,g:c,r:d,a:f}}function Ee(s,o,c=0,d="hexa"){if(o==65535)return"currentColor";let f=s&&s.tables&&s.tables.cpal;if(!f)return"currentColor";if(c>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[c]+o;if(m>f.colorRecords)throw new Error(`Color index out of range (colorRecords.length: ${f.colorRecords.length}, lookupIndex: ${m})`);let v=De(f.colorRecords[m]);return d==="bgra"?v:mt(v,d)}function Me(s){return("0"+parseInt(s).toString(16)).slice(-2)}function ht(s){let o=s.r/255,c=s.g/255,d=s.b/255,f=Math.max(o,c,d),m=Math.min(o,c,d),v,T,_=(f+m)/2;if(f===m)v=T=0;else{let M=f-m;switch(T=_>.5?M/(2-f-m):M/(f+m),f){case o:v=(c-d)/M+(c<d?6:0);break;case c:v=(d-o)/M+2;break;case d:v=(o-c)/M+4;break}v/=6}return{h:v*360,s:T*100,l:_*100}}function vt(s){let{h:o,s:c,l:d,a:f}=s;o=o%360,c/=100,d/=100;let m=(1-Math.abs(2*d-1))*c,v=m*(1-Math.abs(o/60%2-1)),T=d-m/2,_=0,M=0,E=0;return 0<=o&&o<60?(_=m,M=v,E=0):60<=o&&o<120?(_=v,M=m,E=0):120<=o&&o<180?(_=0,M=m,E=v):180<=o&&o<240?(_=0,M=v,E=m):240<=o&&o<300?(_=v,M=0,E=m):300<=o&&o<=360&&(_=m,M=0,E=v),{r:Math.round((_+T)*255),g:Math.round((M+T)*255),b:Math.round((E+T)*255),a:f}}function lt(s){return parseInt(`0x${Me(s.b)}${Me(s.g)}${Me(s.r)}${Me(s.a*255)}`,16)}function rt(s,o="hexa"){let c=o=="raw"||o=="cpal",d=Number.isInteger(s),f=!0;if(d&&c||s==="currentColor")return s;if(typeof s=="object"){if(o=="bgra")return s;if(c)return lt(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=mt(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=vt({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 mt(s,o)}function mt(s,o="hexa"){if(s==="currentColor")return s;if(Number.isInteger(s)){if(o=="raw"||o=="cpal")return s;s=De(s)}else typeof s!="object"&&(s=rt(s,"bgra"));let c=["hsl","hsla"].includes(o)?ht(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`#${Me(s.r)}${Me(s.g)}${Me(s.b)}`;case"hexa":case"hex8":case"hex-8":return`#${Me(s.r)}${Me(s.g)}${Me(s.b)}${Me(s.a*255)}`;case"hsl":return`hsl(${c.h.toFixed(2)}, ${c.s.toFixed(2)}%, ${c.l.toFixed(2)}%)`;case"hsla":return`hsla(${c.h.toFixed(2)}, ${c.s.toFixed(2)}%, ${c.l.toFixed(2)}%, ${parseFloat(s.a.toFixed(3))})`;case"bgra":return s;case"raw":case"cpal":return lt(s);default:throw new Error("Unknown color format: "+o)}}var fr={parse:$,make:he,getPaletteColor:Ee,parseColor:rt,formatColor:mt};function gt(s,o){let c=o||new Oe;return{configurable:!0,get:function(){return typeof c=="function"&&(c=c()),c},set:function(d){c=d}}}function Kt(s){this.bindConstructorValues(s)}Kt.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",gt(this,s.path))},Kt.prototype.addUnicode=function(s){this.unicodes.length===0&&(this.unicode=s),this.unicodes.push(s)},Kt.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},Kt.prototype.getPath=function(s,o,c,d,f){s=s!==void 0?s:0,o=o!==void 0?o:0,c=c!==void 0?c:72,d=Object.assign({},f&&f.defaultRenderOptions,d);let m,v,T=d.xScale,_=d.yScale,M=1/(this.path.unitsPerEm||1e3)*c,E=this;f&&f.variation&&(E=f.variation.getTransform(this,d.variation),m=E.path.commands),d.hinting&&f&&f.hinting&&(v=E.path&&f.hinting.exec(E,c,d)),v?(m=f.hinting.getCommands(v),s=Math.round(s),o=Math.round(o),T=_=1):(m=E.path.commands,T===void 0&&(T=M),_===void 0&&(_=M));let G=new Oe;if(d.drawSVG){let H=this.getSvgImage(f);if(H){let oe=new Oe;return oe._image={image:H.image,x:s+H.leftSideBearing*M,y:o-H.baseline*M,width:H.image.width*M,height:H.image.height*M},G._layers=[oe],G}}if(d.drawLayers){let H=this.getLayers(f);if(H&&H.length){G._layers=[];for(let oe=0;oe<H.length;oe+=1){let J=H[oe],fe=Ee(f,J.paletteIndex,d.usePalette);fe==="currentColor"?fe=d.fill||"black":fe=mt(fe,d.colorFormat||"rgba"),d=Object.assign({},d,{fill:fe}),G._layers.push(this.getPath.call(J.glyph,s,o,c,d,f))}return G}}G.fill=d.fill||this.path.fill,G.stroke=this.path.stroke,G.strokeWidth=this.path.strokeWidth*M;for(let H=0;H<m.length;H+=1){let oe=m[H];oe.type==="M"?G.moveTo(s+oe.x*T,o+-oe.y*_):oe.type==="L"?G.lineTo(s+oe.x*T,o+-oe.y*_):oe.type==="Q"?G.quadraticCurveTo(s+oe.x1*T,o+-oe.y1*_,s+oe.x*T,o+-oe.y*_):oe.type==="C"?G.curveTo(s+oe.x1*T,o+-oe.y1*_,s+oe.x2*T,o+-oe.y2*_,s+oe.x*T,o+-oe.y*_):oe.type==="Z"&&G.stroke&&G.strokeWidth&&G.closePath()}return G},Kt.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)},Kt.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)},Kt.prototype.getContours=function(s=null){if(this.points===void 0&&!s)return[];let o=[],c=[],d=s||this.points;for(let f=0;f<d.length;f+=1){let m=d[f];c.push(m),m.lastPointOfContour&&(o.push(c),c=[])}return X.argument(c.length===0,"There are still points left in the current contour."),o},Kt.prototype.getMetrics=function(){let s=this.path.commands,o=[],c=[];for(let f=0;f<s.length;f+=1){let m=s[f];m.type!=="Z"&&(o.push(m.x),c.push(m.y)),(m.type==="Q"||m.type==="C")&&(o.push(m.x1),c.push(m.y1)),m.type==="C"&&(o.push(m.x2),c.push(m.y2))}let d={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,c),xMax:Math.max.apply(null,o),yMax:Math.max.apply(null,c),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},Kt.prototype.draw=function(s,o,c,d,f,m){f=Object.assign({},m&&m.defaultRenderOptions,f),this.getPath(o,c,d,f,m).draw(s)},Kt.prototype.drawPoints=function(s,o,c,d,f,m){if(f=Object.assign({},m&&m.defaultRenderOptions,f),f.drawLayers){let G=this.getLayers(m);if(G&&G.length){for(let H=0;H<G.length;H+=1)G[H].glyph.index!==this.index&&this.drawPoints.call(G[H].glyph,s,o,c,d);return}}function v(G,H,oe,J){s.beginPath();for(let fe=0;fe<G.length;fe+=1)s.moveTo(H+G[fe].x*J,oe+G[fe].y*J),s.arc(H+G[fe].x*J,oe+G[fe].y*J,2,0,Math.PI*2,!1);s.fill()}o=o!==void 0?o:0,c=c!==void 0?c:0,d=d!==void 0?d:24;let T=1/this.path.unitsPerEm*d,_=[],M=[],E=this.path.commands;m&&m.variation&&(E=m.variation.getTransform(this,f.variation).path.commands);for(let G=0;G<E.length;G+=1){let H=E[G];H.x!==void 0&&_.push({x:H.x,y:-H.y}),H.x1!==void 0&&M.push({x:H.x1,y:-H.y1}),H.x2!==void 0&&M.push({x:H.x2,y:-H.y2})}s.fillStyle="blue",v(_,o,c,T),s.fillStyle="red",v(M,o,c,T)},Kt.prototype.drawMetrics=function(s,o,c,d){let f;o=o!==void 0?o:0,c=c!==void 0?c:0,d=d!==void 0?d:24,f=1/this.path.unitsPerEm*d,s.lineWidth=1,s.strokeStyle="black",yn.line(s,o,-1e4,o,1e4),yn.line(s,-1e4,c,1e4,c);let m=this.xMin||0,v=this.yMin||0,T=this.xMax||0,_=this.yMax||0,M=this.advanceWidth||0;s.strokeStyle="blue",yn.line(s,o+m*f,-1e4,o+m*f,1e4),yn.line(s,o+T*f,-1e4,o+T*f,1e4),yn.line(s,-1e4,c+-v*f,1e4,c+-v*f),yn.line(s,-1e4,c+-_*f,1e4,c+-_*f),s.strokeStyle="green",yn.line(s,o+M*f,-1e4,o+M*f,1e4)},Kt.prototype.toPathData=function(s,o){s=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},s);let c=this;o&&o.variation&&(c=o.variation.getTransform(this,s.variation));let d=c.points&&s.pointsTransform?s.pointsTransform(c.points):c.path;return s.pathTransform&&(d=s.pathTransform(d)),d.toPathData(s)},Kt.prototype.fromSVG=function(s,o={}){return this.path.fromSVG(s,o)},Kt.prototype.toSVG=function(s,o){let c=this.toPathData.apply(this,[s,o]);return this.path.toSVG(s,c)},Kt.prototype.toDOMElement=function(s,o){s=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},s);let c=this.path;return o&&o.variation&&(c=o.variation.getTransform(this,s.variation).path),c.toDOMElement(s)};var at=Kt;function nr(s,o,c){Object.defineProperty(s,o,{get:function(){return typeof s[c]>"u"&&s.path,s[c]},set:function(d){s[c]=d},enumerable:!0,configurable:!0})}function Ar(s,o){if(this.font=s,this.glyphs={},Array.isArray(o))for(let c=0;c<o.length;c++){let d=o[c];d.path.unitsPerEm=s.unitsPerEm,this.glyphs[c]=d}this.length=o&&o.length||0}typeof Symbol<"u"&&Symbol.iterator&&(Ar.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)}}),Ar.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],c=this.font._IndexToUnicodeMap[s];if(c)for(let d=0;d<c.unicodes.length;d++)o.addUnicode(c.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]},Ar.prototype.push=function(s,o){this.glyphs[s]=o,this.length++};function er(s,o){return new at({index:o,font:s})}function Gr(s,o,c,d,f,m){return function(){let v=new at({index:o,font:s});return v.path=function(){c(v,d,f);let T=m(s.glyphs,v);return T.unitsPerEm=s.unitsPerEm,T},nr(v,"numberOfContours","_numberOfContours"),nr(v,"xMin","_xMin"),nr(v,"xMax","_xMax"),nr(v,"yMin","_yMin"),nr(v,"yMax","_yMax"),nr(v,"points","_points"),v}}function Mr(s,o,c,d,f){return function(){let m=new at({index:o,font:s});return m.path=function(){let v=c(s,m,d,f);return v.unitsPerEm=s.unitsPerEm,v},m}}var Sr={GlyphSet:Ar,glyphLoader:er,ttfGlyphLoader:Gr,cffGlyphLoader:Mr};function Nn(s,o){if(s===o)return!0;if(Array.isArray(s)&&Array.isArray(o)){if(s.length!==o.length)return!1;for(let c=0;c<s.length;c+=1)if(!Nn(s[c],o[c]))return!1;return!0}else return!1}var F=10;function ae(s){let o;return s.length<1240?o=107:s.length<33900?o=1131:o=32768,o}function le(s,o,c,d){let f=[],m=[],v=d>1?ft.getULong(s,o):ft.getCard16(s,o),T=d>1?4:2,_,M;if(v!==0){let E=ft.getByte(s,o+T);_=o+(v+1)*E+T;let G=o+T+1;for(let H=0;H<v+1;H+=1)f.push(ft.getOffset(s,G,E)),G+=E;M=_+f[v]}else M=o+T;for(let E=0;E<f.length-1;E+=1){let G=ft.getBytes(s,_+f[E],_+f[E+1]);c&&(G=c(G,s,o,d)),m.push(G)}return{objects:m,startOffset:o,endOffset:M}}function Qe(s,o,c){let d=[],f=c>1?ft.getULong(s,o):ft.getCard16(s,o),m=c>1?4:2,v,T;if(f!==0){let _=ft.getByte(s,o+m);v=o+(f+1)*_+m;let M=o+m+1;for(let E=0;E<f+1;E+=1)d.push(ft.getOffset(s,M,_)),M+=_;T=v+d[f]}else T=o+m;return{offsets:d,startOffset:o,endOffset:T}}function Mt(s,o,c,d,f,m){let v=m>1?ft.getULong(c,d):ft.getCard16(c,d),T=m>1?4:2,_=0;if(v!==0){let E=ft.getByte(c,d+T);_=d+(v+1)*E+T}let M=ft.getBytes(c,_+o[s],_+o[s+1]);return f&&(M=f(M)),M}function Ut(s){let o="",c=["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+=c[f],m===15))break;o+=c[m]}return parseFloat(o)}function Xt(s,o){let c,d,f,m;if(o===28)return c=s.parseByte(),d=s.parseByte(),c<<8|d;if(o===29)return c=s.parseByte(),d=s.parseByte(),f=s.parseByte(),m=s.parseByte(),c<<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 c=s.parseByte(),(o-247)*256+c+108;if(o>=251&&o<=254)return c=s.parseByte(),-(o-251)*256-c-108;throw new Error("Invalid b0 "+o)}function pr(s){let o={};for(let c=0;c<s.length;c+=1){let d=s[c][0],f=s[c][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 Dr(s,o,c,d){o=o!==void 0?o:0;let f=new ft.Parser(s,o),m=[],v=[];c=c!==void 0?c:s.byteLength;let T=d<2?22:28;for(;f.relativeOffset<c;){let _=f.parseByte();if(_<T){if(_===12&&(_=1200+f.parseByte()),d>1&&_===23){Is(v);continue}m.push([_,v]),v=[]}else v.push(Xt(f,_,d))}return pr(m)}function fn(s,o){return o<=390?o=ar[o]:s?o=s[o-391]:o=void 0,o}function j(s,o,c){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=fn(c,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=fn(c,f)),d[v.name]=f}return d}function ye(s,o){let c={};if(c.formatMajor=ft.getCard8(s,o),c.formatMinor=ft.getCard8(s,o+1),c.formatMajor>2)throw new Error(`Unsupported CFF table version ${c.formatMajor}.${c.formatMinor}`);return c.size=ft.getCard8(s,o+2),c.formatMajor<2?(c.offsetSize=ft.getCard8(s,o+3),c.startOffset=o,c.endOffset=o+4):(c.topDictLength=ft.getCard16(s,o+3),c.endOffset=o+8),c}var Ne=[{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"}],tt=[{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"}],Lt=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}],Zt=[{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"}],Vt=[{name:"private",op:18,type:["number","offset"],value:[0,0]}];function zt(s,o,c,d){let f=Dr(s,o,s.byteLength,d);return j(f,d>1?tt:Ne,c)}function _r(s,o,c,d,f){let m=Dr(s,o,c,f);return j(m,f>1?Zt:Lt,d)}function bs(s,o,c){let d=Dr(s,o,void 0,c);return j(d,Vt)}function ai(s,o,c){let d=[];for(let f=0;f<c.length;f++){let m=new DataView(new Uint8Array(c[f]).buffer),v=bs(m,0,2),T=v.private[0],_=v.private[1];if(T!==0&&_!==0){let M=_r(s,_+o,T,[],2);if(M.subrs){let E=_+M.subrs,G=le(s,E+o,void 0,2);v._subrs=G.objects,v._subrsBias=ae(v._subrs)}v._privateDict=M}d.push(v)}return d}function Fs(s,o,c,d,f){let m=[];for(let v=0;v<c.length;v+=1){let T=new DataView(new Uint8Array(c[v]).buffer),_=zt(T,0,d,f);_._subrs=[],_._subrsBias=0,_._defaultWidthX=0,_._nominalWidthX=0;let M=f<2?_.private[0]:0,E=f<2?_.private[1]:0;if(M!==0&&E!==0){let G=_r(s,E+o,M,d,f);if(_._defaultWidthX=G.defaultWidthX,_._nominalWidthX=G.nominalWidthX,G.subrs!==0){let H=E+G.subrs,oe=le(s,H+o,void 0,f);_._subrs=oe.objects,_._subrsBias=ae(_._subrs)}_._privateDict=G}m.push(_)}return m}function Fo(s,o,c,d,f){let m,v,T=new ft.Parser(s,o);c-=1;let _=[".notdef"],M=T.parseCard8();if(M===0)for(let E=0;E<c;E+=1)m=T.parseSID(),f?_.push(m):_.push(fn(d,m)||m);else if(M===1)for(;_.length<=c;){m=T.parseSID(),v=T.parseCard8();for(let E=0;E<=v;E+=1)f?_.push("cid"+("00000"+m).slice(-5)):_.push(fn(d,m)||m),m+=1}else if(M===2)for(;_.length<=c;){m=T.parseSID(),v=T.parseCard16();for(let E=0;E<=v;E+=1)f?_.push("cid"+("00000"+m).slice(-5)):_.push(fn(d,m)||m),m+=1}else throw new Error("Unknown charset format "+M);return _}function ks(s,o){let c,d={},f=new ft.Parser(s,o),m=f.parseCard8();if(m===0){let v=f.parseCard8();for(let T=0;T<v;T+=1)c=f.parseCard8(),d[c]=T}else if(m===1){let v=f.parseCard8();c=1;for(let T=0;T<v;T+=1){let _=f.parseCard8(),M=f.parseCard8();for(let E=_;E<=_+M;E+=1)d[E]=c,c+=1}}else throw new Error("Unknown encoding format "+m);return d}function Is(s){let o=s.pop();for(;s.length>o;)s.pop()}function zn(s,o){let c=s.tables.cff&&s.tables.cff.topDict&&s.tables.cff.topDict.paintType||0;return c===2&&(o.fill=null,o.stroke="black",o.strokeWidth=s.tables.cff.topDict.strokeWidth||0),c}function $i(s,o,c,d,f){let m,v,T,_,M=new Oe,E=[],G=0,H=!1,oe=!1,J=0,fe=0,Xe,gr,or,Ir,Kr=0,Dn=[],qn,Yn=0,Qs=s.tables.cff2||s.tables.cff;if(or=Qs.topDict._defaultWidthX,Ir=Qs.topDict._nominalWidthX,f=f||s.variation&&s.variation.get(),o.getBlendPath||(o.getBlendPath=function(tr){return $i(s,o,c,d,tr)}),s.isCIDFont||d>1){let tr=Qs.topDict._fdSelect?Qs.topDict._fdSelect[o.index]:0,sr=Qs.topDict._fdArray[tr];Xe=sr._subrs,gr=sr._subrsBias,d>1?(Dn=Qs.topDict._vstore.itemVariationStore,Kr=sr._privateDict.vsindex):(or=sr._defaultWidthX,Ir=sr._nominalWidthX)}else Xe=Qs.topDict._subrs,gr=Qs.topDict._subrsBias;let io=zn(s,M),Xr=or;function pa(tr,sr){oe&&io!==2&&M.closePath(),M.moveTo(tr,sr),oe=!0}function Ni(){let tr;tr=(E.length&1)!==0,tr&&!H&&(Xr=E.shift()+Ir),G+=E.length>>1,E.length=0,H=!0}function xr(tr){let sr,Si,Al,qu,Ul,ao,Mi,Na,_i,ma,Di,Bi,Ns=0;for(;Ns<tr.length;){let Da=tr[Ns];switch(Ns+=1,Da){case 1:Ni();break;case 3:Ni();break;case 4:E.length>1&&!H&&(Xr=E.shift()+Ir,H=!0),fe+=E.pop(),pa(J,fe);break;case 5:for(;E.length>0;)J+=E.shift(),fe+=E.shift(),M.lineTo(J,fe);break;case 6:for(;E.length>0&&(J+=E.shift(),M.lineTo(J,fe),E.length!==0);)fe+=E.shift(),M.lineTo(J,fe);break;case 7:for(;E.length>0&&(fe+=E.shift(),M.lineTo(J,fe),E.length!==0);)J+=E.shift(),M.lineTo(J,fe);break;case 8:for(;E.length>0;)m=J+E.shift(),v=fe+E.shift(),T=m+E.shift(),_=v+E.shift(),J=T+E.shift(),fe=_+E.shift(),M.curveTo(m,v,T,_,J,fe);break;case 10:if(Ul=E.pop()+gr,ao=Xe[Ul],ao){if(Yn>=F){console.warn("CFF charstring subroutine call depth exceeded, skipping callsubr");break}Yn++,xr(ao),Yn--}break;case 11:if(d>1){console.error("CFF CharString operator return (11) is not supported in CFF2");break}return;case 12:switch(Da=tr[Ns],Ns+=1,Da){case 35:m=J+E.shift(),v=fe+E.shift(),T=m+E.shift(),_=v+E.shift(),Mi=T+E.shift(),Na=_+E.shift(),_i=Mi+E.shift(),ma=Na+E.shift(),Di=_i+E.shift(),Bi=ma+E.shift(),J=Di+E.shift(),fe=Bi+E.shift(),E.shift(),M.curveTo(m,v,T,_,Mi,Na),M.curveTo(_i,ma,Di,Bi,J,fe);break;case 34:m=J+E.shift(),v=fe,T=m+E.shift(),_=v+E.shift(),Mi=T+E.shift(),Na=_,_i=Mi+E.shift(),ma=_,Di=_i+E.shift(),Bi=fe,J=Di+E.shift(),M.curveTo(m,v,T,_,Mi,Na),M.curveTo(_i,ma,Di,Bi,J,fe);break;case 36:m=J+E.shift(),v=fe+E.shift(),T=m+E.shift(),_=v+E.shift(),Mi=T+E.shift(),Na=_,_i=Mi+E.shift(),ma=_,Di=_i+E.shift(),Bi=ma+E.shift(),J=Di+E.shift(),M.curveTo(m,v,T,_,Mi,Na),M.curveTo(_i,ma,Di,Bi,J,fe);break;case 37:m=J+E.shift(),v=fe+E.shift(),T=m+E.shift(),_=v+E.shift(),Mi=T+E.shift(),Na=_+E.shift(),_i=Mi+E.shift(),ma=Na+E.shift(),Di=_i+E.shift(),Bi=ma+E.shift(),Math.abs(Di-J)>Math.abs(Bi-fe)?J=Di+E.shift():fe=Bi+E.shift(),M.curveTo(m,v,T,_,Mi,Na),M.curveTo(_i,ma,Di,Bi,J,fe);break;default:console.log("Glyph "+o.index+": unknown operator 1200"+Da),E.length=0}break;case 14:if(d>1){console.error("CFF CharString operator endchar (14) is not supported in CFF2");break}if(E.length>=4){let $l=Cr[E.pop()],_c=Cr[E.pop()],Yu=E.pop(),Zu=E.pop();if($l&&_c){o.isComposite=!0,o.components=[];let bm=s.cffEncoding.charset.indexOf($l),ym=s.cffEncoding.charset.indexOf(_c);o.components.push({glyphIndex:ym,dx:0,dy:0}),o.components.push({glyphIndex:bm,dx:Zu,dy:Yu}),M.extend(s.glyphs.get(ym).path);let Yv=s.glyphs.get(bm),Zh=JSON.parse(JSON.stringify(Yv.path.commands));for(let Kh=0;Kh<Zh.length;Kh+=1){let To=Zh[Kh];To.type!=="Z"&&(To.x+=Zu,To.y+=Yu),(To.type==="Q"||To.type==="C")&&(To.x1+=Zu,To.y1+=Yu),To.type==="C"&&(To.x2+=Zu,To.y2+=Yu)}M.extend(Zh)}}else E.length>0&&!H&&(Xr=E.shift()+Ir,H=!0);oe&&io!==2&&(M.closePath(),oe=!1);break;case 15:if(d<2){console.error("CFF2 CharString operator vsindex (15) is not supported in CFF");break}Kr=E.pop();break;case 16:if(d<2){console.error("CFF2 CharString operator blend (16) is not supported in CFF");break}qn||(qn=s.variation&&f&&s.variation.process.getBlendVector(Dn,Kr,f));var Kn=E.pop(),Zi=qn?qn.length:Dn.itemVariationSubtables[Kr].regionIndexes.length,Ma=Kn*Zi,oo=E.length-Ma,Ko=oo-Kn;if(qn)for(let $l=0;$l<Kn;$l++){var xm=E[Ko+$l];for(let _c=0;_c<Zi;_c++)xm+=qn[_c]*E[oo++];E[Ko+$l]=xm}for(;Ma--;)E.pop();break;case 18:Ni();break;case 19:case 20:Ni(),Ns+=G+7>>3;break;case 21:E.length>2&&!H&&(Xr=E.shift()+Ir,H=!0),fe+=E.pop(),J+=E.pop(),pa(J,fe);break;case 22:E.length>1&&!H&&(Xr=E.shift()+Ir,H=!0),J+=E.pop(),pa(J,fe);break;case 23:Ni();break;case 24:for(;E.length>2;)m=J+E.shift(),v=fe+E.shift(),T=m+E.shift(),_=v+E.shift(),J=T+E.shift(),fe=_+E.shift(),M.curveTo(m,v,T,_,J,fe);J+=E.shift(),fe+=E.shift(),M.lineTo(J,fe);break;case 25:for(;E.length>6;)J+=E.shift(),fe+=E.shift(),M.lineTo(J,fe);m=J+E.shift(),v=fe+E.shift(),T=m+E.shift(),_=v+E.shift(),J=T+E.shift(),fe=_+E.shift(),M.curveTo(m,v,T,_,J,fe);break;case 26:for(E.length&1&&(J+=E.shift());E.length>0;)m=J,v=fe+E.shift(),T=m+E.shift(),_=v+E.shift(),J=T,fe=_+E.shift(),M.curveTo(m,v,T,_,J,fe);break;case 27:for(E.length&1&&(fe+=E.shift());E.length>0;)m=J+E.shift(),v=fe,T=m+E.shift(),_=v+E.shift(),J=T+E.shift(),fe=_,M.curveTo(m,v,T,_,J,fe);break;case 28:sr=tr[Ns],Si=tr[Ns+1],E.push((sr<<24|Si<<16)>>16),Ns+=2;break;case 29:if(Ul=E.pop()+s.gsubrsBias,ao=s.gsubrs[Ul],ao){if(Yn>=F){console.warn("CFF charstring subroutine call depth exceeded, skipping callgsubr");break}Yn++,xr(ao),Yn--}break;case 30:for(;E.length>0&&(m=J,v=fe+E.shift(),T=m+E.shift(),_=v+E.shift(),J=T+E.shift(),fe=_+(E.length===1?E.shift():0),M.curveTo(m,v,T,_,J,fe),E.length!==0);)m=J+E.shift(),v=fe,T=m+E.shift(),_=v+E.shift(),fe=_+E.shift(),J=T+(E.length===1?E.shift():0),M.curveTo(m,v,T,_,J,fe);break;case 31:for(;E.length>0&&(m=J+E.shift(),v=fe,T=m+E.shift(),_=v+E.shift(),fe=_+E.shift(),J=T+(E.length===1?E.shift():0),M.curveTo(m,v,T,_,J,fe),E.length!==0);)m=J,v=fe+E.shift(),T=m+E.shift(),_=v+E.shift(),J=T+E.shift(),fe=_+(E.length===1?E.shift():0),M.curveTo(m,v,T,_,J,fe);break;default:Da<32?console.log("Glyph "+o.index+": unknown operator "+Da):Da<247?E.push(Da-139):Da<251?(sr=tr[Ns],Ns+=1,E.push((Da-247)*256+sr+108)):Da<255?(sr=tr[Ns],Ns+=1,E.push(-(Da-251)*256-sr-108)):(sr=tr[Ns],Si=tr[Ns+1],Al=tr[Ns+2],qu=tr[Ns+3],Ns+=4,E.push((sr<<24|Si<<16|Al<<8|qu)/65536))}}}return xr(c),s.variation&&f&&(M.commands=M.commands.map(tr=>{let sr=Object.keys(tr);for(let Si=0;Si<sr.length;Si++){let Al=sr[Si];Al!=="type"&&(tr[Al]=Math.round(tr[Al]))}return tr})),H&&(o.advanceWidth=Xr),M}function Zr(s,o,c,d,f){let m=[],v,T=new ft.Parser(s,o),_=T.parseCard8();if(_===0)for(let M=0;M<c;M++){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 M=_===4?T.parseULong():T.parseCard16(),E=_===4?T.parseULong():T.parseCard16();if(E!==0)throw new Error(`CFF Table CID Font FDSelect format ${_} range has bad initial GID ${E}`);let G;for(let H=0;H<M;H++){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>c)throw new Error(`CFF Table CID Font FDSelect format ${f} range has bad GID ${G}`);for(;E<G;E++)m.push(v);E=G}if(G!==c)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 Hn(s,o,c,d){let f,m=ye(s,o);m.formatMajor===2?f=c.tables.cff2={}:f=c.tables.cff={};let v=m.formatMajor>1?null:le(s,m.endOffset,ft.bytesToString),T=m.formatMajor>1?null:le(s,v.endOffset),_=m.formatMajor>1?null:le(s,T.endOffset,ft.bytesToString),M=le(s,m.formatMajor>1?o+m.size+m.topDictLength:_.endOffset,void 0,m.formatMajor);c.gsubrs=M.objects,c.gsubrsBias=ae(c.gsubrs);let E;if(m.formatMajor>1){let H=o+m.size,oe=ft.getBytes(s,H,H+m.topDictLength);E=Fs(s,0,[oe],void 0,m.formatMajor)[0]}else{let H=Fs(s,o,T.objects,_.objects,m.formatMajor);if(H.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+H.length);E=H[0]}if(f.topDict=E,E._privateDict&&(c.defaultWidthX=E._privateDict.defaultWidthX,c.nominalWidthX=E._privateDict.nominalWidthX),m.formatMajor<2&&E.ros[0]!==void 0&&E.ros[1]!==void 0&&(c.isCIDFont=!0),m.formatMajor>1){let H=E.fdArray,oe=E.fdSelect;if(!H)throw new Error("This is a CFF2 font, but FDArray information is missing");let J=le(s,o+H,null,m.formatMajor),fe=ai(s,o,J.objects);E._fdArray=fe,oe&&(E._fdSelect=Zr(s,o+oe,c.numGlyphs,fe.length,m.formatMajor))}else if(c.isCIDFont){let H=E.fdArray,oe=E.fdSelect;if(H===0||oe===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");H+=o;let J=le(s,H),fe=Fs(s,o,J.objects,_.objects,m.formatMajor);E._fdArray=fe,oe+=o,E._fdSelect=Zr(s,oe,c.numGlyphs,fe.length,m.formatMajor)}if(m.formatMajor<2){let H=o+E.private[1],oe=_r(s,H,E.private[0],_.objects,m.formatMajor);if(c.defaultWidthX=oe.defaultWidthX,c.nominalWidthX=oe.nominalWidthX,oe.subrs!==0){let J=H+oe.subrs,fe=le(s,J);c.subrs=fe.objects,c.subrsBias=ae(c.subrs)}else c.subrs=[],c.subrsBias=0}let G;if(d.lowMemory?(G=Qe(s,o+E.charStrings,m.formatMajor),c.nGlyphs=G.offsets.length-(m.formatMajor>1?1:0)):(G=le(s,o+E.charStrings,null,m.formatMajor),c.nGlyphs=G.objects.length),m.formatMajor>1&&c.tables.maxp&&c.nGlyphs!==c.tables.maxp.numGlyphs&&console.error(`Glyph count in the CFF2 table (${c.nGlyphs}) must correspond to the glyph count in the maxp table (${c.tables.maxp.numGlyphs})`),m.formatMajor<2){let H=[],oe=[];E.charset===0?H=us:E.charset===1?H=yr:E.charset===2?H=Qr:H=Fo(s,o+E.charset,c.nGlyphs,_.objects,c.isCIDFont),E.encoding===0?oe=Cr:E.encoding===1?oe=ds:oe=ks(s,o+E.encoding),c.cffEncoding=new Jn(oe,H),c.encoding=c.encoding||c.cffEncoding}if(c.glyphs=new Sr.GlyphSet(c),d.lowMemory)c._push=function(H){let oe=Mt(H,G.offsets,s,o+E.charStrings,void 0,m.formatMajor);c.glyphs.push(H,Sr.cffGlyphLoader(c,H,$i,oe,m.formatMajor))};else for(let H=0;H<c.nGlyphs;H+=1){let oe=G.objects[H];c.glyphs.push(H,Sr.cffGlyphLoader(c,H,$i,oe,m.formatMajor))}if(E.vstore){let H=new ft.Parser(s,o+E.vstore);E._vstore=H.parseVariationStore()}}function hs(s,o){let c,d=ar.indexOf(s);return d>=0&&(c=d),d=o.indexOf(s),d>=0?c=d+ar.length:(c=ar.length+o.length,o.push(s)),c}function Aa(){return new Se.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 wi(s){let o=new Se.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);o.names=[];for(let c=0;c<s.length;c+=1)o.names.push({name:"name_"+c,type:"NAME",value:s[c]});return o}function Uo(s,o,c){let d={};for(let f=0;f<s.length;f+=1){let m=s[f],v=o[m.name];v!==void 0&&!Nn(v,m.value)&&(m.type==="SID"&&(v=hs(v,c)),d[m.op]={name:m.name,type:m.type,value:v})}return d}function qa(s,o,c){let d=new Se.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=Uo(c>1?tt:Ne,s,o),d}function ts(s){let o=new Se.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return o.topDicts=[{name:"topDict_0",type:"TABLE",value:s}],o}function Ta(s){let o=new Se.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);o.strings=[];for(let c=0;c<s.length;c+=1)o.strings.push({name:"string_"+c,type:"STRING",value:s[c]});return o}function Ca(){return new Se.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function ul(s,o){let c=new Se.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let d=0;d<s.length;d+=1){let f=s[d],m=hs(f,o);c.fields.push({name:"glyph_"+d,type:"SID",value:m})}return c}function sa(s,o){let c=[],d=s.path;o<2&&c.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,_,M=d.commands[v];if(M.type==="Q"){let E=.3333333333333333,G=2/3;M={type:"C",x:M.x,y:M.y,x1:Math.round(E*f+G*M.x1),y1:Math.round(E*m+G*M.y1),x2:Math.round(E*M.x+G*M.x1),y2:Math.round(E*M.y+G*M.y1)}}if(M.type==="M")T=Math.round(M.x-f),_=Math.round(M.y-m),c.push({name:"dx",type:"NUMBER",value:T}),c.push({name:"dy",type:"NUMBER",value:_}),c.push({name:"rmoveto",type:"OP",value:21}),f=Math.round(M.x),m=Math.round(M.y);else if(M.type==="L")T=Math.round(M.x-f),_=Math.round(M.y-m),c.push({name:"dx",type:"NUMBER",value:T}),c.push({name:"dy",type:"NUMBER",value:_}),c.push({name:"rlineto",type:"OP",value:5}),f=Math.round(M.x),m=Math.round(M.y);else if(M.type==="C"){let E=Math.round(M.x1-f),G=Math.round(M.y1-m),H=Math.round(M.x2-M.x1),oe=Math.round(M.y2-M.y1);T=Math.round(M.x-M.x2),_=Math.round(M.y-M.y2),c.push({name:"dx1",type:"NUMBER",value:E}),c.push({name:"dy1",type:"NUMBER",value:G}),c.push({name:"dx2",type:"NUMBER",value:H}),c.push({name:"dy2",type:"NUMBER",value:oe}),c.push({name:"dx",type:"NUMBER",value:T}),c.push({name:"dy",type:"NUMBER",value:_}),c.push({name:"rrcurveto",type:"OP",value:8}),f=Math.round(M.x),m=Math.round(M.y)}}return o<2&&c.push({name:"endchar",type:"OP",value:14}),c}function go(s,o){let c=new Se.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let d=0;d<s.length;d+=1){let f=s.get(d),m=sa(f,o);c.charStrings.push({name:f.name,type:"CHARSTRING",value:m})}return c}function Ii(s,o,c){let d=new Se.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=Uo(c>1?Zt:Lt,s,o),d}function Ya(s,o){let c=new Se.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 H=1;H<s.length;H+=1)_=s.get(H),T.push(_.name);let M=[];c.header=Aa(),c.nameIndex=wi([o.postScriptName]);let E=qa(f,M);c.topDictIndex=ts(E),c.globalSubrIndex=Ca(),c.charsets=ul(T,M),c.charStringsIndex=go(s,1),c.privateDict=Ii(v,M),c.stringIndex=Ta(M);let G=c.header.sizeOf()+c.nameIndex.sizeOf()+c.topDictIndex.sizeOf()+c.stringIndex.sizeOf()+c.globalSubrIndex.sizeOf();return f.charset=G,f.encoding=0,f.charStrings=f.charset+c.charsets.sizeOf(),f.private[1]=f.charStrings+c.charStringsIndex.sizeOf(),E=qa(f,M),c.topDictIndex=ts(E),c}var Za={parse:Hn,make:Ya};function Ka(s,o){let c={},d=new ft.Parser(s,o);return c.version=d.parseVersion(),c.fontRevision=Math.round(d.parseFixed()*1e3)/1e3,c.checkSumAdjustment=d.parseULong(),c.magicNumber=d.parseULong(),X.argument(c.magicNumber===1594834165,"Font header has wrong magic number."),c.flags=d.parseUShort(),c.unitsPerEm=d.parseUShort(),c.created=d.parseLongDateTime(),c.modified=d.parseLongDateTime(),c.xMin=d.parseShort(),c.yMin=d.parseShort(),c.xMax=d.parseShort(),c.yMax=d.parseShort(),c.macStyle=d.parseUShort(),c.lowestRecPPEM=d.parseUShort(),c.fontDirectionHint=d.parseShort(),c.indexToLocFormat=d.parseShort(),c.glyphDataFormat=d.parseShort(),c}function Ai(s){let o=Math.round(new Date().getTime()/1e3)+2082844800,c=o,d=s.macStyle||0;return s.createdTimestamp&&(c=s.createdTimestamp+2082844800),new Se.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:c},{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 Es={parse:Ka,make:Ai};function Vs(s,o){let c={},d=new ft.Parser(s,o);return c.version=d.parseVersion(),c.ascender=d.parseShort(),c.descender=d.parseShort(),c.lineGap=d.parseShort(),c.advanceWidthMax=d.parseUShort(),c.minLeftSideBearing=d.parseShort(),c.minRightSideBearing=d.parseShort(),c.xMaxExtent=d.parseShort(),c.caretSlopeRise=d.parseShort(),c.caretSlopeRun=d.parseShort(),c.caretOffset=d.parseShort(),d.relativeOffset+=8,c.metricDataFormat=d.parseShort(),c.numberOfHMetrics=d.parseUShort(),c}function zi(s){return new Se.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 qs={parse:Vs,make:zi};function ia(s,o,c,d,f){let m,v,T=new ft.Parser(s,o);for(let _=0;_<d;_+=1){_<c&&(m=T.parseUShort(),v=T.parseShort());let M=f.get(_);M.advanceWidth=m,M.leftSideBearing=v}}function xo(s,o,c,d,f){s._hmtxTableData={};let m,v,T=new ft.Parser(o,c);for(let _=0;_<f;_+=1)_<d&&(m=T.parseUShort(),v=T.parseShort()),s._hmtxTableData[_]={advanceWidth:m,leftSideBearing:v}}function Hi(s,o,c,d,f,m,v){v.lowMemory?xo(s,o,c,d,f):ia(o,c,d,f,m)}function Sa(s){let o=new Se.Table("hmtx",[]);for(let c=0;c<s.length;c+=1){let d=s.get(c),f=d.advanceWidth||0,m=d.leftSideBearing||0;o.fields.push({name:"advanceWidth_"+c,type:"USHORT",value:f}),o.fields.push({name:"leftSideBearing_"+c,type:"SHORT",value:m})}return o}var _a={parse:Hi,make:Sa};function dl(s){let o=new Se.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:s.length}]),c="",d=12+s.length*4;for(let f=0;f<s.length;++f){let m=c.indexOf(s[f]);m<0&&(m=c.length,c+=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:c}),o}function La(s,o){let c=new ft.Parser(s,o),d=c.parseULong();X.argument(d===1,"Unsupported ltag table version."),c.skip("uLong",1);let f=c.parseULong(),m=[];for(let v=0;v<f;v++){let T="",_=o+c.parseUShort(),M=c.parseUShort();for(let E=_;E<_+M;++E)T+=String.fromCharCode(s.getInt8(E));m.push(T)}return m}var bo={make:dl,parse:La};function Ti(s,o){let c={},d=new ft.Parser(s,o);return c.version=d.parseVersion(),c.numGlyphs=d.parseUShort(),c.version===1&&(c.maxPoints=d.parseUShort(),c.maxContours=d.parseUShort(),c.maxCompositePoints=d.parseUShort(),c.maxCompositeContours=d.parseUShort(),c.maxZones=d.parseUShort(),c.maxTwilightPoints=d.parseUShort(),c.maxStorage=d.parseUShort(),c.maxFunctionDefs=d.parseUShort(),c.maxInstructionDefs=d.parseUShort(),c.maxStackElements=d.parseUShort(),c.maxSizeOfInstructions=d.parseUShort(),c.maxComponentElements=d.parseUShort(),c.maxComponentDepth=d.parseUShort()),c}function oi(s){return new Se.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:s}])}var ka={parse:Ti,make:oi},aa=[{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 oa(s){for(let o=0;o<aa.length;o+=1){let c=aa[o];if(s>=c.begin&&s<c.end)return o}return-1}function $o(s,o){let c={},d=new ft.Parser(s,o);c.version=d.parseUShort(),c.xAvgCharWidth=d.parseShort(),c.usWeightClass=d.parseUShort(),c.usWidthClass=d.parseUShort(),c.fsType=d.parseUShort(),c.ySubscriptXSize=d.parseShort(),c.ySubscriptYSize=d.parseShort(),c.ySubscriptXOffset=d.parseShort(),c.ySubscriptYOffset=d.parseShort(),c.ySuperscriptXSize=d.parseShort(),c.ySuperscriptYSize=d.parseShort(),c.ySuperscriptXOffset=d.parseShort(),c.ySuperscriptYOffset=d.parseShort(),c.yStrikeoutSize=d.parseShort(),c.yStrikeoutPosition=d.parseShort(),c.sFamilyClass=d.parseShort(),c.panose=[];for(let f=0;f<10;f++)c.panose[f]=d.parseByte();return c.ulUnicodeRange1=d.parseULong(),c.ulUnicodeRange2=d.parseULong(),c.ulUnicodeRange3=d.parseULong(),c.ulUnicodeRange4=d.parseULong(),c.achVendID=String.fromCharCode(d.parseByte(),d.parseByte(),d.parseByte(),d.parseByte()),c.fsSelection=d.parseUShort(),c.usFirstCharIndex=d.parseUShort(),c.usLastCharIndex=d.parseUShort(),c.sTypoAscender=d.parseShort(),c.sTypoDescender=d.parseShort(),c.sTypoLineGap=d.parseShort(),c.usWinAscent=d.parseUShort(),c.usWinDescent=d.parseUShort(),c.version>=1&&(c.ulCodePageRange1=d.parseULong(),c.ulCodePageRange2=d.parseULong()),c.version>=2&&(c.sxHeight=d.parseShort(),c.sCapHeight=d.parseShort(),c.usDefaultChar=d.parseUShort(),c.usBreakChar=d.parseUShort(),c.usMaxContent=d.parseUShort()),c}function vs(s){return new Se.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:$o,make:vs,unicodeRanges:aa,getUnicodeRange:oa};function Xa(s,o){let c={},d=new ft.Parser(s,o);switch(c.version=d.parseVersion(),c.italicAngle=d.parseFixed(),c.underlinePosition=d.parseShort(),c.underlineThickness=d.parseShort(),c.isFixedPitch=d.parseULong(),c.minMemType42=d.parseULong(),c.maxMemType42=d.parseULong(),c.minMemType1=d.parseULong(),c.maxMemType1=d.parseULong(),c.version){case 1:c.names=Ln.slice();break;case 2:c.numberOfGlyphs=d.parseUShort(),c.glyphNameIndex=new Array(c.numberOfGlyphs);for(let f=0;f<c.numberOfGlyphs;f++)c.glyphNameIndex[f]=d.parseUShort();c.names=[];for(let f=0;f<c.numberOfGlyphs;f++)if(c.glyphNameIndex[f]>=Ln.length){let m=d.parseChar();c.names.push(d.parseString(m))}break;case 2.5:c.numberOfGlyphs=d.parseUShort(),c.offset=new Array(c.numberOfGlyphs);for(let f=0;f<c.numberOfGlyphs;f++)c.offset[f]=d.parseChar();break}return c}function Ja(s){let{italicAngle:o=Math.round((s.italicAngle||0)*65536),underlinePosition:c=0,underlineThickness:d=0,isFixedPitch:f=0,minMemType42:m=0,maxMemType42:v=0,minMemType1:T=0,maxMemType1:_=0}=s.tables.post||{};return new Se.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:o},{name:"underlinePosition",type:"FWORD",value:c},{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 eo={parse:Xa,make:Ja},Us=new Array(9);Us[1]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(ie.coverage),deltaGlyphId:this.parseShort()};if(o===2)return{substFormat:2,coverage:this.parsePointer(ie.coverage),substitute:this.parseOffset16List()};X.assert(!1,"0x"+s.toString(16)+": lookup type 1 format must be 1 or 2.")},Us[2]=function(){let s=this.parseUShort();return X.argument(s===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:s,coverage:this.parsePointer(ie.coverage),sequences:this.parseListOfLists()}},Us[3]=function(){let s=this.parseUShort();return X.argument(s===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:s,coverage:this.parsePointer(ie.coverage),alternateSets:this.parseListOfLists()}},Us[4]=function(){let s=this.parseUShort();return X.argument(s===1,"GSUB ligature table identifier-format must be 1"),{substFormat:s,coverage:this.parsePointer(ie.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var Wi={sequenceIndex:ie.uShort,lookupListIndex:ie.uShort};Us[5]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:o,coverage:this.parsePointer(ie.coverage),ruleSets:this.parseListOfLists(function(){let c=this.parseUShort(),d=this.parseUShort();return{input:this.parseUShortList(c-1),lookupRecords:this.parseRecordList(d,Wi)}})};if(o===2)return{substFormat:o,coverage:this.parsePointer(ie.coverage),classDef:this.parsePointer(ie.classDef),classSets:this.parseListOfLists(function(){let c=this.parseUShort(),d=this.parseUShort();return{classes:this.parseUShortList(c-1),lookupRecords:this.parseRecordList(d,Wi)}})};if(o===3){let c=this.parseUShort(),d=this.parseUShort();return{substFormat:o,coverages:this.parseList(c,ie.pointer(ie.coverage)),lookupRecords:this.parseRecordList(d,Wi)}}X.assert(!1,"0x"+s.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},Us[6]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(ie.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Wi)}})};if(o===2)return{substFormat:2,coverage:this.parsePointer(ie.coverage),backtrackClassDef:this.parsePointer(ie.classDef),inputClassDef:this.parsePointer(ie.classDef),lookaheadClassDef:this.parsePointer(ie.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Wi)}})};if(o===3)return{substFormat:3,backtrackCoverage:this.parseList(ie.pointer(ie.coverage)),inputCoverage:this.parseList(ie.pointer(ie.coverage)),lookaheadCoverage:this.parseList(ie.pointer(ie.coverage)),lookupRecords:this.parseRecordList(Wi)};X.assert(!1,"0x"+s.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},Us[7]=function(){let s=this.parseUShort();X.argument(s===1,"GSUB Extension Substitution subtable identifier-format must be 1");let o=this.parseUShort(),c=new ie(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:o,extension:Us[o].call(c)}},Us[8]=function(){let s=this.parseUShort();return X.argument(s===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:s,coverage:this.parsePointer(ie.coverage),backtrackCoverage:this.parseList(ie.pointer(ie.coverage)),lookaheadCoverage:this.parseList(ie.pointer(ie.coverage)),substitutes:this.parseUShortList()}};function Ia(s,o){o=o||0;let c=new ie(s,o),d=c.parseVersion(1);return X.argument(d===1||d===1.1,"Unsupported GSUB table version."),d===1?{version:d,scripts:c.parseScriptList(),features:c.parseFeatureList(),lookups:c.parseLookupList(Us)}:{version:d,scripts:c.parseScriptList(),features:c.parseFeatureList(),lookups:c.parseLookupList(Us),variations:c.parseFeatureVariationsList()}}var Zn=new Array(9);Zn[1]=function(s){if(s.substFormat===1)return new Se.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Se.Coverage(s.coverage)},{name:"deltaGlyphID",type:"SHORT",value:s.deltaGlyphId}]);if(s.substFormat===2)return new Se.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new Se.Coverage(s.coverage)}].concat(Se.ushortList("substitute",s.substitute)));X.fail("Lookup type 1 substFormat must be 1 or 2.")},Zn[2]=function(s){return X.assert(s.substFormat===1,"Lookup type 2 substFormat must be 1."),new Se.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Se.Coverage(s.coverage)}].concat(Se.tableList("seqSet",s.sequences,function(o){return new Se.Table("sequenceSetTable",Se.ushortList("sequence",o))})))},Zn[3]=function(s){return X.assert(s.substFormat===1,"Lookup type 3 substFormat must be 1."),new Se.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Se.Coverage(s.coverage)}].concat(Se.tableList("altSet",s.alternateSets,function(o){return new Se.Table("alternateSetTable",Se.ushortList("alternate",o))})))},Zn[4]=function(s){return X.assert(s.substFormat===1,"Lookup type 4 substFormat must be 1."),new Se.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Se.Coverage(s.coverage)}].concat(Se.tableList("ligSet",s.ligatureSets,function(o){return new Se.Table("ligatureSetTable",Se.tableList("ligature",o,function(c){return new Se.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:c.ligGlyph}].concat(Se.ushortList("component",c.components,c.components.length+1)))}))})))},Zn[5]=function(s){if(s.substFormat===1)return new Se.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:s.substFormat},{name:"coverage",type:"TABLE",value:new Se.Coverage(s.coverage)}].concat(Se.tableList("sequenceRuleSet",s.ruleSets,function(o){return o?new Se.Table("sequenceRuleSetTable",Se.tableList("sequenceRule",o,function(c){let d=Se.ushortList("seqLookup",[],c.lookupRecords.length).concat(Se.ushortList("inputSequence",c.input,c.input.length+1));[d[0],d[1]]=[d[1],d[0]];for(let f=0;f<c.lookupRecords.length;f++){let m=c.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new Se.Table("sequenceRuleTable",d)})):new Se.Table("NULL",null)})));if(s.substFormat===2)return new Se.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:s.substFormat},{name:"coverage",type:"TABLE",value:new Se.Coverage(s.coverage)},{name:"classDef",type:"TABLE",value:new Se.ClassDef(s.classDef)}].concat(Se.tableList("classSeqRuleSet",s.classSets,function(o){return o?new Se.Table("classSeqRuleSetTable",Se.tableList("classSeqRule",o,function(c){let d=Se.ushortList("classes",c.classes,c.classes.length+1).concat(Se.ushortList("seqLookupCount",[],c.lookupRecords.length));for(let f=0;f<c.lookupRecords.length;f++){let m=c.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new Se.Table("classSeqRuleTable",d)})):new Se.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 c=0;c<s.coverages.length;c++){let d=s.coverages[c];o.push({name:"inputCoverage"+c,type:"TABLE",value:new Se.Coverage(d)})}for(let c=0;c<s.lookupRecords.length;c++){let d=s.lookupRecords[c];o=o.concat({name:"sequenceIndex"+c,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+c,type:"USHORT",value:d.lookupListIndex})}return new Se.Table("contextualSubstitutionTable",o)}X.assert(!1,"lookup type 5 format must be 1, 2 or 3.")},Zn[6]=function(s){if(s.substFormat===1)return new Se.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:s.substFormat},{name:"coverage",type:"TABLE",value:new Se.Coverage(s.coverage)}].concat(Se.tableList("chainRuleSet",s.chainRuleSets,function(o){return new Se.Table("chainRuleSetTable",Se.tableList("chainRule",o,function(c){let d=Se.ushortList("backtrackGlyph",c.backtrack,c.backtrack.length).concat(Se.ushortList("inputGlyph",c.input,c.input.length+1)).concat(Se.ushortList("lookaheadGlyph",c.lookahead,c.lookahead.length)).concat(Se.ushortList("substitution",[],c.lookupRecords.length));for(let f=0;f<c.lookupRecords.length;f++){let m=c.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new Se.Table("chainRuleTable",d)}))})));if(s.substFormat===2)X.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 c=0;c<s.backtrackCoverage.length;c++){let d=s.backtrackCoverage[c];o.push({name:"backtrackCoverage"+c,type:"TABLE",value:new Se.Coverage(d)})}o.push({name:"inputGlyphCount",type:"USHORT",value:s.inputCoverage.length});for(let c=0;c<s.inputCoverage.length;c++){let d=s.inputCoverage[c];o.push({name:"inputCoverage"+c,type:"TABLE",value:new Se.Coverage(d)})}o.push({name:"lookaheadGlyphCount",type:"USHORT",value:s.lookaheadCoverage.length});for(let c=0;c<s.lookaheadCoverage.length;c++){let d=s.lookaheadCoverage[c];o.push({name:"lookaheadCoverage"+c,type:"TABLE",value:new Se.Coverage(d)})}o.push({name:"substitutionCount",type:"USHORT",value:s.lookupRecords.length});for(let c=0;c<s.lookupRecords.length;c++){let d=s.lookupRecords[c];o=o.concat({name:"sequenceIndex"+c,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+c,type:"USHORT",value:d.lookupListIndex})}return new Se.Table("chainContextTable",o)}X.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function os(s){return new Se.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Se.ScriptList(s.scripts)},{name:"features",type:"TABLE",value:new Se.FeatureList(s.features)},{name:"lookups",type:"TABLE",value:new Se.LookupList(s.lookups,Zn)}])}var Ei={parse:Ia,make:os};function Gi(s,o){let c=new ft.Parser(s,o),d=c.parseULong();X.argument(d===1,"Unsupported META table version."),c.parseULong(),c.parseULong();let f=c.parseULong(),m={};for(let v=0;v<f;v++){let T=c.parseTag(),_=c.parseULong(),M=c.parseULong();if(T==="appl"||T==="bild")continue;let E=wt.UTF8(s,o+_,M);m[T]=E}return m}function Vi(s){let o=Object.keys(s).length,c="",d=16+o*12,f=new Se.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=c.length;c+=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:c}),f}var $s={parse:Gi,make:Vi};function yo(s,o){let c=new ie(s,o),d=c.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=c.parseUShort(),m=c.parseOffset32(),v=c.parseOffset32(),T=c.parseUShort();c.relativeOffset=m;let _=c.parseRecordList(f,{glyphID:ie.uShort,firstLayerIndex:ie.uShort,numLayers:ie.uShort});c.relativeOffset=v;let M=c.parseRecordList(T,{glyphID:ie.uShort,paletteIndex:ie.uShort});return{version:d,baseGlyphRecords:_,layerRecords:M}}function se({version:s=0,baseGlyphRecords:o=[],layerRecords:c=[]}){X.argument(s===0,"Only COLRv0 supported.");let d=14,f=d+o.length*6;return new Se.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:c.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(),...c.map((m,v)=>[{name:"LayerGlyphID_"+v,type:"USHORT",value:m.glyphID},{name:"paletteIndex_"+v,type:"USHORT",value:m.paletteIndex}]).flat()])}var We={parse:yo,make:se};function et(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 $t(s,o,c){let d={},f=new ft.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=He(c,m),d}function Fe(s,o,c,d={}){let f=[{name:"nameID_"+s,type:"USHORT",value:o.subfamilyNameID},{name:"flags_"+s,type:"USHORT",value:0}];for(let m=0;m<c.length;++m){let v=c[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 St(s,o,c,d,f){let m={},v=new ft.Parser(s,o),T=v.parseUShort();m.subfamilyNameID=T,m.name=He(d,T,[2,17]),v.skip("uShort",1),m.coordinates={};for(let M=0;M<c.length;++M)m.coordinates[c[M].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?He(d,_,[6]):"",m}function Er(s,o){let c=new Se.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}]);c.offsetToData=c.sizeOf();for(let f=0;f<s.axes.length;f++)c.fields=c.fields.concat(et(f,s.axes[f],o));let d={};for(let f=0;f<s.instances.length;f++)if(s.instances[f].postScriptNameID!==void 0){c.instanceSize+=2,d.postScriptNameID=!0;break}for(let f=0;f<s.instances.length;f++)c.fields=c.fields.concat(Fe(f,s.instances[f],s.axes,d));return c}function Fr(s,o,c){let d=new ft.Parser(s,o),f=d.parseULong();X.argument(f===65536,"Unsupported fvar table version.");let m=d.parseOffset16();d.skip("uShort",1);let v=d.parseUShort(),T=d.parseUShort(),_=d.parseUShort(),M=d.parseUShort(),E=[];for(let oe=0;oe<v;oe++)E.push($t(s,o+m+oe*T,c));let G=[],H=o+m+v*T;for(let oe=0;oe<_;oe++)G.push(St(s,H+oe*M,E,c,M));return{axes:E,instances:G}}var vn={make:Er,parse:Fr},Rr={tag:ie.tag,nameID:ie.uShort,ordering:ie.uShort},pn=new Array(5);pn[1]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed()}},pn[2]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),nominalValue:this.parseFixed(),rangeMinValue:this.parseFixed(),rangeMaxValue:this.parseFixed()}},pn[3]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed(),linkedValue:this.parseFixed()}},pn[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 Sn(){let s=this.parseUShort(),o=pn[s],c={format:s};return o===void 0?(console.warn(`Unknown axis value table format ${s}`),c):Object.assign(c,this.parseStruct(o.bind(this)))}function ws(s,o,c){o||(o=0);let d=new ft.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(),M=d.parseOffset32(),E=d.parseUShort(),G=d.parseOffset32(),H=f>1||m>0?d.parseUShort():void 0;c!==void 0&&X.argument(_>=c.axes.length,"STAT axis count must be greater than or equal to fvar axis count"),E>0&&X.argument(_>=0,"STAT axis count must be greater than 0 if STAT axis value count is greater than 0");let oe=[];for(let Xe=0;Xe<_;Xe++)d.offset=o+M,d.relativeOffset=Xe*T,oe.push(d.parseStruct(Rr));d.offset=o,d.relativeOffset=G;let J=d.parseUShortList(E),fe=[];for(let Xe=0;Xe<E;Xe++)d.offset=o+G,d.relativeOffset=J[Xe],fe.push(Sn.apply(d));return{version:v,axes:oe,values:fe,elidedFallbackNameID:H}}var Wn=new Array(5);Wn[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}]},Wn[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}]},Wn[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}]},Wn[4]=function(s,o){let c=[{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++)c=c.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 c};function fs(s,o){return new Se.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 zs(s,o){let c=o.format,d=Wn[c];X.argument(d!==void 0,`Unknown axis value table format ${c}`);let f=d(s,o);return new Se.Table("axisValueTable_"+s,f)}function Ql(s){let o=new Se.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=fs(m,s.axes[m]);o.offsetToAxisValueOffsets+=v.sizeOf(),o.fields=o.fields.concat(v.fields)}let c=[],d=[],f=s.values.length*2;for(let m=0;m<s.values.length;m++){let v=zs(m,s.values[m]);c.push({name:"offset_"+m,type:"USHORT",value:f}),f+=v.sizeOf(),d=d.concat(v.fields)}return o.fields=o.fields.concat(c),o.fields=o.fields.concat(d),o}var la={make:Ql,parse:ws};function zo(s,o){return new Se.Record("axisValueMap_"+s,[{name:"fromCoordinate_"+s,type:"F2DOT14",value:o.fromCoordinate},{name:"toCoordinate_"+s,type:"F2DOT14",value:o.toCoordinate}])}function vo(s,o){let c=new Se.Record("segmentMap_"+s,[{name:"positionMapCount_"+s,type:"USHORT",value:o.axisValueMaps.length}]),d=[];for(let f=0;f<o.axisValueMaps.length;f++){let m=zo(`${s}_${f}`,o.axisValueMaps[f]);d=d.concat(m.fields)}return c.fields=c.fields.concat(d),c}function jl(s,o){X.argument(s.axisSegmentMaps.length===o.axes.length,"avar axis count must correspond to fvar axis count");let c=new Se.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=vo(d,s.axisSegmentMaps[d]);c.fields=c.fields.concat(f.fields)}return c}function Ho(s,o,c){o||(o=0);let d=new ie(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();X.argument(v===c.axes.length,"avar axis count must correspond to fvar axis count");let T=[];for(let _=0;_<v;_++){let M=[],E=d.parseUShort();for(let G=0;G<E;G++){let H=d.parseF2Dot14(),oe=d.parseF2Dot14();M.push({fromCoordinate:H,toCoordinate:oe})}T.push({axisValueMaps:M})}return{version:[f,m],axisSegmentMaps:T}}var to={make:jl,parse:Ho};function Wo(s,o,c,d){let f=new ft.Parser(s,o),m=f.parseTupleVariationStore(f.relativeOffset,c.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 Go(){console.warn("Writing of cvar tables is not yet supported.")}var wo={make:Go,parse:Wo};function Gn(s,o,c,d){let f=new ft.Parser(s,o),m=f.parseUShort(),v=f.parseUShort();m!==1&&console.warn(`Unsupported gvar table version ${m}.${v}`);let T=f.parseUShort();T!==c.axes.length&&console.warn(`axisCount ${T} in gvar table does not match the number of axes ${c.axes.length} in the fvar table!`);let _=f.parseUShort(),M=f.parsePointer32(function(){return this.parseTupleRecords(_,T)}),E=f.parseTupleVariationStoreList(T,"gvar",d);return{version:[m,v],sharedTuples:M,glyphVariations:E}}function ci(){console.warn("Writing of gvar tables is not yet supported.")}var Vo={make:ci,parse:Gn};function pc(s,o){let c={},d=new ft.Parser(s,o);c.version=d.parseUShort(),X.argument(c.version<=1,"Unsupported gasp table version."),c.numRanges=d.parseUShort(),c.gaspRanges=[];for(let f=0;f<c.numRanges;f++)c.gaspRanges[f]={rangeMaxPPEM:d.parseUShort(),rangeGaspBehavior:d.parseUShort()};return c}function mc(s){let o=new Se.Table("gasp",[{name:"version",type:"USHORT",value:1},{name:"numRanges",type:"USHORT",value:s.numRanges}]);for(let c in s.gaspRanges)o.fields.push({name:"rangeMaxPPEM",type:"USHORT",value:s.gaspRanges[c].rangeMaxPPEM}),o.fields.push({name:"rangeGaspBehavior",type:"USHORT",value:s.gaspRanges[c].rangeGaspBehavior});return o}var L={parse:pc,make:mc};function Q(s,o){let c=new Map,d=s.buffer,f=new ie(s,o);if(f.parseUShort()!==0)return c;f.relativeOffset=f.parseOffset32();let m=s.byteOffset+o+f.relativeOffset,v=f.parseUShort(),T=new Map;for(let _=0;_<v;_++){let M=f.parseUShort(),E=f.parseUShort(),G=m+f.parseOffset32(),H=f.parseULong(),oe=T.get(G);oe===void 0&&(oe=new Uint8Array(d,G,H),T.set(G,oe));for(let J=M;J<=E;J++)c.set(J,oe)}return c}function P(s){let o=Array.from(s.keys()).sort(),c=[],d=[],f=new Map,m=0,v={endGlyphID:null};for(let H=0,oe=o.length;H<oe;H++){let J=o[H],fe=s.get(J),Xe=f.get(fe);Xe===void 0&&(Xe=m,d.push(fe),f.set(fe,Xe),m+=fe.byteLength),J-1===v.endGlyphID&&Xe===v.svgDocOffset?v.endGlyphID=J:(v={startGlyphID:J,endGlyphID:J,svgDocOffset:Xe,svgDocLength:fe.byteLength},c.push(v))}let T=c.length,_=d.length,M=2+T*12,E=new Array(4+T*4+_),G=0;E[G++]={name:"version",type:"USHORT",value:0},E[G++]={name:"svgDocumentListOffset",type:"ULONG",value:10},E[G++]={name:"reserved",type:"ULONG",value:0},E[G++]={name:"numEntries",type:"USHORT",value:T};for(let H=0;H<T;H++){let oe="documentRecord_"+H,{startGlyphID:J,endGlyphID:fe,svgDocOffset:Xe,svgDocLength:gr}=c[H];E[G++]={name:oe+"_startGlyphID",type:"USHORT",value:J},E[G++]={name:oe+"_endGlyphID",type:"USHORT",value:fe},E[G++]={name:oe+"_svgDocOffset",type:"ULONG",value:M+Xe},E[G++]={name:oe+"_svgDocLength",type:"ULONG",value:gr}}for(let H=0;H<_;H++)E[G++]={name:"svgDoc_"+H,type:"LITERAL",value:d[H]};return new Se.Table("SVG ",E)}var W={make:P,parse:Q};function Ue(s){return Math.log(s)/Math.log(2)|0}function Le(s){for(;s.length%4!==0;)s.push(0);let o=0;for(let c=0;c<s.length;c+=4)o+=(s[c]<<24)+(s[c+1]<<16)+(s[c+2]<<8)+s[c+3];return o%=Math.pow(2,32),o}function ct(s,o,c,d){return new Se.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:c!==void 0?c:0},{name:"length",type:"ULONG",value:d!==void 0?d:0}])}function dt(s){let o=new Se.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 c=Math.pow(2,Ue(o.numTables));o.searchRange=16*c,o.entrySelector=Ue(c),o.rangeShift=o.numTables*16-o.searchRange;let d=[],f=[],m=o.sizeOf()+ct().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];X.argument(T.tableName.length===4,"Table name"+T.tableName+" is invalid.");let _=T.sizeOf(),M=ct(T.tableName,Le(T.encode()),m,_);for(d.push({name:M.tag+" Table Record",type:"RECORD",value:M}),f.push({name:T.tableName+" table",type:"RECORD",value:T}),m+=_,X.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 Pt(s,o,c){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 c}function vr(s){let o=0;for(let c=0;c<s.length;c+=1)o+=s[c];return o/s.length}function sn(s){let o=[],c=[],d=[],f=[],m=[],v=[],T=[],_,M=0,E=0,G=0,H=0,oe=0;for(let Kn=0;Kn<s.glyphs.length;Kn+=1){let Zi=s.glyphs.get(Kn),Ma=Zi.unicode|0;if(isNaN(Zi.advanceWidth))throw new Error("Glyph "+Zi.name+" ("+Kn+"): advanceWidth is not a number.");(_>Ma||_===void 0)&&Ma>0&&(_=Ma),M<Ma&&(M=Ma);let oo=li.getUnicodeRange(Ma);if(oo<32)E|=1<<oo;else if(oo<64)G|=1<<oo-32;else if(oo<96)H|=1<<oo-64;else if(oo<123)oe|=1<<oo-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(Zi.name===".notdef")continue;let Ko=Zi.getMetrics();o.push(Ko.xMin),c.push(Ko.yMin),d.push(Ko.xMax),f.push(Ko.yMax),v.push(Ko.leftSideBearing),T.push(Ko.rightSideBearing),m.push(Zi.advanceWidth)}let J={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,c),xMax:Math.max.apply(null,d),yMax:Math.max.apply(null,f),advanceWidthMax:Math.max.apply(null,m),advanceWidthAvg:vr(m),minLeftSideBearing:Math.min.apply(null,v),maxLeftSideBearing:Math.max.apply(null,v),minRightSideBearing:Math.min.apply(null,T)};J.ascender=s.ascender,J.descender=s.descender;let fe=0;s.weightClass>=600&&(fe|=s.macStyleValues.BOLD),s.italicAngle<0&&(fe|=s.macStyleValues.ITALIC);let Xe=Es.make({flags:3,unitsPerEm:s.unitsPerEm,xMin:J.xMin,yMin:J.yMin,xMax:J.xMax,yMax:J.yMax,lowestRecPPEM:3,macStyle:fe,createdTimestamp:s.createdTimestamp}),gr=qs.make({ascender:J.ascender,descender:J.descender,advanceWidthMax:J.advanceWidthMax,minLeftSideBearing:J.minLeftSideBearing,minRightSideBearing:J.minRightSideBearing,xMaxExtent:J.maxLeftSideBearing+(J.xMax-J.xMin),numberOfHMetrics:s.glyphs.length}),or=ka.make(s.glyphs.length),Ir=li.make(Object.assign({xAvgCharWidth:Math.round(J.advanceWidthAvg),usFirstCharIndex:_,usLastCharIndex:M,ulUnicodeRange1:E,ulUnicodeRange2:G,ulUnicodeRange3:H,ulUnicodeRange4:oe,sTypoAscender:J.ascender,sTypoDescender:J.descender,sTypoLineGap:0,usWinAscent:J.yMax,usWinDescent:Math.abs(J.yMin),ulCodePageRange1:1,sxHeight:Pt(s,"xyvw",{yMax:Math.round(J.ascender/2)}).yMax,sCapHeight:Pt(s,"HIKLEFJMNTZBDPRAGOQSUVWXY",J).yMax,usDefaultChar:s.hasChar(" ")?32:0,usBreakChar:s.hasChar(" ")?32:0},s.tables.os2)),Kr=_a.make(s.glyphs),Dn=$n.make(s.glyphs),qn=s.getEnglishName("fontFamily"),Yn=s.getEnglishName("fontSubfamily"),Qs=qn+" "+Yn,io=s.getEnglishName("postScriptName");io||(io=qn.replace(/\s/g,"")+"-"+Yn);let Xr={};for(let Kn in s.names)Xr[Kn]=s.names[Kn];Xr.unicode=Xr.unicode||{},Xr.macintosh=Xr.macintosh||{},Xr.windows=Xr.windows||{};let pa=s.names.unicode||{},Ni=s.names.macintosh||{},xr=s.names.windows||{};for(let Kn in Xr){if(Xr[Kn]=Xr[Kn]||{},!Xr[Kn].uniqueID){let Zi=s.getEnglishName("manufacturer")||"";Xr[Kn].uniqueID={en:`${Zi}: ${Qs}`}}Xr[Kn].postScriptName||(Xr[Kn].postScriptName={en:io})}Xr.unicode.preferredFamily||(Xr.unicode.preferredFamily=pa.fontFamily||Ni.fontFamily||xr.fontFamily),Xr.macintosh.preferredFamily||(Xr.macintosh.preferredFamily=Ni.fontFamily||pa.fontFamily||xr.fontFamily),Xr.windows.preferredFamily||(Xr.windows.preferredFamily=xr.fontFamily||pa.fontFamily||Ni.fontFamily),Xr.unicode.preferredSubfamily||(Xr.unicode.preferredSubfamily=pa.fontSubfamily||Ni.fontSubfamily||xr.fontSubfamily),Xr.macintosh.preferredSubfamily||(Xr.macintosh.preferredSubfamily=Ni.fontSubfamily||pa.fontSubfamily||xr.fontSubfamily),Xr.windows.preferredSubfamily||(Xr.windows.preferredSubfamily=xr.fontSubfamily||pa.fontSubfamily||Ni.fontSubfamily);let tr=[],sr=xt.make(Xr,tr),Si=tr.length>0?bo.make(tr):void 0,Al=eo.make(s),qu=Za.make(s.glyphs,{version:s.getEnglishName("version"),fullName:Qs,familyName:qn,weightName:Yn,postScriptName:io,unitsPerEm:s.unitsPerEm,fontBBox:[0,J.yMin,J.ascender,J.advanceWidthMax],topDict:s.tables.cff&&s.tables.cff.topDict||{}}),Ul=s.metas&&Object.keys(s.metas).length>0?$s.make(s.metas):void 0,ao=[Xe,gr,or,Ir,sr,Dn,Al,qu,Kr];Si&&ao.push(Si);let Mi={gsub:Ei,cpal:fr,colr:We,stat:la,avar:to,cvar:wo,fvar:vn,gvar:Vo,gasp:L,svg:W},Na={avar:[s.tables.fvar],fvar:[s.names]};for(let Kn in Mi){let Zi=s.tables[Kn];if(Zi){let Ma=Mi[Kn].make.call(s,Zi,...Na[Kn]||[]);Ma&&ao.push(Ma)}}Ul&&ao.push(Ul);let _i=dt(ao),ma=_i.encode(),Di=Le(ma),Bi=_i.fields,Ns=!1;for(let Kn=0;Kn<Bi.length;Kn+=1)if(Bi[Kn].name==="head table"){Bi[Kn].value.checkSumAdjustment=2981146554-Di,Ns=!0;break}if(!Ns)throw new Error("Could not find head table with checkSum to adjust.");return _i}var Mn={make:dt,fontToTable:sn,computeCheckSum:Le};function _n(s,o){let c=0,d=s.length-1;for(;c<=d;){let f=c+d>>>1,m=s[f].tag;if(m===o)return f;m<o?c=f+1:d=f-1}return-c-1}function Vn(s,o){let c=0,d=s.length-1;for(;c<=d;){let f=c+d>>>1,m=s[f];if(m===o)return f;m<o?c=f+1:d=f-1}return-c-1}function Nr(s,o){let c,d=0,f=s.length-1;for(;d<=f;){let m=d+f>>>1;c=s[m];let v=c.start;if(v===o)return c;v<o?d=m+1:f=m-1}if(d>0)return c=s[d-1],o>c.end?0:c}function mn(s,o){this.font=s,this.tableName=o}mn.prototype={searchTag:_n,binSearch:Vn,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 c=0;c<s.scripts.length;c++){let d=s.scripts[c].tag;if(d==="DFLT")return d;d==="latn"&&(o=!0)}if(o)return"latn"},getScriptTable:function(s,o){let c=this.getTable(o);if(c){s=s||"DFLT";let d=c.scripts,f=_n(c.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,c){let d=this.getScriptTable(s,c);if(d){if(!o||o==="dflt"||o==="DFLT")return d.defaultLangSys;let f=_n(d.langSysRecords,o);if(f>=0)return d.langSysRecords[f].langSys;if(c){let m={tag:o,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return d.langSysRecords.splice(-1-f,0,m),m.langSys}}},getFeatureTable:function(s,o,c,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===c)return m.feature;if(d){let _=T.length;return X.assert(_===0||c>=T[_-1].tag,"Features must be added in alphabetical order."),m={tag:c,feature:{params:0,lookupListIndexes:[]}},T.push(m),v.push(_),m.feature}}},getLookupTables:function(s,o,c,d,f){let m=this.getFeatureTable(s,o,c,f),v=[];if(m){let T,_=m.lookupListIndexes,M=this.font.tables[this.tableName].lookups;for(let E=0;E<_.length;E++)T=M[_[E]],T.lookupType===d&&v.push(T);if(v.length===0&&f){T={lookupType:d,lookupFlag:0,subtables:[],markFilteringSet:void 0};let E=M.length;return M.push(T),_.push(E),[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 c=Nr(s.ranges,o);return c?c.classId:0}}},getCoverageIndex:function(s,o){switch(s.format){case 1:{let c=Vn(s.glyphs,o);return c>=0?c:-1}case 2:{let c=Nr(s.ranges,o);return c?c.index+o-c.start:-1}}},expandCoverage:function(s){if(s.format===1)return s.glyphs;{let o=[],c=s.ranges;for(let d=0;d<c.length;d++){let f=c[d],m=f.start,v=f.end;for(let T=m;T<=v;T++)o.push(T)}return o}}};var wn=mn;function Ys(s){wn.call(this,s,"gpos")}Ys.prototype=wn.prototype,Ys.prototype.init=function(){let s=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(s)},Ys.prototype.getKerningValue=function(s,o,c){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 M=0;M<_.length;M++){let E=_[M];if(E.secondGlyph===c)return E.value1&&E.value1.xAdvance||0}break}case 2:{let _=this.getGlyphClass(v.classDef1,o),M=this.getGlyphClass(v.classDef2,c),E=v.classRecords[_][M];return E.value1&&E.value1.xAdvance||0}}}}return 0},Ys.prototype.getKerningTables=function(s,o){if(this.font.tables.gpos)return this.getLookupTables(s,o,"kern",2)};var ca=Ys;function ps(s,o){let c=s.length;if(c!==o.length)return!1;for(let d=0;d<c;d++)if(s[d]!==o[d])return!1;return!0}function Pl(s,o,c){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(_<c)d=v+1;else if(_>c)f=v-1;else{m=T;break}}return m}function Rs(s,o,c){let d=0,f=s.length-1;for(;d<=f;){let m=Math.floor((d+f)/2),v=s[m];if(v[o]<c)d=m+1;else if(v[o]>c)f=m-1;else return m}return-1}function Ao(s,o,c){let d=0,f=s.length,m=(v,T)=>v[o]-T[o];for(;d<f;){let v=d+f>>>1;m(s[v],c)<0?d=v+1:f=v}return s.splice(d,0,c),d}function hl(s){return s[0]===31&&s[1]===139&&s[2]===8}function gc(s){let o=new DataView(s.buffer,s.byteOffset,s.byteLength),c=10,d=s.byteLength-8,f=o.getInt8(3);if(f&4&&(c+=2+o.getUint16(c,!0)),f&8)for(;c<d&&s[c++]!==0;);if(f&16)for(;c<d&&s[c++]!==0;);if(f&2&&(c+=2),c>=d)throw new Error("Can't find compressed blocks");let m=o.getUint32(o.byteLength-4,!0);return de(s.subarray(c,d),new Uint8Array(m))}function Ci(s){return{x:s.x,y:s.y,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour}}function ua(s){return{glyphIndex:s.glyphIndex,xScale:s.xScale,scale01:s.scale01,scale10:s.scale10,yScale:s.yScale,dx:s.dx,dy:s.dy}}function Ds(s){wn.call(this,s,"gsub")}function fl(s,o,c){let d=s.subtables;for(let f=0;f<d.length;f++){let m=d[f];if(m.substFormat===o)return m}if(c)return d.push(c),c}Ds.prototype=wn.prototype,Ds.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Ds.prototype.getSingle=function(s,o,c){let d=[],f=this.getLookupTables(o,c,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],M=this.expandCoverage(_.coverage),E;if(_.substFormat===1){let G=_.deltaGlyphId;for(E=0;E<M.length;E++){let H=M[E];d.push({sub:H,by:H+G})}}else{let G=_.substitute;for(E=0;E<M.length;E++)d.push({sub:M[E],by:G[E]})}}}return d},Ds.prototype.getMultiple=function(s,o,c){let d=[],f=this.getLookupTables(o,c,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],M=this.expandCoverage(_.coverage),E;for(E=0;E<M.length;E++){let G=M[E],H=_.sequences[E];d.push({sub:G,by:H})}}}return d},Ds.prototype.getAlternates=function(s,o,c){let d=[],f=this.getLookupTables(o,c,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],M=this.expandCoverage(_.coverage),E=_.alternateSets;for(let G=0;G<M.length;G++)d.push({sub:M[G],by:E[G]})}}return d},Ds.prototype.getLigatures=function(s,o,c){let d=[],f=this.getLookupTables(o,c,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],M=this.expandCoverage(_.coverage),E=_.ligatureSets;for(let G=0;G<M.length;G++){let H=M[G],oe=E[G];for(let J=0;J<oe.length;J++){let fe=oe[J];d.push({sub:[H].concat(fe.components),by:fe.ligGlyph})}}}}return d},Ds.prototype.addSingle=function(s,o,c,d){let f=this.getLookupTables(c,d,s,1,!0)[0],m=fl(f,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});X.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},Ds.prototype.addMultiple=function(s,o,c,d){X.assert(o.by instanceof Array&&o.by.length>1,'Multiple: "by" must be an array of two or more ids');let f=this.getLookupTables(c,d,s,2,!0)[0],m=fl(f,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});X.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},Ds.prototype.addAlternate=function(s,o,c,d){let f=this.getLookupTables(c,d,s,3,!0)[0],m=fl(f,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});X.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},Ds.prototype.addLigature=function(s,o,c,d){let f=this.getLookupTables(c,d,s,4,!0)[0],m=f.subtables[0];m||(m={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},f.subtables[0]=m),X.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},M=this.binSearch(m.coverage.glyphs,v);if(M>=0){let E=m.ligatureSets[M];for(let G=0;G<E.length;G++)if(ps(E[G].components,T))return;E.push(_)}else M=-1-M,m.coverage.glyphs.splice(M,0,v),m.ligatureSets.splice(M,0,[_])},Ds.prototype.getFeature=function(s,o,c){if(/ss\d\d/.test(s))return this.getSingle(s,o,c);switch(s){case"aalt":case"salt":return this.getSingle(s,o,c).concat(this.getAlternates(s,o,c));case"dlig":case"liga":case"rlig":return this.getLigatures(s,o,c);case"ccmp":return this.getMultiple(s,o,c).concat(this.getLigatures(s,o,c));case"stch":return this.getMultiple(s,o,c)}},Ds.prototype.add=function(s,o,c,d){if(/ss\d\d/.test(s))return this.addSingle(s,o,c,d);switch(s){case"aalt":case"salt":return typeof o.by=="number"?this.addSingle(s,o,c,d):this.addAlternate(s,o,c,d);case"dlig":case"liga":case"rlig":return this.addLigature(s,o,c,d);case"ccmp":return o.by instanceof Array?this.addMultiple(s,o,c,d):this.addLigature(s,o,c,d)}};var Qh=Ds,Du=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=[],c=this.cpal();if(!c)return o;for(let d=0;d<c.colorRecordIndices.length;d++){let f=c.colorRecordIndices[d],m=[];for(let v=f;v<f+c.numPaletteEntries;v++)m.push(mt(c.colorRecords[v],s||"hexa"));o.push(m)}return o}toCPALcolor(s){return Array.isArray(s)?s.map(o=>rt(o,"raw")):rt(s,"raw")}fillPalette(s,o=[],c=this.cpal().numPaletteEntries){return s=Number.isInteger(s)?this.get(s,"raw"):s,Object.assign(Array(c).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(),c=o.numPaletteEntries+s,d=this.getAll().map(f=>this.fillPalette(f,[],c));o.numPaletteEntries=c,o.colorRecords=this.toCPALcolor(d.flat()),this.updateIndices()}get(s,o="hexa"){return this.getAll(o)[s]||null}getColor(s,o=0,c="hexa"){return Ee(this.font,s,o,c)}setColor(s,o,c=0){s=parseInt(s),c=parseInt(c);let d=this.getAll("raw"),f=d[c];if(!f)throw Error(`paletteIndex ${c} 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[c]);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(),c=o.numPaletteEntries;s&&s.length?(s=this.toCPALcolor(s),s.length>c?this.extend(s.length-c):s.length<c&&(s=this.fillPalette(s)),o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...s)):(o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...Array(c).fill(this.defaultValue)))}delete(s){let o=this.getAll("raw");delete o[s];let c=this.cpal();c.colorRecordIndices.pop(),c.colorRecords=o.flat()}deleteColor(s,o){if(s===o)throw Error("replacementIndex cannot be the same as colorIndex");let c=this.cpal(),d=this.getAll("raw"),f=[];if(o>c.numPaletteEntries-1)throw Error(`Replacement index out of range: numPaletteEntries after deletion: ${c.numPaletteEntries-1}, replacementIndex: ${o})`);for(let T=0;T<d.length;T++){let _=d[T].filter((M,E)=>E!==s);f.push(_)}let m=this.font.tables.colr;if(m){let T=m.layerRecords;for(let _=0;_<T.length;_++){let M=T[_].paletteIndex;if(M>s)T[_].paletteIndex-=1;else if(M===s){let E=0;for(let G=0;G<d.length;G++)if(o>s&&o<=s+d[G].length){E++;break}T[_].paletteIndex=o-E}}this.font.tables.colr={...m,layerRecords:T}}let v=f.flat();for(let T=0;T<d.length;T++)c.colorRecordIndices[T]-=T;c.numPaletteEntries=Math.max(0,c.numPaletteEntries-1),c.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 c=0;c<o;c++)s.colorRecordIndices.push(c*s.numPaletteEntries)}},jh=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,c=[],d=o.tables.colr,f=o.tables.cpal;if(!d||!f)return c;let m=Pl(d.baseGlyphRecords,"glyphID",s);if(!m)return c;let v=m.firstLayerIndex,T=m.numLayers;for(let _=0;_<T;_++){let M=d.layerRecords[v+_];c.push({glyph:o.glyphs.get(M.glyphID),paletteIndex:M.paletteIndex})}return c}add(s,o,c){let d=this.get(s);o=Array.isArray(o)?o:[o],c===void 0||c===1/0||c>d.length?c=d.length:c<0&&(c=d.length+1+c%(d.length+1),c>=d.length+1&&(c-=d.length+1));let f=[];for(let m=0;m<c;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=c;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,c){let d=this.get(s);d[o]?(d=d.map((f,m)=>({glyphID:f.glyph.index,paletteIndex:m===o?c:f.paletteIndex})),this.updateColrTable(s,d)):console.error("Invalid layer index")}remove(s,o,c=o){let d=this.get(s);d=d.map(f=>({glyphID:f.glyph.index,paletteIndex:f.paletteIndex})),d.splice(o,c-o+1),this.updateColrTable(s,d)}updateColrTable(s,o){this.ensureCOLR();let c=this.font.tables.colr,d=Rs(c.baseGlyphRecords,"glyphID",s);if(d===-1){let _={glyphID:s,firstLayerIndex:c.layerRecords.length,numLayers:0};d=Ao(c.baseGlyphRecords,"glyphID",_)}let f=c.baseGlyphRecords[d],m=f.numLayers,v=o.length,T=v-m;if(T>0){let _=o.slice(m).map(M=>({glyphID:M.glyphID,paletteIndex:M.paletteIndex}));c.layerRecords.splice(f.firstLayerIndex+m,0,..._)}else T<0&&c.layerRecords.splice(f.firstLayerIndex+v,-T);for(let _=0;_<Math.min(m,v);_++)c.layerRecords[f.firstLayerIndex+_]={glyphID:o[_].glyphID,paletteIndex:o[_].paletteIndex};if(f.numLayers=v,T!==0)for(let _=0;_<c.baseGlyphRecords.length;_++){let M=c.baseGlyphRecords[_];_===d||M.firstLayerIndex<f.firstLayerIndex||(c.baseGlyphRecords[_].firstLayerIndex+=T)}}},Ph=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 c=o.get(s);if(c===void 0)return;let d=this.cache.get(c);d===void 0&&(d=ro(c),this.cache.set(c,d));let f=d.images.get(s);return f===void 0&&(f=qo(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 ro(s){return{template:Oh(s).then(Qu),images:new Map}}function qo(s,o,c){return{promise:o.then(d=>{let f;typeof d=="string"?f=d:(d[4]=c,f=d.join(""));let m=ju(f,s.unitsPerEm);return m.image.decode().then(()=>m)}),image:void 0}}var Oh=typeof DecompressionStream=="function"?Bu:xc;function xc(s){try{return Promise.resolve(new TextDecoder().decode(hl(s)?gc(s):s))}catch(o){return Promise.reject(o)}}function Bu(s){if(hl(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 Qu(s){let o=s.indexOf("<svg"),c=s.indexOf(">",o+4)+1;if(/ id=['"]glyph\d+['"]/.test(s.substring(o,c)))return s;let d=s.lastIndexOf("</svg>");return[s.substring(0,c),"<defs>",s.substring(c,d),'</defs><use href="#glyph',"",'"/>',s.substring(d)]}function ju(s,o){let c=new DOMParser().parseFromString(s,"image/svg+xml").documentElement,d=c.viewBox.baseVal,f=c.width.baseVal,m=c.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(c),document.body.appendChild(_);let M=c.getBBox();document.body.removeChild(_);let E=(M.x-d.x)*v,G=(d.y-M.y)*T,H=M.width*v,oe=M.height*T;c.setAttribute("viewBox",[M.x,M.y,M.width,M.height].join(" ")),v!==1&&c.setAttribute("width",H),T!==1&&c.setAttribute("height",oe);let J=new Image(H,oe);return J.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(c.outerHTML),{leftSideBearing:E,baseline:G,image:J}}var bc=new WeakMap;function h0(s,o,c,d,f){let m;return(o&d)>0?(m=s.parseByte(),(o&f)===0&&(m=-m),m=c+m):(o&f)>0?m=c:m=c+s.parseShort(),m}function pl(s,o,c){let d=new ft.Parser(o,c);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 M=d.parseByte();for(let E=0;E<M;E+=1)f.push(m),_+=1}if(X.argument(f.length===T,"Bad flags."),v.length>0){let _=[],M;if(T>0){for(let H=0;H<T;H+=1)m=f[H],M={},M.onCurve=!!(m&1),M.lastPointOfContour=v.indexOf(H)>=0,_.push(M);let E=0;for(let H=0;H<T;H+=1)m=f[H],M=_[H],M.x=h0(d,m,E,2,16),E=M.x;let G=0;for(let H=0;H<T;H+=1)m=f[H],M=_[H],M.y=h0(d,m,G,4,32),G=M.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 no(s,o){let c=[];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};c.push(m)}return c}function Fh(s){let o=[],c=[];for(let d=0;d<s.length;d+=1){let f=s[d];c.push(f),f.lastPointOfContour&&(o.push(c),c=[])}return X.argument(c.length===0,"There are still points left in the current contour."),o}function yc(s){let o=new Oe;if(!s)return o;let c=Fh(s);for(let d=0;d<c.length;++d){let f=c[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 vc(s,o){if(o.isComposite){bc.has(s)||bc.set(s,new Set);let c=bc.get(s);c.add(o.index);try{for(let d=0;d<o.components.length;d+=1){let f=o.components[d];if(c.has(f.glyphIndex))continue;let m=s.get(f.glyphIndex);if(m.getPath(),m.points){let v;if(f.matchedPoints===void 0)v=no(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]],M={xScale:f.xScale,scale01:f.scale01,scale10:f.scale10,yScale:f.yScale,dx:0,dy:0};_=no([_],M)[0],M.dx=T.x-_.x,M.dy=T.y-_.y,v=no(m.points,M)}o.points=o.points.concat(v)}}}finally{c.delete(o.index)}}return yc(o.points)}function f0(s,o,c,d){let f=new Sr.GlyphSet(d);for(let m=0;m<c.length-1;m+=1){let v=c[m],T=c[m+1];v!==T?f.push(m,Sr.ttfGlyphLoader(d,m,pl,s,o+v,vc)):f.push(m,Sr.glyphLoader(d,m))}return f}function Uh(s,o,c,d){let f=new Sr.GlyphSet(d);return d._push=function(m){let v=c[m],T=c[m+1];v!==T?f.push(m,Sr.ttfGlyphLoader(d,m,pl,s,o+v,vc)):f.push(m,Sr.glyphLoader(d,m))},f}function Pu(s,o,c,d,f){return f.lowMemory?Uh(s,o,c,d):f0(s,o,c,d)}var wc={getPath:yc,parse:Pu},Ou=class{constructor(s){this.font=s}normalizeCoordTags(s){for(let o in s)if(o.length<4){let c=o.padEnd(4," ");s[c]===void 0&&(s[c]=s[o]),delete s[o]}}getNormalizedCoords(s){s||(s=this.font.variation.get());let o=[];this.normalizeCoordTags(s);for(let c=0;c<this.fvar().axes.length;c++){let d=this.fvar().axes[c],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 c=0;c<this.avar().axisSegmentMaps.length;c++){let d=this.avar().axisSegmentMaps[c];for(let f=0;f<d.axisValueMaps.length;f++){let m=d.axisValueMaps[f];if(f>=1&&o[c]<m.fromCoordinate){let v=d.axisValueMaps[f-1];o[c]=((o[c]-v.fromCoordinate)*(m.toCoordinate-v.toCoordinate)+Number.EPSILON)/(m.fromCoordinate-v.fromCoordinate+Number.EPSILON)+v.toCoordinate;break}}}return o}interpolatePoints(s,o,c){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&&!c[d];)d++;if(d>m)continue;let T=d,_=d;for(d++;d<=m;)c[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,c,d,f,m){if(s>o)return;let v=["x","y"];for(let _=0;_<v.length;_++){let M=v[_];if(f[c][M]>f[d][M]){var T=c;c=d,d=T}let E=f[c][M],G=f[d][M],H=m[c][M],oe=m[d][M];if(E!==G||H===oe){let J=E===G?0:(oe-H)/(G-E);for(let fe=s;fe<=o;fe++){let Xe=f[fe][M];Xe<=E?Xe+=H-E:Xe>=G?Xe+=oe-G:Xe=H+(Xe-E)*J,m[fe][M]=Xe}}}}deltaShift(s,o,c,d,f){let m=f[c].x-d[c].x,v=f[c].y-d[c].y;if(!(m===0&&v===0))for(let T=s;T<=o;T++)T!==c&&(f[T].x+=m,f[T].y+=v)}transformComponents(s,o,c,d,f,m){let v=0;for(let T=0;T<s.components.length;T++){let _=s.components[T],M=this.font.glyphs.get(_.glyphIndex),E=ua(_),G=d.indexOf(T);G>-1&&(E.dx+=Math.round(f.deltas[G]*m),E.dy+=Math.round(f.deltasY[G]*m));let H=no(this.getTransform(M,c).points,E);o.splice(v,H.length,...H),v+=M.points.length}}applyTupleVariationStore(s,o,c,d="gvar",f={}){c||(c=this.font.variation.get());let m=this.getNormalizedCoords(c),{headers:v,sharedPoints:T}=s,_=this.fvar().axes.length,M;d==="gvar"?M=o.map(Ci):d==="cvar"&&(M=[...o]);for(let E=0;E<v.length;E++){let G=v[E],H=1;for(let J=0;J<_;J++){let fe=[0];switch(d){case"gvar":fe=G.peakTuple?G.peakTuple:this.gvar().sharedTuples[G.sharedTupleRecordsIndex];break;case"cvar":fe=G.peakTuple;break}if(fe[J]!==0){if(m[J]===0){H=0;break}if(G.intermediateStartTuple)if(m[J]<G.intermediateStartTuple[J]||m[J]>G.intermediateEndTuple[J]){H=0;break}else m[J]<fe[J]?H=H*(m[J]-G.intermediateStartTuple[J]+Number.EPSILON)/(fe[J]-G.intermediateStartTuple[J]+Number.EPSILON):H=H*(G.intermediateEndTuple[J]-m[J]+Number.EPSILON)/(G.intermediateEndTuple[J]-fe[J]+Number.EPSILON);else{if(m[J]<Math.min(0,fe[J])||m[J]>Math.max(0,fe[J])){H=0;break}H=(H*m[J]+Number.EPSILON)/(fe[J]+Number.EPSILON)}}}if(H===0)continue;let oe=G.privatePoints.length?G.privatePoints:T;if(d==="gvar"&&f.glyph&&f.glyph.isComposite)this.transformComponents(f.glyph,M,c,oe,G,H);else if(oe.length===0)for(let J=0;J<M.length;J++){let fe=M[J];d==="gvar"?M[J]={x:Math.round(fe.x+G.deltas[J]*H),y:Math.round(fe.y+G.deltasY[J]*H),onCurve:fe.onCurve,lastPointOfContour:fe.lastPointOfContour}:d==="cvar"&&(M[J]=Math.round(fe+G.deltas[J]*H))}else{let J;d==="gvar"?J=M.map(Ci):d==="cvar"&&(J=M);let fe=Array(o.length).fill(!1);for(let Xe=0;Xe<oe.length;Xe++){let gr=oe[Xe];if(gr<o.length){let or=J[gr];d==="gvar"?(fe[gr]=!0,or.x+=G.deltas[Xe]*H,or.y+=G.deltasY[Xe]*H):d==="cvar"&&(M[gr]=Math.round(or+G.deltas[Xe]*H))}}if(d==="gvar"){this.interpolatePoints(J,M,fe);for(let Xe=0;Xe<o.length;Xe++){let gr=J[Xe].x-M[Xe].x,or=J[Xe].y-M[Xe].y;M[Xe].x=Math.round(M[Xe].x+gr),M[Xe].y=Math.round(M[Xe].y+or)}}}}return M}getTransform(s,o){Number.isInteger(s)&&(s=this.font.glyphs.get(s));let c=s.getBlendPath,d=!!(s.points&&s.points.length),f=s;if(c||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 at(Object.assign({},s,{points:T,path:yc(T)}))}}else if(c){let m=s.getBlendPath(o);f=new at(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,c=this.cvar();return!o||!o.length||!c||!c.headers.length?o:this.applyTupleVariationStore(c,o,s,"cvar")}getVariableAdjustment(s,o,c,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[c]&&v[c].map.length;if(T){let _=s;_>=T&&(_=T-1),{outerIndex:f,innerIndex:m}=v[c].map[_]}else f=0,m=s;return this.getDelta(v.itemVariationStore,f,m,d)}getDelta(s,o,c,d){if(o>=s.itemVariationSubtables.length)return 0;let f=s.itemVariationSubtables[o];if(c>=f.deltaSets.length)return 0;let m=f.deltaSets[c],v=this.getBlendVector(s,o,d),T=0;for(let _=0;_<f.regionIndexes.length;_++)T+=m[_]*v[_];return T}getBlendVector(s,o,c){c||(c=this.font.variation.get());let d=s.itemVariationSubtables[o],f=this.getNormalizedCoords(c),m=[];for(let v=0;v<d.regionIndexes.length;v++){let T=1,_=d.regionIndexes[v],M=s.variationRegions[_].regionAxes;for(let E=0;E<M.length;E++){let G=M[E],H;G.startCoord>G.peakCoord||G.peakCoord>G.endCoord||G.startCoord<0&&G.endCoord>0&&G.peakCoord!==0||G.peakCoord===0?H=1:f[E]<G.startCoord||f[E]>G.endCoord?H=0:f[E]===G.peakCoord?H=1:f[E]<G.peakCoord?H=(f[E]-G.startCoord+Number.EPSILON)/(G.peakCoord-G.startCoord+Number.EPSILON):H=(G.endCoord-f[E]+Number.EPSILON)/(G.endCoord-G.peakCoord+Number.EPSILON),T*=H}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}},da=class{constructor(s){this.font=s,this.process=new Ou(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(c=>c.name&&c.name.en==="Regular")),o}getInstanceIndex(s){return this.fvar().instances.findIndex(o=>Object.keys(s).every(c=>o.coordinates[c]===s[c]))}getInstance(s){return this.fvar().instances&&this.fvar().instances[s]}set(s){let o;if(Number.isInteger(s)){let c=this.getInstance(s);if(!c)throw Error(`Invalid instance index ${s}`);o={...c.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}},Ol=1e6,ml=64,Yo=1e4,Zo,rs,Fu,Ac;function Uu(s){this.font=s,this.getCommands=function(o){return wc.getPath(o).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function $u(s){return s}function p0(s){return Math.sign(s)*Math.round(Math.abs(s))}function C(s){return Math.sign(s)*Math.round(Math.abs(s*2))/2}function B(s){return Math.sign(s)*(Math.round(Math.abs(s)+.5)-.5)}function ee(s){return Math.sign(s)*Math.ceil(Math.abs(s))}function Ye(s){return Math.sign(s)*Math.floor(Math.abs(s))}var kt=function(s){let o=this.srPeriod,c=this.srPhase,d=this.srThreshold,f=1;return s<0&&(s=-s,f=-1),s+=d-c,s=Math.trunc(s/o)*o,s+=c,s<0?c*f:s*f},Ot={x:1,y:0,axis:"x",distance:function(s,o,c,d){return(c?s.xo:s.x)-(d?o.xo:o.x)},interpolate:function(s,o,c,d){let f,m,v,T,_,M,E;if(!d||d===this){if(f=s.xo-o.xo,m=s.xo-c.xo,_=o.x-o.xo,M=c.x-c.xo,v=Math.abs(f),T=Math.abs(m),E=v+T,E===0){s.x=s.xo+(_+M)/2;return}s.x=s.xo+(_*T+M*v)/E;return}if(f=d.distance(s,o,!0,!0),m=d.distance(s,c,!0,!0),_=d.distance(o,o,!1,!0),M=d.distance(c,c,!1,!0),v=Math.abs(f),T=Math.abs(m),E=v+T,E===0){Ot.setRelative(s,s,(_+M)/2,d,!0);return}Ot.setRelative(s,s,(_*T+M*v)/E,d,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(s,o,c,d,f){if(!d||d===this){s.x=(f?o.xo:o.x)+c;return}let m=f?o.xo:o.x,v=f?o.yo:o.y,T=m+c*d.x,_=v+c*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}},mr={x:0,y:1,axis:"y",distance:function(s,o,c,d){return(c?s.yo:s.y)-(d?o.yo:o.y)},interpolate:function(s,o,c,d){let f,m,v,T,_,M,E;if(!d||d===this){if(f=s.yo-o.yo,m=s.yo-c.yo,_=o.y-o.yo,M=c.y-c.yo,v=Math.abs(f),T=Math.abs(m),E=v+T,E===0){s.y=s.yo+(_+M)/2;return}s.y=s.yo+(_*T+M*v)/E;return}if(f=d.distance(s,o,!0,!0),m=d.distance(s,c,!0,!0),_=d.distance(o,o,!1,!0),M=d.distance(c,c,!1,!0),v=Math.abs(f),T=Math.abs(m),E=v+T,E===0){mr.setRelative(s,s,(_+M)/2,d,!0);return}mr.setRelative(s,s,(_*T+M*v)/E,d,!0)},normalSlope:0,setRelative:function(s,o,c,d,f){if(!d||d===this){s.y=(f?o.yo:o.y)+c;return}let m=f?o.xo:o.x,v=f?o.yo:o.y,T=m+c*d.x,_=v+c*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(Ot),Object.freeze(mr);function an(s,o){this.x=s,this.y=o,this.axis=void 0,this.slope=o/s,this.normalSlope=-s/o,Object.freeze(this)}an.prototype.distance=function(s,o,c,d){return this.x*Ot.distance(s,o,c,d)+this.y*mr.distance(s,o,c,d)},an.prototype.interpolate=function(s,o,c,d){let f,m,v,T,_,M,E;if(v=d.distance(s,o,!0,!0),T=d.distance(s,c,!0,!0),f=d.distance(o,o,!1,!0),m=d.distance(c,c,!1,!0),_=Math.abs(v),M=Math.abs(T),E=_+M,E===0){this.setRelative(s,s,(f+m)/2,d,!0);return}this.setRelative(s,s,(f*M+m*_)/E,d,!0)},an.prototype.setRelative=function(s,o,c,d,f){d=d||this;let m=f?o.xo:o.x,v=f?o.yo:o.y,T=m+c*d.x,_=v+c*d.y,M=d.normalSlope,E=this.slope,G=s.x,H=s.y;s.x=(E*G-M*T+_-H)/(E-M),s.y=E*(s.x-G)+H},an.prototype.touch=function(s){s.xTouched=!0,s.yTouched=!0};function gn(s,o){let c=Math.sqrt(s*s+o*o);return s/=c,o/=c,s===1&&o===0?Ot:s===0&&o===1?mr:new an(s,o)}function en(s,o,c,d){this.x=this.xo=Math.round(s*64)/64,this.y=this.yo=Math.round(o*64)/64,this.lastPointOfContour=c,this.onCurve=d,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}en.prototype.nextTouched=function(s){let o=this.nextPointOnContour;for(;!s.touched(o)&&o!==this;)o=o.nextPointOnContour;return o},en.prototype.prevTouched=function(s){let o=this.prevPointOnContour;for(;!s.touched(o)&&o!==this;)o=o.prevPointOnContour;return o};var Bs=Object.freeze(new en(0,0)),xn={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function As(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=Ot,this.round=p0}}Uu.prototype.exec=function(s,o){if(typeof o!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;let c=this.font,d=this._prepState;if(!d||d.ppem!==o){let f=this._fpgmState;if(!f){As.prototype=xn,f=this._fpgmState=new As("fpgm",c.tables.fpgm),f.funcs=[],f.font=c,f.instructionCount=0,f.callDepth=0;try{rs(f)}catch(v){console.log("Hinting error in FPGM:"+v),this._errorState=3;return}}As.prototype=f,d=this._prepState=new As("prep",c.tables.prep),d.ppem=o,d.instructionCount=0,d.callDepth=0;let m=c.variation&&c.variation.process.getCvarTransform()||c.tables.cvt;if(m){let v=d.cvt=new Array(m.length),T=o/c.unitsPerEm;for(let _=0;_<m.length;_++)v[_]=m[_]*T}else d.cvt=[];try{rs(d)}catch(v){this._errorState<2&&console.log("Hinting error in PREP:"+v),this._errorState=2}}if(!(this._errorState>1))try{return Fu(s,d)}catch(f){this._errorState<1&&(console.log("Hinting error:"+f),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}},Fu=function(s,o){let c=o.ppem/o.font.unitsPerEm,d=c,f=s.components,m,v,T;if(As.prototype=o,!f)T=new As("glyf",s.instructions),T.instructionCount=0,T.callDepth=0,Ac(s,T,c,d),v=T.gZone;else{let _=o.font;v=[],m=[];for(let M=0;M<f.length;M++){let E=f[M],G=_.glyphs.get(E.glyphIndex);T=new As("glyf",G.instructions),T.instructionCount=0,T.callDepth=0,Ac(G,T,c,d);let H=Math.round(E.dx*c),oe=Math.round(E.dy*d),J=T.gZone,fe=T.contours;for(let gr=0;gr<J.length;gr++){let or=J[gr];or.xTouched=or.yTouched=!1,or.xo=or.x=or.x+H,or.yo=or.y=or.y+oe}let Xe=v.length;v.push.apply(v,J);for(let gr=0;gr<fe.length;gr++)m.push(fe[gr]+Xe)}s.instructions&&!T.inhibitGridFit&&(T=new As("glyf",s.instructions),T.gZone=T.z0=T.z1=T.z2=v,T.contours=m,v.push(new en(0,0),new en(Math.round(s.advanceWidth*c),0)),rs(T),v.length-=2)}return v},Ac=function(s,o,c,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 en(_.x*c,_.y*d,_.lastPointOfContour,_.onCurve);let M,E;for(let G=0;G<m;G++)_=v[G],M||(M=_,T.push(G)),_.lastPointOfContour?(_.nextPointOnContour=M,M.prevPointOnContour=_,M=void 0):(E=v[G+1],_.nextPointOnContour=E,E.prevPointOnContour=_);o.inhibitGridFit||(v.push(new en(0,0),new en(Math.round(s.advanceWidth*c),0)),rs(o),v.length-=2)},rs=function(s){let o=s.prog;if(!o)return;let c=o.length,d;for(s.ip=0;s.ip<c;s.ip++){if(++s.instructionCount>Ol)throw new Error("Hinting instructions exceeded maximum of "+Ol);if(d=Zo[o[s.ip]],!d)throw new Error("unknown instruction: 0x"+Number(o[s.ip]).toString(16));d(s)}};function qi(s){let o=s.tZone=new Array(s.gZone.length);for(let c=0;c<o.length;c++)o[c]=new en(0,0)}function Ea(s,o){let c=s.prog,d=s.ip,f=1,m;do if(m=c[++d],m===88)f++;else if(m===89)f--;else if(m===64)d+=c[d+1]+1;else if(m===65)d+=2*c[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 Yi(s,o){o.fv=o.pv=o.dpv=s}function ui(s,o){o.pv=o.dpv=s}function ha(s,o){o.fv=s}function zu(s,o){let c=o.stack,d=c.pop(),f=c.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=gn(T,_)}function Tc(s,o){let c=o.stack,d=c.pop(),f=c.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=gn(T,_)}function q6(s){let o=s.stack,c=o.pop(),d=o.pop();s.pv=s.dpv=gn(d,c)}function Y6(s){let o=s.stack,c=o.pop(),d=o.pop();s.fv=gn(d,c)}function Z6(s){let o=s.stack,c=s.pv;o.push(c.x*16384),o.push(c.y*16384)}function K6(s){let o=s.stack,c=s.fv;o.push(c.x*16384),o.push(c.y*16384)}function X6(s){s.fv=s.pv}function J6(s){let o=s.stack,c=o.pop(),d=o.pop(),f=o.pop(),m=o.pop(),v=o.pop(),T=s.z0,_=s.z1,M=T[c],E=T[d],G=_[f],H=_[m],oe=s.z2[v],J=M.x,fe=M.y,Xe=E.x,gr=E.y,or=G.x,Ir=G.y,Kr=H.x,Dn=H.y,qn=(J-Xe)*(Ir-Dn)-(fe-gr)*(or-Kr),Yn=J*gr-fe*Xe,Qs=or*Dn-Ir*Kr;oe.x=(Yn*(or-Kr)-Qs*(J-Xe))/qn,oe.y=(Yn*(Ir-Dn)-Qs*(fe-gr))/qn}function ey(s){s.rp0=s.stack.pop()}function ty(s){s.rp1=s.stack.pop()}function ry(s){s.rp2=s.stack.pop()}function ny(s){let o=s.stack.pop();switch(s.zp0=o,o){case 0:s.tZone||qi(s),s.z0=s.tZone;break;case 1:s.z0=s.gZone;break;default:throw new Error("Invalid zone pointer")}}function sy(s){let o=s.stack.pop();switch(s.zp1=o,o){case 0:s.tZone||qi(s),s.z1=s.tZone;break;case 1:s.z1=s.gZone;break;default:throw new Error("Invalid zone pointer")}}function iy(s){let o=s.stack.pop();switch(s.zp2=o,o){case 0:s.tZone||qi(s),s.z2=s.tZone;break;case 1:s.z2=s.gZone;break;default:throw new Error("Invalid zone pointer")}}function ay(s){let o=s.stack.pop();switch(s.zp0=s.zp1=s.zp2=o,o){case 0:s.tZone||qi(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 oy(s){s.loop=s.stack.pop(),s.loop>Yo&&(s.loop=Yo)}function ly(s){s.round=p0}function cy(s){s.round=B}function uy(s){let o=s.stack.pop();s.minDis=o/64}function dy(s){Ea(s,!1)}function hy(s){let o=s.stack.pop();s.ip+=o-1}function fy(s){let o=s.stack.pop();s.cvCutIn=o/64}function py(s){let o=s.stack;o.push(o[o.length-1])}function $h(s){s.stack.pop()}function my(s){s.stack.length=0}function gy(s){let o=s.stack,c=o.pop(),d=o.pop();o.push(c),o.push(d)}function xy(s){let o=s.stack;o.push(o.length)}function by(s){let o=s.stack,c=o.pop(),d=o.pop();if(d>Yo&&(d=Yo),++s.callDepth>ml)throw new Error("Hinting call depth exceeded maximum of "+ml);let f=s.ip,m=s.prog;s.prog=s.funcs[c];for(let v=0;v<d;v++)rs(s);s.ip=f,s.prog=m,s.callDepth--}function yy(s){let o=s.stack.pop();if(++s.callDepth>ml)throw new Error("Hinting call depth exceeded maximum of "+ml);let c=s.ip,d=s.prog;s.prog=s.funcs[o],rs(s),s.ip=c,s.prog=d,s.callDepth--}function vy(s){let o=s.stack,c=o.pop();o.push(o[o.length-c])}function wy(s){let o=s.stack,c=o.pop();o.push(o.splice(o.length-c,1)[0])}function Ay(s){if(s.env!=="fpgm")throw new Error("FDEF not allowed here");let o=s.stack,c=s.prog,d=s.ip,f=o.pop(),m=d;for(;c[++d]!==45;);s.ip=d,s.funcs[f]=c.slice(m+1,d)}function K1(s,o){let c=o.stack.pop(),d=o.z0[c],f=o.fv,m=o.pv,v=m.distance(d,Bs);s&&(v=o.round(v)),f.setRelative(d,Bs,v,m),f.touch(d),o.rp0=o.rp1=c}function X1(s,o){let c=o.z2,d=c.length-2,f,m,v;for(let T=0;T<d;T++)f=c[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 J1(s,o){let c=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 M=c.pop(),E=_[M],G=v.distance(f,f,!1,!0);m.setRelative(E,E,G,v),m.touch(E)}o.loop=1}function em(s,o){let c=o.stack,d=s?o.rp1:o.rp2,f=(s?o.z0:o.z1)[d],m=o.fv,v=o.pv,T=c.pop(),_=o.z2[o.contours[T]],M=_,E=v.distance(f,f,!1,!0);do M!==f&&m.setRelative(M,M,E,v),M=M.nextPointOnContour;while(M!==_)}function tm(s,o){let c=o.stack,d=s?o.rp1:o.rp2,f=(s?o.z0:o.z1)[d],m=o.fv,v=o.pv,T=c.pop(),_;switch(T){case 0:_=o.tZone;break;case 1:_=o.gZone;break;default:throw new Error("Invalid zone")}let M,E=v.distance(f,f,!1,!0),G=_.length-2;for(let H=0;H<G;H++)M=_[H],m.setRelative(M,M,E,v)}function Ty(s){let o=s.stack,c=s.loop,d=s.fv,f=o.pop()/64,m=s.z2;for(;c--;){let v=o.pop(),T=m[v];d.setRelative(T,T,f),d.touch(T)}s.loop=1}function Cy(s){let o=s.stack,c=s.rp1,d=s.rp2,f=s.loop,m=s.z0[c],v=s.z1[d],T=s.fv,_=s.dpv,M=s.z2;for(;f--;){let E=o.pop(),G=M[E];T.interpolate(G,m,v,_),T.touch(G)}s.loop=1}function rm(s,o){let c=o.stack,d=c.pop()/64,f=c.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 Sy(s){let o=s.stack,c=s.rp0,d=s.z0[c],f=s.loop,m=s.fv,v=s.pv,T=s.z1;for(;f--;){let _=o.pop(),M=T[_];m.setRelative(M,d,0,v),m.touch(M)}s.loop=1}function _y(s){s.round=C}function nm(s,o){let c=o.stack,d=c.pop(),f=c.pop(),m=o.z0[f],v=o.fv,T=o.pv,_=o.cvt[d],M=T.distance(m,Bs);s&&(Math.abs(M-_)<o.cvCutIn&&(M=_),M=o.round(M)),v.setRelative(m,Bs,M,T),o.zp0===0&&(m.xo=m.x,m.yo=m.y),v.touch(m),o.rp0=o.rp1=f}function Ly(s){let o=s.prog,c=s.ip,d=s.stack,f=o[++c];for(let m=0;m<f;m++)d.push(o[++c]);s.ip=c}function ky(s){let o=s.ip,c=s.prog,d=s.stack,f=c[++o];for(let m=0;m<f;m++){let v=c[++o]<<8|c[++o];v&32768&&(v=-((v^65535)+1)),d.push(v)}s.ip=o}function Iy(s){let o=s.stack,c=s.store;c||(c=s.store=[]);let d=o.pop(),f=o.pop();c[f]=d}function Ey(s){let o=s.stack,c=s.store,d=o.pop(),f=c&&c[d]||0;o.push(f)}function Ry(s){let o=s.stack,c=o.pop(),d=o.pop();s.cvt[d]=c/64}function Ny(s){let o=s.stack,c=o.pop();o.push(s.cvt[c]*64)}function sm(s,o){let c=o.stack,d=c.pop(),f=o.z2[d];c.push(o.dpv.distance(f,Bs,s,!1)*64)}function im(s,o){let c=o.stack,d=c.pop(),f=c.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 My(s){s.stack.push(s.ppem)}function Dy(s){s.autoFlip=!0}function By(s){let o=s.stack,c=o.pop(),d=o.pop();o.push(d<c?1:0)}function Qy(s){let o=s.stack,c=o.pop(),d=o.pop();o.push(d<=c?1:0)}function jy(s){let o=s.stack,c=o.pop(),d=o.pop();o.push(d>c?1:0)}function Py(s){let o=s.stack,c=o.pop(),d=o.pop();o.push(d>=c?1:0)}function Oy(s){let o=s.stack,c=o.pop(),d=o.pop();o.push(c===d?1:0)}function Fy(s){let o=s.stack,c=o.pop(),d=o.pop();o.push(c!==d?1:0)}function Uy(s){let o=s.stack,c=o.pop();o.push(Math.trunc(c)&1?1:0)}function $y(s){let o=s.stack,c=o.pop();o.push(Math.trunc(c)&1?0:1)}function zy(s){let o=s.stack.pop(),c;o||Ea(s,!0)}function Hy(s){}function Wy(s){let o=s.stack,c=o.pop(),d=o.pop();o.push(c&&d?1:0)}function Gy(s){let o=s.stack,c=o.pop(),d=o.pop();o.push(c||d?1:0)}function Vy(s){let o=s.stack,c=o.pop();o.push(c?0:1)}function zh(s,o){let c=o.stack,d=c.pop(),f=o.fv,m=o.pv,v=o.ppem,T=o.deltaBase+(s-1)*16,_=o.deltaShift,M=o.z0;for(let E=0;E<d;E++){let G=c.pop(),H=c.pop();if(T+((H&240)>>4)!==v)continue;let oe=(H&15)-8;oe>=0&&oe++;let J=M[G];f.setRelative(J,J,oe*_,m)}}function qy(s){let o=s.stack.pop();s.deltaBase=o}function Yy(s){let o=s.stack.pop();s.deltaShift=Math.pow(.5,o)}function Zy(s){let o=s.stack,c=o.pop(),d=o.pop();o.push(d+c)}function Ky(s){let o=s.stack,c=o.pop(),d=o.pop();o.push(d-c)}function Xy(s){let o=s.stack,c=o.pop(),d=o.pop();o.push(d*64/c)}function Jy(s){let o=s.stack,c=o.pop(),d=o.pop();o.push(d*c/64)}function e4(s){let o=s.stack,c=o.pop();o.push(Math.abs(c))}function t4(s){let o=s.stack,c=o.pop();o.push(-c)}function r4(s){let o=s.stack,c=o.pop();o.push(Math.floor(c/64)*64)}function n4(s){let o=s.stack,c=o.pop();o.push(Math.ceil(c/64)*64)}function Hu(s,o){let c=o.stack,d=c.pop();c.push(o.round(d/64)*64)}function s4(s){let o=s.stack,c=o.pop(),d=o.pop();s.cvt[d]=c*s.ppem/s.font.unitsPerEm}function Hh(s,o){let c=o.stack,d=c.pop(),f=o.ppem,m=o.deltaBase+(s-1)*16,v=o.deltaShift;for(let T=0;T<d;T++){let _=c.pop(),M=c.pop();if(m+((M&240)>>4)!==f)continue;let E=(M&15)-8;E>=0&&E++;let G=E*v;o.cvt[_]+=G}}function i4(s){let o=s.stack.pop();s.round=kt;let c;switch(o&192){case 0:c=.5;break;case 64:c=1;break;case 128:c=2;break;default:throw new Error("invalid SROUND value")}switch(s.srPeriod=c,o&48){case 0:s.srPhase=0;break;case 16:s.srPhase=.25*c;break;case 32:s.srPhase=.5*c;break;case 48:s.srPhase=.75*c;break;default:throw new Error("invalid SROUND value")}o&=15,o===0?s.srThreshold=0:s.srThreshold=(o/8-.5)*c}function a4(s){let o=s.stack.pop();s.round=kt;let c;switch(o&192){case 0:c=Math.sqrt(2)/2;break;case 64:c=Math.sqrt(2);break;case 128:c=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(s.srPeriod=c,o&48){case 0:s.srPhase=0;break;case 16:s.srPhase=.25*c;break;case 32:s.srPhase=.5*c;break;case 48:s.srPhase=.75*c;break;default:throw new Error("invalid S45ROUND value")}o&=15,o===0?s.srThreshold=0:s.srThreshold=(o/8-.5)*c}function o4(s){s.round=$u}function l4(s){s.round=ee}function c4(s){s.round=Ye}function u4(s){let o=s.stack.pop()}function am(s,o){let c=o.stack,d=c.pop(),f=c.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=gn(T,_)}function d4(s){let o=s.stack,c=o.pop(),d=0;c&1&&(d=35),c&32&&(d|=4096),o.push(d)}function h4(s){let o=s.stack,c=o.pop(),d=o.pop(),f=o.pop();o.push(d),o.push(c),o.push(f)}function f4(s){let o=s.stack,c=o.pop(),d=o.pop();o.push(Math.max(d,c))}function p4(s){let o=s.stack,c=o.pop(),d=o.pop();o.push(Math.min(d,c))}function m4(s){let o=s.stack.pop()}function g4(s){let o=s.stack.pop(),c=s.stack.pop();switch(o){case 1:s.inhibitGridFit=!!c;return;case 2:s.ignoreCvt=!!c;return;default:throw new Error("invalid INSTCTRL[] selector")}}function gl(s,o){let c=o.stack,d=o.prog,f=o.ip;for(let m=0;m<s;m++)c.push(d[++f]);o.ip=f}function xl(s,o){let c=o.ip,d=o.prog,f=o.stack;for(let m=0;m<s;m++){let v=d[++c]<<8|d[++c];v&32768&&(v=-((v^65535)+1)),f.push(v)}o.ip=c}function lr(s,o,c,d,f,m){let v=m.stack,T=s&&v.pop(),_=v.pop(),M=m.rp0,E=m.z0[M],G=m.z1[_],H=m.minDis,oe=m.fv,J=m.dpv,fe,Xe,gr,or;Xe=fe=J.distance(G,E,!0,!0),gr=Xe>=0?1:-1,Xe=Math.abs(Xe),s&&(or=m.cvt[T],d&&Math.abs(Xe-or)<m.cvCutIn&&(Xe=or)),c&&Xe<H&&(Xe=H),d&&(Xe=m.round(Xe)),oe.setRelative(G,E,gr*Xe,J),oe.touch(G),m.rp1=m.rp0,m.rp2=_,o&&(m.rp0=_)}Zo=[Yi.bind(void 0,mr),Yi.bind(void 0,Ot),ui.bind(void 0,mr),ui.bind(void 0,Ot),ha.bind(void 0,mr),ha.bind(void 0,Ot),zu.bind(void 0,0),zu.bind(void 0,1),Tc.bind(void 0,0),Tc.bind(void 0,1),q6,Y6,Z6,K6,X6,J6,ey,ty,ry,ny,sy,iy,ay,oy,ly,cy,uy,dy,hy,fy,void 0,void 0,py,$h,my,gy,xy,vy,wy,void 0,void 0,void 0,by,yy,Ay,void 0,K1.bind(void 0,0),K1.bind(void 0,1),X1.bind(void 0,mr),X1.bind(void 0,Ot),J1.bind(void 0,0),J1.bind(void 0,1),em.bind(void 0,0),em.bind(void 0,1),tm.bind(void 0,0),tm.bind(void 0,1),Ty,Cy,rm.bind(void 0,0),rm.bind(void 0,1),Sy,_y,nm.bind(void 0,0),nm.bind(void 0,1),Ly,ky,Iy,Ey,Ry,Ny,sm.bind(void 0,0),sm.bind(void 0,1),void 0,im.bind(void 0,0),im.bind(void 0,1),My,void 0,Dy,void 0,void 0,By,Qy,jy,Py,Oy,Fy,Uy,$y,zy,Hy,Wy,Gy,Vy,zh.bind(void 0,1),qy,Yy,Zy,Ky,Xy,Jy,e4,t4,r4,n4,Hu.bind(void 0,0),Hu.bind(void 0,1),Hu.bind(void 0,2),Hu.bind(void 0,3),void 0,void 0,void 0,void 0,s4,zh.bind(void 0,2),zh.bind(void 0,3),Hh.bind(void 0,1),Hh.bind(void 0,2),Hh.bind(void 0,3),i4,a4,void 0,void 0,o4,void 0,l4,c4,$h,$h,void 0,void 0,void 0,void 0,void 0,u4,am.bind(void 0,0),am.bind(void 0,1),d4,void 0,h4,f4,p4,m4,g4,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,gl.bind(void 0,1),gl.bind(void 0,2),gl.bind(void 0,3),gl.bind(void 0,4),gl.bind(void 0,5),gl.bind(void 0,6),gl.bind(void 0,7),gl.bind(void 0,8),xl.bind(void 0,1),xl.bind(void 0,2),xl.bind(void 0,3),xl.bind(void 0,4),xl.bind(void 0,5),xl.bind(void 0,6),xl.bind(void 0,7),xl.bind(void 0,8),lr.bind(void 0,0,0,0,0,0),lr.bind(void 0,0,0,0,0,1),lr.bind(void 0,0,0,0,0,2),lr.bind(void 0,0,0,0,0,3),lr.bind(void 0,0,0,0,1,0),lr.bind(void 0,0,0,0,1,1),lr.bind(void 0,0,0,0,1,2),lr.bind(void 0,0,0,0,1,3),lr.bind(void 0,0,0,1,0,0),lr.bind(void 0,0,0,1,0,1),lr.bind(void 0,0,0,1,0,2),lr.bind(void 0,0,0,1,0,3),lr.bind(void 0,0,0,1,1,0),lr.bind(void 0,0,0,1,1,1),lr.bind(void 0,0,0,1,1,2),lr.bind(void 0,0,0,1,1,3),lr.bind(void 0,0,1,0,0,0),lr.bind(void 0,0,1,0,0,1),lr.bind(void 0,0,1,0,0,2),lr.bind(void 0,0,1,0,0,3),lr.bind(void 0,0,1,0,1,0),lr.bind(void 0,0,1,0,1,1),lr.bind(void 0,0,1,0,1,2),lr.bind(void 0,0,1,0,1,3),lr.bind(void 0,0,1,1,0,0),lr.bind(void 0,0,1,1,0,1),lr.bind(void 0,0,1,1,0,2),lr.bind(void 0,0,1,1,0,3),lr.bind(void 0,0,1,1,1,0),lr.bind(void 0,0,1,1,1,1),lr.bind(void 0,0,1,1,1,2),lr.bind(void 0,0,1,1,1,3),lr.bind(void 0,1,0,0,0,0),lr.bind(void 0,1,0,0,0,1),lr.bind(void 0,1,0,0,0,2),lr.bind(void 0,1,0,0,0,3),lr.bind(void 0,1,0,0,1,0),lr.bind(void 0,1,0,0,1,1),lr.bind(void 0,1,0,0,1,2),lr.bind(void 0,1,0,0,1,3),lr.bind(void 0,1,0,1,0,0),lr.bind(void 0,1,0,1,0,1),lr.bind(void 0,1,0,1,0,2),lr.bind(void 0,1,0,1,0,3),lr.bind(void 0,1,0,1,1,0),lr.bind(void 0,1,0,1,1,1),lr.bind(void 0,1,0,1,1,2),lr.bind(void 0,1,0,1,1,3),lr.bind(void 0,1,1,0,0,0),lr.bind(void 0,1,1,0,0,1),lr.bind(void 0,1,1,0,0,2),lr.bind(void 0,1,1,0,0,3),lr.bind(void 0,1,1,0,1,0),lr.bind(void 0,1,1,0,1,1),lr.bind(void 0,1,1,0,1,2),lr.bind(void 0,1,1,0,1,3),lr.bind(void 0,1,1,1,0,0),lr.bind(void 0,1,1,1,0,1),lr.bind(void 0,1,1,1,0,2),lr.bind(void 0,1,1,1,0,3),lr.bind(void 0,1,1,1,1,0),lr.bind(void 0,1,1,1,1,1),lr.bind(void 0,1,1,1,1,2),lr.bind(void 0,1,1,1,1,3)];var x4=Uu;function Cc(s){this.char=s,this.state={},this.activeState=null}function Wh(s,o,c){this.contextName=c,this.startIndex=s,this.endOffset=o}function b4(s,o,c){this.contextName=s,this.openRange=null,this.ranges=[],this.checkStart=o,this.checkEnd=c}function Ri(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 Wu(s){this.eventId=s,this.subscribers=[]}function y4(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 Wu(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 c=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];for(let d=0;d<c.length;d++){let f=c[d];this.events[f].subscribe(this.updateContextsRanges)}}function Ts(s){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],y4.call(this,s)}Cc.prototype.setState=function(s,o){return this.state[s]=o,this.activeState={key:s,value:this.state[s]},this.activeState},Cc.prototype.getState=function(s){return this.state[s]||null},Ts.prototype.inboundIndex=function(s){return s>=0&&s<this.tokens.length},Ts.prototype.composeRUD=function(s){let o=s.map(d=>this[d[0]].apply(this,d.slice(1).concat(!0))),c=d=>typeof d=="object"&&Object.prototype.hasOwnProperty.call(d,"FAIL");if(o.every(c))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:o.filter(c)};this.dispatch("composeRUD",[o.filter(d=>!c(d))])},Ts.prototype.replaceRange=function(s,o,c,d){o=o!==null?o:this.tokens.length;let f=c.every(m=>m instanceof Cc);if(!isNaN(s)&&this.inboundIndex(s)&&f){let m=this.tokens.splice.apply(this.tokens,[s,o].concat(c));return d||this.dispatch("replaceToken",[s,o,c]),[m,c]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},Ts.prototype.replaceToken=function(s,o,c){if(!isNaN(s)&&this.inboundIndex(s)&&o instanceof Cc){let d=this.tokens.splice(s,1,o);return c||this.dispatch("replaceToken",[s,o]),[d[0],o]}else return{FAIL:"replaceToken: invalid token or index."}},Ts.prototype.removeRange=function(s,o,c){o=isNaN(o)?this.tokens.length:o;let d=this.tokens.splice(s,o);return c||this.dispatch("removeRange",[d,s,o]),d},Ts.prototype.removeToken=function(s,o){if(!isNaN(s)&&this.inboundIndex(s)){let c=this.tokens.splice(s,1);return o||this.dispatch("removeToken",[c,s]),c}else return{FAIL:"removeToken: invalid token index."}},Ts.prototype.insertToken=function(s,o,c){return s.every(d=>d instanceof Cc)?(this.tokens.splice.apply(this.tokens,[o,0].concat(s)),c||this.dispatch("insertToken",[s,o]),s):{FAIL:"insertToken: invalid token(s)."}},Ts.prototype.registerModifier=function(s,o,c){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 _=c.apply(this,T);d.setState(s,_)}}),this.registeredModifiers.push(s)},Wu.prototype.subscribe=function(s){return typeof s=="function"?this.subscribers.push(s)-1:{FAIL:`invalid '${this.eventId}' event handler`}},Wu.prototype.unsubscribe=function(s){this.subscribers.splice(s,1)},Ri.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)},Ri.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}},Ts.prototype.rangeToText=function(s){if(s instanceof Wh)return this.getRangeTokens(s).map(o=>o.char).join("")},Ts.prototype.getText=function(){return this.tokens.map(s=>s.char).join("")},Ts.prototype.getContext=function(s){return this.registeredContexts[s]||null},Ts.prototype.on=function(s,o){let c=this.events[s];return c?c.subscribe(o):null},Ts.prototype.dispatch=function(s,o){let c=this.events[s];if(c instanceof Wu)for(let d=0;d<c.subscribers.length;d++)c.subscribers[d].apply(this,o||[])},Ts.prototype.registerContextChecker=function(s,o,c){if(this.getContext(s))return{FAIL:`context name '${s}' is already registered.`};if(typeof o!="function")return{FAIL:"missing context start check."};if(typeof c!="function")return{FAIL:"missing context end check."};let d=new b4(s,o,c);return this.registeredContexts[s]=d,this.contextCheckers.push(d),d},Ts.prototype.getRangeTokens=function(s){let o=s.startIndex+s.endOffset;return[].concat(this.tokens.slice(s.startIndex,o))},Ts.prototype.getContextRanges=function(s){let o=this.getContext(s);return o?o.ranges:{FAIL:`context checker '${s}' is not registered.`}},Ts.prototype.resetContextsRanges=function(){let s=this.registeredContexts;for(let o in s)if(Object.prototype.hasOwnProperty.call(s,o)){let c=s[o];c.ranges=[]}},Ts.prototype.updateContextsRanges=function(){this.resetContextsRanges();let s=this.tokens.map(o=>o.char);for(let o=0;o<s.length;o++){let c=new Ri(s,o);this.runContextCheck(c)}this.dispatch("updateContextsRanges",[this.registeredContexts])},Ts.prototype.setEndOffset=function(s,o){let c=this.getContext(o).openRange.startIndex,d=new Wh(c,s,o),f=this.getContext(o).ranges;return d.rangeId=`${o}.${f.length}`,f.push(d),this.getContext(o).openRange=null,d},Ts.prototype.runContextCheck=function(s){let o=s.index;for(let c=0;c<this.contextCheckers.length;c++){let d=this.contextCheckers[c],f=d.contextName,m=this.getContext(f).openRange;if(!m&&d.checkStart(s)&&(m=new Wh(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])}}},Ts.prototype.tokenize=function(s){this.tokens=[],this.resetContextsRanges();let o=Array.from(s);this.dispatch("start");for(let c=0;c<o.length;c++){let d=o[c],f=new Ri(o,c);this.dispatch("next",[f]),this.runContextCheck(f);let m=new Cc(d);this.tokens.push(m),this.dispatch("newToken",[m,f])}return this.dispatch("end",[this.tokens]),this.tokens};var v4=Ts;function bl(s){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(s)}function om(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 yl(s){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(s)}function Gu(s){return/[\u0E00-\u0E7F]/.test(s)}function Vu(s){return/[A-z]/.test(s)}function w4(s){return/\s/.test(s)}function fa(s){this.font=s,this.features={}}function vl(s){this.id=s.id,this.tag=s.tag,this.substitution=s.substitution}function wl(s,o){if(!s)return-1;switch(o.format){case 1:return o.glyphs.indexOf(s);case 2:{let c=o.ranges;for(let d=0;d<c.length;d++){let f=c[d];if(s>=f.start&&s<=f.end){let m=s-f.start;return f.index+m}}break}default:return-1}return-1}function A4(s,o){return wl(s,o.coverage)===-1?null:s+o.deltaGlyphId}function T4(s,o){let c=wl(s,o.coverage);return c===-1?null:o.substitute[c]}function Gh(s,o){let c=[];for(let d=0;d<s.length;d++){let f=s[d],m=o.current;m=Array.isArray(m)?m[0]:m;let v=wl(m,f);v!==-1&&c.push(v)}return c.length!==s.length?-1:c}function C4(s,o){let c=o.inputCoverage.length+o.lookaheadCoverage.length+o.backtrackCoverage.length;if(s.context.length<c)return[];let d=Gh(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&&yl(m[0].char);)m.shift();let v=new Ri(m,0),T=Gh(o.lookaheadCoverage,v),_=[].concat(s.backtrack);for(_.reverse();_.length&&yl(_[0].char);)_.shift();if(_.length<o.backtrackCoverage.length)return[];let M=new Ri(_,0),E=Gh(o.backtrackCoverage,M),G=d.length===o.inputCoverage.length&&T.length===o.lookaheadCoverage.length&&E.length===o.backtrackCoverage.length,H=[];if(G)for(let oe=0;oe<o.lookupRecords.length;oe++){let J=o.lookupRecords[oe],fe=J.lookupListIndex,Xe=this.getLookupByIndex(fe);for(let gr=0;gr<Xe.subtables.length;gr++){let or=Xe.subtables[gr],Ir,Kr=this.getSubstitutionType(Xe,or);if(Kr==="71"?(Kr=this.getSubstitutionType(or,or.extension),Ir=this.getLookupMethod(or,or.extension),or=or.extension):Ir=this.getLookupMethod(Xe,or),Kr==="12"){let Dn=s.get(J.sequenceIndex),qn=Ir(Dn);qn&&H.push(qn)}else if(Kr==="21"){let Dn=s.get(J.sequenceIndex),qn=Ir(Dn);qn&&H.push(qn)}else throw new Error(`Substitution type ${Kr} is not supported in chaining substitution`)}}return H}function S4(s,o){let c=s.current,d=wl(c,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],M=f.components[T];if(_!==M)break;if(T===f.components.length-1)return f}}return null}function _4(s,o){let c=s.current;if(wl(c,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(c);for(let _=0;_<f.input.length;_++)v.push(f.input[_]);let T=(_,M)=>{let{lookupListIndex:E,sequenceIndex:G}=M,{subtables:H}=this.getLookupByIndex(E);for(let oe of H)wl(_[G],oe.coverage)!==-1&&(_[G]=oe.deltaGlyphId)};for(let _=0;_<f.lookupRecords.length;_++){let M=f.lookupRecords[_];T(v,M)}return v}}return null}function L4(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,wl(f,o.coverages[d])===-1)return[]}let c=[];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],M,E=this.getSubstitutionType(v,_);if(E==="71"?(E=this.getSubstitutionType(_,_.extension),M=this.getLookupMethod(_,_.extension),_=_.extension):M=this.getLookupMethod(v,_),E==="12"){let G=s.get(f.sequenceIndex),H=M(G);H&&c.push(H)}else if(E==="21"){let G=s.get(f.sequenceIndex),H=M(G);H&&c.push(H)}}}return c}function k4(s,o){let c=wl(s,o.coverage);return c===-1?null:o.sequences[c]}fa.prototype.getDefaultScriptFeaturesIndexes=function(){let s=this.font.tables.gsub.scripts;for(let o=0;o<s.length;o++){let c=s[o];if(c.tag==="DFLT")return c.script.defaultLangSys.featureIndexes}return[]},fa.prototype.getScriptFeaturesIndexes=function(s){if(!this.font.tables.gsub)return[];if(!s)return this.getDefaultScriptFeaturesIndexes();let o=this.font.tables.gsub.scripts;for(let c=0;c<o.length;c++){let d=o[c];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()},fa.prototype.mapTagsToFeatures=function(s,o){let c={};for(let d=0;d<s.length;d++){let f=s[d].tag,m=s[d].feature;c[f]=m}this.features[o].tags=c},fa.prototype.getScriptFeatures=function(s){let o=this.features[s];if(Object.prototype.hasOwnProperty.call(this.features,s))return o;let c=this.getScriptFeaturesIndexes(s);if(!c)return null;let d=this.font.tables.gsub;return o=c.map(f=>d.features[f]),this.features[s]=o,this.mapTagsToFeatures(o,s),o},fa.prototype.getSubstitutionType=function(s,o){let c=s.lookupType.toString(),d=o.substFormat.toString();return c+d},fa.prototype.getLookupMethod=function(s,o){let c=this.getSubstitutionType(s,o);switch(c){case"11":return d=>A4.apply(this,[d,o]);case"12":return d=>T4.apply(this,[d,o]);case"63":return d=>C4.apply(this,[d,o]);case"41":return d=>S4.apply(this,[d,o]);case"21":return d=>k4.apply(this,[d,o]);case"51":return d=>_4.apply(this,[d,o]);case"53":return d=>L4.apply(this,[d,o]);default:throw new Error(`substitutionType : ${c} lookupType: ${s.lookupType} - substFormat: ${o.substFormat} is not yet supported`)}},fa.prototype.lookupFeature=function(s){let o=s.contextParams,c=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 M=0;M<_.length;M++){let E=_[M],G=this.getSubstitutionType(T,E),H;G==="71"?(G=this.getSubstitutionType(E,E.extension),H=this.getLookupMethod(E,E.extension),E=E.extension):H=this.getLookupMethod(T,E);let oe;switch(G){case"11":oe=H(o.current),oe&&m.splice(c,1,new vl({id:11,tag:s.tag,substitution:oe}));break;case"12":oe=H(o.current),oe&&m.splice(c,1,new vl({id:12,tag:s.tag,substitution:oe}));break;case"63":oe=H(o),Array.isArray(oe)&&oe.length&&m.splice(c,1,new vl({id:63,tag:s.tag,substitution:oe}));break;case"41":oe=H(o),oe&&m.splice(c,1,new vl({id:41,tag:s.tag,substitution:oe}));break;case"21":oe=H(o.current),oe&&m.splice(c,1,new vl({id:21,tag:s.tag,substitution:oe}));break;case"51":case"53":oe=H(o),Array.isArray(oe)&&oe.length&&m.splice(c,1,new vl({id:parseInt(G),tag:s.tag,substitution:oe}));break}o=new Ri(m,c),!(Array.isArray(oe)&&!oe.length)&&(oe=null)}}return m.length?m:null},fa.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 c=this.features[s.script].some(d=>d.tag===s.tag);return o&&c},fa.prototype.getLookupSubtables=function(s){return s.subtables||null},fa.prototype.getLookupByIndex=function(s){return this.font.tables.gsub.lookups[s]||null},fa.prototype.getFeatureLookups=function(s){return s.lookupListIndexes.map(this.getLookupByIndex.bind(this))},fa.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 I4=fa;function E4(s){let o=s.current,c=s.get(-1);return c===null&&bl(o)||!bl(c)&&bl(o)}function R4(s){let o=s.get(1);return o===null||!bl(o)}var N4={startCheck:E4,endCheck:R4};function M4(s){let o=s.current,c=s.get(-1);return(bl(o)||yl(o))&&!bl(c)}function D4(s){let o=s.get(1);switch(!0){case o===null:return!0;case(!bl(o)&&!yl(o)):{let c=w4(o);if(!c)return!0;if(c){let d=!1;if(d=s.lookahead.some(f=>bl(f)||yl(f)),!d)return!0}break}default:return!1}}var B4={startCheck:M4,endCheck:D4};function Q4(s,o,c){o[c].setState(s.tag,s.substitution)}function j4(s,o,c){o[c].setState(s.tag,s.substitution)}function Vh(s,o,c){for(let d=0;d<s.substitution.length;d++){let f=s.substitution[d],m=o[c+d];if(Array.isArray(f)){f.length?m.setState(s.tag,f[0]):m.setState("deleted",!0);continue}m.setState(s.tag,f)}}function P4(s,o,c){let d=o[c];d.setState(s.tag,s.substitution.ligGlyph);let f=s.substitution.components.length;for(let m=0;m<f;m++)d=o[c+m+1],d.setState("deleted",!0)}var lm={11:Q4,12:j4,63:Vh,41:P4,51:Vh,53:Vh};function O4(s,o,c){s instanceof vl&&lm[s.id]&&lm[s.id](s,o,c)}var Fl=O4;function F4(s){let o=[].concat(s.backtrack);for(let c=o.length-1;c>=0;c--){let d=o[c],f=om(d),m=yl(d);if(!f&&!m)return!0;if(f)return!1}return!1}function U4(s){if(om(s.current))return!1;for(let o=0;o<s.lookahead.length;o++){let c=s.lookahead[o];if(!yl(c))return!0}return!1}function $4(s){let o="arab",c=this.featuresTags[o],d=this.tokenizer.getRangeTokens(s);if(d.length===1)return;let f=new Ri(d.map(v=>v.getState("glyphIndex")),0),m=new Ri(d.map(v=>v.char),0);for(let v=0;v<d.length;v++){let T=d[v];if(yl(T.char))continue;f.setCurrentIndex(v),m.setCurrentIndex(v);let _=0;F4(m)&&(_|=1),U4(m)&&(_|=2);let M;switch(_){case 1:M="fina";break;case 2:M="init";break;case 3:M="medi";break}if(c.indexOf(M)===-1)continue;let E=this.query.lookupFeature({tag:M,script:o,contextParams:f});if(E instanceof Error){console.info(E.message);continue}for(let G=0;G<E.length;G++){let H=E[G];H instanceof vl&&(Fl(H,d,G),f.context[G]=H.substitution)}}}var z4=$4;function cm(s,o){let c=s.map(d=>d.activeState.value);return new Ri(c,o||0)}function H4(s){let o="arab",c=this.tokenizer.getRangeTokens(s),d=cm(c);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];Fl(T,c,f)}d=cm(c)}}}var W4=H4;function G4(s){return s.index===0&&s.context.length>1}function V4(s){return s.index===s.context.length-1}var q4={startCheck:G4,endCheck:V4};function um(s,o){let c=s.map(d=>d.activeState.value);return new Ri(c,o||0)}function Y4(s){let o="delf",c="ccmp",d=this.tokenizer.getRangeTokens(s),f=um(d);for(let m=0;m<f.context.length;m++){if(!this.query.getFeature({tag:c,script:o,contextParams:f}))continue;f.setCurrentIndex(m);let v=this.query.lookupFeature({tag:c,script:o,contextParams:f});if(v.length){for(let T=0;T<v.length;T++){let _=v[T];Fl(_,d,m)}f=um(d)}}}var Z4=Y4;function K4(s){let o=s.current,c=s.get(-1);return c===null&&Vu(o)||!Vu(c)&&Vu(o)}function X4(s){let o=s.get(1);return o===null||!Vu(o)}var J4={startCheck:K4,endCheck:X4};function dm(s,o){let c=s.map(d=>d.activeState.value);return new Ri(c,o||0)}function ev(s){let o="latn",c=this.tokenizer.getRangeTokens(s),d=dm(c);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];Fl(T,c,f)}d=dm(c)}}}var tv=ev;function rv(s){let o=s.current,c=s.get(-1);return c===null&&Gu(o)||!Gu(c)&&Gu(o)}function nv(s){let o=s.get(1);return o===null||!Gu(o)}var sv={startCheck:rv,endCheck:nv};function hm(s,o){let c=s.map(d=>d.activeState.value);return new Ri(c,o||0)}function iv(s){let o="thai",c=this.tokenizer.getRangeTokens(s),d=hm(c,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];Fl(T,c,f)}d=hm(c,f)}}}var av=iv;function fm(s,o){let c=s.map(d=>d.activeState.value);return new Ri(c,o||0)}function ov(s){let o="thai",c=this.tokenizer.getRangeTokens(s),d=fm(c,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];Fl(T,c,f)}d=fm(c,f)}}}var lv=ov;function pm(s,o){let c=s.map(d=>d.activeState.value);return new Ri(c,o||0)}function cv(s){let o="thai",c=this.tokenizer.getRangeTokens(s),d=pm(c,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];Fl(T,c,f)}d=pm(c,f)}}}var uv=cv;function qh(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 dv(s){let o=s.current,c=s.get(1);return c===null&&qh(o)||qh(c)}function hv(s){let o=s.get(1);return o===null||!qh(o)}var fv={startCheck:dv,endCheck:hv};function pv(s){let o=this.query.font,c=this.tokenizer.getRangeTokens(s);if(c[1].setState("deleted",!0),o.tables.cmap&&o.tables.cmap.varSelectorList){let d=c[0].char.codePointAt(0),f=c[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&&c[0].setState("glyphIndex",T)}}}}var mv=pv;function Ra(s){this.baseDir=s||"ltr",this.tokenizer=new v4,this.featuresTags={}}Ra.prototype.setText=function(s){this.text=s},Ra.prototype.contextChecks={ccmpReplacementCheck:q4,latinWordCheck:J4,arabicWordCheck:N4,arabicSentenceCheck:B4,thaiWordCheck:sv,unicodeVariationSequenceCheck:fv};function Sc(s){let o=this.contextChecks[`${s}Check`];return this.tokenizer.registerContextChecker(s,o.startCheck,o.endCheck)}function gv(){return Sc.call(this,"ccmpReplacement"),Sc.call(this,"latinWord"),Sc.call(this,"arabicWord"),Sc.call(this,"arabicSentence"),Sc.call(this,"thaiWord"),Sc.call(this,"unicodeVariationSequence"),this.tokenizer.tokenize(this.text)}function xv(){let s=this.tokenizer.getContextRanges("arabicSentence");for(let o=0;o<s.length;o++){let c=s[o],d=this.tokenizer.getRangeTokens(c);this.tokenizer.replaceRange(c.startIndex,c.endOffset,d.reverse())}}Ra.prototype.registerFeatures=function(s,o){let c=o.filter(d=>this.query.supports({script:s,tag:d}));Object.prototype.hasOwnProperty.call(this.featuresTags,s)?this.featuresTags[s]=this.featuresTags[s].concat(c):this.featuresTags[s]=c},Ra.prototype.applyFeatures=function(s,o){if(!s)throw new Error("No valid font was provided to apply features");this.query||(this.query=new I4(s));for(let c=0;c<o.length;c++){let d=o[c];this.query.supports({script:d.script})&&this.registerFeatures(d.script,d.tags)}},Ra.prototype.registerModifier=function(s,o,c){this.tokenizer.registerModifier(s,o,c)};function m0(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function bv(){if(!Object.prototype.hasOwnProperty.call(this.featuresTags,"arab"))return;m0.call(this);let s=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<s.length;o++){let c=s[o];z4.call(this,c)}}function yv(){m0.call(this);let s=this.tokenizer.getContextRanges("ccmpReplacement");for(let o=0;o<s.length;o++){let c=s[o];Z4.call(this,c)}}function vv(){if(!this.hasFeatureEnabled("arab","rlig"))return;m0.call(this);let s=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<s.length;o++){let c=s[o];W4.call(this,c)}}function wv(){if(!this.hasFeatureEnabled("latn","liga"))return;m0.call(this);let s=this.tokenizer.getContextRanges("latinWord");for(let o=0;o<s.length;o++){let c=s[o];tv.call(this,c)}}function Av(){let s=this.tokenizer.getContextRanges("unicodeVariationSequence");for(let o=0;o<s.length;o++){let c=s[o];mv.call(this,c)}}function Tv(){m0.call(this);let s=this.tokenizer.getContextRanges("thaiWord");for(let o=0;o<s.length;o++){let c=s[o];this.hasFeatureEnabled("thai","liga")&&lv.call(this,c),this.hasFeatureEnabled("thai","rlig")&&uv.call(this,c),this.hasFeatureEnabled("thai","ccmp")&&av.call(this,c)}}Ra.prototype.checkContextReady=function(s){return!!this.tokenizer.getContext(s)},Ra.prototype.applyFeaturesToContexts=function(){this.checkContextReady("ccmpReplacement")&&yv.call(this),this.checkContextReady("arabicWord")&&(bv.call(this),vv.call(this)),this.checkContextReady("latinWord")&&wv.call(this),this.checkContextReady("arabicSentence")&&xv.call(this),this.checkContextReady("thaiWord")&&Tv.call(this),this.checkContextReady("unicodeVariationSequence")&&Av.call(this)},Ra.prototype.hasFeatureEnabled=function(s,o){return(this.featuresTags[s]||[]).indexOf(o)!==-1},Ra.prototype.processText=function(s){(!this.text||this.text!==s)&&(this.setText(s),gv.call(this),this.applyFeaturesToContexts())},Ra.prototype.getBidiText=function(s){return this.processText(s),this.tokenizer.getText()},Ra.prototype.getTextGlyphs=function(s){this.processText(s);let o=[];for(let c=0;c<this.tokenizer.tokens.length;c++){let d=this.tokenizer.tokens[c];if(d.state.deleted)continue;let f=d.activeState.value;o.push(Array.isArray(f)?f[0]:f)}return o};var Cv=Ra;function Yh(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=Yh(s),this.names.macintosh=Yh(s),this.names.windows=Yh(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 Sr.GlyphSet(this,s.glyphs||[]),this.encoding=new Rn(this),this.position=new ca(this),this.substitution=new Qh(this),this.tables=this.tables||{},this.tables=new Proxy(this.tables,{set:(o,c,d)=>(o[c]=d,o.fvar&&(o.gvar||o.cff2)&&!this.variation&&(this.variation=new da(this)),!0)}),this.palettes=new Du(this),this.layers=new jh(this),this.svgImages=new Ph(this),this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:this.outlinesFormat==="truetype"?this._hinting=new x4(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),c=this.glyphs.get(o);return c||(c=this.glyphs.get(0)),c},Fn.prototype.updateFeatures=function(s){return this.defaultRenderOptions.features.map(o=>o.script==="latn"?{script:"latn",tags:o.tags.filter(c=>s[c])}:o)},Fn.prototype.stringToGlyphIndexes=function(s,o){let c=new Cv,d=m=>this.charToGlyphIndex(m.char);c.registerModifier("glyphIndex",null,d);let f=o?this.updateFeatures(o.features):this.defaultRenderOptions.features;return c.applyFeatures(this,f),c.getTextGlyphs(s)},Fn.prototype.stringToGlyphs=function(s,o){let c=this.stringToGlyphIndexes(s,o),d=c.length,f=new Array(d),m=this.glyphs.get(0);for(let v=0;v<d;v+=1)f[v]=this.glyphs.get(c[v])||m;return f},Fn.prototype.nameToGlyphIndex=function(s){return this.glyphNames.nameToGlyphIndex(s)},Fn.prototype.nameToGlyph=function(s){let o=this.nameToGlyphIndex(s),c=this.glyphs.get(o);return c||(c=this.glyphs.get(0)),c},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 c=this.position.defaultKerningTables;return c?this.position.getKerningValue(c,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,c,d,f,m){o=o!==void 0?o:0,c=c!==void 0?c: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 M=f.script||this.position.getDefaultScriptName();_=this.position.getKerningTables(M,f.language)}for(let M=0;M<T.length;M+=1){let E=T[M];if(m.call(this,E,o,c,d,f),E.advanceWidth&&(o+=E.advanceWidth*v),f.kerning&&M<T.length-1){let G=_?this.position.getKerningValue(_,E.index,T[M+1].index):this.getKerningValue(E,T[M+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,c,d,f){f=Object.assign({},this.defaultRenderOptions,f);let m=new Oe;if(m._layers=[],zn(this,m,d),m.stroke){let v=1/(m.unitsPerEm||1e3)*d;m.strokeWidth*=v}return this.forEachGlyph(s,o,c,d,f,(v,T,_,M)=>{let E=v.getPath(T,_,M,f,this);if(f.drawSVG||f.drawLayers){let G=E._layers;if(G&&G.length){for(let H=0;H<G.length;H++){let oe=G[H];m._layers.push(oe)}return}}m.extend(E)}),m},Fn.prototype.getPaths=function(s,o,c,d,f){f=Object.assign({},this.defaultRenderOptions,f);let m=[];return this.forEachGlyph(s,o,c,d,f,function(v,T,_,M){let E=v.getPath(T,_,M,f,this);m.push(E)}),m},Fn.prototype.getAdvanceWidth=function(s,o,c){return c=Object.assign({},this.defaultRenderOptions,c),this.forEachGlyph(s,0,0,o,c,function(){})},Fn.prototype.draw=function(s,o,c,d,f,m){this.getPath(o,c,d,f,m).draw(s)},Fn.prototype.drawPoints=function(s,o,c,d,f,m){m=Object.assign({},this.defaultRenderOptions,m),this.forEachGlyph(o,c,d,f,m,function(v,T,_,M){v.drawPoints(s,T,_,M,m,this)})},Fn.prototype.drawMetrics=function(s,o,c,d,f,m){m=Object.assign({},this.defaultRenderOptions,m),this.forEachGlyph(o,c,d,f,m,function(v,T,_,M){v.drawMetrics(s,T,_,M)})},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 c(f,m){f||(console.warn(`[opentype.js] ${m}`),s.push(m))}function d(f){let m=o.getEnglishName(f);c(m&&m.trim().length>0,"No English "+f+" specified.")}if(d("fontFamily"),d("weightName"),d("manufacturer"),d("copyright"),d("version"),c(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(c(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),c=new Uint8Array(o);for(let d=0;d<s.length;d++)c[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 mm=Fn;function Sv(s,o){let c=new ft.Parser(s,o),d=c.parseUShort(),f=c.parseUShort();d!==1&&console.warn(`Unsupported hvar table version ${d}.${f}`);let m=[d,f],v=c.parsePointer32(function(){return this.parseItemVariationStore()}),T=c.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),_=c.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),M=c.parsePointer32(function(){return this.parseDeltaSetIndexMap()});return{version:m,itemVariationStore:v,advanceWidth:T,lsb:_,rsb:M}}function _v(){console.warn("Writing of hvar tables is not yet supported.")}var Lv={make:_v,parse:Sv},kv=function(){return{coverage:this.parsePointer(ie.coverage),attachPoints:this.parseList(ie.pointer(ie.uShortList))}},Iv=function(){var s=this.parseUShort();if(X.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()}},Ev=function(){return this.parseList(ie.pointer(Iv))},Rv=function(){return{coverage:this.parsePointer(ie.coverage),ligGlyphs:this.parseList(ie.pointer(Ev))}},Nv=function(){return this.parseUShort(),this.parseList(ie.pointer(ie.coverage))};function Mv(s,o){o=o||0;let c=new ie(s,o),d=c.parseVersion(1);X.argument(d===1||d===1.2||d===1.3,"Unsupported GDEF table version.");var f={version:d,classDef:c.parsePointer(ie.classDef),attachList:c.parsePointer(kv),ligCaretList:c.parsePointer(Rv),markAttachClassDef:c.parsePointer(ie.classDef)};return d>=1.2&&(f.markGlyphSets=c.parsePointer(Nv)),f}var Dv={parse:Mv},so=new Array(10);so[1]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{posFormat:1,coverage:this.parsePointer(ie.coverage),value:this.parseValueRecord()};if(o===2)return{posFormat:2,coverage:this.parsePointer(ie.coverage),values:this.parseValueRecordList()};X.assert(!1,"0x"+s.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},so[2]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();X.assert(o===1||o===2,"0x"+s.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");let c=this.parsePointer(ie.coverage),d=this.parseUShort(),f=this.parseUShort();if(o===1)return{posFormat:o,coverage:c,valueFormat1:d,valueFormat2:f,pairSets:this.parseList(ie.pointer(ie.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(d),value2:this.parseValueRecord(f)}})))};if(o===2){let m=this.parsePointer(ie.classDef),v=this.parsePointer(ie.classDef),T=this.parseUShort(),_=this.parseUShort();return{posFormat:o,coverage:c,valueFormat1:d,valueFormat2:f,classDef1:m,classDef2:v,class1Count:T,class2Count:_,classRecords:this.parseList(T,ie.list(_,function(){return{value1:this.parseValueRecord(d),value2:this.parseValueRecord(f)}}))}}},so[3]=function(){return{error:"GPOS Lookup 3 not supported"}},so[4]=function(){return{error:"GPOS Lookup 4 not supported"}},so[5]=function(){return{error:"GPOS Lookup 5 not supported"}},so[6]=function(){return{error:"GPOS Lookup 6 not supported"}},so[7]=function(){return{error:"GPOS Lookup 7 not supported"}},so[8]=function(){return{error:"GPOS Lookup 8 not supported"}},so[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function Bv(s,o){o=o||0;let c=new ie(s,o),d=c.parseVersion(1);return X.argument(d===1||d===1.1,"Unsupported GPOS table version "+d),d===1?{version:d,scripts:c.parseScriptList(),features:c.parseFeatureList(),lookups:c.parseLookupList(so)}:{version:d,scripts:c.parseScriptList(),features:c.parseFeatureList(),lookups:c.parseLookupList(so),variations:c.parseFeatureVariationsList()}}var Qv=new Array(10);function jv(s){return new Se.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Se.ScriptList(s.scripts)},{name:"features",type:"TABLE",value:new Se.FeatureList(s.features)},{name:"lookups",type:"TABLE",value:new Se.LookupList(s.lookups,Qv)}])}var Pv={parse:Bv,make:jv};function Ov(s){let o={};s.skip("uShort");let c=s.parseUShort();X.argument(c===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 Fv(s){let o={};s.skip("uShort"),s.parseULong()>1&&console.warn("Only the first kern subtable is supported."),s.skip("uLong");let c=s.parseUShort()&255;if(s.skip("uShort"),c===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 Uv(s,o){let c=new ft.Parser(s,o),d=c.parseUShort();if(d===0)return Ov(c);if(d===1)return Fv(c);throw new Error("Unsupported kern table version ("+d+").")}var $v={parse:Uv};function zv(s,o,c,d){let f=new ft.Parser(s,o),m=d?f.parseUShort:f.parseULong,v=[];for(let T=0;T<c+1;T+=1){let _=m.call(f);d&&(_*=2),v.push(_)}return v}var Hv={parse:zv};function gm(s,o){let c=[],d=12;for(let f=0;f<o;f+=1){let m=ft.getTag(s,d),v=ft.getULong(s,d+4),T=ft.getULong(s,d+8),_=ft.getULong(s,d+12);c.push({tag:m,checksum:v,offset:T,length:_,compression:!1}),d+=16}return c}function Wv(s,o){let c=[],d=44;for(let f=0;f<o;f+=1){let m=ft.getTag(s,d),v=ft.getULong(s,d+4),T=ft.getULong(s,d+8),_=ft.getULong(s,d+12),M;T<_?M="WOFF":M=!1,c.push({tag:m,offset:v,compression:M,compressedLength:T,length:_}),d+=20}return c}function kn(s,o){if(o.compression==="WOFF"){let c=new Uint8Array(s.buffer,o.offset+2,o.compressedLength-2),d=new Uint8Array(o.length);if(de(c,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 Gv(s,o={}){let c,d,f=new mm({empty:!0});s.constructor!==ArrayBuffer&&(s=new Uint8Array(s).buffer);let m=new DataView(s,0),v,T=[],_=ft.getTag(m,0);if(_==="\0\0\0"||_==="true"||_==="typ1")f.outlinesFormat="truetype",v=ft.getUShort(m,4),T=gm(m,v);else if(_==="OTTO")f.outlinesFormat="cff",v=ft.getUShort(m,4),T=gm(m,v);else if(_==="wOFF"){let xr=ft.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=ft.getUShort(m,12),T=Wv(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 M,E,G,H,oe,J,fe,Xe,gr,or,Ir,Kr,Dn,qn,Yn,Qs,io,Xr;for(let xr=0;xr<v;xr+=1){let tr=T[xr],sr;switch(tr.tag){case"avar":fe=tr;break;case"cmap":sr=kn(m,tr),f.tables.cmap=$n.parse(sr.data,sr.offset),f.encoding=new zr(f.tables.cmap);break;case"cvt ":sr=kn(m,tr),Xr=new ft.Parser(sr.data,sr.offset),f.tables.cvt=Xr.parseShortList(tr.length/2);break;case"fvar":G=tr;break;case"STAT":H=tr;break;case"gvar":oe=tr;break;case"cvar":J=tr;break;case"fpgm":sr=kn(m,tr),Xr=new ft.Parser(sr.data,sr.offset),f.tables.fpgm=Xr.parseByteList(tr.length);break;case"head":sr=kn(m,tr),f.tables.head=Es.parse(sr.data,sr.offset),f.unitsPerEm=f.tables.head.unitsPerEm,c=f.tables.head.indexToLocFormat;break;case"hhea":sr=kn(m,tr),f.tables.hhea=qs.parse(sr.data,sr.offset),f.ascender=f.tables.hhea.ascender,f.descender=f.tables.hhea.descender,f.numberOfHMetrics=f.tables.hhea.numberOfHMetrics;break;case"HVAR":Dn=tr;break;case"hmtx":Kr=tr;break;case"ltag":sr=kn(m,tr),d=bo.parse(sr.data,sr.offset);break;case"COLR":sr=kn(m,tr),f.tables.colr=We.parse(sr.data,sr.offset);break;case"CPAL":sr=kn(m,tr),f.tables.cpal=fr.parse(sr.data,sr.offset);break;case"maxp":sr=kn(m,tr),f.tables.maxp=ka.parse(sr.data,sr.offset),f.numGlyphs=f.tables.maxp.numGlyphs;break;case"name":Qs=tr;break;case"OS/2":sr=kn(m,tr),f.tables.os2=li.parse(sr.data,sr.offset);break;case"post":sr=kn(m,tr),f.tables.post=eo.parse(sr.data,sr.offset),f.glyphNames=new es(f.tables.post);break;case"prep":sr=kn(m,tr),Xr=new ft.Parser(sr.data,sr.offset),f.tables.prep=Xr.parseByteList(tr.length);break;case"glyf":Xe=tr;break;case"loca":Yn=tr;break;case"CFF ":M=tr;break;case"CFF2":E=tr;break;case"kern":qn=tr;break;case"GDEF":gr=tr;break;case"GPOS":or=tr;break;case"GSUB":Ir=tr;break;case"meta":io=tr;break;case"gasp":try{sr=kn(m,tr),f.tables.gasp=L.parse(sr.data,sr.offset)}catch(Si){console.warn("Failed to parse gasp table, skipping."),console.warn(Si)}break;case"SVG ":sr=kn(m,tr),f.tables.svg=W.parse(sr.data,sr.offset);break;default:break}}let pa=kn(m,Qs);if(f.tables.name=xt.parse(pa.data,pa.offset,d),f.names=f.tables.name,Xe&&Yn){let xr=c===0,tr=kn(m,Yn),sr=Hv.parse(tr.data,tr.offset,f.numGlyphs,xr),Si=kn(m,Xe);f.glyphs=wc.parse(Si.data,Si.offset,sr,f,o)}else if(M){let xr=kn(m,M);Za.parse(xr.data,xr.offset,f,o)}else if(E){let xr=kn(m,E);Za.parse(xr.data,xr.offset,f,o)}else throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");let Ni=kn(m,Kr);if(_a.parse(f,Ni.data,Ni.offset,f.numberOfHMetrics,f.numGlyphs,f.glyphs,o),on(f,o),qn){let xr=kn(m,qn);f.kerningPairs=$v.parse(xr.data,xr.offset)}else f.kerningPairs={};if(gr){let xr=kn(m,gr);f.tables.gdef=Dv.parse(xr.data,xr.offset)}if(or){let xr=kn(m,or);f.tables.gpos=Pv.parse(xr.data,xr.offset),f.position.init()}if(Ir){let xr=kn(m,Ir);f.tables.gsub=Ei.parse(xr.data,xr.offset)}if(G){let xr=kn(m,G);f.tables.fvar=vn.parse(xr.data,xr.offset,f.names)}if(H){let xr=kn(m,H);f.tables.stat=la.parse(xr.data,xr.offset,f.tables.fvar)}if(oe){G||console.warn("This font provides a gvar table, but no fvar table, which is required for variable fonts."),Xe||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let xr=kn(m,oe);f.tables.gvar=Vo.parse(xr.data,xr.offset,f.tables.fvar,f.glyphs)}if(J){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."),Xe||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let xr=kn(m,J);f.tables.cvar=wo.parse(xr.data,xr.offset,f.tables.fvar,f.tables.cvt||[])}if(fe){G||console.warn("This font provides an avar table, but no fvar table, which is required for variable fonts.");let xr=kn(m,fe);f.tables.avar=to.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."),Kr||console.warn("This font provides an HVAR table, but no hmtx table to vary.");let xr=kn(m,Dn);f.tables.hvar=Lv.parse(xr.data,xr.offset,f.tables.fvar)}if(io){let xr=kn(m,io);f.tables.meta=$s.parse(xr.data,xr.offset),f.metas=f.tables.meta}return f.palettes=new Du(f),f}function Vv(){console.error("DEPRECATED! migrate to: opentype.parse(buffer, opt) See: https://github.com/opentypejs/opentype.js/issues/675")}function qv(){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}))}),SS=TS(CS()),gi=Uc("lru-cache:metrics"),eu=pS("lru-cache"),_S=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,bf=()=>gi.hasSubscribers||eu.hasSubscribers,Q3=new Set,Tg=typeof process=="object"&&process?process:{},LS=(e,t,r,n)=>{typeof Tg.emitWarning=="function"?Tg.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)},kS=e=>!Q3.has(e),Il=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),j3=e=>Il(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Pd:null:null,Pd=class extends Array{constructor(e){super(e),this.fill(0)}},Vl,C0,IS=(Vl=class{constructor(e,t){if(Ws(this,"heap"),Ws(this,"length"),!K(Vl,C0))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){let t=j3(e);if(!t)return[];Lr(Vl,C0,!0);let r=new Vl(e,t);return Lr(Vl,C0,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},C0=new WeakMap,ln(Vl,C0,!1),Vl),Cg,Sg,lo,Ba,_o,Ic,Lo,S0,_0,ko,Ks,Qa,Hs,ms,Wr,Xi,ja,Qi,hi,Io,fi,Eo,Ro,Pa,Oa,No,L0,Ji,Ec,Bt,yf,Rc,Tl,sd,Fa,_g,Nc,k0,id,Cl,Sl,vf,Mc,ad,Lg,kg,od,ns,wf,Ig,Eg,I0,Af,E0,_l,Tf,Cf,ES=(Cf=class{constructor(e){ln(this,Bt),ln(this,lo),ln(this,Ba),ln(this,_o),ln(this,Ic),ln(this,Lo),ln(this,S0),ln(this,_0),ln(this,ko),Ws(this,"ttl"),Ws(this,"ttlResolution"),Ws(this,"ttlAutopurge"),Ws(this,"updateAgeOnGet"),Ws(this,"updateAgeOnHas"),Ws(this,"allowStale"),Ws(this,"noDisposeOnSet"),Ws(this,"noUpdateTTL"),Ws(this,"maxEntrySize"),Ws(this,"sizeCalculation"),Ws(this,"noDeleteOnFetchRejection"),Ws(this,"noDeleteOnStaleGet"),Ws(this,"allowStaleOnFetchAbort"),Ws(this,"allowStaleOnFetchRejection"),Ws(this,"ignoreFetchAbort"),Ws(this,"backgroundFetchSize"),ln(this,Ks),ln(this,Qa),ln(this,Hs),ln(this,ms),ln(this,Wr),ln(this,Xi),ln(this,ja),ln(this,Qi),ln(this,hi),ln(this,Io),ln(this,fi),ln(this,Eo),ln(this,Ro),ln(this,Pa),ln(this,Oa),ln(this,No),ln(this,L0),ln(this,Ji),ln(this,Ec),ln(this,Rc,()=>{}),ln(this,Tl,()=>{}),ln(this,sd,()=>{}),ln(this,Fa,()=>!1),ln(this,Nc,ve=>{}),ln(this,k0,(ve,_e,Ze)=>{}),ln(this,id,(ve,_e,Ze,Ve)=>{if(Ze||Ve)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0}),Ws(this,Cg,"LRUCache");let{max:t=0,ttl:r,ttlResolution:n=1,ttlAutopurge:i,updateAgeOnGet:l,updateAgeOnHas:u,allowStale:h,dispose:p,onInsert:g,disposeAfter:x,noDisposeOnSet:b,noUpdateTTL:w,maxSize:A=0,maxEntrySize:k=0,sizeCalculation:I,fetchMethod:N,memoMethod:R,noDeleteOnFetchRejection:D,noDeleteOnStaleGet:O,allowStaleOnFetchRejection:q,allowStaleOnFetchAbort:Y,ignoreFetchAbort:U,backgroundFetchSize:V=1,perf:me}=e;if(this.backgroundFetchSize=V,me!==void 0&&typeof me?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(Lr(this,ko,me??_S),t!==0&&!Il(t))throw new TypeError("max option must be a nonnegative integer");let Je=t?j3(t):Array;if(!Je)throw new Error("invalid max value: "+t);if(Lr(this,lo,t),Lr(this,Ba,A),this.maxEntrySize=k||K(this,Ba),this.sizeCalculation=I,this.sizeCalculation){if(!K(this,Ba)&&!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(R!==void 0&&typeof R!="function")throw new TypeError("memoMethod must be a function if defined");if(Lr(this,_0,R),N!==void 0&&typeof N!="function")throw new TypeError("fetchMethod must be a function if specified");if(Lr(this,S0,N),Lr(this,L0,!!N),Lr(this,Hs,new Map),Lr(this,ms,Array.from({length:t}).fill(void 0)),Lr(this,Wr,Array.from({length:t}).fill(void 0)),Lr(this,Xi,new Je(t)),Lr(this,ja,new Je(t)),Lr(this,Qi,0),Lr(this,hi,0),Lr(this,Io,IS.create(t)),Lr(this,Ks,0),Lr(this,Qa,0),typeof p=="function"&&Lr(this,_o,p),typeof g=="function"&&Lr(this,Ic,g),typeof x=="function"?(Lr(this,Lo,x),Lr(this,fi,[])):(Lr(this,Lo,void 0),Lr(this,fi,void 0)),Lr(this,No,!!K(this,_o)),Lr(this,Ec,!!K(this,Ic)),Lr(this,Ji,!!K(this,Lo)),this.noDisposeOnSet=!!b,this.noUpdateTTL=!!w,this.noDeleteOnFetchRejection=!!D,this.allowStaleOnFetchRejection=!!q,this.allowStaleOnFetchAbort=!!Y,this.ignoreFetchAbort=!!U,this.maxEntrySize!==0){if(K(this,Ba)!==0&&!Il(K(this,Ba)))throw new TypeError("maxSize must be a positive integer if specified");if(!Il(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Ft(this,Bt,_g).call(this)}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!O,this.updateAgeOnGet=!!l,this.updateAgeOnHas=!!u,this.ttlResolution=Il(n)||n===0?n:1,this.ttlAutopurge=!!i,this.ttl=r||0,this.ttl){if(!Il(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Ft(this,Bt,yf).call(this)}if(K(this,lo)===0&&this.ttl===0&&K(this,Ba)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!K(this,lo)&&!K(this,Ba)){let ve="LRU_CACHE_UNBOUNDED";kS(ve)&&(Q3.add(ve),LS("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ve,Cf))}}get perf(){return K(this,ko)}static unsafeExposeInternals(e){return{starts:K(e,Ro),ttls:K(e,Pa),autopurgeTimers:K(e,Oa),sizes:K(e,Eo),keyMap:K(e,Hs),keyList:K(e,ms),valList:K(e,Wr),next:K(e,Xi),prev:K(e,ja),get head(){return K(e,Qi)},get tail(){return K(e,hi)},free:K(e,Io),isBackgroundFetch:t=>{var r;return Ft(r=e,Bt,ns).call(r,t)},backgroundFetch:(t,r,n,i)=>{var l;return Ft(l=e,Bt,od).call(l,t,r,n,i)},moveToTail:t=>{var r;return Ft(r=e,Bt,E0).call(r,t)},indexes:t=>{var r;return Ft(r=e,Bt,Cl).call(r,t)},rindexes:t=>{var r;return Ft(r=e,Bt,Sl).call(r,t)},isStale:t=>{var r;return K(r=e,Fa).call(r,t)}}}get max(){return K(this,lo)}get maxSize(){return K(this,Ba)}get calculatedSize(){return K(this,Qa)}get size(){return K(this,Ks)}get fetchMethod(){return K(this,S0)}get memoMethod(){return K(this,_0)}get dispose(){return K(this,_o)}get onInsert(){return K(this,Ic)}get disposeAfter(){return K(this,Lo)}getRemainingTTL(e){return K(this,Hs).has(e)?1/0:0}*entries(){for(let e of Ft(this,Bt,Cl).call(this))K(this,Wr)[e]!==void 0&&K(this,ms)[e]!==void 0&&!Ft(this,Bt,ns).call(this,K(this,Wr)[e])&&(yield[K(this,ms)[e],K(this,Wr)[e]])}*rentries(){for(let e of Ft(this,Bt,Sl).call(this))K(this,Wr)[e]!==void 0&&K(this,ms)[e]!==void 0&&!Ft(this,Bt,ns).call(this,K(this,Wr)[e])&&(yield[K(this,ms)[e],K(this,Wr)[e]])}*keys(){for(let e of Ft(this,Bt,Cl).call(this)){let t=K(this,ms)[e];t!==void 0&&!Ft(this,Bt,ns).call(this,K(this,Wr)[e])&&(yield t)}}*rkeys(){for(let e of Ft(this,Bt,Sl).call(this)){let t=K(this,ms)[e];t!==void 0&&!Ft(this,Bt,ns).call(this,K(this,Wr)[e])&&(yield t)}}*values(){for(let e of Ft(this,Bt,Cl).call(this))K(this,Wr)[e]!==void 0&&!Ft(this,Bt,ns).call(this,K(this,Wr)[e])&&(yield K(this,Wr)[e])}*rvalues(){for(let e of Ft(this,Bt,Sl).call(this))K(this,Wr)[e]!==void 0&&!Ft(this,Bt,ns).call(this,K(this,Wr)[e])&&(yield K(this,Wr)[e])}[(Sg=Symbol.iterator,Cg=Symbol.toStringTag,Sg)](){return this.entries()}find(e,t={}){for(let r of Ft(this,Bt,Cl).call(this)){let n=K(this,Wr)[r],i=Ft(this,Bt,ns).call(this,n)?n.__staleWhileFetching:n;if(i!==void 0&&e(i,K(this,ms)[r],this))return Ft(this,Bt,I0).call(this,K(this,ms)[r],t)}}forEach(e,t=this){for(let r of Ft(this,Bt,Cl).call(this)){let n=K(this,Wr)[r],i=Ft(this,Bt,ns).call(this,n)?n.__staleWhileFetching:n;i!==void 0&&e.call(t,i,K(this,ms)[r],this)}}rforEach(e,t=this){for(let r of Ft(this,Bt,Sl).call(this)){let n=K(this,Wr)[r],i=Ft(this,Bt,ns).call(this,n)?n.__staleWhileFetching:n;i!==void 0&&e.call(t,i,K(this,ms)[r],this)}}purgeStale(){let e=!1;for(let t of Ft(this,Bt,Sl).call(this,{allowStale:!0}))K(this,Fa).call(this,t)&&(Ft(this,Bt,_l).call(this,K(this,ms)[t],"expire"),e=!0);return e}info(e){let t=K(this,Hs).get(e);if(t===void 0)return;let r=K(this,Wr)[t],n=Ft(this,Bt,ns).call(this,r)?r.__staleWhileFetching:r;if(n===void 0)return;let i={value:n};if(K(this,Pa)&&K(this,Ro)){let l=K(this,Pa)[t],u=K(this,Ro)[t];if(l&&u){let h=l-(K(this,ko).now()-u);i.ttl=h,i.start=Date.now()}}return K(this,Eo)&&(i.size=K(this,Eo)[t]),i}dump(){let e=[];for(let t of Ft(this,Bt,Cl).call(this,{allowStale:!0})){let r=K(this,ms)[t],n=K(this,Wr)[t],i=Ft(this,Bt,ns).call(this,n)?n.__staleWhileFetching:n;if(i===void 0||r===void 0)continue;let l={value:i};if(K(this,Pa)&&K(this,Ro)){l.ttl=K(this,Pa)[t];let u=K(this,ko).now()-K(this,Ro)[t];l.start=Math.floor(Date.now()-u)}K(this,Eo)&&(l.size=K(this,Eo)[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=K(this,ko).now()-n}Ft(this,Bt,Mc).call(this,t,r.value,r)}}set(e,t,r={}){let{status:n=gi.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=Ft(this,Bt,Mc).call(this,e,t,r);return n&&gi.hasSubscribers&&gi.publish(n),i}pop(){var e;try{for(;K(this,Ks);){let t=K(this,Wr)[K(this,Qi)];if(Ft(this,Bt,ad).call(this,!0),Ft(this,Bt,ns).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(K(this,Ji)&&K(this,fi)){let t=K(this,fi),r;for(;r=t?.shift();)(e=K(this,Lo))==null||e.call(this,...r)}}}has(e,t={}){let{status:r=gi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="has",r.key=e,r.cache=this);let n=Ft(this,Bt,Lg).call(this,e,t);return gi.hasSubscribers&&gi.publish(r),n}peek(e,t={}){let{status:r=bf()?{}:void 0}=t;r&&(r.op="peek",r.key=e,r.cache=this),t.status=r;let n=Ft(this,Bt,kg).call(this,e,t);return gi.hasSubscribers&&gi.publish(r),n}fetch(e,t={}){let r=eu.hasSubscribers,{status:n=bf()?{}:void 0}=t;t.status=n,n&&t.context&&(n.context=t.context);let i=Ft(this,Bt,wf).call(this,e,t);return n&&r&&(n.trace=!0,eu.tracePromise(()=>i,n).catch(()=>{})),i}forceFetch(e,t={}){let r=eu.hasSubscribers,{status:n=bf()?{}:void 0}=t;t.status=n,n&&t.context&&(n.context=t.context);let i=Ft(this,Bt,Ig).call(this,e,t);return n&&r&&(n.trace=!0,eu.tracePromise(()=>i,n).catch(()=>{})),i}memo(e,t={}){let{status:r=gi.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=Ft(this,Bt,Eg).call(this,e,t);return r&&(r.value=n),gi.hasSubscribers&&gi.publish(r),n}get(e,t={}){let{status:r=gi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="get",r.key=e,r.cache=this);let n=Ft(this,Bt,I0).call(this,e,t);return r&&(n!==void 0&&(r.value=n),gi.hasSubscribers&&gi.publish(r)),n}delete(e){return Ft(this,Bt,_l).call(this,e,"delete")}clear(){return Ft(this,Bt,Tf).call(this,"delete")}},lo=new WeakMap,Ba=new WeakMap,_o=new WeakMap,Ic=new WeakMap,Lo=new WeakMap,S0=new WeakMap,_0=new WeakMap,ko=new WeakMap,Ks=new WeakMap,Qa=new WeakMap,Hs=new WeakMap,ms=new WeakMap,Wr=new WeakMap,Xi=new WeakMap,ja=new WeakMap,Qi=new WeakMap,hi=new WeakMap,Io=new WeakMap,fi=new WeakMap,Eo=new WeakMap,Ro=new WeakMap,Pa=new WeakMap,Oa=new WeakMap,No=new WeakMap,L0=new WeakMap,Ji=new WeakMap,Ec=new WeakMap,Bt=new WeakSet,yf=function(){let e=new Pd(K(this,lo)),t=new Pd(K(this,lo));Lr(this,Pa,e),Lr(this,Ro,t);let r=this.ttlAutopurge?Array.from({length:K(this,lo)}):void 0;Lr(this,Oa,r),Lr(this,sd,(u,h,p=K(this,ko).now())=>{t[u]=h!==0?p:0,e[u]=h,n(u,h)}),Lr(this,Rc,u=>{t[u]=e[u]!==0?K(this,ko).now():0,n(u,e[u])});let n=this.ttlAutopurge?(u,h)=>{if(r?.[u]&&(clearTimeout(r[u]),r[u]=void 0),h&&h!==0&&r){let p=setTimeout(()=>{K(this,Fa).call(this,u)&&Ft(this,Bt,_l).call(this,K(this,ms)[u],"expire")},h+1);p.unref&&p.unref(),r[u]=p}}:()=>{};Lr(this,Tl,(u,h)=>{if(e[h]){let p=e[h],g=t[h];if(!p||!g)return;u.ttl=p,u.start=g,u.now=i||l();let x=u.now-g;u.remainingTTL=p-x}});let i=0,l=()=>{let u=K(this,ko).now();if(this.ttlResolution>0){i=u;let h=setTimeout(()=>i=0,this.ttlResolution);h.unref&&h.unref()}return u};this.getRemainingTTL=u=>{let h=K(this,Hs).get(u);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},Lr(this,Fa,u=>{let h=t[u],p=e[u];return!!p&&!!h&&(i||l())-h>p})},Rc=new WeakMap,Tl=new WeakMap,sd=new WeakMap,Fa=new WeakMap,_g=function(){let e=new Pd(K(this,lo));Lr(this,Qa,0),Lr(this,Eo,e),Lr(this,Nc,t=>{Lr(this,Qa,K(this,Qa)-e[t]),e[t]=0}),Lr(this,id,(t,r,n,i)=>{if(!Il(n)){if(Ft(this,Bt,ns).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),!Il(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}),Lr(this,k0,(t,r,n)=>{if(e[t]=r,K(this,Ba)){let i=K(this,Ba)-e[t];for(;K(this,Qa)>i;)Ft(this,Bt,ad).call(this,!0)}Lr(this,Qa,K(this,Qa)+e[t]),n&&(n.entrySize=r,n.totalCalculatedSize=K(this,Qa))})},Nc=new WeakMap,k0=new WeakMap,id=new WeakMap,Cl=function*({allowStale:e=this.allowStale}={}){if(K(this,Ks))for(let t=K(this,hi);Ft(this,Bt,vf).call(this,t)&&((e||!K(this,Fa).call(this,t))&&(yield t),t!==K(this,Qi));)t=K(this,ja)[t]},Sl=function*({allowStale:e=this.allowStale}={}){if(K(this,Ks))for(let t=K(this,Qi);Ft(this,Bt,vf).call(this,t)&&((e||!K(this,Fa).call(this,t))&&(yield t),t!==K(this,hi));)t=K(this,Xi)[t]},vf=function(e){return e!==void 0&&K(this,Hs).get(K(this,ms)[e])===e},Mc=function(e,t,r,n){var i,l,u,h;let{ttl:p=this.ttl,start:g,noDisposeOnSet:x=this.noDisposeOnSet,sizeCalculation:b=this.sizeCalculation,status:w}=r,A=Ft(this,Bt,ns).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 I=K(this,id).call(this,e,t,r.size||0,b,w);if(this.maxEntrySize&&I>this.maxEntrySize)return Ft(this,Bt,_l).call(this,e,"set"),w&&(w.set="miss",w.maxEntrySizeExceeded=!0),this;let N=K(this,Ks)===0?void 0:K(this,Hs).get(e);if(N===void 0)N=K(this,Ks)===0?K(this,hi):K(this,Io).length!==0?K(this,Io).pop():K(this,Ks)===K(this,lo)?Ft(this,Bt,ad).call(this,!1):K(this,Ks),K(this,ms)[N]=e,K(this,Wr)[N]=t,K(this,Hs).set(e,N),K(this,Xi)[K(this,hi)]=N,K(this,ja)[N]=K(this,hi),Lr(this,hi,N),xf(this,Ks)._++,K(this,k0).call(this,N,I,w),w&&(w.set="add"),k=!1,K(this,Ec)&&!A&&((i=K(this,Ic))==null||i.call(this,t,e,"add"));else{Ft(this,Bt,E0).call(this,N);let R=K(this,Wr)[N];if(t!==R){if(!x)if(Ft(this,Bt,ns).call(this,R)){R!==n&&R.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:D}=R;D!==void 0&&D!==t&&(K(this,No)&&((l=K(this,_o))==null||l.call(this,D,e,"set")),K(this,Ji)&&K(this,fi)?.push([D,e,"set"]))}else K(this,No)&&((u=K(this,_o))==null||u.call(this,R,e,"set")),K(this,Ji)&&K(this,fi)?.push([R,e,"set"]);if(K(this,Nc).call(this,N),K(this,k0).call(this,N,I,w),K(this,Wr)[N]=t,!A){let D=R&&Ft(this,Bt,ns).call(this,R)?R.__staleWhileFetching:R,O=D===void 0?"add":t!==D?"replace":"update";w&&(w.set=O,D!==void 0&&(w.oldValue=D)),K(this,Ec)&&this.onInsert?.(t,e,O)}}else A||(w&&(w.set="update"),K(this,Ec)&&this.onInsert?.(t,e,"update"))}if(p!==0&&!K(this,Pa)&&Ft(this,Bt,yf).call(this),K(this,Pa)&&(k||K(this,sd).call(this,N,p,g),w&&K(this,Tl).call(this,w,N)),!x&&K(this,Ji)&&K(this,fi)){let R=K(this,fi),D;for(;D=R?.shift();)(h=K(this,Lo))==null||h.call(this,...D)}return this},ad=function(e){var t;let r=K(this,Qi),n=K(this,ms)[r],i=K(this,Wr)[r],l=Ft(this,Bt,ns).call(this,i);l&&i.__abortController.abort(new Error("evicted"));let u=l?i.__staleWhileFetching:i;return(K(this,No)||K(this,Ji))&&u!==void 0&&(K(this,No)&&((t=K(this,_o))==null||t.call(this,u,n,"evict")),K(this,Ji)&&K(this,fi)?.push([u,n,"evict"])),K(this,Nc).call(this,r),K(this,Oa)?.[r]&&(clearTimeout(K(this,Oa)[r]),K(this,Oa)[r]=void 0),e&&(K(this,ms)[r]=void 0,K(this,Wr)[r]=void 0,K(this,Io).push(r)),K(this,Ks)===1?(Lr(this,Qi,Lr(this,hi,0)),K(this,Io).length=0):Lr(this,Qi,K(this,Xi)[r]),K(this,Hs).delete(n),xf(this,Ks)._--,r},Lg=function(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,i=K(this,Hs).get(e);if(i!==void 0){let l=K(this,Wr)[i];if(Ft(this,Bt,ns).call(this,l)&&l.__staleWhileFetching===void 0)return!1;if(K(this,Fa).call(this,i))n&&(n.has="stale",K(this,Tl).call(this,n,i));else return r&&K(this,Rc).call(this,i),n&&(n.has="hit",K(this,Tl).call(this,n,i)),!0}else n&&(n.has="miss");return!1},kg=function(e,t){let{status:r,allowStale:n=this.allowStale}=t,i=K(this,Hs).get(e);if(i===void 0||!n&&K(this,Fa).call(this,i)){r&&(r.peek=i===void 0?"miss":"stale");return}let l=K(this,Wr)[i],u=Ft(this,Bt,ns).call(this,l)?l.__staleWhileFetching:l;return r&&(u!==void 0?(r.peek="hit",r.value=u):r.peek="miss"),u},od=function(e,t,r,n){let i=t===void 0?void 0:K(this,Wr)[t];if(Ft(this,Bt,ns).call(this,i))return i;let l=new AbortController,{signal:u}=r;u?.addEventListener("abort",()=>l.abort(u.reason),{signal:l.signal});let h={signal:l.signal,options:r,context:n},p=(k,I=!1)=>{let{aborted:N}=l.signal,R=r.ignoreFetchAbort&&k!==void 0,D=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&k!==void 0);if(r.status&&(N&&!I?(r.status.fetchAborted=!0,r.status.fetchError=l.signal.reason,R&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),N&&!R&&!I)return x(l.signal.reason,D);let O=w,q=K(this,Wr)[t];return(q===w||q===void 0&&R&&I)&&(k===void 0?O.__staleWhileFetching!==void 0?K(this,Wr)[t]=O.__staleWhileFetching:Ft(this,Bt,_l).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),Ft(this,Bt,Mc).call(this,e,k,h.options,O))),k},g=k=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=k),x(k,!1)),x=(k,I)=>{let{aborted:N}=l.signal,R=N&&r.allowStaleOnFetchAbort,D=R||r.allowStaleOnFetchRejection,O=D||r.noDeleteOnFetchRejection,q=w;if(K(this,Wr)[t]===w&&(!O||!I&&q.__staleWhileFetching===void 0?Ft(this,Bt,_l).call(this,e,"fetch"):R||(K(this,Wr)[t]=q.__staleWhileFetching)),D)return r.status&&q.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),q.__staleWhileFetching;if(q.__returned===q)throw k},b=(k,I)=>{var N;let R=(N=K(this,S0))==null?void 0:N.call(this,e,i,h);l.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(k(void 0),r.allowStaleOnFetchAbort&&(k=D=>p(D,!0)))}),R&&R instanceof Promise?R.then(D=>k(D===void 0?void 0:D),I):R!==void 0&&k(R)};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?(Ft(this,Bt,Mc).call(this,e,A,{...h.options,status:void 0}),t=K(this,Hs).get(e)):K(this,Wr)[t]=A,A},ns=function(e){if(!K(this,L0))return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController},wf=async function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:l=this.ttl,noDisposeOnSet:u=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:I=!1,status:N,signal:R}=t;if(N&&(N.op="fetch",N.key=e,I&&(N.forceRefresh=!0),N.cache=this),!K(this,L0))return N&&(N.fetch="get"),Ft(this,Bt,I0).call(this,e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,status:N});let D={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,ttl:l,noDisposeOnSet:u,size:h,sizeCalculation:p,noUpdateTTL:g,noDeleteOnFetchRejection:x,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:A,ignoreFetchAbort:w,status:N,signal:R},O=K(this,Hs).get(e);if(O===void 0){N&&(N.fetch="miss");let q=Ft(this,Bt,od).call(this,e,O,D,k);return q.__returned=q}else{let q=K(this,Wr)[O];if(Ft(this,Bt,ns).call(this,q)){let me=r&&q.__staleWhileFetching!==void 0;return N&&(N.fetch="inflight",me&&(N.returnedStale=!0)),me?q.__staleWhileFetching:q.__returned=q}let Y=K(this,Fa).call(this,O);if(!I&&!Y)return N&&(N.fetch="hit"),Ft(this,Bt,E0).call(this,O),n&&K(this,Rc).call(this,O),N&&K(this,Tl).call(this,N,O),q;let U=Ft(this,Bt,od).call(this,e,O,D,k),V=U.__staleWhileFetching!==void 0&&r;return N&&(N.fetch=Y?"stale":"refresh",V&&Y&&(N.returnedStale=!0)),V?U.__staleWhileFetching:U.__returned=U}},Ig=async function(e,t={}){let r=await Ft(this,Bt,wf).call(this,e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r},Eg=function(e,t={}){let r=K(this,_0);if(!r)throw new Error("no memoMethod provided to constructor");let{context:n,status:i,forceRefresh:l,...u}=t;i&&l&&(i.forceRefresh=!0);let h=Ft(this,Bt,I0).call(this,e,u),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:u,context:n});return i&&(i.value=g),Ft(this,Bt,Mc).call(this,e,g,u),g},I0=function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:l}=t,u=K(this,Hs).get(e);if(u===void 0){l&&(l.get="miss");return}let h=K(this,Wr)[u],p=Ft(this,Bt,ns).call(this,h);return l&&K(this,Tl).call(this,l,u),K(this,Fa).call(this,u)?p?(l&&(l.get="stale-fetching"),r&&h.__staleWhileFetching!==void 0?(l&&(l.returnedStale=!0),h.__staleWhileFetching):void 0):(i||Ft(this,Bt,_l).call(this,e,"expire"),l&&(l.get="stale"),r?(l&&(l.returnedStale=!0),h):void 0):(l&&(l.get=p?"fetching":"hit"),Ft(this,Bt,E0).call(this,u),n&&K(this,Rc).call(this,u),p?h.__staleWhileFetching:h)},Af=function(e,t){K(this,ja)[t]=e,K(this,Xi)[e]=t},E0=function(e){e!==K(this,hi)&&(e===K(this,Qi)?Lr(this,Qi,K(this,Xi)[e]):Ft(this,Bt,Af).call(this,K(this,ja)[e],K(this,Xi)[e]),Ft(this,Bt,Af).call(this,K(this,hi),e),Lr(this,hi,e))},_l=function(e,t){var r,n;gi.hasSubscribers&&gi.publish({op:"delete",delete:t,key:e,cache:this});let i=!1;if(K(this,Ks)!==0){let l=K(this,Hs).get(e);if(l!==void 0)if(K(this,Oa)?.[l]&&(clearTimeout(K(this,Oa)?.[l]),K(this,Oa)[l]=void 0),i=!0,K(this,Ks)===1)Ft(this,Bt,Tf).call(this,t);else{K(this,Nc).call(this,l);let u=K(this,Wr)[l];if(Ft(this,Bt,ns).call(this,u)?u.__abortController.abort(new Error("deleted")):(K(this,No)||K(this,Ji))&&(K(this,No)&&((r=K(this,_o))==null||r.call(this,u,e,t)),K(this,Ji)&&K(this,fi)?.push([u,e,t])),K(this,Hs).delete(e),K(this,ms)[l]=void 0,K(this,Wr)[l]=void 0,l===K(this,hi))Lr(this,hi,K(this,ja)[l]);else if(l===K(this,Qi))Lr(this,Qi,K(this,Xi)[l]);else{let h=K(this,ja)[l];K(this,Xi)[h]=K(this,Xi)[l];let p=K(this,Xi)[l];K(this,ja)[p]=K(this,ja)[l]}xf(this,Ks)._--,K(this,Io).push(l)}}if(K(this,Ji)&&K(this,fi)?.length){let l=K(this,fi),u;for(;u=l?.shift();)(n=K(this,Lo))==null||n.call(this,...u)}return i},Tf=function(e){var t,r;for(let n of Ft(this,Bt,Sl).call(this,{allowStale:!0})){let i=K(this,Wr)[n];if(Ft(this,Bt,ns).call(this,i))i.__abortController.abort(new Error("deleted"));else{let l=K(this,ms)[n];K(this,No)&&((t=K(this,_o))==null||t.call(this,i,l,e)),K(this,Ji)&&K(this,fi)?.push([i,l,e])}}if(K(this,Hs).clear(),K(this,Wr).fill(void 0),K(this,ms).fill(void 0),K(this,Pa)&&K(this,Ro)){K(this,Pa).fill(0),K(this,Ro).fill(0);for(let n of K(this,Oa)??[])n!==void 0&&clearTimeout(n);K(this,Oa)?.fill(void 0)}if(K(this,Eo)&&K(this,Eo).fill(0),Lr(this,Qi,0),Lr(this,hi,0),K(this,Io).length=0,Lr(this,Qa,0),Lr(this,Ks,0),K(this,Ji)&&K(this,fi)){let n=K(this,fi),i;for(;i=n?.shift();)(r=K(this,Lo))==null||r.call(this,...i)}},Cf);function P3(e){let t={individual:{},range:[]},r=new WeakMap;for(let n of e)kp(t,n,r);return t}function kp(e,t,r){for(let[n,i]of Object.entries(t.individual))if(e.individual[n])Dc(e.individual[n],i,r);else{let l=!1;for(let[u,{range:h,entry:p}]of e.range.entries()){let g=Sf(Number(n),h);if(g.both!==null){l=!0,e.individual[n]=i,Dc(e.individual[n],xi(p),r),e.range.splice(u,1);for(let x of g.second)Array.isArray(x)?e.range.push({range:x,entry:xi(p)}):e.individual[x]=xi(p)}}l||(e.individual[n]=i)}for(let{range:n,entry:i}of t.range){let l=[n];for(let u=0;u<e.range.length;u++){let{range:h,entry:p}=e.range[u];for(let[g,x]of l.entries())if(Array.isArray(x)){let b=RS(x,h);if(b.both===null)continue;e.range.splice(u,1),u--;let w=xi(p);Array.isArray(b.both)?e.range.push({range:b.both,entry:w}):e.individual[b.both]=w,Dc(w,xi(i),r);for(let A of b.second)Array.isArray(A)?e.range.push({range:A,entry:xi(p)}):e.individual[A]=xi(p);l=b.first}else{let b=Sf(x,h);if(b.both===null)continue;e.individual[x]=xi(i),Dc(e.individual[x],xi(p),r),e.range.splice(u,1),u--;for(let w of b.second)Array.isArray(w)?e.range.push({range:w,entry:xi(p)}):e.individual[w]=xi(p);l.splice(g,1,...b.first);break}}for(let u of Object.keys(e.individual))for(let[h,p]of l.entries())if(Array.isArray(p)){let g=Sf(Number(u),p);if(g.both===null)continue;Dc(e.individual[u],xi(i),r),l.splice(h,1,...g.second);break}else if(Number(u)===p){Dc(e.individual[u],xi(i),r);break}for(let u of l)Array.isArray(u)?e.range.push({range:u,entry:xi(i)}):e.individual[u]=xi(i)}}function Dc(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?kp(e.forward,t.forward,r):e.forward=t.forward),t.reverse&&(e.reverse?kp(e.reverse,t.reverse,r):e.reverse=t.reverse))}function RS(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=Xl(n,i)}if(e[0]<t[0]){let n=e[0],i=Math.min(t[0],e[1]);r.first.push(Xl(n,i))}else if(t[0]<e[0]){let n=t[0],i=Math.min(t[1],e[0]);r.second.push(Xl(n,i))}if(e[1]>t[1]){let n=Math.max(e[0],t[1]),i=e[1];r.first.push(Xl(n,i))}else if(t[1]>e[1]){let n=Math.max(e[1],t[0]),i=t[1];r.second.push(Xl(n,i))}return r}function Sf(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(Xl(t[0],e)),t[1]>e&&r.second.push(Xl(e+1,t[1])),r}function Xl(e,t){return t-e===1?e:[e,t]}function xi(e,t=new Map){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=Rg(e.forward,t)),e.reverse&&(r.reverse=Rg(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 Rg(e,t=new Map){let r={};for(let[n,i]of Object.entries(e.individual))r[n]=xi(i,t);return{individual:r,range:e.range.map(({range:n,entry:i})=>({range:n.slice(),entry:xi(i,t)}))}}function Ip(e,t,r,n){let i=t[n],l=e[i];if(!l)return;let u=l.lookup;if(l.reverse){let p=NS(l.reverse,t,r);(!u&&p||p&&u&&(u.index>p.index||u.index===p.index&&u.subIndex>p.subIndex))&&(u=p)}if(++n>=t.length||!l.forward)return u;let h=Ip(l.forward,t,r,n);return(!u&&h||h&&u&&(u.index>h.index||u.index===h.index&&u.subIndex>h.subIndex))&&(u=h),u}function NS(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 Ng(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 MS(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 cl(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 DS(e,t){let r=t[0],n=Ep(e,r),i=t[0]+1,l=new Map;for(;i<t[1];)Ep(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 Ep(e,t){let r=MS(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 b1(e,t,r,n,i){let l=[];for(let u of r){u.entry.forward={individual:{},range:[]};for(let h of e)l.push(...Th(u.entry.forward,n,i,t,h).map(({entry:p,substitution:g})=>({entry:p,substitutions:[...u.substitutions,g]})))}return l}function wh(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 u of e)Array.isArray(u)?i.entry.forward.range.push({entry:l,range:u}):i.entry.forward.individual[u]=l;r.push({entry:l,substitutions:i.substitutions})}return r}function Ah(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 u of e)Array.isArray(u)?i.entry.reverse.range.push({entry:l,range:u}):i.entry.reverse.individual[u]=l;r.push({entry:l,substitutions:i.substitutions})}return r}function Th(e,t,r,n,i){let l=[];if(!Array.isArray(i))e.individual[i]={},l.push({entry:e.individual[i],substitution:QS(t,r,n,i)});else{let u=BS(t,r,n,i);for(let[h,p]of u){let g={};Array.isArray(h)?e.range.push({range:h,entry:g}):e.individual[h]={},l.push({entry:g,substitution:p})}}return l}function BS(e,t,r,n){for(let i of e.filter(l=>l.sequenceIndex===r))for(let l of t[i.lookupListIndex].subtables){let u=DS(l,n);if(!Array.from(u.values()).every(h=>h!==null))return u}return new Map([[n,null]])}function QS(e,t,r,n){for(let i of e.filter(l=>l.sequenceIndex===r))for(let l of t[i.lookupListIndex].subtables){let u=Ep(l,n);if(u!==null)return u}return null}function jS(e,t,r){let n={individual:{},range:[]},i=cl(e.coverage);for(let{glyphId:l,index:u}of i){let h=e.chainRuleSets[u];if(h)for(let[p,g]of h.entries()){let x=Th(n,g.lookupRecords,t,0,l).map(({entry:b,substitution:w})=>({entry:b,substitutions:[w]}));for(let[b,w]of g.input.entries())x=b1([w],b+1,x,g.lookupRecords,t);for(let b of g.lookahead)x=wh([b],x);for(let b of g.backtrack)x=Ah([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 PS(e,t){return e.format===2?Array.isArray(t)?OS(e,t):new Map([[t,Rp(e,t)]]):new Map([[t,null]])}function OS(e,t){let r=t[0],n=Rp(e,r),i=t[0]+1,l=new Map;for(;i<t[1];)Rp(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 Rp(e,t){for(let r of e.ranges)if(r.start<=t&&r.end>=t)return r.classId;return null}function _f(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 FS(e,t,r){let n=[],i=cl(e.coverage);for(let{glyphId:l}of i){let u=PS(e.inputClassDef,l);for(let[h,p]of u.entries()){if(p===null)continue;let g=e.chainClassSet[p];if(g)for(let[x,b]of g.entries()){let w={individual:{},range:[]},A=Th(w,b.lookupRecords,t,0,h).map(({entry:k,substitution:I})=>({entry:k,substitutions:[I]}));for(let[k,I]of b.input.entries())A=b1(_f(e.inputClassDef,I),k+1,A,b.lookupRecords,t);for(let k of b.lookahead)A=wh(_f(e.lookaheadClassDef,k),A);for(let k of b.backtrack)A=Ah(_f(e.backtrackClassDef,k),A);for(let{entry:k,substitutions:I}of A)k.lookup={substitutions:I,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 P3(n)}function US(e,t,r){let n={individual:{},range:[]},i=cl(e.inputCoverage[0]);for(let{glyphId:l}of i){let u=Th(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())u=b1(cl(p).map(g=>g.glyphId),h+1,u,e.lookupRecords,t);for(let h of e.lookaheadCoverage)u=wh(cl(h).map(p=>p.glyphId),u);for(let h of e.backtrackCoverage)u=Ah(cl(h).map(p=>p.glyphId),u);for(let{entry:h,substitutions:p}of u)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 $S(e,t){let r={individual:{},range:[]},n=cl(e.coverage);for(let{glyphId:i,index:l}of n){let u={};Array.isArray(i)?r.range.push({entry:u,range:i}):r.individual[i]=u;let h=[{entry:u,substitutions:[e.substitutes[l]]}];for(let p of e.lookaheadCoverage)h=wh(cl(p).map(g=>g.glyphId),h);for(let p of e.backtrackCoverage)h=Ah(cl(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 Np(e,t=new Map){let r={};for(let[n,i]of Object.entries(e.individual))r[n]=Mg(i,t);for(let{range:n,entry:i}of e.range){let l=Mg(i,t);for(let u=n[0];u<n[1];u++)r[u]=l}return r}function Mg(e,t){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=Np(e.forward,t)),e.reverse&&(r.reverse=Np(e.reverse,t)),e.lookup&&(r.lookup=e.lookup),r}var zS=class{constructor(e,t){this._lookupTrees=[],this._glyphLookups={},this._font=e,t.cacheSize>0&&(this._cache=new ES({maxSize:t.cacheSize,sizeCalculation:((l,u)=>u.length)}));let r=(this._font.tables.gsub&&this._font.tables.gsub.features.filter(l=>l.tag==="calt")||[]).reduce((l,u)=>[...l,...u.feature.lookupListIndexes],[]),n=this._font.tables.gsub&&this._font.tables.gsub.lookups||[],i=n.filter((l,u)=>r.some(h=>h===u));for(let[l,u]of i.entries()){let h=[];switch(u.lookupType){case 6:for(let[g,x]of u.subtables.entries())switch(x.substFormat){case 1:h.push(jS(x,n,g));break;case 2:h.push(FS(x,n,g));break;case 3:h.push(US(x,n,g));break}break;case 8:for(let[g,x]of u.subtables.entries())h.push($S(x,g));break}let p=Np(P3(h));this._lookupTrees.push({tree:p,processForward:u.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 u=Ip(n.tree,e,l,l);if(u){for(let h=0;h<u.substitutions.length;h++){let p=u.substitutions[h];p!==null&&(e[l+h]=p)}Ng(t,u.contextRange[0]+l,u.contextRange[1]+l),l+u.length>=i&&(i=l+u.length+1),l+=u.length-1}}}else for(let i=r.last-1;i>=r.first;i--){let l=Ip(n.tree,e,i,i);if(l){for(let u=0;u<l.substitutions.length;u++){let h=l.substitutions[u];h!==null&&(e[i+u]=h)}Ng(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 u=i[l];if(u>=t){(r.index===null||u<=r.index)&&(r.index=u,r.first>n&&(r.first=n),r.last=n+1);break}}}return r}};function HS(e,t){let r=SS.parse(e);return new zS(r,{cacheSize:0,...t})}function WS(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+=GS(t,i);break;case",":r.push(n),n="";break;default:/\s/.test(i)||(t.offset--,n+=VS(t),r.push(n),n="")}}return r}function GS(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+=O3(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 VS(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+=O3(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 O3(e){let t="";for(;e.offset<e.input.length;){let r=e.input[e.offset++];if(/\s/.test(r))return Lf(t);if(t.length>=6||!/[\dA-Fa-f]/.test(r))return e.offset--,Lf(t);t+=r}return Lf(t)}function Lf(e){return String.fromCodePoint(parseInt(e,16))}var R0;async function qS(e,t){if(!R0){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);R0=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);R0=Promise.resolve(n)}catch(i){i instanceof Error&&console.error(i.name,i.message)}}R0??=Promise.resolve({})}let r=await R0;for(let n of WS(e)){if(YS.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 HS(l,{cacheSize:t})}return}}}var YS=["serif","sans-serif","cursive","fantasy","monospace","system-ui","emoji","math","fangsong"],ZS=1e5;function KS(e,t=[]){let r,n,i=0,l;return e.registerCharacterJoiner(u=>{let h=e.options.fontFamily;if(h&&(i===0||r!==h)){n=void 0,i=1,r=h;let p=r;qS(p,ZS).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(u).map(p=>[p[0],p[1]]):XS(u,t)})}function XS(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 JS=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=KS(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 Dg(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 e_=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=Dg(r[1]),i=Dg(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 F3(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 Bg(e,t){const r=F3(e,t);return r?(r.right-r.left)*(r.bottom-r.top):0}function nc(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,u=i&&i>0?i:n.height/e.rows;return{originLeft:n.left,originTop:n.top,cellW:l,cellH:u}}function Od(e,t){const r=nc(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 t_(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 Xd(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 r_(e,t,r){const n=nc(e);if(!n)return null;const{start:i,end:l}=Xd(t,r,e.cols),u=e.buffer.active.viewportY,h=u+e.rows-1;if(l.row<u||i.row>h)return null;const p=Math.max(i.row,u),g=Math.min(l.row,h),x=n.originTop+(p-u)*n.cellH,b=n.originTop+(g-u+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 n_(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,u=r+e.margin,h=Math.max(l,n-e.width-e.margin),p=Math.max(u,i-e.height-e.margin),g=me=>Math.max(l,Math.min(me,h)),x=me=>Math.max(u,Math.min(me,p)),b=e.selection?F3(e.selection,{left:t,top:r,right:n,bottom:i}):null;if(!b){const me=g(e.clientX-e.width/2),Je=e.clientY-e.height-e.fingerGap,ve=e.clientY+e.fingerGap,_e=x(Je>=u?Je:ve);return{left:Math.round(me),top:Math.round(_e)}}const w=(b.left+b.right)/2,A=(b.top+b.bottom)/2,k=e.preference?.alignX??w,I=e.selectionGap??e.fingerGap,N=b.top-e.height-I,R=b.bottom+I,D=e.preference?.vertical==="below"?R:N,O=e.preference?.vertical==="below"?N:R,q=[{left:l,top:u},{left:h,top:u},{left:l,top:p},{left:h,top:p}];e.preference&&q.sort((me,Je)=>{const ve=_e=>{const Ze=_e.left+e.width/2,Ve=_e.top+e.height/2;return Math.hypot(Ze-e.preference.focusX,Ve-e.preference.focusY)};return ve(Je)-ve(me)});const Y=[{left:k-e.width/2,top:D},{left:w-e.width/2,top:D},{left:k-e.width/2,top:O},{left:w-e.width/2,top:O},{left:b.left-e.width-e.fingerGap,top:A-e.height/2},{left:b.right+e.fingerGap,top:A-e.height/2},...q].map(me=>({left:g(me.left),top:x(me.top)}));let U=Y[0],V=Number.POSITIVE_INFINITY;return Y.forEach((me,Je)=>{const ve={left:me.left,top:me.top,right:me.left+e.width,bottom:me.top+e.height},_e=(e.avoid??[]).reduce((Ve,ce)=>Ve+Bg(ve,ce),0),Ze=(_e>0?1e6:0)+_e*100+Bg(ve,b)*10+Je*.01;Ze<V&&(U=me,V=Ze)}),{left:Math.round(U.left),top:Math.round(U.top)}}function s_(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(s_(window.getComputedStyle(t)))return t;t=t.parentElement}return null}function a_(e,t,r,n){const i=e.getBoundingClientRect();let l=0,u=0;if(t){const h=t.getBoundingClientRect();l=h.left+t.clientLeft,u=h.top+t.clientTop}return{x:i.left-l+r,y:i.top-u+n}}function o_(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 l_(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,u=t.length-n;for(;i<l&&i<u&&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 Qg=2,c_=new Set(["mount","init-fit","resize","dpr-change","session-key-change","session-reset","tmux-layout"]);function u_(e){const t=e.reason.replace(/^refresh:/,""),r=c_.has(t),n=Math.abs(e.proposedCols-e.currentCols),i=Math.abs(e.proposedRows-e.currentRows);return{accept:r?n>0||i>0:n>=Qg||i>=Qg,isRealResize:r,colsDelta:n,rowsDelta:i}}function d_(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 h_(e,t){return!e||t}function f_(e,t,r){return e!=="alternate"&&r>=t}function p_(e,t){return e?"none":t?"single":"settled"}function m_(e,t,r){return!r&&(e||t)}function g_(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)),u=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&&u(!0)},cancel(){u(!0)},dispose(){u(!1),l.dispose()}}}function kf(){return{confirmed:null,pending:null,nextSeq:1}}function jg(e,t){return e?.cols===t.cols&&e.rows===t.rows}function y1(e,t,r){const n={...t,seq:e.nextSeq,attempt:r};return{state:{...e,pending:n,nextSeq:e.nextSeq+1},request:n}}function x_(e,t){return jg(e.pending,t)||!e.pending&&jg(e.confirmed,t)?{state:e,request:null}:y1(e,t,0)}function b_(e,t){return y1(e,t,0)}function y_(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 Pg(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}:{...y1(e,n,n.attempt+1),exhausted:!1}}function v_(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 A_=150;function Og(e=0){return{lastPushAt:e}}function T_(e,t,r=A_){return t-e.lastPushAt>=r?(e.lastPushAt=t,{action:"send"}):{action:"hold",readyAt:e.lastPushAt+r}}function C_(e){return{lastPushAt:e}}const Mp="termdock-settings",S_=6,__=100,L_='"calt" on',k_=["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!==","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"];function I_(){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 v1(){return{fontFamily:"var(--font-mono)",fontSize:I_(),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 ld(e,t,r,n){return typeof e=="number"&&Number.isFinite(e)?Math.max(t,Math.min(r,e)):n}function Fg(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 Yc(e){const t=v1(),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:ld(r.fontSize,S_,__,t.fontSize),rendererMode:n==="auto"||n==="webgl"||n==="canvas"?n:t.rendererMode,fontWeight:Fg(r.fontWeight,t.fontWeight),fontWeightBold:Fg(r.fontWeightBold,t.fontWeightBold),letterSpacing:Math.round(ld(r.letterSpacing,-5,10,t.letterSpacing)),lineHeight:ld(r.lineHeight,1,2,t.lineHeight),minimumContrastRatio:ld(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 cd(e){return e.pointerType==="touch"||e.pointerType==="pen"}class E_{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(!cd(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(!cd(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 u=this.active.get(t.pointerId)??null;this.active.set(t.pointerId,n.name),r=!0,t.preventDefault(),u&&u!==n.name&&this.log("handoff",`${u}->${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 u=this.active.get(t.pointerId);this.active.delete(t.pointerId),this.log("release",n.name,`pid=${t.pointerId}`),this.emitChange("release",t.pointerId,u??null)}}};handlePointerUp=t=>{if(!cd(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(!cd(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 U3=new E_,R_=90,N_=80,M_=70,D_=(e,t)=>{const{scrollMultiplier:r=1.2,maxScrollBoost:n=.8,boostDenominator:i=50,velocityAlpha:l=.15,maxVelocity:u=15,minVelocity:h=.3,decelerationRate:p=.998,enableKinetic:g=!0,shouldCaptureTouch:x,canStartScrollGesture:b,onScroll:w,onScrollWithCoords:A,onTap:k,onClickWithCoords:I,onClaimChange:N,tapThreshold:R=10,gestureName:D="normal-scroll"}=t,O=1.06,q=S.useRef({lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1,pointerId:null,isCurrentlyScrolling:!1,gestureAxis:null}),Y=S.useRef(0),U=S.useRef(0),V=S.useRef(0),me=S.useRef(null),Je=S.useRef(0),ve=S.useRef(!1),_e=S.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),Ze=S.useCallback(()=>{me.current=null,Y.current!==0&&(A&&U.current>0&&V.current>0?A(Y.current,U.current,V.current):w&&w(Y.current),Y.current=0,U.current=0,V.current=0)},[w,A]),Ve=S.useCallback(()=>{me.current===null&&typeof window<"u"&&(me.current=window.requestAnimationFrame(Ze))},[Ze]),ce=S.useCallback((Ae,z,Oe)=>{Y.current+=Ae,z!==void 0&&Oe!==void 0&&(U.current=z,V.current=Oe),Ve()},[Ve]),ke=S.useCallback(Ae=>{if(!Ae||!w)return!1;const z=w(Ae);return z?Je.current=0:Je.current++,z},[w]),ot=S.useCallback(Ae=>{ve.current!==Ae&&(ve.current=Ae,N?.(Ae))},[N]),Ie=S.useCallback(()=>{const Ae=q.current;Ae.rafId!==null&&typeof window<"u"&&window.cancelAnimationFrame(Ae.rafId),Ae.rafId=null,me.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(me.current),me.current=null,Y.current=0},[]),de=S.useRef(k);de.current=k;const qe=S.useRef(I);qe.current=I;const xe=S.useRef(x);xe.current=x;const te=S.useCallback(()=>{const Ae=e.current;if(!Ae||!("PointerEvent"in window))return()=>{};const z=q.current,Oe={name:D,priority:M_,get container(){return e.current??void 0},onPointerDown:(X,Be)=>(X.pointerType!=="touch"||(z.pointerId=X.pointerId,z.startX=Be.startX,z.startY=Be.startY,z.didMove=!1,z.gestureAxis=null,z.lastY=X.clientY,z.lastTime=_e(),z.velocity=0,Ie()),!1),onPointerMove:(X,Be)=>{if(X.pointerType!=="touch"||z.pointerId!==X.pointerId||!z.lastY||!z.lastTime)return"neutral";const st=X.clientX,be=X.clientY,je=_e(),wt=je-z.lastTime,Te=be-z.lastY;if(z.startX!==null&&z.startY!==null){const $e=st-z.startX,pt=be-z.startY;if(!z.didMove&&Math.hypot($e,pt)>=R&&(z.didMove=!0),z.gestureAxis===null&&z.didMove){const Tt=Math.abs($e),Ct=Math.abs(pt);Tt>Ct*O?z.gestureAxis="x":Ct>Tt*O&&(z.gestureAxis="y")}if(z.gestureAxis==="x")return z.isCurrentlyScrolling=!1,ot(!1),z.lastY=be,z.lastTime=je,Be?"release":"neutral";if(z.gestureAxis===null)return z.lastY=be,z.lastTime=je,"neutral"}if(z.gestureAxis==="y"&&!Be&&!(b?.()??!0))return z.lastY=be,z.lastTime=je,ot(!1),"neutral";const pe=Te/Math.max(wt,1);if(z.velocity=z.velocity*(1-l)+pe*l,z.velocity=Math.max(-u,Math.min(u,z.velocity)),Math.abs(Te)>1){if(!Be)return ot(!0),z.lastY=be,z.lastTime=je,"claim";z.isCurrentlyScrolling=!0;const $e=r+Math.min(n,Math.abs(Te)/i),pt=-Te*$e;ce(pt,st,be),ot(!0)}return z.lastY=be,z.lastTime=je,Be?"claim":"neutral"},onPointerUp:X=>{if(X.pointerType!=="touch"||z.pointerId!==X.pointerId)return;const Be=z.isCurrentlyScrolling;z.isCurrentlyScrolling=!1,ot(!1);const st=z.rafId!==null||me.current!==null;!z.didMove&&!st&&z.startX!==null&&z.startY!==null&&de.current?.(z.startX,z.startY),!z.didMove&&!st&&z.startX!==null&&z.startY!==null&&qe.current?.(z.startX,z.startY),z.pointerId=null,z.startX=null,z.startY=null;const be=z.gestureAxis==="x";if(z.gestureAxis=null,g&&Be&&!be&&Math.abs(z.velocity)>h&&z.didMove){const je=()=>{const wt=_e(),Te=wt-(z.lastTime||wt);if(z.lastTime=wt,z.velocity*=Math.pow(p,Te),Math.abs(z.velocity)<h){z.velocity=0,Ie();return}if(!ke(-z.velocity*Te)&&Je.current>2){z.velocity=0,Ie();return}z.rafId=requestAnimationFrame(je)};z.rafId=requestAnimationFrame(je)}},onPointerCancel:X=>{X.pointerType!=="touch"||z.pointerId!==X.pointerId||(z.isCurrentlyScrolling=!1,ot(!1),z.pointerId=null,z.startX=null,z.startY=null,z.gestureAxis=null,Ie())}},nt=U3.register(Oe),Re=Ae.style.touchAction;return Ae.style.touchAction="none",()=>{ot(!1),nt(),Ae.style.touchAction=Re,Ie()}},[e,D,r,n,i,l,u,h,p,_e,Ie,ke,ce,R,g,ot,b]),re=S.useCallback(()=>{const Ae=e.current;if(!Ae)return()=>{};const z=q.current,Oe=Be=>{Be.touches.length===1&&((x?.()??!0)&&Be.cancelable&&Be.preventDefault(),z.isCurrentlyScrolling=!1,z.gestureAxis=null,z.lastY=Be.touches[0].clientY,z.startX=Be.touches[0].clientX,z.startY=Be.touches[0].clientY,z.didMove=!1,z.velocity=0,Ie())},nt=Be=>{if(Be.touches.length!==1)return;const st=Be.touches[0].clientX,be=Be.touches[0].clientY;if(z.startX!==null&&z.startY!==null){const wt=st-z.startX,Te=be-z.startY;if(!z.didMove&&Math.hypot(wt,Te)>=R&&(z.didMove=!0),z.gestureAxis===null&&z.didMove){const pe=Math.abs(wt),$e=Math.abs(Te);pe>$e*O?z.gestureAxis="x":$e>pe*O&&(z.gestureAxis="y")}if(z.gestureAxis==="x"){z.isCurrentlyScrolling=!1,z.lastY=be;return}if(z.gestureAxis===null){(x?.()??!1)&&Be.cancelable&&Be.preventDefault(),z.lastY=be;return}}if(Be.preventDefault(),!z.lastY){z.lastY=be;return}const je=be-z.lastY;if(Math.abs(je)>1){z.isCurrentlyScrolling=!0;const wt=r+Math.min(n,Math.abs(je)/i),Te=-je*wt;ce(Te,st,be)}z.lastY=be},Re=Be=>{if(!Be.changedTouches?.[0])return;const be=z.isCurrentlyScrolling;z.isCurrentlyScrolling=!1;const je=z.rafId!==null||me.current!==null;!z.didMove&&!je&&k&&z.startX!==null&&z.startY!==null&&k(z.startX,z.startY),!z.didMove&&!je&&I&&z.startX!==null&&z.startY!==null&&I(z.startX,z.startY),z.startX=null,z.startY=null;const wt=z.gestureAxis==="x";if(z.gestureAxis=null,g&&be&&!wt&&z.didMove&&Math.abs(z.velocity)>h){const Te=()=>{if(z.velocity*=Math.pow(p,16),Math.abs(z.velocity)<h){z.velocity=0,Ie();return}if(!ke(-z.velocity*16)&&Je.current>2){z.velocity=0,Ie();return}z.rafId=requestAnimationFrame(Te)};z.rafId=requestAnimationFrame(Te)}};Ae.addEventListener("touchstart",Oe,{passive:!1}),Ae.addEventListener("touchmove",nt,{passive:!1}),Ae.addEventListener("touchend",Re,{passive:!1}),Ae.addEventListener("touchcancel",Re,{passive:!1});const X=Ae.style.touchAction;return Ae.style.touchAction="none",()=>{Ae.removeEventListener("touchstart",Oe),Ae.removeEventListener("touchmove",nt),Ae.removeEventListener("touchend",Re),Ae.removeEventListener("touchcancel",Re),Ae.style.touchAction=X,Ie()}},[e,r,n,i,h,p,Ie,ke,ce,k,I,R,x,g]),ge=S.useCallback(()=>{Ie();const Ae=typeof window<"u"&&"PointerEvent"in window,z=Ae?te():()=>{},Oe=Ae?()=>{}:re();return()=>{z(),Oe(),Ie()}},[te,re,Ie]),ze=S.useCallback(()=>q.current.isCurrentlyScrolling||q.current.rafId!==null||me.current!==null,[]),Ke=S.useCallback(()=>{Ie();const Ae=q.current;Ae.isCurrentlyScrolling=!1,Ae.velocity=0,Ae.lastY=null,Ae.lastTime=null,Ae.startX=null,Ae.startY=null,Ae.pointerId=null,Ae.didMove=!1,Ae.gestureAxis=null},[Ie]);return{setupTouchScroll:ge,isScrolling:ze,stopAllScroll:Ke}};function Ug(e){const{name:t,priority:r}=e,n=y.useRef(e.onPointerDown),i=y.useRef(e.onPointerMove),l=y.useRef(e.onPointerUp),u=y.useRef(e.onPointerCancel),h=y.useRef(e.container);n.current=e.onPointerDown,i.current=e.onPointerMove,l.current=e.onPointerUp,u.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){u.current?.(x)}};return U3.register(p)},[t,r])}var Os;(function(e){e.Light="light",e.Medium="medium",e.Heavy="heavy",e.Success="success",e.Warning="warning",e.Error="error"})(Os||(Os={}));Os.Light,Os.Medium,Os.Heavy,Os.Success,Os.Warning,Os.Error;Os.Light,Os.Medium,Os.Heavy,Os.Success,Os.Warning,Os.Error;Os.Light,Os.Medium,Os.Heavy,Os.Success,Os.Warning,Os.Error;const B_=()=>typeof navigator<"u"&&typeof navigator.vibrate=="function",Q_=()=>typeof document<"u"&&!!document.body,j_=()=>{if(Q_())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{}},$g=e=>Array.isArray(e)?[...e]:[e],P_=e=>{if(B_()){try{const i=$g(e),l=i.length===1?i[0]:i;navigator.vibrate(l)}catch{}return}const t=$g(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(j_,n),n+=i+l},ho=e=>P_(e),O_=({message:e})=>{const{t}=Jr();return a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsxs("div",{className:"rounded-full bg-surface-2 px-4 py-2 flex items-center gap-3 shadow-sm",children:[a.jsx("div",{className:"w-5 h-5 border-2 border-primary/30 border-t-primary rounded-full animate-spin"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:e??t("terminal.loading")})]})})},F_=()=>{const{t:e}=Jr();return a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsxs("div",{className:"rounded-full bg-surface-2 px-4 py-2 flex items-center gap-3 shadow-sm",children:[a.jsx("div",{className:"w-5 h-5 border-2 border-primary/30 border-t-primary rounded-full animate-spin"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:e("terminal.initializing")})]})})},U_=({message:e,onRetry:t})=>{const{t:r}=Jr();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 Fd(e){return Array.from(e)}function zg(e,t,r){return Math.max(t,Math.min(r,e))}function $_(e,t,r,n){const i=Fd(e),l=Fd(t);let u=zg(r,0,i.length);const h=zg(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;u>A?w.push({left:u-A}):u<A&&w.push({right:A-u}),u=A,x>0&&(w.push({backspace:x}),u=p),b&&(w.push({insert:b}),u+=Fd(b).length)}return u>h?w.push({left:u-h}):u<h&&w.push({right:h-u}),u=h,{ops:w,cursor:u}}function Hg(e){const t=e.value,r=e.selectionStart??t.length;return Fd(t.slice(0,r)).length}const Jd=16,z_=10,Wg=1.5,H_=1.8,Gg=240,W_=125,G_=92;function V_(e,t,r){const n=Math.hypot(e,t),i=Math.abs(e),l=Math.abs(t),u=()=>i>=l*Wg?e>0?"right":"left":l>=i*Wg?t>0?"down":"up":"";if(r==="")return n>Jd?u():"";if(n<z_)return"";if(n<=Jd)return r;const h=u();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)*H_?h:r}function q_(e){const t=G_-Jd,r=Math.min(Math.max((e-Jd)/t,0),1);return Gg-r*(Gg-W_)}const Y_="termdock-open-terminal-directory",Dp=/(?:\\[ \t]|[^\s`"'<>|()[\]{}=,:;!?:,;!?。、“”‘’])+/gu,Z_=new RegExp(`^( *)(${Dp.source})`,"u"),K_=/[,;:!?]+$/u,X_=/^[a-z][a-z\d+.-]*:\/\//iu;function J_(e){return!e||e==="/"||X_.test(e)||e.startsWith("//")?!1:e.startsWith("/")||e.startsWith("~/")||e.startsWith("./")||e.startsWith("../")?!0:e.endsWith("/")||/^[^/:]+\/[^/:]+\/(?:[^/:]+\/?)+$/u.test(e)}function $3(e){const t=[];Dp.lastIndex=0;let r;for(;(r=Dp.exec(e))!==null;){const i=r[0].replace(K_,"");if(!J_(i))continue;const l=e.slice(r.index+i.length).match(/^:(\d+)(?::\d+)?(?=$|[\s:,,;;。!!??)\]}`])/u),u=l?Number(l[1]):void 0,h=u!==void 0&&Number.isSafeInteger(u)&&u>0;t.push({text:i,...h?{line:u}:{},startIndex:r.index,endIndex:r.index+i.length+(h?l[0].length:0)})}return t}function If(e){const t=[];for(const r of e.split("/"))!r||r==="."||(r===".."?t.pop():t.push(r));return`/${t.join("/")}`}function eL(e){return e.match(/^\/(?:home|Users)\/[^/]+/u)?.[0]??null}function tL(e,t){const r=e.replace(/\\([ \t])/gu,"$1").replace(/\/+$/u,"")||"/";if(r.startsWith("/"))return If(r);if(r==="~"||r.startsWith("~/")){const n=t?eL(t):null;return n?If(`${n}/${r.slice(2)}`):null}return t?.startsWith("/")?If(`${t}/${r}`):null}function ud(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),u=$3(i).at(-1),h=l.match(Z_);if(!u||u.endIndex!==i.length||!u.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 I=x;I<n.length;I+=1){const N=n.getCell(I);if(N?.getWidth()!==0){if(!N||/[\s/:]/u.test(N.getChars()||" "))break;b+=N.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 rL(e,t){const r=e.buffer.active;let n=t-1;if(!r.getLine(n))return null;for(;n>0&&(r.getLine(n)?.isWrapped||ud(e,n)!==null);)n-=1;let i=t-1;for(;i+1<r.length&&(r.getLine(i+1)?.isWrapped||ud(e,i+1)!==null);)i+=1;let l="";const u=[],h=[];for(let g=n;g<=i&&l.length<=2048;g+=1){const x=r.getLine(g);if(!x)break;const b=g>n?ud(e,g)??0:0;let w=x.length;if(g<i&&ud(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 I=k.getChars()||" ";l+=I;for(let N=0;N<I.length;N+=1)u.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:u.slice(0,p),endPositions:h.slice(0,p)}}function nL(e,t){return{provideLinks(r,n){const i=rL(e,r);if(!i){n(void 0);return}const l=$3(i.text).map(u=>({text:u.text,range:{start:i.startPositions[u.startIndex]??{x:u.startIndex+1,y:r},end:i.endPositions[u.endIndex-1]??{x:u.endIndex,y:r}},activate:()=>u.line===void 0?t(u.text):t(u.text,u.line)}));n(l.length>0?l:void 0)}}}function Vg(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),u=n===null?l:Math.min(l,n),h=Math.max(0,u-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),u=n===null?l:Math.min(l,n),h=Math.max(0,u-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 qg(e,t=e.rows){const n=e._core?._bufferService?.buffers;return n?Vg(n.normal,t)+Vg(n.alt,t):0}function dd(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:0}function sL(e,t,r){const n=dd(e.fontBoundingBoxAscent)+dd(e.fontBoundingBoxDescent),i=dd(e.actualBoundingBoxAscent)+dd(e.actualBoundingBoxDescent);return Math.max(1,Math.floor(Math.ceil(n||i||t)*r))}const ql=8,hd=36,Yg=10,iL=1.08,aL=1.16,fd=6,oL=.94,lL=.08,cL=.12,uL=88,dL=36,hL=10,fL=14,pL=52;function N0(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 mL=80,gL=8;function pd(e,t){return e.modes?.applicationCursorKeysMode===!0?`\x1BO${t}`:`\x1B[${t}`}function xL(e){return e.nativeEvent.isComposing||e.isComposing===!0||e.keyCode===229}function bL(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 yL(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,u=1;for(let g=i+t.length;g<e.length;g+=1){const x=e.charCodeAt(g);if(x===7){l=g,u=1;break}if(x===27&&g+1<e.length&&e[g+1]==="\\"){l=g,u=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=bL(g);x!==null&&navigator.clipboard?.writeText(x).catch(()=>{})}}r=l+u}return{cleaned:n,remainder:""}}function vL(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 wL=new Set(["visibility","bfcache","online"]),AL=5e5,TL=1e5,M0=260,D0=140,Zg=80;function CL(e){return!e}let Bc=null;const SL=[{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:"⏺⏸⏹✓✗"}],_L=()=>{if(Bc)return Bc;if(typeof document>"u"||!("fonts"in document))return Bc=Promise.resolve(),Bc;const e=document.fonts;return Bc=Promise.allSettled(SL.map(({font:r,text:n})=>e.load(r,n))).then(()=>e.ready).then(()=>{}).catch(()=>{}),Bc},Kg=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 Xg(e){return e==="normal"||e==="bold"?e:Math.max(1,Math.min(1e3,Math.round(e)))}function Yl(e,t,r){const n=e?.dimensions?.css.cell.height;return Math.max(8,Math.round(n||t*r))}function LL(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 Jg=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 u=window.devicePixelRatio||1,h=`${r}::${n}::${i}::${u}::${t}`;let p=Jg.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"),I=(Math.floor(A.width*u)+Math.round(n))/u,N=sL(A,r,i);I>=1&&N>=1&&(p={cellWidth:I,cellHeight:N},Jg.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 e2(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 IL(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 u=t.getLine(l);u&&i.push(u.translateToString(!0))}return i.join(`
|
|
64
|
-
`).replace(/\s+$/g,"")}function B0(e,t,r){const n=nc(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 Ef(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),u=Math.max(n,i)+1,h=l%e.cols,p=Math.floor(l/e.cols);return e.select(h,p,u-l),!0}function t2(e){if(typeof document>"u")return 0;const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e)||"0");return Number.isFinite(t)?t:0}function EL(e,t,r,n,i=!0){if(typeof window>"u")return{left:0,top:0};const l=window.visualViewport,u=l?.offsetLeft??0,h=l?.offsetTop??0,p=l?.width??window.innerWidth,g=l?.height??window.innerHeight,x=t2("--safe-top-inset"),b=t2("--safe-bottom-inset"),w=n?r_(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 N=nc(n.terminal),{start:R,end:D}=Xd(n.anchor,n.focus,n.terminal.cols),O=Od(n.terminal,R),q=Od(n.terminal,D);if(O&&A.push({left:O.x-24,top:O.y-48,right:O.x+24,bottom:O.y+4}),q&&N){const Y=q.y+N.cellH;A.push({left:q.x-24,top:Y-4,right:q.x+24,bottom:Y+48})}if(w){const Y=n.anchor.row*n.terminal.cols+n.anchor.col,U=n.focus.row*n.terminal.cols+n.focus.col,V=Y<=U,me=w.right-w.left,ve=n.anchor.row===n.focus.row?V?w.left+me*.25:w.right-me*.25:(w.left+w.right)/2,_e=Od(n.terminal,n.focus),Ze=_e&&N?_e.y+N.cellH/2:t;k={vertical:n.focus.row<n.anchor.row?"below":"above",alignX:ve,focusX:_e?.x??e,focusY:Ze}}}const I=n_({clientX:e,clientY:t,viewport:{left:u,top:h+x,right:u+p,bottom:h+g-b},terminal:r,width:uL,height:dL,margin:hL,fingerGap:fL,selection:w,avoid:A,preference:k,selectionGap:pL});return{left:I.left-r.left,top:I.top-r.top}}const z3=S.forwardRef(({sessionKey:e,sessionId:t,isLayoutVisible:r=!0,chunks:n,onInput:i,onResize:l,onFlowControl:u,onTmuxScroll:h,tmuxScrollSensitivity:p=.55,onDoubleTap:g,onInputFocusChange:x,onMobileLongPressCopyResult:b,onMobilePasteResult:w,onReadyChange:A,onSizeSynchronizedChange:k,onWritesSettled:I,onWriteProgress:N,onCursorPositionChange:R,onDirectoryLinkActivate:D,terminalSettings:O,theme:q,className:Y,enableTouchScroll:U,mobileLongPressMode:V="arrows",autoFocus:me=!0,cursorVisible:Je=!0,suppressSmoothScroll:ve=!1},_e)=>{const{t:Ze}=Jr(),Ve=S.useRef(null),ce=S.useRef(null),ke=S.useRef(null),ot=S.useRef(null),Ie=S.useRef(null),de=S.useRef(ve);de.current=ve;const qe=S.useRef(null),xe=S.useRef(i),te=S.useRef(l),re=S.useRef(x),ge=S.useRef(u),ze=S.useRef(A);ze.current=A;const Ke=S.useRef(k);Ke.current=k;const Ae=S.useRef(I);Ae.current=I;const z=S.useRef(N);z.current=N;const Oe=S.useRef(R);Oe.current=R;const nt=S.useRef(D);nt.current=D;const Re=S.useRef(O.rendererMode),X=S.useRef(""),Be=S.useRef(0),st=S.useRef(!1),be=S.useRef(null),je=S.useRef(0),wt=S.useRef(0),Te=S.useRef(!1),pe=S.useRef(null),$e=S.useRef(null),pt=S.useRef(null),Tt=S.useRef(!1),Ct=S.useRef(null),rr=S.useRef(()=>{}),ir=S.useRef(null),yt=S.useRef(null),bt=S.useRef(void 0),_t=S.useRef(null),Qt=S.useRef(!1),Et=S.useRef(0),Ht=S.useRef(""),ne=S.useRef(null),Pe=S.useRef(null),it=S.useRef(!1),jt=S.useRef(typeof window<"u"?window.devicePixelRatio:1),ue=S.useRef(!1),Nt=S.useRef(!1),qt=S.useRef(null),Se=S.useRef(""),Ce=S.useRef(0),ut=S.useRef(null),Ge=S.useRef(null),dr=S.useRef(null),Rt=S.useRef(0),un=S.useRef(0),It=S.useRef(0),jn=S.useRef(null),is=S.useRef(0),Pn=S.useRef(0),Tr=S.useRef(!1),In=S.useRef(0),[,Br]=S.useReducer(L=>L+1,0),[ie,$r]=S.useReducer(L=>L+1,0),[ft,hr]=S.useState("loading"),[Ls,Un]=S.useState(null),[as,Pr]=S.useState(null);S.useEffect(()=>{const L=Q=>{(Q.target instanceof Element?Q.target.closest("[data-termdock-terminal-dropzone]"):null)?.dataset.termdockTerminalDropzone===e&&Pr(String(Q.detail))};return window.addEventListener("termdock:file-drop-error",L),()=>window.removeEventListener("termdock:file-drop-error",L)},[e]);const Yt=S.useMemo(()=>Kc("terminal"),[]),[Xn,dn]=S.useState(!0),[kr,Or]=S.useState(!1);S.useEffect(()=>{if(!Xn&&ft!=="loading"){Or(!1);return}const L=window.setTimeout(()=>Or(!0),160);return()=>window.clearTimeout(L)},[Xn,ft]);const[Ur,qr]=S.useState(!1),[An,Yr]=S.useState({visible:!1,activeDir:""}),[jr,En]=S.useState(null),Z=S.useRef(null),He=S.useRef(!1),xt=S.useRef({active:!1,anchor:null,focus:null,dragging:null}),[cr,Gt]=S.useState(null),[At,hn]=S.useState({x:0,y:0,cellW:8,cellH:17,cursorX:0}),nn=S.useRef(At);nn.current=At;const On=S.useRef(null),[rn,Tn]=S.useState({active:!1,text:""}),Cn=S.useRef(null),$n=S.useRef(null);xe.current=i,te.current=l,re.current=x,ge.current=u,Re.current=O.rendererMode;const ar=S.useRef(me);ar.current=me;const us=S.useRef(Je);us.current=Je;const yr=S.useRef(U);yr.current=U;const Qr=S.useRef(r);Qr.current=r;const ds=CL(!!h),{rendererMode:Ln,fontFamily:Rn,fontSize:zr,fontWeight:Jn,fontWeightBold:es,letterSpacing:ur,lineHeight:Hr,minimumContrastRatio:on,drawBoldTextInBrightColors:Ms,unicodeVersion:yn,customGlyphs:$,rescaleOverlappingGlyphs:he,fontLigatures:De,enableImages:Ee,smoothScrolling:Me}=O,ht=Ln==="webgl",vt=S.useCallback(()=>{Z.current!==null&&(clearTimeout(Z.current),Z.current=null),En(null)},[]),lt=S.useCallback((L,Q)=>{Z.current!==null&&(clearTimeout(Z.current),Z.current=null),He.current=!1,En(L),!Q?.persistent&&(Z.current=setTimeout(()=>{Z.current=null,En(null)},3e3))},[]);S.useEffect(()=>{if(!jr)return;const L=()=>{xt.current.active||vt()},Q=()=>vt();return window.addEventListener("scroll",L,!0),window.addEventListener("resize",Q),document.addEventListener("visibilitychange",Q),()=>{window.removeEventListener("scroll",L,!0),window.removeEventListener("resize",Q),document.removeEventListener("visibilitychange",Q)}},[vt,jr]),S.useEffect(()=>()=>{Z.current!==null&&(clearTimeout(Z.current),Z.current=null)},[]);const rt=S.useCallback(()=>{const L=ke.current,Q=Ve.current,P=xt.current;if(!L||!Q||!P.active||!P.anchor||!P.focus){Gt(null);return}const W=Q.getBoundingClientRect(),Ue=nc(L)?.cellH??16,{start:Le,end:ct}=Xd(P.anchor,P.focus,L.cols),dt=P.dragging==="start"?P.focus:P.dragging==="end"?P.anchor:Le,Pt=P.dragging==="end"?P.focus:P.dragging==="start"?P.anchor:ct,vr=(sn,Mn)=>{const _n=Od(L,sn);return _n?{left:_n.x-W.left,top:Mn?_n.y-W.top:_n.y+Ue-W.top}:null};Gt({start:vr(dt,!0),end:vr(Pt,!1)})},[]),mt=S.useCallback(L=>{const Q=ke.current,P=Ve.current,W=xt.current;if(!Q||!P||!W.active||!W.anchor||!W.focus)return;if(W.dragging){vt();return}const Ue=P.getBoundingClientRect(),Le={x:(Ue.left+Ue.right)/2,y:(Ue.top+Ue.bottom)/2};lt(EL(L?.x??Le.x,L?.y??Le.y,Ue,{terminal:Q,anchor:W.anchor,focus:W.focus},L!==void 0),{persistent:!0})},[vt,lt]),fr=S.useCallback(()=>{const L=xt.current;L.active=!1,L.anchor=null,L.focus=null,L.dragging=null,Gt(null),vt()},[vt]);S.useEffect(()=>{if(!cr)return;const L=ke.current;if(!L)return;const Q=L.onScroll(()=>{rt(),mt()}),P=L.onResize(()=>fr());return()=>{Q.dispose(),P.dispose()}},[cr,rt,mt,fr]),S.useEffect(()=>{U||re.current?.(!1)},[U]);const gt=S.useCallback((L,Q,P)=>{const W=(P.element?.offsetWidth||0)/P.cols||8,Ue=(P.element?.offsetHeight||0)/P.rows||16,Le=Math.max(1,Math.min(P.cols,Math.floor(L/W)+1)),ct=Math.max(1,Math.min(P.rows,Math.floor(Q/Ue)+1));return{x:Le,y:ct}},[]),Kt=S.useCallback((L,Q,P)=>{const W=ke.current;if(!W)return!1;const Ue=L>0?-1:1;if(W.modes?.mouseTrackingMode!=="none"){let Le,ct;if(Q!==void 0&&P!==void 0){const vr=gt(Q,P,W);Le=vr.x,ct=vr.y}else Le=W.buffer.active.cursorX+1,ct=W.buffer.active.cursorY+1;const Pt=`\x1B[<${Ue>0?64:65};${Le};${ct}M`;return xe.current(Pt),!0}if(W.buffer.active.type==="alternate"){const Le=Ue>0?"\x1B[A":"\x1B[B";return xe.current(Le),!0}return null},[gt]),at=S.useCallback(L=>{const Q=ke.current;if(!Q)return!1;const P=Yl(ke.current,zr,Hr),W=Et.current+L,Ue=Math.trunc(W/P);return Et.current=W-Ue*P,Ue!==0?(Q.scrollLines(Ue),!0):!1},[zr,Hr]),nr=S.useCallback(L=>{if(!ke.current)return!1;const W=Yl(ke.current,zr,Hr)/Math.max(.1,p),Ue=Et.current+L;let Le=Math.trunc(Ue/W);if(Et.current=Ue-Le*W,Le===0&&Math.abs(Ue)>=W/3&&(Le=Ue>0?1:-1,Et.current=0),Le===0)return!1;const ct=Le>0?"down":"up",dt=Math.max(1,Math.min(Math.abs(Le),10));return h(ct,dt),!0},[zr,Hr,h,p]),Ar=S.useRef(Kt);Ar.current=Kt;const er=S.useRef(at);er.current=at;const Gr=S.useRef(nr);Gr.current=nr;const Mr=S.useRef(h);Mr.current=h;const Sr=S.useRef({pointerId:null,tmuxActiveAtDown:!1});S.useEffect(()=>{if(!U)return;const L=Ve.current;if(!L)return;const Q=W=>{W.pointerType==="touch"&&(Sr.current.pointerId=W.pointerId,Sr.current.tmuxActiveAtDown=!!Mr.current)},P=W=>{W.pointerType==="touch"&&Sr.current.pointerId===W.pointerId&&(Sr.current.pointerId=null,Sr.current.tmuxActiveAtDown=!1)};return L.addEventListener("pointerdown",Q,{capture:!0,passive:!0}),L.addEventListener("pointerup",P,{capture:!0,passive:!0}),L.addEventListener("pointercancel",P,{capture:!0,passive:!0}),()=>{L.removeEventListener("pointerdown",Q,!0),L.removeEventListener("pointerup",P,!0),L.removeEventListener("pointercancel",P,!0)}},[U]);const Nn=S.useCallback(()=>{if(Tr.current)return!1;const L=Sr.current;return L.pointerId!==null?!L.tmuxActiveAtDown:!Mr.current},[]),F=S.useCallback((L,Q,P)=>{const W=Ar.current(L,Q,P);return W!==null?W:Mr.current?Gr.current(L):er.current(L)},[]),ae=S.useCallback((L,Q)=>{if(performance.now()<=Pn.current){Pn.current=0;return}const P=ke.current;if(P&&P.modes?.mouseTrackingMode!=="none"){const W=gt(L,Q,P),Ue=W.x,Le=W.y,ct=`\x1B[<0;${Ue};${Le}M`,dt=`\x1B[<0;${Ue};${Le}m`;xe.current(ct),xe.current(dt)}},[gt]),le=S.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),Qe=S.useCallback((L=700)=>{jn.current=null,is.current=le()+L},[le]),Mt=S.useCallback(()=>yr.current&&le()<=is.current,[le]),Ut=S.useCallback(()=>{const L=yt.current;return!L||typeof document>"u"?!1:document.activeElement===L},[]),Xt=S.useCallback(()=>{if(typeof window>"u")return!1;const L=dt=>{if(typeof document>"u")return 0;const Pt=Number.parseFloat(document.documentElement.style.getPropertyValue(dt)||"0");return Number.isFinite(Pt)?Pt:0},Q=L("--kb-height");if(Q>0)return Q>=Zg;const P=window.visualViewport;if(!P)return!1;const W=L("--app-base-vh")||window.innerHeight,Ue=L("--safe-bottom-inset"),Le=P.height+P.offsetTop;return Math.max(0,Math.round(W-Le-Ue))>=Zg},[]),pr=S.useCallback(()=>{ut.current!==null&&(clearTimeout(ut.current),ut.current=null),Ge.current=null},[]),Dr=S.useCallback(L=>{const Q=ke.current;let P="";for(const W of L)W.left&&(P+=(Q?pd(Q,"D"):"\x1B[D").repeat(W.left)),W.right&&(P+=(Q?pd(Q,"C"):"\x1B[C").repeat(W.right)),W.backspace&&(P+="".repeat(W.backspace)),W.insert&&(P+=W.insert);return P},[]),fn=S.useCallback(L=>{const Q=L.value,P=N0(Q),W=Se.current;if(!(yr.current&&!P.includes("\r")&&!W.includes("\r"))){if(P===W)return;let vr=0;for(;vr<W.length&&vr<P.length&&W[vr]===P[vr];)vr++;const sn=W.length-vr;sn>0&&xe.current("".repeat(sn));const Mn=P.slice(vr);if(Mn){try{ke.current?.clearSelection()}catch{}xe.current(Mn)}Se.current=P,Ce.current=Array.from(P).length;return}const Le=Hg(L),{ops:ct,cursor:dt}=$_(W,P,Ce.current,Le),Pt=Dr(ct);if(Pt){if(ct.some(vr=>vr.insert))try{ke.current?.clearSelection()}catch{}xe.current(Pt)}Se.current=P,Ce.current=dt},[Dr]),j=S.useCallback((L,Q)=>{const P=L.value,W=N0(P),Ue=Se.current;if(W===Ue){pr();return}let Le=0;for(;Le<Ue.length&&Le<W.length&&Ue[Le]===W[Le];)Le++;const ct=Ue.length-Le;if(U&&!Q?.immediate&&ct>=gL){Ge.current=L,ut.current!==null&&clearTimeout(ut.current),ut.current=setTimeout(()=>{ut.current=null;const Pt=Ge.current;Ge.current=null,Pt&&fn(Pt)},mL);return}pr(),fn(L)},[pr,U,fn]),ye=S.useCallback(L=>{j(L,{immediate:!0}),xe.current("\r"),L.value="",Se.current="",Ce.current=0},[j]),Ne=S.useCallback((L,Q,P)=>{if(!L)return;pr();const W=Q??yt.current;W&&(W.value=""),Se.current="",Ce.current=0;try{ke.current?.clearSelection()}catch{}if(fr(),P?.paste&&/[\r\n]/.test(L)){const Ue=P.submitAfterPaste??L.endsWith("\r"),Le=o_(L,Ue);return xe.current(Le,{skipModifierTransform:!0,consumeModifier:P?.consumeModifier,targeted:P?.targeted})}return xe.current(L,{skipModifierTransform:!0,consumeModifier:P?.consumeModifier,targeted:P?.targeted})},[pr]),tt=S.useCallback((L,Q)=>{const P=N0(L);return P?(Pr(null),Xh(P)||(Ne(P,Q,{paste:!0,submitAfterPaste:!1}),vt()),!0):!1},[vt,Ne]);S.useEffect(()=>Xv(L=>{if(L.sessionKey!==e||L.paths.length===0)return;const Q=L.paths.map(K0).join(" ");Ne(`${Q} `);try{yt.current?.focus({preventScroll:!0})}catch{}}),[Ne,e]);const Lt=S.useCallback(async(L,Q)=>{Pr(null);try{const P=await rT(L);return Xh(`${K0(P)} `)||(Ne(`${K0(P)} `,Q),vt()),!0}catch(P){return Pr(P instanceof Error?P.message:"Image upload failed"),!1}},[vt,Ne]),Zt=S.useCallback(async(L,Q)=>{Pr(null);try{const P=await sT(L);if(!P.length)return!1;const W=`${P.map(K0).join(" ")} `;return Xh(W)||(Ne(W,Q),vt()),!0}catch(P){return Pr(P instanceof Error?P.message:"File upload failed"),!1}},[vt,Ne]),Vt=S.useCallback(async L=>{Pr(null);try{if(fo()?.readClipboardFiles){const W=await nT();if(W.length)return Zt(W,L)}if(!fo()?.readClipboardImage){if(typeof navigator.clipboard?.read=="function"){const W=await navigator.clipboard.read(),Ue=await Wm({read:async()=>W});if(Ue)return Lt(Ue,L);for(const Le of W){if(!Le.types.includes("text/plain"))continue;const ct=await(await Le.getType("text/plain")).text();return tt(ct,L)}return!1}return navigator.clipboard?.readText?tt(await navigator.clipboard.readText(),L):!1}const Q=await Wm(navigator.clipboard);if(Q)return Lt(Q,L);if(!navigator.clipboard?.readText)return!1;const P=await navigator.clipboard.readText();return tt(P,L)}catch(Q){return Pr(Q instanceof Error?Q.message:"Clipboard read failed"),!1}},[Zt,Lt,tt]),zt=S.useCallback(L=>{if(On.current&&!L?.repositionFrozen)return null;const Q=ke.current;if(!Q||!Q.element)return null;const P=nc(Q),Ue=Q.element.querySelector(".xterm-screen")??Q.element,Le=Ue.getBoundingClientRect(),ct=P?.cellW??(Le.width>0&&Q.cols>0?Le.width/Q.cols:8),dt=P?.cellH??(Le.height>0&&Q.rows>0?Le.height/Q.rows:17),Pt=yt.current;let vr=bt.current;Pt&&(vr===void 0||vr!==null&&(!vr.isConnected||!vr.contains(Pt)))&&(vr=i_(Pt),bt.current=vr);const sn=Q.buffer.active,Mn=sn.cursorX*ct,_n=sn.cursorY*dt,Vn=a_(Ue,vr??null,Mn,_n),Nr=Math.round(Vn.x),mn=Math.round(Vn.y),wn={x:Nr,y:mn,cellW:ct,cellH:dt,cursorX:sn.cursorX};return nn.current=wn,On.current&&L?.repositionFrozen&&(On.current={...wn}),hn(Ys=>Math.abs(Ys.x-Nr)<.5&&Math.abs(Ys.y-mn)<.5&&Math.abs(Ys.cellW-ct)<.5&&Math.abs(Ys.cellH-dt)<.5&&Ys.cursorX===sn.cursorX?Ys:wn),wn},[]),_r=S.useRef(zt);_r.current=zt,S.useEffect(()=>{if(!U)return;let L=null,Q=null;const P=()=>{L!==null&&window.cancelAnimationFrame(L),Q!==null&&window.cancelAnimationFrame(Q),L=window.requestAnimationFrame(()=>{L=null,Q=window.requestAnimationFrame(()=>{Q=null,_r.current({repositionFrozen:!0})})})};return window.visualViewport?.addEventListener("resize",P),window.visualViewport?.addEventListener("scroll",P),document.addEventListener("termdock:viewport-keyboard-change",P),()=>{L!==null&&window.cancelAnimationFrame(L),Q!==null&&window.cancelAnimationFrame(Q),window.visualViewport?.removeEventListener("resize",P),window.visualViewport?.removeEventListener("scroll",P),document.removeEventListener("termdock:viewport-keyboard-change",P)}},[U]);const bs=S.useCallback(L=>{let Q=0;for(const P of L){const W=P.codePointAt(0)??0,Ue=W>=4352&&W<=4447||W>=11904&&W<=12350||W>=12353&&W<=13311||W>=13312&&W<=19903||W>=19968&&W<=40959||W>=40960&&W<=42191||W>=44032&&W<=55203||W>=63744&&W<=64255||W>=65072&&W<=65103||W>=65280&&W<=65376||W>=65504&&W<=65510||W>=127744&&W<=129791;Q+=Ue?2:1}return Q},[]),ai=S.useCallback(L=>{const Q=ke.current,{cellW:P,cellH:W}=At;if(!Q||!L)return{width:Math.max(1,Math.round(P)),height:Math.max(1,Math.round(W)),whiteSpace:"pre"};const Le=On.current?.cursorX??Q.buffer.active.cursorX,ct=Math.max(1,Q.cols),dt=Math.max(1,bs(L)),Pt=Math.max(1,ct-Le);if(dt<=Pt)return{width:Math.max(1,Math.round(dt*P)),height:Math.max(1,Math.round(W)),whiteSpace:"pre"};const vr=dt-Pt,Mn=1+Math.ceil(vr/ct);return{width:Math.max(1,Math.round(Pt*P)),height:Math.max(1,Math.round(Mn*W)),whiteSpace:"pre-wrap"}},[At,bs]),Fs=S.useCallback(()=>{bt.current=void 0;const L=_r.current();On.current={...L??nn.current}},[]),Fo=S.useCallback(()=>{On.current=null},[]),ks=S.useCallback(L=>{if(!ue.current&&On.current===null)return!1;if(ue.current=!1,On.current=null,pr(),qt.current!==null&&(clearTimeout(qt.current),qt.current=null),Nt.current=!1,L){L.value=Se.current;try{L.setSelectionRange(L.value.length,L.value.length)}catch{}}return Tn(Q=>Q.active||Q.text?{active:!1,text:""}:Q),!0},[pr]),Is=S.useCallback((L,Q)=>{const P=yt.current;if(P)try{P.removeAttribute("readonly");const Ue=typeof document<"u"&&document.activeElement===P&&!Xt(),Le=le(),ct=Le-In.current;In.current=Le,Ue&&ct>600?(P.blur(),P.removeAttribute("readonly"),P.focus(),In.current=le()):P.focus()}catch{}},[Xt,le]),zn=S.useCallback(L=>{un.current=le()+L},[le]),$i=S.useCallback(()=>U?le()<=un.current:!1,[U,le]),Zr=S.useCallback(L=>{zn(L),It.current=le()},[zn,le]),Hn=S.useCallback(()=>{U&&yt.current?.removeAttribute("readonly")},[U]),hs=S.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),[]),Aa=S.useCallback(L=>{if(Hn(),Zr(M0),!U||L.pointerType!=="touch"){jn.current=null;return}const Q=L.target;if(hs(Q)){Qe();return}jr&&!(Q instanceof HTMLElement&&Q.closest('[data-terminal-copy-popover="true"]'))&&vt(),jn.current={pointerId:L.pointerId,startX:L.clientX,startY:L.clientY,moved:!1}},[vt,U,Zr,hs,jr,Hn,Qe]),wi=S.useCallback(L=>{Zr(M0);const Q=jn.current;!Q||Q.pointerId!==L.pointerId||Math.hypot(L.clientX-Q.startX,L.clientY-Q.startY)>12&&(Q.moved=!0)},[Zr]),Uo=S.useCallback(L=>{Zr(D0);const Q=jn.current;jn.current=null,!(!U||L.pointerType!=="touch")&&(!Q||Q.pointerId!==L.pointerId||Q.moved||Mt()||Is(L.clientX,L.clientY))},[U,Zr,Is,Mt]),qa=S.useCallback(()=>{jn.current=null,Zr(D0)},[Zr]),ts=S.useMemo(()=>({enableKinetic:!0}),[]),Ta=S.useRef(()=>!1),Ca=S.useRef(Is);Ca.current=Is;const ul=S.useCallback((L,Q)=>{Mt()||Ca.current(L,Q)},[Mt]),sa=S.useRef(g);sa.current=g;const go=S.useRef(b);go.current=b;const Ii=S.useRef(w);Ii.current=w;const Ya=S.useCallback(()=>{if(He.current)return;He.current=!0,Qe();const L=ke.current,Q=L?.hasSelection()?L.getSelection():"";try{L?.clearSelection()}catch{}na.flushSync(()=>{fr()}),(async()=>{const P=await e2(Q);go.current?.(P)})()},[fr,Qe]),Za=S.useCallback(L=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:L}}))},[]),{setupTouchScroll:Ka,stopAllScroll:Ai}=D_(Ve,{...ts,shouldCaptureTouch:Ta.current,canStartScrollGesture:Nn,onScroll:F,onScrollWithCoords:F,onClickWithCoords:ae,onTap:ul,onClaimChange:Za,tapThreshold:12,gestureName:`normal-scroll:${e}`});S.useEffect(()=>{if(!U)return;yt.current?.setAttribute("readonly","");const L=Ka();return()=>{L()}},[U,Ka]),S.useEffect(()=>{if(!U)return;let L=Xt();const Q=()=>{const P=Xt();if(L&&!P){const W=yt.current;W&&typeof document<"u"&&document.activeElement===W&&(W.setAttribute("readonly",""),W.blur())}L=P};return window.visualViewport?.addEventListener("resize",Q),window.visualViewport?.addEventListener("scroll",Q),document.addEventListener("termdock:viewport-keyboard-change",Q),()=>{window.visualViewport?.removeEventListener("resize",Q),window.visualViewport?.removeEventListener("scroll",Q),document.removeEventListener("termdock:viewport-keyboard-change",Q)}},[U,Xt]),S.useEffect(()=>{if(!U)return;const L=Ve.current;if(!L)return;const Q=W=>{const Le=W.sourceCapabilities?.firesTouchEvents===!0,ct=le()-It.current<=1200;return!Le&&!ct?!1:L.contains(W.target)},P=W=>{Q(W)&&(W.cancelable&&W.preventDefault(),W.stopImmediatePropagation(),W.stopPropagation())};return L.addEventListener("mousedown",P,{capture:!0,passive:!1}),L.addEventListener("mouseup",P,{capture:!0,passive:!1}),L.addEventListener("click",P,{capture:!0,passive:!1}),document.addEventListener("mouseup",P,{capture:!0,passive:!1}),()=>{L.removeEventListener("mousedown",P,!0),L.removeEventListener("mouseup",P,!0),L.removeEventListener("click",P,!0),document.removeEventListener("mouseup",P,!0)}},[U,le]);const Es=S.useRef({pointerId:null,lastX:null,lastY:null,startX:null,startY:null,gestureAxis:null,remainder:0,didScroll:!1,rafId:null,velocity:0,instantSpeed:0}),Vs=S.useCallback(()=>{const L=Es.current;L.rafId!==null&&(cancelAnimationFrame(L.rafId),L.rafId=null)},[]),zi=S.useCallback((L,Q,P)=>{const W=ke.current;if(!W||!W.element||!W.cols||!W.rows)return null;const Ue=Es.current,Le=W.element.getBoundingClientRect(),ct=Q??Ue.lastX??Le.left+Le.width/2,dt=P??Ue.lastY??Le.top+Le.height/2,Pt=ct-Le.left,vr=dt-Le.top,sn=W.element.offsetWidth/W.cols||8,Mn=W.element.offsetHeight/W.rows||16,_n=Math.max(1,Math.min(W.cols,Math.floor(Pt/sn)+1)),Vn=Math.max(1,Math.min(W.rows,Math.floor(vr/Mn)+1));return`\x1B[<${L==="up"?64:65};${_n};${Vn}M`},[]),qs=S.useCallback((L,Q,P,W)=>{if(Q<=0)return;const Ue=zi(L,P,W);Ue&&xe.current(Q===1?Ue:Ue.repeat(Q))},[zi]),ia=S.useRef(qs);ia.current=qs;const xo=S.useRef(()=>{}),Hi=S.useCallback(()=>{const Q=Yl(ke.current,zr,Hr)/Math.max(.1,p),P=1+Es.current.instantSpeed*.1;return Q/Math.min(6,P)},[zr,Hr,p]),Sa=S.useCallback(()=>{const L=Es.current;L.rafId=null;const Q=Hi();let P=0,W=0;for(;P+W<fd&&L.remainder>=Q;)L.remainder-=Q,W++;for(;P+W<fd&&L.remainder<=-Q;)L.remainder+=Q,P++;if(W>0&&qs("down",W),P>0&&qs("up",P),P+W>0)L.rafId=requestAnimationFrame(Sa);else if(L.pointerId!==null&&Math.abs(L.remainder)>=Q/3){const Le=L.remainder>0?"down":"up";L.remainder=0,qs(Le,1),L.rafId=requestAnimationFrame(Sa)}},[Hi,qs]),_a=S.useCallback(()=>{const L=Es.current;L.rafId===null&&typeof requestAnimationFrame<"u"&&(L.rafId=requestAnimationFrame(Sa))},[Sa]),dl=S.useCallback(L=>{if(L.pointerType!=="touch")return!1;Vs();const Q=Es.current;return Q.pointerId=L.pointerId,Q.lastX=L.clientX,Q.lastY=L.clientY,Q.startX=L.clientX,Q.startY=L.clientY,Q.gestureAxis=null,Q.remainder=0,Q.velocity=0,Q.instantSpeed=0,Q.didScroll=!1,!1},[Vs]),La=S.useCallback((L,Q)=>{if(Tr.current)return Q?"release":"neutral";if(performance.now()<=Pn.current)return"neutral";const P=Es.current;if(L.pointerType!=="touch"||L.pointerId!==P.pointerId||P.lastY==null)return"neutral";if(P.gestureAxis===null&&P.startX!==null&&P.startY!==null){const Le=Math.abs(L.clientX-P.startX),ct=Math.abs(L.clientY-P.startY);if(Le>Yg||ct>Yg){if(Le>ct*iL)return P.gestureAxis="x","release";ct>Le*aL&&(P.gestureAxis="y")}}if(P.gestureAxis==="x")return P.lastX=L.clientX,P.lastY=L.clientY,"release";if(P.gestureAxis===null)return P.lastX=L.clientX,P.lastY=L.clientY,"neutral";const W=L.clientY-P.lastY;P.lastX=L.clientX,P.lastY=L.clientY;const Ue=-W;if(P.remainder+=Ue,P.instantSpeed=Math.abs(Ue),P.velocity=P.velocity*.45+Ue*.55,Q){const ct=Yl(ke.current,zr,Hr)/Math.max(.1,p);Math.abs(P.remainder)>=ct/3&&(P.didScroll=!0,_a())}return"claim"},[zr,Hr,p,_a]),bo=S.useCallback(L=>{const Q=Es.current;if(L.pointerType!=="touch"||L.pointerId!==Q.pointerId)return;if(Vs(),Q.pointerId=null,Q.lastX=null,Q.lastY=null,Q.startX=null,Q.startY=null,Q.instantSpeed=0,Q.gestureAxis==="x"){Q.gestureAxis=null;return}Q.gestureAxis=null;const W=Yl(ke.current,zr,Hr)/Math.max(.1,p);if(Q.didScroll&&Math.abs(Q.velocity)>W*lL){const Ue=()=>{Q.velocity*=oL,Q.remainder+=Q.velocity;const Le=1+Math.abs(Q.velocity)*.1,ct=W/Math.min(6,Le);if(Math.abs(Q.velocity)<W*cL){if(Math.abs(Q.remainder)>=ct/3){const vr=Q.remainder>0?"down":"up";qs(vr,1),Q.remainder=0}Q.velocity=0,Q.rafId=null;return}let dt=0,Pt=0;for(;dt+Pt<fd&&Q.remainder>=ct;)Q.remainder-=ct,Pt++;for(;dt+Pt<fd&&Q.remainder<=-ct;)Q.remainder+=ct,dt++;Pt>0&&qs("down",Pt),dt>0&&qs("up",dt),Q.rafId=requestAnimationFrame(Ue)};Q.rafId=requestAnimationFrame(Ue)}else Math.abs(Q.remainder)>=W/3&&_a();Q.didScroll&&L.stopImmediatePropagation()},[Vs,qs,_a,p,zr,Hr]),Ti=S.useCallback(L=>{const Q=Es.current;L.pointerType!=="touch"||L.pointerId!==Q.pointerId||(Vs(),Q.pointerId=null,Q.lastX=null,Q.lastY=null,Q.startX=null,Q.startY=null,Q.gestureAxis=null,Q.remainder=0,Q.velocity=0,Q.didScroll=!1)},[Vs]);Ug({name:`tmux-scroll:${e}`,priority:N_,container:()=>Ve.current,onPointerDown:U&&h?dl:void 0,onPointerMove:U&&h?La:void 0,onPointerUp:U&&h?bo:void 0,onPointerCancel:U&&h?Ti:void 0});const oi=S.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}),ka=S.useRef(null);ka.current=Ve.current;const aa=ka,oa=xe,$o=S.useRef(V);$o.current=V;const vs=S.useCallback(L=>{const Q=oi.current;Q.gestureLocked!==L&&(Q.gestureLocked=L,Za(L))},[Za]),li=S.useCallback(()=>{const L=oi.current;L.edgeScrollTimer!==null&&(clearInterval(L.edgeScrollTimer),L.edgeScrollTimer=null),L.edgeScrollDir=0},[]),Xa=S.useCallback(L=>{const Q=ke.current,P=oi.current;if(Q){if(P.mode==="copy"&&P.copyStart){P.copyDidSelect=Ef(Q,P.copyStart,L)||P.copyDidSelect;return}if(P.mode==="adjust"){const W=xt.current;if(!W.active||!W.anchor)return;W.focus=t_(Q,L),Ef(Q,W.anchor,W.focus),rt()}}},[rt]),Ja=S.useCallback((L,Q)=>{const P=ke.current,W=oi.current;if(!P)return;const Ue=nc(P);if(!Ue)return;const Le=Ue.originTop,ct=Ue.originTop+P.rows*Ue.cellH,dt=Math.max(28,Ue.cellH*1.5),Pt=Q-Le,vr=ct-Q;let sn=0,Mn=0;if(Pt<dt?(sn=-1,Mn=Math.min(1,(dt-Pt)/dt)):vr<dt&&(sn=1,Mn=Math.min(1,(dt-vr)/dt)),W.edgeClientX=L,W.edgeClientY=Q,sn===0){li();return}W.edgeScrollDir=sn,W.edgeScrollLines=1+Math.round(Mn*5),W.edgeScrollTimer===null&&(W.edgeScrollTimer=setInterval(()=>{const _n=ke.current,Vn=oi.current;if(!_n||Vn.edgeScrollDir===0)return;if(Vn.mode!=="copy"&&Vn.mode!=="adjust"){li();return}_n.scrollLines(Vn.edgeScrollDir*Vn.edgeScrollLines);const Nr=B0(_n,Vn.edgeClientX,Vn.edgeClientY-hd);Nr&&Xa(Nr)},60))},[Xa,li]),eo=S.useCallback(L=>{if(L.pointerType!=="touch")return!1;const Q=aa.current;if(!Q)return!1;const P=L.target;if(!(P instanceof HTMLElement)||!Q.contains(P)||P.closest('[data-mobile-keyboard="true"]'))return!1;const W=oi.current;W.longPressMode=$o.current;const Ue=xt.current;if(Ue.active&&W.pointerId===null){const Le=P.closest("[data-selection-handle]");if(Le instanceof HTMLElement){const ct=ke.current,dt=Le.dataset.selectionHandle==="start"?"start":"end";if(ct&&Ue.anchor&&Ue.focus){const Pt=Xd(Ue.anchor,Ue.focus,ct.cols);return Ue.anchor=dt==="start"?Pt.end:Pt.start,Ue.focus=dt==="start"?Pt.start:Pt.end,Ue.dragging=dt,vt(),W.pointerId=L.pointerId,W.tapStartX=L.clientX,W.tapStartY=L.clientY,W.tapDidMove=!1,W.mode="adjust",Tr.current=!0,Qe(1800),yt.current?.setAttribute("readonly",""),Ai(),Vs(),ho(ql),vs(!0),!0}}if(!P.closest("[data-terminal-copy-popover]")){fr();try{ke.current?.clearSelection()}catch{}}}if(W.pointerId!==null)return!0;if(Tr.current=!1,sa.current){const Le=performance.now(),ct=L.clientX,dt=L.clientY;if(W.lastTapTime!==0&&Le-W.lastTapTime<=300&&Math.hypot(ct-W.lastTapX,dt-W.lastTapY)<=25)return ho(ql),Pn.current=performance.now()+500,sa.current?.(),qr(!0),$n.current&&clearTimeout($n.current),$n.current=setTimeout(()=>qr(!1),400),W.lastTapTime=0,!0}return W.holdTimer!==null&&(clearTimeout(W.holdTimer),W.holdTimer=null),W.joystickRepeatTimer!==null&&(clearTimeout(W.joystickRepeatTimer),W.joystickRepeatTimer=null),W.joystickDir="",W.copyStart=null,W.copyDidSelect=!1,W.pointerId=L.pointerId,W.originX=L.clientX,W.originY=L.clientY,W.tapStartX=L.clientX,W.tapStartY=L.clientY,W.tapDidMove=!1,W.mode="holding",W.longPressMode==="copy"&&vs(!0),W.holdTimer=setTimeout(()=>{if(W.holdTimer=null,W.mode==="holding"){if(W.longPressMode==="copy"){const Le=ke.current,ct=Le?B0(Le,W.tapStartX,W.tapStartY):null;if(!Le||!ct){W.mode="idle";return}W.mode="copy",Tr.current=!0,Qe(1800),yt.current?.setAttribute("readonly",""),W.copyStart=ct,W.copyDidSelect=!1,Ai(),Vs(),Le.clearSelection(),ho(ql),vs(!0);return}W.mode="arrow",Tr.current=!0,Qe(1e3),Ai(),Vs(),ho(ql),vs(!0),requestAnimationFrame(()=>{Yr({visible:!0,activeDir:""})})}},350),!0},[vs,vt,fr]),Us=S.useCallback((L,Q)=>{if(L.pointerType!=="touch")return"neutral";const P=oi.current;if(P.mode==="arrow"&&L.pointerId!==P.pointerId||P.mode==="copy"&&L.pointerId!==P.pointerId||P.mode!=="arrow"&&P.mode!=="copy"&&L.pointerId!==P.pointerId)return"neutral";const W=L.clientX-P.tapStartX,Ue=L.clientY-P.tapStartY;if(Math.hypot(W,Ue)>10&&(P.tapDidMove=!0),P.mode==="holding"){if(!Q)return P.holdTimer!==null&&(clearTimeout(P.holdTimer),P.holdTimer=null),vs(!1),Tr.current=!1,P.mode="idle","neutral";const Le=L.clientX-P.originX,ct=L.clientY-P.originY;return P.longPressMode==="copy"&&Math.hypot(Le,ct)>20?(P.holdTimer!==null&&(clearTimeout(P.holdTimer),P.holdTimer=null),vs(!1),Tr.current=!1,P.mode="idle","release"):Math.hypot(Le,ct)>20?(P.holdTimer!==null&&(clearTimeout(P.holdTimer),P.holdTimer=null),vs(!1),P.mode="idle","release"):"claim"}if(P.mode==="adjust"){if(!Q)return"claim";Ai();const Le=ke.current,ct=xt.current;if(!Le||!ct.active||!ct.anchor||!ct.focus)return"claim";const dt=B0(Le,L.clientX,L.clientY-hd);return dt&&(Xa(dt),Ja(L.clientX,L.clientY)),"claim"}if(P.mode==="copy"){if(!Q)return"claim";Ai();const Le=ke.current;if(!Le||!P.copyStart)return"claim";const ct=B0(Le,L.clientX,L.clientY-hd);return ct&&(Xa(ct),Ja(L.clientX,L.clientY)),"claim"}if(P.mode==="arrow"){if(!Q)return"claim";const Le={up:"\x1B[A",down:"\x1B[B",left:"\x1B[D",right:"\x1B[C"},ct=L.clientX-P.tapStartX,dt=L.clientY-P.tapStartY,Pt=V_(ct,dt,P.joystickDir);if(Pt&&Pt!==P.joystickDir&&(P.originX=L.clientX,P.originY=L.clientY),Pt){const vr=L.clientX-P.originX,sn=L.clientY-P.originY,Mn=Math.hypot(vr,sn);if(P.repeatIntervalMs=q_(Mn),Pt!==P.joystickDir){P.joystickRepeatTimer!==null&&clearTimeout(P.joystickRepeatTimer);const _n=P.joystickDir==="";P.joystickDir=Pt,oa.current(Le[Pt]);const Vn=performance.now();Vn-P.lastHapticTime>120&&(ho(ql),P.lastHapticTime=Vn);const Nr=_n?400:300;P.joystickRepeatTimer=setTimeout(function mn(){if(P.joystickDir!==Pt)return;oa.current(Le[Pt]);const wn=performance.now();wn-P.lastHapticTime>120&&(ho(ql),P.lastHapticTime=wn),P.joystickRepeatTimer=setTimeout(mn,P.repeatIntervalMs)},Nr)}Yr({visible:!0,activeDir:Pt})}else P.joystickRepeatTimer!==null&&(clearTimeout(P.joystickRepeatTimer),P.joystickRepeatTimer=null),P.joystickDir="",Yr({visible:!0,activeDir:""});return"claim"}return"neutral"},[vs,Xa,Ja]),Wi=S.useCallback(L=>{if(L.pointerType!=="touch"||L.pointerId!==oi.current.pointerId)return;const Q=oi.current;if(Q.mode==="copy"){Ai(),Vs(),li(),vs(!1);const W=ke.current;let Ue=null;if(W&&Q.copyStart&&(Ue=B0(W,L.clientX,L.clientY-hd),Ue&&(Q.copyDidSelect=Ef(W,Q.copyStart,Ue)||Q.copyDidSelect)),W&&Q.copyDidSelect&&W.hasSelection()&&Q.copyStart){const Le=xt.current;Le.active=!0,Le.anchor=Q.copyStart,Le.focus=Ue??Q.copyStart,Le.dragging=null,rt(),mt({x:L.clientX,y:L.clientY}),Qe(1800),ho(ql)}else go.current?.(!1);Q.holdTimer!==null&&(clearTimeout(Q.holdTimer),Q.holdTimer=null),Q.copyStart=null,Q.copyDidSelect=!1,Q.pointerId=null,Q.mode="idle",Tr.current=!1;return}if(Q.mode==="adjust"){Ai(),Vs(),li(),vs(!1),xt.current.dragging=null,rt(),mt({x:L.clientX,y:L.clientY}),Qe(1800),Q.pointerId=null,Q.mode="idle",Tr.current=!1;return}if(Q.mode==="arrow"){Ai(),Vs(),vs(!1),Yr({visible:!1,activeDir:""}),Q.holdTimer!==null&&(clearTimeout(Q.holdTimer),Q.holdTimer=null),Q.joystickRepeatTimer!==null&&(clearTimeout(Q.joystickRepeatTimer),Q.joystickRepeatTimer=null),Q.joystickDir="",Q.pointerId=null,Q.mode="idle",Tr.current=!1;return}const P=aa.current;if(P&&!Q.tapDidMove){const W=L.target;W instanceof HTMLElement&&P.contains(W)&&!W.closest('[data-mobile-keyboard="true"]')&&(Q.lastTapTime=performance.now(),Q.lastTapX=L.clientX,Q.lastTapY=L.clientY)}else Q.tapDidMove&&(Q.lastTapTime=0);Q.holdTimer!==null&&(clearTimeout(Q.holdTimer),Q.holdTimer=null),Q.joystickRepeatTimer!==null&&(clearTimeout(Q.joystickRepeatTimer),Q.joystickRepeatTimer=null),Q.joystickDir="",vs(!1),Tr.current=!1,Q.copyStart=null,Q.copyDidSelect=!1,Q.pointerId=null,Q.mode="idle"},[vs,Ai,Qe,li,rt,mt]),Ia=S.useCallback(()=>{const L=oi.current;vs(!1),li(),L.mode==="arrow"&&Yr({visible:!1,activeDir:""}),L.mode==="adjust"&&(xt.current.dragging=null,rt(),mt()),L.holdTimer!==null&&(clearTimeout(L.holdTimer),L.holdTimer=null),L.joystickRepeatTimer!==null&&(clearTimeout(L.joystickRepeatTimer),L.joystickRepeatTimer=null),L.joystickDir="",Tr.current=!1,L.copyStart=null,L.copyDidSelect=!1,L.pointerId=null,L.tapDidMove=!1,L.mode="idle"},[vs,li,rt,mt]);Ug({name:`long-press:${e}`,priority:R_,container:()=>Ve.current,onPointerDown:U?eo:void 0,onPointerMove:U?Us:void 0,onPointerUp:U?Wi:void 0,onPointerCancel:U?Ia:void 0});const Zn=S.useCallback((L={})=>{wt.current+=1,X.current="",$e.current=null,Be.current=0,Tt.current=!1,Ct.current=null,st.current&&(st.current=!1,L.notifyFlowResume===!0&&ge.current?.(!1)),be.current=null,Te.current=!1,pe.current=null,Ht.current=""},[]),os=S.useCallback((L="unknown")=>{const Q=qe.current,P=ke.current,W=Ve.current;if(!Q||!P||!W||!P.element||!P.cols||!P.rows)return;const Ue=W.getBoundingClientRect();if(Ue.width<24||Ue.height<24){Yt("skip fit: container too small",{reason:L,width:Math.round(Ue.width),height:Math.round(Ue.height)});return}try{const Le={cols:P.cols,rows:P.rows},ct=P.buffer.active,dt=f_(ct.type,ct.baseY,ct.viewportY),Pt=Q.proposeDimensions();if(!Pt||Pt.cols<=0||Pt.rows<=0)return;const vr=qg(P,Le.rows),sn=u_({reason:L,currentCols:Le.cols,currentRows:Le.rows,proposedCols:Pt.cols,proposedRows:Pt.rows});let Mn=0;if(sn.accept){vn.current&&Mr.current&&(Le.cols!==Pt.cols||Le.rows!==Pt.rows)&&Ie.current?.begin();const Vn=P.options.smoothScrollDuration;try{P.options.smoothScrollDuration=0,P.resize(Pt.cols,Pt.rows),Mn=qg(P,Pt.rows),dt&&P.scrollToBottom()}finally{P.options.smoothScrollDuration=Vn}Et.current=0}(vr>0||Mn>0)&&(P.refresh(0,Math.max(0,P.rows-1)),Yt("xterm buffer invariant repaired",{reason:L,before:vr,after:Mn,cols:P.cols,rows:P.rows}));const _n={cols:P.cols,rows:P.rows};Yt("fit",{reason:L,backend:"xterm",width:Math.round(Ue.width),height:Math.round(Ue.height),before:Le,proposed:Pt,next:_n,hysteresis:sn,changed:Le.cols!==_n.cols||Le.rows!==_n.rows})}catch{Ie.current?.cancel()}},[Yt]),Ei=S.useCallback(L=>{const Q=ke.current;if(Q)try{Q.refresh(0,Math.max(0,Q.rows-1)),Yt("terminal refreshed (sync)",{reason:L,cols:Q.cols,rows:Q.rows,hasWebgl:!!ne.current})}catch(P){Yt("terminal refresh (sync) failed",{reason:L,error:P})}},[Yt]),Gi=S.useCallback(L=>{const Q=Pe.current;if(Q){try{Q.dispose()}catch{}Pe.current=null}const P=ne.current;if(!P)return!1;Ie.current?.cancel();try{P.dispose()}catch{}return ne.current=null,Yt("renderer disposed",{type:"webgl",reason:L}),!0},[Yt]),Vi=S.useCallback((L,Q)=>{if(ne.current)return!0;try{const P=new lC({customGlyphs:$});return Pe.current=P.onContextLoss(()=>{Yt("webgl context loss",{reason:"onContextLoss"}),it.current=!0,typeof window<"u"&&window.setTimeout(()=>{Gn("webgl-context-loss",{forceRendererRecreate:!0})},0)}),Ie.current?.cancel(),L.loadAddon(P),ne.current=P,it.current=!1,Yt("renderer",{type:"webgl",reason:Q,mobile:U,mode:Re.current}),Ei(`webgl-enabled:${Q}`),os(`webgl-enabled:${Q}`),Fr.current=!0,!0}catch(P){return Yt("webgl load failed, fallback to dom renderer",{reason:Q,error:P,mobile:U,mode:Re.current}),!1}},[Yt,$,U,os,Ei]),$s=200,yo=S.useRef(0),se=S.useRef(new Map),We=S.useRef(new Map),et=S.useRef(kf()),$t=S.useRef(null),Fe=S.useRef(null),St=S.useRef(-1),Er=S.useRef(new Map),Fr=S.useRef(!1),vn=S.useRef(!1),Rr=S.useRef(Og()),pn=S.useRef(null),Sn=S.useRef(null),ws=S.useCallback(()=>{pn.current!==null&&(clearTimeout(pn.current),pn.current=null),Sn.current=null},[]),Wn=S.useCallback(()=>{const L=se.current;L.forEach(Q=>cancelAnimationFrame(Q)),L.clear(),We.current.clear()},[]),fs=S.useCallback(()=>{$t.current!==null&&(window.clearTimeout($t.current),$t.current=null)},[]),zs=S.useRef(()=>{}),Ql=S.useCallback(L=>{fs(),Ke.current?.(!1),te.current(L.cols,L.rows,L.seq),$t.current=window.setTimeout(()=>{$t.current=null;const Q=Pg(et.current,L.seq);et.current=Q.state,Q.request&&vn.current?(Yt("resize ack timeout; retrying",{seq:L.seq,retrySeq:Q.request.seq,cols:Q.request.cols,rows:Q.request.rows}),zs.current(Q.request)):Q.exhausted&&(Ie.current?.cancel(),Yt("resize ack timeout; leaving size unconfirmed",{seq:L.seq,cols:L.cols,rows:L.rows}))},1200)},[fs,Yt]);zs.current=Ql;const la=S.useCallback((L,Q)=>{if(!vn.current)return;const P=x_(et.current,{cols:L,rows:Q});et.current=P.state,P.request&&Ql(P.request)},[Ql]),zo=S.useCallback((L,Q)=>{const P=T_(Rr.current,Date.now());if(P.action==="send"){Sn.current=null,la(L,Q);return}Sn.current={cols:L,rows:Q},pn.current===null&&(pn.current=setTimeout(()=>{pn.current=null;const W=Sn.current;Sn.current=null,W&&(Rr.current=C_(Date.now()),la(W.cols,W.rows))},Math.max(0,P.readyAt-Date.now())))},[la]),vo=1500,jl=400,Ho=S.useRef(0),to=S.useRef(0),Wo=S.useCallback((L,Q,P)=>{if(!Number.isFinite(L)||!Number.isFinite(Q)||L<=0||Q<=0)return;const W=Math.floor(L),Ue=Math.floor(Q);et.current=v_(et.current,{cols:W,rows:Ue}),Ho.current=Date.now(),Yt("pty-size broadcast received",{cols:W,rows:Ue,source:P??"unknown"})},[Yt]),Go=S.useCallback(L=>{const Q=ke.current;if(!Q||!Q.cols||!Q.rows||!vn.current||typeof document<"u"&&(document.visibilityState!=="visible"||!X0()))return;const P=Date.now();if(P-Ho.current<vo||P-to.current<jl)return;const W=Q.cols,Ue=Q.rows,Le=et.current.confirmed;Le&&Le.cols===W&&Le.rows===Ue||(to.current=P,Yt("ensureSizeMatches push",{reason:L,cols:W,rows:Ue,lastServerSize:Le}),la(W,Ue))},[Yt,la]),wo=S.useCallback((L,Q)=>{const P=ke.current,W=qe.current;if(!P||!W)return;if(!Fr.current){Yt("refresh skipped: renderer not ready",{reason:L});return}if(Q.dedupeKey!==void 0){if(Er.current.get(L)===Q.dedupeKey){Yt("refresh deduped",{reason:L,dedupeKey:Q.dedupeKey});return}Er.current.set(L,Q.dedupeKey)}Yt("refresh",{reason:L,options:Q});const Ue=Q.forceRendererRecreate===!0||it.current||ht&&!!ne.current&&wL.has(L)&&/Android/i.test(navigator.userAgent);let Le=!1;Ue&&(it.current=!1,ht?(Gi(`refresh:${L}`),Vi(P,`refresh:${L}`)||Ei(`refresh:${L}:webgl-fallback`),Le=!0):(Ei(`refresh:${L}`),Le=!0)),m_(Q.forceRedraw===!0,L==="dpr-change",Le)?Ei(`refresh:${L}`):Le||Yt("terminal redraw skipped: fit/write already repaints",{reason:L});const ct={cols:P.cols,rows:P.rows};os(`refresh:${L}`);const dt={cols:P.cols,rows:P.rows};if(Q.skipResizePush||d_({before:ct,after:dt,lastServerSize:et.current.confirmed,reconcileServerSize:Q.reconcileServerSize})&&zo(dt.cols,dt.rows),!Q.skipScrollToBottom&&L!=="resize"&&L!=="dpr-change"){const vr=requestAnimationFrame(()=>{const _n=ke.current;if(_n&&_n.buffer.active.type!=="alternate")try{_n.scrollToBottom()}catch{}}),sn=se.current,Mn=sn.get(L);Mn!==void 0&&cancelAnimationFrame(Mn),sn.set(L,vr)}},[Yt,ht,Gi,Vi,Ei,os,zo]),Gn=S.useCallback((L,Q={})=>{if(ke.current,L==="session-key-change"&&(et.current=kf(),fs(),ws(),Rr.current=Og(),Er.current.clear(),Wn()),!Q.force&&(L==="visibility"||L==="bfcache"||L==="online")){const W=Date.now();if(W-yo.current<$s){Yt("refresh throttled",{reason:L});return}yo.current=W}if(We.current.set(L,Q),se.current.has(L))return;const P=requestAnimationFrame(()=>{const W=We.current.get(L)??{};se.current.delete(L),We.current.delete(L),wo(L,W)});se.current.set(L,P)},[Yt,Wn,fs,ws,wo]),ci=S.useCallback(L=>{const Q=se.current.get(L);if(Q===void 0)return;const P=We.current.get(L)??{};cancelAnimationFrame(Q),se.current.delete(L),We.current.delete(L),wo(L,P)},[wo]);xo.current=()=>ci("resize"),S.useEffect(()=>()=>{Wn(),_t.current!==null&&(window.clearTimeout(_t.current),_t.current=null)},[e,Wn]),S.useEffect(()=>{et.current=kf(),fs(),Er.current.clear()},[e,fs]);const Vo=S.useCallback(()=>{if(Te.current)return;const L=ke.current;if(!L){Zn();return}if(!X.current)return;const Q=X.current,P=Q.length,W=$e.current,Ue=Tt.current;X.current="",$e.current=null,Tt.current=!1,Te.current=!0;let Le=null;Ue&&(Le=Ct.current??{depth:0},Ct.current=Le,Le.depth+=1);const ct=Ie.current,dt=ct?.generation;L.write(Q,()=>{if(Le&&(Le.depth-=1),dt!==void 0&&ct?.written(dt),Te.current=!1,Be.current-=P,Be.current<0&&(Be.current=0),W!==null&&z.current?.(W),st.current&&Be.current<TL&&(st.current=!1,ge.current?.(!1)),X.current){Vo();return}const Pt=++wt.current,vr=()=>{if(Pt!==wt.current||Te.current||X.current)return;const sn=L.buffer.active;Ae.current?.({x:sn.cursorX,y:sn.cursorY,rows:L.rows,lastProcessedChunkId:pe.current})};typeof window>"u"?vr():window.requestAnimationFrame(()=>{window.requestAnimationFrame(vr)})})},[Zn]);rr.current=Vo;const pc=S.useCallback(()=>{if(be.current!==null)return;const L=++je.current;be.current=L,queueMicrotask(()=>{be.current===L&&(be.current=null,Vo())})},[Vo]),mc=S.useCallback((L,Q,P=!1)=>{if(!L)return;wt.current+=1,X.current+=L,$e.current=Q,Tt.current=Tt.current||P,Be.current+=L.length;const W=pt.current;(W===null||Q>W)&&(pt.current=Q),!st.current&&Be.current>=AL&&(st.current=!0,ge.current?.(!0)),pc()},[pc]);return S.useEffect(()=>{let L=!1,Q=null,P=null,W=[];const Ue=Ve.current;return Ue?(Ue.tabIndex=U?-1:0,(async()=>{if(ze.current?.(!1),hr("loading"),Un(null),dn(!0),await _L(),!L)try{const ct=kL(Ue,Kg(Rn),zr,ur,Hr),dt=new c9({...ct?{cols:ct.cols,rows:ct.rows}:{},allowProposedApi:!0,fontFamily:Kg(Rn),fontSize:zr,fontWeight:Xg(Jn),fontWeightBold:Xg(es),theme:LL(q),logLevel:"off",cursorBlink:!ht,cursorStyle:"block",cursorInactiveStyle:us.current?"bar":"none",scrollback:h?2e3:5e3,scrollbar:{showScrollbar:!1},allowTransparency:LA(Ln,Ee),convertEol:ds,drawBoldTextInBrightColors:Ms,rescaleOverlappingGlyphs:he,minimumContrastRatio:on,letterSpacing:ur,lineHeight:Hr,smoothScrollDuration:Me&&!de.current?125:0,scrollOnEraseInDisplay:!0,tabStopWidth:8,vtExtensions:{kittyKeyboard:!0},windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0}}),Pt=new u9;dt.loadAddon(Pt),dt.loadAddon(new pC),dt.registerLinkProvider(nL(dt,(Nr,mn)=>{nt.current?.(Nr,mn)}));const vr=new wC;dt.loadAddon(vr),dt.unicode.activeVersion=yn,dt.loadAddon(new IC({highlightLimit:1e3}));const sn=new DC;dt.loadAddon(sn),ot.current=sn,dt.loadAddon(new e_);try{dt.loadAddon(new QC(void 0,new L3))}catch(Nr){Yt("clipboard addon skipped",{error:Nr})}Q=dt,ke.current=dt,qe.current=Pt,jt.current=typeof window<"u"?window.devicePixelRatio:1,dt.open(Ue),Ie.current=g_(dt),De&&dt.loadAddon(new JS({fontFeatureSettings:L_,fallbackLigatures:k_}));try{const Nr=dt._core;Nr?.coreService&&(Nr.coreService.isCursorInitialized=!0),dt.refresh(0,dt.rows-1)}catch{}ht?(Vi(dt,"init"),Fr.current=!0):(Yt("renderer",{type:"dom",reason:"renderer-mode-dom-fallback",mobile:U,mode:Ln}),Fr.current=!0),dn(!1),$r();const Mn=Nr=>{if(Nr.ctrlKey||Nr.metaKey){Nr.preventDefault();const mn=Nr.deltaY>0?-1:1;Nd(t,zr+mn)}};if(dr.current=Mn,Ue.addEventListener("wheel",Mn,{passive:!1}),!U){let Nr=0,mn=null,wn=null,Ys=null;const ca=()=>{Ys=null,xo.current();const ps=Yl(ke.current,zr,Hr),Pl=Rt.current+Nr;Nr=0;const Rs=Math.trunc(Pl/ps);if(Rt.current=Pl-Rs*ps,Rs!==0){const Ao=Rs>0?"down":"up",hl=ke.current,gc=Math.max(3,Math.floor((hl?.rows??24)/2)),Ci=Math.abs(Rs);Ci>gc&&(Rt.current=0),ia.current(Ao,Math.min(Ci,gc),mn??void 0,wn??void 0)}};dt.attachCustomWheelEventHandler(ps=>{if(ps.ctrlKey||ps.metaKey||ps.shiftKey)return!0;if(ps.deltaY===0)return!1;if(!ke.current||!Mr.current)return!0;const Rs=Yl(ke.current,zr,Hr);let Ao=ps.deltaY;return ps.deltaMode===1?Ao=ps.deltaY*Rs:ps.deltaMode===2&&(Ao=ps.deltaY*(Ue.clientHeight||Rs*20)),Nr+=Ao,mn=ps.clientX,wn=ps.clientY,Ys===null&&(Ys=requestAnimationFrame(ca)),ps.preventDefault(),!1})}const _n=vL(Ue);if(_n?(_n.classList.add("overlay-scrollbar-target","overlay-scrollbar-container"),ce.current=_n,Br()):ce.current=null,Gn("mount",{skipResizePush:!0,skipScrollToBottom:!0}),ar.current&&(U?dt.focus():yt.current?.focus({preventScroll:!0})),U||_r.current(),W.push(dt.onRender(()=>{const Nr=dt.buffer.active;Oe.current?.({x:Nr.cursorX,y:Nr.cursorY,rows:dt.rows}),U||_r.current()})),!U){try{const Nr=dt.textarea;if(Nr){Nr.tabIndex=-1,Nr.setAttribute("aria-hidden","true"),Nr.setAttribute("readonly",""),Nr.value="";const mn=()=>{yt.current?.focus({preventScroll:!0})};Nr.addEventListener("focus",mn),W.push({dispose:()=>Nr.removeEventListener("focus",mn)})}}catch{}try{W.push(dt.onCursorMove(()=>_r.current())),W.push(dt.onResize(()=>_r.current()))}catch{}}W.push(dt.onData(Nr=>{const mn=Ct.current;mn!==null&&mn.depth>0||xe.current(Nr)}));const Vn=Nr=>{const mn=typeof window<"u"?window.devicePixelRatio:1,wn=Math.abs(mn-jt.current)>.001;return wn&&(jt.current=mn,Yt("device pixel ratio changed",{value:mn,source:Nr})),wn};if(P=new ResizeObserver(Nr=>{if(!h_(!!yr.current,Qr.current)){Yt("resize observer skipped: hidden mobile session");return}bt.current=void 0;const mn=Nr[0];mn&&Yt("resize observer",{width:Math.round(mn.contentRect.width),height:Math.round(mn.contentRect.height)});const wn=Vn("resize-observer");Gn(wn?"dpr-change":"resize")}),P.observe(Ue),typeof window<"u"){const Nr=()=>{Vn("window-resize")&&Gn("dpr-change")};window.addEventListener("resize",Nr),W.push({dispose:()=>window.removeEventListener("resize",Nr)});const mn=window.visualViewport;if(mn){const wn=()=>{Vn("visual-viewport-resize")&&Gn("dpr-change")};mn.addEventListener("resize",wn),W.push({dispose:()=>mn.removeEventListener("resize",wn)})}}os("init-fit"),hr("ready"),ze.current?.(!0)}catch(ct){console.error("Failed to initialize terminal:",ct),dn(!1),hr("error"),Un(ct instanceof Error?ct.message:"Failed to load terminal")}})(),()=>{ze.current?.(!1),L=!0,re.current?.(!1),ir.current?.(),ir.current=null,ue.current=!1,qt.current!==null&&(clearTimeout(qt.current),qt.current=null),Nt.current=!1,On.current=null,pr(),Tn({active:!1,text:""});for(const ct of W)ct.dispose();P?.disconnect(),dr.current&&(Ue.removeEventListener("wheel",dr.current),dr.current=null),Ie.current?.dispose(),Ie.current=null,Gi("component-unmount"),Q?.dispose(),ke.current=null,qe.current=null,ce.current=null,Zn({notifyFlowResume:!0}),fs(),ws()}):void 0},[os,Rn,zr,Jn,es,ur,Hr,on,Ms,yn,$,he,De,Ee,Me,q,Zn,pr,U,Vi,Gi,Yt,fs,ws]),S.useEffect(()=>{const L=ke.current;L&&(L.options.smoothScrollDuration=Me&&!ve?125:0)},[Me,ve,ie]),S.useEffect(()=>{const L=ke.current;L&&(L.options.cursorInactiveStyle=Je?"bar":"none",Je||L.blur())},[Je,ie]),S.useEffect(()=>{const L=ke.current;if(L){if(ht){if(L.options.cursorBlink=!1,Vi(L,"renderer-mode-change")&&Ee&&!Qt.current)try{L.loadAddon(new fS({storageLimit:64,pixelLimit:1<<24,sixelSupport:!0,iipSupport:!0,kittySupport:!0})),Qt.current=!0}catch(P){Yt("image addon skipped",{error:P})}return}L.options.cursorBlink=!0,Gi("renderer-mode-change")&&(Ei("renderer-mode-change:webgl-disabled"),os("renderer-mode-change:webgl-disabled"))}},[ht,Ee,Vi,Gi,Ei,os,Yt]),S.useEffect(()=>{const L=ke.current;L&&(pe.current!==null&&L.reset(),Zn(),Se.current="",Ce.current=0,yt.current&&(yt.current.value=""),Gn("session-reset",{skipScrollToBottom:!0}),ar.current&&(yr.current?L.focus():yt.current?.focus({preventScroll:!0})))},[e,ie,Gn,Zn]),S.useEffect(()=>{if(!U||typeof document>"u")return;let L=null;const Q=()=>{L=null;const W=yt.current;if(!W||document.activeElement!==W||ue.current)return;const Ue=Se.current,Le=N0(W.value);if(Le!==Ue||Le.includes("\r")||!Xt())return;const ct=Math.min(Hg(W),Array.from(Le).length),dt=ct-Ce.current;if(dt===0)return;const Pt=ke.current,vr=dt<0?(Pt?pd(Pt,"D"):"\x1B[D").repeat(-dt):(Pt?pd(Pt,"C"):"\x1B[C").repeat(dt);xe.current(vr),Ce.current=ct},P=()=>{L===null&&(L=requestAnimationFrame(Q))};return document.addEventListener("selectionchange",P),()=>{document.removeEventListener("selectionchange",P),L!==null&&cancelAnimationFrame(L)}},[U,Xt]),S.useEffect(()=>{if(!U)return;const L=Ka();return ir.current=L,()=>{L(),ir.current=null}},[U,Ka]),S.useEffect(()=>{const L=ke.current;if(L)try{L.options.scrollback=h?0:1e3}catch{}},[h,ie]),S.useEffect(()=>{const L=ke.current;if(!L)return;if(n.length===0){pe.current!==null&&(L.reset(),Zn(),Gn("buffer-reset",{skipResizePush:!0,skipScrollToBottom:!0}));return}const Q=pe.current;let P,W=!1;if(Q===null)P=n;else{const Ue=n.findIndex(Le=>Le.id===Q);Ue>=0?P=n.slice(Ue+1):(P=n,W=!0)}if(P.length>0){const Ue=P.map(sn=>sn.data).join(""),Le=Ht.current+Ue,{cleaned:ct,remainder:dt}=yL(Le);Ht.current=dt;const Pt=pt.current,vr=Pt!==null&&(P[0].id<=Pt||W);ct?mc(ct,P[P.length-1].id,vr):z.current?.(P[P.length-1].id)}pe.current=n[n.length-1].id},[n,ie,mc,Gn,Zn]),S.useImperativeHandle(_e,()=>({serializeSnapshot:()=>ke.current?ot.current?.serialize({scrollback:100})??null:null,focus:()=>{if(yr.current){Is();return}yt.current?.focus({preventScroll:!0})},blur:()=>{const L=yt.current;ks(L),L&&typeof document<"u"&&document.activeElement===L&&L.blur(),yr.current&&L?.setAttribute("readonly",""),re.current?.(!1)},clear:()=>{const L=ke.current;L&&(L.reset(),Zn(),Gn("clear",{skipResizePush:!0,skipScrollToBottom:!0}))},prepareScreenReplacement:()=>{Zn({notifyFlowResume:!0})},copySelectionOrViewport:async()=>{const L=ke.current;if(!L)return!1;const Q=L.hasSelection()?L.getSelection():IL(L),P=await e2(Q);return P&&L.hasSelection()&&vt(),P},pasteClipboardText:async()=>{Qe();const L=await Vt(yt.current);return Ii.current?.(L),L},sendSequence:(L,Q)=>Ne(L,null,Q),getDimensions:()=>{const L=ke.current;return!L||!L.cols||!L.rows?null:{cols:L.cols,rows:L.rows}},requestRefresh:Gn,setSessionReady:L=>{vn.current=L,L||(Ie.current?.cancel(),fs(),et.current=w_(et.current),Fe.current=null,St.current=-1,Ke.current?.(!1))},acknowledgeResize:L=>{if(!L.ok&&typeof L.seq=="number"){const Le=Pg(et.current,L.seq);if(!Le.request&&!Le.exhausted)return;fs(),et.current=Le.state,Le.request&&vn.current?zs.current(Le.request):Le.exhausted&&Ie.current?.cancel();return}const Q=y_(et.current,L);if(!Q.accepted)return;fs(),et.current=Q.state,Yt("resize acknowledged",{seq:L.seq,ok:L.ok,cols:L.cols,rows:L.rows,screenSyncPending:L.screenSyncPending===!0,screenSyncGeneration:L.screenSyncGeneration});const P=ke.current,W=Q.state.confirmed;if(!!!(P&&W&&P.cols===W.cols&&P.rows===W.rows)){Ke.current?.(!1);return}if(L.screenSyncPending&&typeof L.screenSyncGeneration=="number"){Fe.current=L.screenSyncGeneration;const Le=St.current>=L.screenSyncGeneration;Ke.current?.(Le),Le&&(Fe.current=null);return}Fe.current=null,Ke.current?.(!0)},notifyScreenSynchronized:L=>{if(!Number.isFinite(L))return;St.current=Math.max(St.current,L);const Q=Fe.current;if(Q===null||L<Q)return;Fe.current=null;const P=ke.current,W=et.current.confirmed;Ke.current?.(!!(P&&W&&P.cols===W.cols&&P.rows===W.rows))},notifyServerSize:Wo,ensureSizeMatches:Go,requestPtyRedraw:()=>{const L=ke.current;if(!L||!vn.current||et.current.pending||Fe.current!==null)return;const Q=b_(et.current,{cols:L.cols,rows:L.rows});et.current=Q.state,zs.current(Q.request)}}),[U,ks,Is,Zn,Vt,Ne,Gn,fs,Yt,la,Wo,Go]),a.jsxs("div",{ref:Ve,"data-termdock-terminal-dropzone":e,className:`relative h-full w-full terminal-viewport-container ${Y||""}`,style:{backgroundColor:q.background,touchAction:An.visible?"none":void 0},role:"button",tabIndex:-1,onPointerDownCapture:Aa,onPointerMoveCapture:wi,onPointerUpCapture:Uo,onPointerCancelCapture:qa,onTouchStartCapture:L=>{if(hs(L.target)){Qe(),Zr(M0);return}Hn(),Zr(M0)},onTouchMoveCapture:()=>Zr(M0),onTouchEndCapture:()=>Zr(D0),onTouchCancelCapture:()=>Zr(D0),onMouseDown:L=>{U||L.button===0&&(_t.current!==null&&(window.clearTimeout(_t.current),_t.current=null),requestAnimationFrame(()=>{try{yt.current?.focus({preventScroll:!0})}catch{}}))},onMouseUp:L=>{U||L.button===0&&(_t.current!==null&&window.clearTimeout(_t.current),_t.current=window.setTimeout(()=>{_t.current=null;try{yt.current?.focus({preventScroll:!0})}catch{}},0))},children:[as&&a.jsx("button",{type:"button",role:"alert",onClick:()=>Pr(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:as}),jr&&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:jr.left,top:jr.top,WebkitBackdropFilter:"blur(18px)"},onPointerDown:L=>{Qe(),L.stopPropagation()},onPointerUp:L=>{L.preventDefault(),L.stopPropagation(),Ya()},onTouchStart:L=>{Qe(),L.stopPropagation()},onTouchEnd:L=>{L.preventDefault(),L.stopPropagation(),Ya()},onClick:L=>{L.preventDefault(),L.stopPropagation(),Ya()},children:[a.jsx(Jv,{size:14,strokeWidth:2.4}),a.jsx("span",{children:Ze("common.copy")})]}),cr?.start&&a.jsx("div",{"data-selection-handle":"start",className:"absolute z-30 h-11 w-11 select-none",style:{left:cr.start.left,top:cr.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)]"})]})}),cr?.end&&a.jsx("div",{"data-selection-handle":"end",className:"absolute z-30 h-11 w-11 select-none",style:{left:cr.end.left,top:cr.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)]"})]})}),kr&&Xn&&a.jsx(F_,{}),kr&&ft==="loading"&&!Xn&&a.jsx(O_,{}),ft==="error"&&a.jsx(U_,{message:Ls||void 0,onRetry:()=>{window.location.reload()}}),ft==="ready"&&a.jsxs(a.Fragment,{children:[a.jsx("textarea",{ref:yt,"aria-label":Ze("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",...U?{inset:0,touchAction:"none",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",pointerEvents:"auto",fontSize:"16px"}:(()=>{const L=At.x,Q=At.y,P={position:"fixed",left:L,top:Q,pointerEvents:"none",touchAction:"auto",fontSize:`${zr}px`,fontFamily:Rn,lineHeight:"1",whiteSpace:"pre",boxSizing:"content-box",width:Math.max(1,Math.round(At.cellW)),height:Math.max(1,Math.round(At.cellH))};if(!rn.active)return P;const W=ai(rn.text);return{...P,opacity:1,color:"transparent",WebkitTextFillColor:"transparent",background:"transparent",transition:"none",caretColor:"transparent",textDecorationColor:"transparent",wordBreak:"break-all",zIndex:20,width:W.width,height:W.height,whiteSpace:W.whiteSpace}})()},onContextMenu:L=>{L.preventDefault()},onFocus:()=>{Yt("input anchor focus"),bt.current=void 0,_r.current(),Gn("focus",{skipResizePush:!0,skipScrollToBottom:!0}),re.current?.(!0)},onBlur:L=>{U||ks(L.currentTarget);const Q=$i(),P=typeof document<"u"?document.activeElement:null;if(Yt("input anchor blur",{guarded:Q,activeTag:P?.tagName??null,activeClass:P?.className??null}),!Q){U&&yt.current?.setAttribute("readonly",""),re.current?.(!1);return}if(typeof window>"u"){re.current?.(!1);return}window.setTimeout(()=>{Ut()||Xt()||(U&&yt.current?.setAttribute("readonly",""),re.current?.(!1))},D0)},onBeforeInput:L=>{if(ue.current)return;const Q=L.nativeEvent;if(Q instanceof InputEvent){if(Q.inputType==="insertFromPaste"||Q.inputType==="insertFromPasteAsQuotation"){const P=Q.dataTransfer?.getData("text/plain")||Q.data;if(P){L.preventDefault();const W=tt(P,L.currentTarget);U&&Ii.current?.(W)}return}if(Q.inputType==="insertLineBreak"){if(Nt.current){Nt.current=!1,qt.current!==null&&(clearTimeout(qt.current),qt.current=null),L.preventDefault();return}L.preventDefault(),ye(L.currentTarget);return}if(Q.inputType==="deleteContentBackward"||Q.inputType==="deleteContentForward"||Q.inputType==="deleteByCut"){if(!L.currentTarget.value){L.preventDefault(),xe.current("");return}if(Q.inputType==="deleteContentBackward"&&L.currentTarget.selectionStart===0&&L.currentTarget.selectionEnd===0){L.preventDefault(),xe.current("");return}return}}},onInput:L=>{if(ue.current)return;const Q=L.nativeEvent,P=l_(Se.current,N0(L.currentTarget.value),Q.inputType);if(P){const W=tt(P,L.currentTarget);U&&Ii.current?.(W);return}j(L.currentTarget)},onPaste:L=>{if(window.termdockDesktop?.readClipboardFiles){L.preventDefault(),Vt(L.currentTarget);return}const Q=Array.from(L.clipboardData.files);if(Q.length&&(Q.length>1||!Q[0].type.startsWith("image/"))){L.preventDefault(),Zt(Q,L.currentTarget);return}const P=Q[0];if(P){L.preventDefault(),Lt(P,L.currentTarget);return}const W=L.clipboardData.getData("text/plain");if(!W){window.termdockDesktop&&(L.preventDefault(),Vt(L.currentTarget));return}L.preventDefault();const Ue=tt(W,L.currentTarget);U&&Ii.current?.(Ue)},onKeyDown:L=>{const Q=xL(L);if(!Q&&!ue.current){if(L.getModifierState("AltGraph"))return;const P=ke.current,W=L.metaKey,Ue=L.ctrlKey,Le=L.altKey,ct=L.shiftKey,dt=L.key;if(W&&!Ue&&!Le&&!ct&&dt==="Enter"){L.preventDefault(),ye(L.currentTarget);return}if((W||Ue)&&!Le&&!ct&&(dt==="v"||dt==="V")){if(window.termdockDesktop?.readClipboardFiles||window.termdockDesktop?.readClipboardImage){L.preventDefault(),Vt(L.currentTarget);return}return}if(W&&!Ue&&!Le&&!ct&&(dt==="c"||dt==="C")){L.preventDefault();const vr=P?.hasSelection()?P.getSelection():"";vr&&navigator.clipboard?.writeText(vr).catch(()=>{});return}if((W||Ue)&&!Le&&!ct&&(dt==="k"||dt==="K")){L.preventDefault(),P&&(P.reset(),Zn(),Gn("clear",{skipResizePush:!0,skipScrollToBottom:!0})),L.currentTarget.value="",Se.current="",Ce.current=0;return}if(W&&!Ue&&!Le&&!ct&&dt==="Backspace"){L.preventDefault(),Ne("",L.currentTarget);return}if(W&&!Ue&&!Le&&!ct&&dt==="Delete"){L.preventDefault(),Ne("\v",L.currentTarget);return}if(W&&!Ue&&!Le&&!ct&&dt==="ArrowLeft"){L.preventDefault(),Ne("",L.currentTarget);return}if(W&&!Ue&&!Le&&!ct&&dt==="ArrowRight"){L.preventDefault(),Ne("",L.currentTarget);return}if(W)return;if(Le&&!Ue&&!W&&!ct&&dt==="Backspace"){L.preventDefault(),Ne("\x1B",L.currentTarget);return}if(Le&&!Ue&&!W&&!ct&&dt==="Delete"){L.preventDefault(),Ne("\x1Bd",L.currentTarget);return}if(Le&&!Ue&&!W&&!ct&&dt==="ArrowLeft"){L.preventDefault(),Ne("\x1Bb",L.currentTarget);return}if(Le&&!Ue&&!W&&!ct&&dt==="ArrowRight"){L.preventDefault(),Ne("\x1Bf",L.currentTarget);return}const Pt=tT(L,P?.modes?.applicationCursorKeysMode===!0);if(Pt!==null){L.preventDefault(),Ne(Pt,L.currentTarget);return}}if(L.key==="Enter"||L.key==="Go"||L.key==="done"||L.key==="send"){if(Q||ue.current){L.preventDefault();return}if(Nt.current){Nt.current=!1,qt.current!==null&&(clearTimeout(qt.current),qt.current=null),L.preventDefault();return}L.preventDefault(),ye(L.currentTarget);return}if(L.key==="Backspace"){if(Q||ue.current)return;if(!L.currentTarget.value){L.preventDefault(),xe.current("");return}if(L.currentTarget.selectionStart===0&&L.currentTarget.selectionEnd===0){L.preventDefault(),xe.current("");return}}},onCompositionStart:()=>{ue.current=!0,Fs(),Tn({active:!0,text:""})},onCompositionUpdate:L=>{ue.current=!0;const Q=L.data??L.currentTarget.value;Tn(P=>P.active&&P.text===Q?P:{active:!0,text:Q})},onCompositionEnd:L=>{ue.current=!1,Nt.current=!0,qt.current!==null&&clearTimeout(qt.current),qt.current=setTimeout(()=>{Nt.current=!1,qt.current=null},50),Tn({active:!1,text:""}),j(L.currentTarget),Fo()}}),rn.active&&(()=>{const L=ai(rn.text);return a.jsx("div",{"aria-hidden":"true","data-terminal-ime-composition":"true",style:{position:"fixed",left:At.x,top:At.y,zIndex:21,pointerEvents:"none",overflow:"hidden",boxSizing:"content-box",width:L.width,height:L.height,margin:0,padding:0,color:q.foreground,background:q.background,boxShadow:`-1px 0 0 1px ${q.background}`,fontSize:`${zr}px`,fontFamily:Rn,lineHeight:"1",textDecorationLine:"underline",textDecorationStyle:"solid",textDecorationColor:q.foreground,wordBreak:"break-all",whiteSpace:L.whiteSpace,transition:"none"},children:rn.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:Ur?1:0,transform:Ur?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:"Tab"}),a.jsx("div",{ref:Cn,"aria-hidden":!0,className:"absolute left-1/2 top-6 z-30 pointer-events-none transition-opacity duration-150 ease-out",style:{opacity:An.visible?1:0,transform:An.visible?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:An.visible&&(()=>{const{activeDir:L}=An,Q=P=>L===P;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 ${Q("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 ${Q("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 ${Q("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 ${Q("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"})})})]})})()})]})]})});z3.displayName="TerminalViewport";const RL=z3,NL=e=>{const t=e?.retry;return{maxRetries:t?.maxRetries??3,initialRetryDelay:t?.initialDelayMs??1e3,maxRetryDelay:t?.maxDelayMs??8e3,connectionTimeout:e?.connectionTimeoutMs??1e4}},ML=()=>({async createSession(e){return a7(e)},connect(e,t,r){const n=i7(e,t.onEvent,t.onError,{...NL(r),getDimensions:r?.getDimensions});return{close:()=>n()}},async sendInput(e,t){await Ex(e,t)},async resize(e){await s7(e.sessionId,e.cols,e.rows,e.seq)},async close(e){await Ix(e)},async restartSession(e,t){return n7(e,{cols:t.cols,rows:t.rows,mode:t.mode,tmuxSessionName:t.tmuxSessionName})},async forceKill(e){await r7(e)},async tmuxAction(e,t){return t7(e,t)},async listTmuxSessions(){return mp()},async getTmuxStatus(){return pp()},async checkHealth(e){return e7(e)}}),DL="\x1B",BL=/\x1b\[[IO]/g,QL=/\x1b\[<[0-9]+;[0-9]+;[0-9]+[mM]/y,jL=/\x1b\[[0-9]+;[0-9]+;[0-9]+M/y;function r2(e,t,r){return e.lastIndex=r,e.exec(t)?e.lastIndex:-1}function PL(e){const t=e.replace(BL,"");if(t.length===0)return e.length>0;let r=0;for(;r<t.length;){let n=r2(QL,t,r);if(n<0&&(n=r2(jL,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 OL(e){return e===DL}function Bp(e,t){return e.label.trim().length>0?e.label:`Key ${t+1}`}const tu=15;function FL(){return H3.map(e=>e.id)}const H3=[{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 gu(){return H3.map(e=>({...e,programs:[...e.programs],includeAlt:e.includeAlt,rowLayout:[...e.rowLayout],actions:e.actions.map(t=>({...t})),showOnDesktop:e.showOnDesktop}))}function w1(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 W3(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.length>0?t:null}const A1=/^\/(.+)\/([gimsuy]*)$/;function n2(e){return A1.test(e.trim())}function eh(e){const t=e.trim().match(A1);if(!t)return null;try{return new RegExp(t[1]??"",t[2]??"")}catch{return null}}function G3(e){if(typeof e!="string")return null;const t=e.trim();return t?A1.test(t)?eh(t)?t:null:t.toLowerCase():null}function s2(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 i2="||",UL=120;function $L(e){return e.includes(i2)?e.split(i2).filter(t=>t.length>0):[e]}function Hc(e){const t=new Set,r=e.map((i,l)=>{const u=typeof i.id=="string"&&i.id.trim().length>0?i.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):`preset-${l+1}`,h=t.has(u)?`${u}-${l+1}`:u;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=>G3(p)).filter(p=>!!p):[],includeAlt:typeof i.includeAlt=="boolean"?!!i.includeAlt:!1,rowLayout:w1(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=gu()[0];return n&&!r.some(i=>i.id==="default")&&r.unshift(n),r}function zL(e,t){const r=W3(e);if(!r)return"default";for(const n of t)if(n.id!=="default")for(const i of n.programs){const l=eh(i);if(l){if(l.test(r))return n.id}else if(r.includes(i))return n.id}return"default"}function a2(e,t){return e.find(r=>r.id===t)??e.find(r=>r.id==="default")??gu()[0]}function HL(e){return[{id:"auto",label:"Auto"},...e.map(t=>({id:t.id,label:t.label}))]}function WL(e){return[{id:"auto",label:"Auto"},...e.filter(t=>t.showOnDesktop===!0).map(t=>({id:t.id,label:t.label}))]}function V3(e,t){const r=w1(t),n=[];let i=0,l=0;for(;i<e.length;){const u=r[Math.min(l,r.length-1)]??3;n.push({columns:u,items:e.slice(i,i+u)}),i+=u,l+=1}return n}const q3=28,Y3=({mode:e,presetLabel:t,title:r,ariaLabel:n,disabled:i,onPointerDown:l,buttonRef:u})=>a.jsx("button",{ref:u,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(SA,{size:14}):(t.charAt(0)||"?").toUpperCase()}),GL={esc:"\x1B",enter:"\r",home:"\x1B[H",end:"\x1B[F","ctrl-c":"","ctrl-d":"","ctrl-w":"","ctrl-u":""},md=8;function VL(e,t){return GL[e]??null}const qL=({visible:e,interactive:t=!0,presentation:r="mobile",activeModifier:n,lockedModifier:i,disabled:l,defaultShowExtended:u=!1,presetLabel:h,presetModeLabel:p,presetMode:g,presetOptions:x,includeAlt:b,presetRowLayout:w,extraActions:A,onKeyPress:k,onTextPress:I,onPastePress:N,onFilePress:R,fileUploadState:D="idle",fileUploadProgress:O=0,longPressMode:q="arrows",copyFeedback:Y="idle",onLongPressModeToggle:U,onModifierToggle:V,onPresetSelect:me,onExpandedChange:Je})=>{const{t:ve}=Jr(),[_e,Ze]=S.useState(u),[Ve,ce]=S.useState(!1),ke=S.useRef(null),ot=r==="desktop-actions",Ie=ot||_e,[de,qe]=S.useState(!1),[xe,te]=S.useState(null),re=l||!e||!t,ge=l||!e,ze=S.useRef(null),Ke=S.useRef(null),Ae=S.useRef(null),z=S.useRef(null),Oe=S.useRef(null),nt=S.useRef(Y),Re=S.useRef(null),X=S.useRef(0),Be=S.useCallback(ue=>{if(re)return;const Nt=ue.target;if(!(Nt instanceof Element))return;const qt=Nt.closest("button"),Se=qt?.hasAttribute("data-mobile-native-action")===!0;qt&&!Se?(ue.preventDefault(),ho(md)):qt&&ho(md)},[re]),st=S.useCallback(ue=>{ue.preventDefault()},[]),be=S.useCallback(ue=>{const Nt=ue.target;re||Nt instanceof HTMLElement&&Nt.closest("button")&&Nt.blur()},[re]);S.useEffect(()=>{Ze(u)},[u]),S.useEffect(()=>{ot||Je?.(_e)},[ot,Je,_e]),S.useEffect(()=>{re&&(Re.current!==null&&(window.clearTimeout(Re.current.timer),Re.current=null),qe(!1),te(null))},[re]),S.useEffect(()=>{e||(qe(!1),te(null))},[e]),S.useEffect(()=>{if(!de)return;const ue=()=>{const Nt=ze.current?.getBoundingClientRect();Nt&&te({left:Math.max(8,Nt.left),top:Math.max(8,Nt.top-8)})};return ue(),window.addEventListener("resize",ue),window.addEventListener("scroll",ue,!0),()=>{window.removeEventListener("resize",ue),window.removeEventListener("scroll",ue,!0)}},[de]),S.useEffect(()=>{const ue=nt.current;if(nt.current=Y,Y==="idle"||Y===ue)return;if(Oe.current!==null&&window.clearTimeout(Oe.current),!(typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches))if(Y==="copied"){Ke.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 qt=[{opacity:0,transform:"scale(0.65)"},{opacity:.75,transform:"scale(0.9)",offset:.18},{opacity:0,transform:"scale(1.65)"}];Ae.current?.animate?.(qt,{duration:760,easing:"ease-out"}),z.current?.animate?.(qt,{duration:760,delay:130,easing:"ease-out"})}else Ke.current?.animate?.([{transform:"translateX(0)"},{transform:"translateX(-2px)"},{transform:"translateX(2px)"},{transform:"translateX(0)"}],{duration:280,easing:"ease-out"});ho(md),Y==="copied"&&(Oe.current=window.setTimeout(()=>{ho(md),Oe.current=null},90),q==="copy"&&U?.())},[Y,q,U]),S.useEffect(()=>()=>{Oe.current!==null&&window.clearTimeout(Oe.current)},[]);const je=S.useCallback((ue,Nt)=>{re||(ue.preventDefault(),k(Nt))},[k,re]),wt=S.useCallback((ue,Nt)=>{re||(ue.preventDefault(),V(Nt))},[V,re]),Te=S.useCallback(ue=>{re||(ue.preventDefault(),Ze(Nt=>{const qt=!Nt;return qt&&(ce(!0),ke.current!==null&&window.clearTimeout(ke.current),ke.current=window.setTimeout(()=>{ce(!1),ke.current=null},350)),qt}))},[re]),pe=S.useCallback(()=>{const ue=typeof performance<"u"?performance.now():Date.now();ue-X.current<350||(X.current=ue,N?.())},[N]),$e=S.useCallback(ue=>{re||(ue.stopPropagation(),ue.pointerType!=="touch"&&(ue.preventDefault(),pe()))},[re,pe]),pt=S.useCallback(ue=>{re||(ue.preventDefault(),ue.stopPropagation(),pe())},[re,pe]),Tt=S.useCallback(ue=>{re||D==="uploading"||!R||(ue.preventDefault(),ue.stopPropagation(),R())},[D,R,re]),Ct=S.useCallback(ue=>{re||ue.stopPropagation()},[re]),rr=250,ir=S.useCallback(()=>{Re.current!==null&&(window.clearTimeout(Re.current.timer),Re.current=null)},[]);S.useEffect(()=>()=>{ir(),ke.current!==null&&(window.clearTimeout(ke.current),ke.current=null)},[ir]);const yt=S.useCallback((ue,Nt)=>{if(re)return;if(ue.preventDefault(),!Nt.doubleTapSequence){I(Nt.sequence);return}const qt=Re.current;if(qt!==null&&qt.actionId===Nt.id){window.clearTimeout(qt.timer),Re.current=null,I(Nt.doubleTapSequence);return}ir();const Se=window.setTimeout(()=>{Re.current=null,I(Nt.sequence)},rr);Re.current={actionId:Nt.id,timer:Se}},[ir,I,re]),bt=S.useCallback(ue=>{re||(ue.preventDefault(),ue.stopPropagation(),U?.())},[U,re]),_t=S.useCallback(ue=>{re||ue.stopPropagation()},[re]),Qt=S.useCallback(ue=>{if(re)return;ue.preventDefault();const Nt=ue.currentTarget.getBoundingClientRect();te({left:Math.max(8,Nt.left),top:Math.max(8,Nt.top-8)}),qe(qt=>!qt)},[re]),Et=S.useCallback((ue,Nt)=>{re||(ue.preventDefault(),qe(!1),te(null),me(Nt))},[me,re]),Ht=A.length>0,ne=S.useMemo(()=>{const ue=[{id:"preset",kind:"preset"}];if(!ot&&b&&ue.push({id:"alt",kind:"alt"}),Ht){const Nt=A.map(qt=>({id:qt.id,kind:"text",action:qt}));return ue.concat(Nt)}return ot?ue:ue.concat([{id:"home",kind:"key",keyName:"home"},{id:"end",kind:"key",keyName:"end"},{id:"ctrl-d",kind:"key",keyName:"ctrl-d"}])},[A,Ht,b,ot]),Pe=S.useMemo(()=>V3(ne,w),[ne,w]),it=`${ot?"space-y-1":"mt-1 space-y-1"}${Ve?" pointer-events-none":""}`,jt=de&&xe?na.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:xe.left,top:xe.top},children:a.jsx("div",{className:"grid gap-1",children:x.map(ue=>a.jsx("button",{type:"button",onPointerDown:Nt=>Et(Nt,ue.id),tabIndex:-1,disabled:ge,className:`h-7 rounded-full px-3 text-left text-xs font-medium transition-colors disabled:opacity-50 ${ue.id===g?"bg-primary text-primary-foreground":"bg-surface-2 hover:bg-surface-elevated text-muted-foreground hover:text-foreground"}`,children:ue.label},ue.id))})}),document.body):null;return a.jsxs(a.Fragment,{children:[jt,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?ot?"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:st,onFocusCapture:be,children:a.jsxs("div",{className:"rounded-2xl bg-surface-elevated p-0.5 space-y-0.5",children:[!ot&&a.jsxs("div",{"data-mobile-keyboard-primary-row":"true",className:"grid grid-cols-10 gap-1",children:[a.jsx("button",{type:"button",onPointerDown:ue=>je(ue,"esc"),tabIndex:-1,disabled:ge,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:ue=>wt(ue,"ctrl"),tabIndex:-1,disabled:ge,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:ue=>je(ue,"ctrl-c"),tabIndex:-1,disabled:ge,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:ue=>je(ue,"ctrl-u"),tabIndex:-1,disabled:ge,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:Ct,onTouchStart:Ct,onClick:Tt,tabIndex:-1,disabled:ge||!R||D==="uploading",title:D==="uploading"?`${ve("rightSidebar.uploading")} ${Math.round(O)}%`:ve(D==="inserted"?"rightSidebar.inserted":D==="failed"?"rightSidebar.uploadFailed":"rightSidebar.insertLocalFile"),"aria-label":ve("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 ${D==="inserted"?"bg-primary/15 text-primary":D==="failed"?"bg-destructive/15 text-destructive":"bg-surface-2"}`,children:[D==="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,O))}%`}}),a.jsx("span",{className:"relative z-10 flex items-center justify-center",children:D==="uploading"?a.jsx(cn,{size:15,className:"animate-spin"}):D==="inserted"?a.jsx(ya,{size:15}):D==="failed"?a.jsx(gs,{size:15}):a.jsx(J9,{size:15})}),D!=="idle"&&a.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:D==="uploading"?`${ve("rightSidebar.uploading")} ${Math.round(O)}%`:ve(D==="inserted"?"rightSidebar.inserted":"rightSidebar.uploadFailed")})]}),a.jsx("button",{type:"button",onPointerDown:()=>I("/"),tabIndex:-1,disabled:ge,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:ue=>je(ue,"enter"),tabIndex:-1,disabled:ge,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(V9,{size:16})}),a.jsxs("button",{ref:Ke,type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:_t,onTouchStart:_t,onClick:bt,tabIndex:-1,disabled:ge,title:ve(Y==="copied"?"terminal.copied":Y==="failed"?"terminal.copyFailed":q==="copy"?"terminal.longPressSelectsText":"terminal.longPressSendsArrows"),"aria-label":ve(q==="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 ${Y==="copied"?"bg-primary/15 text-primary":Y==="failed"?"bg-destructive/15 text-destructive":q==="copy"?"bg-primary/15 text-primary":"bg-surface-2"}`,children:[a.jsx("span",{ref:Ae,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/70 opacity-0"}),a.jsx("span",{ref:z,"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(ya,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${Y==="copied"?"scale-100 rotate-0 opacity-100":"scale-50 -rotate-45 opacity-0"}`}),a.jsx(gs,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-200 ease-out motion-reduce:transition-none ${Y==="failed"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),a.jsx(zx,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${Y==="idle"&&q==="copy"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),a.jsx(Sw,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${Y==="idle"&&q==="arrows"?"scale-100 rotate-0 opacity-100":"scale-50 rotate-45 opacity-0"}`})]}),Y!=="idle"&&a.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:Y==="copied"?`${ve("terminal.copied")} · ${ve("terminal.longPressSendsArrows")}`:`${ve("terminal.copyFailed")} · ${ve("terminal.longPressSelectsText")}`})]}),a.jsx("button",{type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:$e,onPointerUp:Ct,onTouchStart:Ct,onTouchEnd:Ct,onClick:pt,tabIndex:-1,disabled:ge,title:ve("terminal.paste"),"aria-label":ve("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(P9,{size:15})}),a.jsx("button",{type:"button",onPointerDown:Te,tabIndex:-1,disabled:ge,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:_e?a.jsx(o7,{size:16}):a.jsx(Oo,{size:16})})]}),Ie&&a.jsx("div",{className:it,children:Pe.map((ue,Nt)=>{const qt=ue.items[0]?.kind==="preset",Se=Math.max(2,ue.columns),Ce=qt?`${q3}px repeat(${Math.max(1,Se-1)}, minmax(0, 1fr))`:`repeat(${Se}, minmax(0, 1fr))`;return a.jsx("div",{className:"relative grid gap-1",style:{gridTemplateColumns:Ce},children:ue.items.map(ut=>ut.kind==="preset"?a.jsx(Y3,{buttonRef:ut.id==="preset"?ze:void 0,mode:g,presetLabel:h,title:p,disabled:ge,onPointerDown:Qt},ut.id):ut.kind==="alt"?a.jsx("button",{type:"button",onPointerDown:Ge=>wt(Ge,"alt"),tabIndex:-1,disabled:ge,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"})},ut.id):ut.kind==="text"?a.jsxs("button",{type:"button",onPointerDown:Ge=>yt(Ge,ut.action),tabIndex:-1,disabled:ge,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:[ut.action.label,ut.action.doubleTapSequence&&a.jsx("span",{className:"absolute top-0.5 right-1.5 h-1 w-1 rounded-full bg-accent/60"})]},ut.id):a.jsx("button",{type:"button",onPointerDown:Ge=>je(Ge,ut.keyName),tabIndex:-1,disabled:ge,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:ut.keyName==="ctrl-d"?"Ctrl-D":ut.keyName==="home"?"Home":"End"},ut.id))},`row-${Nt}`)})})]})})]})},YL=({isMobile:e,isInputFocused:t,isIOS:r,isConnecting:n,connectionError:i,terminalSessionId:l})=>{if(typeof window>"u")return null;const u=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~: ",u,"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"})})]})},ZL=/^Reconnecting/i,KL=({connectionError:e,isFatalError:t,isRestarting:r,isConnecting:n,onHardRestart:i})=>{const{t:l}=Jr(),u=!!e&&ZL.test(e),h=!!(n&&!e||u),[p,g]=S.useState(!1);return S.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("span",{className:"text-[11px] text-muted-foreground/60 animate-pulse tracking-wide",children:l("connection.reconnecting")})}):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 ru=[],Rf=!1;function ga(e,t,r={}){typeof window>"u"||(ru.push(JSON.stringify({level:e,message:t,data:{ts:Date.now(),...r}})),XL())}async function XL(){if(!Rf){Rf=!0;try{for(;ru.length>0;){const e=ru[0];try{await fetch("/api/client-log",{method:"POST",headers:{"Content-Type":"application/json"},body:e,keepalive:!0}),ru.shift()}catch{ru=[];break}}}finally{Rf=!1}}}const JL=120,ek=80,tk=400;function o2(){if(typeof window>"u"||document.visibilityState!=="visible"||!l7())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=Mo().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 Z3(e){const{enabled:t,openThresholdPx:r=JL,closeThresholdPx:n=ek,settleDelayMs:i=tk}=e,l=S.useMemo(()=>Kc("keyboard"),[]),u=S.useRef(!1),h=S.useRef(null),p=S.useRef(0),[g,x]=S.useState({isOpen:!1,isSettled:!1,keyboardHeight:0});return S.useEffect(()=>{if(typeof window>"u"||!t){u.current=!1,h.current!==null&&(clearTimeout(h.current),h.current=null),x(U=>!U.isOpen&&!U.isSettled&&U.keyboardHeight===0?U:{isOpen:!1,isSettled:!1,keyboardHeight:0});return}let b=null;const w=()=>{b=null;const U=o2();let V=u.current;if(U>=r?V=!0:U<=n&&(V=!1),u.current=V,V){const me=Math.abs(U-p.current);p.current=U,me>10&&(h.current!==null&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,x(Je=>Je.isSettled?Je:{...Je,isSettled:!0})},i))}else h.current!==null&&(clearTimeout(h.current),h.current=null);x(me=>{const Je=V?me.isSettled:!1;return me.isOpen===V&&me.keyboardHeight===U&&me.isSettled===Je?me:(l("sync",{keyboardHeight:U,isOpen:V,isSettled:Je,visualViewport:Mo().visualViewport?{width:Math.round(Mo().visualViewport.width),height:Math.round(Mo().visualViewport.height),offsetTop:Math.round(Mo().visualViewport.offsetTop)}:null}),{isOpen:V,isSettled:Je,keyboardHeight:U})})},A=(U="event")=>{(U.includes("visibilitychange")||U.includes("pageshow"))&&l("schedule",{source:U}),b===null&&(b=window.requestAnimationFrame(w))};A("mount");const k=()=>A("resize"),I=()=>A("orientationchange"),N=()=>A("visualViewport.resize"),R=()=>A("visualViewport.scroll"),D=()=>A("viewport-keyboard-change");window.addEventListener("resize",k),window.addEventListener("orientationchange",I),Mo().visualViewport?.addEventListener("resize",N),Mo().visualViewport?.addEventListener("scroll",R),document.addEventListener("termdock:viewport-keyboard-change",D);const O=U=>{l("resume",{source:U,keyboardHeight:o2(),hidden:document.hidden}),A(`${U}:now`),window.setTimeout(()=>A(`${U}:50ms`),50),window.setTimeout(()=>A(`${U}:200ms`),200)},q=()=>{document.hidden||O("visibilitychange")},Y=()=>O("pageshow");return document.addEventListener("visibilitychange",q),window.addEventListener("pageshow",Y),()=>{window.removeEventListener("resize",k),window.removeEventListener("orientationchange",I),Mo().visualViewport?.removeEventListener("resize",N),Mo().visualViewport?.removeEventListener("scroll",R),document.removeEventListener("termdock:viewport-keyboard-change",D),document.removeEventListener("visibilitychange",q),window.removeEventListener("pageshow",Y),b!==null&&window.cancelAnimationFrame(b),h.current!==null&&(clearTimeout(h.current),h.current=null)}},[l,t,r,n,i]),g}const Ud=300,rk=120,nk=2e3,sk=250,ik=6e4;function ak(e){const t=new Set(e.slides.flat()),r=new Set([...e.visibleSessionIds].filter(u=>t.has(u)));e.foregroundSessionId&&t.has(e.foregroundSessionId)&&r.add(e.foregroundSessionId);const n=e.slides.findIndex(u=>u.some(h=>r.has(h)));if(n<0)return r;const i=e.slides[n-1]??[],l=e.slides[n+1]??[];for(let u=0;u<Math.max(i.length,l.length)&&r.size<3;u+=1)for(const h of[i[u],l[u]])h&&r.size<3&&r.add(h);return r}function Nf(e,t){return t?e.find(r=>r.id===t||r.backendSessionId===t)?.id??null:null}function gd(e){return e.prioritySessionId??e.activeSessionId??e.persistedActiveSessionId??e.firstSessionId}function ok(e){return e.foregroundSessionId===null||e.isVisible===!0||e.sessionId===e.foregroundSessionId||e.foregroundReady}function lk(e){return e.sessionId===e.foregroundSessionId||e.visibleSessionIds.has(e.sessionId)||e.deferredViewportSessionIds.has(e.sessionId)}function ck(e){return e.isMobile&&(!e.viewportReady||!e.streamReady||!e.contentReady)}function uk(e){return e.writtenChunkId!==null&&e.initialTargetChunkId!==null&&e.writtenChunkId>=e.initialTargetChunkId}function dk(e){return!e.initialConnectionPending}function hk(e){return!e}function fk(e){return e.requestToken===0||e.isVisible===!0||e.foregroundSessionId===null||e.isVisible===void 0&&e.sessionId===e.foregroundSessionId||e.foregroundCompletedToken===e.requestToken}function pk(e,t){return[...e].every(r=>t.has(r))}function mk(e,t){return e===null||t-e>=sk}function gk(e){return!1}function xk(e){return!e.isActive||e.isStreamReady||e.reconnectStartedAt===null?null:Math.max(0,ik-(e.now-e.reconnectStartedAt))}function bk(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,Ud+n*rk),n+=1}return r}const yk="Session not found on server",Mf="Terminal session not found",vk="STALE_SESSION_RESTORE_REJECTED";function wk(e){return e?.message===yk}function l2(e){return e?.code===vk}function Ak(e,t){if(!e||e.startsWith("/"))return e;const r=e.replace(/^\.\//,"");return t?`${t.replace(/\/+$/,"")}/${r}`:r}function K3(e,t){return Ak(e,t).replace(/ /g,"\\ ")}function X3(e,t){return`${K3(e,t)} `}function c2(e,t){return K3(e,t)}function gO(e,t,r){if(!r)return c2(e,t);const n=r.start===r.end?`${r.start}`:`${r.start}-${r.end}`;return`${c2(e,t)}:${n}`}const Tk="/tmp";async function J3(e,t,r){const i=(await t(Tk,[e])).files[0];if(!i?.path)throw new Error("Upload did not return a file path");return r(i.path),i}const xO=J3,Ck=320,u2="termdock:mobile-keyboard-expanded",d2="termdock:mobile-keyboard-preset-mode",h2="termdock:mobile-long-press-mode",Sk=80;function Df(){return typeof window>"u"?!1:(navigator.maxTouchPoints>0||"ontouchstart"in window)&&window.innerWidth<768}const _k={retry:{maxRetries:60,initialDelayMs:1e3,maxDelayMs:2e4},connectionTimeoutMs:15e3},Lk=({sessionId:e,mode:t,tmuxSessionName:r=null,terminalSettings:n=v1(),colorTheme:i="dark",toolbarPresets:l=[],isActive:u=!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:I=0,initialConnectEnabled:N=!0,resumeRequestEnabled:R=!0,onStreamReadyChange:D,onStreamConnected:O,onViewportReadyChange:q,onContentReadyChange:Y,onKeyboardVisibilityChange:U,suppressKeyboard:V=!1,keyboardPortalTarget:me=null,sharedMobileKeyboardLayout:Je=!1,suppressPageFlipRefresh:ve=!1,showDebug:_e,onStatusChange:Ze})=>{const{t:Ve}=Jr(),[ce]=S.useState(e||r3()),[ke,ot]=S.useState(()=>(e?gp(e):null)??n.fontSize),Ie=S.useMemo(()=>ML(),[]),de=S.useMemo(()=>Kc("session"),[]),qe=S.useMemo(()=>Kc("keyboard"),[]),xe=S.useRef(null),te=S.useRef(null);S.useEffect(()=>{gp(ce)===null&&ot(n.fontSize)},[n.fontSize,ce]);const re=S.useMemo(()=>({...n,fontSize:ke}),[n,ke]),[ge,ze]=S.useState(Df),[Ke,Ae]=S.useState(!1),[z,Oe]=S.useState(!1),[nt,Re]=S.useState(!1),[X,Be]=S.useState(()=>typeof document>"u"?!0:!document.hidden&&X0()),[st,be]=S.useState(()=>typeof document>"u"?!0:document.hasFocus()),[je,wt]=S.useState(!1),[Te,pe]=S.useState(!1),[$e,pt]=S.useState(!1),[Tt,Ct]=S.useState(!1),[rr,ir]=S.useState(!0),{isOpen:yt,keyboardHeight:bt}=Z3({enabled:ge&&u}),[_t,Qt]=S.useState(null),[Et,Ht]=S.useState(null),[ne,Pe]=S.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(u2)==="true"),[it,jt]=S.useState(()=>{if(typeof window>"u")return"auto";const se=window.localStorage.getItem(d2);return se&&se.length>0?se:"auto"}),[ue,Nt]=S.useState(()=>typeof window>"u"?"arrows":window.localStorage.getItem(h2)==="copy"?"copy":"arrows"),[qt,Se]=S.useState("idle"),[Ce,ut]=S.useState("idle"),[Ge,dr]=S.useState(0),Rt=Vr(se=>se.sessions.get(ce)),{setTerminalSession:un,setConnecting:It,appendToBuffer:jn,replaceBuffer:is,clearTerminalSession:Pn,removeTerminalSession:Tr,clearBuffer:In,setSessionActiveProgram:Br,setSessionCwd:ie,setSessionCopyMode:$r,setSessionAgentStatus:ft,setSessionShellTitle:hr,setSessionPromptState:Ls,clearAgentNeedsReview:Un}=Vr.getState(),as=S.useMemo(()=>`wt-${ce.replace(/[^a-zA-Z0-9_-]/g,"").slice(0,12)}`,[ce]),Pr=Rt?.terminalSessionId??null,Yt=Rt?.mode??"shell",Xn=Rt?.activeProgram??null,dn=S.useMemo(()=>Hc(l),[l]),kr=Yt==="tmux",Or=Rt?.bufferChunks??[],Ur=Rt?.isConnecting??!1,qr=Pr,An=S.useCallback(async(se,We)=>{const et=tL(se,Rt?.cwd||Rt?.directory);if(!et)return;let $t=et,Fe="directory";try{$t=(await a1(et)).path}catch(St){if(!(St instanceof Error)||St.message!=="Path is not a directory")return;Fe="file"}try{const St=Jt.getState();St.setRightTab("files"),St.openRight(),window.dispatchEvent(new CustomEvent(Y_,{detail:{path:$t,kind:Fe,line:We}}))}catch{}},[Rt?.cwd,Rt?.directory]),Yr=t??Rt?.mode??"shell",jr=Yr==="tmux"?r??Rt?.tmuxSessionName??null:null,[En,Z]=S.useState(null),He=S.useRef(!1),[xt,cr]=S.useState(!1),[Gt,At]=S.useState(!1),[hn,nn]=S.useState(null),[On,rn]=S.useState(0),[Tn,Cn]=S.useState(null),$n=_e!==void 0?_e:!1,ar=S.useRef(null),us=S.useRef(null),yr=S.useRef(null),Qr=S.useRef(null),Cr=S.useRef(null),ds=S.useRef(!1),Ln=S.useRef(null),Rn=S.useRef([]),zr=S.useRef(0),Jn=S.useRef(!1),es=S.useRef(null),ur=S.useRef(null),Hr=S.useRef(-1),on=S.useRef(null),Ms=S.useRef(0),yn=S.useRef(null),$=S.useRef(null),he=S.useRef(0),De=S.useRef(!1),Ee=S.useRef(null),Me=S.useRef(null),ht=S.useRef(!1),vt=S.useRef(0),lt=S.useRef(!1),rt=S.useRef(!1),mt=S.useRef(!1),fr=S.useRef(null),gt=S.useRef(null),Kt=S.useRef(null),at=S.useRef(u);at.current=u;const nr=S.useRef(h);nr.current=h;const Ar=S.useRef(ge),er=S.useRef(null),Gr=S.useRef(null),Mr=S.useRef(null),Sr=S.useRef(null),Nn=S.useRef(null),F=S.useRef(null),ae=S.useRef(null),le=S.useCallback(()=>{const se=++vt.current,We=()=>{se===vt.current&&pe(!0)};if(typeof window>"u"){We();return}window.requestAnimationFrame(()=>window.requestAnimationFrame(We))},[]),Qe=S.useCallback(se=>{if(lt.current){if(gt.current!==null&&(window.clearTimeout(gt.current),gt.current=null),se.x===0&&se.y>=se.rows-1){ir(!1);return}gt.current=window.setTimeout(()=>{gt.current=null,ir(!0)},Sk)}},[]),Mt=S.useRef(null);S.useEffect(()=>()=>{Mt.current?.()},[]);const Ut=S.useCallback(()=>{Mt.current||(Mt.current=d1(()=>{Mt.current=null;const se=Vr.getState(),We=yr.current,et=se.getTerminalSession(ce);if(!We||et?.mode!=="shell"||se.hasPendingBufferWrites(ce))return;const $t=c7(We),Fe=Cr.current?.getDimensions();if(!$t||!Fe)return;const St=Cr.current?.serializeSnapshot();St&&u7({id:We,version:1,...$t,...Fe,data:St,savedAt:Date.now()})},2e3))},[ce]),Xt=S.useCallback(se=>{const We=Vr.getState(),et=We.getTerminalSession(ce)?.bufferChunks.at(-1)?.id;if(yr.current&&et!==void 0&&et<=se&&!We.hasPendingBufferWrites(ce)&&(d7(yr.current),Ut()),!De.current||!uk({writtenChunkId:se,initialTargetChunkId:Ee.current}))return;const $t=Me.current;Me.current=null,$t!==null&&Cr.current?.notifyScreenSynchronized($t),De.current=!1,Ee.current=null,le()},[le,Ut,ce]),pr=S.useCallback(se=>{if(!lt.current)return;const We=fr.current;We&&We.x===se.x&&We.y===se.y&&We.rows===se.rows||(fr.current=se,gt.current!==null&&(window.clearTimeout(gt.current),gt.current=null),se.x===0&&se.y>=se.rows-1&&ir(!1))},[]);S.useEffect(()=>{if(!p){rt.current=!1;return}rt.current||(rt.current=!0,mt.current=!1,lt.current=!0,fr.current=null,ir(!1),gt.current!==null&&(window.clearTimeout(gt.current),gt.current=null),Kt.current!==null&&window.clearTimeout(Kt.current),Kt.current=window.setTimeout(()=>{Kt.current=null,gt.current!==null&&typeof window<"u"&&window.clearTimeout(gt.current),gt.current=null,lt.current=!1,ir(!0)},15e3))},[p]);const Dr=S.useCallback(()=>{Sr.current=null;const se=Mr.current;Mr.current=null,se&&hr(se.sessionId,se.title)},[hr]),fn=S.useCallback((se,We)=>{if(Mr.current={sessionId:se,title:We},Sr.current===null){if(typeof window>"u"){Dr();return}Sr.current=window.requestAnimationFrame(Dr)}},[Dr]),j=S.useCallback(()=>{Sr.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(Sr.current),Sr.current=null,Mr.current=null},[]),ye=S.useCallback(async()=>{const se=Yr;return(await h7({preferredFrontendSessionId:ce,mode:se,tmuxSessionName:se==="tmux"?jr||as:void 0,termType:"xterm-256color",requireExisting:!0})).terminalSession},[Yr,jr,as,ce]),Ne=S.useRef(u);S.useEffect(()=>{if(!u){Cr.current?.blur(),Ne.current=!1;return}if(Ne.current)return;Ne.current=!0;const se=p_(ge,ve);if(se==="single"){Cr.current?.requestRefresh("focus",{skipResizePush:!0,skipScrollToBottom:!0});return}se!=="none"&&Cr.current?.requestRefresh("page-flip",{reconcileServerSize:!0,skipScrollToBottom:!0})},[u,ge,ve,qr]),S.useEffect(()=>{Ar.current=ge},[ge]);const tt=S.useCallback(()=>{!at.current||nr.current||Cr.current?.focus()},[]);S.useLayoutEffect(()=>{h&&Cr.current?.blur()},[h]),S.useEffect(()=>{if(!u||h||rr||mt.current)return;mt.current=!0;const se=window.requestAnimationFrame(()=>{Cr.current?.requestPtyRedraw()});return()=>window.cancelAnimationFrame(se)},[h,u,rr]);const Lt=S.useCallback(se=>{typeof window>"u"||typeof document>"u"||!at.current||nr.current||Ar.current||document.hidden||!X0()||(er.current!==null&&window.clearTimeout(er.current),er.current=window.setTimeout(()=>{if(er.current=null,!at.current||nr.current||Ar.current||document.hidden||!X0())return;const We=document.activeElement,et=We?.getAttribute("data-terminal-input-anchor")==="true";if((We instanceof HTMLInputElement||We instanceof HTMLTextAreaElement||We instanceof HTMLSelectElement||We?.isContentEditable===!0)&&!et){qe("desktop resume focus skipped: editable active",{reason:se});return}qe("desktop resume focus",{reason:se}),Cr.current?.requestRefresh("focus",{force:!0,forceRedraw:!0,skipResizePush:!0,skipScrollToBottom:!0}),Cr.current?.focus()},50))},[qe]);S.useEffect(()=>()=>{er.current!==null&&typeof window<"u"&&window.clearTimeout(er.current),er.current=null,Gr.current!==null&&typeof window<"u"&&window.clearTimeout(Gr.current),Gr.current=null,Nn.current!==null&&typeof window<"u"&&window.clearTimeout(Nn.current),Nn.current=null,F.current!==null&&typeof window<"u"&&window.clearTimeout(F.current),F.current=null,Kt.current!==null&&typeof window<"u"&&window.clearTimeout(Kt.current),Kt.current=null,gt.current!==null&&typeof window<"u"&&window.clearTimeout(gt.current),gt.current=null},[]),S.useEffect(()=>{if(typeof document>"u"||typeof window>"u")return;const se=()=>{Gr.current!==null&&window.clearTimeout(Gr.current),Gr.current=window.setTimeout(()=>{Gr.current=null;const We=document.activeElement,$t=!(We?.getAttribute("data-terminal-input-anchor")==="true")&&!!(We&&(We instanceof HTMLInputElement||We instanceof HTMLTextAreaElement||We instanceof HTMLSelectElement||We.isContentEditable));EA({isActive:at.current&&!nr.current,isMobile:Ar.current,documentVisible:!document.hidden,activeElementIsEditable:$t})&&tt()},0)};return document.addEventListener("pointerup",se),()=>{document.removeEventListener("pointerup",se),Gr.current!==null&&(window.clearTimeout(Gr.current),Gr.current=null)}},[tt]);const Zt=S.useCallback(()=>{Zr.current=!1,rn(se=>se+1)},[]),Vt=S.useCallback((se,We,et)=>{const $t=yr.current,Fe=Date.now();if($t&&We&&f7($t)){te.current={startedAt:Fe,strategy:"reconnect",reason:se},ga("info","PWA_RESUME terminal-start",{frontendSessionId:ce,backendSessionId:$t,strategy:"reconnect",reason:se,active:at.current});return}if($t&&p7($t,()=>{const St=te.current;ga("info","PWA_RESUME terminal-responsive",{frontendSessionId:ce,backendSessionId:$t,durationMs:St?Date.now()-St.startedAt:null,strategy:St?.strategy??"probe",reason:St?.reason??se}),te.current=null,O?.(ce)},{visible:et})){te.current={startedAt:Fe,strategy:"probe",reason:se},ga("info","PWA_RESUME terminal-start",{frontendSessionId:ce,backendSessionId:$t,strategy:"probe",reason:se,active:at.current}),de("[Terminal] resume probe sent",{reason:se,backendSessionId:$t,active:at.current});return}if(de("[Terminal] resume probe missing connection, restarting ensureSession",{reason:se,backendSessionId:$t,active:at.current}),!dk({initialConnectionPending:ht.current})){de("[Terminal] resume probe deferred during initial websocket handshake",{reason:se,backendSessionId:$t});return}Zt()},[de,O,Zt,ce]),zt=S.useCallback((se,We)=>{const et=yr.current;et&&Ln.current!==se&&(Ln.current=se,vm(et,se,We),de("[Terminal] flow-control state sent",{backendSessionId:et,paused:se,reason:We}))},[de]),_r=S.useCallback((se,We)=>{const et=yr.current;et&&yn.current!==se&&(yn.current=se,wm(et,se,We),de("[Terminal] focus state sent",{backendSessionId:et,focused:se,reason:We}))},[de]),bs=S.useCallback((se,We)=>{const et=yr.current;et&&$.current!==se&&($.current=se,Am(et,se,We),de("[Terminal] viewing state sent",{backendSessionId:et,viewing:se,reason:We}))},[de]),ai=kA({isActive:u&&!h,viewportFocused:nt,documentVisible:X,windowFocused:st,streamReady:je}),Fs=IA({isActive:u,documentVisible:X,windowFocused:st,streamReady:je,isDesktop:fo()!==null}),Fo=S.useRef(ai),ks=S.useRef(Fs);S.useEffect(()=>{Fo.current=ai,_r(ai,"logical-focus-change")},[ai,_r,qr]),S.useEffect(()=>{ks.current=Fs,bs(Fs,"logical-viewing-change")},[Fs,bs,qr]),$A(qr,X,je),S.useEffect(()=>{const se=We=>{const et=We.detail;!et||et.sessionId!==ce||ot(et.fontSize??n.fontSize)};return window.addEventListener("termfontchange",se),()=>window.removeEventListener("termfontchange",se)},[ce,n.fontSize]),S.useEffect(()=>{const se=()=>{const Fe=!document.hidden&&X0();Be(Fe),Fe&&u&&Lt("visibility")},We=Fe=>{u&&Lt(Fe.persisted?"bfcache":"pageshow")},et=()=>{be(!0),Lt("window-focus")},$t=()=>be(!1);return document.addEventListener("visibilitychange",se),window.addEventListener(Tm,se),window.addEventListener("pageshow",We),window.addEventListener("focus",et),window.addEventListener("blur",$t),()=>{document.removeEventListener("visibilitychange",se),window.removeEventListener(Tm,se),window.removeEventListener("pageshow",We),window.removeEventListener("focus",et),window.removeEventListener("blur",$t)}},[u,Lt]),S.useEffect(()=>{if(!b||!R||!Hn.current)return;const se=A,We=se<=0,et=xe.current;if(et?.token===b&&(et.visible||!We))return;const $t=()=>{xe.current={token:b,visible:We},Cr.current?.requestRefresh(w,{skipScrollToBottom:!0}),Vt(se>0?"global-resume-background":"global-resume-visible",se<=0&&k,We)};if(se<=0){$t();return}const Fe=window.setTimeout($t,se);return()=>window.clearTimeout(Fe)},[b,w,R,A,k,Vt]);const Is=S.useRef(0);S.useEffect(()=>{if(je){Is.current=0;return}if(!xt||En==="Authentication required"||En===Mf)return;const se=Is.current,We=Math.min(2e3*Math.pow(2,Math.min(se,4)),3e4),et=setTimeout(()=>{Is.current+=1,de("[Terminal] fatal self-heal: auto restarting ensureSession",{attempt:Is.current,backendSessionId:yr.current}),Z("Reconnecting..."),cr(!1),Zt()},We);return()=>clearTimeout(et)},[En,xt,je,On,de,Zt]),S.useEffect(()=>{if(typeof window>"u"){Ae(!1);return}const se=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;Ae(se)},[]),S.useEffect(()=>{(!u||!ge)&&Oe(!1),u||Re(!1)},[u,ge]),S.useEffect(()=>{yr.current=qr,Hr.current=-1,Me.current=null,yn.current=null,$.current=null,Ln.current=null},[qr]),S.useEffect(()=>{D?.(ce,je)},[je,D,ce]),S.useEffect(()=>{Y?.(ce,je&&Te&&$e)},[Te,$e,je,Y,ce]),S.useEffect(()=>{kr||(Jn.current=!1,es.current=null,ur.current&&(clearTimeout(ur.current),ur.current=null))},[kr]),S.useEffect(()=>{qr&&Cr.current?.requestRefresh("session-key-change",{force:!0})},[qr]),S.useEffect(()=>{const se=u&&ge&&yt;qe("visibility signal",{sessionId:ce,isActive:u,isMobile:ge,isInputFocused:z,isViewportKeyboardOpen:yt,viewportKeyboardHeight:bt,visible:se}),U?.(ce,se)},[U,ce,u,ge,yt,bt,qe]),S.useEffect(()=>{u&&x&&x!==Ms.current&&(Ms.current=x,tt())},[x,tt,u]),S.useEffect(()=>{Qr.current=ce},[ce]),S.useEffect(()=>{!ge&&(_t!==null||Et!==null)&&(Qt(null),Ht(null),on.current=null)},[ge,_t,Et]),S.useEffect(()=>{!qr&&(_t!==null||Et!==null)&&(Qt(null),Ht(null),on.current=null)},[qr,_t,Et]),S.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(u2,ne?"true":"false")},[ne]),S.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(d2,it)},[it]),S.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(h2,ue)},[ue]),S.useEffect(()=>{ze(Df());const se=()=>{ze(Df())};return window.addEventListener("resize",se),()=>window.removeEventListener("resize",se)},[]);const zn=S.useCallback(()=>{he.current+=1,Dr(),j();const se=ar.current;ar.current=null,us.current=null,ht.current=!1,wt(!1),Cr.current?.setSessionReady(!1);const We=yr.current;We&&vm(We,!1,"stream-disconnect"),ds.current=!1,Ln.current=null,Rn.current=[],se?.()},[j,Dr]),$i=S.useCallback(async se=>{if(us.current===se){de(`[startStream] Skipping - already connected to ${se}`);return}de(`[startStream] Starting stream for frontendSessionId=${ce} backendSessionId=${se}`),nn(null),vt.current+=1,De.current=!1,Ee.current=null,pe(!1),pt(!1),zn();const We=he.current+1;he.current=We,ht.current=!0;const et=Vr.getState().getTerminalSession(ce);if(et?.mode==="shell"&&!et.bufferChunks.length){const Fe=await Promise.race([m7(se),new Promise(St=>window.setTimeout(()=>St(null),75))]);if(he.current!==We||Qr.current!==ce)return;if(Fe&&!Vr.getState().getTerminalSession(ce)?.bufferChunks.length){Vr.getState().replaceBuffer(ce,[Fe.data]);const St=Cr.current?.getDimensions();St?.cols===Fe.cols&&St.rows===Fe.rows&&g7(se,Fe.seq,Fe.epoch)}}const $t=Ie.connect(se,{onEvent:Fe=>{if(he.current!==We)return;const St=ce;if(St)switch(Fe.type){case"connected":{ht.current=!1;const Er=te.current;Er&&(ga("info","PWA_RESUME terminal-connected",{frontendSessionId:St,backendSessionId:yr.current,durationMs:Date.now()-Er.startedAt,strategy:Er.strategy,reason:Er.reason}),te.current=null),O?.(St),(Fe.runtime||Fe.ptyBackend)&&de(`[Terminal] connected frontendSessionId=${St} backendSessionId=${yr.current} runtime=${Fe.runtime??"unknown"} pty=${Fe.ptyBackend??"unknown"} cwd=${Fe.cwd??"unknown"}`),It(St,!1),Z(null),cr(!1),nn(null),wt(!0),yr.current&&(wm(yr.current,Fo.current,"stream-connected"),Am(yr.current,ks.current,"stream-connected")),Cr.current?.setSessionReady(!0),Ln.current=null,zt(ds.current,"stream-connected"),Fe.tuiProgress!==void 0&&Vr.getState().setSessionTuiProgress(St,Fe.tuiProgress??null),Fe.shellTitle!==void 0&&Vr.getState().setSessionShellTitle(St,Fe.shellTitle??null),Fe.promptState!==void 0&&Fe.promptState!==null&&Vr.getState().setSessionPromptState(St,Fe.promptState);const Fr=Vr.getState().getTerminalSession(St);if(Fr?.terminalSessionId&&Fe.mode&&Vr.getState().setTerminalSession(St,{sessionId:Fr.terminalSessionId,cols:80,rows:24,mode:Fe.mode,tmuxSessionName:Fe.tmuxSessionName??null,cwd:Fe.cwd??null}),Fe.activeProgram!==void 0&&Br(St,Fe.activeProgram??null,Fe.activeProgramSource??null,Fe.activeProgramRaw??null),Cr.current?.requestRefresh("connected",{force:!0,reconcileServerSize:at.current}),Fe.mode!=="tmux"&&(Cn(null),$r(St,!1)),de("[Terminal] Connected event received:",{frontendSessionId:St,backendSessionId:yr.current,storeHasState:!!Fr,storeTerminalId:Fr?.terminalSessionId,hasHistoryInStore:!!Fr?.history?.length,historyLength:Fr?.history?.length??0}),Fr?.history&&Fr.history.length>0){de(`[Terminal] Restoring ${Fr.history.length} history chunks to frontend session ${St}`);const pn=Fr.history.reduce((ws,Wn)=>ws+Wn.length,0),Sn=Math.max(300,Math.min(2e3,Math.ceil(pn/200)));zr.current=Date.now()+Sn,Fr.history.forEach(ws=>{jn(St,ws,{markActivity:!1})}),Vr.getState().setSessionHistory(St,[]),de(`[Terminal] History restoration complete for ${St}`)}else de(`[Terminal] No history to restore for ${St}`);const vn=Fe.replayChunks,Rr=!!Fr?.history?.length||!!vn?.length;if(Rr?De.current=!0:le(),vn&&vn.length>0){let pn=null;if(Fe.replayOutOfWindow)de(`[Terminal] Replay out-of-window, atomically replacing buffer (${vn.length} chunks)`),pn=is(St,ZA(vn));else{de(`[Terminal] Replay incremental: ${vn.length} chunks`);for(const Wn of vn)jn(St,Wn)}const Sn=vn.reduce((Wn,fs)=>Wn+fs.length,0),ws=Math.max(200,Math.min(1500,Math.ceil(Sn/200)));zr.current=Math.max(zr.current,Date.now()+ws),Ee.current=pn}Rr&&Ee.current===null&&(Ee.current=Vr.getState().flushPendingBufferWrites(St),Ee.current===null&&(De.current=!1,le()));break}case"reconnecting":{nn(Er=>Er??Date.now()),Z("Reconnecting..."),cr(!1);break}case"data":{Fe.data&&(ds.current?Rn.current.push(Fe.data):jn(St,Fe.data));break}case"tmux-layout":{Cn(Fe.layout??null),Fe.layout&&$r(St,Fe.layout.inCopyMode);break}case"tmux-screen-sync":{const Er=Fe.generation??0;if(Er<Hr.current)break;Hr.current=Er,vt.current+=1,De.current=!0,pe(!1),Rn.current=[],Cr.current?.prepareScreenReplacement(),Me.current=Er,Ee.current=is(St,KA(Fe.chunks??[])),Ee.current===null&&(Me.current=null,Cr.current?.notifyScreenSynchronized(Er),De.current=!1,le()),typeof Fe.cols=="number"&&typeof Fe.rows=="number"&&Cr.current?.notifyServerSize(Fe.cols,Fe.rows,"tmux-screen-sync");break}case"active-program":{Br(St,Fe.activeProgram??null,Fe.activeProgramSource??null,Fe.activeProgramRaw??null);break}case"cwd":{ie(St,Fe.cwd??null);break}case"agent-status":{ft(St,{agentStatus:Fe.agentStatus??null,agentIndicator:Fe.agentIndicator??null,agentStatusDetail:Fe.agentStatusDetail??null,agent:Fe.agent??null,agentMessage:Fe.agentMessage??null,agentNativeSessionId:Fe.agentNativeSessionId??null,agentResumeRecovered:Fe.agentResumeRecovered===!0,agentRich:Fe.agentRich===!0,agentActivity:Fe.agentActivity??0,agentCwd:Fe.agentCwd??null,reviewed:Fe.reviewed??null});break}case"git-status":{Vr.getState().setSessionGitStatus(St,Fe.gitStatus??null);break}case"focus-mode":{de("[Terminal] focus tracking mode",{backendSessionId:yr.current,requested:Fe.focusTrackingRequested===!0});break}case"resize-ack":{Cr.current?.acknowledgeResize({seq:Fe.seq,ok:Fe.ok!==!1,cols:Fe.cols,rows:Fe.rows,screenSyncPending:Fe.screenSyncPending,screenSyncGeneration:Fe.screenSyncGeneration});break}case"pty-size":{typeof Fe.cols=="number"&&typeof Fe.rows=="number"&&Cr.current?.notifyServerSize(Fe.cols,Fe.rows,Fe.source);break}case"shell-title":{fn(St,Fe.title??null);break}case"prompt-state":{Ls(St,Fe.state??"idle",Fe.exitCode??null);break}case"tui-progress":{Vr.getState().setSessionTuiProgress(St,Fe.tuiProgress??null);break}case"exit":{const Er=typeof Fe.exitCode=="number"?Fe.exitCode:null,Fr=typeof Fe.signal=="number"?Fe.signal:null;jn(St,`\r
|
|
68
|
-
[Process exited${Er!==null?` with code ${Er}`:""}${Fr!==null?` (signal ${Fr})`:""}]\r
|
|
69
|
-
`),Pn(St),It(St,!1),Z("Terminal session ended"),wt(!1),cr(!1),nn(null),Cn(null),$r(St,!1),zn();break}}},onError:(Fe,St)=>{if(he.current!==We)return;const Er=ce;if(!Er)return;ht.current=!1;const Fr=St&&Fe.message==="Authentication required",vn=wk(Fe),Rr=Fr?Fe.message:vn||St?"Reconnecting...":Fe.message||"Terminal stream connection error";console.error(`[Terminal] Stream error (fatal=${St}):`,Rr),vn&&console.warn("[Terminal] SESSION_NOT_FOUND_DETECTED",{terminalIdAtError:yr.current,frontendSessionId:Er,isActive:u,isMobile:ge,fatal:St,stack:new Error().stack}),Z(Rr),cr(!!St),St&&(nn(null),It(Er,!1),zn(),vn&&(de("[onError] Session lost, auto-recreating"),Z("Reconnecting..."),cr(!1),Pn(Er),In(Er),yr.current=null,Zr.current=!1,Zt()))}},{..._k,getDimensions:()=>Cr.current?.getDimensions()??null});ar.current=()=>{$t.close(),he.current===We&&(us.current=null)},us.current=se},[jn,In,Pn,de,zn,le,O,zt,Zt,fn,It,Br,ft,$r,ie,Ls,Ie,ce]);S.useEffect(()=>{const se=xk({isActive:u,isStreamReady:je,reconnectStartedAt:hn,now:Date.now()});if(se===null)return;const We=window.setTimeout(()=>{de("[Terminal] visible reconnect watchdog expired",{backendSessionId:yr.current,reconnectStartedAt:hn}),zn(),It(ce,!1),Z("Reconnecting..."),cr(!1),nn(Date.now()),Zt()},se);return()=>window.clearTimeout(We)},[de,zn,u,je,hn,Zt,ce,It]);const Zr=S.useRef(!1),Hn=S.useRef(!1),hs=S.useRef(0);S.useEffect(()=>()=>{hs.current+=1,Zr.current=!1,zn()},[zn]);const Aa=S.useRef(Yr),wi=S.useRef(jr);S.useEffect(()=>{const se=Aa.current,We=wi.current;Aa.current=Yr,wi.current=jr,Qr.current===ce&&(se===Yr&&We===jr||(Zr.current=!1,zn(),rn(et=>et+1)))},[Yr,jr,zn,ce]),S.useEffect(()=>{if(Qr.current!==ce&&(de(`[useEffect] sessionId changed from ${Qr.current} to ${ce}, allowing reinitialization`),Zr.current=!1,Hn.current=!1),Zr.current&&Qr.current===ce){de(`[useEffect] Already initialized for sessionId=${ce}, skipping`);return}if(!Tt)return;const se=async St=>{if(de(`[ensureSession] Starting for sessionId=${ce}, runId=${St}`),!Qr.current||Qr.current!==ce){de(`[ensureSession] SessionId mismatch or stale run (current=${Qr.current}, target=${ce}), skipping`);return}if(St!==hs.current){de(`[ensureSession] Stale run detected (runId=${St}, currentRunId=${hs.current}), skipping`);return}const Er=Vr.getState(),Fr=Er.getTerminalSession(ce),vn=Fr?.mode??Yr;de("[ensureSession] Current state from store:",{terminalSessionId:Fr?.terminalSessionId,mode:Fr?.mode,tmuxSessionName:Fr?.tmuxSessionName,isConnecting:Fr?.isConnecting});let Rr=Fr?.terminalSessionId??null,pn=!Rr;if(Rr&&vn!==Yr?(de(`[ensureSession] Store mode mismatch for ${Rr}: current=${vn} desired=${Yr}, will create new session`),pn=!0,Er.clearTerminalSession(ce),Rr=null):Rr&&Yr==="tmux"&&jr&&Fr?.tmuxSessionName!==jr&&(de(`[ensureSession] Store tmux name mismatch for ${Rr}: current=${Fr?.tmuxSessionName} desired=${jr}, will create new session`),pn=!0,Er.clearTerminalSession(ce),Rr=null),Rr&&Ie.checkHealth&&!at.current){de(`[ensureSession] Checking health of existing session ${Rr}`);try{const Sn=await Ie.checkHealth(Rr);if(de("[ensureSession] Health check result:",Sn),!Sn.healthy)de(`[ensureSession] Session ${Rr} is NOT healthy (healthy=${Sn.healthy}), will create new session`),de("[ensureSession] Health check details:",Sn),pn=!0,Sn.mode&&Fr?.terminalSessionId&&Er.setTerminalSession(ce,{sessionId:Fr.terminalSessionId,cols:80,rows:24,mode:Sn.mode,tmuxSessionName:Sn.tmuxSessionName??null}),Er.clearTerminalSession(ce),de("[ensureSession] Cleared unhealthy session from store");else{de(`[ensureSession] Session ${Rr} is healthy, reusing it, cwd=${Sn.cwd}, clients=${Sn.clients}, lastActivity=${Date.now()-(Sn.lastActivity||0)}ms ago`),Sn.mode&&Fr?.terminalSessionId&&Er.setTerminalSession(ce,{sessionId:Fr.terminalSessionId,cols:80,rows:24,mode:Sn.mode,tmuxSessionName:Sn.tmuxSessionName??null}),de(`[ensureSession] Setting terminalIdRef to ${Rr} and starting stream`),yr.current=Rr,$i(Rr),de(`[ensureSession] Successfully reused healthy session ${Rr}, returning early`);return}}catch(Sn){de(`[ensureSession] Failed to check health of session ${Rr}:`,Sn),de("[ensureSession] Health check API call failed, proceeding as if session might be unhealthy")}}if(de(`[ensureSession] Decision: shouldCreateNewSession=${pn}, terminalId=${Rr}`),pn){de(`[ensureSession] Creating new session, shouldCreateNewSession=${pn}, runId=${St}`),Z(null),cr(!1),Er.setConnecting(ce,!0);const ws=Vr.getState().getTerminalSession(ce),fs=(ws?.mode??Yr)===Yr&&(Yr!=="tmux"||!jr||ws?.tmuxSessionName===jr);if(ws?.terminalSessionId&&fs)de(`[ensureSession] Race condition avoided: another instance already created session ${ws.terminalSessionId}`),Er.setConnecting(ce,!1),Rr=ws.terminalSessionId,pn=!1;else try{const zs=await ye();if(de(`[ensureSession] Opened managed backend session ${zs.sessionId}`),St!==hs.current){de(`[ensureSession] Stale run after session creation (runId=${St}, currentRunId=${hs.current}), leaving ${zs.sessionId} for sibling`);return}Er.setTerminalSession(ce,zs),de(`[ensureSession] Updated store with new session ${zs.sessionId}`),Rr=zs.sessionId}catch(zs){if(St!==hs.current){de("[ensureSession] Stale run after session creation failed, skipping error handling");return}if(zs instanceof Cm&&l2(zs)){de("[ensureSession] Confirmed missing persisted session:",{sessionId:ce,error:zs.message}),Er.clearTerminalSession(ce),Z(Mf),cr(!0),Er.setConnecting(ce,!1);return}Z("Reconnecting..."),cr(!0),Er.setConnecting(ce,!1);return}}if(St!==hs.current){de(`[ensureSession] Stale run before starting stream (runId=${St}, currentRunId=${hs.current}), skipping`);return}if(!Rr){de(`[ensureSession] No terminalId, terminalId=${Rr}`);return}de(`[ensureSession] Starting stream for session ${Rr}`),yr.current=Rr,$i(Rr),de(`[ensureSession] ensureSession completed for sessionId=${ce}, terminalId=${Rr}`)};let We=null,et=null;const $t=()=>{et=null,!(Zr.current&&Qr.current===ce)&&(de(`[useEffect] Running ensureSession for sessionId=${ce}, hasInitialized=${Zr.current}`),Zr.current=!0,Hn.current=!0,We=++hs.current,se(We))};if(!N&&!Hn.current){de(`[useEffect] Holding background connection until the selected session is ready: ${ce}`);return}const Fe=Hn.current?0:Math.max(0,I);return Fe>0?(de(`[useEffect] Delaying initial connection for sessionId=${ce} by ${Fe}ms`),et=window.setTimeout($t,Fe)):$t(),()=>{et!==null&&window.clearTimeout(et),de(`[useEffect] Cleanup for sessionId=${ce}, runId=${We??"pending"}`)}},[ce,On,$i,zn,Ie,de,Yr,jr,as,I,N,Tt]);const Uo=S.useCallback(async()=>{if(ce&&!Gt){At(!0),Z(null),cr(!1),nn(null),zn();try{Ie.forceKill&&await Ie.forceKill({sessionId:ce})}catch{}Tr(ce),In(ce),Cr.current?.clear(),await new Promise(se=>setTimeout(se,100));try{It(ce,!0);const se=await ye();un(ce,se),yr.current=se.sessionId,$i(se.sessionId)}catch(se){Z(se instanceof Cm&&l2(se)?Mf:"Reconnecting..."),cr(!0),It(ce,!1)}finally{At(!1)}}},[ce,Gt,zn,Ie,Tr,In,It,un,$i,ye]),qa=S.useCallback((se,We)=>{if(!at.current&&!We?.targeted||!se)return;const et=PL(se),$t=/^(\x1b\[<6[45];[0-9]+;[0-9]+M)+$/.test(se);if(kr&&$t&&(Jn.current=!0),Date.now()<zr.current)return;let Fe=se,St=We?.consumeModifier??!1;if(!We?.skipModifierTransform&&_t&&se.length>0){const Rr=se[0];if(Rr.length===1&&/[a-zA-Z]/.test(Rr)){const pn=Rr.toUpperCase();_t==="ctrl"?(Fe=String.fromCharCode(pn.charCodeAt(0)&31),St=!0):_t==="alt"&&(Fe=`\x1B${se}`,St=!0)}St||(_t==="alt"&&(Fe=`\x1B${se}`),St=!0)}const Er=yr.current;if(!Er)return;const vn=(async()=>{try{if(kr&&!et&&Jn.current&&Ie.tmuxAction){Jn.current=!1;try{await Ie.tmuxAction(Er,{action:"copy-mode",enabled:!1})}catch{}if(OL(Fe))return!0}return await Ie.sendInput(Er,Fe),Un(ce),!0}catch(Rr){return Z(Rr instanceof Error?Rr.message:"Failed to send input"),!1}})();return St&&(Et||Qt(null),tt()),vn},[_t,Un,tt,kr,Et,Ie]);S.useEffect(()=>{const se=We=>{const et=We,$t=et.detail?.sessionId;if($t?$t!==ce:!at.current)return;const Fe=et.detail?.text;if(!Fe)return;const St=et.detail?.nonce;if(He.current||!Cr.current){St&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:St,ok:!1}}));return}const Er=Cr.current?.sendSequence(Fe,{paste:et.detail?.paste,targeted:!!$t});St&&Promise.resolve(Er).then(Fr=>{window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:St,ok:Fr===!0}}))},()=>{window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:St,ok:!1}}))}),RA(Ar.current,et.detail?.focus!==!1)&&tt()};return window.addEventListener("termdock-insert-reference",se),()=>window.removeEventListener("termdock-insert-reference",se)},[tt,ce]);const ts=S.useCallback((se,We,et)=>{const $t=yr.current;if(!$t){qe("xterm resize push skipped: no terminalId",{cols:se,rows:We});return}qe("xterm resize push",{cols:se,rows:We}),Ie.resize({sessionId:$t,cols:se,rows:We,seq:et}).catch(Fe=>{Cr.current?.acknowledgeResize({seq:et,ok:!1}),Fe&&/session not found/i.test(String(Fe.message||Fe))&&console.warn("[Terminal] resize 404 session not found",{sessionId:$t,cols:se,rows:We,stack:new Error().stack})})},[Ie,qe]),Ta=S.useCallback(async se=>{const We=yr.current;if(!(!We||!Ie.tmuxAction))try{const et=await Ie.tmuxAction(We,se);et.layout&&(Cn(et.layout),se.action==="switch-session"&&(un(ce,{sessionId:We,cols:80,rows:24,mode:"tmux",tmuxSessionName:et.layout.sessionName}),x7(ce,{tmuxSessionName:et.layout.sessionName}).catch($t=>{console.warn("[Terminal] failed to update inventory after tmux switch",$t)})))}catch(et){Z(et instanceof Error?et.message:"Failed to execute tmux action")}},[ce,un,Ie]);S.useEffect(()=>{if(!Tn||!qr)return;const We=Tn.windows.find(et=>et.id===Tn.activeWindowId)?.panes.find(et=>et.id===Tn.activePaneId);We&&Cr.current?.requestRefresh("tmux-layout",{skipScrollToBottom:!0,dedupeKey:`${qr}:${Tn.sessionId}:${We.id}:${We.width}x${We.height}`})},[Tn,qr]);const Ca=S.useCallback((se,We=5)=>{const et=Math.max(1,Math.min(Math.floor(We)||1,40));Jn.current=!0;const $t=es.current;if($t&&$t.direction===se){$t.lines+=et;return}$t&&Ta({action:"scroll",direction:$t.direction,lines:$t.lines}).finally(()=>{tt()}),es.current={direction:se,lines:et},ur.current&&clearTimeout(ur.current),ur.current=setTimeout(()=>{const Fe=es.current;Fe&&(es.current=null,Ta({action:"scroll",direction:Fe.direction,lines:Fe.lines}).finally(()=>{tt()}))},0)},[tt,Ta]),ul=S.useCallback(se=>{const We=Date.now(),et=on.current,$t=et!==null&&et.modifier===se&&We-et.timestamp<=Ck;if(on.current={modifier:se,timestamp:We},Et===se){Ht(null),Qt(null);return}if($t){Ht(se),Qt(se);return}Et!==null&&Et!==se&&Ht(null),Qt(Fe=>Fe===se?null:se)},[Et]),sa=S.useCallback(se=>{if(Re(se&&at.current),qe("input focus changed",{focused:se,isActive:at.current,isMobile:Ar.current}),!Ar.current||!at.current){Oe(!1);return}Oe(We=>We===se?We:se)},[qe]),go=S.useCallback(se=>{if(ds.current=se,zt(se,"viewport-watermark"),!se&&Rn.current.length>0){const We=ce;if(We){const et=Rn.current;Rn.current=[];for(const $t of et)jn(We,$t)}}},[jn,zt,ce]),Ii=S.useCallback(se=>{at.current&&Cr.current?.ensureSizeMatches(se)},[]),Ya=S.useRef(null);S.useEffect(()=>{if(!u)return;const se=Ya.current;if(!se)return;const We=()=>Ii("pointerdown"),et=()=>Ii("keydown"),$t=()=>Ii("touchstart"),Fe=()=>Ii("wheel");return se.addEventListener("pointerdown",We),se.addEventListener("keydown",et),se.addEventListener("touchstart",$t,{passive:!0}),se.addEventListener("wheel",Fe,{passive:!0}),()=>{se.removeEventListener("pointerdown",We),se.removeEventListener("keydown",et),se.removeEventListener("touchstart",$t),se.removeEventListener("wheel",Fe)}},[u,Ii]);const Za=S.useCallback(se=>{Cr.current=se},[]),Ka=S.useCallback(se=>{Ct(se),q?.(ce,se)},[q,ce]),Ai=S.useCallback(se=>{const We=VL(se);if(!We)return;const et=_t!==null;Cr.current?.sendSequence(We,{consumeModifier:et})},[_t]),Es=S.useCallback(se=>{const We=$L(se);if(We.length===0)return;const et=_t!==null;Cr.current?.sendSequence(s2(We[0]),{consumeModifier:et});for(let $t=1;$t<We.length;$t+=1){const Fe=We[$t];window.setTimeout(()=>{Cr.current?.sendSequence(s2(Fe))},UL*$t)}},[_t]),Vs=S.useCallback(()=>{Cr.current?.pasteClipboardText()},[]),zi=S.useCallback(se=>{F.current!==null&&(window.clearTimeout(F.current),F.current=null),ut(se),(se==="inserted"||se==="failed")&&(F.current=window.setTimeout(()=>{F.current=null,ut("idle")},1400))},[]),qs=S.useCallback(()=>{zi("idle"),dr(0),ae.current?.click()},[zi]),ia=S.useCallback(se=>{const We=se.currentTarget.files?.[0];se.currentTarget.value="",We&&(dr(0),zi("uploading"),J3(We,(et,$t)=>_u(et,$t,void 0,dr),et=>{if(!at.current||He.current)throw new Error("Terminal unavailable");window.dispatchEvent(new CustomEvent("termdock-insert-reference",{detail:{text:X3(et,null),focus:!0}}))}).then(()=>zi("inserted"),()=>zi("failed")))},[zi]),xo=Ur||En!==null;He.current=xo;const Hi=S.useRef(Xn);xo||(Hi.current=Xn);const Sa=xo?Hi.current:Xn,_a=S.useMemo(()=>zL(Sa,dn),[Sa,dn]),dl=S.useMemo(()=>a2(dn,it),[it,dn]),La=!ge&&it!=="auto"&&dl.showOnDesktop!==!0?"auto":it,bo=La==="auto"?_a:La,Ti=S.useMemo(()=>a2(dn,bo),[bo,dn]),oi=S.useMemo(()=>Ti.actions.filter(se=>se.sequence.trim().length>0).map((se,We)=>({...se,label:Bp(se,We)})),[Ti.actions]),ka=S.useMemo(()=>W3(Xn),[Xn]),aa=Ti.label,oa=S.useMemo(()=>La!=="auto"?`Manual preset: ${Ti.label}`:ka?`Auto preset · ${Ti.label} (${ka})`:"Auto preset",[ka,La,Ti.label]),$o=S.useCallback(se=>{jt(se)},[]),vs=S.useCallback(()=>{Nt(se=>se==="copy"?"arrows":"copy"),Se("idle")},[]),li=S.useCallback(()=>{typeof window>"u"||(Nn.current!==null&&window.clearTimeout(Nn.current),Nn.current=window.setTimeout(()=>{Nn.current=null,Se("idle")},1200))},[]),Xa=S.useCallback(se=>{Nn.current!==null&&typeof window<"u"&&(window.clearTimeout(Nn.current),Nn.current=null),Se(se?"copied":"failed"),li()},[li]),Ja=S.useCallback(se=>{Pe(se)},[]),eo=S.useMemo(()=>ge?HL(dn):WL(dn),[ge,dn]),Us=S.useMemo(()=>b7(i),[i]),Wi=S.useMemo(()=>`terminal::${ce}`,[ce]);S.useEffect(()=>{Ze?.({isConnecting:Ur,isRestarting:Gt,hasError:!!En,sessionId:qr})},[Ur,Gt,En,qr,Ze]);const Ia=!qr||Ur||Gt,Zn=S.useCallback((se,We)=>{if(Ia)return;const et=Math.max(1,Math.min(Math.floor(We)||1,40));Ca(se,et)},[Ca,Ia]);S.useEffect(()=>{if(!u||!ge)return;Cr.current?.requestRefresh("resize",{skipScrollToBottom:!yt,force:!0})},[u,ge,yt,bt,ce]),S.useEffect(()=>{if(!u||!ge)return;const se=We=>{const et=We.detail;Cr.current?.requestRefresh("resize",{skipScrollToBottom:et?.isOpen!==!0,force:!0})};return document.addEventListener("termdock:viewport-keyboard-change",se),()=>{document.removeEventListener("termdock:viewport-keyboard-change",se)}},[u,ge,ce]);const os=!V&&(ge||Ti.showOnDesktop===!0),Ei=u,Gi=ge&&!Je?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,Vi=ge&&!Je?{marginTop:"var(--kb-margin-top, 0px)",transition:"none"}:void 0,$s=a.jsx(qL,{visible:os,interactive:Ei,presentation:ge?"mobile":"desktop-actions",activeModifier:_t,lockedModifier:Et,disabled:Ia,defaultShowExtended:ne,presetLabel:aa,presetModeLabel:oa,presetMode:La,presetOptions:eo,includeAlt:Ti.includeAlt,presetRowLayout:Ti.rowLayout,extraActions:oi,onKeyPress:Ai,onTextPress:Es,onPastePress:ge?Vs:void 0,onFilePress:ge?qs:void 0,fileUploadState:Ce,fileUploadProgress:Ge,longPressMode:ue,copyFeedback:qt,onLongPressModeToggle:vs,onModifierToggle:ul,onPresetSelect:$o,onExpandedChange:Ja}),yo=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:Gi,children:[a.jsx("input",{ref:ae,type:"file",className:"hidden",onChange:ia}),$n&&a.jsx(YL,{isMobile:ge,isInputFocused:z,isIOS:Ke,isConnecting:Ur,connectionError:En,terminalSessionId:qr}),a.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden",style:{backgroundColor:Us.background,...Vi},children:[a.jsx("div",{ref:Ya,className:"h-full w-full box-border",children:a.jsx(y7,{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:Ve("terminal.componentFailed")})]})}),children:a.jsx(RL,{ref:Za,sessionKey:Wi,sessionId:ce,isLayoutVisible:g,chunks:Or,onInput:qa,onResize:ts,onFlowControl:go,onTmuxScroll:kr?Zn:void 0,tmuxScrollSensitivity:.38,onDoubleTap:ge?()=>{Cr.current?.sendSequence(" ")}:void 0,onInputFocusChange:sa,onMobileLongPressCopyResult:Xa,onReadyChange:Ka,onSizeSynchronizedChange:pt,onWritesSettled:Qe,onWriteProgress:Xt,onCursorPositionChange:pr,onDirectoryLinkActivate:An,terminalSettings:re,theme:Us,enableTouchScroll:ge,mobileLongPressMode:ue,autoFocus:!h&&!ge&&!yo,cursorVisible:!h&&rr,suppressSmoothScroll:!Te||!$e,className:h||!rr?"terminal-focus-suspended":void 0},Wi)})}),a.jsx(KL,{connectionError:En,isFatalError:xt,isRestarting:Gt,isConnecting:Ur,onHardRestart:Uo})]}),me?V?null:na.createPortal($s,me):$s]})};function kk({session:e,active:t,onActivate:r,onToggleRightSidebar:n}){const{t:i}=Jr(),l=Vr(u=>{const h=u.sessions.get(e.id);return Do(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:u=>u.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(Ga,{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(Lu,{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(qx,{size:14})})]})}const Ik="termdock:startup:";function Wc(e){if(typeof performance>"u"||typeof performance.mark!="function")return;const t=`${Ik}${e}`;performance.getEntriesByName(t,"mark").length>0||performance.mark(t)}function f2(e,t){e||na.flushSync(t)}const Qp="horizontal";function Zc(e){return e<=0?[]:Array.from({length:e},()=>1/e)}function $d(e,t){if(!Array.isArray(e)||e.length!==t)return Zc(t);const r=e.map(Number);if(r.some(i=>!Number.isFinite(i)||i<=0))return Zc(t);const n=r.reduce((i,l)=>i+l,0);return n<=0?Zc(t):r.map(i=>i/n)}function Ek(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 Rk(e){return e==="horizontal"||e==="vertical"||e==="grid"}function Nk(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 u=Array.isArray(l.sessionIds)?l.sessionIds.filter(g=>typeof g=="string"&&!!g&&!t.has(g)):[],h=[...new Set(u)];if(h.length<2)continue;const p=Ek(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:Rk(l.layout)?l.layout:Qp,ratios:$d(l.ratios,h.length),...l.gridColumnRatios!==void 0?{gridColumnRatios:$d(l.gridColumnRatios,p.columns)}:{},...l.gridRowRatios!==void 0?{gridRowRatios:$d(l.gridRowRatios,p.rows)}:{}})}return n}function Mk(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?$d(n.ratios,i.length):Zc(i.length)}]})}function xu(e,t){if(t)return e.find(r=>r.sessionIds.includes(t))}function Bf(e,t,r){if(!t||!r||t===r)return e;const n=xu(e,t),i=xu(e,r);if(n&&n.id===i?.id)return e;const l=[...n?.sessionIds??[t],...i?.sessionIds??[r]],u=[...new Set(l)],h={id:n?.id??`split:${t}`,...n?.name?{name:n.name}:{},sessionIds:u,layout:u.length>2&&(!n||n.layout===Qp)?"grid":n?.layout??Qp,ratios:Zc(u.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 Dk(e,t){const r=xu(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:Zc(n.length)}:i)}function Bk(e,t){const r=xu(e,t);return r?e.filter(n=>n.id!==r.id):e}function Qk(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 jk(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 jp=320,eb=1,Pk=jp+120,Pp="termdock:split-workspaces:v2",tb="termdock:split-workspace:v1",Ok=.1,Fk=.9;function Qf(){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 Uk(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Pp);if(e)return Nk(JSON.parse(e));const t=JSON.parse(window.localStorage.getItem(tb)||"null");if(t&&typeof t.primaryId=="string"&&typeof t.secondaryId=="string"&&t.primaryId!==t.secondaryId){const r=Math.min(Fk,Math.max(Ok,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 $k(e,t){const r=new Map(e.map(u=>[u.id,u])),n=new Map;t.forEach(u=>u.sessionIds.forEach(h=>n.set(h,u)));const i=new Set,l=[];for(const u of e){const h=n.get(u.id);if(!h){l.push({key:u.id,sessions:[u]});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 p2(e){const t=e.wrapperEl;if(t)try{t.getAnimations().forEach(r=>r.cancel())}catch{}}function xd(e,t){const r=th(e,t);if(r===null)return;const n=e.wrapperEl;p2(e),n&&(n.style.transitionDuration="0ms");try{const i=e;i.setTransition?.(0),i.setTranslate?.(r),p2(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 Op(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 th(e,t){const r=e.snapGrid,n=Array.isArray(r)?r[t]:void 0;return typeof n!="number"||!Number.isFinite(n)?null:-n}function zk(e,t){const r=Op(e),n=th(e,t);return r!==null&&n!==null&&Math.abs(r-n)<=eb}function Hk(e){const t=[],r=new Map,n=new Map,i=new Map;for(const l of e){const u=r.get(l.id)??[];if(u.push(l.id),r.set(l.id,u),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,u]of r)u.length>1&&t.push({kind:"frontend",key:l,sessionIds:u});for(const[l,u]of n)u.length>1&&t.push({kind:"backend",key:l,sessionIds:u});for(const[l,u]of i)u.length>1&&t.push({kind:"tmux",key:l,sessionIds:u});return t}function rb(e){const t=new Map;for(const r of e)t.set(r.id,r);return Array.from(t.values())}function nb(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 Wk(e,t){const r=rb(e),n=r.findIndex(i=>i.id===t.id);if(n>=0){const i=[...r];return i[n]=t,i}return[...r,t]}function m2(e,t){const r=new Map(e.map(n=>[n.id,n]));return t.map(n=>{const i=r.get(n.sessionId);return{...nb(n),history:i?.history}})}function g2(e,t){return e.length===0?null:t&&e.some(r=>r.sessionId===t)?t:e[0]?.sessionId??null}function x2(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 b2(e){const t=new Map;for(const[r,n]of e)t.set(r,n.cwd??null);return t}function Gk(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 Vk(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 qk=({terminalSettings:e=v1(),colorTheme:t="dark",toolbarPresets:r=[],showDebug:n,terminalFocusAvailable:i=!0,defaultSessionMode:l="shell",defaultTmuxSessionName:u="",connectionPrioritySessionId:h=null,connectionPriorityReady:p=!0,desktopRightSidebarEnabled:g=!1,onToggleRightSidebar:x,desktopFloatingTitle:b=!1,desktopPinnedLeftSidebarWidth:w=0,desktopViewportWidth:A=0,onStatusChange:k,onSessionDataUpdate:I,onInitialViewportReady:N,onInitialRecoveryRequired:R})=>{const{t:D}=Jr(),O=y.useMemo(()=>Kc("session"),[]),q=y.useMemo(()=>Kc("terminal"),[]),[Y,U]=y.useState([]),[V,me]=y.useState(null),Je=ss(F=>F.activePaneId);y.useEffect(()=>{ss.getState().setActivePane(V)},[V]);const[ve,_e]=y.useState(null),[Ze,Ve]=y.useState(!0),[ce,ke]=y.useState({token:0,reason:"visibility",forceForegroundReconnect:!1}),[ot,Ie]=y.useState(()=>new Set),[de,qe]=y.useState(()=>({token:0,completed:new Set})),[xe,te]=y.useState(0),[re,ge]=y.useState(()=>new Set),[ze,Ke]=y.useState(()=>new Set),[Ae,z]=y.useState(()=>new Set),Oe=y.useRef(!1),nt=y.useRef(null),Re=y.useRef({}),[X,Be]=y.useState(null),[st,be]=y.useState(()=>Uk()),[je,wt]=y.useState(!1),[Te,pe]=y.useState(null),[$e,pt]=y.useState(null),[Tt,Ct]=y.useState(null),[rr,ir]=y.useState(!1),[yt,bt]=y.useState(()=>Qf().mobile),[_t,Qt]=y.useState(()=>Qf().landscape),[Et,Ht]=y.useState(null),[ne,Pe]=y.useState(null),it=y.useRef(i),jt=y.useRef(!1),ue=y.useRef(!1),Nt=y.useRef(null),qt=y.useRef(null),Se=y.useRef(yt),Ce=y.useRef(null),ut=y.useRef(0),Ge=y.useRef([]),dr=y.useRef(0),Rt=y.useRef(null),un=y.useRef(!1),It=y.useRef(!0),jn=y.useRef(null),is=y.useRef(""),Pn=y.useRef(0);y.useEffect(()=>{if(typeof window>"u")return;const F=()=>{const ae=Qf();Se.current=ae.mobile,bt(ae.mobile),Qt(ae.landscape)};return F(),window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[]);const{sessions:Tr,inventory:In,activeSessionId:Br,isLoading:ie,openSession:$r,setActiveSession:ft,removeSession:hr,renameSession:Ls,resetSessionCustomName:Un,reorderSessions:as,restoreSessions:Pr}=v7(),Yt=In?.tmuxRecovery??null;y.useEffect(()=>{Yt&&R?.()},[Yt,R]),y.useEffect(()=>{Ct(null),pt(null)},[Yt?.id]);const Xn=y.useCallback(async()=>{pt("restore"),Ct(null);try{const F=await w7();await Pr(),F.failed>0&&Ct(D("tab.tmuxRecoveryPartial",{restored:F.restored,failed:F.failed}))}catch{Ct(D("tab.tmuxRecoveryFailed"))}finally{pt(null)}},[Pr,D]),dn=y.useCallback(async()=>{pt("dismiss"),Ct(null);try{await A7(),await Pr()}catch{Ct(D("tab.tmuxRecoveryDismissFailed"))}finally{pt(null)}},[Pr,D]),kr=Jt(F=>F.groupByFolder),Or=su(F=>F.collaborationGroups),Ur=Jt(F=>F.leftOpen||F.rightOpen),qr=Jt(F=>F.rightSidebarWidthContextKey),An=Jt(F=>F.rightSidebarWidth),Yr=Jt(F=>F.rightPinned),[jr,En]=y.useState(()=>b2(Vr.getState().sessions));y.useEffect(()=>Vr.subscribe(F=>{const ae=b2(F.sessions);En(le=>Gk(le,ae)?le:ae)}),[]);const{arranged:Z}=y.useMemo(()=>Gd(Y,F=>jr.get(F.id)??null,kr,"",st,Or),[Y,jr,kr,st,Or]),He=y.useRef(Z);He.current=Z;const xt=y.useMemo(()=>$k(Z,st),[Z,st]),cr=y.useRef(xt);cr.current=xt;const Gt=y.useMemo(()=>xu(st,V),[V,st]),At=y.useMemo(()=>{const F=xt.find(ae=>ae.sessions.some(le=>le.id===V));return new Set(F?.sessions.map(ae=>ae.id)??[])},[V,xt]),hn=y.useMemo(()=>{const F=new Map;if(!g||A<=0)return F;for(const ae of xt){const le=ae.sessions[0];if(!le)continue;const Qe=T7(le.id,jr.get(le.id)??null,ae.workspace?.id??null);if(!(Qe===qr?Yr:C7(le.id,jr.get(le.id)??null,ae.workspace?.id??null)))continue;const Ut=Qe===qr?An:S7(le.id,jr.get(le.id)??null,ae.workspace?.id??null),Xt=Md(Ut,A,w);F.set(ae.key,Xt+Rx)}return F},[jr,w,g,Yr,qr,An,A,xt]),nn=y.useMemo(()=>Nf(Y.map(F=>({id:F.id,backendSessionId:F.sessionId})),h),[h,Y]),On=y.useMemo(()=>g2(Tr,Br),[Br,Tr]),rn=gd({prioritySessionId:nn,activeSessionId:ve??V,persistedActiveSessionId:On,firstSessionId:Y[0]?.id??null}),Tn=y.useMemo(()=>bk(xt.flatMap(F=>F.sessions.map(ae=>ae.id)),At),[At,xt]),Cn=rn!==null&&ot.has(rn),$n=y.useMemo(()=>{const F=new Set(At);return ve&&F.add(ve),!F.size&&rn&&F.add(rn),F},[At,ve,rn]),ar=de.token===ce.token&&pk($n,de.completed),us=ar||xe===ce.token?ce.token:-1;y.useEffect(()=>{if(!ce.token||ar)return;const F=window.setTimeout(()=>te(ce.token),nk);return()=>window.clearTimeout(F)},[ce.token,ar]);const yr=y.useCallback((F,ae)=>{Ie(le=>{if(le.has(F)===ae)return le;const Mt=new Set(le);return ae?Mt.add(F):Mt.delete(F),Mt})},[]),Qr=y.useCallback(F=>{const ae=ut.current;qe(Qe=>{if(Qe.token===ae&&Qe.completed.has(F))return Qe;const Mt=new Set(Qe.token===ae?Qe.completed:[]);return Mt.add(F),{token:ae,completed:Mt}});const le=nn??ve??Ce.current;F===le&&Wc("foreground-stream-connected")},[ve,nn]),Cr=y.useCallback((F,ae)=>{ge(le=>{if(le.has(F)===ae)return le;const Qe=new Set(le);return ae?Qe.add(F):Qe.delete(F),Qe})},[]),ds=y.useCallback((F,ae)=>{Ke(le=>{if(le.has(F)===ae)return le;const Qe=new Set(le);return ae?Qe.add(F):Qe.delete(F),Qe})},[]),Ln=rn!==null&&re.has(rn),Rn=rn!==null&&ze.has(rn);y.useEffect(()=>{Ln&&Wc("foreground-viewport-ready")},[Ln]),y.useEffect(()=>{Rn&&Wc("foreground-content-ready")},[Rn]),y.useEffect(()=>{if(!N)return;if(!Ze&&Y.length===0){N();return}if(!Ln||!Cn||!Rn)return;const F=[...At].every(Ut=>re.has(Ut)&&ot.has(Ut)&&ze.has(Ut));let ae=0,le=0;const Qe=()=>{ae=requestAnimationFrame(()=>{le=requestAnimationFrame(()=>{Wc("initial-viewport-presented"),N()})})};F&&Qe();const Mt=F?void 0:window.setTimeout(Qe,8e3);return()=>{cancelAnimationFrame(ae),cancelAnimationFrame(le),clearTimeout(Mt)}},[Cn,Rn,Ln,Ze,N,Y.length,At,re,ot,ze]);const zr=y.useMemo(()=>yt?ak({slides:xt.map(F=>F.sessions.map(ae=>ae.id)),visibleSessionIds:At,foregroundSessionId:rn}):Ae,[yt,xt,At,rn,Ae]);y.useEffect(()=>{if(yt||At.size===0)return;const F=new Set(At),ae=xt.findIndex(le=>le.sessions.some(Qe=>At.has(Qe.id)));for(let le=-2;le<=2;le+=1)le!==0&&xt[ae+le]?.sessions.forEach(Qe=>F.add(Qe.id));z(le=>{let Qe=!1;const Mt=new Set(le);for(const Ut of F)Mt.has(Ut)||(Mt.add(Ut),Qe=!0);return Qe?Mt:le})},[yt,At,xt]);const Jn=UA(zr);y.useEffect(()=>{if(!ve)return;if(!Y.some(ae=>ae.id===ve)){_e(null);return}if(!re.has(ve)||!ot.has(ve)||!ze.has(ve))return;const F=window.setTimeout(()=>{_e(ae=>ae===ve?null:ae),it.current&&!Se.current&&Be({sessionId:ve,token:Date.now()})},80);return()=>window.clearTimeout(F)},[ze,ve,ot,Y,re]),y.useEffect(()=>{typeof window>"u"||(st.length>0?(window.localStorage.setItem(Pp,JSON.stringify(st)),window.localStorage.removeItem(tb)):window.localStorage.removeItem(Pp))},[st]),y.useEffect(()=>{ie||Ze||st.length===0||be(F=>Mk(F,Y.map(ae=>ae.id)))},[ie,Ze,Y,st.length]),y.useEffect(()=>{if(!Te)return;const F=window.setTimeout(()=>pe(null),3200);return()=>window.clearTimeout(F)},[Te]),Ce.current=V,ut.current=ce.token,Ge.current=Y,Rt.current=Br,un.current=ie,It.current=Ze,it.current=i;const es=y.useCallback((F=nt.current)=>{const ae=dr.current,le=typeof window<"u"?window.visualViewport:null,Qe=F?Op(F):null,Mt=F?th(F,ae):null;return{sessionsLength:Ge.current.length,workspaceSlidesLength:cr.current.length,sessionIds:Ge.current.map(Ut=>Ut.id),activeSessionId:Ce.current,activeSessionIndex:ae,persistedActiveId:Rt.current,isLoading:un.current,isRestoring:It.current,activeIndex:F?.activeIndex??null,previousIndex:F?.previousIndex??null,animating:F?.animating??null,allowTouchMove:F?.allowTouchMove??null,width:F?.width??null,translate:Qe,targetTranslate:Mt,translateDelta:Qe!==null&&Mt!==null?Qe-Mt:null,snapGridLength:F?.snapGrid?.length??null,targetSnap:F?.snapGrid?.[ae]??null,visualViewport:le?{width:Math.round(le.width),height:Math.round(le.height),offsetTop:Math.round(le.offsetTop)}:null}},[]),ur=y.useCallback((F,ae)=>{O(F,{...es(),...ae})},[O,es]);y.useEffect(()=>{ie||Ze||V!==Br&&ft(V)},[V,ie,Ze,Br,ft]);const Hr=y.useMemo(()=>{if(Z.length===0||!V)return 0;const F=xt.findIndex(ae=>ae.sessions.some(le=>le.id===V));return F>=0?F:0},[xt,V]);dr.current=Hr;const on=y.useCallback(()=>{Nt.current&&(clearTimeout(Nt.current),Nt.current=null)},[]),Ms=y.useCallback(F=>{on(),Nt.current=setTimeout(()=>{Nt.current=null,jt.current=!1,ur("[swiper:touch-guard-clear]",{reason:F})},Pk)},[on,ur]),yn=y.useCallback((F,ae={})=>{const le=nt.current,Qe=dr.current,Mt=cr.current;if(!le||Mt.length===0||Qe<0||Qe>=Mt.length)return;if(jt.current){ur("[swiper:sync-skip-touch]",{reason:F});return}if(le.animating){ur("[swiper:sync-skip-animating]",{reason:F});return}const Ut=Op(le),Xt=th(le,Qe),pr=Ut!==null&&Xt!==null&&Math.abs(Ut-Xt)<=eb,Dr=le.activeIndex===Qe;if(ur("[swiper:sync-check]",{reason:F,activeIndexAligned:Dr,translateAligned:pr,immediate:ae.immediate===!0}),!(Dr&&pr)){if(Dr){xd(le,Qe),ur("[swiper:sync-forced-active]",{reason:F,translateAligned:pr,immediate:ae.immediate===!0});return}ae.immediate?(xd(le,Qe),le.slideTo(Qe,0,!1),xd(le,Qe)):le.slideTo(Qe,jp,!1),ur("[swiper:sync-applied]",{reason:F,activeIndexAligned:Dr,translateAligned:pr,immediate:ae.immediate===!0})}},[ur]);y.useEffect(()=>{const F=ae=>{const le=ae;nt.current&&(nt.current.allowTouchMove=!le.detail.locked),ur("[swiper:gesture-lock]",{locked:le.detail.locked})};return document.addEventListener("termdock:gesture-lock",F),()=>document.removeEventListener("termdock:gesture-lock",F)},[ur]),y.useEffect(()=>{if(Y.length===0){V!==null&&me(null);return}if(!V){if(!p)return;me(gd({prioritySessionId:nn,activeSessionId:null,persistedActiveSessionId:On,firstSessionId:Y[0]?.id??null}));return}Y.some(ae=>ae.id===V)||me(Y[0].id)},[Y,V,p,nn,On]);const $=y.useCallback((F,ae)=>{if(ae&&Date.now()<Pn.current){Re.current[F]=!1;return}Re.current[F]=ae,Pe(le=>ae?F:le===F?null:le)},[]),he=y.useCallback(F=>{if(!jt.current&&F.activeIndex!==dr.current){ur("[swiper:slide-change-ignored-layout]",{instanceActiveIndex:F.activeIndex,expectedActiveIndex:dr.current}),requestAnimationFrame(()=>yn("ignored-layout-slide-change",{immediate:!0}));return}const ae=cr.current[F.activeIndex],le=ae?.sessions.some(Ut=>Ut.id===V)?V:ae?.sessions[0]?.id;if(ur("[swiper:slide-change]",{nextSessionId:le??null,instanceActiveIndex:F.activeIndex}),!le||le===V)return;const Qe=!!V&&Re.current[V]===!0,Mt=it.current&&(!Se.current||Qe);if(qt.current=le,me(le),Mt){Be({sessionId:le,token:Date.now()});return}Be(null)},[Y,V,ur,yn]);y.useLayoutEffect(()=>{if(qt.current===V){ur("[swiper:sync-skip-swiper-driven]",{activeSessionId:V}),qt.current=null;return}yn("active-session-index",{immediate:!0})},[V,Hr,Y.length,yn,ur]),y.useEffect(()=>{const F=nt.current;if(!F)return;const ae=xt.length>1&&!Ur&&!je;F.allowTouchMove!==ae&&(F.allowTouchMove=ae,ur("[swiper:allow-touch-sync]",{nextAllow:ae,sidebarOverlayOpen:Ur}))},[xt.length,ur,Ur,je]);const De=y.useCallback(F=>{const ae=nt.current;if(!ae)return;const le=ae.el;if(ur("[swiper:layout-before]",{reason:F,scrollLeft:le?.scrollLeft??null}),le&&(le.scrollLeft=0),ae.updateSize(),ae.updateSlides(),ae.updateProgress(),ae.updateSlidesClasses(),le&&(le.scrollLeft=0),ur("[swiper:layout-after]",{reason:F,scrollLeft:le?.scrollLeft??null}),jt.current||ae.animating){ur("[swiper:layout-skip-sync-motion]",{reason:F});return}yn(`layout:${F}`,{immediate:!0}),requestAnimationFrame(()=>{const Qe=nt.current;Qe&&(jt.current||Qe.animating||xd(Qe,dr.current))})},[ur,yn]);y.useEffect(()=>()=>on(),[on]);const Ee=xt.map(F=>F.key).join("\0");y.useEffect(()=>{requestAnimationFrame(()=>De("group-change"))},[kr,Ee,De]),y.useEffect(()=>{let F=null,ae="mount";const le=pr=>{ae=pr,F===null&&(F=requestAnimationFrame(()=>{F=null,De(`viewport-change:${ae}`)}))},Qe=()=>le("window-resize"),Mt=()=>le("visual-viewport-resize"),Ut=()=>le("visual-viewport-scroll"),Xt=pr=>{le(`measured:${pr.detail?.source??"unknown"}`)};return window.addEventListener("resize",Qe),window.visualViewport?.addEventListener("resize",Mt),window.visualViewport?.addEventListener("scroll",Ut),document.addEventListener(Sm,Xt),le("mount"),()=>{window.removeEventListener("resize",Qe),window.visualViewport?.removeEventListener("resize",Mt),window.visualViewport?.removeEventListener("scroll",Ut),document.removeEventListener(Sm,Xt),F!==null&&cancelAnimationFrame(F)}},[De]),y.useEffect(()=>{if(typeof document>"u")return;let F=null,ae=null;const le=Dr=>{if(Dr!=="online"&&document.hidden)return;const fn=performance.now();if(!mk(ae,fn))return;ae=fn;const j=Dr==="bfcache"||Dr==="online"?Dr:"visibility",ye=gk();Jh(),ga("info","PWA_RESUME scheduled",{source:Dr,forceForegroundReconnect:ye,activeSessionId:Ce.current}),ke(Ne=>({token:Ne.token+1,reason:j,forceForegroundReconnect:ye})),requestAnimationFrame(()=>De(`resume:${Dr}:raf`)),F&&clearTimeout(F),F=setTimeout(()=>{F=null,De(`resume:${Dr}:settled`)},320)},Qe=()=>{if(document.hidden){Jh();return}le("visibility")},Mt=()=>{Jh()},Ut=Dr=>{le(Dr.persisted?"bfcache":"pageshow")},Xt=()=>le("online"),pr=()=>le("focus");return document.addEventListener("visibilitychange",Qe),window.addEventListener("pagehide",Mt),window.addEventListener("pageshow",Ut),window.addEventListener("online",Xt),window.addEventListener("focus",pr),()=>{document.removeEventListener("visibilitychange",Qe),window.removeEventListener("pagehide",Mt),window.removeEventListener("pageshow",Ut),window.removeEventListener("online",Xt),window.removeEventListener("focus",pr),F&&clearTimeout(F)}},[De]),y.useLayoutEffect(()=>{if(!hk(Ze))return;const F=Hk(Y),ae=JSON.stringify(F);F.length>0&&ae!==is.current?(is.current=ae,console.warn("[session-invariant] duplicate mapping detected",F)):F.length===0&&is.current&&(is.current=""),I?.({sessions:Y.map(le=>({id:le.id,name:le.name,customName:le.customName,mode:le.mode,tmuxSessionName:le.tmuxSessionName})),activeSessionId:V,splitWorkspaces:st.map(({id:le,name:Qe,sessionIds:Mt,layout:Ut})=>({id:le,...Qe?{name:Qe}:{},sessionIds:Mt,layout:Ut}))})},[Y,V,st,I,Ze]),y.useEffect(()=>{if(ie||Oe.current)return;Oe.current=!0;const F=Nf(Tr.map(Ut=>({id:Ut.sessionId,backendSessionId:Ut.backendSessionId??null})),h),ae=g2(Tr,Br),le=gd({prioritySessionId:p?F:null,activeSessionId:null,persistedActiveSessionId:ae,firstSessionId:Tr[0]?.sessionId??null}),Qe=rb(Tr.map(nb));if(O("[Session] Restoring",Qe.length,"persisted sessions (one-shot)"),ur("[swiper:restore-start]",{persistedSessionIds:Tr.map(Ut=>Ut.sessionId),nextActiveSessionId:le}),Qe.length>0){const Ut=Vr.getState();Qe.forEach(pr=>{pr.sessionId&&Ut.setTerminalSession(pr.id,{sessionId:pr.sessionId,cols:80,rows:24,mode:pr.mode,tmuxSessionName:pr.tmuxSessionName,history:pr.history})}),Tr.forEach(pr=>{pr.activeProgram!=null&&Ut.setSessionActiveProgram(pr.sessionId,pr.activeProgram),pr.cwd!=null&&Ut.setSessionCwd(pr.sessionId,pr.cwd)}),U(Qe);const Xt=le||Qe[0]?.id||null;me(Xt),ur("[swiper:restore-complete]",{restoredSessionIds:Qe.map(pr=>pr.id),nextActiveSessionId:Xt})}(async()=>(Qe.length===0&&await jn.current?.({createIfEmpty:!0}),Ve(!1),requestAnimationFrame(()=>yn("restore-finished",{immediate:!0}))))()},[ie,Tr,Br,O,ur,yn,p,h]),y.useEffect(()=>{if(!p||Ze||Y.length===0)return;const F=Nf(Y.map(le=>({id:le.id,backendSessionId:le.sessionId})),h),ae=gd({prioritySessionId:F,activeSessionId:Ce.current,persistedActiveSessionId:On,firstSessionId:Y[0]?.id??null});ae&&ae!==Ce.current&&me(ae)},[p,h,Ze,On,Y]);const Me=y.useRef([]),ht=y.useRef(!1);Ce.current=V,y.useEffect(()=>{if(Ze)return;const F=Me.current,ae=Tr,le=new Map(F.map(j=>[j.sessionId,j])),Qe=Vr.getState();for(const j of ae){const ye=le.get(j.sessionId),Ne=Vr.getState().sessions.get(j.sessionId);j.activeProgram!=null&&j.activeProgram!==Ne?.activeProgram&&(Ne?.activeProgram==null||j.activeProgram!==ye?.activeProgram)&&Qe.setSessionActiveProgram(j.sessionId,j.activeProgram),j.cwd!=null&&j.cwd!==Ne?.cwd&&(Ne?.cwd==null||j.cwd!==ye?.cwd)&&Qe.setSessionCwd(j.sessionId,j.cwd)}if(!ht.current){U(j=>m2(j,ae)),Me.current=ae,ht.current=!0;return}const Mt=new Set(F.map(j=>j.sessionId)),Ut=new Set(ae.map(j=>j.sessionId)),Xt=new Map(F.map(j=>[j.sessionId,j.name]));Me.current=ae,U(j=>{const ye=m2(j,ae);return(!Ce.current||!ye.some(Ne=>Ne.id===Ce.current))&&me(ye[0]?.id??null),ye});const pr=ae.filter(j=>!Mt.has(j.sessionId)),Dr=[...Mt].filter(j=>!Ut.has(j)),fn=ae.filter(j=>Mt.has(j.sessionId)&&Xt.get(j.sessionId)!==j.name);(pr.length>0||Dr.length>0||fn.length>0)&&O("[Session] Synced persisted sessions:",{newSessionIds:pr.map(j=>j.sessionId),removedSessionIds:Dr,renamedSessionIds:fn.map(j=>j.sessionId),currentSessionIds:ae.map(j=>j.sessionId)});for(const j of ae){if(!j.backendSessionId)continue;Vr.getState().setTerminalSession(j.sessionId,{sessionId:j.backendSessionId,cols:80,rows:24,mode:j.mode,tmuxSessionName:j.tmuxSessionName})}},[Tr,Ze,O]);const vt=y.useCallback(async F=>{try{const ae=F?.mode==="tmux"||F?.mode==="shell"?F.mode:l,le=(F?.tmuxSessionName||"").trim(),Qe=u.trim(),Mt=ae==="tmux"?le||Qe||Vk():null,Ut=typeof F?.cwd=="string"?F.cwd:null,Xt=V?Vr.getState().sessions.get(V)?.cwd??null:null,pr=typeof Ut=="string"&&Ut.trim().length>0?Ut:typeof Xt=="string"&&Xt.trim().length>0?Xt:void 0,Dr=await $r({mode:ae,tmuxSessionName:Mt,cwd:pr,termType:"xterm-256color",createIfEmpty:F?.createIfEmpty===!0}),fn=Dr.session,j=Dr.terminalSession,ye={id:fn.sessionId,name:fn.name,customName:fn.customName===!0,sessionId:j.sessionId,mode:j.mode??fn.mode,tmuxSessionName:j.tmuxSessionName??fn.tmuxSessionName};U(Lt=>Wk(Lt,ye)),me(ye.id),Vr.getState().setTerminalSession(ye.id,{sessionId:j.sessionId,cols:80,rows:24,mode:ye.mode,tmuxSessionName:ye.tmuxSessionName,activeProgram:j.activeProgram,activeProgramRaw:j.activeProgramRaw,activeProgramSource:j.activeProgramSource,cwd:j.cwd}),O("[Session] Inventory opened session:",{frontendSessionId:ye.id,backendSessionId:j.sessionId,reused:Dr.reused,mode:ye.mode,tmuxSessionName:ye.tmuxSessionName});const tt=F?.command?.trim();return tt&&await Ex(j.sessionId,`${tt}\r`),ye.id}catch(ae){return console.error("[Session] Failed to create new session:",ae),null}},[l,u,V,$r,O]);jn.current=vt;const lt=y.useCallback((F,ae={})=>{ss.getState().setActivePane(F);const le=Ce.current,Qe=!!le&&Re.current[le]===!0;if(me(F),Se.current&&ae.preserveMobileKeyboard===!1){Pn.current=Date.now()+600,le&&(Re.current[le]=!1),Pe(null),Be(null);const Mt=document.activeElement;Mt instanceof HTMLTextAreaElement&&Mt.closest(".terminal-viewport-container")&&Mt.blur();return}Qe&&Se.current&&Pe(F),it.current&&(!Se.current||Qe)&&Be({sessionId:F,token:Date.now()})},[]),rt=y.useCallback(F=>{me(F),wt(!0),pe(null)},[]),mt=y.useCallback(F=>{const ae=Ce.current;!ae||ae===F||(be(le=>Bf(le,ae,F)),wt(!1),lt(ae,{preserveMobileKeyboard:!1}))},[lt]),fr=y.useCallback(async()=>{const F=Ce.current;if(!F||rr)return;ir(!0);const ae=Vr.getState().sessions.get(F)?.cwd??void 0,le=await vt({cwd:ae||void 0,mode:l});if(ir(!1),!le){pe(D("common.error"));return}be(Qe=>Bf(Qe,F,le)),wt(!1),lt(F,{preserveMobileKeyboard:!1})},[lt,l,vt,rr,D]),gt=y.useCallback(F=>{be(ae=>Bk(ae,F)),F&<(F,{preserveMobileKeyboard:!1})},[lt]),Kt=y.useCallback(F=>{be(ae=>Dk(ae,F)),lt(F,{preserveMobileKeyboard:!1})},[lt]),at=y.useCallback(F=>{if(Y.find(le=>le.id===F)){if(ss.getState().setActivePane(F),F===Ce.current)return;if(me(F),!ck({isMobile:Se.current,viewportReady:re.has(F),streamReady:ot.has(F),contentReady:ze.has(F)})){_e(null),it.current&&Be({sessionId:F,token:Date.now()}),O("[Session] Switched to session:",F);return}z(Qe=>{if(Qe.has(F))return Qe;const Mt=new Set(Qe);return Mt.add(F),Mt}),_e(F),O("[Session] Switched to session:",F)}},[ze,O,ot,Y,re]),nr=y.useCallback((F,ae)=>{ae.trim()&&(U(le=>le.map(Qe=>Qe.id===F?{...Qe,name:ae.trim(),customName:!0}:Qe)),Ls(F,ae.trim()))},[Ls]),Ar=y.useCallback(F=>{U(ae=>ae.map(le=>le.id===F?{...le,customName:!1}:le)),Un(F)},[Un]),er=y.useCallback(F=>{U(ae=>{const le=new Map(ae.map(Xt=>[Xt.id,Xt])),Qe=F.map(Xt=>le.get(Xt)).filter(Xt=>Xt!==void 0),Mt=new Set(F),Ut=ae.filter(Xt=>!Mt.has(Xt.id));return[...Qe,...Ut]}),as(F),O("[Session] Reordered sessions:",F),requestAnimationFrame(()=>{nt.current?.update()})},[as,O]),Gr=y.useCallback(async F=>{const ae=typeof F=="string"?F:F.sessionId,le=typeof F=="string"?"auto":F.closeMode??"auto",Qe=Y.find(Ut=>Ut.id===ae);if(!Qe)return;const Mt=_7(Z,ae,Ut=>Ut.id);try{le==="destroy"&&Qe.mode==="tmux"&&Qe.tmuxSessionName?(await Nx(Qe.tmuxSessionName),O("[Session] Destroyed tmux session:",{frontendSessionId:Qe.id,tmuxSessionName:Qe.tmuxSessionName})):Qe.sessionId&&(await Ix(Qe.sessionId),O("[Session] Closed backend terminal:",Qe.sessionId))}catch(Ut){console.error("[Session] Failed to close backend terminal:",Ut);return}U(Ut=>{const Xt=Ut.filter(pr=>pr.id!==ae);return me(Mt),Xt}),hr(ae,Mt),delete Re.current[ae],O("[Session] Closed session:",{sessionId:ae,closeMode:le})},[Y,Z,hr,O]),Mr=y.useCallback(F=>{if(!F)return;const ae=Y.filter(le=>le.sessionId===F);if(ae.length!==0){ae.length>1&&console.warn("[session-invariant] backend matched multiple frontend sessions during cleanup",{backendSessionId:F,frontendSessionIds:ae.map(le=>le.id)}),U(le=>{const Qe=le.filter(Mt=>Mt.sessionId!==F);return Qe.length!==le.length&&!Qe.some(Ut=>Ut.id===V)&&me(Qe.length>0?Qe[0].id:null),Qe});for(const le of ae)hr(le.id),delete Re.current[le.id];O("[Session] Backend gone, dropped local session(s):",ae.map(le=>le.id))}},[Y,V,hr,O]);y.useEffect(()=>{const F=Vt=>{vt(Vt.detail)},ae=Vt=>{at(Vt.detail)},le=()=>{const Vt=Ce.current;!Vt||Se.current||Be({sessionId:Vt,token:Date.now()})},Qe=Vt=>{const zt=Vt;zt.detail&&rt(zt.detail)},Mt=Vt=>{const zt=Vt.detail;gt(zt??Ce.current??void 0)},Ut=Vt=>{const zt=Vt.detail;zt&&Kt(zt)},Xt=Vt=>{const zt=Vt.detail,_r=typeof zt=="string"?zt:zt?.layout,bs=typeof zt=="string"?Ce.current:zt?.sessionId;_r!=="horizontal"&&_r!=="vertical"&&_r!=="grid"||be(ai=>ai.map(Fs=>Fs.sessionIds.includes(bs??"")?{...Fs,layout:_r}:Fs))},pr=Vt=>{const _r=Vt.detail?.direction;if(_r!=="prev"&&_r!=="next")return;const bs=He.current;if(bs.length<=1)return;const ai=Ce.current,Fs=ai?bs.findIndex($i=>$i.id===ai):-1,Is=((Fs>=0?Fs:0)+(_r==="next"?1:-1)+bs.length)%bs.length,zn=bs[Is]?.id;zn&&zn!==ai&&at(zn)},Dr=Vt=>{Gr(Vt.detail)},fn=Vt=>{Mr(Vt.detail)},j=Vt=>{const zt=Vt;!zt.detail?.sessionId||!zt.detail?.name||nr(zt.detail.sessionId,zt.detail.name)},ye=Vt=>{const zt=Vt;zt.detail?.sessionId&&Ar(zt.detail.sessionId)},Ne=Vt=>{const zt=Vt;zt.detail?.sessionIds&&er(zt.detail.sessionIds)},tt=Vt=>{const zt=Vt.detail;!zt?.workspaceId||!Array.isArray(zt.sessionIds)||be(_r=>Qk(_r,zt.workspaceId,zt.sessionIds))},Lt=Vt=>{const zt=Vt.detail;!zt?.workspaceId||typeof zt.name!="string"||be(_r=>jk(_r,zt.workspaceId,zt.name))},Zt=Vt=>{const zt=Vt.detail;!zt?.primaryId||!zt.secondaryId||zt.primaryId===zt.secondaryId||(be(_r=>Bf(_r,zt.primaryId,zt.secondaryId)),lt(zt.primaryId,{preserveMobileKeyboard:!1}))};return window.addEventListener("new-terminal-session",F),window.addEventListener("switch-terminal-session",ae),window.addEventListener("focus-active-terminal-session",le),window.addEventListener("open-terminal-split-chooser",Qe),window.addEventListener("close-terminal-split",Mt),window.addEventListener("remove-terminal-split-pane",Ut),window.addEventListener("set-terminal-split-direction",Xt),window.addEventListener("cycle-terminal-session",pr),window.addEventListener("close-terminal-session",Dr),window.addEventListener("close-terminal-session-by-backend",fn),window.addEventListener("rename-terminal-session",j),window.addEventListener("reset-terminal-session-name",ye),window.addEventListener("reorder-terminal-session",Ne),window.addEventListener("reorder-terminal-split-workspace",tt),window.addEventListener("rename-terminal-split-workspace",Lt),window.addEventListener("combine-terminal-split-sessions",Zt),()=>{window.removeEventListener("new-terminal-session",F),window.removeEventListener("switch-terminal-session",ae),window.removeEventListener("focus-active-terminal-session",le),window.removeEventListener("open-terminal-split-chooser",Qe),window.removeEventListener("close-terminal-split",Mt),window.removeEventListener("remove-terminal-split-pane",Ut),window.removeEventListener("set-terminal-split-direction",Xt),window.removeEventListener("cycle-terminal-session",pr),window.removeEventListener("close-terminal-session",Dr),window.removeEventListener("close-terminal-session-by-backend",fn),window.removeEventListener("rename-terminal-session",j),window.removeEventListener("reset-terminal-session-name",ye),window.removeEventListener("reorder-terminal-session",Ne),window.removeEventListener("reorder-terminal-split-workspace",tt),window.removeEventListener("rename-terminal-split-workspace",Lt),window.removeEventListener("combine-terminal-split-sessions",Zt)}},[lt,vt,at,rt,gt,Kt,Gr,Mr,nr,Ar,er]),y.useEffect(()=>{if(!Gt||yt)return;const F=ae=>{if(!(ae.ctrlKey||ae.metaKey)||!ae.shiftKey)return;if(Gt.layout==="horizontal"?ae.key==="ArrowLeft"||ae.key==="ArrowRight":Gt.layout==="vertical"?ae.key==="ArrowUp"||ae.key==="ArrowDown":ae.key.startsWith("Arrow")){ae.preventDefault(),ae.stopPropagation();const Qe=Gt.sessionIds.indexOf(Ce.current??""),Mt=ae.key==="ArrowLeft"||ae.key==="ArrowUp"?-1:1,Ut=(Math.max(0,Qe)+Mt+Gt.sessionIds.length)%Gt.sessionIds.length,Xt=Gt.sessionIds[Ut];if(!Xt)return;lt(Xt);return}ae.key==="Backspace"&&(ae.preventDefault(),ae.stopPropagation(),gt(Ce.current??void 0))};return window.addEventListener("keydown",F,!0),()=>window.removeEventListener("keydown",F,!0)},[lt,Gt,gt,yt]);const Sr=F=>{const ae=Vr.getState().sessions.get(F.id);return Do(F,ae?.activeProgram??null,ae?.cwd??null,void 0,ae?.shellTitle??null,ae?.promptState??null)},Nn=(F,ae={})=>{const le=F.id===V&&!Je?.startsWith("@collaboration:"),Qe=At.has(F.id)&&!ae.hidden,Mt=p&&lk({sessionId:F.id,foregroundSessionId:rn,visibleSessionIds:At,deferredViewportSessionIds:yt?Jn:zr}),Ut=ok({sessionId:F.id,foregroundSessionId:rn,foregroundReady:Cn,isVisible:Qe})&&p,Xt=fk({sessionId:F.id,foregroundSessionId:rn,requestToken:ce.token,foregroundCompletedToken:us,isVisible:$n.has(F.id)})&&p,pr=Qe||F.id===rn||zr.has(F.id)?0:Tn.get(F.id)??Ud;return a.jsxs("div",{className:`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden ${ae.hidden?"invisible pointer-events-none":""}`,style:ae.containerStyle,"aria-hidden":ae.hidden||void 0,onPointerDownCapture:()=>{Qe&&f2(le,()=>lt(F.id))},onWheelCapture:()=>{f2(le,()=>lt(F.id))},children:[ae.showPaneTitle&&a.jsx(kk,{session:F,active:le,onActivate:()=>lt(F.id),onToggleRightSidebar:le?x:void 0}),a.jsx("div",{className:"min-h-0 flex-1 app-chrome-bg",children:Mt&&a.jsx(Lk,{sessionId:F.id,mode:F.mode,tmuxSessionName:F.tmuxSessionName,terminalSettings:e,colorTheme:t,toolbarPresets:r,isActive:le,focusSuspended:ve!==null,deferCursorUntilPositioned:ve===F.id||F.mode==="tmux"&&!ze.has(F.id),isLayoutVisible:Qe,initialConnectEnabled:Ut&&Xt,resumeRequestEnabled:Xt,suppressKeyboard:ae.suppressKeyboard,keyboardPortalTarget:ae.keyboardPortalTarget,sharedMobileKeyboardLayout:ae.sharedMobileKeyboardLayout,suppressPageFlipRefresh:ae.suppressPageFlipRefresh,focusRequestToken:X?.sessionId===F.id?X.token:0,resumeRequestToken:ce.token,resumeRequestReason:ce.reason,forceResumeReconnect:ce.forceForegroundReconnect&&$n.has(F.id),resumeRequestDelayMs:$n.has(F.id)?0:ae.hidden?Ud:Tn.get(F.id)??Ud,initialConnectDelayMs:pr,onStreamReadyChange:yr,onStreamConnected:Qr,onViewportReadyChange:Cr,onContentReadyChange:ds,onKeyboardVisibilityChange:$,showDebug:n,onStatusChange:le?k:void 0})})]},F.id)};return a.jsxs("div",{className:"relative h-full flex flex-col",children:[Yt&&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(Fx,{size:18})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-[13px] font-semibold text-foreground",children:D("tab.tmuxRecoveryTitle",{count:Yt.sessions.length})}),a.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:D("tab.tmuxRecoveryHint")}),a.jsx("p",{className:"mt-1.5 truncate text-[10px] text-foreground/70",children:Yt.sessions.map(F=>F.name).join(" · ")}),Tt&&a.jsx("p",{className:"mt-2 text-[10px] text-destructive",children:Tt}),a.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[a.jsxs("button",{type:"button",disabled:$e!==null,onClick:()=>{Xn()},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(Yx,{size:13,className:$e==="restore"?"animate-spin":""}),D($e==="restore"?"tab.tmuxRecoveryRestoring":"tab.tmuxRecoveryRestoreAll")]}),a.jsx("button",{type:"button",disabled:$e!==null,onClick:()=>{dn()},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:D("tab.tmuxRecoveryDismiss")})]})]})]})}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(e9,{onSwiper:F=>{nt.current=F,F.allowTouchMove=xt.length>1&&!Ur&&!je,ur("[swiper:on-swiper]",{allowTouchMove:F.allowTouchMove}),requestAnimationFrame(()=>De("on-swiper"))},onSlideChange:he,onTouchStart:(F,ae)=>{const le=x2(ae),Qe=le==="touch"||le==="pen"||le==="unknown";q("[swipe:touch-start]",{pointerType:le,allowed:Qe}),ur("[swiper:touch-start]",{pointerType:le,allowed:Qe}),Qe&&(on(),ue.current=!0,jt.current=!0)},onTouchEnd:(F,ae)=>{const le=x2(ae),Qe=le==="touch"||le==="pen"||le==="unknown";q("[swipe:touch-end]",{pointerType:le,allowed:Qe}),ur("[swiper:touch-end]",{pointerType:le,allowed:Qe}),Qe&&(ue.current=!1,Ms("touch-end"))},onTransitionEnd:()=>{const F=nt.current;if(ue.current){ur("[swiper:transition-end-during-touch]");return}if(jt.current&&F&&!zk(F,dr.current)){ur("[swiper:transition-end-deferred]");return}on(),jt.current=!1,ur("[swiper:transition-end]")},initialSlide:Math.max(0,Hr),speed:jp,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:xt.map(F=>{const ae=F.workspace,le=!!ae&&F.sessions.length>=2,Qe=yt?_t?"horizontal":"vertical":ae?.layout??"horizontal",Mt=yt&&ne?F.sessions.some(Xt=>Xt.id===ne):!1,Ut=F.sessions.some(Xt=>Xt.id===V)?V:F.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":hn.get(F.key)??0,style:{paddingRight:hn.get(F.key)??0,paddingTop:b&&!le?"2.5rem":void 0},children:le?a.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--chrome-bg)]",style:yt?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,children:[a.jsx($m,{layoutId:F.key,preset:ae?.layout??"horizontal",initialTree:QA(F.sessions.map(Xt=>Xt.id),Qe,ae?.ratios,ae?.gridColumnRatios,ae?.gridRowRatios),mobile:yt,focusId:Mt?ne:null,panes:F.sessions.map(Xt=>({id:Xt.id,content:Nn(Xt,{showPaneTitle:!yt,suppressKeyboard:yt&&Xt.id!==Ut,keyboardPortalTarget:yt?Et:null,sharedMobileKeyboardLayout:yt,suppressPageFlipRefresh:!0})}))}),yt&&a.jsx("div",{ref:Ht,className:"relative shrink-0 app-chrome-bg","data-split-keyboard-host":"true"})]}):a.jsx($m,{layoutId:F.key,preset:ae?.layout??"horizontal",mobile:yt,panes:[{id:F.sessions[0].id,content:Nn(F.sessions[0])}]})})},F.key)})})}),je&&V&&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:()=>wt(!1),"aria-label":D("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":D("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(al,{size:17})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:D("tab.splitTitle")}),a.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-muted-foreground",children:D("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:()=>wt(!1),"aria-label":D("common.close"),children:a.jsx(gs,{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:rr,onClick:()=>{fr()},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(bi,{size:17})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block text-[13px] font-medium text-foreground",children:D("tab.splitNew")}),a.jsx("span",{className:"mt-0.5 block text-[11px] text-muted-foreground",children:D("tab.splitNewHint")})]})]}),st.filter(F=>F.id!==Gt?.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:D("tab.splitExistingGroups")}),st.filter(F=>F.id!==Gt?.id).map((F,ae)=>{const le=F.sessionIds.flatMap(Ut=>{const Xt=Y.find(pr=>pr.id===Ut);return Xt?[Xt]:[]});if(le.length<2)return null;const Qe=F.name||`${D("tab.splitWorkspace")} ${ae+1}`,Mt=le.map(Ut=>Sr(Ut).primary).join(" · ");return a.jsxs("button",{type:"button",onClick:()=>mt(le[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(al,{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:Qe}),a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium text-primary",children:D("tab.splitOccupied")})]}),a.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[D("tab.sessionCount",{count:le.length})," · ",Mt]})]}),a.jsx(ya,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},F.id)})]}),a.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:D("tab.splitAvailableSessions")}),Y.filter(F=>!st.some(ae=>ae.sessionIds.includes(F.id))&&F.id!==V).length===0&&st.filter(F=>F.id!==Gt?.id).length===0?a.jsx("p",{className:"px-3 py-4 text-[12px] text-muted-foreground",children:D("tab.splitNoOtherSessions")}):Y.filter(F=>!st.some(ae=>ae.sessionIds.includes(F.id))&&F.id!==V).map(F=>{const ae=jr.get(F.id)??null,le=Sr(F);return a.jsxs("button",{type:"button",onClick:()=>mt(F.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:ae?a.jsx(lc,{size:15}):a.jsx(al,{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:le.primary}),a.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:ae?lu(ae)??ae:F.name})]}),a.jsx(ya,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},F.id)})]})]})]}),Te&&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:Te})]})},Yk={sm:"h-4 w-7",md:"h-6 w-10"},Zk={sm:"h-3 w-3",md:"h-5 w-5"},Kk={sm:"translate-x-3",md:"translate-x-4"};function Po({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 ${Yk[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 ${Zk[r]} ${e?Kk[r]:""}`})})}function Fi(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 Xk=typeof Symbol=="function"&&Symbol.observable||"@@observable",y2=Xk,v2=()=>Math.random().toString(36).substring(7).split("").join("."),Jk={INIT:`@@redux/INIT${v2()}`,REPLACE:`@@redux/REPLACE${v2()}`},w2=Jk;function eI(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 sb(e,t,r){if(typeof e!="function")throw new Error(Fi(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Fi(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Fi(1));return r(sb)(e,t)}let n=e,i=t,l=new Map,u=l,h=0,p=!1;function g(){u===l&&(u=new Map,l.forEach((N,R)=>{u.set(R,N)}))}function x(){if(p)throw new Error(Fi(3));return i}function b(N){if(typeof N!="function")throw new Error(Fi(4));if(p)throw new Error(Fi(5));let R=!0;g();const D=h++;return u.set(D,N),function(){if(R){if(p)throw new Error(Fi(6));R=!1,g(),u.delete(D),l=null}}}function w(N){if(!eI(N))throw new Error(Fi(7));if(typeof N.type>"u")throw new Error(Fi(8));if(typeof N.type!="string")throw new Error(Fi(17));if(p)throw new Error(Fi(9));try{p=!0,i=n(i,N)}finally{p=!1}return(l=u).forEach(D=>{D()}),N}function A(N){if(typeof N!="function")throw new Error(Fi(10));n=N,w({type:w2.REPLACE})}function k(){const N=b;return{subscribe(R){if(typeof R!="object"||R===null)throw new Error(Fi(11));function D(){const q=R;q.next&&q.next(x())}return D(),{unsubscribe:N(D)}},[y2](){return this}}}return w({type:w2.INIT}),{dispatch:w,subscribe:b,getState:x,replaceReducer:A,[y2]:k}}function A2(e,t){return function(...r){return t(e.apply(this,r))}}function T2(e,t){if(typeof e=="function")return A2(e,t);if(typeof e!="object"||e===null)throw new Error(Fi(16));const r={};for(const n in e){const i=e[n];typeof i=="function"&&(r[n]=A2(i,t))}return r}function ib(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function tI(...e){return t=>(r,n)=>{const i=t(r,n);let l=()=>{throw new Error(Fi(15))};const u={getState:i.getState,dispatch:(p,...g)=>l(p,...g)},h=e.map(p=>p(u));return l=ib(...h)(i.dispatch),{...i,dispatch:l}}}var jf={exports:{}},Pf={};var C2;function rI(){if(C2)return Pf;C2=1;var e=f9();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,u=e.useMemo,h=e.useDebugValue;return Pf.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=u(function(){function N(Y){if(!R){if(R=!0,D=Y,Y=b(Y),w!==void 0&&k.hasValue){var U=k.value;if(w(U,Y))return O=U}return O=Y}if(U=O,r(D,Y))return U;var V=b(Y);return w!==void 0&&w(U,V)?(D=Y,U):(D=Y,O=V)}var R=!1,D,O,q=x===void 0?null:x;return[function(){return N(g())},q===null?void 0:function(){return N(q())}]},[g,x,b,w]);var I=n(p,A[0],A[1]);return l(function(){k.hasValue=!0,k.value=I},[I]),h(I),I},Pf}var S2;function nI(){return S2||(S2=1,jf.exports=rI()),jf.exports}nI();var sI=y.version.startsWith("19"),iI=Symbol.for(sI?"react.transitional.element":"react.element"),aI=Symbol.for("react.portal"),oI=Symbol.for("react.fragment"),lI=Symbol.for("react.strict_mode"),cI=Symbol.for("react.profiler"),uI=Symbol.for("react.consumer"),dI=Symbol.for("react.context"),ab=Symbol.for("react.forward_ref"),hI=Symbol.for("react.suspense"),fI=Symbol.for("react.suspense_list"),T1=Symbol.for("react.memo"),pI=Symbol.for("react.lazy"),mI=ab,gI=T1;function xI(e){if(typeof e=="object"&&e!==null){const{$$typeof:t}=e;switch(t){case iI:switch(e=e.type,e){case oI:case cI:case lI:case hI:case fI:return e;default:switch(e=e&&e.$$typeof,e){case dI:case ab:case pI:case T1:return e;case uI:return e;default:return t}}case aI:return t}}}function bI(e){return xI(e)===T1}function yI(e,t,r,n,{areStatesEqual:i,areOwnPropsEqual:l,areStatePropsEqual:u}){let h=!1,p,g,x,b,w;function A(D,O){return p=D,g=O,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 I(){return e.dependsOnOwnProps&&(x=e(p,g)),t.dependsOnOwnProps&&(b=t(n,g)),w=r(x,b,g),w}function N(){const D=e(p,g),O=!u(D,x);return x=D,O&&(w=r(x,b,g)),w}function R(D,O){const q=!l(O,g),Y=!i(D,p,O,g);return p=D,g=O,q&&Y?k():q?I():Y?N():w}return function(O,q){return h?R(O,q):A(O,q)}}function vI(e,{initMapStateToProps:t,initMapDispatchToProps:r,initMergeProps:n,...i}){const l=t(e,i),u=r(e,i),h=n(e,i);return yI(l,u,h,e,i)}function wI(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 Fp(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 ob(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 C1(e,t){return(r,n)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${n.wrappedComponentName}.`)}}function AI(e){return e&&typeof e=="object"?Fp(t=>wI(e,t)):e?typeof e=="function"?ob(e):C1(e,"mapDispatchToProps"):Fp(t=>({dispatch:t}))}function TI(e){return e?typeof e=="function"?ob(e):C1(e,"mapStateToProps"):Fp(()=>({}))}function CI(e,t,r){return{...r,...e,...t}}function SI(e){return function(r,{displayName:n,areMergedPropsEqual:i}){let l=!1,u;return function(p,g,x){const b=e(p,g,x);return l?i(b,u)||(u=b):(l=!0,u=b),u}}}function _I(e){return e?typeof e=="function"?SI(e):C1(e,"mergeProps"):()=>CI}function LI(e){e()}function kI(){let e=null,t=null;return{clear(){e=null,t=null},notify(){LI(()=>{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 L2={notify(){},get:()=>[]};function lb(e,t){let r,n=L2,i=0,l=!1;function u(I){x();const N=n.subscribe(I);let R=!1;return()=>{R||(R=!0,N(),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=kI())}function b(){i--,r&&i===0&&(r(),r=void 0,n.clear(),n=L2)}function w(){l||(l=!0,x())}function A(){l&&(l=!1,b())}const k={addNestedSub:u,notifyNestedSubs:h,handleChangeWrapper:p,isSubscribed:g,trySubscribe:w,tryUnsubscribe:A,getListeners:()=>n};return k}var II=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",EI=II(),RI=()=>typeof navigator<"u"&&navigator.product==="ReactNative",NI=RI(),MI=()=>EI||NI?y.useLayoutEffect:y.useEffect,rh=MI();function k2(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function Of(e,t){if(k2(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])||!k2(e[r[i]],t[r[i]]))return!1;return!0}var DI={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},BI={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},QI={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},cb={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},jI={[mI]:QI,[gI]:cb};function I2(e){return bI(e)?cb:jI[e.$$typeof]||DI}var PI=Object.defineProperty,OI=Object.getOwnPropertyNames,E2=Object.getOwnPropertySymbols,FI=Object.getOwnPropertyDescriptor,UI=Object.getPrototypeOf,R2=Object.prototype;function Up(e,t){if(typeof t!="string"){if(R2){const l=UI(t);l&&l!==R2&&Up(e,l)}let r=OI(t);E2&&(r=r.concat(E2(t)));const n=I2(e),i=I2(t);for(let l=0;l<r.length;++l){const u=r[l];if(!BI[u]&&!(i&&i[u])&&!(n&&n[u])){const h=FI(t,u);try{PI(e,u,h)}catch{}}}}return e}var $I=Symbol.for("react-redux-context"),zI=typeof globalThis<"u"?globalThis:{};function HI(){if(!y.createContext)return{};const e=zI[$I]??=new Map;let t=e.get(y.createContext);return t||(t=y.createContext(null),e.set(y.createContext,t)),t}var ub=HI(),WI=[null,null];function GI(e,t,r){rh(()=>e(...t),r)}function VI(e,t,r,n,i,l){e.current=n,r.current=!1,i.current&&(i.current=null,l())}function qI(e,t,r,n,i,l,u,h,p,g,x){if(!e)return()=>{};let b=!1,w=null;const A=()=>{if(b||!h.current)return;const I=t.getState();let N,R;try{N=n(I,i.current)}catch(D){R=D,w=D}R||(w=null),N===l.current?u.current||g():(l.current=N,p.current=N,u.current=!0,x())};return r.onStateChange=A,r.trySubscribe(),A(),()=>{if(b=!0,r.tryUnsubscribe(),r.onStateChange=null,w)throw w}}function YI(e,t){return e===t}function ZI(e,t,r,{pure:n,areStatesEqual:i=YI,areOwnPropsEqual:l=Of,areStatePropsEqual:u=Of,areMergedPropsEqual:h=Of,forwardRef:p=!1,context:g=ub}={}){const x=g,b=TI(e),w=AI(t),A=_I(r),k=!!e;return N=>{const R=N.displayName||N.name||"Component",D=`Connect(${R})`,O={shouldHandleStateChanges:k,displayName:D,wrappedComponentName:R,WrappedComponent:N,initMapStateToProps:b,initMapDispatchToProps:w,initMergeProps:A,areStatesEqual:i,areStatePropsEqual:u,areOwnPropsEqual:l,areMergedPropsEqual:h};function q(V){const[me,Je,ve]=y.useMemo(()=>{const{reactReduxForwardedRef:Be,...st}=V;return[V.context,Be,st]},[V]),_e=y.useMemo(()=>{let Be=x;return me?.Consumer,Be},[me,x]),Ze=y.useContext(_e),Ve=!!V.store&&!!V.store.getState&&!!V.store.dispatch,ce=!!Ze&&!!Ze.store,ke=Ve?V.store:Ze.store,ot=ce?Ze.getServerState:ke.getState,Ie=y.useMemo(()=>vI(ke.dispatch,O),[ke]),[de,qe]=y.useMemo(()=>{if(!k)return WI;const Be=lb(ke,Ve?void 0:Ze.subscription),st=Be.notifyNestedSubs.bind(Be);return[Be,st]},[ke,Ve,Ze]),xe=y.useMemo(()=>Ve?Ze:{...Ze,subscription:de},[Ve,Ze,de]),te=y.useRef(void 0),re=y.useRef(ve),ge=y.useRef(void 0),ze=y.useRef(!1),Ke=y.useRef(!1),Ae=y.useRef(void 0);rh(()=>(Ke.current=!0,()=>{Ke.current=!1}),[]);const z=y.useMemo(()=>()=>ge.current&&ve===re.current?ge.current:Ie(ke.getState(),ve),[ke,ve]),Oe=y.useMemo(()=>st=>de?qI(k,ke,de,Ie,re,te,ze,Ke,ge,qe,st):()=>{},[de]);GI(VI,[re,te,ze,ve,ge,qe]);let nt;try{nt=y.useSyncExternalStore(Oe,z,ot?()=>Ie(ot(),ve):z)}catch(Be){throw Ae.current&&(Be.message+=`
|
|
70
|
-
The error may be correlated with this previous error:
|
|
71
|
-
${Ae.current.stack}
|
|
72
|
-
|
|
73
|
-
`),Be}rh(()=>{Ae.current=void 0,ge.current=void 0,te.current=nt});const Re=y.useMemo(()=>y.createElement(N,{...nt,ref:Je}),[Je,N,nt]);return y.useMemo(()=>k?y.createElement(_e.Provider,{value:xe},Re):Re,[_e,Re,xe])}const U=y.memo(q);if(U.WrappedComponent=N,U.displayName=q.displayName=D,p){const me=y.forwardRef(function(ve,_e){return y.createElement(U,{...ve,reactReduxForwardedRef:_e})});return me.displayName=D,me.WrappedComponent=N,Up(me,N)}return Up(U,N)}}var db=ZI;function KI(e){const{children:t,context:r,serverState:n,store:i}=e,l=y.useMemo(()=>{const p=lb(i);return{store:i,subscription:p,getServerState:n?()=>n:void 0}},[i,n]),u=y.useMemo(()=>i.getState(),[i]);rh(()=>{const{subscription:p}=l;return p.onStateChange=p.notifyNestedSubs,p.trySubscribe(),u!==i.getState()&&p.notifyNestedSubs(),()=>{p.tryUnsubscribe(),p.onStateChange=void 0}},[l,u]);const h=r||ub;return y.createElement(h.Provider,{value:l},t)}var XI=KI,JI="Invariant failed";function eE(e,t){throw new Error(JI)}var mo=function(t){var r=t.top,n=t.right,i=t.bottom,l=t.left,u=n-l,h=i-r,p={top:r,right:n,bottom:i,left:l,width:u,height:h,x:l,y:r,center:{x:(n+l)/2,y:(i+r)/2}};return p},S1=function(t,r){return{top:t.top-r.top,left:t.left-r.left,bottom:t.bottom+r.bottom,right:t.right+r.right}},N2=function(t,r){return{top:t.top+r.top,left:t.left+r.left,bottom:t.bottom-r.bottom,right:t.right-r.right}},tE=function(t,r){return{top:t.top+r.y,left:t.left+r.x,bottom:t.bottom+r.y,right:t.right+r.x}},Ff={top:0,right:0,bottom:0,left:0},_1=function(t){var r=t.borderBox,n=t.margin,i=n===void 0?Ff:n,l=t.border,u=l===void 0?Ff:l,h=t.padding,p=h===void 0?Ff:h,g=mo(S1(r,i)),x=mo(N2(r,u)),b=mo(N2(x,p));return{marginBox:g,borderBox:mo(r),paddingBox:x,contentBox:b,margin:i,border:u,padding:p}},Ua=function(t){var r=t.slice(0,-2),n=t.slice(-2);if(n!=="px")return 0;var i=Number(r);return isNaN(i)&&eE(),i},rE=function(){return{x:window.pageXOffset,y:window.pageYOffset}},nh=function(t,r){var n=t.borderBox,i=t.border,l=t.margin,u=t.padding,h=tE(n,r);return _1({borderBox:h,border:i,margin:l,padding:u})},sh=function(t,r){return r===void 0&&(r=rE()),nh(t,r)},hb=function(t,r){var n={top:Ua(r.marginTop),right:Ua(r.marginRight),bottom:Ua(r.marginBottom),left:Ua(r.marginLeft)},i={top:Ua(r.paddingTop),right:Ua(r.paddingRight),bottom:Ua(r.paddingBottom),left:Ua(r.paddingLeft)},l={top:Ua(r.borderTopWidth),right:Ua(r.borderRightWidth),bottom:Ua(r.borderBottomWidth),left:Ua(r.borderLeftWidth)};return _1({borderBox:t,margin:n,padding:i,border:l})},fb=function(t){var r=t.getBoundingClientRect(),n=window.getComputedStyle(t);return hb(r,n)},bu=function(t){var r=[],n=null,i=function(){for(var u=arguments.length,h=new Array(u),p=0;p<u;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 ih(){return ih=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},ih.apply(null,arguments)}function pb(e,t){}pb.bind(null,"warn");pb.bind(null,"error");function Rl(){}function nE(e,t){return{...e,...t}}function Wa(e,t,r){const n=t.map(i=>{const l=nE(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 sE="Invariant failed";class ah extends Error{}ah.prototype.toString=function(){return this.message};function Dt(e,t){throw new ah(sE)}class iE extends S.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=Rl,this.onWindowError=r=>{const n=this.getCallbacks();n.isDragging()&&n.tryAbort(),r.error instanceof ah&&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=Wa(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof ah){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const aE=`
|
|
74
|
-
Press space bar to start a drag.
|
|
75
|
-
When dragging you can use the arrow keys to move the item around and escape to cancel.
|
|
76
|
-
Some screen readers may require you to be in focus mode or to use your pass through key
|
|
77
|
-
`,oh=e=>e+1,oE=e=>`
|
|
78
|
-
You have lifted an item in position ${oh(e.source.index)}
|
|
79
|
-
`,mb=(e,t)=>{const r=e.droppableId===t.droppableId,n=oh(e.index),i=oh(t.index);return r?`
|
|
80
|
-
You have moved the item from position ${n}
|
|
81
|
-
to position ${i}
|
|
82
|
-
`:`
|
|
83
|
-
You have moved the item from position ${n}
|
|
84
|
-
in list ${e.droppableId}
|
|
85
|
-
to list ${t.droppableId}
|
|
86
|
-
in position ${i}
|
|
87
|
-
`},gb=(e,t,r)=>t.droppableId===r.droppableId?`
|
|
88
|
-
The item ${e}
|
|
89
|
-
has been combined with ${r.draggableId}`:`
|
|
90
|
-
The item ${e}
|
|
91
|
-
in list ${t.droppableId}
|
|
92
|
-
has been combined with ${r.draggableId}
|
|
93
|
-
in list ${r.droppableId}
|
|
94
|
-
`,lE=e=>{const t=e.destination;if(t)return mb(e.source,t);const r=e.combine;return r?gb(e.draggableId,e.source,r):"You are over an area that cannot be dropped on"},M2=e=>`
|
|
95
|
-
The item has returned to its starting position
|
|
96
|
-
of ${oh(e.index)}
|
|
97
|
-
`,cE=e=>{if(e.reason==="CANCEL")return`
|
|
98
|
-
Movement cancelled.
|
|
99
|
-
${M2(e.source)}
|
|
100
|
-
`;const t=e.destination,r=e.combine;return t?`
|
|
101
|
-
You have dropped the item.
|
|
102
|
-
${mb(e.source,t)}
|
|
103
|
-
`:r?`
|
|
104
|
-
You have dropped the item.
|
|
105
|
-
${gb(e.draggableId,e.source,r)}
|
|
106
|
-
`:`
|
|
107
|
-
The item has been dropped while not over a drop area.
|
|
108
|
-
${M2(e.source)}
|
|
109
|
-
`},zd={dragHandleUsageInstructions:aE,onDragStart:oE,onDragUpdate:lE,onDragEnd:cE};function uE(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function xb(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!uE(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),u=n.current||!!(t&&i.current.inputs&&xb(t,i.current.inputs))?i.current:{inputs:t,result:e()};return y.useEffect(()=>{n.current=!1,i.current=u},[u]),u.result}function wr(e,t){return bn(()=>e,t)}const ii={x:0,y:0},vi=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),xa=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),Nl=(e,t)=>e.x===t.x&&e.y===t.y,c0=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),uc=(e,t,r=0)=>e==="x"?{x:t,y:r}:{x:r,y:t},yu=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),D2=(e,t)=>Math.min(...t.map(r=>yu(e,r))),bb=e=>t=>({x:e(t.x),y:e(t.y)});var dE=(e,t)=>{const r=mo({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 Eu=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),B2=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}],hE={top:0,right:0,bottom:0,left:0},fE=(e,t)=>t?Eu(e,t.scroll.diff.displacement):e,pE=(e,t,r)=>r&&r.increasedBy?{...e,[t.end]:e[t.end]+r.increasedBy[t.line]}:e,mE=(e,t)=>t&&t.shouldClipSubject?dE(t.pageMarginBox,e):mo(e);var r0=({page:e,withPlaceholder:t,axis:r,frame:n})=>{const i=fE(e.marginBox,n),l=pE(i,r,t),u=mE(l,n);return{page:e,withPlaceholder:t,active:u}},L1=(e,t)=>{e.frame||Dt();const r=e.frame,n=xa(t,r.scroll.initial),i=c0(n),l={...r,scroll:{initial:r.scroll.initial,current:t,diff:{value:n,displacement:i},max:r.scroll.max}},u=r0({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:l});return{...e,frame:l,subject:u}};function si(e,t=xb){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 yb=si(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),vb=si(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),Ch=si(e=>Object.values(e)),gE=si(e=>Object.values(e));var u0=si((e,t)=>gE(t).filter(n=>e===n.descriptor.droppableId).sort((n,i)=>n.descriptor.index-i.descriptor.index));function k1(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function Sh(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var _h=si((e,t)=>t.filter(r=>r.descriptor.id!==e.descriptor.id)),xE=({isMovingForward:e,draggable:t,destination:r,insideDestination:n,previousImpact:i})=>{if(!r.isCombineEnabled||!k1(i))return null;function u(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?u(p):null;const g=_h(t,n);if(!p){if(!g.length)return null;const A=g[g.length-1];return u(A.descriptor.id)}const x=g.findIndex(A=>A.descriptor.id===p);x===-1&&Dt();const b=x-1;if(b<0)return null;const w=g[b];return u(w.descriptor.id)},d0=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const wb={point:ii,value:0},vu={invisible:{},visible:{},all:[]},bE={displaced:vu,displacedBy:wb,at:null};var Va=(e,t)=>r=>e<=r&&r<=t,Ab=e=>{const t=Va(e.top,e.bottom),r=Va(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),u=r(n.left)||r(n.right);if(l&&u)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&&u||g&&l}},yE=e=>{const t=Va(e.top,e.bottom),r=Va(e.left,e.right);return n=>t(n.top)&&t(n.bottom)&&r(n.left)&&r(n.right)};const I1={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},Tb={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var vE=e=>t=>{const r=Va(t.top,t.bottom),n=Va(t.left,t.right);return i=>e===I1?r(i.top)&&r(i.bottom):n(i.left)&&n(i.right)};const wE=(e,t)=>{const r=t.frame?t.frame.scroll.diff.displacement:ii;return Eu(e,r)},AE=(e,t,r)=>t.subject.active?r(t.subject.active)(e):!1,TE=(e,t,r)=>r(t)(e),E1=({target:e,destination:t,viewport:r,withDroppableDisplacement:n,isVisibleThroughFrameFn:i})=>{const l=n?wE(e,t):e;return AE(l,t,i)&&TE(l,r,i)},CE=e=>E1({...e,isVisibleThroughFrameFn:Ab}),Cb=e=>E1({...e,isVisibleThroughFrameFn:yE}),SE=e=>E1({...e,isVisibleThroughFrameFn:vE(e.destination.axis)}),_E=(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 LE(e,t){const r=e.page.marginBox,n={top:t.point.y,right:0,bottom:0,left:t.point.x};return mo(S1(r,n))}function wu({afterDragging:e,destination:t,displacedBy:r,viewport:n,forceShouldAnimate:i,last:l}){return e.reduce(function(h,p){const g=LE(p,r),x=p.descriptor.id;if(h.all.push(x),!CE({target:g,destination:t,viewport:n,withDroppableDisplacement:!0}))return h.invisible[p.descriptor.id]=!0,h;const w=_E(x,l,i),A={draggableId:x,shouldAnimate:w};return h.visible[x]=A,h},{all:[],visible:{},invisible:{}})}function kE(e,t){if(!e.length)return 0;const r=e[e.length-1].descriptor.index;return t.inHomeList?r:r+1}function Q2({insideDestination:e,inHomeList:t,displacedBy:r,destination:n}){const i=kE(e,{inHomeList:t});return{displaced:vu,displacedBy:r,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:i}}}}function lh({draggable:e,insideDestination:t,destination:r,viewport:n,displacedBy:i,last:l,index:u,forceShouldAnimate:h}){const p=d0(e,r);if(u==null)return Q2({insideDestination:t,inHomeList:p,displacedBy:i,destination:r});const g=t.find(k=>k.descriptor.index===u);if(!g)return Q2({insideDestination:t,inHomeList:p,displacedBy:i,destination:r});const x=_h(e,t),b=t.indexOf(g),w=x.slice(b);return{displaced:wu({afterDragging:w,destination:r,displacedBy:i,last:l,viewport:n.frame,forceShouldAnimate:h}),displacedBy:i,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:u}}}}function Dl(e,t){return!!t.effected[e]}var IE=({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 Dl(l,i)?e?h:h-1:e?h+1:h},EE=({isMovingForward:e,isInHomeList:t,insideDestination:r,location:n})=>{if(!r.length)return null;const i=n.index,l=e?i+1:i-1,u=r[0].descriptor.index,h=r[r.length-1].descriptor.index,p=t?h:h+1;return l<u||l>p?null:l},RE=({isMovingForward:e,isInHomeList:t,draggable:r,draggables:n,destination:i,insideDestination:l,previousImpact:u,viewport:h,afterCritical:p})=>{const g=u.at;if(g||Dt(),g.type==="REORDER"){const b=EE({isMovingForward:e,isInHomeList:t,location:g.destination,insideDestination:l});return b==null?null:lh({draggable:r,insideDestination:l,destination:i,viewport:h,last:u.displaced,displacedBy:u.displacedBy,index:b})}const x=IE({isMovingForward:e,destination:i,displaced:u.displaced,draggables:n,combine:g.combine,afterCritical:p});return x==null?null:lh({draggable:r,insideDestination:l,destination:i,viewport:h,last:u.displaced,displacedBy:u.displacedBy,index:x})},NE=({displaced:e,afterCritical:t,combineWith:r,displacedBy:n})=>{const i=!!(e.visible[r]||e.invisible[r]);return Dl(r,t)?i?ii:c0(n.point):i?n.point:ii},ME=({afterCritical:e,impact:t,draggables:r})=>{const n=Sh(t);n||Dt();const i=n.draggableId,l=r[i].page.borderBox.center,u=NE({displaced:t.displaced,afterCritical:e,combineWith:i,displacedBy:t.displacedBy});return vi(l,u)};const Sb=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,DE=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,R1=(e,t,r)=>t[e.crossAxisStart]+r.margin[e.crossAxisStart]+r.borderBox[e.crossAxisSize]/2,j2=({axis:e,moveRelativeTo:t,isMoving:r})=>uc(e.line,t.marginBox[e.end]+Sb(e,r),R1(e,t.marginBox,r)),P2=({axis:e,moveRelativeTo:t,isMoving:r})=>uc(e.line,t.marginBox[e.start]-DE(e,r),R1(e,t.marginBox,r)),BE=({axis:e,moveInto:t,isMoving:r})=>uc(e.line,t.contentBox[e.start]+Sb(e,r),R1(e,t.contentBox,r));var QE=({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:i})=>{const l=u0(n.descriptor.id,r),u=t.page,h=n.axis;if(!l.length)return BE({axis:h,moveInto:n.page,isMoving:u});const{displaced:p,displacedBy:g}=e,x=p.all[0];if(x){const w=r[x];if(Dl(x,i))return P2({axis:h,moveRelativeTo:w.page,isMoving:u});const A=nh(w.page,g.point);return P2({axis:h,moveRelativeTo:A,isMoving:u})}const b=l[l.length-1];if(b.descriptor.id===t.descriptor.id)return u.borderBox.center;if(Dl(b.descriptor.id,i)){const w=nh(b.page,c0(i.displacedBy.point));return j2({axis:h,moveRelativeTo:w,isMoving:u})}return j2({axis:h,moveRelativeTo:b.page,isMoving:u})},$p=(e,t)=>{const r=e.frame;return r?vi(t,r.scroll.diff.displacement):t};const jE=({impact:e,draggable:t,droppable:r,draggables:n,afterCritical:i})=>{const l=t.page.borderBox.center,u=e.at;return!r||!u?l:u.type==="REORDER"?QE({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:i}):ME({impact:e,draggables:n,afterCritical:i})};var Lh=e=>{const t=jE(e),r=e.droppable;return r?$p(r,t):t},_b=(e,t)=>{const r=xa(t,e.scroll.initial),n=c0(r);return{frame:mo({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 O2(e,t){return e.map(r=>t[r])}function PE(e,t){for(let r=0;r<t.length;r++){const n=t[r].visible[e];if(n)return n}return null}var OE=({impact:e,viewport:t,destination:r,draggables:n,maxScrollChange:i})=>{const l=_b(t,vi(t.scroll.current,i)),u=r.frame?L1(r,vi(r.frame.scroll.current,i)):r,h=e.displaced,p=wu({afterDragging:O2(h.all,n),destination:r,displacedBy:e.displacedBy,viewport:l.frame,last:h,forceShouldAnimate:!1}),g=wu({afterDragging:O2(h.all,n),destination:u,displacedBy:e.displacedBy,viewport:t.frame,last:h,forceShouldAnimate:!1}),x={},b={},w=[h,p,g];return h.all.forEach(k=>{const I=PE(k,w);if(I){b[k]=I;return}x[k]=!0}),{...e,displaced:{all:h.all,invisible:x,visible:b}}},FE=(e,t)=>vi(e.scroll.diff.displacement,t),N1=({pageBorderBoxCenter:e,draggable:t,viewport:r})=>{const n=FE(r,e),i=xa(n,t.page.borderBox.center);return vi(t.client.borderBox.center,i)},Lb=({draggable:e,destination:t,newPageBorderBoxCenter:r,viewport:n,withDroppableDisplacement:i,onlyOnMainAxis:l=!1})=>{const u=xa(r,e.page.borderBox.center),p={target:Eu(e.page.borderBox,u),destination:t,withDroppableDisplacement:i,viewport:n};return l?SE(p):Cb(p)},UE=({isMovingForward:e,draggable:t,destination:r,draggables:n,previousImpact:i,viewport:l,previousPageBorderBoxCenter:u,previousClientSelection:h,afterCritical:p})=>{if(!r.isEnabled)return null;const g=u0(r.descriptor.id,n),x=d0(t,r),b=xE({isMovingForward:e,draggable:t,destination:r,insideDestination:g,previousImpact:i})||RE({isMovingForward:e,isInHomeList:x,draggable:t,draggables:n,destination:r,insideDestination:g,previousImpact:i,viewport:l,afterCritical:p});if(!b)return null;const w=Lh({impact:b,draggable:t,droppable:r,draggables:n,afterCritical:p});if(Lb({draggable:t,destination:r,newPageBorderBoxCenter:w,viewport:l.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:N1({pageBorderBoxCenter:w,draggable:t,viewport:l}),impact:b,scrollJumpRequest:null};const k=xa(w,u),I=OE({impact:b,viewport:l,destination:r,draggables:n,maxScrollChange:k});return{clientSelection:h,impact:I,scrollJumpRequest:k}};const ji=e=>{const t=e.subject.active;return t||Dt(),t};var $E=({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:n,viewport:i})=>{const l=r.subject.active;if(!l)return null;const u=r.axis,h=Va(l[u.start],l[u.end]),p=Ch(n).filter(x=>x!==r).filter(x=>x.isEnabled).filter(x=>!!x.subject.active).filter(x=>Ab(i.frame)(ji(x))).filter(x=>{const b=ji(x);return e?l[u.crossAxisEnd]<b[u.crossAxisEnd]:b[u.crossAxisStart]<l[u.crossAxisStart]}).filter(x=>{const b=ji(x),w=Va(b[u.start],b[u.end]);return h(b[u.start])||h(b[u.end])||w(l[u.start])||w(l[u.end])}).sort((x,b)=>{const w=ji(x)[u.crossAxisStart],A=ji(b)[u.crossAxisStart];return e?w-A:A-w}).filter((x,b,w)=>ji(x)[u.crossAxisStart]===ji(w[0])[u.crossAxisStart]);if(!p.length)return null;if(p.length===1)return p[0];const g=p.filter(x=>Va(ji(x)[u.start],ji(x)[u.end])(t[u.line]));return g.length===1?g[0]:g.length>1?g.sort((x,b)=>ji(x)[u.start]-ji(b)[u.start])[0]:p.sort((x,b)=>{const w=D2(t,B2(ji(x))),A=D2(t,B2(ji(b)));return w!==A?w-A:ji(x)[u.start]-ji(b)[u.start]})[0]};const F2=(e,t)=>{const r=e.page.borderBox.center;return Dl(e.descriptor.id,t)?xa(r,t.displacedBy.point):r},zE=(e,t)=>{const r=e.page.borderBox;return Dl(e.descriptor.id,t)?Eu(r,c0(t.displacedBy.point)):r};var HE=({pageBorderBoxCenter:e,viewport:t,destination:r,insideDestination:n,afterCritical:i})=>n.filter(u=>Cb({target:zE(u,i),destination:r,viewport:t.frame,withDroppableDisplacement:!0})).sort((u,h)=>{const p=yu(e,$p(r,F2(u,i))),g=yu(e,$p(r,F2(h,i)));return p<g?-1:g<p?1:u.descriptor.index-h.descriptor.index})[0]||null,Ru=si(function(t,r){const n=r[t.line];return{value:n,point:uc(t.line,n)}});const WE=(e,t,r)=>{const n=e.axis;if(e.descriptor.mode==="virtual")return uc(n.line,t[n.line]);const i=e.subject.page.contentBox[n.size],p=u0(e.descriptor.id,r).reduce((g,x)=>g+x.client.marginBox[n.size],0)+t[n.line]-i;return p<=0?null:uc(n.line,p)},kb=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),Ib=(e,t,r)=>{const n=e.frame;d0(t,e)&&Dt(),e.subject.withPlaceholder&&Dt();const i=Ru(e.axis,t.displaceBy).point,l=WE(e,i,r),u={placeholderSize:i,increasedBy:l,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!n){const x=r0({page:e.subject.page,withPlaceholder:u,axis:e.axis,frame:e.frame});return{...e,subject:x}}const h=l?vi(n.scroll.max,l):n.scroll.max,p=kb(n,h),g=r0({page:e.subject.page,withPlaceholder:u,axis:e.axis,frame:p});return{...e,subject:g,frame:p}},GE=e=>{const t=e.subject.withPlaceholder;t||Dt();const r=e.frame;if(!r){const u=r0({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:u}}const n=t.oldFrameMaxScroll;n||Dt();const i=kb(r,n),l=r0({page:e.subject.page,axis:e.axis,frame:i,withPlaceholder:null});return{...e,subject:l,frame:i}};var VE=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:r,draggable:n,draggables:i,destination:l,viewport:u,afterCritical:h})=>{if(!t){if(r.length)return null;const b={displaced:vu,displacedBy:wb,at:{type:"REORDER",destination:{droppableId:l.descriptor.id,index:0}}},w=Lh({impact:b,draggable:n,droppable:l,draggables:i,afterCritical:h}),A=d0(n,l)?l:Ib(l,n,i);return Lb({draggable:n,destination:A,newPageBorderBoxCenter:w,viewport:u.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=Ru(l.axis,n.displaceBy);return lh({draggable:n,insideDestination:r,destination:l,viewport:u,displacedBy:x,last:vu,index:g})},qE=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:r,isOver:n,draggables:i,droppables:l,viewport:u,afterCritical:h})=>{const p=$E({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:l,viewport:u});if(!p)return null;const g=u0(p.descriptor.id,i),x=HE({pageBorderBoxCenter:t,viewport:u,destination:p,insideDestination:g,afterCritical:h}),b=VE({previousPageBorderBoxCenter:t,destination:p,draggable:r,draggables:i,moveRelativeTo:x,insideDestination:g,viewport:u,afterCritical:h});if(!b)return null;const w=Lh({impact:b,draggable:r,droppable:p,draggables:i,afterCritical:h});return{clientSelection:N1({pageBorderBoxCenter:w,draggable:r,viewport:u}),impact:b,scrollJumpRequest:null}},va=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const YE=(e,t)=>{const r=va(e);return r?t[r]:null};var ZE=({state:e,type:t})=>{const r=YE(e.impact,e.dimensions.droppables),n=!!r,i=e.dimensions.droppables[e.critical.droppable.id],l=r||i,u=l.axis.direction,h=u==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||u==="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?UE({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:g,destination:l,draggables:b,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):qE({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:g,isOver:l,draggables:b,droppables:w,viewport:e.viewport,afterCritical:e.afterCritical})};function Kl(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function Eb(e){const t=Va(e.top,e.bottom),r=Va(e.left,e.right);return function(i){return t(i.y)&&r(i.x)}}function KE(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function XE({pageBorderBox:e,draggable:t,candidates:r}){const n=t.page.borderBox.center,i=r.map(l=>{const u=l.axis,h=uc(l.axis.line,e.center[u.line],l.page.borderBox.center[u.crossAxisLine]);return{id:l.descriptor.id,distance:yu(n,h)}}).sort((l,u)=>u.distance-l.distance);return i[0]?i[0].id:null}function JE({pageBorderBox:e,draggable:t,droppables:r}){const n=Ch(r).filter(i=>{if(!i.isEnabled)return!1;const l=i.subject.active;if(!l||!KE(e,l))return!1;if(Eb(l)(e.center))return!0;const u=i.axis,h=l.center[u.crossAxisLine],p=e[u.crossAxisStart],g=e[u.crossAxisEnd],x=Va(l[u.crossAxisStart],l[u.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:XE({pageBorderBox:e,draggable:t,candidates:n}):null}const Rb=(e,t)=>mo(Eu(e,t));var eR=(e,t)=>{const r=e.frame;return r?Rb(t,r.scroll.diff.value):t};function Nb({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function tR({draggable:e,closest:t,inHomeList:r}){return t?r&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var rR=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:r,insideDestination:n,last:i,viewport:l,afterCritical:u})=>{const h=r.axis,p=Ru(r.axis,t.displaceBy),g=p.value,x=e[h.start],b=e[h.end],A=_h(t,n).find(I=>{const N=I.descriptor.id,R=I.page.borderBox.center[h.line],D=Dl(N,u),O=Nb({displaced:i,id:N});return D?O?b<=R:x<R-g:O?b<=R+g:x<R})||null,k=tR({draggable:t,closest:A,inHomeList:d0(t,r)});return lh({draggable:t,insideDestination:n,destination:r,viewport:l,last:i,displacedBy:p,index:k})};const nR=4;var sR=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:r,destination:n,insideDestination:i,afterCritical:l})=>{if(!n.isCombineEnabled)return null;const u=n.axis,h=Ru(n.axis,e.displaceBy),p=h.value,g=t[u.start],x=t[u.end],w=_h(e,i).find(k=>{const I=k.descriptor.id,N=k.page.borderBox,D=N[u.size]/nR,O=Dl(I,l),q=Nb({displaced:r.displaced,id:I});return O?q?x>N[u.start]+D&&x<N[u.end]-D:g>N[u.start]-p+D&&g<N[u.end]-p-D:q?x>N[u.start]+p+D&&x<N[u.end]+p-D:g>N[u.start]+D&&g<N[u.end]-D});return w?{displacedBy:h,displaced:r.displaced,at:{type:"COMBINE",combine:{draggableId:w.descriptor.id,droppableId:n.descriptor.id}}}:null},Mb=({pageOffset:e,draggable:t,draggables:r,droppables:n,previousImpact:i,viewport:l,afterCritical:u})=>{const h=Rb(t.page.borderBox,e),p=JE({pageBorderBox:h,draggable:t,droppables:n});if(!p)return bE;const g=n[p],x=u0(g.descriptor.id,r),b=eR(g,h);return sR({pageBorderBoxWithDroppableScroll:b,draggable:t,previousImpact:i,destination:g,insideDestination:x,afterCritical:u})||rR({pageBorderBoxWithDroppableScroll:b,draggable:t,destination:g,insideDestination:x,last:i.displaced,viewport:l,afterCritical:u})},M1=(e,t)=>({...e,[t.descriptor.id]:t});const iR=({previousImpact:e,impact:t,droppables:r})=>{const n=va(e),i=va(t);if(!n||n===i)return r;const l=r[n];if(!l.subject.withPlaceholder)return r;const u=GE(l);return M1(r,u)};var aR=({draggable:e,draggables:t,droppables:r,previousImpact:n,impact:i})=>{const l=iR({previousImpact:n,impact:i,droppables:r}),u=va(i);if(!u)return l;const h=r[u];if(d0(e,h)||h.subject.withPlaceholder)return l;const p=Ib(h,e,t);return M1(l,p)},au=({state:e,clientSelection:t,dimensions:r,viewport:n,impact:i,scrollJumpRequest:l})=>{const u=n||e.viewport,h=r||e.dimensions,p=t||e.current.client.selection,g=xa(p,e.initial.client.selection),x={offset:g,selection:p,borderBoxCenter:vi(e.initial.client.borderBoxCenter,g)},b={selection:vi(x.selection,u.scroll.current),borderBoxCenter:vi(x.borderBoxCenter,u.scroll.current),offset:vi(x.offset,u.scroll.diff.value)},w={client:x,page:b};if(e.phase==="COLLECTING")return{...e,dimensions:h,viewport:u,current:w};const A=h.draggables[e.critical.draggable.id],k=i||Mb({pageOffset:b.offset,draggable:A,draggables:h.draggables,droppables:h.droppables,previousImpact:e.impact,viewport:u,afterCritical:e.afterCritical}),I=aR({draggable:A,impact:k,previousImpact:e.impact,draggables:h.draggables,droppables:h.droppables});return{...e,current:w,dimensions:{draggables:h.draggables,droppables:I},impact:k,viewport:u,scrollJumpRequest:l||null,forceShouldAnimate:l?!1:null}};function oR(e,t){return e.map(r=>t[r])}var Db=({impact:e,viewport:t,draggables:r,destination:n,forceShouldAnimate:i})=>{const l=e.displaced,u=oR(l.all,r),h=wu({afterDragging:u,destination:n,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:i,last:l});return{...e,displaced:h}},Bb=({impact:e,draggable:t,droppable:r,draggables:n,viewport:i,afterCritical:l})=>{const u=Lh({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:l});return N1({pageBorderBoxCenter:u,draggable:t,viewport:i})},Qb=({state:e,dimensions:t,viewport:r})=>{e.movementMode!=="SNAP"&&Dt();const n=e.impact,i=r||e.viewport,l=t||e.dimensions,{draggables:u,droppables:h}=l,p=u[e.critical.draggable.id],g=va(n);g||Dt();const x=h[g],b=Db({impact:n,viewport:i,destination:x,draggables:u}),w=Bb({impact:b,draggable:p,droppable:x,draggables:u,viewport:i,afterCritical:e.afterCritical});return au({impact:b,clientSelection:w,state:e,dimensions:l,viewport:i})},lR=e=>({index:e.index,droppableId:e.droppableId}),jb=({draggable:e,home:t,draggables:r,viewport:n})=>{const i=Ru(t.axis,e.displaceBy),l=u0(t.descriptor.id,r),u=l.indexOf(e);u===-1&&Dt();const h=l.slice(u+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:wu({afterDragging:h,destination:t,displacedBy:i,last:null,viewport:n.frame,forceShouldAnimate:!1}),displacedBy:i,at:{type:"REORDER",destination:lR(e.descriptor)}},afterCritical:g}},cR=(e,t)=>({draggables:e.draggables,droppables:M1(e.droppables,t)}),uR=({draggable:e,offset:t,initialWindowScroll:r})=>{const n=nh(e.client,t),i=sh(n,r);return{...e,placeholder:{...e.placeholder,client:n},client:n,page:i}},dR=e=>{const t=e.frame;return t||Dt(),t},hR=({additions:e,updatedDroppables:t,viewport:r})=>{const n=r.scroll.diff.value;return e.map(i=>{const l=i.descriptor.droppableId,u=t[l],p=dR(u).scroll.diff.value,g=vi(n,p);return uR({draggable:i,offset:g,initialWindowScroll:r.scroll.initial})})},fR=({state:e,published:t})=>{const r=t.modified.map(R=>{const D=e.dimensions.droppables[R.droppableId];return L1(D,R.scroll)}),n={...e.dimensions.droppables,...yb(r)},i=vb(hR({additions:t.additions,updatedDroppables:n,viewport:e.viewport})),l={...e.dimensions.draggables,...i};t.removals.forEach(R=>{delete l[R]});const u={droppables:n,draggables:l},h=va(e.impact),p=h?u.droppables[h]:null,g=u.draggables[e.critical.draggable.id],x=u.droppables[e.critical.droppable.id],{impact:b,afterCritical:w}=jb({draggable:g,home:x,draggables:l,viewport:e.viewport}),A=p&&p.isCombineEnabled?e.impact:b,k=Mb({pageOffset:e.current.page.offset,draggable:u.draggables[e.critical.draggable.id],draggables:u.draggables,droppables:u.droppables,previousImpact:A,viewport:e.viewport,afterCritical:w}),I={...e,phase:"DRAGGING",impact:k,onLiftImpact:b,dimensions:u,afterCritical:w,forceShouldAnimate:!1};return e.phase==="COLLECTING"?I:{...I,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const zp=e=>e.movementMode==="SNAP",Uf=(e,t,r)=>{const n=cR(e.dimensions,t);return!zp(e)||r?au({state:e,dimensions:n}):Qb({state:e,dimensions:n})};function $f(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const U2={phase:"IDLE",completed:null,shouldFlush:!1};var pR=(e=U2,t)=>{if(t.type==="FLUSH")return{...U2,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&Dt();const{critical:r,clientSelection:n,viewport:i,dimensions:l,movementMode:u}=t.payload,h=l.draggables[r.draggable.id],p=l.droppables[r.droppable.id],g={selection:n,borderBoxCenter:h.client.borderBox.center,offset:ii},x={client:g,page:{selection:vi(g.selection,i.scroll.initial),borderBoxCenter:vi(g.selection,i.scroll.initial),offset:vi(g.selection,i.scroll.diff.value)}},b=Ch(l.droppables).every(I=>!I.isFixedOnPage),{impact:w,afterCritical:A}=jb({draggable:h,home:p,draggables:l.draggables,viewport:i});return{phase:"DRAGGING",isDragging:!0,critical:r,movementMode:u,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"&&Dt(),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||Dt(),fR({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;Kl(e)||Dt();const{client:r}=t.payload;return Nl(r,e.current.client.selection)?e:au({state:e,clientSelection:r,impact:zp(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return $f(e);Kl(e)||Dt();const{id:r,newScroll:n}=t.payload,i=e.dimensions.droppables[r];if(!i)return e;const l=L1(i,n);return Uf(e,l,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;Kl(e)||Dt();const{id:r,isEnabled:n}=t.payload,i=e.dimensions.droppables[r];i||Dt(),i.isEnabled===n&&Dt();const l={...i,isEnabled:n};return Uf(e,l,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;Kl(e)||Dt();const{id:r,isCombineEnabled:n}=t.payload,i=e.dimensions.droppables[r];i||Dt(),i.isCombineEnabled===n&&Dt();const l={...i,isCombineEnabled:n};return Uf(e,l,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;Kl(e)||Dt(),e.isWindowScrollAllowed||Dt();const r=t.payload.newScroll;if(Nl(e.viewport.scroll.current,r))return $f(e);const n=_b(e.viewport,r);return zp(e)?Qb({state:e,viewport:n}):au({state:e,viewport:n})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!Kl(e))return e;const r=t.payload.maxScroll;if(Nl(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"&&Dt();const r=ZE({state:e,type:t.type});return r?au({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"&&Dt(),{...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"||Dt(),{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 mR=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),gR=e=>({type:"LIFT",payload:e}),xR=e=>({type:"INITIAL_PUBLISH",payload:e}),bR=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),yR=()=>({type:"COLLECTION_STARTING",payload:null}),vR=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),wR=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),AR=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),Pb=e=>({type:"MOVE",payload:e}),TR=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),CR=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),SR=()=>({type:"MOVE_UP",payload:null}),_R=()=>({type:"MOVE_DOWN",payload:null}),LR=()=>({type:"MOVE_RIGHT",payload:null}),kR=()=>({type:"MOVE_LEFT",payload:null}),D1=()=>({type:"FLUSH",payload:null}),IR=e=>({type:"DROP_ANIMATE",payload:e}),B1=e=>({type:"DROP_COMPLETE",payload:e}),Ob=e=>({type:"DROP",payload:e}),ER=e=>({type:"DROP_PENDING",payload:e}),Fb=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var RR=e=>({getState:t,dispatch:r})=>n=>i=>{if(!Qn(i,"LIFT")){n(i);return}const{id:l,clientSelection:u,movementMode:h}=i.payload,p=t();p.phase==="DROP_ANIMATING"&&r(B1({completed:p.completed})),t().phase!=="IDLE"&&Dt(),r(D1()),r(mR({draggableId:l,movementMode:h}));const x={draggableId:l,scrollOptions:{shouldPublishImmediately:h==="SNAP"}},{critical:b,dimensions:w,viewport:A}=e.startPublishing(x);r(xR({critical:b,dimensions:w,clientSelection:u,movementMode:h,viewport:A}))},NR=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 Q1={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},Au={opacity:{drop:0,combining:.7},scale:{drop:.75}},Ub={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},Zl=`${Ub.outOfTheWay}s ${Q1.outOfTheWay}`,ou={fluid:`opacity ${Zl}`,snap:`transform ${Zl}, opacity ${Zl}`,drop:e=>{const t=`${e}s ${Q1.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${Zl}`,placeholder:`height ${Zl}, width ${Zl}, margin ${Zl}`},$2=e=>Nl(e,ii)?void 0:`translate(${e.x}px, ${e.y}px)`,Hp={moveTo:$2,drop:(e,t)=>{const r=$2(e);if(r)return t?`${r} scale(${Au.scale.drop})`:r}},{minDropTime:Wp,maxDropTime:$b}=Ub,MR=$b-Wp,z2=1500,DR=.6;var BR=({current:e,destination:t,reason:r})=>{const n=yu(e,t);if(n<=0)return Wp;if(n>=z2)return $b;const i=n/z2,l=Wp+MR*i,u=r==="CANCEL"?l*DR:l;return Number(u.toFixed(2))},QR=({impact:e,draggable:t,dimensions:r,viewport:n,afterCritical:i})=>{const{draggables:l,droppables:u}=r,h=va(e),p=h?u[h]:null,g=u[t.descriptor.droppableId],x=Bb({impact:e,draggable:t,draggables:l,afterCritical:i,droppable:p||g,viewport:n});return xa(x,t.client.borderBox.center)},jR=({draggables:e,reason:t,lastImpact:r,home:n,viewport:i,onLiftImpact:l})=>!r.at||t!=="DROP"?{impact:Db({draggables:e,impact:l,destination:n,viewport:i,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:r.at.type==="REORDER"?{impact:r,didDropInsideDroppable:!0}:{impact:{...r,displaced:vu},didDropInsideDroppable:!0};const PR=({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(ER({reason:l}));return}if(i.phase==="IDLE")return;i.phase==="DROP_PENDING"&&i.isWaiting&&Dt(),i.phase==="DRAGGING"||i.phase==="DROP_PENDING"||Dt();const h=i.critical,p=i.dimensions,g=p.draggables[i.critical.draggable.id],{impact:x,didDropInsideDroppable:b}=jR({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?k1(x):null,A=b?Sh(x):null,k={index:h.draggable.index,droppableId:h.droppable.id},I={draggableId:g.descriptor.id,type:g.descriptor.type,source:k,reason:l,mode:i.movementMode,destination:w,combine:A},N=QR({impact:x,draggable:g,dimensions:p,viewport:i.viewport,afterCritical:i.afterCritical}),R={critical:i.critical,afterCritical:i.afterCritical,result:I,impact:x};if(!(!Nl(i.current.client.offset,N)||!!I.combine)){t(B1({completed:R}));return}const O=BR({current:i.current.client.offset,destination:N,reason:l});t(IR({newHomeClientOffset:N,dropDuration:O,completed:R}))};var zb=()=>({x:window.pageXOffset,y:window.pageYOffset});function OR(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function FR({onWindowScroll:e}){function t(){e(zb())}const r=bu(t),n=OR(r);let i=Rl;function l(){return i!==Rl}function u(){l()&&Dt(),i=Wa(window,[n])}function h(){l()||Dt(),r.cancel(),i(),i=Rl}return{start:u,stop:h,isActive:l}}const UR=e=>Qn(e,"DROP_COMPLETE")||Qn(e,"DROP_ANIMATE")||Qn(e,"FLUSH"),$R=e=>{const t=FR({onWindowScroll:r=>{e.dispatch(TR({newScroll:r}))}});return r=>n=>{!t.isActive()&&Qn(n,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&UR(n)&&t.stop(),r(n)}};var zR=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},HR=()=>{const e=[],t=i=>{const l=e.findIndex(h=>h.timerId===i);l===-1&&Dt();const[u]=e.splice(l,1);u.callback()};return{add:i=>{const l=setTimeout(()=>t(l)),u={timerId:l,callback:i};e.push(u)},flush:()=>{if(!e.length)return;const i=[...e];e.length=0,i.forEach(l=>{clearTimeout(l.timerId),l.callback()})}}};const WR=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,GR=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,VR=(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},Q0=(e,t)=>{t()},bd=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function zf(e,t,r,n){if(!e){r(n(t));return}const i=zR(r);e(t,{announce:i}),i.wasCalled()||r(n(t))}var qR=(e,t)=>{const r=HR();let n=null;const i=(b,w)=>{n&&Dt(),Q0("onBeforeCapture",()=>{const A=e().onBeforeCapture;A&&A({draggableId:b,mode:w})})},l=(b,w)=>{n&&Dt(),Q0("onBeforeDragStart",()=>{const A=e().onBeforeDragStart;A&&A(bd(b,w))})},u=(b,w)=>{n&&Dt();const A=bd(b,w);n={mode:w,lastCritical:b,lastLocation:A.source,lastCombine:null},r.add(()=>{Q0("onDragStart",()=>zf(e().onDragStart,A,t,zd.onDragStart))})},h=(b,w)=>{const A=k1(w),k=Sh(w);n||Dt();const I=!VR(b,n.lastCritical);I&&(n.lastCritical=b);const N=!WR(n.lastLocation,A);N&&(n.lastLocation=A);const R=!GR(n.lastCombine,k);if(R&&(n.lastCombine=k),!I&&!N&&!R)return;const D={...bd(b,n.mode),combine:k,destination:A};r.add(()=>{Q0("onDragUpdate",()=>zf(e().onDragUpdate,D,t,zd.onDragUpdate))})},p=()=>{n||Dt(),r.flush()},g=b=>{n||Dt(),n=null,Q0("onDragEnd",()=>zf(e().onDragEnd,b,t,zd.onDragEnd))};return{beforeCapture:i,beforeStart:l,start:u,update:h,flush:p,drop:g,abort:()=>{if(!n)return;const b={...bd(n.lastCritical,n.mode),combine:null,destination:null,reason:"CANCEL"};g(b)}}},YR=(e,t)=>{const r=qR(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 u=n.getState();u.phase==="DRAGGING"&&r.update(u.critical,u.impact)}};const ZR=e=>t=>r=>{if(!Qn(r,"DROP_ANIMATION_FINISHED")){t(r);return}const n=e.getState();n.phase!=="DROP_ANIMATING"&&Dt(),e.dispatch(B1({completed:n.completed}))},KR=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 u={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(Fb())}};r=requestAnimationFrame(()=>{r=null,t=Wa(window,[u])})}};var XR=e=>()=>t=>r=>{(Qn(r,"DROP_COMPLETE")||Qn(r,"FLUSH")||Qn(r,"DROP_ANIMATE"))&&e.stopPublishing(),t(r)},JR=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 eN=e=>Qn(e,"DROP_COMPLETE")||Qn(e,"DROP_ANIMATE")||Qn(e,"FLUSH");var tN=e=>t=>r=>n=>{if(eN(n)){e.stop(),r(n);return}if(Qn(n,"INITIAL_PUBLISH")){r(n);const i=t.getState();i.phase!=="DRAGGING"&&Dt(),e.start(i);return}r(n),e.scroll(t.getState())};const rN=e=>t=>r=>{if(t(r),!Qn(r,"PUBLISH_WHILE_DRAGGING"))return;const n=e.getState();n.phase==="DROP_PENDING"&&(n.isWaiting||e.dispatch(Ob({reason:n.reason})))},nN=ib;var sN=({dimensionMarshal:e,focusMarshal:t,styleMarshal:r,getResponders:n,announce:i,autoScroller:l})=>sb(pR,nN(tI(NR(r),XR(e),RR(e),PR,ZR,KR,rN,tN(l),$R,JR(t),YR(n,i))));const Hf=()=>({additions:{},removals:{},modified:{}});function iN({registry:e,callbacks:t}){let r=Hf(),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(ii)).sort((k,I)=>k.descriptor.index-I.descriptor.index),w=Object.keys(x).map(k=>{const N=e.droppable.getById(k).callbacks.getScrollWhileDragging();return{droppableId:k,scroll:N}}),A={additions:b,removals:Object.keys(g),modified:w};r=Hf(),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=Hf())}}}var Hb=({scrollHeight:e,scrollWidth:t,height:r,width:n})=>{const i=xa({x:t,y:e},{x:n,y:r});return{x:Math.max(0,i.x),y:Math.max(0,i.y)}},Wb=()=>{const e=document.documentElement;return e||Dt(),e},Gb=()=>{const e=Wb();return Hb({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},aN=()=>{const e=zb(),t=Gb(),r=e.y,n=e.x,i=Wb(),l=i.clientWidth,u=i.clientHeight,h=n+l,p=r+u;return{frame:mo({top:r,left:n,right:h,bottom:p}),scroll:{initial:e,current:e,max:t,diff:{value:ii,displacement:ii}}}},oN=({critical:e,scrollOptions:t,registry:r})=>{const n=aN(),i=n.scroll.current,l=e.droppable,u=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:vb(h),droppables:yb(u)},critical:e,viewport:n}};function H2(e,t,r){return!(r.descriptor.id===t.id||r.descriptor.type!==t.type||e.droppable.getById(r.descriptor.droppableId).descriptor.mode!=="virtual")}var lN=(e,t)=>{let r=null;const n=iN({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),i=(w,A)=>{e.droppable.exists(w)||Dt(),r&&t.updateDroppableIsEnabled({id:w,isEnabled:A})},l=(w,A)=>{r&&(e.droppable.exists(w)||Dt(),t.updateDroppableIsCombineEnabled({id:w,isCombineEnabled:A}))},u=(w,A)=>{r&&(e.droppable.exists(w)||Dt(),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||Dt();const A=r.critical.draggable;w.type==="ADDITION"&&H2(e,A,w.value)&&n.add(w.value),w.type==="REMOVAL"&&H2(e,A,w.value)&&n.remove(w.value)};return{updateDroppableIsEnabled:i,updateDroppableIsCombineEnabled:l,scrollDroppable:h,updateDroppableScroll:u,startPublishing:w=>{r&&Dt();const A=e.draggable.getById(w.draggableId),k=e.droppable.getById(A.descriptor.droppableId),I={draggable:A.descriptor,droppable:k.descriptor},N=e.subscribe(g);return r={critical:I,unsubscribe:N},oN({critical:I,registry:e,scrollOptions:w.scrollOptions})},stopPublishing:p}},Vb=(e,t)=>e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP",cN=e=>{window.scrollBy(e.x,e.y)};const uN=si(e=>Ch(e).filter(t=>!(!t.isEnabled||!t.frame))),dN=(e,t)=>uN(t).find(n=>(n.frame||Dt(),Eb(n.frame.pageMarginBox)(e)))||null;var hN=({center:e,destination:t,droppables:r})=>{if(t){const i=r[t];return i.frame?i:null}return dN(e,r)};const Tu={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>e**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var fN=(e,t,r=()=>Tu)=>{const n=r(),i=e[t.size]*n.startFromPercentage,l=e[t.size]*n.maxScrollAtPercentage;return{startScrollingFrom:i,maxScrollValueAt:l}},qb=({startOfRange:e,endOfRange:t,current:r})=>{const n=t-e;return n===0?0:(r-e)/n},j1=1,pN=(e,t,r=()=>Tu)=>{const n=r();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return n.maxPixelScroll;if(e===t.startScrollingFrom)return j1;const l=1-qb({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),u=n.maxPixelScroll*n.ease(l);return Math.ceil(u)},mN=(e,t,r)=>{const n=r(),i=n.durationDampening.accelerateAt,l=n.durationDampening.stopDampeningAt,u=t,h=l,g=Date.now()-u;if(g>=l)return e;if(g<i)return j1;const x=qb({startOfRange:i,endOfRange:h,current:g}),b=e*n.ease(x);return Math.ceil(b)},W2=({distanceToEdge:e,thresholds:t,dragStartTime:r,shouldUseTimeDampening:n,getAutoScrollerOptions:i})=>{const l=pN(e,t,i);return l===0?0:n?Math.max(mN(l,r,i),j1):l},G2=({container:e,distanceToEdges:t,dragStartTime:r,axis:n,shouldUseTimeDampening:i,getAutoScrollerOptions:l})=>{const u=fN(e,n,l);return t[n.end]<t[n.start]?W2({distanceToEdge:t[n.end],thresholds:u,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:l}):-1*W2({distanceToEdge:t[n.start],thresholds:u,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:l})},gN=({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 xN=bb(e=>e===0?0:e);var Yb=({dragStartTime:e,container:t,subject:r,center:n,shouldUseTimeDampening:i,getAutoScrollerOptions:l})=>{const u={top:n.y-t.top,right:t.right-n.x,bottom:t.bottom-n.y,left:n.x-t.left},h=G2({container:t,distanceToEdges:u,dragStartTime:e,axis:I1,shouldUseTimeDampening:i,getAutoScrollerOptions:l}),p=G2({container:t,distanceToEdges:u,dragStartTime:e,axis:Tb,shouldUseTimeDampening:i,getAutoScrollerOptions:l}),g=xN({x:p,y:h});if(Nl(g,ii))return null;const x=gN({container:t,subject:r,proposedScroll:g});return x?Nl(x,ii)?null:x:null};const bN=bb(e=>e===0?0:e>0?1:-1),P1=(()=>{const e=(t,r)=>t<0?t:t>r?t-r:0;return({current:t,max:r,change:n})=>{const i=vi(t,n),l={x:e(i.x,r.x),y:e(i.y,r.y)};return Nl(l,ii)?null:l}})(),Zb=({max:e,current:t,change:r})=>{const n={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},i=bN(r),l=P1({max:n,current:t,change:i});return!l||i.x!==0&&l.x===0||i.y!==0&&l.y===0},O1=(e,t)=>Zb({current:e.scroll.current,max:e.scroll.max,change:t}),yN=(e,t)=>{if(!O1(e,t))return null;const r=e.scroll.max,n=e.scroll.current;return P1({current:n,max:r,change:t})},F1=(e,t)=>{const r=e.frame;return r?Zb({current:r.scroll.current,max:r.scroll.max,change:t}):!1},vN=(e,t)=>{const r=e.frame;return!r||!F1(e,t)?null:P1({current:r.scroll.current,max:r.scroll.max,change:t})};var wN=({viewport:e,subject:t,center:r,dragStartTime:n,shouldUseTimeDampening:i,getAutoScrollerOptions:l})=>{const u=Yb({dragStartTime:n,container:e.frame,subject:t,center:r,shouldUseTimeDampening:i,getAutoScrollerOptions:l});return u&&O1(e,u)?u:null},AN=({droppable:e,subject:t,center:r,dragStartTime:n,shouldUseTimeDampening:i,getAutoScrollerOptions:l})=>{const u=e.frame;if(!u)return null;const h=Yb({dragStartTime:n,container:u.pageMarginBox,subject:t,center:r,shouldUseTimeDampening:i,getAutoScrollerOptions:l});return h&&F1(e,h)?h:null},V2=({state:e,dragStartTime:t,shouldUseTimeDampening:r,scrollWindow:n,scrollDroppable:i,getAutoScrollerOptions:l})=>{const u=e.current.page.borderBoxCenter,p=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const b=e.viewport,w=wN({dragStartTime:t,viewport:b,subject:p,center:u,shouldUseTimeDampening:r,getAutoScrollerOptions:l});if(w){n(w);return}}const g=hN({center:u,destination:va(e.impact),droppables:e.dimensions.droppables});if(!g)return;const x=AN({dragStartTime:t,droppable:g,subject:p,center:u,shouldUseTimeDampening:r,getAutoScrollerOptions:l});x&&i(g.descriptor.id,x)},TN=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:r=()=>Tu})=>{const n=bu(e),i=bu(t);let l=null;const u=g=>{l||Dt();const{shouldUseTimeDampening:x,dragStartTime:b}=l;V2({state:g,scrollWindow:n,scrollDroppable:i,dragStartTime:b,shouldUseTimeDampening:x,getAutoScrollerOptions:r})};return{start:g=>{l&&Dt();const x=Date.now();let b=!1;const w=()=>{b=!0};V2({state:g,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:w,scrollDroppable:w,getAutoScrollerOptions:r}),l={dragStartTime:x,shouldUseTimeDampening:b},b&&u(g)},stop:()=>{l&&(n.cancel(),i.cancel(),l=null)},scroll:u}},CN=({move:e,scrollDroppable:t,scrollWindow:r})=>{const n=(h,p)=>{const g=vi(h.current.client.selection,p);e({client:g})},i=(h,p)=>{if(!F1(h,p))return p;const g=vN(h,p);if(!g)return t(h.descriptor.id,p),null;const x=xa(p,g);return t(h.descriptor.id,x),xa(p,x)},l=(h,p,g)=>{if(!h||!O1(p,g))return g;const x=yN(p,g);if(!x)return r(g),null;const b=xa(g,x);return r(b),xa(g,b)};return h=>{const p=h.scrollJumpRequest;if(!p)return;const g=va(h.impact);g||Dt();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)}},SN=({scrollDroppable:e,scrollWindow:t,move:r,getAutoScrollerOptions:n})=>{const i=TN({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:n}),l=CN({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 n0="data-rfd",s0=(()=>{const e=`${n0}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),Gp=(()=>{const e=`${n0}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),_N=(()=>{const e=`${n0}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),q2={contextId:`${n0}-scroll-container-context-id`},LN=e=>t=>`[${t}="${e}"]`,j0=(e,t)=>e.map(r=>{const n=r.styles[t];return n?`${r.selector} { ${n} }`:""}).join(" "),kN="pointer-events: none;";var IN=e=>{const t=LN(e),r=(()=>{const h=`
|
|
110
|
-
cursor: -webkit-grab;
|
|
111
|
-
cursor: grab;
|
|
112
|
-
`;return{selector:t(s0.contextId),styles:{always:`
|
|
113
|
-
-webkit-touch-callout: none;
|
|
114
|
-
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
|
115
|
-
touch-action: manipulation;
|
|
116
|
-
`,resting:h,dragging:kN,dropAnimating:h}}})(),n=(()=>{const h=`
|
|
117
|
-
transition: ${ou.outOfTheWay};
|
|
118
|
-
`;return{selector:t(Gp.contextId),styles:{dragging:h,dropAnimating:h,userCancel:h}}})(),i={selector:t(_N.contextId),styles:{always:"overflow-anchor: none;"}},u=[n,r,i,{selector:"body",styles:{dragging:`
|
|
119
|
-
cursor: grabbing;
|
|
120
|
-
cursor: -webkit-grabbing;
|
|
121
|
-
user-select: none;
|
|
122
|
-
-webkit-user-select: none;
|
|
123
|
-
-moz-user-select: none;
|
|
124
|
-
-ms-user-select: none;
|
|
125
|
-
overflow-anchor: none;
|
|
126
|
-
`}}];return{always:j0(u,"always"),resting:j0(u,"resting"),dragging:j0(u,"dragging"),dropAnimating:j0(u,"dropAnimating"),userCancel:j0(u,"userCancel")}};const wa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?y.useLayoutEffect:y.useEffect,Wf=()=>{const e=document.querySelector("head");return e||Dt(),e},Y2=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function EN(e,t){const r=bn(()=>IN(e),[e]),n=y.useRef(null),i=y.useRef(null),l=wr(si(b=>{const w=i.current;w||Dt(),w.textContent=b}),[]),u=wr(b=>{const w=n.current;w||Dt(),w.textContent=b},[]);wa(()=>{!n.current&&!i.current||Dt();const b=Y2(t),w=Y2(t);return n.current=b,i.current=w,b.setAttribute(`${n0}-always`,e),w.setAttribute(`${n0}-dynamic`,e),Wf().appendChild(b),Wf().appendChild(w),u(r.always),l(r.resting),()=>{const A=k=>{const I=k.current;I||Dt(),Wf().removeChild(I),k.current=null};A(n),A(i)}},[t,u,l,r.always,r.resting,e]);const h=wr(()=>l(r.dragging),[l,r.dragging]),p=wr(b=>{if(b==="DROP"){l(r.dropAnimating);return}l(r.userCancel)},[l,r.dropAnimating,r.userCancel]),g=wr(()=>{i.current&&l(r.resting)},[l,r.resting]);return bn(()=>({dragging:h,dropping:p,resting:g}),[h,p,g])}function Kb(e,t){return Array.from(e.querySelectorAll(t))}var Xb=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function kh(e){return e instanceof Xb(e).HTMLElement}function RN(e,t){const r=`[${s0.contextId}="${e}"]`,n=Kb(document,r);if(!n.length)return null;const i=n.find(l=>l.getAttribute(s0.draggableId)===t);return!i||!kh(i)?null:i}function NN(e){const t=y.useRef({}),r=y.useRef(null),n=y.useRef(null),i=y.useRef(!1),l=wr(function(w,A){const k={id:w,focus:A};return t.current[w]=k,function(){const N=t.current;N[w]!==k&&delete N[w]}},[]),u=wr(function(w){const A=RN(e,w);A&&A!==document.activeElement&&A.focus()},[e]),h=wr(function(w,A){r.current===w&&(r.current=A)},[]),p=wr(function(){n.current||i.current&&(n.current=requestAnimationFrame(()=>{n.current=null;const w=r.current;w&&u(w)}))},[u]),g=wr(function(w){r.current=null;const A=document.activeElement;A&&A.getAttribute(s0.draggableId)===w&&(r.current=w)},[]);return wa(()=>(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 MN(){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||Dt(),w}const u={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||Dt(),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:u,droppable:g,subscribe:r,clean:x}}function DN(){const e=bn(MN,[]);return y.useEffect(()=>function(){e.clean()},[e]),e}var U1=S.createContext(null),ch=()=>{const e=document.body;return e||Dt(),e};const BN={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},QN=e=>`rfd-announcement-${e}`;function jN(e){const t=bn(()=>QN(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"),ih(l.style,BN),ch().appendChild(l),function(){setTimeout(function(){const p=ch();p.contains(l)&&p.removeChild(l),l===r.current&&(r.current=null)})}},[t]),wr(i=>{const l=r.current;if(l){l.textContent=i;return}},[])}const PN={separator:"::"};function $1(e,t=PN){const r=S.useId();return bn(()=>`${e}${t.separator}${r}`,[t.separator,e,r])}function ON({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function FN({contextId:e,text:t}){const r=$1("hidden-text",{separator:"-"}),n=bn(()=>ON({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",ch().appendChild(l),function(){const h=ch();h.contains(l)&&h.removeChild(l)}},[n,t]),n}var Ih=S.createContext(null);function Jb(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),t}function UN(){let e=null;function t(){return!!e}function r(u){return u===e}function n(u){e&&Dt();const h={abandon:u};return e=h,h}function i(){e||Dt(),e=null}function l(){e&&(e.abandon(),i())}return{isClaimed:t,isActive:r,claim:n,release:i,tryAbandon:l}}function Cu(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const $N=9,zN=13,z1=27,e6=32,HN=33,WN=34,GN=35,VN=36,qN=37,YN=38,ZN=39,KN=40,XN={[zN]:!0,[$N]:!0};var t6=e=>{XN[e.keyCode]&&e.preventDefault()};const Eh=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(n=>`on${n}`in document)||e})(),r6=0,Z2=5;function JN(e,t){return Math.abs(t.x-e.x)>=Z2||Math.abs(t.y-e.y)>=Z2}const K2={type:"IDLE"};function eM({cancel:e,completed:t,getPhase:r,setPhase:n}){return[{eventName:"mousemove",fn:i=>{const{button:l,clientX:u,clientY:h}=i;if(l!==r6)return;const p={x:u,y:h},g=r();if(g.type==="DRAGGING"){i.preventDefault(),g.actions.move(p);return}g.type!=="PENDING"&&Dt();const x=g.point;if(!JN(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===z1){i.preventDefault(),e();return}t6(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"&&Dt(),l.actions.shouldRespectForcePress()){e();return}i.preventDefault()}},{eventName:Eh,fn:e}]}function tM(e){const t=y.useRef(K2),r=y.useRef(Rl),n=bn(()=>({eventName:"mousedown",fn:function(b){if(b.defaultPrevented||b.button!==r6||b.ctrlKey||b.metaKey||b.shiftKey||b.altKey)return;const w=e.findClosestDraggableId(b);if(!w)return;const A=e.tryGetLock(w,u,{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=wr(function(){const b={passive:!1,capture:!0};r.current=Wa(window,[i,n],b)},[i,n]),u=wr(()=>{t.current.type!=="IDLE"&&(t.current=K2,r.current(),l())},[l]),h=wr(()=>{const x=t.current;u(),x.type==="DRAGGING"&&x.actions.cancel({shouldBlockNextClick:!0}),x.type==="PENDING"&&x.actions.abort()},[u]),p=wr(function(){const b={capture:!0,passive:!1},w=eM({cancel:h,completed:u,getPhase:()=>t.current,setPhase:A=>{t.current=A}});r.current=Wa(window,w,b)},[h,u]),g=wr(function(b,w){t.current.type!=="IDLE"&&Dt(),t.current={type:"PENDING",point:w,actions:b},p()},[p]);wa(function(){return l(),function(){r.current()}},[l])}function rM(){}const nM={[WN]:!0,[HN]:!0,[VN]:!0,[GN]:!0};function sM(e,t){function r(){t(),e.cancel()}function n(){t(),e.drop()}return[{eventName:"keydown",fn:i=>{if(i.keyCode===z1){i.preventDefault(),r();return}if(i.keyCode===e6){i.preventDefault(),n();return}if(i.keyCode===KN){i.preventDefault(),e.moveDown();return}if(i.keyCode===YN){i.preventDefault(),e.moveUp();return}if(i.keyCode===ZN){i.preventDefault(),e.moveRight();return}if(i.keyCode===qN){i.preventDefault(),e.moveLeft();return}if(nM[i.keyCode]){i.preventDefault();return}t6(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:Eh,fn:r}]}function iM(e){const t=y.useRef(rM),r=bn(()=>({eventName:"keydown",fn:function(l){if(l.defaultPrevented||l.keyCode!==e6)return;const u=e.findClosestDraggableId(l);if(!u)return;const h=e.tryGetLock(u,x,{sourceEvent:l});if(!h)return;l.preventDefault();let p=!0;const g=h.snapLift();t.current();function x(){p||Dt(),p=!1,t.current(),n()}t.current=Wa(window,sM(g,x),{capture:!0,passive:!1})}}),[e]),n=wr(function(){const l={passive:!1,capture:!0};t.current=Wa(window,[r],l)},[r]);wa(function(){return n(),function(){t.current()}},[n])}const Gf={type:"IDLE"},aM=120,oM=.15;function lM({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===z1&&r.preventDefault(),e()}},{eventName:Eh,fn:e}]}function cM({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:u}=n.touches[0],h={x:l,y:u};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"&&Dt();const l=n.touches[0];if(!l||!(l.force>=oM))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:Eh,fn:e}]}function uM(e){const t=y.useRef(Gf),r=y.useRef(Rl),n=wr(function(){return t.current},[]),i=wr(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 I=e.tryGetLock(k,h,{sourceEvent:A});if(!I)return;const N=A.touches[0],{clientX:R,clientY:D}=N,O={x:R,y:D};r.current(),b(I,O)}}),[e]),u=wr(function(){const A={capture:!0,passive:!1};r.current=Wa(window,[l],A)},[l]),h=wr(()=>{const w=t.current;w.type!=="IDLE"&&(w.type==="PENDING"&&clearTimeout(w.longPressTimerId),i(Gf),r.current(),u())},[u,i]),p=wr(()=>{const w=t.current;h(),w.type==="DRAGGING"&&w.actions.cancel({shouldBlockNextClick:!0}),w.type==="PENDING"&&w.actions.abort()},[h]),g=wr(function(){const A={capture:!0,passive:!1},k={cancel:p,completed:h,getPhase:n},I=Wa(window,cM(k),A),N=Wa(window,lM(k),A);r.current=function(){I(),N()}},[p,n,h]),x=wr(function(){const A=n();A.type!=="PENDING"&&Dt();const k=A.actions.fluidLift(A.point);i({type:"DRAGGING",actions:k,hasMoved:!1})},[n,i]),b=wr(function(A,k){n().type!=="IDLE"&&Dt();const I=setTimeout(x,aM);i({type:"PENDING",point:k,actions:A,longPressTimerId:I}),g()},[g,n,i,x]);wa(function(){return u(),function(){r.current();const k=n();k.type==="PENDING"&&(clearTimeout(k.longPressTimerId),i(Gf))}},[n,u,i]),wa(function(){return Wa(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const dM=["input","button","textarea","select","option","optgroup","video","audio"];function n6(e,t){if(t==null)return!1;if(dM.includes(t.tagName.toLowerCase()))return!0;const n=t.getAttribute("contenteditable");return n==="true"||n===""?!0:t===e?!1:n6(e,t.parentElement)}function hM(e,t){const r=t.target;return kh(r)?n6(e,r):!1}var fM=e=>mo(e.getBoundingClientRect()).center;function pM(e){return e instanceof Xb(e).Element}const mM=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(n=>n in Element.prototype)||e})();function s6(e,t){return e==null?null:e[mM](t)?e:s6(e.parentElement,t)}function gM(e,t){return e.closest?e.closest(t):s6(e,t)}function xM(e){return`[${s0.contextId}="${e}"]`}function bM(e,t){const r=t.target;if(!pM(r))return null;const n=xM(e),i=gM(r,n);return!i||!kh(i)?null:i}function yM(e,t){const r=bM(e,t);return r?r.getAttribute(s0.draggableId):null}function vM(e,t){const r=`[${Gp.contextId}="${e}"]`,i=Kb(document,r).find(l=>l.getAttribute(Gp.id)===t);return!i||!kh(i)?null:i}function wM(e){e.preventDefault()}function yd({expected:e,phase:t,isLockActive:r,shouldWarn:n}){return!(!r()||e!==t)}function i6({lockAPI:e,store:t,registry:r,draggableId:n}){if(e.isClaimed())return!1;const i=r.draggable.findById(n);return!(!i||!i.options.isEnabled||!Vb(t.getState(),n))}function AM({lockAPI:e,contextId:t,store:r,registry:n,draggableId:i,forceSensorStop:l,sourceEvent:u}){if(!i6({lockAPI:e,store:r,registry:n,draggableId:i}))return null;const p=n.draggable.getById(i),g=vM(t,p.descriptor.id);if(!g||u&&!p.options.canDragInteractiveElements&&hM(g,u))return null;const x=e.claim(l||Rl);let b="PRE_DRAG";function w(){return p.options.shouldRespectForcePress}function A(){return e.isActive(x)}function k(Y,U){yd({expected:Y,phase:b,isLockActive:A,shouldWarn:!0})&&r.dispatch(U())}const I=k.bind(null,"DRAGGING");function N(Y){function U(){e.release(),b="COMPLETED"}b!=="PRE_DRAG"&&(U(),Dt()),r.dispatch(gR(Y.liftActionArgs)),b="DRAGGING";function V(me,Je={shouldBlockNextClick:!1}){if(Y.cleanup(),Je.shouldBlockNextClick){const ve=Wa(window,[{eventName:"click",fn:wM,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(ve)}U(),r.dispatch(Ob({reason:me}))}return{isActive:()=>yd({expected:"DRAGGING",phase:b,isLockActive:A,shouldWarn:!1}),shouldRespectForcePress:w,drop:me=>V("DROP",me),cancel:me=>V("CANCEL",me),...Y.actions}}function R(Y){const U=bu(me=>{I(()=>Pb({client:me}))});return{...N({liftActionArgs:{id:i,clientSelection:Y,movementMode:"FLUID"},cleanup:()=>U.cancel(),actions:{move:U}}),move:U}}function D(){const Y={moveUp:()=>I(SR),moveRight:()=>I(LR),moveDown:()=>I(_R),moveLeft:()=>I(kR)};return N({liftActionArgs:{id:i,clientSelection:fM(g),movementMode:"SNAP"},cleanup:Rl,actions:Y})}function O(){yd({expected:"PRE_DRAG",phase:b,isLockActive:A,shouldWarn:!0})&&e.release()}return{isActive:()=>yd({expected:"PRE_DRAG",phase:b,isLockActive:A,shouldWarn:!1}),shouldRespectForcePress:w,fluidLift:R,snapLift:D,abort:O}}const TM=[tM,iM,uM];function CM({contextId:e,store:t,registry:r,customSensors:n,enableDefaultSensors:i}){const l=[...i?TM:[],...n||[]],u=y.useState(()=>UN())[0],h=wr(function(N,R){Cu(N)&&!Cu(R)&&u.tryAbandon()},[u]);wa(function(){let N=t.getState();return t.subscribe(()=>{const D=t.getState();h(N,D),N=D})},[u,t,h]),wa(()=>u.tryAbandon,[u.tryAbandon]);const p=wr(I=>i6({lockAPI:u,registry:r,store:t,draggableId:I}),[u,r,t]),g=wr((I,N,R)=>AM({lockAPI:u,registry:r,contextId:e,store:t,draggableId:I,forceSensorStop:N||null,sourceEvent:R&&R.sourceEvent?R.sourceEvent:null}),[e,u,r,t]),x=wr(I=>yM(e,I),[e]),b=wr(I=>{const N=r.draggable.findById(I);return N?N.options:null},[r.draggable]),w=wr(function(){u.isClaimed()&&(u.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(D1()))},[u,t]),A=wr(()=>u.isClaimed(),[u]),k=bn(()=>({canGetLock:p,tryGetLock:g,findClosestDraggableId:x,findOptionsForDraggable:b,tryReleaseLock:w,isLockClaimed:A}),[p,g,x,b,w,A]);for(let I=0;I<l.length;I++)l[I](k)}const SM=e=>({onBeforeCapture:t=>{const r=()=>{e.onBeforeCapture&&e.onBeforeCapture(t)};na.flushSync(r)},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),_M=e=>({...Tu,...e.autoScrollerOptions,durationDampening:{...Tu.durationDampening,...e.autoScrollerOptions}});function P0(e){return e.current||Dt(),e.current}function LM(e){const{contextId:t,setCallbacks:r,sensors:n,nonce:i,dragHandleUsageInstructions:l}=e,u=y.useRef(null),h=Jb(e),p=wr(()=>SM(h.current),[h]),g=wr(()=>_M(h.current),[h]),x=jN(t),b=FN({contextId:t,text:l}),w=EN(t,i),A=wr(ve=>{P0(u).dispatch(ve)},[]),k=bn(()=>T2({publishWhileDragging:bR,updateDroppableScroll:vR,updateDroppableIsEnabled:wR,updateDroppableIsCombineEnabled:AR,collectionStarting:yR},A),[A]),I=DN(),N=bn(()=>lN(I,k),[I,k]),R=bn(()=>SN({scrollWindow:cN,scrollDroppable:N.scrollDroppable,getAutoScrollerOptions:g,...T2({move:Pb},A)}),[N.scrollDroppable,A,g]),D=NN(t),O=bn(()=>sN({announce:x,autoScroller:R,dimensionMarshal:N,focusMarshal:D,getResponders:p,styleMarshal:w}),[x,R,N,D,p,w]);u.current=O;const q=wr(()=>{const ve=P0(u);ve.getState().phase!=="IDLE"&&ve.dispatch(D1())},[]),Y=wr(()=>{const ve=P0(u).getState();return ve.phase==="DROP_ANIMATING"?!0:ve.phase==="IDLE"?!1:ve.isDragging},[]),U=bn(()=>({isDragging:Y,tryAbort:q}),[Y,q]);r(U);const V=wr(ve=>Vb(P0(u).getState(),ve),[]),me=wr(()=>Kl(P0(u).getState()),[]),Je=bn(()=>({marshal:N,focus:D,contextId:t,canLift:V,isMovementAllowed:me,dragHandleUsageInstructionsId:b,registry:I}),[t,N,b,D,V,me,I]);return CM({contextId:t,store:O,registry:I,customSensors:n||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),y.useEffect(()=>q,[q]),S.createElement(Ih.Provider,{value:Je},S.createElement(XI,{context:U1,store:O},e.children))}function kM(){return S.useId()}function uh(e){const t=kM(),r=e.dragHandleUsageInstructions||zd.dragHandleUsageInstructions;return S.createElement(iE,null,n=>S.createElement(LM,{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 X2={dragging:5e3,dropAnimating:4500},IM=(e,t)=>t?ou.drop(t.duration):e?ou.snap:ou.fluid,EM=(e,t)=>{if(e)return t?Au.opacity.drop:Au.opacity.combining},RM=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function NM(e){const r=e.dimension.client,{offset:n,combineWith:i,dropping:l}=e,u=!!i,h=RM(e),p=!!l,g=p?Hp.drop(n,u):Hp.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:IM(h,l),transform:g,opacity:EM(u,p),zIndex:p?X2.dropAnimating:X2.dragging,pointerEvents:"none"}}function MM(e){return{transform:Hp.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function DM(e){return e.type==="DRAGGING"?NM(e):MM(e)}function BM(e,t,r=ii){const n=window.getComputedStyle(t),i=t.getBoundingClientRect(),l=hb(i,n),u=sh(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:u}}function QM(e){const t=$1("draggable"),{descriptor:r,registry:n,getDraggableRef:i,canDragInteractiveElements:l,shouldRespectForcePress:u,isEnabled:h}=e,p=bn(()=>({canDragInteractiveElements:l,shouldRespectForcePress:u,isEnabled:h}),[l,h,u]),g=wr(A=>{const k=i();return k||Dt(),BM(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);wa(()=>(n.draggable.register(b.current),()=>n.draggable.unregister(b.current)),[n.draggable]),wa(()=>{if(w.current){w.current=!1;return}const A=b.current;b.current=x,n.draggable.update(x,A)},[x,n.draggable])}var H1=S.createContext(null);function dh(e){const t=y.useContext(e);return t||Dt(),t}function jM(e){e.preventDefault()}const PM=e=>{const t=y.useRef(null),r=wr((U=null)=>{t.current=U},[]),n=wr(()=>t.current,[]),{contextId:i,dragHandleUsageInstructionsId:l,registry:u}=dh(Ih),{type:h,droppableId:p}=dh(H1),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:I,mapped:N,dropAnimationFinished:R}=e;if(!I){const U=bn(()=>({descriptor:g,registry:u,getDraggableRef:n,canDragInteractiveElements:k,shouldRespectForcePress:A,isEnabled:w}),[g,u,n,k,A,w]);QM(U)}const D=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:jM}:null,[i,l,b,w]),O=wr(U=>{N.type==="DRAGGING"&&N.dropping&&U.propertyName==="transform"&&na.flushSync(R)},[R,N]),q=bn(()=>{const U=DM(N),V=N.type==="DRAGGING"&&N.dropping?O:void 0;return{innerRef:r,draggableProps:{"data-rfd-draggable-context-id":i,"data-rfd-draggable-id":b,style:U,onTransitionEnd:V},dragHandleProps:D}},[i,D,b,N,O,r]),Y=bn(()=>({draggableId:g.id,type:g.type,source:{index:g.index,droppableId:g.droppableId}}),[g.droppableId,g.id,g.index,g.type]);return S.createElement(S.Fragment,null,x(q,N.snapshot,Y))};var a6=(e,t)=>e===t,o6=e=>{const{combine:t,destination:r}=e;return r?r.droppableId:t?t.droppableId:null};const OM=e=>e.combine?e.combine.draggableId:null,FM=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function UM(){const e=si((i,l)=>({x:i,y:l})),t=si((i,l,u=null,h=null,p=null)=>({isDragging:!0,isClone:l,isDropAnimating:!!p,dropAnimation:p,mode:i,draggingOver:u,combineWith:h,combineTargetFor:null})),r=si((i,l,u,h,p=null,g=null,x=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:p,combineWith:g,mode:l,offset:i,dimension:u,forceShouldAnimate:x,snapshot:t(l,h,p,g,null)}}));return(i,l)=>{if(Cu(i)){if(i.critical.draggable.id!==l.draggableId)return null;const u=i.current.client.offset,h=i.dimensions.draggables[l.draggableId],p=va(i.impact),g=FM(i.impact),x=i.forceShouldAnimate;return r(e(u.x,u.y),i.movementMode,h,l.isClone,p,g,x)}if(i.phase==="DROP_ANIMATING"){const u=i.completed;if(u.result.draggableId!==l.draggableId)return null;const h=l.isClone,p=i.dimensions.draggables[l.draggableId],g=u.result,x=g.mode,b=o6(g),w=OM(g),k={duration:i.dropDuration,curve:Q1.drop,moveTo:i.newHomeClientOffset,opacity:w?Au.opacity.drop:null,scale:w?Au.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 $M={mapped:{type:"SECONDARY",offset:ii,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:l6(null)}};function zM(){const e=si((u,h)=>({x:u,y:h})),t=si(l6),r=si((u,h=null,p)=>({mapped:{type:"SECONDARY",offset:u,combineTargetFor:h,shouldAnimateDisplacement:p,snapshot:t(h)}})),n=u=>u?r(ii,u,!0):null,i=(u,h,p,g)=>{const x=p.displaced.visible[u],b=!!(g.inVirtualList&&g.effected[u]),w=Sh(p),A=w&&w.draggableId===u?h:null;if(!x){if(!b)return n(A);if(p.displaced.invisible[u])return null;const N=c0(g.displacedBy.point),R=e(N.x,N.y);return r(R,A,!0)}if(b)return n(A);const k=p.displacedBy.point,I=e(k.x,k.y);return r(I,A,x.shouldAnimate)};return(u,h)=>{if(Cu(u))return u.critical.draggable.id===h.draggableId?null:i(h.draggableId,u.critical.draggable.id,u.impact,u.afterCritical);if(u.phase==="DROP_ANIMATING"){const p=u.completed;return p.result.draggableId===h.draggableId?null:i(h.draggableId,p.result.draggableId,p.impact,p.afterCritical)}return null}}const HM=()=>{const e=UM(),t=zM();return(n,i)=>e(n,i)||t(n,i)||$M},WM={dropAnimationFinished:Fb},GM=db(HM,WM,null,{context:U1,areStatePropsEqual:a6})(PM);function c6(e){return dh(H1).isUsingCloneFor===e.draggableId&&!e.isClone?null:S.createElement(GM,e)}function sl(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,r=!!e.disableInteractiveElementBlocking,n=!!e.shouldRespectForcePress;return S.createElement(c6,ih({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:r,shouldRespectForcePress:n}))}const u6=e=>t=>e===t,VM=u6("scroll"),qM=u6("auto"),J2=(e,t)=>t(e.overflowX)||t(e.overflowY),YM=e=>{const t=window.getComputedStyle(e),r={overflowX:t.overflowX,overflowY:t.overflowY};return J2(r,VM)||J2(r,qM)},ZM=()=>!1,d6=e=>e==null?null:e===document.body?ZM()?e:null:e===document.documentElement?null:YM(e)?e:d6(e.parentElement);var Vp=e=>({x:e.scrollLeft,y:e.scrollTop});const h6=e=>e?window.getComputedStyle(e).position==="fixed"?!0:h6(e.parentElement):!1;var KM=e=>{const t=d6(e),r=h6(e);return{closestScrollable:t,isFixedOnPage:r}},XM=({descriptor:e,isEnabled:t,isCombineEnabled:r,isFixedOnPage:n,direction:i,client:l,page:u,closest:h})=>{const p=(()=>{if(!h)return null;const{scrollSize:w,client:A}=h,k=Hb({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:ii,displacement:ii}}}})(),g=i==="vertical"?I1:Tb,x=r0({page:u,withPlaceholder:null,axis:g,frame:p});return{descriptor:e,isCombineEnabled:r,isFixedOnPage:n,axis:g,isEnabled:t,client:l,page:u,frame:p,subject:x}};const JM=(e,t)=>{const r=fb(e);if(!t||e!==t)return r;const n=r.paddingBox.top-t.scrollTop,i=r.paddingBox.left-t.scrollLeft,l=n+t.scrollHeight,u=i+t.scrollWidth,p=S1({top:n,right:u,bottom:l,left:i},r.border);return _1({borderBox:p,margin:r.margin,border:r.border,padding:r.padding})};var eD=({ref:e,descriptor:t,env:r,windowScroll:n,direction:i,isDropDisabled:l,isCombineEnabled:u,shouldClipSubject:h})=>{const p=r.closestScrollable,g=JM(e,p),x=sh(g,n),b=(()=>{if(!p)return null;const A=fb(p),k={scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth};return{client:A,page:sh(A,n),scroll:Vp(p),scrollSize:k,shouldClipSubject:h}})();return XM({descriptor:t,isEnabled:!l,isCombineEnabled:u,isFixedOnPage:r.isFixedOnPage,direction:i,client:g,page:x,closest:b})};const tD={passive:!1},rD={passive:!0};var e5=e=>e.shouldPublishImmediately?tD:rD;const vd=e=>e&&e.env.closestScrollable||null;function nD(e){const t=y.useRef(null),r=dh(Ih),n=$1("droppable"),{registry:i,marshal:l}=r,u=Jb(e),h=bn(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),p=y.useRef(h),g=bn(()=>si((q,Y)=>{t.current||Dt();const U={x:q,y:Y};l.updateDroppableScroll(h.id,U)}),[h.id,l]),x=wr(()=>{const q=t.current;return!q||!q.env.closestScrollable?ii:Vp(q.env.closestScrollable)},[]),b=wr(()=>{const q=x();g(q.x,q.y)},[x,g]),w=bn(()=>bu(b),[b]),A=wr(()=>{const q=t.current,Y=vd(q);if(q&&Y||Dt(),q.scrollOptions.shouldPublishImmediately){b();return}w()},[w,b]),k=wr((q,Y)=>{t.current&&Dt();const U=u.current,V=U.getDroppableRef();V||Dt();const me=KM(V),Je={ref:V,descriptor:h,env:me,scrollOptions:Y};t.current=Je;const ve=eD({ref:V,descriptor:h,env:me,windowScroll:q,direction:U.direction,isDropDisabled:U.isDropDisabled,isCombineEnabled:U.isCombineEnabled,shouldClipSubject:!U.ignoreContainerClipping}),_e=me.closestScrollable;return _e&&(_e.setAttribute(q2.contextId,r.contextId),_e.addEventListener("scroll",A,e5(Je.scrollOptions))),ve},[r.contextId,h,A,u]),I=wr(()=>{const q=t.current,Y=vd(q);return q&&Y||Dt(),Vp(Y)},[]),N=wr(()=>{const q=t.current;q||Dt();const Y=vd(q);t.current=null,Y&&(w.cancel(),Y.removeAttribute(q2.contextId),Y.removeEventListener("scroll",A,e5(q.scrollOptions)))},[A,w]),R=wr(q=>{const Y=t.current;Y||Dt();const U=vd(Y);U||Dt(),U.scrollTop+=q.y,U.scrollLeft+=q.x},[]),D=bn(()=>({getDimensionAndWatchScroll:k,getScrollWhileDragging:I,dragStopped:N,scroll:R}),[N,k,I,R]),O=bn(()=>({uniqueId:n,descriptor:h,callbacks:D}),[D,h,n]);wa(()=>(p.current=O.descriptor,i.droppable.register(O),()=>{t.current&&N(),i.droppable.unregister(O)}),[D,h,N,O,l,i.droppable]),wa(()=>{t.current&&l.updateDroppableIsEnabled(p.current.id,!e.isDropDisabled)},[e.isDropDisabled,l]),wa(()=>{t.current&&l.updateDroppableIsCombineEnabled(p.current.id,e.isCombineEnabled)},[e.isCombineEnabled,l])}function Vf(){}const t5={width:0,height:0,margin:hE},sD=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>e||r==="close"?t5:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},iD=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>{const n=sD({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"?ou.placeholder:null}},aD=e=>{const t=y.useRef(null),r=wr(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:n,onTransitionEnd:i,onClose:l,contextId:u}=e,[h,p]=y.useState(e.animate==="open");y.useEffect(()=>h?n!=="open"?(r(),p(!1),Vf):t.current?Vf:(t.current=setTimeout(()=>{t.current=null,p(!1)}),r):Vf,[n,h,r]);const g=wr(b=>{b.propertyName==="height"&&(i(),n==="close"&&l())},[n,l,i]),x=iD({isAnimatingOpenOnMount:h,animate:e.animate,placeholder:e.placeholder});return S.createElement(e.placeholder.tagName,{style:x,"data-rfd-placeholder-context-id":u,onTransitionEnd:g,ref:e.innerRef})};var oD=S.memo(aD);class lD extends S.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 cD=e=>{const t=y.useContext(Ih);t||Dt();const{contextId:r,isMovementAllowed:n}=t,i=y.useRef(null),l=y.useRef(null),{children:u,droppableId:h,type:p,mode:g,direction:x,ignoreContainerClipping:b,isDropDisabled:w,isCombineEnabled:A,snapshot:k,useClone:I,updateViewportMaxScroll:N,getContainerForClone:R}=e,D=wr(()=>i.current,[]),O=wr((_e=null)=>{i.current=_e},[]);wr(()=>l.current,[]);const q=wr((_e=null)=>{l.current=_e},[]),Y=wr(()=>{n()&&N({maxScroll:Gb()})},[n,N]);nD({droppableId:h,type:p,mode:g,direction:x,isDropDisabled:w,isCombineEnabled:A,ignoreContainerClipping:b,getDroppableRef:D});const U=bn(()=>S.createElement(lD,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:_e,data:Ze,animate:Ve})=>S.createElement(oD,{placeholder:Ze,onClose:_e,innerRef:q,animate:Ve,contextId:r,onTransitionEnd:Y})),[r,Y,e.placeholder,e.shouldAnimatePlaceholder,q]),V=bn(()=>({innerRef:O,placeholder:U,droppableProps:{"data-rfd-droppable-id":h,"data-rfd-droppable-context-id":r}}),[r,h,U,O]),me=I?I.dragging.draggableId:null,Je=bn(()=>({droppableId:h,type:p,isUsingCloneFor:me}),[h,me,p]);function ve(){if(!I)return null;const{dragging:_e,render:Ze}=I,Ve=S.createElement(c6,{draggableId:_e.draggableId,index:_e.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(ce,ke)=>Ze(ce,ke,_e));return J8.createPortal(Ve,R())}return S.createElement(H1.Provider,{value:Je},u(V,k),ve())};function uD(){return document.body||Dt(),document.body}const r5={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:uD},f6=e=>{let t={...e},r;for(r in r5)e[r]===void 0&&(t={...t,[r]:r5[r]});return t},qf=(e,t)=>e===t.droppable.type,n5=(e,t)=>t.draggables[e.draggable.id],dD=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},r=si(l=>({draggableId:l.id,type:l.type,source:{index:l.index,droppableId:l.droppableId}})),n=si((l,u,h,p,g,x)=>{const b=g.descriptor.id;if(g.descriptor.droppableId===l){const k=x?{render:x,dragging:r(g.descriptor)}:null,I={isDraggingOver:h,draggingOverWith:h?b:null,draggingFromThisWith:b,isUsingPlaceholder:!0};return{placeholder:g.placeholder,shouldAnimatePlaceholder:!1,snapshot:I,useClone:k}}if(!u)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,u)=>{const h=f6(u),p=h.droppableId,g=h.type,x=!h.isDropDisabled,b=h.renderClone;if(Cu(l)){const w=l.critical;if(!qf(g,w))return t;const A=n5(w,l.dimensions),k=va(l.impact)===p;return n(p,x,k,k,A,b)}if(l.phase==="DROP_ANIMATING"){const w=l.completed;if(!qf(g,w.critical))return t;const A=n5(w.critical,l.dimensions);return n(p,x,o6(w.result)===p,va(w.impact)===p,A,b)}if(l.phase==="IDLE"&&l.completed&&!l.shouldFlush){const w=l.completed;if(!qf(g,w.critical))return t;const A=va(w.impact)===p,k=!!(w.impact.at&&w.impact.at.type==="COMBINE"),I=w.critical.droppable.id===p;return A?k?e:t:I?e:t}return t}},hD={updateViewportMaxScroll:CR},il=db(dD,hD,(e,t,r)=>({...f6(r),...e,...t}),{context:U1,areStatePropsEqual:a6})(cD);function fD(){if(typeof window>"u")return Yc(void 0);try{const e=window.localStorage.getItem(Mp);return Yc(e?JSON.parse(e):void 0)}catch{return Yc(void 0)}}function Yf(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(Mp),r=t?JSON.parse(t):{},n=Yc({...r,...e});window.localStorage.setItem(Mp,JSON.stringify(n))}catch{}}function pD(){const[e,t]=S.useState(fD);S.useEffect(()=>{Yf(e)},[e]);const r=S.useCallback(i=>{t(l=>{const u=Yc({...l,...i});return Yf(u),u})},[]),n=S.useCallback(()=>{const i=Yc(void 0);t(i),Yf(i)},[]);return{terminalSettings:e,updateTerminalSettings:r,resetTerminalSettings:n}}const qp="termdock-settings";function mD(e){return e==="shell"||e==="tmux"}function gD(){if(typeof window>"u")return{mode:"shell",tmuxName:"",userSelectedMode:null};try{const e=window.localStorage.getItem(qp);if(!e)return{mode:"shell",tmuxName:"",userSelectedMode:null};const t=JSON.parse(e),r=t.newSessionModeUserSelected===!0&&mD(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 s5(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(qp),n={...t?JSON.parse(t):{},...e};window.localStorage.setItem(qp,JSON.stringify(n))}catch{}}function xD(){const[e,t]=S.useState(gD),r=S.useCallback((i,l)=>{const u=l?.userInitiated!==!1;t(h=>({...h,mode:i,userSelectedMode:u?i:h.userSelectedMode})),u&&s5({newSessionMode:i,newSessionModeUserSelected:!0})},[]),n=S.useCallback(i=>{t(l=>({...l,tmuxName:i})),s5({newSessionTmuxName:i})},[]);return{newSessionMode:e.mode,newSessionTmuxName:e.tmuxName,userSelectedNewSessionMode:e.userSelectedMode,setNewSessionMode:r,setNewSessionTmuxName:n}}const bD=550,yD=10;function p6(){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)},[]),u=y.useCallback(()=>{l(),t.current=null},[l]);return y.useCallback(p=>({onPointerDown:g=>{g.pointerType!=="touch"&&g.pointerType!=="pen"||(u(),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())},bD))},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)>yD&&u()},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)),u()},onPointerCancel:u,onPointerLeave:g=>{t.current?.pointerId===g.pointerId&&!r.current&&u()},onClickCapture:g=>{n.current&&(n.current=!1,i.current!=null&&(window.clearTimeout(i.current),i.current=null),g.preventDefault(),g.stopPropagation())}}),[u])}function i5({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 vD(e,t,r){return!!(e&&t===e&&!r)}function a5({sessionIds:e}){const t=L7(i=>e.reduce((l,u)=>l+(i.unread[u]?.length??0),0)),{locale:r}=Jr();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 wD(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 m6(e){const t=wD(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 AD(e,t,r){return Math.max(t,Math.min(e,r))}const cs={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 o5(e,t,r){return t===0||Math.abs(t)===1/0?Math.pow(e,r*5):e*t*r/(t+r*e)}function l5(e,t,r,n=.15){return n===0?AD(e,t,r):e<t?-o5(t-e,r-t,n)+t:e>r?+o5(e-r,r-t,n)+r:e}function TD(e,[t,r],[n,i]){const[[l,u],[h,p]]=e;return[l5(t,l,u,n),l5(r,h,p,i)]}function CD(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 SD(e){var t=CD(e,"string");return typeof t=="symbol"?t:String(t)}function js(e,t,r){return t=SD(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 ys(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){js(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 g6={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 u5(e){return e?e[0].toUpperCase()+e.slice(1):""}const _D=["enter","leave"];function LD(e=!1,t){return e&&!_D.includes(t)}function kD(e,t="",r=!1){const n=g6[e],i=n&&n[t]||t;return"on"+u5(e)+u5(i)+(LD(r,i)?"Capture":"")}const ID=["gotpointercapture","lostpointercapture"];function ED(e){let t=e.substring(2).toLowerCase();const r=!!~t.indexOf("passive");r&&(t=t.replace("passive",""));const n=ID.includes(t)?"capturecapture":"capture",i=!!~t.indexOf(n);return i&&(t=t.replace("capture","")),{device:t,capture:i,passive:r}}function RD(e,t=""){const r=g6[e],n=r&&r[t]||t;return e+n}function Rh(e){return"touches"in e}function x6(e){return Rh(e)?"touch":"pointerType"in e?e.pointerType:"mouse"}function ND(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 MD(e){return e.type==="touchend"||e.type==="touchcancel"?e.changedTouches:e.targetTouches}function b6(e){return Rh(e)?MD(e)[0]:e}function Yp(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,u=Math.hypot(r,n);return{angle:-(Math.atan2(r,n)*180)/Math.PI,distance:u,origin:[i,l]}}catch{}return null}function DD(e){return ND(e).map(t=>t.identifier)}function d5(e,t){const[r,n]=Array.from(e.touches).filter(i=>t.includes(i.identifier));return Yp(r,n)}function Zf(e){const t=b6(e);return Rh(e)?t.identifier:t.pointerId}function i0(e){const t=b6(e);return[t.clientX,t.clientY]}const h5=40,f5=800;function y6(e){let{deltaX:t,deltaY:r,deltaMode:n}=e;return n===1?(t*=h5,r*=h5):n===2&&(t*=f5,r*=f5),[t,r]}function BD(e){var t,r;const{scrollX:n,scrollY:i,scrollLeft:l,scrollTop:u}=e.currentTarget;return[(t=n??l)!==null&&t!==void 0?t:0,(r=i??u)!==null&&r!==void 0?r:0]}function QD(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 hh(e,...t){return typeof e=="function"?e(...t):e}function jD(){}function PD(...e){return e.length===0?jD:e.length===1?e[0]:function(){let t;for(const r of e)t=r.apply(this,arguments)||t;return t}}function p5(e,t){return Object.assign({},t,e||{})}const OD=32;class v6{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?hh(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,QD(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 U=r._delta.map(Math.abs);cs.addTo(r._distance,U)}this.axisIntent&&this.axisIntent(t);const[u,h]=r._movement,[p,g]=n.threshold,{_step:x,values:b}=r;if(n.hasCustomTransform?(x[0]===!1&&(x[0]=Math.abs(u)>=p&&b[0]),x[1]===!1&&(x[1]=Math.abs(h)>=g&&b[1])):(x[0]===!1&&(x[0]=Math.abs(u)>=p&&Math.sign(u)*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[U,V]=b;w[0]=x[0]!==!1?U-x[0]:0,w[1]=x[1]!==!1?V-x[1]:0}else w[0]=x[0]!==!1?u-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=hh(n.bounds,r)),this.setup&&this.setup()),r.movement=w,this.computeOffset()));const[I,N]=r.offset,[[R,D],[O,q]]=r._bounds;r.overflow=[I<R?-1:I>D?1:0,N<O?-1:N>q?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 Y=r._active?n.rubberband||[0,0]:[0,0];if(r.offset=TD(r._bounds,r.offset,Y),r.delta=cs.sub(r.offset,A),this.computeMovement(),k&&(!r.last||l>OD)){r.delta=cs.sub(r.offset,A);const U=r.delta.map(Math.abs);cs.addTo(r.distance,U),r.direction=r.delta.map(Math.sign),r._direction=r._delta.map(Math.sign),!r.first&&l>0&&(r.velocity=[U[0]/l,U[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(ys(ys(ys({},r),t),{},{[this.aliasKey]:t.values}));i!==void 0&&(t.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function FD([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 Nu extends v6{constructor(...t){super(...t),js(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=cs.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=cs.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[x6(t)]:n.axisThreshold;r.axis=FD(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 UD=e=>e,m5=.15,w6={enabled(e=!0){return e},eventOptions(e,t,r){return ys(ys({},r.shared.eventOptions),e)},preventDefault(e=!1){return e},triggerAllEvents(e=!1){return e},rubberband(e=0){switch(e){case!0:return[m5,m5];case!1:return[0,0];default:return cs.toVector(e)}},from(e){if(typeof e=="function")return e;if(e!=null)return cs.toVector(e)},transform(e,t,r){const n=e||r.shared.transform;return this.hasCustomTransform=!!n,n||UD},threshold(e){return cs.toVector(e,0)}},$D=0,hc=ys(ys({},w6),{},{axis(e,t,{axis:r}){if(this.lockDirection=r==="lock",!this.lockDirection)return r},axisThreshold(e=$D){return e},bounds(e={}){if(typeof e=="function")return l=>hc.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]]}}),g5={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 zD extends Nu{constructor(...t){super(...t),js(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=hc.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=Zf(t),n._pointerActive=!0,this.computeValues(i0(t)),this.computeInitial(),r.preventScrollAxis&&x6(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=Zf(t);if(r._pointerId!==void 0&&i!==r._pointerId)return;const l=i0(t);if(document.pointerLockElement===t.target?r._delta=[t.movementX,t.movementY]:(r._delta=cs.sub(l,r._values),this.computeValues(l)),cs.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=Zf(t);if(r._pointerId!==void 0&&i!==r._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(t);const[l,u]=r._distance;if(r.tap=l<=n.tapsThreshold&&u<=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,I=n.swipe.duration;if(r.elapsedTime<I){const N=Math.abs(h/r.timeDelta),R=Math.abs(p/r.timeDelta);N>b&&Math.abs(g)>A&&(r.swipe[0]=Math.sign(h)),R>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,HD(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=g5[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,cs.addTo(n._movement,n._delta),this.compute(t),this.emit()}}keyUp(t){t.key in g5&&(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 HD(e){"persist"in e&&typeof e.persist=="function"&&e.persist()}const Mu=typeof window<"u"&&window.document&&window.document.createElement;function A6(){return Mu&&"ontouchstart"in window}function WD(){return A6()||Mu&&window.navigator.maxTouchPoints>1}function GD(){return Mu&&"onpointerdown"in window}function VD(){return Mu&&"exitPointerLock"in window.document}function qD(){try{return"constructor"in GestureEvent}catch{return!1}}const Ha={isBrowser:Mu,gesture:qD(),touch:A6(),touchscreen:WD(),pointer:GD(),pointerLock:VD()},YD=250,ZD=180,KD=.5,XD=50,JD=250,eB=10,x5={mouse:0,touch:0,pen:8},tB=ys(ys({},hc),{},{device(e,t,{pointer:{touch:r=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&Ha.pointerLock,Ha.touch&&r?"touch":this.pointerLock?"mouse":Ha.pointer&&!i?"pointer":Ha.touch?"touch":"mouse"},preventScrollAxis(e,t,{preventScroll:r}){if(this.preventScrollDelay=typeof r=="number"?r:r||r===void 0&&e?YD:void 0,!(!Ha.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=cs.toVector(e,r?n:i?1:0);return this.filterTaps=r,this.tapsThreshold=n,l},swipe({velocity:e=KD,distance:t=XD,duration:r=JD}={}){return{velocity:this.transform(cs.toVector(e)),distance:this.transform(cs.toVector(t)),duration:r}},delay(e=0){switch(e){case!0:return ZD;case!1:return 0;default:return e}},axisThreshold(e){return e?ys(ys({},x5),e):x5},keyboardDisplacement(e=eB){return e}});function T6(e){const[t,r]=e.overflow,[n,i]=e._delta,[l,u]=e._direction;(t<0&&n>0&&l<0||t>0&&n<0&&l>0)&&(e._movement[0]=e._movementBound[0]),(r<0&&i>0&&u<0||r>0&&i<0&&u>0)&&(e._movement[1]=e._movementBound[1])}const rB=30,nB=100;class sB extends v6{constructor(...t){super(...t),js(this,"ingKey","pinching"),js(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=cs.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)*rB-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=d5(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(u=>i.has(u))||(n.size<2&&n.set(t.pointerId,t),r._pointerEvents.size<2))return;this.start(t);const l=Yp(...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=d5(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=Yp(...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 u=0;Math.abs(l)>270&&(u+=Math.sign(l)),this.computeValues([r.distance,r.angle-360*u]),n.origin=r.origin,n.turns=u,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=cs.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=[-y6(t)[1]/nB*n.offset[0],0],cs.addTo(n._movement,n._delta),T6(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 iB=ys(ys({},w6),{},{device(e,t,{shared:r,pointer:{touch:n=!1}={}}){if(r.target&&!Ha.touch&&Ha.gesture)return"gesture";if(Ha.touch&&n)return"touch";if(Ha.touchscreen){if(Ha.pointer)return"pointer";if(Ha.touch)return"touch"}},bounds(e,t,{scaleBounds:r={},angleBounds:n={}}){const i=u=>{const h=p5(hh(r,u),{min:-1/0,max:1/0});return[h.min,h.max]},l=u=>{const h=p5(hh(n,u),{min:-1/0,max:1/0});return[h.min,h.max]};return typeof r!="function"&&typeof n!="function"?[i(),l()]:u=>[i(u),l(u)]},threshold(e,t,r){return this.lockDirection=r.axis==="lock",cs.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey(e){return e===void 0?"ctrlKey":e},pinchOnWheel(e=!0){return e}});class aB extends Nu{constructor(...t){super(...t),js(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(i0(t)),this.compute(t),this.computeInitial(),this.emit()}moveChange(t){if(!this.state._active)return;const r=i0(t),n=this.state;n._delta=cs.sub(r,n._values),cs.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 oB=ys(ys({},hc),{},{mouseOnly:(e=!0)=>e});class lB extends Nu{constructor(...t){super(...t),js(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=BD(t);r._delta=cs.sub(n,r._values),cs.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 cB=hc;class uB extends Nu{constructor(...t){super(...t),js(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=y6(t),cs.addTo(r._movement,r._delta),T6(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 dB=hc;class hB extends Nu{constructor(...t){super(...t),js(this,"ingKey","hovering")}enter(t){this.config.mouseOnly&&t.pointerType!=="mouse"||(this.start(t),this.computeValues(i0(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=i0(t);r._movement=r._delta=cs.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 fB=ys(ys({},hc),{},{mouseOnly:(e=!0)=>e}),W1=new Map,Zp=new Map;function C6(e){W1.set(e.key,e.engine),Zp.set(e.key,e.resolver)}const S6={key:"drag",engine:zD,resolver:tB},pB={key:"hover",engine:hB,resolver:fB},mB={key:"move",engine:aB,resolver:oB},gB={key:"pinch",engine:sB,resolver:iB},xB={key:"scroll",engine:lB,resolver:cB},bB={key:"wheel",engine:uB,resolver:dB};function yB(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 vB(e,t){if(e==null)return{};var r=yB(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 wB={target(e){if(e)return()=>"current"in e?e.current:e},enabled(e=!0){return e},window(e=Ha.isBrowser?window:void 0){return e},eventOptions({passive:e=!0,capture:t=!1}={}){return{passive:e,capture:t}},transform(e){return e}},AB=["target","eventOptions","window","enabled","transform"];function Hd(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]=Hd(e[n],i);break;case"boolean":i&&(r[n]=e[n]);break}return r}function TB(e,t,r={}){const n=e,{target:i,eventOptions:l,window:u,enabled:h,transform:p}=n,g=vB(n,AB);if(r.shared=Hd({target:i,eventOptions:l,window:u,enabled:h,transform:p},wB),t){const x=Zp.get(t);r[t]=Hd(ys({shared:r.shared},g),x)}else for(const x in g){const b=Zp.get(x);b&&(r[x]=Hd(ys({shared:r.shared},g[x]),b))}return r}class _6{constructor(t,r){js(this,"_listeners",new Set),this._ctrl=t,this._gestureKey=r}add(t,r,n,i,l){const u=this._listeners,h=RD(r,n),p=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},g=ys(ys({},p),l);t.addEventListener(h,i,g);const x=()=>{t.removeEventListener(h,i,g),u.delete(x)};return u.add(x),x}clean(){this._listeners.forEach(t=>t()),this._listeners.clear()}}class CB{constructor(){js(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 SB{constructor(t){js(this,"gestures",new Set),js(this,"_targetEventStore",new _6(this)),js(this,"gestureEventStores",{}),js(this,"gestureTimeoutStores",{}),js(this,"handlers",{}),js(this,"config",{}),js(this,"pointerIds",new Set),js(this,"touchIds",new Set),js(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),_B(this,t)}setEventIds(t){if(Rh(t))return this.touchIds=new Set(DD(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=TB(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 u of this.gestures){const h=this.config[u],p=b5(n,h.eventOptions,!!i);if(h.enabled){const g=W1.get(u);new g(this,t,u).bind(p)}}const l=b5(n,r.eventOptions,!!i);for(const u in this.nativeHandlers)l(u,"",h=>this.nativeHandlers[u](ys(ys({},this.state.shared),{},{event:h,args:t})),void 0,!0)}for(const l in n)n[l]=PD(...n[l]);if(!i)return n;for(const l in n){const{device:u,capture:h,passive:p}=ED(l);this._targetEventStore.add(i,u,"",n[l],{capture:h,passive:p})}}}}function Qc(e,t){e.gestures.add(t),e.gestureEventStores[t]=new _6(e,t),e.gestureTimeoutStores[t]=new CB}function _B(e,t){t.drag&&Qc(e,"drag"),t.wheel&&Qc(e,"wheel"),t.scroll&&Qc(e,"scroll"),t.move&&Qc(e,"move"),t.pinch&&Qc(e,"pinch"),t.hover&&Qc(e,"hover")}const b5=(e,t,r)=>(n,i,l,u={},h=!1)=>{var p,g;const x=(p=u.capture)!==null&&p!==void 0?p:t.capture,b=(g=u.passive)!==null&&g!==void 0?g:t.passive;let w=h?n:kD(n,i,x);r&&b&&(w+="Passive"),e[w]=e[w]||[],e[w].push(l)},LB=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function kB(e){const t={},r={},n=new Set;for(let i in e)LB.test(i)?(n.add(RegExp.lastMatch),r[i]=e[i]):t[i]=e[i];return[r,t,n]}function jc(e,t,r,n,i,l){if(!e.has(r)||!W1.has(n))return;const u=r+"Start",h=r+"End",p=g=>{let x;return g.first&&u in t&&t[u](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 IB(e,t){const[r,n,i]=kB(e),l={};return jc(i,r,"onDrag","drag",l,t),jc(i,r,"onWheel","wheel",l,t),jc(i,r,"onScroll","scroll",l,t),jc(i,r,"onPinch","pinch",l,t),jc(i,r,"onMove","move",l,t),jc(i,r,"onHover","hover",l,t),{handlers:l,config:t,nativeHandlers:n}}function L6(e,t={},r,n){const i=S.useMemo(()=>new SB(e),[]);if(i.applyHandlers(e,n),i.applyConfig(t,r),S.useEffect(i.effect.bind(i)),S.useEffect(()=>i.clean.bind(i),[]),t.target===void 0)return i.bind.bind(i)}function y5(e,t){return C6(S6),L6({drag:e},t||{},"drag")}function EB(e){return e.forEach(C6),function(r,n){const{handlers:i,nativeHandlers:l,config:u}=IB(r,n||{});return L6(i,u,void 0,l)}}function bO(e,t){return EB([S6,gB,xB,bB,mB,pB])(e,t||{})}const v5={dampingRatio:.8,response:.3},RB=.998;function NB(e,t,r,n){const i=2*Math.PI/Math.max(e.response,.001),l=t-n,u=r,h=e.dampingRatio;if(Math.abs(h-1)<1e-4){const A=l,k=u+i*l;return{value:I=>n+(A+k*I)*Math.exp(-i*I),velocity:I=>(k-i*(A+k*I))*Math.exp(-i*I)}}if(h<1){const A=i*Math.sqrt(1-h*h),k=l,I=(u+h*i*l)/A;return{value:N=>n+Math.exp(-h*i*N)*(k*Math.cos(A*N)+I*Math.sin(A*N)),velocity:N=>Math.exp(-h*i*N)*((I*A-h*i*k)*Math.cos(A*N)-(k*A+h*i*I)*Math.sin(A*N))}}const p=i*Math.sqrt(h*h-1),g=-h*i+p,x=-h*i-p,b=(u-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 MB(e,t=RB){return e/1e3*(t/(1-t))}function w5(e,t,r=.55){return e*t*r/(t+r*Math.abs(e))}function DB(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const BB=.1,QB=5;function jB(e,t,r,n,i){const l=NB(e,t,r,n),u=1e3/60,h=240,p=[];for(let g=0;g<h;g++){const x=g*u/1e3,b=l.value(x),w=l.velocity(x);if(p.push(i?i(b):b),g>0&&Math.abs(b-n)<BB&&Math.abs(w)<QB)break}return p.push(i?i(n):n),{frames:p,durationMs:(p.length-1)*u,solver:l}}const PB='input:not([type="hidden"]), textarea, select, [contenteditable]:not([contenteditable="false"])';function OB(){if(typeof document>"u")return;const e=document.activeElement;e instanceof HTMLElement&&e.matches(PB)&&e.blur()}const FB=18,A5=8,T5={touch:A5,pen:A5},UB=500,Kf=200,C5=50,$B=`[${r9}]`;function Xf(e,t,r){return Math.min(r,Math.max(t,e))}function S5(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($B)}function O0(...e){typeof window<"u"&&window.__SIDEBAR_DEBUG__&&console.log("[Sidebar]",...e)}const k6=S.forwardRef(function({side:t,isOpen:r,drawerWidthPx:n,onClose:i,onOpen:l,children:u,pinned:h=!1},p){const{t:g}=Jr(),x=t==="left",b=x?-n:n,w=y.useRef(null),A=y.useRef(null),k=y.useRef(r?0:b),I=y.useRef(null),N=y.useRef(null),R=y.useRef(0),D=y.useRef(null),O=y.useRef(null),q=y.useRef(!1),Y=y.useRef(null),U=y.useRef(!1),V=y.useRef([]),me=y.useRef(null),Je=y.useRef(k.current),ve=y.useRef(r?1:0),_e=y.useRef(r);_e.current=r;const Ze=y.useRef(b);Ze.current=b;const Ve=y.useRef(n);Ve.current=n;const ce=y.useRef(x);ce.current=x;const ke=y.useRef(i);ke.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]),de=y.useCallback(()=>{N.current!==null&&(window.cancelAnimationFrame(N.current),N.current=null),I.current=null},[]),qe=y.useCallback(pe=>{const $e=Ve.current;return ce.current?(pe+$e)/$e:($e-pe)/$e},[]),xe=y.useCallback(pe=>{const $e=A.current;$e&&($e.style.opacity=String(Xf(qe(pe),0,1)))},[qe]),te=y.useCallback(pe=>{k.current=pe;const $e=w.current;$e&&($e.style.transform=`translateX(${pe}px)`,xe(pe))},[xe]),re=y.useCallback(pe=>{I.current=pe,N.current===null&&(N.current=window.requestAnimationFrame(()=>{N.current=null;const $e=I.current;I.current=null,$e!==null&&te($e)}))},[te]),ge=y.useCallback(()=>{N.current!==null&&(window.cancelAnimationFrame(N.current),N.current=null);const pe=I.current;I.current=null,pe!==null&&te(pe)},[te]),ze=y.useCallback(pe=>{const $e=Ze.current;return Xf(pe,Math.min(0,$e),Math.max(0,$e))},[]),Ke=y.useCallback(()=>{const pe=D.current;if(!pe)return null;D.current=null;const $e=(performance.now()-pe.startTime)/1e3,pt={value:pe.solver.value($e),velocity:pe.solver.velocity($e)};return pe.animations.forEach(Tt=>Tt.cancel()),pt},[]),Ae=y.useCallback(()=>{O.current!==null&&(window.clearTimeout(O.current),O.current=null)},[]),z=y.useCallback(()=>{me.current?.(),me.current=null},[]),Oe=y.useCallback(()=>{ge(),Ae();const pe=Ke();pe&&te(ze(pe.value));const $e=w.current,pt=A.current;$e?.getAnimations().forEach(Tt=>Tt.cancel()),$e&&($e.style.transition="none",$e.style.opacity="1"),pt?.getAnimations().forEach(Tt=>Tt.cancel()),pt&&(pt.style.transition="none")},[te,Ae,ze,ge,Ke]),nt=y.useCallback((pe,$e)=>{ge(),Ae();const pt=w.current,Tt=A.current,Ct=pe?0:Ze.current;Tt&&(Tt.style.pointerEvents=pe?"auto":"none");const rr=Ke(),ir=rr?ze(rr.value):k.current,yt=$e?.velocity??rr?.velocity??0;if(DB())return k.current=Ct,pt&&(pt.style.transition=`opacity ${Kf}ms ease`,pt.style.opacity=pe?"1":"0",pt.style.transform=`translateX(${Ct}px)`),Tt&&(Tt.style.transition=`opacity ${Kf}ms ease`,Tt.style.opacity=pe?"1":"0"),Kf;pt&&(pt.style.transition="none",pt.style.opacity="1"),Tt&&(Tt.style.transition="none");const bt=Math.abs($e?.velocity??0)>UB,{frames:_t,durationMs:Qt,solver:Et}=jB({dampingRatio:bt?v5.dampingRatio:1,response:v5.response},ir,yt,Ct,ze);if(!pt||Math.abs(ir-Ct)<.5&&Math.abs(yt)<5)return te(Ct),0;const Ht=pt.animate(_t.map(Pe=>({transform:`translateX(${Pe}px)`})),{duration:Qt,easing:"linear",fill:"forwards"}),ne=[Ht];return Tt&&ne.push(Tt.animate(_t.map(Pe=>({opacity:String(Xf(qe(Pe),0,1))})),{duration:Qt,easing:"linear",fill:"forwards"})),D.current={solver:Et,startTime:performance.now(),target:Ct,animations:ne},O0("spring start",{startX:ir,startVelocity:yt,targetX:Ct,frames:_t.length,durationMs:Qt}),Ht.onfinish=()=>{const Pe=D.current;!Pe||!Pe.animations.includes(Ht)||(D.current=null,te(Ct),Pe.animations.forEach(it=>it.cancel()),O0("spring finish",{targetX:Ct}))},Qt},[te,Ae,ze,ge,qe,Ke]),Re=y.useCallback(pe=>{ge();const $e=pe,pt=0,Tt=Ze.current,Ct=k.current+MB($e),rr=Math.abs(Ct-pt)<=Math.abs(Ct-Tt);O0("decideSnap",{velocity:$e,currentX:k.current,projected:Ct,shouldOpen:rr});const ir=nt(rr,{velocity:$e});return rr&&!_e.current?O.current=window.setTimeout(()=>{O.current=null,ot.current?.()},ir+C5):!rr&&_e.current&&(O.current=window.setTimeout(()=>{O.current=null,ke.current()},ir+C5)),rr},[nt,ge]),X=y.useCallback(pe=>{const $e=Ze.current,pt=Math.min(0,$e),Tt=Math.max(0,$e),Ct=Ve.current;return pe<pt?pt-w5(pt-pe,Ct):pe>Tt?Tt+w5(pe-Tt,Ct):pe},[]),Be=y.useCallback(pe=>{const $e=V.current,pt=performance.now();$e.push({t:pt,x:pe});const Tt=pt-120;for(;$e.length>0&&$e[0].t<Tt;)$e.shift()},[]),st=y.useCallback(()=>{const pe=V.current;if(pe.length<2)return 0;const $e=pe[pe.length-1];if(performance.now()-$e.t>60)return 0;const pt=pe[0],Tt=($e.t-pt.t)/1e3;return Tt<.016?0:($e.x-pt.x)/Tt},[]);y.useEffect(()=>{Ae();const pe=D.current,$e=r?0:Ze.current;pe&&pe.target===$e||nt(r)},[r,nt,Ae]),y.useEffect(()=>{Oe(),re(_e.current?0:b)},[b,Oe,re]),y.useEffect(()=>()=>{de(),Ae(),Ke(),z()},[Ae,de,z,Ke]);const be=y5(({active:pe,cancel:$e,first:pt,last:Tt,movement:[Ct],event:rr})=>{if(O0("bindPanel",{active:pe,first:pt,last:Tt,mx:Ct}),!S5(rr)){$e();return}if(pt){if(z(),q.current=!1,Y.current=null,V.current=[],_5(rr)){$e();return}const ir=w.current,yt=ir?n9(rr.target,ir):null;if(!yt||s9()){$e();return}const bt=i9(yt,Ct,ce.current?-1:1);if(O0("arbitrate",{owner:bt.kind,mx:Ct}),bt.kind==="swiper"){me.current=a9(bt.instance),$e();return}if(bt.kind==="scroller"){const _t=o9(bt.element);if(_t)Y.current=_t;else{$e();return}}Y.current||(q.current=!0,Oe(),R.current=k.current)}if(!pe){Y.current=null,q.current&&(q.current=!1,Re(st()));return}if(Y.current){l9(Y.current,Ct);return}if(q.current){const ir=X(R.current+Ct);Be(ir),re(ir)}},{axis:"x",axisThreshold:T5,filterTaps:!0,pointer:{touch:!0}}),je=y5(({active:pe,cancel:$e,first:pt,movement:[Tt],event:Ct})=>{if(!S5(Ct)){$e();return}if(_e.current){$e();return}if(pt&&(U.current=!0,V.current=[],Oe(),R.current=k.current),!pe){U.current&&(U.current=!1,Re(st())&&OB());return}if(U.current){const rr=X(R.current+Tt);Be(rr),re(rr)}},{axis:"x",axisThreshold:T5,filterTaps:!0,pointer:{touch:!0}}),wt=y.useCallback(pe=>{pe.preventDefault(),pe.stopPropagation(),_e.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:u});const Te=be();return a.jsxs(a.Fragment,{children:[a.jsx("div",{...je(),style:{position:"fixed",top:"1.5rem",bottom:"10rem",...x?{left:0}:{right:0},width:FB,zIndex:"var(--z-chrome-hint)",touchAction:"none",pointerEvents:r?"none":"auto"},onClick:wt,"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:ve.current,pointerEvents:r?"auto":"none",transition:"none",willChange:"opacity"},onClick:i,"aria-label":g("sidebar.closeSidebar")}),a.jsx("aside",{...Te,onClickCapture:pe=>{_5(pe)||Te.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(${Je.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:u})]})}),zB={activeKey:"root",items:[]},HB=()=>()=>{},WB=()=>zB;function GB(e){const t=jo(),r=y.useSyncExternalStore(t?.subscribe??HB,t?.snapshot??WB),n=k7(),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,u)=>l+(u.key===n?0:u.reviewCount),0):e,hasOtherAttention:i.some(l=>l.key!==n)}}function VB({groups:e,currentKey:t,onClose:r}){const{t:n}=Jr(),i=y.useId(),l=y.useRef(null),u=y.useRef(null),h=y.useRef(r);h.current=r;const p=y.useRef(!0),[g,x]=y.useState(""),b=e.reduce((k,I)=>k+I.reviewCount,0);y.useEffect(()=>{const k=document.activeElement;u.current?.focus({preventScroll:!0});const I=N=>{if(N.key==="Escape"&&(N.preventDefault(),N.stopImmediatePropagation(),h.current()),N.key!=="Tab")return;const R=Array.from(l.current?.querySelectorAll("button:not(:disabled)")??[]),D=R[0],O=R[R.length-1],q=!l.current?.contains(document.activeElement);N.shiftKey&&(document.activeElement===D||q)?(N.preventDefault(),O?.focus()):!N.shiftKey&&(document.activeElement===O||q)&&(N.preventDefault(),D?.focus())};return document.addEventListener("keydown",I,!0),()=>{document.removeEventListener("keydown",I,!0),p.current&&k?.isConnected&&!k.closest("[inert]")&&k.focus({preventScroll:!0})}},[]);const w=(k,I)=>{const N=jo(),R=N?.snapshot().items.find(O=>O.key===k.key);if(!R?.reviewCount||I&&!R.attentionSessions?.some(O=>O.id===I)){x(n("serviceAttention.changed"));return}p.current=!1;let D=!1;I&&k.key===t?(window.dispatchEvent(new CustomEvent("termdock:focus-session",{detail:I})),D=!0):I&&R.service?.targetPeerId?D=N?.focusSession(R.service.targetPeerId,I)??!1:R.service&&(D=N?.activate(R.service,!0)??!1),D?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(Ml,{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:u,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(gs,{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(I=>a.jsxs("button",{type:"button",onClick:()=>w(k,I.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:I.label,children:I.label}),a.jsx("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:I.waiting?n("serviceAttention.waiting"):n("agent.needsReview")})]}),a.jsx(Xc,{size:16,className:"shrink-0 text-muted-foreground","aria-hidden":"true"})]},I.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 qB(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 u=>{if(!u.ok)throw new Error(`Icon request failed: ${u.status}`);const h=await u.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 YB(e){return e.agentStatus==="waiting"||e.agentNeedsReview===!0}function ZB(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 u=n==="next"?l:-l,h=(i+u+e.length)%e.length,p=e[h];if(p&&r(p))return p.sessionId}return null}function KB(e,t,r="next"){return ZB(e,t,YB,r)}const ba=42,fh=20,XB=10;function Kp(e,t,r){return Math.min(r,Math.max(t,e))}function Nh(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),u=i+fh,h=Math.max(u,e.width-r-fh-ba),p=Math.max(t+12,52),g=Math.max(p,e.height-n-l-ba);return{minX:u,maxX:h,minY:p,maxY:g}}function L5(e,t){const r=Nh(e),n=Kp(t.yRatio,0,1);return{x:t.side==="left"?r.minX:r.maxX,y:r.minY+(r.maxY-r.minY)*n}}function sc(e,t){const r=Nh(e);return{x:Kp(t.x,r.minX,r.maxX),y:Kp(t.y,r.minY,r.maxY)}}function k5(e,t){const r=Nh(e),n=sc(e,t),i=(r.minX+r.maxX+ba)/2,l=n.x+ba/2<i?"left":"right",u=r.maxY-r.minY;return{position:{x:l==="left"?r.minX:r.maxX,y:n.y},preference:{side:l,yRatio:u>0?(n.y-r.minY)/u:0}}}function I5(e,t,r){const n=sc(e,t),i=ba+XB,l=g=>Math.abs(g.x-r.x)<i&&Math.abs(g.y-r.y)<i;if(!l(n))return n;const u=[{...n,y:r.y-i},{...n,y:r.y+i}].map(g=>sc(e,g)).filter(g=>!l(g)).sort((g,x)=>Math.abs(g.y-n.y)-Math.abs(x.y-n.y));if(u[0])return u[0];const h=Nh(e);return[{...n,x:h.minX},{...n,x:h.maxX}].map(g=>sc(e,g)).filter(g=>!l(g)).sort((g,x)=>Math.abs(g.x-n.x)-Math.abs(x.x-n.x))[0]??n}const Jf="var(--warning)",JB="var(--success)",E5="var(--tmux)",R5="termdock:mobile-attention-position:v1",N5="termdock:running-session-position:v1",eQ={side:"right",yRatio:.68},tQ={side:"right",yRatio:.54};function M5(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 rQ(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function wd(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 nQ(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,u=t?.getBoundingClientRect(),h=!!(u&&u.width>0&&u.height>0);return{width:i,height:l,safeTop:Math.max(wd("--safe-top-inset"),(h?Math.max(0,u.top):0)+Math.max(0,r.top??0)),safeRight:Math.max(wd("--safe-right-inset"),(h?Math.max(0,i-u.right):0)+Math.max(0,r.right??0)),safeBottom:Math.max(wd("--safe-bottom-inset"),(h?Math.max(0,l-u.bottom):0)+Math.max(0,r.bottom??0)),safeLeft:Math.max(wd("--safe-left-inset"),(h?Math.max(0,u.left):0)+Math.max(0,r.left??0)),bottomClearance:e?fh:72}}function I6(){const e=Vr.getState(),t=Array.from(e.sessions.values()),r=KB(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 D5(e){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e}))}function E6(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 sQ({indicator:e,tone:t,size:r}){const n=E6(t);switch(e){case"spinner":return a.jsx(cn,{size:r,className:"shrink-0 animate-spin",style:{color:n}});case"question":return a.jsx(Vd,{size:r,className:"shrink-0 animate-bounce-y",style:{color:n}});case"badge":return a.jsx(Ml,{size:r+1,className:"shrink-0 animate-pulse",style:{color:n}});case"terminal":return a.jsx(Ga,{size:r,className:"shrink-0",style:{color:n}});case"pulse":return a.jsx(M9,{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 ic({agent:e,size:t=12}){const r=t-4,n=qB(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(yh,{size:r,className:"text-white"})})}function iQ({sessionMode:e,state:t,size:r=11}){const n=t?.agent?a.jsx(ic,{agent:t.agent,size:r+1}):e==="tmux"?a.jsx(e0,{size:r,className:"shrink-0"}):a.jsx(Ga,{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(sQ,{indicator:t.agentIndicator,tone:t.agentStatusDetail.tone,size:r})}):t?.agentStatus==="working"?a.jsx("span",{title:t.agentMessage??t.agent?.displayName,children:a.jsx(cn,{size:r,className:"shrink-0 animate-spin",style:{color:JB}})}):t?.agentStatus==="waiting"?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(Vd,{size:r,className:"shrink-0 animate-bounce-y",style:{color:Jf}})}):t?.agentStatus==="done"&&t.agentNeedsReview?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(Ml,{size:r+1,className:"shrink-0 animate-pulse",style:{color:Jf}})}):t?.agentNeedsReview?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(Ml,{size:r+1,className:"shrink-0 animate-pulse",style:{color:Jf}})}):t?.inCopyMode?e==="tmux"?a.jsx(e0,{size:r,className:"shrink-0 animate-pulse",style:{color:E5}}):a.jsx(Ga,{size:r,className:"shrink-0 animate-pulse",style:{color:E5}}):n}function aQ({status:e,detail:t,needsReview:r,inCopyMode:n}){const{t:i}=Jr();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:E6(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 R6({count:e,tone:t,title:r}){const{t:n}=Jr();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 u=r??n("agent.jumpToNext");return a.jsxs("button",{type:"button",className:i,title:`${u} · ${n("agent.jumpToNext")}`,"aria-label":`${u}: ${e}. ${n("agent.jumpToNext")}`,onClick:I6,children:[a.jsx(Ml,{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 oQ({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 lQ=380,B5=10,Ad=10,ep=52,cQ=104;function uQ(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),u=t.height-Math.max(0,t.safeBottom??0),h=fh,p=e.x+ba/2>=n+(i-n)/2,g=p?e.x-Ad-n-h:i-h-e.x-ba-Ad,x=Math.max(1,Math.min(Math.max(0,g),Math.max(168,r*cQ))),b=p?e.x-Ad-x:e.x+ba+Ad,w=Math.min(Math.max(b,n+h),Math.max(n+h,i-h-x)),A=e.y+ba/2-ep/2,k=Math.min(Math.max(A,l+h),Math.max(l+h,u-h-ep));return{left:w,top:k,width:x,height:ep,itemWidth:x/Math.max(1,r),side:p?"left":"right"}}function Q5(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 dQ(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 hQ({reviewCount:e,runningSessions:t,activeSessionId:r,runningButtonEnabled:n,attentionButtonEnabled:i=!0,isDesktopLayout:l,containerElement:u,occlusionInsets:h}){const{t:p}=Jr(),g=Jt(be=>be.leftOpen),x=Jt(be=>be.rightOpen),{isOpen:b}=Z3({enabled:!l}),w=l||!g&&!x&&!b,A=GB(e),[k,I]=S.useState(!1);S.useEffect(()=>{(!A.active||!w)&&I(!1)},[A.active,w]);const N=i&&A.total>0&&w,R=t.length>1||t.length===1&&t[0]?.id!==r,D=n&&t.length>0&&R&&w,O=Math.max(0,h?.top??0),q=Math.max(0,h?.right??0),Y=Math.max(0,h?.bottom??0),U=Math.max(0,h?.left??0),V=S.useCallback(()=>nQ(l,u,{top:O,right:q,bottom:Y,left:U}),[u,l,Y,U,q,O]),me=S.useRef({attention:M5(R5,eQ),running:M5(N5,tQ)}),Je=S.useCallback(()=>{const be=V(),je=L5(be,me.current.attention),wt=L5(be,me.current.running);return{attention:je,running:N&&D?I5(be,wt,je):wt}},[N,V,D]),[ve,_e]=S.useState(()=>Je()),Ze=S.useRef(ve);Ze.current=ve;const[Ve,ce]=S.useState(null),ke=S.useRef(null),[ot,Ie]=S.useState("idle"),[de,qe]=S.useState(null),xe=S.useRef(null),te=S.useRef({attention:!1,running:!1});S.useEffect(()=>()=>{const be=xe.current?.longPressTimer;be!=null&&window.clearTimeout(be)},[]),S.useEffect(()=>{if(D)return;const be=xe.current?.longPressTimer;be!=null&&window.clearTimeout(be),xe.current=null,Ie("idle"),qe(null)},[D]),S.useLayoutEffect(()=>{const be=()=>{const wt=Je();Ze.current=wt,_e(wt)};be(),window.addEventListener("resize",be),window.addEventListener("orientationchange",be),window.visualViewport?.addEventListener("resize",be);const je=typeof ResizeObserver>"u"?null:new ResizeObserver(be);return u&&je?.observe(u),()=>{window.removeEventListener("resize",be),window.removeEventListener("orientationchange",be),window.visualViewport?.removeEventListener("resize",be),je?.disconnect()}},[u,Je]);const re=S.useCallback(be=>be==="attention"?D:N,[N,D]),ge=S.useCallback((be,je)=>{if(!re(be))return je;const wt=be==="attention"?"running":"attention";return I5(V(),je,Ze.current[wt])},[V,re]),ze=S.useCallback((be,je,wt,Te)=>{const pe=V(),$e=je.moved?sc(pe,{x:je.startX+(wt-je.originX),y:je.startY+(Te-je.originY)}):Ze.current[be],pt=k5(pe,$e),Tt=ge(be,pt.position),Ct=k5(pe,Tt);me.current[be]=Ct.preference,rQ(be==="attention"?R5:N5,Ct.preference);const rr={...Ze.current,[be]:Ct.position};Ze.current=rr,_e(rr)},[ge,V]),Ke=S.useCallback(be=>{te.current[be]=!0,window.setTimeout(()=>{te.current[be]=!1},0)},[]),Ae=S.useCallback(be=>{const je=ke.current;!je||je.kind!=="attention"||je.pointerId!==be.pointerId||(ke.current=null,ce(null),ze("attention",je,be.clientX,be.clientY),je.moved&&Ke("attention"))},[ze,Ke]),z={onPointerDown:be=>{be.stopPropagation(),be.currentTarget.setPointerCapture(be.pointerId),ke.current={kind:"attention",pointerId:be.pointerId,originX:be.clientX,originY:be.clientY,startX:ve.attention.x,startY:ve.attention.y,moved:!1}},onPointerMove:be=>{const je=ke.current;if(!je||je.kind!=="attention"||je.pointerId!==be.pointerId)return;const wt=be.clientX-je.originX,Te=be.clientY-je.originY;if(!je.moved&&Math.hypot(wt,Te)<5)return;je.moved=!0,ce("attention");const pe=V(),$e=ge("attention",sc(pe,{x:je.startX+wt,y:je.startY+Te})),pt={...Ze.current,attention:$e};Ze.current=pt,_e(pt)},onPointerUp:Ae,onPointerCancel:Ae},Oe=u?uQ(ve.running,V(),t.length):null,nt=be=>{be.longPressTimer!==null&&(window.clearTimeout(be.longPressTimer),be.longPressTimer=null)},Re={onPointerDown:be=>{be.stopPropagation(),be.currentTarget.setPointerCapture(be.pointerId);const je=be.pointerId,wt={pointerId:je,originX:be.clientX,originY:be.clientY,startX:ve.running.x,startY:ve.running.y,mode:"pressing",moved:!1,selectedIndex:null,longPressTimer:null};wt.longPressTimer=window.setTimeout(()=>{const Te=xe.current;!Te||Te.pointerId!==je||Te.mode!=="pressing"||(Te.longPressTimer=null,Te.mode="dragging",te.current.running=!0,Ie("dragging"))},lQ),xe.current=wt,Ie("pressing"),qe(null)},onPointerMove:be=>{const je=xe.current;if(!je||je.pointerId!==be.pointerId)return;const wt=be.clientX-je.originX,Te=be.clientY-je.originY;if(je.mode==="pressing")if(Math.abs(wt)>=B5&&Math.abs(wt)>=Math.abs(Te))nt(je),je.mode="selecting",te.current.running=!0,Ie("selecting");else if(Math.hypot(wt,Te)>=B5){nt(je),je.mode="cancelled",te.current.running=!0,Ie("idle");return}else return;if(je.mode==="selecting"){const Tt=Oe?Q5(Oe,be.clientX,be.clientY,t.length):null;je.selectedIndex=Tt,qe(Tt);return}if(je.mode!=="dragging"||!je.moved&&Math.hypot(wt,Te)<5)return;je.moved=!0;const pe=V(),$e=ge("running",sc(pe,{x:je.startX+wt,y:je.startY+Te})),pt={...Ze.current,running:$e};Ze.current=pt,_e(pt)},onPointerUp:be=>{const je=xe.current;if(!je||je.pointerId!==be.pointerId)return;nt(je);const wt=je.mode;if(wt==="selecting"){const Te=Oe?Q5(Oe,be.clientX,be.clientY,t.length):je.selectedIndex,pe=Te===null?null:t[Te]?.id;pe&&D5(pe)}else wt==="dragging"&&ze("running",je,be.clientX,be.clientY);xe.current=null,Ie("idle"),qe(null),wt!=="pressing"&&Ke("running")},onPointerCancel:be=>{const je=xe.current;!je||je.pointerId!==be.pointerId||(nt(je),xe.current=null,Ie("idle"),qe(null),Ke("running"))}},X=(be,je)=>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)] ${je==="attention"?"text-[color:var(--warning)]":"text-[color:var(--success)]"}`,children:be>9?"9+":be}),Be=()=>{const be=A.hasOtherAttention?p("serviceAttention.title"):p("agent.jumpToNext"),je=ve.attention,wt=Ve==="attention";return a.jsxs("button",{type:"button","data-attention-button":!0,"data-mobile-attention-button":!0,...z,onClick:Te=>{Te.stopPropagation(),!te.current.attention&&(A.hasOtherAttention?I(!0):I6())},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 ${wt?"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:je.x,top:je.y,width:ba,height:ba,touchAction:"none"},"aria-label":`${be}: ${A.total}`,"aria-haspopup":A.hasOtherAttention?"dialog":void 0,title:be,children:[a.jsx(Ml,{size:17,className:"shrink-0"}),X(A.total,"attention")]},"attention")},st=()=>{const be=t.length,je=ve.running,wt=ot==="selecting",Te=ot==="dragging";return a.jsxs(S.Fragment,{children:[a.jsxs("button",{type:"button","data-running-session-button":!0,"data-running-session-gesture":ot,...Re,onClick:pe=>{if(pe.stopPropagation(),te.current.running)return;const $e=dQ(t,r);$e&&D5($e)},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 ${Te?"cursor-grabbing scale-[1.04] shadow-[0_12px_30px_var(--app-shadow-strong)]":wt?"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:je.x,top:je.y,width:ba,height:ba,touchAction:"none"},"aria-label":`${p("agent.jumpToNextRunning")}: ${be}`,title:p("agent.runningSessionGestureHint"),children:[a.jsx(cn,{size:18,className:"shrink-0 animate-spin"}),X(be,"running")]}),wt&&Oe&&a.jsx("div",{role:"listbox","data-running-session-rail":!0,"data-side":Oe.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:Oe.left,top:Oe.top,width:Oe.width,height:Oe.height},children:t.map((pe,$e)=>{const pt=$e===de,Tt=pe.id===r,Ct=`${pe.label}${pe.detail?` · ${pe.detail}`:""}${Tt?` · ${p("agent.currentSession")}`:""}`;return a.jsxs("div",{role:"option","aria-selected":pt,"data-running-session-option":pe.id,"data-selected":pt?"true":"false",title:Ct,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 ${pt?"scale-[1.02] bg-[var(--success)] text-[color:var(--success-foreground)]":Tt?"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 ${pt?"bg-surface/25":"bg-surface-2 text-muted-foreground"}`,children:$e+1}),a.jsx("span",{className:"truncate text-[10px] font-medium",children:pe.label})]},pe.id)})})]},"running")};return!N&&!D&&!k||u===null||typeof document>"u"?null:a.jsxs(I7,{children:[N&&Be(),D&&!k&&st(),k&&A.active&&w&&a.jsx(VB,{groups:A.groups,currentKey:A.currentKey,onClose:()=>I(!1)})]})}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"]),j5=120,P5=120,pQ=new Set,mQ=[],gQ={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 G1(e,t){if(t==="directory")return null;if(N7(e))return a.jsx(T9,{size:14});if(M7(e))return a.jsx(Xx,{size:14});const r=e.lastIndexOf(".")>=0?e.slice(e.lastIndexOf(".")):"";return fQ.has(r)?a.jsx(K9,{size:14}):a.jsx(Hx,{size:14})}function N6({path:e}){const r=Jt(i=>i.changedFiles.get(e))?.status;if(!r)return null;const n=gQ[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 a0(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 V1(e){return a0(e)}const xQ=y.memo(function({path:t}){const{t:r}=Jr(),[n,i]=y.useState("idle"),[l,u]=y.useState(null),h=y.useCallback(async p=>{if(p.stopPropagation(),n!=="pending"){i("pending"),u(null);try{await Mx(t),i("idle")}catch(g){i("error"),u(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 ${a0(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(cn,{size:12,className:"animate-spin"}):a.jsx(uu,{size:12})})});function M6(){const{t:e}=Jr(),[t,r]=y.useState({status:"idle"}),n=y.useCallback(async i=>{r({status:"pending"});try{await Mx(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 Xp(e){return e instanceof DOMException&&e.name==="AbortError"}function ph(){if(typeof window>"u")return!1;const e=window.getSelection();return!!(e&&!e.isCollapsed&&e.toString().trim())}function D6(e){return e.button===2||e.ctrlKey}const bQ=176,yQ=160,F0=8;function O5(e,t,r,n){const i=window.visualViewport,l=i?.offsetLeft??0,u=i?.offsetTop??0,h=l+(i?.width??window.innerWidth),p=u+(i?.height??window.innerHeight),g=l+F0,x=u+F0,b=Math.max(g,h-r-F0),w=Math.max(x,p-n-F0),A=t+n<=p-F0?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 B6(e){const[t,r]=y.useState(null),n=y.useRef(null),i=y.useCallback((l,u)=>{r(O5(l,u,bQ,yQ))},[]);return y.useLayoutEffect(()=>{if(!e||!t||!n.current)return;const l=n.current.getBoundingClientRect();if(l.width<=0||l.height<=0)return;const u=O5(t.anchorX,t.anchorY,l.width,l.height);u.left===t.left&&u.top===t.top||r(u)},[e,t]),{position:t,menuRef:n,openAt:i,clearPosition:()=>r(null)}}function Q6(e,t){return t&&typeof document<"u"?na.createPortal(e,document.body):e}function vQ(e,t){return t?`${e.name} ${e.path}`.toLowerCase().includes(t):!0}function q1(e,t,r){if(!t||vQ(e,t))return!0;const n=r.get(e.path);return n?n.some(i=>q1(i,t,r)):!1}function Jp(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 e1(e,t){return!e||!t.startsWith(e)?t:t.slice(e.length).replace(/^\/+/,"")||t}const wQ=y.memo(function e({node:t,depth:r,onFileSelect:n,directoriesOnly:i=!1,onPathReference:l,getReferenceText:u,onReferenceCopied:h,insertedReferenceKey:p,copiedReferenceKey:g,onDirectoryRoot:x,onSearchFromDirectory:b,onDirectoryPinToggle:w,onFilePinToggle:A,onOpenInFileBrowser:k,canOpenInFileBrowser:I,pinnedPaths:N,selectedFilePath:R,queryLower:D,onDirectoryDropFiles:O,onFileDeleteRequest:q,deletingFilePath:Y,revealedDirectoryPath:U}){const{t:V}=Jr(),me=Jt(Ge=>Ge.expandedPaths.has(t.path)),Je=Jt(Ge=>Ge.directoryCache.get(t.path)),ve=Jt(Ge=>Ge.showHiddenFiles),_e=Jt(Ge=>Ge.toggleExpanded),Ze=Jt(Ge=>Ge.setDirectoryCache),Ve=Jt(Ge=>Ge.fileSortModes[t.path]??"name"),ce=Jt(Ge=>Ge.setDirectorySortMode),[ke,ot]=y.useState(!1),[Ie,de]=y.useState(!1),{position:qe,menuRef:xe,openAt:te,clearPosition:re}=B6(Ie),[ge,ze]=y.useState(!1),Ke=y.useRef(0),Ae=y.useRef(null),z=y.useRef(null),Oe=t.path===R||t.path===U,nt=t.type==="directory"&&(me||!!D),Re=t.type==="directory",X=N.has(t.path),Be=!Re&&!!A,st=!!(I&&k),be=`path:${t.path}`,je=p===be,wt=g===be,Te=u?.(t.path)??t.path,pe=l1(h),{state:$e,run:pt}=M6(),Tt=Y===t.path,Ct=Re&&!i&&!!(x||b||w||st),rr=y.useMemo(()=>{if(!Je)return;if(!D)return Je;const Ge=Jt.getState().directoryCache;return Je.filter(dr=>(!i||dr.type==="directory")&&q1(dr,D,Ge))},[Je,i,D]),ir=y.useCallback(async()=>{if(!Jt.getState().directoryCache.has(t.path)&&!ke){const dr=`file-tree:${t.path}`;Ae.current?.abort(),xp(dr);const Rt=new AbortController;Ae.current=Rt,ot(!0);try{const un=await a1(t.path,Rt.signal,ve,"expand_directory",dr,Ve),It=Jp(un.entries);Ze(t.path,It)}catch(un){Xp(un)}finally{Ae.current===Rt&&(Ae.current=null),ot(!1)}}},[t.path,ke,Ze,ve,Ve]),yt=y.useCallback(async()=>{if(t.type!=="directory"){n(t.path);return}if(i&&x){x(t.path);return}const Ge=!Jt.getState().expandedPaths.has(t.path);_e(t.path),Ge&&await ir()},[i,t.path,t.type,ir,x,_e,n]);y.useEffect(()=>{t.type==="directory"&&me&&!Je&&!ke&&ir()},[Je,me,ir,ke,t.type]);const bt=y.useCallback(Ge=>{Ge.stopPropagation(),l?.(t.path,be)},[l,t.path,be]),_t=y.useCallback(Ge=>{Ge.stopPropagation(),x?.(t.path),de(!1)},[t.path,x]),Qt=y.useCallback(Ge=>{Ge.stopPropagation(),b?.(t.path),de(!1)},[t.path,b]),Et=y.useCallback(Ge=>{Ge.stopPropagation(),w?.(t.path),de(!1)},[t.path,w]),Ht=y.useCallback(Ge=>{Ge.stopPropagation(),ce(t.path,Ve==="modified"?"name":"modified"),de(!1)},[t.path,ce,Ve]),ne=y.useCallback(Ge=>{Ge.stopPropagation(),A?.(t.path),de(!1)},[t.path,A]),Pe=y.useCallback(Ge=>{Ge.stopPropagation(),de(!1),pt(t.path)},[t.path,pt]),it=y.useCallback(Ge=>{Ge.stopPropagation(),de(!1),q(t)},[t,q]),jt=y.useCallback(Ge=>{Ge.stopPropagation(),k?.(t.path),de(!1)},[t.path,k]),ue=y.useCallback(Ge=>{!Re||!O||!Ge.dataTransfer.types.includes("Files")||(Ge.preventDefault(),Ge.stopPropagation(),Ke.current+=1,ze(!0))},[Re,O]),Nt=y.useCallback(Ge=>{!Re||!O||!Ge.dataTransfer.types.includes("Files")||(Ge.preventDefault(),Ge.stopPropagation(),Ge.dataTransfer.dropEffect="copy",ze(!0))},[Re,O]),qt=y.useCallback(Ge=>{!Re||!O||(Ge.preventDefault(),Ge.stopPropagation(),Ke.current-=1,Ke.current<=0&&(Ke.current=0,ze(!1)))},[Re,O]),Se=y.useCallback(Ge=>{if(!Re||!O)return;Ge.preventDefault(),Ge.stopPropagation(),Ke.current=0,ze(!1);const dr=Array.from(Ge.dataTransfer.files);dr.length>0&&O(t.path,dr)},[Re,t.path,O]),Ce=y.useCallback(Ge=>{Ge.stopPropagation(),re(),de(dr=>!dr)},[re]),ut=y.useCallback(Ge=>{!Ct||!D6(Ge)||(Ge.preventDefault(),Ge.stopPropagation(),te(Ge.clientX,Ge.clientY),de(!0))},[Ct,te]);return y.useEffect(()=>{if(!Ie)return;const Ge=Rt=>{const un=Rt.target;un instanceof Node&&(z.current?.contains(un)||xe.current?.contains(un))||de(!1)},dr=Rt=>{Rt.key==="Escape"&&de(!1)};return document.addEventListener("pointerdown",Ge),document.addEventListener("keydown",dr),()=>{document.removeEventListener("pointerdown",Ge),document.removeEventListener("keydown",dr)}},[Ie,xe]),y.useEffect(()=>()=>{Ae.current?.abort()},[]),a.jsxs("div",{style:!nt&&!Ie?{contentVisibility:"auto",containIntrinsicSize:"auto 32px"}:void 0,children:[a.jsxs("div",{ref:z,className:"relative",children:[pe.popoverNode,a.jsxs("div",{"data-file-tree-path":t.path,"data-sort-mode":Ve,role:"button",tabIndex:0,onClick:()=>{ph()||yt()},onContextMenu:ut,onKeyDown:Ge=>{Ge.key!=="Enter"&&Ge.key!==" "||(Ge.preventDefault(),yt())},onDragEnter:ue,onDragOver:Nt,onDragLeave:qt,onDrop:Se,className:`group relative flex w-full cursor-pointer items-center gap-1 rounded px-2 py-1 text-[13px] transition ${ge?"scale-[1.015] bg-primary/15 text-foreground shadow-[0_0_0_1px_rgb(var(--primary-rgb)_/_0.45)]":Oe?"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`}}),ge&&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:V("fileTree.dropToUploadHere")}),t.type==="directory"?a.jsxs(a.Fragment,{children:[nt?a.jsx(Oo,{size:14,className:"shrink-0 text-muted-foreground/80"}):a.jsx(Xc,{size:14,className:"shrink-0 text-muted-foreground/80"}),nt?a.jsx(Vc,{size:14,className:"shrink-0 text-[color:var(--folder)]"}):a.jsx(lc,{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:Oe?"text-primary":"text-muted-foreground/80",children:G1(t.name,t.type)})]}),a.jsxs("span",{className:`flex-1 select-text whitespace-nowrap text-left leading-snug ${Oe?"font-medium":""}`,children:[t.name,Ve==="modified"&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-primary",title:V("fileTree.sortedByModified"),"aria-label":V("fileTree.sortedByModified"),children:a.jsx(cu,{size:11})}),t.isSymlink&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:V("fileTree.symbolicLink"),children:a.jsx(Jc,{size:11})})]}),a.jsxs("div",{className:`sticky right-0 z-20 flex shrink-0 items-center rounded pl-1 ${Oe?"bg-surface-elevated":"bg-surface group-hover:bg-surface-2"}`,onClick:Ge=>Ge.stopPropagation(),onKeyDown:Ge=>Ge.stopPropagation(),children:[ke&&a.jsx(cn,{size:12,className:"shrink-0 animate-spin text-muted-foreground"}),a.jsx(N6,{path:t.path}),Ct&&a.jsx("span",{onClick:Ce,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${a0(Ie)} ${Ie?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:V("fileTree.moreDirActions"),children:a.jsx(ac,{size:13})}),!Re&&a.jsx("span",{onClick:Ce,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${a0(Ie||$e.status==="pending"||Tt||X)} ${Ie?"bg-surface-elevated text-foreground":X?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:$e.status==="error"?$e.message??V("rightSidebar.downloadFailed"):V("fileTree.moreFileActions"),children:$e.status==="pending"||Tt?a.jsx(cn,{size:13,className:"animate-spin"}):a.jsx(ac,{size:13})}),l&&a.jsx("span",{onClick:bt,...pe(Te,be),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${V1(je||wt)} ${je||wt?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":V(wt?"rightSidebar.copied":je?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:V(wt?"rightSidebar.copied":je?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:wt||je?a.jsx(ya,{size:12}):a.jsx(Jc,{size:12})}),Ct&&Ie&&Q6(a.jsxs("div",{ref:xe,className:`${qe?"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:qe?{left:qe.left,top:qe.top}:void 0,children:[st&&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:V("fileTree.openInFileBrowserTitle"),children:[a.jsx(Vc,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V("fileTree.openInFileBrowser")})]}),x&&a.jsxs("button",{type:"button",onClick:_t,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:V("fileTree.openDirRootTitle"),children:[a.jsx(Vc,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V("fileTree.openDirRoot")})]}),b&&a.jsxs("button",{type:"button",onClick:Qt,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:V("fileTree.searchFromDirTitle"),children:[a.jsx(u1,{size:13,className:"shrink-0 text-primary"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V("fileTree.searchFromDir")})]}),w&&a.jsxs("button",{type:"button",onClick:Et,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] ${X?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:V(X?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[X?a.jsx(hu,{size:13,className:"shrink-0"}):a.jsx(du,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V(X?"fileTree.unpinDir":"fileTree.pinDir")})]}),a.jsxs("button",{type:"button",onClick:Ht,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:[Ve==="modified"?a.jsx(g9,{size:13,className:"shrink-0"}):a.jsx(cu,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V(Ve==="modified"?"fileTree.sortByName":"fileTree.sortByModified")})]})]}),!!qe),!Re&&Ie&&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:[st&&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:V("fileTree.openInFileBrowserTitle"),children:[a.jsx(Hx,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V("fileTree.openInFileBrowser")})]}),a.jsxs("button",{type:"button",onClick:Pe,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:V("rightSidebar.downloadFile"),children:[a.jsx(uu,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V("rightSidebar.downloadFile")})]}),Be&&a.jsxs("button",{type:"button",onClick:ne,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] ${X?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:V(X?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[X?a.jsx(hu,{size:13,className:"shrink-0"}):a.jsx(du,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V(X?"fileTree.unpinFile":"fileTree.pinFile")})]}),a.jsxs("button",{type:"button",onClick:it,disabled:Tt,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:V("fileTree.deleteFile"),children:[Tt?a.jsx(cn,{size:13,className:"shrink-0 animate-spin"}):a.jsx(yi,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V("fileTree.deleteFile")})]})]})]})]})]}),nt&&rr&&rr.length>0&&a.jsx("div",{className:r===0?"mt-0.5":"",children:rr.map(Ge=>a.jsx(e,{node:Ge,depth:r+1,onFileSelect:n,directoriesOnly:i,onPathReference:l,getReferenceText:u,onReferenceCopied:h,onDirectoryRoot:x,onSearchFromDirectory:b,onDirectoryPinToggle:w,onFilePinToggle:A,onOpenInFileBrowser:k,canOpenInFileBrowser:I,pinnedPaths:N,selectedFilePath:R,queryLower:D,insertedReferenceKey:p,copiedReferenceKey:g,onDirectoryDropFiles:O,onFileDeleteRequest:q,deletingFilePath:Y,revealedDirectoryPath:U},Ge.path))})]})}),AQ=y.memo(function({node:t,rootPath:r,onFileSelect:n,onPathReference:i,getReferenceText:l,onReferenceCopied:u,insertedReferenceKey:h,copiedReferenceKey:p,onDirectoryRoot:g,onSearchFromDirectory:x,onDirectoryPinToggle:b,onFilePinToggle:w,pinnedPaths:A,selectedFilePath:k,onFileDeleteRequest:I,deletingFilePath:N}){const{t:R}=Jr(),D=t.path===k,O=t.type==="directory",q=A.has(t.path),Y=!O&&!!w,U=`path:${t.path}`,V=h===U,me=p===U,Je=l?.(t.path)??t.path,ve=l1(u),{state:_e,run:Ze}=M6(),[Ve,ce]=y.useState(!1),{position:ke,menuRef:ot,openAt:Ie,clearPosition:de}=B6(Ve),qe=y.useRef(null),xe=N===t.path,te=O&&!!(g||x||b),re=y.useCallback(()=>{ph()||(t.type==="directory"?g?.(t.path):n(t.path))},[t.path,t.type,g,n]),ge=y.useCallback(Re=>{Re.stopPropagation(),i?.(t.path,U)},[i,t.path,U]),ze=y.useCallback(Re=>{Re.stopPropagation(),b?.(t.path),ce(!1)},[t.path,b]),Ke=y.useCallback(Re=>{Re.stopPropagation(),w?.(t.path),ce(!1)},[t.path,w]),Ae=y.useCallback(Re=>{Re.stopPropagation(),ce(!1),Ze(t.path)},[t.path,Ze]),z=y.useCallback(Re=>{Re.stopPropagation(),ce(!1),I(t)},[t,I]),Oe=y.useCallback(Re=>{Re.stopPropagation(),de(),ce(X=>!X)},[de]),nt=y.useCallback(Re=>{!te||!D6(Re)||(Re.preventDefault(),Re.stopPropagation(),Ie(Re.clientX,Re.clientY),ce(!0))},[te,Ie]);return y.useEffect(()=>{if(!Ve)return;const Re=Be=>{const st=Be.target;st instanceof Node&&(qe.current?.contains(st)||ot.current?.contains(st))||ce(!1)},X=Be=>{Be.key==="Escape"&&ce(!1)};return document.addEventListener("pointerdown",Re),document.addEventListener("keydown",X),()=>{document.removeEventListener("pointerdown",Re),document.removeEventListener("keydown",X)}},[Ve,ot]),a.jsxs("div",{ref:qe,className:"relative border-b border-border/10 last:border-b-0",children:[ve.popoverNode,a.jsxs("div",{role:"button",tabIndex:0,onClick:re,onContextMenu:nt,onKeyDown:Re=>{Re.key!=="Enter"&&Re.key!==" "||(Re.preventDefault(),re())},className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-left text-[13px] transition ${D?"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(lc,{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:D?"text-primary":"text-muted-foreground/80",children:G1(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 ${D?"text-primary":"text-foreground"}`,children:[t.name,t.isSymlink&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:R("fileTree.symbolicLink"),children:a.jsx(Jc,{size:11})})]}),a.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-muted-foreground/80",children:e1(r,t.path)})]}),a.jsx(N6,{path:t.path}),t.type==="directory"&&(b||x)&&a.jsx("span",{onClick:Oe,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${a0(Ve)} ${Ve?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:R("fileTree.moreDirActions"),children:a.jsx(ac,{size:13})}),!O&&a.jsx("span",{onClick:Oe,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${a0(Ve||_e.status==="pending"||xe||q)} ${Ve?"bg-surface-elevated text-foreground":q?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:_e.status==="error"?_e.message??R("rightSidebar.downloadFailed"):R("fileTree.moreFileActions"),children:_e.status==="pending"||xe?a.jsx(cn,{size:13,className:"animate-spin"}):a.jsx(ac,{size:13})}),i&&a.jsx("span",{onClick:ge,...ve(Je,U),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${V1(V||me)} ${V||me?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":R(me?"rightSidebar.copied":V?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:R(me?"rightSidebar.copied":V?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:me||V?a.jsx(ya,{size:12}):a.jsx(Jc,{size:12})})]}),te&&Ve&&Q6(a.jsxs("div",{ref:ot,className:`${ke?"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:ke?{left:ke.left,top:ke.top}:void 0,children:[g&&a.jsxs("button",{type:"button",onClick:Re=>{Re.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:R("fileTree.openDirRootTitle"),children:[a.jsx(Vc,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("fileTree.openDirRoot")})]}),x&&a.jsxs("button",{type:"button",onClick:Re=>{Re.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(u1,{size:13,className:"shrink-0 text-primary"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("fileTree.searchFromDir")})]}),b&&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] ${q?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:R(q?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[q?a.jsx(hu,{size:13,className:"shrink-0"}):a.jsx(du,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R(q?"fileTree.unpinDir":"fileTree.pinDir")})]})]}),!!ke),!O&&Ve&&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:Ae,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:R("rightSidebar.downloadFile"),children:[a.jsx(uu,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("rightSidebar.downloadFile")})]}),Y&&a.jsxs("button",{type:"button",onClick:Ke,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] ${q?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:R(q?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[q?a.jsx(hu,{size:13,className:"shrink-0"}):a.jsx(du,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R(q?"fileTree.unpinFile":"fileTree.pinFile")})]}),a.jsxs("button",{type:"button",onClick:z,disabled:xe,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:R("fileTree.deleteFile"),children:[xe?a.jsx(cn,{size:13,className:"shrink-0 animate-spin"}):a.jsx(yi,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("fileTree.deleteFile")})]})]})]})}),TQ=60,F5=60,CQ=20;function U5({count:e,loading:t,engine:r,limited:n,scope:i,content:l}){const{t:u}=Jr();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(u1,{size:14,className:"shrink-0 text-primary"}),a.jsx("span",{children:l?u("fileTree.contentMatchesCount",{count:e}):u("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(cn,{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:u("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:u("fileTree.searching")})]})]})}function SQ(e,t){if(!t)return e;const r=e.toLowerCase(),n=t.toLowerCase(),i=[];let l=0,u=r.indexOf(n,l),h=0;for(;u>=0&&n;)u>l&&i.push(e.slice(l,u)),i.push(a.jsx("mark",{className:"rounded-sm bg-[rgb(var(--warning-rgb)_/_0.30)] px-0.5 text-foreground",children:e.slice(u,u+n.length)},`m-${h++}`)),l=u+n.length,u=r.indexOf(n,l);return l<e.length&&i.push(e.slice(l)),i.length>0?i:e}const _Q=y.memo(function({entry:t,rootPath:r,selectedFilePath:n,query:i,onContentMatchSelect:l,onPathReference:u,getReferenceText:h,onReferenceCopied:p,insertedReferenceKey:g,copiedReferenceKey:x}){const{t:b}=Jr(),[w,A]=y.useState(!0),k=t.path===n,I=w?t.matches.slice(0,CQ):[],N=t.matches.length-I.length,R=`path:${t.path}`,D=g===R,O=x===R,q=h?.(t.path)??t.path,Y=l1(p);return a.jsxs("div",{className:"border-b border-border/10 last:border-b-0",children:[Y.popoverNode,a.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{ph()||A(U=>!U)},onKeyDown:U=>{U.key!=="Enter"&&U.key!==" "||(U.preventDefault(),A(V=>!V))},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(Oo,{size:14,className:"shrink-0 text-muted-foreground/80"}):a.jsx(Xc,{size:14,className:"shrink-0 text-muted-foreground/80"}),a.jsx("span",{className:k?"text-primary":"text-muted-foreground/80",children:G1(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:e1(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(xQ,{path:t.path}),u&&a.jsx("span",{onClick:U=>{U.stopPropagation(),u(t.path,R)},...Y(q,R),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${V1(D||O)} ${D||O?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":b(O?"rightSidebar.copied":D?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:b(O?"rightSidebar.copied":D?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:O||D?a.jsx(ya,{size:12}):a.jsx(Jc,{size:12})})]}),w&&a.jsxs("div",{className:"mb-1 ml-3 border-l border-border/20 pl-1",children:[I.map((U,V)=>a.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{ph()||l?.(t.path,U.line)},onKeyDown:me=>{me.key!=="Enter"&&me.key!==" "||(me.preventDefault(),l?.(t.path,U.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:`${e1(r,t.path)}:${U.line}`,children:[a.jsx("span",{className:"shrink-0 select-none tabular-nums text-muted-foreground/60",children:U.line}),a.jsx("span",{className:"min-w-0 flex-1 truncate whitespace-pre select-text",children:SQ(U.text,i)})]},`${U.line}-${V}`)),N>0&&a.jsx("div",{className:"px-2 py-1 text-[10px] text-muted-foreground/70",children:b("fileTree.moreMatches",{count:N})})]})]})});function LQ({rootPath:e,onFileSelect:t,directoriesOnly:r=!1,onPathReference:n,getReferenceText:i,onReferenceCopied:l,insertedReferenceKey:u,copiedReferenceKey:h,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:b,onOpenInFileBrowser:w,canOpenInFileBrowser:A=!1,pinnedPaths:k=pQ,selectedFilePath:I,query:N="",searchRootPath:R,searchOptions:D={},searchMode:O="name",onContentMatchSelect:q,onDirectoryDropFiles:Y,revealDirectory:U}){const{t:V}=Jr(),me=Jt(bt=>e?bt.directoryCache.get(e):void 0),Je=Jt(bt=>bt.setDirectoryCache),ve=Jt(bt=>bt.showHiddenFiles),_e=Jt(bt=>bt.fileSortModesHydrated),Ze=Jt(bt=>bt.fileSortModes[e]??"name"),Ve=Jt(bt=>bt.hydrateFileSortModes),[ce,ke]=y.useState(!1),[ot,Ie]=y.useState(null),[de,qe]=y.useState(!1),[xe,te]=y.useState(!1),[re,ge]=y.useState(null),[ze,Ke]=y.useState(_e),Ae=_e||ze;y.useEffect(()=>{let bt=!1;return Ve().catch(()=>{}).finally(()=>{bt||Ke(!0)}),()=>{bt=!0}},[Ve]);const[z,Oe]=y.useState([]),[nt,Re]=y.useState(null),[X,Be]=y.useState(j5),[st,be]=y.useState([]),[je,wt]=y.useState(null),Te=y.useRef(null),pe=y.useRef(0),$e=N.trim().toLowerCase(),pt=O==="content",Tt=R||e,Ct=D.excludePatterns??mQ,rr=Ct.join(`
|
|
127
|
-
`);y.useEffect(()=>{const bt=U?.path;if(!bt||!bt.startsWith(`${e}/`)&&bt!==e)return;const _t=bt.slice(e.length).replace(/^\/+/,""),Qt=_t?_t.split("/"):[],Et=Qt.map((Nt,qt)=>`${e}/${Qt.slice(0,qt+1).join("/")}`),Ht=Jt.getState(),ne=Et.filter(Nt=>!Ht.expandedPaths.has(Nt));ne.length>0&&Jt.setState(Nt=>({expandedPaths:new Set([...Nt.expandedPaths,...ne])}));let Pe=!1,it=0;const jt=()=>{if(Pe)return;const Nt=Array.from(document.querySelectorAll("[data-file-tree-path]")).find(qt=>qt.dataset.fileTreePath===bt);if(Nt){Nt.scrollIntoView({block:"center",behavior:"smooth"});return}it+=1,it<80&&window.setTimeout(jt,50)},ue=window.requestAnimationFrame(jt);return()=>{Pe=!0,window.cancelAnimationFrame(ue)}},[U?.nonce,U?.path,e]);const ir=y.useCallback(async bt=>{if(!(je||bt.type==="directory")&&window.confirm(V("fileTree.deleteFileConfirm",{name:bt.name}))){wt(bt.path);try{await E7(bt.path),Jt.getState().applyFileWatchEvents([{type:"deleted",path:bt.path}]),Oe(_t=>_t.filter(Qt=>Qt.path!==bt.path)),be(_t=>_t.filter(Qt=>Qt.path!==bt.path)),k.has(bt.path)&&b?.(bt.path)}catch(_t){const Qt=_t instanceof Error?_t.message:String(_t);window.alert(V("fileTree.deleteFileFailed",{message:Qt}))}finally{wt(null)}}},[je,b,k,V]);y.useEffect(()=>{if(!e||!Ae)return;if($e){ke(!1);return}if(Jt.getState().directoryCache.has(e)){ke(!1);return}let bt=!1;const _t=new AbortController;return ke(!0),Ie(null),a1(e,_t.signal,ve,"load_file_tree_root",`file-tree-root:${e}`,Ze).then(Qt=>{if(bt)return;const Et=Jp(Qt.entries);qe(!!Qt.truncated),Je(e,Et)}).catch(Qt=>{bt||Xp(Qt)||Ie(Qt instanceof Error?Qt.message:"Failed to load directory")}).finally(()=>{bt||ke(!1)}),()=>{bt=!0,_t.abort(),xp(`file-tree-root:${e}`)}},[$e,me,e,Ze,Je,ve,Ae]),y.useEffect(()=>{if(!Tt||!$e){te(!1),ge(null),Oe([]),be([]),Re(null);return}let bt=!1;const _t=new AbortController,Qt=new Set;te(!0),ge(null),Oe([]),be([]),Be(pt?TQ:j5),Re({truncated:!1,total:0,engine:"rg",limited:!1,done:!1});const Et=`file-search:${Tt}:${++pe.current}`;return R7(Tt,N.trim(),Ht=>{if(!bt){if(Ht.engine&&Re(ne=>({truncated:ne?.truncated??!1,total:ne?.total??0,engine:Ht.engine,limited:Ht.limited??ne?.limited??!1,done:ne?.done??!1})),Ht.entries?.length){const ne=Ht.entries.filter(Pe=>Qt.has(Pe.path)?!1:(Qt.add(Pe.path),!0));ne.length>0&&(Oe(Pe=>[...Pe,...Jp(ne)]),Re(Pe=>Pe?{...Pe,total:Qt.size}:{truncated:!1,total:Qt.size,engine:"rg",limited:!1,done:!1}))}if(Ht.contentEntries?.length){const ne=Ht.contentEntries.filter(Pe=>Qt.has(Pe.path)?!1:(Qt.add(Pe.path),!0));ne.length>0&&(be(Pe=>[...Pe,...ne]),Re(Pe=>Pe?{...Pe,total:Qt.size}:{truncated:!1,total:Qt.size,engine:"rg",limited:!1,done:!1}))}Ht.done&&Re(ne=>({truncated:!!Ht.truncated,total:typeof Ht.total=="number"?Ht.total:Qt.size,engine:Ht.engine??ne?.engine??"rg",limited:!!Ht.limited,done:!0}))}},_t.signal,ve,O,Et,{excludePatterns:Ct,caseSensitive:D.caseSensitive,wholeWord:D.wholeWord,regex:D.regex}).catch(Ht=>{bt||Xp(Ht)||(ge(Ht instanceof Error?Ht.message:"Failed to search files"),Oe([]),be([]),Re(null))}).finally(()=>{bt||te(!1)}),()=>{bt=!0,_t.abort(),xp(Et)}},[Tt,rr,pt,N,$e,O,D.caseSensitive,D.regex,D.wholeWord,ve]),y.useEffect(()=>{if(!$e)return;const bt=Te.current;if(!bt)return;const _t=pt?st.length:z.length,Qt=pt?F5:P5,Et=new IntersectionObserver(Ht=>{Ht.some(ne=>ne.isIntersecting)&&Be(ne=>Math.min(ne+Qt,_t))},{rootMargin:"160px 0px"});return Et.observe(bt),()=>Et.disconnect()},[$e,z.length,st.length,pt]);const yt=y.useMemo(()=>{if(!me)return;if(!$e)return r?me.filter(_t=>_t.type==="directory"):me;const bt=Jt.getState().directoryCache;return me.filter(_t=>(!r||_t.type==="directory")&&q1(_t,$e,bt))},[r,$e,me]);if(!e)return a.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:V("fileTree.noWorkingDir")});if(ce||!Ae)return a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(cn,{size:20,className:"animate-spin text-muted-foreground"})});if($e&&pt){const bt=nt?.total??st.length,_t=st.slice(0,X),Qt=X<st.length;return a.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[a.jsx(U5,{count:bt,loading:xe,engine:nt?.engine,limited:nt?.limited,scope:Tt,content:!0}),re?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:[V("fileTree.contentSearchNeedsRipgrep"),a.jsx("div",{className:"mt-1 break-words text-[11px] text-muted-foreground/70",children:re})]}):xe&&st.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(cn,{size:20,className:"animate-spin text-muted-foreground"})}):st.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:V("fileTree.noContentMatches")}):a.jsxs(a.Fragment,{children:[nt?.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:V("fileTree.searchTruncatedHint",{count:nt.total})}),_t.map(Et=>a.jsx(_Q,{entry:Et,rootPath:Tt,selectedFilePath:I,query:N.trim(),onContentMatchSelect:q,onPathReference:n,getReferenceText:i,onReferenceCopied:l,insertedReferenceKey:u,copiedReferenceKey:h},Et.path)),a.jsx("div",{ref:Te,className:"py-2 text-center text-[11px] text-muted-foreground",children:Qt?a.jsx("button",{type:"button",onClick:()=>Be(Et=>Math.min(Et+F5,st.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:V("fileTree.loadMoreSearchResults",{shown:_t.length,total:st.length})}):xe?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(cn,{size:10,className:"animate-spin"}),V("fileTree.searchStillRunning")]}):_t.length>0?a.jsx("span",{children:V("fileTree.showingSearchResults",{shown:_t.length,total:bt})}):null})]})]})}if($e){const bt=nt?.total??z.length,_t=z.slice(0,X),Qt=X<z.length;return a.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[a.jsx(U5,{count:bt,loading:xe,engine:nt?.engine,limited:nt?.limited,scope:Tt,content:!1}),xe&&z.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(cn,{size:20,className:"animate-spin text-muted-foreground"})}):re?a.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:re}):z.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:V("fileTree.noMatchingFiles")}):a.jsxs(a.Fragment,{children:[nt?.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:V("fileTree.searchTruncatedHint",{count:nt.total})}),_t.map(Et=>a.jsx(AQ,{node:Et,rootPath:Tt,onFileSelect:t,onPathReference:n,getReferenceText:i,onReferenceCopied:l,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:b,pinnedPaths:k,selectedFilePath:I,insertedReferenceKey:u,copiedReferenceKey:h,onFileDeleteRequest:ir,deletingFilePath:je},Et.path)),a.jsx("div",{ref:Te,className:"py-2 text-center text-[11px] text-muted-foreground",children:Qt?a.jsx("button",{type:"button",onClick:()=>Be(Et=>Math.min(Et+P5,z.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:V("fileTree.loadMoreSearchResults",{shown:_t.length,total:z.length})}):xe?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(cn,{size:10,className:"animate-spin"}),V("fileTree.searchStillRunning")]}):_t.length>0?a.jsx("span",{children:V("fileTree.showingSearchResults",{shown:_t.length,total:bt})}):null})]})]})}return ot?a.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:ot}):!me||me.length===0?a.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:V("fileTree.emptyDir")}):!yt||yt.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:V("fileTree.noMatchingFiles")}):a.jsxs("div",{className:"termdock-native-select w-max min-w-full space-y-px px-2 py-2",children:[de&&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:V("fileTree.truncatedHint")}),yt.map(bt=>a.jsx(wQ,{node:bt,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:I,queryLower:$e,insertedReferenceKey:u,copiedReferenceKey:h,onDirectoryDropFiles:Y,onFileDeleteRequest:ir,deletingFilePath:je,revealedDirectoryPath:U?.path},bt.path))]})}function t1(e){return e.trim().replace(/\/+$/,"")||"/"}function kQ(e){const t=t1(e);if(t==="/")return"/";const r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}function Y1({open:e,initialPath:t,title:r,labels:n,onCancel:i,onConfirm:l}){const{t:u}=Jr(),h={hint:n?.hint??u("sidebar.directoryPickerHint"),cancel:n?.cancel??u("common.cancel"),confirm:n?.confirm??u("sidebar.useThisFolder"),close:n?.close??u("common.close"),parent:n?.parent??u("rightSidebar.parentFolder")},[p,g]=y.useState(()=>t1(t));return y.useEffect(()=>{e&&g(t1(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?na.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(sw,{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(gs,{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(kQ(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(Ux,{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(LQ,{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(ya,{size:13}),h.confirm]})]})]})]}),document.body):null}const r1="termdock:new-session-commands:v1",El="__saved_command__:";function Td(e){return[...new Set(Object.entries(e).filter(([t])=>t.startsWith(El)||t==="__custom__"||t==="__terminal__").map(([,t])=>t.trim()).filter(Boolean))]}function U0(){try{const e=JSON.parse(localStorage.getItem(r1)||"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="string"))}catch{return{}}}function IQ({directories:e,tmuxAvailable:t,options:r,agents:n,selectedAgent:i,detecting:l,resumeHistory:u,resumeHistoryLoading:h,resumeHistoryPendingId:p,resumeHistoryError:g,onRefreshAgents:x,onSelectAgent:b,onLaunchAgent:w,onResumeHistory:A,onRemoveResumeHistory:k,onClose:I,onOptionsChange:N}){const{t:R,locale:D}=Jr(),[O,q]=y.useState(i),[Y,U]=y.useState(!1),[V,me]=y.useState(!1),[Je,ve]=y.useState(U0),[_e,Ze]=y.useState(()=>Td(U0())),[Ve,ce]=y.useState(null),[ke,ot]=y.useState("idle"),Ie=V?"__custom__":O?.slug??"__terminal__",de=O?.command??"",qe=V?Je.__custom__??Je.__terminal__??"":O?Je[Ie]??de:"",xe=()=>{const X=qe.trim()||de;if(!(V&&!X))try{const Be={...U0(),[Ie]:X};if(V){for(const st of Td(U0()))Be[El+st]=st;Be[El+X]=X}localStorage.setItem(r1,JSON.stringify(Be)),Ze(Td(Be)),V&&ce(X),ot("saved")}catch{ot("error")}},te=()=>{if(Ve)try{const X=U0();for(const[Be,st]of Object.entries(X))(Be.startsWith(El)||Be==="__custom__"||Be==="__terminal__")&&st.trim()===Ve&&delete X[Be];localStorage.setItem(r1,JSON.stringify(X)),Ze(Td(X)),ve(Be=>({...Be,__custom__:""})),ce(null),ot("idle")}catch{ot("error")}},re=()=>{const X=qe.trim()||de;V&&!X||(xe(),w(O,X))},ge=y.useMemo(()=>[...new Set(e.filter(Boolean))].slice(0,5),[e]),ze=V?Ve?El+Ve:"__custom__":O?.slug??"__terminal__",Ke=X=>{ot("idle");const Be=X.startsWith(El)?X.slice(El.length):null;ce(Be),me(X==="__custom__"||Be!==null),(Be!==null||X==="__custom__")&&ve(st=>({...st,__custom__:Be??""})),q(n.find(st=>st.slug===X)??null)},Ae=V?Ve??R("sidebar.customStartupCommand"):O?.displayName??"Terminal",z=i?.displayName??"Terminal",Oe=!V&&(O===null?i===null:i?.slug===O.slug);y.useEffect(()=>{const X=Be=>{Be.key==="Escape"&&(Y||I())};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[Y,I]);const nt=X=>{N({...r,cwd:X}),U(!1)},Re=X=>new Intl.DateTimeFormat(D==="zh"?"zh-CN":"en",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(X));return a.jsxs("section",{className:"relative z-20 flex max-h-[min(56svh,36rem)] shrink-0 flex-col overflow-hidden border-t border-border bg-[var(--chrome-bg)] animate-slide-down","aria-label":R("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(Ga,{size:14})}),a.jsx("div",{className:"min-w-0",children:a.jsx("div",{className:"text-[12px] font-semibold text-foreground",children:R("sidebar.newSessionComposerTitle")})})]}),a.jsx("button",{type:"button",onClick:I,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":R("common.close"),children:a.jsx(gs,{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:R("sidebar.sessionMode")}),a.jsx("div",{className:"grid grid-cols-2 gap-1 rounded-lg bg-surface p-0.5",children:["shell","tmux"].map(X=>a.jsx("button",{type:"button",disabled:X==="tmux"&&!t,onClick:()=>N({...r,mode:X}),"aria-pressed":r.mode===X,title:X==="tmux"?R(t?"sidebar.tmuxKeepsRunning":"sidebar.newTmuxDisabled"):void 0,className:`min-h-9 rounded-md px-4 text-[11px] font-medium transition ${r.mode===X?"bg-surface-2 text-foreground":"text-muted-foreground hover:text-foreground"} disabled:cursor-not-allowed disabled:opacity-40`,children:R(X==="shell"?"sidebar.newShell":"sidebar.newTmux")},X))})]}),a.jsxs("div",{className:"mt-1 flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:R("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:R("sidebar.detectAgents"),"aria-label":R("sidebar.detectAgents"),children:a.jsx(xs,{size:12,className:l?"animate-spin":""})})]}),a.jsxs("div",{role:"radiogroup","aria-label":R("sidebar.startupCommand"),className:"flex flex-wrap gap-1",children:[n.map(X=>{const Be=!V&&O?.slug===X.slug;return a.jsxs("button",{type:"button",role:"radio","aria-checked":Be,onClick:()=>Ke(X.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(ic,{agent:X,size:12}),a.jsx("span",{className:"max-w-[9rem] truncate",children:X.displayName}),i?.slug===X.slug&&a.jsx("span",{className:"ml-0.5 text-[9px] text-muted-foreground",children:R("sidebar.defaultAgent")})]},X.slug)}),_e.map(X=>{const Be=V&&Ve===X;return a.jsxs("button",{type:"button",role:"radio","aria-checked":Be,onClick:()=>Ke(El+X),title:X,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(Jl,{size:10,className:"shrink-0"}),a.jsx("span",{className:"max-w-[9rem] truncate font-mono text-[10px]",children:X})]},X)}),a.jsxs("button",{type:"button",role:"radio","aria-checked":ze==="__terminal__",onClick:()=>Ke("__terminal__"),className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 text-[10.5px] font-medium transition ${ze==="__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(Ga,{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:R("sidebar.defaultAgent")})]}),a.jsxs("button",{type:"button",role:"radio","aria-checked":ze==="__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 ${ze==="__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(bi,{size:10,className:"shrink-0"}),a.jsx("span",{children:R("sidebar.addStartupCommand")})]})]}),!Oe&&!V&&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:R("sidebar.currentDefaultAgent",{name:z})}),a.jsx("button",{type:"button",onClick:()=>b(O),className:"relative z-10 shrink-0 rounded-md px-2 py-1.5 font-medium text-primary transition hover:bg-primary/10",children:R("sidebar.makeDefault")})]}),ke==="error"&&a.jsx("p",{role:"alert",className:"text-[10px] text-destructive",children:R("sidebar.saveStartupCommandFailed")}),(O||V)&&a.jsxs("details",{open:V&&!Ve||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:[R(V&&!Ve?"sidebar.customStartupCommand":"sidebar.changeStartupCommand"),a.jsx(Oo,{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:R("sidebar.startupCommand")}),O&&qe!==de&&a.jsx("button",{type:"button",onClick:()=>{ve(X=>({...X,[Ie]:de})),ot("idle")},className:"min-h-8 rounded-md px-2 text-[10px] text-primary transition hover:bg-primary/10",children:R("sidebar.resetStartupCommand")})]}),a.jsx("input",{id:"new-session-command",value:qe,onChange:X=>{ve(Be=>({...Be,[Ie]:X.target.value})),ot("idle")},placeholder:de||R("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:[V&&Ve&&a.jsxs("button",{type:"button",onClick:te,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":R("sidebar.deleteStartupCommand"),children:[a.jsx(yi,{size:11}),R("sidebar.deleteStartupCommand")]}),a.jsx("button",{type:"button",onClick:xe,disabled:ke==="saved"||V&&!qe.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:R(ke==="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:R(O?"sidebar.agentStartupCommandHint":"sidebar.terminalStartupCommandHint")})]},Ve??Ie),a.jsx("label",{htmlFor:"new-session-directory",className:"mt-2 block text-[11px] text-muted-foreground",children:R("sidebar.workingDirectory")}),a.jsxs("button",{id:"new-session-directory",type:"button","aria-haspopup":"dialog",onClick:()=>U(!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(lc,{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||R("sidebar.directoryPlaceholder")})]}),ge.length>0&&a.jsx("div",{className:"mt-1.5 flex gap-1 overflow-x-auto pb-0.5","aria-label":R("sidebar.recentDirectories"),children:ge.map(X=>a.jsx("button",{type:"button",onClick:()=>nt(X),title:X,className:"min-h-8 shrink-0 rounded-md px-2 text-[10px] text-muted-foreground transition hover:bg-surface hover:text-foreground",children:lu(X)||X},X))}),(u.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(Jl,{size:11}),a.jsx("span",{className:"flex-1",children:R("sidebar.resumeHistory")}),h&&a.jsx(cn,{size:10,className:"animate-spin"}),u.length>0&&a.jsx("span",{className:"normal-case tracking-normal",children:R("sidebar.resumeHistoryCount",{n:u.length})}),a.jsx(Oo,{size:11})]}),u.length>0&&a.jsx("div",{className:"mt-1 divide-y divide-border overflow-hidden rounded-lg border border-border bg-surface",children:u.slice(0,6).map(X=>{const Be=p===X.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(X),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":R("sidebar.resumeHistoryAction",{title:X.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(cn,{size:13,className:"animate-spin"}):a.jsx(ic,{agent:X.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:X.title}),a.jsxs("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[X.agent.displayName," · ",Re(X.closedAt)]})]}),a.jsx(Yx,{size:12,className:"shrink-0 text-muted-foreground transition group-hover:text-primary"})]}),a.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>k(X.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":R("sidebar.resumeHistoryRemove",{title:X.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(yi,{size:12})]})]},X.id)})}),g&&a.jsx("div",{role:"alert",className:"mt-1.5 px-1 text-[10px] text-destructive",children:g})]})]}),a.jsx("div",{className:"shrink-0 bg-[var(--chrome-bg)] px-3 pb-3 pt-2",children:a.jsxs("button",{type:"button",onClick:re,disabled:V&&!qe.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":R("sidebar.launchSessionWith",{name:Ae}),children:[O?a.jsx(ic,{agent:O,size:15}):a.jsx(Ga,{size:14}),a.jsx("span",{className:"truncate",children:R("sidebar.launchSessionWith",{name:Ae})})]})}),a.jsx(Y1,{open:Y,initialPath:r.cwd?.trim()||ge[0]||"/",title:R("sidebar.chooseDirectory"),onCancel:()=>U(!1),onConfirm:nt})]})}const j6="termdock:new-session-agent:v1";function EQ(){if(typeof window>"u")return null;try{const e=JSON.parse(window.localStorage.getItem(j6)||"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 tp(e){if(!(typeof window>"u"))try{window.localStorage.setItem(j6,JSON.stringify(e))}catch{}}function RQ(e,t){return e?t.find(r=>r.slug===e)??null:null}function NQ(){const[e,t]=y.useState(EQ),[r,n]=y.useState([]),[i,l]=y.useState(!0),u=y.useCallback(async()=>{l(!0);try{const[p,g]=await Promise.all([Bl(),Dx()]),x=RQ(p.newSessionAgentSlug,g);n(g),t(x),tp(x)}finally{l(!1)}},[]);y.useEffect(()=>{const p=()=>{u().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)},[u]);const h=y.useCallback(async p=>{const g=e;t(p),tp(p);try{await ra({newSessionAgentSlug:p?.slug??null})}catch(x){throw t(g),tp(g),x}},[e]);return{preference:e,agents:r,detecting:i,refresh:u,selectAgent:h}}function MQ(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}const Li="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",n1="inline-flex min-h-7 items-center justify-center rounded-md border px-2 py-1 text-[11px] leading-4 font-medium transition",tn="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 $5(e){const[t,r]=y.useState(null),[n,i]=y.useState(!1),[l,u]=y.useState({}),h=y.useCallback(x=>u(b=>({...x,...b})),[]),p=y.useCallback((x,b)=>u(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(z5,{...e,...g,onOpenOverlay:r,onClose:()=>{t?i(!0):e.onClose()}}),t&&a.jsx(z5,{...e,...g,overlayOnly:!0,initialFloating:t==="floating",onFloatingChange:void 0,onOpenOverlay:r,onClose:()=>{r(null),n&&e.onClose()}})]})}function z5({activeSessionId:e,initialCollaborationGroupId:t=null,initialFloating:r=!1,onFloatingChange:n,defaultSessionMode:i="shell",onClose:l,onNewSession:u,overlayOnly:h=!1,onOpenOverlay:p,drafts:g,loadDrafts:x,updateDraft:b}){const[w,A]=y.useState(r);y.useEffect(()=>{A(r)},[r]);const[k,I]=y.useState(!1),[N,R]=y.useState(t),D=ss(Ce=>Ce.docks[t??"workbench"]),O=ss(Ce=>Ce.hosts[t??"workbench"]),[q,Y]=y.useState("floating"),[U,V]=y.useState(null),[me,Je]=y.useState({x:16,y:80}),ve=y.useRef(null),_e=y.useRef({x:.5,y:.5}),[Ze,Ve]=y.useState(null),[ce,ke]=y.useState(null);y.useEffect(()=>{let Ce=!1;return Bl().then(ut=>{if(Ce)return;const Ge=e3(ut.collaborationPanels?.[vh()],t);Ge.position&&(_e.current=Ge.position),Ge.size&&V(Ge.size),x(Ge.drafts??{}),h||Y(Ge.mode??"floating"),Ve(Ge)}).catch(()=>{Ce||ke("面板草稿加载失败,请重新打开面板重试")}),()=>{Ce=!0}},[]);const[ot,Ie]=y.useState(null);y.useEffect(()=>{const Ce=ut=>ke(String(ut.detail));return window.addEventListener("termdock-panel-save-error",Ce),()=>{window.removeEventListener("termdock-panel-save-error",Ce),h||ss.getState().setDock(t??"workbench",null)}},[]);const de=!h&&w&&q==="docked"&&!!O;y.useEffect(()=>{!h&&!w&&ss.getState().setDock(t??"workbench",null)},[w]);const qe=async Ce=>{if(h||k||Ce==="docked"&&!e)return;const ut={sessionId:e,side:"right"};I(!0);try{await ol({mode:Ce,...Ce==="docked"?{dock:ut}:{}},t),Y(Ce),ss.getState().setDock(t??"workbench",Ce==="docked"?ut:null)}catch{ke("面板布局保存失败,请重试")}finally{I(!1)}},xe=y.useRef(!1),te=y.useRef(null),re=y.useCallback((Ce,ut)=>{const Ge=ve.current?.getBoundingClientRect(),dr=window.visualViewport,Rt=(dr?.offsetLeft??0)+12,un=(dr?.offsetTop??0)+12;return{x:Math.max(Rt,Math.min(Ce,Rt+(dr?.width??window.innerWidth)-(Ge?.width??440)-24)),y:Math.max(un,Math.min(ut,un+(dr?.height??window.innerHeight)-(Ge?.height??340)-24))}},[]);y.useLayoutEffect(()=>{if(!w||de)return;const Ce=()=>{const Ge=window.visualViewport;Ie(Ge?.height??window.innerHeight);const dr=ve.current?.getBoundingClientRect();!dr?.width||!dr.height||xe.current||Je(re((Ge?.offsetLeft??0)+12+Math.max(0,(Ge?.width??window.innerWidth)-dr.width-24)*_e.current.x,(Ge?.offsetTop??0)+12+Math.max(0,(Ge?.height??window.innerHeight)-dr.height-24)*_e.current.y))},ut=new ResizeObserver(Ce);return ve.current&&ut.observe(ve.current),window.addEventListener("resize",Ce),window.visualViewport?.addEventListener("resize",Ce),Ce(),()=>{ut.disconnect(),window.removeEventListener("resize",Ce),window.visualViewport?.removeEventListener("resize",Ce)}},[w,de,re,Ze,U]);const[ge,ze]=y.useState(t?"collaboration":"automation"),[Ke,Ae]=y.useState([]),[z,Oe]=y.useState([]),[nt,Re]=y.useState([]),[X,Be]=y.useState([]),[st,be]=y.useState([]),[je,wt]=y.useState(null),[Te,pe]=y.useState(null),[$e,pt]=y.useState(null),[Tt,Ct]=y.useState("loading"),[rr,ir]=y.useState(null),[yt,bt]=y.useState(),[_t,Qt]=y.useState(null),Et=y.useRef(null),Ht=y.useRef(null),ne=y.useRef(null),Pe=t?X.find(Ce=>Ce.id===t)??null:null,it=N?X.find(Ce=>Ce.id===N)??null:X[0]??null,jt=!!t&&Tt==="loaded"&&!Pe,ue=!!e&&(!!it?.sessionIds.includes(e)||!!t&&(!Pe||!!ce));y.useEffect(()=>{if(h)return;const Ce=t??"workbench",ut=ss.getState();jt?ut.docks[Ce]&&ut.setDock(Ce,null):Pe&&w&&q==="docked"&&Ze?.dock&&!ut.docks[Ce]&&ut.setDock(Ce,Ze.dock)},[jt,Pe,w,q,Ze,t,D]);const Nt=async(Ce,ut=!1)=>{if(!(k||Ce&&!it)){if(!h&&!Ce&&!ut&&D){p("full");return}if(h){ut?l():(A(Ce),p(Ce?"floating":"full"));return}I(!0);try{await n?.(Ce?it.id:null),A(Ce),Ce&&q==="docked"&&e&&ss.getState().setDock(t??"workbench",{sessionId:e,side:D?.side??Ze?.dock?.side??"right"}),ut&&l()}catch(Ge){pe(`常驻浮窗状态保存失败,请重试:${Ge instanceof Error?Ge.message:"连接失败"}`)}finally{I(!1)}}},qt=y.useCallback(Ce=>{Be(Ce.groups),be(Ce.sessions),bt(Ce.peers),ir(null),Ct("loaded")},[]);y.useEffect(()=>Bx(qt),[qt]);const Se=y.useCallback(async(Ce={})=>{Ce.silent||pe(null),Ht.current||(Ht.current=D7().then(ut=>{Ae(ut.automations),Oe(ut.runs)}).catch(ut=>{Ce.silent||pe(ut instanceof Error?ut.message:"自动任务加载失败")}).finally(()=>{Ht.current=null})),ne.current||(ne.current=Dx().then(ut=>{Re(ut),Qt(null)}).catch(()=>{Qt("Agent 命令检测失败;已有会话可继续协作。")}).finally(()=>{ne.current=null})),Et.current||(Ct(ut=>ut==="error"?"loading":ut),Et.current=Qx().then(qt).catch(ut=>{Ct("error"),ir(`协作会话加载失败:${ut instanceof Error?ut.message:"请重试"}`)}).finally(()=>{Et.current=null})),await Et.current},[qt]);return y.useEffect(()=>{Se();const Ce=window.setInterval(()=>{Se({silent:!0})},1e4);return()=>window.clearInterval(Ce)},[Se]),y.useEffect(()=>{const Ce=ut=>{ut.key==="Escape"&&!w&&l()};return window.addEventListener("keydown",Ce),()=>window.removeEventListener("keydown",Ce)},[l,w]),na.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:Ce=>{de&&Ce.stopPropagation()},ref:ve,"aria-label":de?"工作组消息分屏":w?"工作组消息浮窗":"Agent 工作台",style:w&&!de?{display:ue?void 0:"none",left:me.x,top:me.y,...U?{width:`min(calc(100vw - 24px), max(280px, ${U.width*100}vw))`,height:`min(calc(100dvh - 24px), max(220px, ${U.height*100}dvh))`}:{},maxHeight:ot?ot-24:"calc(100dvh - 24px)"}:void 0,className:de?"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,env(safe-area-inset-top,0px))] bottom-[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-[8%] sm:bottom-auto sm:max-h-[84vh]",children:[a.jsxs("header",{"data-pane-titlebar":de?"true":void 0,"data-panel-drag-title":de?"true":void 0,onDragStart:Ce=>Ce.preventDefault(),className:`flex items-center gap-2 border-b border-border/15 ${de?"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:Ce=>{!w||de||Ce.button!==0||Ce.target.closest("button")||(te.current={x:Ce.clientX,y:Ce.clientY,left:me.x,top:me.y},Ce.currentTarget.setPointerCapture?.(Ce.pointerId))},onPointerMove:Ce=>{te.current&&Je(re(te.current.left+Ce.clientX-te.current.x,te.current.top+Ce.clientY-te.current.y))},onPointerUp:()=>{if(!te.current)return;te.current=null;const Ce=ve.current?.getBoundingClientRect(),ut=window.visualViewport;Ce&&(_e.current=Fm(me.x,me.y,(ut?.offsetLeft??0)+12,(ut?.offsetTop??0)+12,(ut?.width??window.innerWidth)-Ce.width-24,(ut?.height??window.innerHeight)-Ce.height-24),ol({position:_e.current},t).catch(()=>ke("浮窗位置保存失败,请重新拖动重试")))},onPointerCancel:()=>{te.current=null},children:[a.jsx(yh,{size:de?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:de?"拖动标题移动面板;放在边缘拆分,中央交换":Pe?.name,children:Pe?`${Pe.name} · 协作消息`:t?"协作消息":"Agent 工作台"}),!de&&a.jsx("p",{className:"text-[10px] text-muted-foreground",children:w?"引用、文件路径和粘贴优先加入此处":Pe?"选择成员,发送协作消息":"自动任务、会话协作与全文恢复"})]}),!de&&ge==="collaboration"&&X.length>0&&a.jsx("button",{className:`${tn} shrink-0 text-primary hover:bg-primary/10`,disabled:k,onClick:()=>{Nt(!w)},children:w?"完整面板":"常驻浮窗"}),de&&a.jsxs(a.Fragment,{children:[a.jsx(Lu,{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(d9,{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:()=>{qe("floating")},children:a.jsx(c1,{size:14})})]}),a.jsx("button",{className:`${de?"rounded p-1":"rounded-lg p-2"} text-muted-foreground hover:bg-surface-2 hover:text-foreground`,disabled:k,onClick:()=>{w?Nt(!1,!0):l()},"aria-label":"关闭",children:a.jsx(gs,{size:16})})]}),w&&!de&&!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":q==="floating",className:`${n1} ${q==="floating"?"border-primary/40 text-primary":"border-transparent text-muted-foreground"}`,onClick:()=>{qe("floating")},children:"浮窗"}),a.jsx("button",{type:"button",disabled:k||!e||jt,"aria-pressed":q==="docked",className:`${n1} ${q==="docked"?"border-primary/40 text-primary":"border-transparent text-muted-foreground"}`,onClick:()=>{qe("docked")},children:"占用分屏"})]}),!w&&a.jsx("nav",{className:"flex gap-1 border-b border-border/15 px-3 py-2",children:[["automation",cu,"自动任务"],["collaboration",Jc,"会话协作"],["search",fu,"全文搜索"]].map(([Ce,ut,Ge])=>a.jsxs("button",{onClick:()=>ze(Ce),className:`${tn} ${ge===Ce?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(ut,{size:14}),Ge]},Ce))}),rr&&a.jsxs("div",{role:"alert",className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:[rr,a.jsx("button",{className:`${tn} ml-2`,onClick:()=>{Se()},children:"重新加载会话"})]}),!w&&ge==="collaboration"&&yt&&["loading","partial","error","unsupported"].includes(yt.state)&&a.jsxs("div",{role:"status",className:"mx-4 mt-3 text-[11px] text-muted-foreground",children:[yt.state==="loading"?"正在加载其他服务的会话;当前服务内可先组队。":yt.state==="unsupported"?"当前客户端不支持跨服务会话,请更新客户端;当前服务内可继续组队。":yt.state==="partial"?"部分服务的协作会话暂不可用;已有成员会保留,恢复后继续同步。":"其他服务的会话暂时加载失败;当前服务内仍可组队。",yt.error&&a.jsx("span",{className:"mt-1 block break-words text-[10px]",children:yt.error}),yt.services?.filter(Ce=>!Ce.connected&&Ce.error).map(Ce=>a.jsxs("span",{className:"mt-1 block break-words text-[10px]",children:[oc({serviceLabel:Ce.label,serviceOrigin:Ce.origin}),":",Ce.error]},Ce.origin)),["partial","error"].includes(yt.state)&&a.jsx("button",{className:`${tn} ml-2`,onClick:B7,children:"重试跨服务连接"})]}),_t&&a.jsx("div",{className:"mx-4 mt-3 text-[11px] text-muted-foreground",children:_t}),Te&&a.jsx("div",{className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:Te}),$e&&!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(ya,{size:13}),$e]}),a.jsxs("div",{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain ${w?"p-3":"p-4"}`,children:[ge==="automation"&&a.jsx(DQ,{automations:Ke,runs:z,agents:nt,sessions:st,activeSessionId:e,busy:je,setBusy:wt,setError:pe,setNotice:pt,refresh:Se,onClose:l}),ge==="collaboration"&&!Ze&&!ce&&a.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"正在恢复消息面板…"}),ge==="collaboration"&&t&&!Pe&&a.jsxs("div",{role:"status",className:"space-y-2 text-[11px] text-muted-foreground",children:[a.jsx("p",{children:Tt==="loading"?"正在加载协作组…":Tt==="error"?"协作组加载失败,恢复连接后可重试。":"此协作组暂不可用,已释放分屏位置。草稿和布局偏好仍保留。"}),Tt!=="loading"&&a.jsx("button",{className:tn,onClick:()=>{Se()},children:"重新加载"})]}),ce&&a.jsx("p",{role:"alert",className:"text-[11px] text-destructive",children:ce}),ge==="collaboration"&&Ze&&(!t||Pe)&&a.jsx(QQ,{notice:$e,initialDrafts:g,onDraftChange:b,docked:de,inputKeySuffix:h?":overlay":"",selectedGroupId:N,setSelectedGroupId:R,floatingVisible:ue,floating:w,sessionsState:Tt,groups:X,sessions:st,agents:nt,activeSessionId:e,initialGroupId:t,defaultSessionMode:i,busy:je,setBusy:wt,setError:pe,setNotice:pt,refresh:Se}),ge==="search"&&a.jsx(zQ,{onClose:l,onNewSession:u,setError:pe})]}),w&&!de&&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:Ce=>{Ce.preventDefault(),xe.current=!0,Ce.currentTarget.setPointerCapture(Ce.pointerId)},onPointerMove:Ce=>{if(!Ce.currentTarget.hasPointerCapture(Ce.pointerId))return;const ut=window.visualViewport,Ge=ut?.width??window.innerWidth,dr=ut?.height??window.innerHeight;V({width:Math.min(1,Math.max(280,Ce.clientX-me.x)/Ge),height:Math.min(1,Math.max(220,Ce.clientY-me.y)/dr)})},onPointerUp:()=>{xe.current=!1;const Ce=ve.current?.getBoundingClientRect(),ut=window.visualViewport;Ce&&(_e.current=Fm(me.x,me.y,(ut?.offsetLeft??0)+12,(ut?.offsetTop??0)+12,(ut?.width??window.innerWidth)-Ce.width-24,(ut?.height??window.innerHeight)-Ce.height-24)),U&&ol({size:U,position:_e.current},t).catch(()=>ke("浮窗大小保存失败,请重新调整重试"))},onPointerCancel:()=>{xe.current=!1},onKeyDown:Ce=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(Ce.key))return;Ce.preventDefault();const ut=ve.current?.getBoundingClientRect(),Ge={width:Math.max(.15,Math.min(1,(U?.width??(ut?.width??400)/window.innerWidth)+(Ce.key==="ArrowRight"?.03:Ce.key==="ArrowLeft"?-.03:0))),height:Math.max(.15,Math.min(1,(U?.height??(ut?.height??300)/window.innerHeight)+(Ce.key==="ArrowDown"?.03:Ce.key==="ArrowUp"?-.03:0)))};V(Ge),ol({size:Ge},t).catch(()=>ke("浮窗大小保存失败,请重试"))},children:a.jsx("span",{"aria-hidden":"true",children:"⌟"})})]})]}),de?O:document.body)}function DQ({automations:e,runs:t,agents:r,sessions:n,activeSessionId:i,busy:l,setBusy:u,setError:h,setNotice:p,refresh:g,onClose:x}){const[b,w]=y.useState(null),[A,k]=y.useState(!1),[I,N]=y.useState(null),R=async(D,O,q)=>{u(D),h(null),p(null);try{await O(),await g(),p(q)}catch(Y){h(Y instanceof Error?Y.message:"操作失败")}finally{u(null)}};return a.jsxs("div",{className:"space-y-4",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:"按计划把任务交给 Agent。每次运行都有独立会话和结果入口。"})]}),!A&&e.length>0&&a.jsxs("button",{className:`${tn} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{w(null),k(!0),p(null)},children:[a.jsx(bi,{size:13}),"新建任务"]})]}),A&&a.jsx(BQ,{agents:r,sessions:n,activeSessionId:i,initial:b,onCancel:()=>{w(null),k(!1)},onSaved:async D=>{w(null),k(!1),await g(),p(b?`“${D}”已更新`:`“${D}”已创建,将按计划自动运行`)},setError:h}),e.length===0&&!A&&a.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[a.jsx(L9,{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:`${tn} mt-4 bg-primary text-primary-foreground`,onClick:()=>k(!0),children:[a.jsx(bi,{size:13}),"创建第一个任务"]})]}),a.jsx("div",{className:"space-y-2",children:e.map(D=>{const O=t.find(Y=>Y.automationId===D.id),q=r.find(Y=>Y.command===D.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:D.name}),a.jsx("span",{className:`rounded-full px-2 py-0.5 text-[9px] ${D.enabled?"bg-primary/10 text-primary":"bg-surface-elevated text-muted-foreground"}`,children:D.enabled?"已启用":"已停用"}),D.lastRunStatus&&a.jsx("span",{className:`text-[10px] ${qQ(D.lastRunStatus)}`,children:VQ(D.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(cu,{size:11}),WQ(D)]}),a.jsx("span",{children:D.enabled&&D.nextRunAt?`下次 ${gh(D.nextRunAt)}`:"不会自动运行"})]}),a.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:D.targetSessionId?`发送到 ${n.find(Y=>Y.sessionId===D.targetSessionId)?.name??"指定会话"}`:`新建 ${q?.displayName??"Agent"} 会话 · ${D.cwd}`}),a.jsx("p",{className:"mt-2 line-clamp-2 text-[11px] leading-relaxed text-foreground/80",children:D.prompt}),D.lastRunAt&&a.jsxs("p",{className:"mt-2 text-[10px] text-muted-foreground",children:["上次 ",gh(D.lastRunAt),D.lastRunMessage?` · ${D.lastRunMessage}`:""]})]}),a.jsx("button",{"aria-label":`编辑 ${D.name}`,title:"编辑",className:"rounded-lg p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",onClick:()=>{w(D),k(!0),p(null)},children:a.jsx(jx,{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:I===D.id?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"mr-auto text-[10px] text-destructive",children:"删除后不会再自动运行"}),a.jsx("button",{className:`${tn} bg-surface-elevated text-foreground`,onClick:()=>N(null),children:"取消"}),a.jsxs("button",{disabled:l!==null,className:`${tn} bg-destructive text-destructive-foreground`,onClick:()=>{R(`delete:${D.id}`,()=>Q7(D.id),`“${D.name}”已删除`).then(()=>N(null))},children:[l===`delete:${D.id}`?a.jsx(xs,{size:13,className:"animate-spin"}):a.jsx(yi,{size:13}),"确认删除"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:`${tn} mr-auto px-2 text-destructive hover:bg-destructive/10`,onClick:()=>N(D.id),children:[a.jsx(yi,{size:13}),"删除"]}),a.jsxs("button",{disabled:l!==null,className:`${tn} ${D.enabled?"bg-surface-elevated text-foreground":"bg-primary/15 text-primary"}`,onClick:()=>{R(`toggle:${D.id}`,()=>j7(D.id,!D.enabled),D.enabled?`“${D.name}”已暂停,不会自动运行`:`“${D.name}”已恢复,将按原计划运行`)},children:[l===`toggle:${D.id}`?a.jsx(xs,{size:13,className:"animate-spin"}):D.enabled?a.jsx(Dw,{size:13}):a.jsx(Bm,{size:13}),D.enabled?"暂停":"恢复"]}),O?.frontendSessionId&&a.jsxs("button",{className:`${tn} bg-surface-elevated text-foreground`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:O.frontendSessionId})),x()},children:[a.jsx(c1,{size:13}),"打开上次会话"]}),a.jsxs("button",{disabled:l!==null,className:`${tn} bg-primary/15 text-primary`,onClick:()=>{R(`run:${D.id}`,()=>P7(D.id),`“${D.name}”已投递,可打开会话查看进度`)},children:[l===`run:${D.id}`?a.jsx(xs,{size:13,className:"animate-spin"}):a.jsx(Bm,{size:13}),"立即运行"]})]})})]},D.id)})})]})}function BQ({agents:e,sessions:t,activeSessionId:r,initial:n,onCancel:i,onSaved:l,setError:u}){const[h,p]=y.useState(n?.name??""),g=t.find(z=>z.sessionId===r),x=n?.cwd??g?.cwd??t[0]?.cwd??"",[b,w]=y.useState(x),[A,k]=y.useState(!1),[I,N]=y.useState(()=>e.find(z=>z.command===n?.command)?.slug??""),[R,D]=y.useState(n?.prompt??""),[O,q]=y.useState(n?.targetSessionId??""),[Y,U]=y.useState(n?.targetSessionId?"existing":"new"),[V,me]=y.useState(n?.schedule.kind??"interval"),[Je,ve]=y.useState(n?.schedule.kind==="interval"?n.schedule.everyMinutes:60),[_e,Ze]=y.useState(n?.schedule.kind==="daily"?n.schedule.time:"09:00"),[Ve,ce]=y.useState(n?.schedule.kind==="daily"?n.schedule.weekdays:[1,2,3,4,5]),[ke,ot]=y.useState(n?.enabled??!0),[Ie,de]=y.useState(!1),xe=(e.find(z=>z.slug===I)??null)?.command??n?.command??"";y.useEffect(()=>{!n&&!I&&e[0]&&N(e[0].slug)},[e,n,I]);const te=async()=>{de(!0),u(null);try{await z7({id:n?.id,name:h,cwd:b,command:Y==="new"?xe:"",prompt:R,targetSessionId:Y==="existing"&&O||null,enabled:ke,schedule:V==="interval"?{kind:V,everyMinutes:Je}:{kind:V,time:_e,weekdays:Ve}}),await l(h.trim())}catch(z){u(z instanceof Error?z.message:"保存失败")}finally{de(!1)}},re=V==="interval"?{kind:V,everyMinutes:Je}:{kind:V,time:_e,weekdays:Ve},[ge,ze]=_e.split(":"),Ke=(z,Oe)=>Ze(`${z}:${Oe}`),Ae=!!(h.trim()&&R.trim()&&(Y==="existing"?O:xe)&&(V==="interval"?Je>=1:Ve.length>0));return a.jsxs("div",{className:"overflow-hidden rounded-xl border border-primary/25 bg-primary/5",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-primary/15 px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[13px] font-medium text-foreground",children:n?"编辑自动任务":"创建自动任务"}),a.jsx("p",{className:"mt-0.5 text-[10px] text-muted-foreground",children:"三步完成,保存后可立即试跑"})]}),a.jsx("button",{className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:i,"aria-label":"关闭任务表单",children:a.jsx(gs,{size:14})})]}),a.jsxs("div",{className:"space-y-5 p-4",children:[a.jsxs("fieldset",{className:"space-y-3",children:[a.jsxs("legend",{className:"text-[11px] font-medium text-foreground",children:[a.jsx("span",{className:"mr-2 text-primary",children:"1"}),"要做什么"]}),a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["任务名称",a.jsx("input",{autoFocus:!0,className:Li,value:h,onChange:z=>p(z.target.value),placeholder:"例如:每日代码巡检"})]}),a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["任务内容",a.jsx("textarea",{className:`${Li} min-h-24 resize-y`,value:R,onChange:z=>D(z.target.value),placeholder:"说明目标、检查范围和期望产出,例如:检查当前分支的测试与待办,修复可安全处理的问题并总结结果。"})]})]}),a.jsxs("fieldset",{className:"space-y-3 border-t border-border/10 pt-4",children:[a.jsxs("legend",{className:"text-[11px] font-medium text-foreground",children:[a.jsx("span",{className:"mr-2 text-primary",children:"2"}),"在哪里运行"]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("button",{type:"button","aria-pressed":Y==="new",className:`${tn} justify-start border px-3 text-left ${Y==="new"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>U("new"),children:"每次新建会话"}),a.jsx("button",{type:"button","aria-pressed":Y==="existing",disabled:t.length===0,className:`${tn} justify-start border px-3 text-left ${Y==="existing"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>{U("existing"),O||q(r??t[0]?.sessionId??"")},children:"发送到现有会话"})]}),Y==="new"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("label",{className:"space-y-1 text-[10px] text-muted-foreground",children:["Agent / Plugin",a.jsxs("select",{className:Li,value:I,onChange:z=>N(z.target.value),children:[n&&!e.some(z=>z.command===n.command)&&a.jsx("option",{value:"",children:"原 Agent 当前不可用"}),e.map(z=>a.jsxs("option",{value:z.slug,children:[z.displayName,z.isPlugin?" · Plugin":""]},z.slug))]})]}),a.jsxs("label",{className:"space-y-1 text-[10px] text-muted-foreground",children:["工作目录",a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{className:Li,value:b,onChange:z=>w(z.target.value),placeholder:"默认使用当前目录"}),a.jsxs("button",{type:"button","aria-haspopup":"dialog",className:`${tn} shrink-0 bg-surface-2 text-foreground`,onClick:()=>k(!0),children:[a.jsx(Vc,{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.jsx("select",{className:Li,value:O,onChange:z=>q(z.target.value),children:t.map(z=>a.jsxs("option",{value:z.sessionId,children:[z.name," · ",z.status]},z.sessionId))}),a.jsx("span",{className:"block leading-relaxed",children:"运行时该会话需要在线,并且 Agent 处于可接收任务的状态。"})]})]}),a.jsxs("fieldset",{className:"space-y-3 border-t border-border/10 pt-4",children:[a.jsxs("legend",{className:"text-[11px] font-medium text-foreground",children:[a.jsx("span",{className:"mr-2 text-primary",children:"3"}),"什么时候运行"]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("button",{type:"button","aria-pressed":V==="interval",className:`${tn} border ${V==="interval"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>me("interval"),children:"固定间隔"}),a.jsx("button",{type:"button","aria-pressed":V==="daily",className:`${tn} border ${V==="daily"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>me("daily"),children:"指定日期与时间"})]}),V==="interval"?a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["每隔多少分钟",a.jsx("input",{className:Li,type:"number",min:1,max:43200,value:Je,onChange:z=>ve(Number(z.target.value))}),a.jsx("span",{className:"block",children:"例如 60 = 每小时,1440 = 每天。始终按任务创建时间计算,之后编辑不会重置节奏。"})]}):a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"运行时间"}),a.jsxs("div",{className:"mt-1 flex items-center rounded-xl border border-border/20 bg-surface-2 px-3 py-2.5 focus-within:border-primary/60",children:[a.jsx(cu,{size:15,className:"mr-3 shrink-0 text-primary"}),a.jsx(H5,{label:"小时",value:ge,options:24,onChange:z=>Ke(z,ze)}),a.jsx("span",{"aria-hidden":"true",className:"px-2 text-[18px] font-medium text-muted-foreground",children:":"}),a.jsx(H5,{label:"分钟",value:ze,options:60,onChange:z=>Ke(ge,z)}),a.jsx("span",{className:"ml-3 shrink-0 rounded-md bg-surface-elevated px-2 py-1 text-[9px] font-medium text-muted-foreground",children:"24 小时制"})]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"运行日期"}),a.jsx("div",{className:"mt-1 grid grid-cols-7 gap-1",children:["日","一","二","三","四","五","六"].map((z,Oe)=>{const nt=Ve.includes(Oe);return a.jsx("button",{type:"button","aria-pressed":nt,"aria-label":`星期${z}`,className:`rounded-lg py-2.5 text-[10px] transition ${nt?"bg-primary text-primary-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,onClick:()=>ce(Re=>nt?Re.filter(X=>X!==Oe):[...Re,Oe].sort()),children:z},Oe)})}),Ve.length===0&&a.jsx("p",{className:"mt-1 text-[10px] text-destructive",children:"至少选择一天"})]})]})]})]}),a.jsxs("div",{className:"flex flex-col gap-3 border-t border-primary/15 bg-surface/50 px-4 py-3 sm:flex-row sm:items-center",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:ke,onChange:z=>ot(z.target.checked)}),"保存后启用"]}),a.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:ke&&Ae?`${n?"下次运行":"首次运行"}:${gh(GQ(re,Date.now(),n?.createdAt))}`:ke?"填写完整后显示首次运行时间":"任务会保存,但不会自动运行"})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{className:`${tn} bg-surface-2 text-foreground`,onClick:i,children:"取消"}),a.jsx("button",{disabled:Ie||!Ae,className:`${tn} bg-primary text-primary-foreground`,onClick:()=>{te()},children:Ie?"保存中…":n?"保存修改":"创建任务"})]})]}),a.jsx(Y1,{open:A,initialPath:b||x||"/",title:"选择工作目录",labels:{hint:"进入文件夹,确认后才会更改工作目录。",cancel:"取消",confirm:"使用此目录",close:"关闭",parent:"上一级目录"},onCancel:()=>k(!1),onConfirm:z=>{w(z),k(!1)}})]})}function H5({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 u=String(l).padStart(2,"0");return a.jsx("option",{value:u,children:u},u)})}),a.jsx(Oo,{"aria-hidden":"true",size:13,className:"pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground"})]})}function QQ({notice:e,initialDrafts:t,onDraftChange:r,docked:n,inputKeySuffix:i,selectedGroupId:l,setSelectedGroupId:u,floatingVisible:h,floating:p,sessionsState:g,groups:x,sessions:b,agents:w,activeSessionId:A,initialGroupId:k,defaultSessionMode:I,busy:N,setBusy:R,setError:D,setNotice:O,refresh:q}){const[Y,U]=y.useState(""),[V,me]=y.useState(()=>new Set(A?[A]:[])),[Je,ve]=y.useState(""),[_e,Ze]=y.useState(()=>new Set),[Ve,ce]=y.useState(!1),[ke,ot]=y.useState([]),[Ie,de]=y.useState(!1),[qe,xe]=y.useState(null),[te,re]=y.useState("all"),[ge,ze]=y.useState(!0),[Ke,Ae]=y.useState(new Set),[z,Oe]=y.useState(null),[nt,Re]=y.useState(""),[X,Be]=y.useState(!1),[st,be]=y.useState(null),[je,wt]=y.useState(new Set),[Te,pe]=y.useState(),[$e,pt]=y.useState({}),[Tt,Ct]=y.useState(!1),[rr,ir]=y.useState(""),[yt,bt]=y.useState(""),[_t,Qt]=y.useState(""),[Et,Ht]=y.useState(""),ne=y.useRef(null),Pe=n,it=(l??x[0]?.id??"")+i,jt=y.useRef(!1),ue=l==="new"?null:(l?x.find(Z=>Z.id===l):x[0])??null,[Nt,qt]=y.useState(0),Se=y.useRef(new Map(Object.entries(t??{}))),Ce=y.useRef(void 0),ut=y.useRef(!1),Ge=y.useRef(z);Ge.current=z;const dr=y.useRef(nt);dr.current=nt,y.useLayoutEffect(()=>{if(Ce.current===ue?.id)return;if(Ce.current){const He={content:dr.current,targets:z};Se.current.set(Ce.current,He),ol({drafts:{[Ce.current]:He}}).catch(()=>D("草稿保存失败,请返回该组重试"))}Ce.current=ue?.id,ut.current=!0;const Z=Se.current.get(ue?.id??"");Re(Z?.content??""),Oe(Z?.targets??null)},[ue?.id]),y.useEffect(()=>{be(null)},[ue?.id]);const Rt=y.useRef(null),un=y.useRef(t);y.useLayoutEffect(()=>{if(un.current===t)return;un.current=t;for(const[He,xt]of Object.entries(t??{}))Se.current.set(He,xt);const Z=t?.[ue?.id??""];!Z||Z.content===dr.current&&JSON.stringify(Z.targets)===JSON.stringify(Ge.current)||(ut.current=!0,Rt.current=null,Re(Z.content),Oe(Z.targets))},[t,ue?.id]);const It=y.useCallback(Z=>{ol(Z).catch(()=>D("草稿保存失败,请保持面板打开,修改内容后重试"))},[D]);y.useEffect(()=>{if(ut.current){ut.current=!1;return}if(!ue||Ce.current!==ue.id)return;const Z={drafts:{[ue.id]:{content:nt,targets:z}}};r(ue.id,Z.drafts[ue.id]),Rt.current=Z;const He=setTimeout(()=>{Rt.current=null,It(Z)},400);return()=>{clearTimeout(He)}},[ue?.id,nt,z,It]),y.useEffect(()=>{const Z=()=>{Rt.current&&(It(Rt.current),Rt.current=null)},He=()=>{document.visibilityState==="hidden"&&Z()};return document.addEventListener("visibilitychange",He),window.addEventListener("pagehide",Z),()=>{document.removeEventListener("visibilitychange",He),window.removeEventListener("pagehide",Z),Z()}},[It]),y.useEffect(()=>{if(!(!p||!h||!ue))return O7(Z=>{Re(He=>He+(He&&!/\s$/.test(He)?`
|
|
128
|
-
`:"")+Z.replace(/\r\n?/g,`
|
|
129
|
-
`))},it,Pe)},[p,h,ue?.id,Pe,it]),y.useEffect(()=>{const Z=ne.current;if(!p||!Z)return;const He=xt=>D(String(xt.detail));return Z.addEventListener("termdock:file-drop-error",He),()=>Z.removeEventListener("termdock:file-drop-error",He)},[p,ue?.id,D]);const jn=async Z=>{const He=ue?.id;D(null),qt(xt=>xt+1);try{const xt=await _u("/tmp",Z);if(xt.files.length!==Z.length||xt.files.some(Gt=>!Gt.path))throw new Error("文件路径准备失败,请重试");const cr=xt.files.map(Gt=>K0(Gt.path)).join(" ")+" ";if(Ce.current===He)Re(Gt=>Gt+(Gt&&!/\s$/.test(Gt)?`
|
|
130
|
-
`:"")+cr);else if(He){const Gt=Se.current.get(He)??{content:"",targets:null},At={...Gt,content:Gt.content+`
|
|
131
|
-
`+cr};Se.current.set(He,At),It({drafts:{[He]:At}})}}catch(xt){D(xt instanceof Error?xt.message:"文件上传失败")}finally{qt(xt=>xt-1)}},is=new Set(b.filter(rp).map(Z=>Z.sessionId)),Pn=V.size,Tr=[...V].filter(Z=>!is.has(Z)),In=PQ(ue,b),Br=Je.trim().toLocaleLowerCase(),ie=b.filter(Z=>!Br||[Z.name,Z.serviceLabel??"",Z.cwd,ip(Z.currentTask)].some(He=>He.toLocaleLowerCase().includes(Br))),$r=W5(ie),ft=W5(In),hr=Z=>!Br&&_e.has(Z),Ls=Z=>Ze(He=>{const xt=new Set(He);return xt.has(Z)?xt.delete(Z):xt.add(Z),xt});y.useEffect(()=>{!l&&x[0]&&u(x[0].id)},[x,l]),y.useEffect(()=>{Be(!1),Ct(!1);try{Ae(new Set(JSON.parse(localStorage.getItem(`collab-seen:${ue?.id}`)??"[]")))}catch{Ae(new Set)}wt(new Set(ue?.sessionIds??[]))},[ue?.id]),y.useEffect(()=>{!rr&&w[0]&&ir(w[0].slug)},[w,rr]),y.useEffect(()=>{if(ot([]),xe(null),!ue){de(!1);return}de(!0);let Z=!1,He=0;const xt=()=>{const Gt=++He;Lm(ue.id).then(At=>{!Z&&Gt===He&&(ot(At.messages),xe(null))}).catch(At=>{!Z&&Gt===He&&xe(At instanceof Error?At.message:"消息加载失败")}).finally(()=>{!Z&&Gt===He&&de(!1)})};xt();const cr=window.setInterval(xt,3e3);return()=>{Z=!0,window.clearInterval(cr)}},[ue?.id]),y.useEffect(()=>{!k||ue?.id!==k||jt.current||(jt.current=!0,ne.current?.scrollIntoView?.({block:"nearest"}))},[k,ue?.id]);const Un=async()=>{R("create-group"),D(null),O(null);try{if(Tr.length)throw new Error("所选会话已变化,请先清除不可用选择");const Z=await Gc({name:Y,sessionIds:[...V]});U(""),ve(""),u(Z.group.id),await q(),O(`“${Z.group.name}”已创建,${Z.group.sessionIds.length} 个会话可以开始协作`)}catch(Z){D(Z instanceof Error?Z.message:"创建失败")}finally{R(null)}},as=ue?.sessionIds.filter(Z=>z===null||z.includes(Z))??[],Pr=async()=>{if(!ue||N||Nt||!nt.trim()||!as.length)return;const Z=nt,He=ue.id;R("send-message"),D(null),O(null);try{const xt=await $7(ue.id,{fromSessionId:null,toSessionIds:z===null?void 0:as,kind:"message",content:nt});if(Ce.current===He){const hn=dr.current,nn=hn===Z?"":hn.startsWith(Z)?hn.slice(Z.length).replace(/^\n/,""):hn;Re(nn),It({drafts:{[He]:{content:nn,targets:Ge.current}}})}else{const hn=Se.current.get(He);if(hn){const nn={...hn,content:hn.content===Z?"":hn.content.startsWith(Z)?hn.content.slice(Z.length).replace(/^\n/,""):hn.content};Se.current.set(He,nn),It({drafts:{[He]:nn}})}}const cr=await Lm(He).catch(()=>null);cr&&Ce.current===He&&ot(cr.messages);const Gt=xt.deliveries?.filter(hn=>hn.serviceUnavailable).length??0,At=xt.deliveries?.filter(hn=>hn.pending>0).length??0;O(Gt>0?`已保存消息;${Gt} 个接收成员的服务不可达,尚未送达,等待重连`:At>0?`已保存消息;${At} 个成员等待投递确认`:`消息已送达 ${xt.messages.length} 个会话`)}catch(xt){D(xt instanceof Error?xt.message:"发送失败")}finally{R(null)}},Yt=async()=>{if(!ue)return;R(`delete:${ue.id}`),D(null),O(null);const Z=ue.name;try{await bp(ue.id),u(null),ce(!1),await q(),O(`“${Z}”已删除`)}catch(He){D(He instanceof Error?He.message:"删除失败")}finally{R(null)}},Xn=async()=>{if(!ue)return;const Z=[...je];R("save-members"),D(null),O(null);try{const He=await Gc({id:ue.id,name:ue.name,sessionIds:Z,expectedUpdatedAt:Te});u(He.group.id),Be(!1),await q(),O(`“${ue.name}”成员已更新,共 ${Z.length} 个会话`)}catch(He){D(He instanceof Error?He.message:"成员更新失败")}finally{R(null)}},dn=async Z=>{if(!ue||!ue.sessionIds.includes(Z)){be(null);return}const He=b.find(Gt=>Gt.sessionId===Z)?.name??Z,xt=ue.name,cr=ue.sessionIds.length<=2;R(`remove-member:${Z}`),D(null),O(null);try{cr?await bp(ue.id,ue.updatedAt):await Gc({id:ue.id,name:xt,sessionIds:ue.sessionIds.filter(Gt=>Gt!==Z),expectedUpdatedAt:ue.updatedAt}),be(null),wt(Gt=>new Set([...Gt].filter(At=>At!==Z))),pt(Gt=>Object.fromEntries(Object.entries(Gt).filter(([At])=>At!==Z))),cr&&u(null),await q(),O(cr?`“${xt}”已删除:移出“${He}”后不足两个成员`:`已把“${He}”移出“${xt}”`)}catch(Gt){D(Gt instanceof Error?Gt.message:cr?"删除协作组失败":"移出成员失败")}finally{R(null)}},kr=async Z=>{if(!ue)return;const He=$e[Z]??"";R(`role:${Z}`),D(null),O(null);try{await H7(ue.id,Z,He.trim()||null),await q(),O(He.trim()?"定位已保存,该成员每次收到消息都会看到":"定位已清除")}catch(xt){D(xt instanceof Error?xt.message:"定位保存失败")}finally{R(null)}},Or=()=>{const Z=b.find(He=>He.sessionId===A)?.cwd??b.find(He=>ue?.sessionIds.includes(He.sessionId))?.cwd??"";Qt(Z),bt(""),Ht(""),Ct(!0),Be(!1)},Ur=async()=>{if(!(!ue||!rr)){R("spawn-agent"),D(null),O(null);try{const Z=await U7(ue.id,{agentSlug:rr,name:yt.trim()||void 0,cwd:_t.trim()||void 0,task:Et.trim()||void 0,mode:I});Ct(!1),await q(),O(`“${Z.session.name}”已创建并加入“${Z.group.name}”`)}catch(Z){D(Z instanceof Error?Z.message:"Agent Session 创建失败")}finally{R(null)}}},qr=ke.filter(Z=>(!ge||!Ke.has(Z.id))&&(te==="all"||Z.responseKind===te)),An=$Q(qr,b),Yr=()=>{const Z=new Set([...Ke,...qr.map(He=>He.id)].slice(-1e4));try{localStorage.setItem(`collab-seen:${ue?.id}`,JSON.stringify([...Z]))}catch{D("无法保存已看记录,请检查浏览器存储空间");return}Ae(Z)},jr=Z=>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:!rp(Z),checked:V.has(Z.sessionId),onChange:()=>me(He=>{const xt=new Set(He);return xt.has(Z.sessionId)?xt.delete(Z.sessionId):xt.add(Z.sessionId),xt})}),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:Z.name}),a.jsx(np,{session:Z}),a.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:sp(Z)})]}),a.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[ip(Z.currentTask)," · ",Z.cwd]})]})]},Z.sessionId),En=Z=>{const He=$e[Z.sessionId]??"",xt=ue?.roles?.[Z.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:!ue?.sessionIds.includes(Z.sessionId)&&!rp(Z),checked:je.has(Z.sessionId),onChange:()=>wt(cr=>{const Gt=new Set(cr);return Gt.has(Z.sessionId)?Gt.delete(Z.sessionId):Gt.add(Z.sessionId),Gt})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-[11px] text-foreground",children:Z.name}),a.jsx(np,{session:Z}),a.jsxs("span",{className:"block truncate text-[9px] text-muted-foreground",children:[sp(Z)," · ",Z.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":`${Z.name} 的定位`,className:`${Li} min-h-8 py-1 text-[10px]`,value:He,maxLength:200,placeholder:"成员收到的定位;清空后保存可移除",onChange:cr=>pt(Gt=>({...Gt,[Z.sessionId]:cr.target.value}))}),a.jsx("button",{"aria-label":`保存 ${Z.name} 的定位`,title:He.trim()===xt?"定位未变化":"保存此成员的定位",disabled:N!==null||He.trim()===xt,className:`${tn} min-h-8 shrink-0 px-2 text-muted-foreground`,onClick:()=>{kr(Z.sessionId)},children:N===`role:${Z.sessionId}`?a.jsx(xs,{size:12,className:"animate-spin"}):a.jsx(ya,{size:12})})]})]},Z.sessionId)};return a.jsxs("div",{className:p?"space-y-0":"space-y-5",children:[qe&&a.jsxs("p",{role:"alert",className:"mb-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:["消息同步暂时失败,正在自动重试:",qe]}),a.jsxs("div",{hidden:p,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:"创建协作组后,一个 Agent 会话可以把任务直接交给另一个会话。比如“开发”写完代码后通知“测试”检查,测试结果再回复回来;你也可以给单个会话或全组发任务,所有交接和进展都记录在这里。"})]}),ue&&a.jsxs("button",{className:`${tn} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{u("new"),ce(!1),O(null)},children:[a.jsx(bi,{size:13}),"新建组"]})]}),x.length>0&&a.jsx("div",{className:"flex gap-2 overflow-x-auto border-b border-border/15 pb-3",children:x.map(Z=>a.jsxs("button",{onClick:()=>u(Z.id),className:`${tn} shrink-0 ${ue?.id===Z.id?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground"}`,children:[Z.name,a.jsx("span",{className:"text-[9px] opacity-70",children:Z.sessionIds.length})]},Z.id))}),!ue&&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] ${Pn>=2?"text-primary":"text-muted-foreground"}`,children:["已选 ",Pn," 个"]})]}),a.jsxs("label",{className:"mt-4 block space-y-1 text-[10px] text-muted-foreground",children:["协作组名称",a.jsx("input",{className:Li,value:Y,onChange:Z=>U(Z.target.value),placeholder:"例如:发布准备"})]}),b.length>5&&a.jsxs("label",{className:"relative mt-3 block",children:[a.jsx("span",{className:"sr-only",children:"筛选会话"}),a.jsx(fu,{size:13,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{className:`${Li} pl-8`,value:Je,onChange:Z=>ve(Z.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:[$r.length<=1?ie.map(jr):$r.map(Z=>{const He=hr(Z.key);return a.jsxs("div",{children:[a.jsx(G5,{label:Z.label,count:Z.sessions.length,collapsed:He,onToggle:()=>Ls(Z.key)}),!He&&a.jsx("div",{className:"divide-y divide-border/10",children:Z.sessions.map(jr)})]},Z.key)}),b.length===0&&a.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:g==="loading"?"正在加载会话…":g==="error"?"会话加载失败,请重试":"当前服务暂无可选会话"}),b.length>0&&ie.length===0&&a.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:"没有符合筛选条件的会话"})]}),Tr.length>0&&a.jsxs("div",{role:"alert",className:"mt-2 text-[11px] text-destructive",children:["有 ",Tr.length," 个所选会话暂不可用。",a.jsx("button",{className:tn,onClick:()=>me(Z=>new Set([...Z].filter(He=>is.has(He)))),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] ${Pn<2?"text-muted-foreground":"text-primary"}`,children:Pn<2?`还需选择 ${2-Pn} 个会话`:"成员已满足要求,可以创建"}),a.jsxs("div",{className:"flex justify-end gap-2",children:[x.length>0&&a.jsx("button",{className:`${tn} bg-surface-2 text-foreground`,onClick:()=>u(x[0]?.id??null),children:"取消"}),a.jsxs("button",{disabled:N!==null||g!=="loaded"||!Y.trim()||Pn<2||Tr.length>0,className:`${tn} bg-primary text-primary-foreground`,onClick:()=>{Un()},children:[N==="create-group"?a.jsx(xs,{size:13,className:"animate-spin"}):a.jsx(bi,{size:13}),"创建协作组"]})]})]})]})]}),ue&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{hidden:p,children:[a.jsxs("section",{className:"border-y border-border/15 py-4",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:ue.name}),a.jsxs("p",{className:"mt-1 text-[10px] text-muted-foreground",children:[ue.sessionIds.length," 个成员 · 组 ID:",a.jsx("span",{className:"break-all font-mono",children:MQ(ue.id)})]})]}),Ve?a.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[a.jsx("button",{className:`${tn} bg-surface-2 px-2 text-foreground`,onClick:()=>ce(!1),children:"取消"}),a.jsxs("button",{disabled:N!==null,className:`${tn} bg-destructive px-2 text-destructive-foreground`,onClick:()=>{Yt()},children:[N===`delete:${ue.id}`?a.jsx(xs,{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:`${tn} px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>{wt(new Set(ue.sessionIds)),pe(ue.updatedAt);const Z=!X;Be(Z),Z&&pt(Object.fromEntries(ue.sessionIds.map(He=>[He,ue.roles?.[He]??""]))),Ct(!1)},children:[a.jsx(jx,{size:13}),"管理成员"]}),a.jsxs("button",{className:`${tn} px-2 text-primary hover:bg-primary/10`,onClick:Or,children:[a.jsx(bi,{size:13}),"新建 Agent"]}),a.jsx("button",{"aria-label":`删除协作组 ${ue.name}`,title:"删除协作组",disabled:N!==null,className:"rounded-lg p-2 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",onClick:()=>ce(!0),children:a.jsx(yi,{size:14})})]})]}),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:ue.sessionIds.map(Z=>{const He=b.find(At=>At.sessionId===Z),xt=ue.roles?.[Z],cr=He?.name??Z,Gt=ue.sessionIds.length<=2;return a.jsxs("div",{className:`flex min-w-0 items-stretch transition ${st===Z?"bg-destructive/5":"hover:bg-surface-2"}`,children:[a.jsxs("button",{disabled:!He,onClick:()=>He&&void OQ(He).catch(At=>D(At instanceof Error?At.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 ${He?.status==="working"?"bg-primary":He?"bg-[var(--success)]":"bg-muted-foreground"}`}),a.jsx("span",{className:"truncate text-[11px] text-foreground",children:cr}),He&&a.jsx(np,{session:He}),a.jsx("span",{className:"ml-auto shrink-0 text-[9px] text-muted-foreground",children:He?sp(He):"已离线"})]}),a.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-1 text-[9px] text-muted-foreground",children:[xt?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"min-w-0 truncate font-medium text-primary/80",children:["定位:",xt]}),a.jsx("span",{className:"shrink-0 text-muted-foreground/50",children:"·"})]}):null,He?a.jsx("span",{className:"min-w-0 truncate",children:ip(He.currentTask)}):a.jsx("span",{className:"shrink-0",children:"重新上线后可继续接收消息"})]})]}),a.jsx("button",{"aria-label":`把 ${cr} 移出协作组`,"aria-expanded":st===Z,title:Gt?"移出后不足两个成员,将删除协作组":"移出协作组",disabled:N!==null,className:`mr-1 shrink-0 self-center rounded-lg p-2 transition ${st===Z?"text-destructive":"text-muted-foreground hover:bg-destructive/10 hover:text-destructive"}`,onClick:()=>be(st===Z?null:Z),children:a.jsx(yi,{size:13})})]},Z)})}),st&&ue.sessionIds.includes(st)&&(()=>{const Z=b.find(cr=>cr.sessionId===st)?.name??st,He=ue.sessionIds.length<=2,xt=N===`remove-member:${st}`;return a.jsxs("div",{role:"group","aria-label":`确认移除成员 ${Z}`,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:He?`移出“${Z}”后组内不足两个成员,协作组“${ue.name}”和它的 ${ke.length} 条协作记录会一并删除`:`把“${Z}”移出“${ue.name}”?移出后它不再收到这个组的消息,可以随时重新加入`}),a.jsxs("div",{className:"flex shrink-0 gap-2",children:[a.jsx("button",{className:`${tn} min-h-8 bg-surface-2 px-2 text-[10px] text-foreground`,onClick:()=>be(null),children:"取消"}),a.jsxs("button",{disabled:N!==null,className:`${tn} min-h-8 px-2 text-[10px] bg-destructive text-destructive-foreground`,onClick:()=>{dn(st)},children:[xt?a.jsx(xs,{size:12,className:"animate-spin"}):a.jsx(yi,{size:12}),He?"删除协作组":"移出"]})]})]})})(),X&&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:["已选 ",je.size]})]}),a.jsx("div",{className:"mt-3 max-h-72 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:ft.length<=1?In.map(En):ft.map(Z=>{const He=hr(Z.key);return a.jsxs("div",{children:[a.jsx(G5,{label:Z.label,count:Z.sessions.length,collapsed:He,onToggle:()=>Ls(Z.key)}),!He&&a.jsx("div",{className:"divide-y divide-border/10",children:Z.sessions.map(En)})]},Z.key)})}),a.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[a.jsx("button",{className:`${tn} bg-surface-2 text-foreground`,onClick:()=>{Be(!1),pt({})},children:"取消"}),a.jsxs("button",{disabled:N!==null||g!=="loaded"||je.size<2,className:`${tn} bg-primary text-primary-foreground`,onClick:()=>{Xn()},children:[N==="save-members"?a.jsx(xs,{size:13,className:"animate-spin"}):a.jsx(ya,{size:13}),"保存成员"]})]})]}),Tt&&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:Li,value:rr,onChange:Z=>ir(Z.target.value),children:w.map(Z=>a.jsxs("option",{value:Z.slug,children:[Z.displayName,Z.isPlugin?" · Plugin":""]},Z.slug))})]}),a.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["会话名称",a.jsx("input",{"aria-label":"新 Agent 会话名称",className:Li,value:yt,onChange:Z=>bt(Z.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:Li,value:_t,onChange:Z=>Qt(Z.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:`${Li} min-h-16 resize-y`,value:Et,onChange:Z=>Ht(Z.target.value),placeholder:"说明它加入后要先完成什么"})]}),a.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[a.jsx("button",{className:`${tn} bg-surface-2 text-foreground`,onClick:()=>Ct(!1),children:"取消"}),a.jsxs("button",{disabled:N!==null||!rr,className:`${tn} bg-primary text-primary-foreground`,onClick:()=>{Ur()},children:[N==="spawn-agent"?a.jsx(xs,{size:13,className:"animate-spin"}):a.jsx(yh,{size:13}),"创建并加入"]})]})]})]}),a.jsxs("section",{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:[An.length," 条"]})]}),a.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[a.jsxs("select",{"aria-label":"筛选回复类型",className:`${Li} w-auto`,value:te,onChange:Z=>re(Z.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:ge,onChange:Z=>ze(Z.target.checked)}),"只看新记录"]}),a.jsx("button",{className:`${tn} min-h-9 text-muted-foreground`,disabled:!qr.length,onClick:Yr,children:"标记当前记录已看"})]}),a.jsxs("div",{className:"max-h-72 touch-pan-y divide-y divide-border/10 overflow-x-hidden overflow-y-auto overscroll-y-contain border-y border-border/10 [overflow-wrap:anywhere]",children:[An.map(Z=>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:Z.responseKind==="ack"?"收到确认":Z.responseKind==="progress"?"进展":Z.responseKind==="result"?"结果":UQ(Z.kind)}),a.jsx("span",{children:Z.fromName}),a.jsx("span",{children:"→"}),a.jsx("span",{className:"truncate",children:Z.toNames.join("、")}),a.jsx("span",{className:"ml-auto shrink-0",children:new Date(Z.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),a.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[11px] leading-relaxed text-foreground",children:Z.content}),a.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:Z.status==="pending"?"尚未送达 · 等待连接或接收方读取":Z.status==="read"?"接收方已确认读取 · 不代表任务完成":Z.status==="failed"?"投递失败":Z.status==="expired"?"消息已过期,未继续投递":"已写入接收方终端 · 等待接手确认"}),(Z.task||Z.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(Z.task??{failure_reason:Z.failureReason},null,2)})]})]},Z.key)),An.length===0&&a.jsx(YQ,{text:Ie?"正在加载协作记录…":ke.length?"没有符合筛选条件的新记录。可切换类型或取消“只看新记录”。":"还没有消息。可以先发一个任务或问题。"})]})]})]}),a.jsxs("section",{onFocusCapture:()=>_m(it),onPointerDownCapture:()=>_m(it),"data-termdock-terminal-dropzone":p?A??"collaboration-composer":void 0,onDragOver:Z=>{p&&Z.preventDefault()},onDrop:Z=>{if(!p)return;const He=Array.from(Z.dataTransfer.files);if(!(He.length&&fo()))if(Z.preventDefault(),Z.stopPropagation(),He.length)jn(He);else{const xt=Z.dataTransfer.getData("text/plain")||Z.dataTransfer.getData("text/uri-list");xt&&Re(cr=>cr+(cr?`
|
|
132
|
-
`:"")+xt)}},ref:ne,className:p?"":"border-t border-primary/20 bg-primary/5 px-3 py-3",children:[!p&&a.jsx("h4",{className:"text-[11px] font-medium text-foreground",children:"发送给成员"}),a.jsx("div",{className:p?"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:"全组成员"},...ue.sessionIds.map(Z=>({id:Z,label:P6(b.find(He=>He.sessionId===Z),b.filter(He=>ue.sessionIds.includes(He.sessionId)))??`${Z.slice(0,8)}(离线)`}))].map(({id:Z,label:He})=>{const xt=Z==="*"?z===null:z?.includes(Z)??!1;return a.jsxs("button",{type:"button","aria-pressed":xt,onClick:()=>Oe(cr=>Z==="*"?null:cr?.includes(Z)?cr.filter(Gt=>Gt!==Z):[...cr??[],Z]),className:`${n1} max-w-full gap-1 ${xt?"border-primary/40 bg-primary/15 text-primary":"border-border/20 bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[xt&&a.jsx(ya,{size:12,"aria-hidden":"true",className:"shrink-0"}),a.jsx("span",{className:"break-words text-left",children:He})]},Z)})})]})}),a.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["内容",a.jsx("textarea",{onKeyDown:Z=>{Z.key==="Enter"&&(Z.metaKey||Z.ctrlKey)&&!Z.nativeEvent.isComposing&&Z.keyCode!==229&&(Z.preventDefault(),Pr())},onPaste:Z=>{const He=Array.from(Z.clipboardData.files);He.length&&(Z.preventDefault(),jn(He))},className:`${Li} min-h-16 max-h-48 resize-y`,value:nt,onChange:Z=>Re(Z.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:p&&e?e:void 0,className:`min-w-0 flex-1 text-[9px] leading-relaxed ${p?"truncate":""} ${p&&e?"text-primary":"text-muted-foreground"}`,children:Nt>0?"正在准备文件路径…":p&&e?e:ue.federated?"消息由服务端后台投递,可查看送达结果;无需保持客户端在线。":"在线成员立即入队;离线成员上线后送达。"}),a.jsxs("button",{disabled:N!==null||Nt>0||!nt.trim()||!as.length,className:`${tn} shrink-0 bg-primary text-primary-foreground`,title:"发送(⌘ / Ctrl + Enter)",onClick:()=>{Pr()},children:[N==="send-message"?a.jsx(xs,{size:13,className:"animate-spin"}):null,"发送"]})]})]})]})]})}function rp(e){return!o1(e.sessionId)||e.serviceConnected!==!1}function jQ(e){return e.serviceOrigin?e.serviceOrigin===window.location.origin?"":e.serviceOrigin:o1(e.sessionId)?.origin??""}function W5(e){const t=new Map;for(const r of e){const n=jQ(r),i=t.get(n)??{key:n,label:n?oc(r):"本机服务",sessions:[]};n&&i.label==="远端服务"&&(i.label=oc(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 G5({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(Oo,{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 PQ(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,...o1(n)?{serviceConnected:!1}:{}})}return[...r.values()]}function np({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(c1,{size:9}),a.jsx("span",{className:"truncate",children:oc(e)})]})}function sp(e){return e.serviceConnected===!1?"服务不可达":FQ(e.status)}function P6(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:")?oc(e):"本机服务";return r?`${e.name} · ${n}`:e.name}async function OQ(e){e.sessionId.startsWith("remote:")?await m6(e.sessionId):window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e.sessionId}))}function FQ(e){return e==="working"?"处理中":e==="idle"||e==="done"?"可接收":e==="offline"?"已离线":"在线"}function ip(e){if(!e)return"暂无任务摘要";try{const t=JSON.parse(e);if(typeof t.prompt=="string")return mh(t.prompt)||"暂无任务摘要"}catch{}return mh(e)||"暂无任务摘要"}function UQ(e){return{message:"消息",ask:"问题",reply:"回复",task:"任务",handoff:"交接",done:"完成"}[e]}function $Q(e,t){const r=new Map(t.map(i=>[i.sessionId,P6(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}`,u=n.get(l),h=r.get(i.toSessionId)??i.toSessionId.slice(0,8);if(u){u.toNames.push(h);const p={failed:-2,expired:-1,pending:0,delivered:1,read:2};p[i.status]<p[u.status]&&(u.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 zQ({onClose:e,onNewSession:t,setError:r}){const[n,i]=y.useState(""),[l,u]=y.useState([]),[h,p]=y.useState(!1),g=y.useRef(0);y.useEffect(()=>{const b=n.trim(),w=++g.current;if(u([]),!b){p(!1);return}p(!0);const A=window.setTimeout(()=>{F7(b).then(k=>{w===g.current&&u(k.results)}).catch(k=>{w===g.current&&r(k instanceof Error?k.message:"搜索失败")}).finally(()=>{w===g.current&&p(!1)})},250);return()=>window.clearTimeout(A)},[n,r]);const x=async b=>{if(b.live){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:b.sessionId})),e();return}if(b.resumeHistoryId)try{const w=await Px(b.resumeHistoryId);t({mode:"shell",cwd:w.cwd,command:w.command}),e()}catch(w){r(w instanceof Error?w.message:"恢复失败")}};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] text-muted-foreground",children:"搜索会话标题、项目目录、任务内容和终端记录"})]}),a.jsxs("label",{className:"relative mt-3 block",children:[a.jsx("span",{className:"sr-only",children:"搜索全部会话"}),a.jsx(fu,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{autoFocus:!0,className:`${Li} pl-9 pr-9`,value:n,onChange:b=>{r(null),i(b.target.value)},placeholder:"输入你记得的关键词"}),h?a.jsx(xs,{size:13,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"}):n&&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:()=>i(""),children:a.jsx(gs,{size:13})})]})]}),!n.trim()&&a.jsxs("div",{className:"border-y border-border/15 py-10 text-center",children:[a.jsx(fu,{size:24,className:"mx-auto text-primary"}),a.jsx("p",{className:"mt-3 text-[13px] font-medium text-foreground",children:"找回之前做过的事"}),a.jsx("p",{className:"mx-auto mt-1 max-w-md text-[11px] leading-relaxed text-muted-foreground",children:"可以输入任务名、报错片段或目录名,例如“自动任务”“web-terminal”“构建失败”。搜索索引只保存在本机。"})]}),n.trim()&&!h&&l.length>0&&a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("p",{className:"text-[11px] text-foreground",children:["显示 ",l.length," 个会话"]}),a.jsx("p",{className:"text-[9px] text-muted-foreground",children:"在线可打开 · 已关闭可恢复"})]}),a.jsx("div",{className:"divide-y divide-border/10 border-y border-border/10",children:l.map(b=>{const w=b.live||!!b.resumeHistoryId,A=b.live?"打开会话":b.resumeHistoryId?"恢复会话":"仅供查阅",k=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:"truncate text-[12px] font-medium text-foreground",children:b.title}),a.jsx("p",{className:"mt-0.5 truncate text-[9px] text-muted-foreground",children:b.cwd})]}),a.jsx("span",{className:`shrink-0 text-[10px] ${b.live?"text-[var(--success)]":b.resumeHistoryId?"text-primary":"text-muted-foreground"}`,children:A})]}),a.jsx("p",{className:"mt-2 line-clamp-3 text-[10px] leading-relaxed text-foreground/75",children:HQ(b)||"匹配内容来自标题、目录或终端控制信息"}),a.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:[gh(b.updatedAt)," · ",b.matchCount," 处匹配",w?"":" · 没有可恢复记录"]})]});return w?a.jsx("button",{onClick:()=>{x(b)},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:k},b.sessionId):a.jsx("article",{className:"px-2 py-3",children:k},b.sessionId)})}),n.trim()&&!h&&l.length===0&&a.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[a.jsxs("p",{className:"text-[12px] text-foreground",children:["没有找到“",n.trim(),"”"]}),a.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:"试试更短的关键词、目录名或报错中的一小段。"}),a.jsx("button",{className:`${tn} mt-3 bg-surface-2 text-foreground`,onClick:()=>i(""),children:"清空后重试"})]})]})}function mh(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 HQ(e){let t=mh(e.snippet);for(const r of[e.title,e.cwd,e.agentSlug])r&&(t=t.split(r).join(" "));return mh(t)}function WQ(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 GQ(e,t=Date.now(),r=t){if(e.kind==="interval"){const l=e.everyMinutes*6e4,u=Math.max(0,t-r);return r+(Math.floor(u/l)+1)*l}const[n,i]=e.time.split(":").map(Number);for(let l=0;l<=7;l+=1){const u=new Date(t);if(u.setDate(u.getDate()+l),u.setHours(n,i,0,0),u.getTime()>t&&e.weekdays.includes(u.getDay()))return u.getTime()}return t}function gh(e){return new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)}function VQ(e){return e==="running"?"投递中":e==="success"?"已投递":e==="failed"?"投递失败":""}function qQ(e){return e==="running"?"text-[var(--warning)]":e==="success"?"text-[var(--success)]":e==="failed"?"text-destructive":"text-muted-foreground"}function YQ({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 ZQ(e,t){return J7(e,t)}function Cd(e,t){const r=new Set(e),n=t.filter(l=>l.sessionIds.length>=2&&l.sessionIds.every(u=>r.has(u))),i=new Set;return e.flatMap(l=>{const u=n.find(h=>h.sessionIds.includes(l));return u?i.has(u.id)?[]:(i.add(u.id),[{sessionIds:u.sessionIds,workspace:u}]):[{sessionIds:[l]}]})}function $0(e,t,r,n=[]){const i=new Map,l=new Map,u=new Set(e.map(x=>x.id));for(const x of n){const b=x.sessionIds.filter(A=>u.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=>u.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(I=>{const N=r.get(I);return N?[N]:[]});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 I=r.get(k);return I?[I]:[]});g.push({kind:"workspace",id:`workspace:${w.id}`,workspace:w,members:A,sessionIds:w.sessionIds})}return g}function V5(e,t,r){const n=Math.min(e.length,Math.max(0,r)),i=e.slice(0,n).flatMap(u=>u.sessionIds.filter(h=>h!==t)),l=e.slice(n).flatMap(u=>u.sessionIds.filter(h=>h!==t));return[...i,t,...l]}function KQ({status:e,detail:t,needsReview:r,inCopyMode:n}){return a.jsx(aQ,{status:e,detail:t,needsReview:r,inCopyMode:n})}function q5({isOpen:e,drawerWidthPx:t,onClose:r,onOpen:n,sessions:i,activeSessionId:l,sessionStates:u,onJumpToNextAttention:h,onNewSession:p,onCloseSession:g,onSplitSession:x,onCloseSplit:b,onRemoveFromSplit:w,splitWorkspaces:A,onSetSplitLayout:k,onReorderSplitWorkspace:I,onCombineSplitSessions:N,onReorderSessions:R,onSessionMenu:D,onOpenSettings:O,onOpenQuota:q,updateState:Y,updateActionPending:U=!1,onConfirmUpdateRestart:V,onRetryUpdate:me,serverHealthState:Je,tmuxAvailable:ve=!0,defaultSessionMode:_e="shell",push:Ze,pinned:Ve,runningSessionButtonEnabled:ce=!1,onRunningSessionButtonEnabledChange:ke,attentionButtonEnabled:ot=!0,onAttentionButtonEnabledChange:Ie,onTogglePinned:de,recoverableTmuxSessions:qe=[],recoverableTmuxSessionsLoading:xe=!1,onRefreshRecoverableTmuxSessions:te}){const{t:re}=Jr(),[ge,ze]=y.useState(!1),[,Ke]=y.useState(0),[Ae,z]=y.useState(null),[Oe,nt]=y.useState(!1),[Re,X]=y.useState(!1),[Be,st]=y.useState({}),be=Re||Object.keys(Be).length>0,je=y.useRef(!1);y.useEffect(()=>{let $=!1;return Bl().then(he=>{$||je.current||st(Object.fromEntries(t3(he.collaborationPanels?.[vh()]).map(De=>[De,!0])))}).catch(()=>{}),()=>{$=!0}},[]);const wt=async($,he)=>{je.current=!0,await ol({floatingGroupId:he},$),st(De=>({...De,[$]:he!==null}))},[Te,pe]=y.useState([]),[$e,pt]=y.useState(!1),[Tt,Ct]=y.useState(null),[rr,ir]=y.useState(null),[yt,bt]=y.useState(null),[_t,Qt]=y.useState(null),Et=async $=>{if(je.current=!0,!$){X(!0);return}const he=su.getState().collaborationGroups.find(Me=>Me.id===$),De=ss.getState().docks[$]?.sessionId,Ee=i.find(Me=>Me.id===De)??i.find(Me=>Me.id===l&&he?.sessionIds.includes(Me.id))??i.find(Me=>he?.sessionIds.includes(Me.id));if(Ee&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:Ee.id})),Be[$]===void 0)try{await ol({floatingGroupId:$},$),st(Me=>({...Me,[$]:!0}))}catch{Qt("协作面板打开失败,请重试")}},Ht=su($=>$.collaborationGroups),ne=su($=>$.setCollaborationGroups),[Pe,it]=y.useState({mode:_e}),{preference:jt,agents:ue,detecting:Nt,refresh:qt,selectAgent:Se}=NQ(),Ce=y.useRef(null),ut=y.useRef(null),Ge=y.useRef(null),dr=!!(Y?.latestVersion&&["installing","ready","restarting","error"].includes(Y.status)),Rt=!!Je?.attention,un=[re("sidebar.moreActions"),Rt?re("sidebar.serverAttention"):null,dr&&Y?.latestVersion?re("sidebar.updateAvailable",{version:Y.latestVersion}):null].filter(Boolean).join(": "),It=Jt($=>$.groupByFolder),jn=Jt($=>$.collapsedGroups),is=Jt($=>$.toggleGroupCollapsed),Pn=y.useRef(null),Tr=y.useRef(null),In=y.useRef(null),Br=y.useRef(0),ie=y.useRef(!1),$r=y.useRef(null),ft=y.useRef(null),[hr,Ls]=y.useState(!1),Un=y.useRef([]),as=y.useRef(null),Pr=y.useRef(null),Yt=y.useRef(new Set),Xn=y.useRef(null),dn=y.useMemo(()=>new Set(A.flatMap($=>$.sessionIds)),[A]),kr=y.useMemo(()=>new Map(i.map($=>[$.id,$])),[i]),Or=y.useMemo(()=>ZQ(Ht,new Set(kr.keys())),[Ht,kr]),Ur=y.useCallback(async()=>{const $=++Br.current;try{const he=await Qx();if($!==Br.current)return;ne(Array.isArray(he.groups)?he.groups:[])}catch{}},[]);y.useEffect(()=>Bx($=>ne($.groups)),[]),y.useEffect(()=>{Ur();const $=window.setInterval(()=>{Ur()},1e4),he=()=>{Ur()};return window.addEventListener("focus",he),()=>{Br.current+=1,window.clearInterval($),window.removeEventListener("focus",he)}},[Ur]),y.useEffect(()=>{(e||!be)&&Ur()},[be,e,Ur]);const qr=y.useCallback(()=>{Un.current=Array.from(document.querySelectorAll("[data-collaboration-member], [data-collaboration-background]")).flatMap($=>{const he=$.dataset.collaborationMember??"",De=$.hasAttribute("data-collaboration-background"),Ee=$.closest("[data-collaboration-group]")?.dataset.collaborationGroup;if(!he&&!De||!Ee)return[];const Me=[];for(let ht=$.parentElement;ht;ht=ht.parentElement)Me.push({element:ht,top:ht.scrollTop,left:ht.scrollLeft});return[{element:$,sessionId:he,groupId:Ee,background:De,rect:$.getBoundingClientRect(),scrollParents:Me}]})},[]),An=y.useCallback(($,he)=>{if(!ie.current)return;document.querySelectorAll("[data-split-exit-drop-index]").forEach(at=>at.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(at=>at.removeAttribute("data-drop-active"));const Ee=document.elementsFromPoint($,he).map(at=>at.closest("[data-collaboration-background]")).find(Boolean)?.closest("[data-collaboration-group]");if(Ee?.dataset.collaborationGroup){Ee.dataset.dropActive="true",Pr.current={kind:"collaboration",groupId:Ee.dataset.collaborationGroup,background:!0};return}const Me=Un.current.find(at=>{if(at.sessionId===ft.current||!at.element.isConnected)return!1;const nr=at.scrollParents.reduce((er,Gr)=>er+Gr.element.scrollLeft-Gr.left,0),Ar=at.scrollParents.reduce((er,Gr)=>er+Gr.element.scrollTop-Gr.top,0);return $>=at.rect.left-nr&&$<=at.rect.right-nr&&he>=at.rect.top-Ar+at.rect.height*.25&&he<=at.rect.bottom-Ar-at.rect.height*.25});if(Me?.background){Me.element.closest("[data-collaboration-group]")?.setAttribute("data-drop-active","true"),Pr.current={kind:"collaboration",groupId:Me.groupId,background:!0};return}if(Me&&!A.find(nr=>nr.sessionIds.includes(Me.sessionId))?.sessionIds.includes(ft.current??"")){Me.element.dataset.dropActive="true",Pr.current={kind:"split",sessionId:Me.sessionId,groupId:Me.groupId};return}const ht=document.elementsFromPoint($,he).filter(at=>{const nr=at.closest("[data-rfd-draggable-id]");return!nr||!["session:","split-member:","collaboration-member:"].some(Ar=>nr.dataset.rfdDraggableId===`${Ar}${ft.current}`)}),vt=ht.map(at=>at.closest("[data-collaboration-group]")).find(at=>at?.dataset.collaborationGroup);if(vt?.dataset.collaborationGroup){const at=vt.dataset.collaborationGroup,nr=ht.map(Mr=>Mr.closest("[data-collaboration-split]")).find(Boolean),Ar=ht.map(Mr=>Mr.closest("[data-collaboration-member]")).find(Boolean),er=Ar?.dataset.collaborationMember??nr?.dataset.splitAnchor,Gr=at===$r.current&&A.some(Mr=>Mr.sessionIds.includes(er??"")&&Mr.sessionIds.includes(ft.current??""));if(er&&!Gr&&(at!==$r.current||!Ar&&nr)){vt.dataset.dropActive="true";const Mr=Ar??nr;Mr&&(Mr.dataset.dropActive="true"),Pr.current={kind:"split",sessionId:er,groupId:at}}else{const Mr=ht.some(Sr=>Sr.closest("[data-collaboration-background]"));(at!==$r.current||Mr)&&(vt.dataset.dropActive="true"),Pr.current={kind:"collaboration",groupId:at,background:Mr}}return}const rt=Array.from(document.querySelectorAll("[data-sidebar-entity-list-id]")).filter(at=>at.dataset.sidebarEntityListId===as.current).find(at=>{const nr=at.getBoundingClientRect();return $>=nr.left&&$<=nr.right&&he>=nr.top-8&&he<=nr.bottom+8});if(!rt){Pr.current=null;return}const mt=Array.from(rt.children).filter(at=>at instanceof HTMLElement&&at.hasAttribute("data-sidebar-entity-index")),fr=mt.findIndex(at=>{const nr=at.getBoundingClientRect();return he<nr.top+nr.height/2}),gt=fr<0?mt.length:fr;Pr.current={kind:"list",listId:rt.dataset.sidebarEntityListId??"",index:gt};const Kt=Array.from(rt.querySelectorAll(":scope > [data-sidebar-entity-index] > [data-split-exit-drop-index]")).find(at=>at.dataset.splitExitDropIndex===String(gt));Kt instanceof HTMLElement&&(Kt.dataset.active="true")},[A]);y.useEffect(()=>{const $=De=>An(De.clientX,De.clientY),he=De=>{const Ee=De.touches[0];Ee&&An(Ee.clientX,Ee.clientY)};return window.addEventListener("pointermove",$),window.addEventListener("touchmove",he,{passive:!0}),()=>{window.removeEventListener("pointermove",$),window.removeEventListener("touchmove",he)}},[An]);const Yr=y.useCallback(($,he)=>{try{$(he)}finally{document.querySelectorAll("[data-sidebar-dragging]").forEach(De=>{delete De.dataset.sidebarDragging}),ie.current=!1,Un.current=[],Ls(!1),$r.current=null,ft.current=null,as.current=null,Pr.current=null,document.querySelectorAll("[data-split-exit-drop-index]").forEach(De=>De.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(De=>De.removeAttribute("data-drop-active"))}},[]),jr=y.useMemo(()=>i.filter($=>!dn.has($.id)),[i,dn]),En=y.useMemo(()=>{let $=0;for(const he of i)u.get(he.id)?.agentStatus==="working"&&($+=1);return $},[i,u]);y.useLayoutEffect(()=>{const $=Pn.current,he=Tr.current;if(!e||!$||!he){In.current=null;return}const De=he.getBoundingClientRect(),Ee=$.getBoundingClientRect(),Me={item:$,top:Math.round(Ee.top-De.top+he.scrollTop),height:Math.round(Ee.height),viewportHeight:he.clientHeight},ht=In.current;if(In.current=Me,ht?.item===Me.item&&ht.top===Me.top&&ht.height===Me.height&&ht.viewportHeight===Me.viewportHeight||ie.current||he.clientHeight===0)return;const vt=8,lt=Ee.top-De.top,rt=Ee.bottom-De.top;lt<vt?he.scrollTop+=lt-vt:rt>he.clientHeight-vt&&(he.scrollTop+=rt-he.clientHeight+vt)});const Z=y.useMemo(()=>{if(!It||!l)return null;const $=u.get(l)?.cwd??null;return W7($)},[It,l,u]);y.useEffect(()=>{if(!It){Xn.current=null,Yt.current.clear();return}if(!l){Xn.current=null;return}const $=Jt.getState(),he=Yt.current,De=Xn.current,Ee=Z;De!==null&&De!==Ee&&he.has(De)&&($.collapsedGroups.has(De)||$.toggleGroupCollapsed(De),he.delete(De)),Ee!==null&&Ee!==""&&$.collapsedGroups.has(Ee)&&($.toggleGroupCollapsed(Ee),he.add(Ee)),Xn.current=Ee},[It,l,Z]),y.useEffect(()=>{e||(ze(!1),nt(!1))},[e]),y.useEffect(()=>{it($=>({...$,command:jt?.command}))},[jt]),y.useEffect(()=>{if(!Oe)return;let $=!1;return pt(!0),ir(null),km().then(he=>{$||pe(he)}).catch(()=>{$||ir(re("sidebar.resumeHistoryLoadFailed"))}).finally(()=>{$||pt(!1)}),()=>{$=!0}},[Oe,re]),y.useLayoutEffect(()=>{if(!ge)return;const $=Ce.current,he=ut.current;if(!$||!he)return;const De=window.visualViewport,Ee=()=>{const vt=(De?.offsetLeft??0)+8,lt=(De?.offsetTop??0)+8,rt=Math.max(0,(De?.width??window.innerWidth)-16),mt=Math.max(0,(De?.height??window.innerHeight)-16);he.style.maxWidth=`${rt}px`,he.style.maxHeight=`${mt}px`;const fr=$.getBoundingClientRect(),gt=Math.max(vt,Math.min(fr.right-he.offsetWidth,vt+rt-he.offsetWidth)),Kt=Math.max(lt,Math.min(fr.bottom+4,lt+mt-he.offsetHeight));he.style.left=`${gt-fr.left}px`,he.style.top=`${Kt-fr.top}px`};Ee();const Me=typeof ResizeObserver>"u"?null:new ResizeObserver(Ee);return Me?.observe($),Me?.observe(he),window.addEventListener("resize",Ee),window.addEventListener("scroll",Ee,!0),De?.addEventListener("resize",Ee),De?.addEventListener("scroll",Ee),()=>{Me?.disconnect(),window.removeEventListener("resize",Ee),window.removeEventListener("scroll",Ee,!0),De?.removeEventListener("resize",Ee),De?.removeEventListener("scroll",Ee)}},[ge,t]),y.useEffect(()=>{if(!ge)return;const $=he=>{he instanceof KeyboardEvent&&he.key!=="Escape"||he instanceof MouseEvent&&he.target instanceof Node&&Ce.current?.contains(he.target)||ze(!1)};return window.addEventListener("mousedown",$),window.addEventListener("keydown",$),()=>{window.removeEventListener("mousedown",$),window.removeEventListener("keydown",$)}},[ge]),y.useEffect(()=>{if(!Ae)return;const $=he=>{he instanceof KeyboardEvent&&he.key!=="Escape"||he instanceof PointerEvent&&he.target instanceof Node&&Ge.current?.contains(he.target)||z(null)};return window.addEventListener("pointerdown",$),window.addEventListener("keydown",$),()=>{window.removeEventListener("pointerdown",$),window.removeEventListener("keydown",$)}},[Ae]);const He=()=>{!Ze&&!Ve&&r()},xt=_e==="tmux"&&!ve?"shell":_e,cr=()=>{p({mode:xt}),He()},Gt=()=>{jt&&(p({mode:xt,command:jt.command}),He())},At=$=>{bt($.name),p({mode:"tmux",tmuxSessionName:$.name,cwd:$.cwd??void 0}),He()};y.useEffect(()=>{yt&&(qe.some($=>$.name===yt)||bt(null))},[yt,qe]);const hn=($,he)=>{p({...Pe,cwd:Pe.cwd?.trim()||void 0,command:he??$?.command}),nt(!1),He()},nn=async $=>{Ct($.id),ir(null);try{const he=await Px($.id);p({mode:"shell",cwd:he.cwd,command:he.command}),nt(!1),He()}catch(he){const De=he&&typeof he=="object"&&"code"in he?String(he.code??""):"";ir(re(De==="AGENT_SESSION_ACTIVE_ELSEWHERE"?"tab.resumeAgentConflict":"sidebar.resumeHistoryFailed"))}finally{Ct(null)}},On=async $=>{pe(he=>he.filter(De=>De.id!==$));try{await e8($)}catch{ir(re("sidebar.resumeHistoryRemoveFailed")),km().then(pe).catch(()=>{})}},rn=()=>{if(Oe){nt(!1);return}it({mode:_e==="tmux"&&!ve?"shell":_e,cwd:l?u.get(l)?.cwd??void 0:void 0,command:jt?.command}),nt(!0)},Tn=y.useCallback($=>{const he=u.get($);return he?.agentStatus==="waiting"||he?.agentNeedsReview?"bg-[rgb(var(--warning-rgb)_/_0.10)] text-foreground":he?.agentStatus==="working"?"bg-[rgb(var(--success-rgb)_/_0.08)] text-foreground":he?.inCopyMode?"bg-[rgb(var(--tmux-rgb)_/_0.08)] text-foreground":null},[u]),Cn=p6(),$n=y.useCallback(($,he,De,Ee)=>{const Me=$.id===l,ht=dn.has($.id),vt=!!(De&&ht),lt=u.get($.id),rt=lu(lt?.cwd??null),mt=lt?.shellTitle??G7($.id),fr=mt===lt?.cwd||mt===rt?null:mt,gt=V7($,lt?.activeProgram??null,null,q7,fr,lt?.promptState??null),Kt=!!(lt?.tuiProgress&<.tuiProgress.state!=="remove"),nr=lt?.promptState==="running"||lt?.agentStatus==="working"||Kt?"bg-[var(--success)]":lt?.agentStatus==="waiting"||lt?.agentNeedsReview?"bg-[var(--warning)]":lt?.inCopyMode?"bg-[var(--tmux)]":"bg-primary";return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:Me?Pn:null,type:"button",...he??{},onContextMenu:Ar=>{D&&(Ar.preventDefault(),D($.id,{x:Ar.clientX,y:Ar.clientY}))},onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:$.id})),He()},className:`sidebar-session-primary relative min-w-0 flex flex-1 items-center overflow-hidden text-left ${he?"cursor-grab active:cursor-grabbing ":""}${De?"gap-1.5 py-0.5 pl-1.5 pr-0.5":"gap-1.5 py-1 pl-2 pr-1"}`,title:lt?.cwd??$.name,children:[Me&&a.jsx("span",{className:`absolute inset-y-2 left-0 w-0.5 rounded-full ${nr}`}),a.jsxs("span",{className:`relative inline-flex shrink-0 items-center justify-center rounded-md ${De?"h-5 w-[22px]":"h-[22px] w-[22px]"} ${Me?$.mode==="tmux"?"bg-[rgb(var(--tmux-rgb)_/_0.15)] text-[color:var(--tmux)]":"bg-primary/15 text-primary":$.mode==="tmux"?"bg-surface text-[rgb(var(--tmux-rgb)_/_0.80)]":"bg-surface text-muted-foreground"}`,children:[lt?.isConnecting||Kt&&!lt?.agentStatus?a.jsx(cn,{size:De?10:11,className:"animate-spin"}):lt?.agent??Im($.id)?a.jsx(ic,{agent:lt?.agent??Im($.id),size:De?13:15}):$.mode==="tmux"?a.jsx(e0,{size:De?10:11}):a.jsx(Ga,{size:De?10:11}),a.jsx(KQ,{status:lt?.agentStatus??null,detail:lt?.agentStatusDetail,needsReview:lt?.agentNeedsReview,inCopyMode:lt?.inCopyMode})]}),a.jsx("span",{className:`min-w-0 flex-1 truncate leading-tight ${De?"text-[11px]":"text-[12px]"} ${Me?"font-medium text-foreground":""} ${lt?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:gt}),a.jsx(a5,{sessionIds:[$.id]})]}),Ee,a.jsx("button",{type:"button",onClick:Ar=>{Ar.stopPropagation(),vt?w($.id):ht?b($.id):x($.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 ${De?"h-6 w-6":"h-[26px] w-[26px]"} ${ht?"bg-primary/15 text-primary":"text-muted-foreground/70"}`,"aria-label":`${re(vt?"tab.splitRemovePane":ht?"tab.splitClose":"tab.split")} ${gt}`,title:re(vt?"tab.splitRemovePane":ht?"tab.splitClose":"tab.split"),children:vt?a.jsx(xA,{size:11}):a.jsx(al,{size:12})}),a.jsx("button",{type:"button",onClick:Ar=>{Ar.stopPropagation(),g($.id,Ar)},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 ${De?"h-6 w-6":"h-[26px] w-[26px]"}`,"aria-label":re("sidebar.closeSession",{name:gt}),title:re("common.close"),children:a.jsx(gs,{size:De?11:12})})]})},[l,dn,u,g,x,b,w,D,re]),ar=y.useMemo(()=>Gd(i,$=>u.get($.id)?.cwd??null,It,re("sidebar.ungrouped"),A,Or).groups,[Or,It,i,u,A,re]),us=y.useMemo(()=>$0(i,A,kr,Or),[Or,i,kr,A]),yr=y.useCallback($=>{Ls($.draggableId.startsWith("collaboration:")||$.draggableId.startsWith("workspace:"));const he=$.draggableId.replace(/^split-member:/,"");ft.current=$.draggableId.replace(/^(?:session|split-member|collaboration-member):/,"");const De=$.type==="split-member"?A.find(lt=>lt.sessionIds.includes(he)):null,Ee=$.type==="collaboration-member"?$.source.droppableId.replace(/^collaboration-members:/,""):null,Me=Ee?Or.find(lt=>lt.id===Ee):null;ie.current=!!(De||Me||$.type==="session"&&$.draggableId.startsWith("session:")),ie.current&&document.querySelectorAll("[data-collaboration-group]").forEach(lt=>{lt.dataset.sidebarDragging="true"}),$r.current=Me?.id??null;const ht=De?.sessionIds??Me?.sessionIds??[],vt=ht.length>0?ar.find(lt=>ht.every(rt=>lt.sessions.some(mt=>mt.id===rt))):null;as.current=It?vt?`group-sessions:${vt.key}`:null:ht.length>0?"sidebar-entities":null,Pr.current=null},[Or,ar,It,A]),Qr=y.useCallback(($,he,De)=>{if(he===De)return;const Ee=he?Ht.find(rt=>rt.id===he):null,Me=De?Ht.find(rt=>rt.id===De):null;if(De&&!Me)return;if(Me){const rt=i.map(fr=>fr.id).filter(fr=>fr!==$);let mt=-1;rt.forEach((fr,gt)=>{Me.sessionIds.includes(fr)&&(mt=gt)}),mt>=0&&(rt.splice(mt+1,0,$),R(rt))}const ht=Ee?.sessionIds.filter(rt=>rt!==$)??[],vt=Me?[...Me.sessionIds.filter(rt=>rt!==$),$]:[];ne(rt=>rt.flatMap(mt=>mt.id===he?ht.length>=2?[{...mt,sessionIds:ht}]:[]:mt.id===De?[{...mt,sessionIds:vt}]:[mt])),Qt(null),(Ee&&Me?Y7({sourceGroupId:Ee.id,targetGroupId:Me.id,sessionId:$,expectedSourceUpdatedAt:Ee.updatedAt,expectedTargetUpdatedAt:Me.updatedAt}):Ee?ht.length>=2?Gc({id:Ee.id,name:Ee.name,sessionIds:ht,expectedUpdatedAt:Ee.updatedAt}):bp(Ee.id,Ee.updatedAt):Me?Gc({id:Me.id,name:Me.name,sessionIds:vt,expectedUpdatedAt:Me.updatedAt}):Promise.resolve()).then(()=>Ur(),rt=>(Qt(rt instanceof Error?rt.message:"协作成员移动失败"),Ur()))},[Ht,Ur,i,R]),Cr=y.useCallback(($,he,De)=>{const Ee=Ht.find(rt=>rt.id===$);if(!Ee||he===De)return;const Me=Ee.sessionIds.filter(rt=>!rt.startsWith("remote:")),ht=Cd(Me,A).flatMap(rt=>rt.sessionIds),[vt]=ht.splice(he,1);if(!vt)return;ht.splice(De,0,vt);const lt=A.find(rt=>rt.sessionIds.includes(vt));if(lt&<.sessionIds.every(rt=>Ee.sessionIds.includes(rt))){const rt=ht.filter(mt=>lt.sessionIds.includes(mt));I(lt.id,rt)}ht.push(...Ee.sessionIds.filter(rt=>rt.startsWith("remote:"))),ne(rt=>rt.map(mt=>mt.id===$?{...mt,sessionIds:ht}:mt)),Qt(null),Gc({id:Ee.id,name:Ee.name,sessionIds:ht,expectedUpdatedAt:Ee.updatedAt}).then(()=>Ur(),rt=>(Qt(rt instanceof Error?rt.message:"成员排序失败"),Ur()))},[Ht,Ur,A,I]);y.useEffect(()=>{const $=he=>{const{sourceId:De,targetId:Ee}=he.detail;if(!De||!Ee||De===Ee)return;const Me=Gd(i,er=>u.get(er.id)?.cwd??null,It,"",A,Or).arranged.map(er=>er.id),ht=Me.indexOf(De),vt=Me.indexOf(Ee);if(ht<0||vt<0)return;const lt=Or.find(er=>er.sessionIds.includes(De));if(lt?.sessionIds.includes(Ee)){const er=Cd(lt.sessionIds,A).flatMap(Gr=>Gr.sessionIds);Cr(lt.id,er.indexOf(De),er.indexOf(Ee));return}const rt=A.filter(er=>er.sessionIds.length>=2&&er.sessionIds.every(Gr=>kr.has(Gr))&&!Or.some(Gr=>er.sessionIds.some(Mr=>Gr.sessionIds.includes(Mr)))),mt=rt.find(er=>er.sessionIds.includes(De));if(mt?.sessionIds.includes(Ee)){const er=[...mt.sessionIds];er.splice(er.indexOf(De),1),er.splice(mt.sessionIds.indexOf(Ee),0,De),I(mt.id,er);return}const fr=er=>Or.find(Gr=>Gr.sessionIds.includes(er))?.sessionIds??rt.find(Gr=>Gr.sessionIds.includes(er))?.sessionIds??[er],gt=new Set(fr(De)),Kt=new Set(fr(Ee)),at=Me.filter(er=>!gt.has(er)),nr=at.flatMap((er,Gr)=>Kt.has(er)?[Gr]:[]),Ar=ht<vt?Math.max(...nr)+1:Math.min(...nr);at.splice(Ar,0,...Me.filter(er=>gt.has(er))),R(at)};return window.addEventListener("reorder-navigation-session",$),()=>window.removeEventListener("reorder-navigation-session",$)},[i,u,It,A,Or,kr,Cr,I,R]);const ds=y.useCallback($=>{if($.type!=="collaboration-member")return!1;if($.reason==="CANCEL")return!0;const he=$.source.droppableId.replace(/^collaboration-members:/,""),De=$.draggableId.replace(/^collaboration-member:/,""),Ee=Pr.current;if(Ee?.kind==="split")return Qr(De,he,Ee.groupId),N(Ee.sessionId,De),!0;if(Ee?.kind==="collaboration"&&Ee.groupId!==he)return Qr(De,he,Ee.groupId),!0;if(Ee?.kind==="collaboration"&&Ee.background)return dn.has(De)&&w(De),!0;if($.destination&&$.destination.droppableId!==$.source.droppableId){const Me=$.destination.droppableId.replace(/^collaboration-members:/,"");if(Or.some(ht=>ht.id===Me))return Qr(De,he,Me),!0}if($.combine){const Me=$.combine.droppableId.replace(/^collaboration-members:/,"");Me!==he&&Qr(De,he,Me);const ht=$.combine.draggableId.replace(/^collaboration-member:/,"");if(A.find(lt=>lt.sessionIds.includes(De))?.sessionIds.includes(ht)){const lt=Or.find(mt=>mt.id===he),rt=lt?Cd(lt.sessionIds,A).flatMap(mt=>mt.sessionIds).indexOf(ht):-1;rt>=0&&Cr(he,$.source.index,rt)}else kr.has(ht)&&N(ht,De);return!0}if($.destination?.droppableId===$.source.droppableId)return Cr(he,$.source.index,$.destination.index),!0;if(Ee?.kind!=="list")return!0;if(Ee?.kind==="list"){const Me=ar.find(vt=>`group-sessions:${vt.key}`===Ee.listId),ht=Ee.listId==="sidebar-entities"?us:Me?$0(Me.sessions,A,kr,Or):null;if(ht){const vt=V5(ht,De,Ee.index);Ee.listId==="sidebar-entities"?R(vt):Me&&R(ar.flatMap(lt=>lt.key===Me.key?vt:lt.sessions.map(rt=>rt.id)))}}return Qr(De,he,null),!0},[Or,us,ar,Qr,R,Cr,kr,A,dn,w,N]),Ln=y.useCallback($=>{if($.type!=="split-member")return!1;if($.reason==="CANCEL")return!0;const he=$.draggableId.replace(/^split-member:/,""),De=A.find(rt=>rt.sessionIds.includes(he));if(!De?.sessionIds.includes(he))return!0;const Ee=De.id,Me=Pr.current;if(Me?.kind==="split")return Qr(he,null,Me.groupId),N(Me.sessionId,he),!0;if(Me?.kind==="collaboration")return Qr(he,null,Me.groupId),!0;if(!$.destination&&Me?.kind==="list"){const rt=ar.find(gt=>`group-sessions:${gt.key}`===Me.listId),mt=Me.listId==="sidebar-entities"?us:rt?$0(rt.sessions,A,kr,Or):null;if(!mt)return!0;const fr=V5(mt,he,Me.index);return w(he),Me.listId==="sidebar-entities"?R(fr):rt&&R(ar.flatMap(gt=>gt.key===rt.key?fr:gt.sessions.map(Kt=>Kt.id))),!0}if(!$.destination)return!0;const ht=$.destination.droppableId.replace(/^split-members:/,"");if(ht!==Ee){const mt=A.find(fr=>fr.id===ht)?.sessionIds[0];return mt&&N(mt,he),!0}if($.source.index===$.destination.index)return!0;const vt=[...De.sessionIds],[lt]=vt.splice($.source.index,1);return lt&&(vt.splice($.destination.index,0,lt),I(Ee,vt)),!0},[Or,us,ar,Qr,N,w,R,I,kr,A]),Rn=($,he="top")=>a.jsx("div",{"data-split-exit-drop-index":$,className:`group/split-exit pointer-events-none absolute inset-x-0 z-10 h-2 ${he==="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"})}),zr=y.useCallback(($,he,De)=>{if(ds($)||Ln($)||$.reason==="CANCEL")return;const Ee=he.find(rt=>rt.id===$.draggableId);if(!Ee)return;const Me=Pr.current;if(Me?.kind==="split"&&Ee.kind==="session"){Qr(Ee.session.id,null,Me.groupId),N(Me.sessionId,Ee.session.id);return}if(Me?.kind==="collaboration"&&Ee.kind==="session"){Qr(Ee.session.id,null,Me.groupId);return}if($.combine&&Ee.kind!=="session"){const rt=he.findIndex(mt=>mt.id===$.combine?.draggableId);if(rt<0)return;$={...$,combine:null,destination:{...$.source,index:rt}}}if($.combine){const rt=he.find(at=>at.id===$.combine?.draggableId);if(!rt)return;const mt=rt.kind==="workspace"?rt:Ee.kind==="workspace"?Ee:rt,fr=mt===Ee?rt:Ee,gt=mt.sessionIds[0],Kt=fr.sessionIds[0];gt&&Kt&>!==Kt&&N(gt,Kt);return}if(!$.destination||$.source.index===$.destination.index)return;const ht=[...he],[vt]=ht.splice($.source.index,1);if(!vt)return;ht.splice($.destination.index,0,vt);const lt=ht.flatMap(rt=>rt.sessionIds);if(De===void 0){R(lt);return}R(ar.flatMap(rt=>rt.key===De?lt:rt.sessions.map(mt=>mt.id)))},[ar,ds,Ln,Qr,N,R]),Jn=y.useCallback($=>{if($.reason==="CANCEL"||ds($)||Ln($))return;if($.type==="group"){if(!$.destination||$.source.index===$.destination.index)return;R(Ox(ar,$.source.index,$.destination.index));return}const he=$.source.droppableId.replace(/^group-sessions:/,""),De=ar.find(Me=>Me.key===he);if(!De)return;const Ee=$0(De.sessions,A,kr,Or);if($.combine||Pr.current?.kind==="collaboration"||Pr.current?.kind==="split"){zr($,Ee,he);return}!$.destination||$.destination.droppableId!==$.source.droppableId||zr($,Ee,he)},[Or,ar,kr,A,ds,zr,Ln,R]),es=$=>{const he=Ae===$.id,De=[{layout:"horizontal",label:re("tab.splitHorizontal"),icon:al},{layout:"vertical",label:re("tab.splitVertical"),icon:Qm},...$.sessionIds.length>=3||$.layout==="grid"?[{layout:"grid",label:re("tab.splitGrid"),icon:Dm}]:[]],Ee=$.layout==="vertical"?Qm:$.layout==="grid"?Dm:al,Me=De.find(ht=>ht.layout===$.layout)?.label??re("tab.splitHorizontal");return a.jsxs("div",{ref:he?Ge:void 0,className:"relative shrink-0",onPointerDown:ht=>ht.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 ${he?"bg-primary/15 text-primary":"text-muted-foreground/70 hover:bg-surface-2 hover:text-foreground"}`,"aria-label":`${re("tab.splitLayout")}: ${Me}`,"aria-haspopup":"menu","aria-expanded":he,title:re("tab.splitLayout"),onClick:ht=>{ht.stopPropagation(),z(vt=>vt===$.id?null:$.id)},children:a.jsx(Ee,{size:12})}),he&&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:De.map(ht=>{const vt=ht.icon,lt=ht.layout===$.layout;return a.jsx("button",{type:"button",role:"menuitemradio","aria-checked":lt,"aria-label":ht.label,title:ht.label,className:`sidebar-session-action inline-flex h-7 w-7 items-center justify-center rounded-sm transition active:scale-95 ${lt?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,onClick:rt=>{rt.stopPropagation(),k($.sessionIds[0],ht.layout),z(null)},children:a.jsx(vt,{size:13})},ht.layout)})})]})},ur=($,he)=>he&&a.jsx("button",{type:"button",...he,"aria-label":$,title:$,onClick:De=>De.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(Lu,{size:10})}),Hr=($,he,De=!1,Ee=!1,Me)=>{if(he.length<2)return null;const ht=he.some(gt=>gt.id===l),vt=[],lt=[],rt=[];for(const gt of he){const Kt=u.get(gt.id);Kt?.agentStatus==="waiting"||Kt?.agentNeedsReview?vt.push(gt):Kt?.agentStatus==="working"?lt.push(gt):Kt?.inCopyMode&&rt.push(gt)}const mt=$.name?.trim()||`${re("tab.splitWorkspace")} ${A.findIndex(gt=>gt.id===$.id)+1}`,fr=Ae===$.id;return a.jsxs("section",{"data-split-workspace":$.id,"aria-label":mt,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 ${Ee?"bg-primary/15 ring-1 ring-primary/40":De?"bg-surface-elevated opacity-90 shadow-lg":vt.length>0?"bg-[rgb(var(--warning-rgb)_/_0.08)] hover:bg-[rgb(var(--warning-rgb)_/_0.12)]":lt.length>0?"bg-[rgb(var(--success-rgb)_/_0.06)] hover:bg-[rgb(var(--success-rgb)_/_0.10)]":rt.length>0?"bg-[rgb(var(--tmux-rgb)_/_0.07)] hover:bg-[rgb(var(--tmux-rgb)_/_0.11)]":ht?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[ur(`移动分屏组 ${mt}`,Me),a.jsx(il,{droppableId:`split-members:${$.id}`,type:"split-member",direction:"vertical",children:(gt,Kt)=>a.jsxs("div",{ref:gt.innerRef,...gt.droppableProps,"data-split-members":!0,className:Kt.isDraggingOver?"rounded-sm bg-primary/10 ring-1 ring-primary/40":"",children:[he.map((at,nr)=>a.jsx(sl,{draggableId:`split-member:${at.id}`,index:nr,disableInteractiveElementBlocking:!0,children:(Ar,er)=>a.jsx("div",{ref:Ar.innerRef,...Ar.draggableProps,...D?Cn(()=>D(at.id)):{},className:`${nr===0&&fr?"relative z-20 ":"relative "}flex items-center rounded-sm pr-0.5 transition-colors ${er.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${Tn(at.id)??(at.id===l?"bg-surface-elevated/80 text-foreground":"text-muted-foreground hover:bg-surface-2")}`,children:$n(at,Ar.dragHandleProps,!0,nr===0?es($):void 0)})},at.id)),gt.placeholder]})})]})},on=($,he,De,Ee=!1,Me=!1)=>{if(he.length<($.federated?1:2))return null;const ht=he.some(mt=>mt.id===l),vt=Cd($.sessionIds,A),lt=vt.flatMap(mt=>mt.sessionIds),rt=vt.length===1?vt[0]?.workspace:void 0;return a.jsxs("section",{"data-collaboration-group":$.id,"data-collaboration-group-name":$.name,"aria-label":`Agent 工作组:${$.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 ${Me?"bg-primary/15 ring-1 ring-primary/40":Ee?"bg-surface-elevated opacity-90 shadow-lg":ht?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[ur(`移动工作组 ${$.name}`,De),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:`打开 ${$.name} 的协作消息`,"aria-label":`打开 Agent 工作组消息:${$.name}`,onClick:mt=>{mt.stopPropagation(),Et($.id)},children:a.jsx(jm,{size:9})}),a.jsx(il,{droppableId:`collaboration-members:${$.id}`,type:"collaboration-member",direction:"vertical",isCombineEnabled:!0,children:(mt,fr)=>a.jsxs("div",{ref:mt.innerRef,...mt.droppableProps,"data-collaboration-members":!0,className:`${fr.isDraggingOver?"rounded-sm bg-primary/10":""}`,children:[vt.map(gt=>a.jsx("div",{"data-collaboration-split":gt.workspace?.id,"data-split-anchor":gt.workspace?.sessionIds[0],role:gt.workspace?"region":void 0,"aria-label":gt.workspace?`${re("tab.splitWorkspace")} · ${gt.sessionIds.length}`:void 0,className:gt.workspace&&!rt?`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 ${gt.sessionIds.includes(l??"")?"bg-primary/[0.07]":"bg-surface/35"}`:void 0,children:gt.sessionIds.map(Kt=>{const at=kr.get(Kt);return at?a.jsx(sl,{draggableId:`collaboration-member:${at.id}`,index:lt.indexOf(at.id),disableInteractiveElementBlocking:!0,children:(nr,Ar)=>a.jsxs("div",{ref:nr.innerRef,...nr.draggableProps,"data-collaboration-member":at.id,"data-split-member":dn.has(at.id)?"true":void 0,...D?Cn(()=>D(at.id)):{},className:`${gt.workspace&&Kt===gt.sessionIds[0]&&Ae===gt.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 ${Ar.combineTargetFor?"bg-primary/15 ring-1 ring-primary/40 ":Ar.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${Tn(at.id)??(at.id===l?"bg-surface-elevated/80 text-foreground":dn.has(at.id)?"bg-primary/[0.05] text-muted-foreground hover:bg-primary/[0.09]":"text-muted-foreground hover:bg-surface-2")}`,children:[$n(at,nr.dragHandleProps,!0,gt.workspace&&Kt===gt.sessionIds[0]?es(gt.workspace):void 0),!gt.workspace&&dn.has(at.id)&&a.jsx("button",{type:"button",className:"shrink-0 px-1 text-[10px] text-primary",title:`与 ${A.find(er=>er.sessionIds.includes(at.id))?.sessionIds.filter(er=>er!==at.id).map(er=>kr.get(er)?.name??er).join("、")} 分屏`,"aria-label":`查看 ${at.name} 的跨组分屏`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:at.id})),He()},children:a.jsx(al,{size:10})})]})},at.id):null})},gt.workspace?.id??gt.sessionIds[0])),mt.placeholder]})}),$.remoteSessions?.map(mt=>a.jsxs("button",{type:"button",title:`${oc(mt)} · ${mt.serviceConnected===!1?"服务不可达,消息尚未送达":mt.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:()=>{m6(mt.sessionId).catch(()=>{Et($.id)})},children:[a.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${mt.serviceConnected===!1?"bg-muted-foreground":"bg-primary"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:mt.name}),a.jsx("span",{className:"max-w-20 truncate rounded border border-border/20 px-1 text-[9px]",children:oc(mt)}),mt.serviceConnected===!1&&a.jsx("span",{className:"shrink-0 text-[9px]",children:"不可达"})]},mt.sessionId)),a.jsx("div",{"data-collaboration-background":!0,className:"h-1.5"})]})},Ms=($,he,De)=>a.jsx(uh,{onBeforeCapture:qr,onDragStart:yr,onDragEnd:Ee=>Yr(Me=>zr(Me,$,De),Ee),children:a.jsx(il,{droppableId:he,direction:"vertical",isCombineEnabled:!hr,children:Ee=>a.jsxs("div",{ref:Ee.innerRef,...Ee.droppableProps,"data-sidebar-entity-list-id":he,className:"space-y-0.5",children:[$.map((Me,ht)=>a.jsx(sl,{draggableId:Me.id,index:ht,disableInteractiveElementBlocking:!0,children:(vt,lt)=>a.jsxs("div",{ref:vt.innerRef,...vt.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":ht,className:"relative",children:[Rn(ht),ht===$.length-1&&Rn($.length,"bottom"),Me.kind==="workspace"?Hr(Me.workspace,Me.members,lt.isDragging,!!lt.combineTargetFor,vt.dragHandleProps):Me.kind==="collaboration"?on(Me.group,Me.members,vt.dragHandleProps,lt.isDragging,!!lt.combineTargetFor):a.jsx("div",{...D?Cn(()=>D(Me.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${lt.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":lt.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":Tn(Me.session.id)??(Me.session.id===l?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:$n(Me.session,vt.dragHandleProps)})]})},Me.id)),Ee.placeholder]})})}),yn=a.jsxs(a.Fragment,{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 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}),En>0&&a.jsx("span",{className:"ml-0.5 flex items-center",children:a.jsx(R6,{count:En,tone:"running",title:re("agent.aiRunning")})})]})}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[a.jsxs("div",{ref:Ce,className:ge?"relative z-20":"relative",children:[a.jsxs("button",{type:"button",onClick:()=>ze($=>!$),className:`relative inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg transition active:scale-95 ${ge?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-expanded":ge,"aria-haspopup":"menu","aria-label":un,title:un,children:[a.jsx(ac,{size:15}),Rt&&a.jsx("span",{className:"absolute right-0.5 top-0.5 z-10 h-2 w-2 rounded-full bg-destructive ring-2 ring-[var(--chrome-bg)]","aria-hidden":"true"}),dr&&a.jsx("span",{className:`absolute top-0.5 z-10 h-2 w-2 rounded-full bg-[var(--warning)] ring-2 ring-[var(--chrome-bg)] ${Rt?"right-3.5":"right-0.5"}`,"aria-hidden":"true"})]}),ge&&a.jsxs("div",{ref:ut,role:"menu",className:"absolute z-30 w-60 overflow-y-auto overscroll-contain rounded-xl border border-border/15 bg-surface p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in",children:[dr&&Y?.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(xs,{size:13,className:Y.status==="installing"||Y.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:Y.latestVersion})}),a.jsx("span",{className:"mt-0.5 block text-[10.5px] leading-relaxed text-muted-foreground",children:Y.status==="installing"?re("sidebar.updateInstalling"):Y.status==="ready"?re("sidebar.updateReady"):Y.status==="restarting"?re("sidebar.updateRestarting"):re("sidebar.updateFailed")})]})]}),Y.status==="ready"&&V&&a.jsx("button",{type:"button",role:"menuitem",disabled:U,onClick:V,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")}),Y.status==="error"&&me&&a.jsx("button",{type:"button",role:"menuitem",disabled:U,onClick:me,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")})]}),ke&&a.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":ce,onClick:()=>ke(!ce),className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",title:re("sidebar.runningSessionButtonHint"),children:[a.jsx(cn,{size:14,className:ce?"text-[color:var(--success)]":"text-muted-foreground"}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block",children:re("sidebar.runningSessionButton")}),a.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:re("sidebar.runningSessionButtonHint")})]}),a.jsx(Po,{checked:ce,size:"sm"})]}),Ie&&a.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":ot,onClick:()=>Ie(!ot),className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",title:re("sidebar.attentionButtonHint"),children:[a.jsx(Ml,{size:14,className:ot?"text-[color:var(--warning)]":"text-muted-foreground"}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block",children:re("sidebar.attentionButton")}),a.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:re("sidebar.attentionButtonHint")})]}),a.jsx(Po,{checked:ot,size:"sm"})]}),q&&a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ze(!1),q()},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[a.jsx(R9,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:re("sidebar.subscriptionQuota")})]}),a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ze(!1),Et(null)},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[a.jsx(jm,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:"Agent 工作台"})]}),a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ze(!1),K7()},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[a.jsx(Z7,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:"服务与设备"})]}),a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ze(!1),O()},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[a.jsx(tA,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:re("sidebar.settings")})]}),de&&a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ze(!1),de()},className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left transition ${Ve?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,children:[Ve?a.jsx(hu,{size:14}):a.jsx(du,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:re(Ve?"sidebar.unpinSidebar":"sidebar.pinSidebar")})]})]})]}),(!Ze||Ve)&&a.jsx("button",{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(gs,{size:14})})]})]})]}),_t&&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:_t}),a.jsx("button",{type:"button","aria-label":"关闭协作错误提示",className:"shrink-0",onClick:()=>Qt(null),children:a.jsx(gs,{size:14})})]}),a.jsxs("div",{ref:Tr,className:"relative z-10 min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pt-0.5 pb-1.5",children:[qe.length>0&&a.jsxs("section",{className:"mb-2 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(Jl,{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:qe.length}),te&&a.jsx("button",{type:"button",onClick:te,disabled:xe,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(xs,{size:11,className:xe?"animate-spin":""})})]}),a.jsx("div",{className:"space-y-0.5",children:qe.slice(0,4).map($=>{const he=$.friendlyName?.trim()||$.label?.trim()||$.name,De=lu($.cwd??null),Ee=yt===$.name;return a.jsxs("button",{type:"button",disabled:yt!==null,onClick:()=>At($),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:he}),title:$.cwd||$.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:Ee?a.jsx(cn,{size:12,className:"animate-spin"}):a.jsx(e0,{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:he}),a.jsx("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[$.program,De].filter(Boolean).join(" · ")||`tmux:${$.name}`})]}),a.jsx("span",{className:"shrink-0 text-[10px] font-medium text-[color:var(--tmux)] group-hover:text-foreground",children:re(Ee?"sidebar.restoringRecoverableSession":"sidebar.restore")})]},$.name)})})]}),i.length===0?a.jsxs("div",{className:"rounded-xl bg-surface-2/60 px-4 py-8 text-center",children:[a.jsx(Ga,{size:26,className:"mx-auto mb-2 text-muted-foreground"}),a.jsx("p",{className:"text-[12px] text-muted-foreground",children:re("sidebar.noSessions")})]}):jr.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")})}):It?a.jsx("div",{className:"space-y-1.5",children:a.jsx(uh,{onBeforeCapture:qr,onDragStart:yr,onDragEnd:$=>Yr(Jn,$),children:a.jsx(il,{droppableId:"sidebar-groups",type:"group",direction:"vertical",children:$=>a.jsxs("div",{ref:$.innerRef,...$.droppableProps,className:"space-y-1.5",children:[ar.map((he,De)=>{const Ee=jn.has(he.key),Me=$0(he.sessions,A,kr,Or);let ht=0,vt=0;for(const rt of he.sessions){const mt=u.get(rt.id);mt?.agentStatus==="working"&&(ht+=1),(mt?.agentStatus==="waiting"||mt?.agentNeedsReview)&&(vt+=1)}const lt=he.key==="";return a.jsx(sl,{draggableId:`sidebar-group:${he.key||"__ungrouped__"}`,index:De,isDragDisabled:lt,disableInteractiveElementBlocking:!0,children:(rt,mt)=>a.jsxs("div",{ref:rt.innerRef,...rt.draggableProps,className:`rounded-md transition-colors ${mt.isDragging?"bg-surface-elevated shadow-lg opacity-90":""}`,children:[a.jsxs("button",{type:"button",...lt?{}:rt.dragHandleProps,onClick:()=>{is(he.key),Yt.current.delete(he.key)},className:`flex w-full items-center gap-1.5 rounded-md px-1.5 py-1 text-left text-muted-foreground transition hover:bg-surface-2 ${lt?"":"cursor-grab active:cursor-grabbing"}`,title:he.key||he.label,children:[a.jsx(Xc,{size:13,className:`shrink-0 transition-transform ${Ee?"":"rotate-90"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold uppercase tracking-wide",children:he.label}),ht>0&&a.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)] animate-pulse"}),vt>0&&a.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] animate-pulse"}),a.jsx(a5,{sessionIds:he.sessions.map(fr=>fr.id)}),a.jsx("span",{className:"shrink-0 text-[10.5px] text-muted-foreground/70",children:he.sessions.length})]}),!Ee&&a.jsx("div",{className:"mt-0.5 pl-2",children:a.jsx(il,{droppableId:`group-sessions:${he.key}`,type:"session",direction:"vertical",isCombineEnabled:!hr,children:fr=>a.jsxs("div",{ref:fr.innerRef,...fr.droppableProps,"data-sidebar-entity-list-id":`group-sessions:${he.key}`,className:"space-y-0.5",children:[Me.map((gt,Kt)=>a.jsx(sl,{draggableId:gt.id,index:Kt,disableInteractiveElementBlocking:!0,children:(at,nr)=>a.jsxs("div",{ref:at.innerRef,...at.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":Kt,className:"relative",children:[Rn(Kt),Kt===Me.length-1&&Rn(Me.length,"bottom"),gt.kind==="workspace"?Hr(gt.workspace,gt.members,nr.isDragging,!!nr.combineTargetFor,at.dragHandleProps):gt.kind==="collaboration"?on(gt.group,gt.members,at.dragHandleProps,nr.isDragging,!!nr.combineTargetFor):a.jsx("div",{...D?Cn(()=>D(gt.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${nr.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":nr.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":Tn(gt.session.id)??(gt.session.id===l?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:$n(gt.session,at.dragHandleProps)})]})},gt.id)),fr.placeholder]})})})]})},he.key||"__ungrouped__")}),$.placeholder]})})})}):Ms(us,"sidebar-entities")]}),a.jsx(X7,{onReselect:()=>{h&&(In.current=null,Ke($=>$+1),h())}}),Oe&&a.jsx(IQ,{directories:i.flatMap($=>{const he=u.get($.id)?.cwd;return he?[he]:[]}),tmuxAvailable:ve,options:Pe,agents:ue,selectedAgent:jt,detecting:Nt,resumeHistory:Te,resumeHistoryLoading:$e,resumeHistoryPendingId:Tt,resumeHistoryError:rr,onRefreshAgents:()=>{qt().catch(()=>{})},onSelectAgent:$=>{Se($).catch(()=>{})},onLaunchAgent:hn,onResumeHistory:$=>{nn($)},onRemoveResumeHistory:$=>{On($)},onClose:()=>nt(!1),onOptionsChange:it}),Re&&a.jsx($5,{onFloatingChange:async $=>{$&&(await Et($),X(!1))},activeSessionId:l,defaultSessionMode:_e,onClose:()=>X(!1),onNewSession:$=>p($)}),Object.entries(Be).map(([$,he])=>a.jsx($5,{activeSessionId:l,initialCollaborationGroupId:$,initialFloating:he,onFloatingChange:De=>wt($,De),defaultSessionMode:_e,onClose:()=>{je.current=!0,st(De=>{const Ee={...De};return delete Ee[$],Ee})},onNewSession:De=>p(De)},$)),!Oe&&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 ${jt?"grid-cols-[minmax(0,1fr)_minmax(0,1fr)_2.5rem]":"grid-cols-[minmax(0,1fr)_2.5rem]"}`,children:[a.jsxs("button",{type:"button",onClick:cr,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] ${jt?"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(Ga,{size:15,className:"shrink-0"}),a.jsx("span",{className:"truncate",children:"Terminal"})]}),jt&&a.jsxs("button",{type:"button",onClick:Gt,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:jt.displayName}),"aria-label":re("sidebar.newSessionWithAgent",{agent:jt.displayName}),children:[a.jsx(ic,{agent:jt,size:15}),a.jsx("span",{className:"truncate",children:jt.displayName})]}),a.jsx("button",{type:"button",onClick:rn,className:"inline-flex w-10 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground ring-1 ring-border/20 transition hover:bg-surface-elevated hover:text-foreground active:scale-[0.97]",title:re("sidebar.moreLaunchOptions"),"aria-label":re("sidebar.moreLaunchOptions"),"aria-expanded":!1,children:a.jsx(Oo,{size:15,className:"transition-transform duration-200"})})]})})]});return Ve?a.jsx("div",{"data-session-sidebar-pinned":!0,className:"h-full flex flex-col app-chrome-bg border-r border-border",children:yn}):a.jsx(k6,{side:"left",isOpen:e,drawerWidthPx:t,onClose:r,onOpen:n,push:Ze,children:yn})}function XQ(){const{t:e}=Jr();return a.jsxs("div",{role:"status","aria-label":e("rightSidebar.loadingGitChanges"),className:"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 JQ({slow:e=!1}){const{t}=Jr();return a.jsxs("div",{role:"status","aria-label":t("rightSidebar.loadingGitChanges"),className:"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 O6=()=>t8(()=>import("./RightSidebar-B52JGGs9.js").then(e=>e.R),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])).then(e=>({default:e.RightSidebar})),ej=y.lazy(O6);function Y5(e){const t=y.useRef(!1);y.useEffect(()=>{const p=navigator.connection;if(!(p?.saveData||/2g|3g/.test(p?.effectiveType??"")))return d1(()=>{O6().catch(()=>{})},3e3)},[]);const{t:r}=Jr(),n=Jt(p=>p.rootPath),i=Jt(p=>p.rightTab),l=Jt(p=>p.setRightTab),u=n?.replace(/\/+$/,"").split("/").pop()||r("rightSidebar.workspace");(e.isOpen||e.pinned)&&(t.current=!0);const h=a.jsx(k6,{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:u})})}),a.jsx("div",{"aria-hidden":"true",className:"flex items-center gap-1.5",children:[fu,Pw,ac].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(gs,{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",h9,"rightSidebar.tabGit"],["diff",p9,"rightSidebar.tabChanges"],["files",lc,"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(JQ,{}):a.jsx(XQ,{})})]})});return t.current?a.jsx(y.Suspense,{fallback:h,children:a.jsx(ej,{...e})}):h}const Z5=bh(e=>({overlay:"off",setOverlay:t=>e({overlay:t})}));function tj(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 rj=bh((e,t)=>({sessions:new Map,activeSessionId:null,nextSessionNumber:1,createSession:r=>{const n=r3(),i=Date.now(),l=t().sessions,u=tj(l),h={id:n,cwd:r,sessionId:null,name:u,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 u=n.activeSessionId;if(l){const h=Array.from(i.keys());u=h.length>0?h[0]:null}return{sessions:i,activeSessionId:u}})},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 u=new Map(i.sessions);return u.set(r,{...l,...n,lastActivity:Date.now()}),{sessions:u}})},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})}})),nj=[7e5,1e6,14e5,18e5,24e5,32e5,4e6,5e6,6e6,8e6,1e7,12e6].map(e=>({id:"auto",maxSize:1600,bitRate:e,maxFps:30}));class sj{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 nj[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,u=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>=(u?1e3:2e3)&&r-this.lastChange>=(u?2e3:3e3)&&this.level>0){this.level=Math.max(0,this.level-(u?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 fc(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 ij(){return fc("/api/android/devices")}async function aj(e){return fc("/api/android/connect",{method:"POST",body:JSON.stringify({address:e})})}const xh=[{id:"low",maxSize:720,bitRate:12e5,maxFps:30},{id:"medium",maxSize:1080,bitRate:4e6,maxFps:30},{id:"high",maxSize:1600,bitRate:8e6,maxFps:60}],Su=xh[1];function s1(e){if(!e||typeof e!="object")return Su;const t=e;if(t.id==="auto")return{id:"auto",maxSize:1600,bitRate:4e6,maxFps:30};const r=xh.find(u=>u.id===t.id);if(r)return r;if(t.id!=="custom")return Su;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 oj(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 K5(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 lj(e){return fc(`/api/android/recordings?serial=${encodeURIComponent(e)}`)}function cj(e){return fc("/api/android/recordings",{method:"POST",body:JSON.stringify({serial:e})})}function uj(e){return fc(`/api/android/recordings/${encodeURIComponent(e)}/stop`,{method:"POST"})}function dj(e,t){return fc(`/api/android/recordings/${encodeURIComponent(e)}/save`,{method:"POST",body:JSON.stringify({directory:t})})}function hj(e){return fc(`/api/android/recordings/${encodeURIComponent(e)}`,{method:"DELETE"})}const fj=0,pj=1,mj=2,gj=3,xj=4,bj=5,yj=7,vj=10,wj=11,Aj=16,X5=17,J5=0,ap=1,Tj=2,ex=3,op=0,tx=1,rx=1,Pc=0xffffffffffffffffn,Sd=0xfffffffffffffffen,z0={HOME:3,APP_SWITCH:187,POWER:26,VOLUME_UP:24,VOLUME_DOWN:25};function F6(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 Cj(e,t,r,n,i,l){const u=new Uint8Array(32),h=new DataView(u.buffer);return h.setUint8(0,mj),h.setUint8(1,e),h.setBigUint64(2,t),F6(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),u}function lp(e,t,r=0,n=0){const i=new Uint8Array(14),l=new DataView(i.buffer);return l.setUint8(0,fj),l.setUint8(1,e),l.setUint32(2,t>>>0),l.setUint32(6,r>>>0),l.setUint32(10,n>>>0),i}function Sj(e,t,r,n=0){const i=new Uint8Array(21),l=new DataView(i.buffer);l.setUint8(0,gj),F6(l,1,e);const u=h=>Math.max(-32768,Math.min(32767,Math.round(Math.max(-1,Math.min(1,h/16))*32768)));return l.setInt16(13,u(t)),l.setInt16(15,u(r)),l.setUint32(17,n>>>0),i}function _j(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,pj),i.setUint32(1,r.length),n.set(r,5),n}function Lj(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]=Aj,r[1]=t.length,r.set(t,2),r}function H0(e){return new Uint8Array([e])}function nx(e){return new Uint8Array([xj,e])}function kj(e){return new Uint8Array([vj,e?1:0])}function Ij(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)}function Ej(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 U6(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,u=e[n]===0&&e[n+1]===0&&e[n+2]===0&&e[n+3]===1?n+4:i?n+3:-1;if(u<0||u>=e.length)continue;if((r?e[u]>>1&63:e[u]&31)!==t){n=u-1;continue}let p=u+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(u,Math.min(e.length,p))}return null}function Rj(e){const t=e?U6(e,7,!1):null;return t&&t.length>=4?`avc1.${cp(t[1])}${cp(t[2])}${cp(t[3])}`:"avc1.42e01e"}function Nj(e){const t=e?U6(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 Mj{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=r8(oj(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(H0(X5)))},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:Ij(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=Ej(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 u=performance.now()-n/1e3;this.minimumFrameOffset=Math.min(this.minimumFrameOffset,u),this.deliveryDelayMs=Math.max(0,u-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(H0(X5))}})}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=[Rj(this.configData),"avc1.42e01e","avc1.4d401e","avc1.64001f"].filter((u,h,p)=>p.indexOf(u)===h),r.avc={format:"annexb"}):t==="h265"?(n=[Nj(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(u){i.push(`${l}: ${u instanceof Error?u.message:String(u)}`),console.warn("[android] decoder configure failed",l,u)}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===ap||t===ex,u=l?0:1,h=i===Pc&&!l?rx:0,p=(t===J5||t===ap)&&i===Pc?rx:0;this.sendControl(Cj(t,i,this.pointerPoint(r,n),u,p,h))}pointerDown(t,r,n){this.touch(J5,t,r,n==="mouse"?Pc:Sd)}pointerMove(t,r,n){this.touch(Tj,t,r,n==="mouse"?Pc:Sd)}pointerUp(t,r,n){this.touch(ap,t,r,n==="mouse"?Pc:Sd)}pointerCancel(t,r,n){this.touch(ex,t,r,n==="mouse"?Pc:Sd)}scroll(t,r,n,i){this.sendControl(Sj(this.pointerPoint(t,r),n,i))}key(t,r=op){this.sendControl(lp(r,t))}tapKey(t){this.sendControl(lp(op,t)),this.sendControl(lp(tx,t))}back(){this.sendControl(nx(op)),this.sendControl(nx(tx))}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(H0(wj))}expandNotifications(){this.sendControl(H0(bj))}collapsePanels(){this.sendControl(H0(yj))}setDisplayPower(t){this.sendControl(kj(t))}sendText(t){this.sendControl(_j(t))}startApp(t){this.sendControl(Lj(t))}}function Dj(){try{return crypto.randomUUID().slice(0,8)}catch{return Math.random().toString(36).slice(2,10)}}function Bj(){return`termdock-mirror-shot-${new Date().toISOString().replace(/[-:T]/g,"").slice(0,14)}-${Dj()}.png`}function sx(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 Qj(e,t=Bj()){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 u=await new Promise(h=>i.toBlob(h,"image/png"));if(!u||u.size===0)throw new Error("截图失败,请重试");return new File([u],t,{type:"image/png"})}function $6(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 ix(e,t,r,n,i){const l=Math.max(1,Math.min(8,e.zoom*i)),u=l/e.zoom;return{zoom:l,pan:$6({x:n.x-t.cx-(r.x-t.cx-e.pan.x)*u,y:n.y-t.cy-(r.y-t.cy-e.pan.y)*u},l,t)}}function z6(e,t){return t?new Promise((r,n)=>{const i=crypto.randomUUID(),l=p=>{window.clearTimeout(h),window.removeEventListener("termdock-insert-reference-ack",u),p?r():n(new Error("目标终端不可用,内容尚未插入,请连接终端后重试"))},u=p=>{const g=p.detail;g?.nonce===i&&l(g.ok===!0)},h=window.setTimeout(()=>l(!1),1e4);window.addEventListener("termdock-insert-reference-ack",u),window.dispatchEvent(new CustomEvent("termdock-insert-reference",{detail:{text:e,sessionId:t,nonce:i,focus:!1,paste:!0}}))}):Promise.reject(new Error("没有可接收内容的终端"))}function ax(e,t){return z6(X3(e,null),t)}const up=bh(e=>({pending:[],enqueue:(t,r,n="/",i)=>e(l=>l.pending.some(u=>u.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 jj({file:e,initialPath:t,onInsert:r,onDone:n}){const{t:i}=Jr(),[l,u]=y.useState(!1),[h,p]=y.useState(!1),[g,x]=y.useState(!1),[b,w]=y.useState(!1),[A,k]=y.useState(null),I=y.useRef(!1),N=y.useRef(null),R=async()=>{if(!I.current){I.current=!0,p(!0),w(!0);try{await hj(e.id),n()}catch(O){k(O instanceof Error?O.message:String(O))}finally{I.current=!1,p(!1),w(!1)}}};y.useEffect(()=>{if(l)return;N.current?.focus();const O=q=>{if(q.stopPropagation(),q.key==="Escape"&&q.preventDefault(),q.key!=="Tab")return;const Y=Array.from(N.current?.querySelectorAll("button:not(:disabled)")??[]),U=Y[0],V=Y.at(-1);q.shiftKey&&(document.activeElement===U||document.activeElement===N.current)?(q.preventDefault(),V?.focus()):!q.shiftKey&&document.activeElement===V&&(q.preventDefault(),U?.focus())};return document.addEventListener("keydown",O,!0),()=>document.removeEventListener("keydown",O,!0)},[l]);const D=async O=>{if(!I.current){I.current=!0,p(!0),x(O!==void 0),u(!1),k(null);try{const q=await dj(e.id,O);O===void 0&&await r(q.path),n()}catch(q){k(q instanceof Error?q.message:String(q))}finally{I.current=!1,p(!1)}}};return l?a.jsx(Y1,{open:!0,initialPath:t||"/",title:i("android.recordingSave"),onCancel:()=>u(!1),onConfirm:O=>{D(O)}}):na.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:N,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(cn,{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:()=>{D()},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:()=>u(!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:()=>{R()},className:"min-h-10 rounded-lg px-3 text-sm text-muted-foreground disabled:opacity-40",children:i("android.recordingDiscard")})]})]})}),document.body)}const nu="android-mirror",W0=nu,H6="termdock:android:quality:v1",dp=176,Pj=204,nl=1,Wd=8,ox=[1,1.25,1.5,2,2.5,3,4,6,8],Oj=e=>Math.max(nl,Math.min(Wd,e));function Fj(e){return`${Number.isInteger(e)?e:e.toFixed(1)}×`}function _d(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,u=t.clientWidth-i-(parseFloat(n.paddingRight)||0),h=t.clientHeight-l-(parseFloat(n.paddingBottom)||0);return{cx:r.left+t.clientLeft+i+u/2,cy:r.top+t.clientTop+l+h/2,width:u,height:h,contentWidth:e.offsetWidth,contentHeight:e.offsetHeight}}function Uj(e,t){try{e.setPointerCapture?.(t)}catch{}}function lx(e,t){try{e.releasePointerCapture?.(t)}catch{}}const cx=e=>typeof requestAnimationFrame=="function"?requestAnimationFrame(e):window.setTimeout(e,16),Ld=e=>{typeof cancelAnimationFrame=="function"?cancelAnimationFrame(e):window.clearTimeout(e)},hp={auto:"android.qualityAuto",low:"android.qualityLow",medium:"android.qualityMedium",high:"android.qualityHigh",custom:"android.qualityCustom"},$j=()=>{try{const e=localStorage.getItem(H6);return e?s1(JSON.parse(e)):Su}catch{return Su}},G0=e=>{try{localStorage.setItem(H6,JSON.stringify(e))}catch{}};function zj({sessionId:e,dockOnly:t=!1,onInsertPrompt:r,onInsertFile:n,onRecordingComplete:i}){const{t:l}=Jr(),u=Z5(j=>j.overlay),h=Z5(j=>j.setOverlay),p=y.useRef(null),g=y.useRef(null),x=y.useRef(null),b=y.useMemo($j,[]),w=y.useRef(b),A=y.useRef(null),k=y.useRef(null),[I,N]=y.useState(4e6),R=y.useRef(null),D=y.useRef(new Map),O=y.useRef(null),q=y.useRef(!1),[Y,U]=y.useState(nl),V=y.useRef(Y),me=y.useRef({x:0,y:0}),Je=y.useRef(null),ve=y.useRef(0),_e=y.useRef(0),Ze=y.useRef(null),Ve=y.useRef(0),[ce,ke]=y.useState(null),[ot,Ie]=y.useState(null),[de,qe]=y.useState(!0),[xe,te]=y.useState(""),[re,ge]=y.useState(b.id),[ze,Ke]=y.useState([]),[Ae,z]=y.useState(null),[Oe,nt]=y.useState(""),[Re,X]=y.useState(!0),[Be,st]=y.useState({maxSize:b.maxSize,bitRate:b.bitRate,maxFps:b.maxFps}),[be,je]=y.useState("idle"),[wt,Te]=y.useState(null),[pe,$e]=y.useState(null),[pt,Tt]=y.useState({fps:0,kbps:0,width:0,height:0,received:0,decoded:0,controls:0,last:""}),[Ct,rr]=y.useState(null),[ir,yt]=y.useState(null),[bt,_t]=y.useState(!1),[Qt,Et]=y.useState([]),[Ht,ne]=y.useState(null),[Pe,it]=y.useState([]),[jt,ue]=y.useState(!1),Nt=y.useRef(null),qt=y.useRef(0),Se=y.useRef([]),[Ce,ut]=y.useState(!1),[Ge,dr]=y.useState(""),[Rt,un]=y.useState(!1),[It,jn]=y.useState(!1),[is,Pn]=y.useState(""),[Tr,In]=y.useState(null),[Br,ie]=y.useState(null),[$r,ft]=y.useState(!1),[hr,Ls]=y.useState(0),Un=y.useRef(null),[as,Pr]=y.useState(!1),Yt=y.useRef(!1),Xn=y.useRef(new Set),dn=y.useRef(null),kr=y.useRef(null),Or=y.useRef(!1),[Ur,qr]=y.useState(!1),An=y.useRef(i);An.current=i;const[Yr,jr]=y.useState(!1),[En,Z]=y.useState(null),He=y.useRef(null),xt=y.useRef(null),cr=rj(j=>j.activeSessionId??j.sessions.keys().next().value??null),Gt=e??cr,At=ss(j=>!!j.docks[W0]),hn=ss(j=>j.hosts[W0]),nn=ss(j=>j.setDock),On=y.useCallback(async()=>{qe(!0);try{const j=await ij();ke(j),Ie(null)}catch(j){Ie(j instanceof Error?j.message:"ADB_UNAVAILABLE")}finally{qe(!1)}},[]);y.useEffect(()=>{On()},[On]);const rn=ce?.devices??[],Tn=rn.find(j=>j.serial===xe)??null,Cn=!!(ot&&/ADB_NOT_FOUND|ADB_UNAVAILABLE/i.test(ot)),$n=!!(ce?.adbAvailable&&!ce.scrcpyVersion),ar=y.useCallback(()=>{const j=R.current,ye=[...D.current.keys()];R.current=null,D.current.clear(),O.current=null,q.current=!1,Nt.current=null,Ld(ve.current),ve.current=0,j&&g.current?.pointerCancel(j.x,j.y,j.type);const Ne=p.current;if(Ne)for(const tt of ye)lx(Ne,tt);ne(null),ue(!1),it([]),U(V.current)},[]);y.useEffect(()=>{const j=tt=>{D.current.has(tt.pointerId)&&(tt.type==="pointercancel"||tt.target!==p.current)&&ar()},ye=()=>ar(),Ne=()=>{document.hidden&&ar()};return window.addEventListener("pointerup",j,!0),window.addEventListener("pointercancel",j,!0),window.addEventListener("blur",ye),document.addEventListener("visibilitychange",Ne),()=>{window.removeEventListener("pointerup",j,!0),window.removeEventListener("pointercancel",j,!0),window.removeEventListener("blur",ye),document.removeEventListener("visibilitychange",Ne),ar()}},[ar]);const us=y.useCallback(()=>{ar(),g.current?.disconnect(),g.current=null,je("idle"),Te(null),$e(null)},[ar]),yr=y.useCallback((j,ye=!1)=>{const Ne=p.current;if(!Ne||!j)return;ar(),g.current?.disconnect(),Te(null),!ye&&x.current!==j&&$e(null),x.current=j,yt(null),rr(null);const tt=new Mj(Ne,{onBitrateSupport:(Zt,Vt)=>{g.current!==tt||w.current.id!=="auto"||rr(Zt?null:Vt??"BITRATE_REASON_UNAVAILABLE")},onState:(Zt,Vt)=>{g.current===tt&&(je(Zt),Te(Vt??null))},onHeader:Zt=>{g.current===tt&&$e(Zt)},onStats:Zt=>{g.current===tt&&Tt(Zt)},onWarning:Zt=>{g.current===tt&&yt(Zt)}});g.current=tt;let Lt=w.current;Lt.id==="auto"?(A.current?.serial!==j&&(A.current={serial:j,policy:new sj}),A.current.policy.connected(performance.now()),Lt=A.current.policy.quality,N(Lt.bitRate)):A.current=null,k.current=Lt,tt.connect(j,Lt)},[ar]);y.useEffect(()=>{if(re!=="auto"||w.current.id!=="auto"||be!=="streaming"||!pt.adaptation||document.hidden)return;const j=A.current,ye=g.current;if(!j||j.serial!==xe||!ye?.canSetBitrate)return;const Ne=p.current,tt=Ne?Math.max(Ne.clientWidth,Ne.clientHeight)*(window.devicePixelRatio||1)*V.current:1600,Lt=j.policy.sample(pt.adaptation,performance.now(),tt||1600);Lt&&ye.setBitrate(Lt.bitRate).then(Zt=>{Zt&&g.current===ye&&(k.current=Lt,N(Lt.bitRate))})},[pt,re,be,xe,yr]);const Qr=y.useCallback(j=>{const ye={...j.quality?{quality:{id:j.quality.id,maxSize:j.quality.maxSize,bitRate:j.quality.bitRate,maxFps:j.quality.maxFps}}:{},...j.activePresetId!==void 0?{activePresetId:j.activePresetId}:{},...j.presets!==void 0?{presets:j.presets}:{},...j.docked!==void 0?{docked:j.docked}:{},...j.deviceSerial!==void 0?{deviceSerial:j.deviceSerial}:{}};ra({androidPanel:ye}).catch(()=>{})},[]);y.useEffect(()=>{let j=!1;return Bl().then(ye=>{if(j)return;const Ne=ye.androidPanel;if(Ne?.quality){const tt=s1(Ne.quality);w.current=tt,ge(tt.id),st({maxSize:tt.maxSize,bitRate:tt.bitRate,maxFps:tt.maxFps}),G0(tt)}Ke(Ne?.presets??[]),z(Ne?.activePresetId??null),Ne?.deviceSerial&&(Ze.current=Ne.deviceSerial,te(Ne.deviceSerial))}).catch(()=>{}),()=>{j=!0}},[]);const Cr=y.useCallback(j=>{const ye=++qt.current;Et(tt=>[...tt,{id:ye,left:j.left,top:j.top}]);const Ne=window.setTimeout(()=>{Et(tt=>tt.filter(Lt=>Lt.id!==ye)),Se.current=Se.current.filter(tt=>tt!==Ne)},300);Se.current.push(Ne)},[]),ds=y.useCallback((j,ye)=>{const Ne=g.current,tt=k.current;Ne?.supportsLiveBitrate&&x.current===j&&tt&&tt.maxSize===ye.maxSize&&tt.maxFps===ye.maxFps?Ne.setBitrate(ye.bitRate).then(Lt=>{g.current===Ne&&(Lt?(k.current=ye,rr(null)):rr(Ne.lastBitrateFailure??"BITRATE_REASON_UNAVAILABLE"))}):yr(j)},[yr,l]),Ln=y.useCallback(j=>{if(A.current=null,j.startsWith("user:")){const Ne=ze.find(Lt=>Lt.id===j.slice(5));if(!Ne)return;const tt={id:"custom",maxSize:Ne.maxSize,bitRate:Ne.bitRate,maxFps:Ne.maxFps};w.current=tt,ge("custom"),z(Ne.id),st({maxSize:Ne.maxSize,bitRate:Ne.bitRate,maxFps:Ne.maxFps}),X(!0),G0(tt),Qr({quality:tt,activePresetId:Ne.id}),xe&&yr(xe);return}if(j==="custom"){const Ne=w.current;ge("custom"),z(null),st({maxSize:Ne.maxSize,bitRate:Ne.bitRate,maxFps:Ne.maxFps}),X(!0);return}const ye=j==="auto"?s1({id:"auto"}):xh.find(Ne=>Ne.id===j)??Su;w.current=ye,ge(ye.id),z(null),G0(ye),Qr({quality:ye,activePresetId:null}),xe&&yr(xe)},[yr,xe,ze,Qr]),Rn=y.useCallback(()=>{const j={id:"custom",maxSize:Be.maxSize,bitRate:Be.bitRate,maxFps:Be.maxFps};w.current=j,G0(j),Qr({quality:j,activePresetId:null}),ge("custom"),z(null),xe&&ds(xe,j)},[ds,xe,Be,Qr]),zr=y.useCallback(()=>{const j=Oe.trim();if(!j)return;const ye=`p${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,Ne={id:ye,name:j,maxSize:Be.maxSize,bitRate:Be.bitRate,maxFps:Be.maxFps},tt=[...ze.filter(Zt=>Zt.name!==j),Ne].slice(-12),Lt={id:"custom",maxSize:Be.maxSize,bitRate:Be.bitRate,maxFps:Be.maxFps};Ke(tt),nt(""),z(ye),ge("custom"),w.current=Lt,G0(Lt),Qr({quality:Lt,activePresetId:ye,presets:tt}),xe&&ds(xe,Lt)},[Oe,Be,ze,xe,ds,Qr]),Jn=y.useCallback(()=>{if(!Ae)return;const j=ze.filter(ye=>ye.id!==Ae);Ke(j),z(null),Qr({activePresetId:null,presets:j})},[Ae,ze,Qr]);y.useEffect(()=>()=>{g.current?.disconnect(),g.current=null;for(const j of Se.current)window.clearTimeout(j);Se.current=[]},[]),y.useEffect(()=>{if(u==="off")return;const j=ye=>{ye.key==="Escape"&&h("off")};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[u,h]),y.useEffect(()=>{const j=rn.filter(Ne=>Ne.state==="device");if(xe||j.length!==1)return;const ye=j[0].serial;Ze.current!==ye&&(Ze.current=ye,te(ye))},[rn,xe]),y.useEffect(()=>{xe&&yr(xe)},[xe,yr]),y.useEffect(()=>{if(be==="streaming"){Ve.current=0,_t(!1);return}if(be!=="error"||!xe||!Wj(wt??""))return;const j=Math.min(8e3,700*2**Ve.current);Ve.current+=1,_t(!0);const ye=window.setTimeout(()=>{_t(!1),yr(xe)},j);return()=>window.clearTimeout(ye)},[be,wt,xe,yr]);const es=y.useCallback((j,ye,Ne)=>{const tt=p.current,Lt=Ne??(tt?_d(tt):null);return!tt||!Lt?{x:0,y:0}:$6(j,ye,Lt)},[]),ur=y.useCallback(()=>{const j=p.current;if(!j)return;const{x:ye,y:Ne}=me.current,tt=V.current,Lt=tt===nl&&ye===0&&Ne===0?"":`translate3d(${ye}px, ${Ne}px, 0) scale(${tt})`;j.style.transform!==Lt&&(j.style.transform=Lt);const Zt=Je.current;Zt&&(Zt.textContent=tt>nl?Fj(tt):"")},[]),Hr=y.useCallback((j,ye,Ne=!0)=>{const tt=p.current,Lt=V.current,Zt=Oj(j);if(!tt||Zt===Lt)return;const Vt=_d(tt);if(!Vt)return;const zt=ye??{x:Vt.cx,y:Vt.cy},_r=ix({zoom:Lt,pan:me.current},Vt,zt,zt,Zt/Lt);V.current=_r.zoom,me.current=_r.pan,Ne&&ur()},[ur]),on=y.useCallback(()=>{const j=V.current;U(ye=>ye<=nl+.01==j<=nl+.01&&ye>=Wd-.01==j>=Wd-.01?ye:j)},[]);y.useEffect(()=>()=>{Ld(ve.current),Ld(_e.current)},[]);const Ms=()=>{let j=0,ye=0;for(const tt of D.current.values())j+=tt.x,ye+=tt.y;const Ne=D.current.size;return Ne?{x:j/Ne,y:ye/Ne}:null},yn=()=>{const[j,ye]=Array.from(D.current.values());return j&&ye?Math.hypot(j.x-ye.x,j.y-ye.y):0},$=()=>{const j=Ms(),ye=p.current?_d(p.current):null;!j||!ye||(O.current={startCentroid:j,startDistance:yn(),box:ye})},he=y.useCallback(()=>{const j=O.current,ye=Ms();if(!j||!ye)return;const Ne=yn(),tt=j.startDistance>0&&Ne>0?Ne/j.startDistance:1,Lt=ix({zoom:V.current,pan:me.current},j.box,j.startCentroid,ye,tt);V.current=Lt.zoom,me.current=Lt.pan,j.startCentroid=ye,j.startDistance=Ne},[]),De=y.useCallback(()=>{ve.current||(ve.current=cx(()=>{ve.current=0,he(),ur()}))},[he,ur]),Ee=y.useCallback(()=>{ve.current&&(Ld(ve.current),ve.current=0,he(),ur())},[he,ur]);y.useEffect(()=>{const j=p.current;if(!j)return;const ye=j.parentElement;if(!ye)return;const Ne=Lt=>{if(Lt.ctrlKey||Lt.metaKey){if(Lt.preventDefault(),!Lt.deltaY||O.current)return;const zt=Lt.deltaMode===1?16:Lt.deltaMode===2?j.parentElement?.clientHeight||600:1,_r=Math.max(-600,Math.min(600,Lt.deltaY*zt));Hr(V.current*Math.exp(-_r*.002),{x:Lt.clientX,y:Lt.clientY},!1),_e.current||(_e.current=cx(()=>{_e.current=0,ur(),on()}));return}const Zt=g.current;if(!Zt||Lt.target!==j)return;Lt.preventDefault();const Vt=Id(j,Lt.clientX,Lt.clientY);Zt.scroll(Vt.x,Vt.y,Lt.deltaX,Lt.deltaY)},tt=Lt=>Lt.preventDefault();return ye.addEventListener("wheel",Ne,{passive:!1}),ye.addEventListener("gesturestart",tt,{passive:!1}),ye.addEventListener("gesturechange",tt,{passive:!1}),()=>{ye.removeEventListener("wheel",Ne),ye.removeEventListener("gesturestart",tt),ye.removeEventListener("gesturechange",tt)}},[Hr,ur,on]),y.useEffect(()=>{const j=p.current,ye=j?.parentElement;if(!j||!ye||typeof ResizeObserver>"u")return;const Ne=new ResizeObserver(()=>{O.current&&(O.current.box=_d(j));const tt=es(me.current,V.current);tt.x===me.current.x&&tt.y===me.current.y||(me.current=tt,ur())});return Ne.observe(j),Ne.observe(ye),()=>Ne.disconnect()},[es,ur]),y.useLayoutEffect(()=>{ur()});const Me=j=>{const ye=g.current,Ne=p.current;if(!ye||!Ne)return;if(j.pointerType==="mouse"&&j.button!==0){j.preventDefault(),j.button===2?ye.back():j.button===1&&ye.home();return}j.preventDefault(),Ne.closest(".android-mirror-panel")?.focus({preventScroll:!0}),ur(),on(),Ee(),Uj(Ne,j.pointerId),D.current.set(j.pointerId,{x:j.clientX,y:j.clientY});const tt=j.pointerType==="mouse"&&j.altKey;if(D.current.size>=2||tt){const Vt=R.current;Vt&&(ye.pointerCancel(Vt.x,Vt.y,Vt.type),R.current=null,Nt.current=null,ne(null),ue(!1),it([])),q.current=!0,$();return}if(q.current)return;const Lt=Id(Ne,j.clientX,j.clientY);R.current={id:j.pointerId,type:j.pointerType,x:Lt.x,y:Lt.y},ye.pointerDown(Lt.x,Lt.y,j.pointerType);const Zt=px(Ne,j.clientX,j.clientY);Zt&&(Nt.current={left:Zt.left,top:Zt.top},it([]),ue(!1),ne(Zt))},ht=j=>{const ye=g.current,Ne=p.current;if(!Ne||!D.current.has(j.pointerId))return;if(j.pointerType==="mouse"){const zt=Ne.getBoundingClientRect(),_r=Ne.parentElement?.getBoundingClientRect()??zt;if(!(j.buttons&1)||j.clientX<Math.max(zt.left,_r.left)||j.clientX>=Math.min(zt.right,_r.right)||j.clientY<Math.max(zt.top,_r.top)||j.clientY>=Math.min(zt.bottom,_r.bottom)){ar();return}}if(j.preventDefault(),D.current.set(j.pointerId,{x:j.clientX,y:j.clientY}),O.current){De();return}const tt=R.current;if(!ye||!tt||tt.id!==j.pointerId)return;const Lt=Id(Ne,j.clientX,j.clientY);tt.x=Lt.x,tt.y=Lt.y,ye.pointerMove(Lt.x,Lt.y,tt.type);const Zt=px(Ne,j.clientX,j.clientY),Vt=Nt.current;!Zt||!Vt||(ne(Zt),Math.hypot(Zt.left-Vt.left,Zt.top-Vt.top)>=6&&(ue(!0),it(zt=>{const _r=zt[zt.length-1];if(_r&&Math.hypot(Zt.left-_r.x,Zt.top-_r.y)<4)return zt;const bs=[...zt,{x:Zt.left,y:Zt.top}];return bs.length>12?bs.slice(bs.length-12):bs})))},vt=j=>{const ye=g.current,Ne=p.current;if(!Ne||!D.current.has(j.pointerId))return;if(Ee(),D.current.delete(j.pointerId),lx(Ne,j.pointerId),D.current.size===0&&(q.current=!1),O.current){D.current.size===0?(O.current=null,U(V.current)):$();return}const tt=R.current;if(!tt||tt.id!==j.pointerId)return;const Lt=Id(Ne,j.clientX,j.clientY);ye?.pointerUp(Lt.x,Lt.y,tt.type),Ht&&Cr(Ht),ne(null),ue(!1),window.setTimeout(()=>it([]),200),R.current=null,Nt.current=null},lt=j=>{if(Yr||Ce||It)return;const ye=g.current;ye&&(j.key==="Backspace"?(j.preventDefault(),ye.key(67)):j.key==="Escape"?(j.preventDefault(),ye.back()):j.key==="Enter"&&(j.preventDefault(),ye.key(66)))},rt=async()=>{const j=Ge.trim();if(j){un(!0);try{const ye=await aj(j);dr(""),ut(!1),await On(),te(ye.serial)}catch(ye){Ie(ye instanceof Error?ye.message:"ADB_CONNECT_FAILED")}finally{un(!1)}}},mt=()=>{const j=g.current,ye=is;!j||!ye||(j.sendText(ye),Pn(""))},fr=y.useCallback(j=>{In(j),kr.current!==null&&window.clearTimeout(kr.current),kr.current=window.setTimeout(()=>{kr.current=null,In(null)},2500)},[]),gt=y.useCallback(j=>{const ye=V.current,Ne=j==="in"?ox.find(tt=>tt>ye+.01):[...ox].reverse().find(tt=>tt<ye-.01);Ne!==void 0&&(ye<=nl&&Ne>nl&&fr(l("android.zoomPanHint")),Ee(),Hr(Ne),U(Ne))},[Hr,Ee,fr,l]),Kt=j=>{Promise.resolve().then(()=>r?.(j)).catch(ye=>{ie(ye instanceof Error?ye.message:String(ye))})},at=y.useCallback(async(j,ye)=>{try{if(!n)throw new Error(l("android.captureUnavailable"));await n(j),fr(ye)}catch(Ne){ie(l("android.captureFailed")+(Ne instanceof Error?`:${Ne.message}`:""))}},[n,fr,l]),nr=async()=>{const j=p.current;if(!(!j||Or.current)){Or.current=!0,qr(!0),ie(null);try{const ye=await Qj(j);await at(ye,l("android.captureInserted"))}catch(ye){ie(ye instanceof Error?ye.message:String(ye))}finally{Or.current=!1,qr(!1)}}},Ar=y.useCallback(j=>{(j.status==="ready"||j.status==="error")&&An.current&&!Xn.current.has(j.id)&&(Xn.current.add(j.id),An.current?.(j))},[]),er=y.useCallback(async j=>{const ye=Un.current;if(!(!ye||Yt.current)){Yt.current=!0,Pr(!0),ie(null);try{const Ne=await uj(ye.id);Un.current=null,ft(!1),Ar(Ne)}catch(Ne){ie(Ne instanceof Error?Ne.message:String(Ne))}finally{Yt.current=!1,Pr(!1)}}},[Ar]),Gr=async()=>{if(!(!xe||Yt.current||Un.current)){Yt.current=!0,Pr(!0),ie(null);try{const j=await cj(xe);j.status==="recording"||j.status==="starting"||j.status==="stopping"?(Un.current=j,ft(!0),Ls(Math.max(0,Date.now()-j.startedAt))):Ar(j)}catch(j){ie(j instanceof Error?j.message:String(j))}finally{Yt.current=!1,Pr(!1)}}};y.useEffect(()=>{let j=!1,ye=!1;Un.current=null,ft(!1);const Ne=async()=>{if(!(!xe||ye||Yt.current)){ye=!0;try{const{recordings:Lt}=await lj(xe);if(j||Yt.current)return;const Zt=Lt.find(Vt=>["starting","recording","stopping"].includes(Vt.status));Un.current=Zt??null,ft(!!Zt);for(const Vt of Lt)Ar(Vt)}catch{}finally{ye=!1}}};Ne();const tt=window.setInterval(()=>{Ne()},2e3);return dn.current=window.setInterval(()=>{Un.current&&Ls(Math.max(0,Date.now()-Un.current.startedAt))},500),()=>{j=!0,window.clearInterval(tt),dn.current!==null&&window.clearInterval(dn.current)}},[xe,Ar]),y.useEffect(()=>{if(!Yr)return;const j=()=>jr(!1),ye=tt=>{const Lt=tt.target;Lt instanceof Node&&(He.current?.contains(Lt)||xt.current?.contains(Lt)||j())},Ne=tt=>{tt.key==="Escape"&&(tt.preventDefault(),tt.stopPropagation(),j())};return document.addEventListener("pointerdown",ye,!0),document.addEventListener("keydown",Ne,!0),window.addEventListener("resize",j),()=>{document.removeEventListener("pointerdown",ye,!0),document.removeEventListener("keydown",Ne,!0),window.removeEventListener("resize",j)}},[Yr]),y.useEffect(()=>()=>{kr.current!==null&&window.clearTimeout(kr.current)},[]);const Mr=be==="streaming",Sr=At,Nn=Sr?"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",F=Tn?(Tn.model||Tn.serial)+mx(Tn,l):rn.length?l("android.selectDevice"):l("android.noDevices"),le=(Ae?ze.find(j=>j.id===Ae):null)?.name??(re==="auto"?`${l("android.qualityAuto")} · ${I/1e6} Mbps`:l(hp[re])),Qe=Sr?"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",Mt=Sr?"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",Ut="absolute inset-0 h-full w-full cursor-pointer opacity-0",Xt=()=>{const j=He.current?.getBoundingClientRect();j&&Z({left:Math.max(8,Math.min(j.right-dp,window.innerWidth-dp-8)),top:Math.min(j.bottom+4,Math.max(8,window.innerHeight-Pj-8))}),jr(!0)},pr=()=>{if(At){nn(W0,null),Qr({docked:null});return}if(!Gt)return;const j={sessionId:Gt,side:"right"};nn(W0,j),Qr({docked:j})},Dr=Ce||At||u!=="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:lt,tabIndex:-1,children:[a.jsxs("div",{"data-panel-drag-title":At?"true":void 0,className:Sr?"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:[At&&a.jsx("span",{"data-panel-drag-title":"true",role:"button","aria-label":l("android.splitDrag"),title:l("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(Lu,{size:12})}),a.jsx(n8,{size:Sr?12:14,className:"shrink-0 text-muted-foreground"}),a.jsxs("div",{className:`${Qe} flex-1`,children:[a.jsx("span",{"aria-hidden":"true",className:`${Mt} w-full`,children:F}),a.jsxs("select",{value:xe,onChange:j=>{const ye=j.target.value;te(ye),Ze.current=ye,ye&&Qr({deviceSerial:ye})},className:Ut,"aria-label":l("android.device"),children:[a.jsx("option",{value:"",children:rn.length?l("android.selectDevice"):l("android.noDevices")}),rn.map(j=>a.jsx("option",{value:j.serial,children:(j.model||j.serial)+mx(j,l)},j.serial))]})]}),a.jsxs("div",{className:`${Qe} max-w-[45%] shrink-0`,children:[a.jsx("span",{"aria-hidden":"true",className:Mt,children:le}),a.jsxs("select",{value:Ae?`user:${Ae}`:re,onChange:j=>Ln(j.target.value),className:Ut,title:l(re==="auto"?"android.qualityAutoHint":"android.quality"),"aria-label":l("android.quality"),children:[a.jsxs("option",{value:"auto",children:[l("android.qualityAuto"),re==="auto"?` · ${I/1e6} Mbps`:""]}),xh.map(j=>a.jsx("option",{value:j.id,children:l(hp[j.id])},j.id)),ze.map(j=>a.jsx("option",{value:`user:${j.id}`,children:j.name},j.id)),a.jsx("option",{value:"custom",children:l(hp.custom)})]})]}),a.jsx("button",{type:"button",onClick:()=>{On()},className:`${Nn} text-muted-foreground`,title:l("android.refresh"),children:de?a.jsx(cn,{size:13,className:"animate-spin"}):a.jsx(xs,{size:13})}),Mr?a.jsx("button",{type:"button",onClick:us,className:`${Nn} text-destructive`,title:l("android.disconnect"),children:a.jsx(Kx,{size:13})}):a.jsx("button",{type:"button",onClick:()=>xe&&yr(xe),disabled:!xe,className:`${Nn} text-primary`,title:l("android.connect"),children:a.jsx(zw,{size:13})}),(Mr||$r)&&a.jsx("button",{type:"button",onClick:()=>{nr()},disabled:!n||Ur,className:`${Nn} text-muted-foreground`,title:l(n?"android.screenshot":"android.captureUnavailable"),"aria-label":l("android.screenshot"),children:Ur?a.jsx(cn,{size:Sr?12:13,className:"animate-spin"}):a.jsx(I9,{size:Sr?12:13})}),(Mr||$r)&&a.jsx("button",{type:"button",onClick:()=>{$r?er("manual"):Gr()},disabled:as||!$r&&!i,className:`${Nn} ${$r?"text-destructive":"text-muted-foreground"}`,title:l($r?"android.recordingStop":i?"android.recordingStart":"android.captureUnavailable"),"aria-label":l($r?"android.recordingStop":"android.recordingStart"),children:as?a.jsx(cn,{className:"animate-spin",size:13}):$r?a.jsx(Zx,{size:Sr?10:11,fill:"currentColor"}):a.jsx(Xx,{size:Sr?12:13})}),a.jsx("button",{ref:He,type:"button",onClick:()=>Yr?jr(!1):Xt(),"aria-haspopup":"menu","aria-expanded":Yr,className:`${Nn} ${Dr?"text-primary":"text-muted-foreground"}`,title:l("android.more"),"aria-label":l("android.more"),children:a.jsx(ac,{size:Sr?13:14})})]}),Yr&&En&&na.createPortal(a.jsxs("div",{ref:xt,role:"menu","aria-label":l("android.more"),style:{left:En.left,top:En.top,width:dp},className:"fixed z-popover overflow-hidden rounded-md border border-border bg-surface-elevated py-1 text-[11px] shadow-lg",children:[a.jsx(kd,{icon:a.jsx(Oo,{size:13}),label:l("android.addDevice"),active:Ce,onSelect:()=>{ut(j=>!j),jr(!1)}}),a.jsx(kd,{icon:At?a.jsx(gs,{size:13}):a.jsx(al,{size:13}),label:l(At?"android.splitClose":"android.splitOpen"),active:At,disabled:!At&&!Gt,onSelect:()=>{pr(),jr(!1)}}),a.jsx(kd,{icon:u==="window"?a.jsx(yw,{size:13}):a.jsx(gw,{size:13}),label:l(u==="window"?"android.exitFullscreen":"android.fullscreen"),active:u==="window",onSelect:()=>{h(u==="window"?"off":"window"),jr(!1)}}),!t&&a.jsx(kd,{icon:u==="sidebar"?a.jsx(Lw,{size:13}):a.jsx(Rw,{size:13}),label:l(u==="sidebar"?"android.exitFullscreen":"android.fillSidebar"),active:u==="sidebar",onSelect:()=>{h(u==="sidebar"?"off":"sidebar"),jr(!1)}}),pe&&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:`${pt.fps} fps · ${pt.kbps} kbps`}),a.jsx("div",{className:"truncate",children:`${pt.width}×${pt.height}`})]})]}),document.body),(re==="custom"||Ae)&&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:()=>X(j=>!j),"aria-expanded":Re,className:"flex w-full items-center gap-1 rounded text-muted-foreground hover:text-foreground",children:[a.jsx(Oo,{size:12,className:`transition-transform ${Re?"":"-rotate-90"}`}),a.jsxs("span",{children:[l("android.quality"),Ae?` · ${ze.find(j=>j.id===Ae)?.name??""}`:""]})]}),Re&&a.jsxs("div",{className:"mt-2 grid gap-2",children:[a.jsx(fx,{label:l("android.qualityResolution"),display:`${Be.maxSize}px`,min:360,max:2160,step:8,value:Be.maxSize,onChange:j=>st(ye=>({...ye,maxSize:j}))}),a.jsx(fx,{label:l("android.qualityBitRate"),display:`${(Be.bitRate/1e6).toFixed(1)} Mbps`,min:.5,max:20,step:.5,value:Be.bitRate/1e6,onChange:j=>st(ye=>({...ye,bitRate:Math.round(j*1e6)}))}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-14 shrink-0 text-muted-foreground",children:l("android.qualityFrameRate")}),a.jsxs("div",{className:"flex gap-1",children:[[15,30,60].map(j=>a.jsx("button",{type:"button",onClick:()=>st(ye=>({...ye,maxFps:j})),className:`rounded px-2 py-0.5 ${Be.maxFps===j?"bg-surface-elevated text-primary":"text-muted-foreground hover:bg-surface-2"}`,children:j},j)),a.jsx("button",{type:"button",onClick:()=>st(j=>({...j,maxFps:0})),className:`rounded px-2 py-0.5 ${Be.maxFps===0?"bg-surface-elevated text-primary":"text-muted-foreground hover:bg-surface-2"}`,children:l("android.qualityAuto")})]}),a.jsx("button",{type:"button",onClick:Rn,disabled:!xe,className:"ml-auto rounded bg-primary/15 px-2 py-1 text-primary disabled:opacity-40",children:l("android.qualityApply")})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{value:Oe,onChange:j=>nt(j.target.value),onKeyDown:j=>{j.key==="Enter"&&!j.nativeEvent.isComposing&&zr()},placeholder:l("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:zr,disabled:!Oe.trim(),className:"shrink-0 rounded bg-surface-2 px-2 py-1 text-primary disabled:opacity-40",children:l("android.presetSave")}),Ae&&a.jsx("button",{type:"button",onClick:Jn,className:"shrink-0 rounded px-2 py-1 text-destructive hover:bg-surface-2",children:l("android.presetDelete")})]})]})]}),Ce&&a.jsxs("div",{className:"flex items-center gap-1.5 border-b border-border px-2 py-2",children:[a.jsx("input",{value:Ge,onChange:j=>dr(j.target.value),onKeyDown:j=>{j.key==="Enter"&&rt()},placeholder:l("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:()=>{rt()},disabled:Rt,className:"rounded bg-surface-2 px-2 py-1 text-[11px] text-primary disabled:opacity-40",children:Rt?a.jsx(cn,{size:12,className:"animate-spin"}):l("android.connect")})]}),Cn&&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:l("android.adbUnavailable")}),a.jsx(dx,{label:l("android.insertFixPrompt"),onClick:()=>Kt(hx("adb",ot??"")),enabled:!!r})]}),!Cn&&$n&&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:l("android.scrcpyUnavailable")}),a.jsx(dx,{label:l("android.insertFixPrompt"),onClick:()=>Kt(hx("scrcpy","")),enabled:!!r})]}),Tn&&Tn.state!=="device"&&a.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:Gj(Tn,l)}),ot&&!Cn&&a.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:K5(ot)}),Ct&&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:[l("android.qualityAutoUnavailable")," ",l(Ct.startsWith("SCRCPY_VERSION")?"android.qualityAutoVersionError":Ct.startsWith("SCRCPY_BUILD")?"android.qualityAutoBuildError":/EXTENSION|SERVER_READ|PUSH/.test(Ct.split(":")[0])?"android.qualityAutoExtensionError":/TIMEOUT/.test(Ct.split(":")[0])?"android.qualityAutoTimeoutError":/ENCODER_REJECTED/.test(Ct.split(":")[0])?"android.qualityAutoEncoderError":/CHANNEL|TUNNEL|LISTEN|PROTOCOL|CONNECTION/.test(Ct.split(":")[0])?"android.qualityAutoChannelError":"android.qualityAutoUnknownError")]}),a.jsx("pre",{className:"mt-1 select-text whitespace-pre-wrap break-all text-[10px]",children:Ct})]}),ir&&a.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:ir}),Br&&a.jsx("div",{role:"alert",className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:Br}),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:p,className:"max-h-full max-w-full touch-none select-none rounded",style:{display:Mr||pe?"block":"none",transformOrigin:"center",transition:"none"},onPointerDown:Me,onPointerMove:ht,onPointerUp:vt,onPointerCancel:()=>ar(),onLostPointerCapture:j=>{D.current.has(j.pointerId)&&ar()},onPointerLeave:j=>{D.current.has(j.pointerId)&&!j.currentTarget.hasPointerCapture?.(j.pointerId)&&ar()},onContextMenu:j=>j.preventDefault()}),Ht&&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:Ht.left,top:Ht.top}}),Pe.length>1&&a.jsx("svg",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 h-full w-full",style:{opacity:jt?1:0,transition:"opacity 160ms linear"},children:Pe.slice(1).map((j,ye)=>{const Ne=Pe[ye],tt=(ye+1)/(Pe.length-1);return a.jsx("line",{x1:Ne.x,y1:Ne.y,x2:j.x,y2:j.y,stroke:"var(--primary)",strokeWidth:1+1.6*tt,strokeLinecap:"round",opacity:.06+.45*tt},ye)})}),Qt.map(j=>a.jsx("span",{"aria-hidden":"true",className:"termdock-tap-fade pointer-events-none absolute h-4 w-4 rounded-full bg-primary",style:{left:j.left,top:j.top}},j.id)),!Mr&&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(cn,{size:18,className:"animate-spin"}),a.jsx("span",{children:l("android.connecting")})]}),be==="error"&&a.jsxs(a.Fragment,{children:[a.jsx(Q9,{size:14,className:"text-destructive"}),a.jsx("span",{className:"max-w-[80%] text-destructive",children:bt?l("android.reconnecting"):K5(wt||"")}),xe&&a.jsx("button",{type:"button",onClick:()=>{Ve.current=0,yr(xe)},className:"rounded bg-surface-2 px-2 py-1 text-foreground",children:l("android.retry")})]}),be==="idle"&&!Cn&&!$n&&a.jsxs(a.Fragment,{children:[a.jsx(ww,{size:22,className:"opacity-60"}),a.jsx("span",{children:rn.length?l("android.idleHint"):l("android.noDevicesHint")})]})]})]}),a.jsxs("div",{className:`flex flex-wrap items-center gap-1 border-t border-border ${Sr?"px-1.5 py-0.5":"px-2 py-1.5"}`,children:[a.jsx(co,{compact:Sr,label:l("android.back"),onClick:()=>g.current?.back(),disabled:!Mr,children:a.jsx(s8,{size:14})}),a.jsx(co,{compact:Sr,label:l("android.home"),onClick:()=>g.current?.home(),disabled:!Mr,children:a.jsx(dw,{size:14})}),a.jsx(co,{compact:Sr,label:l("android.recents"),onClick:()=>g.current?.recents(),disabled:!Mr,children:a.jsx(Gx,{size:14})}),a.jsx(co,{compact:Sr,label:l("android.notifications"),onClick:()=>g.current?.expandNotifications(),disabled:!Mr,children:a.jsx($x,{size:14})}),a.jsx(co,{compact:Sr,label:l("android.rotate"),onClick:()=>g.current?.rotate(),disabled:!Mr,children:a.jsx(Yw,{size:14})}),a.jsx(co,{compact:Sr,label:l("android.volumeDown"),onClick:()=>g.current?.volumeDown(),disabled:!Mr,children:a.jsx(wA,{size:14})}),a.jsx(co,{compact:Sr,label:l("android.volumeUp"),onClick:()=>g.current?.volumeUp(),disabled:!Mr,children:a.jsx(TA,{size:14})}),a.jsx(co,{compact:Sr,label:l("android.power"),onClick:()=>g.current?.power(),disabled:!Mr,children:a.jsx(Ww,{size:14})}),a.jsx(co,{compact:Sr,label:l("android.inputText"),active:It,onClick:()=>jn(j=>!j),disabled:!Mr,children:a.jsx(Wx,{size:14})}),a.jsx(co,{compact:Sr,label:l("android.zoomIn"),onClick:()=>gt("in"),disabled:!Mr||Y>=Wd-.01,children:a.jsx(bi,{size:14})}),a.jsx(co,{compact:Sr,label:l("android.zoomOut"),onClick:()=>gt("out"),disabled:!Mr||Y<=nl+.01,children:a.jsx(Vx,{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":$r||!!Tr||Ur,className:`block truncate text-right text-[10px] leading-5 tabular-nums text-muted-foreground ${$r||Tr||Ur?"invisible":""}`,children:pe?a.jsx(a.Fragment,{children:a.jsx("span",{ref:Je})}):""}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-end overflow-hidden",children:a.jsx(Hj,{recording:$r,elapsed:hr,status:Ur?l("android.captureInserting"):Tr,stopLabel:l("android.recordingStop"),onStop:()=>{er("manual")}})})]})]}),It&&a.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border px-2 py-1.5",children:[a.jsx("input",{value:is,onChange:j=>Pn(j.target.value),onKeyDown:j=>{j.key==="Enter"&&!j.nativeEvent.isComposing&&(j.preventDefault(),mt())},placeholder:l("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:mt,disabled:!is,className:"rounded bg-surface-2 p-1.5 text-primary disabled:opacity-40",title:l("android.send"),children:a.jsx(Jw,{size:13})})]})]});return u==="window"?na.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?At&&hn?na.createPortal(fn,hn):null:At&&hn?a.jsxs(a.Fragment,{children:[na.createPortal(fn,hn),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(al,{size:18,className:"opacity-60"}),a.jsx("span",{children:l("android.splitDockedHint")}),a.jsx("button",{type:"button",onClick:()=>{nn(W0,null),Qr({docked:null})},className:"rounded bg-surface-2 px-2 py-1 text-foreground",children:l("android.splitClose")})]})]}):fn}function kd({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(ya,{size:12,className:"shrink-0"})]})}function Hj({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"}),sx(t),a.jsx("button",{type:"button",onClick:i,title:n,"aria-label":`${n} · ${sx(t)}`,className:"ml-0.5 inline-flex h-4 w-4 items-center justify-center rounded hover:bg-destructive/25",children:a.jsx(Zx,{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 ux({sessionId:e}){const t=ss(x=>x.docks[nu]),r=!!t,n=t?.sessionId??e??null,l=up(x=>x.pending)[0],u=y.useCallback(async x=>{if(!n)throw new Error("没有可接收截图的终端");const w=(await _u("/tmp",[x])).files[0]?.path;if(!w)throw new Error("截图上传未返回文件路径");await ax(w,n)},[n]),h=y.useCallback(x=>{up.getState().enqueue(x,n)},[n]),p=ss(x=>!!x.hosts[nu]),g=y.useRef(!1);return y.useEffect(()=>{g.current||(g.current=!0,Bl().then(x=>{const b=x.androidPanel?.docked;b&&(ss.getState().docks[nu]||ss.getState().setDock(nu,b))}).catch(()=>{}))},[]),a.jsxs(a.Fragment,{children:[r&&p&&a.jsx(zj,{sessionId:n,dockOnly:!0,onInsertFile:n?u:void 0,onInsertPrompt:n?x=>z6(x,n):void 0,onRecordingComplete:h}),l&&a.jsx(jj,{file:l.file,initialPath:l.initialPath,onInsert:x=>l.insert?l.insert(x):ax(x,l.sessionId),onDone:()=>up.getState().remove(l.file.id)},l.file.id)]})}function dx({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 hx(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(`
|
|
133
|
-
`)}function fx({label:e,display:t,min:r,max:n,step:i,value:l,onChange:u}){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=>u(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 co({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 px(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 Id(e,t,r){const n=e.getBoundingClientRect(),i=e.width||n.width,l=e.height||n.height,u=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,u)),y:Math.max(0,Math.min(l,h))}}function Wj(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 mx(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 Gj(e,t){return e.state==="unauthorized"?t("android.unauthorizedHint"):e.state==="offline"?t("android.offlineHint"):t("android.stateUnknown")}function Vj(e){return e>=90?"var(--destructive)":e>=70?"var(--warning)":"var(--success)"}function qj(e){return e>=90?"var(--destructive)/0.15":e>=70?"var(--warning)/0.15":"var(--success)/0.12"}function Yj(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),u=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 u>0?b=`${u}d ${h}h`:h>0?b=`${h}h ${p}m`:p>0?b=`${p}m`:b="soon",`resets in ${b} (${g} ${x})`}function Zj(e){return{claude:"🧠",codex:"✨",kimi:"🌙",copilot:"🐙",grok:"🚀",gemini:"💎"}[e]||"📊"}function Kj({result:e}){const{t}=Jr(),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 u=null;return!l&&e.entitlement&&(e.usagePercent>=90?u=t("quota.exhausted"):e.remaining!==void 0&&e.remaining<e.entitlement?u=t("quota.left",{n:e.remaining}):u=`${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:Zj(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})]}),u&&a.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:u})]}),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:qj(h.percent)},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${p}%`,background:Vj(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:Yj(h.resetAt)})]},h.label)})}):l?a.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:e.error}):null]})}function Xj({isOpen:e,onClose:t}){const{t:r}=Jr(),[n,i]=y.useState([]),[l,u]=y.useState(!1),h=async(x=!1)=>{u(!0);try{const b=x?await i8():await a8();i(b.providers||[])}catch{}finally{u(!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(xs,{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(gs,{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("div",{className:"flex items-center justify-center py-12",children:a.jsx(xs,{size:24,className:"animate-spin text-muted-foreground"})}):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(Kj,{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 gx=[{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~"}],Jj=2,eP=20;function tP({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 rP({value:e,onChange:t,placeholder:r}){const{t:n}=Jr(),[i,l]=S.useState(""),u=b=>{const w=[];let A="",k=!1;const I=()=>{const R=A.trim();R&&w.push(R),A=""};for(let R=0;R<b.length;R+=1){const D=b[R];if(!k&&D==="/"&&A.trim().length===0){k=!0,A+=D;continue}if(k){if(A+=D,D==="/"&&b[R-1]!=="\\"&&A.length>1){for(;R+1<b.length&&/[gimsuy]/.test(b[R+1]??"");)R+=1,A+=b[R];I(),k=!1}continue}if(D===","||/\s/.test(D)){I();continue}A+=D}if(I(),w.length===0)return;const N=[...e];for(const R of w){const D=G3(R);D&&(N.includes(D)||N.push(D))}t(N),l("")},h=b=>{t(e.filter(w=>w!==b))},p=i.trim(),g=p.length>0&&n2(p),x=g&&!eh(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=n2(b),A=w&&!eh(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(gs,{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(),u(i)):b.key==="Backspace"&&i.length===0&&e.length>0&&h(e[e.length-1])},onBlur:()=>u(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 nP({value:e,min:t,max:r,onChange:n}){const{t:i}=Jr();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(Vx,{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(bi,{size:14})})]})}const sP=({presets:e,selectedPresetId:t,onSelectPreset:r,onUpdatePreset:n,onAddPreset:i,onRemovePreset:l,onResetDefaults:u})=>{const{t:h}=Jr(),p=e.find(R=>R.id===t)??e[0]??null,[g,x]=S.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((R,D)=>({id:R.id,label:Bp(R,D)})):["Enter","Home","End","Ctrl-C","Ctrl-D"].map(R=>({id:R,label:R}))],A=V3(w,p.rowLayout),k=(R,D)=>{n(p.id,O=>{const q=O.actions.findIndex(V=>V.id===R);if(q===-1)return O;const Y=q+D;if(Y<0||Y>=O.actions.length)return O;const U=[...O.actions];return[U[q],U[Y]]=[U[Y],U[q]],{...O,actions:U}})},I=p.rowLayout.reduce((R,D)=>R+D,0),N=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"," · ",I," slot",I===1?"":"s"]})]}),a.jsx("div",{className:"space-y-1 rounded-2xl bg-surface-2/60 p-2",children:A.map((R,D)=>{const O=R.items[0]?.kind==="preset",q=Math.max(2,R.columns),Y=O?`${q3}px repeat(${Math.max(1,q-1)}, minmax(0, 1fr))`:`repeat(${q}, minmax(0, 1fr))`;return a.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:Y},children:R.items.map(U=>U.kind==="preset"?a.jsx(Y3,{mode:"auto",presetLabel:U.label,title:`Auto preset · ${U.label}`,disabled:!0},U.id):a.jsx(tP,{label:U.label},U.id))},`preview-row-${D}`)})}),p.actions.length>I-N&&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(bi,{size:14}),h("toolbarPresets.new")]}),a.jsxs("button",{type:"button",onClick:u,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(xs,{size:14}),h("toolbarPresets.reset")]})]})]}),a.jsx("div",{className:"-mx-1 flex flex-wrap gap-1.5 px-1",children:e.map(R=>a.jsxs("button",{type:"button",onClick:()=>r(R.id),className:`rounded-full px-3 py-2 text-xs font-medium transition ${R.id===p.id?"bg-primary/20 text-primary ring-1 ring-primary/30":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,children:[R.label,R.actions.length>0&&a.jsx("span",{className:"ml-1.5 text-[10px] text-muted-foreground",children:R.actions.length})]},R.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:R=>n(p.id,D=>({...D,label:R.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(yi,{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(rP,{value:p.programs,onChange:R=>n(p.id,D=>({...D,programs:R})),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,R=>({...R,includeAlt:!R.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(Po,{checked:p.includeAlt})]}),a.jsxs("button",{type:"button",onClick:()=>n(p.id,R=>({...R,showOnDesktop:!R.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(Po,{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,R=>({...R,rowLayout:[...w1(R.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(bi,{size:12}),h("toolbarPresets.addRow")]})]}),a.jsx("div",{className:"space-y-2",children:p.rowLayout.map((R,D)=>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:D+1})}),a.jsx("div",{className:"flex-1"}),a.jsx(nP,{value:R,min:Jj,max:eP,onChange:O=>n(p.id,q=>({...q,rowLayout:q.rowLayout.map((Y,U)=>U===D?O:Y)}))}),p.rowLayout.length>1&&a.jsx("button",{type:"button",onClick:()=>n(p.id,O=>({...O,rowLayout:O.rowLayout.filter((q,Y)=>Y!==D)})),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:D+1}),children:h("toolbarPresets.del")})]},`row-${D}`))})]}),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 R=`${p.id}-action-${Date.now()}`;n(p.id,D=>({...D,actions:[...D.actions,{id:R,label:`Key ${D.actions.length+1}`,sequence:""}]})),x(R)},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(bi,{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((R,D)=>{const O=g===R.id;return a.jsxs("div",{className:`rounded-2xl bg-surface-2 transition ${O?"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(R.id,-1),disabled:D===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(Ux,{size:12})}),a.jsx("button",{type:"button",onClick:()=>k(R.id,1),disabled:D===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(b9,{size:12})})]}),a.jsxs("button",{type:"button",onClick:()=>x(O?null:R.id),className:"min-w-0 flex-1 text-left",children:[a.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:Bp(R,D)}),a.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:[R.sequence?R.sequence:h("toolbarPresets.noSequence"),R.doubleTapSequence&&a.jsxs("span",{className:"ml-1 text-accent/70",children:["· 2× ",R.doubleTapSequence]})]})]}),a.jsx("button",{type:"button",onClick:()=>n(p.id,q=>({...q,actions:q.actions.filter(Y=>Y.id!==R.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:R.label}),children:a.jsx(yi,{size:14})})]}),O&&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:R.label,onChange:q=>n(p.id,Y=>({...Y,actions:Y.actions.map(U=>U.id===R.id?{...U,label:q.target.value}:U)})),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:R.sequence,onChange:q=>n(p.id,Y=>({...Y,actions:Y.actions.map(U=>U.id===R.id?{...U,sequence:q.target.value}:U)})),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:gx.map(q=>a.jsx("button",{type:"button",onClick:()=>n(p.id,Y=>({...Y,actions:Y.actions.map(U=>U.id===R.id?{...U,sequence:q.sequence}:U)})),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:q.label},q.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")}),!R.doubleTapSequence&&a.jsx("button",{type:"button",onClick:()=>n(p.id,q=>({...q,actions:q.actions.map(Y=>Y.id===R.id?{...Y,doubleTapSequence:""}:Y)})),className:"text-[10px] text-accent hover:text-accent/80",children:h("toolbarPresets.doubleTapAdd")})]}),R.doubleTapSequence!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"text",value:R.doubleTapSequence,onChange:q=>n(p.id,Y=>({...Y,actions:Y.actions.map(U=>U.id===R.id?{...U,doubleTapSequence:q.target.value}:U)})),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:[gx.map(q=>a.jsx("button",{type:"button",onClick:()=>n(p.id,Y=>({...Y,actions:Y.actions.map(U=>U.id===R.id?{...U,doubleTapSequence:(U.doubleTapSequence??"")+q.sequence}:U)})),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:q.label},q.label)),a.jsx("button",{type:"button",onClick:()=>n(p.id,q=>({...q,actions:q.actions.map(Y=>{if(Y.id!==R.id)return Y;const{doubleTapSequence:U,...V}=Y;return V})})),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")})]})]})]})]})]},R.id)})]})]})]})},iP={installed:"text-[color:var(--success)]",outdated:"text-[color:var(--warning)]","needs-approval":"text-[color:var(--warning)]","not-installed":"text-muted-foreground"};function aP(){const{t:e}=Jr(),[t,r]=S.useState(null),[n,i]=S.useState(null),[l,u]=S.useState(null),[h,p]=S.useState(null),[g,x]=S.useState(!1),[b,w]=S.useState(!1),[A,k]=S.useState(""),[I,N]=S.useState(""),[R,D]=S.useState(null),[O,q]=S.useState([]),[Y,U]=S.useState([]),[V,me]=S.useState(null),[Je,ve]=S.useState(new Set),[_e,Ze]=S.useState(null),[Ve,ce]=S.useState("auto"),[ke,ot]=S.useState({}),[Ie,de]=S.useState(null),[qe,xe]=S.useState(null),[te,re]=S.useState(10),[ge,ze]=S.useState(""),[Ke,Ae]=S.useState(""),[z,Oe]=S.useState(12e3),[nt,Re]=S.useState(null),[X,Be]=S.useState(null),st=S.useCallback(async()=>{const[ne,Pe,it,jt]=await Promise.allSettled([o8(),l8(),Bl(),g0()]);if(r(ne.status==="fulfilled"?ne.value:[]),Pe.status==="fulfilled"){const ue=Pe.value;q(ue.plugins??[]),U(ue.errors??[])}else q([]),U([]);if(it.status==="fulfilled"){const ue=it.value;ve(new Set(ue.autoRenameAgents??[])),ce(ue.autoRenameNamer??"auto"),ot(ue.autoRenameModels??{}),re(ue.autoRenameIntervalMinutes??10),ze(ue.autoRenamePromptPreference??""),Ae(ue.autoRenamePromptPreference??""),Oe(ue.autoRenamePromptPayloadChars??12e3)}else ve(new Set);de(jt.status==="fulfilled"?jt.value:[])},[]);S.useEffect(()=>{st()},[st]);const be=async(ne,Pe)=>{i(ne),u(null);try{Pe==="install"?(await c8(ne)).devMode&&p(ne):(await u8(ne),h===ne&&p(null)),await st()}catch(it){u(it instanceof Error?it.message:String(it))}finally{i(null)}},je=ne=>e(ne==="installed"?"settings.agentHooksInstalled":ne==="outdated"?"settings.agentHooksOutdated":ne==="needs-approval"?"settings.agentHooksNeedsApproval":"settings.agentHooksNotInstalled"),wt=async()=>{D(null);let ne;try{ne=JSON.parse(I)}catch{D("Invalid JSON");return}try{await g8(ne),N(""),x(!1),await st()}catch(Pe){if(Pe instanceof x8&&Pe.migration){U(it=>[{slug:typeof ne.slug=="string"?ne.slug:"manifest.json",errors:Pe.message.split(`
|
|
134
|
-
`),code:Pe.code,migration:Pe.migration},...it.filter(jt=>jt.slug!==ne.slug)]);return}D(Pe instanceof Error?Pe.message:String(Pe))}},Te=async()=>{const ne=A.trim();if(ne){Re("install"),D(null);try{await d8(ne),k(""),w(!1),await st()}catch(Pe){D(Pe instanceof Error?Pe.message:String(Pe))}finally{Re(null)}}},pe=async ne=>{Re(`remove:${ne}`);try{await m8(ne),Be(Pe=>Pe?.slug===ne?null:Pe),await st()}catch(Pe){u(Pe instanceof Error?Pe.message:String(Pe))}finally{Re(null)}},$e=async ne=>{Re(`check:${ne}`),u(null);try{await p8(ne),await st()}catch(Pe){u(Pe instanceof Error?Pe.message:String(Pe))}finally{Re(null)}},pt=async ne=>{Re(`update:${ne}`),u(null);try{const Pe=await f8(ne),it=[Pe.hookWarning,Pe.titleWarning].filter(Boolean).join(" ");it&&u(it),Be(jt=>jt?.slug===ne?null:jt),await st()}catch(Pe){u(Pe instanceof Error?Pe.message:String(Pe))}finally{Re(null)}},Tt=async ne=>{Re(`doctor:${ne}`),u(null),Be(null);try{const Pe=await h8(ne);Be(Pe),de(await g0())}catch(Pe){u(Pe instanceof Error?Pe.message:String(Pe))}finally{Re(null)}},Ct=async ne=>{const Pe=ne.migration?.aiPrompt??ne.errors.join(`
|
|
135
|
-
`);try{await navigator.clipboard.writeText(Pe),me(ne.slug),window.setTimeout(()=>me(it=>it===ne.slug?null:it),1800)}catch{D(Pe)}},rr=async ne=>{if(_e)return;const Pe=Je,it=new Set(Pe);it.has(ne)?it.delete(ne):it.add(ne),ve(it),Ze(ne),u(null);try{const jt=await ra({autoRenameAgents:[...it]});ve(new Set(jt.autoRenameAgents??[])),de(await g0(!0))}catch(jt){ve(Pe),u(jt instanceof Error?jt.message:String(jt))}finally{Ze(null)}},ir=async ne=>{const Pe=Ve;ce(ne),xe("namer"),u(null);try{const it=await ra({autoRenameNamer:ne});ce(it.autoRenameNamer??"auto"),de(await g0(!0))}catch(it){ce(Pe),u(it instanceof Error?it.message:String(it))}finally{xe(null)}},yt=async(ne,Pe)=>{const it=ke,jt={...it};Pe?jt[ne]=Pe:delete jt[ne],ot(jt),xe(ne),u(null);try{const ue=await ra({autoRenameModels:jt});ot(ue.autoRenameModels??{})}catch(ue){ot(it),u(ue instanceof Error?ue.message:String(ue))}finally{xe(null)}},bt=async ne=>{const Pe=te;re(ne),xe("interval"),u(null);try{const it=await ra({autoRenameIntervalMinutes:ne});re(it.autoRenameIntervalMinutes??10)}catch(it){re(Pe),u(it instanceof Error?it.message:String(it))}finally{xe(null)}},_t=async()=>{const ne=ge.trim();if(ne!==Ke){xe("preference"),u(null);try{const it=(await ra({autoRenamePromptPreference:ne})).autoRenamePromptPreference??"";ze(it),Ae(it)}catch(Pe){ze(Ke),u(Pe instanceof Error?Pe.message:String(Pe))}finally{xe(null)}}},Qt=async ne=>{const Pe=Math.max(1e3,Math.min(64e3,Math.round(ne||12e3))),it=z;Oe(Pe),xe("payload-limit"),u(null);try{const jt=await ra({autoRenamePromptPayloadChars:Pe});Oe(jt.autoRenamePromptPayloadChars??12e3)}catch(jt){Oe(it),u(jt instanceof Error?jt.message:String(jt))}finally{xe(null)}},Et=new Set(O.map(ne=>ne.slug)),Ht=X?{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")}[X.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:Ve,disabled:qe!==null,onChange:ne=>{ir(ne.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(ne=>ne.available).map(ne=>a.jsx("option",{value:ne.slug,children:ne.displayName},ne.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:te,disabled:qe!==null,onChange:ne=>{bt(Number(ne.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(ne=>a.jsxs("option",{value:ne,children:[ne," ",e("settings.agentAutoRenameMinutes")]},ne))})]}),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:ge,maxLength:2e3,rows:3,disabled:qe!==null,placeholder:e("settings.agentAutoRenamePreferencePlaceholder"),onChange:ne=>ze(ne.target.value),onBlur:()=>{_t()},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:qe==="preference"?e("settings.saving"):`${ge.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:z,disabled:qe!==null,onChange:ne=>Oe(Number(ne.target.value)),onBlur:ne=>{Qt(Number(ne.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()=>{de(null);try{de(await g0(!0))}catch{de([])}},className:"rounded p-1 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",title:e("settings.agentAutoRenameRefreshModels"),children:a.jsx(xs,{size:11,className:Ie===null?"animate-spin":""})})]}),Ie?.filter(ne=>ne.available).map(ne=>{const Pe=ne.models.find(it=>it.id===ne.recommendedModel);return a.jsxs("label",{className:"flex items-center justify-between gap-3",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:ne.displayName}),a.jsxs("select",{value:ke[ne.slug]??"",disabled:qe!==null,onChange:it=>{yt(ne.slug,it.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:Pe?`${e("settings.agentAutoRenameAutomatic")} · ${Pe.displayName}`:e("settings.agentAutoRenameCliDefault")}),ne.models.map(it=>a.jsx("option",{value:it.id,children:it.displayName},it.id))]})]},ne.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(cn,{size:12,className:"animate-spin"})," …"]}),t?.map(ne=>{const Pe=n===ne.slug,it=ne.state!=="not-installed",jt=Et.has(ne.slug);return a.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-surface-2 px-3 py-2.5",children:[a.jsx(ic,{agent:{slug:ne.slug,displayName:ne.displayName,accentColor:ne.accentColor??"#878580",icon:ne.icon,isPlugin:jt,iconMode:ne.iconMode,iconVersion:ne.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:ne.displayName}),jt&&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] ${iP[ne.state]}`,children:[ne.state==="installed"&&a.jsx(Mm,{size:10,className:"mr-0.5 inline"}),(ne.state==="outdated"||ne.state==="needs-approval")&&a.jsx(Fx,{size:10,className:"mr-0.5 inline"}),je(ne.state)]})]}),a.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",title:ne.targetDisplay,children:[e("settings.agentHooksTarget")," ",ne.targetDisplay]}),h===ne.slug&&a.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksDevMode")}),ne.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:_e!==null,onClick:()=>{rr(ne.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":Je.has(ne.slug),title:e("settings.agentAutoRenameToggle"),children:[a.jsx("span",{children:e("settings.agentAutoRenameShort")}),a.jsx(Po,{checked:Je.has(ne.slug),disabled:_e!==null,size:"sm"})]}),a.jsxs("button",{type:"button",disabled:Pe,onClick:()=>{be(ne.slug,it?"uninstall":"install")},className:`flex shrink-0 items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition ${it?"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:[Pe?a.jsx(cn,{size:11,className:"animate-spin"}):it?a.jsx(yi,{size:11}):ne.state==="outdated"?a.jsx(xs,{size:11}):a.jsx(uu,{size:11}),Pe?"…":it?e("settings.agentHooksUninstall"):ne.state==="outdated"?e("settings.agentHooksReinstall"):e("settings.agentHooksInstall")]})]})]},ne.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(bi,{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:ne=>k(ne.target.value),onKeyDown:ne=>{ne.key==="Enter"&&Te()},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()||nt!==null,onClick:()=>{Te()},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:[nt==="install"?a.jsx(cn,{size:11,className:"animate-spin"}):a.jsx(uu,{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")})]}),O.map(ne=>{const Pe=ne.revision?.slice(0,8),it=nt?.endsWith(`:${ne.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:ne.displayName}),ne.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:ne.source??void 0,children:[ne.source??e("settings.agentPluginManualSource"),Pe?` · ${Pe}`:""]})]}),a.jsxs("button",{type:"button",disabled:nt!==null,onClick:()=>{Tt(ne.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:[nt===`doctor:${ne.slug}`?a.jsx(cn,{size:10,className:"animate-spin"}):a.jsx(uA,{size:10}),e("settings.agentPluginDoctor")]}),ne.updateSupported&&a.jsxs("button",{type:"button",disabled:nt!==null,onClick:()=>{ne.updateAvailable?pt(ne.slug):$e(ne.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:[it?a.jsx(cn,{size:10,className:"animate-spin"}):a.jsx(xs,{size:10}),ne.updateAvailable?e("settings.agentPluginUpdate"):e("settings.agentPluginCheck")]}),a.jsx("button",{type:"button",disabled:nt!==null,onClick:()=>{pe(ne.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(yi,{size:11})})]},ne.slug)}),X&&a.jsxs("div",{className:`mt-2 rounded-lg px-3 py-2 text-[10px] ${X.status==="ok"||X.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:[X.displayName,": ",Ht]}),a.jsx("div",{className:"mt-1 text-muted-foreground",children:X.models.length>0?`${X.models.length} ${e("settings.agentPluginDoctorModels")}${X.recommendedModel?` · ${e("settings.agentPluginDoctorAutomatic")} ${X.recommendedModel}`:""}`:e("settings.agentPluginDoctorCliDefault")}),X.error&&a.jsx("div",{className:"mt-1 break-words",children:X.error}),X.warnings.length>0&&a.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:X.warnings.map(ne=>a.jsxs("div",{children:["• ",ne]},ne))}),X.nextSteps.length>0&&a.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:X.nextSteps.map(ne=>a.jsxs("div",{children:["→ ",ne]},ne))})]}),Y.map(ne=>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:[ne.slug,": ",ne.code??e("settings.agentPluginInvalid")]}),a.jsxs("button",{type:"button",onClick:()=>{Ct(ne)},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:[V===ne.slug?a.jsx(Mm,{size:10}):a.jsx(zx,{size:10}),V===ne.slug?e("settings.agentPluginCopied"):e("settings.agentPluginCopyAiPrompt")]})]}),a.jsx("div",{className:"mt-1 whitespace-pre-wrap break-words text-muted-foreground",children:ne.errors.join(`
|
|
136
|
-
`)}),ne.migration?.guideCommand&&a.jsx("code",{className:"mt-1 block select-all text-foreground",children:ne.migration.guideCommand})]},ne.slug)),b&&g&&a.jsxs("div",{className:"mt-2 space-y-2",children:[a.jsx("textarea",{value:I,onChange:ne=>N(ne.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:`{
|
|
137
|
-
"version": 2,
|
|
138
|
-
"slug": "my-agent",
|
|
139
|
-
"displayName": "My Agent",
|
|
140
|
-
"aliases": ["my-agent"],
|
|
141
|
-
"accentColor": "#4385BE",
|
|
142
|
-
"statuses": [
|
|
143
|
-
{ "id": "thinking", "phase": "working", "label": "Thinking", "indicator": "spinner", "tone": "info" },
|
|
144
|
-
{ "id": "approval", "phase": "waiting", "label": "Needs approval", "indicator": "question", "tone": "warning" },
|
|
145
|
-
{ "id": "complete", "phase": "done", "label": "Complete", "indicator": "badge", "tone": "success" }
|
|
146
|
-
],
|
|
147
|
-
"hooks": {
|
|
148
|
-
"target": "~/.my-agent/settings.json",
|
|
149
|
-
"events": [
|
|
150
|
-
{ "hook": "UserPromptSubmit", "event": "prompt-submit", "status": "thinking" },
|
|
151
|
-
{ "hook": "PermissionRequest", "event": "permission-request", "status": "approval" },
|
|
152
|
-
{ "hook": "Stop", "event": "stop", "status": "complete" }
|
|
153
|
-
]
|
|
154
|
-
}
|
|
155
|
-
}`}),R&&a.jsx("div",{className:"whitespace-pre-wrap break-words text-[10px] text-[color:var(--warning)]",children:R}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>{wt()},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(H9,{size:11}),e("settings.agentPluginCreate")]}),a.jsx("button",{type:"button",onClick:()=>{x(!1),N(""),D(null)},className:"rounded-full px-3 py-1 text-[11px] text-muted-foreground hover:text-foreground transition",children:e("common.cancel")})]})]})]})]})}function oP({state:e,pending:t,onCheck:r,onConfirmRestart:n,desktopState:i,desktopPending:l=!1,desktopSnapshot:u,desktopActions:h,onCheckDesktop:p,onInstallDesktop:g}){const{t:x}=Jr(),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"),I=i?.currentVersion||u?.appVersion,N=i?.status??"idle",R=l||N==="checking"||N==="downloading"||N==="installing",D=N==="ready",O=i?.error||(N==="unsupported"?x("settings.desktopUpdateUnsupported"):N==="checking"?x("settings.desktopUpdateChecking"):N==="current"?x("settings.desktopUpdateCurrent"):N==="downloading"?x("settings.desktopUpdateDownloading"):N==="ready"?x("settings.desktopUpdateReady"):N==="installing"?x("settings.desktopUpdateInstalling"):N==="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(xs,{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 ${D?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:a.jsx(xs,{size:15,className:R?"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?O:x(p?"settings.desktopStatusLoading":"settings.desktopUpdateUnsupported")}),a.jsxs("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:[D&&i?.latestVersion?`${i.currentVersion} → ${i.latestVersion}`:I?`v${I}`:null,u&&` · ${x("settings.desktopBundledCli")} ${u.bundledCliVersion}`]})]})]}),D?a.jsx("button",{type:"button",disabled:R||!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||R||N==="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(N==="installing"?"settings.updateInstallingShort":N==="downloading"?"settings.desktopUpdateDownloadingShort":N==="checking"?"settings.updateCheckingShort":N==="current"||N==="error"?"settings.desktopUpdateCheckAgain":"settings.desktopUpdateCheck")})]}),h]})}const xx={"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 lP(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 cP({state:e,onDismiss:t}){const{t:r}=Jr(),[n,i]=y.useState(!1),[l,u]=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),u(!1))},[e?.supervised]),y.useEffect(()=>{if(!n)return;const O=window.setTimeout(()=>{h.current=!1,i(!1),u(!0)},45e3);return()=>window.clearTimeout(O)},[n]);const g=async()=>{if(!h.current){h.current=!0,u(!1),i(!0);try{await b8()}catch{if(!p.current)return;h.current=!1,i(!1),u(!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",I=b?r("settings.serverHealthGaveUp",{count:e.supervisor?.consecutiveCrashes??0}):w?r("settings.serverHealthSupervisorLost"):e.supervised?r("settings.serverHealthSupervised"):r("settings.serverHealthUnsupervised"),N=x?r(xx[x.event]??"settings.serverHealthUnknownEvent"):"",R=x?.causeEvent?r(xx[x.causeEvent]??"settings.serverHealthUnknownEvent"):"",D=x?[new Date(x.at).toLocaleString(),x.uptimeMs!==null?r("settings.serverHealthUptime",{duration:lP(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(nA,{size:15}):a.jsx(iA,{size:15})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground",children:I}),a.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:x?`${r(k?"settings.serverHealthHistory":"settings.serverHealthLastIncident")}: ${N}${R?` · ${R}`:""}`: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:D}),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 uP=()=>()=>{},dP=()=>1/0;function hP(){const{t:e}=Jr(),t=y.useId(),r=jo(),n=y.useSyncExternalStore(r?.subscribe??uP,r?.retentionLimit??dP);if(!r)return null;const i=y8+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:u=>{const h=Number(u.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 i1="mobile-session-destroy";function fP(e,t){return t&&e.type==="session"&&e.destination?.droppableId===i1}const ea="termdock-program-rules-cache",Ed="termdock-toolbar-presets-cache",V0="termdock-settings-cache",bx="termdock-color-theme",yx="termdock:right-sidebar:file-preview-open-by-session:v2",q0="termdock:running-session-button-enabled:v1",Y0="termdock:attention-button-enabled:v1",pP=60,vx=320,wx=420,uo=8;function Ax(e,t,r){return Math.min(Math.max(e,t),r)}function Tx(e){if(typeof window>"u")return{left:uo,top:uo};const t=window.innerWidth/2,r=Math.min(64,window.innerHeight/4),n=e?.x??t,i=e?.y??r,l=Math.max(uo,window.innerWidth-vx-uo),u=Math.max(uo,window.innerHeight-wx-uo);return{left:Ax(n+uo,uo,l),top:Ax(i+uo,uo,u),width:vx,maxHeight:`min(${wx}px, calc(100vh - ${uo*2}px))`}}function mP(e){return e==="dark"||e==="light"}function gP(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 fp(e){const t=Object.entries(e).filter(([r,n])=>r&&Number.isFinite(n.updatedAt)).sort(([,r],[,n])=>n.updatedAt-r.updatedAt).slice(0,pP);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 bP(e){return typeof e=="object"&&e!==null&&typeof e.version=="number"&&Array.isArray(e.presets)}function yP(e,t){const r=gu(),n=new Set(FL()),i=Array.isArray(e)?e:[],l=Hc(i),u=t<tu;if(l.length===0)return r;if(u){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 vP(e){return typeof e=="object"&&e!==null&&typeof e.preventSleep=="boolean"&&typeof e.networkAvailable=="boolean"}const wP={name:"",source:"auto",hostname:"",fallbackHostname:"",url:"",fallbackUrl:"",onboardingUrl:null,status:"disabled",reason:null,httpsEnabled:!1,caAvailable:!1,lanAddresses:[],interfaces:[]},Mh="__termdockOverlay",Dh="__termdockBaseAnchor",Bh="__termdockBaseGuard",AP=3,Cx=250,TP="termdock-notification-target-v1",Sx="/__termdock-notification-target",_x=3e4;function CP(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 Oc(e){if(!e||typeof e!="object")return null;const t=e[Mh];return CP(t)?t:null}function Z1(e){return e&&typeof e=="object"?{...e}:{}}function W6(e){const t=Z1(e);return delete t[Mh],t}function SP(e){const t=W6(e);return delete t[Bh],{...t,[Dh]:!0}}function _P(){typeof window>"u"||window.history.pushState({...W6(window.history.state),[Dh]:!0,[Bh]:!0},"",window.location.href)}function G6(){for(let e=0;e<AP;e+=1)_P()}function Rd(){typeof window>"u"||(window.history.replaceState(SP(window.history.state),"",window.location.href),G6())}function Z0(e){typeof window>"u"||window.history.pushState({...Z1(window.history.state),[Dh]:!0,[Mh]:e,[Bh]:!1},"",window.location.href)}function LP(e){typeof window>"u"||window.history.replaceState({...Z1(window.history.state),[Dh]:!0,[Mh]:e,[Bh]:!1},"",window.location.href)}const V6=["bash","zsh","fish","sh","dash","ksh","tcsh","csh","nu"];let ta=new Set(V6);function Lx(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 kP(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 kx(e,t){return a.jsx(iQ,{sessionMode:e,state:t})}function IP(e,t){const r=new Map(e.map(u=>[u.id,u])),n=t.map(u=>r.get(u)).filter(u=>u!==void 0),i=new Set(t),l=e.filter(u=>!i.has(u.id));return[...n,...l]}function EP(){const{t:e,locale:t,setLocale:r}=Jr(),n="env(safe-area-inset-top, 0px)",i="env(safe-area-inset-bottom, 0px)";v8();const l=S.useMemo(()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,[]),[u,h]=S.useState(!1),[p,g]=S.useState(()=>zl(bx,mP)??"dark"),x=S.useRef(zl(V0,vP)).current,[b,w]=S.useState(x?.preventSleep??!1),[A,k]=S.useState(x?.networkAvailable??!0),[I,N]=S.useState(w8),[R,D]=S.useState(A8),[O,q]=S.useState(T8),[Y,U]=S.useState(C8),[V,me]=S.useState(ef),[Je,ve]=S.useState(x?.localAccess??wP),[_e,Ze]=S.useState(x?.localAccess?.name??""),[Ve,ce]=S.useState(!1),[ke,ot]=S.useState(null),[Ie,de]=S.useState(null),[qe,xe]=S.useState(null),[te,re]=S.useState(!1),[ge,ze]=S.useState(null),Ke=S.useMemo(()=>fo(),[]),Ae=!!(Ke?.desktopUpdateState&&Ke.checkDesktopUpdate&&Ke.installDesktopUpdate),[z,Oe]=S.useState(null),[nt,Re]=S.useState(null),[X,Be]=S.useState(!1),[st,be]=S.useState(null),[je,wt]=S.useState(!1),[Te,pe]=S.useState(()=>fp(zl(yx,gP)??{})),[$e,pt]=S.useState(0),[Tt,Ct]=S.useState(!1),[rr,ir]=S.useState(0),[yt,bt]=S.useState(!1),[_t,Qt]=S.useState(0),[Et,Ht]=S.useState(!1),[ne,Pe]=S.useState(0),it=S.useRef(null),[jt,ue]=S.useState({}),{terminalSettings:Nt,updateTerminalSettings:qt}=pD(),Se=Nt.fontSize,Ce=Nt.rendererMode,[ut,Ge]=S.useState(!1),dr=S.useRef(S8()).current,[Rt,un]=y.useState(()=>dr.sessions.map(C=>({id:C.sessionId,name:C.name,customName:C.customName,mode:C.mode,tmuxSessionName:C.tmuxSessionName}))),[It,jn]=S.useState(dr.activeSessionId),[is,Pn]=S.useState(!1);S.useEffect(()=>{is&&_8({rendered:!0})},[is]);const[Tr,In]=S.useState(null),[Br,ie]=S.useState(null),[$r,ft]=S.useState([]),[hr,Ls]=y.useState(()=>{const C=Vr.getState();return dr.sessions.forEach(B=>{B.backendSessionId&&C.setTerminalSession(B.sessionId,{sessionId:B.backendSessionId,cols:80,rows:24,mode:B.mode,tmuxSessionName:B.tmuxSessionName}),B.activeProgram!=null&&C.setSessionActiveProgram(B.sessionId,B.activeProgram),B.cwd!=null&&C.setSessionCwd(B.sessionId,B.cwd)}),Wc("session-chrome-hydrated"),Lx(Vr.getState().sessions)});y.useEffect(()=>{!Ke||!ut||Promise.all([Ke.snapshot(),Ke.desktopUpdateState?.()??Promise.resolve(null)]).then(([C,B])=>{Oe(C),Re(B)}).catch(C=>be(C instanceof Error?C.message:String(C)))},[Ke,ut]),y.useEffect(()=>{Ke?.onDesktopUpdateState&&Ke.onDesktopUpdateState(Re)},[Ke]),y.useEffect(()=>Vr.subscribe(C=>{const B=Lx(C.sessions);Ls(ee=>kP(ee,B)?ee:B)}),[]);const Un=y.useCallback(async(C,B)=>{ie(null),In({sessionId:C,status:"submitting",error:null});try{await L8(B),In(ee=>ee?.sessionId===C?{...ee,status:"waiting",error:null}:ee)}catch(ee){const kt=(ee&&typeof ee=="object"&&"code"in ee?String(ee.code??""):"")==="AGENT_SESSION_ACTIVE_ELSEWHERE"?e("tab.resumeAgentConflict"):ee instanceof Error&&/busy/i.test(ee.message)?e("tab.resumeAgentBusy"):e("tab.resumeAgentFailed");In(Ot=>Ot?.sessionId===C?{...Ot,error:kt}:Ot),ie({tone:"error",message:kt})}},[e]);y.useEffect(()=>{if(!Tr||Tr.status!=="waiting")return;const C=hr.get(Tr.sessionId);if(!C||C.agentResumeRecovered||C.agentStatus===null&&!C.agent)return;const B=C.agent?.displayName??"Agent";In(null),ie({tone:"success",message:e("tab.resumeAgentSuccess",{agent:B})})},[Tr,hr,e]),y.useEffect(()=>{if(!Tr||Tr.status!=="waiting"||Tr.error)return;const C=Tr.sessionId,B=window.setTimeout(()=>{const ee=e("tab.resumeAgentTimeout");In(Ye=>Ye?.sessionId===C&&Ye.status==="waiting"?{...Ye,error:ee}:Ye),ie({tone:"error",message:ee})},15e3);return()=>window.clearTimeout(B)},[Tr,e]),y.useEffect(()=>{if(Br?.tone!=="success")return;const C=window.setTimeout(()=>ie(null),3200);return()=>window.clearTimeout(C)},[Br]),y.useEffect(()=>{let C=!1;k8().then(ee=>{C||xe(ee)}).catch(()=>{}),I8().then(ee=>{C||ze(ee)}).catch(()=>{});const B=Em(ee=>{C||(ee.type==="update-state"?xe(ee.state):ee.type==="server-health"&&ze(ee.state))});return()=>{C=!0,B()}},[]);const as=y.useCallback(async()=>{try{ze(await E8())}catch(C){window.alert(C instanceof Error?C.message:String(C))}},[]),Pr=y.useCallback(async()=>{const C=qe?.latestVersion;if(!(!C||te)&&window.confirm(e("sidebar.updateRestartConfirm",{version:C}))){re(!0);try{xe(await R8())}catch(B){window.alert(B instanceof Error?B.message:String(B))}finally{re(!1)}}},[qe?.latestVersion,e,te]),Yt=y.useCallback(async()=>{if(!te){re(!0);try{xe(await N8())}catch(C){window.alert(C instanceof Error?C.message:String(C))}finally{re(!1)}}},[te]),Xn=y.useCallback(async()=>{if(!(!Ke?.checkDesktopUpdate||X)){Be(!0);try{Re(await Ke.checkDesktopUpdate())}catch(C){be(C instanceof Error?C.message:String(C))}finally{Be(!1)}}},[Ke,X]),dn=y.useCallback(async()=>{if(!(!Ke?.installDesktopUpdate||X||nt?.status!=="ready")&&window.confirm(e("settings.desktopUpdateRestartConfirm"))){Be(!0);try{Re(await Ke.installDesktopUpdate())}catch(C){be(C instanceof Error?C.message:String(C))}finally{Be(!1)}}},[Ke,X,nt?.status,e]);y.useEffect(()=>{document.documentElement.dataset.theme=p,M8(p),Bn(bx,p)},[p]),y.useEffect(()=>{Bn(yx,fp(Te))},[Te]);const kr=Jt(C=>C.leftOpen),Or=Jt(C=>C.rightOpen),Ur=Jt(C=>C.leftPinned),qr=Jt(C=>C.leftSidebarWidth),An=Jt(C=>C.rightPinned),Yr=Jt(C=>C.rightSidebarWidth),jr=Jt(C=>C.rootPath),En=Jt(C=>C.contextKey),Z=Jt(C=>C.selectedFilePath),He=Jt(C=>C.groupByFolder),xt=su(C=>C.collaborationGroups),cr=Jt(C=>C.collapsedGroups),Gt=Jt(C=>C.toggleGroupCollapsed),[At,hn]=y.useState(()=>typeof window>"u"?!0:window.matchMedia("(min-width: 1024px)").matches),[nn,On]=y.useState(()=>typeof window>"u"?1024:window.innerWidth),[rn,Tn]=y.useState(()=>typeof window>"u"?!1:window.matchMedia("(orientation: landscape)").matches),[Cn,$n]=y.useState([]),[ar,us]=y.useState({available:!0,version:null,reason:null}),[yr,Qr]=y.useState(!1),[Cr,ds]=y.useState(null),[Ln,Rn]=y.useState(null),[zr,Jn]=y.useState(null),[es,ur]=y.useState(null),[Hr,on]=y.useState(null),[Ms,yn]=y.useState(null),[$,he]=y.useState(null),[,De]=y.useState(0),[Ee,Me]=y.useState(null),[ht,vt]=y.useState(null),[lt,rt]=y.useState(null),[mt,fr]=y.useState(!1),[gt,Kt]=y.useState(()=>zl(q0,C=>typeof C=="boolean")??!1),at=y.useCallback(async C=>{const B=gt;Kt(C),Bn(q0,C);try{const ee=await ra({runningSessionButtonEnabled:C});Kt(ee.runningSessionButtonEnabled),Bn(q0,ee.runningSessionButtonEnabled)}catch{Kt(B),Bn(q0,B)}},[gt]),[nr,Ar]=y.useState(()=>zl(Y0,C=>typeof C=="boolean")??!0),er=y.useCallback(async C=>{const B=nr;Ar(C),Bn(Y0,C);try{const ee=await ra({attentionButtonEnabled:C});Ar(ee.attentionButtonEnabled),Bn(Y0,ee.attentionButtonEnabled)}catch{Ar(B),Bn(Y0,B)}},[nr]),[Gr,Mr]=y.useState(null),Sr=y.useCallback(C=>{Mr(C)},[]),Nn=y.useRef(!1),[F,ae]=y.useState(null),[le,Qe]=y.useState(null),Mt=S.useRef(null),Ut=S.useRef(!1),Xt=S.useRef(null),pr=S.useRef(!1),Dr=y.useCallback(()=>{yn(null),he(null)},[]),fn=S.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("session")),[j,ye]=S.useState(fn.current),[Ne,tt]=S.useState(!0),Lt=S.useRef(fn.current),Zt=S.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("_notifTrace"));y.useEffect(()=>{if(typeof window>"u")return;const C=window.matchMedia("(min-width: 1024px)"),B=()=>{hn(C.matches),On(window.innerWidth)};return B(),C.addEventListener("change",B),window.addEventListener("resize",B),()=>{C.removeEventListener("change",B),window.removeEventListener("resize",B)}},[]),y.useEffect(()=>{if(typeof window>"u")return;const C=window.matchMedia("(orientation: landscape)"),B=()=>Tn(C.matches);return B(),C.addEventListener("change",B),()=>C.removeEventListener("change",B)},[]);const Vt=S.useMemo(()=>It?$r.find(C=>C.sessionIds.includes(It))??null:null,[It,$r]),zt=Vt?.id??null,_r=Vt?.sessionIds[0]??It,bs=S.useRef([]);S.useLayoutEffect(()=>{const C=bs.current;if(bs.current=$r,C.length===0)return;const B=new Set($r.flatMap(ee=>ee.sessionIds));for(const ee of C){const Ye=ee.sessionIds.filter(kt=>!B.has(kt)).map(kt=>({sessionId:kt,rootPath:Vr.getState().sessions.get(kt)?.cwd??null}));Ye.length>0&&Jt.getState().inheritRightSidebarStateFromSplitWorkspace(ee.id,Ye)}},[$r]),S.useLayoutEffect(()=>((()=>{const B=_r?Vr.getState().sessions.get(_r)?.cwd??null:null;Jt.getState().setRootPath(B,_r,zt)})(),Vr.subscribe((B,ee)=>{const Ye=_r?B.sessions.get(_r)?.cwd??null:null,kt=_r?ee.sessions.get(_r)?.cwd??null:null;Ye!==kt&&Jt.getState().setRootPath(Ye,_r,zt)})),[zt,_r]);const ai=At||rn,Fs=nn*.95,Fo=ai?Math.min(Math.max(nn*.22,280),340):Math.min(nn*.86,380),ks=It&&jr?`${It}\0${jr}`:"",Is=!!(ks&&Z&&Te[ks]),zn=y.useCallback(C=>{ks&&(C&&!Jt.getState().selectedFilePath||pe(B=>{if(!!B[ks]===C)return B;if(C)return fp({...B,[ks]:{updatedAt:Date.now()}});const Ye={...B};return delete Ye[ks],Ye}))},[ks]);y.useEffect(()=>{vD(ks,En,Z)&&pe(C=>{if(!C[ks])return C;const B={...C};return delete B[ks],B})},[ks,En,Z]);const Zr=Et?"markdown-image-lightbox":yt?"markdown-outline":Tt?"right-sidebar-repo-picker":Or&&Is?"right-sidebar-file-preview":ut?"settings":Or&&!(An&&At)?"right-sidebar":kr&&!(Ur&&At)?"left-sidebar":null,Hn=S.useRef(Zr),hs=S.useRef(Zr),Aa=S.useRef(!1),wi=S.useRef(!1),Uo=y.useCallback(()=>{if(typeof window>"u")return;const C=window.matchMedia("(hover: hover) and (pointer: fine)").matches;!At||!C||navigator.maxTouchPoints>0||window.setTimeout(()=>{window.dispatchEvent(new CustomEvent("focus-active-terminal-session"))},0)},[At]),qa=y.useCallback(C=>{if(C==="markdown-image-lightbox"){Ht(!1),Pe(B=>B+1);return}if(C==="markdown-outline"){bt(!1),Qt(B=>B+1);return}if(C==="right-sidebar-file-preview"){bt(!1),Qt(B=>B+1),zn(!1),pt(B=>B+1);return}if(C==="right-sidebar-repo-picker"){Ct(!1),ir(B=>B+1);return}if(C==="settings"){Ge(!1),St(!1),Rr(!1),to(!1);return}if(C==="left-sidebar"){Jt.getState().closeLeft();return}bt(!1),Qt(B=>B+1),Ct(!1),ir(B=>B+1),Ht(!1),Pe(B=>B+1),Jt.getState().closeRight()},[zn]),ts=y.useCallback(C=>{if(!l&&typeof window<"u"&&Hn.current===C&&Oc(window.history.state)===C){window.history.back();return}qa(C)},[qa,l]),Ta=y.useCallback(()=>{Ge(!1);const C=Jt.getState();C.closeRight(),C.openLeft()},[]),Ca=y.useCallback(()=>{Ge(!1);const C=Jt.getState();C.closeLeft(),C.openRight()},[]),ul=y.useCallback(()=>{Ge(!1);const C=Jt.getState();C.closeLeft(),C.openRight(),C.setRightTab("files"),C.openRightSearch()},[]),sa=y.useCallback(()=>{const C=Jt.getState();if(C.leftPinned){C.setLeftPinned(!1),C.closeLeft();return}if(kr){ts("left-sidebar");return}Ta()},[Ta,ts,kr]),go=y.useCallback(()=>{const C=Jt.getState();C.leftPinned?(C.setLeftPinned(!1),C.openLeft()):(C.setLeftPinned(!0),C.openLeft())},[]),Ii=y.useCallback(()=>{const C=Jt.getState();C.setLeftPinned(!1),C.closeLeft()},[]),Ya=y.useCallback(()=>{const C=Jt.getState();C.rightPinned?(C.setRightPinned(!1),C.openRight()):(C.setRightPinned(!0),C.openRight())},[]),Za=y.useCallback(()=>{const C=Jt.getState();C.setRightPinned(!1),C.closeRight()},[]),Ka=y.useRef(0),Ai=y.useRef(0),Es=y.useRef(null),Vs=y.useCallback(C=>{C.preventDefault(),Ka.current=C.clientX,Ai.current=Jt.getState().leftSidebarWidth;const B=Ye=>{Es.current===null&&(Es.current=requestAnimationFrame(()=>{Es.current=null;const kt=Ye.clientX-Ka.current;Jt.getState().setLeftSidebarWidth(Ai.current+kt)}))},ee=()=>{window.removeEventListener("mousemove",B),window.removeEventListener("mouseup",ee),Es.current!==null&&(cancelAnimationFrame(Es.current),Es.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",B),window.addEventListener("mouseup",ee)},[]),zi=y.useRef(0),qs=y.useRef(0),ia=y.useRef(null),xo=y.useCallback(C=>{C.preventDefault(),zi.current=C.clientX;const B=Jt.getState(),ee=B.leftPinned?B.leftSidebarWidth:0;qs.current=Md(B.rightSidebarWidth,window.innerWidth,ee);const Ye=Ot=>{ia.current===null&&(ia.current=requestAnimationFrame(()=>{ia.current=null;const mr=zi.current-Ot.clientX,an=Jt.getState(),gn=an.leftPinned?an.leftSidebarWidth:0;an.setRightSidebarWidth(Md(qs.current+mr,window.innerWidth,gn))}))},kt=()=>{window.removeEventListener("mousemove",Ye),window.removeEventListener("mouseup",kt),ia.current!==null&&(cancelAnimationFrame(ia.current),ia.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",Ye),window.addEventListener("mouseup",kt)},[]),Hi=y.useCallback(()=>{const C=Jt.getState();if(C.rightPinned){C.setRightPinned(!1),C.closeRight();return}if(Or){ts("right-sidebar");return}Ca()},[Ca,ts,Or]),Sa=y.useCallback(()=>{!Is&&!l&&typeof window<"u"&&Hn.current==="right-sidebar"&&Oc(window.history.state)==="right-sidebar"&&(Z0("right-sidebar-file-preview"),hs.current="right-sidebar-file-preview"),zn(!0)},[Is,l,zn]),_a=y.useCallback(()=>{ts("right-sidebar-file-preview")},[ts]),dl=y.useCallback(()=>{!Tt&&!l&&typeof window<"u"&&Hn.current==="right-sidebar"&&Oc(window.history.state)==="right-sidebar"&&(Z0("right-sidebar-repo-picker"),hs.current="right-sidebar-repo-picker"),Ct(!0)},[Tt,l]),La=y.useCallback(()=>{ts("right-sidebar-repo-picker")},[ts]),bo=y.useCallback(()=>{!yt&&!l&&typeof window<"u"&&Hn.current&&Oc(window.history.state)===Hn.current&&(Z0("markdown-outline"),hs.current="markdown-outline"),bt(!0)},[yt,l]),Ti=y.useCallback(()=>{ts("markdown-outline")},[ts]),oi=y.useCallback(()=>{!l&&typeof window<"u"&&Hn.current&&Oc(window.history.state)===Hn.current&&(Z0("markdown-image-lightbox"),hs.current="markdown-image-lightbox"),Ht(!0)},[l]),ka=y.useCallback(()=>{ts("markdown-image-lightbox")},[ts]),aa=y.useCallback(()=>{!l&&typeof window<"u"&&Hn.current&&Oc(window.history.state)===Hn.current&&(LP("settings"),hs.current="settings"),Jt.getState().closeAll(),Ge(!0)},[l]),oa=y.useCallback(()=>{ts("settings")},[ts]);y.useEffect(()=>{if(!Ke)return;const C=()=>aa();return window.addEventListener("termdock:open-settings",C),()=>window.removeEventListener("termdock:open-settings",C)},[Ke,aa]);const $o=y.useCallback(()=>{wt(!0),it.current!==null&&(window.clearTimeout(it.current),it.current=null)},[]),vs=y.useCallback(()=>{it.current!==null&&(window.clearTimeout(it.current),it.current=null),wt(!1),wi.current=!0,Rd(),wi.current},[]);y.useEffect(()=>()=>{it.current!==null&&window.clearTimeout(it.current)},[]),y.useEffect(()=>{l||Rd()},[l]),y.useEffect(()=>{if(typeof window>"u"||l)return;let C=null;const B=()=>{C!==null&&(window.clearTimeout(C),C=null)},ee=an=>{if(Hn.current,wi.current,Hn.current){Hn.current;return}!an?.force&&wi.current||(an?.userActivated&&(wi.current=!0),Rd(),wi.current,void 0)},Ye=()=>{B(),C=window.setTimeout(()=>{C=null,ee({force:!0})},Cx)},kt=()=>{ee({userActivated:!0})},Ot=()=>{Ye()},mr=()=>{document.visibilityState==="visible"&&Ye()};return window.addEventListener("pointerdown",kt,{capture:!0,passive:!0}),window.addEventListener("touchstart",kt,{capture:!0,passive:!0}),window.addEventListener("keydown",kt,{capture:!0}),window.addEventListener("pageshow",Ot),document.addEventListener("visibilitychange",mr),()=>{B(),window.removeEventListener("pointerdown",kt,{capture:!0}),window.removeEventListener("touchstart",kt,{capture:!0}),window.removeEventListener("keydown",kt,{capture:!0}),window.removeEventListener("pageshow",Ot),document.removeEventListener("visibilitychange",mr)}},[l]),y.useEffect(()=>{Hn.current=Zr},[Zr]),y.useEffect(()=>{if(typeof window>"u"||Zr||l)return;const C=window.setTimeout(()=>{Hn.current?(Hn.current,void 0):Rd()},Cx);return()=>window.clearTimeout(C)},[Zr,l]),y.useEffect(()=>{if(typeof window>"u"||l)return;const C=hs.current;Aa.current,Zr&&Zr!==C&&!Aa.current&&Z0(Zr),!Zr&&C&&Uo(),hs.current=Zr,!Zr&&Aa.current&&window.setTimeout(()=>{Aa.current=!1},0)},[Zr,l,Uo]),y.useEffect(()=>{if(typeof window>"u"||l)return;const C=()=>{const B=Hn.current;if(wi.current,!B){wi.current=!1,wi.current,$o(),G6();return}Aa.current=!0,qa(B)};return window.addEventListener("popstate",C),()=>window.removeEventListener("popstate",C)},[qa,$o,l]),y.useEffect(()=>{const C=B=>{const ee=B.metaKey||B.ctrlKey;if(ee&&B.key==="b"&&!B.shiftKey&&(B.preventDefault(),sa()),ee&&B.shiftKey&&B.key==="E"&&(B.preventDefault(),Hi()),ee&&B.shiftKey&&B.key==="P"&&(B.preventDefault(),ul()),ee&&!B.shiftKey&&B.altKey&&(B.key==="ArrowLeft"||B.key==="ArrowRight")){B.preventDefault();const Ye=B.key==="ArrowRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:Ye}}));return}if(ee&&B.shiftKey&&!B.altKey&&(B.code==="BracketLeft"||B.code==="BracketRight")){B.preventDefault();const Ye=B.code==="BracketRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:Ye}}));return}};return document.addEventListener("keydown",C),()=>{document.removeEventListener("keydown",C)}},[sa,Hi,ul]);const li=y.useCallback(async()=>{ce(!0),ot(null);try{const C=await ra({localAccess:{name:_e}});ve(C.localAccess),Ze(C.localAccess.name),Bn(V0,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}catch(C){ot(C instanceof Error?C.message:"Failed to save local access name")}finally{ce(!1)}},[_e]),Xa=y.useCallback(async()=>{ce(!0),ot(null);try{const C=await ra({localAccess:{reset:!0}});ve(C.localAccess),Ze(C.localAccess.name),Bn(V0,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}catch(C){ot(C instanceof Error?C.message:"Failed to reset local access name")}finally{ce(!1)}},[]),Ja=y.useCallback(async(C,B="url")=>{if(C)try{if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(C);else{const ee=document.createElement("textarea");ee.value=C,ee.style.position="fixed",ee.style.left="-9999px",document.body.appendChild(ee),ee.focus(),ee.select(),document.execCommand("copy"),document.body.removeChild(ee)}de(B),window.setTimeout(()=>de(ee=>ee===B?null:ee),1600)}catch{de(null)}},[]),eo=y.useCallback(C=>{const B=IP(Rt,C);B.map(ee=>ee.id).join("\0")!==Rt.map(ee=>ee.id).join("\0")&&(un(B),window.dispatchEvent(new CustomEvent("reorder-terminal-session",{detail:{sessionIds:B.map(ee=>ee.id)}})))},[Rt]),Us=y.useCallback(C=>{At||C.type!=="session"||(Nn.current=!1,fr(!1),rt(C.draggableId))},[At]),Wi=y.useCallback(C=>{if(At||C.type!=="session")return;const B=C.destination?.droppableId===i1;B!==Nn.current&&(Nn.current=B,fr(B),B&&navigator.vibrate?.(20))},[At]),Ia=y.useCallback(C=>{const B=fP(C,!At);if(Nn.current=!1,fr(!1),rt(null),!B)return!1;const ee=Rt.find(kt=>kt.id===C.draggableId),Ye=ee?hr.get(ee.id):null;return ee&&i5({mode:ee.mode,activeProgram:Ye?.activeProgram??null,promptState:Ye?.promptState??null,shellNames:ta})?(Qe(null),ae(ee.id),Jn(null)):ee&&window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:{sessionId:ee.id,source:"other",closeMode:ee.mode==="tmux"?"destroy":"auto"}})),!0},[At,Rt,hr]),{groups:Zn,arranged:os}=S.useMemo(()=>Gd(Rt,C=>hr.get(C.id)?.cwd??null,He,e("sidebar.ungrouped"),$r,xt),[Rt,hr,He,e,$r,xt]),Ei=y.useCallback(C=>{Ia(C)||!C.destination||C.source.index===C.destination.index||window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:os[C.source.index]?.id,targetId:os[C.destination.index]?.id}}))},[Ia,os]),Gi=y.useCallback((C,B)=>{const ee=B.trim();ee&&window.dispatchEvent(new CustomEvent("rename-terminal-session",{detail:{sessionId:C,name:ee}}))},[]),Vi=y.useCallback(C=>{window.dispatchEvent(new CustomEvent("reset-terminal-session-name",{detail:{sessionId:C}}))},[]),{newSessionMode:$s,newSessionTmuxName:yo,userSelectedNewSessionMode:se,setNewSessionMode:We}=xD(),[et,$t]=y.useState(null),[Fe,St]=S.useState(!1),[Er,Fr]=S.useState(!1),[vn,Rr]=S.useState(!1),[pn,Sn]=S.useState("idle"),ws=S.useRef(zl(Ed,bP)).current,[Wn,fs]=S.useState(()=>{const C=ws?.presets;if(C&&C.length>0){const B=Hc(C);if(B.length>0)return B}return gu()}),[zs,Ql]=S.useState(!1),[la,zo]=S.useState("default"),vo=S.useRef(typeof ws?.updatedAt=="number"?ws.updatedAt:null),jl=S.useRef(!1),[Ho,to]=S.useState(!1),[Wo,Go]=S.useState(!1),wo=S.useRef(zl(ea,xP)).current,[Gn,ci]=S.useState(wo??[]),[Vo,pc]=S.useState(wo!==null),[mc,L]=S.useState(!1),Q=!Zr&&!Er&&!vn&&!Fe&&!Ho&&!Wo&&!Ms&&!F&&!et,P=S.useCallback(C=>{const B=typeof C.version=="number"?C.version:0,ee=yP(Array.isArray(C.presets)?C.presets:[],B);vo.current=typeof C.updatedAt=="number"?C.updatedAt:null,fs(Ye=>D8(Ye,ee)?Ye:(jl.current=!0,ee)),Bn(Ed,{version:tu,presets:ee,updatedAt:vo.current??void 0})},[]);y.useEffect(()=>{const C=B=>{if(B.key!=="Escape")return;if(Er){B.preventDefault(),Fr(!1);return}if(vn){B.preventDefault(),Rr(!1);return}if(Fe){B.preventDefault(),St(!1);return}if(Ho){B.preventDefault(),to(!1);return}if(Wo){B.preventDefault(),Go(!1);return}if(Ms){B.preventDefault(),Dr();return}if(Ee){B.preventDefault(),on(null),Me(null);return}if(ut){B.preventDefault(),oa();return}if(Or&&!(An&&At)){B.preventDefault(),ts("right-sidebar");return}kr&&!(Ur&&At)&&(B.preventDefault(),ts("left-sidebar"))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[Er,vn,Fe,Ho,Ms,Dr,ut,Or,An,kr,Ur,At,oa,ts]),y.useEffect(()=>{pc(!0)},[]);const[W,Ue]=S.useState({genericProgramNames:[],wrapperScriptNames:[],shellNames:V6}),[,Le]=S.useState(!1),ct=S.useCallback(()=>B8().then(C=>{Ue(C),ta=new Set(C.shellNames),Le(!0)}).catch(()=>{}),[]);y.useEffect(()=>{ct()},[ct]),y.useEffect(()=>Em(C=>{if(C.type==="config-updated"){if(C.key==="toolbar-presets"){Rm().then(B=>P(B)).catch(B=>{console.warn("[toolbar-presets] Failed to refresh after remote update:",B)});return}C.key==="program-detection"&&ct()}}),[P,ct]),y.useEffect(()=>{let C=!1;return(async()=>{try{const B=await Rm();if(C)return;P(B)}catch(B){console.warn("[toolbar-presets] Failed to load from server:",B)}finally{C||Ql(!0)}})(),()=>{C=!0}},[P]),y.useEffect(()=>{if(zs){if(jl.current){jl.current=!1;return}Bn(Ed,{version:tu,presets:Wn,updatedAt:vo.current??void 0}),Q8({version:tu,presets:Wn,baseUpdatedAt:vo.current??void 0}).then(C=>{vo.current=typeof C.updatedAt=="number"?C.updatedAt:null,Bn(Ed,{version:tu,presets:Wn,updatedAt:vo.current??void 0})}).catch(C=>{const B=C instanceof Error&&"current"in C?C.current:null;B&&typeof B=="object"&&P(B),console.warn("[toolbar-presets] Failed to save to server:",C)})}},[P,Wn,zs]),y.useEffect(()=>{Bl().then(C=>{w(B=>B===C.preventSleep?B:C.preventSleep),k(B=>B===C.networkAvailable?B:C.networkAvailable),ve(C.localAccess),Ze(C.localAccess.name),Kt(C.runningSessionButtonEnabled),Bn(q0,C.runningSessionButtonEnabled),Ar(C.attentionButtonEnabled),Bn(Y0,C.attentionButtonEnabled),Bn(V0,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}).catch(()=>{})},[]),y.useEffect(()=>{if(!I)return;const C=ef();me(C),C!=="granted"&&(N(!1),Xu(!1))},[I]),y.useEffect(()=>{if(!I)return;x0();const C=()=>{document.visibilityState==="visible"&&(x0(),Z8())},B=window.setInterval(()=>{x0()},360*60*1e3);return document.addEventListener("visibilitychange",C),window.addEventListener("focus",C),()=>{window.clearInterval(B),document.removeEventListener("visibilitychange",C),window.removeEventListener("focus",C)}},[I]);const dt=y.useCallback(async()=>{if(I){N(!1),Xu(!1),j8(),me(ef());return}const C=await P8();if(me(C),C!=="granted"){N(!1),Xu(!1);return}N(!0),Xu(!0),await x0(!0,!0),Sn("idle")},[I]),Pt=y.useCallback(async()=>{Sn("checking"),await fo()?.prepareNotificationTest?.();const C=await O8({title:"Termdock",body:e("settings.notificationsTestBody"),tag:"termdock-notification-test",requireHidden:!1,data:{url:"/"}});Sn(C?"delivered":"failed")},[e]),vr=y.useCallback(C=>{D(C),F8(C),tf()},[]),sn=y.useCallback(C=>{q(C),U8(C),tf()},[]),Mn=y.useCallback(C=>{U(C),$8(C),tf()},[]);y.useEffect(()=>{Wn.some(C=>C.id===la)||zo(Wn[0]?.id??"default")},[la,Wn]),y.useEffect(()=>{if(!ar.available&&$s==="tmux"){We("shell",{userInitiated:!1});return}ar.available&&se!=="shell"&&$s!=="tmux"&&We("tmux",{userInitiated:!1})},[$s,ar.available,se,We]),y.useEffect(()=>{$t(null)},[ut,$s,ar.available]),y.useEffect(()=>{const C={};typeof navigator<"u"&&(C.userAgent=navigator.userAgent,C.platform=navigator.platform,C.maxTouchPoints=navigator.maxTouchPoints,C.hasTouch=navigator.maxTouchPoints>0||"ontouchstart"in window,C.vendor=navigator.vendor),typeof window<"u"&&(C.screenWidth=window.innerWidth,C.screenHeight=window.innerHeight,C.pixelRatio=window.devicePixelRatio,C.orientation=window.screen?.orientation?.type||"unknown",C.hasVisualViewport=!!window.visualViewport,C.visualViewportHeight=window.visualViewport?.height,C.visualViewportWidth=window.visualViewport?.width,C.location=window.location.href),C.timestamp=new Date().toISOString(),C.isIOS=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,C.isAndroid=/Android/.test(navigator.userAgent),ue(C)},[]);const _n=y.useCallback(C=>{if(Ia(C)||!C.destination)return;if(C.type==="group"){if(C.source.index===C.destination.index)return;eo(Ox(Zn,C.source.index,C.destination.index));return}if(C.source.droppableId!==C.destination.droppableId||C.source.index===C.destination.index)return;const B=C.source.droppableId.replace(/^group-sessions:/,""),ee=Zn.find(Ye=>Ye.key===B);ee&&window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:ee.sessions[C.source.index]?.id,targetId:ee.sessions[C.destination.index]?.id}}))},[Zn,eo,Ia]),Vn=S.useMemo(()=>os.flatMap(C=>{const B=hr.get(C.id);if(B?.agentStatus!=="working")return[];const{primary:ee,secondary:Ye}=Do(C,B?.activeProgram??null,B?.cwd??null,ta,B?.shellTitle??null,B?.promptState??null);return[{id:C.id,label:ee,detail:Ye}]}),[os,hr]),Nr=It?os.findIndex(C=>C.id===It):-1,mn=os.length>0&&Nr>=0?`${Nr+1}/${os.length}`:`${os.length}`,wn=S.useMemo(()=>{let C=0;for(const B of Rt){const ee=hr.get(B.id);(ee?.agentStatus==="waiting"||ee?.agentNeedsReview)&&(C+=1)}return{running:Vn.length,review:C}},[Vn.length,Rt,hr]),Ys=S.useMemo(()=>os.flatMap(C=>{const B=hr.get(C.id);if(B?.agentStatus!=="waiting"&&!B?.agentNeedsReview)return[];const{primary:ee}=Do(C,B.activeProgram,B.cwd,ta,B.shellTitle,B.promptState);return[{id:B.terminalSessionId??C.id,label:ee,waiting:B.agentStatus==="waiting"}]}),[os,hr]);z8(wn.running,wn.review,Ys);const ca=It?Rt.find(C=>C.id===It)??null:null,ps=ca?hr.get(ca.id):void 0,Pl=!!(ca&&ps?.agentResumeRecovered&&ps.agentNativeSessionId&&ps.terminalSessionId),Rs=ca&&Tr?.sessionId===ca.id?Tr:null;S.useLayoutEffect(()=>{if(!Ne)return;const C=Xt.current;if(!C)return;const B=!pr.current;C.scrollIntoView({inline:"nearest",block:"nearest",behavior:B?"auto":"smooth"}),pr.current=!0,B&&Wc("active-tab-positioned")},[It,Ne]),y.useEffect(()=>{Hr&&Mt.current&&(Mt.current.scrollIntoView({block:"nearest",inline:"nearest"}),Mt.current.focus(),Mt.current.select()),Hr||(Ut.current=!1)},[Hr]);const Ao=y.useCallback(C=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:C}))},[]),hl=y.useCallback((C,B)=>{he(B??null),yn(C)},[]),gc=p6(),Ci=y.useCallback(C=>{if(!C)return;ye(C),Zt.current&&ga("info","PWA_NOTIFICATION_CLICK app-focus-request",{traceId:Zt.current,requestedSessionId:C,activeSessionId:It,sessions:Rt.map(ee=>({id:ee.id,terminalSessionId:hr.get(ee.id)?.terminalSessionId??null}))}),H8(C);const B=Rt.find(ee=>ee.id===C||hr.get(ee.id)?.terminalSessionId===C);B?(Lt.current=null,Zt.current&&ga("info","PWA_NOTIFICATION_CLICK app-focus-dispatch",{traceId:Zt.current,requestedSessionId:C,targetSessionId:B.id}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:B.id}))):(Lt.current=C,Zt.current&&ga("info","PWA_NOTIFICATION_CLICK app-focus-pending",{traceId:Zt.current,requestedSessionId:C}))},[It,Rt,hr]);y.useEffect(()=>{if(typeof window>"u"||typeof caches>"u")return;let C=!1;const B=async()=>{if(window.parent!==window&&jo()){tt(!0);return}try{const Ye=await caches.open(TP),kt=await Ye.match(Sx);if(!kt)return;await Ye.delete(Sx);const Ot=await kt.json();if(C)return;const mr=typeof Ot.sessionId=="string"?Ot.sessionId:null,an=typeof Ot.traceId=="string"?Ot.traceId:null,gn=typeof Ot.clickedAt=="number"?Ot.clickedAt:0,en=Date.now()-gn;ga("info","PWA_NOTIFICATION_CLICK app-cache-consumed",{traceId:an,sessionId:mr,ageMs:en,valid:!!(mr&&en>=0&&en<=_x),visibilityState:document.visibilityState}),mr&&en>=0&&en<=_x&&(Zt.current=an,typeof Ot.targetPeerId=="string"&&Ot.targetPeerId!==b0()?.targetPeerId?jo()?.focusSession(Ot.targetPeerId,mr):Ci(mr))}catch(Ye){ga("warn","PWA_NOTIFICATION_CLICK app-cache-failed",{error:Ye instanceof Error?Ye.message:String(Ye)})}finally{C||tt(!0)}},ee=()=>{document.visibilityState==="visible"&&B()};return B(),document.addEventListener("visibilitychange",ee),window.addEventListener("pageshow",B),()=>{C=!0,document.removeEventListener("visibilitychange",ee),window.removeEventListener("pageshow",B)}},[Ci]),y.useEffect(()=>{if(typeof window>"u")return;const C=new URLSearchParams(window.location.search),B=C.get("session");if(!B)return;ga("info","PWA_NOTIFICATION_CLICK app-url-received",{traceId:Zt.current,targetSessionId:B,href:window.location.href,visibilityState:document.visibilityState});const ee=C.get("service");ee&&ee!==b0()?.targetPeerId?jo()?.focusSession(ee,B):Lt.current=B,C.delete("service"),C.delete("session"),C.delete("_notifTrace");const Ye=C.toString(),kt=`${window.location.pathname}${Ye?`?${Ye}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",kt)},[]),y.useEffect(()=>{if(typeof window>"u")return;const C=new URLSearchParams(window.location.search);if(C.get("_notif")!=="1")return;const B=C.get("session");C.delete("_notif");const ee=C.toString(),Ye=`${window.location.pathname}${ee?`?${ee}`:""}${window.location.hash}`;if(window.history.replaceState(window.history.state,"",Ye),window.parent!==window&&jo())return;const kt=new BroadcastChannel("termdock:notif");let Ot=!1;const mr=gn=>{gn.data?.type==="termdock:notif-pong"&&!Ot&&(Ot=!0,kt.close(),window.close())};kt.addEventListener("message",mr),kt.postMessage({type:"termdock:notif-ping",sessionId:B,targetPeerId:C.get("service")});const an=setTimeout(()=>{Ot||kt.close()},500);return()=>{clearTimeout(an),Ot||kt.close()}},[]),y.useEffect(()=>{if(typeof window>"u"||window.parent!==window&&jo())return;const C=new BroadcastChannel("termdock:notif"),B=ee=>{ee.data?.type==="termdock:notif-ping"&&(C.postMessage({type:"termdock:notif-pong"}),typeof ee.data.sessionId=="string"&&(typeof ee.data.targetPeerId=="string"&&ee.data.targetPeerId!==b0()?.targetPeerId?jo()?.focusSession(ee.data.targetPeerId,ee.data.sessionId):Ci(ee.data.sessionId)))};return C.addEventListener("message",B),()=>C.close()},[Ci]),y.useEffect(()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return;const C=B=>{const ee=B.data;if(ee&&ee.type==="termdock:focus-session"&&typeof ee.sessionId=="string"){if(typeof ee.targetPeerId=="string"&&ee.targetPeerId!==b0()?.targetPeerId){jo()?.focusSession(ee.targetPeerId,ee.sessionId)&&B.ports[0]?.postMessage({type:"termdock:focus-session-ack"});return}B.ports[0]?.postMessage({type:"termdock:focus-session-ack"}),Ci(ee.sessionId)}else ee?.type==="termdock:push-subscription-changed"?x0(!0):ee?.type};return navigator.serviceWorker.addEventListener("message",C),()=>navigator.serviceWorker.removeEventListener("message",C)},[Ci]),y.useEffect(()=>{const C=B=>{const ee=B.detail;typeof ee=="string"&&Ci(ee)};return window.addEventListener("termdock:focus-session",C),()=>window.removeEventListener("termdock:focus-session",C)},[Ci]),y.useEffect(()=>{const C=()=>{const B=K8(b0()?.targetPeerId);B&&Ci(B)};return C(),window.addEventListener("termdock:workspace-session",C),()=>window.removeEventListener("termdock:workspace-session",C)},[Ci]),y.useEffect(()=>{const C=Lt.current;if(!C)return;const B=Rt.find(ee=>ee.id===C||hr.get(ee.id)?.terminalSessionId===C);B?(Lt.current=null,Zt.current&&ga("info","PWA_NOTIFICATION_CLICK app-pending-dispatch",{traceId:Zt.current,requestedSessionId:C,targetSessionId:B.id,activeSessionId:It}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:B.id}))):Zt.current&&ga("info","PWA_NOTIFICATION_CLICK app-pending-unmatched",{traceId:Zt.current,requestedSessionId:C,activeSessionId:It,sessions:Rt.map(ee=>({id:ee.id,terminalSessionId:hr.get(ee.id)?.terminalSessionId??null}))})},[It,Rt,hr]);const ua=S.useMemo(()=>{const C=[];for(const B of Rt){const ee=hr.get(B.id);(ee?.agentStatus==="waiting"||ee?.agentNeedsReview)&&C.push(B.id)}return C},[Rt,hr]),Ds=y.useCallback(()=>{if(ua.length===0)return;It&&Vr.getState().clearAgentNeedsReview(It);const C=It?Rt.findIndex(ee=>ee.id===It):-1,B=ua.find(ee=>Rt.findIndex(Ye=>Ye.id===ee)>C)??ua[0];B&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:B}))},[ua,Rt,It]),fl=y.useCallback(()=>{if(ua.length===0)return;It&&Vr.getState().clearAgentNeedsReview(It);const C=It?Rt.findIndex(ee=>ee.id===It):Rt.length,B=[...ua].reverse().find(ee=>Rt.findIndex(Ye=>Ye.id===ee)<C)??ua[ua.length-1];B&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:B}))},[ua,Rt,It]);y.useEffect(()=>{const C=B=>{!B.altKey||!B.shiftKey||B.metaKey||B.ctrlKey||B.key!=="ArrowUp"&&B.key!=="ArrowDown"||(B.preventDefault(),B.key==="ArrowUp"?fl():Ds())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[Ds,fl]);const Qh=y.useCallback(async C=>{const ee=Vr.getState().sessions.get(C)?.cwd;if(ee)try{await navigator.clipboard?.writeText(ee),vt(ee),window.setTimeout(()=>{vt(Ye=>Ye===ee?null:Ye)},1400)}catch{}},[]),Du=y.useCallback(C=>{un(C.sessions),jn(C.activeSessionId),ft(C.splitWorkspaces),Vr.getState().setActiveSessionId(C.activeSessionId)},[]),jh=y.useCallback(()=>{Pn(!0)},[]),Ph=y.useCallback(()=>{Pn(!0),window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("termdock:initial-viewport-presented"))})},[]);y.useEffect(()=>{if(!j||!It)return;Rt.find(B=>B.id===j||hr.get(B.id)?.terminalSessionId===j)?.id===It&&ye(null)},[It,j,Rt,hr]);const ro=y.useCallback(C=>{const B=C?.mode??$s,ee=B==="tmux"&&(C?.tmuxSessionName?.trim()||yo.trim())||void 0,Ye=C?.cwd||(It?Vr.getState().sessions.get(It)?.cwd:void 0);window.dispatchEvent(new CustomEvent("new-terminal-session",{detail:{mode:B,tmuxSessionName:ee,cwd:Ye,command:C?.command}}))},[$s,yo,It]),qo=y.useCallback(async()=>{Qr(!0);try{const C=await pp();if(us(C),!C.available){$n([]);return}const B=await mp();$n(B)}catch{us({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),$n([])}finally{Qr(!1)}},[]),Oh=y.useCallback(async C=>{Rn(C),Jn(null);try{const{cleanedSessions:B}=await Nx(C);for(const ee of B)window.dispatchEvent(new CustomEvent("close-terminal-session-by-backend",{detail:ee}));ds(null),await qo()}catch(B){Jn(B instanceof Error?B.message:"Failed to kill tmux session")}finally{Rn(null)}},[qo]);y.useEffect(()=>{if(!es)return;if(Cn.find(ee=>ee.name===es&&(ee.connected||ee.boundFrontendSessionId))){ur(null);return}const B=setTimeout(()=>ur(null),1e4);return()=>clearTimeout(B)},[es,Cn]);const xc=y.useCallback(C=>{window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:C}))},[]),Bu=y.useCallback(C=>{const B=C??It;B&&window.dispatchEvent(new CustomEvent("open-terminal-split-chooser",{detail:B}))},[It]),Qu=y.useCallback((C,B)=>{window.dispatchEvent(new CustomEvent("set-terminal-split-direction",{detail:{sessionId:C,layout:B}}))},[]),ju=y.useCallback((C,B)=>{window.dispatchEvent(new CustomEvent("reorder-terminal-split-workspace",{detail:{workspaceId:C,sessionIds:B}}))},[]),bc=y.useCallback((C,B)=>{window.dispatchEvent(new CustomEvent("rename-terminal-split-workspace",{detail:{workspaceId:C,name:B}}))},[]),h0=y.useCallback((C,B)=>{window.dispatchEvent(new CustomEvent("combine-terminal-split-sessions",{detail:{primaryId:C,secondaryId:B}}))},[]),pl=y.useCallback((C,B)=>{const ee=Rt.find(kt=>kt.id===C);if(!ee)return;const Ye=hr.get(C);if(!i5({mode:ee.mode,activeProgram:Ye?.activeProgram??null,promptState:Ye?.promptState??null,shellNames:ta})){xc({sessionId:C,source:"sidebar",closeMode:ee.mode==="tmux"?"destroy":"auto"});return}Qe(B?{x:B.clientX,y:B.clientY}:null),ae(C),Jn(null)},[Rt,hr,xc]);y.useEffect(()=>{if(!Ke)return;const C=B=>{const ee=B.detail;ee==="new-session"?ro():ee==="close-session"?It&&pl(It):ee==="previous-session"||ee==="next-session"?window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:ee==="next-session"?"next":"prev"}})):ee==="toggle-left-sidebar"?sa():ee==="toggle-right-sidebar"?Hi():ee==="previous-attention"?fl():ee==="next-attention"&&Ds()};return window.addEventListener("termdock:native-command",C),()=>window.removeEventListener("termdock:native-command",C)},[It,Ke,ro,pl,sa,Hi,Ds,fl]);const no=S.useMemo(()=>Rt.find(C=>C.id===F)??null,[Rt,F]),Fh=S.useMemo(()=>{if(!no)return"";const C=hr.get(no.id);return Do(no,C?.activeProgram??null,C?.cwd??null,ta,C?.shellTitle??null,C?.promptState??null).primary},[no,hr]);y.useEffect(()=>{if(!ut)return;let C=!1,B=!1;const ee=async()=>{if(!B)try{const kt=await pp();if(C||us(kt),!kt.available){C||$n([]);return}const Ot=await mp();C||$n(Ot)}catch{B=!0,C||(us({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),$n([]))}};ee();const Ye=setInterval(()=>{ee()},4e3);return()=>{C=!0,clearInterval(Ye)}},[ut]);const yc=et??$s,vc=yc==="shell",f0=yc==="tmux"&&ar.available,Uh=S.useMemo(()=>W8(Cn.map(C=>({...C,id:C.name})),C=>C.cwd??null,e("sidebar.ungrouped")),[Cn,e]),Pu=S.useMemo(()=>Cn.filter(C=>C.recoveryCandidate===!0&&!C.connected&&!C.boundFrontendSessionId).sort((C,B)=>(B.lastActiveAt??B.createdAt??0)-(C.lastActiveAt??C.createdAt??0)),[Cn]);y.useEffect(()=>{!kr&&!(Ur&&At)||qo()},[kr,Ur,At,Rt.length,qo]);const wc=(C,B,ee,Ye=!1)=>{const kt=C.id===It,Ot=C.id===Hr,mr=hr.get(C.id),{primary:an,secondary:gn}=Do(C,mr?.activeProgram??null,mr?.cwd??null,ta,mr?.shellTitle??null,mr?.promptState??null),en=lu(mr?.cwd??null),Bs=B?gn??(en&&en!==an?en:null):null,xn=mr?.gitStatus,As=`${mr?.cwd||C.name}${xn?`
|
|
156
|
-
⎇ ${xn.branch} +${xn.added} −${xn.removed}`:""}`,qi=!!(mr?.tuiProgress&&mr.tuiProgress.state!=="remove"),Ea=mr?.agentStatus==="working"||qi?"var(--success)":mr?.agentStatus==="waiting"||mr?.agentNeedsReview?"var(--warning)":mr?.inCopyMode?"var(--tmux)":null;if(Ot&&At&&!Ee){const Yi=C.customName?C.name:an,ui=(ha,zu)=>{const Tc=zu.trim();Tc?Tc!==Yi&&Gi(ha,Tc):Vi(ha),on(null)};return a.jsx("input",{ref:ha=>{Mt.current=ha},type:"text",defaultValue:Yi,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(Yi.length,5)}ch`},onKeyDown:ha=>{ha.key==="Enter"?ui(C.id,ha.target.value):ha.key==="Escape"&&on(null)},onBlur:ha=>ui(C.id,ha.target.value)})}return a.jsx("div",{ref:kt?Xt:null,onContextMenu:Yi=>{Yi.preventDefault(),he({x:Yi.clientX,y:Yi.clientY}),yn(C.id)},...gc(()=>hl(C.id)),className:Ye?`group relative inline-flex h-5 shrink-0 items-center rounded-sm text-[11px] leading-none transition ${kt?"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 ${kt?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:bg-surface-elevated/50 hover:text-foreground"}`,style:!Ye&&kt&&Ea?{boxShadow:`inset 2px 0 0 0 ${Ea}`}:!Ye&&kt?{boxShadow:"inset 2px 0 0 0 rgb(var(--primary-rgb, 99 102 241))"}:void 0,title:As,children:a.jsx("button",{type:"button",...ee??{},onClick:()=>Ao(C.id),className:`inline-flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-left ${Ye?"px-1":"py-1 pl-1 pr-1.5 sm:pl-1.5 sm:pr-2"} ${ee?"cursor-grab active:cursor-grabbing":""}`,title:As,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:[kx(C.mode,mr),mr?.agentResumeRecovered&&a.jsx(Jl,{size:Ye?9:10,className:"-ml-0.5 shrink-0 text-[color:var(--warning)]","aria-label":e("tab.resumeAgentAvailable")}),qi&&!mr?.agentStatus&&a.jsx(cn,{size:Ye?9:10,className:"-ml-0.5 shrink-0 animate-spin text-[color:var(--success)]"})]}),Bs?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] ${mr?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:an}),a.jsx("span",{className:"truncate text-[9px] text-muted-foreground/80 sm:text-[9.5px]",children:Bs})]}):a.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${mr?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:an})]})})})},Ou=()=>a.jsx(il,{droppableId:i1,type:"session",isDropDisabled:At,children:(C,B)=>{const ee=mt||B.isDraggingOver;return a.jsxs("div",{ref:C.innerRef,...C.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":!lt,"data-mobile-session-destroy-target":"","data-active":ee?"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 ${lt?ee?"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(yi,{size:28,strokeWidth:1.8}),a.jsx("span",{className:"px-2 text-center text-[11px] font-semibold leading-tight",children:e(ee?"tab.releaseToClose":"tab.dragToClose")})]}),C.placeholder]})}}),da=Ur&&At,Ol=An&&At,ml=Md(Yr,nn,da?qr:0),Yo=Ol?ml+Rx:0,Zo=da?Rt.find(C=>C.id===It):null,rs=Zo?hr.get(Zo.id):void 0,Fu=Zo?Do(Zo,rs?.activeProgram??null,rs?.cwd??null,ta,rs?.shellTitle??null,rs?.promptState??null).primary:"",Ac=At?Vt:null,Uu=da&&!Ac&&rs?rs.agentStatus==="working"?"bg-gradient-to-r from-[rgb(var(--success-rgb)_/_0.08)] to-transparent":rs.agentStatus==="waiting"?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.14)] to-transparent":rs.agentNeedsReview?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.08)] to-transparent":rs.inCopyMode?"bg-gradient-to-r from-[rgb(var(--tmux-rgb)_/_0.07)] to-transparent":"":"",$u=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:`${At?"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 ${da?"flex justify-end":"flex justify-between"} ${He?"h-10 sm:h-10":"h-9 sm:h-10"} ${Uu}`,style:{marginRight:Yo||void 0,display:Ac?"none":void 0},children:[!da&&a.jsxs("button",{type:"button",onClick:sa,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")}: ${wn.running} · ${e("agent.needsReview")}: ${wn.review}`,children:[a.jsx(Iw,{size:14}),a.jsx(oQ,{runningCount:wn.running,reviewCount:wn.review,className:"sm:hidden"})]}),da?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:Zo?a.jsxs(a.Fragment,{children:[kx(Zo.mode,rs),a.jsx("span",{className:`truncate text-[12px] font-medium ${rs?.inCopyMode?"text-[color:var(--tmux)]":"text-foreground"}`,children:Fu}),rs?.agentStatus==="working"&&a.jsx("span",{title:rs?.agentMessage??void 0,children:a.jsx(cn,{size:12,className:"shrink-0 animate-spin text-[color:var(--success)]"})}),rs?.agentStatus==="waiting"&&a.jsx("span",{title:rs?.agentMessage??void 0,children:a.jsx(Vd,{size:12,className:"shrink-0 animate-bounce-y text-[color:var(--warning)]"})}),!rs?.agentStatus&&rs?.agentNeedsReview&&a.jsx("span",{title:rs?.agentMessage??void 0,children:a.jsx(Ml,{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")})}):He?a.jsxs(uh,{onDragStart:Us,onDragUpdate:Wi,onDragEnd:_n,children:[Ou(),a.jsx(il,{droppableId:"groups",type:"group",direction:"horizontal",children:C=>a.jsxs("div",{ref:C.innerRef,...C.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:[Zn.map((B,ee)=>{let Ye=0,kt=0;for(const gn of B.sessions){const en=hr.get(gn.id);en?.agentStatus==="working"&&(Ye+=1),(en?.agentStatus==="waiting"||en?.agentNeedsReview)&&(kt+=1)}const Ot=B.sessions.some(gn=>gn.id===It),mr=cr.has(B.key),an=B.key==="";return a.jsx(sl,{draggableId:`group-${B.key||"__ungrouped__"}`,index:ee,isDragDisabled:an,disableInteractiveElementBlocking:!0,children:(gn,en)=>a.jsxs("div",{ref:gn.innerRef,...gn.draggableProps,className:`flex w-fit shrink-0 flex-col justify-center gap-px rounded-md py-0.5 px-1 ring-1 transition-colors ${en.isDragging?"bg-surface-elevated ring-primary/30 shadow-lg opacity-90":Ot?"bg-primary/[0.06] ring-primary/20":"bg-surface-2/40 ring-border/10"}`,children:[a.jsxs("button",{type:"button",...an?{}:gn.dragHandleProps,onClick:()=>Gt(B.key),className:`flex ${mr?"":B.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 ${an?"":"cursor-grab active:cursor-grabbing"} ${Ot?"text-primary/80":"text-muted-foreground/55"}`,title:B.key||B.label,children:[a.jsx(Xc,{size:9,className:`shrink-0 opacity-70 transition-transform ${mr?"":"rotate-90"}`}),a.jsx("span",{className:"min-w-0 truncate",children:B.label}),Ye>0&&a.jsx("span",{className:"ml-auto h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)]"}),kt>0&&a.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] ${Ye>0?"":"ml-auto"}`})]}),mr?a.jsx("span",{className:"flex h-5 items-center text-[10px] leading-none text-muted-foreground/50",children:e("tab.sessionCount",{count:B.sessions.length})}):a.jsx(il,{droppableId:`group-sessions:${B.key}`,type:"session",direction:"horizontal",children:Bs=>a.jsxs("div",{ref:Bs.innerRef,...Bs.droppableProps,className:"flex items-center gap-px",children:[B.sessions.map((xn,As)=>a.jsx(sl,{draggableId:xn.id,index:As,disableInteractiveElementBlocking:!0,children:(qi,Ea)=>a.jsx("div",{ref:qi.innerRef,...qi.draggableProps,className:`flex shrink-0 items-center ${Ea.isDragging?"opacity-70":""}`,children:wc(xn,!1,qi.dragHandleProps,!0)})},xn.id)),Bs.placeholder]})})]})},B.key||"__ungrouped__")}),C.placeholder,a.jsx("button",{type:"button",onClick:()=>ro(),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(bi,{size:14})})]})})]}):a.jsxs(uh,{onDragStart:Us,onDragUpdate:Wi,onDragEnd:Ei,children:[Ou(),a.jsx(il,{droppableId:"tabs",type:"session",direction:"horizontal",children:C=>a.jsxs("div",{ref:C.innerRef,...C.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:[os.map((B,ee)=>B.id===Hr?a.jsx(S.Fragment,{children:a.jsx(sl,{draggableId:B.id,index:ee,isDragDisabled:!0,children:kt=>a.jsx("div",{ref:kt.innerRef,...kt.draggableProps,className:"flex h-full items-center",children:wc(B,!0)})})},B.id):a.jsx(S.Fragment,{children:a.jsx(sl,{draggableId:B.id,index:ee,disableInteractiveElementBlocking:!0,children:(kt,Ot)=>a.jsx("div",{ref:kt.innerRef,...kt.draggableProps,className:`flex h-full shrink-0 items-center ${Ot.isDragging?"opacity-70":""}`,children:wc(B,!0,kt.dragHandleProps)})})},B.id)),a.jsx("button",{type:"button",onClick:()=>ro(),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(bi,{size:14})}),C.placeholder]})})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[!da&&wn.running>0&&a.jsx("span",{className:"hidden items-center gap-1 sm:inline-flex",children:a.jsx(R6,{count:wn.running,tone:"running",title:e("agent.aiRunning")})}),!da&&Rt.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 ${Nr+1} of ${Rt.length}`,children:mn}),!Ol&&a.jsx("button",{type:"button",onClick:Hi,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(qx,{size:14})})]})]}),Pl&&ca&&ps?.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:Yo||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:!Rs?.error&&(Rs?.status==="submitting"||Rs?.status==="waiting")?a.jsx(cn,{size:14,className:"animate-spin"}):a.jsx(Jl,{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:ps.agent?.displayName??"Agent"})}),a.jsx("div",{className:`truncate text-[10px] sm:text-[11px] ${Rs?.error?"text-destructive":"text-muted-foreground"}`,children:Rs?.error??(Rs?.status==="submitting"?e("tab.resumeAgentSubmitting"):Rs?.status==="waiting"?e("tab.resumeAgentWaiting"):e("tab.resumeAgentRecoveredHint"))})]}),a.jsx("button",{type:"button",disabled:!Rs?.error&&(Rs?.status==="submitting"||Rs?.status==="waiting"),onClick:()=>{Un(ca.id,ps.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:Rs?.error?e("common.retry"):e("tab.resumeAgentNow")}),a.jsx("button",{type:"button",onClick:()=>{Vr.getState().setAgentResumeRecovered(ca.id,!1),In(C=>C?.sessionId===ca.id?null:C)},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(gs,{size:13})})]}),a.jsx("div",{ref:Sr,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(qk,{terminalSettings:Nt,colorTheme:p,toolbarPresets:Wn,showDebug:u&&At,terminalFocusAvailable:Q,defaultSessionMode:$s,defaultTmuxSessionName:yo,connectionPrioritySessionId:j,connectionPriorityReady:Ne,desktopRightSidebarEnabled:At,onToggleRightSidebar:Hi,desktopFloatingTitle:At,desktopPinnedLeftSidebarWidth:da?qr:0,desktopViewportWidth:nn,onSessionDataUpdate:Du,onInitialViewportReady:Ph,onInitialRecoveryRequired:jh})})})]})}),a.jsx(hQ,{reviewCount:wn.review,runningSessions:Vn,activeSessionId:It,runningButtonEnabled:gt,attentionButtonEnabled:nr,isDesktopLayout:At,containerElement:Gr,occlusionInsets:{right:Yo}}),ut&&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:oa,"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(oA,{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:oa,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(gs,{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:()=>qt({fontSize:Math.max(8,Se-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:Se,onChange:C=>qt({fontSize:parseInt(C.target.value,10)}),className:"min-w-0 flex-1","aria-label":e("settings.font")}),a.jsx("button",{type:"button",onClick:()=>qt({fontSize:Math.min(32,Se+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:[Se,"px"]})]}),a.jsx(hP,{}),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(C=>{const B=Ce===C;return a.jsx("button",{type:"button",onClick:()=>qt({rendererMode:C}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${B?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:e(C==="auto"?"settings.auto":C==="webgl"?"settings.webgl":"settings.canvas")},C)})})]})}),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",Tw,e("settings.darkTheme")],["light",hA,e("settings.lightTheme")]].map(([C,B,ee])=>{const Ye=p===C;return a.jsxs("button",{type:"button",onClick:()=>g(C),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition ${Ye?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:[a.jsx(B,{size:12}),a.jsx("span",{children:ee})]},C)})})]})}),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(C=>{const B=$s===C,ee=C==="tmux"&&!ar.available;return a.jsx("button",{type:"button",disabled:ee,onClick:()=>We(C,{userInitiated:!0}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${B?"bg-primary/20 text-primary":ee?"cursor-not-allowed text-muted-foreground/40":"text-muted-foreground hover:bg-surface-elevated"}`,title:ee?ar.reason||e("settings.installTmuxHint"):void 0,children:e(C==="shell"?"settings.shell":"settings.tmux")},C)})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>h(!u),className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${u?"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(Po,{checked:u,size:"sm"})]}),a.jsxs("button",{type:"button",onClick:async()=>{const C=!b;w(C);try{const B=await ra({preventSleep:C});w(B.preventSleep),k(B.networkAvailable),ve(B.localAccess),Bn(V0,{preventSleep:B.preventSleep,networkAvailable:B.networkAvailable,localAccess:B.localAccess})}catch{w(!C)}},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(Po,{checked:b,size:"sm"})]})]})]}),a.jsxs("button",{type:"button",onClick:()=>Rr(!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($x,{size:14,className:I?"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(I?R&&O?"settings.notificationsBothOnSummary":R?"settings.notificationsAiOnSummary":O?"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(I?"common.on":"common.off")}),a.jsx("span",{children:"›"})]})]}),a.jsxs("button",{type:"button",onClick:()=>Fr(!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(Xc,{size:16,className:"shrink-0 text-muted-foreground"})]}),a.jsx(oP,{state:qe,pending:te,onCheck:()=>{Yt()},onConfirmRestart:()=>{Pr()},desktopState:Ae?nt:void 0,desktopPending:X,onCheckDesktop:Ae?()=>{Xn()}:void 0,onInstallDesktop:()=>{dn()},desktopSnapshot:z,desktopActions:Ke?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-3",children:[a.jsxs("button",{type:"button",onClick:()=>{Ke.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(S9,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopSwitchService")]}),a.jsxs("button",{type:"button",onClick:()=>{be(null),Ke.installCli().then(C=>{Oe(C),be(e("settings.desktopCliUpdated"))}).catch(C=>be(C instanceof Error?C.message:String(C)))},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(Ga,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopInstallCli")]}),a.jsxs("button",{type:"button",onClick:()=>{be(null),Ke.revealDataDirectory().catch(C=>be(C instanceof Error?C.message:String(C)))},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(Vc,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopOpenDataDirectory")]})]}),st&&a.jsx("div",{className:"border-t border-border/10 px-3 py-2 text-[10px] text-muted-foreground",children:st})]}):void 0}),a.jsx(cP,{state:ge,onDismiss:()=>{as()}}),a.jsxs("div",{className:"mt-3 flex gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>{$t(null),ro({mode:"shell"}),oa()},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${vc?"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(et==="shell"?"sidebar.confirmNewShell":"settings.shell"),children:[a.jsx(bi,{size:14,className:vc?"shrink-0":"hidden"}),a.jsx(Ga,{size:12}),a.jsx("span",{className:vc?"whitespace-nowrap":"hidden",children:e(et==="shell"?"sidebar.confirmNewShell":"settings.shell")})]}),a.jsxs("button",{type:"button",disabled:!ar.available,onClick:()=>{ar.available&&($t(null),ro({mode:"tmux"}),oa())},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${ar.available?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":"flex-1 bg-surface-2/50 text-muted-foreground/50 cursor-not-allowed"}`,title:ar.available?e(et==="tmux"?"sidebar.confirmNewTmux":"settings.tmux"):ar.reason||e("settings.installTmuxHint"),children:[a.jsx(bi,{size:14,className:f0?"shrink-0":"hidden"}),a.jsx(e0,{size:12}),a.jsx("span",{className:f0?"whitespace-nowrap":"hidden",children:e(et==="tmux"?"sidebar.confirmNewTmux":"settings.tmux")})]})]}),(ar.available||Cn.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 ${ar.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:ar.available?e("settings.sessions",{n:Cn.length}):e("settings.tmuxUnavailable")})]}),a.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),qo()},disabled:yr,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(xs,{size:12,className:yr?"animate-spin":""})})]}),a.jsx("div",{className:"px-2 pb-2",children:ar.available?Cn.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:[Uh.map(C=>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(lc,{size:11,className:"shrink-0 text-muted-foreground/70"}),a.jsx("span",{className:"shrink-0 font-medium text-foreground/75",children:C.label}),a.jsx("span",{className:"shrink-0 text-muted-foreground/70",children:e("settings.sessions",{n:C.sessions.length})}),C.key&&a.jsx("span",{className:"min-w-0 truncate text-muted-foreground/60",children:C.key})]}),C.sessions.map(B=>{const ee=B.boundFrontendSessionId??null,Ye=!!(B.connected||ee),kt=ee?Rt.find(ui=>ui.id===ee)??null:null,Ot=B.friendlyName?.trim()||null,mr=B.label&&B.label!==B.name?B.label:null,an=Ot||mr||B.name,gn=Ot||mr?`tmux:${B.name}`:null,en=B.clientCount&&B.clientCount>0?t==="zh"?`网页连接 ${B.clientCount}`:`Web clients ${B.clientCount}`:null,Bs=B.attached>0?t==="zh"?`原生 tmux ${B.attached}`:`Native tmux ${B.attached}`:null,xn=[gn,Ye?B.restorable?e("settings.restorable"):e("settings.attached"):null,en,Bs].filter(ui=>!!ui),As=[e("settings.windows",{n:B.windows}),B.createdAt?new Date(B.createdAt).toLocaleDateString():null].filter(ui=>!!ui),qi=Cr===B.name,Ea=Ln===B.name,Yi=es===B.name;return a.jsxs("div",{className:`flex items-start gap-2 rounded-lg px-2.5 py-2 ${qi?"bg-destructive/10 ring-1 ring-destructive/40":"bg-surface"}`,children:[a.jsx(e0,{size:13,className:Ye?"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:an}),B.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"})]}),xn.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:xn.map(ui=>a.jsx("span",{className:"max-w-full truncate",children:ui},ui))}),(B.program||B.cwd)&&a.jsxs("div",{className:"grid min-w-0 gap-0.5 text-[10px] text-muted-foreground",children:[B.program&&a.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[a.jsx(lw,{size:10,className:"shrink-0 text-muted-foreground/70"}),a.jsx("span",{className:"truncate text-foreground/75",children:B.program})]}),B.cwd&&a.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[a.jsx(lc,{size:10,className:"shrink-0 text-muted-foreground/70"}),a.jsx("span",{className:"truncate",children:B.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:As.map(ui=>a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx($9,{size:10,className:"shrink-0 text-muted-foreground/60"}),ui]},ui))})]}),qi?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",disabled:Ea,onClick:()=>{Oh(B.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:Ea?"…":e("settings.destroy")}),a.jsx("button",{type:"button",disabled:Ea,onClick:()=>{ds(null),Jn(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:()=>{kt?Ao(kt.id):(ur(B.name),ro({mode:"tmux",tmuxSessionName:B.name}))},disabled:Yi,className:`shrink-0 inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition disabled:opacity-50 ${Ye?"bg-surface text-foreground hover:bg-surface-elevated":Yi?"bg-primary/10 text-primary":"bg-primary/15 text-primary hover:bg-primary/25"}`,children:Yi?a.jsxs(a.Fragment,{children:[a.jsx(cn,{size:10,className:"animate-spin"}),e("settings.attaching")]}):e(Ye?"settings.attached":"settings.attach")}),a.jsx("button",{type:"button",disabled:Ea,onClick:()=>{Jn(null),ds(B.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 ${B.name}`,children:a.jsx(yi,{size:12})})]})]},B.name)})]},C.key||"__ungrouped_tmux__")),zr&&a.jsx("p",{className:"px-2 text-[11px] text-destructive",children:zr})]}):a.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:ar.reason||e("settings.installTmuxHint")})})]}),a.jsxs("button",{type:"button",onClick:()=>St(!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(Wx,{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:Wn.length})}),a.jsx("span",{children:"›"})]})]}),a.jsxs("button",{type:"button",onClick:()=>to(!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(yh,{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(C=>{const B=t===C.code;return a.jsx("button",{type:"button",onClick:()=>r(C.code),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${B?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:C.label},C.code)})})]}),a.jsxs("button",{type:"button",onClick:async()=>{try{await G8()}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(Kx,{size:14}),e("settings.signOut")]})]})]})})]}),no&&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:()=>{ae(null),Qe(null),Jn(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 ${le&&At?"":"inset-x-3 bottom-6 mx-auto max-w-sm sm:bottom-auto sm:top-[15%]"}`,style:le&&At?{...Tx(le),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:Fh}),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:()=>{xc({sessionId:no.id,source:"sidebar",closeMode:"destroy"}),ae(null),Qe(null)},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(yi,{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")})]})]}),zr&&a.jsx("p",{className:"px-4 py-2 text-[11px] text-destructive",children:zr})]}),a.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:a.jsx("button",{type:"button",onClick:()=>{ae(null),Qe(null),Jn(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")})})]})]}),Ms&&(()=>{const C=Rt.find(en=>en.id===Ms);if(!C)return null;const B=hr.get(C.id),{primary:ee}=Do(C,B?.activeProgram??null,B?.cwd??null,ta),Ye=At,kt=Ye?Tx($):{paddingBottom:i},Ot=Ye?"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%]",mr=Ye?"border-b border-border/15 px-3 py-2":"border-b border-border/15 px-4 py-3",an=Ye?"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",gn=Ye?"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 ${Ye?"bg-transparent":"bg-[var(--app-backdrop-soft)] backdrop-blur-sm"}`,onClick:Dr,"aria-label":"Close menu"}),a.jsxs("div",{className:Ot,style:kt,children:[a.jsxs("div",{className:mr,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:ee}),B?.cwd&&a.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/80",children:B.cwd})]}),a.jsxs("div",{className:"flex flex-col py-1",children:[a.jsxs("button",{type:"button",onClick:()=>{const en=$;Dr(),Me(en),on(C.id)},className:`${an} text-foreground hover:bg-surface-2`,children:[a.jsx("span",{className:`${gn} bg-primary/15 text-primary`,children:a.jsx(Qw,{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:!B?.cwd,onClick:()=>{Qh(C.id),Dr()},className:`${an} ${B?.cwd?"text-foreground hover:bg-surface-2":"text-muted-foreground/50 cursor-not-allowed"}`,children:[a.jsx("span",{className:`${gn} bg-surface-2 text-muted-foreground`,children:a.jsx(Gx,{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")})]}),ht&&ht===B?.cwd&&a.jsx("span",{className:"ml-auto text-[11px] text-primary",children:e("tab.copied")})]}),(()=>{const en=gp(C.id),Bs=en??Se;return a.jsxs("div",{className:`${an} text-foreground`,children:[a.jsx("span",{className:`${gn} bg-surface-2 text-muted-foreground`,children:a.jsx(mA,{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:()=>{Nd(C.id,Bs-1),De(xn=>xn+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:[Bs,"px"]}),a.jsx("button",{type:"button",onClick:()=>{Nd(C.id,Bs+1),De(xn=>xn+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:"+"}),en!==null&&a.jsx("button",{type:"button",onClick:()=>{Nd(C.id,null),De(xn=>xn+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")})]})]})})(),B?.agentNativeSessionId&&B.agentStatus!=="working"&&B.agentStatus!=="waiting"&&B.terminalSessionId&&a.jsxs("button",{type:"button",onClick:()=>{const en=B.terminalSessionId;en&&(Dr(),Un(C.id,en))},className:`${an} text-foreground hover:bg-surface-2`,children:[a.jsx("span",{className:`${gn} bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)]`,children:a.jsx(Jl,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"block font-medium",children:[e("tab.resumeAgent"),B.agent?.displayName?` · ${B.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"}),C.mode==="tmux"?a.jsxs("button",{type:"button",onClick:()=>{Dr(),pl(C.id)},className:`${an} text-destructive hover:bg-destructive/10`,children:[a.jsx("span",{className:`${gn} bg-destructive/15 text-destructive`,children:a.jsx(yi,{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:()=>{Dr(),xc({sessionId:C.id,source:"tab-menu",closeMode:"auto"})},className:`${an} text-destructive hover:bg-destructive/10`,children:[a.jsx("span",{className:`${gn} bg-destructive/15 text-destructive`,children:a.jsx(gs,{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")})]})]}),!Ye&&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:()=>{Dr()},children:e("tab.longPressTip")})]}),!Ye&&a.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:a.jsx("button",{type:"button",onClick:Dr,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")})})]})]})})(),Hr&&Ee&&At&&(()=>{const C=Rt.find(xn=>xn.id===Hr);if(!C)return null;const B=hr.get(C.id),{primary:ee}=Do(C,B?.activeProgram??null,B?.cwd??null,ta,B?.shellTitle??null,B?.promptState??null),Ye=C.customName?C.name:ee,kt=xn=>{const As=xn.trim();As?As!==Ye&&Gi(C.id,As):Vi(C.id),on(null),Me(null)},Ot=300,mr=160,an=Ee.x,gn=Ee.y,en=Math.min(Math.max(an-Ot/2,12),window.innerWidth-Ot-12),Bs=gn+mr+20>window.innerHeight?Math.max(gn-mr-12,12):gn+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:()=>{on(null),Me(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:`${en}px`,top:`${Bs}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:ee}),B?.cwd&&a.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/70",children:B.cwd})]}),a.jsxs("form",{className:"px-3 py-2.5",onSubmit:xn=>{xn.preventDefault();const As=new FormData(xn.currentTarget).get("session-name");kt(typeof As=="string"?As:"")},children:[a.jsx("input",{ref:xn=>{Mt.current=xn,xn&&!Ut.current&&(Ut.current=!0,xn.focus({preventScroll:!0}),xn.select())},type:"text",name:"session-name",defaultValue:Ye,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:xn=>{xn.key==="Escape"&&(xn.stopPropagation(),on(null),Me(null))}}),a.jsxs("div",{className:"mt-2.5 flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{on(null),Me(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")})]})]})]})]})})(),Hr&&!At&&(()=>{const C=Rt.find(Ot=>Ot.id===Hr);if(!C)return null;const B=hr.get(C.id),{primary:ee}=Do(C,B?.activeProgram??null,B?.cwd??null,ta,B?.shellTitle??null,B?.promptState??null),Ye=C.customName?C.name:ee,kt=Ot=>{const mr=Ot.trim();mr?mr!==Ye&&Gi(C.id,mr):Vi(C.id),on(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:()=>on(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:Ot=>{Ot.preventDefault();const mr=new FormData(Ot.currentTarget).get("session-name");kt(typeof mr=="string"?mr:"")},children:[a.jsx("input",{ref:Ot=>{Mt.current=Ot,Ot&&!Ut.current&&(Ut.current=!0,Ot.focus({preventScroll:!0}),Ot.select())},type:"text",name:"session-name",defaultValue:Ye,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:Ot=>{Ot.key==="Escape"&&(Ot.stopPropagation(),on(null))}}),a.jsxs("div",{className:"mt-3 flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>on(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")})]})]})]})]})})(),Er&&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:()=>Fr(!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:()=>Fr(!1),className:"rounded-full bg-surface-2 p-2 text-muted-foreground",children:a.jsx(gs,{size:18})})]}),a.jsxs("div",{className:"overflow-y-auto overscroll-contain p-4",children:[a.jsx(NA,{state:Je,onCopy:C=>{Ja(C,"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:_e,onChange:C=>Ze(C.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:Ve,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(Ve?"settings.saving":"common.save")}),a.jsx("button",{type:"button",disabled:Ve,onClick:()=>{Xa()},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:[Je.url&&a.jsxs("button",{type:"button",onClick:()=>{Ja(Je.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: ",Je.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")})]}),Je.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:Je.interfaces.map(C=>{const B=C.url??`${Je.httpsEnabled?"https":"http"}://${C.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:[C.label," (",C.name,")"]}),a.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:C.address}),C.qrDataUrl&&a.jsx("div",{className:"mt-2 inline-block rounded-lg bg-[var(--background)] p-1.5",children:a.jsx("img",{src:C.qrDataUrl,alt:`QR code for ${B}`,className:"h-28 w-28"})}),a.jsxs("button",{type:"button",onClick:()=>{Ja(B,`ip-${C.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:B}),a.jsx("span",{className:"shrink-0 text-[10px]",children:Ie===`ip-${C.address}`?"Copied":e("common.copy")})]})]},`${C.name}-${C.address}`)})})]}),a.jsxs("div",{className:"text-muted-foreground",children:[Je.httpsEnabled?e("settings.httpsActive"):e("settings.httpsInactive"),!Je.caAvailable&&` · ${e("settings.caMissing")}`]}),Je.reason&&a.jsx("div",{className:"text-[color:var(--warning)]",children:Je.reason}),ke&&a.jsx("div",{className:"text-destructive",children:ke})]})]})]})]}),vn&&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:()=>Rr(!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:()=>Rr(!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(gs,{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:V==="denied"?e("settings.notificationsDenied"):Ju()?e("settings.notificationsMasterHint"):e("settings.notificationsUnsupported")}),Ju()&&!V8()&&a.jsx("div",{className:"mt-1.5 text-[11px] leading-relaxed text-[var(--warning)]",children:e("settings.notificationsIOSInstallHint")})]}),a.jsx("button",{type:"button",onClick:()=>{dt()},disabled:!Ju()||V==="denied",className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":I,children:a.jsx(Po,{checked:I,disabled:!Ju()||V==="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 ${V==="granted"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:[e("settings.notificationsPermission"),": ",fo()?e("settings.notificationsPermissionSystem"):V]}),a.jsx("button",{type:"button",disabled:!I||V!=="granted"||pn==="checking",onClick:()=>{Pt()},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(pn==="checking"?"settings.notificationsTestChecking":"settings.notificationsTest")}),fo()?.openNotificationSettings&&a.jsx("button",{type:"button",onClick:()=>{fo()?.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")})]}),pn!=="idle"&&pn!=="checking"&&a.jsx("div",{className:`mt-2 text-[11px] leading-relaxed ${pn==="delivered"?"text-primary":"text-[var(--warning)]"}`,children:e(pn==="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(([C,B,ee])=>{const Ye=Y===C;return a.jsxs("button",{type:"button",disabled:!I,onClick:()=>Mn(C),className:`min-w-0 rounded-lg px-2 py-2 text-left transition ${Ye&&I?"bg-primary/15 text-primary":I?"text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"cursor-not-allowed text-muted-foreground/40"}`,title:ee,children:[a.jsx("span",{className:"block truncate text-[11px] font-semibold",children:B}),a.jsx("span",{className:"mt-0.5 block truncate text-[9px] opacity-80",children:ee})]},C)})})]}),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:!I,onClick:()=>vr(!R),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":R&&I,children:a.jsx(Po,{checked:R&&I,disabled:!I})})]}),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:!I,onClick:()=>sn(!O),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":O&&I,children:a.jsx(Po,{checked:O&&I,disabled:!I})})]})]}),a.jsx("p",{className:"mt-2 text-[10px] text-muted-foreground",children:e("settings.notificationsFutureHint")})]})]})]})]}),Fe&&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:()=>St(!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:()=>St(!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(gs,{size:18})})]}),a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:a.jsx(sP,{presets:Wn,selectedPresetId:la,onSelectPreset:zo,onUpdatePreset:(C,B)=>{fs(ee=>Hc(ee.map(Ye=>Ye.id===C?B(Ye):Ye)))},onAddPreset:()=>{const C=`preset-${Date.now()}`;fs(B=>Hc([...B,{id:C,label:`Preset ${B.length}`,programs:[],includeAlt:!1,rowLayout:[3,3],actions:[],showOnDesktop:!1}])),zo(C)},onRemovePreset:C=>{fs(B=>Hc(B.filter(ee=>ee.id!==C)))},onResetDefaults:()=>{fs(gu()),zo("default")}})})]})]}),Ho&&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:()=>to(!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:()=>to(!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(gs,{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(aP,{}),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:Rt.map(C=>{const B=hr.get(C.id),ee=B?.activeProgramRaw??null,Ye=B?.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:C.name}),a.jsxs("div",{className:"mt-0.5 text-[11px] text-foreground",children:[a.jsx("span",{className:"text-muted-foreground",children:"display:"})," ",Ye||"—"]}),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:"})," ",ee||"—"]})]},`raw-${C.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:C,label:B,hint:ee})=>a.jsxs("div",{children:[a.jsx("div",{className:"mb-0.5 text-[11px] font-medium text-foreground",children:B}),a.jsx("div",{className:"text-[10px] text-muted-foreground",children:ee}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[W[C].map(Ye=>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:[Ye,a.jsx("button",{type:"button",onClick:()=>{const kt={...W,[C]:W[C].filter(Ot=>Ot!==Ye)};Ue(kt),C==="shellNames"&&(ta=new Set(kt.shellNames)),Nm(kt).catch(()=>{})},className:"ml-0.5 text-muted-foreground hover:text-destructive",children:"×"})]},Ye)),a.jsx("input",{placeholder:e("settings.addTag"),className:"w-16 rounded bg-surface px-1.5 py-0.5 text-[11px] font-mono",onKeyDown:Ye=>{if(Ye.key!=="Enter")return;const kt=Ye.target.value.trim().toLowerCase();if(!kt||W[C].includes(kt))return;const Ot={...W,[C]:[...W[C],kt]};Ue(Ot),C==="shellNames"&&(ta=new Set(Ot.shellNames)),Ye.target.value="",Nm(Ot).catch(()=>{})}})]})]},C)),a.jsx("button",{type:"button",onClick:()=>{q8().then(C=>{Ue(C),ta=new Set(C.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")}),Gn.map((C,B)=>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:C.enabled!==!1,onChange:ee=>{const Ye=Gn.map((kt,Ot)=>Ot===B?{...kt,enabled:ee.target.checked}:kt);ci(Ye),Bn(ea,Ye),L(!0),Lc(Ye).then(kt=>{ci(kt),Bn(ea,kt)}).catch(()=>{}).finally(()=>L(!1))}}),a.jsxs("select",{value:C.matchType,onChange:ee=>{const Ye=Gn.map((kt,Ot)=>Ot===B?{...kt,matchType:ee.target.value}:kt);ci(Ye),Bn(ea,Ye),L(!0),Lc(Ye).then(kt=>{ci(kt),Bn(ea,kt)}).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:C.pattern,onChange:ee=>{const Ye=Gn.map((kt,Ot)=>Ot===B?{...kt,pattern:ee.target.value}:kt);ci(Ye),Bn(ea,Ye)},onBlur:()=>{L(!0),Lc(Gn).then(ee=>{ci(ee),Bn(ea,ee)}).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:C.output,onChange:ee=>{const Ye=Gn.map((kt,Ot)=>Ot===B?{...kt,output:ee.target.value}:kt);ci(Ye),Bn(ea,Ye)},onBlur:()=>{L(!0),Lc(Gn).then(ee=>{ci(ee),Bn(ea,ee)}).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 ee=Gn.filter((Ye,kt)=>kt!==B);ci(ee),Bn(ea,ee),L(!0),Lc(ee).then(Ye=>{ci(Ye),Bn(ea,Ye)}).catch(()=>{}).finally(()=>L(!1))},className:"rounded bg-surface px-2 py-1 text-[11px] text-muted-foreground hover:text-destructive",children:e("common.delete")})]})},C.id)),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{const C=[...Gn,{id:`rule-${Date.now()}`,enabled:!0,priority:100,matchType:"includes",pattern:"",output:""}];ci(C),Bn(ea,C),L(!0),Lc(C).then(B=>{ci(B),Bn(ea,B)}).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),Y8().then(C=>{ci(C),Bn(ea,C)}).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:mc?e("settings.saving"):Vo?`${Gn.length} rules`:"…"})]})]})]})]})]})]}),Wo&&a.jsx(Xj,{isOpen:Wo,onClose:()=>Go(!1)}),!da&&a.jsx(q5,{isOpen:kr,drawerWidthPx:Fo,onClose:()=>ts("left-sidebar"),onOpen:Ta,sessions:Rt,activeSessionId:It,sessionStates:hr,onNewSession:C=>ro(C),recoverableTmuxSessions:Pu,recoverableTmuxSessionsLoading:yr,onRefreshRecoverableTmuxSessions:()=>{qo()},onCloseSession:pl,onSplitSession:Bu,onCloseSplit:C=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:C})),onRemoveFromSplit:C=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:C})),splitWorkspaces:$r,onSetSplitLayout:Qu,onReorderSplitWorkspace:ju,onRenameSplitWorkspace:bc,onCombineSplitSessions:h0,onReorderSessions:eo,onSessionMenu:hl,onOpenSettings:aa,onJumpToNextAttention:ua.length>0?Ds:void 0,onOpenQuota:()=>Go(!0),updateState:qe,updateActionPending:te,onConfirmUpdateRestart:Pr,onRetryUpdate:Yt,serverHealthState:ge,tmuxAvailable:ar.available,defaultSessionMode:$s,runningSessionButtonEnabled:gt,onRunningSessionButtonEnabledChange:at,attentionButtonEnabled:nr,onAttentionButtonEnabledChange:er,onTogglePinned:At?go:void 0}),!Ol&&a.jsx(Y5,{isOpen:Or,sessionId:It,drawerWidthPx:Fs,onClose:()=>ts("right-sidebar"),onOpen:Ca,rightSidebarFilePreviewOpen:Is,rightSidebarFilePreviewCloseSignal:$e,onOpenRightSidebarFilePreview:Sa,onCloseRightSidebarFilePreview:_a,rightSidebarRepoPickerOpen:Tt,rightSidebarRepoPickerCloseSignal:rr,onOpenRightSidebarRepoPicker:dl,onCloseRightSidebarRepoPicker:La,markdownOutlineOpen:yt,markdownOutlineCloseSignal:_t,onOpenMarkdownOutline:bo,onCloseMarkdownOutline:Ti,markdownImageLightboxOpen:Et,markdownImageLightboxCloseSignal:ne,onOpenMarkdownImageLightbox:oi,onCloseMarkdownImageLightbox:ka,onTogglePinned:At?Ya:void 0}),je&&!l&&a.jsx("button",{type:"button",onClick:vs,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"})]})}),Br&&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 ${Br.tone==="success"?"border-[rgb(var(--success-rgb)_/_0.24)] bg-surface-elevated text-foreground":"border-destructive/30 bg-surface-elevated text-destructive"}`,role:Br.tone==="error"?"alert":"status",children:[Br.tone==="success"?a.jsx(Jl,{size:14,className:"shrink-0 text-[color:var(--success)]"}):a.jsx(Vd,{size:14,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1",children:Br.message}),a.jsx("button",{type:"button",onClick:()=>ie(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(gs,{size:12})})]}),u&&a.jsxs(a.Fragment,{children:[!At&&a.jsx(MA,{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(jt,null,2)})]})]})]}),p0=is?null:a.jsx(X8,{className:"z-modal-panel"});return At?a.jsxs("div",{className:"w-screen h-full flex flex-row",children:[da&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{width:qr,flexShrink:0,height:"100%"},children:a.jsx(q5,{isOpen:kr,drawerWidthPx:qr,onClose:Ii,onOpen:Ta,sessions:Rt,activeSessionId:It,sessionStates:hr,onNewSession:C=>ro(C),recoverableTmuxSessions:Pu,recoverableTmuxSessionsLoading:yr,onRefreshRecoverableTmuxSessions:()=>{qo()},onCloseSession:pl,onSplitSession:Bu,onCloseSplit:C=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:C})),onRemoveFromSplit:C=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:C})),splitWorkspaces:$r,onSetSplitLayout:Qu,onReorderSplitWorkspace:ju,onRenameSplitWorkspace:bc,onCombineSplitSessions:h0,onReorderSessions:eo,onSessionMenu:hl,onOpenSettings:aa,onJumpToNextAttention:ua.length>0?Ds:void 0,onOpenQuota:()=>Go(!0),updateState:qe,updateActionPending:te,onConfirmUpdateRestart:Pr,onRetryUpdate:Yt,serverHealthState:ge,tmuxAvailable:ar.available,defaultSessionMode:$s,runningSessionButtonEnabled:gt,onRunningSessionButtonEnabledChange:at,attentionButtonEnabled:nr,onAttentionButtonEnabledChange:er,pinned:!0,onTogglePinned:go})}),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:Vs})]}),a.jsxs("div",{className:"relative flex-1 min-w-0 h-full overflow-hidden",children:[$u,Ol&&a.jsxs("div",{className:"absolute inset-y-0 right-0 z-20 flex",style:{width:Yo},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:xo}),a.jsx("div",{style:{width:ml,flexShrink:0,height:"100%"},children:a.jsx(Y5,{isOpen:!0,sessionId:It,drawerWidthPx:ml,onClose:Za,onOpen:Ca,pinned:!0,onTogglePinned:Ya,rightSidebarFilePreviewOpen:Is,rightSidebarFilePreviewCloseSignal:$e,onOpenRightSidebarFilePreview:Sa,onCloseRightSidebarFilePreview:_a,rightSidebarRepoPickerOpen:Tt,rightSidebarRepoPickerCloseSignal:rr,onOpenRightSidebarRepoPicker:dl,onCloseRightSidebarRepoPicker:La,markdownOutlineOpen:yt,markdownOutlineCloseSignal:_t,onOpenMarkdownOutline:bo,onCloseMarkdownOutline:Ti,markdownImageLightboxOpen:Et,markdownImageLightboxCloseSignal:ne,onOpenMarkdownImageLightbox:oi,onCloseMarkdownImageLightbox:ka})})]})]}),a.jsx(ux,{sessionId:It}),p0]}):a.jsxs(a.Fragment,{children:[$u,a.jsx(ux,{sessionId:It}),p0]})}const yO=Object.freeze(Object.defineProperty({__proto__:null,default:EP},Symbol.toStringTag,{value:"Module"}));export{nu as A,ax as B,XQ as C,uu as D,Ak as E,LQ as F,JQ as G,dw as H,xO as I,Z5 as J,up as K,Gx as L,gw as M,bO as N,rj as O,Dw as P,r3 as Q,xs as R,fu as S,Y_ as T,TA as V,zj as a,yO as b,b9 as c,g9 as d,Ux as e,cu as f,V9 as g,u1 as h,yw as i,Tw as j,Qw as k,Pw as l,du as m,hu as n,Bm as o,Yx as p,Yw as q,Jw as r,k6 as s,oA as t,hA as u,yi as v,K3 as w,gO as x,c2 as y,X3 as z};
|