termdock 1.4.174 → 1.4.176
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.desktop-dist/main.js +154 -7
- package/dist/client/assets/App-BXYZyI_k.js +150 -0
- package/dist/client/assets/App-BXYZyI_k.js.br +0 -0
- package/dist/client/assets/App-BXYZyI_k.js.gz +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-DeVtCf73.js +2 -0
- package/dist/client/assets/ChangeWalkthroughPanel-DeVtCf73.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-DeVtCf73.js.gz +0 -0
- package/dist/client/assets/DagPlayground-ZIqLZoMo.js +1 -0
- package/dist/client/assets/DagPlayground-ZIqLZoMo.js.br +0 -0
- package/dist/client/assets/DagPlayground-ZIqLZoMo.js.gz +0 -0
- package/dist/client/assets/{DiffLab-CdbPsjKS.js → DiffLab-CSMf8So2.js} +2 -2
- package/dist/client/assets/DiffLab-CSMf8So2.js.br +0 -0
- package/dist/client/assets/DiffLab-CSMf8So2.js.gz +0 -0
- package/dist/client/assets/DiffReview-CE5lW1zQ.js +1 -0
- package/dist/client/assets/DiffReview-CE5lW1zQ.js.br +0 -0
- package/dist/client/assets/DiffReview-CE5lW1zQ.js.gz +0 -0
- package/dist/client/assets/DiffReviewLab-CpUW75fZ.js +2 -0
- package/dist/client/assets/DiffReviewLab-CpUW75fZ.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-CpUW75fZ.js.gz +0 -0
- package/dist/client/assets/{DiffViewer-hdxcM9yF.js → DiffViewer-BomvZ4kq.js} +5 -5
- package/dist/client/assets/DiffViewer-BomvZ4kq.js.br +0 -0
- package/dist/client/assets/DiffViewer-BomvZ4kq.js.gz +0 -0
- package/dist/client/assets/{ModelPreview-BZ454pgM.js → ModelPreview-BWdZFyhh.js} +3 -3
- package/dist/client/assets/ModelPreview-BWdZFyhh.js.br +0 -0
- package/dist/client/assets/ModelPreview-BWdZFyhh.js.gz +0 -0
- package/dist/client/assets/RightSidebar-CYVwFbOc.js +79 -0
- package/dist/client/assets/RightSidebar-CYVwFbOc.js.br +0 -0
- package/dist/client/assets/RightSidebar-CYVwFbOc.js.gz +0 -0
- package/dist/client/assets/{abnfDiagram-VCTEODGH-C185Omck.js → abnfDiagram-VCTEODGH-BIPsLStE.js} +1 -1
- package/dist/client/assets/abnfDiagram-VCTEODGH-BIPsLStE.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-BIPsLStE.js.gz +0 -0
- package/dist/client/assets/app-D6KzR8B3.js +34 -0
- package/dist/client/assets/app-D6KzR8B3.js.br +0 -0
- package/dist/client/assets/app-D6KzR8B3.js.gz +0 -0
- package/dist/client/assets/{arc-DNt-DTCl.js → arc-DzeT6hBj.js} +1 -1
- package/dist/client/assets/arc-DzeT6hBj.js.br +0 -0
- package/dist/client/assets/arc-DzeT6hBj.js.gz +0 -0
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-C5Nwm_Qz.js → architectureDiagram-5GKGNRK7-B1qsxd_5.js} +1 -1
- package/dist/client/assets/architectureDiagram-5GKGNRK7-B1qsxd_5.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-B1qsxd_5.js.gz +0 -0
- package/dist/client/assets/{blockDiagram-I7D4REHJ-C5aR_7V9.js → blockDiagram-I7D4REHJ-NLsa29Jp.js} +1 -1
- package/dist/client/assets/blockDiagram-I7D4REHJ-NLsa29Jp.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-NLsa29Jp.js.gz +0 -0
- package/dist/client/assets/{c4Diagram-7LVT6UL2-DjV6ZNwd.js → c4Diagram-7LVT6UL2-DBAUvou3.js} +1 -1
- package/dist/client/assets/c4Diagram-7LVT6UL2-DBAUvou3.js.br +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-DBAUvou3.js.gz +0 -0
- package/dist/client/assets/channel-BhwBAWhq.js +1 -0
- package/dist/client/assets/{chunk-2Q5K7J3B-Ct7nd4cL.js → chunk-2Q5K7J3B-BsVAXGLa.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-CXem4UYP.js → chunk-5VM5RSS4-BKtILsst.js} +1 -1
- package/dist/client/assets/{chunk-F27PBJKO-DyMNEawE.js → chunk-F27PBJKO-Dn9zcQZG.js} +1 -1
- package/dist/client/assets/chunk-F27PBJKO-Dn9zcQZG.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-Dn9zcQZG.js.gz +0 -0
- package/dist/client/assets/{chunk-IMKFNOWR-BsW7iIrh.js → chunk-IMKFNOWR-MVtVQeTr.js} +1 -1
- package/dist/client/assets/chunk-IMKFNOWR-MVtVQeTr.js.br +0 -0
- package/dist/client/assets/{chunk-IMKFNOWR-BsW7iIrh.js.gz → chunk-IMKFNOWR-MVtVQeTr.js.gz} +0 -0
- package/dist/client/assets/{chunk-JWPE2WC7-EO8E1q1J.js → chunk-JWPE2WC7-DliIIMe7.js} +1 -1
- package/dist/client/assets/{chunk-POPQ4Y6H-0One8T9x.js → chunk-POPQ4Y6H-XBSus3IC.js} +1 -1
- package/dist/client/assets/{chunk-SVP7TREG-CDu41dkj.js → chunk-SVP7TREG-wleSQcJR.js} +1 -1
- package/dist/client/assets/chunk-SVP7TREG-wleSQcJR.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-wleSQcJR.js.gz +0 -0
- package/dist/client/assets/{chunk-TICWLB2K-BACjgX9v.js → chunk-TICWLB2K-Dq6LdswN.js} +1 -1
- package/dist/client/assets/chunk-TICWLB2K-Dq6LdswN.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-Dq6LdswN.js.gz +0 -0
- package/dist/client/assets/{chunk-XXDRQBXY-BJWowF6E.js → chunk-XXDRQBXY-xafyKlM-.js} +1 -1
- package/dist/client/assets/classDiagram-ZZMXUADV-slQB0ns2.js +1 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-slQB0ns2.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-WTwHOCdm.js → cose-bilkent-JH36ORCC-BR7Ohnm_.js} +1 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-BR7Ohnm_.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-BR7Ohnm_.js.gz +0 -0
- package/dist/client/assets/{cynefin-OW5HDTMX-D4y8TkaO.js → cynefin-OW5HDTMX-CmPjQgER.js} +1 -1
- package/dist/client/assets/cynefin-OW5HDTMX-CmPjQgER.js.br +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-CmPjQgER.js.gz +0 -0
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-BzN8Ggk_.js → cynefinDiagram-5FMLGOSQ-CFyR9RvM.js} +1 -1
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-CFyR9RvM.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-CFyR9RvM.js.gz +0 -0
- package/dist/client/assets/{dagre-GXQ25YYZ-CwMYtt5E.js → dagre-GXQ25YYZ-D_RVMRO1.js} +1 -1
- package/dist/client/assets/dagre-GXQ25YYZ-D_RVMRO1.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-D_RVMRO1.js.gz +0 -0
- package/dist/client/assets/{diagram-S7CK7UJ4-BnTeHiAb.js → diagram-S7CK7UJ4-6fr-ZoPj.js} +1 -1
- package/dist/client/assets/diagram-S7CK7UJ4-6fr-ZoPj.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-6fr-ZoPj.js.gz +0 -0
- package/dist/client/assets/{diagram-UQ7AKVKN-BNlh251g.js → diagram-UQ7AKVKN-CgwiUtz0.js} +1 -1
- package/dist/client/assets/diagram-UQ7AKVKN-CgwiUtz0.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-CgwiUtz0.js.gz +0 -0
- package/dist/client/assets/{diagram-VSXAHHWV-B5FftXkQ.js → diagram-VSXAHHWV-CLxzTB9k.js} +1 -1
- package/dist/client/assets/diagram-VSXAHHWV-CLxzTB9k.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-CLxzTB9k.js.gz +0 -0
- package/dist/client/assets/{diagram-VX7I27RA-C51ZNXR2.js → diagram-VX7I27RA-DjxDAvdZ.js} +1 -1
- package/dist/client/assets/diagram-VX7I27RA-DjxDAvdZ.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-DjxDAvdZ.js.gz +0 -0
- package/dist/client/assets/{diagram-Z3DM3KII-CXoZH2qf.js → diagram-Z3DM3KII-CDPOjiz4.js} +1 -1
- package/dist/client/assets/diagram-Z3DM3KII-CDPOjiz4.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-CDPOjiz4.js.gz +0 -0
- package/dist/client/assets/{ebnfDiagram-PWID7BFC-C7YFLlx4.js → ebnfDiagram-PWID7BFC-BLbwyF1O.js} +1 -1
- package/dist/client/assets/ebnfDiagram-PWID7BFC-BLbwyF1O.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-BLbwyF1O.js.gz +0 -0
- package/dist/client/assets/{erDiagram-RLTQ6QDP-BNQlS7-g.js → erDiagram-RLTQ6QDP-DbjtZnJx.js} +1 -1
- package/dist/client/assets/erDiagram-RLTQ6QDP-DbjtZnJx.js.br +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-DbjtZnJx.js.gz +0 -0
- package/dist/client/assets/{flowDiagram-HODETNUW-DIQXZ06I.js → flowDiagram-HODETNUW-BirJInAN.js} +1 -1
- package/dist/client/assets/flowDiagram-HODETNUW-BirJInAN.js.br +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-BirJInAN.js.gz +0 -0
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-BaJQfOqD.js → ganttDiagram-EL5Y4UJY-d6Q9vSbv.js} +1 -1
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-d6Q9vSbv.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-d6Q9vSbv.js.gz +0 -0
- package/dist/client/assets/gestureArbiter-C2J0D0kV.css +1 -0
- package/dist/client/assets/gestureArbiter-C2J0D0kV.css.br +0 -0
- package/dist/client/assets/gestureArbiter-C2J0D0kV.css.gz +0 -0
- package/dist/client/assets/gestureArbiter-D1SNS_gK.js +1 -0
- package/dist/client/assets/gestureArbiter-D1SNS_gK.js.br +0 -0
- package/dist/client/assets/gestureArbiter-D1SNS_gK.js.gz +0 -0
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-tQ4E6pwN.js → gitGraphDiagram-WWUBYQGX-BWBoIeS6.js} +1 -1
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BWBoIeS6.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BWBoIeS6.js.gz +0 -0
- package/dist/client/assets/{index-DlxiaPv1.css → index-DUI8KRf6.css} +1 -1
- package/dist/client/assets/index-DUI8KRf6.css.br +0 -0
- package/dist/client/assets/index-DUI8KRf6.css.gz +0 -0
- package/dist/client/assets/{infoDiagram-27XIBGKW-DTOUeQrN.js → infoDiagram-27XIBGKW-BH4AynkM.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-8sBi-gla.js → ishikawaDiagram-5VMMS53U-BQw90AKR.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-8sBi-gla.js.br → ishikawaDiagram-5VMMS53U-BQw90AKR.js.br} +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-BQw90AKR.js.gz +0 -0
- package/dist/client/assets/{journeyDiagram-3NMN7TZE-ZwikziWh.js → journeyDiagram-3NMN7TZE-DISkQocf.js} +1 -1
- package/dist/client/assets/journeyDiagram-3NMN7TZE-DISkQocf.js.br +0 -0
- package/dist/client/assets/{journeyDiagram-3NMN7TZE-ZwikziWh.js.gz → journeyDiagram-3NMN7TZE-DISkQocf.js.gz} +0 -0
- package/dist/client/assets/{kanban-definition-UXKFOSKX-wjuw2jQ4.js → kanban-definition-UXKFOSKX-Qg2LyEVy.js} +1 -1
- package/dist/client/assets/kanban-definition-UXKFOSKX-Qg2LyEVy.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-Qg2LyEVy.js.gz +0 -0
- package/dist/client/assets/{layout-nASMIj-E.js → layout-Cd7-4_Vr.js} +1 -1
- package/dist/client/assets/layout-Cd7-4_Vr.js.br +0 -0
- package/dist/client/assets/layout-Cd7-4_Vr.js.gz +0 -0
- package/dist/client/assets/{linear-pGaQeqW5.js → linear-DFTi2fTn.js} +1 -1
- package/dist/client/assets/linear-DFTi2fTn.js.br +0 -0
- package/dist/client/assets/linear-DFTi2fTn.js.gz +0 -0
- package/dist/client/assets/{mermaid.core-CKEBWbQz.js → mermaid.core-2v726lUU.js} +5 -5
- package/dist/client/assets/mermaid.core-2v726lUU.js.br +0 -0
- package/dist/client/assets/mermaid.core-2v726lUU.js.gz +0 -0
- package/dist/client/assets/{mindmap-definition-YA3MSWOX-CBjYcnwd.js → mindmap-definition-YA3MSWOX-_FpwteCy.js} +4 -4
- package/dist/client/assets/mindmap-definition-YA3MSWOX-_FpwteCy.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-_FpwteCy.js.gz +0 -0
- package/dist/client/assets/passwordBootstrap-D9Ffc7NY.js +2 -0
- package/dist/client/assets/passwordBootstrap-D9Ffc7NY.js.br +0 -0
- package/dist/client/assets/passwordBootstrap-D9Ffc7NY.js.gz +0 -0
- package/dist/client/assets/{pegDiagram-XKGWAZYB-DJqvclIp.js → pegDiagram-XKGWAZYB-DLFf-HmZ.js} +1 -1
- package/dist/client/assets/pegDiagram-XKGWAZYB-DLFf-HmZ.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-DLFf-HmZ.js.gz +0 -0
- package/dist/client/assets/{pieDiagram-E7YTZNPT-DLV4WPwc.js → pieDiagram-E7YTZNPT-DqTnfXHG.js} +1 -1
- package/dist/client/assets/pieDiagram-E7YTZNPT-DqTnfXHG.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-DqTnfXHG.js.gz +0 -0
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-BN7Zpsb9.js → quadrantDiagram-AXDQQJYC-B_oBH52Q.js} +1 -1
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-B_oBH52Q.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-B_oBH52Q.js.gz +0 -0
- package/dist/client/assets/{railroadDiagram-O6MQD6OU-DfHX6MUm.js → railroadDiagram-O6MQD6OU-HxFQ7Pce.js} +1 -1
- package/dist/client/assets/railroadDiagram-O6MQD6OU-HxFQ7Pce.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-HxFQ7Pce.js.gz +0 -0
- package/dist/client/assets/referenceLongPress-B3NGIjvv.js +1 -0
- package/dist/client/assets/referenceLongPress-B3NGIjvv.js.br +0 -0
- package/dist/client/assets/referenceLongPress-B3NGIjvv.js.gz +0 -0
- package/dist/client/assets/{requirementDiagram-BXWQKSXE-tQVSFg_k.js → requirementDiagram-BXWQKSXE-NZdfaZFk.js} +1 -1
- package/dist/client/assets/requirementDiagram-BXWQKSXE-NZdfaZFk.js.br +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-NZdfaZFk.js.gz +0 -0
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-C7JW1-Wh.js → sankeyDiagram-P5KCCOFB-BgCctv6X.js} +1 -1
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-BgCctv6X.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-BgCctv6X.js.gz +0 -0
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-BVeDiFDI.js → sequenceDiagram-WJ2MYXX4-Br42Za1R.js} +1 -1
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-Br42Za1R.js.br +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-Br42Za1R.js.gz +0 -0
- package/dist/client/assets/{sizeCapture-INFHLROL-CBRaCpeP.js → sizeCapture-INFHLROL-FT4z4S1b.js} +1 -1
- package/dist/client/assets/sizeCapture-INFHLROL-FT4z4S1b.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-FT4z4S1b.js.gz +0 -0
- package/dist/client/assets/sparkles-BaGaevME.js +1 -0
- package/dist/client/assets/{stateDiagram-D77RDMKH-CiLpGRuf.js → stateDiagram-D77RDMKH-DD0t9f84.js} +1 -1
- package/dist/client/assets/stateDiagram-D77RDMKH-DD0t9f84.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-DD0t9f84.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-BhvVVB56.js +1 -0
- package/dist/client/assets/{swimlanes-42K2YHIH-BkzVtkVY.js → swimlanes-42K2YHIH-DcC8pGLx.js} +1 -1
- package/dist/client/assets/swimlanes-42K2YHIH-DcC8pGLx.js.br +0 -0
- package/dist/client/assets/swimlanes-42K2YHIH-DcC8pGLx.js.gz +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-DSC5lz0i.js +8 -0
- package/dist/client/assets/{timeline-definition-24CTP7MA-DKyfGITP.js → timeline-definition-24CTP7MA-DnwO_Pxd.js} +1 -1
- package/dist/client/assets/timeline-definition-24CTP7MA-DnwO_Pxd.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-DnwO_Pxd.js.gz +0 -0
- package/dist/client/assets/triangle-alert-BCQO9Ap9.js +1 -0
- package/dist/client/assets/{vennDiagram-4TSXK5OY-CRgkkrgx.js → vennDiagram-4TSXK5OY-IVNSrZDM.js} +1 -1
- package/dist/client/assets/vennDiagram-4TSXK5OY-IVNSrZDM.js.br +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-IVNSrZDM.js.gz +0 -0
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-Cr7yS4CZ.js → wardleyDiagram-VM6X3IG4-BnGetaQL.js} +1 -1
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-BnGetaQL.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-BnGetaQL.js.gz +0 -0
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-DkPYl6E0.js → xychartDiagram-S5SC5T6Z-C01eBN-W.js} +1 -1
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-C01eBN-W.js.br +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-C01eBN-W.js.gz +0 -0
- package/dist/client/index.html +2 -2
- package/dist/client/index.html.br +0 -0
- package/dist/client/index.html.gz +0 -0
- package/dist/client/preview-shell.html +1 -0
- package/dist/client/preview-shell.js +20 -0
- package/dist/client/preview-shell.js.br +0 -0
- package/dist/client/preview-shell.js.gz +0 -0
- package/dist/client/sw-secure-api.js +132 -0
- package/dist/client/sw-secure-api.js.br +0 -0
- package/dist/client/sw-secure-api.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/agent/collaborationCli.js +298 -0
- package/dist/server/agent/collaborationPrompt.js +10 -2
- package/dist/server/agent/collaborationProtocol.js +50 -0
- package/dist/server/agent/collaborationRoutes.js +86 -0
- package/dist/server/agent/collaborationStore.js +249 -21
- package/dist/server/cli.js +28 -168
- package/dist/server/entry.js +114 -51
- package/dist/server/federation/accessPolicy.js +122 -0
- package/dist/server/federation/authorization.js +226 -0
- package/dist/server/federation/bootstrapCors.js +23 -0
- package/dist/server/federation/cli.js +185 -0
- package/dist/server/federation/deviceNames.js +29 -0
- package/dist/server/federation/directRoutes.js +72 -0
- package/dist/server/federation/invitations.js +123 -0
- package/dist/server/federation/openAccess.js +25 -0
- package/dist/server/federation/originPolicy.js +19 -0
- package/dist/server/federation/packets.js +116 -0
- package/dist/server/federation/passwordBootstrap.js +86 -0
- package/dist/server/federation/passwordLoginRoutes.js +98 -0
- package/dist/server/federation/relay.js +346 -0
- package/dist/server/federation/requestContext.js +4 -0
- package/dist/server/federation/routeAccess.js +124 -0
- package/dist/server/federation/routeInvitations.js +160 -0
- package/dist/server/federation/runtime.js +537 -0
- package/dist/server/federation/secureProtocol.js +223 -0
- package/dist/server/federation/socketDuplex.js +42 -0
- package/dist/server/federation/streamLimits.js +5 -0
- package/dist/server/routes/filesystem.js +2 -1
- package/dist/server/routes/terminal.js +40 -72
- package/dist/server/utils/authProtection.js +13 -0
- package/dist/server/utils/csrfProtection.js +3 -0
- package/dist/server/utils/publicSecurity.js +8 -3
- package/package.json +10 -3
- package/runtime-manifest.json +4 -4
- package/dist/client/assets/ChangeWalkthroughPanel-hj8I8Cwy.js +0 -2
- package/dist/client/assets/ChangeWalkthroughPanel-hj8I8Cwy.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-hj8I8Cwy.js.gz +0 -0
- package/dist/client/assets/DagPlayground-BRoB8JX5.js +0 -1
- package/dist/client/assets/DagPlayground-BRoB8JX5.js.br +0 -0
- package/dist/client/assets/DagPlayground-BRoB8JX5.js.gz +0 -0
- package/dist/client/assets/DiffLab-CdbPsjKS.js.br +0 -0
- package/dist/client/assets/DiffLab-CdbPsjKS.js.gz +0 -0
- package/dist/client/assets/DiffReview-MQXjrRsW.js +0 -1
- package/dist/client/assets/DiffReview-MQXjrRsW.js.br +0 -0
- package/dist/client/assets/DiffReview-MQXjrRsW.js.gz +0 -0
- package/dist/client/assets/DiffReviewLab-C47CNvDM.js +0 -2
- package/dist/client/assets/DiffReviewLab-C47CNvDM.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-C47CNvDM.js.gz +0 -0
- package/dist/client/assets/DiffViewer-hdxcM9yF.js.br +0 -0
- package/dist/client/assets/DiffViewer-hdxcM9yF.js.gz +0 -0
- package/dist/client/assets/ModelPreview-BZ454pgM.js.br +0 -0
- package/dist/client/assets/ModelPreview-BZ454pgM.js.gz +0 -0
- package/dist/client/assets/RightSidebar-i0Oq68YI.js +0 -55
- package/dist/client/assets/RightSidebar-i0Oq68YI.js.br +0 -0
- package/dist/client/assets/RightSidebar-i0Oq68YI.js.gz +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-C185Omck.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-C185Omck.js.gz +0 -0
- package/dist/client/assets/app-DAp8rVMc.js +0 -175
- package/dist/client/assets/app-DAp8rVMc.js.br +0 -0
- package/dist/client/assets/app-DAp8rVMc.js.gz +0 -0
- package/dist/client/assets/arc-DNt-DTCl.js.br +0 -0
- package/dist/client/assets/arc-DNt-DTCl.js.gz +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-C5Nwm_Qz.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-C5Nwm_Qz.js.gz +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-C5aR_7V9.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-C5aR_7V9.js.gz +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-DjV6ZNwd.js.br +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-DjV6ZNwd.js.gz +0 -0
- package/dist/client/assets/channel-uhLrATdy.js +0 -1
- package/dist/client/assets/chunk-F27PBJKO-DyMNEawE.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-DyMNEawE.js.gz +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-BsW7iIrh.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-CDu41dkj.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-CDu41dkj.js.gz +0 -0
- package/dist/client/assets/chunk-TICWLB2K-BACjgX9v.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-BACjgX9v.js.gz +0 -0
- package/dist/client/assets/classDiagram-ZZMXUADV-CnxFfzm9.js +0 -1
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-CnxFfzm9.js +0 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-WTwHOCdm.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-WTwHOCdm.js.gz +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-D4y8TkaO.js.br +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-D4y8TkaO.js.gz +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-BzN8Ggk_.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-BzN8Ggk_.js.gz +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-CwMYtt5E.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-CwMYtt5E.js.gz +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-BnTeHiAb.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-BnTeHiAb.js.gz +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-BNlh251g.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-BNlh251g.js.gz +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-B5FftXkQ.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-B5FftXkQ.js.gz +0 -0
- package/dist/client/assets/diagram-VX7I27RA-C51ZNXR2.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-C51ZNXR2.js.gz +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-CXoZH2qf.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-CXoZH2qf.js.gz +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-C7YFLlx4.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-C7YFLlx4.js.gz +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-BNQlS7-g.js.br +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-BNQlS7-g.js.gz +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-DIQXZ06I.js.br +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-DIQXZ06I.js.gz +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-BaJQfOqD.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-BaJQfOqD.js.gz +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-tQ4E6pwN.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-tQ4E6pwN.js.gz +0 -0
- package/dist/client/assets/index-DlxiaPv1.css.br +0 -0
- package/dist/client/assets/index-DlxiaPv1.css.gz +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-8sBi-gla.js.gz +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-ZwikziWh.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-wjuw2jQ4.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-wjuw2jQ4.js.gz +0 -0
- package/dist/client/assets/layout-nASMIj-E.js.br +0 -0
- package/dist/client/assets/layout-nASMIj-E.js.gz +0 -0
- package/dist/client/assets/linear-pGaQeqW5.js.br +0 -0
- package/dist/client/assets/linear-pGaQeqW5.js.gz +0 -0
- package/dist/client/assets/mermaid.core-CKEBWbQz.js.br +0 -0
- package/dist/client/assets/mermaid.core-CKEBWbQz.js.gz +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-CBjYcnwd.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-CBjYcnwd.js.gz +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-DJqvclIp.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-DJqvclIp.js.gz +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-DLV4WPwc.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-DLV4WPwc.js.gz +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-BN7Zpsb9.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-BN7Zpsb9.js.gz +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-DfHX6MUm.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-DfHX6MUm.js.gz +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-tQVSFg_k.js.br +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-tQVSFg_k.js.gz +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-C7JW1-Wh.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-C7JW1-Wh.js.gz +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-BVeDiFDI.js.br +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-BVeDiFDI.js.gz +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-CBRaCpeP.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-CBRaCpeP.js.gz +0 -0
- package/dist/client/assets/sparkles-D0cwIvB0.js +0 -1
- package/dist/client/assets/stateDiagram-D77RDMKH-CiLpGRuf.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-CiLpGRuf.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-BRbS0rv2.js +0 -1
- package/dist/client/assets/swimlanes-42K2YHIH-BkzVtkVY.js.br +0 -0
- package/dist/client/assets/swimlanes-42K2YHIH-BkzVtkVY.js.gz +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-CeWFezkt.js +0 -8
- package/dist/client/assets/timeline-definition-24CTP7MA-DKyfGITP.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-DKyfGITP.js.gz +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-CRgkkrgx.js.br +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-CRgkkrgx.js.gz +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-Cr7yS4CZ.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-Cr7yS4CZ.js.gz +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-DkPYl6E0.js.br +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-DkPYl6E0.js.gz +0 -0
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RightSidebar-i0Oq68YI.js","assets/dnd-BCFAPC0L.js","assets/react-XDCjal2T.js","assets/DiffReview-MQXjrRsW.js","assets/sparkles-D0cwIvB0.js","assets/DiffViewer-hdxcM9yF.js","assets/DiffViewer-T3uj2-aP.css","assets/ChangeWalkthroughPanel-hj8I8Cwy.js","assets/RightSidebar-DW-JEgm2.css","assets/DagPlayground-BRoB8JX5.js","assets/terminal-C7X98Amf.js","assets/DiffLab-CdbPsjKS.js","assets/DiffReviewLab-C47CNvDM.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as Oh,a as N8,g as yb}from"./react-XDCjal2T.js";import{b as S,R as _,r as ga,a as D8}from"./dnd-BCFAPC0L.js";import{L as B8,l as P8}from"./terminal-C7X98Amf.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const Q8="modulepreload",O8=function(e){return"/"+e},G1={},Fh=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let h=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),d=a?.nonce||a?.getAttribute("nonce");s=h(n.map(p=>{if(p=O8(p),p in G1)return;G1[p]=!0;const g=p.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${y}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":Q8,g||(b.as="script"),b.crossOrigin="",b.href=p,d&&b.setAttribute("nonce",d),document.head.appendChild(b),g)return new Promise((v,T)=>{b.addEventListener("load",v),b.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${p}`)))})}))}function o(a){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=a,window.dispatchEvent(d),!d.defaultPrevented)throw a}return s.then(a=>{for(const d of a||[])d.status==="rejected"&&o(d.reason);return t().catch(o)})};var kf={exports:{}},Du={};var W1;function F8(){if(W1)return Du;W1=1;var e=Oh(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function a(d,h,p){var g,y={},b=null,v=null;p!==void 0&&(b=""+p),h.key!==void 0&&(b=""+h.key),h.ref!==void 0&&(v=h.ref);for(g in h)r.call(h,g)&&!o.hasOwnProperty(g)&&(y[g]=h[g]);if(d&&d.defaultProps)for(g in h=d.defaultProps,h)y[g]===void 0&&(y[g]=h[g]);return{$$typeof:t,type:d,key:b,ref:v,props:y,_owner:s.current}}return Du.Fragment=n,Du.jsx=a,Du.jsxs=a,Du}var V1;function j8(){return V1||(V1=1,kf.exports=F8()),kf.exports}var u=j8(),fd={},q1;function $8(){if(q1)return fd;q1=1;var e=N8();return fd.createRoot=e.createRoot,fd.hydrateRoot=e.hydrateRoot,fd}var U8=$8();const H8=yb(U8);let rm=0,Y1=!1,Zc=0;function z8(){if(Y1||typeof window>"u")return;Y1=!0;const e=()=>{rm=performance.now()};window.addEventListener("pointerdown",()=>{Zc+=1,e()},{passive:!0,capture:!0});for(const t of["pointerup","pointercancel"])window.addEventListener(t,()=>{Zc=Math.max(0,Zc-1),e()},{passive:!0,capture:!0});for(const t of["pointermove","wheel","keydown"])window.addEventListener(t,e,{passive:!0,capture:!0});window.addEventListener("blur",()=>{Zc=0,e()})}function dg(e,t=500){z8();let n=!1,r,s;const o=()=>{if(n)return;if(Zc>0||performance.now()-rm<400){s=setTimeout(o,100);return}const a=()=>{if(!n){if(Zc>0||performance.now()-rm<400){s=setTimeout(o,100);return}e()}};"requestIdleCallback"in window?r=window.requestIdleCallback(a):s=setTimeout(a,16)};return s=setTimeout(o,t),()=>{n=!0,clearTimeout(s),r!==void 0&&window.cancelIdleCallback(r)}}function G8(e){const[t,n]=S.useState(e);return S.useEffect(()=>dg(()=>n(e),0),[e]),t}function Z1(e){return e!==null&&typeof e=="object"&&"constructor"in e&&e.constructor===Object}function hg(e={},t={}){const n=["__proto__","constructor","prototype"];Object.keys(t).filter(r=>n.indexOf(r)<0).forEach(r=>{typeof e[r]>"u"?e[r]=t[r]:Z1(t[r])&&Z1(e[r])&&Object.keys(t[r]).length>0&&hg(e[r],t[r])})}const bb={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector(){return null},querySelectorAll(){return[]},getElementById(){return null},createEvent(){return{initEvent(){}}},createElement(){return{children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName(){return[]}}},createElementNS(){return{}},importNode(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function xc(){const e=typeof document<"u"?document:{};return hg(e,bb),e}const W8={document:bb,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle(){return{getPropertyValue(){return""}}},Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia(){return{}},requestAnimationFrame(e){return typeof setTimeout>"u"?(e(),null):setTimeout(e,0)},cancelAnimationFrame(e){typeof setTimeout>"u"||clearTimeout(e)}};function Zi(){const e=typeof window<"u"?window:{};return hg(e,W8),e}function V8(e=""){return e.trim().split(" ").filter(t=>!!t.trim())}function q8(e){const t=e;Object.keys(t).forEach(n=>{try{t[n]=null}catch{}try{delete t[n]}catch{}})}function vb(e,t=0){return setTimeout(e,t)}function lh(){return Date.now()}function Y8(e){const t=Zi();let n;return t.getComputedStyle&&(n=t.getComputedStyle(e,null)),!n&&e.currentStyle&&(n=e.currentStyle),n||(n=e.style),n}function Z8(e,t="x"){const n=Zi();let r,s,o;const a=Y8(e);return n.WebKitCSSMatrix?(s=a.transform||a.webkitTransform,s.split(",").length>6&&(s=s.split(", ").map(d=>d.replace(",",".")).join(", ")),o=new n.WebKitCSSMatrix(s==="none"?"":s)):(o=a.MozTransform||a.OTransform||a.MsTransform||a.msTransform||a.transform||a.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),r=o.toString().split(",")),t==="x"&&(n.WebKitCSSMatrix?s=o.m41:r.length===16?s=parseFloat(r[12]):s=parseFloat(r[4])),t==="y"&&(n.WebKitCSSMatrix?s=o.m42:r.length===16?s=parseFloat(r[13]):s=parseFloat(r[5])),s||0}function pd(e){return typeof e=="object"&&e!==null&&e.constructor&&Object.prototype.toString.call(e).slice(8,-1)==="Object"}function K8(e){return typeof window<"u"&&typeof window.HTMLElement<"u"?e instanceof HTMLElement:e&&(e.nodeType===1||e.nodeType===11)}function Ao(...e){const t=Object(e[0]);for(let n=1;n<e.length;n+=1){const r=e[n];if(r!=null&&!K8(r)){const s=Object.keys(Object(r)).filter(o=>o!=="__proto__"&&o!=="constructor"&&o!=="prototype");for(let o=0,a=s.length;o<a;o+=1){const d=s[o],h=Object.getOwnPropertyDescriptor(r,d);h!==void 0&&h.enumerable&&(pd(t[d])&&pd(r[d])?r[d].__swiper__?t[d]=r[d]:Ao(t[d],r[d]):!pd(t[d])&&pd(r[d])?(t[d]={},r[d].__swiper__?t[d]=r[d]:Ao(t[d],r[d])):t[d]=r[d])}}}return t}function Rc(e,t,n){e.style.setProperty(t,n)}function wb({swiper:e,targetPosition:t,side:n}){const r=Zi(),s=-e.translate;let o=null,a;const d=e.params.speed;e.wrapperEl.style.scrollSnapType="none",r.cancelAnimationFrame(e.cssModeFrameID);const h=t>s?"next":"prev",p=(y,b)=>h==="next"&&y>=b||h==="prev"&&y<=b,g=()=>{a=new Date().getTime(),o===null&&(o=a);const y=Math.max(Math.min((a-o)/d,1),0),b=.5-Math.cos(y*Math.PI)/2;let v=s+b*(t-s);if(p(v,t)&&(v=t),e.wrapperEl.scrollTo({[n]:v}),p(v,t)){e.wrapperEl.style.overflow="hidden",e.wrapperEl.style.scrollSnapType="",setTimeout(()=>{e.wrapperEl.style.overflow="",e.wrapperEl.scrollTo({[n]:v})}),r.cancelAnimationFrame(e.cssModeFrameID);return}e.cssModeFrameID=r.requestAnimationFrame(g)};g()}function il(e,t=""){const n=Zi(),r=[...e.children];return n.HTMLSlotElement&&e instanceof HTMLSlotElement&&r.push(...e.assignedElements()),t?r.filter(s=>s.matches(t)):r}function X8(e,t){const n=[t];for(;n.length>0;){const r=n.shift();if(e===r)return!0;n.push(...r.children,...r.shadowRoot?r.shadowRoot.children:[],...r.assignedElements?r.assignedElements():[])}}function J8(e,t){const n=Zi();let r=t.contains(e);return!r&&n.HTMLSlotElement&&t instanceof HTMLSlotElement&&(r=[...t.assignedElements()].includes(e),r||(r=X8(e,t))),r}function ch(e){try{console.warn(e);return}catch{}}function sm(e,t=[]){const n=document.createElement(e);return n.classList.add(...Array.isArray(t)?t:V8(t)),n}function e9(e,t){const n=[];for(;e.previousElementSibling;){const r=e.previousElementSibling;t?r.matches(t)&&n.push(r):n.push(r),e=r}return n}function t9(e,t){const n=[];for(;e.nextElementSibling;){const r=e.nextElementSibling;t?r.matches(t)&&n.push(r):n.push(r),e=r}return n}function Bl(e,t){return Zi().getComputedStyle(e,null).getPropertyValue(t)}function K1(e){let t=e,n;if(t){for(n=0;(t=t.previousSibling)!==null;)t.nodeType===1&&(n+=1);return n}}function n9(e,t){const n=[];let r=e.parentElement;for(;r;)n.push(r),r=r.parentElement;return n}function X1(e,t,n){const r=Zi();return e[t==="width"?"offsetWidth":"offsetHeight"]+parseFloat(r.getComputedStyle(e,null).getPropertyValue(t==="width"?"margin-right":"margin-top"))+parseFloat(r.getComputedStyle(e,null).getPropertyValue(t==="width"?"margin-left":"margin-bottom"))}function J1(e,t=""){typeof trustedTypes<"u"?e.innerHTML=trustedTypes.createPolicy("html",{createHTML:n=>n}).createHTML(t):e.innerHTML=t}let Ef;function r9(){const e=Zi(),t=xc();return{smoothScroll:t.documentElement&&t.documentElement.style&&"scrollBehavior"in t.documentElement.style,touch:!!("ontouchstart"in e||e.DocumentTouch&&t instanceof e.DocumentTouch)}}function Ab(){return Ef||(Ef=r9()),Ef}let If;function s9({userAgent:e}={}){const t=Ab(),n=Zi(),r=n.navigator.platform,s=e||n.navigator.userAgent,o={ios:!1,android:!1},a=n.screen.width,d=n.screen.height,h=s.match(/(Android);?[\s\/]+([\d.]+)?/);let p=s.match(/(iPad)(?!\1).*OS\s([\d_]+)/);const g=s.match(/(iPod)(.*OS\s([\d_]+))?/),y=!p&&s.match(/(iPhone\sOS|iOS)\s([\d_]+)/),b=r==="Win32";let v=r==="MacIntel";const T=["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"];return!p&&v&&t.touch&&T.indexOf(`${a}x${d}`)>=0&&(p=s.match(/(Version)\/([\d.]+)/),p||(p=[0,1,"13_0_0"]),v=!1),h&&!b&&(o.os="android",o.android=!0),(p||y||g)&&(o.os="ios",o.ios=!0),o}function Tb(e={}){return If||(If=s9(e)),If}let Rf;function i9(){const e=Zi(),t=Tb();let n=!1;function r(){const d=e.navigator.userAgent.toLowerCase();return d.indexOf("safari")>=0&&d.indexOf("chrome")<0&&d.indexOf("android")<0}if(r()){const d=String(e.navigator.userAgent);if(d.includes("Version/")){const[h,p]=d.split("Version/")[1].split(" ")[0].split(".").map(g=>Number(g));n=h<16||h===16&&p<2}}const s=/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(e.navigator.userAgent),o=r(),a=o||s&&t.ios;return{isSafari:n||o,needPerspectiveFix:n,need3dFix:a,isWebView:s}}function Sb(){return Rf||(Rf=i9()),Rf}function o9({swiper:e,on:t,emit:n}){const r=Zi();let s=null,o=null;const a=()=>{!e||e.destroyed||!e.initialized||(n("beforeResize"),n("resize"))},d=()=>{!e||e.destroyed||!e.initialized||(s=new ResizeObserver(g=>{o=r.requestAnimationFrame(()=>{const{width:y,height:b}=e;let v=y,T=b;g.forEach(({contentBoxSize:A,contentRect:L,target:R})=>{R&&R!==e.el||(v=L?L.width:(A[0]||A).inlineSize,T=L?L.height:(A[0]||A).blockSize)}),(v!==y||T!==b)&&a()})}),s.observe(e.el))},h=()=>{o&&r.cancelAnimationFrame(o),s&&s.unobserve&&e.el&&(s.unobserve(e.el),s=null)},p=()=>{!e||e.destroyed||!e.initialized||n("orientationchange")};t("init",()=>{if(e.params.resizeObserver&&typeof r.ResizeObserver<"u"){d();return}r.addEventListener("resize",a),r.addEventListener("orientationchange",p)}),t("destroy",()=>{h(),r.removeEventListener("resize",a),r.removeEventListener("orientationchange",p)})}function a9({swiper:e,extendParams:t,on:n,emit:r}){const s=[],o=Zi(),a=(p,g={})=>{const y=o.MutationObserver||o.WebkitMutationObserver,b=new y(v=>{if(e.__preventObserver__)return;if(v.length===1){r("observerUpdate",v[0]);return}const T=function(){r("observerUpdate",v[0])};o.requestAnimationFrame?o.requestAnimationFrame(T):o.setTimeout(T,0)});b.observe(p,{attributes:typeof g.attributes>"u"?!0:g.attributes,childList:e.isElement||(typeof g.childList>"u"?!0:g).childList,characterData:typeof g.characterData>"u"?!0:g.characterData}),s.push(b)},d=()=>{if(e.params.observer){if(e.params.observeParents){const p=n9(e.hostEl);for(let g=0;g<p.length;g+=1)a(p[g])}a(e.hostEl,{childList:e.params.observeSlideChildren}),a(e.wrapperEl,{attributes:!1})}},h=()=>{s.forEach(p=>{p.disconnect()}),s.splice(0,s.length)};t({observer:!1,observeParents:!1,observeSlideChildren:!1}),n("init",d),n("destroy",h)}var l9={on(e,t,n){const r=this;if(!r.eventsListeners||r.destroyed||typeof t!="function")return r;const s=n?"unshift":"push";return e.split(" ").forEach(o=>{r.eventsListeners[o]||(r.eventsListeners[o]=[]),r.eventsListeners[o][s](t)}),r},once(e,t,n){const r=this;if(!r.eventsListeners||r.destroyed||typeof t!="function")return r;function s(...o){r.off(e,s),s.__emitterProxy&&delete s.__emitterProxy,t.apply(r,o)}return s.__emitterProxy=t,r.on(e,s,n)},onAny(e,t){const n=this;if(!n.eventsListeners||n.destroyed||typeof e!="function")return n;const r=t?"unshift":"push";return n.eventsAnyListeners.indexOf(e)<0&&n.eventsAnyListeners[r](e),n},offAny(e){const t=this;if(!t.eventsListeners||t.destroyed||!t.eventsAnyListeners)return t;const n=t.eventsAnyListeners.indexOf(e);return n>=0&&t.eventsAnyListeners.splice(n,1),t},off(e,t){const n=this;return!n.eventsListeners||n.destroyed||!n.eventsListeners||e.split(" ").forEach(r=>{typeof t>"u"?n.eventsListeners[r]=[]:n.eventsListeners[r]&&n.eventsListeners[r].forEach((s,o)=>{(s===t||s.__emitterProxy&&s.__emitterProxy===t)&&n.eventsListeners[r].splice(o,1)})}),n},emit(...e){const t=this;if(!t.eventsListeners||t.destroyed||!t.eventsListeners)return t;let n,r,s;return typeof e[0]=="string"||Array.isArray(e[0])?(n=e[0],r=e.slice(1,e.length),s=t):(n=e[0].events,r=e[0].data,s=e[0].context||t),r.unshift(s),(Array.isArray(n)?n:n.split(" ")).forEach(a=>{t.eventsAnyListeners&&t.eventsAnyListeners.length&&t.eventsAnyListeners.forEach(d=>{d.apply(s,[a,...r])}),t.eventsListeners&&t.eventsListeners[a]&&t.eventsListeners[a].forEach(d=>{d.apply(s,r)})}),t}};function c9(){const e=this;let t,n;const r=e.el;typeof e.params.width<"u"&&e.params.width!==null?t=e.params.width:t=r.clientWidth,typeof e.params.height<"u"&&e.params.height!==null?n=e.params.height:n=r.clientHeight,!(t===0&&e.isHorizontal()||n===0&&e.isVertical())&&(t=t-parseInt(Bl(r,"padding-left")||0,10)-parseInt(Bl(r,"padding-right")||0,10),n=n-parseInt(Bl(r,"padding-top")||0,10)-parseInt(Bl(r,"padding-bottom")||0,10),Number.isNaN(t)&&(t=0),Number.isNaN(n)&&(n=0),Object.assign(e,{width:t,height:n,size:e.isHorizontal()?t:n}))}function u9(){const e=this;function t(q,te){return parseFloat(q.getPropertyValue(e.getDirectionLabel(te))||0)}const n=e.params,{wrapperEl:r,slidesEl:s,rtlTranslate:o,wrongRTL:a}=e,d=e.virtual&&n.virtual.enabled,h=d?e.virtual.slides.length:e.slides.length,p=il(s,`.${e.params.slideClass}, swiper-slide`),g=d?e.virtual.slides.length:p.length;let y=[];const b=[],v=[];let T=n.slidesOffsetBefore;typeof T=="function"&&(T=n.slidesOffsetBefore.call(e));let A=n.slidesOffsetAfter;typeof A=="function"&&(A=n.slidesOffsetAfter.call(e));const L=e.snapGrid.length,R=e.slidesGrid.length,D=e.size-T-A;let B=n.spaceBetween,j=-T,P=0,$=0;if(typeof D>"u")return;typeof B=="string"&&B.indexOf("%")>=0?B=parseFloat(B.replace("%",""))/100*D:typeof B=="string"&&(B=parseFloat(B)),e.virtualSize=-B-T-A,p.forEach(q=>{o?q.style.marginLeft="":q.style.marginRight="",q.style.marginBottom="",q.style.marginTop=""}),n.centeredSlides&&n.cssMode&&(Rc(r,"--swiper-centered-offset-before",""),Rc(r,"--swiper-centered-offset-after","")),n.cssMode&&(Rc(r,"--swiper-slides-offset-before",`${T}px`),Rc(r,"--swiper-slides-offset-after",`${A}px`));const z=n.grid&&n.grid.rows>1&&e.grid;z?e.grid.initSlides(p):e.grid&&e.grid.unsetSlides();let H;const ye=n.slidesPerView==="auto"&&n.breakpoints&&Object.keys(n.breakpoints).filter(q=>typeof n.breakpoints[q].slidesPerView<"u").length>0;for(let q=0;q<g;q+=1){H=0;const te=p[q];if(!(te&&(z&&e.grid.updateSlide(q,te,p),Bl(te,"display")==="none"))){if(d&&n.slidesPerView==="auto")n.virtual.slidesPerViewAutoSlideSize&&(H=n.virtual.slidesPerViewAutoSlideSize),H&&te&&(n.roundLengths&&(H=Math.floor(H)),te.style[e.getDirectionLabel("width")]=`${H}px`);else if(n.slidesPerView==="auto"){ye&&(te.style[e.getDirectionLabel("width")]="");const ve=getComputedStyle(te),ge=te.style.transform,ie=te.style.webkitTransform;if(ge&&(te.style.transform="none"),ie&&(te.style.webkitTransform="none"),n.roundLengths)H=e.isHorizontal()?X1(te,"width"):X1(te,"height");else{const Ae=t(ve,"width"),xe=t(ve,"padding-left"),ce=t(ve,"padding-right"),K=t(ve,"margin-left"),be=t(ve,"margin-right"),Se=ve.getPropertyValue("box-sizing");if(Se&&Se==="border-box")H=Ae+K+be;else{const{clientWidth:We,offsetWidth:ue}=te;H=Ae+xe+ce+K+be+(ue-We)}}ge&&(te.style.transform=ge),ie&&(te.style.webkitTransform=ie),n.roundLengths&&(H=Math.floor(H))}else H=(D-(n.slidesPerView-1)*B)/n.slidesPerView,n.roundLengths&&(H=Math.floor(H)),te&&(te.style[e.getDirectionLabel("width")]=`${H}px`);te&&(te.swiperSlideSize=H),v.push(H),n.centeredSlides?(j=j+H/2+P/2+B,P===0&&q!==0&&(j=j-D/2-B),q===0&&(j=j-D/2-B),Math.abs(j)<1/1e3&&(j=0),n.roundLengths&&(j=Math.floor(j)),$%n.slidesPerGroup===0&&y.push(j),b.push(j)):(n.roundLengths&&(j=Math.floor(j)),($-Math.min(e.params.slidesPerGroupSkip,$))%e.params.slidesPerGroup===0&&y.push(j),b.push(j),j=j+H+B),e.virtualSize+=H+B,P=H,$+=1}}if(e.virtualSize=Math.max(e.virtualSize,D)+A,o&&a&&(n.effect==="slide"||n.effect==="coverflow")&&(r.style.width=`${e.virtualSize+B}px`),n.setWrapperSize&&(r.style[e.getDirectionLabel("width")]=`${e.virtualSize+B}px`),z&&e.grid.updateWrapperSize(H,y),!n.centeredSlides){const q=n.slidesPerView!=="auto"&&n.slidesPerView%1!==0,te=n.snapToSlideEdge&&!n.loop&&(n.slidesPerView==="auto"||q);let ve=y.length;if(te){let ie;if(n.slidesPerView==="auto"){ie=1;let Ae=0;for(let xe=v.length-1;xe>=0&&(Ae+=v[xe]+(xe<v.length-1?B:0),Ae<=D);xe-=1)ie=v.length-xe}else ie=Math.floor(n.slidesPerView);ve=Math.max(g-ie,0)}const ge=[];for(let ie=0;ie<y.length;ie+=1){let Ae=y[ie];n.roundLengths&&(Ae=Math.floor(Ae)),te?ie<=ve&&ge.push(Ae):y[ie]<=e.virtualSize-D&&ge.push(Ae)}y=ge,Math.floor(e.virtualSize-D)-Math.floor(y[y.length-1])>1&&(te||y.push(e.virtualSize-D))}if(d&&n.loop){const q=v[0]+B;if(n.slidesPerGroup>1){const te=Math.ceil((e.virtual.slidesBefore+e.virtual.slidesAfter)/n.slidesPerGroup),ve=q*n.slidesPerGroup;for(let ge=0;ge<te;ge+=1)y.push(y[y.length-1]+ve)}for(let te=0;te<e.virtual.slidesBefore+e.virtual.slidesAfter;te+=1)n.slidesPerGroup===1&&y.push(y[y.length-1]+q),b.push(b[b.length-1]+q),e.virtualSize+=q}if(y.length===0&&(y=[0]),B!==0){const q=e.isHorizontal()&&o?"marginLeft":e.getDirectionLabel("marginRight");p.filter((te,ve)=>!n.cssMode||n.loop?!0:ve!==p.length-1).forEach(te=>{te.style[q]=`${B}px`})}if(n.centeredSlides&&n.centeredSlidesBounds){let q=0;v.forEach(ve=>{q+=ve+(B||0)}),q-=B;const te=q>D?q-D:0;y=y.map(ve=>ve<=0?-T:ve>te?te+A:ve)}if(n.centerInsufficientSlides){let q=0;if(v.forEach(te=>{q+=te+(B||0)}),q-=B,q<D){const te=(D-q)/2;y.forEach((ve,ge)=>{y[ge]=ve-te}),b.forEach((ve,ge)=>{b[ge]=ve+te})}}if(Object.assign(e,{slides:p,snapGrid:y,slidesGrid:b,slidesSizesGrid:v}),n.centeredSlides&&n.cssMode&&!n.centeredSlidesBounds){Rc(r,"--swiper-centered-offset-before",`${-y[0]}px`),Rc(r,"--swiper-centered-offset-after",`${e.size/2-v[v.length-1]/2}px`);const q=-e.snapGrid[0],te=-e.slidesGrid[0];e.snapGrid=e.snapGrid.map(ve=>ve+q),e.slidesGrid=e.slidesGrid.map(ve=>ve+te)}if(g!==h&&e.emit("slidesLengthChange"),y.length!==L&&(e.params.watchOverflow&&e.checkOverflow(),e.emit("snapGridLengthChange")),b.length!==R&&e.emit("slidesGridLengthChange"),n.watchSlidesProgress&&e.updateSlidesOffset(),e.emit("slidesUpdated"),!d&&!n.cssMode&&(n.effect==="slide"||n.effect==="fade")){const q=`${n.containerModifierClass}backface-hidden`,te=e.el.classList.contains(q);g<=n.maxBackfaceHiddenSlides?te||e.el.classList.add(q):te&&e.el.classList.remove(q)}}function d9(e){const t=this,n=[],r=t.virtual&&t.params.virtual.enabled;let s=0,o;typeof e=="number"?t.setTransition(e):e===!0&&t.setTransition(t.params.speed);const a=d=>r?t.slides[t.getSlideIndexByData(d)]:t.slides[d];if(t.params.slidesPerView!=="auto"&&t.params.slidesPerView>1)if(t.params.centeredSlides)(t.visibleSlides||[]).forEach(d=>{n.push(d)});else for(o=0;o<Math.ceil(t.params.slidesPerView);o+=1){const d=t.activeIndex+o;if(d>t.slides.length&&!r)break;n.push(a(d))}else n.push(a(t.activeIndex));for(o=0;o<n.length;o+=1)if(typeof n[o]<"u"){const d=n[o].offsetHeight;s=d>s?d:s}(s||s===0)&&(t.wrapperEl.style.height=`${s}px`)}function h9(){const e=this,t=e.slides,n=e.isElement?e.isHorizontal()?e.wrapperEl.offsetLeft:e.wrapperEl.offsetTop:0;for(let r=0;r<t.length;r+=1)t[r].swiperSlideOffset=(e.isHorizontal()?t[r].offsetLeft:t[r].offsetTop)-n-e.cssOverflowAdjustment()}const e2=(e,t,n)=>{t&&!e.classList.contains(n)?e.classList.add(n):!t&&e.classList.contains(n)&&e.classList.remove(n)};function f9(e=this&&this.translate||0){const t=this,n=t.params,{slides:r,rtlTranslate:s,snapGrid:o}=t;if(r.length===0)return;typeof r[0].swiperSlideOffset>"u"&&t.updateSlidesOffset();let a=-e;s&&(a=e),t.visibleSlidesIndexes=[],t.visibleSlides=[];let d=n.spaceBetween;typeof d=="string"&&d.indexOf("%")>=0?d=parseFloat(d.replace("%",""))/100*t.size:typeof d=="string"&&(d=parseFloat(d));for(let h=0;h<r.length;h+=1){const p=r[h];let g=p.swiperSlideOffset;n.cssMode&&n.centeredSlides&&(g-=r[0].swiperSlideOffset);const y=(a+(n.centeredSlides?t.minTranslate():0)-g)/(p.swiperSlideSize+d),b=(a-o[0]+(n.centeredSlides?t.minTranslate():0)-g)/(p.swiperSlideSize+d),v=-(a-g),T=v+t.slidesSizesGrid[h],A=v>=0&&v<=t.size-t.slidesSizesGrid[h],L=v>=0&&v<t.size-1||T>1&&T<=t.size||v<=0&&T>=t.size;L&&(t.visibleSlides.push(p),t.visibleSlidesIndexes.push(h)),e2(p,L,n.slideVisibleClass),e2(p,A,n.slideFullyVisibleClass),p.progress=s?-y:y,p.originalProgress=s?-b:b}}function p9(e){const t=this;if(typeof e>"u"){const g=t.rtlTranslate?-1:1;e=t&&t.translate&&t.translate*g||0}const n=t.params,r=t.maxTranslate()-t.minTranslate();let{progress:s,isBeginning:o,isEnd:a,progressLoop:d}=t;const h=o,p=a;if(r===0)s=0,o=!0,a=!0;else{s=(e-t.minTranslate())/r;const g=Math.abs(e-t.minTranslate())<1,y=Math.abs(e-t.maxTranslate())<1;o=g||s<=0,a=y||s>=1,g&&(s=0),y&&(s=1)}if(n.loop){const g=t.getSlideIndexByData(0),y=t.getSlideIndexByData(t.slides.length-1),b=t.slidesGrid[g],v=t.slidesGrid[y],T=t.slidesGrid[t.slidesGrid.length-1],A=Math.abs(e);A>=b?d=(A-b)/T:d=(A+T-v)/T,d>1&&(d-=1)}Object.assign(t,{progress:s,progressLoop:d,isBeginning:o,isEnd:a}),(n.watchSlidesProgress||n.centeredSlides&&n.autoHeight)&&t.updateSlidesProgress(e),o&&!h&&t.emit("reachBeginning toEdge"),a&&!p&&t.emit("reachEnd toEdge"),(h&&!o||p&&!a)&&t.emit("fromEdge"),t.emit("progress",s)}const Mf=(e,t,n)=>{t&&!e.classList.contains(n)?e.classList.add(n):!t&&e.classList.contains(n)&&e.classList.remove(n)};function m9(){const e=this,{slides:t,params:n,slidesEl:r,activeIndex:s}=e,o=e.virtual&&n.virtual.enabled,a=e.grid&&n.grid&&n.grid.rows>1,d=y=>il(r,`.${n.slideClass}${y}, swiper-slide${y}`)[0];let h,p,g;if(o)if(n.loop){let y=s-e.virtual.slidesBefore;y<0&&(y=e.virtual.slides.length+y),y>=e.virtual.slides.length&&(y-=e.virtual.slides.length),h=d(`[data-swiper-slide-index="${y}"]`)}else h=d(`[data-swiper-slide-index="${s}"]`);else a?(h=t.find(y=>y.column===s),g=t.find(y=>y.column===s+1),p=t.find(y=>y.column===s-1)):h=t[s];h&&(a||(g=t9(h,`.${n.slideClass}, swiper-slide`)[0],n.loop&&!g&&(g=t[0]),p=e9(h,`.${n.slideClass}, swiper-slide`)[0],n.loop&&!p===0&&(p=t[t.length-1]))),t.forEach(y=>{Mf(y,y===h,n.slideActiveClass),Mf(y,y===g,n.slideNextClass),Mf(y,y===p,n.slidePrevClass)}),e.emitSlidesClasses()}const zd=(e,t)=>{if(!e||e.destroyed||!e.params)return;const n=()=>e.isElement?"swiper-slide":`.${e.params.slideClass}`,r=t.closest(n());if(r){let s=r.querySelector(`.${e.params.lazyPreloaderClass}`);!s&&e.isElement&&(r.shadowRoot?s=r.shadowRoot.querySelector(`.${e.params.lazyPreloaderClass}`):requestAnimationFrame(()=>{r.shadowRoot&&(s=r.shadowRoot.querySelector(`.${e.params.lazyPreloaderClass}`),s&&!s.lazyPreloaderManaged&&s.remove())})),s&&!s.lazyPreloaderManaged&&s.remove()}},Nf=(e,t)=>{if(!e.slides[t])return;const n=e.slides[t].querySelector('[loading="lazy"]');n&&n.removeAttribute("loading")},im=e=>{if(!e||e.destroyed||!e.params)return;let t=e.params.lazyPreloadPrevNext;const n=e.slides.length;if(!n||!t||t<0)return;t=Math.min(t,n);const r=e.params.slidesPerView==="auto"?e.slidesPerViewDynamic():Math.ceil(e.params.slidesPerView),s=e.activeIndex;if(e.params.grid&&e.params.grid.rows>1){const a=s,d=[a-t];d.push(...Array.from({length:t}).map((h,p)=>a+r+p)),e.slides.forEach((h,p)=>{d.includes(h.column)&&Nf(e,p)});return}const o=s+r-1;if(e.params.rewind||e.params.loop)for(let a=s-t;a<=o+t;a+=1){const d=(a%n+n)%n;(d<s||d>o)&&Nf(e,d)}else for(let a=Math.max(s-t,0);a<=Math.min(o+t,n-1);a+=1)a!==s&&(a>o||a<s)&&Nf(e,a)};function g9(e){const{slidesGrid:t,params:n}=e,r=e.rtlTranslate?e.translate:-e.translate;let s;for(let o=0;o<t.length;o+=1)typeof t[o+1]<"u"?r>=t[o]&&r<t[o+1]-(t[o+1]-t[o])/2?s=o:r>=t[o]&&r<t[o+1]&&(s=o+1):r>=t[o]&&(s=o);return n.normalizeSlideIndex&&(s<0||typeof s>"u")&&(s=0),s}function x9(e){const t=this,n=t.rtlTranslate?t.translate:-t.translate,{snapGrid:r,params:s,activeIndex:o,realIndex:a,snapIndex:d}=t;let h=e,p;const g=v=>{let T=v-t.virtual.slidesBefore;return T<0&&(T=t.virtual.slides.length+T),T>=t.virtual.slides.length&&(T-=t.virtual.slides.length),T};if(typeof h>"u"&&(h=g9(t)),r.indexOf(n)>=0)p=r.indexOf(n);else{const v=Math.min(s.slidesPerGroupSkip,h);p=v+Math.floor((h-v)/s.slidesPerGroup)}if(p>=r.length&&(p=r.length-1),h===o&&!t.params.loop){p!==d&&(t.snapIndex=p,t.emit("snapIndexChange"));return}if(h===o&&t.params.loop&&t.virtual&&t.params.virtual.enabled){t.realIndex=g(h);return}const y=t.grid&&s.grid&&s.grid.rows>1;let b;if(t.virtual&&s.virtual.enabled)s.loop?b=g(h):b=h;else if(y){const v=t.slides.find(A=>A.column===h);let T=parseInt(v.getAttribute("data-swiper-slide-index"),10);Number.isNaN(T)&&(T=Math.max(t.slides.indexOf(v),0)),b=Math.floor(T/s.grid.rows)}else if(t.slides[h]){const v=t.slides[h].getAttribute("data-swiper-slide-index");v?b=parseInt(v,10):b=h}else b=h;Object.assign(t,{previousSnapIndex:d,snapIndex:p,previousRealIndex:a,realIndex:b,previousIndex:o,activeIndex:h}),t.initialized&&im(t),t.emit("activeIndexChange"),t.emit("snapIndexChange"),(t.initialized||t.params.runCallbacksOnInit)&&(a!==b&&t.emit("realIndexChange"),t.emit("slideChange"))}function y9(e,t){const n=this,r=n.params;let s=e.closest(`.${r.slideClass}, swiper-slide`);!s&&n.isElement&&t&&t.length>1&&t.includes(e)&&[...t.slice(t.indexOf(e)+1,t.length)].forEach(d=>{!s&&d.matches&&d.matches(`.${r.slideClass}, swiper-slide`)&&(s=d)});let o=!1,a;if(s){for(let d=0;d<n.slides.length;d+=1)if(n.slides[d]===s){o=!0,a=d;break}}if(s&&o)n.clickedSlide=s,n.virtual&&n.params.virtual.enabled?n.clickedIndex=parseInt(s.getAttribute("data-swiper-slide-index"),10):n.clickedIndex=a;else{n.clickedSlide=void 0,n.clickedIndex=void 0;return}r.slideToClickedSlide&&n.clickedIndex!==void 0&&n.clickedIndex!==n.activeIndex&&n.slideToClickedSlide()}var b9={updateSize:c9,updateSlides:u9,updateAutoHeight:d9,updateSlidesOffset:h9,updateSlidesProgress:f9,updateProgress:p9,updateSlidesClasses:m9,updateActiveIndex:x9,updateClickedSlide:y9};function v9(e=this.isHorizontal()?"x":"y"){const t=this,{params:n,rtlTranslate:r,translate:s,wrapperEl:o}=t;if(n.virtualTranslate)return r?-s:s;if(n.cssMode)return s;let a=Z8(o,e);return a+=t.cssOverflowAdjustment(),r&&(a=-a),a||0}function w9(e,t){const n=this,{rtlTranslate:r,params:s,wrapperEl:o,progress:a}=n;let d=0,h=0;const p=0;n.isHorizontal()?d=r?-e:e:h=e,s.roundLengths&&(d=Math.floor(d),h=Math.floor(h)),n.previousTranslate=n.translate,n.translate=n.isHorizontal()?d:h,s.cssMode?o[n.isHorizontal()?"scrollLeft":"scrollTop"]=n.isHorizontal()?-d:-h:s.virtualTranslate||(n.isHorizontal()?d-=n.cssOverflowAdjustment():h-=n.cssOverflowAdjustment(),o.style.transform=`translate3d(${d}px, ${h}px, ${p}px)`);let g;const y=n.maxTranslate()-n.minTranslate();y===0?g=0:g=(e-n.minTranslate())/y,g!==a&&n.updateProgress(e),n.emit("setTranslate",n.translate,t)}function A9(){return-this.snapGrid[0]}function T9(){return-this.snapGrid[this.snapGrid.length-1]}function S9(e=0,t=this.params.speed,n=!0,r=!0,s){const o=this,{params:a,wrapperEl:d}=o;if(o.animating&&a.preventInteractionOnTransition)return!1;const h=o.minTranslate(),p=o.maxTranslate();let g;if(r&&e>h?g=h:r&&e<p?g=p:g=e,o.updateProgress(g),a.cssMode){const y=o.isHorizontal();if(t===0)d[y?"scrollLeft":"scrollTop"]=-g;else{if(!o.support.smoothScroll)return wb({swiper:o,targetPosition:-g,side:y?"left":"top"}),!0;d.scrollTo({[y?"left":"top"]:-g,behavior:"smooth"})}return!0}return t===0?(o.setTransition(0),o.setTranslate(g),n&&(o.emit("beforeTransitionStart",t,s),o.emit("transitionEnd"))):(o.setTransition(t),o.setTranslate(g),n&&(o.emit("beforeTransitionStart",t,s),o.emit("transitionStart")),o.animating||(o.animating=!0,o.onTranslateToWrapperTransitionEnd||(o.onTranslateToWrapperTransitionEnd=function(b){!o||o.destroyed||b.target===this&&(o.wrapperEl.removeEventListener("transitionend",o.onTranslateToWrapperTransitionEnd),o.onTranslateToWrapperTransitionEnd=null,delete o.onTranslateToWrapperTransitionEnd,o.animating=!1,n&&o.emit("transitionEnd"))}),o.wrapperEl.addEventListener("transitionend",o.onTranslateToWrapperTransitionEnd))),!0}var C9={getTranslate:v9,setTranslate:w9,minTranslate:A9,maxTranslate:T9,translateTo:S9};function _9(e,t){const n=this;n.params.cssMode||(n.wrapperEl.style.transitionDuration=`${e}ms`,n.wrapperEl.style.transitionDelay=e===0?"0ms":""),n.emit("setTransition",e,t)}function Cb({swiper:e,runCallbacks:t,direction:n,step:r}){const{activeIndex:s,previousIndex:o}=e;let a=n;a||(s>o?a="next":s<o?a="prev":a="reset"),e.emit(`transition${r}`),t&&a==="reset"?e.emit(`slideResetTransition${r}`):t&&s!==o&&(e.emit(`slideChangeTransition${r}`),a==="next"?e.emit(`slideNextTransition${r}`):e.emit(`slidePrevTransition${r}`))}function L9(e=!0,t){const n=this,{params:r}=n;r.cssMode||(r.autoHeight&&n.updateAutoHeight(),Cb({swiper:n,runCallbacks:e,direction:t,step:"Start"}))}function k9(e=!0,t){const n=this,{params:r}=n;n.animating=!1,!r.cssMode&&(n.setTransition(0),Cb({swiper:n,runCallbacks:e,direction:t,step:"End"}))}var E9={setTransition:_9,transitionStart:L9,transitionEnd:k9};function I9(e=0,t,n=!0,r,s){typeof e=="string"&&(e=parseInt(e,10));const o=this;let a=e;a<0&&(a=0);const{params:d,snapGrid:h,slidesGrid:p,previousIndex:g,activeIndex:y,rtlTranslate:b,wrapperEl:v,enabled:T}=o;if(!T&&!r&&!s||o.destroyed||o.animating&&d.preventInteractionOnTransition)return!1;typeof t>"u"&&(t=o.params.speed);const A=Math.min(o.params.slidesPerGroupSkip,a);let L=A+Math.floor((a-A)/o.params.slidesPerGroup);L>=h.length&&(L=h.length-1);const R=-h[L];if(d.normalizeSlideIndex)for(let z=0;z<p.length;z+=1){const H=-Math.floor(R*100),ye=Math.floor(p[z]*100),q=Math.floor(p[z+1]*100);typeof p[z+1]<"u"?H>=ye&&H<q-(q-ye)/2?a=z:H>=ye&&H<q&&(a=z+1):H>=ye&&(a=z)}if(o.initialized&&a!==y&&(!o.allowSlideNext&&(b?R>o.translate&&R>o.minTranslate():R<o.translate&&R<o.minTranslate())||!o.allowSlidePrev&&R>o.translate&&R>o.maxTranslate()&&(y||0)!==a))return!1;a!==(g||0)&&n&&o.emit("beforeSlideChangeStart"),o.updateProgress(R);let D;a>y?D="next":a<y?D="prev":D="reset";const B=o.virtual&&o.params.virtual.enabled;if(!(B&&s)&&(b&&-R===o.translate||!b&&R===o.translate))return o.updateActiveIndex(a),d.autoHeight&&o.updateAutoHeight(),o.updateSlidesClasses(),d.effect!=="slide"&&o.setTranslate(R),D!=="reset"&&(o.transitionStart(n,D),o.transitionEnd(n,D)),!1;if(d.cssMode){const z=o.isHorizontal(),H=b?R:-R;if(t===0)B&&(o.wrapperEl.style.scrollSnapType="none",o._immediateVirtual=!0),B&&!o._cssModeVirtualInitialSet&&o.params.initialSlide>0?(o._cssModeVirtualInitialSet=!0,requestAnimationFrame(()=>{v[z?"scrollLeft":"scrollTop"]=H})):v[z?"scrollLeft":"scrollTop"]=H,B&&requestAnimationFrame(()=>{o.wrapperEl.style.scrollSnapType="",o._immediateVirtual=!1});else{if(!o.support.smoothScroll)return wb({swiper:o,targetPosition:H,side:z?"left":"top"}),!0;v.scrollTo({[z?"left":"top"]:H,behavior:"smooth"})}return!0}const $=Sb().isSafari;return B&&!s&&$&&o.isElement&&o.virtual.update(!1,!1,a),o.setTransition(t),o.setTranslate(R),o.updateActiveIndex(a),o.updateSlidesClasses(),o.emit("beforeTransitionStart",t,r),o.transitionStart(n,D),t===0?o.transitionEnd(n,D):o.animating||(o.animating=!0,o.onSlideToWrapperTransitionEnd||(o.onSlideToWrapperTransitionEnd=function(H){!o||o.destroyed||H.target===this&&(o.wrapperEl.removeEventListener("transitionend",o.onSlideToWrapperTransitionEnd),o.onSlideToWrapperTransitionEnd=null,delete o.onSlideToWrapperTransitionEnd,o.transitionEnd(n,D))}),o.wrapperEl.addEventListener("transitionend",o.onSlideToWrapperTransitionEnd)),!0}function R9(e=0,t,n=!0,r){typeof e=="string"&&(e=parseInt(e,10));const s=this;if(s.destroyed)return;typeof t>"u"&&(t=s.params.speed);const o=s.grid&&s.params.grid&&s.params.grid.rows>1;let a=e;if(s.params.loop)if(s.virtual&&s.params.virtual.enabled)a=a+s.virtual.slidesBefore;else{let d;if(o){const A=a*s.params.grid.rows;d=s.slides.find(L=>L.getAttribute("data-swiper-slide-index")*1===A).column}else d=s.getSlideIndexByData(a);const h=o?Math.ceil(s.slides.length/s.params.grid.rows):s.slides.length,{centeredSlides:p,slidesOffsetBefore:g,slidesOffsetAfter:y}=s.params,b=p||!!g||!!y;let v=s.params.slidesPerView;v==="auto"?v=s.slidesPerViewDynamic():(v=Math.ceil(parseFloat(s.params.slidesPerView,10)),b&&v%2===0&&(v=v+1));let T=h-d<v;if(b&&(T=T||d<Math.ceil(v/2)),r&&b&&s.params.slidesPerView!=="auto"&&!o&&(T=!1),T){const A=b?d<s.activeIndex?"prev":"next":d-s.activeIndex-1<s.params.slidesPerView?"next":"prev";s.loopFix({direction:A,slideTo:!0,activeSlideIndex:A==="next"?d+1:d-h+1,slideRealIndex:A==="next"?s.realIndex:void 0})}if(o){const A=a*s.params.grid.rows;a=s.slides.find(L=>L.getAttribute("data-swiper-slide-index")*1===A).column}else a=s.getSlideIndexByData(a)}return requestAnimationFrame(()=>{s.slideTo(a,t,n,r)}),s}function M9(e,t=!0,n){const r=this,{enabled:s,params:o,animating:a}=r;if(!s||r.destroyed)return r;typeof e>"u"&&(e=r.params.speed);let d=o.slidesPerGroup;o.slidesPerView==="auto"&&o.slidesPerGroup===1&&o.slidesPerGroupAuto&&(d=Math.max(r.slidesPerViewDynamic("current",!0),1));const h=r.activeIndex<o.slidesPerGroupSkip?1:d,p=r.virtual&&o.virtual.enabled;if(o.loop){if(a&&!p&&o.loopPreventsSliding)return!1;if(r.loopFix({direction:"next"}),r._clientLeft=r.wrapperEl.clientLeft,r.activeIndex===r.slides.length-1&&o.cssMode)return requestAnimationFrame(()=>{r.slideTo(r.activeIndex+h,e,t,n)}),!0}return o.rewind&&r.isEnd?r.slideTo(0,e,t,n):r.slideTo(r.activeIndex+h,e,t,n)}function N9(e,t=!0,n){const r=this,{params:s,snapGrid:o,slidesGrid:a,rtlTranslate:d,enabled:h,animating:p}=r;if(!h||r.destroyed)return r;typeof e>"u"&&(e=r.params.speed);const g=r.virtual&&s.virtual.enabled;if(s.loop){if(p&&!g&&s.loopPreventsSliding)return!1;r.loopFix({direction:"prev"}),r._clientLeft=r.wrapperEl.clientLeft}const y=d?r.translate:-r.translate;function b(D){return D<0?-Math.floor(Math.abs(D)):Math.floor(D)}const v=b(y),T=o.map(D=>b(D)),A=s.freeMode&&s.freeMode.enabled;let L=o[T.indexOf(v)-1];if(typeof L>"u"&&(s.cssMode||A)){let D;o.forEach((B,j)=>{v>=B&&(D=j)}),typeof D<"u"&&(L=A?o[D]:o[D>0?D-1:D])}let R=0;if(typeof L<"u"&&(R=a.indexOf(L),R<0&&(R=r.activeIndex-1),s.slidesPerView==="auto"&&s.slidesPerGroup===1&&s.slidesPerGroupAuto&&(R=R-r.slidesPerViewDynamic("previous",!0)+1,R=Math.max(R,0))),s.rewind&&r.isBeginning){const D=r.params.virtual&&r.params.virtual.enabled&&r.virtual?r.virtual.slides.length-1:r.slides.length-1;return r.slideTo(D,e,t,n)}else if(s.loop&&r.activeIndex===0&&s.cssMode)return requestAnimationFrame(()=>{r.slideTo(R,e,t,n)}),!0;return r.slideTo(R,e,t,n)}function D9(e,t=!0,n){const r=this;if(!r.destroyed)return typeof e>"u"&&(e=r.params.speed),r.slideTo(r.activeIndex,e,t,n)}function B9(e,t=!0,n,r=.5){const s=this;if(s.destroyed)return;typeof e>"u"&&(e=s.params.speed);let o=s.activeIndex;const a=Math.min(s.params.slidesPerGroupSkip,o),d=a+Math.floor((o-a)/s.params.slidesPerGroup),h=s.rtlTranslate?s.translate:-s.translate;if(h>=s.snapGrid[d]){const p=s.snapGrid[d],g=s.snapGrid[d+1];h-p>(g-p)*r&&(o+=s.params.slidesPerGroup)}else{const p=s.snapGrid[d-1],g=s.snapGrid[d];h-p<=(g-p)*r&&(o-=s.params.slidesPerGroup)}return o=Math.max(o,0),o=Math.min(o,s.slidesGrid.length-1),s.slideTo(o,e,t,n)}function P9(){const e=this;if(e.destroyed)return;const{params:t,slidesEl:n}=e,r=t.slidesPerView==="auto"?e.slidesPerViewDynamic():t.slidesPerView;let s=e.getSlideIndexWhenGrid(e.clickedIndex),o;const a=e.isElement?"swiper-slide":`.${t.slideClass}`,d=e.grid&&e.params.grid&&e.params.grid.rows>1;if(t.loop){if(e.animating)return;o=parseInt(e.clickedSlide.getAttribute("data-swiper-slide-index"),10),t.centeredSlides?e.slideToLoop(o):s>(d?(e.slides.length-r)/2-(e.params.grid.rows-1):e.slides.length-r)?(e.loopFix(),s=e.getSlideIndex(il(n,`${a}[data-swiper-slide-index="${o}"]`)[0]),vb(()=>{e.slideTo(s)})):e.slideTo(s)}else e.slideTo(s)}var Q9={slideTo:I9,slideToLoop:R9,slideNext:M9,slidePrev:N9,slideReset:D9,slideToClosest:B9,slideToClickedSlide:P9};function O9(e,t){const n=this,{params:r,slidesEl:s}=n;if(!r.loop||n.virtual&&n.params.virtual.enabled)return;const o=()=>{il(s,`.${r.slideClass}, swiper-slide`).forEach((T,A)=>{T.setAttribute("data-swiper-slide-index",A)})},a=()=>{const v=il(s,`.${r.slideBlankClass}`);v.forEach(T=>{T.remove()}),v.length>0&&(n.recalcSlides(),n.updateSlides())},d=n.grid&&r.grid&&r.grid.rows>1;r.loopAddBlankSlides&&(r.slidesPerGroup>1||d)&&a();const h=r.slidesPerGroup*(d?r.grid.rows:1),p=n.slides.length%h!==0,g=d&&n.slides.length%r.grid.rows!==0,y=v=>{for(let T=0;T<v;T+=1){const A=n.isElement?sm("swiper-slide",[r.slideBlankClass]):sm("div",[r.slideClass,r.slideBlankClass]);n.slidesEl.append(A)}};if(p){if(r.loopAddBlankSlides){const v=h-n.slides.length%h;y(v),n.recalcSlides(),n.updateSlides()}else ch("Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)");o()}else if(g){if(r.loopAddBlankSlides){const v=r.grid.rows-n.slides.length%r.grid.rows;y(v),n.recalcSlides(),n.updateSlides()}else ch("Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)");o()}else o();const b=r.centeredSlides||!!r.slidesOffsetBefore||!!r.slidesOffsetAfter;n.loopFix({slideRealIndex:e,direction:b?void 0:"next",initial:t})}function F9({slideRealIndex:e,slideTo:t=!0,direction:n,setTranslate:r,activeSlideIndex:s,initial:o,byController:a,byMousewheel:d}={}){const h=this;if(!h.params.loop)return;h.emit("beforeLoopFix");const{slides:p,allowSlidePrev:g,allowSlideNext:y,slidesEl:b,params:v}=h,{centeredSlides:T,slidesOffsetBefore:A,slidesOffsetAfter:L,initialSlide:R}=v,D=T||!!A||!!L;if(h.allowSlidePrev=!0,h.allowSlideNext=!0,h.virtual&&v.virtual.enabled){t&&(!D&&h.snapIndex===0?h.slideTo(h.virtual.slides.length,0,!1,!0):D&&h.snapIndex<v.slidesPerView?h.slideTo(h.virtual.slides.length+h.snapIndex,0,!1,!0):h.snapIndex===h.snapGrid.length-1&&h.slideTo(h.virtual.slidesBefore,0,!1,!0)),h.allowSlidePrev=g,h.allowSlideNext=y,h.emit("loopFix");return}let B=v.slidesPerView;B==="auto"?B=h.slidesPerViewDynamic():(B=Math.ceil(parseFloat(v.slidesPerView,10)),D&&B%2===0&&(B=B+1));const j=v.slidesPerGroupAuto?B:v.slidesPerGroup;let P=D?Math.max(j,Math.ceil(B/2)):j;P%j!==0&&(P+=j-P%j),P+=v.loopAdditionalSlides,h.loopedSlides=P;const $=h.grid&&v.grid&&v.grid.rows>1;p.length<B+P||h.params.effect==="cards"&&p.length<B+P*2?ch("Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled or not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters"):$&&v.grid.fill==="row"&&ch("Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`");const z=[],H=[],ye=$?Math.ceil(p.length/v.grid.rows):p.length,q=o&&ye-R<B&&!D;let te=q?R:h.activeIndex;typeof s>"u"?s=h.getSlideIndex(p.find(K=>K.classList.contains(v.slideActiveClass))):te=s;const ve=n==="next"||!n,ge=n==="prev"||!n;let ie=0,Ae=0;const ce=($?p[s].column:s)+(D&&typeof r>"u"?-B/2+.5:0);if(ce<P){ie=Math.max(P-ce,j);for(let K=0;K<P-ce;K+=1){const be=K-Math.floor(K/ye)*ye;if($){const Se=ye-be-1;for(let We=p.length-1;We>=0;We-=1)p[We].column===Se&&z.push(We)}else z.push(ye-be-1)}}else if(ce+B>ye-P){Ae=Math.max(ce-(ye-P*2),j),q&&(Ae=Math.max(Ae,B-ye+R+1));for(let K=0;K<Ae;K+=1){const be=K-Math.floor(K/ye)*ye;$?p.forEach((Se,We)=>{Se.column===be&&H.push(We)}):H.push(be)}}if(h.__preventObserver__=!0,requestAnimationFrame(()=>{h.__preventObserver__=!1}),h.params.effect==="cards"&&p.length<B+P*2&&(H.includes(s)&&H.splice(H.indexOf(s),1),z.includes(s)&&z.splice(z.indexOf(s),1)),ge&&z.forEach(K=>{p[K].swiperLoopMoveDOM=!0,b.prepend(p[K]),p[K].swiperLoopMoveDOM=!1}),ve&&H.forEach(K=>{p[K].swiperLoopMoveDOM=!0,b.append(p[K]),p[K].swiperLoopMoveDOM=!1}),h.recalcSlides(),v.slidesPerView==="auto"?h.updateSlides():$&&(z.length>0&&ge||H.length>0&&ve)&&h.slides.forEach((K,be)=>{h.grid.updateSlide(be,K,h.slides)}),v.watchSlidesProgress&&h.updateSlidesOffset(),t){if(z.length>0&&ge){if(typeof e>"u"){const K=h.slidesGrid[te],Se=h.slidesGrid[te+ie]-K;d?h.setTranslate(h.translate-Se):(h.slideTo(te+Math.ceil(ie),0,!1,!0),r&&(h.touchEventsData.startTranslate=h.touchEventsData.startTranslate-Se,h.touchEventsData.currentTranslate=h.touchEventsData.currentTranslate-Se))}else if(r){const K=$?z.length/v.grid.rows:z.length;h.slideTo(h.activeIndex+K,0,!1,!0),h.touchEventsData.currentTranslate=h.translate}}else if(H.length>0&&ve)if(typeof e>"u"){const K=h.slidesGrid[te],Se=h.slidesGrid[te-Ae]-K;d?h.setTranslate(h.translate-Se):(h.slideTo(te-Ae,0,!1,!0),r&&(h.touchEventsData.startTranslate=h.touchEventsData.startTranslate-Se,h.touchEventsData.currentTranslate=h.touchEventsData.currentTranslate-Se))}else{const K=$?H.length/v.grid.rows:H.length;h.slideTo(h.activeIndex-K,0,!1,!0)}}if(h.allowSlidePrev=g,h.allowSlideNext=y,h.controller&&h.controller.control&&!a){const K={slideRealIndex:e,direction:n,setTranslate:r,activeSlideIndex:s,byController:!0};Array.isArray(h.controller.control)?h.controller.control.forEach(be=>{!be.destroyed&&be.params.loop&&be.loopFix({...K,slideTo:be.params.slidesPerView===v.slidesPerView?t:!1})}):h.controller.control instanceof h.constructor&&h.controller.control.params.loop&&h.controller.control.loopFix({...K,slideTo:h.controller.control.params.slidesPerView===v.slidesPerView?t:!1})}h.emit("loopFix")}function j9(){const e=this,{params:t,slidesEl:n}=e;if(!t.loop||!n||e.virtual&&e.params.virtual.enabled)return;e.recalcSlides();const r=[];e.slides.forEach(s=>{const o=typeof s.swiperSlideIndex>"u"?s.getAttribute("data-swiper-slide-index")*1:s.swiperSlideIndex;r[o]=s}),e.slides.forEach(s=>{s.removeAttribute("data-swiper-slide-index")}),r.forEach(s=>{n.append(s)}),e.recalcSlides(),e.slideTo(e.realIndex,0)}var $9={loopCreate:O9,loopFix:F9,loopDestroy:j9};function U9(e){const t=this;if(!t.params.simulateTouch||t.params.watchOverflow&&t.isLocked||t.params.cssMode)return;const n=t.params.touchEventsTarget==="container"?t.el:t.wrapperEl;t.isElement&&(t.__preventObserver__=!0),n.style.cursor="move",n.style.cursor=e?"grabbing":"grab",t.isElement&&requestAnimationFrame(()=>{t.__preventObserver__=!1})}function H9(){const e=this;e.params.watchOverflow&&e.isLocked||e.params.cssMode||(e.isElement&&(e.__preventObserver__=!0),e[e.params.touchEventsTarget==="container"?"el":"wrapperEl"].style.cursor="",e.isElement&&requestAnimationFrame(()=>{e.__preventObserver__=!1}))}var z9={setGrabCursor:U9,unsetGrabCursor:H9};function G9(e,t=this){function n(r){if(!r||r===xc()||r===Zi())return null;r.assignedSlot&&(r=r.assignedSlot);const s=r.closest(e);return!s&&!r.getRootNode?null:s||n(r.getRootNode().host)}return n(t)}function t2(e,t,n){const r=Zi(),{params:s}=e,o=s.edgeSwipeDetection,a=s.edgeSwipeThreshold;return o&&(n<=a||n>=r.innerWidth-a)?o==="prevent"?(t.preventDefault(),!0):!1:!0}function W9(e){const t=this;if(t.destroyed)return;const n=xc();let r=e;r.originalEvent&&(r=r.originalEvent);const s=t.touchEventsData;if(r.type==="pointerdown"){if(s.pointerId!==null&&s.pointerId!==r.pointerId)return;s.pointerId=r.pointerId}else r.type==="touchstart"&&r.targetTouches.length===1&&(s.touchId=r.targetTouches[0].identifier);if(r.type==="touchstart"){t2(t,r,r.targetTouches[0].pageX);return}const{params:o,touches:a,enabled:d}=t;if(!d||!o.simulateTouch&&r.pointerType==="mouse"||t.animating&&o.preventInteractionOnTransition)return;!t.animating&&o.cssMode&&o.loop&&t.loopFix();let h=r.target;if(o.touchEventsTarget==="wrapper"&&!J8(h,t.wrapperEl)||"which"in r&&r.which===3||"button"in r&&r.button>0||s.isTouched&&s.isMoved)return;const p=!!o.noSwipingClass&&o.noSwipingClass!=="",g=r.composedPath?r.composedPath():r.path;p&&r.target&&r.target.shadowRoot&&g&&(h=g[0]);const y=o.noSwipingSelector?o.noSwipingSelector:`.${o.noSwipingClass}`,b=!!(r.target&&r.target.shadowRoot);if(o.noSwiping&&(b?G9(y,h):h.closest(y))){t.allowClick=!0;return}if(o.swipeHandler&&!h.closest(o.swipeHandler))return;a.currentX=r.pageX,a.currentY=r.pageY;const v=a.currentX,T=a.currentY;if(!t2(t,r,v))return;Object.assign(s,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),a.startX=v,a.startY=T,s.touchStartTime=lh(),t.allowClick=!0,t.updateSize(),t.swipeDirection=void 0,o.threshold>0&&(s.allowThresholdMove=!1);let A=!0;h.matches(s.focusableElements)&&(A=!1,h.nodeName==="SELECT"&&(s.isTouched=!1)),n.activeElement&&n.activeElement.matches(s.focusableElements)&&n.activeElement!==h&&(r.pointerType==="mouse"||r.pointerType!=="mouse"&&!h.matches(s.focusableElements))&&n.activeElement.blur();const L=A&&t.allowTouchMove&&o.touchStartPreventDefault;(o.touchStartForcePreventDefault||L)&&!h.isContentEditable&&r.preventDefault(),o.freeMode&&o.freeMode.enabled&&t.freeMode&&t.animating&&!o.cssMode&&t.freeMode.onTouchStart(),t.emit("touchStart",r)}function V9(e){const t=xc(),n=this;if(n.destroyed)return;const r=n.touchEventsData,{params:s,touches:o,rtlTranslate:a,enabled:d}=n;if(!d||!s.simulateTouch&&e.pointerType==="mouse")return;let h=e;if(h.originalEvent&&(h=h.originalEvent),h.type==="pointermove"&&(r.touchId!==null||h.pointerId!==r.pointerId))return;let p;if(h.type==="touchmove"){if(p=[...h.changedTouches].find(P=>P.identifier===r.touchId),!p||p.identifier!==r.touchId)return}else p=h;if(!r.isTouched){r.startMoving&&r.isScrolling&&n.emit("touchMoveOpposite",h);return}const g=p.pageX,y=p.pageY;if(h.preventedByNestedSwiper){o.startX=g,o.startY=y;return}if(!n.allowTouchMove){h.target.matches(r.focusableElements)||(n.allowClick=!1),r.isTouched&&(Object.assign(o,{startX:g,startY:y,currentX:g,currentY:y}),r.touchStartTime=lh());return}if(s.touchReleaseOnEdges&&!s.loop)if(n.isVertical()){if(y<o.startY&&n.translate<=n.maxTranslate()||y>o.startY&&n.translate>=n.minTranslate()){r.isTouched=!1,r.isMoved=!1;return}}else{if(a&&(g>o.startX&&-n.translate<=n.maxTranslate()||g<o.startX&&-n.translate>=n.minTranslate()))return;if(!a&&(g<o.startX&&n.translate<=n.maxTranslate()||g>o.startX&&n.translate>=n.minTranslate()))return}if(t.activeElement&&t.activeElement.matches(r.focusableElements)&&t.activeElement!==h.target&&h.pointerType!=="mouse"&&t.activeElement.blur(),t.activeElement&&h.target===t.activeElement&&h.target.matches(r.focusableElements)){r.isMoved=!0,n.allowClick=!1;return}r.allowTouchCallbacks&&n.emit("touchMove",h),o.previousX=o.currentX,o.previousY=o.currentY,o.currentX=g,o.currentY=y;const b=o.currentX-o.startX,v=o.currentY-o.startY;if(n.params.threshold&&Math.sqrt(b**2+v**2)<n.params.threshold)return;if(typeof r.isScrolling>"u"){let P;n.isHorizontal()&&o.currentY===o.startY||n.isVertical()&&o.currentX===o.startX?r.isScrolling=!1:b*b+v*v>=25&&(P=Math.atan2(Math.abs(v),Math.abs(b))*180/Math.PI,r.isScrolling=n.isHorizontal()?P>s.touchAngle:90-P>s.touchAngle)}if(r.isScrolling&&n.emit("touchMoveOpposite",h),typeof r.startMoving>"u"&&(o.currentX!==o.startX||o.currentY!==o.startY)&&(r.startMoving=!0),r.isScrolling||h.type==="touchmove"&&r.preventTouchMoveFromPointerMove){r.isTouched=!1;return}if(!r.startMoving)return;n.allowClick=!1,!s.cssMode&&h.cancelable&&h.preventDefault(),s.touchMoveStopPropagation&&!s.nested&&h.stopPropagation();let T=n.isHorizontal()?b:v,A=n.isHorizontal()?o.currentX-o.previousX:o.currentY-o.previousY;s.oneWayMovement&&(T=Math.abs(T)*(a?1:-1),A=Math.abs(A)*(a?1:-1)),o.diff=T,T*=s.touchRatio,a&&(T=-T,A=-A);const L=n.touchesDirection;n.swipeDirection=T>0?"prev":"next",n.touchesDirection=A>0?"prev":"next";const R=n.params.loop&&!s.cssMode,D=n.touchesDirection==="next"&&n.allowSlideNext||n.touchesDirection==="prev"&&n.allowSlidePrev;if(!r.isMoved){if(R&&D&&n.loopFix({direction:n.swipeDirection}),r.startTranslate=n.getTranslate(),n.setTransition(0),n.animating){const P=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0,detail:{bySwiperTouchMove:!0}});n.wrapperEl.dispatchEvent(P)}r.allowMomentumBounce=!1,s.grabCursor&&(n.allowSlideNext===!0||n.allowSlidePrev===!0)&&n.setGrabCursor(!0),n.emit("sliderFirstMove",h)}if(new Date().getTime(),s._loopSwapReset!==!1&&r.isMoved&&r.allowThresholdMove&&L!==n.touchesDirection&&R&&D&&Math.abs(T)>=1){Object.assign(o,{startX:g,startY:y,currentX:g,currentY:y,startTranslate:r.currentTranslate}),r.loopSwapReset=!0,r.startTranslate=r.currentTranslate;return}n.emit("sliderMove",h),r.isMoved=!0,r.currentTranslate=T+r.startTranslate;let B=!0,j=s.resistanceRatio;if(s.touchReleaseOnEdges&&(j=0),T>0?(R&&D&&r.allowThresholdMove&&r.currentTranslate>(s.centeredSlides?n.minTranslate()-n.slidesSizesGrid[n.activeIndex+1]-(s.slidesPerView!=="auto"&&n.slides.length-s.slidesPerView>=2?n.slidesSizesGrid[n.activeIndex+1]+n.params.spaceBetween:0)-n.params.spaceBetween:n.minTranslate())&&n.loopFix({direction:"prev",setTranslate:!0,activeSlideIndex:0}),r.currentTranslate>n.minTranslate()&&(B=!1,s.resistance&&(r.currentTranslate=n.minTranslate()-1+(-n.minTranslate()+r.startTranslate+T)**j))):T<0&&(R&&D&&r.allowThresholdMove&&r.currentTranslate<(s.centeredSlides?n.maxTranslate()+n.slidesSizesGrid[n.slidesSizesGrid.length-1]+n.params.spaceBetween+(s.slidesPerView!=="auto"&&n.slides.length-s.slidesPerView>=2?n.slidesSizesGrid[n.slidesSizesGrid.length-1]+n.params.spaceBetween:0):n.maxTranslate())&&n.loopFix({direction:"next",setTranslate:!0,activeSlideIndex:n.slides.length-(s.slidesPerView==="auto"?n.slidesPerViewDynamic():Math.ceil(parseFloat(s.slidesPerView,10)))}),r.currentTranslate<n.maxTranslate()&&(B=!1,s.resistance&&(r.currentTranslate=n.maxTranslate()+1-(n.maxTranslate()-r.startTranslate-T)**j))),B&&(h.preventedByNestedSwiper=!0),!n.allowSlideNext&&n.swipeDirection==="next"&&r.currentTranslate<r.startTranslate&&(r.currentTranslate=r.startTranslate),!n.allowSlidePrev&&n.swipeDirection==="prev"&&r.currentTranslate>r.startTranslate&&(r.currentTranslate=r.startTranslate),!n.allowSlidePrev&&!n.allowSlideNext&&(r.currentTranslate=r.startTranslate),s.threshold>0)if(Math.abs(T)>s.threshold||r.allowThresholdMove){if(!r.allowThresholdMove){r.allowThresholdMove=!0,o.startX=o.currentX,o.startY=o.currentY,r.currentTranslate=r.startTranslate,o.diff=n.isHorizontal()?o.currentX-o.startX:o.currentY-o.startY;return}}else{r.currentTranslate=r.startTranslate;return}!s.followFinger||s.cssMode||((s.freeMode&&s.freeMode.enabled&&n.freeMode||s.watchSlidesProgress)&&(n.updateActiveIndex(),n.updateSlidesClasses()),s.freeMode&&s.freeMode.enabled&&n.freeMode&&n.freeMode.onTouchMove(),n.updateProgress(r.currentTranslate),n.setTranslate(r.currentTranslate))}function q9(e){const t=this;if(t.destroyed)return;const n=t.touchEventsData;let r=e;r.originalEvent&&(r=r.originalEvent);let s;if(r.type==="touchend"||r.type==="touchcancel"){if(s=[...r.changedTouches].find(P=>P.identifier===n.touchId),!s||s.identifier!==n.touchId)return}else{if(n.touchId!==null||r.pointerId!==n.pointerId)return;s=r}if(["pointercancel","pointerout","pointerleave","contextmenu"].includes(r.type)&&!(["pointercancel","contextmenu"].includes(r.type)&&(t.browser.isSafari||t.browser.isWebView)))return;n.pointerId=null,n.touchId=null;const{params:a,touches:d,rtlTranslate:h,slidesGrid:p,enabled:g}=t;if(!g||!a.simulateTouch&&r.pointerType==="mouse")return;if(n.allowTouchCallbacks&&t.emit("touchEnd",r),n.allowTouchCallbacks=!1,!n.isTouched){n.isMoved&&a.grabCursor&&t.setGrabCursor(!1),n.isMoved=!1,n.startMoving=!1;return}a.grabCursor&&n.isMoved&&n.isTouched&&(t.allowSlideNext===!0||t.allowSlidePrev===!0)&&t.setGrabCursor(!1);const y=lh(),b=y-n.touchStartTime;if(t.allowClick){const P=r.path||r.composedPath&&r.composedPath();t.updateClickedSlide(P&&P[0]||r.target,P),t.emit("tap click",r),b<300&&y-n.lastClickTime<300&&t.emit("doubleTap doubleClick",r)}if(n.lastClickTime=lh(),vb(()=>{t.destroyed||(t.allowClick=!0)}),!n.isTouched||!n.isMoved||!t.swipeDirection||d.diff===0&&!n.loopSwapReset||n.currentTranslate===n.startTranslate&&!n.loopSwapReset){n.isTouched=!1,n.isMoved=!1,n.startMoving=!1;return}n.isTouched=!1,n.isMoved=!1,n.startMoving=!1;let v;if(a.followFinger?v=h?t.translate:-t.translate:v=-n.currentTranslate,a.cssMode)return;if(a.freeMode&&a.freeMode.enabled){t.freeMode.onTouchEnd({currentPos:v});return}const T=v>=-t.maxTranslate()&&!t.params.loop;let A=0,L=t.slidesSizesGrid[0];for(let P=0;P<p.length;P+=P<a.slidesPerGroupSkip?1:a.slidesPerGroup){const $=P<a.slidesPerGroupSkip-1?1:a.slidesPerGroup;typeof p[P+$]<"u"?(T||v>=p[P]&&v<p[P+$])&&(A=P,L=p[P+$]-p[P]):(T||v>=p[P])&&(A=P,L=p[p.length-1]-p[p.length-2])}let R=null,D=null;a.rewind&&(t.isBeginning?D=a.virtual&&a.virtual.enabled&&t.virtual?t.virtual.slides.length-1:t.slides.length-1:t.isEnd&&(R=0));const B=(v-p[A])/L,j=A<a.slidesPerGroupSkip-1?1:a.slidesPerGroup;if(b>a.longSwipesMs){if(!a.longSwipes){t.slideTo(t.activeIndex);return}t.swipeDirection==="next"&&(B>=a.longSwipesRatio?t.slideTo(a.rewind&&t.isEnd?R:A+j):t.slideTo(A)),t.swipeDirection==="prev"&&(B>1-a.longSwipesRatio?t.slideTo(A+j):D!==null&&B<0&&Math.abs(B)>a.longSwipesRatio?t.slideTo(D):t.slideTo(A))}else{if(!a.shortSwipes){t.slideTo(t.activeIndex);return}t.navigation&&(r.target===t.navigation.nextEl||r.target===t.navigation.prevEl)?r.target===t.navigation.nextEl?t.slideTo(A+j):t.slideTo(A):(t.swipeDirection==="next"&&t.slideTo(R!==null?R:A+j),t.swipeDirection==="prev"&&t.slideTo(D!==null?D:A))}}function n2(){const e=this,{params:t,el:n}=e;if(n&&n.offsetWidth===0)return;t.breakpoints&&e.setBreakpoint();const{allowSlideNext:r,allowSlidePrev:s,snapGrid:o}=e,a=e.virtual&&e.params.virtual.enabled;e.allowSlideNext=!0,e.allowSlidePrev=!0,e.updateSize(),e.updateSlides(),e.updateSlidesClasses();const d=a&&t.loop;if((t.slidesPerView==="auto"||t.slidesPerView>1)&&e.isEnd&&!e.isBeginning&&!e.params.centeredSlides&&!d){const h=a?e.virtual.slides:e.slides;e.slideTo(h.length-1,0,!1,!0)}else e.params.loop&&!a?e.slideToLoop(e.realIndex,0,!1,!0):e.slideTo(e.activeIndex,0,!1,!0);e.autoplay&&e.autoplay.running&&e.autoplay.paused&&(clearTimeout(e.autoplay.resizeTimeout),e.autoplay.resizeTimeout=setTimeout(()=>{e.autoplay&&e.autoplay.running&&e.autoplay.paused&&e.autoplay.resume()},500)),e.allowSlidePrev=s,e.allowSlideNext=r,e.params.watchOverflow&&o!==e.snapGrid&&e.checkOverflow()}function Y9(e){const t=this;t.destroyed||t.enabled&&(t.allowClick||(t.params.preventClicks&&e.preventDefault(),t.params.preventClicksPropagation&&t.animating&&(e.stopPropagation(),e.stopImmediatePropagation())))}function Z9(){const e=this;if(e.destroyed)return;const{wrapperEl:t,rtlTranslate:n,enabled:r}=e;if(!r)return;e.previousTranslate=e.translate,e.isHorizontal()?e.translate=-t.scrollLeft:e.translate=-t.scrollTop,e.translate===0&&(e.translate=0),e.updateActiveIndex(),e.updateSlidesClasses();let s;const o=e.maxTranslate()-e.minTranslate();o===0?s=0:s=(e.translate-e.minTranslate())/o,s!==e.progress&&e.updateProgress(n?-e.translate:e.translate),e.emit("setTranslate",e.translate,!1)}function K9(e){const t=this;t.destroyed||(zd(t,e.target),!(t.params.cssMode||t.params.slidesPerView!=="auto"&&!t.params.autoHeight)&&t.update())}function X9(){const e=this;e.destroyed||e.documentTouchHandlerProceeded||(e.documentTouchHandlerProceeded=!0,e.params.touchReleaseOnEdges&&(e.el.style.touchAction="auto"))}const _b=(e,t)=>{const n=xc(),{params:r,el:s,wrapperEl:o,device:a}=e,d=!!r.nested,h=t==="on"?"addEventListener":"removeEventListener",p=t;!s||typeof s=="string"||(n[h]("touchstart",e.onDocumentTouchStart,{passive:!1,capture:d}),s[h]("touchstart",e.onTouchStart,{passive:!1}),s[h]("pointerdown",e.onTouchStart,{passive:!1}),n[h]("touchmove",e.onTouchMove,{passive:!1,capture:d}),n[h]("pointermove",e.onTouchMove,{passive:!1,capture:d}),n[h]("touchend",e.onTouchEnd,{passive:!0}),n[h]("pointerup",e.onTouchEnd,{passive:!0}),n[h]("pointercancel",e.onTouchEnd,{passive:!0}),n[h]("touchcancel",e.onTouchEnd,{passive:!0}),n[h]("pointerout",e.onTouchEnd,{passive:!0}),n[h]("pointerleave",e.onTouchEnd,{passive:!0}),n[h]("contextmenu",e.onTouchEnd,{passive:!0}),(r.preventClicks||r.preventClicksPropagation)&&s[h]("click",e.onClick,!0),r.cssMode&&o[h]("scroll",e.onScroll),r.updateOnWindowResize?e[p](a.ios||a.android?"resize orientationchange observerUpdate":"resize observerUpdate",n2,!0):e[p]("observerUpdate",n2,!0),s[h]("load",e.onLoad,{capture:!0}))};function J9(){const e=this,{params:t}=e;e.onTouchStart=W9.bind(e),e.onTouchMove=V9.bind(e),e.onTouchEnd=q9.bind(e),e.onDocumentTouchStart=X9.bind(e),t.cssMode&&(e.onScroll=Z9.bind(e)),e.onClick=Y9.bind(e),e.onLoad=K9.bind(e),_b(e,"on")}function eA(){_b(this,"off")}var tA={attachEvents:J9,detachEvents:eA};const r2=(e,t)=>e.grid&&t.grid&&t.grid.rows>1;function nA(){const e=this,{realIndex:t,initialized:n,params:r,el:s}=e,o=r.breakpoints;if(!o||o&&Object.keys(o).length===0)return;const a=xc(),d=r.breakpointsBase==="window"||!r.breakpointsBase?r.breakpointsBase:"container",h=["window","container"].includes(r.breakpointsBase)||!r.breakpointsBase?e.el:a.querySelector(r.breakpointsBase),p=e.getBreakpoint(o,d,h);if(!p||e.currentBreakpoint===p)return;const y=(p in o?o[p]:void 0)||e.originalParams,b=r2(e,r),v=r2(e,y),T=e.params.grabCursor,A=y.grabCursor,L=r.enabled;b&&!v?(s.classList.remove(`${r.containerModifierClass}grid`,`${r.containerModifierClass}grid-column`),e.emitContainerClasses()):!b&&v&&(s.classList.add(`${r.containerModifierClass}grid`),(y.grid.fill&&y.grid.fill==="column"||!y.grid.fill&&r.grid.fill==="column")&&s.classList.add(`${r.containerModifierClass}grid-column`),e.emitContainerClasses()),T&&!A?e.unsetGrabCursor():!T&&A&&e.setGrabCursor(),["navigation","pagination","scrollbar"].forEach($=>{if(typeof y[$]>"u")return;const z=r[$]&&r[$].enabled,H=y[$]&&y[$].enabled;z&&!H&&e[$].disable(),!z&&H&&e[$].enable()});const R=y.direction&&y.direction!==r.direction,D=r.loop&&(y.slidesPerView!==r.slidesPerView||R),B=r.loop;R&&n&&e.changeDirection(),Ao(e.params,y);const j=e.params.enabled,P=e.params.loop;Object.assign(e,{allowTouchMove:e.params.allowTouchMove,allowSlideNext:e.params.allowSlideNext,allowSlidePrev:e.params.allowSlidePrev}),L&&!j?e.disable():!L&&j&&e.enable(),e.currentBreakpoint=p,e.emit("_beforeBreakpoint",y),n&&(D?(e.loopDestroy(),e.loopCreate(t),e.updateSlides()):!B&&P?(e.loopCreate(t),e.updateSlides()):B&&!P&&e.loopDestroy()),e.emit("breakpoint",y)}function rA(e,t="window",n){if(!e||t==="container"&&!n)return;let r=!1;const s=Zi(),o=t==="window"?s.innerHeight:n.clientHeight,a=Object.keys(e).map(d=>{if(typeof d=="string"&&d.indexOf("@")===0){const h=parseFloat(d.substr(1));return{value:o*h,point:d}}return{value:d,point:d}});a.sort((d,h)=>parseInt(d.value,10)-parseInt(h.value,10));for(let d=0;d<a.length;d+=1){const{point:h,value:p}=a[d];t==="window"?s.matchMedia(`(min-width: ${p}px)`).matches&&(r=h):p<=n.clientWidth&&(r=h)}return r||"max"}var sA={setBreakpoint:nA,getBreakpoint:rA};function iA(e,t){const n=[];return e.forEach(r=>{typeof r=="object"?Object.keys(r).forEach(s=>{r[s]&&n.push(t+s)}):typeof r=="string"&&n.push(t+r)}),n}function oA(){const e=this,{classNames:t,params:n,rtl:r,el:s,device:o}=e,a=iA(["initialized",n.direction,{"free-mode":e.params.freeMode&&n.freeMode.enabled},{autoheight:n.autoHeight},{rtl:r},{grid:n.grid&&n.grid.rows>1},{"grid-column":n.grid&&n.grid.rows>1&&n.grid.fill==="column"},{android:o.android},{ios:o.ios},{"css-mode":n.cssMode},{centered:n.cssMode&&n.centeredSlides},{"watch-progress":n.watchSlidesProgress}],n.containerModifierClass);t.push(...a),s.classList.add(...t),e.emitContainerClasses()}function aA(){const e=this,{el:t,classNames:n}=e;!t||typeof t=="string"||(t.classList.remove(...n),e.emitContainerClasses())}var lA={addClasses:oA,removeClasses:aA};function cA(){const e=this,{isLocked:t,params:n}=e,{slidesOffsetBefore:r}=n;if(r){const s=e.slides.length-1,o=e.slidesGrid[s]+e.slidesSizesGrid[s]+r*2;e.isLocked=e.size>o}else e.isLocked=e.snapGrid.length===1;n.allowSlideNext===!0&&(e.allowSlideNext=!e.isLocked),n.allowSlidePrev===!0&&(e.allowSlidePrev=!e.isLocked),t&&t!==e.isLocked&&(e.isEnd=!1),t!==e.isLocked&&e.emit(e.isLocked?"lock":"unlock")}var uA={checkOverflow:cA},om={init:!0,direction:"horizontal",oneWayMovement:!1,swiperElementNodeName:"SWIPER-CONTAINER",touchEventsTarget:"wrapper",initialSlide:0,speed:300,cssMode:!1,updateOnWindowResize:!0,resizeObserver:!0,nested:!1,createElements:!1,eventsPrefix:"swiper",enabled:!0,focusableElements:"input, select, option, textarea, button, video, label",width:null,height:null,preventInteractionOnTransition:!1,userAgent:null,url:null,edgeSwipeDetection:!1,edgeSwipeThreshold:20,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsBase:"window",spaceBetween:0,slidesPerView:1,slidesPerGroup:1,slidesPerGroupSkip:0,slidesPerGroupAuto:!1,centeredSlides:!1,centeredSlidesBounds:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,snapToSlideEdge:!1,watchOverflow:!0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:5,touchMoveStopPropagation:!1,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,loop:!1,loopAddBlankSlides:!0,loopAdditionalSlides:0,loopPreventsSliding:!0,rewind:!1,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,maxBackfaceHiddenSlides:10,containerModifierClass:"swiper-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-blank",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideFullyVisibleClass:"swiper-slide-fully-visible",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",lazyPreloaderClass:"swiper-lazy-preloader",lazyPreloadPrevNext:0,runCallbacksOnInit:!0,_emitClasses:!1};function dA(e,t){return function(r={}){const s=Object.keys(r)[0],o=r[s];if(typeof o!="object"||o===null){Ao(t,r);return}if(e[s]===!0&&(e[s]={enabled:!0}),s==="navigation"&&e[s]&&e[s].enabled&&!e[s].prevEl&&!e[s].nextEl&&(e[s].auto=!0),["pagination","scrollbar"].indexOf(s)>=0&&e[s]&&e[s].enabled&&!e[s].el&&(e[s].auto=!0),!(s in e&&"enabled"in o)){Ao(t,r);return}typeof e[s]=="object"&&!("enabled"in e[s])&&(e[s].enabled=!0),e[s]||(e[s]={enabled:!1}),Ao(t,r)}}const Df={eventsEmitter:l9,update:b9,translate:C9,transition:E9,slide:Q9,loop:$9,grabCursor:z9,events:tA,breakpoints:sA,checkOverflow:uA,classes:lA},Bf={};let fg=class Ja{constructor(...t){let n,r;t.length===1&&t[0].constructor&&Object.prototype.toString.call(t[0]).slice(8,-1)==="Object"?r=t[0]:[n,r]=t,r||(r={}),r=Ao({},r),n&&!r.el&&(r.el=n);const s=xc();if(r.el&&typeof r.el=="string"&&s.querySelectorAll(r.el).length>1){const h=[];return s.querySelectorAll(r.el).forEach(p=>{const g=Ao({},r,{el:p});h.push(new Ja(g))}),h}const o=this;o.__swiper__=!0,o.support=Ab(),o.device=Tb({userAgent:r.userAgent}),o.browser=Sb(),o.eventsListeners={},o.eventsAnyListeners=[],o.modules=[...o.__modules__],r.modules&&Array.isArray(r.modules)&&r.modules.forEach(h=>{typeof h=="function"&&o.modules.indexOf(h)<0&&o.modules.push(h)});const a={};o.modules.forEach(h=>{h({params:r,swiper:o,extendParams:dA(r,a),on:o.on.bind(o),once:o.once.bind(o),off:o.off.bind(o),emit:o.emit.bind(o)})});const d=Ao({},om,a);return o.params=Ao({},d,Bf,r),o.originalParams=Ao({},o.params),o.passedParams=Ao({},r),o.params&&o.params.on&&Object.keys(o.params.on).forEach(h=>{o.on(h,o.params.on[h])}),o.params&&o.params.onAny&&o.onAny(o.params.onAny),Object.assign(o,{enabled:o.params.enabled,el:n,classNames:[],slides:[],slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal(){return o.params.direction==="horizontal"},isVertical(){return o.params.direction==="vertical"},activeIndex:0,realIndex:0,isBeginning:!0,isEnd:!1,translate:0,previousTranslate:0,progress:0,velocity:0,animating:!1,cssOverflowAdjustment(){return Math.trunc(this.translate/2**23)*2**23},allowSlideNext:o.params.allowSlideNext,allowSlidePrev:o.params.allowSlidePrev,touchEventsData:{isTouched:void 0,isMoved:void 0,allowTouchCallbacks:void 0,touchStartTime:void 0,isScrolling:void 0,currentTranslate:void 0,startTranslate:void 0,allowThresholdMove:void 0,focusableElements:o.params.focusableElements,lastClickTime:0,clickTimeout:void 0,velocities:[],allowMomentumBounce:void 0,startMoving:void 0,pointerId:null,touchId:null},allowClick:!0,allowTouchMove:o.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),o.emit("_swiper"),o.params.init&&o.init(),o}getDirectionLabel(t){return this.isHorizontal()?t:{width:"height","margin-top":"margin-left","margin-bottom ":"margin-right","margin-left":"margin-top","margin-right":"margin-bottom","padding-left":"padding-top","padding-right":"padding-bottom",marginRight:"marginBottom"}[t]}getSlideIndex(t){const{slidesEl:n,params:r}=this,s=il(n,`.${r.slideClass}, swiper-slide`),o=K1(s[0]);return K1(t)-o}getSlideIndexByData(t){return this.getSlideIndex(this.slides.find(n=>n.getAttribute("data-swiper-slide-index")*1===t))}getSlideIndexWhenGrid(t){return this.grid&&this.params.grid&&this.params.grid.rows>1&&(this.params.grid.fill==="column"?t=Math.floor(t/this.params.grid.rows):this.params.grid.fill==="row"&&(t=t%Math.ceil(this.slides.length/this.params.grid.rows))),t}recalcSlides(){const t=this,{slidesEl:n,params:r}=t;t.slides=il(n,`.${r.slideClass}, swiper-slide`)}enable(){const t=this;t.enabled||(t.enabled=!0,t.params.grabCursor&&t.setGrabCursor(),t.emit("enable"))}disable(){const t=this;t.enabled&&(t.enabled=!1,t.params.grabCursor&&t.unsetGrabCursor(),t.emit("disable"))}setProgress(t,n){const r=this;t=Math.min(Math.max(t,0),1);const s=r.minTranslate(),a=(r.maxTranslate()-s)*t+s;r.translateTo(a,typeof n>"u"?0:n),r.updateActiveIndex(),r.updateSlidesClasses()}emitContainerClasses(){const t=this;if(!t.params._emitClasses||!t.el)return;const n=t.el.className.split(" ").filter(r=>r.indexOf("swiper")===0||r.indexOf(t.params.containerModifierClass)===0);t.emit("_containerClasses",n.join(" "))}getSlideClasses(t){const n=this;return n.destroyed?"":t.className.split(" ").filter(r=>r.indexOf("swiper-slide")===0||r.indexOf(n.params.slideClass)===0).join(" ")}emitSlidesClasses(){const t=this;if(!t.params._emitClasses||!t.el)return;const n=[];t.slides.forEach(r=>{const s=t.getSlideClasses(r);n.push({slideEl:r,classNames:s}),t.emit("_slideClass",r,s)}),t.emit("_slideClasses",n)}slidesPerViewDynamic(t="current",n=!1){const r=this,{params:s,slides:o,slidesGrid:a,slidesSizesGrid:d,size:h,activeIndex:p}=r;let g=1;if(typeof s.slidesPerView=="number")return s.slidesPerView;if(s.centeredSlides){let y=o[p]?Math.ceil(o[p].swiperSlideSize):0,b;for(let v=p+1;v<o.length;v+=1)o[v]&&!b&&(y+=Math.ceil(o[v].swiperSlideSize),g+=1,y>h&&(b=!0));for(let v=p-1;v>=0;v-=1)o[v]&&!b&&(y+=o[v].swiperSlideSize,g+=1,y>h&&(b=!0))}else if(t==="current")for(let y=p+1;y<o.length;y+=1)(n?a[y]+d[y]-a[p]<h:a[y]-a[p]<h)&&(g+=1);else for(let y=p-1;y>=0;y-=1)a[p]-a[y]<h&&(g+=1);return g}update(){const t=this;if(!t||t.destroyed)return;const{snapGrid:n,params:r}=t;r.breakpoints&&t.setBreakpoint(),[...t.el.querySelectorAll('[loading="lazy"]')].forEach(a=>{a.complete&&zd(t,a)}),t.updateSize(),t.updateSlides(),t.updateProgress(),t.updateSlidesClasses();function s(){const a=t.rtlTranslate?t.translate*-1:t.translate,d=Math.min(Math.max(a,t.maxTranslate()),t.minTranslate());t.setTranslate(d),t.updateActiveIndex(),t.updateSlidesClasses()}let o;if(r.freeMode&&r.freeMode.enabled&&!r.cssMode)s(),r.autoHeight&&t.updateAutoHeight();else{if((r.slidesPerView==="auto"||r.slidesPerView>1)&&t.isEnd&&!r.centeredSlides){const a=t.virtual&&r.virtual.enabled?t.virtual.slides:t.slides;o=t.slideTo(a.length-1,0,!1,!0)}else o=t.slideTo(t.activeIndex,0,!1,!0);o||s()}r.watchOverflow&&n!==t.snapGrid&&t.checkOverflow(),t.emit("update")}changeDirection(t,n=!0){const r=this,s=r.params.direction;return t||(t=s==="horizontal"?"vertical":"horizontal"),t===s||t!=="horizontal"&&t!=="vertical"||(r.el.classList.remove(`${r.params.containerModifierClass}${s}`),r.el.classList.add(`${r.params.containerModifierClass}${t}`),r.emitContainerClasses(),r.params.direction=t,r.slides.forEach(o=>{t==="vertical"?o.style.width="":o.style.height=""}),r.emit("changeDirection"),n&&r.update()),r}changeLanguageDirection(t){const n=this;n.rtl&&t==="rtl"||!n.rtl&&t==="ltr"||(n.rtl=t==="rtl",n.rtlTranslate=n.params.direction==="horizontal"&&n.rtl,n.rtl?(n.el.classList.add(`${n.params.containerModifierClass}rtl`),n.el.dir="rtl"):(n.el.classList.remove(`${n.params.containerModifierClass}rtl`),n.el.dir="ltr"),n.update())}mount(t){const n=this;if(n.mounted)return!0;let r=t||n.params.el;if(typeof r=="string"&&(r=document.querySelector(r)),!r)return!1;r.swiper=n,r.parentNode&&r.parentNode.host&&r.parentNode.host.nodeName===n.params.swiperElementNodeName.toUpperCase()&&(n.isElement=!0);const s=()=>`.${(n.params.wrapperClass||"").trim().split(" ").join(".")}`;let a=r&&r.shadowRoot&&r.shadowRoot.querySelector?r.shadowRoot.querySelector(s()):il(r,s())[0];return!a&&n.params.createElements&&(a=sm("div",n.params.wrapperClass),r.append(a),il(r,`.${n.params.slideClass}`).forEach(d=>{a.append(d)})),Object.assign(n,{el:r,wrapperEl:a,slidesEl:n.isElement&&!r.parentNode.host.slideSlots?r.parentNode.host:a,hostEl:n.isElement?r.parentNode.host:r,mounted:!0,rtl:r.dir.toLowerCase()==="rtl"||Bl(r,"direction")==="rtl",rtlTranslate:n.params.direction==="horizontal"&&(r.dir.toLowerCase()==="rtl"||Bl(r,"direction")==="rtl"),wrongRTL:Bl(a,"display")==="-webkit-box"}),!0}init(t){const n=this;if(n.initialized||n.mount(t)===!1)return n;n.emit("beforeInit"),n.params.breakpoints&&n.setBreakpoint(),n.addClasses(),n.updateSize(),n.updateSlides(),n.params.watchOverflow&&n.checkOverflow(),n.params.grabCursor&&n.enabled&&n.setGrabCursor(),n.params.loop&&n.virtual&&n.params.virtual.enabled?n.slideTo(n.params.initialSlide+n.virtual.slidesBefore,0,n.params.runCallbacksOnInit,!1,!0):n.slideTo(n.params.initialSlide,0,n.params.runCallbacksOnInit,!1,!0),n.params.loop&&n.loopCreate(void 0,!0),n.attachEvents();const s=[...n.el.querySelectorAll('[loading="lazy"]')];return n.isElement&&s.push(...n.hostEl.querySelectorAll('[loading="lazy"]')),s.forEach(o=>{o.complete?zd(n,o):o.addEventListener("load",a=>{zd(n,a.target)})}),im(n),n.initialized=!0,im(n),n.emit("init"),n.emit("afterInit"),n}destroy(t=!0,n=!0){const r=this,{params:s,el:o,wrapperEl:a,slides:d}=r;return typeof r.params>"u"||r.destroyed||(r.emit("beforeDestroy"),r.initialized=!1,r.detachEvents(),s.loop&&r.loopDestroy(),n&&(r.removeClasses(),o&&typeof o!="string"&&o.removeAttribute("style"),a&&a.removeAttribute("style"),d&&d.length&&d.forEach(h=>{h.classList.remove(s.slideVisibleClass,s.slideFullyVisibleClass,s.slideActiveClass,s.slideNextClass,s.slidePrevClass),h.removeAttribute("style"),h.removeAttribute("data-swiper-slide-index")})),r.emit("destroy"),Object.keys(r.eventsListeners).forEach(h=>{r.off(h)}),t!==!1&&(r.el&&typeof r.el!="string"&&(r.el.swiper=null),q8(r)),r.destroyed=!0),null}static extendDefaults(t){Ao(Bf,t)}static get extendedDefaults(){return Bf}static get defaults(){return om}static installModule(t){Ja.prototype.__modules__||(Ja.prototype.__modules__=[]);const n=Ja.prototype.__modules__;typeof t=="function"&&n.indexOf(t)<0&&n.push(t)}static use(t){return Array.isArray(t)?(t.forEach(n=>Ja.installModule(n)),Ja):(Ja.installModule(t),Ja)}};Object.keys(Df).forEach(e=>{Object.keys(Df[e]).forEach(t=>{fg.prototype[t]=Df[e][t]})});fg.use([o9,a9]);const Lb=["eventsPrefix","injectStyles","injectStylesUrls","modules","init","_direction","oneWayMovement","swiperElementNodeName","touchEventsTarget","initialSlide","_speed","cssMode","updateOnWindowResize","resizeObserver","nested","focusableElements","_enabled","_width","_height","preventInteractionOnTransition","userAgent","url","_edgeSwipeDetection","_edgeSwipeThreshold","_freeMode","_autoHeight","setWrapperSize","virtualTranslate","_effect","breakpoints","breakpointsBase","_spaceBetween","_slidesPerView","maxBackfaceHiddenSlides","_grid","_slidesPerGroup","_slidesPerGroupSkip","_slidesPerGroupAuto","_centeredSlides","_centeredSlidesBounds","_slidesOffsetBefore","_slidesOffsetAfter","normalizeSlideIndex","_centerInsufficientSlides","_snapToSlideEdge","_watchOverflow","roundLengths","touchRatio","touchAngle","simulateTouch","_shortSwipes","_longSwipes","longSwipesRatio","longSwipesMs","_followFinger","allowTouchMove","_threshold","touchMoveStopPropagation","touchStartPreventDefault","touchStartForcePreventDefault","touchReleaseOnEdges","uniqueNavElements","_resistance","_resistanceRatio","_watchSlidesProgress","_grabCursor","preventClicks","preventClicksPropagation","_slideToClickedSlide","_loop","loopAdditionalSlides","loopAddBlankSlides","loopPreventsSliding","_rewind","_allowSlidePrev","_allowSlideNext","_swipeHandler","_noSwiping","noSwipingClass","noSwipingSelector","passiveListeners","containerModifierClass","slideClass","slideActiveClass","slideVisibleClass","slideFullyVisibleClass","slideNextClass","slidePrevClass","slideBlankClass","wrapperClass","lazyPreloaderClass","lazyPreloadPrevNext","runCallbacksOnInit","observer","observeParents","observeSlideChildren","a11y","_autoplay","_controller","coverflowEffect","cubeEffect","fadeEffect","flipEffect","creativeEffect","cardsEffect","hashNavigation","history","keyboard","mousewheel","_navigation","_pagination","parallax","_scrollbar","_thumbs","virtual","zoom","control"];function hc(e){return typeof e=="object"&&e!==null&&e.constructor&&Object.prototype.toString.call(e).slice(8,-1)==="Object"&&!e.__swiper__}function tu(e,t){const n=["__proto__","constructor","prototype"];Object.keys(t).filter(r=>n.indexOf(r)<0).forEach(r=>{typeof e[r]>"u"?e[r]=t[r]:hc(t[r])&&hc(e[r])&&Object.keys(t[r]).length>0?t[r].__swiper__?e[r]=t[r]:tu(e[r],t[r]):e[r]=t[r]})}function kb(e={}){return e.navigation&&typeof e.navigation.nextEl>"u"&&typeof e.navigation.prevEl>"u"}function Eb(e={}){return e.pagination&&typeof e.pagination.el>"u"}function Ib(e={}){return e.scrollbar&&typeof e.scrollbar.el>"u"}function Rb(e=""){const t=e.split(" ").map(r=>r.trim()).filter(r=>!!r),n=[];return t.forEach(r=>{n.indexOf(r)<0&&n.push(r)}),n.join(" ")}function hA(e=""){return e?e.includes("swiper-wrapper")?e:`swiper-wrapper ${e}`:"swiper-wrapper"}function fA({swiper:e,slides:t,passedParams:n,changedParams:r,nextEl:s,prevEl:o,scrollbarEl:a,paginationEl:d}){const h=r.filter(H=>H!=="children"&&H!=="direction"&&H!=="wrapperClass"),{params:p,pagination:g,navigation:y,scrollbar:b,virtual:v,thumbs:T}=e;let A,L,R,D,B,j,P,$;r.includes("thumbs")&&n.thumbs&&n.thumbs.swiper&&!n.thumbs.swiper.destroyed&&p.thumbs&&(!p.thumbs.swiper||p.thumbs.swiper.destroyed)&&(A=!0),r.includes("controller")&&n.controller&&n.controller.control&&p.controller&&!p.controller.control&&(L=!0),r.includes("pagination")&&n.pagination&&(n.pagination.el||d)&&(p.pagination||p.pagination===!1)&&g&&!g.el&&(R=!0),r.includes("scrollbar")&&n.scrollbar&&(n.scrollbar.el||a)&&(p.scrollbar||p.scrollbar===!1)&&b&&!b.el&&(D=!0),r.includes("navigation")&&n.navigation&&(n.navigation.prevEl||o)&&(n.navigation.nextEl||s)&&(p.navigation||p.navigation===!1)&&y&&!y.prevEl&&!y.nextEl&&(B=!0);const z=H=>{e[H]&&(e[H].destroy(),H==="navigation"?(e.isElement&&(e[H].prevEl.remove(),e[H].nextEl.remove()),p[H].prevEl=void 0,p[H].nextEl=void 0,e[H].prevEl=void 0,e[H].nextEl=void 0):(e.isElement&&e[H].el.remove(),p[H].el=void 0,e[H].el=void 0))};r.includes("loop")&&e.isElement&&(p.loop&&!n.loop?j=!0:!p.loop&&n.loop?P=!0:$=!0),h.forEach(H=>{if(hc(p[H])&&hc(n[H]))Object.assign(p[H],n[H]),(H==="navigation"||H==="pagination"||H==="scrollbar")&&"enabled"in n[H]&&!n[H].enabled&&z(H);else{const ye=n[H];(ye===!0||ye===!1)&&(H==="navigation"||H==="pagination"||H==="scrollbar")?ye===!1&&z(H):p[H]=n[H]}}),h.includes("controller")&&!L&&e.controller&&e.controller.control&&p.controller&&p.controller.control&&(e.controller.control=p.controller.control),r.includes("children")&&t&&v&&p.virtual.enabled?(v.slides=t,v.update(!0)):r.includes("virtual")&&v&&p.virtual.enabled&&(t&&(v.slides=t),v.update(!0)),r.includes("children")&&t&&p.loop&&($=!0),A&&T.init()&&T.update(!0),L&&(e.controller.control=p.controller.control),R&&(e.isElement&&(!d||typeof d=="string")&&(d=document.createElement("div"),d.classList.add("swiper-pagination"),d.part.add("pagination"),e.el.appendChild(d)),d&&(p.pagination.el=d),g.init(),g.render(),g.update()),D&&(e.isElement&&(!a||typeof a=="string")&&(a=document.createElement("div"),a.classList.add("swiper-scrollbar"),a.part.add("scrollbar"),e.el.appendChild(a)),a&&(p.scrollbar.el=a),b.init(),b.updateSize(),b.setTranslate()),B&&(e.isElement&&((!s||typeof s=="string")&&(s=document.createElement("div"),s.classList.add("swiper-button-next"),J1(s,e.navigation.arrowSvg),s.part.add("button-next"),e.el.appendChild(s)),(!o||typeof o=="string")&&(o=document.createElement("div"),o.classList.add("swiper-button-prev"),J1(o,e.navigation.arrowSvg),o.part.add("button-prev"),e.el.appendChild(o))),s&&(p.navigation.nextEl=s),o&&(p.navigation.prevEl=o),y.init(),y.update()),r.includes("allowSlideNext")&&(e.allowSlideNext=n.allowSlideNext),r.includes("allowSlidePrev")&&(e.allowSlidePrev=n.allowSlidePrev),r.includes("direction")&&e.changeDirection(n.direction,!1),(j||$)&&e.loopDestroy(),(P||$)&&e.loopCreate(),e.update()}function pA(e={},t=!0){const n={on:{}},r={},s={};tu(n,om),n._emitClasses=!0,n.init=!1;const o={},a=Lb.map(h=>h.replace(/_/,"")),d=Object.assign({},e);return Object.keys(d).forEach(h=>{typeof e[h]>"u"||(a.indexOf(h)>=0?hc(e[h])?(n[h]={},s[h]={},tu(n[h],e[h]),tu(s[h],e[h])):(n[h]=e[h],s[h]=e[h]):h.search(/on[A-Z]/)===0&&typeof e[h]=="function"?t?r[`${h[2].toLowerCase()}${h.substr(3)}`]=e[h]:n.on[`${h[2].toLowerCase()}${h.substr(3)}`]=e[h]:o[h]=e[h])}),["navigation","pagination","scrollbar"].forEach(h=>{n[h]===!0&&(n[h]={}),n[h]===!1&&delete n[h]}),{params:n,passedParams:s,rest:o,events:r}}function mA({el:e,nextEl:t,prevEl:n,paginationEl:r,scrollbarEl:s,swiper:o},a){kb(a)&&t&&n&&(o.params.navigation.nextEl=t,o.originalParams.navigation.nextEl=t,o.params.navigation.prevEl=n,o.originalParams.navigation.prevEl=n),Eb(a)&&r&&(o.params.pagination.el=r,o.originalParams.pagination.el=r),Ib(a)&&s&&(o.params.scrollbar.el=s,o.originalParams.scrollbar.el=s),o.init(e)}function gA(e,t,n,r,s){const o=[];if(!t)return o;const a=h=>{o.indexOf(h)<0&&o.push(h)};if(n&&r){const h=r.map(s),p=n.map(s);h.join("")!==p.join("")&&a("children"),r.length!==n.length&&a("children")}return Lb.filter(h=>h[0]==="_").map(h=>h.replace(/_/,"")).forEach(h=>{if(h in e&&h in t)if(hc(e[h])&&hc(t[h])){const p=Object.keys(e[h]),g=Object.keys(t[h]);p.length!==g.length?a(h):(p.forEach(y=>{e[h][y]!==t[h][y]&&a(h)}),g.forEach(y=>{e[h][y]!==t[h][y]&&a(h)}))}else e[h]!==t[h]&&a(h)}),o}const xA=e=>{!e||e.destroyed||!e.params.virtual||e.params.virtual&&!e.params.virtual.enabled||(e.updateSlides(),e.updateProgress(),e.updateSlidesClasses(),e.emit("_virtualUpdated"),e.parallax&&e.params.parallax&&e.params.parallax.enabled&&e.parallax.setTranslate())};function uh(){return uh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uh.apply(this,arguments)}function Mb(e){return e.type&&e.type.displayName&&e.type.displayName.includes("SwiperSlide")}function Nb(e){const t=[];return _.Children.toArray(e).forEach(n=>{Mb(n)?t.push(n):n.props&&n.props.children&&Nb(n.props.children).forEach(r=>t.push(r))}),t}function yA(e){const t=[],n={"container-start":[],"container-end":[],"wrapper-start":[],"wrapper-end":[]};return _.Children.toArray(e).forEach(r=>{if(Mb(r))t.push(r);else if(r.props&&r.props.slot&&n[r.props.slot])n[r.props.slot].push(r);else if(r.props&&r.props.children){const s=Nb(r.props.children);s.length>0?s.forEach(o=>t.push(o)):n["container-end"].push(r)}else n["container-end"].push(r)}),{slides:t,slots:n}}function bA(e,t,n){if(!n)return null;const r=g=>{let y=g;return g<0?y=t.length+g:y>=t.length&&(y=y-t.length),y},s=e.isHorizontal()?{[e.rtlTranslate?"right":"left"]:`${n.offset}px`}:{top:`${n.offset}px`},{from:o,to:a}=n,d=e.params.loop?-t.length:0,h=e.params.loop?t.length*2:t.length,p=[];for(let g=d;g<h;g+=1)g>=o&&g<=a&&p.push(t[r(g)]);return p.map((g,y)=>_.cloneElement(g,{swiper:e,style:s,key:g.props.virtualIndex||g.key||`slide-${y}`}))}function w0(e,t){return typeof window>"u"?S.useEffect(e,t):S.useLayoutEffect(e,t)}const s2=S.createContext(null),vA=S.createContext(null),Db=S.forwardRef(({className:e,tag:t="div",wrapperTag:n="div",children:r,onSwiper:s,...o}={},a)=>{let d=!1;const[h,p]=S.useState("swiper"),[g,y]=S.useState(null),[b,v]=S.useState(!1),T=S.useRef(!1),A=S.useRef(null),L=S.useRef(null),R=S.useRef(null),D=S.useRef(null),B=S.useRef(null),j=S.useRef(null),P=S.useRef(null),$=S.useRef(null),{params:z,passedParams:H,rest:ye,events:q}=pA(o),{slides:te,slots:ve}=yA(r),ge=()=>{v(!b)};Object.assign(z.on,{_containerClasses(K,be){p(be)}});const ie=()=>{Object.assign(z.on,q),d=!0;const K={...z};if(delete K.wrapperClass,L.current=new fg(K),L.current.virtual&&L.current.params.virtual.enabled){L.current.virtual.slides=te;const be={cache:!1,slides:te,renderExternal:y,renderExternalUpdate:!1};tu(L.current.params.virtual,be),tu(L.current.originalParams.virtual,be)}};A.current||ie(),L.current&&L.current.on("_beforeBreakpoint",ge);const Ae=()=>{d||!q||!L.current||Object.keys(q).forEach(K=>{L.current.on(K,q[K])})},xe=()=>{!q||!L.current||Object.keys(q).forEach(K=>{L.current.off(K,q[K])})};S.useEffect(()=>()=>{L.current&&L.current.off("_beforeBreakpoint",ge)}),S.useEffect(()=>{!T.current&&L.current&&(L.current.emitSlidesClasses(),T.current=!0)}),w0(()=>{if(a&&(a.current=A.current),!!A.current)return L.current.destroyed&&ie(),mA({el:A.current,nextEl:B.current,prevEl:j.current,paginationEl:P.current,scrollbarEl:$.current,swiper:L.current},z),s&&!L.current.destroyed&&s(L.current),()=>{L.current&&!L.current.destroyed&&L.current.destroy(!0,!1)}},[]),w0(()=>{Ae();const K=gA(H,R.current,te,D.current,be=>be.key);return R.current=H,D.current=te,K.length&&L.current&&!L.current.destroyed&&fA({swiper:L.current,slides:te,passedParams:H,changedParams:K,nextEl:B.current,prevEl:j.current,scrollbarEl:$.current,paginationEl:P.current}),()=>{xe()}}),w0(()=>{xA(L.current)},[g]);function ce(){return z.virtual?bA(L.current,te,g):te.map((K,be)=>_.cloneElement(K,{swiper:L.current,swiperSlideIndex:be}))}return _.createElement(t,uh({ref:A,className:Rb(`${h}${e?` ${e}`:""}`)},ye),_.createElement(vA.Provider,{value:L.current},ve["container-start"],_.createElement(n,{className:hA(z.wrapperClass)},ve["wrapper-start"],ce(),ve["wrapper-end"]),kb(z)&&_.createElement(_.Fragment,null,_.createElement("div",{ref:j,className:"swiper-button-prev"}),_.createElement("div",{ref:B,className:"swiper-button-next"})),Ib(z)&&_.createElement("div",{ref:$,className:"swiper-scrollbar"}),Eb(z)&&_.createElement("div",{ref:P,className:"swiper-pagination"}),ve["container-end"]))});Db.displayName="Swiper";const Bb=S.forwardRef(({tag:e="div",children:t,className:n="",swiper:r,zoom:s,lazy:o,virtualIndex:a,swiperSlideIndex:d,...h}={},p)=>{const g=S.useRef(null),[y,b]=S.useState("swiper-slide"),[v,T]=S.useState(!1);function A(B,j,P){j===g.current&&b(P)}w0(()=>{if(typeof d<"u"&&(g.current.swiperSlideIndex=d),p&&(p.current=g.current),!(!g.current||!r)){if(r.destroyed){y!=="swiper-slide"&&b("swiper-slide");return}return r.on("_slideClass",A),()=>{r&&r.off("_slideClass",A)}}}),w0(()=>{r&&g.current&&!r.destroyed&&b(r.getSlideClasses(g.current))},[r]);const L={isActive:y.indexOf("swiper-slide-active")>=0,isVisible:y.indexOf("swiper-slide-visible")>=0,isFullyVisible:y.indexOf("swiper-slide-fully-visible")>=0,isPrev:y.indexOf("swiper-slide-prev")>=0,isNext:y.indexOf("swiper-slide-next")>=0},R=()=>typeof t=="function"?t(L):t,D=()=>{T(!0)};return _.createElement(e,uh({ref:g,className:Rb(`${y}${n?` ${n}`:""}`),"data-swiper-slide-index":a,onLoad:D},h),s&&_.createElement(s2.Provider,{value:L},_.createElement("div",{className:"swiper-zoom-container","data-swiper-zoom":typeof s=="number"?s:void 0},R(),o&&!v&&_.createElement("div",{className:"swiper-lazy-preloader",ref:B=>{B&&(B.lazyPreloaderManaged=!0)}}))),!s&&_.createElement(s2.Provider,{value:L},R(),o&&!v&&_.createElement("div",{className:"swiper-lazy-preloader",ref:B=>{B&&(B.lazyPreloaderManaged=!0)}})))});Bb.displayName="SwiperSlide";const wA=4*1024*1024,AA=256*1024,TA=1440*6e4;let nu=0,i2;function pg(){return typeof indexedDB>"u"?Promise.resolve(null):i2??=new Promise(e=>{const t=indexedDB.open("termdock-terminal-snapshots",1);t.onupgradeneeded=()=>t.result.createObjectStore("snapshots",{keyPath:"id"}),t.onerror=()=>e(null),t.onblocked=()=>e(null),t.onsuccess=()=>{t.result.onversionchange=()=>{t.result.close(),i2=void 0},e(t.result)}})}function am(e){return!!e&&e.version===1&&typeof e.epoch=="string"&&e.epoch.length>0&&Number.isSafeInteger(e.cols)&&e.cols>0&&Number.isSafeInteger(e.rows)&&e.rows>0&&Number.isSafeInteger(e.seq)&&e.seq>0&&typeof e.data=="string"&&e.data.length*2<=AA&&e.savedAt<=Date.now()&&Date.now()-e.savedAt<TA}async function SA(e){const t=nu;try{const n=await pg();return!n||t!==nu?null:await new Promise(r=>{const s=n.transaction("snapshots").objectStore("snapshots").get(e);s.onerror=()=>r(null),s.onsuccess=()=>r(t===nu&&am(s.result)?s.result:null)})}catch{return null}}async function CA(e){const t=nu;if(am(e))try{const n=await pg();if(!n||t!==nu)return;await new Promise(r=>{const s=n.transaction("snapshots","readwrite"),o=s.objectStore("snapshots");o.put(e);const a=o.getAll();a.onsuccess=()=>{let d=0,h=0;for(const p of a.result.sort((g,y)=>y.savedAt-g.savedAt))d+=p.data.length*2,(++h>32||d>wA||!am(p))&&o.delete(p.id)},s.oncomplete=()=>r(),s.onerror=s.onabort=()=>r()})}catch{}}async function Pb(){nu+=1;try{(await pg())?.transaction("snapshots","readwrite").objectStore("snapshots").clear()}catch{}}typeof window<"u"&&window.addEventListener("auth:unauthorized",()=>{Pb()});const el=new Map,Dl=new Map,_A=32*1024*1024,LA=8*1024*1024,kA=48;let p0=0,lm=0;function mg(){lm+=1,el.clear(),p0=0;for(const e of Dl.values())e.controller.abort();Dl.clear()}typeof window<"u"&&window.addEventListener("auth:unauthorized",mg);function EA(e,t){const n=el.get(e);if(n&&(p0-=n.blob.size,el.delete(e)),!(t.blob.size>LA))for(el.set(e,t),p0+=t.blob.size;el.size>kA||p0>_A;){const r=el.keys().next().value;p0-=el.get(r).blob.size,el.delete(r)}}async function Qb(e,t={}){const n=new URL(e,typeof location<"u"?location.origin:"http://localhost");if(!/^\/api\/terminal\/fs\/(read|blob)$/.test(n.pathname))return fetch(e,{signal:t.signal});if(t.signal?.aborted)throw t.signal.reason??new DOMException("Aborted","AbortError");n.searchParams.delete("requestSlotId"),n.searchParams.delete("action"),n.searchParams.sort();const r=n.href;let s=Dl.get(r);if(!s){const a=new AbortController,d=lm,h=el.get(r),p=new Headers,g=h?.headers.get("ETag");g&&p.set("If-None-Match",g);const y=setTimeout(()=>a.abort(new DOMException("File preview timed out. Please retry.","TimeoutError")),t.timeoutMs??15e3),b={controller:a,readers:0,promise:Promise.resolve(null)};b.promise=(async()=>{const v=await fetch(r,{headers:p,signal:a.signal,cache:"no-cache"});let T;return v.status===304&&h?T=h:T={blob:await v.blob(),headers:new Headers(v.headers),status:v.status},lm===d&&!a.signal.aborted&&T.status===200&&T.headers.has("ETag")&&EA(r,T),v.status===401&&mg(),T})().finally(()=>{clearTimeout(y),Dl.get(r)===b&&Dl.delete(r)}),s=b,Dl.set(r,s)}const o=s;return o.readers+=1,new Promise((a,d)=>{let h=!1;const p=()=>h?!1:(h=!0,t.signal?.removeEventListener("abort",g),o.readers-=1,o.readers===0&&Dl.get(r)===o&&(Dl.delete(r),o.controller.abort()),!0),g=()=>{p()&&d(t.signal?.reason??new DOMException("Aborted","AbortError"))};if(t.signal?.addEventListener("abort",g,{once:!0}),t.signal?.aborted){g();return}o.promise.then(y=>{p()&&a(new Response(y.blob,{status:y.status,headers:y.headers}))},y=>{p()&&d(y)})})}const E0="auth:unauthorized";let rc=null;class Lo extends Error{constructor(t,n,r){super(t),this.status=n,this.code=r,this.name="TerminalApiError"}status;code}async function IA(){const e=await fetch("/api/terminal/update");if(!e.ok)throw new Lo("Failed to load update state",e.status);return e.json()}async function RA(){const e=await xn(),t=await fetch("/api/terminal/update/check",{method:"POST",headers:{"X-XSRF-TOKEN":e}});if(!t.ok)throw new Lo("Failed to check for updates",t.status);return t.json()}async function MA(){const e=await xn(),t=await fetch("/api/terminal/update/restart",{method:"POST",headers:{"X-XSRF-TOKEN":e}});if(!t.ok){const n=await t.json().catch(()=>({error:"Failed to restart Termdock"}));throw new Lo(n.error||"Failed to restart Termdock",t.status)}return t.json()}async function NA(){const e=await fetch("/api/terminal/quota");if(!e.ok)throw new Lo("Failed to fetch quota",e.status);return e.json()}async function DA(){const e=await xn(),t=await fetch("/api/terminal/quota/refresh",{method:"POST",headers:{"X-XSRF-TOKEN":e}});if(!t.ok)throw new Lo("Failed to refresh quota",t.status);return t.json()}const yc=8e3,BA=6e4,PA=32e3,QA=125e3,ja=1e4,ru=45e3,OA=8e3,FA=8e3,jA=15e3,$A=1e4,lu=5e3;let UA=0;const Gd=[];let Pf=!1;function Cl(e,t={}){if(typeof window>"u")return;const n=JSON.stringify({level:e==="error"||e==="timeout_or_abort"||e==="response_body_timeout"||e==="response_body_parse_error"?"warn":"info",message:`DIFF_API ${e}`,data:{seq:++UA,ts:Date.now(),...t}});Gd.push(n),HA()}async function HA(){if(!Pf){Pf=!0;try{for(;Gd.length>0;){const e=Gd[0];try{await fetch("/api/client-log",{method:"POST",headers:{"Content-Type":"application/json"},body:e,keepalive:!0}),Gd.shift()}catch{break}}}finally{Pf=!1}}}function gg(e,t,n){const r=new AbortController;let s=setTimeout(()=>{r.abort(new DOMException(n,"TimeoutError"))},t);const o=()=>r.abort(e?.reason);return e&&(e.aborted?o():e.addEventListener("abort",o,{once:!0})),{signal:r.signal,cleanup:()=>{s&&(clearTimeout(s),s=null),e?.removeEventListener("abort",o)}}}async function os(e,t,n,r){const{signal:s,cleanup:o}=gg(t?.signal??void 0,n,r);try{return await fetch(e,{...t,signal:s})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(r):a}finally{o()}}async function Ob(e,t,n){let r=null;const s=new Promise((o,a)=>{r=setTimeout(()=>a(new Error(n)),t)});try{return await Promise.race([e.text(),s])}finally{r&&clearTimeout(r)}}async function cu(e,t,n){const r=await Ob(e,t,n);return JSON.parse(r)}if(typeof window<"u"&&!window.__termdockFetchPatched){window.__termdockFetchPatched=!0;const e=window.fetch.bind(window);window.fetch=async(...t)=>{const n=await e(...t);if(n.status===401){rc=null;try{window.dispatchEvent(new CustomEvent(E0))}catch{}}return n}}async function xn(){if(rc)return rc;const e=await os("/api/csrf-token",void 0,OA,"CSRF token request timed out");if(!e.ok)throw new Error("Failed to get CSRF token");const t=await cu(e,lu,"CSRF token response timed out");if(!t.csrfToken)throw new Error("Invalid CSRF token response");return rc=t.csrfToken,rc}function Fb(){rc=null}const zA=2e4,o2=8e3,GA=1500,WA=250,bs=new Map,xg=new Map,VA=24,qA=40,YA=40;function ZA(e){return e.retryState.retryCount>=2||e.pendingInputs.length>=YA?"congested":e.retryState.retryCount>=1||e.pendingInputs.length>=8?"degraded":"good"}function a2(e){if(e.pendingInputs.length===0||e.ws.readyState!==WebSocket.OPEN)return;const t=e.pendingInputs.splice(0);for(const n of t)try{e.ws.send(JSON.stringify({type:"input",data:n}))}catch{}}function jb(e){if(e.ws.readyState!==WebSocket.OPEN)return;const t=ZA(e);if(t==="good"){a2(e);return}if(e.inputFlushTimer)return;const n=t==="congested"?qA:VA;e.inputFlushTimer=setTimeout(()=>{e.inputFlushTimer=null,a2(e)},n)}const A0=new Map;function KA(e,t,n,r){const s=A0.get(e);s&&(A0.delete(e),t?s.resolve({success:!0,layout:n}):s.reject(new Error(r||"Tmux action failed")))}const Wc=new Map;function XA(e,t,n,r){const o=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/api/terminal/${e}/ws`,a=new URLSearchParams({flow:"2",transport:"tmux-client",active:xg.get(e)===!1?"0":"1"});t>0&&a.set("since",String(t)),n&&a.set("epoch",n);const d=r??Wc.get(e);return d&&(a.set("cols",String(d.cols)),a.set("rows",String(d.rows))),`${o}?${a}`}const cm=new Map,um=new Map;function JA(e,t,n){cm.set(e,t),um.set(e,n)}function eT(e){const t=bs.get(e);return t?.streamEpoch&&t.appliedSeq===t.lastSeq&&t.lastSeq>0?{seq:t.lastSeq,epoch:t.streamEpoch}:null}async function tT(e){const t=await xn(),n=await fetch("/api/terminal/create",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify({cols:e.cols||80,rows:e.rows||24,mode:e.mode||"shell",tmuxSessionName:e.tmuxSessionName,cwd:e.cwd,termType:e.termType})});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to create terminal"}));throw new Error(r.error||"Failed to create terminal session")}return n.json()}function nT(e,t,n,r={}){const{maxRetries:s=10,initialRetryDelay:o=1e3,maxRetryDelay:a=2e4,connectionTimeout:d=15e3}=r,h={maxRetries:s,initialDelayMs:o,maxDelayMs:a,connectionTimeoutMs:d,retryCount:0,retryTimeout:null,connectionTimeoutId:null,isClosed:!1,isSuspended:!1};let p=null,g=cm.get(e)??0,y=um.get(e);um.delete(e),cm.delete(e);const b=[];let v=!1,T=null;const A=new WeakSet,L=()=>{h.retryTimeout&&(clearTimeout(h.retryTimeout),h.retryTimeout=null),h.connectionTimeoutId&&(clearTimeout(h.connectionTimeoutId),h.connectionTimeoutId=null),T&&(clearTimeout(T),T=null)},R=$=>{$.wakeProbe&&(clearTimeout($.wakeProbe.timer),$.wakeProbe=void 0),$.heartbeatTimer&&(clearInterval($.heartbeatTimer),$.heartbeatTimer=null),$.pongTimer&&(clearTimeout($.pongTimer),$.pongTimer=null),$.inputFlushTimer&&(clearTimeout($.inputFlushTimer),$.inputFlushTimer=null)},D=$=>{R($),$.heartbeatTimer=setInterval(()=>{if($.ws.readyState===WebSocket.OPEN){try{$.ws.send(JSON.stringify({type:"ping"}))}catch{}$.pongTimer&&clearTimeout($.pongTimer),$.pongTimer=setTimeout(()=>{if(Date.now()-$.lastInboundAt>=o2){v=!0,R($);try{$.ws.close()}catch{}P(new Error("WebSocket heartbeat timeout"),!1)}},o2)}},zA)},B=()=>{if(h.isClosed=!0,L(),p){R(p),bs.delete(e);try{p.ws.close()}catch{}p=null}},j=()=>{if(h.isClosed)return;if(p){A.add(p.ws),R(p);try{p.ws.close()}catch{}}const $=XA(e,g,y,r.getDimensions?.()),z=new WebSocket($);v=!1,h.connectionTimeoutId=setTimeout(()=>{z.readyState!==WebSocket.OPEN&&(v=!0,z.close(),P(new Error("WebSocket connection timeout"),!1))},d);const H={ws:z,onEvent:t,onError:n,reconnectNow:()=>{if(!h.isClosed&&(h.isSuspended=!1,!T)){if(L(),p){A.add(p.ws),R(p);try{p.ws.close()}catch{}}t({type:"reconnecting",attempt:Math.min(h.retryCount+1,s),maxAttempts:s}),h.retryCount=Math.min(h.retryCount+1,s),v=!0,T=setTimeout(()=>{T=null,v=!1,j()},0)}},suspendReconnect:()=>{h.isClosed||(h.isSuspended=!0,h.retryTimeout&&(clearTimeout(h.retryTimeout),h.retryTimeout=null))},retryState:h,lastSeq:g,pendingInputs:b,inputFlushTimer:null,heartbeatTimer:null,pongTimer:null,lastInboundAt:Date.now(),inboundSequence:0};z.onopen=()=>{h.isClosed||A.has(z)||v||(L(),h.retryCount=0,H.lastInboundAt=Date.now(),H.inboundSequence+=1,D(H),jb(H))},z.onmessage=ye=>{if(!(h.isClosed||A.has(z)||v)){H.lastInboundAt=Date.now(),H.inboundSequence+=1;try{const q=JSON.parse(ye.data);if(H.wakeProbe&&bs.get(e)===H){const ve=H.wakeProbe;H.wakeProbe=void 0,clearTimeout(ve.timer);for(const ge of ve.listeners)ge()}if(q.type==="pong"){H.pongTimer&&(clearTimeout(H.pongTimer),H.pongTimer=null);return}if(q.type==="tmux-result"&&q.reqId){KA(q.reqId,q.success!==!1,q.layout,q.error);return}if(q.type==="tmux-layout"&&q.layout){t({type:"tmux-layout",layout:q.layout});return}if(q.type==="tmux-screen-sync"&&Array.isArray(q.chunks)){t({type:"tmux-screen-sync",chunks:q.chunks.filter(ve=>typeof ve=="string"),cols:typeof q.cols=="number"?q.cols:void 0,rows:typeof q.rows=="number"?q.rows:void 0,generation:typeof q.generation=="number"?q.generation:void 0});return}if(q.type==="active-program"){t({type:"active-program",activeProgram:q.activeProgram,activeProgramRaw:q.activeProgramRaw,activeProgramSource:q.activeProgramSource});return}if(q.type==="cwd"){t({type:"cwd",cwd:q.cwd});return}if(q.type==="agent-status"){t({type:"agent-status",agentStatus:q.agentStatus??null,agentIndicator:q.agentIndicator??null,agentStatusDetail:q.agentStatusDetail??null,agent:q.agent??null,agentMessage:q.agentMessage??null,agentNativeSessionId:q.agentNativeSessionId??null,agentResumeRecovered:q.agentResumeRecovered===!0,agentRich:q.agentRich===!0,agentActivity:typeof q.agentActivity=="number"?q.agentActivity:0,agentCwd:q.agentCwd??null,reviewed:typeof q.reviewed=="boolean"?q.reviewed:null});return}if(q.type==="git-status"){t({type:"git-status",gitStatus:q.gitStatus??null});return}if(q.type==="quota-status"&&Array.isArray(q.providers)){window.dispatchEvent(new CustomEvent("termdock:quota-update",{detail:q.providers}));return}if(q.type==="focus-mode"){t({type:"focus-mode",focusTrackingRequested:q.focusTrackingRequested===!0});return}if(q.type==="resize-ack"){t({type:"resize-ack",seq:typeof q.seq=="number"?q.seq:void 0,cols:typeof q.cols=="number"?q.cols:void 0,rows:typeof q.rows=="number"?q.rows:void 0,ok:q.ok!==!1,error:typeof q.error=="string"?q.error:void 0,screenSyncPending:q.screenSyncPending===!0,screenSyncGeneration:typeof q.screenSyncGeneration=="number"?q.screenSyncGeneration:void 0});return}if(q.type==="pty-size"){t({type:"pty-size",cols:typeof q.cols=="number"?q.cols:void 0,rows:typeof q.rows=="number"?q.rows:void 0,source:typeof q.source=="string"?q.source:void 0});return}if(q.type==="shell-title"){t({type:"shell-title",title:typeof q.title=="string"?q.title:""});return}if(q.type==="prompt-state"){t({type:"prompt-state",state:q.state==="running"?"running":"idle",exitCode:typeof q.exitCode=="number"?q.exitCode:void 0});return}const te=q;if(te.type==="connected"){H.appliedSeq=void 0,y=te.streamEpoch,H.streamEpoch=y,H.outputProtocol=te.outputProtocol,typeof te.replayLastSeq=="number"&&te.replayLastSeq>=0&&(g=te.replayLastSeq,H.lastSeq=g),t(te),Ub(e,xg.get(e)??!0);return}if(te.type==="exit"){B(),t(te);return}if(te.type==="data"){if(H.appliedSeq=void 0,typeof te.seq=="number"&&te.seq<=g)return;typeof te.flowSeq=="number"&&(H.flowSeq=te.flowSeq)}t(te),te.type==="data"&&typeof te.seq=="number"&&Number.isFinite(te.seq)&&te.seq>g&&(g=te.seq,H.lastSeq=g)}catch(q){n?.(q,!1)}}},z.onerror=()=>{h.isClosed||A.has(z)||v||(L(),R(H),v||(v=!0,P(new Error("WebSocket connection error"),!1)))},z.onclose=ye=>{if(!(h.isClosed||A.has(z)||v)){if(L(),R(H),v=!0,ye.code===4001){console.warn("[Terminal] WS 4001: Session not found on server",{code:ye.code,reason:ye.reason,stack:new Error().stack}),P(new Error("Session not found on server"),!0);return}if(ye.code===4003||ye.code===4401){try{window.dispatchEvent(new CustomEvent(E0))}catch{}P(new Error("Authentication required"),!0);return}P(new Error("WebSocket connection closed"),!1)}},p=H,bs.set(e,p)},P=($,z)=>{if(!h.isClosed)if(z)n?.($,!0),B();else{h.retryCount=Math.min(h.retryCount+1,Math.max(1,s));const H=Math.min(o*Math.pow(2,h.retryCount-1),a);if(t({type:"reconnecting",attempt:h.retryCount,maxAttempts:s}),h.isSuspended)return;h.retryTimeout=setTimeout(()=>{h.isClosed||j()},H)}};return j(),B}async function $b(e,t){const n=bs.get(e);if(n){if(n.ws.readyState===WebSocket.OPEN){n.pendingInputs.push(t),jb(n);return}if(n.ws.readyState===WebSocket.CONNECTING){n.pendingInputs.push(t);return}}const r=await xn(),s=await fetch(`/api/terminal/${e}/input`,{method:"POST",headers:{"Content-Type":"text/plain","X-XSRF-TOKEN":r},body:t});if(!s.ok){const o=await s.json().catch(()=>({error:"Failed to send input"}));throw new Error(o.error||"Failed to send terminal input")}}function rT(e,t,n={}){const r=bs.get(e);if(!r)return!1;if(r.retryState.isSuspended=!1,r.ws.readyState!==WebSocket.OPEN)return r.reconnectNow(),!0;const s=n.visible?WA:GA,o=Date.now()+s,a=r.wakeProbe,d=a?.listeners??new Set;if(t&&d.add(t),a&&a.deadline<=o)return!0;a&&clearTimeout(a.timer);const h=setTimeout(()=>{bs.get(e)!==r||r.retryState.isClosed||(r.wakeProbe=void 0,r.reconnectNow())},s);if(r.wakeProbe={timer:h,listeners:d,deadline:o},a)return!0;try{r.ws.send(JSON.stringify({type:"ping"}))}catch{clearTimeout(h),r.wakeProbe=void 0,r.reconnectNow()}return!0}function sT(e){const t=bs.get(e);return t?(t.reconnectNow(),!0):!1}function Qf(){for(const e of bs.values())e.suspendReconnect()}function l2(e,t,n){const r=bs.get(e);if(!(!r||r.ws.readyState!==WebSocket.OPEN))try{r.ws.send(JSON.stringify({type:"focus",focused:t,reason:n}))}catch{}}function Ub(e,t){xg.set(e,t);const n=bs.get(e);!n||n.ws.readyState!==WebSocket.OPEN||n.outputProtocol!==2||n.ws.send(JSON.stringify({type:"output-subscription",active:t,since:n.lastSeq,epoch:n.streamEpoch}))}function iT(e){const t=bs.get(e);!t||t.ws.readyState!==WebSocket.OPEN||t.outputProtocol!==2||(t.appliedSeq=t.lastSeq,!(!t.flowSeq||t.flowSeq===t.acknowledgedFlowSeq)&&(t.acknowledgedFlowSeq=t.flowSeq,t.ws.send(JSON.stringify({type:"output-ack",flowSeq:t.flowSeq,since:t.appliedSeq,epoch:t.streamEpoch}))))}function c2(e,t,n){const r=bs.get(e);if(!(!r||r.ws.readyState!==WebSocket.OPEN))try{r.ws.send(JSON.stringify({type:"viewing",viewing:t,reason:n}))}catch{}}function u2(e){const t=bs.get(e);if(!(!t||t.ws.readyState!==WebSocket.OPEN))try{t.ws.send(JSON.stringify({type:"agent-review-ack"}))}catch{}}function d2(e,t,n){const r=bs.get(e);if(!(!r||r.ws.readyState!==WebSocket.OPEN))try{r.ws.send(JSON.stringify({type:"flow-control",paused:t,reason:n}))}catch{}}async function oT(e,t,n,r){Number.isFinite(t)&&Number.isFinite(n)&&t>=1&&n>=1&&(Wc.delete(e),Wc.set(e,{cols:Math.floor(t),rows:Math.floor(n)}),Wc.size>256&&Wc.delete(Wc.keys().next().value));const s=bs.get(e);if(s&&s.ws.readyState===WebSocket.OPEN)try{s.ws.send(JSON.stringify({type:"resize",cols:t,rows:n,seq:r}));return}catch{}const o=await xn(),a=await fetch(`/api/terminal/${e}/resize`,{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":o},body:JSON.stringify({cols:t,rows:n,seq:r})});if(!a.ok){const h=await a.json().catch(()=>({error:"Failed to resize terminal"}));throw new Error(h.error||"Failed to resize terminal")}const d=await a.json().catch(()=>({success:!0}));if(d?.success===!1||d?.ok===!1)throw new Error(d?.error||"Failed to resize terminal")}async function aT(e,t){const n=bs.get(e);if(n&&n.ws.readyState===WebSocket.OPEN)return t.action==="scroll"?(n.ws.send(JSON.stringify({type:"tmux",...t})),{success:!0}):new Promise((o,a)=>{const d=Math.random().toString(36).substring(7);A0.set(d,{resolve:o,reject:a}),n.ws.send(JSON.stringify({type:"tmux",reqId:d,...t})),setTimeout(()=>{A0.has(d)&&(A0.delete(d),a(new Error("Tmux action timed out")))},3e4)});const r=await xn(),s=await fetch(`/api/terminal/${e}/tmux`,{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":r},body:JSON.stringify(t)});if(!s.ok){const o=await s.json().catch(()=>({error:"Failed to execute tmux action"}));throw new Error(o.error||"Failed to execute tmux action")}return s.json()}async function Hb(e){const t=bs.get(e);if(t){t.retryState.isClosed=!0;try{t.ws.close()}catch{}bs.delete(e)}const n=await xn(),r=await fetch(`/api/terminal/${e}`,{method:"DELETE",headers:{"X-XSRF-TOKEN":n}});if(r.status!==404&&!r.ok){const s=await r.json().catch(()=>({error:"Failed to close terminal"}));throw new Error(s.error||"Failed to close terminal")}}async function lT(e,t){const n=bs.get(e);if(n){n.retryState.isClosed=!0;try{n.ws.close()}catch{}bs.delete(e)}const r=await xn(),s=await fetch(`/api/terminal/${e}/restart`,{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":r},body:JSON.stringify({...t.cwd?{cwd:t.cwd}:{},cols:t.cols??80,rows:t.rows??24,mode:t.mode,tmuxSessionName:t.tmuxSessionName})});if(!s.ok){const o=await s.json().catch(()=>({error:"Failed to restart terminal"}));throw new Error(o.error||"Failed to restart terminal session")}return s.json()}async function cT(e){const t=await os(`/api/terminal/${e}/health`,{method:"GET"},FA,"Terminal health check timed out");if(!t.ok){if(t.status===404)return{healthy:!1,sessionId:e};const n=await cu(t,lu,"Terminal health error response timed out").catch(()=>({error:"Failed to check terminal health"}));throw new Error(n.error||"Failed to check terminal health")}return cu(t,lu,"Terminal health response timed out")}async function uT(e){const t=await xn(),n=await os("/api/terminal/force-kill",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)},$A,"Terminal force-kill request timed out");if(!n.ok){const r=await cu(n,lu,"Terminal force-kill error response timed out").catch(()=>({error:"Failed to force kill terminal"}));throw new Error(r.error||"Failed to force kill terminal")}}async function dm(){const e=await fetch("/api/terminal/tmux/sessions",{method:"GET"});if(!e.ok){const n=await e.json().catch(()=>({error:"Failed to list tmux sessions"}));throw new Error(n.error||"Failed to list tmux sessions")}const t=await e.json();return Array.isArray(t.sessions)?t.sessions:[]}async function hm(){const e=await fetch("/api/terminal/tmux/status",{method:"GET"});if(!e.ok){const t=await e.json().catch(()=>({error:"Failed to get tmux status"}));throw new Error(t.error||"Failed to get tmux status")}return e.json()}async function zb(e){const t=e.trim();if(!t)throw new Error("tmux session name is required");const n=await xn(),r=await fetch(`/api/terminal/tmux/sessions/${encodeURIComponent(t)}`,{method:"DELETE",headers:{"X-XSRF-TOKEN":n}});if(!r.ok){const o=await r.json().catch(()=>({error:"Failed to kill tmux session"}));throw new Error(o.error||"Failed to kill tmux session")}const s=await r.json();return{cleanedSessions:Array.isArray(s.cleanedSessions)?s.cleanedSessions:[],alreadyGone:!!s.alreadyGone}}async function dT(){const e=await xn(),t=await fetch("/api/terminal/tmux/recovery/restore-all",{method:"POST",headers:{"X-XSRF-TOKEN":e}}),n=await t.json().catch(()=>({}));if(!t.ok)throw new Lo(n.error||"Failed to restore tmux Agent sessions",t.status);return n}async function hT(){const e=await xn(),t=await fetch("/api/terminal/tmux/recovery",{method:"DELETE",headers:{"X-XSRF-TOKEN":e}});if(!t.ok)throw new Lo("Failed to dismiss tmux recovery",t.status)}const md=new Map;function fT(e){return JSON.stringify({preferredFrontendSessionId:e.preferredFrontendSessionId??null,mode:e.mode??null,tmuxSessionName:e.tmuxSessionName??null,cwd:e.cwd??null,termType:e.termType??null,createIfEmpty:e.createIfEmpty===!0,requireExisting:e.requireExisting===!0})}async function pT(){const e=await fetch("/api/terminal/session-inventory",{method:"GET"});if(!e.ok){const t=await e.json().catch(()=>({error:"Failed to load session inventory"}));throw new Error(t.error||"Failed to load session inventory")}return e.json()}async function Gb(e){const t=fT(e),n=md.get(t);if(n)return n;const r=await xn(),s=os("/api/terminal/session-inventory/open",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":r},body:JSON.stringify(e)},jA,"Terminal session open request timed out").then(async o=>{if(!o.ok){const a=await cu(o,lu,"Terminal session open error response timed out").catch(()=>({error:"Failed to open session"}));throw new Lo(a.error||"Failed to open session",o.status,typeof a.code=="string"?a.code:void 0)}return cu(o,lu,"Terminal session open response timed out")}).finally(()=>{md.get(t)===s&&md.delete(t)});return md.set(t,s),s}async function Wd(e,t){const n=await xn(),r=await fetch(`/api/terminal/session-inventory/sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":n},body:JSON.stringify(t)});if(!r.ok){const s=await r.json().catch(()=>({error:"Failed to update session"}));throw new Error(s.error||"Failed to update session")}return r.json()}async function mT(e){const t=await xn(),n=await fetch("/api/terminal/session-inventory/reorder",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify({sessionIds:e})});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to reorder sessions"}));throw new Error(r.error||"Failed to reorder sessions")}return n.json()}async function gT(e){const t=await xn(),n=await fetch(`/api/terminal/session-inventory/sessions/${encodeURIComponent(e)}`,{method:"DELETE",headers:{"X-XSRF-TOKEN":t}});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to remove session"}));throw new Error(r.error||"Failed to remove session")}}async function xT(){const e=await xn(),t=await fetch("/api/terminal/session-inventory/sessions",{method:"DELETE",headers:{"X-XSRF-TOKEN":e}});if(!t.ok){const n=await t.json().catch(()=>({error:"Failed to clear sessions"}));throw new Error(n.error||"Failed to clear sessions")}}async function h2(){const e=await fetch("/api/terminal/toolbar-presets",{method:"GET"});if(!e.ok){const t=await e.json().catch(()=>({error:"Failed to load toolbar presets"}));throw new Error(t.error||"Failed to load toolbar presets")}return e.json()}async function yT(e){const t=await xn(),n=await fetch("/api/terminal/toolbar-presets",{method:"PUT",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to save toolbar presets"})),s=new Error(r.error||"Failed to save toolbar presets");throw s.current=r.current,s.code=r.code,s}return n.json()}let Bu=null,m0=null;const Wb=1500;function uu(){return m0&&Date.now()-m0.readAt<Wb?Promise.resolve(m0.value):Bu||(Bu=(async()=>{const e=await fetch("/api/terminal/settings",{method:"GET"});if(!e.ok){const n=await e.json().catch(()=>({error:"Failed to load settings"}));throw new Error(n.error||"Failed to load settings")}const t=await e.json();return m0={value:t,readAt:Date.now()},t})().finally(()=>{Bu=null}),Bu)}async function gi(e){const t=await xn(),n=await fetch("/api/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)});if(!n.ok){const s=await n.json().catch(()=>({error:"Failed to update settings"}));throw new Error(s.error||"Failed to update settings")}const r=await n.json();return m0={value:r,readAt:Date.now()},r}async function Pu(e=!1){const t=await fetch(`/api/terminal/auto-title/catalog${e?"?refresh=1":""}`);if(!t.ok)throw new Error("Failed to discover title models");const n=await t.json();return Array.isArray(n?.namers)?n.namers:[]}let Qu=null,g0=null;function DH(){return g0&&Date.now()-g0.readAt<Wb?Promise.resolve(g0.value):Qu||(Qu=(async()=>{const e=await fetch("/api/terminal/context-draft",{method:"GET"});if(!e.ok){const n=await e.json().catch(()=>({error:"Failed to load context draft"}));throw new Error(n.error||"Failed to load context draft")}const t=await e.json();return g0={value:t,readAt:Date.now()},t})().finally(()=>{Qu=null}),Qu)}async function BH(e,t){const n=await xn(),r=await fetch("/api/terminal/context-draft",{method:"PUT",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":n},body:JSON.stringify({text:e,origin:t})});if(!r.ok){const o=await r.json().catch(()=>({error:"Failed to update context draft"}));throw new Error(o.error||"Failed to update context draft")}const s=await r.json();return g0={value:s,readAt:Date.now()},s}async function bT(){const e=await fetch("/api/auth/status");if(!e.ok)throw new Error("Failed to query auth status");return e.json()}async function vT(e){const t=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:e})});if(t.ok)return Fb(),{ok:!0};const n=await t.json().catch(()=>null);return t.status===429?{ok:!1,rateLimited:!0,retryAfterMs:typeof n?.retryAfterMs=="number"?n.retryAfterMs:void 0,error:n?.error||"Too many failed attempts. Please wait and try again."}:{ok:!1,error:n?.error||"Login failed"}}async function wT(){mg(),Pb();const e=await xn();await fetch("/api/auth/logout",{method:"POST",headers:{"X-XSRF-TOKEN":e}}),Fb()}async function Vb(){const e=await fetch("/api/terminal/agent-launchers");if(!e.ok)throw new Error("Failed to detect agent launchers");const t=await e.json();return Array.isArray(t?.agents)?t.agents:[]}async function AT(){const e=await fetch("/api/terminal/agent-hooks");if(!e.ok)throw new Error("Failed to get agent hooks");const t=await e.json();return Array.isArray(t?.agents)?t.agents:[]}async function TT(e){const t=await xn(),n=await fetch(`/api/terminal/agent-hooks/${encodeURIComponent(e)}/install`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Error(r.error||"Failed to install agent hooks");return{summary:r.summary??"Installed",devMode:r.devMode===!0}}async function ST(e){const t=await xn(),n=await fetch(`/api/terminal/agent-hooks/${encodeURIComponent(e)}/uninstall`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Error(r.error||"Failed to uninstall agent hooks");return r.summary??"Removed"}class yg extends Error{constructor(t,n,r){super(t),this.code=n,this.migration=r,this.name="AgentPluginManifestError"}code;migration}async function CT(){const e=await fetch("/api/terminal/agent-plugins");if(!e.ok)throw new Error("Failed to get agent plugins");return await e.json()}async function _T(e){const t=await xn(),n=await fetch("/api/terminal/agent-plugins",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)}),r=await n.json().catch(()=>({}));if(!n.ok)throw new yg(r.error||"Failed to create agent plugin",r.code,r.migration);return r}async function LT(e){const t=await xn(),n=await fetch("/api/terminal/agent-plugins/install",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify({source:e})}),r=await n.json().catch(()=>({}));if(!n.ok)throw new yg(r.error||"Failed to install agent plugin",r.code,r.migration);return r}async function kT(e){const t=await xn(),n=await fetch(`/api/terminal/agent-plugins/${encodeURIComponent(e)}/check-update`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Error(r.error||"Failed to check plugin updates");return r}async function ET(e){const t=await xn(),n=await fetch(`/api/terminal/agent-plugins/${encodeURIComponent(e)}/update`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Error(r.error||"Failed to update plugin");return r}async function IT(e){const t=await xn(),n=await fetch(`/api/terminal/agent-plugins/${encodeURIComponent(e)}/doctor`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Error(r.error||"Failed to diagnose plugin");return r}async function RT(e){const t=await xn(),n=await fetch(`/api/terminal/agent-plugins/${encodeURIComponent(e)}`,{method:"DELETE",headers:{"X-XSRF-TOKEN":t}});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||"Failed to delete agent plugin")}}async function MT(e){const t=await xn(),n=await fetch(`/api/terminal/${encodeURIComponent(e)}/agent-resume`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Lo(r.error||"Failed to resume agent session",n.status,typeof r.code=="string"?r.code:void 0);return{command:r.command??""}}async function f2(){const e=await fetch("/api/terminal/agent-resume-history",{method:"GET"});if(!e.ok)throw new Error("Failed to load Agent resume history");const t=await e.json().catch(()=>({entries:[]}));return Array.isArray(t.entries)?t.entries:[]}async function qb(e){const t=await xn(),n=await fetch(`/api/terminal/agent-resume-history/${encodeURIComponent(e)}/prepare`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Lo(r.error||"Failed to prepare Agent session resume",n.status,typeof r.code=="string"?r.code:void 0);return r}async function NT(e){const t=await xn(),n=await fetch(`/api/terminal/agent-resume-history/${encodeURIComponent(e)}`,{method:"DELETE",headers:{"X-XSRF-TOKEN":t}});if(!n.ok&&n.status!==404)throw new Error("Failed to remove Agent resume history")}async function Mc(e){const t=await xn(),n=await fetch("/api/terminal/program-rules",{method:"PUT",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to update program rules"}));throw new Error(r.error||"Failed to update program rules")}return n.json()}async function DT(){const e=await xn(),t=await fetch("/api/terminal/program-rules",{method:"DELETE",headers:{"X-XSRF-TOKEN":e}});if(!t.ok)throw new Error("Failed to reset program rules");return t.json()}async function BT(){const e=await fetch("/api/terminal/program-detection");if(!e.ok)throw new Error("Failed to get program detection config");return e.json()}async function p2(e){const t=await xn(),n=await fetch("/api/terminal/program-detection",{method:"PUT",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)});if(!n.ok)throw new Error("Failed to save program detection config");return n.json()}async function PT(){const e=await xn(),t=await fetch("/api/terminal/program-detection",{method:"DELETE",headers:{"X-XSRF-TOKEN":e}});if(!t.ok)throw new Error("Failed to reset program detection config");return t.json()}const QT={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".bmp":"image/bmp",".ico":"image/x-icon",".svg":"image/svg+xml",".heic":"image/heic",".heif":"image/heif"};function bg(e){const t=e.lastIndexOf(".");return t<0?null:QT[e.slice(t).toLowerCase()]??null}function PH(e){return bg(e)!==null}function OT(e){const t=bg(e);return t==="image/heic"||t==="image/heif"}const FT={".mp4":"video/mp4",".m4v":"video/x-m4v",".webm":"video/webm",".mov":"video/quicktime",".ogv":"video/ogg",".mpeg":"video/mpeg",".mpg":"video/mpeg"};function jT(e){const t=e.lastIndexOf(".");return t<0?null:FT[e.slice(t).toLowerCase()]??null}function $T(e){return jT(e)!==null}function QH(e){return`/api/terminal/fs/video?path=${encodeURIComponent(e)}&action=view_file`}const UT=[".stl",".glb",".gltf"];function Yb(e){const t=e.lastIndexOf(".");if(t<0)return null;const n=e.slice(t).toLowerCase();return UT.includes(n)?n:null}function HT(e){return Yb(e)!==null}function Zb(e){const t=e.toLowerCase();return t.endsWith(".kicad_sch")?".kicad_sch":t.endsWith(".kicad_pcb")?".kicad_pcb":null}function OH(e){return Zb(e)!==null}function FH(e){return Zb(e)===".kicad_pcb"?"pcb-front":"schematic"}const zT=[".html",".htm"];function jH(e){const t=e.lastIndexOf(".");if(t<0)return!1;const n=e.slice(t).toLowerCase();return zT.includes(n)}function $H(e){return`/api/terminal/fs/preview/${e.split(/[\\/]+/).filter(Boolean).map(n=>encodeURIComponent(n)).join("/")}`}const GT={".stl":"model/stl",".glb":"model/gltf-binary",".gltf":"model/gltf+json"};async function vg(e,t,n,r="list_directory",s,o="name"){const a=new URLSearchParams({path:e});n&&a.set("showHidden","true"),o!=="name"&&a.set("sort",o),a.set("action",r),s&&a.set("requestSlotId",s);const d=await os(`/api/terminal/fs/list?${a}`,{signal:t},yc,"Directory listing took too long. The folder may be on slow storage or blocked by another process.");if(!d.ok){const h=await d.json().catch(()=>({error:"Failed to list directory"}));throw new Error(h.error||"Failed to list directory")}return d.json()}async function WT(e,t,n,r,s,o="name",a,d={}){const h=new URLSearchParams({path:e,query:t,stream:"true"});s&&h.set("showHidden","true"),o==="content"&&h.set("mode","content"),a&&h.set("requestSlotId",a);for(const T of d.excludePatterns??[])h.append("exclude",T);d.caseSensitive&&h.set("caseSensitive","true"),d.wholeWord&&h.set("wholeWord","true"),d.regex&&h.set("regex","true");const p=await fetch(`/api/terminal/fs/search?${h}`,{signal:r});if(!p.ok||!p.body){const T=await p.json().catch(()=>({error:"Failed to search files"}));throw new Error(T.error||"Failed to search files")}const g=p.body.getReader(),y=new TextDecoder;let b="";const v=T=>{if(!T.trim())return;const A=JSON.parse(T);if(A.type==="meta")n({path:A.path,query:A.query,engine:A.engine,mode:A.mode,limited:A.limited});else if(A.type==="batch")n({entries:A.entries??[]});else if(A.type==="content-batch")n({contentEntries:A.contentEntries??[]});else{if(A.type==="error")throw new Error(A.message||"Search failed");A.type==="done"&&n({total:A.total,truncated:A.truncated,limited:A.limited,engine:A.engine,mode:A.mode,done:!0})}};for(;;){const{value:T,done:A}=await g.read();if(A)break;b+=y.decode(T,{stream:!0});let L=b.indexOf(`
|
|
3
|
-
`);for(;L>=0;)v(b.slice(0,L)),b=b.slice(L+1),L=b.indexOf(`
|
|
4
|
-
`)}b+=y.decode(),v(b)}async function UH(e,t,n){const r=new URLSearchParams;for(const g of e)r.append("root",g);const s=await fetch(`/api/terminal/fs/watch?${r}`,{signal:n});if(!s.ok||!s.body){const g=await s.json().catch(()=>({error:"Failed to watch files"}));throw new Error(g.error||"Failed to watch files")}const o=s.body.getReader(),a=new TextDecoder;let d="",h=null;const p=g=>{if(!g.trim())return;const y=JSON.parse(g);if(y.type==="events"&&y.events?.length){t(y.events);const b=y.events.find(v=>v.type==="rescan-required"&&v.reason!=="event-storm"&&v.reason!=="reconnected"&&v.reason!=="directory-rescan"&&v.reason!=="polling-fallback");b?.reason&&(h=b.reason)}};for(;;){const{value:g,done:y}=await o.read();if(y)break;d+=a.decode(g,{stream:!0});let b=d.indexOf(`
|
|
5
|
-
`);for(;b>=0;)p(d.slice(0,b)),d=d.slice(b+1),b=d.indexOf(`
|
|
6
|
-
`)}if(d+=a.decode(),p(d),h)throw new Error(h)}function fm(e){if(!e)return;const t=new URLSearchParams({requestSlotId:e,action:"cancel_io_slot"});fetch(`/api/terminal/fs/cancel-slot?${t}`,{method:"GET",keepalive:!0}).catch(()=>{})}async function HH(e,t,n="view_file",r){const s=new URLSearchParams({path:e,action:n});r&&s.set("requestSlotId",r);const o=await Qb(`/api/terminal/fs/read?${s}`,{signal:t,timeoutMs:yc});if(!o.ok){const a=await o.json().catch(()=>({error:"Failed to read file"}));throw new Error(a.error||"Failed to read file")}return o.json()}async function zH(e,t,n="HEAD",r,s="ref"){const o=new URLSearchParams({path:e,cwd:t,ref:n,action:"git_blob"});s==="index"&&o.set("source","index");const a=await os(`/api/terminal/fs/git-blob?${o}`,{signal:r},yc,"Git blob preview took too long.");if(!a.ok){const d=await a.json().catch(()=>({error:"Failed to read git blob"}));throw new Error(d.error||"Failed to read git blob")}return a.json()}async function GH(e,t,n="view_file",r){const s=new URLSearchParams({path:e,action:n});r&&s.set("requestSlotId",r);const o=await Qb(`/api/terminal/fs/blob?${s}`,{signal:t,timeoutMs:OT(e)?PA:yc});if(!o.ok){const h=await o.json().catch(()=>({error:"Failed to load image preview"}));throw new Error(h.error||"Failed to load image preview")}const a=await o.blob(),d=o.headers.get("Content-Length");return{blob:a,path:e,size:d?Number(d):null,modified:o.headers.get("Last-Modified"),mimeType:o.headers.get("Content-Type")||a.type||bg(e)||"application/octet-stream"}}function Kb(e,t){try{const n=decodeURIComponent(e.headers.get("X-Termdock-Source-Path")||"");return n.startsWith("/")&&!/[\r\n\0]/.test(n)?n:t}catch{return t}}async function WH(e,t,n,r="view_file",s){const o=new URLSearchParams({path:e,view:t,action:r});s&&o.set("requestSlotId",s);const a="KiCad preview rendering or transfer timed out.",d=gg(n,QA,a);try{const h=await fetch(`/api/terminal/fs/eda-preview?${o}`,{signal:d.signal});if(!h.ok){const y=await h.json().catch(()=>({error:"Failed to render KiCad preview"}));throw new Error(y.error||"Failed to render KiCad preview")}const p=await h.blob(),g=h.headers.get("Content-Length");return{blob:p,path:Kb(h,e),view:t,size:g?Number(g):null,modified:h.headers.get("Last-Modified"),mimeType:h.headers.get("Content-Type")||p.type||"image/svg+xml"}}catch(h){throw d.signal.aborted&&!n?.aborted?new Error(a):h}finally{d.cleanup()}}async function VH(e,t,n,r,s){const o=new URLSearchParams({path:e,view:t,x:String(n),y:String(r)}),a=await os(`/api/terminal/fs/eda-inspect?${o}`,{signal:s},8e3,"KiCad point inspection timed out.");if(!a.ok){const d=await a.json().catch(()=>({error:"Failed to inspect KiCad point"}));throw new Error(d.error||"Failed to inspect KiCad point")}return a.json()}async function qH(e,t,n="view_file",r){const s=new URLSearchParams({path:e,action:n});r&&s.set("requestSlotId",r);const a=gg(t,BA,"3D model transfer timed out. Please retry.");try{const d=await fetch(`/api/terminal/fs/download?${s}`,{signal:a.signal});if(!d.ok){const y=await d.json().catch(()=>({error:"Failed to load 3D model preview"}));throw new Error(y.error||"Failed to load 3D model preview")}const h=await d.blob(),p=d.headers.get("Content-Length"),g=Yb(e)??"";return{blob:h,path:Kb(d,e),size:p?Number(p):null,modified:d.headers.get("Last-Modified"),ext:g,mimeType:d.headers.get("Content-Type")||h.type||GT[g]||"application/octet-stream"}}finally{a.cleanup()}}function VT(){return typeof navigator>"u"?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}async function Xb(e){const t=`/api/terminal/fs/download?path=${encodeURIComponent(e)}`,n=await fetch(t);if(!n.ok){const h=await n.json().catch(()=>({error:"Failed to download file"}));throw new Error(h.error||"Failed to download file")}const r=await n.blob(),s=ZT(n.headers.get("Content-Disposition")||"")??e.split("/").pop()?.split("\\").pop()??"download",o=window.showSaveFilePicker;if(typeof o=="function")try{const p=await(await o({suggestedName:s})).createWritable();await p.write(r),await p.close();return}catch(h){if(h instanceof DOMException&&h.name==="AbortError")return}if(VT()){const h=new File([r],s,{type:r.type||"application/octet-stream"});if(typeof navigator<"u"&&"share"in navigator&&(!navigator.canShare||navigator.canShare({files:[h]})))try{await navigator.share({files:[h]});return}catch(g){if(g instanceof DOMException&&g.name==="AbortError")return}window.location.href=t;return}const a=URL.createObjectURL(r),d=document.createElement("a");d.href=a,d.download=s,d.rel="noopener",d.style.display="none",document.body.appendChild(d),d.click(),setTimeout(()=>{URL.revokeObjectURL(a),d.remove()},4e3)}async function qT(e){const t=await xn(),n=new URLSearchParams({path:e,confirm:"true"}),r=await os(`/api/terminal/fs/file?${n}`,{method:"DELETE",headers:{"X-XSRF-TOKEN":t}},yc,"File deletion took too long.");if(!r.ok){const s=await r.json().catch(()=>({error:"Failed to delete file"}));throw new Error(s.error||"Failed to delete file")}}async function YT(e,t,n,r){const s=new FormData;for(const h of t)s.append("files",h);const o=`/api/terminal/fs/upload?dir=${encodeURIComponent(e)}`,a=await xn();if(r)return new Promise((h,p)=>{const g=new XMLHttpRequest,y=()=>g.abort(),b=()=>n?.removeEventListener("abort",y),v=()=>{let T="Upload failed";try{T=JSON.parse(g.responseText).error||T}catch{}p(new Error(T))};if(g.open("POST",o),g.setRequestHeader("X-XSRF-TOKEN",a),g.timeout=12e4,g.upload.onprogress=T=>{T.lengthComputable&&T.total>0&&r(Math.min(100,Math.round(T.loaded/T.total*100)))},g.onload=()=>{if(b(),g.status>=200&&g.status<300){try{r(100),h(JSON.parse(g.responseText))}catch{p(new Error("Upload returned an invalid response"))}return}g.status===401&&(rc=null,window.dispatchEvent(new CustomEvent(E0))),v()},g.onerror=()=>{b(),p(new Error("Upload failed"))},g.ontimeout=()=>{b(),p(new Error("Upload timed out"))},g.onabort=()=>{b(),p(new DOMException("Upload aborted","AbortError"))},n?.addEventListener("abort",y,{once:!0}),n?.aborted){g.abort();return}r(0),g.send(s)});const d=await os(o,{method:"POST",headers:{"X-XSRF-TOKEN":a},body:s,signal:n},12e4,"Upload timed out");if(!d.ok){const h=await d.json().catch(()=>({error:"Upload failed"}));throw new Error(h.error||"Upload failed")}return d.json()}async function YH(e){const t=await os("/api/terminal/fs/local-open-availability",{signal:e},yc,"Local file browser availability check timed out");return t.ok?t.json():{available:!1}}async function ZH(e){const t=await xn(),n=await os("/api/terminal/fs/open-in-file-browser",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify({path:e})},yc,"Opening file browser timed out");if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to open file browser"}));throw new Error(r.error||"Failed to open file browser")}}function ZT(e){if(!e)return null;const t=/(?:^|;)\s*filename\*=\s*(?:UTF-8'')?([^;]+)/i.exec(e);if(t){const r=t[1].trim().replace(/^"|"$/g,"");try{return decodeURIComponent(r)}catch{return r}}const n=/(?:^|;)\s*filename=\s*(?:"([^"]*)"|([^;]+))/i.exec(e);return n?(n[1]??n[2]).trim():null}function KT(e,t){t?.algorithm&&t.algorithm!=="default"&&e.set("algorithm",t.algorithm),t?.whitespace&&t.whitespace!=="default"&&e.set("whitespace",t.whitespace),t?.context==="all"?e.set("context","all"):typeof t?.context=="number"&&e.set("context",String(t.context))}async function KH(e,t,n,r,s=e?"view_diff":"view_all_changes",o,a,d,h){const p=new URLSearchParams;e&&p.set("path",e),n&&p.set("cwd",n),p.set("action",s),KT(p,h),o&&p.set("traceId",o),a&&p.set("interactionId",a),d&&p.set("requestSlotId",d);const g=!!e&&s==="view_diff",y=typeof performance<"u"?performance.now():Date.now();Cl("request_start",{traceId:o,interactionId:a,requestSlotId:d,filePath:e,cwd:n,action:s,cached:!!t,algorithm:h?.algorithm??"default",whitespace:h?.whitespace??"default",context:h?.context===void 0?"default":String(h.context),timeoutMs:g?ru:ja});const b=await os(`/api/terminal/fs/diff?${p}`,{signal:r},g?ru:ja,g?"Git diff is still running for this file. It may be blocked by repository IO or another Git process.":"Git diff took too long. The repository may be busy, on slow storage, or locked by another Git process.").catch(A=>{throw Cl("timeout_or_abort",{traceId:o,interactionId:a,requestSlotId:d,filePath:e,cwd:n,action:s,durationMs:Math.round((typeof performance<"u"?performance.now():Date.now())-y),message:A instanceof Error?A.message:String(A),signalAborted:!!r?.aborted,signalReason:r?.aborted?String(r.reason??""):void 0}),A});if(Cl("response_headers",{traceId:o,interactionId:a,requestSlotId:d,filePath:e,cwd:n,action:s,status:b.status,ok:b.ok,durationMs:Math.round((typeof performance<"u"?performance.now():Date.now())-y)}),!b.ok){const A=await b.json().catch(()=>({error:"Failed to get diff"}));throw Cl("error",{traceId:o,interactionId:a,requestSlotId:d,filePath:e,cwd:n,action:s,status:b.status,message:A.error||"Failed to get diff"}),new Error(A.error||"Failed to get diff")}Cl("response_body_start",{traceId:o,interactionId:a,requestSlotId:d,filePath:e,cwd:n,action:s,durationMs:Math.round((typeof performance<"u"?performance.now():Date.now())-y),contentLength:b.headers.get("Content-Length")});let v;try{v=await Ob(b,g?ru:ja,g?"Git diff response body is still loading for this file.":"Git diff response body took too long.")}catch(A){throw Cl("response_body_timeout",{traceId:o,interactionId:a,requestSlotId:d,filePath:e,cwd:n,action:s,durationMs:Math.round((typeof performance<"u"?performance.now():Date.now())-y),message:A instanceof Error?A.message:String(A),signalAborted:!!r?.aborted,signalReason:r?.aborted?String(r.reason??""):void 0}),A}let T;try{T=JSON.parse(v)}catch(A){throw Cl("response_body_parse_error",{traceId:o,interactionId:a,requestSlotId:d,filePath:e,cwd:n,action:s,durationMs:Math.round((typeof performance<"u"?performance.now():Date.now())-y),bytes:v.length,snippet:v.slice(0,160),message:A instanceof Error?A.message:String(A)}),A}return Cl("response_body",{traceId:o,interactionId:a,requestSlotId:d,filePath:e,cwd:n,action:s,durationMs:Math.round((typeof performance<"u"?performance.now():Date.now())-y),bytes:T.diff?.length??0,error:T.error??null,truncated:!!T.truncated,tooLarge:!!T.tooLarge}),T}async function XH(e,t,n="load_git_details",r){const s=new URLSearchParams;e&&s.set("cwd",e),s.set("action",n),r&&s.set("requestSlotId",r);const o=s.toString(),a=await os(`/api/terminal/fs/git-context${o?`?${o}`:""}`,{signal:t},ja,"Git details took too long. The repository may be busy, on slow storage, or locked by another Git process.");if(!a.ok){const d=await a.json().catch(()=>({error:"Failed to get git context"}));throw new Error(d.error||"Failed to get git context")}return a.json()}async function JH(e={},t){const n=new URLSearchParams;e.workspaceRoot&&n.set("workspaceRoot",e.workspaceRoot),e.repoRoot&&n.set("repoRoot",e.repoRoot);const r=n.toString(),s=await os(`/api/terminal/fs/change-audit${r?`?${r}`:""}`,{signal:t},ja,"Change audit explanations took too long to load.");if(!s.ok){const o=await s.json().catch(()=>({error:"Failed to get change audit explanations"}));throw new Error(o.error||"Failed to get change audit explanations")}return s.json()}async function ez(e,t){const n=new URLSearchParams;e.cwd&&n.set("cwd",e.cwd),e.repoRoot&&n.set("repoRoot",e.repoRoot),n.set("base",e.base),e.head&&n.set("head",e.head),e.includeUncommitted===!1&&n.set("includeUncommitted","0"),n.set("action","load_branch_diff"),e.requestSlotId&&n.set("requestSlotId",e.requestSlotId);const r=await os(`/api/terminal/fs/branch-diff?${n}`,{signal:t},ru,"Branch diff took too long. The repository may be busy, on slow storage, or locked by another Git process.");if(!r.ok){const s=await r.json().catch(()=>({error:"Failed to get branch diff"}));throw new Error(s.error||"Failed to get branch diff")}return r.json()}async function tz(e,t){const n=new URLSearchParams;e.cwd&&n.set("cwd",e.cwd),e.repoRoot&&n.set("repoRoot",e.repoRoot),n.set("commit",e.commit),n.set("action","load_commit_diff"),e.requestSlotId&&n.set("requestSlotId",e.requestSlotId);const r=await os(`/api/terminal/fs/commit-diff?${n}`,{signal:t},ru,"Commit diff took too long. The repository may be busy, on slow storage, or locked by another Git process.");if(!r.ok){const s=await r.json().catch(()=>({error:"Failed to get commit diff"}));throw new Error(s.error||"Failed to get commit diff")}return r.json()}async function nz(e,t){const n=new URLSearchParams;e.cwd&&n.set("cwd",e.cwd),e.repoRoot&&n.set("repoRoot",e.repoRoot),n.set("limit",String(e.limit)),typeof e.skip=="number"&&n.set("skip",String(e.skip)),e.query&&n.set("query",e.query),n.set("action","load_recent_commits"),e.requestSlotId&&n.set("requestSlotId",e.requestSlotId);const r=await os(`/api/terminal/fs/git-recent-commits?${n}`,{signal:t},ja,"Recent commits took too long. The repository may be busy, on slow storage, or locked by another Git process.");if(!r.ok){const s=await r.json().catch(()=>({error:"Failed to get recent commits"}));throw new Error(s.error||"Failed to get recent commits")}return r.json()}async function rz(e={},t){const n=new URLSearchParams;e.workspaceRoot&&n.set("workspaceRoot",e.workspaceRoot),e.repoRoot&&n.set("repoRoot",e.repoRoot),e.baseRef&&n.set("baseRef",e.baseRef),e.branchName&&n.set("branchName",e.branchName);const r=n.toString(),s=await os(`/api/terminal/fs/branch-audit${r?`?${r}`:""}`,{signal:t},ja,"Branch explanations took too long to load.");if(!s.ok){const o=await s.json().catch(()=>({error:"Failed to get branch explanations"}));throw new Error(o.error||"Failed to get branch explanations")}return s.json()}async function sz(e={}){const t=await xn(),n=await os("/api/terminal/fs/change-audit",{method:"DELETE",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)},ja,"Change audit explanations took too long to clear.");if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to clear change audit explanations"}));throw new Error(r.error||"Failed to clear change audit explanations")}return n.json()}async function iz(e={}){const t=await xn(),n=await os("/api/terminal/fs/branch-audit",{method:"DELETE",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)},ja,"Branch explanations took too long to clear.");if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to clear branch explanations"}));throw new Error(r.error||"Failed to clear branch explanations")}return n.json()}async function oz(e,t,n){const r=new URLSearchParams;e&&r.set("cwd",e),r.set("action","load_untracked_files"),n&&r.set("requestSlotId",n);const s=r.toString();return(await os(`/api/terminal/fs/untracked-files${s?`?${s}`:""}`,{signal:t},ru,"Untracked file scan took too long. The repository may be busy, on slow storage, or locked by another Git process.")).json()}async function az(e,t,n={}){const r=new URLSearchParams;e&&r.set("cwd",e),n.includeNested&&r.set("includeNested","true"),n.refresh&&r.set("refresh","true"),n.cacheOnly&&r.set("cacheOnly","true"),r.set("action",n.action??(n.refresh?"manual_git_refresh":"open_sidebar_git_refresh")),n.requestSlotId&&r.set("requestSlotId",n.requestSlotId);const s=r.toString(),o=`/api/terminal/fs/git-bundle${s?`?${s}`:""}`,a=n.requestTimeoutMs===null?await fetch(o,{signal:t}):await os(o,{signal:t},n.requestTimeoutMs??ja,"Git status refresh took too long. The repository may be busy, on slow storage, or locked by another Git process.");if(!a.ok){const d=await a.json().catch(()=>({error:"Failed to get git bundle"}));throw new Error(d.error||"Failed to get git bundle")}return a.json()}async function lz(e){const t=await xn(),n=await fetch("/api/terminal/fs/git-action",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)});if(!n.ok){const r=await n.json().catch(()=>({error:"Git action failed"})),s=r.confirmationPhrase?`${r.error||"Git action failed"} (${r.confirmationPhrase})`:r.error||"Git action failed";throw new Error(s)}return n.json()}async function cz(e){const t=new URLSearchParams;e.cwd&&t.set("cwd",e.cwd),e.action&&t.set("action",e.action),e.jobId&&t.set("jobId",e.jobId);const n=await fetch(`/api/terminal/fs/git-action/status?${t}`);if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to get Git action status"}));throw new Error(r.error||"Failed to get Git action status")}return n.json()}async function uz(e){const t=await xn(),n=await fetch("/api/terminal/fs/apply-hunk",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to apply diff hunk"}));throw new Error(r.error||"Failed to apply diff hunk")}return n.json()}async function Ko(e,t){const n=t?.method?.toUpperCase()??"GET",r=new Headers(t?.headers);n!=="GET"&&n!=="HEAD"&&r.set("X-XSRF-TOKEN",await xn()),t?.body&&r.set("Content-Type","application/json");const s=await fetch(`/api/terminal/operations${e}`,{...t,headers:r});if(!s.ok){const o=await s.json().catch(()=>({error:"操作失败"}));throw new Lo(o.error||"操作失败",s.status)}return s.status===204?void 0:await s.json()}function XT(){return Ko("/automations")}function JT(e){return Ko("/automations",{method:"POST",body:JSON.stringify(e)})}function eS(e){return Ko(`/automations/${encodeURIComponent(e)}/run`,{method:"POST"})}function tS(e,t){return Ko(`/automations/${encodeURIComponent(e)}/enabled`,{method:"POST",body:JSON.stringify({enabled:t})})}function nS(e){return Ko(`/automations/${encodeURIComponent(e)}`,{method:"DELETE"})}let Ou=null;function Jb(){return Ou||(Ou=(window.termdockDesktop?.collaborationList?.()??Ko("/collaboration-groups")).finally(()=>{Ou=null}),Ou)}function T0(e){return window.termdockDesktop?.collaborationSave?.(e)??Ko("/collaboration-groups",{method:"POST",body:JSON.stringify(e)})}function rS(e,t){return Ko(`/collaboration-groups/${encodeURIComponent(e)}/spawn`,{method:"POST",body:JSON.stringify(t)})}function e3(e){return e.startsWith("cross-")&&window.termdockDesktop?.collaborationRemove?window.termdockDesktop.collaborationRemove(e):Ko(`/collaboration-groups/${encodeURIComponent(e)}`,{method:"DELETE"})}function m2(e){return Ko(`/collaboration-groups/${encodeURIComponent(e)}/messages`)}function sS(e,t){return Ko(`/collaboration-groups/${encodeURIComponent(e)}/messages`,{method:"POST",body:JSON.stringify(t)})}function iS(e){return Ko(`/session-search?q=${encodeURIComponent(e)}`)}function oS(e,t,n){S.useEffect(()=>{e&&Ub(e,!0)},[e,n])}const hi=[];for(let e=0;e<256;++e)hi.push((e+256).toString(16).slice(1));function aS(e,t=0){return(hi[e[t+0]]+hi[e[t+1]]+hi[e[t+2]]+hi[e[t+3]]+"-"+hi[e[t+4]]+hi[e[t+5]]+"-"+hi[e[t+6]]+hi[e[t+7]]+"-"+hi[e[t+8]]+hi[e[t+9]]+"-"+hi[e[t+10]]+hi[e[t+11]]+hi[e[t+12]]+hi[e[t+13]]+hi[e[t+14]]+hi[e[t+15]]).toLowerCase()}let Of;const lS=new Uint8Array(16);function cS(){if(!Of){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Of=crypto.getRandomValues.bind(crypto)}return Of(lS)}const uS=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),g2={randomUUID:uS};function dS(e,t,n){e=e||{};const r=e.random??e.rng?.()??cS();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,aS(r)}function hS(e,t,n){return g2.randomUUID&&!e?g2.randomUUID():dS(e)}const fS={},x2=e=>{let t;const n=new Set,r=(g,y)=>{const b=typeof g=="function"?g(t):g;if(!Object.is(b,t)){const v=t;t=y??(typeof b!="object"||b===null)?b:Object.assign({},t,b),n.forEach(T=>T(t,v))}},s=()=>t,h={setState:r,getState:s,getInitialState:()=>p,subscribe:g=>(n.add(g),()=>n.delete(g)),destroy:()=>{(fS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},p=t=e(r,s,h);return h},pS=e=>e?x2(e):x2;var Ff={exports:{}},jf={},$f={exports:{}},Uf={};var y2;function mS(){if(y2)return Uf;y2=1;var e=Oh();function t(y,b){return y===b&&(y!==0||1/y===1/b)||y!==y&&b!==b}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,o=e.useLayoutEffect,a=e.useDebugValue;function d(y,b){var v=b(),T=r({inst:{value:v,getSnapshot:b}}),A=T[0].inst,L=T[1];return o(function(){A.value=v,A.getSnapshot=b,h(A)&&L({inst:A})},[y,v,b]),s(function(){return h(A)&&L({inst:A}),y(function(){h(A)&&L({inst:A})})},[y]),a(v),v}function h(y){var b=y.getSnapshot;y=y.value;try{var v=b();return!n(y,v)}catch{return!0}}function p(y,b){return b()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:d;return Uf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Uf}var b2;function gS(){return b2||(b2=1,$f.exports=mS()),$f.exports}var v2;function xS(){if(v2)return jf;v2=1;var e=Oh(),t=gS();function n(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,o=e.useRef,a=e.useEffect,d=e.useMemo,h=e.useDebugValue;return jf.useSyncExternalStoreWithSelector=function(p,g,y,b,v){var T=o(null);if(T.current===null){var A={hasValue:!1,value:null};T.current=A}else A=T.current;T=d(function(){function R($){if(!D){if(D=!0,B=$,$=b($),v!==void 0&&A.hasValue){var z=A.value;if(v(z,$))return j=z}return j=$}if(z=j,r(B,$))return z;var H=b($);return v!==void 0&&v(z,H)?(B=$,z):(B=$,j=H)}var D=!1,B,j,P=y===void 0?null:y;return[function(){return R(g())},P===null?void 0:function(){return R(P())}]},[g,y,b,v]);var L=s(p,T[0],T[1]);return a(function(){A.hasValue=!0,A.value=L},[L]),h(L),L},jf}var w2;function yS(){return w2||(w2=1,Ff.exports=xS()),Ff.exports}var bS=yS();const vS=yb(bS),t3={},{useDebugValue:wS}=_,{useSyncExternalStoreWithSelector:AS}=vS;let A2=!1;const TS=e=>e;function SS(e,t=TS,n){(t3?"production":void 0)!=="production"&&n&&!A2&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),A2=!0);const r=AS(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return wS(r),r}const T2=e=>{(t3?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?pS(e):e,n=(r,s)=>SS(t,r,s);return Object.assign(n,t),n},n3=e=>e?T2(e):T2,CS=256*1024,_S=256*1024,LS=128;function S2(e,t=CS){if(!e)return[];if(e.length<=t)return[e];const n=[];let r=0;for(;r<e.length;){let s=Math.min(r+t,e.length);if(s<e.length){const o=e.lastIndexOf(`
|
|
7
|
-
`,s);o>r&&(s=o+1)}n.push(e.slice(r,s)),r=s}return n}function kS(e,t=_S,n=LS){const r=new Map;let s=0,o=0;for(const a of[...e.keys()]){const d=e.get(a);if(!d||d.length===0){e.delete(a);continue}const h=[];for(;d.length>0;){const p=d[0];if(o>0&&(o>=n||s+p.length>t))break;d.shift(),h.push(p),s+=p.length,o+=1}if(h.length>0&&r.set(a,h),e.delete(a),d.length>0&&e.set(a,d),o>=n||s>=t)break}return r}function Qs(){return typeof window>"u"?null:window.termdockDesktop??null}function ES(e){return typeof e?.reportServiceActivity=="function"&&typeof e.focusService=="function"&&typeof e.onServiceActivity=="function"}const Hf=new Set;let C2=!1;function IS(e){const t=Qs();return t?(Hf.add(e),C2||(t.onNativeFileDrop(n=>{for(const r of Hf)r(n)}),C2=!0),()=>{Hf.delete(e)}):()=>{}}const r3="termdock-pwa-notifications-enabled",s3="termdock-pwa-ai-notifications-enabled",i3="termdock-pwa-exit-notifications-enabled",o3="termdock-pwa-notification-alert-style",RS="termdock-notification-claim:",pm=5e3,MS=1500,mm="termdock-push-last-sync",_2=360*60*1e3,NS=10080*60*1e3,S0=new Map;function sc(){return Qs()?!0:typeof window<"u"&&typeof Notification<"u"&&"serviceWorker"in navigator&&window.isSecureContext}function DS(){if(typeof navigator>"u")return!1;const e=navigator.userAgent;return/iPad|iPhone|iPod/.test(e)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function BS(){return typeof window>"u"?!1:!!(window.matchMedia("(display-mode: standalone)").matches||"standalone"in navigator&&navigator.standalone===!0)}function a3(){return Qs()?!0:!(!sc()||DS()&&!BS())}function zf(){return Qs()?"granted":typeof Notification>"u"?"unsupported":Notification.permission}function jh(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(r3)==="true"}catch{return!1}}function gd(e){if(!(typeof window>"u"))try{window.localStorage.setItem(r3,String(e))}catch{}}function $h(){if(typeof window>"u")return!0;try{const e=window.localStorage.getItem(s3);return e===null?!0:e==="true"}catch{return!0}}function PS(e){if(!(typeof window>"u"))try{window.localStorage.setItem(s3,String(e))}catch{}}function wg(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(i3)==="true"}catch{return!1}}function QS(e){if(!(typeof window>"u"))try{window.localStorage.setItem(i3,String(e))}catch{}}function I0(){if(typeof window>"u")return"normal";try{const e=window.localStorage.getItem(o3);if(e==="quiet"||e==="persistent")return e}catch{}return"normal"}function OS(e){if(!(typeof window>"u"))try{window.localStorage.setItem(o3,e)}catch{}}async function FS(){return Qs()?"granted":sc()?Notification.permission==="default"?Notification.requestPermission():Notification.permission:"unsupported"}function jS(){return typeof document>"u"?!0:document.visibilityState==="visible"&&document.hasFocus()}function $S(e){for(const[t,n]of S0)e-n>pm&&S0.delete(t)}function US(e){return e.dedupKey?.trim()?e.dedupKey.trim():e.tag?.trim()?e.tag.trim():[e.data?.sessionId,e.title,e.body].filter(t=>typeof t=="string"&&t.trim().length>0).map(t=>t.trim()).join("|")}function HS(e){const t=US(e);if(!t)return!0;const n=Date.now();$S(n);const r=S0.get(t)??0;if(n-r<pm)return!1;try{if(typeof window<"u"&&window.localStorage){const s=`${RS}${t}`,o=Number(window.localStorage.getItem(s)??"0");if(Number.isFinite(o)&&n-o<pm)return S0.set(t,o),!1;Number.isFinite(o)&&o>0&&window.localStorage.removeItem(s),window.localStorage.setItem(s,String(n))}}catch{}return S0.set(t,n),!0}async function Uh(){if(typeof navigator>"u"||!("serviceWorker"in navigator))return null;try{const e=await navigator.serviceWorker.getRegistration()??null;return e?.active?e:await Promise.race([navigator.serviceWorker.ready,new Promise(n=>{window.setTimeout(()=>n(null),MS)})])??e}catch{return null}}function zS(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),r=window.atob(n),s=new Uint8Array(new ArrayBuffer(r.length));for(let o=0;o<r.length;o+=1)s[o]=r.charCodeAt(o);return s}async function Ag(e,t){const n=await fetch("/api/csrf-token");if(!n.ok)throw new Error("Unable to get notification security token");const{csrfToken:r}=await n.json();return fetch(`/api/notifications/${e}`,{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":r},body:JSON.stringify(t)})}async function Vc(e=!1,t=!1){if(Qs())return!0;if(!jh()||!a3()||Notification.permission!=="granted")return!1;const n=await Uh();if(!n?.pushManager)return!1;try{const r=await fetch("/api/notifications/status");if(!r.ok)return!1;const s=await r.json();let o=await n.pushManager.getSubscription();const a=!!(o?.expirationTime&&o.expirationTime-Date.now()<NS);if(!o)try{o=await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:zS(s.publicKey)})}catch(p){return console.warn(`[PWA notifications] Push subscription missing; re-subscribe failed${t?" (user gesture)":""}:`,p),!1}const d=Number(window.localStorage.getItem(mm)??"0"),h=!s.subscription||s.subscription.endpoint!==o.endpoint||Date.now()-(s.subscription.updatedAt??0)>=_2;if(e||h||Date.now()-d>=_2||a){if(!(await Ag("subscribe",{subscription:o.toJSON(),aiEnabled:$h(),exitEnabled:wg(),alertStyle:I0(),locale:navigator.language})).ok)return!1;window.localStorage.setItem(mm,String(Date.now()))}return!0}catch(r){return console.warn("[PWA notifications] Push subscription sync failed:",r),!1}}async function GS(){if(Qs())return;const t=await(await Uh())?.pushManager?.getSubscription();try{await Ag("unsubscribe",{endpoint:t?.endpoint})}finally{await t?.unsubscribe();try{window.localStorage.removeItem(mm)}catch{}}}async function Gf(){if(Qs()||!jh())return;(await Ag("preferences",{aiEnabled:$h(),exitEnabled:wg(),alertStyle:I0(),locale:navigator.language})).status===404&&await Vc(!0)}async function WS(){if(!Qs())try{const e=navigator;typeof e.clearAppBadge=="function"&&await e.clearAppBadge()}catch{}}async function VS(e){if(!Qs())try{const t=await Uh();if(!t||typeof t.getNotifications!="function")return;const n=`agent:${e}`,r=await t.getNotifications({tag:n});for(const o of r)o.close();const s=navigator;if(typeof s.setAppBadge=="function"){const o=await t.getNotifications();await s.setAppBadge(o.length)}}catch{}}async function Vd(e){if(!jh()||!sc())return!1;if(e.requireHidden!==!1&&jS())return!0;const t=Qs();if(t){const o=e.alertStyle??I0(),a=await t.showNotification({title:e.title,body:e.body,tag:e.tag,sessionId:e.data?.sessionId,silent:o==="quiet",persistent:o==="persistent"});return t.notificationDeliveryConfirmation===!0&&a}if(Notification.permission!=="granted")return!1;const n=await Uh();if(e.deferToPush&&await n?.pushManager?.getSubscription())return!0;if(e.requireHidden!==!1){if(await n?.pushManager?.getSubscription())return!0}if(!HS(e))return!0;const r=e.alertStyle??I0(),s={body:e.body,tag:e.tag,icon:"/pwa-192x192.png",badge:"/maskable-icon-512x512.png",requireInteraction:r==="persistent",renotify:r==="persistent"?!!e.tag:!1,silent:r==="quiet",vibrate:r==="quiet"?[]:[80,40,80],data:{url:e.data?.url??"/",sessionId:e.data?.sessionId}};try{if(n&&typeof n.showNotification=="function")return await n.showNotification(e.title,s),!0;const o=new Notification(e.title,s);return o.onclick=()=>{window.focus(),e.data?.url&&window.location.href!==e.data.url&&window.location.assign(e.data.url),o.close()},!0}catch(o){if(o instanceof DOMException&&o.name==="NotSupportedError"&&s.renotify)try{const a={...s,renotify:!1};return n&&typeof n.showNotification=="function"?await n.showNotification(e.title,a):new Notification(e.title,a),!0}catch(a){return console.warn("[PWA notifications] Failed to show notification (renotify fallback):",a),!1}return console.warn("[PWA notifications] Failed to show notification:",o),!1}}function qS(){try{return localStorage.getItem("termdock:locale")||"en"}catch{return"en"}}function YS(e,t){return e==="zh"?{waitingTitle:`${t} 需要你的处理`,waitingBody:`${t} 需要你的处理。`,doneTitle:`${t} 已完成`,doneBody:`${t} 已完成,点按查看结果。`,exitedTitle:`${t} 已退出`,exitedBody:`${t} 已退出,点按查看结果。`}:{waitingTitle:`${t} needs your input`,waitingBody:`${t} is waiting for your input.`,doneTitle:`${t} finished`,doneBody:"Tap to see the result.",exitedTitle:`${t} exited`,exitedBody:"Tap to see the result."}}const L2=1e6;function _l(e){return{sessionId:e,directory:"",terminalSessionId:null,mode:"shell",tmuxSessionName:null,activeProgram:null,activeProgramRaw:null,activeProgramSource:null,cwd:null,inCopyMode:!1,isConnecting:!1,agentStatus:null,agentIndicator:null,agentStatusDetail:null,agent:null,agentMessage:null,agentNativeSessionId:null,agentResumeRecovered:!1,agentRich:!1,agentActivity:0,agentCwd:null,agentNeedsReview:!1,shellTitle:null,promptState:null,shellExitCode:null,tuiProgress:null,gitStatus:null,bufferChunks:[],bufferLength:0,lastOutputAt:null,updatedAt:Date.now()}}const Hh="termdock-shell-titles-v1";function zh(){if(typeof window>"u")return{};try{const e=localStorage.getItem(Hh);if(!e)return{};const t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}function ZS(e){return zh()[e]??null}function KS(e,t){if(!(typeof window>"u"))try{const n=zh();t?n[e]=t:delete n[e],localStorage.setItem(Hh,JSON.stringify(n))}catch{}}function XS(e){if(!(typeof window>"u"))try{const t=zh();delete t[e],localStorage.setItem(Hh,JSON.stringify(t))}catch{}}const Gh="termdock-agent-cache-v1";function Tg(){if(typeof window>"u")return{};try{const e=localStorage.getItem(Gh);if(!e)return{};const t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}function JS(e,t){if(!(typeof window>"u"))try{const n=Tg();t?n[e]=t:delete n[e],localStorage.setItem(Gh,JSON.stringify(n))}catch{}}function eC(e){if(!(typeof window>"u"))try{const t=Tg();delete t[e],localStorage.setItem(Gh,JSON.stringify(t))}catch{}}function tC(){if(!(typeof window>"u"))try{localStorage.removeItem(Gh)}catch{}}function k2(e){return Tg()[e]??null}function nC(){if(!(typeof window>"u"))try{localStorage.removeItem(Hh)}catch{}}const Bn=n3((e,t)=>{const n={pendingChunksBySession:new Map,activitySessionIds:new Set,batchFlushRafRef:null},r=(a,d)=>{const h=new Map;return e(p=>{const g=new Map(p.sessions);let y=p.nextChunkId;const b=Date.now();for(const[v,T]of a){const A=g.get(v)??_l(v);let L=A.bufferChunks.length>0?[...A.bufferChunks]:[],R=A.bufferLength;for(const D of T){const B=y++;L.push({id:B,data:D}),h.set(v,B),R+=D.length}for(;R>L2&&L.length>1;){const D=L.shift();if(!D)break;R-=D.data.length}g.set(v,{...A,bufferChunks:L,bufferLength:R,lastOutputAt:d.has(v)?b:A.lastOutputAt,updatedAt:b})}return{sessions:g,nextChunkId:y}}),h},s=()=>{if(n.batchFlushRafRef===null){if(typeof window>"u"){o();return}n.batchFlushRafRef=window.requestAnimationFrame(()=>{n.batchFlushRafRef=null,o()})}},o=()=>{if(n.pendingChunksBySession.size===0)return;const a=kS(n.pendingChunksBySession),d=new Set([...a.keys()].filter(h=>n.activitySessionIds.has(h)));for(const h of a.keys())n.pendingChunksBySession.has(h)||n.activitySessionIds.delete(h);r(a,d),n.pendingChunksBySession.size>0&&s()};return{sessions:new Map,nextChunkId:1,activeSessionId:null,getTerminalSession:a=>t().sessions.get(a),setActiveSessionId:a=>{if(e({activeSessionId:a}),a){const d=t().sessions.get(a);if(d?.agentNeedsReview){const h=new Map(t().sessions);h.set(a,{...d,agentNeedsReview:!1,updatedAt:Date.now()}),e({sessions:h}),d.terminalSessionId&&u2(d.terminalSessionId)}}},setTerminalSession:(a,d)=>{e(h=>{const p=new Map(h.sessions),g=p.get(a),b=!g||g.terminalSessionId!==d.sessionId?_l(a):g??_l(a),v=d.history??g?.history??[];return p.set(a,{...b,terminalSessionId:d.sessionId,mode:d.mode??b.mode,tmuxSessionName:d.tmuxSessionName??b.tmuxSessionName,activeProgram:d.activeProgram??g?.activeProgram??b.activeProgram,activeProgramRaw:d.activeProgramRaw??g?.activeProgramRaw??b.activeProgramRaw,activeProgramSource:d.activeProgramSource??g?.activeProgramSource??b.activeProgramSource,cwd:d.cwd??g?.cwd??b.cwd,agentResumeRecovered:g?.agentResumeRecovered??b.agentResumeRecovered,shellTitle:g?.shellTitle??zh()[a]??b.shellTitle,sessionId:a,isConnecting:!1,history:v,updatedAt:Date.now()}),{sessions:p}})},setSessionHistory:(a,d)=>{e(h=>{const p=new Map(h.sessions),g=p.get(a)??_l(a);return p.set(a,{...g,history:d,updatedAt:Date.now()}),{sessions:p}})},setSessionActiveProgram:(a,d,h=null,p=null)=>{e(g=>{const y=new Map(g.sessions),b=y.get(a)??_l(a);return y.set(a,{...b,activeProgram:d,activeProgramRaw:p,activeProgramSource:h,updatedAt:Date.now()}),{sessions:y}})},setSessionCwd:(a,d)=>{e(h=>{const p=new Map(h.sessions),g=p.get(a)??_l(a);return p.set(a,{...g,cwd:d,updatedAt:Date.now()}),{sessions:p}})},setSessionShellTitle:(a,d)=>{e(h=>{const p=h.sessions.get(a);if(!p||p.shellTitle===d)return h;const g=new Map(h.sessions);return g.set(a,{...p,shellTitle:d,updatedAt:Date.now()}),{sessions:g}}),KS(a,d)},setSessionPromptState:(a,d,h)=>{e(p=>{const g=p.sessions.get(a);if(!g||g.promptState===d)return p;const y=new Map(p.sessions);return y.set(a,{...g,promptState:d,shellExitCode:h??g.shellExitCode,updatedAt:Date.now()}),{sessions:y}})},setSessionTuiProgress:(a,d)=>{e(h=>{const p=h.sessions.get(a);if(!p)return h;const g=d?.state==="remove"?null:d;if(p.tuiProgress?.state===g?.state&&p.tuiProgress?.progress===g?.progress)return h;const y=new Map(h.sessions);return y.set(a,{...p,tuiProgress:g,updatedAt:Date.now()}),{sessions:y}})},setSessionGitStatus:(a,d)=>{e(h=>{const p=new Map(h.sessions),g=p.get(a);return!g||JSON.stringify(g.gitStatus)===JSON.stringify(d)?h:(p.set(a,{...g,gitStatus:d,updatedAt:Date.now()}),{sessions:p})})},setSessionCopyMode:(a,d)=>{e(h=>{const p=new Map(h.sessions),g=p.get(a);return!g||g.inCopyMode===d?h:(p.set(a,{...g,inCopyMode:d,updatedAt:Date.now()}),{sessions:p})})},setSessionAgentStatus:(a,d)=>{const h=t(),p=h.sessions.get(a);if(!p)return;const g=d.agentStatus??null,y=g&&g!=="idle"?d.agentIndicator??p.agentIndicator??null:null,b=g&&g!=="idle"?d.agentStatusDetail??null:null,v=d.agent!==void 0?d.agent:p.agent,T=d.agentMessage!==void 0?d.agentMessage:g?p.agentMessage:null,A=d.agentNativeSessionId!==void 0?d.agentNativeSessionId:p.agentNativeSessionId,L=d.agentResumeRecovered!==void 0?d.agentResumeRecovered:p.agentResumeRecovered,R=d.agentRich??p.agentRich,D=d.agentActivity??p.agentActivity,B=d.agentCwd!==void 0?d.agentCwd:p.agentCwd,j=h.activeSessionId!==a,P=p.agentStatus==="working"||p.agentStatus==="waiting"||p.agentStatus==="done",$=d.reviewed===!1||d.reviewed===null&&g===null&&P&&j;if(p.agentStatus===g&&p.agentIndicator===y&&p.agentStatusDetail===b&&p.agent===v&&p.agentMessage===T&&p.agentNativeSessionId===A&&p.agentResumeRecovered===L&&p.agentRich===R&&p.agentActivity===D&&p.agentCwd===B&&p.agentNeedsReview===$)return;const z=new Map(h.sessions);if(z.set(a,{...p,agentStatus:g,agentIndicator:y,agentStatusDetail:b,agent:v,agentMessage:T,agentNativeSessionId:A,agentResumeRecovered:L,agentRich:R,agentActivity:D,agentCwd:B,agentNeedsReview:$,updatedAt:Date.now()}),e({sessions:z}),v&&JS(a,v),!$h())return;const H=v?.displayName??p.agent?.displayName??"Agent",ye=qS(),q=YS(ye,H);if(g==="waiting"&&p.agentStatus!=="waiting"&&j){Vd({title:q.waitingTitle,body:T??q.waitingBody,tag:`agent:${a}`,dedupKey:`agent:${a}:waiting:${D}`,data:{url:"/",sessionId:a},deferToPush:!0});return}if(g==="done"&&p.agentStatus!=="done"&&j){Vd({title:q.doneTitle,body:q.doneBody,tag:`agent:${a}`,dedupKey:`agent:${a}:done:${D}`,data:{url:"/",sessionId:a},deferToPush:!0});return}g===null&&(p.agentStatus==="working"||p.agentStatus==="waiting")&&j&&Vd({title:q.exitedTitle,body:q.exitedBody,tag:`agent:${a}`,dedupKey:`agent:${a}:exited:${D}`,data:{url:"/",sessionId:a},deferToPush:!0})},setAgentResumeRecovered:(a,d)=>{e(h=>{const p=new Map(h.sessions),g=p.get(a)??_l(a);return g.agentResumeRecovered===d?h:(p.set(a,{...g,agentResumeRecovered:d,updatedAt:Date.now()}),{sessions:p})})},clearAgentNeedsReview:a=>{const d=t().sessions.get(a);d?.agentNeedsReview&&(e(h=>{const p=new Map(h.sessions),g=p.get(a);return!g||!g.agentNeedsReview?h:(p.set(a,{...g,agentNeedsReview:!1,updatedAt:Date.now()}),{sessions:p})}),d.terminalSessionId&&u2(d.terminalSessionId))},setConnecting:(a,d)=>{e(h=>{const p=new Map(h.sessions),g=p.get(a)??_l(a);return p.set(a,{...g,isConnecting:d,updatedAt:Date.now()}),{sessions:p}})},appendToBuffer:(a,d,h)=>{if(!d)return;let p=n.pendingChunksBySession.get(a);p||(p=[],n.pendingChunksBySession.set(a,p)),p.push(...S2(d)),h?.markActivity!==!1&&n.activitySessionIds.add(a),s()},hasPendingBufferWrites:a=>(n.pendingChunksBySession.get(a)?.length??0)>0,flushPendingBufferWrites:a=>{const d=n.pendingChunksBySession.get(a);if(!d?.length)return t().sessions.get(a)?.bufferChunks.at(-1)?.id??null;n.pendingChunksBySession.delete(a);const h=n.activitySessionIds.delete(a);return n.pendingChunksBySession.size===0&&n.batchFlushRafRef!==null&&(window.cancelAnimationFrame(n.batchFlushRafRef),n.batchFlushRafRef=null),r(new Map([[a,d]]),h?new Set([a]):new Set).get(a)??null},replaceBuffer:(a,d)=>{n.pendingChunksBySession.delete(a),n.activitySessionIds.delete(a),n.pendingChunksBySession.size===0&&n.batchFlushRafRef!==null&&(window.cancelAnimationFrame(n.batchFlushRafRef),n.batchFlushRafRef=null);let h=null;return e(p=>{const g=new Map(p.sessions),y=g.get(a);if(!y)return p;if(!d||d.length===0)return g.set(a,{...y,bufferChunks:[],bufferLength:0,updatedAt:Date.now()}),{sessions:g};let b=p.nextChunkId;const v=[];let T=0;for(const A of d)if(A)for(const L of S2(A)){const R=b++;v.push({id:R,data:L}),h=R,T+=L.length}for(;T>L2&&v.length>1;){const A=v.shift();if(!A)break;T-=A.data.length}return g.set(a,{...y,bufferChunks:v,bufferLength:T,updatedAt:Date.now()}),{sessions:g,nextChunkId:b}}),h},clearTerminalSession:a=>{n.pendingChunksBySession.delete(a),n.activitySessionIds.delete(a),n.pendingChunksBySession.size===0&&n.batchFlushRafRef!==null&&(window.cancelAnimationFrame(n.batchFlushRafRef),n.batchFlushRafRef=null),e(d=>{const h=new Map(d.sessions),p=h.get(a);return p&&h.set(a,{...p,terminalSessionId:null,isConnecting:!1,agentStatus:null,agentIndicator:null,agentStatusDetail:null,agent:null,agentMessage:null,agentNeedsReview:!1,updatedAt:Date.now()}),{sessions:h}})},clearBuffer:a=>{n.pendingChunksBySession.delete(a),n.activitySessionIds.delete(a),n.pendingChunksBySession.size===0&&n.batchFlushRafRef!==null&&(window.cancelAnimationFrame(n.batchFlushRafRef),n.batchFlushRafRef=null),e(d=>{const h=new Map(d.sessions),p=h.get(a);return p?(h.set(a,{...p,bufferChunks:[],bufferLength:0,updatedAt:Date.now()}),{sessions:h}):d})},removeTerminalSession:a=>{n.pendingChunksBySession.delete(a),n.activitySessionIds.delete(a),e(d=>{const h=new Map(d.sessions);return h.delete(a),{sessions:h}}),XS(a),eC(a)},clearAllTerminalSessions:()=>{n.pendingChunksBySession.clear(),n.activitySessionIds.clear(),n.batchFlushRafRef!==null&&(window.cancelAnimationFrame(n.batchFlushRafRef),n.batchFlushRafRef=null),e({sessions:new Map,nextChunkId:1}),nC(),tC()}}}),l3="\x1B[?2026h",rC="\x1B[?2026l",c3="\x1Bc";function sC(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,n,r)=>{if(t===c3||t.endsWith("!p"))return t+l3;if(n===void 0)return t;const s=n.split(";").filter(o=>Number(o)!==2026);return s.length?`\x1B[?${s.join(";")}${r}`:""})}function iC(e){const t=e.filter(r=>r.length>0).join("");if(!t)return[];const n=sC(t.replace(/^(?:\x1bc)+/,""));return[`${c3}${l3}${n}${rC}`]}function oC(e){return[`\x1B[!p\x1B[?2026h\x1B[H\x1B[2J\x1B[3J${e.join("")}\x1B[?2026l`]}const aC=/^[A-Za-z0-9_@%+=:,./-]$/;function E2(e){return Array.from(e,t=>(t.codePointAt(0)??0)>127||aC.test(t)?t:`\\${t}`).join("")}const lC={app:{name:"Termdock"},common:{cancel:"Cancel",close:"Close",save:"Save",reset:"Reset",loading:"Loading…",error:"Error",retry:"Retry",refresh:"Refresh",search:"Search",clear:"Clear",delete:"Delete",on:"On",off:"Off",back:"Back",copy:"Copy",decrease:"Decrease",increase:"Increase",use:"Use",previous:"Previous",next:"Next"},login:{prompt:"termdock login",placeholder:"Enter password",placeholderBlocked:({s:e})=>`Please wait ${e}s`,submit:"Sign in",invalidPassword:"Incorrect password",failed:"Login failed"},sidebar:{sessions:"Sessions",noSessions:"No open sessions yet.",noMatchingSessions:"No matching sessions.",toggleSearch:"Toggle search",settings:"Settings",moreActions:"More actions",subscriptionQuota:"Subscription quota",pinSidebar:"Keep sidebar open",unpinSidebar:"Stop keeping sidebar open",runningSessionButton:"Running sessions button",runningSessionButtonHint:"Tap to cycle, swipe sideways to select, hold to drag",updateAvailable:({version:e})=>`Termdock ${e} is available`,updateInstalling:"Installing in the background without interrupting this service.",updateReady:"The update is installed and ready for a confirmed restart.",updateRestart:"Restart and finish update",updateRestartConfirm:({version:e})=>`Restart Termdock and switch to ${e}? This page will reconnect briefly and sessions will stay open.`,updateRestarting:"Restarting; this page will reconnect automatically…",updateFailed:"Automatic installation failed. This reminder will remain.",updateRetry:"Try again",filterSessions:"Filter sessions",clearSearch:"Clear search",groupByFolder:"Group by folder",groupByFolderTitle:"Collapse sessions into groups by working directory. Mutually exclusive with drag sorting.",ungrouped:"Other",needsAttention:"Needs attention",waitingForYou:"Waiting for you",completedUnread:"Completed · unread",closeSession:({name:e})=>`Close ${e}`,newShell:"Shell",newTmux:"Tmux",newTmuxDisabled:"tmux not available on server",confirmNewShell:"Create Shell?",confirmNewTmux:"Create Tmux?",newSession:"New terminal",newSessionWithAgent:({agent:e})=>`New ${e}`,moreLaunchOptions:"More launch options",recoverableSessions:"Recoverable sessions",refreshRecoverableSessions:"Refresh recoverable sessions",restoreRecoverableSession:({name:e})=>`Restore ${e}`,restoringRecoverableSession:"Restoring…",restore:"Restore",newSessionAdvanced:"Quick-launch agent",newSessionComposerTitle:"Start a session",newSessionHint:"Choose how and where it starts",launchSessionWith:({name:e})=>`Start ${e}`,setNewSessionDefault:({name:e})=>`Set ${e} as default`,currentNewSessionDefault:({name:e})=>`${e} is the current default`,currentDefaultAgent:({name:e})=>`Current default: ${e}`,defaultAgent:"Default",makeDefault:"Make default",sessionMode:"Run mode",tmuxKeepsRunning:"Keeps running after disconnect",resumeHistory:"Recent conversations",resumeHistoryCount:({n:e})=>`${e} saved`,resumeHistoryLoading:"Loading recent Agent conversations…",resumeHistoryAction:({title:e})=>`Resume ${e}`,resumeHistoryRemove:({title:e})=>`Remove ${e} from recent conversations`,resumeHistoryLoadFailed:"Could not load recent Agent conversations.",resumeHistoryFailed:"Could not prepare this Agent conversation for resume.",resumeHistoryRemoveFailed:"Could not remove the conversation from history.",workingDirectory:"Working directory",directoryPlaceholder:"Enter a directory path",browseDirectories:"Browse",hideDirectoryBrowser:"Hide browser",chooseDirectory:"Choose working directory",directoryPickerHint:"Open a folder, then confirm the current location.",useThisFolder:"Use folder",recentDirectories:"Recent directories",startCommand:"Start command",customCommand:"Other command",commandPlaceholder:"Optional, e.g. codex",detectAgents:"Detect agents again",savePreset:"Save as preset",createAndRun:"Create and run",createSession:"Create terminal",openLeftSidebar:"Open left sidebar",openRightSidebar:"Open right sidebar",closeSidebar:"Close sidebar"},rightSidebar:{workspace:"Workspace",currentProject:"Project",browsingLocation:"Browsing",parentFolder:"Parent folder",backToProjectRoot:"Back to project",refreshFiles:"Refresh current folder",resizeFileTree:"Drag to resize file browser",pinCurrentFolder:"Pin current folder to this project",unpinCurrentFolder:"Unpin current folder",showHiddenFiles:"Show hidden files",hideHiddenFiles:"Hide hidden files",insertCurrentFolder:"Insert current folder reference",insertCurrentFolderShort:"Insert",pinnedFolders:"Pinned",unpinFolder:({name:e})=>`Unpin ${e}`,fileWatchUnavailable:({message:e})=>`File watcher unavailable: ${e}. Click to refresh manually.`,browsingOutsideProject:"Browsing outside current project",browsingOutsideProjectHint:"Git and Changes still use the current project. File references from here are inserted as external paths.",toggleSearch:"Toggle search",refreshGit:"Refresh Git status",gitLastUpdated:({time:e})=>`Last updated: ${e}`,close:"Close",filterChanges:"Filter changes or files",searchPlaceholderContent:"Search text in files…",searchModeName:"File",searchModeContent:"Content",clearSearch:"Clear search",searchScope:"Scope",searchScopePlaceholder:"Relative folder or absolute path",resetSearchScope:"Reset to current folder",searchOptions:"Search options",searchExclude:"Exclude",searchExcludePlaceholder:"dist/**, *.lock",clearSearchExclude:"Clear exclusions",contentSearchOptions:"Content search options",matchCase:"Match case",matchWholeWord:"Whole word",useRegex:"Regex",insertGitContext:"Insert current Git context into terminal",copyGitContext:"Copy Git context",insertChangeAuditPrompt:"Explain changes",insertChangeAuditPromptTitle:"Insert the change audit prompt into the current session",changeAuditShort:"Explain changes",changeAuditLoading:"Loading hunk explanations…",changeAuditLoaded:({count:e})=>`${e} hunk explanation${e===1?"":"s"} loaded`,changeAuditLoadedAt:({time:e})=>`Generated ${e}`,changeAuditRegenerate:"Regenerate",changeAuditRefreshStale:"Fill stale",changeAuditRefreshStaleTitle:"Insert a prompt to refresh stale hunk explanations",clearChangeAudit:"Clear",clearChangeAuditTitle:"Clear hunk explanations for the current repository",changeAuditClearFailed:({message:e})=>`Failed to clear hunk explanations: ${e}`,changeAuditScopeAll:"All repositories",changeAuditScopeLabel:"Explain scope",branchAuditTitle:"Branch explanation",branchAuditShort:"Explain branch changes",branchAuditBaseLabel:"Base branch",branchAuditBasePlaceholder:"Base branch, e.g. master",branchAuditBaseSearchPlaceholder:"Search base branch",branchAuditBaseEmpty:"No branch options. Type a branch name directly.",branchAuditGenerate:"Generate",branchAuditRegenerate:"Regenerate",branchAuditGenerateTitle:"Insert a prompt to explain this branch against the base branch",branchAuditViewDiff:"View diff",branchAuditViewDiffTitle:"View target branch changes against the base branch",branchAuditDiffLoading:"Loading branch diff...",branchAuditDiffEmpty:"No changes between this branch and the base branch.",branchAuditMissingBase:({repo:e})=>`${e} has no base branch set`,branchAuditRefreshDiff:"Refresh diff",branchAuditRefreshStale:"Fill stale",branchAuditRefreshStaleTitle:"Insert a prompt to refresh stale branch explanations",branchAuditClearTitle:"Clear current branch explanation",branchAuditClearFailed:({message:e})=>`Failed to clear branch explanation: ${e}`,branchAuditCommitCount:({count:e})=>`${e} commit${e===1?"":"s"}`,branchAuditFileCount:({count:e})=>`${e} file${e===1?"":"s"}`,branchAuditTruncated:"diff truncated",branchAuditCurrent:"Saved explanation",branchAuditStale:"Explanation is stale",branchAuditEmpty:"No branch explanation yet. Generate one to persist it here for later review.",branchAuditView:"View explanations",branchAuditSaved:({count:e})=>`${e} hunk explanation${e===1?"":"s"} saved`,branchAuditGeneratedAt:({time:e})=>`Generated ${e}`,insertPreset:({label:e})=>`Insert: ${e}`,tabChanges:"Changes",tabGit:"Git",tabFiles:"Files",inserted:"Inserted",copied:"Copied",toggleContextDraft:"Toggle context draft",contextDraftTitle:"Context draft",contextDraftHint:"References are added here while enabled. Keep browsing, add instructions, then insert once.",contextDraftPlaceholder:"Compose a longer prompt here. Keep using sidebar references to add context…",contextDraftCollapse:"Collapse context draft",contextDraftExpand:"Expand context draft",contextDraftDisable:"Disable context draft",contextDraftClear:"Clear draft",contextDraftInsert:"Insert",contextDraftInsertAndSend:"Insert & send",contextDraftInserted:"Inserted",contextDraftSent:"Sent",contextDraftSend:"Send draft",contextDraftAppended:"Reference added",contextDraftResize:"Drag to resize, double-click for default height",contextDraftAutoCollapseAfterSend:"Collapse after insert/send",contextDraftInsertFailed:"Terminal disconnected — draft kept",contextDraftCharacterCount:({count:e})=>`${e} chars`,selectFilePrompt:"Select a file to preview its contents",backToFileList:"Back to file list",backToPreviousPreview:"Back to source document",insertLineRef:({lineLabel:e})=>`Insert ${e}`,insertFileRef:"Insert",copyFileRef:"Copy file reference",findInFile:"Find in file",findInFilePlaceholder:"Find in this file…",previousSearchMatch:"Previous match",nextSearchMatch:"Next match",closeFileSearch:"Close file search",downloadFile:"Download file",downloadFailed:"Download failed",uploadFile:"Upload file",uploadFiles:"Upload files",insertLocalFile:"Insert local file",insertLocalImage:"Insert local image",layoutMode:"Display mode",layoutModeAuto:"Auto",layoutModeNarrow:"Narrow",layoutModeWide:"Wide",dropToUpload:"Drop files to upload",uploading:"Uploading…",uploadSuccess:({count:e})=>`${e} file${e===1?"":"s"} uploaded`,uploadFailed:"Upload failed",binaryPreviewHint:"Binary files cannot be previewed. Use the download button above to save it.",selectedLineHint:({lineLabel:e})=>`Selected ${e} · tap "Insert" below to add to terminal`,multiLineHint:"Multi-line select: tap start line, then end line",loadingImage:"Loading image…",imagePreviewHint:"Pinch or ⌘/Ctrl + scroll to zoom · double-tap to reset",imageLoadFailed:"Failed to load image preview",loadingVideo:"Loading video…",videoPreviewHint:"Click to play · hold for 2× · drag to seek",videoLoadFailed:"Failed to load video preview",videoUnsupported:"Your browser does not support this video format",videoPlay:"Play",videoPause:"Pause",videoLongPressSpeed:"Playing at 2×",videoRotate:"Rotate 90° clockwise",videoFullscreenEnter:"Enter fullscreen",videoFullscreenExit:"Exit fullscreen",model3dLoading:"Loading 3D model…",model3dExplode:"Exploded view",model3dExplodeAxis:"Explosion axis (viewer coordinates)",model3dExplodeAmount:"Explosion amount",model3dHome:"Reset view",model3dFit:"Fit visible parts",model3dFront:"Front view",model3dTop:"Top view",model3dRight:"Right view",model3dAssemble:"Restore assembly",model3dExplodedNotice:"Exploded · dimensions and references remain assembled",model3dLoadFailed:"Failed to load 3D model preview",model3dTimeout:"3D model transfer timed out. Check your connection and retry.",model3dDimensions:({dims:e})=>`Dimensions: ${e}`,model3dHintMouse:"Drag to orbit · two-finger pan · pinch or scroll to zoom",model3dHintTouch:"One finger to orbit · two fingers to zoom & pan",model3dFullscreenEnter:"Fullscreen",model3dFullscreenExit:"Exit fullscreen",model3dBgToLight:"Light background",model3dBgToDark:"Dark background",model3dRefresh:"Reload model",model3dClipToggle:"Section view",model3dClipPosition:"Section position",model3dClipFlip:"Flip section direction",model3dFeatureToggle:"Features",model3dFeatureStatus:({total:e,positioned:t})=>`Features: ${e} · positioned ${t}`,model3dFeatureInsert:"Insert reference",model3dGlossaryToggle:"Modeling terms",model3dPickToggle:"Select part / reference",model3dPickHint:"Select a part to hide it or insert a point reference",model3dHidePart:"Hide part",model3dShowAllParts:({count:e})=>`Show all (${e})`,model3dParts:"Parts",model3dCloseParts:"Close parts",model3dSearchParts:"Find a part",model3dClearPartSearch:"Clear part search",model3dHiddenParts:({count:e})=>`${e} hidden`,model3dShowNamedPart:({name:e})=>`Show ${e}`,model3dHideNamedPart:({name:e})=>`Hide ${e}`,model3dIsolateNamedPart:({name:e})=>`Only show ${e}`,model3dIsolatePart:"Only this part",model3dShowPart:"Show part",model3dNoParts:"No matching parts",model3dUndoVisibility:"Undo",model3dClearSelection:"Clear selection",model3dAllPartsVisible:"All parts visible",model3dInspectHint:"Drag to orbit · double-tap to zoom · double-tap empty space to fit",model3dUnnamedPart:({index:e})=>`Part ${e}`,model3dCanvas:"3D model",model3dMore:"More model options",edaLoading:"Rendering KiCad file…",reviewTargetChanged:"The active session changed. Return to the original session before inserting this reference.",reviewReference:"Review reference",reviewReferenceHint:"Add context, then insert. Nothing is sent automatically.",reviewSnapshot:"Snapshot of the selected viewer",reviewCapturing:"Capturing this view…",reviewIncludeImage:"Include snapshot (stored temporarily on this server)",reviewCaptureFailed:"Snapshot unavailable; location can still be inserted.",reviewNote:"Your comment (optional)",reviewNotePlaceholder:"What should change here?",reviewDetails:"View location and quoted content",reviewUploading:"Preparing reference…",reviewAddToDraft:"Add to context draft",reviewInsert:"Insert reference",reviewUploadFailed:"Could not prepare the reference. Your comment is kept. Retry, or uncheck the snapshot to insert text only.",edaLoadFailed:"Failed to render KiCad preview",edaTimeout:"KiCad preview rendering or transfer timed out. Please retry.",edaRefresh:"Render again",edaPickHint:"Click a schematic or PCB location to create an electronics annotation",edaPickedPosition:({x:e,y:t})=>`Selected ${e}%, ${t}%`,edaPickedBoardPosition:({x:e,y:t,object:n})=>`Board ${e}, ${t} mm · ${n}`,edaInspecting:"Reading board coordinates and nearby object…",edaNoNearbyObject:"No nearby object",edaInsertAnnotation:"Insert electronics annotation",csvUnnamedColumn:({index:e})=>`Column ${e}`,csvSelectedCell:({row:e,column:t})=>`Row ${e} · ${t}`,csvPickHint:({rows:e,columns:t})=>`${e} records · ${t} columns; click a cell to reference`,csvInsertAnnotation:"Insert table annotation",csvTablePreview:"Table preview: select a cell to reference its record",kicadLocalStateNotice:"This is local UI state and is not part of schematic, PCB, or manufacturing review.",kicadShowRawJson:"Show raw JSON",kicadProjectPickHint:"Select a setting to insert a reference",kicadInsertSetting:"Insert setting",markdownPreview:"Preview",markdownSource:"Source",markdownPreviewHint:"Tap a line/section to reference, tap another to extend; drag the left rail to select a range",htmlPreview:"Preview",htmlSource:"Source",htmlPreviewHint:"Sandboxed iframe preview; scripts run sandboxed",htmlFullscreenEnter:"Enter fullscreen preview",htmlFullscreenExit:"Exit fullscreen preview",markdownOutline:"Markdown outline",markdownOutlineShort:"Outline",closeMarkdownOutline:"Close outline",changedFromPath:({path:e})=>`from ${e}`,selectedLineFooter:({lineLabel:e})=>`Selected ${e}`,clearSelection:"Clear",allChanges:"All changes",backToChangeList:"Back to list",allRepositories:"All repositories",allRepositoriesShort:"All",repositories:"Repositories",gitRepositorySectionTitle:"Repository",gitRepositoryLabel:"Repository",gitRepositoryPlaceholder:"Select repository",gitRepositorySearchPlaceholder:"Search repositories",gitRepositoryEmpty:"No available repositories",selectRepositoryForGitActions:"Select a repository before running Git actions",selectRepositoryForDiff:"Select a repository or file to view diff",repoChangedCount:({count:e})=>`${e} change${e===1?"":"s"}`,repoStagedCount:({count:e})=>`${e} staged`,noChanges:"No changes",noMatchingChanges:"No matching changes",loadingGitChanges:"Loading Git changes…",loadingGitChangesSlow:"Large repositories can take a few seconds.",refreshingGitChanges:"Refreshing Git changes…",gitChangesLoadFailed:"Unable to load Git changes",retryGitChanges:"Retry",insertThisFile:"Insert this file reference into terminal",viewDiff:"View diff",diffViewMode:"Change file display mode",diffViewModeList:"Flat list",diffViewModeTree:"Folder tree",diffViewModeAi:"AI walkthrough",changeWalkthroughEmpty:"No AI walkthrough yet. Generate explanations to show the overview, flow, and checks here.",gitInfo:"Git context",wrapLongLines:"Wrap long lines",wrapOn:"Wrapped",wrapOff:"Raw",horizontalScrollHint:"Swipe left/right to see the full diff",stageFile:"Stage",stageAll:"Stage all",unstageFile:"Unstage",stashFile:"Stash",stashAll:"Stash all",restoreFile:"Restore",gitQuickActions:"Git Actions",gitUnavailable:"Current directory is not a Git repository",branchSectionTitle:"Current branch",currentBranchLabel:"Branch",switchBranchPlaceholder:"Select branch",switchBranchSearchPlaceholder:"Search local branch",switchNoBranches:"No local branches",switchBranch:"Switch",noStagedChangesShort:"no staged",stagedCount:({count:e})=>`${e} staged`,stagedCountShort:({count:e})=>`${e} staged`,commitSectionTitle:"Commit",commitReadyHint:({count:e})=>`${e} file${e===1?"":"s"} ready`,commitMessagePlaceholder:"Commit message",commitChanges:"Commit",commitNeedsStaged:"Stage changes before committing",recentCommitsTitle:"Recent commits",recentCommitsSearchPlaceholder:"Search commit hash or message",recentCommitsLoadMore:"Load more commits",recentCommitsEmpty:"No commit history",pushSectionTitle:"Remote sync",pushRemoteLabel:"Remote",pushRemotePlaceholder:"origin",pushRemoteSearchPlaceholder:"Search remote",pushNoRemotes:"No remotes",pushBranchLabel:"Target",pushBranchPlaceholder:({branch:e})=>`${e}`,pushBranchSearchPlaceholder:"Search branch",pushNoBranches:"No branches",pushUpstreamBadge:"upstream",pushCurrentBranchBadge:"current",pushNoUpstream:"No upstream configured",pushUpToDate:"Up to date with remote",pushAheadCount:({count:e})=>`${e} commit${e===1?"":"s"} to push`,pushBehindCount:({count:e})=>`${e} commit${e===1?"":"s"} to pull`,pushDivergedCount:({ahead:e,behind:t})=>`${e} ahead / ${t} behind`,pullChanges:"Pull",pushChanges:"Push",gitActionRunning:"Running…",gitActionFailed:({message:e})=>`Git action failed: ${e}`,confirmRestoreTitle:"Discard changes?",confirmRestoreDescription:({path:e})=>`This will discard unstaged changes in ${e}. Termdock cannot recover them.`,confirmRestorePhrase:"discard changes",confirmRestorePlaceholder:"Type “discard changes” to confirm",confirmStashAllTitle:"Stash all changes?",confirmStashAllDescription:"This moves current working tree changes, including untracked files, into a stash.",confirmAction:"Confirm",renderingHtml:"Rendering HTML…",footnotes:"Footnotes",backToFootnote:({index:e})=>`Back to footnote ${e}`,openMermaidDiagram:"Open Mermaid diagram",mermaidDiagram:"Mermaid diagram",renderingDiagram:"Rendering diagram…",markdownImage:"Markdown image",image:"Image",previousImage:"Previous image",nextImage:"Next image",closeImagePreview:"Close image preview",emptyFile:"Empty file.",insertReference:({reference:e})=>`Insert reference: ${e}`,copyReference:({reference:e})=>`Copy reference: ${e}`,byteCount:({count:e})=>`${e} bytes`,previewTruncated:"Preview truncated to 1 MB",branchCandidatesLoading:"Loading branch candidates…",includeUncommitted:"Include local uncommitted changes",includeUncommittedHint:"Include working tree and untracked diffs when viewing or explaining changes",missingBaseReposSkipped:({repositories:e})=>`Repositories without a base branch will be skipped: ${e}`,localBranch:"local",remoteBranch:"remote"},fileTree:{insertRef:"Insert",insertRefTitle:"Insert file reference into active terminal",openDirRoot:"Open",openDirRootTitle:"Use this folder as the current browsing root",openInFileBrowser:"Reveal in Finder",openInFileBrowserTitle:"Open this item in the system file browser",openInFileBrowserFailed:"Failed to open file browser",moreDirActions:"More folder actions",searchFromDir:"Search from here",searchFromDirTitle:"Search only this folder and its descendants",pinDir:"Pin",pinDirTitle:"Pin this folder to the current project",unpinDir:"Pinned",unpinDirTitle:"Unpin this folder",pinFileTitle:"Pin this file to the current project",unpinFileTitle:"Unpin this file",pinFile:"Pin",unpinFile:"Unpin",moreFileActions:"More file actions",deleteFile:"Delete file",deleteFileConfirm:({name:e})=>`Delete “${e}”? This action cannot be undone.`,deleteFileFailed:({message:e})=>`Failed to delete file: ${e}`,noWorkingDir:"No working directory detected.",emptyDir:"Empty directory.",noMatchingFiles:"No matching files.",searching:"Searching files…",searchingWithCount:({count:e})=>`Searching… ${e} found`,searchResults:({count:e})=>`${e} results`,searchScope:"Search scope",searchTruncatedHint:({count:e})=>`Fallback search scanned a large directory and stopped after ${e} matches. Install ripgrep or refine the query for complete results.`,searchStillRunning:"Search is still running. More results will appear automatically.",showingSearchResults:({shown:e,total:t})=>`Showing ${e} of ${t}`,loadMoreSearchResults:({shown:e,total:t})=>`Show more (${e}/${t})`,contentMatchesCount:({count:e})=>`${e} file${e===1?"":"s"} with matches`,moreMatches:({count:e})=>`+${e} more match${e===1?"":"es"}`,noContentMatches:"No matches found in file contents.",contentSearchNeedsRipgrep:"Content search requires ripgrep (rg). Install it on the server to search inside files.",truncatedHint:"Showing first 1000 entries. Use search or open a smaller folder for better performance.",dropToUploadHere:"Upload here",symbolicLink:"Symbolic link",sortByModified:"Sort by recent changes",sortByName:"Sort by name",sortedByModified:"Sorted by recent changes"},diffViewer:{noFileChanges:"No changes in this file.",noUnstagedChanges:"No unstaged changes.",emptyHint:"Make some changes, or pull from a remote.",loading:"Loading diff…",insertAllDiff:"Insert current diff as context",insertFileDiff:"Insert this file's diff",insertHunkDiff:"Insert this hunk",insertHunkShort:"Insert",insertFileShort:"Insert",insertAllShort:"Insert all",stageHunk:"Stage",stageHunkTitle:"Stage only this hunk (git apply --cached)",revertHunk:"Revert",revertHunkTitle:"Revert this hunk in the worktree (cannot be undone)",revertHunkConfirm:"Confirm revert?",hunkActionApplying:"Applying…",hunkActionUnavailable:"Cannot build a patch for this hunk",hunkActionFailed:({message:e})=>`Failed: ${e}. If the changes moved on, refresh and retry.`,auditExplanation:"Change meaning",auditStale:"Explanation stale",auditClear:"Clear explanation",auditGeneratedAt:({time:e})=>`Generated ${e}`,allDiffLabel:"all changes",allChangesLabel:"all changes",workingTree:"Working tree changes",allUnstaged:"All unstaged changes",binaryOrEmpty:"No textual changes to display.",noFinalNewline:"No newline at end of file",noHunks:"No hunks",hunkOutline:"Hunks",expandHunkRail:"Show hunk list",collapseHunkRail:"Hide hunk list",prevHunk:"Previous hunk",nextHunk:"Next hunk",prevFile:"Previous",nextFile:"Next",expandFile:"Expand file",collapseFile:"Collapse file",expandAll:"Expand all",collapseAll:"Collapse all",collapseHunk:"Collapse hunk",useBracketKeysHint:"Press [ / ] to jump between hunks",unified:"Unified",unifiedMode:"Unified view",split:"Split",splitMode:"Side-by-side view",moreActions:"More actions",view:"View",loadingPreviousFile:"Loading previous file…",loadingNextFile:"Loading next file…",resizeNavigation:"Resize diff navigation",focusPathHint:"Select a label to focus its path",whitespace:"Whitespace",whitespaceDefault:"Default",whitespaceTrim:"Ignore trailing",whitespaceIgnore:"Ignore all",whitespaceIgnoreBlankLines:"Ignore blank lines",context:"Context",contextLines:({count:e})=>`${e} lines`,contextAll:"All"},settings:{title:"Settings",font:"Font",render:"Render",theme:"Theme",darkTheme:"Dark",lightTheme:"Light",newTab:"New tab",debug:"Debug",noSleep:"No sleep",noSleepUnavailable:"No network — disabled",updateTitle:"Termdock update",updateRuntimeTitle:"CLI and service runtime",updateHint:"A manual check downloads and installs a new version immediately. The service restarts only after you confirm.",updateCheck:"Check for updates",updateCheckAgain:"Check again",updateChecking:"Checking npm for the latest version…",updateCheckingShort:"Checking…",updateInstallingShort:"Installing…",updateCurrent:"Termdock is up to date.",desktopUpdateTitle:"macOS desktop app",desktopUpdateHint:"Manually check signed desktop releases published on GitHub.",desktopUpdateUnsupported:"In-app updates require an installed, signed macOS app.",desktopUpdateChecking:"Checking for a desktop update…",desktopUpdateCurrent:"The desktop app is up to date.",desktopUpdateDownloading:"A new version is downloading in the background…",desktopUpdateReady:"The desktop update is downloaded and ready to install.",desktopUpdateInstalling:"Restarting to install the desktop update…",desktopUpdateCheck:"Check desktop app",desktopUpdateCheckAgain:"Check again",desktopUpdateRestart:"Restart and install",desktopUpdateRestartConfirm:"Restart Termdock and install the downloaded desktop update? The terminal service and tmux sessions will remain running.",notifications:"Notify",notificationsTitle:"Notification settings",notificationsHint:"Notify when an AI task finishes while Termdock is hidden.",notificationsPageHint:"Choose which Termdock events can send system notifications. The master switch controls browser permission and delivery; event switches decide what should notify you.",notificationsMaster:"System notifications",notificationsMasterHint:"Allow Termdock to send notifications when it is hidden or running as an installed PWA.",notificationsIOSInstallHint:"On iPhone and iPad, install Termdock to the Home Screen before enabling notifications.",notificationsPermission:"Permission",notificationsPermissionSystem:"Managed by macOS",notificationsTest:"Send test",notificationsTestChecking:"Waiting for macOS to confirm delivery…",notificationsTestDelivered:"Delivered to Notification Center. If no banner appeared, check the alert style and Focus.",notificationsTestFailed:"macOS did not deliver the notification. Allow Termdock in System Settings.",notificationsOpenSystemSettings:"Open system notification settings",notificationsAlertStyle:"Alert style",notificationsAlertStyleHint:"Browsers and Android still decide the final heads-up behavior. Termdock can only request quiet/default/sticky notification options.",notificationsStyleNormal:"Default",notificationsStyleNormalHint:"Sound/vibration if allowed",notificationsStyleQuiet:"Quiet",notificationsStyleQuietHint:"Status tray, no sound",notificationsStylePersistent:"Sticky",notificationsStylePersistentHint:"Stay until dismissed",notificationsEvents:"Events",notificationsAiFinished:"AI task finished",notificationsAiFinishedHint:"Notify when an AI agent stops while Termdock is in the background.",notificationsSessionExited:"Terminal exited",notificationsSessionExitedHint:"Notify when a terminal process exits on its own (closing it yourself does not trigger; delivered via Web Push).",notificationsFutureHint:"More notification types can be added here later without changing the top-level settings layout.",notificationsOffSummary:"System notifications disabled",notificationsAiOnSummary:"AI task finished enabled",notificationsExitOnSummary:"Terminal exit enabled",notificationsBothOnSummary:"AI task finished and terminal exit enabled",notificationsNoEventsSummary:"No notification events enabled",notificationsDenied:"Browser notification permission is blocked. Enable it in site settings.",notificationsUnsupported:"Notifications require a secure context and service worker support.",notificationsTestBody:"Notifications are enabled. You will be notified when an AI task finishes in the background.",shell:"Shell",tmux:"Tmux",auto:"Auto",webgl:"WebGL",canvas:"Built-in",tmuxServer:"Tmux server",tmuxUnavailable:"unavailable",noTmuxSessions:"No tmux sessions on the server.",installTmuxHint:"Install tmux on the server to enable.",refresh:"Refresh",attached:"Attached",restorable:"Restorable",attach:"Attach",attaching:"Attaching…",destroy:"Destroy",sessions:({n:e})=>`${e} session${e===1?"":"s"}`,windows:({n:e})=>`${e} window${e===1?"":"s"}`,keyboardToolbar:"Keyboard toolbar",aiAgentDetection:"AI agent detection",signOut:"Sign out",language:"Language",programNamePlaceholder:"Program name (e.g. claude)",patternPlaceholder:"Regex pattern (e.g. Thinking|Generating)",statusPlaceholder:"Status",addProgram:"Add program",addPattern:"Add pattern",resetDefaults:"Reset defaults",invalidRegex:"Invalid regex",removeProgram:"Remove program",removeRule:"Remove rule",keepLabel:"keep",customColor:"Custom color",tabIndicator:"Tab indicator style",toolbarPresets:"Toolbar presets",detectionRules:"Detection rules",agentHooksHint:"With hooks installed, agents report their own status: working (green), waiting for you (amber), turn done (check) — and you get a notification the moment one needs your input. Hooks install globally but only fire inside termdock terminals.",agentHooksInstall:"Install",agentHooksInstalled:"Installed",agentHooksOutdated:"Outdated",agentHooksNeedsApproval:"Needs approval",agentHooksApprovalHint:"Run /hooks in Codex and approve the Termdock hooks",agentHooksNotInstalled:"Not installed",agentHooksUninstall:"Uninstall",agentHooksReinstall:"Reinstall",agentHooksDevMode:"Dev mode: hooks point at TS sources and need a built install to fire",agentHooksTarget:"writes to",agentAutoRename:"Automatic session titles",agentAutoRenameHint:"Update the title from recent work when an agent finishes a turn. Off by default; manual titles are never overwritten. External plugin CLIs run only after their title feature is enabled.",agentAutoRenameToggle:"Toggle automatic titles for this agent",agentAutoRenameShort:"Auto title",agentAutoRenameNamer:"Title agent",agentAutoRenameFollow:"Follow current session",agentAutoRenameModelsFromCli:"Models discovered from local CLIs",agentAutoRenameRefreshModels:"Refresh CLI models",agentAutoRenameCliDefault:"CLI default model",agentAutoRenameAutomatic:"Automatic selection",agentAutoRenameNoCli:"No supported title CLI detected",agentAutoRenameAdvanced:"Advanced title preferences",agentAutoRenamePreference:"Additional preferences",agentAutoRenamePreferenceHint:"Optional. Add preferences for title style or emphasis; Termdock keeps its default naming rules. Saved when you leave the field.",agentAutoRenamePreferencePlaceholder:"For example: emphasize user value; use action phrases; avoid technical jargon",agentAutoRenamePayloadLimit:"User-message context limit (characters)",agentAutoRenamePayloadLimitHint:"Total raw prompt-submit payload characters retained. Default 12000; range 1000–64000.",agentPlugins:"Agent Plugins",agentPluginAdd:"Add Plugin",agentPluginHint:"Install from an HTTPS Git repository or local directory after reviewing the source. Hooks and executable title CLIs require separate user opt-in.",agentPluginCreate:"Create Plugin",agentPluginDelete:"Delete Plugin",agentPluginInvalid:"Invalid plugin manifest",agentPluginCopyAiPrompt:"Copy AI fix prompt",agentPluginCopied:"Copied",agentPluginSourcePlaceholder:"https://github.com/user/agent-plugin or local directory",agentPluginInstallPackage:"Install plugin",agentPluginAdvancedManifest:"Advanced: paste manifest.json",agentPluginUpdateAvailable:"Update available",agentPluginManualSource:"Manual manifest",agentPluginUpdate:"Update",agentPluginCheck:"Check",agentPluginDoctor:"Diagnose",agentPluginDoctorHint:"Explicitly probe plugin models without generating a title",agentPluginDoctorStatusOk:"Title and model capabilities are healthy",agentPluginDoctorStatusMissing:"titleNamer is not declared",agentPluginDoctorStatusCliDefault:"Titles are available using the CLI default model",agentPluginDoctorStatusNoModels:"No usable model data was returned",agentPluginDoctorStatusFailed:"Model probe failed",agentPluginDoctorModels:"usable models",agentPluginDoctorAutomatic:"automatic",agentPluginDoctorCliDefault:"When no model is specified, the Agent CLI default model is used",agentAutoRenameInterval:"Recheck interval",agentAutoRenameMinutes:"minutes",mobileKeyboard:"Mobile keyboard",saving:"Saving…",rulesHint:"Configure regex patterns to detect what an AI tool is doing in a terminal tab. Each rule can choose its label, color, icon style and how long the indicator is kept after output quiets down. When it stops and you haven't viewed the tab yet, the tab keeps a yellow review hint.",programsHelp:"Supports multiple programs in one config. Separate with commas.",programLabelResolution:"Program label resolution",rawCommandMapping:"Raw command mapping",rawCommandMappingHint:"Rules below map the raw command line to the tab display label. User rules run before built-ins.",genericProgramNames:"Generic program names",genericProgramNamesHint:"Trigger ps-based deep detection (e.g. node, python)",wrapperScriptNames:"Wrapper script names",wrapperScriptNamesHint:"CLI wrappers that launch another tool (e.g. aiden, npx)",shellNamesConfig:"Shell names",shellNamesHint:"Filtered out from tab display (e.g. bash, zsh)",addTag:"+ add",customRules:"Custom rules",addRule:"Add rule",localAccess:"Local access",localAccessHint:"Use this LAN URL from your phone after trusting the local CA. Open Mobile setup on your phone to download the CA certificate.",resetAutoName:"Reset auto",onboardingUrl:"Mobile setup",httpsActive:"HTTPS active",httpsInactive:"HTTPS inactive",caMissing:"CA download unavailable",closeSettings:"Close settings",desktopTitle:"Termdock Desktop",desktopStatusLoading:"Reading native macOS status…",desktopSwitchService:"Switch service",desktopInstallCli:"Install / Repair CLI",desktopCliUpdated:"CLI status updated",desktopOpenDataDirectory:"Open data directory"},toolbarPresets:{preview:"Preview",presets:"Presets",label:"Label",new:"New",reset:"Reset",presetLabelPlaceholder:"Preset label",deletePreset:({name:e})=>`Delete preset ${e}`,matchPrograms:"Match programs",typeEnterHint:"Type & Enter",programsPlaceholder:"vim, nvim, /^claude(-code)?$/i …",programsHelp:"Plain names match as case-insensitive substrings. Wrap in /…/flags for regex (tested against the lowercase program name).",altSlot:"Alt modifier slot",altSlotHint:"Reserve one preview slot for the Alt key.",desktopVisibility:"Show on desktop",desktopVisibilityHint:"Desktop shows only this preset’s custom actions, not the basic keyboard shortcuts.",rowLayout:"Row layout",rowLayoutHint:"Buttons per expanded row.",addRow:"Row",rowN:({n:e})=>`Row ${e}`,del:"Del",buttons:"Buttons",buttonsHint:"Tap to edit. Use ↑↓ to reorder.",addButton:"Add button",noCustomButtons:"No custom buttons yet. Add one to override the default toolbar.",moveUp:"Move up",moveDown:"Move down",removeRow:({n:e})=>`Remove row ${e}`,removeAction:({name:e})=>`Remove ${e}`,labelField:"Label",labelPlaceholder:"Label shown on the button",sequence:"Sequence",sequencePlaceholder:"e.g. /undo or \\t or /||undo",sequenceHint:"Double-tap sequence",doubleTap:"Double-tap sequence",doubleTapAdd:"+ Add",doubleTapPlaceholder:"e.g. /undo\\r or /||undo ||\\r",remove:"Remove",noSequence:"No sequence",preset:"Preset",overCapacityHint:"More buttons than slots. Extra rows will use the last row size."},agentRules:{ruleColors:{green:"Green",yellow:"Yellow",red:"Red",blue:"Blue",purple:"Purple",orange:"Orange",gray:"Gray"}},tab:{session:"Session",new:"New session",rename:"Rename",renameHint:"Change the tab display name",renamePlaceholder:"Leave empty to reset to default",copyCwd:"Copy cwd",copyCwdHint:"Copy the current working directory",resumeAgent:"Resume agent session",resumeAgentHint:"Resume the last conversation by its native session id",resumeAgentAvailable:"Agent conversation available to resume",resumeAgentRecoveredTitle:({agent:e})=>`${e} conversation available`,resumeAgentRecoveredHint:"This terminal was rebuilt after an interruption. Continue where you left off.",resumeAgentNow:"Resume",resumeAgentLater:"Dismiss for now",resumeAgentSubmitting:"Submitting the native resume command…",resumeAgentWaiting:"Waiting for the Agent to confirm the restored conversation…",resumeAgentSuccess:({agent:e})=>`${e} conversation restored`,resumeAgentFailed:"Could not resume the Agent conversation. You can retry.",resumeAgentConflict:"This Agent conversation is already open in another terminal.",resumeAgentBusy:"Wait for the current Agent turn to finish before resuming.",resumeAgentTimeout:"The Agent did not confirm the restored conversation. Check the terminal or retry.",tmuxRecoveryTitle:({count:e})=>`tmux exited unexpectedly; ${e} Agent session(s) can be restored`,tmuxRecoveryHint:"Termdock kept the native session IDs. Restore continues each conversation in its original tab.",tmuxRecoveryRestoreAll:"Restore all",tmuxRecoveryRestoring:"Restoring…",tmuxRecoveryDismiss:"Not now",tmuxRecoveryPartial:({restored:e,failed:t})=>`Restored ${e}; ${t} still need attention.`,tmuxRecoveryFailed:"Recovery failed. Check the terminals and try again.",tmuxRecoveryDismissFailed:"Could not dismiss the recovery notice.",copied:"Copied",close:"Close session",closeHint:"Remove this tab from the list",longPressTip:"Tip: hold a tab still for a moment to open actions; hold and drag to reorder.",sessionsTitle:"Sessions",explorerTitle:"Explorer",split:"Split",splitTitle:"Add to split workspace",splitNew:"New session in workspace",splitNewHint:"Uses the current directory and default type; add as many panes as needed",splitExisting:"Choose a session or workspace",splitExistingHint:"Create multiple independent workspaces; choosing another workspace merges them",splitCurrent:"Current",splitClose:"Exit split",splitLayout:"Split layout",splitHorizontal:"Side by side",splitVertical:"Stacked",splitGrid:"Grid",splitWorkspace:"Split group",splitWorkspaces:"Split workspaces",splitRename:"Rename split group",splitRemovePane:"Remove from split",splitExistingGroups:"Existing split groups",splitAvailableSessions:"Available sessions",splitOccupied:"Grouped",splitUnavailableGrouped:"Grouped mode only supports sessions in the same directory",splitEndedGrouped:"Split ended: grouped mode does not support mixed directories",splitNoOtherSessions:"No other sessions are available",sessionCount:({count:e})=>`${e} session${e===1?"":"s"}`,closeChooserTitle:"Destroy tmux session?",closeChooserDescription:"This will stop the session and every process inside it. This cannot be undone.",destroySession:"Destroy session",confirmDestroySession:"Confirm destroy",destroySessionHint:"Stop the tmux session and every process inside it.",dragToClose:"Drag here to close",releaseToClose:"Release to confirm"},agent:{aiRunning:"AI running",needsReview:"Needs review",finishedReview:"AI finished — needs review",aiWaiting:"AI waiting",copyMode:"Copy mode",jumpToNext:"Jump to next session needing attention",jumpToNextRunning:"Jump to next running session",selectRunningSession:"Select a running session",runningSessionGestureHint:"Tap to cycle · swipe sideways to select · hold to drag",currentSession:"Current"},connection:{reconnecting:"Reconnecting…"},desktopServices:{switchService:"Switch Termdock service",openServices:"Open services",idle:"Idle",manageServices:"Manage services and names"},terminal:{input:"Terminal input",error:"Error",dropFilesToPastePaths:"Drop files to paste paths",loading:"Loading terminal…",initializing:"Initializing terminal engine…",failedToLoad:"Failed to load terminal",unknownError:"An unknown error occurred",componentFailed:"Terminal component failed to load",paste:"Paste",copied:"Copied",copyFailed:"Copy failed",longPressSelectsText:"Long press selects text",longPressSendsArrows:"Long press sends arrow keys",switchLongPressToArrows:"Switch long press to arrow keys",switchLongPressToCopy:"Switch long press to copy selection"},quota:{title:"Subscription Quota",noProviders:"No subscription providers detected.",noProvidersHint:"Quota tracking becomes available when you use AI coding agents with API keys or OAuth login.",exhausted:"Exhausted",left:({n:e})=>`${e} left`,updated:({time:e})=>`Updated ${e}`,refresh:"Refresh",close:"Close"},errorBoundary:{title:"Something went wrong",unexpected:"An unexpected error occurred",retry:"Try Again",copyDetails:"Copy error details",copied:"Copied",copyFailed:"Copy failed"},error:{type:{network:"Network error",session:"Session error",terminal:"Terminal error",auth:"Authentication error",validation:"Validation error",unknown:"Unknown error"},severity:{low:"Notice: ",medium:"Warning: ",high:"Error: ",critical:"Critical: "},suggestion:{networkCheck:"Check your network connection",networkRetry:"Try reconnecting",networkProxy:"Check proxy settings",networkWait:"Wait for the network to recover",sessionRecreate:"Recreate the session",sessionServer:"Check the server status",sessionCache:"Clear your browser cache",terminalRestart:"Restart the terminal",terminalConfig:"Check the terminal configuration",terminalClear:"Clear the terminal output",authRelogin:"Sign in again",authCredentials:"Check your credentials",authAdmin:"Contact the administrator",validationFormat:"Check the input format",validationParams:"Verify your parameters",validationDocs:"See the documentation",unknownReload:"Reload the page",unknownApp:"Restart the app",unknownSupport:"Contact support"}}},cC={app:{name:"Termdock"},common:{cancel:"取消",close:"关闭",save:"保存",reset:"重置",loading:"加载中…",error:"错误",retry:"重试",refresh:"刷新",search:"搜索",clear:"清除",delete:"删除",on:"开",off:"关",back:"返回",copy:"复制",decrease:"减少",increase:"增加",use:"使用",previous:"上一个",next:"下一个"},login:{prompt:"termdock login",placeholder:"请输入密码",placeholderBlocked:({s:e})=>`请稍候 ${e}s`,submit:"登录",invalidPassword:"密码错误",failed:"登录失败"},sidebar:{sessions:"会话",noSessions:"暂无打开的会话。",noMatchingSessions:"没有匹配的会话。",toggleSearch:"切换搜索",settings:"设置",moreActions:"更多操作",subscriptionQuota:"订阅额度",pinSidebar:"常驻边栏",unpinSidebar:"取消常驻",runningSessionButton:"运行中会话按钮",runningSessionButtonHint:"轻点循环,横向滑动选择,长按拖动",updateAvailable:({version:e})=>`Termdock ${e} 可用`,updateInstalling:"正在后台安装,不会中断当前服务。",updateReady:"更新已安装,确认后将重启服务。",updateRestart:"重启并完成更新",updateRestartConfirm:({version:e})=>`确认重启 Termdock 并切换到 ${e}?当前网页会短暂重连,会话不会被关闭。`,updateRestarting:"正在重启,网页将自动重连…",updateFailed:"自动安装失败,提醒会保留。",updateRetry:"重新尝试",filterSessions:"过滤会话",clearSearch:"清除搜索",groupByFolder:"按文件夹分组",groupByFolderTitle:"按工作目录把会话归组折叠;与拖拽排序互斥。",ungrouped:"其他",needsAttention:"待处理",waitingForYou:"等你操作",completedUnread:"完成待查看",closeSession:({name:e})=>`关闭 ${e}`,newShell:"Shell",newTmux:"Tmux",newTmuxDisabled:"服务端未安装 tmux",confirmNewShell:"创建 Shell?",confirmNewTmux:"创建 Tmux?",newSession:"新建 Terminal",newSessionWithAgent:({agent:e})=>`新建 ${e}`,moreLaunchOptions:"更多启动选项",recoverableSessions:"可恢复会话",refreshRecoverableSessions:"刷新可恢复会话",restoreRecoverableSession:({name:e})=>`恢复 ${e}`,restoringRecoverableSession:"恢复中…",restore:"恢复",newSessionAdvanced:"快速启动 Agent",newSessionComposerTitle:"开始新会话",newSessionHint:"选好运行方式和目录后再启动",launchSessionWith:({name:e})=>`启动 ${e}`,setNewSessionDefault:({name:e})=>`将 ${e} 设为默认`,currentNewSessionDefault:({name:e})=>`${e} 是当前默认`,currentDefaultAgent:({name:e})=>`当前默认:${e}`,defaultAgent:"默认",makeDefault:"设为默认",sessionMode:"运行方式",tmuxKeepsRunning:"断开后继续运行",resumeHistory:"最近会话",resumeHistoryCount:({n:e})=>`已保存 ${e} 条`,resumeHistoryLoading:"正在载入最近的 Agent 会话…",resumeHistoryAction:({title:e})=>`恢复 ${e}`,resumeHistoryRemove:({title:e})=>`从最近会话中移除 ${e}`,resumeHistoryLoadFailed:"无法载入最近的 Agent 会话。",resumeHistoryFailed:"无法准备恢复该 Agent 会话。",resumeHistoryRemoveFailed:"无法从历史中移除该会话。",workingDirectory:"工作目录",directoryPlaceholder:"输入目录路径",browseDirectories:"浏览目录",hideDirectoryBrowser:"收起目录",chooseDirectory:"选择工作目录",directoryPickerHint:"进入文件夹,确认后才会更改工作目录。",useThisFolder:"使用此目录",recentDirectories:"最近使用的目录",startCommand:"启动命令",customCommand:"其他命令",commandPlaceholder:"可选,例如 codex",detectAgents:"重新检测 Agent",savePreset:"保存为预设",createAndRun:"创建并运行",createSession:"创建 Terminal",openLeftSidebar:"打开左侧边栏",openRightSidebar:"打开右侧边栏",closeSidebar:"关闭边栏"},rightSidebar:{workspace:"工作区",currentProject:"项目",browsingLocation:"浏览中",parentFolder:"上一级目录",backToProjectRoot:"回到当前项目",refreshFiles:"刷新当前目录",resizeFileTree:"拖动调整文件目录宽度",pinCurrentFolder:"固定当前目录到这个项目",unpinCurrentFolder:"取消固定当前目录",showHiddenFiles:"显示隐藏文件",hideHiddenFiles:"不显示隐藏文件",insertCurrentFolder:"引用当前目录",insertCurrentFolderShort:"引用",pinnedFolders:"固定",unpinFolder:({name:e})=>`取消固定 ${e}`,fileWatchUnavailable:({message:e})=>`文件监听不可用:${e}。可点击手动刷新。`,browsingOutsideProject:"正在浏览当前项目外目录",browsingOutsideProjectHint:"Git 和改动仍使用当前项目;这里引用的文件会按外部路径插入。",toggleSearch:"切换搜索",refreshGit:"刷新 Git 状态",gitLastUpdated:({time:e})=>`上次更新:${e}`,close:"关闭",filterChanges:"过滤改动或文件",searchPlaceholderContent:"在文件内容中搜索…",searchModeName:"文件",searchModeContent:"内容",clearSearch:"清除搜索",searchScope:"范围",searchScopePlaceholder:"相对目录或绝对路径",resetSearchScope:"恢复搜索当前目录",searchOptions:"搜索选项",searchExclude:"排除",searchExcludePlaceholder:"dist/**, *.lock",clearSearchExclude:"清空排除规则",contentSearchOptions:"内容搜索选项",matchCase:"区分大小写",matchWholeWord:"全词",useRegex:"正则",insertGitContext:"把当前 Git 信息插入 Terminal",copyGitContext:"复制 Git 信息",insertChangeAuditPrompt:"解释当前改动",insertChangeAuditPromptTitle:"把更改审计提示词插入当前会话",changeAuditShort:"解释当前改动",changeAuditLoading:"正在加载 hunk 解释…",changeAuditLoaded:({count:e})=>`已加载 ${e} 条 hunk 解释`,changeAuditLoadedAt:({time:e})=>`最近生成 ${e}`,changeAuditRegenerate:"重新生成",changeAuditRefreshStale:"补充失效",changeAuditRefreshStaleTitle:"为已失效的 hunk 解释插入补充生成提示词",clearChangeAudit:"清理",clearChangeAuditTitle:"清理当前仓库的 hunk 解释",changeAuditClearFailed:({message:e})=>`清理 hunk 解释失败:${e}`,changeAuditScopeAll:"全部仓库",changeAuditScopeLabel:"解释范围",branchAuditTitle:"分支解释",branchAuditShort:"解释分支改动",branchAuditBaseLabel:"基线分支",branchAuditBasePlaceholder:"基线分支,例如 master",branchAuditBaseSearchPlaceholder:"搜索基线分支",branchAuditBaseEmpty:"没有可选分支,可直接输入分支名",branchAuditGenerate:"生成解释",branchAuditRegenerate:"重新生成",branchAuditGenerateTitle:"生成当前分支相对于基线分支的解释提示词",branchAuditViewDiff:"查看对比",branchAuditViewDiffTitle:"查看目标分支相对于基线分支的改动",branchAuditDiffLoading:"正在加载分支对比…",branchAuditDiffEmpty:"当前分支相对于基线分支暂无改动。",branchAuditMissingBase:({repo:e})=>`${e} 未设置基线分支`,branchAuditRefreshDiff:"刷新对比",branchAuditRefreshStale:"补充失效",branchAuditRefreshStaleTitle:"为已失效的分支解释插入补充生成提示词",branchAuditClearTitle:"清理当前分支解释",branchAuditClearFailed:({message:e})=>`清理分支解释失败:${e}`,branchAuditCommitCount:({count:e})=>`${e} 个提交`,branchAuditFileCount:({count:e})=>`${e} 个文件`,branchAuditTruncated:"diff 已截断",branchAuditCurrent:"已保存解释",branchAuditStale:"解释已失效",branchAuditEmpty:"暂无分支解释。生成后会持久化保存,可随时回来查看。",branchAuditView:"查看解释",branchAuditSaved:({count:e})=>`已保存 ${e} 条 hunk 解释`,branchAuditGeneratedAt:({time:e})=>`生成于 ${e}`,insertPreset:({label:e})=>`插入:${e}`,tabChanges:"改动",tabGit:"Git",tabFiles:"文件",inserted:"已插入",copied:"已复制",toggleContextDraft:"切换上下文草稿",contextDraftTitle:"上下文草稿",contextDraftHint:"启用后,引用会追加到这里;可以继续浏览、补写描述,最后一次插入。",contextDraftPlaceholder:"在这里组织长提示词,继续点击侧栏中的引用来追加上下文…",contextDraftCollapse:"收起上下文草稿",contextDraftExpand:"展开上下文草稿",contextDraftDisable:"停用上下文草稿",contextDraftClear:"清空草稿",contextDraftInsert:"插入",contextDraftInsertAndSend:"插入并发送",contextDraftInserted:"已插入",contextDraftSent:"已发送",contextDraftSend:"发送草稿",contextDraftAppended:"已追加引用",contextDraftResize:"拖动调整高度,双击恢复默认",contextDraftAutoCollapseAfterSend:"插入/发送后收起",contextDraftInsertFailed:"终端未连接,草稿已保留",contextDraftCharacterCount:({count:e})=>`${e} 字`,selectFilePrompt:"选择文件以预览内容",backToFileList:"返回文件列表",backToPreviousPreview:"返回来源文档",insertLineRef:({lineLabel:e})=>`引用${e}`,insertFileRef:"引用",copyFileRef:"复制文件引用",findInFile:"在文件内查找",findInFilePlaceholder:"在当前文件中查找…",previousSearchMatch:"上一个匹配项",nextSearchMatch:"下一个匹配项",closeFileSearch:"关闭文件搜索",downloadFile:"下载文件",downloadFailed:"下载失败",uploadFile:"上传文件",uploadFiles:"上传文件",insertLocalFile:"插入本地文件",insertLocalImage:"插入本地图片",layoutMode:"显示模式",layoutModeAuto:"自动",layoutModeNarrow:"窄版",layoutModeWide:"宽版",dropToUpload:"拖放文件以上传",uploading:"上传中…",uploadSuccess:({count:e})=>`已上传 ${e} 个文件`,uploadFailed:"上传失败",binaryPreviewHint:"二进制文件无法预览,请使用上方下载按钮保存到本地",selectedLineHint:({lineLabel:e})=>`已选 ${e} · 点下方「引用」按钮插入`,multiLineHint:"多行引用:先点起始行,再点结束行",loadingImage:"正在加载图片…",imagePreviewHint:"双指捏合或 ⌘/Ctrl + 滚动缩放 · 双击还原",imageLoadFailed:"图片预览加载失败",loadingVideo:"正在加载视频…",videoPreviewHint:"点击播放 · 长按 2× · 可拖动进度条",videoLoadFailed:"视频预览加载失败",videoUnsupported:"当前浏览器不支持该视频格式",videoPlay:"播放",videoPause:"暂停",videoLongPressSpeed:"长按 2× 播放",videoRotate:"顺时针旋转 90°",videoFullscreenEnter:"全屏播放",videoFullscreenExit:"退出全屏",model3dLoading:"正在加载 3D 模型…",model3dExplode:"爆炸展开",model3dExplodeAxis:"展开方向(查看器坐标)",model3dExplodeAmount:"展开程度",model3dHome:"回正并看全",model3dFit:"看全可见零件",model3dFront:"正视图",model3dTop:"俯视图",model3dRight:"右视图",model3dAssemble:"恢复装配",model3dExplodedNotice:"爆炸展示 · 尺寸与引用仍为原始装配坐标",model3dLoadFailed:"3D 模型预览加载失败",model3dTimeout:"3D 模型传输超时,请检查连接后重试。",model3dDimensions:({dims:e})=>`尺寸: ${e}`,model3dHintMouse:"拖拽旋转 / 双指平移 / 捏合或滚轮缩放",model3dHintTouch:"单指旋转 / 双指缩放平移",model3dFullscreenEnter:"全屏查看",model3dFullscreenExit:"退出全屏",model3dBgToLight:"切换为白底",model3dBgToDark:"切换为黑底",model3dRefresh:"重新加载模型",model3dClipToggle:"切面查看",model3dClipPosition:"切面位置",model3dClipFlip:"反转切面方向",model3dFeatureToggle:"特征标注",model3dFeatureStatus:({total:e,positioned:t})=>`特征: ${e} 个 · 已定位 ${t}`,model3dFeatureInsert:"引用",model3dGlossaryToggle:"建模名词说明",model3dPickToggle:"选择零件 / 引用",model3dPickHint:"点选零件后可临时隐藏,或引用所选位置",model3dHidePart:"隐藏零件",model3dShowAllParts:({count:e})=>`显示全部(${e})`,model3dParts:"零件",model3dCloseParts:"关闭零件列表",model3dSearchParts:"查找零件",model3dClearPartSearch:"清空零件搜索",model3dHiddenParts:({count:e})=>`已隐藏 ${e}`,model3dShowNamedPart:({name:e})=>`显示 ${e}`,model3dHideNamedPart:({name:e})=>`隐藏 ${e}`,model3dIsolateNamedPart:({name:e})=>`只看 ${e}`,model3dIsolatePart:"只看此件",model3dShowPart:"显示零件",model3dNoParts:"没有匹配的零件",model3dUndoVisibility:"撤销",model3dClearSelection:"取消选择",model3dAllPartsVisible:"全部可见",model3dInspectHint:"单指旋转 · 双指缩放平移 · 双击局部放大,双击空白看全",model3dUnnamedPart:({index:e})=>`零件 ${e}`,model3dCanvas:"三维模型",model3dMore:"更多模型选项",edaLoading:"正在渲染 KiCad 文件…",reviewTargetChanged:"当前会话已切换,请回到创建这条引用的会话后再插入。",reviewReference:"审阅引用",reviewReferenceHint:"补充意见后插入,不会自动发送。",reviewSnapshot:"选中位置的视图快照",reviewCapturing:"正在截取当前视图…",reviewIncludeImage:"附带截图(临时保存在当前服务器)",reviewCaptureFailed:"截图未成功,仍可插入定位信息。",reviewNote:"你的意见(可选)",reviewNotePlaceholder:"例如:这里太厚了,能否减薄?",reviewDetails:"查看定位信息和引用原文",reviewUploading:"正在准备引用…",reviewAddToDraft:"加入引用草稿",reviewInsert:"插入引用",reviewUploadFailed:"引用准备失败,意见已保留。请重试,或取消附带截图后只插入文字。",edaLoadFailed:"KiCad 预览渲染失败",edaTimeout:"KiCad 预览生成或传输超时,请重试。",edaRefresh:"重新渲染",edaPickHint:"点击原理图或 PCB 上的问题位置,生成电子标注",edaPickedPosition:({x:e,y:t})=>`已选位置 ${e}%, ${t}%`,edaPickedBoardPosition:({x:e,y:t,object:n})=>`板坐标 ${e}, ${t} mm · ${n}`,edaInspecting:"正在读取板坐标和附近对象…",edaNoNearbyObject:"附近无对象",edaInsertAnnotation:"引用电子标注",csvUnnamedColumn:({index:e})=>`第 ${e} 列`,csvSelectedCell:({row:e,column:t})=>`已选第 ${e} 行 · ${t}`,csvPickHint:({rows:e,columns:t})=>`${e} 条记录 · ${t} 列,点击单元格引用`,csvInsertAnnotation:"引用表格标注",csvTablePreview:"表格预览:点击单元格后可引用完整记录",kicadLocalStateNotice:"这是本机界面状态文件,不参与原理图、PCB 或生产审查。",kicadShowRawJson:"查看原始 JSON",kicadProjectPickHint:"点击一项配置后可插入引用",kicadInsertSetting:"引用配置",markdownPreview:"预览",markdownSource:"源码",markdownPreviewHint:"点按行/段落引用,再点一行扩选;拖左侧竖条可连续框选",htmlPreview:"预览",htmlSource:"源码",htmlPreviewHint:"HTML 沙箱 iframe 预览,脚本受限",htmlFullscreenEnter:"全屏预览",htmlFullscreenExit:"退出全屏预览",markdownOutline:"Markdown 目录",markdownOutlineShort:"目录",closeMarkdownOutline:"关闭目录",changedFromPath:({path:e})=>`来自 ${e}`,selectedLineFooter:({lineLabel:e})=>`已选 ${e}`,clearSelection:"清除",allChanges:"全部改动",backToChangeList:"返回目录",allRepositories:"全部仓库",allRepositoriesShort:"全部",repositories:"仓库",gitRepositorySectionTitle:"操作仓库",gitRepositoryLabel:"仓库",gitRepositoryPlaceholder:"选择仓库",gitRepositorySearchPlaceholder:"搜索仓库",gitRepositoryEmpty:"没有可操作的仓库",selectRepositoryForGitActions:"请选择一个仓库后再执行 Git 操作",selectRepositoryForDiff:"选择一个仓库或文件查看 diff",repoChangedCount:({count:e})=>`${e} 个改动`,repoStagedCount:({count:e})=>`${e} 已暂存`,noChanges:"没有改动",noMatchingChanges:"没有匹配的改动",loadingGitChanges:"正在加载 Git 改动…",loadingGitChangesSlow:"仓库较大时可能需要几秒。",refreshingGitChanges:"正在刷新 Git 改动…",gitChangesLoadFailed:"无法加载 Git 改动",retryGitChanges:"重试",insertThisFile:"把这个文件引用插入 Terminal",viewDiff:"查看 diff",diffViewMode:"改动文件展示方式",diffViewModeList:"平铺列表",diffViewModeTree:"目录结构",diffViewModeAi:"AI 导览",changeWalkthroughEmpty:"暂无 AI 导览。生成解释后会在这里展示总览、链路和验证点。",gitInfo:"Git 信息",wrapLongLines:"长行换行",wrapOn:"已换行",wrapOff:"原始",horizontalScrollHint:"左右滑动查看完整 diff",stageFile:"暂存",stageAll:"全部暂存",unstageFile:"取消暂存",stashFile:"贮藏",stashAll:"全部贮藏",restoreFile:"丢弃",gitQuickActions:"Git 操作",gitUnavailable:"当前目录不是 Git 仓库",branchSectionTitle:"当前分支",currentBranchLabel:"分支",switchBranchPlaceholder:"选择分支",switchBranchSearchPlaceholder:"搜索本地分支",switchNoBranches:"没有本地分支",switchBranch:"切换",noStagedChangesShort:"无暂存",stagedCount:({count:e})=>`已暂存 ${e}`,stagedCountShort:({count:e})=>`已暂存 ${e}`,commitSectionTitle:"提交",commitReadyHint:({count:e})=>`${e} 个文件已准备提交`,commitMessagePlaceholder:"提交信息",commitChanges:"提交",commitNeedsStaged:"请先暂存要提交的改动",recentCommitsTitle:"近期提交",recentCommitsSearchPlaceholder:"搜索提交 hash 或信息",recentCommitsLoadMore:"加载更多提交",recentCommitsEmpty:"暂无提交历史",pushSectionTitle:"同步远端",pushRemoteLabel:"Remote",pushRemotePlaceholder:"origin",pushRemoteSearchPlaceholder:"搜索 Remote",pushNoRemotes:"没有 Remote",pushBranchLabel:"目标分支",pushBranchPlaceholder:({branch:e})=>`${e}`,pushBranchSearchPlaceholder:"搜索分支",pushNoBranches:"没有分支",pushUpstreamBadge:"upstream",pushCurrentBranchBadge:"当前",pushNoUpstream:"当前分支未设置 upstream",pushUpToDate:"与远端同步",pushAheadCount:({count:e})=>`领先远端 ${e} 个提交`,pushBehindCount:({count:e})=>`落后远端 ${e} 个提交`,pushDivergedCount:({ahead:e,behind:t})=>`领先 ${e} / 落后 ${t} 个提交`,pullChanges:"拉取",pushChanges:"推送",gitActionRunning:"执行中…",gitActionFailed:({message:e})=>`Git 操作失败:${e}`,confirmRestoreTitle:"确认丢弃改动",confirmRestoreDescription:({path:e})=>`将丢弃 ${e} 的未暂存改动,此操作不可从 Termdock 恢复。`,confirmRestorePhrase:"丢弃改动",confirmRestorePlaceholder:"输入“丢弃改动”确认",confirmStashAllTitle:"确认贮藏全部改动",confirmStashAllDescription:"会把当前工作区改动(包含未跟踪文件)移入贮藏。",confirmAction:"确认",renderingHtml:"正在渲染 HTML…",footnotes:"脚注",backToFootnote:({index:e})=>`返回脚注 ${e}`,openMermaidDiagram:"打开 Mermaid 图表",mermaidDiagram:"Mermaid 图表",renderingDiagram:"正在渲染图表…",markdownImage:"Markdown 图片",image:"图片",previousImage:"上一张图片",nextImage:"下一张图片",closeImagePreview:"关闭图片预览",emptyFile:"空文件。",insertReference:({reference:e})=>`插入引用:${e}`,copyReference:({reference:e})=>`复制引用:${e}`,byteCount:({count:e})=>`${e} 字节`,previewTruncated:"预览已截断至 1 MB",branchCandidatesLoading:"正在加载分支候选…",includeUncommitted:"包含本地未提交改动",includeUncommittedHint:"查看对比或生成解释时纳入工作区和未跟踪文件的 diff",missingBaseReposSkipped:({repositories:e})=>`未设置基线的仓库会跳过:${e}`,localBranch:"本地",remoteBranch:"远端"},fileTree:{insertRef:"引用",insertRefTitle:"Insert file reference into active terminal",openDirRoot:"进入",openDirRootTitle:"把这个目录作为当前浏览根目录",openInFileBrowser:"在 Finder 中显示",openInFileBrowserTitle:"在系统文件浏览器中打开这个项目",openInFileBrowserFailed:"打开文件浏览器失败",moreDirActions:"更多目录操作",searchFromDir:"从这里搜索",searchFromDirTitle:"只搜索这个目录及其子目录",pinDir:"固定",pinDirTitle:"固定这个目录到当前项目",unpinDir:"已固定",unpinDirTitle:"取消固定这个目录",pinFileTitle:"固定这个文件到当前项目",unpinFileTitle:"取消固定这个文件",pinFile:"固定",unpinFile:"已固定",moreFileActions:"更多文件操作",deleteFile:"删除文件",deleteFileConfirm:({name:e})=>`确认删除“${e}”?此操作无法撤销。`,deleteFileFailed:({message:e})=>`删除文件失败:${e}`,noWorkingDir:"未检测到工作目录。",emptyDir:"空目录。",noMatchingFiles:"没有匹配的文件。",searching:"正在搜索文件…",searchingWithCount:({count:e})=>`搜索中…已找到 ${e} 项`,searchResults:({count:e})=>`${e} 个结果`,searchScope:"搜索范围",searchTruncatedHint:({count:e})=>`降级搜索已扫描大量目录并在找到 ${e} 项后停止。安装 ripgrep 或输入更精确关键词可获得完整结果。`,searchStillRunning:"搜索仍在进行,更多结果会自动出现。",showingSearchResults:({shown:e,total:t})=>`正在展示 ${e}/${t}`,loadMoreSearchResults:({shown:e,total:t})=>`查看更多(${e}/${t})`,contentMatchesCount:({count:e})=>`${e} 个文件命中`,moreMatches:({count:e})=>`还有 ${e} 处匹配`,noContentMatches:"文件内容中没有匹配。",contentSearchNeedsRipgrep:"内容搜索需要 ripgrep(rg),请在服务端安装后再在文件内搜索。",truncatedHint:"仅展示前 1000 项。使用搜索或打开更小的文件夹以获得更好性能。",dropToUploadHere:"上传到这里",symbolicLink:"符号链接",sortByModified:"按最近修改排序",sortByName:"按名称排序",sortedByModified:"已按最近修改排序"},diffViewer:{noFileChanges:"此文件无改动。",noUnstagedChanges:"没有未暂存的改动。",emptyHint:"做一些改动,或从远程拉取。",loading:"正在加载 diff…",insertAllDiff:"把当前 diff 内容作为上下文插入 Terminal",insertFileDiff:"引用这个文件的 diff",insertHunkDiff:"引用这段 diff hunk",insertHunkShort:"引用",insertFileShort:"引用",insertAllShort:"全部",stageHunk:"暂存",stageHunkTitle:"只把这个 hunk 加入暂存区 (git apply --cached)",revertHunk:"撤销",revertHunkTitle:"撤销这个 hunk 的工作区改动(不可恢复)",revertHunkConfirm:"确认撤销?",hunkActionApplying:"应用中…",hunkActionUnavailable:"无法为这个 hunk 构造补丁",hunkActionFailed:({message:e})=>`操作失败:${e}。如改动已变化,请刷新后重试。`,auditExplanation:"更改意义",auditStale:"解释已失效",auditClear:"清除解释",auditGeneratedAt:({time:e})=>`生成于 ${e}`,allDiffLabel:"全部 diff",allChangesLabel:"全部改动",workingTree:"工作区改动",allUnstaged:"所有未暂存改动",binaryOrEmpty:"没有可显示的文本改动。",noFinalNewline:"文件末尾没有换行符",noHunks:"没有 hunk",hunkOutline:"Hunk 列表",expandHunkRail:"显示 hunk 列表",collapseHunkRail:"隐藏 hunk 列表",prevHunk:"上一个 hunk",nextHunk:"下一个 hunk",prevFile:"上一个",nextFile:"下一个",expandFile:"展开文件",collapseFile:"折叠文件",expandAll:"全部展开",collapseAll:"全部折叠",collapseHunk:"折叠 hunk",useBracketKeysHint:"按 [ / ] 在 hunk 之间跳转",unified:"统一",unifiedMode:"统一视图",split:"分屏",splitMode:"左右分屏视图",moreActions:"更多操作",view:"视图",loadingPreviousFile:"正在加载上一个文件…",loadingNextFile:"正在加载下一个文件…",resizeNavigation:"调整 diff 导航宽度",focusPathHint:"点击标注聚焦路径",whitespace:"空白",whitespaceDefault:"默认",whitespaceTrim:"忽略行尾空白",whitespaceIgnore:"忽略所有空白",whitespaceIgnoreBlankLines:"忽略空行",context:"上下文",contextLines:({count:e})=>`${e} 行`,contextAll:"全部"},settings:{title:"设置",font:"字体",render:"渲染",theme:"主题",darkTheme:"深色",lightTheme:"浅色",newTab:"新标签",debug:"调试",noSleep:"常亮",noSleepUnavailable:"无网络 — 已禁用",updateTitle:"Termdock 更新",updateRuntimeTitle:"CLI 与服务 Runtime",updateHint:"手动检查会立即下载并安装新版本;服务只会在你确认后重启。",updateCheck:"检查更新",updateCheckAgain:"再次检查",updateChecking:"正在检查 npm 上的最新版本…",updateCheckingShort:"检查中…",updateInstallingShort:"安装中…",updateCurrent:"Termdock 已是最新版本。",desktopUpdateTitle:"macOS 桌面版",desktopUpdateHint:"手动检查 GitHub 发布的签名桌面版本。",desktopUpdateUnsupported:"仅签名安装的 macOS 桌面版支持应用内更新。",desktopUpdateChecking:"正在检查桌面版更新…",desktopUpdateCurrent:"桌面版已是最新版本。",desktopUpdateDownloading:"发现新版本,正在后台下载…",desktopUpdateReady:"桌面版更新已下载,可以重启安装。",desktopUpdateInstalling:"正在重启并安装桌面版更新…",desktopUpdateCheck:"检查桌面版",desktopUpdateCheckAgain:"再次检查",desktopUpdateRestart:"重启并安装",desktopUpdateRestartConfirm:"重启 Termdock 并安装已下载的桌面版更新?终端服务和 tmux 会话不会被停止。",notifications:"通知",notificationsTitle:"通知设置",notificationsHint:"Termdock 在后台时,AI 任务结束后发送系统通知。",notificationsPageHint:"选择哪些 Termdock 事件可以发送系统通知。总开关负责浏览器权限和投递,事件开关决定具体哪些内容提醒你。",notificationsMaster:"系统通知",notificationsMasterHint:"允许 Termdock 在隐藏或作为 PWA 安装运行时发送通知。",notificationsIOSInstallHint:"在 iPhone 或 iPad 上,请先将 Termdock 添加到主屏幕,再开启通知。",notificationsPermission:"权限",notificationsPermissionSystem:"由 macOS 管理",notificationsTest:"发送测试",notificationsTestChecking:"正在等待 macOS 确认投递…",notificationsTestDelivered:"已投递到通知中心;若没有横幅,请检查提醒样式和专注模式。",notificationsTestFailed:"macOS 未投递通知,请在系统设置中允许 Termdock 通知。",notificationsOpenSystemSettings:"打开系统通知设置",notificationsAlertStyle:"提醒方式",notificationsAlertStyleHint:"最终是否横幅弹出仍由浏览器和 Android 系统决定。Termdock 只能请求静默、默认或持续显示等通知选项。",notificationsStyleNormal:"默认",notificationsStyleNormalHint:"允许时声音/震动",notificationsStyleQuiet:"静默",notificationsStyleQuietHint:"仅状态栏,无声音",notificationsStylePersistent:"持续",notificationsStylePersistentHint:"保留到手动关闭",notificationsEvents:"事件",notificationsAiFinished:"AI 任务结束",notificationsAiFinishedHint:"当 Termdock 在后台时,AI agent 停止后发送通知。",notificationsSessionExited:"终端退出",notificationsSessionExitedHint:"终端进程自行结束时发送通知(主动关闭不触发,经 Web Push 投递)。",notificationsFutureHint:"后续可以在这里继续增加更多通知类型,不需要改变顶层设置布局。",notificationsOffSummary:"系统通知已关闭",notificationsAiOnSummary:"AI 任务结束通知已开启",notificationsExitOnSummary:"终端退出通知已开启",notificationsBothOnSummary:"AI 任务结束、终端退出通知已开启",notificationsNoEventsSummary:"暂无开启的通知事件",notificationsDenied:"浏览器通知权限已被阻止,请在站点设置中开启。",notificationsUnsupported:"通知需要安全上下文和 Service Worker 支持。",notificationsTestBody:"通知已开启。后台 AI 任务结束后会提醒你。",shell:"Shell",tmux:"Tmux",auto:"自动",webgl:"WebGL",canvas:"内置",tmuxServer:"Tmux 服务",tmuxUnavailable:"不可用",noTmuxSessions:"服务端没有 tmux 会话。",installTmuxHint:"请在服务端安装 tmux 后启用。",refresh:"刷新",attached:"已连接",restorable:"可恢复",attach:"连接",attaching:"连接中…",destroy:"销毁",sessions:({n:e})=>`${e} 个会话`,windows:({n:e})=>`${e} 个窗口`,keyboardToolbar:"键盘工具栏",aiAgentDetection:"AI 代理检测",signOut:"退出登录",language:"语言",programNamePlaceholder:"程序名(如 claude)",patternPlaceholder:"正则表达式(如 Thinking|Generating)",statusPlaceholder:"状态",addProgram:"添加程序",addPattern:"添加规则",resetDefaults:"恢复默认",invalidRegex:"无效的正则",removeProgram:"移除程序",removeRule:"移除规则",keepLabel:"保持",customColor:"自定义颜色",tabIndicator:"标签指示器样式",toolbarPresets:"工具栏预设",detectionRules:"检测规则",agentHooksHint:"安装 hooks 后,agent 会主动上报状态:回合进行中(绿)、等你授权/回答(黄)、回合完成(对勾),并在等待你输入时推送通知。hooks 全局安装但只在 termdock 的终端里生效。",agentHooksInstall:"安装",agentHooksInstalled:"已安装",agentHooksOutdated:"需更新",agentHooksNeedsApproval:"待授权",agentHooksApprovalHint:"在 Codex 中输入 /hooks,批准 Termdock Hook 后生效",agentHooksNotInstalled:"未安装",agentHooksUninstall:"卸载",agentHooksReinstall:"重新安装",agentHooksDevMode:"开发模式:hooks 指向 TS 源码,需要构建后的版本才能生效",agentHooksTarget:"写入",agentAutoRename:"自动更新会话标题",agentAutoRenameHint:"Agent 完成一轮后,根据近期内容更新标题。默认全部关闭,手工命名的会话不会被覆盖;启用外部插件标题后才会执行其 CLI。",agentAutoRenameToggle:"切换此 Agent 的自动标题",agentAutoRenameShort:"自动标题",agentAutoRenameNamer:"起名 Agent",agentAutoRenameFollow:"跟随当前会话",agentAutoRenameModelsFromCli:"模型由本机 CLI 动态提供",agentAutoRenameRefreshModels:"重新查询 CLI 模型",agentAutoRenameCliDefault:"CLI 默认模型",agentAutoRenameAutomatic:"自动选择",agentAutoRenameNoCli:"未检测到可用于起名的 CLI",agentAutoRenameAdvanced:"高级标题偏好",agentAutoRenamePreference:"补充偏好",agentAutoRenamePreferenceHint:"可选。仅补充你对标题风格或重点的偏好;Termdock 的默认起名规则仍会保留。离开输入框时自动保存。",agentAutoRenamePreferencePlaceholder:"例如:突出用户收益;优先使用动宾结构;避免技术术语",agentAutoRenamePayloadLimit:"用户消息上下文上限(字符)",agentAutoRenamePayloadLimitHint:"保留 prompt-submit 原始 payload 的总字符数,默认 12000,可设置 1000–64000。",agentPlugins:"Agent 插件",agentPluginAdd:"添加插件",agentPluginHint:"从 HTTPS Git 仓库或本地目录安装;请先审查来源。Hooks 和可执行的标题 CLI 均需用户分别启用。",agentPluginCreate:"创建插件",agentPluginDelete:"删除插件",agentPluginInvalid:"插件配置无效",agentPluginCopyAiPrompt:"复制 AI 修复提示",agentPluginCopied:"已复制",agentPluginSourcePlaceholder:"https://github.com/user/agent-plugin 或本地目录",agentPluginInstallPackage:"安装插件",agentPluginAdvancedManifest:"高级:直接粘贴 manifest.json",agentPluginUpdateAvailable:"有更新",agentPluginManualSource:"手动 manifest",agentPluginUpdate:"更新",agentPluginCheck:"检查更新",agentPluginDoctor:"诊断",agentPluginDoctorHint:"显式运行插件模型探测,不会调用标题生成",agentPluginDoctorStatusOk:"标题与模型能力正常",agentPluginDoctorStatusMissing:"未声明 titleNamer",agentPluginDoctorStatusCliDefault:"标题可用,使用 CLI 默认模型",agentPluginDoctorStatusNoModels:"没有可用的模型数据",agentPluginDoctorStatusFailed:"模型探测失败",agentPluginDoctorModels:"个可用模型",agentPluginDoctorAutomatic:"自动选择",agentPluginDoctorCliDefault:"未指定模型时使用 Agent CLI 默认模型",agentAutoRenameInterval:"重新判断间隔",agentAutoRenameMinutes:"分钟",mobileKeyboard:"移动键盘",saving:"保存中…",rulesHint:"配置正则表达式来识别 AI 工具在终端标签中的状态。每条规则可独立设置标签、颜色、图标样式以及输出静默后指示器保留的时长。停止后若你未查看该标签,标签会保留一个黄色待查看提示。",programsHelp:"支持在一个配置中匹配多个程序,用英文逗号分隔。",programLabelResolution:"程序名识别",rawCommandMapping:"原始命令映射",rawCommandMappingHint:"以下规则将原始命令行映射为标签显示名。用户规则优先于内置规则。",genericProgramNames:"通用程序名",genericProgramNamesHint:"触发 ps 深度识别(如 node, python)",wrapperScriptNames:"包装脚本名",wrapperScriptNamesHint:"CLI 包装器,启动其他工具(如 aiden, npx)",shellNamesConfig:"Shell 名称",shellNamesHint:"从标签显示中过滤(如 bash, zsh)",addTag:"+ 添加",customRules:"自定义规则",addRule:"添加规则",localAccess:"本地访问",localAccessHint:"手机信任本地 CA 后,可通过这个局域网地址访问。请先在手机上打开「手机引导」地址下载 CA 证书。",resetAutoName:"恢复自动",onboardingUrl:"手机引导",httpsActive:"HTTPS 已启用",httpsInactive:"HTTPS 未启用",caMissing:"未配置 CA 下载",closeSettings:"关闭设置",desktopTitle:"Termdock 桌面端",desktopStatusLoading:"正在读取 macOS 原生状态…",desktopSwitchService:"切换服务",desktopInstallCli:"安装 / 修复 CLI",desktopCliUpdated:"CLI 状态已更新",desktopOpenDataDirectory:"打开数据目录"},toolbarPresets:{preview:"预览",presets:"预设",label:"标签",new:"新建",reset:"重置",presetLabelPlaceholder:"预设名称",deletePreset:({name:e})=>`删除预设 ${e}`,matchPrograms:"匹配程序",typeEnterHint:"输入后回车",programsPlaceholder:"vim, nvim, /^claude(-code)?$/i …",programsHelp:"纯字符串按大小写不敏感子串匹配。用 /…/flags 包裹则为正则(针对小写程序名测试)。",altSlot:"Alt 修饰键槽",altSlotHint:"在预览中保留一个 Alt 键槽位。",desktopVisibility:"桌面端显示",desktopVisibilityHint:"桌面端只显示该预设的自定义按钮,不显示基础快捷键。",rowLayout:"行布局",rowLayoutHint:"每行按钮数。",addRow:"行",rowN:({n:e})=>`第 ${e} 行`,del:"删",buttons:"按钮",buttonsHint:"点击编辑,使用 ↑↓ 排序。",addButton:"添加按钮",noCustomButtons:"暂无自定义按钮。添加一个来覆盖默认工具栏。",moveUp:"上移",moveDown:"下移",removeRow:({n:e})=>`移除第 ${e} 行`,removeAction:({name:e})=>`移除 ${e}`,labelField:"标签",labelPlaceholder:"按钮上显示的文本",sequence:"序列",sequencePlaceholder:"例如 /undo 或 \\t 或 /||undo",sequenceHint:"双击序列",doubleTap:"双击序列",doubleTapAdd:"+ 添加",doubleTapPlaceholder:"例如 /undo\\r 或 /||undo ||\\r",remove:"移除",noSequence:"无序列",preset:"预设",overCapacityHint:"按钮数超过槽位,多余按钮将使用最后一行的尺寸。"},agentRules:{ruleColors:{green:"绿",yellow:"黄",red:"红",blue:"蓝",purple:"紫",orange:"橙",gray:"灰"}},tab:{session:"会话",new:"新建会话",rename:"重命名",renameHint:"修改标签的显示名称",renamePlaceholder:"留空则恢复默认名称",copyCwd:"复制当前目录",copyCwdHint:"复制当前工作目录",resumeAgent:"恢复 Agent 会话",resumeAgentHint:"用原生 session id 恢复上次对话",resumeAgentAvailable:"有可恢复的 Agent 对话",resumeAgentRecoveredTitle:({agent:e})=>`可继续上次的 ${e} 对话`,resumeAgentRecoveredHint:"Terminal 曾异常中断,已重新创建;可以从上次对话继续。",resumeAgentNow:"恢复",resumeAgentLater:"暂不恢复",resumeAgentSubmitting:"正在提交原生恢复命令…",resumeAgentWaiting:"正在等待 Agent 确认已载入原会话…",resumeAgentSuccess:({agent:e})=>`${e} 会话已恢复`,resumeAgentFailed:"Agent 会话恢复失败,可以重试。",resumeAgentConflict:"该 Agent 会话已在另一个 Terminal 中打开。",resumeAgentBusy:"当前 Agent 回合尚未结束,暂时不能恢复。",resumeAgentTimeout:"Agent 未确认已载入原会话,请查看 Terminal 输出或重试。",tmuxRecoveryTitle:({count:e})=>`检测到 tmux 异常退出,${e} 个 Agent 可恢复`,tmuxRecoveryHint:"Termdock 保留了原生会话 ID。恢复操作会在原标签页中继续之前的对话。",tmuxRecoveryRestoreAll:"恢复全部",tmuxRecoveryRestoring:"正在恢复…",tmuxRecoveryDismiss:"暂不处理",tmuxRecoveryPartial:({restored:e,failed:t})=>`已恢复 ${e} 个,${t} 个需要重试。`,tmuxRecoveryFailed:"恢复失败,请检查终端状态后重试。",tmuxRecoveryDismissFailed:"暂时无法关闭该恢复提示。",copied:"已复制",close:"关闭会话",closeHint:"从列表移除该标签",longPressTip:"提示:按住标签不动约半秒打开操作菜单,按住并拖动可排序。",sessionsTitle:"会话",explorerTitle:"资源管理器",split:"分屏",splitTitle:"添加到分屏工作区",splitNew:"新建会话并加入",splitNewHint:"沿用当前目录和默认会话类型;可连续加入多个会话",splitExisting:"选择已有会话或工作区",splitExistingHint:"会话可组成多个独立工作区;选择另一工作区会将两组合并",splitCurrent:"当前",splitClose:"退出分屏",splitLayout:"分屏布局",splitHorizontal:"左右",splitVertical:"上下",splitGrid:"网格",splitWorkspace:"分屏组",splitWorkspaces:"分屏工作区",splitRename:"重命名分屏组",splitRemovePane:"移出分屏",splitExistingGroups:"已有分屏组",splitAvailableSessions:"可加入的会话",splitOccupied:"已成组",splitUnavailableGrouped:"分组模式下只能分屏同一目录的会话",splitEndedGrouped:"已退出分屏:分组模式不支持跨目录组合",splitNoOtherSessions:"没有可组合的其他会话",sessionCount:({count:e})=>`${e} 个会话`,closeChooserTitle:"销毁 Tmux 会话?",closeChooserDescription:"确认后会终止该会话及其中的所有进程,此操作无法撤销。",destroySession:"销毁会话",confirmDestroySession:"确认销毁",destroySessionHint:"终止 tmux 会话及其中的所有进程。",dragToClose:"拖到此处关闭",releaseToClose:"松手后确认"},agent:{aiRunning:"AI 运行中",needsReview:"需要查看",finishedReview:"AI 已完成 — 需要查看",aiWaiting:"AI 等待中",copyMode:"Copy 模式",jumpToNext:"跳到下一个待处理",jumpToNextRunning:"跳到下一个运行中会话",selectRunningSession:"选择运行中的 Session",runningSessionGestureHint:"轻点循环 · 横向滑动选择 · 长按拖动",currentSession:"当前"},connection:{reconnecting:"正在重连…"},desktopServices:{switchService:"切换 Termdock 服务",openServices:"已打开的服务",idle:"空闲",manageServices:"管理服务与名称"},terminal:{input:"终端输入",error:"错误",dropFilesToPastePaths:"拖放文件以输入路径",loading:"正在加载终端…",initializing:"正在初始化终端引擎…",failedToLoad:"终端加载失败",unknownError:"发生未知错误",componentFailed:"终端组件加载失败",paste:"粘贴",copied:"已复制",copyFailed:"复制失败",longPressSelectsText:"长按选择文本",longPressSendsArrows:"长按发送方向键",switchLongPressToArrows:"将长按切换为方向键",switchLongPressToCopy:"将长按切换为复制所选文本"},quota:{title:"订阅配额",noProviders:"未检测到订阅服务。",noProvidersHint:"使用 AI 编程工具并登录后,自动显示配额信息。",exhausted:"已用完",left:({n:e})=>`剩余 ${e}`,updated:({time:e})=>`${e} 更新`,refresh:"刷新",close:"关闭"},errorBoundary:{title:"出现了一些问题",unexpected:"发生意外错误",retry:"重试",copyDetails:"复制错误信息",copied:"已复制",copyFailed:"复制失败"},error:{type:{network:"网络连接错误",session:"会话错误",terminal:"终端错误",auth:"认证错误",validation:"验证错误",unknown:"未知错误"},severity:{low:"提示:",medium:"警告:",high:"错误:",critical:"严重错误:"},suggestion:{networkCheck:"检查网络连接",networkRetry:"尝试重新连接",networkProxy:"检查代理设置",networkWait:"等待网络恢复",sessionRecreate:"重新创建会话",sessionServer:"检查服务器状态",sessionCache:"清理浏览器缓存",terminalRestart:"重启终端",terminalConfig:"检查终端配置",terminalClear:"清除终端输出",authRelogin:"重新登录",authCredentials:"检查凭证",authAdmin:"联系管理员",validationFormat:"检查输入格式",validationParams:"验证参数",validationDocs:"参考文档",unknownReload:"刷新页面",unknownApp:"重启应用",unknownSupport:"联系技术支持"}}},uC=["en","zh"],du="en",gm="termdock:locale",qd={en:lC,zh:cC};function dC(e){return typeof e=="string"&&uC.includes(e)}function hC(){if(typeof window>"u")return du;try{const t=window.localStorage.getItem(gm);if(dC(t))return t}catch{}return(window.navigator?.language?.toLowerCase()??"").startsWith("zh")?"zh":du}const u3=S.createContext(null);function xm(e,t){const n=t.split(".");let r=e;for(const s of n)if(r&&typeof r=="object"&&s in r)r=r[s];else return;return r}function ym(e,t){return typeof e=="function"?e(t??{}):typeof e!="string"?String(e):t?e.replace(/\{(\w+)\}/g,(n,r)=>Object.prototype.hasOwnProperty.call(t,r)?String(t[r]):n):e}function fC({children:e}){const[t,n]=S.useState(()=>hC()),r=_.useRef(!1);S.useEffect(()=>{typeof window>"u"||uu().then(h=>{if(h?.locale==="zh"||h?.locale==="en"){if(h.locale===t||h.locale==="en"&&t!=="en")return;n(h.locale);try{window.localStorage.setItem(gm,h.locale)}catch{}}}).catch(()=>{})},[]),S.useEffect(()=>{if(!(typeof window>"u")){try{window.localStorage.setItem(gm,t)}catch{}r.current&&(r.current=!1,gi({locale:t}).catch(()=>{})),document.documentElement.lang=t==="zh"?"zh-CN":"en"}},[t]);const s=S.useCallback(h=>{r.current=!0,n(h)},[]),o=qd[t]??qd[du],a=S.useCallback((h,p)=>{const g=xm(o,h);if(g===void 0){const y=xm(qd[du],h);return y===void 0?h:ym(y,p)}return ym(g,p)},[o]),d=S.useMemo(()=>({locale:t,setLocale:s,t:a}),[t,s,a]);return u.jsx(u3.Provider,{value:d,children:e})}function qn(){const e=S.useContext(u3);return e||{locale:du,setLocale:()=>{},t:(t,n)=>{const r=xm(qd[du],t);return r===void 0?t:ym(r,n)}}}const d3=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const pC=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const mC=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const I2=e=>{const t=mC(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Wf={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const gC=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},xC=S.createContext({}),yC=()=>S.useContext(xC),bC=S.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:s="",children:o,iconNode:a,...d},h)=>{const{size:p=24,strokeWidth:g=2,absoluteStrokeWidth:y=!1,color:b="currentColor",className:v=""}=yC()??{},T=r??y?Number(n??g)*24/Number(t??p):n??g;return S.createElement("svg",{ref:h,...Wf,width:t??p??Wf.width,height:t??p??Wf.height,stroke:e??b,strokeWidth:T,className:d3("lucide",v,s),...!o&&!gC(d)&&{"aria-hidden":"true"},...d},[...a.map(([A,L])=>S.createElement(A,L)),...Array.isArray(o)?o:[o]])});const Lt=(e,t)=>{const n=S.forwardRef(({className:r,...s},o)=>S.createElement(bC,{ref:o,iconNode:t,className:d3(`lucide-${pC(I2(e))}`,`lucide-${e}`,r),...s}));return n.displayName=I2(e),n};const vC=[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]],wC=Lt("app-window",vC);const AC=[["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"}]],TC=Lt("arrow-down-a-z",AC);const SC=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],CC=Lt("arrow-down",SC);const _C=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],LC=Lt("arrow-right",_C);const kC=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],h3=Lt("arrow-up",kC);const EC=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M11.68 2.009A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673c-.824-.85-1.678-1.731-2.21-3.348",key:"xaq59h"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],Fl=Lt("bell-dot",EC);const IC=[["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"}]],RC=Lt("bell",IC);const MC=[["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"}]],Wh=Lt("bot",MC);const NC=[["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"}]],DC=Lt("box",NC);const BC=[["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"}]],PC=Lt("cable",BC);const QC=[["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"}]],OC=Lt("calendar-clock",QC);const FC=[["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"}]],jC=Lt("chart-bar",FC);const $C=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ma=Lt("check",$C);const UC=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],fc=Lt("chevron-down",UC);const HC=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Vh=Lt("chevron-right",HC);const zC=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],GC=Lt("chevron-up",zC);const WC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],R2=Lt("circle-check",WC);const VC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],qC=Lt("circle-dot",VC);const YC=[["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"}]],dh=Lt("circle-question-mark",YC);const ZC=[["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"}]],KC=Lt("clipboard-paste",ZC);const XC=[["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"}]],f3=Lt("clipboard",XC);const JC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],R0=Lt("clock-3",JC);const e_=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],t_=Lt("clock",e_);const n_=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],r_=Lt("code",n_);const s_=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ic=Lt("columns-2",s_);const i_=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],p3=Lt("copy",i_);const o_=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],a_=Lt("corner-down-left",o_);const l_=[["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"}]],M0=Lt("download",l_);const c_=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],N0=Lt("ellipsis",c_);const u_=[["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"}]],m3=Lt("external-link",u_);const d_=[["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"}]],h_=Lt("file-code",d_);const f_=[["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"}]],p_=Lt("file-up",f_);const m_=[["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"}]],g3=Lt("file",m_);const g_=[["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"}]],su=Lt("folder-open",g_);const x_=[["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"}]],Sg=Lt("folder-search",x_);const y_=[["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"}]],b_=Lt("folder-tree",y_);const v_=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],hu=Lt("folder",v_);const w_=[["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"}]],M2=Lt("grid-2x2",w_);const A_=[["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"}]],T_=Lt("grip-vertical",A_);const S_=[["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"}]],C_=Lt("hash",S_);const __=[["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"}]],Kc=Lt("history",__);const L_=[["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"}]],k_=Lt("keyboard",L_);const E_=[["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"}]],I_=Lt("layers",E_);const R_=[["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"}]],fu=Lt("layout-grid",R_);const M_=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],pu=Lt("link-2",M_);const N_=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Xn=Lt("loader-circle",N_);const D_=[["path",{d:"M5 12h14",key:"1ays0h"}]],B_=Lt("minus",D_);const P_=[["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"}]],Q_=Lt("moon",P_);const O_=[["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"}]],F_=Lt("move",O_);const j_=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],$_=Lt("panel-left",j_);const U_=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],H_=Lt("panel-right",U_);const z_=[["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"}]],G_=Lt("pause",z_);const W_=[["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"}]],V_=Lt("pen-line",W_);const q_=[["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"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],x3=Lt("pencil",q_);const Y_=[["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"}]],D0=Lt("pin",Y_);const Z_=[["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"}]],B0=Lt("pin-off",Z_);const K_=[["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"}]],N2=Lt("play",K_);const X_=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Yi=Lt("plus",X_);const J_=[["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"}]],ys=Lt("refresh-cw",J_);const eL=[["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"}]],y3=Lt("rotate-ccw",eL);const tL=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],D2=Lt("rows-2",tL);const nL=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],hh=Lt("search",nL);const rL=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],B2=Lt("server",rL);const sL=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],iL=Lt("settings-2",sL);const oL=[["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"}]],aL=Lt("settings",oL);const lL=[["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"}]],cL=Lt("sliders-horizontal",lL);const uL=[["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"}]],dL=Lt("stethoscope",uL);const hL=[["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"}]],fL=Lt("sun",hL);const pL=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],pa=Lt("terminal",pL);const mL=[["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"}]],co=Lt("trash-2",mL);const gL=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],b3=Lt("triangle-alert",gL);const xL=[["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"}]],yL=Lt("unlink",xL);const bL=[["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"}]],vL=Lt("unplug",bL);const wL=[["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"}]],AL=Lt("video",wL);const TL=[["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"}]],SL=Lt("wand-sparkles",TL);const CL=[["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"}]],P2=Lt("workflow",CL);const _L=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Bs=Lt("x",_L);function Ps(e){return{dispose:e}}function LL(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function kL(...e){return Ps(()=>LL(e))}var v3=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()}},bc=class{constructor(){this._store=new v3}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};bc.None=Object.freeze({dispose(){}});var Fu=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}},w3=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),V0=w3?"node":navigator.userAgent,EL=w3?"node":navigator.platform,IL=V0.includes("Firefox");V0.includes("Chrome");var RL=V0.includes("Edge"),A3=/^((?!chrome|android).)*safari/i.test(V0);function ML(){if(!A3)return 0;let e=V0.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1],10)}EL.indexOf("Linux")>=0;var Ys=0,Zs=0,Ks=0,ss=0,Wo={css:"#00000000",rgba:0},qi;(e=>{function t(s,o,a,d){return d!==void 0?`#${Vl(s)}${Vl(o)}${Vl(a)}${Vl(d)}`:`#${Vl(s)}${Vl(o)}${Vl(a)}`}e.toCss=t;function n(s,o,a,d=255){return(s<<24|o<<16|a<<8|d)>>>0}e.toRgba=n;function r(s,o,a,d){return{css:e.toCss(s,o,a,d),rgba:e.toRgba(s,o,a,d)}}e.toColor=r})(qi||={});var x0;(e=>{function t(h,p){if(ss=(p.rgba&255)/255,ss===1)return{css:p.css,rgba:p.rgba};let g=p.rgba>>24&255,y=p.rgba>>16&255,b=p.rgba>>8&255,v=h.rgba>>24&255,T=h.rgba>>16&255,A=h.rgba>>8&255;Ys=v+Math.round((g-v)*ss),Zs=T+Math.round((y-T)*ss),Ks=A+Math.round((b-A)*ss);let L=qi.toCss(Ys,Zs,Ks),R=qi.toRgba(Ys,Zs,Ks);return{css:L,rgba:R}}e.blend=t;function n(h){return(h.rgba&255)===255}e.isOpaque=n;function r(h,p,g){let y=ac.ensureContrastRatio(h.rgba,p.rgba,g);if(y)return qi.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=r;function s(h){let p=(h.rgba|255)>>>0;return[Ys,Zs,Ks]=ac.toChannels(p),{css:qi.toCss(Ys,Zs,Ks),rgba:p}}e.opaque=s;function o(h,p){return ss=Math.round(p*255),[Ys,Zs,Ks]=ac.toChannels(h.rgba),{css:qi.toCss(Ys,Zs,Ks,ss),rgba:qi.toRgba(Ys,Zs,Ks,ss)}}e.opacity=o;function a(h,p){return ss=h.rgba&255,o(h,ss*p/255)}e.multiplyOpacity=a;function d(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=d})(x0||={});var NL;(e=>{let t,n;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Ys=parseInt(s.slice(1,2).repeat(2),16),Zs=parseInt(s.slice(2,3).repeat(2),16),Ks=parseInt(s.slice(3,4).repeat(2),16),qi.toColor(Ys,Zs,Ks);case 5:return Ys=parseInt(s.slice(1,2).repeat(2),16),Zs=parseInt(s.slice(2,3).repeat(2),16),Ks=parseInt(s.slice(3,4).repeat(2),16),ss=parseInt(s.slice(4,5).repeat(2),16),qi.toColor(Ys,Zs,Ks,ss);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let o=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Ys=parseInt(o[1],10),Zs=parseInt(o[2],10),Ks=parseInt(o[3],10),ss=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),qi.toColor(Ys,Zs,Ks,ss);if(s==="transparent")return{css:"transparent",rgba:0};if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Ys,Zs,Ks,ss]=t.getImageData(0,0,1,1).data,ss!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:qi.toRgba(Ys,Zs,Ks,ss),css:s}}e.toColor=r})(NL||={});var Gi;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,s,o){let a=r/255,d=s/255,h=o/255,p=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),g=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),y=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return p*.2126+g*.7152+y*.0722}e.relativeLuminance2=n})(Gi||={});var ac;(e=>{function t(a,d){if(ss=(d&255)/255,ss===1)return d;let h=d>>24&255,p=d>>16&255,g=d>>8&255,y=a>>24&255,b=a>>16&255,v=a>>8&255;return Ys=y+Math.round((h-y)*ss),Zs=b+Math.round((p-b)*ss),Ks=v+Math.round((g-v)*ss),qi.toRgba(Ys,Zs,Ks)}e.blend=t;function n(a,d,h){let p=Gi.relativeLuminance(a>>8),g=Gi.relativeLuminance(d>>8);if(qa(p,g)<h){if(g<p){let v=r(a,d,h),T=qa(p,Gi.relativeLuminance(v>>8));if(T<h){let A=s(a,d,h),L=qa(p,Gi.relativeLuminance(A>>8));return T>L?v:A}return v}let y=s(a,d,h),b=qa(p,Gi.relativeLuminance(y>>8));if(b<h){let v=r(a,d,h),T=qa(p,Gi.relativeLuminance(v>>8));return b>T?y:v}return y}}e.ensureContrastRatio=n;function r(a,d,h){let p=a>>24&255,g=a>>16&255,y=a>>8&255,b=d>>24&255,v=d>>16&255,T=d>>8&255,A=qa(Gi.relativeLuminance2(b,v,T),Gi.relativeLuminance2(p,g,y));for(;A<h&&(b>0||v>0||T>0);)b-=Math.max(0,Math.ceil(b*.1)),v-=Math.max(0,Math.ceil(v*.1)),T-=Math.max(0,Math.ceil(T*.1)),A=qa(Gi.relativeLuminance2(b,v,T),Gi.relativeLuminance2(p,g,y));return(b<<24|v<<16|T<<8|255)>>>0}e.reduceLuminance=r;function s(a,d,h){let p=a>>24&255,g=a>>16&255,y=a>>8&255,b=d>>24&255,v=d>>16&255,T=d>>8&255,A=qa(Gi.relativeLuminance2(b,v,T),Gi.relativeLuminance2(p,g,y));for(;A<h&&(b<255||v<255||T<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),T=Math.min(255,T+Math.ceil((255-T)*.1)),A=qa(Gi.relativeLuminance2(b,v,T),Gi.relativeLuminance2(p,g,y));return(b<<24|v<<16|T<<8|255)>>>0}e.increaseLuminance=s;function o(a){return[a>>24&255,a>>16&255,a>>8&255,a&255]}e.toChannels=o})(ac||={});function Vl(e){let t=e.toString(16);return t.length<2?"0"+t:t}function qa(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Ss(e){if(!e)throw new Error("value must not be falsy");return e}function Cg(e){return 57508<=e&&e<=57558}function DL(e){return 57520<=e&&e<=57527}function BL(e){return 57344<=e&&e<=63743}function PL(e){return 9472<=e&&e<=9631}function QL(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 OL(e,t,n,r){return t===1&&n>Math.ceil(r*1.5)&&e!==void 0&&e>255&&!QL(e)&&!Cg(e)&&!BL(e)}function T3(e){return Cg(e)||PL(e)}function FL(){return{css:{canvas:xd(),cell:xd()},device:{canvas:xd(),cell:xd(),char:{width:0,height:0,left:0,top:0}}}}function xd(){return{width:0,height:0}}function jL(e,t,n=0){return(e-(Math.round(t)*2-n))%(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,n)=>`M.5,1 L.5,${.5+n/.15*.5} C.5,${.5+n/.15*.5},.5,.5,1,.5`,strokeWidth:1}),e.CURVE_DOWN_LEFT=Object.freeze({type:2,data:(t,n)=>`M.5,1 L.5,${.5+n/.15*.5} C.5,${.5+n/.15*.5},.5,.5,0,.5`,strokeWidth:1}),e.CURVE_UP_RIGHT=Object.freeze({type:2,data:(t,n)=>`M.5,0 L.5,${.5-n/.15*.5} C.5,${.5-n/.15*.5},.5,.5,1,.5`,strokeWidth:1}),e.CURVE_UP_LEFT=Object.freeze({type:2,data:(t,n)=>`M.5,0 L.5,${.5-n/.15*.5} C.5,${.5-n/.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 $L={"─":{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],"🬀":Vt(1),"🬁":Vt(2),"🬂":Vt(3),"🬃":Vt(4),"🬄":Vt(5),"🬅":Vt(6),"🬆":Vt(7),"🬇":Vt(8),"🬈":Vt(9),"🬉":Vt(10),"🬊":Vt(11),"🬋":Vt(12),"🬌":Vt(13),"🬍":Vt(14),"🬎":Vt(15),"🬏":Vt(16),"🬐":Vt(17),"🬑":Vt(18),"🬒":Vt(19),"🬓":Vt(20),"🬔":Vt(22),"🬕":Vt(23),"🬖":Vt(24),"🬗":Vt(25),"🬘":Vt(26),"🬙":Vt(27),"🬚":Vt(28),"🬛":Vt(29),"🬜":Vt(30),"🬝":Vt(31),"🬞":Vt(32),"🬟":Vt(33),"🬠":Vt(34),"🬡":Vt(35),"🬢":Vt(36),"🬣":Vt(37),"🬤":Vt(38),"🬥":Vt(39),"🬦":Vt(40),"🬧":Vt(41),"🬨":Vt(43),"🬩":Vt(44),"🬪":Vt(45),"🬫":Vt(46),"🬬":Vt(47),"🬭":Vt(48),"🬮":Vt(49),"🬯":Vt(50),"🬰":Vt(51),"🬱":Vt(52),"🬲":Vt(53),"🬳":Vt(54),"🬴":Vt(55),"🬵":Vt(56),"🬶":Vt(57),"🬷":Vt(58),"🬸":Vt(59),"🬹":Vt(60),"🬺":Vt(61),"🬻":Vt(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:La(126),type:0},scaleType:1},"🯱":{type:5,data:{d:La(48),type:0},scaleType:1},"🯲":{type:5,data:{d:La(109),type:0},scaleType:1},"🯳":{type:5,data:{d:La(121),type:0},scaleType:1},"🯴":{type:5,data:{d:La(51),type:0},scaleType:1},"🯵":{type:5,data:{d:La(91),type:0},scaleType:1},"🯶":{type:5,data:{d:La(95),type:0},scaleType:1},"🯷":{type:5,data:{d:La(114),type:0},scaleType:1},"🯸":{type:5,data:{d:La(127),type:0},scaleType:1},"🯹":{type:5,data:{d:La(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}]))},UL=new Set([9617,9618,9619,129932,129933,129934,129935,129936,129937,129938,129940,129948,129949,129950,129951]);function Vt(e){return{type:2,data:()=>{let t=[],n=[.375,.25,.375],r=[0,3/8,5/8];for(let s=0;s<3;s++){let o=e>>s*2&1,a=e>>s*2+1&1;o&&a?t.push(`M0,${r[s]} L1,${r[s]} L1,${r[s]+n[s]} L0,${r[s]+n[s]} Z`):o?t.push(`M0,${r[s]} L${.5},${r[s]} L${.5},${r[s]+n[s]} L0,${r[s]+n[s]} Z`):a&&t.push(`M${.5},${r[s]} L1,${r[s]} L1,${r[s]+n[s]} L${.5},${r[s]+n[s]} Z`)}return t.join(" ")}}}function La(e){let t=[];if(e&64){let n=.21500000000000002,r=.95-.15-.015;t.push(`M${n},${.2125} L${n+.075},${.175} L${r-.075},${.175} L${r},${.2125} L${r-.075},${.25} L${n+.075},${.25} Z`)}if(e&32){let n=.7999999999999999,r=.95-.15/2,s=.95,o=.175+.075+.015,a=.5-.015;t.push(`M${r},${o} L${s},${o+.0375} L${s},${a-.0375} L${r},${a} L${n},${a-.0375} L${n},${o+.0375} Z`)}if(e&16){let n=.7999999999999999,r=.95-.15/2,s=.95,o=.5+.015,a=.825-.075-.015;t.push(`M${r},${o} L${s},${o+.0375} L${s},${a-.0375} L${r},${a} L${n},${a-.0375} L${n},${o+.0375} Z`)}if(e&8){let n=.21500000000000002,r=.95-.15-.015;t.push(`M${n},${.7875} L${n+.075},${.75} L${r-.075},${.75} L${r},${.7875} L${r-.075},${.825} L${n+.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 n=.21500000000000002,r=.95-.15-.015;t.push(`M${n},${.5} L${n+.075},${.4625} L${r-.075},${.4625} L${r},${.5} L${r-.075},${.5375} L${n+.075},${.5375} Z`)}return t.join(" ")}var ci=0,Vs=0,ka=!1,Ya=!1,yd=!1,so,ju=0,HL=class{constructor(e,t,n,r,s,o){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=r,this._coreBrowserService=s,this._themeService=o,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,r,s){this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Vs=0,ci=0,Ya=!1,ka=!1,yd=!1,so=this._themeService.colors,ju=0;let o=e.getCode();if(o!==0&&e.extended.underlineStyle===4){let a=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));ju=t*r%(Math.round(a)*2)}if(ju===0&&UL.has(o)&&(ju=t*r%2*2+n*s%2),this._decorationService.forEachDecorationAtCell(t,n,"bottom",a=>{a.backgroundColorRGB&&(Vs=a.backgroundColorRGB.rgba>>8&16777215,Ya=!0),a.foregroundColorRGB&&(ci=a.foregroundColorRGB.rgba>>8&16777215,ka=!0)}),yd=this._selectionRenderModel.isCellSelected(this._terminal,t,n),yd){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Vs=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Vs=(this.result.fg&16777215)<<8|255;break;default:Vs=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Vs=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Vs=(this.result.bg&16777215)<<8|255;break}Vs=ac.blend(Vs,(this._coreBrowserService.isFocused?so.selectionBackgroundOpaque:so.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Vs=(this._coreBrowserService.isFocused?so.selectionBackgroundOpaque:so.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Ya=!0,so.selectionForeground&&(ci=so.selectionForeground.rgba>>8&16777215,ka=!0),T3(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)ci=(this._coreBrowserService.isFocused?so.selectionBackgroundOpaque:so.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:ci=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:ci=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:ci=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:ci=(this.result.fg&16777215)<<8|255;break;default:ci=this._themeService.colors.foreground.rgba}ci=ac.blend(ci,(this._coreBrowserService.isFocused?so.selectionBackgroundOpaque:so.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}ka=!0}}this._decorationService.forEachDecorationAtCell(t,n,"top",a=>{a.backgroundColorRGB&&(Vs=a.backgroundColorRGB.rgba>>8&16777215,Ya=!0),a.foregroundColorRGB&&(ci=a.foregroundColorRGB.rgba>>8&16777215,ka=!0)}),Ya&&(yd?Vs=e.bg&-16777216&-134217729|Vs|50331648:Vs=e.bg&-16777216|Vs|50331648),ka&&(ci=e.fg&-16777216&-67108865|ci|50331648),this.result.fg&67108864&&(Ya&&!ka&&((this.result.bg&50331648)===0?ci=this.result.fg&-134217728|so.background.rgba>>8&16777215&16777215|50331648:ci=this.result.fg&-134217728|this.result.bg&67108863,ka=!0),!Ya&&ka&&((this.result.fg&50331648)===0?Vs=this.result.bg&-67108864|so.foreground.rgba>>8&16777215&16777215|50331648:Vs=this.result.bg&-67108864|this.result.fg&67108863,Ya=!0)),so=void 0,this.result.bg=Ya?Vs:this.result.bg,this.result.fg=ka?ci:this.result.fg,this.result.ext&=536870911,this.result.ext|=ju<<29&3758096384}},zL=.5,S3=IL||RL?"bottom":"ideographic";function GL(e,t,n,r,s,o,a,d,h,p,g,y,b=0){let v=$L[t];if(v){let T=Array.isArray(v)?v:[v];for(let A of T)WL(e,A,n,r,s,o,a,d,h,p,g,y,b);return!0}return!1}function WL(e,t,n,r,s,o,a,d,h,p,g,y,b=0){let v=s,T=o,A=n,L=r;switch(t.scaleType===1&&(v=a,T=d,A=n+(s-a)/2,L=r+(o-d)/2),t.clipPath&&(e.save(),ek(e,t.clipPath,A,L,v,T)),t.type){case 0:VL(e,t.data,A,L,v,T);break;case 1:XL(e,t.data,A,L,v,T,b);break;case 2:JL(e,t.data,A,L,v,T,p,g,t.strokeWidth);break;case 3:YL(e,t.data,A,L,v,T,p,t.strokeWidth);break;case 4:KL(e,t.data,A,L,v,T,p,y);break;case 5:tk(e,t.data,A,L,v,T,h,p,g);break;case 6:qL(e,t.data,A,L,v,T);break}t.clipPath&&e.restore()}function VL(e,t,n,r,s,o){for(let a=0;a<t.length;a++){let d=t[a],h=s/8,p=o/8;e.fillRect(n+d.x*h,r+d.y*p,d.w*h,d.h*p)}}var Q2=new Uint8Array([1,0,1,2,1,4,5,0,5,2,5,4,1,6,5,6]);function qL(e,t,n,r,s,o){let a=s/8,d=o*.1,h=o*.8/8,p=Math.min(a,h);for(let g=0;g<8;g++)if(t&1<<g){let y=Q2[g*2],b=Q2[g*2+1],v=n+(y+1)*a,T=r+d+(b+1)*h;e.beginPath(),e.arc(v,T,p,0,Math.PI*2),e.fill()}}function YL(e,t,n,r,s,o,a,d){let h=typeof t=="string"?t:t(0,0);e.beginPath();let p=0,g=0,y=0,b=0,v="";for(let T of h.split(" ")){let A=T[0],L=T.substring(1).split(",");if(A==="Z"){e.closePath(),v=A;continue}if(A==="V"){let D=r+parseFloat(L[0])*o;e.lineTo(p,D),g=D,y=p,b=g,v=A;continue}if(A==="H"){let D=n+parseFloat(L[0])*s;e.lineTo(D,g),p=D,y=p,b=g,v=A;continue}if(!L[0]||!L[1])continue;if(A==="A"){let D=parseFloat(L[0])*s,B=parseFloat(L[1])*o,j=parseFloat(L[2])*Math.PI/180,P=parseInt(L[3],10),$=parseInt(L[4],10),z=n+parseFloat(L[5])*s,H=r+parseFloat(L[6])*o;ZL(e,p,g,D,B,j,P,$,z,H),p=z,g=H;continue}let R=L.map((D,B)=>{let j=parseFloat(D);return B%2===0?n+j*s:r+j*o});if(A==="M")e.moveTo(R[0],R[1]),p=R[0],g=R[1],y=p,b=g;else if(A==="L")e.lineTo(R[0],R[1]),p=R[0],g=R[1],y=p,b=g;else if(A==="Q")e.quadraticCurveTo(R[0],R[1],R[2],R[3]),y=R[0],b=R[1],p=R[2],g=R[3];else if(A==="T"){let D,B;v==="Q"||v==="T"?(D=2*p-y,B=2*g-b):(D=p,B=g),e.quadraticCurveTo(D,B,R[0],R[1]),y=D,b=B,p=R[0],g=R[1]}else A==="C"&&(e.bezierCurveTo(R[0],R[1],R[2],R[3],R[4],R[5]),y=R[2],b=R[3],p=R[4],g=R[5]);v=A}d!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=a*d,e.stroke()):e.fill()}function ZL(e,t,n,r,s,o,a,d,h,p){if(r===0||s===0){e.lineTo(h,p);return}r=Math.abs(r),s=Math.abs(s);let g=Math.cos(o),y=Math.sin(o),b=(t-h)/2,v=(n-p)/2,T=g*b+y*v,A=-y*b+g*v,L=r*r,R=s*s,D=T*T,B=A*A,j=D/L+B/R;if(j>1){let K=Math.sqrt(j);r*=K,s*=K,L=r*r,R=s*s}let P=(L*R-L*B-R*D)/(L*B+R*D);P<0&&(P=0);let $=(a===d?-1:1)*Math.sqrt(P),z=$*(r*A/s),H=$*-(s*T/r),ye=g*z-y*H+(t+h)/2,q=y*z+g*H+(n+p)/2,te=(T-z)/r,ve=(A-H)/s,ge=(-T-z)/r,ie=(-A-H)/s,Ae=Math.atan2(ve,te),xe=Math.atan2(ie,ge)-Ae;d===0&&xe>0?xe-=2*Math.PI:d===1&&xe<0&&(xe+=2*Math.PI);let ce=Ae+xe;e.ellipse(ye,q,r,s,o,Ae,ce,d===0)}function KL(e,t,n,r,s,o,a,d){e.save(),e.fillRect(n,r,s,o),d&&(e.fillStyle=d,e.strokeStyle=d),e.lineWidth=a,e.lineCap="square",e.beginPath();for(let h of t.d.split(" ")){let p=h[0],g=h.substring(1).split(",");if(!g[0]||!g[1]){p==="Z"&&e.closePath();continue}let y=g.map((b,v)=>{let T=parseFloat(b);return v%2===0?n+T*s:r+T*o});p==="M"?e.moveTo(y[0],y[1]):p==="L"&&e.lineTo(y[0],y[1])}t.type===1?e.stroke():e.fill(),e.restore()}var O2=new Map;function XL(e,t,n,r,s,o,a=0){let d=O2.get(t);d||(d=new Map,O2.set(t,d));let h=e.fillStyle;if(typeof h!="string")throw new Error(`Unexpected fillStyle type "${h}"`);let p=d.get(h);if(!p){let b=t[0].length,v=t.length,T=e.canvas.ownerDocument.createElement("canvas");T.width=b,T.height=v;let A=Ss(T.getContext("2d")),L=new ImageData(b,v),R,D,B,j;if(h.startsWith("#"))R=parseInt(h.slice(1,3),16),D=parseInt(h.slice(3,5),16),B=parseInt(h.slice(5,7),16),j=h.length>7&&parseInt(h.slice(7,9),16)||1;else if(h.startsWith("rgba"))[R,D,B,j]=h.substring(5,h.length-1).split(",").map(P=>parseFloat(P));else throw new Error(`Unexpected fillStyle color format "${h}" when drawing pattern glyph`);for(let P=0;P<v;P++)for(let $=0;$<b;$++)L.data[(P*b+$)*4]=R,L.data[(P*b+$)*4+1]=D,L.data[(P*b+$)*4+2]=B,L.data[(P*b+$)*4+3]=t[P][$]*(j*255);A.putImageData(L,0,0),p=Ss(e.createPattern(T,null)),d.set(h,p)}let g=a>>1&1,y=a&1;g!==0||y!==0?p.setTransform(new DOMMatrix().translateSelf(-g,-y)):p.setTransform(new DOMMatrix),e.fillStyle=p,e.fillRect(n,r,s,o)}function JL(e,t,n,r,s,o,a,d,h){e.save(),e.beginPath(),e.rect(n,r,s,o),e.clip(),e.beginPath();let p;if(typeof t=="function"){let y=.15/o*s;p=t(.15,y)}else p=t;let g={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let y of p.split(" ")){let b=y[0];if(b==="Z"){e.closePath(),g.lastCommand=b;continue}let v=C3[b];if(!v){d.error(`Could not find drawing instructions for "${b}"`);continue}let T=y.substring(1).split(",");!T[0]||!T[1]||(v(e,_3(T,s,o,n,r,!0,a,0,0,!1),g),g.lastCommand=b)}h!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=a*h,e.stroke()):e.fill(),e.closePath(),e.restore()}function ek(e,t,n,r,s,o){e.beginPath();for(let a of t.split(" ")){let d=a[0];if(d==="Z"){e.closePath();continue}let h=a.substring(1).split(",");if(!h[0]||!h[1])continue;let p=n+parseFloat(h[0])*s,g=r+parseFloat(h[1])*o;d==="M"?e.moveTo(p,g):d==="L"&&e.lineTo(p,g)}e.clip()}function tk(e,t,n,r,s,o,a,d,h){let p=new Path2D;p.rect(n,r,s,o),e.clip(p),e.beginPath();let g=a/12;e.lineWidth=d*g;let y={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let b of t.d.split(" ")){let v=b[0];if(v==="Z"){e.closePath(),y.lastCommand=v;continue}let T=C3[v];if(!T){h.error(`Could not find drawing instructions for "${v}"`);continue}let A=b.substring(1).split(",");!A[0]||!A[1]||(T(e,_3(A,s,o,n,r,!1,d,(t.leftPadding??0)*(g/2),(t.rightPadding??0)*(g/2)),y),y.lastCommand=v)}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function F2(e,t,n=0){return Math.max(Math.min(e,t),n)}var C3={C:(e,t,n)=>{e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),n.lastControlX=t[2],n.lastControlY=t[3],n.currentX=t[4],n.currentY=t[5]},L:(e,t,n)=>{e.lineTo(t[0],t[1]),n.lastControlX=n.currentX=t[0],n.lastControlY=n.currentY=t[1]},M:(e,t,n)=>{e.moveTo(t[0],t[1]),n.lastControlX=n.currentX=t[0],n.lastControlY=n.currentY=t[1]},Q:(e,t,n)=>{e.quadraticCurveTo(t[0],t[1],t[2],t[3]),n.lastControlX=t[0],n.lastControlY=t[1],n.currentX=t[2],n.currentY=t[3]},T:(e,t,n)=>{let r,s;n.lastCommand==="Q"||n.lastCommand==="T"?(r=2*n.currentX-n.lastControlX,s=2*n.currentY-n.lastControlY):(r=n.currentX,s=n.currentY),e.quadraticCurveTo(r,s,t[0],t[1]),n.lastControlX=r,n.lastControlY=s,n.currentX=t[0],n.currentY=t[1]}};function _3(e,t,n,r,s,o,a,d=0,h=0,p=!0){let g=e.map(y=>parseFloat(y)||parseInt(y));if(g.length<2)throw new Error("Too few arguments for instruction");for(let y=0;y<g.length;y+=2){if(g[y]*=t-d*a-h*a,o&&g[y]!==0){let b=Math.round(g[y]+.5)-.5;g[y]=p?F2(b,t,0):b}g[y]+=r+d*a}for(let y=1;y<g.length;y+=2){if(g[y]*=n,o&&g[y]!==0){let b=Math.round(g[y]+.5)-.5;g[y]=p?F2(b,n,0):b}g[y]+=s}return g}var j2=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},$2=class{constructor(){this._data=new j2}set(e,t,n,r,s){this._data.get(e,t)||this._data.set(e,t,new j2),this._data.get(e,t).set(n,r,s)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}},L3=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,n=0,r=e.timeRemaining(),s;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),s=e.timeRemaining(),n*1.5>s){r-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=s}this.clear()}},nk=class extends L3{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let n=performance.now()+t;return{timeRemaining:()=>Math.max(0,n-performance.now())}}},rk=class extends L3{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},sk="requestIdleCallback"in globalThis?rk:nk,Xc=class k3{constructor(){this.fg=0,this.bg=0,this.extended=new E3}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 k3;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}},E3=class I3{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}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 I3(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ha=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,n,r)=>{if(this._disposed)return Ps(()=>{});let s={fn:t,thisArgs:n};this._listeners.push(s);let o=Ps(()=>{let a=this._listeners.indexOf(s);a!==-1&&this._listeners.splice(a,1)});return r&&(Array.isArray(r)?r.push(o):r.add(o)),o},this._event)}fire(t){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:n,thisArgs:r}=this._listeners[0];n.call(r,t);return}default:{let n=this._listeners.slice();for(let{fn:r,thisArgs:s}of n)r.call(s,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},oc;(e=>{function t(o,a){return o(d=>a.fire(d))}e.forward=t;function n(o,a){return(d,h,p)=>o(g=>d.call(h,a(g)),void 0,p)}e.map=n;function r(...o){return(a,d,h)=>{let p=new v3;for(let g of o)p.add(g(y=>a.call(d,y)));return h&&(Array.isArray(h)?h.push(p):h.add(p)),p}}e.any=r;function s(o,a,d){return a(d),o(h=>a(h))}e.runAndSubscribe=s})(oc||={});var U2={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}},$u=2,Uu,Rl=class qc{constructor(t,n,r,s){this._document=t,this._config=n,this._unicodeService=r,this._logService=s,this._didWarmUp=!1,this._cacheMap=new $2,this._cacheMapCombined=new $2,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Xc,this._textureSize=512,this._onAddTextureAtlasCanvas=new ha,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new ha,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=M3(t,this._config.deviceCellWidth*4+$u*2,this._config.deviceCellHeight+$u*2),this._tmpCtx=Ss(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 sk(this._logService);for(let n=33;n<126;n++)t.enqueue(()=>{if(!this._cacheMap.get(n,0,0,0)){let r=this._drawToCache(n,0,0,0,!1,void 0);this._cacheMap.set(n,0,0,0,r)}})}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(qc.maxAtlasPages&&this._pages.length>=Math.max(4,qc.maxAtlasPages)){let n=this._pages.filter(p=>p.canvas.width*2<=(qc.maxTextureSize||4096)).sort((p,g)=>g.canvas.width!==p.canvas.width?g.canvas.width-p.canvas.width:g.percentageUsed-p.percentageUsed),r=-1,s=0;for(let p=0;p<n.length;p++)if(n[p].canvas.width!==s)r=p,s=n[p].canvas.width;else if(p-r===3)break;let o=n.slice(r,r+4);if(o.length<4||o.some(p=>p.canvas.width!==o[0].canvas.width)){let p=new ql(this._document,this._textureSize);return this._pages.push(p),this._activePages.push(p),this._onAddTextureAtlasCanvas.fire(p.canvas),p}let a=o.map(p=>p.glyphs[0].texturePage).sort((p,g)=>p-g),d=this.pages.length-o.length,h=this._mergePages(o,d);h.version=++ql.nextVersion;for(let p=a.length-1;p>=0;p--)this._deletePage(a[p]);this.pages.push(h),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(h.canvas)}let t=new ql(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,n){let r=t[0].canvas.width*2,s=new ql(this._document,r,t);for(let[o,a]of t.entries()){let d=o*a.canvas.width%r,h=Math.floor(o/2)*a.canvas.height;s.ctx.drawImage(a.canvas,d,h);for(let g of a.glyphs)g.texturePage=n,g.sizeClipSpace.x=g.size.x/r,g.sizeClipSpace.y=g.size.y/r,g.texturePosition.x+=d,g.texturePosition.y+=h,g.texturePositionClipSpace.x=g.texturePosition.x/r,g.texturePositionClipSpace.y=g.texturePosition.y/r;this._onRemoveTextureAtlasCanvas.fire(a.canvas);let p=this._activePages.indexOf(a);p!==-1&&this._activePages.splice(p,1)}return s}_deletePage(t){this._pages.splice(t,1);for(let n=t;n<this._pages.length;n++){let r=this._pages[n];for(let s of r.glyphs)s.texturePage--;r.version=++ql.nextVersion}}getRasterizedGlyphCombinedChar(t,n,r,s,o,a){return this._getFromCacheMap(this._cacheMapCombined,t,n,r,s,o,a)}getRasterizedGlyph(t,n,r,s,o,a){return this._getFromCacheMap(this._cacheMap,t,n,r,s,o,a)}_getFromCacheMap(t,n,r,s,o,a,d){return Uu=t.get(n,r,s,o),Uu||(Uu=this._drawToCache(n,r,s,o,a,d),t.set(n,r,s,o,Uu)),Uu}_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,n,r,s){if(this._config.allowTransparency)return Wo;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(n);break;case 50331648:let a=Xc.toColorRGB(n);o=qi.toColor(a[0],a[1],a[2]);break;default:r?o=x0.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=x0.opaque(o)),o}_getForegroundColor(t,n,r,s,o,a,d,h,p,g){let y=this._getMinimumContrastColor(t,n,r,s,o,a,d,p,h,g);if(y)return y;let b;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&p&&a<8&&(a+=8),b=this._getColorFromAnsiIndex(a);break;case 50331648:let v=Xc.toColorRGB(a);b=qi.toColor(v[0],v[1],v[2]);break;default:d?b=this._config.colors.background:b=this._config.colors.foreground}return this._config.allowTransparency&&(b=x0.opaque(b)),h&&(b=x0.multiplyOpacity(b,zL)),b}_resolveBackgroundRgba(t,n,r){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(n).rgba;case 50331648:return n<<8;default:return r?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,n,r,s){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&s&&n<8&&(n+=8),this._getColorFromAnsiIndex(n).rgba;case 50331648:return n<<8;default:return r?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,n,r,s,o,a,d,h,p,g){if(this._config.minimumContrastRatio===1||g)return;let y=this._getContrastCache(p),b=y.getColor(t,s);if(b!==void 0)return b??void 0;let v=this._resolveBackgroundRgba(n,r,d),T=this._resolveForegroundRgba(o,a,d,h),A=ac.ensureContrastRatio(v,T,this._config.minimumContrastRatio/(p?2:1));if(!A){y.setColor(t,s,null);return}let L=qi.toColor(A>>24&255,A>>16&255,A>>8&255);return y.setColor(t,s,L),L}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,n,r,s,o,a){let d=typeof t=="number"?String.fromCharCode(t):t;a&&this._tmpCanvas.parentElement!==a&&(this._tmpCanvas.style.display="none",a.append(this._tmpCanvas));let h=Math.min(this._config.deviceCellWidth*Math.max(d.length,2)+$u*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<h&&(this._tmpCanvas.width=h);let p=Math.min(this._config.deviceCellHeight+$u*4,this._textureSize);if(this._tmpCanvas.height<p&&(this._tmpCanvas.height=p),this._tmpCtx.save(),this._workAttributeData.fg=r,this._workAttributeData.bg=n,this._workAttributeData.extended.ext=s,!!this._workAttributeData.isInvisible())return U2;let g=!!this._workAttributeData.isBold(),y=!!this._workAttributeData.isInverse(),b=!!this._workAttributeData.isDim(),v=!!this._workAttributeData.isItalic(),T=!!this._workAttributeData.isUnderline(),A=!!this._workAttributeData.isStrikethrough(),L=!!this._workAttributeData.isOverline(),R=this._workAttributeData.getFgColor(),D=this._workAttributeData.getFgColorMode(),B=this._workAttributeData.getBgColor(),j=this._workAttributeData.getBgColorMode();if(y){let Se=R;R=B,B=Se;let We=D;D=j,j=We}let P=this._getBackgroundColor(j,B,y,b);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=P.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let $=g?this._config.fontWeightBold:this._config.fontWeight,z=v?"italic":"";this._tmpCtx.font=`${z} ${$} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=S3;let H=d.length===1&&Cg(d.charCodeAt(0)),ye=d.length===1&&DL(d.charCodeAt(0)),q=this._getForegroundColor(n,j,B,r,D,R,y,b,g,T3(d.charCodeAt(0)));this._tmpCtx.fillStyle=q.css;let te=ye?0:$u*2,ve=!1;if(this._config.customGlyphs!==!1){let Se=this._workAttributeData.getUnderlineVariantOffset();ve=GL(this._tmpCtx,d,te,te,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.deviceCharWidth,this._config.deviceCharHeight,this._config.fontSize,this._config.devicePixelRatio,this._logService,P.css,Se)}let ge=!H,ie;if(typeof t=="number"?ie=this._unicodeService.wcwidth(t):ie=this._unicodeService.getStringCellWidth(t),T){this._tmpCtx.save();let Se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),We=Se%2===1?.5:0;if(this._tmpCtx.lineWidth=Se,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())ge=!1,this._tmpCtx.strokeStyle=`rgb(${Xc.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{ge=!1;let rt=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&rt<8&&(rt+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(rt).css}this._tmpCtx.fillStyle=this._tmpCtx.strokeStyle,this._tmpCtx.beginPath();let ue=te,Ee=Math.ceil(te+this._config.deviceCharHeight)-We-(o?Se*2:0),Tt=Ee+Se*2,Rt=this._workAttributeData.getUnderlineVariantOffset(),ze=0,X=0;for(let rt=0;rt<ie;rt++){let qe=!1;this._tmpCtx.save(),ze=Ee,X=Tt;let re=ue+rt*this._config.deviceCellWidth,J=ue+(rt+1)*this._config.deviceCellWidth;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(re,Ee),this._tmpCtx.lineTo(J,Ee),this._tmpCtx.moveTo(re,Tt),this._tmpCtx.lineTo(J,Tt);break;case 3:ze=this._config.deviceCharHeight+1,X=ze+3*this._config.devicePixelRatio;let $e=new Path2D;$e.rect(re,ze,this._config.deviceCellWidth,X-ze),this._tmpCtx.clip($e);let tt=this._config.deviceCellWidth,gt=X-ze,pt=tt/6,Ct=gt/3,Le=[[0,2,1,3,2.4,3,0,.6],[5.5,0,2.5,3,1.1,3,4.1,0],[4,0,6,2,6,.6,5.4,0]];for(let yn of Le){this._tmpCtx.beginPath();for(let at=0;at<yn.length;at+=2){let bt=re+yn[at]*pt,It=X-yn[at+1]*Ct;at===0?this._tmpCtx.moveTo(bt,It):this._tmpCtx.lineTo(bt,It)}this._tmpCtx.closePath(),this._tmpCtx.fill()}qe=!0;break;case 4:let Te=Rt===0?0:Rt>=Se?Se*2-Rt:Se-Rt;Rt>=Se||Te===0?(this._tmpCtx.setLineDash([Math.round(Se),Math.round(Se)]),this._tmpCtx.moveTo(re+Te,Ee),this._tmpCtx.lineTo(J,Ee)):(this._tmpCtx.setLineDash([Math.round(Se),Math.round(Se)]),this._tmpCtx.moveTo(re,Ee),this._tmpCtx.lineTo(re+Te,Ee),this._tmpCtx.moveTo(re+Te+Se,Ee),this._tmpCtx.lineTo(J,Ee)),Rt=jL(J-re,Se,Rt);break;case 5:let Oe=.6,yt=.3,de=J-re,Pe=Math.floor(Oe*de),ot=Math.floor(yt*de),zt=de-Pe-ot;this._tmpCtx.setLineDash([Pe,ot,zt]),this._tmpCtx.moveTo(re,Ee),this._tmpCtx.lineTo(J,Ee);break;default:this._tmpCtx.moveTo(re,Ee),this._tmpCtx.lineTo(J,Ee);break}qe||this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!ve&&this._config.fontSize>=12&&!this._config.allowTransparency&&d!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let rt=this._tmpCtx.measureText(d);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in rt&&rt.actualBoundingBoxDescent>0){this._tmpCtx.save();let qe=new Path2D;qe.rect(ue,ze-Math.ceil(Se/2),this._config.deviceCellWidth*ie,X-ze+Math.ceil(Se/2)),this._tmpCtx.clip(qe),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=P.css,this._tmpCtx.strokeText(d,te,te+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(L){let Se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),We=Se%2===1?.5:0;this._tmpCtx.lineWidth=Se,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(te,te+We),this._tmpCtx.lineTo(te+this._config.deviceCharWidth*ie,te+We),this._tmpCtx.stroke()}if(ve||this._tmpCtx.fillText(d,te,te+this._config.deviceCharHeight),d==="_"&&!this._config.allowTransparency){let Se=Vf(this._tmpCtx.getImageData(te,te,this._config.deviceCellWidth,this._config.deviceCellHeight),P,q,ge);if(Se)for(let We=1;We<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=P.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(d,te,te+this._config.deviceCharHeight-We),Se=Vf(this._tmpCtx.getImageData(te,te,this._config.deviceCellWidth,this._config.deviceCellHeight),P,q,ge),!!Se);We++);}if(A){let Se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),We=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=Se,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(te,te+Math.floor(this._config.deviceCharHeight/2)-We),this._tmpCtx.lineTo(te+this._config.deviceCharWidth*ie,te+Math.floor(this._config.deviceCharHeight/2)-We),this._tmpCtx.stroke()}this._tmpCtx.restore();let Ae=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),xe;if(this._config.allowTransparency?xe=ik(Ae):xe=Vf(Ae,P,q,ge),xe)return U2;let ce=this._findGlyphBoundingBox(Ae,this._workBoundingBox,h,ye,ve,te),K,be;for(;;){if(this._activePages.length===0){let Se=this._createNewPage();K=Se,be=Se.currentRow,be.height=ce.size.y;break}K=this._activePages[this._activePages.length-1],be=K.currentRow;for(let Se of this._activePages)ce.size.y<=Se.currentRow.height&&(K=Se,be=Se.currentRow);for(let Se=this._activePages.length-1;Se>=0;Se--)for(let We of this._activePages[Se].fixedRows)We.height<=be.height&&ce.size.y<=We.height&&(K=this._activePages[Se],be=We);if(ce.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new ql(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),K=this._overflowSizePage,be=this._overflowSizePage.currentRow,be.x+ce.size.x>=K.canvas.width&&(be.x=0,be.y+=be.height,be.height=0);break}if(be.y+ce.size.y>=K.canvas.height||be.height>ce.size.y+2){let Se=!1;if(K.currentRow.y+K.currentRow.height+ce.size.y>=K.canvas.height){let We;for(let ue of this._activePages)if(ue.currentRow.y+ue.currentRow.height+ce.size.y<ue.canvas.height){We=ue;break}if(We)K=We;else if(qc.maxAtlasPages&&this._pages.length>=qc.maxAtlasPages&&be.y+ce.size.y<=K.canvas.height&&be.height>=ce.size.y&&be.x+ce.size.x<=K.canvas.width)Se=!0;else{let ue=this._createNewPage();K=ue,be=ue.currentRow,be.height=ce.size.y,Se=!0}}Se||(K.currentRow.height>0&&K.fixedRows.push(K.currentRow),be={x:0,y:K.currentRow.y+K.currentRow.height,height:ce.size.y},K.fixedRows.push(be),K.currentRow={x:0,y:be.y+be.height,height:0})}if(be.x+ce.size.x<=K.canvas.width)break;be===K.currentRow?(be.x=0,be.y+=be.height,be.height=0):K.fixedRows.splice(K.fixedRows.indexOf(be),1)}return ce.texturePage=this._pages.indexOf(K),ce.texturePosition.x=be.x,ce.texturePosition.y=be.y,ce.texturePositionClipSpace.x=be.x/K.canvas.width,ce.texturePositionClipSpace.y=be.y/K.canvas.height,ce.sizeClipSpace.x/=K.canvas.width,ce.sizeClipSpace.y/=K.canvas.height,be.height=Math.max(be.height,ce.size.y),be.x+=ce.size.x,K.ctx.putImageData(Ae,ce.texturePosition.x-this._workBoundingBox.left,ce.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ce.size.x,ce.size.y),K.addGlyph(ce),K.version=++ql.nextVersion,ce}_findGlyphBoundingBox(t,n,r,s,o,a){n.top=0;let d=s?this._config.deviceCellHeight:this._tmpCanvas.height,h=s?this._config.deviceCellWidth:r,p=!1;for(let g=0;g<d;g++){for(let y=0;y<h;y++){let b=g*this._tmpCanvas.width*4+y*4+3;if(t.data[b]!==0){n.top=g,p=!0;break}}if(p)break}n.left=0,p=!1;for(let g=0;g<a+h;g++){for(let y=0;y<d;y++){let b=y*this._tmpCanvas.width*4+g*4+3;if(t.data[b]!==0){n.left=g,p=!0;break}}if(p)break}n.right=h,p=!1;for(let g=a+h-1;g>=a;g--){for(let y=0;y<d;y++){let b=y*this._tmpCanvas.width*4+g*4+3;if(t.data[b]!==0){n.right=g,p=!0;break}}if(p)break}n.bottom=d,p=!1;for(let g=d-1;g>=0;g--){for(let y=0;y<h;y++){let b=g*this._tmpCanvas.width*4+y*4+3;if(t.data[b]!==0){n.bottom=g,p=!0;break}}if(p)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:n.right-n.left+1,y:n.bottom-n.top+1},sizeClipSpace:{x:n.right-n.left+1,y:n.bottom-n.top+1},offset:{x:-n.left+a+(s||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-n.top+a+(s||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},R3=class bm{constructor(t,n,r){if(this._usedPixels=0,this._glyphs=[],this.version=++bm.nextVersion,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],this.canvas=M3(t,n,n),this.ctx=Ss(this.canvas.getContext("2d",{alpha:!0})),r)if(r.length===4)this._glyphs=this._glyphs.concat(r[0].glyphs,r[1].glyphs,r[2].glyphs,r[3].glyphs),this._usedPixels=r[0]._usedPixels+r[1]._usedPixels+r[2]._usedPixels+r[3]._usedPixels;else for(let s=0;s<r.length;++s)this._glyphs=this._glyphs.concat(r[s].glyphs),this._usedPixels+=r[s]._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=++bm.nextVersion}};R3.nextVersion=0;var ql=R3;function Vf(e,t,n,r){let s=t.rgba>>>24,o=t.rgba>>>16&255,a=t.rgba>>>8&255,d=n.rgba>>>24,h=n.rgba>>>16&255,p=n.rgba>>>8&255,g=Math.floor((Math.abs(s-d)+Math.abs(o-h)+Math.abs(a-p))/12),y=!0;for(let b=0;b<e.data.length;b+=4)e.data[b]===s&&e.data[b+1]===o&&e.data[b+2]===a||r&&Math.abs(e.data[b]-s)+Math.abs(e.data[b+1]-o)+Math.abs(e.data[b+2]-a)<g?e.data[b+3]=0:y=!1;return y}function ik(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function M3(e,t,n){let r=e.createElement("canvas");return r.width=t,r.height=n,r}function ok(e,t,n,r,s,o,a,d,h=!0){let p={foreground:o.foreground,background:o.background,cursor:Wo,cursorAccent:Wo,selectionForeground:Wo,selectionBackgroundTransparent:Wo,selectionBackgroundOpaque:Wo,selectionInactiveBackgroundTransparent:Wo,selectionInactiveBackgroundOpaque:Wo,overviewRulerBorder:Wo,scrollbarSliderBackground:Wo,scrollbarSliderHoverBackground:Wo,scrollbarSliderActiveBackground:Wo,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:h,devicePixelRatio:a,deviceMaxTextureSize:d,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:r,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:p}}function H2(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].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 ak(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Vo=[];function N3(e,t,n,r,s,o,a,d,h,p=!0){let g=ok(r,s,o,a,t,n,d,h,p);for(let T=0;T<Vo.length;T++){let A=Vo[T],L=A.ownedBy.indexOf(e);if(L>=0){if(H2(A.config,g))return A.atlas;A.ownedBy.length===1?(A.atlas.dispose(),Vo.splice(T,1)):A.ownedBy.splice(L,1);break}}for(let T=0;T<Vo.length;T++){let A=Vo[T];if(H2(A.config,g))return A.ownedBy.push(e),A.atlas}let y=e._core,b=y._logService,v={atlas:new Rl(document,g,y.unicodeService,b),config:g,ownedBy:[e]};return Vo.push(v),v.atlas}function z2(e){for(let t=0;t<Vo.length;t++){let n=Vo[t].ownedBy.indexOf(e);if(n!==-1){Vo[t].ownedBy.length===1?(Vo[t].atlas.dispose(),Vo.splice(t,1)):Vo[t].ownedBy.splice(n,1);break}}}var lk=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 G2(e,t,n){let r=new t.ResizeObserver(s=>{let o=s.find(h=>h.target===e);if(!o)return;if(!("devicePixelContentBoxSize"in o)){r?.disconnect(),r=void 0;return}let a=o.devicePixelContentBoxSize[0].inlineSize,d=o.devicePixelContentBoxSize[0].blockSize;a>0&&d>0&&n(a,d)});try{r.observe(e,{box:["device-pixel-content-box"]})}catch{r.disconnect(),r=void 0}return Ps(()=>r?.disconnect())}function ck(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var uk=class D3 extends Xc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new E3,this.combinedData=""}static fromCharData(t){let n=new D3;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ck(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 n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(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 n=this.isUnderlineColorDefault(),r=t.isUnderlineColorDefault();if(!(n&&r)&&(n!==r||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())}},dk=class extends bc{constructor(e,t,n){super(),this._renderCallback=e,this._coreBrowserService=t,this._optionsService=n,this._intervalDuration=0,this._blinkOn=!0,this._needsBlinkInViewport=!1,this._isViewportVisible=!0,this._register(this._optionsService.onSpecificOptionChange("blinkIntervalDuration",r=>{this.setIntervalDuration(r)})),this.setIntervalDuration(this._optionsService.rawOptions.blinkIntervalDuration),this._register(Ps(()=>this._clearInterval()))}get isBlinkOn(){return this._blinkOn}get isEnabled(){return this._intervalDuration>0}setNeedsBlinkInViewport(e){this._needsBlinkInViewport!==e&&(this._needsBlinkInViewport=e,this._updateIntervalState())}setViewportVisible(e){this._isViewportVisible!==e&&(this._isViewportVisible=e,this._updateIntervalState())}setIntervalDuration(e){e!==this._intervalDuration&&(this._intervalDuration=e,this._clearInterval(),this._updateIntervalState())}_updateIntervalState(){if(this._intervalDuration>0&&this._needsBlinkInViewport&&this._isViewportVisible){if(this._interval!==void 0)return;let e=this._blinkOn;this._blinkOn=!0,this._interval=this._coreBrowserService.window.setInterval(()=>{this._blinkOn=!this._blinkOn,this._renderCallback()},this._intervalDuration),e||this._renderCallback();return}this._clearInterval(),this._blinkOn||(this._blinkOn=!0,this._renderCallback())}_clearInterval(){this._interval!==void 0&&(this._coreBrowserService.window.clearInterval(this._interval),this._interval=void 0)}},B3=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function P3(e,t,n,r){let s=Ss(e.createProgram());if(e.attachShader(s,Ss(W2(e,e.VERTEX_SHADER,t,r))),e.attachShader(s,Ss(W2(e,e.FRAGMENT_SHADER,n,r))),e.linkProgram(s),e.getProgramParameter(s,e.LINK_STATUS))return s;r.error(e.getProgramInfoLog(s)),e.deleteProgram(s)}function W2(e,t,n,r){let s=Ss(e.createShader(t));if(e.shaderSource(s,n),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS))return s;r.error(e.getShaderInfoLog(s)),e.deleteShader(s)}function hk(e,t){let n=Math.min(e.length*2,t),r=new Float32Array(n);for(let s=0;s<e.length;s++)r[s]=e[s];return r}var fk=class{constructor(t){this.texture=t,this.version=-1}},pk=`#version 300 es
|
|
8
|
-
layout (location = 0) in vec2 a_unitquad;
|
|
9
|
-
layout (location = 1) in vec2 a_cellpos;
|
|
10
|
-
layout (location = 2) in vec2 a_offset;
|
|
11
|
-
layout (location = 3) in vec2 a_size;
|
|
12
|
-
layout (location = 4) in float a_texpage;
|
|
13
|
-
layout (location = 5) in vec2 a_texcoord;
|
|
14
|
-
layout (location = 6) in vec2 a_texsize;
|
|
15
|
-
|
|
16
|
-
uniform mat4 u_projection;
|
|
17
|
-
uniform vec2 u_resolution;
|
|
18
|
-
|
|
19
|
-
out vec2 v_texcoord;
|
|
20
|
-
flat out int v_texpage;
|
|
21
|
-
|
|
22
|
-
void main() {
|
|
23
|
-
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
24
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
25
|
-
v_texpage = int(a_texpage);
|
|
26
|
-
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
27
|
-
}`;function mk(e){let t="";for(let n=1;n<e;n++)t+=` else if (v_texpage == ${n}) { outColor = texture(u_texture[${n}], v_texcoord); }`;return`#version 300 es
|
|
28
|
-
precision lowp float;
|
|
29
|
-
|
|
30
|
-
in vec2 v_texcoord;
|
|
31
|
-
flat in int v_texpage;
|
|
32
|
-
|
|
33
|
-
uniform sampler2D u_texture[${e}];
|
|
34
|
-
|
|
35
|
-
out vec4 outColor;
|
|
36
|
-
|
|
37
|
-
void main() {
|
|
38
|
-
if (v_texpage == 0) {
|
|
39
|
-
outColor = texture(u_texture[0], v_texcoord);
|
|
40
|
-
} ${t}
|
|
41
|
-
}`}var rs=0,Fr,qf=0,Hu=0,gk=class extends bc{constructor(t,n,r,s,o){super(),this._terminal=t,this._gl=n,this._dimensions=r,this._optionsService=s,this._logService=o,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let a=this._gl;Rl.maxAtlasPages===void 0&&(Rl.maxAtlasPages=Math.min(32,Ss(a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS))),Rl.maxTextureSize=Ss(a.getParameter(a.MAX_TEXTURE_SIZE))),this._program=Ss(P3(a,pk,mk(Rl.maxAtlasPages),this._logService)),this._register(Ps(()=>a.deleteProgram(this._program))),this._projectionLocation=Ss(a.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Ss(a.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Ss(a.getUniformLocation(this._program,"u_texture"));let d=this._vertexArrayObject=a.createVertexArray();this._register(Ps(()=>a.deleteVertexArray(d))),a.bindVertexArray(d);let h=new Float32Array([0,0,1,0,0,1,1,1]),p=a.createBuffer();this._register(Ps(()=>a.deleteBuffer(p))),a.bindBuffer(a.ARRAY_BUFFER,p),a.bufferData(a.ARRAY_BUFFER,h,a.STATIC_DRAW),a.enableVertexAttribArray(0),a.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let g=new Uint8Array([0,1,2,3]),y=a.createBuffer();this._register(Ps(()=>a.deleteBuffer(y))),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,y),a.bufferData(a.ELEMENT_ARRAY_BUFFER,g,a.STATIC_DRAW),this._attributesBuffer=Ss(a.createBuffer()),this._register(Ps(()=>a.deleteBuffer(this._attributesBuffer))),a.bindBuffer(a.ARRAY_BUFFER,this._attributesBuffer),a.enableVertexAttribArray(2),a.vertexAttribPointer(2,2,a.FLOAT,!1,44,0),a.vertexAttribDivisor(2,1),a.enableVertexAttribArray(3),a.vertexAttribPointer(3,2,a.FLOAT,!1,44,2*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(3,1),a.enableVertexAttribArray(4),a.vertexAttribPointer(4,1,a.FLOAT,!1,44,4*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(4,1),a.enableVertexAttribArray(5),a.vertexAttribPointer(5,2,a.FLOAT,!1,44,5*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(5,1),a.enableVertexAttribArray(6),a.vertexAttribPointer(6,2,a.FLOAT,!1,44,7*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(6,1),a.enableVertexAttribArray(1),a.vertexAttribPointer(1,2,a.FLOAT,!1,44,9*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(1,1),a.useProgram(this._program);let b=new Int32Array(Rl.maxAtlasPages);for(let v=0;v<Rl.maxAtlasPages;v++)b[v]=v;a.uniform1iv(this._textureLocation,b),a.uniformMatrix4fv(this._projectionLocation,!1,B3),this._atlasTextures=[];for(let v=0;v<Rl.maxAtlasPages;v++){let T=new fk(Ss(a.createTexture()));this._register(Ps(()=>a.deleteTexture(T.texture))),a.activeTexture(a.TEXTURE0+v),a.bindTexture(a.TEXTURE_2D,T.texture),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,1,1,0,a.RGBA,a.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[v]=T}a.enable(a.BLEND),a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,n,r,s,o,a,d,h,p){this._updateCell(this._vertices.attributes,t,n,r,s,o,a,d,h,p)}_updateCell(t,n,r,s,o,a,d,h,p,g){if(rs=(r*this._terminal.cols+n)*11,s===0||s===void 0){t.fill(0,rs,rs+11-1-2);return}this._atlas&&(h&&h.length>1?Fr=this._atlas.getRasterizedGlyphCombinedChar(h,o,a,d,!1,this._terminal.element):Fr=this._atlas.getRasterizedGlyph(s,o,a,d,!1,this._terminal.element),qf=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==g&&Fr.offset.x>qf?(Hu=Fr.offset.x-qf,t[rs]=-(Fr.offset.x-Hu)+this._dimensions.device.char.left,t[rs+1]=-Fr.offset.y+this._dimensions.device.char.top,t[rs+2]=(Fr.size.x-Hu)/this._dimensions.device.canvas.width,t[rs+3]=Fr.size.y/this._dimensions.device.canvas.height,t[rs+4]=Fr.texturePage,t[rs+5]=Fr.texturePositionClipSpace.x+Hu/this._atlas.pages[Fr.texturePage].canvas.width,t[rs+6]=Fr.texturePositionClipSpace.y,t[rs+7]=Fr.sizeClipSpace.x-Hu/this._atlas.pages[Fr.texturePage].canvas.width,t[rs+8]=Fr.sizeClipSpace.y):(t[rs]=-Fr.offset.x+this._dimensions.device.char.left,t[rs+1]=-Fr.offset.y+this._dimensions.device.char.top,t[rs+2]=Fr.size.x/this._dimensions.device.canvas.width,t[rs+3]=Fr.size.y/this._dimensions.device.canvas.height,t[rs+4]=Fr.texturePage,t[rs+5]=Fr.texturePositionClipSpace.x,t[rs+6]=Fr.texturePositionClipSpace.y,t[rs+7]=Fr.sizeClipSpace.x,t[rs+8]=Fr.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&OL(s,p,Fr.size.x,this._dimensions.device.cell.width)&&(t[rs+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,n=t.cols*t.rows*11;this._vertices.count!==n?this._vertices.attributes=new Float32Array(n):this._vertices.attributes.fill(0);let r=0;for(;r<this._vertices.attributesBuffers.length;r++)this._vertices.count!==n?this._vertices.attributesBuffers[r]=new Float32Array(n):this._vertices.attributesBuffers[r].fill(0);this._vertices.count=n,r=0;for(let s=0;s<t.rows;s++)for(let o=0;o<t.cols;o++)this._vertices.attributes[r+9]=o/t.cols,this._vertices.attributes[r+10]=s/t.rows,r+=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 n=this._gl;n.useProgram(this._program),n.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let r=this._vertices.attributesBuffers[this._activeBuffer],s=0;for(let o=0;o<t.lineLengths.length;o++){let a=o*this._terminal.cols*11,d=this._vertices.attributes.subarray(a,a+t.lineLengths[o]*11);r.set(d,s),s+=d.length}n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.bufferData(n.ARRAY_BUFFER,r.subarray(0,s),n.STREAM_DRAW);for(let o=0;o<this._atlas.pages.length;o++)this._atlas.pages[o].version!==this._atlasTextures[o].version&&this._bindAtlasPageTexture(n,this._atlas,o);n.drawElementsInstanced(n.TRIANGLE_STRIP,4,n.UNSIGNED_BYTE,0,s/11)}setAtlas(t){this._atlas=t,this.invalidateAtlasTextures()}invalidateAtlasTextures(){for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(t,n,r){t.activeTexture(t.TEXTURE0+r),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[r].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,n.pages[r].canvas),this._atlasTextures[r].version=n.pages[r].version}setDimensions(t){this._dimensions=t}},xk=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,n,r,s=!1){if(this.selectionStart=n,this.selectionEnd=r,!n||!r||n[0]===r[0]&&n[1]===r[1]){this.clear();return}let o=t.buffers.active.ydisp,a=n[1]-o,d=r[1]-o,h=Math.max(a,0),p=Math.min(d,t.rows-1);if(h>=t.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=a,this.viewportEndRow=d,this.viewportCappedStartRow=h,this.viewportCappedEndRow=p,this.startCol=n[0],this.endCol=r[0]}isCellSelected(t,n,r){return this.hasSelection?(r-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&r>=this.viewportCappedStartRow&&n<this.endCol&&r<=this.viewportCappedEndRow:n<this.startCol&&r>=this.viewportCappedStartRow&&n>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&n>=this.startCol):!1}};function yk(){return new xk}var bk=2147483648,vk=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=yk()}resize(t,n){let r=t*n*4;r!==this.cells.length&&(this.cells=new Uint32Array(r),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},wk=`#version 300 es
|
|
42
|
-
layout (location = 0) in vec2 a_position;
|
|
43
|
-
layout (location = 1) in vec2 a_size;
|
|
44
|
-
layout (location = 2) in vec4 a_color;
|
|
45
|
-
layout (location = 3) in vec2 a_unitquad;
|
|
46
|
-
|
|
47
|
-
uniform mat4 u_projection;
|
|
48
|
-
|
|
49
|
-
out vec4 v_color;
|
|
50
|
-
|
|
51
|
-
void main() {
|
|
52
|
-
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
53
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
54
|
-
v_color = a_color;
|
|
55
|
-
}`,Ak=`#version 300 es
|
|
56
|
-
precision lowp float;
|
|
57
|
-
|
|
58
|
-
in vec4 v_color;
|
|
59
|
-
|
|
60
|
-
out vec4 outColor;
|
|
61
|
-
|
|
62
|
-
void main() {
|
|
63
|
-
outColor = v_color;
|
|
64
|
-
}`,Pa=8,Yf=Pa*Float32Array.BYTES_PER_ELEMENT,Tk=20*Pa,V2=class{constructor(){this.attributes=new Float32Array(Tk),this.count=0}},Za=0,q2=0,Y2=0,Z2=0,K2=0,X2=0,J2=0,Sk=class extends bc{constructor(t,n,r,s,o){super(),this._terminal=t,this._gl=n,this._dimensions=r,this._themeService=s,this._logService=o,this._vertices=new V2,this._verticesCursor=new V2;let a=this._gl;this._program=Ss(P3(a,wk,Ak,this._logService)),this._register(Ps(()=>a.deleteProgram(this._program))),this._projectionLocation=Ss(a.getUniformLocation(this._program,"u_projection"));let d=this._vertexArrayObject=a.createVertexArray();this._register(Ps(()=>a.deleteVertexArray(d))),a.bindVertexArray(d);let h=new Float32Array([0,0,1,0,0,1,1,1]),p=a.createBuffer();this._register(Ps(()=>a.deleteBuffer(p))),a.bindBuffer(a.ARRAY_BUFFER,p),a.bufferData(a.ARRAY_BUFFER,h,a.STATIC_DRAW),a.enableVertexAttribArray(3),a.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let g=new Uint8Array([0,1,2,3]),y=a.createBuffer();this._register(Ps(()=>a.deleteBuffer(y))),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,y),a.bufferData(a.ELEMENT_ARRAY_BUFFER,g,a.STATIC_DRAW),this._attributesBuffer=Ss(a.createBuffer()),this._register(Ps(()=>a.deleteBuffer(this._attributesBuffer))),a.bindBuffer(a.ARRAY_BUFFER,this._attributesBuffer),a.enableVertexAttribArray(0),a.vertexAttribPointer(0,2,a.FLOAT,!1,Yf,0),a.vertexAttribDivisor(0,1),a.enableVertexAttribArray(1),a.vertexAttribPointer(1,2,a.FLOAT,!1,Yf,2*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(1,1),a.enableVertexAttribArray(2),a.vertexAttribPointer(2,4,a.FLOAT,!1,Yf,4*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors(b=>{this._updateCachedColors(b),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let n=this._gl;n.useProgram(this._program),n.bindVertexArray(this._vertexArrayObject),n.uniformMatrix4fv(this._projectionLocation,!1,B3),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.bufferData(n.ARRAY_BUFFER,t.attributes,n.DYNAMIC_DRAW),n.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,n.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 n=this._terminal,r=this._vertices,s=1,o,a,d,h,p,g,y,b,v,T,A;for(o=0;o<n.rows;o++){for(d=-1,h=0,p=0,g=!1,a=0;a<n.cols;a++)y=(o*n.cols+a)*4,b=t.cells[y+1],v=t.cells[y+2],T=!!(v&67108864),(b!==h||v!==p&&(g||T))&&((h!==0||g&&p!==0)&&(A=s++*Pa,this._updateRectangle(r,A,p,h,d,a,o)),d=a,h=b,p=v,g=T);(h!==0||g&&p!==0)&&(A=s++*Pa,this._updateRectangle(r,A,p,h,d,n.cols,o))}r.count=s}updateCursor(t){let n=this._verticesCursor,r=t.cursor;if(!r||r.style==="block"){n.count=0;return}let s,o=0;(r.style==="bar"||r.style==="outline")&&(s=o++*Pa,this._addRectangleFloat(n.attributes,s,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.style==="bar"?r.dpr*r.cursorWidth:r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(r.style==="underline"||r.style==="outline")&&(s=o++*Pa,this._addRectangleFloat(n.attributes,s,r.x*this._dimensions.device.cell.width,(r.y+1)*this._dimensions.device.cell.height-r.dpr,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat)),r.style==="outline"&&(s=o++*Pa,this._addRectangleFloat(n.attributes,s,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat),s=o++*Pa,this._addRectangleFloat(n.attributes,s,(r.x+r.width)*this._dimensions.device.cell.width-r.dpr,r.y*this._dimensions.device.cell.height,r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),n.count=o}_updateRectangle(t,n,r,s,o,a,d){if(r&67108864)switch(r&50331648){case 16777216:case 33554432:Za=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:Za=(r&16777215)<<8;break;default:Za=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:Za=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Za=(s&16777215)<<8;break;default:Za=this._themeService.colors.background.rgba}t.attributes.length<n+Pa&&(t.attributes=hk(t.attributes,(this._terminal.rows*this._terminal.cols+1)*Pa)),q2=o*this._dimensions.device.cell.width,Y2=d*this._dimensions.device.cell.height,Z2=(Za>>24&255)/255,K2=(Za>>16&255)/255,X2=(Za>>8&255)/255,J2=1,this._addRectangle(t.attributes,n,q2,Y2,(a-o)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Z2,K2,X2,J2)}_addRectangle(t,n,r,s,o,a,d,h,p,g){t[n]=r/this._dimensions.device.canvas.width,t[n+1]=s/this._dimensions.device.canvas.height,t[n+2]=o/this._dimensions.device.canvas.width,t[n+3]=a/this._dimensions.device.canvas.height,t[n+4]=d,t[n+5]=h,t[n+6]=p,t[n+7]=g}_addRectangleFloat(t,n,r,s,o,a,d){t[n]=r/this._dimensions.device.canvas.width,t[n+1]=s/this._dimensions.device.canvas.height,t[n+2]=o/this._dimensions.device.canvas.width,t[n+3]=a/this._dimensions.device.canvas.height,t[n+4]=d[0],t[n+5]=d[1],t[n+6]=d[2],t[n+7]=d[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])}},Ck=class extends bc{constructor(e,t,n,r,s,o,a,d){super(),this._container=t,this._alpha=s,this._coreBrowserService=o,this._optionsService=a,this._themeService=d,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-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(e,h),this.reset(e)})),this._register(Ps(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Ss(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=N3(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,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*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,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=S3,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?"italic":""} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},_k=class extends Ck{constructor(t,n,r,s,o,a,d){super(r,t,"link",n,!0,o,a,d),this._register(s.onShowLinkUnderline(h=>this._handleShowLinkUnderline(h))),this._register(s.onHideLinkUnderline(h=>this._handleHideLinkUnderline(h)))}resize(t,n){super.resize(t,n),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&&ak(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 n=t.y1+1;n<t.y2;n++)this._fillBottomLineAtCells(0,n,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},Lk=class{constructor(t,n,r,s){this._node=t,this._type=n,this._handler=r,this._options=s,t.addEventListener(n,r,s)}dispose(){!this._node||!this._handler||(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Zf(e,t,n,r){return new Lk(e,t,n,r)}var kk=class extends bc{constructor(e,t,n,r,s,o,a,d,h,p=!0,g){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=s,this._decorationService=o,this._logService=a,this._optionsService=d,this._themeService=h,this._customGlyphs=p,this._cursorBlinkStateManager=this._register(new Fu),this._charAtlasDisposable=this._register(new Fu),this._observerDisposable=this._register(new Fu),this._model=new vk,this._rowHasBlinkingCells=[],this._rowHasBlinkingCellsCount=0,this._workCell=new uk,this._rectangleRenderer=this._register(new Fu),this._glyphRenderer=this._register(new Fu),this._onChangeTextureAtlas=this._register(new ha),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ha),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ha),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ha),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ha),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let y={antialias:!1,depth:!1,preserveDrawingBuffer:g};if(this._gl=this._canvas.getContext("webgl2",y),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new HL(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new _k(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,d,this._themeService)],this.dimensions=FL(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(d.onOptionChange(()=>this._handleOptionsChanged())),this._textBlinkStateManager=this._register(new dk(()=>this._requestRedrawViewport(),this._coreBrowserService,this._optionsService)),this._resetBlinkingRowState(),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Zf(this._canvas,"webglcontextlost",b=>{this._logService.debug("webglcontextlost event received"),b.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,this._logService.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(b)},3e3)})),this._register(Zf(this._canvas,"webglcontextrestored",b=>{this._logService.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,z2(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=G2(this._canvas,this._coreBrowserService.window,(b,v)=>this._setCanvasDevicePixelDimensions(b,v)),this._register(this._coreBrowserService.onWindowChange(b=>{this._observerDisposable.value=G2(this._canvas,b,(v,T)=>this._setCanvasDevicePixelDimensions(v,T))})),this._register(Zf(this._coreBrowserService.mainDocument,"mousedown",()=>this._cursorBlinkStateManager.value?.restartBlinkAnimation())),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Ps(()=>{clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0;for(let b of this._renderLayers)b.dispose();this._canvas.parentElement?.removeChild(this._canvas),z2(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 n of this._renderLayers)n.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,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),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 Sk(this._terminal,this._gl,this.dimensions,this._themeService,this._logService),this._glyphRenderer.value=new gk(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=N3(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=kL(oc.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),oc.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 s of this._renderLayers)s.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 n=!1,r=0;for(;this._charAtlas&&this._glyphRenderer.value.beginFrame()&&r++<32;)n=!0,this._clearModel(!0),this._updateModel(0,this._terminal.rows-1);n&&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 lk(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,s,o,a,d,h,p,g,y,b,v,T,A,L,R,D,B,j;e=e5(e,n.rows-1,0),t=e5(t,n.rows-1,0);let P=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??"block",$=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,z=$-n.buffer.ydisp,H=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),ye=-1,q=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let te=!1;for(o=e;o<=t;o++){a=o+n.buffer.ydisp;let ve=n.buffer.lines.get(a);if(!ve){for(this._model.lineLengths[o]=0,B=0;B<n.cols;B++)j=(o*n.cols+B)*4,te=!0,this._nullModelCell(B,o,j,0,0,0);this._setRowBlinkState(o,!1);continue}d=ve;let ge=!1;for(this._model.lineLengths[o]=0,T=$===a,g=0,h=this._characterJoinerService.getJoinedCharacters(a),B=0;B<n.cols;B++){if(s=this._cellColorResolver.result.bg,d.loadCell(B,r),B===0&&(s=this._cellColorResolver.result.bg),p=!1,y=B>=g,b=B,h.length>0&&B===h[0][0]&&y){v=h.shift();let ie=this._model.selection.isCellSelected(this._terminal,v[0],a);for(D=v[0]+1;D<v[1];D++)y&&=ie===this._model.selection.isCellSelected(this._terminal,D,a);y&&=!T||H<v[0]||H>=v[1],y?(p=!0,r=new Ek(r,d.translateToString(!0,v[0],v[1]),v[1]-v[0]),b=v[1]-1):g=v[1]}if(A=r.getChars(),L=r.getCode(),D=(o*n.cols+B)*4,!ge&&r.isBlink()&&(ge=!0),this._cellColorResolver.resolve(r,B,a,this.dimensions.device.cell.width,this.dimensions.device.cell.height),q&&a===$&&(B===H&&(this._model.cursor={x:H,y:z,width:r.getWidth(),style:this._coreBrowserService.isFocused?P:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},ye=H+r.getWidth()-1),B>=H&&B<=ye&&(this._coreBrowserService.isFocused&&P==="block"||this._coreBrowserService.isFocused===!1&&n.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&&r.isBlink()&&(this._cellColorResolver.result.fg|=1073741824),L!==0&&(this._model.lineLengths[o]=B+1),!(this._model.cells[D]===L&&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)&&(te=!0,A.length>1&&(L|=bk),this._model.cells[D]=L,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=r.getWidth(),this._glyphRenderer.value.updateCell(B,o,L,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,A,R,s),p)){for(r=this._workCell,B++;B<=b;B++)j=(o*n.cols+B)*4,this._nullModelCell(B,o,j,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext);B--}}this._setRowBlinkState(o,ge)}te&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model),this._updateTextBlinkState()}_nullModelCell(e,t,n,r,s,o){this._glyphRenderer.value.updateCell(e,t,0,r,s,o,"",0,0),this._model.cells[n]=0,this._model.cells[n+1]=r,this._model.cells[n+2]=s,this._model.cells[n+3]=o}_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})}},Ek=class extends Xc{constructor(t,n,r){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=n,this._width=r}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 e5(e,t,n=0){return Math.max(Math.min(e,t),n)}var Ik=class extends bc{constructor(e){if(A3&&ML()<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 ha),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ha),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ha),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ha),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 n=t.coreService,r=t.optionsService,s=t,o=s._renderService,a=s._characterJoinerService,d=s._charSizeService,h=s._coreBrowserService,p=s._decorationService,g=s._logService,y=s._themeService;this._renderer=this._register(new kk(e,a,d,h,n,p,g,r,y,this._customGlyphs,this._preserveDrawingBuffer)),this._register(oc.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(oc.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(oc.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(oc.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),o.setRenderer(this._renderer),this._register(Ps(()=>{if(this._terminal._core._store._isDisposed)return;let b=this._terminal._core._renderService;b.setRenderer(this._terminal._core._createRenderer()),b.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var Rk=class{constructor(t,n,r,s={}){this._terminal=t,this._regex=n,this._handler=r,this._options=s}provideLinks(t,n){let r=Nk.computeLink(t,this._regex,this._terminal,this._handler);n(this._addCallbacks(r))}_addCallbacks(t){return t.map(n=>(n.leave=this._options.leave,n.hover=(r,s)=>{if(this._options.hover){let{range:o}=n;this._options.hover(r,s,o)}},n))}};function Mk(e){try{let t=new URL(e),n=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(n.toLocaleLowerCase())}catch{return!1}}var Nk=class Yd{static computeLink(t,n,r,s){let o=n.flags.includes("g")?n.flags:`${n.flags}g`,a=new RegExp(n.source,o),[d,h]=Yd._getWindowedLineStrings(t-1,r),p=d.join(""),g,y=[];for(;g=a.exec(p);){let b=g[0];if(!Mk(b))continue;let[v,T]=Yd._mapStrIdx(r,h,0,g.index),[A,L]=Yd._mapStrIdx(r,v,T,b.length);if(v===-1||T===-1||A===-1||L===-1)continue;let R={start:{x:T+1,y:v+1},end:{x:L,y:A+1}};y.push({range:R,text:b,activate:s})}return y}static _getWindowedLineStrings(t,n){let r,s=t,o=t,a,d,h=[];if(r=n.buffer.active.getLine(t)){let p=r.translateToString(!0);if(r.isWrapped&&p[0]!==" "){for(a=0;(r=n.buffer.active.getLine(--s))&&a<2048&&(d=r.translateToString(!0),a+=d.length,h.push(d),!(!r.isWrapped||d.indexOf(" ")!==-1)););h.reverse()}for(h.push(p),a=0;(r=n.buffer.active.getLine(++o))&&r.isWrapped&&a<2048&&(d=r.translateToString(!0),a+=d.length,h.push(d),d.indexOf(" ")===-1););}return[h,s]}static _mapStrIdx(t,n,r,s){let o=t.buffer.active,a=o.getNullCell(),d=r;for(;s;){let h=o.getLine(n);if(!h)return[-1,-1];for(let p=d;p<h.length;++p){h.getCell(p,a);let g=a.getChars();if(a.getWidth()&&(s-=g.length||1,p===h.length-1&&g==="")){let y=o.getLine(n+1);y&&y.isWrapped&&(y.getCell(0,a),a.getWidth()===2&&(s+=1))}if(s<0)return[n,p]}n++,d=0}return[n,d]}},Dk=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Bk(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var Pk=class{constructor(t=Bk,n={}){this._handler=t,this._options=n}activate(t){this._terminal=t;let n=this._options,r=n.urlRegex??Dk;this._linkProvider=this._terminal.registerLinkProvider(new Rk(this._terminal,r,this._handler,n))}dispose(){this._linkProvider?.dispose()}};function t5(e){return{dispose:e}}var Qk=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()}},Ok=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,n,r)=>{if(this._disposed)return t5(()=>{});let s={fn:t,thisArgs:n};this._listeners.push(s);let o=t5(()=>{let a=this._listeners.indexOf(s);a!==-1&&this._listeners.splice(a,1)});return r&&(Array.isArray(r)?r.push(o):r.add(o)),o},this._event)}fire(t){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:n,thisArgs:r}=this._listeners[0];n.call(r,t);return}default:{let n=this._listeners.slice();for(let{fn:r,thisArgs:s}of n)r.call(s,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},Fk;(e=>{function t(o,a){return o(d=>a.fire(d))}e.forward=t;function n(o,a){return(d,h,p)=>o(g=>d.call(h,a(g)),void 0,p)}e.map=n;function r(...o){return(a,d,h)=>{let p=new Qk;for(let g of o)p.add(g(y=>a.call(d,y)));return h&&(Array.isArray(h)?h.push(p):h.add(p)),p}}e.any=r;function s(o,a,d){return a(d),o(h=>a(h))}e.runAndSubscribe=s})(Fk||={});var n5=class Zd{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Ok,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,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?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 n=0,r=0,s=t.length;for(let o=0;o<s;++o){let a=t.charCodeAt(o);if(55296<=a&&a<=56319){if(++o>=s)return n+this.wcwidth(a);let p=t.charCodeAt(o);56320<=p&&p<=57343?a=(a-55296)*1024+p-56320+65536:n+=this.wcwidth(p)}let d=this.charProperties(a,r),h=Zd.extractWidth(d);Zd.extractShouldJoin(d)&&(h-=Zd.extractWidth(r)),n+=h,r=d}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},Kf=[[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]],jk=[[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]],Xf=[[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]],$k=[[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]],Ka;function r5(e,t){let n=0,r=t.length-1,s;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(s=n+r>>1,e>t[s][1])n=s+1;else if(e<t[s][0])r=s-1;else return!0;return!1}var Uk=class{constructor(){if(this.version="11",!Ka){Ka=new Uint8Array(65536),Ka.fill(1),Ka[0]=0,Ka.fill(0,1,32),Ka.fill(0,127,160);for(let e=0;e<Kf.length;++e)Ka.fill(0,Kf[e][0],Kf[e][1]+1);for(let e=0;e<Xf.length;++e)Ka.fill(2,Xf[e][0],Xf[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Ka[e]:r5(e,jk)?0:r5(e,$k)?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let s=n5.extractWidth(t);s===0?r=!1:s>n&&(n=s)}return n5.createPropertyValue(0,n,r)}},Hk=class{activate(e){e.unicode.register(new Uk)}dispose(){}};function pc(e){return{dispose:e}}function Kd(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function zk(...e){return pc(()=>Kd(e))}var Q3=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()}},q0=class{constructor(){this._store=new Q3}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};q0.None=Object.freeze({dispose(){}});var fh=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}},vm=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,n)=>{if(this._disposed)return pc(()=>{});let r={fn:e,thisArgs:t};this._listeners.push(r);let s=pc(()=>{let o=this._listeners.indexOf(r);o!==-1&&this._listeners.splice(o,1)});return n&&(Array.isArray(n)?n.push(s):n.add(s)),s},this._event)}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:n}=this._listeners[0];t.call(n,e);return}default:{let t=this._listeners.slice();for(let{fn:n,thisArgs:r}of t)n.call(r,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},Gk;(e=>{function t(o,a){return o(d=>a.fire(d))}e.forward=t;function n(o,a){return(d,h,p)=>o(g=>d.call(h,a(g)),void 0,p)}e.map=n;function r(...o){return(a,d,h)=>{let p=new Q3;for(let g of o)p.add(g(y=>a.call(d,y)));return h&&(Array.isArray(h)?h.push(p):h.add(p)),p}}e.any=r;function s(o,a,d){return a(d),o(h=>a(h))}e.runAndSubscribe=s})(Gk||={});function O3(e,t=0,n){let r=setTimeout(()=>{e()},t);return pc(()=>{clearTimeout(r)})}var Wk=class extends q0{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new fh),this._linesCacheDisposables=this._register(new fh),this._lastAccessTimestamp=0,this._register(pc(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=zk(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=O3(()=>{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 n=[],r=[0],s=this._terminal.buffer.active.getLine(e);for(;s;){let o=this._terminal.buffer.active.getLine(e+1),a=o?o.isWrapped:!1,d=s.translateToString(!a&&t);if(a&&o){let h=s.getCell(s.length-1);h&&h.getCode()===0&&h.getWidth()===1&&o.getCell(0)?.getWidth()===2&&(d=d.slice(0,-1))}if(n.push(d),a)r.push(r[r.length-1]+d.length);else break;e++,s=o}return[n.join(""),r]}},Vk=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,n){return n?.decorations?this._cachedSearchTerm===void 0||t!==this._cachedSearchTerm||this.didOptionsChange(n):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},qk=class{constructor(t,n){this._terminal=t,this._lineCache=n}find(t,n,r,s){if(!t||t.length===0){this._terminal.clearSelection();return}if(r>=this._terminal.cols)throw new Error(`Invalid col: ${r} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let o={startRow:n,startCol:r},a=this._findInLine(t,o,s);if(!a)for(let d=n+1;d<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=d,o.startCol=0,a=this._findInLine(t,o,s),!a);d++);return a}findNextWithSelection(t,n,r){if(!t||t.length===0){this._terminal.clearSelection();return}let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let o=0,a=0;s&&(r===t?(o=s.end.x,a=s.end.y):(o=s.start.x,a=s.start.y)),this._lineCache.initLinesCache();let d={startRow:a,startCol:o},h=this._findInLine(t,d,n);if(!h)for(let p=a+1;p<this._terminal.buffer.active.baseY+this._terminal.rows&&(d.startRow=p,d.startCol=0,h=this._findInLine(t,d,n),!h);p++);if(!h&&a!==0)for(let p=0;p<a&&(d.startRow=p,d.startCol=0,h=this._findInLine(t,d,n),!h);p++);return!h&&s&&(d.startRow=s.start.y,d.startCol=0,h=this._findInLine(t,d,n)),h}findPreviousWithSelection(t,n,r){if(!t||t.length===0){this._terminal.clearSelection();return}let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let o=this._terminal.buffer.active.baseY+this._terminal.rows-1,a=this._terminal.cols,d=!0;this._lineCache.initLinesCache();let h={startRow:o,startCol:a},p;if(s&&(h.startRow=o=s.start.y,h.startCol=s.start.x,r!==t&&(p=this._findInLine(t,h,n,!1),p||(h.startRow=o=s.end.y,h.startCol=s.end.x))),p??=this._findInLine(t,h,n,d),!p){h.startCol=Math.max(h.startCol,this._terminal.cols);for(let g=o-1;g>=0&&(h.startRow=g,p=this._findInLine(t,h,n,d),!p);g--);}if(!p&&o!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let g=this._terminal.buffer.active.baseY+this._terminal.rows-1;g>=o&&(h.startRow=g,p=this._findInLine(t,h,n,d),!p);g--);return p}_isWholeWord(t,n,r){return(t===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(n[t-1]))&&(t+r.length===n.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(n[t+r.length]))}_findInLine(t,n,r={},s=!1){let o=n.startRow,a=n.startCol;if(this._terminal.buffer.active.getLine(o)?.isWrapped){if(s){n.startCol+=this._terminal.cols;return}return n.startRow--,n.startCol+=this._terminal.cols,this._findInLine(t,n,r)}let d=this._lineCache.getLineFromCache(o);d||(d=this._lineCache.translateBufferLineToStringWithWrap(o,!0),this._lineCache.setLineInCache(o,d));let[h,p]=d,g=this._bufferColsToStringOffset(o,a),y=t,b=h;r.regex||(y=r.caseSensitive?t:t.toLowerCase(),b=r.caseSensitive?h:h.toLowerCase());let v=-1;if(r.regex){let T=RegExp(y,r.caseSensitive?"g":"gi"),A;if(s)for(;A=T.exec(b.slice(0,g));)v=T.lastIndex-A[0].length,t=A[0],T.lastIndex-=t.length-1;else A=T.exec(b.slice(g)),A&&A[0].length>0&&(v=g+(T.lastIndex-A[0].length),t=A[0])}else s?g-y.length>=0&&(v=b.lastIndexOf(y,g-y.length)):v=b.indexOf(y,g);if(v>=0){if(r.wholeWord&&!this._isWholeWord(v,b,t))return;let T=0;for(;T<p.length-1&&v>=p[T+1];)T++;let A=T;for(;A<p.length-1&&v+t.length>=p[A+1];)A++;let L=v-p[T],R=v+t.length-p[A],D=this._stringLengthToBufferSize(o+T,L),B=this._stringLengthToBufferSize(o+A,R)-D+this._terminal.cols*(A-T);return{term:t,col:D,row:o+T,size:B}}}_stringLengthToBufferSize(t,n){let r=this._terminal.buffer.active.getLine(t);if(!r)return 0;for(let s=0;s<n;s++){let o=r.getCell(s);if(!o)break;let a=o.getChars();a.length>1&&(n-=a.length-1);let d=r.getCell(s+1);d&&d.getWidth()===0&&n++}return n}_bufferColsToStringOffset(t,n){let r=t,s=0,o=this._terminal.buffer.active.getLine(r);for(;n>0&&o;){for(let a=0;a<n&&a<this._terminal.cols;a++){let d=o.getCell(a);if(!d)break;d.getWidth()&&(s+=d.getCode()===0?1:d.getChars().length)}if(r++,o=this._terminal.buffer.active.getLine(r),o&&!o.isWrapped)break;n-=this._terminal.cols}return s}},Yk=class extends q0{constructor(t){super(),this._terminal=t,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(pc(()=>this.clearHighlightDecorations()))}createHighlightDecorations(t,n){this.clearHighlightDecorations();for(let r of t){let s=this._createResultDecorations(r,n,!1);if(s)for(let o of s)this._storeDecoration(o,r)}}createActiveDecoration(t,n){let r=this._createResultDecorations(t,n,!0);if(r)return{decorations:r,match:t,dispose(){Kd(r)}}}clearHighlightDecorations(){Kd(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(t,n){this._highlightedLines.add(t.marker.line),this._highlightDecorations.push({decoration:t,match:n,dispose(){t.dispose()}})}_applyStyles(t,n,r){t.classList.contains("xterm-find-result-decoration")||(t.classList.add("xterm-find-result-decoration"),n&&(t.style.outline=`1px solid ${n}`)),r&&t.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(t,n,r){let s=[],o=t.col,a=t.size,d=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+t.row;for(;a>0;){let p=Math.min(this._terminal.cols-o,a);s.push([d,o,p]),o=0,a-=p,d++}let h=[];for(let p of s){let g=this._terminal.registerMarker(p[0]),y=this._terminal.registerDecoration({marker:g,x:p[1],width:p[2],layer:r?"top":"bottom",backgroundColor:r?n.activeMatchBackground:n.matchBackground,overviewRulerOptions:this._highlightedLines.has(g.line)?void 0:{color:r?n.activeMatchColorOverviewRuler:n.matchOverviewRuler,position:"center"}});if(y){let b=[];b.push(g),b.push(y.onRender(v=>this._applyStyles(v,r?n.activeMatchBorder:n.matchBorder,!1))),b.push(y.onDispose(()=>Kd(b))),h.push(y)}}return h.length===0?void 0:h}},Zk=class extends q0{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new vm)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(t){this._selectedDecoration=t}updateResults(t,n){this._searchResults=t.slice(0,n)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(t){for(let n=0;n<this._searchResults.length;n++){let r=this._searchResults[n];if(r.row===t.row&&r.col===t.col&&r.size===t.size)return n}return-1}fireResultsChanged(t){if(!t)return;let n=-1;this._selectedDecoration&&(n=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:n,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},Kk=class extends q0{constructor(t){super(),this._highlightTimeout=this._register(new fh),this._lineCache=this._register(new fh),this._state=new Vk,this._resultTracker=this._register(new Zk),this._onAfterSearch=this._register(new vm),this.onAfterSearch=this._onAfterSearch.event,this._onBeforeSearch=this._register(new vm),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 Wk(t),this._engine=new qk(t,this._lineCache.value),this._decorationManager=new Yk(t),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(pc(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=O3(()=>{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,n,r){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._onBeforeSearch.fire(),this._state.lastSearchOptions=n,this._state.shouldUpdateHighlighting(t,n)&&this._highlightAllMatches(t,n);let s=this._findNextAndSelect(t,n,r);return this._fireResults(n),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),s}_highlightAllMatches(t,n){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 r=[],s,o=this._engine.find(t,0,0,n);for(;o&&(s?.row!==o.row||s?.col!==o.col)&&!(r.length>=this._highlightLimit);){s=o,r.push(s);let a=this._terminal.cols,d=s.col+s.size,h=s.row;d>=a&&(h+=Math.floor(d/a),d=d%a),o=this._engine.find(t,h,d,n)}this._resultTracker.updateResults(r,this._highlightLimit),n.decorations&&this._decorationManager.createHighlightDecorations(r,n.decorations)}_findNextAndSelect(t,n,r){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let s=this._engine.findNextWithSelection(t,n,this._state.cachedSearchTerm);return this._selectResult(s,n?.decorations,r?.noScroll)}findPrevious(t,n,r){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._onBeforeSearch.fire(),this._state.lastSearchOptions=n,this._state.shouldUpdateHighlighting(t,n)&&this._highlightAllMatches(t,n);let s=this._findPreviousAndSelect(t,n,r);return this._fireResults(n),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),s}_fireResults(t){this._resultTracker.fireResultsChanged(!!t?.decorations)}_findPreviousAndSelect(t,n,r){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let s=this._engine.findPreviousWithSelection(t,n,this._state.cachedSearchTerm);return this._selectResult(s,n?.decorations,r?.noScroll)}_selectResult(t,n,r){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),n){let s=this._decorationManager.createActiveDecoration(t,n);s&&(this._resultTracker.selectedDecoration=s)}if(!r&&(t.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||t.row<this._terminal.buffer.active.viewportY)){let s=t.row-this._terminal.buffer.active.viewportY;s-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(s)}return!0}};var Xs=0,Js=0,ei=0,is=0,ki;(e=>{function t(s,o,a,d){return d!==void 0?`#${Yl(s)}${Yl(o)}${Yl(a)}${Yl(d)}`:`#${Yl(s)}${Yl(o)}${Yl(a)}`}e.toCss=t;function n(s,o,a,d=255){return(s<<24|o<<16|a<<8|d)>>>0}e.toRgba=n;function r(s,o,a,d){return{css:e.toCss(s,o,a,d),rgba:e.toRgba(s,o,a,d)}}e.toColor=r})(ki||={});var Xk;(e=>{function t(h,p){if(is=(p.rgba&255)/255,is===1)return{css:p.css,rgba:p.rgba};let g=p.rgba>>24&255,y=p.rgba>>16&255,b=p.rgba>>8&255,v=h.rgba>>24&255,T=h.rgba>>16&255,A=h.rgba>>8&255;Xs=v+Math.round((g-v)*is),Js=T+Math.round((y-T)*is),ei=A+Math.round((b-A)*is);let L=ki.toCss(Xs,Js,ei),R=ki.toRgba(Xs,Js,ei);return{css:L,rgba:R}}e.blend=t;function n(h){return(h.rgba&255)===255}e.isOpaque=n;function r(h,p,g){let y=Xd.ensureContrastRatio(h.rgba,p.rgba,g);if(y)return ki.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=r;function s(h){let p=(h.rgba|255)>>>0;return[Xs,Js,ei]=Xd.toChannels(p),{css:ki.toCss(Xs,Js,ei),rgba:p}}e.opaque=s;function o(h,p){return is=Math.round(p*255),[Xs,Js,ei]=Xd.toChannels(h.rgba),{css:ki.toCss(Xs,Js,ei,is),rgba:ki.toRgba(Xs,Js,ei,is)}}e.opacity=o;function a(h,p){return is=h.rgba&255,o(h,is*p/255)}e.multiplyOpacity=a;function d(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=d})(Xk||={});var fi;(e=>{let t,n;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Xs=parseInt(s.slice(1,2).repeat(2),16),Js=parseInt(s.slice(2,3).repeat(2),16),ei=parseInt(s.slice(3,4).repeat(2),16),ki.toColor(Xs,Js,ei);case 5:return Xs=parseInt(s.slice(1,2).repeat(2),16),Js=parseInt(s.slice(2,3).repeat(2),16),ei=parseInt(s.slice(3,4).repeat(2),16),is=parseInt(s.slice(4,5).repeat(2),16),ki.toColor(Xs,Js,ei,is);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let o=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Xs=parseInt(o[1],10),Js=parseInt(o[2],10),ei=parseInt(o[3],10),is=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),ki.toColor(Xs,Js,ei,is);if(s==="transparent")return{css:"transparent",rgba:0};if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Xs,Js,ei,is]=t.getImageData(0,0,1,1).data,is!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ki.toRgba(Xs,Js,ei,is),css:s}}e.toColor=r})(fi||={});var Wi;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,s,o){let a=r/255,d=s/255,h=o/255,p=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),g=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),y=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return p*.2126+g*.7152+y*.0722}e.relativeLuminance2=n})(Wi||={});var Xd;(e=>{function t(a,d){if(is=(d&255)/255,is===1)return d;let h=d>>24&255,p=d>>16&255,g=d>>8&255,y=a>>24&255,b=a>>16&255,v=a>>8&255;return Xs=y+Math.round((h-y)*is),Js=b+Math.round((p-b)*is),ei=v+Math.round((g-v)*is),ki.toRgba(Xs,Js,ei)}e.blend=t;function n(a,d,h){let p=Wi.relativeLuminance(a>>8),g=Wi.relativeLuminance(d>>8);if(Xa(p,g)<h){if(g<p){let v=r(a,d,h),T=Xa(p,Wi.relativeLuminance(v>>8));if(T<h){let A=s(a,d,h),L=Xa(p,Wi.relativeLuminance(A>>8));return T>L?v:A}return v}let y=s(a,d,h),b=Xa(p,Wi.relativeLuminance(y>>8));if(b<h){let v=r(a,d,h),T=Xa(p,Wi.relativeLuminance(v>>8));return b>T?y:v}return y}}e.ensureContrastRatio=n;function r(a,d,h){let p=a>>24&255,g=a>>16&255,y=a>>8&255,b=d>>24&255,v=d>>16&255,T=d>>8&255,A=Xa(Wi.relativeLuminance2(b,v,T),Wi.relativeLuminance2(p,g,y));for(;A<h&&(b>0||v>0||T>0);)b-=Math.max(0,Math.ceil(b*.1)),v-=Math.max(0,Math.ceil(v*.1)),T-=Math.max(0,Math.ceil(T*.1)),A=Xa(Wi.relativeLuminance2(b,v,T),Wi.relativeLuminance2(p,g,y));return(b<<24|v<<16|T<<8|255)>>>0}e.reduceLuminance=r;function s(a,d,h){let p=a>>24&255,g=a>>16&255,y=a>>8&255,b=d>>24&255,v=d>>16&255,T=d>>8&255,A=Xa(Wi.relativeLuminance2(b,v,T),Wi.relativeLuminance2(p,g,y));for(;A<h&&(b<255||v<255||T<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),T=Math.min(255,T+Math.ceil((255-T)*.1)),A=Xa(Wi.relativeLuminance2(b,v,T),Wi.relativeLuminance2(p,g,y));return(b<<24|v<<16|T<<8|255)>>>0}e.increaseLuminance=s;function o(a){return[a>>24&255,a>>16&255,a>>8&255,a&255]}e.toChannels=o})(Xd||={});function Yl(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Xa(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Jk=Object.freeze((()=>{let e=[fi.toColor("#2e3436"),fi.toColor("#cc0000"),fi.toColor("#4e9a06"),fi.toColor("#c4a000"),fi.toColor("#3465a4"),fi.toColor("#75507b"),fi.toColor("#06989a"),fi.toColor("#d3d7cf"),fi.toColor("#555753"),fi.toColor("#ef2929"),fi.toColor("#8ae234"),fi.toColor("#fce94f"),fi.toColor("#729fcf"),fi.toColor("#ad7fa8"),fi.toColor("#34e2e2"),fi.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],s=t[n/6%6|0],o=t[n%6];e.push({css:ki.toCss(r,s,o),rgba:ki.toRgba(r,s,o)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:ki.toCss(r,r,r),rgba:ki.toRgba(r,r,r)})}return e})());function s5(e,t,n){return Math.max(t,Math.min(e,n))}function eE(e){switch(e){case"&":return"&";case"<":return"<"}return e}var F3=class{constructor(e){this._buffer=e}serialize(e,t){let n=this._buffer.getNullCell(),r=this._buffer.getNullCell(),s=n,o=e.start.y,a=e.end.y,d=e.start.x,h=e.end.x;this._beforeSerialize(a-o,o,a);for(let p=o;p<=a;p++){let g=this._buffer.getLine(p);if(g){let y=p===e.start.y?d:0,b=p===e.end.y?h:g.length;for(let v=y;v<b;v++){let T=g.getCell(v,s===n?r:n);if(!T){console.warn(`Can't get cell at row=${p}, col=${v}`);continue}this._nextCell(T,s,p,v),s=T}}this._rowEnd(p,p===a)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,n,r){}_rowEnd(e,t){}_beforeSerialize(e,t,n){}_afterSerialize(){}_serializeString(e){return""}};function _g(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Qa(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function j3(e,t){if(!e.isUnderline()&&!t.isUnderline())return!0;if(e.getUnderlineStyle()!==t.getUnderlineStyle())return!1;let n=e.isUnderlineColorDefault(),r=t.isUnderlineColorDefault();return n&&r?!0:n!==r?!1:e.getUnderlineColor()===t.getUnderlineColor()&&e.getUnderlineColorMode()===t.getUnderlineColorMode()}function Lg(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&j3(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 n=e;return typeof n.attributesEquals=="function"?n.attributesEquals(t):_g(e,t)&&Qa(e,t)&&Lg(e,t)}var tE=class extends F3{constructor(t,n){super(t),this._terminal=n,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,n,r){this._allRows=new Array(t),this._lastContentCursorRow=n,this._lastCursorRow=n,this._firstRow=n}_rowEnd(t,n){this._nullCellCount>0&&!Qa(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let r="";if(!n){t-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let s=this._buffer.getLine(t),o=this._buffer.getLine(t+1);if(!o.isWrapped)r=`\r
|
|
65
|
-
`,this._lastCursorRow=t+1,this._lastCursorCol=0;else{r="";let a=s.getCell(s.length-1,this._thisRowLastChar),d=s.getCell(s.length-2,this._thisRowLastSecondChar),h=o.getCell(0,this._nextRowFirstChar),p=h.getWidth()>1,g=!1;(h.getChars()&&p?this._nullCellCount<=1:this._nullCellCount<=0)&&((a.getChars()||a.getWidth()===0)&&Qa(a,h)&&(g=!0),p&&(d.getChars()||d.getWidth()===0)&&Qa(a,h)&&Qa(d,h)&&(g=!0)),g||(r="-".repeat(this._nullCellCount+1),r+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(r+="\x1B[A",r+=`\x1B[${s.length-this._nullCellCount}C`,r+=`\x1B[${this._nullCellCount}X`,r+=`\x1B[${s.length-this._nullCellCount}D`,r+="\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++]=r,this._currentRow="",this._nullCellCount=0}_diffStyle(t,n){let r=[];if($3(t,n))return r;let s=!_g(t,n),o=!Qa(t,n),a=!Lg(t,n);if(s||o||a)if(t.isAttributeDefault())n.isAttributeDefault()||r.push(0);else{if(s){let d=t.getFgColor();t.isFgRGB()?r.push(38,2,d>>>16&255,d>>>8&255,d&255):t.isFgPalette()?d>=16?r.push(38,5,d):r.push(d&8?90+(d&7):30+(d&7)):r.push(39)}if(o){let d=t.getBgColor();t.isBgRGB()?r.push(48,2,d>>>16&255,d>>>8&255,d&255):t.isBgPalette()?d>=16?r.push(48,5,d):r.push(d&8?100+(d&7):40+(d&7)):r.push(49)}if(a){if(t.isInverse()!==n.isInverse()&&r.push(t.isInverse()?7:27),t.isBold()!==n.isBold()&&r.push(t.isBold()?1:22),j3(t,n))t.isUnderline()!==n.isUnderline()&&r.push(t.isUnderline()?4:24);else{let d=t.getUnderlineStyle();if(d===0)r.push(24);else if(d===1&&t.isUnderlineColorDefault())r.push(4);else if(r.push("4:"+d),!t.isUnderlineColorDefault()){let h=t.getUnderlineColor();t.isUnderlineColorRGB()?r.push("58:2::"+(h>>>16&255)+":"+(h>>>8&255)+":"+(h&255)):r.push("58:5:"+h)}}t.isOverline()!==n.isOverline()&&r.push(t.isOverline()?53:55),t.isBlink()!==n.isBlink()&&r.push(t.isBlink()?5:25),t.isInvisible()!==n.isInvisible()&&r.push(t.isInvisible()?8:28),t.isItalic()!==n.isItalic()&&r.push(t.isItalic()?3:23),t.isDim()!==n.isDim()&&r.push(t.isDim()?2:22),t.isStrikethrough()!==n.isStrikethrough()&&r.push(t.isStrikethrough()?9:29)}}return r}_nextCell(t,n,r,s){if(t.getWidth()===0)return;let o=t.getChars()==="",a=this._diffStyle(t,this._cursorStyle);if(o?!Qa(this._cursorStyle,t):a.length>0){this._nullCellCount>0&&(Qa(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=s,this._currentRow+=`\x1B[${a.join(";")}m`;let d=this._buffer.getLine(r);d!==void 0&&(d.getCell(s,this._cursorStyle),this._cursorStyleRow=r,this._cursorStyleCol=s)}o?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(Qa(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=r,this._lastContentCursorCol=this._lastCursorCol=s+t.getWidth())}_serializeString(t){let n=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(n=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let r="";for(let a=0;a<n;a++)r+=this._allRows[a],a+1<n&&(r+=this._allRowSeparators[a]);if(!t){let a=this._buffer.baseY+this._buffer.cursorY,d=this._buffer.cursorX,h=a!==this._lastCursorRow||d!==this._lastCursorCol,p=g=>{g>0?r+=`\x1B[${g}C`:g<0&&(r+=`\x1B[${-g}D`)};h&&((g=>{g>0?r+=`\x1B[${g}B`:g<0&&(r+=`\x1B[${-g}A`)})(a-this._lastCursorRow),p(d-this._lastCursorCol))}let s=this._terminal._core._inputHandler._curAttrData,o=this._diffStyle(s,this._cursorStyle);return o.length>0&&(r+=`\x1B[${o.join(";")}m`),r}},nE=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,n,r){let s=n.length,o=r===void 0?s:s5(r+t.rows,0,s);return this._serializeBufferByRange(t,n,{start:s-o,end:s-1},!1)}_serializeBufferByRange(t,n,r,s){return new tE(n,t).serialize({start:{x:0,y:typeof r.start=="number"?r.start:r.start.line},end:{x:t.cols,y:typeof r.end=="number"?r.end:r.end.line}},s)}_serializeBufferAsHTML(t,n){let r=t.buffer.active,s=new rE(r,t,n),o=n.onlySelection??!1,a=n.range;if(a)return s.serialize({start:{x:a.startCol,y:(a.startLine,a.startLine)},end:{x:t.cols,y:(a.endLine,a.endLine)}});if(!o){let h=r.length,p=n.scrollback,g=p===void 0?h:s5(p+t.rows,0,h);return s.serialize({start:{x:0,y:h-g},end:{x:t.cols,y:h-1}})}let d=this._terminal?.getSelectionPosition();return d!==void 0?s.serialize({start:{x:d.start.x,y:d.start.y},end:{x:d.end.x,y:d.end.y}}):""}_serializeScrollRegion(t){let n=t._core.buffer,r=n.scrollTop,s=n.scrollBottom;return r!==0||s!==t.rows-1?`\x1B[${r+1};${s+1}r`:""}_serializeModes(t){let n="",r=t.modes;if(r.applicationCursorKeysMode&&(n+="\x1B[?1h"),r.applicationKeypadMode&&(n+="\x1B[?66h"),r.bracketedPasteMode&&(n+="\x1B[?2004h"),r.insertMode&&(n+="\x1B[4h"),r.originMode&&(n+="\x1B[?6h"),r.reverseWraparoundMode&&(n+="\x1B[?45h"),r.sendFocusMode&&(n+="\x1B[?1004h"),r.wraparoundMode===!1&&(n+="\x1B[?7l"),r.mouseTrackingMode!=="none")switch(r.mouseTrackingMode){case"x10":n+="\x1B[?9h";break;case"vt200":n+="\x1B[?1000h";break;case"drag":n+="\x1B[?1002h";break;case"any":n+="\x1B[?1003h";break}return r.showCursor||(n+="\x1B[?25l"),n}serialize(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let n=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 r=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);n+=`\x1B[?1049h\x1B[H${r}`}return t?.excludeModes||(n+=this._serializeModes(this._terminal),n+=this._serializeScrollRegion(this._terminal)),n}serializeAsHTML(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,t??{})}dispose(){}},rE=class extends F3{constructor(t,n,r){super(t),this._terminal=n,this._options=r,this._currentRow="",this._htmlContent="",n._core._themeService?this._ansiColors=n._core._themeService.colors.ansi:this._ansiColors=Jk}_beforeSerialize(t,n,r){this._htmlContent+="<html><body><!--StartFragment--><pre>";let s="#000000",o="#ffffff";(this._options.includeGlobalBackground??!1)&&(s=this._terminal.options.theme?.foreground??"#ffffff",o=this._terminal.options.theme?.background??"#000000");let a=[];a.push("color: "+s+";"),a.push("background-color: "+o+";"),a.push("font-family: "+this._terminal.options.fontFamily+";"),a.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+a.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(t,n){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(t,n){let r=n?t.getFgColor():t.getBgColor();if(n?t.isFgRGB():t.isBgRGB())return"#"+[r>>16&255,r>>8&255,r&255].map(s=>s.toString(16).padStart(2,"0")).join("");if(n?t.isFgPalette():t.isBgPalette())return this._ansiColors[r].css}_getUnderlineColor(t){if(t.isUnderlineColorDefault())return;let n=t.getUnderlineColor();return t.isUnderlineColorRGB()?"#"+[n>>16&255,n>>8&255,n&255].map(r=>r.toString(16).padStart(2,"0")).join(""):this._ansiColors[n].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,n){let r=[];if($3(t,n))return;let s=!_g(t,n),o=!Qa(t,n),a=!Lg(t,n);if(s||o||a){let d=this._getHexColor(t,!0);d&&r.push("color: "+d+";");let h=this._getHexColor(t,!1);h&&r.push("background-color: "+h+";"),t.isInverse()&&r.push("color: #000000; background-color: #BFBFBF;"),t.isBold()&&r.push("font-weight: bold;");let p=[];if(t.isUnderline()&&p.push(this._getUnderlineStyle(t)),t.isOverline()&&p.push("overline"),t.isStrikethrough()&&p.push("line-through"),t.isBlink()&&p.push("blink"),p.length>0&&r.push("text-decoration: "+p.join(" ")+";"),t.isUnderline()){let g=this._getUnderlineColor(t);g&&r.push("text-decoration-color: "+g+";")}return t.isInvisible()&&r.push("visibility: hidden;"),t.isItalic()&&r.push("font-style: italic;"),t.isDim()&&r.push("opacity: 0.5;"),r}}_nextCell(t,n,r,s){if(t.getWidth()===0)return;let o=t.getChars()==="",a=this._diffStyle(t,n);a&&(this._currentRow+=a.length===0?"</span><span>":"</span><span style='"+a.join(" ")+"'>"),o?this._currentRow+=" ":this._currentRow+=eE(t.getChars())}_serializeString(){return this._htmlContent}};var sE=class{constructor(e=new iE,t=new U3){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 n=this._base64.encodeText(t);this._terminal?.input(`\x1B]52;${e};${n}\x07`,!1)}_setOrReportClipboard(e){let t=e.split(";");if(t.length<2)return!0;let n=t[0],r=t[1];if(r==="?"){let a=this._provider.readText(n);return a instanceof Promise?a.then(d=>(this._readText(n,d),!0)):(this._readText(n,a),!0)}let s="";try{s=this._base64.decodeText(r)}catch{}let o=this._provider.writeText(n,s);return o instanceof Promise?o.then(()=>!0):!0}},U3=class{readText(e){return navigator.clipboard.readText()}writeText(e,t){return navigator.clipboard.writeText(t)}},iE=class{encodeText(t){let n=new TextEncoder().encode(t);if(n.toBase64!==void 0)return n.toBase64();let r="";for(let s=0;s<n.length;s++)r+=String.fromCharCode(n[s]);return btoa(r)}decodeText(t){if(Uint8Array.fromBase64!==void 0){try{return new TextDecoder().decode(Uint8Array.fromBase64(t))}catch{}return""}try{let n=atob(t),r=new Uint8Array(n.length);for(let s=0;s<n.length;++s)r[s]=n.charCodeAt(s);return new TextDecoder().decode(r)}catch{}return""}};var oE=Object.create,H3=Object.defineProperty,aE=Object.getOwnPropertyDescriptor,lE=Object.getOwnPropertyNames,cE=Object.getPrototypeOf,uE=Object.prototype.hasOwnProperty,wu=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},dE=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of lE(t))!uE.call(e,s)&&s!==n&&H3(e,s,{get:()=>t[s],enumerable:!(r=aE(t,s))||r.enumerable});return e},Au=(e,t,n)=>(n=e!=null?oE(cE(e)):{},dE(!e||!e.__esModule?H3(n,"default",{value:e,enumerable:!0}):n,e)),kg=wu(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(v){return v&255}e.red=t;function n(v){return v>>>8&255}e.green=n;function r(v){return v>>>16&255}e.blue=r;function s(v){return v>>>24&255}e.alpha=s;function o(v,T,A,L=255){return((L&255)<<24|(A&255)<<16|(T&255)<<8|v&255)>>>0}e.toRGBA8888=o;function a(v){return[v&255,v>>8&255,v>>16&255,v>>>24]}e.fromRGBA8888=a;function d(v,T){let A=t(v),L=n(v),R=r(v),D=Number.MAX_SAFE_INTEGER,B=-1;for(let j=0;j<T.length;++j){let P=A-T[j][0],$=L-T[j][1],z=R-T[j][2],H=P*P+$*$+z*z;if(!H)return j;H<D&&(D=H,B=j)}return B}e.nearestColorIndex=d;function h(v,T,A){return Math.max(v,Math.min(A,T))}function p(v,T,A){return A<0&&(A+=1),A>1&&(A-=1),A*6<1?T+(v-T)*6*A:A*2<1?v:A*3<2?T+(v-T)*(4-A*6):T}function g(v,T,A){if(!A){let D=Math.round(T*255);return o(D,D,D)}let L=T<.5?T*(1+A):T+A-T*A,R=2*T-L;return o(h(0,255,Math.round(p(L,R,v+1/3)*255)),h(0,255,Math.round(p(L,R,v)*255)),h(0,255,Math.round(p(L,R,v-1/3)*255)))}function y(v,T,A){return(4278190080|Math.round(A/100*255)<<16|Math.round(T/100*255)<<8|Math.round(v/100*255))>>>0}e.normalizeRGB=y;function b(v,T,A){return g((v+240%360)/360,T/100,A/100)}e.normalizeHLS=b,e.PALETTE_VT340_COLOR=new Uint32Array([y(0,0,0),y(20,20,80),y(80,13,13),y(20,80,20),y(80,20,80),y(20,80,80),y(80,80,20),y(53,53,53),y(26,26,26),y(33,33,60),y(60,26,26),y(33,60,33),y(60,33,60),y(33,60,60),y(60,60,33),y(80,80,80)]),e.PALETTE_VT340_GREY=new Uint32Array([y(0,0,0),y(13,13,13),y(26,26,26),y(40,40,40),y(6,6,6),y(20,20,20),y(33,33,33),y(46,46,46),y(0,0,0),y(13,13,13),y(26,26,26),y(40,40,40),y(6,6,6),y(20,20,20),y(33,33,33),y(46,46,46)]),e.PALETTE_ANSI_256=(()=>{let v=[o(0,0,0),o(205,0,0),o(0,205,0),o(205,205,0),o(0,0,238),o(205,0,205),o(0,250,205),o(229,229,229),o(127,127,127),o(255,0,0),o(0,255,0),o(255,255,0),o(92,92,255),o(255,0,255),o(0,255,255),o(255,255,255)],T=[0,95,135,175,215,255];for(let A=0;A<6;++A)for(let L=0;L<6;++L)for(let R=0;R<6;++R)v.push(o(T[A],T[L],T[R]));for(let A=8;A<=238;A+=10)v.push(o(A,A,A));return new Uint32Array(v)})(),e.DEFAULT_BACKGROUND=o(0,0,0,255),e.DEFAULT_FOREGROUND=o(255,255,255,255)}),z3=wu(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InWasm=n;var t=r=>{if(Uint8Array.fromBase64)return Uint8Array.fromBase64(r);if(typeof Buffer<"u")return Buffer.from(r,"base64");let s=atob(r),o=new Uint8Array(s.length);for(let a=0;a<o.length;++a)o[a]=s.charCodeAt(a);return o};function n(r){if(r.d){let{t:s,s:o,d:a}=r,d,h,p=WebAssembly;return s===0?o?g=>new p.Instance(h||(h=new p.Module(d||(d=t(a)))),g):g=>h?p.instantiate(h,g):p.instantiate(d||(d=t(a)),g).then(y=>(h=y.module)&&y.instance):s===1?o?()=>h||(h=new p.Module(d||(d=t(a)))):()=>h?Promise.resolve(h):p.compile(d||(d=t(a))).then(g=>h=g):o?()=>d||(d=t(a)):()=>Promise.resolve(d||(d=t(a)))}if(typeof _wasmCtx>"u")throw new Error('must run "inwasm"');_wasmCtx.add(r)}}),G3=wu(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=z3(),n=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABBQFgAAF/Ag8BA2VudgZtZW1vcnkCAAEDAwIAAAcNAgNkZWMAAANlbmQAAQqLBgKZBAEKf0GIKCgCAEGgKGohAUGEKCgCACIDQaAoaiEAQYAoKAIAQQFrQXxxIgRBoChqIQUgBEEQayADSgRAIARBkChqIQMDQCABIABBA2otAABBAnQoAoAgIABBAmotAABBAnQoAoAYIABBAWotAABBAnQoAoAQIAAtAABBAnQoAoAIcnJyIgY2AgAgAUEDaiAAQQdqLQAAQQJ0KAKAICAAQQZqLQAAQQJ0KAKAGCAAQQVqLQAAQQJ0KAKAECAAQQRqLQAAQQJ0KAKACHJyciIHNgIAIAFBBmogAEELai0AAEECdCgCgCAgAEEKai0AAEECdCgCgBggAEEJai0AAEECdCgCgBAgAEEIai0AAEECdCgCgAhycnIiCDYCACABQQlqIABBD2otAABBAnQoAoAgIABBDmotAABBAnQoAoAYIABBDWotAABBAnQoAoAQIABBDGotAABBAnQoAoAIcnJyIgk2AgAgAiAGciAHciAIciAJciECIAFBDGohASAAQRBqIgAgA0kNAAsLIAAgBUkEQANAIAEgAEEDai0AAEECdCgCgCAgAEECai0AAEECdCgCgBggAEEBai0AAEECdCgCgBAgAC0AAEECdCgCgAhycnIiAzYCACACIANyIQIgAUEDaiEBIABBBGoiACAFSQ0ACwtBfyEAIAJB////B00Ef0GEKCAENgIAQYgoIAFBoChrNgIAQQAFQX8LC+0BAQR/AkBBgCgoAgAiAUGEKCgCACIAa0EFTgRAQX8hAxAADQFBgCgoAgAhAUGEKCgCACEAC0F/IQMgASAAayIBQQJIDQAgAC0AoShBAnQoAoAQIAAtAKAoQQJ0KAKACHIhAgJ/IAFBBEYEQEEDQQQgAC0AoyhBPUYbIAAtAKIoQT1GayEBC0EBIAFBA0kNABogAC0AoihBAnQoAoAYIAJyIQJBAiABQQRHDQAaIAAtAKMoQQJ0KAKAICACciECQQMLIQEgAkH///8HSw0AQQAhA0GIKCgCACIAIAI2AKAoQYgoIAAgAWo2AgALIAML"}),r=new Uint8Array("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").map(d=>d.charCodeAt(0))),s=new Uint32Array(1024);s.fill(4278190080);for(let d=0;d<r.length;++d)s[r[d]]=d<<2;for(let d=0;d<r.length;++d)s[256+r[d]]=d>>4|(d<<4&255)<<8;for(let d=0;d<r.length;++d)s[512+r[d]]=d>>2<<8|(d<<6&255)<<16;for(let d=0;d<r.length;++d)s[768+r[d]]=d<<16;var o=new Uint8Array(0),a=class{constructor(d,h,p){if(this._inst=null,this._ended=!0,this._bytes=0,this.keepSize=d??1048576,this.maxBytes=h??4294901760,this._bytes=p??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]):o}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(d,h){if(this.maxBytes=d??this.maxBytes,this._bytes=h??Math.min(this._bytes,this.maxBytes),this._bytes>this.maxBytes||this.maxBytes>4294901760)throw Error("invalid byte settings");let p=this._m32,g=this._bytes+5152;this._inst?this._mem.buffer.byteLength<g&&(this._mem.grow(Math.ceil((g-this._mem.buffer.byteLength)/65536)),p=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)):(this._mem=new WebAssembly.Memory({initial:Math.ceil(g/65536)}),this._inst=n({env:{memory:this._mem}}),p=new Uint32Array(this._mem.buffer,0),p.set(s,256),this._d=new Uint8Array(this._mem.buffer,5152)),p[1280]=0,p[1281]=0,p[1282]=0,this._m32=p,this._ended=!1}_realloc(d){let h=this._m32[1280]+d;if(this._bytes<h){if(h>this.maxBytes)return-3;let p=this._bytes;for(;(p*=2)<h;);if(p=Math.min(p,this.maxBytes),p<h)return-3;if(p+5152>this._mem.buffer.byteLength){let g=Math.ceil((p+5152-this._mem.buffer.byteLength)/65536);this._mem.grow(g),this._m32=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)}this._bytes=p}return 0}put(d){if(!this._inst||this._ended)return-2;if(this._realloc(d.length))return-3;let h=this._m32;return this._d.set(d,h[1280]),h[1280]+=d.length,h[1280]-h[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=a}),hE=wu(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=z3(),n=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABCgJgAABgA39/fwACDwEDZW52Bm1lbW9yeQIAAQMDAgABBwcBA2RlYwABCAEACu4EAgwAQQBBAEGAAvwLAAveBAEJf0EAQQBBgAL8CwAgAUEXTgRAIAAgAWpBCGshCkGACCEBIAJBAnRBgAhqIQsgAEEOaiEDQf8BIQZBACECA0AgA0EBaiEHIAMtAAAiCEE/cSEAAkACQCAIQcABcSIJRQRAIABBAnQiAC0AAyEGIAAtAAIhBCAALQABIQUgAC0AACECIAchAwwBCwJAIAhB/QFLDQAgCUHAAUcNACAFQQVsIAJBA2xqIARBB2xqIAZBC2xqQT9xQQJ0IgMgBDoAAiADIAU6AAEgAyACOgAAIANBA2ogBjoAAANAIAEgAjoAACABQQNqIAY6AAAgAUECaiAEOgAAIAFBAWogBToAACABQQRqIQEgAEUEQCAHIQMMBAsgAEEBayEAIAEgC0kNAAsgByEDDAILAn8CQAJAAkAgCEH+AWsOAgABAgsgAy0AAyEEIAMtAAIhBSADLQABIQIgA0EEagwCCyADKAIBIgJBGHYhBiACQRB2IQQgAkEIdiEFIANBBWoMAQsgCUGAAUcEQCAHIAlBwABHDQEaIAQgCEEDcWpBAmshBCACIABBBHZqQQJrIQIgBSAIQQJ2QQNxakECayEFIAcMAQsgBCAAQShrIgkgAy0AASIHQQ9xamohBCACIAdBBHYgCWpqIQIgACAFakEgayEFIANBAmoLIQMgBUEFbCACQQNsaiAEQQdsaiAGQQtsakE/cUECdCIAIAQ6AAIgACAFOgABIAAgAjoAACAAQQNqIAY6AAALIAEgBjoAAyABIAQ6AAIgASAFOgABIAEgAjoAACABQQRqIQELIAMgCkkNAAsLCw=="}),r=class{constructor(s){this.keepSize=s,this.width=0,this.height=0}decode(s){this.width=s[4]<<24|s[5]<<16|s[6]<<8|s[7],this.height=s[8]<<24|s[9]<<16|s[10]<<8|s[11];let o=this.width*this.height,a=o*4,d=s.length,h=Math.max(a,d)+(Math.min(a,d)>>1)+4096;this._inst?this._mem.buffer.byteLength<h&&(this._mem.grow(Math.ceil((h-this._mem.buffer.byteLength)/65536)),this._d=null):(this._mem=new WebAssembly.Memory({initial:Math.ceil(h/65536)}),this._inst=n({env:{memory:this._mem}})),this._d||(this._d=new Uint8Array(this._mem.buffer));let p=this._mem.buffer.byteLength-d&-256;return this._d.set(s,p),this._inst.exports.dec(p,d,o),this._d.subarray(1024,1024+a)}release(){this._inst&&this._mem.buffer.byteLength>this.keepSize&&(this._inst=this._d=this._mem=null)}};e.default=r}),fE=wu(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"}}),pE=wu(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAsync=e.decode=e.Decoder=e.DecoderAsync=void 0;var t=kg(),n=fE();function r(v){if(typeof Buffer<"u")return Buffer.from(v,"base64");let T=atob(v),A=new Uint8Array(T.length);for(let L=0;L<A.length;++L)A[L]=T.charCodeAt(L);return A}var s=r(n.LIMITS.BYTES),o,a=new Uint32Array,d=class{constructor(){this.bandHandler=v=>1,this.modeHandler=v=>1}handle_band(v){return this.bandHandler(v)}mode_parsed(v){return this.modeHandler(v)}},h={memoryLimit:2048*65536,sixelColor:t.DEFAULT_FOREGROUND,fillColor:t.DEFAULT_BACKGROUND,palette:t.PALETTE_VT340_COLOR,paletteLimit:n.LIMITS.PALETTE_SIZE,truncate:!0};function p(v){let T=new d,A={env:{handle_band:T.handle_band.bind(T),mode_parsed:T.mode_parsed.bind(T)}};return WebAssembly.instantiate(o||s,A).then(L=>(o=o||L.module,new g(v,L.instance||L,T)))}e.DecoderAsync=p;var g=class{constructor(v,T,A){if(this._PIXEL_OFFSET=n.LIMITS.MAX_WIDTH+4,this._canvas=a,this._bandWidths=[],this._maxWidth=0,this._minWidth=n.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0,this._opts=Object.assign({},h,v),this._opts.paletteLimit>n.LIMITS.PALETTE_SIZE)throw new Error(`DecoderOptions.paletteLimit must not exceed ${n.LIMITS.PALETTE_SIZE}`);if(T)A.bandHandler=this._handle_band.bind(this),A.modeHandler=this._initCanvas.bind(this);else{let L=o||(o=new WebAssembly.Module(s));T=new WebAssembly.Instance(L,{env:{handle_band:this._handle_band.bind(this),mode_parsed:this._initCanvas.bind(this)}})}this._instance=T,this._wasm=this._instance.exports,this._chunk=new Uint8Array(this._wasm.memory.buffer,this._wasm.get_chunk_address(),n.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(),n.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(v){if(v===2){let T=this.width*this.height;if(T>this._canvas.length){if(this._opts.memoryLimit&&T*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(T)}this._maxWidth=this._width}else if(v===1)if(this._level===2){let T=Math.min(this._rasterWidth,n.LIMITS.MAX_WIDTH)*this._rasterHeight;if(T>this._canvas.length){if(this._opts.memoryLimit&&T*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(T)}}else this._canvas.length<65536&&(this._canvas=new Uint32Array(65536));return 0}_realloc(v,T){let A=v+T;if(A>this._canvas.length){if(this._opts.memoryLimit&&A*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");let L=new Uint32Array(Math.ceil(A/65536)*65536);L.set(this._canvas),this._canvas=L}}_handle_band(v){let T=this._PIXEL_OFFSET,A=this._lastOffset;if(this._mode===2){let L=this.height-this._currentHeight,R=0;for(;R<6&&L>0;)this._canvas.set(this._pSrc.subarray(T*R,T*R+v),A+v*R),R++,L--;this._lastOffset+=v*R,this._currentHeight+=R}else if(this._mode===1){this._realloc(A,v*6),this._maxWidth=Math.max(this._maxWidth,v),this._minWidth=Math.min(this._minWidth,v);for(let L=0;L<6;++L)this._canvas.set(this._pSrc.subarray(T*L,T*L+v),A+v*L);this._bandWidths.push(v),this._lastOffset+=v*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(v=this._opts.fillColor,T=this._opts.palette,A=this._opts.paletteLimit,L=this._opts.truncate){this._wasm.init(this._opts.sixelColor,v,A,L?1:0),T&&this._palette.set(T.subarray(0,n.LIMITS.PALETTE_SIZE)),this._bandWidths.length=0,this._maxWidth=0,this._minWidth=n.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0}decode(v,T=0,A=v.length){let L=T;for(;L<A;){let R=Math.min(A-L,n.LIMITS.CHUNK_SIZE);this._chunk.set(v.subarray(L,L+=R)),this._wasm.decode(0,R)}}decodeString(v,T=0,A=v.length){let L=T;for(;L<A;){let R=Math.min(A-L,n.LIMITS.CHUNK_SIZE);for(let D=0,B=L;D<R;++D,++B)this._chunk[D]=v.charCodeAt(B);L+=R,this._wasm.decode(0,R)}}get data32(){if(this._mode===0||!this.width||!this.height)return a;let v=this._wasm.current_width();if(this._mode===2){let T=this.height-this._currentHeight;if(T>0){let A=this._PIXEL_OFFSET,L=this._lastOffset,R=0;for(;R<6&&T>0;)this._canvas.set(this._pSrc.subarray(A*R,A*R+v),L+v*R),R++,T--;T&&this._canvas.fill(this._fillColor,L+v*R)}return this._canvas.subarray(0,this.width*this.height)}if(this._mode===1){if(this._minWidth===this._maxWidth){let R=!1;if(v)if(v!==this._minWidth)R=!0;else{let D=this._PIXEL_OFFSET,B=this._lastOffset;this._realloc(B,v*6);for(let j=0;j<6;++j)this._canvas.set(this._pSrc.subarray(D*j,D*j+v),B+v*j)}if(!R)return this._canvas.subarray(0,this.width*this.height)}let T=new Uint32Array(this.width*this.height);T.fill(this._fillColor);let A=0,L=0;for(let R=0;R<this._bandWidths.length;++R){let D=this._bandWidths[R];for(let B=0;B<6;++B)T.set(this._canvas.subarray(L,L+=D),A),A+=this.width}if(v){let R=this._PIXEL_OFFSET,D=this._wasm.current_height();for(let B=0;B<D;++B)T.set(this._pSrc.subarray(R*B,R*B+v),A+this.width*B)}return T}return a}get data8(){return new Uint8ClampedArray(this.data32.buffer,0,this.width*this.height*4)}release(){this._canvas=a,this._bandWidths.length=0,this._maxWidth=0,this._minWidth=n.LIMITS.MAX_WIDTH,this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}};e.Decoder=g;function y(v,T){let A=new g(T);return A.init(),typeof v=="string"?A.decodeString(v):A.decode(v),{width:A.width,height:A.height,data32:A.data32,data8:A.data8}}e.decode=y;async function b(v,T){let A=await p(T);return A.init(),typeof v=="string"?A.decodeString(v):A.decode(v),{width:A.width,height:A.height,data32:A.data32,data8:A.data8}}e.decodeAsync=b});function wm(e){return{dispose:e}}var W3=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()}},V3=class{constructor(){this._store=new W3}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};V3.None=Object.freeze({dispose(){}});var mE=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}},gE=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,n)=>{if(this._disposed)return wm(()=>{});let r={fn:e,thisArgs:t};this._listeners.push(r);let s=wm(()=>{let o=this._listeners.indexOf(r);o!==-1&&this._listeners.splice(o,1)});return n&&(Array.isArray(n)?n.push(s):n.add(s)),s},this._event)}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:n}=this._listeners[0];t.call(n,e);return}default:{let t=this._listeners.slice();for(let{fn:n,thisArgs:r}of t)n.call(r,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},xE;(e=>{function t(o,a){return o(d=>a.fire(d))}e.forward=t;function n(o,a){return(d,h,p)=>o(g=>d.call(h,a(g)),void 0,p)}e.map=n;function r(...o){return(a,d,h)=>{let p=new W3;for(let g of o)p.add(g(y=>a.call(d,y)));return h&&(Array.isArray(h)?h.push(p):h.add(p)),p}}e.any=r;function s(o,a,d){return a(d),o(h=>a(h))}e.runAndSubscribe=s})(xE||={});var i5=Au(kg()),mu=class Ml extends V3{constructor(t){super(),this._terminal=t,this._layers=new Map,this._optionsRefresh=this._register(new mE),this._oldOpen=this._terminal._core.open,this._terminal._core.open=n=>{this._oldOpen?.call(this._terminal._core,n),this._open()},this._terminal._core.screenElement&&this._open(),this._optionsRefresh.value=this._terminal._core.optionsService.onOptionChange(n=>{n==="fontSize"&&(this.rescaleCanvas(),this._renderService?.refreshRows(0,this._terminal.rows))}),this._register(wm(()=>{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,n,r){let s=(t??document).createElement("canvas");return s.width=n|0,s.height=r|0,s}static createImageData(t,n,r,s){if(typeof ImageData!="function"){let o=t.createImageData(n,r);return s&&o.data.set(new Uint8ClampedArray(s,0,n*r*4)),o}return s?new ImageData(new Uint8ClampedArray(s,0,n*r*4),n,r):new ImageData(n,r)}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,n,r){let s=t*(this.dimensions?.css.cell.height||0),o=this.dimensions?.css.canvas.width||0,a=(n+1-t)*(this.dimensions?.css.cell.height||0);(!r||r==="top")&&this._layers.get("top")?.clearRect(0,s,o,a),(!r||r==="bottom")&&this._layers.get("bottom")?.clearRect(0,s,o,a)}clearAll(t){if(!t||t==="top"){let n=this._layers.get("top");n?.clearRect(0,0,n.canvas.width,n.canvas.height)}if(!t||t==="bottom"){let n=this._layers.get("bottom");n?.clearRect(0,0,n.canvas.width,n.canvas.height)}}draw(t,n,r,s,o=1){let a=this._layers.get(t.layer);if(!a)return;let{width:d,height:h}=this.cellSize;if(d===-1||h===-1)return;this._rescaleImage(t,d,h);let p=t.actual,g=Math.ceil(p.width/d),y=n%g*d,b=Math.floor(n/g)*h,v=r*d,T=s*h,A=o*d+y>p.width?p.width-y:o*d,L=b+h>p.height?p.height-b:h;a.drawImage(p,Math.floor(y),Math.floor(b),Math.ceil(A),Math.ceil(L),Math.floor(v),Math.floor(T),Math.ceil(A),Math.ceil(L))}extractTile(t,n){let{width:r,height:s}=this.cellSize;if(r===-1||s===-1)return;this._rescaleImage(t,r,s);let o=t.actual,a=Math.ceil(o.width/r),d=n%a*r,h=Math.floor(n/a)*s,p=r+d>o.width?o.width-d:r,g=h+s>o.height?o.height-h:s,y=Ml.createCanvas(this.document,p,g),b=y.getContext("2d");if(b)return b.drawImage(o,Math.floor(d),Math.floor(h),Math.floor(p),Math.floor(g),0,0,Math.floor(p),Math.floor(g)),y}drawPlaceholder(t,n,r=1){let s=this._layers.get("top");if(s){let{width:o,height:a}=this.cellSize;if(o===-1||a===-1||(this._placeholder?a>=this._placeholder.height&&this._createPlaceHolder(a+1):this._createPlaceHolder(Math.max(a+1,24)),!this._placeholder))return;s.drawImage(this._placeholderBitmap??this._placeholder,t*o,n*a%2?0:1,o*r,a,t*o,n*a,o*r,a)}}rescaleCanvas(){let t=this.dimensions?.css.canvas.width||0,n=this.dimensions?.css.canvas.height||0;for(let r of this._layers.values())(r.canvas.width!==t||r.canvas.height!==n)&&(r.canvas.width=t,r.canvas.height=n)}_rescaleImage(t,n,r){if(n===t.actualCellSize.width&&r===t.actualCellSize.height)return;let{width:s,height:o}=t.origCellSize;if(n===s&&r===o){t.actual=t.orig,t.actualCellSize.width=s,t.actualCellSize.height=o;return}let a=Ml.createCanvas(this.document,Math.ceil(t.orig.width*n/s),Math.ceil(t.orig.height*r/o)),d=a.getContext("2d");d&&(d.drawImage(t.orig,0,0,a.width,a.height),t.actual=a,t.actualCellSize.width=n,t.actualCellSize.height=r)}_open(){this._renderService=this._terminal._core._renderService,this._oldSetRenderer=this._renderService.setRenderer.bind(this._renderService),this._renderService.setRenderer=t=>{for(let n of[...this._layers.keys()])this.removeLayerFromDom(n);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 n=Ml.createCanvas(this.document,this.dimensions?.css.canvas.width||0,this.dimensions?.css.canvas.height||0);n.classList.add(`xterm-image-layer-${t}`);let r=this._terminal._core.screenElement;r.style.isolation="isolate",t==="bottom"?(n.style.zIndex="-1",r.insertBefore(n,r.firstChild)):(n.style.zIndex="0",r.appendChild(n));let s=n.getContext("2d",{alpha:!0});if(!s){n.remove();return}this._layers.set(t,s),this.clearAll(t)}removeLayerFromDom(t="top"){let n=this._layers.get(t);n&&(n.canvas.remove(),this._layers.delete(t))}hasLayer(t){return this._layers.has(t)}_createPlaceHolder(t=24){this._placeholderBitmap?.close(),this._placeholderBitmap=void 0;let n=32,r=Ml.createCanvas(this.document,n,t),s=r.getContext("2d",{alpha:!1});if(!s)return;let o=Ml.createImageData(s,n,t),a=new Uint32Array(o.data.buffer),d=(0,i5.toRGBA8888)(0,0,0),h=(0,i5.toRGBA8888)(255,255,255);a.fill(d);for(let y=0;y<t;++y){let b=y%2,v=y*n;for(let T=0;T<n;T+=2)a[v+T+b]=h}s.putImageData(o,0,0);let p=screen.width+n-1&-32||4096;this._placeholder=Ml.createCanvas(this.document,p,t);let g=this._placeholder.getContext("2d",{alpha:!1});if(!g){this._placeholder=void 0;return}for(let y=0;y<p;y+=n)g.drawImage(r,y,0);Ml.createImageBitmap(this._placeholder).then(y=>this._placeholderBitmap=y)}get document(){return this._terminal._core._coreBrowserService?.window.document}},ol={width:7,height:14},Am=class q3{constructor(t=0,n=0,r=-1,s=-1){this.imageId=r,this.tileId=s,this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}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 q3(this._ext,this._urlId,this.imageId,this.tileId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0&&this.imageId===-1}},bd=new Am,yE=class{constructor(e,t,n){this._terminal=e,this._renderer=t,this._opts=n,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(r){r instanceof Error&&console.error(r.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,n]of this._images.entries())n.bufferType==="alternate"&&(n.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 n=this._renderer.cellSize;(n.width===-1||n.height===-1)&&(n=ol);let r=Math.ceil(e.width/n.width),s=Math.ceil(e.height/n.height),o=++this._lastId,a=this._terminal._core.buffer,d=this._terminal.cols,h=this._terminal.rows,p=a.x,g=a.y,y=p,b=0;t.scrolling||(a.x=0,a.y=0,y=0),this._terminal._core._inputHandler._dirtyRowTracker.markDirty(a.y);for(let L=0;L<s;++L){let R=a.lines.get(a.y+a.ybase);for(let D=0;D<r&&!(y+D>=d);++D)this._writeToCell(R,y+D,o,L*r+D),b++;if(t.scrolling)L<s-1&&this._terminal._core._inputHandler.lineFeed();else if(++a.y>=h)break;a.x=y}this._terminal._core._inputHandler._dirtyRowTracker.markDirty(a.y),t.scrolling?t.cursorPos==="iip"?a.x=Math.min(y+r,d):a.x=y:(a.x=p,a.y=g);let v=[];for(let[L,R]of this._images.entries())R.tileCount<1&&(R.marker?.dispose(),v.push(L));for(let L of v)this._delImg(L);let T=this._terminal.registerMarker(0);T?.onDispose(()=>{this._images.get(o)&&this._delImg(o)}),this._terminal.buffer.active.type==="alternate"&&this._evictOnAlternate();let A={orig:e,origCellSize:n,actual:e,actualCellSize:{...n},marker:T||void 0,tileCount:b,bufferType:this._terminal.buffer.active.type,layer:t.layer,zIndex:t.zIndex};return this._images.set(o,A),this.onImageAdded?.(),o}render(e){let t=!1,n=!1;for(let p of this._images.values())if(p.layer==="bottom"?n=!0:t=!0,t&&n)break;if(t&&!this._renderer.hasLayer("top")&&(this._renderer.insertLayerToDom("top"),!this._renderer.hasLayer("top")))return;if(n&&!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")),!n&&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:r,end:s}=e,o=this._terminal._core.buffer,a=this._terminal._core.cols;this._renderer.clearLines(r,s);let d=[],h=[];for(let p=r;p<=s;++p){let g=o.lines.get(p+o.ydisp);if(!g)return;for(let y=0;y<a;++y){let b;if(g.getBg(y)&268435456)b=g._extendedAttrs[y]??bd;else{let A=g._extendedAttrs[y];if(!A||A.imageId===void 0||A.imageId===-1)continue;b=A}let v=b.imageId;if(v===void 0||v===-1)continue;let T=this._images.get(v);if(b.tileId!==-1){let A=b.tileId,L=y,R=1;for(;++y<a;){let D=g._extendedAttrs[y];if(!D||D.imageId!==v||D.tileId!==A+R)break;R++}y--,T?T.actual&&d.push({imgSpec:T,tileId:A,col:L,row:p,count:R}):this._opts.showPlaceholder&&h.push({col:L,row:p,count:R}),this._fullyCleared=!1}}}d.sort((p,g)=>p.imgSpec.zIndex-g.imgSpec.zIndex);for(let p of h)this._renderer.drawPlaceholder(p.col,p.row,p.count);for(let p of d)this._renderer.draw(p.imgSpec,p.tileId,p.col,p.row,p.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,n=t.lines.length,r=this._viewportMetrics.cols-1;for(let s=0;s<n;++s){let o=t.lines.get(s);if(o.getBg(r)&268435456){let a=o._extendedAttrs[r]??bd,d=a.imageId;if(d===void 0||d===-1)continue;let h=this._images.get(d);if(!h)continue;let p=Math.ceil((h.actual?.width||0)/h.actualCellSize.width);if(a.tileId%p+1>=p)continue;let g=!1;for(let v=r+1;v>e.cols;++v)if(o._data[v*3+0]&4194303){g=!0;break}if(g)continue;let y=Math.min(e.cols,p-a.tileId%p+r),b=a.tileId;for(let v=r+1;v<y;++v)this._writeToCell(o,v,d,++b),h.tileCount++}}this._viewportMetrics=e}getImageAtBufferCell(e,t){let n=this._terminal._core.buffer.lines.get(t);if(n&&n.getBg(e)&268435456){let r=n._extendedAttrs[e]??bd;if(r.imageId&&r.imageId!==-1){let s=this._images.get(r.imageId)?.orig;if(window.ImageBitmap&&s instanceof ImageBitmap){let o=mu.createCanvas(window.document,s.width,s.height);return o.getContext("2d")?.drawImage(s,0,0,s.width,s.height),o}return s}}}extractTileAtBufferCell(e,t){let n=this._terminal._core.buffer.lines.get(t);if(n&&n.getBg(e)&268435456){let r=n._extendedAttrs[e]??bd;if(r.imageId&&r.imageId!==-1&&r.tileId!==-1){let s=this._images.get(r.imageId);if(s)return this._renderer.extractTile(s,r.tileId)}}}_evictOldest(e){let t=this._getStoredPixels(),n=t;for(;this._pixelLimit<n+e&&this._images.size;){let r=this._images.get(++this._lowestId);r&&r.orig&&(n-=r.orig.width*r.orig.height,r.actual&&r.orig!==r.actual&&(n-=r.actual.width*r.actual.height),r.marker?.dispose(),this._delImg(this._lowestId))}return t-n}_writeToCell(e,t,n,r){if(e._data[t*3+2]&268435456){let s=e._extendedAttrs[t];if(s){if(s.imageId!==void 0){let o=this._images.get(s.imageId);o&&o.tileCount--,s.imageId=n,s.tileId=r;return}e._extendedAttrs[t]=new Am(s.ext,s.urlId,n,r);return}}e._data[t*3+2]|=268435456,e._extendedAttrs[t]=new Am(0,0,n,r)}_evictOnAlternate(){for(let n of this._images.values())n.bufferType==="alternate"&&(n.tileCount=0);let e=this._terminal._core.buffer;for(let n=0;n<this._terminal.rows;++n){let r=e.lines.get(n);if(r){for(let s=0;s<this._terminal.cols;++s)if(r._data[s*3+2]&268435456){let o=r._extendedAttrs[s]?.imageId;if(o){let a=this._images.get(o);a&&a.tileCount++}}}}let t=[];for(let[n,r]of this._images.entries())r.bufferType==="alternate"&&!r.tileCount&&(r.marker?.dispose(),t.push(n));for(let n of t)this._delImg(n)}},bE=Au(G3()),vE=Au(hE());function ph(e){let t="";for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}function Jf(e){let t=0;for(let n=0;n<e.length;++n){if(e[n]<48||e[n]>57)throw new Error("illegal char");t=t*10+e[n]-48}return t}function o5(e){let t=ph(e);if(!t.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/))throw new Error("illegal size");return t}function wE(e){if(typeof Buffer<"u")return Buffer.from(ph(e),"base64").toString();let t=atob(ph(e)),n=new Uint8Array(t.length);for(let r=0;r<n.length;++r)n[r]=t.charCodeAt(r);return new TextDecoder().decode(n)}var a5={inline:Jf,size:Jf,name:wE,width:o5,height:o5,preserveAspectRatio:Jf},l5=[70,105,108,101],c5=[77,117,108,116,105,112,97,114,116,70,105,108,101],ep=[70,105,108,101,80,97,114,116],tp=[70,105,108,101,69,110,100],np=[82,101,112,111,114,116,67,101,108,108,83,105,122,101],rp=1024,AE=class{constructor(){this.state=0,this._buffer=new Uint32Array(rp),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===tp.length){for(let t=0;t<tp.length;++t)if(this._buffer[t]!==tp[t])return this._a();return this.fields.type=4,this.state=4,0}if(this._position===np.length){for(let t=0;t<np.length;++t)if(this._buffer[t]!==np[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,n,r){let s=this.state,o=this._position,a=this._buffer;if(s===1||s===4||s===0&&o>14)return-1;for(let d=n;d<r;++d){let h=t[d];switch(h){case 59:if(!this._storeValue(o))return this._a();s=2,o=0;break;case 61:if(s===0){if(a[0]===70){let p=0;for(;p<l5.length;++p)if(a[p]!==l5[p])return this._a();if(this.fields.type=1,o===ep.length){for(;p<ep.length;++p)if(a[p]!==ep[p])return this._a();return this.fields.type=3,this.state=4,d+1}}else if(a[0]===77){for(let p=0;p<c5.length;++p)if(a[p]!==c5[p])return this._a();this.fields.type=2}else return this._a();s=2,o=0}else if(s===2){if(!this._storeKey(o))return this._a();s=3,o=0}else if(s===3){if(o>=rp)return this._a();a[o++]=h}break;case 58:return s===3&&!this._storeValue(o)?this._a():(this.state=4,d+1);default:if(o>=rp)return this._a();a[o++]=h}}return this.state=s,this._position=o,-2}_a(){return this.fields.type=0,this.state=1,-1}_storeKey(t){let n=ph(this._buffer.subarray(0,t));return n?(this._key=n,this.fields[n]=null,!0):!1}_storeValue(t){if(this._key){try{let n=this._buffer.slice(0,t);this.fields[this._key]=a5[this._key]?a5[this._key](n):n}catch{return!1}return!0}return!1}},mh={mime:"unsupported",width:0,height:0};function TE(e){if(e.length<24)return mh;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[n,r]=SE(e);return{mime:"image/jpeg",width:n,height:r}}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]}:mh}function SE(e){let t=e.length,n=4,r=e[n]<<8|e[n+1];for(;;){if(n+=r,n>=t)return[0,0];if(e[n]!==255)return[0,0];if(e[n+1]===192||e[n+1]===194)return n+8<t?[e[n+7]<<8|e[n+8],e[n+5]<<8|e[n+6]]:[0,0];n+=2,r=e[n]<<8|e[n+1]}}var sp={type:0,name:"Unnamed file",size:0,width:"auto",height:"auto",preserveAspectRatio:1,inline:0},CE=class{constructor(e,t,n,r){this._opts=e,this._renderer=t,this._storage=n,this._coreTerminal=r,this._aborted=!1,this._hp=new AE,this._header=sp,this._metrics=mh,this._isMultipart=!1,this._abortMulti=!1;let s=Math.ceil(this._opts.iipSizeLimit*4/3),o=Math.min(1048576,s);this._dec=new bE.default(4194304,s,o),this._qoiDec=new vE.default(4194304)}reset(){this._hp.reset(),this._dec.release(),this._qoiDec.release()}start(){this._aborted=!1,this._metrics=mh,this._hp.reset()}put(e,t,n){if(!this._aborted)if(this._hp.state===4)this._dec.put(e.subarray(t,n))!==0&&(this._dec.release(),this._aborted=!0);else{let r=this._hp.parse(e,t,n);if(r===-1){this._aborted=!0;return}if(r>0){if(this._hp.fields.type===1){if(this._isMultipart&&(this._isMultipart=!1,this._abortMulti=!1,this._dec.release()),this._header=Object.assign({},sp,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(r,n))!==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 a=ol.width,d=ol.height;this._renderer.dimensions&&(a=this._renderer.dimensions.css.canvas.width/this._coreTerminal.cols,d=this._renderer.dimensions.css.canvas.height/this._coreTerminal.rows);let h=this._coreTerminal._core._coreBrowserService?.dpr??1,p=`\x1B]1337;ReportCellSize=${d.toFixed(3)};${a.toFixed(3)};${h.toFixed(3)}\x1B\\`;return this._coreTerminal.input(p,!1),!0}if(t===2)return this._header=Object.assign({},sp,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 n=0,r=0,s;if((s=e)&&(s=!this._dec.end())&&(this._metrics=TE(this._dec.data8),(s=this._metrics.mime!=="unsupported")&&(n=this._metrics.width,r=this._metrics.height,(s=n&&r&&n*r<this._opts.pixelLimit)&&([n,r]=this._resize(n,r).map(Math.floor),s=n&&r&&n*r<this._opts.pixelLimit))),!s)return this._dec.release(),!0;let o;if(this._metrics.mime==="image/qoi"){let a=this._qoiDec.decode(this._dec.data8);if(o=new ImageData(new Uint8ClampedArray(a.buffer,a.byteOffset,a.byteLength),this._qoiDec.width,this._qoiDec.height),this._qoiDec.release(),n===this._qoiDec.width&&r===this._qoiDec.height){this._dec.release();let d=mu.createCanvas(void 0,this._qoiDec.width,this._qoiDec.height);return d.getContext("2d")?.putImageData(o,0,0),this._storage.addImage(d),!0}}else o=new Blob([this._dec.data8],{type:this._metrics.mime});return this._dec.release(),createImageBitmap(o,{resizeWidth:n,resizeHeight:r}).then(a=>(this._storage.addImage(a),!0))}_resize(e,t){let n=this._renderer.dimensions?.css.cell.width||ol.width,r=this._renderer.dimensions?.css.cell.height||ol.height,s=this._renderer.dimensions?.css.canvas.width||n*this._coreTerminal.cols,o=this._renderer.dimensions?.css.canvas.height||r*this._coreTerminal.rows,a=this._dim(this._header.width,s,n),d=this._dim(this._header.height,o,r);if(!a&&!d){let h=s/e,p=(o-r)/t,g=Math.min(h,p);return g<1?[e*g,t*g]:[e,t]}return a?this._header.preserveAspectRatio||!a||!d?[a,t*a/e]:[a,d]:[e*d/t,d]}_dim(e,t,n){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)*n}},_E=Au(G3());function u5(e){let t={},n=e.split(",");for(let r of n){let s=r.indexOf("=");if(s===-1)continue;let o=r.substring(0,s),a=r.substring(s+1);if(o==="a"){t.action=a;continue}if(o==="o"){t.compression=a;continue}if(o==="t"){t.transmission=a;continue}if(o==="d"){t.deleteSelector=a;continue}let d=parseInt(a,10);switch(o){case"f":t.format=d;break;case"i":t.id=d;break;case"I":t.imageNumber=d;break;case"s":t.width=d;break;case"v":t.height=d;break;case"x":t.x=d;break;case"y":t.y=d;break;case"w":t.sourceWidth=d;break;case"h":t.sourceHeight=d;break;case"X":t.xOffset=d;break;case"Y":t.yOffset=d;break;case"c":t.columns=d;break;case"r":t.rows=d;break;case"m":t.more=d;break;case"q":t.quiet=d;break;case"C":t.cursorMovement=d;break;case"z":t.zIndex=d;break;case"p":t.placementId=d;break}}return t}var d5=0,LE=class{constructor(e,t,n,r){this._opts=e,this._renderer=t,this._kittyStorage=n,this._coreTerminal=r,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,n){if(!this._aborted)if(!this._inControlData)this._streamPayload(e,t,n);else{let r=n;for(let o=t;o<n;o++)if(e[o]===59){this._inControlData=!1,r=o;break}let s=r-t;if(this._controlLength+s>512){this._aborted=!0;return}if(this._controlData.set(e.subarray(t,r),this._controlLength),this._controlLength+=s,!this._inControlData){if(this._parsedCommand=u5(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 o=r+1;o<n&&this._streamPayload(e,o,n)}}}_streamPayload(e,t,n){if(this._aborted)return;let r=this._parsedCommand?.id??this._lastPendingKey??0,s=this._pendingTransmissions.get(r),o=s?.totalEncodedSize??0;if(this._totalEncodedSize+=n-t,o+this._totalEncodedSize>this._encodedSizeLimit){let a=this._activeDecoder??s?.decoder;a&&a.release(),this._activeDecoder=null,s&&this._removePendingEntry(r),this._aborted=!0;return}this._decodeError||(s?.decoder&&!this._activeDecoder&&(this._activeDecoder=s.decoder),this._activeDecoder||(this._activeDecoder=new _E.default(4194304,this._maxEncodedBytes,this._initialEncodedBytes),this._activeDecoder.init()),this._activeDecoder.put(e.subarray(t,n))!==d5&&(this._activeDecoder.release(),this._activeDecoder=null,this._decodeError=!0,s&&this._removePendingEntry(r)))}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 n=t.id??this._lastPendingKey??0,r=t.more===1,s=this._pendingTransmissions.get(n);if(r)return this._activeDecoder&&(s?(s.totalEncodedSize+=this._totalEncodedSize,s.decodeError=s.decodeError||this._decodeError):this._pendingTransmissions.set(n,{cmd:{...t},decoder:this._activeDecoder,totalEncodedSize:this._totalEncodedSize,decodeError:this._decodeError}),this._lastPendingKey=n,this._activeDecoder=null),!0;s&&(this._lastPendingKey=void 0);let o=this._decodeError,a=t,d=this._activeDecoder;s&&(a=s.cmd,d=s.decoder,o=o||s.decodeError,this._pendingTransmissions.delete(n));let h=new Uint8Array(0);d&&(d.end()!==d5&&(o=!0),h=d.data8),this._activeDecoder=null;let p=this._handleCommandWithBytesAndCmd(a,h,o);return d&&d.release(),p}_parseControlDataString(){let e="";for(let t=0;t<this._controlLength;t++)e+=String.fromCodePoint(this._controlData[t]);return e}_handleNoPayloadCommand(){let e=u5(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,n){switch(e.action??"t"){case"t":{let r=this._handleTransmit(e,t,n);return(e.transmission??"d")==="d"&&e.id!==void 0&&(n?this._sendResponse(e.id,"EINVAL:invalid base64 data",e.quiet??0):t.length>0&&this._sendResponse(e.id,"OK",e.quiet??0)),r}case"T":return this._handleTransmitDisplay(e,t,n);case"q":return this._handleQuery(e,t,n);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,n=this._kittyStorage.getImage(t);return n?this._displayImage(n,e).then(r=>(this._sendResponse(t,r?"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,n){return(e.transmission??"d")!=="d"?(e.id!==void 0&&this._sendResponse(e.id,"EINVAL:unsupported transmission medium",e.quiet??0),!0):(n||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,n){if(n)return e.id!==void 0&&this._sendResponse(e.id,"EINVAL:invalid base64 data",e.quiet??0),!0;this._handleTransmit(e,t,n);let r=e.id??this._kittyStorage.lastImageId,s=this._kittyStorage.getImage(r);if(s){let o=this._displayImage(s,e);return e.id!==void 0?o.then(a=>(this._sendResponse(r,a?"OK":"EINVAL:image rendering failed",e.quiet??0),!0)):o.then(()=>!0)}return!0}_handleQuery(e,t,n){let r=e.id??0,s=e.quiet??0;if((e.transmission??"d")!=="d")return this._sendResponse(r,"EINVAL:unsupported transmission medium",s),!0;if(n)return this._sendResponse(r,"EINVAL:invalid base64 data",s),!0;if(t.length===0)return this._sendResponse(r,"OK",s),!0;let o=e.format??32;if(o===100)this._sendResponse(r,"OK",s);else{let a=e.width??0,d=e.height??0;if(!a||!d)return this._sendResponse(r,"EINVAL:width and height required for raw pixel data",s),!0;let h=o===32?4:3,p=a*d*h;if(t.length<p)return this._sendResponse(r,"EINVAL:insufficient pixel data",s),!0;this._sendResponse(r,"OK",s)}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,n,r){let s=t==="OK";if(s&&n>=1||!s&&n>=2)return;let o=r?`,p=${r}`:"",a=`\x1B_Gi=${e}${o};${t}\x1B\\`;this._coreTerminal._core.coreService.triggerDataEvent(a)}_displayImage(e,t){return this._decodeAndDisplay(e,t).then(()=>!0).catch(()=>!1)}async _decodeAndDisplay(e,t){let n=await this._createBitmap(e);try{let r=Math.max(0,t.x??0),s=Math.max(0,t.y??0),o=t.sourceWidth||n.width-r,a=t.sourceHeight||n.height-s,d=Math.max(0,n.width-r),h=Math.max(0,n.height-s),p=Math.max(0,Math.min(o,d)),g=Math.max(0,Math.min(a,h));if(p===0||g===0)throw new Error("invalid source rectangle");if(r!==0||s!==0||p!==n.width||g!==n.height){let ye=await createImageBitmap(n,r,s,p,g);n.close(),n=ye}let y=this._renderer.dimensions?.css.cell.width||ol.width,b=this._renderer.dimensions?.css.cell.height||ol.height,v,T;t.columns!==void 0&&t.rows!==void 0?(v=t.columns,T=t.rows):t.columns!==void 0?(v=t.columns,T=Math.max(1,Math.ceil(n.height/n.width*(v*y)/b))):t.rows!==void 0?(T=t.rows,v=Math.max(1,Math.ceil(n.width/n.height*(T*b)/y))):(v=Math.ceil(n.width/y),T=Math.ceil(n.height/b));let A=n.width,L=n.height;if((t.columns!==void 0||t.rows!==void 0)&&(A=Math.round(v*y),L=Math.round(T*b)),A*L>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");let R=this._coreTerminal._core.buffer,D=R.x,B=R.y,j=R.ybase,P=t.zIndex!==void 0&&t.zIndex<0?"bottom":"top";if(A!==n.width||L!==n.height){let ye=await createImageBitmap(n,{resizeWidth:A,resizeHeight:L});n.close(),n=ye}let $=Math.min(Math.max(0,t.xOffset??0),y-1),z=Math.min(Math.max(0,t.yOffset??0),b-1);if($!==0||z!==0){let ye=t.columns!==void 0?Math.round(v*y):n.width+$,q=t.rows!==void 0?Math.round(T*b):n.height+z,te=mu.createCanvas(window.document,ye,q),ve=te.getContext("2d");if(!ve)throw new Error("Failed to create offset canvas context");ve.drawImage(n,$,z);let ge=await createImageBitmap(te);if(te.width=te.height=0,n.close(),n=ge,A=n.width,L=n.height,A*L>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");t.columns===void 0&&(v=Math.ceil(n.width/y)),t.rows===void 0&&(T=Math.ceil(n.height/b))}let H=t.zIndex??0;if(this._kittyStorage.addImage(e.id,n,!0,P,H),n=void 0,t.cursorMovement===1){let ye=R.ybase-j;R.x=D,R.y=Math.max(B-ye,0)}else R.x=Math.min(D+v,this._coreTerminal.cols)}catch(r){throw n?.close(),r}}async _createBitmap(e){let t=new Uint8Array(await e.data.arrayBuffer());if(e.compression==="z"&&(t=await this._decompressZlib(t)),e.format===100){let A=new Blob([t],{type:"image/png"});if(!window.createImageBitmap){let L=URL.createObjectURL(A),R=new Image;return new Promise((D,B)=>{R.addEventListener("load",()=>{URL.revokeObjectURL(L);let j=mu.createCanvas(window.document,R.width,R.height);j.getContext("2d")?.drawImage(R,0,0),createImageBitmap(j).then(D).catch(B)}),R.addEventListener("error",()=>{URL.revokeObjectURL(L),B(new Error("Failed to load image"))}),R.src=L})}return createImageBitmap(A)}let n=e.width,r=e.height;if(!n||!r)throw new Error("Width and height required for raw pixel data");let s=e.format===32?4:3,o=n*r*s;if(t.length<o)throw new Error("Insufficient pixel data");let a=n*r;if(e.format===32)return createImageBitmap(new ImageData(new Uint8ClampedArray(t.buffer,t.byteOffset,a*4),n,r));let d=new Uint8ClampedArray(a*4),h=new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),p=new Uint32Array(d.buffer),g=a&-4,y=0,b=0;for(let A=0;A<g;A+=4){let L=h[y++],R=h[y++],D=h[y++];p[b++]=4278190080|L,p[b++]=4278190080|L>>>24|R<<8,p[b++]=4278190080|R>>>16|D<<16,p[b++]=4278190080|D>>>8}let v=g*3,T=g*4;for(let A=g;A<a;A++)d[T]=t[v],d[T+1]=t[v+1],d[T+2]=t[v+2],d[T+3]=255,v+=3,T+=4;return createImageBitmap(new ImageData(d,n,r))}async _decompressZlib(e){try{return await this._decompress(e,"deflate")}catch{return await this._decompress(e,"deflate-raw")}}async _decompress(e,t){let n=new DecompressionStream(t),r=n.writable.getWriter();r.write(e),r.close();let s=[],o=n.readable.getReader();for(;;){let{done:p,value:g}=await o.read();if(p)break;s.push(g)}let a=s.reduce((p,g)=>p+g.length,0),d=new Uint8Array(a),h=0;for(let p of s)d.set(p,h),h+=p.length;return d}get images(){return this._kittyStorage.images}get _kittyIdToStorageId(){return this._kittyStorage.kittyIdToStorageId}get pendingTransmissions(){return this._pendingTransmissions}},Y3=class Tm{constructor(t){this._storage=t,this._nextImageId=1,this._images=new Map,this._kittyIdToStorageId=new Map,this._storageIdToKittyId=new Map,this._handleStorageImageDeleted=n=>{let r=this._storageIdToKittyId.get(n);r!==void 0&&(this._kittyIdToStorageId.delete(r),this._storageIdToKittyId.delete(n),this._images.delete(r))},this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"},this._previousOnImageDeleted=this._storage.onImageDeleted,this._wrappedOnImageDeleted=n=>{this._previousOnImageDeleted?.(n),this._handleStorageImageDeleted(n)},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,n){let r=t??this._nextImageId++,s=this._kittyIdToStorageId.get(r);return s!==void 0&&(this._storage.deleteImage(s),this._kittyIdToStorageId.delete(r),this._storageIdToKittyId.delete(s)),!this._images.has(r)&&this._images.size>=Tm._maxStoredImages&&this._evictUndisplayedImages(),this._images.set(r,{...n,id:r}),r}addImage(t,n,r,s,o){let a=this._kittyIdToStorageId.get(t);a!==void 0&&this._storageIdToKittyId.delete(a),this._addImageOpts.scrolling=r,this._addImageOpts.layer=s,this._addImageOpts.zIndex=o;let d=this._storage.addImage(n,this._addImageOpts);this._kittyIdToStorageId.set(t,d),this._storageIdToKittyId.set(d,t)}getImage(t){return this._images.get(t)}deleteById(t){this._images.delete(t);let n=this._kittyIdToStorageId.get(t);n!==void 0&&(this._storage.deleteImage(n),this._kittyIdToStorageId.delete(t),this._storageIdToKittyId.delete(n))}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<=Tm._maxStoredImages/2)break;this._kittyIdToStorageId.has(t)||this._images.delete(t)}}};Y3._maxStoredImages=256;var kE=Y3,P0=Au(kg()),EE=Au(pE()),IE=4194304,Sm=P0.PALETTE_ANSI_256;Sm.set(P0.PALETTE_VT340_COLOR);var RE=class{constructor(e,t,n){this._opts=e,this._storage=t,this._coreTerminal=n,this._size=0,this._aborted=!1,(0,EE.DecoderAsync)({memoryLimit:this._opts.pixelLimit*4,palette:Sm,paletteLimit:this._opts.sixelPaletteLimit}).then(r=>this._dec=r)}reset(){this._dec&&(this._dec.release(),this._dec._palette.fill(0),this._dec.init(0,Sm,this._opts.sixelPaletteLimit))}hook(e){if(this._size=0,this._aborted=!1,this._dec){let t=e.params[1]===1?0:ME(this._coreTerminal._core._inputHandler._curAttrData,this._coreTerminal._core._themeService?.colors);this._dec.init(t,null,this._opts.sixelPaletteLimit)}}put(e,t,n){if(!(this._aborted||!this._dec)){if(this._size+=n-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,n)}catch(r){console.warn(`SIXEL: error while decoding image - ${r}`),this._aborted=!0,this._dec.release()}}}unhook(e){if(this._aborted||!e||!this._dec)return!0;let t=this._dec.width,n=this._dec.height;if(!t||!n)return n&&this._storage.advanceCursor(n),!0;let r=mu.createCanvas(void 0,t,n);return r.getContext("2d")?.putImageData(new ImageData(this._dec.data8,t,n),0,0),this._dec.memoryUsage>IE&&this._dec.release(),this._storage.addImage(r),!0}};function ME(e,t){let n=0;if(!t)return n;if(e.isInverse())if(e.isFgDefault())n=vd(t.foreground.rgba);else if(e.isFgRGB()){let r=e.constructor.toColorRGB(e.getFgColor());n=(0,P0.toRGBA8888)(...r)}else n=vd(t.ansi[e.getFgColor()].rgba);else if(e.isBgDefault())n=vd(t.background.rgba);else if(e.isBgRGB()){let r=e.constructor.toColorRGB(e.getBgColor());n=(0,P0.toRGBA8888)(...r)}else n=vd(t.ansi[e.getBgColor()].rgba);return n}function vd(e){return P0.BIG_ENDIAN?e:(e&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255}var NE=class{constructor(e,t,n,r){this._storage=e,this._opts=t,this._renderer=n,this._terminal=r,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=ol);let n=Math.ceil(e/t.height);for(let r=1;r<n;++r)this._terminal._core._inputHandler.lineFeed()}}},DE=class{constructor(e){this._storage=e,this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"}}addImage(e){this._storage.addImage(e,this._addImageOpts)}},h5={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:4096,sixelSizeLimit:33554432,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:33554432,kittySupport:!0,kittySizeLimit:33554432},f5=4096,BE=class{constructor(t){this._disposables=[],this._handlers=new Map,this._onImageAdded=new gE,this.onImageAdded=this._onImageAdded.event,this._opts=Object.assign({},h5,t),this._defaultOpts=Object.assign({},h5,t)}dispose(){for(let t of this._disposables)t.dispose();this._disposables.length=0,this._handlers.clear(),this._onImageAdded.dispose()}_disposeLater(...t){for(let n of t)this._disposables.push(n)}activate(t){if(this._terminal=t,this._renderer=new mu(t),this._storage=new yE(t,this._renderer,this._opts),this._storage.onImageAdded=()=>this._onImageAdded.fire(),this._opts.enableSizeReports){let n=t.options.windowOptions??{};n.getWinSizePixels=!0,n.getCellSizePixels=!0,n.getWinSizeChars=!0,t.options.windowOptions=n}if(this._disposeLater(this._renderer,this._storage,t.parser.registerCsiHandler({prefix:"?",final:"h"},n=>this._decset(n)),t.parser.registerCsiHandler({prefix:"?",final:"l"},n=>this._decrst(n)),t.parser.registerCsiHandler({final:"c"},n=>this._da1(n)),t.parser.registerCsiHandler({prefix:"?",final:"S"},n=>this._xtermGraphicsAttributes(n)),t.onRender(n=>this._storage?.render(n)),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(n=>this._storage?.viewportResize(n))),this._opts.sixelSupport){let n=new NE(this._storage,this._opts,this._renderer,t),r=new RE(this._opts,n,t);this._handlers.set("sixel",r),this._disposeLater(t._core._inputHandler._parser.registerDcsHandler({final:"q"},r))}if(this._opts.iipSupport){let n=new DE(this._storage),r=new CE(this._opts,this._renderer,n,t);this._handlers.set("iip",r),this._disposeLater(t._core._inputHandler._parser.registerOscHandler(1337,r))}if(this._opts.kittySupport){let n=new kE(this._storage),r=new LE(this._opts,this._renderer,n,t);this._handlers.set("kitty",r),this._disposeLater(n,r,t._core._inputHandler._parser.registerApcHandler({final:"G"},r))}}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,n){return this._storage?.getImageAtBufferCell(t,n)}extractTileAtBufferCell(t,n){return this._storage?.extractTileAtBufferCell(t,n)}_report(t){this._terminal?._core.input(t,!1)}_decset(t){for(let n=0;n<t.length;++n)t[n]===80&&(this._opts.sixelScrolling=!1);return!1}_decrst(t){for(let n=0;n<t.length;++n)t[n]===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 n of this._handlers.values())n.reset();return!0;case 3:return t.length>2&&!(t[2]instanceof Array)&&t[2]<=f5?(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;${f5}S`),!0;default:return this._report(`\x1B[?${t[0]};2S`),!0}if(t[0]===2)switch(t[1]){case 1:let n=this._renderer?.dimensions?.css.canvas.width,r=this._renderer?.dimensions?.css.canvas.height;if(!n||!r){let o=ol;n=(this._terminal?.cols||80)*o.width,r=(this._terminal?.rows||24)*o.height}if(n*r<this._opts.pixelLimit)this._report(`\x1B[?${t[0]};0;${n.toFixed(0)};${r.toFixed(0)}S`);else{let o=Math.floor(Math.sqrt(this._opts.pixelLimit));this._report(`\x1B[?${t[0]};0;${o};${o}S`)}return!0;case 4:let s=Math.floor(Math.sqrt(this._opts.pixelLimit));return this._report(`\x1B[?${t[0]};0;${s};${s}S`),!0;default:return this._report(`\x1B[?${t[0]};2S`),!0}return this._report(`\x1B[?${t[0]};1S`),!0}};const Nc=new Map;function Yc(e){return{name:e,get hasSubscribers(){return(Nc.get(e)?.size??0)>0},publish(t){const n=Nc.get(e);if(n)for(const r of n)r(t,e)},subscribe(t){const n=Nc.get(e)??new Set;n.add(t),Nc.set(e,n)},unsubscribe(t){const n=Nc.get(e);if(!n)return!1;const r=n.delete(t);return n.size===0&&Nc.delete(e),r}}}function PE(e){const t={start:`${e}:start`,end:`${e}:end`,asyncStart:`${e}:asyncStart`,asyncEnd:`${e}:asyncEnd`,error:`${e}:error`},n={start:Yc(t.start),end:Yc(t.end),asyncStart:Yc(t.asyncStart),asyncEnd:Yc(t.asyncEnd),error:Yc(t.error),traceSync(r,s,o,...a){n.start.publish(s);try{const d=r.apply(o,a);return n.end.publish(s),d}catch(d){throw n.error.publish(d),d}},async tracePromise(r,s,o,...a){n.asyncStart.publish(s);try{const d=await r.apply(o,a);return n.asyncEnd.publish(s),d}catch(d){throw n.error.publish(d),d}},traceCallback(r,s,o,a,...d){n.start.publish(o);try{const h=r.apply(a,d);return n.end.publish(o),h}catch(h){throw n.error.publish(h),h}}};return n}var QE=Object.create,Eg=Object.defineProperty,OE=Object.getOwnPropertyDescriptor,FE=Object.getOwnPropertyNames,jE=Object.getPrototypeOf,$E=Object.prototype.hasOwnProperty,Z3=e=>{throw TypeError(e)},UE=(e,t,n)=>t in e?Eg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,HE=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},zE=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of FE(t))!$E.call(e,s)&&s!==n&&Eg(e,s,{get:()=>t[s],enumerable:!(r=OE(t,s))||r.enumerable});return e},GE=(e,t,n)=>(n=e!=null?QE(jE(e)):{},zE(!e||!e.__esModule?Eg(n,"default",{value:e,enumerable:!0}):n,e)),Ds=(e,t,n)=>UE(e,typeof t!="symbol"?t+"":t,n),Ig=(e,t,n)=>t.has(e)||Z3("Cannot "+n),Z=(e,t,n)=>(Ig(e,t,"read from private field"),n?n.call(e):t.get(e)),zn=(e,t,n)=>t.has(e)?Z3("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),en=(e,t,n,r)=>(Ig(e,t,"write to private field"),t.set(e,n),n),St=(e,t,n)=>(Ig(e,t,"access private method"),n),ip=(e,t,n,r)=>({set _(s){en(e,t,s)},get _(){return Z(e,t,r)}}),WE=HE((e,t)=>{var n=(()=>{var r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,d=(i,l)=>{for(var c in l)r(i,c,{get:l[c],enumerable:!0})},h=(i,l,c,f)=>{if(l&&typeof l=="object"||typeof l=="function")for(let m of o(l))!a.call(i,m)&&m!==c&&r(i,m,{get:()=>l[m],enumerable:!(f=s(l,m))||f.enumerable});return i},p=i=>h(r({},"__esModule",{value:!0}),i),g={};d(g,{BoundingBox:()=>We,Font:()=>j1,Glyph:()=>Dn,Path:()=>rt,_parse:()=>Ue,load:()=>I8,loadSync:()=>R8,parse:()=>E8});var y=0,b=-3;function v(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function T(i,l){this.source=i,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=l,this.destLen=0,this.ltree=new v,this.dtree=new v}var A=new v,L=new v,R=new Uint8Array(30),D=new Uint16Array(30),B=new Uint8Array(30),j=new Uint16Array(30),P=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$=new v,z=new Uint8Array(320);function H(i,l,c,f){var m,x;for(m=0;m<c;++m)i[m]=0;for(m=0;m<30-c;++m)i[m+c]=m/c|0;for(x=f,m=0;m<30;++m)l[m]=x,x+=1<<i[m]}function ye(i,l){var c;for(c=0;c<7;++c)i.table[c]=0;for(i.table[7]=24,i.table[8]=152,i.table[9]=112,c=0;c<24;++c)i.trans[c]=256+c;for(c=0;c<144;++c)i.trans[24+c]=c;for(c=0;c<8;++c)i.trans[168+c]=280+c;for(c=0;c<112;++c)i.trans[176+c]=144+c;for(c=0;c<5;++c)l.table[c]=0;for(l.table[5]=32,c=0;c<32;++c)l.trans[c]=c}var q=new Uint16Array(16);function te(i,l,c,f){var m,x;for(m=0;m<16;++m)i.table[m]=0;for(m=0;m<f;++m)i.table[l[c+m]]++;for(i.table[0]=0,x=0,m=0;m<16;++m)q[m]=x,x+=i.table[m];for(m=0;m<f;++m)l[c+m]&&(i.trans[q[l[c+m]]++]=m)}function ve(i){i.bitcount--||(i.tag=i.source[i.sourceIndex++],i.bitcount=7);var l=i.tag&1;return i.tag>>>=1,l}function ge(i,l,c){if(!l)return c;for(;i.bitcount<24;)i.tag|=i.source[i.sourceIndex++]<<i.bitcount,i.bitcount+=8;var f=i.tag&65535>>>16-l;return i.tag>>>=l,i.bitcount-=l,f+c}function ie(i,l){for(;i.bitcount<24;)i.tag|=i.source[i.sourceIndex++]<<i.bitcount,i.bitcount+=8;var c=0,f=0,m=0,x=i.tag;do f=2*f+(x&1),x>>>=1,++m,c+=l.table[m],f-=l.table[m];while(f>=0);return i.tag=x,i.bitcount-=m,l.trans[c+f]}function Ae(i,l,c){var f,m,x,w,C,k;for(f=ge(i,5,257),m=ge(i,5,1),x=ge(i,4,4),w=0;w<19;++w)z[w]=0;for(w=0;w<x;++w){var N=ge(i,3,0);z[P[w]]=N}for(te($,z,0,19),C=0;C<f+m;){var M=ie(i,$);switch(M){case 16:var W=z[C-1];for(k=ge(i,2,3);k;--k)z[C++]=W;break;case 17:for(k=ge(i,3,3);k;--k)z[C++]=0;break;case 18:for(k=ge(i,7,11);k;--k)z[C++]=0;break;default:z[C++]=M;break}}te(l,z,0,f),te(c,z,f,m)}function xe(i,l,c){for(;;){var f=ie(i,l);if(f===256)return y;if(f<256)i.dest[i.destLen++]=f;else{var m,x,w,C;for(f-=257,m=ge(i,R[f],D[f]),x=ie(i,c),w=i.destLen-ge(i,B[x],j[x]),C=w;C<w+m;++C)i.dest[i.destLen++]=i.dest[C]}}}function ce(i){for(var l,c,f;i.bitcount>8;)i.sourceIndex--,i.bitcount-=8;if(l=i.source[i.sourceIndex+1],l=256*l+i.source[i.sourceIndex],c=i.source[i.sourceIndex+3],c=256*c+i.source[i.sourceIndex+2],l!==(~c&65535))return b;for(i.sourceIndex+=4,f=l;f;--f)i.dest[i.destLen++]=i.source[i.sourceIndex++];return i.bitcount=0,y}function K(i,l){var c=new T(i,l),f,m,x;do{switch(f=ve(c),m=ge(c,2,0),m){case 0:x=ce(c);break;case 1:x=xe(c,A,L);break;case 2:Ae(c,c.ltree,c.dtree),x=xe(c,c.ltree,c.dtree);break;default:x=b}if(x!==y)throw new Error("Data error")}while(!f);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}ye(A,L),H(R,D,4,3),H(B,j,2,1),R[28]=0,D[28]=258;function be(i,l,c,f,m){return Math.pow(1-m,3)*i+3*Math.pow(1-m,2)*m*l+3*(1-m)*Math.pow(m,2)*c+Math.pow(m,3)*f}function Se(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}Se.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},Se.prototype.addPoint=function(i,l){typeof i=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=i,this.x2=i),i<this.x1&&(this.x1=i),i>this.x2&&(this.x2=i)),typeof l=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=l,this.y2=l),l<this.y1&&(this.y1=l),l>this.y2&&(this.y2=l))},Se.prototype.addX=function(i){this.addPoint(i,null)},Se.prototype.addY=function(i){this.addPoint(null,i)},Se.prototype.addBezier=function(i,l,c,f,m,x,w,C){let k=[i,l],N=[c,f],M=[m,x],W=[w,C];this.addPoint(i,l),this.addPoint(w,C);for(let G=0;G<=1;G++){let le=6*k[G]-12*N[G]+6*M[G],ne=-3*k[G]+9*N[G]-9*M[G]+3*W[G],me=3*N[G]-3*k[G];if(ne===0){if(le===0)continue;let rn=-me/le;0<rn&&rn<1&&(G===0&&this.addX(be(k[G],N[G],M[G],W[G],rn)),G===1&&this.addY(be(k[G],N[G],M[G],W[G],rn)));continue}let He=Math.pow(le,2)-4*me*ne;if(He<0)continue;let Gt=(-le+Math.sqrt(He))/(2*ne);0<Gt&&Gt<1&&(G===0&&this.addX(be(k[G],N[G],M[G],W[G],Gt)),G===1&&this.addY(be(k[G],N[G],M[G],W[G],Gt)));let Ft=(-le-Math.sqrt(He))/(2*ne);0<Ft&&Ft<1&&(G===0&&this.addX(be(k[G],N[G],M[G],W[G],Ft)),G===1&&this.addY(be(k[G],N[G],M[G],W[G],Ft)))}},Se.prototype.addQuad=function(i,l,c,f,m,x){let w=i+.6666666666666666*(c-i),C=l+2/3*(f-l),k=w+1/3*(m-i),N=C+1/3*(x-l);this.addBezier(i,l,w,C,k,N,m,x)};var We=Se;function ue(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}var Ee={};function Tt(i,l){let c=Math.floor(i),f=i-c;if(Ee[l]||(Ee[l]={}),Ee[l][f]!==void 0){let x=Ee[l][f];return c+x}let m=+(Math.round(f+"e+"+l)+"e-"+l);return Ee[l][f]=m,c+m}function Rt(i){let l=[[]],c=0,f=0;for(let m=0;m<i.length;m+=1){let x=l[l.length-1],w=i[m],C=x[0],k=x[1],N=x[x.length-1],M=i[m+1];x.push(w),w.type==="M"?(c=w.x,f=w.y):w.type==="L"&&(!M||M.type==="Z")?Math.abs(w.x-c)>1||Math.abs(w.y-f)>1||x.pop():w.type==="L"&&N&&N.x===w.x&&N.y===w.y?x.pop():w.type==="Z"&&(C&&k&&N&&C.type==="M"&&k.type==="L"&&N.type==="L"&&N.x===C.x&&N.y===C.y&&(x.shift(),x[0].type="M"),m+1<i.length&&l.push([]))}return i=[].concat.apply([],l),i}function ze(i){return Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0,scale:1,x:0,y:0},i)}function X(i){return parseInt(i)===i&&(i={decimalPlaces:i,flipY:!1}),Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0},i)}ue.prototype.fromSVG=function(i,l={}){typeof SVGPathElement<"u"&&i instanceof SVGPathElement&&(i=i.getAttribute("d")),l=ze(l),this.commands=[];let c="0123456789",f="MmLlQqCcZzHhVv",m="SsTtAa",x="-+",w={},C=[""],k=!1;function N(ne){return ne.filter(me=>me.length).map(me=>{let He=parseFloat(me);return(l.decimalPlaces||l.decimalPlaces===0)&&(He=Tt(He,l.decimalPlaces)),He})}function M(ne){if(!this.commands.length)return ne;let me=this.commands[this.commands.length-1];for(let He=0;He<ne.length;He++)ne[He]+=me[He&1?"y":"x"];return ne}function W(){if(w.type===void 0)return;let ne=w.type.toUpperCase(),me=ne!=="Z"&&w.type.toUpperCase()!==w.type,He=N(C);if(C=[""],!He.length&&ne!=="Z")return;me&&ne!=="H"&&ne!=="V"&&(He=M.apply(this,[He]));let Gt=this.commands.length&&this.commands[this.commands.length-1].x||0,Ft=this.commands.length&&this.commands[this.commands.length-1].y||0;switch(ne){case"M":this.moveTo(...He);break;case"L":this.lineTo(...He);break;case"V":for(let rn=0;rn<He.length;rn++){let kn=0;me&&(kn=this.commands.length&&this.commands[this.commands.length-1].y||0),this.lineTo(Gt,He[rn]+kn)}break;case"H":for(let rn=0;rn<He.length;rn++){let kn=0;me&&(kn=this.commands.length&&this.commands[this.commands.length-1].x||0),this.lineTo(He[rn]+kn,Ft)}break;case"C":this.bezierCurveTo(...He);break;case"Q":this.quadraticCurveTo(...He);break;case"Z":(this.commands.length<1||this.commands[this.commands.length-1].type!=="Z")&&this.close();break}if(this.commands.length)for(let rn in this.commands[this.commands.length-1])this.commands[this.commands.length-1][rn]===void 0&&(this.commands[this.commands.length-1][rn]=0)}for(let ne=0;ne<i.length;ne++){let me=i.charAt(ne),He=C[C.length-1];if(c.indexOf(me)>-1)C[C.length-1]+=me;else if(x.indexOf(me)>-1)if(!w.type&&!this.commands.length&&(w.type="L"),me==="-")!w.type||He.indexOf("-")>0?k=!0:He.length?C.push("-"):C[C.length-1]=me;else if(!w.type||He.length>0)k=!0;else continue;else if(f.indexOf(me)>-1)w.type?(W.apply(this),w={type:me}):w.type=me;else{if(m.indexOf(me)>-1)throw new Error("Unsupported path command: "+me+". Currently supported commands are "+f.split("").join(", ")+".");` ,
|
|
66
|
-
\r\f\v`.indexOf(me)>-1?C.push(""):me==="."?!w.type||He.indexOf(me)>-1?k=!0:C[C.length-1]+=me:k=!0}if(k)throw new Error("Unexpected character: "+me+" at offset "+ne)}W.apply(this),l.optimize&&(this.commands=Rt(this.commands));let G=l.flipY,le=l.flipYBase;if(G===!0&&l.flipYBase===void 0){let ne=this.getBoundingBox();le=ne.y1+ne.y2}for(let ne in this.commands){let me=this.commands[ne];for(let He in me)["x","x1","x2"].includes(He)?this.commands[ne][He]=l.x+me[He]*l.scale:["y","y1","y2"].includes(He)&&(this.commands[ne][He]=l.y+(G?le-me[He]:me[He])*l.scale)}return this},ue.fromSVG=function(i,l){return new ue().fromSVG(i,l)},ue.prototype.moveTo=function(i,l){this.commands.push({type:"M",x:i,y:l})},ue.prototype.lineTo=function(i,l){this.commands.push({type:"L",x:i,y:l})},ue.prototype.curveTo=ue.prototype.bezierCurveTo=function(i,l,c,f,m,x){this.commands.push({type:"C",x1:i,y1:l,x2:c,y2:f,x:m,y:x})},ue.prototype.quadTo=ue.prototype.quadraticCurveTo=function(i,l,c,f){this.commands.push({type:"Q",x1:i,y1:l,x:c,y:f})},ue.prototype.close=ue.prototype.closePath=function(){this.commands.push({type:"Z"})},ue.prototype.extend=function(i){if(i.commands)i=i.commands;else if(i instanceof We){let l=i;this.moveTo(l.x1,l.y1),this.lineTo(l.x2,l.y1),this.lineTo(l.x2,l.y2),this.lineTo(l.x1,l.y2),this.close();return}Array.prototype.push.apply(this.commands,i)},ue.prototype.getBoundingBox=function(){let i=new We,l=0,c=0,f=0,m=0;for(let x=0;x<this.commands.length;x++){let w=this.commands[x];switch(w.type){case"M":i.addPoint(w.x,w.y),l=f=w.x,c=m=w.y;break;case"L":i.addPoint(w.x,w.y),f=w.x,m=w.y;break;case"Q":i.addQuad(f,m,w.x1,w.y1,w.x,w.y),f=w.x,m=w.y;break;case"C":i.addBezier(f,m,w.x1,w.y1,w.x2,w.y2,w.x,w.y),f=w.x,m=w.y;break;case"Z":f=l,m=c;break;default:throw new Error("Unexpected path command "+w.type)}}return i.isEmpty()&&i.addPoint(0,0),i},ue.prototype.draw=function(i){let l=this._layers;if(l&&l.length){for(let f=0;f<l.length;f++)this.draw.call(l[f],i);return}let c=this._image;if(c){i.drawImage(c.image,c.x,c.y,c.width,c.height);return}i.beginPath();for(let f=0;f<this.commands.length;f+=1){let m=this.commands[f];m.type==="M"?i.moveTo(m.x,m.y):m.type==="L"?i.lineTo(m.x,m.y):m.type==="C"?i.bezierCurveTo(m.x1,m.y1,m.x2,m.y2,m.x,m.y):m.type==="Q"?i.quadraticCurveTo(m.x1,m.y1,m.x,m.y):m.type==="Z"&&this.stroke&&this.strokeWidth&&i.closePath()}this.fill&&(i.fillStyle=this.fill,i.fill()),this.stroke&&(i.strokeStyle=this.stroke,i.lineWidth=this.strokeWidth,i.stroke())},ue.prototype.toPathData=function(i){i=X(i);function l(C){let k=Tt(C,i.decimalPlaces);return Math.round(C)===k?""+k:k.toFixed(i.decimalPlaces)}function c(){let C="";for(let k=0;k<arguments.length;k+=1){let N=arguments[k];N>=0&&k>0&&(C+=" "),C+=l(N)}return C}let f=this.commands;i.optimize&&(f=JSON.parse(JSON.stringify(this.commands)),f=Rt(f));let m=i.flipY,x=i.flipYBase;if(m===!0&&x===void 0){let C=new ue;C.extend(f);let k=C.getBoundingBox();x=k.y1+k.y2}let w="";for(let C=0;C<f.length;C+=1){let k=f[C];k.type==="M"?w+="M"+c(k.x,m?x-k.y:k.y):k.type==="L"?w+="L"+c(k.x,m?x-k.y:k.y):k.type==="C"?w+="C"+c(k.x1,m?x-k.y1:k.y1,k.x2,m?x-k.y2:k.y2,k.x,m?x-k.y:k.y):k.type==="Q"?w+="Q"+c(k.x1,m?x-k.y1:k.y1,k.x,m?x-k.y:k.y):k.type==="Z"&&(w+="Z")}return w},ue.prototype.toSVG=function(i,l){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"),l||(l=this.toPathData(i));let c='<path d="';return c+=l,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},ue.prototype.toDOMElement=function(i,l){this._layers&&this._layers.length&&console.warn("toDOMElement() does not support colr font layers yet"),l||(l=this.toPathData(i));let c=document.createElementNS("http://www.w3.org/2000/svg","path");return c.setAttribute("d",l),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 rt=ue;function qe(i){throw new Error(i)}function re(i,l){i||qe(l)}var J={fail:qe,argument:re,assert:re},$e=32768,tt=2147483648,gt=-32768,pt=32767+1/65536,Ct={},Le={},Te={};function Oe(i){return function(){return i}}Le.BYTE=function(i){return J.argument(i>=0&&i<=255,"Byte value should be between 0 and 255."),[i]},Te.BYTE=Oe(1),Le.CHAR=function(i){return[i.charCodeAt(0)]},Te.CHAR=Oe(1),Le.CHARARRAY=function(i){(i===null||typeof i>"u")&&(i="",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 l=[];for(let c=0;c<i.length;c+=1)l[c]=i.charCodeAt(c);return l},Te.CHARARRAY=function(i){return typeof i>"u"?0:i.length},Le.USHORT=function(i){return[i>>8&255,i&255]},Te.USHORT=Oe(2),Le.SHORT=function(i){return i>=$e&&(i=-(2*$e-i)),[i>>8&255,i&255]},Te.SHORT=Oe(2),Le.UINT24=function(i){return[i>>16&255,i>>8&255,i&255]},Te.UINT24=Oe(3),Le.ULONG=function(i){return[i>>24&255,i>>16&255,i>>8&255,i&255]},Te.ULONG=Oe(4),Le.LONG=function(i){return i>=tt&&(i=-(2*tt-i)),[i>>24&255,i>>16&255,i>>8&255,i&255]},Te.LONG=Oe(4),Le.FLOAT=function(i){if(i>pt||i<gt)throw new Error(`Value ${i} is outside the range of representable values in 16.16 format`);let l=Math.round(i*65536)<<0;return Le.ULONG(l)},Te.FLOAT=Te.ULONG,Le.FIXED=Le.ULONG,Te.FIXED=Te.ULONG,Le.FWORD=Le.SHORT,Te.FWORD=Te.SHORT,Le.UFWORD=Le.USHORT,Te.UFWORD=Te.USHORT,Le.F2DOT14=function(i){return Le.USHORT(i*16384)},Te.F2DOT14=Te.USHORT,Le.LONGDATETIME=function(i){return[0,0,0,0,i>>24&255,i>>16&255,i>>8&255,i&255]},Te.LONGDATETIME=Oe(8),Le.TAG=function(i){return J.argument(i.length===4,"Tag should be exactly 4 ASCII characters."),[i.charCodeAt(0),i.charCodeAt(1),i.charCodeAt(2),i.charCodeAt(3)]},Te.TAG=Oe(4),Le.Card8=Le.BYTE,Te.Card8=Te.BYTE,Le.Card16=Le.USHORT,Te.Card16=Te.USHORT,Le.OffSize=Le.BYTE,Te.OffSize=Te.BYTE,Le.SID=Le.USHORT,Te.SID=Te.USHORT,Le.NUMBER=function(i){return i>=-107&&i<=107?[i+139]:i>=108&&i<=1131?(i=i-108,[(i>>8)+247,i&255]):i>=-1131&&i<=-108?(i=-i-108,[(i>>8)+251,i&255]):i>=-32768&&i<=32767?Le.NUMBER16(i):Le.NUMBER32(i)},Te.NUMBER=function(i){return Le.NUMBER(i).length},Le.NUMBER16=function(i){return[28,i>>8&255,i&255]},Te.NUMBER16=Oe(3),Le.NUMBER32=function(i){return[29,i>>24&255,i>>16&255,i>>8&255,i&255]},Te.NUMBER32=Oe(5),Le.REAL=function(i){let l=i.toString(),c=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(l);if(c){let x=parseFloat("1e"+((c[2]?+c[2]:0)+c[1].length));l=(Math.round(i*x)/x).toString()}let f="";for(let x=0,w=l.length;x<w;x+=1){let C=l[x];C==="e"?f+=l[++x]==="-"?"c":"b":C==="."?f+="a":C==="-"?f+="e":f+=C}f+=f.length&1?"f":"ff";let m=[30];for(let x=0,w=f.length;x<w;x+=2)m.push(parseInt(f.substr(x,2),16));return m},Te.REAL=function(i){return Le.REAL(i).length},Le.NAME=Le.CHARARRAY,Te.NAME=Te.CHARARRAY,Le.STRING=Le.CHARARRAY,Te.STRING=Te.CHARARRAY,Ct.UTF8=function(i,l,c){let f=[],m=c;for(let x=0;x<m;x++,l+=1)f[x]=i.getUint8(l);return String.fromCharCode.apply(null,f)},Ct.UTF16=function(i,l,c){let f=[],m=c/2;for(let x=0;x<m;x++,l+=2)f[x]=i.getUint16(l);return String.fromCharCode.apply(null,f)},Le.UTF16=function(i){let l=[];for(let c=0;c<i.length;c+=1){let f=i.charCodeAt(c);l[l.length]=f>>8&255,l[l.length]=f&255}return l},Te.UTF16=function(i){return i.length*2};var yt={"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":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};Ct.MACSTRING=function(i,l,c,f){let m=yt[f];if(m===void 0)return;let x="";for(let w=0;w<c;w++){let C=i.getUint8(l+w);C<=127?x+=String.fromCharCode(C):x+=m[C&127]}return x};var de=typeof WeakMap=="function"&&new WeakMap,Pe,ot=function(i){if(!Pe){Pe={};for(let m in yt)Pe[m]=new String(m)}let l=Pe[i];if(l===void 0)return;if(de){let m=de.get(l);if(m!==void 0)return m}let c=yt[i];if(c===void 0)return;let f={};for(let m=0;m<c.length;m++)f[c.charCodeAt(m)]=m+128;return de&&de.set(l,f),f};Le.MACSTRING=function(i,l){let c=ot(l);if(c===void 0)return;let f=[];for(let m=0;m<i.length;m++){let x=i.charCodeAt(m);if(x>=128&&(x=c[x],x===void 0))return;f[m]=x}return f},Te.MACSTRING=function(i,l){let c=Le.MACSTRING(i,l);return c!==void 0?c.length:0};function zt(i){return i>=-128&&i<=127}function yn(i,l,c){let f=0,m=i.length;for(;l<m&&f<64&&i[l]===0;)++l,++f;return c.push(128|f-1),l}function at(i,l,c){let f=0,m=i.length,x=l;for(;x<m&&f<64;){let w=i[x];if(!zt(w)||w===0&&x+1<m&&i[x+1]===0)break;++x,++f}c.push(f-1);for(let w=l;w<x;++w)c.push(i[w]+256&255);return x}function bt(i,l,c){let f=0,m=i.length,x=l;for(;x<m&&f<64;){let w=i[x];if(w===0||zt(w)&&x+1<m&&zt(i[x+1]))break;++x,++f}c.push(64|f-1);for(let w=l;w<x;++w){let C=i[w];c.push(C+65536>>8&255,C+256&255)}return x}Le.VARDELTAS=function(i){let l=0,c=[];for(;l<i.length;){let f=i[l];f===0?l=yn(i,l,c):f>=-128&&f<=127?l=at(i,l,c):l=bt(i,l,c)}return c},Le.INDEX=function(i){let l=1,c=[l],f=[];for(let C=0;C<i.length;C+=1){let k=Le.OBJECT(i[C]);Array.prototype.push.apply(f,k),l+=k.length,c.push(l)}if(f.length===0)return[0,0];let m=[],x=1+Math.floor(Math.log(l)/Math.log(2))/8|0,w=[void 0,Le.BYTE,Le.USHORT,Le.UINT24,Le.ULONG][x];for(let C=0;C<c.length;C+=1){let k=w(c[C]);Array.prototype.push.apply(m,k)}return Array.prototype.concat(Le.Card16(i.length),Le.OffSize(x),m,f)},Te.INDEX=function(i){return Le.INDEX(i).length},Le.DICT=function(i){let l=[],c=Object.keys(i),f=c.length;for(let m=0;m<f;m+=1){let x=parseInt(c[m],0),w=i[x],C=Le.OPERAND(w.value,w.type),k=Le.OPERATOR(x);for(let N=0;N<C.length;N++)l.push(C[N]);for(let N=0;N<k.length;N++)l.push(k[N])}return l},Te.DICT=function(i){return Le.DICT(i).length},Le.OPERATOR=function(i){return i<1200?[i]:[12,i-1200]},Le.OPERAND=function(i,l){let c=[];if(Array.isArray(l))for(let f=0;f<l.length;f+=1){J.argument(i.length===l.length,"Not enough arguments given for type"+l);let m=Le.OPERAND(i[f],l[f]);for(let x=0;x<m.length;x++)c.push(m[x])}else if(l==="SID"){let f=Le.NUMBER(i);for(let m=0;m<f.length;m++)c.push(f[m])}else if(l==="offset"){let f=Le.NUMBER32(i);for(let m=0;m<f.length;m++)c.push(f[m])}else if(l==="number"){let f=Le.NUMBER(i);for(let m=0;m<f.length;m++)c.push(f[m])}else if(l==="real"){let f=Le.REAL(i);for(let m=0;m<f.length;m++)c.push(f[m])}else throw new Error("Unknown operand type "+l);return c},Le.OP=Le.BYTE,Te.OP=Te.BYTE;var It=typeof WeakMap=="function"&&new WeakMap;Le.CHARSTRING=function(i){if(It){let f=It.get(i);if(f!==void 0)return f}let l=[],c=i.length;for(let f=0;f<c;f+=1){let m=i[f],x=Le[m.type](m.value);for(let w=0;w<x.length;w++)l.push(x[w])}return It&&It.set(i,l),l},Te.CHARSTRING=function(i){return Le.CHARSTRING(i).length},Le.OBJECT=function(i){let l=Le[i.type];return J.argument(l!==void 0,"No encoding function for type "+i.type),l(i.value)},Te.OBJECT=function(i){let l=Te[i.type];return J.argument(l!==void 0,"No sizeOf function for type "+i.type),l(i.value)},Le.TABLE=function(i){let l=[],c=(i.fields||[]).length,f=[],m=[];for(let x=0;x<c;x+=1){let w=i.fields[x],C=Le[w.type];J.argument(C!==void 0,"No encoding function for field type "+w.type+" ("+w.name+")");let k=i[w.name];k===void 0&&(k=w.value);let N=C(k);if(w.type==="TABLE")k.fields!==null&&(m.push(l.length),f.push(N)),l.push(0,0);else for(let M=0;M<N.length;M++)l.push(N[M])}for(let x=0;x<f.length;x+=1){let w=m[x],C=l.length;J.argument(C<65536,"Table "+i.tableName+" too big."),l[w]=C>>8,l[w+1]=C&255;for(let k=0;k<f[x].length;k++)l.push(f[x][k])}return l},Te.TABLE=function(i){let l=0,c=(i.fields||[]).length;for(let f=0;f<c;f+=1){let m=i.fields[f],x=Te[m.type];J.argument(x!==void 0,"No sizeOf function for field type "+m.type+" ("+m.name+")");let w=i[m.name];w===void 0&&(w=m.value),l+=x(w),m.type==="TABLE"&&(l+=2)}return l},Le.RECORD=Le.TABLE,Te.RECORD=Te.TABLE,Le.LITERAL=function(i){return i},Te.LITERAL=function(i){return i.length};function kt(i,l,c){if(l&&l.length)for(let f=0;f<l.length;f+=1){let m=l[f];this[m.name]=m.value}if(this.tableName=i,this.fields=l,c){let f=Object.keys(c);for(let m=0;m<f.length;m+=1){let x=f[m],w=c[x];this[x]!==void 0&&(this[x]=w)}}}kt.prototype.encode=function(){return Le.TABLE(this)},kt.prototype.sizeOf=function(){return Te.TABLE(this)};function $t(i,l,c){c===void 0&&(c=l.length);let f=new Array(l.length+1);f[0]={name:i+"Count",type:"USHORT",value:c};for(let m=0;m<l.length;m++)f[m+1]={name:i+m,type:"USHORT",value:l[m]};return f}function se(i,l,c){let f=l.length,m=new Array(f+1);m[0]={name:i+"Count",type:"USHORT",value:f};for(let x=0;x<f;x++)m[x+1]={name:i+x,type:"TABLE",value:c(l[x],x)};return m}function Fe(i,l,c){let f=l.length,m=[];m[0]={name:i+"Count",type:"USHORT",value:f};for(let x=0;x<f;x++)m=m.concat(c(l[x],x));return m}function Je(i){i.format===1?kt.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat($t("glyph",i.glyphs))):i.format===2?kt.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(Fe("rangeRecord",i.ranges,function(l,c){return[{name:"startGlyphID"+c,type:"USHORT",value:l.start},{name:"endGlyphID"+c,type:"USHORT",value:l.end},{name:"startCoverageIndex"+c,type:"USHORT",value:l.index}]}))):J.assert(!1,"Coverage format must be 1 or 2.")}Je.prototype=Object.create(kt.prototype),Je.prototype.constructor=Je;function Ot(i){kt.call(this,"scriptListTable",Fe("scriptRecord",i,function(l,c){let f=l.script,m=f.defaultLangSys;return J.assert(!!m,"Unable to write GSUB: script "+l.tag+" has no default language system."),[{name:"scriptTag"+c,type:"TAG",value:l.tag},{name:"script"+c,type:"TABLE",value:new kt("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new kt("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:m.reqFeatureIndex}].concat($t("featureIndex",m.featureIndexes)))}].concat(Fe("langSys",f.langSysRecords,function(x,w){let C=x.langSys;return[{name:"langSysTag"+w,type:"TAG",value:x.tag},{name:"langSys"+w,type:"TABLE",value:new kt("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:C.reqFeatureIndex}].concat($t("featureIndex",C.featureIndexes)))}]})))}]}))}Ot.prototype=Object.create(kt.prototype),Ot.prototype.constructor=Ot;function je(i){kt.call(this,"featureListTable",Fe("featureRecord",i,function(l,c){let f=l.feature;return[{name:"featureTag"+c,type:"TAG",value:l.tag},{name:"feature"+c,type:"TABLE",value:new kt("featureTable",[{name:"featureParams",type:"USHORT",value:f.featureParams}].concat($t("lookupListIndex",f.lookupListIndexes)))}]}))}je.prototype=Object.create(kt.prototype),je.prototype.constructor=je;function ut(i,l){kt.call(this,"lookupListTable",se("lookup",i,function(c){let f=l[c.lookupType];return J.assert(!!f,"Unable to write GSUB lookup type "+c.lookupType+" tables."),new kt("lookupTable",[{name:"lookupType",type:"USHORT",value:c.lookupType},{name:"lookupFlag",type:"USHORT",value:c.lookupFlag}].concat(se("subtable",c.subtables,f)))}))}ut.prototype=Object.create(kt.prototype),ut.prototype.constructor=ut;function un(i){i.format===1?kt.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:1},{name:"startGlyphID",type:"USHORT",value:i.startGlyph}].concat($t("glyph",i.classes))):i.format===2?kt.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:2}].concat(Fe("rangeRecord",i.ranges,function(l,c){return[{name:"startGlyphID"+c,type:"USHORT",value:l.start},{name:"endGlyphID"+c,type:"USHORT",value:l.end},{name:"class"+c,type:"USHORT",value:l.classId}]}))):J.assert(!1,"Class format must be 1 or 2.")}un.prototype=Object.create(kt.prototype),un.prototype.constructor=un;var Be={Table:kt,Record:kt,Coverage:Je,ClassDef:un,ScriptList:Ot,FeatureList:je,LookupList:ut,ushortList:$t,tableList:se,recordList:Fe};function hr(i,l){return i.getUint8(l)}function jn(i,l){return i.getUint16(l,!1)}function Ne(i,l){return i.getInt16(l,!1)}function Pn(i,l){return(i.getUint16(l)<<8)+i.getUint8(l+2)}function dt(i,l){return i.getUint32(l,!1)}function fr(i,l){return i.getInt32(l,!1)}function In(i,l){let c=i.getInt16(l,!1),f=i.getUint16(l+2,!1);return c+f/65535}function Sr(i,l){let c="";for(let f=l;f<l+4;f+=1)c+=String.fromCharCode(i.getInt8(f));return c}function fn(i,l,c){let f=0;for(let m=0;m<c;m+=1)f<<=8,f+=i.getUint8(l+m);return f}function Qn(i,l,c){let f=[];for(let m=l;m<c;m+=1)f.push(i.getUint8(m));return f}function Br(i){let l="";for(let c=0;c<i.length;c+=1)l+=String.fromCharCode(i[c]);return l}var Rn={byte:1,uShort:2,f2dot14:2,short:2,uInt24:3,uLong:4,fixed:4,longDateTime:8,tag:4},On={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 pe(i,l){this.data=i,this.offset=l,this.relativeOffset=0}pe.prototype.parseByte=function(){let i=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,i},pe.prototype.parseChar=function(){let i=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,i},pe.prototype.parseCard8=pe.prototype.parseByte,pe.prototype.parseUShort=function(){let i=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,i},pe.prototype.parseCard16=pe.prototype.parseUShort,pe.prototype.parseSID=pe.prototype.parseUShort,pe.prototype.parseOffset16=pe.prototype.parseUShort,pe.prototype.parseShort=function(){let i=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,i},pe.prototype.parseF2Dot14=function(){let i=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,i},pe.prototype.parseUInt24=function(){let i=Pn(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=3,i},pe.prototype.parseULong=function(){let i=dt(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,i},pe.prototype.parseLong=function(){let i=fr(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,i},pe.prototype.parseOffset32=pe.prototype.parseULong,pe.prototype.parseFixed=function(){let i=In(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,i},pe.prototype.parseString=function(i){let l=this.data,c=this.offset+this.relativeOffset,f="";this.relativeOffset+=i;for(let m=0;m<i;m++)f+=String.fromCharCode(l.getUint8(c+m));return f},pe.prototype.parseTag=function(){return this.parseString(4)},pe.prototype.parseLongDateTime=function(){let i=dt(this.data,this.offset+this.relativeOffset+4);return i-=2082844800,this.relativeOffset+=8,i},pe.prototype.parseVersion=function(i){let l=jn(this.data,this.offset+this.relativeOffset),c=jn(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,i===void 0&&(i=4096),l+c/i/10},pe.prototype.skip=function(i,l){l===void 0&&(l=1),this.relativeOffset+=Rn[i]*l},pe.prototype.parseULongList=function(i){i===void 0&&(i=this.parseULong());let l=new Array(i),c=this.data,f=this.offset+this.relativeOffset;for(let m=0;m<i;m++)l[m]=c.getUint32(f),f+=4;return this.relativeOffset+=i*4,l},pe.prototype.parseOffset16List=pe.prototype.parseUShortList=function(i){i===void 0&&(i=this.parseUShort());let l=new Array(i),c=this.data,f=this.offset+this.relativeOffset;for(let m=0;m<i;m++)l[m]=c.getUint16(f),f+=2;return this.relativeOffset+=i*2,l},pe.prototype.parseShortList=function(i){let l=new Array(i),c=this.data,f=this.offset+this.relativeOffset;for(let m=0;m<i;m++)l[m]=c.getInt16(f),f+=2;return this.relativeOffset+=i*2,l},pe.prototype.parseByteList=function(i){let l=new Array(i),c=this.data,f=this.offset+this.relativeOffset;for(let m=0;m<i;m++)l[m]=c.getUint8(f++);return this.relativeOffset+=i,l},pe.prototype.parseList=function(i,l){l||(l=i,i=this.parseUShort());let c=new Array(i);for(let f=0;f<i;f++)c[f]=l.call(this);return c},pe.prototype.parseList32=function(i,l){l||(l=i,i=this.parseULong());let c=new Array(i);for(let f=0;f<i;f++)c[f]=l.call(this);return c},pe.prototype.parseRecordList=function(i,l){l||(l=i,i=this.parseUShort());let c=new Array(i),f=Object.keys(l);for(let m=0;m<i;m++){let x={};for(let w=0;w<f.length;w++){let C=f[w],k=l[C];x[C]=k.call(this)}c[m]=x}return c},pe.prototype.parseRecordList32=function(i,l){l||(l=i,i=this.parseULong());let c=new Array(i),f=Object.keys(l);for(let m=0;m<i;m++){let x={};for(let w=0;w<f.length;w++){let C=f[w],k=l[C];x[C]=k.call(this)}c[m]=x}return c},pe.prototype.parseTupleRecords=function(i,l){let c=[];for(let f=0;f<i;f++){let m=[];for(let x=0;x<l;x++)m.push(this.parseF2Dot14());c.push(m)}return c},pe.prototype.parseStruct=function(i){if(typeof i=="function")return i.call(this);{let l=Object.keys(i),c={};for(let f=0;f<l.length;f++){let m=l[f],x=i[m];c[m]=x.call(this)}return c}},pe.prototype.parseValueRecord=function(i){if(i===void 0&&(i=this.parseUShort()),i===0)return;let l={};return i&1&&(l.xPlacement=this.parseShort()),i&2&&(l.yPlacement=this.parseShort()),i&4&&(l.xAdvance=this.parseShort()),i&8&&(l.yAdvance=this.parseShort()),i&16&&(l.xPlaDevice=void 0,this.parseShort()),i&32&&(l.yPlaDevice=void 0,this.parseShort()),i&64&&(l.xAdvDevice=void 0,this.parseShort()),i&128&&(l.yAdvDevice=void 0,this.parseShort()),l},pe.prototype.parseValueRecordList=function(){let i=this.parseUShort(),l=this.parseUShort(),c=new Array(l);for(let f=0;f<l;f++)c[f]=this.parseValueRecord(i);return c},pe.prototype.parsePointer=function(i){let l=this.parseOffset16();if(l>0)return new pe(this.data,this.offset+l).parseStruct(i)},pe.prototype.parsePointer32=function(i){let l=this.parseOffset32();if(l>0)return new pe(this.data,this.offset+l).parseStruct(i)},pe.prototype.parseListOfLists=function(i){let l=this.parseOffset16List(),c=l.length,f=this.relativeOffset,m=new Array(c);for(let x=0;x<c;x++){let w=l[x];if(w===0){m[x]=void 0;continue}if(this.relativeOffset=w,i){let C=this.parseOffset16List(),k=new Array(C.length);for(let N=0;N<C.length;N++)this.relativeOffset=w+C[N],k[N]=i.call(this);m[x]=k}else m[x]=this.parseUShortList()}return this.relativeOffset=f,m},pe.prototype.parseCoverage=function(){let i=this.offset+this.relativeOffset,l=this.parseUShort(),c=this.parseUShort();if(l===1)return{format:1,glyphs:this.parseUShortList(c)};if(l===2){let f=new Array(c);for(let m=0;m<c;m++)f[m]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:f}}throw new Error("0x"+i.toString(16)+": Coverage format must be 1 or 2.")},pe.prototype.parseClassDef=function(){let i=this.offset+this.relativeOffset,l=this.parseUShort();return l===1?{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:l===2?{format:2,ranges:this.parseRecordList({start:pe.uShort,end:pe.uShort,classId:pe.uShort})}:(console.warn(`0x${i.toString(16)}: This font file uses an invalid ClassDef format of ${l}. It might be corrupted and should be reacquired if it doesn't display as intended.`),{format:l})},pe.list=function(i,l){return function(){return this.parseList(i,l)}},pe.list32=function(i,l){return function(){return this.parseList32(i,l)}},pe.recordList=function(i,l){return function(){return this.parseRecordList(i,l)}},pe.recordList32=function(i,l){return function(){return this.parseRecordList32(i,l)}},pe.pointer=function(i){return function(){return this.parsePointer(i)}},pe.pointer32=function(i){return function(){return this.parsePointer32(i)}},pe.tag=pe.prototype.parseTag,pe.byte=pe.prototype.parseByte,pe.uShort=pe.offset16=pe.prototype.parseUShort,pe.uShortList=pe.prototype.parseUShortList,pe.uInt24=pe.prototype.parseUInt24,pe.uLong=pe.offset32=pe.prototype.parseULong,pe.uLongList=pe.prototype.parseULongList,pe.fixed=pe.prototype.parseFixed,pe.f2Dot14=pe.prototype.parseF2Dot14,pe.struct=pe.prototype.parseStruct,pe.coverage=pe.prototype.parseCoverage,pe.classDef=pe.prototype.parseClassDef;var tn={reserved:pe.uShort,reqFeatureIndex:pe.uShort,featureIndexes:pe.uShortList};pe.prototype.parseScriptList=function(){return this.parsePointer(pe.recordList({tag:pe.tag,script:pe.pointer({defaultLangSys:pe.pointer(tn),langSysRecords:pe.recordList({tag:pe.tag,langSys:pe.pointer(tn)})})}))||[]},pe.prototype.parseFeatureList=function(){return this.parsePointer(pe.recordList({tag:pe.tag,feature:pe.pointer({featureParams:pe.offset16,lookupListIndexes:pe.uShortList})}))||[]},pe.prototype.parseLookupList=function(i){return this.parsePointer(pe.list(pe.pointer(function(){let l=this.parseUShort();J.argument(1<=l&&l<=9,"GPOS/GSUB lookup type "+l+" unknown.");let c=this.parseUShort(),f=c&16;return{lookupType:l,lookupFlag:c,subtables:this.parseList(pe.pointer(i[l])),markFilteringSet:f?this.parseUShort():void 0}})))||[]},pe.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){let i=this.parseUShort(),l=this.parseUShort();return J.argument(i===1&&l<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:pe.offset32,featureTableSubstitutionOffset:pe.offset32})})||[]},pe.prototype.parseVariationStore=function(){let i=this.relativeOffset,l=this.parseUShort(),c={itemVariationStore:this.parseItemVariationStore()};return this.relativeOffset=i+l+2,c},pe.prototype.parseItemVariationStore=function(){let i=this.relativeOffset,l={format:this.parseUShort(),variationRegions:[],itemVariationSubtables:[]},c=this.parseOffset32(),f=this.parseUShort(),m=this.parseULongList(f);this.relativeOffset=i+c,l.variationRegions=this.parseVariationRegionList();for(let x=0;x<f;x++){let w=m[x];this.relativeOffset=i+w,l.itemVariationSubtables.push(this.parseItemVariationSubtable())}return l},pe.prototype.parseVariationRegionList=function(){let i=this.parseUShort(),l=this.parseUShort();return this.parseRecordList(l,{regionAxes:pe.recordList(i,{startCoord:pe.f2Dot14,peakCoord:pe.f2Dot14,endCoord:pe.f2Dot14})})},pe.prototype.parseItemVariationSubtable=function(){let i=this.parseUShort(),l=this.parseUShort(),c=this.parseUShortList(),f=c.length;return{regionIndexes:c,deltaSets:i&&f?this.parseDeltaSets(i,l,f):[]}},pe.prototype.parseDeltaSetIndexMap=function(){let i=this.parseByte(),l=this.parseByte(),c=[],f=0;switch(i){case 0:f=this.parseUShort();break;case 1:f=this.parseULong();break;default:console.error(`unsupported DeltaSetIndexMap format ${i}`)}if(!f)return{format:i,entryFormat:l};let m=(l&On.INNER_INDEX_BIT_COUNT_MASK)+1,x=((l&On.MAP_ENTRY_SIZE_MASK)>>4)+1;for(let w=0;w<f;w++){let C;if(x===1)C=this.parseByte();else if(x===2)C=this.parseUShort();else if(x===3)C=this.parseUInt24();else if(x===4)C=this.parseULong();else throw new Error(`Invalid entry size of ${x}`);let k=C>>m,N=C&(1<<m)-1;c.push({outerIndex:k,innerIndex:N})}return{format:i,entryFormat:l,map:c}},pe.prototype.parseDeltaSets=function(i,l,c){let f=Array.from({length:i},()=>[]),m=l&On.LONG_WORDS,x=l&On.WORD_DELTA_COUNT_MASK;if(x>c)throw Error("wordCount must be less than or equal to regionIndexCount");let w=(m?this.parseLong:this.parseShort).bind(this),C=(m?this.parseShort:this.parseChar).bind(this);for(let k=0;k<i;k++)for(let N=0;N<c;N++)N<x?f[k].push(w()):f[k].push(C());return f},pe.prototype.parseTupleVariationStoreList=function(i,l,c){let f=this.parseUShort(),m=this.parseUShort()&1,x=this.parseOffset32(),w=(m?this.parseULong:this.parseUShort).bind(this),C={},k=w();m||(k*=2);let N;for(let M=0;M<f;M++){N=w(),m||(N*=2);let W=N-k;C[M]=W?this.parseTupleVariationStore(x+k,i,l,c,M):void 0,k=N}return C},pe.prototype.parseTupleVariationStore=function(i,l,c,f,m){let x=this.relativeOffset;this.relativeOffset=i,c==="cvar"&&(this.relativeOffset+=4);let w=this.parseUShort(),C=!!(w&On.SHARED_POINT_NUMBERS),k=w&On.COUNT_MASK,N=this.parseOffset16(),M=[],W=[];for(let ne=0;ne<k;ne++){let me=this.parseTupleVariationHeader(l,c);M.push(me)}this.relativeOffset!==i+N&&(console.warn(`Unexpected offset after parsing tuple variation headers! Expected ${i+N}, actually ${this.relativeOffset}`),this.relativeOffset=i+N),C&&(W=this.parsePackedPointNumbers());let G=this.relativeOffset;for(let ne=0;ne<k;ne++){let me=M[ne];me.privatePoints=[],this.relativeOffset=G,c==="cvar"&&!me.peakTuple&&console.warn("An embedded peak tuple is required in TupleVariationHeaders for the cvar table."),me.flags.privatePointNumbers&&(me.privatePoints=this.parsePackedPointNumbers()),delete me.flags;let He=this.offset,Gt=this.relativeOffset,Ft=rn=>{let kn,mr,kr=()=>{let Er=0;if(c==="gvar"){if(Er=me.privatePoints.length||W.length,!Er){let As=f.get(m);As.path,Er=As.points.length,Er+=4}}else c==="cvar"&&(Er=f.length);this.offset=He,this.relativeOffset=Gt,kn=this.parsePackedDeltas(Er),c==="gvar"&&(mr=this.parsePackedDeltas(Er))};return{configurable:!0,get:function(){return kn===void 0&&kr(),rn==="deltasY"?mr:kn},set:function(Er){kn===void 0&&kr(),rn==="deltasY"?mr=Er:kn=Er}}};Object.defineProperty(me,"deltas",Ft.call(this,"deltas")),c==="gvar"&&Object.defineProperty(me,"deltasY",Ft.call(this,"deltasY")),G+=me.variationDataSize,delete me.variationDataSize}this.relativeOffset=x;let le={headers:M};return le.sharedPoints=W,le},pe.prototype.parseTupleVariationHeader=function(i,l){let c=this.parseUShort(),f=this.parseUShort(),m=!!(f&On.EMBEDDED_PEAK_TUPLE),x=!!(f&On.INTERMEDIATE_REGION),w=!!(f&On.PRIVATE_POINT_NUMBERS),C=m?void 0:f&On.TUPLE_INDEX_MASK,k=m?this.parseTupleRecords(1,i)[0]:void 0,N=x?this.parseTupleRecords(1,i)[0]:void 0,M=x?this.parseTupleRecords(1,i)[0]:void 0,W={variationDataSize:c,peakTuple:k,intermediateStartTuple:N,intermediateEndTuple:M,flags:{embeddedPeakTuple:m,intermediateRegion:x,privatePointNumbers:w}};return l==="gvar"&&(W.sharedTupleRecordsIndex=C),W},pe.prototype.parsePackedPointNumbers=function(){let i=this.parseByte(),l=[],c=i;if(i>=128){let m=this.parseByte();c=(i&On.POINT_RUN_COUNT_MASK)<<8|m}let f=0;for(;l.length<c;){let m=this.parseByte(),x=!!(m&On.POINTS_ARE_WORDS),w=(m&On.POINT_RUN_COUNT_MASK)+1;for(let C=0;C<w&&l.length<c;C++){let k;x?k=this.parseUShort():k=this.parseByte(),f=f+k,l.push(f)}}return l},pe.prototype.parsePackedDeltas=function(i){let l=[];for(;l.length<i;){let c=this.parseByte(),f=!!(c&On.DELTAS_ARE_ZERO),m=!!(c&On.DELTAS_ARE_WORDS),x=(c&On.DELTA_RUN_COUNT_MASK)+1;for(let w=0;w<x&&l.length<i;w++)f?l.push(0):m?l.push(this.parseShort()):l.push(this.parseChar())}return l};var Ue={getByte:hr,getCard8:hr,getUShort:jn,getCard16:jn,getShort:Ne,getUInt24:Pn,getULong:dt,getFixed:In,getTag:Sr,getOffset:fn,getBytes:Qn,bytesToString:Br,Parser:pe},as=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],_s={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"},$r={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},Ls={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 ko(i,l,c){switch(i){case 0:if(l===65535)return"und";if(c)return c[l];break;case 1:return _s[l];case 3:return Ls[l]}}var Jr="utf-16",Ir={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"},rr={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 sr(i,l,c){switch(i){case 0:return Jr;case 1:return rr[c]||Ir[l];case 3:if(l===1||l===10)return Jr;break}}var ri={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function nr(i){return ri[i]}function Yn(i,l,c){let f={},m=new Ue.Parser(i,l),x=m.parseUShort(),w=m.parseUShort(),C=m.offset+m.parseUShort();for(let k=0;k<w;k++){let N=m.parseUShort(),M=m.parseUShort(),W=m.parseUShort(),G=m.parseUShort(),le=as[G]||G,ne=m.parseUShort(),me=m.parseUShort(),He=ko(N,W,c),Gt=sr(N,M,W),Ft=nr(N);if(Gt!==void 0&&He!==void 0&&Ft!==void 0){let rn;if(Gt===Jr?rn=Ct.UTF16(i,C+me,ne):rn=Ct.MACSTRING(i,C+me,ne,Gt),rn){let kn=f[Ft];kn===void 0&&(kn=f[Ft]={});let mr=kn[le];mr===void 0&&(mr=kn[le]={}),mr[He]=rn}}}return x===1&&m.parseUShort(),f}function dn(i){let l={};for(let c in i)l[i[c]]=parseInt(c);return l}function Sn(i,l,c,f,m,x){return new Be.Record("NameRecord",[{name:"platformID",type:"USHORT",value:i},{name:"encodingID",type:"USHORT",value:l},{name:"languageID",type:"USHORT",value:c},{name:"nameID",type:"USHORT",value:f},{name:"length",type:"USHORT",value:m},{name:"offset",type:"USHORT",value:x}])}function an(i,l){let c=i.length,f=l.length-c+1;e:for(let m=0;m<f;m++)for(;m<f;m++){for(let x=0;x<c;x++)if(l[m+x]!==i[x])continue e;return m}return-1}function bn(i,l){let c=an(i,l);if(c<0){c=l.length;let f=0,m=i.length;for(;f<m;++f)l.push(i[f])}return c}function Pr(i,l){let c=dn(ri),f=dn(_s),m=dn(Ls),x=[],w=[];for(let k in i){let N,M=[],W={},G=dn(as),le=c[k];for(let ne in i[k]){let me=G[ne];if(me===void 0&&(me=ne),N=parseInt(me),isNaN(N))throw new Error('Name table entry "'+ne+'" does not exist, see nameTableNames for complete list.');W[N]=i[k][ne],M.push(N)}for(let ne=0;ne<M.length;ne++){N=M[ne];let me=W[N];for(let He in me){let Gt=me[He];if(le===1||le===0){let Ft=f[He],rn=$r[Ft],kn=sr(le,rn,Ft),mr=Le.MACSTRING(Gt,kn);if(le===0&&(Ft=l.indexOf(He),Ft<0&&(Ft=l.length,l.push(He)),rn=4,mr=Le.UTF16(Gt)),mr!==void 0){let kr=bn(mr,w);x.push(Sn(le,rn,Ft,N,mr.length,kr))}}if(le===3){let Ft=m[He];if(Ft!==void 0){let rn=Le.UTF16(Gt),kn=bn(rn,w);x.push(Sn(3,1,Ft,N,rn.length,kn))}}}}}x.sort(function(k,N){return k.platformID-N.platformID||k.encodingID-N.encodingID||k.languageID-N.languageID||k.nameID-N.nameID});let C=new Be.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:x.length},{name:"stringOffset",type:"USHORT",value:6+x.length*12}]);for(let k=0;k<x.length;k++)C.fields.push({name:"record_"+k,type:"RECORD",value:x[k]});return C.fields.push({name:"strings",type:"LITERAL",value:w}),C}function Ht(i,l,c=[]){if(l<256&&l in as){if(c.length&&!c.includes(parseInt(l)))return;l=as[l]}for(let f in i)for(let m in i[f])if(m===l||parseInt(m)===l)return i[f][m]}var Cr={parse:Yn,make:Pr,getNameByID:Ht};function ln(i,l,c,f){i.length=l.parseUShort(),i.language=l.parseUShort()-1;let m=l.parseByteList(i.length),x=Object.assign({},m),w=sr(c,f,i.language),C=yt[w];for(let k=0;k<C.length;k++)x[C.charCodeAt(k)]=m[128+k];i.glyphIndexMap=x}function Ur(i,l,c){l.parseUShort(),i.length=l.parseULong(),i.language=l.parseULong();let f;i.groupCount=f=l.parseULong(),i.glyphIndexMap={};for(let m=0;m<f;m+=1){let x=l.parseULong(),w=l.parseULong(),C=l.parseULong();for(let k=x;k<=w;k+=1)i.glyphIndexMap[k]=C,c===12&&C++}}function Os(i,l,c,f,m){i.length=l.parseUShort(),i.language=l.parseUShort();let x;i.segCount=x=l.parseUShort()>>1,l.skip("uShort",3),i.glyphIndexMap={};let w=new Ue.Parser(c,f+m+14),C=new Ue.Parser(c,f+m+16+x*2),k=new Ue.Parser(c,f+m+16+x*4),N=new Ue.Parser(c,f+m+16+x*6),M=f+m+16+x*8;for(let W=0;W<x-1;W+=1){let G,le=w.parseUShort(),ne=C.parseUShort(),me=k.parseShort(),He=N.parseUShort();for(let Gt=ne;Gt<=le;Gt+=1)He!==0?(M=N.offset+N.relativeOffset-2,M+=He,M+=(Gt-ne)*2,G=Ue.getUShort(c,M),G!==0&&(G=G+me&65535)):G=Gt+me&65535,i.glyphIndexMap[Gt]=G}}function ls(i,l){let c={};l.skip("uLong");let f=l.parseULong();for(let m=0;m<f;m+=1){let x=l.parseUInt24(),w={varSelector:x},C=l.parseOffset32(),k=l.parseOffset32(),N=l.relativeOffset;C&&(l.relativeOffset=C,w.defaultUVS=l.parseStruct({ranges:function(){return l.parseRecordList32({startUnicodeValue:l.parseUInt24,additionalCount:l.parseByte})}})),k&&(l.relativeOffset=k,w.nonDefaultUVS=l.parseStruct({uvsMappings:function(){let M={},W=l.parseRecordList32({unicodeValue:l.parseUInt24,glyphID:l.parseUShort});for(let G=0;G<W.length;G+=1)M[W[G].unicodeValue]=W[G];return M}})),c[x]=w,l.relativeOffset=N}i.varSelectorList=c}function yr(i,l){let c={};c.version=Ue.getUShort(i,l),J.argument(c.version===0,"cmap table version should be 0."),c.numTables=Ue.getUShort(i,l+2);let f=null,m=-1,x=-1,w=null,C=null,k=[0,1,2,3,4,6],N=[0,1,10];for(let W=c.numTables-1;W>=0;W-=1)if(w=Ue.getUShort(i,l+4+W*8),C=Ue.getUShort(i,l+4+W*8+2),w===3&&N.includes(C)||w===0&&k.includes(C)||w===1&&C===0){if(x>0)continue;if(x=Ue.getULong(i,l+4+W*8+4),f)break}else if(w===0&&C===5){if(m=Ue.getULong(i,l+4+W*8+4),f=new Ue.Parser(i,l+m),f.parseUShort()!==14)m=-1,f=null;else if(x>0)break}if(x===-1)throw new Error("No valid cmap sub-tables found.");let M=new Ue.Parser(i,l+x);if(c.format=M.parseUShort(),c.format===0)ln(c,M,w,C);else if(c.format===12||c.format===13)Ur(c,M,c.format);else if(c.format===4)Os(c,M,i,l,x);else throw new Error("Only format 0 (platformId 1, encodingId 0), 4, 12 and 14 cmap tables are supported (found format "+c.format+", platformId "+w+", encodingId "+C+").");return f&&ls(c,f),c}function ks(i,l,c){i.segments.push({end:l,start:l,delta:-(l-c),offset:0,glyphIndex:c})}function $n(i){i.segments.push({end:65535,start:65535,delta:1,offset:0})}function cs(i){if(i.length===0)return i;let l=[i[0]];for(let c=1;c<i.length;c++){let f=l[l.length-1],m=i[c];f.end+1===m.start&&f.delta===m.delta&&m.end!==65535?f.end=m.end:l.push(m)}return l}function si(i){let l=!0,c;for(c=i.length-1;c>0;c-=1)if(i.get(c).unicode>65535){l=!1;break}let f=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:l?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:l?12:20}];l||f.push({name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}),f.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 m=new Be.Table("cmap",f);for(m.segments=[],c=0;c<i.length;c+=1){let le=i.get(c);for(let ne=0;ne<le.unicodes.length;ne+=1)ks(m,le.unicodes[ne],c)}m.segments.sort(function(le,ne){return le.start-ne.start}),m.segments=cs(m.segments),$n(m);let x=m.segments.length,w=0,C=[],k=[],N=[],M=[],W=[],G=[];for(c=0;c<x;c+=1){let le=m.segments[c];le.end<=65535&&le.start<=65535?(C.push({name:"end_"+c,type:"USHORT",value:le.end}),k.push({name:"start_"+c,type:"USHORT",value:le.start}),N.push({name:"idDelta_"+c,type:"SHORT",value:le.delta}),M.push({name:"idRangeOffset_"+c,type:"USHORT",value:le.offset}),le.glyphId!==void 0&&W.push({name:"glyph_"+c,type:"USHORT",value:le.glyphId})):w+=1,!l&&le.glyphIndex!==void 0&&(G.push({name:"cmap12Start_"+c,type:"ULONG",value:le.start}),G.push({name:"cmap12End_"+c,type:"ULONG",value:le.end}),G.push({name:"cmap12Glyph_"+c,type:"ULONG",value:le.glyphIndex}))}m.segCountX2=(x-w)*2,m.searchRange=Math.pow(2,Math.floor(Math.log(x-w)/Math.log(2)))*2,m.entrySelector=Math.log(m.searchRange/2)/Math.log(2),m.rangeShift=m.segCountX2-m.searchRange;for(let le=0;le<C.length;le++)m.fields.push(C[le]);m.fields.push({name:"reservedPad",type:"USHORT",value:0});for(let le=0;le<k.length;le++)m.fields.push(k[le]);for(let le=0;le<N.length;le++)m.fields.push(N[le]);for(let le=0;le<M.length;le++)m.fields.push(M[le]);for(let le=0;le<W.length;le++)m.fields.push(W[le]);if(m.cmap4Length=14+C.length*2+2+k.length*2+N.length*2+M.length*2+W.length*2,!l){let le=16+G.length*4;m.cmap12Offset=20+m.cmap4Length,m.fields.push({name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:le},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:G.length/3});for(let ne=0;ne<G.length;ne++)m.fields.push(G[ne])}return m}var uo={parse:yr,make:si},es=[".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"],Y=[".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"],he=[".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"],Ke=[".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"],_e=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Ie=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Ge=[".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 lt(i){this.font=i}lt.prototype.charToGlyphIndex=function(i){let l=i.codePointAt(0),c=this.font.glyphs;if(c)for(let f=0;f<c.length;f+=1){let m=c.get(f);for(let x=0;x<m.unicodes.length;x+=1)if(m.unicodes[x]===l)return f}return null};function et(i){this.cmap=i}et.prototype.charToGlyphIndex=function(i){return this.cmap.glyphIndexMap[i.codePointAt(0)]||0};function Ze(i,l){this.encoding=i,this.charset=l}Ze.prototype.charToGlyphIndex=function(i){let l=i.codePointAt(0),c=this.encoding[l];return this.charset.indexOf(c)};function it(i){switch(i.version){case 1:this.names=Ge.slice();break;case 2:this.names=new Array(i.numberOfGlyphs);for(let l=0;l<i.numberOfGlyphs;l++)i.glyphNameIndex[l]<Ge.length?this.names[l]=Ge[i.glyphNameIndex[l]]:this.names[l]=i.names[i.glyphNameIndex[l]-Ge.length];break;case 2.5:this.names=new Array(i.numberOfGlyphs);for(let l=0;l<i.numberOfGlyphs;l++)this.names[l]=Ge[l+i.glyphNameIndex[l]];break;case 3:this.names=[];break;default:this.names=[];break}}it.prototype.nameToGlyphIndex=function(i){return this.names.indexOf(i)},it.prototype.glyphIndexToName=function(i){return this.names[i]};function pn(i){let l,c=i.tables.cmap.glyphIndexMap,f=Object.keys(c);for(let m=0;m<f.length;m+=1){let x=f[m],w=c[x];l=i.glyphs.get(w),l.addUnicode(parseInt(x))}for(let m=0;m<i.glyphs.length;m+=1)l=i.glyphs.get(m),i.cffEncoding?l.name=i.cffEncoding.charset[m]:i.glyphNames.names&&(l.name=i.glyphNames.glyphIndexToName(m))}function vt(i){i._IndexToUnicodeMap={};let l=i.tables.cmap.glyphIndexMap,c=Object.keys(l);for(let f=0;f<c.length;f+=1){let m=c[f],x=l[m];i._IndexToUnicodeMap[x]===void 0?i._IndexToUnicodeMap[x]={unicodes:[parseInt(m)]}:i._IndexToUnicodeMap[x].unicodes.push(parseInt(m))}}function mn(i,l){l.lowMemory?vt(i):pn(i)}function ct(i,l,c,f,m){i.beginPath(),i.moveTo(l,c),i.lineTo(f,m),i.stroke()}var Pt={line:ct};function Xt(i,l){let c=new pe(i,l),f=c.parseShort();f!==0&&console.warn("Only CPALv0 is currently fully supported.");let m=c.parseShort(),x=c.parseShort(),w=c.parseShort(),C=c.parseOffset32(),k=c.parseUShortList(x);c.relativeOffset=C;let N=c.parseULongList(w);return c.relativeOffset=C,{version:f,numPaletteEntries:m,colorRecords:N,colorRecordIndices:k}}function hn({version:i=0,numPaletteEntries:l=0,colorRecords:c=[],colorRecordIndices:f=[0]}){return J.argument(i===0,"Only CPALv0 are supported."),J.argument(c.length,"No colorRecords given."),J.argument(f.length,"No colorRecordIndices given."),f.length>1&&J.argument(l,"Can't infer numPaletteEntries on multiple colorRecordIndices"),new Be.Table("CPAL",[{name:"version",type:"USHORT",value:i},{name:"numPaletteEntries",type:"USHORT",value:l||c.length},{name:"numPalettes",type:"USHORT",value:f.length},{name:"numColorRecords",type:"USHORT",value:c.length},{name:"colorRecordsArrayOffset",type:"ULONG",value:12+2*f.length},...f.map((m,x)=>({name:"colorRecordIndices_"+x,type:"USHORT",value:m})),...c.map((m,x)=>({name:"colorRecords_"+x,type:"ULONG",value:m}))])}function Tn(i){var l=(i&4278190080)>>24,c=(i&16711680)>>16,f=(i&65280)>>8,m=i&255;return l=l+256&255,c=c+256&255,f=f+256&255,m=(m+256&255)/255,{b:l,g:c,r:f,a:m}}function br(i,l,c=0,f="hexa"){if(l==65535)return"currentColor";let m=i&&i.tables&&i.tables.cpal;if(!m)return"currentColor";if(c>m.colorRecordIndices.length-1)throw new Error(`Palette index out of range (colorRecordIndices.length: ${m.colorRecordIndices.length}, index: ${l})`);if(l>m.numPaletteEntries)throw new Error(`Color index out of range (numPaletteEntries: ${m.numPaletteEntries}, index: ${l})`);let x=m.colorRecordIndices[c]+l;if(x>m.colorRecords)throw new Error(`Color index out of range (colorRecords.length: ${m.colorRecords.length}, lookupIndex: ${x})`);let w=Tn(m.colorRecords[x]);return f==="bgra"?w:$s(w,f)}function vr(i){return("0"+parseInt(i).toString(16)).slice(-2)}function us(i){let l=i.r/255,c=i.g/255,f=i.b/255,m=Math.max(l,c,f),x=Math.min(l,c,f),w,C,k=(m+x)/2;if(m===x)w=C=0;else{let N=m-x;switch(C=k>.5?N/(2-m-x):N/(m+x),m){case l:w=(c-f)/N+(c<f?6:0);break;case c:w=(f-l)/N+2;break;case f:w=(l-c)/N+4;break}w/=6}return{h:w*360,s:C*100,l:k*100}}function Fs(i){let{h:l,s:c,l:f,a:m}=i;l=l%360,c/=100,f/=100;let x=(1-Math.abs(2*f-1))*c,w=x*(1-Math.abs(l/60%2-1)),C=f-x/2,k=0,N=0,M=0;return 0<=l&&l<60?(k=x,N=w,M=0):60<=l&&l<120?(k=w,N=x,M=0):120<=l&&l<180?(k=0,N=x,M=w):180<=l&&l<240?(k=0,N=w,M=x):240<=l&&l<300?(k=w,N=0,M=x):300<=l&&l<=360&&(k=x,N=0,M=w),{r:Math.round((k+C)*255),g:Math.round((N+C)*255),b:Math.round((M+C)*255),a:m}}function Es(i){return parseInt(`0x${vr(i.b)}${vr(i.g)}${vr(i.r)}${vr(i.a*255)}`,16)}function js(i,l="hexa"){let c=l=="raw"||l=="cpal",f=Number.isInteger(i),m=!0;if(f&&c||i==="currentColor")return i;if(typeof i=="object"){if(l=="bgra")return i;if(c)return Es(i)}else if(!f&&/^#([a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})$/i.test(i.trim())){switch(i=i.trim().substring(1),i.length){case 3:i={r:parseInt(i[0].repeat(2),16),g:parseInt(i[1].repeat(2),16),b:parseInt(i[2].repeat(2),16),a:1};break;case 4:i={r:parseInt(i[0].repeat(2),16),g:parseInt(i[1].repeat(2),16),b:parseInt(i[2].repeat(2),16),a:parseInt(i[3].repeat(2),16)/255};break;case 6:i={r:parseInt(i[0]+i[1],16),g:parseInt(i[2]+i[3],16),b:parseInt(i[4]+i[5],16),a:1};break;case 8:i={r:parseInt(i[0]+i[1],16),g:parseInt(i[2]+i[3],16),b:parseInt(i[4]+i[5],16),a:parseInt(i[6]+i[7],16)/255};break}if(l=="bgra")return i}else if(typeof document<"u"&&/^[a-z]+$/i.test(i)){let x=document.createElement("canvas").getContext("2d");x.fillStyle=i;let w=$s(x.fillStyle,"hexa");w==="#000000ff"&&i.toLowerCase()!=="black"?m=!1:i=w}else{i=i.trim();let x=/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(x.test(i)){let w=i.match(x).filter(C=>typeof C<"u");i={r:Math.round(parseFloat(w[1])/(w[2]?.39215686274509803:1)),g:Math.round(parseFloat(w[3])/(w[4]?.39215686274509803:1)),b:Math.round(parseFloat(w[5])/(w[6]?.39215686274509803:1)),a:w[7]?parseFloat(w[7])/(w[8]?100:1):1}}else{let w=/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(w.test(i)){let C=i.match(w).filter(k=>typeof k<"u");i=Fs({h:parseFloat(C[1])*(C[2]==="turn"?360:1),s:parseFloat(C[3]),l:parseFloat(C[4]),a:C[5]?parseFloat(C[5])/(C[6]?100:1):1})}else m=!1}}if(!m)throw new Error(`Invalid color format: ${i}`);return $s(i,l)}function $s(i,l="hexa"){if(i==="currentColor")return i;if(Number.isInteger(i)){if(l=="raw"||l=="cpal")return i;i=Tn(i)}else typeof i!="object"&&(i=js(i,"bgra"));let c=["hsl","hsla"].includes(l)?us(i):null;switch(l){case"rgba":return`rgba(${i.r}, ${i.g}, ${i.b}, ${parseFloat(i.a.toFixed(3))})`;case"rgb":return`rgb(${i.r}, ${i.g}, ${i.b})`;case"hex":case"hex6":case"hex-6":return`#${vr(i.r)}${vr(i.g)}${vr(i.b)}`;case"hexa":case"hex8":case"hex-8":return`#${vr(i.r)}${vr(i.g)}${vr(i.b)}${vr(i.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(i.a.toFixed(3))})`;case"bgra":return i;case"raw":case"cpal":return Es(i);default:throw new Error("Unknown color format: "+l)}}var Ki={parse:Xt,make:hn,getPaletteColor:br,parseColor:js,formatColor:$s};function Rr(i,l){let c=l||new rt;return{configurable:!0,get:function(){return typeof c=="function"&&(c=c()),c},set:function(f){c=f}}}function Nn(i){this.bindConstructorValues(i)}Nn.prototype.bindConstructorValues=function(i){if(this.index=i.index||0,i.name===".notdef"?i.unicode=void 0:i.name===".null"&&(i.unicode=0),i.unicode===0&&i.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=i.name||null,this.unicode=i.unicode,this.unicodes=i.unicodes||(i.unicode!==void 0?[i.unicode]:[]),"xMin"in i&&(this.xMin=i.xMin),"yMin"in i&&(this.yMin=i.yMin),"xMax"in i&&(this.xMax=i.xMax),"yMax"in i&&(this.yMax=i.yMax),"advanceWidth"in i&&(this.advanceWidth=i.advanceWidth),"leftSideBearing"in i&&(this.leftSideBearing=i.leftSideBearing),"points"in i&&(this.points=i.points),Object.defineProperty(this,"path",Rr(this,i.path))},Nn.prototype.addUnicode=function(i){this.unicodes.length===0&&(this.unicode=i),this.unicodes.push(i)},Nn.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},Nn.prototype.getPath=function(i,l,c,f,m){i=i!==void 0?i:0,l=l!==void 0?l:0,c=c!==void 0?c:72,f=Object.assign({},m&&m.defaultRenderOptions,f);let x,w,C=f.xScale,k=f.yScale,N=1/(this.path.unitsPerEm||1e3)*c,M=this;m&&m.variation&&(M=m.variation.getTransform(this,f.variation),x=M.path.commands),f.hinting&&m&&m.hinting&&(w=M.path&&m.hinting.exec(M,c,f)),w?(x=m.hinting.getCommands(w),i=Math.round(i),l=Math.round(l),C=k=1):(x=M.path.commands,C===void 0&&(C=N),k===void 0&&(k=N));let W=new rt;if(f.drawSVG){let G=this.getSvgImage(m);if(G){let le=new rt;return le._image={image:G.image,x:i+G.leftSideBearing*N,y:l-G.baseline*N,width:G.image.width*N,height:G.image.height*N},W._layers=[le],W}}if(f.drawLayers){let G=this.getLayers(m);if(G&&G.length){W._layers=[];for(let le=0;le<G.length;le+=1){let ne=G[le],me=br(m,ne.paletteIndex,f.usePalette);me==="currentColor"?me=f.fill||"black":me=$s(me,f.colorFormat||"rgba"),f=Object.assign({},f,{fill:me}),W._layers.push(this.getPath.call(ne.glyph,i,l,c,f,m))}return W}}W.fill=f.fill||this.path.fill,W.stroke=this.path.stroke,W.strokeWidth=this.path.strokeWidth*N;for(let G=0;G<x.length;G+=1){let le=x[G];le.type==="M"?W.moveTo(i+le.x*C,l+-le.y*k):le.type==="L"?W.lineTo(i+le.x*C,l+-le.y*k):le.type==="Q"?W.quadraticCurveTo(i+le.x1*C,l+-le.y1*k,i+le.x*C,l+-le.y*k):le.type==="C"?W.curveTo(i+le.x1*C,l+-le.y1*k,i+le.x2*C,l+-le.y2*k,i+le.x*C,l+-le.y*k):le.type==="Z"&&W.stroke&&W.strokeWidth&&W.closePath()}return W},Nn.prototype.getLayers=function(i){if(!i)throw new Error("The font object is required to read the colr/cpal tables in order to get the layers.");return i.layers.get(this.index)},Nn.prototype.getSvgImage=function(i){if(!i)throw new Error("The font object is required to read the svg table in order to get the image.");return i.svgImages.get(this.index)},Nn.prototype.getContours=function(i=null){if(this.points===void 0&&!i)return[];let l=[],c=[],f=i||this.points;for(let m=0;m<f.length;m+=1){let x=f[m];c.push(x),x.lastPointOfContour&&(l.push(c),c=[])}return J.argument(c.length===0,"There are still points left in the current contour."),l},Nn.prototype.getMetrics=function(){let i=this.path.commands,l=[],c=[];for(let m=0;m<i.length;m+=1){let x=i[m];x.type!=="Z"&&(l.push(x.x),c.push(x.y)),(x.type==="Q"||x.type==="C")&&(l.push(x.x1),c.push(x.y1)),x.type==="C"&&(l.push(x.x2),c.push(x.y2))}let f={xMin:Math.min.apply(null,l),yMin:Math.min.apply(null,c),xMax:Math.max.apply(null,l),yMax:Math.max.apply(null,c),leftSideBearing:this.leftSideBearing};return isFinite(f.xMin)||(f.xMin=0),isFinite(f.xMax)||(f.xMax=this.advanceWidth),isFinite(f.yMin)||(f.yMin=0),isFinite(f.yMax)||(f.yMax=0),f.rightSideBearing=this.advanceWidth-f.leftSideBearing-(f.xMax-f.xMin),f},Nn.prototype.draw=function(i,l,c,f,m,x){m=Object.assign({},x&&x.defaultRenderOptions,m),this.getPath(l,c,f,m,x).draw(i)},Nn.prototype.drawPoints=function(i,l,c,f,m,x){if(m=Object.assign({},x&&x.defaultRenderOptions,m),m.drawLayers){let W=this.getLayers(x);if(W&&W.length){for(let G=0;G<W.length;G+=1)W[G].glyph.index!==this.index&&this.drawPoints.call(W[G].glyph,i,l,c,f);return}}function w(W,G,le,ne){i.beginPath();for(let me=0;me<W.length;me+=1)i.moveTo(G+W[me].x*ne,le+W[me].y*ne),i.arc(G+W[me].x*ne,le+W[me].y*ne,2,0,Math.PI*2,!1);i.fill()}l=l!==void 0?l:0,c=c!==void 0?c:0,f=f!==void 0?f:24;let C=1/this.path.unitsPerEm*f,k=[],N=[],M=this.path.commands;x&&x.variation&&(M=x.variation.getTransform(this,m.variation).path.commands);for(let W=0;W<M.length;W+=1){let G=M[W];G.x!==void 0&&k.push({x:G.x,y:-G.y}),G.x1!==void 0&&N.push({x:G.x1,y:-G.y1}),G.x2!==void 0&&N.push({x:G.x2,y:-G.y2})}i.fillStyle="blue",w(k,l,c,C),i.fillStyle="red",w(N,l,c,C)},Nn.prototype.drawMetrics=function(i,l,c,f){let m;l=l!==void 0?l:0,c=c!==void 0?c:0,f=f!==void 0?f:24,m=1/this.path.unitsPerEm*f,i.lineWidth=1,i.strokeStyle="black",Pt.line(i,l,-1e4,l,1e4),Pt.line(i,-1e4,c,1e4,c);let x=this.xMin||0,w=this.yMin||0,C=this.xMax||0,k=this.yMax||0,N=this.advanceWidth||0;i.strokeStyle="blue",Pt.line(i,l+x*m,-1e4,l+x*m,1e4),Pt.line(i,l+C*m,-1e4,l+C*m,1e4),Pt.line(i,-1e4,c+-w*m,1e4,c+-w*m),Pt.line(i,-1e4,c+-k*m,1e4,c+-k*m),i.strokeStyle="green",Pt.line(i,l+N*m,-1e4,l+N*m,1e4)},Nn.prototype.toPathData=function(i,l){i=Object.assign({},{variation:l&&l.defaultRenderOptions.variation},i);let c=this;l&&l.variation&&(c=l.variation.getTransform(this,i.variation));let f=c.points&&i.pointsTransform?i.pointsTransform(c.points):c.path;return i.pathTransform&&(f=i.pathTransform(f)),f.toPathData(i)},Nn.prototype.fromSVG=function(i,l={}){return this.path.fromSVG(i,l)},Nn.prototype.toSVG=function(i,l){let c=this.toPathData.apply(this,[i,l]);return this.path.toSVG(i,c)},Nn.prototype.toDOMElement=function(i,l){i=Object.assign({},{variation:l&&l.defaultRenderOptions.variation},i);let c=this.path;return l&&l.variation&&(c=l.variation.getTransform(this,i.variation).path),c.toDOMElement(i)};var Dn=Nn;function Wr(i,l,c){Object.defineProperty(i,l,{get:function(){return typeof i[c]>"u"&&i.path,i[c]},set:function(f){i[c]=f},enumerable:!0,configurable:!0})}function ts(i,l){if(this.font=i,this.glyphs={},Array.isArray(l))for(let c=0;c<l.length;c++){let f=l[c];f.path.unitsPerEm=i.unitsPerEm,this.glyphs[c]=f}this.length=l&&l.length||0}typeof Symbol<"u"&&Symbol.iterator&&(ts.prototype[Symbol.iterator]=function(){let i=-1;return{next:(function(){i++;let l=i>=this.length-1;return{value:this.get(i),done:l}}).bind(this)}}),ts.prototype.get=function(i){if(this.font._push&&this.glyphs[i]===void 0){this.font._push(i),typeof this.glyphs[i]=="function"&&(this.glyphs[i]=this.glyphs[i]());let l=this.glyphs[i],c=this.font._IndexToUnicodeMap[i];if(c)for(let f=0;f<c.unicodes.length;f++)l.addUnicode(c.unicodes[f]);this.font.cffEncoding?l.name=this.font.cffEncoding.charset[i]:this.font.glyphNames.names&&(l.name=this.font.glyphNames.glyphIndexToName(i)),this.glyphs[i].advanceWidth=this.font._hmtxTableData[i].advanceWidth,this.glyphs[i].leftSideBearing=this.font._hmtxTableData[i].leftSideBearing}else typeof this.glyphs[i]=="function"&&(this.glyphs[i]=this.glyphs[i]());return this.glyphs[i]},ts.prototype.push=function(i,l){this.glyphs[i]=l,this.length++};function U(i,l){return new Dn({index:l,font:i})}function ee(i,l,c,f,m,x){return function(){let w=new Dn({index:l,font:i});return w.path=function(){c(w,f,m);let C=x(i.glyphs,w);return C.unitsPerEm=i.unitsPerEm,C},Wr(w,"numberOfContours","_numberOfContours"),Wr(w,"xMin","_xMin"),Wr(w,"xMax","_xMax"),Wr(w,"yMin","_yMin"),Wr(w,"yMax","_yMax"),Wr(w,"points","_points"),w}}function fe(i,l,c,f,m){return function(){let x=new Dn({index:l,font:i});return x.path=function(){let w=c(i,x,f,m);return w.unitsPerEm=i.unitsPerEm,w},x}}var ke={GlyphSet:ts,glyphLoader:U,ttfGlyphLoader:ee,cffGlyphLoader:fe};function ht(i,l){if(i===l)return!0;if(Array.isArray(i)&&Array.isArray(l)){if(i.length!==l.length)return!1;for(let c=0;c<i.length;c+=1)if(!ht(i[c],l[c]))return!1;return!0}else return!1}var nt=10;function Bt(i){let l;return i.length<1240?l=107:i.length<33900?l=1131:l=32768,l}function _t(i,l,c,f){let m=[],x=[],w=f>1?Ue.getULong(i,l):Ue.getCard16(i,l),C=f>1?4:2,k,N;if(w!==0){let M=Ue.getByte(i,l+C);k=l+(w+1)*M+C;let W=l+C+1;for(let G=0;G<w+1;G+=1)m.push(Ue.getOffset(i,W,M)),W+=M;N=k+m[w]}else N=l+C;for(let M=0;M<m.length-1;M+=1){let W=Ue.getBytes(i,k+m[M],k+m[M+1]);c&&(W=c(W,i,l,f)),x.push(W)}return{objects:x,startOffset:l,endOffset:N}}function Nt(i,l,c){let f=[],m=c>1?Ue.getULong(i,l):Ue.getCard16(i,l),x=c>1?4:2,w,C;if(m!==0){let k=Ue.getByte(i,l+x);w=l+(m+1)*k+x;let N=l+x+1;for(let M=0;M<m+1;M+=1)f.push(Ue.getOffset(i,N,k)),N+=k;C=w+f[m]}else C=l+x;return{offsets:f,startOffset:l,endOffset:C}}function Fn(i,l,c,f,m,x){let w=x>1?Ue.getULong(c,f):Ue.getCard16(c,f),C=x>1?4:2,k=0;if(w!==0){let M=Ue.getByte(c,f+C);k=f+(w+1)*M+C}let N=Ue.getBytes(c,k+l[i],k+l[i+1]);return m&&(N=m(N)),N}function Cn(i){let l="",c=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){let f=i.parseByte(),m=f>>4,x=f&15;if(m===15||(l+=c[m],x===15))break;l+=c[x]}return parseFloat(l)}function nn(i,l){let c,f,m,x;if(l===28)return c=i.parseByte(),f=i.parseByte(),c<<8|f;if(l===29)return c=i.parseByte(),f=i.parseByte(),m=i.parseByte(),x=i.parseByte(),c<<24|f<<16|m<<8|x;if(l===30)return Cn(i);if(l>=32&&l<=246)return l-139;if(l>=247&&l<=250)return c=i.parseByte(),(l-247)*256+c+108;if(l>=251&&l<=254)return c=i.parseByte(),-(l-251)*256-c-108;throw new Error("Invalid b0 "+l)}function _n(i){let l={};for(let c=0;c<i.length;c+=1){let f=i[c][0],m=i[c][1],x;if(m.length===1?x=m[0]:x=m,Object.prototype.hasOwnProperty.call(l,f)&&!isNaN(l[f]))throw new Error("Object "+l+" already has key "+f);l[f]=x}return l}function ir(i,l,c,f){l=l!==void 0?l:0;let m=new Ue.Parser(i,l),x=[],w=[];c=c!==void 0?c:i.byteLength;let C=f<2?22:28;for(;m.relativeOffset<c;){let k=m.parseByte();if(k<C){if(k===12&&(k=1200+m.parseByte()),f>1&&k===23){Hs(w);continue}x.push([k,w]),w=[]}else w.push(nn(m,k,f))}return _n(x)}function _r(i,l){return l<=390?l=es[l]:i?l=i[l-391]:l=void 0,l}function Un(i,l,c){let f={},m;for(let x=0;x<l.length;x+=1){let w=l[x];if(Array.isArray(w.type)){let C=[];C.length=w.type.length;for(let k=0;k<w.type.length;k++)m=i[w.op]!==void 0?i[w.op][k]:void 0,m===void 0&&(m=w.value!==void 0&&w.value[k]!==void 0?w.value[k]:null),w.type[k]==="SID"&&(m=_r(c,m)),C[k]=m;f[w.name]=C}else m=i[w.op],m===void 0&&(m=w.value!==void 0?w.value:null),w.type==="SID"&&(m=_r(c,m)),f[w.name]=m}return f}function sn(i,l){let c={};if(c.formatMajor=Ue.getCard8(i,l),c.formatMinor=Ue.getCard8(i,l+1),c.formatMajor>2)throw new Error(`Unsupported CFF table version ${c.formatMajor}.${c.formatMinor}`);return c.size=Ue.getCard8(i,l+2),c.formatMajor<2?(c.offsetSize=Ue.getCard8(i,l+3),c.startOffset=l,c.endOffset=l+4):(c.topDictLength=Ue.getCard16(i,l+3),c.endOffset=l+8),c}var Ut=[{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"}],qt=[{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"}],vn=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}],Yt=[{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"}],on=[{name:"private",op:18,type:["number","offset"],value:[0,0]}];function or(i,l,c,f){let m=ir(i,l,i.byteLength,f);return Un(m,f>1?qt:Ut,c)}function Us(i,l,c,f,m){let x=ir(i,l,c,m);return Un(x,m>1?Yt:vn,f)}function Hr(i,l,c){let f=ir(i,l,void 0,c);return Un(f,on)}function ar(i,l,c){let f=[];for(let m=0;m<c.length;m++){let x=new DataView(new Uint8Array(c[m]).buffer),w=Hr(x,0,2),C=w.private[0],k=w.private[1];if(C!==0&&k!==0){let N=Us(i,k+l,C,[],2);if(N.subrs){let M=k+N.subrs,W=_t(i,M+l,void 0,2);w._subrs=W.objects,w._subrsBias=Bt(w._subrs)}w._privateDict=N}f.push(w)}return f}function Gn(i,l,c,f,m){let x=[];for(let w=0;w<c.length;w+=1){let C=new DataView(new Uint8Array(c[w]).buffer),k=or(C,0,f,m);k._subrs=[],k._subrsBias=0,k._defaultWidthX=0,k._nominalWidthX=0;let N=m<2?k.private[0]:0,M=m<2?k.private[1]:0;if(N!==0&&M!==0){let W=Us(i,M+l,N,f,m);if(k._defaultWidthX=W.defaultWidthX,k._nominalWidthX=W.nominalWidthX,W.subrs!==0){let G=M+W.subrs,le=_t(i,G+l,void 0,m);k._subrs=le.objects,k._subrsBias=Bt(k._subrs)}k._privateDict=W}x.push(k)}return x}function Xi(i,l,c,f,m){let x,w,C=new Ue.Parser(i,l);c-=1;let k=[".notdef"],N=C.parseCard8();if(N===0)for(let M=0;M<c;M+=1)x=C.parseSID(),m?k.push(x):k.push(_r(f,x)||x);else if(N===1)for(;k.length<=c;){x=C.parseSID(),w=C.parseCard8();for(let M=0;M<=w;M+=1)m?k.push("cid"+("00000"+x).slice(-5)):k.push(_r(f,x)||x),x+=1}else if(N===2)for(;k.length<=c;){x=C.parseSID(),w=C.parseCard16();for(let M=0;M<=w;M+=1)m?k.push("cid"+("00000"+x).slice(-5)):k.push(_r(f,x)||x),x+=1}else throw new Error("Unknown charset format "+N);return k}function Eo(i,l){let c,f={},m=new Ue.Parser(i,l),x=m.parseCard8();if(x===0){let w=m.parseCard8();for(let C=0;C<w;C+=1)c=m.parseCard8(),f[c]=C}else if(x===1){let w=m.parseCard8();c=1;for(let C=0;C<w;C+=1){let k=m.parseCard8(),N=m.parseCard8();for(let M=k;M<=k+N;M+=1)f[M]=c,c+=1}}else throw new Error("Unknown encoding format "+x);return f}function Hs(i){let l=i.pop();for(;i.length>l;)i.pop()}function ds(i,l){let c=i.tables.cff&&i.tables.cff.topDict&&i.tables.cff.topDict.paintType||0;return c===2&&(l.fill=null,l.stroke="black",l.strokeWidth=i.tables.cff.topDict.strokeWidth||0),c}function yi(i,l,c,f,m){let x,w,C,k,N=new rt,M=[],W=0,G=!1,le=!1,ne=0,me=0,He,Gt,Ft,rn,kn=0,mr=[],kr,Er=0,As=i.tables.cff2||i.tables.cff;if(Ft=As.topDict._defaultWidthX,rn=As.topDict._nominalWidthX,m=m||i.variation&&i.variation.get(),l.getBlendPath||(l.getBlendPath=function(Dt){return yi(i,l,c,f,Dt)}),i.isCIDFont||f>1){let Dt=As.topDict._fdSelect?As.topDict._fdSelect[l.index]:0,Qt=As.topDict._fdArray[Dt];He=Qt._subrs,Gt=Qt._subrsBias,f>1?(mr=As.topDict._vstore.itemVariationStore,kn=Qt._privateDict.vsindex):(Ft=Qt._defaultWidthX,rn=Qt._nominalWidthX)}else He=As.topDict._subrs,Gt=As.topDict._subrsBias;let oa=ds(i,N),En=Ft;function yo(Dt,Qt){le&&oa!==2&&N.closePath(),N.moveTo(Dt,Qt),le=!0}function Fi(){let Dt;Dt=(M.length&1)!==0,Dt&&!G&&(En=M.shift()+rn),W+=M.length>>1,M.length=0,G=!0}function Wt(Dt){let Qt,Ci,Sl,ud,Gl,aa,ji,Po,_i,bo,$i,Ui,xs=0;for(;xs<Dt.length;){let Oo=Dt[xs];switch(xs+=1,Oo){case 1:Fi();break;case 3:Fi();break;case 4:M.length>1&&!G&&(En=M.shift()+rn,G=!0),me+=M.pop(),yo(ne,me);break;case 5:for(;M.length>0;)ne+=M.shift(),me+=M.shift(),N.lineTo(ne,me);break;case 6:for(;M.length>0&&(ne+=M.shift(),N.lineTo(ne,me),M.length!==0);)me+=M.shift(),N.lineTo(ne,me);break;case 7:for(;M.length>0&&(me+=M.shift(),N.lineTo(ne,me),M.length!==0);)ne+=M.shift(),N.lineTo(ne,me);break;case 8:for(;M.length>0;)x=ne+M.shift(),w=me+M.shift(),C=x+M.shift(),k=w+M.shift(),ne=C+M.shift(),me=k+M.shift(),N.curveTo(x,w,C,k,ne,me);break;case 10:if(Gl=M.pop()+Gt,aa=He[Gl],aa){if(Er>=nt){console.warn("CFF charstring subroutine call depth exceeded, skipping callsubr");break}Er++,Wt(aa),Er--}break;case 11:if(f>1){console.error("CFF CharString operator return (11) is not supported in CFF2");break}return;case 12:switch(Oo=Dt[xs],xs+=1,Oo){case 35:x=ne+M.shift(),w=me+M.shift(),C=x+M.shift(),k=w+M.shift(),ji=C+M.shift(),Po=k+M.shift(),_i=ji+M.shift(),bo=Po+M.shift(),$i=_i+M.shift(),Ui=bo+M.shift(),ne=$i+M.shift(),me=Ui+M.shift(),M.shift(),N.curveTo(x,w,C,k,ji,Po),N.curveTo(_i,bo,$i,Ui,ne,me);break;case 34:x=ne+M.shift(),w=me,C=x+M.shift(),k=w+M.shift(),ji=C+M.shift(),Po=k,_i=ji+M.shift(),bo=k,$i=_i+M.shift(),Ui=me,ne=$i+M.shift(),N.curveTo(x,w,C,k,ji,Po),N.curveTo(_i,bo,$i,Ui,ne,me);break;case 36:x=ne+M.shift(),w=me+M.shift(),C=x+M.shift(),k=w+M.shift(),ji=C+M.shift(),Po=k,_i=ji+M.shift(),bo=k,$i=_i+M.shift(),Ui=bo+M.shift(),ne=$i+M.shift(),N.curveTo(x,w,C,k,ji,Po),N.curveTo(_i,bo,$i,Ui,ne,me);break;case 37:x=ne+M.shift(),w=me+M.shift(),C=x+M.shift(),k=w+M.shift(),ji=C+M.shift(),Po=k+M.shift(),_i=ji+M.shift(),bo=Po+M.shift(),$i=_i+M.shift(),Ui=bo+M.shift(),Math.abs($i-ne)>Math.abs(Ui-me)?ne=$i+M.shift():me=Ui+M.shift(),N.curveTo(x,w,C,k,ji,Po),N.curveTo(_i,bo,$i,Ui,ne,me);break;default:console.log("Glyph "+l.index+": unknown operator 1200"+Oo),M.length=0}break;case 14:if(f>1){console.error("CFF CharString operator endchar (14) is not supported in CFF2");break}if(M.length>=4){let Wl=_e[M.pop()],Ic=_e[M.pop()],dd=M.pop(),hd=M.pop();if(Wl&&Ic){l.isComposite=!0,l.components=[];let H1=i.cffEncoding.charset.indexOf(Wl),z1=i.cffEncoding.charset.indexOf(Ic);l.components.push({glyphIndex:z1,dx:0,dy:0}),l.components.push({glyphIndex:H1,dx:hd,dy:dd}),N.extend(i.glyphs.get(z1).path);let M8=i.glyphs.get(H1),_f=JSON.parse(JSON.stringify(M8.path.commands));for(let Lf=0;Lf<_f.length;Lf+=1){let _a=_f[Lf];_a.type!=="Z"&&(_a.x+=hd,_a.y+=dd),(_a.type==="Q"||_a.type==="C")&&(_a.x1+=hd,_a.y1+=dd),_a.type==="C"&&(_a.x2+=hd,_a.y2+=dd)}N.extend(_f)}}else M.length>0&&!G&&(En=M.shift()+rn,G=!0);le&&oa!==2&&(N.closePath(),le=!1);break;case 15:if(f<2){console.error("CFF2 CharString operator vsindex (15) is not supported in CFF");break}kn=M.pop();break;case 16:if(f<2){console.error("CFF2 CharString operator blend (16) is not supported in CFF");break}kr||(kr=i.variation&&m&&i.variation.process.getBlendVector(mr,kn,m));var Dr=M.pop(),ro=kr?kr.length:mr.itemVariationSubtables[kn].regionIndexes.length,Qo=Dr*ro,la=M.length-Qo,Va=la-Dr;if(kr)for(let Wl=0;Wl<Dr;Wl++){var U1=M[Va+Wl];for(let Ic=0;Ic<ro;Ic++)U1+=kr[Ic]*M[la++];M[Va+Wl]=U1}for(;Qo--;)M.pop();break;case 18:Fi();break;case 19:case 20:Fi(),xs+=W+7>>3;break;case 21:M.length>2&&!G&&(En=M.shift()+rn,G=!0),me+=M.pop(),ne+=M.pop(),yo(ne,me);break;case 22:M.length>1&&!G&&(En=M.shift()+rn,G=!0),ne+=M.pop(),yo(ne,me);break;case 23:Fi();break;case 24:for(;M.length>2;)x=ne+M.shift(),w=me+M.shift(),C=x+M.shift(),k=w+M.shift(),ne=C+M.shift(),me=k+M.shift(),N.curveTo(x,w,C,k,ne,me);ne+=M.shift(),me+=M.shift(),N.lineTo(ne,me);break;case 25:for(;M.length>6;)ne+=M.shift(),me+=M.shift(),N.lineTo(ne,me);x=ne+M.shift(),w=me+M.shift(),C=x+M.shift(),k=w+M.shift(),ne=C+M.shift(),me=k+M.shift(),N.curveTo(x,w,C,k,ne,me);break;case 26:for(M.length&1&&(ne+=M.shift());M.length>0;)x=ne,w=me+M.shift(),C=x+M.shift(),k=w+M.shift(),ne=C,me=k+M.shift(),N.curveTo(x,w,C,k,ne,me);break;case 27:for(M.length&1&&(me+=M.shift());M.length>0;)x=ne+M.shift(),w=me,C=x+M.shift(),k=w+M.shift(),ne=C+M.shift(),me=k,N.curveTo(x,w,C,k,ne,me);break;case 28:Qt=Dt[xs],Ci=Dt[xs+1],M.push((Qt<<24|Ci<<16)>>16),xs+=2;break;case 29:if(Gl=M.pop()+i.gsubrsBias,aa=i.gsubrs[Gl],aa){if(Er>=nt){console.warn("CFF charstring subroutine call depth exceeded, skipping callgsubr");break}Er++,Wt(aa),Er--}break;case 30:for(;M.length>0&&(x=ne,w=me+M.shift(),C=x+M.shift(),k=w+M.shift(),ne=C+M.shift(),me=k+(M.length===1?M.shift():0),N.curveTo(x,w,C,k,ne,me),M.length!==0);)x=ne+M.shift(),w=me,C=x+M.shift(),k=w+M.shift(),me=k+M.shift(),ne=C+(M.length===1?M.shift():0),N.curveTo(x,w,C,k,ne,me);break;case 31:for(;M.length>0&&(x=ne+M.shift(),w=me,C=x+M.shift(),k=w+M.shift(),me=k+M.shift(),ne=C+(M.length===1?M.shift():0),N.curveTo(x,w,C,k,ne,me),M.length!==0);)x=ne,w=me+M.shift(),C=x+M.shift(),k=w+M.shift(),ne=C+M.shift(),me=k+(M.length===1?M.shift():0),N.curveTo(x,w,C,k,ne,me);break;default:Oo<32?console.log("Glyph "+l.index+": unknown operator "+Oo):Oo<247?M.push(Oo-139):Oo<251?(Qt=Dt[xs],xs+=1,M.push((Oo-247)*256+Qt+108)):Oo<255?(Qt=Dt[xs],xs+=1,M.push(-(Oo-251)*256-Qt-108)):(Qt=Dt[xs],Ci=Dt[xs+1],Sl=Dt[xs+2],ud=Dt[xs+3],xs+=4,M.push((Qt<<24|Ci<<16|Sl<<8|ud)/65536))}}}return Wt(c),i.variation&&m&&(N.commands=N.commands.map(Dt=>{let Qt=Object.keys(Dt);for(let Ci=0;Ci<Qt.length;Ci++){let Sl=Qt[Ci];Sl!=="type"&&(Dt[Sl]=Math.round(Dt[Sl]))}return Dt})),G&&(l.advanceWidth=En),N}function Zn(i,l,c,f,m){let x=[],w,C=new Ue.Parser(i,l),k=C.parseCard8();if(k===0)for(let N=0;N<c;N++){if(w=C.parseCard8(),w>=f)throw new Error("CFF table CID Font FDSelect has bad FD index value "+w+" (FD count "+f+")");x.push(w)}else if(k===3||m>1&&k===4){let N=k===4?C.parseULong():C.parseCard16(),M=k===4?C.parseULong():C.parseCard16();if(M!==0)throw new Error(`CFF Table CID Font FDSelect format ${k} range has bad initial GID ${M}`);let W;for(let G=0;G<N;G++){if(w=k===4?C.parseUShort():C.parseCard8(),W=k===4?C.parseULong():C.parseCard16(),w>=f)throw new Error("CFF table CID Font FDSelect has bad FD index value "+w+" (FD count "+f+")");if(W>c)throw new Error(`CFF Table CID Font FDSelect format ${m} range has bad GID ${W}`);for(;M<W;M++)x.push(w);M=W}if(W!==c)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final (Sentinal) GID "+W)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+k);return x}function Ei(i,l,c,f){let m,x=sn(i,l);x.formatMajor===2?m=c.tables.cff2={}:m=c.tables.cff={};let w=x.formatMajor>1?null:_t(i,x.endOffset,Ue.bytesToString),C=x.formatMajor>1?null:_t(i,w.endOffset),k=x.formatMajor>1?null:_t(i,C.endOffset,Ue.bytesToString),N=_t(i,x.formatMajor>1?l+x.size+x.topDictLength:k.endOffset,void 0,x.formatMajor);c.gsubrs=N.objects,c.gsubrsBias=Bt(c.gsubrs);let M;if(x.formatMajor>1){let G=l+x.size,le=Ue.getBytes(i,G,G+x.topDictLength);M=Gn(i,0,[le],void 0,x.formatMajor)[0]}else{let G=Gn(i,l,C.objects,k.objects,x.formatMajor);if(G.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+G.length);M=G[0]}if(m.topDict=M,M._privateDict&&(c.defaultWidthX=M._privateDict.defaultWidthX,c.nominalWidthX=M._privateDict.nominalWidthX),x.formatMajor<2&&M.ros[0]!==void 0&&M.ros[1]!==void 0&&(c.isCIDFont=!0),x.formatMajor>1){let G=M.fdArray,le=M.fdSelect;if(!G)throw new Error("This is a CFF2 font, but FDArray information is missing");let ne=_t(i,l+G,null,x.formatMajor),me=ar(i,l,ne.objects);M._fdArray=me,le&&(M._fdSelect=Zn(i,l+le,c.numGlyphs,me.length,x.formatMajor))}else if(c.isCIDFont){let G=M.fdArray,le=M.fdSelect;if(G===0||le===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");G+=l;let ne=_t(i,G),me=Gn(i,l,ne.objects,k.objects,x.formatMajor);M._fdArray=me,le+=l,M._fdSelect=Zn(i,le,c.numGlyphs,me.length,x.formatMajor)}if(x.formatMajor<2){let G=l+M.private[1],le=Us(i,G,M.private[0],k.objects,x.formatMajor);if(c.defaultWidthX=le.defaultWidthX,c.nominalWidthX=le.nominalWidthX,le.subrs!==0){let ne=G+le.subrs,me=_t(i,ne);c.subrs=me.objects,c.subrsBias=Bt(c.subrs)}else c.subrs=[],c.subrsBias=0}let W;if(f.lowMemory?(W=Nt(i,l+M.charStrings,x.formatMajor),c.nGlyphs=W.offsets.length-(x.formatMajor>1?1:0)):(W=_t(i,l+M.charStrings,null,x.formatMajor),c.nGlyphs=W.objects.length),x.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})`),x.formatMajor<2){let G=[],le=[];M.charset===0?G=Y:M.charset===1?G=he:M.charset===2?G=Ke:G=Xi(i,l+M.charset,c.nGlyphs,k.objects,c.isCIDFont),M.encoding===0?le=_e:M.encoding===1?le=Ie:le=Eo(i,l+M.encoding),c.cffEncoding=new Ze(le,G),c.encoding=c.encoding||c.cffEncoding}if(c.glyphs=new ke.GlyphSet(c),f.lowMemory)c._push=function(G){let le=Fn(G,W.offsets,i,l+M.charStrings,void 0,x.formatMajor);c.glyphs.push(G,ke.cffGlyphLoader(c,G,yi,le,x.formatMajor))};else for(let G=0;G<c.nGlyphs;G+=1){let le=W.objects[G];c.glyphs.push(G,ke.cffGlyphLoader(c,G,yi,le,x.formatMajor))}if(M.vstore){let G=new Ue.Parser(i,l+M.vstore);M._vstore=G.parseVariationStore()}}function Is(i,l){let c,f=es.indexOf(i);return f>=0&&(c=f),f=l.indexOf(i),f>=0?c=f+es.length:(c=es.length+l.length,l.push(i)),c}function Xo(){return new Be.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 Ji(i){let l=new Be.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);l.names=[];for(let c=0;c<i.length;c+=1)l.names.push({name:"name_"+c,type:"NAME",value:i[c]});return l}function ho(i,l,c){let f={};for(let m=0;m<i.length;m+=1){let x=i[m],w=l[x.name];w!==void 0&&!ht(w,x.value)&&(x.type==="SID"&&(w=Is(w,c)),f[x.op]={name:x.name,type:x.type,value:w})}return f}function xa(i,l,c){let f=new Be.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return f.dict=ho(c>1?qt:Ut,i,l),f}function Jo(i){let l=new Be.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return l.topDicts=[{name:"topDict_0",type:"TABLE",value:i}],l}function Io(i){let l=new Be.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);l.strings=[];for(let c=0;c<i.length;c+=1)l.strings.push({name:"string_"+c,type:"STRING",value:i[c]});return l}function ii(){return new Be.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function bi(i,l){let c=new Be.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let f=0;f<i.length;f+=1){let m=i[f],x=Is(m,l);c.fields.push({name:"glyph_"+f,type:"SID",value:x})}return c}function Vr(i,l){let c=[],f=i.path;l<2&&c.push({name:"width",type:"NUMBER",value:i.advanceWidth});let m=0,x=0;for(let w=0;w<f.commands.length;w+=1){let C,k,N=f.commands[w];if(N.type==="Q"){let M=.3333333333333333,W=2/3;N={type:"C",x:N.x,y:N.y,x1:Math.round(M*m+W*N.x1),y1:Math.round(M*x+W*N.y1),x2:Math.round(M*N.x+W*N.x1),y2:Math.round(M*N.y+W*N.y1)}}if(N.type==="M")C=Math.round(N.x-m),k=Math.round(N.y-x),c.push({name:"dx",type:"NUMBER",value:C}),c.push({name:"dy",type:"NUMBER",value:k}),c.push({name:"rmoveto",type:"OP",value:21}),m=Math.round(N.x),x=Math.round(N.y);else if(N.type==="L")C=Math.round(N.x-m),k=Math.round(N.y-x),c.push({name:"dx",type:"NUMBER",value:C}),c.push({name:"dy",type:"NUMBER",value:k}),c.push({name:"rlineto",type:"OP",value:5}),m=Math.round(N.x),x=Math.round(N.y);else if(N.type==="C"){let M=Math.round(N.x1-m),W=Math.round(N.y1-x),G=Math.round(N.x2-N.x1),le=Math.round(N.y2-N.y1);C=Math.round(N.x-N.x2),k=Math.round(N.y-N.y2),c.push({name:"dx1",type:"NUMBER",value:M}),c.push({name:"dy1",type:"NUMBER",value:W}),c.push({name:"dx2",type:"NUMBER",value:G}),c.push({name:"dy2",type:"NUMBER",value:le}),c.push({name:"dx",type:"NUMBER",value:C}),c.push({name:"dy",type:"NUMBER",value:k}),c.push({name:"rrcurveto",type:"OP",value:8}),m=Math.round(N.x),x=Math.round(N.y)}}return l<2&&c.push({name:"endchar",type:"OP",value:14}),c}function cl(i,l){let c=new Be.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let f=0;f<i.length;f+=1){let m=i.get(f),x=Vr(m,l);c.charStrings.push({name:m.name,type:"CHARSTRING",value:x})}return c}function hs(i,l,c){let f=new Be.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return f.dict=ho(c>1?Yt:vn,i,l),f}function ya(i,l){let c=new Be.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"}]),f=1/l.unitsPerEm,m={version:l.version,fullName:l.fullName,familyName:l.familyName,weight:l.weightName,fontBBox:l.fontBBox||[0,0,0,0],fontMatrix:[f,0,0,f,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},x=l&&l.topDict||{};x.paintType&&(m.paintType=x.paintType,m.strokeWidth=x.strokeWidth||0);let w={},C=[],k;for(let G=1;G<i.length;G+=1)k=i.get(G),C.push(k.name);let N=[];c.header=Xo(),c.nameIndex=Ji([l.postScriptName]);let M=xa(m,N);c.topDictIndex=Jo(M),c.globalSubrIndex=ii(),c.charsets=bi(C,N),c.charStringsIndex=cl(i,1),c.privateDict=hs(w,N),c.stringIndex=Io(N);let W=c.header.sizeOf()+c.nameIndex.sizeOf()+c.topDictIndex.sizeOf()+c.stringIndex.sizeOf()+c.globalSubrIndex.sizeOf();return m.charset=W,m.encoding=0,m.charStrings=m.charset+c.charsets.sizeOf(),m.private[1]=m.charStrings+c.charStringsIndex.sizeOf(),M=xa(m,N),c.topDictIndex=Jo(M),c}var Ii={parse:Ei,make:ya};function ul(i,l){let c={},f=new Ue.Parser(i,l);return c.version=f.parseVersion(),c.fontRevision=Math.round(f.parseFixed()*1e3)/1e3,c.checkSumAdjustment=f.parseULong(),c.magicNumber=f.parseULong(),J.argument(c.magicNumber===1594834165,"Font header has wrong magic number."),c.flags=f.parseUShort(),c.unitsPerEm=f.parseUShort(),c.created=f.parseLongDateTime(),c.modified=f.parseLongDateTime(),c.xMin=f.parseShort(),c.yMin=f.parseShort(),c.xMax=f.parseShort(),c.yMax=f.parseShort(),c.macStyle=f.parseUShort(),c.lowestRecPPEM=f.parseUShort(),c.fontDirectionHint=f.parseShort(),c.indexToLocFormat=f.parseShort(),c.glyphDataFormat=f.parseShort(),c}function eo(i){let l=Math.round(new Date().getTime()/1e3)+2082844800,c=l,f=i.macStyle||0;return i.createdTimestamp&&(c=i.createdTimestamp+2082844800),new Be.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:l},{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:f},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],i)}var Ro={parse:ul,make:eo};function dl(i,l){let c={},f=new Ue.Parser(i,l);return c.version=f.parseVersion(),c.ascender=f.parseShort(),c.descender=f.parseShort(),c.lineGap=f.parseShort(),c.advanceWidthMax=f.parseUShort(),c.minLeftSideBearing=f.parseShort(),c.minRightSideBearing=f.parseShort(),c.xMaxExtent=f.parseShort(),c.caretSlopeRise=f.parseShort(),c.caretSlopeRun=f.parseShort(),c.caretOffset=f.parseShort(),f.relativeOffset+=8,c.metricDataFormat=f.parseShort(),c.numberOfHMetrics=f.parseUShort(),c}function fo(i){return new Be.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}],i)}var $a={parse:dl,make:fo};function hl(i,l,c,f,m){let x,w,C=new Ue.Parser(i,l);for(let k=0;k<f;k+=1){k<c&&(x=C.parseUShort(),w=C.parseShort());let N=m.get(k);N.advanceWidth=x,N.leftSideBearing=w}}function Rs(i,l,c,f,m){i._hmtxTableData={};let x,w,C=new Ue.Parser(l,c);for(let k=0;k<m;k+=1)k<f&&(x=C.parseUShort(),w=C.parseShort()),i._hmtxTableData[k]={advanceWidth:x,leftSideBearing:w}}function ba(i,l,c,f,m,x,w){w.lowMemory?Rs(i,l,c,f,m):hl(l,c,f,m,x)}function va(i){let l=new Be.Table("hmtx",[]);for(let c=0;c<i.length;c+=1){let f=i.get(c),m=f.advanceWidth||0,x=f.leftSideBearing||0;l.fields.push({name:"advanceWidth_"+c,type:"USHORT",value:m}),l.fields.push({name:"leftSideBearing_"+c,type:"SHORT",value:x})}return l}var Mo={parse:ba,make:va};function po(i){let l=new Be.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:i.length}]),c="",f=12+i.length*4;for(let m=0;m<i.length;++m){let x=c.indexOf(i[m]);x<0&&(x=c.length,c+=i[m]),l.fields.push({name:"offset "+m,type:"USHORT",value:f+x}),l.fields.push({name:"length "+m,type:"USHORT",value:i[m].length})}return l.fields.push({name:"stringPool",type:"CHARARRAY",value:c}),l}function Mr(i,l){let c=new Ue.Parser(i,l),f=c.parseULong();J.argument(f===1,"Unsupported ltag table version."),c.skip("uLong",1);let m=c.parseULong(),x=[];for(let w=0;w<m;w++){let C="",k=l+c.parseUShort(),N=c.parseUShort();for(let M=k;M<k+N;++M)C+=String.fromCharCode(i.getInt8(M));x.push(C)}return x}var vi={make:po,parse:Mr};function Ms(i,l){let c={},f=new Ue.Parser(i,l);return c.version=f.parseVersion(),c.numGlyphs=f.parseUShort(),c.version===1&&(c.maxPoints=f.parseUShort(),c.maxContours=f.parseUShort(),c.maxCompositePoints=f.parseUShort(),c.maxCompositeContours=f.parseUShort(),c.maxZones=f.parseUShort(),c.maxTwilightPoints=f.parseUShort(),c.maxStorage=f.parseUShort(),c.maxFunctionDefs=f.parseUShort(),c.maxInstructionDefs=f.parseUShort(),c.maxStackElements=f.parseUShort(),c.maxSizeOfInstructions=f.parseUShort(),c.maxComponentElements=f.parseUShort(),c.maxComponentDepth=f.parseUShort()),c}function Ua(i){return new Be.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:i}])}var No={parse:Ms,make:Ua},Ri=[{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 fl(i){for(let l=0;l<Ri.length;l+=1){let c=Ri[l];if(i>=c.begin&&i<c.end)return l}return-1}function pl(i,l){let c={},f=new Ue.Parser(i,l);c.version=f.parseUShort(),c.xAvgCharWidth=f.parseShort(),c.usWeightClass=f.parseUShort(),c.usWidthClass=f.parseUShort(),c.fsType=f.parseUShort(),c.ySubscriptXSize=f.parseShort(),c.ySubscriptYSize=f.parseShort(),c.ySubscriptXOffset=f.parseShort(),c.ySubscriptYOffset=f.parseShort(),c.ySuperscriptXSize=f.parseShort(),c.ySuperscriptYSize=f.parseShort(),c.ySuperscriptXOffset=f.parseShort(),c.ySuperscriptYOffset=f.parseShort(),c.yStrikeoutSize=f.parseShort(),c.yStrikeoutPosition=f.parseShort(),c.sFamilyClass=f.parseShort(),c.panose=[];for(let m=0;m<10;m++)c.panose[m]=f.parseByte();return c.ulUnicodeRange1=f.parseULong(),c.ulUnicodeRange2=f.parseULong(),c.ulUnicodeRange3=f.parseULong(),c.ulUnicodeRange4=f.parseULong(),c.achVendID=String.fromCharCode(f.parseByte(),f.parseByte(),f.parseByte(),f.parseByte()),c.fsSelection=f.parseUShort(),c.usFirstCharIndex=f.parseUShort(),c.usLastCharIndex=f.parseUShort(),c.sTypoAscender=f.parseShort(),c.sTypoDescender=f.parseShort(),c.sTypoLineGap=f.parseShort(),c.usWinAscent=f.parseUShort(),c.usWinDescent=f.parseUShort(),c.version>=1&&(c.ulCodePageRange1=f.parseULong(),c.ulCodePageRange2=f.parseULong()),c.version>=2&&(c.sxHeight=f.parseShort(),c.sCapHeight=f.parseShort(),c.usDefaultChar=f.parseUShort(),c.usBreakChar=f.parseUShort(),c.usMaxContent=f.parseUShort()),c}function fs(i){return new Be.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}],i)}var oi={parse:pl,make:fs,unicodeRanges:Ri,getUnicodeRange:fl};function wi(i,l){let c={},f=new Ue.Parser(i,l);switch(c.version=f.parseVersion(),c.italicAngle=f.parseFixed(),c.underlinePosition=f.parseShort(),c.underlineThickness=f.parseShort(),c.isFixedPitch=f.parseULong(),c.minMemType42=f.parseULong(),c.maxMemType42=f.parseULong(),c.minMemType1=f.parseULong(),c.maxMemType1=f.parseULong(),c.version){case 1:c.names=Ge.slice();break;case 2:c.numberOfGlyphs=f.parseUShort(),c.glyphNameIndex=new Array(c.numberOfGlyphs);for(let m=0;m<c.numberOfGlyphs;m++)c.glyphNameIndex[m]=f.parseUShort();c.names=[];for(let m=0;m<c.numberOfGlyphs;m++)if(c.glyphNameIndex[m]>=Ge.length){let x=f.parseChar();c.names.push(f.parseString(x))}break;case 2.5:c.numberOfGlyphs=f.parseUShort(),c.offset=new Array(c.numberOfGlyphs);for(let m=0;m<c.numberOfGlyphs;m++)c.offset[m]=f.parseChar();break}return c}function to(i){let{italicAngle:l=Math.round((i.italicAngle||0)*65536),underlinePosition:c=0,underlineThickness:f=0,isFixedPitch:m=0,minMemType42:x=0,maxMemType42:w=0,minMemType1:C=0,maxMemType1:k=0}=i.tables.post||{};return new Be.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:l},{name:"underlinePosition",type:"FWORD",value:c},{name:"underlineThickness",type:"FWORD",value:f},{name:"isFixedPitch",type:"ULONG",value:m},{name:"minMemType42",type:"ULONG",value:x},{name:"maxMemType42",type:"ULONG",value:w},{name:"minMemType1",type:"ULONG",value:C},{name:"maxMemType1",type:"ULONG",value:k}])}var qr={parse:wi,make:to},vs=new Array(9);vs[1]=function(){let i=this.offset+this.relativeOffset,l=this.parseUShort();if(l===1)return{substFormat:1,coverage:this.parsePointer(pe.coverage),deltaGlyphId:this.parseShort()};if(l===2)return{substFormat:2,coverage:this.parsePointer(pe.coverage),substitute:this.parseOffset16List()};J.assert(!1,"0x"+i.toString(16)+": lookup type 1 format must be 1 or 2.")},vs[2]=function(){let i=this.parseUShort();return J.argument(i===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:i,coverage:this.parsePointer(pe.coverage),sequences:this.parseListOfLists()}},vs[3]=function(){let i=this.parseUShort();return J.argument(i===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:i,coverage:this.parsePointer(pe.coverage),alternateSets:this.parseListOfLists()}},vs[4]=function(){let i=this.parseUShort();return J.argument(i===1,"GSUB ligature table identifier-format must be 1"),{substFormat:i,coverage:this.parsePointer(pe.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var Mi={sequenceIndex:pe.uShort,lookupListIndex:pe.uShort};vs[5]=function(){let i=this.offset+this.relativeOffset,l=this.parseUShort();if(l===1)return{substFormat:l,coverage:this.parsePointer(pe.coverage),ruleSets:this.parseListOfLists(function(){let c=this.parseUShort(),f=this.parseUShort();return{input:this.parseUShortList(c-1),lookupRecords:this.parseRecordList(f,Mi)}})};if(l===2)return{substFormat:l,coverage:this.parsePointer(pe.coverage),classDef:this.parsePointer(pe.classDef),classSets:this.parseListOfLists(function(){let c=this.parseUShort(),f=this.parseUShort();return{classes:this.parseUShortList(c-1),lookupRecords:this.parseRecordList(f,Mi)}})};if(l===3){let c=this.parseUShort(),f=this.parseUShort();return{substFormat:l,coverages:this.parseList(c,pe.pointer(pe.coverage)),lookupRecords:this.parseRecordList(f,Mi)}}J.assert(!1,"0x"+i.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},vs[6]=function(){let i=this.offset+this.relativeOffset,l=this.parseUShort();if(l===1)return{substFormat:1,coverage:this.parsePointer(pe.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Mi)}})};if(l===2)return{substFormat:2,coverage:this.parsePointer(pe.coverage),backtrackClassDef:this.parsePointer(pe.classDef),inputClassDef:this.parsePointer(pe.classDef),lookaheadClassDef:this.parsePointer(pe.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Mi)}})};if(l===3)return{substFormat:3,backtrackCoverage:this.parseList(pe.pointer(pe.coverage)),inputCoverage:this.parseList(pe.pointer(pe.coverage)),lookaheadCoverage:this.parseList(pe.pointer(pe.coverage)),lookupRecords:this.parseRecordList(Mi)};J.assert(!1,"0x"+i.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},vs[7]=function(){let i=this.parseUShort();J.argument(i===1,"GSUB Extension Substitution subtable identifier-format must be 1");let l=this.parseUShort(),c=new pe(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:l,extension:vs[l].call(c)}},vs[8]=function(){let i=this.parseUShort();return J.argument(i===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:i,coverage:this.parsePointer(pe.coverage),backtrackCoverage:this.parseList(pe.pointer(pe.coverage)),lookaheadCoverage:this.parseList(pe.pointer(pe.coverage)),substitutes:this.parseUShortList()}};function zs(i,l){l=l||0;let c=new pe(i,l),f=c.parseVersion(1);return J.argument(f===1||f===1.1,"Unsupported GSUB table version."),f===1?{version:f,scripts:c.parseScriptList(),features:c.parseFeatureList(),lookups:c.parseLookupList(vs)}:{version:f,scripts:c.parseScriptList(),features:c.parseFeatureList(),lookups:c.parseLookupList(vs),variations:c.parseFeatureVariationsList()}}var Yr=new Array(9);Yr[1]=function(i){if(i.substFormat===1)return new Be.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Be.Coverage(i.coverage)},{name:"deltaGlyphID",type:"SHORT",value:i.deltaGlyphId}]);if(i.substFormat===2)return new Be.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new Be.Coverage(i.coverage)}].concat(Be.ushortList("substitute",i.substitute)));J.fail("Lookup type 1 substFormat must be 1 or 2.")},Yr[2]=function(i){return J.assert(i.substFormat===1,"Lookup type 2 substFormat must be 1."),new Be.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Be.Coverage(i.coverage)}].concat(Be.tableList("seqSet",i.sequences,function(l){return new Be.Table("sequenceSetTable",Be.ushortList("sequence",l))})))},Yr[3]=function(i){return J.assert(i.substFormat===1,"Lookup type 3 substFormat must be 1."),new Be.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Be.Coverage(i.coverage)}].concat(Be.tableList("altSet",i.alternateSets,function(l){return new Be.Table("alternateSetTable",Be.ushortList("alternate",l))})))},Yr[4]=function(i){return J.assert(i.substFormat===1,"Lookup type 4 substFormat must be 1."),new Be.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Be.Coverage(i.coverage)}].concat(Be.tableList("ligSet",i.ligatureSets,function(l){return new Be.Table("ligatureSetTable",Be.tableList("ligature",l,function(c){return new Be.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:c.ligGlyph}].concat(Be.ushortList("component",c.components,c.components.length+1)))}))})))},Yr[5]=function(i){if(i.substFormat===1)return new Be.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:i.substFormat},{name:"coverage",type:"TABLE",value:new Be.Coverage(i.coverage)}].concat(Be.tableList("sequenceRuleSet",i.ruleSets,function(l){return l?new Be.Table("sequenceRuleSetTable",Be.tableList("sequenceRule",l,function(c){let f=Be.ushortList("seqLookup",[],c.lookupRecords.length).concat(Be.ushortList("inputSequence",c.input,c.input.length+1));[f[0],f[1]]=[f[1],f[0]];for(let m=0;m<c.lookupRecords.length;m++){let x=c.lookupRecords[m];f=f.concat({name:"sequenceIndex"+m,type:"USHORT",value:x.sequenceIndex}).concat({name:"lookupListIndex"+m,type:"USHORT",value:x.lookupListIndex})}return new Be.Table("sequenceRuleTable",f)})):new Be.Table("NULL",null)})));if(i.substFormat===2)return new Be.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:i.substFormat},{name:"coverage",type:"TABLE",value:new Be.Coverage(i.coverage)},{name:"classDef",type:"TABLE",value:new Be.ClassDef(i.classDef)}].concat(Be.tableList("classSeqRuleSet",i.classSets,function(l){return l?new Be.Table("classSeqRuleSetTable",Be.tableList("classSeqRule",l,function(c){let f=Be.ushortList("classes",c.classes,c.classes.length+1).concat(Be.ushortList("seqLookupCount",[],c.lookupRecords.length));for(let m=0;m<c.lookupRecords.length;m++){let x=c.lookupRecords[m];f=f.concat({name:"sequenceIndex"+m,type:"USHORT",value:x.sequenceIndex}).concat({name:"lookupListIndex"+m,type:"USHORT",value:x.lookupListIndex})}return new Be.Table("classSeqRuleTable",f)})):new Be.Table("NULL",null)})));if(i.substFormat===3){let l=[{name:"substFormat",type:"USHORT",value:i.substFormat}];l.push({name:"inputGlyphCount",type:"USHORT",value:i.coverages.length}),l.push({name:"substitutionCount",type:"USHORT",value:i.lookupRecords.length});for(let c=0;c<i.coverages.length;c++){let f=i.coverages[c];l.push({name:"inputCoverage"+c,type:"TABLE",value:new Be.Coverage(f)})}for(let c=0;c<i.lookupRecords.length;c++){let f=i.lookupRecords[c];l=l.concat({name:"sequenceIndex"+c,type:"USHORT",value:f.sequenceIndex}).concat({name:"lookupListIndex"+c,type:"USHORT",value:f.lookupListIndex})}return new Be.Table("contextualSubstitutionTable",l)}J.assert(!1,"lookup type 5 format must be 1, 2 or 3.")},Yr[6]=function(i){if(i.substFormat===1)return new Be.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:i.substFormat},{name:"coverage",type:"TABLE",value:new Be.Coverage(i.coverage)}].concat(Be.tableList("chainRuleSet",i.chainRuleSets,function(l){return new Be.Table("chainRuleSetTable",Be.tableList("chainRule",l,function(c){let f=Be.ushortList("backtrackGlyph",c.backtrack,c.backtrack.length).concat(Be.ushortList("inputGlyph",c.input,c.input.length+1)).concat(Be.ushortList("lookaheadGlyph",c.lookahead,c.lookahead.length)).concat(Be.ushortList("substitution",[],c.lookupRecords.length));for(let m=0;m<c.lookupRecords.length;m++){let x=c.lookupRecords[m];f=f.concat({name:"sequenceIndex"+m,type:"USHORT",value:x.sequenceIndex}).concat({name:"lookupListIndex"+m,type:"USHORT",value:x.lookupListIndex})}return new Be.Table("chainRuleTable",f)}))})));if(i.substFormat===2)J.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(i.substFormat===3){let l=[{name:"substFormat",type:"USHORT",value:i.substFormat}];l.push({name:"backtrackGlyphCount",type:"USHORT",value:i.backtrackCoverage.length});for(let c=0;c<i.backtrackCoverage.length;c++){let f=i.backtrackCoverage[c];l.push({name:"backtrackCoverage"+c,type:"TABLE",value:new Be.Coverage(f)})}l.push({name:"inputGlyphCount",type:"USHORT",value:i.inputCoverage.length});for(let c=0;c<i.inputCoverage.length;c++){let f=i.inputCoverage[c];l.push({name:"inputCoverage"+c,type:"TABLE",value:new Be.Coverage(f)})}l.push({name:"lookaheadGlyphCount",type:"USHORT",value:i.lookaheadCoverage.length});for(let c=0;c<i.lookaheadCoverage.length;c++){let f=i.lookaheadCoverage[c];l.push({name:"lookaheadCoverage"+c,type:"TABLE",value:new Be.Coverage(f)})}l.push({name:"substitutionCount",type:"USHORT",value:i.lookupRecords.length});for(let c=0;c<i.lookupRecords.length;c++){let f=i.lookupRecords[c];l=l.concat({name:"sequenceIndex"+c,type:"USHORT",value:f.sequenceIndex}).concat({name:"lookupListIndex"+c,type:"USHORT",value:f.lookupListIndex})}return new Be.Table("chainContextTable",l)}J.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function Lr(i){return new Be.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Be.ScriptList(i.scripts)},{name:"features",type:"TABLE",value:new Be.FeatureList(i.features)},{name:"lookups",type:"TABLE",value:new Be.LookupList(i.lookups,Yr)}])}var Ni={parse:zs,make:Lr};function ai(i,l){let c=new Ue.Parser(i,l),f=c.parseULong();J.argument(f===1,"Unsupported META table version."),c.parseULong(),c.parseULong();let m=c.parseULong(),x={};for(let w=0;w<m;w++){let C=c.parseTag(),k=c.parseULong(),N=c.parseULong();if(C==="appl"||C==="bild")continue;let M=Ct.UTF8(i,l+k,N);x[C]=M}return x}function mo(i){let l=Object.keys(i).length,c="",f=16+l*12,m=new Be.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:f},{name:"numTags",type:"ULONG",value:l}]);for(let x in i){let w=c.length;c+=i[x],m.fields.push({name:"tag "+x,type:"TAG",value:x}),m.fields.push({name:"offset "+x,type:"ULONG",value:f+w}),m.fields.push({name:"length "+x,type:"ULONG",value:i[x].length})}return m.fields.push({name:"stringPool",type:"CHARARRAY",value:c}),m}var Ai={parse:ai,make:mo};function Di(i,l){let c=new pe(i,l),f=c.parseUShort();f!==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 m=c.parseUShort(),x=c.parseOffset32(),w=c.parseOffset32(),C=c.parseUShort();c.relativeOffset=x;let k=c.parseRecordList(m,{glyphID:pe.uShort,firstLayerIndex:pe.uShort,numLayers:pe.uShort});c.relativeOffset=w;let N=c.parseRecordList(C,{glyphID:pe.uShort,paletteIndex:pe.uShort});return{version:f,baseGlyphRecords:k,layerRecords:N}}function oe({version:i=0,baseGlyphRecords:l=[],layerRecords:c=[]}){J.argument(i===0,"Only COLRv0 supported.");let f=14,m=f+l.length*6;return new Be.Table("COLR",[{name:"version",type:"USHORT",value:i},{name:"numBaseGlyphRecords",type:"USHORT",value:l.length},{name:"baseGlyphRecordsOffset",type:"ULONG",value:f},{name:"layerRecordsOffset",type:"ULONG",value:m},{name:"numLayerRecords",type:"USHORT",value:c.length},...l.map((x,w)=>[{name:"glyphID_"+w,type:"USHORT",value:x.glyphID},{name:"firstLayerIndex_"+w,type:"USHORT",value:x.firstLayerIndex},{name:"numLayers_"+w,type:"USHORT",value:x.numLayers}]).flat(),...c.map((x,w)=>[{name:"LayerGlyphID_"+w,type:"USHORT",value:x.glyphID},{name:"paletteIndex_"+w,type:"USHORT",value:x.paletteIndex}]).flat()])}var De={parse:Di,make:oe};function Ve(i,l){return[{name:"tag_"+i,type:"TAG",value:l.tag},{name:"minValue_"+i,type:"FIXED",value:l.minValue<<16},{name:"defaultValue_"+i,type:"FIXED",value:l.defaultValue<<16},{name:"maxValue_"+i,type:"FIXED",value:l.maxValue<<16},{name:"flags_"+i,type:"USHORT",value:0},{name:"nameID_"+i,type:"USHORT",value:l.axisNameID}]}function mt(i,l,c){let f={},m=new Ue.Parser(i,l);f.tag=m.parseTag(),f.minValue=m.parseFixed(),f.defaultValue=m.parseFixed(),f.maxValue=m.parseFixed(),m.skip("uShort",1);let x=m.parseUShort();return f.axisNameID=x,f.name=Ht(c,x),f}function Re(i,l,c,f={}){let m=[{name:"nameID_"+i,type:"USHORT",value:l.subfamilyNameID},{name:"flags_"+i,type:"USHORT",value:0}];for(let x=0;x<c.length;++x){let w=c[x].tag;m.push({name:"axis_"+i+" "+w,type:"FIXED",value:l.coordinates[w]<<16})}return f&&f.postScriptNameID&&m.push({name:"postScriptNameID_",type:"USHORT",value:l.postScriptNameID!==void 0?l.postScriptNameID:65535}),m}function At(i,l,c,f,m){let x={},w=new Ue.Parser(i,l),C=w.parseUShort();x.subfamilyNameID=C,x.name=Ht(f,C,[2,17]),w.skip("uShort",1),x.coordinates={};for(let N=0;N<c.length;++N)x.coordinates[c[N].tag]=w.parseFixed();if(w.relativeOffset===m)return x.postScriptNameID=void 0,x.postScriptName=void 0,x;let k=w.parseUShort();return x.postScriptNameID=k==65535?void 0:k,x.postScriptName=x.postScriptNameID!==void 0?Ht(f,k,[6]):"",x}function gn(i,l){let c=new Be.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:i.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:i.instances.length},{name:"instanceSize",type:"USHORT",value:4+i.axes.length*4}]);c.offsetToData=c.sizeOf();for(let m=0;m<i.axes.length;m++)c.fields=c.fields.concat(Ve(m,i.axes[m],l));let f={};for(let m=0;m<i.instances.length;m++)if(i.instances[m].postScriptNameID!==void 0){c.instanceSize+=2,f.postScriptNameID=!0;break}for(let m=0;m<i.instances.length;m++)c.fields=c.fields.concat(Re(m,i.instances[m],i.axes,f));return c}function Mn(i,l,c){let f=new Ue.Parser(i,l),m=f.parseULong();J.argument(m===65536,"Unsupported fvar table version.");let x=f.parseOffset16();f.skip("uShort",1);let w=f.parseUShort(),C=f.parseUShort(),k=f.parseUShort(),N=f.parseUShort(),M=[];for(let le=0;le<w;le++)M.push(mt(i,l+x+le*C,c));let W=[],G=l+x+w*C;for(let le=0;le<k;le++)W.push(At(i,G+le*N,M,c,N));return{axes:M,instances:W}}var Wn={make:gn,parse:Mn},wn={tag:pe.tag,nameID:pe.uShort,ordering:pe.uShort},Qr=new Array(5);Qr[1]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed()}},Qr[2]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),nominalValue:this.parseFixed(),rangeMinValue:this.parseFixed(),rangeMaxValue:this.parseFixed()}},Qr[3]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed(),linkedValue:this.parseFixed()}},Qr[4]=function(){let i=this.parseUShort();return{flags:this.parseUShort(),valueNameID:this.parseUShort(),axisValues:this.parseList(i,function(){return{axisIndex:this.parseUShort(),value:this.parseFixed()}})}};function lr(){let i=this.parseUShort(),l=Qr[i],c={format:i};return l===void 0?(console.warn(`Unknown axis value table format ${i}`),c):Object.assign(c,this.parseStruct(l.bind(this)))}function Zr(i,l,c){l||(l=0);let f=new Ue.Parser(i,l),m=f.parseUShort(),x=f.parseUShort();m!==1&&console.warn(`Unsupported STAT table version ${m}.${x}`);let w=[m,x],C=f.parseUShort(),k=f.parseUShort(),N=f.parseOffset32(),M=f.parseUShort(),W=f.parseOffset32(),G=m>1||x>0?f.parseUShort():void 0;c!==void 0&&J.argument(k>=c.axes.length,"STAT axis count must be greater than or equal to fvar axis count"),M>0&&J.argument(k>=0,"STAT axis count must be greater than 0 if STAT axis value count is greater than 0");let le=[];for(let He=0;He<k;He++)f.offset=l+N,f.relativeOffset=He*C,le.push(f.parseStruct(wn));f.offset=l,f.relativeOffset=W;let ne=f.parseUShortList(M),me=[];for(let He=0;He<M;He++)f.offset=l+W,f.relativeOffset=ne[He],me.push(lr.apply(f));return{version:w,axes:le,values:me,elidedFallbackNameID:G}}var Jn=new Array(5);Jn[1]=function(i,l){return[{name:`format${i}`,type:"USHORT",value:1},{name:`axisIndex${i}`,type:"USHORT",value:l.axisIndex},{name:`flags${i}`,type:"USHORT",value:l.flags},{name:`valueNameID${i}`,type:"USHORT",value:l.valueNameID},{name:`value${i}`,type:"FLOAT",value:l.value}]},Jn[2]=function(i,l){return[{name:`format${i}`,type:"USHORT",value:2},{name:`axisIndex${i}`,type:"USHORT",value:l.axisIndex},{name:`flags${i}`,type:"USHORT",value:l.flags},{name:`valueNameID${i}`,type:"USHORT",value:l.valueNameID},{name:`nominalValue${i}`,type:"FLOAT",value:l.nominalValue},{name:`rangeMinValue${i}`,type:"FLOAT",value:l.rangeMinValue},{name:`rangeMaxValue${i}`,type:"FLOAT",value:l.rangeMaxValue}]},Jn[3]=function(i,l){return[{name:`format${i}`,type:"USHORT",value:3},{name:`axisIndex${i}`,type:"USHORT",value:l.axisIndex},{name:`flags${i}`,type:"USHORT",value:l.flags},{name:`valueNameID${i}`,type:"USHORT",value:l.valueNameID},{name:`value${i}`,type:"FLOAT",value:l.value},{name:`linkedValue${i}`,type:"FLOAT",value:l.linkedValue}]},Jn[4]=function(i,l){let c=[{name:`format${i}`,type:"USHORT",value:4},{name:`axisCount${i}`,type:"USHORT",value:l.axisValues.length},{name:`flags${i}`,type:"USHORT",value:l.flags},{name:`valueNameID${i}`,type:"USHORT",value:l.valueNameID}];for(let f=0;f<l.axisValues.length;f++)c=c.concat([{name:`format${i}axisIndex${f}`,type:"USHORT",value:l.axisValues[f].axisIndex},{name:`format${i}value${f}`,type:"FLOAT",value:l.axisValues[f].value}]);return c};function wa(i,l){return new Be.Record("axisRecord_"+i,[{name:"axisTag_"+i,type:"TAG",value:l.tag},{name:"axisNameID_"+i,type:"USHORT",value:l.nameID},{name:"axisOrdering_"+i,type:"USHORT",value:l.ordering}])}function Nr(i,l){let c=l.format,f=Jn[c];J.argument(f!==void 0,`Unknown axis value table format ${c}`);let m=f(i,l);return new Be.Table("axisValueTable_"+i,m)}function Gs(i){let l=new Be.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:i.axes.length},{name:"designAxesOffset",type:"ULONG",value:0},{name:"axisValueCount",type:"USHORT",value:i.values.length},{name:"offsetToAxisValueOffsets",type:"ULONG",value:0},{name:"elidedFallbackNameID",type:"USHORT",value:i.elidedFallbackNameID}]);l.designAxesOffset=l.offsetToAxisValueOffsets=l.sizeOf();for(let x=0;x<i.axes.length;x++){let w=wa(x,i.axes[x]);l.offsetToAxisValueOffsets+=w.sizeOf(),l.fields=l.fields.concat(w.fields)}let c=[],f=[],m=i.values.length*2;for(let x=0;x<i.values.length;x++){let w=Nr(x,i.values[x]);c.push({name:"offset_"+x,type:"USHORT",value:m}),m+=w.sizeOf(),f=f.concat(w.fields)}return l.fields=l.fields.concat(c),l.fields=l.fields.concat(f),l}var $l={make:Gs,parse:Zr};function I(i,l){return new Be.Record("axisValueMap_"+i,[{name:"fromCoordinate_"+i,type:"F2DOT14",value:l.fromCoordinate},{name:"toCoordinate_"+i,type:"F2DOT14",value:l.toCoordinate}])}function O(i,l){let c=new Be.Record("segmentMap_"+i,[{name:"positionMapCount_"+i,type:"USHORT",value:l.axisValueMaps.length}]),f=[];for(let m=0;m<l.axisValueMaps.length;m++){let x=I(`${i}_${m}`,l.axisValueMaps[m]);f=f.concat(x.fields)}return c.fields=c.fields.concat(f),c}function F(i,l){J.argument(i.axisSegmentMaps.length===l.axes.length,"avar axis count must correspond to fvar axis count");let c=new Be.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:i.axisSegmentMaps.length}]);for(let f=0;f<i.axisSegmentMaps.length;f++){let m=O(f,i.axisSegmentMaps[f]);c.fields=c.fields.concat(m.fields)}return c}function V(i,l,c){l||(l=0);let f=new pe(i,l),m=f.parseUShort(),x=f.parseUShort();m!==1&&console.warn(`Unsupported avar table version ${m}.${x}`),f.skip("uShort",1);let w=f.parseUShort();J.argument(w===c.axes.length,"avar axis count must correspond to fvar axis count");let C=[];for(let k=0;k<w;k++){let N=[],M=f.parseUShort();for(let W=0;W<M;W++){let G=f.parseF2Dot14(),le=f.parseF2Dot14();N.push({fromCoordinate:G,toCoordinate:le})}C.push({axisValueMaps:N})}return{version:[m,x],axisSegmentMaps:C}}var Me={make:F,parse:V};function Ce(i,l,c,f){let m=new Ue.Parser(i,l),x=m.parseTupleVariationStore(m.relativeOffset,c.axes.length,"cvar",f),w=m.parseUShort(),C=m.parseUShort();return w!==1&&console.warn(`Unsupported cvar table version ${w}.${C}`),{version:[w,C],...x}}function Xe(){console.warn("Writing of cvar tables is not yet supported.")}var Ye={make:Xe,parse:Ce};function ft(i,l,c,f){let m=new Ue.Parser(i,l),x=m.parseUShort(),w=m.parseUShort();x!==1&&console.warn(`Unsupported gvar table version ${x}.${w}`);let C=m.parseUShort();C!==c.axes.length&&console.warn(`axisCount ${C} in gvar table does not match the number of axes ${c.axes.length} in the fvar table!`);let k=m.parseUShort(),N=m.parsePointer32(function(){return this.parseTupleRecords(k,C)}),M=m.parseTupleVariationStoreList(C,"gvar",f);return{version:[x,w],sharedTuples:N,glyphVariations:M}}function cn(){console.warn("Writing of gvar tables is not yet supported.")}var er={make:cn,parse:ft};function cr(i,l){let c={},f=new Ue.Parser(i,l);c.version=f.parseUShort(),J.argument(c.version<=1,"Unsupported gasp table version."),c.numRanges=f.parseUShort(),c.gaspRanges=[];for(let m=0;m<c.numRanges;m++)c.gaspRanges[m]={rangeMaxPPEM:f.parseUShort(),rangeGaspBehavior:f.parseUShort()};return c}function pr(i){let l=new Be.Table("gasp",[{name:"version",type:"USHORT",value:1},{name:"numRanges",type:"USHORT",value:i.numRanges}]);for(let c in i.gaspRanges)l.fields.push({name:"rangeMaxPPEM",type:"USHORT",value:i.gaspRanges[c].rangeMaxPPEM}),l.fields.push({name:"rangeGaspBehavior",type:"USHORT",value:i.gaspRanges[c].rangeGaspBehavior});return l}var Jt={parse:cr,make:pr};function Ln(i,l){let c=new Map,f=i.buffer,m=new pe(i,l);if(m.parseUShort()!==0)return c;m.relativeOffset=m.parseOffset32();let x=i.byteOffset+l+m.relativeOffset,w=m.parseUShort(),C=new Map;for(let k=0;k<w;k++){let N=m.parseUShort(),M=m.parseUShort(),W=x+m.parseOffset32(),G=m.parseULong(),le=C.get(W);le===void 0&&(le=new Uint8Array(f,W,G),C.set(W,le));for(let ne=N;ne<=M;ne++)c.set(ne,le)}return c}function ps(i){let l=Array.from(i.keys()).sort(),c=[],f=[],m=new Map,x=0,w={endGlyphID:null};for(let G=0,le=l.length;G<le;G++){let ne=l[G],me=i.get(ne),He=m.get(me);He===void 0&&(He=x,f.push(me),m.set(me,He),x+=me.byteLength),ne-1===w.endGlyphID&&He===w.svgDocOffset?w.endGlyphID=ne:(w={startGlyphID:ne,endGlyphID:ne,svgDocOffset:He,svgDocLength:me.byteLength},c.push(w))}let C=c.length,k=f.length,N=2+C*12,M=new Array(4+C*4+k),W=0;M[W++]={name:"version",type:"USHORT",value:0},M[W++]={name:"svgDocumentListOffset",type:"ULONG",value:10},M[W++]={name:"reserved",type:"ULONG",value:0},M[W++]={name:"numEntries",type:"USHORT",value:C};for(let G=0;G<C;G++){let le="documentRecord_"+G,{startGlyphID:ne,endGlyphID:me,svgDocOffset:He,svgDocLength:Gt}=c[G];M[W++]={name:le+"_startGlyphID",type:"USHORT",value:ne},M[W++]={name:le+"_endGlyphID",type:"USHORT",value:me},M[W++]={name:le+"_svgDocOffset",type:"ULONG",value:N+He},M[W++]={name:le+"_svgDocLength",type:"ULONG",value:Gt}}for(let G=0;G<k;G++)M[W++]={name:"svgDoc_"+G,type:"LITERAL",value:f[G]};return new Be.Table("SVG ",M)}var zr={make:ps,parse:Ln};function Bi(i){return Math.log(i)/Math.log(2)|0}function Kr(i){for(;i.length%4!==0;)i.push(0);let l=0;for(let c=0;c<i.length;c+=4)l+=(i[c]<<24)+(i[c+1]<<16)+(i[c+2]<<8)+i[c+3];return l%=Math.pow(2,32),l}function ml(i,l,c,f){return new Be.Record("Table Record",[{name:"tag",type:"TAG",value:i!==void 0?i:""},{name:"checkSum",type:"ULONG",value:l!==void 0?l:0},{name:"offset",type:"ULONG",value:c!==void 0?c:0},{name:"length",type:"ULONG",value:f!==void 0?f:0}])}function ws(i){let l=new Be.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}]);l.tables=i,l.numTables=i.length;let c=Math.pow(2,Bi(l.numTables));l.searchRange=16*c,l.entrySelector=Bi(c),l.rangeShift=l.numTables*16-l.searchRange;let f=[],m=[],x=l.sizeOf()+ml().sizeOf()*l.numTables;for(;x%4!==0;)x+=1,m.push({name:"padding",type:"BYTE",value:0});for(let w=0;w<i.length;w+=1){let C=i[w];J.argument(C.tableName.length===4,"Table name"+C.tableName+" is invalid.");let k=C.sizeOf(),N=ml(C.tableName,Kr(C.encode()),x,k);for(f.push({name:N.tag+" Table Record",type:"RECORD",value:N}),m.push({name:C.tableName+" table",type:"RECORD",value:C}),x+=k,J.argument(!isNaN(x),"Something went wrong calculating the offset.");x%4!==0;)x+=1,m.push({name:"padding",type:"BYTE",value:0})}return f.sort(function(w,C){return w.value.tag>C.value.tag?1:-1}),l.fields=l.fields.concat(f),l.fields=l.fields.concat(m),l}function Ws(i,l,c){for(let f=0;f<l.length;f+=1){let m=i.charToGlyphIndex(l[f]);if(m>0)return i.glyphs.get(m).getMetrics()}return c}function Aa(i){let l=0;for(let c=0;c<i.length;c+=1)l+=i[c];return l/i.length}function wc(i){let l=[],c=[],f=[],m=[],x=[],w=[],C=[],k,N=0,M=0,W=0,G=0,le=0;for(let Dr=0;Dr<i.glyphs.length;Dr+=1){let ro=i.glyphs.get(Dr),Qo=ro.unicode|0;if(isNaN(ro.advanceWidth))throw new Error("Glyph "+ro.name+" ("+Dr+"): advanceWidth is not a number.");(k>Qo||k===void 0)&&Qo>0&&(k=Qo),N<Qo&&(N=Qo);let la=oi.getUnicodeRange(Qo);if(la<32)M|=1<<la;else if(la<64)W|=1<<la-32;else if(la<96)G|=1<<la-64;else if(la<123)le|=1<<la-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(ro.name===".notdef")continue;let Va=ro.getMetrics();l.push(Va.xMin),c.push(Va.yMin),f.push(Va.xMax),m.push(Va.yMax),w.push(Va.leftSideBearing),C.push(Va.rightSideBearing),x.push(ro.advanceWidth)}let ne={xMin:Math.min.apply(null,l),yMin:Math.min.apply(null,c),xMax:Math.max.apply(null,f),yMax:Math.max.apply(null,m),advanceWidthMax:Math.max.apply(null,x),advanceWidthAvg:Aa(x),minLeftSideBearing:Math.min.apply(null,w),maxLeftSideBearing:Math.max.apply(null,w),minRightSideBearing:Math.min.apply(null,C)};ne.ascender=i.ascender,ne.descender=i.descender;let me=0;i.weightClass>=600&&(me|=i.macStyleValues.BOLD),i.italicAngle<0&&(me|=i.macStyleValues.ITALIC);let He=Ro.make({flags:3,unitsPerEm:i.unitsPerEm,xMin:ne.xMin,yMin:ne.yMin,xMax:ne.xMax,yMax:ne.yMax,lowestRecPPEM:3,macStyle:me,createdTimestamp:i.createdTimestamp}),Gt=$a.make({ascender:ne.ascender,descender:ne.descender,advanceWidthMax:ne.advanceWidthMax,minLeftSideBearing:ne.minLeftSideBearing,minRightSideBearing:ne.minRightSideBearing,xMaxExtent:ne.maxLeftSideBearing+(ne.xMax-ne.xMin),numberOfHMetrics:i.glyphs.length}),Ft=No.make(i.glyphs.length),rn=oi.make(Object.assign({xAvgCharWidth:Math.round(ne.advanceWidthAvg),usFirstCharIndex:k,usLastCharIndex:N,ulUnicodeRange1:M,ulUnicodeRange2:W,ulUnicodeRange3:G,ulUnicodeRange4:le,sTypoAscender:ne.ascender,sTypoDescender:ne.descender,sTypoLineGap:0,usWinAscent:ne.yMax,usWinDescent:Math.abs(ne.yMin),ulCodePageRange1:1,sxHeight:Ws(i,"xyvw",{yMax:Math.round(ne.ascender/2)}).yMax,sCapHeight:Ws(i,"HIKLEFJMNTZBDPRAGOQSUVWXY",ne).yMax,usDefaultChar:i.hasChar(" ")?32:0,usBreakChar:i.hasChar(" ")?32:0},i.tables.os2)),kn=Mo.make(i.glyphs),mr=uo.make(i.glyphs),kr=i.getEnglishName("fontFamily"),Er=i.getEnglishName("fontSubfamily"),As=kr+" "+Er,oa=i.getEnglishName("postScriptName");oa||(oa=kr.replace(/\s/g,"")+"-"+Er);let En={};for(let Dr in i.names)En[Dr]=i.names[Dr];En.unicode=En.unicode||{},En.macintosh=En.macintosh||{},En.windows=En.windows||{};let yo=i.names.unicode||{},Fi=i.names.macintosh||{},Wt=i.names.windows||{};for(let Dr in En){if(En[Dr]=En[Dr]||{},!En[Dr].uniqueID){let ro=i.getEnglishName("manufacturer")||"";En[Dr].uniqueID={en:`${ro}: ${As}`}}En[Dr].postScriptName||(En[Dr].postScriptName={en:oa})}En.unicode.preferredFamily||(En.unicode.preferredFamily=yo.fontFamily||Fi.fontFamily||Wt.fontFamily),En.macintosh.preferredFamily||(En.macintosh.preferredFamily=Fi.fontFamily||yo.fontFamily||Wt.fontFamily),En.windows.preferredFamily||(En.windows.preferredFamily=Wt.fontFamily||yo.fontFamily||Fi.fontFamily),En.unicode.preferredSubfamily||(En.unicode.preferredSubfamily=yo.fontSubfamily||Fi.fontSubfamily||Wt.fontSubfamily),En.macintosh.preferredSubfamily||(En.macintosh.preferredSubfamily=Fi.fontSubfamily||yo.fontSubfamily||Wt.fontSubfamily),En.windows.preferredSubfamily||(En.windows.preferredSubfamily=Wt.fontSubfamily||yo.fontSubfamily||Fi.fontSubfamily);let Dt=[],Qt=Cr.make(En,Dt),Ci=Dt.length>0?vi.make(Dt):void 0,Sl=qr.make(i),ud=Ii.make(i.glyphs,{version:i.getEnglishName("version"),fullName:As,familyName:kr,weightName:Er,postScriptName:oa,unitsPerEm:i.unitsPerEm,fontBBox:[0,ne.yMin,ne.ascender,ne.advanceWidthMax],topDict:i.tables.cff&&i.tables.cff.topDict||{}}),Gl=i.metas&&Object.keys(i.metas).length>0?Ai.make(i.metas):void 0,aa=[He,Gt,Ft,rn,Qt,mr,Sl,ud,kn];Ci&&aa.push(Ci);let ji={gsub:Ni,cpal:Ki,colr:De,stat:$l,avar:Me,cvar:Ye,fvar:Wn,gvar:er,gasp:Jt,svg:zr},Po={avar:[i.tables.fvar],fvar:[i.names]};for(let Dr in ji){let ro=i.tables[Dr];if(ro){let Qo=ji[Dr].make.call(i,ro,...Po[Dr]||[]);Qo&&aa.push(Qo)}}Gl&&aa.push(Gl);let _i=ws(aa),bo=_i.encode(),$i=Kr(bo),Ui=_i.fields,xs=!1;for(let Dr=0;Dr<Ui.length;Dr+=1)if(Ui[Dr].name==="head table"){Ui[Dr].value.checkSumAdjustment=2981146554-$i,xs=!0;break}if(!xs)throw new Error("Could not find head table with checkSum to adjust.");return _i}var Ti={make:ws,fontToTable:wc,computeCheckSum:Kr};function Ac(i,l){let c=0,f=i.length-1;for(;c<=f;){let m=c+f>>>1,x=i[m].tag;if(x===l)return m;x<l?c=m+1:f=m-1}return-c-1}function Tc(i,l){let c=0,f=i.length-1;for(;c<=f;){let m=c+f>>>1,x=i[m];if(x===l)return m;x<l?c=m+1:f=m-1}return-c-1}function J0(i,l){let c,f=0,m=i.length-1;for(;f<=m;){let x=f+m>>>1;c=i[x];let w=c.start;if(w===l)return c;w<l?f=x+1:m=x-1}if(f>0)return c=i[f-1],l>c.end?0:c}function ea(i,l){this.font=i,this.tableName=l}ea.prototype={searchTag:Ac,binSearch:Tc,getTable:function(i){let l=this.font.tables[this.tableName];return!l&&i&&(l=this.font.tables[this.tableName]=this.createDefaultTable()),l},getScriptNames:function(){let i=this.getTable();return i?i.scripts.map(function(l){return l.tag}):[]},getDefaultScriptName:function(){let i=this.getTable();if(!i)return;let l=!1;for(let c=0;c<i.scripts.length;c++){let f=i.scripts[c].tag;if(f==="DFLT")return f;f==="latn"&&(l=!0)}if(l)return"latn"},getScriptTable:function(i,l){let c=this.getTable(l);if(c){i=i||"DFLT";let f=c.scripts,m=Ac(c.scripts,i);if(m>=0)return f[m].script;if(l){let x={tag:i,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return f.splice(-1-m,0,x),x.script}}},getLangSysTable:function(i,l,c){let f=this.getScriptTable(i,c);if(f){if(!l||l==="dflt"||l==="DFLT")return f.defaultLangSys;let m=Ac(f.langSysRecords,l);if(m>=0)return f.langSysRecords[m].langSys;if(c){let x={tag:l,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return f.langSysRecords.splice(-1-m,0,x),x.langSys}}},getFeatureTable:function(i,l,c,f){let m=this.getLangSysTable(i,l,f);if(m){let x,w=m.featureIndexes,C=this.font.tables[this.tableName].features;for(let k=0;k<w.length;k++)if(x=C[w[k]],x.tag===c)return x.feature;if(f){let k=C.length;return J.assert(k===0||c>=C[k-1].tag,"Features must be added in alphabetical order."),x={tag:c,feature:{params:0,lookupListIndexes:[]}},C.push(x),w.push(k),x.feature}}},getLookupTables:function(i,l,c,f,m){let x=this.getFeatureTable(i,l,c,m),w=[];if(x){let C,k=x.lookupListIndexes,N=this.font.tables[this.tableName].lookups;for(let M=0;M<k.length;M++)C=N[k[M]],C.lookupType===f&&w.push(C);if(w.length===0&&m){C={lookupType:f,lookupFlag:0,subtables:[],markFilteringSet:void 0};let M=N.length;return N.push(C),k.push(M),[C]}}return w},getGlyphClass:function(i,l){switch(i.format){case 1:return i.startGlyph<=l&&l<i.startGlyph+i.classes.length?i.classes[l-i.startGlyph]:0;case 2:{let c=J0(i.ranges,l);return c?c.classId:0}}},getCoverageIndex:function(i,l){switch(i.format){case 1:{let c=Tc(i.glyphs,l);return c>=0?c:-1}case 2:{let c=J0(i.ranges,l);return c?c.index+l-c.start:-1}}},expandCoverage:function(i){if(i.format===1)return i.glyphs;{let l=[],c=i.ranges;for(let f=0;f<c.length;f++){let m=c[f],x=m.start,w=m.end;for(let C=x;C<=w;C++)l.push(C)}return l}}};var no=ea;function Ta(i){no.call(this,i,"gpos")}Ta.prototype=no.prototype,Ta.prototype.init=function(){let i=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(i)},Ta.prototype.getKerningValue=function(i,l,c){for(let f=0;f<i.length;f++){let m=i[f].subtables;for(let x=0;x<m.length;x++){let w=m[x],C=this.getCoverageIndex(w.coverage,l);if(!(C<0))switch(w.posFormat){case 1:{let k=w.pairSets[C];for(let N=0;N<k.length;N++){let M=k[N];if(M.secondGlyph===c)return M.value1&&M.value1.xAdvance||0}break}case 2:{let k=this.getGlyphClass(w.classDef1,l),N=this.getGlyphClass(w.classDef2,c),M=w.classRecords[k][N];return M.value1&&M.value1.xAdvance||0}}}}return 0},Ta.prototype.getKerningTables=function(i,l){if(this.font.tables.gpos)return this.getLookupTables(i,l,"kern",2)};var Sc=Ta;function uf(i,l){let c=i.length;if(c!==l.length)return!1;for(let f=0;f<c;f++)if(i[f]!==l[f])return!1;return!0}function df(i,l,c){let f=0,m=i.length-1,x=null;for(;f<=m;){let w=Math.floor((f+m)/2),C=i[w],k=C[l];if(k<c)f=w+1;else if(k>c)m=w-1;else{x=C;break}}return x}function hf(i,l,c){let f=0,m=i.length-1;for(;f<=m;){let x=Math.floor((f+m)/2),w=i[x];if(w[l]<c)f=x+1;else if(w[l]>c)m=x-1;else return x}return-1}function ta(i,l,c){let f=0,m=i.length,x=(w,C)=>w[l]-C[l];for(;f<m;){let w=f+m>>>1;x(i[w],c)<0?f=w+1:m=w}return i.splice(f,0,c),f}function Sa(i){return i[0]===31&&i[1]===139&&i[2]===8}function ff(i){let l=new DataView(i.buffer,i.byteOffset,i.byteLength),c=10,f=i.byteLength-8,m=l.getInt8(3);if(m&4&&(c+=2+l.getUint16(c,!0)),m&8)for(;c<f&&i[c++]!==0;);if(m&16)for(;c<f&&i[c++]!==0;);if(m&2&&(c+=2),c>=f)throw new Error("Can't find compressed blocks");let x=l.getUint32(l.byteLength-4,!0);return K(i.subarray(c,f),new Uint8Array(x))}function Ul(i){return{x:i.x,y:i.y,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour}}function ed(i){return{glyphIndex:i.glyphIndex,xScale:i.xScale,scale01:i.scale01,scale10:i.scale10,yScale:i.yScale,dx:i.dx,dy:i.dy}}function Si(i){no.call(this,i,"gsub")}function Cc(i,l,c){let f=i.subtables;for(let m=0;m<f.length;m++){let x=f[m];if(x.substFormat===l)return x}if(c)return f.push(c),c}Si.prototype=no.prototype,Si.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Si.prototype.getSingle=function(i,l,c){let f=[],m=this.getLookupTables(l,c,i,1);for(let x=0;x<m.length;x++){let w=m[x].subtables;for(let C=0;C<w.length;C++){let k=w[C],N=this.expandCoverage(k.coverage),M;if(k.substFormat===1){let W=k.deltaGlyphId;for(M=0;M<N.length;M++){let G=N[M];f.push({sub:G,by:G+W})}}else{let W=k.substitute;for(M=0;M<N.length;M++)f.push({sub:N[M],by:W[M]})}}}return f},Si.prototype.getMultiple=function(i,l,c){let f=[],m=this.getLookupTables(l,c,i,2);for(let x=0;x<m.length;x++){let w=m[x].subtables;for(let C=0;C<w.length;C++){let k=w[C],N=this.expandCoverage(k.coverage),M;for(M=0;M<N.length;M++){let W=N[M],G=k.sequences[M];f.push({sub:W,by:G})}}}return f},Si.prototype.getAlternates=function(i,l,c){let f=[],m=this.getLookupTables(l,c,i,3);for(let x=0;x<m.length;x++){let w=m[x].subtables;for(let C=0;C<w.length;C++){let k=w[C],N=this.expandCoverage(k.coverage),M=k.alternateSets;for(let W=0;W<N.length;W++)f.push({sub:N[W],by:M[W]})}}return f},Si.prototype.getLigatures=function(i,l,c){let f=[],m=this.getLookupTables(l,c,i,4);for(let x=0;x<m.length;x++){let w=m[x].subtables;for(let C=0;C<w.length;C++){let k=w[C],N=this.expandCoverage(k.coverage),M=k.ligatureSets;for(let W=0;W<N.length;W++){let G=N[W],le=M[W];for(let ne=0;ne<le.length;ne++){let me=le[ne];f.push({sub:[G].concat(me.components),by:me.ligGlyph})}}}}return f},Si.prototype.addSingle=function(i,l,c,f){let m=this.getLookupTables(c,f,i,1,!0)[0],x=Cc(m,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});J.assert(x.coverage.format===1,"Single: unable to modify coverage table format "+x.coverage.format);let w=l.sub,C=this.binSearch(x.coverage.glyphs,w);C<0&&(C=-1-C,x.coverage.glyphs.splice(C,0,w),x.substitute.splice(C,0,0)),x.substitute[C]=l.by},Si.prototype.addMultiple=function(i,l,c,f){J.assert(l.by instanceof Array&&l.by.length>1,'Multiple: "by" must be an array of two or more ids');let m=this.getLookupTables(c,f,i,2,!0)[0],x=Cc(m,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});J.assert(x.coverage.format===1,"Multiple: unable to modify coverage table format "+x.coverage.format);let w=l.sub,C=this.binSearch(x.coverage.glyphs,w);C<0&&(C=-1-C,x.coverage.glyphs.splice(C,0,w),x.sequences.splice(C,0,0)),x.sequences[C]=l.by},Si.prototype.addAlternate=function(i,l,c,f){let m=this.getLookupTables(c,f,i,3,!0)[0],x=Cc(m,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});J.assert(x.coverage.format===1,"Alternate: unable to modify coverage table format "+x.coverage.format);let w=l.sub,C=this.binSearch(x.coverage.glyphs,w);C<0&&(C=-1-C,x.coverage.glyphs.splice(C,0,w),x.alternateSets.splice(C,0,0)),x.alternateSets[C]=l.by},Si.prototype.addLigature=function(i,l,c,f){let m=this.getLookupTables(c,f,i,4,!0)[0],x=m.subtables[0];x||(x={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},m.subtables[0]=x),J.assert(x.coverage.format===1,"Ligature: unable to modify coverage table format "+x.coverage.format);let w=l.sub[0],C=l.sub.slice(1),k={ligGlyph:l.by,components:C},N=this.binSearch(x.coverage.glyphs,w);if(N>=0){let M=x.ligatureSets[N];for(let W=0;W<M.length;W++)if(uf(M[W].components,C))return;M.push(k)}else N=-1-N,x.coverage.glyphs.splice(N,0,w),x.ligatureSets.splice(N,0,[k])},Si.prototype.getFeature=function(i,l,c){if(/ss\d\d/.test(i))return this.getSingle(i,l,c);switch(i){case"aalt":case"salt":return this.getSingle(i,l,c).concat(this.getAlternates(i,l,c));case"dlig":case"liga":case"rlig":return this.getLigatures(i,l,c);case"ccmp":return this.getMultiple(i,l,c).concat(this.getLigatures(i,l,c));case"stch":return this.getMultiple(i,l,c)}},Si.prototype.add=function(i,l,c,f){if(/ss\d\d/.test(i))return this.addSingle(i,l,c,f);switch(i){case"aalt":case"salt":return typeof l.by=="number"?this.addSingle(i,l,c,f):this.addAlternate(i,l,c,f);case"dlig":case"liga":case"rlig":return this.addLigature(i,l,c,f);case"ccmp":return l.by instanceof Array?this.addMultiple(i,l,c,f):this.addLigature(i,l,c,f)}};var td=Si,_u=class{constructor(i){this.defaultValue=255,this.font=i}cpal(){return this.font.tables&&this.font.tables.cpal?this.font.tables.cpal:!1}getAll(i){let l=[],c=this.cpal();if(!c)return l;for(let f=0;f<c.colorRecordIndices.length;f++){let m=c.colorRecordIndices[f],x=[];for(let w=m;w<m+c.numPaletteEntries;w++)x.push($s(c.colorRecords[w],i||"hexa"));l.push(x)}return l}toCPALcolor(i){return Array.isArray(i)?i.map(l=>js(l,"raw")):js(i,"raw")}fillPalette(i,l=[],c=this.cpal().numPaletteEntries){return i=Number.isInteger(i)?this.get(i,"raw"):i,Object.assign(Array(c).fill(this.defaultValue),this.toCPALcolor(i).concat(this.toCPALcolor(l)))}extend(i){if(this.ensureCPAL(Array(i).fill(this.defaultValue)))return;let l=this.cpal(),c=l.numPaletteEntries+i,f=this.getAll().map(m=>this.fillPalette(m,[],c));l.numPaletteEntries=c,l.colorRecords=this.toCPALcolor(f.flat()),this.updateIndices()}get(i,l="hexa"){return this.getAll(l)[i]||null}getColor(i,l=0,c="hexa"){return br(this.font,i,l,c)}setColor(i,l,c=0){i=parseInt(i),c=parseInt(c);let f=this.getAll("raw"),m=f[c];if(!m)throw Error(`paletteIndex ${c} out of range`);let x=this.cpal(),w=x.numPaletteEntries;Array.isArray(l)||(l=[l]),l.length+i>w&&(this.extend(l.length+i-w),f=this.getAll("raw"),m=f[c]);for(let C=0;C<l.length;C++)m[C+i]=this.toCPALcolor(l[C]);x.colorRecords=f.flat(),this.updateIndices()}add(i){if(this.ensureCPAL(i))return;let l=this.cpal(),c=l.numPaletteEntries;i&&i.length?(i=this.toCPALcolor(i),i.length>c?this.extend(i.length-c):i.length<c&&(i=this.fillPalette(i)),l.colorRecordIndices.push(l.colorRecords.length),l.colorRecords.push(...i)):(l.colorRecordIndices.push(l.colorRecords.length),l.colorRecords.push(...Array(c).fill(this.defaultValue)))}delete(i){let l=this.getAll("raw");delete l[i];let c=this.cpal();c.colorRecordIndices.pop(),c.colorRecords=l.flat()}deleteColor(i,l){if(i===l)throw Error("replacementIndex cannot be the same as colorIndex");let c=this.cpal(),f=this.getAll("raw"),m=[];if(l>c.numPaletteEntries-1)throw Error(`Replacement index out of range: numPaletteEntries after deletion: ${c.numPaletteEntries-1}, replacementIndex: ${l})`);for(let C=0;C<f.length;C++){let k=f[C].filter((N,M)=>M!==i);m.push(k)}let x=this.font.tables.colr;if(x){let C=x.layerRecords;for(let k=0;k<C.length;k++){let N=C[k].paletteIndex;if(N>i)C[k].paletteIndex-=1;else if(N===i){let M=0;for(let W=0;W<f.length;W++)if(l>i&&l<=i+f[W].length){M++;break}C[k].paletteIndex=l-M}}this.font.tables.colr={...x,layerRecords:C}}let w=m.flat();for(let C=0;C<f.length;C++)c.colorRecordIndices[C]-=C;c.numPaletteEntries=Math.max(0,c.numPaletteEntries-1),c.colorRecords=this.toCPALcolor(w)}ensureCPAL(i){return this.cpal()?!1:(!i||!i.length?i=[this.defaultValue]:i=this.toCPALcolor(i),this.font.tables.cpal={version:0,numPaletteEntries:i.length,colorRecords:i,colorRecordIndices:[0]},!0)}updateIndices(){let i=this.cpal(),l=Math.ceil(i.colorRecords.length/i.numPaletteEntries);i.colorRecordIndices=[];for(let c=0;c<l;c++)i.colorRecordIndices.push(c*i.numPaletteEntries)}},Hl=class{constructor(i){this.font=i}ensureCOLR(){return this.font.tables.colr||(this.font.tables.colr={version:0,baseGlyphRecords:[],layerRecords:[]}),this.font}get(i){let l=this.font,c=[],f=l.tables.colr,m=l.tables.cpal;if(!f||!m)return c;let x=df(f.baseGlyphRecords,"glyphID",i);if(!x)return c;let w=x.firstLayerIndex,C=x.numLayers;for(let k=0;k<C;k++){let N=f.layerRecords[w+k];c.push({glyph:l.glyphs.get(N.glyphID),paletteIndex:N.paletteIndex})}return c}add(i,l,c){let f=this.get(i);l=Array.isArray(l)?l:[l],c===void 0||c===1/0||c>f.length?c=f.length:c<0&&(c=f.length+1+c%(f.length+1),c>=f.length+1&&(c-=f.length+1));let m=[];for(let x=0;x<c;x++){let w=Number.isInteger(f[x].glyph)?f[x].glyph:f[x].glyph.index;m.push({glyphID:w,paletteIndex:f[x].paletteIndex})}for(let x of l){let w=Number.isInteger(x.glyph)?x.glyph:x.glyph.index;m.push({glyphID:w,paletteIndex:x.paletteIndex})}for(let x=c;x<f.length;x++){let w=Number.isInteger(f[x].glyph)?f[x].glyph:f[x].glyph.index;m.push({glyphID:w,paletteIndex:f[x].paletteIndex})}this.updateColrTable(i,m)}setPaletteIndex(i,l,c){let f=this.get(i);f[l]?(f=f.map((m,x)=>({glyphID:m.glyph.index,paletteIndex:x===l?c:m.paletteIndex})),this.updateColrTable(i,f)):console.error("Invalid layer index")}remove(i,l,c=l){let f=this.get(i);f=f.map(m=>({glyphID:m.glyph.index,paletteIndex:m.paletteIndex})),f.splice(l,c-l+1),this.updateColrTable(i,f)}updateColrTable(i,l){this.ensureCOLR();let c=this.font.tables.colr,f=hf(c.baseGlyphRecords,"glyphID",i);if(f===-1){let k={glyphID:i,firstLayerIndex:c.layerRecords.length,numLayers:0};f=ta(c.baseGlyphRecords,"glyphID",k)}let m=c.baseGlyphRecords[f],x=m.numLayers,w=l.length,C=w-x;if(C>0){let k=l.slice(x).map(N=>({glyphID:N.glyphID,paletteIndex:N.paletteIndex}));c.layerRecords.splice(m.firstLayerIndex+x,0,...k)}else C<0&&c.layerRecords.splice(m.firstLayerIndex+w,-C);for(let k=0;k<Math.min(x,w);k++)c.layerRecords[m.firstLayerIndex+k]={glyphID:l[k].glyphID,paletteIndex:l[k].paletteIndex};if(m.numLayers=w,C!==0)for(let k=0;k<c.baseGlyphRecords.length;k++){let N=c.baseGlyphRecords[k];k===f||N.firstLayerIndex<m.firstLayerIndex||(c.baseGlyphRecords[k].firstLayerIndex+=C)}}},gl=class{constructor(i){this.font=i,this.cache=new WeakMap}get(i){let l=this.getOrCreateSvgImageCacheEntry(i);return l&&l.image}getAsync(i){let l=this.getOrCreateSvgImageCacheEntry(i);return l&&l.promise}getOrCreateSvgImageCacheEntry(i){let l=this.font.tables.svg;if(l===void 0)return;let c=l.get(i);if(c===void 0)return;let f=this.cache.get(c);f===void 0&&(f=pf(c),this.cache.set(c,f));let m=f.images.get(i);return m===void 0&&(m=nd(this.font,f.template,i),m.promise.then(x=>{if(m.image=x,typeof this.font.onGlyphUpdated=="function")try{this.font.onGlyphUpdated(i)}catch(w){console.error("font.onGlyphUpdated",i,w)}}),f.images.set(i,m)),m}};function pf(i){return{template:Lu(i).then(rd),images:new Map}}function nd(i,l,c){return{promise:l.then(f=>{let m;typeof f=="string"?m=f:(f[4]=c,m=f.join(""));let x=Eu(m,i.unitsPerEm);return x.image.decode().then(()=>x)}),image:void 0}}var Lu=typeof DecompressionStream=="function"?mf:ku;function ku(i){try{return Promise.resolve(new TextDecoder().decode(Sa(i)?ff(i):i))}catch(l){return Promise.reject(l)}}function mf(i){if(Sa(i))return new Response(new Response(i).body.pipeThrough(new DecompressionStream("gzip"))).text();try{return Promise.resolve(new TextDecoder().decode(i))}catch(l){return Promise.reject(l)}}function rd(i){let l=i.indexOf("<svg"),c=i.indexOf(">",l+4)+1;if(/ id=['"]glyph\d+['"]/.test(i.substring(l,c)))return i;let f=i.lastIndexOf("</svg>");return[i.substring(0,c),"<defs>",i.substring(c,f),'</defs><use href="#glyph',"",'"/>',i.substring(f)]}function Eu(i,l){let c=new DOMParser().parseFromString(i,"image/svg+xml").documentElement,f=c.viewBox.baseVal,m=c.width.baseVal,x=c.height.baseVal,w=1,C=1;f.width>0&&f.height>0&&(m.unitType===1?(w=m.valueInSpecifiedUnits/f.width,C=x.unitType===1?x.valueInSpecifiedUnits/f.height:w):x.unitType===1?(C=x.valueInSpecifiedUnits/f.height,w=C):l&&(w=l/f.width,C=l/f.height));let k=document.createElement("div");k.style.position="fixed",k.style.visibility="hidden",k.appendChild(c),document.body.appendChild(k);let N=c.getBBox();document.body.removeChild(k);let M=(N.x-f.x)*w,W=(f.y-N.y)*C,G=N.width*w,le=N.height*C;c.setAttribute("viewBox",[N.x,N.y,N.width,N.height].join(" ")),w!==1&&c.setAttribute("width",G),C!==1&&c.setAttribute("height",le);let ne=new Image(G,le);return ne.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(c.outerHTML),{leftSideBearing:M,baseline:W,image:ne}}var _c=new WeakMap;function Pi(i,l,c,f,m){let x;return(l&f)>0?(x=i.parseByte(),(l&m)===0&&(x=-x),x=c+x):(l&m)>0?x=c:x=c+i.parseShort(),x}function Ha(i,l,c){let f=new Ue.Parser(l,c);i._numberOfContours=f.parseShort(),i._xMin=f.parseShort(),i._yMin=f.parseShort(),i._xMax=f.parseShort(),i._yMax=f.parseShort();let m,x;if(i._numberOfContours>0){let w=i.endPointIndices=[];for(let k=0;k<i._numberOfContours;k+=1)w.push(f.parseUShort());i.instructionLength=f.parseUShort(),i.instructions=[];for(let k=0;k<i.instructionLength;k+=1)i.instructions.push(f.parseByte());let C=w[w.length-1]+1;m=[];for(let k=0;k<C;k+=1)if(x=f.parseByte(),m.push(x),(x&8)>0){let N=f.parseByte();for(let M=0;M<N;M+=1)m.push(x),k+=1}if(J.argument(m.length===C,"Bad flags."),w.length>0){let k=[],N;if(C>0){for(let G=0;G<C;G+=1)x=m[G],N={},N.onCurve=!!(x&1),N.lastPointOfContour=w.indexOf(G)>=0,k.push(N);let M=0;for(let G=0;G<C;G+=1)x=m[G],N=k[G],N.x=Pi(f,x,M,2,16),M=N.x;let W=0;for(let G=0;G<C;G+=1)x=m[G],N=k[G],N.y=Pi(f,x,W,4,32),W=N.y}i.points=k}else i.points=[]}else if(i._numberOfContours===0)i.points=[];else{i.isComposite=!0,i.points=[],i.components=[];let w=!0;for(;w;){m=f.parseUShort();let C={glyphIndex:f.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(m&1)>0?(m&2)>0?(C.dx=f.parseShort(),C.dy=f.parseShort()):C.matchedPoints=[f.parseUShort(),f.parseUShort()]:(m&2)>0?(C.dx=f.parseChar(),C.dy=f.parseChar()):C.matchedPoints=[f.parseByte(),f.parseByte()],(m&8)>0?C.xScale=C.yScale=f.parseF2Dot14():(m&64)>0?(C.xScale=f.parseF2Dot14(),C.yScale=f.parseF2Dot14()):(m&128)>0&&(C.xScale=f.parseF2Dot14(),C.scale01=f.parseF2Dot14(),C.scale10=f.parseF2Dot14(),C.yScale=f.parseF2Dot14()),i.components.push(C),w=!!(m&32)}if(m&256){i.instructionLength=f.parseUShort(),i.instructions=[];for(let C=0;C<i.instructionLength;C+=1)i.instructions.push(f.parseByte())}}}function za(i,l){let c=[];for(let f=0;f<i.length;f+=1){let m=i[f],x={x:l.xScale*m.x+l.scale10*m.y+l.dx,y:l.scale01*m.x+l.yScale*m.y+l.dy,onCurve:m.onCurve,lastPointOfContour:m.lastPointOfContour};c.push(x)}return c}function Lc(i){let l=[],c=[];for(let f=0;f<i.length;f+=1){let m=i[f];c.push(m),m.lastPointOfContour&&(l.push(c),c=[])}return J.argument(c.length===0,"There are still points left in the current contour."),l}function Ca(i){let l=new rt;if(!i)return l;let c=Lc(i);for(let f=0;f<c.length;++f){let m=c[f],x=m[m.length-1],w=m[0];if(x.onCurve)l.moveTo(x.x,x.y);else if(w.onCurve)l.moveTo(w.x,w.y);else{let C={x:(x.x+w.x)*.5,y:(x.y+w.y)*.5};l.moveTo(C.x,C.y)}for(let C=0;C<m.length;++C)if(x=w,w=m[(C+1)%m.length],x.onCurve)l.lineTo(x.x,x.y);else{let k=w;w.onCurve||(k={x:(x.x+w.x)*.5,y:(x.y+w.y)*.5}),l.quadraticCurveTo(x.x,x.y,k.x,k.y)}l.closePath()}return l}function ms(i,l){if(l.isComposite){_c.has(i)||_c.set(i,new Set);let c=_c.get(i);c.add(l.index);try{for(let f=0;f<l.components.length;f+=1){let m=l.components[f];if(c.has(m.glyphIndex))continue;let x=i.get(m.glyphIndex);if(x.getPath(),x.points){let w;if(m.matchedPoints===void 0)w=za(x.points,m);else{if(m.matchedPoints[0]>l.points.length-1||m.matchedPoints[1]>x.points.length-1)throw Error("Matched points out of range in "+l.name);let C=l.points[m.matchedPoints[0]],k=x.points[m.matchedPoints[1]],N={xScale:m.xScale,scale01:m.scale01,scale10:m.scale10,yScale:m.yScale,dx:0,dy:0};k=za([k],N)[0],N.dx=C.x-k.x,N.dy=C.y-k.y,w=za(x.points,N)}l.points=l.points.concat(w)}}}finally{c.delete(l.index)}}return Ca(l.points)}function gf(i,l,c,f){let m=new ke.GlyphSet(f);for(let x=0;x<c.length-1;x+=1){let w=c[x],C=c[x+1];w!==C?m.push(x,ke.ttfGlyphLoader(f,x,Ha,i,l+w,ms)):m.push(x,ke.glyphLoader(f,x))}return m}function xf(i,l,c,f){let m=new ke.GlyphSet(f);return f._push=function(x){let w=c[x],C=c[x+1];w!==C?m.push(x,ke.ttfGlyphLoader(f,x,Ha,i,l+w,ms)):m.push(x,ke.glyphLoader(f,x))},m}function sd(i,l,c,f,m){return m.lowMemory?xf(i,l,c,f):gf(i,l,c,f)}var Iu={getPath:Ca,parse:sd},E=class{constructor(i){this.font=i}normalizeCoordTags(i){for(let l in i)if(l.length<4){let c=l.padEnd(4," ");i[c]===void 0&&(i[c]=i[l]),delete i[l]}}getNormalizedCoords(i){i||(i=this.font.variation.get());let l=[];this.normalizeCoordTags(i);for(let c=0;c<this.fvar().axes.length;c++){let f=this.fvar().axes[c],m=i[f.tag];m===void 0&&(m=f.defaultValue),m<f.defaultValue?l.push((m-f.defaultValue+Number.EPSILON)/(f.defaultValue-f.minValue+Number.EPSILON)):l.push((m-f.defaultValue+Number.EPSILON)/(f.maxValue-f.defaultValue+Number.EPSILON))}if(this.avar())for(let c=0;c<this.avar().axisSegmentMaps.length;c++){let f=this.avar().axisSegmentMaps[c];for(let m=0;m<f.axisValueMaps.length;m++){let x=f.axisValueMaps[m];if(m>=1&&l[c]<x.fromCoordinate){let w=f.axisValueMaps[m-1];l[c]=((l[c]-w.fromCoordinate)*(x.toCoordinate-w.toCoordinate)+Number.EPSILON)/(x.fromCoordinate-w.fromCoordinate+Number.EPSILON)+w.toCoordinate;break}}}return l}interpolatePoints(i,l,c){if(i.length===0)return;let f=0;for(;f<i.length;){let m=f,x=f,w=i[x];for(;!w.lastPointOfContour;)w=i[++x];for(;f<=x&&!c[f];)f++;if(f>x)continue;let C=f,k=f;for(f++;f<=x;)c[f]&&(this.deltaInterpolate(k+1,f-1,k,f,l,i),k=f),f++;k===C?this.deltaShift(m,x,k,l,i):(this.deltaInterpolate(k+1,x,k,C,l,i),C>0&&this.deltaInterpolate(m,C-1,k,C,l,i)),f=x+1}}deltaInterpolate(i,l,c,f,m,x){if(i>l)return;let w=["x","y"];for(let k=0;k<w.length;k++){let N=w[k];if(m[c][N]>m[f][N]){var C=c;c=f,f=C}let M=m[c][N],W=m[f][N],G=x[c][N],le=x[f][N];if(M!==W||G===le){let ne=M===W?0:(le-G)/(W-M);for(let me=i;me<=l;me++){let He=m[me][N];He<=M?He+=G-M:He>=W?He+=le-W:He=G+(He-M)*ne,x[me][N]=He}}}}deltaShift(i,l,c,f,m){let x=m[c].x-f[c].x,w=m[c].y-f[c].y;if(!(x===0&&w===0))for(let C=i;C<=l;C++)C!==c&&(m[C].x+=x,m[C].y+=w)}transformComponents(i,l,c,f,m,x){let w=0;for(let C=0;C<i.components.length;C++){let k=i.components[C],N=this.font.glyphs.get(k.glyphIndex),M=ed(k),W=f.indexOf(C);W>-1&&(M.dx+=Math.round(m.deltas[W]*x),M.dy+=Math.round(m.deltasY[W]*x));let G=za(this.getTransform(N,c).points,M);l.splice(w,G.length,...G),w+=N.points.length}}applyTupleVariationStore(i,l,c,f="gvar",m={}){c||(c=this.font.variation.get());let x=this.getNormalizedCoords(c),{headers:w,sharedPoints:C}=i,k=this.fvar().axes.length,N;f==="gvar"?N=l.map(Ul):f==="cvar"&&(N=[...l]);for(let M=0;M<w.length;M++){let W=w[M],G=1;for(let ne=0;ne<k;ne++){let me=[0];switch(f){case"gvar":me=W.peakTuple?W.peakTuple:this.gvar().sharedTuples[W.sharedTupleRecordsIndex];break;case"cvar":me=W.peakTuple;break}if(me[ne]!==0){if(x[ne]===0){G=0;break}if(W.intermediateStartTuple)if(x[ne]<W.intermediateStartTuple[ne]||x[ne]>W.intermediateEndTuple[ne]){G=0;break}else x[ne]<me[ne]?G=G*(x[ne]-W.intermediateStartTuple[ne]+Number.EPSILON)/(me[ne]-W.intermediateStartTuple[ne]+Number.EPSILON):G=G*(W.intermediateEndTuple[ne]-x[ne]+Number.EPSILON)/(W.intermediateEndTuple[ne]-me[ne]+Number.EPSILON);else{if(x[ne]<Math.min(0,me[ne])||x[ne]>Math.max(0,me[ne])){G=0;break}G=(G*x[ne]+Number.EPSILON)/(me[ne]+Number.EPSILON)}}}if(G===0)continue;let le=W.privatePoints.length?W.privatePoints:C;if(f==="gvar"&&m.glyph&&m.glyph.isComposite)this.transformComponents(m.glyph,N,c,le,W,G);else if(le.length===0)for(let ne=0;ne<N.length;ne++){let me=N[ne];f==="gvar"?N[ne]={x:Math.round(me.x+W.deltas[ne]*G),y:Math.round(me.y+W.deltasY[ne]*G),onCurve:me.onCurve,lastPointOfContour:me.lastPointOfContour}:f==="cvar"&&(N[ne]=Math.round(me+W.deltas[ne]*G))}else{let ne;f==="gvar"?ne=N.map(Ul):f==="cvar"&&(ne=N);let me=Array(l.length).fill(!1);for(let He=0;He<le.length;He++){let Gt=le[He];if(Gt<l.length){let Ft=ne[Gt];f==="gvar"?(me[Gt]=!0,Ft.x+=W.deltas[He]*G,Ft.y+=W.deltasY[He]*G):f==="cvar"&&(N[Gt]=Math.round(Ft+W.deltas[He]*G))}}if(f==="gvar"){this.interpolatePoints(ne,N,me);for(let He=0;He<l.length;He++){let Gt=ne[He].x-N[He].x,Ft=ne[He].y-N[He].y;N[He].x=Math.round(N[He].x+Gt),N[He].y=Math.round(N[He].y+Ft)}}}}return N}getTransform(i,l){Number.isInteger(i)&&(i=this.font.glyphs.get(i));let c=i.getBlendPath,f=!!(i.points&&i.points.length),m=i;if(c||f){if(l||(l=this.font.variation.get()),f){let x=this.gvar()&&this.gvar().glyphVariations[i.index];if(x){let w=i.points,C=this.applyTupleVariationStore(x,w,l,"gvar",{glyph:i});m=new Dn(Object.assign({},i,{points:C,path:Ca(C)}))}}else if(c){let x=i.getBlendPath(l);m=new Dn(Object.assign({},i,{path:x}))}}return this.font.tables.hvar&&(i._advanceWidth=typeof i._advanceWidth<"u"?i._advanceWidth:i.advanceWidth,i.advanceWidth=m.advanceWidth=Math.round(i._advanceWidth+this.getVariableAdjustment(m.index,"hvar","advanceWidth",l)),i._leftSideBearing=typeof i._leftSideBearing<"u"?i._leftSideBearing:i.leftSideBearing,i.leftSideBearing=m.leftSideBearing=Math.round(i._leftSideBearing+this.getVariableAdjustment(m.index,"hvar","lsb",l))),m}getCvarTransform(i){let l=this.font.tables.cvt,c=this.cvar();return!l||!l.length||!c||!c.headers.length?l:this.applyTupleVariationStore(c,l,i,"cvar")}getVariableAdjustment(i,l,c,f){f=f||this.font.variation.get();let m,x,w=this.font.tables[l];if(!w)throw Error(`trying to get variation adjustment from non-existent table "${w}"`);if(!w.itemVariationStore)throw Error(`trying to get variation adjustment from table "${w}" which does not have an itemVariationStore`);let C=w[c]&&w[c].map.length;if(C){let k=i;k>=C&&(k=C-1),{outerIndex:m,innerIndex:x}=w[c].map[k]}else m=0,x=i;return this.getDelta(w.itemVariationStore,m,x,f)}getDelta(i,l,c,f){if(l>=i.itemVariationSubtables.length)return 0;let m=i.itemVariationSubtables[l];if(c>=m.deltaSets.length)return 0;let x=m.deltaSets[c],w=this.getBlendVector(i,l,f),C=0;for(let k=0;k<m.regionIndexes.length;k++)C+=x[k]*w[k];return C}getBlendVector(i,l,c){c||(c=this.font.variation.get());let f=i.itemVariationSubtables[l],m=this.getNormalizedCoords(c),x=[];for(let w=0;w<f.regionIndexes.length;w++){let C=1,k=f.regionIndexes[w],N=i.variationRegions[k].regionAxes;for(let M=0;M<N.length;M++){let W=N[M],G;W.startCoord>W.peakCoord||W.peakCoord>W.endCoord||W.startCoord<0&&W.endCoord>0&&W.peakCoord!==0||W.peakCoord===0?G=1:m[M]<W.startCoord||m[M]>W.endCoord?G=0:m[M]===W.peakCoord?G=1:m[M]<W.peakCoord?G=(m[M]-W.startCoord+Number.EPSILON)/(W.peakCoord-W.startCoord+Number.EPSILON):G=(W.endCoord-m[M]+Number.EPSILON)/(W.endCoord-W.peakCoord+Number.EPSILON),C*=G}x[w]=C}return x}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}},Q=class{constructor(i){this.font=i,this.process=new E(this.font),this.activateDefaultVariation(),this.getTransform=this.process.getTransform.bind(this.process)}activateDefaultVariation(){let i=this.getDefaultInstanceIndex();i>-1?this.set(i):this.set(this.getDefaultCoordinates())}getDefaultCoordinates(){return this.fvar().axes.reduce((i,l)=>(i[l.tag]=l.defaultValue,i),{})}getDefaultInstanceIndex(){let i=this.getDefaultCoordinates(),l=this.getInstanceIndex(i);return l<0&&(l=this.fvar().instances.findIndex(c=>c.name&&c.name.en==="Regular")),l}getInstanceIndex(i){return this.fvar().instances.findIndex(l=>Object.keys(i).every(c=>l.coordinates[c]===i[c]))}getInstance(i){return this.fvar().instances&&this.fvar().instances[i]}set(i){let l;if(Number.isInteger(i)){let c=this.getInstance(i);if(!c)throw Error(`Invalid instance index ${i}`);l={...c.coordinates}}else l=i,this.process.normalizeCoordTags(l);l=Object.assign({},this.font.defaultRenderOptions.variation,l),this.font.defaultRenderOptions=Object.assign({},this.font.defaultRenderOptions,{variation:l})}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}},ae=1e6,Qe=64,st=1e4,Mt,Zt,tr,ur;function wr(i){this.font=i,this.getCommands=function(l){return Iu.getPath(l).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function Do(i){return i}function Ar(i){return Math.sign(i)*Math.round(Math.abs(i))}function Qi(i){return Math.sign(i)*Math.round(Math.abs(i*2))/2}function na(i){return Math.sign(i)*(Math.round(Math.abs(i)+.5)-.5)}function ra(i){return Math.sign(i)*Math.ceil(Math.abs(i))}function go(i){return Math.sign(i)*Math.floor(Math.abs(i))}var li=function(i){let l=this.srPeriod,c=this.srPhase,f=this.srThreshold,m=1;return i<0&&(i=-i,m=-1),i+=f-c,i=Math.trunc(i/l)*l,i+=c,i<0?c*m:i*m},gs={x:1,y:0,axis:"x",distance:function(i,l,c,f){return(c?i.xo:i.x)-(f?l.xo:l.x)},interpolate:function(i,l,c,f){let m,x,w,C,k,N,M;if(!f||f===this){if(m=i.xo-l.xo,x=i.xo-c.xo,k=l.x-l.xo,N=c.x-c.xo,w=Math.abs(m),C=Math.abs(x),M=w+C,M===0){i.x=i.xo+(k+N)/2;return}i.x=i.xo+(k*C+N*w)/M;return}if(m=f.distance(i,l,!0,!0),x=f.distance(i,c,!0,!0),k=f.distance(l,l,!1,!0),N=f.distance(c,c,!1,!0),w=Math.abs(m),C=Math.abs(x),M=w+C,M===0){gs.setRelative(i,i,(k+N)/2,f,!0);return}gs.setRelative(i,i,(k*C+N*w)/M,f,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(i,l,c,f,m){if(!f||f===this){i.x=(m?l.xo:l.x)+c;return}let x=m?l.xo:l.x,w=m?l.yo:l.y,C=x+c*f.x,k=w+c*f.y;i.x=C+(i.y-k)/f.normalSlope},slope:0,touch:function(i){i.xTouched=!0},touched:function(i){return i.xTouched},untouch:function(i){i.xTouched=!1}},sa={x:0,y:1,axis:"y",distance:function(i,l,c,f){return(c?i.yo:i.y)-(f?l.yo:l.y)},interpolate:function(i,l,c,f){let m,x,w,C,k,N,M;if(!f||f===this){if(m=i.yo-l.yo,x=i.yo-c.yo,k=l.y-l.yo,N=c.y-c.yo,w=Math.abs(m),C=Math.abs(x),M=w+C,M===0){i.y=i.yo+(k+N)/2;return}i.y=i.yo+(k*C+N*w)/M;return}if(m=f.distance(i,l,!0,!0),x=f.distance(i,c,!0,!0),k=f.distance(l,l,!1,!0),N=f.distance(c,c,!1,!0),w=Math.abs(m),C=Math.abs(x),M=w+C,M===0){sa.setRelative(i,i,(k+N)/2,f,!0);return}sa.setRelative(i,i,(k*C+N*w)/M,f,!0)},normalSlope:0,setRelative:function(i,l,c,f,m){if(!f||f===this){i.y=(m?l.yo:l.y)+c;return}let x=m?l.xo:l.x,w=m?l.yo:l.y,C=x+c*f.x,k=w+c*f.y;i.y=k+f.normalSlope*(i.x-C)},slope:Number.POSITIVE_INFINITY,touch:function(i){i.yTouched=!0},touched:function(i){return i.yTouched},untouch:function(i){i.yTouched=!1}};Object.freeze(gs),Object.freeze(sa);function Ga(i,l){this.x=i,this.y=l,this.axis=void 0,this.slope=l/i,this.normalSlope=-i/l,Object.freeze(this)}Ga.prototype.distance=function(i,l,c,f){return this.x*gs.distance(i,l,c,f)+this.y*sa.distance(i,l,c,f)},Ga.prototype.interpolate=function(i,l,c,f){let m,x,w,C,k,N,M;if(w=f.distance(i,l,!0,!0),C=f.distance(i,c,!0,!0),m=f.distance(l,l,!1,!0),x=f.distance(c,c,!1,!0),k=Math.abs(w),N=Math.abs(C),M=k+N,M===0){this.setRelative(i,i,(m+x)/2,f,!0);return}this.setRelative(i,i,(m*N+x*k)/M,f,!0)},Ga.prototype.setRelative=function(i,l,c,f,m){f=f||this;let x=m?l.xo:l.x,w=m?l.yo:l.y,C=x+c*f.x,k=w+c*f.y,N=f.normalSlope,M=this.slope,W=i.x,G=i.y;i.x=(M*W-N*C+k-G)/(M-N),i.y=M*(i.x-W)+G},Ga.prototype.touch=function(i){i.xTouched=!0,i.yTouched=!0};function Ru(i,l){let c=Math.sqrt(i*i+l*l);return i/=c,l/=c,i===1&&l===0?gs:i===0&&l===1?sa:new Ga(i,l)}function Wa(i,l,c,f){this.x=this.xo=Math.round(i*64)/64,this.y=this.yo=Math.round(l*64)/64,this.lastPointOfContour=c,this.onCurve=f,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}Wa.prototype.nextTouched=function(i){let l=this.nextPointOnContour;for(;!i.touched(l)&&l!==this;)l=l.nextPointOnContour;return l},Wa.prototype.prevTouched=function(i){let l=this.prevPointOnContour;for(;!i.touched(l)&&l!==this;)l=l.prevPointOnContour;return l};var Mu=Object.freeze(new Wa(0,0)),Iw={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function xl(i,l){switch(this.env=i,this.stack=[],this.prog=l,i){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=gs,this.round=Ar}}wr.prototype.exec=function(i,l){if(typeof l!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;let c=this.font,f=this._prepState;if(!f||f.ppem!==l){let m=this._fpgmState;if(!m){xl.prototype=Iw,m=this._fpgmState=new xl("fpgm",c.tables.fpgm),m.funcs=[],m.font=c,m.instructionCount=0,m.callDepth=0;try{Zt(m)}catch(w){console.log("Hinting error in FPGM:"+w),this._errorState=3;return}}xl.prototype=m,f=this._prepState=new xl("prep",c.tables.prep),f.ppem=l,f.instructionCount=0,f.callDepth=0;let x=c.variation&&c.variation.process.getCvarTransform()||c.tables.cvt;if(x){let w=f.cvt=new Array(x.length),C=l/c.unitsPerEm;for(let k=0;k<x.length;k++)w[k]=x[k]*C}else f.cvt=[];try{Zt(f)}catch(w){this._errorState<2&&console.log("Hinting error in PREP:"+w),this._errorState=2}}if(!(this._errorState>1))try{return tr(i,f)}catch(m){this._errorState<1&&(console.log("Hinting error:"+m),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}},tr=function(i,l){let c=l.ppem/l.font.unitsPerEm,f=c,m=i.components,x,w,C;if(xl.prototype=l,!m)C=new xl("glyf",i.instructions),C.instructionCount=0,C.callDepth=0,ur(i,C,c,f),w=C.gZone;else{let k=l.font;w=[],x=[];for(let N=0;N<m.length;N++){let M=m[N],W=k.glyphs.get(M.glyphIndex);C=new xl("glyf",W.instructions),C.instructionCount=0,C.callDepth=0,ur(W,C,c,f);let G=Math.round(M.dx*c),le=Math.round(M.dy*f),ne=C.gZone,me=C.contours;for(let Gt=0;Gt<ne.length;Gt++){let Ft=ne[Gt];Ft.xTouched=Ft.yTouched=!1,Ft.xo=Ft.x=Ft.x+G,Ft.yo=Ft.y=Ft.y+le}let He=w.length;w.push.apply(w,ne);for(let Gt=0;Gt<me.length;Gt++)x.push(me[Gt]+He)}i.instructions&&!C.inhibitGridFit&&(C=new xl("glyf",i.instructions),C.gZone=C.z0=C.z1=C.z2=w,C.contours=x,w.push(new Wa(0,0),new Wa(Math.round(i.advanceWidth*c),0)),Zt(C),w.length-=2)}return w},ur=function(i,l,c,f){let m=i.points||[],x=m.length,w=l.gZone=l.z0=l.z1=l.z2=[],C=l.contours=[],k;for(let W=0;W<x;W++)k=m[W],w[W]=new Wa(k.x*c,k.y*f,k.lastPointOfContour,k.onCurve);let N,M;for(let W=0;W<x;W++)k=w[W],N||(N=k,C.push(W)),k.lastPointOfContour?(k.nextPointOnContour=N,N.prevPointOnContour=k,N=void 0):(M=w[W+1],k.nextPointOnContour=M,M.prevPointOnContour=k);l.inhibitGridFit||(w.push(new Wa(0,0),new Wa(Math.round(i.advanceWidth*c),0)),Zt(l),w.length-=2)},Zt=function(i){let l=i.prog;if(!l)return;let c=l.length,f;for(i.ip=0;i.ip<c;i.ip++){if(++i.instructionCount>ae)throw new Error("Hinting instructions exceeded maximum of "+ae);if(f=Mt[l[i.ip]],!f)throw new Error("unknown instruction: 0x"+Number(l[i.ip]).toString(16));f(i)}};function id(i){let l=i.tZone=new Array(i.gZone.length);for(let c=0;c<l.length;c++)l[c]=new Wa(0,0)}function g1(i,l){let c=i.prog,f=i.ip,m=1,x;do if(x=c[++f],x===88)m++;else if(x===89)m--;else if(x===64)f+=c[f+1]+1;else if(x===65)f+=2*c[f+1]+1;else if(x>=176&&x<=183)f+=x-176+1;else if(x>=184&&x<=191)f+=(x-184+1)*2;else if(l&&m===1&&x===27)break;while(m>0);i.ip=f}function x1(i,l){l.fv=l.pv=l.dpv=i}function y1(i,l){l.pv=l.dpv=i}function b1(i,l){l.fv=i}function v1(i,l){let c=l.stack,f=c.pop(),m=c.pop(),x=l.z2[f],w=l.z1[m],C,k;i?(C=x.y-w.y,k=w.x-x.x):(C=w.x-x.x,k=w.y-x.y),l.pv=l.dpv=Ru(C,k)}function w1(i,l){let c=l.stack,f=c.pop(),m=c.pop(),x=l.z2[f],w=l.z1[m],C,k;i?(C=x.y-w.y,k=w.x-x.x):(C=w.x-x.x,k=w.y-x.y),l.fv=Ru(C,k)}function Rw(i){let l=i.stack,c=l.pop(),f=l.pop();i.pv=i.dpv=Ru(f,c)}function Mw(i){let l=i.stack,c=l.pop(),f=l.pop();i.fv=Ru(f,c)}function Nw(i){let l=i.stack,c=i.pv;l.push(c.x*16384),l.push(c.y*16384)}function Dw(i){let l=i.stack,c=i.fv;l.push(c.x*16384),l.push(c.y*16384)}function Bw(i){i.fv=i.pv}function Pw(i){let l=i.stack,c=l.pop(),f=l.pop(),m=l.pop(),x=l.pop(),w=l.pop(),C=i.z0,k=i.z1,N=C[c],M=C[f],W=k[m],G=k[x],le=i.z2[w],ne=N.x,me=N.y,He=M.x,Gt=M.y,Ft=W.x,rn=W.y,kn=G.x,mr=G.y,kr=(ne-He)*(rn-mr)-(me-Gt)*(Ft-kn),Er=ne*Gt-me*He,As=Ft*mr-rn*kn;le.x=(Er*(Ft-kn)-As*(ne-He))/kr,le.y=(Er*(rn-mr)-As*(me-Gt))/kr}function Qw(i){i.rp0=i.stack.pop()}function Ow(i){i.rp1=i.stack.pop()}function Fw(i){i.rp2=i.stack.pop()}function jw(i){let l=i.stack.pop();switch(i.zp0=l,l){case 0:i.tZone||id(i),i.z0=i.tZone;break;case 1:i.z0=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function $w(i){let l=i.stack.pop();switch(i.zp1=l,l){case 0:i.tZone||id(i),i.z1=i.tZone;break;case 1:i.z1=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function Uw(i){let l=i.stack.pop();switch(i.zp2=l,l){case 0:i.tZone||id(i),i.z2=i.tZone;break;case 1:i.z2=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function Hw(i){let l=i.stack.pop();switch(i.zp0=i.zp1=i.zp2=l,l){case 0:i.tZone||id(i),i.z0=i.z1=i.z2=i.tZone;break;case 1:i.z0=i.z1=i.z2=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function zw(i){i.loop=i.stack.pop(),i.loop>st&&(i.loop=st)}function Gw(i){i.round=Ar}function Ww(i){i.round=na}function Vw(i){let l=i.stack.pop();i.minDis=l/64}function qw(i){g1(i,!1)}function Yw(i){let l=i.stack.pop();i.ip+=l-1}function Zw(i){let l=i.stack.pop();i.cvCutIn=l/64}function Kw(i){let l=i.stack;l.push(l[l.length-1])}function yf(i){i.stack.pop()}function Xw(i){i.stack.length=0}function Jw(i){let l=i.stack,c=l.pop(),f=l.pop();l.push(c),l.push(f)}function e4(i){let l=i.stack;l.push(l.length)}function t4(i){let l=i.stack,c=l.pop(),f=l.pop();if(f>st&&(f=st),++i.callDepth>Qe)throw new Error("Hinting call depth exceeded maximum of "+Qe);let m=i.ip,x=i.prog;i.prog=i.funcs[c];for(let w=0;w<f;w++)Zt(i);i.ip=m,i.prog=x,i.callDepth--}function n4(i){let l=i.stack.pop();if(++i.callDepth>Qe)throw new Error("Hinting call depth exceeded maximum of "+Qe);let c=i.ip,f=i.prog;i.prog=i.funcs[l],Zt(i),i.ip=c,i.prog=f,i.callDepth--}function r4(i){let l=i.stack,c=l.pop();l.push(l[l.length-c])}function s4(i){let l=i.stack,c=l.pop();l.push(l.splice(l.length-c,1)[0])}function i4(i){if(i.env!=="fpgm")throw new Error("FDEF not allowed here");let l=i.stack,c=i.prog,f=i.ip,m=l.pop(),x=f;for(;c[++f]!==45;);i.ip=f,i.funcs[m]=c.slice(x+1,f)}function A1(i,l){let c=l.stack.pop(),f=l.z0[c],m=l.fv,x=l.pv,w=x.distance(f,Mu);i&&(w=l.round(w)),m.setRelative(f,Mu,w,x),m.touch(f),l.rp0=l.rp1=c}function T1(i,l){let c=l.z2,f=c.length-2,m,x,w;for(let C=0;C<f;C++)m=c[C],!i.touched(m)&&(x=m.prevTouched(i),x!==m&&(w=m.nextTouched(i),x===w&&i.setRelative(m,m,i.distance(x,x,!1,!0),i,!0),i.interpolate(m,x,w,i)))}function S1(i,l){let c=l.stack,f=i?l.rp1:l.rp2,m=(i?l.z0:l.z1)[f],x=l.fv,w=l.pv,C=l.loop,k=l.z2;for(;C--;){let N=c.pop(),M=k[N],W=w.distance(m,m,!1,!0);x.setRelative(M,M,W,w),x.touch(M)}l.loop=1}function C1(i,l){let c=l.stack,f=i?l.rp1:l.rp2,m=(i?l.z0:l.z1)[f],x=l.fv,w=l.pv,C=c.pop(),k=l.z2[l.contours[C]],N=k,M=w.distance(m,m,!1,!0);do N!==m&&x.setRelative(N,N,M,w),N=N.nextPointOnContour;while(N!==k)}function _1(i,l){let c=l.stack,f=i?l.rp1:l.rp2,m=(i?l.z0:l.z1)[f],x=l.fv,w=l.pv,C=c.pop(),k;switch(C){case 0:k=l.tZone;break;case 1:k=l.gZone;break;default:throw new Error("Invalid zone")}let N,M=w.distance(m,m,!1,!0),W=k.length-2;for(let G=0;G<W;G++)N=k[G],x.setRelative(N,N,M,w)}function o4(i){let l=i.stack,c=i.loop,f=i.fv,m=l.pop()/64,x=i.z2;for(;c--;){let w=l.pop(),C=x[w];f.setRelative(C,C,m),f.touch(C)}i.loop=1}function a4(i){let l=i.stack,c=i.rp1,f=i.rp2,m=i.loop,x=i.z0[c],w=i.z1[f],C=i.fv,k=i.dpv,N=i.z2;for(;m--;){let M=l.pop(),W=N[M];C.interpolate(W,x,w,k),C.touch(W)}i.loop=1}function L1(i,l){let c=l.stack,f=c.pop()/64,m=c.pop(),x=l.z1[m],w=l.z0[l.rp0],C=l.fv,k=l.pv;C.setRelative(x,w,f,k),C.touch(x),l.rp1=l.rp0,l.rp2=m,i&&(l.rp0=m)}function l4(i){let l=i.stack,c=i.rp0,f=i.z0[c],m=i.loop,x=i.fv,w=i.pv,C=i.z1;for(;m--;){let k=l.pop(),N=C[k];x.setRelative(N,f,0,w),x.touch(N)}i.loop=1}function c4(i){i.round=Qi}function k1(i,l){let c=l.stack,f=c.pop(),m=c.pop(),x=l.z0[m],w=l.fv,C=l.pv,k=l.cvt[f],N=C.distance(x,Mu);i&&(Math.abs(N-k)<l.cvCutIn&&(N=k),N=l.round(N)),w.setRelative(x,Mu,N,C),l.zp0===0&&(x.xo=x.x,x.yo=x.y),w.touch(x),l.rp0=l.rp1=m}function u4(i){let l=i.prog,c=i.ip,f=i.stack,m=l[++c];for(let x=0;x<m;x++)f.push(l[++c]);i.ip=c}function d4(i){let l=i.ip,c=i.prog,f=i.stack,m=c[++l];for(let x=0;x<m;x++){let w=c[++l]<<8|c[++l];w&32768&&(w=-((w^65535)+1)),f.push(w)}i.ip=l}function h4(i){let l=i.stack,c=i.store;c||(c=i.store=[]);let f=l.pop(),m=l.pop();c[m]=f}function f4(i){let l=i.stack,c=i.store,f=l.pop(),m=c&&c[f]||0;l.push(m)}function p4(i){let l=i.stack,c=l.pop(),f=l.pop();i.cvt[f]=c/64}function m4(i){let l=i.stack,c=l.pop();l.push(i.cvt[c]*64)}function E1(i,l){let c=l.stack,f=c.pop(),m=l.z2[f];c.push(l.dpv.distance(m,Mu,i,!1)*64)}function I1(i,l){let c=l.stack,f=c.pop(),m=c.pop(),x=l.z1[f],w=l.z0[m],C=l.dpv.distance(w,x,i,i);l.stack.push(Math.round(C*64))}function g4(i){i.stack.push(i.ppem)}function x4(i){i.autoFlip=!0}function y4(i){let l=i.stack,c=l.pop(),f=l.pop();l.push(f<c?1:0)}function b4(i){let l=i.stack,c=l.pop(),f=l.pop();l.push(f<=c?1:0)}function v4(i){let l=i.stack,c=l.pop(),f=l.pop();l.push(f>c?1:0)}function w4(i){let l=i.stack,c=l.pop(),f=l.pop();l.push(f>=c?1:0)}function A4(i){let l=i.stack,c=l.pop(),f=l.pop();l.push(c===f?1:0)}function T4(i){let l=i.stack,c=l.pop(),f=l.pop();l.push(c!==f?1:0)}function S4(i){let l=i.stack,c=l.pop();l.push(Math.trunc(c)&1?1:0)}function C4(i){let l=i.stack,c=l.pop();l.push(Math.trunc(c)&1?0:1)}function _4(i){let l=i.stack.pop(),c;l||g1(i,!0)}function L4(i){}function k4(i){let l=i.stack,c=l.pop(),f=l.pop();l.push(c&&f?1:0)}function E4(i){let l=i.stack,c=l.pop(),f=l.pop();l.push(c||f?1:0)}function I4(i){let l=i.stack,c=l.pop();l.push(c?0:1)}function bf(i,l){let c=l.stack,f=c.pop(),m=l.fv,x=l.pv,w=l.ppem,C=l.deltaBase+(i-1)*16,k=l.deltaShift,N=l.z0;for(let M=0;M<f;M++){let W=c.pop(),G=c.pop();if(C+((G&240)>>4)!==w)continue;let le=(G&15)-8;le>=0&&le++;let ne=N[W];m.setRelative(ne,ne,le*k,x)}}function R4(i){let l=i.stack.pop();i.deltaBase=l}function M4(i){let l=i.stack.pop();i.deltaShift=Math.pow(.5,l)}function N4(i){let l=i.stack,c=l.pop(),f=l.pop();l.push(f+c)}function D4(i){let l=i.stack,c=l.pop(),f=l.pop();l.push(f-c)}function B4(i){let l=i.stack,c=l.pop(),f=l.pop();l.push(f*64/c)}function P4(i){let l=i.stack,c=l.pop(),f=l.pop();l.push(f*c/64)}function Q4(i){let l=i.stack,c=l.pop();l.push(Math.abs(c))}function O4(i){let l=i.stack,c=l.pop();l.push(-c)}function F4(i){let l=i.stack,c=l.pop();l.push(Math.floor(c/64)*64)}function j4(i){let l=i.stack,c=l.pop();l.push(Math.ceil(c/64)*64)}function od(i,l){let c=l.stack,f=c.pop();c.push(l.round(f/64)*64)}function $4(i){let l=i.stack,c=l.pop(),f=l.pop();i.cvt[f]=c*i.ppem/i.font.unitsPerEm}function vf(i,l){let c=l.stack,f=c.pop(),m=l.ppem,x=l.deltaBase+(i-1)*16,w=l.deltaShift;for(let C=0;C<f;C++){let k=c.pop(),N=c.pop();if(x+((N&240)>>4)!==m)continue;let M=(N&15)-8;M>=0&&M++;let W=M*w;l.cvt[k]+=W}}function U4(i){let l=i.stack.pop();i.round=li;let c;switch(l&192){case 0:c=.5;break;case 64:c=1;break;case 128:c=2;break;default:throw new Error("invalid SROUND value")}switch(i.srPeriod=c,l&48){case 0:i.srPhase=0;break;case 16:i.srPhase=.25*c;break;case 32:i.srPhase=.5*c;break;case 48:i.srPhase=.75*c;break;default:throw new Error("invalid SROUND value")}l&=15,l===0?i.srThreshold=0:i.srThreshold=(l/8-.5)*c}function H4(i){let l=i.stack.pop();i.round=li;let c;switch(l&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(i.srPeriod=c,l&48){case 0:i.srPhase=0;break;case 16:i.srPhase=.25*c;break;case 32:i.srPhase=.5*c;break;case 48:i.srPhase=.75*c;break;default:throw new Error("invalid S45ROUND value")}l&=15,l===0?i.srThreshold=0:i.srThreshold=(l/8-.5)*c}function z4(i){i.round=Do}function G4(i){i.round=ra}function W4(i){i.round=go}function V4(i){let l=i.stack.pop()}function R1(i,l){let c=l.stack,f=c.pop(),m=c.pop(),x=l.z2[f],w=l.z1[m],C,k;i?(C=x.y-w.y,k=w.x-x.x):(C=w.x-x.x,k=w.y-x.y),l.dpv=Ru(C,k)}function q4(i){let l=i.stack,c=l.pop(),f=0;c&1&&(f=35),c&32&&(f|=4096),l.push(f)}function Y4(i){let l=i.stack,c=l.pop(),f=l.pop(),m=l.pop();l.push(f),l.push(c),l.push(m)}function Z4(i){let l=i.stack,c=l.pop(),f=l.pop();l.push(Math.max(f,c))}function K4(i){let l=i.stack,c=l.pop(),f=l.pop();l.push(Math.min(f,c))}function X4(i){let l=i.stack.pop()}function J4(i){let l=i.stack.pop(),c=i.stack.pop();switch(l){case 1:i.inhibitGridFit=!!c;return;case 2:i.ignoreCvt=!!c;return;default:throw new Error("invalid INSTCTRL[] selector")}}function yl(i,l){let c=l.stack,f=l.prog,m=l.ip;for(let x=0;x<i;x++)c.push(f[++m]);l.ip=m}function bl(i,l){let c=l.ip,f=l.prog,m=l.stack;for(let x=0;x<i;x++){let w=f[++c]<<8|f[++c];w&32768&&(w=-((w^65535)+1)),m.push(w)}l.ip=c}function jt(i,l,c,f,m,x){let w=x.stack,C=i&&w.pop(),k=w.pop(),N=x.rp0,M=x.z0[N],W=x.z1[k],G=x.minDis,le=x.fv,ne=x.dpv,me,He,Gt,Ft;He=me=ne.distance(W,M,!0,!0),Gt=He>=0?1:-1,He=Math.abs(He),i&&(Ft=x.cvt[C],f&&Math.abs(He-Ft)<x.cvCutIn&&(He=Ft)),c&&He<G&&(He=G),f&&(He=x.round(He)),le.setRelative(W,M,Gt*He,ne),le.touch(W),x.rp1=x.rp0,x.rp2=k,l&&(x.rp0=k)}Mt=[x1.bind(void 0,sa),x1.bind(void 0,gs),y1.bind(void 0,sa),y1.bind(void 0,gs),b1.bind(void 0,sa),b1.bind(void 0,gs),v1.bind(void 0,0),v1.bind(void 0,1),w1.bind(void 0,0),w1.bind(void 0,1),Rw,Mw,Nw,Dw,Bw,Pw,Qw,Ow,Fw,jw,$w,Uw,Hw,zw,Gw,Ww,Vw,qw,Yw,Zw,void 0,void 0,Kw,yf,Xw,Jw,e4,r4,s4,void 0,void 0,void 0,t4,n4,i4,void 0,A1.bind(void 0,0),A1.bind(void 0,1),T1.bind(void 0,sa),T1.bind(void 0,gs),S1.bind(void 0,0),S1.bind(void 0,1),C1.bind(void 0,0),C1.bind(void 0,1),_1.bind(void 0,0),_1.bind(void 0,1),o4,a4,L1.bind(void 0,0),L1.bind(void 0,1),l4,c4,k1.bind(void 0,0),k1.bind(void 0,1),u4,d4,h4,f4,p4,m4,E1.bind(void 0,0),E1.bind(void 0,1),void 0,I1.bind(void 0,0),I1.bind(void 0,1),g4,void 0,x4,void 0,void 0,y4,b4,v4,w4,A4,T4,S4,C4,_4,L4,k4,E4,I4,bf.bind(void 0,1),R4,M4,N4,D4,B4,P4,Q4,O4,F4,j4,od.bind(void 0,0),od.bind(void 0,1),od.bind(void 0,2),od.bind(void 0,3),void 0,void 0,void 0,void 0,$4,bf.bind(void 0,2),bf.bind(void 0,3),vf.bind(void 0,1),vf.bind(void 0,2),vf.bind(void 0,3),U4,H4,void 0,void 0,z4,void 0,G4,W4,yf,yf,void 0,void 0,void 0,void 0,void 0,V4,R1.bind(void 0,0),R1.bind(void 0,1),q4,void 0,Y4,Z4,K4,X4,J4,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,yl.bind(void 0,1),yl.bind(void 0,2),yl.bind(void 0,3),yl.bind(void 0,4),yl.bind(void 0,5),yl.bind(void 0,6),yl.bind(void 0,7),yl.bind(void 0,8),bl.bind(void 0,1),bl.bind(void 0,2),bl.bind(void 0,3),bl.bind(void 0,4),bl.bind(void 0,5),bl.bind(void 0,6),bl.bind(void 0,7),bl.bind(void 0,8),jt.bind(void 0,0,0,0,0,0),jt.bind(void 0,0,0,0,0,1),jt.bind(void 0,0,0,0,0,2),jt.bind(void 0,0,0,0,0,3),jt.bind(void 0,0,0,0,1,0),jt.bind(void 0,0,0,0,1,1),jt.bind(void 0,0,0,0,1,2),jt.bind(void 0,0,0,0,1,3),jt.bind(void 0,0,0,1,0,0),jt.bind(void 0,0,0,1,0,1),jt.bind(void 0,0,0,1,0,2),jt.bind(void 0,0,0,1,0,3),jt.bind(void 0,0,0,1,1,0),jt.bind(void 0,0,0,1,1,1),jt.bind(void 0,0,0,1,1,2),jt.bind(void 0,0,0,1,1,3),jt.bind(void 0,0,1,0,0,0),jt.bind(void 0,0,1,0,0,1),jt.bind(void 0,0,1,0,0,2),jt.bind(void 0,0,1,0,0,3),jt.bind(void 0,0,1,0,1,0),jt.bind(void 0,0,1,0,1,1),jt.bind(void 0,0,1,0,1,2),jt.bind(void 0,0,1,0,1,3),jt.bind(void 0,0,1,1,0,0),jt.bind(void 0,0,1,1,0,1),jt.bind(void 0,0,1,1,0,2),jt.bind(void 0,0,1,1,0,3),jt.bind(void 0,0,1,1,1,0),jt.bind(void 0,0,1,1,1,1),jt.bind(void 0,0,1,1,1,2),jt.bind(void 0,0,1,1,1,3),jt.bind(void 0,1,0,0,0,0),jt.bind(void 0,1,0,0,0,1),jt.bind(void 0,1,0,0,0,2),jt.bind(void 0,1,0,0,0,3),jt.bind(void 0,1,0,0,1,0),jt.bind(void 0,1,0,0,1,1),jt.bind(void 0,1,0,0,1,2),jt.bind(void 0,1,0,0,1,3),jt.bind(void 0,1,0,1,0,0),jt.bind(void 0,1,0,1,0,1),jt.bind(void 0,1,0,1,0,2),jt.bind(void 0,1,0,1,0,3),jt.bind(void 0,1,0,1,1,0),jt.bind(void 0,1,0,1,1,1),jt.bind(void 0,1,0,1,1,2),jt.bind(void 0,1,0,1,1,3),jt.bind(void 0,1,1,0,0,0),jt.bind(void 0,1,1,0,0,1),jt.bind(void 0,1,1,0,0,2),jt.bind(void 0,1,1,0,0,3),jt.bind(void 0,1,1,0,1,0),jt.bind(void 0,1,1,0,1,1),jt.bind(void 0,1,1,0,1,2),jt.bind(void 0,1,1,0,1,3),jt.bind(void 0,1,1,1,0,0),jt.bind(void 0,1,1,1,0,1),jt.bind(void 0,1,1,1,0,2),jt.bind(void 0,1,1,1,0,3),jt.bind(void 0,1,1,1,1,0),jt.bind(void 0,1,1,1,1,1),jt.bind(void 0,1,1,1,1,2),jt.bind(void 0,1,1,1,1,3)];var e7=wr;function kc(i){this.char=i,this.state={},this.activeState=null}function wf(i,l,c){this.contextName=c,this.startIndex=i,this.endOffset=l}function t7(i,l,c){this.contextName=i,this.openRange=null,this.ranges=[],this.checkStart=l,this.checkEnd=c}function Oi(i,l){this.context=i,this.index=l,this.length=i.length,this.current=i[l],this.backtrack=i.slice(0,l),this.lookahead=i.slice(l+1)}function ad(i){this.eventId=i,this.subscribers=[]}function n7(i){let l=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];for(let f=0;f<l.length;f++){let m=l[f];Object.defineProperty(this.events,m,{value:new ad(m)})}if(i)for(let f=0;f<l.length;f++){let m=l[f],x=i[m];typeof x=="function"&&this.events[m].subscribe(x)}let c=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];for(let f=0;f<c.length;f++){let m=c[f];this.events[m].subscribe(this.updateContextsRanges)}}function ns(i){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],n7.call(this,i)}kc.prototype.setState=function(i,l){return this.state[i]=l,this.activeState={key:i,value:this.state[i]},this.activeState},kc.prototype.getState=function(i){return this.state[i]||null},ns.prototype.inboundIndex=function(i){return i>=0&&i<this.tokens.length},ns.prototype.composeRUD=function(i){let l=i.map(f=>this[f[0]].apply(this,f.slice(1).concat(!0))),c=f=>typeof f=="object"&&Object.prototype.hasOwnProperty.call(f,"FAIL");if(l.every(c))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:l.filter(c)};this.dispatch("composeRUD",[l.filter(f=>!c(f))])},ns.prototype.replaceRange=function(i,l,c,f){l=l!==null?l:this.tokens.length;let m=c.every(x=>x instanceof kc);if(!isNaN(i)&&this.inboundIndex(i)&&m){let x=this.tokens.splice.apply(this.tokens,[i,l].concat(c));return f||this.dispatch("replaceToken",[i,l,c]),[x,c]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},ns.prototype.replaceToken=function(i,l,c){if(!isNaN(i)&&this.inboundIndex(i)&&l instanceof kc){let f=this.tokens.splice(i,1,l);return c||this.dispatch("replaceToken",[i,l]),[f[0],l]}else return{FAIL:"replaceToken: invalid token or index."}},ns.prototype.removeRange=function(i,l,c){l=isNaN(l)?this.tokens.length:l;let f=this.tokens.splice(i,l);return c||this.dispatch("removeRange",[f,i,l]),f},ns.prototype.removeToken=function(i,l){if(!isNaN(i)&&this.inboundIndex(i)){let c=this.tokens.splice(i,1);return l||this.dispatch("removeToken",[c,i]),c}else return{FAIL:"removeToken: invalid token index."}},ns.prototype.insertToken=function(i,l,c){return i.every(f=>f instanceof kc)?(this.tokens.splice.apply(this.tokens,[l,0].concat(i)),c||this.dispatch("insertToken",[i,l]),i):{FAIL:"insertToken: invalid token(s)."}},ns.prototype.registerModifier=function(i,l,c){this.events.newToken.subscribe(function(f,m){let x=[f,m],w=l===null||l.apply(this,x)===!0,C=[f,m];if(w){let k=c.apply(this,C);f.setState(i,k)}}),this.registeredModifiers.push(i)},ad.prototype.subscribe=function(i){return typeof i=="function"?this.subscribers.push(i)-1:{FAIL:`invalid '${this.eventId}' event handler`}},ad.prototype.unsubscribe=function(i){this.subscribers.splice(i,1)},Oi.prototype.setCurrentIndex=function(i){this.index=i,this.current=this.context[i],this.backtrack=this.context.slice(0,i),this.lookahead=this.context.slice(i+1)},Oi.prototype.get=function(i){switch(!0){case i===0:return this.current;case(i<0&&Math.abs(i)<=this.backtrack.length):return this.backtrack.slice(i)[0];case(i>0&&i<=this.lookahead.length):return this.lookahead[i-1];default:return null}},ns.prototype.rangeToText=function(i){if(i instanceof wf)return this.getRangeTokens(i).map(l=>l.char).join("")},ns.prototype.getText=function(){return this.tokens.map(i=>i.char).join("")},ns.prototype.getContext=function(i){return this.registeredContexts[i]||null},ns.prototype.on=function(i,l){let c=this.events[i];return c?c.subscribe(l):null},ns.prototype.dispatch=function(i,l){let c=this.events[i];if(c instanceof ad)for(let f=0;f<c.subscribers.length;f++)c.subscribers[f].apply(this,l||[])},ns.prototype.registerContextChecker=function(i,l,c){if(this.getContext(i))return{FAIL:`context name '${i}' is already registered.`};if(typeof l!="function")return{FAIL:"missing context start check."};if(typeof c!="function")return{FAIL:"missing context end check."};let f=new t7(i,l,c);return this.registeredContexts[i]=f,this.contextCheckers.push(f),f},ns.prototype.getRangeTokens=function(i){let l=i.startIndex+i.endOffset;return[].concat(this.tokens.slice(i.startIndex,l))},ns.prototype.getContextRanges=function(i){let l=this.getContext(i);return l?l.ranges:{FAIL:`context checker '${i}' is not registered.`}},ns.prototype.resetContextsRanges=function(){let i=this.registeredContexts;for(let l in i)if(Object.prototype.hasOwnProperty.call(i,l)){let c=i[l];c.ranges=[]}},ns.prototype.updateContextsRanges=function(){this.resetContextsRanges();let i=this.tokens.map(l=>l.char);for(let l=0;l<i.length;l++){let c=new Oi(i,l);this.runContextCheck(c)}this.dispatch("updateContextsRanges",[this.registeredContexts])},ns.prototype.setEndOffset=function(i,l){let c=this.getContext(l).openRange.startIndex,f=new wf(c,i,l),m=this.getContext(l).ranges;return f.rangeId=`${l}.${m.length}`,m.push(f),this.getContext(l).openRange=null,f},ns.prototype.runContextCheck=function(i){let l=i.index;for(let c=0;c<this.contextCheckers.length;c++){let f=this.contextCheckers[c],m=f.contextName,x=this.getContext(m).openRange;if(!x&&f.checkStart(i)&&(x=new wf(l,null,m),this.getContext(m).openRange=x,this.dispatch("contextStart",[m,l])),x&&f.checkEnd(i)){let w=l-x.startIndex+1,C=this.setEndOffset(w,m);this.dispatch("contextEnd",[m,C])}}},ns.prototype.tokenize=function(i){this.tokens=[],this.resetContextsRanges();let l=Array.from(i);this.dispatch("start");for(let c=0;c<l.length;c++){let f=l[c],m=new Oi(l,c);this.dispatch("next",[m]),this.runContextCheck(m);let x=new kc(f);this.tokens.push(x),this.dispatch("newToken",[x,m])}return this.dispatch("end",[this.tokens]),this.tokens};var r7=ns;function vl(i){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(i)}function M1(i){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(i)}function wl(i){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(i)}function ld(i){return/[\u0E00-\u0E7F]/.test(i)}function cd(i){return/[A-z]/.test(i)}function s7(i){return/\s/.test(i)}function xo(i){this.font=i,this.features={}}function Al(i){this.id=i.id,this.tag=i.tag,this.substitution=i.substitution}function Tl(i,l){if(!i)return-1;switch(l.format){case 1:return l.glyphs.indexOf(i);case 2:{let c=l.ranges;for(let f=0;f<c.length;f++){let m=c[f];if(i>=m.start&&i<=m.end){let x=i-m.start;return m.index+x}}break}default:return-1}return-1}function i7(i,l){return Tl(i,l.coverage)===-1?null:i+l.deltaGlyphId}function o7(i,l){let c=Tl(i,l.coverage);return c===-1?null:l.substitute[c]}function Af(i,l){let c=[];for(let f=0;f<i.length;f++){let m=i[f],x=l.current;x=Array.isArray(x)?x[0]:x;let w=Tl(x,m);w!==-1&&c.push(w)}return c.length!==i.length?-1:c}function a7(i,l){let c=l.inputCoverage.length+l.lookaheadCoverage.length+l.backtrackCoverage.length;if(i.context.length<c)return[];let f=Af(l.inputCoverage,i);if(f===-1)return[];let m=l.inputCoverage.length-1;if(i.lookahead.length<l.lookaheadCoverage.length)return[];let x=i.lookahead.slice(m);for(;x.length&&wl(x[0].char);)x.shift();let w=new Oi(x,0),C=Af(l.lookaheadCoverage,w),k=[].concat(i.backtrack);for(k.reverse();k.length&&wl(k[0].char);)k.shift();if(k.length<l.backtrackCoverage.length)return[];let N=new Oi(k,0),M=Af(l.backtrackCoverage,N),W=f.length===l.inputCoverage.length&&C.length===l.lookaheadCoverage.length&&M.length===l.backtrackCoverage.length,G=[];if(W)for(let le=0;le<l.lookupRecords.length;le++){let ne=l.lookupRecords[le],me=ne.lookupListIndex,He=this.getLookupByIndex(me);for(let Gt=0;Gt<He.subtables.length;Gt++){let Ft=He.subtables[Gt],rn,kn=this.getSubstitutionType(He,Ft);if(kn==="71"?(kn=this.getSubstitutionType(Ft,Ft.extension),rn=this.getLookupMethod(Ft,Ft.extension),Ft=Ft.extension):rn=this.getLookupMethod(He,Ft),kn==="12"){let mr=i.get(ne.sequenceIndex),kr=rn(mr);kr&&G.push(kr)}else if(kn==="21"){let mr=i.get(ne.sequenceIndex),kr=rn(mr);kr&&G.push(kr)}else throw new Error(`Substitution type ${kn} is not supported in chaining substitution`)}}return G}function l7(i,l){let c=i.current,f=Tl(c,l.coverage);if(f===-1)return null;let m,x=l.ligatureSets[f];for(let w=0;w<x.length;w++){m=x[w];for(let C=0;C<m.components.length;C++){let k=i.lookahead[C],N=m.components[C];if(k!==N)break;if(C===m.components.length-1)return m}}return null}function c7(i,l){let c=i.current;if(Tl(c,l.coverage)===-1)return null;for(let f of l.ruleSets)for(let m of f){let x=!0;for(let w=0;w<m.input.length;w++)if(i.lookahead[w]!==m.input[w]){x=!1;break}if(x){let w=[];w.push(c);for(let k=0;k<m.input.length;k++)w.push(m.input[k]);let C=(k,N)=>{let{lookupListIndex:M,sequenceIndex:W}=N,{subtables:G}=this.getLookupByIndex(M);for(let le of G)Tl(k[W],le.coverage)!==-1&&(k[W]=le.deltaGlyphId)};for(let k=0;k<m.lookupRecords.length;k++){let N=m.lookupRecords[k];C(w,N)}return w}}return null}function u7(i,l){if(i.context.length<l.coverages.length)return[];for(let f=0;f<l.coverages.length;f++){let m=i.get(f);if(m=Array.isArray(m)?m[0]:m,Tl(m,l.coverages[f])===-1)return[]}let c=[];for(let f=0;f<l.lookupRecords.length;f++){let m=l.lookupRecords[f],x=m.lookupListIndex,w=this.getLookupByIndex(x);for(let C=0;C<w.subtables.length;C++){let k=w.subtables[C],N,M=this.getSubstitutionType(w,k);if(M==="71"?(M=this.getSubstitutionType(k,k.extension),N=this.getLookupMethod(k,k.extension),k=k.extension):N=this.getLookupMethod(w,k),M==="12"){let W=i.get(m.sequenceIndex),G=N(W);G&&c.push(G)}else if(M==="21"){let W=i.get(m.sequenceIndex),G=N(W);G&&c.push(G)}}}return c}function d7(i,l){let c=Tl(i,l.coverage);return c===-1?null:l.sequences[c]}xo.prototype.getDefaultScriptFeaturesIndexes=function(){let i=this.font.tables.gsub.scripts;for(let l=0;l<i.length;l++){let c=i[l];if(c.tag==="DFLT")return c.script.defaultLangSys.featureIndexes}return[]},xo.prototype.getScriptFeaturesIndexes=function(i){if(!this.font.tables.gsub)return[];if(!i)return this.getDefaultScriptFeaturesIndexes();let l=this.font.tables.gsub.scripts;for(let c=0;c<l.length;c++){let f=l[c];if(f.tag===i&&f.script.defaultLangSys)return f.script.defaultLangSys.featureIndexes;{let m=f.langSysRecords;if(m)for(let x=0;x<m.length;x++){let w=m[x];if(w.tag===i)return w.langSys.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},xo.prototype.mapTagsToFeatures=function(i,l){let c={};for(let f=0;f<i.length;f++){let m=i[f].tag,x=i[f].feature;c[m]=x}this.features[l].tags=c},xo.prototype.getScriptFeatures=function(i){let l=this.features[i];if(Object.prototype.hasOwnProperty.call(this.features,i))return l;let c=this.getScriptFeaturesIndexes(i);if(!c)return null;let f=this.font.tables.gsub;return l=c.map(m=>f.features[m]),this.features[i]=l,this.mapTagsToFeatures(l,i),l},xo.prototype.getSubstitutionType=function(i,l){let c=i.lookupType.toString(),f=l.substFormat.toString();return c+f},xo.prototype.getLookupMethod=function(i,l){let c=this.getSubstitutionType(i,l);switch(c){case"11":return f=>i7.apply(this,[f,l]);case"12":return f=>o7.apply(this,[f,l]);case"63":return f=>a7.apply(this,[f,l]);case"41":return f=>l7.apply(this,[f,l]);case"21":return f=>d7.apply(this,[f,l]);case"51":return f=>c7.apply(this,[f,l]);case"53":return f=>u7.apply(this,[f,l]);default:throw new Error(`substitutionType : ${c} lookupType: ${i.lookupType} - substFormat: ${l.substFormat} is not yet supported`)}},xo.prototype.lookupFeature=function(i){let l=i.contextParams,c=l.index,f=this.getFeature({tag:i.tag,script:i.script});if(!f)return new Error(`font '${(this.font.names.unicode||this.font.names.windows||this.font.names.macintosh).fullName.en}' doesn't support feature '${i.tag}' for script '${i.script}'.`);let m=this.getFeatureLookups(f),x=[].concat(l.context);for(let w=0;w<m.length;w++){let C=m[w],k=this.getLookupSubtables(C);for(let N=0;N<k.length;N++){let M=k[N],W=this.getSubstitutionType(C,M),G;W==="71"?(W=this.getSubstitutionType(M,M.extension),G=this.getLookupMethod(M,M.extension),M=M.extension):G=this.getLookupMethod(C,M);let le;switch(W){case"11":le=G(l.current),le&&x.splice(c,1,new Al({id:11,tag:i.tag,substitution:le}));break;case"12":le=G(l.current),le&&x.splice(c,1,new Al({id:12,tag:i.tag,substitution:le}));break;case"63":le=G(l),Array.isArray(le)&&le.length&&x.splice(c,1,new Al({id:63,tag:i.tag,substitution:le}));break;case"41":le=G(l),le&&x.splice(c,1,new Al({id:41,tag:i.tag,substitution:le}));break;case"21":le=G(l.current),le&&x.splice(c,1,new Al({id:21,tag:i.tag,substitution:le}));break;case"51":case"53":le=G(l),Array.isArray(le)&&le.length&&x.splice(c,1,new Al({id:parseInt(W),tag:i.tag,substitution:le}));break}l=new Oi(x,c),!(Array.isArray(le)&&!le.length)&&(le=null)}}return x.length?x:null},xo.prototype.supports=function(i){if(!i.script)return!1;this.getScriptFeatures(i.script);let l=Object.prototype.hasOwnProperty.call(this.features,i.script);if(!i.tag)return l;let c=this.features[i.script].some(f=>f.tag===i.tag);return l&&c},xo.prototype.getLookupSubtables=function(i){return i.subtables||null},xo.prototype.getLookupByIndex=function(i){return this.font.tables.gsub.lookups[i]||null},xo.prototype.getFeatureLookups=function(i){return i.lookupListIndexes.map(this.getLookupByIndex.bind(this))},xo.prototype.getFeature=function(i){if(!this.font)return{FAIL:"No font was found"};Object.prototype.hasOwnProperty.call(this.features,i.script)||this.getScriptFeatures(i.script);let l=this.features[i.script];return l?l.tags[i.tag]?this.features[i.script].tags[i.tag]:null:{FAIL:`No feature for script ${i.script}`}};var h7=xo;function f7(i){let l=i.current,c=i.get(-1);return c===null&&vl(l)||!vl(c)&&vl(l)}function p7(i){let l=i.get(1);return l===null||!vl(l)}var m7={startCheck:f7,endCheck:p7};function g7(i){let l=i.current,c=i.get(-1);return(vl(l)||wl(l))&&!vl(c)}function x7(i){let l=i.get(1);switch(!0){case l===null:return!0;case(!vl(l)&&!wl(l)):{let c=s7(l);if(!c)return!0;if(c){let f=!1;if(f=i.lookahead.some(m=>vl(m)||wl(m)),!f)return!0}break}default:return!1}}var y7={startCheck:g7,endCheck:x7};function b7(i,l,c){l[c].setState(i.tag,i.substitution)}function v7(i,l,c){l[c].setState(i.tag,i.substitution)}function Tf(i,l,c){for(let f=0;f<i.substitution.length;f++){let m=i.substitution[f],x=l[c+f];if(Array.isArray(m)){m.length?x.setState(i.tag,m[0]):x.setState("deleted",!0);continue}x.setState(i.tag,m)}}function w7(i,l,c){let f=l[c];f.setState(i.tag,i.substitution.ligGlyph);let m=i.substitution.components.length;for(let x=0;x<m;x++)f=l[c+x+1],f.setState("deleted",!0)}var N1={11:b7,12:v7,63:Tf,41:w7,51:Tf,53:Tf};function A7(i,l,c){i instanceof Al&&N1[i.id]&&N1[i.id](i,l,c)}var zl=A7;function T7(i){let l=[].concat(i.backtrack);for(let c=l.length-1;c>=0;c--){let f=l[c],m=M1(f),x=wl(f);if(!m&&!x)return!0;if(m)return!1}return!1}function S7(i){if(M1(i.current))return!1;for(let l=0;l<i.lookahead.length;l++){let c=i.lookahead[l];if(!wl(c))return!0}return!1}function C7(i){let l="arab",c=this.featuresTags[l],f=this.tokenizer.getRangeTokens(i);if(f.length===1)return;let m=new Oi(f.map(w=>w.getState("glyphIndex")),0),x=new Oi(f.map(w=>w.char),0);for(let w=0;w<f.length;w++){let C=f[w];if(wl(C.char))continue;m.setCurrentIndex(w),x.setCurrentIndex(w);let k=0;T7(x)&&(k|=1),S7(x)&&(k|=2);let N;switch(k){case 1:N="fina";break;case 2:N="init";break;case 3:N="medi";break}if(c.indexOf(N)===-1)continue;let M=this.query.lookupFeature({tag:N,script:l,contextParams:m});if(M instanceof Error){console.info(M.message);continue}for(let W=0;W<M.length;W++){let G=M[W];G instanceof Al&&(zl(G,f,W),m.context[W]=G.substitution)}}}var _7=C7;function D1(i,l){let c=i.map(f=>f.activeState.value);return new Oi(c,l||0)}function L7(i){let l="arab",c=this.tokenizer.getRangeTokens(i),f=D1(c);for(let m=0;m<f.context.length;m++){f.setCurrentIndex(m);let x=this.query.lookupFeature({tag:"rlig",script:l,contextParams:f});if(x.length){for(let w=0;w<x.length;w++){let C=x[w];zl(C,c,m)}f=D1(c)}}}var k7=L7;function E7(i){return i.index===0&&i.context.length>1}function I7(i){return i.index===i.context.length-1}var R7={startCheck:E7,endCheck:I7};function B1(i,l){let c=i.map(f=>f.activeState.value);return new Oi(c,l||0)}function M7(i){let l="delf",c="ccmp",f=this.tokenizer.getRangeTokens(i),m=B1(f);for(let x=0;x<m.context.length;x++){if(!this.query.getFeature({tag:c,script:l,contextParams:m}))continue;m.setCurrentIndex(x);let w=this.query.lookupFeature({tag:c,script:l,contextParams:m});if(w.length){for(let C=0;C<w.length;C++){let k=w[C];zl(k,f,x)}m=B1(f)}}}var N7=M7;function D7(i){let l=i.current,c=i.get(-1);return c===null&&cd(l)||!cd(c)&&cd(l)}function B7(i){let l=i.get(1);return l===null||!cd(l)}var P7={startCheck:D7,endCheck:B7};function P1(i,l){let c=i.map(f=>f.activeState.value);return new Oi(c,l||0)}function Q7(i){let l="latn",c=this.tokenizer.getRangeTokens(i),f=P1(c);for(let m=0;m<f.context.length;m++){f.setCurrentIndex(m);let x=this.query.lookupFeature({tag:"liga",script:l,contextParams:f});if(x.length){for(let w=0;w<x.length;w++){let C=x[w];zl(C,c,m)}f=P1(c)}}}var O7=Q7;function F7(i){let l=i.current,c=i.get(-1);return c===null&&ld(l)||!ld(c)&&ld(l)}function j7(i){let l=i.get(1);return l===null||!ld(l)}var $7={startCheck:F7,endCheck:j7};function Q1(i,l){let c=i.map(f=>f.activeState.value);return new Oi(c,l||0)}function U7(i){let l="thai",c=this.tokenizer.getRangeTokens(i),f=Q1(c,0);for(let m=0;m<f.context.length;m++){f.setCurrentIndex(m);let x=this.query.lookupFeature({tag:"ccmp",script:l,contextParams:f});if(x.length){for(let w=0;w<x.length;w++){let C=x[w];zl(C,c,m)}f=Q1(c,m)}}}var H7=U7;function O1(i,l){let c=i.map(f=>f.activeState.value);return new Oi(c,l||0)}function z7(i){let l="thai",c=this.tokenizer.getRangeTokens(i),f=O1(c,0);for(let m=0;m<f.context.length;m++){f.setCurrentIndex(m);let x=this.query.lookupFeature({tag:"liga",script:l,contextParams:f});if(x.length){for(let w=0;w<x.length;w++){let C=x[w];zl(C,c,m)}f=O1(c,m)}}}var G7=z7;function F1(i,l){let c=i.map(f=>f.activeState.value);return new Oi(c,l||0)}function W7(i){let l="thai",c=this.tokenizer.getRangeTokens(i),f=F1(c,0);for(let m=0;m<f.context.length;m++){f.setCurrentIndex(m);let x=this.query.lookupFeature({tag:"rlig",script:l,contextParams:f});if(x.length){for(let w=0;w<x.length;w++){let C=x[w];zl(C,c,m)}f=F1(c,m)}}}var V7=W7;function Sf(i){if(i===null)return!1;let l=i.codePointAt(0);return l>=6155&&l<=6157||l>=65024&&l<=65039||l>=917760&&l<=917999}function q7(i){let l=i.current,c=i.get(1);return c===null&&Sf(l)||Sf(c)}function Y7(i){let l=i.get(1);return l===null||!Sf(l)}var Z7={startCheck:q7,endCheck:Y7};function K7(i){let l=this.query.font,c=this.tokenizer.getRangeTokens(i);if(c[1].setState("deleted",!0),l.tables.cmap&&l.tables.cmap.varSelectorList){let f=c[0].char.codePointAt(0),m=c[1].char.codePointAt(0),x=l.tables.cmap.varSelectorList[m];if(x!==void 0&&x.nonDefaultUVS){let w=x.nonDefaultUVS.uvsMappings;if(w[f]){let C=w[f].glyphID;l.glyphs.glyphs[C]!==void 0&&c[0].setState("glyphIndex",C)}}}}var X7=K7;function Bo(i){this.baseDir=i||"ltr",this.tokenizer=new r7,this.featuresTags={}}Bo.prototype.setText=function(i){this.text=i},Bo.prototype.contextChecks={ccmpReplacementCheck:R7,latinWordCheck:P7,arabicWordCheck:m7,arabicSentenceCheck:y7,thaiWordCheck:$7,unicodeVariationSequenceCheck:Z7};function Ec(i){let l=this.contextChecks[`${i}Check`];return this.tokenizer.registerContextChecker(i,l.startCheck,l.endCheck)}function J7(){return Ec.call(this,"ccmpReplacement"),Ec.call(this,"latinWord"),Ec.call(this,"arabicWord"),Ec.call(this,"arabicSentence"),Ec.call(this,"thaiWord"),Ec.call(this,"unicodeVariationSequence"),this.tokenizer.tokenize(this.text)}function e8(){let i=this.tokenizer.getContextRanges("arabicSentence");for(let l=0;l<i.length;l++){let c=i[l],f=this.tokenizer.getRangeTokens(c);this.tokenizer.replaceRange(c.startIndex,c.endOffset,f.reverse())}}Bo.prototype.registerFeatures=function(i,l){let c=l.filter(f=>this.query.supports({script:i,tag:f}));Object.prototype.hasOwnProperty.call(this.featuresTags,i)?this.featuresTags[i]=this.featuresTags[i].concat(c):this.featuresTags[i]=c},Bo.prototype.applyFeatures=function(i,l){if(!i)throw new Error("No valid font was provided to apply features");this.query||(this.query=new h7(i));for(let c=0;c<l.length;c++){let f=l[c];this.query.supports({script:f.script})&&this.registerFeatures(f.script,f.tags)}},Bo.prototype.registerModifier=function(i,l,c){this.tokenizer.registerModifier(i,l,c)};function Nu(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function t8(){if(!Object.prototype.hasOwnProperty.call(this.featuresTags,"arab"))return;Nu.call(this);let i=this.tokenizer.getContextRanges("arabicWord");for(let l=0;l<i.length;l++){let c=i[l];_7.call(this,c)}}function n8(){Nu.call(this);let i=this.tokenizer.getContextRanges("ccmpReplacement");for(let l=0;l<i.length;l++){let c=i[l];N7.call(this,c)}}function r8(){if(!this.hasFeatureEnabled("arab","rlig"))return;Nu.call(this);let i=this.tokenizer.getContextRanges("arabicWord");for(let l=0;l<i.length;l++){let c=i[l];k7.call(this,c)}}function s8(){if(!this.hasFeatureEnabled("latn","liga"))return;Nu.call(this);let i=this.tokenizer.getContextRanges("latinWord");for(let l=0;l<i.length;l++){let c=i[l];O7.call(this,c)}}function i8(){let i=this.tokenizer.getContextRanges("unicodeVariationSequence");for(let l=0;l<i.length;l++){let c=i[l];X7.call(this,c)}}function o8(){Nu.call(this);let i=this.tokenizer.getContextRanges("thaiWord");for(let l=0;l<i.length;l++){let c=i[l];this.hasFeatureEnabled("thai","liga")&&G7.call(this,c),this.hasFeatureEnabled("thai","rlig")&&V7.call(this,c),this.hasFeatureEnabled("thai","ccmp")&&H7.call(this,c)}}Bo.prototype.checkContextReady=function(i){return!!this.tokenizer.getContext(i)},Bo.prototype.applyFeaturesToContexts=function(){this.checkContextReady("ccmpReplacement")&&n8.call(this),this.checkContextReady("arabicWord")&&(t8.call(this),r8.call(this)),this.checkContextReady("latinWord")&&s8.call(this),this.checkContextReady("arabicSentence")&&e8.call(this),this.checkContextReady("thaiWord")&&o8.call(this),this.checkContextReady("unicodeVariationSequence")&&i8.call(this)},Bo.prototype.hasFeatureEnabled=function(i,l){return(this.featuresTags[i]||[]).indexOf(l)!==-1},Bo.prototype.processText=function(i){(!this.text||this.text!==i)&&(this.setText(i),J7.call(this),this.applyFeaturesToContexts())},Bo.prototype.getBidiText=function(i){return this.processText(i),this.tokenizer.getText()},Bo.prototype.getTextGlyphs=function(i){this.processText(i);let l=[];for(let c=0;c<this.tokenizer.tokens.length;c++){let f=this.tokenizer.tokens[c];if(f.state.deleted)continue;let m=f.activeState.value;l.push(Array.isArray(m)?m[0]:m)}return l};var a8=Bo;function Cf(i){return{fontFamily:{en:i.familyName||" "},fontSubfamily:{en:i.styleName||" "},fullName:{en:i.fullName||i.familyName+" "+i.styleName},postScriptName:{en:i.postScriptName||(i.familyName+i.styleName).replace(/\s/g,"")},designer:{en:i.designer||" "},designerURL:{en:i.designerURL||" "},manufacturer:{en:i.manufacturer||" "},manufacturerURL:{en:i.manufacturerURL||" "},license:{en:i.license||" "},licenseURL:{en:i.licenseURL||" "},version:{en:i.version||"Version 0.1"},description:{en:i.description||" "},copyright:{en:i.copyright||" "},trademark:{en:i.trademark||" "}}}function Tr(i){if(i=i||{},i.tables=i.tables||{},!i.empty){if(!i.familyName)throw new Error("When creating a new Font object, familyName is required.");if(!i.styleName)throw new Error("When creating a new Font object, styleName is required.");if(!i.unitsPerEm)throw new Error("When creating a new Font object, unitsPerEm is required.");if(!i.ascender)throw new Error("When creating a new Font object, ascender is required.");if(i.descender>0)throw new Error("When creating a new Font object, negative descender value is required.");this.names={},this.names.unicode=Cf(i),this.names.macintosh=Cf(i),this.names.windows=Cf(i),this.unitsPerEm=i.unitsPerEm||1e3,this.ascender=i.ascender,this.descender=i.descender,this.createdTimestamp=i.createdTimestamp,this.italicAngle=i.italicAngle||0,this.weightClass=i.weightClass||0;let l=0;i.fsSelection?l=i.fsSelection:(this.italicAngle<0?l|=this.fsSelectionValues.ITALIC:this.italicAngle>0&&(l|=this.fsSelectionValues.OBLIQUE),this.weightClass>=600&&(l|=this.fsSelectionValues.BOLD),l===0&&(l=this.fsSelectionValues.REGULAR)),(!i.panose||!Array.isArray(i.panose))&&(i.panose=[0,0,0,0,0,0,0,0,0]),this.tables=Object.assign(i.tables,{os2:Object.assign({usWeightClass:i.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:i.widthClass||this.usWidthClasses.MEDIUM,bFamilyType:i.panose[0]||0,bSerifStyle:i.panose[1]||0,bWeight:i.panose[2]||0,bProportion:i.panose[3]||0,bContrast:i.panose[4]||0,bStrokeVariation:i.panose[5]||0,bArmStyle:i.panose[6]||0,bLetterform:i.panose[7]||0,bMidline:i.panose[8]||0,bXHeight:i.panose[9]||0,fsSelection:l},i.tables.os2)})}this.supported=!0,this.glyphs=new ke.GlyphSet(this,i.glyphs||[]),this.encoding=new lt(this),this.position=new Sc(this),this.substitution=new td(this),this.tables=this.tables||{},this.tables=new Proxy(this.tables,{set:(l,c,f)=>(l[c]=f,l.fvar&&(l.gvar||l.cff2)&&!this.variation&&(this.variation=new Q(this)),!0)}),this.palettes=new _u(this),this.layers=new Hl(this),this.svgImages=new gl(this),this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:this.outlinesFormat==="truetype"?this._hinting=new e7(this):null}})}Tr.prototype.hasChar=function(i){return this.encoding.charToGlyphIndex(i)>0},Tr.prototype.charToGlyphIndex=function(i){return this.encoding.charToGlyphIndex(i)},Tr.prototype.charToGlyph=function(i){let l=this.charToGlyphIndex(i),c=this.glyphs.get(l);return c||(c=this.glyphs.get(0)),c},Tr.prototype.updateFeatures=function(i){return this.defaultRenderOptions.features.map(l=>l.script==="latn"?{script:"latn",tags:l.tags.filter(c=>i[c])}:l)},Tr.prototype.stringToGlyphIndexes=function(i,l){let c=new a8,f=x=>this.charToGlyphIndex(x.char);c.registerModifier("glyphIndex",null,f);let m=l?this.updateFeatures(l.features):this.defaultRenderOptions.features;return c.applyFeatures(this,m),c.getTextGlyphs(i)},Tr.prototype.stringToGlyphs=function(i,l){let c=this.stringToGlyphIndexes(i,l),f=c.length,m=new Array(f),x=this.glyphs.get(0);for(let w=0;w<f;w+=1)m[w]=this.glyphs.get(c[w])||x;return m},Tr.prototype.nameToGlyphIndex=function(i){return this.glyphNames.nameToGlyphIndex(i)},Tr.prototype.nameToGlyph=function(i){let l=this.nameToGlyphIndex(i),c=this.glyphs.get(l);return c||(c=this.glyphs.get(0)),c},Tr.prototype.glyphIndexToName=function(i){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(i):""},Tr.prototype.getKerningValue=function(i,l){i=i.index||i,l=l.index||l;let c=this.position.defaultKerningTables;return c?this.position.getKerningValue(c,i,l):this.kerningPairs[i+","+l]||0},Tr.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},Tr.prototype.forEachGlyph=function(i,l,c,f,m,x){l=l!==void 0?l:0,c=c!==void 0?c:0,f=f!==void 0?f:72,m=Object.assign({},this.defaultRenderOptions,m);let w=1/this.unitsPerEm*f,C=this.stringToGlyphs(i,m),k;if(m.kerning){let N=m.script||this.position.getDefaultScriptName();k=this.position.getKerningTables(N,m.language)}for(let N=0;N<C.length;N+=1){let M=C[N];if(x.call(this,M,l,c,f,m),M.advanceWidth&&(l+=M.advanceWidth*w),m.kerning&&N<C.length-1){let W=k?this.position.getKerningValue(k,M.index,C[N+1].index):this.getKerningValue(M,C[N+1]);l+=W*w}m.letterSpacing?l+=m.letterSpacing*f:m.tracking&&(l+=m.tracking/1e3*f)}return l},Tr.prototype.getPath=function(i,l,c,f,m){m=Object.assign({},this.defaultRenderOptions,m);let x=new rt;if(x._layers=[],ds(this,x,f),x.stroke){let w=1/(x.unitsPerEm||1e3)*f;x.strokeWidth*=w}return this.forEachGlyph(i,l,c,f,m,(w,C,k,N)=>{let M=w.getPath(C,k,N,m,this);if(m.drawSVG||m.drawLayers){let W=M._layers;if(W&&W.length){for(let G=0;G<W.length;G++){let le=W[G];x._layers.push(le)}return}}x.extend(M)}),x},Tr.prototype.getPaths=function(i,l,c,f,m){m=Object.assign({},this.defaultRenderOptions,m);let x=[];return this.forEachGlyph(i,l,c,f,m,function(w,C,k,N){let M=w.getPath(C,k,N,m,this);x.push(M)}),x},Tr.prototype.getAdvanceWidth=function(i,l,c){return c=Object.assign({},this.defaultRenderOptions,c),this.forEachGlyph(i,0,0,l,c,function(){})},Tr.prototype.draw=function(i,l,c,f,m,x){this.getPath(l,c,f,m,x).draw(i)},Tr.prototype.drawPoints=function(i,l,c,f,m,x){x=Object.assign({},this.defaultRenderOptions,x),this.forEachGlyph(l,c,f,m,x,function(w,C,k,N){w.drawPoints(i,C,k,N,x,this)})},Tr.prototype.drawMetrics=function(i,l,c,f,m,x){x=Object.assign({},this.defaultRenderOptions,x),this.forEachGlyph(l,c,f,m,x,function(w,C,k,N){w.drawMetrics(i,C,k,N)})},Tr.prototype.getEnglishName=function(i){let l=(this.names.unicode||this.names.macintosh||this.names.windows)[i];if(l)return l.en},Tr.prototype.validate=function(){let i=[],l=this;function c(m,x){m||(console.warn(`[opentype.js] ${x}`),i.push(x))}function f(m){let x=l.getEnglishName(m);c(x&&x.trim().length>0,"No English "+m+" specified.")}if(f("fontFamily"),f("weightName"),f("manufacturer"),f("copyright"),f("version"),c(this.unitsPerEm>0,"No unitsPerEm specified."),this.tables.colr){let m=this.tables.colr.baseGlyphRecords,x=-1;for(let w=0;w<m.length;w++){let C=m[w].glyphID;if(c(x<m[w].glyphID,`baseGlyphs must be sorted by GlyphID in ascending order, but glyphID ${C} comes after ${x}`),x>m[w].glyphID)break;x=C}}return i},Tr.prototype.toTables=function(){return Ti.fontToTable(this)},Tr.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},Tr.prototype.toArrayBuffer=function(){let i=this.toTables().encode(),l=new ArrayBuffer(i.length),c=new Uint8Array(l);for(let f=0;f<i.length;f++)c[f]=i[f];return l},Tr.prototype.download=function(){console.error("DEPRECATED: platform-specific actions are to be implemented on user-side")},Tr.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},Tr.prototype.macStyleValues={BOLD:1,ITALIC:2,UNDERLINE:4,OUTLINED:8,SHADOW:16,CONDENSED:32,EXTENDED:64},Tr.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},Tr.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};var j1=Tr;function l8(i,l){let c=new Ue.Parser(i,l),f=c.parseUShort(),m=c.parseUShort();f!==1&&console.warn(`Unsupported hvar table version ${f}.${m}`);let x=[f,m],w=c.parsePointer32(function(){return this.parseItemVariationStore()}),C=c.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),k=c.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),N=c.parsePointer32(function(){return this.parseDeltaSetIndexMap()});return{version:x,itemVariationStore:w,advanceWidth:C,lsb:k,rsb:N}}function c8(){console.warn("Writing of hvar tables is not yet supported.")}var u8={make:c8,parse:l8},d8=function(){return{coverage:this.parsePointer(pe.coverage),attachPoints:this.parseList(pe.pointer(pe.uShortList))}},h8=function(){var i=this.parseUShort();if(J.argument(i===1||i===2||i===3,"Unsupported CaretValue table version."),i===1)return{coordinate:this.parseShort()};if(i===2)return{pointindex:this.parseShort()};if(i===3)return{coordinate:this.parseShort()}},f8=function(){return this.parseList(pe.pointer(h8))},p8=function(){return{coverage:this.parsePointer(pe.coverage),ligGlyphs:this.parseList(pe.pointer(f8))}},m8=function(){return this.parseUShort(),this.parseList(pe.pointer(pe.coverage))};function g8(i,l){l=l||0;let c=new pe(i,l),f=c.parseVersion(1);J.argument(f===1||f===1.2||f===1.3,"Unsupported GDEF table version.");var m={version:f,classDef:c.parsePointer(pe.classDef),attachList:c.parsePointer(d8),ligCaretList:c.parsePointer(p8),markAttachClassDef:c.parsePointer(pe.classDef)};return f>=1.2&&(m.markGlyphSets=c.parsePointer(m8)),m}var x8={parse:g8},ia=new Array(10);ia[1]=function(){let i=this.offset+this.relativeOffset,l=this.parseUShort();if(l===1)return{posFormat:1,coverage:this.parsePointer(pe.coverage),value:this.parseValueRecord()};if(l===2)return{posFormat:2,coverage:this.parsePointer(pe.coverage),values:this.parseValueRecordList()};J.assert(!1,"0x"+i.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},ia[2]=function(){let i=this.offset+this.relativeOffset,l=this.parseUShort();J.assert(l===1||l===2,"0x"+i.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");let c=this.parsePointer(pe.coverage),f=this.parseUShort(),m=this.parseUShort();if(l===1)return{posFormat:l,coverage:c,valueFormat1:f,valueFormat2:m,pairSets:this.parseList(pe.pointer(pe.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(f),value2:this.parseValueRecord(m)}})))};if(l===2){let x=this.parsePointer(pe.classDef),w=this.parsePointer(pe.classDef),C=this.parseUShort(),k=this.parseUShort();return{posFormat:l,coverage:c,valueFormat1:f,valueFormat2:m,classDef1:x,classDef2:w,class1Count:C,class2Count:k,classRecords:this.parseList(C,pe.list(k,function(){return{value1:this.parseValueRecord(f),value2:this.parseValueRecord(m)}}))}}},ia[3]=function(){return{error:"GPOS Lookup 3 not supported"}},ia[4]=function(){return{error:"GPOS Lookup 4 not supported"}},ia[5]=function(){return{error:"GPOS Lookup 5 not supported"}},ia[6]=function(){return{error:"GPOS Lookup 6 not supported"}},ia[7]=function(){return{error:"GPOS Lookup 7 not supported"}},ia[8]=function(){return{error:"GPOS Lookup 8 not supported"}},ia[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function y8(i,l){l=l||0;let c=new pe(i,l),f=c.parseVersion(1);return J.argument(f===1||f===1.1,"Unsupported GPOS table version "+f),f===1?{version:f,scripts:c.parseScriptList(),features:c.parseFeatureList(),lookups:c.parseLookupList(ia)}:{version:f,scripts:c.parseScriptList(),features:c.parseFeatureList(),lookups:c.parseLookupList(ia),variations:c.parseFeatureVariationsList()}}var b8=new Array(10);function v8(i){return new Be.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Be.ScriptList(i.scripts)},{name:"features",type:"TABLE",value:new Be.FeatureList(i.features)},{name:"lookups",type:"TABLE",value:new Be.LookupList(i.lookups,b8)}])}var w8={parse:y8,make:v8};function A8(i){let l={};i.skip("uShort");let c=i.parseUShort();J.argument(c===0,"Unsupported kern sub-table version."),i.skip("uShort",2);let f=i.parseUShort();i.skip("uShort",3);for(let m=0;m<f;m+=1){let x=i.parseUShort(),w=i.parseUShort(),C=i.parseShort();l[x+","+w]=C}return l}function T8(i){let l={};i.skip("uShort"),i.parseULong()>1&&console.warn("Only the first kern subtable is supported."),i.skip("uLong");let c=i.parseUShort()&255;if(i.skip("uShort"),c===0){let f=i.parseUShort();i.skip("uShort",3);for(let m=0;m<f;m+=1){let x=i.parseUShort(),w=i.parseUShort(),C=i.parseShort();l[x+","+w]=C}}return l}function S8(i,l){let c=new Ue.Parser(i,l),f=c.parseUShort();if(f===0)return A8(c);if(f===1)return T8(c);throw new Error("Unsupported kern table version ("+f+").")}var C8={parse:S8};function _8(i,l,c,f){let m=new Ue.Parser(i,l),x=f?m.parseUShort:m.parseULong,w=[];for(let C=0;C<c+1;C+=1){let k=x.call(m);f&&(k*=2),w.push(k)}return w}var L8={parse:_8};function $1(i,l){let c=[],f=12;for(let m=0;m<l;m+=1){let x=Ue.getTag(i,f),w=Ue.getULong(i,f+4),C=Ue.getULong(i,f+8),k=Ue.getULong(i,f+12);c.push({tag:x,checksum:w,offset:C,length:k,compression:!1}),f+=16}return c}function k8(i,l){let c=[],f=44;for(let m=0;m<l;m+=1){let x=Ue.getTag(i,f),w=Ue.getULong(i,f+4),C=Ue.getULong(i,f+8),k=Ue.getULong(i,f+12),N;C<k?N="WOFF":N=!1,c.push({tag:x,offset:w,compression:N,compressedLength:C,length:k}),f+=20}return c}function dr(i,l){if(l.compression==="WOFF"){let c=new Uint8Array(i.buffer,l.offset+2,l.compressedLength-2),f=new Uint8Array(l.length);if(K(c,f),f.byteLength!==l.length)throw new Error("Decompression error: "+l.tag+" decompressed length doesn't match recorded length");return{data:new DataView(f.buffer,0),offset:0}}else return{data:i,offset:l.offset}}function E8(i,l={}){let c,f,m=new j1({empty:!0});i.constructor!==ArrayBuffer&&(i=new Uint8Array(i).buffer);let x=new DataView(i,0),w,C=[],k=Ue.getTag(x,0);if(k==="\0\0\0"||k==="true"||k==="typ1")m.outlinesFormat="truetype",w=Ue.getUShort(x,4),C=$1(x,w);else if(k==="OTTO")m.outlinesFormat="cff",w=Ue.getUShort(x,4),C=$1(x,w);else if(k==="wOFF"){let Wt=Ue.getTag(x,4);if(Wt==="\0\0\0")m.outlinesFormat="truetype";else if(Wt==="OTTO")m.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+k);w=Ue.getUShort(x,12),C=k8(x,w)}else if(k==="wOF2"){let Wt="https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025";throw new Error("WOFF2 require an external decompressor library, see examples at: "+Wt)}else throw new Error("Unsupported OpenType signature "+k);let N,M,W,G,le,ne,me,He,Gt,Ft,rn,kn,mr,kr,Er,As,oa,En;for(let Wt=0;Wt<w;Wt+=1){let Dt=C[Wt],Qt;switch(Dt.tag){case"avar":me=Dt;break;case"cmap":Qt=dr(x,Dt),m.tables.cmap=uo.parse(Qt.data,Qt.offset),m.encoding=new et(m.tables.cmap);break;case"cvt ":Qt=dr(x,Dt),En=new Ue.Parser(Qt.data,Qt.offset),m.tables.cvt=En.parseShortList(Dt.length/2);break;case"fvar":W=Dt;break;case"STAT":G=Dt;break;case"gvar":le=Dt;break;case"cvar":ne=Dt;break;case"fpgm":Qt=dr(x,Dt),En=new Ue.Parser(Qt.data,Qt.offset),m.tables.fpgm=En.parseByteList(Dt.length);break;case"head":Qt=dr(x,Dt),m.tables.head=Ro.parse(Qt.data,Qt.offset),m.unitsPerEm=m.tables.head.unitsPerEm,c=m.tables.head.indexToLocFormat;break;case"hhea":Qt=dr(x,Dt),m.tables.hhea=$a.parse(Qt.data,Qt.offset),m.ascender=m.tables.hhea.ascender,m.descender=m.tables.hhea.descender,m.numberOfHMetrics=m.tables.hhea.numberOfHMetrics;break;case"HVAR":mr=Dt;break;case"hmtx":kn=Dt;break;case"ltag":Qt=dr(x,Dt),f=vi.parse(Qt.data,Qt.offset);break;case"COLR":Qt=dr(x,Dt),m.tables.colr=De.parse(Qt.data,Qt.offset);break;case"CPAL":Qt=dr(x,Dt),m.tables.cpal=Ki.parse(Qt.data,Qt.offset);break;case"maxp":Qt=dr(x,Dt),m.tables.maxp=No.parse(Qt.data,Qt.offset),m.numGlyphs=m.tables.maxp.numGlyphs;break;case"name":As=Dt;break;case"OS/2":Qt=dr(x,Dt),m.tables.os2=oi.parse(Qt.data,Qt.offset);break;case"post":Qt=dr(x,Dt),m.tables.post=qr.parse(Qt.data,Qt.offset),m.glyphNames=new it(m.tables.post);break;case"prep":Qt=dr(x,Dt),En=new Ue.Parser(Qt.data,Qt.offset),m.tables.prep=En.parseByteList(Dt.length);break;case"glyf":He=Dt;break;case"loca":Er=Dt;break;case"CFF ":N=Dt;break;case"CFF2":M=Dt;break;case"kern":kr=Dt;break;case"GDEF":Gt=Dt;break;case"GPOS":Ft=Dt;break;case"GSUB":rn=Dt;break;case"meta":oa=Dt;break;case"gasp":try{Qt=dr(x,Dt),m.tables.gasp=Jt.parse(Qt.data,Qt.offset)}catch(Ci){console.warn("Failed to parse gasp table, skipping."),console.warn(Ci)}break;case"SVG ":Qt=dr(x,Dt),m.tables.svg=zr.parse(Qt.data,Qt.offset);break;default:break}}let yo=dr(x,As);if(m.tables.name=Cr.parse(yo.data,yo.offset,f),m.names=m.tables.name,He&&Er){let Wt=c===0,Dt=dr(x,Er),Qt=L8.parse(Dt.data,Dt.offset,m.numGlyphs,Wt),Ci=dr(x,He);m.glyphs=Iu.parse(Ci.data,Ci.offset,Qt,m,l)}else if(N){let Wt=dr(x,N);Ii.parse(Wt.data,Wt.offset,m,l)}else if(M){let Wt=dr(x,M);Ii.parse(Wt.data,Wt.offset,m,l)}else throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");let Fi=dr(x,kn);if(Mo.parse(m,Fi.data,Fi.offset,m.numberOfHMetrics,m.numGlyphs,m.glyphs,l),mn(m,l),kr){let Wt=dr(x,kr);m.kerningPairs=C8.parse(Wt.data,Wt.offset)}else m.kerningPairs={};if(Gt){let Wt=dr(x,Gt);m.tables.gdef=x8.parse(Wt.data,Wt.offset)}if(Ft){let Wt=dr(x,Ft);m.tables.gpos=w8.parse(Wt.data,Wt.offset),m.position.init()}if(rn){let Wt=dr(x,rn);m.tables.gsub=Ni.parse(Wt.data,Wt.offset)}if(W){let Wt=dr(x,W);m.tables.fvar=Wn.parse(Wt.data,Wt.offset,m.names)}if(G){let Wt=dr(x,G);m.tables.stat=$l.parse(Wt.data,Wt.offset,m.tables.fvar)}if(le){W||console.warn("This font provides a gvar table, but no fvar table, which is required for variable fonts."),He||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let Wt=dr(x,le);m.tables.gvar=er.parse(Wt.data,Wt.offset,m.tables.fvar,m.glyphs)}if(ne){W||console.warn("This font provides a cvar table, but no fvar table, which is required for variable fonts."),m.tables.cvt||console.warn("This font provides a cvar table, but no cvt table which could be made variable."),He||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let Wt=dr(x,ne);m.tables.cvar=Ye.parse(Wt.data,Wt.offset,m.tables.fvar,m.tables.cvt||[])}if(me){W||console.warn("This font provides an avar table, but no fvar table, which is required for variable fonts.");let Wt=dr(x,me);m.tables.avar=Me.parse(Wt.data,Wt.offset,m.tables.fvar)}if(mr){W||console.warn("This font provides an HVAR table, but no fvar table, which is required for variable fonts."),kn||console.warn("This font provides an HVAR table, but no hmtx table to vary.");let Wt=dr(x,mr);m.tables.hvar=u8.parse(Wt.data,Wt.offset,m.tables.fvar)}if(oa){let Wt=dr(x,oa);m.tables.meta=Ai.parse(Wt.data,Wt.offset),m.metas=m.tables.meta}return m.palettes=new _u(m),m}function I8(){console.error("DEPRECATED! migrate to: opentype.parse(buffer, opt) See: https://github.com/opentypejs/opentype.js/issues/675")}function R8(){console.error('DEPRECATED! migrate to: opentype.parse(require("fs").readFileSync(url), opt)')}return p(g)})();(function(r,s){typeof define=="function"&&define.amd?define(s):typeof t=="object"&&t.exports?t.exports=s():r.opentype=s()})(typeof self<"u"?self:e,()=>({...n,default:n}))}),VE=GE(WE()),pi=Yc("lru-cache:metrics"),y0=PE("lru-cache"),qE=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,op=()=>pi.hasSubscribers||y0.hasSubscribers,K3=new Set,p5=typeof process=="object"&&process?process:{},YE=(e,t,n,r)=>{typeof p5.emitWarning=="function"?p5.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},ZE=e=>!K3.has(e),Nl=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),X3=e=>Nl(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Jd:null:null,Jd=class extends Array{constructor(e){super(e),this.fill(0)}},Zl,zu,KE=(Zl=class{constructor(e,t){if(Ds(this,"heap"),Ds(this,"length"),!Z(Zl,zu))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){let t=X3(e);if(!t)return[];en(Zl,zu,!0);let n=new Zl(e,t);return en(Zl,zu,!1),n}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},zu=new WeakMap,zn(Zl,zu,!1),Zl),m5,g5,ca,Fo,Ea,Dc,Ia,Gu,Wu,Ra,qs,jo,Ns,Gr,An,io,$o,Hi,ui,Ma,di,Na,Da,Uo,Ho,Ba,Vu,oo,Bc,wt,ap,Pc,Ll,wd,zo,x5,Qc,qu,Ad,kl,El,lp,Oc,Td,y5,b5,Sd,Or,cp,v5,w5,Yu,up,Zu,Il,dp,hp,XE=(hp=class{constructor(e){zn(this,wt),zn(this,ca),zn(this,Fo),zn(this,Ea),zn(this,Dc),zn(this,Ia),zn(this,Gu),zn(this,Wu),zn(this,Ra),Ds(this,"ttl"),Ds(this,"ttlResolution"),Ds(this,"ttlAutopurge"),Ds(this,"updateAgeOnGet"),Ds(this,"updateAgeOnHas"),Ds(this,"allowStale"),Ds(this,"noDisposeOnSet"),Ds(this,"noUpdateTTL"),Ds(this,"maxEntrySize"),Ds(this,"sizeCalculation"),Ds(this,"noDeleteOnFetchRejection"),Ds(this,"noDeleteOnStaleGet"),Ds(this,"allowStaleOnFetchAbort"),Ds(this,"allowStaleOnFetchRejection"),Ds(this,"ignoreFetchAbort"),Ds(this,"backgroundFetchSize"),zn(this,qs),zn(this,jo),zn(this,Ns),zn(this,Gr),zn(this,An),zn(this,io),zn(this,$o),zn(this,Hi),zn(this,ui),zn(this,Ma),zn(this,di),zn(this,Na),zn(this,Da),zn(this,Uo),zn(this,Ho),zn(this,Ba),zn(this,Vu),zn(this,oo),zn(this,Bc),zn(this,Pc,()=>{}),zn(this,Ll,()=>{}),zn(this,wd,()=>{}),zn(this,zo,()=>!1),zn(this,Qc,q=>{}),zn(this,qu,(q,te,ve)=>{}),zn(this,Ad,(q,te,ve,ge)=>{if(ve||ge)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0}),Ds(this,m5,"LRUCache");let{max:t=0,ttl:n,ttlResolution:r=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:d,dispose:h,onInsert:p,disposeAfter:g,noDisposeOnSet:y,noUpdateTTL:b,maxSize:v=0,maxEntrySize:T=0,sizeCalculation:A,fetchMethod:L,memoMethod:R,noDeleteOnFetchRejection:D,noDeleteOnStaleGet:B,allowStaleOnFetchRejection:j,allowStaleOnFetchAbort:P,ignoreFetchAbort:$,backgroundFetchSize:z=1,perf:H}=e;if(this.backgroundFetchSize=z,H!==void 0&&typeof H?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(en(this,Ra,H??qE),t!==0&&!Nl(t))throw new TypeError("max option must be a nonnegative integer");let ye=t?X3(t):Array;if(!ye)throw new Error("invalid max value: "+t);if(en(this,ca,t),en(this,Fo,v),this.maxEntrySize=T||Z(this,Fo),this.sizeCalculation=A,this.sizeCalculation){if(!Z(this,Fo)&&!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(en(this,Wu,R),L!==void 0&&typeof L!="function")throw new TypeError("fetchMethod must be a function if specified");if(en(this,Gu,L),en(this,Vu,!!L),en(this,Ns,new Map),en(this,Gr,Array.from({length:t}).fill(void 0)),en(this,An,Array.from({length:t}).fill(void 0)),en(this,io,new ye(t)),en(this,$o,new ye(t)),en(this,Hi,0),en(this,ui,0),en(this,Ma,KE.create(t)),en(this,qs,0),en(this,jo,0),typeof h=="function"&&en(this,Ea,h),typeof p=="function"&&en(this,Dc,p),typeof g=="function"?(en(this,Ia,g),en(this,di,[])):(en(this,Ia,void 0),en(this,di,void 0)),en(this,Ba,!!Z(this,Ea)),en(this,Bc,!!Z(this,Dc)),en(this,oo,!!Z(this,Ia)),this.noDisposeOnSet=!!y,this.noUpdateTTL=!!b,this.noDeleteOnFetchRejection=!!D,this.allowStaleOnFetchRejection=!!j,this.allowStaleOnFetchAbort=!!P,this.ignoreFetchAbort=!!$,this.maxEntrySize!==0){if(Z(this,Fo)!==0&&!Nl(Z(this,Fo)))throw new TypeError("maxSize must be a positive integer if specified");if(!Nl(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");St(this,wt,x5).call(this)}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!B,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=Nl(r)||r===0?r:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!Nl(this.ttl))throw new TypeError("ttl must be a positive integer if specified");St(this,wt,ap).call(this)}if(Z(this,ca)===0&&this.ttl===0&&Z(this,Fo)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!Z(this,ca)&&!Z(this,Fo)){let q="LRU_CACHE_UNBOUNDED";ZE(q)&&(K3.add(q),YE("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",q,hp))}}get perf(){return Z(this,Ra)}static unsafeExposeInternals(e){return{starts:Z(e,Da),ttls:Z(e,Uo),autopurgeTimers:Z(e,Ho),sizes:Z(e,Na),keyMap:Z(e,Ns),keyList:Z(e,Gr),valList:Z(e,An),next:Z(e,io),prev:Z(e,$o),get head(){return Z(e,Hi)},get tail(){return Z(e,ui)},free:Z(e,Ma),isBackgroundFetch:t=>{var n;return St(n=e,wt,Or).call(n,t)},backgroundFetch:(t,n,r,s)=>{var o;return St(o=e,wt,Sd).call(o,t,n,r,s)},moveToTail:t=>{var n;return St(n=e,wt,Zu).call(n,t)},indexes:t=>{var n;return St(n=e,wt,kl).call(n,t)},rindexes:t=>{var n;return St(n=e,wt,El).call(n,t)},isStale:t=>{var n;return Z(n=e,zo).call(n,t)}}}get max(){return Z(this,ca)}get maxSize(){return Z(this,Fo)}get calculatedSize(){return Z(this,jo)}get size(){return Z(this,qs)}get fetchMethod(){return Z(this,Gu)}get memoMethod(){return Z(this,Wu)}get dispose(){return Z(this,Ea)}get onInsert(){return Z(this,Dc)}get disposeAfter(){return Z(this,Ia)}getRemainingTTL(e){return Z(this,Ns).has(e)?1/0:0}*entries(){for(let e of St(this,wt,kl).call(this))Z(this,An)[e]!==void 0&&Z(this,Gr)[e]!==void 0&&!St(this,wt,Or).call(this,Z(this,An)[e])&&(yield[Z(this,Gr)[e],Z(this,An)[e]])}*rentries(){for(let e of St(this,wt,El).call(this))Z(this,An)[e]!==void 0&&Z(this,Gr)[e]!==void 0&&!St(this,wt,Or).call(this,Z(this,An)[e])&&(yield[Z(this,Gr)[e],Z(this,An)[e]])}*keys(){for(let e of St(this,wt,kl).call(this)){let t=Z(this,Gr)[e];t!==void 0&&!St(this,wt,Or).call(this,Z(this,An)[e])&&(yield t)}}*rkeys(){for(let e of St(this,wt,El).call(this)){let t=Z(this,Gr)[e];t!==void 0&&!St(this,wt,Or).call(this,Z(this,An)[e])&&(yield t)}}*values(){for(let e of St(this,wt,kl).call(this))Z(this,An)[e]!==void 0&&!St(this,wt,Or).call(this,Z(this,An)[e])&&(yield Z(this,An)[e])}*rvalues(){for(let e of St(this,wt,El).call(this))Z(this,An)[e]!==void 0&&!St(this,wt,Or).call(this,Z(this,An)[e])&&(yield Z(this,An)[e])}[(g5=Symbol.iterator,m5=Symbol.toStringTag,g5)](){return this.entries()}find(e,t={}){for(let n of St(this,wt,kl).call(this)){let r=Z(this,An)[n],s=St(this,wt,Or).call(this,r)?r.__staleWhileFetching:r;if(s!==void 0&&e(s,Z(this,Gr)[n],this))return St(this,wt,Yu).call(this,Z(this,Gr)[n],t)}}forEach(e,t=this){for(let n of St(this,wt,kl).call(this)){let r=Z(this,An)[n],s=St(this,wt,Or).call(this,r)?r.__staleWhileFetching:r;s!==void 0&&e.call(t,s,Z(this,Gr)[n],this)}}rforEach(e,t=this){for(let n of St(this,wt,El).call(this)){let r=Z(this,An)[n],s=St(this,wt,Or).call(this,r)?r.__staleWhileFetching:r;s!==void 0&&e.call(t,s,Z(this,Gr)[n],this)}}purgeStale(){let e=!1;for(let t of St(this,wt,El).call(this,{allowStale:!0}))Z(this,zo).call(this,t)&&(St(this,wt,Il).call(this,Z(this,Gr)[t],"expire"),e=!0);return e}info(e){let t=Z(this,Ns).get(e);if(t===void 0)return;let n=Z(this,An)[t],r=St(this,wt,Or).call(this,n)?n.__staleWhileFetching:n;if(r===void 0)return;let s={value:r};if(Z(this,Uo)&&Z(this,Da)){let o=Z(this,Uo)[t],a=Z(this,Da)[t];if(o&&a){let d=o-(Z(this,Ra).now()-a);s.ttl=d,s.start=Date.now()}}return Z(this,Na)&&(s.size=Z(this,Na)[t]),s}dump(){let e=[];for(let t of St(this,wt,kl).call(this,{allowStale:!0})){let n=Z(this,Gr)[t],r=Z(this,An)[t],s=St(this,wt,Or).call(this,r)?r.__staleWhileFetching:r;if(s===void 0||n===void 0)continue;let o={value:s};if(Z(this,Uo)&&Z(this,Da)){o.ttl=Z(this,Uo)[t];let a=Z(this,Ra).now()-Z(this,Da)[t];o.start=Math.floor(Date.now()-a)}Z(this,Na)&&(o.size=Z(this,Na)[t]),e.unshift([n,o])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let r=Date.now()-n.start;n.start=Z(this,Ra).now()-r}St(this,wt,Oc).call(this,t,n.value,n)}}set(e,t,n={}){let{status:r=pi.hasSubscribers?{}:void 0}=n;n.status=r,r&&(r.op="set",r.key=e,t!==void 0&&(r.value=t),r.cache=this);let s=St(this,wt,Oc).call(this,e,t,n);return r&&pi.hasSubscribers&&pi.publish(r),s}pop(){var e;try{for(;Z(this,qs);){let t=Z(this,An)[Z(this,Hi)];if(St(this,wt,Td).call(this,!0),St(this,wt,Or).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(Z(this,oo)&&Z(this,di)){let t=Z(this,di),n;for(;n=t?.shift();)(e=Z(this,Ia))==null||e.call(this,...n)}}}has(e,t={}){let{status:n=pi.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="has",n.key=e,n.cache=this);let r=St(this,wt,y5).call(this,e,t);return pi.hasSubscribers&&pi.publish(n),r}peek(e,t={}){let{status:n=op()?{}:void 0}=t;n&&(n.op="peek",n.key=e,n.cache=this),t.status=n;let r=St(this,wt,b5).call(this,e,t);return pi.hasSubscribers&&pi.publish(n),r}fetch(e,t={}){let n=y0.hasSubscribers,{status:r=op()?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let s=St(this,wt,cp).call(this,e,t);return r&&n&&(r.trace=!0,y0.tracePromise(()=>s,r).catch(()=>{})),s}forceFetch(e,t={}){let n=y0.hasSubscribers,{status:r=op()?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let s=St(this,wt,v5).call(this,e,t);return r&&n&&(r.trace=!0,y0.tracePromise(()=>s,r).catch(()=>{})),s}memo(e,t={}){let{status:n=pi.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="memo",n.key=e,t.context&&(n.context=t.context),n.cache=this);let r=St(this,wt,w5).call(this,e,t);return n&&(n.value=r),pi.hasSubscribers&&pi.publish(n),r}get(e,t={}){let{status:n=pi.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="get",n.key=e,n.cache=this);let r=St(this,wt,Yu).call(this,e,t);return n&&(r!==void 0&&(n.value=r),pi.hasSubscribers&&pi.publish(n)),r}delete(e){return St(this,wt,Il).call(this,e,"delete")}clear(){return St(this,wt,dp).call(this,"delete")}},ca=new WeakMap,Fo=new WeakMap,Ea=new WeakMap,Dc=new WeakMap,Ia=new WeakMap,Gu=new WeakMap,Wu=new WeakMap,Ra=new WeakMap,qs=new WeakMap,jo=new WeakMap,Ns=new WeakMap,Gr=new WeakMap,An=new WeakMap,io=new WeakMap,$o=new WeakMap,Hi=new WeakMap,ui=new WeakMap,Ma=new WeakMap,di=new WeakMap,Na=new WeakMap,Da=new WeakMap,Uo=new WeakMap,Ho=new WeakMap,Ba=new WeakMap,Vu=new WeakMap,oo=new WeakMap,Bc=new WeakMap,wt=new WeakSet,ap=function(){let e=new Jd(Z(this,ca)),t=new Jd(Z(this,ca));en(this,Uo,e),en(this,Da,t);let n=this.ttlAutopurge?Array.from({length:Z(this,ca)}):void 0;en(this,Ho,n),en(this,wd,(a,d,h=Z(this,Ra).now())=>{t[a]=d!==0?h:0,e[a]=d,r(a,d)}),en(this,Pc,a=>{t[a]=e[a]!==0?Z(this,Ra).now():0,r(a,e[a])});let r=this.ttlAutopurge?(a,d)=>{if(n?.[a]&&(clearTimeout(n[a]),n[a]=void 0),d&&d!==0&&n){let h=setTimeout(()=>{Z(this,zo).call(this,a)&&St(this,wt,Il).call(this,Z(this,Gr)[a],"expire")},d+1);h.unref&&h.unref(),n[a]=h}}:()=>{};en(this,Ll,(a,d)=>{if(e[d]){let h=e[d],p=t[d];if(!h||!p)return;a.ttl=h,a.start=p,a.now=s||o();let g=a.now-p;a.remainingTTL=h-g}});let s=0,o=()=>{let a=Z(this,Ra).now();if(this.ttlResolution>0){s=a;let d=setTimeout(()=>s=0,this.ttlResolution);d.unref&&d.unref()}return a};this.getRemainingTTL=a=>{let d=Z(this,Ns).get(a);if(d===void 0)return 0;let h=e[d],p=t[d];if(!h||!p)return 1/0;let g=(s||o())-p;return h-g},en(this,zo,a=>{let d=t[a],h=e[a];return!!h&&!!d&&(s||o())-d>h})},Pc=new WeakMap,Ll=new WeakMap,wd=new WeakMap,zo=new WeakMap,x5=function(){let e=new Jd(Z(this,ca));en(this,jo,0),en(this,Na,e),en(this,Qc,t=>{en(this,jo,Z(this,jo)-e[t]),e[t]=0}),en(this,Ad,(t,n,r,s)=>{if(!Nl(r)){if(St(this,wt,Or).call(this,n))return this.backgroundFetchSize;if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(r=s(n,t),!Nl(r))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 r}),en(this,qu,(t,n,r)=>{if(e[t]=n,Z(this,Fo)){let s=Z(this,Fo)-e[t];for(;Z(this,jo)>s;)St(this,wt,Td).call(this,!0)}en(this,jo,Z(this,jo)+e[t]),r&&(r.entrySize=n,r.totalCalculatedSize=Z(this,jo))})},Qc=new WeakMap,qu=new WeakMap,Ad=new WeakMap,kl=function*({allowStale:e=this.allowStale}={}){if(Z(this,qs))for(let t=Z(this,ui);St(this,wt,lp).call(this,t)&&((e||!Z(this,zo).call(this,t))&&(yield t),t!==Z(this,Hi));)t=Z(this,$o)[t]},El=function*({allowStale:e=this.allowStale}={}){if(Z(this,qs))for(let t=Z(this,Hi);St(this,wt,lp).call(this,t)&&((e||!Z(this,zo).call(this,t))&&(yield t),t!==Z(this,ui));)t=Z(this,io)[t]},lp=function(e){return e!==void 0&&Z(this,Ns).get(Z(this,Gr)[e])===e},Oc=function(e,t,n,r){var s,o,a,d;let{ttl:h=this.ttl,start:p,noDisposeOnSet:g=this.noDisposeOnSet,sizeCalculation:y=this.sizeCalculation,status:b}=n,v=St(this,wt,Or).call(this,t);if(t===void 0)return b&&(b.set="deleted"),this.delete(e),this;let{noUpdateTTL:T=this.noUpdateTTL}=n;b&&!v&&(b.value=t);let A=Z(this,Ad).call(this,e,t,n.size||0,y,b);if(this.maxEntrySize&&A>this.maxEntrySize)return St(this,wt,Il).call(this,e,"set"),b&&(b.set="miss",b.maxEntrySizeExceeded=!0),this;let L=Z(this,qs)===0?void 0:Z(this,Ns).get(e);if(L===void 0)L=Z(this,qs)===0?Z(this,ui):Z(this,Ma).length!==0?Z(this,Ma).pop():Z(this,qs)===Z(this,ca)?St(this,wt,Td).call(this,!1):Z(this,qs),Z(this,Gr)[L]=e,Z(this,An)[L]=t,Z(this,Ns).set(e,L),Z(this,io)[Z(this,ui)]=L,Z(this,$o)[L]=Z(this,ui),en(this,ui,L),ip(this,qs)._++,Z(this,qu).call(this,L,A,b),b&&(b.set="add"),T=!1,Z(this,Bc)&&!v&&((s=Z(this,Dc))==null||s.call(this,t,e,"add"));else{St(this,wt,Zu).call(this,L);let R=Z(this,An)[L];if(t!==R){if(!g)if(St(this,wt,Or).call(this,R)){R!==r&&R.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:D}=R;D!==void 0&&D!==t&&(Z(this,Ba)&&((o=Z(this,Ea))==null||o.call(this,D,e,"set")),Z(this,oo)&&Z(this,di)?.push([D,e,"set"]))}else Z(this,Ba)&&((a=Z(this,Ea))==null||a.call(this,R,e,"set")),Z(this,oo)&&Z(this,di)?.push([R,e,"set"]);if(Z(this,Qc).call(this,L),Z(this,qu).call(this,L,A,b),Z(this,An)[L]=t,!v){let D=R&&St(this,wt,Or).call(this,R)?R.__staleWhileFetching:R,B=D===void 0?"add":t!==D?"replace":"update";b&&(b.set=B,D!==void 0&&(b.oldValue=D)),Z(this,Bc)&&this.onInsert?.(t,e,B)}}else v||(b&&(b.set="update"),Z(this,Bc)&&this.onInsert?.(t,e,"update"))}if(h!==0&&!Z(this,Uo)&&St(this,wt,ap).call(this),Z(this,Uo)&&(T||Z(this,wd).call(this,L,h,p),b&&Z(this,Ll).call(this,b,L)),!g&&Z(this,oo)&&Z(this,di)){let R=Z(this,di),D;for(;D=R?.shift();)(d=Z(this,Ia))==null||d.call(this,...D)}return this},Td=function(e){var t;let n=Z(this,Hi),r=Z(this,Gr)[n],s=Z(this,An)[n],o=St(this,wt,Or).call(this,s);o&&s.__abortController.abort(new Error("evicted"));let a=o?s.__staleWhileFetching:s;return(Z(this,Ba)||Z(this,oo))&&a!==void 0&&(Z(this,Ba)&&((t=Z(this,Ea))==null||t.call(this,a,r,"evict")),Z(this,oo)&&Z(this,di)?.push([a,r,"evict"])),Z(this,Qc).call(this,n),Z(this,Ho)?.[n]&&(clearTimeout(Z(this,Ho)[n]),Z(this,Ho)[n]=void 0),e&&(Z(this,Gr)[n]=void 0,Z(this,An)[n]=void 0,Z(this,Ma).push(n)),Z(this,qs)===1?(en(this,Hi,en(this,ui,0)),Z(this,Ma).length=0):en(this,Hi,Z(this,io)[n]),Z(this,Ns).delete(r),ip(this,qs)._--,n},y5=function(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,s=Z(this,Ns).get(e);if(s!==void 0){let o=Z(this,An)[s];if(St(this,wt,Or).call(this,o)&&o.__staleWhileFetching===void 0)return!1;if(Z(this,zo).call(this,s))r&&(r.has="stale",Z(this,Ll).call(this,r,s));else return n&&Z(this,Pc).call(this,s),r&&(r.has="hit",Z(this,Ll).call(this,r,s)),!0}else r&&(r.has="miss");return!1},b5=function(e,t){let{status:n,allowStale:r=this.allowStale}=t,s=Z(this,Ns).get(e);if(s===void 0||!r&&Z(this,zo).call(this,s)){n&&(n.peek=s===void 0?"miss":"stale");return}let o=Z(this,An)[s],a=St(this,wt,Or).call(this,o)?o.__staleWhileFetching:o;return n&&(a!==void 0?(n.peek="hit",n.value=a):n.peek="miss"),a},Sd=function(e,t,n,r){let s=t===void 0?void 0:Z(this,An)[t];if(St(this,wt,Or).call(this,s))return s;let o=new AbortController,{signal:a}=n;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let d={signal:o.signal,options:n,context:r},h=(T,A=!1)=>{let{aborted:L}=o.signal,R=n.ignoreFetchAbort&&T!==void 0,D=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&T!==void 0);if(n.status&&(L&&!A?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,R&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),L&&!R&&!A)return g(o.signal.reason,D);let B=b,j=Z(this,An)[t];return(j===b||j===void 0&&R&&A)&&(T===void 0?B.__staleWhileFetching!==void 0?Z(this,An)[t]=B.__staleWhileFetching:St(this,wt,Il).call(this,e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),St(this,wt,Oc).call(this,e,T,d.options,B))),T},p=T=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=T),g(T,!1)),g=(T,A)=>{let{aborted:L}=o.signal,R=L&&n.allowStaleOnFetchAbort,D=R||n.allowStaleOnFetchRejection,B=D||n.noDeleteOnFetchRejection,j=b;if(Z(this,An)[t]===b&&(!B||!A&&j.__staleWhileFetching===void 0?St(this,wt,Il).call(this,e,"fetch"):R||(Z(this,An)[t]=j.__staleWhileFetching)),D)return n.status&&j.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),j.__staleWhileFetching;if(j.__returned===j)throw T},y=(T,A)=>{var L;let R=(L=Z(this,Gu))==null?void 0:L.call(this,e,s,d);o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(T(void 0),n.allowStaleOnFetchAbort&&(T=D=>h(D,!0)))}),R&&R instanceof Promise?R.then(D=>T(D===void 0?void 0:D),A):R!==void 0&&T(R)};n.status&&(n.status.fetchDispatched=!0);let b=new Promise(y).then(h,p),v=Object.assign(b,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return t===void 0?(St(this,wt,Oc).call(this,e,v,{...d.options,status:void 0}),t=Z(this,Ns).get(e)):Z(this,An)[t]=v,v},Or=function(e){if(!Z(this,Vu))return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController},cp=async function(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:d=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:p=this.noUpdateTTL,noDeleteOnFetchRejection:g=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:b=this.ignoreFetchAbort,allowStaleOnFetchAbort:v=this.allowStaleOnFetchAbort,context:T,forceRefresh:A=!1,status:L,signal:R}=t;if(L&&(L.op="fetch",L.key=e,A&&(L.forceRefresh=!0),L.cache=this),!Z(this,Vu))return L&&(L.fetch="get"),St(this,wt,Yu).call(this,e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:s,status:L});let D={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:a,size:d,sizeCalculation:h,noUpdateTTL:p,noDeleteOnFetchRejection:g,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:v,ignoreFetchAbort:b,status:L,signal:R},B=Z(this,Ns).get(e);if(B===void 0){L&&(L.fetch="miss");let j=St(this,wt,Sd).call(this,e,B,D,T);return j.__returned=j}else{let j=Z(this,An)[B];if(St(this,wt,Or).call(this,j)){let H=n&&j.__staleWhileFetching!==void 0;return L&&(L.fetch="inflight",H&&(L.returnedStale=!0)),H?j.__staleWhileFetching:j.__returned=j}let P=Z(this,zo).call(this,B);if(!A&&!P)return L&&(L.fetch="hit"),St(this,wt,Zu).call(this,B),r&&Z(this,Pc).call(this,B),L&&Z(this,Ll).call(this,L,B),j;let $=St(this,wt,Sd).call(this,e,B,D,T),z=$.__staleWhileFetching!==void 0&&n;return L&&(L.fetch=P?"stale":"refresh",z&&P&&(L.returnedStale=!0)),z?$.__staleWhileFetching:$.__returned=$}},v5=async function(e,t={}){let n=await St(this,wt,cp).call(this,e,t);if(n===void 0)throw new Error("fetch() returned undefined");return n},w5=function(e,t={}){let n=Z(this,Wu);if(!n)throw new Error("no memoMethod provided to constructor");let{context:r,status:s,forceRefresh:o,...a}=t;s&&o&&(s.forceRefresh=!0);let d=St(this,wt,Yu).call(this,e,a),h=o||d===void 0;if(s&&(s.memo=h?"miss":"hit",h||(s.value=d)),!h)return d;let p=n(e,d,{options:a,context:r});return s&&(s.value=p),St(this,wt,Oc).call(this,e,p,a),p},Yu=function(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=t,a=Z(this,Ns).get(e);if(a===void 0){o&&(o.get="miss");return}let d=Z(this,An)[a],h=St(this,wt,Or).call(this,d);return o&&Z(this,Ll).call(this,o,a),Z(this,zo).call(this,a)?h?(o&&(o.get="stale-fetching"),n&&d.__staleWhileFetching!==void 0?(o&&(o.returnedStale=!0),d.__staleWhileFetching):void 0):(s||St(this,wt,Il).call(this,e,"expire"),o&&(o.get="stale"),n?(o&&(o.returnedStale=!0),d):void 0):(o&&(o.get=h?"fetching":"hit"),St(this,wt,Zu).call(this,a),r&&Z(this,Pc).call(this,a),h?d.__staleWhileFetching:d)},up=function(e,t){Z(this,$o)[t]=e,Z(this,io)[e]=t},Zu=function(e){e!==Z(this,ui)&&(e===Z(this,Hi)?en(this,Hi,Z(this,io)[e]):St(this,wt,up).call(this,Z(this,$o)[e],Z(this,io)[e]),St(this,wt,up).call(this,Z(this,ui),e),en(this,ui,e))},Il=function(e,t){var n,r;pi.hasSubscribers&&pi.publish({op:"delete",delete:t,key:e,cache:this});let s=!1;if(Z(this,qs)!==0){let o=Z(this,Ns).get(e);if(o!==void 0)if(Z(this,Ho)?.[o]&&(clearTimeout(Z(this,Ho)?.[o]),Z(this,Ho)[o]=void 0),s=!0,Z(this,qs)===1)St(this,wt,dp).call(this,t);else{Z(this,Qc).call(this,o);let a=Z(this,An)[o];if(St(this,wt,Or).call(this,a)?a.__abortController.abort(new Error("deleted")):(Z(this,Ba)||Z(this,oo))&&(Z(this,Ba)&&((n=Z(this,Ea))==null||n.call(this,a,e,t)),Z(this,oo)&&Z(this,di)?.push([a,e,t])),Z(this,Ns).delete(e),Z(this,Gr)[o]=void 0,Z(this,An)[o]=void 0,o===Z(this,ui))en(this,ui,Z(this,$o)[o]);else if(o===Z(this,Hi))en(this,Hi,Z(this,io)[o]);else{let d=Z(this,$o)[o];Z(this,io)[d]=Z(this,io)[o];let h=Z(this,io)[o];Z(this,$o)[h]=Z(this,$o)[o]}ip(this,qs)._--,Z(this,Ma).push(o)}}if(Z(this,oo)&&Z(this,di)?.length){let o=Z(this,di),a;for(;a=o?.shift();)(r=Z(this,Ia))==null||r.call(this,...a)}return s},dp=function(e){var t,n;for(let r of St(this,wt,El).call(this,{allowStale:!0})){let s=Z(this,An)[r];if(St(this,wt,Or).call(this,s))s.__abortController.abort(new Error("deleted"));else{let o=Z(this,Gr)[r];Z(this,Ba)&&((t=Z(this,Ea))==null||t.call(this,s,o,e)),Z(this,oo)&&Z(this,di)?.push([s,o,e])}}if(Z(this,Ns).clear(),Z(this,An).fill(void 0),Z(this,Gr).fill(void 0),Z(this,Uo)&&Z(this,Da)){Z(this,Uo).fill(0),Z(this,Da).fill(0);for(let r of Z(this,Ho)??[])r!==void 0&&clearTimeout(r);Z(this,Ho)?.fill(void 0)}if(Z(this,Na)&&Z(this,Na).fill(0),en(this,Hi,0),en(this,ui,0),Z(this,Ma).length=0,en(this,jo,0),en(this,qs,0),Z(this,oo)&&Z(this,di)){let r=Z(this,di),s;for(;s=r?.shift();)(n=Z(this,Ia))==null||n.call(this,...s)}},hp);function J3(e){let t={individual:{},range:[]},n=new WeakMap;for(let r of e)Cm(t,r,n);return t}function Cm(e,t,n){for(let[r,s]of Object.entries(t.individual))if(e.individual[r])Fc(e.individual[r],s,n);else{let o=!1;for(let[a,{range:d,entry:h}]of e.range.entries()){let p=fp(Number(r),d);if(p.both!==null){o=!0,e.individual[r]=s,Fc(e.individual[r],mi(h),n),e.range.splice(a,1);for(let g of p.second)Array.isArray(g)?e.range.push({range:g,entry:mi(h)}):e.individual[g]=mi(h)}}o||(e.individual[r]=s)}for(let{range:r,entry:s}of t.range){let o=[r];for(let a=0;a<e.range.length;a++){let{range:d,entry:h}=e.range[a];for(let[p,g]of o.entries())if(Array.isArray(g)){let y=JE(g,d);if(y.both===null)continue;e.range.splice(a,1),a--;let b=mi(h);Array.isArray(y.both)?e.range.push({range:y.both,entry:b}):e.individual[y.both]=b,Fc(b,mi(s),n);for(let v of y.second)Array.isArray(v)?e.range.push({range:v,entry:mi(h)}):e.individual[v]=mi(h);o=y.first}else{let y=fp(g,d);if(y.both===null)continue;e.individual[g]=mi(s),Fc(e.individual[g],mi(h),n),e.range.splice(a,1),a--;for(let b of y.second)Array.isArray(b)?e.range.push({range:b,entry:mi(h)}):e.individual[b]=mi(h);o.splice(p,1,...y.first);break}}for(let a of Object.keys(e.individual))for(let[d,h]of o.entries())if(Array.isArray(h)){let p=fp(Number(a),h);if(p.both===null)continue;Fc(e.individual[a],mi(s),n),o.splice(d,1,...p.second);break}else if(Number(a)===h){Fc(e.individual[a],mi(s),n);break}for(let a of o)Array.isArray(a)?e.range.push({range:a,entry:mi(s)}):e.individual[a]=mi(s)}}function Fc(e,t,n){let r=n.get(e);r?.has(t)||(r||(r=new Set,n.set(e,r)),r.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?Cm(e.forward,t.forward,n):e.forward=t.forward),t.reverse&&(e.reverse?Cm(e.reverse,t.reverse,n):e.reverse=t.reverse))}function JE(e,t){let n={first:[],second:[],both:null};if(e[0]<t[1]&&t[0]<e[1]){let r=Math.max(e[0],t[0]),s=Math.min(e[1],t[1]);n.both=nc(r,s)}if(e[0]<t[0]){let r=e[0],s=Math.min(t[0],e[1]);n.first.push(nc(r,s))}else if(t[0]<e[0]){let r=t[0],s=Math.min(t[1],e[0]);n.second.push(nc(r,s))}if(e[1]>t[1]){let r=Math.max(e[0],t[1]),s=e[1];n.first.push(nc(r,s))}else if(t[1]>e[1]){let r=Math.max(e[1],t[0]),s=t[1];n.second.push(nc(r,s))}return n}function fp(e,t){if(e<t[0]||e>t[1])return{first:[e],second:[t],both:null};let n={first:[],second:[],both:e};return t[0]<e&&n.second.push(nc(t[0],e)),t[1]>e&&n.second.push(nc(e+1,t[1])),n}function nc(e,t){return t-e===1?e:[e,t]}function mi(e,t=new Map){if(t.has(e))return t.get(e);let n={};return t.set(e,n),e.forward&&(n.forward=A5(e.forward,t)),e.reverse&&(n.reverse=A5(e.reverse,t)),e.lookup&&(n.lookup={contextRange:e.lookup.contextRange.slice(),index:e.lookup.index,length:e.lookup.length,subIndex:e.lookup.subIndex,substitutions:e.lookup.substitutions.slice()}),n}function A5(e,t=new Map){let n={};for(let[r,s]of Object.entries(e.individual))n[r]=mi(s,t);return{individual:n,range:e.range.map(({range:r,entry:s})=>({range:r.slice(),entry:mi(s,t)}))}}function _m(e,t,n,r){let s=t[r],o=e[s];if(!o)return;let a=o.lookup;if(o.reverse){let h=eI(o.reverse,t,n);(!a&&h||h&&a&&(a.index>h.index||a.index===h.index&&a.subIndex>h.subIndex))&&(a=h)}if(++r>=t.length||!o.forward)return a;let d=_m(o.forward,t,n,r);return(!a&&d||d&&a&&(a.index>d.index||a.index===d.index&&a.subIndex>d.subIndex))&&(a=d),a}function eI(e,t,n){let r=e[t[--n]],s=r&&r.lookup;for(;r&&((!s&&r.lookup||r.lookup&&s&&s.index>r.lookup.index)&&(s=r.lookup),!(--n<0||!r.reverse));)r=r.reverse[t[n]];return s}function T5(e,t,n){let r=!1;for(let s=0;s<e.length;s++){let o=e[s];if(r){if(n<=o[0])return e[s-1][1]=n,e;if(n<=o[1])return e[s-1][1]=Math.max(n,o[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(n<=o[0])return e.splice(s,0,[t,n]),e;if(n<=o[1])return o[0]=Math.min(t,o[0]),e;if(t<o[1])o[0]=Math.min(t,o[0]),r=!0;else continue}}return r?e[e.length-1][1]=n:e.push([t,n]),e}function tI(e,t){switch(e.format){case 1:let n=e.glyphs.indexOf(t);return n!==-1?n:null;case 2:let r=e.ranges.find(s=>s.start<=t&&s.end>=t);return r?r.index:null}}function al(e){switch(e.format){case 1:return e.glyphs.map((n,r)=>({glyphId:n,index:r}));case 2:let t=[];for(let[n,r]of e.ranges.entries())r.end===r.start?t.push({glyphId:r.start,index:n}):t.push({glyphId:[r.start,r.end+1],index:n});return t}}function nI(e,t){let n=t[0],r=Lm(e,n),s=t[0]+1,o=new Map;for(;s<t[1];)Lm(e,s)!==r&&(s-n<=1?o.set(n,r):o.set([n,s],r)),s++;return s-n<=1?o.set(n,r):o.set([n,s],r),o}function Lm(e,t){let n=tI(e.coverage,t);if(n===null)return null;switch(e.substFormat){case 1:return(t+e.deltaGlyphId)%2**16;case 2:return e.substitute[n]??null}}function Rg(e,t,n,r,s){let o=[];for(let a of n){a.entry.forward={individual:{},range:[]};for(let d of e)o.push(...Zh(a.entry.forward,r,s,t,d).map(({entry:h,substitution:p})=>({entry:h,substitutions:[...a.substitutions,p]})))}return o}function qh(e,t){let n=[],r=new Set;for(let s of t){if(r.has(s.entry))continue;r.add(s.entry),s.entry.forward??={individual:{},range:[]};let o={};for(let a of e)Array.isArray(a)?s.entry.forward.range.push({entry:o,range:a}):s.entry.forward.individual[a]=o;n.push({entry:o,substitutions:s.substitutions})}return n}function Yh(e,t){let n=[],r=new Set;for(let s of t){if(r.has(s.entry))continue;r.add(s.entry),s.entry.reverse??={individual:{},range:[]};let o={};for(let a of e)Array.isArray(a)?s.entry.reverse.range.push({entry:o,range:a}):s.entry.reverse.individual[a]=o;n.push({entry:o,substitutions:s.substitutions})}return n}function Zh(e,t,n,r,s){let o=[];if(!Array.isArray(s))e.individual[s]={},o.push({entry:e.individual[s],substitution:sI(t,n,r,s)});else{let a=rI(t,n,r,s);for(let[d,h]of a){let p={};Array.isArray(d)?e.range.push({range:d,entry:p}):e.individual[d]={},o.push({entry:p,substitution:h})}}return o}function rI(e,t,n,r){for(let s of e.filter(o=>o.sequenceIndex===n))for(let o of t[s.lookupListIndex].subtables){let a=nI(o,r);if(!Array.from(a.values()).every(d=>d!==null))return a}return new Map([[r,null]])}function sI(e,t,n,r){for(let s of e.filter(o=>o.sequenceIndex===n))for(let o of t[s.lookupListIndex].subtables){let a=Lm(o,r);if(a!==null)return a}return null}function iI(e,t,n){let r={individual:{},range:[]},s=al(e.coverage);for(let{glyphId:o,index:a}of s){let d=e.chainRuleSets[a];if(d)for(let[h,p]of d.entries()){let g=Zh(r,p.lookupRecords,t,0,o).map(({entry:y,substitution:b})=>({entry:y,substitutions:[b]}));for(let[y,b]of p.input.entries())g=Rg([b],y+1,g,p.lookupRecords,t);for(let y of p.lookahead)g=qh([y],g);for(let y of p.backtrack)g=Yh([y],g);for(let{entry:y,substitutions:b}of g)y.lookup={substitutions:b,length:p.input.length+1,index:n,subIndex:h,contextRange:[-1*p.backtrack.length,1+p.input.length+p.lookahead.length]}}}return r}function oI(e,t){return e.format===2?Array.isArray(t)?aI(e,t):new Map([[t,km(e,t)]]):new Map([[t,null]])}function aI(e,t){let n=t[0],r=km(e,n),s=t[0]+1,o=new Map;for(;s<t[1];)km(e,s)!==r&&(s-n<=1?o.set(n,r):o.set([n,s],r)),s++;return s-n<=1?o.set(n,r):o.set([n,s],r),o}function km(e,t){for(let n of e.ranges)if(n.start<=t&&n.end>=t)return n.classId;return null}function pp(e,t){switch(e.format){case 2:let n=[];for(let r of e.ranges)r.classId===t&&(r.end===r.start?n.push(r.start):n.push([r.start,r.end+1]));return n;default:return[]}}function lI(e,t,n){let r=[],s=al(e.coverage);for(let{glyphId:o}of s){let a=oI(e.inputClassDef,o);for(let[d,h]of a.entries()){if(h===null)continue;let p=e.chainClassSet[h];if(p)for(let[g,y]of p.entries()){let b={individual:{},range:[]},v=Zh(b,y.lookupRecords,t,0,d).map(({entry:T,substitution:A})=>({entry:T,substitutions:[A]}));for(let[T,A]of y.input.entries())v=Rg(pp(e.inputClassDef,A),T+1,v,y.lookupRecords,t);for(let T of y.lookahead)v=qh(pp(e.lookaheadClassDef,T),v);for(let T of y.backtrack)v=Yh(pp(e.backtrackClassDef,T),v);for(let{entry:T,substitutions:A}of v)T.lookup={substitutions:A,index:n,subIndex:g,length:y.input.length+1,contextRange:[-1*y.backtrack.length,1+y.input.length+y.lookahead.length]};r.push(b)}}}return J3(r)}function cI(e,t,n){let r={individual:{},range:[]},s=al(e.inputCoverage[0]);for(let{glyphId:o}of s){let a=Zh(r,e.lookupRecords,t,0,o).map(({entry:d,substitution:h})=>({entry:d,substitutions:[h]}));for(let[d,h]of e.inputCoverage.slice(1).entries())a=Rg(al(h).map(p=>p.glyphId),d+1,a,e.lookupRecords,t);for(let d of e.lookaheadCoverage)a=qh(al(d).map(h=>h.glyphId),a);for(let d of e.backtrackCoverage)a=Yh(al(d).map(h=>h.glyphId),a);for(let{entry:d,substitutions:h}of a)d.lookup={substitutions:h,index:n,subIndex:0,length:e.inputCoverage.length,contextRange:[-1*e.backtrackCoverage.length,e.inputCoverage.length+e.lookaheadCoverage.length]}}return r}function uI(e,t){let n={individual:{},range:[]},r=al(e.coverage);for(let{glyphId:s,index:o}of r){let a={};Array.isArray(s)?n.range.push({entry:a,range:s}):n.individual[s]=a;let d=[{entry:a,substitutions:[e.substitutes[o]]}];for(let h of e.lookaheadCoverage)d=qh(al(h).map(p=>p.glyphId),d);for(let h of e.backtrackCoverage)d=Yh(al(h).map(p=>p.glyphId),d);for(let{entry:h,substitutions:p}of d)h.lookup={substitutions:p,index:t,subIndex:0,length:1,contextRange:[-1*e.backtrackCoverage.length,1+e.lookaheadCoverage.length]}}return n}function Em(e,t=new Map){let n={};for(let[r,s]of Object.entries(e.individual))n[r]=S5(s,t);for(let{range:r,entry:s}of e.range){let o=S5(s,t);for(let a=r[0];a<r[1];a++)n[a]=o}return n}function S5(e,t){if(t.has(e))return t.get(e);let n={};return t.set(e,n),e.forward&&(n.forward=Em(e.forward,t)),e.reverse&&(n.reverse=Em(e.reverse,t)),e.lookup&&(n.lookup=e.lookup),n}var dI=class{constructor(e,t){this._lookupTrees=[],this._glyphLookups={},this._font=e,t.cacheSize>0&&(this._cache=new XE({maxSize:t.cacheSize,sizeCalculation:((o,a)=>a.length)}));let n=(this._font.tables.gsub&&this._font.tables.gsub.features.filter(o=>o.tag==="calt")||[]).reduce((o,a)=>[...o,...a.feature.lookupListIndexes],[]),r=this._font.tables.gsub&&this._font.tables.gsub.lookups||[],s=r.filter((o,a)=>n.some(d=>d===a));for(let[o,a]of s.entries()){let d=[];switch(a.lookupType){case 6:for(let[p,g]of a.subtables.entries())switch(g.substFormat){case 1:d.push(iI(g,r,p));break;case 2:d.push(lI(g,r,p));break;case 3:d.push(cI(g,r,p));break}break;case 8:for(let[p,g]of a.subtables.entries())d.push(uI(g,p));break}let h=Em(J3(d));this._lookupTrees.push({tree:h,processForward:a.lookupType!==8});for(let p of Object.keys(h))this._glyphLookups[p]||(this._glyphLookups[p]=[]),this._glyphLookups[p].push(o)}}findLigatures(e){let t=this._cache&&this._cache.get(e);if(t&&!Array.isArray(t))return t;let n=[];for(let o of e)n.push(this._font.charToGlyphIndex(o));if(this._lookupTrees.length===0)return{inputGlyphs:n,outputGlyphs:n,contextRanges:[]};let r=this._findInternal(n.slice()),s={inputGlyphs:n,outputGlyphs:r.sequence,contextRanges:r.ranges};return this._cache&&this._cache.set(e,s),s}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 n=[];for(let s of e)n.push(this._font.charToGlyphIndex(s));let r=this._findInternal(n);return this._cache&&this._cache.set(e,r.ranges),r.ranges}_findInternal(e){let t=[],n=this._getNextLookup(e,0);for(;n.index!==null;){let r=this._lookupTrees[n.index];if(r.processForward){let s=n.last;for(let o=n.first;o<s;o++){let a=_m(r.tree,e,o,o);if(a){for(let d=0;d<a.substitutions.length;d++){let h=a.substitutions[d];h!==null&&(e[o+d]=h)}T5(t,a.contextRange[0]+o,a.contextRange[1]+o),o+a.length>=s&&(s=o+a.length+1),o+=a.length-1}}}else for(let s=n.last-1;s>=n.first;s--){let o=_m(r.tree,e,s,s);if(o){for(let a=0;a<o.substitutions.length;a++){let d=o.substitutions[a];d!==null&&(e[s+a]=d)}T5(t,o.contextRange[0]+s,o.contextRange[1]+s),s-=o.length-1}}n=this._getNextLookup(e,n.index+1)}return{sequence:e,ranges:t}}_getNextLookup(e,t){let n={index:null,first:1/0,last:-1};for(let r=0;r<e.length;r++){let s=this._glyphLookups[e[r]];if(s)for(let o=0;o<s.length;o++){let a=s[o];if(a>=t){(n.index===null||a<=n.index)&&(n.index=a,n.first>r&&(n.first=r),n.last=r+1);break}}}return n}};function hI(e,t){let n=VE.parse(e);return new dI(n,{cacheSize:0,...t})}function fI(e){if(typeof e!="string")throw new Error("Font family must be a string");let t={input:e,offset:0},n=[],r="";for(;t.offset<t.input.length;){let s=t.input[t.offset++];switch(s){case"'":case'"':r+=pI(t,s);break;case",":n.push(r),r="";break;default:/\s/.test(s)||(t.offset--,r+=mI(t),n.push(r),r="")}}return n}function pI(e,t){let n="",r=!1;for(;e.offset<e.input.length;){let s=e.input[e.offset++];if(r)/[\dA-Fa-f]/.test(s)?(e.offset--,n+=ev(e)):s!==`
|
|
67
|
-
`&&(n+=s),r=!1;else switch(s){case t:return n;case"\\":r=!0;break;default:n+=s}}throw new Error("Unterminated string")}function mI(e){let t="",n=!1;for(;e.offset<e.input.length;){let r=e.input[e.offset++];if(n)/[\dA-Fa-f]/.test(r)?(e.offset--,t+=ev(e)):t+=r,n=!1;else switch(r){case"\\":n=!0;break;case",":return t;default:/\s/.test(r)?t.endsWith(" ")||(t+=" "):t+=r}}return t}function ev(e){let t="";for(;e.offset<e.input.length;){let n=e.input[e.offset++];if(/\s/.test(n))return mp(t);if(t.length>=6||!/[\dA-Fa-f]/.test(n))return e.offset--,mp(t);t+=n}return mp(t)}function mp(e){return String.fromCodePoint(parseInt(e,16))}var Ku;async function gI(e,t){if(!Ku){if(typeof navigator<"u"&&"fonts"in navigator){try{let s=await navigator.permissions.request?.({name:"local-fonts"});if(s&&s.state!=="granted")throw new Error("Permission to access local fonts not granted.")}catch(s){if(s instanceof Error&&s.name!=="TypeError")throw s}let r={};try{let s=await navigator.fonts.query();for(let o of s)r.hasOwnProperty(o.family)||(r[o.family]=[]),r[o.family].push(o);Ku=Promise.resolve(r)}catch(s){s instanceof Error&&console.error(s.name,s.message)}}else if(typeof window<"u"&&"queryLocalFonts"in window){let r={};try{let s=await window.queryLocalFonts();for(let o of s)r.hasOwnProperty(o.family)||(r[o.family]=[]),r[o.family].push(o);Ku=Promise.resolve(r)}catch(s){s instanceof Error&&console.error(s.name,s.message)}}Ku??=Promise.resolve({})}let n=await Ku;for(let r of fI(e)){if(xI.includes(r))return;if(n.hasOwnProperty(r)&&n[r].length>0){let s=n[r][0];if("blob"in s){let o=await(await s.blob()).arrayBuffer();return hI(o,{cacheSize:t})}return}}}var xI=["serif","sans-serif","cursive","fantasy","monospace","system-ui","emoji","math","fangsong"],yI=1e5;function bI(e,t=[]){let n,r,s=0,o;return e.registerCharacterJoiner(a=>{let d=e.options.fontFamily;if(d&&(s===0||n!==d)){r=void 0,s=1,n=d;let h=n;gI(h,yI).then(p=>{h===e.options.fontFamily&&(s=2,r=p,p&&e.refresh(0,e.rows-1))}).catch(p=>{h===e.options.fontFamily&&(s=3,e.options.logLevel==="debug"&&console.debug(o,new Error("Failure while loading font")),r=void 0,o=p)})}return r&&s===2?r.findLigatureRanges(a).map(h=>[h[0],h[1]]):vI(a,t)})}function vI(e,t){let n=[];for(let r=0;r<e.length;r++)for(let s=0;s<t.length;s++)if(e.startsWith(t[s],r)){n.push([r,r+t[s].length]),r+=t[s].length-1;break}return n}var wI=class{constructor(e){this._fallbackLigatures=(e?.fallbackLigatures??["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!===","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"]).sort((t,n)=>n.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=bI(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 C5(e){let t=0;for(let n=0;n<e.length;++n){let r=e.charCodeAt(n);if(r<48||57<r)return-1;t=t*10+r-48}return t}var AI=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 n=t.split(";");if(n.length>3)return!0;n.length===2&&n.push("");let r=C5(n[1]),s=C5(n[2]);switch(r){case 0:this.progress={state:r,value:0};break;case 1:if(s<0)return!0;this.progress={state:r,value:s};break;case 2:case 4:if(s<0)return!0;this.progress={state:r,value:s||this._pr};break;case 3:this.progress={state:r,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 tv(e,t){const n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),s=Math.min(e.right,t.right),o=Math.min(e.bottom,t.bottom);return s>n&&o>r?{left:n,top:r,right:s,bottom:o}:null}function _5(e,t){const n=tv(e,t);return n?(n.right-n.left)*(n.bottom-n.top):0}function lc(e){const t=e.element;if(!t||!e.cols||!e.rows)return null;const r=(t.querySelector?.(".xterm-screen")??null??t).getBoundingClientRect();if(!r.width||!r.height)return null;const s=e.dimensions?.css?.cell?.height,o=r.width/e.cols,a=s&&s>0?s:r.height/e.rows;return{originLeft:r.left,originTop:r.top,cellW:o,cellH:a}}function eh(e,t){const n=lc(e);if(!n)return null;const r=t.row-e.buffer.active.viewportY;if(r<0||r>=e.rows)return null;const s=Math.max(0,Math.min(e.cols-1,t.col));return{x:n.originLeft+(s+.5)*n.cellW,y:n.originTop+r*n.cellH}}function TI(e,t){const n=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(n,t.row))}}function gh(e,t,n){const r=e.row*n+e.col,s=t.row*n+t.col;return r<=s?{start:e,end:t}:{start:t,end:e}}function SI(e,t,n){const r=lc(e);if(!r)return null;const{start:s,end:o}=gh(t,n,e.cols),a=e.buffer.active.viewportY,d=a+e.rows-1;if(o.row<a||s.row>d)return null;const h=Math.max(s.row,a),p=Math.min(o.row,d),g=r.originTop+(h-a)*r.cellH,y=r.originTop+(p-a+1)*r.cellH;return s.row===o.row?{left:r.originLeft+s.col*r.cellW,top:g,right:r.originLeft+(o.col+1)*r.cellW,bottom:y}:{left:r.originLeft,top:g,right:r.originLeft+e.cols*r.cellW,bottom:y}}function CI(e){const t=Math.max(e.viewport.left,e.terminal.left),n=Math.max(e.viewport.top,e.terminal.top),r=Math.min(e.viewport.right,e.terminal.right),s=Math.min(e.viewport.bottom,e.terminal.bottom),o=t+e.margin,a=n+e.margin,d=Math.max(o,r-e.width-e.margin),h=Math.max(a,s-e.height-e.margin),p=H=>Math.max(o,Math.min(H,d)),g=H=>Math.max(a,Math.min(H,h)),y=e.selection?tv(e.selection,{left:t,top:n,right:r,bottom:s}):null;if(!y){const H=p(e.clientX-e.width/2),ye=e.clientY-e.height-e.fingerGap,q=e.clientY+e.fingerGap,te=g(ye>=a?ye:q);return{left:Math.round(H),top:Math.round(te)}}const b=(y.left+y.right)/2,v=(y.top+y.bottom)/2,T=e.preference?.alignX??b,A=e.selectionGap??e.fingerGap,L=y.top-e.height-A,R=y.bottom+A,D=e.preference?.vertical==="below"?R:L,B=e.preference?.vertical==="below"?L:R,j=[{left:o,top:a},{left:d,top:a},{left:o,top:h},{left:d,top:h}];e.preference&&j.sort((H,ye)=>{const q=te=>{const ve=te.left+e.width/2,ge=te.top+e.height/2;return Math.hypot(ve-e.preference.focusX,ge-e.preference.focusY)};return q(ye)-q(H)});const P=[{left:T-e.width/2,top:D},{left:b-e.width/2,top:D},{left:T-e.width/2,top:B},{left:b-e.width/2,top:B},{left:y.left-e.width-e.fingerGap,top:v-e.height/2},{left:y.right+e.fingerGap,top:v-e.height/2},...j].map(H=>({left:p(H.left),top:g(H.top)}));let $=P[0],z=Number.POSITIVE_INFINITY;return P.forEach((H,ye)=>{const q={left:H.left,top:H.top,right:H.left+e.width,bottom:H.top+e.height},te=(e.avoid??[]).reduce((ge,ie)=>ge+_5(q,ie),0),ve=(te>0?1e6:0)+te*100+_5(q,y)*10+ye*.01;ve<z&&($=H,z=ve)}),{left:Math.round($.left),top:Math.round($.top)}}function _I(e){const t=e.willChange.split(",").map(r=>r.trim()),n=(r,s)=>!!(r&&r!==s);return n(e.transform,"none")||n(e.perspective,"none")||n(e.filter,"none")||n(e.backdropFilter,"none")||n(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 LI(e){let t=e.parentElement;for(;t;){if(_I(window.getComputedStyle(t)))return t;t=t.parentElement}return null}function kI(e,t,n,r){const s=e.getBoundingClientRect();let o=0,a=0;if(t){const d=t.getBoundingClientRect();o=d.left+t.clientLeft,a=d.top+t.clientTop}return{x:s.left-o+n,y:s.top-a+r}}function EI(e,t){const n=e.replace(/\r?\n/g,"\r");return`\x1B[200~${(t&&n.endsWith("\r")?n.slice(0,-1):n).replace(/\x1b/g,"␛")}\x1B[201~${t?"\r":""}`}function II(e,t,n){let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];)r+=1;let s=0;const o=e.length-r,a=t.length-r;for(;s<o&&s<a&&e[e.length-1-s]===t[t.length-1-s];)s+=1;const d=t.slice(r,t.length-s);return d&&(n==="insertFromPaste"||n==="insertFromPasteAsQuotation"||/[\r\n]/.test(d))?d:null}const L5=2,RI=new Set(["mount","init-fit","resize","dpr-change","session-key-change","session-reset","tmux-layout"]);function MI(e){const t=e.reason.replace(/^refresh:/,""),n=RI.has(t),r=Math.abs(e.proposedCols-e.currentCols),s=Math.abs(e.proposedRows-e.currentRows);return{accept:n?r>0||s>0:r>=L5||s>=L5,isRealResize:n,colsDelta:r,rowsDelta:s}}function NI(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 DI(e,t){return!e||t}function BI(e,t,n){return e!=="alternate"&&n>=t}function PI(e,t){return e?"none":t?"single":"settled"}function QI(e,t,n){return!n&&(e||t)}function OI(e,t){return e==="webgl"&&t}function FI(e){let t,n,r=!1,s=0;const o=e.parser.registerCsiHandler({prefix:"?",final:"l"},d=>(t&&d.some(h=>h===2026)&&(r=!0),!1)),a=d=>{const h=t;if(!h)return;const p=n;if(t=void 0,n=void 0,r=!1,h(),d){const g=e._core?._renderService?._renderer?.value;p&&g?.handleResize(...p),g?.renderRows(0,e.rows-1),e.refresh(0,e.rows-1)}};return{begin(){if(s++,r=!1,t)return;const d=e._core?._renderService?._renderer?.value;if(!d||typeof d.handleResize!="function"||typeof d.renderRows!="function"||typeof d.clear!="function")return;const h=d.handleResize,p=d.renderRows,g=d.clear;d.handleResize=(y,b)=>{n=[y,b]},d.renderRows=()=>{},d.clear=()=>{},t=()=>{d.handleResize=h,d.renderRows=p,d.clear=g}},get generation(){return s},written(d){d===s&&r&&!e.modes.synchronizedOutputMode&&a(!0)},cancel(){a(!0)},dispose(){a(!1),o.dispose()}}}function gp(){return{confirmed:null,pending:null,nextSeq:1}}function k5(e,t){return e?.cols===t.cols&&e.rows===t.rows}function Mg(e,t,n){const r={...t,seq:e.nextSeq,attempt:n};return{state:{...e,pending:r,nextSeq:e.nextSeq+1},request:r}}function jI(e,t){return k5(e.pending,t)||!e.pending&&k5(e.confirmed,t)?{state:e,request:null}:Mg(e,t,0)}function $I(e,t){return Mg(e,t,0)}function UI(e,t){const n=e.pending;if(!n||t.seq!==n.seq)return{state:e,accepted:!1};const r=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:r,pending:null},accepted:!0}}function E5(e,t,n=1){const r=e.pending;return!r||r.seq!==t?{state:e,request:null,exhausted:!1}:r.attempt>=n?{state:{...e,confirmed:null,pending:null},request:null,exhausted:!0}:{...Mg(e,r,r.attempt+1),exhausted:!1}}function HI(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 zI(e){return{...e,pending:null}}const Im="termdock-settings",GI=6,WI=100,VI='"calt" on',qI=["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!==","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"];function YI(){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 Ng(){return{fontFamily:"var(--font-mono)",fontSize:YI(),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 Cd(e,t,n,r){return typeof e=="number"&&Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function I5(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 iu(e){const t=Ng(),n=e&&typeof e=="object"?e:{},r=n.rendererMode??n.renderer;return{fontFamily:typeof n.fontFamily=="string"&&n.fontFamily.trim()?n.fontFamily.trim():t.fontFamily,fontSize:Cd(n.fontSize,GI,WI,t.fontSize),rendererMode:r==="auto"||r==="webgl"||r==="canvas"?r:t.rendererMode,fontWeight:I5(n.fontWeight,t.fontWeight),fontWeightBold:I5(n.fontWeightBold,t.fontWeightBold),letterSpacing:Math.round(Cd(n.letterSpacing,-5,10,t.letterSpacing)),lineHeight:Cd(n.lineHeight,1,2,t.lineHeight),minimumContrastRatio:Cd(n.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 _d(e){return e.pointerType==="touch"||e.pointerType==="pen"}class ZI{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[n,r]of this.active)r===t&&(this.active.delete(n),this.pointerStates.delete(n));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,n){return this.active.get(t)===n}isAnyPointerClaimed(){return this.active.size>0}onChange(t){return this.changeListeners.add(t),()=>{this.changeListeners.delete(t)}}emitChange(t,n,r){this.changeListeners.size!==0&&this.changeListeners.forEach(s=>{try{s({type:t,pointerId:n,handler:r})}catch{}})}log(t,n,r=""){if(typeof window<"u"&&window.__TERMDOCK_GESTURE_DEBUG__){const s=performance.now().toFixed(0);console.debug(`[GestureManager ${s}] ${t} ${n} ${r}`)}}sortedHandlers(){return this.sortedDirty&&(this.sorted=[...this.handlers.values()].sort((t,n)=>n.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(!_d(t))return;const n={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,startTime:performance.now()};this.pointerStates.set(t.pointerId,n);let r=!1;for(const s of this.sortedHandlers()){if(!this.handlerMatchesContainer(s,t)){this.log("skip-container",s.name);continue}s.onPointerDown(t,n)&&!r&&(this.active.set(t.pointerId,s.name),r=!0,this.log("claim",s.name,`pid=${t.pointerId} onPointerDown`),this.emitChange("claim",t.pointerId,s.name))}r&&t.preventDefault()};handlePointerMove=t=>{if(!_d(t)||!this.pointerStates.has(t.pointerId))return;let n=!1;for(const r of this.sortedHandlers()){if(!this.handlerMatchesContainer(r,t))continue;const s=this.active.get(t.pointerId)===r.name,o=r.onPointerMove(t,s);if(o==="claim"&&!n){const a=this.active.get(t.pointerId)??null;this.active.set(t.pointerId,r.name),n=!0,t.preventDefault(),a&&a!==r.name&&this.log("handoff",`${a}->${r.name}`,`pid=${t.pointerId}`),this.log("claim",r.name,`pid=${t.pointerId} onPointerMove`),this.emitChange("claim",t.pointerId,r.name)}if(o==="release"&&s&&!n){const a=this.active.get(t.pointerId);this.active.delete(t.pointerId),this.log("release",r.name,`pid=${t.pointerId}`),this.emitChange("release",t.pointerId,a??null)}}};handlePointerUp=t=>{if(!_d(t))return;for(const r of this.sortedHandlers())this.handlerMatchesContainer(r,t)&&r.onPointerUp(t);const n=this.active.get(t.pointerId)??null;this.active.delete(t.pointerId),this.pointerStates.delete(t.pointerId),this.emitChange("complete",t.pointerId,n)};handlePointerCancel=t=>{if(!_d(t))return;for(const r of this.sortedHandlers())this.handlerMatchesContainer(r,t)&&r.onPointerCancel(t);const n=this.active.get(t.pointerId)??null;this.active.delete(t.pointerId),this.pointerStates.delete(t.pointerId),this.emitChange("complete",t.pointerId,n)};handlerMatchesContainer(t,n){return t.container?t.container.contains(n.target):!0}}const nv=new ZI,KI=90,XI=80,JI=70,eR=(e,t)=>{const{scrollMultiplier:n=1.2,maxScrollBoost:r=.8,boostDenominator:s=50,velocityAlpha:o=.15,maxVelocity:a=15,minVelocity:d=.3,decelerationRate:h=.998,enableKinetic:p=!0,shouldCaptureTouch:g,canStartScrollGesture:y,onScroll:b,onScrollWithCoords:v,onTap:T,onClickWithCoords:A,onClaimChange:L,tapThreshold:R=10,gestureName:D="normal-scroll"}=t,B=1.06,j=_.useRef({lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1,pointerId:null,isCurrentlyScrolling:!1,gestureAxis:null}),P=_.useRef(0),$=_.useRef(0),z=_.useRef(0),H=_.useRef(null),ye=_.useRef(0),q=_.useRef(!1),te=_.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),ve=_.useCallback(()=>{H.current=null,P.current!==0&&(v&&$.current>0&&z.current>0?v(P.current,$.current,z.current):b&&b(P.current),P.current=0,$.current=0,z.current=0)},[b,v]),ge=_.useCallback(()=>{H.current===null&&typeof window<"u"&&(H.current=window.requestAnimationFrame(ve))},[ve]),ie=_.useCallback((ze,X,rt)=>{P.current+=ze,X!==void 0&&rt!==void 0&&($.current=X,z.current=rt),ge()},[ge]),Ae=_.useCallback(ze=>{if(!ze||!b)return!1;const X=b(ze);return X?ye.current=0:ye.current++,X},[b]),xe=_.useCallback(ze=>{q.current!==ze&&(q.current=ze,L?.(ze))},[L]),ce=_.useCallback(()=>{const ze=j.current;ze.rafId!==null&&typeof window<"u"&&window.cancelAnimationFrame(ze.rafId),ze.rafId=null,H.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(H.current),H.current=null,P.current=0},[]),K=_.useRef(T);K.current=T;const be=_.useRef(A);be.current=A;const Se=_.useRef(g);Se.current=g;const We=_.useCallback(()=>{const ze=e.current;if(!ze||!("PointerEvent"in window))return()=>{};const X=j.current,rt={name:D,priority:JI,get container(){return e.current??void 0},onPointerDown:(J,$e)=>(J.pointerType!=="touch"||(X.pointerId=J.pointerId,X.startX=$e.startX,X.startY=$e.startY,X.didMove=!1,X.gestureAxis=null,X.lastY=J.clientY,X.lastTime=te(),X.velocity=0,ce()),!1),onPointerMove:(J,$e)=>{if(J.pointerType!=="touch"||X.pointerId!==J.pointerId||!X.lastY||!X.lastTime)return"neutral";const tt=J.clientX,gt=J.clientY,pt=te(),Ct=pt-X.lastTime,Le=gt-X.lastY;if(X.startX!==null&&X.startY!==null){const Oe=tt-X.startX,yt=gt-X.startY;if(!X.didMove&&Math.hypot(Oe,yt)>=R&&(X.didMove=!0),X.gestureAxis===null&&X.didMove){const de=Math.abs(Oe),Pe=Math.abs(yt);de>Pe*B?X.gestureAxis="x":Pe>de*B&&(X.gestureAxis="y")}if(X.gestureAxis==="x")return X.isCurrentlyScrolling=!1,xe(!1),X.lastY=gt,X.lastTime=pt,$e?"release":"neutral";if(X.gestureAxis===null)return X.lastY=gt,X.lastTime=pt,"neutral"}if(X.gestureAxis==="y"&&!$e&&!(y?.()??!0))return X.lastY=gt,X.lastTime=pt,xe(!1),"neutral";const Te=Le/Math.max(Ct,1);if(X.velocity=X.velocity*(1-o)+Te*o,X.velocity=Math.max(-a,Math.min(a,X.velocity)),Math.abs(Le)>1){if(!$e)return xe(!0),X.lastY=gt,X.lastTime=pt,"claim";X.isCurrentlyScrolling=!0;const Oe=n+Math.min(r,Math.abs(Le)/s),yt=-Le*Oe;ie(yt,tt,gt),xe(!0)}return X.lastY=gt,X.lastTime=pt,$e?"claim":"neutral"},onPointerUp:J=>{if(J.pointerType!=="touch"||X.pointerId!==J.pointerId)return;const $e=X.isCurrentlyScrolling;X.isCurrentlyScrolling=!1,xe(!1);const tt=X.rafId!==null||H.current!==null;!X.didMove&&!tt&&X.startX!==null&&X.startY!==null&&K.current?.(X.startX,X.startY),!X.didMove&&!tt&&X.startX!==null&&X.startY!==null&&be.current?.(X.startX,X.startY),X.pointerId=null,X.startX=null,X.startY=null;const gt=X.gestureAxis==="x";if(X.gestureAxis=null,p&&$e&&!gt&&Math.abs(X.velocity)>d&&X.didMove){const pt=()=>{const Ct=te(),Le=Ct-(X.lastTime||Ct);if(X.lastTime=Ct,X.velocity*=Math.pow(h,Le),Math.abs(X.velocity)<d){X.velocity=0,ce();return}if(!Ae(-X.velocity*Le)&&ye.current>2){X.velocity=0,ce();return}X.rafId=requestAnimationFrame(pt)};X.rafId=requestAnimationFrame(pt)}},onPointerCancel:J=>{J.pointerType!=="touch"||X.pointerId!==J.pointerId||(X.isCurrentlyScrolling=!1,xe(!1),X.pointerId=null,X.startX=null,X.startY=null,X.gestureAxis=null,ce())}},qe=nv.register(rt),re=ze.style.touchAction;return ze.style.touchAction="none",()=>{xe(!1),qe(),ze.style.touchAction=re,ce()}},[e,D,n,r,s,o,a,d,h,te,ce,Ae,ie,R,p,xe,y]),ue=_.useCallback(()=>{const ze=e.current;if(!ze)return()=>{};const X=j.current,rt=$e=>{$e.touches.length===1&&((g?.()??!0)&&$e.cancelable&&$e.preventDefault(),X.isCurrentlyScrolling=!1,X.gestureAxis=null,X.lastY=$e.touches[0].clientY,X.startX=$e.touches[0].clientX,X.startY=$e.touches[0].clientY,X.didMove=!1,X.velocity=0,ce())},qe=$e=>{if($e.touches.length!==1)return;const tt=$e.touches[0].clientX,gt=$e.touches[0].clientY;if(X.startX!==null&&X.startY!==null){const Ct=tt-X.startX,Le=gt-X.startY;if(!X.didMove&&Math.hypot(Ct,Le)>=R&&(X.didMove=!0),X.gestureAxis===null&&X.didMove){const Te=Math.abs(Ct),Oe=Math.abs(Le);Te>Oe*B?X.gestureAxis="x":Oe>Te*B&&(X.gestureAxis="y")}if(X.gestureAxis==="x"){X.isCurrentlyScrolling=!1,X.lastY=gt;return}if(X.gestureAxis===null){(g?.()??!1)&&$e.cancelable&&$e.preventDefault(),X.lastY=gt;return}}if($e.preventDefault(),!X.lastY){X.lastY=gt;return}const pt=gt-X.lastY;if(Math.abs(pt)>1){X.isCurrentlyScrolling=!0;const Ct=n+Math.min(r,Math.abs(pt)/s),Le=-pt*Ct;ie(Le,tt,gt)}X.lastY=gt},re=$e=>{if(!$e.changedTouches?.[0])return;const gt=X.isCurrentlyScrolling;X.isCurrentlyScrolling=!1;const pt=X.rafId!==null||H.current!==null;!X.didMove&&!pt&&T&&X.startX!==null&&X.startY!==null&&T(X.startX,X.startY),!X.didMove&&!pt&&A&&X.startX!==null&&X.startY!==null&&A(X.startX,X.startY),X.startX=null,X.startY=null;const Ct=X.gestureAxis==="x";if(X.gestureAxis=null,p&>&&!Ct&&X.didMove&&Math.abs(X.velocity)>d){const Le=()=>{if(X.velocity*=Math.pow(h,16),Math.abs(X.velocity)<d){X.velocity=0,ce();return}if(!Ae(-X.velocity*16)&&ye.current>2){X.velocity=0,ce();return}X.rafId=requestAnimationFrame(Le)};X.rafId=requestAnimationFrame(Le)}};ze.addEventListener("touchstart",rt,{passive:!1}),ze.addEventListener("touchmove",qe,{passive:!1}),ze.addEventListener("touchend",re,{passive:!1}),ze.addEventListener("touchcancel",re,{passive:!1});const J=ze.style.touchAction;return ze.style.touchAction="none",()=>{ze.removeEventListener("touchstart",rt),ze.removeEventListener("touchmove",qe),ze.removeEventListener("touchend",re),ze.removeEventListener("touchcancel",re),ze.style.touchAction=J,ce()}},[e,n,r,s,d,h,ce,Ae,ie,T,A,R,g,p]),Ee=_.useCallback(()=>{ce();const ze=typeof window<"u"&&"PointerEvent"in window,X=ze?We():()=>{},rt=ze?()=>{}:ue();return()=>{X(),rt(),ce()}},[We,ue,ce]),Tt=_.useCallback(()=>j.current.isCurrentlyScrolling||j.current.rafId!==null||H.current!==null,[]),Rt=_.useCallback(()=>{ce();const ze=j.current;ze.isCurrentlyScrolling=!1,ze.velocity=0,ze.lastY=null,ze.lastTime=null,ze.startX=null,ze.startY=null,ze.pointerId=null,ze.didMove=!1,ze.gestureAxis=null},[ce]);return{setupTouchScroll:Ee,isScrolling:Tt,stopAllScroll:Rt}};function R5(e){const{name:t,priority:n}=e,r=S.useRef(e.onPointerDown),s=S.useRef(e.onPointerMove),o=S.useRef(e.onPointerUp),a=S.useRef(e.onPointerCancel),d=S.useRef(e.container);r.current=e.onPointerDown,s.current=e.onPointerMove,o.current=e.onPointerUp,a.current=e.onPointerCancel,d.current=e.container,S.useEffect(()=>{const h={name:t,priority:n,get container(){const g=d.current;return typeof g=="function"?g():g},onPointerDown(g,y){return r.current?.(g,y)??!1},onPointerMove(g,y){return s.current?.(g,y)??"neutral"},onPointerUp(g){o.current?.(g)},onPointerCancel(g){a.current?.(g)}};return nv.register(h)},[t,n])}var Cs;(function(e){e.Light="light",e.Medium="medium",e.Heavy="heavy",e.Success="success",e.Warning="warning",e.Error="error"})(Cs||(Cs={}));Cs.Light,Cs.Medium,Cs.Heavy,Cs.Success,Cs.Warning,Cs.Error;Cs.Light,Cs.Medium,Cs.Heavy,Cs.Success,Cs.Warning,Cs.Error;Cs.Light,Cs.Medium,Cs.Heavy,Cs.Success,Cs.Warning,Cs.Error;const tR=()=>typeof navigator<"u"&&typeof navigator.vibrate=="function",nR=()=>typeof document<"u"&&!!document.body,rR=()=>{if(nR())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{}},M5=e=>Array.isArray(e)?[...e]:[e],sR=e=>{if(tR()){try{const s=M5(e),o=s.length===1?s[0]:s;navigator.vibrate(o)}catch{}return}const t=M5(e),n=Array.from({length:Math.ceil(t.length/2)},(s,o)=>[t[o*2]??0,t[o*2+1]??0]);let r=0;for(const[s,o]of n)s>0&&setTimeout(rR,r),r+=s+o},da=e=>sR(e),iR=({message:e})=>{const{t}=qn();return u.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:u.jsxs("div",{className:"rounded-full bg-surface-2 px-4 py-2 flex items-center gap-3 shadow-sm",children:[u.jsx("div",{className:"w-5 h-5 border-2 border-primary/30 border-t-primary rounded-full animate-spin"}),u.jsx("span",{className:"text-sm text-muted-foreground",children:e??t("terminal.loading")})]})})},oR=()=>{const{t:e}=qn();return u.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:u.jsxs("div",{className:"rounded-full bg-surface-2 px-4 py-2 flex items-center gap-3 shadow-sm",children:[u.jsx("div",{className:"w-5 h-5 border-2 border-primary/30 border-t-primary rounded-full animate-spin"}),u.jsx("span",{className:"text-sm text-muted-foreground",children:e("terminal.initializing")})]})})},aR=({message:e,onRetry:t})=>{const{t:n}=qn();return u.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-4",children:u.jsxs("div",{className:"flex flex-col items-center gap-3 text-center max-w-md",children:[u.jsx("div",{className:"w-12 h-12 rounded-full bg-destructive/10 flex items-center justify-center",children:u.jsxs("svg",{className:"w-6 h-6 text-destructive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,role:"img","aria-label":n("terminal.error"),children:[u.jsx("title",{children:n("terminal.error")}),u.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"})]})}),u.jsxs("div",{className:"space-y-1",children:[u.jsx("h3",{className:"font-medium text-foreground",children:n("terminal.failedToLoad")}),u.jsx("p",{className:"text-sm text-muted-foreground",children:e||n("terminal.unknownError")})]}),t&&u.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:n("common.retry")})]})})},lR="debug",cR="termdock:debug";function N5(e){return e?new Set(e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean)):new Set}function uR(){if(typeof window>"u")return new Set;const e=N5(new URLSearchParams(window.location.search).get(lR));let t=new Set;try{t=N5(window.localStorage.getItem(cR))}catch{t=new Set}const n=new Set([...e,...t]);return n.has("1")||n.has("true")||n.has("*")||n.has("all")?new Set(["*"]):n}function dR(e){const t=uR();return t.has("*")||t.has(e)}function mc(e){const t=dR(e);return(...n)=>{t&&console.log(`[debug:${e}]`,...n)}}function th(e){return Array.from(e)}function D5(e,t,n){return Math.max(t,Math.min(n,e))}function hR(e,t,n,r){const s=th(e),o=th(t);let a=D5(n,0,s.length);const d=D5(r,0,o.length);let h=0;for(;h<s.length&&h<o.length&&s[h]===o[h];)h++;let p=0;for(;p<s.length-h&&p<o.length-h&&s[s.length-1-p]===o[o.length-1-p];)p++;const g=s.length-h-p,y=o.slice(h,o.length-p).join(""),b=[];if(g>0||y){const v=h+g;a>v?b.push({left:a-v}):a<v&&b.push({right:v-a}),a=v,g>0&&(b.push({backspace:g}),a=h),y&&(b.push({insert:y}),a+=th(y).length)}return a>d?b.push({left:a-d}):a<d&&b.push({right:d-a}),a=d,{ops:b,cursor:a}}function B5(e){const t=e.value,n=e.selectionStart??t.length;return th(t.slice(0,n)).length}const xh=16,fR=10,P5=1.5,pR=1.8,Q5=240,mR=125,gR=92;function xR(e,t,n){const r=Math.hypot(e,t),s=Math.abs(e),o=Math.abs(t),a=()=>s>=o*P5?e>0?"right":"left":o>=s*P5?t>0?"down":"up":"";if(n==="")return r>xh?a():"";if(r<fR)return"";if(r<=xh)return n;const d=a();if(d===""||d===n)return n;if(n==="left"&&d==="right"||n==="right"&&d==="left"||n==="up"&&d==="down"||n==="down"&&d==="up")return d;const p=n==="left"||n==="right";return(p?o:s)>=(p?s:o)*pR?d:n}function yR(e){const t=gR-xh,n=Math.min(Math.max((e-xh)/t,0),1);return Q5-n*(Q5-mR)}const bR="termdock-open-terminal-directory",O5=/(?:\\[ \t]|[^\s`"'<>|()[\]{}=,:;!?])+/gu,vR=/[,;:!?]+$/u,wR=/^[a-z][a-z\d+.-]*:\/\//iu;function AR(e){return!e||e==="/"||wR.test(e)||e.startsWith("//")?!1:e.startsWith("/")||e.startsWith("~/")||e.startsWith("./")||e.startsWith("../")?!0:e.endsWith("/")||/^[^/:]+\/[^/:]+\/(?:[^/:]+\/?)+$/u.test(e)}function TR(e){const t=[];O5.lastIndex=0;let n;for(;(n=O5.exec(e))!==null;){const s=n[0].replace(vR,"");AR(s)&&t.push({text:s,startIndex:n.index,endIndex:n.index+s.length})}return t}function xp(e){const t=[];for(const n of e.split("/"))!n||n==="."||(n===".."?t.pop():t.push(n));return`/${t.join("/")}`}function SR(e){return e.match(/^\/(?:home|Users)\/[^/]+/u)?.[0]??null}function CR(e,t){const n=e.replace(/\\([ \t])/gu,"$1").replace(/\/+$/u,"")||"/";if(n.startsWith("/"))return xp(n);if(n==="~"||n.startsWith("~/")){const r=t?SR(t):null;return r?xp(`${r}/${n.slice(2)}`):null}return t?.startsWith("/")?xp(`${t}/${n}`):null}function _R(e,t){const n=e.buffer.active;let r=t-1;if(!n.getLine(r))return null;for(;r>0&&n.getLine(r)?.isWrapped;)r-=1;let s=t-1;for(;s+1<n.length&&n.getLine(s+1)?.isWrapped;)s+=1;let o="";const a=[],d=[];for(let p=r;p<=s&&o.length<=2048;p+=1){const g=n.getLine(p);if(!g)break;for(let y=0;y<g.length;y+=1){const b=g.getCell(y);if(!b||b.getWidth()===0)continue;const v=b.getChars()||" ";o+=v;for(let T=0;T<v.length;T+=1)a.push({x:y+1,y:p+1}),d.push({x:y+Math.max(1,b.getWidth()),y:p+1})}}const h=o.trimEnd().length;return{text:o.slice(0,h),startPositions:a.slice(0,h),endPositions:d.slice(0,h)}}function LR(e,t){return{provideLinks(n,r){const s=_R(e,n);if(!s){r(void 0);return}const o=TR(s.text).map(a=>({text:a.text,range:{start:s.startPositions[a.startIndex]??{x:a.startIndex+1,y:n},end:s.endPositions[a.endIndex-1]??{x:a.endIndex,y:n}},activate:()=>t(a.text)}));r(o.length>0?o:void 0)}}}function F5(e,t){if(!e||e.lines.length===0||!Number.isFinite(t)||t<=0)return 0;const n=Math.floor(t),r=Number.isFinite(e.lines.maxLength)&&e.lines.maxLength>0?Math.floor(e.lines.maxLength):null;let s=0;if(r!==null){const h=Math.max(0,r-n);e.ybase>h&&(e.ybase=h,Number.isFinite(e.ydisp)&&(e.ydisp=Math.min(e.ydisp,h)),s++)}let o=Math.max(0,Math.floor(e.ybase)+n),a=r===null?o:Math.min(o,r),d=Math.max(0,a-e.lines.length);if(d>n){const h=Math.max(0,e.lines.length-n);e.ybase>h&&(e.ybase=h,Number.isFinite(e.ydisp)&&(e.ydisp=Math.min(e.ydisp,h)),s++),o=Math.max(0,Math.floor(e.ybase)+n),a=r===null?o:Math.min(o,r),d=Math.max(0,a-e.lines.length)}for(let h=0;h<d;h++){const p=e.lines.length;if(e.lines.push(e.getBlankLine(void 0)),e.lines.length<=p)break;s++}return s}function j5(e,t=e.rows){const r=e._core?._bufferService?.buffers;return r?F5(r.normal,t)+F5(r.alt,t):0}function Ld(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:0}function kR(e,t,n){const r=Ld(e.fontBoundingBoxAscent)+Ld(e.fontBoundingBoxDescent),s=Ld(e.actualBoundingBoxAscent)+Ld(e.actualBoundingBoxDescent);return Math.max(1,Math.floor(Math.ceil(r||s||t)*n))}const Kl=8,kd=36,$5=10,ER=1.08,IR=1.16,Ed=6,RR=.94,MR=.08,NR=.12,DR=88,BR=36,PR=10,QR=14,OR=52;function Xu(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 FR=80,jR=8,U5={F1:"\x1BOP",F2:"\x1BOQ",F3:"\x1BOR",F4:"\x1BOS",F5:"\x1B[15~",F6:"\x1B[17~",F7:"\x1B[18~",F8:"\x1B[19~",F9:"\x1B[20~",F10:"\x1B[21~",F11:"\x1B[23~",F12:"\x1B[24~"};function Pl(e,t){return e.modes?.applicationCursorKeysMode===!0?`\x1BO${t}`:`\x1B[${t}`}function $R(e,t){switch(e.key){case"ArrowUp":return Pl(t,"A");case"ArrowDown":return Pl(t,"B");case"ArrowRight":return Pl(t,"C");case"ArrowLeft":return Pl(t,"D");case"Home":return"\x1B[H";case"End":return"\x1B[F";case"PageUp":return"\x1B[5~";case"PageDown":return"\x1B[6~";case"Insert":return"\x1B[2~";case"Delete":return"\x1B[3~";case"Tab":return" ";case"Escape":return"\x1B";default:return U5[e.key]?U5[e.key]:null}}function UR(e){return e.nativeEvent.isComposing||e.isComposing===!0||e.keyCode===229}function HR(e){try{const t=atob(e),n=Uint8Array.from(t,r=>r.charCodeAt(0));return new TextDecoder("utf-8").decode(n)}catch{return null}}function zR(e){const t="\x1B]52;";let n=0,r="";for(;n<e.length;){const s=e.indexOf(t,n);if(s===-1)return r+=e.slice(n),{cleaned:r,remainder:""};r+=e.slice(n,s);let o=-1,a=1;for(let p=s+t.length;p<e.length;p+=1){const g=e.charCodeAt(p);if(g===7){o=p,a=1;break}if(g===27&&p+1<e.length&&e[p+1]==="\\"){o=p,a=2;break}}if(o===-1)return{cleaned:r,remainder:e.slice(s)};const d=e.slice(s+t.length,o),h=d.indexOf(";");if(h>=0){const p=d.slice(h+1);if(p&&p!=="?"){const g=HR(p);g!==null&&navigator.clipboard?.writeText(g).catch(()=>{})}}n=o+a}return{cleaned:r,remainder:""}}function GR(e){if(typeof window>"u")return null;const t=[e,...Array.from(e.querySelectorAll("*"))];let n=null;for(const r of t){const o=window.getComputedStyle(r).overflowY;if(!(o!=="auto"&&o!=="scroll")){if(r.scrollHeight-r.clientHeight>2)return r;n||(n=r)}}return n}const WR=new Set(["visibility","bfcache","online"]),VR=5e5,qR=1e5,Ju=260,e0=140,H5=80;function YR(e){return!e}let jc=null;const ZR=[{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:"⏺⏸⏹✓✗"}],KR=()=>{if(jc)return jc;if(typeof document>"u"||!("fonts"in document))return jc=Promise.resolve(),jc;const e=document.fonts;return jc=Promise.allSettled(ZR.map(({font:n,text:r})=>e.load(n,r))).then(()=>e.ready).then(()=>{}).catch(()=>{}),jc},z5=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 G5(e){return e==="normal"||e==="bold"?e:Math.max(1,Math.min(1e3,Math.round(e)))}function Xl(e,t,n){const r=e?.dimensions?.css.cell.height;return Math.max(8,Math.round(r||t*n))}function XR(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 W5=new Map;function JR(e,t,n,r,s){if(typeof window>"u"||typeof document>"u")return null;const o=e.getBoundingClientRect();if(o.width<24||o.height<24)return null;const a=window.devicePixelRatio||1,d=`${n}::${r}::${s}::${a}::${t}`;let h=W5.get(d);if(!h)try{const b=document.createElement("canvas").getContext("2d");if(!b)return null;b.font=`${n}px ${t}`;const v=b.measureText("M"),A=(Math.floor(v.width*a)+Math.round(r))/a,L=kR(v,n,s);A>=1&&L>=1&&(h={cellWidth:A,cellHeight:L},W5.set(d,h))}catch{return null}if(!h)return null;const p=Math.max(2,Math.floor(o.width/h.cellWidth)),g=Math.max(2,Math.floor(o.height/h.cellHeight));return!Number.isFinite(p)||!Number.isFinite(g)?null:{cols:p,rows:g}}async function V5(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 n=document.execCommand("copy");return t.remove(),n}catch{return!1}}}function eM(e){const t=e.buffer.active,n=t.viewportY,r=Math.min(t.length,n+e.rows),s=[];for(let o=n;o<r;o+=1){const a=t.getLine(o);a&&s.push(a.translateToString(!0))}return s.join(`
|
|
68
|
-
`).replace(/\s+$/g,"")}function t0(e,t,n){const r=lc(e);if(!r)return null;const s=Math.max(0,Math.min(e.cols-1,Math.floor((t-r.originLeft)/r.cellW))),o=Math.max(0,Math.min(e.rows-1,Math.floor((n-r.originTop)/r.cellH)));return{col:s,row:e.buffer.active.viewportY+o}}function yp(e,t,n){const r=t.row*e.cols+t.col,s=n.row*e.cols+n.col;if(r===s)return e.clearSelection(),!1;const o=Math.min(r,s),a=Math.max(r,s)+1,d=o%e.cols,h=Math.floor(o/e.cols);return e.select(d,h,a-o),!0}function q5(e){if(typeof document>"u")return 0;const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e)||"0");return Number.isFinite(t)?t:0}function tM(e,t,n,r,s=!0){if(typeof window>"u")return{left:0,top:0};const o=window.visualViewport,a=o?.offsetLeft??0,d=o?.offsetTop??0,h=o?.width??window.innerWidth,p=o?.height??window.innerHeight,g=q5("--safe-top-inset"),y=q5("--safe-bottom-inset"),b=r?SI(r.terminal,r.anchor,r.focus):null,v=[];let T;if(s&&v.push({left:e-32,top:t-32,right:e+32,bottom:t+32}),r){const L=lc(r.terminal),{start:R,end:D}=gh(r.anchor,r.focus,r.terminal.cols),B=eh(r.terminal,R),j=eh(r.terminal,D);if(B&&v.push({left:B.x-24,top:B.y-48,right:B.x+24,bottom:B.y+4}),j&&L){const P=j.y+L.cellH;v.push({left:j.x-24,top:P-4,right:j.x+24,bottom:P+48})}if(b){const P=r.anchor.row*r.terminal.cols+r.anchor.col,$=r.focus.row*r.terminal.cols+r.focus.col,z=P<=$,H=b.right-b.left,q=r.anchor.row===r.focus.row?z?b.left+H*.25:b.right-H*.25:(b.left+b.right)/2,te=eh(r.terminal,r.focus),ve=te&&L?te.y+L.cellH/2:t;T={vertical:r.focus.row<r.anchor.row?"below":"above",alignX:q,focusX:te?.x??e,focusY:ve}}}const A=CI({clientX:e,clientY:t,viewport:{left:a,top:d+g,right:a+h,bottom:d+p-y},terminal:n,width:DR,height:BR,margin:PR,fingerGap:QR,selection:b,avoid:v,preference:T,selectionGap:OR});return{left:A.left-n.left,top:A.top-n.top}}const rv=_.forwardRef(({sessionKey:e,isLayoutVisible:t=!0,chunks:n,onInput:r,onResize:s,onFlowControl:o,onTmuxScroll:a,tmuxScrollSensitivity:d=.55,onDoubleTap:h,onInputFocusChange:p,onMobileLongPressCopyResult:g,onMobilePasteResult:y,onReadyChange:b,onSizeSynchronizedChange:v,onWritesSettled:T,onWriteProgress:A,onCursorPositionChange:L,onDirectoryLinkActivate:R,terminalSettings:D,theme:B,className:j,enableTouchScroll:P,mobileLongPressMode:$="arrows",autoFocus:z=!0,cursorVisible:H=!0,suppressSmoothScroll:ye=!1},q)=>{const{t:te}=qn(),ve=_.useRef(null),ge=_.useRef(null),ie=_.useRef(null),Ae=_.useRef(null),xe=_.useRef(null),ce=_.useRef(ye);ce.current=ye;const K=_.useRef(null),be=_.useRef(r),Se=_.useRef(s),We=_.useRef(p),ue=_.useRef(o),Ee=_.useRef(b);Ee.current=b;const Tt=_.useRef(v);Tt.current=v;const Rt=_.useRef(T);Rt.current=T;const ze=_.useRef(A);ze.current=A;const X=_.useRef(L);X.current=L;const rt=_.useRef(R);rt.current=R;const qe=_.useRef(D.rendererMode),re=_.useRef(""),J=_.useRef(0),$e=_.useRef(!1),tt=_.useRef(null),gt=_.useRef(0),pt=_.useRef(0),Ct=_.useRef(!1),Le=_.useRef(null),Te=_.useRef(null),Oe=_.useRef(()=>{}),yt=_.useRef(null),de=_.useRef(null),Pe=_.useRef(void 0),ot=_.useRef(null),zt=_.useRef(!1),yn=_.useRef(0),at=_.useRef(""),bt=_.useRef(null),It=_.useRef(null),kt=_.useRef(!1),$t=_.useRef(typeof window<"u"?window.devicePixelRatio:1),se=_.useRef(!1),Fe=_.useRef(!1),Je=_.useRef(null),Ot=_.useRef(""),je=_.useRef(0),ut=_.useRef(null),un=_.useRef(null),Be=_.useRef(null),hr=_.useRef(0),jn=_.useRef(0),Ne=_.useRef(0),Pn=_.useRef(null),dt=_.useRef(0),fr=_.useRef(0),In=_.useRef(!1),Sr=_.useRef(0),[,fn]=_.useReducer(I=>I+1,0),[Qn,Br]=_.useReducer(I=>I+1,0),[Rn,On]=_.useState("loading"),[pe,tn]=_.useState(null),Ue=_.useMemo(()=>mc("terminal"),[]),[as,_s]=_.useState(!0),[$r,Ls]=_.useState(!1);_.useEffect(()=>{if(!as&&Rn!=="loading"){Ls(!1);return}const I=window.setTimeout(()=>Ls(!0),160);return()=>window.clearTimeout(I)},[as,Rn]);const[ko,Jr]=_.useState(!1),[Ir,rr]=_.useState({visible:!1,activeDir:""}),[sr,ri]=_.useState(null),nr=_.useRef(null),Yn=_.useRef(!1),dn=_.useRef({active:!1,anchor:null,focus:null,dragging:null}),[Sn,an]=_.useState(null),[bn,Pr]=_.useState({x:0,y:0,cellW:8,cellH:17,cursorX:0}),Ht=_.useRef(bn);Ht.current=bn;const Cr=_.useRef(null),[ln,Ur]=_.useState({active:!1,text:""}),Os=_.useRef(null),ls=_.useRef(null);be.current=r,Se.current=s,We.current=p,ue.current=o,qe.current=D.rendererMode;const yr=_.useRef(z);yr.current=z;const ks=_.useRef(H);ks.current=H;const $n=_.useRef(P);$n.current=P;const cs=_.useRef(t);cs.current=t;const uo=YR(!!a),{rendererMode:es,fontFamily:Y,fontSize:he,fontWeight:Ke,fontWeightBold:_e,letterSpacing:Ie,lineHeight:Ge,minimumContrastRatio:lt,drawBoldTextInBrightColors:et,unicodeVersion:Ze,customGlyphs:it,rescaleOverlappingGlyphs:pn,fontLigatures:vt,enableImages:mn,smoothScrolling:ct}=D,Pt=es==="webgl",Xt=_.useCallback(()=>{nr.current!==null&&(clearTimeout(nr.current),nr.current=null),ri(null)},[]),hn=_.useCallback((I,O)=>{nr.current!==null&&(clearTimeout(nr.current),nr.current=null),Yn.current=!1,ri(I),!O?.persistent&&(nr.current=setTimeout(()=>{nr.current=null,ri(null)},3e3))},[]);_.useEffect(()=>{if(!sr)return;const I=()=>{dn.current.active||Xt()},O=()=>Xt();return window.addEventListener("scroll",I,!0),window.addEventListener("resize",O),document.addEventListener("visibilitychange",O),()=>{window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",O),document.removeEventListener("visibilitychange",O)}},[Xt,sr]),_.useEffect(()=>()=>{nr.current!==null&&(clearTimeout(nr.current),nr.current=null)},[]);const Tn=_.useCallback(()=>{const I=ie.current,O=ve.current,F=dn.current;if(!I||!O||!F.active||!F.anchor||!F.focus){an(null);return}const V=O.getBoundingClientRect(),Me=lc(I)?.cellH??16,{start:Ce,end:Xe}=gh(F.anchor,F.focus,I.cols),Ye=F.dragging==="start"?F.focus:F.dragging==="end"?F.anchor:Ce,ft=F.dragging==="end"?F.focus:F.dragging==="start"?F.anchor:Xe,cn=(er,cr)=>{const pr=eh(I,er);return pr?{left:pr.x-V.left,top:cr?pr.y-V.top:pr.y+Me-V.top}:null};an({start:cn(Ye,!0),end:cn(ft,!1)})},[]),br=_.useCallback(I=>{const O=ie.current,F=ve.current,V=dn.current;if(!O||!F||!V.active||!V.anchor||!V.focus)return;if(V.dragging){Xt();return}const Me=F.getBoundingClientRect(),Ce={x:(Me.left+Me.right)/2,y:(Me.top+Me.bottom)/2};hn(tM(I?.x??Ce.x,I?.y??Ce.y,Me,{terminal:O,anchor:V.anchor,focus:V.focus},I!==void 0),{persistent:!0})},[Xt,hn]),vr=_.useCallback(()=>{const I=dn.current;I.active=!1,I.anchor=null,I.focus=null,I.dragging=null,an(null),Xt()},[Xt]);_.useEffect(()=>{if(!Sn)return;const I=ie.current;if(!I)return;const O=I.onScroll(()=>{Tn(),br()}),F=I.onResize(()=>vr());return()=>{O.dispose(),F.dispose()}},[Sn,Tn,br,vr]),_.useEffect(()=>{P||We.current?.(!1)},[P]);const us=_.useCallback((I,O,F)=>{const V=(F.element?.offsetWidth||0)/F.cols||8,Me=(F.element?.offsetHeight||0)/F.rows||16,Ce=Math.max(1,Math.min(F.cols,Math.floor(I/V)+1)),Xe=Math.max(1,Math.min(F.rows,Math.floor(O/Me)+1));return{x:Ce,y:Xe}},[]),Fs=_.useCallback((I,O,F)=>{const V=ie.current;if(!V)return!1;const Me=I>0?-1:1;if(V.modes?.mouseTrackingMode!=="none"){let Ce,Xe;if(O!==void 0&&F!==void 0){const cn=us(O,F,V);Ce=cn.x,Xe=cn.y}else Ce=V.buffer.active.cursorX+1,Xe=V.buffer.active.cursorY+1;const ft=`\x1B[<${Me>0?64:65};${Ce};${Xe}M`;return be.current(ft),!0}if(V.buffer.active.type==="alternate"){const Ce=Me>0?"\x1B[A":"\x1B[B";return be.current(Ce),!0}return null},[us]),Es=_.useCallback(I=>{const O=ie.current;if(!O)return!1;const F=Xl(ie.current,he,Ge),V=yn.current+I,Me=Math.trunc(V/F);return yn.current=V-Me*F,Me!==0?(O.scrollLines(Me),!0):!1},[he,Ge]),js=_.useCallback(I=>{if(!ie.current)return!1;const V=Xl(ie.current,he,Ge)/Math.max(.1,d),Me=yn.current+I;let Ce=Math.trunc(Me/V);if(yn.current=Me-Ce*V,Ce===0&&Math.abs(Me)>=V/3&&(Ce=Me>0?1:-1,yn.current=0),Ce===0)return!1;const Xe=Ce>0?"down":"up",Ye=Math.max(1,Math.min(Math.abs(Ce),10));return a(Xe,Ye),!0},[he,Ge,a,d]),$s=_.useRef(Fs);$s.current=Fs;const Ki=_.useRef(Es);Ki.current=Es;const Rr=_.useRef(js);Rr.current=js;const Nn=_.useRef(a);Nn.current=a;const Dn=_.useRef({pointerId:null,tmuxActiveAtDown:!1});_.useEffect(()=>{if(!P)return;const I=ve.current;if(!I)return;const O=V=>{V.pointerType==="touch"&&(Dn.current.pointerId=V.pointerId,Dn.current.tmuxActiveAtDown=!!Nn.current)},F=V=>{V.pointerType==="touch"&&Dn.current.pointerId===V.pointerId&&(Dn.current.pointerId=null,Dn.current.tmuxActiveAtDown=!1)};return I.addEventListener("pointerdown",O,{capture:!0,passive:!0}),I.addEventListener("pointerup",F,{capture:!0,passive:!0}),I.addEventListener("pointercancel",F,{capture:!0,passive:!0}),()=>{I.removeEventListener("pointerdown",O,!0),I.removeEventListener("pointerup",F,!0),I.removeEventListener("pointercancel",F,!0)}},[P]);const Wr=_.useCallback(()=>{if(In.current)return!1;const I=Dn.current;return I.pointerId!==null?!I.tmuxActiveAtDown:!Nn.current},[]),ts=_.useCallback((I,O,F)=>{const V=$s.current(I,O,F);return V!==null?V:Nn.current?Rr.current(I):Ki.current(I)},[]),U=_.useCallback((I,O)=>{if(performance.now()<=fr.current){fr.current=0;return}const F=ie.current;if(F&&F.modes?.mouseTrackingMode!=="none"){const V=us(I,O,F),Me=V.x,Ce=V.y,Xe=`\x1B[<0;${Me};${Ce}M`,Ye=`\x1B[<0;${Me};${Ce}m`;be.current(Xe),be.current(Ye)}},[us]),ee=_.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),fe=_.useCallback((I=700)=>{Pn.current=null,dt.current=ee()+I},[ee]),ke=_.useCallback(()=>$n.current&&ee()<=dt.current,[ee]),ht=_.useCallback(()=>{const I=de.current;return!I||typeof document>"u"?!1:document.activeElement===I},[]),nt=_.useCallback(()=>{if(typeof window>"u")return!1;const I=Ye=>{if(typeof document>"u")return 0;const ft=Number.parseFloat(document.documentElement.style.getPropertyValue(Ye)||"0");return Number.isFinite(ft)?ft:0},O=I("--kb-height");if(O>0)return O>=H5;const F=window.visualViewport;if(!F)return!1;const V=I("--app-base-vh")||window.innerHeight,Me=I("--safe-bottom-inset"),Ce=F.height+F.offsetTop;return Math.max(0,Math.round(V-Ce-Me))>=H5},[]),Bt=_.useCallback(()=>{ut.current!==null&&(clearTimeout(ut.current),ut.current=null),un.current=null},[]),_t=_.useCallback(I=>{const O=ie.current;let F="";for(const V of I)V.left&&(F+=(O?Pl(O,"D"):"\x1B[D").repeat(V.left)),V.right&&(F+=(O?Pl(O,"C"):"\x1B[C").repeat(V.right)),V.backspace&&(F+="".repeat(V.backspace)),V.insert&&(F+=V.insert);return F},[]),Nt=_.useCallback(I=>{const O=I.value,F=Xu(O),V=Ot.current;if(!($n.current&&!F.includes("\r")&&!V.includes("\r"))){if(F===V)return;let cn=0;for(;cn<V.length&&cn<F.length&&V[cn]===F[cn];)cn++;const er=V.length-cn;er>0&&be.current("".repeat(er));const cr=F.slice(cn);if(cr){try{ie.current?.clearSelection()}catch{}be.current(cr)}Ot.current=F,je.current=Array.from(F).length;return}const Ce=B5(I),{ops:Xe,cursor:Ye}=hR(V,F,je.current,Ce),ft=_t(Xe);if(ft){if(Xe.some(cn=>cn.insert))try{ie.current?.clearSelection()}catch{}be.current(ft)}Ot.current=F,je.current=Ye},[_t]),Fn=_.useCallback((I,O)=>{const F=I.value,V=Xu(F),Me=Ot.current;if(V===Me){Bt();return}let Ce=0;for(;Ce<Me.length&&Ce<V.length&&Me[Ce]===V[Ce];)Ce++;const Xe=Me.length-Ce;if(P&&!O?.immediate&&Xe>=jR){un.current=I,ut.current!==null&&clearTimeout(ut.current),ut.current=setTimeout(()=>{ut.current=null;const ft=un.current;un.current=null,ft&&Nt(ft)},FR);return}Bt(),Nt(I)},[Bt,P,Nt]),Cn=_.useCallback(I=>{Fn(I,{immediate:!0}),be.current("\r"),I.value="",Ot.current="",je.current=0},[Fn]),nn=_.useCallback((I,O,F)=>{if(!I)return;Bt();const V=O??de.current;V&&(V.value=""),Ot.current="",je.current=0;try{ie.current?.clearSelection()}catch{}if(vr(),F?.paste&&/[\r\n]/.test(I)){const Me=F.submitAfterPaste??I.endsWith("\r"),Ce=EI(I,Me);be.current(Ce,{skipModifierTransform:!0,consumeModifier:F?.consumeModifier});return}be.current(I,{skipModifierTransform:!0,consumeModifier:F?.consumeModifier})},[Bt]),_n=_.useCallback((I,O)=>{const F=Xu(I);return F?(nn(F,O,{paste:!0,submitAfterPaste:!1}),Xt(),!0):!1},[Xt,nn]);_.useEffect(()=>IS(I=>{if(I.sessionKey!==e||I.paths.length===0)return;const O=I.paths.map(E2).join(" ");nn(O);try{de.current?.focus({preventScroll:!0})}catch{}}),[nn,e]);const ir=_.useCallback(async I=>{try{const O=Qs();if(O?.pasteClipboardImage){const V=await O.pasteClipboardImage();if(V)return nn(E2(V),I),Xt(),!0}if(!navigator.clipboard?.readText)return!1;const F=await navigator.clipboard.readText();return _n(F,I)}catch{return!1}},[Xt,_n,nn]),_r=_.useCallback(I=>{if(Cr.current&&!I?.repositionFrozen)return null;const O=ie.current;if(!O||!O.element)return null;const F=lc(O),Me=O.element.querySelector(".xterm-screen")??O.element,Ce=Me.getBoundingClientRect(),Xe=F?.cellW??(Ce.width>0&&O.cols>0?Ce.width/O.cols:8),Ye=F?.cellH??(Ce.height>0&&O.rows>0?Ce.height/O.rows:17),ft=de.current;let cn=Pe.current;ft&&(cn===void 0||cn!==null&&(!cn.isConnected||!cn.contains(ft)))&&(cn=LI(ft),Pe.current=cn);const er=O.buffer.active,cr=er.cursorX*Xe,pr=er.cursorY*Ye,Jt=kI(Me,cn??null,cr,pr),Ln=Math.round(Jt.x),ps=Math.round(Jt.y),zr={x:Ln,y:ps,cellW:Xe,cellH:Ye,cursorX:er.cursorX};return Ht.current=zr,Cr.current&&I?.repositionFrozen&&(Cr.current={...zr}),Pr(Bi=>Math.abs(Bi.x-Ln)<.5&&Math.abs(Bi.y-ps)<.5&&Math.abs(Bi.cellW-Xe)<.5&&Math.abs(Bi.cellH-Ye)<.5&&Bi.cursorX===er.cursorX?Bi:zr),zr},[]),Un=_.useRef(_r);Un.current=_r,_.useEffect(()=>{if(!P)return;let I=null,O=null;const F=()=>{I!==null&&window.cancelAnimationFrame(I),O!==null&&window.cancelAnimationFrame(O),I=window.requestAnimationFrame(()=>{I=null,O=window.requestAnimationFrame(()=>{O=null,Un.current({repositionFrozen:!0})})})};return window.visualViewport?.addEventListener("resize",F),window.visualViewport?.addEventListener("scroll",F),document.addEventListener("termdock:viewport-keyboard-change",F),()=>{I!==null&&window.cancelAnimationFrame(I),O!==null&&window.cancelAnimationFrame(O),window.visualViewport?.removeEventListener("resize",F),window.visualViewport?.removeEventListener("scroll",F),document.removeEventListener("termdock:viewport-keyboard-change",F)}},[P]);const sn=_.useCallback(I=>{let O=0;for(const F of I){const V=F.codePointAt(0)??0,Me=V>=4352&&V<=4447||V>=11904&&V<=12350||V>=12353&&V<=13311||V>=13312&&V<=19903||V>=19968&&V<=40959||V>=40960&&V<=42191||V>=44032&&V<=55203||V>=63744&&V<=64255||V>=65072&&V<=65103||V>=65280&&V<=65376||V>=65504&&V<=65510||V>=127744&&V<=129791;O+=Me?2:1}return O},[]),Ut=_.useCallback(I=>{const O=ie.current,{cellW:F,cellH:V}=bn;if(!O||!I)return{width:Math.max(1,Math.round(F)),height:Math.max(1,Math.round(V)),whiteSpace:"pre"};const Ce=Cr.current?.cursorX??O.buffer.active.cursorX,Xe=Math.max(1,O.cols),Ye=Math.max(1,sn(I)),ft=Math.max(1,Xe-Ce);if(Ye<=ft)return{width:Math.max(1,Math.round(Ye*F)),height:Math.max(1,Math.round(V)),whiteSpace:"pre"};const cn=Ye-ft,cr=1+Math.ceil(cn/Xe);return{width:Math.max(1,Math.round(ft*F)),height:Math.max(1,Math.round(cr*V)),whiteSpace:"pre-wrap"}},[bn,sn]),qt=_.useCallback(()=>{Pe.current=void 0;const I=Un.current();Cr.current={...I??Ht.current}},[]),vn=_.useCallback(()=>{Cr.current=null},[]),Yt=_.useCallback(I=>{if(!se.current&&Cr.current===null)return!1;if(se.current=!1,Cr.current=null,Bt(),Je.current!==null&&(clearTimeout(Je.current),Je.current=null),Fe.current=!1,I){I.value=Ot.current;try{I.setSelectionRange(I.value.length,I.value.length)}catch{}}return Ur(O=>O.active||O.text?{active:!1,text:""}:O),!0},[Bt]),on=_.useCallback((I,O)=>{const F=de.current;if(F)try{F.removeAttribute("readonly");const Me=typeof document<"u"&&document.activeElement===F&&!nt(),Ce=ee(),Xe=Ce-Sr.current;Sr.current=Ce,Me&&Xe>600?(F.blur(),F.removeAttribute("readonly"),F.focus(),Sr.current=ee()):F.focus()}catch{}},[nt,ee]),or=_.useCallback(I=>{jn.current=ee()+I},[ee]),Us=_.useCallback(()=>P?ee()<=jn.current:!1,[P,ee]),Hr=_.useCallback(I=>{or(I),Ne.current=ee()},[or,ee]),ar=_.useCallback(()=>{P&&de.current?.removeAttribute("readonly")},[P]),Gn=_.useCallback(I=>I instanceof HTMLElement&&(I.closest('[data-terminal-copy-popover="true"]')!==null||I.closest('[data-mobile-copy-button="true"]')!==null||I.closest("[data-selection-handle]")!==null),[]),Xi=_.useCallback(I=>{if(ar(),Hr(Ju),!P||I.pointerType!=="touch"){Pn.current=null;return}const O=I.target;if(Gn(O)){fe();return}sr&&!(O instanceof HTMLElement&&O.closest('[data-terminal-copy-popover="true"]'))&&Xt(),Pn.current={pointerId:I.pointerId,startX:I.clientX,startY:I.clientY,moved:!1}},[Xt,P,Hr,Gn,sr,ar,fe]),Eo=_.useCallback(I=>{Hr(Ju);const O=Pn.current;!O||O.pointerId!==I.pointerId||Math.hypot(I.clientX-O.startX,I.clientY-O.startY)>12&&(O.moved=!0)},[Hr]),Hs=_.useCallback(I=>{Hr(e0);const O=Pn.current;Pn.current=null,!(!P||I.pointerType!=="touch")&&(!O||O.pointerId!==I.pointerId||O.moved||ke()||on(I.clientX,I.clientY))},[P,Hr,on,ke]),ds=_.useCallback(()=>{Pn.current=null,Hr(e0)},[Hr]),yi=_.useMemo(()=>({enableKinetic:!0}),[]),Zn=_.useRef(()=>!1),Ei=_.useRef(on);Ei.current=on;const Is=_.useCallback((I,O)=>{ke()||Ei.current(I,O)},[ke]),Xo=_.useRef(h);Xo.current=h;const Ji=_.useRef(g);Ji.current=g;const ho=_.useRef(y);ho.current=y;const xa=_.useCallback(()=>{if(Yn.current)return;Yn.current=!0,fe();const I=ie.current,O=I?.hasSelection()?I.getSelection():"";try{I?.clearSelection()}catch{}ga.flushSync(()=>{vr()}),(async()=>{const F=await V5(O);Ji.current?.(F)})()},[vr,fe]),Jo=_.useCallback(I=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:I}}))},[]),{setupTouchScroll:Io,stopAllScroll:ii}=eR(ve,{...yi,shouldCaptureTouch:Zn.current,canStartScrollGesture:Wr,onScroll:ts,onScrollWithCoords:ts,onClickWithCoords:U,onTap:Is,onClaimChange:Jo,tapThreshold:12,gestureName:`normal-scroll:${e}`});_.useEffect(()=>{if(!P)return;de.current?.setAttribute("readonly","");const I=Io();return()=>{I()}},[P,Io]),_.useEffect(()=>{if(!P)return;let I=nt();const O=()=>{const F=nt();if(I&&!F){const V=de.current;V&&typeof document<"u"&&document.activeElement===V&&(V.setAttribute("readonly",""),V.blur())}I=F};return window.visualViewport?.addEventListener("resize",O),window.visualViewport?.addEventListener("scroll",O),document.addEventListener("termdock:viewport-keyboard-change",O),()=>{window.visualViewport?.removeEventListener("resize",O),window.visualViewport?.removeEventListener("scroll",O),document.removeEventListener("termdock:viewport-keyboard-change",O)}},[P,nt]),_.useEffect(()=>{if(!P)return;const I=ve.current;if(!I)return;const O=V=>{const Ce=V.sourceCapabilities?.firesTouchEvents===!0,Xe=ee()-Ne.current<=1200;return!Ce&&!Xe?!1:I.contains(V.target)},F=V=>{O(V)&&(V.cancelable&&V.preventDefault(),V.stopImmediatePropagation(),V.stopPropagation())};return I.addEventListener("mousedown",F,{capture:!0,passive:!1}),I.addEventListener("mouseup",F,{capture:!0,passive:!1}),I.addEventListener("click",F,{capture:!0,passive:!1}),document.addEventListener("mouseup",F,{capture:!0,passive:!1}),()=>{I.removeEventListener("mousedown",F,!0),I.removeEventListener("mouseup",F,!0),I.removeEventListener("click",F,!0),document.removeEventListener("mouseup",F,!0)}},[P,ee]);const bi=_.useRef({pointerId:null,lastX:null,lastY:null,startX:null,startY:null,gestureAxis:null,remainder:0,didScroll:!1,rafId:null,velocity:0,instantSpeed:0}),Vr=_.useCallback(()=>{const I=bi.current;I.rafId!==null&&(cancelAnimationFrame(I.rafId),I.rafId=null)},[]),cl=_.useCallback((I,O,F)=>{const V=ie.current;if(!V||!V.element||!V.cols||!V.rows)return null;const Me=bi.current,Ce=V.element.getBoundingClientRect(),Xe=O??Me.lastX??Ce.left+Ce.width/2,Ye=F??Me.lastY??Ce.top+Ce.height/2,ft=Xe-Ce.left,cn=Ye-Ce.top,er=V.element.offsetWidth/V.cols||8,cr=V.element.offsetHeight/V.rows||16,pr=Math.max(1,Math.min(V.cols,Math.floor(ft/er)+1)),Jt=Math.max(1,Math.min(V.rows,Math.floor(cn/cr)+1));return`\x1B[<${I==="up"?64:65};${pr};${Jt}M`},[]),hs=_.useCallback((I,O,F,V)=>{if(O<=0)return;const Me=cl(I,F,V);Me&&be.current(O===1?Me:Me.repeat(O))},[cl]),ya=_.useRef(hs);ya.current=hs;const Ii=_.useRef(()=>{}),ul=_.useCallback(()=>{const O=Xl(ie.current,he,Ge)/Math.max(.1,d),F=1+bi.current.instantSpeed*.1;return O/Math.min(6,F)},[he,Ge,d]),eo=_.useCallback(()=>{const I=bi.current;I.rafId=null;const O=ul();let F=0,V=0;for(;F+V<Ed&&I.remainder>=O;)I.remainder-=O,V++;for(;F+V<Ed&&I.remainder<=-O;)I.remainder+=O,F++;if(V>0&&hs("down",V),F>0&&hs("up",F),F+V>0)I.rafId=requestAnimationFrame(eo);else if(I.pointerId!==null&&Math.abs(I.remainder)>=O/3){const Ce=I.remainder>0?"down":"up";I.remainder=0,hs(Ce,1),I.rafId=requestAnimationFrame(eo)}},[ul,hs]),Ro=_.useCallback(()=>{const I=bi.current;I.rafId===null&&typeof requestAnimationFrame<"u"&&(I.rafId=requestAnimationFrame(eo))},[eo]),dl=_.useCallback(I=>{if(I.pointerType!=="touch")return!1;Vr();const O=bi.current;return O.pointerId=I.pointerId,O.lastX=I.clientX,O.lastY=I.clientY,O.startX=I.clientX,O.startY=I.clientY,O.gestureAxis=null,O.remainder=0,O.velocity=0,O.instantSpeed=0,O.didScroll=!1,!1},[Vr]),fo=_.useCallback((I,O)=>{if(In.current)return O?"release":"neutral";if(performance.now()<=fr.current)return"neutral";const F=bi.current;if(I.pointerType!=="touch"||I.pointerId!==F.pointerId||F.lastY==null)return"neutral";if(F.gestureAxis===null&&F.startX!==null&&F.startY!==null){const Ce=Math.abs(I.clientX-F.startX),Xe=Math.abs(I.clientY-F.startY);if(Ce>$5||Xe>$5){if(Ce>Xe*ER)return F.gestureAxis="x","release";Xe>Ce*IR&&(F.gestureAxis="y")}}if(F.gestureAxis==="x")return F.lastX=I.clientX,F.lastY=I.clientY,"release";if(F.gestureAxis===null)return F.lastX=I.clientX,F.lastY=I.clientY,"neutral";const V=I.clientY-F.lastY;F.lastX=I.clientX,F.lastY=I.clientY;const Me=-V;if(F.remainder+=Me,F.instantSpeed=Math.abs(Me),F.velocity=F.velocity*.45+Me*.55,O){const Xe=Xl(ie.current,he,Ge)/Math.max(.1,d);Math.abs(F.remainder)>=Xe/3&&(F.didScroll=!0,Ro())}return"claim"},[he,Ge,d,Ro]),$a=_.useCallback(I=>{const O=bi.current;if(I.pointerType!=="touch"||I.pointerId!==O.pointerId)return;if(Vr(),O.pointerId=null,O.lastX=null,O.lastY=null,O.startX=null,O.startY=null,O.instantSpeed=0,O.gestureAxis==="x"){O.gestureAxis=null;return}O.gestureAxis=null;const V=Xl(ie.current,he,Ge)/Math.max(.1,d);if(O.didScroll&&Math.abs(O.velocity)>V*MR){const Me=()=>{O.velocity*=RR,O.remainder+=O.velocity;const Ce=1+Math.abs(O.velocity)*.1,Xe=V/Math.min(6,Ce);if(Math.abs(O.velocity)<V*NR){if(Math.abs(O.remainder)>=Xe/3){const cn=O.remainder>0?"down":"up";hs(cn,1),O.remainder=0}O.velocity=0,O.rafId=null;return}let Ye=0,ft=0;for(;Ye+ft<Ed&&O.remainder>=Xe;)O.remainder-=Xe,ft++;for(;Ye+ft<Ed&&O.remainder<=-Xe;)O.remainder+=Xe,Ye++;ft>0&&hs("down",ft),Ye>0&&hs("up",Ye),O.rafId=requestAnimationFrame(Me)};O.rafId=requestAnimationFrame(Me)}else Math.abs(O.remainder)>=V/3&&Ro();O.didScroll&&I.stopImmediatePropagation()},[Vr,hs,Ro,d,he,Ge]),hl=_.useCallback(I=>{const O=bi.current;I.pointerType!=="touch"||I.pointerId!==O.pointerId||(Vr(),O.pointerId=null,O.lastX=null,O.lastY=null,O.startX=null,O.startY=null,O.gestureAxis=null,O.remainder=0,O.velocity=0,O.didScroll=!1)},[Vr]);R5({name:`tmux-scroll:${e}`,priority:XI,container:()=>ve.current,onPointerDown:P&&a?dl:void 0,onPointerMove:P&&a?fo:void 0,onPointerUp:P&&a?$a:void 0,onPointerCancel:P&&a?hl:void 0});const Rs=_.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}),ba=_.useRef(null);ba.current=ve.current;const va=ba,Mo=be,po=_.useRef($);po.current=$;const Mr=_.useCallback(I=>{const O=Rs.current;O.gestureLocked!==I&&(O.gestureLocked=I,Jo(I))},[Jo]),vi=_.useCallback(()=>{const I=Rs.current;I.edgeScrollTimer!==null&&(clearInterval(I.edgeScrollTimer),I.edgeScrollTimer=null),I.edgeScrollDir=0},[]),Ms=_.useCallback(I=>{const O=ie.current,F=Rs.current;if(O){if(F.mode==="copy"&&F.copyStart){F.copyDidSelect=yp(O,F.copyStart,I)||F.copyDidSelect;return}if(F.mode==="adjust"){const V=dn.current;if(!V.active||!V.anchor)return;V.focus=TI(O,I),yp(O,V.anchor,V.focus),Tn()}}},[Tn]),Ua=_.useCallback((I,O)=>{const F=ie.current,V=Rs.current;if(!F)return;const Me=lc(F);if(!Me)return;const Ce=Me.originTop,Xe=Me.originTop+F.rows*Me.cellH,Ye=Math.max(28,Me.cellH*1.5),ft=O-Ce,cn=Xe-O;let er=0,cr=0;if(ft<Ye?(er=-1,cr=Math.min(1,(Ye-ft)/Ye)):cn<Ye&&(er=1,cr=Math.min(1,(Ye-cn)/Ye)),V.edgeClientX=I,V.edgeClientY=O,er===0){vi();return}V.edgeScrollDir=er,V.edgeScrollLines=1+Math.round(cr*5),V.edgeScrollTimer===null&&(V.edgeScrollTimer=setInterval(()=>{const pr=ie.current,Jt=Rs.current;if(!pr||Jt.edgeScrollDir===0)return;if(Jt.mode!=="copy"&&Jt.mode!=="adjust"){vi();return}pr.scrollLines(Jt.edgeScrollDir*Jt.edgeScrollLines);const Ln=t0(pr,Jt.edgeClientX,Jt.edgeClientY-kd);Ln&&Ms(Ln)},60))},[Ms,vi]),No=_.useCallback(I=>{if(I.pointerType!=="touch")return!1;const O=va.current;if(!O)return!1;const F=I.target;if(!(F instanceof HTMLElement)||!O.contains(F)||F.closest('[data-mobile-keyboard="true"]'))return!1;const V=Rs.current;V.longPressMode=po.current;const Me=dn.current;if(Me.active&&V.pointerId===null){const Ce=F.closest("[data-selection-handle]");if(Ce instanceof HTMLElement){const Xe=ie.current,Ye=Ce.dataset.selectionHandle==="start"?"start":"end";if(Xe&&Me.anchor&&Me.focus){const ft=gh(Me.anchor,Me.focus,Xe.cols);return Me.anchor=Ye==="start"?ft.end:ft.start,Me.focus=Ye==="start"?ft.start:ft.end,Me.dragging=Ye,Xt(),V.pointerId=I.pointerId,V.tapStartX=I.clientX,V.tapStartY=I.clientY,V.tapDidMove=!1,V.mode="adjust",In.current=!0,fe(1800),de.current?.setAttribute("readonly",""),ii(),Vr(),da(Kl),Mr(!0),!0}}if(!F.closest("[data-terminal-copy-popover]")){vr();try{ie.current?.clearSelection()}catch{}}}if(V.pointerId!==null)return!0;if(In.current=!1,Xo.current){const Ce=performance.now(),Xe=I.clientX,Ye=I.clientY;if(V.lastTapTime!==0&&Ce-V.lastTapTime<=300&&Math.hypot(Xe-V.lastTapX,Ye-V.lastTapY)<=25)return da(Kl),fr.current=performance.now()+500,Xo.current?.(),Jr(!0),ls.current&&clearTimeout(ls.current),ls.current=setTimeout(()=>Jr(!1),400),V.lastTapTime=0,!0}return V.holdTimer!==null&&(clearTimeout(V.holdTimer),V.holdTimer=null),V.joystickRepeatTimer!==null&&(clearTimeout(V.joystickRepeatTimer),V.joystickRepeatTimer=null),V.joystickDir="",V.copyStart=null,V.copyDidSelect=!1,V.pointerId=I.pointerId,V.originX=I.clientX,V.originY=I.clientY,V.tapStartX=I.clientX,V.tapStartY=I.clientY,V.tapDidMove=!1,V.mode="holding",V.longPressMode==="copy"&&Mr(!0),V.holdTimer=setTimeout(()=>{if(V.holdTimer=null,V.mode==="holding"){if(V.longPressMode==="copy"){const Ce=ie.current,Xe=Ce?t0(Ce,V.tapStartX,V.tapStartY):null;if(!Ce||!Xe){V.mode="idle";return}V.mode="copy",In.current=!0,fe(1800),de.current?.setAttribute("readonly",""),V.copyStart=Xe,V.copyDidSelect=!1,ii(),Vr(),Ce.clearSelection(),da(Kl),Mr(!0);return}V.mode="arrow",In.current=!0,fe(1e3),ii(),Vr(),da(Kl),Mr(!0),requestAnimationFrame(()=>{rr({visible:!0,activeDir:""})})}},350),!0},[Mr,Xt,vr]),Ri=_.useCallback((I,O)=>{if(I.pointerType!=="touch")return"neutral";const F=Rs.current;if(F.mode==="arrow"&&I.pointerId!==F.pointerId||F.mode==="copy"&&I.pointerId!==F.pointerId||F.mode!=="arrow"&&F.mode!=="copy"&&I.pointerId!==F.pointerId)return"neutral";const V=I.clientX-F.tapStartX,Me=I.clientY-F.tapStartY;if(Math.hypot(V,Me)>10&&(F.tapDidMove=!0),F.mode==="holding"){if(!O)return F.holdTimer!==null&&(clearTimeout(F.holdTimer),F.holdTimer=null),Mr(!1),In.current=!1,F.mode="idle","neutral";const Ce=I.clientX-F.originX,Xe=I.clientY-F.originY;return F.longPressMode==="copy"&&Math.hypot(Ce,Xe)>20?(F.holdTimer!==null&&(clearTimeout(F.holdTimer),F.holdTimer=null),Mr(!1),In.current=!1,F.mode="idle","release"):Math.hypot(Ce,Xe)>20?(F.holdTimer!==null&&(clearTimeout(F.holdTimer),F.holdTimer=null),Mr(!1),F.mode="idle","release"):"claim"}if(F.mode==="adjust"){if(!O)return"claim";ii();const Ce=ie.current,Xe=dn.current;if(!Ce||!Xe.active||!Xe.anchor||!Xe.focus)return"claim";const Ye=t0(Ce,I.clientX,I.clientY-kd);return Ye&&(Ms(Ye),Ua(I.clientX,I.clientY)),"claim"}if(F.mode==="copy"){if(!O)return"claim";ii();const Ce=ie.current;if(!Ce||!F.copyStart)return"claim";const Xe=t0(Ce,I.clientX,I.clientY-kd);return Xe&&(Ms(Xe),Ua(I.clientX,I.clientY)),"claim"}if(F.mode==="arrow"){if(!O)return"claim";const Ce={up:"\x1B[A",down:"\x1B[B",left:"\x1B[D",right:"\x1B[C"},Xe=I.clientX-F.tapStartX,Ye=I.clientY-F.tapStartY,ft=xR(Xe,Ye,F.joystickDir);if(ft&&ft!==F.joystickDir&&(F.originX=I.clientX,F.originY=I.clientY),ft){const cn=I.clientX-F.originX,er=I.clientY-F.originY,cr=Math.hypot(cn,er);if(F.repeatIntervalMs=yR(cr),ft!==F.joystickDir){F.joystickRepeatTimer!==null&&clearTimeout(F.joystickRepeatTimer);const pr=F.joystickDir==="";F.joystickDir=ft,Mo.current(Ce[ft]);const Jt=performance.now();Jt-F.lastHapticTime>120&&(da(Kl),F.lastHapticTime=Jt);const Ln=pr?400:300;F.joystickRepeatTimer=setTimeout(function ps(){if(F.joystickDir!==ft)return;Mo.current(Ce[ft]);const zr=performance.now();zr-F.lastHapticTime>120&&(da(Kl),F.lastHapticTime=zr),F.joystickRepeatTimer=setTimeout(ps,F.repeatIntervalMs)},Ln)}rr({visible:!0,activeDir:ft})}else F.joystickRepeatTimer!==null&&(clearTimeout(F.joystickRepeatTimer),F.joystickRepeatTimer=null),F.joystickDir="",rr({visible:!0,activeDir:""});return"claim"}return"neutral"},[Mr,Ms,Ua]),fl=_.useCallback(I=>{if(I.pointerType!=="touch"||I.pointerId!==Rs.current.pointerId)return;const O=Rs.current;if(O.mode==="copy"){ii(),Vr(),vi(),Mr(!1);const V=ie.current;let Me=null;if(V&&O.copyStart&&(Me=t0(V,I.clientX,I.clientY-kd),Me&&(O.copyDidSelect=yp(V,O.copyStart,Me)||O.copyDidSelect)),V&&O.copyDidSelect&&V.hasSelection()&&O.copyStart){const Ce=dn.current;Ce.active=!0,Ce.anchor=O.copyStart,Ce.focus=Me??O.copyStart,Ce.dragging=null,Tn(),br({x:I.clientX,y:I.clientY}),fe(1800),da(Kl)}else Ji.current?.(!1);O.holdTimer!==null&&(clearTimeout(O.holdTimer),O.holdTimer=null),O.copyStart=null,O.copyDidSelect=!1,O.pointerId=null,O.mode="idle",In.current=!1;return}if(O.mode==="adjust"){ii(),Vr(),vi(),Mr(!1),dn.current.dragging=null,Tn(),br({x:I.clientX,y:I.clientY}),fe(1800),O.pointerId=null,O.mode="idle",In.current=!1;return}if(O.mode==="arrow"){ii(),Vr(),Mr(!1),rr({visible:!1,activeDir:""}),O.holdTimer!==null&&(clearTimeout(O.holdTimer),O.holdTimer=null),O.joystickRepeatTimer!==null&&(clearTimeout(O.joystickRepeatTimer),O.joystickRepeatTimer=null),O.joystickDir="",O.pointerId=null,O.mode="idle",In.current=!1;return}const F=va.current;if(F&&!O.tapDidMove){const V=I.target;V instanceof HTMLElement&&F.contains(V)&&!V.closest('[data-mobile-keyboard="true"]')&&(O.lastTapTime=performance.now(),O.lastTapX=I.clientX,O.lastTapY=I.clientY)}else O.tapDidMove&&(O.lastTapTime=0);O.holdTimer!==null&&(clearTimeout(O.holdTimer),O.holdTimer=null),O.joystickRepeatTimer!==null&&(clearTimeout(O.joystickRepeatTimer),O.joystickRepeatTimer=null),O.joystickDir="",Mr(!1),In.current=!1,O.copyStart=null,O.copyDidSelect=!1,O.pointerId=null,O.mode="idle"},[Mr,ii,fe,vi,Tn,br]),pl=_.useCallback(()=>{const I=Rs.current;Mr(!1),vi(),I.mode==="arrow"&&rr({visible:!1,activeDir:""}),I.mode==="adjust"&&(dn.current.dragging=null,Tn(),br()),I.holdTimer!==null&&(clearTimeout(I.holdTimer),I.holdTimer=null),I.joystickRepeatTimer!==null&&(clearTimeout(I.joystickRepeatTimer),I.joystickRepeatTimer=null),I.joystickDir="",In.current=!1,I.copyStart=null,I.copyDidSelect=!1,I.pointerId=null,I.tapDidMove=!1,I.mode="idle"},[Mr,vi,Tn,br]);R5({name:`long-press:${e}`,priority:KI,container:()=>ve.current,onPointerDown:P?No:void 0,onPointerMove:P?Ri:void 0,onPointerUp:P?fl:void 0,onPointerCancel:P?pl:void 0});const fs=_.useCallback((I={})=>{pt.current+=1,re.current="",Te.current=null,J.current=0,$e.current&&($e.current=!1,I.notifyFlowResume===!0&&ue.current?.(!1)),tt.current=null,Ct.current=!1,Le.current=null,at.current=""},[]),oi=_.useCallback((I="unknown")=>{const O=K.current,F=ie.current,V=ve.current;if(!O||!F||!V||!F.element||!F.cols||!F.rows)return;const Me=V.getBoundingClientRect();if(Me.width<24||Me.height<24){Ue("skip fit: container too small",{reason:I,width:Math.round(Me.width),height:Math.round(Me.height)});return}try{const Ce={cols:F.cols,rows:F.rows},Xe=F.buffer.active,Ye=BI(Xe.type,Xe.baseY,Xe.viewportY),ft=O.proposeDimensions();if(!ft||ft.cols<=0||ft.rows<=0)return;const cn=j5(F,Ce.rows),er=MI({reason:I,currentCols:Ce.cols,currentRows:Ce.rows,proposedCols:ft.cols,proposedRows:ft.rows});let cr=0;er.accept&&(oe.current&&Nn.current&&(Ce.cols!==ft.cols||Ce.rows!==ft.rows)&&xe.current?.begin(),F.resize(ft.cols,ft.rows),cr=j5(F,ft.rows),Ye&&F.scrollToBottom(),yn.current=0),(cn>0||cr>0)&&(F.refresh(0,Math.max(0,F.rows-1)),Ue("xterm buffer invariant repaired",{reason:I,before:cn,after:cr,cols:F.cols,rows:F.rows}));const pr={cols:F.cols,rows:F.rows};Ue("fit",{reason:I,backend:"xterm",width:Math.round(Me.width),height:Math.round(Me.height),before:Ce,proposed:ft,next:pr,hysteresis:er,changed:Ce.cols!==pr.cols||Ce.rows!==pr.rows})}catch{xe.current?.cancel()}},[Ue]),wi=_.useCallback(I=>{const O=ie.current;if(O)try{O.refresh(0,Math.max(0,O.rows-1)),Ue("terminal refreshed (sync)",{reason:I,cols:O.cols,rows:O.rows,hasWebgl:!!bt.current})}catch(F){Ue("terminal refresh (sync) failed",{reason:I,error:F})}},[Ue]),to=_.useCallback(I=>{const O=It.current;if(O){try{O.dispose()}catch{}It.current=null}const F=bt.current;if(!F)return!1;xe.current?.cancel();try{F.dispose()}catch{}return bt.current=null,Ue("renderer disposed",{type:"webgl",reason:I}),!0},[Ue]),qr=_.useCallback((I,O)=>{if(bt.current)return!0;try{const F=new Ik({customGlyphs:it});return It.current=F.onContextLoss(()=>{Ue("webgl context loss",{reason:"onContextLoss"}),kt.current=!0,typeof window<"u"&&window.setTimeout(()=>{Jn("webgl-context-loss",{forceRendererRecreate:!0})},0)}),xe.current?.cancel(),I.loadAddon(F),bt.current=F,kt.current=!1,Ue("renderer",{type:"webgl",reason:O,mobile:P,mode:qe.current}),wi(`webgl-enabled:${O}`),oi(`webgl-enabled:${O}`),Di.current=!0,!0}catch(F){return Ue("webgl load failed, fallback to dom renderer",{reason:O,error:F,mobile:P,mode:qe.current}),!1}},[Ue,it,P,oi,wi]),vs=200,Mi=_.useRef(0),zs=_.useRef(new Map),Yr=_.useRef(new Map),Lr=_.useRef(gp()),Ni=_.useRef(null),ai=_.useRef(null),mo=_.useRef(-1),Ai=_.useRef(new Map),Di=_.useRef(!1),oe=_.useRef(!1),De=_.useCallback(()=>{const I=zs.current;I.forEach(O=>cancelAnimationFrame(O)),I.clear(),Yr.current.clear()},[]),Ve=_.useCallback(()=>{Ni.current!==null&&(window.clearTimeout(Ni.current),Ni.current=null)},[]),mt=_.useRef(()=>{}),Re=_.useCallback(I=>{Ve(),Tt.current?.(!1),Se.current(I.cols,I.rows,I.seq),Ni.current=window.setTimeout(()=>{Ni.current=null;const O=E5(Lr.current,I.seq);Lr.current=O.state,O.request&&oe.current?(Ue("resize ack timeout; retrying",{seq:I.seq,retrySeq:O.request.seq,cols:O.request.cols,rows:O.request.rows}),mt.current(O.request)):O.exhausted&&(xe.current?.cancel(),Ue("resize ack timeout; leaving size unconfirmed",{seq:I.seq,cols:I.cols,rows:I.rows}))},1200)},[Ve,Ue]);mt.current=Re;const At=_.useCallback((I,O)=>{if(!oe.current)return;const F=jI(Lr.current,{cols:I,rows:O});Lr.current=F.state,F.request&&Re(F.request)},[Re]),gn=1500,Mn=400,Wn=_.useRef(0),wn=_.useRef(0),Qr=_.useCallback((I,O,F)=>{if(!Number.isFinite(I)||!Number.isFinite(O)||I<=0||O<=0)return;const V=Math.floor(I),Me=Math.floor(O);Lr.current=HI(Lr.current,{cols:V,rows:Me}),Wn.current=Date.now(),Ue("pty-size broadcast received",{cols:V,rows:Me,source:F??"unknown"})},[Ue]),lr=_.useCallback(I=>{const O=ie.current;if(!O||!O.cols||!O.rows||!oe.current||typeof document<"u"&&document.visibilityState!=="visible")return;const F=Date.now();if(F-Wn.current<gn||F-wn.current<Mn)return;const V=O.cols,Me=O.rows,Ce=Lr.current.confirmed;Ce&&Ce.cols===V&&Ce.rows===Me||(wn.current=F,Ue("ensureSizeMatches push",{reason:I,cols:V,rows:Me,lastServerSize:Ce}),At(V,Me))},[Ue,At]),Zr=_.useCallback((I,O)=>{const F=ie.current,V=K.current;if(!F||!V)return;if(!Di.current){Ue("refresh skipped: renderer not ready",{reason:I});return}if(O.dedupeKey!==void 0){if(Ai.current.get(I)===O.dedupeKey){Ue("refresh deduped",{reason:I,dedupeKey:O.dedupeKey});return}Ai.current.set(I,O.dedupeKey)}Ue("refresh",{reason:I,options:O});const Me=O.forceRendererRecreate===!0||kt.current||Pt&&!!bt.current&&WR.has(I)&&/Android/i.test(navigator.userAgent);let Ce=!1;Me&&(kt.current=!1,Pt?(to(`refresh:${I}`),qr(F,`refresh:${I}`)||wi(`refresh:${I}:webgl-fallback`),Ce=!0):(wi(`refresh:${I}`),Ce=!0)),QI(O.forceRedraw===!0,I==="dpr-change",Ce)?wi(`refresh:${I}`):Ce||Ue("terminal redraw skipped: fit/write already repaints",{reason:I});const Xe={cols:F.cols,rows:F.rows};oi(`refresh:${I}`);const Ye={cols:F.cols,rows:F.rows};if(O.skipResizePush||NI({before:Xe,after:Ye,lastServerSize:Lr.current.confirmed,reconcileServerSize:O.reconcileServerSize})&&At(Ye.cols,Ye.rows),!O.skipScrollToBottom&&I!=="resize"&&I!=="dpr-change"){const cn=requestAnimationFrame(()=>{const pr=ie.current;if(pr&&pr.buffer.active.type!=="alternate")try{pr.scrollToBottom()}catch{}}),er=zs.current,cr=er.get(I);cr!==void 0&&cancelAnimationFrame(cr),er.set(I,cn)}},[Ue,Pt,to,qr,wi,oi,At]),Jn=_.useCallback((I,O={})=>{if(ie.current,I==="session-key-change"&&(Lr.current=gp(),Ve(),Ai.current.clear(),De()),!O.force&&(I==="visibility"||I==="bfcache"||I==="online")){const V=Date.now();if(V-Mi.current<vs){Ue("refresh throttled",{reason:I});return}Mi.current=V}if(Yr.current.set(I,O),zs.current.has(I))return;const F=requestAnimationFrame(()=>{const V=Yr.current.get(I)??{};zs.current.delete(I),Yr.current.delete(I),Zr(I,V)});zs.current.set(I,F)},[Ue,De,Ve,Zr]),wa=_.useCallback(I=>{const O=zs.current.get(I);if(O===void 0)return;const F=Yr.current.get(I)??{};cancelAnimationFrame(O),zs.current.delete(I),Yr.current.delete(I),Zr(I,F)},[Zr]);Ii.current=()=>wa("resize"),_.useEffect(()=>()=>{De(),ot.current!==null&&(window.clearTimeout(ot.current),ot.current=null)},[e,De]),_.useEffect(()=>{Lr.current=gp(),Ve(),Ai.current.clear()},[e,Ve]);const Nr=_.useCallback(()=>{if(Ct.current)return;const I=ie.current;if(!I){fs();return}if(!re.current)return;const O=re.current,F=O.length,V=Te.current;re.current="",Te.current=null,Ct.current=!0;const Me=xe.current,Ce=Me?.generation;I.write(O,()=>{if(Ce!==void 0&&Me?.written(Ce),Ct.current=!1,J.current-=F,J.current<0&&(J.current=0),V!==null&&ze.current?.(V),$e.current&&J.current<qR&&($e.current=!1,ue.current?.(!1)),re.current){Nr();return}const Xe=++pt.current,Ye=()=>{if(Xe!==pt.current||Ct.current||re.current)return;const ft=I.buffer.active;Rt.current?.({x:ft.cursorX,y:ft.cursorY,rows:I.rows,lastProcessedChunkId:Le.current})};typeof window>"u"?Ye():window.requestAnimationFrame(()=>{window.requestAnimationFrame(Ye)})})},[fs]);Oe.current=Nr;const Gs=_.useCallback(()=>{if(tt.current!==null)return;const I=++gt.current;tt.current=I,queueMicrotask(()=>{tt.current===I&&(tt.current=null,Nr())})},[Nr]),$l=_.useCallback((I,O)=>{I&&(pt.current+=1,re.current+=I,Te.current=O,J.current+=I.length,!$e.current&&J.current>=VR&&($e.current=!0,ue.current?.(!0)),Gs())},[Gs]);return _.useEffect(()=>{let I=!1,O=null,F=null,V=[];const Me=ve.current;return Me?(Me.tabIndex=P?-1:0,(async()=>{if(Ee.current?.(!1),On("loading"),tn(null),_s(!0),await KR(),!I)try{const Xe=JR(Me,z5(Y),he,Ie,Ge),Ye=new B8({...Xe?{cols:Xe.cols,rows:Xe.rows}:{},allowProposedApi:!0,fontFamily:z5(Y),fontSize:he,fontWeight:G5(Ke),fontWeightBold:G5(_e),theme:XR(B),logLevel:"off",cursorBlink:!Pt,cursorStyle:"block",cursorInactiveStyle:ks.current?"bar":"none",scrollback:a?2e3:5e3,scrollbar:{showScrollbar:!1},allowTransparency:OI(es,mn),convertEol:uo,drawBoldTextInBrightColors:et,rescaleOverlappingGlyphs:pn,minimumContrastRatio:lt,letterSpacing:Ie,lineHeight:Ge,smoothScrollDuration:ct&&!ce.current?125:0,scrollOnEraseInDisplay:!0,tabStopWidth:8,vtExtensions:{kittyKeyboard:!0},windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0}}),ft=new P8;Ye.loadAddon(ft),Ye.loadAddon(new Pk),Ye.registerLinkProvider(LR(Ye,Jt=>{rt.current?.(Jt)}));const cn=new Hk;Ye.loadAddon(cn),Ye.unicode.activeVersion=Ze,Ye.loadAddon(new Kk({highlightLimit:1e3}));const er=new nE;Ye.loadAddon(er),Ae.current=er,Ye.loadAddon(new AI);try{Ye.loadAddon(new sE(void 0,new U3))}catch(Jt){Ue("clipboard addon skipped",{error:Jt})}O=Ye,ie.current=Ye,K.current=ft,$t.current=typeof window<"u"?window.devicePixelRatio:1,Ye.open(Me),xe.current=FI(Ye),vt&&Ye.loadAddon(new wI({fontFeatureSettings:VI,fallbackLigatures:qI}));try{const Jt=Ye._core;Jt?.coreService&&(Jt.coreService.isCursorInitialized=!0),Ye.refresh(0,Ye.rows-1)}catch{}if(Pt?(qr(Ye,"init"),Di.current=!0):(Ue("renderer",{type:"dom",reason:"renderer-mode-dom-fallback",mobile:P,mode:es}),Di.current=!0),_s(!1),Br(),P){const Jt=Ln=>{if(Ln.ctrlKey||Ln.metaKey){Ln.preventDefault();const ps=Ln.deltaY>0?-1:1,zr=Math.max(8,Math.min(32,he+ps));zr!==he&&Me.dispatchEvent(new CustomEvent("termfontchange",{detail:zr}))}};Be.current=Jt,Me.addEventListener("wheel",Jt,{passive:!1})}if(!P){let Jt=0,Ln=null,ps=null,zr=null;const Bi=()=>{zr=null,Ii.current();const Kr=Xl(ie.current,he,Ge),ml=hr.current+Jt;Jt=0;const ws=Math.trunc(ml/Kr);if(hr.current=ml-ws*Kr,ws!==0){const Ws=ws>0?"down":"up",Aa=ie.current,wc=Math.max(3,Math.floor((Aa?.rows??24)/2)),Ti=Math.abs(ws);Ti>wc&&(hr.current=0),ya.current(Ws,Math.min(Ti,wc),Ln??void 0,ps??void 0)}};Ye.attachCustomWheelEventHandler(Kr=>{if(Kr.ctrlKey||Kr.metaKey||Kr.shiftKey)return!0;if(Kr.deltaY===0)return!1;if(!ie.current||!Nn.current)return!0;const ws=Xl(ie.current,he,Ge);let Ws=Kr.deltaY;return Kr.deltaMode===1?Ws=Kr.deltaY*ws:Kr.deltaMode===2&&(Ws=Kr.deltaY*(Me.clientHeight||ws*20)),Jt+=Ws,Ln=Kr.clientX,ps=Kr.clientY,zr===null&&(zr=requestAnimationFrame(Bi)),Kr.preventDefault(),!1})}const cr=GR(Me);if(cr?(cr.classList.add("overlay-scrollbar-target","overlay-scrollbar-container"),ge.current=cr,fn()):ge.current=null,Jn("mount",{skipResizePush:!0,skipScrollToBottom:!0}),yr.current&&(P?Ye.focus():de.current?.focus({preventScroll:!0})),P||Un.current(),V.push(Ye.onRender(()=>{const Jt=Ye.buffer.active;X.current?.({x:Jt.cursorX,y:Jt.cursorY,rows:Ye.rows}),P||Un.current()})),!P){try{const Jt=Ye.textarea;if(Jt){Jt.tabIndex=-1,Jt.setAttribute("aria-hidden","true"),Jt.setAttribute("readonly",""),Jt.value="";const Ln=()=>{de.current?.focus({preventScroll:!0})};Jt.addEventListener("focus",Ln),V.push({dispose:()=>Jt.removeEventListener("focus",Ln)})}}catch{}try{V.push(Ye.onCursorMove(()=>Un.current())),V.push(Ye.onResize(()=>Un.current()))}catch{}}V.push(Ye.onData(Jt=>{be.current(Jt)}));const pr=Jt=>{const Ln=typeof window<"u"?window.devicePixelRatio:1,ps=Math.abs(Ln-$t.current)>.001;return ps&&($t.current=Ln,Ue("device pixel ratio changed",{value:Ln,source:Jt})),ps};if(F=new ResizeObserver(Jt=>{if(!DI($n.current,cs.current)){Ue("resize observer skipped: hidden mobile session");return}Pe.current=void 0;const Ln=Jt[0];Ln&&Ue("resize observer",{width:Math.round(Ln.contentRect.width),height:Math.round(Ln.contentRect.height)});const ps=pr("resize-observer");Jn(ps?"dpr-change":"resize")}),F.observe(Me),typeof window<"u"){const Jt=()=>{pr("window-resize")&&Jn("dpr-change")};window.addEventListener("resize",Jt),V.push({dispose:()=>window.removeEventListener("resize",Jt)});const Ln=window.visualViewport;if(Ln){const ps=()=>{pr("visual-viewport-resize")&&Jn("dpr-change")};Ln.addEventListener("resize",ps),V.push({dispose:()=>Ln.removeEventListener("resize",ps)})}}oi("init-fit"),On("ready"),Ee.current?.(!0)}catch(Xe){console.error("Failed to initialize terminal:",Xe),_s(!1),On("error"),tn(Xe instanceof Error?Xe.message:"Failed to load terminal")}})(),()=>{Ee.current?.(!1),I=!0,We.current?.(!1),yt.current?.(),yt.current=null,se.current=!1,Je.current!==null&&(clearTimeout(Je.current),Je.current=null),Fe.current=!1,Cr.current=null,Bt(),Ur({active:!1,text:""});for(const Xe of V)Xe.dispose();F?.disconnect(),Be.current&&(Me.removeEventListener("wheel",Be.current),Be.current=null),xe.current?.dispose(),xe.current=null,to("component-unmount"),O?.dispose(),ie.current=null,K.current=null,ge.current=null,fs({notifyFlowResume:!0}),Ve()}):void 0},[oi,Y,he,Ke,_e,Ie,Ge,lt,et,Ze,it,pn,vt,mn,ct,B,fs,Bt,P,qr,to,Ue,Ve]),_.useEffect(()=>{const I=ie.current;I&&(I.options.smoothScrollDuration=ct&&!ye?125:0)},[ct,ye,Qn]),_.useEffect(()=>{const I=ie.current;I&&(I.options.cursorInactiveStyle=H?"bar":"none",H||I.blur())},[H,Qn]),_.useEffect(()=>{const I=ie.current;if(I){if(Pt){if(I.options.cursorBlink=!1,qr(I,"renderer-mode-change")&&mn&&!zt.current)try{I.loadAddon(new BE({storageLimit:64,pixelLimit:1<<24,sixelSupport:!0,iipSupport:!0,kittySupport:!0})),zt.current=!0}catch(F){Ue("image addon skipped",{error:F})}return}I.options.cursorBlink=!0,to("renderer-mode-change")&&(wi("renderer-mode-change:webgl-disabled"),oi("renderer-mode-change:webgl-disabled"))}},[Pt,mn,qr,to,wi,oi,Ue]),_.useEffect(()=>{const I=ie.current;I&&(Le.current!==null&&I.reset(),fs(),Ot.current="",je.current=0,de.current&&(de.current.value=""),Jn("session-reset",{skipScrollToBottom:!0}),yr.current&&($n.current?I.focus():de.current?.focus({preventScroll:!0})))},[e,Qn,Jn,fs]),_.useEffect(()=>{if(!P||typeof document>"u")return;let I=null;const O=()=>{I=null;const V=de.current;if(!V||document.activeElement!==V||se.current)return;const Me=Ot.current,Ce=Xu(V.value);if(Ce!==Me||Ce.includes("\r")||!nt())return;const Xe=Math.min(B5(V),Array.from(Ce).length),Ye=Xe-je.current;if(Ye===0)return;const ft=ie.current,cn=Ye<0?(ft?Pl(ft,"D"):"\x1B[D").repeat(-Ye):(ft?Pl(ft,"C"):"\x1B[C").repeat(Ye);be.current(cn),je.current=Xe},F=()=>{I===null&&(I=requestAnimationFrame(O))};return document.addEventListener("selectionchange",F),()=>{document.removeEventListener("selectionchange",F),I!==null&&cancelAnimationFrame(I)}},[P,nt]),_.useEffect(()=>{if(!P)return;const I=Io();return yt.current=I,()=>{I(),yt.current=null}},[P,Io]),_.useEffect(()=>{const I=ie.current;if(I)try{I.options.scrollback=a?0:1e3}catch{}},[a,Qn]),_.useEffect(()=>{const I=ie.current;if(!I)return;if(n.length===0){Le.current!==null&&(I.reset(),fs(),Jn("buffer-reset",{skipResizePush:!0,skipScrollToBottom:!0}));return}const O=Le.current;let F;if(O===null)F=n;else{const V=n.findIndex(Me=>Me.id===O);F=V>=0?n.slice(V+1):n}if(F.length>0){const V=F.map(Ye=>Ye.data).join(""),Me=at.current+V,{cleaned:Ce,remainder:Xe}=zR(Me);at.current=Xe,Ce?$l(Ce,F[F.length-1].id):ze.current?.(F[F.length-1].id)}Le.current=n[n.length-1].id},[n,Qn,$l,Jn,fs]),_.useImperativeHandle(q,()=>({serializeSnapshot:()=>ie.current?Ae.current?.serialize({scrollback:100})??null:null,focus:()=>{if($n.current){on();return}de.current?.focus({preventScroll:!0})},blur:()=>{const I=de.current;Yt(I),I&&typeof document<"u"&&document.activeElement===I&&I.blur(),$n.current&&I?.setAttribute("readonly",""),We.current?.(!1)},clear:()=>{const I=ie.current;I&&(I.reset(),fs(),Jn("clear",{skipResizePush:!0,skipScrollToBottom:!0}))},prepareScreenReplacement:()=>{fs({notifyFlowResume:!0})},copySelectionOrViewport:async()=>{const I=ie.current;if(!I)return!1;const O=I.hasSelection()?I.getSelection():eM(I),F=await V5(O);return F&&I.hasSelection()&&Xt(),F},pasteClipboardText:async()=>{fe();const I=await ir(de.current);return ho.current?.(I),I},sendSequence:(I,O)=>{nn(I,null,O)},getDimensions:()=>{const I=ie.current;return!I||!I.cols||!I.rows?null:{cols:I.cols,rows:I.rows}},requestRefresh:Jn,setSessionReady:I=>{oe.current=I,I||(xe.current?.cancel(),Ve(),Lr.current=zI(Lr.current),ai.current=null,mo.current=-1,Tt.current?.(!1))},acknowledgeResize:I=>{if(!I.ok&&typeof I.seq=="number"){const Ce=E5(Lr.current,I.seq);if(!Ce.request&&!Ce.exhausted)return;Ve(),Lr.current=Ce.state,Ce.request&&oe.current?mt.current(Ce.request):Ce.exhausted&&xe.current?.cancel();return}const O=UI(Lr.current,I);if(!O.accepted)return;Ve(),Lr.current=O.state,Ue("resize acknowledged",{seq:I.seq,ok:I.ok,cols:I.cols,rows:I.rows,screenSyncPending:I.screenSyncPending===!0,screenSyncGeneration:I.screenSyncGeneration});const F=ie.current,V=O.state.confirmed;if(!!!(F&&V&&F.cols===V.cols&&F.rows===V.rows)){Tt.current?.(!1);return}if(I.screenSyncPending&&typeof I.screenSyncGeneration=="number"){ai.current=I.screenSyncGeneration;const Ce=mo.current>=I.screenSyncGeneration;Tt.current?.(Ce),Ce&&(ai.current=null);return}ai.current=null,Tt.current?.(!0)},notifyScreenSynchronized:I=>{if(!Number.isFinite(I))return;mo.current=Math.max(mo.current,I);const O=ai.current;if(O===null||I<O)return;ai.current=null;const F=ie.current,V=Lr.current.confirmed;Tt.current?.(!!(F&&V&&F.cols===V.cols&&F.rows===V.rows))},notifyServerSize:Qr,ensureSizeMatches:lr,requestPtyRedraw:()=>{const I=ie.current;if(!I||!oe.current||Lr.current.pending||ai.current!==null)return;const O=$I(Lr.current,{cols:I.cols,rows:I.rows});Lr.current=O.state,mt.current(O.request)}}),[P,Yt,on,fs,ir,nn,Jn,Ve,Ue,At,Qr,lr]),u.jsxs("div",{ref:ve,"data-termdock-terminal-dropzone":e,className:`relative h-full w-full terminal-viewport-container ${j||""}`,style:{backgroundColor:B.background,touchAction:Ir.visible?"none":void 0},role:"button",tabIndex:-1,onPointerDownCapture:Xi,onPointerMoveCapture:Eo,onPointerUpCapture:Hs,onPointerCancelCapture:ds,onTouchStartCapture:I=>{if(Gn(I.target)){fe(),Hr(Ju);return}ar(),Hr(Ju)},onTouchMoveCapture:()=>Hr(Ju),onTouchEndCapture:()=>Hr(e0),onTouchCancelCapture:()=>Hr(e0),onMouseDown:I=>{P||I.button===0&&(ot.current!==null&&(window.clearTimeout(ot.current),ot.current=null),requestAnimationFrame(()=>{try{de.current?.focus({preventScroll:!0})}catch{}}))},onMouseUp:I=>{P||I.button===0&&(ot.current!==null&&window.clearTimeout(ot.current),ot.current=window.setTimeout(()=>{ot.current=null;try{de.current?.focus({preventScroll:!0})}catch{}},0))},children:[sr&&u.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:sr.left,top:sr.top,WebkitBackdropFilter:"blur(18px)"},onPointerDown:I=>{fe(),I.stopPropagation()},onPointerUp:I=>{I.preventDefault(),I.stopPropagation(),xa()},onTouchStart:I=>{fe(),I.stopPropagation()},onTouchEnd:I=>{I.preventDefault(),I.stopPropagation(),xa()},onClick:I=>{I.preventDefault(),I.stopPropagation(),xa()},children:[u.jsx(p3,{size:14,strokeWidth:2.4}),u.jsx("span",{children:te("common.copy")})]}),Sn?.start&&u.jsx("div",{"data-selection-handle":"start",className:"absolute z-30 h-11 w-11 select-none",style:{left:Sn.start.left,top:Sn.start.top,transform:"translate(-50%, -100%)",touchAction:"none"},onPointerDown:I=>I.stopPropagation(),children:u.jsxs("div",{className:"pointer-events-none absolute bottom-0 left-1/2 flex -translate-x-1/2 flex-col items-center",children:[u.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-[var(--accent)] shadow-[0_1px_4px_rgb(0_0_0_/_0.4)]"}),u.jsx("div",{className:"h-3 w-0.5 bg-[var(--accent)]"})]})}),Sn?.end&&u.jsx("div",{"data-selection-handle":"end",className:"absolute z-30 h-11 w-11 select-none",style:{left:Sn.end.left,top:Sn.end.top,transform:"translate(-50%, 0)",touchAction:"none"},onPointerDown:I=>I.stopPropagation(),children:u.jsxs("div",{className:"pointer-events-none absolute left-1/2 top-0 flex -translate-x-1/2 flex-col items-center",children:[u.jsx("div",{className:"h-3 w-0.5 bg-[var(--accent)]"}),u.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-[var(--accent)] shadow-[0_1px_4px_rgb(0_0_0_/_0.4)]"})]})}),$r&&as&&u.jsx(oR,{}),$r&&Rn==="loading"&&!as&&u.jsx(iR,{}),Rn==="error"&&u.jsx(aR,{message:pe||void 0,onRetry:()=>{window.location.reload()}}),Rn==="ready"&&u.jsxs(u.Fragment,{children:[u.jsx("textarea",{ref:de,"aria-label":te("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",...P?{inset:0,touchAction:"none",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",pointerEvents:"auto",fontSize:"16px"}:(()=>{const I=bn.x,O=bn.y,F={position:"fixed",left:I,top:O,pointerEvents:"none",touchAction:"auto",fontSize:`${he}px`,fontFamily:Y,lineHeight:"1",whiteSpace:"pre",boxSizing:"content-box",width:Math.max(1,Math.round(bn.cellW)),height:Math.max(1,Math.round(bn.cellH))};if(!ln.active)return F;const V=Ut(ln.text);return{...F,opacity:1,color:"transparent",WebkitTextFillColor:"transparent",background:"transparent",transition:"none",caretColor:"transparent",textDecorationColor:"transparent",wordBreak:"break-all",zIndex:20,width:V.width,height:V.height,whiteSpace:V.whiteSpace}})()},onContextMenu:I=>{I.preventDefault()},onFocus:()=>{Ue("input anchor focus"),Pe.current=void 0,Un.current(),Jn("focus",{skipResizePush:!0,skipScrollToBottom:!0}),We.current?.(!0)},onBlur:I=>{P||Yt(I.currentTarget);const O=Us(),F=typeof document<"u"?document.activeElement:null;if(Ue("input anchor blur",{guarded:O,activeTag:F?.tagName??null,activeClass:F?.className??null}),!O){P&&de.current?.setAttribute("readonly",""),We.current?.(!1);return}if(typeof window>"u"){We.current?.(!1);return}window.setTimeout(()=>{ht()||nt()||(P&&de.current?.setAttribute("readonly",""),We.current?.(!1))},e0)},onBeforeInput:I=>{if(se.current)return;const O=I.nativeEvent;if(O instanceof InputEvent){if(O.inputType==="insertFromPaste"||O.inputType==="insertFromPasteAsQuotation"){const F=O.dataTransfer?.getData("text/plain")||O.data;if(F){I.preventDefault();const V=_n(F,I.currentTarget);P&&ho.current?.(V)}return}if(O.inputType==="insertLineBreak"){if(Fe.current){Fe.current=!1,Je.current!==null&&(clearTimeout(Je.current),Je.current=null),I.preventDefault();return}I.preventDefault(),Cn(I.currentTarget);return}if(O.inputType==="deleteContentBackward"||O.inputType==="deleteContentForward"||O.inputType==="deleteByCut"){if(!I.currentTarget.value){I.preventDefault(),be.current("");return}if(O.inputType==="deleteContentBackward"&&I.currentTarget.selectionStart===0&&I.currentTarget.selectionEnd===0){I.preventDefault(),be.current("");return}return}}},onInput:I=>{if(se.current)return;const O=I.nativeEvent,F=II(Ot.current,Xu(I.currentTarget.value),O.inputType);if(F){const V=_n(F,I.currentTarget);P&&ho.current?.(V);return}Fn(I.currentTarget)},onPaste:I=>{const O=I.clipboardData.getData("text/plain");if(!O){Qs()?.pasteClipboardImage&&(I.preventDefault(),ir(I.currentTarget));return}I.preventDefault();const F=_n(O,I.currentTarget);P&&ho.current?.(F)},onKeyDown:I=>{const O=UR(I);if(!P){const F=ie.current,V=I.metaKey,Me=I.ctrlKey,Ce=I.altKey,Xe=I.shiftKey,Ye=I.key;if(V&&!Me&&!Ce&&!Xe&&Ye==="Enter"){I.preventDefault(),Cn(I.currentTarget);return}if((V||Me)&&!Ce&&!Xe&&(Ye==="v"||Ye==="V")){I.preventDefault(),ir(I.currentTarget);return}if(V&&!Me&&!Ce&&!Xe&&(Ye==="c"||Ye==="C")){I.preventDefault();const ft=F?.hasSelection()?F.getSelection():"";ft&&navigator.clipboard?.writeText(ft).catch(()=>{});return}if((V||Me)&&!Ce&&!Xe&&(Ye==="k"||Ye==="K")){I.preventDefault(),F&&(F.reset(),fs(),Jn("clear",{skipResizePush:!0,skipScrollToBottom:!0})),I.currentTarget.value="",Ot.current="",je.current=0;return}if(V&&!Me&&!Ce&&!Xe&&Ye==="Backspace"){I.preventDefault(),nn("",I.currentTarget);return}if(V&&!Me&&!Ce&&!Xe&&Ye==="Delete"){I.preventDefault(),nn("\v",I.currentTarget);return}if(V&&!Me&&!Ce&&!Xe&&Ye==="ArrowLeft"){I.preventDefault(),nn("",I.currentTarget);return}if(V&&!Me&&!Ce&&!Xe&&Ye==="ArrowRight"){I.preventDefault(),nn("",I.currentTarget);return}if(V)return;if(Me&&!Ce&&!Xe&&Ye===" "){I.preventDefault(),nn("\0",I.currentTarget);return}if(Me&&!Ce&&!V&&Ye.length===1){const ft=Ye.toLowerCase().charCodeAt(0);if(ft>=64&&ft<=127){I.preventDefault(),nn(String.fromCharCode(ft&31),I.currentTarget);return}}if(Ce&&!Me&&!V&&!Xe&&Ye==="Backspace"){I.preventDefault(),nn("\x1B",I.currentTarget);return}if(Ce&&!Me&&!V&&!Xe&&Ye==="Delete"){I.preventDefault(),nn("\x1Bd",I.currentTarget);return}if(Ce&&!Me&&!V&&!Xe&&Ye==="ArrowLeft"){I.preventDefault(),nn("\x1Bb",I.currentTarget);return}if(Ce&&!Me&&!V&&!Xe&&Ye==="ArrowRight"){I.preventDefault(),nn("\x1Bf",I.currentTarget);return}if(Ce&&!Me&&!V&&Ye.length===1){I.preventDefault(),nn(`\x1B${Ye}`,I.currentTarget);return}if(O||se.current)return;if(F){const ft=$R(I,F);if(ft!==null){I.preventDefault(),nn(ft,I.currentTarget);return}}}if(I.key==="Enter"||I.key==="Go"||I.key==="done"||I.key==="send"){if(O||se.current){I.preventDefault();return}if(Fe.current){Fe.current=!1,Je.current!==null&&(clearTimeout(Je.current),Je.current=null),I.preventDefault();return}I.preventDefault(),Cn(I.currentTarget);return}if(I.key==="Backspace"){if(se.current)return;if(!I.currentTarget.value){I.preventDefault(),be.current("");return}if(I.currentTarget.selectionStart===0&&I.currentTarget.selectionEnd===0){I.preventDefault(),be.current("");return}}},onCompositionStart:()=>{se.current=!0,qt(),Ur({active:!0,text:""})},onCompositionUpdate:I=>{se.current=!0;const O=I.data??I.currentTarget.value;Ur(F=>F.active&&F.text===O?F:{active:!0,text:O})},onCompositionEnd:I=>{se.current=!1,Fe.current=!0,Je.current!==null&&clearTimeout(Je.current),Je.current=setTimeout(()=>{Fe.current=!1,Je.current=null},50),Ur({active:!1,text:""}),Fn(I.currentTarget),vn()}}),ln.active&&(()=>{const I=Ut(ln.text);return u.jsx("div",{"aria-hidden":"true","data-terminal-ime-composition":"true",style:{position:"fixed",left:bn.x,top:bn.y,zIndex:21,pointerEvents:"none",overflow:"hidden",boxSizing:"content-box",width:I.width,height:I.height,margin:0,padding:0,color:B.foreground,background:B.background,boxShadow:`-1px 0 0 1px ${B.background}`,fontSize:`${he}px`,fontFamily:Y,lineHeight:"1",textDecorationLine:"underline",textDecorationStyle:"solid",textDecorationColor:B.foreground,wordBreak:"break-all",whiteSpace:I.whiteSpace,transition:"none"},children:ln.text})})(),u.jsx("div",{"aria-hidden":!0,className:`absolute left-1/2 -translate-x-1/2 top-6 z-30 pointer-events-none
|
|
69
|
-
rounded-full bg-[var(--surface-elevated)] px-4 py-1.5 text-sm font-semibold text-foreground
|
|
70
|
-
shadow-lg transition-all duration-150 ease-out`,style:{opacity:ko?1:0,transform:ko?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:"Tab"}),u.jsx("div",{ref:Os,"aria-hidden":!0,className:"absolute left-1/2 top-6 z-30 pointer-events-none transition-opacity duration-150 ease-out",style:{opacity:Ir.visible?1:0,transform:Ir.visible?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:Ir.visible&&(()=>{const{activeDir:I}=Ir,O=F=>I===F;return u.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:[u.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${O("up")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("path",{d:"M12 19V5M7 11l5-5 5 5"})})}),u.jsxs("div",{className:"flex items-center gap-0.5",children:[u.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${O("left")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}),u.jsx("div",{className:"w-7 h-7 flex items-center justify-center rounded-lg text-[rgb(var(--overlay-foreground-rgb)_/_0.18)]",children:u.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"currentColor",children:u.jsx("circle",{cx:"12",cy:"12",r:"4"})})}),u.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${O("right")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})})})]}),u.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${O("down")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("path",{d:"M12 5v14M19 12l-7 7-7-7"})})})]})})()})]})]})});rv.displayName="TerminalViewport";const nM=rv,rM={background:"#1C1B1A",foreground:"#CECDC3",cursor:"#CECDC3",cursorAccent:"#1C1B1A",selectionBackground:"#403E3C",selectionForeground:"#CECDC3",selectionInactiveBackground:"#403E3C50",black:"#6F6E69",red:"#AF3029",green:"#66800B",yellow:"#AD8301",blue:"#205EA6",magenta:"#A02F6F",cyan:"#24837B",white:"#CECDC3",brightBlack:"#6F6E69",brightRed:"#D14D41",brightGreen:"#879A39",brightYellow:"#D0A215",brightBlue:"#4385BE",brightMagenta:"#CE5D97",brightCyan:"#3AA99F",brightWhite:"#FFFCF0"},sM={background:"#FFFCF0",foreground:"#100F0F",cursor:"#100F0F",cursorAccent:"#FFFCF0",selectionBackground:"#CECDC3",selectionForeground:"#100F0F",selectionInactiveBackground:"#CECDC350",black:"#100F0F",red:"#AF3029",green:"#66800B",yellow:"#AD8301",blue:"#205EA6",magenta:"#A02F6F",cyan:"#24837B",white:"#575653",brightBlack:"#6F6E69",brightRed:"#D14D41",brightGreen:"#879A39",brightYellow:"#D0A215",brightBlue:"#4385BE",brightMagenta:"#CE5D97",brightCyan:"#3AA99F",brightWhite:"#100F0F"};function iM(e){return e==="light"?sM:rM}const Dg=new Set(["bash","zsh","fish","sh","dash","ksh","tcsh","csh","nu"]);function Oa(e){if(!e)return null;if(e==="/")return"/";const t=e.replace(/\/+$/,"").split("/");return t[t.length-1]||e}function tl(e,t,n,r=Dg,s=null,o=null){if(e.customName)return{primary:e.name,secondary:Oa(n)};if(s){const d=Oa(n),h=s===n||s===d;if(o!=="idle"&&!r.has(s)&&!h)return{primary:s,secondary:d}}if(t&&!r.has(t))return{primary:t,secondary:Oa(n)};const a=Oa(n);return a?{primary:a,secondary:null}:{primary:e.name,secondary:null}}function oM(e,t,n,r=Dg,s=null,o=null){return tl(e,t,n,r,s,o).primary}function Bg(e,t,n){const r=[],s=new Map;for(const o of e){const a=t(o),d=a&&a.trim().length>0?a:"";let h=s.get(d);h||(h={key:d,label:d?Oa(d)??d:n,sessions:[]},s.set(d,h),r.push(h)),h.sessions.push(o)}return r.sort((o,a)=>(o.key===""?1:0)-(a.key===""?1:0))}function bp(e){return e&&e.trim().length>0?e:""}function sv(e,t,n){const r=[...e],[s]=r.splice(t,1);return s?(r.splice(n,0,s),r.flatMap(o=>o.sessions.map(a=>a.id))):e.flatMap(o=>o.sessions.map(a=>a.id))}function aM(e,t,n,r){return e.flatMap(s=>{if(s.key!==t)return s.sessions.map(d=>d.id);const o=s.sessions.map(d=>d.id),[a]=o.splice(n,1);return a===void 0?s.sessions.map(d=>d.id):(o.splice(r,0,a),o)})}function iv(e,t,n,r){if(!n)return{arranged:e,groups:[]};const s=Bg(e,t,r);return{arranged:s.flatMap(a=>a.sessions),groups:s}}function lM(e){return e.isActive&&e.viewportFocused&&e.documentVisible&&e.windowFocused&&e.streamReady}function cM(e){return e.isActive&&e.documentVisible&&e.streamReady&&(!e.isDesktop||e.windowFocused)}function uM(e){return e.isActive&&!e.isMobile&&e.documentVisible&&!e.activeElementIsEditable}function dM(e,t){return!e&&t}const hM=e=>{const t=e?.retry;return{maxRetries:t?.maxRetries??3,initialRetryDelay:t?.initialDelayMs??1e3,maxRetryDelay:t?.maxDelayMs??8e3,connectionTimeout:e?.connectionTimeoutMs??1e4}},fM=()=>({async createSession(e){return tT(e)},connect(e,t,n){const r=nT(e,t.onEvent,t.onError,{...hM(n),getDimensions:n?.getDimensions});return{close:()=>r()}},async sendInput(e,t){await $b(e,t)},async resize(e){await oT(e.sessionId,e.cols,e.rows,e.seq)},async close(e){await Hb(e)},async restartSession(e,t){return lT(e,{cols:t.cols,rows:t.rows,mode:t.mode,tmuxSessionName:t.tmuxSessionName})},async forceKill(e){await uT(e)},async tmuxAction(e,t){return aT(e,t)},async listTmuxSessions(){return dm()},async getTmuxStatus(){return hm()},async checkHealth(e){return cT(e)}}),pM="\x1B",mM=/\x1b\[[IO]/g,gM=/\x1b\[<[0-9]+;[0-9]+;[0-9]+[mM]/y,xM=/\x1b\[[0-9]+;[0-9]+;[0-9]+M/y;function Y5(e,t,n){return e.lastIndex=n,e.exec(t)?e.lastIndex:-1}function yM(e){const t=e.replace(mM,"");if(t.length===0)return e.length>0;let n=0;for(;n<t.length;){let r=Y5(gM,t,n);if(r<0&&(r=Y5(xM,t,n)),r<0&&t.startsWith("\x1B[M",n)&&t.length>=n+6&&(r=n+6),r<0)return!1;n=r}return!0}function bM(e){return e===pM}function vM(e,t,n){const r=e?.name||"Error",s=e?.message||"Unexpected error";return["Termdock error report",`Time: ${n.capturedAt}`,`URL: ${n.url}`,`User agent: ${n.userAgent}`,"",`${r}: ${s}`,e?.stack?`
|
|
71
|
-
Stack:
|
|
72
|
-
${e.stack}`:"",t?`
|
|
73
|
-
React component stack:
|
|
74
|
-
${t.trim()}`:""].filter(Boolean).join(`
|
|
75
|
-
`)}async function wM(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{return document.execCommand("copy")}catch{return!1}finally{t.remove()}}function AM({error:e,componentStack:t}){const{t:n}=qn(),[r,s]=_.useState("idle"),o=async()=>{const a=vM(e,t,{url:window.location.href,userAgent:navigator.userAgent,capturedAt:new Date().toISOString()});s(await wM(a)?"copied":"failed")};return u.jsx("div",{className:"flex h-full items-center justify-center p-4",children:u.jsxs("div",{className:"flex flex-col items-center gap-3 text-center max-w-md",children:[u.jsx("div",{className:"w-12 h-12 rounded-full bg-destructive/10 flex items-center justify-center",children:u.jsx("svg",{className:"w-6 h-6 text-destructive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:u.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"})})}),u.jsxs("div",{className:"space-y-1",children:[u.jsx("h3",{className:"font-medium text-foreground",children:n("errorBoundary.title")}),u.jsx("p",{className:"text-sm text-muted-foreground",children:e?.message||n("errorBoundary.unexpected")})]}),u.jsxs("div",{className:"mt-2 flex flex-wrap items-center justify-center gap-2",children:[u.jsx("button",{type:"button",onClick:()=>{o()},className:"rounded-full bg-surface-2 px-5 py-2.5 text-sm font-medium text-foreground ring-1 ring-border/15 transition hover:bg-surface-elevated active:scale-[0.97]",children:n(r==="copied"?"errorBoundary.copied":r==="failed"?"errorBoundary.copyFailed":"errorBoundary.copyDetails")}),u.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"rounded-full bg-primary px-5 py-2.5 text-sm font-medium text-primary-foreground shadow-sm transition-all hover:bg-primary/90 active:scale-[0.97]",children:n("errorBoundary.retry")})]})]})})}let ov=class extends _.Component{state={hasError:!1,error:null,componentStack:""};static getDerivedStateFromError(t){return{hasError:!0,error:t,componentStack:""}}componentDidCatch(t,n){console.error("Terminal error caught by boundary:",t,n),this.setState({componentStack:n.componentStack??""})}render(){return this.state.hasError?this.props.fallback?this.props.fallback:u.jsx(AM,{error:this.state.error,componentStack:this.state.componentStack}):this.props.children}};function Rm(e,t){return e.label.trim().length>0?e.label:`Key ${t+1}`}const b0=15;function TM(){return av.map(e=>e.id)}const av=[{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 Q0(){return av.map(e=>({...e,programs:[...e.programs],includeAlt:e.includeAlt,rowLayout:[...e.rowLayout],actions:e.actions.map(t=>({...t})),showOnDesktop:e.showOnDesktop}))}function Pg(e){const t=Array.isArray(e)?e.map(n=>Math.min(20,Math.max(2,Math.floor(n)))).filter(n=>Number.isFinite(n)):[];return t.length>0?t:[3,3]}function lv(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.length>0?t:null}const Qg=/^\/(.+)\/([gimsuy]*)$/;function Z5(e){return Qg.test(e.trim())}function yh(e){const t=e.trim().match(Qg);if(!t)return null;try{return new RegExp(t[1]??"",t[2]??"")}catch{return null}}function cv(e){if(typeof e!="string")return null;const t=e.trim();return t?Qg.test(t)?yh(t)?t:null:t.toLowerCase():null}function K5(e){return e.replace(/\\u([0-9a-fA-F]{4})/g,(t,n)=>String.fromCharCode(Number.parseInt(n,16))).replace(/\\r/g,"\r").replace(/\\n/g,`
|
|
76
|
-
`).replace(/\\t/g," ")}const X5="||",SM=120;function CM(e){return e.includes(X5)?e.split(X5).filter(t=>t.length>0):[e]}function Jc(e){const t=new Set,n=e.map((s,o)=>{const a=typeof s.id=="string"&&s.id.trim().length>0?s.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):`preset-${o+1}`,d=t.has(a)?`${a}-${o+1}`:a;return t.add(d),{id:d,label:typeof s.label=="string"&&s.label.trim().length>0?s.label.trim():"Preset",programs:Array.isArray(s.programs)?s.programs.map(h=>cv(h)).filter(h=>!!h):[],includeAlt:typeof s.includeAlt=="boolean"?!!s.includeAlt:!1,rowLayout:Pg(s.rowLayout),showOnDesktop:typeof s.showOnDesktop=="boolean"?!!s.showOnDesktop:!1,actions:Array.isArray(s.actions)?s.actions.map((h,p)=>{const g={id:typeof h.id=="string"&&h.id.trim().length>0?h.id:`${d}-action-${p+1}`,label:typeof h.label=="string"?h.label:`Key ${p+1}`,sequence:typeof h.sequence=="string"?h.sequence:""};return typeof h.doubleTapSequence=="string"&&(g.doubleTapSequence=h.doubleTapSequence),g}):[]}}).filter(s=>s.id!=="auto"),r=Q0()[0];return r&&!n.some(s=>s.id==="default")&&n.unshift(r),n}function _M(e,t){const n=lv(e);if(!n)return"default";for(const r of t)if(r.id!=="default")for(const s of r.programs){const o=yh(s);if(o){if(o.test(n))return r.id}else if(n.includes(s))return r.id}return"default"}function J5(e,t){return e.find(n=>n.id===t)??e.find(n=>n.id==="default")??Q0()[0]}function LM(e){return[{id:"auto",label:"Auto"},...e.map(t=>({id:t.id,label:t.label}))]}function kM(e){return[{id:"auto",label:"Auto"},...e.filter(t=>t.showOnDesktop===!0).map(t=>({id:t.id,label:t.label}))]}function uv(e,t){const n=Pg(t),r=[];let s=0,o=0;for(;s<e.length;){const a=n[Math.min(o,n.length-1)]??3;r.push({columns:a,items:e.slice(s,s+a)}),s+=a,o+=1}return r}const dv=28,hv=({mode:e,presetLabel:t,title:n,ariaLabel:r,disabled:s,onPointerDown:o,buttonRef:a})=>u.jsx("button",{ref:a,type:"button",onPointerDown:o,tabIndex:-1,disabled:s,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:n,"aria-label":r??n,children:e==="auto"?u.jsx(SL,{size:14}):(t.charAt(0)||"?").toUpperCase()}),EM={esc:"\x1B",enter:"\r",home:"\x1B[H",end:"\x1B[F","ctrl-c":"","ctrl-d":"","ctrl-w":"","ctrl-u":""},Id=8;function IM(e,t){return EM[e]??null}const RM=({visible:e,interactive:t=!0,presentation:n="mobile",activeModifier:r,lockedModifier:s,disabled:o,defaultShowExtended:a=!1,presetLabel:d,presetModeLabel:h,presetMode:p,presetOptions:g,includeAlt:y,presetRowLayout:b,extraActions:v,onKeyPress:T,onTextPress:A,onPastePress:L,onFilePress:R,fileUploadState:D="idle",fileUploadProgress:B=0,longPressMode:j="arrows",copyFeedback:P="idle",onLongPressModeToggle:$,onModifierToggle:z,onPresetSelect:H,onExpandedChange:ye})=>{const{t:q}=qn(),[te,ve]=_.useState(a),[ge,ie]=_.useState(!1),Ae=_.useRef(null),xe=n==="desktop-actions",ce=xe||te,[K,be]=_.useState(!1),[Se,We]=_.useState(null),ue=o||!e||!t,Ee=o||!e,Tt=_.useRef(null),Rt=_.useRef(null),ze=_.useRef(null),X=_.useRef(null),rt=_.useRef(null),qe=_.useRef(P),re=_.useRef(null),J=_.useRef(0),$e=_.useCallback(je=>{if(ue)return;const ut=je.target;if(!(ut instanceof HTMLElement))return;const un=ut.closest("button"),Be=un?.hasAttribute("data-mobile-native-action")===!0;un&&!Be?(je.preventDefault(),da(Id)):un&&da(Id)},[ue]),tt=_.useCallback(je=>{je.preventDefault()},[]),gt=_.useCallback(je=>{const ut=je.target;ue||ut instanceof HTMLElement&&ut.closest("button")&&ut.blur()},[ue]);_.useEffect(()=>{ve(a)},[a]),_.useEffect(()=>{xe||ye?.(te)},[xe,ye,te]),_.useEffect(()=>{ue&&(re.current!==null&&(window.clearTimeout(re.current.timer),re.current=null),be(!1),We(null))},[ue]),_.useEffect(()=>{e||(be(!1),We(null))},[e]),_.useEffect(()=>{if(!K)return;const je=()=>{const ut=Tt.current?.getBoundingClientRect();ut&&We({left:Math.max(8,ut.left),top:Math.max(8,ut.top-8)})};return je(),window.addEventListener("resize",je),window.addEventListener("scroll",je,!0),()=>{window.removeEventListener("resize",je),window.removeEventListener("scroll",je,!0)}},[K]),_.useEffect(()=>{const je=qe.current;if(qe.current=P,P==="idle"||P===je)return;if(rt.current!==null&&window.clearTimeout(rt.current),!(typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches))if(P==="copied"){Rt.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 un=[{opacity:0,transform:"scale(0.65)"},{opacity:.75,transform:"scale(0.9)",offset:.18},{opacity:0,transform:"scale(1.65)"}];ze.current?.animate?.(un,{duration:760,easing:"ease-out"}),X.current?.animate?.(un,{duration:760,delay:130,easing:"ease-out"})}else Rt.current?.animate?.([{transform:"translateX(0)"},{transform:"translateX(-2px)"},{transform:"translateX(2px)"},{transform:"translateX(0)"}],{duration:280,easing:"ease-out"});da(Id),P==="copied"&&(rt.current=window.setTimeout(()=>{da(Id),rt.current=null},90),j==="copy"&&$?.())},[P,j,$]),_.useEffect(()=>()=>{rt.current!==null&&window.clearTimeout(rt.current)},[]);const pt=_.useCallback((je,ut)=>{ue||(je.preventDefault(),T(ut))},[T,ue]),Ct=_.useCallback((je,ut)=>{ue||(je.preventDefault(),z(ut))},[z,ue]),Le=_.useCallback(je=>{ue||(je.preventDefault(),ve(ut=>{const un=!ut;return un&&(ie(!0),Ae.current!==null&&window.clearTimeout(Ae.current),Ae.current=window.setTimeout(()=>{ie(!1),Ae.current=null},350)),un}))},[ue]),Te=_.useCallback(()=>{const je=typeof performance<"u"?performance.now():Date.now();je-J.current<350||(J.current=je,L?.())},[L]),Oe=_.useCallback(je=>{ue||(je.stopPropagation(),je.pointerType!=="touch"&&(je.preventDefault(),Te()))},[ue,Te]),yt=_.useCallback(je=>{ue||(je.preventDefault(),je.stopPropagation(),Te())},[ue,Te]),de=_.useCallback(je=>{ue||D==="uploading"||!R||(je.preventDefault(),je.stopPropagation(),R())},[D,R,ue]),Pe=_.useCallback(je=>{ue||je.stopPropagation()},[ue]),ot=250,zt=_.useCallback(()=>{re.current!==null&&(window.clearTimeout(re.current.timer),re.current=null)},[]);_.useEffect(()=>()=>{zt(),Ae.current!==null&&(window.clearTimeout(Ae.current),Ae.current=null)},[zt]);const yn=_.useCallback((je,ut)=>{if(ue)return;if(je.preventDefault(),!ut.doubleTapSequence){A(ut.sequence);return}const un=re.current;if(un!==null&&un.actionId===ut.id){window.clearTimeout(un.timer),re.current=null,A(ut.doubleTapSequence);return}zt();const Be=window.setTimeout(()=>{re.current=null,A(ut.sequence)},ot);re.current={actionId:ut.id,timer:Be}},[zt,A,ue]),at=_.useCallback(je=>{ue||(je.preventDefault(),je.stopPropagation(),$?.())},[$,ue]),bt=_.useCallback(je=>{ue||je.stopPropagation()},[ue]),It=_.useCallback(je=>{if(ue)return;je.preventDefault();const ut=je.currentTarget.getBoundingClientRect();We({left:Math.max(8,ut.left),top:Math.max(8,ut.top-8)}),be(un=>!un)},[ue]),kt=_.useCallback((je,ut)=>{ue||(je.preventDefault(),be(!1),We(null),H(ut))},[H,ue]),$t=v.length>0,se=_.useMemo(()=>{const je=[{id:"preset",kind:"preset"}];if(!xe&&y&&je.push({id:"alt",kind:"alt"}),$t){const ut=v.map(un=>({id:un.id,kind:"text",action:un}));return je.concat(ut)}return xe?je:je.concat([{id:"home",kind:"key",keyName:"home"},{id:"end",kind:"key",keyName:"end"},{id:"ctrl-d",kind:"key",keyName:"ctrl-d"}])},[v,$t,y,xe]),Fe=_.useMemo(()=>uv(se,b),[se,b]),Je=`${xe?"space-y-1":"mt-1 space-y-1"}${ge?" pointer-events-none":""}`,Ot=K&&Se?ga.createPortal(u.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:Se.left,top:Se.top},children:u.jsx("div",{className:"grid gap-1",children:g.map(je=>u.jsx("button",{type:"button",onPointerDown:ut=>kt(ut,je.id),tabIndex:-1,disabled:Ee,className:`h-7 rounded-full px-3 text-left text-xs font-medium transition-colors disabled:opacity-50 ${je.id===p?"bg-primary text-primary-foreground":"bg-surface-2 hover:bg-surface-elevated text-muted-foreground hover:text-foreground"}`,children:je.label},je.id))})}),document.body):null;return u.jsxs(u.Fragment,{children:[Ot,u.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?xe?"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:$e,onPointerDownCapture:$e,onContextMenuCapture:tt,onFocusCapture:gt,children:u.jsxs("div",{className:"rounded-2xl bg-surface-elevated p-0.5 space-y-0.5",children:[!xe&&u.jsxs("div",{"data-mobile-keyboard-primary-row":"true",className:"grid grid-cols-10 gap-1",children:[u.jsx("button",{type:"button",onPointerDown:je=>pt(je,"esc"),tabIndex:-1,disabled:Ee,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"}),u.jsx("button",{type:"button",onPointerDown:je=>Ct(je,"ctrl"),tabIndex:-1,disabled:Ee,className:`h-7 w-full rounded-full shadow-sm text-xs disabled:opacity-50 flex items-center justify-center transition-all ${r==="ctrl"?"bg-primary text-primary-foreground scale-105 shadow-md shadow-primary/40":"bg-surface-2"} ${s==="ctrl"?"ring-2 ring-accent":""}`,children:u.jsx("span",{className:"font-medium",children:s==="ctrl"?"Ctrl*":"Ctrl"})}),u.jsx("button",{type:"button",onPointerDown:je=>pt(je,"ctrl-c"),tabIndex:-1,disabled:Ee,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"}),u.jsx("button",{type:"button",onPointerDown:je=>pt(je,"ctrl-u"),tabIndex:-1,disabled:Ee,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"}),u.jsxs("button",{type:"button","data-mobile-native-action":"true",onPointerDown:Pe,onTouchStart:Pe,onClick:de,tabIndex:-1,disabled:Ee||!R||D==="uploading",title:D==="uploading"?`${q("rightSidebar.uploading")} ${Math.round(B)}%`:q(D==="inserted"?"rightSidebar.inserted":D==="failed"?"rightSidebar.uploadFailed":"rightSidebar.insertLocalFile"),"aria-label":q("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"&&u.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,B))}%`}}),u.jsx("span",{className:"relative z-10 flex items-center justify-center",children:D==="uploading"?u.jsx(Xn,{size:15,className:"animate-spin"}):D==="inserted"?u.jsx(ma,{size:15}):D==="failed"?u.jsx(Bs,{size:15}):u.jsx(p_,{size:15})}),D!=="idle"&&u.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:D==="uploading"?`${q("rightSidebar.uploading")} ${Math.round(B)}%`:q(D==="inserted"?"rightSidebar.inserted":"rightSidebar.uploadFailed")})]}),u.jsx("button",{type:"button",onPointerDown:()=>A("/"),tabIndex:-1,disabled:Ee,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:"/"}),u.jsx("button",{type:"button",onPointerDown:je=>pt(je,"enter"),tabIndex:-1,disabled:Ee,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:u.jsx(a_,{size:16})}),u.jsxs("button",{ref:Rt,type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:bt,onTouchStart:bt,onClick:at,tabIndex:-1,disabled:Ee,title:q(P==="copied"?"terminal.copied":P==="failed"?"terminal.copyFailed":j==="copy"?"terminal.longPressSelectsText":"terminal.longPressSendsArrows"),"aria-label":q(j==="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 ${P==="copied"?"bg-primary/15 text-primary":P==="failed"?"bg-destructive/15 text-destructive":j==="copy"?"bg-primary/15 text-primary":"bg-surface-2"}`,children:[u.jsx("span",{ref:ze,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/70 opacity-0"}),u.jsx("span",{ref:X,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/40 opacity-0"}),u.jsxs("span",{className:"relative z-10 h-4 w-4","aria-hidden":"true",children:[u.jsx(ma,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${P==="copied"?"scale-100 rotate-0 opacity-100":"scale-50 -rotate-45 opacity-0"}`}),u.jsx(Bs,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-200 ease-out motion-reduce:transition-none ${P==="failed"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),u.jsx(f3,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${P==="idle"&&j==="copy"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),u.jsx(F_,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${P==="idle"&&j==="arrows"?"scale-100 rotate-0 opacity-100":"scale-50 rotate-45 opacity-0"}`})]}),P!=="idle"&&u.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:P==="copied"?`${q("terminal.copied")} · ${q("terminal.longPressSendsArrows")}`:`${q("terminal.copyFailed")} · ${q("terminal.longPressSelectsText")}`})]}),u.jsx("button",{type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:Oe,onPointerUp:Pe,onTouchStart:Pe,onTouchEnd:Pe,onClick:yt,tabIndex:-1,disabled:Ee,title:q("terminal.paste"),"aria-label":q("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:u.jsx(KC,{size:15})}),u.jsx("button",{type:"button",onPointerDown:Le,tabIndex:-1,disabled:Ee,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:te?u.jsx(GC,{size:16}):u.jsx(fc,{size:16})})]}),ce&&u.jsx("div",{className:Je,children:Fe.map((je,ut)=>{const un=je.items[0]?.kind==="preset",Be=Math.max(2,je.columns),hr=un?`${dv}px repeat(${Math.max(1,Be-1)}, minmax(0, 1fr))`:`repeat(${Be}, minmax(0, 1fr))`;return u.jsx("div",{className:"relative grid gap-1",style:{gridTemplateColumns:hr},children:je.items.map(jn=>jn.kind==="preset"?u.jsx(hv,{buttonRef:jn.id==="preset"?Tt:void 0,mode:p,presetLabel:d,title:h,disabled:Ee,onPointerDown:It},jn.id):jn.kind==="alt"?u.jsx("button",{type:"button",onPointerDown:Ne=>Ct(Ne,"alt"),tabIndex:-1,disabled:Ee,className:`h-7 w-full rounded-full shadow-sm text-xs disabled:opacity-50 flex items-center justify-center transition-all ${r==="alt"?"bg-primary text-primary-foreground scale-105 shadow-md shadow-primary/40":"bg-surface-2"} ${s==="alt"?"ring-2 ring-accent":""}`,children:u.jsx("span",{className:"font-medium",children:s==="alt"?"Alt*":"Alt"})},jn.id):jn.kind==="text"?u.jsxs("button",{type:"button",onPointerDown:Ne=>yn(Ne,jn.action),tabIndex:-1,disabled:Ee,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:[jn.action.label,jn.action.doubleTapSequence&&u.jsx("span",{className:"absolute top-0.5 right-1.5 h-1 w-1 rounded-full bg-accent/60"})]},jn.id):u.jsx("button",{type:"button",onPointerDown:Ne=>pt(Ne,jn.keyName),tabIndex:-1,disabled:Ee,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:jn.keyName==="ctrl-d"?"Ctrl-D":jn.keyName==="home"?"Home":"End"},jn.id))},`row-${ut}`)})})]})})]})},MM=({isMobile:e,isInputFocused:t,isIOS:n,isConnecting:r,connectionError:s,terminalSessionId:o})=>{if(typeof window>"u")return null;const a=window.visualViewport?Math.max(0,Math.round(window.innerHeight-window.visualViewport.height-window.visualViewport.offsetTop)):0;return u.jsxs("div",{className:"px-3 py-2 bg-surface text-foreground text-xs border-b border-border/15",children:[u.jsx("div",{className:"font-bold mb-2",children:"Debug Info"}),u.jsxs("div",{className:"grid grid-cols-2 gap-1 font-mono",children:[u.jsxs("div",{children:["isMobile: ",u.jsx("span",{className:e?"text-accent":"text-destructive",children:String(e)})]}),u.jsxs("div",{children:["touchPoints: ",navigator.maxTouchPoints]}),u.jsxs("div",{children:["innerWidth: ",window.innerWidth]}),u.jsxs("div",{children:["innerHeight: ",window.innerHeight]}),u.jsxs("div",{children:["viewportH:"," ",window.visualViewport?Math.round(window.visualViewport.height):"N/A"]}),u.jsxs("div",{children:["inputFocused: ",String(t)]}),u.jsxs("div",{children:["keyboard~: ",a,"px"]}),u.jsxs("div",{children:["connecting:"," ",u.jsx("span",{className:r?"text-muted-foreground":"text-accent",children:String(r)})]}),u.jsxs("div",{children:["sessionId:"," ",u.jsx("span",{className:o?"text-accent":"text-destructive",children:o?"✓":"✗"})]}),u.jsxs("div",{children:["error:"," ",u.jsx("span",{className:s?"text-destructive":"text-accent",children:s?"Yes":"No"})]}),u.jsxs("div",{children:["isIOS:"," ",u.jsx("span",{className:n?"text-muted-foreground":"text-accent",children:String(n)})]})]}),u.jsx("div",{className:"mt-2 pt-2 border-t border-border/15",children:u.jsx("div",{children:"Tip: Tap the status bar 3 times to toggle debug panel"})})]})},NM=/^Reconnecting/i,DM=({connectionError:e,isFatalError:t,isRestarting:n,isConnecting:r,onHardRestart:s})=>{const{t:o}=qn(),a=!!e&&NM.test(e);return r&&!e||a?u.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2 pointer-events-none",children:u.jsx("span",{className:"text-[11px] text-muted-foreground/60 animate-pulse tracking-wide",children:e||o("connection.reconnecting")})}):e?u.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2",children:u.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-destructive/70",children:[u.jsx("span",{children:e}),t&&u.jsx("button",{type:"button",onClick:s,disabled:n,className:"text-[11px] text-destructive/90 hover:text-destructive underline underline-offset-2 transition-colors disabled:opacity-40",children:o("common.retry")})]})}):null};let v0=[],vp=!1;function wo(e,t,n={}){typeof window>"u"||(v0.push(JSON.stringify({level:e,message:t,data:{ts:Date.now(),...n}})),BM())}async function BM(){if(!vp){vp=!0;try{for(;v0.length>0;){const e=v0[0];try{await fetch("/api/client-log",{method:"POST",headers:{"Content-Type":"application/json"},body:e,keepalive:!0}),v0.shift()}catch{v0=[];break}}}finally{vp=!1}}}const ex=80,PM=60,QM="termdock:viewport-keyboard-change",Mm="termdock:viewport-layout-change",ll=240,tx=640,nx=360;function OM({measuredHeight:e,documentVisible:t,editableFocused:n}){return t&&n&&e>0}function Nm(){if(typeof document>"u")return!1;const e=document.activeElement;return e instanceof HTMLElement&&e.matches('input:not([type="hidden"]), textarea, select, [contenteditable]:not([contenteditable="false"])')}const bh=e=>{const t=typeof e=="number"?e:Number.parseFloat(typeof e=="string"?e:"0");return Number.isFinite(t)&&t>0?Math.round(t):0},fv=(e,t)=>{const n=e.map(bh).filter(r=>r>0);return n.find(r=>r>=ll)??n[0]??t},C0=()=>typeof window>"u"?tx:fv([window.innerHeight,document.documentElement?.clientHeight,document.body?.clientHeight,window.visualViewport?.height,window.screen?.availHeight,window.screen?.height],tx),pv=()=>typeof window>"u"?nx:fv([window.innerWidth,document.documentElement?.clientWidth,document.body?.clientWidth,window.visualViewport?.width,window.screen?.availWidth,window.screen?.width],nx),Rd=e=>{const t=Number.parseFloat(e||"0");return Number.isFinite(t)?Math.max(0,Math.round(t)):0},FM=()=>typeof navigator>"u"?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,jM=()=>typeof window>"u"?!1:navigator.standalone===!0||window.matchMedia?.("(display-mode: standalone)").matches===!0,mv=()=>{if(typeof window>"u"||!FM()||!jM())return{top:0,right:0,bottom:0,left:0};if(!(C0()>=pv()))return{top:0,right:0,bottom:0,left:0};const t=window.screen?.width||window.innerWidth,n=window.screen?.height||window.innerHeight,r=Math.min(t,n),s=Math.max(t,n);return r>=700?{top:20,right:0,bottom:20,left:0}:s<780?{top:20,right:0,bottom:0,left:0}:{top:s>=852?59:s>=844?47:44,right:0,bottom:34,left:0}};function $M(e="--app-vh"){if(typeof window>"u"||typeof document>"u")return;const t=bh(window.visualViewport?.height),n=Math.max(0,Math.round(window.visualViewport?.offsetTop??0)),r=C0(),o=t>=ll?Math.min(r,t+n):r,a=Math.max(r,o),d=document.documentElement.style;d.setProperty(e,`${Math.max(o,ll)}px`),d.setProperty("--app-base-vh",`${Math.max(a,ll)}px`),d.setProperty("--app-visible-vh",`${Math.max(o,ll)}px`),d.setProperty("--app-vv-offset-top",`${n}px`),d.setProperty("--kb-translate-y","0px"),d.setProperty("--kb-margin-top","0px"),d.setProperty("--kb-height","0px");const h=mv();h.top>0&&d.setProperty("--safe-top-inset",`${h.top}px`),h.right>0&&d.setProperty("--safe-right-inset",`${h.right}px`),h.bottom>0&&d.setProperty("--safe-bottom-inset",`${h.bottom}px`),h.left>0&&d.setProperty("--safe-left-inset",`${h.left}px`)}function UM(e={}){const{cssVarName:t="--app-vh"}=e,n=_.useMemo(()=>mc("viewport"),[]),r=_.useCallback(()=>{if(typeof window>"u")return 0;const g=window.visualViewport,y=C0();if(!g)return y;const b=bh(g.height);if(b<ll&&y>=ll)return y;const v=g.offsetTop,A=b<y-1&&v>0&&v<=96?b+v:b,L=Math.max(0,Math.min(y,A));return L>0?Math.round(L):y},[]),[s,o]=_.useState(r),a=_.useRef(0),d=_.useRef(0),h=_.useRef(0),p=_.useRef(!1);return _.useEffect(()=>{if(typeof window>"u")return;let g=null,y=null;const b=()=>{if(y?.isConnected)return y;try{return y=document.createElement("div"),y.setAttribute("aria-hidden","true"),y.style.cssText=["position:fixed","top:0","left:0","width:0","height:0","visibility:hidden","pointer-events:none","padding-top:constant(safe-area-inset-top)","padding-top:env(safe-area-inset-top,0px)","padding-right:constant(safe-area-inset-right)","padding-right:env(safe-area-inset-right,0px)","padding-bottom:constant(safe-area-inset-bottom)","padding-bottom:env(safe-area-inset-bottom,0px)","padding-left:constant(safe-area-inset-left)","padding-left:env(safe-area-inset-left,0px)"].join(";"),(document.body||document.documentElement).appendChild(y),y}catch{}return null},v=()=>{let ve={top:0,right:0,bottom:0,left:0};try{const Ae=b();if(Ae){const xe=getComputedStyle(Ae);ve={top:Rd(xe.paddingTop),right:Rd(xe.paddingRight),bottom:Rd(xe.paddingBottom),left:Rd(xe.paddingLeft)}}}catch{}const ge=mv(),ie={top:Math.max(ve.top,ge.top),right:Math.max(ve.right,ge.right),bottom:Math.max(ve.bottom,ge.bottom),left:Math.max(ve.left,ge.left)};return document.documentElement.style.setProperty("--safe-top-inset",`${ie.top}px`),document.documentElement.style.setProperty("--safe-right-inset",`${ie.right}px`),document.documentElement.style.setProperty("--safe-bottom-inset",`${ie.bottom}px`),document.documentElement.style.setProperty("--safe-left-inset",`${ie.left}px`),ie},T=(ve,ge,ie,Ae)=>{const xe=Math.max(ge,ie);if(a.current===0){a.current=xe,d.current=ve,document.documentElement.style.setProperty("--app-base-vh",`${xe}px`);return}const ce=Math.abs(ve-d.current),K=Ae<=ex;(ce>PM||K)&&(a.current=xe,d.current=ve,document.documentElement.style.setProperty("--app-base-vh",`${xe}px`))},A=(ve="event")=>{g=null;const ge=r(),ie=Math.round(window.visualViewport?.offsetTop??0),Ae=bh(window.visualViewport?.height),xe=Ae>=ll?Ae:ge,ce=C0(),K=pv(),be=Math.max(0,xe+ie),Se=v(),We=Se.bottom,ue=Math.max(0,a.current-be-We);T(K,ce,be,ue),o(Le=>Le===ge?Le:ge);const Ee=Number.parseInt(document.documentElement.style.getPropertyValue(t)||"0",10);document.documentElement.style.setProperty(t,`${ge}px`),document.documentElement.style.setProperty("--app-vv-offset-top",`${ie}px`);const Tt=a.current,Rt=Math.min(ge,xe),ze=Math.max(0,Math.min(Tt,be)),X=Math.max(0,Math.round(Tt-ze-We)),rt=Nm(),qe=OM({measuredHeight:X,documentVisible:document.visibilityState==="visible",editableFocused:rt}),re=qe?X:0,J=re>=ex,$e=-re,tt=re;document.documentElement.style.setProperty("--kb-translate-y",`${$e}px`),document.documentElement.style.setProperty("--kb-margin-top",`${tt}px`),document.documentElement.style.setProperty("--kb-height",`${re}px`),document.documentElement.style.setProperty("--app-visible-vh",`${ze}px`);const gt=Math.abs(re-h.current)>1,pt=J!==p.current;(gt||pt)&&(h.current=re,p.current=J,document.dispatchEvent(new CustomEvent(QM,{detail:{baseHeight:Tt,visibleHeight:ze,visualViewportHeight:xe,offsetTop:ie,keyboardHeight:re,isOpen:J,source:ve}}))),(Ee!==ge||ie>0||gt||pt)&&n("sync",{cssVarName:t,innerHeight:ce,baseHeight:Tt,rawViewportHeight:xe,offsetTop:ie,visibleHeight:ze,rawHeight:ge,appliedHeight:ge,keyboardViewportHeight:Rt,measuredKeyboardHeight:X,editableFocused:rt,applyKeyboardInset:qe,keyboardHeight:re,isKeyboardOpen:J,safeAreaInsets:Se,source:ve}),document.dispatchEvent(new CustomEvent(Mm,{detail:{height:ge,baseHeight:Tt,visibleHeight:ze,offsetTop:ie,source:ve}}))},L=(ve="event")=>{(ve.includes("visibilitychange")||ve.includes("pageshow"))&&n("schedule",{source:ve}),g===null&&(g=window.requestAnimationFrame(()=>A(ve)))};L("mount");const R=()=>L("resize"),D=()=>L("orientationchange"),B=()=>L("visualViewport.resize"),j=()=>L("visualViewport.scroll"),P=()=>L("focusin"),$=()=>L("focusout"),z=ve=>{const ge=document.activeElement;ge instanceof HTMLElement&&Nm()&&ge.blur(),h.current=0,p.current=!1;const ie=Math.max(a.current,C0(),ll),Ae=document.documentElement.style;Ae.setProperty(t,`${ie}px`),Ae.setProperty("--app-visible-vh",`${ie}px`),Ae.setProperty("--app-vv-offset-top","0px"),Ae.setProperty("--kb-translate-y","0px"),Ae.setProperty("--kb-margin-top","0px"),Ae.setProperty("--kb-height","0px"),o(xe=>xe===ie?xe:ie),n("keyboard session reset",{source:ve,baseHeight:ie})};window.addEventListener("resize",R),window.addEventListener("orientationchange",D),window.visualViewport?.addEventListener("resize",B),window.visualViewport?.addEventListener("scroll",j),document.addEventListener("focusin",P),document.addEventListener("focusout",$);const H=ve=>{n("resume",{source:ve,innerHeight:Math.round(window.innerHeight),visualViewport:window.visualViewport?{width:Math.round(window.visualViewport.width),height:Math.round(window.visualViewport.height),offsetTop:Math.round(window.visualViewport.offsetTop)}:null,hidden:document.hidden}),L(ve)},ye=()=>{document.hidden?z("visibilitychange:hidden"):H("visibilitychange")},q=()=>H("pageshow"),te=()=>z("pagehide");return document.addEventListener("visibilitychange",ye),window.addEventListener("pageshow",q),window.addEventListener("pagehide",te),()=>{window.removeEventListener("resize",R),window.removeEventListener("orientationchange",D),window.visualViewport?.removeEventListener("resize",B),window.visualViewport?.removeEventListener("scroll",j),document.removeEventListener("focusin",P),document.removeEventListener("focusout",$),document.removeEventListener("visibilitychange",ye),window.removeEventListener("pageshow",q),window.removeEventListener("pagehide",te),g!==null&&window.cancelAnimationFrame(g),y?.remove()}},[t,n,r]),s}const HM=120,zM=80,GM=400;function rx(){if(typeof window>"u"||document.visibilityState!=="visible"||!Nm())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=window.visualViewport;if(!t)return 0;const n=Number.parseFloat(document.documentElement.style.getPropertyValue("--app-base-vh")||"0")||window.innerHeight,r=Number.parseFloat(document.documentElement.style.getPropertyValue("--safe-bottom-inset")||"0")||0,s=t.height+t.offsetTop;return Math.max(0,Math.round(n-s-r))}function gv(e){const{enabled:t,openThresholdPx:n=HM,closeThresholdPx:r=zM,settleDelayMs:s=GM}=e,o=_.useMemo(()=>mc("keyboard"),[]),a=_.useRef(!1),d=_.useRef(null),h=_.useRef(0),[p,g]=_.useState({isOpen:!1,isSettled:!1,keyboardHeight:0});return _.useEffect(()=>{if(typeof window>"u"||!t){a.current=!1,d.current!==null&&(clearTimeout(d.current),d.current=null),g($=>!$.isOpen&&!$.isSettled&&$.keyboardHeight===0?$:{isOpen:!1,isSettled:!1,keyboardHeight:0});return}let y=null;const b=()=>{y=null;const $=rx();let z=a.current;if($>=n?z=!0:$<=r&&(z=!1),a.current=z,z){const H=Math.abs($-h.current);h.current=$,H>10&&(d.current!==null&&clearTimeout(d.current),d.current=setTimeout(()=>{d.current=null,g(ye=>ye.isSettled?ye:{...ye,isSettled:!0})},s))}else d.current!==null&&(clearTimeout(d.current),d.current=null);g(H=>{const ye=z?H.isSettled:!1;return H.isOpen===z&&H.keyboardHeight===$&&H.isSettled===ye?H:(o("sync",{keyboardHeight:$,isOpen:z,isSettled:ye,visualViewport:window.visualViewport?{width:Math.round(window.visualViewport.width),height:Math.round(window.visualViewport.height),offsetTop:Math.round(window.visualViewport.offsetTop)}:null}),{isOpen:z,isSettled:ye,keyboardHeight:$})})},v=($="event")=>{($.includes("visibilitychange")||$.includes("pageshow"))&&o("schedule",{source:$}),y===null&&(y=window.requestAnimationFrame(b))};v("mount");const T=()=>v("resize"),A=()=>v("orientationchange"),L=()=>v("visualViewport.resize"),R=()=>v("visualViewport.scroll"),D=()=>v("viewport-keyboard-change");window.addEventListener("resize",T),window.addEventListener("orientationchange",A),window.visualViewport?.addEventListener("resize",L),window.visualViewport?.addEventListener("scroll",R),document.addEventListener("termdock:viewport-keyboard-change",D);const B=$=>{o("resume",{source:$,keyboardHeight:rx(),hidden:document.hidden}),v(`${$}:now`),window.setTimeout(()=>v(`${$}:50ms`),50),window.setTimeout(()=>v(`${$}:200ms`),200)},j=()=>{document.hidden||B("visibilitychange")},P=()=>B("pageshow");return document.addEventListener("visibilitychange",j),window.addEventListener("pageshow",P),()=>{window.removeEventListener("resize",T),window.removeEventListener("orientationchange",A),window.visualViewport?.removeEventListener("resize",L),window.visualViewport?.removeEventListener("scroll",R),document.removeEventListener("termdock:viewport-keyboard-change",D),document.removeEventListener("visibilitychange",j),window.removeEventListener("pageshow",P),y!==null&&window.cancelAnimationFrame(y),d.current!==null&&(clearTimeout(d.current),d.current=null)}},[o,t,n,r,s]),p}const nh=300,WM=120,VM=2e3,qM=250,YM=6e4;function ZM(e){const t=new Set(e.slides.flat()),n=new Set([...e.visibleSessionIds].filter(a=>t.has(a)));e.foregroundSessionId&&t.has(e.foregroundSessionId)&&n.add(e.foregroundSessionId);const r=e.slides.findIndex(a=>a.some(d=>n.has(d)));if(r<0)return n;const s=e.slides[r-1]??[],o=e.slides[r+1]??[];for(let a=0;a<Math.max(s.length,o.length)&&n.size<3;a+=1)for(const d of[s[a],o[a]])d&&n.size<3&&n.add(d);return n}function wp(e,t){return t?e.find(n=>n.id===t||n.backendSessionId===t)?.id??null:null}function Md(e){return e.prioritySessionId??e.activeSessionId??e.persistedActiveSessionId??e.firstSessionId}function KM(e){return e.foregroundSessionId===null||e.isVisible===!0||e.sessionId===e.foregroundSessionId||e.foregroundReady}function XM(e){return e.sessionId===e.foregroundSessionId||e.visibleSessionIds.has(e.sessionId)||e.deferredViewportSessionIds.has(e.sessionId)}function JM(e){return e.isMobile&&(!e.viewportReady||!e.streamReady||!e.contentReady)}function eN(e){return e.writtenChunkId!==null&&e.initialTargetChunkId!==null&&e.writtenChunkId>=e.initialTargetChunkId}function tN(e){return!e.initialConnectionPending}function nN(e){return!e}function rN(e){return e.requestToken===0||e.isVisible===!0||e.foregroundSessionId===null||e.isVisible===void 0&&e.sessionId===e.foregroundSessionId||e.foregroundCompletedToken===e.requestToken}function sN(e,t){return[...e].every(n=>t.has(n))}function iN(e,t){return e===null||t-e>=qM}function oN(e){return!1}function aN(e){return!e.isActive||e.isStreamReady||e.reconnectStartedAt===null?null:Math.max(0,YM-(e.now-e.reconnectStartedAt))}function lN(e,t){const n=new Map;let r=0;for(const s of e)if(!n.has(s)){if(t.has(s)){n.set(s,0);continue}n.set(s,nh+r*WM),r+=1}return n}const cN="Session not found on server",Ap="Terminal session not found",uN="STALE_SESSION_RESTORE_REJECTED";function dN(e){return e?.message===cN}function sx(e){return e?.code===uN}function hN(e,t){if(!e||e.startsWith("/"))return e;const n=e.replace(/^\.\//,"");return t?`${t.replace(/\/+$/,"")}/${n}`:n}function xv(e,t){return hN(e,t).replace(/ /g,"\\ ")}function fN(e,t){return`${xv(e,t)} `}function ix(e,t){return xv(e,t)}function zz(e,t,n){if(!n)return ix(e,t);const r=n.start===n.end?`${n.start}`:`${n.start}-${n.end}`;return`${ix(e,t)}:${r}`}const pN="/tmp";async function yv(e,t,n){const s=(await t(pN,[e])).files[0];if(!s?.path)throw new Error("Upload did not return a file path");return n(s.path),s}const Gz=yv;function Tp(e,t,n=new Set){for(const r of e.keys()){if(e.size<=t)break;n.has(r)||e.delete(r)}return e}function lo(e,t){if(typeof window>"u")return null;try{const n=window.localStorage.getItem(e);if(n===null||n==="")return null;const r=JSON.parse(n);return t(r)?r:null}catch{return null}}function Hn(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function Sp(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(e)}catch{}}const _0=new Map,ou=new Map,rh=new Map;function Wz(e,t,n){if(typeof window>"u")return;const r=Date.now(),s=rh.get(e)??0,o=r-s;if(o>=n){rh.set(e,r),Hn(e,t);return}if(ou.set(e,t),_0.has(e))return;const a=n-o,d=setTimeout(()=>{_0.delete(e);const h=ou.get(e);ou.delete(e),rh.set(e,Date.now()),h!==void 0&&Hn(e,h)},a);_0.set(e,d)}function mN(e){const t=_0.get(e);t&&(clearTimeout(t),_0.delete(e));const n=ou.get(e);n!==void 0&&(ou.delete(e),rh.set(e,Date.now()),Hn(e,n))}function gN(e,t){if(e===t)return!0;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}if(typeof window<"u"){const e=()=>{for(const t of ou.keys())mN(t)};window.addEventListener("pagehide",e),window.addEventListener("termdock:before-update",e),document.addEventListener("visibilitychange",()=>{document.hidden&&e()})}const xN=600,O0=320,yN=280,Og=5;function sh(e,t,n=0){const r=Math.max(O0,t-Math.max(0,n)-Og*(n>0?2:1)-yN);return Math.min(r,Math.max(O0,e))}const bv="termdock:right-sidebar:tabs-by-session:v2",vv="termdock:right-sidebar:explorer-roots-by-session:v2",Fg="termdock:right-sidebar:pinned-explorer-roots:v1",wv="termdock:right-sidebar:selected-files-by-session:v2",Av="termdock:right-sidebar:show-hidden-files:v1",Dm="termdock:right-sidebar:file-sort-modes:v1",ox="termdock-sidebar-group-by-folder",Tv="termdock-sidebar-collapsed-folder-groups",Sv="termdock-left-sidebar-pinned",Cv="termdock-left-sidebar-width",_v="termdock-right-sidebar-pinned",Lv="termdock-right-sidebar-width",jg="termdock:right-sidebar:widths-by-session:v1",kv="termdock:right-sidebar:split-state-initialized:v1",Ev="termdock-right-sidebar-layout-preference";function bN(){if(typeof window>"u")return!0;try{const e=window.localStorage.getItem(Sv);return e===null?!0:e==="1"}catch{return!0}}function ax(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Sv,e?"1":"0")}catch{}}function vN(){if(typeof window>"u")return 300;try{const e=window.localStorage.getItem(Cv);if(!e)return 300;const t=parseInt(e,10);return Number.isFinite(t)&&t>=200&&t<=500?t:300}catch{return 300}}function wN(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Cv,String(e))}catch{}}function AN(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(_v)==="1"}catch{return!1}}function lx(e){if(!(typeof window>"u"))try{window.localStorage.setItem(_v,e?"1":"0")}catch{}}function ih(){if(typeof window>"u")return 760;try{const e=window.localStorage.getItem(Lv);if(!e)return 760;const t=parseInt(e,10);return Number.isFinite(t)&&t>=O0?t:760}catch{return 760}}function TN(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Lv,String(e))}catch{}}function SN(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.values(e).every(t=>typeof t=="number"&&Number.isFinite(t)&&t>=O0)}function vh(){return lo(jg,SN)??{}}function cx(e,t){if(!e){TN(t);return}Hn(jg,{...vh(),[e]:t})}function CN(){if(typeof window>"u")return"auto";try{const e=window.localStorage.getItem(Ev);return e==="narrow"||e==="wide"?e:"auto"}catch{return"auto"}}function _N(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Ev,e)}catch{}}function Vz(e,t,n){return!t||n==="auto"?e<xN:n==="narrow"}function LN(){return!0}function ux(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(ox,"1"):window.localStorage.setItem(ox,"0")}catch{}}function kN(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(Tv);if(!e)return new Set;const t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(n=>typeof n=="string")):new Set}catch{return new Set}}function EN(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Tv,JSON.stringify([...e]))}catch{}}function IN(e){return e==="git"||e==="files"||e==="diff"}function RN(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.values(e).every(IN)}function Bm(){return lo(bv,RN)??{}}function Cp(e,t){e&&Hn(bv,{...Bm(),[e]:t})}function MN(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.values(e).every(t=>typeof t=="string")}function dx(){return lo(vv,MN)??{}}function Nd(e){Hn(vv,e)}function NN(e){return e!==null&&typeof e=="object"&&typeof e.path=="string"&&(e.kind==="file"||e.kind==="directory")}function DN(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.values(e).every(t=>Array.isArray(t)&&t.every(n=>typeof n=="string"||NN(n)))}function Iv(e){const t=new Set,n=[];for(const r of e){const s=typeof r=="string"?{path:r,kind:"directory"}:r;!s.path||t.has(s.path)||(t.add(s.path),n.push(s))}return n}function BN(){const e=lo(Fg,DN)??{},t={};for(const[n,r]of Object.entries(e))t[n]=Iv(r);return t}function hx(e){Hn(Fg,e)}function PN(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.values(e).every(t=>typeof t=="string")}function Pm(){return lo(wv,PN)??{}}function n0(e,t){if(!e)return;const n={...Pm()};t?n[e]=t:delete n[e],Hn(wv,n)}function wh(e,t){return t?e?`${e}\0${t}`:t:null}function Qm(e,t,n){return n?`split-workspace\0${n}`:wh(e,t)}function QN(e,t,n){const r=vh(),s=Qm(e,t,n);if(s&&r[s]!==void 0)return r[s];if(n){const o=wh(e,t);if(o&&r[o]!==void 0)return r[o]}return ih()}function Rv(){const e=lo(kv,t=>Array.isArray(t)&&t.every(n=>typeof n=="string"));return new Set(e??[])}function ON(e){const t=Rv();t.has(e)||(t.add(e),Hn(kv,[...t]))}function FN(e){return typeof e=="boolean"}function jN(){return lo(Av,FN)??!1}function $N(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.values(e).every(t=>t==="modified")}function UN(){return lo(Dm,$N)??{}}let r0=null;const _p=new Map;let s0=null;const Lp=globalThis.crypto?.randomUUID?.()??`pins-${Math.random().toString(36).slice(2)}`;function HN(e){const t=e.replace(/\/+$/,"")||"/";return t==="/"?"/":t.slice(0,t.lastIndexOf("/"))||"/"}function $c(e,t){const n=e.replace(/\/+$/,"")||"/";return t===n||t.startsWith(`${n}/`)}function fx(e,t="name"){return[...e].sort((n,r)=>{if(n.type==="directory"&&r.type!=="directory")return-1;if(n.type!=="directory"&&r.type==="directory")return 1;if(t==="modified"){const s=Date.parse(r.modified??"")-Date.parse(n.modified??"");if(Number.isFinite(s)&&s!==0)return s}return n.name.localeCompare(r.name)})}function zN(e){return e.entry?{name:e.entry.name,path:e.entry.path,type:e.entry.type,isSymlink:e.entry.isSymlink,modified:e.entry.modified,expanded:!1,loaded:!1,children:e.entry.type==="directory"?[]:void 0}:null}const Et=n3(e=>({leftOpen:!1,rightOpen:!1,leftPinned:bN(),leftSidebarWidth:vN(),rightPinned:AN(),rightSidebarWidth:ih(),rightSidebarLayoutPreference:CN(),rightTab:"files",rightSearchOpen:!1,rootPath:null,contextKey:null,rightSidebarWidthContextKey:null,explorerRoot:null,explorerRootCache:dx(),pinnedExplorerRootsCache:BN(),pinnedExplorerRootsHydrated:!1,expandedPaths:new Set,selectedFilePath:null,directoryCache:new Map,fileSortModes:UN(),fileSortModesHydrated:!1,showHiddenFiles:jN(),groupByFolder:LN(),collapsedGroups:kN(),changedFiles:new Map,fileChangeVersions:new Map,fileWatchEpoch:0,gitBundleLoading:!1,gitBundleSlow:!1,gitBundleLoadingOwner:null,gitBundleError:null,gitBundleLastLoadedAt:null,gitBundleCacheInfo:null,projectStateCache:new Map,openLeft:()=>e({leftOpen:!0}),closeLeft:()=>e({leftOpen:!1}),toggleLeft:()=>e(t=>({leftOpen:!t.leftOpen,rightOpen:t.leftOpen?t.rightOpen:!1})),toggleLeftPinned:()=>e(t=>{const n=!t.leftPinned;return ax(n),{leftPinned:n,leftOpen:!0}}),setLeftPinned:t=>e(()=>(ax(t),{leftPinned:t})),setLeftSidebarWidth:t=>e(n=>{const r=Math.min(Math.max(t,200),500);return n.leftSidebarWidth===r?n:(wN(r),{leftSidebarWidth:r})}),toggleRightPinned:()=>e(t=>{const n=!t.rightPinned;return lx(n),{rightPinned:n,rightOpen:!0}}),setRightPinned:t=>e(()=>(lx(t),{rightPinned:t})),setRightSidebarWidth:t=>e(n=>{const r=Math.max(t,O0);return n.rightSidebarWidth===r?n:(cx(n.rightSidebarWidthContextKey,r),{rightSidebarWidth:r})}),setRightSidebarLayoutPreference:t=>e(n=>n.rightSidebarLayoutPreference===t?n:(_N(t),{rightSidebarLayoutPreference:t})),openRight:()=>e({rightOpen:!0}),closeRight:()=>e({rightOpen:!1,rightSearchOpen:!1}),toggleRight:()=>e(t=>({rightOpen:!t.rightOpen,rightSearchOpen:t.rightOpen?!1:t.rightSearchOpen,leftOpen:t.rightOpen?t.leftOpen:!1})),closeAll:()=>e({leftOpen:!1,rightOpen:!1,rightSearchOpen:!1}),setRightTab:t=>e(n=>(Cp(n.contextKey,t),{rightTab:t})),openRightSearch:()=>e({rightSearchOpen:!0}),closeRightSearch:()=>e({rightSearchOpen:!1}),setRightSearchOpen:t=>e({rightSearchOpen:t}),setRootPath:(t,n=null,r=null)=>e(s=>{const o=wh(n,t),a=Qm(n,t,r),d=r?a:o;if(s.contextKey===d&&s.rightSidebarWidthContextKey===a)return t===s.rootPath?s:{rootPath:t};const h=new Map(s.projectStateCache);s.contextKey&&h.set(s.contextKey,{rightTab:s.rightTab,explorerRoot:s.explorerRoot,expandedPaths:new Set(s.expandedPaths),selectedFilePath:s.selectedFilePath,directoryCache:new Map(s.directoryCache),changedFiles:new Map(s.changedFiles),gitBundleError:s.gitBundleError,gitBundleLastLoadedAt:s.gitBundleLastLoadedAt,gitBundleCacheInfo:s.gitBundleCacheInfo});const p=r?Rv().has(r):!1;let g={...dx(),...s.explorerRootCache};const y=!!r&&!p,b=y&&o?s.contextKey===o?{rightTab:s.rightTab,explorerRoot:s.explorerRoot,expandedPaths:new Set(s.expandedPaths),selectedFilePath:s.selectedFilePath,directoryCache:new Map(s.directoryCache),changedFiles:new Map(s.changedFiles),gitBundleError:s.gitBundleError,gitBundleLastLoadedAt:s.gitBundleLastLoadedAt,gitBundleCacheInfo:s.gitBundleCacheInfo}:h.get(o):void 0;if(y&&r){const B=b?.rightTab??(o?Bm()[o]:void 0)??"files",j=b?.explorerRoot??(o?s.explorerRootCache[o]:void 0)??t,P=b?.selectedFilePath??(o?Pm()[o]:void 0)??null,$={rightTab:B,explorerRoot:j,expandedPaths:new Set(b?.expandedPaths??[]),selectedFilePath:P,directoryCache:new Map(b?.directoryCache??[]),changedFiles:new Map(b?.changedFiles??[]),gitBundleError:b?.gitBundleError??null,gitBundleLastLoadedAt:b?.gitBundleLastLoadedAt??null,gitBundleCacheInfo:b?.gitBundleCacheInfo??null};d&&(h.set(d,$),Cp(d,B),n0(d,P),j&&(g={...g,[d]:j},Nd(g))),ON(r)}Tp(h,12,new Set(d?[d]:[]));const v=d?h.get(d):void 0,T=d?Bm()[d]:void 0,A=vh();let L=a?A[a]:void 0;r&&a&&L===void 0&&(L=(o?A[o]:void 0)??ih(),cx(a,L));const R=d?g[d]:void 0,D=d?Pm()[d]:void 0;return{rootPath:t,contextKey:d,rightSidebarWidthContextKey:a,rightSidebarWidth:L??ih(),rightTab:v?.rightTab??T??"files",explorerRoot:v?.explorerRoot??R??t,expandedPaths:v?new Set(v.expandedPaths):new Set,selectedFilePath:v?.selectedFilePath??D??null,explorerRootCache:g,directoryCache:v?new Map(v.directoryCache):new Map,changedFiles:v?new Map(v.changedFiles):new Map,gitBundleLoading:!1,gitBundleSlow:!1,gitBundleLoadingOwner:null,gitBundleError:v?.gitBundleError??null,gitBundleLastLoadedAt:v?.gitBundleLastLoadedAt??null,gitBundleCacheInfo:v?.gitBundleCacheInfo??null,projectStateCache:h}}),inheritRightSidebarStateFromSplitWorkspace:(t,n)=>e(r=>{if(!t||n.length===0)return r;const s=vh(),o=Qm(null,null,t);if(!o)return r;const a=s[o]??(r.rightSidebarWidthContextKey===o?r.rightSidebarWidth:void 0),d=r.contextKey===o?{rightTab:r.rightTab,explorerRoot:r.explorerRoot,expandedPaths:new Set(r.expandedPaths),selectedFilePath:r.selectedFilePath,directoryCache:new Map(r.directoryCache),changedFiles:new Map(r.changedFiles),gitBundleError:r.gitBundleError,gitBundleLastLoadedAt:r.gitBundleLastLoadedAt,gitBundleCacheInfo:r.gitBundleCacheInfo}:r.projectStateCache.get(o);if(a===void 0&&!d)return r;const h={...s},p=new Map(r.projectStateCache),g={...r.explorerRootCache};for(const y of n){const b=wh(y.sessionId,y.rootPath);b&&(a!==void 0&&(h[b]=a),d&&(p.set(b,{...d,expandedPaths:new Set(d.expandedPaths),directoryCache:new Map(d.directoryCache),changedFiles:new Map(d.changedFiles)}),Cp(b,d.rightTab),n0(b,d.selectedFilePath),d.explorerRoot?g[b]=d.explorerRoot:delete g[b]))}return a!==void 0&&Hn(jg,h),d&&Nd(g),Tp(p,12,new Set(r.contextKey?[r.contextKey]:[])),{projectStateCache:p,explorerRootCache:g}}),setExplorerRoot:t=>e(n=>{if(n.explorerRoot===t)return n;const r={...n.explorerRootCache};return n.contextKey&&t&&(r[n.contextKey]=t,Nd(r)),{explorerRoot:t,explorerRootCache:r}}),resetExplorerToProject:()=>e(t=>{if(t.explorerRoot===t.rootPath)return t;const n={...t.explorerRootCache};return t.contextKey&&t.rootPath&&(n[t.contextKey]=t.rootPath,Nd(n)),{explorerRoot:t.rootPath,explorerRootCache:n}}),pinExplorerRoot:(t,n="directory")=>e(r=>{if(!r.rootPath||!t)return r;const s=r.rootPath,o=r.pinnedExplorerRootsCache[r.rootPath]??[];if(o.some(d=>d.path===t))return r;const a={...r.pinnedExplorerRootsCache,[r.rootPath]:[{path:t,kind:n},...o].slice(0,12)};return hx(a),(async()=>{try{await Et.getState().hydratePinnedExplorerRoots();const d=await gi({pinnedExplorerRoot:{rootPath:s,path:t,kind:n,pinned:!0},pinnedExplorerRootsOrigin:Lp});Et.getState().syncPinnedExplorerRoots(d.pinnedExplorerRoots??{})}catch{}})(),{pinnedExplorerRootsCache:a}}),unpinExplorerRoot:t=>e(n=>{if(!n.rootPath||!t)return n;const r=n.rootPath,s=n.pinnedExplorerRootsCache[n.rootPath]??[],o=s.find(h=>h.path===t);if(!s.some(h=>h.path===t))return n;const a=s.filter(h=>h.path!==t),d={...n.pinnedExplorerRootsCache};return a.length>0?d[n.rootPath]=a:delete d[n.rootPath],hx(d),(async()=>{try{await Et.getState().hydratePinnedExplorerRoots();const h=await gi({pinnedExplorerRoot:{rootPath:r,path:t,kind:o?.kind??"directory",pinned:!1},pinnedExplorerRootsOrigin:Lp});Et.getState().syncPinnedExplorerRoots(h.pinnedExplorerRoots??{})}catch{}})(),{pinnedExplorerRootsCache:d}}),hydratePinnedExplorerRoots:async()=>{if(!Et.getState().pinnedExplorerRootsHydrated)return s0||(s0=(async()=>{const t=Et.getState().pinnedExplorerRootsCache;let r=(await uu()).pinnedExplorerRoots??{};Object.keys(r).length===0&&Object.keys(t).length>0&&(r=(await gi({pinnedExplorerRoots:t,pinnedExplorerRootsOrigin:Lp})).pinnedExplorerRoots??t),Et.getState().syncPinnedExplorerRoots(r)})().finally(()=>{s0=null}),s0)},syncPinnedExplorerRoots:t=>e(()=>{const n={};for(const[r,s]of Object.entries(t)){const o=Iv(s);o.length>0&&(n[r]=o.slice(0,12))}return Sp(Fg),{pinnedExplorerRootsCache:n,pinnedExplorerRootsHydrated:!0}}),toggleExpanded:t=>e(n=>{const r=new Set(n.expandedPaths);return r.has(t)?r.delete(t):r.add(t),{expandedPaths:r}}),selectFile:t=>e(n=>(n0(n.contextKey,t),{selectedFilePath:t})),toggleShowHiddenFiles:()=>e(t=>{const n=!t.showHiddenFiles;Hn(Av,n);const r=new Map(t.projectStateCache);for(const[s,o]of r)r.set(s,{...o,directoryCache:new Map});return{showHiddenFiles:n,directoryCache:new Map,projectStateCache:r}}),toggleGroupByFolder:()=>e(t=>{const n=!t.groupByFolder;return ux(n),{groupByFolder:n}}),setGroupByFolder:t=>e(n=>n.groupByFolder===t?n:(ux(t),{groupByFolder:t})),toggleGroupCollapsed:t=>e(n=>{const r=new Set(n.collapsedGroups);return r.has(t)?r.delete(t):r.add(t),EN(r),{collapsedGroups:r}}),setDirectoryCache:(t,n)=>e(r=>{const s=new Map(r.directoryCache);return s.delete(t),s.set(t,n),Tp(s,128,new Set([...r.expandedPaths,t,r.explorerRoot??r.rootPath??""])),{directoryCache:s}}),reconcileDirectoryCache:(t,n)=>e(r=>{const s=r.directoryCache.get(t);if(!s)return r;const o=new Map(s.map(g=>[g.path,g])),a=new Set(n.map(g=>g.path)),d=new Map(r.directoryCache),h=n.map(g=>{const y=o.get(g.path);return{name:g.name,path:g.path,type:g.type,isSymlink:g.isSymlink,modified:g.modified,expanded:y?.expanded??!1,loaded:y?.loaded??!1,children:g.type==="directory"?y?.children??[]:void 0}});d.set(t,fx(h,r.fileSortModes[t]??"name"));for(const g of s)if(!a.has(g.path))for(const y of d.keys())$c(g.path,y)&&d.delete(y);let p=r.selectedFilePath;return p&&s.find(y=>!a.has(y.path)&&$c(y.path,p))&&(p=null,n0(r.rootPath,null)),{directoryCache:d,selectedFilePath:p}}),hydrateFileSortModes:async()=>{if(!Et.getState().fileSortModesHydrated)return r0||(r0=(async()=>{const t=Et.getState().fileSortModes;let r=(await uu()).fileSortModes??{};Object.keys(r).length===0&&Object.keys(t).length>0&&(r=(await gi({fileSortModes:t})).fileSortModes??t),Sp(Dm),e({fileSortModes:r,fileSortModesHydrated:!0,directoryCache:new Map})})().finally(()=>{r0=null}),r0)},setDirectorySortMode:async(t,n)=>{try{await Et.getState().hydrateFileSortModes()}catch{}const r=Et.getState().fileSortModes[t]??"name",s=(_p.get(t)??0)+1;_p.set(t,s),e(o=>{const a={...o.fileSortModes};n==="modified"?a[t]=n:delete a[t];const d=new Map(o.directoryCache);return d.delete(t),{fileSortModes:a,fileSortModesHydrated:!0,directoryCache:d}});try{await gi({fileSortMode:{path:t,mode:n}}),Sp(Dm)}catch{if(_p.get(t)!==s)return;e(o=>{const a={...o.fileSortModes};r==="modified"?a[t]=r:delete a[t];const d=new Map(o.directoryCache);return d.delete(t),{fileSortModes:a,directoryCache:d}})}},invalidateDirectoryCache:(t,n=!1)=>e(r=>{const s=new Map(r.directoryCache);for(const o of s.keys())(o===t||n&&$c(t,o))&&s.delete(o);return{directoryCache:s}}),applyFileWatchEvents:t=>e(n=>{if(t.length===0)return n;const r=new Map(n.directoryCache),s=new Map(n.fileChangeVersions);let o=n.selectedFilePath,a=!1,d=!1,h=!1;const p=g=>{s.set(g,(s.get(g)??0)+1),d=!0};for(const g of t){if(g.type==="rescan-required"){h=!0,o&&$c(g.path,o)&&p(o);continue}const y=HN(g.path),b=r.get(y);if(g.type==="deleted"){if(p(g.path),o&&$c(g.path,o)&&(o=null,n0(n.rootPath,null)),b){const L=b.filter(R=>R.path!==g.path);L.length!==b.length&&(r.set(y,L),a=!0)}for(const L of r.keys())$c(g.path,L)&&(r.delete(L),a=!0);continue}p(g.path);const v=zN(g);if(!v||!b)continue;const T=b.find(L=>L.path===v.path),A=fx(T?b.map(L=>L.path===v.path?{...L,...v,children:L.children}:L):[...b,v],n.fileSortModes[y]??"name");r.set(y,A),a=!0}return!a&&!d&&!h?n:{directoryCache:a?r:n.directoryCache,selectedFilePath:o,fileChangeVersions:d?s:n.fileChangeVersions,fileWatchEpoch:h?n.fileWatchEpoch+1:n.fileWatchEpoch}}),bumpFileWatchEpoch:()=>e(t=>({fileWatchEpoch:t.fileWatchEpoch+1})),setChangedFiles:t=>e({changedFiles:t}),beginGitBundleLoading:t=>e({gitBundleLoading:!0,gitBundleSlow:!1,gitBundleLoadingOwner:t}),setGitBundleSlowFor:(t,n)=>e(r=>r.gitBundleLoadingOwner===t?{gitBundleSlow:n}:r),finishGitBundleLoading:t=>e(n=>n.gitBundleLoadingOwner===t?{gitBundleLoading:!1,gitBundleSlow:!1,gitBundleLoadingOwner:null}:n),resetGitBundleLoading:()=>e({gitBundleLoading:!1,gitBundleSlow:!1,gitBundleLoadingOwner:null}),setGitBundleError:t=>e({gitBundleError:t}),markGitBundleLoaded:(t=null)=>e({gitBundleLastLoadedAt:Date.now(),gitBundleCacheInfo:t})})),GN=320,px="termdock:mobile-keyboard-expanded",mx="termdock:mobile-keyboard-preset-mode",gx="termdock:mobile-long-press-mode",WN=80;function kp(){return typeof window>"u"?!1:(navigator.maxTouchPoints>0||"ontouchstart"in window)&&window.innerWidth<768}const VN={retry:{maxRetries:60,initialDelayMs:1e3,maxDelayMs:2e4},connectionTimeoutMs:15e3},qN=({sessionId:e,mode:t,tmuxSessionName:n=null,terminalSettings:r=Ng(),colorTheme:s="dark",toolbarPresets:o=[],isActive:a=!0,focusSuspended:d=!1,deferCursorUntilPositioned:h=!1,isLayoutVisible:p=!0,focusRequestToken:g=0,resumeRequestToken:y=0,resumeRequestReason:b="visibility",resumeRequestDelayMs:v=0,forceResumeReconnect:T=!1,initialConnectDelayMs:A=0,initialConnectEnabled:L=!0,resumeRequestEnabled:R=!0,onStreamReadyChange:D,onStreamConnected:B,onViewportReadyChange:j,onContentReadyChange:P,onKeyboardVisibilityChange:$,suppressKeyboard:z=!1,keyboardPortalTarget:H=null,sharedMobileKeyboardLayout:ye=!1,suppressPageFlipRefresh:q=!1,showDebug:te,onStatusChange:ve})=>{const{t:ge}=qn(),[ie,Ae]=_.useState(r.fontSize),xe=_.useMemo(()=>fM(),[]),ce=_.useMemo(()=>mc("session"),[]),K=_.useMemo(()=>mc("keyboard"),[]),be=_.useRef(null),Se=_.useRef(null);_.useEffect(()=>{Ae(r.fontSize)},[r.fontSize]);const We=_.useMemo(()=>({...r,fontSize:ie}),[r,ie]),[ue]=_.useState(e||hS()),[Ee,Tt]=_.useState(kp),[Rt,ze]=_.useState(!1),[X,rt]=_.useState(!1),[qe,re]=_.useState(!1),[J,$e]=_.useState(()=>typeof document>"u"?!0:!document.hidden),[tt,gt]=_.useState(()=>typeof document>"u"?!0:document.hasFocus()),[pt,Ct]=_.useState(!1),[Le,Te]=_.useState(!1),[Oe,yt]=_.useState(!1),[de,Pe]=_.useState(!1),[ot,zt]=_.useState(!0),{isOpen:yn,keyboardHeight:at}=gv({enabled:Ee&&a}),[bt,It]=_.useState(null),[kt,$t]=_.useState(null),[se,Fe]=_.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(px)==="true"),[Je,Ot]=_.useState(()=>{if(typeof window>"u")return"auto";const oe=window.localStorage.getItem(mx);return oe&&oe.length>0?oe:"auto"}),[je,ut]=_.useState(()=>typeof window>"u"?"arrows":window.localStorage.getItem(gx)==="copy"?"copy":"arrows"),[un,Be]=_.useState("idle"),[hr,jn]=_.useState("idle"),[Ne,Pn]=_.useState(0),dt=Bn(oe=>oe.sessions.get(ue)),{setTerminalSession:fr,setConnecting:In,appendToBuffer:Sr,replaceBuffer:fn,clearTerminalSession:Qn,removeTerminalSession:Br,clearBuffer:Rn,setSessionActiveProgram:On,setSessionCwd:pe,setSessionCopyMode:tn,setSessionAgentStatus:Ue,setSessionShellTitle:as,setSessionPromptState:_s,clearAgentNeedsReview:$r}=Bn.getState(),Ls=_.useMemo(()=>`wt-${ue.replace(/[^a-zA-Z0-9_-]/g,"").slice(0,12)}`,[ue]),ko=dt?.terminalSessionId??null,Jr=dt?.mode??"shell",Ir=dt?.activeProgram??null,rr=_.useMemo(()=>Jc(o),[o]),sr=Jr==="tmux",ri=dt?.bufferChunks??[],nr=dt?.isConnecting??!1,Yn=ko,dn=_.useCallback(async oe=>{const De=CR(oe,dt?.cwd||dt?.directory);if(!De)return;let Ve=De,mt="directory";try{Ve=(await vg(De)).path}catch(Re){if(!(Re instanceof Error)||Re.message!=="Path is not a directory")return;mt="file"}try{const Re=Et.getState();Re.setRightTab("files"),Re.openRight(),window.dispatchEvent(new CustomEvent(bR,{detail:{path:Ve,kind:mt}}))}catch{}},[dt?.cwd,dt?.directory]),Sn=t??dt?.mode??"shell",an=Sn==="tmux"?n??dt?.tmuxSessionName??null:null,[bn,Pr]=_.useState(null),Ht=_.useRef(!1),[Cr,ln]=_.useState(!1),[Ur,Os]=_.useState(!1),[ls,yr]=_.useState(null),[ks,$n]=_.useState(0),[cs,si]=_.useState(null),uo=te!==void 0?te:!1,es=_.useRef(null),Y=_.useRef(null),he=_.useRef(null),Ke=_.useRef(null),_e=_.useRef(null),Ie=_.useRef(!1),Ge=_.useRef(null),lt=_.useRef([]),et=_.useRef(0),Ze=_.useRef(!1),it=_.useRef(null),pn=_.useRef(null),vt=_.useRef(-1),mn=_.useRef(null),ct=_.useRef(0),Pt=_.useRef(null),Xt=_.useRef(null),hn=_.useRef(0),Tn=_.useRef(!1),br=_.useRef(null),vr=_.useRef(null),us=_.useRef(!1),Fs=_.useRef(0),Es=_.useRef(!1),js=_.useRef(!1),$s=_.useRef(!1),Ki=_.useRef(null),Rr=_.useRef(null),Nn=_.useRef(null),Dn=_.useRef(a);Dn.current=a;const Wr=_.useRef(d);Wr.current=d;const ts=_.useRef(Ee),U=_.useRef(null),ee=_.useRef(null),fe=_.useRef(null),ke=_.useRef(null),ht=_.useRef(null),nt=_.useRef(null),Bt=_.useRef(null),_t=_.useCallback(()=>{const oe=++Fs.current,De=()=>{oe===Fs.current&&Te(!0)};if(typeof window>"u"){De();return}window.requestAnimationFrame(()=>window.requestAnimationFrame(De))},[]),Nt=_.useCallback(oe=>{if(Es.current){if(Rr.current!==null&&(window.clearTimeout(Rr.current),Rr.current=null),oe.x===0&&oe.y>=oe.rows-1){zt(!1);return}Rr.current=window.setTimeout(()=>{Rr.current=null,zt(!0)},WN)}},[]),Fn=_.useRef(null);_.useEffect(()=>()=>{Fn.current?.()},[]);const Cn=_.useCallback(()=>{Fn.current||(Fn.current=dg(()=>{Fn.current=null;const oe=Bn.getState(),De=he.current,Ve=oe.getTerminalSession(ue);if(!De||Ve?.mode!=="shell"||oe.hasPendingBufferWrites(ue))return;const mt=eT(De),Re=_e.current?.getDimensions();if(!mt||!Re)return;const At=_e.current?.serializeSnapshot();At&&CA({id:De,version:1,...mt,...Re,data:At,savedAt:Date.now()})},2e3))},[ue]),nn=_.useCallback(oe=>{const De=Bn.getState(),Ve=De.getTerminalSession(ue)?.bufferChunks.at(-1)?.id;if(he.current&&Ve!==void 0&&Ve<=oe&&!De.hasPendingBufferWrites(ue)&&(iT(he.current),Cn()),!Tn.current||!eN({writtenChunkId:oe,initialTargetChunkId:br.current}))return;const mt=vr.current;vr.current=null,mt!==null&&_e.current?.notifyScreenSynchronized(mt),Tn.current=!1,br.current=null,_t()},[_t,Cn,ue]),_n=_.useCallback(oe=>{if(!Es.current)return;const De=Ki.current;De&&De.x===oe.x&&De.y===oe.y&&De.rows===oe.rows||(Ki.current=oe,Rr.current!==null&&(window.clearTimeout(Rr.current),Rr.current=null),oe.x===0&&oe.y>=oe.rows-1&&zt(!1))},[]);_.useEffect(()=>{if(!h){js.current=!1;return}js.current||(js.current=!0,$s.current=!1,Es.current=!0,Ki.current=null,zt(!1),Rr.current!==null&&(window.clearTimeout(Rr.current),Rr.current=null),Nn.current!==null&&window.clearTimeout(Nn.current),Nn.current=window.setTimeout(()=>{Nn.current=null,Rr.current!==null&&typeof window<"u"&&window.clearTimeout(Rr.current),Rr.current=null,Es.current=!1,zt(!0)},15e3))},[h]);const ir=_.useCallback(()=>{ke.current=null;const oe=fe.current;fe.current=null,oe&&as(oe.sessionId,oe.title)},[as]),_r=_.useCallback((oe,De)=>{if(fe.current={sessionId:oe,title:De},ke.current===null){if(typeof window>"u"){ir();return}ke.current=window.requestAnimationFrame(ir)}},[ir]),Un=_.useCallback(()=>{ke.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(ke.current),ke.current=null,fe.current=null},[]),sn=_.useCallback(async()=>{const oe=Sn;return(await Gb({preferredFrontendSessionId:ue,mode:oe,tmuxSessionName:oe==="tmux"?an||Ls:void 0,termType:"xterm-256color",requireExisting:!0})).terminalSession},[Sn,an,Ls,ue]),Ut=_.useRef(a);_.useEffect(()=>{if(!a){_e.current?.blur(),Ut.current=!1;return}if(Ut.current)return;Ut.current=!0;const oe=PI(Ee,q);if(oe==="single"){_e.current?.requestRefresh("focus",{skipResizePush:!0,skipScrollToBottom:!0});return}if(oe==="none")return;let De=0,Ve=0;De=requestAnimationFrame(()=>{Ve=requestAnimationFrame(()=>{_e.current?.requestRefresh("page-flip",{reconcileServerSize:!0,skipScrollToBottom:!0})})});const mt=window.setTimeout(()=>{_e.current?.requestRefresh("page-flip",{skipScrollToBottom:!0,reconcileServerSize:!0})},360);return()=>{cancelAnimationFrame(De),cancelAnimationFrame(Ve),window.clearTimeout(mt)}},[a,Ee,q,Yn]),_.useEffect(()=>{ts.current=Ee},[Ee]);const qt=_.useCallback(()=>{!Dn.current||Wr.current||_e.current?.focus()},[]);_.useLayoutEffect(()=>{d&&_e.current?.blur()},[d]),_.useEffect(()=>{if(!a||d||ot||$s.current)return;$s.current=!0;const oe=window.requestAnimationFrame(()=>{_e.current?.requestPtyRedraw()});return()=>window.cancelAnimationFrame(oe)},[d,a,ot]);const vn=_.useCallback(oe=>{typeof window>"u"||typeof document>"u"||!Dn.current||Wr.current||ts.current||document.hidden||(U.current!==null&&window.clearTimeout(U.current),U.current=window.setTimeout(()=>{if(U.current=null,!Dn.current||Wr.current||ts.current||document.hidden)return;const De=document.activeElement,Ve=De?.getAttribute("data-terminal-input-anchor")==="true";if((De instanceof HTMLInputElement||De instanceof HTMLTextAreaElement||De instanceof HTMLSelectElement||De?.isContentEditable===!0)&&!Ve){K("desktop resume focus skipped: editable active",{reason:oe});return}K("desktop resume focus",{reason:oe}),_e.current?.requestRefresh("focus",{force:!0,forceRedraw:!0,skipResizePush:!0,skipScrollToBottom:!0}),_e.current?.focus()},50))},[K]);_.useEffect(()=>()=>{U.current!==null&&typeof window<"u"&&window.clearTimeout(U.current),U.current=null,ee.current!==null&&typeof window<"u"&&window.clearTimeout(ee.current),ee.current=null,ht.current!==null&&typeof window<"u"&&window.clearTimeout(ht.current),ht.current=null,nt.current!==null&&typeof window<"u"&&window.clearTimeout(nt.current),nt.current=null,Nn.current!==null&&typeof window<"u"&&window.clearTimeout(Nn.current),Nn.current=null,Rr.current!==null&&typeof window<"u"&&window.clearTimeout(Rr.current),Rr.current=null},[]),_.useEffect(()=>{if(typeof document>"u"||typeof window>"u")return;const oe=()=>{ee.current!==null&&window.clearTimeout(ee.current),ee.current=window.setTimeout(()=>{ee.current=null;const De=document.activeElement,mt=!(De?.getAttribute("data-terminal-input-anchor")==="true")&&!!(De&&(De instanceof HTMLInputElement||De instanceof HTMLTextAreaElement||De instanceof HTMLSelectElement||De.isContentEditable));uM({isActive:Dn.current&&!Wr.current,isMobile:ts.current,documentVisible:!document.hidden,activeElementIsEditable:mt})&&qt()},0)};return document.addEventListener("pointerup",oe),()=>{document.removeEventListener("pointerup",oe),ee.current!==null&&(window.clearTimeout(ee.current),ee.current=null)}},[qt]);const Yt=_.useCallback(()=>{Zn.current=!1,$n(oe=>oe+1)},[]),on=_.useCallback((oe,De,Ve)=>{const mt=he.current,Re=Date.now();if(mt&&De&&sT(mt)){Se.current={startedAt:Re,strategy:"reconnect",reason:oe},wo("info","PWA_RESUME terminal-start",{frontendSessionId:ue,backendSessionId:mt,strategy:"reconnect",reason:oe,active:Dn.current});return}if(mt&&rT(mt,()=>{const At=Se.current;wo("info","PWA_RESUME terminal-responsive",{frontendSessionId:ue,backendSessionId:mt,durationMs:At?Date.now()-At.startedAt:null,strategy:At?.strategy??"probe",reason:At?.reason??oe}),Se.current=null,B?.(ue)},{visible:Ve})){Se.current={startedAt:Re,strategy:"probe",reason:oe},wo("info","PWA_RESUME terminal-start",{frontendSessionId:ue,backendSessionId:mt,strategy:"probe",reason:oe,active:Dn.current}),ce("[Terminal] resume probe sent",{reason:oe,backendSessionId:mt,active:Dn.current});return}if(ce("[Terminal] resume probe missing connection, restarting ensureSession",{reason:oe,backendSessionId:mt,active:Dn.current}),!tN({initialConnectionPending:us.current})){ce("[Terminal] resume probe deferred during initial websocket handshake",{reason:oe,backendSessionId:mt});return}Yt()},[ce,B,Yt,ue]),or=_.useCallback((oe,De)=>{const Ve=he.current;Ve&&Ge.current!==oe&&(Ge.current=oe,d2(Ve,oe,De),ce("[Terminal] flow-control state sent",{backendSessionId:Ve,paused:oe,reason:De}))},[ce]),Us=_.useCallback((oe,De)=>{const Ve=he.current;Ve&&Pt.current!==oe&&(Pt.current=oe,l2(Ve,oe,De),ce("[Terminal] focus state sent",{backendSessionId:Ve,focused:oe,reason:De}))},[ce]),Hr=_.useCallback((oe,De)=>{const Ve=he.current;Ve&&Xt.current!==oe&&(Xt.current=oe,c2(Ve,oe,De),ce("[Terminal] viewing state sent",{backendSessionId:Ve,viewing:oe,reason:De}))},[ce]),ar=lM({isActive:a&&!d,viewportFocused:qe,documentVisible:J,windowFocused:tt,streamReady:pt}),Gn=cM({isActive:a,documentVisible:J,windowFocused:tt,streamReady:pt,isDesktop:Qs()!==null}),Xi=_.useRef(ar),Eo=_.useRef(Gn);_.useEffect(()=>{Xi.current=ar,Us(ar,"logical-focus-change")},[ar,Us,Yn]),_.useEffect(()=>{Eo.current=Gn,Hr(Gn,"logical-viewing-change")},[Gn,Hr,Yn]),oS(Yn,J,pt),_.useEffect(()=>{const oe=De=>{const mt=De.detail;typeof mt=="number"&&mt>=8&&mt<=32&&Ae(mt)};return document.addEventListener("termfontchange",oe),()=>document.removeEventListener("termfontchange",oe)},[]),_.useEffect(()=>{const oe=()=>{const Re=!document.hidden;$e(Re),Re&&a&&vn("visibility")},De=Re=>{a&&vn(Re.persisted?"bfcache":"pageshow")},Ve=()=>{gt(!0),vn("window-focus")},mt=()=>gt(!1);return document.addEventListener("visibilitychange",oe),window.addEventListener("pageshow",De),window.addEventListener("focus",Ve),window.addEventListener("blur",mt),()=>{document.removeEventListener("visibilitychange",oe),window.removeEventListener("pageshow",De),window.removeEventListener("focus",Ve),window.removeEventListener("blur",mt)}},[a,vn]),_.useEffect(()=>{if(!y||!R||!Ei.current)return;const oe=v,De=oe<=0,Ve=be.current;if(Ve?.token===y&&(Ve.visible||!De))return;const mt=()=>{be.current={token:y,visible:De},_e.current?.requestRefresh(b,{skipScrollToBottom:!0}),on(oe>0?"global-resume-background":"global-resume-visible",oe<=0&&T,De)};if(oe<=0){mt();return}const Re=window.setTimeout(mt,oe);return()=>window.clearTimeout(Re)},[y,b,R,v,T,on]);const Hs=_.useRef(0);_.useEffect(()=>{if(pt){Hs.current=0;return}if(!Cr||bn==="Authentication required"||bn===Ap)return;const oe=Hs.current,De=Math.min(2e3*Math.pow(2,Math.min(oe,4)),3e4),Ve=setTimeout(()=>{Hs.current+=1,ce("[Terminal] fatal self-heal: auto restarting ensureSession",{attempt:Hs.current,backendSessionId:he.current}),Pr("Reconnecting..."),ln(!1),Yt()},De);return()=>clearTimeout(Ve)},[bn,Cr,pt,ks,ce,Yt]),_.useEffect(()=>{if(typeof window>"u"){ze(!1);return}const oe=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;ze(oe)},[]),_.useEffect(()=>{(!a||!Ee)&&rt(!1),a||re(!1)},[a,Ee]),_.useEffect(()=>{he.current=Yn,vt.current=-1,vr.current=null,Pt.current=null,Xt.current=null,Ge.current=null},[Yn]),_.useEffect(()=>{D?.(ue,pt)},[pt,D,ue]),_.useEffect(()=>{P?.(ue,pt&&Le&&Oe)},[Le,Oe,pt,P,ue]),_.useEffect(()=>{sr||(Ze.current=!1,it.current=null,pn.current&&(clearTimeout(pn.current),pn.current=null))},[sr]),_.useEffect(()=>{Yn&&_e.current?.requestRefresh("session-key-change",{force:!0})},[Yn]),_.useEffect(()=>{const oe=a&&Ee&&yn;K("visibility signal",{sessionId:ue,isActive:a,isMobile:Ee,isInputFocused:X,isViewportKeyboardOpen:yn,viewportKeyboardHeight:at,visible:oe}),$?.(ue,oe)},[$,ue,a,Ee,yn,at,K]),_.useEffect(()=>{a&&g&&g!==ct.current&&(ct.current=g,qt())},[g,qt,a]),_.useEffect(()=>{Ke.current=ue},[ue]),_.useEffect(()=>{!Ee&&(bt!==null||kt!==null)&&(It(null),$t(null),mn.current=null)},[Ee,bt,kt]),_.useEffect(()=>{!Yn&&(bt!==null||kt!==null)&&(It(null),$t(null),mn.current=null)},[Yn,bt,kt]),_.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(px,se?"true":"false")},[se]),_.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(mx,Je)},[Je]),_.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(gx,je)},[je]),_.useEffect(()=>{Tt(kp());const oe=()=>{Tt(kp())};return window.addEventListener("resize",oe),()=>window.removeEventListener("resize",oe)},[]);const ds=_.useCallback(()=>{hn.current+=1,ir(),Un();const oe=es.current;es.current=null,Y.current=null,us.current=!1,Ct(!1),_e.current?.setSessionReady(!1);const De=he.current;De&&d2(De,!1,"stream-disconnect"),Ie.current=!1,Ge.current=null,lt.current=[],oe?.()},[Un,ir]),yi=_.useCallback(async oe=>{if(Y.current===oe){ce(`[startStream] Skipping - already connected to ${oe}`);return}ce(`[startStream] Starting stream for frontendSessionId=${ue} backendSessionId=${oe}`),yr(null),Fs.current+=1,Tn.current=!1,br.current=null,Te(!1),yt(!1),ds();const De=hn.current+1;hn.current=De,us.current=!0;const Ve=Bn.getState().getTerminalSession(ue);if(Ve?.mode==="shell"&&!Ve.bufferChunks.length){const Re=await Promise.race([SA(oe),new Promise(At=>window.setTimeout(()=>At(null),75))]);if(hn.current!==De||Ke.current!==ue)return;if(Re&&!Bn.getState().getTerminalSession(ue)?.bufferChunks.length){Bn.getState().replaceBuffer(ue,[Re.data]);const At=_e.current?.getDimensions();At?.cols===Re.cols&&At.rows===Re.rows&&JA(oe,Re.seq,Re.epoch)}}const mt=xe.connect(oe,{onEvent:Re=>{if(hn.current!==De)return;const At=ue;if(At)switch(Re.type){case"connected":{us.current=!1;const gn=Se.current;gn&&(wo("info","PWA_RESUME terminal-connected",{frontendSessionId:At,backendSessionId:he.current,durationMs:Date.now()-gn.startedAt,strategy:gn.strategy,reason:gn.reason}),Se.current=null),B?.(At),(Re.runtime||Re.ptyBackend)&&ce(`[Terminal] connected frontendSessionId=${At} backendSessionId=${he.current} runtime=${Re.runtime??"unknown"} pty=${Re.ptyBackend??"unknown"} cwd=${Re.cwd??"unknown"}`),In(At,!1),Pr(null),ln(!1),yr(null),Ct(!0),he.current&&(l2(he.current,Xi.current,"stream-connected"),c2(he.current,Eo.current,"stream-connected")),_e.current?.setSessionReady(!0),Ge.current=null,or(Ie.current,"stream-connected"),Re.tuiProgress!==void 0&&Bn.getState().setSessionTuiProgress(At,Re.tuiProgress??null),Re.shellTitle!==void 0&&Bn.getState().setSessionShellTitle(At,Re.shellTitle??null),Re.promptState!==void 0&&Re.promptState!==null&&Bn.getState().setSessionPromptState(At,Re.promptState);const Mn=Bn.getState().getTerminalSession(At);if(Mn?.terminalSessionId&&Re.mode&&Bn.getState().setTerminalSession(At,{sessionId:Mn.terminalSessionId,cols:80,rows:24,mode:Re.mode,tmuxSessionName:Re.tmuxSessionName??null,cwd:Re.cwd??null}),Re.activeProgram!==void 0&&On(At,Re.activeProgram??null,Re.activeProgramSource??null,Re.activeProgramRaw??null),_e.current?.requestRefresh("connected",{force:!0,reconcileServerSize:Dn.current}),Re.mode!=="tmux"&&(si(null),tn(At,!1)),ce("[Terminal] Connected event received:",{frontendSessionId:At,backendSessionId:he.current,storeHasState:!!Mn,storeTerminalId:Mn?.terminalSessionId,hasHistoryInStore:!!Mn?.history?.length,historyLength:Mn?.history?.length??0}),Mn?.history&&Mn.history.length>0){ce(`[Terminal] Restoring ${Mn.history.length} history chunks to frontend session ${At}`);const Qr=Mn.history.reduce((Zr,Jn)=>Zr+Jn.length,0),lr=Math.max(300,Math.min(2e3,Math.ceil(Qr/200)));et.current=Date.now()+lr,Mn.history.forEach(Zr=>{Sr(At,Zr,{markActivity:!1})}),Bn.getState().setSessionHistory(At,[]),ce(`[Terminal] History restoration complete for ${At}`)}else ce(`[Terminal] No history to restore for ${At}`);const Wn=Re.replayChunks,wn=!!Mn?.history?.length||!!Wn?.length;if(wn?Tn.current=!0:_t(),Wn&&Wn.length>0){let Qr=null;if(Re.replayOutOfWindow)ce(`[Terminal] Replay out-of-window, atomically replacing buffer (${Wn.length} chunks)`),Qr=fn(At,iC(Wn));else{ce(`[Terminal] Replay incremental: ${Wn.length} chunks`);for(const Jn of Wn)Sr(At,Jn)}const lr=Wn.reduce((Jn,wa)=>Jn+wa.length,0),Zr=Math.max(200,Math.min(1500,Math.ceil(lr/200)));et.current=Math.max(et.current,Date.now()+Zr),br.current=Qr}wn&&br.current===null&&(br.current=Bn.getState().flushPendingBufferWrites(At),br.current===null&&(Tn.current=!1,_t()));break}case"reconnecting":{yr(gn=>gn??Date.now()),Pr("Reconnecting..."),ln(!1);break}case"data":{Re.data&&(Ie.current?lt.current.push(Re.data):Sr(At,Re.data));break}case"tmux-layout":{si(Re.layout??null),Re.layout&&tn(At,Re.layout.inCopyMode);break}case"tmux-screen-sync":{const gn=Re.generation??0;if(gn<vt.current)break;vt.current=gn,Fs.current+=1,Tn.current=!0,Te(!1),lt.current=[],_e.current?.prepareScreenReplacement(),vr.current=gn,br.current=fn(At,oC(Re.chunks??[])),br.current===null&&(vr.current=null,_e.current?.notifyScreenSynchronized(gn),Tn.current=!1,_t()),typeof Re.cols=="number"&&typeof Re.rows=="number"&&_e.current?.notifyServerSize(Re.cols,Re.rows,"tmux-screen-sync");break}case"active-program":{On(At,Re.activeProgram??null,Re.activeProgramSource??null,Re.activeProgramRaw??null);break}case"cwd":{pe(At,Re.cwd??null);break}case"agent-status":{Ue(At,{agentStatus:Re.agentStatus??null,agentIndicator:Re.agentIndicator??null,agentStatusDetail:Re.agentStatusDetail??null,agent:Re.agent??null,agentMessage:Re.agentMessage??null,agentNativeSessionId:Re.agentNativeSessionId??null,agentResumeRecovered:Re.agentResumeRecovered===!0,agentRich:Re.agentRich===!0,agentActivity:Re.agentActivity??0,agentCwd:Re.agentCwd??null,reviewed:Re.reviewed??null});break}case"git-status":{Bn.getState().setSessionGitStatus(At,Re.gitStatus??null);break}case"focus-mode":{ce("[Terminal] focus tracking mode",{backendSessionId:he.current,requested:Re.focusTrackingRequested===!0});break}case"resize-ack":{_e.current?.acknowledgeResize({seq:Re.seq,ok:Re.ok!==!1,cols:Re.cols,rows:Re.rows,screenSyncPending:Re.screenSyncPending,screenSyncGeneration:Re.screenSyncGeneration});break}case"pty-size":{typeof Re.cols=="number"&&typeof Re.rows=="number"&&_e.current?.notifyServerSize(Re.cols,Re.rows,Re.source);break}case"shell-title":{_r(At,Re.title??null);break}case"prompt-state":{_s(At,Re.state??"idle",Re.exitCode??null);break}case"tui-progress":{Bn.getState().setSessionTuiProgress(At,Re.tuiProgress??null);break}case"exit":{const gn=typeof Re.exitCode=="number"?Re.exitCode:null,Mn=typeof Re.signal=="number"?Re.signal:null;Sr(At,`\r
|
|
77
|
-
[Process exited${gn!==null?` with code ${gn}`:""}${Mn!==null?` (signal ${Mn})`:""}]\r
|
|
78
|
-
`),Qn(At),In(At,!1),Pr("Terminal session ended"),Ct(!1),ln(!1),yr(null),si(null),tn(At,!1),ds();break}}},onError:(Re,At)=>{if(hn.current!==De)return;const gn=ue;if(!gn)return;us.current=!1;const Mn=At&&Re.message==="Authentication required",Wn=dN(Re),wn=Mn?Re.message:Wn||At?"Reconnecting...":Re.message||"Terminal stream connection error";console.error(`[Terminal] Stream error (fatal=${At}):`,wn),Wn&&console.warn("[Terminal] SESSION_NOT_FOUND_DETECTED",{terminalIdAtError:he.current,frontendSessionId:gn,isActive:a,isMobile:Ee,fatal:At,stack:new Error().stack}),Pr(wn),ln(!!At),At&&(yr(null),In(gn,!1),ds(),Wn&&(ce("[onError] Session lost, auto-recreating"),Pr("Reconnecting..."),ln(!1),Qn(gn),Rn(gn),he.current=null,Zn.current=!1,Yt()))}},{...VN,getDimensions:()=>_e.current?.getDimensions()??null});es.current=()=>{mt.close(),hn.current===De&&(Y.current=null)},Y.current=oe},[Sr,Rn,Qn,ce,ds,_t,B,or,Yt,_r,In,On,Ue,tn,pe,_s,xe,ue]);_.useEffect(()=>{const oe=aN({isActive:a,isStreamReady:pt,reconnectStartedAt:ls,now:Date.now()});if(oe===null)return;const De=window.setTimeout(()=>{ce("[Terminal] visible reconnect watchdog expired",{backendSessionId:he.current,reconnectStartedAt:ls}),ds(),In(ue,!1),Pr("Reconnecting..."),ln(!1),yr(Date.now()),Yt()},oe);return()=>window.clearTimeout(De)},[ce,ds,a,pt,ls,Yt,ue,In]);const Zn=_.useRef(!1),Ei=_.useRef(!1),Is=_.useRef(0);_.useEffect(()=>()=>{Is.current+=1,Zn.current=!1,ds()},[ds]);const Xo=_.useRef(Sn),Ji=_.useRef(an);_.useEffect(()=>{const oe=Xo.current,De=Ji.current;Xo.current=Sn,Ji.current=an,Ke.current===ue&&(oe===Sn&&De===an||(Zn.current=!1,ds(),$n(Ve=>Ve+1)))},[Sn,an,ds,ue]),_.useEffect(()=>{if(Ke.current!==ue&&(ce(`[useEffect] sessionId changed from ${Ke.current} to ${ue}, allowing reinitialization`),Zn.current=!1,Ei.current=!1),Zn.current&&Ke.current===ue){ce(`[useEffect] Already initialized for sessionId=${ue}, skipping`);return}if(!de)return;const oe=async At=>{if(ce(`[ensureSession] Starting for sessionId=${ue}, runId=${At}`),!Ke.current||Ke.current!==ue){ce(`[ensureSession] SessionId mismatch or stale run (current=${Ke.current}, target=${ue}), skipping`);return}if(At!==Is.current){ce(`[ensureSession] Stale run detected (runId=${At}, currentRunId=${Is.current}), skipping`);return}const gn=Bn.getState(),Mn=gn.getTerminalSession(ue),Wn=Mn?.mode??Sn;ce("[ensureSession] Current state from store:",{terminalSessionId:Mn?.terminalSessionId,mode:Mn?.mode,tmuxSessionName:Mn?.tmuxSessionName,isConnecting:Mn?.isConnecting});let wn=Mn?.terminalSessionId??null,Qr=!wn;if(wn&&Wn!==Sn?(ce(`[ensureSession] Store mode mismatch for ${wn}: current=${Wn} desired=${Sn}, will create new session`),Qr=!0,gn.clearTerminalSession(ue),wn=null):wn&&Sn==="tmux"&&an&&Mn?.tmuxSessionName!==an&&(ce(`[ensureSession] Store tmux name mismatch for ${wn}: current=${Mn?.tmuxSessionName} desired=${an}, will create new session`),Qr=!0,gn.clearTerminalSession(ue),wn=null),wn&&xe.checkHealth&&!Dn.current){ce(`[ensureSession] Checking health of existing session ${wn}`);try{const lr=await xe.checkHealth(wn);if(ce("[ensureSession] Health check result:",lr),!lr.healthy)ce(`[ensureSession] Session ${wn} is NOT healthy (healthy=${lr.healthy}), will create new session`),ce("[ensureSession] Health check details:",lr),Qr=!0,lr.mode&&Mn?.terminalSessionId&&gn.setTerminalSession(ue,{sessionId:Mn.terminalSessionId,cols:80,rows:24,mode:lr.mode,tmuxSessionName:lr.tmuxSessionName??null}),gn.clearTerminalSession(ue),ce("[ensureSession] Cleared unhealthy session from store");else{ce(`[ensureSession] Session ${wn} is healthy, reusing it, cwd=${lr.cwd}, clients=${lr.clients}, lastActivity=${Date.now()-(lr.lastActivity||0)}ms ago`),lr.mode&&Mn?.terminalSessionId&&gn.setTerminalSession(ue,{sessionId:Mn.terminalSessionId,cols:80,rows:24,mode:lr.mode,tmuxSessionName:lr.tmuxSessionName??null}),ce(`[ensureSession] Setting terminalIdRef to ${wn} and starting stream`),he.current=wn,yi(wn),ce(`[ensureSession] Successfully reused healthy session ${wn}, returning early`);return}}catch(lr){ce(`[ensureSession] Failed to check health of session ${wn}:`,lr),ce("[ensureSession] Health check API call failed, proceeding as if session might be unhealthy")}}if(ce(`[ensureSession] Decision: shouldCreateNewSession=${Qr}, terminalId=${wn}`),Qr){ce(`[ensureSession] Creating new session, shouldCreateNewSession=${Qr}, runId=${At}`),Pr(null),ln(!1),gn.setConnecting(ue,!0);const Zr=Bn.getState().getTerminalSession(ue),wa=(Zr?.mode??Sn)===Sn&&(Sn!=="tmux"||!an||Zr?.tmuxSessionName===an);if(Zr?.terminalSessionId&&wa)ce(`[ensureSession] Race condition avoided: another instance already created session ${Zr.terminalSessionId}`),gn.setConnecting(ue,!1),wn=Zr.terminalSessionId,Qr=!1;else try{const Nr=await sn();if(ce(`[ensureSession] Opened managed backend session ${Nr.sessionId}`),At!==Is.current){ce(`[ensureSession] Stale run after session creation (runId=${At}, currentRunId=${Is.current}), leaving ${Nr.sessionId} for sibling`);return}gn.setTerminalSession(ue,Nr),ce(`[ensureSession] Updated store with new session ${Nr.sessionId}`),wn=Nr.sessionId}catch(Nr){if(At!==Is.current){ce("[ensureSession] Stale run after session creation failed, skipping error handling");return}if(Nr instanceof Lo&&sx(Nr)){ce("[ensureSession] Confirmed missing persisted session:",{sessionId:ue,error:Nr.message}),gn.clearTerminalSession(ue),Pr(Ap),ln(!0),gn.setConnecting(ue,!1);return}Pr("Reconnecting..."),ln(!0),gn.setConnecting(ue,!1);return}}if(At!==Is.current){ce(`[ensureSession] Stale run before starting stream (runId=${At}, currentRunId=${Is.current}), skipping`);return}if(!wn){ce(`[ensureSession] No terminalId, terminalId=${wn}`);return}ce(`[ensureSession] Starting stream for session ${wn}`),he.current=wn,yi(wn),ce(`[ensureSession] ensureSession completed for sessionId=${ue}, terminalId=${wn}`)};let De=null,Ve=null;const mt=()=>{Ve=null,!(Zn.current&&Ke.current===ue)&&(ce(`[useEffect] Running ensureSession for sessionId=${ue}, hasInitialized=${Zn.current}`),Zn.current=!0,Ei.current=!0,De=++Is.current,oe(De))};if(!L&&!Ei.current){ce(`[useEffect] Holding background connection until the selected session is ready: ${ue}`);return}const Re=Ei.current?0:Math.max(0,A);return Re>0?(ce(`[useEffect] Delaying initial connection for sessionId=${ue} by ${Re}ms`),Ve=window.setTimeout(mt,Re)):mt(),()=>{Ve!==null&&window.clearTimeout(Ve),ce(`[useEffect] Cleanup for sessionId=${ue}, runId=${De??"pending"}`)}},[ue,ks,yi,ds,xe,ce,Sn,an,Ls,A,L,de]);const ho=_.useCallback(async()=>{if(ue&&!Ur){Os(!0),Pr(null),ln(!1),yr(null),ds();try{xe.forceKill&&await xe.forceKill({sessionId:ue})}catch{}Br(ue),Rn(ue),_e.current?.clear(),await new Promise(oe=>setTimeout(oe,100));try{In(ue,!0);const oe=await sn();fr(ue,oe),he.current=oe.sessionId,yi(oe.sessionId)}catch(oe){Pr(oe instanceof Lo&&sx(oe)?Ap:"Reconnecting..."),ln(!0),In(ue,!1)}finally{Os(!1)}}},[ue,Ur,ds,xe,Br,Rn,In,fr,yi,sn]),xa=_.useCallback((oe,De)=>{if(!Dn.current||!oe)return;const Ve=yM(oe),mt=/^(\x1b\[<6[45];[0-9]+;[0-9]+M)+$/.test(oe);if(sr&&mt&&(Ze.current=!0),Date.now()<et.current)return;let Re=oe,At=De?.consumeModifier??!1;if(!De?.skipModifierTransform&&bt&&oe.length>0){const Wn=oe[0];if(Wn.length===1&&/[a-zA-Z]/.test(Wn)){const wn=Wn.toUpperCase();bt==="ctrl"?(Re=String.fromCharCode(wn.charCodeAt(0)&31),At=!0):bt==="alt"&&(Re=`\x1B${oe}`,At=!0)}At||(bt==="alt"&&(Re=`\x1B${oe}`),At=!0)}const gn=he.current;if(!gn)return;(async()=>{try{if(sr&&!Ve&&Ze.current&&xe.tmuxAction){Ze.current=!1;try{await xe.tmuxAction(gn,{action:"copy-mode",enabled:!1})}catch{}if(bM(Re))return}await xe.sendInput(gn,Re),$r(ue)}catch(Wn){Pr(Wn instanceof Error?Wn.message:"Failed to send input")}})(),At&&(kt||It(null),qt())},[bt,$r,qt,sr,kt,xe]);_.useEffect(()=>{const oe=De=>{if(!Dn.current)return;const Ve=De,mt=Ve.detail?.text;if(!mt)return;const Re=Ve.detail?.nonce;if(Ht.current){Re&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:Re,ok:!1}}));return}_e.current?.sendSequence(mt,{paste:Ve.detail?.paste}),Re&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:Re,ok:!0}})),dM(ts.current,Ve.detail?.focus!==!1)&&qt()};return window.addEventListener("termdock-insert-reference",oe),()=>window.removeEventListener("termdock-insert-reference",oe)},[qt]);const Jo=_.useCallback((oe,De,Ve)=>{const mt=he.current;if(!mt){K("xterm resize push skipped: no terminalId",{cols:oe,rows:De});return}K("xterm resize push",{cols:oe,rows:De}),xe.resize({sessionId:mt,cols:oe,rows:De,seq:Ve}).catch(Re=>{_e.current?.acknowledgeResize({seq:Ve,ok:!1}),Re&&/session not found/i.test(String(Re.message||Re))&&console.warn("[Terminal] resize 404 session not found",{sessionId:mt,cols:oe,rows:De,stack:new Error().stack})})},[xe,K]),Io=_.useCallback(async oe=>{const De=he.current;if(!(!De||!xe.tmuxAction))try{const Ve=await xe.tmuxAction(De,oe);Ve.layout&&(si(Ve.layout),oe.action==="switch-session"&&(fr(ue,{sessionId:De,cols:80,rows:24,mode:"tmux",tmuxSessionName:Ve.layout.sessionName}),Wd(ue,{tmuxSessionName:Ve.layout.sessionName}).catch(mt=>{console.warn("[Terminal] failed to update inventory after tmux switch",mt)})))}catch(Ve){Pr(Ve instanceof Error?Ve.message:"Failed to execute tmux action")}},[ue,fr,xe]);_.useEffect(()=>{if(!cs||!Yn)return;const De=cs.windows.find(Ve=>Ve.id===cs.activeWindowId)?.panes.find(Ve=>Ve.id===cs.activePaneId);De&&_e.current?.requestRefresh("tmux-layout",{skipScrollToBottom:!0,dedupeKey:`${Yn}:${cs.sessionId}:${De.id}:${De.width}x${De.height}`})},[cs,Yn]);const ii=_.useCallback((oe,De=5)=>{const Ve=Math.max(1,Math.min(Math.floor(De)||1,40));Ze.current=!0;const mt=it.current;if(mt&&mt.direction===oe){mt.lines+=Ve;return}mt&&Io({action:"scroll",direction:mt.direction,lines:mt.lines}).finally(()=>{qt()}),it.current={direction:oe,lines:Ve},pn.current&&clearTimeout(pn.current),pn.current=setTimeout(()=>{const Re=it.current;Re&&(it.current=null,Io({action:"scroll",direction:Re.direction,lines:Re.lines}).finally(()=>{qt()}))},0)},[qt,Io]),bi=_.useCallback(oe=>{const De=Date.now(),Ve=mn.current,mt=Ve!==null&&Ve.modifier===oe&&De-Ve.timestamp<=GN;if(mn.current={modifier:oe,timestamp:De},kt===oe){$t(null),It(null);return}if(mt){$t(oe),It(oe);return}kt!==null&&kt!==oe&&$t(null),It(Re=>Re===oe?null:oe)},[kt]),Vr=_.useCallback(oe=>{if(re(oe&&Dn.current),K("input focus changed",{focused:oe,isActive:Dn.current,isMobile:ts.current}),!ts.current||!Dn.current){rt(!1);return}rt(De=>De===oe?De:oe)},[K]),cl=_.useCallback(oe=>{if(Ie.current=oe,or(oe,"viewport-watermark"),!oe&<.current.length>0){const De=ue;if(De){const Ve=lt.current;lt.current=[];for(const mt of Ve)Sr(De,mt)}}},[Sr,or,ue]),hs=_.useCallback(oe=>{Dn.current&&_e.current?.ensureSizeMatches(oe)},[]),ya=_.useRef(null);_.useEffect(()=>{if(!a)return;const oe=ya.current;if(!oe)return;const De=()=>hs("pointerdown"),Ve=()=>hs("keydown"),mt=()=>hs("touchstart"),Re=()=>hs("wheel");return oe.addEventListener("pointerdown",De),oe.addEventListener("keydown",Ve),oe.addEventListener("touchstart",mt,{passive:!0}),oe.addEventListener("wheel",Re,{passive:!0}),()=>{oe.removeEventListener("pointerdown",De),oe.removeEventListener("keydown",Ve),oe.removeEventListener("touchstart",mt),oe.removeEventListener("wheel",Re)}},[a,hs]);const Ii=_.useCallback(oe=>{_e.current=oe},[]),ul=_.useCallback(oe=>{Pe(oe),j?.(ue,oe)},[j,ue]),eo=_.useCallback(oe=>{const De=IM(oe);if(!De)return;const Ve=bt!==null;_e.current?.sendSequence(De,{consumeModifier:Ve})},[bt]),Ro=_.useCallback(oe=>{const De=CM(oe);if(De.length===0)return;const Ve=bt!==null;_e.current?.sendSequence(K5(De[0]),{consumeModifier:Ve});for(let mt=1;mt<De.length;mt+=1){const Re=De[mt];window.setTimeout(()=>{_e.current?.sendSequence(K5(Re))},SM*mt)}},[bt]),dl=_.useCallback(()=>{_e.current?.pasteClipboardText()},[]),fo=_.useCallback(oe=>{nt.current!==null&&(window.clearTimeout(nt.current),nt.current=null),jn(oe),(oe==="inserted"||oe==="failed")&&(nt.current=window.setTimeout(()=>{nt.current=null,jn("idle")},1400))},[]),$a=_.useCallback(()=>{fo("idle"),Pn(0),Bt.current?.click()},[fo]),hl=_.useCallback(oe=>{const De=oe.currentTarget.files?.[0];oe.currentTarget.value="",De&&(Pn(0),fo("uploading"),yv(De,(Ve,mt)=>YT(Ve,mt,void 0,Pn),Ve=>{if(!Dn.current||Ht.current)throw new Error("Terminal unavailable");window.dispatchEvent(new CustomEvent("termdock-insert-reference",{detail:{text:fN(Ve,null),focus:!0}}))}).then(()=>fo("inserted"),()=>fo("failed")))},[fo]),Rs=nr||bn!==null;Ht.current=Rs;const ba=_.useRef(Ir);Rs||(ba.current=Ir);const va=Rs?ba.current:Ir,Mo=_.useMemo(()=>_M(va,rr),[va,rr]),po=_.useMemo(()=>J5(rr,Je),[Je,rr]),Mr=!Ee&&Je!=="auto"&&po.showOnDesktop!==!0?"auto":Je,vi=Mr==="auto"?Mo:Mr,Ms=_.useMemo(()=>J5(rr,vi),[vi,rr]),Ua=_.useMemo(()=>Ms.actions.filter(oe=>oe.sequence.trim().length>0).map((oe,De)=>({...oe,label:Rm(oe,De)})),[Ms.actions]),No=_.useMemo(()=>lv(Ir),[Ir]),Ri=Ms.label,fl=_.useMemo(()=>Mr!=="auto"?`Manual preset: ${Ms.label}`:No?`Auto preset · ${Ms.label} (${No})`:"Auto preset",[No,Mr,Ms.label]),pl=_.useCallback(oe=>{Ot(oe)},[]),fs=_.useCallback(()=>{ut(oe=>oe==="copy"?"arrows":"copy"),Be("idle")},[]),oi=_.useCallback(()=>{typeof window>"u"||(ht.current!==null&&window.clearTimeout(ht.current),ht.current=window.setTimeout(()=>{ht.current=null,Be("idle")},1200))},[]),wi=_.useCallback(oe=>{ht.current!==null&&typeof window<"u"&&(window.clearTimeout(ht.current),ht.current=null),Be(oe?"copied":"failed"),oi()},[oi]),to=_.useCallback(oe=>{Fe(oe)},[]),qr=_.useMemo(()=>Ee?LM(rr):kM(rr),[Ee,rr]),vs=_.useMemo(()=>iM(s),[s]),Mi=_.useMemo(()=>`terminal::${ue}`,[ue]);_.useEffect(()=>{ve?.({isConnecting:nr,isRestarting:Ur,hasError:!!bn,sessionId:Yn})},[nr,Ur,bn,Yn,ve]);const zs=!Yn||nr||Ur,Yr=_.useCallback((oe,De)=>{if(zs)return;const Ve=Math.max(1,Math.min(Math.floor(De)||1,40));ii(oe,Ve)},[ii,zs]);_.useEffect(()=>{if(!a||!Ee)return;_e.current?.requestRefresh("resize",{skipScrollToBottom:!yn,force:!0})},[a,Ee,yn,at,ue]),_.useEffect(()=>{if(!a||!Ee)return;const oe=De=>{const Ve=De.detail;_e.current?.requestRefresh("resize",{skipScrollToBottom:Ve?.isOpen!==!0,force:!0})};return document.addEventListener("termdock:viewport-keyboard-change",oe),()=>{document.removeEventListener("termdock:viewport-keyboard-change",oe)}},[a,Ee,ue]);const Lr=!z&&(Ee||Ms.showOnDesktop===!0),Ni=a,ai=Ee&&!ye?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,mo=Ee&&!ye?{marginTop:"var(--kb-margin-top, 0px)",transition:"none"}:void 0,Ai=u.jsx(RM,{visible:Lr,interactive:Ni,presentation:Ee?"mobile":"desktop-actions",activeModifier:bt,lockedModifier:kt,disabled:zs,defaultShowExtended:se,presetLabel:Ri,presetModeLabel:fl,presetMode:Mr,presetOptions:qr,includeAlt:Ms.includeAlt,presetRowLayout:Ms.rowLayout,extraActions:Ua,onKeyPress:eo,onTextPress:Ro,onPastePress:Ee?dl:void 0,onFilePress:Ee?$a:void 0,fileUploadState:hr,fileUploadProgress:Ne,longPressMode:je,copyFeedback:un,onLongPressModeToggle:fs,onModifierToggle:bi,onPresetSelect:pl,onExpandedChange:to}),Di=typeof window<"u"&&(navigator.maxTouchPoints>0||"ontouchstart"in window);return u.jsxs("div",{className:"relative flex h-full min-h-0 flex-col overflow-hidden",style:ai,children:[u.jsx("input",{ref:Bt,type:"file",className:"hidden",onChange:hl}),uo&&u.jsx(MM,{isMobile:Ee,isInputFocused:X,isIOS:Rt,isConnecting:nr,connectionError:bn,terminalSessionId:Yn}),u.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden",style:{backgroundColor:vs.background,...mo},children:[u.jsx("div",{ref:ya,className:"h-full w-full box-border",children:u.jsx(ov,{fallback:u.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:u.jsxs("div",{className:"flex flex-col items-center gap-3 text-center rounded-2xl bg-surface-2 px-6 py-5 shadow-sm",children:[u.jsx("div",{className:"w-10 h-10 rounded-full bg-destructive/15 flex items-center justify-center",children:u.jsx("svg",{className:"w-5 h-5 text-destructive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:u.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"})})}),u.jsx("span",{className:"text-sm text-muted-foreground",children:ge("terminal.componentFailed")})]})}),children:u.jsx(nM,{ref:Ii,sessionKey:Mi,isLayoutVisible:p,chunks:ri,onInput:xa,onResize:Jo,onFlowControl:cl,onTmuxScroll:sr?Yr:void 0,tmuxScrollSensitivity:.38,onDoubleTap:Ee?()=>{_e.current?.sendSequence(" ")}:void 0,onInputFocusChange:Vr,onMobileLongPressCopyResult:wi,onReadyChange:ul,onSizeSynchronizedChange:yt,onWritesSettled:Nt,onWriteProgress:nn,onCursorPositionChange:_n,onDirectoryLinkActivate:dn,terminalSettings:We,theme:vs,enableTouchScroll:Ee,mobileLongPressMode:je,autoFocus:!d&&!Ee&&!Di,cursorVisible:!d&&ot,suppressSmoothScroll:!Le||!Oe,className:d||!ot?"terminal-focus-suspended":void 0},Mi)})}),u.jsx(DM,{connectionError:bn,isFatalError:Cr,isRestarting:Ur,isConnecting:nr,onHardRestart:ho})]}),H?z?null:ga.createPortal(Ai,H):Ai]})},YN=1e3,ZN=2e4,KN=9e4,XN=5e3,Vn={ws:null,listeners:new Set,reconnectAttempt:0,reconnectTimer:null,idleCloseTimer:null,closing:!1};let Dd=0,au=null;function JN(){return typeof window>"u"?null:`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/api/control/ws`}function Mv(){Vn.idleCloseTimer&&(clearTimeout(Vn.idleCloseTimer),Vn.idleCloseTimer=null)}function eD(){Mv(),!(Vn.ws&&Vn.ws.readyState===WebSocket.OPEN)&&(Vn.idleCloseTimer=setTimeout(()=>{Vn.idleCloseTimer=null,Vn.listeners.size===0&&tD()},XN))}function tD(){if(Vn.ws){try{Vn.ws.close()}catch{}Vn.ws=null}au&&(clearInterval(au),au=null)}function xx(){if(Vn.reconnectTimer)return;const e=Math.min(YN*Math.pow(2,Vn.reconnectAttempt),ZN);Vn.reconnectAttempt+=1,Vn.reconnectTimer=setTimeout(()=>{Vn.reconnectTimer=null,Nv()},e)}function Nv(){const e=JN();if(!e||Vn.ws&&Vn.ws.readyState===WebSocket.OPEN)return;let t;try{t=new WebSocket(e)}catch{xx();return}Vn.ws=t,t.onopen=()=>{Vn.reconnectAttempt=0,Dd=Date.now(),au||(au=setInterval(()=>{if(!(!Vn.ws||Vn.ws.readyState!==WebSocket.OPEN)&&Dd>0&&Date.now()-Dd>KN)try{Vn.ws.close()}catch{}},3e4),au.unref?.())},t.onmessage=n=>{Dd=Date.now();let r=null;try{r=JSON.parse(n.data)}catch{return}if(!r)return;if(r.type==="update-state"){const a=r.state;if(!a||typeof a.status!="string"||typeof a.currentVersion!="string")return;const d={type:"update-state",state:a};for(const h of Vn.listeners)try{h(d)}catch(p){console.error("[clientStateSync] listener threw:",p)}return}if(r.type==="context-draft"){if(typeof r.text!="string")return;const a={type:"context-draft",text:r.text,updatedAt:typeof r.updatedAt=="number"?r.updatedAt:Date.now(),origin:typeof r.origin=="string"?r.origin:null};for(const d of Vn.listeners)try{d(a)}catch(h){console.error("[clientStateSync] listener threw:",h)}return}if(r.type==="pinned-explorer-roots"){if(!r.pinnedExplorerRoots||typeof r.pinnedExplorerRoots!="object"||Array.isArray(r.pinnedExplorerRoots))return;const a={type:"pinned-explorer-roots",pinnedExplorerRoots:r.pinnedExplorerRoots,updatedAt:typeof r.updatedAt=="number"?r.updatedAt:Date.now(),origin:typeof r.origin=="string"?r.origin:null};for(const d of Vn.listeners)try{d(a)}catch(h){console.error("[clientStateSync] listener threw:",h)}return}if(r.type==="config-updated"){if(r.key!=="toolbar-presets"&&r.key!=="agent-rules"&&r.key!=="program-detection")return;const a={type:"config-updated",key:r.key,updatedAt:typeof r.updatedAt=="number"?r.updatedAt:void 0};for(const d of Vn.listeners)try{d(a)}catch(h){console.error("[clientStateSync] listener threw:",h)}return}if(r.type!=="client-state"||!r.state)return;const s=r.state,o={type:"client-state",clientState:{sessions:Array.isArray(s.sessions)?s.sessions:[],updatedAt:typeof s.updatedAt=="number"?s.updatedAt:Date.now()},inventory:r.inventory,seq:typeof r.seq=="number"?r.seq:void 0};for(const a of Vn.listeners)try{a(o)}catch(d){console.error("[clientStateSync] listener threw:",d)}},t.onclose=()=>{Vn.ws===t&&(Vn.ws=null),Vn.listeners.size>0&&xx()},t.onerror=()=>{}}function Om(e){return Vn.listeners.add(e),Mv(),Vn.ws||Nv(),()=>{Vn.listeners.delete(e),Vn.listeners.size===0&&eD()}}function Dv(e,t,n){const r=e.findIndex(s=>n(s)===t);return r<0?null:e[r+1]?n(e[r+1]):r>0?n(e[r-1]):null}const Ep="termdock-sessions",Fm="termdock-active-session",$g="termdock-sessions-cache";function jm(){try{const e=localStorage.getItem(Fm);return e&&e.trim().length>0?e:null}catch{return null}}function Uc(e){try{e?localStorage.setItem(Fm,e):localStorage.removeItem(Fm)}catch{}}function Bv(){if(typeof window>"u")return null;try{const e=localStorage.getItem($g);if(!e)return null;const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="object"&&n!==null&&typeof n.sessionId=="string"&&typeof n.name=="string"):null}catch{return null}}function Jl(e){if(!(typeof window>"u"))try{localStorage.setItem($g,JSON.stringify(e))}catch{}}function yx(){if(!(typeof window>"u"))try{localStorage.removeItem($g)}catch{}}function Pv(e){return e.map(t=>({...t,mode:t.mode==="tmux"?"tmux":"shell",tmuxSessionName:t.tmuxSessionName??null,customName:t.customName===!0}))}function bx(e){return Pv(e.map(t=>({sessionId:t.sessionId,name:t.name,customName:t.customName===!0,backendSessionId:t.backendSessionId,mode:t.mode,tmuxSessionName:t.tmuxSessionName,createdAt:t.createdAt,lastActivity:t.lastActivity}))).map((t,n)=>({...t,activeProgram:e[n]?.activeProgram??null,cwd:e[n]?.cwd??null}))}function vx(e){return e.map(t=>`${t.sessionId}:${t.name}:${t.customName}:${t.backendSessionId}:${t.mode}:${t.tmuxSessionName}:${t.lastActivity}:${t.activeProgram??""}:${t.cwd??""}`).join("|")}function $m(e,t){return e.length===0?null:t&&e.some(n=>n.sessionId===t)?t:e[0]?.sessionId??null}function nD(){const e=Bv()??[];return{sessions:e,activeSessionId:$m(e,jm())}}function rD(){const e=S.useRef(Bv()).current,t=S.useRef(jm()).current,[n,r]=S.useState(e??[]),[s,o]=S.useState(null),[a,d]=S.useState(e&&e.length>0?$m(e,t):t),[h,p]=S.useState(e===null),g=S.useRef(!1),y=S.useRef(null),b=S.useRef(e===null),v=S.useRef(0),T=S.useRef(new Set),A=S.useRef(0);S.useEffect(()=>{b.current=h},[h]),S.useEffect(()=>{y.current=a},[a]);const L=S.useCallback(ie=>{const Ae=$m(ie,y.current??jm());return d(xe=>xe===Ae?xe:Ae),Uc(Ae),y.current=Ae,Ae},[]),R=S.useCallback((ie,Ae)=>{const xe=ie.filter(ce=>!T.current.has(ce.sessionId));r(ce=>vx(ce)===vx(xe)?ce:xe),Jl(xe),Ae?.reconcileActive&&L(xe)},[L]),D=S.useCallback((ie,Ae)=>{const xe=T.current.size===0?ie:{...ie,clientSessions:ie.clientSessions.filter(ce=>!T.current.has(ce.sessionId))};o(xe),R(bx(xe.clientSessions),Ae)},[R]),B=S.useCallback(()=>typeof window>"u"?[]:localStorage.getItem(Ep)?(localStorage.removeItem(Ep),yx(),Uc(null),r([]),d(null),console.info("[session-persist] discarded legacy local session cache"),[]):[],[]),j=S.useCallback(async()=>{if(typeof window>"u")return[];const ie=A.current;try{const Ae=await pT(),xe=bx(Ae.clientSessions);return ie!==A.current?(console.info("[session-inventory] ignored restore snapshot superseded by a local mutation"),xe.filter(ce=>!T.current.has(ce.sessionId))):(D(Ae,{reconcileActive:!0}),xe.length>0?xe:B())}catch(Ae){console.error("Failed to restore sessions from server:",Ae);try{return B()}catch(xe){console.error("Failed to discard legacy local sessions:",xe)}}finally{p(!1)}return[]},[D,B]),P=S.useCallback(async ie=>{const Ae=++A.current,xe=await Gb(ie);return Ae===A.current&&(D(xe.inventory),d(xe.session.sessionId),Uc(xe.session.sessionId)),xe},[D]),$=S.useCallback(async(ie,Ae)=>{++A.current,T.current.add(ie),r(xe=>{const ce=xe.filter(Se=>Se.sessionId!==ie),K=Ae!=null&&ce.some(Se=>Se.sessionId===Ae),be=y.current===ie?K?Ae:Dv(xe,ie,Se=>Se.sessionId):y.current;return d(be),Uc(be),Jl(ce),ce});try{await gT(ie)}catch(xe){console.error("Failed to remove session from inventory:",xe)}},[]),z=S.useCallback(ie=>{const Ae=Date.now();r(xe=>{const ce=xe.map(K=>K.sessionId===ie?{...K,lastActivity:Ae}:K);return Jl(ce),ce})},[]),H=S.useCallback(ie=>{d(ie),Uc(ie)},[]),ye=S.useCallback(async(ie,Ae)=>{const xe=Ae.trim();if(!xe)return;const ce=++A.current;r(K=>{const be=K.map(Se=>Se.sessionId===ie?{...Se,name:xe,customName:!0}:Se);return Jl(be),be});try{const K=await Wd(ie,{name:xe,customName:!0});ce===A.current&&D(K)}catch(K){console.error("Failed to rename session in inventory:",K)}},[D]),q=S.useCallback(async ie=>{const Ae=++A.current;r(xe=>{const ce=xe.map(K=>K.sessionId===ie?{...K,customName:!1}:K);return Jl(ce),ce});try{const xe=await Wd(ie,{customName:!1});Ae===A.current&&D(xe)}catch(xe){console.error("Failed to reset session name in inventory:",xe)}},[D]),te=S.useCallback(async ie=>{const Ae=++A.current;r(xe=>{const ce=new Map(xe.map(ue=>[ue.sessionId,ue])),K=ie.map(ue=>ce.get(ue)).filter(ue=>ue!==void 0),be=new Set(ie),Se=xe.filter(ue=>!be.has(ue.sessionId)),We=[...K,...Se];return Jl(We),We});try{const xe=await mT(ie);Ae===A.current&&D(xe)}catch(xe){console.error("Failed to reorder sessions in inventory:",xe)}},[D]),ve=S.useCallback(async()=>{++A.current;for(const ie of n)T.current.add(ie.sessionId);r([]),o(null),d(null),Uc(null),yx(),typeof window<"u"&&localStorage.removeItem(Ep);try{await xT()}catch(ie){console.error("Failed to clear session inventory:",ie)}},[n]),ge=S.useCallback(async(ie,Ae)=>{const xe=++A.current;r(ce=>{const K=ce.map(be=>be.sessionId===ie?{...be,backendSessionId:Ae}:be);return Jl(K),K});try{const ce=await Wd(ie,{backendSessionId:Ae});xe===A.current&&D(ce)}catch(ce){console.error("Failed to update session backend in inventory:",ce)}},[D]);return S.useEffect(()=>{g.current||(g.current=!0,j())},[j]),S.useEffect(()=>Om(Ae=>{if(Ae.type!=="client-state"||b.current)return;const xe=typeof Ae.seq=="number"?Ae.seq:null;if(xe!==null){if(xe<v.current){console.warn("[session-inventory] ignored stale control snapshot",{seq:xe,latestSeq:v.current});return}v.current=xe}if(Ae.inventory){D(Ae.inventory,{reconcileActive:!0});return}const ce=Pv(Ae.clientState.sessions||[]);R(ce,{reconcileActive:!0})}),[D,R]),{sessions:n,inventory:s,activeSessionId:a,isLoading:h,openSession:P,removeSession:$,updateSessionActivity:z,setActiveSession:H,updateSessionBackendId:ge,renameSession:ye,resetSessionCustomName:q,reorderSessions:te,clearAllSessions:ve,restoreSessions:j}}const sD="termdock:startup:";function eu(e){if(typeof performance>"u"||typeof performance.mark!="function")return;const t=`${sD}${e}`;performance.getEntriesByName(t,"mark").length>0||performance.mark(t)}function iD(e,t){e||ga.flushSync(t)}const Um="horizontal";function Fa(e){return e<=0?[]:Array.from({length:e},()=>1/e)}function cc(e,t){if(!Array.isArray(e)||e.length!==t)return Fa(t);const n=e.map(Number);if(n.some(s=>!Number.isFinite(s)||s<=0))return Fa(t);const r=n.reduce((s,o)=>s+o,0);return r<=0?Fa(t):n.map(s=>s/r)}function Qv(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 oD(e,t,n,r){if(t<0||t>=e.length-1)return e;const s=[...e],o=s.slice(0,t).reduce((p,g)=>p+g,0),a=s[t]+s[t+1],d=Math.max(0,Math.min(a/2,r)),h=Math.min(a-d,Math.max(d,n-o));return s[t]=h,s[t+1]=a-h,s}function aD(e){return e==="horizontal"||e==="vertical"||e==="grid"}function lD(e){if(!Array.isArray(e))return[];const t=new Set,n=new Set,r=[];for(const s of e){if(!s||typeof s!="object")continue;const o=s;if(typeof o.id!="string"||!o.id||n.has(o.id))continue;const a=Array.isArray(o.sessionIds)?o.sessionIds.filter(p=>typeof p=="string"&&!!p&&!t.has(p)):[],d=[...new Set(a)];if(d.length<2)continue;const h=Qv(d.length);d.forEach(p=>t.add(p)),n.add(o.id),r.push({id:o.id,...typeof o.name=="string"&&o.name.trim()?{name:o.name.trim().slice(0,80)}:{},sessionIds:d,layout:aD(o.layout)?o.layout:Um,ratios:cc(o.ratios,d.length),...o.gridColumnRatios!==void 0?{gridColumnRatios:cc(o.gridColumnRatios,h.columns)}:{},...o.gridRowRatios!==void 0?{gridRowRatios:cc(o.gridRowRatios,h.rows)}:{}})}return r}function cD(e,t){const n=new Set(t);return e.flatMap(r=>{const s=r.sessionIds.filter(o=>n.has(o));return s.length<2?[]:[{...r,sessionIds:s,ratios:s.length===r.sessionIds.length?cc(r.ratios,s.length):Fa(s.length)}]})}function F0(e,t){if(t)return e.find(n=>n.sessionIds.includes(t))}function Ip(e,t,n){if(!t||!n||t===n)return e;const r=F0(e,t),s=F0(e,n);if(r&&r.id===s?.id)return e;const o=[...r?.sessionIds??[t],...s?.sessionIds??[n]],a=[...new Set(o)],d={id:r?.id??`split:${t}`,...r?.name?{name:r.name}:{},sessionIds:a,layout:a.length>2&&(!r||r.layout===Um)?"grid":r?.layout??Um,ratios:Fa(a.length)},h=new Set([r?.id,s?.id].filter(Boolean)),p=e.filter(y=>!h.has(y.id)),g=r?Math.max(0,e.findIndex(y=>y.id===r.id)):p.length;return p.splice(Math.min(g,p.length),0,d),p}function uD(e,t){const n=F0(e,t);if(!n||!t)return e;if(n.sessionIds.length<=2)return e.filter(s=>s.id!==n.id);const r=n.sessionIds.filter(s=>s!==t);return e.map(s=>s.id===n.id?{...s,sessionIds:r,ratios:Fa(r.length)}:s)}function dD(e,t){const n=F0(e,t);return n?e.filter(r=>r.id!==n.id):e}function hD(e,t,n){return e.map(r=>{if(r.id!==t)return r;const s=[...new Set(n)],o=new Set(r.sessionIds);return s.length===r.sessionIds.length&&s.every(d=>o.has(d))?{...r,sessionIds:s}:r})}function fD(e,t,n){const r=n.trim().slice(0,80);return e.map(s=>s.id===t?{...s,...r?{name:r}:{name:void 0}}:s)}const Hm=320,Ov=1,pD=Hm+120,zm="termdock:split-workspaces:v2",Fv="termdock:split-workspace:v1",mD=.1,gD=.9,xD=.28,yD=300,bD=8,vD=280,wD=160;function Rp(){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 AD(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(zm);if(e)return lD(JSON.parse(e));const t=JSON.parse(window.localStorage.getItem(Fv)||"null");if(t&&typeof t.primaryId=="string"&&typeof t.secondaryId=="string"&&t.primaryId!==t.secondaryId){const n=Math.min(gD,Math.max(mD,typeof t.ratio=="number"?t.ratio:.5));return[{id:`split:${t.primaryId}`,sessionIds:[t.primaryId,t.secondaryId],layout:t.direction==="vertical"?"vertical":"horizontal",ratios:[n,1-n]}]}}catch{}return[]}function TD(e,t){const n=new Map(e.map(a=>[a.id,a])),r=new Map;t.forEach(a=>a.sessionIds.forEach(d=>r.set(d,a)));const s=new Set,o=[];for(const a of e){const d=r.get(a.id);if(!d){o.push({key:a.id,sessions:[a]});continue}if(s.has(d.id))continue;s.add(d.id);const h=d.sessionIds.flatMap(p=>{const g=n.get(p);return g?[g]:[]});h.length>=2&&o.push({key:d.id,sessions:h,workspace:d})}return o}function wx(e){const t=e.wrapperEl;if(t)try{t.getAnimations().forEach(n=>n.cancel())}catch{}}function Bd(e,t){const n=Ah(e,t);if(n===null)return;const r=e.wrapperEl;wx(e),r&&(r.style.transitionDuration="0ms");try{const s=e;s.setTransition?.(0),s.setTranslate?.(n),wx(e),r&&(r.style.transitionDuration="0ms",r.style.transform=`translate3d(${n}px, 0px, 0px)`)}catch{r&&(r.style.transitionDuration="0ms",r.style.transform=`translate3d(${n}px, 0px, 0px)`)}}function Gm(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 Ah(e,t){const n=e.snapGrid,r=Array.isArray(n)?n[t]:void 0;return typeof r!="number"||!Number.isFinite(r)?null:-r}function SD(e,t){const n=Gm(e),r=Ah(e,t);return n!==null&&r!==null&&Math.abs(n-r)<=Ov}function CD(e){const t=[],n=new Map,r=new Map,s=new Map;for(const o of e){const a=n.get(o.id)??[];if(a.push(o.id),n.set(o.id,a),o.sessionId){const d=r.get(o.sessionId)??[];d.push(o.id),r.set(o.sessionId,d)}if(o.mode==="tmux"&&o.tmuxSessionName){const d=s.get(o.tmuxSessionName)??[];d.push(o.id),s.set(o.tmuxSessionName,d)}}for(const[o,a]of n)a.length>1&&t.push({kind:"frontend",key:o,sessionIds:a});for(const[o,a]of r)a.length>1&&t.push({kind:"backend",key:o,sessionIds:a});for(const[o,a]of s)a.length>1&&t.push({kind:"tmux",key:o,sessionIds:a});return t}function jv(e){const t=new Map;for(const n of e)t.set(n.id,n);return Array.from(t.values())}function $v(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 _D(e,t){const n=jv(e),r=n.findIndex(s=>s.id===t.id);if(r>=0){const s=[...n];return s[r]=t,s}return[...n,t]}function Ax(e,t){const n=new Map(e.map(r=>[r.id,r]));return t.map(r=>{const s=n.get(r.sessionId);return{...$v(r),history:s?.history}})}function Tx(e,t){return e.length===0?null:t&&e.some(n=>n.sessionId===t)?t:e[0]?.sessionId??null}function Sx(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 Cx(e){const t=new Map;for(const[n,r]of e)t.set(n,r.cwd??null);return t}function LD(e,t){if(e.size!==t.size)return!1;for(const[n,r]of t)if(e.get(n)!==r)return!1;return!0}function kD(e){const t="".toLowerCase().replace(/[^a-z0-9_-]/g,"").slice(0,12);if(t)return`wt-${t}`;const n=Date.now().toString(36),r=Math.random().toString(36).slice(2,8);return`wt-${n}${r}`}const ED=({terminalSettings:e=Ng(),colorTheme:t="dark",toolbarPresets:n=[],showDebug:r,terminalFocusAvailable:s=!0,defaultSessionMode:o="shell",defaultTmuxSessionName:a="",connectionPrioritySessionId:d=null,connectionPriorityReady:h=!0,desktopPinnedRightSidebar:p=!1,desktopPinnedRightSidebarWidth:g=0,desktopPinnedLeftSidebarWidth:y=0,desktopViewportWidth:b=0,onStatusChange:v,onSessionDataUpdate:T,onInitialViewportReady:A})=>{const{t:L}=qn(),R=S.useMemo(()=>mc("session"),[]),D=S.useMemo(()=>mc("terminal"),[]),[B,j]=S.useState([]),[P,$]=S.useState(null),[z,H]=S.useState(null),[ye,q]=S.useState(!0),[te,ve]=S.useState({token:0,reason:"visibility",forceForegroundReconnect:!1}),[ge,ie]=S.useState(()=>new Set),[Ae,xe]=S.useState(()=>({token:0,completed:new Set})),[ce,K]=S.useState(0),[be,Se]=S.useState(()=>new Set),[We,ue]=S.useState(()=>new Set),[Ee,Tt]=S.useState(()=>new Set),Rt=S.useRef(!1),ze=S.useRef(null),X=S.useRef({}),[rt,qe]=S.useState(null),[re,J]=S.useState(()=>AD()),[$e,tt]=S.useState(!1),[gt,pt]=S.useState(null),[Ct,Le]=S.useState(null),[Te,Oe]=S.useState(null),[yt,de]=S.useState(!1),[Pe,ot]=S.useState(()=>Rp().mobile),[zt,yn]=S.useState(()=>Rp().landscape),[at,bt]=S.useState(null),[It,kt]=S.useState(null),$t=S.useRef(s),se=S.useRef(!1),Fe=S.useRef(!1),Je=S.useRef(null),Ot=S.useRef(null),je=S.useRef(Pe),ut=S.useRef(null),un=S.useRef(0),Be=S.useRef([]),hr=S.useRef(0),jn=S.useRef(null),Ne=S.useRef(!1),Pn=S.useRef(!0),dt=S.useRef(null),fr=S.useRef(""),In=S.useRef(null),Sr=S.useRef(0);S.useEffect(()=>{if(typeof window>"u")return;const U=()=>{const ee=Rp();je.current=ee.mobile,ot(ee.mobile),yn(ee.landscape)};return U(),window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[]);const{sessions:fn,inventory:Qn,activeSessionId:Br,isLoading:Rn,openSession:On,setActiveSession:pe,removeSession:tn,renameSession:Ue,resetSessionCustomName:as,reorderSessions:_s,restoreSessions:$r}=rD(),Ls=Qn?.tmuxRecovery??null;S.useEffect(()=>{Oe(null),Le(null)},[Ls?.id]);const ko=S.useCallback(async()=>{Le("restore"),Oe(null);try{const U=await dT();await $r(),U.failed>0&&Oe(L("tab.tmuxRecoveryPartial",{restored:U.restored,failed:U.failed}))}catch{Oe(L("tab.tmuxRecoveryFailed"))}finally{Le(null)}},[$r,L]),Jr=S.useCallback(async()=>{Le("dismiss"),Oe(null);try{await hT(),await $r()}catch{Oe(L("tab.tmuxRecoveryDismissFailed"))}finally{Le(null)}},[$r,L]),Ir=Et(U=>U.groupByFolder),rr=Et(U=>U.leftOpen||U.rightOpen),[sr,ri]=S.useState(()=>Cx(Bn.getState().sessions));S.useEffect(()=>Bn.subscribe(U=>{const ee=Cx(U.sessions);ri(fe=>LD(fe,ee)?fe:ee)}),[]);const{arranged:nr}=S.useMemo(()=>iv(B,U=>sr.get(U.id)??null,Ir,""),[B,sr,Ir]),Yn=S.useRef(nr);Yn.current=nr;const dn=S.useMemo(()=>TD(nr,re),[nr,re]),Sn=S.useRef(dn);Sn.current=dn;const an=S.useMemo(()=>F0(re,P),[P,re]),bn=S.useMemo(()=>{const U=dn.find(ee=>ee.sessions.some(fe=>fe.id===P));return new Set(U?.sessions.map(ee=>ee.id)??[])},[P,dn]),Pr=S.useMemo(()=>{const U=new Map;if(!p||b<=0)return U;for(const ee of dn){const fe=ee.sessions[0];if(!fe)continue;const ke=ee.sessions.some(nt=>nt.id===P)?g:QN(fe.id,sr.get(fe.id)??null,ee.workspace?.id??null),ht=sh(ke,b,y);U.set(ee.key,ht+Og)}return U},[P,sr,y,p,g,b,dn]),Ht=S.useMemo(()=>wp(B.map(U=>({id:U.id,backendSessionId:U.sessionId})),d),[d,B]),Cr=S.useMemo(()=>Tx(fn,Br),[Br,fn]),ln=Md({prioritySessionId:Ht,activeSessionId:z??P,persistedActiveSessionId:Cr,firstSessionId:B[0]?.id??null}),Ur=S.useMemo(()=>lN(dn.flatMap(U=>U.sessions.map(ee=>ee.id)),bn),[bn,dn]),Os=ln!==null&&ge.has(ln),ls=S.useMemo(()=>{const U=new Set(bn);return z&&U.add(z),!U.size&&ln&&U.add(ln),U},[bn,z,ln]),yr=Ae.token===te.token&&sN(ls,Ae.completed),ks=yr||ce===te.token?te.token:-1;S.useEffect(()=>{if(!te.token||yr)return;const U=window.setTimeout(()=>K(te.token),VM);return()=>window.clearTimeout(U)},[te.token,yr]);const $n=S.useCallback((U,ee)=>{ie(fe=>{if(fe.has(U)===ee)return fe;const ht=new Set(fe);return ee?ht.add(U):ht.delete(U),ht})},[]),cs=S.useCallback(U=>{const ee=un.current;xe(ke=>{if(ke.token===ee&&ke.completed.has(U))return ke;const ht=new Set(ke.token===ee?ke.completed:[]);return ht.add(U),{token:ee,completed:ht}});const fe=Ht??z??ut.current;U===fe&&eu("foreground-stream-connected")},[z,Ht]),si=S.useCallback((U,ee)=>{Se(fe=>{if(fe.has(U)===ee)return fe;const ke=new Set(fe);return ee?ke.add(U):ke.delete(U),ke})},[]),uo=S.useCallback((U,ee)=>{ue(fe=>{if(fe.has(U)===ee)return fe;const ke=new Set(fe);return ee?ke.add(U):ke.delete(U),ke})},[]),es=ln!==null&&be.has(ln),Y=ln!==null&&We.has(ln);S.useEffect(()=>{es&&eu("foreground-viewport-ready")},[es]),S.useEffect(()=>{Y&&eu("foreground-content-ready")},[Y]),S.useEffect(()=>{if(A){if(!ye&&B.length===0){A();return}!es||!Os||!Y||(eu("initial-viewport-presented"),A())}},[Os,Y,es,ye,A,B.length]);const he=S.useMemo(()=>Pe?ZM({slides:dn.map(U=>U.sessions.map(ee=>ee.id)),visibleSessionIds:bn,foregroundSessionId:ln}):Ee,[Pe,dn,bn,ln,Ee]);S.useEffect(()=>{if(Pe||bn.size===0)return;const U=new Set(bn),ee=dn.findIndex(fe=>fe.sessions.some(ke=>bn.has(ke.id)));for(let fe=-2;fe<=2;fe+=1)fe!==0&&dn[ee+fe]?.sessions.forEach(ke=>U.add(ke.id));Tt(fe=>{let ke=!1;const ht=new Set(fe);for(const nt of U)ht.has(nt)||(ht.add(nt),ke=!0);return ke?ht:fe})},[Pe,bn,dn]);const Ke=G8(he);S.useEffect(()=>{if(!z)return;if(!B.some(ee=>ee.id===z)){H(null);return}if(!be.has(z)||!ge.has(z)||!We.has(z))return;const U=window.setTimeout(()=>{H(ee=>ee===z?null:ee),$t.current&&!je.current&&qe({sessionId:z,token:Date.now()})},80);return()=>window.clearTimeout(U)},[We,z,ge,B,be]),S.useEffect(()=>{typeof window>"u"||(re.length>0?(window.localStorage.setItem(zm,JSON.stringify(re)),window.localStorage.removeItem(Fv)):window.localStorage.removeItem(zm))},[re]),S.useEffect(()=>{Rn||ye||re.length===0||J(U=>cD(U,B.map(ee=>ee.id)))},[Rn,ye,B,re.length]),S.useEffect(()=>{if(!gt)return;const U=window.setTimeout(()=>pt(null),3200);return()=>window.clearTimeout(U)},[gt]),S.useEffect(()=>()=>In.current?.(),[]),ut.current=P,un.current=te.token,Be.current=B,jn.current=Br,Ne.current=Rn,Pn.current=ye,$t.current=s;const _e=S.useCallback((U=ze.current)=>{const ee=hr.current,fe=typeof window<"u"?window.visualViewport:null,ke=U?Gm(U):null,ht=U?Ah(U,ee):null;return{sessionsLength:Be.current.length,workspaceSlidesLength:Sn.current.length,sessionIds:Be.current.map(nt=>nt.id),activeSessionId:ut.current,activeSessionIndex:ee,persistedActiveId:jn.current,isLoading:Ne.current,isRestoring:Pn.current,activeIndex:U?.activeIndex??null,previousIndex:U?.previousIndex??null,animating:U?.animating??null,allowTouchMove:U?.allowTouchMove??null,width:U?.width??null,translate:ke,targetTranslate:ht,translateDelta:ke!==null&&ht!==null?ke-ht:null,snapGridLength:U?.snapGrid?.length??null,targetSnap:U?.snapGrid?.[ee]??null,visualViewport:fe?{width:Math.round(fe.width),height:Math.round(fe.height),offsetTop:Math.round(fe.offsetTop)}:null}},[]),Ie=S.useCallback((U,ee)=>{R(U,{..._e(),...ee})},[R,_e]);S.useEffect(()=>{Rn||ye||P!==Br&&pe(P)},[P,Rn,ye,Br,pe]);const Ge=S.useMemo(()=>{if(nr.length===0||!P)return 0;const U=dn.findIndex(ee=>ee.sessions.some(fe=>fe.id===P));return U>=0?U:0},[dn,P]);hr.current=Ge;const lt=S.useCallback(()=>{Je.current&&(clearTimeout(Je.current),Je.current=null)},[]),et=S.useCallback(U=>{lt(),Je.current=setTimeout(()=>{Je.current=null,se.current=!1,Ie("[swiper:touch-guard-clear]",{reason:U})},pD)},[lt,Ie]),Ze=S.useCallback((U,ee={})=>{const fe=ze.current,ke=hr.current,ht=Sn.current;if(!fe||ht.length===0||ke<0||ke>=ht.length)return;if(se.current){Ie("[swiper:sync-skip-touch]",{reason:U});return}if(fe.animating){Ie("[swiper:sync-skip-animating]",{reason:U});return}const nt=Gm(fe),Bt=Ah(fe,ke),_t=nt!==null&&Bt!==null&&Math.abs(nt-Bt)<=Ov,Nt=fe.activeIndex===ke;if(Ie("[swiper:sync-check]",{reason:U,activeIndexAligned:Nt,translateAligned:_t,immediate:ee.immediate===!0}),!(Nt&&_t)){if(Nt){Bd(fe,ke),Ie("[swiper:sync-forced-active]",{reason:U,translateAligned:_t,immediate:ee.immediate===!0});return}ee.immediate?(Bd(fe,ke),fe.slideTo(ke,0,!1),Bd(fe,ke)):fe.slideTo(ke,Hm,!1),Ie("[swiper:sync-applied]",{reason:U,activeIndexAligned:Nt,translateAligned:_t,immediate:ee.immediate===!0})}},[Ie]);S.useEffect(()=>{const U=ee=>{const fe=ee;ze.current&&(ze.current.allowTouchMove=!fe.detail.locked),Ie("[swiper:gesture-lock]",{locked:fe.detail.locked})};return document.addEventListener("termdock:gesture-lock",U),()=>document.removeEventListener("termdock:gesture-lock",U)},[Ie]),S.useEffect(()=>{if(B.length===0){P!==null&&$(null);return}if(!P){if(!h)return;$(Md({prioritySessionId:Ht,activeSessionId:null,persistedActiveSessionId:Cr,firstSessionId:B[0]?.id??null}));return}B.some(ee=>ee.id===P)||$(B[0].id)},[B,P,h,Ht,Cr]);const it=S.useCallback((U,ee)=>{if(ee&&Date.now()<Sr.current){X.current[U]=!1;return}X.current[U]=ee,kt(fe=>ee?U:fe===U?null:fe)},[]),pn=S.useCallback(U=>{if(!se.current&&U.activeIndex!==hr.current){Ie("[swiper:slide-change-ignored-layout]",{instanceActiveIndex:U.activeIndex,expectedActiveIndex:hr.current}),requestAnimationFrame(()=>Ze("ignored-layout-slide-change",{immediate:!0}));return}const ee=Sn.current[U.activeIndex],fe=ee?.sessions.some(nt=>nt.id===P)?P:ee?.sessions[0]?.id;if(Ie("[swiper:slide-change]",{nextSessionId:fe??null,instanceActiveIndex:U.activeIndex}),!fe||fe===P)return;const ke=!!P&&X.current[P]===!0,ht=$t.current&&(!je.current||ke);if(Ot.current=fe,$(fe),ht){qe({sessionId:fe,token:Date.now()});return}qe(null)},[B,P,Ie,Ze]);S.useEffect(()=>{if(Ot.current===P){Ie("[swiper:sync-skip-swiper-driven]",{activeSessionId:P}),Ot.current=null;return}Ze("active-session-index",{immediate:!0})},[P,Ge,B.length,Ze,Ie]),S.useEffect(()=>{const U=ze.current;if(!U)return;const ee=dn.length>1&&!rr&&!$e;U.allowTouchMove!==ee&&(U.allowTouchMove=ee,Ie("[swiper:allow-touch-sync]",{nextAllow:ee,sidebarOverlayOpen:rr}))},[dn.length,Ie,rr,$e]);const vt=S.useCallback(U=>{const ee=ze.current;if(!ee)return;const fe=ee.el;if(Ie("[swiper:layout-before]",{reason:U,scrollLeft:fe?.scrollLeft??null}),fe&&(fe.scrollLeft=0),ee.updateSize(),ee.updateSlides(),ee.updateProgress(),ee.updateSlidesClasses(),fe&&(fe.scrollLeft=0),Ie("[swiper:layout-after]",{reason:U,scrollLeft:fe?.scrollLeft??null}),se.current||ee.animating){Ie("[swiper:layout-skip-sync-motion]",{reason:U});return}Ze(`layout:${U}`,{immediate:!0}),requestAnimationFrame(()=>{const ke=ze.current;ke&&(se.current||ke.animating||Bd(ke,hr.current))})},[Ie,Ze]);S.useEffect(()=>()=>lt(),[lt]);const mn=dn.map(U=>U.key).join("\0");S.useEffect(()=>{requestAnimationFrame(()=>vt("group-change"))},[Ir,mn,vt]),S.useEffect(()=>{let U=null,ee="mount";const fe=_t=>{ee=_t,U===null&&(U=requestAnimationFrame(()=>{U=null,vt(`viewport-change:${ee}`)}))},ke=()=>fe("window-resize"),ht=()=>fe("visual-viewport-resize"),nt=()=>fe("visual-viewport-scroll"),Bt=_t=>{fe(`measured:${_t.detail?.source??"unknown"}`)};return window.addEventListener("resize",ke),window.visualViewport?.addEventListener("resize",ht),window.visualViewport?.addEventListener("scroll",nt),document.addEventListener(Mm,Bt),fe("mount"),()=>{window.removeEventListener("resize",ke),window.visualViewport?.removeEventListener("resize",ht),window.visualViewport?.removeEventListener("scroll",nt),document.removeEventListener(Mm,Bt),U!==null&&cancelAnimationFrame(U)}},[vt]),S.useEffect(()=>{if(typeof document>"u")return;let U=null,ee=null;const fe=Nt=>{if(Nt!=="online"&&document.hidden)return;const Fn=performance.now();if(!iN(ee,Fn))return;ee=Fn;const Cn=Nt==="bfcache"||Nt==="online"?Nt:"visibility",nn=oN();Qf(),wo("info","PWA_RESUME scheduled",{source:Nt,forceForegroundReconnect:nn,activeSessionId:ut.current}),ve(_n=>({token:_n.token+1,reason:Cn,forceForegroundReconnect:nn})),requestAnimationFrame(()=>vt(`resume:${Nt}:raf`)),U&&clearTimeout(U),U=setTimeout(()=>{U=null,vt(`resume:${Nt}:settled`)},320)},ke=()=>{if(document.hidden){Qf();return}fe("visibility")},ht=()=>{Qf()},nt=Nt=>{fe(Nt.persisted?"bfcache":"pageshow")},Bt=()=>fe("online"),_t=()=>fe("focus");return document.addEventListener("visibilitychange",ke),window.addEventListener("pagehide",ht),window.addEventListener("pageshow",nt),window.addEventListener("online",Bt),window.addEventListener("focus",_t),()=>{document.removeEventListener("visibilitychange",ke),window.removeEventListener("pagehide",ht),window.removeEventListener("pageshow",nt),window.removeEventListener("online",Bt),window.removeEventListener("focus",_t),U&&clearTimeout(U)}},[vt]),S.useEffect(()=>{if(!nN(ye))return;const U=CD(B),ee=JSON.stringify(U);U.length>0&&ee!==fr.current?(fr.current=ee,console.warn("[session-invariant] duplicate mapping detected",U)):U.length===0&&fr.current&&(fr.current=""),T?.({sessions:B.map(fe=>({id:fe.id,name:fe.name,customName:fe.customName,mode:fe.mode,tmuxSessionName:fe.tmuxSessionName})),activeSessionId:P,splitWorkspaces:re.map(({id:fe,name:ke,sessionIds:ht,layout:nt})=>({id:fe,...ke?{name:ke}:{},sessionIds:ht,layout:nt}))})},[B,P,re,T,ye]),S.useEffect(()=>{if(Rn||Rt.current)return;Rt.current=!0;const U=wp(fn.map(nt=>({id:nt.sessionId,backendSessionId:nt.backendSessionId??null})),d),ee=Tx(fn,Br),fe=Md({prioritySessionId:h?U:null,activeSessionId:null,persistedActiveSessionId:ee,firstSessionId:fn[0]?.sessionId??null}),ke=jv(fn.map($v));if(R("[Session] Restoring",ke.length,"persisted sessions (one-shot)"),Ie("[swiper:restore-start]",{persistedSessionIds:fn.map(nt=>nt.sessionId),nextActiveSessionId:fe}),ke.length>0){const nt=Bn.getState();ke.forEach(_t=>{_t.sessionId&&nt.setTerminalSession(_t.id,{sessionId:_t.sessionId,cols:80,rows:24,mode:_t.mode,tmuxSessionName:_t.tmuxSessionName,history:_t.history})}),fn.forEach(_t=>{_t.activeProgram!=null&&nt.setSessionActiveProgram(_t.sessionId,_t.activeProgram),_t.cwd!=null&&nt.setSessionCwd(_t.sessionId,_t.cwd)}),j(ke);const Bt=fe||ke[0]?.id||null;$(Bt),Ie("[swiper:restore-complete]",{restoredSessionIds:ke.map(_t=>_t.id),nextActiveSessionId:Bt})}(async()=>(ke.length===0&&await dt.current?.({createIfEmpty:!0}),q(!1),requestAnimationFrame(()=>Ze("restore-finished",{immediate:!0}))))()},[Rn,fn,Br,R,Ie,Ze,h,d]),S.useEffect(()=>{if(!h||ye||B.length===0)return;const U=wp(B.map(fe=>({id:fe.id,backendSessionId:fe.sessionId})),d),ee=Md({prioritySessionId:U,activeSessionId:ut.current,persistedActiveSessionId:Cr,firstSessionId:B[0]?.id??null});ee&&ee!==ut.current&&$(ee)},[h,d,ye,Cr,B]);const ct=S.useRef([]),Pt=S.useRef(!1);ut.current=P,S.useEffect(()=>{if(ye)return;const U=ct.current,ee=fn;if(!Pt.current){j(Nt=>Ax(Nt,ee)),ct.current=ee,Pt.current=!0;return}const fe=new Set(U.map(Nt=>Nt.sessionId)),ke=new Set(ee.map(Nt=>Nt.sessionId)),ht=new Map(U.map(Nt=>[Nt.sessionId,Nt.name]));ct.current=ee,j(Nt=>{const Fn=Ax(Nt,ee);return(!ut.current||!Fn.some(Cn=>Cn.id===ut.current))&&$(Fn[0]?.id??null),Fn});const nt=ee.filter(Nt=>!fe.has(Nt.sessionId)),Bt=[...fe].filter(Nt=>!ke.has(Nt)),_t=ee.filter(Nt=>fe.has(Nt.sessionId)&&ht.get(Nt.sessionId)!==Nt.name);(nt.length>0||Bt.length>0||_t.length>0)&&R("[Session] Synced persisted sessions:",{newSessionIds:nt.map(Nt=>Nt.sessionId),removedSessionIds:Bt,renamedSessionIds:_t.map(Nt=>Nt.sessionId),currentSessionIds:ee.map(Nt=>Nt.sessionId)});for(const Nt of ee){if(!Nt.backendSessionId)continue;Bn.getState().setTerminalSession(Nt.sessionId,{sessionId:Nt.backendSessionId,cols:80,rows:24,mode:Nt.mode,tmuxSessionName:Nt.tmuxSessionName})}},[fn,ye,R]);const Xt=S.useCallback(async U=>{try{const ee=U?.mode==="tmux"||U?.mode==="shell"?U.mode:o,fe=(U?.tmuxSessionName||"").trim(),ke=a.trim(),ht=ee==="tmux"?fe||ke||kD():null,nt=typeof U?.cwd=="string"?U.cwd:null,Bt=P?Bn.getState().sessions.get(P)?.cwd??null:null,_t=typeof nt=="string"&&nt.trim().length>0?nt:typeof Bt=="string"&&Bt.trim().length>0?Bt:void 0,Nt=await On({mode:ee,tmuxSessionName:ht,cwd:_t,termType:"xterm-256color",createIfEmpty:U?.createIfEmpty===!0}),Fn=Nt.session,Cn=Nt.terminalSession,nn={id:Fn.sessionId,name:Fn.name,customName:Fn.customName===!0,sessionId:Cn.sessionId,mode:Cn.mode??Fn.mode,tmuxSessionName:Cn.tmuxSessionName??Fn.tmuxSessionName};j(_r=>_D(_r,nn)),$(nn.id),Bn.getState().setTerminalSession(nn.id,{sessionId:Cn.sessionId,cols:80,rows:24,mode:nn.mode,tmuxSessionName:nn.tmuxSessionName,activeProgram:Cn.activeProgram,activeProgramRaw:Cn.activeProgramRaw,activeProgramSource:Cn.activeProgramSource,cwd:Cn.cwd}),R("[Session] Inventory opened session:",{frontendSessionId:nn.id,backendSessionId:Cn.sessionId,reused:Nt.reused,mode:nn.mode,tmuxSessionName:nn.tmuxSessionName});const ir=U?.command?.trim();return ir&&await $b(Cn.sessionId,`${ir}\r`),nn.id}catch(ee){return console.error("[Session] Failed to create new session:",ee),null}},[o,a,P,On,R]);dt.current=Xt;const hn=S.useCallback((U,ee={})=>{const fe=ut.current,ke=!!fe&&X.current[fe]===!0;if($(U),je.current&&ee.preserveMobileKeyboard===!1){Sr.current=Date.now()+600,fe&&(X.current[fe]=!1),kt(null),qe(null);const ht=document.activeElement;ht instanceof HTMLTextAreaElement&&ht.closest(".terminal-viewport-container")&&ht.blur();return}ke&&je.current&&kt(U),$t.current&&(!je.current||ke)&&qe({sessionId:U,token:Date.now()})},[]),Tn=S.useCallback(U=>{$(U),tt(!0),pt(null)},[]),br=S.useCallback(U=>{const ee=ut.current;!ee||ee===U||(J(fe=>Ip(fe,ee,U)),tt(!1),hn(ee,{preserveMobileKeyboard:!1}))},[hn]),vr=S.useCallback(async()=>{const U=ut.current;if(!U||yt)return;de(!0);const ee=Bn.getState().sessions.get(U)?.cwd??void 0,fe=await Xt({cwd:ee||void 0,mode:o});if(de(!1),!fe){pt(L("common.error"));return}J(ke=>Ip(ke,U,fe)),tt(!1),hn(U,{preserveMobileKeyboard:!1})},[hn,o,Xt,yt,L]),us=S.useCallback(U=>{J(ee=>dD(ee,U)),U&&hn(U,{preserveMobileKeyboard:!1})},[hn]),Fs=S.useCallback(U=>{J(ee=>uD(ee,U)),hn(U,{preserveMobileKeyboard:!1})},[hn]),Es=S.useCallback((U,ee,fe,ke,ht,nt="linear",Bt)=>{U.preventDefault(),U.stopPropagation();const _t=U.currentTarget,Nt=U.pointerId,Fn={x:U.clientX,y:U.clientY};_t.setPointerCapture?.(Nt);const Cn=ee.getBoundingClientRect();let nn=!Pe,_n=null;const ir=Un=>{if(Un.pointerId!==Nt)return;if(!nn){Math.hypot(Un.clientX-Fn.x,Un.clientY-Fn.y)>bD&&_n!==null&&(window.clearTimeout(_n),_n=null);return}Un.preventDefault();const sn=fe?(Un.clientY-Cn.top)/Cn.height:(Un.clientX-Cn.left)/Cn.width,Ut=fe?Cn.height:Cn.width,qt=Pe?0:fe?wD:vD;J(vn=>vn.map(Yt=>{if(Yt.id!==ke)return Yt;const on=Bt??Yt.sessionIds.length,or=nt==="grid-columns"?Yt.gridColumnRatios:nt==="grid-rows"?Yt.gridRowRatios:Yt.ratios,Us=cc(or,on),Hr=Us[ht]+Us[ht+1],ar=qt>0?Math.min(Hr/2,qt/Math.max(1,Ut)):Math.min(Hr/2,xD),Gn=oD(Us,ht,sn,ar);return nt==="grid-columns"?{...Yt,gridColumnRatios:Gn}:nt==="grid-rows"?{...Yt,gridRowRatios:Gn}:{...Yt,ratios:Gn}}))},_r=()=>{_n!==null&&(window.clearTimeout(_n),_n=null),window.removeEventListener("pointermove",ir),window.removeEventListener("pointerup",_r),window.removeEventListener("pointercancel",_r),_t.classList.remove("bg-primary"),Pe&&document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),In.current=null};In.current?.(),In.current=_r,window.addEventListener("pointermove",ir),window.addEventListener("pointerup",_r),window.addEventListener("pointercancel",_r),Pe&&(document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}})),_n=window.setTimeout(()=>{_n=null,nn=!0,_t.classList.add("bg-primary"),navigator.vibrate?.(8)},yD))},[Pe]),js=S.useCallback(U=>{if(B.find(fe=>fe.id===U)){if(U===ut.current)return;if($(U),!JM({isMobile:je.current,viewportReady:be.has(U),streamReady:ge.has(U),contentReady:We.has(U)})){H(null),$t.current&&qe({sessionId:U,token:Date.now()}),R("[Session] Switched to session:",U);return}Tt(ke=>{if(ke.has(U))return ke;const ht=new Set(ke);return ht.add(U),ht}),H(U),R("[Session] Switched to session:",U)}},[We,R,ge,B,be]),$s=S.useCallback((U,ee)=>{ee.trim()&&(j(fe=>fe.map(ke=>ke.id===U?{...ke,name:ee.trim(),customName:!0}:ke)),Ue(U,ee.trim()))},[Ue]),Ki=S.useCallback(U=>{j(ee=>ee.map(fe=>fe.id===U?{...fe,customName:!1}:fe)),as(U)},[as]),Rr=S.useCallback(U=>{j(ee=>{const fe=new Map(ee.map(Bt=>[Bt.id,Bt])),ke=U.map(Bt=>fe.get(Bt)).filter(Bt=>Bt!==void 0),ht=new Set(U),nt=ee.filter(Bt=>!ht.has(Bt.id));return[...ke,...nt]}),_s(U),R("[Session] Reordered sessions:",U),requestAnimationFrame(()=>{ze.current?.update()})},[_s,R]),Nn=S.useCallback(async U=>{const ee=typeof U=="string"?U:U.sessionId,fe=typeof U=="string"?"auto":U.closeMode??"auto",ke=B.find(nt=>nt.id===ee);if(!ke)return;const ht=Dv(nr,ee,nt=>nt.id);try{fe==="destroy"&&ke.mode==="tmux"&&ke.tmuxSessionName?(await zb(ke.tmuxSessionName),R("[Session] Destroyed tmux session:",{frontendSessionId:ke.id,tmuxSessionName:ke.tmuxSessionName})):ke.sessionId&&(await Hb(ke.sessionId),R("[Session] Closed backend terminal:",ke.sessionId))}catch(nt){console.error("[Session] Failed to close backend terminal:",nt);return}j(nt=>{const Bt=nt.filter(_t=>_t.id!==ee);return $(ht),Bt}),tn(ee,ht),delete X.current[ee],R("[Session] Closed session:",{sessionId:ee,closeMode:fe})},[B,nr,tn,R]),Dn=S.useCallback(U=>{if(!U)return;const ee=B.filter(fe=>fe.sessionId===U);if(ee.length!==0){ee.length>1&&console.warn("[session-invariant] backend matched multiple frontend sessions during cleanup",{backendSessionId:U,frontendSessionIds:ee.map(fe=>fe.id)}),j(fe=>{const ke=fe.filter(ht=>ht.sessionId!==U);return ke.length!==fe.length&&!ke.some(nt=>nt.id===P)&&$(ke.length>0?ke[0].id:null),ke});for(const fe of ee)tn(fe.id),delete X.current[fe.id];R("[Session] Backend gone, dropped local session(s):",ee.map(fe=>fe.id))}},[B,P,tn,R]);S.useEffect(()=>{const U=sn=>{Xt(sn.detail)},ee=sn=>{js(sn.detail)},fe=()=>{const sn=ut.current;!sn||je.current||qe({sessionId:sn,token:Date.now()})},ke=sn=>{const Ut=sn;Ut.detail&&Tn(Ut.detail)},ht=sn=>{const Ut=sn.detail;us(Ut??ut.current??void 0)},nt=sn=>{const Ut=sn.detail;Ut&&Fs(Ut)},Bt=sn=>{const Ut=sn.detail,qt=typeof Ut=="string"?Ut:Ut?.layout,vn=typeof Ut=="string"?ut.current:Ut?.sessionId;qt!=="horizontal"&&qt!=="vertical"&&qt!=="grid"||J(Yt=>Yt.map(on=>on.sessionIds.includes(vn??"")?{...on,layout:qt}:on))},_t=sn=>{const qt=sn.detail?.direction;if(qt!=="prev"&&qt!=="next")return;const vn=Yn.current;if(vn.length<=1)return;const Yt=ut.current,on=Yt?vn.findIndex(Gn=>Gn.id===Yt):-1,Hr=((on>=0?on:0)+(qt==="next"?1:-1)+vn.length)%vn.length,ar=vn[Hr]?.id;ar&&ar!==Yt&&js(ar)},Nt=sn=>{Nn(sn.detail)},Fn=sn=>{Dn(sn.detail)},Cn=sn=>{const Ut=sn;!Ut.detail?.sessionId||!Ut.detail?.name||$s(Ut.detail.sessionId,Ut.detail.name)},nn=sn=>{const Ut=sn;Ut.detail?.sessionId&&Ki(Ut.detail.sessionId)},_n=sn=>{const Ut=sn;Ut.detail?.sessionIds&&Rr(Ut.detail.sessionIds)},ir=sn=>{const Ut=sn.detail;!Ut?.workspaceId||!Array.isArray(Ut.sessionIds)||J(qt=>hD(qt,Ut.workspaceId,Ut.sessionIds))},_r=sn=>{const Ut=sn.detail;!Ut?.workspaceId||typeof Ut.name!="string"||J(qt=>fD(qt,Ut.workspaceId,Ut.name))},Un=sn=>{const Ut=sn.detail;!Ut?.primaryId||!Ut.secondaryId||Ut.primaryId===Ut.secondaryId||(J(qt=>Ip(qt,Ut.primaryId,Ut.secondaryId)),hn(Ut.primaryId,{preserveMobileKeyboard:!1}))};return window.addEventListener("new-terminal-session",U),window.addEventListener("switch-terminal-session",ee),window.addEventListener("focus-active-terminal-session",fe),window.addEventListener("open-terminal-split-chooser",ke),window.addEventListener("close-terminal-split",ht),window.addEventListener("remove-terminal-split-pane",nt),window.addEventListener("set-terminal-split-direction",Bt),window.addEventListener("cycle-terminal-session",_t),window.addEventListener("close-terminal-session",Nt),window.addEventListener("close-terminal-session-by-backend",Fn),window.addEventListener("rename-terminal-session",Cn),window.addEventListener("reset-terminal-session-name",nn),window.addEventListener("reorder-terminal-session",_n),window.addEventListener("reorder-terminal-split-workspace",ir),window.addEventListener("rename-terminal-split-workspace",_r),window.addEventListener("combine-terminal-split-sessions",Un),()=>{window.removeEventListener("new-terminal-session",U),window.removeEventListener("switch-terminal-session",ee),window.removeEventListener("focus-active-terminal-session",fe),window.removeEventListener("open-terminal-split-chooser",ke),window.removeEventListener("close-terminal-split",ht),window.removeEventListener("remove-terminal-split-pane",nt),window.removeEventListener("set-terminal-split-direction",Bt),window.removeEventListener("cycle-terminal-session",_t),window.removeEventListener("close-terminal-session",Nt),window.removeEventListener("close-terminal-session-by-backend",Fn),window.removeEventListener("rename-terminal-session",Cn),window.removeEventListener("reset-terminal-session-name",nn),window.removeEventListener("reorder-terminal-session",_n),window.removeEventListener("reorder-terminal-split-workspace",ir),window.removeEventListener("rename-terminal-split-workspace",_r),window.removeEventListener("combine-terminal-split-sessions",Un)}},[hn,Xt,js,Tn,us,Fs,Nn,Dn,$s,Ki,Rr]),S.useEffect(()=>{if(!an||Pe)return;const U=ee=>{if(!(ee.ctrlKey||ee.metaKey)||!ee.shiftKey)return;if(an.layout==="horizontal"?ee.key==="ArrowLeft"||ee.key==="ArrowRight":an.layout==="vertical"?ee.key==="ArrowUp"||ee.key==="ArrowDown":ee.key.startsWith("Arrow")){ee.preventDefault(),ee.stopPropagation();const ke=an.sessionIds.indexOf(ut.current??""),ht=ee.key==="ArrowLeft"||ee.key==="ArrowUp"?-1:1,nt=(Math.max(0,ke)+ht+an.sessionIds.length)%an.sessionIds.length,Bt=an.sessionIds[nt];if(!Bt)return;hn(Bt);return}ee.key==="Backspace"&&(ee.preventDefault(),ee.stopPropagation(),us(ut.current??void 0))};return window.addEventListener("keydown",U,!0),()=>window.removeEventListener("keydown",U,!0)},[hn,an,us,Pe]);const Wr=U=>{const ee=Bn.getState().sessions.get(U.id);return tl(U,ee?.activeProgram??null,ee?.cwd??null,void 0,ee?.shellTitle??null,ee?.promptState??null)},ts=(U,ee={})=>{const fe=U.id===P,ke=bn.has(U.id)&&!ee.hidden,ht=h&&XM({sessionId:U.id,foregroundSessionId:ln,visibleSessionIds:bn,deferredViewportSessionIds:Pe?Ke:he}),nt=KM({sessionId:U.id,foregroundSessionId:ln,foregroundReady:Os,isVisible:ke})&&h,Bt=rN({sessionId:U.id,foregroundSessionId:ln,requestToken:te.token,foregroundCompletedToken:ks,isVisible:ls.has(U.id)})&&h,_t=ke||U.id===ln||he.has(U.id)?0:Ur.get(U.id)??nh;return u.jsx("div",{className:`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden ${ee.hidden?"invisible pointer-events-none":""}`,style:ee.containerStyle,"aria-hidden":ee.hidden||void 0,onPointerDown:()=>{!fe&&ke&&hn(U.id)},onWheelCapture:()=>{iD(fe,()=>hn(U.id))},children:u.jsx("div",{className:"min-h-0 flex-1 app-chrome-bg",children:ht&&u.jsx(qN,{sessionId:U.id,mode:U.mode,tmuxSessionName:U.tmuxSessionName,terminalSettings:e,colorTheme:t,toolbarPresets:n,isActive:fe,focusSuspended:z!==null,deferCursorUntilPositioned:z===U.id||U.mode==="tmux"&&!We.has(U.id),isLayoutVisible:ke,initialConnectEnabled:nt&&Bt,resumeRequestEnabled:Bt,suppressKeyboard:ee.suppressKeyboard,keyboardPortalTarget:ee.keyboardPortalTarget,sharedMobileKeyboardLayout:ee.sharedMobileKeyboardLayout,suppressPageFlipRefresh:ee.suppressPageFlipRefresh,focusRequestToken:rt?.sessionId===U.id?rt.token:0,resumeRequestToken:te.token,resumeRequestReason:te.reason,forceResumeReconnect:te.forceForegroundReconnect&&ls.has(U.id),resumeRequestDelayMs:ls.has(U.id)?0:ee.hidden?nh:Ur.get(U.id)??nh,initialConnectDelayMs:_t,onStreamReadyChange:$n,onStreamConnected:cs,onViewportReadyChange:si,onContentReadyChange:uo,onKeyboardVisibilityChange:it,showDebug:r,onStatusChange:fe?v:void 0})})},U.id)};return u.jsxs("div",{className:"relative h-full flex flex-col",children:[Ls&&u.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:u.jsxs("div",{className:"flex items-start gap-3",children:[u.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:u.jsx(b3,{size:18})}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("h2",{className:"text-[13px] font-semibold text-foreground",children:L("tab.tmuxRecoveryTitle",{count:Ls.sessions.length})}),u.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:L("tab.tmuxRecoveryHint")}),u.jsx("p",{className:"mt-1.5 truncate text-[10px] text-foreground/70",children:Ls.sessions.map(U=>U.name).join(" · ")}),Te&&u.jsx("p",{className:"mt-2 text-[10px] text-destructive",children:Te}),u.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[u.jsxs("button",{type:"button",disabled:Ct!==null,onClick:()=>{ko()},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:[u.jsx(y3,{size:13,className:Ct==="restore"?"animate-spin":""}),L(Ct==="restore"?"tab.tmuxRecoveryRestoring":"tab.tmuxRecoveryRestoreAll")]}),u.jsx("button",{type:"button",disabled:Ct!==null,onClick:()=>{Jr()},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:L("tab.tmuxRecoveryDismiss")})]})]})]})}),u.jsx("div",{className:"flex-1 overflow-hidden",children:u.jsx(Db,{onSwiper:U=>{ze.current=U,U.allowTouchMove=dn.length>1&&!rr&&!$e,Ie("[swiper:on-swiper]",{allowTouchMove:U.allowTouchMove}),requestAnimationFrame(()=>vt("on-swiper"))},onSlideChange:pn,onTouchStart:(U,ee)=>{const fe=Sx(ee),ke=fe==="touch"||fe==="pen"||fe==="unknown";D("[swipe:touch-start]",{pointerType:fe,allowed:ke}),Ie("[swiper:touch-start]",{pointerType:fe,allowed:ke}),ke&&(lt(),Fe.current=!0,se.current=!0)},onTouchEnd:(U,ee)=>{const fe=Sx(ee),ke=fe==="touch"||fe==="pen"||fe==="unknown";D("[swipe:touch-end]",{pointerType:fe,allowed:ke}),Ie("[swiper:touch-end]",{pointerType:fe,allowed:ke}),ke&&(Fe.current=!1,et("touch-end"))},onTransitionEnd:()=>{const U=ze.current;if(Fe.current){Ie("[swiper:transition-end-during-touch]");return}if(se.current&&U&&!SD(U,hr.current)){Ie("[swiper:transition-end-deferred]");return}lt(),se.current=!1,Ie("[swiper:transition-end]")},initialSlide:Math.max(0,Ge),speed:Hm,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:dn.map(U=>{const ee=U.workspace,fe=!!ee&&U.sessions.length>=2,ke=Pe?zt?"horizontal":"vertical":ee?.layout??"horizontal",ht=ke==="vertical",nt=ee?.ratios.length===U.sessions.length?ee.ratios:Fa(U.sessions.length),Bt=It?U.sessions.findIndex(qt=>qt.id===It):-1,_t=Pe&&It?U.sessions.some(qt=>qt.id===It):!1,Nt=U.sessions.some(qt=>qt.id===P)?P:U.sessions[0]?.id,Fn=nt.flatMap((qt,vn)=>[_t&&vn!==Bt?"0px":`minmax(0, ${qt}fr)`,...vn<nt.length-1?[_t?"0px":"1px"]:[]]).join(" "),{columns:Cn,rows:nn}=Qv(U.sessions.length),_n=cc(ee?.gridColumnRatios,Cn),ir=cc(ee?.gridRowRatios,nn),_r=_n.slice(0,-1).map((qt,vn)=>_n.slice(0,vn+1).reduce((Yt,on)=>Yt+on,0)),Un=ir.slice(0,-1).map((qt,vn)=>ir.slice(0,vn+1).reduce((Yt,on)=>Yt+on,0)),sn=U.sessions.length%Cn,Ut={...ke==="grid"?{gridTemplateColumns:_n.map(qt=>`minmax(0, ${qt}fr)`).join(" "),gridTemplateRows:ir.map(qt=>`minmax(0, ${qt}fr)`).join(" "),gap:"1px"}:ht?{gridTemplateRows:Fn}:{gridTemplateColumns:Fn},...Pe?{marginTop:"var(--kb-margin-top, 0px)",transition:"none"}:{}};return u.jsx(Bb,{className:"h-full",children:u.jsx("div",{className:"h-full min-w-0","data-pinned-right-sidebar-inset":Pr.get(U.key)??0,style:{paddingRight:Pr.get(U.key)??0},children:fe?u.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--chrome-bg)]",style:Pe?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,children:[u.jsxs("div",{"data-split-container":"true",className:"relative grid min-h-0 min-w-0 flex-1 overflow-hidden",style:Ut,children:[U.sessions.map((qt,vn)=>u.jsxs(_.Fragment,{children:[ts(qt,{suppressKeyboard:Pe&&qt.id!==Nt,keyboardPortalTarget:Pe?at:null,sharedMobileKeyboardLayout:Pe,suppressPageFlipRefresh:!0,hidden:_t&&Bt!==vn,containerStyle:ke==="grid"&&sn>0&&vn===U.sessions.length-1?{gridColumn:`span ${Cn-sn+1}`}:void 0}),ke!=="grid"&&vn<U.sessions.length-1&&ee&&u.jsx("button",{type:"button",className:`swiper-no-swiping relative z-20 touch-none select-none bg-[var(--border-strong)] transition-colors hover:bg-primary active:bg-primary ${ht?"cursor-row-resize":"cursor-col-resize"} ${_t?"invisible pointer-events-none":""}`,onPointerDownCapture:Yt=>{const on=Yt.currentTarget.closest('[data-split-container="true"]');on instanceof HTMLDivElement&&Es(Yt,on,ht,ee.id,vn)},onDoubleClick:Yt=>{Pe||(Yt.preventDefault(),Yt.stopPropagation(),J(on=>on.map(or=>or.id===ee.id?{...or,ratios:Fa(or.sessionIds.length)}:or)))},onContextMenu:Yt=>{Pe&&Yt.preventDefault()},"aria-label":L("tab.split"),children:u.jsx("span",{"aria-hidden":"true","data-split-divider-hitarea":"true",className:`absolute ${ht?"inset-x-0":"inset-y-0"}`,style:ht?{top:-12,bottom:-12}:{left:-12,right:-12}})})]},qt.id)),ke==="grid"&&ee&&_r.map((qt,vn)=>u.jsx("button",{type:"button","data-split-grid-column-divider":vn,className:"swiper-no-swiping absolute top-0 z-20 w-px -translate-x-1/2 touch-none select-none cursor-col-resize bg-[var(--border-strong)] transition-colors hover:bg-primary active:bg-primary",style:{left:`${qt*100}%`,bottom:sn===0||vn<sn-1?0:`${(ir.at(-1)??0)*100}%`},onPointerDownCapture:Yt=>{const on=Yt.currentTarget.closest('[data-split-container="true"]');on instanceof HTMLDivElement&&Es(Yt,on,!1,ee.id,vn,"grid-columns",Cn)},onDoubleClick:Yt=>{Yt.preventDefault(),Yt.stopPropagation(),J(on=>on.map(or=>or.id===ee.id?{...or,gridColumnRatios:Fa(Cn)}:or))},"aria-label":L("tab.split"),children:u.jsx("span",{"aria-hidden":"true","data-split-divider-hitarea":"true",className:"absolute inset-y-0",style:{left:-12,right:-12}})},`grid-column-divider:${vn}`)),ke==="grid"&&ee&&Un.map((qt,vn)=>u.jsx("button",{type:"button","data-split-grid-row-divider":vn,className:"swiper-no-swiping absolute inset-x-0 z-20 h-px -translate-y-1/2 touch-none select-none cursor-row-resize bg-[var(--border-strong)] transition-colors hover:bg-primary active:bg-primary",style:{top:`${qt*100}%`},onPointerDownCapture:Yt=>{const on=Yt.currentTarget.closest('[data-split-container="true"]');on instanceof HTMLDivElement&&Es(Yt,on,!0,ee.id,vn,"grid-rows",nn)},onDoubleClick:Yt=>{Yt.preventDefault(),Yt.stopPropagation(),J(on=>on.map(or=>or.id===ee.id?{...or,gridRowRatios:Fa(nn)}:or))},"aria-label":L("tab.split"),children:u.jsx("span",{"aria-hidden":"true","data-split-divider-hitarea":"true",className:"absolute inset-x-0",style:{top:-12,bottom:-12}})},`grid-row-divider:${vn}`))]}),Pe&&u.jsx("div",{ref:bt,className:"relative shrink-0 app-chrome-bg","data-split-keyboard-host":"true"})]}):ts(U.sessions[0])})},U.key)})})}),$e&&P&&u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop-soft)] backdrop-blur-sm",onClick:()=>tt(!1),"aria-label":L("common.close")}),u.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":L("tab.splitTitle"),children:[u.jsxs("header",{className:"flex items-start gap-3 border-b border-border/20 px-4 py-3.5",children:[u.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:u.jsx(ic,{size:17})}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:L("tab.splitTitle")}),u.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-muted-foreground",children:L("tab.splitExistingHint")})]}),u.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:()=>tt(!1),"aria-label":L("common.close"),children:u.jsx(Bs,{size:16})})]}),u.jsxs("div",{className:"max-h-[calc(min(78svh,620px)-72px)] overflow-y-auto overscroll-contain p-2",children:[u.jsxs("button",{type:"button",disabled:yt,onClick:()=>{vr()},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:[u.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary",children:u.jsx(Yi,{size:17})}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block text-[13px] font-medium text-foreground",children:L("tab.splitNew")}),u.jsx("span",{className:"mt-0.5 block text-[11px] text-muted-foreground",children:L("tab.splitNewHint")})]})]}),re.filter(U=>U.id!==an?.id).length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:L("tab.splitExistingGroups")}),re.filter(U=>U.id!==an?.id).map((U,ee)=>{const fe=U.sessionIds.flatMap(nt=>{const Bt=B.find(_t=>_t.id===nt);return Bt?[Bt]:[]});if(fe.length<2)return null;const ke=U.name||`${L("tab.splitWorkspace")} ${ee+1}`,ht=fe.map(nt=>Wr(nt).primary).join(" · ");return u.jsxs("button",{type:"button",onClick:()=>br(fe[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:[u.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:u.jsx(ic,{size:15})}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium text-foreground",children:ke}),u.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium text-primary",children:L("tab.splitOccupied")})]}),u.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[L("tab.sessionCount",{count:fe.length})," · ",ht]})]}),u.jsx(ma,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},U.id)})]}),u.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:L("tab.splitAvailableSessions")}),B.filter(U=>!re.some(ee=>ee.sessionIds.includes(U.id))&&U.id!==P).length===0&&re.filter(U=>U.id!==an?.id).length===0?u.jsx("p",{className:"px-3 py-4 text-[12px] text-muted-foreground",children:L("tab.splitNoOtherSessions")}):B.filter(U=>!re.some(ee=>ee.sessionIds.includes(U.id))&&U.id!==P).map(U=>{const ee=sr.get(U.id)??null,fe=Wr(U);return u.jsxs("button",{type:"button",onClick:()=>br(U.id),className:"group flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left transition hover:bg-surface-2 active:bg-surface-elevated",children:[u.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground",children:ee?u.jsx(hu,{size:15}):u.jsx(ic,{size:15})}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block truncate text-[12px] font-medium text-foreground",children:fe.primary}),u.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:ee?Oa(ee)??ee:U.name})]}),u.jsx(ma,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},U.id)})]})]})]}),gt&&u.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:gt})]})},ID={sm:"h-4 w-7",md:"h-6 w-10"},RD={sm:"h-3 w-3",md:"h-5 w-5"},MD={sm:"translate-x-3",md:"translate-x-4"};function nl({checked:e,disabled:t=!1,size:n="md",className:r=""}){return u.jsx("span",{"aria-hidden":"true",className:`inline-flex shrink-0 items-center rounded-full transition ${ID[n]} ${e?"bg-primary":"bg-surface-elevated"} ${t?"opacity-50":""} ${r}`,children:u.jsx("span",{className:`mx-0.5 inline-block rounded-full bg-[var(--background)] shadow transition ${RD[n]} ${e?MD[n]:""}`})})}function Vi(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var ND=typeof Symbol=="function"&&Symbol.observable||"@@observable",_x=ND,Lx=()=>Math.random().toString(36).substring(7).split("").join("."),DD={INIT:`@@redux/INIT${Lx()}`,REPLACE:`@@redux/REPLACE${Lx()}`},kx=DD;function BD(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 Uv(e,t,n){if(typeof e!="function")throw new Error(Vi(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Vi(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Vi(1));return n(Uv)(e,t)}let r=e,s=t,o=new Map,a=o,d=0,h=!1;function p(){a===o&&(a=new Map,o.forEach((L,R)=>{a.set(R,L)}))}function g(){if(h)throw new Error(Vi(3));return s}function y(L){if(typeof L!="function")throw new Error(Vi(4));if(h)throw new Error(Vi(5));let R=!0;p();const D=d++;return a.set(D,L),function(){if(R){if(h)throw new Error(Vi(6));R=!1,p(),a.delete(D),o=null}}}function b(L){if(!BD(L))throw new Error(Vi(7));if(typeof L.type>"u")throw new Error(Vi(8));if(typeof L.type!="string")throw new Error(Vi(17));if(h)throw new Error(Vi(9));try{h=!0,s=r(s,L)}finally{h=!1}return(o=a).forEach(D=>{D()}),L}function v(L){if(typeof L!="function")throw new Error(Vi(10));r=L,b({type:kx.REPLACE})}function T(){const L=y;return{subscribe(R){if(typeof R!="object"||R===null)throw new Error(Vi(11));function D(){const j=R;j.next&&j.next(g())}return D(),{unsubscribe:L(D)}},[_x](){return this}}}return b({type:kx.INIT}),{dispatch:b,subscribe:y,getState:g,replaceReducer:v,[_x]:T}}function Ex(e,t){return function(...n){return t(e.apply(this,n))}}function Ix(e,t){if(typeof e=="function")return Ex(e,t);if(typeof e!="object"||e===null)throw new Error(Vi(16));const n={};for(const r in e){const s=e[r];typeof s=="function"&&(n[r]=Ex(s,t))}return n}function Hv(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function PD(...e){return t=>(n,r)=>{const s=t(n,r);let o=()=>{throw new Error(Vi(15))};const a={getState:s.getState,dispatch:(h,...p)=>o(h,...p)},d=e.map(h=>h(a));return o=Hv(...d)(s.dispatch),{...s,dispatch:o}}}var Mp={exports:{}},Np={};var Rx;function QD(){if(Rx)return Np;Rx=1;var e=Oh();function t(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,s=e.useRef,o=e.useEffect,a=e.useMemo,d=e.useDebugValue;return Np.useSyncExternalStoreWithSelector=function(h,p,g,y,b){var v=s(null);if(v.current===null){var T={hasValue:!1,value:null};v.current=T}else T=v.current;v=a(function(){function L(P){if(!R){if(R=!0,D=P,P=y(P),b!==void 0&&T.hasValue){var $=T.value;if(b($,P))return B=$}return B=P}if($=B,n(D,P))return $;var z=y(P);return b!==void 0&&b($,z)?(D=P,$):(D=P,B=z)}var R=!1,D,B,j=g===void 0?null:g;return[function(){return L(p())},j===null?void 0:function(){return L(j())}]},[p,g,y,b]);var A=r(h,v[0],v[1]);return o(function(){T.hasValue=!0,T.value=A},[A]),d(A),A},Np}var Mx;function OD(){return Mx||(Mx=1,Mp.exports=QD()),Mp.exports}OD();var FD=S.version.startsWith("19"),jD=Symbol.for(FD?"react.transitional.element":"react.element"),$D=Symbol.for("react.portal"),UD=Symbol.for("react.fragment"),HD=Symbol.for("react.strict_mode"),zD=Symbol.for("react.profiler"),GD=Symbol.for("react.consumer"),WD=Symbol.for("react.context"),zv=Symbol.for("react.forward_ref"),VD=Symbol.for("react.suspense"),qD=Symbol.for("react.suspense_list"),Ug=Symbol.for("react.memo"),YD=Symbol.for("react.lazy"),ZD=zv,KD=Ug;function XD(e){if(typeof e=="object"&&e!==null){const{$$typeof:t}=e;switch(t){case jD:switch(e=e.type,e){case UD:case zD:case HD:case VD:case qD:return e;default:switch(e=e&&e.$$typeof,e){case WD:case zv:case YD:case Ug:return e;case GD:return e;default:return t}}case $D:return t}}}function JD(e){return XD(e)===Ug}function eB(e,t,n,r,{areStatesEqual:s,areOwnPropsEqual:o,areStatePropsEqual:a}){let d=!1,h,p,g,y,b;function v(D,B){return h=D,p=B,g=e(h,p),y=t(r,p),b=n(g,y,p),d=!0,b}function T(){return g=e(h,p),t.dependsOnOwnProps&&(y=t(r,p)),b=n(g,y,p),b}function A(){return e.dependsOnOwnProps&&(g=e(h,p)),t.dependsOnOwnProps&&(y=t(r,p)),b=n(g,y,p),b}function L(){const D=e(h,p),B=!a(D,g);return g=D,B&&(b=n(g,y,p)),b}function R(D,B){const j=!o(B,p),P=!s(D,h,B,p);return h=D,p=B,j&&P?T():j?A():P?L():b}return function(B,j){return d?R(B,j):v(B,j)}}function tB(e,{initMapStateToProps:t,initMapDispatchToProps:n,initMergeProps:r,...s}){const o=t(e,s),a=n(e,s),d=r(e,s);return eB(o,a,d,e,s)}function nB(e,t){const n={};for(const r in e){const s=e[r];typeof s=="function"&&(n[r]=(...o)=>t(s(...o)))}return n}function Wm(e){return function(n){const r=e(n);function s(){return r}return s.dependsOnOwnProps=!1,s}}function Nx(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:e.length!==1}function Gv(e,t){return function(r,{displayName:s}){const o=function(d,h){return o.dependsOnOwnProps?o.mapToProps(d,h):o.mapToProps(d,void 0)};return o.dependsOnOwnProps=!0,o.mapToProps=function(d,h){o.mapToProps=e,o.dependsOnOwnProps=Nx(e);let p=o(d,h);return typeof p=="function"&&(o.mapToProps=p,o.dependsOnOwnProps=Nx(p),p=o(d,h)),p},o}}function Hg(e,t){return(n,r)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${r.wrappedComponentName}.`)}}function rB(e){return e&&typeof e=="object"?Wm(t=>nB(e,t)):e?typeof e=="function"?Gv(e):Hg(e,"mapDispatchToProps"):Wm(t=>({dispatch:t}))}function sB(e){return e?typeof e=="function"?Gv(e):Hg(e,"mapStateToProps"):Wm(()=>({}))}function iB(e,t,n){return{...n,...e,...t}}function oB(e){return function(n,{displayName:r,areMergedPropsEqual:s}){let o=!1,a;return function(h,p,g){const y=e(h,p,g);return o?s(y,a)||(a=y):(o=!0,a=y),a}}}function aB(e){return e?typeof e=="function"?oB(e):Hg(e,"mergeProps"):()=>iB}function lB(e){e()}function cB(){let e=null,t=null;return{clear(){e=null,t=null},notify(){lB(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const s=t={callback:n,next:null,prev:t};return s.prev?s.prev.next=s:e=s,function(){!r||e===null||(r=!1,s.next?s.next.prev=s.prev:t=s.prev,s.prev?s.prev.next=s.next:e=s.next)}}}}var Dx={notify(){},get:()=>[]};function Wv(e,t){let n,r=Dx,s=0,o=!1;function a(A){g();const L=r.subscribe(A);let R=!1;return()=>{R||(R=!0,L(),y())}}function d(){r.notify()}function h(){T.onStateChange&&T.onStateChange()}function p(){return o}function g(){s++,n||(n=t?t.addNestedSub(h):e.subscribe(h),r=cB())}function y(){s--,n&&s===0&&(n(),n=void 0,r.clear(),r=Dx)}function b(){o||(o=!0,g())}function v(){o&&(o=!1,y())}const T={addNestedSub:a,notifyNestedSubs:d,handleChangeWrapper:h,isSubscribed:p,trySubscribe:b,tryUnsubscribe:v,getListeners:()=>r};return T}var uB=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",dB=uB(),hB=()=>typeof navigator<"u"&&navigator.product==="ReactNative",fB=hB(),pB=()=>dB||fB?S.useLayoutEffect:S.useEffect,Th=pB();function Bx(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function Dp(e,t){if(Bx(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let s=0;s<n.length;s++)if(!Object.prototype.hasOwnProperty.call(t,n[s])||!Bx(e[n[s]],t[n[s]]))return!1;return!0}var mB={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},gB={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},xB={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Vv={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},yB={[ZD]:xB,[KD]:Vv};function Px(e){return JD(e)?Vv:yB[e.$$typeof]||mB}var bB=Object.defineProperty,vB=Object.getOwnPropertyNames,Qx=Object.getOwnPropertySymbols,wB=Object.getOwnPropertyDescriptor,AB=Object.getPrototypeOf,Ox=Object.prototype;function Vm(e,t){if(typeof t!="string"){if(Ox){const o=AB(t);o&&o!==Ox&&Vm(e,o)}let n=vB(t);Qx&&(n=n.concat(Qx(t)));const r=Px(e),s=Px(t);for(let o=0;o<n.length;++o){const a=n[o];if(!gB[a]&&!(s&&s[a])&&!(r&&r[a])){const d=wB(t,a);try{bB(e,a,d)}catch{}}}}return e}var TB=Symbol.for("react-redux-context"),SB=typeof globalThis<"u"?globalThis:{};function CB(){if(!S.createContext)return{};const e=SB[TB]??=new Map;let t=e.get(S.createContext);return t||(t=S.createContext(null),e.set(S.createContext,t)),t}var qv=CB(),_B=[null,null];function LB(e,t,n){Th(()=>e(...t),n)}function kB(e,t,n,r,s,o){e.current=r,n.current=!1,s.current&&(s.current=null,o())}function EB(e,t,n,r,s,o,a,d,h,p,g){if(!e)return()=>{};let y=!1,b=null;const v=()=>{if(y||!d.current)return;const A=t.getState();let L,R;try{L=r(A,s.current)}catch(D){R=D,b=D}R||(b=null),L===o.current?a.current||p():(o.current=L,h.current=L,a.current=!0,g())};return n.onStateChange=v,n.trySubscribe(),v(),()=>{if(y=!0,n.tryUnsubscribe(),n.onStateChange=null,b)throw b}}function IB(e,t){return e===t}function RB(e,t,n,{pure:r,areStatesEqual:s=IB,areOwnPropsEqual:o=Dp,areStatePropsEqual:a=Dp,areMergedPropsEqual:d=Dp,forwardRef:h=!1,context:p=qv}={}){const g=p,y=sB(e),b=rB(t),v=aB(n),T=!!e;return L=>{const R=L.displayName||L.name||"Component",D=`Connect(${R})`,B={shouldHandleStateChanges:T,displayName:D,wrappedComponentName:R,WrappedComponent:L,initMapStateToProps:y,initMapDispatchToProps:b,initMergeProps:v,areStatesEqual:s,areStatePropsEqual:a,areOwnPropsEqual:o,areMergedPropsEqual:d};function j(z){const[H,ye,q]=S.useMemo(()=>{const{reactReduxForwardedRef:$e,...tt}=z;return[z.context,$e,tt]},[z]),te=S.useMemo(()=>{let $e=g;return H?.Consumer,$e},[H,g]),ve=S.useContext(te),ge=!!z.store&&!!z.store.getState&&!!z.store.dispatch,ie=!!ve&&!!ve.store,Ae=ge?z.store:ve.store,xe=ie?ve.getServerState:Ae.getState,ce=S.useMemo(()=>tB(Ae.dispatch,B),[Ae]),[K,be]=S.useMemo(()=>{if(!T)return _B;const $e=Wv(Ae,ge?void 0:ve.subscription),tt=$e.notifyNestedSubs.bind($e);return[$e,tt]},[Ae,ge,ve]),Se=S.useMemo(()=>ge?ve:{...ve,subscription:K},[ge,ve,K]),We=S.useRef(void 0),ue=S.useRef(q),Ee=S.useRef(void 0),Tt=S.useRef(!1),Rt=S.useRef(!1),ze=S.useRef(void 0);Th(()=>(Rt.current=!0,()=>{Rt.current=!1}),[]);const X=S.useMemo(()=>()=>Ee.current&&q===ue.current?Ee.current:ce(Ae.getState(),q),[Ae,q]),rt=S.useMemo(()=>tt=>K?EB(T,Ae,K,ce,ue,We,Tt,Rt,Ee,be,tt):()=>{},[K]);LB(kB,[ue,We,Tt,q,Ee,be]);let qe;try{qe=S.useSyncExternalStore(rt,X,xe?()=>ce(xe(),q):X)}catch($e){throw ze.current&&($e.message+=`
|
|
79
|
-
The error may be correlated with this previous error:
|
|
80
|
-
${ze.current.stack}
|
|
81
|
-
|
|
82
|
-
`),$e}Th(()=>{ze.current=void 0,Ee.current=void 0,We.current=qe});const re=S.useMemo(()=>S.createElement(L,{...qe,ref:ye}),[ye,L,qe]);return S.useMemo(()=>T?S.createElement(te.Provider,{value:Se},re):re,[te,re,Se])}const $=S.memo(j);if($.WrappedComponent=L,$.displayName=j.displayName=D,h){const H=S.forwardRef(function(q,te){return S.createElement($,{...q,reactReduxForwardedRef:te})});return H.displayName=D,H.WrappedComponent=L,Vm(H,L)}return Vm($,L)}}var Yv=RB;function MB(e){const{children:t,context:n,serverState:r,store:s}=e,o=S.useMemo(()=>{const h=Wv(s);return{store:s,subscription:h,getServerState:r?()=>r:void 0}},[s,r]),a=S.useMemo(()=>s.getState(),[s]);Th(()=>{const{subscription:h}=o;return h.onStateChange=h.notifyNestedSubs,h.trySubscribe(),a!==s.getState()&&h.notifyNestedSubs(),()=>{h.tryUnsubscribe(),h.onStateChange=void 0}},[o,a]);const d=n||qv;return S.createElement(d.Provider,{value:o},t)}var NB=MB,DB="Invariant failed";function BB(e,t){throw new Error(DB)}var fa=function(t){var n=t.top,r=t.right,s=t.bottom,o=t.left,a=r-o,d=s-n,h={top:n,right:r,bottom:s,left:o,width:a,height:d,x:o,y:n,center:{x:(r+o)/2,y:(s+n)/2}};return h},zg=function(t,n){return{top:t.top-n.top,left:t.left-n.left,bottom:t.bottom+n.bottom,right:t.right+n.right}},Fx=function(t,n){return{top:t.top+n.top,left:t.left+n.left,bottom:t.bottom-n.bottom,right:t.right-n.right}},PB=function(t,n){return{top:t.top+n.y,left:t.left+n.x,bottom:t.bottom+n.y,right:t.right+n.x}},Bp={top:0,right:0,bottom:0,left:0},Gg=function(t){var n=t.borderBox,r=t.margin,s=r===void 0?Bp:r,o=t.border,a=o===void 0?Bp:o,d=t.padding,h=d===void 0?Bp:d,p=fa(zg(n,s)),g=fa(Fx(n,a)),y=fa(Fx(g,h));return{marginBox:p,borderBox:fa(n),paddingBox:g,contentBox:y,margin:s,border:a,padding:h}},Go=function(t){var n=t.slice(0,-2),r=t.slice(-2);if(r!=="px")return 0;var s=Number(n);return isNaN(s)&&BB(),s},QB=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Sh=function(t,n){var r=t.borderBox,s=t.border,o=t.margin,a=t.padding,d=PB(r,n);return Gg({borderBox:d,border:s,margin:o,padding:a})},Ch=function(t,n){return n===void 0&&(n=QB()),Sh(t,n)},Zv=function(t,n){var r={top:Go(n.marginTop),right:Go(n.marginRight),bottom:Go(n.marginBottom),left:Go(n.marginLeft)},s={top:Go(n.paddingTop),right:Go(n.paddingRight),bottom:Go(n.paddingBottom),left:Go(n.paddingLeft)},o={top:Go(n.borderTopWidth),right:Go(n.borderRightWidth),bottom:Go(n.borderBottomWidth),left:Go(n.borderLeftWidth)};return Gg({borderBox:t,margin:r,padding:s,border:o})},Kv=function(t){var n=t.getBoundingClientRect(),r=window.getComputedStyle(t);return Zv(n,r)},j0=function(t){var n=[],r=null,s=function(){for(var a=arguments.length,d=new Array(a),h=0;h<a;h++)d[h]=arguments[h];n=d,!r&&(r=requestAnimationFrame(function(){r=null,t.apply(void 0,n)}))};return s.cancel=function(){r&&(cancelAnimationFrame(r),r=null)},s};function _h(){return _h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_h.apply(null,arguments)}function Xv(e,t){}Xv.bind(null,"warn");Xv.bind(null,"error");function Ql(){}function OB(e,t){return{...e,...t}}function Yo(e,t,n){const r=t.map(s=>{const o=OB(n,s.options);return e.addEventListener(s.eventName,s.fn,o),function(){e.removeEventListener(s.eventName,s.fn,o)}});return function(){r.forEach(o=>{o()})}}const FB="Invariant failed";class Lh extends Error{}Lh.prototype.toString=function(){return this.message};function xt(e,t){throw new Lh(FB)}class jB extends _.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=Ql,this.onWindowError=n=>{const r=this.getCallbacks();r.isDragging()&&r.tryAbort(),n.error instanceof Lh&&n.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=n=>{this.callbacks=n}}componentDidMount(){this.unbind=Yo(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof Lh){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const $B=`
|
|
83
|
-
Press space bar to start a drag.
|
|
84
|
-
When dragging you can use the arrow keys to move the item around and escape to cancel.
|
|
85
|
-
Some screen readers may require you to be in focus mode or to use your pass through key
|
|
86
|
-
`,kh=e=>e+1,UB=e=>`
|
|
87
|
-
You have lifted an item in position ${kh(e.source.index)}
|
|
88
|
-
`,Jv=(e,t)=>{const n=e.droppableId===t.droppableId,r=kh(e.index),s=kh(t.index);return n?`
|
|
89
|
-
You have moved the item from position ${r}
|
|
90
|
-
to position ${s}
|
|
91
|
-
`:`
|
|
92
|
-
You have moved the item from position ${r}
|
|
93
|
-
in list ${e.droppableId}
|
|
94
|
-
to list ${t.droppableId}
|
|
95
|
-
in position ${s}
|
|
96
|
-
`},e6=(e,t,n)=>t.droppableId===n.droppableId?`
|
|
97
|
-
The item ${e}
|
|
98
|
-
has been combined with ${n.draggableId}`:`
|
|
99
|
-
The item ${e}
|
|
100
|
-
in list ${t.droppableId}
|
|
101
|
-
has been combined with ${n.draggableId}
|
|
102
|
-
in list ${n.droppableId}
|
|
103
|
-
`,HB=e=>{const t=e.destination;if(t)return Jv(e.source,t);const n=e.combine;return n?e6(e.draggableId,e.source,n):"You are over an area that cannot be dropped on"},jx=e=>`
|
|
104
|
-
The item has returned to its starting position
|
|
105
|
-
of ${kh(e.index)}
|
|
106
|
-
`,zB=e=>{if(e.reason==="CANCEL")return`
|
|
107
|
-
Movement cancelled.
|
|
108
|
-
${jx(e.source)}
|
|
109
|
-
`;const t=e.destination,n=e.combine;return t?`
|
|
110
|
-
You have dropped the item.
|
|
111
|
-
${Jv(e.source,t)}
|
|
112
|
-
`:n?`
|
|
113
|
-
You have dropped the item.
|
|
114
|
-
${e6(e.draggableId,e.source,n)}
|
|
115
|
-
`:`
|
|
116
|
-
The item has been dropped while not over a drop area.
|
|
117
|
-
${jx(e.source)}
|
|
118
|
-
`},oh={dragHandleUsageInstructions:$B,onDragStart:UB,onDragUpdate:HB,onDragEnd:zB};function GB(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function t6(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!GB(e[n],t[n]))return!1;return!0}function Kn(e,t){const n=S.useState(()=>({inputs:t,result:e()}))[0],r=S.useRef(!0),s=S.useRef(n),a=r.current||!!(t&&s.current.inputs&&t6(t,s.current.inputs))?s.current:{inputs:t,result:e()};return S.useEffect(()=>{r.current=!1,s.current=a},[a]),a.result}function Kt(e,t){return Kn(()=>e,t)}const ni={x:0,y:0},xi=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),To=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),Ol=(e,t)=>e.x===t.x&&e.y===t.y,Tu=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),gc=(e,t,n=0)=>e==="x"?{x:t,y:n}:{x:n,y:t},$0=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),$x=(e,t)=>Math.min(...t.map(n=>$0(e,n))),n6=e=>t=>({x:e(t.x),y:e(t.y)});var WB=(e,t)=>{const n=fa({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 n.width<=0||n.height<=0?null:n};const Y0=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),Ux=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}],VB={top:0,right:0,bottom:0,left:0},qB=(e,t)=>t?Y0(e,t.scroll.diff.displacement):e,YB=(e,t,n)=>n&&n.increasedBy?{...e,[t.end]:e[t.end]+n.increasedBy[t.line]}:e,ZB=(e,t)=>t&&t.shouldClipSubject?WB(t.pageMarginBox,e):fa(e);var gu=({page:e,withPlaceholder:t,axis:n,frame:r})=>{const s=qB(e.marginBox,r),o=YB(s,n,t),a=ZB(o,r);return{page:e,withPlaceholder:t,active:a}},Wg=(e,t)=>{e.frame||xt();const n=e.frame,r=To(t,n.scroll.initial),s=Tu(r),o={...n,scroll:{initial:n.scroll.initial,current:t,diff:{value:r,displacement:s},max:n.scroll.max}},a=gu({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:o});return{...e,frame:o,subject:a}};function ti(e,t=t6){let n=null;function r(...s){if(n&&n.lastThis===this&&t(s,n.lastArgs))return n.lastResult;const o=e.apply(this,s);return n={lastResult:o,lastArgs:s,lastThis:this},o}return r.clear=function(){n=null},r}const r6=ti(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),s6=ti(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),Kh=ti(e=>Object.values(e)),KB=ti(e=>Object.values(e));var Su=ti((e,t)=>KB(t).filter(r=>e===r.descriptor.droppableId).sort((r,s)=>r.descriptor.index-s.descriptor.index));function Vg(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function Xh(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var Jh=ti((e,t)=>t.filter(n=>n.descriptor.id!==e.descriptor.id)),XB=({isMovingForward:e,draggable:t,destination:n,insideDestination:r,previousImpact:s})=>{if(!n.isCombineEnabled||!Vg(s))return null;function a(v){const T={type:"COMBINE",combine:{draggableId:v,droppableId:n.descriptor.id}};return{...s,at:T}}const d=s.displaced.all,h=d.length?d[0]:null;if(e)return h?a(h):null;const p=Jh(t,r);if(!h){if(!p.length)return null;const v=p[p.length-1];return a(v.descriptor.id)}const g=p.findIndex(v=>v.descriptor.id===h);g===-1&&xt();const y=g-1;if(y<0)return null;const b=p[y];return a(b.descriptor.id)},Cu=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const i6={point:ni,value:0},U0={invisible:{},visible:{},all:[]},JB={displaced:U0,displacedBy:i6,at:null};var Zo=(e,t)=>n=>e<=n&&n<=t,o6=e=>{const t=Zo(e.top,e.bottom),n=Zo(e.left,e.right);return r=>{if(t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right))return!0;const o=t(r.top)||t(r.bottom),a=n(r.left)||n(r.right);if(o&&a)return!0;const h=r.top<e.top&&r.bottom>e.bottom,p=r.left<e.left&&r.right>e.right;return h&&p?!0:h&&a||p&&o}},eP=e=>{const t=Zo(e.top,e.bottom),n=Zo(e.left,e.right);return r=>t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right)};const qg={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},a6={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var tP=e=>t=>{const n=Zo(t.top,t.bottom),r=Zo(t.left,t.right);return s=>e===qg?n(s.top)&&n(s.bottom):r(s.left)&&r(s.right)};const nP=(e,t)=>{const n=t.frame?t.frame.scroll.diff.displacement:ni;return Y0(e,n)},rP=(e,t,n)=>t.subject.active?n(t.subject.active)(e):!1,sP=(e,t,n)=>n(t)(e),Yg=({target:e,destination:t,viewport:n,withDroppableDisplacement:r,isVisibleThroughFrameFn:s})=>{const o=r?nP(e,t):e;return rP(o,t,s)&&sP(o,n,s)},iP=e=>Yg({...e,isVisibleThroughFrameFn:o6}),l6=e=>Yg({...e,isVisibleThroughFrameFn:eP}),oP=e=>Yg({...e,isVisibleThroughFrameFn:tP(e.destination.axis)}),aP=(e,t,n)=>{if(typeof n=="boolean")return n;if(!t)return!0;const{invisible:r,visible:s}=t;if(r[e])return!1;const o=s[e];return o?o.shouldAnimate:!0};function lP(e,t){const n=e.page.marginBox,r={top:t.point.y,right:0,bottom:0,left:t.point.x};return fa(zg(n,r))}function H0({afterDragging:e,destination:t,displacedBy:n,viewport:r,forceShouldAnimate:s,last:o}){return e.reduce(function(d,h){const p=lP(h,n),g=h.descriptor.id;if(d.all.push(g),!iP({target:p,destination:t,viewport:r,withDroppableDisplacement:!0}))return d.invisible[h.descriptor.id]=!0,d;const b=aP(g,o,s),v={draggableId:g,shouldAnimate:b};return d.visible[g]=v,d},{all:[],visible:{},invisible:{}})}function cP(e,t){if(!e.length)return 0;const n=e[e.length-1].descriptor.index;return t.inHomeList?n:n+1}function Hx({insideDestination:e,inHomeList:t,displacedBy:n,destination:r}){const s=cP(e,{inHomeList:t});return{displaced:U0,displacedBy:n,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:s}}}}function Eh({draggable:e,insideDestination:t,destination:n,viewport:r,displacedBy:s,last:o,index:a,forceShouldAnimate:d}){const h=Cu(e,n);if(a==null)return Hx({insideDestination:t,inHomeList:h,displacedBy:s,destination:n});const p=t.find(T=>T.descriptor.index===a);if(!p)return Hx({insideDestination:t,inHomeList:h,displacedBy:s,destination:n});const g=Jh(e,t),y=t.indexOf(p),b=g.slice(y);return{displaced:H0({afterDragging:b,destination:n,displacedBy:s,last:o,viewport:r.frame,forceShouldAnimate:d}),displacedBy:s,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:a}}}}function jl(e,t){return!!t.effected[e]}var uP=({isMovingForward:e,destination:t,draggables:n,combine:r,afterCritical:s})=>{if(!t.isCombineEnabled)return null;const o=r.draggableId,d=n[o].descriptor.index;return jl(o,s)?e?d:d-1:e?d+1:d},dP=({isMovingForward:e,isInHomeList:t,insideDestination:n,location:r})=>{if(!n.length)return null;const s=r.index,o=e?s+1:s-1,a=n[0].descriptor.index,d=n[n.length-1].descriptor.index,h=t?d:d+1;return o<a||o>h?null:o},hP=({isMovingForward:e,isInHomeList:t,draggable:n,draggables:r,destination:s,insideDestination:o,previousImpact:a,viewport:d,afterCritical:h})=>{const p=a.at;if(p||xt(),p.type==="REORDER"){const y=dP({isMovingForward:e,isInHomeList:t,location:p.destination,insideDestination:o});return y==null?null:Eh({draggable:n,insideDestination:o,destination:s,viewport:d,last:a.displaced,displacedBy:a.displacedBy,index:y})}const g=uP({isMovingForward:e,destination:s,displaced:a.displaced,draggables:r,combine:p.combine,afterCritical:h});return g==null?null:Eh({draggable:n,insideDestination:o,destination:s,viewport:d,last:a.displaced,displacedBy:a.displacedBy,index:g})},fP=({displaced:e,afterCritical:t,combineWith:n,displacedBy:r})=>{const s=!!(e.visible[n]||e.invisible[n]);return jl(n,t)?s?ni:Tu(r.point):s?r.point:ni},pP=({afterCritical:e,impact:t,draggables:n})=>{const r=Xh(t);r||xt();const s=r.draggableId,o=n[s].page.borderBox.center,a=fP({displaced:t.displaced,afterCritical:e,combineWith:s,displacedBy:t.displacedBy});return xi(o,a)};const c6=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,mP=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,Zg=(e,t,n)=>t[e.crossAxisStart]+n.margin[e.crossAxisStart]+n.borderBox[e.crossAxisSize]/2,zx=({axis:e,moveRelativeTo:t,isMoving:n})=>gc(e.line,t.marginBox[e.end]+c6(e,n),Zg(e,t.marginBox,n)),Gx=({axis:e,moveRelativeTo:t,isMoving:n})=>gc(e.line,t.marginBox[e.start]-mP(e,n),Zg(e,t.marginBox,n)),gP=({axis:e,moveInto:t,isMoving:n})=>gc(e.line,t.contentBox[e.start]+c6(e,n),Zg(e,t.contentBox,n));var xP=({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:s})=>{const o=Su(r.descriptor.id,n),a=t.page,d=r.axis;if(!o.length)return gP({axis:d,moveInto:r.page,isMoving:a});const{displaced:h,displacedBy:p}=e,g=h.all[0];if(g){const b=n[g];if(jl(g,s))return Gx({axis:d,moveRelativeTo:b.page,isMoving:a});const v=Sh(b.page,p.point);return Gx({axis:d,moveRelativeTo:v,isMoving:a})}const y=o[o.length-1];if(y.descriptor.id===t.descriptor.id)return a.borderBox.center;if(jl(y.descriptor.id,s)){const b=Sh(y.page,Tu(s.displacedBy.point));return zx({axis:d,moveRelativeTo:b,isMoving:a})}return zx({axis:d,moveRelativeTo:y.page,isMoving:a})},qm=(e,t)=>{const n=e.frame;return n?xi(t,n.scroll.diff.displacement):t};const yP=({impact:e,draggable:t,droppable:n,draggables:r,afterCritical:s})=>{const o=t.page.borderBox.center,a=e.at;return!n||!a?o:a.type==="REORDER"?xP({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:s}):pP({impact:e,draggables:r,afterCritical:s})};var ef=e=>{const t=yP(e),n=e.droppable;return n?qm(n,t):t},u6=(e,t)=>{const n=To(t,e.scroll.initial),r=Tu(n);return{frame:fa({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:n,displacement:r}}}};function Wx(e,t){return e.map(n=>t[n])}function bP(e,t){for(let n=0;n<t.length;n++){const r=t[n].visible[e];if(r)return r}return null}var vP=({impact:e,viewport:t,destination:n,draggables:r,maxScrollChange:s})=>{const o=u6(t,xi(t.scroll.current,s)),a=n.frame?Wg(n,xi(n.frame.scroll.current,s)):n,d=e.displaced,h=H0({afterDragging:Wx(d.all,r),destination:n,displacedBy:e.displacedBy,viewport:o.frame,last:d,forceShouldAnimate:!1}),p=H0({afterDragging:Wx(d.all,r),destination:a,displacedBy:e.displacedBy,viewport:t.frame,last:d,forceShouldAnimate:!1}),g={},y={},b=[d,h,p];return d.all.forEach(T=>{const A=bP(T,b);if(A){y[T]=A;return}g[T]=!0}),{...e,displaced:{all:d.all,invisible:g,visible:y}}},wP=(e,t)=>xi(e.scroll.diff.displacement,t),Kg=({pageBorderBoxCenter:e,draggable:t,viewport:n})=>{const r=wP(n,e),s=To(r,t.page.borderBox.center);return xi(t.client.borderBox.center,s)},d6=({draggable:e,destination:t,newPageBorderBoxCenter:n,viewport:r,withDroppableDisplacement:s,onlyOnMainAxis:o=!1})=>{const a=To(n,e.page.borderBox.center),h={target:Y0(e.page.borderBox,a),destination:t,withDroppableDisplacement:s,viewport:r};return o?oP(h):l6(h)},AP=({isMovingForward:e,draggable:t,destination:n,draggables:r,previousImpact:s,viewport:o,previousPageBorderBoxCenter:a,previousClientSelection:d,afterCritical:h})=>{if(!n.isEnabled)return null;const p=Su(n.descriptor.id,r),g=Cu(t,n),y=XB({isMovingForward:e,draggable:t,destination:n,insideDestination:p,previousImpact:s})||hP({isMovingForward:e,isInHomeList:g,draggable:t,draggables:r,destination:n,insideDestination:p,previousImpact:s,viewport:o,afterCritical:h});if(!y)return null;const b=ef({impact:y,draggable:t,droppable:n,draggables:r,afterCritical:h});if(d6({draggable:t,destination:n,newPageBorderBoxCenter:b,viewport:o.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:Kg({pageBorderBoxCenter:b,draggable:t,viewport:o}),impact:y,scrollJumpRequest:null};const T=To(b,a),A=vP({impact:y,viewport:o,destination:n,draggables:r,maxScrollChange:T});return{clientSelection:d,impact:A,scrollJumpRequest:T}};const zi=e=>{const t=e.subject.active;return t||xt(),t};var TP=({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:r,viewport:s})=>{const o=n.subject.active;if(!o)return null;const a=n.axis,d=Zo(o[a.start],o[a.end]),h=Kh(r).filter(g=>g!==n).filter(g=>g.isEnabled).filter(g=>!!g.subject.active).filter(g=>o6(s.frame)(zi(g))).filter(g=>{const y=zi(g);return e?o[a.crossAxisEnd]<y[a.crossAxisEnd]:y[a.crossAxisStart]<o[a.crossAxisStart]}).filter(g=>{const y=zi(g),b=Zo(y[a.start],y[a.end]);return d(y[a.start])||d(y[a.end])||b(o[a.start])||b(o[a.end])}).sort((g,y)=>{const b=zi(g)[a.crossAxisStart],v=zi(y)[a.crossAxisStart];return e?b-v:v-b}).filter((g,y,b)=>zi(g)[a.crossAxisStart]===zi(b[0])[a.crossAxisStart]);if(!h.length)return null;if(h.length===1)return h[0];const p=h.filter(g=>Zo(zi(g)[a.start],zi(g)[a.end])(t[a.line]));return p.length===1?p[0]:p.length>1?p.sort((g,y)=>zi(g)[a.start]-zi(y)[a.start])[0]:h.sort((g,y)=>{const b=$x(t,Ux(zi(g))),v=$x(t,Ux(zi(y)));return b!==v?b-v:zi(g)[a.start]-zi(y)[a.start]})[0]};const Vx=(e,t)=>{const n=e.page.borderBox.center;return jl(e.descriptor.id,t)?To(n,t.displacedBy.point):n},SP=(e,t)=>{const n=e.page.borderBox;return jl(e.descriptor.id,t)?Y0(n,Tu(t.displacedBy.point)):n};var CP=({pageBorderBoxCenter:e,viewport:t,destination:n,insideDestination:r,afterCritical:s})=>r.filter(a=>l6({target:SP(a,s),destination:n,viewport:t.frame,withDroppableDisplacement:!0})).sort((a,d)=>{const h=$0(e,qm(n,Vx(a,s))),p=$0(e,qm(n,Vx(d,s)));return h<p?-1:p<h?1:a.descriptor.index-d.descriptor.index})[0]||null,Z0=ti(function(t,n){const r=n[t.line];return{value:r,point:gc(t.line,r)}});const _P=(e,t,n)=>{const r=e.axis;if(e.descriptor.mode==="virtual")return gc(r.line,t[r.line]);const s=e.subject.page.contentBox[r.size],h=Su(e.descriptor.id,n).reduce((p,g)=>p+g.client.marginBox[r.size],0)+t[r.line]-s;return h<=0?null:gc(r.line,h)},h6=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),f6=(e,t,n)=>{const r=e.frame;Cu(t,e)&&xt(),e.subject.withPlaceholder&&xt();const s=Z0(e.axis,t.displaceBy).point,o=_P(e,s,n),a={placeholderSize:s,increasedBy:o,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!r){const g=gu({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:e.frame});return{...e,subject:g}}const d=o?xi(r.scroll.max,o):r.scroll.max,h=h6(r,d),p=gu({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:h});return{...e,subject:p,frame:h}},LP=e=>{const t=e.subject.withPlaceholder;t||xt();const n=e.frame;if(!n){const a=gu({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:a}}const r=t.oldFrameMaxScroll;r||xt();const s=h6(n,r),o=gu({page:e.subject.page,axis:e.axis,frame:s,withPlaceholder:null});return{...e,subject:o,frame:s}};var kP=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:n,draggable:r,draggables:s,destination:o,viewport:a,afterCritical:d})=>{if(!t){if(n.length)return null;const y={displaced:U0,displacedBy:i6,at:{type:"REORDER",destination:{droppableId:o.descriptor.id,index:0}}},b=ef({impact:y,draggable:r,droppable:o,draggables:s,afterCritical:d}),v=Cu(r,o)?o:f6(o,r,s);return d6({draggable:r,destination:v,newPageBorderBoxCenter:b,viewport:a.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?y:null}const h=e[o.axis.line]<=t.page.borderBox.center[o.axis.line],p=(()=>{const y=t.descriptor.index;return t.descriptor.id===r.descriptor.id||h?y:y+1})(),g=Z0(o.axis,r.displaceBy);return Eh({draggable:r,insideDestination:n,destination:o,viewport:a,displacedBy:g,last:U0,index:p})},EP=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:n,isOver:r,draggables:s,droppables:o,viewport:a,afterCritical:d})=>{const h=TP({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:o,viewport:a});if(!h)return null;const p=Su(h.descriptor.id,s),g=CP({pageBorderBoxCenter:t,viewport:a,destination:h,insideDestination:p,afterCritical:d}),y=kP({previousPageBorderBoxCenter:t,destination:h,draggable:n,draggables:s,moveRelativeTo:g,insideDestination:p,viewport:a,afterCritical:d});if(!y)return null;const b=ef({impact:y,draggable:n,droppable:h,draggables:s,afterCritical:d});return{clientSelection:Kg({pageBorderBoxCenter:b,draggable:n,viewport:a}),impact:y,scrollJumpRequest:null}},Co=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const IP=(e,t)=>{const n=Co(e);return n?t[n]:null};var RP=({state:e,type:t})=>{const n=IP(e.impact,e.dimensions.droppables),r=!!n,s=e.dimensions.droppables[e.critical.droppable.id],o=n||s,a=o.axis.direction,d=a==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||a==="horizontal"&&(t==="MOVE_LEFT"||t==="MOVE_RIGHT");if(d&&!r)return null;const h=t==="MOVE_DOWN"||t==="MOVE_RIGHT",p=e.dimensions.draggables[e.critical.draggable.id],g=e.current.page.borderBoxCenter,{draggables:y,droppables:b}=e.dimensions;return d?AP({isMovingForward:h,previousPageBorderBoxCenter:g,draggable:p,destination:o,draggables:y,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):EP({isMovingForward:h,previousPageBorderBoxCenter:g,draggable:p,isOver:o,draggables:y,droppables:b,viewport:e.viewport,afterCritical:e.afterCritical})};function tc(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function p6(e){const t=Zo(e.top,e.bottom),n=Zo(e.left,e.right);return function(s){return t(s.y)&&n(s.x)}}function MP(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function NP({pageBorderBox:e,draggable:t,candidates:n}){const r=t.page.borderBox.center,s=n.map(o=>{const a=o.axis,d=gc(o.axis.line,e.center[a.line],o.page.borderBox.center[a.crossAxisLine]);return{id:o.descriptor.id,distance:$0(r,d)}}).sort((o,a)=>a.distance-o.distance);return s[0]?s[0].id:null}function DP({pageBorderBox:e,draggable:t,droppables:n}){const r=Kh(n).filter(s=>{if(!s.isEnabled)return!1;const o=s.subject.active;if(!o||!MP(e,o))return!1;if(p6(o)(e.center))return!0;const a=s.axis,d=o.center[a.crossAxisLine],h=e[a.crossAxisStart],p=e[a.crossAxisEnd],g=Zo(o[a.crossAxisStart],o[a.crossAxisEnd]),y=g(h),b=g(p);return!y&&!b?!0:y?h<d:p>d});return r.length?r.length===1?r[0].descriptor.id:NP({pageBorderBox:e,draggable:t,candidates:r}):null}const m6=(e,t)=>fa(Y0(e,t));var BP=(e,t)=>{const n=e.frame;return n?m6(t,n.scroll.diff.value):t};function g6({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function PP({draggable:e,closest:t,inHomeList:n}){return t?n&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var QP=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:n,insideDestination:r,last:s,viewport:o,afterCritical:a})=>{const d=n.axis,h=Z0(n.axis,t.displaceBy),p=h.value,g=e[d.start],y=e[d.end],v=Jh(t,r).find(A=>{const L=A.descriptor.id,R=A.page.borderBox.center[d.line],D=jl(L,a),B=g6({displaced:s,id:L});return D?B?y<=R:g<R-p:B?y<=R+p:g<R})||null,T=PP({draggable:t,closest:v,inHomeList:Cu(t,n)});return Eh({draggable:t,insideDestination:r,destination:n,viewport:o,last:s,displacedBy:h,index:T})};const OP=4;var FP=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:n,destination:r,insideDestination:s,afterCritical:o})=>{if(!r.isCombineEnabled)return null;const a=r.axis,d=Z0(r.axis,e.displaceBy),h=d.value,p=t[a.start],g=t[a.end],b=Jh(e,s).find(T=>{const A=T.descriptor.id,L=T.page.borderBox,D=L[a.size]/OP,B=jl(A,o),j=g6({displaced:n.displaced,id:A});return B?j?g>L[a.start]+D&&g<L[a.end]-D:p>L[a.start]-h+D&&p<L[a.end]-h-D:j?g>L[a.start]+h+D&&g<L[a.end]+h-D:p>L[a.start]+D&&p<L[a.end]-D});return b?{displacedBy:d,displaced:n.displaced,at:{type:"COMBINE",combine:{draggableId:b.descriptor.id,droppableId:r.descriptor.id}}}:null},x6=({pageOffset:e,draggable:t,draggables:n,droppables:r,previousImpact:s,viewport:o,afterCritical:a})=>{const d=m6(t.page.borderBox,e),h=DP({pageBorderBox:d,draggable:t,droppables:r});if(!h)return JB;const p=r[h],g=Su(p.descriptor.id,n),y=BP(p,d);return FP({pageBorderBoxWithDroppableScroll:y,draggable:t,previousImpact:s,destination:p,insideDestination:g,afterCritical:a})||QP({pageBorderBoxWithDroppableScroll:y,draggable:t,destination:p,insideDestination:g,last:s.displaced,viewport:o,afterCritical:a})},Xg=(e,t)=>({...e,[t.descriptor.id]:t});const jP=({previousImpact:e,impact:t,droppables:n})=>{const r=Co(e),s=Co(t);if(!r||r===s)return n;const o=n[r];if(!o.subject.withPlaceholder)return n;const a=LP(o);return Xg(n,a)};var $P=({draggable:e,draggables:t,droppables:n,previousImpact:r,impact:s})=>{const o=jP({previousImpact:r,impact:s,droppables:n}),a=Co(s);if(!a)return o;const d=n[a];if(Cu(e,d)||d.subject.withPlaceholder)return o;const h=f6(d,e,t);return Xg(o,h)},L0=({state:e,clientSelection:t,dimensions:n,viewport:r,impact:s,scrollJumpRequest:o})=>{const a=r||e.viewport,d=n||e.dimensions,h=t||e.current.client.selection,p=To(h,e.initial.client.selection),g={offset:p,selection:h,borderBoxCenter:xi(e.initial.client.borderBoxCenter,p)},y={selection:xi(g.selection,a.scroll.current),borderBoxCenter:xi(g.borderBoxCenter,a.scroll.current),offset:xi(g.offset,a.scroll.diff.value)},b={client:g,page:y};if(e.phase==="COLLECTING")return{...e,dimensions:d,viewport:a,current:b};const v=d.draggables[e.critical.draggable.id],T=s||x6({pageOffset:y.offset,draggable:v,draggables:d.draggables,droppables:d.droppables,previousImpact:e.impact,viewport:a,afterCritical:e.afterCritical}),A=$P({draggable:v,impact:T,previousImpact:e.impact,draggables:d.draggables,droppables:d.droppables});return{...e,current:b,dimensions:{draggables:d.draggables,droppables:A},impact:T,viewport:a,scrollJumpRequest:o||null,forceShouldAnimate:o?!1:null}};function UP(e,t){return e.map(n=>t[n])}var y6=({impact:e,viewport:t,draggables:n,destination:r,forceShouldAnimate:s})=>{const o=e.displaced,a=UP(o.all,n),d=H0({afterDragging:a,destination:r,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:s,last:o});return{...e,displaced:d}},b6=({impact:e,draggable:t,droppable:n,draggables:r,viewport:s,afterCritical:o})=>{const a=ef({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:o});return Kg({pageBorderBoxCenter:a,draggable:t,viewport:s})},v6=({state:e,dimensions:t,viewport:n})=>{e.movementMode!=="SNAP"&&xt();const r=e.impact,s=n||e.viewport,o=t||e.dimensions,{draggables:a,droppables:d}=o,h=a[e.critical.draggable.id],p=Co(r);p||xt();const g=d[p],y=y6({impact:r,viewport:s,destination:g,draggables:a}),b=b6({impact:y,draggable:h,droppable:g,draggables:a,viewport:s,afterCritical:e.afterCritical});return L0({impact:y,clientSelection:b,state:e,dimensions:o,viewport:s})},HP=e=>({index:e.index,droppableId:e.droppableId}),w6=({draggable:e,home:t,draggables:n,viewport:r})=>{const s=Z0(t.axis,e.displaceBy),o=Su(t.descriptor.id,n),a=o.indexOf(e);a===-1&&xt();const d=o.slice(a+1),h=d.reduce((b,v)=>(b[v.descriptor.id]=!0,b),{}),p={inVirtualList:t.descriptor.mode==="virtual",displacedBy:s,effected:h};return{impact:{displaced:H0({afterDragging:d,destination:t,displacedBy:s,last:null,viewport:r.frame,forceShouldAnimate:!1}),displacedBy:s,at:{type:"REORDER",destination:HP(e.descriptor)}},afterCritical:p}},zP=(e,t)=>({draggables:e.draggables,droppables:Xg(e.droppables,t)}),GP=({draggable:e,offset:t,initialWindowScroll:n})=>{const r=Sh(e.client,t),s=Ch(r,n);return{...e,placeholder:{...e.placeholder,client:r},client:r,page:s}},WP=e=>{const t=e.frame;return t||xt(),t},VP=({additions:e,updatedDroppables:t,viewport:n})=>{const r=n.scroll.diff.value;return e.map(s=>{const o=s.descriptor.droppableId,a=t[o],h=WP(a).scroll.diff.value,p=xi(r,h);return GP({draggable:s,offset:p,initialWindowScroll:n.scroll.initial})})},qP=({state:e,published:t})=>{const n=t.modified.map(R=>{const D=e.dimensions.droppables[R.droppableId];return Wg(D,R.scroll)}),r={...e.dimensions.droppables,...r6(n)},s=s6(VP({additions:t.additions,updatedDroppables:r,viewport:e.viewport})),o={...e.dimensions.draggables,...s};t.removals.forEach(R=>{delete o[R]});const a={droppables:r,draggables:o},d=Co(e.impact),h=d?a.droppables[d]:null,p=a.draggables[e.critical.draggable.id],g=a.droppables[e.critical.droppable.id],{impact:y,afterCritical:b}=w6({draggable:p,home:g,draggables:o,viewport:e.viewport}),v=h&&h.isCombineEnabled?e.impact:y,T=x6({pageOffset:e.current.page.offset,draggable:a.draggables[e.critical.draggable.id],draggables:a.draggables,droppables:a.droppables,previousImpact:v,viewport:e.viewport,afterCritical:b}),A={...e,phase:"DRAGGING",impact:T,onLiftImpact:y,dimensions:a,afterCritical:b,forceShouldAnimate:!1};return e.phase==="COLLECTING"?A:{...A,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const Ym=e=>e.movementMode==="SNAP",Pp=(e,t,n)=>{const r=zP(e.dimensions,t);return!Ym(e)||n?L0({state:e,dimensions:r}):v6({state:e,dimensions:r})};function Qp(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const qx={phase:"IDLE",completed:null,shouldFlush:!1};var YP=(e=qx,t)=>{if(t.type==="FLUSH")return{...qx,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&xt();const{critical:n,clientSelection:r,viewport:s,dimensions:o,movementMode:a}=t.payload,d=o.draggables[n.draggable.id],h=o.droppables[n.droppable.id],p={selection:r,borderBoxCenter:d.client.borderBox.center,offset:ni},g={client:p,page:{selection:xi(p.selection,s.scroll.initial),borderBoxCenter:xi(p.selection,s.scroll.initial),offset:xi(p.selection,s.scroll.diff.value)}},y=Kh(o.droppables).every(A=>!A.isFixedOnPage),{impact:b,afterCritical:v}=w6({draggable:d,home:h,draggables:o.draggables,viewport:s});return{phase:"DRAGGING",isDragging:!0,critical:n,movementMode:a,dimensions:o,initial:g,current:g,isWindowScrollAllowed:y,impact:b,afterCritical:v,onLiftImpact:b,viewport:s,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&xt(),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||xt(),qP({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;tc(e)||xt();const{client:n}=t.payload;return Ol(n,e.current.client.selection)?e:L0({state:e,clientSelection:n,impact:Ym(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return Qp(e);tc(e)||xt();const{id:n,newScroll:r}=t.payload,s=e.dimensions.droppables[n];if(!s)return e;const o=Wg(s,r);return Pp(e,o,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;tc(e)||xt();const{id:n,isEnabled:r}=t.payload,s=e.dimensions.droppables[n];s||xt(),s.isEnabled===r&&xt();const o={...s,isEnabled:r};return Pp(e,o,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;tc(e)||xt();const{id:n,isCombineEnabled:r}=t.payload,s=e.dimensions.droppables[n];s||xt(),s.isCombineEnabled===r&&xt();const o={...s,isCombineEnabled:r};return Pp(e,o,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;tc(e)||xt(),e.isWindowScrollAllowed||xt();const n=t.payload.newScroll;if(Ol(e.viewport.scroll.current,n))return Qp(e);const r=u6(e.viewport,n);return Ym(e)?v6({state:e,viewport:r}):L0({state:e,viewport:r})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!tc(e))return e;const n=t.payload.maxScroll;if(Ol(n,e.viewport.scroll.max))return e;const r={...e.viewport,scroll:{...e.viewport.scroll,max:n}};return{...e,viewport:r}}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"&&xt();const n=RP({state:e,type:t.type});return n?L0({state:e,impact:n.impact,clientSelection:n.clientSelection,scrollJumpRequest:n.scrollJumpRequest}):e}if(t.type==="DROP_PENDING"){const n=t.payload.reason;return e.phase!=="COLLECTING"&&xt(),{...e,phase:"DROP_PENDING",isWaiting:!0,reason:n}}if(t.type==="DROP_ANIMATE"){const{completed:n,dropDuration:r,newHomeClientOffset:s}=t.payload;return e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||xt(),{phase:"DROP_ANIMATING",completed:n,dropDuration:r,newHomeClientOffset:s,dimensions:e.dimensions}}if(t.type==="DROP_COMPLETE"){const{completed:n}=t.payload;return{phase:"IDLE",completed:n,shouldFlush:!1}}return e};function xr(e,t){return e instanceof Object&&"type"in e&&e.type===t}const ZP=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),KP=e=>({type:"LIFT",payload:e}),XP=e=>({type:"INITIAL_PUBLISH",payload:e}),JP=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),eQ=()=>({type:"COLLECTION_STARTING",payload:null}),tQ=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),nQ=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),rQ=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),A6=e=>({type:"MOVE",payload:e}),sQ=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),iQ=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),oQ=()=>({type:"MOVE_UP",payload:null}),aQ=()=>({type:"MOVE_DOWN",payload:null}),lQ=()=>({type:"MOVE_RIGHT",payload:null}),cQ=()=>({type:"MOVE_LEFT",payload:null}),Jg=()=>({type:"FLUSH",payload:null}),uQ=e=>({type:"DROP_ANIMATE",payload:e}),e1=e=>({type:"DROP_COMPLETE",payload:e}),T6=e=>({type:"DROP",payload:e}),dQ=e=>({type:"DROP_PENDING",payload:e}),S6=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var hQ=e=>({getState:t,dispatch:n})=>r=>s=>{if(!xr(s,"LIFT")){r(s);return}const{id:o,clientSelection:a,movementMode:d}=s.payload,h=t();h.phase==="DROP_ANIMATING"&&n(e1({completed:h.completed})),t().phase!=="IDLE"&&xt(),n(Jg()),n(ZP({draggableId:o,movementMode:d}));const g={draggableId:o,scrollOptions:{shouldPublishImmediately:d==="SNAP"}},{critical:y,dimensions:b,viewport:v}=e.startPublishing(g);n(XP({critical:y,dimensions:b,clientSelection:a,movementMode:d,viewport:v}))},fQ=e=>()=>t=>n=>{xr(n,"INITIAL_PUBLISH")&&e.dragging(),xr(n,"DROP_ANIMATE")&&e.dropping(n.payload.completed.result.reason),(xr(n,"FLUSH")||xr(n,"DROP_COMPLETE"))&&e.resting(),t(n)};const t1={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},z0={opacity:{drop:0,combining:.7},scale:{drop:.75}},C6={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},ec=`${C6.outOfTheWay}s ${t1.outOfTheWay}`,k0={fluid:`opacity ${ec}`,snap:`transform ${ec}, opacity ${ec}`,drop:e=>{const t=`${e}s ${t1.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${ec}`,placeholder:`height ${ec}, width ${ec}, margin ${ec}`},Yx=e=>Ol(e,ni)?void 0:`translate(${e.x}px, ${e.y}px)`,Zm={moveTo:Yx,drop:(e,t)=>{const n=Yx(e);if(n)return t?`${n} scale(${z0.scale.drop})`:n}},{minDropTime:Km,maxDropTime:_6}=C6,pQ=_6-Km,Zx=1500,mQ=.6;var gQ=({current:e,destination:t,reason:n})=>{const r=$0(e,t);if(r<=0)return Km;if(r>=Zx)return _6;const s=r/Zx,o=Km+pQ*s,a=n==="CANCEL"?o*mQ:o;return Number(a.toFixed(2))},xQ=({impact:e,draggable:t,dimensions:n,viewport:r,afterCritical:s})=>{const{draggables:o,droppables:a}=n,d=Co(e),h=d?a[d]:null,p=a[t.descriptor.droppableId],g=b6({impact:e,draggable:t,draggables:o,afterCritical:s,droppable:h||p,viewport:r});return To(g,t.client.borderBox.center)},yQ=({draggables:e,reason:t,lastImpact:n,home:r,viewport:s,onLiftImpact:o})=>!n.at||t!=="DROP"?{impact:y6({draggables:e,impact:o,destination:r,viewport:s,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:n.at.type==="REORDER"?{impact:n,didDropInsideDroppable:!0}:{impact:{...n,displaced:U0},didDropInsideDroppable:!0};const bQ=({getState:e,dispatch:t})=>n=>r=>{if(!xr(r,"DROP")){n(r);return}const s=e(),o=r.payload.reason;if(s.phase==="COLLECTING"){t(dQ({reason:o}));return}if(s.phase==="IDLE")return;s.phase==="DROP_PENDING"&&s.isWaiting&&xt(),s.phase==="DRAGGING"||s.phase==="DROP_PENDING"||xt();const d=s.critical,h=s.dimensions,p=h.draggables[s.critical.draggable.id],{impact:g,didDropInsideDroppable:y}=yQ({reason:o,lastImpact:s.impact,afterCritical:s.afterCritical,onLiftImpact:s.onLiftImpact,home:s.dimensions.droppables[s.critical.droppable.id],viewport:s.viewport,draggables:s.dimensions.draggables}),b=y?Vg(g):null,v=y?Xh(g):null,T={index:d.draggable.index,droppableId:d.droppable.id},A={draggableId:p.descriptor.id,type:p.descriptor.type,source:T,reason:o,mode:s.movementMode,destination:b,combine:v},L=xQ({impact:g,draggable:p,dimensions:h,viewport:s.viewport,afterCritical:s.afterCritical}),R={critical:s.critical,afterCritical:s.afterCritical,result:A,impact:g};if(!(!Ol(s.current.client.offset,L)||!!A.combine)){t(e1({completed:R}));return}const B=gQ({current:s.current.client.offset,destination:L,reason:o});t(uQ({newHomeClientOffset:L,dropDuration:B,completed:R}))};var L6=()=>({x:window.pageXOffset,y:window.pageYOffset});function vQ(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function wQ({onWindowScroll:e}){function t(){e(L6())}const n=j0(t),r=vQ(n);let s=Ql;function o(){return s!==Ql}function a(){o()&&xt(),s=Yo(window,[r])}function d(){o()||xt(),n.cancel(),s(),s=Ql}return{start:a,stop:d,isActive:o}}const AQ=e=>xr(e,"DROP_COMPLETE")||xr(e,"DROP_ANIMATE")||xr(e,"FLUSH"),TQ=e=>{const t=wQ({onWindowScroll:n=>{e.dispatch(sQ({newScroll:n}))}});return n=>r=>{!t.isActive()&&xr(r,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&AQ(r)&&t.stop(),n(r)}};var SQ=e=>{let t=!1,n=!1;const r=setTimeout(()=>{n=!0}),s=o=>{t||n||(t=!0,e(o),clearTimeout(r))};return s.wasCalled=()=>t,s},CQ=()=>{const e=[],t=s=>{const o=e.findIndex(d=>d.timerId===s);o===-1&&xt();const[a]=e.splice(o,1);a.callback()};return{add:s=>{const o=setTimeout(()=>t(o)),a={timerId:o,callback:s};e.push(a)},flush:()=>{if(!e.length)return;const s=[...e];e.length=0,s.forEach(o=>{clearTimeout(o.timerId),o.callback()})}}};const _Q=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,LQ=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,kQ=(e,t)=>{if(e===t)return!0;const n=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,r=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return n&&r},i0=(e,t)=>{t()},Pd=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function Op(e,t,n,r){if(!e){n(r(t));return}const s=SQ(n);e(t,{announce:s}),s.wasCalled()||n(r(t))}var EQ=(e,t)=>{const n=CQ();let r=null;const s=(y,b)=>{r&&xt(),i0("onBeforeCapture",()=>{const v=e().onBeforeCapture;v&&v({draggableId:y,mode:b})})},o=(y,b)=>{r&&xt(),i0("onBeforeDragStart",()=>{const v=e().onBeforeDragStart;v&&v(Pd(y,b))})},a=(y,b)=>{r&&xt();const v=Pd(y,b);r={mode:b,lastCritical:y,lastLocation:v.source,lastCombine:null},n.add(()=>{i0("onDragStart",()=>Op(e().onDragStart,v,t,oh.onDragStart))})},d=(y,b)=>{const v=Vg(b),T=Xh(b);r||xt();const A=!kQ(y,r.lastCritical);A&&(r.lastCritical=y);const L=!_Q(r.lastLocation,v);L&&(r.lastLocation=v);const R=!LQ(r.lastCombine,T);if(R&&(r.lastCombine=T),!A&&!L&&!R)return;const D={...Pd(y,r.mode),combine:T,destination:v};n.add(()=>{i0("onDragUpdate",()=>Op(e().onDragUpdate,D,t,oh.onDragUpdate))})},h=()=>{r||xt(),n.flush()},p=y=>{r||xt(),r=null,i0("onDragEnd",()=>Op(e().onDragEnd,y,t,oh.onDragEnd))};return{beforeCapture:s,beforeStart:o,start:a,update:d,flush:h,drop:p,abort:()=>{if(!r)return;const y={...Pd(r.lastCritical,r.mode),combine:null,destination:null,reason:"CANCEL"};p(y)}}},IQ=(e,t)=>{const n=EQ(e,t);return r=>s=>o=>{if(xr(o,"BEFORE_INITIAL_CAPTURE")){n.beforeCapture(o.payload.draggableId,o.payload.movementMode);return}if(xr(o,"INITIAL_PUBLISH")){const d=o.payload.critical;n.beforeStart(d,o.payload.movementMode),s(o),n.start(d,o.payload.movementMode);return}if(xr(o,"DROP_COMPLETE")){const d=o.payload.completed.result;n.flush(),s(o),n.drop(d);return}if(s(o),xr(o,"FLUSH")){n.abort();return}const a=r.getState();a.phase==="DRAGGING"&&n.update(a.critical,a.impact)}};const RQ=e=>t=>n=>{if(!xr(n,"DROP_ANIMATION_FINISHED")){t(n);return}const r=e.getState();r.phase!=="DROP_ANIMATING"&&xt(),e.dispatch(e1({completed:r.completed}))},MQ=e=>{let t=null,n=null;function r(){n&&(cancelAnimationFrame(n),n=null),t&&(t(),t=null)}return s=>o=>{if((xr(o,"FLUSH")||xr(o,"DROP_COMPLETE")||xr(o,"DROP_ANIMATION_FINISHED"))&&r(),s(o),!xr(o,"DROP_ANIMATE"))return;const a={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(S6())}};n=requestAnimationFrame(()=>{n=null,t=Yo(window,[a])})}};var NQ=e=>()=>t=>n=>{(xr(n,"DROP_COMPLETE")||xr(n,"FLUSH")||xr(n,"DROP_ANIMATE"))&&e.stopPublishing(),t(n)},DQ=e=>{let t=!1;return()=>n=>r=>{if(xr(r,"INITIAL_PUBLISH")){t=!0,e.tryRecordFocus(r.payload.critical.draggable.id),n(r),e.tryRestoreFocusRecorded();return}if(n(r),!!t){if(xr(r,"FLUSH")){t=!1,e.tryRestoreFocusRecorded();return}if(xr(r,"DROP_COMPLETE")){t=!1;const s=r.payload.completed.result;s.combine&&e.tryShiftRecord(s.draggableId,s.combine.draggableId),e.tryRestoreFocusRecorded()}}}};const BQ=e=>xr(e,"DROP_COMPLETE")||xr(e,"DROP_ANIMATE")||xr(e,"FLUSH");var PQ=e=>t=>n=>r=>{if(BQ(r)){e.stop(),n(r);return}if(xr(r,"INITIAL_PUBLISH")){n(r);const s=t.getState();s.phase!=="DRAGGING"&&xt(),e.start(s);return}n(r),e.scroll(t.getState())};const QQ=e=>t=>n=>{if(t(n),!xr(n,"PUBLISH_WHILE_DRAGGING"))return;const r=e.getState();r.phase==="DROP_PENDING"&&(r.isWaiting||e.dispatch(T6({reason:r.reason})))},OQ=Hv;var FQ=({dimensionMarshal:e,focusMarshal:t,styleMarshal:n,getResponders:r,announce:s,autoScroller:o})=>Uv(YP,OQ(PD(fQ(n),NQ(e),hQ(e),bQ,RQ,MQ,QQ,PQ(o),TQ,DQ(t),IQ(r,s))));const Fp=()=>({additions:{},removals:{},modified:{}});function jQ({registry:e,callbacks:t}){let n=Fp(),r=null;const s=()=>{r||(t.collectionStarting(),r=requestAnimationFrame(()=>{r=null;const{additions:h,removals:p,modified:g}=n,y=Object.keys(h).map(T=>e.draggable.getById(T).getDimension(ni)).sort((T,A)=>T.descriptor.index-A.descriptor.index),b=Object.keys(g).map(T=>{const L=e.droppable.getById(T).callbacks.getScrollWhileDragging();return{droppableId:T,scroll:L}}),v={additions:y,removals:Object.keys(p),modified:b};n=Fp(),t.publish(v)}))};return{add:h=>{const p=h.descriptor.id;n.additions[p]=h,n.modified[h.descriptor.droppableId]=!0,n.removals[p]&&delete n.removals[p],s()},remove:h=>{const p=h.descriptor;n.removals[p.id]=!0,n.modified[p.droppableId]=!0,n.additions[p.id]&&delete n.additions[p.id],s()},stop:()=>{r&&(cancelAnimationFrame(r),r=null,n=Fp())}}}var k6=({scrollHeight:e,scrollWidth:t,height:n,width:r})=>{const s=To({x:t,y:e},{x:r,y:n});return{x:Math.max(0,s.x),y:Math.max(0,s.y)}},E6=()=>{const e=document.documentElement;return e||xt(),e},I6=()=>{const e=E6();return k6({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},$Q=()=>{const e=L6(),t=I6(),n=e.y,r=e.x,s=E6(),o=s.clientWidth,a=s.clientHeight,d=r+o,h=n+a;return{frame:fa({top:n,left:r,right:d,bottom:h}),scroll:{initial:e,current:e,max:t,diff:{value:ni,displacement:ni}}}},UQ=({critical:e,scrollOptions:t,registry:n})=>{const r=$Q(),s=r.scroll.current,o=e.droppable,a=n.droppable.getAllByType(o.type).map(g=>g.callbacks.getDimensionAndWatchScroll(s,t)),d=n.draggable.getAllByType(e.draggable.type).map(g=>g.getDimension(s));return{dimensions:{draggables:s6(d),droppables:r6(a)},critical:e,viewport:r}};function Kx(e,t,n){return!(n.descriptor.id===t.id||n.descriptor.type!==t.type||e.droppable.getById(n.descriptor.droppableId).descriptor.mode!=="virtual")}var HQ=(e,t)=>{let n=null;const r=jQ({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),s=(b,v)=>{e.droppable.exists(b)||xt(),n&&t.updateDroppableIsEnabled({id:b,isEnabled:v})},o=(b,v)=>{n&&(e.droppable.exists(b)||xt(),t.updateDroppableIsCombineEnabled({id:b,isCombineEnabled:v}))},a=(b,v)=>{n&&(e.droppable.exists(b)||xt(),t.updateDroppableScroll({id:b,newScroll:v}))},d=(b,v)=>{n&&e.droppable.getById(b).callbacks.scroll(v)},h=()=>{if(!n)return;r.stop();const b=n.critical.droppable;e.droppable.getAllByType(b.type).forEach(v=>v.callbacks.dragStopped()),n.unsubscribe(),n=null},p=b=>{n||xt();const v=n.critical.draggable;b.type==="ADDITION"&&Kx(e,v,b.value)&&r.add(b.value),b.type==="REMOVAL"&&Kx(e,v,b.value)&&r.remove(b.value)};return{updateDroppableIsEnabled:s,updateDroppableIsCombineEnabled:o,scrollDroppable:d,updateDroppableScroll:a,startPublishing:b=>{n&&xt();const v=e.draggable.getById(b.draggableId),T=e.droppable.getById(v.descriptor.droppableId),A={draggable:v.descriptor,droppable:T.descriptor},L=e.subscribe(p);return n={critical:A,unsubscribe:L},UQ({critical:A,registry:e,scrollOptions:b.scrollOptions})},stopPublishing:h}},R6=(e,t)=>e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP",zQ=e=>{window.scrollBy(e.x,e.y)};const GQ=ti(e=>Kh(e).filter(t=>!(!t.isEnabled||!t.frame))),WQ=(e,t)=>GQ(t).find(r=>(r.frame||xt(),p6(r.frame.pageMarginBox)(e)))||null;var VQ=({center:e,destination:t,droppables:n})=>{if(t){const s=n[t];return s.frame?s:null}return WQ(e,n)};const G0={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>e**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var qQ=(e,t,n=()=>G0)=>{const r=n(),s=e[t.size]*r.startFromPercentage,o=e[t.size]*r.maxScrollAtPercentage;return{startScrollingFrom:s,maxScrollValueAt:o}},M6=({startOfRange:e,endOfRange:t,current:n})=>{const r=t-e;return r===0?0:(n-e)/r},n1=1,YQ=(e,t,n=()=>G0)=>{const r=n();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return r.maxPixelScroll;if(e===t.startScrollingFrom)return n1;const o=1-M6({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),a=r.maxPixelScroll*r.ease(o);return Math.ceil(a)},ZQ=(e,t,n)=>{const r=n(),s=r.durationDampening.accelerateAt,o=r.durationDampening.stopDampeningAt,a=t,d=o,p=Date.now()-a;if(p>=o)return e;if(p<s)return n1;const g=M6({startOfRange:s,endOfRange:d,current:p}),y=e*r.ease(g);return Math.ceil(y)},Xx=({distanceToEdge:e,thresholds:t,dragStartTime:n,shouldUseTimeDampening:r,getAutoScrollerOptions:s})=>{const o=YQ(e,t,s);return o===0?0:r?Math.max(ZQ(o,n,s),n1):o},Jx=({container:e,distanceToEdges:t,dragStartTime:n,axis:r,shouldUseTimeDampening:s,getAutoScrollerOptions:o})=>{const a=qQ(e,r,o);return t[r.end]<t[r.start]?Xx({distanceToEdge:t[r.end],thresholds:a,dragStartTime:n,shouldUseTimeDampening:s,getAutoScrollerOptions:o}):-1*Xx({distanceToEdge:t[r.start],thresholds:a,dragStartTime:n,shouldUseTimeDampening:s,getAutoScrollerOptions:o})},KQ=({container:e,subject:t,proposedScroll:n})=>{const r=t.height>e.height,s=t.width>e.width;return!s&&!r?n:s&&r?null:{x:s?0:n.x,y:r?0:n.y}};const XQ=n6(e=>e===0?0:e);var N6=({dragStartTime:e,container:t,subject:n,center:r,shouldUseTimeDampening:s,getAutoScrollerOptions:o})=>{const a={top:r.y-t.top,right:t.right-r.x,bottom:t.bottom-r.y,left:r.x-t.left},d=Jx({container:t,distanceToEdges:a,dragStartTime:e,axis:qg,shouldUseTimeDampening:s,getAutoScrollerOptions:o}),h=Jx({container:t,distanceToEdges:a,dragStartTime:e,axis:a6,shouldUseTimeDampening:s,getAutoScrollerOptions:o}),p=XQ({x:h,y:d});if(Ol(p,ni))return null;const g=KQ({container:t,subject:n,proposedScroll:p});return g?Ol(g,ni)?null:g:null};const JQ=n6(e=>e===0?0:e>0?1:-1),r1=(()=>{const e=(t,n)=>t<0?t:t>n?t-n:0;return({current:t,max:n,change:r})=>{const s=xi(t,r),o={x:e(s.x,n.x),y:e(s.y,n.y)};return Ol(o,ni)?null:o}})(),D6=({max:e,current:t,change:n})=>{const r={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},s=JQ(n),o=r1({max:r,current:t,change:s});return!o||s.x!==0&&o.x===0||s.y!==0&&o.y===0},s1=(e,t)=>D6({current:e.scroll.current,max:e.scroll.max,change:t}),eO=(e,t)=>{if(!s1(e,t))return null;const n=e.scroll.max,r=e.scroll.current;return r1({current:r,max:n,change:t})},i1=(e,t)=>{const n=e.frame;return n?D6({current:n.scroll.current,max:n.scroll.max,change:t}):!1},tO=(e,t)=>{const n=e.frame;return!n||!i1(e,t)?null:r1({current:n.scroll.current,max:n.scroll.max,change:t})};var nO=({viewport:e,subject:t,center:n,dragStartTime:r,shouldUseTimeDampening:s,getAutoScrollerOptions:o})=>{const a=N6({dragStartTime:r,container:e.frame,subject:t,center:n,shouldUseTimeDampening:s,getAutoScrollerOptions:o});return a&&s1(e,a)?a:null},rO=({droppable:e,subject:t,center:n,dragStartTime:r,shouldUseTimeDampening:s,getAutoScrollerOptions:o})=>{const a=e.frame;if(!a)return null;const d=N6({dragStartTime:r,container:a.pageMarginBox,subject:t,center:n,shouldUseTimeDampening:s,getAutoScrollerOptions:o});return d&&i1(e,d)?d:null},ey=({state:e,dragStartTime:t,shouldUseTimeDampening:n,scrollWindow:r,scrollDroppable:s,getAutoScrollerOptions:o})=>{const a=e.current.page.borderBoxCenter,h=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const y=e.viewport,b=nO({dragStartTime:t,viewport:y,subject:h,center:a,shouldUseTimeDampening:n,getAutoScrollerOptions:o});if(b){r(b);return}}const p=VQ({center:a,destination:Co(e.impact),droppables:e.dimensions.droppables});if(!p)return;const g=rO({dragStartTime:t,droppable:p,subject:h,center:a,shouldUseTimeDampening:n,getAutoScrollerOptions:o});g&&s(p.descriptor.id,g)},sO=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:n=()=>G0})=>{const r=j0(e),s=j0(t);let o=null;const a=p=>{o||xt();const{shouldUseTimeDampening:g,dragStartTime:y}=o;ey({state:p,scrollWindow:r,scrollDroppable:s,dragStartTime:y,shouldUseTimeDampening:g,getAutoScrollerOptions:n})};return{start:p=>{o&&xt();const g=Date.now();let y=!1;const b=()=>{y=!0};ey({state:p,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:b,scrollDroppable:b,getAutoScrollerOptions:n}),o={dragStartTime:g,shouldUseTimeDampening:y},y&&a(p)},stop:()=>{o&&(r.cancel(),s.cancel(),o=null)},scroll:a}},iO=({move:e,scrollDroppable:t,scrollWindow:n})=>{const r=(d,h)=>{const p=xi(d.current.client.selection,h);e({client:p})},s=(d,h)=>{if(!i1(d,h))return h;const p=tO(d,h);if(!p)return t(d.descriptor.id,h),null;const g=To(h,p);return t(d.descriptor.id,g),To(h,g)},o=(d,h,p)=>{if(!d||!s1(h,p))return p;const g=eO(h,p);if(!g)return n(p),null;const y=To(p,g);return n(y),To(p,y)};return d=>{const h=d.scrollJumpRequest;if(!h)return;const p=Co(d.impact);p||xt();const g=s(d.dimensions.droppables[p],h);if(!g)return;const y=d.viewport,b=o(d.isWindowScrollAllowed,y,g);b&&r(d,b)}},oO=({scrollDroppable:e,scrollWindow:t,move:n,getAutoScrollerOptions:r})=>{const s=sO({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:r}),o=iO({move:n,scrollWindow:t,scrollDroppable:e});return{scroll:h=>{if(!(r().disabled||h.phase!=="DRAGGING")){if(h.movementMode==="FLUID"){s.scroll(h);return}h.scrollJumpRequest&&o(h)}},start:s.start,stop:s.stop}};const xu="data-rfd",yu=(()=>{const e=`${xu}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),Xm=(()=>{const e=`${xu}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),aO=(()=>{const e=`${xu}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),ty={contextId:`${xu}-scroll-container-context-id`},lO=e=>t=>`[${t}="${e}"]`,o0=(e,t)=>e.map(n=>{const r=n.styles[t];return r?`${n.selector} { ${r} }`:""}).join(" "),cO="pointer-events: none;";var uO=e=>{const t=lO(e),n=(()=>{const d=`
|
|
119
|
-
cursor: -webkit-grab;
|
|
120
|
-
cursor: grab;
|
|
121
|
-
`;return{selector:t(yu.contextId),styles:{always:`
|
|
122
|
-
-webkit-touch-callout: none;
|
|
123
|
-
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
|
124
|
-
touch-action: manipulation;
|
|
125
|
-
`,resting:d,dragging:cO,dropAnimating:d}}})(),r=(()=>{const d=`
|
|
126
|
-
transition: ${k0.outOfTheWay};
|
|
127
|
-
`;return{selector:t(Xm.contextId),styles:{dragging:d,dropAnimating:d,userCancel:d}}})(),s={selector:t(aO.contextId),styles:{always:"overflow-anchor: none;"}},a=[r,n,s,{selector:"body",styles:{dragging:`
|
|
128
|
-
cursor: grabbing;
|
|
129
|
-
cursor: -webkit-grabbing;
|
|
130
|
-
user-select: none;
|
|
131
|
-
-webkit-user-select: none;
|
|
132
|
-
-moz-user-select: none;
|
|
133
|
-
-ms-user-select: none;
|
|
134
|
-
overflow-anchor: none;
|
|
135
|
-
`}}];return{always:o0(a,"always"),resting:o0(a,"resting"),dragging:o0(a,"dragging"),dropAnimating:o0(a,"dropAnimating"),userCancel:o0(a,"userCancel")}};const _o=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?S.useLayoutEffect:S.useEffect,jp=()=>{const e=document.querySelector("head");return e||xt(),e},ny=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function dO(e,t){const n=Kn(()=>uO(e),[e]),r=S.useRef(null),s=S.useRef(null),o=Kt(ti(y=>{const b=s.current;b||xt(),b.textContent=y}),[]),a=Kt(y=>{const b=r.current;b||xt(),b.textContent=y},[]);_o(()=>{!r.current&&!s.current||xt();const y=ny(t),b=ny(t);return r.current=y,s.current=b,y.setAttribute(`${xu}-always`,e),b.setAttribute(`${xu}-dynamic`,e),jp().appendChild(y),jp().appendChild(b),a(n.always),o(n.resting),()=>{const v=T=>{const A=T.current;A||xt(),jp().removeChild(A),T.current=null};v(r),v(s)}},[t,a,o,n.always,n.resting,e]);const d=Kt(()=>o(n.dragging),[o,n.dragging]),h=Kt(y=>{if(y==="DROP"){o(n.dropAnimating);return}o(n.userCancel)},[o,n.dropAnimating,n.userCancel]),p=Kt(()=>{s.current&&o(n.resting)},[o,n.resting]);return Kn(()=>({dragging:d,dropping:h,resting:p}),[d,h,p])}function B6(e,t){return Array.from(e.querySelectorAll(t))}var P6=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function tf(e){return e instanceof P6(e).HTMLElement}function hO(e,t){const n=`[${yu.contextId}="${e}"]`,r=B6(document,n);if(!r.length)return null;const s=r.find(o=>o.getAttribute(yu.draggableId)===t);return!s||!tf(s)?null:s}function fO(e){const t=S.useRef({}),n=S.useRef(null),r=S.useRef(null),s=S.useRef(!1),o=Kt(function(b,v){const T={id:b,focus:v};return t.current[b]=T,function(){const L=t.current;L[b]!==T&&delete L[b]}},[]),a=Kt(function(b){const v=hO(e,b);v&&v!==document.activeElement&&v.focus()},[e]),d=Kt(function(b,v){n.current===b&&(n.current=v)},[]),h=Kt(function(){r.current||s.current&&(r.current=requestAnimationFrame(()=>{r.current=null;const b=n.current;b&&a(b)}))},[a]),p=Kt(function(b){n.current=null;const v=document.activeElement;v&&v.getAttribute(yu.draggableId)===b&&(n.current=b)},[]);return _o(()=>(s.current=!0,function(){s.current=!1;const b=r.current;b&&cancelAnimationFrame(b)}),[]),Kn(()=>({register:o,tryRecordFocus:p,tryRestoreFocusRecorded:h,tryShiftRecord:d}),[o,p,h,d])}function pO(){const e={draggables:{},droppables:{}},t=[];function n(y){return t.push(y),function(){const v=t.indexOf(y);v!==-1&&t.splice(v,1)}}function r(y){t.length&&t.forEach(b=>b(y))}function s(y){return e.draggables[y]||null}function o(y){const b=s(y);return b||xt(),b}const a={register:y=>{e.draggables[y.descriptor.id]=y,r({type:"ADDITION",value:y})},update:(y,b)=>{const v=e.draggables[b.descriptor.id];v&&v.uniqueId===y.uniqueId&&(delete e.draggables[b.descriptor.id],e.draggables[y.descriptor.id]=y)},unregister:y=>{const b=y.descriptor.id,v=s(b);v&&y.uniqueId===v.uniqueId&&(delete e.draggables[b],e.droppables[y.descriptor.droppableId]&&r({type:"REMOVAL",value:y}))},getById:o,findById:s,exists:y=>!!s(y),getAllByType:y=>Object.values(e.draggables).filter(b=>b.descriptor.type===y)};function d(y){return e.droppables[y]||null}function h(y){const b=d(y);return b||xt(),b}const p={register:y=>{e.droppables[y.descriptor.id]=y},unregister:y=>{const b=d(y.descriptor.id);b&&y.uniqueId===b.uniqueId&&delete e.droppables[y.descriptor.id]},getById:h,findById:d,exists:y=>!!d(y),getAllByType:y=>Object.values(e.droppables).filter(b=>b.descriptor.type===y)};function g(){e.draggables={},e.droppables={},t.length=0}return{draggable:a,droppable:p,subscribe:n,clean:g}}function mO(){const e=Kn(pO,[]);return S.useEffect(()=>function(){e.clean()},[e]),e}var o1=_.createContext(null),Ih=()=>{const e=document.body;return e||xt(),e};const gO={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},xO=e=>`rfd-announcement-${e}`;function yO(e){const t=Kn(()=>xO(e),[e]),n=S.useRef(null);return S.useEffect(function(){const o=document.createElement("div");return n.current=o,o.id=t,o.setAttribute("aria-live","assertive"),o.setAttribute("aria-atomic","true"),_h(o.style,gO),Ih().appendChild(o),function(){setTimeout(function(){const h=Ih();h.contains(o)&&h.removeChild(o),o===n.current&&(n.current=null)})}},[t]),Kt(s=>{const o=n.current;if(o){o.textContent=s;return}},[])}const bO={separator:"::"};function a1(e,t=bO){const n=_.useId();return Kn(()=>`${e}${t.separator}${n}`,[t.separator,e,n])}function vO({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function wO({contextId:e,text:t}){const n=a1("hidden-text",{separator:"-"}),r=Kn(()=>vO({contextId:e,uniqueId:n}),[n,e]);return S.useEffect(function(){const o=document.createElement("div");return o.id=r,o.textContent=t,o.style.display="none",Ih().appendChild(o),function(){const d=Ih();d.contains(o)&&d.removeChild(o)}},[r,t]),r}var nf=_.createContext(null);function Q6(e){const t=S.useRef(e);return S.useEffect(()=>{t.current=e}),t}function AO(){let e=null;function t(){return!!e}function n(a){return a===e}function r(a){e&&xt();const d={abandon:a};return e=d,d}function s(){e||xt(),e=null}function o(){e&&(e.abandon(),s())}return{isClaimed:t,isActive:n,claim:r,release:s,tryAbandon:o}}function W0(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const TO=9,SO=13,l1=27,O6=32,CO=33,_O=34,LO=35,kO=36,EO=37,IO=38,RO=39,MO=40,NO={[SO]:!0,[TO]:!0};var F6=e=>{NO[e.keyCode]&&e.preventDefault()};const rf=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(r=>`on${r}`in document)||e})(),j6=0,ry=5;function DO(e,t){return Math.abs(t.x-e.x)>=ry||Math.abs(t.y-e.y)>=ry}const sy={type:"IDLE"};function BO({cancel:e,completed:t,getPhase:n,setPhase:r}){return[{eventName:"mousemove",fn:s=>{const{button:o,clientX:a,clientY:d}=s;if(o!==j6)return;const h={x:a,y:d},p=n();if(p.type==="DRAGGING"){s.preventDefault(),p.actions.move(h);return}p.type!=="PENDING"&&xt();const g=p.point;if(!DO(g,h))return;s.preventDefault();const y=p.actions.fluidLift(h);r({type:"DRAGGING",actions:y})}},{eventName:"mouseup",fn:s=>{const o=n();if(o.type!=="DRAGGING"){e();return}s.preventDefault(),o.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:s=>{n().type==="DRAGGING"&&s.preventDefault(),e()}},{eventName:"keydown",fn:s=>{if(n().type==="PENDING"){e();return}if(s.keyCode===l1){s.preventDefault(),e();return}F6(s)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{n().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:s=>{const o=n();if(o.type==="IDLE"&&xt(),o.actions.shouldRespectForcePress()){e();return}s.preventDefault()}},{eventName:rf,fn:e}]}function PO(e){const t=S.useRef(sy),n=S.useRef(Ql),r=Kn(()=>({eventName:"mousedown",fn:function(y){if(y.defaultPrevented||y.button!==j6||y.ctrlKey||y.metaKey||y.shiftKey||y.altKey)return;const b=e.findClosestDraggableId(y);if(!b)return;const v=e.tryGetLock(b,a,{sourceEvent:y});if(!v)return;y.preventDefault();const T={x:y.clientX,y:y.clientY};n.current(),p(v,T)}}),[e]),s=Kn(()=>({eventName:"webkitmouseforcewillbegin",fn:g=>{if(g.defaultPrevented)return;const y=e.findClosestDraggableId(g);if(!y)return;const b=e.findOptionsForDraggable(y);b&&(b.shouldRespectForcePress||e.canGetLock(y)&&g.preventDefault())}}),[e]),o=Kt(function(){const y={passive:!1,capture:!0};n.current=Yo(window,[s,r],y)},[s,r]),a=Kt(()=>{t.current.type!=="IDLE"&&(t.current=sy,n.current(),o())},[o]),d=Kt(()=>{const g=t.current;a(),g.type==="DRAGGING"&&g.actions.cancel({shouldBlockNextClick:!0}),g.type==="PENDING"&&g.actions.abort()},[a]),h=Kt(function(){const y={capture:!0,passive:!1},b=BO({cancel:d,completed:a,getPhase:()=>t.current,setPhase:v=>{t.current=v}});n.current=Yo(window,b,y)},[d,a]),p=Kt(function(y,b){t.current.type!=="IDLE"&&xt(),t.current={type:"PENDING",point:b,actions:y},h()},[h]);_o(function(){return o(),function(){n.current()}},[o])}function QO(){}const OO={[_O]:!0,[CO]:!0,[kO]:!0,[LO]:!0};function FO(e,t){function n(){t(),e.cancel()}function r(){t(),e.drop()}return[{eventName:"keydown",fn:s=>{if(s.keyCode===l1){s.preventDefault(),n();return}if(s.keyCode===O6){s.preventDefault(),r();return}if(s.keyCode===MO){s.preventDefault(),e.moveDown();return}if(s.keyCode===IO){s.preventDefault(),e.moveUp();return}if(s.keyCode===RO){s.preventDefault(),e.moveRight();return}if(s.keyCode===EO){s.preventDefault(),e.moveLeft();return}if(OO[s.keyCode]){s.preventDefault();return}F6(s)}},{eventName:"mousedown",fn:n},{eventName:"mouseup",fn:n},{eventName:"click",fn:n},{eventName:"touchstart",fn:n},{eventName:"resize",fn:n},{eventName:"wheel",fn:n,options:{passive:!0}},{eventName:rf,fn:n}]}function jO(e){const t=S.useRef(QO),n=Kn(()=>({eventName:"keydown",fn:function(o){if(o.defaultPrevented||o.keyCode!==O6)return;const a=e.findClosestDraggableId(o);if(!a)return;const d=e.tryGetLock(a,g,{sourceEvent:o});if(!d)return;o.preventDefault();let h=!0;const p=d.snapLift();t.current();function g(){h||xt(),h=!1,t.current(),r()}t.current=Yo(window,FO(p,g),{capture:!0,passive:!1})}}),[e]),r=Kt(function(){const o={passive:!1,capture:!0};t.current=Yo(window,[n],o)},[n]);_o(function(){return r(),function(){t.current()}},[r])}const $p={type:"IDLE"},$O=120,UO=.15;function HO({cancel:e,getPhase:t}){return[{eventName:"orientationchange",fn:e},{eventName:"resize",fn:e},{eventName:"contextmenu",fn:n=>{n.preventDefault()}},{eventName:"keydown",fn:n=>{if(t().type!=="DRAGGING"){e();return}n.keyCode===l1&&n.preventDefault(),e()}},{eventName:rf,fn:e}]}function zO({cancel:e,completed:t,getPhase:n}){return[{eventName:"touchmove",options:{capture:!1},fn:r=>{const s=n();if(s.type!=="DRAGGING"){e();return}s.hasMoved=!0;const{clientX:o,clientY:a}=r.touches[0],d={x:o,y:a};r.preventDefault(),s.actions.move(d)}},{eventName:"touchend",fn:r=>{const s=n();if(s.type!=="DRAGGING"){e();return}r.preventDefault(),s.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:r=>{if(n().type!=="DRAGGING"){e();return}r.preventDefault(),e()}},{eventName:"touchforcechange",fn:r=>{const s=n();s.type==="IDLE"&&xt();const o=r.touches[0];if(!o||!(o.force>=UO))return;const d=s.actions.shouldRespectForcePress();if(s.type==="PENDING"){d&&e();return}if(d){if(s.hasMoved){r.preventDefault();return}e();return}r.preventDefault()}},{eventName:rf,fn:e}]}function GO(e){const t=S.useRef($p),n=S.useRef(Ql),r=Kt(function(){return t.current},[]),s=Kt(function(v){t.current=v},[]),o=Kn(()=>({eventName:"touchstart",fn:function(v){if(v.defaultPrevented)return;const T=e.findClosestDraggableId(v);if(!T)return;const A=e.tryGetLock(T,d,{sourceEvent:v});if(!A)return;const L=v.touches[0],{clientX:R,clientY:D}=L,B={x:R,y:D};n.current(),y(A,B)}}),[e]),a=Kt(function(){const v={capture:!0,passive:!1};n.current=Yo(window,[o],v)},[o]),d=Kt(()=>{const b=t.current;b.type!=="IDLE"&&(b.type==="PENDING"&&clearTimeout(b.longPressTimerId),s($p),n.current(),a())},[a,s]),h=Kt(()=>{const b=t.current;d(),b.type==="DRAGGING"&&b.actions.cancel({shouldBlockNextClick:!0}),b.type==="PENDING"&&b.actions.abort()},[d]),p=Kt(function(){const v={capture:!0,passive:!1},T={cancel:h,completed:d,getPhase:r},A=Yo(window,zO(T),v),L=Yo(window,HO(T),v);n.current=function(){A(),L()}},[h,r,d]),g=Kt(function(){const v=r();v.type!=="PENDING"&&xt();const T=v.actions.fluidLift(v.point);s({type:"DRAGGING",actions:T,hasMoved:!1})},[r,s]),y=Kt(function(v,T){r().type!=="IDLE"&&xt();const A=setTimeout(g,$O);s({type:"PENDING",point:T,actions:v,longPressTimerId:A}),p()},[p,r,s,g]);_o(function(){return a(),function(){n.current();const T=r();T.type==="PENDING"&&(clearTimeout(T.longPressTimerId),s($p))}},[r,a,s]),_o(function(){return Yo(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const WO=["input","button","textarea","select","option","optgroup","video","audio"];function $6(e,t){if(t==null)return!1;if(WO.includes(t.tagName.toLowerCase()))return!0;const r=t.getAttribute("contenteditable");return r==="true"||r===""?!0:t===e?!1:$6(e,t.parentElement)}function VO(e,t){const n=t.target;return tf(n)?$6(e,n):!1}var qO=e=>fa(e.getBoundingClientRect()).center;function YO(e){return e instanceof P6(e).Element}const ZO=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(r=>r in Element.prototype)||e})();function U6(e,t){return e==null?null:e[ZO](t)?e:U6(e.parentElement,t)}function KO(e,t){return e.closest?e.closest(t):U6(e,t)}function XO(e){return`[${yu.contextId}="${e}"]`}function JO(e,t){const n=t.target;if(!YO(n))return null;const r=XO(e),s=KO(n,r);return!s||!tf(s)?null:s}function eF(e,t){const n=JO(e,t);return n?n.getAttribute(yu.draggableId):null}function tF(e,t){const n=`[${Xm.contextId}="${e}"]`,s=B6(document,n).find(o=>o.getAttribute(Xm.id)===t);return!s||!tf(s)?null:s}function nF(e){e.preventDefault()}function Qd({expected:e,phase:t,isLockActive:n,shouldWarn:r}){return!(!n()||e!==t)}function H6({lockAPI:e,store:t,registry:n,draggableId:r}){if(e.isClaimed())return!1;const s=n.draggable.findById(r);return!(!s||!s.options.isEnabled||!R6(t.getState(),r))}function rF({lockAPI:e,contextId:t,store:n,registry:r,draggableId:s,forceSensorStop:o,sourceEvent:a}){if(!H6({lockAPI:e,store:n,registry:r,draggableId:s}))return null;const h=r.draggable.getById(s),p=tF(t,h.descriptor.id);if(!p||a&&!h.options.canDragInteractiveElements&&VO(p,a))return null;const g=e.claim(o||Ql);let y="PRE_DRAG";function b(){return h.options.shouldRespectForcePress}function v(){return e.isActive(g)}function T(P,$){Qd({expected:P,phase:y,isLockActive:v,shouldWarn:!0})&&n.dispatch($())}const A=T.bind(null,"DRAGGING");function L(P){function $(){e.release(),y="COMPLETED"}y!=="PRE_DRAG"&&($(),xt()),n.dispatch(KP(P.liftActionArgs)),y="DRAGGING";function z(H,ye={shouldBlockNextClick:!1}){if(P.cleanup(),ye.shouldBlockNextClick){const q=Yo(window,[{eventName:"click",fn:nF,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(q)}$(),n.dispatch(T6({reason:H}))}return{isActive:()=>Qd({expected:"DRAGGING",phase:y,isLockActive:v,shouldWarn:!1}),shouldRespectForcePress:b,drop:H=>z("DROP",H),cancel:H=>z("CANCEL",H),...P.actions}}function R(P){const $=j0(H=>{A(()=>A6({client:H}))});return{...L({liftActionArgs:{id:s,clientSelection:P,movementMode:"FLUID"},cleanup:()=>$.cancel(),actions:{move:$}}),move:$}}function D(){const P={moveUp:()=>A(oQ),moveRight:()=>A(lQ),moveDown:()=>A(aQ),moveLeft:()=>A(cQ)};return L({liftActionArgs:{id:s,clientSelection:qO(p),movementMode:"SNAP"},cleanup:Ql,actions:P})}function B(){Qd({expected:"PRE_DRAG",phase:y,isLockActive:v,shouldWarn:!0})&&e.release()}return{isActive:()=>Qd({expected:"PRE_DRAG",phase:y,isLockActive:v,shouldWarn:!1}),shouldRespectForcePress:b,fluidLift:R,snapLift:D,abort:B}}const sF=[PO,jO,GO];function iF({contextId:e,store:t,registry:n,customSensors:r,enableDefaultSensors:s}){const o=[...s?sF:[],...r||[]],a=S.useState(()=>AO())[0],d=Kt(function(L,R){W0(L)&&!W0(R)&&a.tryAbandon()},[a]);_o(function(){let L=t.getState();return t.subscribe(()=>{const D=t.getState();d(L,D),L=D})},[a,t,d]),_o(()=>a.tryAbandon,[a.tryAbandon]);const h=Kt(A=>H6({lockAPI:a,registry:n,store:t,draggableId:A}),[a,n,t]),p=Kt((A,L,R)=>rF({lockAPI:a,registry:n,contextId:e,store:t,draggableId:A,forceSensorStop:L||null,sourceEvent:R&&R.sourceEvent?R.sourceEvent:null}),[e,a,n,t]),g=Kt(A=>eF(e,A),[e]),y=Kt(A=>{const L=n.draggable.findById(A);return L?L.options:null},[n.draggable]),b=Kt(function(){a.isClaimed()&&(a.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(Jg()))},[a,t]),v=Kt(()=>a.isClaimed(),[a]),T=Kn(()=>({canGetLock:h,tryGetLock:p,findClosestDraggableId:g,findOptionsForDraggable:y,tryReleaseLock:b,isLockClaimed:v}),[h,p,g,y,b,v]);for(let A=0;A<o.length;A++)o[A](T)}const oF=e=>({onBeforeCapture:t=>{const n=()=>{e.onBeforeCapture&&e.onBeforeCapture(t)};ga.flushSync(n)},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),aF=e=>({...G0,...e.autoScrollerOptions,durationDampening:{...G0.durationDampening,...e.autoScrollerOptions}});function a0(e){return e.current||xt(),e.current}function lF(e){const{contextId:t,setCallbacks:n,sensors:r,nonce:s,dragHandleUsageInstructions:o}=e,a=S.useRef(null),d=Q6(e),h=Kt(()=>oF(d.current),[d]),p=Kt(()=>aF(d.current),[d]),g=yO(t),y=wO({contextId:t,text:o}),b=dO(t,s),v=Kt(q=>{a0(a).dispatch(q)},[]),T=Kn(()=>Ix({publishWhileDragging:JP,updateDroppableScroll:tQ,updateDroppableIsEnabled:nQ,updateDroppableIsCombineEnabled:rQ,collectionStarting:eQ},v),[v]),A=mO(),L=Kn(()=>HQ(A,T),[A,T]),R=Kn(()=>oO({scrollWindow:zQ,scrollDroppable:L.scrollDroppable,getAutoScrollerOptions:p,...Ix({move:A6},v)}),[L.scrollDroppable,v,p]),D=fO(t),B=Kn(()=>FQ({announce:g,autoScroller:R,dimensionMarshal:L,focusMarshal:D,getResponders:h,styleMarshal:b}),[g,R,L,D,h,b]);a.current=B;const j=Kt(()=>{const q=a0(a);q.getState().phase!=="IDLE"&&q.dispatch(Jg())},[]),P=Kt(()=>{const q=a0(a).getState();return q.phase==="DROP_ANIMATING"?!0:q.phase==="IDLE"?!1:q.isDragging},[]),$=Kn(()=>({isDragging:P,tryAbort:j}),[P,j]);n($);const z=Kt(q=>R6(a0(a).getState(),q),[]),H=Kt(()=>tc(a0(a).getState()),[]),ye=Kn(()=>({marshal:L,focus:D,contextId:t,canLift:z,isMovementAllowed:H,dragHandleUsageInstructionsId:y,registry:A}),[t,L,y,D,z,H,A]);return iF({contextId:t,store:B,registry:A,customSensors:r||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),S.useEffect(()=>j,[j]),_.createElement(nf.Provider,{value:ye},_.createElement(NB,{context:o1,store:B},e.children))}function cF(){return _.useId()}function Rh(e){const t=cF(),n=e.dragHandleUsageInstructions||oh.dragHandleUsageInstructions;return _.createElement(jB,null,r=>_.createElement(lF,{nonce:e.nonce,contextId:t,setCallbacks:r,dragHandleUsageInstructions:n,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 iy={dragging:5e3,dropAnimating:4500},uF=(e,t)=>t?k0.drop(t.duration):e?k0.snap:k0.fluid,dF=(e,t)=>{if(e)return t?z0.opacity.drop:z0.opacity.combining},hF=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function fF(e){const n=e.dimension.client,{offset:r,combineWith:s,dropping:o}=e,a=!!s,d=hF(e),h=!!o,p=h?Zm.drop(r,a):Zm.moveTo(r);return{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:uF(d,o),transform:p,opacity:dF(a,h),zIndex:h?iy.dropAnimating:iy.dragging,pointerEvents:"none"}}function pF(e){return{transform:Zm.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function mF(e){return e.type==="DRAGGING"?fF(e):pF(e)}function gF(e,t,n=ni){const r=window.getComputedStyle(t),s=t.getBoundingClientRect(),o=Zv(s,r),a=Ch(o,n),d={client:o,tagName:t.tagName.toLowerCase(),display:r.display},h={x:o.marginBox.width,y:o.marginBox.height};return{descriptor:e,placeholder:d,displaceBy:h,client:o,page:a}}function xF(e){const t=a1("draggable"),{descriptor:n,registry:r,getDraggableRef:s,canDragInteractiveElements:o,shouldRespectForcePress:a,isEnabled:d}=e,h=Kn(()=>({canDragInteractiveElements:o,shouldRespectForcePress:a,isEnabled:d}),[o,d,a]),p=Kt(v=>{const T=s();return T||xt(),gF(n,T,v)},[n,s]),g=Kn(()=>({uniqueId:t,descriptor:n,options:h,getDimension:p}),[n,p,h,t]),y=S.useRef(g),b=S.useRef(!0);_o(()=>(r.draggable.register(y.current),()=>r.draggable.unregister(y.current)),[r.draggable]),_o(()=>{if(b.current){b.current=!1;return}const v=y.current;y.current=g,r.draggable.update(g,v)},[g,r.draggable])}var c1=_.createContext(null);function Mh(e){const t=S.useContext(e);return t||xt(),t}function yF(e){e.preventDefault()}const bF=e=>{const t=S.useRef(null),n=Kt(($=null)=>{t.current=$},[]),r=Kt(()=>t.current,[]),{contextId:s,dragHandleUsageInstructionsId:o,registry:a}=Mh(nf),{type:d,droppableId:h}=Mh(c1),p=Kn(()=>({id:e.draggableId,index:e.index,type:d,droppableId:h}),[e.draggableId,e.index,d,h]),{children:g,draggableId:y,isEnabled:b,shouldRespectForcePress:v,canDragInteractiveElements:T,isClone:A,mapped:L,dropAnimationFinished:R}=e;if(!A){const $=Kn(()=>({descriptor:p,registry:a,getDraggableRef:r,canDragInteractiveElements:T,shouldRespectForcePress:v,isEnabled:b}),[p,a,r,T,v,b]);xF($)}const D=Kn(()=>b?{tabIndex:0,role:"button","aria-describedby":o,"data-rfd-drag-handle-draggable-id":y,"data-rfd-drag-handle-context-id":s,draggable:!1,onDragStart:yF}:null,[s,o,y,b]),B=Kt($=>{L.type==="DRAGGING"&&L.dropping&&$.propertyName==="transform"&&ga.flushSync(R)},[R,L]),j=Kn(()=>{const $=mF(L),z=L.type==="DRAGGING"&&L.dropping?B:void 0;return{innerRef:n,draggableProps:{"data-rfd-draggable-context-id":s,"data-rfd-draggable-id":y,style:$,onTransitionEnd:z},dragHandleProps:D}},[s,D,y,L,B,n]),P=Kn(()=>({draggableId:p.id,type:p.type,source:{index:p.index,droppableId:p.droppableId}}),[p.droppableId,p.id,p.index,p.type]);return _.createElement(_.Fragment,null,g(j,L.snapshot,P))};var z6=(e,t)=>e===t,G6=e=>{const{combine:t,destination:n}=e;return n?n.droppableId:t?t.droppableId:null};const vF=e=>e.combine?e.combine.draggableId:null,wF=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function AF(){const e=ti((s,o)=>({x:s,y:o})),t=ti((s,o,a=null,d=null,h=null)=>({isDragging:!0,isClone:o,isDropAnimating:!!h,dropAnimation:h,mode:s,draggingOver:a,combineWith:d,combineTargetFor:null})),n=ti((s,o,a,d,h=null,p=null,g=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:h,combineWith:p,mode:o,offset:s,dimension:a,forceShouldAnimate:g,snapshot:t(o,d,h,p,null)}}));return(s,o)=>{if(W0(s)){if(s.critical.draggable.id!==o.draggableId)return null;const a=s.current.client.offset,d=s.dimensions.draggables[o.draggableId],h=Co(s.impact),p=wF(s.impact),g=s.forceShouldAnimate;return n(e(a.x,a.y),s.movementMode,d,o.isClone,h,p,g)}if(s.phase==="DROP_ANIMATING"){const a=s.completed;if(a.result.draggableId!==o.draggableId)return null;const d=o.isClone,h=s.dimensions.draggables[o.draggableId],p=a.result,g=p.mode,y=G6(p),b=vF(p),T={duration:s.dropDuration,curve:t1.drop,moveTo:s.newHomeClientOffset,opacity:b?z0.opacity.drop:null,scale:b?z0.scale.drop:null};return{mapped:{type:"DRAGGING",offset:s.newHomeClientOffset,dimension:h,dropping:T,draggingOver:y,combineWith:b,mode:g,forceShouldAnimate:null,snapshot:t(g,d,y,b,T)}}}return null}}function W6(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const TF={mapped:{type:"SECONDARY",offset:ni,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:W6(null)}};function SF(){const e=ti((a,d)=>({x:a,y:d})),t=ti(W6),n=ti((a,d=null,h)=>({mapped:{type:"SECONDARY",offset:a,combineTargetFor:d,shouldAnimateDisplacement:h,snapshot:t(d)}})),r=a=>a?n(ni,a,!0):null,s=(a,d,h,p)=>{const g=h.displaced.visible[a],y=!!(p.inVirtualList&&p.effected[a]),b=Xh(h),v=b&&b.draggableId===a?d:null;if(!g){if(!y)return r(v);if(h.displaced.invisible[a])return null;const L=Tu(p.displacedBy.point),R=e(L.x,L.y);return n(R,v,!0)}if(y)return r(v);const T=h.displacedBy.point,A=e(T.x,T.y);return n(A,v,g.shouldAnimate)};return(a,d)=>{if(W0(a))return a.critical.draggable.id===d.draggableId?null:s(d.draggableId,a.critical.draggable.id,a.impact,a.afterCritical);if(a.phase==="DROP_ANIMATING"){const h=a.completed;return h.result.draggableId===d.draggableId?null:s(d.draggableId,h.result.draggableId,h.impact,h.afterCritical)}return null}}const CF=()=>{const e=AF(),t=SF();return(r,s)=>e(r,s)||t(r,s)||TF},_F={dropAnimationFinished:S6},LF=Yv(CF,_F,null,{context:o1,areStatePropsEqual:z6})(bF);function V6(e){return Mh(c1).isUsingCloneFor===e.draggableId&&!e.isClone?null:_.createElement(LF,e)}function rl(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,n=!!e.disableInteractiveElementBlocking,r=!!e.shouldRespectForcePress;return _.createElement(V6,_h({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:n,shouldRespectForcePress:r}))}const q6=e=>t=>e===t,kF=q6("scroll"),EF=q6("auto"),oy=(e,t)=>t(e.overflowX)||t(e.overflowY),IF=e=>{const t=window.getComputedStyle(e),n={overflowX:t.overflowX,overflowY:t.overflowY};return oy(n,kF)||oy(n,EF)},RF=()=>!1,Y6=e=>e==null?null:e===document.body?RF()?e:null:e===document.documentElement?null:IF(e)?e:Y6(e.parentElement);var Jm=e=>({x:e.scrollLeft,y:e.scrollTop});const Z6=e=>e?window.getComputedStyle(e).position==="fixed"?!0:Z6(e.parentElement):!1;var MF=e=>{const t=Y6(e),n=Z6(e);return{closestScrollable:t,isFixedOnPage:n}},NF=({descriptor:e,isEnabled:t,isCombineEnabled:n,isFixedOnPage:r,direction:s,client:o,page:a,closest:d})=>{const h=(()=>{if(!d)return null;const{scrollSize:b,client:v}=d,T=k6({scrollHeight:b.scrollHeight,scrollWidth:b.scrollWidth,height:v.paddingBox.height,width:v.paddingBox.width});return{pageMarginBox:d.page.marginBox,frameClient:v,scrollSize:b,shouldClipSubject:d.shouldClipSubject,scroll:{initial:d.scroll,current:d.scroll,max:T,diff:{value:ni,displacement:ni}}}})(),p=s==="vertical"?qg:a6,g=gu({page:a,withPlaceholder:null,axis:p,frame:h});return{descriptor:e,isCombineEnabled:n,isFixedOnPage:r,axis:p,isEnabled:t,client:o,page:a,frame:h,subject:g}};const DF=(e,t)=>{const n=Kv(e);if(!t||e!==t)return n;const r=n.paddingBox.top-t.scrollTop,s=n.paddingBox.left-t.scrollLeft,o=r+t.scrollHeight,a=s+t.scrollWidth,h=zg({top:r,right:a,bottom:o,left:s},n.border);return Gg({borderBox:h,margin:n.margin,border:n.border,padding:n.padding})};var BF=({ref:e,descriptor:t,env:n,windowScroll:r,direction:s,isDropDisabled:o,isCombineEnabled:a,shouldClipSubject:d})=>{const h=n.closestScrollable,p=DF(e,h),g=Ch(p,r),y=(()=>{if(!h)return null;const v=Kv(h),T={scrollHeight:h.scrollHeight,scrollWidth:h.scrollWidth};return{client:v,page:Ch(v,r),scroll:Jm(h),scrollSize:T,shouldClipSubject:d}})();return NF({descriptor:t,isEnabled:!o,isCombineEnabled:a,isFixedOnPage:n.isFixedOnPage,direction:s,client:p,page:g,closest:y})};const PF={passive:!1},QF={passive:!0};var ay=e=>e.shouldPublishImmediately?PF:QF;const Od=e=>e&&e.env.closestScrollable||null;function OF(e){const t=S.useRef(null),n=Mh(nf),r=a1("droppable"),{registry:s,marshal:o}=n,a=Q6(e),d=Kn(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),h=S.useRef(d),p=Kn(()=>ti((j,P)=>{t.current||xt();const $={x:j,y:P};o.updateDroppableScroll(d.id,$)}),[d.id,o]),g=Kt(()=>{const j=t.current;return!j||!j.env.closestScrollable?ni:Jm(j.env.closestScrollable)},[]),y=Kt(()=>{const j=g();p(j.x,j.y)},[g,p]),b=Kn(()=>j0(y),[y]),v=Kt(()=>{const j=t.current,P=Od(j);if(j&&P||xt(),j.scrollOptions.shouldPublishImmediately){y();return}b()},[b,y]),T=Kt((j,P)=>{t.current&&xt();const $=a.current,z=$.getDroppableRef();z||xt();const H=MF(z),ye={ref:z,descriptor:d,env:H,scrollOptions:P};t.current=ye;const q=BF({ref:z,descriptor:d,env:H,windowScroll:j,direction:$.direction,isDropDisabled:$.isDropDisabled,isCombineEnabled:$.isCombineEnabled,shouldClipSubject:!$.ignoreContainerClipping}),te=H.closestScrollable;return te&&(te.setAttribute(ty.contextId,n.contextId),te.addEventListener("scroll",v,ay(ye.scrollOptions))),q},[n.contextId,d,v,a]),A=Kt(()=>{const j=t.current,P=Od(j);return j&&P||xt(),Jm(P)},[]),L=Kt(()=>{const j=t.current;j||xt();const P=Od(j);t.current=null,P&&(b.cancel(),P.removeAttribute(ty.contextId),P.removeEventListener("scroll",v,ay(j.scrollOptions)))},[v,b]),R=Kt(j=>{const P=t.current;P||xt();const $=Od(P);$||xt(),$.scrollTop+=j.y,$.scrollLeft+=j.x},[]),D=Kn(()=>({getDimensionAndWatchScroll:T,getScrollWhileDragging:A,dragStopped:L,scroll:R}),[L,T,A,R]),B=Kn(()=>({uniqueId:r,descriptor:d,callbacks:D}),[D,d,r]);_o(()=>(h.current=B.descriptor,s.droppable.register(B),()=>{t.current&&L(),s.droppable.unregister(B)}),[D,d,L,B,o,s.droppable]),_o(()=>{t.current&&o.updateDroppableIsEnabled(h.current.id,!e.isDropDisabled)},[e.isDropDisabled,o]),_o(()=>{t.current&&o.updateDroppableIsCombineEnabled(h.current.id,e.isCombineEnabled)},[e.isCombineEnabled,o])}function Up(){}const ly={width:0,height:0,margin:VB},FF=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>e||n==="close"?ly:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},jF=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>{const r=FF({isAnimatingOpenOnMount:e,placeholder:t,animate:n});return{display:t.display,boxSizing:"border-box",width:r.width,height:r.height,marginTop:r.margin.top,marginRight:r.margin.right,marginBottom:r.margin.bottom,marginLeft:r.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:n!=="none"?k0.placeholder:null}},$F=e=>{const t=S.useRef(null),n=Kt(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:r,onTransitionEnd:s,onClose:o,contextId:a}=e,[d,h]=S.useState(e.animate==="open");S.useEffect(()=>d?r!=="open"?(n(),h(!1),Up):t.current?Up:(t.current=setTimeout(()=>{t.current=null,h(!1)}),n):Up,[r,d,n]);const p=Kt(y=>{y.propertyName==="height"&&(s(),r==="close"&&o())},[r,o,s]),g=jF({isAnimatingOpenOnMount:d,animate:e.animate,placeholder:e.placeholder});return _.createElement(e.placeholder.tagName,{style:g,"data-rfd-placeholder-context-id":a,onTransitionEnd:p,ref:e.innerRef})};var UF=_.memo($F);class HF extends _.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,n){return t.shouldAnimate?t.on?{isVisible:!0,data:t.on,animate:"open"}:n.isVisible?{isVisible:!0,data:n.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 zF=e=>{const t=S.useContext(nf);t||xt();const{contextId:n,isMovementAllowed:r}=t,s=S.useRef(null),o=S.useRef(null),{children:a,droppableId:d,type:h,mode:p,direction:g,ignoreContainerClipping:y,isDropDisabled:b,isCombineEnabled:v,snapshot:T,useClone:A,updateViewportMaxScroll:L,getContainerForClone:R}=e,D=Kt(()=>s.current,[]),B=Kt((te=null)=>{s.current=te},[]);Kt(()=>o.current,[]);const j=Kt((te=null)=>{o.current=te},[]),P=Kt(()=>{r()&&L({maxScroll:I6()})},[r,L]);OF({droppableId:d,type:h,mode:p,direction:g,isDropDisabled:b,isCombineEnabled:v,ignoreContainerClipping:y,getDroppableRef:D});const $=Kn(()=>_.createElement(HF,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:te,data:ve,animate:ge})=>_.createElement(UF,{placeholder:ve,onClose:te,innerRef:j,animate:ge,contextId:n,onTransitionEnd:P})),[n,P,e.placeholder,e.shouldAnimatePlaceholder,j]),z=Kn(()=>({innerRef:B,placeholder:$,droppableProps:{"data-rfd-droppable-id":d,"data-rfd-droppable-context-id":n}}),[n,d,$,B]),H=A?A.dragging.draggableId:null,ye=Kn(()=>({droppableId:d,type:h,isUsingCloneFor:H}),[d,H,h]);function q(){if(!A)return null;const{dragging:te,render:ve}=A,ge=_.createElement(V6,{draggableId:te.draggableId,index:te.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(ie,Ae)=>ve(ie,Ae,te));return D8.createPortal(ge,R())}return _.createElement(c1.Provider,{value:ye},a(z,T),q())};function GF(){return document.body||xt(),document.body}const cy={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:GF},K6=e=>{let t={...e},n;for(n in cy)e[n]===void 0&&(t={...t,[n]:cy[n]});return t},Hp=(e,t)=>e===t.droppable.type,uy=(e,t)=>t.draggables[e.draggable.id],WF=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},n=ti(o=>({draggableId:o.id,type:o.type,source:{index:o.index,droppableId:o.droppableId}})),r=ti((o,a,d,h,p,g)=>{const y=p.descriptor.id;if(p.descriptor.droppableId===o){const T=g?{render:g,dragging:n(p.descriptor)}:null,A={isDraggingOver:d,draggingOverWith:d?y:null,draggingFromThisWith:y,isUsingPlaceholder:!0};return{placeholder:p.placeholder,shouldAnimatePlaceholder:!1,snapshot:A,useClone:T}}if(!a)return t;if(!h)return e;const v={isDraggingOver:d,draggingOverWith:y,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:p.placeholder,shouldAnimatePlaceholder:!0,snapshot:v,useClone:null}});return(o,a)=>{const d=K6(a),h=d.droppableId,p=d.type,g=!d.isDropDisabled,y=d.renderClone;if(W0(o)){const b=o.critical;if(!Hp(p,b))return t;const v=uy(b,o.dimensions),T=Co(o.impact)===h;return r(h,g,T,T,v,y)}if(o.phase==="DROP_ANIMATING"){const b=o.completed;if(!Hp(p,b.critical))return t;const v=uy(b.critical,o.dimensions);return r(h,g,G6(b.result)===h,Co(b.impact)===h,v,y)}if(o.phase==="IDLE"&&o.completed&&!o.shouldFlush){const b=o.completed;if(!Hp(p,b.critical))return t;const v=Co(b.impact)===h,T=!!(b.impact.at&&b.impact.at.type==="COMBINE"),A=b.critical.droppable.id===h;return v?T?e:t:A?e:t}return t}},VF={updateViewportMaxScroll:iQ},sl=Yv(WF,VF,(e,t,n)=>({...K6(n),...e,...t}),{context:o1,areStatePropsEqual:z6})(zF);function qF(){if(typeof window>"u")return iu(void 0);try{const e=window.localStorage.getItem(Im);return iu(e?JSON.parse(e):void 0)}catch{return iu(void 0)}}function zp(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(Im),n=t?JSON.parse(t):{},r=iu({...n,...e});window.localStorage.setItem(Im,JSON.stringify(r))}catch{}}function YF(){const[e,t]=_.useState(qF);_.useEffect(()=>{zp(e)},[e]);const n=_.useCallback(s=>{t(o=>{const a=iu({...o,...s});return zp(a),a})},[]),r=_.useCallback(()=>{const s=iu(void 0);t(s),zp(s)},[]);return{terminalSettings:e,updateTerminalSettings:n,resetTerminalSettings:r}}const eg="termdock-settings";function ZF(e){return e==="shell"||e==="tmux"}function KF(){if(typeof window>"u")return{mode:"shell",tmuxName:"",userSelectedMode:null};try{const e=window.localStorage.getItem(eg);if(!e)return{mode:"shell",tmuxName:"",userSelectedMode:null};const t=JSON.parse(e),n=t.newSessionModeUserSelected===!0&&ZF(t.newSessionMode)?t.newSessionMode:null,r=n??"shell",s=typeof t.newSessionTmuxName=="string"?t.newSessionTmuxName:"";return{mode:r,tmuxName:s,userSelectedMode:n}}catch{return{mode:"shell",tmuxName:"",userSelectedMode:null}}}function dy(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(eg),r={...t?JSON.parse(t):{},...e};window.localStorage.setItem(eg,JSON.stringify(r))}catch{}}function XF(){const[e,t]=_.useState(KF),n=_.useCallback((s,o)=>{const a=o?.userInitiated!==!1;t(d=>({...d,mode:s,userSelectedMode:a?s:d.userSelectedMode})),a&&dy({newSessionMode:s,newSessionModeUserSelected:!0})},[]),r=_.useCallback(s=>{t(o=>({...o,tmuxName:s})),dy({newSessionTmuxName:s})},[]);return{newSessionMode:e.mode,newSessionTmuxName:e.tmuxName,userSelectedNewSessionMode:e.userSelectedMode,setNewSessionMode:n,setNewSessionTmuxName:r}}const JF=550,ej=10;function X6(){const e=S.useRef(null),t=S.useRef(null),n=S.useRef(!1),r=S.useRef(!1),s=S.useRef(null),o=S.useCallback(()=>{e.current!=null&&(window.clearTimeout(e.current),e.current=null)},[]),a=S.useCallback(()=>{o(),t.current=null},[o]);return S.useCallback(h=>({onPointerDown:p=>{p.pointerType!=="touch"&&p.pointerType!=="pen"||(a(),n.current=!1,t.current={pointerId:p.pointerId,startX:p.clientX,startY:p.clientY},e.current=window.setTimeout(()=>{e.current=null,t.current&&(n.current=!0,h())},JF))},onPointerMove:p=>{const g=t.current;if(!g||g.pointerId!==p.pointerId||n.current)return;const y=p.clientX-g.startX,b=p.clientY-g.startY;Math.hypot(y,b)>ej&&a()},onPointerUp:p=>{n.current&&(p.preventDefault(),n.current=!1,r.current=!0,s.current!=null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{r.current=!1,s.current=null},600)),a()},onPointerCancel:a,onPointerLeave:p=>{t.current?.pointerId===p.pointerId&&!n.current&&a()},onClickCapture:p=>{r.current&&(r.current=!1,s.current!=null&&(window.clearTimeout(s.current),s.current=null),p.preventDefault(),p.stopPropagation())}}),[a])}function hy({mode:e,activeProgram:t,promptState:n,shellNames:r}){return e!=="tmux"?!1:n==="running"?!0:n==="idle"?!1:t===null||!r.has(t.toLowerCase())}function J6(e){const t=document.querySelector('meta[name="theme-color"]');t&&t.setAttribute("content",e==="light"?"#FFFCF0":"#1C1B1A")}function tj(e,t,n){return!!(e&&t===e&&!n)}function nj(e,t,n){return Math.max(t,Math.min(e,n))}const jr={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 fy(e,t,n){return t===0||Math.abs(t)===1/0?Math.pow(e,n*5):e*t*n/(t+n*e)}function py(e,t,n,r=.15){return r===0?nj(e,t,n):e<t?-fy(t-e,n-t,r)+t:e>n?+fy(e-n,n-t,r)+n:e}function rj(e,[t,n],[r,s]){const[[o,a],[d,h]]=e;return[py(t,o,a,r),py(n,d,h,s)]}function sj(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ij(e){var t=sj(e,"string");return typeof t=="symbol"?t:String(t)}function Ts(e,t,n){return t=ij(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function my(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Xr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?my(Object(n),!0).forEach(function(r){Ts(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):my(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const ew={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 gy(e){return e?e[0].toUpperCase()+e.slice(1):""}const oj=["enter","leave"];function aj(e=!1,t){return e&&!oj.includes(t)}function lj(e,t="",n=!1){const r=ew[e],s=r&&r[t]||t;return"on"+gy(e)+gy(s)+(aj(n,s)?"Capture":"")}const cj=["gotpointercapture","lostpointercapture"];function uj(e){let t=e.substring(2).toLowerCase();const n=!!~t.indexOf("passive");n&&(t=t.replace("passive",""));const r=cj.includes(t)?"capturecapture":"capture",s=!!~t.indexOf(r);return s&&(t=t.replace("capture","")),{device:t,capture:s,passive:n}}function dj(e,t=""){const n=ew[e],r=n&&n[t]||t;return e+r}function sf(e){return"touches"in e}function tw(e){return sf(e)?"touch":"pointerType"in e?e.pointerType:"mouse"}function hj(e){return Array.from(e.touches).filter(t=>{var n,r;return t.target===e.currentTarget||((n=e.currentTarget)===null||n===void 0||(r=n.contains)===null||r===void 0?void 0:r.call(n,t.target))})}function fj(e){return e.type==="touchend"||e.type==="touchcancel"?e.changedTouches:e.targetTouches}function nw(e){return sf(e)?fj(e)[0]:e}function tg(e,t){try{const n=t.clientX-e.clientX,r=t.clientY-e.clientY,s=(t.clientX+e.clientX)/2,o=(t.clientY+e.clientY)/2,a=Math.hypot(n,r);return{angle:-(Math.atan2(n,r)*180)/Math.PI,distance:a,origin:[s,o]}}catch{}return null}function pj(e){return hj(e).map(t=>t.identifier)}function xy(e,t){const[n,r]=Array.from(e.touches).filter(s=>t.includes(s.identifier));return tg(n,r)}function Gp(e){const t=nw(e);return sf(e)?t.identifier:t.pointerId}function bu(e){const t=nw(e);return[t.clientX,t.clientY]}const yy=40,by=800;function rw(e){let{deltaX:t,deltaY:n,deltaMode:r}=e;return r===1?(t*=yy,n*=yy):r===2&&(t*=by,n*=by),[t,n]}function mj(e){var t,n;const{scrollX:r,scrollY:s,scrollLeft:o,scrollTop:a}=e.currentTarget;return[(t=r??o)!==null&&t!==void 0?t:0,(n=s??a)!==null&&n!==void 0?n:0]}function gj(e){const t={};if("buttons"in e&&(t.buttons=e.buttons),"shiftKey"in e){const{shiftKey:n,altKey:r,metaKey:s,ctrlKey:o}=e;Object.assign(t,{shiftKey:n,altKey:r,metaKey:s,ctrlKey:o})}return t}function Nh(e,...t){return typeof e=="function"?e(...t):e}function xj(){}function yj(...e){return e.length===0?xj:e.length===1?e[0]:function(){let t;for(const n of e)t=n.apply(this,arguments)||t;return t}}function vy(e,t){return Object.assign({},t,e||{})}const bj=32;class sw{constructor(t,n,r){this.ctrl=t,this.args=n,this.key=r,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:n,ingKey:r,args:s}=this;n[r]=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=s,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 n=this.state,r=this.config;n._active||(this.reset(),this.computeInitial(),n._active=!0,n.target=t.target,n.currentTarget=t.currentTarget,n.lastOffset=r.from?Nh(r.from,n):n.offset,n.offset=n.lastOffset,n.startTime=n.timeStamp=t.timeStamp)}computeValues(t){const n=this.state;n._values=t,n.values=this.config.transform(t)}computeInitial(){const t=this.state;t._initial=t._values,t.initial=t.values}compute(t){const{state:n,config:r,shared:s}=this;n.args=this.args;let o=0;if(t&&(n.event=t,r.preventDefault&&t.cancelable&&n.event.preventDefault(),n.type=t.type,s.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,s.locked=!!document.pointerLockElement,Object.assign(s,gj(t)),s.down=s.pressed=s.buttons%2===1||s.touches>0,o=t.timeStamp-n.timeStamp,n.timeStamp=t.timeStamp,n.elapsedTime=n.timeStamp-n.startTime),n._active){const $=n._delta.map(Math.abs);jr.addTo(n._distance,$)}this.axisIntent&&this.axisIntent(t);const[a,d]=n._movement,[h,p]=r.threshold,{_step:g,values:y}=n;if(r.hasCustomTransform?(g[0]===!1&&(g[0]=Math.abs(a)>=h&&y[0]),g[1]===!1&&(g[1]=Math.abs(d)>=p&&y[1])):(g[0]===!1&&(g[0]=Math.abs(a)>=h&&Math.sign(a)*h),g[1]===!1&&(g[1]=Math.abs(d)>=p&&Math.sign(d)*p)),n.intentional=g[0]!==!1||g[1]!==!1,!n.intentional)return;const b=[0,0];if(r.hasCustomTransform){const[$,z]=y;b[0]=g[0]!==!1?$-g[0]:0,b[1]=g[1]!==!1?z-g[1]:0}else b[0]=g[0]!==!1?a-g[0]:0,b[1]=g[1]!==!1?d-g[1]:0;this.restrictToAxis&&!n._blocked&&this.restrictToAxis(b);const v=n.offset,T=n._active&&!n._blocked||n.active;T&&(n.first=n._active&&!n.active,n.last=!n._active&&n.active,n.active=s[this.ingKey]=n._active,t&&(n.first&&("bounds"in r&&(n._bounds=Nh(r.bounds,n)),this.setup&&this.setup()),n.movement=b,this.computeOffset()));const[A,L]=n.offset,[[R,D],[B,j]]=n._bounds;n.overflow=[A<R?-1:A>D?1:0,L<B?-1:L>j?1:0],n._movementBound[0]=n.overflow[0]?n._movementBound[0]===!1?n._movement[0]:n._movementBound[0]:!1,n._movementBound[1]=n.overflow[1]?n._movementBound[1]===!1?n._movement[1]:n._movementBound[1]:!1;const P=n._active?r.rubberband||[0,0]:[0,0];if(n.offset=rj(n._bounds,n.offset,P),n.delta=jr.sub(n.offset,v),this.computeMovement(),T&&(!n.last||o>bj)){n.delta=jr.sub(n.offset,v);const $=n.delta.map(Math.abs);jr.addTo(n.distance,$),n.direction=n.delta.map(Math.sign),n._direction=n._delta.map(Math.sign),!n.first&&o>0&&(n.velocity=[$[0]/o,$[1]/o],n.timeDelta=o)}}emit(){const t=this.state,n=this.shared,r=this.config;if(t._active||this.clean(),(t._blocked||!t.intentional)&&!t._force&&!r.triggerAllEvents)return;const s=this.handler(Xr(Xr(Xr({},n),t),{},{[this.aliasKey]:t.values}));s!==void 0&&(t.memo=s)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function vj([e,t],n){const r=Math.abs(e),s=Math.abs(t);if(r>s&&r>n)return"x";if(s>r&&s>n)return"y"}class K0 extends sw{constructor(...t){super(...t),Ts(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=jr.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=jr.sub(this.state.offset,this.state.lastOffset)}axisIntent(t){const n=this.state,r=this.config;if(!n.axis&&t){const s=typeof r.axisThreshold=="object"?r.axisThreshold[tw(t)]:r.axisThreshold;n.axis=vj(n._movement,s)}n._blocked=(r.lockDirection||!!r.axis)&&!n.axis||!!r.axis&&r.axis!==n.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 wj=e=>e,wy=.15,iw={enabled(e=!0){return e},eventOptions(e,t,n){return Xr(Xr({},n.shared.eventOptions),e)},preventDefault(e=!1){return e},triggerAllEvents(e=!1){return e},rubberband(e=0){switch(e){case!0:return[wy,wy];case!1:return[0,0];default:return jr.toVector(e)}},from(e){if(typeof e=="function")return e;if(e!=null)return jr.toVector(e)},transform(e,t,n){const r=e||n.shared.transform;return this.hasCustomTransform=!!r,r||wj},threshold(e){return jr.toVector(e,0)}},Aj=0,vc=Xr(Xr({},iw),{},{axis(e,t,{axis:n}){if(this.lockDirection=n==="lock",!this.lockDirection)return n},axisThreshold(e=Aj){return e},bounds(e={}){if(typeof e=="function")return o=>vc.bounds(e(o));if("current"in e)return()=>e.current;if(typeof HTMLElement=="function"&&e instanceof HTMLElement)return e;const{left:t=-1/0,right:n=1/0,top:r=-1/0,bottom:s=1/0}=e;return[[t,n],[r,s]]}}),Ay={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 Tj extends K0{constructor(...t){super(...t),Ts(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 n=t._bounds.getBoundingClientRect(),r=t.currentTarget.getBoundingClientRect(),s={left:n.left-r.left+t.offset[0],right:n.right-r.right+t.offset[0],top:n.top-r.top+t.offset[1],bottom:n.bottom-r.bottom+t.offset[1]};t._bounds=vc.bounds(s)}}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 n=this.config,r=this.state;if(t.buttons!=null&&(Array.isArray(n.pointerButtons)?!n.pointerButtons.includes(t.buttons):n.pointerButtons!==-1&&n.pointerButtons!==t.buttons))return;const s=this.ctrl.setEventIds(t);n.pointerCapture&&t.target.setPointerCapture(t.pointerId),!(s&&s.size>1&&r._pointerActive)&&(this.start(t),this.setupPointer(t),r._pointerId=Gp(t),r._pointerActive=!0,this.computeValues(bu(t)),this.computeInitial(),n.preventScrollAxis&&tw(t)!=="mouse"?(r._active=!1,this.setupScrollPrevention(t)):n.delay>0?(this.setupDelayTrigger(t),n.triggerAllEvents&&(this.compute(t),this.emit())):this.startPointerDrag(t))}startPointerDrag(t){const n=this.state;n._active=!0,n._preventScroll=!0,n._delayed=!1,this.compute(t),this.emit()}pointerMove(t){const n=this.state,r=this.config;if(!n._pointerActive)return;const s=Gp(t);if(n._pointerId!==void 0&&s!==n._pointerId)return;const o=bu(t);if(document.pointerLockElement===t.target?n._delta=[t.movementX,t.movementY]:(n._delta=jr.sub(o,n._values),this.computeValues(o)),jr.addTo(n._movement,n._delta),this.compute(t),n._delayed&&n.intentional){this.timeoutStore.remove("dragDelay"),n.active=!1,this.startPointerDrag(t);return}if(r.preventScrollAxis&&!n._preventScroll)if(n.axis)if(n.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){n._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 n=this.state,r=this.config;if(!n._active||!n._pointerActive)return;const s=Gp(t);if(n._pointerId!==void 0&&s!==n._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(t);const[o,a]=n._distance;if(n.tap=o<=r.tapsThreshold&&a<=r.tapsThreshold,n.tap&&r.filterTaps)n._force=!0;else{const[d,h]=n._delta,[p,g]=n._movement,[y,b]=r.swipe.velocity,[v,T]=r.swipe.distance,A=r.swipe.duration;if(n.elapsedTime<A){const L=Math.abs(d/n.timeDelta),R=Math.abs(h/n.timeDelta);L>y&&Math.abs(p)>v&&(n.swipe[0]=Math.sign(d)),R>b&&Math.abs(g)>T&&(n.swipe[1]=Math.sign(h))}}this.emit()}pointerClick(t){!this.state.tap&&t.detail>0&&(t.preventDefault(),t.stopPropagation())}setupPointer(t){const n=this.config,r=n.device;n.pointerLock&&t.currentTarget.requestPointerLock(),n.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"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,Sj(t);const n=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",n),this.eventStore.add(this.sharedConfig.window,"touch","cancel",n),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 n=Ay[t.key];if(n){const r=this.state,s=t.shiftKey?10:t.altKey?.1:1;this.start(t),r._delta=n(this.config.keyboardDisplacement,s),r._keyboardActive=!0,jr.addTo(r._movement,r._delta),this.compute(t),this.emit()}}keyUp(t){t.key in Ay&&(this.state._keyboardActive=!1,this.setActive(),this.compute(t),this.emit())}bind(t){const n=this.config.device;t(n,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(t(n,"change",this.pointerMove.bind(this)),t(n,"end",this.pointerUp.bind(this)),t(n,"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 Sj(e){"persist"in e&&typeof e.persist=="function"&&e.persist()}const X0=typeof window<"u"&&window.document&&window.document.createElement;function ow(){return X0&&"ontouchstart"in window}function Cj(){return ow()||X0&&window.navigator.maxTouchPoints>1}function _j(){return X0&&"onpointerdown"in window}function Lj(){return X0&&"exitPointerLock"in window.document}function kj(){try{return"constructor"in GestureEvent}catch{return!1}}const qo={isBrowser:X0,gesture:kj(),touch:ow(),touchscreen:Cj(),pointer:_j(),pointerLock:Lj()},Ej=250,Ij=180,Rj=.5,Mj=50,Nj=250,Dj=10,Ty={mouse:0,touch:0,pen:8},Bj=Xr(Xr({},vc),{},{device(e,t,{pointer:{touch:n=!1,lock:r=!1,mouse:s=!1}={}}){return this.pointerLock=r&&qo.pointerLock,qo.touch&&n?"touch":this.pointerLock?"mouse":qo.pointer&&!s?"pointer":qo.touch?"touch":"mouse"},preventScrollAxis(e,t,{preventScroll:n}){if(this.preventScrollDelay=typeof n=="number"?n:n||n===void 0&&e?Ej:void 0,!(!qo.touchscreen||n===!1))return e||(n!==void 0?"y":void 0)},pointerCapture(e,t,{pointer:{capture:n=!0,buttons:r=1,keys:s=!0}={}}){return this.pointerButtons=r,this.keys=s,!this.pointerLock&&this.device==="pointer"&&n},threshold(e,t,{filterTaps:n=!1,tapsThreshold:r=3,axis:s=void 0}){const o=jr.toVector(e,n?r:s?1:0);return this.filterTaps=n,this.tapsThreshold=r,o},swipe({velocity:e=Rj,distance:t=Mj,duration:n=Nj}={}){return{velocity:this.transform(jr.toVector(e)),distance:this.transform(jr.toVector(t)),duration:n}},delay(e=0){switch(e){case!0:return Ij;case!1:return 0;default:return e}},axisThreshold(e){return e?Xr(Xr({},Ty),e):Ty},keyboardDisplacement(e=Dj){return e}});function aw(e){const[t,n]=e.overflow,[r,s]=e._delta,[o,a]=e._direction;(t<0&&r>0&&o<0||t>0&&r<0&&o>0)&&(e._movement[0]=e._movementBound[0]),(n<0&&s>0&&a<0||n>0&&s<0&&a>0)&&(e._movement[1]=e._movementBound[1])}const Pj=30,Qj=100;class Oj extends sw{constructor(...t){super(...t),Ts(this,"ingKey","pinching"),Ts(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:n,lastOffset:r}=this.state;t==="wheel"?this.state.offset=jr.add(n,r):this.state.offset=[(1+n[0])*r[0],n[1]+r[1]]}computeMovement(){const{offset:t,lastOffset:n}=this.state;this.state.movement=[t[0]/n[0],t[1]-n[1]]}axisIntent(){const t=this.state,[n,r]=t._movement;if(!t.axis){const s=Math.abs(n)*Pj-Math.abs(r);s<0?t.axis="angle":s>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 n=this.state,r=this.ctrl.touchIds;if(n._active&&n._touchIds.every(o=>r.has(o))||r.size<2)return;this.start(t),n._touchIds=Array.from(r).slice(0,2);const s=xy(t,n._touchIds);s&&this.pinchStart(t,s)}pointerStart(t){if(t.buttons!=null&&t.buttons%2!==1)return;this.ctrl.setEventIds(t),t.target.setPointerCapture(t.pointerId);const n=this.state,r=n._pointerEvents,s=this.ctrl.pointerIds;if(n._active&&Array.from(r.keys()).every(a=>s.has(a))||(r.size<2&&r.set(t.pointerId,t),n._pointerEvents.size<2))return;this.start(t);const o=tg(...Array.from(r.values()));o&&this.pinchStart(t,o)}pinchStart(t,n){const r=this.state;r.origin=n.origin,this.computeValues([n.distance,n.angle]),this.computeInitial(),this.compute(t),this.emit()}touchMove(t){if(!this.state._active)return;const n=xy(t,this.state._touchIds);n&&this.pinchMove(t,n)}pointerMove(t){const n=this.state._pointerEvents;if(n.has(t.pointerId)&&n.set(t.pointerId,t),!this.state._active)return;const r=tg(...Array.from(n.values()));r&&this.pinchMove(t,r)}pinchMove(t,n){const r=this.state,s=r._values[1],o=n.angle-s;let a=0;Math.abs(o)>270&&(a+=Math.sign(o)),this.computeValues([n.distance,n.angle-360*a]),r.origin=n.origin,r.turns=a,r._movement=[r._values[0]/r._initial[0]-1,r._values[1]-r._initial[1]],this.compute(t),this.emit()}touchEnd(t){this.ctrl.setEventIds(t),this.state._active&&this.state._touchIds.some(n=>!this.ctrl.touchIds.has(n))&&(this.state._active=!1,this.compute(t),this.emit())}pointerEnd(t){const n=this.state;this.ctrl.setEventIds(t);try{t.target.releasePointerCapture(t.pointerId)}catch{}n._pointerEvents.has(t.pointerId)&&n._pointerEvents.delete(t.pointerId),n._active&&n._pointerEvents.size<2&&(n._active=!1,this.compute(t),this.emit())}gestureStart(t){t.cancelable&&t.preventDefault();const n=this.state;n._active||(this.start(t),this.computeValues([t.scale,t.rotation]),n.origin=[t.clientX,t.clientY],this.compute(t),this.emit())}gestureMove(t){if(t.cancelable&&t.preventDefault(),!this.state._active)return;const n=this.state;this.computeValues([t.scale,t.rotation]),n.origin=[t.clientX,t.clientY];const r=n._movement;n._movement=[t.scale-1,t.rotation],n._delta=jr.sub(n._movement,r),this.compute(t),this.emit()}gestureEnd(t){this.state._active&&(this.state._active=!1,this.compute(t),this.emit())}wheel(t){const n=this.config.modifierKey;n&&(Array.isArray(n)?!n.find(r=>t[r]):!t[n])||(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 r=this.state;r._delta=[-rw(t)[1]/Qj*r.offset[0],0],jr.addTo(r._movement,r._delta),aw(r),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 n=this.config.device;n&&(t(n,"start",this[n+"Start"].bind(this)),t(n,"change",this[n+"Move"].bind(this)),t(n,"end",this[n+"End"].bind(this)),t(n,"cancel",this[n+"End"].bind(this)),t("lostPointerCapture","",this[n+"End"].bind(this))),this.config.pinchOnWheel&&t("wheel","",this.wheel.bind(this),{passive:!1})}}const Fj=Xr(Xr({},iw),{},{device(e,t,{shared:n,pointer:{touch:r=!1}={}}){if(n.target&&!qo.touch&&qo.gesture)return"gesture";if(qo.touch&&r)return"touch";if(qo.touchscreen){if(qo.pointer)return"pointer";if(qo.touch)return"touch"}},bounds(e,t,{scaleBounds:n={},angleBounds:r={}}){const s=a=>{const d=vy(Nh(n,a),{min:-1/0,max:1/0});return[d.min,d.max]},o=a=>{const d=vy(Nh(r,a),{min:-1/0,max:1/0});return[d.min,d.max]};return typeof n!="function"&&typeof r!="function"?[s(),o()]:a=>[s(a),o(a)]},threshold(e,t,n){return this.lockDirection=n.axis==="lock",jr.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey(e){return e===void 0?"ctrlKey":e},pinchOnWheel(e=!0){return e}});class jj extends K0{constructor(...t){super(...t),Ts(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(bu(t)),this.compute(t),this.computeInitial(),this.emit()}moveChange(t){if(!this.state._active)return;const n=bu(t),r=this.state;r._delta=jr.sub(n,r._values),jr.addTo(r._movement,r._delta),this.computeValues(n),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 $j=Xr(Xr({},vc),{},{mouseOnly:(e=!0)=>e});class Uj extends K0{constructor(...t){super(...t),Ts(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 n=this.state,r=mj(t);n._delta=jr.sub(r,n._values),jr.addTo(n._movement,n._delta),this.computeValues(r),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 Hj=vc;class zj extends K0{constructor(...t){super(...t),Ts(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 n=this.state;n._delta=rw(t),jr.addTo(n._movement,n._delta),aw(n),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 Gj=vc;class Wj extends K0{constructor(...t){super(...t),Ts(this,"ingKey","hovering")}enter(t){this.config.mouseOnly&&t.pointerType!=="mouse"||(this.start(t),this.computeValues(bu(t)),this.compute(t),this.emit())}leave(t){if(this.config.mouseOnly&&t.pointerType!=="mouse")return;const n=this.state;if(!n._active)return;n._active=!1;const r=bu(t);n._movement=n._delta=jr.sub(r,n._values),this.computeValues(r),this.compute(t),n.delta=n.movement,this.emit()}bind(t){t("pointer","enter",this.enter.bind(this)),t("pointer","leave",this.leave.bind(this))}}const Vj=Xr(Xr({},vc),{},{mouseOnly:(e=!0)=>e}),u1=new Map,ng=new Map;function lw(e){u1.set(e.key,e.engine),ng.set(e.key,e.resolver)}const cw={key:"drag",engine:Tj,resolver:Bj},qj={key:"hover",engine:Wj,resolver:Vj},Yj={key:"move",engine:jj,resolver:$j},Zj={key:"pinch",engine:Oj,resolver:Fj},Kj={key:"scroll",engine:Uj,resolver:Hj},Xj={key:"wheel",engine:zj,resolver:Gj};function Jj(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,o;for(o=0;o<r.length;o++)s=r[o],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}function e$(e,t){if(e==null)return{};var n=Jj(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}const t$={target(e){if(e)return()=>"current"in e?e.current:e},enabled(e=!0){return e},window(e=qo.isBrowser?window:void 0){return e},eventOptions({passive:e=!0,capture:t=!1}={}){return{passive:e,capture:t}},transform(e){return e}},n$=["target","eventOptions","window","enabled","transform"];function ah(e={},t){const n={};for(const[r,s]of Object.entries(t))switch(typeof s){case"function":n[r]=s.call(n,e[r],r,e);break;case"object":n[r]=ah(e[r],s);break;case"boolean":s&&(n[r]=e[r]);break}return n}function r$(e,t,n={}){const r=e,{target:s,eventOptions:o,window:a,enabled:d,transform:h}=r,p=e$(r,n$);if(n.shared=ah({target:s,eventOptions:o,window:a,enabled:d,transform:h},t$),t){const g=ng.get(t);n[t]=ah(Xr({shared:n.shared},p),g)}else for(const g in p){const y=ng.get(g);y&&(n[g]=ah(Xr({shared:n.shared},p[g]),y))}return n}class uw{constructor(t,n){Ts(this,"_listeners",new Set),this._ctrl=t,this._gestureKey=n}add(t,n,r,s,o){const a=this._listeners,d=dj(n,r),h=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},p=Xr(Xr({},h),o);t.addEventListener(d,s,p);const g=()=>{t.removeEventListener(d,s,p),a.delete(g)};return a.add(g),g}clean(){this._listeners.forEach(t=>t()),this._listeners.clear()}}class s${constructor(){Ts(this,"_timeouts",new Map)}add(t,n,r=140,...s){this.remove(t),this._timeouts.set(t,window.setTimeout(n,r,...s))}remove(t){const n=this._timeouts.get(t);n&&window.clearTimeout(n)}clean(){this._timeouts.forEach(t=>{window.clearTimeout(t)}),this._timeouts.clear()}}class i${constructor(t){Ts(this,"gestures",new Set),Ts(this,"_targetEventStore",new uw(this)),Ts(this,"gestureEventStores",{}),Ts(this,"gestureTimeoutStores",{}),Ts(this,"handlers",{}),Ts(this,"config",{}),Ts(this,"pointerIds",new Set),Ts(this,"touchIds",new Set),Ts(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),o$(this,t)}setEventIds(t){if(sf(t))return this.touchIds=new Set(pj(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,n){this.handlers=t,this.nativeHandlers=n}applyConfig(t,n){this.config=r$(t,n,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 n=this.config.shared,r={};let s;if(!(n.target&&(s=n.target(),!s))){if(n.enabled){for(const a of this.gestures){const d=this.config[a],h=Sy(r,d.eventOptions,!!s);if(d.enabled){const p=u1.get(a);new p(this,t,a).bind(h)}}const o=Sy(r,n.eventOptions,!!s);for(const a in this.nativeHandlers)o(a,"",d=>this.nativeHandlers[a](Xr(Xr({},this.state.shared),{},{event:d,args:t})),void 0,!0)}for(const o in r)r[o]=yj(...r[o]);if(!s)return r;for(const o in r){const{device:a,capture:d,passive:h}=uj(o);this._targetEventStore.add(s,a,"",r[o],{capture:d,passive:h})}}}}function Hc(e,t){e.gestures.add(t),e.gestureEventStores[t]=new uw(e,t),e.gestureTimeoutStores[t]=new s$}function o$(e,t){t.drag&&Hc(e,"drag"),t.wheel&&Hc(e,"wheel"),t.scroll&&Hc(e,"scroll"),t.move&&Hc(e,"move"),t.pinch&&Hc(e,"pinch"),t.hover&&Hc(e,"hover")}const Sy=(e,t,n)=>(r,s,o,a={},d=!1)=>{var h,p;const g=(h=a.capture)!==null&&h!==void 0?h:t.capture,y=(p=a.passive)!==null&&p!==void 0?p:t.passive;let b=d?r:lj(r,s,g);n&&y&&(b+="Passive"),e[b]=e[b]||[],e[b].push(o)},a$=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function l$(e){const t={},n={},r=new Set;for(let s in e)a$.test(s)?(r.add(RegExp.lastMatch),n[s]=e[s]):t[s]=e[s];return[n,t,r]}function zc(e,t,n,r,s,o){if(!e.has(n)||!u1.has(r))return;const a=n+"Start",d=n+"End",h=p=>{let g;return p.first&&a in t&&t[a](p),n in t&&(g=t[n](p)),p.last&&d in t&&t[d](p),g};s[r]=h,o[r]=o[r]||{}}function c$(e,t){const[n,r,s]=l$(e),o={};return zc(s,n,"onDrag","drag",o,t),zc(s,n,"onWheel","wheel",o,t),zc(s,n,"onScroll","scroll",o,t),zc(s,n,"onPinch","pinch",o,t),zc(s,n,"onMove","move",o,t),zc(s,n,"onHover","hover",o,t),{handlers:o,config:t,nativeHandlers:r}}function dw(e,t={},n,r){const s=_.useMemo(()=>new i$(e),[]);if(s.applyHandlers(e,r),s.applyConfig(t,n),_.useEffect(s.effect.bind(s)),_.useEffect(()=>s.clean.bind(s),[]),t.target===void 0)return s.bind.bind(s)}function Cy(e,t){return lw(cw),dw({drag:e},t||{},"drag")}function u$(e){return e.forEach(lw),function(n,r){const{handlers:s,nativeHandlers:o,config:a}=c$(n,r||{});return dw(s,a,void 0,o)}}function qz(e,t){return u$([cw,Zj,Kj,Xj,Yj,qj])(e,t||{})}const _y={dampingRatio:.8,response:.3},d$=.998;function h$(e,t,n,r){const s=2*Math.PI/Math.max(e.response,.001),o=t-r,a=n,d=e.dampingRatio;if(Math.abs(d-1)<1e-4){const v=o,T=a+s*o;return{value:A=>r+(v+T*A)*Math.exp(-s*A),velocity:A=>(T-s*(v+T*A))*Math.exp(-s*A)}}if(d<1){const v=s*Math.sqrt(1-d*d),T=o,A=(a+d*s*o)/v;return{value:L=>r+Math.exp(-d*s*L)*(T*Math.cos(v*L)+A*Math.sin(v*L)),velocity:L=>Math.exp(-d*s*L)*((A*v-d*s*T)*Math.cos(v*L)-(T*v+d*s*A)*Math.sin(v*L))}}const h=s*Math.sqrt(d*d-1),p=-d*s+h,g=-d*s-h,y=(a-g*o)/(p-g),b=o-y;return{value:v=>r+y*Math.exp(p*v)+b*Math.exp(g*v),velocity:v=>y*p*Math.exp(p*v)+b*g*Math.exp(g*v)}}function f$(e,t=d$){return e/1e3*(t/(1-t))}function Ly(e,t,n=.55){return e*t*n/(t+n*Math.abs(e))}function p$(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const m$=.1,g$=5;function x$(e,t,n,r,s){const o=h$(e,t,n,r),a=1e3/60,d=240,h=[];for(let p=0;p<d;p++){const g=p*a/1e3,y=o.value(g),b=o.velocity(g);if(h.push(s?s(y):y),p>0&&Math.abs(y-r)<m$&&Math.abs(b)<g$)break}return h.push(s?s(r):r),{frames:h,durationMs:(h.length-1)*a,solver:o}}const y$="swiper",b$="pre.termdock-file-preview-horizontal-scroll",v$="swiper-no-swiping",w$="data-sidebar-gesture-ignore",Wp=1;function A$(e,t){const n=e.scrollWidth-e.clientWidth;return n<=Wp?!1:t>0?e.scrollLeft>Wp:e.scrollLeft<n-Wp}function T$(e){return e.matches(b$)?{element:e,startScrollLeft:e.scrollLeft}:null}function S$(e,t){e.element.scrollLeft=e.startScrollLeft-t}function C$(e,t){return t>0?!e.isBeginning:!e.isEnd}function _$(e,t){const n=[],r=[];if(!(e instanceof Element))return{scrollers:n,swipers:r};const s=!!e.closest(`.${v$}`);let o=e;for(;o&&o!==t;){if(!s&&o.classList.contains(y$)){const a=o.swiper;a&&!a.destroyed&&r.push(a)}if(o instanceof HTMLElement){const{overflowX:a}=getComputedStyle(o);(a==="auto"||a==="scroll")&&n.push(o)}o=o.parentElement}return{scrollers:n,swipers:r}}function L$(e,t,n){const r=t>=0?1:-1;for(const s of e.scrollers)if(A$(s,r))return{kind:"scroller",element:s};for(const s of e.swipers)if(C$(s,r))return{kind:"swiper",instance:s};return r===n?{kind:"drawer"}:e.swipers.length>0?{kind:"swiper",instance:e.swipers[0]}:e.scrollers.length>0?{kind:"scroller",element:e.scrollers[0]}:{kind:"drawer"}}function k$(){if(typeof window>"u"||typeof window.getSelection!="function")return!1;const e=window.getSelection();return!!(e&&!e.isCollapsed&&String(e).length>0)}function E$(e){e.allowTouchMove=!0;let t=!1;const n=()=>{t||(t=!0,e.allowTouchMove=!1,window.removeEventListener("touchend",n),window.removeEventListener("touchcancel",n),window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",n))};return window.addEventListener("touchend",n),window.addEventListener("touchcancel",n),window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n),n}const I$='input:not([type="hidden"]), textarea, select, [contenteditable]:not([contenteditable="false"])';function R$(){if(typeof document>"u")return;const e=document.activeElement;e instanceof HTMLElement&&e.matches(I$)&&e.blur()}const M$=18,ky=8,Ey={touch:ky,pen:ky},N$=500,Vp=200,Iy=50,D$=`[${w$}]`;function qp(e,t,n){return Math.min(n,Math.max(t,e))}function Ry(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 My(e){if(!e||typeof e!="object")return!1;const t=e.target;return t instanceof Element&&!!t.closest(D$)}function l0(...e){typeof window<"u"&&window.__SIDEBAR_DEBUG__&&console.log("[Sidebar]",...e)}const hw=_.forwardRef(function({side:t,isOpen:n,drawerWidthPx:r,onClose:s,onOpen:o,children:a,pinned:d=!1},h){const{t:p}=qn(),g=t==="left",y=g?-r:r,b=S.useRef(null),v=S.useRef(null),T=S.useRef(n?0:y),A=S.useRef(null),L=S.useRef(null),R=S.useRef(0),D=S.useRef(null),B=S.useRef(null),j=S.useRef(!1),P=S.useRef(null),$=S.useRef(!1),z=S.useRef([]),H=S.useRef(null),ye=S.useRef(T.current),q=S.useRef(n?1:0),te=S.useRef(n);te.current=n;const ve=S.useRef(y);ve.current=y;const ge=S.useRef(r);ge.current=r;const ie=S.useRef(g);ie.current=g;const Ae=S.useRef(s);Ae.current=s;const xe=S.useRef(o);xe.current=o;const ce=S.useCallback(Te=>{b.current=Te,typeof h=="function"?h(Te):h&&(h.current=Te)},[h]),K=S.useCallback(()=>{L.current!==null&&(window.cancelAnimationFrame(L.current),L.current=null),A.current=null},[]),be=S.useCallback(Te=>{const Oe=ge.current;return ie.current?(Te+Oe)/Oe:(Oe-Te)/Oe},[]),Se=S.useCallback(Te=>{const Oe=v.current;Oe&&(Oe.style.opacity=String(qp(be(Te),0,1)))},[be]),We=S.useCallback(Te=>{T.current=Te;const Oe=b.current;Oe&&(Oe.style.transform=`translateX(${Te}px)`,Se(Te))},[Se]),ue=S.useCallback(Te=>{A.current=Te,L.current===null&&(L.current=window.requestAnimationFrame(()=>{L.current=null;const Oe=A.current;A.current=null,Oe!==null&&We(Oe)}))},[We]),Ee=S.useCallback(()=>{L.current!==null&&(window.cancelAnimationFrame(L.current),L.current=null);const Te=A.current;A.current=null,Te!==null&&We(Te)},[We]),Tt=S.useCallback(Te=>{const Oe=ve.current;return qp(Te,Math.min(0,Oe),Math.max(0,Oe))},[]),Rt=S.useCallback(()=>{const Te=D.current;if(!Te)return null;D.current=null;const Oe=(performance.now()-Te.startTime)/1e3,yt={value:Te.solver.value(Oe),velocity:Te.solver.velocity(Oe)};return Te.animations.forEach(de=>de.cancel()),yt},[]),ze=S.useCallback(()=>{B.current!==null&&(window.clearTimeout(B.current),B.current=null)},[]),X=S.useCallback(()=>{H.current?.(),H.current=null},[]),rt=S.useCallback(()=>{Ee(),ze();const Te=Rt();Te&&We(Tt(Te.value));const Oe=b.current,yt=v.current;Oe?.getAnimations().forEach(de=>de.cancel()),Oe&&(Oe.style.transition="none",Oe.style.opacity="1"),yt?.getAnimations().forEach(de=>de.cancel()),yt&&(yt.style.transition="none")},[We,ze,Tt,Ee,Rt]),qe=S.useCallback((Te,Oe)=>{Ee(),ze();const yt=b.current,de=v.current,Pe=Te?0:ve.current;de&&(de.style.pointerEvents=Te?"auto":"none");const ot=Rt(),zt=ot?Tt(ot.value):T.current,yn=Oe?.velocity??ot?.velocity??0;if(p$())return T.current=Pe,yt&&(yt.style.transition=`opacity ${Vp}ms ease`,yt.style.opacity=Te?"1":"0",yt.style.transform=`translateX(${Pe}px)`),de&&(de.style.transition=`opacity ${Vp}ms ease`,de.style.opacity=Te?"1":"0"),Vp;yt&&(yt.style.transition="none",yt.style.opacity="1"),de&&(de.style.transition="none");const at=Math.abs(Oe?.velocity??0)>N$,{frames:bt,durationMs:It,solver:kt}=x$({dampingRatio:at?_y.dampingRatio:1,response:_y.response},zt,yn,Pe,Tt);if(!yt||Math.abs(zt-Pe)<.5&&Math.abs(yn)<5)return We(Pe),0;const $t=yt.animate(bt.map(Fe=>({transform:`translateX(${Fe}px)`})),{duration:It,easing:"linear",fill:"forwards"}),se=[$t];return de&&se.push(de.animate(bt.map(Fe=>({opacity:String(qp(be(Fe),0,1))})),{duration:It,easing:"linear",fill:"forwards"})),D.current={solver:kt,startTime:performance.now(),target:Pe,animations:se},l0("spring start",{startX:zt,startVelocity:yn,targetX:Pe,frames:bt.length,durationMs:It}),$t.onfinish=()=>{const Fe=D.current;!Fe||!Fe.animations.includes($t)||(D.current=null,We(Pe),Fe.animations.forEach(Je=>Je.cancel()),l0("spring finish",{targetX:Pe}))},It},[We,ze,Tt,Ee,be,Rt]),re=S.useCallback(Te=>{Ee();const Oe=Te,yt=0,de=ve.current,Pe=T.current+f$(Oe),ot=Math.abs(Pe-yt)<=Math.abs(Pe-de);l0("decideSnap",{velocity:Oe,currentX:T.current,projected:Pe,shouldOpen:ot});const zt=qe(ot,{velocity:Oe});return ot&&!te.current?B.current=window.setTimeout(()=>{B.current=null,xe.current?.()},zt+Iy):!ot&&te.current&&(B.current=window.setTimeout(()=>{B.current=null,Ae.current()},zt+Iy)),ot},[qe,Ee]),J=S.useCallback(Te=>{const Oe=ve.current,yt=Math.min(0,Oe),de=Math.max(0,Oe),Pe=ge.current;return Te<yt?yt-Ly(yt-Te,Pe):Te>de?de+Ly(Te-de,Pe):Te},[]),$e=S.useCallback(Te=>{const Oe=z.current,yt=performance.now();Oe.push({t:yt,x:Te});const de=yt-120;for(;Oe.length>0&&Oe[0].t<de;)Oe.shift()},[]),tt=S.useCallback(()=>{const Te=z.current;if(Te.length<2)return 0;const Oe=Te[Te.length-1];if(performance.now()-Oe.t>60)return 0;const yt=Te[0],de=(Oe.t-yt.t)/1e3;return de<.016?0:(Oe.x-yt.x)/de},[]);S.useEffect(()=>{ze();const Te=D.current,Oe=n?0:ve.current;Te&&Te.target===Oe||qe(n)},[n,qe,ze]),S.useEffect(()=>{rt(),ue(te.current?0:y)},[y,rt,ue]),S.useEffect(()=>()=>{K(),ze(),Rt(),X()},[ze,K,X,Rt]);const gt=Cy(({active:Te,cancel:Oe,first:yt,last:de,movement:[Pe],event:ot})=>{if(l0("bindPanel",{active:Te,first:yt,last:de,mx:Pe}),!Ry(ot)){Oe();return}if(yt){if(X(),j.current=!1,P.current=null,z.current=[],My(ot)){Oe();return}const zt=b.current,yn=zt?_$(ot.target,zt):null;if(!yn||k$()){Oe();return}const at=L$(yn,Pe,ie.current?-1:1);if(l0("arbitrate",{owner:at.kind,mx:Pe}),at.kind==="swiper"){H.current=E$(at.instance),Oe();return}if(at.kind==="scroller"){const bt=T$(at.element);if(bt)P.current=bt;else{Oe();return}}P.current||(j.current=!0,rt(),R.current=T.current)}if(!Te){P.current=null,j.current&&(j.current=!1,re(tt()));return}if(P.current){S$(P.current,Pe);return}if(j.current){const zt=J(R.current+Pe);$e(zt),ue(zt)}},{axis:"x",axisThreshold:Ey,filterTaps:!0,pointer:{touch:!0}}),pt=Cy(({active:Te,cancel:Oe,first:yt,movement:[de],event:Pe})=>{if(!Ry(Pe)){Oe();return}if(te.current){Oe();return}if(yt&&($.current=!0,z.current=[],rt(),R.current=T.current),!Te){$.current&&($.current=!1,re(tt())&&R$());return}if($.current){const ot=J(R.current+de);$e(ot),ue(ot)}},{axis:"x",axisThreshold:Ey,filterTaps:!0,pointer:{touch:!0}}),Ct=S.useCallback(Te=>{Te.preventDefault(),Te.stopPropagation(),te.current||xe.current?.()},[]);if(d)return u.jsx("aside",{ref:ce,"data-sidebar":t,"data-sidebar-pinned":"true",className:"relative flex h-full min-h-0 w-full flex-col app-chrome-bg",children:a});const Le=gt();return u.jsxs(u.Fragment,{children:[u.jsx("div",{...pt(),style:{position:"fixed",top:"1.5rem",bottom:"10rem",...g?{left:0}:{right:0},width:M$,zIndex:"var(--z-chrome-hint)",touchAction:"none",pointerEvents:n?"none":"auto"},onClick:Ct,"aria-label":p(g?"sidebar.openLeftSidebar":"sidebar.openRightSidebar")}),u.jsx("div",{ref:v,"data-sidebar-backdrop":t,className:"fixed inset-0 z-sidebar-backdrop bg-[var(--app-backdrop)] cursor-default",style:{opacity:q.current,pointerEvents:n?"auto":"none",transition:"none",willChange:"opacity"},onClick:s,"aria-label":p("sidebar.closeSidebar")}),u.jsx("aside",{...Le,onClickCapture:Te=>{My(Te)||Le.onClickCapture?.(Te)},ref:ce,"data-sidebar":t,className:`fixed inset-y-0 z-sidebar-panel flex flex-col chrome-glow-panel will-change-transform ${g?"border-r border-border/15":"border-l border-border/15"}`,style:{...g?{left:0}:{right:0},width:r,maxWidth:"94vw",transform:`translateX(${ye.current}px)`,transition:"none",touchAction:"pan-y",pointerEvents:n?"auto":"none",paddingTop:"var(--safe-top-inset, env(safe-area-inset-top, 0px))",paddingBottom:"var(--safe-bottom-inset, env(safe-area-inset-bottom, 0px))",...g?{paddingLeft:"var(--safe-left-inset, env(safe-area-inset-left, 0px))"}:{paddingRight:"var(--safe-right-inset, env(safe-area-inset-right, 0px))"}},children:a})]})});function B$(e){return e.agentStatus==="waiting"||e.agentNeedsReview===!0}function P$(e,t,n,r="next"){if(e.length===0)return null;const s=t?e.findIndex(o=>o.sessionId===t):-1;for(let o=1;o<=e.length;o+=1){const a=r==="next"?o:-o,d=(s+a+e.length)%e.length,h=e[d];if(h&&n(h))return h.sessionId}return null}function Q$(e,t,n="next"){return P$(e,t,B$,n)}const So=42,Dh=20,O$=10;function rg(e,t,n){return Math.min(n,Math.max(t,e))}function of(e){const t=Math.max(0,e.safeTop??0),n=Math.max(0,e.safeRight??0),r=Math.max(0,e.safeBottom??0),s=Math.max(0,e.safeLeft??0),o=Math.max(0,e.bottomClearance??72),a=s+Dh,d=Math.max(a,e.width-n-Dh-So),h=Math.max(t+12,52),p=Math.max(h,e.height-r-o-So);return{minX:a,maxX:d,minY:h,maxY:p}}function Ny(e,t){const n=of(e),r=rg(t.yRatio,0,1);return{x:t.side==="left"?n.minX:n.maxX,y:n.minY+(n.maxY-n.minY)*r}}function uc(e,t){const n=of(e);return{x:rg(t.x,n.minX,n.maxX),y:rg(t.y,n.minY,n.maxY)}}function Dy(e,t){const n=of(e),r=uc(e,t),s=(n.minX+n.maxX+So)/2,o=r.x+So/2<s?"left":"right",a=n.maxY-n.minY;return{position:{x:o==="left"?n.minX:n.maxX,y:r.y},preference:{side:o,yRatio:a>0?(r.y-n.minY)/a:0}}}function By(e,t,n){const r=uc(e,t),s=So+O$,o=p=>Math.abs(p.x-n.x)<s&&Math.abs(p.y-n.y)<s;if(!o(r))return r;const a=[{...r,y:n.y-s},{...r,y:n.y+s}].map(p=>uc(e,p)).filter(p=>!o(p)).sort((p,g)=>Math.abs(p.y-r.y)-Math.abs(g.y-r.y));if(a[0])return a[0];const d=of(e);return[{...r,x:d.minX},{...r,x:d.maxX}].map(p=>uc(e,p)).filter(p=>!o(p)).sort((p,g)=>Math.abs(p.x-r.x)-Math.abs(g.x-r.x))[0]??r}const Yp="var(--warning)",F$="var(--success)",Py="var(--tmux)",Qy="termdock:mobile-attention-position:v1",Oy="termdock:running-session-position:v1",j$={side:"right",yRatio:.68},$$={side:"right",yRatio:.54};function Fy(e,t){if(typeof window>"u")return t;try{const n=JSON.parse(window.localStorage.getItem(e)??"null");if(n&&(n.side==="left"||n.side==="right")&&typeof n.yRatio=="number"&&Number.isFinite(n.yRatio))return{side:n.side,yRatio:Math.min(1,Math.max(0,n.yRatio))}}catch{}return t}function U$(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function Fd(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 H$(e,t,n={}){if(typeof window>"u")return{width:390,height:664};const r=window.visualViewport,s=r?.width??window.innerWidth,o=r?.height??window.innerHeight,a=t?.getBoundingClientRect(),d=!!(a&&a.width>0&&a.height>0);return{width:s,height:o,safeTop:Math.max(Fd("--safe-top-inset"),(d?Math.max(0,a.top):0)+Math.max(0,n.top??0)),safeRight:Math.max(Fd("--safe-right-inset"),(d?Math.max(0,s-a.right):0)+Math.max(0,n.right??0)),safeBottom:Math.max(Fd("--safe-bottom-inset"),(d?Math.max(0,o-a.bottom):0)+Math.max(0,n.bottom??0)),safeLeft:Math.max(Fd("--safe-left-inset"),(d?Math.max(0,a.left):0)+Math.max(0,n.left??0)),bottomClearance:e?Dh:72}}function fw(){const e=Bn.getState(),t=Array.from(e.sessions.values()),n=Q$(t,e.activeSessionId);if(!n)return;const r=e.activeSessionId?e.sessions.get(e.activeSessionId):void 0;r?.agentNeedsReview&&e.clearAgentNeedsReview(r.sessionId),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:n}))}function jy(e){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e}))}function pw(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 z$({indicator:e,tone:t,size:n}){const r=pw(t);switch(e){case"spinner":return u.jsx(Xn,{size:n,className:"shrink-0 animate-spin",style:{color:r}});case"question":return u.jsx(dh,{size:n,className:"shrink-0 animate-bounce-y",style:{color:r}});case"badge":return u.jsx(Fl,{size:n+1,className:"shrink-0 animate-pulse",style:{color:r}});case"terminal":return u.jsx(pa,{size:n,className:"shrink-0",style:{color:r}});case"pulse":return u.jsx(qC,{size:n,className:"shrink-0 animate-pulse",style:{color:r}});case"ring":return u.jsx("span",{className:"block shrink-0 rounded-full border-2",style:{width:n,height:n,borderColor:r}});case"dot":return u.jsx("span",{className:"block shrink-0 rounded-full",style:{width:Math.max(5,n-4),height:Math.max(5,n-4),backgroundColor:r}})}}function dc({agent:e,size:t=12}){const n=t-4;if(!e.icon)return u.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t,backgroundColor:e.accentColor},title:e.displayName,children:u.jsx(Wh,{size:n,className:"text-white"})});let r;return e.isPlugin?(r=`/api/terminal/agent-plugin-icon/${e.slug}`,e.iconVersion&&(r+=`?v=${Math.floor(e.iconVersion)}`)):r=`/icons/agents/${e.icon}.svg`,e.iconMode==="native"?u.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t},title:e.displayName,children:u.jsx("img",{src:r,alt:e.displayName,style:{width:n,height:n}})}):u.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t,backgroundColor:e.accentColor},title:e.displayName,children:u.jsx("span",{className:"block bg-white",style:{width:n,height:n,WebkitMask:`url(${r}) center / contain no-repeat`,mask:`url(${r}) center / contain no-repeat`}})})}function G$({sessionMode:e,state:t,size:n=11}){const r=t?.agent?u.jsx(dc,{agent:t.agent,size:n+1}):e==="tmux"?u.jsx(fu,{size:n,className:"shrink-0"}):u.jsx(pa,{size:n,className:"shrink-0"});return t?.agentStatusDetail&&t.agentIndicator&&!(t.agentStatus==="done"&&t.agentNeedsReview)?u.jsx("span",{title:t.agentMessage??t.agentStatusDetail.label,"aria-label":t.agentStatusDetail.label,children:u.jsx(z$,{indicator:t.agentIndicator,tone:t.agentStatusDetail.tone,size:n})}):t?.agentStatus==="working"?u.jsx("span",{title:t.agentMessage??t.agent?.displayName,children:u.jsx(Xn,{size:n,className:"shrink-0 animate-spin",style:{color:F$}})}):t?.agentStatus==="waiting"?u.jsx("span",{title:t.agentMessage??void 0,children:u.jsx(dh,{size:n,className:"shrink-0 animate-bounce-y",style:{color:Yp}})}):t?.agentStatus==="done"&&t.agentNeedsReview?u.jsx("span",{title:t.agentMessage??void 0,children:u.jsx(Fl,{size:n+1,className:"shrink-0 animate-pulse",style:{color:Yp}})}):t?.agentNeedsReview?u.jsx("span",{title:t.agentMessage??void 0,children:u.jsx(Fl,{size:n+1,className:"shrink-0 animate-pulse",style:{color:Yp}})}):t?.inCopyMode?e==="tmux"?u.jsx(fu,{size:n,className:"shrink-0 animate-pulse",style:{color:Py}}):u.jsx(pa,{size:n,className:"shrink-0 animate-pulse",style:{color:Py}}):r}function W$({status:e,detail:t,needsReview:n,inCopyMode:r}){const{t:s}=qn();return t&&!n?u.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:pw(t.tone)},title:t.label}):e==="working"?u.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:s("agent.aiRunning")}):e==="waiting"||n?u.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:s(n?"agent.finishedReview":"agent.aiWaiting")}):e==="done"&&n?u.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:s("agent.finishedReview")}):r?u.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:s("agent.copyMode")}):null}function mw({count:e,tone:t,title:n}){const{t:r}=qn();if(e<=0)return null;const s=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]",o=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 a=n??r("agent.jumpToNext");return u.jsxs("button",{type:"button",className:s,title:`${a} · ${r("agent.jumpToNext")}`,"aria-label":`${a}: ${e}. ${r("agent.jumpToNext")}`,onClick:fw,children:[u.jsx(Fl,{size:11,className:"shrink-0"}),u.jsx("span",{children:r("agent.needsReview")}),u.jsx("span",{className:"tabular-nums",children:e})]})}return u.jsxs("span",{className:s,title:n,children:[u.jsx("span",{className:o}),e]})}function V$({runningCount:e,reviewCount:t,className:n=""}){const r=[];return e>0&&r.push({key:"running",count:e,className:"bg-[var(--success)] text-[color:var(--success-foreground)]"}),t>0&&r.push({key:"review",count:t,className:"bg-[var(--warning)] text-[color:var(--warning-foreground)]"}),r.length===0?null:u.jsx("span",{"aria-hidden":"true",className:`pointer-events-none absolute -right-1 ${r.length>1?"top-0.5 flex flex-col gap-0.5":"-top-1"} ${n}`,children:r.map(s=>u.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 ${s.className}`,children:s.count>9?"9+":s.count},s.key))})}const q$=380,$y=10,jd=10,Zp=52,Y$=104;function Z$(e,t,n){const r=Math.max(0,t.safeLeft??0),s=t.width-Math.max(0,t.safeRight??0),o=Math.max(0,t.safeTop??0),a=t.height-Math.max(0,t.safeBottom??0),d=Dh,h=e.x+So/2>=r+(s-r)/2,p=h?e.x-jd-r-d:s-d-e.x-So-jd,g=Math.max(1,Math.min(Math.max(0,p),Math.max(168,n*Y$))),y=h?e.x-jd-g:e.x+So+jd,b=Math.min(Math.max(y,r+d),Math.max(r+d,s-d-g)),v=e.y+So/2-Zp/2,T=Math.min(Math.max(v,o+d),Math.max(o+d,a-d-Zp));return{left:b,top:T,width:g,height:Zp,itemWidth:g/Math.max(1,n),side:h?"left":"right"}}function Uy(e,t,n,r){return t<e.left||t>e.left+e.width||n<e.top-14||n>e.top+e.height+14?null:Math.min(r-1,Math.max(0,Math.floor((t-e.left)/e.itemWidth)))}function K$(e,t){if(e.length===0)return null;const n=t?e.findIndex(r=>r.id===t):-1;return e[(n+1)%e.length]?.id??null}function X$({reviewCount:e,runningSessions:t,activeSessionId:n,runningButtonEnabled:r,isDesktopLayout:s,containerElement:o,occlusionInsets:a}){const{t:d}=qn(),h=Et(re=>re.leftOpen),p=Et(re=>re.rightOpen),{isOpen:g}=gv({enabled:!s}),y=s||!h&&!p&&!g,b=e>0&&y,v=t.length>1||t.length===1&&t[0]?.id!==n,T=r&&t.length>0&&v&&y,A=Math.max(0,a?.top??0),L=Math.max(0,a?.right??0),R=Math.max(0,a?.bottom??0),D=Math.max(0,a?.left??0),B=_.useCallback(()=>H$(s,o,{top:A,right:L,bottom:R,left:D}),[o,s,R,D,L,A]),j=_.useRef({attention:Fy(Qy,j$),running:Fy(Oy,$$)}),P=_.useCallback(()=>{const re=B(),J=Ny(re,j.current.attention),$e=Ny(re,j.current.running);return{attention:J,running:b&&T?By(re,$e,J):$e}},[b,B,T]),[$,z]=_.useState(()=>P()),H=_.useRef($);H.current=$;const[ye,q]=_.useState(null),te=_.useRef(null),[ve,ge]=_.useState("idle"),[ie,Ae]=_.useState(null),xe=_.useRef(null),ce=_.useRef({attention:!1,running:!1});_.useEffect(()=>()=>{const re=xe.current?.longPressTimer;re!=null&&window.clearTimeout(re)},[]),_.useEffect(()=>{if(T)return;const re=xe.current?.longPressTimer;re!=null&&window.clearTimeout(re),xe.current=null,ge("idle"),Ae(null)},[T]),_.useLayoutEffect(()=>{const re=()=>{const $e=P();H.current=$e,z($e)};re(),window.addEventListener("resize",re),window.addEventListener("orientationchange",re),window.visualViewport?.addEventListener("resize",re);const J=typeof ResizeObserver>"u"?null:new ResizeObserver(re);return o&&J?.observe(o),()=>{window.removeEventListener("resize",re),window.removeEventListener("orientationchange",re),window.visualViewport?.removeEventListener("resize",re),J?.disconnect()}},[o,P]);const K=_.useCallback(re=>re==="attention"?T:b,[b,T]),be=_.useCallback((re,J)=>{if(!K(re))return J;const $e=re==="attention"?"running":"attention";return By(B(),J,H.current[$e])},[B,K]),Se=_.useCallback((re,J,$e,tt)=>{const gt=B(),pt=J.moved?uc(gt,{x:J.startX+($e-J.originX),y:J.startY+(tt-J.originY)}):H.current[re],Ct=Dy(gt,pt),Le=be(re,Ct.position),Te=Dy(gt,Le);j.current[re]=Te.preference,U$(re==="attention"?Qy:Oy,Te.preference);const Oe={...H.current,[re]:Te.position};H.current=Oe,z(Oe)},[be,B]),We=_.useCallback(re=>{ce.current[re]=!0,window.setTimeout(()=>{ce.current[re]=!1},0)},[]),ue=_.useCallback(re=>{const J=te.current;!J||J.kind!=="attention"||J.pointerId!==re.pointerId||(te.current=null,q(null),Se("attention",J,re.clientX,re.clientY),J.moved&&We("attention"))},[Se,We]),Ee={onPointerDown:re=>{re.stopPropagation(),re.currentTarget.setPointerCapture(re.pointerId),te.current={kind:"attention",pointerId:re.pointerId,originX:re.clientX,originY:re.clientY,startX:$.attention.x,startY:$.attention.y,moved:!1}},onPointerMove:re=>{const J=te.current;if(!J||J.kind!=="attention"||J.pointerId!==re.pointerId)return;const $e=re.clientX-J.originX,tt=re.clientY-J.originY;if(!J.moved&&Math.hypot($e,tt)<5)return;J.moved=!0,q("attention");const gt=B(),pt=be("attention",uc(gt,{x:J.startX+$e,y:J.startY+tt})),Ct={...H.current,attention:pt};H.current=Ct,z(Ct)},onPointerUp:ue,onPointerCancel:ue},Tt=o?Z$($.running,B(),t.length):null,Rt=re=>{re.longPressTimer!==null&&(window.clearTimeout(re.longPressTimer),re.longPressTimer=null)},ze={onPointerDown:re=>{re.stopPropagation(),re.currentTarget.setPointerCapture(re.pointerId);const J=re.pointerId,$e={pointerId:J,originX:re.clientX,originY:re.clientY,startX:$.running.x,startY:$.running.y,mode:"pressing",moved:!1,selectedIndex:null,longPressTimer:null};$e.longPressTimer=window.setTimeout(()=>{const tt=xe.current;!tt||tt.pointerId!==J||tt.mode!=="pressing"||(tt.longPressTimer=null,tt.mode="dragging",ce.current.running=!0,ge("dragging"))},q$),xe.current=$e,ge("pressing"),Ae(null)},onPointerMove:re=>{const J=xe.current;if(!J||J.pointerId!==re.pointerId)return;const $e=re.clientX-J.originX,tt=re.clientY-J.originY;if(J.mode==="pressing")if(Math.abs($e)>=$y&&Math.abs($e)>=Math.abs(tt))Rt(J),J.mode="selecting",ce.current.running=!0,ge("selecting");else if(Math.hypot($e,tt)>=$y){Rt(J),J.mode="cancelled",ce.current.running=!0,ge("idle");return}else return;if(J.mode==="selecting"){const Le=Tt?Uy(Tt,re.clientX,re.clientY,t.length):null;J.selectedIndex=Le,Ae(Le);return}if(J.mode!=="dragging"||!J.moved&&Math.hypot($e,tt)<5)return;J.moved=!0;const gt=B(),pt=be("running",uc(gt,{x:J.startX+$e,y:J.startY+tt})),Ct={...H.current,running:pt};H.current=Ct,z(Ct)},onPointerUp:re=>{const J=xe.current;if(!J||J.pointerId!==re.pointerId)return;Rt(J);const $e=J.mode;if($e==="selecting"){const tt=Tt?Uy(Tt,re.clientX,re.clientY,t.length):J.selectedIndex,gt=tt===null?null:t[tt]?.id;gt&&jy(gt)}else $e==="dragging"&&Se("running",J,re.clientX,re.clientY);xe.current=null,ge("idle"),Ae(null),$e!=="pressing"&&We("running")},onPointerCancel:re=>{const J=xe.current;!J||J.pointerId!==re.pointerId||(Rt(J),xe.current=null,ge("idle"),Ae(null),We("running"))}},X=(re,J)=>u.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)] ${J==="attention"?"text-[color:var(--warning)]":"text-[color:var(--success)]"}`,children:re>9?"9+":re}),rt=()=>{const re=d("agent.jumpToNext"),J=$.attention,$e=ye==="attention";return u.jsxs("button",{type:"button","data-attention-button":!0,"data-mobile-attention-button":!0,...Ee,onClick:tt=>{tt.stopPropagation(),!ce.current.attention&&fw()},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 ${$e?"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:{left:J.x,top:J.y,width:So,height:So,touchAction:"none"},"aria-label":`${re}: ${e}`,title:re,children:[u.jsx(Fl,{size:17,className:"shrink-0"}),X(e,"attention")]},"attention")},qe=()=>{const re=t.length,J=$.running,$e=ve==="selecting",tt=ve==="dragging";return u.jsxs(_.Fragment,{children:[u.jsxs("button",{type:"button","data-running-session-button":!0,"data-running-session-gesture":ve,...ze,onClick:gt=>{if(gt.stopPropagation(),ce.current.running)return;const pt=K$(t,n);pt&&jy(pt)},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 ${tt?"cursor-grabbing scale-[1.04] shadow-[0_12px_30px_var(--app-shadow-strong)]":$e?"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:J.x,top:J.y,width:So,height:So,touchAction:"none"},"aria-label":`${d("agent.jumpToNextRunning")}: ${re}`,title:d("agent.runningSessionGestureHint"),children:[u.jsx(Xn,{size:18,className:"shrink-0 animate-spin"}),X(re,"running")]}),$e&&Tt&&u.jsx("div",{role:"listbox","data-running-session-rail":!0,"data-side":Tt.side,"aria-label":d("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:Tt.left,top:Tt.top,width:Tt.width,height:Tt.height},children:t.map((gt,pt)=>{const Ct=pt===ie,Le=gt.id===n,Te=`${gt.label}${gt.detail?` · ${gt.detail}`:""}${Le?` · ${d("agent.currentSession")}`:""}`;return u.jsxs("div",{role:"option","aria-selected":Ct,"data-running-session-option":gt.id,"data-selected":Ct?"true":"false",title:Te,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 ${Ct?"scale-[1.02] bg-[var(--success)] text-[color:var(--success-foreground)]":Le?"bg-primary/15 text-primary ring-1 ring-primary/30":"text-foreground"}`,children:[u.jsx("span",{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-[9px] font-bold tabular-nums ${Ct?"bg-surface/25":"bg-surface-2 text-muted-foreground"}`,children:pt+1}),u.jsx("span",{className:"truncate text-[10px] font-medium",children:gt.label})]},gt.id)})})]},"running")};return!b&&!T||o===null||typeof document>"u"?null:ga.createPortal(u.jsxs(u.Fragment,{children:[b&&rt(),T&&qe()]}),document.body)}const J$=450,eU=10,Hy=88,zy=36,$d=10,Gy=14;function Wy(e){if(typeof document>"u")return 0;const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e)||"0");return Number.isFinite(t)?t:0}function tU(e,t){if(typeof window>"u")return{left:0,top:0};const n=window.visualViewport,r=n?.offsetLeft??0,s=n?.offsetTop??0,o=n?.width??window.innerWidth,a=n?.height??window.innerHeight,d=Wy("--safe-top-inset"),h=Wy("--safe-bottom-inset"),p=r+$d,g=r+o-Hy-$d,y=s+d+$d,b=s+a-h-zy-$d,v=Math.max(p,Math.min(e-Hy/2,Math.max(p,g))),T=t-zy-Gy,A=t+Gy,L=T>=y?T:A,R=Math.max(y,Math.min(L,Math.max(y,b)));return{left:Math.round(v),top:Math.round(R)}}async function Vy(e){if(!e)return;if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}if(typeof document>"u")return;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();try{document.execCommand("copy")}finally{document.body.removeChild(t)}}function d1(e){const t=S.useRef(null),n=S.useRef(null),r=S.useRef(!1),s=S.useRef(!1),o=S.useRef(!1),[a,d]=S.useState(null);S.useEffect(()=>{if(!a)return;const v=T=>{const A=T.target;A instanceof HTMLElement&&A.closest('[data-reference-copy-popover="true"]')||(d(null),r.current=!1,s.current=!1)};return document.addEventListener("pointerdown",v,{capture:!0}),()=>document.removeEventListener("pointerdown",v,!0)},[a]);const h=S.useCallback(()=>{t.current!=null&&(window.clearTimeout(t.current),t.current=null)},[]),p=S.useCallback(()=>{h(),n.current=null,r.current=!1},[h]),g=S.useCallback((v,T)=>({onPointerDown:A=>{A.pointerType==="mouse"&&A.button!==0||(p(),n.current={pointerId:A.pointerId,pointerType:A.pointerType,startX:A.clientX,startY:A.clientY,text:v,key:T},t.current=window.setTimeout(()=>{const L=n.current;if(L){if(r.current=!0,s.current=!0,o.current=!1,L.pointerType==="mouse"){Vy(L.text).then(()=>e?.(L.key)),t.current=null;return}d({text:L.text,key:L.key,...tU(L.startX,L.startY)}),t.current=null}},J$))},onPointerMove:A=>{const L=n.current;if(!L||L.pointerId!==A.pointerId||r.current)return;const R=A.clientX-L.startX,D=A.clientY-L.startY;Math.hypot(R,D)>eU&&p()},onPointerUp:A=>{const L=n.current;if(!L||L.pointerId!==A.pointerId){p();return}r.current&&(A.preventDefault(),A.stopPropagation(),s.current=!0),p()},onPointerCancel:p,onPointerLeave:A=>{n.current?.pointerId===A.pointerId&&!r.current&&p()},onClickCapture:A=>{s.current&&(s.current=!1,A.preventDefault(),A.stopPropagation())},onContextMenu:A=>{!r.current&&!s.current||(A.preventDefault(),A.stopPropagation())}}),[e,p]),y=S.useCallback(v=>{if(v.preventDefault(),v.stopPropagation(),!a||o.current)return;o.current=!0;const T=a;d(null),r.current=!1,s.current=!1,Vy(T.text).then(()=>e?.(T.key))},[e,a]),b=a&&typeof document<"u"?ga.createPortal(S.createElement("button",{type:"button","data-reference-copy-popover":"true",className:"fixed z-modal-backdrop 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:a.left,top:a.top,WebkitBackdropFilter:"blur(18px)"},onPointerDown:v=>{v.stopPropagation()},onPointerUp:y,onTouchStart:v=>{v.stopPropagation()},onTouchEnd:y,onClick:y},S.createElement(p3,{size:14,strokeWidth:2.4}),S.createElement("span",null,"Copy")),document.body):null;return S.useMemo(()=>Object.assign(g,{popoverNode:b}),[g,b])}const nU=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"]),qy=120,Yy=120,rU=new Set,sU=[],iU={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 h1(e,t){if(t==="directory")return null;if(HT(e))return u.jsx(DC,{size:14});if($T(e))return u.jsx(AL,{size:14});const n=e.lastIndexOf(".")>=0?e.slice(e.lastIndexOf(".")):"";return nU.has(n)?u.jsx(h_,{size:14}):u.jsx(g3,{size:14})}function gw({path:e}){const n=Et(s=>s.changedFiles.get(e))?.status;if(!n)return null;const r=iU[n]??{label:"?",className:"text-muted-foreground",title:n};return u.jsx("span",{className:`w-4 shrink-0 text-center text-[10px] font-mono font-bold ${r.className}`,title:r.title,children:r.label})}function vu(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 f1(e){return vu(e)}const oU=S.memo(function({path:t}){const{t:n}=qn(),[r,s]=S.useState("idle"),[o,a]=S.useState(null),d=S.useCallback(async h=>{if(h.stopPropagation(),r!=="pending"){s("pending"),a(null);try{await Xb(t),s("idle")}catch(p){s("error"),a(p instanceof Error?p.message:n("rightSidebar.downloadFailed"))}}},[t,r,n]);return u.jsx("span",{role:"button",tabIndex:-1,onClick:h=>{d(h)},className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-muted-foreground transition active:scale-95 ${vu(r==="pending")} ${r==="pending"?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:r==="error"?o??n("rightSidebar.downloadFailed"):n("rightSidebar.downloadFile"),children:r==="pending"?u.jsx(Xn,{size:12,className:"animate-spin"}):u.jsx(M0,{size:12})})});function xw(){const{t:e}=qn(),[t,n]=S.useState({status:"idle"}),r=S.useCallback(async s=>{n({status:"pending"});try{await Xb(s),n({status:"idle"})}catch(o){n({status:"error",message:o instanceof Error?o.message:e("rightSidebar.downloadFailed")})}},[e]);return{state:t,run:r}}function sg(e){return e instanceof DOMException&&e.name==="AbortError"}function Bh(){if(typeof window>"u")return!1;const e=window.getSelection();return!!(e&&!e.isCollapsed&&e.toString().trim())}function yw(e){return e.button===2||e.ctrlKey}const aU=176,lU=160,c0=8;function Zy(e,t,n,r){const s=window.visualViewport,o=s?.offsetLeft??0,a=s?.offsetTop??0,d=o+(s?.width??window.innerWidth),h=a+(s?.height??window.innerHeight),p=o+c0,g=a+c0,y=Math.max(p,d-n-c0),b=Math.max(g,h-r-c0),v=t+r<=h-c0?t:t-r;return{anchorX:e,anchorY:t,left:Math.min(Math.max(e,p),y),top:Math.min(Math.max(v,g),b)}}function bw(e){const[t,n]=S.useState(null),r=S.useRef(null),s=S.useCallback((o,a)=>{n(Zy(o,a,aU,lU))},[]);return S.useLayoutEffect(()=>{if(!e||!t||!r.current)return;const o=r.current.getBoundingClientRect();if(o.width<=0||o.height<=0)return;const a=Zy(t.anchorX,t.anchorY,o.width,o.height);a.left===t.left&&a.top===t.top||n(a)},[e,t]),{position:t,menuRef:r,openAt:s,clearPosition:()=>n(null)}}function vw(e,t){return t&&typeof document<"u"?ga.createPortal(e,document.body):e}function cU(e,t){return t?`${e.name} ${e.path}`.toLowerCase().includes(t):!0}function p1(e,t,n){if(!t||cU(e,t))return!0;const r=n.get(e.path);return r?r.some(s=>p1(s,t,n)):!1}function ig(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 og(e,t){return!e||!t.startsWith(e)?t:t.slice(e.length).replace(/^\/+/,"")||t}const uU=S.memo(function e({node:t,depth:n,onFileSelect:r,directoriesOnly:s=!1,onPathReference:o,getReferenceText:a,onReferenceCopied:d,insertedReferenceKey:h,copiedReferenceKey:p,onDirectoryRoot:g,onSearchFromDirectory:y,onDirectoryPinToggle:b,onFilePinToggle:v,onOpenInFileBrowser:T,canOpenInFileBrowser:A,pinnedPaths:L,selectedFilePath:R,queryLower:D,onDirectoryDropFiles:B,onFileDeleteRequest:j,deletingFilePath:P,revealedDirectoryPath:$}){const{t:z}=qn(),H=Et(Ne=>Ne.expandedPaths.has(t.path)),ye=Et(Ne=>Ne.directoryCache.get(t.path)),q=Et(Ne=>Ne.showHiddenFiles),te=Et(Ne=>Ne.toggleExpanded),ve=Et(Ne=>Ne.setDirectoryCache),ge=Et(Ne=>Ne.fileSortModes[t.path]??"name"),ie=Et(Ne=>Ne.setDirectorySortMode),[Ae,xe]=S.useState(!1),[ce,K]=S.useState(!1),{position:be,menuRef:Se,openAt:We,clearPosition:ue}=bw(ce),[Ee,Tt]=S.useState(!1),Rt=S.useRef(0),ze=S.useRef(null),X=S.useRef(null),rt=t.path===R||t.path===$,qe=t.type==="directory"&&(H||!!D),re=t.type==="directory",J=L.has(t.path),$e=!re&&!!v,tt=!!(A&&T),gt=`path:${t.path}`,pt=h===gt,Ct=p===gt,Le=a?.(t.path)??t.path,Te=d1(d),{state:Oe,run:yt}=xw(),de=P===t.path,Pe=re&&!s&&!!(g||y||b||tt),ot=S.useMemo(()=>{if(!ye)return;if(!D)return ye;const Ne=Et.getState().directoryCache;return ye.filter(Pn=>(!s||Pn.type==="directory")&&p1(Pn,D,Ne))},[ye,s,D]),zt=S.useCallback(async()=>{if(!Et.getState().directoryCache.has(t.path)&&!Ae){const Pn=`file-tree:${t.path}`;ze.current?.abort(),fm(Pn);const dt=new AbortController;ze.current=dt,xe(!0);try{const fr=await vg(t.path,dt.signal,q,"expand_directory",Pn,ge),In=ig(fr.entries);ve(t.path,In)}catch(fr){sg(fr)}finally{ze.current===dt&&(ze.current=null),xe(!1)}}},[t.path,Ae,ve,q,ge]),yn=S.useCallback(async()=>{if(t.type!=="directory"){r(t.path);return}if(s&&g){g(t.path);return}const Ne=!Et.getState().expandedPaths.has(t.path);te(t.path),Ne&&await zt()},[s,t.path,t.type,zt,g,te,r]);S.useEffect(()=>{t.type==="directory"&&H&&!ye&&!Ae&&zt()},[ye,H,zt,Ae,t.type]);const at=S.useCallback(Ne=>{Ne.stopPropagation(),o?.(t.path,gt)},[o,t.path,gt]),bt=S.useCallback(Ne=>{Ne.stopPropagation(),g?.(t.path),K(!1)},[t.path,g]),It=S.useCallback(Ne=>{Ne.stopPropagation(),y?.(t.path),K(!1)},[t.path,y]),kt=S.useCallback(Ne=>{Ne.stopPropagation(),b?.(t.path),K(!1)},[t.path,b]),$t=S.useCallback(Ne=>{Ne.stopPropagation(),ie(t.path,ge==="modified"?"name":"modified"),K(!1)},[t.path,ie,ge]),se=S.useCallback(Ne=>{Ne.stopPropagation(),v?.(t.path),K(!1)},[t.path,v]),Fe=S.useCallback(Ne=>{Ne.stopPropagation(),K(!1),yt(t.path)},[t.path,yt]),Je=S.useCallback(Ne=>{Ne.stopPropagation(),K(!1),j(t)},[t,j]),Ot=S.useCallback(Ne=>{Ne.stopPropagation(),T?.(t.path),K(!1)},[t.path,T]),je=S.useCallback(Ne=>{!re||!B||!Ne.dataTransfer.types.includes("Files")||(Ne.preventDefault(),Ne.stopPropagation(),Rt.current+=1,Tt(!0))},[re,B]),ut=S.useCallback(Ne=>{!re||!B||!Ne.dataTransfer.types.includes("Files")||(Ne.preventDefault(),Ne.stopPropagation(),Ne.dataTransfer.dropEffect="copy",Tt(!0))},[re,B]),un=S.useCallback(Ne=>{!re||!B||(Ne.preventDefault(),Ne.stopPropagation(),Rt.current-=1,Rt.current<=0&&(Rt.current=0,Tt(!1)))},[re,B]),Be=S.useCallback(Ne=>{if(!re||!B)return;Ne.preventDefault(),Ne.stopPropagation(),Rt.current=0,Tt(!1);const Pn=Array.from(Ne.dataTransfer.files);Pn.length>0&&B(t.path,Pn)},[re,t.path,B]),hr=S.useCallback(Ne=>{Ne.stopPropagation(),ue(),K(Pn=>!Pn)},[ue]),jn=S.useCallback(Ne=>{!Pe||!yw(Ne)||(Ne.preventDefault(),Ne.stopPropagation(),We(Ne.clientX,Ne.clientY),K(!0))},[Pe,We]);return S.useEffect(()=>{if(!ce)return;const Ne=dt=>{const fr=dt.target;fr instanceof Node&&(X.current?.contains(fr)||Se.current?.contains(fr))||K(!1)},Pn=dt=>{dt.key==="Escape"&&K(!1)};return document.addEventListener("pointerdown",Ne),document.addEventListener("keydown",Pn),()=>{document.removeEventListener("pointerdown",Ne),document.removeEventListener("keydown",Pn)}},[ce,Se]),S.useEffect(()=>()=>{ze.current?.abort()},[]),u.jsxs("div",{style:!qe&&!ce?{contentVisibility:"auto",containIntrinsicSize:"auto 32px"}:void 0,children:[u.jsxs("div",{ref:X,className:"relative",children:[Te.popoverNode,u.jsxs("div",{"data-file-tree-path":t.path,"data-sort-mode":ge,role:"button",tabIndex:0,onClick:()=>{Bh()||yn()},onContextMenu:jn,onKeyDown:Ne=>{Ne.key!=="Enter"&&Ne.key!==" "||(Ne.preventDefault(),yn())},onDragEnter:je,onDragOver:ut,onDragLeave:un,onDrop:Be,className:`group relative flex w-full cursor-pointer items-center gap-1 rounded px-2 py-1 text-[13px] transition ${Ee?"scale-[1.015] bg-primary/15 text-foreground shadow-[0_0_0_1px_rgb(var(--primary-rgb)_/_0.45)]":rt?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,style:{paddingLeft:`${n*14+8}px`},title:t.path,children:[Ee&&u.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:z("fileTree.dropToUploadHere")}),t.type==="directory"?u.jsxs(u.Fragment,{children:[qe?u.jsx(fc,{size:14,className:"shrink-0 text-muted-foreground/80"}):u.jsx(Vh,{size:14,className:"shrink-0 text-muted-foreground/80"}),qe?u.jsx(su,{size:14,className:"shrink-0 text-[color:var(--folder)]"}):u.jsx(hu,{size:14,className:"shrink-0 text-[color:var(--folder)]"})]}):u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"w-[14px] shrink-0"}),u.jsx("span",{className:rt?"text-primary":"text-muted-foreground/80",children:h1(t.name,t.type)})]}),u.jsxs("span",{className:`min-w-0 flex-1 select-text whitespace-normal break-all text-left leading-snug ${rt?"font-medium":""}`,children:[t.name,ge==="modified"&&u.jsx("span",{className:"ml-1 inline-flex align-middle text-primary",title:z("fileTree.sortedByModified"),"aria-label":z("fileTree.sortedByModified"),children:u.jsx(R0,{size:11})}),t.isSymlink&&u.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:z("fileTree.symbolicLink"),children:u.jsx(pu,{size:11})})]}),Ae&&u.jsx(Xn,{size:12,className:"shrink-0 animate-spin text-muted-foreground"}),u.jsx(gw,{path:t.path}),Pe&&u.jsx("span",{onClick:hr,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-muted-foreground transition active:scale-95 ${vu(ce)} ${ce?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:z("fileTree.moreDirActions"),children:u.jsx(N0,{size:13})}),!re&&u.jsx("span",{onClick:hr,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-muted-foreground transition active:scale-95 ${vu(ce||Oe.status==="pending"||de||J)} ${ce?"bg-surface-elevated text-foreground":J?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:Oe.status==="error"?Oe.message??z("rightSidebar.downloadFailed"):z("fileTree.moreFileActions"),children:Oe.status==="pending"||de?u.jsx(Xn,{size:13,className:"animate-spin"}):u.jsx(N0,{size:13})}),o&&u.jsx("span",{onClick:at,...Te(Le,gt),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-[11px] font-semibold transition active:scale-95 ${f1(pt||Ct)} ${pt||Ct?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":z(Ct?"rightSidebar.copied":pt?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:z(Ct?"rightSidebar.copied":pt?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:Ct||pt?u.jsx(ma,{size:12}):u.jsx(pu,{size:12})})]}),Pe&&ce&&vw(u.jsxs("div",{ref:Se,className:`${be?"fixed z-menu-panel":"absolute right-2 top-[calc(100%+2px)] z-30"} w-44 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in`,style:be?{left:be.left,top:be.top}:void 0,children:[tt&&u.jsxs("button",{type:"button",onClick:Ot,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:z("fileTree.openInFileBrowserTitle"),children:[u.jsx(su,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:z("fileTree.openInFileBrowser")})]}),g&&u.jsxs("button",{type:"button",onClick:bt,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:z("fileTree.openDirRootTitle"),children:[u.jsx(su,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:z("fileTree.openDirRoot")})]}),y&&u.jsxs("button",{type:"button",onClick:It,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:z("fileTree.searchFromDirTitle"),children:[u.jsx(Sg,{size:13,className:"shrink-0 text-primary"}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:z("fileTree.searchFromDir")})]}),b&&u.jsxs("button",{type:"button",onClick:kt,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] ${J?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:z(J?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[J?u.jsx(B0,{size:13,className:"shrink-0"}):u.jsx(D0,{size:13,className:"shrink-0"}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:z(J?"fileTree.unpinDir":"fileTree.pinDir")})]}),u.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]",children:[ge==="modified"?u.jsx(TC,{size:13,className:"shrink-0"}):u.jsx(R0,{size:13,className:"shrink-0"}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:z(ge==="modified"?"fileTree.sortByName":"fileTree.sortByModified")})]})]}),!!be),!re&&ce&&u.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:[tt&&u.jsxs("button",{type:"button",onClick:Ot,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:z("fileTree.openInFileBrowserTitle"),children:[u.jsx(g3,{size:13,className:"shrink-0"}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:z("fileTree.openInFileBrowser")})]}),u.jsxs("button",{type:"button",onClick:Fe,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:z("rightSidebar.downloadFile"),children:[u.jsx(M0,{size:13,className:"shrink-0"}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:z("rightSidebar.downloadFile")})]}),$e&&u.jsxs("button",{type:"button",onClick:se,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] ${J?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:z(J?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[J?u.jsx(B0,{size:13,className:"shrink-0"}):u.jsx(D0,{size:13,className:"shrink-0"}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:z(J?"fileTree.unpinFile":"fileTree.pinFile")})]}),u.jsxs("button",{type:"button",onClick:Je,disabled:de,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:z("fileTree.deleteFile"),children:[de?u.jsx(Xn,{size:13,className:"shrink-0 animate-spin"}):u.jsx(co,{size:13,className:"shrink-0"}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:z("fileTree.deleteFile")})]})]})]}),qe&&ot&&ot.length>0&&u.jsx("div",{className:n===0?"mt-0.5":"",children:ot.map(Ne=>u.jsx(e,{node:Ne,depth:n+1,onFileSelect:r,directoriesOnly:s,onPathReference:o,getReferenceText:a,onReferenceCopied:d,onDirectoryRoot:g,onSearchFromDirectory:y,onDirectoryPinToggle:b,onFilePinToggle:v,onOpenInFileBrowser:T,canOpenInFileBrowser:A,pinnedPaths:L,selectedFilePath:R,queryLower:D,insertedReferenceKey:h,copiedReferenceKey:p,onDirectoryDropFiles:B,onFileDeleteRequest:j,deletingFilePath:P,revealedDirectoryPath:$},Ne.path))})]})}),dU=S.memo(function({node:t,rootPath:n,onFileSelect:r,onPathReference:s,getReferenceText:o,onReferenceCopied:a,insertedReferenceKey:d,copiedReferenceKey:h,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:y,onFilePinToggle:b,pinnedPaths:v,selectedFilePath:T,onFileDeleteRequest:A,deletingFilePath:L}){const{t:R}=qn(),D=t.path===T,B=t.type==="directory",j=v.has(t.path),P=!B&&!!b,$=`path:${t.path}`,z=d===$,H=h===$,ye=o?.(t.path)??t.path,q=d1(a),{state:te,run:ve}=xw(),[ge,ie]=S.useState(!1),{position:Ae,menuRef:xe,openAt:ce,clearPosition:K}=bw(ge),be=S.useRef(null),Se=L===t.path,We=B&&!!(p||g||y),ue=S.useCallback(()=>{Bh()||(t.type==="directory"?p?.(t.path):r(t.path))},[t.path,t.type,p,r]),Ee=S.useCallback(re=>{re.stopPropagation(),s?.(t.path,$)},[s,t.path,$]),Tt=S.useCallback(re=>{re.stopPropagation(),y?.(t.path),ie(!1)},[t.path,y]),Rt=S.useCallback(re=>{re.stopPropagation(),b?.(t.path),ie(!1)},[t.path,b]),ze=S.useCallback(re=>{re.stopPropagation(),ie(!1),ve(t.path)},[t.path,ve]),X=S.useCallback(re=>{re.stopPropagation(),ie(!1),A(t)},[t,A]),rt=S.useCallback(re=>{re.stopPropagation(),K(),ie(J=>!J)},[K]),qe=S.useCallback(re=>{!We||!yw(re)||(re.preventDefault(),re.stopPropagation(),ce(re.clientX,re.clientY),ie(!0))},[We,ce]);return S.useEffect(()=>{if(!ge)return;const re=$e=>{const tt=$e.target;tt instanceof Node&&(be.current?.contains(tt)||xe.current?.contains(tt))||ie(!1)},J=$e=>{$e.key==="Escape"&&ie(!1)};return document.addEventListener("pointerdown",re),document.addEventListener("keydown",J),()=>{document.removeEventListener("pointerdown",re),document.removeEventListener("keydown",J)}},[ge,xe]),u.jsxs("div",{ref:be,className:"relative border-b border-border/10 last:border-b-0",children:[q.popoverNode,u.jsxs("div",{role:"button",tabIndex:0,onClick:ue,onContextMenu:qe,onKeyDown:re=>{re.key!=="Enter"&&re.key!==" "||(re.preventDefault(),ue())},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"?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"w-[14px] shrink-0"}),u.jsx(hu,{size:14,className:"shrink-0 text-[color:var(--folder)]"})]}):u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"w-[14px] shrink-0"}),u.jsx("span",{className:D?"text-primary":"text-muted-foreground/80",children:h1(t.name,t.type)})]}),u.jsxs("span",{className:"min-w-0 flex-1 select-text",children:[u.jsxs("span",{className:`block whitespace-normal break-all font-medium leading-snug ${D?"text-primary":"text-foreground"}`,children:[t.name,t.isSymlink&&u.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:R("fileTree.symbolicLink"),children:u.jsx(pu,{size:11})})]}),u.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-muted-foreground/80",children:og(n,t.path)})]}),u.jsx(gw,{path:t.path}),t.type==="directory"&&(y||g)&&u.jsx("span",{onClick:rt,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-muted-foreground transition active:scale-95 ${vu(ge)} ${ge?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:R("fileTree.moreDirActions"),children:u.jsx(N0,{size:13})}),!B&&u.jsx("span",{onClick:rt,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-muted-foreground transition active:scale-95 ${vu(ge||te.status==="pending"||Se||j)} ${ge?"bg-surface-elevated text-foreground":j?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:te.status==="error"?te.message??R("rightSidebar.downloadFailed"):R("fileTree.moreFileActions"),children:te.status==="pending"||Se?u.jsx(Xn,{size:13,className:"animate-spin"}):u.jsx(N0,{size:13})}),s&&u.jsx("span",{onClick:Ee,...q(ye,$),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-[11px] font-semibold transition active:scale-95 ${f1(z||H)} ${z||H?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":R(H?"rightSidebar.copied":z?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:R(H?"rightSidebar.copied":z?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:H||z?u.jsx(ma,{size:12}):u.jsx(pu,{size:12})})]}),We&&ge&&vw(u.jsxs("div",{ref:xe,className:`${Ae?"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:Ae?{left:Ae.left,top:Ae.top}:void 0,children:[p&&u.jsxs("button",{type:"button",onClick:re=>{re.stopPropagation(),p(t.path),ie(!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:[u.jsx(su,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("fileTree.openDirRoot")})]}),g&&u.jsxs("button",{type:"button",onClick:re=>{re.stopPropagation(),g(t.path),ie(!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:[u.jsx(Sg,{size:13,className:"shrink-0 text-primary"}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("fileTree.searchFromDir")})]}),y&&u.jsxs("button",{type:"button",onClick:Tt,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] ${j?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:R(j?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[j?u.jsx(B0,{size:13,className:"shrink-0"}):u.jsx(D0,{size:13,className:"shrink-0"}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:R(j?"fileTree.unpinDir":"fileTree.pinDir")})]})]}),!!Ae),!B&&ge&&u.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:[u.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 text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:R("rightSidebar.downloadFile"),children:[u.jsx(M0,{size:13,className:"shrink-0"}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("rightSidebar.downloadFile")})]}),P&&u.jsxs("button",{type:"button",onClick:Rt,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] ${j?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:R(j?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[j?u.jsx(B0,{size:13,className:"shrink-0"}):u.jsx(D0,{size:13,className:"shrink-0"}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:R(j?"fileTree.unpinFile":"fileTree.pinFile")})]}),u.jsxs("button",{type:"button",onClick:X,disabled:Se,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:[Se?u.jsx(Xn,{size:13,className:"shrink-0 animate-spin"}):u.jsx(co,{size:13,className:"shrink-0"}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("fileTree.deleteFile")})]})]})]})}),hU=60,Ky=60,fU=20;function Xy({count:e,loading:t,engine:n,limited:r,scope:s,content:o}){const{t:a}=qn();return u.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:[u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2 text-[12px] font-semibold text-foreground",children:[u.jsx(Sg,{size:14,className:"shrink-0 text-primary"}),u.jsx("span",{children:o?a("fileTree.contentMatchesCount",{count:e}):a("fileTree.searchResults",{count:e})})]}),n&&u.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&&u.jsx(Xn,{size:9,className:"animate-spin"}),n,r?" · limited":""]})]}),u.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-[10px] text-muted-foreground",children:[u.jsx("span",{className:"shrink-0",children:a("fileTree.searchScope")}),u.jsx("span",{className:"min-w-0 truncate font-mono text-foreground/75",title:s,children:s}),t&&u.jsx("span",{className:"ml-auto shrink-0",children:a("fileTree.searching")})]})]})}function pU(e,t){if(!t)return e;const n=e.toLowerCase(),r=t.toLowerCase(),s=[];let o=0,a=n.indexOf(r,o),d=0;for(;a>=0&&r;)a>o&&s.push(e.slice(o,a)),s.push(u.jsx("mark",{className:"rounded-sm bg-[rgb(var(--warning-rgb)_/_0.30)] px-0.5 text-foreground",children:e.slice(a,a+r.length)},`m-${d++}`)),o=a+r.length,a=n.indexOf(r,o);return o<e.length&&s.push(e.slice(o)),s.length>0?s:e}const mU=S.memo(function({entry:t,rootPath:n,selectedFilePath:r,query:s,onContentMatchSelect:o,onPathReference:a,getReferenceText:d,onReferenceCopied:h,insertedReferenceKey:p,copiedReferenceKey:g}){const{t:y}=qn(),[b,v]=S.useState(!0),T=t.path===r,A=b?t.matches.slice(0,fU):[],L=t.matches.length-A.length,R=`path:${t.path}`,D=p===R,B=g===R,j=d?.(t.path)??t.path,P=d1(h);return u.jsxs("div",{className:"border-b border-border/10 last:border-b-0",children:[P.popoverNode,u.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{Bh()||v($=>!$)},onKeyDown:$=>{$.key!=="Enter"&&$.key!==" "||($.preventDefault(),v(z=>!z))},className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-left text-[13px] transition ${T?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[b?u.jsx(fc,{size:14,className:"shrink-0 text-muted-foreground/80"}):u.jsx(Vh,{size:14,className:"shrink-0 text-muted-foreground/80"}),u.jsx("span",{className:T?"text-primary":"text-muted-foreground/80",children:h1(t.name,"file")}),u.jsxs("span",{className:"min-w-0 flex-1 select-text",children:[u.jsx("span",{className:"block whitespace-normal break-all font-medium leading-snug",children:t.name}),u.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-muted-foreground/80",children:og(n,t.path)})]}),u.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}),u.jsx(oU,{path:t.path}),a&&u.jsx("span",{onClick:$=>{$.stopPropagation(),a(t.path,R)},...P(j,R),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-[11px] font-semibold transition active:scale-95 ${f1(D||B)} ${D||B?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":y(B?"rightSidebar.copied":D?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:y(B?"rightSidebar.copied":D?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:B||D?u.jsx(ma,{size:12}):u.jsx(pu,{size:12})})]}),b&&u.jsxs("div",{className:"mb-1 ml-3 border-l border-border/20 pl-1",children:[A.map(($,z)=>u.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{Bh()||o?.(t.path,$.line)},onKeyDown:H=>{H.key!=="Enter"&&H.key!==" "||(H.preventDefault(),o?.(t.path,$.line))},className:"flex w-full cursor-pointer items-start gap-2 rounded px-2 py-1 text-left font-mono text-[11px] text-muted-foreground transition hover:bg-surface-2 hover:text-foreground",title:`${og(n,t.path)}:${$.line}`,children:[u.jsx("span",{className:"shrink-0 select-none tabular-nums text-muted-foreground/60",children:$.line}),u.jsx("span",{className:"min-w-0 flex-1 truncate whitespace-pre select-text",children:pU($.text,s)})]},`${$.line}-${z}`)),L>0&&u.jsx("div",{className:"px-2 py-1 text-[10px] text-muted-foreground/70",children:y("fileTree.moreMatches",{count:L})})]})]})});function gU({rootPath:e,onFileSelect:t,directoriesOnly:n=!1,onPathReference:r,getReferenceText:s,onReferenceCopied:o,insertedReferenceKey:a,copiedReferenceKey:d,onDirectoryRoot:h,onSearchFromDirectory:p,onDirectoryPinToggle:g,onFilePinToggle:y,onOpenInFileBrowser:b,canOpenInFileBrowser:v=!1,pinnedPaths:T=rU,selectedFilePath:A,query:L="",searchRootPath:R,searchOptions:D={},searchMode:B="name",onContentMatchSelect:j,onDirectoryDropFiles:P,revealDirectory:$}){const{t:z}=qn(),H=Et(at=>e?at.directoryCache.get(e):void 0),ye=Et(at=>at.setDirectoryCache),q=Et(at=>at.showHiddenFiles),te=Et(at=>at.fileSortModesHydrated),ve=Et(at=>at.fileSortModes[e]??"name"),ge=Et(at=>at.hydrateFileSortModes),[ie,Ae]=S.useState(!1),[xe,ce]=S.useState(null),[K,be]=S.useState(!1),[Se,We]=S.useState(!1),[ue,Ee]=S.useState(null),[Tt,Rt]=S.useState(te),ze=te||Tt;S.useEffect(()=>{let at=!1;return ge().catch(()=>{}).finally(()=>{at||Rt(!0)}),()=>{at=!0}},[ge]);const[X,rt]=S.useState([]),[qe,re]=S.useState(null),[J,$e]=S.useState(qy),[tt,gt]=S.useState([]),[pt,Ct]=S.useState(null),Le=S.useRef(null),Te=S.useRef(0),Oe=L.trim().toLowerCase(),yt=B==="content",de=R||e,Pe=D.excludePatterns??sU,ot=Pe.join(`
|
|
136
|
-
`);S.useEffect(()=>{const at=$?.path;if(!at||!at.startsWith(`${e}/`)&&at!==e)return;const bt=at.slice(e.length).replace(/^\/+/,""),It=bt?bt.split("/"):[],kt=It.map((ut,un)=>`${e}/${It.slice(0,un+1).join("/")}`),$t=Et.getState(),se=kt.filter(ut=>!$t.expandedPaths.has(ut));se.length>0&&Et.setState(ut=>({expandedPaths:new Set([...ut.expandedPaths,...se])}));let Fe=!1,Je=0;const Ot=()=>{if(Fe)return;const ut=Array.from(document.querySelectorAll("[data-file-tree-path]")).find(un=>un.dataset.fileTreePath===at);if(ut){ut.scrollIntoView({block:"center",behavior:"smooth"});return}Je+=1,Je<80&&window.setTimeout(Ot,50)},je=window.requestAnimationFrame(Ot);return()=>{Fe=!0,window.cancelAnimationFrame(je)}},[$?.nonce,$?.path,e]);const zt=S.useCallback(async at=>{if(!(pt||at.type==="directory")&&window.confirm(z("fileTree.deleteFileConfirm",{name:at.name}))){Ct(at.path);try{await qT(at.path),Et.getState().applyFileWatchEvents([{type:"deleted",path:at.path}]),rt(bt=>bt.filter(It=>It.path!==at.path)),gt(bt=>bt.filter(It=>It.path!==at.path)),T.has(at.path)&&y?.(at.path)}catch(bt){const It=bt instanceof Error?bt.message:String(bt);window.alert(z("fileTree.deleteFileFailed",{message:It}))}finally{Ct(null)}}},[pt,y,T,z]);S.useEffect(()=>{if(!e||!ze)return;if(Oe){Ae(!1);return}if(Et.getState().directoryCache.has(e)){Ae(!1);return}let at=!1;const bt=new AbortController;return Ae(!0),ce(null),vg(e,bt.signal,q,"load_file_tree_root",`file-tree-root:${e}`,ve).then(It=>{if(at)return;const kt=ig(It.entries);be(!!It.truncated),ye(e,kt)}).catch(It=>{at||sg(It)||ce(It instanceof Error?It.message:"Failed to load directory")}).finally(()=>{at||Ae(!1)}),()=>{at=!0,bt.abort(),fm(`file-tree-root:${e}`)}},[Oe,H,e,ve,ye,q,ze]),S.useEffect(()=>{if(!de||!Oe){We(!1),Ee(null),rt([]),gt([]),re(null);return}let at=!1;const bt=new AbortController,It=new Set;We(!0),Ee(null),rt([]),gt([]),$e(yt?hU:qy),re({truncated:!1,total:0,engine:"rg",limited:!1,done:!1});const kt=`file-search:${de}:${++Te.current}`;return WT(de,L.trim(),$t=>{if(!at){if($t.engine&&re(se=>({truncated:se?.truncated??!1,total:se?.total??0,engine:$t.engine,limited:$t.limited??se?.limited??!1,done:se?.done??!1})),$t.entries?.length){const se=$t.entries.filter(Fe=>It.has(Fe.path)?!1:(It.add(Fe.path),!0));se.length>0&&(rt(Fe=>[...Fe,...ig(se)]),re(Fe=>Fe?{...Fe,total:It.size}:{truncated:!1,total:It.size,engine:"rg",limited:!1,done:!1}))}if($t.contentEntries?.length){const se=$t.contentEntries.filter(Fe=>It.has(Fe.path)?!1:(It.add(Fe.path),!0));se.length>0&&(gt(Fe=>[...Fe,...se]),re(Fe=>Fe?{...Fe,total:It.size}:{truncated:!1,total:It.size,engine:"rg",limited:!1,done:!1}))}$t.done&&re(se=>({truncated:!!$t.truncated,total:typeof $t.total=="number"?$t.total:It.size,engine:$t.engine??se?.engine??"rg",limited:!!$t.limited,done:!0}))}},bt.signal,q,B,kt,{excludePatterns:Pe,caseSensitive:D.caseSensitive,wholeWord:D.wholeWord,regex:D.regex}).catch($t=>{at||sg($t)||(Ee($t instanceof Error?$t.message:"Failed to search files"),rt([]),gt([]),re(null))}).finally(()=>{at||We(!1)}),()=>{at=!0,bt.abort(),fm(kt)}},[de,ot,yt,L,Oe,B,D.caseSensitive,D.regex,D.wholeWord,q]),S.useEffect(()=>{if(!Oe)return;const at=Le.current;if(!at)return;const bt=yt?tt.length:X.length,It=yt?Ky:Yy,kt=new IntersectionObserver($t=>{$t.some(se=>se.isIntersecting)&&$e(se=>Math.min(se+It,bt))},{rootMargin:"160px 0px"});return kt.observe(at),()=>kt.disconnect()},[Oe,X.length,tt.length,yt]);const yn=S.useMemo(()=>{if(!H)return;if(!Oe)return n?H.filter(bt=>bt.type==="directory"):H;const at=Et.getState().directoryCache;return H.filter(bt=>(!n||bt.type==="directory")&&p1(bt,Oe,at))},[n,Oe,H]);if(!e)return u.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:z("fileTree.noWorkingDir")});if(ie||!ze)return u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx(Xn,{size:20,className:"animate-spin text-muted-foreground"})});if(Oe&&yt){const at=qe?.total??tt.length,bt=tt.slice(0,J),It=J<tt.length;return u.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[u.jsx(Xy,{count:at,loading:Se,engine:qe?.engine,limited:qe?.limited,scope:de,content:!0}),ue?u.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:[z("fileTree.contentSearchNeedsRipgrep"),u.jsx("div",{className:"mt-1 break-words text-[11px] text-muted-foreground/70",children:ue})]}):Se&&tt.length===0?u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx(Xn,{size:20,className:"animate-spin text-muted-foreground"})}):tt.length===0?u.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:z("fileTree.noContentMatches")}):u.jsxs(u.Fragment,{children:[qe?.limited&&u.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:z("fileTree.searchTruncatedHint",{count:qe.total})}),bt.map(kt=>u.jsx(mU,{entry:kt,rootPath:de,selectedFilePath:A,query:L.trim(),onContentMatchSelect:j,onPathReference:r,getReferenceText:s,onReferenceCopied:o,insertedReferenceKey:a,copiedReferenceKey:d},kt.path)),u.jsx("div",{ref:Le,className:"py-2 text-center text-[11px] text-muted-foreground",children:It?u.jsx("button",{type:"button",onClick:()=>$e(kt=>Math.min(kt+Ky,tt.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:z("fileTree.loadMoreSearchResults",{shown:bt.length,total:tt.length})}):Se?u.jsxs("span",{className:"inline-flex items-center gap-1",children:[u.jsx(Xn,{size:10,className:"animate-spin"}),z("fileTree.searchStillRunning")]}):bt.length>0?u.jsx("span",{children:z("fileTree.showingSearchResults",{shown:bt.length,total:at})}):null})]})]})}if(Oe){const at=qe?.total??X.length,bt=X.slice(0,J),It=J<X.length;return u.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[u.jsx(Xy,{count:at,loading:Se,engine:qe?.engine,limited:qe?.limited,scope:de,content:!1}),Se&&X.length===0?u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx(Xn,{size:20,className:"animate-spin text-muted-foreground"})}):ue?u.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:ue}):X.length===0?u.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:z("fileTree.noMatchingFiles")}):u.jsxs(u.Fragment,{children:[qe?.limited&&u.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:z("fileTree.searchTruncatedHint",{count:qe.total})}),bt.map(kt=>u.jsx(dU,{node:kt,rootPath:de,onFileSelect:t,onPathReference:r,getReferenceText:s,onReferenceCopied:o,onDirectoryRoot:h,onSearchFromDirectory:p,onDirectoryPinToggle:g,onFilePinToggle:y,pinnedPaths:T,selectedFilePath:A,insertedReferenceKey:a,copiedReferenceKey:d,onFileDeleteRequest:zt,deletingFilePath:pt},kt.path)),u.jsx("div",{ref:Le,className:"py-2 text-center text-[11px] text-muted-foreground",children:It?u.jsx("button",{type:"button",onClick:()=>$e(kt=>Math.min(kt+Yy,X.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:z("fileTree.loadMoreSearchResults",{shown:bt.length,total:X.length})}):Se?u.jsxs("span",{className:"inline-flex items-center gap-1",children:[u.jsx(Xn,{size:10,className:"animate-spin"}),z("fileTree.searchStillRunning")]}):bt.length>0?u.jsx("span",{children:z("fileTree.showingSearchResults",{shown:bt.length,total:at})}):null})]})]})}return xe?u.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:xe}):!H||H.length===0?u.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:z("fileTree.emptyDir")}):!yn||yn.length===0?u.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:z("fileTree.noMatchingFiles")}):u.jsxs("div",{className:"termdock-native-select space-y-px px-2 py-2",children:[K&&u.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:z("fileTree.truncatedHint")}),yn.map(at=>u.jsx(uU,{node:at,depth:0,onFileSelect:t,directoriesOnly:n,onPathReference:r,getReferenceText:s,onReferenceCopied:o,onDirectoryRoot:h,onSearchFromDirectory:p,onDirectoryPinToggle:g,onFilePinToggle:y,onOpenInFileBrowser:b,canOpenInFileBrowser:v,pinnedPaths:T,selectedFilePath:A,queryLower:Oe,insertedReferenceKey:a,copiedReferenceKey:d,onDirectoryDropFiles:P,onFileDeleteRequest:zt,deletingFilePath:pt,revealedDirectoryPath:$?.path},at.path))]})}function ag(e){return e.trim().replace(/\/+$/,"")||"/"}function xU(e){const t=ag(e);if(t==="/")return"/";const n=t.lastIndexOf("/");return n<=0?"/":t.slice(0,n)}function ww({open:e,initialPath:t,title:n,labels:r,onCancel:s,onConfirm:o}){const{t:a}=qn(),d={hint:r?.hint??a("sidebar.directoryPickerHint"),cancel:r?.cancel??a("common.cancel"),confirm:r?.confirm??a("sidebar.useThisFolder"),close:r?.close??a("common.close"),parent:r?.parent??a("rightSidebar.parentFolder")},[h,p]=S.useState(()=>ag(t));return S.useEffect(()=>{e&&p(ag(t))},[t,e]),S.useEffect(()=>{if(!e)return;const g=document.body.style.overflow,y=b=>{b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),s())};return document.body.style.overflow="hidden",document.addEventListener("keydown",y,!0),()=>{document.body.style.overflow=g,document.removeEventListener("keydown",y,!0)}},[s,e]),e?ga.createPortal(u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop cursor-default bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:s,"aria-label":d.cancel}),u.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:[u.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border/15 px-4 py-3",children:[u.jsx("span",{className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/15 text-primary",children:u.jsx(b_,{size:15})}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("h2",{id:"directory-picker-title",className:"text-[13px] font-semibold text-foreground",children:n}),u.jsx("p",{className:"mt-0.5 text-[10px] text-muted-foreground",children:d.hint})]}),u.jsx("button",{type:"button",autoFocus:!0,onClick:s,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":d.close,children:u.jsx(Bs,{size:15})})]}),u.jsxs("div",{className:"flex min-h-11 shrink-0 items-center gap-2 border-b border-border/15 px-3 py-1.5",children:[u.jsx("button",{type:"button",disabled:h==="/",onClick:()=>p(xU(h)),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":d.parent,children:u.jsx(h3,{size:14})}),u.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10.5px] text-foreground",title:h,children:h})]}),u.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain py-1",children:u.jsx(gU,{rootPath:h,directoriesOnly:!0,onFileSelect:()=>{},onDirectoryRoot:p,selectedFilePath:t||null})}),u.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:[u.jsx("button",{type:"button",onClick:s,className:"min-h-10 rounded-lg bg-surface-2 px-4 text-[11px] font-medium text-foreground transition hover:bg-surface",children:d.cancel}),u.jsxs("button",{type:"button",onClick:()=>o(h),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:[u.jsx(ma,{size:13}),d.confirm]})]})]})]}),document.body):null}function yU({directories:e,tmuxAvailable:t,options:n,agents:r,selectedAgent:s,detecting:o,resumeHistory:a,resumeHistoryLoading:d,resumeHistoryPendingId:h,resumeHistoryError:p,onRefreshAgents:g,onSelectAgent:y,onLaunchAgent:b,onResumeHistory:v,onRemoveResumeHistory:T,onClose:A,onOptionsChange:L}){const{t:R,locale:D}=qn(),[B,j]=S.useState(s),[P,$]=S.useState(!1),z=S.useMemo(()=>[...new Set(e.filter(Boolean))].slice(0,5),[e]),H=B?.displayName??"Terminal",ye=s?.displayName??"Terminal",q=B===null?s===null:s?.slug===B.slug;S.useEffect(()=>{const ge=ie=>{ie.key==="Escape"&&(P||A())};return document.addEventListener("keydown",ge),()=>document.removeEventListener("keydown",ge)},[P,A]);const te=ge=>{L({...n,cwd:ge}),$(!1)},ve=ge=>new Intl.DateTimeFormat(D==="zh"?"zh-CN":"en",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(ge));return u.jsxs("section",{className:"relative z-20 flex max-h-[min(56svh,36rem)] shrink-0 flex-col overflow-hidden border-t border-border/25 bg-surface-elevated shadow-[0_-18px_42px_var(--app-shadow-soft)] animate-slide-down","aria-label":R("sidebar.newSessionComposerTitle"),children:[u.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 px-3 pb-2 pt-3",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[u.jsx("span",{className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/15 text-primary",children:u.jsx(pa,{size:14})}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[12px] font-semibold text-foreground",children:R("sidebar.newSessionComposerTitle")}),u.jsx("div",{className:"truncate text-[10.5px] text-muted-foreground",children:R("sidebar.newSessionHint")})]})]}),u.jsx("button",{type:"button",onClick:A,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:u.jsx(Bs,{size:14})})]}),u.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 pb-3",children:[u.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2",children:[u.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:R("sidebar.sessionMode")}),n.mode==="tmux"&&u.jsx("span",{className:"text-[10px] text-muted-foreground",children:R("sidebar.tmuxKeepsRunning")})]}),u.jsx("div",{className:"mt-1.5 grid grid-cols-2 gap-1 rounded-lg bg-surface-2 p-1",children:["shell","tmux"].map(ge=>u.jsx("button",{type:"button",disabled:ge==="tmux"&&!t,onClick:()=>L({...n,mode:ge}),"aria-pressed":n.mode===ge,title:ge==="tmux"&&!t?R("sidebar.newTmuxDisabled"):void 0,className:`min-h-9 rounded-md px-2 py-1.5 text-[11px] font-medium transition ${n.mode===ge?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"} disabled:cursor-not-allowed disabled:opacity-40`,children:R(ge==="shell"?"sidebar.newShell":"sidebar.newTmux")},ge))}),u.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[u.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:"Agent"}),u.jsxs("button",{type:"button",onClick:g,disabled:o,className:"inline-flex min-h-8 items-center gap-1 px-1 text-[10px] text-muted-foreground transition hover:text-foreground disabled:opacity-50",title:R("sidebar.detectAgents"),children:[u.jsx(ys,{size:10,className:o?"animate-spin":""}),R("sidebar.detectAgents")]})]}),u.jsxs("label",{className:"relative mt-1 flex min-h-11 cursor-pointer items-center gap-2.5 rounded-lg border border-border/30 bg-surface px-3 text-foreground transition hover:bg-surface-2 focus-within:border-primary/50",children:[B?u.jsx(dc,{agent:B,size:16}):u.jsx(pa,{size:14,className:"shrink-0"}),u.jsx("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:H}),q&&u.jsx("span",{className:"shrink-0 text-[9.5px] text-muted-foreground",children:R("sidebar.defaultAgent")}),o?u.jsx(Xn,{size:12,className:"shrink-0 animate-spin text-muted-foreground"}):u.jsx(fc,{size:13,className:"shrink-0 text-muted-foreground"}),u.jsxs("select",{"aria-label":"Agent",value:B?.slug??"__terminal__",onChange:ge=>{const ie=ge.target.value;j(ie==="__terminal__"?null:r.find(Ae=>Ae.slug===ie)??null)},className:"absolute inset-0 h-full w-full cursor-pointer opacity-0",children:[u.jsx("option",{value:"__terminal__",children:"Terminal"}),r.map(ge=>u.jsx("option",{value:ge.slug,children:ge.displayName},ge.slug))]})]}),!q&&u.jsxs("div",{className:"mt-1 flex min-h-8 items-center justify-between gap-2 px-0.5 text-[10px]",children:[u.jsx("span",{className:"truncate text-muted-foreground",children:R("sidebar.currentDefaultAgent",{name:ye})}),u.jsx("button",{type:"button",onClick:()=>y(B),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")})]}),u.jsx("label",{htmlFor:"new-session-directory",className:"mt-2.5 block text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:R("sidebar.workingDirectory")}),u.jsxs("button",{id:"new-session-directory",type:"button","aria-haspopup":"dialog",onClick:()=>$(!0),className:"mt-1 flex h-9 w-full items-center gap-2 rounded-lg border border-border/25 bg-surface px-2.5 font-mono text-[11px] text-foreground outline-none transition hover:bg-surface-2 focus-visible:border-primary/50",children:[u.jsx(hu,{size:12,className:"shrink-0 text-muted-foreground"}),u.jsx("span",{className:`min-w-0 flex-1 truncate text-left ${n.cwd?"":"text-muted-foreground"}`,children:n.cwd||R("sidebar.directoryPlaceholder")})]}),z.length>0&&u.jsx("div",{className:"mt-1.5 flex gap-1 overflow-x-auto pb-0.5","aria-label":R("sidebar.recentDirectories"),children:z.map(ge=>u.jsx("button",{type:"button",onClick:()=>te(ge),title:ge,className:"min-h-8 shrink-0 rounded-md bg-surface-2 px-2 text-[10px] text-muted-foreground transition hover:bg-surface hover:text-foreground",children:Oa(ge)||ge},ge))}),(a.length>0||p)&&u.jsxs("details",{className:"mt-3 border-t border-border/15 pt-2",children:[u.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:[u.jsx(Kc,{size:11}),u.jsx("span",{className:"flex-1",children:R("sidebar.resumeHistory")}),d&&u.jsx(Xn,{size:10,className:"animate-spin"}),a.length>0&&u.jsx("span",{className:"normal-case tracking-normal",children:R("sidebar.resumeHistoryCount",{n:a.length})}),u.jsx(fc,{size:11})]}),a.length>0&&u.jsx("div",{className:"mt-1 divide-y divide-border/10 overflow-hidden rounded-lg border border-border/15 bg-surface",children:a.slice(0,6).map(ge=>{const ie=h===ge.id;return u.jsxs("div",{className:"group flex min-w-0 items-stretch transition hover:bg-surface-2",children:[u.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>v(ge),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:ge.title}),children:[u.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:ie?u.jsx(Xn,{size:13,className:"animate-spin"}):u.jsx(dc,{agent:ge.agent,size:14})}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block truncate text-[11px] font-semibold text-foreground",children:ge.title}),u.jsxs("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[ge.agent.displayName," · ",ve(ge.closedAt)]})]}),u.jsx(y3,{size:12,className:"shrink-0 text-muted-foreground transition group-hover:text-primary"})]}),u.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>T(ge.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:ge.title}),children:[u.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-2 left-0 w-px bg-border opacity-30"}),u.jsx(co,{size:12})]})]},ge.id)})}),p&&u.jsx("div",{role:"alert",className:"mt-1.5 px-1 text-[10px] text-destructive",children:p})]})]}),u.jsx("div",{className:"shrink-0 border-t border-border/15 bg-surface-elevated p-3",children:u.jsxs("button",{type:"button",onClick:()=>b(B),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 shadow-md shadow-primary/20 transition hover:bg-primary/90 active:scale-[0.99]","aria-label":R("sidebar.launchSessionWith",{name:H}),children:[B?u.jsx(dc,{agent:B,size:15}):u.jsx(pa,{size:14}),u.jsx("span",{className:"truncate",children:R("sidebar.launchSessionWith",{name:H})})]})}),u.jsx(ww,{open:P,initialPath:n.cwd?.trim()||z[0]||"/",title:R("sidebar.chooseDirectory"),onCancel:()=>$(!1),onConfirm:te})]})}const Aw="termdock:new-session-agent:v1";function bU(){if(typeof window>"u")return null;try{const e=JSON.parse(window.localStorage.getItem(Aw)||"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 Kp(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Aw,JSON.stringify(e))}catch{}}function vU(e,t){return e?t.find(n=>n.slug===e)??null:null}function wU(){const[e,t]=S.useState(bU),[n,r]=S.useState([]),[s,o]=S.useState(!0),a=S.useCallback(async()=>{o(!0);try{const[h,p]=await Promise.all([uu(),Vb()]),g=vU(h.newSessionAgentSlug,p);r(p),t(g),Kp(g)}finally{o(!1)}},[]);S.useEffect(()=>{const h=()=>{a().catch(()=>{})};if(performance.getEntriesByName("termdock:startup:initial-viewport-presented").length>0){h();return}return window.addEventListener("termdock:initial-viewport-presented",h,{once:!0}),()=>window.removeEventListener("termdock:initial-viewport-presented",h)},[a]);const d=S.useCallback(async h=>{const p=e;t(h),Kp(h);try{await gi({newSessionAgentSlug:h?.slug??null})}catch(g){throw t(p),Kp(p),g}},[e]);return{preference:e,agents:n,detecting:s,refresh:a,selectAgent:d}}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",gr="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 AU({activeSessionId:e,initialCollaborationGroupId:t=null,defaultSessionMode:n="shell",onClose:r,onNewSession:s}){const[o,a]=S.useState(t?"collaboration":"automation"),[d,h]=S.useState([]),[p,g]=S.useState([]),[y,b]=S.useState([]),[v,T]=S.useState([]),[A,L]=S.useState([]),[R,D]=S.useState(null),[B,j]=S.useState(null),[P,$]=S.useState(null),z=t?v.find(ye=>ye.id===t)??null:null,H=S.useCallback(async(ye={})=>{ye.silent||j(null);try{const[q,te,ve]=await Promise.all([XT(),Jb(),Vb()]);h(q.automations),g(q.runs),T(te.groups),L(te.sessions),b(ve)}catch(q){ye.silent||j(q instanceof Error?q.message:"加载失败")}},[]);return S.useEffect(()=>{H();const ye=window.setInterval(()=>{H({silent:!0})},1e4);return()=>window.clearInterval(ye)},[H]),S.useEffect(()=>{const ye=q=>{q.key==="Escape"&&r()};return window.addEventListener("keydown",ye),()=>window.removeEventListener("keydown",ye)},[r]),ga.createPortal(u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:r,"aria-label":"关闭 Agent 工作台"}),u.jsxs("section",{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-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:[u.jsxs("header",{className:"flex items-center gap-2 border-b border-border/15 px-4 py-3",children:[u.jsx(Wh,{size:17,className:"text-primary"}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:z?`${z.name} · 协作消息`:"Agent 工作台"}),u.jsx("p",{className:"text-[10px] text-muted-foreground",children:z?"发送任务、问题或工作交接":"自动任务、会话协作与全文恢复"})]}),u.jsx("button",{className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:r,"aria-label":"关闭",children:u.jsx(Bs,{size:16})})]}),u.jsx("nav",{className:"flex gap-1 border-b border-border/15 px-3 py-2",children:[["automation",R0,"自动任务"],["collaboration",pu,"会话协作"],["search",hh,"全文搜索"]].map(([ye,q,te])=>u.jsxs("button",{onClick:()=>a(ye),className:`${gr} ${o===ye?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[u.jsx(q,{size:14}),te]},ye))}),B&&u.jsx("div",{className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:B}),P&&u.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:[u.jsx(ma,{size:13}),P]}),u.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:[o==="automation"&&u.jsx(TU,{automations:d,runs:p,agents:y,sessions:A,activeSessionId:e,busy:R,setBusy:D,setError:j,setNotice:$,refresh:H,onClose:r}),o==="collaboration"&&u.jsx(CU,{groups:v,sessions:A,agents:y,activeSessionId:e,initialGroupId:t,defaultSessionMode:n,busy:R,setBusy:D,setError:j,setNotice:$,refresh:H}),o==="search"&&u.jsx(IU,{onClose:r,onNewSession:s,setError:j})]})]})]}),document.body)}function TU({automations:e,runs:t,agents:n,sessions:r,activeSessionId:s,busy:o,setBusy:a,setError:d,setNotice:h,refresh:p,onClose:g}){const[y,b]=S.useState(null),[v,T]=S.useState(!1),[A,L]=S.useState(null),R=async(D,B,j)=>{a(D),d(null),h(null);try{await B(),await p(),h(j)}catch(P){d(P instanceof Error?P.message:"操作失败")}finally{a(null)}};return u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"flex items-start justify-between gap-4",children:[u.jsxs("div",{children:[u.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"自动任务"}),u.jsx("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-muted-foreground",children:"按计划把任务交给 Agent。每次运行都有独立会话和结果入口。"})]}),!v&&e.length>0&&u.jsxs("button",{className:`${gr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{b(null),T(!0),h(null)},children:[u.jsx(Yi,{size:13}),"新建任务"]})]}),v&&u.jsx(SU,{agents:n,sessions:r,activeSessionId:s,initial:y,onCancel:()=>{b(null),T(!1)},onSaved:async D=>{b(null),T(!1),await p(),h(y?`“${D}”已更新`:`“${D}”已创建,将按计划自动运行`)},setError:d}),e.length===0&&!v&&u.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[u.jsx(OC,{size:24,className:"mx-auto text-primary"}),u.jsx("p",{className:"mt-3 text-[13px] font-medium text-foreground",children:"把重复工作交给 Agent"}),u.jsx("p",{className:"mx-auto mt-1 max-w-sm text-[11px] leading-relaxed text-muted-foreground",children:"选择运行会话、写清任务内容,再设定时间。创建后可以先手动运行一次确认效果。"}),u.jsxs("button",{className:`${gr} mt-4 bg-primary text-primary-foreground`,onClick:()=>T(!0),children:[u.jsx(Yi,{size:13}),"创建第一个任务"]})]}),u.jsx("div",{className:"space-y-2",children:e.map(D=>{const B=t.find(P=>P.automationId===D.id),j=n.find(P=>P.command===D.command);return u.jsxs("article",{className:"rounded-xl border border-border/15 bg-surface-2/40 p-3 transition hover:border-border/30",children:[u.jsxs("div",{className:"flex items-start gap-3",children:[u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:D.name}),u.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&&u.jsx("span",{className:`text-[10px] ${BU(D.lastRunStatus)}`,children:DU(D.lastRunStatus)})]}),u.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-muted-foreground",children:[u.jsxs("span",{className:"inline-flex items-center gap-1",children:[u.jsx(R0,{size:11}),MU(D)]}),u.jsx("span",{children:D.enabled&&D.nextRunAt?`下次 ${Qh(D.nextRunAt)}`:"不会自动运行"})]}),u.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:D.targetSessionId?`发送到 ${r.find(P=>P.sessionId===D.targetSessionId)?.name??"指定会话"}`:`新建 ${j?.displayName??"Agent"} 会话 · ${D.cwd}`}),u.jsx("p",{className:"mt-2 line-clamp-2 text-[11px] leading-relaxed text-foreground/80",children:D.prompt}),D.lastRunAt&&u.jsxs("p",{className:"mt-2 text-[10px] text-muted-foreground",children:["上次 ",Qh(D.lastRunAt),D.lastRunMessage?` · ${D.lastRunMessage}`:""]})]}),u.jsx("button",{"aria-label":`编辑 ${D.name}`,title:"编辑",className:"rounded-lg p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",onClick:()=>{b(D),T(!0),h(null)},children:u.jsx(x3,{size:13})})]}),u.jsx("div",{className:"mt-3 flex flex-wrap items-center justify-end gap-2 border-t border-border/10 pt-3",children:A===D.id?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"mr-auto text-[10px] text-destructive",children:"删除后不会再自动运行"}),u.jsx("button",{className:`${gr} bg-surface-elevated text-foreground`,onClick:()=>L(null),children:"取消"}),u.jsxs("button",{disabled:o!==null,className:`${gr} bg-destructive text-destructive-foreground`,onClick:()=>{R(`delete:${D.id}`,()=>nS(D.id),`“${D.name}”已删除`).then(()=>L(null))},children:[o===`delete:${D.id}`?u.jsx(ys,{size:13,className:"animate-spin"}):u.jsx(co,{size:13}),"确认删除"]})]}):u.jsxs(u.Fragment,{children:[u.jsxs("button",{className:`${gr} mr-auto px-2 text-destructive hover:bg-destructive/10`,onClick:()=>L(D.id),children:[u.jsx(co,{size:13}),"删除"]}),u.jsxs("button",{disabled:o!==null,className:`${gr} ${D.enabled?"bg-surface-elevated text-foreground":"bg-primary/15 text-primary"}`,onClick:()=>{R(`toggle:${D.id}`,()=>tS(D.id,!D.enabled),D.enabled?`“${D.name}”已暂停,不会自动运行`:`“${D.name}”已恢复,将按原计划运行`)},children:[o===`toggle:${D.id}`?u.jsx(ys,{size:13,className:"animate-spin"}):D.enabled?u.jsx(G_,{size:13}):u.jsx(N2,{size:13}),D.enabled?"暂停":"恢复"]}),B?.frontendSessionId&&u.jsxs("button",{className:`${gr} bg-surface-elevated text-foreground`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:B.frontendSessionId})),g()},children:[u.jsx(m3,{size:13}),"打开上次会话"]}),u.jsxs("button",{disabled:o!==null,className:`${gr} bg-primary/15 text-primary`,onClick:()=>{R(`run:${D.id}`,()=>eS(D.id),`“${D.name}”已投递,可打开会话查看进度`)},children:[o===`run:${D.id}`?u.jsx(ys,{size:13,className:"animate-spin"}):u.jsx(N2,{size:13}),"立即运行"]})]})})]},D.id)})})]})}function SU({agents:e,sessions:t,activeSessionId:n,initial:r,onCancel:s,onSaved:o,setError:a}){const[d,h]=S.useState(r?.name??""),p=t.find(X=>X.sessionId===n),g=r?.cwd??p?.cwd??t[0]?.cwd??"",[y,b]=S.useState(g),[v,T]=S.useState(!1),[A,L]=S.useState(()=>e.find(X=>X.command===r?.command)?.slug??""),[R,D]=S.useState(r?.prompt??""),[B,j]=S.useState(r?.targetSessionId??""),[P,$]=S.useState(r?.targetSessionId?"existing":"new"),[z,H]=S.useState(r?.schedule.kind??"interval"),[ye,q]=S.useState(r?.schedule.kind==="interval"?r.schedule.everyMinutes:60),[te,ve]=S.useState(r?.schedule.kind==="daily"?r.schedule.time:"09:00"),[ge,ie]=S.useState(r?.schedule.kind==="daily"?r.schedule.weekdays:[1,2,3,4,5]),[Ae,xe]=S.useState(r?.enabled??!0),[ce,K]=S.useState(!1),Se=(e.find(X=>X.slug===A)??null)?.command??r?.command??"";S.useEffect(()=>{!r&&!A&&e[0]&&L(e[0].slug)},[e,r,A]);const We=async()=>{K(!0),a(null);try{await JT({id:r?.id,name:d,cwd:y,command:P==="new"?Se:"",prompt:R,targetSessionId:P==="existing"&&B||null,enabled:Ae,schedule:z==="interval"?{kind:z,everyMinutes:ye}:{kind:z,time:te,weekdays:ge}}),await o(d.trim())}catch(X){a(X instanceof Error?X.message:"保存失败")}finally{K(!1)}},ue=z==="interval"?{kind:z,everyMinutes:ye}:{kind:z,time:te,weekdays:ge},[Ee,Tt]=te.split(":"),Rt=(X,rt)=>ve(`${X}:${rt}`),ze=!!(d.trim()&&R.trim()&&(P==="existing"?B:Se)&&(z==="interval"?ye>=1:ge.length>0));return u.jsxs("div",{className:"overflow-hidden rounded-xl border border-primary/25 bg-primary/5",children:[u.jsxs("div",{className:"flex items-center justify-between border-b border-primary/15 px-4 py-3",children:[u.jsxs("div",{children:[u.jsx("p",{className:"text-[13px] font-medium text-foreground",children:r?"编辑自动任务":"创建自动任务"}),u.jsx("p",{className:"mt-0.5 text-[10px] text-muted-foreground",children:"三步完成,保存后可立即试跑"})]}),u.jsx("button",{className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:s,"aria-label":"关闭任务表单",children:u.jsx(Bs,{size:14})})]}),u.jsxs("div",{className:"space-y-5 p-4",children:[u.jsxs("fieldset",{className:"space-y-3",children:[u.jsxs("legend",{className:"text-[11px] font-medium text-foreground",children:[u.jsx("span",{className:"mr-2 text-primary",children:"1"}),"要做什么"]}),u.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["任务名称",u.jsx("input",{autoFocus:!0,className:Li,value:d,onChange:X=>h(X.target.value),placeholder:"例如:每日代码巡检"})]}),u.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["任务内容",u.jsx("textarea",{className:`${Li} min-h-24 resize-y`,value:R,onChange:X=>D(X.target.value),placeholder:"说明目标、检查范围和期望产出,例如:检查当前分支的测试与待办,修复可安全处理的问题并总结结果。"})]})]}),u.jsxs("fieldset",{className:"space-y-3 border-t border-border/10 pt-4",children:[u.jsxs("legend",{className:"text-[11px] font-medium text-foreground",children:[u.jsx("span",{className:"mr-2 text-primary",children:"2"}),"在哪里运行"]}),u.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[u.jsx("button",{type:"button","aria-pressed":P==="new",className:`${gr} justify-start border px-3 text-left ${P==="new"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>$("new"),children:"每次新建会话"}),u.jsx("button",{type:"button","aria-pressed":P==="existing",disabled:t.length===0,className:`${gr} justify-start border px-3 text-left ${P==="existing"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>{$("existing"),B||j(n??t[0]?.sessionId??"")},children:"发送到现有会话"})]}),P==="new"?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[u.jsxs("label",{className:"space-y-1 text-[10px] text-muted-foreground",children:["Agent / Plugin",u.jsxs("select",{className:Li,value:A,onChange:X=>L(X.target.value),children:[r&&!e.some(X=>X.command===r.command)&&u.jsx("option",{value:"",children:"原 Agent 当前不可用"}),e.map(X=>u.jsxs("option",{value:X.slug,children:[X.displayName,X.isPlugin?" · Plugin":""]},X.slug))]})]}),u.jsxs("label",{className:"space-y-1 text-[10px] text-muted-foreground",children:["工作目录",u.jsxs("div",{className:"flex gap-2",children:[u.jsx("input",{className:Li,value:y,onChange:X=>b(X.target.value),placeholder:"默认使用当前目录"}),u.jsxs("button",{type:"button","aria-haspopup":"dialog",className:`${gr} shrink-0 bg-surface-2 text-foreground`,onClick:()=>T(!0),children:[u.jsx(su,{size:13}),"选择"]})]})]})]}),e.length===0&&u.jsx("p",{className:"text-[10px] text-destructive",children:"没有检测到可启动的 Agent。请先在 Plugin 设置中安装或配置 Agent。"})]}):u.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["目标会话",u.jsx("select",{className:Li,value:B,onChange:X=>j(X.target.value),children:t.map(X=>u.jsxs("option",{value:X.sessionId,children:[X.name," · ",X.status]},X.sessionId))}),u.jsx("span",{className:"block leading-relaxed",children:"运行时该会话需要在线,并且 Agent 处于可接收任务的状态。"})]})]}),u.jsxs("fieldset",{className:"space-y-3 border-t border-border/10 pt-4",children:[u.jsxs("legend",{className:"text-[11px] font-medium text-foreground",children:[u.jsx("span",{className:"mr-2 text-primary",children:"3"}),"什么时候运行"]}),u.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[u.jsx("button",{type:"button","aria-pressed":z==="interval",className:`${gr} border ${z==="interval"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>H("interval"),children:"固定间隔"}),u.jsx("button",{type:"button","aria-pressed":z==="daily",className:`${gr} border ${z==="daily"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>H("daily"),children:"指定日期与时间"})]}),z==="interval"?u.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["每隔多少分钟",u.jsx("input",{className:Li,type:"number",min:1,max:43200,value:ye,onChange:X=>q(Number(X.target.value))}),u.jsx("span",{className:"block",children:"例如 60 = 每小时,1440 = 每天。始终按任务创建时间计算,之后编辑不会重置节奏。"})]}):u.jsxs("div",{className:"space-y-3",children:[u.jsxs("div",{children:[u.jsx("span",{className:"text-[10px] text-muted-foreground",children:"运行时间"}),u.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:[u.jsx(R0,{size:15,className:"mr-3 shrink-0 text-primary"}),u.jsx(Jy,{label:"小时",value:Ee,options:24,onChange:X=>Rt(X,Tt)}),u.jsx("span",{"aria-hidden":"true",className:"px-2 text-[18px] font-medium text-muted-foreground",children:":"}),u.jsx(Jy,{label:"分钟",value:Tt,options:60,onChange:X=>Rt(Ee,X)}),u.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 小时制"})]})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-[10px] text-muted-foreground",children:"运行日期"}),u.jsx("div",{className:"mt-1 grid grid-cols-7 gap-1",children:["日","一","二","三","四","五","六"].map((X,rt)=>{const qe=ge.includes(rt);return u.jsx("button",{type:"button","aria-pressed":qe,"aria-label":`星期${X}`,className:`rounded-lg py-2.5 text-[10px] transition ${qe?"bg-primary text-primary-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,onClick:()=>ie(re=>qe?re.filter(J=>J!==rt):[...re,rt].sort()),children:X},rt)})}),ge.length===0&&u.jsx("p",{className:"mt-1 text-[10px] text-destructive",children:"至少选择一天"})]})]})]})]}),u.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:[u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-foreground",children:[u.jsx("input",{type:"checkbox",checked:Ae,onChange:X=>xe(X.target.checked)}),"保存后启用"]}),u.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:Ae&&ze?`${r?"下次运行":"首次运行"}:${Qh(NU(ue,Date.now(),r?.createdAt))}`:Ae?"填写完整后显示首次运行时间":"任务会保存,但不会自动运行"})]}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx("button",{className:`${gr} bg-surface-2 text-foreground`,onClick:s,children:"取消"}),u.jsx("button",{disabled:ce||!ze,className:`${gr} bg-primary text-primary-foreground`,onClick:()=>{We()},children:ce?"保存中…":r?"保存修改":"创建任务"})]})]}),u.jsx(ww,{open:v,initialPath:y||g||"/",title:"选择工作目录",labels:{hint:"进入文件夹,确认后才会更改工作目录。",cancel:"取消",confirm:"使用此目录",close:"关闭",parent:"上一级目录"},onCancel:()=>T(!1),onConfirm:X=>{b(X),T(!1)}})]})}function Jy({label:e,value:t,options:n,onChange:r}){return u.jsxs("label",{className:"relative min-w-0 flex-1",children:[u.jsx("span",{className:"sr-only",children:e}),u.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:s=>r(s.target.value),children:Array.from({length:n},(s,o)=>{const a=String(o).padStart(2,"0");return u.jsx("option",{value:a,children:a},a)})}),u.jsx(fc,{"aria-hidden":"true",size:13,className:"pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground"})]})}function CU({groups:e,sessions:t,agents:n,activeSessionId:r,initialGroupId:s,defaultSessionMode:o,busy:a,setBusy:d,setError:h,setNotice:p,refresh:g}){const[y,b]=S.useState(""),[v,T]=S.useState(()=>new Set(r?[r]:[])),[A,L]=S.useState(s??e[0]?.id??null),[R,D]=S.useState(""),[B,j]=S.useState(!1),[P,$]=S.useState([]),[z,H]=S.useState("*"),[ye,q]=S.useState("message"),[te,ve]=S.useState(""),[ge,ie]=S.useState(!1),[Ae,xe]=S.useState(new Set),[ce,K]=S.useState(!1),[be,Se]=S.useState(""),[We,ue]=S.useState(""),[Ee,Tt]=S.useState(""),[Rt,ze]=S.useState(""),X=S.useRef(null),rt=S.useRef(!1),qe=A==="new"?null:e.find(de=>de.id===A)??e[0]??null,re=new Set(t.map(de=>de.sessionId)),J=[...v].filter(de=>re.has(de)).length,$e=R.trim().toLocaleLowerCase(),tt=t.filter(de=>!$e||[de.name,de.serviceLabel??"",de.cwd,em(de.currentTask)].some(Pe=>Pe.toLocaleLowerCase().includes($e)));S.useEffect(()=>{!A&&e[0]&&L(e[0].id)},[e,A]),S.useEffect(()=>{ie(!1),K(!1),xe(new Set(qe?.sessionIds??[]))},[qe?.id]),S.useEffect(()=>{!be&&n[0]&&Se(n[0].slug)},[n,be]),S.useEffect(()=>{if(!qe){$([]);return}let de=!1;const Pe=()=>{m2(qe.id).then(zt=>{de||$(zt.messages)}).catch(zt=>{de||h(zt instanceof Error?zt.message:"消息加载失败")})};Pe();const ot=window.setInterval(Pe,3e3);return()=>{de=!0,window.clearInterval(ot)}},[qe?.id,h]),S.useEffect(()=>{!s||qe?.id!==s||rt.current||(rt.current=!0,X.current?.scrollIntoView?.({block:"nearest"}))},[s,qe?.id]);const gt=async()=>{d("create-group"),h(null),p(null);try{const de=[...v].filter(ot=>re.has(ot)),Pe=await T0({name:y,sessionIds:de});b(""),D(""),L(Pe.group.id),await g(),p(`“${Pe.group.name}”已创建,${Pe.group.sessionIds.length} 个会话可以开始协作`)}catch(de){h(de instanceof Error?de.message:"创建失败")}finally{d(null)}},pt=async()=>{if(qe){d("send-message"),h(null),p(null);try{const de=await sS(qe.id,{fromSessionId:null,toSessionIds:z==="*"?void 0:[z],kind:ye,content:te});ve(""),$((await m2(qe.id)).messages);const Pe=de.deliveries?.filter(zt=>zt.serviceUnavailable).length??0,ot=de.deliveries?.filter(zt=>zt.pending>0).length??0;p(Pe>0?`已保存消息;${Pe} 个接收成员的服务不可达,尚未送达,等待重连`:ot>0?`已保存消息;${ot} 个成员等待投递确认`:`消息已送达 ${de.messages.length} 个会话`)}catch(de){h(de instanceof Error?de.message:"发送失败")}finally{d(null)}}},Ct=async()=>{if(!qe)return;d(`delete:${qe.id}`),h(null),p(null);const de=qe.name;try{await e3(qe.id),L(null),j(!1),await g(),p(`“${de}”已删除`)}catch(Pe){h(Pe instanceof Error?Pe.message:"删除失败")}finally{d(null)}},Le=async()=>{if(!qe)return;const de=t.filter(Pe=>Ae.has(Pe.sessionId)).map(Pe=>Pe.sessionId);d("save-members"),h(null),p(null);try{await T0({id:qe.id,name:qe.name,sessionIds:de}),ie(!1),await g(),p(`“${qe.name}”成员已更新,共 ${de.length} 个会话`)}catch(Pe){h(Pe instanceof Error?Pe.message:"成员更新失败")}finally{d(null)}},Te=()=>{const de=t.find(Pe=>Pe.sessionId===r)?.cwd??t.find(Pe=>qe?.sessionIds.includes(Pe.sessionId))?.cwd??"";Tt(de),ue(""),ze(""),K(!0),ie(!1)},Oe=async()=>{if(!(!qe||!be)){d("spawn-agent"),h(null),p(null);try{const de=await rS(qe.id,{agentSlug:be,name:We.trim()||void 0,cwd:Ee.trim()||void 0,task:Rt.trim()||void 0,mode:o});K(!1),await g(),p(`“${de.session.name}”已创建并加入“${de.group.name}”`)}catch(de){h(de instanceof Error?de.message:"Agent Session 创建失败")}finally{d(null)}}},yt=EU(P,t);return u.jsxs("div",{className:"space-y-5",children:[u.jsxs("div",{className:"flex items-start justify-between gap-4",children:[u.jsxs("div",{children:[u.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"会话协作"}),u.jsx("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-muted-foreground",children:"创建协作组后,一个 Agent 会话可以把任务直接交给另一个会话。比如“开发”写完代码后通知“测试”检查,测试结果再回复回来;你也可以给单个会话或全组发任务,所有交接和进展都记录在这里。"})]}),qe&&u.jsxs("button",{className:`${gr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{L("new"),j(!1),p(null)},children:[u.jsx(Yi,{size:13}),"新建组"]})]}),e.length>0&&u.jsx("div",{className:"flex gap-2 overflow-x-auto border-b border-border/15 pb-3",children:e.map(de=>u.jsxs("button",{onClick:()=>L(de.id),className:`${gr} shrink-0 ${qe?.id===de.id?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground"}`,children:[de.name,u.jsx("span",{className:"text-[9px] opacity-70",children:de.sessionIds.length})]},de.id))}),!qe&&u.jsxs("section",{className:"border-y border-border/15 py-4",children:[u.jsxs("div",{className:"flex items-start justify-between gap-3",children:[u.jsxs("div",{children:[u.jsx("h4",{className:"text-[12px] font-medium text-foreground",children:"创建协作组"}),u.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-muted-foreground",children:"至少选择两个会话。离线成员会在重新上线后收到消息;已从列表移除的会话不会提交。"})]}),u.jsxs("span",{className:`shrink-0 text-[10px] ${J>=2?"text-primary":"text-muted-foreground"}`,children:["已选 ",J," 个"]})]}),u.jsxs("label",{className:"mt-4 block space-y-1 text-[10px] text-muted-foreground",children:["协作组名称",u.jsx("input",{className:Li,value:y,onChange:de=>b(de.target.value),placeholder:"例如:发布准备"})]}),t.length>5&&u.jsxs("label",{className:"relative mt-3 block",children:[u.jsx("span",{className:"sr-only",children:"筛选会话"}),u.jsx(hh,{size:13,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),u.jsx("input",{className:`${Li} pl-8`,value:R,onChange:de=>D(de.target.value),placeholder:"按名称、目录或当前任务筛选"})]}),u.jsxs("div",{className:"mt-3 max-h-64 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:[tt.map(de=>u.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-2 py-2.5 transition hover:bg-surface-2",children:[u.jsx("input",{className:"mt-0.5",type:"checkbox",checked:v.has(de.sessionId),onChange:()=>T(Pe=>{const ot=new Set(Pe);return ot.has(de.sessionId)?ot.delete(de.sessionId):ot.add(de.sessionId),ot})}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"truncate text-[12px] text-foreground",children:de.name}),u.jsx(Xp,{session:de}),u.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:Jp(de)})]}),u.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[em(de.currentTask)," · ",de.cwd]})]})]},de.sessionId)),t.length===0&&u.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:"暂无可选会话,请先打开两个会话"}),t.length>0&&tt.length===0&&u.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:"没有符合筛选条件的会话"})]}),u.jsxs("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row sm:items-center",children:[u.jsx("p",{className:`min-w-0 flex-1 text-[10px] ${J<2?"text-muted-foreground":"text-primary"}`,children:J<2?`还需选择 ${2-J} 个会话`:"成员已满足要求,可以创建"}),u.jsxs("div",{className:"flex justify-end gap-2",children:[e.length>0&&u.jsx("button",{className:`${gr} bg-surface-2 text-foreground`,onClick:()=>L(e[0]?.id??null),children:"取消"}),u.jsxs("button",{disabled:a!==null||!y.trim()||J<2,className:`${gr} bg-primary text-primary-foreground`,onClick:()=>{gt()},children:[a==="create-group"?u.jsx(ys,{size:13,className:"animate-spin"}):u.jsx(Yi,{size:13}),"创建协作组"]})]})]})]}),qe&&u.jsxs(u.Fragment,{children:[u.jsxs("section",{className:"border-y border-border/15 py-4",children:[u.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("h4",{className:"text-[13px] font-medium text-foreground",children:qe.name}),u.jsxs("p",{className:"mt-1 text-[10px] text-muted-foreground",children:[qe.sessionIds.length," 个成员 · 组 ID:",u.jsx("span",{className:"break-all font-mono",children:qe.id})]})]}),B?u.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[u.jsx("button",{className:`${gr} bg-surface-2 px-2 text-foreground`,onClick:()=>j(!1),children:"取消"}),u.jsxs("button",{disabled:a!==null,className:`${gr} bg-destructive px-2 text-destructive-foreground`,onClick:()=>{Ct()},children:[a===`delete:${qe.id}`?u.jsx(ys,{size:13,className:"animate-spin"}):null,"确认删除"]})]}):u.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[u.jsxs("button",{className:`${gr} px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>{xe(new Set(qe.sessionIds)),ie(de=>!de),K(!1)},children:[u.jsx(x3,{size:13}),"管理成员"]}),u.jsxs("button",{className:`${gr} px-2 text-primary hover:bg-primary/10`,onClick:Te,children:[u.jsx(Yi,{size:13}),"新建 Agent"]}),u.jsx("button",{"aria-label":`删除协作组 ${qe.name}`,title:"删除协作组",disabled:a!==null,className:"rounded-lg p-2 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",onClick:()=>j(!0),children:u.jsx(co,{size:14})})]})]}),u.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:qe.sessionIds.map(de=>{const Pe=t.find(ot=>ot.sessionId===de);return u.jsxs("button",{disabled:!Pe,onClick:()=>Pe&&void _U(Pe).catch(ot=>h(ot instanceof Error?ot.message:"无法打开会话")),className:"min-w-0 px-3 py-2.5 text-left transition hover:bg-surface-2 disabled:cursor-default",children:[u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${Pe?.status==="working"?"bg-primary":Pe?"bg-[var(--success)]":"bg-muted-foreground"}`}),u.jsx("span",{className:"truncate text-[11px] text-foreground",children:Pe?.name??de}),Pe&&u.jsx(Xp,{session:Pe}),u.jsx("span",{className:"ml-auto shrink-0 text-[9px] text-muted-foreground",children:Pe?Jp(Pe):"已离线"})]}),u.jsx("span",{className:"mt-1 block truncate text-[9px] text-muted-foreground",children:Pe?em(Pe.currentTask):"重新上线后可继续接收消息"})]},de)})}),ge&&u.jsxs("div",{className:"mt-4 border-t border-border/15 pt-4",children:[u.jsxs("div",{className:"flex items-start justify-between gap-3",children:[u.jsxs("div",{children:[u.jsx("h5",{className:"text-[11px] font-medium text-foreground",children:"管理成员"}),u.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:"勾选已有 Session,保存后立即参与之后的协作消息。"})]}),u.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["已选 ",Ae.size]})]}),u.jsx("div",{className:"mt-3 max-h-52 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:t.map(de=>u.jsxs("label",{className:"flex cursor-pointer items-center gap-3 px-2 py-2.5 transition hover:bg-surface-2",children:[u.jsx("input",{type:"checkbox",checked:Ae.has(de.sessionId),onChange:()=>xe(Pe=>{const ot=new Set(Pe);return ot.has(de.sessionId)?ot.delete(de.sessionId):ot.add(de.sessionId),ot})}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block truncate text-[11px] text-foreground",children:de.name}),u.jsx(Xp,{session:de}),u.jsxs("span",{className:"block truncate text-[9px] text-muted-foreground",children:[Jp(de)," · ",de.cwd]})]})]},de.sessionId))}),u.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[u.jsx("button",{className:`${gr} bg-surface-2 text-foreground`,onClick:()=>ie(!1),children:"取消"}),u.jsxs("button",{disabled:a!==null||Ae.size<2,className:`${gr} bg-primary text-primary-foreground`,onClick:()=>{Le()},children:[a==="save-members"?u.jsx(ys,{size:13,className:"animate-spin"}):u.jsx(ma,{size:13}),"保存成员"]})]})]}),ce&&u.jsxs("div",{className:"mt-4 border-t border-primary/20 pt-4",children:[u.jsxs("div",{children:[u.jsx("h5",{className:"text-[11px] font-medium text-foreground",children:"创建 Agent Session"}),u.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:"新会话启动后自动加入本组,并收到初始任务和成员信息。"})]}),u.jsxs("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[u.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["Agent / Plugin",u.jsx("select",{"aria-label":"新 Agent 类型",className:Li,value:be,onChange:de=>Se(de.target.value),children:n.map(de=>u.jsxs("option",{value:de.slug,children:[de.displayName,de.isPlugin?" · Plugin":""]},de.slug))})]}),u.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["会话名称",u.jsx("input",{"aria-label":"新 Agent 会话名称",className:Li,value:We,onChange:de=>ue(de.target.value),placeholder:"留空则自动命名"})]})]}),u.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["工作目录",u.jsx("input",{"aria-label":"新 Agent 工作目录",className:Li,value:Ee,onChange:de=>Tt(de.target.value),placeholder:"默认继承当前会话"})]}),u.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["初始任务",u.jsx("textarea",{"aria-label":"新 Agent 初始任务",className:`${Li} min-h-16 resize-y`,value:Rt,onChange:de=>ze(de.target.value),placeholder:"说明它加入后要先完成什么"})]}),u.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[u.jsx("button",{className:`${gr} bg-surface-2 text-foreground`,onClick:()=>K(!1),children:"取消"}),u.jsxs("button",{disabled:a!==null||!be,className:`${gr} bg-primary text-primary-foreground`,onClick:()=>{Oe()},children:[a==="spawn-agent"?u.jsx(ys,{size:13,className:"animate-spin"}):u.jsx(Wh,{size:13}),"创建并加入"]})]})]})]}),u.jsxs("section",{children:[u.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[u.jsx("h4",{className:"text-[11px] font-medium text-foreground",children:"协作记录"}),u.jsxs("span",{className:"text-[9px] text-muted-foreground",children:[yt.length," 条"]})]}),u.jsxs("div",{className:"max-h-72 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:[yt.map(de=>u.jsxs("div",{className:"px-2 py-3",children:[u.jsxs("div",{className:"flex items-center gap-2 text-[9px] text-muted-foreground",children:[u.jsx("span",{className:"font-medium text-primary",children:kU(de.kind)}),u.jsx("span",{children:de.fromName}),u.jsx("span",{children:"→"}),u.jsx("span",{className:"truncate",children:de.toNames.join("、")}),u.jsx("span",{className:"ml-auto shrink-0",children:new Date(de.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),u.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[11px] leading-relaxed text-foreground",children:de.content}),u.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:de.status==="pending"?"尚未送达 · 等待服务连接或 Agent 上线":de.status==="read"?"已读取":"已进入 Agent 队列"})]},de.key)),yt.length===0&&u.jsx(PU,{text:"还没有消息。可以先发一个任务或问题。"})]})]}),u.jsxs("section",{ref:X,className:"border-t border-primary/20 bg-primary/5 px-3 py-3",children:[u.jsx("h4",{className:"text-[11px] font-medium text-foreground",children:"发送给成员"}),u.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[u.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["接收人",u.jsxs("select",{className:Li,value:z,onChange:de=>H(de.target.value),children:[u.jsx("option",{value:"*",children:"全组成员"}),qe.sessionIds.map(de=>u.jsx("option",{value:de,children:Tw(t.find(Pe=>Pe.sessionId===de))??`${de.slice(0,8)}(离线)`},de))]})]}),u.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["消息类型",u.jsxs("select",{className:Li,value:ye,onChange:de=>q(de.target.value),children:[u.jsx("option",{value:"message",children:"普通消息"}),u.jsx("option",{value:"ask",children:"需要回答的问题"}),u.jsx("option",{value:"task",children:"需要执行的任务"}),u.jsx("option",{value:"handoff",children:"工作交接"}),u.jsx("option",{value:"done",children:"完成通知"})]})]})]}),u.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["内容",u.jsx("textarea",{className:`${Li} min-h-20 resize-y`,value:te,onChange:de=>ve(de.target.value),placeholder:"说明背景、期望产出,以及对方需要回复或完成什么…"})]}),u.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3",children:[u.jsx("p",{className:"text-[9px] leading-relaxed text-muted-foreground",children:qe.federated?"跨服务消息由 Mac 客户端转发,请保持客户端运行;服务不可达时等待重连。":"在线成员立即入队;离线成员上线后送达。"}),u.jsxs("button",{disabled:a!==null||!te.trim(),className:`${gr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{pt()},children:[a==="send-message"?u.jsx(ys,{size:13,className:"animate-spin"}):null,"发送"]})]})]})]})]})}function Xp({session:e}){return!e.serviceOrigin||e.serviceOrigin===window.location.origin?null:u.jsxs("span",{title:e.serviceOrigin,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:[u.jsx(m3,{size:9}),u.jsx("span",{className:"truncate",children:e.serviceLabel??e.serviceOrigin})]})}function Jp(e){return e.serviceConnected===!1?"服务不可达":LU(e.status)}function Tw(e){return e?`${e.name}${e.serviceOrigin&&e.serviceOrigin!==window.location.origin?` · ${e.serviceLabel??e.serviceOrigin}`:""}`:void 0}async function _U(e){if(e.sessionId.startsWith("remote:")){if(!await window.termdockDesktop?.collaborationFocus?.(e.sessionId))throw new Error("服务未连接,请先在连接中心重新连接")}else window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e.sessionId}))}function LU(e){return e==="working"?"处理中":e==="idle"||e==="done"?"可接收":e==="offline"?"已离线":"在线"}function em(e){if(!e)return"暂无任务摘要";try{const t=JSON.parse(e);if(typeof t.prompt=="string")return Ph(t.prompt)||"暂无任务摘要"}catch{}return Ph(e)||"暂无任务摘要"}function kU(e){return{message:"消息",ask:"问题",reply:"回复",task:"任务",handoff:"交接",done:"完成"}[e]}function EU(e,t){const n=new Map(t.map(s=>[s.sessionId,Tw(s)])),r=new Map;for(const s of e){const o=`${s.threadId}:${s.createdAt}:${s.fromSessionId??"user"}:${s.kind}:${s.content}`,a=r.get(o),d=n.get(s.toSessionId)??s.toSessionId.slice(0,8);if(a){a.toNames.push(d);const h={pending:0,delivered:1,read:2};h[s.status]<h[a.status]&&(a.status=s.status);continue}r.set(o,{key:o,kind:s.kind,content:s.content,createdAt:s.createdAt,fromName:s.fromSessionId?n.get(s.fromSessionId)??s.fromSessionId.slice(0,8):"你",toNames:[d],status:s.status})}return[...r.values()].sort((s,o)=>s.createdAt-o.createdAt)}function IU({onClose:e,onNewSession:t,setError:n}){const[r,s]=S.useState(""),[o,a]=S.useState([]),[d,h]=S.useState(!1),p=S.useRef(0);S.useEffect(()=>{const y=r.trim(),b=++p.current;if(a([]),!y){h(!1);return}h(!0);const v=window.setTimeout(()=>{iS(y).then(T=>{b===p.current&&a(T.results)}).catch(T=>{b===p.current&&n(T instanceof Error?T.message:"搜索失败")}).finally(()=>{b===p.current&&h(!1)})},250);return()=>window.clearTimeout(v)},[r,n]);const g=async y=>{if(y.live){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:y.sessionId})),e();return}if(y.resumeHistoryId)try{const b=await qb(y.resumeHistoryId);t({mode:"shell",cwd:b.cwd,command:b.command}),e()}catch(b){n(b instanceof Error?b.message:"恢复失败")}};return u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"sticky -top-4 z-20 -mx-4 -mt-4 border-b border-border/15 bg-surface px-4 py-3",children:[u.jsxs("div",{children:[u.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"全文搜索"}),u.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:"搜索会话标题、项目目录、任务内容和终端记录"})]}),u.jsxs("label",{className:"relative mt-3 block",children:[u.jsx("span",{className:"sr-only",children:"搜索全部会话"}),u.jsx(hh,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),u.jsx("input",{autoFocus:!0,className:`${Li} pl-9 pr-9`,value:r,onChange:y=>{n(null),s(y.target.value)},placeholder:"输入你记得的关键词"}),d?u.jsx(ys,{size:13,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"}):r&&u.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:()=>s(""),children:u.jsx(Bs,{size:13})})]})]}),!r.trim()&&u.jsxs("div",{className:"border-y border-border/15 py-10 text-center",children:[u.jsx(hh,{size:24,className:"mx-auto text-primary"}),u.jsx("p",{className:"mt-3 text-[13px] font-medium text-foreground",children:"找回之前做过的事"}),u.jsx("p",{className:"mx-auto mt-1 max-w-md text-[11px] leading-relaxed text-muted-foreground",children:"可以输入任务名、报错片段或目录名,例如“自动任务”“web-terminal”“构建失败”。搜索索引只保存在本机。"})]}),r.trim()&&!d&&o.length>0&&u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsxs("p",{className:"text-[11px] text-foreground",children:["显示 ",o.length," 个会话"]}),u.jsx("p",{className:"text-[9px] text-muted-foreground",children:"在线可打开 · 已关闭可恢复"})]}),u.jsx("div",{className:"divide-y divide-border/10 border-y border-border/10",children:o.map(y=>{const b=y.live||!!y.resumeHistoryId,v=y.live?"打开会话":y.resumeHistoryId?"恢复会话":"仅供查阅",T=u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-start gap-3",children:[u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("p",{className:"truncate text-[12px] font-medium text-foreground",children:y.title}),u.jsx("p",{className:"mt-0.5 truncate text-[9px] text-muted-foreground",children:y.cwd})]}),u.jsx("span",{className:`shrink-0 text-[10px] ${y.live?"text-[var(--success)]":y.resumeHistoryId?"text-primary":"text-muted-foreground"}`,children:v})]}),u.jsx("p",{className:"mt-2 line-clamp-3 text-[10px] leading-relaxed text-foreground/75",children:RU(y)||"匹配内容来自标题、目录或终端控制信息"}),u.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:[Qh(y.updatedAt)," · ",y.matchCount," 处匹配",b?"":" · 没有可恢复记录"]})]});return b?u.jsx("button",{onClick:()=>{g(y)},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:T},y.sessionId):u.jsx("article",{className:"px-2 py-3",children:T},y.sessionId)})}),r.trim()&&!d&&o.length===0&&u.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[u.jsxs("p",{className:"text-[12px] text-foreground",children:["没有找到“",r.trim(),"”"]}),u.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:"试试更短的关键词、目录名或报错中的一小段。"}),u.jsx("button",{className:`${gr} mt-3 bg-surface-2 text-foreground`,onClick:()=>s(""),children:"清空后重试"})]})]})}function Ph(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 RU(e){let t=Ph(e.snippet);for(const n of[e.title,e.cwd,e.agentSlug])n&&(t=t.split(n).join(" "));return Ph(t)}function MU(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(r=>`周${t[r]}`).join("、")} ${e.schedule.time}`}function NU(e,t=Date.now(),n=t){if(e.kind==="interval"){const o=e.everyMinutes*6e4,a=Math.max(0,t-n);return n+(Math.floor(a/o)+1)*o}const[r,s]=e.time.split(":").map(Number);for(let o=0;o<=7;o+=1){const a=new Date(t);if(a.setDate(a.getDate()+o),a.setHours(r,s,0,0),a.getTime()>t&&e.weekdays.includes(a.getDay()))return a.getTime()}return t}function Qh(e){return new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)}function DU(e){return e==="running"?"投递中":e==="success"?"已投递":e==="failed"?"投递失败":""}function BU(e){return e==="running"?"text-[var(--warning)]":e==="success"?"text-[var(--success)]":e==="failed"?"text-destructive":"text-muted-foreground"}function PU({text:e}){return u.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 QU(e,t){const n=new Set,r=[];for(const s of e){const o=Array.from(new Set(s.sessionIds)).filter(a=>t.has(a)&&!n.has(a));o.length<(s.federated?1:2)||(o.forEach(a=>n.add(a)),r.push({...s,sessionIds:o}))}return r}function tm(e,t){const n=new Set(e),r=t.filter(o=>o.sessionIds.length>=2&&o.sessionIds.every(a=>n.has(a))),s=new Set;return e.flatMap(o=>{const a=r.find(d=>d.sessionIds.includes(o));return a?s.has(a.id)?[]:(s.add(a.id),[{sessionIds:a.sessionIds,workspace:a}]):[{sessionIds:[o]}]})}function u0(e,t,n,r=[]){const s=new Map,o=new Map,a=new Set(e.map(g=>g.id));for(const g of r){const y=g.sessionIds.filter(v=>a.has(v));if(y.length<(g.federated?1:2))continue;const b=y.length===g.sessionIds.length?g:{...g,sessionIds:y};y.forEach(v=>s.set(v,b))}for(const g of t)if(!(g.sessionIds.length<2||!g.sessionIds.every(y=>a.has(y)))&&!g.sessionIds.some(y=>s.has(y)))for(const y of g.sessionIds)o.set(y,g);const d=new Set,h=new Set,p=[];for(const g of e){const y=s.get(g.id);if(y){if(d.has(y.id))continue;d.add(y.id);const T=y.sessionIds.flatMap(A=>{const L=n.get(A);return L?[L]:[]});p.push({kind:"collaboration",id:`collaboration:${y.id}`,group:y,members:T,sessionIds:y.sessionIds});continue}const b=o.get(g.id);if(!b){p.push({kind:"session",id:`session:${g.id}`,session:g,sessionIds:[g.id]});continue}if(h.has(b.id))continue;h.add(b.id);const v=b.sessionIds.flatMap(T=>{const A=n.get(T);return A?[A]:[]});p.push({kind:"workspace",id:`workspace:${b.id}`,workspace:b,members:v,sessionIds:b.sessionIds})}return p}function eb(e,t,n){const r=Math.min(e.length,Math.max(0,n)),s=e.slice(0,r).flatMap(a=>a.sessionIds.filter(d=>d!==t)),o=e.slice(r).flatMap(a=>a.sessionIds.filter(d=>d!==t));return[...s,t,...o]}function OU({status:e,detail:t,needsReview:n,inCopyMode:r}){return u.jsx(W$,{status:e,detail:t,needsReview:n,inCopyMode:r})}function tb({isOpen:e,drawerWidthPx:t,onClose:n,onOpen:r,sessions:s,activeSessionId:o,sessionStates:a,onNewSession:d,onCloseSession:h,onSplitSession:p,onCloseSplit:g,onRemoveFromSplit:y,splitWorkspaces:b,onSetSplitLayout:v,onReorderSplitWorkspace:T,onCombineSplitSessions:A,onReorderSessions:L,onSessionMenu:R,onOpenSettings:D,onOpenQuota:B,updateState:j,updateActionPending:P=!1,onConfirmUpdateRestart:$,onRetryUpdate:z,tmuxAvailable:H=!0,defaultSessionMode:ye="shell",push:q,pinned:te,runningSessionButtonEnabled:ve=!1,onRunningSessionButtonEnabledChange:ge,onTogglePinned:ie,recoverableTmuxSessions:Ae=[],recoverableTmuxSessionsLoading:xe=!1,onRefreshRecoverableTmuxSessions:ce}){const{t:K}=qn(),[be,Se]=S.useState(!1),[We,ue]=S.useState(null),[Ee,Tt]=S.useState(!1),[Rt,ze]=S.useState(!1),[X,rt]=S.useState(null),[qe,re]=S.useState([]),[J,$e]=S.useState(!1),[tt,gt]=S.useState(null),[pt,Ct]=S.useState(null),[Le,Te]=S.useState(null),[Oe,yt]=S.useState([]),[de,Pe]=S.useState({mode:ye}),{preference:ot,agents:zt,detecting:yn,refresh:at,selectAgent:bt}=wU(),It=S.useRef(null),kt=S.useRef(null),$t=!!(j?.latestVersion&&["installing","ready","restarting","error"].includes(j.status)),se=Et(Y=>Y.groupByFolder),Fe=Et(Y=>Y.collapsedGroups),Je=Et(Y=>Y.toggleGroupCollapsed),Ot=S.useRef(null),je=S.useRef(0),ut=S.useRef(!1),un=S.useRef(null),Be=S.useRef(null),[hr,jn]=S.useState(!1),Ne=S.useRef([]),Pn=S.useRef(null),dt=S.useRef(null),fr=S.useRef(new Set),In=S.useRef(null),Sr=S.useMemo(()=>new Set(b.flatMap(Y=>Y.sessionIds)),[b]),fn=S.useMemo(()=>new Map(s.map(Y=>[Y.id,Y])),[s]),Qn=S.useMemo(()=>QU(Oe,new Set(fn.keys())),[Oe,fn]),Br=S.useMemo(()=>new Set(Qn.flatMap(Y=>Y.sessionIds)),[Qn]),Rn=S.useCallback(async()=>{const Y=++je.current;try{const he=await Jb();if(Y!==je.current)return;yt(Array.isArray(he.groups)?he.groups:[])}catch{}},[]);S.useEffect(()=>{Rn();const Y=window.setInterval(()=>{Rn()},1e4),he=()=>{Rn()};return window.addEventListener("focus",he),()=>{je.current+=1,window.clearInterval(Y),window.removeEventListener("focus",he)}},[Rn]),S.useEffect(()=>{(e||!Rt)&&Rn()},[Rt,e,Rn]);const On=S.useCallback(()=>{Ne.current=Array.from(document.querySelectorAll("[data-collaboration-member], [data-collaboration-background]")).flatMap(Y=>{const he=Y.dataset.collaborationMember??"",Ke=Y.hasAttribute("data-collaboration-background"),_e=Y.closest("[data-collaboration-group]")?.dataset.collaborationGroup;if(!he&&!Ke||!_e)return[];const Ie=[];for(let Ge=Y.parentElement;Ge;Ge=Ge.parentElement)Ie.push({element:Ge,top:Ge.scrollTop,left:Ge.scrollLeft});return[{element:Y,sessionId:he,groupId:_e,background:Ke,rect:Y.getBoundingClientRect(),scrollParents:Ie}]})},[]),pe=S.useCallback((Y,he)=>{if(!ut.current)return;document.querySelectorAll("[data-split-exit-drop-index]").forEach(ct=>ct.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(ct=>ct.removeAttribute("data-drop-active"));const _e=document.elementsFromPoint(Y,he).map(ct=>ct.closest("[data-collaboration-background]")).find(Boolean)?.closest("[data-collaboration-group]");if(_e?.dataset.collaborationGroup){_e.dataset.dropActive="true",dt.current={kind:"collaboration",groupId:_e.dataset.collaborationGroup,background:!0};return}const Ie=Ne.current.find(ct=>{if(ct.sessionId===Be.current||!ct.element.isConnected)return!1;const Pt=ct.scrollParents.reduce((hn,Tn)=>hn+Tn.element.scrollLeft-Tn.left,0),Xt=ct.scrollParents.reduce((hn,Tn)=>hn+Tn.element.scrollTop-Tn.top,0);return Y>=ct.rect.left-Pt&&Y<=ct.rect.right-Pt&&he>=ct.rect.top-Xt+ct.rect.height*.25&&he<=ct.rect.bottom-Xt-ct.rect.height*.25});if(Ie?.background){Ie.element.closest("[data-collaboration-group]")?.setAttribute("data-drop-active","true"),dt.current={kind:"collaboration",groupId:Ie.groupId,background:!0};return}if(Ie&&!b.find(Pt=>Pt.sessionIds.includes(Ie.sessionId))?.sessionIds.includes(Be.current??"")){Ie.element.dataset.dropActive="true",dt.current={kind:"split",sessionId:Ie.sessionId,groupId:Ie.groupId};return}const Ge=document.elementsFromPoint(Y,he).filter(ct=>{const Pt=ct.closest("[data-rfd-draggable-id]");return!Pt||!["session:","split-member:","collaboration-member:"].some(Xt=>Pt.dataset.rfdDraggableId===`${Xt}${Be.current}`)}),lt=Ge.map(ct=>ct.closest("[data-collaboration-group]")).find(ct=>ct?.dataset.collaborationGroup);if(lt?.dataset.collaborationGroup){const ct=lt.dataset.collaborationGroup,Pt=Ge.map(Tn=>Tn.closest("[data-collaboration-split]")).find(Boolean),Xt=Ge.map(Tn=>Tn.closest("[data-collaboration-member]")).find(Boolean),hn=Xt?.dataset.collaborationMember??Pt?.dataset.splitAnchor;if(hn&&(ct!==un.current||!Xt&&Pt)){lt.dataset.dropActive="true";const Tn=Xt??Pt;Tn&&(Tn.dataset.dropActive="true"),dt.current={kind:"split",sessionId:hn,groupId:ct}}else{const Tn=Ge.some(br=>br.closest("[data-collaboration-background]"));(ct!==un.current||Tn)&&(lt.dataset.dropActive="true"),dt.current={kind:"collaboration",groupId:ct,background:Tn}}return}const Ze=Array.from(document.querySelectorAll("[data-sidebar-entity-list-id]")).filter(ct=>ct.dataset.sidebarEntityListId===Pn.current).find(ct=>{const Pt=ct.getBoundingClientRect();return Y>=Pt.left&&Y<=Pt.right&&he>=Pt.top-8&&he<=Pt.bottom+8});if(!Ze){dt.current=null;return}const it=Array.from(Ze.children).filter(ct=>ct instanceof HTMLElement&&ct.hasAttribute("data-sidebar-entity-index")),pn=it.findIndex(ct=>{const Pt=ct.getBoundingClientRect();return he<Pt.top+Pt.height/2}),vt=pn<0?it.length:pn;dt.current={kind:"list",listId:Ze.dataset.sidebarEntityListId??"",index:vt};const mn=Array.from(Ze.querySelectorAll(":scope > [data-sidebar-entity-index] > [data-split-exit-drop-index]")).find(ct=>ct.dataset.splitExitDropIndex===String(vt));mn instanceof HTMLElement&&(mn.dataset.active="true")},[b]);S.useEffect(()=>{const Y=Ke=>pe(Ke.clientX,Ke.clientY),he=Ke=>{const _e=Ke.touches[0];_e&&pe(_e.clientX,_e.clientY)};return window.addEventListener("pointermove",Y),window.addEventListener("touchmove",he,{passive:!0}),()=>{window.removeEventListener("pointermove",Y),window.removeEventListener("touchmove",he)}},[pe]);const tn=S.useCallback((Y,he)=>{try{Y(he)}finally{document.querySelectorAll("[data-sidebar-dragging]").forEach(Ke=>{delete Ke.dataset.sidebarDragging}),ut.current=!1,Ne.current=[],jn(!1),un.current=null,Be.current=null,Pn.current=null,dt.current=null,document.querySelectorAll("[data-split-exit-drop-index]").forEach(Ke=>Ke.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(Ke=>Ke.removeAttribute("data-drop-active"))}},[]),Ue=S.useMemo(()=>s.filter(Y=>!Sr.has(Y.id)),[s,Sr]),as=S.useMemo(()=>{let Y=0;for(const he of s)a.get(he.id)?.agentStatus==="working"&&(Y+=1);return Y},[s,a]);S.useEffect(()=>{e&&Ot.current?.scrollIntoView({block:"nearest",behavior:"smooth"})},[o,e,Ue.length,Fe]);const _s=S.useMemo(()=>{if(!se||!o)return null;const Y=a.get(o)?.cwd??null;return bp(Y)},[se,o,a]);S.useEffect(()=>{if(!se){In.current=null,fr.current.clear();return}if(!o){In.current=null;return}const Y=Et.getState(),he=fr.current,Ke=In.current,_e=_s;Ke!==null&&Ke!==_e&&he.has(Ke)&&(Y.collapsedGroups.has(Ke)||Y.toggleGroupCollapsed(Ke),he.delete(Ke)),_e!==null&&_e!==""&&Y.collapsedGroups.has(_e)&&(Y.toggleGroupCollapsed(_e),he.add(_e)),In.current=_e},[se,o,_s]),S.useEffect(()=>{e||(Se(!1),Tt(!1))},[e]),S.useEffect(()=>{Pe(Y=>({...Y,command:ot?.command}))},[ot]),S.useEffect(()=>{if(!Ee)return;let Y=!1;return $e(!0),Ct(null),f2().then(he=>{Y||re(he)}).catch(()=>{Y||Ct(K("sidebar.resumeHistoryLoadFailed"))}).finally(()=>{Y||$e(!1)}),()=>{Y=!0}},[Ee,K]),S.useEffect(()=>{if(!be)return;const Y=he=>{he instanceof KeyboardEvent&&he.key!=="Escape"||he instanceof MouseEvent&&he.target instanceof Node&&It.current?.contains(he.target)||Se(!1)};return window.addEventListener("mousedown",Y),window.addEventListener("keydown",Y),()=>{window.removeEventListener("mousedown",Y),window.removeEventListener("keydown",Y)}},[be]),S.useEffect(()=>{if(!We)return;const Y=he=>{he instanceof KeyboardEvent&&he.key!=="Escape"||he instanceof PointerEvent&&he.target instanceof Node&&kt.current?.contains(he.target)||ue(null)};return window.addEventListener("pointerdown",Y),window.addEventListener("keydown",Y),()=>{window.removeEventListener("pointerdown",Y),window.removeEventListener("keydown",Y)}},[We]);const $r=()=>{!q&&!te&&n()},Ls=ye==="tmux"&&!H?"shell":ye,ko=()=>{d({mode:Ls}),$r()},Jr=()=>{ot&&(d({mode:Ls,command:ot.command}),$r())},Ir=Y=>{Te(Y.name),d({mode:"tmux",tmuxSessionName:Y.name,cwd:Y.cwd??void 0}),$r()};S.useEffect(()=>{Le&&(Ae.some(Y=>Y.name===Le)||Te(null))},[Le,Ae]);const rr=Y=>{d({...de,cwd:de.cwd?.trim()||void 0,command:Y?.command}),Tt(!1),$r()},sr=async Y=>{gt(Y.id),Ct(null);try{const he=await qb(Y.id);d({mode:"shell",cwd:he.cwd,command:he.command}),Tt(!1),$r()}catch(he){const Ke=he&&typeof he=="object"&&"code"in he?String(he.code??""):"";Ct(K(Ke==="AGENT_SESSION_ACTIVE_ELSEWHERE"?"tab.resumeAgentConflict":"sidebar.resumeHistoryFailed"))}finally{gt(null)}},ri=async Y=>{re(he=>he.filter(Ke=>Ke.id!==Y));try{await NT(Y)}catch{Ct(K("sidebar.resumeHistoryRemoveFailed")),f2().then(re).catch(()=>{})}},nr=()=>{if(Ee){Tt(!1);return}Pe({mode:ye==="tmux"&&!H?"shell":ye,cwd:o?a.get(o)?.cwd??void 0:void 0,command:ot?.command}),Tt(!0)},Yn=S.useCallback(Y=>{const he=a.get(Y);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},[a]),dn=X6(),Sn=S.useCallback((Y,he,Ke,_e)=>{const Ie=Y.id===o,Ge=Sr.has(Y.id),lt=!!(Ke&&Ge),et=a.get(Y.id),Ze=Oa(et?.cwd??null),it=et?.shellTitle??ZS(Y.id),pn=it===et?.cwd||it===Ze?null:it,vt=oM(Y,et?.activeProgram??null,null,Dg,pn,et?.promptState??null),mn=!!(et?.tuiProgress&&et.tuiProgress.state!=="remove"),Pt=et?.promptState==="running"||et?.agentStatus==="working"||mn?"bg-[var(--success)]":et?.agentStatus==="waiting"||et?.agentNeedsReview?"bg-[var(--warning)]":et?.inCopyMode?"bg-[var(--tmux)]":"bg-primary";return u.jsxs(u.Fragment,{children:[u.jsxs("button",{ref:Ie?Ot:null,type:"button",...he??{},onContextMenu:Xt=>{R&&(Xt.preventDefault(),R(Y.id,{x:Xt.clientX,y:Xt.clientY}))},onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:Y.id})),$r()},className:`sidebar-session-primary relative min-w-0 flex flex-1 items-center overflow-hidden text-left ${he?"cursor-grab active:cursor-grabbing ":""}${Ke?"gap-1.5 py-0.5 pl-1.5 pr-0.5":"gap-1.5 py-1 pl-2 pr-1"}`,title:et?.cwd??Y.name,children:[Ie&&u.jsx("span",{className:`absolute inset-y-2 left-0 w-0.5 rounded-full ${Pt}`}),u.jsxs("span",{className:`relative inline-flex shrink-0 items-center justify-center rounded-md ${Ke?"h-5 w-[22px]":"h-[22px] w-[22px]"} ${Ie?Y.mode==="tmux"?"bg-[rgb(var(--tmux-rgb)_/_0.15)] text-[color:var(--tmux)]":"bg-primary/15 text-primary":Y.mode==="tmux"?"bg-surface text-[rgb(var(--tmux-rgb)_/_0.80)]":"bg-surface text-muted-foreground"}`,children:[et?.isConnecting||mn&&!et?.agentStatus?u.jsx(Xn,{size:Ke?10:11,className:"animate-spin"}):et?.agent??k2(Y.id)?u.jsx(dc,{agent:et?.agent??k2(Y.id),size:Ke?13:15}):Y.mode==="tmux"?u.jsx(fu,{size:Ke?10:11}):u.jsx(pa,{size:Ke?10:11}),u.jsx(OU,{status:et?.agentStatus??null,detail:et?.agentStatusDetail,needsReview:et?.agentNeedsReview,inCopyMode:et?.inCopyMode})]}),u.jsx("span",{className:`min-w-0 flex-1 truncate leading-tight ${Ke?"text-[11px]":"text-[12px]"} ${Ie?"font-medium text-foreground":""} ${et?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:vt})]}),_e,u.jsx("button",{type:"button",onClick:Xt=>{Xt.stopPropagation(),lt?y(Y.id):Ge?g(Y.id):p(Y.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 ${Ke?"h-6 w-6":"h-[26px] w-[26px]"} ${Ge?"bg-primary/15 text-primary":"text-muted-foreground/70"}`,"aria-label":`${K(lt?"tab.splitRemovePane":Ge?"tab.splitClose":"tab.split")} ${vt}`,title:K(lt?"tab.splitRemovePane":Ge?"tab.splitClose":"tab.split"),children:lt?u.jsx(yL,{size:11}):u.jsx(ic,{size:12})}),u.jsx("button",{type:"button",onClick:Xt=>{Xt.stopPropagation(),h(Y.id,Xt)},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 ${Ke?"h-6 w-6":"h-[26px] w-[26px]"}`,"aria-label":K("sidebar.closeSession",{name:vt}),title:K("common.close"),children:u.jsx(Bs,{size:Ke?11:12})})]})},[o,Sr,a,h,p,g,y,R,K]),an=S.useMemo(()=>{if(!se)return[];const Y=Bg(s,_e=>a.get(_e.id)?.cwd??null,K("sidebar.ungrouped")),he=new Map,Ke=new Set;for(const _e of b){if(_e.sessionIds.some(et=>Br.has(et)))continue;const Ie=_e.sessionIds[0];if(!Ie)continue;const Ge=bp(a.get(Ie)?.cwd??null),lt=he.get(Ge)??new Set;_e.sessionIds.forEach(et=>{lt.add(et),Ke.add(et)}),he.set(Ge,lt)}for(const _e of Qn){const Ie=_e.sessionIds[0];if(!Ie)continue;const Ge=bp(a.get(Ie)?.cwd??null),lt=he.get(Ge)??new Set;_e.sessionIds.forEach(et=>lt.add(et)),he.set(Ge,lt)}return Y.flatMap(_e=>{const Ie=new Set(_e.sessions.filter(lt=>!Ke.has(lt.id)&&!Br.has(lt.id)).map(lt=>lt.id));he.get(_e.key)?.forEach(lt=>Ie.add(lt));const Ge=s.filter(lt=>Ie.has(lt.id));return Ge.length>0?[{..._e,sessions:Ge}]:[]})},[Qn,Br,se,s,a,b,K]),bn=S.useMemo(()=>u0(s,b,fn,Qn),[Qn,s,fn,b]),Pr=S.useCallback(Y=>{jn(Y.draggableId.startsWith("collaboration:")||Y.draggableId.startsWith("workspace:"));const he=Y.draggableId.replace(/^split-member:/,"");Be.current=Y.draggableId.replace(/^(?:session|split-member|collaboration-member):/,"");const Ke=Y.type==="split-member"?b.find(et=>et.sessionIds.includes(he)):null,_e=Y.type==="collaboration-member"?Y.source.droppableId.replace(/^collaboration-members:/,""):null,Ie=_e?Qn.find(et=>et.id===_e):null;ut.current=!!(Ke||Ie||Y.type==="session"&&Y.draggableId.startsWith("session:")),ut.current&&document.querySelectorAll("[data-collaboration-group]").forEach(et=>{et.dataset.sidebarDragging="true"}),un.current=Ie?.id??null;const Ge=Ke?.sessionIds??Ie?.sessionIds??[],lt=Ge.length>0?an.find(et=>Ge.every(Ze=>et.sessions.some(it=>it.id===Ze))):null;Pn.current=se?lt?`group-sessions:${lt.key}`:null:Ge.length>0?"sidebar-entities":null,dt.current=null},[Qn,an,se,b]),Ht=S.useCallback((Y,he,Ke)=>{if(he===Ke)return;const _e=he?Oe.find(Ze=>Ze.id===he):null,Ie=Ke?Oe.find(Ze=>Ze.id===Ke):null;if(Ke&&!Ie)return;if(Ie){const Ze=s.map(pn=>pn.id).filter(pn=>pn!==Y);let it=-1;Ze.forEach((pn,vt)=>{Ie.sessionIds.includes(pn)&&(it=vt)}),it>=0&&(Ze.splice(it+1,0,Y),L(Ze))}const Ge=_e?.sessionIds.filter(Ze=>Ze!==Y)??[],lt=Ie?[...Ie.sessionIds.filter(Ze=>Ze!==Y),Y]:[];yt(Ze=>Ze.flatMap(it=>it.id===he?Ge.length>=2?[{...it,sessionIds:Ge}]:[]:it.id===Ke?[{...it,sessionIds:lt}]:[it]));const et=[];_e&&et.push(Ge.length>=2?T0({id:_e.id,name:_e.name,sessionIds:Ge}):e3(_e.id)),Ie&&et.push(T0({id:Ie.id,name:Ie.name,sessionIds:lt})),Promise.all(et).then(()=>Rn(),()=>Rn())},[Oe,Rn,s,L]),Cr=S.useCallback((Y,he,Ke)=>{const _e=Oe.find(Ze=>Ze.id===Y);if(!_e||he===Ke)return;const Ie=_e.sessionIds.filter(Ze=>!Ze.startsWith("remote:")),Ge=tm(Ie,b).flatMap(Ze=>Ze.sessionIds),[lt]=Ge.splice(he,1);if(!lt)return;Ge.splice(Ke,0,lt);const et=b.find(Ze=>Ze.sessionIds.includes(lt));if(et&&et.sessionIds.every(Ze=>_e.sessionIds.includes(Ze))){const Ze=Ge.filter(it=>et.sessionIds.includes(it));T(et.id,Ze)}Ge.push(..._e.sessionIds.filter(Ze=>Ze.startsWith("remote:"))),yt(Ze=>Ze.map(it=>it.id===Y?{...it,sessionIds:Ge}:it)),T0({id:_e.id,name:_e.name,sessionIds:Ge}).then(()=>Rn(),()=>Rn())},[Oe,Rn,b,T]),ln=S.useCallback(Y=>{if(Y.type!=="collaboration-member")return!1;if(Y.reason==="CANCEL")return!0;const he=Y.source.droppableId.replace(/^collaboration-members:/,""),Ke=Y.draggableId.replace(/^collaboration-member:/,""),_e=dt.current;if(_e?.kind==="split")return Ht(Ke,he,_e.groupId),A(_e.sessionId,Ke),!0;if(_e?.kind==="collaboration"&&_e.groupId!==he)return Ht(Ke,he,_e.groupId),!0;if(_e?.kind==="collaboration"&&_e.background)return Sr.has(Ke)&&y(Ke),!0;if(Y.destination&&Y.destination.droppableId!==Y.source.droppableId){const Ie=Y.destination.droppableId.replace(/^collaboration-members:/,"");if(Qn.some(Ge=>Ge.id===Ie))return Ht(Ke,he,Ie),!0}if(Y.combine){const Ie=Y.combine.droppableId.replace(/^collaboration-members:/,"");Ie!==he&&Ht(Ke,he,Ie);const Ge=Y.combine.draggableId.replace(/^collaboration-member:/,"");if(b.find(et=>et.sessionIds.includes(Ke))?.sessionIds.includes(Ge)){const et=Qn.find(it=>it.id===he),Ze=et?tm(et.sessionIds,b).flatMap(it=>it.sessionIds).indexOf(Ge):-1;Ze>=0&&Cr(he,Y.source.index,Ze)}else fn.has(Ge)&&A(Ge,Ke);return!0}if(Y.destination?.droppableId===Y.source.droppableId)return Cr(he,Y.source.index,Y.destination.index),!0;if(_e?.kind!=="list")return!0;if(_e?.kind==="list"){const Ie=an.find(lt=>`group-sessions:${lt.key}`===_e.listId),Ge=_e.listId==="sidebar-entities"?bn:Ie?u0(Ie.sessions,b,fn,Qn):null;if(Ge){const lt=eb(Ge,Ke,_e.index);_e.listId==="sidebar-entities"?L(lt):Ie&&L(an.flatMap(et=>et.key===Ie.key?lt:et.sessions.map(Ze=>Ze.id)))}}return Ht(Ke,he,null),!0},[Qn,bn,an,Ht,L,Cr,fn,b,Sr,y,A]),Ur=S.useCallback(Y=>{if(Y.type!=="split-member")return!1;if(Y.reason==="CANCEL")return!0;const he=Y.draggableId.replace(/^split-member:/,""),Ke=b.find(Ze=>Ze.sessionIds.includes(he));if(!Ke?.sessionIds.includes(he))return!0;const _e=Ke.id,Ie=dt.current;if(Ie?.kind==="split")return Ht(he,null,Ie.groupId),A(Ie.sessionId,he),!0;if(Ie?.kind==="collaboration")return Ht(he,null,Ie.groupId),!0;if(!Y.destination&&Ie?.kind==="list"){const Ze=an.find(vt=>`group-sessions:${vt.key}`===Ie.listId),it=Ie.listId==="sidebar-entities"?bn:Ze?u0(Ze.sessions,b,fn,Qn):null;if(!it)return!0;const pn=eb(it,he,Ie.index);return y(he),Ie.listId==="sidebar-entities"?L(pn):Ze&&L(an.flatMap(vt=>vt.key===Ze.key?pn:vt.sessions.map(mn=>mn.id))),!0}if(!Y.destination)return!0;const Ge=Y.destination.droppableId.replace(/^split-members:/,"");if(Ge!==_e){const it=b.find(pn=>pn.id===Ge)?.sessionIds[0];return it&&A(it,he),!0}if(Y.source.index===Y.destination.index)return!0;const lt=[...Ke.sessionIds],[et]=lt.splice(Y.source.index,1);return et&&(lt.splice(Y.destination.index,0,et),T(_e,lt)),!0},[Qn,bn,an,Ht,A,y,L,T,fn,b]),Os=(Y,he="top")=>u.jsx("div",{"data-split-exit-drop-index":Y,className:`group/split-exit pointer-events-none absolute inset-x-0 z-10 h-2 ${he==="top"?"-top-1":"-bottom-1"}`,children:u.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"})}),ls=S.useCallback((Y,he,Ke)=>{if(ln(Y)||Ur(Y)||Y.reason==="CANCEL")return;const _e=he.find(Ze=>Ze.id===Y.draggableId);if(!_e)return;const Ie=dt.current;if(Ie?.kind==="split"&&_e.kind==="session"){Ht(_e.session.id,null,Ie.groupId),A(Ie.sessionId,_e.session.id);return}if(Ie?.kind==="collaboration"&&_e.kind==="session"){Ht(_e.session.id,null,Ie.groupId);return}if(Y.combine&&_e.kind!=="session"){const Ze=he.findIndex(it=>it.id===Y.combine?.draggableId);if(Ze<0)return;Y={...Y,combine:null,destination:{...Y.source,index:Ze}}}if(Y.combine){const Ze=he.find(ct=>ct.id===Y.combine?.draggableId);if(!Ze)return;const it=Ze.kind==="workspace"?Ze:_e.kind==="workspace"?_e:Ze,pn=it===_e?Ze:_e,vt=it.sessionIds[0],mn=pn.sessionIds[0];vt&&mn&&vt!==mn&&A(vt,mn);return}if(!Y.destination||Y.source.index===Y.destination.index)return;const Ge=[...he],[lt]=Ge.splice(Y.source.index,1);if(!lt)return;Ge.splice(Y.destination.index,0,lt);const et=Ge.flatMap(Ze=>Ze.sessionIds);if(Ke===void 0){L(et);return}L(an.flatMap(Ze=>Ze.key===Ke?et:Ze.sessions.map(it=>it.id)))},[an,ln,Ur,Ht,A,L]),yr=S.useCallback(Y=>{if(Y.reason==="CANCEL"||ln(Y)||Ur(Y))return;if(Y.type==="group"){if(!Y.destination||Y.source.index===Y.destination.index)return;L(sv(an,Y.source.index,Y.destination.index));return}const he=Y.source.droppableId.replace(/^group-sessions:/,""),Ke=an.find(Ie=>Ie.key===he);if(!Ke)return;const _e=u0(Ke.sessions,b,fn,Qn);if(Y.combine||dt.current?.kind==="collaboration"||dt.current?.kind==="split"){ls(Y,_e,he);return}!Y.destination||Y.destination.droppableId!==Y.source.droppableId||ls(Y,_e,he)},[Qn,an,fn,b,ln,ls,Ur,L]),ks=Y=>{const he=We===Y.id,Ke=[{layout:"horizontal",label:K("tab.splitHorizontal"),icon:ic},{layout:"vertical",label:K("tab.splitVertical"),icon:D2},...Y.sessionIds.length>=3||Y.layout==="grid"?[{layout:"grid",label:K("tab.splitGrid"),icon:M2}]:[]],_e=Y.layout==="vertical"?D2:Y.layout==="grid"?M2:ic,Ie=Ke.find(Ge=>Ge.layout===Y.layout)?.label??K("tab.splitHorizontal");return u.jsxs("div",{ref:he?kt:void 0,className:"relative shrink-0",onPointerDown:Ge=>Ge.stopPropagation(),children:[u.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":`${K("tab.splitLayout")}: ${Ie}`,"aria-haspopup":"menu","aria-expanded":he,title:K("tab.splitLayout"),onClick:Ge=>{Ge.stopPropagation(),ue(lt=>lt===Y.id?null:Y.id)},children:u.jsx(_e,{size:12})}),he&&u.jsx("div",{role:"menu","aria-label":K("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:Ke.map(Ge=>{const lt=Ge.icon,et=Ge.layout===Y.layout;return u.jsx("button",{type:"button",role:"menuitemradio","aria-checked":et,"aria-label":Ge.label,title:Ge.label,className:`sidebar-session-action inline-flex h-7 w-7 items-center justify-center rounded-sm transition active:scale-95 ${et?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,onClick:Ze=>{Ze.stopPropagation(),v(Y.sessionIds[0],Ge.layout),ue(null)},children:u.jsx(lt,{size:13})},Ge.layout)})})]})},$n=(Y,he)=>he&&u.jsx("button",{type:"button",...he,"aria-label":Y,title:Y,onClick:Ke=>Ke.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:u.jsx(T_,{size:10})}),cs=(Y,he,Ke=!1,_e=!1,Ie)=>{if(he.length<2)return null;const Ge=he.some(vt=>vt.id===o),lt=[],et=[],Ze=[];for(const vt of he){const mn=a.get(vt.id);mn?.agentStatus==="waiting"||mn?.agentNeedsReview?lt.push(vt):mn?.agentStatus==="working"?et.push(vt):mn?.inCopyMode&&Ze.push(vt)}const it=Y.name?.trim()||`${K("tab.splitWorkspace")} ${b.findIndex(vt=>vt.id===Y.id)+1}`,pn=We===Y.id;return u.jsxs("section",{"data-split-workspace":Y.id,"aria-label":it,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 ${_e?"bg-primary/15 ring-1 ring-primary/40":Ke?"bg-surface-elevated opacity-90 shadow-lg":lt.length>0?"bg-[rgb(var(--warning-rgb)_/_0.08)] hover:bg-[rgb(var(--warning-rgb)_/_0.12)]":et.length>0?"bg-[rgb(var(--success-rgb)_/_0.06)] hover:bg-[rgb(var(--success-rgb)_/_0.10)]":Ze.length>0?"bg-[rgb(var(--tmux-rgb)_/_0.07)] hover:bg-[rgb(var(--tmux-rgb)_/_0.11)]":Ge?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[$n(`移动分屏组 ${it}`,Ie),u.jsx(sl,{droppableId:`split-members:${Y.id}`,type:"split-member",direction:"vertical",children:(vt,mn)=>u.jsxs("div",{ref:vt.innerRef,...vt.droppableProps,"data-split-members":!0,className:mn.isDraggingOver?"rounded-sm bg-primary/10 ring-1 ring-primary/40":"",children:[he.map((ct,Pt)=>u.jsx(rl,{draggableId:`split-member:${ct.id}`,index:Pt,disableInteractiveElementBlocking:!0,children:(Xt,hn)=>u.jsx("div",{ref:Xt.innerRef,...Xt.draggableProps,...R?dn(()=>R(ct.id)):{},className:`${Pt===0&&pn?"relative z-20 ":"relative "}flex items-center rounded-sm pr-0.5 transition-colors ${hn.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${Yn(ct.id)??(ct.id===o?"bg-surface-elevated/80 text-foreground":"text-muted-foreground hover:bg-surface-2")}`,children:Sn(ct,Xt.dragHandleProps,!0,Pt===0?ks(Y):void 0)})},ct.id)),vt.placeholder]})})]})},si=(Y,he,Ke,_e=!1,Ie=!1)=>{if(he.length<(Y.federated?1:2))return null;const Ge=he.some(it=>it.id===o),lt=tm(Y.sessionIds,b),et=lt.flatMap(it=>it.sessionIds),Ze=lt.length===1?lt[0]?.workspace:void 0;return u.jsxs("section",{"data-collaboration-group":Y.id,"data-collaboration-group-name":Y.name,"aria-label":`Agent 工作组:${Y.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 ${Ie?"bg-primary/15 ring-1 ring-primary/40":_e?"bg-surface-elevated opacity-90 shadow-lg":Ge?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[$n(`移动工作组 ${Y.name}`,Ke),u.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:`打开 ${Y.name} 的协作消息`,"aria-label":`打开 Agent 工作组消息:${Y.name}`,onClick:it=>{it.stopPropagation(),rt(Y.id),ze(!0)},children:u.jsx(P2,{size:9})}),u.jsx(sl,{droppableId:`collaboration-members:${Y.id}`,type:"collaboration-member",direction:"vertical",isCombineEnabled:!0,children:(it,pn)=>u.jsxs("div",{ref:it.innerRef,...it.droppableProps,"data-collaboration-members":!0,className:`${pn.isDraggingOver?"rounded-sm bg-primary/10":""}`,children:[lt.map(vt=>u.jsx("div",{"data-collaboration-split":vt.workspace?.id,"data-split-anchor":vt.workspace?.sessionIds[0],role:vt.workspace?"region":void 0,"aria-label":vt.workspace?`${K("tab.splitWorkspace")} · ${vt.sessionIds.length}`:void 0,className:vt.workspace&&!Ze?`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 ${vt.sessionIds.includes(o??"")?"bg-primary/[0.07]":"bg-surface/35"}`:void 0,children:vt.sessionIds.map(mn=>{const ct=fn.get(mn);return ct?u.jsx(rl,{draggableId:`collaboration-member:${ct.id}`,index:et.indexOf(ct.id),disableInteractiveElementBlocking:!0,children:(Pt,Xt)=>u.jsxs("div",{ref:Pt.innerRef,...Pt.draggableProps,"data-collaboration-member":ct.id,"data-split-member":Sr.has(ct.id)?"true":void 0,...R?dn(()=>R(ct.id)):{},className:`${vt.workspace&&mn===vt.sessionIds[0]&&We===vt.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 ${Xt.combineTargetFor?"bg-primary/15 ring-1 ring-primary/40 ":Xt.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${Yn(ct.id)??(ct.id===o?"bg-surface-elevated/80 text-foreground":Sr.has(ct.id)?"bg-primary/[0.05] text-muted-foreground hover:bg-primary/[0.09]":"text-muted-foreground hover:bg-surface-2")}`,children:[Sn(ct,Pt.dragHandleProps,!0,vt.workspace&&mn===vt.sessionIds[0]?ks(vt.workspace):void 0),!vt.workspace&&Sr.has(ct.id)&&u.jsx("button",{type:"button",className:"shrink-0 px-1 text-[10px] text-primary",title:`与 ${b.find(hn=>hn.sessionIds.includes(ct.id))?.sessionIds.filter(hn=>hn!==ct.id).map(hn=>fn.get(hn)?.name??hn).join("、")} 分屏`,"aria-label":`查看 ${ct.name} 的跨组分屏`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:ct.id})),$r()},children:u.jsx(ic,{size:10})})]})},ct.id):null})},vt.workspace?.id??vt.sessionIds[0])),it.placeholder]})}),Y.remoteSessions?.map(it=>u.jsxs("button",{type:"button",title:`${it.serviceLabel??it.serviceOrigin} · ${it.serviceConnected===!1?"服务不可达,消息尚未送达":it.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:()=>{window.termdockDesktop?.collaborationFocus?.(it.sessionId).then(pn=>{pn||(rt(Y.id),ze(!0))})},children:[u.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${it.serviceConnected===!1?"bg-muted-foreground":"bg-primary"}`}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:it.name}),u.jsx("span",{className:"max-w-20 truncate rounded border border-border/20 px-1 text-[9px]",children:it.serviceLabel??it.serviceOrigin}),it.serviceConnected===!1&&u.jsx("span",{className:"shrink-0 text-[9px]",children:"不可达"})]},it.sessionId)),u.jsx("div",{"data-collaboration-background":!0,className:"relative h-1.5",title:`工作组:${Y.name}`,children:u.jsx("span",{className:"absolute inset-x-0 bottom-0 z-20 hidden rounded-sm bg-surface-elevated px-2 py-1 text-[10px] text-muted-foreground group-data-[sidebar-dragging=true]/collaboration:block",children:"拖入工作组 · 在此移出分屏"})})]})},uo=(Y,he,Ke)=>u.jsx(Rh,{onBeforeCapture:On,onDragStart:Pr,onDragEnd:_e=>tn(Ie=>ls(Ie,Y,Ke),_e),children:u.jsx(sl,{droppableId:he,direction:"vertical",isCombineEnabled:!hr,children:_e=>u.jsxs("div",{ref:_e.innerRef,..._e.droppableProps,"data-sidebar-entity-list-id":he,className:"space-y-0.5",children:[Y.map((Ie,Ge)=>u.jsx(rl,{draggableId:Ie.id,index:Ge,disableInteractiveElementBlocking:!0,children:(lt,et)=>u.jsxs("div",{ref:lt.innerRef,...lt.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":Ge,className:"relative",children:[Os(Ge),Ge===Y.length-1&&Os(Y.length,"bottom"),Ie.kind==="workspace"?cs(Ie.workspace,Ie.members,et.isDragging,!!et.combineTargetFor,lt.dragHandleProps):Ie.kind==="collaboration"?si(Ie.group,Ie.members,lt.dragHandleProps,et.isDragging,!!et.combineTargetFor):u.jsx("div",{...R?dn(()=>R(Ie.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${et.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":et.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":Yn(Ie.session.id)??(Ie.session.id===o?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:Sn(Ie.session,lt.dragHandleProps)})]})},Ie.id)),_e.placeholder]})})}),es=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"shrink-0 border-b border-border/15 px-2 py-2",children:u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("div",{className:"min-w-0 flex-1 px-1",children:u.jsxs("div",{className:"flex items-baseline gap-1.5",children:[u.jsx("span",{className:"text-[13px] font-semibold text-foreground",children:K("sidebar.sessions")}),u.jsx("span",{className:"text-[11px] text-muted-foreground",children:s.length}),as>0&&u.jsx("span",{className:"ml-1 flex items-center gap-1.5",children:u.jsx(mw,{count:as,tone:"running",title:K("agent.aiRunning")})})]})}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.jsxs("div",{ref:It,className:be?"relative z-20":"relative",children:[u.jsxs("button",{type:"button",onClick:()=>Se(Y=>!Y),className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition active:scale-95 ${be?"bg-surface-elevated text-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-expanded":be,"aria-haspopup":"menu","aria-label":$t&&j?.latestVersion?`${K("sidebar.moreActions")}: ${K("sidebar.updateAvailable",{version:j.latestVersion})}`:K("sidebar.moreActions"),title:$t&&j?.latestVersion?`${K("sidebar.moreActions")}: ${K("sidebar.updateAvailable",{version:j.latestVersion})}`:K("sidebar.moreActions"),children:[u.jsx(N0,{size:15}),$t&&u.jsx("span",{className:"absolute right-0.5 top-0.5 z-10 h-2 w-2 rounded-full bg-[var(--warning)] ring-2 ring-[var(--chrome-bg)]","aria-hidden":"true"})]}),be&&u.jsxs("div",{role:"menu",className:"absolute right-0 top-[calc(100%+4px)] z-30 w-60 overflow-hidden 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:[$t&&j?.latestVersion&&u.jsxs("div",{className:"mb-1 rounded-lg bg-[rgb(var(--warning-rgb)_/_0.10)] px-2.5 py-2.5 text-foreground",children:[u.jsxs("div",{className:"flex items-start gap-2",children:[u.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:u.jsx(ys,{size:13,className:j.status==="installing"||j.status==="restarting"?"animate-spin":""})}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block font-semibold",children:K("sidebar.updateAvailable",{version:j.latestVersion})}),u.jsx("span",{className:"mt-0.5 block text-[10.5px] leading-relaxed text-muted-foreground",children:j.status==="installing"?K("sidebar.updateInstalling"):j.status==="ready"?K("sidebar.updateReady"):j.status==="restarting"?K("sidebar.updateRestarting"):K("sidebar.updateFailed")})]})]}),j.status==="ready"&&$&&u.jsx("button",{type:"button",role:"menuitem",disabled:P,onClick:$,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:K("sidebar.updateRestart")}),j.status==="error"&&z&&u.jsx("button",{type:"button",role:"menuitem",disabled:P,onClick:z,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:K("sidebar.updateRetry")})]}),ge&&u.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":ve,onClick:()=>ge(!ve),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:K("sidebar.runningSessionButtonHint"),children:[u.jsx(Xn,{size:14,className:ve?"text-[color:var(--success)]":"text-muted-foreground"}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block",children:K("sidebar.runningSessionButton")}),u.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:K("sidebar.runningSessionButtonHint")})]}),u.jsx(nl,{checked:ve,size:"sm"})]}),B&&u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Se(!1),B()},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:[u.jsx(jC,{size:14,className:"text-muted-foreground"}),u.jsx("span",{children:K("sidebar.subscriptionQuota")})]}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Se(!1),rt(null),ze(!0)},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:[u.jsx(P2,{size:14,className:"text-muted-foreground"}),u.jsx("span",{children:"Agent 工作台"})]}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Se(!1),D()},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:[u.jsx(aL,{size:14,className:"text-muted-foreground"}),u.jsx("span",{children:K("sidebar.settings")})]}),ie&&u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Se(!1),ie()},className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left transition ${te?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,children:[te?u.jsx(B0,{size:14}):u.jsx(D0,{size:14,className:"text-muted-foreground"}),u.jsx("span",{children:K(te?"sidebar.unpinSidebar":"sidebar.pinSidebar")})]})]})]}),(!q||te)&&u.jsx("button",{type:"button",onClick:n,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 active:scale-95","aria-label":K("common.close"),children:u.jsx(Bs,{size:14})})]})]})}),u.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 py-1.5",children:[Ae.length>0&&u.jsxs("section",{className:"mb-2 rounded-lg bg-[rgb(var(--tmux-rgb)_/_0.07)] p-1","aria-label":K("sidebar.recoverableSessions"),children:[u.jsxs("div",{className:"flex min-h-8 items-center gap-2 px-2 text-[10.5px] font-semibold text-[color:var(--tmux)]",children:[u.jsx(Kc,{size:12,className:"shrink-0"}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:K("sidebar.recoverableSessions")}),u.jsx("span",{className:"text-muted-foreground",children:Ae.length}),ce&&u.jsx("button",{type:"button",onClick:ce,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":K("sidebar.refreshRecoverableSessions"),title:K("sidebar.refreshRecoverableSessions"),children:u.jsx(ys,{size:11,className:xe?"animate-spin":""})})]}),u.jsx("div",{className:"space-y-0.5",children:Ae.slice(0,4).map(Y=>{const he=Y.friendlyName?.trim()||Y.label?.trim()||Y.name,Ke=Oa(Y.cwd??null),_e=Le===Y.name;return u.jsxs("button",{type:"button",disabled:Le!==null,onClick:()=>Ir(Y),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":K("sidebar.restoreRecoverableSession",{name:he}),title:Y.cwd||Y.name,children:[u.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:_e?u.jsx(Xn,{size:12,className:"animate-spin"}):u.jsx(fu,{size:12})}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block truncate text-[11.5px] font-semibold text-foreground",children:he}),u.jsx("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[Y.program,Ke].filter(Boolean).join(" · ")||`tmux:${Y.name}`})]}),u.jsx("span",{className:"shrink-0 text-[10px] font-medium text-[color:var(--tmux)] group-hover:text-foreground",children:K(_e?"sidebar.restoringRecoverableSession":"sidebar.restore")})]},Y.name)})})]}),s.length===0?u.jsxs("div",{className:"rounded-xl bg-surface-2/60 px-4 py-8 text-center",children:[u.jsx(pa,{size:26,className:"mx-auto mb-2 text-muted-foreground"}),u.jsx("p",{className:"text-[12px] text-muted-foreground",children:K("sidebar.noSessions")})]}):Ue.length===0&&b.length===0?u.jsx("div",{className:"rounded-xl bg-surface-2/60 px-4 py-6 text-center",children:u.jsx("p",{className:"text-[12px] text-muted-foreground",children:K("sidebar.noMatchingSessions")})}):se?u.jsx("div",{className:"space-y-1.5",children:u.jsx(Rh,{onBeforeCapture:On,onDragStart:Pr,onDragEnd:Y=>tn(yr,Y),children:u.jsx(sl,{droppableId:"sidebar-groups",type:"group",direction:"vertical",children:Y=>u.jsxs("div",{ref:Y.innerRef,...Y.droppableProps,className:"space-y-1.5",children:[an.map((he,Ke)=>{const _e=Fe.has(he.key),Ie=u0(he.sessions,b,fn,Qn);let Ge=0,lt=0;for(const Ze of he.sessions){const it=a.get(Ze.id);it?.agentStatus==="working"&&(Ge+=1),(it?.agentStatus==="waiting"||it?.agentNeedsReview)&&(lt+=1)}const et=he.key==="";return u.jsx(rl,{draggableId:`sidebar-group:${he.key||"__ungrouped__"}`,index:Ke,isDragDisabled:et,disableInteractiveElementBlocking:!0,children:(Ze,it)=>u.jsxs("div",{ref:Ze.innerRef,...Ze.draggableProps,className:`rounded-md transition-colors ${it.isDragging?"bg-surface-elevated shadow-lg opacity-90":""}`,children:[u.jsxs("button",{type:"button",...et?{}:Ze.dragHandleProps,onClick:()=>{Je(he.key),fr.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 ${et?"":"cursor-grab active:cursor-grabbing"}`,title:he.key||he.label,children:[u.jsx(Vh,{size:13,className:`shrink-0 transition-transform ${_e?"":"rotate-90"}`}),u.jsx("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold uppercase tracking-wide",children:he.label}),Ge>0&&u.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)] animate-pulse"}),lt>0&&u.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] animate-pulse"}),u.jsx("span",{className:"shrink-0 text-[10.5px] text-muted-foreground/70",children:he.sessions.length})]}),!_e&&u.jsx("div",{className:"mt-0.5 pl-2",children:u.jsx(sl,{droppableId:`group-sessions:${he.key}`,type:"session",direction:"vertical",isCombineEnabled:!hr,children:pn=>u.jsxs("div",{ref:pn.innerRef,...pn.droppableProps,"data-sidebar-entity-list-id":`group-sessions:${he.key}`,className:"space-y-0.5",children:[Ie.map((vt,mn)=>u.jsx(rl,{draggableId:vt.id,index:mn,disableInteractiveElementBlocking:!0,children:(ct,Pt)=>u.jsxs("div",{ref:ct.innerRef,...ct.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":mn,className:"relative",children:[Os(mn),mn===Ie.length-1&&Os(Ie.length,"bottom"),vt.kind==="workspace"?cs(vt.workspace,vt.members,Pt.isDragging,!!Pt.combineTargetFor,ct.dragHandleProps):vt.kind==="collaboration"?si(vt.group,vt.members,ct.dragHandleProps,Pt.isDragging,!!Pt.combineTargetFor):u.jsx("div",{...R?dn(()=>R(vt.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${Pt.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":Pt.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":Yn(vt.session.id)??(vt.session.id===o?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:Sn(vt.session,ct.dragHandleProps)})]})},vt.id)),pn.placeholder]})})})]})},he.key||"__ungrouped__")}),Y.placeholder]})})})}):uo(bn,"sidebar-entities")]}),Ee&&u.jsx(yU,{directories:s.flatMap(Y=>{const he=a.get(Y.id)?.cwd;return he?[he]:[]}),tmuxAvailable:H,options:de,agents:zt,selectedAgent:ot,detecting:yn,resumeHistory:qe,resumeHistoryLoading:J,resumeHistoryPendingId:tt,resumeHistoryError:pt,onRefreshAgents:()=>{at().catch(()=>{})},onSelectAgent:Y=>{bt(Y).catch(()=>{})},onLaunchAgent:rr,onResumeHistory:Y=>{sr(Y)},onRemoveResumeHistory:Y=>{ri(Y)},onClose:()=>Tt(!1),onOptionsChange:Pe}),Rt&&u.jsx(AU,{activeSessionId:o,initialCollaborationGroupId:X,defaultSessionMode:ye,onClose:()=>{ze(!1),rt(null)},onNewSession:Y=>d(Y)}),!Ee&&u.jsx("div",{className:"relative z-10 shrink-0 border-t border-border/15 bg-[var(--chrome-bg)] p-2",children:u.jsxs("div",{className:`grid gap-1.5 ${ot?"grid-cols-[minmax(0,1fr)_minmax(0,1fr)_2.5rem]":"grid-cols-[minmax(0,1fr)_2.5rem]"}`,children:[u.jsxs("button",{type:"button",onClick:ko,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] ${ot?"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:K("sidebar.newSession"),"aria-label":K("sidebar.newSession"),children:[u.jsx(pa,{size:15,className:"shrink-0"}),u.jsx("span",{className:"truncate",children:"Terminal"})]}),ot&&u.jsxs("button",{type:"button",onClick:Jr,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:K("sidebar.newSessionWithAgent",{agent:ot.displayName}),"aria-label":K("sidebar.newSessionWithAgent",{agent:ot.displayName}),children:[u.jsx(dc,{agent:ot,size:15}),u.jsx("span",{className:"truncate",children:ot.displayName})]}),u.jsx("button",{type:"button",onClick:nr,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:K("sidebar.moreLaunchOptions"),"aria-label":K("sidebar.moreLaunchOptions"),"aria-expanded":!1,children:u.jsx(fc,{size:15,className:"transition-transform duration-200"})})]})})]});return te?u.jsx("div",{className:"h-full flex flex-col app-chrome-bg border-r border-border/15",children:es}):u.jsx(hw,{side:"left",isOpen:e,drawerWidthPx:t,onClose:n,onOpen:r,push:q,children:es})}const Sw=()=>Fh(()=>import("./RightSidebar-i0Oq68YI.js").then(e=>e.R),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(e=>({default:e.RightSidebar})),FU=S.lazy(Sw);function nb(e){const t=S.useRef(!1);S.useEffect(()=>{const s=navigator.connection;if(!(s?.saveData||/2g|3g/.test(s?.effectiveType??"")))return dg(()=>{Sw().catch(()=>{})},3e3)},[]);const{t:n}=qn();(e.isOpen||e.pinned)&&(t.current=!0);const r=u.jsx(hw,{side:"right",isOpen:e.isOpen,drawerWidthPx:e.drawerWidthPx,onClose:e.onClose,onOpen:e.onOpen,pinned:e.pinned,children:u.jsx("div",{className:"p-4 text-sm text-muted-foreground",role:"status",children:n("common.loading")})});return t.current?u.jsx(S.Suspense,{fallback:r,children:u.jsx(FU,{...e})}):r}function jU(e){return e>=90?"var(--destructive)":e>=70?"var(--warning)":"var(--success)"}function $U(e){return e>=90?"var(--destructive)/0.15":e>=70?"var(--warning)/0.15":"var(--success)/0.12"}function UU(e){if(!e)return"";const t=new Date(e),n=Date.now(),r=t.getTime()-n;if(r<=0)return"";const s=Math.floor(r/6e4),o=Math.floor(s/60),a=Math.floor(o/24),d=o%24,h=s%60,p=t.toLocaleDateString(void 0,{month:"short",day:"numeric"}),g=t.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});let y;return a>0?y=`${a}d ${d}h`:d>0?y=`${d}h ${h}m`:h>0?y=`${h}m`:y="soon",`resets in ${y} (${p} ${g})`}function HU(e){return{claude:"🧠",codex:"✨",kimi:"🌙",copilot:"🐙",grok:"🚀",gemini:"💎"}[e]||"📊"}function zU({result:e}){const{t}=qn(),n=e.windows.filter(d=>d.percent===0&&!d.resetAt),r=e.windows.filter(d=>d.percent>0||d.resetAt),s=n.length>0?n.map(d=>d.label).join(" · "):"",o=!!e.error;let a=null;return!o&&e.entitlement&&(e.usagePercent>=90?a=t("quota.exhausted"):e.remaining!==void 0&&e.remaining<e.entitlement?a=t("quota.left",{n:e.remaining}):a=`${Math.round(e.usagePercent)}%`),u.jsxs("div",{className:"rounded-xl border border-border/15 bg-surface-2 p-3 sm:p-4",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[13px] font-semibold text-foreground",children:[u.jsx("span",{className:"shrink-0",children:HU(e.slug)}),u.jsx("span",{className:"truncate",children:e.displayName}),s&&u.jsx("span",{className:"shrink-0 rounded-full bg-surface-elevated px-2 py-0.5 text-[10px] font-normal text-muted-foreground",children:s})]}),a&&u.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:a})]}),r.length>0?u.jsx("div",{className:"mt-2.5 space-y-2",children:r.map(d=>{const h=Math.max(0,Math.min(100,d.percent));return u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center gap-2 text-[12px]",children:[u.jsx("span",{className:"w-14 shrink-0 truncate text-muted-foreground sm:w-16",children:d.label}),u.jsx("div",{className:"flex-1",children:u.jsx("div",{className:"h-2 rounded-full",style:{background:$U(d.percent)},children:u.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${h}%`,background:jU(d.percent)}})})}),u.jsxs("span",{className:"w-9 shrink-0 text-right tabular-nums font-medium text-foreground",children:[Math.round(d.percent),"%"]})]}),d.resetAt&&u.jsx("p",{className:"mt-1 pl-14 text-[10px] text-muted-foreground sm:pl-16",children:UU(d.resetAt)})]},d.label)})}):o?u.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:e.error}):null]})}function GU({isOpen:e,onClose:t}){const{t:n}=qn(),[r,s]=S.useState([]),[o,a]=S.useState(!1),d=async(g=!1)=>{a(!0);try{const y=g?await DA():await NA();s(y.providers||[])}catch{}finally{a(!1)}};if(S.useEffect(()=>{e&&d()},[e]),S.useEffect(()=>{if(!e)return;const g=y=>{const b=y.detail;Array.isArray(b)&&s(b)};return window.addEventListener("termdock:quota-update",g),()=>{window.removeEventListener("termdock:quota-update",g)}},[e]),!e)return null;const h=r.filter(g=>!g.error),p=h.length>0?new Date(Math.max(...h.map(g=>g.fetchedAt||0))):null;return u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:t}),u.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:[u.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:[u.jsx("h2",{className:"text-[14px] font-semibold text-foreground sm:text-base",children:n("quota.title")}),u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("button",{type:"button",onClick:()=>d(!0),disabled:o,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":n("quota.refresh"),children:u.jsx(ys,{size:15,className:o?"animate-spin":""})}),u.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":n("quota.close"),children:u.jsx(Bs,{size:17})})]})]}),u.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-3 sm:p-5",children:[o&&h.length===0?u.jsx("div",{className:"flex items-center justify-center py-12",children:u.jsx(ys,{size:24,className:"animate-spin text-muted-foreground"})}):h.length===0?u.jsxs("div",{className:"py-8 text-center text-[13px] text-muted-foreground",children:[u.jsx("p",{children:n("quota.noProviders")}),u.jsx("p",{className:"mt-1.5 text-[11px]",children:n("quota.noProvidersHint")})]}):u.jsx("div",{className:"space-y-2.5",children:h.map(g=>u.jsx(zU,{result:g},g.slug))}),p&&u.jsx("p",{className:"mt-3 text-center text-[10px] text-muted-foreground",children:n("quota.updated",{time:p.toLocaleTimeString()})})]})]})]})}const rb=[{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~"}],WU=2,VU=20;function qU({label:e}){return u.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 YU({value:e,onChange:t,placeholder:n}){const{t:r}=qn(),[s,o]=_.useState(""),a=y=>{const b=[];let v="",T=!1;const A=()=>{const R=v.trim();R&&b.push(R),v=""};for(let R=0;R<y.length;R+=1){const D=y[R];if(!T&&D==="/"&&v.trim().length===0){T=!0,v+=D;continue}if(T){if(v+=D,D==="/"&&y[R-1]!=="\\"&&v.length>1){for(;R+1<y.length&&/[gimsuy]/.test(y[R+1]??"");)R+=1,v+=y[R];A(),T=!1}continue}if(D===","||/\s/.test(D)){A();continue}v+=D}if(A(),b.length===0)return;const L=[...e];for(const R of b){const D=cv(R);D&&(L.includes(D)||L.push(D))}t(L),o("")},d=y=>{t(e.filter(b=>b!==y))},h=s.trim(),p=h.length>0&&Z5(h),g=p&&!yh(h);return u.jsx("div",{className:"rounded-2xl bg-surface px-3 py-2 ring-1 ring-border/15 focus-within:ring-accent/40",children:u.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(y=>{const b=Z5(y),v=b&&!yh(y);return u.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] ${v?"bg-destructive/15 text-destructive":b?"bg-accent/15 font-mono text-accent":"bg-surface-elevated text-foreground"}`,title:b?v?r("settings.invalidRegex"):"Regex match":"Substring match (case-insensitive)",children:[b&&u.jsx("span",{className:"text-[10px] opacity-70",children:"re"}),y,u.jsx("button",{type:"button",onClick:()=>d(y),className:"rounded-full p-0.5 text-muted-foreground hover:bg-destructive/20 hover:text-destructive","aria-label":r("toolbarPresets.removeAction",{name:y}),children:u.jsx(Bs,{size:12})})]},y)}),u.jsx("input",{type:"text",value:s,onChange:y=>o(y.target.value),onKeyDown:y=>{y.key==="Enter"||y.key===","&&!p?(y.preventDefault(),a(s)):y.key==="Backspace"&&s.length===0&&e.length>0&&d(e[e.length-1])},onBlur:()=>a(s),placeholder:e.length===0?n:"",className:`min-w-[8ch] flex-1 bg-transparent py-1 text-sm outline-none placeholder:text-muted/60 ${p?"font-mono":""} ${g?"text-destructive":""}`,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off"})]})})}function ZU({value:e,min:t,max:n,onChange:r}){const{t:s}=qn();return u.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full bg-surface px-1 py-1 ring-1 ring-border/15",children:[u.jsx("button",{type:"button",onClick:()=>r(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":s("common.decrease"),children:u.jsx(B_,{size:14})}),u.jsx("span",{className:"w-6 text-center text-sm font-medium tabular-nums text-foreground",children:e}),u.jsx("button",{type:"button",onClick:()=>r(Math.min(n,e+1)),disabled:e>=n,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":s("common.increase"),children:u.jsx(Yi,{size:14})})]})}const KU=({presets:e,selectedPresetId:t,onSelectPreset:n,onUpdatePreset:r,onAddPreset:s,onRemovePreset:o,onResetDefaults:a})=>{const{t:d}=qn(),h=e.find(R=>R.id===t)??e[0]??null,[p,g]=_.useState(null);if(!h)return null;const y=h.actions.length>0,b=[{id:"preview-auto",label:h.label,kind:"preset"},...h.includeAlt?[{id:"preview-alt",label:"Alt"}]:[],...y?h.actions.map((R,D)=>({id:R.id,label:Rm(R,D)})):["Enter","Home","End","Ctrl-C","Ctrl-D"].map(R=>({id:R,label:R}))],v=uv(b,h.rowLayout),T=(R,D)=>{r(h.id,B=>{const j=B.actions.findIndex(z=>z.id===R);if(j===-1)return B;const P=j+D;if(P<0||P>=B.actions.length)return B;const $=[...B.actions];return[$[j],$[P]]=[$[P],$[j]],{...B,actions:$}})},A=h.rowLayout.reduce((R,D)=>R+D,0),L=1+(h.includeAlt?1:0);return u.jsxs("div",{className:"space-y-4",children:[u.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:[u.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[u.jsx("span",{className:"ui-kicker",children:d("toolbarPresets.preview")}),u.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[h.actions.length," button",h.actions.length===1?"":"s"," · ",A," slot",A===1?"":"s"]})]}),u.jsx("div",{className:"space-y-1 rounded-2xl bg-surface-2/60 p-2",children:v.map((R,D)=>{const B=R.items[0]?.kind==="preset",j=Math.max(2,R.columns),P=B?`${dv}px repeat(${Math.max(1,j-1)}, minmax(0, 1fr))`:`repeat(${j}, minmax(0, 1fr))`;return u.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:P},children:R.items.map($=>$.kind==="preset"?u.jsx(hv,{mode:"auto",presetLabel:$.label,title:`Auto preset · ${$.label}`,disabled:!0},$.id):u.jsx(qU,{label:$.label},$.id))},`preview-row-${D}`)})}),h.actions.length>A-L&&u.jsx("p",{className:"mt-1.5 text-[10px] text-muted-foreground",children:d("toolbarPresets.overCapacityHint")})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"ui-kicker",children:d("toolbarPresets.presets")}),u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsxs("button",{type:"button",onClick:s,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:[u.jsx(Yi,{size:14}),d("toolbarPresets.new")]}),u.jsxs("button",{type:"button",onClick:a,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:[u.jsx(ys,{size:14}),d("toolbarPresets.reset")]})]})]}),u.jsx("div",{className:"-mx-1 flex flex-wrap gap-1.5 px-1",children:e.map(R=>u.jsxs("button",{type:"button",onClick:()=>n(R.id),className:`rounded-full px-3 py-2 text-xs font-medium transition ${R.id===h.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&&u.jsx("span",{className:"ml-1.5 text-[10px] text-muted-foreground",children:R.actions.length})]},R.id))})]}),u.jsxs("div",{className:"space-y-4 rounded-2xl bg-surface p-4 ring-1 ring-border/10",children:[u.jsxs("div",{className:"space-y-1.5",children:[u.jsx("span",{className:"ui-kicker",children:d("toolbarPresets.label")}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("input",{type:"text",value:h.label,onChange:R=>r(h.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:d("toolbarPresets.presetLabelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"}),h.id!=="default"&&u.jsx("button",{type:"button",onClick:()=>o(h.id),className:"shrink-0 rounded-full bg-surface-2 px-3 py-2.5 text-destructive hover:bg-destructive/15","aria-label":d("toolbarPresets.deletePreset",{name:h.label}),children:u.jsx(co,{size:14})})]})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"ui-kicker",children:d("toolbarPresets.matchPrograms")}),u.jsx("span",{className:"text-[10px] text-muted-foreground",children:d("toolbarPresets.typeEnterHint")})]}),u.jsx(YU,{value:h.programs,onChange:R=>r(h.id,D=>({...D,programs:R})),placeholder:d("toolbarPresets.programsPlaceholder")}),u.jsx("p",{className:"text-[10px] text-muted-foreground",children:d("toolbarPresets.programsHelp")})]}),u.jsxs("button",{type:"button",onClick:()=>r(h.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:[u.jsxs("span",{children:[u.jsx("span",{className:"block font-medium text-foreground",children:d("toolbarPresets.altSlot")}),u.jsx("span",{className:"block text-[11px] text-muted-foreground",children:d("toolbarPresets.altSlotHint")})]}),u.jsx(nl,{checked:h.includeAlt})]}),u.jsxs("button",{type:"button",onClick:()=>r(h.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:[u.jsxs("span",{children:[u.jsx("span",{className:"block font-medium text-foreground",children:d("toolbarPresets.desktopVisibility")}),u.jsx("span",{className:"block text-[11px] text-muted-foreground",children:d("toolbarPresets.desktopVisibilityHint")})]}),u.jsx(nl,{checked:h.showOnDesktop===!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("span",{className:"ui-kicker",children:d("toolbarPresets.rowLayout")}),u.jsx("p",{className:"text-[11px] text-muted-foreground",children:d("toolbarPresets.rowLayoutHint")})]}),u.jsxs("button",{type:"button",onClick:()=>r(h.id,R=>({...R,rowLayout:[...Pg(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:[u.jsx(Yi,{size:12}),d("toolbarPresets.addRow")]})]}),u.jsx("div",{className:"space-y-2",children:h.rowLayout.map((R,D)=>u.jsxs("div",{className:"flex items-center gap-3 rounded-2xl bg-surface-2 px-3 py-2",children:[u.jsx("span",{className:"w-12 shrink-0 text-xs text-muted-foreground",children:d("toolbarPresets.rowN",{n:D+1})}),u.jsx("div",{className:"flex-1"}),u.jsx(ZU,{value:R,min:WU,max:VU,onChange:B=>r(h.id,j=>({...j,rowLayout:j.rowLayout.map((P,$)=>$===D?B:P)}))}),h.rowLayout.length>1&&u.jsx("button",{type:"button",onClick:()=>r(h.id,B=>({...B,rowLayout:B.rowLayout.filter((j,P)=>P!==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":d("toolbarPresets.removeRow",{n:D+1}),children:d("toolbarPresets.del")})]},`row-${D}`))})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("span",{className:"ui-kicker",children:d("toolbarPresets.buttons")}),u.jsx("p",{className:"text-[11px] text-muted-foreground",children:d("toolbarPresets.buttonsHint")})]}),u.jsxs("button",{type:"button",onClick:()=>{const R=`${h.id}-action-${Date.now()}`;r(h.id,D=>({...D,actions:[...D.actions,{id:R,label:`Key ${D.actions.length+1}`,sequence:""}]})),g(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:[u.jsx(Yi,{size:12}),d("toolbarPresets.addButton")]})]}),h.actions.length===0&&u.jsx("div",{className:"rounded-2xl bg-surface-2/60 px-4 py-6 text-center text-[11px] text-muted-foreground",children:d("toolbarPresets.noCustomButtons")}),h.actions.map((R,D)=>{const B=p===R.id;return u.jsxs("div",{className:`rounded-2xl bg-surface-2 transition ${B?"ring-1 ring-accent/40":""}`,children:[u.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[u.jsxs("div",{className:"flex flex-col gap-0.5",children:[u.jsx("button",{type:"button",onClick:()=>T(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":d("toolbarPresets.moveUp"),children:u.jsx(h3,{size:12})}),u.jsx("button",{type:"button",onClick:()=>T(R.id,1),disabled:D===h.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":d("toolbarPresets.moveDown"),children:u.jsx(CC,{size:12})})]}),u.jsxs("button",{type:"button",onClick:()=>g(B?null:R.id),className:"min-w-0 flex-1 text-left",children:[u.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:Rm(R,D)}),u.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:[R.sequence?R.sequence:d("toolbarPresets.noSequence"),R.doubleTapSequence&&u.jsxs("span",{className:"ml-1 text-accent/70",children:["· 2× ",R.doubleTapSequence]})]})]}),u.jsx("button",{type:"button",onClick:()=>r(h.id,j=>({...j,actions:j.actions.filter(P=>P.id!==R.id)})),className:"shrink-0 rounded-full bg-surface p-2 text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":d("toolbarPresets.removeAction",{name:R.label}),children:u.jsx(co,{size:14})})]}),B&&u.jsxs("div",{className:"space-y-3 border-t border-border/10 px-3 py-3",children:[u.jsxs("div",{className:"space-y-1.5",children:[u.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:d("toolbarPresets.labelField")}),u.jsx("input",{type:"text",value:R.label,onChange:j=>r(h.id,P=>({...P,actions:P.actions.map($=>$.id===R.id?{...$,label:j.target.value}:$)})),className:"w-full rounded-full bg-surface px-4 py-2.5 text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:d("toolbarPresets.labelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:d("toolbarPresets.sequence")}),u.jsx("input",{type:"text",value:R.sequence,onChange:j=>r(h.id,P=>({...P,actions:P.actions.map($=>$.id===R.id?{...$,sequence:j.target.value}:$)})),className:"w-full rounded-full bg-surface px-4 py-2.5 font-mono text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:d("toolbarPresets.sequencePlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),u.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:rb.map(j=>u.jsx("button",{type:"button",onClick:()=>r(h.id,P=>({...P,actions:P.actions.map($=>$.id===R.id?{...$,sequence:j.sequence}:$)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:j.label},j.label))})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:d("toolbarPresets.doubleTap")}),!R.doubleTapSequence&&u.jsx("button",{type:"button",onClick:()=>r(h.id,j=>({...j,actions:j.actions.map(P=>P.id===R.id?{...P,doubleTapSequence:""}:P)})),className:"text-[10px] text-accent hover:text-accent/80",children:d("toolbarPresets.doubleTapAdd")})]}),R.doubleTapSequence!==void 0&&u.jsxs(u.Fragment,{children:[u.jsx("input",{type:"text",value:R.doubleTapSequence,onChange:j=>r(h.id,P=>({...P,actions:P.actions.map($=>$.id===R.id?{...$,doubleTapSequence:j.target.value}:$)})),className:"w-full rounded-full bg-surface px-4 py-2.5 font-mono text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:d("toolbarPresets.doubleTapPlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),u.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[rb.map(j=>u.jsx("button",{type:"button",onClick:()=>r(h.id,P=>({...P,actions:P.actions.map($=>$.id===R.id?{...$,doubleTapSequence:($.doubleTapSequence??"")+j.sequence}:$)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:j.label},j.label)),u.jsx("button",{type:"button",onClick:()=>r(h.id,j=>({...j,actions:j.actions.map(P=>{if(P.id!==R.id)return P;const{doubleTapSequence:$,...z}=P;return z})})),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:d("toolbarPresets.remove")})]})]})]})]})]},R.id)})]})]})]})},XU={installed:"text-[color:var(--success)]",outdated:"text-[color:var(--warning)]","needs-approval":"text-[color:var(--warning)]","not-installed":"text-muted-foreground"};function JU(){const{t:e}=qn(),[t,n]=_.useState(null),[r,s]=_.useState(null),[o,a]=_.useState(null),[d,h]=_.useState(null),[p,g]=_.useState(!1),[y,b]=_.useState(!1),[v,T]=_.useState(""),[A,L]=_.useState(""),[R,D]=_.useState(null),[B,j]=_.useState([]),[P,$]=_.useState([]),[z,H]=_.useState(null),[ye,q]=_.useState(new Set),[te,ve]=_.useState(null),[ge,ie]=_.useState("auto"),[Ae,xe]=_.useState({}),[ce,K]=_.useState(null),[be,Se]=_.useState(null),[We,ue]=_.useState(10),[Ee,Tt]=_.useState(""),[Rt,ze]=_.useState(""),[X,rt]=_.useState(12e3),[qe,re]=_.useState(null),[J,$e]=_.useState(null),tt=_.useCallback(async()=>{const[se,Fe,Je,Ot]=await Promise.allSettled([AT(),CT(),uu(),Pu()]);if(n(se.status==="fulfilled"?se.value:[]),Fe.status==="fulfilled"){const je=Fe.value;j(je.plugins??[]),$(je.errors??[])}else j([]),$([]);if(Je.status==="fulfilled"){const je=Je.value;q(new Set(je.autoRenameAgents??[])),ie(je.autoRenameNamer??"auto"),xe(je.autoRenameModels??{}),ue(je.autoRenameIntervalMinutes??10),Tt(je.autoRenamePromptPreference??""),ze(je.autoRenamePromptPreference??""),rt(je.autoRenamePromptPayloadChars??12e3)}else q(new Set);K(Ot.status==="fulfilled"?Ot.value:[])},[]);_.useEffect(()=>{tt()},[tt]);const gt=async(se,Fe)=>{s(se),a(null);try{Fe==="install"?(await TT(se)).devMode&&h(se):(await ST(se),d===se&&h(null)),await tt()}catch(Je){a(Je instanceof Error?Je.message:String(Je))}finally{s(null)}},pt=se=>e(se==="installed"?"settings.agentHooksInstalled":se==="outdated"?"settings.agentHooksOutdated":se==="needs-approval"?"settings.agentHooksNeedsApproval":"settings.agentHooksNotInstalled"),Ct=async()=>{D(null);let se;try{se=JSON.parse(A)}catch{D("Invalid JSON");return}try{await _T(se),L(""),g(!1),await tt()}catch(Fe){if(Fe instanceof yg&&Fe.migration){$(Je=>[{slug:typeof se.slug=="string"?se.slug:"manifest.json",errors:Fe.message.split(`
|
|
137
|
-
`),code:Fe.code,migration:Fe.migration},...Je.filter(Ot=>Ot.slug!==se.slug)]);return}D(Fe instanceof Error?Fe.message:String(Fe))}},Le=async()=>{const se=v.trim();if(se){re("install"),D(null);try{await LT(se),T(""),b(!1),await tt()}catch(Fe){D(Fe instanceof Error?Fe.message:String(Fe))}finally{re(null)}}},Te=async se=>{re(`remove:${se}`);try{await RT(se),$e(Fe=>Fe?.slug===se?null:Fe),await tt()}catch(Fe){a(Fe instanceof Error?Fe.message:String(Fe))}finally{re(null)}},Oe=async se=>{re(`check:${se}`),a(null);try{await kT(se),await tt()}catch(Fe){a(Fe instanceof Error?Fe.message:String(Fe))}finally{re(null)}},yt=async se=>{re(`update:${se}`),a(null);try{const Fe=await ET(se),Je=[Fe.hookWarning,Fe.titleWarning].filter(Boolean).join(" ");Je&&a(Je),$e(Ot=>Ot?.slug===se?null:Ot),await tt()}catch(Fe){a(Fe instanceof Error?Fe.message:String(Fe))}finally{re(null)}},de=async se=>{re(`doctor:${se}`),a(null),$e(null);try{const Fe=await IT(se);$e(Fe),K(await Pu())}catch(Fe){a(Fe instanceof Error?Fe.message:String(Fe))}finally{re(null)}},Pe=async se=>{const Fe=se.migration?.aiPrompt??se.errors.join(`
|
|
138
|
-
`);try{await navigator.clipboard.writeText(Fe),H(se.slug),window.setTimeout(()=>H(Je=>Je===se.slug?null:Je),1800)}catch{D(Fe)}},ot=async se=>{if(te)return;const Fe=ye,Je=new Set(Fe);Je.has(se)?Je.delete(se):Je.add(se),q(Je),ve(se),a(null);try{const Ot=await gi({autoRenameAgents:[...Je]});q(new Set(Ot.autoRenameAgents??[])),K(await Pu(!0))}catch(Ot){q(Fe),a(Ot instanceof Error?Ot.message:String(Ot))}finally{ve(null)}},zt=async se=>{const Fe=ge;ie(se),Se("namer"),a(null);try{const Je=await gi({autoRenameNamer:se});ie(Je.autoRenameNamer??"auto"),K(await Pu(!0))}catch(Je){ie(Fe),a(Je instanceof Error?Je.message:String(Je))}finally{Se(null)}},yn=async(se,Fe)=>{const Je=Ae,Ot={...Je};Fe?Ot[se]=Fe:delete Ot[se],xe(Ot),Se(se),a(null);try{const je=await gi({autoRenameModels:Ot});xe(je.autoRenameModels??{})}catch(je){xe(Je),a(je instanceof Error?je.message:String(je))}finally{Se(null)}},at=async se=>{const Fe=We;ue(se),Se("interval"),a(null);try{const Je=await gi({autoRenameIntervalMinutes:se});ue(Je.autoRenameIntervalMinutes??10)}catch(Je){ue(Fe),a(Je instanceof Error?Je.message:String(Je))}finally{Se(null)}},bt=async()=>{const se=Ee.trim();if(se!==Rt){Se("preference"),a(null);try{const Je=(await gi({autoRenamePromptPreference:se})).autoRenamePromptPreference??"";Tt(Je),ze(Je)}catch(Fe){Tt(Rt),a(Fe instanceof Error?Fe.message:String(Fe))}finally{Se(null)}}},It=async se=>{const Fe=Math.max(1e3,Math.min(64e3,Math.round(se||12e3))),Je=X;rt(Fe),Se("payload-limit"),a(null);try{const Ot=await gi({autoRenamePromptPayloadChars:Fe});rt(Ot.autoRenamePromptPayloadChars??12e3)}catch(Ot){rt(Je),a(Ot instanceof Error?Ot.message:String(Ot))}finally{Se(null)}},kt=new Set(B.map(se=>se.slug)),$t=J?{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")}[J.status]:"";return u.jsxs("div",{className:"space-y-3",children:[u.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[u.jsx("div",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentAutoRename")}),u.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameHint")}),u.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[u.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameNamer")}),u.jsxs("select",{value:ge,disabled:be!==null,onChange:se=>{zt(se.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:[u.jsx("option",{value:"auto",children:e("settings.agentAutoRenameFollow")}),ce?.filter(se=>se.available).map(se=>u.jsx("option",{value:se.slug,children:se.displayName},se.slug))]})]}),u.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[u.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameInterval")}),u.jsx("select",{value:We,disabled:be!==null,onChange:se=>{at(Number(se.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(se=>u.jsxs("option",{value:se,children:[se," ",e("settings.agentAutoRenameMinutes")]},se))})]}),u.jsxs("details",{className:"mt-2 border-t border-border/40 pt-2",children:[u.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentAutoRenameAdvanced")}),u.jsxs("label",{className:"mt-2 block",children:[u.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePreference")}),u.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePreferenceHint")}),u.jsx("textarea",{value:Ee,maxLength:2e3,rows:3,disabled:be!==null,placeholder:e("settings.agentAutoRenamePreferencePlaceholder"),onChange:se=>Tt(se.target.value),onBlur:()=>{bt()},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"}),u.jsx("span",{className:"mt-1 block text-right text-[10px] text-muted-foreground",children:be==="preference"?e("settings.saving"):`${Ee.length}/2000`})]}),u.jsxs("label",{className:"mt-2 block",children:[u.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePayloadLimit")}),u.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePayloadLimitHint")}),u.jsx("input",{type:"number",min:1e3,max:64e3,step:1e3,value:X,disabled:be!==null,onChange:se=>rt(Number(se.target.value)),onBlur:se=>{It(Number(se.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"})]})]}),u.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/40 pt-2",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsx("span",{className:"text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameModelsFromCli")}),u.jsx("button",{type:"button",onClick:async()=>{K(null);try{K(await Pu(!0))}catch{K([])}},className:"rounded p-1 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",title:e("settings.agentAutoRenameRefreshModels"),children:u.jsx(ys,{size:11,className:ce===null?"animate-spin":""})})]}),ce?.filter(se=>se.available).map(se=>{const Fe=se.models.find(Je=>Je.id===se.recommendedModel);return u.jsxs("label",{className:"flex items-center justify-between gap-3",children:[u.jsx("span",{className:"text-[11px] text-muted-foreground",children:se.displayName}),u.jsxs("select",{value:Ae[se.slug]??"",disabled:be!==null,onChange:Je=>{yn(se.slug,Je.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:[u.jsx("option",{value:"",children:Fe?`${e("settings.agentAutoRenameAutomatic")} · ${Fe.displayName}`:e("settings.agentAutoRenameCliDefault")}),se.models.map(Je=>u.jsx("option",{value:Je.id,children:Je.displayName},Je.id))]})]},se.slug)}),ce?.length===0&&u.jsx("div",{className:"text-[10px] text-[color:var(--warning)]",children:e("settings.agentAutoRenameNoCli")})]})]}),t===null&&u.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[u.jsx(Xn,{size:12,className:"animate-spin"})," …"]}),t?.map(se=>{const Fe=r===se.slug,Je=se.state!=="not-installed",Ot=kt.has(se.slug);return u.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-surface-2 px-3 py-2.5",children:[u.jsx(dc,{agent:{slug:se.slug,displayName:se.displayName,accentColor:se.accentColor??"#878580",icon:se.icon,isPlugin:Ot,iconMode:se.iconMode,iconVersion:se.iconVersion??void 0},size:18}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-[13px] font-medium text-foreground",children:se.displayName}),Ot&&u.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"}),u.jsxs("span",{className:`text-[10px] ${XU[se.state]}`,children:[se.state==="installed"&&u.jsx(R2,{size:10,className:"mr-0.5 inline"}),(se.state==="outdated"||se.state==="needs-approval")&&u.jsx(b3,{size:10,className:"mr-0.5 inline"}),pt(se.state)]})]}),u.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",title:se.targetDisplay,children:[e("settings.agentHooksTarget")," ",se.targetDisplay]}),d===se.slug&&u.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksDevMode")}),se.state==="needs-approval"&&u.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksApprovalHint")})]}),u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsxs("button",{type:"button",disabled:te!==null,onClick:()=>{ot(se.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":ye.has(se.slug),title:e("settings.agentAutoRenameToggle"),children:[u.jsx("span",{children:e("settings.agentAutoRenameShort")}),u.jsx(nl,{checked:ye.has(se.slug),disabled:te!==null,size:"sm"})]}),u.jsxs("button",{type:"button",disabled:Fe,onClick:()=>{gt(se.slug,Je?"uninstall":"install")},className:`flex shrink-0 items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition ${Je?"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:[Fe?u.jsx(Xn,{size:11,className:"animate-spin"}):Je?u.jsx(co,{size:11}):se.state==="outdated"?u.jsx(ys,{size:11}):u.jsx(M0,{size:11}),Fe?"…":Je?e("settings.agentHooksUninstall"):se.state==="outdated"?e("settings.agentHooksReinstall"):e("settings.agentHooksInstall")]})]})]},se.slug)}),o&&u.jsx("div",{className:"rounded-xl bg-[rgb(var(--warning-rgb)_/_0.10)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:o}),u.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentPlugins")}),u.jsxs("button",{type:"button",onClick:()=>b(!y),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:[u.jsx(Yi,{size:11}),e("settings.agentPluginAdd")]})]}),u.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentPluginHint")}),y&&u.jsxs("div",{className:"mt-2 space-y-2",children:[u.jsxs("div",{className:"flex gap-2",children:[u.jsx("input",{value:v,onChange:se=>T(se.target.value),onKeyDown:se=>{se.key==="Enter"&&Le()},className:"min-w-0 flex-1 rounded-lg bg-surface px-3 py-2 font-mono text-[11px] text-foreground placeholder:text-muted-foreground outline-none",placeholder:e("settings.agentPluginSourcePlaceholder")}),u.jsxs("button",{type:"button",disabled:!v.trim()||qe!==null,onClick:()=>{Le()},className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-3 py-1 text-[11px] font-medium text-[color:var(--success)] transition hover:bg-[rgb(var(--success-rgb)_/_0.22)] disabled:opacity-50",children:[qe==="install"?u.jsx(Xn,{size:11,className:"animate-spin"}):u.jsx(M0,{size:11}),e("settings.agentPluginInstallPackage")]})]}),u.jsx("button",{type:"button",onClick:()=>g(!p),className:"text-[10px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentPluginAdvancedManifest")})]}),B.map(se=>{const Fe=se.revision?.slice(0,8),Je=qe?.endsWith(`:${se.slug}`)===!0;return u.jsxs("div",{className:"mt-2 flex items-center gap-2 border-t border-border/40 pt-2",children:[u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-medium text-foreground",children:[u.jsx("span",{className:"truncate",children:se.displayName}),se.updateAvailable&&u.jsx("span",{className:"text-[9px] text-[color:var(--warning)]",children:e("settings.agentPluginUpdateAvailable")})]}),u.jsxs("div",{className:"truncate text-[9px] text-muted-foreground",title:se.source??void 0,children:[se.source??e("settings.agentPluginManualSource"),Fe?` · ${Fe}`:""]})]}),u.jsxs("button",{type:"button",disabled:qe!==null,onClick:()=>{de(se.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:[qe===`doctor:${se.slug}`?u.jsx(Xn,{size:10,className:"animate-spin"}):u.jsx(dL,{size:10}),e("settings.agentPluginDoctor")]}),se.updateSupported&&u.jsxs("button",{type:"button",disabled:qe!==null,onClick:()=>{se.updateAvailable?yt(se.slug):Oe(se.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:[Je?u.jsx(Xn,{size:10,className:"animate-spin"}):u.jsx(ys,{size:10}),se.updateAvailable?e("settings.agentPluginUpdate"):e("settings.agentPluginCheck")]}),u.jsx("button",{type:"button",disabled:qe!==null,onClick:()=>{Te(se.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:u.jsx(co,{size:11})})]},se.slug)}),J&&u.jsxs("div",{className:`mt-2 rounded-lg px-3 py-2 text-[10px] ${J.status==="ok"||J.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:[u.jsxs("div",{className:"font-medium",children:[J.displayName,": ",$t]}),u.jsx("div",{className:"mt-1 text-muted-foreground",children:J.models.length>0?`${J.models.length} ${e("settings.agentPluginDoctorModels")}${J.recommendedModel?` · ${e("settings.agentPluginDoctorAutomatic")} ${J.recommendedModel}`:""}`:e("settings.agentPluginDoctorCliDefault")}),J.error&&u.jsx("div",{className:"mt-1 break-words",children:J.error}),J.warnings.length>0&&u.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:J.warnings.map(se=>u.jsxs("div",{children:["• ",se]},se))}),J.nextSteps.length>0&&u.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:J.nextSteps.map(se=>u.jsxs("div",{children:["→ ",se]},se))})]}),P.map(se=>u.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:[u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsxs("span",{className:"font-medium",children:[se.slug,": ",se.code??e("settings.agentPluginInvalid")]}),u.jsxs("button",{type:"button",onClick:()=>{Pe(se)},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:[z===se.slug?u.jsx(R2,{size:10}):u.jsx(f3,{size:10}),z===se.slug?e("settings.agentPluginCopied"):e("settings.agentPluginCopyAiPrompt")]})]}),u.jsx("div",{className:"mt-1 whitespace-pre-wrap break-words text-muted-foreground",children:se.errors.join(`
|
|
139
|
-
`)}),se.migration?.guideCommand&&u.jsx("code",{className:"mt-1 block select-all text-foreground",children:se.migration.guideCommand})]},se.slug)),y&&p&&u.jsxs("div",{className:"mt-2 space-y-2",children:[u.jsx("textarea",{value:A,onChange:se=>L(se.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:`{
|
|
140
|
-
"version": 2,
|
|
141
|
-
"slug": "my-agent",
|
|
142
|
-
"displayName": "My Agent",
|
|
143
|
-
"aliases": ["my-agent"],
|
|
144
|
-
"accentColor": "#4385BE",
|
|
145
|
-
"statuses": [
|
|
146
|
-
{ "id": "thinking", "phase": "working", "label": "Thinking", "indicator": "spinner", "tone": "info" },
|
|
147
|
-
{ "id": "approval", "phase": "waiting", "label": "Needs approval", "indicator": "question", "tone": "warning" },
|
|
148
|
-
{ "id": "complete", "phase": "done", "label": "Complete", "indicator": "badge", "tone": "success" }
|
|
149
|
-
],
|
|
150
|
-
"hooks": {
|
|
151
|
-
"target": "~/.my-agent/settings.json",
|
|
152
|
-
"events": [
|
|
153
|
-
{ "hook": "UserPromptSubmit", "event": "prompt-submit", "status": "thinking" },
|
|
154
|
-
{ "hook": "PermissionRequest", "event": "permission-request", "status": "approval" },
|
|
155
|
-
{ "hook": "Stop", "event": "stop", "status": "complete" }
|
|
156
|
-
]
|
|
157
|
-
}
|
|
158
|
-
}`}),R&&u.jsx("div",{className:"whitespace-pre-wrap break-words text-[10px] text-[color:var(--warning)]",children:R}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("button",{type:"button",onClick:()=>{Ct()},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:[u.jsx(r_,{size:11}),e("settings.agentPluginCreate")]}),u.jsx("button",{type:"button",onClick:()=>{g(!1),L(""),D(null)},className:"rounded-full px-3 py-1 text-[11px] text-muted-foreground hover:text-foreground transition",children:e("common.cancel")})]})]})]})]})}function eH({state:e,pending:t,onCheck:n,onConfirmRestart:r,desktopState:s,desktopPending:o=!1,onCheckDesktop:a,onInstallDesktop:d}){const{t:h}=qn(),p=e?.status??"idle",g=t||p==="checking"||p==="installing"||p==="restarting",y=p==="ready"&&!!e?.latestVersion,b=p==="checking"?h("settings.updateChecking"):p==="installing"?h("sidebar.updateInstalling"):p==="ready"?h("sidebar.updateReady"):p==="restarting"?h("sidebar.updateRestarting"):p==="current"?h("settings.updateCurrent"):p==="error"?e?.error||h("sidebar.updateFailed"):h("settings.updateHint"),v=s?.status??"idle",T=o||v==="checking"||v==="downloading"||v==="installing",A=v==="ready",L=v==="unsupported"?h("settings.desktopUpdateUnsupported"):v==="checking"?h("settings.desktopUpdateChecking"):v==="current"?h("settings.desktopUpdateCurrent"):v==="downloading"?h("settings.desktopUpdateDownloading"):v==="ready"?h("settings.desktopUpdateReady"):v==="installing"?h("settings.desktopUpdateInstalling"):v==="error"&&s?.error||h("settings.desktopUpdateHint");return u.jsxs("section",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2","aria-labelledby":"termdock-update-title",children:[u.jsx("div",{id:"termdock-update-title",className:"px-3 pt-3 text-[12px] font-semibold text-foreground",children:h("settings.updateTitle")}),u.jsxs("div",{className:"flex items-start justify-between gap-3 px-3 py-3",children:[u.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[u.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${y?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:u.jsx(ys,{size:15,className:g?"animate-spin":""})}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[12px] font-medium text-foreground",children:h("settings.updateRuntimeTitle")}),u.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:b}),e&&u.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:y&&e.latestVersion?`${e.currentVersion} → ${e.latestVersion}`:`v${e.currentVersion}`})]})]}),y?u.jsx("button",{type:"button",disabled:g,onClick:r,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:h("sidebar.updateRestart")}):u.jsx("button",{type:"button",disabled:g,onClick:n,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:h(p==="checking"?"settings.updateCheckingShort":p==="installing"?"settings.updateInstallingShort":p==="error"?"sidebar.updateRetry":p==="current"?"settings.updateCheckAgain":"settings.updateCheck")})]}),s&&u.jsxs("div",{className:"flex items-start justify-between gap-3 border-t border-border/10 px-3 py-3",children:[u.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[u.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:u.jsx(ys,{size:15,className:T?"animate-spin":""})}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[12px] font-medium text-foreground",children:h("settings.desktopUpdateTitle")}),u.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:L}),u.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:A&&s.latestVersion?`${s.currentVersion} → ${s.latestVersion}`:`v${s.currentVersion}`})]})]}),A?u.jsx("button",{type:"button",disabled:T||!d,onClick:d,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:h("settings.desktopUpdateRestart")}):u.jsx("button",{type:"button",disabled:T||v==="unsupported"||!a,onClick:a,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:h(v==="checking"?"settings.updateCheckingShort":v==="current"||v==="error"?"settings.desktopUpdateCheckAgain":"settings.desktopUpdateCheck")})]})]})}function tH({bridge:e,runningCount:t,reviewCount:n,labels:r}){const[s,o]=_.useState([]),[a,d]=_.useState(!1),h=_.useRef(null);if(_.useEffect(()=>e.onServiceActivity(o),[e]),_.useEffect(()=>{e.reportServiceActivity({runningCount:t,reviewCount:n})},[e,n,t]),_.useEffect(()=>{if(!a)return;const A=R=>{h.current?.contains(R.target)||d(!1)},L=R=>{R.key==="Escape"&&d(!1)};return document.addEventListener("pointerdown",A),document.addEventListener("keydown",L),()=>{document.removeEventListener("pointerdown",A),document.removeEventListener("keydown",L)}},[a]),s.length<2)return null;const p=[...s].sort((A,L)=>A.current!==L.current?A.current?-1:1:A.reviewCount!==L.reviewCount?L.reviewCount-A.reviewCount:A.runningCount!==L.runningCount?L.runningCount-A.runningCount:A.label.localeCompare(L.label)),g=p.find(A=>A.current),y=p.filter(A=>!A.current),b=y.reduce((A,L)=>A+L.runningCount,0),v=y.reduce((A,L)=>A+L.reviewCount,0),T=async A=>{await e.focusService(A)&&d(!1)};return u.jsxs("div",{ref:h,className:"relative z-20 shrink-0","data-testid":"desktop-service-switcher",children:[u.jsxs("button",{type:"button",className:`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-[11px] ring-1 transition sm:h-8 ${v>0?"bg-[rgb(var(--warning-rgb)_/_0.12)] text-[color:var(--warning)] ring-[rgb(var(--warning-rgb)_/_0.22)] hover:bg-[rgb(var(--warning-rgb)_/_0.18)]":"bg-surface-2 text-muted-foreground ring-border/10 hover:bg-surface-elevated hover:text-foreground"}`,"aria-haspopup":"menu","aria-expanded":a,"aria-label":r.switchService,title:g?`${r.switchService} · ${g.label}`:r.switchService,onClick:()=>d(A=>!A),children:[u.jsx(B2,{size:13,className:"shrink-0"}),b>0&&u.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[color:var(--success)]",title:`${r.running}: ${b}`,children:[u.jsx(Xn,{size:10,className:"animate-spin"}),u.jsx("span",{className:"tabular-nums",children:b})]}),v>0&&u.jsxs("span",{className:"inline-flex items-center gap-0.5",title:`${r.review}: ${v}`,children:[u.jsx(Fl,{size:10,className:"animate-pulse"}),u.jsx("span",{className:"tabular-nums",children:v})]}),b===0&&v===0&&u.jsx("span",{className:"tabular-nums text-muted-foreground",children:s.length})]}),a&&u.jsxs("div",{role:"menu","aria-label":r.openServices,className:"absolute right-0 top-[calc(100%+0.4rem)] z-30 w-72 overflow-hidden rounded-xl border border-border/15 bg-surface-elevated p-1.5 text-foreground shadow-[0_18px_50px_var(--app-shadow-strong)]",children:[u.jsx("div",{className:"px-2.5 pb-1.5 pt-1 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:r.openServices}),p.map(A=>{const L=A.runningCount===0&&A.reviewCount===0;return u.jsxs("button",{type:"button",role:"menuitem",className:"flex min-h-11 w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left transition hover:bg-surface-2 focus-visible:bg-surface-2 focus-visible:outline-none",onClick:()=>{T(A.origin)},children:[u.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface text-muted-foreground",children:A.current?u.jsx(ma,{size:13,className:"text-primary"}):u.jsx(B2,{size:13})}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx("span",{className:"truncate text-[12px] font-medium",children:A.label}),A.current&&u.jsx("span",{className:"shrink-0 text-[9px] text-primary",children:r.current})]}),u.jsx("span",{className:"mt-0.5 block truncate text-[9px] text-muted-foreground",children:A.origin})]}),u.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[10px] tabular-nums",children:[A.runningCount>0&&u.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[color:var(--success)]",title:r.running,children:[u.jsx(Xn,{size:10,className:"animate-spin"}),A.runningCount]}),A.reviewCount>0&&u.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[color:var(--warning)]",title:r.review,children:[u.jsx(Fl,{size:10}),A.reviewCount]}),L&&u.jsx("span",{className:"text-muted-foreground",children:r.idle})]})]},A.origin)}),u.jsx("div",{className:"mt-1 border-t border-border/15 pt-1",children:u.jsxs("button",{type:"button",role:"menuitem",className:"flex min-h-9 w-full items-center gap-2 rounded-lg px-2.5 text-left text-[11px] text-muted-foreground transition hover:bg-surface-2 hover:text-foreground focus-visible:bg-surface-2 focus-visible:outline-none",onClick:()=>{d(!1),e.showConnectionCenter()},children:[u.jsx(iL,{size:13}),u.jsx("span",{children:r.manageServices})]})})]})]})}const lg="mobile-session-destroy";function nH(e,t){return t&&e.type==="session"&&e.destination?.droppableId===lg}const ao="termdock-program-rules-cache",Ud="termdock-toolbar-presets-cache",d0="termdock-settings-cache",sb="termdock-color-theme",ib="termdock:right-sidebar:file-preview-open-by-session:v2",h0="termdock:running-session-button-enabled:v1",rH=60,ob=320,ab=420,ua=8;function lb(e,t,n){return Math.min(Math.max(e,t),n)}function cb(e){if(typeof window>"u")return{left:ua,top:ua};const t=window.innerWidth/2,n=Math.min(64,window.innerHeight/4),r=e?.x??t,s=e?.y??n,o=Math.max(ua,window.innerWidth-ob-ua),a=Math.max(ua,window.innerHeight-ab-ua);return{left:lb(r+ua,ua,o),top:lb(s+ua,ua,a),width:ob,maxHeight:`min(${ab}px, calc(100vh - ${ua*2}px))`}}function sH(e){return e==="dark"||e==="light"}function iH(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.entries(e).every(([t,n])=>{if(!t||!n||typeof n!="object"||Array.isArray(n))return!1;const r=n;return typeof r.updatedAt=="number"&&Number.isFinite(r.updatedAt)})}function nm(e){const t=Object.entries(e).filter(([n,r])=>n&&Number.isFinite(r.updatedAt)).sort(([,n],[,r])=>r.updatedAt-n.updatedAt).slice(0,rH);return Object.fromEntries(t)}function oH(e){return Array.isArray(e)&&e.every(t=>{if(!t||typeof t!="object")return!1;const n=t;return typeof n.id=="string"&&typeof n.pattern=="string"&&typeof n.output=="string"&&(n.matchType==="exact"||n.matchType==="includes"||n.matchType==="prefix"||n.matchType==="regex")})}function aH(e){return typeof e=="object"&&e!==null&&typeof e.version=="number"&&Array.isArray(e.presets)}function lH(e,t){const n=Q0(),r=new Set(TM()),s=Array.isArray(e)?e:[],o=Jc(s),a=t<b0;if(o.length===0)return n;if(a){const h=new Map(o.map(b=>[b.id,b])),p=new Map(s.map(b=>[typeof b.id=="string"?b.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):"",b])),g=o.filter(b=>!r.has(b.id));return[...n.map(b=>{const v=h.get(b.id),T=p.get(b.id);return v?{...b,rowLayout:v.rowLayout,showOnDesktop:typeof T?.showOnDesktop=="boolean"?T.showOnDesktop:b.showOnDesktop}:b}),...g]}const d=new Set(o.map(h=>h.id));return[...o,...n.filter(h=>!d.has(h.id))]}function cH(e){return typeof e=="object"&&e!==null&&typeof e.preventSleep=="boolean"&&typeof e.networkAvailable=="boolean"}const uH={name:"",source:"auto",hostname:"",fallbackHostname:"",url:"",fallbackUrl:"",onboardingUrl:null,status:"disabled",reason:null,httpsEnabled:!1,caAvailable:!1,lanAddresses:[],interfaces:[]},af="__termdockOverlay",lf="__termdockBaseAnchor",cf="__termdockBaseGuard",dH=3,ub=250,hH="termdock-notification-target-v1",db="/__termdock-notification-target",hb=3e4;function fH(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 Gc(e){if(!e||typeof e!="object")return null;const t=e[af];return fH(t)?t:null}function m1(e){return e&&typeof e=="object"?{...e}:{}}function Cw(e){const t=m1(e);return delete t[af],t}function pH(e){const t=Cw(e);return delete t[cf],{...t,[lf]:!0}}function mH(){typeof window>"u"||window.history.pushState({...Cw(window.history.state),[lf]:!0,[cf]:!0},"",window.location.href)}function _w(){for(let e=0;e<dH;e+=1)mH()}function Hd(){typeof window>"u"||(window.history.replaceState(pH(window.history.state),"",window.location.href),_w())}function f0(e){typeof window>"u"||window.history.pushState({...m1(window.history.state),[lf]:!0,[af]:e,[cf]:!1},"",window.location.href)}function gH(e){typeof window>"u"||window.history.replaceState({...m1(window.history.state),[lf]:!0,[af]:e,[cf]:!1},"",window.location.href)}const Lw=["bash","zsh","fish","sh","dash","ksh","tcsh","csh","nu"];let vo=new Set(Lw);function fb(e){const t=new Map;for(const[n,r]of e)t.set(n,{cwd:r.cwd,activeProgram:r.activeProgram,activeProgramRaw:r.activeProgramRaw,inCopyMode:r.inCopyMode,isConnecting:r.isConnecting,agentStatus:r.agentStatus,agentIndicator:r.agentIndicator,agentStatusDetail:r.agentStatusDetail,agent:r.agent,agentMessage:r.agentMessage,agentNativeSessionId:r.agentNativeSessionId,agentResumeRecovered:r.agentResumeRecovered,terminalSessionId:r.terminalSessionId,agentNeedsReview:r.agentNeedsReview,gitStatus:r.gitStatus,shellTitle:r.shellTitle,promptState:r.promptState,tuiProgress:r.tuiProgress});return t}function xH(e,t){if(e.size!==t.size)return!1;for(const[n,r]of t){const s=e.get(n);if(!s||s.cwd!==r.cwd||s.activeProgram!==r.activeProgram||s.activeProgramRaw!==r.activeProgramRaw||s.inCopyMode!==r.inCopyMode||s.isConnecting!==r.isConnecting||s.agentStatus!==r.agentStatus||s.agentIndicator!==r.agentIndicator||s.agentStatusDetail!==r.agentStatusDetail||s.agent!==r.agent||s.agentMessage!==r.agentMessage||s.agentNativeSessionId!==r.agentNativeSessionId||s.agentResumeRecovered!==r.agentResumeRecovered||s.terminalSessionId!==r.terminalSessionId||s.agentNeedsReview!==r.agentNeedsReview||s.gitStatus!==r.gitStatus||s.shellTitle!==r.shellTitle||s.promptState!==r.promptState||s.tuiProgress?.state!==r.tuiProgress?.state||s.tuiProgress?.progress!==r.tuiProgress?.progress)return!1}return!0}function pb(e,t){return u.jsx(G$,{sessionMode:e,state:t})}function yH(e,t){const n=new Map(e.map(a=>[a.id,a])),r=t.map(a=>n.get(a)).filter(a=>a!==void 0),s=new Set(t),o=e.filter(a=>!s.has(a.id));return[...r,...o]}function bH(){const{t:e,locale:t,setLocale:n}=qn(),r="env(safe-area-inset-top, 0px)",s="env(safe-area-inset-bottom, 0px)";UM();const o=_.useMemo(()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,[]),[a,d]=_.useState(!1),[h,p]=_.useState(()=>lo(sb,sH)??"dark"),g=_.useRef(lo(d0,cH)).current,[y,b]=_.useState(g?.preventSleep??!1),[v,T]=_.useState(g?.networkAvailable??!0),[A,L]=_.useState(jh),[R,D]=_.useState($h),[B,j]=_.useState(wg),[P,$]=_.useState(I0),[z,H]=_.useState(zf),[ye,q]=_.useState(g?.localAccess??uH),[te,ve]=_.useState(g?.localAccess?.name??""),[ge,ie]=_.useState(!1),[Ae,xe]=_.useState(null),[ce,K]=_.useState(null),[be,Se]=_.useState(null),[We,ue]=_.useState(!1),Ee=_.useMemo(()=>Qs(),[]),Tt=!!(Ee?.desktopUpdateState&&Ee.checkDesktopUpdate&&Ee.installDesktopUpdate),[Rt,ze]=_.useState(null),[X,rt]=_.useState(null),[qe,re]=_.useState(!1),[J,$e]=_.useState(null),[tt,gt]=_.useState(!1),[pt,Ct]=_.useState(()=>nm(lo(ib,iH)??{})),[Le,Te]=_.useState(0),[Oe,yt]=_.useState(!1),[de,Pe]=_.useState(0),[ot,zt]=_.useState(!1),[yn,at]=_.useState(0),[bt,It]=_.useState(!1),[kt,$t]=_.useState(0),se=_.useRef(null),[Fe,Je]=_.useState({}),{terminalSettings:Ot,updateTerminalSettings:je}=YF(),ut=Ot.fontSize,un=Ot.rendererMode,[Be,hr]=_.useState(!1),jn=_.useRef(nD()).current,[Ne,Pn]=S.useState(()=>jn.sessions.map(E=>({id:E.sessionId,name:E.name,customName:E.customName,mode:E.mode,tmuxSessionName:E.tmuxSessionName}))),[dt,fr]=_.useState(jn.activeSessionId),[In,Sr]=_.useState(!1),[fn,Qn]=_.useState(null),[Br,Rn]=_.useState(null),[On,pe]=_.useState([]),[tn,Ue]=S.useState(()=>{const E=Bn.getState();return jn.sessions.forEach(Q=>{Q.backendSessionId&&E.setTerminalSession(Q.sessionId,{sessionId:Q.backendSessionId,cols:80,rows:24,mode:Q.mode,tmuxSessionName:Q.tmuxSessionName}),Q.activeProgram!=null&&E.setSessionActiveProgram(Q.sessionId,Q.activeProgram),Q.cwd!=null&&E.setSessionCwd(Q.sessionId,Q.cwd)}),eu("session-chrome-hydrated"),fb(Bn.getState().sessions)});S.useEffect(()=>{!Ee||!Be||Promise.all([Ee.snapshot(),Ee.desktopUpdateState?.()??Promise.resolve(null)]).then(([E,Q])=>{ze(E),rt(Q)}).catch(E=>$e(E instanceof Error?E.message:String(E)))},[Ee,Be]),S.useEffect(()=>{Ee?.onDesktopUpdateState&&Ee.onDesktopUpdateState(rt)},[Ee]),S.useEffect(()=>Bn.subscribe(E=>{const Q=fb(E.sessions);Ue(ae=>xH(ae,Q)?ae:Q)}),[]);const as=S.useCallback(async(E,Q)=>{Rn(null),Qn({sessionId:E,status:"submitting",error:null});try{await MT(Q),Qn(ae=>ae?.sessionId===E?{...ae,status:"waiting",error:null}:ae)}catch(ae){const st=(ae&&typeof ae=="object"&&"code"in ae?String(ae.code??""):"")==="AGENT_SESSION_ACTIVE_ELSEWHERE"?e("tab.resumeAgentConflict"):ae instanceof Error&&/busy/i.test(ae.message)?e("tab.resumeAgentBusy"):e("tab.resumeAgentFailed");Qn(Mt=>Mt?.sessionId===E?{...Mt,error:st}:Mt),Rn({tone:"error",message:st})}},[e]);S.useEffect(()=>{if(!fn||fn.status!=="waiting")return;const E=tn.get(fn.sessionId);if(!E||E.agentResumeRecovered||E.agentStatus===null&&!E.agent)return;const Q=E.agent?.displayName??"Agent";Qn(null),Rn({tone:"success",message:e("tab.resumeAgentSuccess",{agent:Q})})},[fn,tn,e]),S.useEffect(()=>{if(!fn||fn.status!=="waiting"||fn.error)return;const E=fn.sessionId,Q=window.setTimeout(()=>{const ae=e("tab.resumeAgentTimeout");Qn(Qe=>Qe?.sessionId===E&&Qe.status==="waiting"?{...Qe,error:ae}:Qe),Rn({tone:"error",message:ae})},15e3);return()=>window.clearTimeout(Q)},[fn,e]),S.useEffect(()=>{if(Br?.tone!=="success")return;const E=window.setTimeout(()=>Rn(null),3200);return()=>window.clearTimeout(E)},[Br]),S.useEffect(()=>{let E=!1;IA().then(ae=>{E||Se(ae)}).catch(()=>{});const Q=Om(ae=>{ae.type==="update-state"&&!E&&Se(ae.state)});return()=>{E=!0,Q()}},[]);const _s=S.useCallback(async()=>{const E=be?.latestVersion;if(!(!E||We)&&window.confirm(e("sidebar.updateRestartConfirm",{version:E}))){ue(!0);try{Se(await MA())}catch(Q){window.alert(Q instanceof Error?Q.message:String(Q))}finally{ue(!1)}}},[be?.latestVersion,e,We]),$r=S.useCallback(async()=>{if(!We){ue(!0);try{Se(await RA())}catch(E){window.alert(E instanceof Error?E.message:String(E))}finally{ue(!1)}}},[We]),Ls=S.useCallback(async()=>{if(!(!Ee?.checkDesktopUpdate||qe)){re(!0);try{rt(await Ee.checkDesktopUpdate())}catch(E){$e(E instanceof Error?E.message:String(E))}finally{re(!1)}}},[Ee,qe]),ko=S.useCallback(async()=>{if(!(!Ee?.installDesktopUpdate||qe||X?.status!=="ready")&&window.confirm(e("settings.desktopUpdateRestartConfirm"))){re(!0);try{rt(await Ee.installDesktopUpdate())}catch(E){$e(E instanceof Error?E.message:String(E)),re(!1)}}},[Ee,qe,X?.status,e]);S.useEffect(()=>{document.documentElement.dataset.theme=h,J6(h),Hn(sb,h)},[h]),S.useEffect(()=>{Hn(ib,nm(pt))},[pt]);const Jr=Et(E=>E.leftOpen),Ir=Et(E=>E.rightOpen),rr=Et(E=>E.leftPinned),sr=Et(E=>E.leftSidebarWidth),ri=Et(E=>E.rightPinned),nr=Et(E=>E.rightSidebarWidth),Yn=Et(E=>E.rootPath),dn=Et(E=>E.contextKey),Sn=Et(E=>E.selectedFilePath),an=Et(E=>E.groupByFolder),bn=Et(E=>E.collapsedGroups),Pr=Et(E=>E.toggleGroupCollapsed),[Ht,Cr]=S.useState(()=>typeof window>"u"?!0:window.matchMedia("(min-width: 1024px)").matches),[ln,Ur]=S.useState(()=>typeof window>"u"?1024:window.innerWidth),[Os,ls]=S.useState(()=>typeof window>"u"?!1:window.matchMedia("(orientation: landscape)").matches),[yr,ks]=S.useState([]),[$n,cs]=S.useState({available:!0,version:null,reason:null}),[si,uo]=S.useState(!1),[es,Y]=S.useState(null),[he,Ke]=S.useState(null),[_e,Ie]=S.useState(null),[Ge,lt]=S.useState(null),[et,Ze]=S.useState(null),[it,pn]=S.useState(null),[vt,mn]=S.useState(null),[ct,Pt]=S.useState(null),[Xt,hn]=S.useState(null),[Tn,br]=S.useState(null),[vr,us]=S.useState(!1),[Fs,Es]=S.useState(()=>lo(h0,E=>typeof E=="boolean")??!1),js=S.useCallback(async E=>{const Q=Fs;Es(E),Hn(h0,E);try{const ae=await gi({runningSessionButtonEnabled:E});Es(ae.runningSessionButtonEnabled),Hn(h0,ae.runningSessionButtonEnabled)}catch{Es(Q),Hn(h0,Q)}},[Fs]),[$s,Ki]=S.useState(null),Rr=S.useCallback(E=>{Ki(E)},[]),Nn=S.useRef(!1),[Dn,Wr]=S.useState(null),[ts,U]=S.useState(null),ee=_.useRef(null),fe=_.useRef(!1),ke=_.useRef(null),ht=_.useRef(!1),nt=S.useCallback(()=>{pn(null),mn(null)},[]),Bt=_.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("session")),[_t,Nt]=_.useState(Bt.current),[Fn,Cn]=_.useState(!0),nn=_.useRef(Bt.current),_n=_.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("_notifTrace"));S.useEffect(()=>{if(typeof window>"u")return;const E=window.matchMedia("(min-width: 1024px)"),Q=()=>{Cr(E.matches),Ur(window.innerWidth)};return Q(),E.addEventListener("change",Q),window.addEventListener("resize",Q),()=>{E.removeEventListener("change",Q),window.removeEventListener("resize",Q)}},[]),S.useEffect(()=>{if(typeof window>"u")return;const E=window.matchMedia("(orientation: landscape)"),Q=()=>ls(E.matches);return Q(),E.addEventListener("change",Q),()=>E.removeEventListener("change",Q)},[]);const ir=_.useMemo(()=>dt?On.find(E=>E.sessionIds.includes(dt))??null:null,[dt,On]),_r=ir?.id??null,Un=ir?.sessionIds[0]??dt,sn=_.useRef([]);_.useLayoutEffect(()=>{const E=sn.current;if(sn.current=On,E.length===0)return;const Q=new Set(On.flatMap(ae=>ae.sessionIds));for(const ae of E){const Qe=ae.sessionIds.filter(st=>!Q.has(st)).map(st=>({sessionId:st,rootPath:Bn.getState().sessions.get(st)?.cwd??null}));Qe.length>0&&Et.getState().inheritRightSidebarStateFromSplitWorkspace(ae.id,Qe)}},[On]),_.useLayoutEffect(()=>((()=>{const Q=Un?Bn.getState().sessions.get(Un)?.cwd??null:null;Et.getState().setRootPath(Q,Un,_r)})(),Bn.subscribe((Q,ae)=>{const Qe=Un?Q.sessions.get(Un)?.cwd??null:null,st=Un?ae.sessions.get(Un)?.cwd??null:null;Qe!==st&&Et.getState().setRootPath(Qe,Un,_r)})),[_r,Un]);const Ut=Ht||Os,qt=Ht||Os,vn=Ut?Math.min(Math.max(ln*.9,360),ln-56):Math.min(ln*.92,420),Yt=qt?Math.min(Math.max(ln*.22,280),340):Math.min(ln*.86,380),on=dt&&Yn?`${dt}\0${Yn}`:"",or=!!(on&&Sn&&pt[on]),Us=S.useCallback(E=>{on&&(E&&!Et.getState().selectedFilePath||Ct(Q=>{if(!!Q[on]===E)return Q;if(E)return nm({...Q,[on]:{updatedAt:Date.now()}});const Qe={...Q};return delete Qe[on],Qe}))},[on]);S.useEffect(()=>{tj(on,dn,Sn)&&Ct(E=>{if(!E[on])return E;const Q={...E};return delete Q[on],Q})},[on,dn,Sn]);const ar=bt?"markdown-image-lightbox":ot?"markdown-outline":Oe?"right-sidebar-repo-picker":Ir&&or?"right-sidebar-file-preview":Be?"settings":Ir&&!(ri&&Ht)?"right-sidebar":Jr&&!(rr&&Ht)?"left-sidebar":null,Gn=_.useRef(ar),Xi=_.useRef(ar),Eo=_.useRef(!1),Hs=_.useRef(!1),ds=S.useCallback(()=>{if(typeof window>"u")return;const E=window.matchMedia("(hover: hover) and (pointer: fine)").matches;!Ht||!E||navigator.maxTouchPoints>0||window.setTimeout(()=>{window.dispatchEvent(new CustomEvent("focus-active-terminal-session"))},0)},[Ht]),yi=S.useCallback(E=>{if(E==="markdown-image-lightbox"){It(!1),$t(Q=>Q+1);return}if(E==="markdown-outline"){zt(!1),at(Q=>Q+1);return}if(E==="right-sidebar-file-preview"){zt(!1),at(Q=>Q+1),Us(!1),Te(Q=>Q+1);return}if(E==="right-sidebar-repo-picker"){yt(!1),Pe(Q=>Q+1);return}if(E==="settings"){hr(!1),ai(!1),Ai(!1),lr(!1);return}if(E==="left-sidebar"){Et.getState().closeLeft();return}zt(!1),at(Q=>Q+1),yt(!1),Pe(Q=>Q+1),It(!1),$t(Q=>Q+1),Et.getState().closeRight()},[Us]),Zn=S.useCallback(E=>{if(!o&&typeof window<"u"&&Gn.current===E&&Gc(window.history.state)===E){window.history.back();return}yi(E)},[yi,o]),Ei=S.useCallback(()=>{hr(!1);const E=Et.getState();E.closeRight(),E.openLeft()},[]),Is=S.useCallback(()=>{hr(!1);const E=Et.getState();E.closeLeft(),E.openRight()},[]),Xo=S.useCallback(()=>{hr(!1);const E=Et.getState();E.closeLeft(),E.openRight(),E.setRightTab("files"),E.openRightSearch()},[]),Ji=S.useCallback(()=>{const E=Et.getState();if(E.leftPinned){E.setLeftPinned(!1),E.closeLeft();return}if(Jr){Zn("left-sidebar");return}Ei()},[Ei,Zn,Jr]),ho=S.useCallback(()=>{const E=Et.getState();E.leftPinned?(E.setLeftPinned(!1),E.openLeft()):(E.setLeftPinned(!0),E.openLeft())},[]),xa=S.useCallback(()=>{const E=Et.getState();E.setLeftPinned(!1),E.closeLeft()},[]),Jo=S.useCallback(()=>{const E=Et.getState();E.rightPinned?(E.setRightPinned(!1),E.openRight()):(E.setRightPinned(!0),E.openRight())},[]),Io=S.useCallback(()=>{const E=Et.getState();E.setRightPinned(!1),E.closeRight()},[]),ii=S.useRef(0),bi=S.useRef(0),Vr=S.useRef(null),cl=S.useCallback(E=>{E.preventDefault(),ii.current=E.clientX,bi.current=Et.getState().leftSidebarWidth;const Q=Qe=>{Vr.current===null&&(Vr.current=requestAnimationFrame(()=>{Vr.current=null;const st=Qe.clientX-ii.current;Et.getState().setLeftSidebarWidth(bi.current+st)}))},ae=()=>{window.removeEventListener("mousemove",Q),window.removeEventListener("mouseup",ae),Vr.current!==null&&(cancelAnimationFrame(Vr.current),Vr.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",Q),window.addEventListener("mouseup",ae)},[]),hs=S.useRef(0),ya=S.useRef(0),Ii=S.useRef(null),ul=S.useCallback(E=>{E.preventDefault(),hs.current=E.clientX;const Q=Et.getState(),ae=Q.leftPinned?Q.leftSidebarWidth:0;ya.current=sh(Q.rightSidebarWidth,window.innerWidth,ae);const Qe=Mt=>{Ii.current===null&&(Ii.current=requestAnimationFrame(()=>{Ii.current=null;const Zt=hs.current-Mt.clientX,tr=Et.getState(),ur=tr.leftPinned?tr.leftSidebarWidth:0;tr.setRightSidebarWidth(sh(ya.current+Zt,window.innerWidth,ur))}))},st=()=>{window.removeEventListener("mousemove",Qe),window.removeEventListener("mouseup",st),Ii.current!==null&&(cancelAnimationFrame(Ii.current),Ii.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",Qe),window.addEventListener("mouseup",st)},[]),eo=S.useCallback(()=>{const E=Et.getState();if(E.rightPinned){E.setRightPinned(!1),E.closeRight();return}if(Ir){Zn("right-sidebar");return}Is()},[Is,Zn,Ir]),Ro=S.useCallback(()=>{!or&&!o&&typeof window<"u"&&Gn.current==="right-sidebar"&&Gc(window.history.state)==="right-sidebar"&&(f0("right-sidebar-file-preview"),Xi.current="right-sidebar-file-preview"),Us(!0)},[or,o,Us]),dl=S.useCallback(()=>{Zn("right-sidebar-file-preview")},[Zn]),fo=S.useCallback(()=>{!Oe&&!o&&typeof window<"u"&&Gn.current==="right-sidebar"&&Gc(window.history.state)==="right-sidebar"&&(f0("right-sidebar-repo-picker"),Xi.current="right-sidebar-repo-picker"),yt(!0)},[Oe,o]),$a=S.useCallback(()=>{Zn("right-sidebar-repo-picker")},[Zn]),hl=S.useCallback(()=>{!ot&&!o&&typeof window<"u"&&Gn.current&&Gc(window.history.state)===Gn.current&&(f0("markdown-outline"),Xi.current="markdown-outline"),zt(!0)},[ot,o]),Rs=S.useCallback(()=>{Zn("markdown-outline")},[Zn]),ba=S.useCallback(()=>{!o&&typeof window<"u"&&Gn.current&&Gc(window.history.state)===Gn.current&&(f0("markdown-image-lightbox"),Xi.current="markdown-image-lightbox"),It(!0)},[o]),va=S.useCallback(()=>{Zn("markdown-image-lightbox")},[Zn]),Mo=S.useCallback(()=>{!o&&typeof window<"u"&&Gn.current&&Gc(window.history.state)===Gn.current&&(gH("settings"),Xi.current="settings"),Et.getState().closeAll(),hr(!0)},[o]),po=S.useCallback(()=>{Zn("settings")},[Zn]);S.useEffect(()=>{if(!Ee)return;const E=()=>Mo();return window.addEventListener("termdock:open-settings",E),()=>window.removeEventListener("termdock:open-settings",E)},[Ee,Mo]);const Mr=S.useCallback(()=>{gt(!0),se.current!==null&&(window.clearTimeout(se.current),se.current=null)},[]),vi=S.useCallback(()=>{se.current!==null&&(window.clearTimeout(se.current),se.current=null),gt(!1),Hs.current=!0,Hd(),Hs.current},[]);S.useEffect(()=>()=>{se.current!==null&&window.clearTimeout(se.current)},[]),S.useEffect(()=>{o||Hd()},[o]),S.useEffect(()=>{if(typeof window>"u"||o)return;let E=null;const Q=()=>{E!==null&&(window.clearTimeout(E),E=null)},ae=tr=>{if(Gn.current,Hs.current,Gn.current){Gn.current;return}!tr?.force&&Hs.current||(tr?.userActivated&&(Hs.current=!0),Hd(),Hs.current,void 0)},Qe=()=>{Q(),E=window.setTimeout(()=>{E=null,ae({force:!0})},ub)},st=()=>{ae({userActivated:!0})},Mt=()=>{Qe()},Zt=()=>{document.visibilityState==="visible"&&Qe()};return window.addEventListener("pointerdown",st,{capture:!0,passive:!0}),window.addEventListener("touchstart",st,{capture:!0,passive:!0}),window.addEventListener("keydown",st,{capture:!0}),window.addEventListener("pageshow",Mt),document.addEventListener("visibilitychange",Zt),()=>{Q(),window.removeEventListener("pointerdown",st,{capture:!0}),window.removeEventListener("touchstart",st,{capture:!0}),window.removeEventListener("keydown",st,{capture:!0}),window.removeEventListener("pageshow",Mt),document.removeEventListener("visibilitychange",Zt)}},[o]),S.useEffect(()=>{Gn.current=ar},[ar]),S.useEffect(()=>{if(typeof window>"u"||ar||o)return;const E=window.setTimeout(()=>{Gn.current?(Gn.current,void 0):Hd()},ub);return()=>window.clearTimeout(E)},[ar,o]),S.useEffect(()=>{if(typeof window>"u"||o)return;const E=Xi.current;Eo.current,ar&&ar!==E&&!Eo.current&&f0(ar),!ar&&E&&ds(),Xi.current=ar,!ar&&Eo.current&&window.setTimeout(()=>{Eo.current=!1},0)},[ar,o,ds]),S.useEffect(()=>{if(typeof window>"u"||o)return;const E=()=>{const Q=Gn.current;if(Hs.current,!Q){Hs.current=!1,Hs.current,Mr(),_w();return}Eo.current=!0,yi(Q)};return window.addEventListener("popstate",E),()=>window.removeEventListener("popstate",E)},[yi,Mr,o]),S.useEffect(()=>{const E=Q=>{const ae=Q.metaKey||Q.ctrlKey;if(ae&&Q.key==="b"&&!Q.shiftKey&&(Q.preventDefault(),Ji()),ae&&Q.shiftKey&&Q.key==="E"&&(Q.preventDefault(),eo()),ae&&Q.shiftKey&&Q.key==="P"&&(Q.preventDefault(),Xo()),ae&&!Q.shiftKey&&Q.altKey&&(Q.key==="ArrowLeft"||Q.key==="ArrowRight")){Q.preventDefault();const Qe=Q.key==="ArrowRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:Qe}}));return}if(ae&&Q.shiftKey&&!Q.altKey&&(Q.code==="BracketLeft"||Q.code==="BracketRight")){Q.preventDefault();const Qe=Q.code==="BracketRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:Qe}}));return}};return document.addEventListener("keydown",E),()=>{document.removeEventListener("keydown",E)}},[Ji,eo,Xo]);const Ms=S.useCallback(async()=>{ie(!0),xe(null);try{const E=await gi({localAccess:{name:te}});q(E.localAccess),ve(E.localAccess.name),Hn(d0,{preventSleep:E.preventSleep,networkAvailable:E.networkAvailable,localAccess:E.localAccess})}catch(E){xe(E instanceof Error?E.message:"Failed to save local access name")}finally{ie(!1)}},[te]),Ua=S.useCallback(async()=>{ie(!0),xe(null);try{const E=await gi({localAccess:{reset:!0}});q(E.localAccess),ve(E.localAccess.name),Hn(d0,{preventSleep:E.preventSleep,networkAvailable:E.networkAvailable,localAccess:E.localAccess})}catch(E){xe(E instanceof Error?E.message:"Failed to reset local access name")}finally{ie(!1)}},[]),No=S.useCallback(async(E,Q="url")=>{if(E)try{if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(E);else{const ae=document.createElement("textarea");ae.value=E,ae.style.position="fixed",ae.style.left="-9999px",document.body.appendChild(ae),ae.focus(),ae.select(),document.execCommand("copy"),document.body.removeChild(ae)}K(Q),window.setTimeout(()=>K(ae=>ae===Q?null:ae),1600)}catch{K(null)}},[]),Ri=S.useCallback(E=>{const Q=yH(Ne,E);Q.map(ae=>ae.id).join("\0")!==Ne.map(ae=>ae.id).join("\0")&&(Pn(Q),window.dispatchEvent(new CustomEvent("reorder-terminal-session",{detail:{sessionIds:Q.map(ae=>ae.id)}})))},[Ne]),fl=S.useCallback(E=>{Ht||E.type!=="session"||(Nn.current=!1,us(!1),br(E.draggableId))},[Ht]),pl=S.useCallback(E=>{if(Ht||E.type!=="session")return;const Q=E.destination?.droppableId===lg;Q!==Nn.current&&(Nn.current=Q,us(Q),Q&&navigator.vibrate?.(20))},[Ht]),fs=S.useCallback(E=>{const Q=nH(E,!Ht);if(Nn.current=!1,us(!1),br(null),!Q)return!1;const ae=Ne.find(st=>st.id===E.draggableId),Qe=ae?tn.get(ae.id):null;return ae&&hy({mode:ae.mode,activeProgram:Qe?.activeProgram??null,promptState:Qe?.promptState??null,shellNames:vo})?(U(null),Wr(ae.id),Ie(null)):ae&&window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:{sessionId:ae.id,source:"other",closeMode:ae.mode==="tmux"?"destroy":"auto"}})),!0},[Ht,Ne,tn]),oi=S.useCallback(E=>{if(fs(E)||!E.destination||E.source.index===E.destination.index)return;const Q=[...Ne],[ae]=Q.splice(E.source.index,1);Q.splice(E.destination.index,0,ae),Ri(Q.map(Qe=>Qe.id))},[Ri,fs,Ne]),wi=S.useCallback((E,Q)=>{const ae=Q.trim();ae&&window.dispatchEvent(new CustomEvent("rename-terminal-session",{detail:{sessionId:E,name:ae}}))},[]),to=S.useCallback(E=>{window.dispatchEvent(new CustomEvent("reset-terminal-session-name",{detail:{sessionId:E}}))},[]),{newSessionMode:qr,newSessionTmuxName:vs,userSelectedNewSessionMode:Mi,setNewSessionMode:zs}=XF(),[Yr,Lr]=S.useState(null),[Ni,ai]=_.useState(!1),[mo,Ai]=_.useState(!1),[Di,oe]=_.useState("idle"),De=_.useRef(lo(Ud,aH)).current,[Ve,mt]=_.useState(()=>{const E=De?.presets;if(E&&E.length>0){const Q=Jc(E);if(Q.length>0)return Q}return Q0()}),[Re,At]=_.useState(!1),[gn,Mn]=_.useState("default"),Wn=_.useRef(typeof De?.updatedAt=="number"?De.updatedAt:null),wn=_.useRef(!1),[Qr,lr]=_.useState(!1),[Zr,Jn]=_.useState(!1),wa=_.useRef(lo(ao,oH)).current,[Nr,Gs]=_.useState(wa??[]),[$l,I]=_.useState(wa!==null),[O,F]=_.useState(!1),V=!ar&&!mo&&!Ni&&!Qr&&!Zr&&!it&&!Dn&&!Yr,Me=_.useCallback(E=>{const Q=typeof E.version=="number"?E.version:0,ae=lH(Array.isArray(E.presets)?E.presets:[],Q);Wn.current=typeof E.updatedAt=="number"?E.updatedAt:null,mt(Qe=>gN(Qe,ae)?Qe:(wn.current=!0,ae)),Hn(Ud,{version:b0,presets:ae,updatedAt:Wn.current??void 0})},[]);S.useEffect(()=>{const E=Q=>{if(Q.key!=="Escape")return;if(mo){Q.preventDefault(),Ai(!1);return}if(Ni){Q.preventDefault(),ai(!1);return}if(Qr){Q.preventDefault(),lr(!1);return}if(Zr){Q.preventDefault(),Jn(!1);return}if(it){Q.preventDefault(),nt();return}if(ct){Q.preventDefault(),Ze(null),Pt(null);return}if(Be){Q.preventDefault(),po();return}if(Ir&&!(ri&&Ht)){Q.preventDefault(),Zn("right-sidebar");return}Jr&&!(rr&&Ht)&&(Q.preventDefault(),Zn("left-sidebar"))};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[mo,Ni,Qr,it,nt,Be,Ir,ri,Jr,rr,Ht,po,Zn]),S.useEffect(()=>{I(!0)},[]);const[Ce,Xe]=_.useState({genericProgramNames:[],wrapperScriptNames:[],shellNames:Lw}),[,Ye]=_.useState(!1),ft=_.useCallback(()=>BT().then(E=>{Xe(E),vo=new Set(E.shellNames),Ye(!0)}).catch(()=>{}),[]);S.useEffect(()=>{ft()},[ft]),S.useEffect(()=>Om(E=>{if(E.type==="config-updated"){if(E.key==="toolbar-presets"){h2().then(Q=>Me(Q)).catch(Q=>{console.warn("[toolbar-presets] Failed to refresh after remote update:",Q)});return}E.key==="program-detection"&&ft()}}),[Me,ft]),S.useEffect(()=>{let E=!1;return(async()=>{try{const Q=await h2();if(E)return;Me(Q)}catch(Q){console.warn("[toolbar-presets] Failed to load from server:",Q)}finally{E||At(!0)}})(),()=>{E=!0}},[Me]),S.useEffect(()=>{if(Re){if(wn.current){wn.current=!1;return}Hn(Ud,{version:b0,presets:Ve,updatedAt:Wn.current??void 0}),yT({version:b0,presets:Ve,baseUpdatedAt:Wn.current??void 0}).then(E=>{Wn.current=typeof E.updatedAt=="number"?E.updatedAt:null,Hn(Ud,{version:b0,presets:Ve,updatedAt:Wn.current??void 0})}).catch(E=>{const Q=E instanceof Error&&"current"in E?E.current:null;Q&&typeof Q=="object"&&Me(Q),console.warn("[toolbar-presets] Failed to save to server:",E)})}},[Me,Ve,Re]),S.useEffect(()=>{uu().then(E=>{b(Q=>Q===E.preventSleep?Q:E.preventSleep),T(Q=>Q===E.networkAvailable?Q:E.networkAvailable),q(E.localAccess),ve(E.localAccess.name),Es(E.runningSessionButtonEnabled),Hn(h0,E.runningSessionButtonEnabled),Hn(d0,{preventSleep:E.preventSleep,networkAvailable:E.networkAvailable,localAccess:E.localAccess})}).catch(()=>{})},[]),S.useEffect(()=>{if(!A)return;const E=zf();H(E),E!=="granted"&&(L(!1),gd(!1))},[A]),S.useEffect(()=>{if(!A)return;Vc();const E=()=>{document.visibilityState==="visible"&&(Vc(),WS())},Q=window.setInterval(()=>{Vc()},360*60*1e3);return document.addEventListener("visibilitychange",E),window.addEventListener("focus",E),()=>{window.clearInterval(Q),document.removeEventListener("visibilitychange",E),window.removeEventListener("focus",E)}},[A]);const cn=S.useCallback(async()=>{if(A){L(!1),gd(!1),GS(),H(zf());return}const E=await FS();if(H(E),E!=="granted"){L(!1),gd(!1);return}L(!0),gd(!0),await Vc(!0,!0),oe("idle")},[A]),er=S.useCallback(async()=>{oe("checking"),await Qs()?.prepareNotificationTest?.();const E=await Vd({title:"Termdock",body:e("settings.notificationsTestBody"),tag:"termdock-notification-test",requireHidden:!1,data:{url:"/"}});oe(E?"delivered":"failed")},[e]),cr=S.useCallback(E=>{D(E),PS(E),Gf()},[]),pr=S.useCallback(E=>{j(E),QS(E),Gf()},[]),Jt=S.useCallback(E=>{$(E),OS(E),Gf()},[]);S.useEffect(()=>{Ve.some(E=>E.id===gn)||Mn(Ve[0]?.id??"default")},[gn,Ve]),S.useEffect(()=>{if(!$n.available&&qr==="tmux"){zs("shell",{userInitiated:!1});return}$n.available&&Mi!=="shell"&&qr!=="tmux"&&zs("tmux",{userInitiated:!1})},[qr,$n.available,Mi,zs]),S.useEffect(()=>{Lr(null)},[Be,qr,$n.available]),S.useEffect(()=>{const E={};typeof navigator<"u"&&(E.userAgent=navigator.userAgent,E.platform=navigator.platform,E.maxTouchPoints=navigator.maxTouchPoints,E.hasTouch=navigator.maxTouchPoints>0||"ontouchstart"in window,E.vendor=navigator.vendor),typeof window<"u"&&(E.screenWidth=window.innerWidth,E.screenHeight=window.innerHeight,E.pixelRatio=window.devicePixelRatio,E.orientation=window.screen?.orientation?.type||"unknown",E.hasVisualViewport=!!window.visualViewport,E.visualViewportHeight=window.visualViewport?.height,E.visualViewportWidth=window.visualViewport?.width,E.location=window.location.href),E.timestamp=new Date().toISOString(),E.isIOS=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,E.isAndroid=/Android/.test(navigator.userAgent),Je(E)},[]);const{groups:Ln}=_.useMemo(()=>iv(Ne,E=>tn.get(E.id)?.cwd??null,an,e("sidebar.ungrouped")),[Ne,tn,an,e]),ps=S.useCallback(E=>{if(fs(E)||!E.destination)return;if(E.type==="group"){if(E.source.index===E.destination.index)return;Ri(sv(Ln,E.source.index,E.destination.index));return}if(E.source.droppableId!==E.destination.droppableId||E.source.index===E.destination.index)return;const Q=E.source.droppableId.replace(/^group-sessions:/,"");Ri(aM(Ln,Q,E.source.index,E.destination.index))},[Ln,Ri,fs]),zr=_.useMemo(()=>Ln.length>0?Ln.flatMap(E=>E.sessions):Ne,[Ln,Ne]),Bi=_.useMemo(()=>zr.flatMap(E=>{const Q=tn.get(E.id);if(Q?.agentStatus!=="working")return[];const{primary:ae,secondary:Qe}=tl(E,Q?.activeProgram??null,Q?.cwd??null,vo,Q?.shellTitle??null,Q?.promptState??null);return[{id:E.id,label:ae,detail:Qe}]}),[zr,tn]),Kr=dt?zr.findIndex(E=>E.id===dt):-1,ml=zr.length>0&&Kr>=0?`${Kr+1}/${zr.length}`:`${zr.length}`,ws=_.useMemo(()=>{let E=0;for(const Q of Ne){const ae=tn.get(Q.id);(ae?.agentStatus==="waiting"||ae?.agentNeedsReview)&&(E+=1)}return{running:Bi.length,review:E}},[Bi.length,Ne,tn]),Ws=dt?Ne.find(E=>E.id===dt)??null:null,Aa=Ws?tn.get(Ws.id):void 0,wc=!!(Ws&&Aa?.agentResumeRecovered&&Aa.agentNativeSessionId&&Aa.terminalSessionId),Ti=Ws&&fn?.sessionId===Ws.id?fn:null;_.useLayoutEffect(()=>{if(!Fn)return;const E=ke.current;if(!E)return;const Q=!ht.current;E.scrollIntoView({inline:"nearest",block:"nearest",behavior:Q?"auto":"smooth"}),ht.current=!0,Q&&eu("active-tab-positioned")},[dt,Fn]),S.useEffect(()=>{et&&ee.current&&(ee.current.scrollIntoView({block:"nearest",inline:"nearest"}),ee.current.focus(),ee.current.select()),et||(fe.current=!1)},[et]);const Ac=S.useCallback(E=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:E}))},[]),Tc=S.useCallback((E,Q)=>{mn(Q??null),pn(E)},[]),J0=X6(),ea=S.useCallback(E=>{if(!E)return;Nt(E),_n.current&&wo("info","PWA_NOTIFICATION_CLICK app-focus-request",{traceId:_n.current,requestedSessionId:E,activeSessionId:dt,sessions:Ne.map(ae=>({id:ae.id,terminalSessionId:tn.get(ae.id)?.terminalSessionId??null}))}),VS(E);const Q=Ne.find(ae=>ae.id===E||tn.get(ae.id)?.terminalSessionId===E);Q?(nn.current=null,_n.current&&wo("info","PWA_NOTIFICATION_CLICK app-focus-dispatch",{traceId:_n.current,requestedSessionId:E,targetSessionId:Q.id}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:Q.id}))):(nn.current=E,_n.current&&wo("info","PWA_NOTIFICATION_CLICK app-focus-pending",{traceId:_n.current,requestedSessionId:E}))},[dt,Ne,tn]);S.useEffect(()=>{if(typeof window>"u"||typeof caches>"u")return;let E=!1;const Q=async()=>{try{const Qe=await caches.open(hH),st=await Qe.match(db);if(!st)return;await Qe.delete(db);const Mt=await st.json();if(E)return;const Zt=typeof Mt.sessionId=="string"?Mt.sessionId:null,tr=typeof Mt.traceId=="string"?Mt.traceId:null,ur=typeof Mt.clickedAt=="number"?Mt.clickedAt:0,wr=Date.now()-ur;wo("info","PWA_NOTIFICATION_CLICK app-cache-consumed",{traceId:tr,sessionId:Zt,ageMs:wr,valid:!!(Zt&&wr>=0&&wr<=hb),visibilityState:document.visibilityState}),Zt&&wr>=0&&wr<=hb&&(_n.current=tr,ea(Zt))}catch(Qe){wo("warn","PWA_NOTIFICATION_CLICK app-cache-failed",{error:Qe instanceof Error?Qe.message:String(Qe)})}finally{E||Cn(!0)}},ae=()=>{document.visibilityState==="visible"&&Q()};return Q(),document.addEventListener("visibilitychange",ae),window.addEventListener("pageshow",Q),()=>{E=!0,document.removeEventListener("visibilitychange",ae),window.removeEventListener("pageshow",Q)}},[ea]),S.useEffect(()=>{if(typeof window>"u")return;const E=new URLSearchParams(window.location.search),Q=E.get("session");if(!Q)return;wo("info","PWA_NOTIFICATION_CLICK app-url-received",{traceId:_n.current,targetSessionId:Q,href:window.location.href,visibilityState:document.visibilityState}),nn.current=Q,E.delete("session"),E.delete("_notifTrace");const ae=E.toString(),Qe=`${window.location.pathname}${ae?`?${ae}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",Qe)},[]),S.useEffect(()=>{if(typeof window>"u")return;const E=new URLSearchParams(window.location.search);if(E.get("_notif")!=="1")return;const Q=E.get("session");E.delete("_notif");const ae=E.toString(),Qe=`${window.location.pathname}${ae?`?${ae}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",Qe);const st=new BroadcastChannel("termdock:notif");let Mt=!1;const Zt=ur=>{ur.data?.type==="termdock:notif-pong"&&!Mt&&(Mt=!0,st.close(),window.close())};st.addEventListener("message",Zt),st.postMessage({type:"termdock:notif-ping",sessionId:Q});const tr=setTimeout(()=>{Mt||st.close()},500);return()=>{clearTimeout(tr),Mt||st.close()}},[]),S.useEffect(()=>{if(typeof window>"u")return;const E=new BroadcastChannel("termdock:notif"),Q=ae=>{ae.data?.type==="termdock:notif-ping"&&(E.postMessage({type:"termdock:notif-pong"}),typeof ae.data.sessionId=="string"&&ea(ae.data.sessionId))};return E.addEventListener("message",Q),()=>E.close()},[ea]),S.useEffect(()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return;const E=Q=>{const ae=Q.data;ae&&ae.type==="termdock:focus-session"&&typeof ae.sessionId=="string"?(Q.ports[0]?.postMessage({type:"termdock:focus-session-ack"}),ea(ae.sessionId)):ae?.type==="termdock:push-subscription-changed"?Vc(!0):ae?.type};return navigator.serviceWorker.addEventListener("message",E),()=>navigator.serviceWorker.removeEventListener("message",E)},[ea]),S.useEffect(()=>{const E=Q=>{const ae=Q.detail;typeof ae=="string"&&ea(ae)};return window.addEventListener("termdock:focus-session",E),()=>window.removeEventListener("termdock:focus-session",E)},[ea]),S.useEffect(()=>{const E=nn.current;if(!E)return;const Q=Ne.find(ae=>ae.id===E||tn.get(ae.id)?.terminalSessionId===E);Q?(nn.current=null,_n.current&&wo("info","PWA_NOTIFICATION_CLICK app-pending-dispatch",{traceId:_n.current,requestedSessionId:E,targetSessionId:Q.id,activeSessionId:dt}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:Q.id}))):_n.current&&wo("info","PWA_NOTIFICATION_CLICK app-pending-unmatched",{traceId:_n.current,requestedSessionId:E,activeSessionId:dt,sessions:Ne.map(ae=>({id:ae.id,terminalSessionId:tn.get(ae.id)?.terminalSessionId??null}))})},[dt,Ne,tn]);const no=_.useMemo(()=>{const E=[];for(const Q of Ne){const ae=tn.get(Q.id);(ae?.agentStatus==="waiting"||ae?.agentNeedsReview)&&E.push(Q.id)}return E},[Ne,tn]),Ta=S.useCallback(()=>{if(no.length===0)return;dt&&Bn.getState().clearAgentNeedsReview(dt);const E=dt?Ne.findIndex(ae=>ae.id===dt):-1,Q=no.find(ae=>Ne.findIndex(Qe=>Qe.id===ae)>E)??no[0];Q&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:Q}))},[no,Ne,dt]),Sc=S.useCallback(()=>{if(no.length===0)return;dt&&Bn.getState().clearAgentNeedsReview(dt);const E=dt?Ne.findIndex(ae=>ae.id===dt):Ne.length,Q=[...no].reverse().find(ae=>Ne.findIndex(Qe=>Qe.id===ae)<E)??no[no.length-1];Q&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:Q}))},[no,Ne,dt]);S.useEffect(()=>{const E=Q=>{!Q.altKey||!Q.shiftKey||Q.metaKey||Q.ctrlKey||Q.key!=="ArrowUp"&&Q.key!=="ArrowDown"||(Q.preventDefault(),Q.key==="ArrowUp"?Sc():Ta())};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[Ta,Sc]);const uf=S.useCallback(async E=>{const ae=Bn.getState().sessions.get(E)?.cwd;if(ae)try{await navigator.clipboard?.writeText(ae),hn(ae),window.setTimeout(()=>{hn(Qe=>Qe===ae?null:Qe)},1400)}catch{}},[]),df=S.useCallback(E=>{Pn(E.sessions),fr(E.activeSessionId),pe(E.splitWorkspaces),Bn.getState().setActiveSessionId(E.activeSessionId)},[]),hf=S.useCallback(()=>{Sr(!0),window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("termdock:initial-viewport-presented"))})},[]);S.useEffect(()=>{if(!_t||!dt)return;Ne.find(Q=>Q.id===_t||tn.get(Q.id)?.terminalSessionId===_t)?.id===dt&&Nt(null)},[dt,_t,Ne,tn]);const ta=S.useCallback(E=>{const Q=E?.mode??qr,ae=Q==="tmux"&&(E?.tmuxSessionName?.trim()||vs.trim())||void 0,Qe=E?.cwd||(dt?Bn.getState().sessions.get(dt)?.cwd:void 0);window.dispatchEvent(new CustomEvent("new-terminal-session",{detail:{mode:Q,tmuxSessionName:ae,cwd:Qe,command:E?.command}}))},[qr,vs,dt]),Sa=S.useCallback(async()=>{uo(!0);try{const E=await hm();if(cs(E),!E.available){ks([]);return}const Q=await dm();ks(Q)}catch{cs({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),ks([])}finally{uo(!1)}},[]),ff=S.useCallback(async E=>{Ke(E),Ie(null);try{const{cleanedSessions:Q}=await zb(E);for(const ae of Q)window.dispatchEvent(new CustomEvent("close-terminal-session-by-backend",{detail:ae}));Y(null),await Sa()}catch(Q){Ie(Q instanceof Error?Q.message:"Failed to kill tmux session")}finally{Ke(null)}},[Sa]);S.useEffect(()=>{if(!Ge)return;if(yr.find(ae=>ae.name===Ge&&(ae.connected||ae.boundFrontendSessionId))){lt(null);return}const Q=setTimeout(()=>lt(null),1e4);return()=>clearTimeout(Q)},[Ge,yr]);const Ul=S.useCallback(E=>{window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:E}))},[]),ed=S.useCallback(E=>{const Q=E??dt;Q&&window.dispatchEvent(new CustomEvent("open-terminal-split-chooser",{detail:Q}))},[dt]),Si=S.useCallback((E,Q)=>{window.dispatchEvent(new CustomEvent("set-terminal-split-direction",{detail:{sessionId:E,layout:Q}}))},[]),Cc=S.useCallback((E,Q)=>{window.dispatchEvent(new CustomEvent("reorder-terminal-split-workspace",{detail:{workspaceId:E,sessionIds:Q}}))},[]),td=S.useCallback((E,Q)=>{window.dispatchEvent(new CustomEvent("rename-terminal-split-workspace",{detail:{workspaceId:E,name:Q}}))},[]),_u=S.useCallback((E,Q)=>{window.dispatchEvent(new CustomEvent("combine-terminal-split-sessions",{detail:{primaryId:E,secondaryId:Q}}))},[]),Hl=S.useCallback((E,Q)=>{const ae=Ne.find(st=>st.id===E);if(!ae)return;const Qe=tn.get(E);if(!hy({mode:ae.mode,activeProgram:Qe?.activeProgram??null,promptState:Qe?.promptState??null,shellNames:vo})){Ul({sessionId:E,source:"sidebar",closeMode:ae.mode==="tmux"?"destroy":"auto"});return}U(Q?{x:Q.clientX,y:Q.clientY}:null),Wr(E),Ie(null)},[Ne,tn,Ul]);S.useEffect(()=>{if(!Ee)return;const E=Q=>{const ae=Q.detail;ae==="new-session"?ta():ae==="close-session"?dt&&Hl(dt):ae==="previous-session"||ae==="next-session"?window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:ae==="next-session"?"next":"prev"}})):ae==="toggle-left-sidebar"?Ji():ae==="toggle-right-sidebar"?eo():ae==="previous-attention"?Sc():ae==="next-attention"&&Ta()};return window.addEventListener("termdock:native-command",E),()=>window.removeEventListener("termdock:native-command",E)},[dt,Ee,ta,Hl,Ji,eo,Ta,Sc]);const gl=_.useMemo(()=>Ne.find(E=>E.id===Dn)??null,[Ne,Dn]),pf=_.useMemo(()=>{if(!gl)return"";const E=tn.get(gl.id);return tl(gl,E?.activeProgram??null,E?.cwd??null,vo,E?.shellTitle??null,E?.promptState??null).primary},[gl,tn]);S.useEffect(()=>{if(!Be)return;let E=!1,Q=!1;const ae=async()=>{if(!Q)try{const st=await hm();if(E||cs(st),!st.available){E||ks([]);return}const Mt=await dm();E||ks(Mt)}catch{Q=!0,E||(cs({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),ks([]))}};ae();const Qe=setInterval(()=>{ae()},4e3);return()=>{E=!0,clearInterval(Qe)}},[Be]);const nd=Yr??qr,Lu=nd==="shell",ku=nd==="tmux"&&$n.available,mf=_.useMemo(()=>Bg(yr.map(E=>({...E,id:E.name})),E=>E.cwd??null,e("sidebar.ungrouped")),[yr,e]),rd=_.useMemo(()=>yr.filter(E=>E.recoveryCandidate===!0&&!E.connected&&!E.boundFrontendSessionId).sort((E,Q)=>(Q.lastActiveAt??Q.createdAt??0)-(E.lastActiveAt??E.createdAt??0)),[yr]);S.useEffect(()=>{!Jr&&!(rr&&Ht)||Sa()},[Jr,rr,Ht,Ne.length,Sa]);const Eu=(E,Q,ae,Qe=!1)=>{const st=E.id===dt,Mt=E.id===et,Zt=tn.get(E.id),{primary:tr,secondary:ur}=tl(E,Zt?.activeProgram??null,Zt?.cwd??null,vo,Zt?.shellTitle??null,Zt?.promptState??null),wr=Oa(Zt?.cwd??null),Do=Q?ur??(wr&&wr!==tr?wr:null):null,Ar=Zt?.gitStatus,Qi=`${Zt?.cwd||E.name}${Ar?`
|
|
159
|
-
⎇ ${Ar.branch} +${Ar.added} −${Ar.removed}`:""}`,na=!!(Zt?.tuiProgress&&Zt.tuiProgress.state!=="remove"),ra=Zt?.agentStatus==="working"||na?"var(--success)":Zt?.agentStatus==="waiting"||Zt?.agentNeedsReview?"var(--warning)":Zt?.inCopyMode?"var(--tmux)":null;if(Mt&&Ht&&!ct){const go=E.customName?E.name:tr,li=(gs,sa)=>{const Ga=sa.trim();Ga?Ga!==go&&wi(gs,Ga):to(gs),Ze(null)};return u.jsx("input",{ref:gs=>{ee.current=gs},type:"text",defaultValue:go,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(go.length,5)}ch`},onKeyDown:gs=>{gs.key==="Enter"?li(E.id,gs.target.value):gs.key==="Escape"&&Ze(null)},onBlur:gs=>li(E.id,gs.target.value)})}return u.jsx("div",{ref:st?ke:null,onContextMenu:go=>{go.preventDefault(),mn({x:go.clientX,y:go.clientY}),pn(E.id)},...J0(()=>Tc(E.id)),className:Qe?`group relative inline-flex h-5 shrink-0 items-center rounded-sm text-[11px] leading-none transition ${st?"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 ${st?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:bg-surface-elevated/50 hover:text-foreground"}`,style:!Qe&&st&&ra?{boxShadow:`inset 2px 0 0 0 ${ra}`}:!Qe&&st?{boxShadow:"inset 2px 0 0 0 rgb(var(--primary-rgb, 99 102 241))"}:void 0,title:Qi,children:u.jsx("button",{type:"button",...ae??{},onClick:()=>Ac(E.id),className:`inline-flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-left ${Qe?"px-1":"py-1 pl-1 pr-1.5 sm:pl-1.5 sm:pr-2"} ${ae?"cursor-grab active:cursor-grabbing":""}`,title:Qi,children:u.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 overflow-hidden",children:[u.jsxs("span",{className:"inline-flex shrink-0 items-center",children:[pb(E.mode,Zt),Zt?.agentResumeRecovered&&u.jsx(Kc,{size:Qe?9:10,className:"-ml-0.5 shrink-0 text-[color:var(--warning)]","aria-label":e("tab.resumeAgentAvailable")}),na&&!Zt?.agentStatus&&u.jsx(Xn,{size:Qe?9:10,className:"-ml-0.5 shrink-0 animate-spin text-[color:var(--success)]"})]}),Do?u.jsxs("span",{className:"flex min-w-0 flex-col justify-center leading-[0.82rem] sm:leading-[0.85rem]",children:[u.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${Zt?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:tr}),u.jsx("span",{className:"truncate text-[9px] text-muted-foreground/80 sm:text-[9.5px]",children:Do})]}):u.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${Zt?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:tr})]})})})},_c=()=>u.jsx(sl,{droppableId:lg,type:"session",isDropDisabled:Ht,children:(E,Q)=>{const ae=vr||Q.isDraggingOver;return u.jsxs("div",{ref:E.innerRef,...E.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":!Tn,"data-mobile-session-destroy-target":"","data-active":ae?"true":"false",children:[u.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 ${Tn?ae?"scale-110 border-destructive bg-destructive text-destructive-foreground opacity-100":"scale-100 border-destructive/50 text-destructive opacity-100":"scale-75 border-transparent opacity-0"}`,children:[u.jsx(co,{size:28,strokeWidth:1.8}),u.jsx("span",{className:"px-2 text-center text-[11px] font-semibold leading-tight",children:e(ae?"tab.releaseToClose":"tab.dragToClose")})]}),E.placeholder]})}}),Pi=rr&&Ht,Ha=ri&&Ht,za=sh(nr,ln,Pi?sr:0),Lc=Ha?za+Og:0,Ca=Pi?Ne.find(E=>E.id===dt):null,ms=Ca?tn.get(Ca.id):void 0,gf=Ca?tl(Ca,ms?.activeProgram??null,ms?.cwd??null,vo,ms?.shellTitle??null,ms?.promptState??null).primary:"",xf=Pi&&ms?ms.agentStatus==="working"?"bg-gradient-to-r from-[rgb(var(--success-rgb)_/_0.08)] to-transparent":ms.agentStatus==="waiting"?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.14)] to-transparent":ms.agentNeedsReview?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.08)] to-transparent":ms.inCopyMode?"bg-gradient-to-r from-[rgb(var(--tmux-rgb)_/_0.07)] to-transparent":"":"",sd=u.jsxs("div",{className:"w-full h-full flex flex-col app-chrome-bg text-foreground",children:[u.jsx("main",{className:"relative min-h-0 flex-1 overflow-visible px-0 pb-0 pt-0",children:u.jsxs("div",{className:"flex h-full w-full min-h-0 flex-col overflow-visible app-chrome-bg",children:[u.jsxs("div",{className:`shrink-0 items-center gap-1 app-chrome-bg px-1 sm:px-1.5 transition-colors duration-500 ${Pi?"relative flex justify-end":"flex justify-between"} ${an?"h-10 sm:h-10":"h-9 sm:h-10"} ${xf}`,style:{marginRight:Lc||void 0},children:[!Pi&&u.jsxs("button",{type:"button",onClick:Ji,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")}: ${ws.running} · ${e("agent.needsReview")}: ${ws.review}`,children:[u.jsx($_,{size:14}),u.jsx(V$,{runningCount:ws.running,reviewCount:ws.review,className:"sm:hidden"})]}),Pi?u.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:Ca?u.jsxs(u.Fragment,{children:[pb(Ca.mode,ms),u.jsx("span",{className:`truncate text-[12px] font-medium ${ms?.inCopyMode?"text-[color:var(--tmux)]":"text-foreground"}`,children:gf}),ms?.agentStatus==="working"&&u.jsx("span",{title:ms?.agentMessage??void 0,children:u.jsx(Xn,{size:12,className:"shrink-0 animate-spin text-[color:var(--success)]"})}),ms?.agentStatus==="waiting"&&u.jsx("span",{title:ms?.agentMessage??void 0,children:u.jsx(dh,{size:12,className:"shrink-0 animate-bounce-y text-[color:var(--warning)]"})}),!ms?.agentStatus&&ms?.agentNeedsReview&&u.jsx("span",{title:ms?.agentMessage??void 0,children:u.jsx(Fl,{size:13,className:"shrink-0 animate-pulse text-[color:var(--warning)]"})})]}):u.jsx("span",{className:"truncate px-2 text-[12px] text-muted-foreground",children:e("sidebar.sessions")})}):an?u.jsxs(Rh,{onDragStart:fl,onDragUpdate:pl,onDragEnd:ps,children:[_c(),u.jsx(sl,{droppableId:"groups",type:"group",direction:"horizontal",children:E=>u.jsxs("div",{ref:E.innerRef,...E.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:[Ln.map((Q,ae)=>{let Qe=0,st=0;for(const ur of Q.sessions){const wr=tn.get(ur.id);wr?.agentStatus==="working"&&(Qe+=1),(wr?.agentStatus==="waiting"||wr?.agentNeedsReview)&&(st+=1)}const Mt=Q.sessions.some(ur=>ur.id===dt),Zt=bn.has(Q.key),tr=Q.key==="";return u.jsx(rl,{draggableId:`group-${Q.key||"__ungrouped__"}`,index:ae,isDragDisabled:tr,disableInteractiveElementBlocking:!0,children:(ur,wr)=>u.jsxs("div",{ref:ur.innerRef,...ur.draggableProps,className:`flex w-fit shrink-0 flex-col justify-center gap-px rounded-md py-0.5 px-1 ring-1 transition-colors ${wr.isDragging?"bg-surface-elevated ring-primary/30 shadow-lg opacity-90":Mt?"bg-primary/[0.06] ring-primary/20":"bg-surface-2/40 ring-border/10"}`,children:[u.jsxs("button",{type:"button",...tr?{}:ur.dragHandleProps,onClick:()=>Pr(Q.key),className:`flex ${Zt?"":Q.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 ${tr?"":"cursor-grab active:cursor-grabbing"} ${Mt?"text-primary/80":"text-muted-foreground/55"}`,title:Q.key||Q.label,children:[u.jsx(Vh,{size:9,className:`shrink-0 opacity-70 transition-transform ${Zt?"":"rotate-90"}`}),u.jsx("span",{className:"min-w-0 truncate",children:Q.label}),Qe>0&&u.jsx("span",{className:"ml-auto h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)]"}),st>0&&u.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] ${Qe>0?"":"ml-auto"}`})]}),Zt?u.jsx("span",{className:"flex h-5 items-center text-[10px] leading-none text-muted-foreground/50",children:e("tab.sessionCount",{count:Q.sessions.length})}):u.jsx(sl,{droppableId:`group-sessions:${Q.key}`,type:"session",direction:"horizontal",children:Do=>u.jsxs("div",{ref:Do.innerRef,...Do.droppableProps,className:"flex items-center gap-px",children:[Q.sessions.map((Ar,Qi)=>u.jsx(rl,{draggableId:Ar.id,index:Qi,disableInteractiveElementBlocking:!0,children:(na,ra)=>u.jsx("div",{ref:na.innerRef,...na.draggableProps,className:`flex shrink-0 items-center ${ra.isDragging?"opacity-70":""}`,children:Eu(Ar,!1,na.dragHandleProps,!0)})},Ar.id)),Do.placeholder]})})]})},Q.key||"__ungrouped__")}),E.placeholder,u.jsx("button",{type:"button",onClick:()=>ta(),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:u.jsx(Yi,{size:14})})]})})]}):u.jsxs(Rh,{onDragStart:fl,onDragUpdate:pl,onDragEnd:oi,children:[_c(),u.jsx(sl,{droppableId:"tabs",type:"session",direction:"horizontal",children:E=>u.jsxs("div",{ref:E.innerRef,...E.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:[Ne.map((Q,ae)=>Q.id===et?u.jsx(_.Fragment,{children:u.jsx(rl,{draggableId:Q.id,index:ae,isDragDisabled:!0,children:st=>u.jsx("div",{ref:st.innerRef,...st.draggableProps,className:"flex h-full items-center",children:Eu(Q,!0)})})},Q.id):u.jsx(_.Fragment,{children:u.jsx(rl,{draggableId:Q.id,index:ae,disableInteractiveElementBlocking:!0,children:(st,Mt)=>u.jsx("div",{ref:st.innerRef,...st.draggableProps,className:`flex h-full shrink-0 items-center ${Mt.isDragging?"opacity-70":""}`,children:Eu(Q,!0,st.dragHandleProps)})})},Q.id)),u.jsx("button",{type:"button",onClick:()=>ta(),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:u.jsx(Yi,{size:14})}),E.placeholder]})})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[ES(Ee)&&u.jsx(tH,{bridge:Ee,runningCount:ws.running,reviewCount:ws.review,labels:{switchService:e("desktopServices.switchService"),openServices:e("desktopServices.openServices"),current:e("agent.currentSession"),running:e("agent.aiRunning"),review:e("agent.needsReview"),idle:e("desktopServices.idle"),manageServices:e("desktopServices.manageServices")}}),!Pi&&ws.running>0&&u.jsx("span",{className:"hidden items-center gap-1 sm:inline-flex",children:u.jsx(mw,{count:ws.running,tone:"running",title:e("agent.aiRunning")})}),!Pi&&Ne.length>0&&u.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 ${Kr+1} of ${Ne.length}`,children:ml}),!Ha&&u.jsx("button",{type:"button",onClick:eo,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:u.jsx(H_,{size:14})})]})]}),wc&&Ws&&Aa?.terminalSessionId&&u.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:Lc||void 0},role:"status","data-testid":"agent-resume-recovery-banner",children:[u.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:!Ti?.error&&(Ti?.status==="submitting"||Ti?.status==="waiting")?u.jsx(Xn,{size:14,className:"animate-spin"}):u.jsx(Kc,{size:14})}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("div",{className:"truncate text-[12px] font-medium text-foreground",children:e("tab.resumeAgentRecoveredTitle",{agent:Aa.agent?.displayName??"Agent"})}),u.jsx("div",{className:`truncate text-[10px] sm:text-[11px] ${Ti?.error?"text-destructive":"text-muted-foreground"}`,children:Ti?.error??(Ti?.status==="submitting"?e("tab.resumeAgentSubmitting"):Ti?.status==="waiting"?e("tab.resumeAgentWaiting"):e("tab.resumeAgentRecoveredHint"))})]}),u.jsx("button",{type:"button",disabled:!Ti?.error&&(Ti?.status==="submitting"||Ti?.status==="waiting"),onClick:()=>{as(Ws.id,Aa.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:Ti?.error?e("common.retry"):e("tab.resumeAgentNow")}),u.jsx("button",{type:"button",onClick:()=>{Bn.getState().setAgentResumeRecovered(Ws.id,!1),Qn(E=>E?.sessionId===Ws.id?null:E)},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:u.jsx(Bs,{size:13})})]}),u.jsx("div",{ref:Rr,className:"min-h-0 flex-1 flex overflow-hidden app-chrome-bg",children:u.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:u.jsx(ED,{terminalSettings:Ot,colorTheme:h,toolbarPresets:Ve,showDebug:a,terminalFocusAvailable:V,defaultSessionMode:qr,defaultTmuxSessionName:vs,connectionPrioritySessionId:_t,connectionPriorityReady:Fn,desktopPinnedRightSidebar:Ha,desktopPinnedRightSidebarWidth:za,desktopPinnedLeftSidebarWidth:Pi?sr:0,desktopViewportWidth:ln,onSessionDataUpdate:df,onInitialViewportReady:hf})})})]})}),u.jsx(X$,{reviewCount:ws.review,runningSessions:Bi,activeSessionId:dt,runningButtonEnabled:Fs,isDesktopLayout:Ht,containerElement:$s,occlusionInsets:{right:Lc}}),Be&&u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"fixed inset-0 z-drawer-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm animate-fade-in cursor-default",onClick:po,"aria-label":e("settings.closeSettings")}),u.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:u.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:r,paddingBottom:s},children:[u.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:[u.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[u.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:u.jsx(cL,{size:15})}),u.jsx("h2",{id:"settings-dialog-title",className:"text-[15px] font-semibold text-foreground sm:text-[16px]",children:e("settings.title")})]}),u.jsx("button",{type:"button",onClick:po,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:u.jsx(Bs,{size:16})})]}),u.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:[u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[u.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.font")}),u.jsx("button",{type:"button",onClick:()=>je({fontSize:Math.max(8,ut-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:"−"}),u.jsx("input",{type:"range",min:"8",max:"32",value:ut,onChange:E=>je({fontSize:parseInt(E.target.value,10)}),className:"min-w-0 flex-1","aria-label":e("settings.font")}),u.jsx("button",{type:"button",onClick:()=>je({fontSize:Math.min(32,ut+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:"+"}),u.jsxs("span",{className:"w-8 shrink-0 text-right text-[11px] tabular-nums text-muted-foreground",children:[ut,"px"]})]}),u.jsx("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.render")}),u.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:["auto","webgl","canvas"].map(E=>{const Q=un===E;return u.jsx("button",{type:"button",onClick:()=>je({rendererMode:E}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${Q?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:e(E==="auto"?"settings.auto":E==="webgl"?"settings.webgl":"settings.canvas")},E)})})]})}),u.jsx("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.theme")}),u.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:[["dark",Q_,e("settings.darkTheme")],["light",fL,e("settings.lightTheme")]].map(([E,Q,ae])=>{const Qe=h===E;return u.jsxs("button",{type:"button",onClick:()=>p(E),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition ${Qe?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:[u.jsx(Q,{size:12}),u.jsx("span",{children:ae})]},E)})})]})}),u.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[u.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.newTab")}),u.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:["shell","tmux"].map(E=>{const Q=qr===E,ae=E==="tmux"&&!$n.available;return u.jsx("button",{type:"button",disabled:ae,onClick:()=>zs(E,{userInitiated:!0}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${Q?"bg-primary/20 text-primary":ae?"cursor-not-allowed text-muted-foreground/40":"text-muted-foreground hover:bg-surface-elevated"}`,title:ae?$n.reason||e("settings.installTmuxHint"):void 0,children:e(E==="shell"?"settings.shell":"settings.tmux")},E)})})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[u.jsxs("button",{type:"button",onClick:()=>d(!a),className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${a?"bg-primary/15 text-primary":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,children:[u.jsx("span",{className:"font-medium",children:e("settings.debug")}),u.jsx(nl,{checked:a,size:"sm"})]}),u.jsxs("button",{type:"button",onClick:async()=>{const E=!y;b(E);try{const Q=await gi({preventSleep:E});b(Q.preventSleep),T(Q.networkAvailable),q(Q.localAccess),Hn(d0,{preventSleep:Q.preventSleep,networkAvailable:Q.networkAvailable,localAccess:Q.localAccess})}catch{b(!E)}},className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${y?"bg-[rgb(var(--success-rgb)_/_0.15)] text-[color:var(--success)]":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:!v&&y?e("settings.noSleepUnavailable"):void 0,children:[u.jsx("span",{className:"font-medium truncate",children:e("settings.noSleep")}),u.jsx(nl,{checked:y,size:"sm"})]})]})]}),u.jsxs("button",{type:"button",onClick:()=>Ai(!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:[u.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[u.jsx(RC,{size:14,className:A?"shrink-0 text-primary":"shrink-0 text-muted-foreground"}),u.jsxs("span",{className:"min-w-0",children:[u.jsx("span",{className:"block font-medium text-foreground",children:e("settings.notifications")}),u.jsx("span",{className:"block truncate text-[10px] text-muted-foreground",children:e(A?R&&B?"settings.notificationsBothOnSummary":R?"settings.notificationsAiOnSummary":B?"settings.notificationsExitOnSummary":"settings.notificationsNoEventsSummary":"settings.notificationsOffSummary")})]})]}),u.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[11px] text-muted-foreground",children:[u.jsx("span",{children:e(A?"common.on":"common.off")}),u.jsx("span",{children:"›"})]})]}),u.jsxs("details",{className:"mt-3 rounded-xl bg-surface-2 px-3 py-3",open:!1,children:[u.jsxs("summary",{className:"flex cursor-pointer items-start justify-between gap-2 list-none",children:[u.jsxs("div",{children:[u.jsx("div",{className:"text-[12px] font-medium text-foreground/90",children:e("settings.localAccess")}),u.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:e("settings.localAccessHint")})]}),u.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] ${ye.status==="active"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:ye.status})]}),u.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:[u.jsx("input",{value:te,onChange:E=>ve(E.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}),u.jsx("span",{className:"shrink-0 border-l border-border/10 px-2.5 py-2 text-[11px] text-muted-foreground",children:".termdock.local"})]}),u.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[u.jsx("button",{type:"button",disabled:ge,onClick:()=>{Ms()},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(ge?"settings.saving":"common.save")}),u.jsx("button",{type:"button",disabled:ge,onClick:()=>{Ua()},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")})]}),u.jsxs("div",{className:"mt-3 space-y-1.5 text-[11px]",children:[ye.url&&u.jsxs("button",{type:"button",onClick:()=>{No(ye.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:[u.jsxs("span",{className:"min-w-0 truncate",children:["Branded: ",ye.url]}),u.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium",children:ce==="lan"?"Copied":e("common.copy")})]}),ye.interfaces.length>0&&u.jsxs("details",{className:"rounded-lg bg-surface px-2.5 py-2 text-muted-foreground",open:!1,children:[u.jsx("summary",{className:"cursor-pointer text-[11px] font-medium text-foreground/80",children:"IP fallback addresses"}),u.jsx("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-2",children:ye.interfaces.map(E=>{const Q=E.url??`${ye.httpsEnabled?"https":"http"}://${E.address}:9834`;return u.jsxs("div",{className:"rounded-lg bg-surface-2 p-2",children:[u.jsxs("div",{className:"text-[11px] font-medium text-foreground/85",children:[E.label," (",E.name,")"]}),u.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:E.address}),E.qrDataUrl&&u.jsx("div",{className:"mt-2 inline-block rounded-lg bg-[var(--background)] p-1.5",children:u.jsx("img",{src:E.qrDataUrl,alt:`QR code for ${Q}`,className:"h-28 w-28"})}),u.jsxs("button",{type:"button",onClick:()=>{No(Q,`ip-${E.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:[u.jsx("span",{className:"min-w-0 truncate",children:Q}),u.jsx("span",{className:"shrink-0 text-[10px]",children:ce===`ip-${E.address}`?"Copied":e("common.copy")})]})]},`${E.name}-${E.address}`)})})]}),ye.onboardingUrl&&u.jsxs("button",{type:"button",onClick:()=>{No(ye.onboardingUrl,"setup")},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:[u.jsxs("span",{className:"min-w-0 truncate",children:[e("settings.onboardingUrl"),": ",ye.onboardingUrl]}),u.jsx("span",{className:"shrink-0 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-medium",children:ce==="setup"?"Copied":e("common.copy")})]}),u.jsxs("div",{className:"text-muted-foreground",children:[ye.httpsEnabled?e("settings.httpsActive"):e("settings.httpsInactive"),!ye.caAvailable&&` · ${e("settings.caMissing")}`]}),ye.reason&&u.jsx("div",{className:"text-[color:var(--warning)]",children:ye.reason}),Ae&&u.jsx("div",{className:"text-destructive",children:Ae})]})]}),u.jsx(eH,{state:be,pending:We,onCheck:()=>{$r()},onConfirmRestart:()=>{_s()},desktopState:Tt?X:void 0,desktopPending:qe,onCheckDesktop:()=>{Ls()},onInstallDesktop:()=>{ko()}}),Ee&&u.jsxs("div",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2",children:[u.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border/10 px-3 py-3",children:[u.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[u.jsx("span",{className:"mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/15 text-primary",children:u.jsx(wC,{size:15})}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[12px] font-medium text-foreground",children:e("settings.desktopTitle")}),u.jsx("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:Rt?`App ${Rt.appVersion} · CLI ${Rt.bundledCliVersion}`:e("settings.desktopStatusLoading")})]})]}),u.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary",children:"macOS"})]}),u.jsxs("div",{className:"grid grid-cols-1 gap-px bg-border/10 sm:grid-cols-3",children:[u.jsxs("button",{type:"button",onClick:()=>{Ee.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:[u.jsx(PC,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopSwitchService")]}),u.jsxs("button",{type:"button",onClick:()=>{$e(null),Ee.installCli().then(E=>{ze(E),$e(e("settings.desktopCliUpdated"))}).catch(E=>$e(E instanceof Error?E.message:String(E)))},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:[u.jsx(pa,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopInstallCli")]}),u.jsxs("button",{type:"button",onClick:()=>{$e(null),Ee.revealDataDirectory().catch(E=>$e(E instanceof Error?E.message:String(E)))},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:[u.jsx(su,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopOpenDataDirectory")]})]}),J&&u.jsx("div",{className:"border-t border-border/10 px-3 py-2 text-[10px] text-muted-foreground",children:J})]}),u.jsxs("div",{className:"mt-3 flex gap-2",children:[u.jsxs("button",{type:"button",onClick:()=>{Lr(null),ta({mode:"shell"}),po()},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${Lu?"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(Yr==="shell"?"sidebar.confirmNewShell":"settings.shell"),children:[u.jsx(Yi,{size:14,className:Lu?"shrink-0":"hidden"}),u.jsx(pa,{size:12}),u.jsx("span",{className:Lu?"whitespace-nowrap":"hidden",children:e(Yr==="shell"?"sidebar.confirmNewShell":"settings.shell")})]}),u.jsxs("button",{type:"button",disabled:!$n.available,onClick:()=>{$n.available&&(Lr(null),ta({mode:"tmux"}),po())},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${$n.available?ku?"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:$n.available?e(Yr==="tmux"?"sidebar.confirmNewTmux":"settings.tmux"):$n.reason||e("settings.installTmuxHint"),children:[u.jsx(Yi,{size:14,className:ku?"shrink-0":"hidden"}),u.jsx(fu,{size:12}),u.jsx("span",{className:ku?"whitespace-nowrap":"hidden",children:e(Yr==="tmux"?"sidebar.confirmNewTmux":"settings.tmux")})]})]}),($n.available||yr.length>0)&&u.jsxs("details",{className:"mt-3 group rounded-xl bg-surface-2 [&[open]]:bg-surface-2",children:[u.jsxs("summary",{className:"flex cursor-pointer items-center justify-between rounded-xl px-3 py-2.5 text-[13px] hover:bg-surface-elevated",children:[u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx("span",{className:`inline-flex h-2 w-2 rounded-full ${$n.available?"bg-primary":"bg-destructive"}`}),u.jsx("span",{className:"font-medium",children:e("settings.tmuxServer")}),u.jsx("span",{className:"text-[11px] text-muted-foreground",children:$n.available?e("settings.sessions",{n:yr.length}):e("settings.tmuxUnavailable")})]}),u.jsx("button",{type:"button",onClick:E=>{E.preventDefault(),Sa()},disabled:si,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:u.jsx(ys,{size:12,className:si?"animate-spin":""})})]}),u.jsx("div",{className:"px-2 pb-2",children:$n.available?yr.length===0?u.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:e("settings.noTmuxSessions")}):u.jsxs("div",{className:"space-y-2",children:[mf.map(E=>u.jsxs("div",{className:"space-y-1",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-1.5 py-1 text-[10px] text-muted-foreground",children:[u.jsx(hu,{size:11,className:"shrink-0 text-muted-foreground/70"}),u.jsx("span",{className:"shrink-0 font-medium text-foreground/75",children:E.label}),u.jsx("span",{className:"shrink-0 text-muted-foreground/70",children:e("settings.sessions",{n:E.sessions.length})}),E.key&&u.jsx("span",{className:"min-w-0 truncate text-muted-foreground/60",children:E.key})]}),E.sessions.map(Q=>{const ae=Q.boundFrontendSessionId??null,Qe=!!(Q.connected||ae),st=ae?Ne.find(li=>li.id===ae)??null:null,Mt=Q.friendlyName?.trim()||null,Zt=Q.label&&Q.label!==Q.name?Q.label:null,tr=Mt||Zt||Q.name,ur=Mt||Zt?`tmux:${Q.name}`:null,wr=Q.clientCount&&Q.clientCount>0?t==="zh"?`网页连接 ${Q.clientCount}`:`Web clients ${Q.clientCount}`:null,Do=Q.attached>0?t==="zh"?`原生 tmux ${Q.attached}`:`Native tmux ${Q.attached}`:null,Ar=[ur,Qe?Q.restorable?e("settings.restorable"):e("settings.attached"):null,wr,Do].filter(li=>!!li),Qi=[e("settings.windows",{n:Q.windows}),Q.createdAt?new Date(Q.createdAt).toLocaleDateString():null].filter(li=>!!li),na=es===Q.name,ra=he===Q.name,go=Ge===Q.name;return u.jsxs("div",{className:`flex items-start gap-2 rounded-lg px-2.5 py-2 ${na?"bg-destructive/10 ring-1 ring-destructive/40":"bg-surface"}`,children:[u.jsx(fu,{size:13,className:Qe?"mt-0.5 shrink-0 text-primary":"mt-0.5 shrink-0 text-muted-foreground"}),u.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[u.jsx("div",{className:"truncate text-[12px] font-semibold text-foreground",children:tr}),Q.friendlyName&&u.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"})]}),Ar.length>0&&u.jsx("div",{className:"flex min-w-0 flex-wrap gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground",children:Ar.map(li=>u.jsx("span",{className:"max-w-full truncate",children:li},li))}),(Q.program||Q.cwd)&&u.jsxs("div",{className:"grid min-w-0 gap-0.5 text-[10px] text-muted-foreground",children:[Q.program&&u.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[u.jsx(C_,{size:10,className:"shrink-0 text-muted-foreground/70"}),u.jsx("span",{className:"truncate text-foreground/75",children:Q.program})]}),Q.cwd&&u.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[u.jsx(hu,{size:10,className:"shrink-0 text-muted-foreground/70"}),u.jsx("span",{className:"truncate",children:Q.cwd})]})]}),u.jsx("div",{className:"flex min-w-0 flex-wrap gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground/80",children:Qi.map(li=>u.jsxs("span",{className:"inline-flex items-center gap-1",children:[u.jsx(t_,{size:10,className:"shrink-0 text-muted-foreground/60"}),li]},li))})]}),na?u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",disabled:ra,onClick:()=>{ff(Q.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:ra?"…":e("settings.destroy")}),u.jsx("button",{type:"button",disabled:ra,onClick:()=>{Y(null),Ie(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")})]}):u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",onClick:()=>{st?Ac(st.id):(lt(Q.name),ta({mode:"tmux",tmuxSessionName:Q.name}))},disabled:go,className:`shrink-0 inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition disabled:opacity-50 ${Qe?"bg-surface text-foreground hover:bg-surface-elevated":go?"bg-primary/10 text-primary":"bg-primary/15 text-primary hover:bg-primary/25"}`,children:go?u.jsxs(u.Fragment,{children:[u.jsx(Xn,{size:10,className:"animate-spin"}),e("settings.attaching")]}):e(Qe?"settings.attached":"settings.attach")}),u.jsx("button",{type:"button",disabled:ra,onClick:()=>{Ie(null),Y(Q.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 ${Q.name}`,children:u.jsx(co,{size:12})})]})]},Q.name)})]},E.key||"__ungrouped_tmux__")),_e&&u.jsx("p",{className:"px-2 text-[11px] text-destructive",children:_e})]}):u.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:$n.reason||e("settings.installTmuxHint")})})]}),u.jsxs("button",{type:"button",onClick:()=>ai(!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:[u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx(k_,{size:14,className:"text-muted-foreground"}),u.jsx("span",{className:"font-medium text-foreground",children:e("settings.keyboardToolbar")})]}),u.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[u.jsx("span",{children:e("settings.sessions",{n:Ve.length})}),u.jsx("span",{children:"›"})]})]}),u.jsxs("button",{type:"button",onClick:()=>lr(!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:[u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx(Wh,{size:14,className:"text-muted-foreground"}),u.jsx("span",{className:"font-medium text-foreground",children:e("settings.aiAgentDetection")})]}),u.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[u.jsx("span",{children:"hooks"}),u.jsx("span",{children:"›"})]})]}),u.jsxs("div",{className:"mt-3 flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[u.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.language")}),u.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(E=>{const Q=t===E.code;return u.jsx("button",{type:"button",onClick:()=>n(E.code),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${Q?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:E.label},E.code)})})]}),u.jsxs("button",{type:"button",onClick:async()=>{try{await wT()}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:[u.jsx(vL,{size:14}),e("settings.signOut")]})]})]})})]}),gl&&u.jsxs(u.Fragment,{children:[u.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:()=>{Wr(null),U(null),Ie(null)},"aria-label":e("common.close")}),u.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 ${ts&&Ht?"":"inset-x-3 bottom-6 mx-auto max-w-sm sm:bottom-auto sm:top-[15%]"}`,style:ts&&Ht?{...cb(ts),paddingBottom:s}:{paddingBottom:s},children:[u.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[u.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.closeChooserTitle")}),u.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:pf}),u.jsx("div",{className:"mt-0.5 text-[11px] text-muted-foreground/80",children:e("tab.closeChooserDescription")})]}),u.jsxs("div",{className:"flex flex-col py-1",children:[u.jsxs("button",{type:"button",onClick:()=>{Ul({sessionId:gl.id,source:"sidebar",closeMode:"destroy"}),Wr(null),U(null)},className:"flex items-center gap-3 px-4 py-3 text-left text-[13px] text-destructive transition hover:bg-destructive/10",children:[u.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full bg-destructive/15 text-destructive",children:u.jsx(co,{size:14})}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block font-medium",children:e("tab.confirmDestroySession")}),u.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.destroySessionHint")})]})]}),_e&&u.jsx("p",{className:"px-4 py-2 text-[11px] text-destructive",children:_e})]}),u.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:u.jsx("button",{type:"button",onClick:()=>{Wr(null),U(null),Ie(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")})})]})]}),it&&(()=>{const E=Ne.find(wr=>wr.id===it);if(!E)return null;const Q=tn.get(E.id),{primary:ae}=tl(E,Q?.activeProgram??null,Q?.cwd??null,vo),Qe=Ht,st=Qe?cb(vt):{paddingBottom:s},Mt=Qe?"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%]",Zt=Qe?"border-b border-border/15 px-3 py-2":"border-b border-border/15 px-4 py-3",tr=Qe?"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",ur=Qe?"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 u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:`fixed inset-0 z-menu-backdrop cursor-default animate-fade-in ${Qe?"bg-transparent":"bg-[var(--app-backdrop-soft)] backdrop-blur-sm"}`,onClick:nt,"aria-label":"Close menu"}),u.jsxs("div",{className:Mt,style:st,children:[u.jsxs("div",{className:Zt,children:[u.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),u.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:ae}),Q?.cwd&&u.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/80",children:Q.cwd})]}),u.jsxs("div",{className:"flex flex-col py-1",children:[u.jsxs("button",{type:"button",onClick:()=>{const wr=vt;nt(),Pt(wr),Ze(E.id)},className:`${tr} text-foreground hover:bg-surface-2`,children:[u.jsx("span",{className:`${ur} bg-primary/15 text-primary`,children:u.jsx(V_,{size:14})}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block font-medium",children:e("tab.rename")}),u.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.renameHint")})]})]}),u.jsxs("button",{type:"button",disabled:!Q?.cwd,onClick:()=>{uf(E.id),nt()},className:`${tr} ${Q?.cwd?"text-foreground hover:bg-surface-2":"text-muted-foreground/50 cursor-not-allowed"}`,children:[u.jsx("span",{className:`${ur} bg-surface-2 text-muted-foreground`,children:u.jsx(I_,{size:14})}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block font-medium",children:e("tab.copyCwd")}),u.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.copyCwdHint")})]}),Xt&&Xt===Q?.cwd&&u.jsx("span",{className:"ml-auto text-[11px] text-primary",children:e("tab.copied")})]}),Q?.agentNativeSessionId&&Q.agentStatus!=="working"&&Q.agentStatus!=="waiting"&&Q.terminalSessionId&&u.jsxs("button",{type:"button",onClick:()=>{const wr=Q.terminalSessionId;wr&&(nt(),as(E.id,wr))},className:`${tr} text-foreground hover:bg-surface-2`,children:[u.jsx("span",{className:`${ur} bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)]`,children:u.jsx(Kc,{size:14})}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsxs("span",{className:"block font-medium",children:[e("tab.resumeAgent"),Q.agent?.displayName?` · ${Q.agent.displayName}`:""]}),u.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.resumeAgentHint")})]})]}),u.jsx("div",{className:"my-1 border-t border-border/15"}),E.mode==="tmux"?u.jsxs("button",{type:"button",onClick:()=>{nt(),Hl(E.id)},className:`${tr} text-destructive hover:bg-destructive/10`,children:[u.jsx("span",{className:`${ur} bg-destructive/15 text-destructive`,children:u.jsx(co,{size:14})}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block font-medium",children:e("tab.destroySession")}),u.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.destroySessionHint")})]})]}):u.jsxs("button",{type:"button",onClick:()=>{nt(),Ul({sessionId:E.id,source:"tab-menu",closeMode:"auto"})},className:`${tr} text-destructive hover:bg-destructive/10`,children:[u.jsx("span",{className:`${ur} bg-destructive/15 text-destructive`,children:u.jsx(Bs,{size:14})}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block font-medium",children:e("tab.close")}),u.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.closeHint")})]})]}),!Qe&&u.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:()=>{nt()},children:e("tab.longPressTip")})]}),!Qe&&u.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:u.jsx("button",{type:"button",onClick:nt,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")})})]})]})})(),et&&ct&&Ht&&(()=>{const E=Ne.find(Ar=>Ar.id===et);if(!E)return null;const Q=tn.get(E.id),{primary:ae}=tl(E,Q?.activeProgram??null,Q?.cwd??null,vo,Q?.shellTitle??null,Q?.promptState??null),Qe=E.customName?E.name:ae,st=Ar=>{const Qi=Ar.trim();Qi?Qi!==Qe&&wi(E.id,Qi):to(E.id),Ze(null),Pt(null)},Mt=300,Zt=160,tr=ct.x,ur=ct.y,wr=Math.min(Math.max(tr-Mt/2,12),window.innerWidth-Mt-12),Do=ur+Zt+20>window.innerHeight?Math.max(ur-Zt-12,12):ur+12;return u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop cursor-default animate-fade-in bg-transparent",onClick:()=>{Ze(null),Pt(null)},"aria-label":e("common.cancel")}),u.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:`${wr}px`,top:`${Do}px`},children:[u.jsxs("div",{className:"border-b border-border/15 px-3 py-2.5",children:[u.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.rename")}),u.jsx("div",{className:"mt-0.5 truncate text-[13px] font-medium text-foreground",children:ae}),Q?.cwd&&u.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/70",children:Q.cwd})]}),u.jsxs("form",{className:"px-3 py-2.5",onSubmit:Ar=>{Ar.preventDefault();const Qi=new FormData(Ar.currentTarget).get("session-name");st(typeof Qi=="string"?Qi:"")},children:[u.jsx("input",{ref:Ar=>{ee.current=Ar,Ar&&!fe.current&&(fe.current=!0,Ar.focus({preventScroll:!0}),Ar.select())},type:"text",name:"session-name",defaultValue:Qe,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:Ar=>{Ar.key==="Escape"&&(Ar.stopPropagation(),Ze(null),Pt(null))}}),u.jsxs("div",{className:"mt-2.5 flex gap-2",children:[u.jsx("button",{type:"button",onClick:()=>{Ze(null),Pt(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")}),u.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")})]})]})]})]})})(),et&&!Ht&&(()=>{const E=Ne.find(Mt=>Mt.id===et);if(!E)return null;const Q=tn.get(E.id),{primary:ae}=tl(E,Q?.activeProgram??null,Q?.cwd??null,vo,Q?.shellTitle??null,Q?.promptState??null),Qe=E.customName?E.name:ae,st=Mt=>{const Zt=Mt.trim();Zt?Zt!==Qe&&wi(E.id,Zt):to(E.id),Ze(null)};return u.jsxs(u.Fragment,{children:[u.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:()=>Ze(null),"aria-label":e("common.cancel")}),u.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(${r} + 3.5rem)`},children:[u.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[u.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),u.jsx("div",{className:"mt-0.5 text-[14px] font-medium text-foreground",children:e("tab.rename")})]}),u.jsxs("form",{className:"px-4 py-3",onSubmit:Mt=>{Mt.preventDefault();const Zt=new FormData(Mt.currentTarget).get("session-name");st(typeof Zt=="string"?Zt:"")},children:[u.jsx("input",{ref:Mt=>{ee.current=Mt,Mt&&!fe.current&&(fe.current=!0,Mt.focus({preventScroll:!0}),Mt.select())},type:"text",name:"session-name",defaultValue:Qe,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:Mt=>{Mt.key==="Escape"&&(Mt.stopPropagation(),Ze(null))}}),u.jsxs("div",{className:"mt-3 flex gap-2",children:[u.jsx("button",{type:"button",onClick:()=>Ze(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")}),u.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")})]})]})]})]})})(),mo&&u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>Ai(!1)}),u.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:[u.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"ui-kicker",children:e("settings.notifications")}),u.jsx("h2",{className:"section-title mt-1",children:e("settings.notificationsTitle")})]}),u.jsx("button",{type:"button",onClick:()=>Ai(!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:u.jsx(Bs,{size:18})})]}),u.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:[u.jsx("p",{className:"text-[12px] leading-relaxed text-muted-foreground",children:e("settings.notificationsPageHint")}),u.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[u.jsxs("div",{className:"flex items-start justify-between gap-3",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsMaster")}),u.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:z==="denied"?e("settings.notificationsDenied"):sc()?e("settings.notificationsMasterHint"):e("settings.notificationsUnsupported")}),sc()&&!a3()&&u.jsx("div",{className:"mt-1.5 text-[11px] leading-relaxed text-[var(--warning)]",children:e("settings.notificationsIOSInstallHint")})]}),u.jsx("button",{type:"button",onClick:()=>{cn()},disabled:!sc()||z==="denied",className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":A,children:u.jsx(nl,{checked:A,disabled:!sc()||z==="denied"})})]}),u.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-[11px]",children:[u.jsxs("span",{className:`rounded-full px-2 py-0.5 ${z==="granted"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:[e("settings.notificationsPermission"),": ",Qs()?e("settings.notificationsPermissionSystem"):z]}),u.jsx("button",{type:"button",disabled:!A||z!=="granted"||Di==="checking",onClick:()=>{er()},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(Di==="checking"?"settings.notificationsTestChecking":"settings.notificationsTest")}),Qs()?.openNotificationSettings&&u.jsx("button",{type:"button",onClick:()=>{Qs()?.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")})]}),Di!=="idle"&&Di!=="checking"&&u.jsx("div",{className:`mt-2 text-[11px] leading-relaxed ${Di==="delivered"?"text-primary":"text-[var(--warning)]"}`,children:e(Di==="delivered"?"settings.notificationsTestDelivered":"settings.notificationsTestFailed")})]}),u.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[u.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAlertStyle")}),u.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAlertStyleHint")}),u.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(([E,Q,ae])=>{const Qe=P===E;return u.jsxs("button",{type:"button",disabled:!A,onClick:()=>Jt(E),className:`min-w-0 rounded-lg px-2 py-2 text-left transition ${Qe&&A?"bg-primary/15 text-primary":A?"text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"cursor-not-allowed text-muted-foreground/40"}`,title:ae,children:[u.jsx("span",{className:"block truncate text-[11px] font-semibold",children:Q}),u.jsx("span",{className:"mt-0.5 block truncate text-[9px] opacity-80",children:ae})]},E)})})]}),u.jsxs("div",{className:"mt-4",children:[u.jsx("div",{className:"ui-kicker",children:e("settings.notificationsEvents")}),u.jsxs("div",{className:"mt-2 rounded-2xl bg-surface-2 p-3",children:[u.jsxs("div",{className:"flex items-start justify-between gap-3",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAiFinished")}),u.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAiFinishedHint")})]}),u.jsx("button",{type:"button",disabled:!A,onClick:()=>cr(!R),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":R&&A,children:u.jsx(nl,{checked:R&&A,disabled:!A})})]}),u.jsxs("div",{className:"mt-3 flex items-start justify-between gap-3 border-t border-border/10 pt-3",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsSessionExited")}),u.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsSessionExitedHint")})]}),u.jsx("button",{type:"button",disabled:!A,onClick:()=>pr(!B),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":B&&A,children:u.jsx(nl,{checked:B&&A,disabled:!A})})]})]}),u.jsx("p",{className:"mt-2 text-[10px] text-muted-foreground",children:e("settings.notificationsFutureHint")})]})]})]})]}),Ni&&u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>ai(!1)}),u.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:[u.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"ui-kicker",children:e("settings.mobileKeyboard")}),u.jsx("h2",{className:"section-title mt-1",children:e("settings.toolbarPresets")})]}),u.jsx("button",{type:"button",onClick:()=>ai(!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:u.jsx(Bs,{size:18})})]}),u.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:u.jsx(KU,{presets:Ve,selectedPresetId:gn,onSelectPreset:Mn,onUpdatePreset:(E,Q)=>{mt(ae=>Jc(ae.map(Qe=>Qe.id===E?Q(Qe):Qe)))},onAddPreset:()=>{const E=`preset-${Date.now()}`;mt(Q=>Jc([...Q,{id:E,label:`Preset ${Q.length}`,programs:[],includeAlt:!1,rowLayout:[3,3],actions:[],showOnDesktop:!1}])),Mn(E)},onRemovePreset:E=>{mt(Q=>Jc(Q.filter(ae=>ae.id!==E)))},onResetDefaults:()=>{mt(Q0()),Mn("default")}})})]})]}),Qr&&u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>lr(!1)}),u.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:[u.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"ui-kicker",children:e("settings.aiAgentDetection")}),u.jsx("h2",{className:"section-title mt-1",children:e("settings.detectionRules")})]}),u.jsx("div",{className:"flex items-center gap-2",children:u.jsx("button",{type:"button",onClick:()=>lr(!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:u.jsx(Bs,{size:18})})})]}),u.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:[u.jsx("p",{className:"mb-4 text-[11px] text-muted-foreground",children:e("settings.agentHooksHint")}),u.jsx(JU,{}),u.jsxs("div",{className:"mt-6 border-t border-border/15 pt-4",children:[u.jsx("div",{className:"ui-kicker",children:e("settings.programLabelResolution")}),u.jsx("h3",{className:"mt-1 text-sm font-semibold text-foreground",children:e("settings.rawCommandMapping")}),u.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:e("settings.rawCommandMappingHint")}),u.jsx("div",{className:"mt-3 space-y-2 rounded-xl bg-surface-2 p-3",children:Ne.map(E=>{const Q=tn.get(E.id),ae=Q?.activeProgramRaw??null,Qe=Q?.activeProgram??null;return u.jsxs("div",{className:"rounded-lg bg-surface/60 px-2.5 py-2",children:[u.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:E.name}),u.jsxs("div",{className:"mt-0.5 text-[11px] text-foreground",children:[u.jsx("span",{className:"text-muted-foreground",children:"display:"})," ",Qe||"—"]}),u.jsxs("div",{className:"mt-0.5 break-all font-mono text-[10px] text-muted-foreground",children:[u.jsx("span",{className:"text-muted-foreground/80",children:"raw:"})," ",ae||"—"]})]},`raw-${E.id}`)})}),u.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:E,label:Q,hint:ae})=>u.jsxs("div",{children:[u.jsx("div",{className:"mb-0.5 text-[11px] font-medium text-foreground",children:Q}),u.jsx("div",{className:"text-[10px] text-muted-foreground",children:ae}),u.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[Ce[E].map(Qe=>u.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:[Qe,u.jsx("button",{type:"button",onClick:()=>{const st={...Ce,[E]:Ce[E].filter(Mt=>Mt!==Qe)};Xe(st),E==="shellNames"&&(vo=new Set(st.shellNames)),p2(st).catch(()=>{})},className:"ml-0.5 text-muted-foreground hover:text-destructive",children:"×"})]},Qe)),u.jsx("input",{placeholder:e("settings.addTag"),className:"w-16 rounded bg-surface px-1.5 py-0.5 text-[11px] font-mono",onKeyDown:Qe=>{if(Qe.key!=="Enter")return;const st=Qe.target.value.trim().toLowerCase();if(!st||Ce[E].includes(st))return;const Mt={...Ce,[E]:[...Ce[E],st]};Xe(Mt),E==="shellNames"&&(vo=new Set(Mt.shellNames)),Qe.target.value="",p2(Mt).catch(()=>{})}})]})]},E)),u.jsx("button",{type:"button",onClick:()=>{PT().then(E=>{Xe(E),vo=new Set(E.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")})]}),u.jsxs("div",{className:"mt-3",children:[u.jsx("div",{className:"mb-1 text-[11px] font-medium text-foreground",children:e("settings.customRules")}),Nr.map((E,Q)=>u.jsx("div",{className:"mb-2 rounded-lg bg-surface-2 p-2.5",children:u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx("input",{type:"checkbox",checked:E.enabled!==!1,onChange:ae=>{const Qe=Nr.map((st,Mt)=>Mt===Q?{...st,enabled:ae.target.checked}:st);Gs(Qe),Hn(ao,Qe),F(!0),Mc(Qe).then(st=>{Gs(st),Hn(ao,st)}).catch(()=>{}).finally(()=>F(!1))}}),u.jsxs("select",{value:E.matchType,onChange:ae=>{const Qe=Nr.map((st,Mt)=>Mt===Q?{...st,matchType:ae.target.value}:st);Gs(Qe),Hn(ao,Qe),F(!0),Mc(Qe).then(st=>{Gs(st),Hn(ao,st)}).catch(()=>{}).finally(()=>F(!1))},className:"rounded bg-surface px-2 py-1 text-[11px]",children:[u.jsx("option",{value:"includes",children:"includes"}),u.jsx("option",{value:"exact",children:"exact"}),u.jsx("option",{value:"prefix",children:"prefix"}),u.jsx("option",{value:"regex",children:"regex"})]}),u.jsx("input",{value:E.pattern,onChange:ae=>{const Qe=Nr.map((st,Mt)=>Mt===Q?{...st,pattern:ae.target.value}:st);Gs(Qe),Hn(ao,Qe)},onBlur:()=>{F(!0),Mc(Nr).then(ae=>{Gs(ae),Hn(ao,ae)}).catch(()=>{}).finally(()=>F(!1))},placeholder:"pattern",className:"min-w-[180px] flex-1 rounded bg-surface px-2 py-1 text-[11px] font-mono"}),u.jsx("input",{value:E.output,onChange:ae=>{const Qe=Nr.map((st,Mt)=>Mt===Q?{...st,output:ae.target.value}:st);Gs(Qe),Hn(ao,Qe)},onBlur:()=>{F(!0),Mc(Nr).then(ae=>{Gs(ae),Hn(ao,ae)}).catch(()=>{}).finally(()=>F(!1))},placeholder:"output",className:"w-28 rounded bg-surface px-2 py-1 text-[11px]"}),u.jsx("button",{type:"button",onClick:()=>{const ae=Nr.filter((Qe,st)=>st!==Q);Gs(ae),Hn(ao,ae),F(!0),Mc(ae).then(Qe=>{Gs(Qe),Hn(ao,Qe)}).catch(()=>{}).finally(()=>F(!1))},className:"rounded bg-surface px-2 py-1 text-[11px] text-muted-foreground hover:text-destructive",children:e("common.delete")})]})},E.id)),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("button",{type:"button",onClick:()=>{const E=[...Nr,{id:`rule-${Date.now()}`,enabled:!0,priority:100,matchType:"includes",pattern:"",output:""}];Gs(E),Hn(ao,E),F(!0),Mc(E).then(Q=>{Gs(Q),Hn(ao,Q)}).catch(()=>{}).finally(()=>F(!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")}),u.jsx("button",{type:"button",onClick:()=>{F(!0),DT().then(E=>{Gs(E),Hn(ao,E)}).catch(()=>{}).finally(()=>F(!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")}),u.jsx("span",{className:"text-[11px] text-muted-foreground",children:O?e("settings.saving"):$l?`${Nr.length} rules`:"…"})]})]})]})]})]})]}),Zr&&u.jsx(GU,{isOpen:Zr,onClose:()=>Jn(!1)}),!Pi&&u.jsx(tb,{isOpen:Jr,drawerWidthPx:Yt,onClose:()=>Zn("left-sidebar"),onOpen:Ei,sessions:Ne,activeSessionId:dt,sessionStates:tn,onNewSession:E=>ta(E),recoverableTmuxSessions:rd,recoverableTmuxSessionsLoading:si,onRefreshRecoverableTmuxSessions:()=>{Sa()},onCloseSession:Hl,onSplitSession:ed,onCloseSplit:E=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:E})),onRemoveFromSplit:E=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:E})),splitWorkspaces:On,onSetSplitLayout:Si,onReorderSplitWorkspace:Cc,onRenameSplitWorkspace:td,onCombineSplitSessions:_u,onReorderSessions:Ri,onSessionMenu:Tc,onOpenSettings:Mo,onOpenQuota:()=>Jn(!0),updateState:be,updateActionPending:We,onConfirmUpdateRestart:_s,onRetryUpdate:$r,tmuxAvailable:$n.available,defaultSessionMode:qr,runningSessionButtonEnabled:Fs,onRunningSessionButtonEnabledChange:js,onTogglePinned:Ht?ho:void 0}),!Ha&&u.jsx(nb,{isOpen:Ir,drawerWidthPx:vn,onClose:()=>Zn("right-sidebar"),onOpen:Is,rightSidebarFilePreviewOpen:or,rightSidebarFilePreviewCloseSignal:Le,onOpenRightSidebarFilePreview:Ro,onCloseRightSidebarFilePreview:dl,rightSidebarRepoPickerOpen:Oe,rightSidebarRepoPickerCloseSignal:de,onOpenRightSidebarRepoPicker:fo,onCloseRightSidebarRepoPicker:$a,markdownOutlineOpen:ot,markdownOutlineCloseSignal:yn,onOpenMarkdownOutline:hl,onCloseMarkdownOutline:Rs,markdownImageLightboxOpen:bt,markdownImageLightboxCloseSignal:kt,onOpenMarkdownImageLightbox:ba,onCloseMarkdownImageLightbox:va,onTogglePinned:Ht?Jo:void 0}),tt&&!o&&u.jsx("button",{type:"button",onClick:vi,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:u.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:[u.jsx("div",{className:"text-[14px] font-semibold text-foreground",children:t==="zh"?"建议使用 Home":"Use Home instead"}),u.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."}),u.jsx("div",{className:"mt-3 text-[11px] font-medium text-muted-foreground/80",children:t==="zh"?"轻点关闭提示":"Tap to dismiss"})]})}),Br&&u.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"?u.jsx(Kc,{size:14,className:"shrink-0 text-[color:var(--success)]"}):u.jsx(dh,{size:14,className:"shrink-0"}),u.jsx("span",{className:"min-w-0 flex-1",children:Br.message}),u.jsx("button",{type:"button",onClick:()=>Rn(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:u.jsx(Bs,{size:12})})]}),a&&u.jsxs("div",{className:"fixed bottom-0 left-0 right-0 z-toast max-h-48 overflow-y-auto border-t border-border/15 bg-surface p-3 animate-fade-in",children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsx("h4",{className:"ui-kicker",children:"Debug Info"}),u.jsx("button",{type:"button",onClick:()=>d(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Close"})]}),u.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify(Fe,null,2)})]})]}),Iu=In?null:u.jsxs("div",{className:"termdock-boot z-modal-panel",role:"status","aria-live":"polite",children:[u.jsx("div",{className:"termdock-boot-spinner","aria-hidden":"true"}),u.jsx("span",{children:"Loading Termdock"})]});return Pi||Ha?u.jsxs("div",{className:"w-screen h-full flex flex-row",children:[Pi&&u.jsxs(u.Fragment,{children:[u.jsx("div",{style:{width:sr,flexShrink:0,height:"100%"},children:u.jsx(tb,{isOpen:Jr,drawerWidthPx:sr,onClose:xa,onOpen:Ei,sessions:Ne,activeSessionId:dt,sessionStates:tn,onNewSession:E=>ta(E),recoverableTmuxSessions:rd,recoverableTmuxSessionsLoading:si,onRefreshRecoverableTmuxSessions:()=>{Sa()},onCloseSession:Hl,onSplitSession:ed,onCloseSplit:E=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:E})),onRemoveFromSplit:E=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:E})),splitWorkspaces:On,onSetSplitLayout:Si,onReorderSplitWorkspace:Cc,onRenameSplitWorkspace:td,onCombineSplitSessions:_u,onReorderSessions:Ri,onSessionMenu:Tc,onOpenSettings:Mo,onOpenQuota:()=>Jn(!0),updateState:be,updateActionPending:We,onConfirmUpdateRestart:_s,onRetryUpdate:$r,tmuxAvailable:$n.available,defaultSessionMode:qr,runningSessionButtonEnabled:Fs,onRunningSessionButtonEnabledChange:js,pinned:!0,onTogglePinned:ho})}),u.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:cl})]}),u.jsxs("div",{className:"relative flex-1 min-w-0 h-full overflow-hidden",children:[sd,Ha&&u.jsxs("div",{className:"absolute inset-y-0 right-0 z-20 flex",style:{width:Lc},children:[u.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:ul}),u.jsx("div",{style:{width:za,flexShrink:0,height:"100%"},children:u.jsx(nb,{isOpen:!0,drawerWidthPx:za,onClose:Io,onOpen:Is,pinned:!0,onTogglePinned:Jo,rightSidebarFilePreviewOpen:or,rightSidebarFilePreviewCloseSignal:Le,onOpenRightSidebarFilePreview:Ro,onCloseRightSidebarFilePreview:dl,rightSidebarRepoPickerOpen:Oe,rightSidebarRepoPickerCloseSignal:de,onOpenRightSidebarRepoPicker:fo,onCloseRightSidebarRepoPicker:$a,markdownOutlineOpen:ot,markdownOutlineCloseSignal:yn,onOpenMarkdownOutline:hl,onCloseMarkdownOutline:Rs,markdownImageLightboxOpen:bt,markdownImageLightboxCloseSignal:kt,onOpenMarkdownImageLightbox:ba,onCloseMarkdownImageLightbox:va})})]})]}),Iu]}):u.jsxs(u.Fragment,{children:[sd,Iu]})}const vH=String.raw`
|
|
160
|
-
████████ ███████ ██████ ███ ███ ██████ ██████ ██████ ██ ██
|
|
161
|
-
██ ██ ██ ██ ████ ████ ██ ██ ██ ██ ██ ██ ██
|
|
162
|
-
██ █████ ██████ ██ ████ ██ ██ ██ ██ ██ ██ █████
|
|
163
|
-
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
|
164
|
-
██ ███████ ██ ██ ██ ██ ██████ ██████ ██████ ██ ██
|
|
165
|
-
`;function wH({onLoginSuccess:e}){const{t}=qn(),[n,r]=S.useState(""),[s,o]=S.useState(!1),[a,d]=S.useState(null),[h,p]=S.useState(0),g=S.useRef(null);S.useEffect(()=>{g.current?.focus()},[]),S.useEffect(()=>{if(h<=0)return;const A=setInterval(()=>{p(L=>L>1?L-1:0)},1e3);return()=>clearInterval(A)},[h]);const y=h>0,b=!s&&!y&&n.length>0,v=async A=>{if(A.preventDefault(),!!b){o(!0),d(null);try{const L=await vT(n);if(L.ok){r(""),e();return}d(L.error||t("login.invalidPassword")),L.rateLimited&&typeof L.retryAfterMs=="number"&&p(Math.max(1,Math.ceil(L.retryAfterMs/1e3)))}catch(L){d(L instanceof Error?L.message:t("login.failed"))}finally{o(!1)}}},T=y?t("login.placeholderBlocked",{s:h}):t("login.placeholder");return u.jsxs("div",{className:"flex w-screen flex-col items-center justify-center bg-background px-4 text-foreground",style:{height:"var(--app-vh, 100vh)",paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"20vh",gap:"clamp(20px, 4vh, 40px)"},children:[u.jsx("pre",{"aria-hidden":!0,className:"max-w-full select-none overflow-hidden whitespace-pre leading-[1.05] text-primary/80 font-mono",style:{fontSize:"clamp(5px, 2vw, 14px)"},children:vH}),u.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground font-mono",children:[u.jsx("span",{className:"text-primary",children:"$"}),u.jsx("span",{children:t("login.prompt")}),u.jsx("span",{className:"terminal-cursor","aria-hidden":!0,children:"▍"})]}),u.jsxs("form",{onSubmit:v,className:"w-full max-w-xs",children:[u.jsxs("div",{className:`flex items-center gap-1 rounded-full border bg-surface-2 p-1 pl-4 transition ${a?"border-destructive/60":"border-border"}`,children:[u.jsx("input",{ref:g,type:"password",autoComplete:"current-password",value:n,placeholder:T,onChange:A=>{r(A.target.value),a&&d(null)},disabled:s||y,className:"flex-1 bg-transparent text-foreground placeholder:text-muted-foreground/70 focus:outline-none disabled:opacity-60",style:{minWidth:0,fontSize:"16px"}}),u.jsx("button",{type:"submit",disabled:!b,"aria-label":t("login.submit"),className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground transition hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-40",children:s?u.jsx(Xn,{size:16,className:"animate-spin"}):u.jsx(LC,{size:16})})]}),a&&!y?u.jsx("div",{className:"mt-3 text-center text-xs text-destructive",children:a}):null]}),u.jsx("style",{children:`
|
|
166
|
-
@keyframes terminal-blink {
|
|
167
|
-
0%, 49% { opacity: 1; }
|
|
168
|
-
50%, 100% { opacity: 0; }
|
|
169
|
-
}
|
|
170
|
-
.terminal-cursor {
|
|
171
|
-
display: inline-block;
|
|
172
|
-
animation: terminal-blink 1.05s steps(1, end) infinite;
|
|
173
|
-
color: var(--primary);
|
|
174
|
-
}
|
|
175
|
-
`})]})}const mb=5*6e4;let cg,kw=!1,Ew=!1,gb=!1;const ug=new Set;function xb(){kw=!0,ug.forEach(e=>e())}function AH(){return S.useSyncExternalStore(e=>(ug.add(e),()=>{ug.delete(e)}),()=>kw,()=>!1)}function TH(){window.dispatchEvent(new Event("termdock:before-update")),Ew=!0,cg?.waiting?cg.waiting.postMessage({type:"SKIP_WAITING"}):window.location.reload()}function SH(e,t){let n=e;return()=>{if(!n){n=!0;return}t()}}function CH(){if(gb||typeof window>"u"||!("serviceWorker"in navigator))return;gb=!0,navigator.serviceWorker.addEventListener("controllerchange",SH(!!navigator.serviceWorker.controller,()=>{Ew?window.location.reload():xb()}));const e=()=>{navigator.serviceWorker.register("/sw.js",{scope:"/",updateViaCache:"none"}).then(t=>{cg=t;const n=()=>{t.waiting&&xb()},r=()=>{const a=t.installing;a?.addEventListener("statechange",()=>{a.state==="installed"&&navigator.serviceWorker.controller&&n()})};t.addEventListener("updatefound",r),r(),n();let s=0;const o=()=>{document.visibilityState!=="visible"||Date.now()-s<mb||(s=Date.now(),t.update().then(n).catch(()=>{}))};o(),window.setInterval(o,mb),document.addEventListener("visibilitychange",o)}).catch(()=>{})};document.readyState==="complete"?e():window.addEventListener("load",e,{once:!0})}function _H(){const e=AH(),[t,n]=S.useState(!1),{locale:r}=qn();if(!e||t)return null;const s=r==="zh";return u.jsxs("div",{role:"status",className:"fixed bottom-16 left-1/2 z-toast flex max-w-[calc(100%-2rem)] -translate-x-1/2 items-center gap-3 rounded-lg border border-border bg-background px-4 py-3 text-sm text-foreground shadow-lg",children:[u.jsx("span",{children:s?"新版本已就绪":"An update is ready"}),u.jsx("button",{type:"button",className:"whitespace-nowrap text-primary",onClick:TH,children:s?"重新加载":"Reload"}),u.jsx("button",{type:"button",className:"whitespace-nowrap text-muted-foreground",onClick:()=>n(!0),children:s?"稍后":"Later"})]})}const LH=S.lazy(()=>Fh(()=>import("./DagPlayground-BRoB8JX5.js"),__vite__mapDeps([9,7,1,2,4,10])).then(e=>({default:e.DagPlayground}))),kH=S.lazy(()=>Fh(()=>import("./DiffLab-CdbPsjKS.js"),__vite__mapDeps([11,1,2,5,6,10])).then(e=>({default:e.DiffLab}))),EH=S.lazy(()=>Fh(()=>import("./DiffReviewLab-C47CNvDM.js"),__vite__mapDeps([12,1,2,3,4,5,6,10])).then(e=>({default:e.DiffReviewLab})));$M();CH();try{const e=JSON.parse(window.localStorage.getItem("termdock-color-theme")||"null");(e==="dark"||e==="light")&&(document.documentElement.dataset.theme=e,J6(e))}catch{}function IH(){const{t:e}=qn(),[t,n]=S.useState(null),[r,s]=S.useState(null),o=S.useCallback(async()=>{try{const a=await bT();n(a),s(null)}catch(a){s(a instanceof Error?a.message:"Failed to query auth status")}},[]);return S.useEffect(()=>{o();const a=()=>{document.visibilityState==="visible"&&o()};document.addEventListener("visibilitychange",a),window.addEventListener("focus",a);const d=window.setInterval(a,3600*1e3);return()=>{document.removeEventListener("visibilitychange",a),window.removeEventListener("focus",a),window.clearInterval(d)}},[o]),S.useEffect(()=>{const a=()=>{n(d=>d&&{...d,authenticated:!1})};return window.addEventListener(E0,a),()=>window.removeEventListener(E0,a)},[]),t===null?u.jsxs("div",{className:`termdock-boot${r?" termdock-boot-error":""}`,role:"status","aria-live":"polite",children:[!r&&u.jsx("div",{className:"termdock-boot-spinner","aria-hidden":"true"}),u.jsx("span",{children:r?`${e("common.error")}: ${r}`:"Loading Termdock"})]}):t.enabled&&!t.authenticated?u.jsx(wH,{onLoginSuccess:o}):u.jsx(bH,{})}H8.createRoot(document.getElementById("root")).render(u.jsx(_.StrictMode,{children:u.jsxs(fC,{children:[u.jsx(_H,{}),u.jsx(ov,{children:u.jsx(S.Suspense,{fallback:u.jsx("div",{className:"termdock-boot",role:"status",children:"Loading Termdock"}),children:(()=>{const e=new URLSearchParams(window.location.search);return e.get("dag-playground")==="1"?u.jsx(LH,{}):e.get("diff-review-lab")==="1"?u.jsx(EH,{}):e.get("diff-lab")==="1"?u.jsx(kH,{}):u.jsx(IH,{})})()})})]})}));export{n3 as $,CC as A,Db as B,ma as C,M0 as D,QA as E,gU as F,Bb as G,co as H,b3 as I,uz as J,xv as K,I_ as L,BA as M,$H as N,zz as O,G_ as P,ix as Q,ys as R,w$ as S,bR as T,fN as U,QH as V,fm as W,Bs as X,iz as Y,sz as Z,Fh as _,TC as a,Lt as a0,Xb as a1,Qb as a2,mN as a3,rz as a4,ez as a5,JH as a6,tz as a7,DH as a8,FH as a9,hN as aA,Vz as aB,lz as aC,Om as aD,BH as aE,gi as aF,YT as aG,Gz as aH,qz as aI,qn as aJ,d1 as aK,Et as aL,hS as aM,UH as aN,Hn as aO,Wz as aP,KH as aa,cz as ab,zH as ac,az as ad,XH as ae,YH as af,nz as ag,uu as ah,oz as ai,jT as aj,k$ as ak,VH as al,OT as am,OH as an,jH as ao,PH as ap,HT as aq,$T as ar,u as as,vg as at,ZH as au,lo as av,WH as aw,HH as ax,GH as ay,qH as az,LC as b,h3 as c,fc as d,Vh as e,GC as f,R2 as g,R0 as h,p3 as i,a_ as j,N0 as k,hu as l,Sg as m,pu as n,Xn as o,Q_ as p,V_ as q,D0 as r,B0 as s,N2 as t,y3 as u,v$ as v,hh as w,hw as x,cL as y,fL as z};
|