@svenroth-ai/shipwright 0.27.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/dist/apple-touch-icon.png +0 -0
- package/client/dist/assets/{EmbeddedTerminal-CqCQUDtp.js → EmbeddedTerminal-IkAS1bic.js} +30 -30
- package/client/dist/assets/{abnfDiagram-VRR7QNED-DX2objTP.js → abnfDiagram-VCTEODGH-CclAL-Ri.js} +1 -1
- package/client/dist/assets/arc-C8vUxwav.js +1 -0
- package/client/dist/assets/architectureDiagram-5GKGNRK7-DdrrZJx7.js +36 -0
- package/client/dist/assets/blockDiagram-I7D4REHJ-CMhbhsVq.js +129 -0
- package/client/dist/assets/c4Diagram-7LVT6UL2-OvlH6BiV.js +38 -0
- package/client/dist/assets/channel-BtkABUIE.js +1 -0
- package/client/dist/assets/{chunk-2Q5K7J3B-C111EHL6.js → chunk-2Q5K7J3B-BxUk85j7.js} +1 -1
- package/client/dist/assets/{chunk-5VM5RSS4-DIejoaXS.js → chunk-5VM5RSS4-DoTSs3Kn.js} +1 -1
- package/client/dist/assets/{chunk-32BRIVSS-DrCYs2XG.js → chunk-F27PBJKO-DquVu1wX.js} +1 -1
- package/client/dist/assets/{chunk-EX3LRPZG-CGWNeH2g.js → chunk-IMKFNOWR-8l4wPLQK.js} +5 -5
- package/client/dist/assets/{chunk-JWPE2WC7-CCH0SRFY.js → chunk-JWPE2WC7-CTAa0a4O.js} +1 -1
- package/client/dist/assets/chunk-POPQ4Y6H-BZ6zpqEF.js +1 -0
- package/client/dist/assets/{chunk-MOJQB5TN-B3OpZGRv.js → chunk-SVP7TREG-Dx7pMiq4.js} +1 -1
- package/client/dist/assets/{chunk-V7JOEXUC-B6Bu8x1y.js → chunk-TICWLB2K-BtDKT858.js} +1 -1
- package/client/dist/assets/{chunk-XXDRQBXY-xyjuuhxl.js → chunk-XXDRQBXY-BbrrrzuM.js} +1 -1
- package/client/dist/assets/classDiagram-ZZMXUADV-2gEcH3cX.js +1 -0
- package/client/dist/assets/classDiagram-v2-VYDZK3BY-2gEcH3cX.js +1 -0
- package/client/dist/assets/{cose-bilkent-JH36ORCC-BQIH3SCK.js → cose-bilkent-JH36ORCC-Bhem6unn.js} +1 -1
- package/client/dist/assets/{cynefin-VYW2F7L2-oyLAz8te.js → cynefin-OW5HDTMX-hukx0bAt.js} +3 -3
- package/client/dist/assets/{cynefinDiagram-TSTJHNR4-DoLCsH0l.js → cynefinDiagram-5FMLGOSQ-CGogKYMK.js} +1 -1
- package/client/dist/assets/dagre-GXQ25YYZ-BiLo3XBj.js +4 -0
- package/client/dist/assets/diagram-S7CK7UJ4-DBfdjdN6.js +30 -0
- package/client/dist/assets/diagram-UQ7AKVKN-3CvmyZYO.js +41 -0
- package/client/dist/assets/{diagram-FQU43EPY-DFuYE0Vf.js → diagram-VSXAHHWV-COG9399I.js} +2 -2
- package/client/dist/assets/{diagram-G47NLZAW-CffCZVXk.js → diagram-VX7I27RA-Dftpj84a.js} +1 -1
- package/client/dist/assets/{diagram-NH7WQ7WH-BhrHtUlt.js → diagram-Z3DM3KII-Dw9_CGLA.js} +1 -1
- package/client/dist/assets/{ebnfDiagram-CCIWWBDH-DfV7gT4m.js → ebnfDiagram-PWID7BFC-CJirhPah.js} +1 -1
- package/client/dist/assets/erDiagram-RLTQ6QDP-B11aYoo6.js +99 -0
- package/client/dist/assets/flowDiagram-HODETNUW-CPC6X9E5.js +168 -0
- package/client/dist/assets/{ganttDiagram-NO4QXBWP-BclyOgMb.js → ganttDiagram-EL5Y4UJY-DDSk2AAg.js} +4 -4
- package/client/dist/assets/{gitGraphDiagram-IHSO6WYX-BXT4rIKj.js → gitGraphDiagram-WWUBYQGX-D_2UGciq.js} +1 -1
- package/client/dist/assets/index-DDSwQXcp.js +924 -0
- package/client/dist/assets/index-DWrPE3aq.css +1 -0
- package/client/dist/assets/infoDiagram-27XIBGKW-BuUv5Wms.js +2 -0
- package/client/dist/assets/{ishikawaDiagram-FXEZZL3T-BBUFWq5C.js → ishikawaDiagram-5VMMS53U-DpnAnJ0q.js} +4 -4
- package/client/dist/assets/{journeyDiagram-5HDEW3XC-CmclipcQ.js → journeyDiagram-3NMN7TZE-CFUsXz2q.js} +2 -2
- package/client/dist/assets/{kanban-definition-HUTT4EX6-eIzUeZ03.js → kanban-definition-UXKFOSKX-BAq4Kujj.js} +8 -8
- package/client/dist/assets/katex-C5jXJg4s.js +257 -0
- package/client/dist/assets/layout-CccpfEe3.js +1 -0
- package/client/dist/assets/{linear-DGiT7uKK.js → linear-BIeIr2tp.js} +1 -1
- package/client/dist/assets/mermaid.core-B-Ezy6Me.js +312 -0
- package/client/dist/assets/{mindmap-definition-LN4V7U3C-C4ANnNiP.js → mindmap-definition-YA3MSWOX-CMPZ0Ggp.js} +2 -2
- package/client/dist/assets/{pegDiagram-2B236MQR-DnMeh3Yh.js → pegDiagram-XKGWAZYB-B0_2KQ6f.js} +1 -1
- package/client/dist/assets/{pieDiagram-ENE6RG2P-CKV_rkhF.js → pieDiagram-E7YTZNPT-1-nOk5pZ.js} +3 -3
- package/client/dist/assets/{quadrantDiagram-ABIIQ3AL-BuUsGwHh.js → quadrantDiagram-AXDQQJYC-C_RdmOuq.js} +1 -1
- package/client/dist/assets/{railroadDiagram-RFXS5EU6-BwwdKnFL.js → railroadDiagram-O6MQD6OU-o73KM0oq.js} +1 -1
- package/client/dist/assets/{requirementDiagram-TGXJPOKE-CpQZouJV.js → requirementDiagram-BXWQKSXE-DnhCWJHv.js} +5 -5
- package/client/dist/assets/{sankeyDiagram-HTMAVEWB-4fnDUNVa.js → sankeyDiagram-P5KCCOFB-CVkYgfTV.js} +4 -4
- package/client/dist/assets/{sequenceDiagram-DBY2YBRQ-BOcaWlM0.js → sequenceDiagram-WJ2MYXX4-BYLed29R.js} +1 -1
- package/client/dist/assets/{sizeCapture-X5ZJPWSS-_pv-9R0c.js → sizeCapture-INFHLROL-CYb4HDaH.js} +1 -1
- package/client/dist/assets/stateDiagram-D77RDMKH-CNKFRye_.js +1 -0
- package/client/dist/assets/stateDiagram-v2-MP3YSRHH-NpMhMQ36.js +1 -0
- package/client/dist/assets/swimlanes-42K2YHIH-BhsYrplp.js +1 -0
- package/client/dist/assets/swimlanesDiagram-VR7AAH4N-B4frkWBG.js +8 -0
- package/client/dist/assets/{timeline-definition-FHXFAJF6-rhGYElgn.js → timeline-definition-24CTP7MA-DiUXzB2p.js} +3 -3
- package/client/dist/assets/{vennDiagram-L72KCM5P-BoGjRxyA.js → vennDiagram-4TSXK5OY-aE4j6W86.js} +5 -5
- package/client/dist/assets/{wardleyDiagram-EHGQE667-D-IGv5bH.js → wardleyDiagram-VM6X3IG4-BxJXq0mU.js} +1 -1
- package/client/dist/assets/xychartDiagram-S5SC5T6Z-4vHeL9zc.js +7 -0
- package/client/dist/favicon-16.png +0 -0
- package/client/dist/favicon-32.png +0 -0
- package/client/dist/icon-192.png +0 -0
- package/client/dist/icon-512.png +0 -0
- package/client/dist/icon-maskable-512.png +0 -0
- package/client/dist/index.html +11 -2
- package/client/dist/manifest.json +13 -0
- package/lib/preflight.mjs +24 -5
- package/lib/util.mjs +5 -1
- package/package.json +2 -2
- package/scripts/deploy-procs.mjs +105 -20
- package/scripts/deploy-swap.mjs +23 -2
- package/server/dist/config.d.ts +9 -0
- package/server/dist/config.d.ts.map +1 -1
- package/server/dist/config.js +8 -2
- package/server/dist/config.js.map +1 -1
- package/server/dist/core/adopt-scan-findings.d.ts +12 -0
- package/server/dist/core/adopt-scan-findings.d.ts.map +1 -0
- package/server/dist/core/adopt-scan-findings.js +96 -0
- package/server/dist/core/adopt-scan-findings.js.map +1 -0
- package/server/dist/core/adopt-scan.d.ts +49 -0
- package/server/dist/core/adopt-scan.d.ts.map +1 -0
- package/server/dist/core/adopt-scan.js +201 -0
- package/server/dist/core/adopt-scan.js.map +1 -0
- package/server/dist/core/campaign-events.d.ts.map +1 -1
- package/server/dist/core/campaign-events.js +1 -0
- package/server/dist/core/campaign-events.js.map +1 -1
- package/server/dist/core/campaign-loop-state.d.ts.map +1 -1
- package/server/dist/core/campaign-loop-state.js +54 -21
- package/server/dist/core/campaign-loop-state.js.map +1 -1
- package/server/dist/core/campaign-parse.d.ts +4 -0
- package/server/dist/core/campaign-parse.d.ts.map +1 -1
- package/server/dist/core/campaign-parse.js +9 -0
- package/server/dist/core/campaign-parse.js.map +1 -1
- package/server/dist/core/campaign-readiness-schema.d.ts +33 -0
- package/server/dist/core/campaign-readiness-schema.d.ts.map +1 -0
- package/server/dist/core/campaign-readiness-schema.js +70 -0
- package/server/dist/core/campaign-readiness-schema.js.map +1 -0
- package/server/dist/core/campaign-readiness.d.ts +59 -0
- package/server/dist/core/campaign-readiness.d.ts.map +1 -0
- package/server/dist/core/campaign-readiness.js +163 -0
- package/server/dist/core/campaign-readiness.js.map +1 -0
- package/server/dist/core/campaign-status-json.d.ts +3 -0
- package/server/dist/core/campaign-status-json.d.ts.map +1 -1
- package/server/dist/core/campaign-status-json.js +7 -0
- package/server/dist/core/campaign-status-json.js.map +1 -1
- package/server/dist/core/campaign-store.d.ts.map +1 -1
- package/server/dist/core/campaign-store.js +4 -1
- package/server/dist/core/campaign-store.js.map +1 -1
- package/server/dist/core/campaign-types.d.ts +8 -0
- package/server/dist/core/campaign-types.d.ts.map +1 -1
- package/server/dist/core/campaign-worktree-root.d.ts +19 -0
- package/server/dist/core/campaign-worktree-root.d.ts.map +1 -0
- package/server/dist/core/campaign-worktree-root.js +76 -0
- package/server/dist/core/campaign-worktree-root.js.map +1 -0
- package/server/dist/core/claim-record-lock.d.ts +30 -0
- package/server/dist/core/claim-record-lock.d.ts.map +1 -0
- package/server/dist/core/claim-record-lock.js +90 -0
- package/server/dist/core/claim-record-lock.js.map +1 -0
- package/server/dist/core/cli-child-spawn.d.ts +28 -0
- package/server/dist/core/cli-child-spawn.d.ts.map +1 -0
- package/server/dist/core/cli-child-spawn.js +146 -0
- package/server/dist/core/cli-child-spawn.js.map +1 -0
- package/server/dist/core/codex-models-probe.d.ts +46 -0
- package/server/dist/core/codex-models-probe.d.ts.map +1 -0
- package/server/dist/core/codex-models-probe.js +103 -0
- package/server/dist/core/codex-models-probe.js.map +1 -0
- package/server/dist/core/codex-oracle-runner.d.ts +68 -0
- package/server/dist/core/codex-oracle-runner.d.ts.map +1 -0
- package/server/dist/core/codex-oracle-runner.js +124 -0
- package/server/dist/core/codex-oracle-runner.js.map +1 -0
- package/server/dist/core/codex-status-report.d.ts +6 -0
- package/server/dist/core/codex-status-report.d.ts.map +1 -0
- package/server/dist/core/codex-status-report.js +40 -0
- package/server/dist/core/codex-status-report.js.map +1 -0
- package/server/dist/core/codex-task-watcher-types.d.ts +69 -0
- package/server/dist/core/codex-task-watcher-types.d.ts.map +1 -0
- package/server/dist/core/codex-task-watcher-types.js +12 -0
- package/server/dist/core/codex-task-watcher-types.js.map +1 -0
- package/server/dist/core/codex-task-watcher.d.ts +30 -0
- package/server/dist/core/codex-task-watcher.d.ts.map +1 -0
- package/server/dist/core/codex-task-watcher.js +252 -0
- package/server/dist/core/codex-task-watcher.js.map +1 -0
- package/server/dist/core/codex-terminal-signal-detect.d.ts +7 -0
- package/server/dist/core/codex-terminal-signal-detect.d.ts.map +1 -0
- package/server/dist/core/codex-terminal-signal-detect.js +113 -0
- package/server/dist/core/codex-terminal-signal-detect.js.map +1 -0
- package/server/dist/core/codex-thread-discovery.d.ts +21 -0
- package/server/dist/core/codex-thread-discovery.d.ts.map +1 -0
- package/server/dist/core/codex-thread-discovery.js +169 -0
- package/server/dist/core/codex-thread-discovery.js.map +1 -0
- package/server/dist/core/codextender-auth-file-sweep.d.ts +41 -0
- package/server/dist/core/codextender-auth-file-sweep.d.ts.map +1 -0
- package/server/dist/core/codextender-auth-file-sweep.js +97 -0
- package/server/dist/core/codextender-auth-file-sweep.js.map +1 -0
- package/server/dist/core/codextender-proxy-probe.d.ts +80 -0
- package/server/dist/core/codextender-proxy-probe.d.ts.map +1 -0
- package/server/dist/core/codextender-proxy-probe.js +179 -0
- package/server/dist/core/codextender-proxy-probe.js.map +1 -0
- package/server/dist/core/contract-version.d.ts +16 -1
- package/server/dist/core/contract-version.d.ts.map +1 -1
- package/server/dist/core/contract-version.js +16 -1
- package/server/dist/core/contract-version.js.map +1 -1
- package/server/dist/core/custom-profile-command-policy.d.ts +6 -0
- package/server/dist/core/custom-profile-command-policy.d.ts.map +1 -0
- package/server/dist/core/custom-profile-command-policy.js +110 -0
- package/server/dist/core/custom-profile-command-policy.js.map +1 -0
- package/server/dist/core/custom-profile-loader.d.ts +34 -0
- package/server/dist/core/custom-profile-loader.d.ts.map +1 -0
- package/server/dist/core/custom-profile-loader.js +225 -0
- package/server/dist/core/custom-profile-loader.js.map +1 -0
- package/server/dist/core/launcher-codex.d.ts +61 -0
- package/server/dist/core/launcher-codex.d.ts.map +1 -0
- package/server/dist/core/launcher-codex.js +187 -0
- package/server/dist/core/launcher-codex.js.map +1 -0
- package/server/dist/core/launcher-codextender-env.d.ts +44 -0
- package/server/dist/core/launcher-codextender-env.d.ts.map +1 -0
- package/server/dist/core/launcher-codextender-env.js +212 -0
- package/server/dist/core/launcher-codextender-env.js.map +1 -0
- package/server/dist/core/launcher-codextender.d.ts +72 -0
- package/server/dist/core/launcher-codextender.d.ts.map +1 -0
- package/server/dist/core/launcher-codextender.js +98 -0
- package/server/dist/core/launcher-codextender.js.map +1 -0
- package/server/dist/core/launcher-codextender.smoke-helpers.d.ts +25 -0
- package/server/dist/core/launcher-codextender.smoke-helpers.d.ts.map +1 -0
- package/server/dist/core/launcher-codextender.smoke-helpers.js +211 -0
- package/server/dist/core/launcher-codextender.smoke-helpers.js.map +1 -0
- package/server/dist/core/launcher-permission-flags.d.ts +17 -0
- package/server/dist/core/launcher-permission-flags.d.ts.map +1 -0
- package/server/dist/core/launcher-permission-flags.js +27 -0
- package/server/dist/core/launcher-permission-flags.js.map +1 -0
- package/server/dist/core/launcher.d.ts +18 -0
- package/server/dist/core/launcher.d.ts.map +1 -1
- package/server/dist/core/launcher.js +6 -0
- package/server/dist/core/launcher.js.map +1 -1
- package/server/dist/core/leadwright-preflight-transport.d.ts +27 -0
- package/server/dist/core/leadwright-preflight-transport.d.ts.map +1 -0
- package/server/dist/core/leadwright-preflight-transport.js +124 -0
- package/server/dist/core/leadwright-preflight-transport.js.map +1 -0
- package/server/dist/core/mission-context/artifacts-tests-ac.d.ts +6 -0
- package/server/dist/core/mission-context/artifacts-tests-ac.d.ts.map +1 -0
- package/server/dist/core/mission-context/artifacts-tests-ac.js +31 -0
- package/server/dist/core/mission-context/artifacts-tests-ac.js.map +1 -0
- package/server/dist/core/mission-context/artifacts-tests.d.ts.map +1 -1
- package/server/dist/core/mission-context/artifacts-tests.js +20 -0
- package/server/dist/core/mission-context/artifacts-tests.js.map +1 -1
- package/server/dist/core/mission-context/resolver-io.d.ts +10 -0
- package/server/dist/core/mission-context/resolver-io.d.ts.map +1 -1
- package/server/dist/core/mission-context/resolver-parts.d.ts +8 -7
- package/server/dist/core/mission-context/resolver-parts.d.ts.map +1 -1
- package/server/dist/core/mission-context/resolver-parts.js +22 -14
- package/server/dist/core/mission-context/resolver-parts.js.map +1 -1
- package/server/dist/core/mission-context/resolver.d.ts.map +1 -1
- package/server/dist/core/mission-context/resolver.js +1 -1
- package/server/dist/core/mission-context/resolver.js.map +1 -1
- package/server/dist/core/mission-context/run-id-recovery.d.ts +18 -2
- package/server/dist/core/mission-context/run-id-recovery.d.ts.map +1 -1
- package/server/dist/core/mission-context/run-id-recovery.js +38 -18
- package/server/dist/core/mission-context/run-id-recovery.js.map +1 -1
- package/server/dist/core/mission-context/traceability.d.ts.map +1 -1
- package/server/dist/core/mission-context/traceability.js +15 -1
- package/server/dist/core/mission-context/traceability.js.map +1 -1
- package/server/dist/core/mission-context/types-slice2.d.ts +44 -0
- package/server/dist/core/mission-context/types-slice2.d.ts.map +1 -1
- package/server/dist/core/model-tier-config-reader.d.ts +14 -1
- package/server/dist/core/model-tier-config-reader.d.ts.map +1 -1
- package/server/dist/core/model-tier-config-reader.js +34 -2
- package/server/dist/core/model-tier-config-reader.js.map +1 -1
- package/server/dist/core/powershell-probe.smoke-helpers.d.ts +12 -0
- package/server/dist/core/powershell-probe.smoke-helpers.d.ts.map +1 -0
- package/server/dist/core/powershell-probe.smoke-helpers.js +80 -0
- package/server/dist/core/powershell-probe.smoke-helpers.js.map +1 -0
- package/server/dist/core/preview-child-lifecycle.d.ts +7 -2
- package/server/dist/core/preview-child-lifecycle.d.ts.map +1 -1
- package/server/dist/core/preview-child-lifecycle.js +17 -5
- package/server/dist/core/preview-child-lifecycle.js.map +1 -1
- package/server/dist/core/preview-session-manager.d.ts +1 -0
- package/server/dist/core/preview-session-manager.d.ts.map +1 -1
- package/server/dist/core/preview-session-manager.js +2 -2
- package/server/dist/core/preview-session-manager.js.map +1 -1
- package/server/dist/core/project-actions-loader.d.ts +13 -0
- package/server/dist/core/project-actions-loader.d.ts.map +1 -1
- package/server/dist/core/project-actions-loader.js +28 -6
- package/server/dist/core/project-actions-loader.js.map +1 -1
- package/server/dist/core/project-data-dir.d.ts +41 -0
- package/server/dist/core/project-data-dir.d.ts.map +1 -0
- package/server/dist/core/project-data-dir.js +64 -0
- package/server/dist/core/project-data-dir.js.map +1 -0
- package/server/dist/core/project-data-migrate.d.ts +14 -0
- package/server/dist/core/project-data-migrate.d.ts.map +1 -0
- package/server/dist/core/project-data-migrate.js +94 -0
- package/server/dist/core/project-data-migrate.js.map +1 -0
- package/server/dist/core/project-manager.d.ts.map +1 -1
- package/server/dist/core/project-manager.js +9 -10
- package/server/dist/core/project-manager.js.map +1 -1
- package/server/dist/core/readiness-install-hints.d.ts +1 -1
- package/server/dist/core/readiness-install-hints.d.ts.map +1 -1
- package/server/dist/core/readiness-install-hints.js +5 -0
- package/server/dist/core/readiness-install-hints.js.map +1 -1
- package/server/dist/core/readiness-probe-run.d.ts +61 -0
- package/server/dist/core/readiness-probe-run.d.ts.map +1 -1
- package/server/dist/core/readiness-probe-run.js +93 -15
- package/server/dist/core/readiness-probe-run.js.map +1 -1
- package/server/dist/core/readiness-probe.d.ts +1 -1
- package/server/dist/core/readiness-probe.d.ts.map +1 -1
- package/server/dist/core/readiness-probe.js +36 -8
- package/server/dist/core/readiness-probe.js.map +1 -1
- package/server/dist/core/sdk-sessions-store.d.ts +46 -0
- package/server/dist/core/sdk-sessions-store.d.ts.map +1 -1
- package/server/dist/core/sdk-sessions-store.js +1 -0
- package/server/dist/core/sdk-sessions-store.js.map +1 -1
- package/server/dist/core/sdk-sessions-validate.d.ts.map +1 -1
- package/server/dist/core/sdk-sessions-validate.js +11 -0
- package/server/dist/core/sdk-sessions-validate.js.map +1 -1
- package/server/dist/core/session-file/access.d.ts +26 -0
- package/server/dist/core/session-file/access.d.ts.map +1 -0
- package/server/dist/core/session-file/access.js +143 -0
- package/server/dist/core/session-file/access.js.map +1 -0
- package/server/dist/core/session-file/asset-access.d.ts +15 -0
- package/server/dist/core/session-file/asset-access.d.ts.map +1 -0
- package/server/dist/core/session-file/asset-access.js +141 -0
- package/server/dist/core/session-file/asset-access.js.map +1 -0
- package/server/dist/core/session-file/evidence.d.ts +25 -0
- package/server/dist/core/session-file/evidence.d.ts.map +1 -0
- package/server/dist/core/session-file/evidence.js +201 -0
- package/server/dist/core/session-file/evidence.js.map +1 -0
- package/server/dist/core/session-file/probe.d.ts +16 -0
- package/server/dist/core/session-file/probe.d.ts.map +1 -0
- package/server/dist/core/session-file/probe.js +63 -0
- package/server/dist/core/session-file/probe.js.map +1 -0
- package/server/dist/core/session-file/safe-read.d.ts +33 -0
- package/server/dist/core/session-file/safe-read.d.ts.map +1 -0
- package/server/dist/core/session-file/safe-read.js +103 -0
- package/server/dist/core/session-file/safe-read.js.map +1 -0
- package/server/dist/core/session-file/sensitive.d.ts +5 -0
- package/server/dist/core/session-file/sensitive.d.ts.map +1 -0
- package/server/dist/core/session-file/sensitive.js +52 -0
- package/server/dist/core/session-file/sensitive.js.map +1 -0
- package/server/dist/core/session-info/collect.d.ts +70 -0
- package/server/dist/core/session-info/collect.d.ts.map +1 -0
- package/server/dist/core/session-info/collect.js +248 -0
- package/server/dist/core/session-info/collect.js.map +1 -0
- package/server/dist/core/session-info/line-scan.d.ts +20 -0
- package/server/dist/core/session-info/line-scan.d.ts.map +1 -0
- package/server/dist/core/session-info/line-scan.js +109 -0
- package/server/dist/core/session-info/line-scan.js.map +1 -0
- package/server/dist/core/session-info/remote-control.d.ts +9 -0
- package/server/dist/core/session-info/remote-control.d.ts.map +1 -0
- package/server/dist/core/session-info/remote-control.js +64 -0
- package/server/dist/core/session-info/remote-control.js.map +1 -0
- package/server/dist/core/session-info/session-info.d.ts +18 -0
- package/server/dist/core/session-info/session-info.d.ts.map +1 -0
- package/server/dist/core/session-info/session-info.js +170 -0
- package/server/dist/core/session-info/session-info.js.map +1 -0
- package/server/dist/core/session-info/small-file.d.ts +2 -0
- package/server/dist/core/session-info/small-file.d.ts.map +1 -0
- package/server/dist/core/session-info/small-file.js +42 -0
- package/server/dist/core/session-info/small-file.js.map +1 -0
- package/server/dist/core/session-info/subagent-transcript.d.ts +12 -0
- package/server/dist/core/session-info/subagent-transcript.d.ts.map +1 -0
- package/server/dist/core/session-info/subagent-transcript.js +78 -0
- package/server/dist/core/session-info/subagent-transcript.js.map +1 -0
- package/server/dist/core/session-info/subagents.d.ts +14 -0
- package/server/dist/core/session-info/subagents.d.ts.map +1 -0
- package/server/dist/core/session-info/subagents.js +92 -0
- package/server/dist/core/session-info/subagents.js.map +1 -0
- package/server/dist/core/session-info/test-fixtures.d.ts +50 -0
- package/server/dist/core/session-info/test-fixtures.d.ts.map +1 -0
- package/server/dist/core/session-info/test-fixtures.js +43 -0
- package/server/dist/core/session-info/test-fixtures.js.map +1 -0
- package/server/dist/core/session-info/types.d.ts +77 -0
- package/server/dist/core/session-info/types.d.ts.map +1 -0
- package/server/dist/core/session-info/types.js +14 -0
- package/server/dist/core/session-info/types.js.map +1 -0
- package/server/dist/core/settings-reader.d.ts +18 -0
- package/server/dist/core/settings-reader.d.ts.map +1 -0
- package/server/dist/core/settings-reader.js +40 -0
- package/server/dist/core/settings-reader.js.map +1 -0
- package/server/dist/core/shell-quote.d.ts +29 -0
- package/server/dist/core/shell-quote.d.ts.map +1 -1
- package/server/dist/core/shell-quote.js +34 -0
- package/server/dist/core/shell-quote.js.map +1 -1
- package/server/dist/core/stack-profiles-create.d.ts +31 -0
- package/server/dist/core/stack-profiles-create.d.ts.map +1 -0
- package/server/dist/core/stack-profiles-create.js +128 -0
- package/server/dist/core/stack-profiles-create.js.map +1 -0
- package/server/dist/core/stack-profiles.d.ts +49 -0
- package/server/dist/core/stack-profiles.d.ts.map +1 -0
- package/server/dist/core/stack-profiles.js +142 -0
- package/server/dist/core/stack-profiles.js.map +1 -0
- package/server/dist/core/task-editability.d.ts +1 -1
- package/server/dist/core/task-editability.d.ts.map +1 -1
- package/server/dist/core/task-editability.js +1 -0
- package/server/dist/core/task-editability.js.map +1 -1
- package/server/dist/core/triage-cli-runner.d.ts.map +1 -1
- package/server/dist/core/triage-cli-runner.js +6 -21
- package/server/dist/core/triage-cli-runner.js.map +1 -1
- package/server/dist/core/triage-compose.d.ts.map +1 -1
- package/server/dist/core/triage-compose.js +34 -3
- package/server/dist/core/triage-compose.js.map +1 -1
- package/server/dist/core/triage-store.d.ts +2 -1
- package/server/dist/core/triage-store.d.ts.map +1 -1
- package/server/dist/core/triage-store.js +1 -1
- package/server/dist/core/triage-store.js.map +1 -1
- package/server/dist/external/_shared/helpers.d.ts +2 -0
- package/server/dist/external/_shared/helpers.d.ts.map +1 -1
- package/server/dist/external/_shared/helpers.js.map +1 -1
- package/server/dist/external/actions/get.d.ts +3 -1
- package/server/dist/external/actions/get.d.ts.map +1 -1
- package/server/dist/external/actions/get.js +15 -4
- package/server/dist/external/actions/get.js.map +1 -1
- package/server/dist/external/actions/routes.d.ts +3 -1
- package/server/dist/external/actions/routes.d.ts.map +1 -1
- package/server/dist/external/actions/routes.js.map +1 -1
- package/server/dist/external/actions/stub.d.ts.map +1 -1
- package/server/dist/external/actions/stub.js +15 -4
- package/server/dist/external/actions/stub.js.map +1 -1
- package/server/dist/external/actions/upload-delete.d.ts.map +1 -1
- package/server/dist/external/actions/upload-delete.js +30 -20
- package/server/dist/external/actions/upload-delete.js.map +1 -1
- package/server/dist/external/actions/upload.d.ts.map +1 -1
- package/server/dist/external/actions/upload.js +5 -4
- package/server/dist/external/actions/upload.js.map +1 -1
- package/server/dist/external/create-external-routes-args.d.ts +124 -0
- package/server/dist/external/create-external-routes-args.d.ts.map +1 -0
- package/server/dist/external/create-external-routes-args.js +2 -0
- package/server/dist/external/create-external-routes-args.js.map +1 -0
- package/server/dist/external/inbox/_codex.d.ts +14 -0
- package/server/dist/external/inbox/_codex.d.ts.map +1 -0
- package/server/dist/external/inbox/_codex.js +88 -0
- package/server/dist/external/inbox/_codex.js.map +1 -0
- package/server/dist/external/inbox/_derive.d.ts.map +1 -1
- package/server/dist/external/inbox/_derive.js +11 -0
- package/server/dist/external/inbox/_derive.js.map +1 -1
- package/server/dist/external/inbox/_phase-gate.d.ts +9 -0
- package/server/dist/external/inbox/_phase-gate.d.ts.map +1 -0
- package/server/dist/external/inbox/_phase-gate.js +87 -0
- package/server/dist/external/inbox/_phase-gate.js.map +1 -0
- package/server/dist/external/inbox/_types.d.ts +30 -0
- package/server/dist/external/inbox/_types.d.ts.map +1 -1
- package/server/dist/external/inbox/_types.js +8 -5
- package/server/dist/external/inbox/_types.js.map +1 -1
- package/server/dist/external/inbox/routes.d.ts +7 -0
- package/server/dist/external/inbox/routes.d.ts.map +1 -1
- package/server/dist/external/inbox/routes.js +17 -2
- package/server/dist/external/inbox/routes.js.map +1 -1
- package/server/dist/external/launch/_helpers.d.ts +4 -0
- package/server/dist/external/launch/_helpers.d.ts.map +1 -1
- package/server/dist/external/launch/_helpers.js.map +1 -1
- package/server/dist/external/launch/action-substitution-branch.d.ts +12 -0
- package/server/dist/external/launch/action-substitution-branch.d.ts.map +1 -1
- package/server/dist/external/launch/action-substitution-branch.js +37 -3
- package/server/dist/external/launch/action-substitution-branch.js.map +1 -1
- package/server/dist/external/launch/branch-dispatch.d.ts +15 -0
- package/server/dist/external/launch/branch-dispatch.d.ts.map +1 -0
- package/server/dist/external/launch/branch-dispatch.js +73 -0
- package/server/dist/external/launch/branch-dispatch.js.map +1 -0
- package/server/dist/external/launch/campaign-step-branch.d.ts +7 -1
- package/server/dist/external/launch/campaign-step-branch.d.ts.map +1 -1
- package/server/dist/external/launch/campaign-step-branch.js +70 -2
- package/server/dist/external/launch/campaign-step-branch.js.map +1 -1
- package/server/dist/external/launch/claim-executor-permissions.d.ts +31 -0
- package/server/dist/external/launch/claim-executor-permissions.d.ts.map +1 -0
- package/server/dist/external/launch/claim-executor-permissions.js +107 -0
- package/server/dist/external/launch/claim-executor-permissions.js.map +1 -0
- package/server/dist/external/launch/claim-executor-template-arming.d.ts +42 -0
- package/server/dist/external/launch/claim-executor-template-arming.d.ts.map +1 -0
- package/server/dist/external/launch/claim-executor-template-arming.js +121 -0
- package/server/dist/external/launch/claim-executor-template-arming.js.map +1 -0
- package/server/dist/external/launch/claim-holder-gate.d.ts +9 -0
- package/server/dist/external/launch/claim-holder-gate.d.ts.map +1 -1
- package/server/dist/external/launch/claim-holder-gate.js +10 -2
- package/server/dist/external/launch/claim-holder-gate.js.map +1 -1
- package/server/dist/external/launch/claim-permission-perimeter-assert.d.ts +3 -0
- package/server/dist/external/launch/claim-permission-perimeter-assert.d.ts.map +1 -0
- package/server/dist/external/launch/claim-permission-perimeter-assert.js +24 -0
- package/server/dist/external/launch/claim-permission-perimeter-assert.js.map +1 -0
- package/server/dist/external/launch/legacy-fallback-branch.d.ts +14 -0
- package/server/dist/external/launch/legacy-fallback-branch.d.ts.map +1 -1
- package/server/dist/external/launch/legacy-fallback-branch.js +3 -1
- package/server/dist/external/launch/legacy-fallback-branch.js.map +1 -1
- package/server/dist/external/launch/master-run-branch.js +2 -2
- package/server/dist/external/launch/master-run-branch.js.map +1 -1
- package/server/dist/external/launch/mixed-intents-guard.d.ts +10 -0
- package/server/dist/external/launch/mixed-intents-guard.d.ts.map +1 -0
- package/server/dist/external/launch/mixed-intents-guard.js +49 -0
- package/server/dist/external/launch/mixed-intents-guard.js.map +1 -0
- package/server/dist/external/launch/parse-body.d.ts +29 -0
- package/server/dist/external/launch/parse-body.d.ts.map +1 -1
- package/server/dist/external/launch/parse-body.js +66 -0
- package/server/dist/external/launch/parse-body.js.map +1 -1
- package/server/dist/external/launch/routes.d.ts +3 -0
- package/server/dist/external/launch/routes.d.ts.map +1 -1
- package/server/dist/external/launch/routes.js +76 -109
- package/server/dist/external/launch/routes.js.map +1 -1
- package/server/dist/external/launch/runtime-chokepoint-codextender.d.ts +20 -0
- package/server/dist/external/launch/runtime-chokepoint-codextender.d.ts.map +1 -0
- package/server/dist/external/launch/runtime-chokepoint-codextender.js +51 -0
- package/server/dist/external/launch/runtime-chokepoint-codextender.js.map +1 -0
- package/server/dist/external/launch/runtime-chokepoint-errors.d.ts +33 -0
- package/server/dist/external/launch/runtime-chokepoint-errors.d.ts.map +1 -0
- package/server/dist/external/launch/runtime-chokepoint-errors.js +63 -0
- package/server/dist/external/launch/runtime-chokepoint-errors.js.map +1 -0
- package/server/dist/external/launch/runtime-chokepoint.d.ts +120 -0
- package/server/dist/external/launch/runtime-chokepoint.d.ts.map +1 -0
- package/server/dist/external/launch/runtime-chokepoint.js +201 -0
- package/server/dist/external/launch/runtime-chokepoint.js.map +1 -0
- package/server/dist/external/mission-context/facts.js +2 -2
- package/server/dist/external/mission-context/facts.js.map +1 -1
- package/server/dist/external/mission-context/routes.d.ts +33 -27
- package/server/dist/external/mission-context/routes.d.ts.map +1 -1
- package/server/dist/external/mission-context/routes.js +30 -27
- package/server/dist/external/mission-context/routes.js.map +1 -1
- package/server/dist/external/mission-context/test-harness.d.ts +6 -0
- package/server/dist/external/mission-context/test-harness.d.ts.map +1 -1
- package/server/dist/external/mission-context/test-harness.js +6 -1
- package/server/dist/external/mission-context/test-harness.js.map +1 -1
- package/server/dist/external/mission-context/wire.d.ts.map +1 -1
- package/server/dist/external/mission-context/wire.js +24 -2
- package/server/dist/external/mission-context/wire.js.map +1 -1
- package/server/dist/external/org/audit-log.d.ts +19 -0
- package/server/dist/external/org/audit-log.d.ts.map +1 -1
- package/server/dist/external/org/audit-log.js +33 -18
- package/server/dist/external/org/audit-log.js.map +1 -1
- package/server/dist/external/org/beat-effect-audit-read.d.ts +15 -0
- package/server/dist/external/org/beat-effect-audit-read.d.ts.map +1 -0
- package/server/dist/external/org/beat-effect-audit-read.js +73 -0
- package/server/dist/external/org/beat-effect-audit-read.js.map +1 -0
- package/server/dist/external/org/beat-register-health.d.ts +57 -0
- package/server/dist/external/org/beat-register-health.d.ts.map +1 -0
- package/server/dist/external/org/beat-register-health.js +125 -0
- package/server/dist/external/org/beat-register-health.js.map +1 -0
- package/server/dist/external/org/beat-register-release-core.d.ts.map +1 -1
- package/server/dist/external/org/beat-register-release-core.js +4 -1
- package/server/dist/external/org/beat-register-release-core.js.map +1 -1
- package/server/dist/external/org/beat-register-release-request.d.ts +20 -0
- package/server/dist/external/org/beat-register-release-request.d.ts.map +1 -0
- package/server/dist/external/org/beat-register-release-request.js +92 -0
- package/server/dist/external/org/beat-register-release-request.js.map +1 -0
- package/server/dist/external/org/beat-register-release.d.ts +3 -1
- package/server/dist/external/org/beat-register-release.d.ts.map +1 -1
- package/server/dist/external/org/beat-register-release.js +15 -57
- package/server/dist/external/org/beat-register-release.js.map +1 -1
- package/server/dist/external/org/beat-register.d.ts +18 -20
- package/server/dist/external/org/beat-register.d.ts.map +1 -1
- package/server/dist/external/org/beat-register.js +30 -56
- package/server/dist/external/org/beat-register.js.map +1 -1
- package/server/dist/external/org/beat-steps-read.d.ts +17 -0
- package/server/dist/external/org/beat-steps-read.d.ts.map +1 -0
- package/server/dist/external/org/beat-steps-read.js +89 -0
- package/server/dist/external/org/beat-steps-read.js.map +1 -0
- package/server/dist/external/org/charter-authority-read.d.ts +39 -0
- package/server/dist/external/org/charter-authority-read.d.ts.map +1 -0
- package/server/dist/external/org/charter-authority-read.js +142 -0
- package/server/dist/external/org/charter-authority-read.js.map +1 -0
- package/server/dist/external/org/commit-validate.d.ts +18 -0
- package/server/dist/external/org/commit-validate.d.ts.map +1 -0
- package/server/dist/external/org/commit-validate.js +59 -0
- package/server/dist/external/org/commit-validate.js.map +1 -0
- package/server/dist/external/org/commit-writes.d.ts +68 -0
- package/server/dist/external/org/commit-writes.d.ts.map +1 -0
- package/server/dist/external/org/commit-writes.js +110 -0
- package/server/dist/external/org/commit-writes.js.map +1 -0
- package/server/dist/external/org/commit.d.ts +73 -0
- package/server/dist/external/org/commit.d.ts.map +1 -0
- package/server/dist/external/org/commit.js +181 -0
- package/server/dist/external/org/commit.js.map +1 -0
- package/server/dist/external/org/commit.test-fixtures.d.ts +38 -0
- package/server/dist/external/org/commit.test-fixtures.d.ts.map +1 -0
- package/server/dist/external/org/commit.test-fixtures.js +67 -0
- package/server/dist/external/org/commit.test-fixtures.js.map +1 -0
- package/server/dist/external/org/countersign-core.d.ts +19 -0
- package/server/dist/external/org/countersign-core.d.ts.map +1 -0
- package/server/dist/external/org/countersign-core.js +122 -0
- package/server/dist/external/org/countersign-core.js.map +1 -0
- package/server/dist/external/org/countersign-request.d.ts +14 -0
- package/server/dist/external/org/countersign-request.d.ts.map +1 -0
- package/server/dist/external/org/countersign-request.js +78 -0
- package/server/dist/external/org/countersign-request.js.map +1 -0
- package/server/dist/external/org/countersign.d.ts +6 -5
- package/server/dist/external/org/countersign.d.ts.map +1 -1
- package/server/dist/external/org/countersign.js +12 -141
- package/server/dist/external/org/countersign.js.map +1 -1
- package/server/dist/external/org/daemon-config-read.d.ts +31 -0
- package/server/dist/external/org/daemon-config-read.d.ts.map +1 -0
- package/server/dist/external/org/daemon-config-read.js +50 -0
- package/server/dist/external/org/daemon-config-read.js.map +1 -0
- package/server/dist/external/org/decisions-lock.d.ts +6 -4
- package/server/dist/external/org/decisions-lock.d.ts.map +1 -1
- package/server/dist/external/org/decisions-lock.js +9 -8
- package/server/dist/external/org/decisions-lock.js.map +1 -1
- package/server/dist/external/org/domains.d.ts +35 -0
- package/server/dist/external/org/domains.d.ts.map +1 -0
- package/server/dist/external/org/domains.js +29 -0
- package/server/dist/external/org/domains.js.map +1 -0
- package/server/dist/external/org/existing-charters-read.d.ts +5 -0
- package/server/dist/external/org/existing-charters-read.d.ts.map +1 -0
- package/server/dist/external/org/existing-charters-read.js +31 -0
- package/server/dist/external/org/existing-charters-read.js.map +1 -0
- package/server/dist/external/org/leadwright-proposal-merge.d.ts +54 -0
- package/server/dist/external/org/leadwright-proposal-merge.d.ts.map +1 -0
- package/server/dist/external/org/leadwright-proposal-merge.js +47 -0
- package/server/dist/external/org/leadwright-proposal-merge.js.map +1 -0
- package/server/dist/external/org/mount.d.ts +10 -2
- package/server/dist/external/org/mount.d.ts.map +1 -1
- package/server/dist/external/org/mount.js +6 -1
- package/server/dist/external/org/mount.js.map +1 -1
- package/server/dist/external/org/org-chart-full-read.d.ts +19 -0
- package/server/dist/external/org/org-chart-full-read.d.ts.map +1 -0
- package/server/dist/external/org/org-chart-full-read.js +58 -0
- package/server/dist/external/org/org-chart-full-read.js.map +1 -0
- package/server/dist/external/org/org-file-lock.d.ts +41 -0
- package/server/dist/external/org/org-file-lock.d.ts.map +1 -0
- package/server/dist/external/org/org-file-lock.js +90 -0
- package/server/dist/external/org/org-file-lock.js.map +1 -0
- package/server/dist/external/org/routes.d.ts +10 -0
- package/server/dist/external/org/routes.d.ts.map +1 -1
- package/server/dist/external/org/routes.js +22 -1
- package/server/dist/external/org/routes.js.map +1 -1
- package/server/dist/external/org/verdict.d.ts +57 -0
- package/server/dist/external/org/verdict.d.ts.map +1 -0
- package/server/dist/external/org/verdict.js +74 -0
- package/server/dist/external/org/verdict.js.map +1 -0
- package/server/dist/external/preview/routes.d.ts +3 -1
- package/server/dist/external/preview/routes.d.ts.map +1 -1
- package/server/dist/external/preview/routes.js +8 -1
- package/server/dist/external/preview/routes.js.map +1 -1
- package/server/dist/external/routes.d.ts +3 -101
- package/server/dist/external/routes.d.ts.map +1 -1
- package/server/dist/external/routes.js +21 -6
- package/server/dist/external/routes.js.map +1 -1
- package/server/dist/external/session-file/probe-route.d.ts +4 -0
- package/server/dist/external/session-file/probe-route.d.ts.map +1 -0
- package/server/dist/external/session-file/probe-route.js +66 -0
- package/server/dist/external/session-file/probe-route.js.map +1 -0
- package/server/dist/external/session-file/routes.d.ts +12 -0
- package/server/dist/external/session-file/routes.d.ts.map +1 -0
- package/server/dist/external/session-file/routes.js +90 -0
- package/server/dist/external/session-file/routes.js.map +1 -0
- package/server/dist/external/session-file/session-file.fixture.d.ts +45 -0
- package/server/dist/external/session-file/session-file.fixture.d.ts.map +1 -0
- package/server/dist/external/session-file/session-file.fixture.js +41 -0
- package/server/dist/external/session-file/session-file.fixture.js.map +1 -0
- package/server/dist/external/session-info/routes.d.ts +15 -0
- package/server/dist/external/session-info/routes.d.ts.map +1 -0
- package/server/dist/external/session-info/routes.js +57 -0
- package/server/dist/external/session-info/routes.js.map +1 -0
- package/server/dist/external/tasks/_phase-helpers.js +2 -2
- package/server/dist/external/tasks/_phase-helpers.js.map +1 -1
- package/server/dist/external/tasks/create.d.ts.map +1 -1
- package/server/dist/external/tasks/create.js +10 -2
- package/server/dist/external/tasks/create.js.map +1 -1
- package/server/dist/external/tasks/fork.d.ts +29 -0
- package/server/dist/external/tasks/fork.d.ts.map +1 -0
- package/server/dist/external/tasks/fork.js +166 -0
- package/server/dist/external/tasks/fork.js.map +1 -0
- package/server/dist/external/tasks/lifecycle.d.ts.map +1 -1
- package/server/dist/external/tasks/lifecycle.js +10 -57
- package/server/dist/external/tasks/lifecycle.js.map +1 -1
- package/server/dist/external/tasks/patch.d.ts.map +1 -1
- package/server/dist/external/tasks/patch.js +17 -0
- package/server/dist/external/tasks/patch.js.map +1 -1
- package/server/dist/external/tasks/routes.d.ts +2 -0
- package/server/dist/external/tasks/routes.d.ts.map +1 -1
- package/server/dist/external/tasks/routes.js +7 -0
- package/server/dist/external/tasks/routes.js.map +1 -1
- package/server/dist/external/transcript/routes.d.ts.map +1 -1
- package/server/dist/external/transcript/routes.js +25 -3
- package/server/dist/external/transcript/routes.js.map +1 -1
- package/server/dist/external-routes-wiring.d.ts +28 -0
- package/server/dist/external-routes-wiring.d.ts.map +1 -0
- package/server/dist/external-routes-wiring.js +70 -0
- package/server/dist/external-routes-wiring.js.map +1 -0
- package/server/dist/index.d.ts.map +1 -1
- package/server/dist/index.js +117 -52
- package/server/dist/index.js.map +1 -1
- package/server/dist/lib/resolveHonoHost.d.ts.map +1 -1
- package/server/dist/lib/resolveHonoHost.js +16 -1
- package/server/dist/lib/resolveHonoHost.js.map +1 -1
- package/server/dist/routes/_triage-api-harness.d.ts +1 -1
- package/server/dist/routes/_triage-api-harness.d.ts.map +1 -1
- package/server/dist/routes/_triage-api-harness.js.map +1 -1
- package/server/dist/routes/adopt-scan.d.ts +4 -0
- package/server/dist/routes/adopt-scan.d.ts.map +1 -0
- package/server/dist/routes/adopt-scan.js +27 -0
- package/server/dist/routes/adopt-scan.js.map +1 -0
- package/server/dist/routes/campaigns-readiness.d.ts +10 -0
- package/server/dist/routes/campaigns-readiness.d.ts.map +1 -0
- package/server/dist/routes/campaigns-readiness.js +58 -0
- package/server/dist/routes/campaigns-readiness.js.map +1 -0
- package/server/dist/routes/campaigns.d.ts.map +1 -1
- package/server/dist/routes/campaigns.js +3 -0
- package/server/dist/routes/campaigns.js.map +1 -1
- package/server/dist/routes/codex-models.d.ts +15 -0
- package/server/dist/routes/codex-models.d.ts.map +1 -0
- package/server/dist/routes/codex-models.js +77 -0
- package/server/dist/routes/codex-models.js.map +1 -0
- package/server/dist/routes/codextender-models.d.ts +16 -0
- package/server/dist/routes/codextender-models.d.ts.map +1 -0
- package/server/dist/routes/codextender-models.js +81 -0
- package/server/dist/routes/codextender-models.js.map +1 -0
- package/server/dist/routes/diagnostics.d.ts +15 -0
- package/server/dist/routes/diagnostics.d.ts.map +1 -1
- package/server/dist/routes/diagnostics.js +1 -0
- package/server/dist/routes/diagnostics.js.map +1 -1
- package/server/dist/routes/org-chart-lead-guard.d.ts +10 -0
- package/server/dist/routes/org-chart-lead-guard.d.ts.map +1 -0
- package/server/dist/routes/org-chart-lead-guard.js +49 -0
- package/server/dist/routes/org-chart-lead-guard.js.map +1 -0
- package/server/dist/routes/org-inventory-composite.d.ts +20 -0
- package/server/dist/routes/org-inventory-composite.d.ts.map +1 -0
- package/server/dist/routes/org-inventory-composite.js +100 -0
- package/server/dist/routes/org-inventory-composite.js.map +1 -0
- package/server/dist/routes/org-lead-setup-wizard.d.ts +10 -0
- package/server/dist/routes/org-lead-setup-wizard.d.ts.map +1 -0
- package/server/dist/routes/org-lead-setup-wizard.js +51 -0
- package/server/dist/routes/org-lead-setup-wizard.js.map +1 -0
- package/server/dist/routes/org-leads-composite.d.ts.map +1 -1
- package/server/dist/routes/org-leads-composite.js +35 -9
- package/server/dist/routes/org-leads-composite.js.map +1 -1
- package/server/dist/routes/org-writes.d.ts +14 -0
- package/server/dist/routes/org-writes.d.ts.map +1 -0
- package/server/dist/routes/org-writes.js +61 -0
- package/server/dist/routes/org-writes.js.map +1 -0
- package/server/dist/routes/org.d.ts +11 -2
- package/server/dist/routes/org.d.ts.map +1 -1
- package/server/dist/routes/org.js +50 -47
- package/server/dist/routes/org.js.map +1 -1
- package/server/dist/routes/profiles.d.ts +7 -0
- package/server/dist/routes/profiles.d.ts.map +1 -1
- package/server/dist/routes/profiles.js +13 -0
- package/server/dist/routes/profiles.js.map +1 -1
- package/server/dist/routes/projects.d.ts.map +1 -1
- package/server/dist/routes/projects.js +58 -16
- package/server/dist/routes/projects.js.map +1 -1
- package/server/dist/routes/settings.d.ts.map +1 -1
- package/server/dist/routes/settings.js +23 -2
- package/server/dist/routes/settings.js.map +1 -1
- package/server/dist/routes/stack-profiles.d.ts +10 -0
- package/server/dist/routes/stack-profiles.d.ts.map +1 -0
- package/server/dist/routes/stack-profiles.js +65 -0
- package/server/dist/routes/stack-profiles.js.map +1 -0
- package/server/dist/routes/triage.d.ts +17 -0
- package/server/dist/routes/triage.d.ts.map +1 -1
- package/server/dist/routes/triage.js +29 -0
- package/server/dist/routes/triage.js.map +1 -1
- package/server/dist/terminal/data-target.d.ts +17 -0
- package/server/dist/terminal/data-target.d.ts.map +1 -0
- package/server/dist/terminal/data-target.js +56 -0
- package/server/dist/terminal/data-target.js.map +1 -0
- package/server/dist/terminal/image-paste.d.ts +2 -0
- package/server/dist/terminal/image-paste.d.ts.map +1 -1
- package/server/dist/terminal/image-paste.js +11 -12
- package/server/dist/terminal/image-paste.js.map +1 -1
- package/server/dist/terminal/pty-manager.d.ts +14 -0
- package/server/dist/terminal/pty-manager.d.ts.map +1 -1
- package/server/dist/terminal/pty-manager.js +11 -0
- package/server/dist/terminal/pty-manager.js.map +1 -1
- package/server/dist/terminal/routes.d.ts +5 -0
- package/server/dist/terminal/routes.d.ts.map +1 -1
- package/server/dist/terminal/routes.js +20 -13
- package/server/dist/terminal/routes.js.map +1 -1
- package/server/dist/terminal/ws-upgrade-handler.d.ts.map +1 -1
- package/server/dist/terminal/ws-upgrade-handler.fixtures.d.ts.map +1 -1
- package/server/dist/terminal/ws-upgrade-handler.fixtures.js +1 -0
- package/server/dist/terminal/ws-upgrade-handler.fixtures.js.map +1 -1
- package/server/dist/terminal/ws-upgrade-handler.js +14 -5
- package/server/dist/terminal/ws-upgrade-handler.js.map +1 -1
- package/server/dist/test/event-test-counts-fixtures.d.ts +40 -0
- package/server/dist/test/event-test-counts-fixtures.d.ts.map +1 -0
- package/server/dist/test/event-test-counts-fixtures.js +56 -0
- package/server/dist/test/event-test-counts-fixtures.js.map +1 -0
- package/server/dist/types/leadwright-beat-step.d.ts +19 -0
- package/server/dist/types/leadwright-beat-step.d.ts.map +1 -0
- package/server/dist/types/leadwright-beat-step.js +56 -0
- package/server/dist/types/leadwright-beat-step.js.map +1 -0
- package/server/dist/types/leadwright-preflight.d.ts +90 -0
- package/server/dist/types/leadwright-preflight.d.ts.map +1 -0
- package/server/dist/types/leadwright-preflight.js +65 -0
- package/server/dist/types/leadwright-preflight.js.map +1 -0
- package/server/dist/types/leadwright-schema-drift.d.ts +28 -0
- package/server/dist/types/leadwright-schema-drift.d.ts.map +1 -0
- package/server/dist/types/leadwright-schema-drift.js +89 -0
- package/server/dist/types/leadwright-schema-drift.js.map +1 -0
- package/server/dist/types/org-inventory.d.ts +53 -0
- package/server/dist/types/org-inventory.d.ts.map +1 -0
- package/server/dist/types/org-inventory.js +11 -0
- package/server/dist/types/org-inventory.js.map +1 -0
- package/server/dist/types/org.d.ts +57 -6
- package/server/dist/types/org.d.ts.map +1 -1
- package/server/dist/types/project.d.ts +9 -0
- package/server/dist/types/project.d.ts.map +1 -1
- package/server/dist/types/run-config-retry.d.ts +29 -0
- package/server/dist/types/run-config-retry.d.ts.map +1 -0
- package/server/dist/types/run-config-retry.js +47 -0
- package/server/dist/types/run-config-retry.js.map +1 -0
- package/server/dist/types/run-config-v2.d.ts +29 -41
- package/server/dist/types/run-config-v2.d.ts.map +1 -1
- package/server/dist/types/run-config-v2.js +16 -50
- package/server/dist/types/run-config-v2.js.map +1 -1
- package/server/dist/types/settings.d.ts +33 -0
- package/server/dist/types/settings.d.ts.map +1 -1
- package/server/dist/types/stack-profile-contract.d.ts +33 -0
- package/server/dist/types/stack-profile-contract.d.ts.map +1 -0
- package/server/dist/types/stack-profile-contract.js +11 -0
- package/server/dist/types/stack-profile-contract.js.map +1 -0
- package/server/dist/vendor/leadwright/beat-step.schema.json +83 -0
- package/server/dist/vendor/leadwright/claim-record-lock-contract.json +15 -0
- package/server/dist/vendor/leadwright/org-chart.schema.json +195 -0
- package/server/dist/vendor/leadwright/preflight-input.schema.json +318 -0
- package/server/dist/vendor/leadwright/preflight-result.schema.json +56 -0
- package/server/package.json +3 -3
- package/client/dist/assets/arc-DQmjbsFU.js +0 -1
- package/client/dist/assets/architectureDiagram-ZJ3FMSHR-DAvCsPCW.js +0 -36
- package/client/dist/assets/blockDiagram-677ZJIJ3-DC-dlyYI.js +0 -132
- package/client/dist/assets/c4Diagram-LMCZKHZV-DSlmXfhE.js +0 -10
- package/client/dist/assets/channel-BfmIcrp7.js +0 -1
- package/client/dist/assets/chunk-RYQCIY6F-BKhdp_8v.js +0 -1
- package/client/dist/assets/chunk-VR4S4FIN-OgFi2_iB.js +0 -1
- package/client/dist/assets/classDiagram-OUVF2IWQ-HfUQZ6Uc.js +0 -1
- package/client/dist/assets/classDiagram-v2-EOCWNBFH-HfUQZ6Uc.js +0 -1
- package/client/dist/assets/dagre-VKFMJZFB-D7djx1_Y.js +0 -4
- package/client/dist/assets/diagram-OA4YK3LP-CwQPbOn0.js +0 -30
- package/client/dist/assets/diagram-WEI45ONY-abtYnYqH.js +0 -41
- package/client/dist/assets/erDiagram-Q63AITRT-vtbCprgH.js +0 -85
- package/client/dist/assets/flowDiagram-23GEKE2U-CVCgcyDF.js +0 -156
- package/client/dist/assets/graph-C9eacEi8.js +0 -1
- package/client/dist/assets/index-CKU9dY18.css +0 -1
- package/client/dist/assets/index-DOMl6atu.js +0 -847
- package/client/dist/assets/infoDiagram-FWYZ7A6U-Dr4mN24J.js +0 -2
- package/client/dist/assets/katex-DkKDou_j.js +0 -257
- package/client/dist/assets/layout-DEXfKzaS.js +0 -1
- package/client/dist/assets/map-Czzmt4hB.js +0 -1
- package/client/dist/assets/mermaid.core-BcLNGbxW.js +0 -314
- package/client/dist/assets/stateDiagram-2N3HPSRC-CFwCOonY.js +0 -1
- package/client/dist/assets/stateDiagram-v2-6OUMAXLB-srkiu3Ib.js +0 -1
- package/client/dist/assets/swimlanes-5IMT3BWC-DFa2tzxu.js +0 -2
- package/client/dist/assets/swimlanesDiagram-G3AALYLV-Dq-0K9Zm.js +0 -8
- package/client/dist/assets/xychartDiagram-FW5EYKEG-D9PFTCfm.js +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var tl=Object.defineProperty;var il=(t,e,i)=>e in t?tl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var ws=(t,e,i)=>il(t,typeof e!="symbol"?e+"":e,i);import{r as x,a as sl,h as rl,T as en,b as nl,c as ol,d as al,s as ll,j as J,u as hl,e as cl,f as dl}from"./index-DOMl6atu.js";const ul=5e3,_l=2,fl=4e3,gl=8e3,pl=5e3,vl=5e3,Io=12,ml=3e4,Sl=1e4;function wl(t=_l){let e=0;return{notePong(){e=0},tick(){return e>=t?"terminate":(e+=1,"ping")}}}function bl(t){const e=wl(t.maxMissed),i=t.intervalMs??ul,s=t.setIntervalFn??setInterval,r=t.clearIntervalFn??clearInterval;let n=null,o=!1;const l=()=>{o||(o=!0,n!==null&&(r(n),n=null))};return n=s(()=>{if(!o){if(!t.isOpen()){l();return}if(e.tick()==="terminate"){t.onDead(),l();return}t.sendPing()}},i),{notePong:()=>e.notePong(),stop:l}}const yl=2e3,Cl=8e3;function xl(t){const e=t.now??(()=>Date.now()),i=t.intervalMs??yl,s=t.gapMs??Cl,r=t.setIntervalFn??setInterval,n=t.clearIntervalFn??clearInterval;let o=e(),l=!1;const h=r(()=>{if(l)return;const a=e(),c=a-o;o=a,c>s&&t.onWake()},i);return{stop(){l||(l=!0,n(h))}}}function kl(t){const e=t.refocusProbeMs??fl,i=t.setTimeoutFn??setTimeout,s=t.clearTimeoutFn??clearTimeout,r=t.nowFn??(()=>Date.now());let n=null,o=null,l=!1,h=r(),a=0;const c=()=>{const M=t.getSocket();if(M)try{M.send(JSON.stringify({type:"ping"}))}catch{}},d=()=>{l=!1,o!==null&&(s(o),o=null)},u=()=>{d(),h=r(),n==null||n.stop(),n=bl({isOpen:()=>{var M;return((M=t.getSocket())==null?void 0:M.readyState)===t.openState},sendPing:c,onDead:()=>{const M=t.getSocket();if(M)try{M.close()}catch{}},intervalMs:t.intervalMs,maxMissed:t.maxMissed,setIntervalFn:t.setIntervalFn,clearIntervalFn:t.clearIntervalFn})},_=()=>{n==null||n.stop(),n=null},f=()=>{h=r(),n==null||n.notePong(),d()},v=()=>{if(t.isReplayOnly())return;t.rearmBudget();const M=t.getSocket();if(!M){t.reconnect();return}if(M.readyState!==t.openState)return;c(),l=!0;const I=M;o!==null&&s(o),o=i(()=>{if(o=null,t.isCancelled()||!l)return;const N=t.getSocket();if(N===I&&N.readyState===t.openState)try{N.close()}catch{}},e)},b=()=>{t.isCancelled()||typeof document<"u"&&document.hidden||v()},y=()=>{t.isCancelled()||v()},C=()=>{if(t.isCancelled())return;const M=r();M-h<=gl||M-a<pl||(a=M,v())},L=xl({onWake:()=>{t.isCancelled()||v()},now:t.nowFn,intervalMs:t.wakeIntervalMs,gapMs:t.wakeGapMs,setIntervalFn:t.setIntervalFn,clearIntervalFn:t.clearIntervalFn}),g=typeof window<"u",B=typeof document<"u";return g&&(window.addEventListener("focus",b),window.addEventListener("pageshow",b),window.addEventListener("online",y)),B&&(document.addEventListener("visibilitychange",b),document.addEventListener("keydown",C,{capture:!0,passive:!0}),document.addEventListener("pointerdown",C,{capture:!0,passive:!0})),{onConnected:u,onDisconnected:_,noteInbound:f,dispose(){_(),d(),L.stop(),g&&(window.removeEventListener("focus",b),window.removeEventListener("pageshow",b),window.removeEventListener("online",y)),B&&(document.removeEventListener("visibilitychange",b),document.removeEventListener("keydown",C,{capture:!0}),document.removeEventListener("pointerdown",C,{capture:!0}))}}}const Ti=[200,400,800,1600,3200];function Ll(t){return t<Ti.length?Ti[t]:t<Ti.length+Io?vl:ml}function El(t){return t>=Ti.length+Io}function Rl(t){const e=t.timeoutMs??Sl,i=t.setTimeoutFn??setTimeout,s=t.clearTimeoutFn??clearTimeout;let r=null;const n=()=>{r!==null&&(s(r),r=null)};return{clear:n,arm(o){n(),r=i(()=>{if(r=null,!t.isCancelled()&&t.isCurrent(o)&&o.readyState===t.connectingState)try{o.close()}catch{}},e)}}}function Ml(t){const e=t.role==="writer"||t.role==="reader"?t.role:void 0,i=t.shellKind==="pwsh"||t.shellKind==="cmd"||t.shellKind==="posix"?t.shellKind:void 0;return{role:e,shellKind:i,replayOnly:typeof t.replayOnly=="boolean"?t.replayOnly:!1,scrollbackBytes:typeof t.scrollbackBytes=="number"&&t.scrollbackBytes>=0?t.scrollbackBytes:null,retentionDays:typeof t.retentionDays=="number"&&t.retentionDays>0?t.retentionDays:null,scrollbackDir:typeof t.scrollbackDir=="string"&&t.scrollbackDir.length>0?t.scrollbackDir:null,terminalReset:typeof t.terminalReset=="boolean"?t.terminalReset:!1,ptyReused:typeof t.ptyReused=="boolean"?t.ptyReused:!1}}function Bl(t){return typeof window>"u"?"":`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/terminal/${encodeURIComponent(t)}/ws`}function Tl(t){const{taskId:e,urlOverride:i,enabled:s=!0,sessionEnded:r,onData:n,onBackpressure:o,onReadOnly:l,onReplaySnapshot:h}=t,a=x.useRef(n),c=x.useRef(o),d=x.useRef(l),u=x.useRef(h);x.useEffect(()=>{a.current=n},[n]),x.useEffect(()=>{c.current=o},[o]),x.useEffect(()=>{d.current=l},[l]),x.useEffect(()=>{u.current=h},[h]);const[_,f]=x.useState(!1),[v,b]=x.useState(null),[y,C]=x.useState(null),[L,g]=x.useState(null),[B,M]=x.useState(null),[I,N]=x.useState(null),[G,Q]=x.useState(null),[$,S]=x.useState(null),[p,w]=x.useState(null),[m,k]=x.useState(!1),[E,A]=x.useState(null),[R,D]=x.useState(0),[z,Z]=x.useState(!1),[H,Y]=x.useState(!1),F=x.useRef(null),X=x.useRef(null),q=x.useRef(0),V=x.useRef(null),ee=x.useRef(!1),me=x.useRef(()=>{}),Ne=x.useRef(r);x.useEffect(()=>{Ne.current=r},[r]);const We=x.useRef(r),Te=x.useCallback(()=>{f(!1),b(null),C(null),g(null),M(null),N(null),Q(null),S(null),w(null),k(!1),Z(!1),Y(!1)},[]),j=x.useCallback(_e=>{const lt=F.current;if(!(!lt||lt.readyState!==WebSocket.OPEN))try{lt.send(JSON.stringify(_e))}catch{}},[]);return x.useEffect(()=>{if(!s||!e){Te(),V.current=null,ee.current=!1,We.current=r;return}V.current=null,ee.current=!1,We.current=r;let _e=!1;const lt=Rl({connectingState:WebSocket.CONNECTING,isCancelled:()=>_e,isCurrent:Ge=>F.current===Ge}),mt=()=>{if(_e)return;V.current=null;const Ge=i??Bl(e);let je;try{je=new WebSocket(Ge)}catch(Mt){A(String(Mt)),_i();return}F.current=je,lt.arm(je),je.addEventListener("open",()=>{_e||F.current!==je||(lt.clear(),k(!0),q.current=0,D(0),Z(!1),Y(!1),A(null),Rt.onConnected())}),je.addEventListener("message",Mt=>{var jr,Xr,Zr,Jr;if(_e||F.current!==je)return;let Zt;try{Zt=JSON.parse(typeof Mt.data=="string"?Mt.data:"")}catch{return}if(!Zt||typeof Zt!="object")return;const te=Zt;if(Rt.noteInbound(),te.type==="ready"){const Ae=Ml(te);Ae.role&&b(Ae.role),Ae.shellKind&&C(Ae.shellKind),g(Ae.replayOnly),V.current=Ae.replayOnly,Ae.replayOnly&&(ee.current=!0,Rt.onDisconnected(),Z(!1),Y(!1)),M(Ae.scrollbackBytes),N(Ae.retentionDays),Q(Ae.scrollbackDir),S(Ae.terminalReset),w(Ae.ptyReused),f(!0);return}if(te.type==="data"&&typeof te.payload=="string"){(jr=a.current)==null||jr.call(a,te.payload);return}if(te.type==="backpressure"){const Ae=Qr=>typeof Qr=="number"?Qr:0;(Xr=c.current)==null||Xr.call(c,{droppedBytes:Ae(te.droppedBytes),droppedChunks:Ae(te.droppedChunks),totalDroppedBytes:Ae(te.totalDroppedBytes),episode:Ae(te.episode),episodeEnded:te.episodeEnded===!0});return}if(te.type==="read_only"){(Zr=d.current)==null||Zr.call(d);return}if(te.type==="scrollback-meta"){typeof te.scrollbackBytes=="number"&&te.scrollbackBytes>=0&&M(te.scrollbackBytes);return}if(te.type==="writer-promoted"){b("writer");return}if(te.type==="replay_snapshot"&&typeof te.data=="string"&&typeof te.cols=="number"&&typeof te.rows=="number"&&typeof te.terminalVersion=="string"){(Jr=u.current)==null||Jr.call(u,{data:te.data,cols:te.cols,rows:te.rows,terminalVersion:te.terminalVersion});return}}),je.addEventListener("close",Mt=>{if(_e||F.current!==je)return;lt.clear(),k(!1),f(!1),F.current=null,Rt.onDisconnected();const Zt=Mt==null?void 0:Mt.code,te=V.current===!0&&Zt===1e3;if(V.current=null,te){if(Ne.current===!1){ee.current=!1,Te(),mt();return}return}_i()}),je.addEventListener("error",()=>{_e||F.current!==je||A("websocket error")})},_i=()=>{if(_e||ee.current)return;const Ge=q.current,je=Ll(Ge);q.current=Ge+1,Ge<Ti.length&&D(q.current),Z(!0),El(Ge)&&Y(!0),X.current=setTimeout(()=>{_e||mt()},je)},Rt=kl({getSocket:()=>F.current,openState:WebSocket.OPEN,isReplayOnly:()=>ee.current,isCancelled:()=>_e,rearmBudget:()=>{q.current=0,D(0)},reconnect:()=>{X.current&&(clearTimeout(X.current),X.current=null),mt()}});return me.current=()=>{_e||(X.current&&(clearTimeout(X.current),X.current=null),ee.current=!1,V.current=null,q.current=0,D(0),Te(),mt())},mt(),()=>{_e=!0,Rt.dispose(),lt.clear(),X.current&&(clearTimeout(X.current),X.current=null);const Ge=F.current;if(F.current=null,Ge)try{Ge.close(1e3,"unmount")}catch{}Te(),V.current=null}},[s,e,i,Te]),x.useEffect(()=>{const _e=We.current;We.current=r,_e===!0&&r===!1&&ee.current&&me.current()},[r]),{ready:_,role:v,shellKind:y,replayOnly:L,scrollbackBytes:B,retentionDays:I,scrollbackDir:G,terminalReset:$,ptyReused:p,lastError:E,reconnectAttempts:R,reconnecting:z,reconnectStalled:H,send:j,open:m}}function Al(t){if(t.type!=="keydown"||t.metaKey||t.altKey)return"passthrough";const e=t.key.toLowerCase(),i=t.key==="Insert";return t.ctrlKey&&!t.shiftKey&&e==="v"||t.shiftKey&&!t.ctrlKey&&i?"paste":"passthrough"}async function Dl(){if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"unavailable"};try{return{ok:!0,text:await navigator.clipboard.readText()}}catch{return{ok:!1,reason:"denied"}}}function Pl(t){const{term:e,isDisposed:i,notify:s,readClipboard:r}=t;return n=>Al(n)!=="paste"?!0:(n.preventDefault(),n.stopPropagation(),n.repeat||r().then(o=>{i()||(o.ok?o.text&&e.paste(o.text):o.reason==="unavailable"?s("paste-hint"):s("paste-failed"))}),!1)}const tn=1e6;function Ol(t){if(typeof atob!="function")return null;try{const e=atob(t.trim());try{return decodeURIComponent(Array.from(e).map(i=>"%"+i.charCodeAt(0).toString(16).padStart(2,"0")).join(""))}catch{return e}}catch{return null}}function Il(t){const e=t.indexOf(";"),i=e>=0?t.slice(e+1):t;if(i==="?")return{kind:"read"};if(i.length>Math.ceil(tn*4/3)+4)return{kind:"invalid"};const s=Ol(i);return s===null?{kind:"invalid"}:s.length>tn?{kind:"invalid"}:{kind:"write",text:s}}function Fl(t){const{copy:e,isDisposed:i,onError:s}=t;return r=>{const n=Il(r);return n.kind==="write"&&n.text&&e(n.text).catch(()=>{i!=null&&i()||s==null||s()}),!0}}const $l="\x1B",Fo=new RegExp("^"+$l+"\\[<(\\d+);\\d+;\\d+[Mm]$");function Nl(t){const e=Fo.exec(t);if(!e)return!1;const i=Number(e[1]);return i<64&&(i&3)===2}function Wl(t){return Fo.test(t)}function zl(t){return Nl(t)?null:{type:Wl(t)?"mouse":"data",payload:t}}const Hl=0;function Ul(){return{active:!1,identifier:null,lastY:0,pixelAccumulator:0}}function Kl(t,e,i){if(i<=0)return 0;t.pixelAccumulator+=e;const s=Math.trunc(t.pixelAccumulator/i);return s!==0&&(t.pixelAccumulator-=s*i),s}function ql(t,e,i={}){const s=Ul(),r=i.getPixelsPerLine??Gl,n=e.style.getPropertyValue("touch-action");e.style.setProperty("touch-action","none");const o=a=>{if(a.touches.length!==1){s.active=!1,s.identifier=null;return}const c=a.touches[0];s.active=!0,s.identifier=c.identifier,s.lastY=c.clientY,s.pixelAccumulator=0},l=a=>{if(!s.active||s.identifier===null)return;let c=null;for(let _=0;_<a.touches.length;_++)if(a.touches[_].identifier===s.identifier){c=a.touches[_];break}if(!c)return;const d=s.lastY-c.clientY;s.lastY=c.clientY;const u=r(t,e);Vl(t,s,d,u,c.clientX,c.clientY),a.cancelable&&a.preventDefault()},h=()=>{s.active=!1,s.identifier=null,s.pixelAccumulator=0};return e.addEventListener("touchstart",o,{passive:!0}),e.addEventListener("touchmove",l,{passive:!1}),e.addEventListener("touchend",h,{passive:!0}),e.addEventListener("touchcancel",h,{passive:!0}),()=>{e.removeEventListener("touchstart",o),e.removeEventListener("touchmove",l),e.removeEventListener("touchend",h),e.removeEventListener("touchcancel",h),n?e.style.setProperty("touch-action",n):e.style.removeProperty("touch-action")}}function Vl(t,e,i,s,r,n){const o=t.element??null,l=t.buffer.active.type==="alternate";if(o&&l){i!==0&&Yl(o,i,r,n);return}const h=Kl(e,i,s);h!==0&&t.scrollLines(h)}function Yl(t,e,i,s){t.dispatchEvent(new WheelEvent("wheel",{deltaY:e,deltaMode:Hl,clientX:i,clientY:s,bubbles:!0,cancelable:!0}))}function Gl(t,e){const i=e.querySelector(".xterm-rows");if(i&&i.children.length>0){const r=i.children[0].getBoundingClientRect().height;if(r>0)return r}if(t.rows>0){const s=e.clientHeight/t.rows;if(s>0)return s}return 18}const jl=150;function Xl(t,e,i,s={}){const r=s.requestFrame??(_=>requestAnimationFrame(_)),n=s.cancelFrame??(_=>cancelAnimationFrame(_)),o=s.setTimer??((_,f)=>setTimeout(_,f)),l=s.clearTimer??(_=>clearTimeout(_));let h=null,a=null;const c=()=>{if(!i())try{t.refresh(0,t.rows-1)}catch{}},d=()=>{i()||(h===null&&(h=r(()=>{h=null,c()})),a!==null&&l(a),a=o(()=>{var _,f;if(a=null,c(),!i())try{(f=(_=s.getHealAtlas)==null?void 0:_.call(s))==null||f()}catch{}},jl))},u=t.onScroll(d);return e.addEventListener("wheel",d,{passive:!0}),()=>{h!==null&&(n(h),h=null),a!==null&&(l(a),a=null);try{u.dispose()}catch{}e.removeEventListener("wheel",d)}}const Zl=450,Jl=3e3;function Ql(t,e,i={}){const s=i.requestFrame??(L=>requestAnimationFrame(L)),r=i.cancelFrame??(L=>cancelAnimationFrame(L)),n=i.setTimer??((L,g)=>setTimeout(L,g)),o=i.clearTimer??(L=>clearTimeout(L));let l=!1,h=null,a=null,c=null;const d=()=>{if(!e())try{t.refresh(0,t.rows-1)}catch{}},u=()=>{h===null&&(h=s(()=>{h=null,d()}))},_=()=>{a!==null&&(o(a),a=null)},f=()=>{l=!1,_(),c!==null&&(o(c),c=null),h!==null&&(r(h),h=null)},v=()=>{e()||(l=!0,_(),c!==null&&o(c),c=n(f,Jl))},b=()=>{!l||e()||(u(),_(),a=n(f,Zl))},y=t.onWriteParsed(b),C=t.onResize(v);return{arm:v,dispose(){f();try{y.dispose()}catch{}try{C.dispose()}catch{}}}}/**
|
|
1
|
+
var cl=Object.defineProperty;var dl=(t,e,i)=>e in t?cl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var bs=(t,e,i)=>dl(t,typeof e!="symbol"?e+"":e,i);import{r as x,a as ul,h as _l,T as rn,b as fl,c as gl,d as pl,s as vl,j as J,p as nn,e as zo,f as ml,i as on,C as Sl,k as wl,u as bl,l as yl,m as Cl}from"./index-DDSwQXcp.js";const xl=5e3,kl=2,Ll=4e3,El=8e3,Rl=5e3,Ml=5e3,Ho=12,Bl=3e4,Tl=1e4;function Al(t=kl){let e=0;return{notePong(){e=0},tick(){return e>=t?"terminate":(e+=1,"ping")}}}function Dl(t){const e=Al(t.maxMissed),i=t.intervalMs??xl,s=t.setIntervalFn??setInterval,r=t.clearIntervalFn??clearInterval;let n=null,o=!1;const l=()=>{o||(o=!0,n!==null&&(r(n),n=null))};return n=s(()=>{if(!o){if(!t.isOpen()){l();return}if(e.tick()==="terminate"){t.onDead(),l();return}t.sendPing()}},i),{notePong:()=>e.notePong(),stop:l}}const Pl=2e3,Il=8e3;function Ol(t){const e=t.now??(()=>Date.now()),i=t.intervalMs??Pl,s=t.gapMs??Il,r=t.setIntervalFn??setInterval,n=t.clearIntervalFn??clearInterval;let o=e(),l=!1;const h=r(()=>{if(l)return;const a=e(),c=a-o;o=a,c>s&&t.onWake()},i);return{stop(){l||(l=!0,n(h))}}}function Fl(t){let e=!1,i=null;return{isAwaiting:()=>e,arm:()=>{var l;const n=t.getSocket();if(!n)return;t.sendPing(),e=!0,(l=t.onProbing)==null||l.call(t,!0);const o=n;i!==null&&t.clearTimeoutFn(i),i=t.setTimeoutFn(()=>{if(i=null,t.isCancelled()||!e)return;const h=t.getSocket();if(h===o&&h.readyState===t.openState)try{h.close()}catch{}},t.refocusProbeMs)},clear:()=>{var n;e&&((n=t.onProbing)==null||n.call(t,!1)),e=!1,i!==null&&(t.clearTimeoutFn(i),i=null)}}}function $l(t){const e=t.refocusProbeMs??Ll,i=t.setTimeoutFn??setTimeout,s=t.clearTimeoutFn??clearTimeout,r=t.nowFn??(()=>Date.now());let n=null,o=r(),l=0;const h=()=>{const g=t.getSocket();if(g)try{g.send(JSON.stringify({type:"ping"}))}catch{}},a=Fl({getSocket:t.getSocket,openState:t.openState,sendPing:h,isCancelled:t.isCancelled,onProbing:t.onProbing,refocusProbeMs:e,setTimeoutFn:i,clearTimeoutFn:s}),c=()=>{a.clear(),o=r(),n==null||n.stop(),n=Dl({isOpen:()=>{var g;return((g=t.getSocket())==null?void 0:g.readyState)===t.openState},sendPing:h,onDead:()=>{const g=t.getSocket();if(g)try{g.close()}catch{}},intervalMs:t.intervalMs,maxMissed:t.maxMissed,setIntervalFn:t.setIntervalFn,clearIntervalFn:t.clearIntervalFn})},d=()=>{n==null||n.stop(),n=null},u=()=>{o=r(),n==null||n.notePong(),a.clear()},_=()=>{if(t.isReplayOnly())return;t.rearmBudget();const g=t.getSocket();if(!g){t.reconnect();return}g.readyState===t.openState&&a.arm()},f=()=>{t.isCancelled()||typeof document<"u"&&document.hidden||_()},p=()=>{t.isCancelled()||_()},w=()=>{if(t.isCancelled())return;const g=r();g-o<=El||g-l<Rl||(l=g,_())},C=Ol({onWake:()=>{t.isCancelled()||_()},now:t.nowFn,intervalMs:t.wakeIntervalMs,gapMs:t.wakeGapMs,setIntervalFn:t.setIntervalFn,clearIntervalFn:t.clearIntervalFn}),k=typeof window<"u",L=typeof document<"u";return k&&(window.addEventListener("focus",f),window.addEventListener("pageshow",f),window.addEventListener("online",p)),L&&(document.addEventListener("visibilitychange",f),document.addEventListener("keydown",w,{capture:!0,passive:!0}),document.addEventListener("pointerdown",w,{capture:!0,passive:!0})),{onConnected:c,onDisconnected:d,noteInbound:u,dispose(){d(),a.clear(),C.stop(),k&&(window.removeEventListener("focus",f),window.removeEventListener("pageshow",f),window.removeEventListener("online",p)),L&&(document.removeEventListener("visibilitychange",f),document.removeEventListener("keydown",w,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}))}}}const Ai=[200,400,800,1600,3200];function Nl(t){return t<Ai.length?Ai[t]:t<Ai.length+Ho?Ml:Bl}function Wl(t){return t>=Ai.length+Ho}function zl(t){const e=t.timeoutMs??Tl,i=t.setTimeoutFn??setTimeout,s=t.clearTimeoutFn??clearTimeout;let r=null;const n=()=>{r!==null&&(s(r),r=null)};return{clear:n,arm(o){n(),r=i(()=>{if(r=null,!t.isCancelled()&&t.isCurrent(o)&&o.readyState===t.connectingState)try{o.close()}catch{}},e)}}}function Hl(t){const e=t.role==="writer"||t.role==="reader"?t.role:void 0,i=t.shellKind==="pwsh"||t.shellKind==="cmd"||t.shellKind==="posix"?t.shellKind:void 0;return{role:e,shellKind:i,replayOnly:typeof t.replayOnly=="boolean"?t.replayOnly:!1,scrollbackBytes:typeof t.scrollbackBytes=="number"&&t.scrollbackBytes>=0?t.scrollbackBytes:null,retentionDays:typeof t.retentionDays=="number"&&t.retentionDays>0?t.retentionDays:null,scrollbackDir:typeof t.scrollbackDir=="string"&&t.scrollbackDir.length>0?t.scrollbackDir:null,terminalReset:typeof t.terminalReset=="boolean"?t.terminalReset:!1,ptyReused:typeof t.ptyReused=="boolean"?t.ptyReused:!1}}function Ul(t){return typeof window>"u"?"":`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/terminal/${encodeURIComponent(t)}/ws`}function Kl(t){const{taskId:e,urlOverride:i,enabled:s=!0,sessionEnded:r,onData:n,onBackpressure:o,onReadOnly:l,onReplaySnapshot:h}=t,a=x.useRef(n),c=x.useRef(o),d=x.useRef(l),u=x.useRef(h);x.useEffect(()=>{a.current=n},[n]),x.useEffect(()=>{c.current=o},[o]),x.useEffect(()=>{d.current=l},[l]),x.useEffect(()=>{u.current=h},[h]);const[_,f]=x.useState(!1),[p,w]=x.useState(null),[C,k]=x.useState(null),[L,g]=x.useState(null),[E,T]=x.useState(null),[O,$]=x.useState(null),[G,X]=x.useState(null),[N,m]=x.useState(null),[v,S]=x.useState(null),[y,b]=x.useState(!1),[R,A]=x.useState(null),[M,D]=x.useState(0),[H,Z]=x.useState(!1),[U,ue]=x.useState(!1),K=x.useRef(null),z=x.useRef(null),F=x.useRef(0),q=x.useRef(null),Q=x.useRef(!1),Ce=x.useRef(()=>{}),Ve=x.useRef(r);x.useEffect(()=>{Ve.current=r},[r]);const Se=x.useRef(r),ge=x.useCallback(()=>{f(!1),w(null),k(null),g(null),T(null),$(null),X(null),m(null),S(null),b(!1),Z(!1),ue(!1)},[]),j=x.useCallback(_e=>{const lt=K.current;if(!(!lt||lt.readyState!==WebSocket.OPEN))try{lt.send(JSON.stringify(_e))}catch{}},[]);return x.useEffect(()=>{if(!s||!e){ge(),q.current=null,Q.current=!1,Se.current=r;return}q.current=null,Q.current=!1,Se.current=r;let _e=!1;const lt=zl({connectingState:WebSocket.CONNECTING,isCancelled:()=>_e,isCurrent:We=>K.current===We}),mt=()=>{if(_e)return;q.current=null;const We=i??Ul(e);let Ge;try{Ge=new WebSocket(We)}catch(Mt){A(String(Mt)),_i();return}K.current=Ge,lt.arm(Ge),Ge.addEventListener("open",()=>{_e||K.current!==Ge||(lt.clear(),b(!0),F.current=0,D(0),Z(!1),ue(!1),A(null),Rt.onConnected())}),Ge.addEventListener("message",Mt=>{var Jr,Qr,en,tn;if(_e||K.current!==Ge)return;let Zt;try{Zt=JSON.parse(typeof Mt.data=="string"?Mt.data:"")}catch{return}if(!Zt||typeof Zt!="object")return;const ee=Zt;if(Rt.noteInbound(),ee.type==="ready"){const De=Hl(ee);De.role&&w(De.role),De.shellKind&&k(De.shellKind),g(De.replayOnly),q.current=De.replayOnly,De.replayOnly&&(Q.current=!0,Rt.onDisconnected(),Z(!1),ue(!1)),T(De.scrollbackBytes),$(De.retentionDays),X(De.scrollbackDir),m(De.terminalReset),S(De.ptyReused),f(!0);return}if(ee.type==="data"&&typeof ee.payload=="string"){(Jr=a.current)==null||Jr.call(a,ee.payload);return}if(ee.type==="backpressure"){const De=sn=>typeof sn=="number"?sn:0;(Qr=c.current)==null||Qr.call(c,{droppedBytes:De(ee.droppedBytes),droppedChunks:De(ee.droppedChunks),totalDroppedBytes:De(ee.totalDroppedBytes),episode:De(ee.episode),episodeEnded:ee.episodeEnded===!0});return}if(ee.type==="read_only"){(en=d.current)==null||en.call(d);return}if(ee.type==="scrollback-meta"){typeof ee.scrollbackBytes=="number"&&ee.scrollbackBytes>=0&&T(ee.scrollbackBytes);return}if(ee.type==="writer-promoted"){w("writer");return}if(ee.type==="replay_snapshot"&&typeof ee.data=="string"&&typeof ee.cols=="number"&&typeof ee.rows=="number"&&typeof ee.terminalVersion=="string"){(tn=u.current)==null||tn.call(u,{data:ee.data,cols:ee.cols,rows:ee.rows,terminalVersion:ee.terminalVersion});return}}),Ge.addEventListener("close",Mt=>{if(_e||K.current!==Ge)return;lt.clear(),b(!1),f(!1),K.current=null,Rt.onDisconnected();const Zt=Mt==null?void 0:Mt.code,ee=q.current===!0&&Zt===1e3;if(q.current=null,ee){if(Ve.current===!1){Q.current=!1,ge(),mt();return}return}_i()}),Ge.addEventListener("error",()=>{_e||K.current!==Ge||A("websocket error")})},_i=()=>{if(_e||Q.current)return;const We=F.current,Ge=Nl(We);F.current=We+1,We<Ai.length&&D(F.current),Z(!0),Wl(We)&&ue(!0),z.current=setTimeout(()=>{_e||mt()},Ge)},Rt=$l({getSocket:()=>K.current,openState:WebSocket.OPEN,isReplayOnly:()=>Q.current,isCancelled:()=>_e,rearmBudget:()=>{F.current=0,D(0)},reconnect:()=>{z.current&&(clearTimeout(z.current),z.current=null),mt()},onProbing:We=>Z(We)});return Ce.current=()=>{_e||(z.current&&(clearTimeout(z.current),z.current=null),Q.current=!1,q.current=null,F.current=0,D(0),ge(),mt())},mt(),()=>{_e=!0,Rt.dispose(),lt.clear(),z.current&&(clearTimeout(z.current),z.current=null);const We=K.current;if(K.current=null,We)try{We.close(1e3,"unmount")}catch{}ge(),q.current=null}},[s,e,i,ge]),x.useEffect(()=>{const _e=Se.current;Se.current=r,_e===!0&&r===!1&&Q.current&&Ce.current()},[r]),{ready:_,role:p,shellKind:C,replayOnly:L,scrollbackBytes:E,retentionDays:O,scrollbackDir:G,terminalReset:N,ptyReused:v,lastError:R,reconnectAttempts:M,reconnecting:H,reconnectStalled:U,send:j,open:y}}function ql(t){if(t.type!=="keydown"||t.metaKey)return"passthrough";if(t.altKey)return t.key.toLowerCase()==="v"&&!t.ctrlKey&&!t.shiftKey?"paste-image":"passthrough";const e=t.key.toLowerCase(),i=t.key==="Insert";return t.ctrlKey&&!t.shiftKey&&e==="v"||t.shiftKey&&!t.ctrlKey&&i?"paste":"passthrough"}async function Uo(){if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.read!="function")return null;try{return await navigator.clipboard.read()}catch{return null}}async function Ko(t){for(const e of t){const i=e.types.find(s=>s.startsWith("image/"));if(i)try{return await e.getType(i)}catch{}}return null}async function Vl(){const t=await Uo();return t?Ko(t):null}async function qo(){if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"unavailable"};const t=await Uo();if(t){const e=await Ko(t);if(e)return{ok:!0,image:e};for(const i of t)if(i.types.includes("text/plain"))try{return{ok:!0,text:await(await i.getType("text/plain")).text()}}catch{}}try{return{ok:!0,text:await navigator.clipboard.readText()}}catch{return{ok:!1,reason:"denied"}}}function Yl(t){const{term:e,isDisposed:i,notify:s,readClipboard:r,readImage:n,uploadImage:o}=t;return l=>{const h=ql(l);return h==="passthrough"?!0:h==="paste-image"?(l.preventDefault(),l.stopPropagation(),l.repeat||n().then(a=>{i()||(a?o(a):e.input("\x1Bv",!0))}),!1):(l.preventDefault(),l.stopPropagation(),l.repeat||r().then(a=>{if(!i())if(a.ok){if(a.image){o(a.image);return}a.text&&e.paste(a.text)}else a.reason==="unavailable"?s("paste-hint"):s("paste-failed")}),!1)}}async function jl(t){if(!t.writer||!t.term)return;const e=await qo();if(!t.isDisposed()){if(!e.ok)return t.notify(e.reason==="unavailable"?"paste-hint":"paste-failed");try{e.image?t.uploadImage(e.image):e.text&&t.term.paste(e.text)}catch{t.notify("paste-failed")}}}const an=1e6;function Gl(t){if(typeof atob!="function")return null;try{const e=atob(t.trim());try{return decodeURIComponent(Array.from(e).map(i=>"%"+i.charCodeAt(0).toString(16).padStart(2,"0")).join(""))}catch{return e}}catch{return null}}function Xl(t){const e=t.indexOf(";"),i=e>=0?t.slice(e+1):t;if(i==="?")return{kind:"read"};if(i.length>Math.ceil(an*4/3)+4)return{kind:"invalid"};const s=Gl(i);return s===null?{kind:"invalid"}:s.length>an?{kind:"invalid"}:{kind:"write",text:s}}function Zl(t){const{copy:e,isDisposed:i,onError:s}=t;return r=>{const n=Xl(r);return n.kind==="write"&&n.text&&e(n.text).catch(()=>{i!=null&&i()||s==null||s()}),!0}}const Jl="\x1B",Vo=new RegExp("^"+Jl+"\\[<(\\d+);\\d+;\\d+[Mm]$");function Ql(t){const e=Vo.exec(t);if(!e)return!1;const i=Number(e[1]);return i<64&&(i&3)===2}function eh(t){return Vo.test(t)}function th(t){return Ql(t)?null:{type:eh(t)?"mouse":"data",payload:t}}const ih=0;function sh(){return{active:!1,identifier:null,lastY:0,pixelAccumulator:0}}function rh(t,e,i){if(i<=0)return 0;t.pixelAccumulator+=e;const s=Math.trunc(t.pixelAccumulator/i);return s!==0&&(t.pixelAccumulator-=s*i),s}function nh(t,e,i={}){const s=sh(),r=i.getPixelsPerLine??lh,n=e.style.getPropertyValue("touch-action");e.style.setProperty("touch-action","none");const o=a=>{if(a.touches.length!==1){s.active=!1,s.identifier=null;return}const c=a.touches[0];s.active=!0,s.identifier=c.identifier,s.lastY=c.clientY,s.pixelAccumulator=0},l=a=>{if(!s.active||s.identifier===null)return;let c=null;for(let _=0;_<a.touches.length;_++)if(a.touches[_].identifier===s.identifier){c=a.touches[_];break}if(!c)return;const d=s.lastY-c.clientY;s.lastY=c.clientY;const u=r(t,e);oh(t,s,d,u,c.clientX,c.clientY),a.cancelable&&a.preventDefault()},h=()=>{s.active=!1,s.identifier=null,s.pixelAccumulator=0};return e.addEventListener("touchstart",o,{passive:!0}),e.addEventListener("touchmove",l,{passive:!1}),e.addEventListener("touchend",h,{passive:!0}),e.addEventListener("touchcancel",h,{passive:!0}),()=>{e.removeEventListener("touchstart",o),e.removeEventListener("touchmove",l),e.removeEventListener("touchend",h),e.removeEventListener("touchcancel",h),n?e.style.setProperty("touch-action",n):e.style.removeProperty("touch-action")}}function oh(t,e,i,s,r,n){const o=t.element??null,l=t.buffer.active.type==="alternate";if(o&&l){i!==0&&ah(o,i,r,n);return}const h=rh(e,i,s);h!==0&&t.scrollLines(h)}function ah(t,e,i,s){t.dispatchEvent(new WheelEvent("wheel",{deltaY:e,deltaMode:ih,clientX:i,clientY:s,bubbles:!0,cancelable:!0}))}function lh(t,e){const i=e.querySelector(".xterm-rows");if(i&&i.children.length>0){const r=i.children[0].getBoundingClientRect().height;if(r>0)return r}if(t.rows>0){const s=e.clientHeight/t.rows;if(s>0)return s}return 18}const hh=150;function ch(t,e,i,s={}){const r=s.requestFrame??(_=>requestAnimationFrame(_)),n=s.cancelFrame??(_=>cancelAnimationFrame(_)),o=s.setTimer??((_,f)=>setTimeout(_,f)),l=s.clearTimer??(_=>clearTimeout(_));let h=null,a=null;const c=()=>{if(!i())try{t.refresh(0,t.rows-1)}catch{}},d=()=>{i()||(h===null&&(h=r(()=>{h=null,c()})),a!==null&&l(a),a=o(()=>{var _,f;if(a=null,c(),!i())try{(f=(_=s.getHealAtlas)==null?void 0:_.call(s))==null||f()}catch{}},hh))},u=t.onScroll(d);return e.addEventListener("wheel",d,{passive:!0}),()=>{h!==null&&(n(h),h=null),a!==null&&(l(a),a=null);try{u.dispose()}catch{}e.removeEventListener("wheel",d)}}const dh=450,uh=3e3;function _h(t,e,i={}){const s=i.requestFrame??(L=>requestAnimationFrame(L)),r=i.cancelFrame??(L=>cancelAnimationFrame(L)),n=i.setTimer??((L,g)=>setTimeout(L,g)),o=i.clearTimer??(L=>clearTimeout(L));let l=!1,h=null,a=null,c=null;const d=()=>{if(!e())try{t.refresh(0,t.rows-1)}catch{}},u=()=>{h===null&&(h=s(()=>{h=null,d()}))},_=()=>{a!==null&&(o(a),a=null)},f=()=>{l=!1,_(),c!==null&&(o(c),c=null),h!==null&&(r(h),h=null)},p=()=>{e()||(l=!0,_(),c!==null&&o(c),c=n(f,uh))},w=()=>{!l||e()||(u(),_(),a=n(f,dh))},C=t.onWriteParsed(w),k=t.onResize(p);return{arm:p,dispose(){f();try{C.dispose()}catch{}try{k.dispose()}catch{}}}}/**
|
|
2
2
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
3
3
|
* @license MIT
|
|
4
4
|
*
|
|
@@ -9,22 +9,22 @@ var tl=Object.defineProperty;var il=(t,e,i)=>e in t?tl(t,e,{enumerable:!0,config
|
|
|
9
9
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
10
10
|
* http://bellard.org/jslinux/
|
|
11
11
|
* Copyright (c) 2011 Fabrice Bellard
|
|
12
|
-
*/var
|
|
12
|
+
*/var Yo=Object.defineProperty,fh=Object.getOwnPropertyDescriptor,gh=(t,e)=>{for(var i in e)Yo(t,i,{get:e[i],enumerable:!0})},de=(t,e,i,s)=>{for(var r=s>1?void 0:s?fh(e,i):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&Yo(e,i,r),r},I=(t,e)=>(i,s)=>e(i,s,t),ln="Terminal input",Gs={get:()=>ln,set:t=>ln=t},hn="Too much output to announce, navigate to rows manually to read",Xs={get:()=>hn,set:t=>hn=t};function ph(t){return t.replace(/\r?\n/g,"\r")}function vh(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function mh(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function Sh(t,e,i,s){if(t.stopPropagation(),t.clipboardData){let r=t.clipboardData.getData("text/plain");jo(r,e,i,s)}}function jo(t,e,i,s){t=ph(t),t=vh(t,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(t,!0),e.value=""}function Go(t,e,i){let s=i.getBoundingClientRect(),r=t.clientX-s.left-10,n=t.clientY-s.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${r}px`,e.style.top=`${n}px`,e.style.zIndex="1000",e.focus()}function cn(t,e,i,s,r){Go(t,e,i),r&&s.rightClickSelect(t),e.value=s.selectionText,e.select()}function Ot(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function ps(t,e=0,i=t.length){let s="";for(let r=e;r<i;++r){let n=t[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var wh=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,i){let s=e.length;if(!s)return 0;let r=0,n=0;if(this._interim){let o=e.charCodeAt(n++);56320<=o&&o<=57343?i[r++]=(this._interim-55296)*1024+o-56320+65536:(i[r++]=this._interim,i[r++]=o),this._interim=0}for(let o=n;o<s;++o){let l=e.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=s)return this._interim=l,r;let h=e.charCodeAt(o);56320<=h&&h<=57343?i[r++]=(l-55296)*1024+h-56320+65536:(i[r++]=l,i[r++]=h);continue}l!==65279&&(i[r++]=l)}return r}},bh=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,i){let s=e.length;if(!s)return 0;let r=0,n,o,l,h,a=0,c=0;if(this.interim[0]){let _=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let p=0,w;for(;(w=this.interim[++p]&63)&&p<4;)f<<=6,f|=w;let C=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,k=C-p;for(;c<k;){if(c>=s)return 0;if(w=e[c++],(w&192)!==128){c--,_=!0;break}else this.interim[p++]=w,f<<=6,f|=w&63}_||(C===2?f<128?c--:i[r++]=f:C===3?f<2048||f>=55296&&f<=57343||f===65279||(i[r++]=f):f<65536||f>1114111||(i[r++]=f)),this.interim.fill(0)}let d=s-4,u=c;for(;u<s;){for(;u<d&&!((n=e[u])&128)&&!((o=e[u+1])&128)&&!((l=e[u+2])&128)&&!((h=e[u+3])&128);)i[r++]=n,i[r++]=o,i[r++]=l,i[r++]=h,u+=4;if(n=e[u++],n<128)i[r++]=n;else if((n&224)===192){if(u>=s)return this.interim[0]=n,r;if(o=e[u++],(o&192)!==128){u--;continue}if(a=(n&31)<<6|o&63,a<128){u--;continue}i[r++]=a}else if((n&240)===224){if(u>=s)return this.interim[0]=n,r;if(o=e[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=n,this.interim[1]=o,r;if(l=e[u++],(l&192)!==128){u--;continue}if(a=(n&15)<<12|(o&63)<<6|l&63,a<2048||a>=55296&&a<=57343||a===65279)continue;i[r++]=a}else if((n&248)===240){if(u>=s)return this.interim[0]=n,r;if(o=e[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=n,this.interim[1]=o,r;if(l=e[u++],(l&192)!==128){u--;continue}if(u>=s)return this.interim[0]=n,this.interim[1]=o,this.interim[2]=l,r;if(h=e[u++],(h&192)!==128){u--;continue}if(a=(n&7)<<18|(o&63)<<12|(l&63)<<6|h&63,a<65536||a>1114111)continue;i[r++]=a}}return r}},Xo="",Ft=" ",$i=class Zo{constructor(){this.fg=0,this.bg=0,this.extended=new hs}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new Zo;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}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}},hs=class Jo{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new Jo(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},rt=class Qo extends $i{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new hs,this.combinedData=""}static fromCharData(e){let i=new Qo;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ot(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},dn="di$target",Zs="di$dependencies",ys=new Map;function yh(t){return t[Zs]||[]}function Ae(t){if(ys.has(t))return ys.get(t);let e=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ch(e,i,r)};return e._id=t,ys.set(t,e),e}function Ch(t,e,i){e[dn]===e?e[Zs].push({id:t,index:i}):(e[Zs]=[{id:t,index:i}],e[dn]=e)}var Ke=Ae("BufferService"),ea=Ae("CoreMouseService"),Xt=Ae("CoreService"),xh=Ae("CharsetService"),Nr=Ae("InstantiationService"),ta=Ae("LogService"),qe=Ae("OptionsService"),ia=Ae("OscLinkService"),kh=Ae("UnicodeService"),Ni=Ae("DecorationService"),Js=class{constructor(e,i,s){this._bufferService=e,this._optionsService=i,this._oscLinkService=s}provideLinks(e,i){var d;let s=this._bufferService.buffer.lines.get(e-1);if(!s){i(void 0);return}let r=[],n=this._optionsService.rawOptions.linkHandler,o=new rt,l=s.getTrimmedLength(),h=-1,a=-1,c=!1;for(let u=0;u<l;u++)if(!(a===-1&&!s.hasContent(u))){if(s.loadCell(u,o),o.hasExtendedAttrs()&&o.extended.urlId)if(a===-1){a=u,h=o.extended.urlId;continue}else c=o.extended.urlId!==h;else a!==-1&&(c=!0);if(c||a!==-1&&u===l-1){let _=(d=this._oscLinkService.getLinkData(h))==null?void 0:d.uri;if(_){let f={start:{x:a+1,y:e},end:{x:u+(!c&&u===l-1?1:0),y:e}},p=!1;if(!(n!=null&&n.allowNonHttpProtocols))try{let w=new URL(_);["http:","https:"].includes(w.protocol)||(p=!0)}catch{p=!0}p||r.push({text:_,range:f,activate:(w,C)=>n?n.activate(w,C,f):Lh(w,C),hover:(w,C)=>{var k;return(k=n==null?void 0:n.hover)==null?void 0:k.call(n,w,C,f)},leave:(w,C)=>{var k;return(k=n==null?void 0:n.leave)==null?void 0:k.call(n,w,C,f)}})}c=!1,o.hasExtendedAttrs()&&o.extended.urlId?(a=u,h=o.extended.urlId):(a=-1,h=-1)}}i(r)}};Js=de([I(0,Ke),I(1,qe),I(2,ia)],Js);function Lh(t,e){if(confirm(`Do you want to navigate to ${e}?
|
|
13
13
|
|
|
14
|
-
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var
|
|
14
|
+
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var vs=Ae("CharSizeService"),Lt=Ae("CoreBrowserService"),Wr=Ae("MouseService"),Et=Ae("RenderService"),Eh=Ae("SelectionService"),sa=Ae("CharacterJoinerService"),ci=Ae("ThemeService"),ra=Ae("LinkProviderService"),Rh=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?un.isErrorNoTelemetry(e)?new un(e.message+`
|
|
15
15
|
|
|
16
16
|
`+e.stack):new Error(e.message+`
|
|
17
17
|
|
|
18
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(i=>{i(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},gh=new fh;function Ji(t){ph(t)||gh.onUnexpectedError(t)}var Xs="Canceled";function ph(t){return t instanceof vh?!0:t instanceof Error&&t.name===Xs&&t.message===Xs}var vh=class extends Error{constructor(){super(Xs),this.name=this.message}};function mh(t){return new Error(`Illegal argument: ${t}`)}var an=class Zs extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof Zs)return e;let i=new Zs;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},Js=class Xo extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,Xo.prototype)}};function Xe(t,e=0){return t[t.length-(1+e)]}var Sh;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function s(n){return n>0}t.isGreaterThan=s;function r(n){return n===0}t.isNeitherLessOrGreaterThan=r,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(Sh||(Sh={}));function wh(t,e){let i=this,s=!1,r;return function(){return s||(s=!0,e||(r=t.apply(i,arguments))),r}}var Zo;(t=>{function e(g){return g&&typeof g=="object"&&typeof g[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function s(){return i}t.empty=s;function*r(g){yield g}t.single=r;function n(g){return e(g)?g:r(g)}t.wrap=n;function o(g){return g||i}t.from=o;function*l(g){for(let B=g.length-1;B>=0;B--)yield g[B]}t.reverse=l;function h(g){return!g||g[Symbol.iterator]().next().done===!0}t.isEmpty=h;function a(g){return g[Symbol.iterator]().next().value}t.first=a;function c(g,B){let M=0;for(let I of g)if(B(I,M++))return!0;return!1}t.some=c;function d(g,B){for(let M of g)if(B(M))return M}t.find=d;function*u(g,B){for(let M of g)B(M)&&(yield M)}t.filter=u;function*_(g,B){let M=0;for(let I of g)yield B(I,M++)}t.map=_;function*f(g,B){let M=0;for(let I of g)yield*B(I,M++)}t.flatMap=f;function*v(...g){for(let B of g)yield*B}t.concat=v;function b(g,B,M){let I=M;for(let N of g)I=B(I,N);return I}t.reduce=b;function*y(g,B,M=g.length){for(B<0&&(B+=g.length),M<0?M+=g.length:M>g.length&&(M=g.length);B<M;B++)yield g[B]}t.slice=y;function C(g,B=Number.POSITIVE_INFINITY){let M=[];if(B===0)return[M,g];let I=g[Symbol.iterator]();for(let N=0;N<B;N++){let G=I.next();if(G.done)return[M,t.empty()];M.push(G.value)}return[M,{[Symbol.iterator](){return I}}]}t.consume=C;async function L(g){let B=[];for await(let M of g)B.push(M);return Promise.resolve(B)}t.asyncToArray=L})(Zo||(Zo={}));function Gt(t){if(Zo.is(t)){let e=[];for(let i of t)if(i)try{i.dispose()}catch(s){e.push(s)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function bh(...t){return oe(()=>Gt(t))}function oe(t){return{dispose:wh(()=>{t()})}}var Jo=class Qo{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Gt(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Qo.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};Jo.DISABLE_DISPOSED_WARNING=!1;var $t=Jo,K=class{constructor(){this._store=new $t,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};K.None=Object.freeze({dispose(){}});var hi=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var i;this._isDisposed||e===this._value||((i=this._value)==null||i.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},xt=typeof window=="object"?window:globalThis,Qs=class er{constructor(e){this.element=e,this.next=er.Undefined,this.prev=er.Undefined}};Qs.Undefined=new Qs(void 0);var ae=Qs,ln=class{constructor(){this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ae.Undefined}clear(){let e=this._first;for(;e!==ae.Undefined;){let i=e.next;e.prev=ae.Undefined,e.next=ae.Undefined,e=i}this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,i){let s=new ae(e);if(this._first===ae.Undefined)this._first=s,this._last=s;else if(i){let n=this._last;this._last=s,s.prev=n,n.next=s}else{let n=this._first;this._first=s,s.next=n,n.prev=s}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(s))}}shift(){if(this._first!==ae.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ae.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ae.Undefined&&e.next!==ae.Undefined){let i=e.prev;i.next=e.next,e.next.prev=i}else e.prev===ae.Undefined&&e.next===ae.Undefined?(this._first=ae.Undefined,this._last=ae.Undefined):e.next===ae.Undefined?(this._last=this._last.prev,this._last.next=ae.Undefined):e.prev===ae.Undefined&&(this._first=this._first.next,this._first.prev=ae.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ae.Undefined;)yield e.element,e=e.next}},yh=globalThis.performance&&typeof globalThis.performance.now=="function",Ch=class ea{static create(e){return new ea(e)}constructor(e){this._now=yh&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Ie;(t=>{t.None=()=>K.None;function e(S,p){return d(S,()=>{},0,void 0,!0,void 0,p)}t.defer=e;function i(S){return(p,w=null,m)=>{let k=!1,E;return E=S(A=>{if(!k)return E?E.dispose():k=!0,p.call(w,A)},null,m),k&&E.dispose(),E}}t.once=i;function s(S,p,w){return a((m,k=null,E)=>S(A=>m.call(k,p(A)),null,E),w)}t.map=s;function r(S,p,w){return a((m,k=null,E)=>S(A=>{p(A),m.call(k,A)},null,E),w)}t.forEach=r;function n(S,p,w){return a((m,k=null,E)=>S(A=>p(A)&&m.call(k,A),null,E),w)}t.filter=n;function o(S){return S}t.signal=o;function l(...S){return(p,w=null,m)=>{let k=bh(...S.map(E=>E(A=>p.call(w,A))));return c(k,m)}}t.any=l;function h(S,p,w,m){let k=w;return s(S,E=>(k=p(k,E),k),m)}t.reduce=h;function a(S,p){let w,m={onWillAddFirstListener(){w=S(k.fire,k)},onDidRemoveLastListener(){w==null||w.dispose()}},k=new P(m);return p==null||p.add(k),k.event}function c(S,p){return p instanceof Array?p.push(S):p&&p.add(S),S}function d(S,p,w=100,m=!1,k=!1,E,A){let R,D,z,Z=0,H,Y={leakWarningThreshold:E,onWillAddFirstListener(){R=S(X=>{Z++,D=p(D,X),m&&!z&&(F.fire(D),D=void 0),H=()=>{let q=D;D=void 0,z=void 0,(!m||Z>1)&&F.fire(q),Z=0},typeof w=="number"?(clearTimeout(z),z=setTimeout(H,w)):z===void 0&&(z=0,queueMicrotask(H))})},onWillRemoveListener(){k&&Z>0&&(H==null||H())},onDidRemoveLastListener(){H=void 0,R.dispose()}},F=new P(Y);return A==null||A.add(F),F.event}t.debounce=d;function u(S,p=0,w){return t.debounce(S,(m,k)=>m?(m.push(k),m):[k],p,void 0,!0,void 0,w)}t.accumulate=u;function _(S,p=(m,k)=>m===k,w){let m=!0,k;return n(S,E=>{let A=m||!p(E,k);return m=!1,k=E,A},w)}t.latch=_;function f(S,p,w){return[t.filter(S,p,w),t.filter(S,m=>!p(m),w)]}t.split=f;function v(S,p=!1,w=[],m){let k=w.slice(),E=S(D=>{k?k.push(D):R.fire(D)});m&&m.add(E);let A=()=>{k==null||k.forEach(D=>R.fire(D)),k=null},R=new P({onWillAddFirstListener(){E||(E=S(D=>R.fire(D)),m&&m.add(E))},onDidAddFirstListener(){k&&(p?setTimeout(A):A())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return m&&m.add(R),R.event}t.buffer=v;function b(S,p){return(w,m,k)=>{let E=p(new C);return S(function(A){let R=E.evaluate(A);R!==y&&w.call(m,R)},void 0,k)}}t.chain=b;let y=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(p){return this.steps.push(p),this}forEach(p){return this.steps.push(w=>(p(w),w)),this}filter(p){return this.steps.push(w=>p(w)?w:y),this}reduce(p,w){let m=w;return this.steps.push(k=>(m=p(m,k),m)),this}latch(p=(w,m)=>w===m){let w=!0,m;return this.steps.push(k=>{let E=w||!p(k,m);return w=!1,m=k,E?k:y}),this}evaluate(p){for(let w of this.steps)if(p=w(p),p===y)break;return p}}function L(S,p,w=m=>m){let m=(...R)=>A.fire(w(...R)),k=()=>S.on(p,m),E=()=>S.removeListener(p,m),A=new P({onWillAddFirstListener:k,onDidRemoveLastListener:E});return A.event}t.fromNodeEventEmitter=L;function g(S,p,w=m=>m){let m=(...R)=>A.fire(w(...R)),k=()=>S.addEventListener(p,m),E=()=>S.removeEventListener(p,m),A=new P({onWillAddFirstListener:k,onDidRemoveLastListener:E});return A.event}t.fromDOMEventEmitter=g;function B(S){return new Promise(p=>i(S)(p))}t.toPromise=B;function M(S){let p=new P;return S.then(w=>{p.fire(w)},()=>{p.fire(void 0)}).finally(()=>{p.dispose()}),p.event}t.fromPromise=M;function I(S,p){return S(w=>p.fire(w))}t.forward=I;function N(S,p,w){return p(w),S(m=>p(m))}t.runAndSubscribe=N;class G{constructor(p,w){this._observable=p,this._counter=0,this._hasChanged=!1;let m={onWillAddFirstListener:()=>{p.addObserver(this)},onDidRemoveLastListener:()=>{p.removeObserver(this)}};this.emitter=new P(m),w&&w.add(this.emitter)}beginUpdate(p){this._counter++}handlePossibleChange(p){}handleChange(p,w){this._hasChanged=!0}endUpdate(p){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Q(S,p){return new G(S,p).emitter.event}t.fromObservable=Q;function $(S){return(p,w,m)=>{let k=0,E=!1,A={beginUpdate(){k++},endUpdate(){k--,k===0&&(S.reportChanges(),E&&(E=!1,p.call(w)))},handlePossibleChange(){},handleChange(){E=!0}};S.addObserver(A),S.reportChanges();let R={dispose(){S.removeObserver(A)}};return m instanceof $t?m.add(R):Array.isArray(m)&&m.push(R),R}}t.fromObservableLight=$})(Ie||(Ie={}));var tr=class ir{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${ir._idPool++}`,ir.all.add(this)}start(e){this._stopWatch=new Ch,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};tr.all=new Set,tr._idPool=0;var xh=tr,kh=-1,ta=class ia{constructor(e,i,s=(ia._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[n,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(n);let h=new Rh(l,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[s,r]of this._stacks)(!e||i<r)&&(e=[s,r],i=r);return e}};ta._idPool=1;var Lh=ta,Eh=class sa{constructor(e){this.value=e}static create(){let e=new Error;return new sa(e.stack??"")}print(){console.warn(this.value.split(`
|
|
18
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(i=>{i(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},Mh=new Rh;function Qi(t){Bh(t)||Mh.onUnexpectedError(t)}var Qs="Canceled";function Bh(t){return t instanceof Th?!0:t instanceof Error&&t.name===Qs&&t.message===Qs}var Th=class extends Error{constructor(){super(Qs),this.name=this.message}};function Ah(t){return new Error(`Illegal argument: ${t}`)}var un=class er extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof er)return e;let i=new er;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},tr=class na extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,na.prototype)}};function Xe(t,e=0){return t[t.length-(1+e)]}var Dh;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function s(n){return n>0}t.isGreaterThan=s;function r(n){return n===0}t.isNeitherLessOrGreaterThan=r,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(Dh||(Dh={}));function Ph(t,e){let i=this,s=!1,r;return function(){return s||(s=!0,e||(r=t.apply(i,arguments))),r}}var oa;(t=>{function e(g){return g&&typeof g=="object"&&typeof g[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function s(){return i}t.empty=s;function*r(g){yield g}t.single=r;function n(g){return e(g)?g:r(g)}t.wrap=n;function o(g){return g||i}t.from=o;function*l(g){for(let E=g.length-1;E>=0;E--)yield g[E]}t.reverse=l;function h(g){return!g||g[Symbol.iterator]().next().done===!0}t.isEmpty=h;function a(g){return g[Symbol.iterator]().next().value}t.first=a;function c(g,E){let T=0;for(let O of g)if(E(O,T++))return!0;return!1}t.some=c;function d(g,E){for(let T of g)if(E(T))return T}t.find=d;function*u(g,E){for(let T of g)E(T)&&(yield T)}t.filter=u;function*_(g,E){let T=0;for(let O of g)yield E(O,T++)}t.map=_;function*f(g,E){let T=0;for(let O of g)yield*E(O,T++)}t.flatMap=f;function*p(...g){for(let E of g)yield*E}t.concat=p;function w(g,E,T){let O=T;for(let $ of g)O=E(O,$);return O}t.reduce=w;function*C(g,E,T=g.length){for(E<0&&(E+=g.length),T<0?T+=g.length:T>g.length&&(T=g.length);E<T;E++)yield g[E]}t.slice=C;function k(g,E=Number.POSITIVE_INFINITY){let T=[];if(E===0)return[T,g];let O=g[Symbol.iterator]();for(let $=0;$<E;$++){let G=O.next();if(G.done)return[T,t.empty()];T.push(G.value)}return[T,{[Symbol.iterator](){return O}}]}t.consume=k;async function L(g){let E=[];for await(let T of g)E.push(T);return Promise.resolve(E)}t.asyncToArray=L})(oa||(oa={}));function jt(t){if(oa.is(t)){let e=[];for(let i of t)if(i)try{i.dispose()}catch(s){e.push(s)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function Ih(...t){return ne(()=>jt(t))}function ne(t){return{dispose:Ph(()=>{t()})}}var aa=class la{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{jt(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?la.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};aa.DISABLE_DISPOSED_WARNING=!1;var $t=aa,Y=class{constructor(){this._store=new $t,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Y.None=Object.freeze({dispose(){}});var hi=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var i;this._isDisposed||e===this._value||((i=this._value)==null||i.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},xt=typeof window=="object"?window:globalThis,ir=class sr{constructor(e){this.element=e,this.next=sr.Undefined,this.prev=sr.Undefined}};ir.Undefined=new ir(void 0);var oe=ir,_n=class{constructor(){this._first=oe.Undefined,this._last=oe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===oe.Undefined}clear(){let e=this._first;for(;e!==oe.Undefined;){let i=e.next;e.prev=oe.Undefined,e.next=oe.Undefined,e=i}this._first=oe.Undefined,this._last=oe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,i){let s=new oe(e);if(this._first===oe.Undefined)this._first=s,this._last=s;else if(i){let n=this._last;this._last=s,s.prev=n,n.next=s}else{let n=this._first;this._first=s,s.next=n,n.prev=s}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(s))}}shift(){if(this._first!==oe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==oe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==oe.Undefined&&e.next!==oe.Undefined){let i=e.prev;i.next=e.next,e.next.prev=i}else e.prev===oe.Undefined&&e.next===oe.Undefined?(this._first=oe.Undefined,this._last=oe.Undefined):e.next===oe.Undefined?(this._last=this._last.prev,this._last.next=oe.Undefined):e.prev===oe.Undefined&&(this._first=this._first.next,this._first.prev=oe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==oe.Undefined;)yield e.element,e=e.next}},Oh=globalThis.performance&&typeof globalThis.performance.now=="function",Fh=class ha{static create(e){return new ha(e)}constructor(e){this._now=Oh&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Fe;(t=>{t.None=()=>Y.None;function e(m,v){return d(m,()=>{},0,void 0,!0,void 0,v)}t.defer=e;function i(m){return(v,S=null,y)=>{let b=!1,R;return R=m(A=>{if(!b)return R?R.dispose():b=!0,v.call(S,A)},null,y),b&&R.dispose(),R}}t.once=i;function s(m,v,S){return a((y,b=null,R)=>m(A=>y.call(b,v(A)),null,R),S)}t.map=s;function r(m,v,S){return a((y,b=null,R)=>m(A=>{v(A),y.call(b,A)},null,R),S)}t.forEach=r;function n(m,v,S){return a((y,b=null,R)=>m(A=>v(A)&&y.call(b,A),null,R),S)}t.filter=n;function o(m){return m}t.signal=o;function l(...m){return(v,S=null,y)=>{let b=Ih(...m.map(R=>R(A=>v.call(S,A))));return c(b,y)}}t.any=l;function h(m,v,S,y){let b=S;return s(m,R=>(b=v(b,R),b),y)}t.reduce=h;function a(m,v){let S,y={onWillAddFirstListener(){S=m(b.fire,b)},onDidRemoveLastListener(){S==null||S.dispose()}},b=new P(y);return v==null||v.add(b),b.event}function c(m,v){return v instanceof Array?v.push(m):v&&v.add(m),m}function d(m,v,S=100,y=!1,b=!1,R,A){let M,D,H,Z=0,U,ue={leakWarningThreshold:R,onWillAddFirstListener(){M=m(z=>{Z++,D=v(D,z),y&&!H&&(K.fire(D),D=void 0),U=()=>{let F=D;D=void 0,H=void 0,(!y||Z>1)&&K.fire(F),Z=0},typeof S=="number"?(clearTimeout(H),H=setTimeout(U,S)):H===void 0&&(H=0,queueMicrotask(U))})},onWillRemoveListener(){b&&Z>0&&(U==null||U())},onDidRemoveLastListener(){U=void 0,M.dispose()}},K=new P(ue);return A==null||A.add(K),K.event}t.debounce=d;function u(m,v=0,S){return t.debounce(m,(y,b)=>y?(y.push(b),y):[b],v,void 0,!0,void 0,S)}t.accumulate=u;function _(m,v=(y,b)=>y===b,S){let y=!0,b;return n(m,R=>{let A=y||!v(R,b);return y=!1,b=R,A},S)}t.latch=_;function f(m,v,S){return[t.filter(m,v,S),t.filter(m,y=>!v(y),S)]}t.split=f;function p(m,v=!1,S=[],y){let b=S.slice(),R=m(D=>{b?b.push(D):M.fire(D)});y&&y.add(R);let A=()=>{b==null||b.forEach(D=>M.fire(D)),b=null},M=new P({onWillAddFirstListener(){R||(R=m(D=>M.fire(D)),y&&y.add(R))},onDidAddFirstListener(){b&&(v?setTimeout(A):A())},onDidRemoveLastListener(){R&&R.dispose(),R=null}});return y&&y.add(M),M.event}t.buffer=p;function w(m,v){return(S,y,b)=>{let R=v(new k);return m(function(A){let M=R.evaluate(A);M!==C&&S.call(y,M)},void 0,b)}}t.chain=w;let C=Symbol("HaltChainable");class k{constructor(){this.steps=[]}map(v){return this.steps.push(v),this}forEach(v){return this.steps.push(S=>(v(S),S)),this}filter(v){return this.steps.push(S=>v(S)?S:C),this}reduce(v,S){let y=S;return this.steps.push(b=>(y=v(y,b),y)),this}latch(v=(S,y)=>S===y){let S=!0,y;return this.steps.push(b=>{let R=S||!v(b,y);return S=!1,y=b,R?b:C}),this}evaluate(v){for(let S of this.steps)if(v=S(v),v===C)break;return v}}function L(m,v,S=y=>y){let y=(...M)=>A.fire(S(...M)),b=()=>m.on(v,y),R=()=>m.removeListener(v,y),A=new P({onWillAddFirstListener:b,onDidRemoveLastListener:R});return A.event}t.fromNodeEventEmitter=L;function g(m,v,S=y=>y){let y=(...M)=>A.fire(S(...M)),b=()=>m.addEventListener(v,y),R=()=>m.removeEventListener(v,y),A=new P({onWillAddFirstListener:b,onDidRemoveLastListener:R});return A.event}t.fromDOMEventEmitter=g;function E(m){return new Promise(v=>i(m)(v))}t.toPromise=E;function T(m){let v=new P;return m.then(S=>{v.fire(S)},()=>{v.fire(void 0)}).finally(()=>{v.dispose()}),v.event}t.fromPromise=T;function O(m,v){return m(S=>v.fire(S))}t.forward=O;function $(m,v,S){return v(S),m(y=>v(y))}t.runAndSubscribe=$;class G{constructor(v,S){this._observable=v,this._counter=0,this._hasChanged=!1;let y={onWillAddFirstListener:()=>{v.addObserver(this)},onDidRemoveLastListener:()=>{v.removeObserver(this)}};this.emitter=new P(y),S&&S.add(this.emitter)}beginUpdate(v){this._counter++}handlePossibleChange(v){}handleChange(v,S){this._hasChanged=!0}endUpdate(v){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function X(m,v){return new G(m,v).emitter.event}t.fromObservable=X;function N(m){return(v,S,y)=>{let b=0,R=!1,A={beginUpdate(){b++},endUpdate(){b--,b===0&&(m.reportChanges(),R&&(R=!1,v.call(S)))},handlePossibleChange(){},handleChange(){R=!0}};m.addObserver(A),m.reportChanges();let M={dispose(){m.removeObserver(A)}};return y instanceof $t?y.add(M):Array.isArray(y)&&y.push(M),M}}t.fromObservableLight=N})(Fe||(Fe={}));var rr=class nr{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${nr._idPool++}`,nr.all.add(this)}start(e){this._stopWatch=new Fh,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};rr.all=new Set,rr._idPool=0;var $h=rr,Nh=-1,ca=class da{constructor(e,i,s=(da._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[n,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(n);let h=new Hh(l,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[s,r]of this._stacks)(!e||i<r)&&(e=[s,r],i=r);return e}};ca._idPool=1;var Wh=ca,zh=class ua{constructor(e){this.value=e}static create(){let e=new Error;return new ua(e.stack??"")}print(){console.warn(this.value.split(`
|
|
19
19
|
`).slice(2).join(`
|
|
20
|
-
`))}},Rh=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},Mh=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},Bh=0,ys=class{constructor(e){this.value=e,this.id=Bh++}},Th=2,Ah,P=class{constructor(e){var i,s,r,n;this._size=0,this._options=e,this._leakageMon=(i=this._options)!=null&&i.leakWarningThreshold?new Lh((e==null?void 0:e.onListenerError)??Ji,((s=this._options)==null?void 0:s.leakWarningThreshold)??kh):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new xh(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,i,s,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(s=(i=this._options)==null?void 0:i.onDidRemoveLastListener)==null||s.call(i),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,i,s)=>{var l,h,a,c,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(u);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new Mh(`${u}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(((l=this._options)==null?void 0:l.onListenerError)||Ji)(f),K.None}if(this._disposed)return K.None;i&&(e=e.bind(i));let r=new ys(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Eh.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof ys?(this._deliveryQueue??(this._deliveryQueue=new Dh),this._listeners=[this._listeners,r]):this._listeners.push(r):((a=(h=this._options)==null?void 0:h.onWillAddFirstListener)==null||a.call(h,this),this._listeners=r,(d=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null||d.call(c,this)),this._size++;let o=oe(()=>{n==null||n(),this._removeListener(r)});return s instanceof $t?s.add(o):Array.isArray(s)&&s.push(o),o}),this._event}_removeListener(e){var n,o,l,h;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null||o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(h=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||h.call(l,this),this._size=0;return}let i=this._listeners,s=i.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,i[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Th<=i.length){let a=0;for(let c=0;c<i.length;c++)i[c]?i[a++]=i[c]:r&&(this._deliveryQueue.end--,a<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=a}}_deliver(e,i){var r;if(!e)return;let s=((r=this._options)==null?void 0:r.onListenerError)||Ji;if(!s){e.value(i);return}try{e.value(i)}catch(n){s(n)}}_deliverQueue(e){let i=e.current._listeners;for(;e.i<e.end;)this._deliver(i[e.i++],e.value);e.reset()}fire(e){var i,s,r,n;if((i=this._deliveryQueue)!=null&&i.current&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null||s.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof ys)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null||n.stop()}hasListeners(){return this._size>0}},Dh=class{constructor(){this.i=-1,this.end=0}enqueue(e,i,s){this.i=0,this.end=s,this.current=e,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},sr=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new P,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new P,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,e),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,e),this._onDidChangeFullscreen.fire(s)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};sr.INSTANCE=new sr;var $r=sr;function Ph(t,e,i){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",i)}$r.INSTANCE.onDidChangeZoomLevel;function Oh(t){return $r.INSTANCE.getZoomFactor(t)}$r.INSTANCE.onDidChangeFullscreen;var di=typeof navigator=="object"?navigator.userAgent:"",rr=di.indexOf("Firefox")>=0,Ih=di.indexOf("AppleWebKit")>=0,Nr=di.indexOf("Chrome")>=0,Fh=!Nr&&di.indexOf("Safari")>=0;di.indexOf("Electron/")>=0;di.indexOf("Android")>=0;var Cs=!1;if(typeof xt.matchMedia=="function"){let t=xt.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=xt.matchMedia("(display-mode: fullscreen)");Cs=t.matches,Ph(xt,t,({matches:i})=>{Cs&&e.matches||(Cs=i)})}var ri="en",nr=!1,or=!1,Qi=!1,ra=!1,zi,es=ri,hn=ri,$h,nt,qt=globalThis,Pe,Bo;typeof qt.vscode<"u"&&typeof qt.vscode.process<"u"?Pe=qt.vscode.process:typeof process<"u"&&typeof((Bo=process==null?void 0:process.versions)==null?void 0:Bo.node)=="string"&&(Pe=process);var To,Nh=typeof((To=Pe==null?void 0:Pe.versions)==null?void 0:To.electron)=="string",Wh=Nh&&(Pe==null?void 0:Pe.type)==="renderer",Ao;if(typeof Pe=="object"){nr=Pe.platform==="win32",or=Pe.platform==="darwin",Qi=Pe.platform==="linux",Qi&&Pe.env.SNAP&&Pe.env.SNAP_REVISION,Pe.env.CI||Pe.env.BUILD_ARTIFACTSTAGINGDIRECTORY,zi=ri,es=ri;let t=Pe.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);zi=e.userLocale,hn=e.osLocale,es=e.resolvedLanguage||ri,$h=(Ao=e.languagePack)==null?void 0:Ao.translationsConfigFile}catch{}ra=!0}else typeof navigator=="object"&&!Wh?(nt=navigator.userAgent,nr=nt.indexOf("Windows")>=0,or=nt.indexOf("Macintosh")>=0,(nt.indexOf("Macintosh")>=0||nt.indexOf("iPad")>=0||nt.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Qi=nt.indexOf("Linux")>=0,(nt==null?void 0:nt.indexOf("Mobi"))>=0,es=globalThis._VSCODE_NLS_LANGUAGE||ri,zi=navigator.language.toLowerCase(),hn=zi):console.error("Unable to resolve platform.");var na=nr,ft=or,zh=Qi,cn=ra,gt=nt,Bt=es,Hh;(t=>{function e(){return Bt}t.value=e;function i(){return Bt.length===2?Bt==="en":Bt.length>=3?Bt[0]==="e"&&Bt[1]==="n"&&Bt[2]==="-":!1}t.isDefaultVariant=i;function s(){return Bt==="en"}t.isDefault=s})(Hh||(Hh={}));var Uh=typeof qt.postMessage=="function"&&!qt.importScripts;(()=>{if(Uh){let t=[];qt.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.id===i.data.vscodeScheduleAsyncWork){t.splice(s,1),n.callback();return}}});let e=0;return i=>{let s=++e;t.push({id:s,callback:i}),qt.postMessage({vscodeScheduleAsyncWork:s},"*")}}return t=>setTimeout(t)})();var Kh=!!(gt&>.indexOf("Chrome")>=0);gt&>.indexOf("Firefox")>=0;!Kh&>&>.indexOf("Safari")>=0;gt&>.indexOf("Edg/")>=0;gt&>.indexOf("Android")>=0;var Jt=typeof navigator=="object"?navigator:{};cn||document.queryCommandSupported&&document.queryCommandSupported("copy")||Jt&&Jt.clipboard&&Jt.clipboard.writeText,cn||Jt&&Jt.clipboard&&Jt.clipboard.readText;var Wr=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},xs=new Wr,dn=new Wr,un=new Wr,qh=new Array(230),oa;(t=>{function e(l){return xs.keyCodeToStr(l)}t.toString=e;function i(l){return xs.strToKeyCode(l)}t.fromString=i;function s(l){return dn.keyCodeToStr(l)}t.toUserSettingsUS=s;function r(l){return un.keyCodeToStr(l)}t.toUserSettingsGeneral=r;function n(l){return dn.strToKeyCode(l)||un.strToKeyCode(l)}t.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return xs.keyCodeToStr(l)}t.toElectronAccelerator=o})(oa||(oa={}));var Vh=class aa{constructor(e,i,s,r,n){this.ctrlKey=e,this.shiftKey=i,this.altKey=s,this.metaKey=r,this.keyCode=n}equals(e){return e instanceof aa&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",s=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${e}${i}${s}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Yh([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Yh=class{constructor(t){if(t.length===0)throw mh("chords");this.chords=t}getHashCode(){let t="";for(let e=0,i=this.chords.length;e<i;e++)e!==0&&(t+=";"),t+=this.chords[e].getHashCode();return t}equals(t){if(t===null||this.chords.length!==t.chords.length)return!1;for(let e=0;e<this.chords.length;e++)if(!this.chords[e].equals(t.chords[e]))return!1;return!0}};function Gh(t){if(t.charCode){let i=String.fromCharCode(t.charCode).toUpperCase();return oa.fromString(i)}let e=t.keyCode;if(e===3)return 7;if(rr)switch(e){case 59:return 85;case 60:if(zh)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ft)return 57;break}else if(Ih&&(ft&&e===93||!ft&&e===92))return 57;return qh[e]||0}var jh=ft?256:2048,Xh=512,Zh=1024,Jh=ft?2048:256,_n=class{constructor(t){var i;this._standardKeyboardEventBrand=!0;let e=t;this.browserEvent=e,this.target=e.target,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.altGraphKey=(i=e.getModifierState)==null?void 0:i.call(e,"AltGraph"),this.keyCode=Gh(e),this.code=e.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(t){return this._asKeybinding===t}_computeKeybinding(){let t=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode);let e=0;return this.ctrlKey&&(e|=jh),this.altKey&&(e|=Xh),this.shiftKey&&(e|=Zh),this.metaKey&&(e|=Jh),e|=t,e}_computeKeyCodeChord(){let t=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode),new Vh(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,t)}},fn=new WeakMap;function Qh(t){if(!t.parent||t.parent===t)return null;try{let e=t.location,i=t.parent.location;if(e.origin!=="null"&&i.origin!=="null"&&e.origin!==i.origin)return null}catch{return null}return t.parent}var ec=class{static getSameOriginWindowChain(t){let e=fn.get(t);if(!e){e=[],fn.set(t,e);let i=t,s;do s=Qh(i),s?e.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):e.push({window:new WeakRef(i),iframeElement:null}),i=s;while(i)}return e.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(t,e){if(!e||t===e)return{top:0,left:0};let i=0,s=0,r=this.getSameOriginWindowChain(t);for(let n of r){let o=n.window.deref();if(i+=(o==null?void 0:o.scrollY)??0,s+=(o==null?void 0:o.scrollX)??0,o===e||!n.iframeElement)break;let l=n.iframeElement.getBoundingClientRect();i+=l.top,s+=l.left}return{top:i,left:s}}},Hi=class{constructor(e,i){this.timestamp=Date.now(),this.browserEvent=i,this.leftButton=i.button===0,this.middleButton=i.button===1,this.rightButton=i.button===2,this.buttons=i.buttons,this.target=i.target,this.detail=i.detail||1,i.type==="dblclick"&&(this.detail=2),this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,typeof i.pageX=="number"?(this.posx=i.pageX,this.posy=i.pageY):(this.posx=i.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=i.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let s=ec.getPositionOfChildWindowRelativeToAncestorWindow(e,i.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},gn=class{constructor(e,i=0,s=0){var n;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=s,this.deltaX=i;let r=!1;if(Nr){let o=navigator.userAgent.match(/Chrome\/(\d+)/);r=(o?parseInt(o[1]):123)<=122}if(e){let o=e,l=e,h=((n=e.view)==null?void 0:n.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")r?this.deltaY=o.wheelDeltaY/(120*h):this.deltaY=o.wheelDeltaY/120;else if(typeof l.VERTICAL_AXIS<"u"&&l.axis===l.VERTICAL_AXIS)this.deltaY=-l.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?rr&&!ft?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")Fh&&na?this.deltaX=-(o.wheelDeltaX/120):r?this.deltaX=o.wheelDeltaX/(120*h):this.deltaX=o.wheelDeltaX/120;else if(typeof l.HORIZONTAL_AXIS<"u"&&l.axis===l.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?rr&&!ft?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*h):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},la=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),tc;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof ic?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ie.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:la})})(tc||(tc={}));var ic=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?la:(this._emitter||(this._emitter=new P),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},zr=class{constructor(e,i){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof i=="number"&&this.setIfNotSet(e,i)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,i){if(this._isDisposed)throw new Js("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},i)}setIfNotSet(e,i){if(this._isDisposed)throw new Js("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},i))}},sc=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,i,s=globalThis){if(this.isDisposed)throw new Js("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=s.setInterval(()=>{e()},i);this.disposable=oe(()=>{s.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},rc;(t=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}t.settled=e;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}t.withAsyncBody=i})(rc||(rc={}));var pn=class Qe{static fromArray(e){return new Qe(i=>{i.emitMany(e)})}static fromPromise(e){return new Qe(async i=>{i.emitMany(await e)})}static fromPromises(e){return new Qe(async i=>{await Promise.all(e.map(async s=>i.emitOne(await s)))})}static merge(e){return new Qe(async i=>{await Promise.all(e.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new P,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Ie.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(e,i){return new Qe(async s=>{for await(let r of e)s.emitOne(i(r))})}map(e){return Qe.map(this,e)}static filter(e,i){return new Qe(async s=>{for await(let r of e)i(r)&&s.emitOne(r)})}filter(e){return Qe.filter(this,e)}static coalesce(e){return Qe.filter(e,i=>!!i)}coalesce(){return Qe.coalesce(this)}static async toPromise(e){let i=[];for await(let s of e)i.push(s);return i}toPromise(){return Qe.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};pn.EMPTY=pn.fromArray([]);var{getWindow:_t,getWindowId:nc,onDidRegisterWindow:oc}=(function(){let t=new Map,e={window:xt,disposables:new $t};t.set(xt.vscodeWindowId,e);let i=new P,s=new P,r=new P;function n(o,l){return(typeof o=="number"?t.get(o):void 0)??(l?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(t.has(o.vscodeWindowId))return K.None;let l=new $t,h={window:o,disposables:l.add(new $t)};return t.set(o.vscodeWindowId,h),l.add(oe(()=>{t.delete(o.vscodeWindowId),s.fire(o)})),l.add(W(o,Ce.BEFORE_UNLOAD,()=>{r.fire(o)})),i.fire(h),l},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return t.has(o)},getWindowById:n,getWindow(o){var a;let l=o;if((a=l==null?void 0:l.ownerDocument)!=null&&a.defaultView)return l.ownerDocument.defaultView.window;let h=o;return h!=null&&h.view?h.view.window:xt},getDocument(o){return _t(o).document}}})(),ac=class{constructor(e,i,s,r){this._node=e,this._type=i,this._handler=s,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function W(t,e,i,s){return new ac(t,e,i,s)}var vn=function(t,e,i,s){return W(t,e,i,s)},Hr,lc=class extends sc{constructor(t){super(),this.defaultTarget=t&&_t(t)}cancelAndSet(t,e,i){return super.cancelAndSet(t,e,i??this.defaultTarget)}},mn=class{constructor(e,i=0){this._runner=e,this.priority=i,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Ji(e)}}static sort(e,i){return i.priority-e.priority}};(function(){let t=new Map,e=new Map,i=new Map,s=new Map,r=n=>{i.set(n,!1);let o=t.get(n)??[];for(e.set(n,o),t.set(n,[]),s.set(n,!0);o.length>0;)o.sort(mn.sort),o.shift().execute();s.set(n,!1)};Hr=(n,o,l=0)=>{let h=nc(n),a=new mn(o,l),c=t.get(h);return c||(c=[],t.set(h,c)),c.push(a),i.get(h)||(i.set(h,!0),n.requestAnimationFrame(()=>r(h))),a}})();function hc(t){let e=t.getBoundingClientRect(),i=_t(t);return{left:e.left+i.scrollX,top:e.top+i.scrollY,width:e.width,height:e.height}}var Ce={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},cc=class{constructor(t){this.domNode=t,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(t){let e=Ve(t);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let e=Ve(t);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(t){let e=Ve(t);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(t){let e=Ve(t);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(t){let e=Ve(t);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(t){let e=Ve(t);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(t){let e=Ve(t);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(t){let e=Ve(t);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let e=Ve(t);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let e=Ve(t);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let e=Ve(t);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let e=Ve(t);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let e=Ve(t);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let e=Ve(t);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,e){this.domNode.classList.toggle(t,e),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,e){this.domNode.setAttribute(t,e)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function Ve(t){return typeof t=="number"?`${t}px`:t}function Ai(t){return new cc(t)}var ha=class{constructor(){this._hooks=new $t,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,i){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(i)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,i,s,r,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=n;let o=e;try{e.setPointerCapture(i),this._hooks.add(oe(()=>{try{e.releasePointerCapture(i)}catch{}}))}catch{o=_t(e)}this._hooks.add(W(o,Ce.POINTER_MOVE,l=>{if(l.buttons!==s){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(W(o,Ce.POINTER_UP,l=>this.stopMonitoring(!0)))}};function dc(t,e,i){let s=null,r=null;if(typeof i.value=="function"?(s="value",r=i.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(s="get",r=i.get),!r)throw new Error("not supported");let n=`$memoize$${e}`;i[s]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[n]}}var ut;(t=>(t.Tap="-xterm-gesturetap",t.Change="-xterm-gesturechange",t.Start="-xterm-gesturestart",t.End="-xterm-gesturesend",t.Contextmenu="-xterm-gesturecontextmenu"))(ut||(ut={}));var xi=class Fe extends K{constructor(){super(),this.dispatched=!1,this.targets=new ln,this.ignoreTargets=new ln,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ie.runAndSubscribe(oc,({window:e,disposables:i})=>{i.add(W(e.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),i.add(W(e.document,"touchend",s=>this.onTouchEnd(e,s))),i.add(W(e.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:xt,disposables:this._store}))}static addTarget(e){if(!Fe.isTouchDevice())return K.None;Fe.INSTANCE||(Fe.INSTANCE=new Fe);let i=Fe.INSTANCE.targets.push(e);return oe(i)}static ignoreTarget(e){if(!Fe.isTouchDevice())return K.None;Fe.INSTANCE||(Fe.INSTANCE=new Fe);let i=Fe.INSTANCE.ignoreTargets.push(e);return oe(i)}static isTouchDevice(){return"ontouchstart"in xt||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,r=e.targetTouches.length;s<r;s++){let n=e.targetTouches.item(s);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:i,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[i],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent(ut.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,i){let s=Date.now(),r=Object.keys(this.activeTouches).length;for(let n=0,o=i.changedTouches.length;n<o;n++){let l=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let h=this.activeTouches[l.identifier],a=Date.now()-h.initialTimeStamp;if(a<Fe.HOLD_DELAY&&Math.abs(h.initialPageX-Xe(h.rollingPageX))<30&&Math.abs(h.initialPageY-Xe(h.rollingPageY))<30){let c=this.newGestureEvent(ut.Tap,h.initialTarget);c.pageX=Xe(h.rollingPageX),c.pageY=Xe(h.rollingPageY),this.dispatchEvent(c)}else if(a>=Fe.HOLD_DELAY&&Math.abs(h.initialPageX-Xe(h.rollingPageX))<30&&Math.abs(h.initialPageY-Xe(h.rollingPageY))<30){let c=this.newGestureEvent(ut.Contextmenu,h.initialTarget);c.pageX=Xe(h.rollingPageX),c.pageY=Xe(h.rollingPageY),this.dispatchEvent(c)}else if(r===1){let c=Xe(h.rollingPageX),d=Xe(h.rollingPageY),u=Xe(h.rollingTimestamps)-h.rollingTimestamps[0],_=c-h.rollingPageX[0],f=d-h.rollingPageY[0],v=[...this.targets].filter(b=>h.initialTarget instanceof Node&&b.contains(h.initialTarget));this.inertia(e,v,s,Math.abs(_)/u,_>0?1:-1,c,Math.abs(f)/u,f>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(ut.End,h.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let s=document.createEvent("CustomEvent");return s.initEvent(e,!1,!0),s.initialTarget=i,s.tapCount=0,s}dispatchEvent(e){if(e.type===ut.Tap){let i=new Date().getTime(),s=0;i-this._lastSetTapCountTime>Fe.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=i,e.tapCount=s}else(e.type===ut.Change||e.type===ut.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(e.initialTarget))return;let i=[];for(let s of this.targets)if(s.contains(e.initialTarget)){let r=0,n=e.initialTarget;for(;n&&n!==s;)r++,n=n.parentElement;i.push([r,s])}i.sort((s,r)=>s[0]-r[0]);for(let[s,r]of i)r.dispatchEvent(e),this.dispatched=!0}}inertia(e,i,s,r,n,o,l,h,a){this.handle=Hr(e,()=>{let c=Date.now(),d=c-s,u=0,_=0,f=!0;r+=Fe.SCROLL_FRICTION*d,l+=Fe.SCROLL_FRICTION*d,r>0&&(f=!1,u=n*r*d),l>0&&(f=!1,_=h*l*d);let v=this.newGestureEvent(ut.Change);v.translationX=u,v.translationY=_,i.forEach(b=>b.dispatchEvent(v)),f||this.inertia(e,i,c,r,n,o+u,l,h,a+_)})}onTouchMove(e){let i=Date.now();for(let s=0,r=e.changedTouches.length;s<r;s++){let n=e.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let o=this.activeTouches[n.identifier],l=this.newGestureEvent(ut.Change,o.initialTarget);l.translationX=n.pageX-Xe(o.rollingPageX),l.translationY=n.pageY-Xe(o.rollingPageY),l.pageX=n.pageX,l.pageY=n.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};xi.SCROLL_FRICTION=-.005,xi.HOLD_DELAY=700,xi.CLEAR_TAP_COUNT_TIME=400,ue([dc],xi,"isTouchDevice",1);var uc=xi,Ur=class extends K{onclick(e,i){this._register(W(e,Ce.CLICK,s=>i(new Hi(_t(e),s))))}onmousedown(e,i){this._register(W(e,Ce.MOUSE_DOWN,s=>i(new Hi(_t(e),s))))}onmouseover(e,i){this._register(W(e,Ce.MOUSE_OVER,s=>i(new Hi(_t(e),s))))}onmouseleave(e,i){this._register(W(e,Ce.MOUSE_LEAVE,s=>i(new Hi(_t(e),s))))}onkeydown(e,i){this._register(W(e,Ce.KEY_DOWN,s=>i(new _n(s))))}onkeyup(e,i){this._register(W(e,Ce.KEY_UP,s=>i(new _n(s))))}oninput(e,i){this._register(W(e,Ce.INPUT,i))}onblur(e,i){this._register(W(e,Ce.BLUR,i))}onfocus(e,i){this._register(W(e,Ce.FOCUS,i))}onchange(e,i){this._register(W(e,Ce.CHANGE,i))}ignoreGesture(e){return uc.ignoreTarget(e)}},Sn=11,_c=class extends Ur{constructor(t){super(),this._onActivate=t.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=t.bgWidth+"px",this.bgDomNode.style.height=t.bgHeight+"px",typeof t.top<"u"&&(this.bgDomNode.style.top="0px"),typeof t.left<"u"&&(this.bgDomNode.style.left="0px"),typeof t.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof t.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=t.className,this.domNode.style.position="absolute",this.domNode.style.width=Sn+"px",this.domNode.style.height=Sn+"px",typeof t.top<"u"&&(this.domNode.style.top=t.top+"px"),typeof t.left<"u"&&(this.domNode.style.left=t.left+"px"),typeof t.bottom<"u"&&(this.domNode.style.bottom=t.bottom+"px"),typeof t.right<"u"&&(this.domNode.style.right=t.right+"px"),this._pointerMoveMonitor=this._register(new ha),this._register(vn(this.bgDomNode,Ce.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(vn(this.domNode,Ce.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new lc),this._pointerdownScheduleRepeatTimer=this._register(new zr)}_arrowPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,_t(t))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),t.preventDefault()}},fc=class ar{constructor(e,i,s,r,n,o,l){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,s=s|0,r=r|0,n=n|0,o=o|0,l=l|0),this.rawScrollLeft=r,this.rawScrollTop=l,i<0&&(i=0),r+i>s&&(r=s-i),r<0&&(r=0),n<0&&(n=0),l+n>o&&(l=o-n),l<0&&(l=0),this.width=i,this.scrollWidth=s,this.scrollLeft=r,this.height=n,this.scrollHeight=o,this.scrollTop=l}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,i){return new ar(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new ar(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,i){let s=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,n=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,l=this.scrollHeight!==e.scrollHeight,h=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:i,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:h}}},gc=class extends K{constructor(t){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new P),this.onScroll=this._onScroll.event,this._smoothScrollDuration=t.smoothScrollDuration,this._scheduleAtNextAnimationFrame=t.scheduleAtNextAnimationFrame,this._state=new fc(t.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(t){this._smoothScrollDuration=t}validateScrollPosition(t){return this._state.withScrollPosition(t)}getScrollDimensions(){return this._state}setScrollDimensions(t,e){var s;let i=this._state.withScrollDimensions(t,e);this._setState(i,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(t){let e=this._state.withScrollPosition(t);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(e,!1)}setScrollPositionSmooth(t,e){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(t);if(this._smoothScrolling){t={scrollLeft:typeof t.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:t.scrollLeft,scrollTop:typeof t.scrollTop>"u"?this._smoothScrolling.to.scrollTop:t.scrollTop};let i=this._state.withScrollPosition(t);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let s;e?s=new bn(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let i=this._state.withScrollPosition(t);this._smoothScrolling=bn.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let t=this._smoothScrolling.tick(),e=this._state.withScrollPosition(t);if(this._setState(e,!0),!!this._smoothScrolling){if(t.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(t,e){let i=this._state;i.equals(t)||(this._state=t,this._onScroll.fire(this._state.createScrollEvent(i,e)))}},wn=class{constructor(e,i,s){this.scrollLeft=e,this.scrollTop=i,this.isDone=s}};function ks(t,e){let i=e-t;return function(s){return t+i*mc(s)}}function pc(t,e,i){return function(s){return s<i?t(s/i):e((s-i)/(1-i))}}var bn=class lr{constructor(e,i,s,r){this.from=e,this.to=i,this.duration=r,this.startTime=s,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,i,s){if(Math.abs(e-i)>2.5*s){let r,n;return e<i?(r=e+.75*s,n=i-.75*s):(r=e-.75*s,n=i+.75*s),pc(ks(e,r),ks(n,i),.33)}return ks(e,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let i=(e-this.startTime)/this.duration;if(i<1){let s=this.scrollLeft(i),r=this.scrollTop(i);return new wn(s,r,!1)}return new wn(this.to.scrollLeft,this.to.scrollTop,!0)}combine(e,i,s){return lr.start(e,i,s)}static start(e,i,s){s=s+10;let r=Date.now()-10;return new lr(e,i,r,s)}};function vc(t){return Math.pow(t,3)}function mc(t){return 1-vc(1-t)}var Sc=class extends K{constructor(e,i,s){super(),this._visibility=e,this._visibleClassName=i,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new zr)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var i;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(i=this._domNode)==null||i.setClassName(this._invisibleClassName+(e?" fade":"")))}},wc=140,ca=class extends Ur{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Sc(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ha),this._shouldRender=!0,this.domNode=Ai(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(W(this.domNode.domNode,Ce.POINTER_DOWN,i=>this._domNodePointerDown(i)))}_createArrow(e){let i=this._register(new _c(e));this.domNode.domNode.appendChild(i.bgDomNode),this.domNode.domNode.appendChild(i.domNode)}_createSlider(e,i,s,r){this.slider=Ai(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(i),typeof s=="number"&&this.slider.setWidth(s),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(W(this.slider.domNode,Ce.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let i=this.domNode.domNode.getClientRects()[0].top,s=i+this._scrollbarState.getSliderPosition(),r=i+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);s<=n&&n<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let i,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")i=e.offsetX,s=e.offsetY;else{let n=hc(this.domNode.domNode);i=e.pageX-n.left,s=e.pageY-n.top}let r=this._pointerDownRelativePosition(i,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=this._sliderPointerPosition(e),s=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{let o=this._sliderOrthogonalPointerPosition(n),l=Math.abs(o-s);if(na&&l>wc){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let h=this._sliderPointerPosition(n)-i;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(h))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let i={};this.writeScrollPosition(i,e),this._scrollable.setScrollPositionNow(i)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},da=class hr{constructor(e,i,s,r,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new hr(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let i=Math.round(e);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(e){let i=Math.round(e);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(e){let i=Math.round(e);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,i,s,r,n){let o=Math.max(0,s-e),l=Math.max(0,o-2*i),h=r>0&&r>s;if(!h)return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let a=Math.round(Math.max(20,Math.floor(s*l/r))),c=(l-a)/(r-s),d=n*c;return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(a),computedSliderRatio:c,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let e=hr._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize,s=this._scrollPosition;return i<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+e;return Math.round(i/this._computedSliderRatio)}},bc=class extends ca{constructor(e,i,s){let r=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:s,scrollbarState:new da(i.horizontalHasArrows?i.arrowSize:0,i.horizontal===2?0:i.horizontalScrollbarSize,i.vertical===2?0:i.verticalScrollbarSize,r.width,r.scrollWidth,n.scrollLeft),visibility:i.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:i.scrollByPage}),i.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((i.horizontalScrollbarSize-i.horizontalSliderSize)/2),0,void 0,i.horizontalSliderSize)}_updateSlider(e,i){this.slider.setWidth(e),this.slider.setLeft(i)}_renderDomNode(e,i){this.domNode.setWidth(e),this.domNode.setHeight(i),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,i){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,i){e.scrollLeft=i}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},yc=class extends ca{constructor(t,e,i){let s=t.getScrollDimensions(),r=t.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:i,scrollbarState:new da(e.verticalHasArrows?e.arrowSize:0,e.vertical===2?0:e.verticalScrollbarSize,0,s.height,s.scrollHeight,r.scrollTop),visibility:e.vertical,extraScrollbarClassName:"vertical",scrollable:t,scrollByPage:e.scrollByPage}),e.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((e.verticalScrollbarSize-e.verticalSliderSize)/2),e.verticalSliderSize,void 0)}_updateSlider(t,e){this.slider.setHeight(t),this.slider.setTop(e)}_renderDomNode(t,e){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(t){return this._shouldRender=this._onElementScrollSize(t.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(t.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(t.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(t,e){return e}_sliderPointerPosition(t){return t.pageY}_sliderOrthogonalPointerPosition(t){return t.pageX}_updateScrollbarSize(t){this.slider.setWidth(t)}writeScrollPosition(t,e){t.scrollTop=e}updateOptions(t){this.updateScrollbarSize(t.vertical===2?0:t.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(t.vertical),this._scrollByPage=t.scrollByPage}},Cc=500,yn=50,xc=class{constructor(e,i,s){this.timestamp=e,this.deltaX=i,this.deltaY=s,this.score=0}},cr=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,i=0,s=1,r=this._rear;do{let n=r===this._front?e:Math.pow(2,-s);if(e-=n,i+=this._memory[r].score*n,r===this._front)break;r=(this._capacity+r-1)%this._capacity,s++}while(!0);return i<=.5}acceptStandardWheelEvent(e){if(Nr){let i=_t(e.browserEvent),s=Oh(i);this.accept(Date.now(),e.deltaX*s,e.deltaY*s)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,i,s){let r=null,n=new xc(e,i,s);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=n),n.score=this._computeScore(n,r)}_computeScore(e,i){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(s+=.25),i){let r=Math.abs(e.deltaX),n=Math.abs(e.deltaY),o=Math.abs(i.deltaX),l=Math.abs(i.deltaY),h=Math.max(Math.min(r,o),1),a=Math.max(Math.min(n,l),1),c=Math.max(r,o),d=Math.max(n,l);c%h===0&&d%a===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};cr.INSTANCE=new cr;var kc=cr,Lc=class extends Ur{constructor(t,e,i){super(),this._onScroll=this._register(new P),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new P),this.onWillScroll=this._onWillScroll.event,this._options=Rc(e),this._scrollable=i,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let s={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new yc(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new bc(this._scrollable,this._options,s)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(t),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Ai(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Ai(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Ai(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new zr),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Gt(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(t){this._verticalScrollbar.delegatePointerDown(t)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(t){this._scrollable.setScrollDimensions(t,!1)}updateClassName(t){this._options.className=t,ft&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(t){typeof t.handleMouseWheel<"u"&&(this._options.handleMouseWheel=t.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof t.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=t.mouseWheelScrollSensitivity),typeof t.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=t.fastScrollSensitivity),typeof t.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=t.scrollPredominantAxis),typeof t.horizontal<"u"&&(this._options.horizontal=t.horizontal),typeof t.vertical<"u"&&(this._options.vertical=t.vertical),typeof t.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=t.horizontalScrollbarSize),typeof t.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=t.verticalScrollbarSize),typeof t.scrollByPage<"u"&&(this._options.scrollByPage=t.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(t){this._revealOnScroll=t}delegateScrollFromMouseWheelEvent(t){this._onMouseWheel(new gn(t))}_setListeningToMouseWheel(t){if(this._mouseWheelToDispose.length>0!==t&&(this._mouseWheelToDispose=Gt(this._mouseWheelToDispose),t)){let e=i=>{this._onMouseWheel(new gn(i))};this._mouseWheelToDispose.push(W(this._listenOnDomNode,Ce.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(t){var r;if((r=t.browserEvent)!=null&&r.defaultPrevented)return;let e=kc.INSTANCE;e.acceptStandardWheelEvent(t);let i=!1;if(t.deltaY||t.deltaX){let n=t.deltaY*this._options.mouseWheelScrollSensitivity,o=t.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+n===0?o=n=0:Math.abs(n)>=Math.abs(o)?o=0:n=0),this._options.flipAxes&&([n,o]=[o,n]);let l=!ft&&t.browserEvent&&t.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=n,n=0),t.browserEvent&&t.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,n=n*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),a={};if(n){let c=yn*n,d=h.scrollTop-(c<0?Math.floor(c):Math.ceil(c));this._verticalScrollbar.writeScrollPosition(a,d)}if(o){let c=yn*o,d=h.scrollLeft-(c<0?Math.floor(c):Math.ceil(c));this._horizontalScrollbar.writeScrollPosition(a,d)}a=this._scrollable.validateScrollPosition(a),(h.scrollLeft!==a.scrollLeft||h.scrollTop!==a.scrollTop)&&(this._options.mouseWheelSmoothScroll&&e.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),i=!0)}let s=i;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(t.preventDefault(),t.stopPropagation())}_onDidScroll(t){this._shouldRender=this._horizontalScrollbar.onDidScroll(t)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(t)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let t=this._scrollable.getCurrentScrollPosition(),e=t.scrollTop>0,i=t.scrollLeft>0,s=i?" left":"",r=e?" top":"",n=i||e?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${r}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(t){this._mouseIsOver=!1,this._hide()}_onMouseOver(t){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Cc)}},Ec=class extends Lc{constructor(e,i,s){super(e,i,s)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Rc(t){let e={lazyRender:typeof t.lazyRender<"u"?t.lazyRender:!1,className:typeof t.className<"u"?t.className:"",useShadows:typeof t.useShadows<"u"?t.useShadows:!0,handleMouseWheel:typeof t.handleMouseWheel<"u"?t.handleMouseWheel:!0,flipAxes:typeof t.flipAxes<"u"?t.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof t.consumeMouseWheelIfScrollbarIsNeeded<"u"?t.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof t.alwaysConsumeMouseWheel<"u"?t.alwaysConsumeMouseWheel:!1,scrollYToX:typeof t.scrollYToX<"u"?t.scrollYToX:!1,mouseWheelScrollSensitivity:typeof t.mouseWheelScrollSensitivity<"u"?t.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof t.fastScrollSensitivity<"u"?t.fastScrollSensitivity:5,scrollPredominantAxis:typeof t.scrollPredominantAxis<"u"?t.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof t.mouseWheelSmoothScroll<"u"?t.mouseWheelSmoothScroll:!0,arrowSize:typeof t.arrowSize<"u"?t.arrowSize:11,listenOnDomNode:typeof t.listenOnDomNode<"u"?t.listenOnDomNode:null,horizontal:typeof t.horizontal<"u"?t.horizontal:1,horizontalScrollbarSize:typeof t.horizontalScrollbarSize<"u"?t.horizontalScrollbarSize:10,horizontalSliderSize:typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:0,horizontalHasArrows:typeof t.horizontalHasArrows<"u"?t.horizontalHasArrows:!1,vertical:typeof t.vertical<"u"?t.vertical:1,verticalScrollbarSize:typeof t.verticalScrollbarSize<"u"?t.verticalScrollbarSize:10,verticalHasArrows:typeof t.verticalHasArrows<"u"?t.verticalHasArrows:!1,verticalSliderSize:typeof t.verticalSliderSize<"u"?t.verticalSliderSize:0,scrollByPage:typeof t.scrollByPage<"u"?t.scrollByPage:!1};return e.horizontalSliderSize=typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof t.verticalSliderSize<"u"?t.verticalSliderSize:e.verticalScrollbarSize,ft&&(e.className+=" mac"),e}var dr=class extends K{constructor(e,i,s,r,n,o,l,h){super(),this._bufferService=s,this._optionsService=l,this._renderService=h,this._onRequestScrollLines=this._register(new P),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new gc({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>Hr(r.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Ec(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},a)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ie.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(oe(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(oe(()=>this._styleElement.remove())),this._register(Ie.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
21
|
-
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(e){let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),s=i-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=i,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};dr=ue([O(2,Ke),O(3,Lt),O(4,qo),O(5,ci),O(6,qe),O(7,Et)],dr);var ur=class extends K{constructor(e,i,s,r,n){super(),this._screenElement=e,this._bufferService=i,this._coreBrowserService=s,this._decorationService=r,this._renderService=n,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(oe(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=e.options.x??0;return s&&s>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${i*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,i=e.element){if(!i)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?i.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=s?`${s*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var i;(i=this._decorationElements.get(e))==null||i.remove(),this._decorationElements.delete(e),e.dispose()}};ur=ue([O(1,Ke),O(2,Lt),O(3,$i),O(4,Et)],ur);var Mc=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let i of this._zones)if(i.color===e.options.overviewRulerOptions.color&&i.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(i,e.marker.line))return;if(this._lineAdjacentToZone(i,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(i,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,i){return i>=e.startBufferLine&&i<=e.endBufferLine}_lineAdjacentToZone(e,i,s){return i>=e.startBufferLine-this._linePadding[s||"full"]&&i<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,i){e.startBufferLine=Math.min(e.startBufferLine,i),e.endBufferLine=Math.max(e.endBufferLine,i)}},ht={full:0,left:0,center:0,right:0},Tt={full:0,left:0,center:0,right:0},fi={full:0,left:0,center:0,right:0},hs=class extends K{constructor(e,i,s,r,n,o,l,h){var c;super(),this._viewportElement=e,this._screenElement=i,this._bufferService=s,this._decorationService=r,this._renderService=n,this._optionsService=o,this._themeService=l,this._coreBrowserService=h,this._colorZoneStore=new Mc,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(oe(()=>{var d;return(d=this._canvas)==null?void 0:d.remove()}));let a=this._canvas.getContext("2d");if(a)this._ctx=a;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),i=Math.ceil((this._canvas.width-1)/3);Tt.full=this._canvas.width,Tt.left=e,Tt.center=i,Tt.right=e,this._refreshDrawHeightConstants(),fi.full=1,fi.left=1,fi.center=1+Tt.left,fi.right=1+Tt.left+Tt.center}_refreshDrawHeightConstants(){ht.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,i=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);ht.left=i,ht.center=i,ht.right=i}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ht.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ht.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ht.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ht.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let i of this._decorationService.decorations)this._colorZoneStore.addDecoration(i);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)i.position!=="full"&&this._renderColorZone(i);for(let i of e)i.position==="full"&&this._renderColorZone(i);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(fi[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-ht[e.position||"full"]/2),Tt[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+ht[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};hs=ue([O(2,Ke),O(3,$i),O(4,Et),O(5,qe),O(6,ci),O(7,Lt)],hs);var T;(t=>(t.NUL="\0",t.SOH="",t.STX="",t.ETX="",t.EOT="",t.ENQ="",t.ACK="",t.BEL="\x07",t.BS="\b",t.HT=" ",t.LF=`
|
|
22
|
-
`,t.VT="\v",t.FF="\f",t.CR="\r",t.SO="",t.SI="",t.DLE="",t.DC1="",t.DC2="",t.DC3="",t.DC4="",t.NAK="",t.SYN="",t.ETB="",t.CAN="",t.EM="",t.SUB="",t.ESC="\x1B",t.FS="",t.GS="",t.RS="",t.US="",t.SP=" ",t.DEL=""))(T||(T={}));var ts;(t=>(t.PAD="",t.HOP="",t.BPH="",t.NBH="",t.IND="",t.NEL="
",t.SSA="",t.ESA="",t.HTS="",t.HTJ="",t.VTS="",t.PLD="",t.PLU="",t.RI="",t.SS2="",t.SS3="",t.DCS="",t.PU1="",t.PU2="",t.STS="",t.CCH="",t.MW="",t.SPA="",t.EPA="",t.SOS="",t.SGCI="",t.SCI="",t.CSI="",t.ST="",t.OSC="",t.PM="",t.APC=""))(ts||(ts={}));var ua;(t=>t.ST=`${T.ESC}\\`)(ua||(ua={}));var _r=class{constructor(e,i,s,r,n,o){this._textarea=e,this._compositionView=i,this._bufferService=s,this._optionsService=r,this._coreService=n,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let s;i.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(i.start,this._compositionPosition.start):s=this._textarea.value.substring(i.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let i=this._textarea.value,s=i.replace(e,"");this._dataAlreadySent=s,i.length>e.length?this._coreService.triggerDataEvent(s,!0):i.length<e.length?this._coreService.triggerDataEvent(`${T.DEL}`,!0):i.length===e.length&&i!==e&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};_r=ue([O(2,Ke),O(3,qe),O(4,Xt),O(5,Et)],_r);var xe=0,ke=0,Le=0,ce=0,Cn={css:"#00000000",rgba:0},ve;(t=>{function e(r,n,o,l){return l!==void 0?`#${Nt(r)}${Nt(n)}${Nt(o)}${Nt(l)}`:`#${Nt(r)}${Nt(n)}${Nt(o)}`}t.toCss=e;function i(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}t.toRgba=i;function s(r,n,o,l){return{css:t.toCss(r,n,o,l),rgba:t.toRgba(r,n,o,l)}}t.toColor=s})(ve||(ve={}));var re;(t=>{function e(h,a){if(ce=(a.rgba&255)/255,ce===1)return{css:a.css,rgba:a.rgba};let c=a.rgba>>24&255,d=a.rgba>>16&255,u=a.rgba>>8&255,_=h.rgba>>24&255,f=h.rgba>>16&255,v=h.rgba>>8&255;xe=_+Math.round((c-_)*ce),ke=f+Math.round((d-f)*ce),Le=v+Math.round((u-v)*ce);let b=ve.toCss(xe,ke,Le),y=ve.toRgba(xe,ke,Le);return{css:b,rgba:y}}t.blend=e;function i(h){return(h.rgba&255)===255}t.isOpaque=i;function s(h,a,c){let d=is.ensureContrastRatio(h.rgba,a.rgba,c);if(d)return ve.toColor(d>>24&255,d>>16&255,d>>8&255)}t.ensureContrastRatio=s;function r(h){let a=(h.rgba|255)>>>0;return[xe,ke,Le]=is.toChannels(a),{css:ve.toCss(xe,ke,Le),rgba:a}}t.opaque=r;function n(h,a){return ce=Math.round(a*255),[xe,ke,Le]=is.toChannels(h.rgba),{css:ve.toCss(xe,ke,Le,ce),rgba:ve.toRgba(xe,ke,Le,ce)}}t.opacity=n;function o(h,a){return ce=h.rgba&255,n(h,ce*a/255)}t.multiplyOpacity=o;function l(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}t.toColorRGB=l})(re||(re={}));var le;(t=>{let e,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return xe=parseInt(r.slice(1,2).repeat(2),16),ke=parseInt(r.slice(2,3).repeat(2),16),Le=parseInt(r.slice(3,4).repeat(2),16),ve.toColor(xe,ke,Le);case 5:return xe=parseInt(r.slice(1,2).repeat(2),16),ke=parseInt(r.slice(2,3).repeat(2),16),Le=parseInt(r.slice(3,4).repeat(2),16),ce=parseInt(r.slice(4,5).repeat(2),16),ve.toColor(xe,ke,Le,ce);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return xe=parseInt(n[1]),ke=parseInt(n[2]),Le=parseInt(n[3]),ce=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),ve.toColor(xe,ke,Le,ce);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[xe,ke,Le,ce]=e.getImageData(0,0,1,1).data,ce!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ve.toRgba(xe,ke,Le,ce),css:r}}t.toColor=s})(le||(le={}));var ze;(t=>{function e(s){return i(s>>16&255,s>>8&255,s&255)}t.relativeLuminance=e;function i(s,r,n){let o=s/255,l=r/255,h=n/255,a=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),d=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return a*.2126+c*.7152+d*.0722}t.relativeLuminance2=i})(ze||(ze={}));var is;(t=>{function e(o,l){if(ce=(l&255)/255,ce===1)return l;let h=l>>24&255,a=l>>16&255,c=l>>8&255,d=o>>24&255,u=o>>16&255,_=o>>8&255;return xe=d+Math.round((h-d)*ce),ke=u+Math.round((a-u)*ce),Le=_+Math.round((c-_)*ce),ve.toRgba(xe,ke,Le)}t.blend=e;function i(o,l,h){let a=ze.relativeLuminance(o>>8),c=ze.relativeLuminance(l>>8);if(St(a,c)<h){if(c<a){let _=s(o,l,h),f=St(a,ze.relativeLuminance(_>>8));if(f<h){let v=r(o,l,h),b=St(a,ze.relativeLuminance(v>>8));return f>b?_:v}return _}let d=r(o,l,h),u=St(a,ze.relativeLuminance(d>>8));if(u<h){let _=s(o,l,h),f=St(a,ze.relativeLuminance(_>>8));return u>f?d:_}return d}}t.ensureContrastRatio=i;function s(o,l,h){let a=o>>24&255,c=o>>16&255,d=o>>8&255,u=l>>24&255,_=l>>16&255,f=l>>8&255,v=St(ze.relativeLuminance2(u,_,f),ze.relativeLuminance2(a,c,d));for(;v<h&&(u>0||_>0||f>0);)u-=Math.max(0,Math.ceil(u*.1)),_-=Math.max(0,Math.ceil(_*.1)),f-=Math.max(0,Math.ceil(f*.1)),v=St(ze.relativeLuminance2(u,_,f),ze.relativeLuminance2(a,c,d));return(u<<24|_<<16|f<<8|255)>>>0}t.reduceLuminance=s;function r(o,l,h){let a=o>>24&255,c=o>>16&255,d=o>>8&255,u=l>>24&255,_=l>>16&255,f=l>>8&255,v=St(ze.relativeLuminance2(u,_,f),ze.relativeLuminance2(a,c,d));for(;v<h&&(u<255||_<255||f<255);)u=Math.min(255,u+Math.ceil((255-u)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),v=St(ze.relativeLuminance2(u,_,f),ze.relativeLuminance2(a,c,d));return(u<<24|_<<16|f<<8|255)>>>0}t.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(is||(is={}));function Nt(t){let e=t.toString(16);return e.length<2?"0"+e:e}function St(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}var Bc=class extends Fi{constructor(e,i,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},cs=class{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new rt}register(t){let e={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(e),e.id}deregister(t){for(let e=0;e<this._characterJoiners.length;e++)if(this._characterJoiners[e].id===t)return this._characterJoiners.splice(e,1),!0;return!1}getJoinedCharacters(t){if(this._characterJoiners.length===0)return[];let e=this._bufferService.buffer.lines.get(t);if(!e||e.length===0)return[];let i=[],s=e.translateToString(!0),r=0,n=0,o=0,l=e.getFg(0),h=e.getBg(0);for(let a=0;a<e.getTrimmedLength();a++)if(e.loadCell(a,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==h){if(a-r>1){let c=this._getJoinedRanges(s,o,n,e,r);for(let d=0;d<c.length;d++)i.push(c[d])}r=a,o=n,l=this._workCell.fg,h=this._workCell.bg}n+=this._workCell.getChars().length||Ft.length}if(this._bufferService.cols-r>1){let a=this._getJoinedRanges(s,o,n,e,r);for(let c=0;c<a.length;c++)i.push(a[c])}return i}_getJoinedRanges(t,e,i,s,r){let n=t.substring(e,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let h=this._characterJoiners[l].handler(n);for(let a=0;a<h.length;a++)cs._mergeRanges(o,h[a])}catch(h){console.error(h)}return this._stringRangesToCellRanges(o,s,r),o}_stringRangesToCellRanges(t,e,i){let s=0,r=!1,n=0,o=t[s];if(o){for(let l=i;l<this._bufferService.cols;l++){let h=e.getWidth(l),a=e.getString(l).length||Ft.length;if(h!==0){if(!r&&o[0]<=n&&(o[0]=l,r=!0),o[1]<=n){if(o[1]=l,o=t[++s],!o)break;o[0]<=n?(o[0]=l,r=!0):r=!1}n+=a}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(t,e){let i=!1;for(let s=0;s<t.length;s++){let r=t[s];if(i){if(e[1]<=r[0])return t[s-1][1]=e[1],t;if(e[1]<=r[1])return t[s-1][1]=Math.max(e[1],r[1]),t.splice(s,1),t;t.splice(s,1),s--}else{if(e[1]<=r[0])return t.splice(s,0,e),t;if(e[1]<=r[1])return r[0]=Math.min(e[0],r[0]),t;e[0]<r[1]&&(r[0]=Math.min(e[0],r[0]),i=!0);continue}}return i?t[t.length-1][1]=e[1]:t.push(e),t}};cs=ue([O(0,Ke)],cs);function Tc(t){return 57508<=t&&t<=57558}function Ac(t){return 9472<=t&&t<=9631}function Dc(t){return Tc(t)||Ac(t)}function Pc(){return{css:{canvas:Ui(),cell:Ui()},device:{canvas:Ui(),cell:Ui(),char:{width:0,height:0,left:0,top:0}}}}function Ui(){return{width:0,height:0}}var fr=class{constructor(e,i,s,r,n,o,l){this._document=e,this._characterJoinerService=i,this._optionsService=s,this._coreBrowserService=r,this._coreService=n,this._decorationService=o,this._themeService=l,this._workCell=new rt,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,i,s){this._selectionStart=e,this._selectionEnd=i,this._columnSelectMode=s}createRow(e,i,s,r,n,o,l,h,a,c,d){let u=[],_=this._characterJoinerService.getJoinedCharacters(i),f=this._themeService.colors,v=e.getNoBgTrimmedLength();s&&v<o+1&&(v=o+1);let b,y=0,C="",L=0,g=0,B=0,M=0,I=!1,N=0,G=!1,Q=0,$=0,S=[],p=c!==-1&&d!==-1;for(let w=0;w<v;w++){e.loadCell(w,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let k=!1,E=w>=$,A=w,R=this._workCell;if(_.length>0&&w===_[0][0]&&E){let j=_.shift(),_e=this._isCellInSelection(j[0],i);for(L=j[0]+1;L<j[1];L++)E&&(E=_e===this._isCellInSelection(L,i));E&&(E=!s||o<j[0]||o>=j[1]),E?(k=!0,R=new Bc(this._workCell,e.translateToString(!0,j[0],j[1]),j[1]-j[0]),A=j[1]-1,m=R.getWidth()):$=j[1]}let D=this._isCellInSelection(w,i),z=s&&w===o,Z=p&&w>=c&&w<=d,H=!1;this._decorationService.forEachDecorationAtCell(w,i,void 0,j=>{H=!0});let Y=R.getChars()||Ft;if(Y===" "&&(R.isUnderline()||R.isOverline())&&(Y=" "),Q=m*h-a.get(Y,R.isBold(),R.isItalic()),!b)b=this._document.createElement("span");else if(y&&(D&&G||!D&&!G&&R.bg===g)&&(D&&G&&f.selectionForeground||R.fg===B)&&R.extended.ext===M&&Z===I&&Q===N&&!z&&!k&&!H&&E){R.isInvisible()?C+=Ft:C+=Y,y++;continue}else y&&(b.textContent=C),b=this._document.createElement("span"),y=0,C="";if(g=R.bg,B=R.fg,M=R.extended.ext,I=Z,N=Q,G=D,k&&o>=w&&o<=A&&(o=w),!this._coreService.isCursorHidden&&z&&this._coreService.isCursorInitialized){if(S.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&S.push("xterm-cursor-blink"),S.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":S.push("xterm-cursor-outline");break;case"block":S.push("xterm-cursor-block");break;case"bar":S.push("xterm-cursor-bar");break;case"underline":S.push("xterm-cursor-underline");break}}if(R.isBold()&&S.push("xterm-bold"),R.isItalic()&&S.push("xterm-italic"),R.isDim()&&S.push("xterm-dim"),R.isInvisible()?C=Ft:C=R.getChars()||Ft,R.isUnderline()&&(S.push(`xterm-underline-${R.extended.underlineStyle}`),C===" "&&(C=" "),!R.isUnderlineColorDefault()))if(R.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${Fi.toColorRGB(R.getUnderlineColor()).join(",")})`;else{let j=R.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&R.isBold()&&j<8&&(j+=8),b.style.textDecorationColor=f.ansi[j].css}R.isOverline()&&(S.push("xterm-overline"),C===" "&&(C=" ")),R.isStrikethrough()&&S.push("xterm-strikethrough"),Z&&(b.style.textDecoration="underline");let F=R.getFgColor(),X=R.getFgColorMode(),q=R.getBgColor(),V=R.getBgColorMode(),ee=!!R.isInverse();if(ee){let j=F;F=q,q=j;let _e=X;X=V,V=_e}let me,Ne,We=!1;this._decorationService.forEachDecorationAtCell(w,i,void 0,j=>{j.options.layer!=="top"&&We||(j.backgroundColorRGB&&(V=50331648,q=j.backgroundColorRGB.rgba>>8&16777215,me=j.backgroundColorRGB),j.foregroundColorRGB&&(X=50331648,F=j.foregroundColorRGB.rgba>>8&16777215,Ne=j.foregroundColorRGB),We=j.options.layer==="top")}),!We&&D&&(me=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,q=me.rgba>>8&16777215,V=50331648,We=!0,f.selectionForeground&&(X=50331648,F=f.selectionForeground.rgba>>8&16777215,Ne=f.selectionForeground)),We&&S.push("xterm-decoration-top");let Te;switch(V){case 16777216:case 33554432:Te=f.ansi[q],S.push(`xterm-bg-${q}`);break;case 50331648:Te=ve.toColor(q>>16,q>>8&255,q&255),this._addStyle(b,`background-color:#${xn((q>>>0).toString(16),"0",6)}`);break;case 0:default:ee?(Te=f.foreground,S.push("xterm-bg-257")):Te=f.background}switch(me||R.isDim()&&(me=re.multiplyOpacity(Te,.5)),X){case 16777216:case 33554432:R.isBold()&&F<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(F+=8),this._applyMinimumContrast(b,Te,f.ansi[F],R,me,void 0)||S.push(`xterm-fg-${F}`);break;case 50331648:let j=ve.toColor(F>>16&255,F>>8&255,F&255);this._applyMinimumContrast(b,Te,j,R,me,Ne)||this._addStyle(b,`color:#${xn(F.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(b,Te,f.foreground,R,me,Ne)||ee&&S.push("xterm-fg-257")}S.length&&(b.className=S.join(" "),S.length=0),!z&&!k&&!H&&E?y++:b.textContent=C,Q!==this.defaultSpacing&&(b.style.letterSpacing=`${Q}px`),u.push(b),w=A}return b&&y&&(b.textContent=C),u}_applyMinimumContrast(e,i,s,r,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||Dc(r.getCode()))return!1;let l=this._getContrastCache(r),h;if(!n&&!o&&(h=l.getColor(i.rgba,s.rgba)),h===void 0){let a=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);h=re.ensureContrastRatio(n||i,o||s,a),l.setColor((n||i).rgba,(o||s).rgba,h??null)}return h?(this._addStyle(e,`color:${h.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,i){e.setAttribute("style",`${e.getAttribute("style")||""}${i};`)}_isCellInSelection(e,i){let s=this._selectionStart,r=this._selectionEnd;return!s||!r?!1:this._columnSelectMode?s[0]<=r[0]?e>=s[0]&&i>=s[1]&&e<r[0]&&i<=r[1]:e<s[0]&&i>=s[1]&&e>=r[0]&&i<=r[1]:i>s[1]&&i<r[1]||s[1]===r[1]&&i===s[1]&&e>=s[0]&&e<r[0]||s[1]<r[1]&&i===r[1]&&e<r[0]||s[1]<r[1]&&i===s[1]&&e>=s[0]}};fr=ue([O(1,Go),O(2,qe),O(3,Lt),O(4,Xt),O(5,$i),O(6,ci)],fr);function xn(t,e,i){for(;t.length<i;)t=e+t;return t}var Oc=class{constructor(e,i){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let s=e.createElement("span");s.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[s,r,n,o],this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(o),i.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,i,s,r){e===this._font&&i===this._fontSize&&s===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=i,this._weight=s,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${s}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${s}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,i,s){let r=0;if(!i&&!s&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let l=this._measure(e,0);return l>0&&(this._flat[r]=l),l}let n=e;i&&(n+="B"),s&&(n+="I");let o=this._holey.get(n);if(o===void 0){let l=0;i&&(l|=1),s&&(l|=2),o=this._measure(e,l),o>0&&this._holey.set(n,o)}return o}_measure(e,i){let s=this._measureElements[i];return s.textContent=e.repeat(32),s.offsetWidth/32}},Ic=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(e,i,s,r=!1){if(this.selectionStart=i,this.selectionEnd=s,!i||!s||i[0]===s[0]&&i[1]===s[1]){this.clear();return}let n=e.buffers.active.ydisp,o=i[1]-n,l=s[1]-n,h=Math.max(o,0),a=Math.min(l,e.rows-1);if(h>=e.rows||a<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=o,this.viewportEndRow=l,this.viewportCappedStartRow=h,this.viewportCappedEndRow=a,this.startCol=i[0],this.endCol=s[0]}isCellSelected(e,i,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&s>=this.viewportCappedStartRow&&i<this.endCol&&s<=this.viewportCappedEndRow:i<this.startCol&&s>=this.viewportCappedStartRow&&i>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&i>=this.startCol&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&i>=this.startCol):!1}};function Fc(){return new Ic}var Ls="xterm-dom-renderer-owner-",Je="xterm-rows",Ki="xterm-fg-",kn="xterm-bg-",gi="xterm-focus",qi="xterm-selection",$c=1,gr=class extends K{constructor(e,i,s,r,n,o,l,h,a,c,d,u,_,f){super(),this._terminal=e,this._document=i,this._element=s,this._screenElement=r,this._viewportElement=n,this._helperContainer=o,this._linkifier2=l,this._charSizeService=a,this._optionsService=c,this._bufferService=d,this._coreService=u,this._coreBrowserService=_,this._themeService=f,this._terminalClass=$c++,this._rowElements=[],this._selectionRenderModel=Fc(),this.onRequestRedraw=this._register(new P).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Je),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(qi),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Pc(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(v=>this._injectCss(v))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(fr,document),this._element.classList.add(Ls+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(v=>this._handleLinkHover(v))),this._register(this._linkifier2.onHideLinkUnderline(v=>this._handleLinkLeave(v))),this._register(oe(()=>{this._element.classList.remove(Ls+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Oc(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${Je} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let i=`${this._terminalSelector} .${Je} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;i+=`${this._terminalSelector} .${Je} .xterm-dim { color: ${re.multiplyOpacity(e.foreground,.5).css};}`,i+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let s=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;i+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,i+=`@keyframes ${r} { 50% { box-shadow: none; }}`,i+=`@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,i+=`${this._terminalSelector} .${Je}.${gi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Je}.${gi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Je}.${gi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Je} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Je} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Je} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Je} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Je} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,i+=`${this._terminalSelector} .${qi} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${qi} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${qi} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,l]of e.ansi.entries())i+=`${this._terminalSelector} .${Ki}${o} { color: ${l.css}; }${this._terminalSelector} .${Ki}${o}.xterm-dim { color: ${re.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${kn}${o} { background-color: ${l.css}; }`;i+=`${this._terminalSelector} .${Ki}257 { color: ${re.opaque(e.background).css}; }${this._terminalSelector} .${Ki}257.xterm-dim { color: ${re.multiplyOpacity(re.opaque(e.background),.5).css}; }${this._terminalSelector} .${kn}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,i){for(let s=this._rowElements.length;s<=i;s++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(gi),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(gi),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,s),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,s),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(s){let a=e[0]>i[0];h.appendChild(this._createSelectionElement(o,a?i[0]:e[0],a?e[0]:i[0],l-o+1))}else{let a=r===o?e[0]:0,c=o===n?i[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(o,a,c));let d=l-o-1;if(h.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,d)),o!==l){let u=n===l?i[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(l,0,u))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,i,s,r=1){let n=this._document.createElement("div"),o=i*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(s-i);return o+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-o),n.style.height=`${r*this.dimensions.css.cell.height}px`,n.style.top=`${e*this.dimensions.css.cell.height}px`,n.style.left=`${o}px`,n.style.width=`${l}px`,n}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,i){let s=this._bufferService.buffer,r=s.ybase+s.y,n=Math.min(s.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let a=e;a<=i;a++){let c=a+s.ydisp,d=this._rowElements[a],u=s.lines.get(c);if(!d||!u)break;d.replaceChildren(...this._rowFactory.createRow(u,c,c===r,l,h,n,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Ls}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,i,s,r,n,o){s<0&&(e=0),r<0&&(i=0);let l=this._bufferService.rows-1;s=Math.max(Math.min(s,l),0),r=Math.max(Math.min(r,l),0),n=Math.min(n,this._bufferService.cols);let h=this._bufferService.buffer,a=h.ybase+h.y,c=Math.min(h.x,n-1),d=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,_=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=s;f<=r;++f){let v=f+h.ydisp,b=this._rowElements[f],y=h.lines.get(v);if(!b||!y)break;b.replaceChildren(...this._rowFactory.createRow(y,v,v===a,u,_,c,d,this.dimensions.css.cell.width,this._widthCache,o?f===s?e:0:-1,o?(f===r?i:n)-1:-1))}}};gr=ue([O(7,Ir),O(8,ps),O(9,qe),O(10,Ke),O(11,Xt),O(12,Lt),O(13,ci)],gr);var pr=class extends K{constructor(e,i,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new P),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Wc(this._optionsService))}catch{this._measureStrategy=this._register(new Nc(e,i,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};pr=ue([O(2,qe)],pr);var _a=class extends K{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,e){t!==void 0&&t>0&&e!==void 0&&e>0&&(this._result.width=t,this._result.height=e)}},Nc=class extends _a{constructor(t,e,i){super(),this._document=t,this._parentElement=e,this._optionsService=i,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},Wc=class extends _a{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},zc=class extends K{constructor(e,i,s){super(),this._textarea=e,this._window=i,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Hc(this._window)),this._onDprChange=this._register(new P),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new P),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Ie.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(W(this._textarea,"focus",()=>this._isFocused=!0)),this._register(W(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},Hc=class extends K{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new hi),this._onDprChange=this._register(new P),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(oe(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=W(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},Uc=class extends K{constructor(){super(),this.linkProviders=[],this._register(oe(()=>this.linkProviders.length=0))}registerLinkProvider(t){return this.linkProviders.push(t),{dispose:()=>{let e=this.linkProviders.indexOf(t);e!==-1&&this.linkProviders.splice(e,1)}}}};function Kr(t,e,i){let s=i.getBoundingClientRect(),r=t.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[e.clientX-s.left-n,e.clientY-s.top-o]}function Kc(t,e,i,s,r,n,o,l,h){if(!n)return;let a=Kr(t,e,i);if(a)return a[0]=Math.ceil((a[0]+(h?o/2:0))/o),a[1]=Math.ceil(a[1]/l),a[0]=Math.min(Math.max(a[0],1),s+(h?1:0)),a[1]=Math.min(Math.max(a[1],1),r),a}var vr=class{constructor(e,i){this._renderService=e,this._charSizeService=i}getCoords(e,i,s,r,n){return Kc(window,e,i,s,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,i){let s=Kr(window,e,i);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};vr=ue([O(0,Et),O(1,ps)],vr);var qc=class{constructor(e,i){this._renderCallback=e,this._coreBrowserService=i,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,i,s){this._rowCount=s,e=e!==void 0?e:0,i=i!==void 0?i:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,i):i,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},fa={};th(fa,{getSafariVersion:()=>Yc,isChromeOS:()=>ma,isFirefox:()=>ga,isIpad:()=>Gc,isIphone:()=>jc,isLegacyEdge:()=>Vc,isLinux:()=>qr,isMac:()=>ds,isNode:()=>vs,isSafari:()=>pa,isWindows:()=>va});var vs=typeof process<"u"&&"title"in process,Ni=vs?"node":navigator.userAgent,Wi=vs?"node":navigator.platform,ga=Ni.includes("Firefox"),Vc=Ni.includes("Edge"),pa=/^((?!chrome|android).)*safari/i.test(Ni);function Yc(){if(!pa)return 0;let t=Ni.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}var ds=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Wi),Gc=Wi==="iPad",jc=Wi==="iPhone",va=["Windows","Win16","Win32","WinCE"].includes(Wi),qr=Wi.indexOf("Linux")>=0,ma=/\bCrOS\b/.test(Ni),Sa=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),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(t){this._idleCallback=void 0;let e=0,i=0,s=t.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),i=Math.max(e,i),r=t.timeRemaining(),i*1.5>r){s-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-e))}ms`),this._start();return}s=r}this.clear()}},Xc=class extends Sa{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let i=performance.now()+e;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},Zc=class extends Sa{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},us=!vs&&"requestIdleCallback"in window?Zc:Xc,Jc=class{constructor(){this._queue=new us}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}},mr=class extends K{constructor(e,i,s,r,n,o,l,h,a){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=r,this._coreService=n,this._coreBrowserService=h,this._renderer=this._register(new hi),this._pausedResizeTask=new Jc,this._observerDisposable=this._register(new hi),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new P),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new P),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new P),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new P),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new qc((c,d)=>this._renderRows(c,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Qc(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(oe(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(a.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});s.observe(i),this._observerDisposable.value=oe(()=>s.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,i,s=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),i=Math.max(i,r.end)),s||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(i=>this.refreshRows(i.start,i.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,i;this._renderer.value&&((i=(e=this._renderer.value).clearTextureAtlas)==null||i.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var s;return(s=this._renderer.value)==null?void 0:s.handleResize(e,i)}):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,i,s){var r;this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=s,(r=this._renderer.value)==null||r.handleSelectionChanged(e,i,s)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};mr=ue([O(2,qe),O(3,ps),O(4,Xt),O(5,$i),O(6,Ke),O(7,Lt),O(8,ci)],mr);var Qc=class{constructor(t,e,i){this._coreBrowserService=t,this._coreService=e,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(t,e){this._isBuffering?(this._start=Math.min(this._start,t),this._end=Math.max(this._end,e)):(this._start=t,this._end=e,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let t={start:this._start,end:this._end};return this._isBuffering=!1,t}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function ed(t,e,i,s){let r=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return sd(r,n,t,e,i,s)+ms(n,e,i,s)+rd(r,n,t,e,i,s);let o;if(n===e)return o=r>t?"D":"C",Pi(Math.abs(r-t),Di(o,s));o=n>e?"D":"C";let l=Math.abs(n-e),h=id(n>e?t:r,i)+(l-1)*i.cols+1+td(n>e?r:t);return Pi(h,Di(o,s))}function td(t,e){return t-1}function id(t,e){return e.cols-t}function sd(t,e,i,s,r,n){return ms(e,s,r,n).length===0?"":Pi(ba(t,e,t,e-jt(e,r),!1,r).length,Di("D",n))}function ms(t,e,i,s){let r=t-jt(t,i),n=e-jt(e,i),o=Math.abs(r-n)-nd(t,e,i);return Pi(o,Di(wa(t,e),s))}function rd(t,e,i,s,r,n){let o;ms(e,s,r,n).length>0?o=s-jt(s,r):o=e;let l=s,h=od(t,e,i,s,r,n);return Pi(ba(t,o,i,l,h==="C",r).length,Di(h,n))}function nd(t,e,i){var o;let s=0,r=t-jt(t,i),n=e-jt(e,i);for(let l=0;l<Math.abs(r-n);l++){let h=wa(t,e)==="A"?-1:1;(o=i.buffer.lines.get(r+h*l))!=null&&o.isWrapped&&s++}return s}function jt(t,e){let i=0,s=e.buffer.lines.get(t),r=s==null?void 0:s.isWrapped;for(;r&&t>=0&&t<e.rows;)i++,s=e.buffer.lines.get(--t),r=s==null?void 0:s.isWrapped;return i}function od(t,e,i,s,r,n){let o;return ms(i,s,r,n).length>0?o=s-jt(s,r):o=e,t<i&&o<=s||t>=i&&o<s?"C":"D"}function wa(t,e){return t>e?"A":"B"}function ba(t,e,i,s,r,n){let o=t,l=e,h="";for(;(o!==i||l!==s)&&l>=0&&l<n.buffer.lines.length;)o+=r?1:-1,r&&o>n.cols-1?(h+=n.buffer.translateBufferLineToString(l,!1,t,o),o=0,t=0,l++):!r&&o<0&&(h+=n.buffer.translateBufferLineToString(l,!1,0,t+1),o=n.cols-1,t=o,l--);return h+n.buffer.translateBufferLineToString(l,!1,t,o)}function Di(t,e){let i=e?"O":"[";return T.ESC+i+t}function Pi(t,e){t=Math.floor(t);let i="";for(let s=0;s<t;s++)i+=e;return i}var ad=class{constructor(t){this._bufferService=t,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,e=this.selectionEnd;return!t||!e?!1:t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Ln(t,e){if(t.start.y>t.end.y)throw new Error(`Buffer range end (${t.end.x}, ${t.end.y}) cannot be before start (${t.start.x}, ${t.start.y})`);return e*(t.end.y-t.start.y)+(t.end.x-t.start.x+1)}var Es=50,ld=15,hd=50,cd=500,dd=" ",ud=new RegExp(dd,"g"),Sr=class extends K{constructor(e,i,s,r,n,o,l,h,a){super(),this._element=e,this._screenElement=i,this._linkifier=s,this._bufferService=r,this._coreService=n,this._mouseService=o,this._optionsService=l,this._renderService=h,this._coreBrowserService=a,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new rt,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new P),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new P),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new P),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new P),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new ad(this._bufferService),this._activeSelectionMode=0,this._register(oe(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!e||!i?!1:e[0]!==i[0]||e[1]!==i[1]}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let s=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===i[0])return"";let n=e[0]<i[0]?e[0]:i[0],o=e[0]<i[0]?i[0]:e[0];for(let l=e[1];l<=i[1];l++){let h=s.translateBufferLineToString(l,!0,n,o);r.push(h)}}else{let n=e[1]===i[1]?i[0]:void 0;r.push(s.translateBufferLineToString(e[1],!0,e[0],n));for(let o=e[1]+1;o<=i[1]-1;o++){let l=s.lines.get(o),h=s.translateBufferLineToString(o,!0);l!=null&&l.isWrapped?r[r.length-1]+=h:r.push(h)}if(e[1]!==i[1]){let o=s.lines.get(i[1]),l=s.translateBufferLineToString(i[1],!0,0,i[0]);o&&o.isWrapped?r[r.length-1]+=l:r.push(l)}}return r.map(n=>n.replace(ud," ")).join(va?`\r
|
|
20
|
+
`))}},Hh=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},Uh=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},Kh=0,Cs=class{constructor(e){this.value=e,this.id=Kh++}},qh=2,Vh,P=class{constructor(e){var i,s,r,n;this._size=0,this._options=e,this._leakageMon=(i=this._options)!=null&&i.leakWarningThreshold?new Wh((e==null?void 0:e.onListenerError)??Qi,((s=this._options)==null?void 0:s.leakWarningThreshold)??Nh):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new $h(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,i,s,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(s=(i=this._options)==null?void 0:i.onDidRemoveLastListener)==null||s.call(i),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,i,s)=>{var l,h,a,c,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(u);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new Uh(`${u}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(((l=this._options)==null?void 0:l.onListenerError)||Qi)(f),Y.None}if(this._disposed)return Y.None;i&&(e=e.bind(i));let r=new Cs(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=zh.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Cs?(this._deliveryQueue??(this._deliveryQueue=new Yh),this._listeners=[this._listeners,r]):this._listeners.push(r):((a=(h=this._options)==null?void 0:h.onWillAddFirstListener)==null||a.call(h,this),this._listeners=r,(d=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null||d.call(c,this)),this._size++;let o=ne(()=>{n==null||n(),this._removeListener(r)});return s instanceof $t?s.add(o):Array.isArray(s)&&s.push(o),o}),this._event}_removeListener(e){var n,o,l,h;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null||o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(h=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||h.call(l,this),this._size=0;return}let i=this._listeners,s=i.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,i[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*qh<=i.length){let a=0;for(let c=0;c<i.length;c++)i[c]?i[a++]=i[c]:r&&(this._deliveryQueue.end--,a<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=a}}_deliver(e,i){var r;if(!e)return;let s=((r=this._options)==null?void 0:r.onListenerError)||Qi;if(!s){e.value(i);return}try{e.value(i)}catch(n){s(n)}}_deliverQueue(e){let i=e.current._listeners;for(;e.i<e.end;)this._deliver(i[e.i++],e.value);e.reset()}fire(e){var i,s,r,n;if((i=this._deliveryQueue)!=null&&i.current&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null||s.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof Cs)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null||n.stop()}hasListeners(){return this._size>0}},Yh=class{constructor(){this.i=-1,this.end=0}enqueue(e,i,s){this.i=0,this.end=s,this.current=e,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},or=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new P,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new P,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,e),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,e),this._onDidChangeFullscreen.fire(s)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};or.INSTANCE=new or;var zr=or;function jh(t,e,i){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",i)}zr.INSTANCE.onDidChangeZoomLevel;function Gh(t){return zr.INSTANCE.getZoomFactor(t)}zr.INSTANCE.onDidChangeFullscreen;var di=typeof navigator=="object"?navigator.userAgent:"",ar=di.indexOf("Firefox")>=0,Xh=di.indexOf("AppleWebKit")>=0,Hr=di.indexOf("Chrome")>=0,Zh=!Hr&&di.indexOf("Safari")>=0;di.indexOf("Electron/")>=0;di.indexOf("Android")>=0;var xs=!1;if(typeof xt.matchMedia=="function"){let t=xt.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=xt.matchMedia("(display-mode: fullscreen)");xs=t.matches,jh(xt,t,({matches:i})=>{xs&&e.matches||(xs=i)})}var ri="en",lr=!1,hr=!1,es=!1,_a=!1,Hi,ts=ri,fn=ri,Jh,nt,qt=globalThis,Ie,Io;typeof qt.vscode<"u"&&typeof qt.vscode.process<"u"?Ie=qt.vscode.process:typeof process<"u"&&typeof((Io=process==null?void 0:process.versions)==null?void 0:Io.node)=="string"&&(Ie=process);var Oo,Qh=typeof((Oo=Ie==null?void 0:Ie.versions)==null?void 0:Oo.electron)=="string",ec=Qh&&(Ie==null?void 0:Ie.type)==="renderer",Fo;if(typeof Ie=="object"){lr=Ie.platform==="win32",hr=Ie.platform==="darwin",es=Ie.platform==="linux",es&&Ie.env.SNAP&&Ie.env.SNAP_REVISION,Ie.env.CI||Ie.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Hi=ri,ts=ri;let t=Ie.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);Hi=e.userLocale,fn=e.osLocale,ts=e.resolvedLanguage||ri,Jh=(Fo=e.languagePack)==null?void 0:Fo.translationsConfigFile}catch{}_a=!0}else typeof navigator=="object"&&!ec?(nt=navigator.userAgent,lr=nt.indexOf("Windows")>=0,hr=nt.indexOf("Macintosh")>=0,(nt.indexOf("Macintosh")>=0||nt.indexOf("iPad")>=0||nt.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,es=nt.indexOf("Linux")>=0,(nt==null?void 0:nt.indexOf("Mobi"))>=0,ts=globalThis._VSCODE_NLS_LANGUAGE||ri,Hi=navigator.language.toLowerCase(),fn=Hi):console.error("Unable to resolve platform.");var fa=lr,ft=hr,tc=es,gn=_a,gt=nt,Bt=ts,ic;(t=>{function e(){return Bt}t.value=e;function i(){return Bt.length===2?Bt==="en":Bt.length>=3?Bt[0]==="e"&&Bt[1]==="n"&&Bt[2]==="-":!1}t.isDefaultVariant=i;function s(){return Bt==="en"}t.isDefault=s})(ic||(ic={}));var sc=typeof qt.postMessage=="function"&&!qt.importScripts;(()=>{if(sc){let t=[];qt.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.id===i.data.vscodeScheduleAsyncWork){t.splice(s,1),n.callback();return}}});let e=0;return i=>{let s=++e;t.push({id:s,callback:i}),qt.postMessage({vscodeScheduleAsyncWork:s},"*")}}return t=>setTimeout(t)})();var rc=!!(gt&>.indexOf("Chrome")>=0);gt&>.indexOf("Firefox")>=0;!rc&>&>.indexOf("Safari")>=0;gt&>.indexOf("Edg/")>=0;gt&>.indexOf("Android")>=0;var Jt=typeof navigator=="object"?navigator:{};gn||document.queryCommandSupported&&document.queryCommandSupported("copy")||Jt&&Jt.clipboard&&Jt.clipboard.writeText,gn||Jt&&Jt.clipboard&&Jt.clipboard.readText;var Ur=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},ks=new Ur,pn=new Ur,vn=new Ur,nc=new Array(230),ga;(t=>{function e(l){return ks.keyCodeToStr(l)}t.toString=e;function i(l){return ks.strToKeyCode(l)}t.fromString=i;function s(l){return pn.keyCodeToStr(l)}t.toUserSettingsUS=s;function r(l){return vn.keyCodeToStr(l)}t.toUserSettingsGeneral=r;function n(l){return pn.strToKeyCode(l)||vn.strToKeyCode(l)}t.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return ks.keyCodeToStr(l)}t.toElectronAccelerator=o})(ga||(ga={}));var oc=class pa{constructor(e,i,s,r,n){this.ctrlKey=e,this.shiftKey=i,this.altKey=s,this.metaKey=r,this.keyCode=n}equals(e){return e instanceof pa&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",s=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${e}${i}${s}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new ac([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},ac=class{constructor(t){if(t.length===0)throw Ah("chords");this.chords=t}getHashCode(){let t="";for(let e=0,i=this.chords.length;e<i;e++)e!==0&&(t+=";"),t+=this.chords[e].getHashCode();return t}equals(t){if(t===null||this.chords.length!==t.chords.length)return!1;for(let e=0;e<this.chords.length;e++)if(!this.chords[e].equals(t.chords[e]))return!1;return!0}};function lc(t){if(t.charCode){let i=String.fromCharCode(t.charCode).toUpperCase();return ga.fromString(i)}let e=t.keyCode;if(e===3)return 7;if(ar)switch(e){case 59:return 85;case 60:if(tc)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ft)return 57;break}else if(Xh&&(ft&&e===93||!ft&&e===92))return 57;return nc[e]||0}var hc=ft?256:2048,cc=512,dc=1024,uc=ft?2048:256,mn=class{constructor(t){var i;this._standardKeyboardEventBrand=!0;let e=t;this.browserEvent=e,this.target=e.target,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.altGraphKey=(i=e.getModifierState)==null?void 0:i.call(e,"AltGraph"),this.keyCode=lc(e),this.code=e.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(t){return this._asKeybinding===t}_computeKeybinding(){let t=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode);let e=0;return this.ctrlKey&&(e|=hc),this.altKey&&(e|=cc),this.shiftKey&&(e|=dc),this.metaKey&&(e|=uc),e|=t,e}_computeKeyCodeChord(){let t=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode),new oc(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,t)}},Sn=new WeakMap;function _c(t){if(!t.parent||t.parent===t)return null;try{let e=t.location,i=t.parent.location;if(e.origin!=="null"&&i.origin!=="null"&&e.origin!==i.origin)return null}catch{return null}return t.parent}var fc=class{static getSameOriginWindowChain(t){let e=Sn.get(t);if(!e){e=[],Sn.set(t,e);let i=t,s;do s=_c(i),s?e.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):e.push({window:new WeakRef(i),iframeElement:null}),i=s;while(i)}return e.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(t,e){if(!e||t===e)return{top:0,left:0};let i=0,s=0,r=this.getSameOriginWindowChain(t);for(let n of r){let o=n.window.deref();if(i+=(o==null?void 0:o.scrollY)??0,s+=(o==null?void 0:o.scrollX)??0,o===e||!n.iframeElement)break;let l=n.iframeElement.getBoundingClientRect();i+=l.top,s+=l.left}return{top:i,left:s}}},Ui=class{constructor(e,i){this.timestamp=Date.now(),this.browserEvent=i,this.leftButton=i.button===0,this.middleButton=i.button===1,this.rightButton=i.button===2,this.buttons=i.buttons,this.target=i.target,this.detail=i.detail||1,i.type==="dblclick"&&(this.detail=2),this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,typeof i.pageX=="number"?(this.posx=i.pageX,this.posy=i.pageY):(this.posx=i.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=i.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let s=fc.getPositionOfChildWindowRelativeToAncestorWindow(e,i.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},wn=class{constructor(e,i=0,s=0){var n;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=s,this.deltaX=i;let r=!1;if(Hr){let o=navigator.userAgent.match(/Chrome\/(\d+)/);r=(o?parseInt(o[1]):123)<=122}if(e){let o=e,l=e,h=((n=e.view)==null?void 0:n.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")r?this.deltaY=o.wheelDeltaY/(120*h):this.deltaY=o.wheelDeltaY/120;else if(typeof l.VERTICAL_AXIS<"u"&&l.axis===l.VERTICAL_AXIS)this.deltaY=-l.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?ar&&!ft?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")Zh&&fa?this.deltaX=-(o.wheelDeltaX/120):r?this.deltaX=o.wheelDeltaX/(120*h):this.deltaX=o.wheelDeltaX/120;else if(typeof l.HORIZONTAL_AXIS<"u"&&l.axis===l.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?ar&&!ft?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*h):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},va=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),gc;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof pc?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Fe.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:va})})(gc||(gc={}));var pc=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?va:(this._emitter||(this._emitter=new P),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Kr=class{constructor(e,i){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof i=="number"&&this.setIfNotSet(e,i)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,i){if(this._isDisposed)throw new tr("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},i)}setIfNotSet(e,i){if(this._isDisposed)throw new tr("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},i))}},vc=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,i,s=globalThis){if(this.isDisposed)throw new tr("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=s.setInterval(()=>{e()},i);this.disposable=ne(()=>{s.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},mc;(t=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}t.settled=e;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}t.withAsyncBody=i})(mc||(mc={}));var bn=class Qe{static fromArray(e){return new Qe(i=>{i.emitMany(e)})}static fromPromise(e){return new Qe(async i=>{i.emitMany(await e)})}static fromPromises(e){return new Qe(async i=>{await Promise.all(e.map(async s=>i.emitOne(await s)))})}static merge(e){return new Qe(async i=>{await Promise.all(e.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new P,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Fe.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(e,i){return new Qe(async s=>{for await(let r of e)s.emitOne(i(r))})}map(e){return Qe.map(this,e)}static filter(e,i){return new Qe(async s=>{for await(let r of e)i(r)&&s.emitOne(r)})}filter(e){return Qe.filter(this,e)}static coalesce(e){return Qe.filter(e,i=>!!i)}coalesce(){return Qe.coalesce(this)}static async toPromise(e){let i=[];for await(let s of e)i.push(s);return i}toPromise(){return Qe.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};bn.EMPTY=bn.fromArray([]);var{getWindow:_t,getWindowId:Sc,onDidRegisterWindow:wc}=(function(){let t=new Map,e={window:xt,disposables:new $t};t.set(xt.vscodeWindowId,e);let i=new P,s=new P,r=new P;function n(o,l){return(typeof o=="number"?t.get(o):void 0)??(l?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(t.has(o.vscodeWindowId))return Y.None;let l=new $t,h={window:o,disposables:l.add(new $t)};return t.set(o.vscodeWindowId,h),l.add(ne(()=>{t.delete(o.vscodeWindowId),s.fire(o)})),l.add(W(o,ke.BEFORE_UNLOAD,()=>{r.fire(o)})),i.fire(h),l},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return t.has(o)},getWindowById:n,getWindow(o){var a;let l=o;if((a=l==null?void 0:l.ownerDocument)!=null&&a.defaultView)return l.ownerDocument.defaultView.window;let h=o;return h!=null&&h.view?h.view.window:xt},getDocument(o){return _t(o).document}}})(),bc=class{constructor(e,i,s,r){this._node=e,this._type=i,this._handler=s,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function W(t,e,i,s){return new bc(t,e,i,s)}var yn=function(t,e,i,s){return W(t,e,i,s)},qr,yc=class extends vc{constructor(t){super(),this.defaultTarget=t&&_t(t)}cancelAndSet(t,e,i){return super.cancelAndSet(t,e,i??this.defaultTarget)}},Cn=class{constructor(e,i=0){this._runner=e,this.priority=i,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Qi(e)}}static sort(e,i){return i.priority-e.priority}};(function(){let t=new Map,e=new Map,i=new Map,s=new Map,r=n=>{i.set(n,!1);let o=t.get(n)??[];for(e.set(n,o),t.set(n,[]),s.set(n,!0);o.length>0;)o.sort(Cn.sort),o.shift().execute();s.set(n,!1)};qr=(n,o,l=0)=>{let h=Sc(n),a=new Cn(o,l),c=t.get(h);return c||(c=[],t.set(h,c)),c.push(a),i.get(h)||(i.set(h,!0),n.requestAnimationFrame(()=>r(h))),a}})();function Cc(t){let e=t.getBoundingClientRect(),i=_t(t);return{left:e.left+i.scrollX,top:e.top+i.scrollY,width:e.width,height:e.height}}var ke={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},xc=class{constructor(t){this.domNode=t,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(t){let e=Ye(t);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let e=Ye(t);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(t){let e=Ye(t);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(t){let e=Ye(t);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(t){let e=Ye(t);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(t){let e=Ye(t);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(t){let e=Ye(t);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(t){let e=Ye(t);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let e=Ye(t);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let e=Ye(t);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let e=Ye(t);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let e=Ye(t);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let e=Ye(t);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let e=Ye(t);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,e){this.domNode.classList.toggle(t,e),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,e){this.domNode.setAttribute(t,e)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function Ye(t){return typeof t=="number"?`${t}px`:t}function Di(t){return new xc(t)}var ma=class{constructor(){this._hooks=new $t,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,i){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(i)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,i,s,r,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=n;let o=e;try{e.setPointerCapture(i),this._hooks.add(ne(()=>{try{e.releasePointerCapture(i)}catch{}}))}catch{o=_t(e)}this._hooks.add(W(o,ke.POINTER_MOVE,l=>{if(l.buttons!==s){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(W(o,ke.POINTER_UP,l=>this.stopMonitoring(!0)))}};function kc(t,e,i){let s=null,r=null;if(typeof i.value=="function"?(s="value",r=i.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(s="get",r=i.get),!r)throw new Error("not supported");let n=`$memoize$${e}`;i[s]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[n]}}var ut;(t=>(t.Tap="-xterm-gesturetap",t.Change="-xterm-gesturechange",t.Start="-xterm-gesturestart",t.End="-xterm-gesturesend",t.Contextmenu="-xterm-gesturecontextmenu"))(ut||(ut={}));var xi=class $e extends Y{constructor(){super(),this.dispatched=!1,this.targets=new _n,this.ignoreTargets=new _n,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Fe.runAndSubscribe(wc,({window:e,disposables:i})=>{i.add(W(e.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),i.add(W(e.document,"touchend",s=>this.onTouchEnd(e,s))),i.add(W(e.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:xt,disposables:this._store}))}static addTarget(e){if(!$e.isTouchDevice())return Y.None;$e.INSTANCE||($e.INSTANCE=new $e);let i=$e.INSTANCE.targets.push(e);return ne(i)}static ignoreTarget(e){if(!$e.isTouchDevice())return Y.None;$e.INSTANCE||($e.INSTANCE=new $e);let i=$e.INSTANCE.ignoreTargets.push(e);return ne(i)}static isTouchDevice(){return"ontouchstart"in xt||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,r=e.targetTouches.length;s<r;s++){let n=e.targetTouches.item(s);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:i,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[i],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent(ut.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,i){let s=Date.now(),r=Object.keys(this.activeTouches).length;for(let n=0,o=i.changedTouches.length;n<o;n++){let l=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let h=this.activeTouches[l.identifier],a=Date.now()-h.initialTimeStamp;if(a<$e.HOLD_DELAY&&Math.abs(h.initialPageX-Xe(h.rollingPageX))<30&&Math.abs(h.initialPageY-Xe(h.rollingPageY))<30){let c=this.newGestureEvent(ut.Tap,h.initialTarget);c.pageX=Xe(h.rollingPageX),c.pageY=Xe(h.rollingPageY),this.dispatchEvent(c)}else if(a>=$e.HOLD_DELAY&&Math.abs(h.initialPageX-Xe(h.rollingPageX))<30&&Math.abs(h.initialPageY-Xe(h.rollingPageY))<30){let c=this.newGestureEvent(ut.Contextmenu,h.initialTarget);c.pageX=Xe(h.rollingPageX),c.pageY=Xe(h.rollingPageY),this.dispatchEvent(c)}else if(r===1){let c=Xe(h.rollingPageX),d=Xe(h.rollingPageY),u=Xe(h.rollingTimestamps)-h.rollingTimestamps[0],_=c-h.rollingPageX[0],f=d-h.rollingPageY[0],p=[...this.targets].filter(w=>h.initialTarget instanceof Node&&w.contains(h.initialTarget));this.inertia(e,p,s,Math.abs(_)/u,_>0?1:-1,c,Math.abs(f)/u,f>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(ut.End,h.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let s=document.createEvent("CustomEvent");return s.initEvent(e,!1,!0),s.initialTarget=i,s.tapCount=0,s}dispatchEvent(e){if(e.type===ut.Tap){let i=new Date().getTime(),s=0;i-this._lastSetTapCountTime>$e.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=i,e.tapCount=s}else(e.type===ut.Change||e.type===ut.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(e.initialTarget))return;let i=[];for(let s of this.targets)if(s.contains(e.initialTarget)){let r=0,n=e.initialTarget;for(;n&&n!==s;)r++,n=n.parentElement;i.push([r,s])}i.sort((s,r)=>s[0]-r[0]);for(let[s,r]of i)r.dispatchEvent(e),this.dispatched=!0}}inertia(e,i,s,r,n,o,l,h,a){this.handle=qr(e,()=>{let c=Date.now(),d=c-s,u=0,_=0,f=!0;r+=$e.SCROLL_FRICTION*d,l+=$e.SCROLL_FRICTION*d,r>0&&(f=!1,u=n*r*d),l>0&&(f=!1,_=h*l*d);let p=this.newGestureEvent(ut.Change);p.translationX=u,p.translationY=_,i.forEach(w=>w.dispatchEvent(p)),f||this.inertia(e,i,c,r,n,o+u,l,h,a+_)})}onTouchMove(e){let i=Date.now();for(let s=0,r=e.changedTouches.length;s<r;s++){let n=e.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let o=this.activeTouches[n.identifier],l=this.newGestureEvent(ut.Change,o.initialTarget);l.translationX=n.pageX-Xe(o.rollingPageX),l.translationY=n.pageY-Xe(o.rollingPageY),l.pageX=n.pageX,l.pageY=n.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};xi.SCROLL_FRICTION=-.005,xi.HOLD_DELAY=700,xi.CLEAR_TAP_COUNT_TIME=400,de([kc],xi,"isTouchDevice",1);var Lc=xi,Vr=class extends Y{onclick(e,i){this._register(W(e,ke.CLICK,s=>i(new Ui(_t(e),s))))}onmousedown(e,i){this._register(W(e,ke.MOUSE_DOWN,s=>i(new Ui(_t(e),s))))}onmouseover(e,i){this._register(W(e,ke.MOUSE_OVER,s=>i(new Ui(_t(e),s))))}onmouseleave(e,i){this._register(W(e,ke.MOUSE_LEAVE,s=>i(new Ui(_t(e),s))))}onkeydown(e,i){this._register(W(e,ke.KEY_DOWN,s=>i(new mn(s))))}onkeyup(e,i){this._register(W(e,ke.KEY_UP,s=>i(new mn(s))))}oninput(e,i){this._register(W(e,ke.INPUT,i))}onblur(e,i){this._register(W(e,ke.BLUR,i))}onfocus(e,i){this._register(W(e,ke.FOCUS,i))}onchange(e,i){this._register(W(e,ke.CHANGE,i))}ignoreGesture(e){return Lc.ignoreTarget(e)}},xn=11,Ec=class extends Vr{constructor(t){super(),this._onActivate=t.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=t.bgWidth+"px",this.bgDomNode.style.height=t.bgHeight+"px",typeof t.top<"u"&&(this.bgDomNode.style.top="0px"),typeof t.left<"u"&&(this.bgDomNode.style.left="0px"),typeof t.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof t.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=t.className,this.domNode.style.position="absolute",this.domNode.style.width=xn+"px",this.domNode.style.height=xn+"px",typeof t.top<"u"&&(this.domNode.style.top=t.top+"px"),typeof t.left<"u"&&(this.domNode.style.left=t.left+"px"),typeof t.bottom<"u"&&(this.domNode.style.bottom=t.bottom+"px"),typeof t.right<"u"&&(this.domNode.style.right=t.right+"px"),this._pointerMoveMonitor=this._register(new ma),this._register(yn(this.bgDomNode,ke.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(yn(this.domNode,ke.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new yc),this._pointerdownScheduleRepeatTimer=this._register(new Kr)}_arrowPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,_t(t))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),t.preventDefault()}},Rc=class cr{constructor(e,i,s,r,n,o,l){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,s=s|0,r=r|0,n=n|0,o=o|0,l=l|0),this.rawScrollLeft=r,this.rawScrollTop=l,i<0&&(i=0),r+i>s&&(r=s-i),r<0&&(r=0),n<0&&(n=0),l+n>o&&(l=o-n),l<0&&(l=0),this.width=i,this.scrollWidth=s,this.scrollLeft=r,this.height=n,this.scrollHeight=o,this.scrollTop=l}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,i){return new cr(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new cr(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,i){let s=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,n=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,l=this.scrollHeight!==e.scrollHeight,h=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:i,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:h}}},Mc=class extends Y{constructor(t){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new P),this.onScroll=this._onScroll.event,this._smoothScrollDuration=t.smoothScrollDuration,this._scheduleAtNextAnimationFrame=t.scheduleAtNextAnimationFrame,this._state=new Rc(t.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(t){this._smoothScrollDuration=t}validateScrollPosition(t){return this._state.withScrollPosition(t)}getScrollDimensions(){return this._state}setScrollDimensions(t,e){var s;let i=this._state.withScrollDimensions(t,e);this._setState(i,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(t){let e=this._state.withScrollPosition(t);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(e,!1)}setScrollPositionSmooth(t,e){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(t);if(this._smoothScrolling){t={scrollLeft:typeof t.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:t.scrollLeft,scrollTop:typeof t.scrollTop>"u"?this._smoothScrolling.to.scrollTop:t.scrollTop};let i=this._state.withScrollPosition(t);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let s;e?s=new Ln(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let i=this._state.withScrollPosition(t);this._smoothScrolling=Ln.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let t=this._smoothScrolling.tick(),e=this._state.withScrollPosition(t);if(this._setState(e,!0),!!this._smoothScrolling){if(t.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(t,e){let i=this._state;i.equals(t)||(this._state=t,this._onScroll.fire(this._state.createScrollEvent(i,e)))}},kn=class{constructor(e,i,s){this.scrollLeft=e,this.scrollTop=i,this.isDone=s}};function Ls(t,e){let i=e-t;return function(s){return t+i*Ac(s)}}function Bc(t,e,i){return function(s){return s<i?t(s/i):e((s-i)/(1-i))}}var Ln=class dr{constructor(e,i,s,r){this.from=e,this.to=i,this.duration=r,this.startTime=s,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,i,s){if(Math.abs(e-i)>2.5*s){let r,n;return e<i?(r=e+.75*s,n=i-.75*s):(r=e-.75*s,n=i+.75*s),Bc(Ls(e,r),Ls(n,i),.33)}return Ls(e,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let i=(e-this.startTime)/this.duration;if(i<1){let s=this.scrollLeft(i),r=this.scrollTop(i);return new kn(s,r,!1)}return new kn(this.to.scrollLeft,this.to.scrollTop,!0)}combine(e,i,s){return dr.start(e,i,s)}static start(e,i,s){s=s+10;let r=Date.now()-10;return new dr(e,i,r,s)}};function Tc(t){return Math.pow(t,3)}function Ac(t){return 1-Tc(1-t)}var Dc=class extends Y{constructor(e,i,s){super(),this._visibility=e,this._visibleClassName=i,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Kr)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var i;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(i=this._domNode)==null||i.setClassName(this._invisibleClassName+(e?" fade":"")))}},Pc=140,Sa=class extends Vr{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Dc(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ma),this._shouldRender=!0,this.domNode=Di(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(W(this.domNode.domNode,ke.POINTER_DOWN,i=>this._domNodePointerDown(i)))}_createArrow(e){let i=this._register(new Ec(e));this.domNode.domNode.appendChild(i.bgDomNode),this.domNode.domNode.appendChild(i.domNode)}_createSlider(e,i,s,r){this.slider=Di(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(i),typeof s=="number"&&this.slider.setWidth(s),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(W(this.slider.domNode,ke.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let i=this.domNode.domNode.getClientRects()[0].top,s=i+this._scrollbarState.getSliderPosition(),r=i+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);s<=n&&n<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let i,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")i=e.offsetX,s=e.offsetY;else{let n=Cc(this.domNode.domNode);i=e.pageX-n.left,s=e.pageY-n.top}let r=this._pointerDownRelativePosition(i,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=this._sliderPointerPosition(e),s=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{let o=this._sliderOrthogonalPointerPosition(n),l=Math.abs(o-s);if(fa&&l>Pc){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let h=this._sliderPointerPosition(n)-i;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(h))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let i={};this.writeScrollPosition(i,e),this._scrollable.setScrollPositionNow(i)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},wa=class ur{constructor(e,i,s,r,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new ur(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let i=Math.round(e);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(e){let i=Math.round(e);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(e){let i=Math.round(e);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,i,s,r,n){let o=Math.max(0,s-e),l=Math.max(0,o-2*i),h=r>0&&r>s;if(!h)return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let a=Math.round(Math.max(20,Math.floor(s*l/r))),c=(l-a)/(r-s),d=n*c;return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(a),computedSliderRatio:c,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let e=ur._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize,s=this._scrollPosition;return i<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+e;return Math.round(i/this._computedSliderRatio)}},Ic=class extends Sa{constructor(e,i,s){let r=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:s,scrollbarState:new wa(i.horizontalHasArrows?i.arrowSize:0,i.horizontal===2?0:i.horizontalScrollbarSize,i.vertical===2?0:i.verticalScrollbarSize,r.width,r.scrollWidth,n.scrollLeft),visibility:i.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:i.scrollByPage}),i.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((i.horizontalScrollbarSize-i.horizontalSliderSize)/2),0,void 0,i.horizontalSliderSize)}_updateSlider(e,i){this.slider.setWidth(e),this.slider.setLeft(i)}_renderDomNode(e,i){this.domNode.setWidth(e),this.domNode.setHeight(i),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,i){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,i){e.scrollLeft=i}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Oc=class extends Sa{constructor(t,e,i){let s=t.getScrollDimensions(),r=t.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:i,scrollbarState:new wa(e.verticalHasArrows?e.arrowSize:0,e.vertical===2?0:e.verticalScrollbarSize,0,s.height,s.scrollHeight,r.scrollTop),visibility:e.vertical,extraScrollbarClassName:"vertical",scrollable:t,scrollByPage:e.scrollByPage}),e.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((e.verticalScrollbarSize-e.verticalSliderSize)/2),e.verticalSliderSize,void 0)}_updateSlider(t,e){this.slider.setHeight(t),this.slider.setTop(e)}_renderDomNode(t,e){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(t){return this._shouldRender=this._onElementScrollSize(t.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(t.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(t.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(t,e){return e}_sliderPointerPosition(t){return t.pageY}_sliderOrthogonalPointerPosition(t){return t.pageX}_updateScrollbarSize(t){this.slider.setWidth(t)}writeScrollPosition(t,e){t.scrollTop=e}updateOptions(t){this.updateScrollbarSize(t.vertical===2?0:t.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(t.vertical),this._scrollByPage=t.scrollByPage}},Fc=500,En=50,$c=class{constructor(e,i,s){this.timestamp=e,this.deltaX=i,this.deltaY=s,this.score=0}},_r=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,i=0,s=1,r=this._rear;do{let n=r===this._front?e:Math.pow(2,-s);if(e-=n,i+=this._memory[r].score*n,r===this._front)break;r=(this._capacity+r-1)%this._capacity,s++}while(!0);return i<=.5}acceptStandardWheelEvent(e){if(Hr){let i=_t(e.browserEvent),s=Gh(i);this.accept(Date.now(),e.deltaX*s,e.deltaY*s)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,i,s){let r=null,n=new $c(e,i,s);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=n),n.score=this._computeScore(n,r)}_computeScore(e,i){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(s+=.25),i){let r=Math.abs(e.deltaX),n=Math.abs(e.deltaY),o=Math.abs(i.deltaX),l=Math.abs(i.deltaY),h=Math.max(Math.min(r,o),1),a=Math.max(Math.min(n,l),1),c=Math.max(r,o),d=Math.max(n,l);c%h===0&&d%a===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};_r.INSTANCE=new _r;var Nc=_r,Wc=class extends Vr{constructor(t,e,i){super(),this._onScroll=this._register(new P),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new P),this.onWillScroll=this._onWillScroll.event,this._options=Hc(e),this._scrollable=i,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let s={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Oc(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new Ic(this._scrollable,this._options,s)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(t),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Di(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Di(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Di(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new Kr),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=jt(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(t){this._verticalScrollbar.delegatePointerDown(t)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(t){this._scrollable.setScrollDimensions(t,!1)}updateClassName(t){this._options.className=t,ft&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(t){typeof t.handleMouseWheel<"u"&&(this._options.handleMouseWheel=t.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof t.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=t.mouseWheelScrollSensitivity),typeof t.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=t.fastScrollSensitivity),typeof t.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=t.scrollPredominantAxis),typeof t.horizontal<"u"&&(this._options.horizontal=t.horizontal),typeof t.vertical<"u"&&(this._options.vertical=t.vertical),typeof t.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=t.horizontalScrollbarSize),typeof t.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=t.verticalScrollbarSize),typeof t.scrollByPage<"u"&&(this._options.scrollByPage=t.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(t){this._revealOnScroll=t}delegateScrollFromMouseWheelEvent(t){this._onMouseWheel(new wn(t))}_setListeningToMouseWheel(t){if(this._mouseWheelToDispose.length>0!==t&&(this._mouseWheelToDispose=jt(this._mouseWheelToDispose),t)){let e=i=>{this._onMouseWheel(new wn(i))};this._mouseWheelToDispose.push(W(this._listenOnDomNode,ke.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(t){var r;if((r=t.browserEvent)!=null&&r.defaultPrevented)return;let e=Nc.INSTANCE;e.acceptStandardWheelEvent(t);let i=!1;if(t.deltaY||t.deltaX){let n=t.deltaY*this._options.mouseWheelScrollSensitivity,o=t.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+n===0?o=n=0:Math.abs(n)>=Math.abs(o)?o=0:n=0),this._options.flipAxes&&([n,o]=[o,n]);let l=!ft&&t.browserEvent&&t.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=n,n=0),t.browserEvent&&t.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,n=n*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),a={};if(n){let c=En*n,d=h.scrollTop-(c<0?Math.floor(c):Math.ceil(c));this._verticalScrollbar.writeScrollPosition(a,d)}if(o){let c=En*o,d=h.scrollLeft-(c<0?Math.floor(c):Math.ceil(c));this._horizontalScrollbar.writeScrollPosition(a,d)}a=this._scrollable.validateScrollPosition(a),(h.scrollLeft!==a.scrollLeft||h.scrollTop!==a.scrollTop)&&(this._options.mouseWheelSmoothScroll&&e.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),i=!0)}let s=i;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(t.preventDefault(),t.stopPropagation())}_onDidScroll(t){this._shouldRender=this._horizontalScrollbar.onDidScroll(t)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(t)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let t=this._scrollable.getCurrentScrollPosition(),e=t.scrollTop>0,i=t.scrollLeft>0,s=i?" left":"",r=e?" top":"",n=i||e?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${r}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(t){this._mouseIsOver=!1,this._hide()}_onMouseOver(t){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Fc)}},zc=class extends Wc{constructor(e,i,s){super(e,i,s)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Hc(t){let e={lazyRender:typeof t.lazyRender<"u"?t.lazyRender:!1,className:typeof t.className<"u"?t.className:"",useShadows:typeof t.useShadows<"u"?t.useShadows:!0,handleMouseWheel:typeof t.handleMouseWheel<"u"?t.handleMouseWheel:!0,flipAxes:typeof t.flipAxes<"u"?t.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof t.consumeMouseWheelIfScrollbarIsNeeded<"u"?t.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof t.alwaysConsumeMouseWheel<"u"?t.alwaysConsumeMouseWheel:!1,scrollYToX:typeof t.scrollYToX<"u"?t.scrollYToX:!1,mouseWheelScrollSensitivity:typeof t.mouseWheelScrollSensitivity<"u"?t.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof t.fastScrollSensitivity<"u"?t.fastScrollSensitivity:5,scrollPredominantAxis:typeof t.scrollPredominantAxis<"u"?t.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof t.mouseWheelSmoothScroll<"u"?t.mouseWheelSmoothScroll:!0,arrowSize:typeof t.arrowSize<"u"?t.arrowSize:11,listenOnDomNode:typeof t.listenOnDomNode<"u"?t.listenOnDomNode:null,horizontal:typeof t.horizontal<"u"?t.horizontal:1,horizontalScrollbarSize:typeof t.horizontalScrollbarSize<"u"?t.horizontalScrollbarSize:10,horizontalSliderSize:typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:0,horizontalHasArrows:typeof t.horizontalHasArrows<"u"?t.horizontalHasArrows:!1,vertical:typeof t.vertical<"u"?t.vertical:1,verticalScrollbarSize:typeof t.verticalScrollbarSize<"u"?t.verticalScrollbarSize:10,verticalHasArrows:typeof t.verticalHasArrows<"u"?t.verticalHasArrows:!1,verticalSliderSize:typeof t.verticalSliderSize<"u"?t.verticalSliderSize:0,scrollByPage:typeof t.scrollByPage<"u"?t.scrollByPage:!1};return e.horizontalSliderSize=typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof t.verticalSliderSize<"u"?t.verticalSliderSize:e.verticalScrollbarSize,ft&&(e.className+=" mac"),e}var fr=class extends Y{constructor(e,i,s,r,n,o,l,h){super(),this._bufferService=s,this._optionsService=l,this._renderService=h,this._onRequestScrollLines=this._register(new P),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new Mc({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>qr(r.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new zc(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},a)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Fe.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ne(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(ne(()=>this._styleElement.remove())),this._register(Fe.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
21
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(e){let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),s=i-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=i,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};fr=de([I(2,Ke),I(3,Lt),I(4,ea),I(5,ci),I(6,qe),I(7,Et)],fr);var gr=class extends Y{constructor(e,i,s,r,n){super(),this._screenElement=e,this._bufferService=i,this._coreBrowserService=s,this._decorationService=r,this._renderService=n,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(ne(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=e.options.x??0;return s&&s>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${i*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,i=e.element){if(!i)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?i.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=s?`${s*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var i;(i=this._decorationElements.get(e))==null||i.remove(),this._decorationElements.delete(e),e.dispose()}};gr=de([I(1,Ke),I(2,Lt),I(3,Ni),I(4,Et)],gr);var Uc=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let i of this._zones)if(i.color===e.options.overviewRulerOptions.color&&i.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(i,e.marker.line))return;if(this._lineAdjacentToZone(i,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(i,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,i){return i>=e.startBufferLine&&i<=e.endBufferLine}_lineAdjacentToZone(e,i,s){return i>=e.startBufferLine-this._linePadding[s||"full"]&&i<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,i){e.startBufferLine=Math.min(e.startBufferLine,i),e.endBufferLine=Math.max(e.endBufferLine,i)}},ht={full:0,left:0,center:0,right:0},Tt={full:0,left:0,center:0,right:0},fi={full:0,left:0,center:0,right:0},cs=class extends Y{constructor(e,i,s,r,n,o,l,h){var c;super(),this._viewportElement=e,this._screenElement=i,this._bufferService=s,this._decorationService=r,this._renderService=n,this._optionsService=o,this._themeService=l,this._coreBrowserService=h,this._colorZoneStore=new Uc,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(ne(()=>{var d;return(d=this._canvas)==null?void 0:d.remove()}));let a=this._canvas.getContext("2d");if(a)this._ctx=a;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),i=Math.ceil((this._canvas.width-1)/3);Tt.full=this._canvas.width,Tt.left=e,Tt.center=i,Tt.right=e,this._refreshDrawHeightConstants(),fi.full=1,fi.left=1,fi.center=1+Tt.left,fi.right=1+Tt.left+Tt.center}_refreshDrawHeightConstants(){ht.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,i=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);ht.left=i,ht.center=i,ht.right=i}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ht.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ht.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ht.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ht.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let i of this._decorationService.decorations)this._colorZoneStore.addDecoration(i);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)i.position!=="full"&&this._renderColorZone(i);for(let i of e)i.position==="full"&&this._renderColorZone(i);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(fi[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-ht[e.position||"full"]/2),Tt[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+ht[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};cs=de([I(2,Ke),I(3,Ni),I(4,Et),I(5,qe),I(6,ci),I(7,Lt)],cs);var B;(t=>(t.NUL="\0",t.SOH="",t.STX="",t.ETX="",t.EOT="",t.ENQ="",t.ACK="",t.BEL="\x07",t.BS="\b",t.HT=" ",t.LF=`
|
|
22
|
+
`,t.VT="\v",t.FF="\f",t.CR="\r",t.SO="",t.SI="",t.DLE="",t.DC1="",t.DC2="",t.DC3="",t.DC4="",t.NAK="",t.SYN="",t.ETB="",t.CAN="",t.EM="",t.SUB="",t.ESC="\x1B",t.FS="",t.GS="",t.RS="",t.US="",t.SP=" ",t.DEL=""))(B||(B={}));var is;(t=>(t.PAD="",t.HOP="",t.BPH="",t.NBH="",t.IND="",t.NEL="
",t.SSA="",t.ESA="",t.HTS="",t.HTJ="",t.VTS="",t.PLD="",t.PLU="",t.RI="",t.SS2="",t.SS3="",t.DCS="",t.PU1="",t.PU2="",t.STS="",t.CCH="",t.MW="",t.SPA="",t.EPA="",t.SOS="",t.SGCI="",t.SCI="",t.CSI="",t.ST="",t.OSC="",t.PM="",t.APC=""))(is||(is={}));var ba;(t=>t.ST=`${B.ESC}\\`)(ba||(ba={}));var pr=class{constructor(e,i,s,r,n,o){this._textarea=e,this._compositionView=i,this._bufferService=s,this._optionsService=r,this._coreService=n,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let s;i.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(i.start,this._compositionPosition.start):s=this._textarea.value.substring(i.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let i=this._textarea.value,s=i.replace(e,"");this._dataAlreadySent=s,i.length>e.length?this._coreService.triggerDataEvent(s,!0):i.length<e.length?this._coreService.triggerDataEvent(`${B.DEL}`,!0):i.length===e.length&&i!==e&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};pr=de([I(2,Ke),I(3,qe),I(4,Xt),I(5,Et)],pr);var Le=0,Ee=0,Re=0,he=0,Rn={css:"#00000000",rgba:0},me;(t=>{function e(r,n,o,l){return l!==void 0?`#${Nt(r)}${Nt(n)}${Nt(o)}${Nt(l)}`:`#${Nt(r)}${Nt(n)}${Nt(o)}`}t.toCss=e;function i(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}t.toRgba=i;function s(r,n,o,l){return{css:t.toCss(r,n,o,l),rgba:t.toRgba(r,n,o,l)}}t.toColor=s})(me||(me={}));var se;(t=>{function e(h,a){if(he=(a.rgba&255)/255,he===1)return{css:a.css,rgba:a.rgba};let c=a.rgba>>24&255,d=a.rgba>>16&255,u=a.rgba>>8&255,_=h.rgba>>24&255,f=h.rgba>>16&255,p=h.rgba>>8&255;Le=_+Math.round((c-_)*he),Ee=f+Math.round((d-f)*he),Re=p+Math.round((u-p)*he);let w=me.toCss(Le,Ee,Re),C=me.toRgba(Le,Ee,Re);return{css:w,rgba:C}}t.blend=e;function i(h){return(h.rgba&255)===255}t.isOpaque=i;function s(h,a,c){let d=ss.ensureContrastRatio(h.rgba,a.rgba,c);if(d)return me.toColor(d>>24&255,d>>16&255,d>>8&255)}t.ensureContrastRatio=s;function r(h){let a=(h.rgba|255)>>>0;return[Le,Ee,Re]=ss.toChannels(a),{css:me.toCss(Le,Ee,Re),rgba:a}}t.opaque=r;function n(h,a){return he=Math.round(a*255),[Le,Ee,Re]=ss.toChannels(h.rgba),{css:me.toCss(Le,Ee,Re,he),rgba:me.toRgba(Le,Ee,Re,he)}}t.opacity=n;function o(h,a){return he=h.rgba&255,n(h,he*a/255)}t.multiplyOpacity=o;function l(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}t.toColorRGB=l})(se||(se={}));var ae;(t=>{let e,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Le=parseInt(r.slice(1,2).repeat(2),16),Ee=parseInt(r.slice(2,3).repeat(2),16),Re=parseInt(r.slice(3,4).repeat(2),16),me.toColor(Le,Ee,Re);case 5:return Le=parseInt(r.slice(1,2).repeat(2),16),Ee=parseInt(r.slice(2,3).repeat(2),16),Re=parseInt(r.slice(3,4).repeat(2),16),he=parseInt(r.slice(4,5).repeat(2),16),me.toColor(Le,Ee,Re,he);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Le=parseInt(n[1]),Ee=parseInt(n[2]),Re=parseInt(n[3]),he=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),me.toColor(Le,Ee,Re,he);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Le,Ee,Re,he]=e.getImageData(0,0,1,1).data,he!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:me.toRgba(Le,Ee,Re,he),css:r}}t.toColor=s})(ae||(ae={}));var ze;(t=>{function e(s){return i(s>>16&255,s>>8&255,s&255)}t.relativeLuminance=e;function i(s,r,n){let o=s/255,l=r/255,h=n/255,a=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),d=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return a*.2126+c*.7152+d*.0722}t.relativeLuminance2=i})(ze||(ze={}));var ss;(t=>{function e(o,l){if(he=(l&255)/255,he===1)return l;let h=l>>24&255,a=l>>16&255,c=l>>8&255,d=o>>24&255,u=o>>16&255,_=o>>8&255;return Le=d+Math.round((h-d)*he),Ee=u+Math.round((a-u)*he),Re=_+Math.round((c-_)*he),me.toRgba(Le,Ee,Re)}t.blend=e;function i(o,l,h){let a=ze.relativeLuminance(o>>8),c=ze.relativeLuminance(l>>8);if(St(a,c)<h){if(c<a){let _=s(o,l,h),f=St(a,ze.relativeLuminance(_>>8));if(f<h){let p=r(o,l,h),w=St(a,ze.relativeLuminance(p>>8));return f>w?_:p}return _}let d=r(o,l,h),u=St(a,ze.relativeLuminance(d>>8));if(u<h){let _=s(o,l,h),f=St(a,ze.relativeLuminance(_>>8));return u>f?d:_}return d}}t.ensureContrastRatio=i;function s(o,l,h){let a=o>>24&255,c=o>>16&255,d=o>>8&255,u=l>>24&255,_=l>>16&255,f=l>>8&255,p=St(ze.relativeLuminance2(u,_,f),ze.relativeLuminance2(a,c,d));for(;p<h&&(u>0||_>0||f>0);)u-=Math.max(0,Math.ceil(u*.1)),_-=Math.max(0,Math.ceil(_*.1)),f-=Math.max(0,Math.ceil(f*.1)),p=St(ze.relativeLuminance2(u,_,f),ze.relativeLuminance2(a,c,d));return(u<<24|_<<16|f<<8|255)>>>0}t.reduceLuminance=s;function r(o,l,h){let a=o>>24&255,c=o>>16&255,d=o>>8&255,u=l>>24&255,_=l>>16&255,f=l>>8&255,p=St(ze.relativeLuminance2(u,_,f),ze.relativeLuminance2(a,c,d));for(;p<h&&(u<255||_<255||f<255);)u=Math.min(255,u+Math.ceil((255-u)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),p=St(ze.relativeLuminance2(u,_,f),ze.relativeLuminance2(a,c,d));return(u<<24|_<<16|f<<8|255)>>>0}t.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(ss||(ss={}));function Nt(t){let e=t.toString(16);return e.length<2?"0"+e:e}function St(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}var Kc=class extends $i{constructor(e,i,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ds=class{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new rt}register(t){let e={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(e),e.id}deregister(t){for(let e=0;e<this._characterJoiners.length;e++)if(this._characterJoiners[e].id===t)return this._characterJoiners.splice(e,1),!0;return!1}getJoinedCharacters(t){if(this._characterJoiners.length===0)return[];let e=this._bufferService.buffer.lines.get(t);if(!e||e.length===0)return[];let i=[],s=e.translateToString(!0),r=0,n=0,o=0,l=e.getFg(0),h=e.getBg(0);for(let a=0;a<e.getTrimmedLength();a++)if(e.loadCell(a,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==h){if(a-r>1){let c=this._getJoinedRanges(s,o,n,e,r);for(let d=0;d<c.length;d++)i.push(c[d])}r=a,o=n,l=this._workCell.fg,h=this._workCell.bg}n+=this._workCell.getChars().length||Ft.length}if(this._bufferService.cols-r>1){let a=this._getJoinedRanges(s,o,n,e,r);for(let c=0;c<a.length;c++)i.push(a[c])}return i}_getJoinedRanges(t,e,i,s,r){let n=t.substring(e,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let h=this._characterJoiners[l].handler(n);for(let a=0;a<h.length;a++)ds._mergeRanges(o,h[a])}catch(h){console.error(h)}return this._stringRangesToCellRanges(o,s,r),o}_stringRangesToCellRanges(t,e,i){let s=0,r=!1,n=0,o=t[s];if(o){for(let l=i;l<this._bufferService.cols;l++){let h=e.getWidth(l),a=e.getString(l).length||Ft.length;if(h!==0){if(!r&&o[0]<=n&&(o[0]=l,r=!0),o[1]<=n){if(o[1]=l,o=t[++s],!o)break;o[0]<=n?(o[0]=l,r=!0):r=!1}n+=a}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(t,e){let i=!1;for(let s=0;s<t.length;s++){let r=t[s];if(i){if(e[1]<=r[0])return t[s-1][1]=e[1],t;if(e[1]<=r[1])return t[s-1][1]=Math.max(e[1],r[1]),t.splice(s,1),t;t.splice(s,1),s--}else{if(e[1]<=r[0])return t.splice(s,0,e),t;if(e[1]<=r[1])return r[0]=Math.min(e[0],r[0]),t;e[0]<r[1]&&(r[0]=Math.min(e[0],r[0]),i=!0);continue}}return i?t[t.length-1][1]=e[1]:t.push(e),t}};ds=de([I(0,Ke)],ds);function qc(t){return 57508<=t&&t<=57558}function Vc(t){return 9472<=t&&t<=9631}function Yc(t){return qc(t)||Vc(t)}function jc(){return{css:{canvas:Ki(),cell:Ki()},device:{canvas:Ki(),cell:Ki(),char:{width:0,height:0,left:0,top:0}}}}function Ki(){return{width:0,height:0}}var vr=class{constructor(e,i,s,r,n,o,l){this._document=e,this._characterJoinerService=i,this._optionsService=s,this._coreBrowserService=r,this._coreService=n,this._decorationService=o,this._themeService=l,this._workCell=new rt,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,i,s){this._selectionStart=e,this._selectionEnd=i,this._columnSelectMode=s}createRow(e,i,s,r,n,o,l,h,a,c,d){let u=[],_=this._characterJoinerService.getJoinedCharacters(i),f=this._themeService.colors,p=e.getNoBgTrimmedLength();s&&p<o+1&&(p=o+1);let w,C=0,k="",L=0,g=0,E=0,T=0,O=!1,$=0,G=!1,X=0,N=0,m=[],v=c!==-1&&d!==-1;for(let S=0;S<p;S++){e.loadCell(S,this._workCell);let y=this._workCell.getWidth();if(y===0)continue;let b=!1,R=S>=N,A=S,M=this._workCell;if(_.length>0&&S===_[0][0]&&R){let j=_.shift(),_e=this._isCellInSelection(j[0],i);for(L=j[0]+1;L<j[1];L++)R&&(R=_e===this._isCellInSelection(L,i));R&&(R=!s||o<j[0]||o>=j[1]),R?(b=!0,M=new Kc(this._workCell,e.translateToString(!0,j[0],j[1]),j[1]-j[0]),A=j[1]-1,y=M.getWidth()):N=j[1]}let D=this._isCellInSelection(S,i),H=s&&S===o,Z=v&&S>=c&&S<=d,U=!1;this._decorationService.forEachDecorationAtCell(S,i,void 0,j=>{U=!0});let ue=M.getChars()||Ft;if(ue===" "&&(M.isUnderline()||M.isOverline())&&(ue=" "),X=y*h-a.get(ue,M.isBold(),M.isItalic()),!w)w=this._document.createElement("span");else if(C&&(D&&G||!D&&!G&&M.bg===g)&&(D&&G&&f.selectionForeground||M.fg===E)&&M.extended.ext===T&&Z===O&&X===$&&!H&&!b&&!U&&R){M.isInvisible()?k+=Ft:k+=ue,C++;continue}else C&&(w.textContent=k),w=this._document.createElement("span"),C=0,k="";if(g=M.bg,E=M.fg,T=M.extended.ext,O=Z,$=X,G=D,b&&o>=S&&o<=A&&(o=S),!this._coreService.isCursorHidden&&H&&this._coreService.isCursorInitialized){if(m.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&m.push("xterm-cursor-blink"),m.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":m.push("xterm-cursor-outline");break;case"block":m.push("xterm-cursor-block");break;case"bar":m.push("xterm-cursor-bar");break;case"underline":m.push("xterm-cursor-underline");break}}if(M.isBold()&&m.push("xterm-bold"),M.isItalic()&&m.push("xterm-italic"),M.isDim()&&m.push("xterm-dim"),M.isInvisible()?k=Ft:k=M.getChars()||Ft,M.isUnderline()&&(m.push(`xterm-underline-${M.extended.underlineStyle}`),k===" "&&(k=" "),!M.isUnderlineColorDefault()))if(M.isUnderlineColorRGB())w.style.textDecorationColor=`rgb(${$i.toColorRGB(M.getUnderlineColor()).join(",")})`;else{let j=M.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&M.isBold()&&j<8&&(j+=8),w.style.textDecorationColor=f.ansi[j].css}M.isOverline()&&(m.push("xterm-overline"),k===" "&&(k=" ")),M.isStrikethrough()&&m.push("xterm-strikethrough"),Z&&(w.style.textDecoration="underline");let K=M.getFgColor(),z=M.getFgColorMode(),F=M.getBgColor(),q=M.getBgColorMode(),Q=!!M.isInverse();if(Q){let j=K;K=F,F=j;let _e=z;z=q,q=_e}let Ce,Ve,Se=!1;this._decorationService.forEachDecorationAtCell(S,i,void 0,j=>{j.options.layer!=="top"&&Se||(j.backgroundColorRGB&&(q=50331648,F=j.backgroundColorRGB.rgba>>8&16777215,Ce=j.backgroundColorRGB),j.foregroundColorRGB&&(z=50331648,K=j.foregroundColorRGB.rgba>>8&16777215,Ve=j.foregroundColorRGB),Se=j.options.layer==="top")}),!Se&&D&&(Ce=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,F=Ce.rgba>>8&16777215,q=50331648,Se=!0,f.selectionForeground&&(z=50331648,K=f.selectionForeground.rgba>>8&16777215,Ve=f.selectionForeground)),Se&&m.push("xterm-decoration-top");let ge;switch(q){case 16777216:case 33554432:ge=f.ansi[F],m.push(`xterm-bg-${F}`);break;case 50331648:ge=me.toColor(F>>16,F>>8&255,F&255),this._addStyle(w,`background-color:#${Mn((F>>>0).toString(16),"0",6)}`);break;case 0:default:Q?(ge=f.foreground,m.push("xterm-bg-257")):ge=f.background}switch(Ce||M.isDim()&&(Ce=se.multiplyOpacity(ge,.5)),z){case 16777216:case 33554432:M.isBold()&&K<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(K+=8),this._applyMinimumContrast(w,ge,f.ansi[K],M,Ce,void 0)||m.push(`xterm-fg-${K}`);break;case 50331648:let j=me.toColor(K>>16&255,K>>8&255,K&255);this._applyMinimumContrast(w,ge,j,M,Ce,Ve)||this._addStyle(w,`color:#${Mn(K.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(w,ge,f.foreground,M,Ce,Ve)||Q&&m.push("xterm-fg-257")}m.length&&(w.className=m.join(" "),m.length=0),!H&&!b&&!U&&R?C++:w.textContent=k,X!==this.defaultSpacing&&(w.style.letterSpacing=`${X}px`),u.push(w),S=A}return w&&C&&(w.textContent=k),u}_applyMinimumContrast(e,i,s,r,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||Yc(r.getCode()))return!1;let l=this._getContrastCache(r),h;if(!n&&!o&&(h=l.getColor(i.rgba,s.rgba)),h===void 0){let a=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);h=se.ensureContrastRatio(n||i,o||s,a),l.setColor((n||i).rgba,(o||s).rgba,h??null)}return h?(this._addStyle(e,`color:${h.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,i){e.setAttribute("style",`${e.getAttribute("style")||""}${i};`)}_isCellInSelection(e,i){let s=this._selectionStart,r=this._selectionEnd;return!s||!r?!1:this._columnSelectMode?s[0]<=r[0]?e>=s[0]&&i>=s[1]&&e<r[0]&&i<=r[1]:e<s[0]&&i>=s[1]&&e>=r[0]&&i<=r[1]:i>s[1]&&i<r[1]||s[1]===r[1]&&i===s[1]&&e>=s[0]&&e<r[0]||s[1]<r[1]&&i===r[1]&&e<r[0]||s[1]<r[1]&&i===s[1]&&e>=s[0]}};vr=de([I(1,sa),I(2,qe),I(3,Lt),I(4,Xt),I(5,Ni),I(6,ci)],vr);function Mn(t,e,i){for(;t.length<i;)t=e+t;return t}var Gc=class{constructor(e,i){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let s=e.createElement("span");s.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[s,r,n,o],this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(o),i.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,i,s,r){e===this._font&&i===this._fontSize&&s===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=i,this._weight=s,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${s}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${s}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,i,s){let r=0;if(!i&&!s&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let l=this._measure(e,0);return l>0&&(this._flat[r]=l),l}let n=e;i&&(n+="B"),s&&(n+="I");let o=this._holey.get(n);if(o===void 0){let l=0;i&&(l|=1),s&&(l|=2),o=this._measure(e,l),o>0&&this._holey.set(n,o)}return o}_measure(e,i){let s=this._measureElements[i];return s.textContent=e.repeat(32),s.offsetWidth/32}},Xc=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(e,i,s,r=!1){if(this.selectionStart=i,this.selectionEnd=s,!i||!s||i[0]===s[0]&&i[1]===s[1]){this.clear();return}let n=e.buffers.active.ydisp,o=i[1]-n,l=s[1]-n,h=Math.max(o,0),a=Math.min(l,e.rows-1);if(h>=e.rows||a<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=o,this.viewportEndRow=l,this.viewportCappedStartRow=h,this.viewportCappedEndRow=a,this.startCol=i[0],this.endCol=s[0]}isCellSelected(e,i,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&s>=this.viewportCappedStartRow&&i<this.endCol&&s<=this.viewportCappedEndRow:i<this.startCol&&s>=this.viewportCappedStartRow&&i>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&i>=this.startCol&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&i>=this.startCol):!1}};function Zc(){return new Xc}var Es="xterm-dom-renderer-owner-",Je="xterm-rows",qi="xterm-fg-",Bn="xterm-bg-",gi="xterm-focus",Vi="xterm-selection",Jc=1,mr=class extends Y{constructor(e,i,s,r,n,o,l,h,a,c,d,u,_,f){super(),this._terminal=e,this._document=i,this._element=s,this._screenElement=r,this._viewportElement=n,this._helperContainer=o,this._linkifier2=l,this._charSizeService=a,this._optionsService=c,this._bufferService=d,this._coreService=u,this._coreBrowserService=_,this._themeService=f,this._terminalClass=Jc++,this._rowElements=[],this._selectionRenderModel=Zc(),this.onRequestRedraw=this._register(new P).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Je),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(Vi),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=jc(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(p=>this._injectCss(p))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(vr,document),this._element.classList.add(Es+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(p=>this._handleLinkHover(p))),this._register(this._linkifier2.onHideLinkUnderline(p=>this._handleLinkLeave(p))),this._register(ne(()=>{this._element.classList.remove(Es+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Gc(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${Je} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let i=`${this._terminalSelector} .${Je} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;i+=`${this._terminalSelector} .${Je} .xterm-dim { color: ${se.multiplyOpacity(e.foreground,.5).css};}`,i+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let s=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;i+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,i+=`@keyframes ${r} { 50% { box-shadow: none; }}`,i+=`@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,i+=`${this._terminalSelector} .${Je}.${gi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Je}.${gi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Je}.${gi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Je} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Je} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Je} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Je} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Je} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,i+=`${this._terminalSelector} .${Vi} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Vi} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Vi} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,l]of e.ansi.entries())i+=`${this._terminalSelector} .${qi}${o} { color: ${l.css}; }${this._terminalSelector} .${qi}${o}.xterm-dim { color: ${se.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${Bn}${o} { background-color: ${l.css}; }`;i+=`${this._terminalSelector} .${qi}257 { color: ${se.opaque(e.background).css}; }${this._terminalSelector} .${qi}257.xterm-dim { color: ${se.multiplyOpacity(se.opaque(e.background),.5).css}; }${this._terminalSelector} .${Bn}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,i){for(let s=this._rowElements.length;s<=i;s++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(gi),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(gi),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,s),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,s),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(s){let a=e[0]>i[0];h.appendChild(this._createSelectionElement(o,a?i[0]:e[0],a?e[0]:i[0],l-o+1))}else{let a=r===o?e[0]:0,c=o===n?i[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(o,a,c));let d=l-o-1;if(h.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,d)),o!==l){let u=n===l?i[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(l,0,u))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,i,s,r=1){let n=this._document.createElement("div"),o=i*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(s-i);return o+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-o),n.style.height=`${r*this.dimensions.css.cell.height}px`,n.style.top=`${e*this.dimensions.css.cell.height}px`,n.style.left=`${o}px`,n.style.width=`${l}px`,n}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,i){let s=this._bufferService.buffer,r=s.ybase+s.y,n=Math.min(s.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let a=e;a<=i;a++){let c=a+s.ydisp,d=this._rowElements[a],u=s.lines.get(c);if(!d||!u)break;d.replaceChildren(...this._rowFactory.createRow(u,c,c===r,l,h,n,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Es}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,i,s,r,n,o){s<0&&(e=0),r<0&&(i=0);let l=this._bufferService.rows-1;s=Math.max(Math.min(s,l),0),r=Math.max(Math.min(r,l),0),n=Math.min(n,this._bufferService.cols);let h=this._bufferService.buffer,a=h.ybase+h.y,c=Math.min(h.x,n-1),d=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,_=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=s;f<=r;++f){let p=f+h.ydisp,w=this._rowElements[f],C=h.lines.get(p);if(!w||!C)break;w.replaceChildren(...this._rowFactory.createRow(C,p,p===a,u,_,c,d,this.dimensions.css.cell.width,this._widthCache,o?f===s?e:0:-1,o?(f===r?i:n)-1:-1))}}};mr=de([I(7,Nr),I(8,vs),I(9,qe),I(10,Ke),I(11,Xt),I(12,Lt),I(13,ci)],mr);var Sr=class extends Y{constructor(e,i,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new P),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new ed(this._optionsService))}catch{this._measureStrategy=this._register(new Qc(e,i,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Sr=de([I(2,qe)],Sr);var ya=class extends Y{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,e){t!==void 0&&t>0&&e!==void 0&&e>0&&(this._result.width=t,this._result.height=e)}},Qc=class extends ya{constructor(t,e,i){super(),this._document=t,this._parentElement=e,this._optionsService=i,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},ed=class extends ya{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},td=class extends Y{constructor(e,i,s){super(),this._textarea=e,this._window=i,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new id(this._window)),this._onDprChange=this._register(new P),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new P),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Fe.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(W(this._textarea,"focus",()=>this._isFocused=!0)),this._register(W(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},id=class extends Y{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new hi),this._onDprChange=this._register(new P),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ne(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=W(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},sd=class extends Y{constructor(){super(),this.linkProviders=[],this._register(ne(()=>this.linkProviders.length=0))}registerLinkProvider(t){return this.linkProviders.push(t),{dispose:()=>{let e=this.linkProviders.indexOf(t);e!==-1&&this.linkProviders.splice(e,1)}}}};function Yr(t,e,i){let s=i.getBoundingClientRect(),r=t.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[e.clientX-s.left-n,e.clientY-s.top-o]}function rd(t,e,i,s,r,n,o,l,h){if(!n)return;let a=Yr(t,e,i);if(a)return a[0]=Math.ceil((a[0]+(h?o/2:0))/o),a[1]=Math.ceil(a[1]/l),a[0]=Math.min(Math.max(a[0],1),s+(h?1:0)),a[1]=Math.min(Math.max(a[1],1),r),a}var wr=class{constructor(e,i){this._renderService=e,this._charSizeService=i}getCoords(e,i,s,r,n){return rd(window,e,i,s,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,i){let s=Yr(window,e,i);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};wr=de([I(0,Et),I(1,vs)],wr);var nd=class{constructor(e,i){this._renderCallback=e,this._coreBrowserService=i,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,i,s){this._rowCount=s,e=e!==void 0?e:0,i=i!==void 0?i:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,i):i,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Ca={};gh(Ca,{getSafariVersion:()=>ad,isChromeOS:()=>Ea,isFirefox:()=>xa,isIpad:()=>ld,isIphone:()=>hd,isLegacyEdge:()=>od,isLinux:()=>jr,isMac:()=>us,isNode:()=>ms,isSafari:()=>ka,isWindows:()=>La});var ms=typeof process<"u"&&"title"in process,Wi=ms?"node":navigator.userAgent,zi=ms?"node":navigator.platform,xa=Wi.includes("Firefox"),od=Wi.includes("Edge"),ka=/^((?!chrome|android).)*safari/i.test(Wi);function ad(){if(!ka)return 0;let t=Wi.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}var us=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(zi),ld=zi==="iPad",hd=zi==="iPhone",La=["Windows","Win16","Win32","WinCE"].includes(zi),jr=zi.indexOf("Linux")>=0,Ea=/\bCrOS\b/.test(Wi),Ra=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),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(t){this._idleCallback=void 0;let e=0,i=0,s=t.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),i=Math.max(e,i),r=t.timeRemaining(),i*1.5>r){s-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-e))}ms`),this._start();return}s=r}this.clear()}},cd=class extends Ra{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let i=performance.now()+e;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},dd=class extends Ra{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},_s=!ms&&"requestIdleCallback"in window?dd:cd,ud=class{constructor(){this._queue=new _s}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}},br=class extends Y{constructor(e,i,s,r,n,o,l,h,a){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=r,this._coreService=n,this._coreBrowserService=h,this._renderer=this._register(new hi),this._pausedResizeTask=new ud,this._observerDisposable=this._register(new hi),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new P),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new P),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new P),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new P),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new nd((c,d)=>this._renderRows(c,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new _d(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ne(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(a.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});s.observe(i),this._observerDisposable.value=ne(()=>s.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,i,s=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),i=Math.max(i,r.end)),s||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(i=>this.refreshRows(i.start,i.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,i;this._renderer.value&&((i=(e=this._renderer.value).clearTextureAtlas)==null||i.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var s;return(s=this._renderer.value)==null?void 0:s.handleResize(e,i)}):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,i,s){var r;this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=s,(r=this._renderer.value)==null||r.handleSelectionChanged(e,i,s)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};br=de([I(2,qe),I(3,vs),I(4,Xt),I(5,Ni),I(6,Ke),I(7,Lt),I(8,ci)],br);var _d=class{constructor(t,e,i){this._coreBrowserService=t,this._coreService=e,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(t,e){this._isBuffering?(this._start=Math.min(this._start,t),this._end=Math.max(this._end,e)):(this._start=t,this._end=e,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let t={start:this._start,end:this._end};return this._isBuffering=!1,t}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function fd(t,e,i,s){let r=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return vd(r,n,t,e,i,s)+Ss(n,e,i,s)+md(r,n,t,e,i,s);let o;if(n===e)return o=r>t?"D":"C",Ii(Math.abs(r-t),Pi(o,s));o=n>e?"D":"C";let l=Math.abs(n-e),h=pd(n>e?t:r,i)+(l-1)*i.cols+1+gd(n>e?r:t);return Ii(h,Pi(o,s))}function gd(t,e){return t-1}function pd(t,e){return e.cols-t}function vd(t,e,i,s,r,n){return Ss(e,s,r,n).length===0?"":Ii(Ba(t,e,t,e-Gt(e,r),!1,r).length,Pi("D",n))}function Ss(t,e,i,s){let r=t-Gt(t,i),n=e-Gt(e,i),o=Math.abs(r-n)-Sd(t,e,i);return Ii(o,Pi(Ma(t,e),s))}function md(t,e,i,s,r,n){let o;Ss(e,s,r,n).length>0?o=s-Gt(s,r):o=e;let l=s,h=wd(t,e,i,s,r,n);return Ii(Ba(t,o,i,l,h==="C",r).length,Pi(h,n))}function Sd(t,e,i){var o;let s=0,r=t-Gt(t,i),n=e-Gt(e,i);for(let l=0;l<Math.abs(r-n);l++){let h=Ma(t,e)==="A"?-1:1;(o=i.buffer.lines.get(r+h*l))!=null&&o.isWrapped&&s++}return s}function Gt(t,e){let i=0,s=e.buffer.lines.get(t),r=s==null?void 0:s.isWrapped;for(;r&&t>=0&&t<e.rows;)i++,s=e.buffer.lines.get(--t),r=s==null?void 0:s.isWrapped;return i}function wd(t,e,i,s,r,n){let o;return Ss(i,s,r,n).length>0?o=s-Gt(s,r):o=e,t<i&&o<=s||t>=i&&o<s?"C":"D"}function Ma(t,e){return t>e?"A":"B"}function Ba(t,e,i,s,r,n){let o=t,l=e,h="";for(;(o!==i||l!==s)&&l>=0&&l<n.buffer.lines.length;)o+=r?1:-1,r&&o>n.cols-1?(h+=n.buffer.translateBufferLineToString(l,!1,t,o),o=0,t=0,l++):!r&&o<0&&(h+=n.buffer.translateBufferLineToString(l,!1,0,t+1),o=n.cols-1,t=o,l--);return h+n.buffer.translateBufferLineToString(l,!1,t,o)}function Pi(t,e){let i=e?"O":"[";return B.ESC+i+t}function Ii(t,e){t=Math.floor(t);let i="";for(let s=0;s<t;s++)i+=e;return i}var bd=class{constructor(t){this._bufferService=t,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,e=this.selectionEnd;return!t||!e?!1:t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Tn(t,e){if(t.start.y>t.end.y)throw new Error(`Buffer range end (${t.end.x}, ${t.end.y}) cannot be before start (${t.start.x}, ${t.start.y})`);return e*(t.end.y-t.start.y)+(t.end.x-t.start.x+1)}var Rs=50,yd=15,Cd=50,xd=500,kd=" ",Ld=new RegExp(kd,"g"),yr=class extends Y{constructor(e,i,s,r,n,o,l,h,a){super(),this._element=e,this._screenElement=i,this._linkifier=s,this._bufferService=r,this._coreService=n,this._mouseService=o,this._optionsService=l,this._renderService=h,this._coreBrowserService=a,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new rt,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new P),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new P),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new P),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new P),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new bd(this._bufferService),this._activeSelectionMode=0,this._register(ne(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!e||!i?!1:e[0]!==i[0]||e[1]!==i[1]}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let s=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===i[0])return"";let n=e[0]<i[0]?e[0]:i[0],o=e[0]<i[0]?i[0]:e[0];for(let l=e[1];l<=i[1];l++){let h=s.translateBufferLineToString(l,!0,n,o);r.push(h)}}else{let n=e[1]===i[1]?i[0]:void 0;r.push(s.translateBufferLineToString(e[1],!0,e[0],n));for(let o=e[1]+1;o<=i[1]-1;o++){let l=s.lines.get(o),h=s.translateBufferLineToString(o,!0);l!=null&&l.isWrapped?r[r.length-1]+=h:r.push(h)}if(e[1]!==i[1]){let o=s.lines.get(i[1]),l=s.translateBufferLineToString(i[1],!0,0,i[0]);o&&o.isWrapped?r[r.length-1]+=l:r.push(l)}}return r.map(n=>n.replace(Ld," ")).join(La?`\r
|
|
23
23
|
`:`
|
|
24
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),qr&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let i=this._getMouseBufferCoords(e),s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r||!i?!1:this._areCoordsInSelection(i,s,r)}isCellInSelection(e,i){let s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r?!1:this._areCoordsInSelection([e,i],s,r)}_areCoordsInSelection(e,i,s){return e[1]>i[1]&&e[1]<s[1]||i[1]===s[1]&&e[1]===i[1]&&e[0]>=i[0]&&e[0]<s[0]||i[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||i[1]<s[1]&&e[1]===i[1]&&e[0]>=i[0]}_selectWordAtCursor(e,i){var n,o;let s=(o=(n=this._linkifier.currentLink)==null?void 0:n.link)==null?void 0:o.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=Ln(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,i),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=Kr(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=s?0:(i>s&&(i-=s),i=Math.min(Math.max(i,-Es),Es),i/=Es,i/Math.abs(i)+Math.round(i*(ld-1)))}shouldForceSelection(e){return ds?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),hd)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&i.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(ds&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let r=s.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!i||i[0]!==this._model.selectionEnd[0]||i[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&i<cd&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let s=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(s&&s[0]!==void 0&&s[1]!==void 0){let r=ed(s[0]-1,s[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd,s=!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,i,s);return}!e||!i||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||i[0]!==this._oldSelectionEnd[0]||i[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,i,s)}_fireOnSelectionChange(e,i,s){this._oldSelectionStart=e,this._oldSelectionEnd=i,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(i=>this._handleTrim(i))}_convertViewportColToCharacterIndex(e,i){let s=i;for(let r=0;i>=r;r++){let n=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:n>1&&i!==r&&(s+=n-1)}return s}setSelection(e,i,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,s=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,o=n.lines.get(e[1]);if(!o)return;let l=n.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(o,e[0]),a=h,c=e[0]-h,d=0,u=0,_=0,f=0;if(l.charAt(h)===" "){for(;h>0&&l.charAt(h-1)===" ";)h--;for(;a<l.length&&l.charAt(a+1)===" ";)a++}else{let y=e[0],C=e[0];o.getWidth(y)===0&&(d++,y--),o.getWidth(C)===2&&(u++,C++);let L=o.getString(C).length;for(L>1&&(f+=L-1,a+=L-1);y>0&&h>0&&!this._isCharWordSeparator(o.loadCell(y-1,this._workCell));){o.loadCell(y-1,this._workCell);let g=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,y--):g>1&&(_+=g-1,h-=g-1),h--,y--}for(;C<o.length&&a+1<l.length&&!this._isCharWordSeparator(o.loadCell(C+1,this._workCell));){o.loadCell(C+1,this._workCell);let g=this._workCell.getChars().length;this._workCell.getWidth()===2?(u++,C++):g>1&&(f+=g-1,a+=g-1),a++,C++}}a++;let v=h+c-d+_,b=Math.min(this._bufferService.cols,a-h+d+u-_-f);if(!(!i&&l.slice(h,a).trim()==="")){if(s&&v===0&&o.getCodePoint(0)!==32){let y=n.lines.get(e[1]-1);if(y&&o.isWrapped&&y.getCodePoint(this._bufferService.cols-1)!==32){let C=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(C){let L=this._bufferService.cols-C.start;v-=L,b+=L}}}if(r&&v+b===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let y=n.lines.get(e[1]+1);if(y!=null&&y.isWrapped&&y.getCodePoint(0)!==32){let C=this._getWordAt([0,e[1]+1],!1,!1,!0);C&&(b+=C.length)}}return{start:v,length:b}}}_selectWordAt(e,i){let s=this._getWordAt(e,i);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let s=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),s={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Ln(s,this._bufferService.cols)}};Sr=ue([O(3,Ke),O(4,Xt),O(5,Fr),O(6,qe),O(7,Et),O(8,Lt)],Sr);var En=class{constructor(){this._data={}}set(e,i,s){this._data[e]||(this._data[e]={}),this._data[e][i]=s}get(e,i){return this._data[e]?this._data[e][i]:void 0}clear(){this._data={}}},Rn=class{constructor(){this._color=new En,this._css=new En}setCss(e,i,s){this._css.set(e,i,s)}getCss(e,i){return this._css.get(e,i)}setColor(e,i,s){this._color.set(e,i,s)}getColor(e,i){return this._color.get(e,i)}clear(){this._color.clear(),this._css.clear()}},Se=Object.freeze((()=>{let t=[le.toColor("#2e3436"),le.toColor("#cc0000"),le.toColor("#4e9a06"),le.toColor("#c4a000"),le.toColor("#3465a4"),le.toColor("#75507b"),le.toColor("#06989a"),le.toColor("#d3d7cf"),le.toColor("#555753"),le.toColor("#ef2929"),le.toColor("#8ae234"),le.toColor("#fce94f"),le.toColor("#729fcf"),le.toColor("#ad7fa8"),le.toColor("#34e2e2"),le.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let i=0;i<216;i++){let s=e[i/36%6|0],r=e[i/6%6|0],n=e[i%6];t.push({css:ve.toCss(s,r,n),rgba:ve.toRgba(s,r,n)})}for(let i=0;i<24;i++){let s=8+i*10;t.push({css:ve.toCss(s,s,s),rgba:ve.toRgba(s,s,s)})}return t})()),zt=le.toColor("#ffffff"),ki=le.toColor("#000000"),Mn=le.toColor("#ffffff"),Bn=ki,pi={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},_d=zt,wr=class extends K{constructor(e){super(),this._optionsService=e,this._contrastCache=new Rn,this._halfContrastCache=new Rn,this._onChangeColors=this._register(new P),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:zt,background:ki,cursor:Mn,cursorAccent:Bn,selectionForeground:void 0,selectionBackgroundTransparent:pi,selectionBackgroundOpaque:re.blend(ki,pi),selectionInactiveBackgroundTransparent:pi,selectionInactiveBackgroundOpaque:re.blend(ki,pi),scrollbarSliderBackground:re.opacity(zt,.2),scrollbarSliderHoverBackground:re.opacity(zt,.4),scrollbarSliderActiveBackground:re.opacity(zt,.5),overviewRulerBorder:zt,ansi:Se.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let i=this._colors;if(i.foreground=ie(e.foreground,zt),i.background=ie(e.background,ki),i.cursor=re.blend(i.background,ie(e.cursor,Mn)),i.cursorAccent=re.blend(i.background,ie(e.cursorAccent,Bn)),i.selectionBackgroundTransparent=ie(e.selectionBackground,pi),i.selectionBackgroundOpaque=re.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=ie(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=re.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?ie(e.selectionForeground,Cn):void 0,i.selectionForeground===Cn&&(i.selectionForeground=void 0),re.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=re.opacity(i.selectionBackgroundTransparent,.3)),re.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=re.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=ie(e.scrollbarSliderBackground,re.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=ie(e.scrollbarSliderHoverBackground,re.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=ie(e.scrollbarSliderActiveBackground,re.opacity(i.foreground,.5)),i.overviewRulerBorder=ie(e.overviewRulerBorder,_d),i.ansi=Se.slice(),i.ansi[0]=ie(e.black,Se[0]),i.ansi[1]=ie(e.red,Se[1]),i.ansi[2]=ie(e.green,Se[2]),i.ansi[3]=ie(e.yellow,Se[3]),i.ansi[4]=ie(e.blue,Se[4]),i.ansi[5]=ie(e.magenta,Se[5]),i.ansi[6]=ie(e.cyan,Se[6]),i.ansi[7]=ie(e.white,Se[7]),i.ansi[8]=ie(e.brightBlack,Se[8]),i.ansi[9]=ie(e.brightRed,Se[9]),i.ansi[10]=ie(e.brightGreen,Se[10]),i.ansi[11]=ie(e.brightYellow,Se[11]),i.ansi[12]=ie(e.brightBlue,Se[12]),i.ansi[13]=ie(e.brightMagenta,Se[13]),i.ansi[14]=ie(e.brightCyan,Se[14]),i.ansi[15]=ie(e.brightWhite,Se[15]),e.extendedAnsi){let s=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<s;r++)i.ansi[r+16]=ie(e.extendedAnsi[r],Se[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let i=0;i<this._restoreColors.ansi.length;++i)this._colors.ansi[i]=this._restoreColors.ansi[i];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};wr=ue([O(0,qe)],wr);function ie(t,e){if(t!==void 0)try{return le.toColor(t)}catch{}return e}var fd=class{constructor(...e){this._entries=new Map;for(let[i,s]of e)this.set(i,s)}set(e,i){let s=this._entries.get(e);return this._entries.set(e,i),s}forEach(e){for(let[i,s]of this._entries.entries())e(i,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},gd=class{constructor(){this._services=new fd,this._services.set(Ir,this)}setService(t,e){this._services.set(t,e)}getService(t){return this._services.get(t)}createInstance(t,...e){let i=lh(t).sort((n,o)=>n.index-o.index),s=[];for(let n of i){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${n.id._id}.`);s.push(o)}let r=i.length>0?i[0].index:e.length;if(e.length!==r)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${r+1} conflicts with ${e.length} static arguments`);return new t(...e,...s)}},pd={trace:0,debug:1,info:2,warn:3,error:4,off:5},vd="xterm.js: ",br=class extends K{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=pd[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)typeof e[i]=="function"&&(e[i]=e[i]())}_log(e,i,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":vd)+i,...s)}trace(e,...i){var s;this._logLevel<=0&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,e,i)}debug(e,...i){var s;this._logLevel<=1&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,e,i)}info(e,...i){var s;this._logLevel<=2&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.info.bind(this._optionsService.options.logger))??console.info,e,i)}warn(e,...i){var s;this._logLevel<=3&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,e,i)}error(e,...i){var s;this._logLevel<=4&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.error.bind(this._optionsService.options.logger))??console.error,e,i)}};br=ue([O(0,qe)],br);var Tn=class extends K{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new P),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new P),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new P),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let i=new Array(e);for(let s=0;s<Math.min(e,this.length);s++)i[s]=this._array[this._getCyclicIndex(s)];this._array=i,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let i=this._length;i<e;i++)this._array[i]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,i){this._array[this._getCyclicIndex(e)]=i}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,i,...s){if(i){for(let r=e;r<this._length-i;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+i)];this._length-=i,this.onDeleteEmitter.fire({index:e,amount:i})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+s.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<s.length;r++)this._array[this._getCyclicIndex(e+r)]=s[r];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let r=this._length+s.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,s){if(!(i<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let n=i-1;n>=0;n--)this.set(e+n+s,this.get(e+n));let r=e+i+s-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<i;r++)this.set(e+r+s,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},U=3,ge=Object.freeze(new Fi),Vi=0,Rs=2,Li=class ya{constructor(e,i,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*U);let r=i||rt.fromCharData([0,zo,1,0]);for(let n=0;n<e;++n)this.setCell(n,r);this.length=e}get(e){let i=this._data[e*U+0],s=i&2097151;return[this._data[e*U+1],i&2097152?this._combined[e]:s?It(s):"",i>>22,i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):s]}set(e,i){this._data[e*U+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[e*U+0]=e|2097152|i[2]<<22):this._data[e*U+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[e*U+0]>>22}hasWidth(e){return this._data[e*U+0]&12582912}getFg(e){return this._data[e*U+1]}getBg(e){return this._data[e*U+2]}hasContent(e){return this._data[e*U+0]&4194303}getCodePoint(e){let i=this._data[e*U+0];return i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):i&2097151}isCombined(e){return this._data[e*U+0]&2097152}getString(e){let i=this._data[e*U+0];return i&2097152?this._combined[e]:i&2097151?It(i&2097151):""}isProtected(e){return this._data[e*U+2]&536870912}loadCell(e,i){return Vi=e*U,i.content=this._data[Vi+0],i.fg=this._data[Vi+1],i.bg=this._data[Vi+2],i.content&2097152&&(i.combinedData=this._combined[e]),i.bg&268435456&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){i.content&2097152&&(this._combined[e]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[e]=i.extended),this._data[e*U+0]=i.content,this._data[e*U+1]=i.fg,this._data[e*U+2]=i.bg}setCellFromCodepoint(e,i,s,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*U+0]=i|s<<22,this._data[e*U+1]=r.fg,this._data[e*U+2]=r.bg}addCodepointToCell(e,i,s){let r=this._data[e*U+0];r&2097152?this._combined[e]+=It(i):r&2097151?(this._combined[e]=It(r&2097151)+It(i),r&=-2097152,r|=2097152):r=i|1<<22,s&&(r&=-12582913,r|=s<<22),this._data[e*U+0]=r}insertCells(e,i,s){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),i<this.length-e){let r=new rt;for(let n=this.length-e-i-1;n>=0;--n)this.setCell(e+i+n,this.loadCell(e+n,r));for(let n=0;n<i;++n)this.setCell(e+n,s)}else for(let r=e;r<this.length;++r)this.setCell(r,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(e,i,s){if(e%=this.length,i<this.length-e){let r=new rt;for(let n=0;n<this.length-e-i;++n)this.setCell(e+n,this.loadCell(e+i+n,r));for(let n=this.length-i;n<this.length;++n)this.setCell(n,s)}else for(let r=e;r<this.length;++r)this.setCell(r,s);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,s)}replaceCells(e,i,s,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,s);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,s),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,s);e<i&&e<this.length;)this.setCell(e++,s)}resize(e,i){if(e===this.length)return this._data.length*4*Rs<this._data.buffer.byteLength;let s=e*U;if(e>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r<e;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,s);let r=Object.keys(this._combined);for(let o=0;o<r.length;o++){let l=parseInt(r[o],10);l>=e&&delete this._combined[l]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let l=parseInt(n[o],10);l>=e&&delete this._extendedAttrs[l]}}return this.length=e,s*4*Rs<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Rs<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,e);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,e)}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let i in e._combined)this._combined[i]=e._combined[i];this._extendedAttrs={};for(let i in e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){let e=new ya(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let i in this._combined)e._combined[i]=this._combined[i];for(let i in this._extendedAttrs)e._extendedAttrs[i]=this._extendedAttrs[i];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*U+0]&4194303)return e+(this._data[e*U+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*U+0]&4194303||this._data[e*U+2]&50331648)return e+(this._data[e*U+0]>>22);return 0}copyCellsFrom(e,i,s,r,n){let o=e._data;if(n)for(let h=r-1;h>=0;h--){for(let a=0;a<U;a++)this._data[(s+h)*U+a]=o[(i+h)*U+a];o[(i+h)*U+2]&268435456&&(this._extendedAttrs[s+h]=e._extendedAttrs[i+h])}else for(let h=0;h<r;h++){for(let a=0;a<U;a++)this._data[(s+h)*U+a]=o[(i+h)*U+a];o[(i+h)*U+2]&268435456&&(this._extendedAttrs[s+h]=e._extendedAttrs[i+h])}let l=Object.keys(e._combined);for(let h=0;h<l.length;h++){let a=parseInt(l[h],10);a>=i&&(this._combined[a-i+s]=e._combined[a])}}translateToString(e,i,s,r){i=i??0,s=s??this.length,e&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;i<s;){let o=this._data[i*U+0],l=o&2097151,h=o&2097152?this._combined[i]:l?It(l):Ft;if(n+=h,r)for(let a=0;a<h.length;++a)r.push(i);i+=o>>22||1}return r&&r.push(i),n}};function md(t,e,i,s,r,n){let o=[];for(let l=0;l<t.length-1;l++){let h=l,a=t.get(++h);if(!a.isWrapped)continue;let c=[t.get(l)];for(;h<t.length&&a.isWrapped;)c.push(a),a=t.get(++h);if(!n&&s>=l&&s<h){l+=c.length-1;continue}let d=0,u=Oi(c,d,e),_=1,f=0;for(;_<c.length;){let b=Oi(c,_,e),y=b-f,C=i-u,L=Math.min(y,C);c[d].copyCellsFrom(c[_],f,u,L,!1),u+=L,u===i&&(d++,u=0),f+=L,f===b&&(_++,f=0),u===0&&d!==0&&c[d-1].getWidth(i-1)===2&&(c[d].copyCellsFrom(c[d-1],i-1,u++,1,!1),c[d-1].setCell(i-1,r))}c[d].replaceCells(u,i,r);let v=0;for(let b=c.length-1;b>0&&(b>d||c[b].getTrimmedLength()===0);b--)v++;v>0&&(o.push(l+c.length-v),o.push(v)),l+=c.length-1}return o}function Sd(t,e){let i=[],s=0,r=e[s],n=0;for(let o=0;o<t.length;o++)if(r===o){let l=e[++s];t.onDeleteEmitter.fire({index:o-n,amount:l}),o+=l-1,n+=l,r=e[++s]}else i.push(o);return{layout:i,countRemoved:n}}function wd(t,e){let i=[];for(let s=0;s<e.length;s++)i.push(t.get(e[s]));for(let s=0;s<i.length;s++)t.set(s,i[s]);t.length=e.length}function bd(t,e,i){let s=[],r=t.map((h,a)=>Oi(t,a,e)).reduce((h,a)=>h+a),n=0,o=0,l=0;for(;l<r;){if(r-l<i){s.push(r-l);break}n+=i;let h=Oi(t,o,e);n>h&&(n-=h,o++);let a=t[o].getWidth(n-1)===2;a&&n--;let c=a?i-1:i;s.push(c),l+=c}return s}function Oi(t,e,i){if(e===t.length-1)return t[e].getTrimmedLength();let s=!t[e].hasContent(i-1)&&t[e].getWidth(i-1)===1,r=t[e+1].getWidth(0)===2;return s&&r?i-1:i}var Ca=class xa{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=xa._nextId++,this._onDispose=this.register(new P),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Gt(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};Ca._nextId=1;var yd=Ca,be={},Ht=be.B;be[0]={"`":"◆",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:"≥","{":"π","|":"≠","}":"£","~":"·"};be.A={"#":"£"};be.B=void 0;be[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};be.C=be[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};be.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};be.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};be.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};be.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};be.E=be[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};be.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};be.H=be[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};be["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var An=4294967295,Dn=class{constructor(t,e,i){this._hasScrollback=t,this._optionsService=e,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=ge.clone(),this.savedCharset=Ht,this.markers=[],this._nullCell=rt.fromCharData([0,zo,1,0]),this._whitespaceCell=rt.fromCharData([0,Ft,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new us,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Tn(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new ls),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new ls),this._whitespaceCell}getBlankLine(t,e){return new Li(this._bufferService.cols,this.getNullCell(t),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows}_getCorrectBufferLength(t){if(!this._hasScrollback)return t;let e=t+this._optionsService.rawOptions.scrollback;return e>An?An:e}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=ge);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Tn(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let i=this.getNullCell(ge),s=0,r=this._getCorrectBufferLength(e);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<t)for(let o=0;o<this.lines.length;o++)s+=+this.lines.get(o).resize(t,i);let n=0;if(this._rows<e)for(let o=this._rows;o<e;o++)this.lines.length<e+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Li(t,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new Li(t,i)));else for(let o=this._rows;o>e;o--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let o=this.lines.length-r;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=r}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,e-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(t,e),this._cols>t))for(let n=0;n<this.lines.length;n++)s+=+this.lines.get(n).resize(t,i);this._cols=t,this._rows=e,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let e=0;for(;this._memoryCleanupPosition<this.lines.length;)if(e+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),e>100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,e){this._cols!==t&&(t>this._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))}_reflowLarger(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,s=md(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(ge),i);if(s.length>0){let r=Sd(this.lines,s);wd(this.lines,r.layout),this._reflowLargerAdjustViewport(t,e,r.countRemoved)}}_reflowLargerAdjustViewport(t,e,i){let s=this.getNullCell(ge),r=i;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<e&&this.lines.push(new Li(t,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(ge),r=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=t)continue;let h=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),h.unshift(l);if(!i){let L=this.ybase+this.y;if(L>=o&&L<o+h.length)continue}let a=h[h.length-1].getTrimmedLength(),c=bd(h,this._cols,t),d=c.length-h.length,u;this.ybase===0&&this.y!==this.lines.length-1?u=Math.max(0,this.y-this.lines.maxLength+d):u=Math.max(0,this.lines.length-this.lines.maxLength+d);let _=[];for(let L=0;L<d;L++){let g=this.getBlankLine(ge,!0);_.push(g)}_.length>0&&(r.push({start:o+h.length+n,newLines:_}),n+=_.length),h.push(..._);let f=c.length-1,v=c[f];v===0&&(f--,v=c[f]);let b=h.length-d-1,y=a;for(;b>=0;){let L=Math.min(y,v);if(h[f]===void 0)break;if(h[f].copyCellsFrom(h[b],y-L,v-L,L,!0),v-=L,v===0&&(f--,v=c[f]),y-=L,y===0){b--;let g=Math.max(b,0);y=Oi(h,g,this._cols)}}for(let L=0;L<h.length;L++)c[L]<t&&h[L].setCell(c[L],s);let C=d-u;for(;C-- >0;)this.ybase===0?this.y<e-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-e&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+e-1)}if(r.length>0){let o=[],l=[];for(let v=0;v<this.lines.length;v++)l.push(this.lines.get(v));let h=this.lines.length,a=h-1,c=0,d=r[c];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let u=0;for(let v=Math.min(this.lines.maxLength-1,h+n-1);v>=0;v--)if(d&&d.start>a+u){for(let b=d.newLines.length-1;b>=0;b--)this.lines.set(v--,d.newLines[b]);v++,o.push({index:a+1,amount:d.newLines.length}),u+=d.newLines.length,d=r[++c]}else this.lines.set(v,l[a--]);let _=0;for(let v=o.length-1;v>=0;v--)o[v].index+=_,this.lines.onInsertEmitter.fire(o[v]),_+=o[v].amount;let f=Math.max(0,h+n-this.lines.maxLength);f>0&&this.lines.onTrimEmitter.fire(f)}}translateBufferLineToString(t,e,i=0,s){let r=this.lines.get(t);return r?r.translateToString(e,i,s):""}getWrappedRangeForLine(t){let e=t,i=t;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:e,last:i}}setupTabStops(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.rawOptions.tabStopWidth)this.tabs[t]=!0}prevStop(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].line===t&&(this.markers[e].dispose(),this.markers.splice(e--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].dispose();this.markers.length=0,this._isClearing=!1}addMarker(t){let e=new yd(t);return this.markers.push(e),e.register(this.lines.onTrim(i=>{e.line-=i,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(i=>{e.line>=i.index&&(e.line+=i.amount)})),e.register(this.lines.onDelete(i=>{e.line>=i.index&&e.line<i.index+i.amount&&e.dispose(),e.line>i.index&&(e.line-=i.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}},Cd=class extends K{constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new P),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new Dn(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Dn(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},ka=2,La=1,yr=class extends K{constructor(t){super(),this.isUserScrolling=!1,this._onResize=this._register(new P),this.onResize=this._onResize.event,this._onScroll=this._register(new P),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,ka),this.rows=Math.max(t.rawOptions.rows||0,La),this.buffers=this._register(new Cd(t,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(t,e){let i=this.cols!==t,s=this.rows!==e;this.cols=t,this.rows=e,this.buffers.resize(t,e),this._onResize.fire({cols:t,rows:e,colsChanged:i,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,e=!1){let i=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==t.fg||s.getBg(0)!==t.bg)&&(s=i.getBlankLine(t,e),this._cachedBlankLine=s),s.isWrapped=e;let r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let o=i.lines.isFull;n===i.lines.length-1?o?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),o?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let o=n-r+1;i.lines.shiftElements(r+1,o-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(t,e){let i=this.buffer;if(t<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else t+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let s=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+t,i.ybase),0),s!==i.ydisp&&(e||this._onScroll.fire(i.ydisp))}};yr=ue([O(0,qe)],yr);var Qt={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:ds,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},xd=["normal","bold","100","200","300","400","500","600","700","800","900"],kd=class extends K{constructor(e){super(),this._onOptionChange=this._register(new P),this.onOptionChange=this._onOptionChange.event;let i={...Qt};for(let s in e)if(s in i)try{let r=e[s];i[s]=this._sanitizeAndValidateOption(s,r)}catch(r){console.error(r)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(oe(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(s=>{s===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&i()})}_setupOptions(){let e=s=>{if(!(s in Qt))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},i=(s,r)=>{if(!(s in Qt))throw new Error(`No option with key "${s}"`);r=this._sanitizeAndValidateOption(s,r),this.rawOptions[s]!==r&&(this.rawOptions[s]=r,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let r={get:e.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this.options,s,r)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=Qt[e]),!Ld(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=Qt[e]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=xd.includes(i)?i:Qt[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(i*10)/10));break;case"scrollback":if(i=Math.min(i,4294967295),i<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{};break}return i}};function Ld(t){return t==="block"||t==="underline"||t==="bar"}function Ei(t,e=5){if(typeof t!="object")return t;let i=Array.isArray(t)?[]:{};for(let s in t)i[s]=e<=1?t[s]:t[s]&&Ei(t[s],e-1);return i}var Pn=Object.freeze({insertMode:!1}),On=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Cr=class extends K{constructor(e,i,s){super(),this._bufferService=e,this._logService=i,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new P),this.onData=this._onData.event,this._onUserInput=this._register(new P),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new P),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new P),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Ei(Pn),this.decPrivateModes=Ei(On)}reset(){this.modes=Ei(Pn),this.decPrivateModes=Ei(On)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onBinary.fire(e))}};Cr=ue([O(0,Ke),O(1,Vo),O(2,qe)],Cr);var In={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button===4||t.action!==1?!1:(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>!(t.action===32&&t.button===3)},ANY:{events:31,restrict:t=>!0}};function Ms(t,e){let i=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(i|=64,i|=t.action):(i|=t.button&3,t.button&4&&(i|=64),t.button&8&&(i|=128),t.action===32?i|=32:t.action===0&&!e&&(i|=3)),i}var Bs=String.fromCharCode,Fn={DEFAULT:t=>{let e=[Ms(t,!1)+32,t.col+32,t.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${Bs(e[0])}${Bs(e[1])}${Bs(e[2])}`},SGR:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Ms(t,!0)};${t.col};${t.row}${e}`},SGR_PIXELS:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Ms(t,!0)};${t.x};${t.y}${e}`}},xr=class extends K{constructor(t,e,i){super(),this._bufferService=t,this._coreService=e,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new P),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(In))this.addProtocol(s,In[s]);for(let s of Object.keys(Fn))this.addEncoding(s,Fn[s]);this.reset()}addProtocol(t,e){this._protocols[t]=e}addEncoding(t,e){this._encodings[t]=e}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(t,e,i){if(t.deltaY===0||t.shiftKey||e===void 0||i===void 0)return 0;let s=e/i,r=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(t.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(t,e){return e.altKey||e.ctrlKey||e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let e=this._encodings[this._activeEncoding](t);return e&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(e):this._coreService.triggerDataEvent(e,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(t&1),up:!!(t&2),drag:!!(t&4),move:!!(t&8),wheel:!!(t&16)}}_equalEvents(t,e,i){if(i){if(t.x!==e.x||t.y!==e.y)return!1}else if(t.col!==e.col||t.row!==e.row)return!1;return!(t.button!==e.button||t.action!==e.action||t.ctrl!==e.ctrl||t.alt!==e.alt||t.shift!==e.shift)}};xr=ue([O(0,Ke),O(1,Xt),O(2,qe)],xr);var Ts=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],Ed=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],we;function Rd(t,e){let i=0,s=e.length-1,r;if(t<e[0][0]||t>e[s][1])return!1;for(;s>=i;)if(r=i+s>>1,t>e[r][1])i=r+1;else if(t<e[r][0])s=r-1;else return!0;return!1}var Md=class{constructor(){if(this.version="6",!we){we=new Uint8Array(65536),we.fill(1),we[0]=0,we.fill(0,1,32),we.fill(0,127,160),we.fill(2,4352,4448),we[9001]=2,we[9002]=2,we.fill(2,11904,42192),we[12351]=1,we.fill(2,44032,55204),we.fill(2,63744,64256),we.fill(2,65040,65050),we.fill(2,65072,65136),we.fill(2,65280,65377),we.fill(2,65504,65511);for(let e=0;e<Ts.length;++e)we.fill(0,Ts[e][0],Ts[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?we[e]:Rd(e,Ed)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,i){let s=this.wcwidth(e),r=s===0&&i!==0;if(r){let n=Ut.extractWidth(i);n===0?r=!1:n>s&&(s=n)}return Ut.createPropertyValue(0,s,r)}},Ut=class ss{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new P,this.onChange=this._onChange.event;let e=new Md;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,s=!1){return(e&16777215)<<3|(i&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let i=0,s=0,r=e.length;for(let n=0;n<r;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=r)return i+this.wcwidth(o);let a=e.charCodeAt(n);56320<=a&&a<=57343?o=(o-55296)*1024+a-56320+65536:i+=this.wcwidth(a)}let l=this.charProperties(o,s),h=ss.extractWidth(l);ss.extractShouldJoin(l)&&(h-=ss.extractWidth(s)),i+=h,s=l}return i}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},Bd=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,i){this._charsets[e]=i,this.glevel===e&&(this.charset=i)}};function $n(t){var s;let e=(s=t.buffer.lines.get(t.buffer.ybase+t.buffer.y-1))==null?void 0:s.get(t.cols-1),i=t.buffer.lines.get(t.buffer.ybase+t.buffer.y);i&&e&&(i.isWrapped=e[3]!==0&&e[3]!==32)}var vi=2147483647,Td=256,Ea=class kr{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>Td)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let i=new kr;if(!e.length)return i;for(let s=Array.isArray(e[0])?1:0;s<e.length;++s){let r=e[s];if(Array.isArray(r))for(let n=0;n<r.length;++n)i.addSubParam(r[n]);else i.addParam(r)}return i}clone(){let e=new kr(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let i=0;i<this.length;++i){e.push(this.params[i]);let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&e.push(Array.prototype.slice.call(this._subParams,s,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>vi?vi:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>vi?vi:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,s=this._subParamsIdx[e]&255;return s-i>0?this._subParams.subarray(i,s):null}getSubParamsAll(){let e={};for(let i=0;i<this.length;++i){let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&(e[i]=this._subParams.slice(s,r))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[i-1];s[i-1]=~r?Math.min(r*10+e,vi):e}},mi=[],Ad=class{constructor(){this._state=0,this._active=mi,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(i),{dispose:()=>{let r=s.indexOf(i);r!==-1&&s.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=mi}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=mi,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||mi,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,i,s){if(!this._active.length)this._handlerFb(this._id,"PUT",gs(e,i,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,i,s)}start(){this.reset(),this._state=1}put(e,i,s){if(this._state!==3){if(this._state===1)for(;i<s;){let r=e[i++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&s-i>0&&this._put(e,i,s)}}end(e,i=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let s=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&s===!1){for(;r>=0&&(s=this._active[r].end(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=mi,this._id=-1,this._state=0}}},Ze=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,i,s){this._hitLimit||(this._data+=gs(e,i,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data),i instanceof Promise))return i.then(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,i}},Si=[],Dd=class{constructor(){this._handlers=Object.create(null),this._active=Si,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Si}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(i),{dispose:()=>{let r=s.indexOf(i);r!==-1&&s.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Si,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Si,!this._active.length)this._handlerFb(this._ident,"HOOK",i);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(i)}put(e,i,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",gs(e,i,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,i,s)}unhook(e,i=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&s===!1){for(;r>=0&&(s=this._active[r].unhook(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=Si,this._ident=0}},Ri=new Ea;Ri.addParam(0);var Nn=class{constructor(t){this._handler=t,this._data="",this._params=Ri,this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():Ri,this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=gs(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(i=>(this._params=Ri,this._data="",this._hitLimit=!1,i));return this._params=Ri,this._data="",this._hitLimit=!1,e}},Pd=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,s,r){this.table[i<<8|e]=s<<4|r}addMany(e,i,s,r){for(let n=0;n<e.length;n++)this.table[i<<8|e[n]]=s<<4|r}},it=160,Od=(function(){let t=new Pd(4095),e=Array.apply(null,Array(256)).map((l,h)=>h),i=(l,h)=>e.slice(l,h),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let n=i(0,14),o;t.setDefault(1,0),t.addMany(s,0,2,0);for(o in n)t.addMany([24,26,153,154],o,3,0),t.addMany(i(128,144),o,3,0),t.addMany(i(144,152),o,3,0),t.add(156,o,0,0),t.add(27,o,11,1),t.add(157,o,4,8),t.addMany([152,158,159],o,0,7),t.add(155,o,11,3),t.add(144,o,11,9);return t.addMany(r,0,3,0),t.addMany(r,1,3,1),t.add(127,1,0,1),t.addMany(r,8,0,8),t.addMany(r,3,3,3),t.add(127,3,0,3),t.addMany(r,4,3,4),t.add(127,4,0,4),t.addMany(r,6,3,6),t.addMany(r,5,3,5),t.add(127,5,0,5),t.addMany(r,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(s,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(i(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(s,7,0,7),t.addMany(r,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(i(64,127),3,7,0),t.addMany(i(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(i(48,60),4,8,4),t.addMany(i(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(i(32,64),6,0,6),t.add(127,6,0,6),t.addMany(i(64,127),6,0,0),t.addMany(i(32,48),3,9,5),t.addMany(i(32,48),5,9,5),t.addMany(i(48,64),5,0,6),t.addMany(i(64,127),5,7,0),t.addMany(i(32,48),4,9,5),t.addMany(i(32,48),1,9,2),t.addMany(i(32,48),2,9,2),t.addMany(i(48,127),2,10,0),t.addMany(i(48,80),1,10,0),t.addMany(i(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(i(96,127),1,10,0),t.add(80,1,11,9),t.addMany(r,9,0,9),t.add(127,9,0,9),t.addMany(i(28,32),9,0,9),t.addMany(i(32,48),9,9,12),t.addMany(i(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(r,11,0,11),t.addMany(i(32,128),11,0,11),t.addMany(i(28,32),11,0,11),t.addMany(r,10,0,10),t.add(127,10,0,10),t.addMany(i(28,32),10,0,10),t.addMany(i(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(i(32,48),10,9,12),t.addMany(r,12,0,12),t.add(127,12,0,12),t.addMany(i(28,32),12,0,12),t.addMany(i(32,48),12,9,12),t.addMany(i(48,64),12,0,11),t.addMany(i(64,127),12,12,13),t.addMany(i(64,127),10,12,13),t.addMany(i(64,127),9,12,13),t.addMany(r,13,13,13),t.addMany(s,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(it,0,2,0),t.add(it,8,5,8),t.add(it,6,0,6),t.add(it,11,0,11),t.add(it,13,13,13),t})(),Id=class extends K{constructor(e=Od){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Ea,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,s,r)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,s)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(oe(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Ad),this._dcsParser=this._register(new Dd),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let n=0;n<e.intermediates.length;++n){let o=e.intermediates.charCodeAt(n);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(i[0]>r||r>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return s<<=8,s|=r,s}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(e&255)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let r=this._escHandlers[s];return r.push(i),{dispose:()=>{let n=r.indexOf(i);n!==-1&&r.splice(n,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let r=this._csiHandlers[s];return r.push(i),{dispose:()=>{let n=r.indexOf(i);n!==-1&&r.splice(n,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,i,s,r,n){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=s,this._parseStack.transition=r,this._parseStack.chunkPos=n}parse(e,i,s){let r=0,n=0,o=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&a>-1){for(;a>=0&&(l=h[a](this._params),l!==!0);a--)if(l instanceof Promise)return this._parseStack.handlerPos=a,l}this._parseStack.handlers=[];break;case 4:if(s===!1&&a>-1){for(;a>=0&&(l=h[a](),l!==!0);a--)if(l instanceof Promise)return this._parseStack.handlerPos=a,l}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(r!==24&&r!==26,s),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],l=this._oscParser.end(r!==24&&r!==26,s),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=o;h<i;++h){switch(r=e[h],n=this._transitions.table[this.currentState<<8|(r<160?r:it)],n>>4){case 2:for(let _=h+1;;++_){if(_>=i||(r=e[_])<32||r>126&&r<it){this._printHandler(e,h,_),h=_-1;break}if(++_>=i||(r=e[_])<32||r>126&&r<it){this._printHandler(e,h,_),h=_-1;break}if(++_>=i||(r=e[_])<32||r>126&&r<it){this._printHandler(e,h,_),h=_-1;break}if(++_>=i||(r=e[_])<32||r>126&&r<it){this._printHandler(e,h,_),h=_-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],c=a?a.length-1:-1;for(;c>=0&&(l=a[c](this._params),l!==!0);c--)if(l instanceof Promise)return this._preserveStack(3,a,c,n,h),l;c<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++h<i&&(r=e[h])>47&&r<60);h--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let d=this._escHandlers[this._collect<<8|r],u=d?d.length-1:-1;for(;u>=0&&(l=d[u](),l!==!0);u--)if(l instanceof Promise)return this._preserveStack(4,d,u,n,h),l;u<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let _=h+1;;++_)if(_>=i||(r=e[_])===24||r===26||r===27||r>127&&r<it){this._dcsParser.put(e,h,_),h=_-1;break}break;case 14:if(l=this._dcsParser.unhook(r!==24&&r!==26),l)return this._preserveStack(6,[],0,n,h),l;r===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let _=h+1;;_++)if(_>=i||(r=e[_])<32||r>127&&r<it){this._oscParser.put(e,h,_),h=_-1;break}break;case 6:if(l=this._oscParser.end(r!==24&&r!==26),l)return this._preserveStack(5,[],0,n,h),l;r===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=n&15}}},Fd=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,$d=/^[\da-f]+$/;function Wn(t){if(!t)return;let e=t.toLowerCase();if(e.indexOf("rgb:")===0){e=e.slice(4);let i=Fd.exec(e);if(i){let s=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/s*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/s*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/s*255)]}}else if(e.indexOf("#")===0&&(e=e.slice(1),$d.exec(e)&&[3,6,9,12].includes(e.length))){let i=e.length/3,s=[0,0,0];for(let r=0;r<3;++r){let n=parseInt(e.slice(i*r,i*r+i),16);s[r]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return s}}function As(t,e){let i=t.toString(16),s=i.length<2?"0"+i:i;switch(e){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function Nd(t,e=16){let[i,s,r]=t;return`rgb:${As(i,e)}/${As(s,e)}/${As(r,e)}`}var Wd={"(":0,")":1,"*":2,"+":3,"-":1,".":2},At=131072,zn=10;function Hn(t,e){if(t>24)return e.setWinLines||!1;switch(t){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var Un=5e3,Kn=0,zd=class extends K{constructor(t,e,i,s,r,n,o,l,h=new Id){super(),this._bufferService=t,this._charsetService=e,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=l,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new oh,this._utf8Decoder=new ah,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ge.clone(),this._eraseAttrDataInternal=ge.clone(),this._onRequestBell=this._register(new P),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new P),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new P),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new P),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new P),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new P),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new P),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new P),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new P),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new P),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new P),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new P),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new P),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new Lr(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(a=>this._activeBuffer=a.activeBuffer)),this._parser.setCsiHandlerFallback((a,c)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(a),params:c.toArray()})}),this._parser.setEscHandlerFallback(a=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(a)})}),this._parser.setExecuteHandlerFallback(a=>{this._logService.debug("Unknown EXECUTE code: ",{code:a})}),this._parser.setOscHandlerFallback((a,c,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:a,action:c,data:d})}),this._parser.setDcsHandlerFallback((a,c,d)=>{c==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(a),action:c,payload:d})}),this._parser.setPrintHandler((a,c,d)=>this.print(a,c,d)),this._parser.registerCsiHandler({final:"@"},a=>this.insertChars(a)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},a=>this.scrollLeft(a)),this._parser.registerCsiHandler({final:"A"},a=>this.cursorUp(a)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},a=>this.scrollRight(a)),this._parser.registerCsiHandler({final:"B"},a=>this.cursorDown(a)),this._parser.registerCsiHandler({final:"C"},a=>this.cursorForward(a)),this._parser.registerCsiHandler({final:"D"},a=>this.cursorBackward(a)),this._parser.registerCsiHandler({final:"E"},a=>this.cursorNextLine(a)),this._parser.registerCsiHandler({final:"F"},a=>this.cursorPrecedingLine(a)),this._parser.registerCsiHandler({final:"G"},a=>this.cursorCharAbsolute(a)),this._parser.registerCsiHandler({final:"H"},a=>this.cursorPosition(a)),this._parser.registerCsiHandler({final:"I"},a=>this.cursorForwardTab(a)),this._parser.registerCsiHandler({final:"J"},a=>this.eraseInDisplay(a,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},a=>this.eraseInDisplay(a,!0)),this._parser.registerCsiHandler({final:"K"},a=>this.eraseInLine(a,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},a=>this.eraseInLine(a,!0)),this._parser.registerCsiHandler({final:"L"},a=>this.insertLines(a)),this._parser.registerCsiHandler({final:"M"},a=>this.deleteLines(a)),this._parser.registerCsiHandler({final:"P"},a=>this.deleteChars(a)),this._parser.registerCsiHandler({final:"S"},a=>this.scrollUp(a)),this._parser.registerCsiHandler({final:"T"},a=>this.scrollDown(a)),this._parser.registerCsiHandler({final:"X"},a=>this.eraseChars(a)),this._parser.registerCsiHandler({final:"Z"},a=>this.cursorBackwardTab(a)),this._parser.registerCsiHandler({final:"`"},a=>this.charPosAbsolute(a)),this._parser.registerCsiHandler({final:"a"},a=>this.hPositionRelative(a)),this._parser.registerCsiHandler({final:"b"},a=>this.repeatPrecedingCharacter(a)),this._parser.registerCsiHandler({final:"c"},a=>this.sendDeviceAttributesPrimary(a)),this._parser.registerCsiHandler({prefix:">",final:"c"},a=>this.sendDeviceAttributesSecondary(a)),this._parser.registerCsiHandler({final:"d"},a=>this.linePosAbsolute(a)),this._parser.registerCsiHandler({final:"e"},a=>this.vPositionRelative(a)),this._parser.registerCsiHandler({final:"f"},a=>this.hVPosition(a)),this._parser.registerCsiHandler({final:"g"},a=>this.tabClear(a)),this._parser.registerCsiHandler({final:"h"},a=>this.setMode(a)),this._parser.registerCsiHandler({prefix:"?",final:"h"},a=>this.setModePrivate(a)),this._parser.registerCsiHandler({final:"l"},a=>this.resetMode(a)),this._parser.registerCsiHandler({prefix:"?",final:"l"},a=>this.resetModePrivate(a)),this._parser.registerCsiHandler({final:"m"},a=>this.charAttributes(a)),this._parser.registerCsiHandler({final:"n"},a=>this.deviceStatus(a)),this._parser.registerCsiHandler({prefix:"?",final:"n"},a=>this.deviceStatusPrivate(a)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},a=>this.softReset(a)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},a=>this.setCursorStyle(a)),this._parser.registerCsiHandler({final:"r"},a=>this.setScrollRegion(a)),this._parser.registerCsiHandler({final:"s"},a=>this.saveCursor(a)),this._parser.registerCsiHandler({final:"t"},a=>this.windowOptions(a)),this._parser.registerCsiHandler({final:"u"},a=>this.restoreCursor(a)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},a=>this.insertColumns(a)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},a=>this.deleteColumns(a)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},a=>this.selectProtected(a)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},a=>this.requestMode(a,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},a=>this.requestMode(a,!1)),this._parser.setExecuteHandler(T.BEL,()=>this.bell()),this._parser.setExecuteHandler(T.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(T.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(T.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(T.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(T.BS,()=>this.backspace()),this._parser.setExecuteHandler(T.HT,()=>this.tab()),this._parser.setExecuteHandler(T.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(T.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(ts.IND,()=>this.index()),this._parser.setExecuteHandler(ts.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(ts.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ze(a=>(this.setTitle(a),this.setIconName(a),!0))),this._parser.registerOscHandler(1,new Ze(a=>this.setIconName(a))),this._parser.registerOscHandler(2,new Ze(a=>this.setTitle(a))),this._parser.registerOscHandler(4,new Ze(a=>this.setOrReportIndexedColor(a))),this._parser.registerOscHandler(8,new Ze(a=>this.setHyperlink(a))),this._parser.registerOscHandler(10,new Ze(a=>this.setOrReportFgColor(a))),this._parser.registerOscHandler(11,new Ze(a=>this.setOrReportBgColor(a))),this._parser.registerOscHandler(12,new Ze(a=>this.setOrReportCursorColor(a))),this._parser.registerOscHandler(104,new Ze(a=>this.restoreIndexedColor(a))),this._parser.registerOscHandler(110,new Ze(a=>this.restoreFgColor(a))),this._parser.registerOscHandler(111,new Ze(a=>this.restoreBgColor(a))),this._parser.registerOscHandler(112,new Ze(a=>this.restoreCursorColor(a))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let a in be)this._parser.registerEscHandler({intermediates:"(",final:a},()=>this.selectCharset("("+a)),this._parser.registerEscHandler({intermediates:")",final:a},()=>this.selectCharset(")"+a)),this._parser.registerEscHandler({intermediates:"*",final:a},()=>this.selectCharset("*"+a)),this._parser.registerEscHandler({intermediates:"+",final:a},()=>this.selectCharset("+"+a)),this._parser.registerEscHandler({intermediates:"-",final:a},()=>this.selectCharset("-"+a)),this._parser.registerEscHandler({intermediates:".",final:a},()=>this.selectCharset("."+a)),this._parser.registerEscHandler({intermediates:"/",final:a},()=>this.selectCharset("/"+a));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(a=>(this._logService.error("Parsing error: ",a),a)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Nn((a,c)=>this.requestStatusString(a,c)))}getAttrData(){return this._curAttrData}_preserveStack(t,e,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=t,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(t){this._logService.logLevel<=3&&Promise.race([t,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),Un))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(`async parser handler taking longer than ${Un} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(t,e){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,t.length>At&&(n=this._parseStack.position+At)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof t=="string"?` "${t}"`:` "${Array.prototype.map.call(t,a=>String.fromCharCode(a)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof t=="string"?t.split("").map(a=>a.charCodeAt(0)):t),this._parseBuffer.length<t.length&&this._parseBuffer.length<At&&(this._parseBuffer=new Uint32Array(Math.min(t.length,At))),o||this._dirtyRowTracker.clearRange(),t.length>At)for(let a=n;a<t.length;a+=At){let c=a+At<t.length?a+At:t.length,d=typeof t=="string"?this._stringDecoder.decode(t.substring(a,c),this._parseBuffer):this._utf8Decoder.decode(t.subarray(a,c),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,d))return this._preserveStack(s,r,d,a),this._logSlowResolvingAsync(i),i}else if(!o){let a=typeof t=="string"?this._stringDecoder.decode(t,this._parseBuffer):this._utf8Decoder.decode(t,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,a))return this._preserveStack(s,r,a,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==s||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(t,e,i){let s,r,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,a=this._coreService.modes.insertMode,c=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-e>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,c);let u=this._parser.precedingJoinState;for(let _=e;_<i;++_){if(s=t[_],s<127&&n){let y=n[String.fromCharCode(s)];y&&(s=y.charCodeAt(0))}let f=this._unicodeService.charProperties(s,u);r=Ut.extractWidth(f);let v=Ut.extractShouldJoin(f),b=v?Ut.extractWidth(u):0;if(u=f,o&&this._onA11yChar.fire(It(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-b>l){if(h){let y=d,C=this._activeBuffer.x-b;for(this._activeBuffer.x=b,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),b>0&&d instanceof Li&&d.copyCellsFrom(y,C,0,b,!1);C<l;)y.setCellFromCodepoint(C++,0,1,c)}else if(this._activeBuffer.x=l-1,r===2)continue}if(v&&this._activeBuffer.x){let y=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-y,s,r);for(let C=r-b;--C>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,c);continue}if(a&&(d.insertCells(this._activeBuffer.x,r-b,this._activeBuffer.getNullCell(c)),d.getWidth(l-1)===2&&d.setCellFromCodepoint(l-1,0,1,c)),d.setCellFromCodepoint(this._activeBuffer.x++,s,r,c),r>0)for(;--r;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,c)}this._parser.precedingJoinState=u,this._activeBuffer.x<l&&i-e>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,c),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(t,e){return t.final==="t"&&!t.prefix&&!t.intermediates?this._parser.registerCsiHandler(t,i=>Hn(i.params[0],this._optionsService.rawOptions.windowOptions)?e(i):!0):this._parser.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._parser.registerDcsHandler(t,new Nn(e))}registerEscHandler(t,e){return this._parser.registerEscHandler(t,e)}registerOscHandler(t,e){return this._parser.registerOscHandler(t,new Ze(e))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var t;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&t.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-t),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(t=this._bufferService.cols-1){this._activeBuffer.x=Math.min(t,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(t,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=t,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=t,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(t,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+t,this._activeBuffer.y+e)}cursorUp(t){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,t.params[0]||1)):this._moveCursor(0,-(t.params[0]||1)),!0}cursorDown(t){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,t.params[0]||1)):this._moveCursor(0,t.params[0]||1),!0}cursorForward(t){return this._moveCursor(t.params[0]||1,0),!0}cursorBackward(t){return this._moveCursor(-(t.params[0]||1),0),!0}cursorNextLine(t){return this.cursorDown(t),this._activeBuffer.x=0,!0}cursorPrecedingLine(t){return this.cursorUp(t),this._activeBuffer.x=0,!0}cursorCharAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(t){return this._setCursor(t.length>=2?(t.params[1]||1)-1:0,(t.params[0]||1)-1),!0}charPosAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(t){return this._moveCursor(t.params[0]||1,0),!0}linePosAbsolute(t){return this._setCursor(this._activeBuffer.x,(t.params[0]||1)-1),!0}vPositionRelative(t){return this._moveCursor(0,t.params[0]||1),!0}hVPosition(t){return this.cursorPosition(t),!0}tabClear(t){let e=t.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(t){let e=t.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(t,e,i,s=!1,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);n.replaceCells(e,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1)}_resetBufferLine(t,e=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+t),i.isWrapped=!1)}eraseInDisplay(t,e=!1){var s;this._restrictCursor(this._bufferService.cols);let i;switch(t.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);i<this._bufferService.rows;i++)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,e),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&s.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(t,e=!1){switch(this._restrictCursor(this._bufferService.cols),t.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;e--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;e--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.insertCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.deleteCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(t){let e=t.params[0]||1;for(;e--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(t){let e=t.params[0]||1;for(;e--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(ge));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(t.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(t){let e=this._parser.precedingJoinState;if(!e)return!0;let i=t.params[0]||1,s=Ut.extractWidth(e),r=this._activeBuffer.x-s,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),o=new Uint32Array(n.length*i),l=0;for(let a=0;a<n.length;){let c=n.codePointAt(a)||0;o[l++]=c,a+=c>65535?2:1}let h=l;for(let a=1;a<i;++a)o.copyWithin(h,0,l),h+=l;return this.print(o,0,h),!0}sendDeviceAttributesPrimary(t){return t.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(T.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(T.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(t){return t.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(T.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(T.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(t.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(T.ESC+"[>83;40003;0c")),!0}_is(t){return(this._optionsService.rawOptions.termName+"").indexOf(t)===0}setMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Ht),this._charsetService.setgCharset(1,Ht),this._charsetService.setgCharset(2,Ht),this._charsetService.setgCharset(3,Ht);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),t.params[e]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(t,e){(v=>(v[v.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",v[v.SET=1]="SET",v[v.RESET=2]="RESET",v[v.PERMANENTLY_SET=3]="PERMANENTLY_SET",v[v.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let s=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:l,cols:h}=this._bufferService,{active:a,alt:c}=l,d=this._optionsService.rawOptions,u=(v,b)=>(o.triggerDataEvent(`${T.ESC}[${e?"":"?"}${v};${b}$y`),!0),_=v=>v?1:2,f=t.params[0];return e?f===2?u(f,4):f===4?u(f,_(o.modes.insertMode)):f===12?u(f,3):f===20?u(f,_(d.convertEol)):u(f,0):f===1?u(f,_(s.applicationCursorKeys)):f===3?u(f,d.windowOptions.setWinLines?h===80?2:h===132?1:0:0):f===6?u(f,_(s.origin)):f===7?u(f,_(s.wraparound)):f===8?u(f,3):f===9?u(f,_(r==="X10")):f===12?u(f,_(d.cursorBlink)):f===25?u(f,_(!o.isCursorHidden)):f===45?u(f,_(s.reverseWraparound)):f===66?u(f,_(s.applicationKeypad)):f===67?u(f,4):f===1e3?u(f,_(r==="VT200")):f===1002?u(f,_(r==="DRAG")):f===1003?u(f,_(r==="ANY")):f===1004?u(f,_(s.sendFocus)):f===1005?u(f,4):f===1006?u(f,_(n==="SGR")):f===1015?u(f,4):f===1016?u(f,_(n==="SGR_PIXELS")):f===1048?u(f,1):f===47||f===1047||f===1049?u(f,_(a===c)):f===2004?u(f,_(s.bracketedPasteMode)):f===2026?u(f,_(s.synchronizedOutput)):u(f,0)}_updateAttrColor(t,e,i,s,r){return e===2?(t|=50331648,t&=-16777216,t|=Fi.fromColorRGB([i,s,r])):e===5&&(t&=-50331904,t|=33554432|i&255),t}_extractColor(t,e,i){let s=[0,0,-1,0,0,0],r=0,n=0;do{if(s[n+r]=t.params[e+n],t.hasSubParams(e+n)){let o=t.getSubParams(e+n),l=0;do s[1]===5&&(r=1),s[n+l+1+r]=o[l];while(++l<o.length&&l+n+1+r<s.length);break}if(s[1]===5&&n+r>=2||s[1]===2&&n+r>=5)break;s[1]&&(r=1)}while(++n+e<t.length&&n+r<s.length);for(let o=2;o<s.length;++o)s[o]===-1&&(s[o]=0);switch(s[0]){case 38:i.fg=this._updateAttrColor(i.fg,s[1],s[3],s[4],s[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,s[1],s[3],s[4],s[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,s[1],s[3],s[4],s[5])}return n}_processUnderline(t,e){e.extended=e.extended.clone(),(!~t||t>5)&&(t=1),e.extended.underlineStyle=t,e.fg|=268435456,t===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(t){t.fg=ge.fg,t.bg=ge.bg,t.extended=t.extended.clone(),t.extended.underlineStyle=0,t.extended.underlineColor&=-67108864,t.updateExtended()}charAttributes(t){if(t.length===1&&t.params[0]===0)return this._processSGR0(this._curAttrData),!0;let e=t.length,i,s=this._curAttrData;for(let r=0;r<e;r++)i=t.params[r],i>=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777216|i-90|8):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777216|i-100|8):i===0?this._processSGR0(s):i===1?s.fg|=134217728:i===3?s.bg|=67108864:i===4?(s.fg|=268435456,this._processUnderline(t.hasSubParams(r)?t.getSubParams(r)[0]:1,s)):i===5?s.fg|=536870912:i===7?s.fg|=67108864:i===8?s.fg|=1073741824:i===9?s.fg|=2147483648:i===2?s.bg|=134217728:i===21?this._processUnderline(2,s):i===22?(s.fg&=-134217729,s.bg&=-134217729):i===23?s.bg&=-67108865:i===24?(s.fg&=-268435457,this._processUnderline(0,s)):i===25?s.fg&=-536870913:i===27?s.fg&=-67108865:i===28?s.fg&=-1073741825:i===29?s.fg&=2147483647:i===39?(s.fg&=-67108864,s.fg|=ge.fg&16777215):i===49?(s.bg&=-67108864,s.bg|=ge.bg&16777215):i===38||i===48||i===58?r+=this._extractColor(t,r,s):i===53?s.bg|=1073741824:i===55?s.bg&=-1073741825:i===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):i===100?(s.fg&=-67108864,s.fg|=ge.fg&16777215,s.bg&=-67108864,s.bg|=ge.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(t){switch(t.params[0]){case 5:this._coreService.triggerDataEvent(`${T.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${T.ESC}[${e};${i}R`);break}return!0}deviceStatusPrivate(t){switch(t.params[0]){case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${T.ESC}[?${e};${i}R`);break}return!0}softReset(t){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ge.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(t){let e=t.length===0?1:t.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let i=e%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(t){let e=t.params[0]||1,i;return(t.length<2||(i=t.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(t){if(!Hn(t.params[0],this._optionsService.rawOptions.windowOptions))return!0;let e=t.length>1?t.params[1]:0;switch(t.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${T.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>zn&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>zn&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(t){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(t){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(t){return this._windowTitle=t,this._onTitleChange.fire(t),!0}setIconName(t){return this._iconName=t,!0}setOrReportIndexedColor(t){let e=[],i=t.split(";");for(;i.length>1;){let s=i.shift(),r=i.shift();if(/^\d+$/.exec(s)){let n=parseInt(s);if(qn(n))if(r==="?")e.push({type:0,index:n});else{let o=Wn(r);o&&e.push({type:1,index:n,color:o})}}}return e.length&&this._onColor.fire(e),!0}setHyperlink(t){let e=t.indexOf(";");if(e===-1)return!0;let i=t.slice(0,e).trim(),s=t.slice(e+1);return s?this._createHyperlink(i,s):i.trim()?!1:this._finishHyperlink()}_createHyperlink(t,e){this._getCurrentLinkId()&&this._finishHyperlink();let i=t.split(":"),s,r=i.findIndex(n=>n.startsWith("id="));return r!==-1&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:e}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(t,e){let i=t.split(";");for(let s=0;s<i.length&&!(e>=this._specialColors.length);++s,++e)if(i[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let r=Wn(i[s]);r&&this._onColor.fire([{type:1,index:this._specialColors[e],color:r}])}return!0}setOrReportFgColor(t){return this._setOrReportSpecialColor(t,0)}setOrReportBgColor(t){return this._setOrReportSpecialColor(t,1)}setOrReportCursorColor(t){return this._setOrReportSpecialColor(t,2)}restoreIndexedColor(t){if(!t)return this._onColor.fire([{type:2}]),!0;let e=[],i=t.split(";");for(let s=0;s<i.length;++s)if(/^\d+$/.exec(i[s])){let r=parseInt(i[s]);qn(r)&&e.push({type:2,index:r})}return e.length&&this._onColor.fire(e),!0}restoreFgColor(t){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(t){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(t){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Ht),!0}selectCharset(t){return t.length!==2?(this.selectDefaultCharset(),!0):(t[0]==="/"||this._charsetService.setgCharset(Wd[t[0]],be[t[1]]||Ht),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let t=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,t,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=ge.clone(),this._eraseAttrDataInternal=ge.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(t){return this._charsetService.setgLevel(t),!0}screenAlignmentPattern(){let t=new rt;t.content=1<<22|69,t.fg=this._curAttrData.fg,t.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e<this._bufferService.rows;++e){let i=this._activeBuffer.ybase+this._activeBuffer.y+e,s=this._activeBuffer.lines.get(i);s&&(s.fill(t),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(t,e){let i=o=>(this._coreService.triggerDataEvent(`${T.ESC}${o}${T.ESC}\\`),!0),s=this._bufferService.buffer,r=this._optionsService.rawOptions;return i(t==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:t==='"p'?'P1$r61;1"p':t==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:t==="m"?"P1$r0m":t===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(t,e){this._dirtyRowTracker.markRangeDirty(t,e)}},Lr=class{constructor(t){this._bufferService=t,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){t<this.start?this.start=t:t>this.end&&(this.end=t)}markRangeDirty(t,e){t>e&&(Kn=t,t=e,e=Kn),t<this.start&&(this.start=t),e>this.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Lr=ue([O(0,Ke)],Lr);function qn(t){return 0<=t&&t<256}var Hd=5e7,Vn=12,Ud=50,Kd=class extends K{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new P),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){if(i!==void 0&&this._syncCalls>i){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let s;for(;s=this._writeBuffer.shift();){this._action(s);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,i){if(this._pendingData>Hd)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],n=this._action(r,i);if(n){let l=h=>performance.now()-s>=Vn?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(s,h);n.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(l);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-s>=Vn)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Ud&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},Er=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let i=this._bufferService.buffer;if(e.id===void 0){let h=i.addMarker(i.ybase+i.y),a={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(a,h)),this._dataByLinkId.set(a.id,a),a.id}let s=e,r=this._getEntryIdKey(s),n=this._entriesWithId.get(r);if(n)return this.addLineToLink(n.id,i.ybase+i.y),n.id;let o=i.addMarker(i.ybase+i.y),l={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(e,i){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(r=>r.line!==i)){let r=this._bufferService.buffer.addMarker(i);s.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(s,r))}}getLinkData(e){var i;return(i=this._dataByLinkId.get(e))==null?void 0:i.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,i){let s=e.lines.indexOf(i);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Er=ue([O(0,Ke)],Er);var Yn=!1,qd=class extends K{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new hi),this._onBinary=this._register(new P),this.onBinary=this._onBinary.event,this._onData=this._register(new P),this.onData=this._onData.event,this._onLineFeed=this._register(new P),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new P),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new P),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new P),this._instantiationService=new gd,this.optionsService=this._register(new kd(e)),this._instantiationService.setService(qe,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(yr)),this._instantiationService.setService(Ke,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(br)),this._instantiationService.setService(Vo,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Cr)),this._instantiationService.setService(Xt,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(xr)),this._instantiationService.setService(qo,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ut)),this._instantiationService.setService(dh,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Bd),this._instantiationService.setService(ch,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Er),this._instantiationService.setService(Yo,this._oscLinkService),this._inputHandler=this._register(new zd(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ie.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ie.forward(this._bufferService.onResize,this._onResize)),this._register(Ie.forward(this.coreService.onData,this._onData)),this._register(Ie.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new Kd((i,s)=>this._inputHandler.parse(i,s))),this._register(Ie.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new P),this._onScroll.event(e=>{var i;(i=this._onScrollApi)==null||i.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!Yn&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Yn=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,ka),i=Math.max(i,La),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&i.buildNumber!==void 0&&i.buildNumber!==void 0?e=i.backend==="conpty"&&i.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed($n.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>($n(this._bufferService),!1))),this._windowsWrappingHeuristics.value=oe(()=>{for(let i of e)i.dispose()})}}},Vd={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function Yd(t,e,i,s){var o;let r={type:0,cancel:!1,key:void 0},n=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:t.key==="UIKeyInputUpArrow"?e?r.key=T.ESC+"OA":r.key=T.ESC+"[A":t.key==="UIKeyInputLeftArrow"?e?r.key=T.ESC+"OD":r.key=T.ESC+"[D":t.key==="UIKeyInputRightArrow"?e?r.key=T.ESC+"OC":r.key=T.ESC+"[C":t.key==="UIKeyInputDownArrow"&&(e?r.key=T.ESC+"OB":r.key=T.ESC+"[B");break;case 8:r.key=t.ctrlKey?"\b":T.DEL,t.altKey&&(r.key=T.ESC+r.key);break;case 9:if(t.shiftKey){r.key=T.ESC+"[Z";break}r.key=T.HT,r.cancel=!0;break;case 13:r.key=t.altKey?T.ESC+T.CR:T.CR,r.cancel=!0;break;case 27:r.key=T.ESC,t.altKey&&(r.key=T.ESC+T.ESC),r.cancel=!0;break;case 37:if(t.metaKey)break;n?r.key=T.ESC+"[1;"+(n+1)+"D":e?r.key=T.ESC+"OD":r.key=T.ESC+"[D";break;case 39:if(t.metaKey)break;n?r.key=T.ESC+"[1;"+(n+1)+"C":e?r.key=T.ESC+"OC":r.key=T.ESC+"[C";break;case 38:if(t.metaKey)break;n?r.key=T.ESC+"[1;"+(n+1)+"A":e?r.key=T.ESC+"OA":r.key=T.ESC+"[A";break;case 40:if(t.metaKey)break;n?r.key=T.ESC+"[1;"+(n+1)+"B":e?r.key=T.ESC+"OB":r.key=T.ESC+"[B";break;case 45:!t.shiftKey&&!t.ctrlKey&&(r.key=T.ESC+"[2~");break;case 46:n?r.key=T.ESC+"[3;"+(n+1)+"~":r.key=T.ESC+"[3~";break;case 36:n?r.key=T.ESC+"[1;"+(n+1)+"H":e?r.key=T.ESC+"OH":r.key=T.ESC+"[H";break;case 35:n?r.key=T.ESC+"[1;"+(n+1)+"F":e?r.key=T.ESC+"OF":r.key=T.ESC+"[F";break;case 33:t.shiftKey?r.type=2:t.ctrlKey?r.key=T.ESC+"[5;"+(n+1)+"~":r.key=T.ESC+"[5~";break;case 34:t.shiftKey?r.type=3:t.ctrlKey?r.key=T.ESC+"[6;"+(n+1)+"~":r.key=T.ESC+"[6~";break;case 112:n?r.key=T.ESC+"[1;"+(n+1)+"P":r.key=T.ESC+"OP";break;case 113:n?r.key=T.ESC+"[1;"+(n+1)+"Q":r.key=T.ESC+"OQ";break;case 114:n?r.key=T.ESC+"[1;"+(n+1)+"R":r.key=T.ESC+"OR";break;case 115:n?r.key=T.ESC+"[1;"+(n+1)+"S":r.key=T.ESC+"OS";break;case 116:n?r.key=T.ESC+"[15;"+(n+1)+"~":r.key=T.ESC+"[15~";break;case 117:n?r.key=T.ESC+"[17;"+(n+1)+"~":r.key=T.ESC+"[17~";break;case 118:n?r.key=T.ESC+"[18;"+(n+1)+"~":r.key=T.ESC+"[18~";break;case 119:n?r.key=T.ESC+"[19;"+(n+1)+"~":r.key=T.ESC+"[19~";break;case 120:n?r.key=T.ESC+"[20;"+(n+1)+"~":r.key=T.ESC+"[20~";break;case 121:n?r.key=T.ESC+"[21;"+(n+1)+"~":r.key=T.ESC+"[21~";break;case 122:n?r.key=T.ESC+"[23;"+(n+1)+"~":r.key=T.ESC+"[23~";break;case 123:n?r.key=T.ESC+"[24;"+(n+1)+"~":r.key=T.ESC+"[24~";break;default:if(t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey)t.keyCode>=65&&t.keyCode<=90?r.key=String.fromCharCode(t.keyCode-64):t.keyCode===32?r.key=T.NUL:t.keyCode>=51&&t.keyCode<=55?r.key=String.fromCharCode(t.keyCode-51+27):t.keyCode===56?r.key=T.DEL:t.keyCode===219?r.key=T.ESC:t.keyCode===220?r.key=T.FS:t.keyCode===221&&(r.key=T.GS);else if((!i||s)&&t.altKey&&!t.metaKey){let l=(o=Vd[t.keyCode])==null?void 0:o[t.shiftKey?1:0];if(l)r.key=T.ESC+l;else if(t.keyCode>=65&&t.keyCode<=90){let h=t.ctrlKey?t.keyCode-64:t.keyCode+32,a=String.fromCharCode(h);t.shiftKey&&(a=a.toUpperCase()),r.key=T.ESC+a}else if(t.keyCode===32)r.key=T.ESC+(t.ctrlKey?T.NUL:" ");else if(t.key==="Dead"&&t.code.startsWith("Key")){let h=t.code.slice(3,4);t.shiftKey||(h=h.toLowerCase()),r.key=T.ESC+h,r.cancel=!0}}else i&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&t.metaKey?t.keyCode===65&&(r.type=1):t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.keyCode>=48&&t.key.length===1?r.key=t.key:t.key&&t.ctrlKey&&(t.key==="_"&&(r.key=T.US),t.key==="@"&&(r.key=T.NUL));break}return r}var fe=0,Gd=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new us,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new us,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((n,o)=>this._getKey(n)-this._getKey(o)),i=0,s=0,r=new Array(this._array.length+this._insertedValues.length);for(let n=0;n<r.length;n++)s>=this._array.length||this._getKey(e[i])<=this._getKey(this._array[s])?(r[n]=e[i],i++):r[n]=this._array[s++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let i=this._getKey(e);if(i===void 0||(fe=this._search(i),fe===-1)||this._getKey(this._array[fe])!==i)return!1;do if(this._array[fe]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(fe),!0;while(++fe<this._array.length&&this._getKey(this._array[fe])===i);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((n,o)=>n-o),i=0,s=new Array(this._array.length-e.length),r=0;for(let n=0;n<this._array.length;n++)e[i]===n?i++:s[r++]=this._array[n];this._array=s,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(fe=this._search(e),!(fe<0||fe>=this._array.length)&&this._getKey(this._array[fe])===e))do yield this._array[fe];while(++fe<this._array.length&&this._getKey(this._array[fe])===e)}forEachByKey(e,i){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(fe=this._search(e),!(fe<0||fe>=this._array.length)&&this._getKey(this._array[fe])===e))do i(this._array[fe]);while(++fe<this._array.length&&this._getKey(this._array[fe])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let i=0,s=this._array.length-1;for(;s>=i;){let r=i+s>>1,n=this._getKey(this._array[r]);if(n>e)s=r-1;else if(n<e)i=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return i}},Ds=0,Gn=0,jd=class extends K{constructor(){super(),this._decorations=new Gd(t=>t==null?void 0:t.marker.line),this._onDecorationRegistered=this._register(new P),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new P),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(oe(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(t){if(t.marker.isDisposed)return;let e=new Xd(t);if(e){let i=e.marker.onDispose(()=>e.dispose()),s=e.onDispose(()=>{s.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),i.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,e,i){let s=0,r=0;for(let n of this._decorations.getKeyIterator(e))s=n.options.x??0,r=s+(n.options.width??1),t>=s&&t<r&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(t,e,i,s){this._decorations.forEachByKey(e,r=>{Ds=r.options.x??0,Gn=Ds+(r.options.width??1),t>=Ds&&t<Gn&&(!i||(r.options.layer??"bottom")===i)&&s(r)})}},Xd=class extends $t{constructor(t){super(),this.options=t,this.onRenderEmitter=this.add(new P),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new P),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=t.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=le.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=le.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Zd=1e3,Jd=class{constructor(e,i=Zd){this._renderCallback=e,this._debounceThresholdMS=i,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,i,s){this._rowCount=s,e=e!==void 0?e:0,i=i!==void 0?i:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,i):i;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=r-this._lastRefreshMs,o=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i)}},jn=20,_s=class extends K{constructor(t,e,i,s){super(),this._terminal=t,this._coreBrowserService=i,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Jd(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
25
|
-
`))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(W(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(
|
|
26
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===jn+1&&(this._liveRegion.textContent+=Ys.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(t){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(t)||this._charsToConsume.push(t)}_refreshRows(t,e){this._liveRegionDebouncer.refresh(t,e,this._terminal.rows)}_renderRows(t,e){let i=this._terminal.buffer,s=i.lines.length.toString();for(let r=t;r<=e;r++){let n=i.lines.get(i.ydisp+r),o=[],l=(n==null?void 0:n.translateToString(!0,void 0,void 0,o))||"",h=(i.ydisp+r+1).toString(),a=this._rowElements[r];a&&(l.length===0?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=l,this._rowColumns.set(a,o)),a.setAttribute("aria-posinset",h),a.setAttribute("aria-setsize",s),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(t,e){let i=t.target,s=this._rowElements[e===0?1:this._rowElements.length-2],r=i.getAttribute("aria-posinset"),n=e===0?"1":`${this._terminal.buffer.lines.length}`;if(r===n||t.relatedTarget!==s)return;let o,l;if(e===0?(o=i,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=i,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),e===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(e===0?-1:1),this._rowElements[e===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_handleSelectionChange(){var l;if(this._rowElements.length===0)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed){this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection();return}if(!t.anchorNode||!t.focusNode){console.error("anchorNode and/or focusNode are null");return}let e={node:t.anchorNode,offset:t.anchorOffset},i={node:t.focusNode,offset:t.focusOffset};if((e.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||e.node===i.node&&e.offset>i.offset)&&([e,i]=[i,e]),e.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(e={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(e.node))return;let s=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:s,offset:((l=s.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(i.node))return;let r=({node:h,offset:a})=>{let c=h instanceof Text?h.parentNode:h,d=parseInt(c==null?void 0:c.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let u=this._rowColumns.get(c);if(!u)return console.warn("columns is null. Race condition?"),null;let _=a<u.length?u[a]:u.slice(-1)[0]+1;return _>=this._terminal.cols&&(++d,_=0),{row:d,column:_}},n=r(e),o=r(i);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let t=this._coreBrowserService.mainDocument.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let t=0;t<this._terminal.rows;t++)this._refreshRowDimensions(this._rowElements[t]),this._alignRowWidth(this._rowElements[t])}}_refreshRowDimensions(t){t.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(t){var r,n;t.style.transform="";let e=t.getBoundingClientRect().width,i=(n=(r=this._rowColumns.get(t))==null?void 0:r.slice(-1))==null?void 0:n[0];if(!i)return;let s=i*this._renderService.dimensions.css.cell.width;t.style.transform=`scaleX(${s/e})`}};_s=ue([O(1,Ir),O(2,Lt),O(3,Et)],_s);var Rr=class extends K{constructor(t,e,i,s,r){super(),this._element=t,this._mouseService=e,this._renderService=i,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new P),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new P),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(oe(()=>{var n;Gt(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(n=this._activeProviderReplies)==null||n.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(W(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(W(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(W(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(W(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(t){this._lastMouseEvent=t;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let i=t.composedPath();for(let s=0;s<i.length;s++){let r=i[s];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||e.x!==this._lastBufferCell.x||e.y!==this._lastBufferCell.y)&&(this._handleHover(e),this._lastBufferCell=e)}_handleHover(t){if(this._activeLine!==t.y||this._wasResized){this._clearCurrentLink(),this._askForLink(t,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,t)||(this._clearCurrentLink(),this._askForLink(t,!0))}_askForLink(t,e){var s,r;(!this._activeProviderReplies||!e)&&((s=this._activeProviderReplies)==null||s.forEach(n=>{n==null||n.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=t.y);let i=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())e?(r=this._activeProviderReplies)!=null&&r.get(n)&&(i=this._checkLinkProviderResult(n,t,i)):o.provideLinks(t.y,l=>{var a,c;if(this._isMouseOut)return;let h=l==null?void 0:l.map(d=>({link:d}));(a=this._activeProviderReplies)==null||a.set(n,h),i=this._checkLinkProviderResult(n,t,i),((c=this._activeProviderReplies)==null?void 0:c.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)})}_removeIntersectingLinks(t,e){let i=new Set;for(let s=0;s<e.size;s++){let r=e.get(s);if(r)for(let n=0;n<r.length;n++){let o=r[n],l=o.link.range.start.y<t?0:o.link.range.start.x,h=o.link.range.end.y>t?this._bufferService.cols:o.link.range.end.x;for(let a=l;a<=h;a++){if(i.has(a)){r.splice(n--,1);break}i.add(a)}}}}_checkLinkProviderResult(t,e,i){var n;if(!this._activeProviderReplies)return i;let s=this._activeProviderReplies.get(t),r=!1;for(let o=0;o<t;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(r=!0);if(!r&&s){let o=s.find(l=>this._linkAtPosition(l.link,e));o&&(i=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(n=this._activeProviderReplies.get(o))==null?void 0:n.find(h=>this._linkAtPosition(h.link,e));if(l){i=!0,this._handleNewLink(l);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);e&&this._mouseDownLink&&Qd(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,e){!this._currentLink||!this._lastMouseEvent||(!t||!e||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Gt(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(t){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(t.link,e)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0?!0:t.link.decorations.underline,pointerCursor:t.link.decorations===void 0?!0:t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>{var i,s;return(s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.pointerCursor},set:i=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,s;return(s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline},set:i=>{var s,r,n;(s=this._currentLink)!=null&&s.state&&((n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let s=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(s,r),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(t,e,i){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(i,e.text)}_fireUnderlineEvent(t,e){let i=t.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(t,e,i){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(i,e.text)}_linkAtPosition(t,e){let i=t.range.start.y*this._bufferService.cols+t.range.start.x,s=t.range.end.y*this._bufferService.cols+t.range.end.x,r=e.y*this._bufferService.cols+e.x;return i<=r&&r<=s}_positionFromMouseEvent(t,e,i){let s=i.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,i,s,r){return{x1:t,y1:e,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};Rr=ue([O(1,Fr),O(2,Et),O(3,Ke),O(4,jo)],Rr);function Qd(t,e){return t.text===e.text&&t.range.start.x===e.range.start.x&&t.range.start.y===e.range.start.y&&t.range.end.x===e.range.end.x&&t.range.end.y===e.range.end.y}var eu=class extends qd{constructor(e={}){super(e),this._linkifier=this._register(new hi),this.browser=fa,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new hi),this._onCursorMove=this._register(new P),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new P),this.onKey=this._onKey.event,this._onRender=this._register(new P),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new P),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new P),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new P),this.onBell=this._onBell.event,this._onFocus=this._register(new P),this._onBlur=this._register(new P),this._onA11yCharEmitter=this._register(new P),this._onA11yTabEmitter=this._register(new P),this._onWillOpen=this._register(new P),this._setup(),this._decorationService=this._instantiationService.createInstance(jd),this._instantiationService.setService($i,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Uc),this._instantiationService.setService(jo,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(js)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(i=>this.refresh((i==null?void 0:i.start)??0,(i==null?void 0:i.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(i=>this._reportWindowsOptions(i))),this._register(this._inputHandler.onColor(i=>this._handleColorEvent(i))),this._register(Ie.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ie.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ie.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ie.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(i=>this._afterResize(i.cols,i.rows))),this._register(oe(()=>{var i,s;this._customKeyEventHandler=void 0,(s=(i=this.element)==null?void 0:i.parentNode)==null||s.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let i of e){let s,r="";switch(i.index){case 256:s="foreground",r="10";break;case 257:s="background",r="11";break;case 258:s="cursor",r="12";break;default:s="ansi",r="4;"+i.index}switch(i.type){case 0:let n=re.toColorRGB(s==="ansi"?this._themeService.colors.ansi[i.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${T.ESC}]${r};${Nd(n)}${ua.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(o=>o.ansi[i.index]=ve.toColor(...i.color));else{let o=s;this._themeService.modifyColors(l=>l[o]=ve.toColor(...i.color))}break;case 2:this._themeService.restoreColor(i.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(_s,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(T.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(T.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,i=this.buffer.lines.get(e);if(!i)return;let s=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,n=i.getWidth(s),o=this._renderService.dimensions.css.cell.width*n,l=this.buffer.y*this._renderService.dimensions.css.cell.height,h=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=l+"px",this.textarea.style.width=o+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(W(this.element,"copy",i=>{this.hasSelection()&&rh(i,this._selectionService)}));let e=i=>nh(i,this.textarea,this.coreService,this.optionsService);this._register(W(this.textarea,"paste",e)),this._register(W(this.element,"paste",e)),ga?this._register(W(this.element,"mousedown",i=>{i.button===2&&nn(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(W(this.element,"contextmenu",i=>{nn(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),qr&&this._register(W(this.element,"auxclick",i=>{i.button===1&&Wo(i,this.textarea,this.screenElement)}))}_bindKeys(){this._register(W(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(W(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(W(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(W(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(W(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(W(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(W(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var n;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((n=this.element)==null?void 0:n.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(W(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Vs.get()),ma||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(zc,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Lt,this._coreBrowserService),this._register(W(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(W(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(pr,this._document,this._helperContainer),this._instantiationService.setService(ps,this._charSizeService),this._themeService=this._instantiationService.createInstance(wr),this._instantiationService.setService(ci,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(cs),this._instantiationService.setService(Go,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(mr,this.rows,this.screenElement)),this._instantiationService.setService(Et,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(_r,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(vr),this._instantiationService.setService(Fr,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Rr,this.screenElement));this.element.appendChild(i);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(dr,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Sr,this.element,this.screenElement,r)),this._instantiationService.setService(_h,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(Ie.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(ur,this.screenElement)),this._register(W(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(_s,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(hs,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(hs,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(gr,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function s(o){var c,d,u,_,f;let l=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!l)return!1;let h,a;switch(o.overrideType||o.type){case"mousemove":a=32,o.buttons===void 0?(h=3,o.button!==void 0&&(h=o.button<3?o.button:3)):h=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":a=0,h=o.button<3?o.button:3;break;case"mousedown":a=1,h=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let v=o.deltaY;if(v===0||e.coreMouseService.consumeWheelEvent(o,(_=(u=(d=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:d.device)==null?void 0:u.cell)==null?void 0:_.height,(f=e._coreBrowserService)==null?void 0:f.dpr)===0)return!1;a=v<0?0:1,h=4;break;default:return!1}return a===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:h,action:a,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:o=>(s(o),o.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(o)),wheel:o=>(s(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&s(o)},mousemove:o=>{o.buttons||s(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),o&8?r.mousemove||(i.addEventListener("mousemove",n.mousemove),r.mousemove=n.mousemove):(i.removeEventListener("mousemove",r.mousemove),r.mousemove=null),o&16?r.wheel||(i.addEventListener("wheel",n.wheel,{passive:!1}),r.wheel=n.wheel):(i.removeEventListener("wheel",r.wheel),r.wheel=null),o&2?r.mouseup||(r.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),o&4?r.mousedrag||(r.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(W(i,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return s(o),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(o)})),this._register(W(i,"wheel",o=>{var l,h,a,c,d;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(c=(a=(h=(l=e._renderService)==null?void 0:l.dimensions)==null?void 0:h.device)==null?void 0:a.cell)==null?void 0:c.height,(d=e._coreBrowserService)==null?void 0:d.dpr)===0)return this.cancel(o,!0);let u=T.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(u,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,i){var s;(s=this._renderService)==null||s.refreshRows(e,i)}updateCursorStyle(e){var i;(i=this._selectionService)!=null&&i.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}paste(e){No(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,i,s){this._selectionService.setSelection(e,i,s)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,i){var s;(s=this._selectionService)==null||s.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!i&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let s=Yd(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let r=this.rows-1;return this.scrollLines(s.type===2?-r:r),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((s.key===T.ETX||s.key===T.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,i){let s=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return i.type==="keypress"?s:s&&(!i.keyCode||i.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(tu(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(e.which===null||e.which===void 0)i=e.keyCode;else if(e.which!==0&&e.charCode!==0)i=e.which;else return!1;return!i||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){var s;(s=this._charSizeService)==null||s.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(ge));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var i;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(i=this._selectionService)==null||i.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(T.ESC+"[I"):this.coreService.triggerDataEvent(T.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let i=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${T.ESC}[4;${s};${i}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${T.ESC}[6;${n};${r}t`);break}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),!1}};function tu(t){return t.keyCode===16||t.keyCode===17||t.keyCode===18}var iu=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let s={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(s),i.dispose=()=>this._wrappedAddonDispose(s),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){i=s;break}if(i===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(i,1)}},su=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,i){if(!(e<0||e>=this._line.length))return i?(this._line.loadCell(e,i),i):this._line.loadCell(e,new rt)}translateToString(e,i,s){return this._line.translateToString(e,i,s)}},Xn=class{constructor(t,e){this._buffer=t,this.type=e}init(t){return this._buffer=t,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(t){let e=this._buffer.lines.get(t);if(e)return new su(e)}getNullCell(){return new rt}},ru=class extends K{constructor(t){super(),this._core=t,this._onBufferChange=this._register(new P),this.onBufferChange=this._onBufferChange.event,this._normal=new Xn(this._core.buffers.normal,"normal"),this._alternate=new Xn(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},nu=class{constructor(t){this._core=t}registerCsiHandler(t,e){return this._core.registerCsiHandler(t,i=>e(i.toArray()))}addCsiHandler(t,e){return this.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._core.registerDcsHandler(t,(i,s)=>e(i,s.toArray()))}addDcsHandler(t,e){return this.registerDcsHandler(t,e)}registerEscHandler(t,e){return this._core.registerEscHandler(t,e)}addEscHandler(t,e){return this.registerEscHandler(t,e)}registerOscHandler(t,e){return this._core.registerOscHandler(t,e)}addOscHandler(t,e){return this.registerOscHandler(t,e)}},ou=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},au=["cols","rows"],ct=0,lu=class extends K{constructor(t){super(),this._core=this._register(new eu(t)),this._addonManager=this._register(new iu),this._publicOptions={...this._core.options};let e=s=>this._core.options[s],i=(s,r)=>{this._checkReadonlyOptions(s),this._core.options[s]=r};for(let s in this._core.options){let r={get:e.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this._publicOptions,s,r)}}_checkReadonlyOptions(t){if(au.includes(t))throw new Error(`Option "${t}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new nu(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new ou(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new ru(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,synchronizedOutputMode:t.synchronizedOutput,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,i){this._verifyIntegers(t,e,i),this._core.select(t,e,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r
|
|
27
|
-
`,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return{get promptLabel(){return
|
|
24
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),jr&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let i=this._getMouseBufferCoords(e),s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r||!i?!1:this._areCoordsInSelection(i,s,r)}isCellInSelection(e,i){let s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r?!1:this._areCoordsInSelection([e,i],s,r)}_areCoordsInSelection(e,i,s){return e[1]>i[1]&&e[1]<s[1]||i[1]===s[1]&&e[1]===i[1]&&e[0]>=i[0]&&e[0]<s[0]||i[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||i[1]<s[1]&&e[1]===i[1]&&e[0]>=i[0]}_selectWordAtCursor(e,i){var n,o;let s=(o=(n=this._linkifier.currentLink)==null?void 0:n.link)==null?void 0:o.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=Tn(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,i),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=Yr(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=s?0:(i>s&&(i-=s),i=Math.min(Math.max(i,-Rs),Rs),i/=Rs,i/Math.abs(i)+Math.round(i*(yd-1)))}shouldForceSelection(e){return us?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),Cd)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&i.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(us&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let r=s.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!i||i[0]!==this._model.selectionEnd[0]||i[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&i<xd&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let s=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(s&&s[0]!==void 0&&s[1]!==void 0){let r=fd(s[0]-1,s[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd,s=!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,i,s);return}!e||!i||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||i[0]!==this._oldSelectionEnd[0]||i[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,i,s)}_fireOnSelectionChange(e,i,s){this._oldSelectionStart=e,this._oldSelectionEnd=i,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(i=>this._handleTrim(i))}_convertViewportColToCharacterIndex(e,i){let s=i;for(let r=0;i>=r;r++){let n=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:n>1&&i!==r&&(s+=n-1)}return s}setSelection(e,i,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,s=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,o=n.lines.get(e[1]);if(!o)return;let l=n.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(o,e[0]),a=h,c=e[0]-h,d=0,u=0,_=0,f=0;if(l.charAt(h)===" "){for(;h>0&&l.charAt(h-1)===" ";)h--;for(;a<l.length&&l.charAt(a+1)===" ";)a++}else{let C=e[0],k=e[0];o.getWidth(C)===0&&(d++,C--),o.getWidth(k)===2&&(u++,k++);let L=o.getString(k).length;for(L>1&&(f+=L-1,a+=L-1);C>0&&h>0&&!this._isCharWordSeparator(o.loadCell(C-1,this._workCell));){o.loadCell(C-1,this._workCell);let g=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,C--):g>1&&(_+=g-1,h-=g-1),h--,C--}for(;k<o.length&&a+1<l.length&&!this._isCharWordSeparator(o.loadCell(k+1,this._workCell));){o.loadCell(k+1,this._workCell);let g=this._workCell.getChars().length;this._workCell.getWidth()===2?(u++,k++):g>1&&(f+=g-1,a+=g-1),a++,k++}}a++;let p=h+c-d+_,w=Math.min(this._bufferService.cols,a-h+d+u-_-f);if(!(!i&&l.slice(h,a).trim()==="")){if(s&&p===0&&o.getCodePoint(0)!==32){let C=n.lines.get(e[1]-1);if(C&&o.isWrapped&&C.getCodePoint(this._bufferService.cols-1)!==32){let k=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(k){let L=this._bufferService.cols-k.start;p-=L,w+=L}}}if(r&&p+w===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let C=n.lines.get(e[1]+1);if(C!=null&&C.isWrapped&&C.getCodePoint(0)!==32){let k=this._getWordAt([0,e[1]+1],!1,!1,!0);k&&(w+=k.length)}}return{start:p,length:w}}}_selectWordAt(e,i){let s=this._getWordAt(e,i);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let s=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),s={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Tn(s,this._bufferService.cols)}};yr=de([I(3,Ke),I(4,Xt),I(5,Wr),I(6,qe),I(7,Et),I(8,Lt)],yr);var An=class{constructor(){this._data={}}set(e,i,s){this._data[e]||(this._data[e]={}),this._data[e][i]=s}get(e,i){return this._data[e]?this._data[e][i]:void 0}clear(){this._data={}}},Dn=class{constructor(){this._color=new An,this._css=new An}setCss(e,i,s){this._css.set(e,i,s)}getCss(e,i){return this._css.get(e,i)}setColor(e,i,s){this._color.set(e,i,s)}getColor(e,i){return this._color.get(e,i)}clear(){this._color.clear(),this._css.clear()}},we=Object.freeze((()=>{let t=[ae.toColor("#2e3436"),ae.toColor("#cc0000"),ae.toColor("#4e9a06"),ae.toColor("#c4a000"),ae.toColor("#3465a4"),ae.toColor("#75507b"),ae.toColor("#06989a"),ae.toColor("#d3d7cf"),ae.toColor("#555753"),ae.toColor("#ef2929"),ae.toColor("#8ae234"),ae.toColor("#fce94f"),ae.toColor("#729fcf"),ae.toColor("#ad7fa8"),ae.toColor("#34e2e2"),ae.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let i=0;i<216;i++){let s=e[i/36%6|0],r=e[i/6%6|0],n=e[i%6];t.push({css:me.toCss(s,r,n),rgba:me.toRgba(s,r,n)})}for(let i=0;i<24;i++){let s=8+i*10;t.push({css:me.toCss(s,s,s),rgba:me.toRgba(s,s,s)})}return t})()),zt=ae.toColor("#ffffff"),ki=ae.toColor("#000000"),Pn=ae.toColor("#ffffff"),In=ki,pi={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Ed=zt,Cr=class extends Y{constructor(e){super(),this._optionsService=e,this._contrastCache=new Dn,this._halfContrastCache=new Dn,this._onChangeColors=this._register(new P),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:zt,background:ki,cursor:Pn,cursorAccent:In,selectionForeground:void 0,selectionBackgroundTransparent:pi,selectionBackgroundOpaque:se.blend(ki,pi),selectionInactiveBackgroundTransparent:pi,selectionInactiveBackgroundOpaque:se.blend(ki,pi),scrollbarSliderBackground:se.opacity(zt,.2),scrollbarSliderHoverBackground:se.opacity(zt,.4),scrollbarSliderActiveBackground:se.opacity(zt,.5),overviewRulerBorder:zt,ansi:we.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let i=this._colors;if(i.foreground=te(e.foreground,zt),i.background=te(e.background,ki),i.cursor=se.blend(i.background,te(e.cursor,Pn)),i.cursorAccent=se.blend(i.background,te(e.cursorAccent,In)),i.selectionBackgroundTransparent=te(e.selectionBackground,pi),i.selectionBackgroundOpaque=se.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=te(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=se.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?te(e.selectionForeground,Rn):void 0,i.selectionForeground===Rn&&(i.selectionForeground=void 0),se.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=se.opacity(i.selectionBackgroundTransparent,.3)),se.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=se.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=te(e.scrollbarSliderBackground,se.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=te(e.scrollbarSliderHoverBackground,se.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=te(e.scrollbarSliderActiveBackground,se.opacity(i.foreground,.5)),i.overviewRulerBorder=te(e.overviewRulerBorder,Ed),i.ansi=we.slice(),i.ansi[0]=te(e.black,we[0]),i.ansi[1]=te(e.red,we[1]),i.ansi[2]=te(e.green,we[2]),i.ansi[3]=te(e.yellow,we[3]),i.ansi[4]=te(e.blue,we[4]),i.ansi[5]=te(e.magenta,we[5]),i.ansi[6]=te(e.cyan,we[6]),i.ansi[7]=te(e.white,we[7]),i.ansi[8]=te(e.brightBlack,we[8]),i.ansi[9]=te(e.brightRed,we[9]),i.ansi[10]=te(e.brightGreen,we[10]),i.ansi[11]=te(e.brightYellow,we[11]),i.ansi[12]=te(e.brightBlue,we[12]),i.ansi[13]=te(e.brightMagenta,we[13]),i.ansi[14]=te(e.brightCyan,we[14]),i.ansi[15]=te(e.brightWhite,we[15]),e.extendedAnsi){let s=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<s;r++)i.ansi[r+16]=te(e.extendedAnsi[r],we[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let i=0;i<this._restoreColors.ansi.length;++i)this._colors.ansi[i]=this._restoreColors.ansi[i];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Cr=de([I(0,qe)],Cr);function te(t,e){if(t!==void 0)try{return ae.toColor(t)}catch{}return e}var Rd=class{constructor(...e){this._entries=new Map;for(let[i,s]of e)this.set(i,s)}set(e,i){let s=this._entries.get(e);return this._entries.set(e,i),s}forEach(e){for(let[i,s]of this._entries.entries())e(i,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},Md=class{constructor(){this._services=new Rd,this._services.set(Nr,this)}setService(t,e){this._services.set(t,e)}getService(t){return this._services.get(t)}createInstance(t,...e){let i=yh(t).sort((n,o)=>n.index-o.index),s=[];for(let n of i){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${n.id._id}.`);s.push(o)}let r=i.length>0?i[0].index:e.length;if(e.length!==r)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${r+1} conflicts with ${e.length} static arguments`);return new t(...e,...s)}},Bd={trace:0,debug:1,info:2,warn:3,error:4,off:5},Td="xterm.js: ",xr=class extends Y{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Bd[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)typeof e[i]=="function"&&(e[i]=e[i]())}_log(e,i,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":Td)+i,...s)}trace(e,...i){var s;this._logLevel<=0&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,e,i)}debug(e,...i){var s;this._logLevel<=1&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,e,i)}info(e,...i){var s;this._logLevel<=2&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.info.bind(this._optionsService.options.logger))??console.info,e,i)}warn(e,...i){var s;this._logLevel<=3&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,e,i)}error(e,...i){var s;this._logLevel<=4&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.error.bind(this._optionsService.options.logger))??console.error,e,i)}};xr=de([I(0,qe)],xr);var On=class extends Y{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new P),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new P),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new P),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let i=new Array(e);for(let s=0;s<Math.min(e,this.length);s++)i[s]=this._array[this._getCyclicIndex(s)];this._array=i,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let i=this._length;i<e;i++)this._array[i]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,i){this._array[this._getCyclicIndex(e)]=i}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,i,...s){if(i){for(let r=e;r<this._length-i;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+i)];this._length-=i,this.onDeleteEmitter.fire({index:e,amount:i})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+s.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<s.length;r++)this._array[this._getCyclicIndex(e+r)]=s[r];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let r=this._length+s.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,s){if(!(i<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let n=i-1;n>=0;n--)this.set(e+n+s,this.get(e+n));let r=e+i+s-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<i;r++)this.set(e+r+s,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},V=3,pe=Object.freeze(new $i),Yi=0,Ms=2,Li=class Ta{constructor(e,i,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*V);let r=i||rt.fromCharData([0,Xo,1,0]);for(let n=0;n<e;++n)this.setCell(n,r);this.length=e}get(e){let i=this._data[e*V+0],s=i&2097151;return[this._data[e*V+1],i&2097152?this._combined[e]:s?Ot(s):"",i>>22,i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):s]}set(e,i){this._data[e*V+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[e*V+0]=e|2097152|i[2]<<22):this._data[e*V+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[e*V+0]>>22}hasWidth(e){return this._data[e*V+0]&12582912}getFg(e){return this._data[e*V+1]}getBg(e){return this._data[e*V+2]}hasContent(e){return this._data[e*V+0]&4194303}getCodePoint(e){let i=this._data[e*V+0];return i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):i&2097151}isCombined(e){return this._data[e*V+0]&2097152}getString(e){let i=this._data[e*V+0];return i&2097152?this._combined[e]:i&2097151?Ot(i&2097151):""}isProtected(e){return this._data[e*V+2]&536870912}loadCell(e,i){return Yi=e*V,i.content=this._data[Yi+0],i.fg=this._data[Yi+1],i.bg=this._data[Yi+2],i.content&2097152&&(i.combinedData=this._combined[e]),i.bg&268435456&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){i.content&2097152&&(this._combined[e]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[e]=i.extended),this._data[e*V+0]=i.content,this._data[e*V+1]=i.fg,this._data[e*V+2]=i.bg}setCellFromCodepoint(e,i,s,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*V+0]=i|s<<22,this._data[e*V+1]=r.fg,this._data[e*V+2]=r.bg}addCodepointToCell(e,i,s){let r=this._data[e*V+0];r&2097152?this._combined[e]+=Ot(i):r&2097151?(this._combined[e]=Ot(r&2097151)+Ot(i),r&=-2097152,r|=2097152):r=i|1<<22,s&&(r&=-12582913,r|=s<<22),this._data[e*V+0]=r}insertCells(e,i,s){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),i<this.length-e){let r=new rt;for(let n=this.length-e-i-1;n>=0;--n)this.setCell(e+i+n,this.loadCell(e+n,r));for(let n=0;n<i;++n)this.setCell(e+n,s)}else for(let r=e;r<this.length;++r)this.setCell(r,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(e,i,s){if(e%=this.length,i<this.length-e){let r=new rt;for(let n=0;n<this.length-e-i;++n)this.setCell(e+n,this.loadCell(e+i+n,r));for(let n=this.length-i;n<this.length;++n)this.setCell(n,s)}else for(let r=e;r<this.length;++r)this.setCell(r,s);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,s)}replaceCells(e,i,s,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,s);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,s),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,s);e<i&&e<this.length;)this.setCell(e++,s)}resize(e,i){if(e===this.length)return this._data.length*4*Ms<this._data.buffer.byteLength;let s=e*V;if(e>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r<e;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,s);let r=Object.keys(this._combined);for(let o=0;o<r.length;o++){let l=parseInt(r[o],10);l>=e&&delete this._combined[l]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let l=parseInt(n[o],10);l>=e&&delete this._extendedAttrs[l]}}return this.length=e,s*4*Ms<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Ms<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,e);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,e)}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let i in e._combined)this._combined[i]=e._combined[i];this._extendedAttrs={};for(let i in e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){let e=new Ta(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let i in this._combined)e._combined[i]=this._combined[i];for(let i in this._extendedAttrs)e._extendedAttrs[i]=this._extendedAttrs[i];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*V+0]&4194303)return e+(this._data[e*V+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*V+0]&4194303||this._data[e*V+2]&50331648)return e+(this._data[e*V+0]>>22);return 0}copyCellsFrom(e,i,s,r,n){let o=e._data;if(n)for(let h=r-1;h>=0;h--){for(let a=0;a<V;a++)this._data[(s+h)*V+a]=o[(i+h)*V+a];o[(i+h)*V+2]&268435456&&(this._extendedAttrs[s+h]=e._extendedAttrs[i+h])}else for(let h=0;h<r;h++){for(let a=0;a<V;a++)this._data[(s+h)*V+a]=o[(i+h)*V+a];o[(i+h)*V+2]&268435456&&(this._extendedAttrs[s+h]=e._extendedAttrs[i+h])}let l=Object.keys(e._combined);for(let h=0;h<l.length;h++){let a=parseInt(l[h],10);a>=i&&(this._combined[a-i+s]=e._combined[a])}}translateToString(e,i,s,r){i=i??0,s=s??this.length,e&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;i<s;){let o=this._data[i*V+0],l=o&2097151,h=o&2097152?this._combined[i]:l?Ot(l):Ft;if(n+=h,r)for(let a=0;a<h.length;++a)r.push(i);i+=o>>22||1}return r&&r.push(i),n}};function Ad(t,e,i,s,r,n){let o=[];for(let l=0;l<t.length-1;l++){let h=l,a=t.get(++h);if(!a.isWrapped)continue;let c=[t.get(l)];for(;h<t.length&&a.isWrapped;)c.push(a),a=t.get(++h);if(!n&&s>=l&&s<h){l+=c.length-1;continue}let d=0,u=Oi(c,d,e),_=1,f=0;for(;_<c.length;){let w=Oi(c,_,e),C=w-f,k=i-u,L=Math.min(C,k);c[d].copyCellsFrom(c[_],f,u,L,!1),u+=L,u===i&&(d++,u=0),f+=L,f===w&&(_++,f=0),u===0&&d!==0&&c[d-1].getWidth(i-1)===2&&(c[d].copyCellsFrom(c[d-1],i-1,u++,1,!1),c[d-1].setCell(i-1,r))}c[d].replaceCells(u,i,r);let p=0;for(let w=c.length-1;w>0&&(w>d||c[w].getTrimmedLength()===0);w--)p++;p>0&&(o.push(l+c.length-p),o.push(p)),l+=c.length-1}return o}function Dd(t,e){let i=[],s=0,r=e[s],n=0;for(let o=0;o<t.length;o++)if(r===o){let l=e[++s];t.onDeleteEmitter.fire({index:o-n,amount:l}),o+=l-1,n+=l,r=e[++s]}else i.push(o);return{layout:i,countRemoved:n}}function Pd(t,e){let i=[];for(let s=0;s<e.length;s++)i.push(t.get(e[s]));for(let s=0;s<i.length;s++)t.set(s,i[s]);t.length=e.length}function Id(t,e,i){let s=[],r=t.map((h,a)=>Oi(t,a,e)).reduce((h,a)=>h+a),n=0,o=0,l=0;for(;l<r;){if(r-l<i){s.push(r-l);break}n+=i;let h=Oi(t,o,e);n>h&&(n-=h,o++);let a=t[o].getWidth(n-1)===2;a&&n--;let c=a?i-1:i;s.push(c),l+=c}return s}function Oi(t,e,i){if(e===t.length-1)return t[e].getTrimmedLength();let s=!t[e].hasContent(i-1)&&t[e].getWidth(i-1)===1,r=t[e+1].getWidth(0)===2;return s&&r?i-1:i}var Aa=class Da{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=Da._nextId++,this._onDispose=this.register(new P),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),jt(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};Aa._nextId=1;var Od=Aa,ye={},Ht=ye.B;ye[0]={"`":"◆",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:"≥","{":"π","|":"≠","}":"£","~":"·"};ye.A={"#":"£"};ye.B=void 0;ye[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ye.C=ye[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ye.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ye.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ye.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ye.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ye.E=ye[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ye.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ye.H=ye[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ye["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Fn=4294967295,$n=class{constructor(t,e,i){this._hasScrollback=t,this._optionsService=e,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=pe.clone(),this.savedCharset=Ht,this.markers=[],this._nullCell=rt.fromCharData([0,Xo,1,0]),this._whitespaceCell=rt.fromCharData([0,Ft,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new _s,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new On(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new hs),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new hs),this._whitespaceCell}getBlankLine(t,e){return new Li(this._bufferService.cols,this.getNullCell(t),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows}_getCorrectBufferLength(t){if(!this._hasScrollback)return t;let e=t+this._optionsService.rawOptions.scrollback;return e>Fn?Fn:e}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=pe);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new On(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let i=this.getNullCell(pe),s=0,r=this._getCorrectBufferLength(e);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<t)for(let o=0;o<this.lines.length;o++)s+=+this.lines.get(o).resize(t,i);let n=0;if(this._rows<e)for(let o=this._rows;o<e;o++)this.lines.length<e+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Li(t,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new Li(t,i)));else for(let o=this._rows;o>e;o--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let o=this.lines.length-r;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=r}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,e-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(t,e),this._cols>t))for(let n=0;n<this.lines.length;n++)s+=+this.lines.get(n).resize(t,i);this._cols=t,this._rows=e,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let e=0;for(;this._memoryCleanupPosition<this.lines.length;)if(e+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),e>100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,e){this._cols!==t&&(t>this._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))}_reflowLarger(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,s=Ad(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(pe),i);if(s.length>0){let r=Dd(this.lines,s);Pd(this.lines,r.layout),this._reflowLargerAdjustViewport(t,e,r.countRemoved)}}_reflowLargerAdjustViewport(t,e,i){let s=this.getNullCell(pe),r=i;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<e&&this.lines.push(new Li(t,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(pe),r=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=t)continue;let h=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),h.unshift(l);if(!i){let L=this.ybase+this.y;if(L>=o&&L<o+h.length)continue}let a=h[h.length-1].getTrimmedLength(),c=Id(h,this._cols,t),d=c.length-h.length,u;this.ybase===0&&this.y!==this.lines.length-1?u=Math.max(0,this.y-this.lines.maxLength+d):u=Math.max(0,this.lines.length-this.lines.maxLength+d);let _=[];for(let L=0;L<d;L++){let g=this.getBlankLine(pe,!0);_.push(g)}_.length>0&&(r.push({start:o+h.length+n,newLines:_}),n+=_.length),h.push(..._);let f=c.length-1,p=c[f];p===0&&(f--,p=c[f]);let w=h.length-d-1,C=a;for(;w>=0;){let L=Math.min(C,p);if(h[f]===void 0)break;if(h[f].copyCellsFrom(h[w],C-L,p-L,L,!0),p-=L,p===0&&(f--,p=c[f]),C-=L,C===0){w--;let g=Math.max(w,0);C=Oi(h,g,this._cols)}}for(let L=0;L<h.length;L++)c[L]<t&&h[L].setCell(c[L],s);let k=d-u;for(;k-- >0;)this.ybase===0?this.y<e-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-e&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+e-1)}if(r.length>0){let o=[],l=[];for(let p=0;p<this.lines.length;p++)l.push(this.lines.get(p));let h=this.lines.length,a=h-1,c=0,d=r[c];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let u=0;for(let p=Math.min(this.lines.maxLength-1,h+n-1);p>=0;p--)if(d&&d.start>a+u){for(let w=d.newLines.length-1;w>=0;w--)this.lines.set(p--,d.newLines[w]);p++,o.push({index:a+1,amount:d.newLines.length}),u+=d.newLines.length,d=r[++c]}else this.lines.set(p,l[a--]);let _=0;for(let p=o.length-1;p>=0;p--)o[p].index+=_,this.lines.onInsertEmitter.fire(o[p]),_+=o[p].amount;let f=Math.max(0,h+n-this.lines.maxLength);f>0&&this.lines.onTrimEmitter.fire(f)}}translateBufferLineToString(t,e,i=0,s){let r=this.lines.get(t);return r?r.translateToString(e,i,s):""}getWrappedRangeForLine(t){let e=t,i=t;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:e,last:i}}setupTabStops(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.rawOptions.tabStopWidth)this.tabs[t]=!0}prevStop(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].line===t&&(this.markers[e].dispose(),this.markers.splice(e--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].dispose();this.markers.length=0,this._isClearing=!1}addMarker(t){let e=new Od(t);return this.markers.push(e),e.register(this.lines.onTrim(i=>{e.line-=i,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(i=>{e.line>=i.index&&(e.line+=i.amount)})),e.register(this.lines.onDelete(i=>{e.line>=i.index&&e.line<i.index+i.amount&&e.dispose(),e.line>i.index&&(e.line-=i.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}},Fd=class extends Y{constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new P),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new $n(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new $n(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Pa=2,Ia=1,kr=class extends Y{constructor(t){super(),this.isUserScrolling=!1,this._onResize=this._register(new P),this.onResize=this._onResize.event,this._onScroll=this._register(new P),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,Pa),this.rows=Math.max(t.rawOptions.rows||0,Ia),this.buffers=this._register(new Fd(t,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(t,e){let i=this.cols!==t,s=this.rows!==e;this.cols=t,this.rows=e,this.buffers.resize(t,e),this._onResize.fire({cols:t,rows:e,colsChanged:i,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,e=!1){let i=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==t.fg||s.getBg(0)!==t.bg)&&(s=i.getBlankLine(t,e),this._cachedBlankLine=s),s.isWrapped=e;let r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let o=i.lines.isFull;n===i.lines.length-1?o?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),o?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let o=n-r+1;i.lines.shiftElements(r+1,o-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(t,e){let i=this.buffer;if(t<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else t+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let s=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+t,i.ybase),0),s!==i.ydisp&&(e||this._onScroll.fire(i.ydisp))}};kr=de([I(0,qe)],kr);var Qt={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:us,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},$d=["normal","bold","100","200","300","400","500","600","700","800","900"],Nd=class extends Y{constructor(e){super(),this._onOptionChange=this._register(new P),this.onOptionChange=this._onOptionChange.event;let i={...Qt};for(let s in e)if(s in i)try{let r=e[s];i[s]=this._sanitizeAndValidateOption(s,r)}catch(r){console.error(r)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(ne(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(s=>{s===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&i()})}_setupOptions(){let e=s=>{if(!(s in Qt))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},i=(s,r)=>{if(!(s in Qt))throw new Error(`No option with key "${s}"`);r=this._sanitizeAndValidateOption(s,r),this.rawOptions[s]!==r&&(this.rawOptions[s]=r,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let r={get:e.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this.options,s,r)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=Qt[e]),!Wd(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=Qt[e]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=$d.includes(i)?i:Qt[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(i*10)/10));break;case"scrollback":if(i=Math.min(i,4294967295),i<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{};break}return i}};function Wd(t){return t==="block"||t==="underline"||t==="bar"}function Ei(t,e=5){if(typeof t!="object")return t;let i=Array.isArray(t)?[]:{};for(let s in t)i[s]=e<=1?t[s]:t[s]&&Ei(t[s],e-1);return i}var Nn=Object.freeze({insertMode:!1}),Wn=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Lr=class extends Y{constructor(e,i,s){super(),this._bufferService=e,this._logService=i,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new P),this.onData=this._onData.event,this._onUserInput=this._register(new P),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new P),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new P),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Ei(Nn),this.decPrivateModes=Ei(Wn)}reset(){this.modes=Ei(Nn),this.decPrivateModes=Ei(Wn)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onBinary.fire(e))}};Lr=de([I(0,Ke),I(1,ta),I(2,qe)],Lr);var zn={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button===4||t.action!==1?!1:(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>!(t.action===32&&t.button===3)},ANY:{events:31,restrict:t=>!0}};function Bs(t,e){let i=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(i|=64,i|=t.action):(i|=t.button&3,t.button&4&&(i|=64),t.button&8&&(i|=128),t.action===32?i|=32:t.action===0&&!e&&(i|=3)),i}var Ts=String.fromCharCode,Hn={DEFAULT:t=>{let e=[Bs(t,!1)+32,t.col+32,t.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${Ts(e[0])}${Ts(e[1])}${Ts(e[2])}`},SGR:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Bs(t,!0)};${t.col};${t.row}${e}`},SGR_PIXELS:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Bs(t,!0)};${t.x};${t.y}${e}`}},Er=class extends Y{constructor(t,e,i){super(),this._bufferService=t,this._coreService=e,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new P),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(zn))this.addProtocol(s,zn[s]);for(let s of Object.keys(Hn))this.addEncoding(s,Hn[s]);this.reset()}addProtocol(t,e){this._protocols[t]=e}addEncoding(t,e){this._encodings[t]=e}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(t,e,i){if(t.deltaY===0||t.shiftKey||e===void 0||i===void 0)return 0;let s=e/i,r=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(t.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(t,e){return e.altKey||e.ctrlKey||e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let e=this._encodings[this._activeEncoding](t);return e&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(e):this._coreService.triggerDataEvent(e,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(t&1),up:!!(t&2),drag:!!(t&4),move:!!(t&8),wheel:!!(t&16)}}_equalEvents(t,e,i){if(i){if(t.x!==e.x||t.y!==e.y)return!1}else if(t.col!==e.col||t.row!==e.row)return!1;return!(t.button!==e.button||t.action!==e.action||t.ctrl!==e.ctrl||t.alt!==e.alt||t.shift!==e.shift)}};Er=de([I(0,Ke),I(1,Xt),I(2,qe)],Er);var As=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],zd=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],be;function Hd(t,e){let i=0,s=e.length-1,r;if(t<e[0][0]||t>e[s][1])return!1;for(;s>=i;)if(r=i+s>>1,t>e[r][1])i=r+1;else if(t<e[r][0])s=r-1;else return!0;return!1}var Ud=class{constructor(){if(this.version="6",!be){be=new Uint8Array(65536),be.fill(1),be[0]=0,be.fill(0,1,32),be.fill(0,127,160),be.fill(2,4352,4448),be[9001]=2,be[9002]=2,be.fill(2,11904,42192),be[12351]=1,be.fill(2,44032,55204),be.fill(2,63744,64256),be.fill(2,65040,65050),be.fill(2,65072,65136),be.fill(2,65280,65377),be.fill(2,65504,65511);for(let e=0;e<As.length;++e)be.fill(0,As[e][0],As[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?be[e]:Hd(e,zd)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,i){let s=this.wcwidth(e),r=s===0&&i!==0;if(r){let n=Ut.extractWidth(i);n===0?r=!1:n>s&&(s=n)}return Ut.createPropertyValue(0,s,r)}},Ut=class rs{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new P,this.onChange=this._onChange.event;let e=new Ud;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,s=!1){return(e&16777215)<<3|(i&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let i=0,s=0,r=e.length;for(let n=0;n<r;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=r)return i+this.wcwidth(o);let a=e.charCodeAt(n);56320<=a&&a<=57343?o=(o-55296)*1024+a-56320+65536:i+=this.wcwidth(a)}let l=this.charProperties(o,s),h=rs.extractWidth(l);rs.extractShouldJoin(l)&&(h-=rs.extractWidth(s)),i+=h,s=l}return i}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},Kd=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,i){this._charsets[e]=i,this.glevel===e&&(this.charset=i)}};function Un(t){var s;let e=(s=t.buffer.lines.get(t.buffer.ybase+t.buffer.y-1))==null?void 0:s.get(t.cols-1),i=t.buffer.lines.get(t.buffer.ybase+t.buffer.y);i&&e&&(i.isWrapped=e[3]!==0&&e[3]!==32)}var vi=2147483647,qd=256,Oa=class Rr{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>qd)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let i=new Rr;if(!e.length)return i;for(let s=Array.isArray(e[0])?1:0;s<e.length;++s){let r=e[s];if(Array.isArray(r))for(let n=0;n<r.length;++n)i.addSubParam(r[n]);else i.addParam(r)}return i}clone(){let e=new Rr(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let i=0;i<this.length;++i){e.push(this.params[i]);let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&e.push(Array.prototype.slice.call(this._subParams,s,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>vi?vi:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>vi?vi:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,s=this._subParamsIdx[e]&255;return s-i>0?this._subParams.subarray(i,s):null}getSubParamsAll(){let e={};for(let i=0;i<this.length;++i){let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&(e[i]=this._subParams.slice(s,r))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[i-1];s[i-1]=~r?Math.min(r*10+e,vi):e}},mi=[],Vd=class{constructor(){this._state=0,this._active=mi,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(i),{dispose:()=>{let r=s.indexOf(i);r!==-1&&s.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=mi}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=mi,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||mi,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,i,s){if(!this._active.length)this._handlerFb(this._id,"PUT",ps(e,i,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,i,s)}start(){this.reset(),this._state=1}put(e,i,s){if(this._state!==3){if(this._state===1)for(;i<s;){let r=e[i++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&s-i>0&&this._put(e,i,s)}}end(e,i=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let s=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&s===!1){for(;r>=0&&(s=this._active[r].end(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=mi,this._id=-1,this._state=0}}},Ze=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,i,s){this._hitLimit||(this._data+=ps(e,i,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data),i instanceof Promise))return i.then(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,i}},Si=[],Yd=class{constructor(){this._handlers=Object.create(null),this._active=Si,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Si}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(i),{dispose:()=>{let r=s.indexOf(i);r!==-1&&s.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Si,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Si,!this._active.length)this._handlerFb(this._ident,"HOOK",i);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(i)}put(e,i,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",ps(e,i,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,i,s)}unhook(e,i=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&s===!1){for(;r>=0&&(s=this._active[r].unhook(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=Si,this._ident=0}},Ri=new Oa;Ri.addParam(0);var Kn=class{constructor(t){this._handler=t,this._data="",this._params=Ri,this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():Ri,this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=ps(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(i=>(this._params=Ri,this._data="",this._hitLimit=!1,i));return this._params=Ri,this._data="",this._hitLimit=!1,e}},jd=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,s,r){this.table[i<<8|e]=s<<4|r}addMany(e,i,s,r){for(let n=0;n<e.length;n++)this.table[i<<8|e[n]]=s<<4|r}},it=160,Gd=(function(){let t=new jd(4095),e=Array.apply(null,Array(256)).map((l,h)=>h),i=(l,h)=>e.slice(l,h),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let n=i(0,14),o;t.setDefault(1,0),t.addMany(s,0,2,0);for(o in n)t.addMany([24,26,153,154],o,3,0),t.addMany(i(128,144),o,3,0),t.addMany(i(144,152),o,3,0),t.add(156,o,0,0),t.add(27,o,11,1),t.add(157,o,4,8),t.addMany([152,158,159],o,0,7),t.add(155,o,11,3),t.add(144,o,11,9);return t.addMany(r,0,3,0),t.addMany(r,1,3,1),t.add(127,1,0,1),t.addMany(r,8,0,8),t.addMany(r,3,3,3),t.add(127,3,0,3),t.addMany(r,4,3,4),t.add(127,4,0,4),t.addMany(r,6,3,6),t.addMany(r,5,3,5),t.add(127,5,0,5),t.addMany(r,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(s,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(i(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(s,7,0,7),t.addMany(r,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(i(64,127),3,7,0),t.addMany(i(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(i(48,60),4,8,4),t.addMany(i(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(i(32,64),6,0,6),t.add(127,6,0,6),t.addMany(i(64,127),6,0,0),t.addMany(i(32,48),3,9,5),t.addMany(i(32,48),5,9,5),t.addMany(i(48,64),5,0,6),t.addMany(i(64,127),5,7,0),t.addMany(i(32,48),4,9,5),t.addMany(i(32,48),1,9,2),t.addMany(i(32,48),2,9,2),t.addMany(i(48,127),2,10,0),t.addMany(i(48,80),1,10,0),t.addMany(i(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(i(96,127),1,10,0),t.add(80,1,11,9),t.addMany(r,9,0,9),t.add(127,9,0,9),t.addMany(i(28,32),9,0,9),t.addMany(i(32,48),9,9,12),t.addMany(i(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(r,11,0,11),t.addMany(i(32,128),11,0,11),t.addMany(i(28,32),11,0,11),t.addMany(r,10,0,10),t.add(127,10,0,10),t.addMany(i(28,32),10,0,10),t.addMany(i(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(i(32,48),10,9,12),t.addMany(r,12,0,12),t.add(127,12,0,12),t.addMany(i(28,32),12,0,12),t.addMany(i(32,48),12,9,12),t.addMany(i(48,64),12,0,11),t.addMany(i(64,127),12,12,13),t.addMany(i(64,127),10,12,13),t.addMany(i(64,127),9,12,13),t.addMany(r,13,13,13),t.addMany(s,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(it,0,2,0),t.add(it,8,5,8),t.add(it,6,0,6),t.add(it,11,0,11),t.add(it,13,13,13),t})(),Xd=class extends Y{constructor(e=Gd){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Oa,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,s,r)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,s)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(ne(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Vd),this._dcsParser=this._register(new Yd),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let n=0;n<e.intermediates.length;++n){let o=e.intermediates.charCodeAt(n);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(i[0]>r||r>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return s<<=8,s|=r,s}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(e&255)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let r=this._escHandlers[s];return r.push(i),{dispose:()=>{let n=r.indexOf(i);n!==-1&&r.splice(n,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let r=this._csiHandlers[s];return r.push(i),{dispose:()=>{let n=r.indexOf(i);n!==-1&&r.splice(n,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,i,s,r,n){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=s,this._parseStack.transition=r,this._parseStack.chunkPos=n}parse(e,i,s){let r=0,n=0,o=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&a>-1){for(;a>=0&&(l=h[a](this._params),l!==!0);a--)if(l instanceof Promise)return this._parseStack.handlerPos=a,l}this._parseStack.handlers=[];break;case 4:if(s===!1&&a>-1){for(;a>=0&&(l=h[a](),l!==!0);a--)if(l instanceof Promise)return this._parseStack.handlerPos=a,l}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(r!==24&&r!==26,s),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],l=this._oscParser.end(r!==24&&r!==26,s),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=o;h<i;++h){switch(r=e[h],n=this._transitions.table[this.currentState<<8|(r<160?r:it)],n>>4){case 2:for(let _=h+1;;++_){if(_>=i||(r=e[_])<32||r>126&&r<it){this._printHandler(e,h,_),h=_-1;break}if(++_>=i||(r=e[_])<32||r>126&&r<it){this._printHandler(e,h,_),h=_-1;break}if(++_>=i||(r=e[_])<32||r>126&&r<it){this._printHandler(e,h,_),h=_-1;break}if(++_>=i||(r=e[_])<32||r>126&&r<it){this._printHandler(e,h,_),h=_-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],c=a?a.length-1:-1;for(;c>=0&&(l=a[c](this._params),l!==!0);c--)if(l instanceof Promise)return this._preserveStack(3,a,c,n,h),l;c<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++h<i&&(r=e[h])>47&&r<60);h--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let d=this._escHandlers[this._collect<<8|r],u=d?d.length-1:-1;for(;u>=0&&(l=d[u](),l!==!0);u--)if(l instanceof Promise)return this._preserveStack(4,d,u,n,h),l;u<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let _=h+1;;++_)if(_>=i||(r=e[_])===24||r===26||r===27||r>127&&r<it){this._dcsParser.put(e,h,_),h=_-1;break}break;case 14:if(l=this._dcsParser.unhook(r!==24&&r!==26),l)return this._preserveStack(6,[],0,n,h),l;r===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let _=h+1;;_++)if(_>=i||(r=e[_])<32||r>127&&r<it){this._oscParser.put(e,h,_),h=_-1;break}break;case 6:if(l=this._oscParser.end(r!==24&&r!==26),l)return this._preserveStack(5,[],0,n,h),l;r===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=n&15}}},Zd=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,Jd=/^[\da-f]+$/;function qn(t){if(!t)return;let e=t.toLowerCase();if(e.indexOf("rgb:")===0){e=e.slice(4);let i=Zd.exec(e);if(i){let s=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/s*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/s*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/s*255)]}}else if(e.indexOf("#")===0&&(e=e.slice(1),Jd.exec(e)&&[3,6,9,12].includes(e.length))){let i=e.length/3,s=[0,0,0];for(let r=0;r<3;++r){let n=parseInt(e.slice(i*r,i*r+i),16);s[r]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return s}}function Ds(t,e){let i=t.toString(16),s=i.length<2?"0"+i:i;switch(e){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function Qd(t,e=16){let[i,s,r]=t;return`rgb:${Ds(i,e)}/${Ds(s,e)}/${Ds(r,e)}`}var eu={"(":0,")":1,"*":2,"+":3,"-":1,".":2},At=131072,Vn=10;function Yn(t,e){if(t>24)return e.setWinLines||!1;switch(t){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var jn=5e3,Gn=0,tu=class extends Y{constructor(t,e,i,s,r,n,o,l,h=new Xd){super(),this._bufferService=t,this._charsetService=e,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=l,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new wh,this._utf8Decoder=new bh,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=pe.clone(),this._eraseAttrDataInternal=pe.clone(),this._onRequestBell=this._register(new P),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new P),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new P),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new P),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new P),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new P),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new P),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new P),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new P),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new P),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new P),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new P),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new P),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new Mr(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(a=>this._activeBuffer=a.activeBuffer)),this._parser.setCsiHandlerFallback((a,c)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(a),params:c.toArray()})}),this._parser.setEscHandlerFallback(a=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(a)})}),this._parser.setExecuteHandlerFallback(a=>{this._logService.debug("Unknown EXECUTE code: ",{code:a})}),this._parser.setOscHandlerFallback((a,c,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:a,action:c,data:d})}),this._parser.setDcsHandlerFallback((a,c,d)=>{c==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(a),action:c,payload:d})}),this._parser.setPrintHandler((a,c,d)=>this.print(a,c,d)),this._parser.registerCsiHandler({final:"@"},a=>this.insertChars(a)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},a=>this.scrollLeft(a)),this._parser.registerCsiHandler({final:"A"},a=>this.cursorUp(a)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},a=>this.scrollRight(a)),this._parser.registerCsiHandler({final:"B"},a=>this.cursorDown(a)),this._parser.registerCsiHandler({final:"C"},a=>this.cursorForward(a)),this._parser.registerCsiHandler({final:"D"},a=>this.cursorBackward(a)),this._parser.registerCsiHandler({final:"E"},a=>this.cursorNextLine(a)),this._parser.registerCsiHandler({final:"F"},a=>this.cursorPrecedingLine(a)),this._parser.registerCsiHandler({final:"G"},a=>this.cursorCharAbsolute(a)),this._parser.registerCsiHandler({final:"H"},a=>this.cursorPosition(a)),this._parser.registerCsiHandler({final:"I"},a=>this.cursorForwardTab(a)),this._parser.registerCsiHandler({final:"J"},a=>this.eraseInDisplay(a,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},a=>this.eraseInDisplay(a,!0)),this._parser.registerCsiHandler({final:"K"},a=>this.eraseInLine(a,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},a=>this.eraseInLine(a,!0)),this._parser.registerCsiHandler({final:"L"},a=>this.insertLines(a)),this._parser.registerCsiHandler({final:"M"},a=>this.deleteLines(a)),this._parser.registerCsiHandler({final:"P"},a=>this.deleteChars(a)),this._parser.registerCsiHandler({final:"S"},a=>this.scrollUp(a)),this._parser.registerCsiHandler({final:"T"},a=>this.scrollDown(a)),this._parser.registerCsiHandler({final:"X"},a=>this.eraseChars(a)),this._parser.registerCsiHandler({final:"Z"},a=>this.cursorBackwardTab(a)),this._parser.registerCsiHandler({final:"`"},a=>this.charPosAbsolute(a)),this._parser.registerCsiHandler({final:"a"},a=>this.hPositionRelative(a)),this._parser.registerCsiHandler({final:"b"},a=>this.repeatPrecedingCharacter(a)),this._parser.registerCsiHandler({final:"c"},a=>this.sendDeviceAttributesPrimary(a)),this._parser.registerCsiHandler({prefix:">",final:"c"},a=>this.sendDeviceAttributesSecondary(a)),this._parser.registerCsiHandler({final:"d"},a=>this.linePosAbsolute(a)),this._parser.registerCsiHandler({final:"e"},a=>this.vPositionRelative(a)),this._parser.registerCsiHandler({final:"f"},a=>this.hVPosition(a)),this._parser.registerCsiHandler({final:"g"},a=>this.tabClear(a)),this._parser.registerCsiHandler({final:"h"},a=>this.setMode(a)),this._parser.registerCsiHandler({prefix:"?",final:"h"},a=>this.setModePrivate(a)),this._parser.registerCsiHandler({final:"l"},a=>this.resetMode(a)),this._parser.registerCsiHandler({prefix:"?",final:"l"},a=>this.resetModePrivate(a)),this._parser.registerCsiHandler({final:"m"},a=>this.charAttributes(a)),this._parser.registerCsiHandler({final:"n"},a=>this.deviceStatus(a)),this._parser.registerCsiHandler({prefix:"?",final:"n"},a=>this.deviceStatusPrivate(a)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},a=>this.softReset(a)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},a=>this.setCursorStyle(a)),this._parser.registerCsiHandler({final:"r"},a=>this.setScrollRegion(a)),this._parser.registerCsiHandler({final:"s"},a=>this.saveCursor(a)),this._parser.registerCsiHandler({final:"t"},a=>this.windowOptions(a)),this._parser.registerCsiHandler({final:"u"},a=>this.restoreCursor(a)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},a=>this.insertColumns(a)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},a=>this.deleteColumns(a)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},a=>this.selectProtected(a)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},a=>this.requestMode(a,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},a=>this.requestMode(a,!1)),this._parser.setExecuteHandler(B.BEL,()=>this.bell()),this._parser.setExecuteHandler(B.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(B.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(B.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(B.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(B.BS,()=>this.backspace()),this._parser.setExecuteHandler(B.HT,()=>this.tab()),this._parser.setExecuteHandler(B.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(B.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(is.IND,()=>this.index()),this._parser.setExecuteHandler(is.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(is.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ze(a=>(this.setTitle(a),this.setIconName(a),!0))),this._parser.registerOscHandler(1,new Ze(a=>this.setIconName(a))),this._parser.registerOscHandler(2,new Ze(a=>this.setTitle(a))),this._parser.registerOscHandler(4,new Ze(a=>this.setOrReportIndexedColor(a))),this._parser.registerOscHandler(8,new Ze(a=>this.setHyperlink(a))),this._parser.registerOscHandler(10,new Ze(a=>this.setOrReportFgColor(a))),this._parser.registerOscHandler(11,new Ze(a=>this.setOrReportBgColor(a))),this._parser.registerOscHandler(12,new Ze(a=>this.setOrReportCursorColor(a))),this._parser.registerOscHandler(104,new Ze(a=>this.restoreIndexedColor(a))),this._parser.registerOscHandler(110,new Ze(a=>this.restoreFgColor(a))),this._parser.registerOscHandler(111,new Ze(a=>this.restoreBgColor(a))),this._parser.registerOscHandler(112,new Ze(a=>this.restoreCursorColor(a))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let a in ye)this._parser.registerEscHandler({intermediates:"(",final:a},()=>this.selectCharset("("+a)),this._parser.registerEscHandler({intermediates:")",final:a},()=>this.selectCharset(")"+a)),this._parser.registerEscHandler({intermediates:"*",final:a},()=>this.selectCharset("*"+a)),this._parser.registerEscHandler({intermediates:"+",final:a},()=>this.selectCharset("+"+a)),this._parser.registerEscHandler({intermediates:"-",final:a},()=>this.selectCharset("-"+a)),this._parser.registerEscHandler({intermediates:".",final:a},()=>this.selectCharset("."+a)),this._parser.registerEscHandler({intermediates:"/",final:a},()=>this.selectCharset("/"+a));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(a=>(this._logService.error("Parsing error: ",a),a)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Kn((a,c)=>this.requestStatusString(a,c)))}getAttrData(){return this._curAttrData}_preserveStack(t,e,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=t,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(t){this._logService.logLevel<=3&&Promise.race([t,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),jn))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(`async parser handler taking longer than ${jn} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(t,e){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,t.length>At&&(n=this._parseStack.position+At)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof t=="string"?` "${t}"`:` "${Array.prototype.map.call(t,a=>String.fromCharCode(a)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof t=="string"?t.split("").map(a=>a.charCodeAt(0)):t),this._parseBuffer.length<t.length&&this._parseBuffer.length<At&&(this._parseBuffer=new Uint32Array(Math.min(t.length,At))),o||this._dirtyRowTracker.clearRange(),t.length>At)for(let a=n;a<t.length;a+=At){let c=a+At<t.length?a+At:t.length,d=typeof t=="string"?this._stringDecoder.decode(t.substring(a,c),this._parseBuffer):this._utf8Decoder.decode(t.subarray(a,c),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,d))return this._preserveStack(s,r,d,a),this._logSlowResolvingAsync(i),i}else if(!o){let a=typeof t=="string"?this._stringDecoder.decode(t,this._parseBuffer):this._utf8Decoder.decode(t,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,a))return this._preserveStack(s,r,a,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==s||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(t,e,i){let s,r,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,a=this._coreService.modes.insertMode,c=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-e>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,c);let u=this._parser.precedingJoinState;for(let _=e;_<i;++_){if(s=t[_],s<127&&n){let C=n[String.fromCharCode(s)];C&&(s=C.charCodeAt(0))}let f=this._unicodeService.charProperties(s,u);r=Ut.extractWidth(f);let p=Ut.extractShouldJoin(f),w=p?Ut.extractWidth(u):0;if(u=f,o&&this._onA11yChar.fire(Ot(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-w>l){if(h){let C=d,k=this._activeBuffer.x-w;for(this._activeBuffer.x=w,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),w>0&&d instanceof Li&&d.copyCellsFrom(C,k,0,w,!1);k<l;)C.setCellFromCodepoint(k++,0,1,c)}else if(this._activeBuffer.x=l-1,r===2)continue}if(p&&this._activeBuffer.x){let C=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-C,s,r);for(let k=r-w;--k>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,c);continue}if(a&&(d.insertCells(this._activeBuffer.x,r-w,this._activeBuffer.getNullCell(c)),d.getWidth(l-1)===2&&d.setCellFromCodepoint(l-1,0,1,c)),d.setCellFromCodepoint(this._activeBuffer.x++,s,r,c),r>0)for(;--r;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,c)}this._parser.precedingJoinState=u,this._activeBuffer.x<l&&i-e>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,c),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(t,e){return t.final==="t"&&!t.prefix&&!t.intermediates?this._parser.registerCsiHandler(t,i=>Yn(i.params[0],this._optionsService.rawOptions.windowOptions)?e(i):!0):this._parser.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._parser.registerDcsHandler(t,new Kn(e))}registerEscHandler(t,e){return this._parser.registerEscHandler(t,e)}registerOscHandler(t,e){return this._parser.registerOscHandler(t,new Ze(e))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var t;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&t.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-t),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(t=this._bufferService.cols-1){this._activeBuffer.x=Math.min(t,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(t,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=t,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=t,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(t,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+t,this._activeBuffer.y+e)}cursorUp(t){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,t.params[0]||1)):this._moveCursor(0,-(t.params[0]||1)),!0}cursorDown(t){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,t.params[0]||1)):this._moveCursor(0,t.params[0]||1),!0}cursorForward(t){return this._moveCursor(t.params[0]||1,0),!0}cursorBackward(t){return this._moveCursor(-(t.params[0]||1),0),!0}cursorNextLine(t){return this.cursorDown(t),this._activeBuffer.x=0,!0}cursorPrecedingLine(t){return this.cursorUp(t),this._activeBuffer.x=0,!0}cursorCharAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(t){return this._setCursor(t.length>=2?(t.params[1]||1)-1:0,(t.params[0]||1)-1),!0}charPosAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(t){return this._moveCursor(t.params[0]||1,0),!0}linePosAbsolute(t){return this._setCursor(this._activeBuffer.x,(t.params[0]||1)-1),!0}vPositionRelative(t){return this._moveCursor(0,t.params[0]||1),!0}hVPosition(t){return this.cursorPosition(t),!0}tabClear(t){let e=t.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(t){let e=t.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(t,e,i,s=!1,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);n.replaceCells(e,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1)}_resetBufferLine(t,e=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+t),i.isWrapped=!1)}eraseInDisplay(t,e=!1){var s;this._restrictCursor(this._bufferService.cols);let i;switch(t.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);i<this._bufferService.rows;i++)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,e),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&s.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(t,e=!1){switch(this._restrictCursor(this._bufferService.cols),t.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;e--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;e--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.insertCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.deleteCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(t){let e=t.params[0]||1;for(;e--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(t){let e=t.params[0]||1;for(;e--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(pe));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(t.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(t){let e=this._parser.precedingJoinState;if(!e)return!0;let i=t.params[0]||1,s=Ut.extractWidth(e),r=this._activeBuffer.x-s,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),o=new Uint32Array(n.length*i),l=0;for(let a=0;a<n.length;){let c=n.codePointAt(a)||0;o[l++]=c,a+=c>65535?2:1}let h=l;for(let a=1;a<i;++a)o.copyWithin(h,0,l),h+=l;return this.print(o,0,h),!0}sendDeviceAttributesPrimary(t){return t.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(B.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(B.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(t){return t.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(B.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(B.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(t.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(B.ESC+"[>83;40003;0c")),!0}_is(t){return(this._optionsService.rawOptions.termName+"").indexOf(t)===0}setMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Ht),this._charsetService.setgCharset(1,Ht),this._charsetService.setgCharset(2,Ht),this._charsetService.setgCharset(3,Ht);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),t.params[e]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(t,e){(p=>(p[p.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",p[p.SET=1]="SET",p[p.RESET=2]="RESET",p[p.PERMANENTLY_SET=3]="PERMANENTLY_SET",p[p.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let s=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:l,cols:h}=this._bufferService,{active:a,alt:c}=l,d=this._optionsService.rawOptions,u=(p,w)=>(o.triggerDataEvent(`${B.ESC}[${e?"":"?"}${p};${w}$y`),!0),_=p=>p?1:2,f=t.params[0];return e?f===2?u(f,4):f===4?u(f,_(o.modes.insertMode)):f===12?u(f,3):f===20?u(f,_(d.convertEol)):u(f,0):f===1?u(f,_(s.applicationCursorKeys)):f===3?u(f,d.windowOptions.setWinLines?h===80?2:h===132?1:0:0):f===6?u(f,_(s.origin)):f===7?u(f,_(s.wraparound)):f===8?u(f,3):f===9?u(f,_(r==="X10")):f===12?u(f,_(d.cursorBlink)):f===25?u(f,_(!o.isCursorHidden)):f===45?u(f,_(s.reverseWraparound)):f===66?u(f,_(s.applicationKeypad)):f===67?u(f,4):f===1e3?u(f,_(r==="VT200")):f===1002?u(f,_(r==="DRAG")):f===1003?u(f,_(r==="ANY")):f===1004?u(f,_(s.sendFocus)):f===1005?u(f,4):f===1006?u(f,_(n==="SGR")):f===1015?u(f,4):f===1016?u(f,_(n==="SGR_PIXELS")):f===1048?u(f,1):f===47||f===1047||f===1049?u(f,_(a===c)):f===2004?u(f,_(s.bracketedPasteMode)):f===2026?u(f,_(s.synchronizedOutput)):u(f,0)}_updateAttrColor(t,e,i,s,r){return e===2?(t|=50331648,t&=-16777216,t|=$i.fromColorRGB([i,s,r])):e===5&&(t&=-50331904,t|=33554432|i&255),t}_extractColor(t,e,i){let s=[0,0,-1,0,0,0],r=0,n=0;do{if(s[n+r]=t.params[e+n],t.hasSubParams(e+n)){let o=t.getSubParams(e+n),l=0;do s[1]===5&&(r=1),s[n+l+1+r]=o[l];while(++l<o.length&&l+n+1+r<s.length);break}if(s[1]===5&&n+r>=2||s[1]===2&&n+r>=5)break;s[1]&&(r=1)}while(++n+e<t.length&&n+r<s.length);for(let o=2;o<s.length;++o)s[o]===-1&&(s[o]=0);switch(s[0]){case 38:i.fg=this._updateAttrColor(i.fg,s[1],s[3],s[4],s[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,s[1],s[3],s[4],s[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,s[1],s[3],s[4],s[5])}return n}_processUnderline(t,e){e.extended=e.extended.clone(),(!~t||t>5)&&(t=1),e.extended.underlineStyle=t,e.fg|=268435456,t===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(t){t.fg=pe.fg,t.bg=pe.bg,t.extended=t.extended.clone(),t.extended.underlineStyle=0,t.extended.underlineColor&=-67108864,t.updateExtended()}charAttributes(t){if(t.length===1&&t.params[0]===0)return this._processSGR0(this._curAttrData),!0;let e=t.length,i,s=this._curAttrData;for(let r=0;r<e;r++)i=t.params[r],i>=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777216|i-90|8):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777216|i-100|8):i===0?this._processSGR0(s):i===1?s.fg|=134217728:i===3?s.bg|=67108864:i===4?(s.fg|=268435456,this._processUnderline(t.hasSubParams(r)?t.getSubParams(r)[0]:1,s)):i===5?s.fg|=536870912:i===7?s.fg|=67108864:i===8?s.fg|=1073741824:i===9?s.fg|=2147483648:i===2?s.bg|=134217728:i===21?this._processUnderline(2,s):i===22?(s.fg&=-134217729,s.bg&=-134217729):i===23?s.bg&=-67108865:i===24?(s.fg&=-268435457,this._processUnderline(0,s)):i===25?s.fg&=-536870913:i===27?s.fg&=-67108865:i===28?s.fg&=-1073741825:i===29?s.fg&=2147483647:i===39?(s.fg&=-67108864,s.fg|=pe.fg&16777215):i===49?(s.bg&=-67108864,s.bg|=pe.bg&16777215):i===38||i===48||i===58?r+=this._extractColor(t,r,s):i===53?s.bg|=1073741824:i===55?s.bg&=-1073741825:i===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):i===100?(s.fg&=-67108864,s.fg|=pe.fg&16777215,s.bg&=-67108864,s.bg|=pe.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(t){switch(t.params[0]){case 5:this._coreService.triggerDataEvent(`${B.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${B.ESC}[${e};${i}R`);break}return!0}deviceStatusPrivate(t){switch(t.params[0]){case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${B.ESC}[?${e};${i}R`);break}return!0}softReset(t){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=pe.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(t){let e=t.length===0?1:t.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let i=e%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(t){let e=t.params[0]||1,i;return(t.length<2||(i=t.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(t){if(!Yn(t.params[0],this._optionsService.rawOptions.windowOptions))return!0;let e=t.length>1?t.params[1]:0;switch(t.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${B.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Vn&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Vn&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(t){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(t){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(t){return this._windowTitle=t,this._onTitleChange.fire(t),!0}setIconName(t){return this._iconName=t,!0}setOrReportIndexedColor(t){let e=[],i=t.split(";");for(;i.length>1;){let s=i.shift(),r=i.shift();if(/^\d+$/.exec(s)){let n=parseInt(s);if(Xn(n))if(r==="?")e.push({type:0,index:n});else{let o=qn(r);o&&e.push({type:1,index:n,color:o})}}}return e.length&&this._onColor.fire(e),!0}setHyperlink(t){let e=t.indexOf(";");if(e===-1)return!0;let i=t.slice(0,e).trim(),s=t.slice(e+1);return s?this._createHyperlink(i,s):i.trim()?!1:this._finishHyperlink()}_createHyperlink(t,e){this._getCurrentLinkId()&&this._finishHyperlink();let i=t.split(":"),s,r=i.findIndex(n=>n.startsWith("id="));return r!==-1&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:e}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(t,e){let i=t.split(";");for(let s=0;s<i.length&&!(e>=this._specialColors.length);++s,++e)if(i[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let r=qn(i[s]);r&&this._onColor.fire([{type:1,index:this._specialColors[e],color:r}])}return!0}setOrReportFgColor(t){return this._setOrReportSpecialColor(t,0)}setOrReportBgColor(t){return this._setOrReportSpecialColor(t,1)}setOrReportCursorColor(t){return this._setOrReportSpecialColor(t,2)}restoreIndexedColor(t){if(!t)return this._onColor.fire([{type:2}]),!0;let e=[],i=t.split(";");for(let s=0;s<i.length;++s)if(/^\d+$/.exec(i[s])){let r=parseInt(i[s]);Xn(r)&&e.push({type:2,index:r})}return e.length&&this._onColor.fire(e),!0}restoreFgColor(t){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(t){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(t){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Ht),!0}selectCharset(t){return t.length!==2?(this.selectDefaultCharset(),!0):(t[0]==="/"||this._charsetService.setgCharset(eu[t[0]],ye[t[1]]||Ht),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let t=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,t,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=pe.clone(),this._eraseAttrDataInternal=pe.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(t){return this._charsetService.setgLevel(t),!0}screenAlignmentPattern(){let t=new rt;t.content=1<<22|69,t.fg=this._curAttrData.fg,t.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e<this._bufferService.rows;++e){let i=this._activeBuffer.ybase+this._activeBuffer.y+e,s=this._activeBuffer.lines.get(i);s&&(s.fill(t),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(t,e){let i=o=>(this._coreService.triggerDataEvent(`${B.ESC}${o}${B.ESC}\\`),!0),s=this._bufferService.buffer,r=this._optionsService.rawOptions;return i(t==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:t==='"p'?'P1$r61;1"p':t==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:t==="m"?"P1$r0m":t===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(t,e){this._dirtyRowTracker.markRangeDirty(t,e)}},Mr=class{constructor(t){this._bufferService=t,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){t<this.start?this.start=t:t>this.end&&(this.end=t)}markRangeDirty(t,e){t>e&&(Gn=t,t=e,e=Gn),t<this.start&&(this.start=t),e>this.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Mr=de([I(0,Ke)],Mr);function Xn(t){return 0<=t&&t<256}var iu=5e7,Zn=12,su=50,ru=class extends Y{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new P),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){if(i!==void 0&&this._syncCalls>i){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let s;for(;s=this._writeBuffer.shift();){this._action(s);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,i){if(this._pendingData>iu)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],n=this._action(r,i);if(n){let l=h=>performance.now()-s>=Zn?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(s,h);n.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(l);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-s>=Zn)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>su&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},Br=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let i=this._bufferService.buffer;if(e.id===void 0){let h=i.addMarker(i.ybase+i.y),a={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(a,h)),this._dataByLinkId.set(a.id,a),a.id}let s=e,r=this._getEntryIdKey(s),n=this._entriesWithId.get(r);if(n)return this.addLineToLink(n.id,i.ybase+i.y),n.id;let o=i.addMarker(i.ybase+i.y),l={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(e,i){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(r=>r.line!==i)){let r=this._bufferService.buffer.addMarker(i);s.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(s,r))}}getLinkData(e){var i;return(i=this._dataByLinkId.get(e))==null?void 0:i.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,i){let s=e.lines.indexOf(i);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Br=de([I(0,Ke)],Br);var Jn=!1,nu=class extends Y{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new hi),this._onBinary=this._register(new P),this.onBinary=this._onBinary.event,this._onData=this._register(new P),this.onData=this._onData.event,this._onLineFeed=this._register(new P),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new P),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new P),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new P),this._instantiationService=new Md,this.optionsService=this._register(new Nd(e)),this._instantiationService.setService(qe,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(kr)),this._instantiationService.setService(Ke,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(xr)),this._instantiationService.setService(ta,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Lr)),this._instantiationService.setService(Xt,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Er)),this._instantiationService.setService(ea,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ut)),this._instantiationService.setService(kh,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Kd),this._instantiationService.setService(xh,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Br),this._instantiationService.setService(ia,this._oscLinkService),this._inputHandler=this._register(new tu(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Fe.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Fe.forward(this._bufferService.onResize,this._onResize)),this._register(Fe.forward(this.coreService.onData,this._onData)),this._register(Fe.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new ru((i,s)=>this._inputHandler.parse(i,s))),this._register(Fe.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new P),this._onScroll.event(e=>{var i;(i=this._onScrollApi)==null||i.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!Jn&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Jn=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,Pa),i=Math.max(i,Ia),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&i.buildNumber!==void 0&&i.buildNumber!==void 0?e=i.backend==="conpty"&&i.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Un.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Un(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ne(()=>{for(let i of e)i.dispose()})}}},ou={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function au(t,e,i,s){var o;let r={type:0,cancel:!1,key:void 0},n=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:t.key==="UIKeyInputUpArrow"?e?r.key=B.ESC+"OA":r.key=B.ESC+"[A":t.key==="UIKeyInputLeftArrow"?e?r.key=B.ESC+"OD":r.key=B.ESC+"[D":t.key==="UIKeyInputRightArrow"?e?r.key=B.ESC+"OC":r.key=B.ESC+"[C":t.key==="UIKeyInputDownArrow"&&(e?r.key=B.ESC+"OB":r.key=B.ESC+"[B");break;case 8:r.key=t.ctrlKey?"\b":B.DEL,t.altKey&&(r.key=B.ESC+r.key);break;case 9:if(t.shiftKey){r.key=B.ESC+"[Z";break}r.key=B.HT,r.cancel=!0;break;case 13:r.key=t.altKey?B.ESC+B.CR:B.CR,r.cancel=!0;break;case 27:r.key=B.ESC,t.altKey&&(r.key=B.ESC+B.ESC),r.cancel=!0;break;case 37:if(t.metaKey)break;n?r.key=B.ESC+"[1;"+(n+1)+"D":e?r.key=B.ESC+"OD":r.key=B.ESC+"[D";break;case 39:if(t.metaKey)break;n?r.key=B.ESC+"[1;"+(n+1)+"C":e?r.key=B.ESC+"OC":r.key=B.ESC+"[C";break;case 38:if(t.metaKey)break;n?r.key=B.ESC+"[1;"+(n+1)+"A":e?r.key=B.ESC+"OA":r.key=B.ESC+"[A";break;case 40:if(t.metaKey)break;n?r.key=B.ESC+"[1;"+(n+1)+"B":e?r.key=B.ESC+"OB":r.key=B.ESC+"[B";break;case 45:!t.shiftKey&&!t.ctrlKey&&(r.key=B.ESC+"[2~");break;case 46:n?r.key=B.ESC+"[3;"+(n+1)+"~":r.key=B.ESC+"[3~";break;case 36:n?r.key=B.ESC+"[1;"+(n+1)+"H":e?r.key=B.ESC+"OH":r.key=B.ESC+"[H";break;case 35:n?r.key=B.ESC+"[1;"+(n+1)+"F":e?r.key=B.ESC+"OF":r.key=B.ESC+"[F";break;case 33:t.shiftKey?r.type=2:t.ctrlKey?r.key=B.ESC+"[5;"+(n+1)+"~":r.key=B.ESC+"[5~";break;case 34:t.shiftKey?r.type=3:t.ctrlKey?r.key=B.ESC+"[6;"+(n+1)+"~":r.key=B.ESC+"[6~";break;case 112:n?r.key=B.ESC+"[1;"+(n+1)+"P":r.key=B.ESC+"OP";break;case 113:n?r.key=B.ESC+"[1;"+(n+1)+"Q":r.key=B.ESC+"OQ";break;case 114:n?r.key=B.ESC+"[1;"+(n+1)+"R":r.key=B.ESC+"OR";break;case 115:n?r.key=B.ESC+"[1;"+(n+1)+"S":r.key=B.ESC+"OS";break;case 116:n?r.key=B.ESC+"[15;"+(n+1)+"~":r.key=B.ESC+"[15~";break;case 117:n?r.key=B.ESC+"[17;"+(n+1)+"~":r.key=B.ESC+"[17~";break;case 118:n?r.key=B.ESC+"[18;"+(n+1)+"~":r.key=B.ESC+"[18~";break;case 119:n?r.key=B.ESC+"[19;"+(n+1)+"~":r.key=B.ESC+"[19~";break;case 120:n?r.key=B.ESC+"[20;"+(n+1)+"~":r.key=B.ESC+"[20~";break;case 121:n?r.key=B.ESC+"[21;"+(n+1)+"~":r.key=B.ESC+"[21~";break;case 122:n?r.key=B.ESC+"[23;"+(n+1)+"~":r.key=B.ESC+"[23~";break;case 123:n?r.key=B.ESC+"[24;"+(n+1)+"~":r.key=B.ESC+"[24~";break;default:if(t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey)t.keyCode>=65&&t.keyCode<=90?r.key=String.fromCharCode(t.keyCode-64):t.keyCode===32?r.key=B.NUL:t.keyCode>=51&&t.keyCode<=55?r.key=String.fromCharCode(t.keyCode-51+27):t.keyCode===56?r.key=B.DEL:t.keyCode===219?r.key=B.ESC:t.keyCode===220?r.key=B.FS:t.keyCode===221&&(r.key=B.GS);else if((!i||s)&&t.altKey&&!t.metaKey){let l=(o=ou[t.keyCode])==null?void 0:o[t.shiftKey?1:0];if(l)r.key=B.ESC+l;else if(t.keyCode>=65&&t.keyCode<=90){let h=t.ctrlKey?t.keyCode-64:t.keyCode+32,a=String.fromCharCode(h);t.shiftKey&&(a=a.toUpperCase()),r.key=B.ESC+a}else if(t.keyCode===32)r.key=B.ESC+(t.ctrlKey?B.NUL:" ");else if(t.key==="Dead"&&t.code.startsWith("Key")){let h=t.code.slice(3,4);t.shiftKey||(h=h.toLowerCase()),r.key=B.ESC+h,r.cancel=!0}}else i&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&t.metaKey?t.keyCode===65&&(r.type=1):t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.keyCode>=48&&t.key.length===1?r.key=t.key:t.key&&t.ctrlKey&&(t.key==="_"&&(r.key=B.US),t.key==="@"&&(r.key=B.NUL));break}return r}var fe=0,lu=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new _s,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new _s,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((n,o)=>this._getKey(n)-this._getKey(o)),i=0,s=0,r=new Array(this._array.length+this._insertedValues.length);for(let n=0;n<r.length;n++)s>=this._array.length||this._getKey(e[i])<=this._getKey(this._array[s])?(r[n]=e[i],i++):r[n]=this._array[s++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let i=this._getKey(e);if(i===void 0||(fe=this._search(i),fe===-1)||this._getKey(this._array[fe])!==i)return!1;do if(this._array[fe]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(fe),!0;while(++fe<this._array.length&&this._getKey(this._array[fe])===i);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((n,o)=>n-o),i=0,s=new Array(this._array.length-e.length),r=0;for(let n=0;n<this._array.length;n++)e[i]===n?i++:s[r++]=this._array[n];this._array=s,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(fe=this._search(e),!(fe<0||fe>=this._array.length)&&this._getKey(this._array[fe])===e))do yield this._array[fe];while(++fe<this._array.length&&this._getKey(this._array[fe])===e)}forEachByKey(e,i){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(fe=this._search(e),!(fe<0||fe>=this._array.length)&&this._getKey(this._array[fe])===e))do i(this._array[fe]);while(++fe<this._array.length&&this._getKey(this._array[fe])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let i=0,s=this._array.length-1;for(;s>=i;){let r=i+s>>1,n=this._getKey(this._array[r]);if(n>e)s=r-1;else if(n<e)i=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return i}},Ps=0,Qn=0,hu=class extends Y{constructor(){super(),this._decorations=new lu(t=>t==null?void 0:t.marker.line),this._onDecorationRegistered=this._register(new P),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new P),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ne(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(t){if(t.marker.isDisposed)return;let e=new cu(t);if(e){let i=e.marker.onDispose(()=>e.dispose()),s=e.onDispose(()=>{s.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),i.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,e,i){let s=0,r=0;for(let n of this._decorations.getKeyIterator(e))s=n.options.x??0,r=s+(n.options.width??1),t>=s&&t<r&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(t,e,i,s){this._decorations.forEachByKey(e,r=>{Ps=r.options.x??0,Qn=Ps+(r.options.width??1),t>=Ps&&t<Qn&&(!i||(r.options.layer??"bottom")===i)&&s(r)})}},cu=class extends $t{constructor(t){super(),this.options=t,this.onRenderEmitter=this.add(new P),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new P),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=t.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=ae.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ae.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},du=1e3,uu=class{constructor(e,i=du){this._renderCallback=e,this._debounceThresholdMS=i,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,i,s){this._rowCount=s,e=e!==void 0?e:0,i=i!==void 0?i:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,i):i;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=r-this._lastRefreshMs,o=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i)}},eo=20,fs=class extends Y{constructor(t,e,i,s){super(),this._terminal=t,this._coreBrowserService=i,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new uu(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
25
|
+
`))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(W(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ne(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(t){for(let e=0;e<t;e++)this._handleChar(" ")}_handleChar(t){this._liveRegionLineCount<eo+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==t&&(this._charsToAnnounce+=t):this._charsToAnnounce+=t,t===`
|
|
26
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===eo+1&&(this._liveRegion.textContent+=Xs.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(t){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(t)||this._charsToConsume.push(t)}_refreshRows(t,e){this._liveRegionDebouncer.refresh(t,e,this._terminal.rows)}_renderRows(t,e){let i=this._terminal.buffer,s=i.lines.length.toString();for(let r=t;r<=e;r++){let n=i.lines.get(i.ydisp+r),o=[],l=(n==null?void 0:n.translateToString(!0,void 0,void 0,o))||"",h=(i.ydisp+r+1).toString(),a=this._rowElements[r];a&&(l.length===0?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=l,this._rowColumns.set(a,o)),a.setAttribute("aria-posinset",h),a.setAttribute("aria-setsize",s),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(t,e){let i=t.target,s=this._rowElements[e===0?1:this._rowElements.length-2],r=i.getAttribute("aria-posinset"),n=e===0?"1":`${this._terminal.buffer.lines.length}`;if(r===n||t.relatedTarget!==s)return;let o,l;if(e===0?(o=i,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=i,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),e===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(e===0?-1:1),this._rowElements[e===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_handleSelectionChange(){var l;if(this._rowElements.length===0)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed){this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection();return}if(!t.anchorNode||!t.focusNode){console.error("anchorNode and/or focusNode are null");return}let e={node:t.anchorNode,offset:t.anchorOffset},i={node:t.focusNode,offset:t.focusOffset};if((e.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||e.node===i.node&&e.offset>i.offset)&&([e,i]=[i,e]),e.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(e={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(e.node))return;let s=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:s,offset:((l=s.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(i.node))return;let r=({node:h,offset:a})=>{let c=h instanceof Text?h.parentNode:h,d=parseInt(c==null?void 0:c.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let u=this._rowColumns.get(c);if(!u)return console.warn("columns is null. Race condition?"),null;let _=a<u.length?u[a]:u.slice(-1)[0]+1;return _>=this._terminal.cols&&(++d,_=0),{row:d,column:_}},n=r(e),o=r(i);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let t=this._coreBrowserService.mainDocument.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let t=0;t<this._terminal.rows;t++)this._refreshRowDimensions(this._rowElements[t]),this._alignRowWidth(this._rowElements[t])}}_refreshRowDimensions(t){t.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(t){var r,n;t.style.transform="";let e=t.getBoundingClientRect().width,i=(n=(r=this._rowColumns.get(t))==null?void 0:r.slice(-1))==null?void 0:n[0];if(!i)return;let s=i*this._renderService.dimensions.css.cell.width;t.style.transform=`scaleX(${s/e})`}};fs=de([I(1,Nr),I(2,Lt),I(3,Et)],fs);var Tr=class extends Y{constructor(t,e,i,s,r){super(),this._element=t,this._mouseService=e,this._renderService=i,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new P),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new P),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ne(()=>{var n;jt(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(n=this._activeProviderReplies)==null||n.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(W(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(W(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(W(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(W(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(t){this._lastMouseEvent=t;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let i=t.composedPath();for(let s=0;s<i.length;s++){let r=i[s];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||e.x!==this._lastBufferCell.x||e.y!==this._lastBufferCell.y)&&(this._handleHover(e),this._lastBufferCell=e)}_handleHover(t){if(this._activeLine!==t.y||this._wasResized){this._clearCurrentLink(),this._askForLink(t,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,t)||(this._clearCurrentLink(),this._askForLink(t,!0))}_askForLink(t,e){var s,r;(!this._activeProviderReplies||!e)&&((s=this._activeProviderReplies)==null||s.forEach(n=>{n==null||n.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=t.y);let i=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())e?(r=this._activeProviderReplies)!=null&&r.get(n)&&(i=this._checkLinkProviderResult(n,t,i)):o.provideLinks(t.y,l=>{var a,c;if(this._isMouseOut)return;let h=l==null?void 0:l.map(d=>({link:d}));(a=this._activeProviderReplies)==null||a.set(n,h),i=this._checkLinkProviderResult(n,t,i),((c=this._activeProviderReplies)==null?void 0:c.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)})}_removeIntersectingLinks(t,e){let i=new Set;for(let s=0;s<e.size;s++){let r=e.get(s);if(r)for(let n=0;n<r.length;n++){let o=r[n],l=o.link.range.start.y<t?0:o.link.range.start.x,h=o.link.range.end.y>t?this._bufferService.cols:o.link.range.end.x;for(let a=l;a<=h;a++){if(i.has(a)){r.splice(n--,1);break}i.add(a)}}}}_checkLinkProviderResult(t,e,i){var n;if(!this._activeProviderReplies)return i;let s=this._activeProviderReplies.get(t),r=!1;for(let o=0;o<t;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(r=!0);if(!r&&s){let o=s.find(l=>this._linkAtPosition(l.link,e));o&&(i=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(n=this._activeProviderReplies.get(o))==null?void 0:n.find(h=>this._linkAtPosition(h.link,e));if(l){i=!0,this._handleNewLink(l);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);e&&this._mouseDownLink&&_u(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,e){!this._currentLink||!this._lastMouseEvent||(!t||!e||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,jt(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(t){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(t.link,e)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0?!0:t.link.decorations.underline,pointerCursor:t.link.decorations===void 0?!0:t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>{var i,s;return(s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.pointerCursor},set:i=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,s;return(s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline},set:i=>{var s,r,n;(s=this._currentLink)!=null&&s.state&&((n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let s=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(s,r),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(t,e,i){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(i,e.text)}_fireUnderlineEvent(t,e){let i=t.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(t,e,i){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(i,e.text)}_linkAtPosition(t,e){let i=t.range.start.y*this._bufferService.cols+t.range.start.x,s=t.range.end.y*this._bufferService.cols+t.range.end.x,r=e.y*this._bufferService.cols+e.x;return i<=r&&r<=s}_positionFromMouseEvent(t,e,i){let s=i.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,i,s,r){return{x1:t,y1:e,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};Tr=de([I(1,Wr),I(2,Et),I(3,Ke),I(4,ra)],Tr);function _u(t,e){return t.text===e.text&&t.range.start.x===e.range.start.x&&t.range.start.y===e.range.start.y&&t.range.end.x===e.range.end.x&&t.range.end.y===e.range.end.y}var fu=class extends nu{constructor(e={}){super(e),this._linkifier=this._register(new hi),this.browser=Ca,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new hi),this._onCursorMove=this._register(new P),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new P),this.onKey=this._onKey.event,this._onRender=this._register(new P),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new P),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new P),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new P),this.onBell=this._onBell.event,this._onFocus=this._register(new P),this._onBlur=this._register(new P),this._onA11yCharEmitter=this._register(new P),this._onA11yTabEmitter=this._register(new P),this._onWillOpen=this._register(new P),this._setup(),this._decorationService=this._instantiationService.createInstance(hu),this._instantiationService.setService(Ni,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(sd),this._instantiationService.setService(ra,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Js)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(i=>this.refresh((i==null?void 0:i.start)??0,(i==null?void 0:i.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(i=>this._reportWindowsOptions(i))),this._register(this._inputHandler.onColor(i=>this._handleColorEvent(i))),this._register(Fe.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Fe.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Fe.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Fe.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(i=>this._afterResize(i.cols,i.rows))),this._register(ne(()=>{var i,s;this._customKeyEventHandler=void 0,(s=(i=this.element)==null?void 0:i.parentNode)==null||s.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let i of e){let s,r="";switch(i.index){case 256:s="foreground",r="10";break;case 257:s="background",r="11";break;case 258:s="cursor",r="12";break;default:s="ansi",r="4;"+i.index}switch(i.type){case 0:let n=se.toColorRGB(s==="ansi"?this._themeService.colors.ansi[i.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${B.ESC}]${r};${Qd(n)}${ba.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(o=>o.ansi[i.index]=me.toColor(...i.color));else{let o=s;this._themeService.modifyColors(l=>l[o]=me.toColor(...i.color))}break;case 2:this._themeService.restoreColor(i.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(fs,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(B.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(B.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,i=this.buffer.lines.get(e);if(!i)return;let s=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,n=i.getWidth(s),o=this._renderService.dimensions.css.cell.width*n,l=this.buffer.y*this._renderService.dimensions.css.cell.height,h=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=l+"px",this.textarea.style.width=o+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(W(this.element,"copy",i=>{this.hasSelection()&&mh(i,this._selectionService)}));let e=i=>Sh(i,this.textarea,this.coreService,this.optionsService);this._register(W(this.textarea,"paste",e)),this._register(W(this.element,"paste",e)),xa?this._register(W(this.element,"mousedown",i=>{i.button===2&&cn(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(W(this.element,"contextmenu",i=>{cn(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),jr&&this._register(W(this.element,"auxclick",i=>{i.button===1&&Go(i,this.textarea,this.screenElement)}))}_bindKeys(){this._register(W(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(W(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(W(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(W(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(W(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(W(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(W(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var n;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((n=this.element)==null?void 0:n.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(W(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Gs.get()),Ea||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(td,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Lt,this._coreBrowserService),this._register(W(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(W(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Sr,this._document,this._helperContainer),this._instantiationService.setService(vs,this._charSizeService),this._themeService=this._instantiationService.createInstance(Cr),this._instantiationService.setService(ci,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ds),this._instantiationService.setService(sa,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(br,this.rows,this.screenElement)),this._instantiationService.setService(Et,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(pr,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(wr),this._instantiationService.setService(Wr,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Tr,this.screenElement));this.element.appendChild(i);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(fr,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(yr,this.element,this.screenElement,r)),this._instantiationService.setService(Eh,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(Fe.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(gr,this.screenElement)),this._register(W(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(fs,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(cs,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(cs,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(mr,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function s(o){var c,d,u,_,f;let l=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!l)return!1;let h,a;switch(o.overrideType||o.type){case"mousemove":a=32,o.buttons===void 0?(h=3,o.button!==void 0&&(h=o.button<3?o.button:3)):h=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":a=0,h=o.button<3?o.button:3;break;case"mousedown":a=1,h=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let p=o.deltaY;if(p===0||e.coreMouseService.consumeWheelEvent(o,(_=(u=(d=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:d.device)==null?void 0:u.cell)==null?void 0:_.height,(f=e._coreBrowserService)==null?void 0:f.dpr)===0)return!1;a=p<0?0:1,h=4;break;default:return!1}return a===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:h,action:a,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:o=>(s(o),o.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(o)),wheel:o=>(s(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&s(o)},mousemove:o=>{o.buttons||s(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),o&8?r.mousemove||(i.addEventListener("mousemove",n.mousemove),r.mousemove=n.mousemove):(i.removeEventListener("mousemove",r.mousemove),r.mousemove=null),o&16?r.wheel||(i.addEventListener("wheel",n.wheel,{passive:!1}),r.wheel=n.wheel):(i.removeEventListener("wheel",r.wheel),r.wheel=null),o&2?r.mouseup||(r.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),o&4?r.mousedrag||(r.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(W(i,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return s(o),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(o)})),this._register(W(i,"wheel",o=>{var l,h,a,c,d;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(c=(a=(h=(l=e._renderService)==null?void 0:l.dimensions)==null?void 0:h.device)==null?void 0:a.cell)==null?void 0:c.height,(d=e._coreBrowserService)==null?void 0:d.dpr)===0)return this.cancel(o,!0);let u=B.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(u,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,i){var s;(s=this._renderService)==null||s.refreshRows(e,i)}updateCursorStyle(e){var i;(i=this._selectionService)!=null&&i.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}paste(e){jo(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,i,s){this._selectionService.setSelection(e,i,s)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,i){var s;(s=this._selectionService)==null||s.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!i&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let s=au(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let r=this.rows-1;return this.scrollLines(s.type===2?-r:r),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((s.key===B.ETX||s.key===B.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,i){let s=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return i.type==="keypress"?s:s&&(!i.keyCode||i.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(gu(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(e.which===null||e.which===void 0)i=e.keyCode;else if(e.which!==0&&e.charCode!==0)i=e.which;else return!1;return!i||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){var s;(s=this._charSizeService)==null||s.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(pe));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var i;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(i=this._selectionService)==null||i.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(B.ESC+"[I"):this.coreService.triggerDataEvent(B.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let i=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${B.ESC}[4;${s};${i}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${B.ESC}[6;${n};${r}t`);break}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),!1}};function gu(t){return t.keyCode===16||t.keyCode===17||t.keyCode===18}var pu=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let s={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(s),i.dispose=()=>this._wrappedAddonDispose(s),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){i=s;break}if(i===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(i,1)}},vu=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,i){if(!(e<0||e>=this._line.length))return i?(this._line.loadCell(e,i),i):this._line.loadCell(e,new rt)}translateToString(e,i,s){return this._line.translateToString(e,i,s)}},to=class{constructor(t,e){this._buffer=t,this.type=e}init(t){return this._buffer=t,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(t){let e=this._buffer.lines.get(t);if(e)return new vu(e)}getNullCell(){return new rt}},mu=class extends Y{constructor(t){super(),this._core=t,this._onBufferChange=this._register(new P),this.onBufferChange=this._onBufferChange.event,this._normal=new to(this._core.buffers.normal,"normal"),this._alternate=new to(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},Su=class{constructor(t){this._core=t}registerCsiHandler(t,e){return this._core.registerCsiHandler(t,i=>e(i.toArray()))}addCsiHandler(t,e){return this.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._core.registerDcsHandler(t,(i,s)=>e(i,s.toArray()))}addDcsHandler(t,e){return this.registerDcsHandler(t,e)}registerEscHandler(t,e){return this._core.registerEscHandler(t,e)}addEscHandler(t,e){return this.registerEscHandler(t,e)}registerOscHandler(t,e){return this._core.registerOscHandler(t,e)}addOscHandler(t,e){return this.registerOscHandler(t,e)}},wu=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},bu=["cols","rows"],ct=0,yu=class extends Y{constructor(t){super(),this._core=this._register(new fu(t)),this._addonManager=this._register(new pu),this._publicOptions={...this._core.options};let e=s=>this._core.options[s],i=(s,r)=>{this._checkReadonlyOptions(s),this._core.options[s]=r};for(let s in this._core.options){let r={get:e.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this._publicOptions,s,r)}}_checkReadonlyOptions(t){if(bu.includes(t))throw new Error(`Option "${t}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new Su(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new wu(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new mu(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,synchronizedOutputMode:t.synchronizedOutput,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,i){this._verifyIntegers(t,e,i),this._core.select(t,e,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r
|
|
27
|
+
`,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return{get promptLabel(){return Gs.get()},set promptLabel(t){Gs.set(t)},get tooMuchOutput(){return Xs.get()},set tooMuchOutput(t){Xs.set(t)}}}_verifyIntegers(...t){for(ct of t)if(ct===1/0||isNaN(ct)||ct%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(ct of t)if(ct&&(ct===1/0||isNaN(ct)||ct%1!==0||ct<0))throw new Error("This API only accepts positive integers")}};/**
|
|
28
28
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
29
29
|
* @license MIT
|
|
30
30
|
*
|
|
@@ -35,7 +35,7 @@ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){t
|
|
|
35
35
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
36
36
|
* http://bellard.org/jslinux/
|
|
37
37
|
* Copyright (c) 2011 Fabrice Bellard
|
|
38
|
-
*/var
|
|
38
|
+
*/var Cu=2,xu=1,ku=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let e=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(e._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){var d;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let e=this._terminal.options.scrollback===0?0:((d=this._terminal.options.overviewRuler)==null?void 0:d.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},l=o.top+o.bottom,h=o.right+o.left,a=s-l,c=r-h-e;return{cols:Math.max(Cu,Math.floor(c/t.css.cell.width)),rows:Math.max(xu,Math.floor(a/t.css.cell.height))}}};/**
|
|
39
39
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
40
40
|
* @license MIT
|
|
41
41
|
*
|
|
@@ -46,24 +46,13 @@ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){t
|
|
|
46
46
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
47
47
|
* http://bellard.org/jslinux/
|
|
48
48
|
* Copyright (c) 2011 Fabrice Bellard
|
|
49
|
-
*/var
|
|
50
|
-
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
51
|
-
* @license MIT
|
|
52
|
-
*
|
|
53
|
-
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
54
|
-
* @license MIT
|
|
55
|
-
*
|
|
56
|
-
* Originally forked from (with the author's permission):
|
|
57
|
-
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
58
|
-
* http://bellard.org/jslinux/
|
|
59
|
-
* Copyright (c) 2011 Fabrice Bellard
|
|
60
|
-
*/var mu=(t,e,i,s)=>{for(var r=e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(r=o(r)||r);return r},Su=(t,e)=>(i,s)=>e(i,s,t),wu=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Zn.isErrorNoTelemetry(t)?new Zn(t.message+`
|
|
49
|
+
*/var Lu=(t,e,i,s)=>{for(var r=e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(r=o(r)||r);return r},Eu=(t,e)=>(i,s)=>e(i,s,t),Ru=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?io.isErrorNoTelemetry(t)?new io(t.message+`
|
|
61
50
|
|
|
62
51
|
`+t.stack):new Error(t.message+`
|
|
63
52
|
|
|
64
|
-
`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},bu=new wu;function Ps(t){yu(t)||bu.onUnexpectedError(t)}var Mr="Canceled";function yu(t){return t instanceof Cu?!0:t instanceof Error&&t.name===Mr&&t.message===Mr}var Cu=class extends Error{constructor(){super(Mr),this.name=this.message}},Zn=class Br extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof Br)return e;let i=new Br;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},xu;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function s(n){return n>0}t.isGreaterThan=s;function r(n){return n===0}t.isNeitherLessOrGreaterThan=r,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(xu||(xu={}));function ku(t,e){let i=this,s=!1,r;return function(){return s||(s=!0,e||(r=t.apply(i,arguments))),r}}var Ra;(t=>{function e(g){return g&&typeof g=="object"&&typeof g[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function s(){return i}t.empty=s;function*r(g){yield g}t.single=r;function n(g){return e(g)?g:r(g)}t.wrap=n;function o(g){return g||i}t.from=o;function*l(g){for(let B=g.length-1;B>=0;B--)yield g[B]}t.reverse=l;function h(g){return!g||g[Symbol.iterator]().next().done===!0}t.isEmpty=h;function a(g){return g[Symbol.iterator]().next().value}t.first=a;function c(g,B){let M=0;for(let I of g)if(B(I,M++))return!0;return!1}t.some=c;function d(g,B){for(let M of g)if(B(M))return M}t.find=d;function*u(g,B){for(let M of g)B(M)&&(yield M)}t.filter=u;function*_(g,B){let M=0;for(let I of g)yield B(I,M++)}t.map=_;function*f(g,B){let M=0;for(let I of g)yield*B(I,M++)}t.flatMap=f;function*v(...g){for(let B of g)yield*B}t.concat=v;function b(g,B,M){let I=M;for(let N of g)I=B(I,N);return I}t.reduce=b;function*y(g,B,M=g.length){for(B<0&&(B+=g.length),M<0?M+=g.length:M>g.length&&(M=g.length);B<M;B++)yield g[B]}t.slice=y;function C(g,B=Number.POSITIVE_INFINITY){let M=[];if(B===0)return[M,g];let I=g[Symbol.iterator]();for(let N=0;N<B;N++){let G=I.next();if(G.done)return[M,t.empty()];M.push(G.value)}return[M,{[Symbol.iterator](){return I}}]}t.consume=C;async function L(g){let B=[];for await(let M of g)B.push(M);return Promise.resolve(B)}t.asyncToArray=L})(Ra||(Ra={}));function Ma(t){if(Ra.is(t)){let e=[];for(let i of t)if(i)try{i.dispose()}catch(s){e.push(s)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function Ba(...t){return $e(()=>Ma(t))}function $e(t){return{dispose:ku(()=>{t()})}}var Ta=class Aa{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ma(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Aa.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};Ta.DISABLE_DISPOSED_WARNING=!1;var li=Ta,at=class{constructor(){this._store=new li,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};at.None=Object.freeze({dispose(){}});var wi=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){var e;this._isDisposed||t===this._value||((e=this._value)==null||e.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,(t=this._value)==null||t.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Vr=typeof process<"u"&&"title"in process,Ss=Vr?"node":navigator.userAgent,Lu=Vr?"node":navigator.platform,Eu=Ss.includes("Firefox"),Ru=Ss.includes("Edge"),Da=/^((?!chrome|android).)*safari/i.test(Ss);function Mu(){if(!Da)return 0;let t=Ss.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}Lu.indexOf("Linux")>=0;var Bu="",Ee=0,Re=0,Me=0,de=0,et={css:"#00000000",rgba:0},Ue;(t=>{function e(r,n,o,l){return l!==void 0?`#${Wt(r)}${Wt(n)}${Wt(o)}${Wt(l)}`:`#${Wt(r)}${Wt(n)}${Wt(o)}`}t.toCss=e;function i(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}t.toRgba=i;function s(r,n,o,l){return{css:t.toCss(r,n,o,l),rgba:t.toRgba(r,n,o,l)}}t.toColor=s})(Ue||(Ue={}));var Mi;(t=>{function e(h,a){if(de=(a.rgba&255)/255,de===1)return{css:a.css,rgba:a.rgba};let c=a.rgba>>24&255,d=a.rgba>>16&255,u=a.rgba>>8&255,_=h.rgba>>24&255,f=h.rgba>>16&255,v=h.rgba>>8&255;Ee=_+Math.round((c-_)*de),Re=f+Math.round((d-f)*de),Me=v+Math.round((u-v)*de);let b=Ue.toCss(Ee,Re,Me),y=Ue.toRgba(Ee,Re,Me);return{css:b,rgba:y}}t.blend=e;function i(h){return(h.rgba&255)===255}t.isOpaque=i;function s(h,a,c){let d=Vt.ensureContrastRatio(h.rgba,a.rgba,c);if(d)return Ue.toColor(d>>24&255,d>>16&255,d>>8&255)}t.ensureContrastRatio=s;function r(h){let a=(h.rgba|255)>>>0;return[Ee,Re,Me]=Vt.toChannels(a),{css:Ue.toCss(Ee,Re,Me),rgba:a}}t.opaque=r;function n(h,a){return de=Math.round(a*255),[Ee,Re,Me]=Vt.toChannels(h.rgba),{css:Ue.toCss(Ee,Re,Me,de),rgba:Ue.toRgba(Ee,Re,Me,de)}}t.opacity=n;function o(h,a){return de=h.rgba&255,n(h,de*a/255)}t.multiplyOpacity=o;function l(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}t.toColorRGB=l})(Mi||(Mi={}));var Tu;(t=>{let e,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Ee=parseInt(r.slice(1,2).repeat(2),16),Re=parseInt(r.slice(2,3).repeat(2),16),Me=parseInt(r.slice(3,4).repeat(2),16),Ue.toColor(Ee,Re,Me);case 5:return Ee=parseInt(r.slice(1,2).repeat(2),16),Re=parseInt(r.slice(2,3).repeat(2),16),Me=parseInt(r.slice(3,4).repeat(2),16),de=parseInt(r.slice(4,5).repeat(2),16),Ue.toColor(Ee,Re,Me,de);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Ee=parseInt(n[1]),Re=parseInt(n[2]),Me=parseInt(n[3]),de=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Ue.toColor(Ee,Re,Me,de);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Ee,Re,Me,de]=e.getImageData(0,0,1,1).data,de!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ue.toRgba(Ee,Re,Me,de),css:r}}t.toColor=s})(Tu||(Tu={}));var He;(t=>{function e(s){return i(s>>16&255,s>>8&255,s&255)}t.relativeLuminance=e;function i(s,r,n){let o=s/255,l=r/255,h=n/255,a=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),d=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return a*.2126+c*.7152+d*.0722}t.relativeLuminance2=i})(He||(He={}));var Vt;(t=>{function e(o,l){if(de=(l&255)/255,de===1)return l;let h=l>>24&255,a=l>>16&255,c=l>>8&255,d=o>>24&255,u=o>>16&255,_=o>>8&255;return Ee=d+Math.round((h-d)*de),Re=u+Math.round((a-u)*de),Me=_+Math.round((c-_)*de),Ue.toRgba(Ee,Re,Me)}t.blend=e;function i(o,l,h){let a=He.relativeLuminance(o>>8),c=He.relativeLuminance(l>>8);if(wt(a,c)<h){if(c<a){let _=s(o,l,h),f=wt(a,He.relativeLuminance(_>>8));if(f<h){let v=r(o,l,h),b=wt(a,He.relativeLuminance(v>>8));return f>b?_:v}return _}let d=r(o,l,h),u=wt(a,He.relativeLuminance(d>>8));if(u<h){let _=s(o,l,h),f=wt(a,He.relativeLuminance(_>>8));return u>f?d:_}return d}}t.ensureContrastRatio=i;function s(o,l,h){let a=o>>24&255,c=o>>16&255,d=o>>8&255,u=l>>24&255,_=l>>16&255,f=l>>8&255,v=wt(He.relativeLuminance2(u,_,f),He.relativeLuminance2(a,c,d));for(;v<h&&(u>0||_>0||f>0);)u-=Math.max(0,Math.ceil(u*.1)),_-=Math.max(0,Math.ceil(_*.1)),f-=Math.max(0,Math.ceil(f*.1)),v=wt(He.relativeLuminance2(u,_,f),He.relativeLuminance2(a,c,d));return(u<<24|_<<16|f<<8|255)>>>0}t.reduceLuminance=s;function r(o,l,h){let a=o>>24&255,c=o>>16&255,d=o>>8&255,u=l>>24&255,_=l>>16&255,f=l>>8&255,v=wt(He.relativeLuminance2(u,_,f),He.relativeLuminance2(a,c,d));for(;v<h&&(u<255||_<255||f<255);)u=Math.min(255,u+Math.ceil((255-u)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),v=wt(He.relativeLuminance2(u,_,f),He.relativeLuminance2(a,c,d));return(u<<24|_<<16|f<<8|255)>>>0}t.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(Vt||(Vt={}));function Wt(t){let e=t.toString(16);return e.length<2?"0"+e:e}function wt(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}function pe(t){if(!t)throw new Error("value must not be falsy");return t}function Yr(t){return 57508<=t&&t<=57558}function Au(t){return 57520<=t&&t<=57527}function Du(t){return 57344<=t&&t<=63743}function Pu(t){return 9472<=t&&t<=9631}function Ou(t){return t>=128512&&t<=128591||t>=127744&&t<=128511||t>=128640&&t<=128767||t>=9728&&t<=9983||t>=9984&&t<=10175||t>=65024&&t<=65039||t>=129280&&t<=129535||t>=127462&&t<=127487}function Iu(t,e,i,s){return e===1&&i>Math.ceil(s*1.5)&&t!==void 0&&t>255&&!Ou(t)&&!Yr(t)&&!Du(t)}function Pa(t){return Yr(t)||Pu(t)}function Fu(){return{css:{canvas:Yi(),cell:Yi()},device:{canvas:Yi(),cell:Yi(),char:{width:0,height:0,left:0,top:0}}}}function Yi(){return{width:0,height:0}}function $u(t,e,i=0){return(t-(Math.round(e)*2-i))%(Math.round(e)*2)}var De=0,ye=0,dt=!1,bt=!1,Gi=!1,Ye,Os=0,Nu=class{constructor(t,e,i,s,r,n){this._terminal=t,this._optionService=e,this._selectionRenderModel=i,this._decorationService=s,this._coreBrowserService=r,this._themeService=n,this.result={fg:0,bg:0,ext:0}}resolve(t,e,i,s){if(this.result.bg=t.bg,this.result.fg=t.fg,this.result.ext=t.bg&268435456?t.extended.ext:0,ye=0,De=0,bt=!1,dt=!1,Gi=!1,Ye=this._themeService.colors,Os=0,t.getCode()!==0&&t.extended.underlineStyle===4){let r=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Os=e*s%(Math.round(r)*2)}if(this._decorationService.forEachDecorationAtCell(e,i,"bottom",r=>{r.backgroundColorRGB&&(ye=r.backgroundColorRGB.rgba>>8&16777215,bt=!0),r.foregroundColorRGB&&(De=r.foregroundColorRGB.rgba>>8&16777215,dt=!0)}),Gi=this._selectionRenderModel.isCellSelected(this._terminal,e,i),Gi){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:ye=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:ye=(this.result.fg&16777215)<<8|255;break;case 0:default:ye=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:ye=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:ye=(this.result.bg&16777215)<<8|255;break}ye=Vt.blend(ye,(this._coreBrowserService.isFocused?Ye.selectionBackgroundOpaque:Ye.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else ye=(this._coreBrowserService.isFocused?Ye.selectionBackgroundOpaque:Ye.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(bt=!0,Ye.selectionForeground&&(De=Ye.selectionForeground.rgba>>8&16777215,dt=!0),Pa(t.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)De=(this._coreBrowserService.isFocused?Ye.selectionBackgroundOpaque:Ye.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:De=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:De=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:De=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:De=(this.result.fg&16777215)<<8|255;break;case 0:default:De=this._themeService.colors.foreground.rgba}De=Vt.blend(De,(this._coreBrowserService.isFocused?Ye.selectionBackgroundOpaque:Ye.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}dt=!0}}this._decorationService.forEachDecorationAtCell(e,i,"top",r=>{r.backgroundColorRGB&&(ye=r.backgroundColorRGB.rgba>>8&16777215,bt=!0),r.foregroundColorRGB&&(De=r.foregroundColorRGB.rgba>>8&16777215,dt=!0)}),bt&&(Gi?ye=t.bg&-16777216&-134217729|ye|50331648:ye=t.bg&-16777216|ye|50331648),dt&&(De=t.fg&-16777216&-67108865|De|50331648),this.result.fg&67108864&&(bt&&!dt&&((this.result.bg&50331648)===0?De=this.result.fg&-134217728|Ye.background.rgba>>8&16777215&16777215|50331648:De=this.result.fg&-134217728|this.result.bg&67108863,dt=!0),!bt&&dt&&((this.result.fg&50331648)===0?ye=this.result.bg&-67108864|Ye.foreground.rgba>>8&16777215&16777215|50331648:ye=this.result.bg&-67108864|this.result.fg&67108863,bt=!0)),Ye=void 0,this.result.bg=bt?ye:this.result.bg,this.result.fg=dt?De:this.result.fg,this.result.ext&=536870911,this.result.ext|=Os<<29&3758096384}},Wu=.5,Oa=Eu||Ru?"bottom":"ideographic",zu={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{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}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{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}],"🮖":[{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}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Hu={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},Uu={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╒":{1:(t,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(t,e)=>`M${.5-t},1 L${.5-t},.5 L1,.5 M${.5+t},.5 L${.5+t},1`},"╔":{1:(t,e)=>`M1,${.5-e} L${.5-t},${.5-e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1`},"╕":{1:(t,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(t,e)=>`M${.5+t},1 L${.5+t},.5 L0,.5 M${.5-t},.5 L${.5-t},1`},"╗":{1:(t,e)=>`M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M0,${.5-e} L${.5+t},${.5-e} L${.5+t},1`},"╘":{1:(t,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(t,e)=>`M1,.5 L${.5-t},.5 L${.5-t},0 M${.5+t},.5 L${.5+t},0`},"╚":{1:(t,e)=>`M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0 M1,${.5+e} L${.5-t},${.5+e} L${.5-t},0`},"╛":{1:(t,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(t,e)=>`M0,.5 L${.5+t},.5 L${.5+t},0 M${.5-t},.5 L${.5-t},0`},"╝":{1:(t,e)=>`M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M0,${.5+e} L${.5+t},${.5+e} L${.5+t},0`},"╞":{1:(t,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1 M${.5+t},.5 L1,.5`},"╠":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╡":{1:(t,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(t,e)=>`M0,.5 L${.5-t},.5 M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╣":{1:(t,e)=>`M${.5+t},0 L${.5+t},1 M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0`},"╤":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},.5 L${.5-t},1 M${.5+t},.5 L${.5+t},1`},"╦":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1`},"╧":{1:(t,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},.5 L${.5-t},0 M${.5+t},.5 L${.5+t},0`},"╩":{1:(t,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╪":{1:(t,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╬":{1:(t,e)=>`M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1 M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(t,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(t,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(t,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(t,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},Ii={"":{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},"":{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},"":{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},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{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},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{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},"":{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},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Ii[""]=Ii[""];Ii[""]=Ii[""];function Ku(t,e,i,s,r,n,o,l){let h=zu[e];if(h)return qu(t,h,i,s,r,n),!0;let a=Hu[e];if(a)return Vu(t,a,i,s,r,n),!0;let c=Uu[e];if(c)return Yu(t,c,i,s,r,n,l),!0;let d=Ii[e];return d?(Gu(t,d,i,s,r,n,o,l),!0):!1}function qu(t,e,i,s,r,n){for(let o=0;o<e.length;o++){let l=e[o],h=r/8,a=n/8;t.fillRect(i+l.x*h,s+l.y*a,l.w*h,l.h*a)}}var Jn=new Map;function Vu(t,e,i,s,r,n){let o=Jn.get(e);o||(o=new Map,Jn.set(e,o));let l=t.fillStyle;if(typeof l!="string")throw new Error(`Unexpected fillStyle type "${l}"`);let h=o.get(l);if(!h){let a=e[0].length,c=e.length,d=t.canvas.ownerDocument.createElement("canvas");d.width=a,d.height=c;let u=pe(d.getContext("2d")),_=new ImageData(a,c),f,v,b,y;if(l.startsWith("#"))f=parseInt(l.slice(1,3),16),v=parseInt(l.slice(3,5),16),b=parseInt(l.slice(5,7),16),y=l.length>7&&parseInt(l.slice(7,9),16)||1;else if(l.startsWith("rgba"))[f,v,b,y]=l.substring(5,l.length-1).split(",").map(C=>parseFloat(C));else throw new Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);for(let C=0;C<c;C++)for(let L=0;L<a;L++)_.data[(C*a+L)*4]=f,_.data[(C*a+L)*4+1]=v,_.data[(C*a+L)*4+2]=b,_.data[(C*a+L)*4+3]=e[C][L]*(y*255);u.putImageData(_,0,0),h=pe(t.createPattern(d,null)),o.set(l,h)}t.fillStyle=h,t.fillRect(i,s,r,n)}function Yu(t,e,i,s,r,n,o){t.strokeStyle=t.fillStyle;for(let[l,h]of Object.entries(e)){t.beginPath(),t.lineWidth=o*Number.parseInt(l);let a;if(typeof h=="function"){let c=.15/n*r;a=h(.15,c)}else a=h;for(let c of a.split(" ")){let d=c[0],u=Ia[d];if(!u){console.error(`Could not find drawing instructions for "${d}"`);continue}let _=c.substring(1).split(",");!_[0]||!_[1]||u(t,Fa(_,r,n,i,s,!0,o))}t.stroke(),t.closePath()}}function Gu(t,e,i,s,r,n,o,l){let h=new Path2D;h.rect(i,s,r,n),t.clip(h),t.beginPath();let a=o/12;t.lineWidth=l*a;for(let c of e.d.split(" ")){let d=c[0],u=Ia[d];if(!u){console.error(`Could not find drawing instructions for "${d}"`);continue}let _=c.substring(1).split(",");!_[0]||!_[1]||u(t,Fa(_,r,n,i,s,!1,l,(e.leftPadding??0)*(a/2),(e.rightPadding??0)*(a/2)))}e.type===1?(t.strokeStyle=t.fillStyle,t.stroke()):t.fill(),t.closePath()}function Qn(t,e,i=0){return Math.max(Math.min(t,e),i)}var Ia={C:(t,e)=>t.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(t,e)=>t.lineTo(e[0],e[1]),M:(t,e)=>t.moveTo(e[0],e[1])};function Fa(t,e,i,s,r,n,o,l=0,h=0){let a=t.map(c=>parseFloat(c)||parseInt(c));if(a.length<2)throw new Error("Too few arguments for instruction");for(let c=0;c<a.length;c+=2)a[c]*=e-l*o-h*o,n&&a[c]!==0&&(a[c]=Qn(Math.round(a[c]+.5)-.5,e,0)),a[c]+=s+l*o;for(let c=1;c<a.length;c+=2)a[c]*=i,n&&a[c]!==0&&(a[c]=Qn(Math.round(a[c]+.5)-.5,i,0)),a[c]+=r;return a}var eo=class{constructor(){this._data={}}set(t,e,i){this._data[t]||(this._data[t]={}),this._data[t][e]=i}get(t,e){return this._data[t]?this._data[t][e]:void 0}clear(){this._data={}}},to=class{constructor(){this._data=new eo}set(t,e,i,s,r){this._data.get(t,e)||this._data.set(t,e,new eo),this._data.get(t,e).set(i,s,r)}get(t,e,i,s){var r;return(r=this._data.get(t,e))==null?void 0:r.get(i,s)}clear(){this._data.clear()}},$a=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),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(t){this._idleCallback=void 0;let e=0,i=0,s=t.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),i=Math.max(e,i),r=t.timeRemaining(),i*1.5>r){s-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-e))}ms`),this._start();return}s=r}this.clear()}},ju=class extends $a{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let e=performance.now()+t;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},Xu=class extends $a{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},Zu=!Vr&&"requestIdleCallback"in window?Xu:ju,ni=class Na{constructor(){this.fg=0,this.bg=0,this.extended=new Wa}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new Na;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}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}},Wa=class za{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new za(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ju=globalThis.performance&&typeof globalThis.performance.now=="function",Qu=class Ha{static create(e){return new Ha(e)}constructor(e){this._now=Ju&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},kt;(t=>{t.None=()=>at.None;function e(S,p){return d(S,()=>{},0,void 0,!0,void 0,p)}t.defer=e;function i(S){return(p,w=null,m)=>{let k=!1,E;return E=S(A=>{if(!k)return E?E.dispose():k=!0,p.call(w,A)},null,m),k&&E.dispose(),E}}t.once=i;function s(S,p,w){return a((m,k=null,E)=>S(A=>m.call(k,p(A)),null,E),w)}t.map=s;function r(S,p,w){return a((m,k=null,E)=>S(A=>{p(A),m.call(k,A)},null,E),w)}t.forEach=r;function n(S,p,w){return a((m,k=null,E)=>S(A=>p(A)&&m.call(k,A),null,E),w)}t.filter=n;function o(S){return S}t.signal=o;function l(...S){return(p,w=null,m)=>{let k=Ba(...S.map(E=>E(A=>p.call(w,A))));return c(k,m)}}t.any=l;function h(S,p,w,m){let k=w;return s(S,E=>(k=p(k,E),k),m)}t.reduce=h;function a(S,p){let w,m={onWillAddFirstListener(){w=S(k.fire,k)},onDidRemoveLastListener(){w==null||w.dispose()}},k=new ne(m);return p==null||p.add(k),k.event}function c(S,p){return p instanceof Array?p.push(S):p&&p.add(S),S}function d(S,p,w=100,m=!1,k=!1,E,A){let R,D,z,Z=0,H,Y={leakWarningThreshold:E,onWillAddFirstListener(){R=S(X=>{Z++,D=p(D,X),m&&!z&&(F.fire(D),D=void 0),H=()=>{let q=D;D=void 0,z=void 0,(!m||Z>1)&&F.fire(q),Z=0},typeof w=="number"?(clearTimeout(z),z=setTimeout(H,w)):z===void 0&&(z=0,queueMicrotask(H))})},onWillRemoveListener(){k&&Z>0&&(H==null||H())},onDidRemoveLastListener(){H=void 0,R.dispose()}},F=new ne(Y);return A==null||A.add(F),F.event}t.debounce=d;function u(S,p=0,w){return t.debounce(S,(m,k)=>m?(m.push(k),m):[k],p,void 0,!0,void 0,w)}t.accumulate=u;function _(S,p=(m,k)=>m===k,w){let m=!0,k;return n(S,E=>{let A=m||!p(E,k);return m=!1,k=E,A},w)}t.latch=_;function f(S,p,w){return[t.filter(S,p,w),t.filter(S,m=>!p(m),w)]}t.split=f;function v(S,p=!1,w=[],m){let k=w.slice(),E=S(D=>{k?k.push(D):R.fire(D)});m&&m.add(E);let A=()=>{k==null||k.forEach(D=>R.fire(D)),k=null},R=new ne({onWillAddFirstListener(){E||(E=S(D=>R.fire(D)),m&&m.add(E))},onDidAddFirstListener(){k&&(p?setTimeout(A):A())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return m&&m.add(R),R.event}t.buffer=v;function b(S,p){return(w,m,k)=>{let E=p(new C);return S(function(A){let R=E.evaluate(A);R!==y&&w.call(m,R)},void 0,k)}}t.chain=b;let y=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(p){return this.steps.push(p),this}forEach(p){return this.steps.push(w=>(p(w),w)),this}filter(p){return this.steps.push(w=>p(w)?w:y),this}reduce(p,w){let m=w;return this.steps.push(k=>(m=p(m,k),m)),this}latch(p=(w,m)=>w===m){let w=!0,m;return this.steps.push(k=>{let E=w||!p(k,m);return w=!1,m=k,E?k:y}),this}evaluate(p){for(let w of this.steps)if(p=w(p),p===y)break;return p}}function L(S,p,w=m=>m){let m=(...R)=>A.fire(w(...R)),k=()=>S.on(p,m),E=()=>S.removeListener(p,m),A=new ne({onWillAddFirstListener:k,onDidRemoveLastListener:E});return A.event}t.fromNodeEventEmitter=L;function g(S,p,w=m=>m){let m=(...R)=>A.fire(w(...R)),k=()=>S.addEventListener(p,m),E=()=>S.removeEventListener(p,m),A=new ne({onWillAddFirstListener:k,onDidRemoveLastListener:E});return A.event}t.fromDOMEventEmitter=g;function B(S){return new Promise(p=>i(S)(p))}t.toPromise=B;function M(S){let p=new ne;return S.then(w=>{p.fire(w)},()=>{p.fire(void 0)}).finally(()=>{p.dispose()}),p.event}t.fromPromise=M;function I(S,p){return S(w=>p.fire(w))}t.forward=I;function N(S,p,w){return p(w),S(m=>p(m))}t.runAndSubscribe=N;class G{constructor(p,w){this._observable=p,this._counter=0,this._hasChanged=!1;let m={onWillAddFirstListener:()=>{p.addObserver(this)},onDidRemoveLastListener:()=>{p.removeObserver(this)}};this.emitter=new ne(m),w&&w.add(this.emitter)}beginUpdate(p){this._counter++}handlePossibleChange(p){}handleChange(p,w){this._hasChanged=!0}endUpdate(p){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Q(S,p){return new G(S,p).emitter.event}t.fromObservable=Q;function $(S){return(p,w,m)=>{let k=0,E=!1,A={beginUpdate(){k++},endUpdate(){k--,k===0&&(S.reportChanges(),E&&(E=!1,p.call(w)))},handlePossibleChange(){},handleChange(){E=!0}};S.addObserver(A),S.reportChanges();let R={dispose(){S.removeObserver(A)}};return m instanceof li?m.add(R):Array.isArray(m)&&m.push(R),R}}t.fromObservableLight=$})(kt||(kt={}));var Tr=class Ar{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${Ar._idPool++}`,Ar.all.add(this)}start(e){this._stopWatch=new Qu,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Tr.all=new Set,Tr._idPool=0;var e_=Tr,t_=-1,Ua=class Ka{constructor(e,i,s=(Ka._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[n,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(n);let h=new r_(l,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[s,r]of this._stacks)(!e||i<r)&&(e=[s,r],i=r);return e}};Ua._idPool=1;var i_=Ua,s_=class qa{constructor(e){this.value=e}static create(){let e=new Error;return new qa(e.stack??"")}print(){console.warn(this.value.split(`
|
|
53
|
+
`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},Mu=new Ru;function Is(t){Bu(t)||Mu.onUnexpectedError(t)}var Ar="Canceled";function Bu(t){return t instanceof Tu?!0:t instanceof Error&&t.name===Ar&&t.message===Ar}var Tu=class extends Error{constructor(){super(Ar),this.name=this.message}},io=class Dr extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof Dr)return e;let i=new Dr;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},Au;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function s(n){return n>0}t.isGreaterThan=s;function r(n){return n===0}t.isNeitherLessOrGreaterThan=r,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(Au||(Au={}));function Du(t,e){let i=this,s=!1,r;return function(){return s||(s=!0,e||(r=t.apply(i,arguments))),r}}var Fa;(t=>{function e(g){return g&&typeof g=="object"&&typeof g[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function s(){return i}t.empty=s;function*r(g){yield g}t.single=r;function n(g){return e(g)?g:r(g)}t.wrap=n;function o(g){return g||i}t.from=o;function*l(g){for(let E=g.length-1;E>=0;E--)yield g[E]}t.reverse=l;function h(g){return!g||g[Symbol.iterator]().next().done===!0}t.isEmpty=h;function a(g){return g[Symbol.iterator]().next().value}t.first=a;function c(g,E){let T=0;for(let O of g)if(E(O,T++))return!0;return!1}t.some=c;function d(g,E){for(let T of g)if(E(T))return T}t.find=d;function*u(g,E){for(let T of g)E(T)&&(yield T)}t.filter=u;function*_(g,E){let T=0;for(let O of g)yield E(O,T++)}t.map=_;function*f(g,E){let T=0;for(let O of g)yield*E(O,T++)}t.flatMap=f;function*p(...g){for(let E of g)yield*E}t.concat=p;function w(g,E,T){let O=T;for(let $ of g)O=E(O,$);return O}t.reduce=w;function*C(g,E,T=g.length){for(E<0&&(E+=g.length),T<0?T+=g.length:T>g.length&&(T=g.length);E<T;E++)yield g[E]}t.slice=C;function k(g,E=Number.POSITIVE_INFINITY){let T=[];if(E===0)return[T,g];let O=g[Symbol.iterator]();for(let $=0;$<E;$++){let G=O.next();if(G.done)return[T,t.empty()];T.push(G.value)}return[T,{[Symbol.iterator](){return O}}]}t.consume=k;async function L(g){let E=[];for await(let T of g)E.push(T);return Promise.resolve(E)}t.asyncToArray=L})(Fa||(Fa={}));function $a(t){if(Fa.is(t)){let e=[];for(let i of t)if(i)try{i.dispose()}catch(s){e.push(s)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function Na(...t){return Ne(()=>$a(t))}function Ne(t){return{dispose:Du(()=>{t()})}}var Wa=class za{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{$a(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?za.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};Wa.DISABLE_DISPOSED_WARNING=!1;var li=Wa,at=class{constructor(){this._store=new li,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};at.None=Object.freeze({dispose(){}});var wi=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){var e;this._isDisposed||t===this._value||((e=this._value)==null||e.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,(t=this._value)==null||t.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Gr=typeof process<"u"&&"title"in process,ws=Gr?"node":navigator.userAgent,Pu=Gr?"node":navigator.platform,Iu=ws.includes("Firefox"),Ou=ws.includes("Edge"),Ha=/^((?!chrome|android).)*safari/i.test(ws);function Fu(){if(!Ha)return 0;let t=ws.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}Pu.indexOf("Linux")>=0;var $u="",Me=0,Be=0,Te=0,ce=0,et={css:"#00000000",rgba:0},Ue;(t=>{function e(r,n,o,l){return l!==void 0?`#${Wt(r)}${Wt(n)}${Wt(o)}${Wt(l)}`:`#${Wt(r)}${Wt(n)}${Wt(o)}`}t.toCss=e;function i(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}t.toRgba=i;function s(r,n,o,l){return{css:t.toCss(r,n,o,l),rgba:t.toRgba(r,n,o,l)}}t.toColor=s})(Ue||(Ue={}));var Mi;(t=>{function e(h,a){if(ce=(a.rgba&255)/255,ce===1)return{css:a.css,rgba:a.rgba};let c=a.rgba>>24&255,d=a.rgba>>16&255,u=a.rgba>>8&255,_=h.rgba>>24&255,f=h.rgba>>16&255,p=h.rgba>>8&255;Me=_+Math.round((c-_)*ce),Be=f+Math.round((d-f)*ce),Te=p+Math.round((u-p)*ce);let w=Ue.toCss(Me,Be,Te),C=Ue.toRgba(Me,Be,Te);return{css:w,rgba:C}}t.blend=e;function i(h){return(h.rgba&255)===255}t.isOpaque=i;function s(h,a,c){let d=Vt.ensureContrastRatio(h.rgba,a.rgba,c);if(d)return Ue.toColor(d>>24&255,d>>16&255,d>>8&255)}t.ensureContrastRatio=s;function r(h){let a=(h.rgba|255)>>>0;return[Me,Be,Te]=Vt.toChannels(a),{css:Ue.toCss(Me,Be,Te),rgba:a}}t.opaque=r;function n(h,a){return ce=Math.round(a*255),[Me,Be,Te]=Vt.toChannels(h.rgba),{css:Ue.toCss(Me,Be,Te,ce),rgba:Ue.toRgba(Me,Be,Te,ce)}}t.opacity=n;function o(h,a){return ce=h.rgba&255,n(h,ce*a/255)}t.multiplyOpacity=o;function l(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}t.toColorRGB=l})(Mi||(Mi={}));var Nu;(t=>{let e,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Me=parseInt(r.slice(1,2).repeat(2),16),Be=parseInt(r.slice(2,3).repeat(2),16),Te=parseInt(r.slice(3,4).repeat(2),16),Ue.toColor(Me,Be,Te);case 5:return Me=parseInt(r.slice(1,2).repeat(2),16),Be=parseInt(r.slice(2,3).repeat(2),16),Te=parseInt(r.slice(3,4).repeat(2),16),ce=parseInt(r.slice(4,5).repeat(2),16),Ue.toColor(Me,Be,Te,ce);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Me=parseInt(n[1]),Be=parseInt(n[2]),Te=parseInt(n[3]),ce=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Ue.toColor(Me,Be,Te,ce);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Me,Be,Te,ce]=e.getImageData(0,0,1,1).data,ce!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ue.toRgba(Me,Be,Te,ce),css:r}}t.toColor=s})(Nu||(Nu={}));var He;(t=>{function e(s){return i(s>>16&255,s>>8&255,s&255)}t.relativeLuminance=e;function i(s,r,n){let o=s/255,l=r/255,h=n/255,a=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),d=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return a*.2126+c*.7152+d*.0722}t.relativeLuminance2=i})(He||(He={}));var Vt;(t=>{function e(o,l){if(ce=(l&255)/255,ce===1)return l;let h=l>>24&255,a=l>>16&255,c=l>>8&255,d=o>>24&255,u=o>>16&255,_=o>>8&255;return Me=d+Math.round((h-d)*ce),Be=u+Math.round((a-u)*ce),Te=_+Math.round((c-_)*ce),Ue.toRgba(Me,Be,Te)}t.blend=e;function i(o,l,h){let a=He.relativeLuminance(o>>8),c=He.relativeLuminance(l>>8);if(wt(a,c)<h){if(c<a){let _=s(o,l,h),f=wt(a,He.relativeLuminance(_>>8));if(f<h){let p=r(o,l,h),w=wt(a,He.relativeLuminance(p>>8));return f>w?_:p}return _}let d=r(o,l,h),u=wt(a,He.relativeLuminance(d>>8));if(u<h){let _=s(o,l,h),f=wt(a,He.relativeLuminance(_>>8));return u>f?d:_}return d}}t.ensureContrastRatio=i;function s(o,l,h){let a=o>>24&255,c=o>>16&255,d=o>>8&255,u=l>>24&255,_=l>>16&255,f=l>>8&255,p=wt(He.relativeLuminance2(u,_,f),He.relativeLuminance2(a,c,d));for(;p<h&&(u>0||_>0||f>0);)u-=Math.max(0,Math.ceil(u*.1)),_-=Math.max(0,Math.ceil(_*.1)),f-=Math.max(0,Math.ceil(f*.1)),p=wt(He.relativeLuminance2(u,_,f),He.relativeLuminance2(a,c,d));return(u<<24|_<<16|f<<8|255)>>>0}t.reduceLuminance=s;function r(o,l,h){let a=o>>24&255,c=o>>16&255,d=o>>8&255,u=l>>24&255,_=l>>16&255,f=l>>8&255,p=wt(He.relativeLuminance2(u,_,f),He.relativeLuminance2(a,c,d));for(;p<h&&(u<255||_<255||f<255);)u=Math.min(255,u+Math.ceil((255-u)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),p=wt(He.relativeLuminance2(u,_,f),He.relativeLuminance2(a,c,d));return(u<<24|_<<16|f<<8|255)>>>0}t.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(Vt||(Vt={}));function Wt(t){let e=t.toString(16);return e.length<2?"0"+e:e}function wt(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}function ve(t){if(!t)throw new Error("value must not be falsy");return t}function Xr(t){return 57508<=t&&t<=57558}function Wu(t){return 57520<=t&&t<=57527}function zu(t){return 57344<=t&&t<=63743}function Hu(t){return 9472<=t&&t<=9631}function Uu(t){return t>=128512&&t<=128591||t>=127744&&t<=128511||t>=128640&&t<=128767||t>=9728&&t<=9983||t>=9984&&t<=10175||t>=65024&&t<=65039||t>=129280&&t<=129535||t>=127462&&t<=127487}function Ku(t,e,i,s){return e===1&&i>Math.ceil(s*1.5)&&t!==void 0&&t>255&&!Uu(t)&&!Xr(t)&&!zu(t)}function Ua(t){return Xr(t)||Hu(t)}function qu(){return{css:{canvas:ji(),cell:ji()},device:{canvas:ji(),cell:ji(),char:{width:0,height:0,left:0,top:0}}}}function ji(){return{width:0,height:0}}function Vu(t,e,i=0){return(t-(Math.round(e)*2-i))%(Math.round(e)*2)}var Pe=0,xe=0,dt=!1,bt=!1,Gi=!1,je,Os=0,Yu=class{constructor(t,e,i,s,r,n){this._terminal=t,this._optionService=e,this._selectionRenderModel=i,this._decorationService=s,this._coreBrowserService=r,this._themeService=n,this.result={fg:0,bg:0,ext:0}}resolve(t,e,i,s){if(this.result.bg=t.bg,this.result.fg=t.fg,this.result.ext=t.bg&268435456?t.extended.ext:0,xe=0,Pe=0,bt=!1,dt=!1,Gi=!1,je=this._themeService.colors,Os=0,t.getCode()!==0&&t.extended.underlineStyle===4){let r=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Os=e*s%(Math.round(r)*2)}if(this._decorationService.forEachDecorationAtCell(e,i,"bottom",r=>{r.backgroundColorRGB&&(xe=r.backgroundColorRGB.rgba>>8&16777215,bt=!0),r.foregroundColorRGB&&(Pe=r.foregroundColorRGB.rgba>>8&16777215,dt=!0)}),Gi=this._selectionRenderModel.isCellSelected(this._terminal,e,i),Gi){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:xe=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:xe=(this.result.fg&16777215)<<8|255;break;case 0:default:xe=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:xe=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:xe=(this.result.bg&16777215)<<8|255;break}xe=Vt.blend(xe,(this._coreBrowserService.isFocused?je.selectionBackgroundOpaque:je.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else xe=(this._coreBrowserService.isFocused?je.selectionBackgroundOpaque:je.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(bt=!0,je.selectionForeground&&(Pe=je.selectionForeground.rgba>>8&16777215,dt=!0),Ua(t.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Pe=(this._coreBrowserService.isFocused?je.selectionBackgroundOpaque:je.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Pe=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Pe=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Pe=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Pe=(this.result.fg&16777215)<<8|255;break;case 0:default:Pe=this._themeService.colors.foreground.rgba}Pe=Vt.blend(Pe,(this._coreBrowserService.isFocused?je.selectionBackgroundOpaque:je.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}dt=!0}}this._decorationService.forEachDecorationAtCell(e,i,"top",r=>{r.backgroundColorRGB&&(xe=r.backgroundColorRGB.rgba>>8&16777215,bt=!0),r.foregroundColorRGB&&(Pe=r.foregroundColorRGB.rgba>>8&16777215,dt=!0)}),bt&&(Gi?xe=t.bg&-16777216&-134217729|xe|50331648:xe=t.bg&-16777216|xe|50331648),dt&&(Pe=t.fg&-16777216&-67108865|Pe|50331648),this.result.fg&67108864&&(bt&&!dt&&((this.result.bg&50331648)===0?Pe=this.result.fg&-134217728|je.background.rgba>>8&16777215&16777215|50331648:Pe=this.result.fg&-134217728|this.result.bg&67108863,dt=!0),!bt&&dt&&((this.result.fg&50331648)===0?xe=this.result.bg&-67108864|je.foreground.rgba>>8&16777215&16777215|50331648:xe=this.result.bg&-67108864|this.result.fg&67108863,bt=!0)),je=void 0,this.result.bg=bt?xe:this.result.bg,this.result.fg=dt?Pe:this.result.fg,this.result.ext&=536870911,this.result.ext|=Os<<29&3758096384}},ju=.5,Ka=Iu||Ou?"bottom":"ideographic",Gu={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{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}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{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}],"🮖":[{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}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Xu={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},Zu={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╒":{1:(t,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(t,e)=>`M${.5-t},1 L${.5-t},.5 L1,.5 M${.5+t},.5 L${.5+t},1`},"╔":{1:(t,e)=>`M1,${.5-e} L${.5-t},${.5-e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1`},"╕":{1:(t,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(t,e)=>`M${.5+t},1 L${.5+t},.5 L0,.5 M${.5-t},.5 L${.5-t},1`},"╗":{1:(t,e)=>`M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M0,${.5-e} L${.5+t},${.5-e} L${.5+t},1`},"╘":{1:(t,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(t,e)=>`M1,.5 L${.5-t},.5 L${.5-t},0 M${.5+t},.5 L${.5+t},0`},"╚":{1:(t,e)=>`M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0 M1,${.5+e} L${.5-t},${.5+e} L${.5-t},0`},"╛":{1:(t,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(t,e)=>`M0,.5 L${.5+t},.5 L${.5+t},0 M${.5-t},.5 L${.5-t},0`},"╝":{1:(t,e)=>`M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M0,${.5+e} L${.5+t},${.5+e} L${.5+t},0`},"╞":{1:(t,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1 M${.5+t},.5 L1,.5`},"╠":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╡":{1:(t,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(t,e)=>`M0,.5 L${.5-t},.5 M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╣":{1:(t,e)=>`M${.5+t},0 L${.5+t},1 M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0`},"╤":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},.5 L${.5-t},1 M${.5+t},.5 L${.5+t},1`},"╦":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1`},"╧":{1:(t,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},.5 L${.5-t},0 M${.5+t},.5 L${.5+t},0`},"╩":{1:(t,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╪":{1:(t,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╬":{1:(t,e)=>`M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1 M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(t,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(t,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(t,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(t,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},Fi={"":{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},"":{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},"":{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},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{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},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{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},"":{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},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Fi[""]=Fi[""];Fi[""]=Fi[""];function Ju(t,e,i,s,r,n,o,l){let h=Gu[e];if(h)return Qu(t,h,i,s,r,n),!0;let a=Xu[e];if(a)return e_(t,a,i,s,r,n),!0;let c=Zu[e];if(c)return t_(t,c,i,s,r,n,l),!0;let d=Fi[e];return d?(i_(t,d,i,s,r,n,o,l),!0):!1}function Qu(t,e,i,s,r,n){for(let o=0;o<e.length;o++){let l=e[o],h=r/8,a=n/8;t.fillRect(i+l.x*h,s+l.y*a,l.w*h,l.h*a)}}var so=new Map;function e_(t,e,i,s,r,n){let o=so.get(e);o||(o=new Map,so.set(e,o));let l=t.fillStyle;if(typeof l!="string")throw new Error(`Unexpected fillStyle type "${l}"`);let h=o.get(l);if(!h){let a=e[0].length,c=e.length,d=t.canvas.ownerDocument.createElement("canvas");d.width=a,d.height=c;let u=ve(d.getContext("2d")),_=new ImageData(a,c),f,p,w,C;if(l.startsWith("#"))f=parseInt(l.slice(1,3),16),p=parseInt(l.slice(3,5),16),w=parseInt(l.slice(5,7),16),C=l.length>7&&parseInt(l.slice(7,9),16)||1;else if(l.startsWith("rgba"))[f,p,w,C]=l.substring(5,l.length-1).split(",").map(k=>parseFloat(k));else throw new Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);for(let k=0;k<c;k++)for(let L=0;L<a;L++)_.data[(k*a+L)*4]=f,_.data[(k*a+L)*4+1]=p,_.data[(k*a+L)*4+2]=w,_.data[(k*a+L)*4+3]=e[k][L]*(C*255);u.putImageData(_,0,0),h=ve(t.createPattern(d,null)),o.set(l,h)}t.fillStyle=h,t.fillRect(i,s,r,n)}function t_(t,e,i,s,r,n,o){t.strokeStyle=t.fillStyle;for(let[l,h]of Object.entries(e)){t.beginPath(),t.lineWidth=o*Number.parseInt(l);let a;if(typeof h=="function"){let c=.15/n*r;a=h(.15,c)}else a=h;for(let c of a.split(" ")){let d=c[0],u=qa[d];if(!u){console.error(`Could not find drawing instructions for "${d}"`);continue}let _=c.substring(1).split(",");!_[0]||!_[1]||u(t,Va(_,r,n,i,s,!0,o))}t.stroke(),t.closePath()}}function i_(t,e,i,s,r,n,o,l){let h=new Path2D;h.rect(i,s,r,n),t.clip(h),t.beginPath();let a=o/12;t.lineWidth=l*a;for(let c of e.d.split(" ")){let d=c[0],u=qa[d];if(!u){console.error(`Could not find drawing instructions for "${d}"`);continue}let _=c.substring(1).split(",");!_[0]||!_[1]||u(t,Va(_,r,n,i,s,!1,l,(e.leftPadding??0)*(a/2),(e.rightPadding??0)*(a/2)))}e.type===1?(t.strokeStyle=t.fillStyle,t.stroke()):t.fill(),t.closePath()}function ro(t,e,i=0){return Math.max(Math.min(t,e),i)}var qa={C:(t,e)=>t.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(t,e)=>t.lineTo(e[0],e[1]),M:(t,e)=>t.moveTo(e[0],e[1])};function Va(t,e,i,s,r,n,o,l=0,h=0){let a=t.map(c=>parseFloat(c)||parseInt(c));if(a.length<2)throw new Error("Too few arguments for instruction");for(let c=0;c<a.length;c+=2)a[c]*=e-l*o-h*o,n&&a[c]!==0&&(a[c]=ro(Math.round(a[c]+.5)-.5,e,0)),a[c]+=s+l*o;for(let c=1;c<a.length;c+=2)a[c]*=i,n&&a[c]!==0&&(a[c]=ro(Math.round(a[c]+.5)-.5,i,0)),a[c]+=r;return a}var no=class{constructor(){this._data={}}set(t,e,i){this._data[t]||(this._data[t]={}),this._data[t][e]=i}get(t,e){return this._data[t]?this._data[t][e]:void 0}clear(){this._data={}}},oo=class{constructor(){this._data=new no}set(t,e,i,s,r){this._data.get(t,e)||this._data.set(t,e,new no),this._data.get(t,e).set(i,s,r)}get(t,e,i,s){var r;return(r=this._data.get(t,e))==null?void 0:r.get(i,s)}clear(){this._data.clear()}},Ya=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),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(t){this._idleCallback=void 0;let e=0,i=0,s=t.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),i=Math.max(e,i),r=t.timeRemaining(),i*1.5>r){s-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-e))}ms`),this._start();return}s=r}this.clear()}},s_=class extends Ya{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let e=performance.now()+t;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},r_=class extends Ya{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},n_=!Gr&&"requestIdleCallback"in window?r_:s_,ni=class ja{constructor(){this.fg=0,this.bg=0,this.extended=new Ga}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new ja;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}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}},Ga=class Xa{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new Xa(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},o_=globalThis.performance&&typeof globalThis.performance.now=="function",a_=class Za{static create(e){return new Za(e)}constructor(e){this._now=o_&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},kt;(t=>{t.None=()=>at.None;function e(m,v){return d(m,()=>{},0,void 0,!0,void 0,v)}t.defer=e;function i(m){return(v,S=null,y)=>{let b=!1,R;return R=m(A=>{if(!b)return R?R.dispose():b=!0,v.call(S,A)},null,y),b&&R.dispose(),R}}t.once=i;function s(m,v,S){return a((y,b=null,R)=>m(A=>y.call(b,v(A)),null,R),S)}t.map=s;function r(m,v,S){return a((y,b=null,R)=>m(A=>{v(A),y.call(b,A)},null,R),S)}t.forEach=r;function n(m,v,S){return a((y,b=null,R)=>m(A=>v(A)&&y.call(b,A),null,R),S)}t.filter=n;function o(m){return m}t.signal=o;function l(...m){return(v,S=null,y)=>{let b=Na(...m.map(R=>R(A=>v.call(S,A))));return c(b,y)}}t.any=l;function h(m,v,S,y){let b=S;return s(m,R=>(b=v(b,R),b),y)}t.reduce=h;function a(m,v){let S,y={onWillAddFirstListener(){S=m(b.fire,b)},onDidRemoveLastListener(){S==null||S.dispose()}},b=new re(y);return v==null||v.add(b),b.event}function c(m,v){return v instanceof Array?v.push(m):v&&v.add(m),m}function d(m,v,S=100,y=!1,b=!1,R,A){let M,D,H,Z=0,U,ue={leakWarningThreshold:R,onWillAddFirstListener(){M=m(z=>{Z++,D=v(D,z),y&&!H&&(K.fire(D),D=void 0),U=()=>{let F=D;D=void 0,H=void 0,(!y||Z>1)&&K.fire(F),Z=0},typeof S=="number"?(clearTimeout(H),H=setTimeout(U,S)):H===void 0&&(H=0,queueMicrotask(U))})},onWillRemoveListener(){b&&Z>0&&(U==null||U())},onDidRemoveLastListener(){U=void 0,M.dispose()}},K=new re(ue);return A==null||A.add(K),K.event}t.debounce=d;function u(m,v=0,S){return t.debounce(m,(y,b)=>y?(y.push(b),y):[b],v,void 0,!0,void 0,S)}t.accumulate=u;function _(m,v=(y,b)=>y===b,S){let y=!0,b;return n(m,R=>{let A=y||!v(R,b);return y=!1,b=R,A},S)}t.latch=_;function f(m,v,S){return[t.filter(m,v,S),t.filter(m,y=>!v(y),S)]}t.split=f;function p(m,v=!1,S=[],y){let b=S.slice(),R=m(D=>{b?b.push(D):M.fire(D)});y&&y.add(R);let A=()=>{b==null||b.forEach(D=>M.fire(D)),b=null},M=new re({onWillAddFirstListener(){R||(R=m(D=>M.fire(D)),y&&y.add(R))},onDidAddFirstListener(){b&&(v?setTimeout(A):A())},onDidRemoveLastListener(){R&&R.dispose(),R=null}});return y&&y.add(M),M.event}t.buffer=p;function w(m,v){return(S,y,b)=>{let R=v(new k);return m(function(A){let M=R.evaluate(A);M!==C&&S.call(y,M)},void 0,b)}}t.chain=w;let C=Symbol("HaltChainable");class k{constructor(){this.steps=[]}map(v){return this.steps.push(v),this}forEach(v){return this.steps.push(S=>(v(S),S)),this}filter(v){return this.steps.push(S=>v(S)?S:C),this}reduce(v,S){let y=S;return this.steps.push(b=>(y=v(y,b),y)),this}latch(v=(S,y)=>S===y){let S=!0,y;return this.steps.push(b=>{let R=S||!v(b,y);return S=!1,y=b,R?b:C}),this}evaluate(v){for(let S of this.steps)if(v=S(v),v===C)break;return v}}function L(m,v,S=y=>y){let y=(...M)=>A.fire(S(...M)),b=()=>m.on(v,y),R=()=>m.removeListener(v,y),A=new re({onWillAddFirstListener:b,onDidRemoveLastListener:R});return A.event}t.fromNodeEventEmitter=L;function g(m,v,S=y=>y){let y=(...M)=>A.fire(S(...M)),b=()=>m.addEventListener(v,y),R=()=>m.removeEventListener(v,y),A=new re({onWillAddFirstListener:b,onDidRemoveLastListener:R});return A.event}t.fromDOMEventEmitter=g;function E(m){return new Promise(v=>i(m)(v))}t.toPromise=E;function T(m){let v=new re;return m.then(S=>{v.fire(S)},()=>{v.fire(void 0)}).finally(()=>{v.dispose()}),v.event}t.fromPromise=T;function O(m,v){return m(S=>v.fire(S))}t.forward=O;function $(m,v,S){return v(S),m(y=>v(y))}t.runAndSubscribe=$;class G{constructor(v,S){this._observable=v,this._counter=0,this._hasChanged=!1;let y={onWillAddFirstListener:()=>{v.addObserver(this)},onDidRemoveLastListener:()=>{v.removeObserver(this)}};this.emitter=new re(y),S&&S.add(this.emitter)}beginUpdate(v){this._counter++}handlePossibleChange(v){}handleChange(v,S){this._hasChanged=!0}endUpdate(v){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function X(m,v){return new G(m,v).emitter.event}t.fromObservable=X;function N(m){return(v,S,y)=>{let b=0,R=!1,A={beginUpdate(){b++},endUpdate(){b--,b===0&&(m.reportChanges(),R&&(R=!1,v.call(S)))},handlePossibleChange(){},handleChange(){R=!0}};m.addObserver(A),m.reportChanges();let M={dispose(){m.removeObserver(A)}};return y instanceof li?y.add(M):Array.isArray(y)&&y.push(M),M}}t.fromObservableLight=N})(kt||(kt={}));var Pr=class Ir{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${Ir._idPool++}`,Ir.all.add(this)}start(e){this._stopWatch=new a_,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Pr.all=new Set,Pr._idPool=0;var l_=Pr,h_=-1,Ja=class Qa{constructor(e,i,s=(Qa._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[n,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(n);let h=new u_(l,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[s,r]of this._stacks)(!e||i<r)&&(e=[s,r],i=r);return e}};Ja._idPool=1;var c_=Ja,d_=class el{constructor(e){this.value=e}static create(){let e=new Error;return new el(e.stack??"")}print(){console.warn(this.value.split(`
|
|
65
54
|
`).slice(2).join(`
|
|
66
|
-
`))}},r_=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},n_=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},o_=0,Is=class{constructor(t){this.value=t,this.id=o_++}},a_=2,l_,ne=class{constructor(t){var e,i,s,r;this._size=0,this._options=t,this._leakageMon=(e=this._options)!=null&&e.leakWarningThreshold?new i_((t==null?void 0:t.onListenerError)??Ps,((i=this._options)==null?void 0:i.leakWarningThreshold)??t_):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new e_(this._options._profName):void 0,this._deliveryQueue=(r=this._options)==null?void 0:r.deliveryQueue}dispose(){var t,e,i,s;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(e=this._options)==null?void 0:e.onDidRemoveLastListener)==null||i.call(e),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(t,e,i)=>{var o,l,h,a,c;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],_=new n_(`${d}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0]);return(((o=this._options)==null?void 0:o.onListenerError)||Ps)(_),at.None}if(this._disposed)return at.None;e&&(t=t.bind(e));let s=new Is(t),r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=s_.create(),r=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof Is?(this._deliveryQueue??(this._deliveryQueue=new h_),this._listeners=[this._listeners,s]):this._listeners.push(s):((h=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null||h.call(l,this),this._listeners=s,(c=(a=this._options)==null?void 0:a.onDidAddFirstListener)==null||c.call(a,this)),this._size++;let n=$e(()=>{r==null||r(),this._removeListener(s)});return i instanceof li?i.add(n):Array.isArray(i)&&i.push(n),n}),this._event}_removeListener(t){var r,n,o,l;if((n=(r=this._options)==null?void 0:r.onWillRemoveListener)==null||n.call(r,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||l.call(o,this),this._size=0;return}let e=this._listeners,i=e.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*a_<=e.length){let h=0;for(let a=0;a<e.length;a++)e[a]?e[h++]=e[a]:s&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=h}}_deliver(t,e){var s;if(!t)return;let i=((s=this._options)==null?void 0:s.onListenerError)||Ps;if(!i){t.value(e);return}try{t.value(e)}catch(r){i(r)}}_deliverQueue(t){let e=t.current._listeners;for(;t.i<t.end;)this._deliver(e[t.i++],t.value);t.reset()}fire(t){var e,i,s,r;if((e=this._deliveryQueue)!=null&&e.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof Is)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}(r=this._perfMon)==null||r.stop()}hasListeners(){return this._size>0}},h_=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},io={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}},bi=2,yi,Pt=class ii{constructor(e,i,s){this._document=e,this._config=i,this._unicodeService=s,this._didWarmUp=!1,this._cacheMap=new to,this._cacheMapCombined=new to,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new ni,this._textureSize=512,this._onAddTextureAtlasCanvas=new ne,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new ne,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=Va(e,this._config.deviceCellWidth*4+bi*2,this._config.deviceCellHeight+bi*2),this._tmpCtx=pe(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new Zu;for(let i=33;i<126;i++)e.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let s=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,s)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(ii.maxAtlasPages&&this._pages.length>=Math.max(4,ii.maxAtlasPages)){let i=this._pages.filter(a=>a.canvas.width*2<=(ii.maxTextureSize||4096)).sort((a,c)=>c.canvas.width!==a.canvas.width?c.canvas.width-a.canvas.width:c.percentageUsed-a.percentageUsed),s=-1,r=0;for(let a=0;a<i.length;a++)if(i[a].canvas.width!==r)s=a,r=i[a].canvas.width;else if(a-s===3)break;let n=i.slice(s,s+4),o=n.map(a=>a.glyphs[0].texturePage).sort((a,c)=>a>c?1:-1),l=this.pages.length-n.length,h=this._mergePages(n,l);h.version++;for(let a=o.length-1;a>=0;a--)this._deletePage(o[a]);this.pages.push(h),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(h.canvas)}let e=new Fs(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,i){let s=e[0].canvas.width*2,r=new Fs(this._document,s,e);for(let[n,o]of e.entries()){let l=n*o.canvas.width%s,h=Math.floor(n/2)*o.canvas.height;r.ctx.drawImage(o.canvas,l,h);for(let c of o.glyphs)c.texturePage=i,c.sizeClipSpace.x=c.size.x/s,c.sizeClipSpace.y=c.size.y/s,c.texturePosition.x+=l,c.texturePosition.y+=h,c.texturePositionClipSpace.x=c.texturePosition.x/s,c.texturePositionClipSpace.y=c.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(o.canvas);let a=this._activePages.indexOf(o);a!==-1&&this._activePages.splice(a,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let i=e;i<this._pages.length;i++){let s=this._pages[i];for(let r of s.glyphs)r.texturePage--;s.version++}}getRasterizedGlyphCombinedChar(e,i,s,r,n,o){return this._getFromCacheMap(this._cacheMapCombined,e,i,s,r,n,o)}getRasterizedGlyph(e,i,s,r,n,o){return this._getFromCacheMap(this._cacheMap,e,i,s,r,n,o)}_getFromCacheMap(e,i,s,r,n,o,l){return yi=e.get(i,s,r,n),yi||(yi=this._drawToCache(i,s,r,n,o,l),e.set(i,s,r,n,yi)),yi}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,i,s,r){if(this._config.allowTransparency)return et;let n;switch(e){case 16777216:case 33554432:n=this._getColorFromAnsiIndex(i);break;case 50331648:let o=ni.toColorRGB(i);n=Ue.toColor(o[0],o[1],o[2]);break;case 0:default:s?n=Mi.opaque(this._config.colors.foreground):n=this._config.colors.background;break}return this._config.allowTransparency||(n=Mi.opaque(n)),n}_getForegroundColor(e,i,s,r,n,o,l,h,a,c){let d=this._getMinimumContrastColor(e,i,s,r,n,o,l,a,h,c);if(d)return d;let u;switch(n){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&a&&o<8&&(o+=8),u=this._getColorFromAnsiIndex(o);break;case 50331648:let _=ni.toColorRGB(o);u=Ue.toColor(_[0],_[1],_[2]);break;case 0:default:l?u=this._config.colors.background:u=this._config.colors.foreground}return this._config.allowTransparency&&(u=Mi.opaque(u)),h&&(u=Mi.multiplyOpacity(u,Wu)),u}_resolveBackgroundRgba(e,i,s){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,i,s,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,i,s,r,n,o,l,h,a,c){if(this._config.minimumContrastRatio===1||c)return;let d=this._getContrastCache(a),u=d.getColor(e,r);if(u!==void 0)return u||void 0;let _=this._resolveBackgroundRgba(i,s,l),f=this._resolveForegroundRgba(n,o,l,h),v=Vt.ensureContrastRatio(_,f,this._config.minimumContrastRatio/(a?2:1));if(!v){d.setColor(e,r,null);return}let b=Ue.toColor(v>>24&255,v>>16&255,v>>8&255);return d.setColor(e,r,b),b}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,i,s,r,n,o){let l=typeof e=="number"?String.fromCharCode(e):e;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let h=Math.min(this._config.deviceCellWidth*Math.max(l.length,2)+bi*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<h&&(this._tmpCanvas.width=h);let a=Math.min(this._config.deviceCellHeight+bi*4,this._textureSize);if(this._tmpCanvas.height<a&&(this._tmpCanvas.height=a),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=r,!!this._workAttributeData.isInvisible())return io;let c=!!this._workAttributeData.isBold(),d=!!this._workAttributeData.isInverse(),u=!!this._workAttributeData.isDim(),_=!!this._workAttributeData.isItalic(),f=!!this._workAttributeData.isUnderline(),v=!!this._workAttributeData.isStrikethrough(),b=!!this._workAttributeData.isOverline(),y=this._workAttributeData.getFgColor(),C=this._workAttributeData.getFgColorMode(),L=this._workAttributeData.getBgColor(),g=this._workAttributeData.getBgColorMode();if(d){let D=y;y=L,L=D;let z=C;C=g,g=z}let B=this._getBackgroundColor(g,L,d,u);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=B.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let M=c?this._config.fontWeightBold:this._config.fontWeight,I=_?"italic":"";this._tmpCtx.font=`${I} ${M} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=Oa;let N=l.length===1&&Yr(l.charCodeAt(0)),G=l.length===1&&Au(l.charCodeAt(0)),Q=this._getForegroundColor(i,g,L,s,C,y,d,u,c,Pa(l.charCodeAt(0)));this._tmpCtx.fillStyle=Q.css;let $=G?0:bi*2,S=!1;this._config.customGlyphs!==!1&&(S=Ku(this._tmpCtx,l,$,$,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let p=!N,w;if(typeof e=="number"?w=this._unicodeService.wcwidth(e):w=this._unicodeService.getStringCellWidth(e),f){this._tmpCtx.save();let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),z=D%2===1?.5:0;if(this._tmpCtx.lineWidth=D,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())p=!1,this._tmpCtx.strokeStyle=`rgb(${ni.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{p=!1;let q=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&q<8&&(q+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(q).css}this._tmpCtx.beginPath();let Z=$,H=Math.ceil($+this._config.deviceCharHeight)-z-(n?D*2:0),Y=H+D,F=H+D*2,X=this._workAttributeData.getUnderlineVariantOffset();for(let q=0;q<w;q++){this._tmpCtx.save();let V=Z+q*this._config.deviceCellWidth,ee=Z+(q+1)*this._config.deviceCellWidth,me=V+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(V,H),this._tmpCtx.lineTo(ee,H),this._tmpCtx.moveTo(V,F),this._tmpCtx.lineTo(ee,F);break;case 3:let Ne=D<=1?F:Math.ceil($+this._config.deviceCharHeight-D/2)-z,We=D<=1?H:Math.ceil($+this._config.deviceCharHeight+D/2)-z,Te=new Path2D;Te.rect(V,H,this._config.deviceCellWidth,F-H),this._tmpCtx.clip(Te),this._tmpCtx.moveTo(V-this._config.deviceCellWidth/2,Y),this._tmpCtx.bezierCurveTo(V-this._config.deviceCellWidth/2,We,V,We,V,Y),this._tmpCtx.bezierCurveTo(V,Ne,me,Ne,me,Y),this._tmpCtx.bezierCurveTo(me,We,ee,We,ee,Y),this._tmpCtx.bezierCurveTo(ee,Ne,ee+this._config.deviceCellWidth/2,Ne,ee+this._config.deviceCellWidth/2,Y);break;case 4:let j=X===0?0:X>=D?D*2-X:D-X;X>=D||j===0?(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(V+j,H),this._tmpCtx.lineTo(ee,H)):(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(V,H),this._tmpCtx.lineTo(V+j,H),this._tmpCtx.moveTo(V+j+D,H),this._tmpCtx.lineTo(ee,H)),X=$u(ee-V,D,X);break;case 5:let _e=.6,lt=.3,mt=ee-V,_i=Math.floor(_e*mt),Rt=Math.floor(lt*mt),Ge=mt-_i-Rt;this._tmpCtx.setLineDash([_i,Rt,Ge]),this._tmpCtx.moveTo(V,H),this._tmpCtx.lineTo(ee,H);break;case 1:default:this._tmpCtx.moveTo(V,H),this._tmpCtx.lineTo(ee,H);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!S&&this._config.fontSize>=12&&!this._config.allowTransparency&&l!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let q=this._tmpCtx.measureText(l);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in q&&q.actualBoundingBoxDescent>0){this._tmpCtx.save();let V=new Path2D;V.rect(Z,H-Math.ceil(D/2),this._config.deviceCellWidth*w,F-H+Math.ceil(D/2)),this._tmpCtx.clip(V),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=B.css,this._tmpCtx.strokeText(l,$,$+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(b){let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),z=D%2===1?.5:0;this._tmpCtx.lineWidth=D,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo($,$+z),this._tmpCtx.lineTo($+this._config.deviceCharWidth*w,$+z),this._tmpCtx.stroke()}if(S||this._tmpCtx.fillText(l,$,$+this._config.deviceCharHeight),l==="_"&&!this._config.allowTransparency){let D=$s(this._tmpCtx.getImageData($,$,this._config.deviceCellWidth,this._config.deviceCellHeight),B,Q,p);if(D)for(let z=1;z<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=B.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(l,$,$+this._config.deviceCharHeight-z),D=$s(this._tmpCtx.getImageData($,$,this._config.deviceCellWidth,this._config.deviceCellHeight),B,Q,p),!!D);z++);}if(v){let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),z=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=D,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo($,$+Math.floor(this._config.deviceCharHeight/2)-z),this._tmpCtx.lineTo($+this._config.deviceCharWidth*w,$+Math.floor(this._config.deviceCharHeight/2)-z),this._tmpCtx.stroke()}this._tmpCtx.restore();let m=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),k;if(this._config.allowTransparency?k=c_(m):k=$s(m,B,Q,p),k)return io;let E=this._findGlyphBoundingBox(m,this._workBoundingBox,h,G,S,$),A,R;for(;;){if(this._activePages.length===0){let D=this._createNewPage();A=D,R=D.currentRow,R.height=E.size.y;break}A=this._activePages[this._activePages.length-1],R=A.currentRow;for(let D of this._activePages)E.size.y<=D.currentRow.height&&(A=D,R=D.currentRow);for(let D=this._activePages.length-1;D>=0;D--)for(let z of this._activePages[D].fixedRows)z.height<=R.height&&E.size.y<=z.height&&(A=this._activePages[D],R=z);if(E.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Fs(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),A=this._overflowSizePage,R=this._overflowSizePage.currentRow,R.x+E.size.x>=A.canvas.width&&(R.x=0,R.y+=R.height,R.height=0);break}if(R.y+E.size.y>=A.canvas.height||R.height>E.size.y+2){let D=!1;if(A.currentRow.y+A.currentRow.height+E.size.y>=A.canvas.height){let z;for(let Z of this._activePages)if(Z.currentRow.y+Z.currentRow.height+E.size.y<Z.canvas.height){z=Z;break}if(z)A=z;else if(ii.maxAtlasPages&&this._pages.length>=ii.maxAtlasPages&&R.y+E.size.y<=A.canvas.height&&R.height>=E.size.y&&R.x+E.size.x<=A.canvas.width)D=!0;else{let Z=this._createNewPage();A=Z,R=Z.currentRow,R.height=E.size.y,D=!0}}D||(A.currentRow.height>0&&A.fixedRows.push(A.currentRow),R={x:0,y:A.currentRow.y+A.currentRow.height,height:E.size.y},A.fixedRows.push(R),A.currentRow={x:0,y:R.y+R.height,height:0})}if(R.x+E.size.x<=A.canvas.width)break;R===A.currentRow?(R.x=0,R.y+=R.height,R.height=0):A.fixedRows.splice(A.fixedRows.indexOf(R),1)}return E.texturePage=this._pages.indexOf(A),E.texturePosition.x=R.x,E.texturePosition.y=R.y,E.texturePositionClipSpace.x=R.x/A.canvas.width,E.texturePositionClipSpace.y=R.y/A.canvas.height,E.sizeClipSpace.x/=A.canvas.width,E.sizeClipSpace.y/=A.canvas.height,R.height=Math.max(R.height,E.size.y),R.x+=E.size.x,A.ctx.putImageData(m,E.texturePosition.x-this._workBoundingBox.left,E.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,E.size.x,E.size.y),A.addGlyph(E),A.version++,E}_findGlyphBoundingBox(e,i,s,r,n,o){i.top=0;let l=r?this._config.deviceCellHeight:this._tmpCanvas.height,h=r?this._config.deviceCellWidth:s,a=!1;for(let c=0;c<l;c++){for(let d=0;d<h;d++){let u=c*this._tmpCanvas.width*4+d*4+3;if(e.data[u]!==0){i.top=c,a=!0;break}}if(a)break}i.left=0,a=!1;for(let c=0;c<o+h;c++){for(let d=0;d<l;d++){let u=d*this._tmpCanvas.width*4+c*4+3;if(e.data[u]!==0){i.left=c,a=!0;break}}if(a)break}i.right=h,a=!1;for(let c=o+h-1;c>=o;c--){for(let d=0;d<l;d++){let u=d*this._tmpCanvas.width*4+c*4+3;if(e.data[u]!==0){i.right=c,a=!0;break}}if(a)break}i.bottom=l,a=!1;for(let c=l-1;c>=0;c--){for(let d=0;d<h;d++){let u=c*this._tmpCanvas.width*4+d*4+3;if(e.data[u]!==0){i.bottom=c,a=!0;break}}if(a)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+o+(r||n?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+o+(r||n?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Fs=class{constructor(t,e,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let s of i)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=Va(t,e,e),this.ctx=pe(this.canvas.getContext("2d",{alpha:!0}))}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++}};function $s(t,e,i,s){let r=e.rgba>>>24,n=e.rgba>>>16&255,o=e.rgba>>>8&255,l=i.rgba>>>24,h=i.rgba>>>16&255,a=i.rgba>>>8&255,c=Math.floor((Math.abs(r-l)+Math.abs(n-h)+Math.abs(o-a))/12),d=!0;for(let u=0;u<t.data.length;u+=4)t.data[u]===r&&t.data[u+1]===n&&t.data[u+2]===o||s&&Math.abs(t.data[u]-r)+Math.abs(t.data[u+1]-n)+Math.abs(t.data[u+2]-o)<c?t.data[u+3]=0:d=!1;return d}function c_(t){for(let e=0;e<t.data.length;e+=4)if(t.data[e+3]>0)return!1;return!0}function Va(t,e,i){let s=t.createElement("canvas");return s.width=e,s.height=i,s}function d_(t,e,i,s,r,n,o,l){let h={foreground:n.foreground,background:n.background,cursor:et,cursorAccent:et,selectionForeground:et,selectionBackgroundTransparent:et,selectionBackgroundOpaque:et,selectionInactiveBackgroundTransparent:et,selectionInactiveBackgroundOpaque:et,overviewRulerBorder:et,scrollbarSliderBackground:et,scrollbarSliderHoverBackground:et,scrollbarSliderActiveBackground:et,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:l,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,deviceCellWidth:t,deviceCellHeight:e,deviceCharWidth:i,deviceCharHeight:s,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:h}}function so(t,e){for(let i=0;i<t.colors.ansi.length;i++)if(t.colors.ansi[i].rgba!==e.colors.ansi[i].rgba)return!1;return t.devicePixelRatio===e.devicePixelRatio&&t.customGlyphs===e.customGlyphs&&t.lineHeight===e.lineHeight&&t.letterSpacing===e.letterSpacing&&t.fontFamily===e.fontFamily&&t.fontSize===e.fontSize&&t.fontWeight===e.fontWeight&&t.fontWeightBold===e.fontWeightBold&&t.allowTransparency===e.allowTransparency&&t.deviceCharWidth===e.deviceCharWidth&&t.deviceCharHeight===e.deviceCharHeight&&t.drawBoldTextInBrightColors===e.drawBoldTextInBrightColors&&t.minimumContrastRatio===e.minimumContrastRatio&&t.colors.foreground.rgba===e.colors.foreground.rgba&&t.colors.background.rgba===e.colors.background.rgba}function u_(t){return(t&50331648)===16777216||(t&50331648)===33554432}var st=[];function Ya(t,e,i,s,r,n,o,l,h){let a=d_(s,r,n,o,e,i,l,h);for(let u=0;u<st.length;u++){let _=st[u],f=_.ownedBy.indexOf(t);if(f>=0){if(so(_.config,a))return _.atlas;_.ownedBy.length===1?(_.atlas.dispose(),st.splice(u,1)):_.ownedBy.splice(f,1);break}}for(let u=0;u<st.length;u++){let _=st[u];if(so(_.config,a))return _.ownedBy.push(t),_.atlas}let c=t._core,d={atlas:new Pt(document,a,c.unicodeService),config:a,ownedBy:[t]};return st.push(d),d.atlas}function ro(t){for(let e=0;e<st.length;e++){let i=st[e].ownedBy.indexOf(t);if(i!==-1){st[e].ownedBy.length===1?(st[e].atlas.dispose(),st.splice(e,1)):st[e].ownedBy.splice(i,1);break}}}var ji=600,__=class{constructor(t,e){this._renderCallback=t,this._coreBrowserService=e,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}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)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(t=ji){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=ji-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);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 e=ji-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},ji)},t)}pause(){this.isCursorVisible=!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)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function no(t,e,i){let s=new e.ResizeObserver(r=>{let n=r.find(h=>h.target===t);if(!n)return;if(!("devicePixelContentBoxSize"in n)){s==null||s.disconnect(),s=void 0;return}let o=n.devicePixelContentBoxSize[0].inlineSize,l=n.devicePixelContentBoxSize[0].blockSize;o>0&&l>0&&i(o,l)});try{s.observe(t,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return $e(()=>s==null?void 0:s.disconnect())}function f_(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}var oo=class Ga extends ni{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Wa,this.combinedData=""}static fromCharData(e){let i=new Ga;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?f_(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ja=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function Xa(t,e,i){let s=pe(t.createProgram());if(t.attachShader(s,pe(ao(t,t.VERTEX_SHADER,e))),t.attachShader(s,pe(ao(t,t.FRAGMENT_SHADER,i))),t.linkProgram(s),t.getProgramParameter(s,t.LINK_STATUS))return s;console.error(t.getProgramInfoLog(s)),t.deleteProgram(s)}function ao(t,e,i){let s=pe(t.createShader(e));if(t.shaderSource(s,i),t.compileShader(s),t.getShaderParameter(s,t.COMPILE_STATUS))return s;console.error(t.getShaderInfoLog(s)),t.deleteShader(s)}function g_(t,e){let i=Math.min(t.length*2,e),s=new Float32Array(i);for(let r=0;r<t.length;r++)s[r]=t[r];return s}var p_=class{constructor(t){this.texture=t,this.version=-1}},v_=`#version 300 es
|
|
55
|
+
`))}},u_=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},__=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},f_=0,Fs=class{constructor(t){this.value=t,this.id=f_++}},g_=2,p_,re=class{constructor(t){var e,i,s,r;this._size=0,this._options=t,this._leakageMon=(e=this._options)!=null&&e.leakWarningThreshold?new c_((t==null?void 0:t.onListenerError)??Is,((i=this._options)==null?void 0:i.leakWarningThreshold)??h_):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new l_(this._options._profName):void 0,this._deliveryQueue=(r=this._options)==null?void 0:r.deliveryQueue}dispose(){var t,e,i,s;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(e=this._options)==null?void 0:e.onDidRemoveLastListener)==null||i.call(e),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(t,e,i)=>{var o,l,h,a,c;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],_=new __(`${d}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0]);return(((o=this._options)==null?void 0:o.onListenerError)||Is)(_),at.None}if(this._disposed)return at.None;e&&(t=t.bind(e));let s=new Fs(t),r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=d_.create(),r=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof Fs?(this._deliveryQueue??(this._deliveryQueue=new v_),this._listeners=[this._listeners,s]):this._listeners.push(s):((h=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null||h.call(l,this),this._listeners=s,(c=(a=this._options)==null?void 0:a.onDidAddFirstListener)==null||c.call(a,this)),this._size++;let n=Ne(()=>{r==null||r(),this._removeListener(s)});return i instanceof li?i.add(n):Array.isArray(i)&&i.push(n),n}),this._event}_removeListener(t){var r,n,o,l;if((n=(r=this._options)==null?void 0:r.onWillRemoveListener)==null||n.call(r,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||l.call(o,this),this._size=0;return}let e=this._listeners,i=e.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*g_<=e.length){let h=0;for(let a=0;a<e.length;a++)e[a]?e[h++]=e[a]:s&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=h}}_deliver(t,e){var s;if(!t)return;let i=((s=this._options)==null?void 0:s.onListenerError)||Is;if(!i){t.value(e);return}try{t.value(e)}catch(r){i(r)}}_deliverQueue(t){let e=t.current._listeners;for(;t.i<t.end;)this._deliver(e[t.i++],t.value);t.reset()}fire(t){var e,i,s,r;if((e=this._deliveryQueue)!=null&&e.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof Fs)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}(r=this._perfMon)==null||r.stop()}hasListeners(){return this._size>0}},v_=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ao={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}},bi=2,yi,Pt=class ii{constructor(e,i,s){this._document=e,this._config=i,this._unicodeService=s,this._didWarmUp=!1,this._cacheMap=new oo,this._cacheMapCombined=new oo,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new ni,this._textureSize=512,this._onAddTextureAtlasCanvas=new re,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new re,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=tl(e,this._config.deviceCellWidth*4+bi*2,this._config.deviceCellHeight+bi*2),this._tmpCtx=ve(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new n_;for(let i=33;i<126;i++)e.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let s=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,s)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(ii.maxAtlasPages&&this._pages.length>=Math.max(4,ii.maxAtlasPages)){let i=this._pages.filter(a=>a.canvas.width*2<=(ii.maxTextureSize||4096)).sort((a,c)=>c.canvas.width!==a.canvas.width?c.canvas.width-a.canvas.width:c.percentageUsed-a.percentageUsed),s=-1,r=0;for(let a=0;a<i.length;a++)if(i[a].canvas.width!==r)s=a,r=i[a].canvas.width;else if(a-s===3)break;let n=i.slice(s,s+4),o=n.map(a=>a.glyphs[0].texturePage).sort((a,c)=>a>c?1:-1),l=this.pages.length-n.length,h=this._mergePages(n,l);h.version++;for(let a=o.length-1;a>=0;a--)this._deletePage(o[a]);this.pages.push(h),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(h.canvas)}let e=new $s(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,i){let s=e[0].canvas.width*2,r=new $s(this._document,s,e);for(let[n,o]of e.entries()){let l=n*o.canvas.width%s,h=Math.floor(n/2)*o.canvas.height;r.ctx.drawImage(o.canvas,l,h);for(let c of o.glyphs)c.texturePage=i,c.sizeClipSpace.x=c.size.x/s,c.sizeClipSpace.y=c.size.y/s,c.texturePosition.x+=l,c.texturePosition.y+=h,c.texturePositionClipSpace.x=c.texturePosition.x/s,c.texturePositionClipSpace.y=c.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(o.canvas);let a=this._activePages.indexOf(o);a!==-1&&this._activePages.splice(a,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let i=e;i<this._pages.length;i++){let s=this._pages[i];for(let r of s.glyphs)r.texturePage--;s.version++}}getRasterizedGlyphCombinedChar(e,i,s,r,n,o){return this._getFromCacheMap(this._cacheMapCombined,e,i,s,r,n,o)}getRasterizedGlyph(e,i,s,r,n,o){return this._getFromCacheMap(this._cacheMap,e,i,s,r,n,o)}_getFromCacheMap(e,i,s,r,n,o,l){return yi=e.get(i,s,r,n),yi||(yi=this._drawToCache(i,s,r,n,o,l),e.set(i,s,r,n,yi)),yi}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,i,s,r){if(this._config.allowTransparency)return et;let n;switch(e){case 16777216:case 33554432:n=this._getColorFromAnsiIndex(i);break;case 50331648:let o=ni.toColorRGB(i);n=Ue.toColor(o[0],o[1],o[2]);break;case 0:default:s?n=Mi.opaque(this._config.colors.foreground):n=this._config.colors.background;break}return this._config.allowTransparency||(n=Mi.opaque(n)),n}_getForegroundColor(e,i,s,r,n,o,l,h,a,c){let d=this._getMinimumContrastColor(e,i,s,r,n,o,l,a,h,c);if(d)return d;let u;switch(n){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&a&&o<8&&(o+=8),u=this._getColorFromAnsiIndex(o);break;case 50331648:let _=ni.toColorRGB(o);u=Ue.toColor(_[0],_[1],_[2]);break;case 0:default:l?u=this._config.colors.background:u=this._config.colors.foreground}return this._config.allowTransparency&&(u=Mi.opaque(u)),h&&(u=Mi.multiplyOpacity(u,ju)),u}_resolveBackgroundRgba(e,i,s){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,i,s,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,i,s,r,n,o,l,h,a,c){if(this._config.minimumContrastRatio===1||c)return;let d=this._getContrastCache(a),u=d.getColor(e,r);if(u!==void 0)return u||void 0;let _=this._resolveBackgroundRgba(i,s,l),f=this._resolveForegroundRgba(n,o,l,h),p=Vt.ensureContrastRatio(_,f,this._config.minimumContrastRatio/(a?2:1));if(!p){d.setColor(e,r,null);return}let w=Ue.toColor(p>>24&255,p>>16&255,p>>8&255);return d.setColor(e,r,w),w}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,i,s,r,n,o){let l=typeof e=="number"?String.fromCharCode(e):e;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let h=Math.min(this._config.deviceCellWidth*Math.max(l.length,2)+bi*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<h&&(this._tmpCanvas.width=h);let a=Math.min(this._config.deviceCellHeight+bi*4,this._textureSize);if(this._tmpCanvas.height<a&&(this._tmpCanvas.height=a),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=r,!!this._workAttributeData.isInvisible())return ao;let c=!!this._workAttributeData.isBold(),d=!!this._workAttributeData.isInverse(),u=!!this._workAttributeData.isDim(),_=!!this._workAttributeData.isItalic(),f=!!this._workAttributeData.isUnderline(),p=!!this._workAttributeData.isStrikethrough(),w=!!this._workAttributeData.isOverline(),C=this._workAttributeData.getFgColor(),k=this._workAttributeData.getFgColorMode(),L=this._workAttributeData.getBgColor(),g=this._workAttributeData.getBgColorMode();if(d){let D=C;C=L,L=D;let H=k;k=g,g=H}let E=this._getBackgroundColor(g,L,d,u);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let T=c?this._config.fontWeightBold:this._config.fontWeight,O=_?"italic":"";this._tmpCtx.font=`${O} ${T} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=Ka;let $=l.length===1&&Xr(l.charCodeAt(0)),G=l.length===1&&Wu(l.charCodeAt(0)),X=this._getForegroundColor(i,g,L,s,k,C,d,u,c,Ua(l.charCodeAt(0)));this._tmpCtx.fillStyle=X.css;let N=G?0:bi*2,m=!1;this._config.customGlyphs!==!1&&(m=Ju(this._tmpCtx,l,N,N,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let v=!$,S;if(typeof e=="number"?S=this._unicodeService.wcwidth(e):S=this._unicodeService.getStringCellWidth(e),f){this._tmpCtx.save();let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),H=D%2===1?.5:0;if(this._tmpCtx.lineWidth=D,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())v=!1,this._tmpCtx.strokeStyle=`rgb(${ni.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{v=!1;let F=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&F<8&&(F+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(F).css}this._tmpCtx.beginPath();let Z=N,U=Math.ceil(N+this._config.deviceCharHeight)-H-(n?D*2:0),ue=U+D,K=U+D*2,z=this._workAttributeData.getUnderlineVariantOffset();for(let F=0;F<S;F++){this._tmpCtx.save();let q=Z+F*this._config.deviceCellWidth,Q=Z+(F+1)*this._config.deviceCellWidth,Ce=q+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(q,U),this._tmpCtx.lineTo(Q,U),this._tmpCtx.moveTo(q,K),this._tmpCtx.lineTo(Q,K);break;case 3:let Ve=D<=1?K:Math.ceil(N+this._config.deviceCharHeight-D/2)-H,Se=D<=1?U:Math.ceil(N+this._config.deviceCharHeight+D/2)-H,ge=new Path2D;ge.rect(q,U,this._config.deviceCellWidth,K-U),this._tmpCtx.clip(ge),this._tmpCtx.moveTo(q-this._config.deviceCellWidth/2,ue),this._tmpCtx.bezierCurveTo(q-this._config.deviceCellWidth/2,Se,q,Se,q,ue),this._tmpCtx.bezierCurveTo(q,Ve,Ce,Ve,Ce,ue),this._tmpCtx.bezierCurveTo(Ce,Se,Q,Se,Q,ue),this._tmpCtx.bezierCurveTo(Q,Ve,Q+this._config.deviceCellWidth/2,Ve,Q+this._config.deviceCellWidth/2,ue);break;case 4:let j=z===0?0:z>=D?D*2-z:D-z;z>=D||j===0?(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(q+j,U),this._tmpCtx.lineTo(Q,U)):(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(q,U),this._tmpCtx.lineTo(q+j,U),this._tmpCtx.moveTo(q+j+D,U),this._tmpCtx.lineTo(Q,U)),z=Vu(Q-q,D,z);break;case 5:let _e=.6,lt=.3,mt=Q-q,_i=Math.floor(_e*mt),Rt=Math.floor(lt*mt),We=mt-_i-Rt;this._tmpCtx.setLineDash([_i,Rt,We]),this._tmpCtx.moveTo(q,U),this._tmpCtx.lineTo(Q,U);break;case 1:default:this._tmpCtx.moveTo(q,U),this._tmpCtx.lineTo(Q,U);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!m&&this._config.fontSize>=12&&!this._config.allowTransparency&&l!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let F=this._tmpCtx.measureText(l);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in F&&F.actualBoundingBoxDescent>0){this._tmpCtx.save();let q=new Path2D;q.rect(Z,U-Math.ceil(D/2),this._config.deviceCellWidth*S,K-U+Math.ceil(D/2)),this._tmpCtx.clip(q),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=E.css,this._tmpCtx.strokeText(l,N,N+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(w){let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),H=D%2===1?.5:0;this._tmpCtx.lineWidth=D,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(N,N+H),this._tmpCtx.lineTo(N+this._config.deviceCharWidth*S,N+H),this._tmpCtx.stroke()}if(m||this._tmpCtx.fillText(l,N,N+this._config.deviceCharHeight),l==="_"&&!this._config.allowTransparency){let D=Ns(this._tmpCtx.getImageData(N,N,this._config.deviceCellWidth,this._config.deviceCellHeight),E,X,v);if(D)for(let H=1;H<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(l,N,N+this._config.deviceCharHeight-H),D=Ns(this._tmpCtx.getImageData(N,N,this._config.deviceCellWidth,this._config.deviceCellHeight),E,X,v),!!D);H++);}if(p){let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),H=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=D,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(N,N+Math.floor(this._config.deviceCharHeight/2)-H),this._tmpCtx.lineTo(N+this._config.deviceCharWidth*S,N+Math.floor(this._config.deviceCharHeight/2)-H),this._tmpCtx.stroke()}this._tmpCtx.restore();let y=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),b;if(this._config.allowTransparency?b=m_(y):b=Ns(y,E,X,v),b)return ao;let R=this._findGlyphBoundingBox(y,this._workBoundingBox,h,G,m,N),A,M;for(;;){if(this._activePages.length===0){let D=this._createNewPage();A=D,M=D.currentRow,M.height=R.size.y;break}A=this._activePages[this._activePages.length-1],M=A.currentRow;for(let D of this._activePages)R.size.y<=D.currentRow.height&&(A=D,M=D.currentRow);for(let D=this._activePages.length-1;D>=0;D--)for(let H of this._activePages[D].fixedRows)H.height<=M.height&&R.size.y<=H.height&&(A=this._activePages[D],M=H);if(R.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new $s(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),A=this._overflowSizePage,M=this._overflowSizePage.currentRow,M.x+R.size.x>=A.canvas.width&&(M.x=0,M.y+=M.height,M.height=0);break}if(M.y+R.size.y>=A.canvas.height||M.height>R.size.y+2){let D=!1;if(A.currentRow.y+A.currentRow.height+R.size.y>=A.canvas.height){let H;for(let Z of this._activePages)if(Z.currentRow.y+Z.currentRow.height+R.size.y<Z.canvas.height){H=Z;break}if(H)A=H;else if(ii.maxAtlasPages&&this._pages.length>=ii.maxAtlasPages&&M.y+R.size.y<=A.canvas.height&&M.height>=R.size.y&&M.x+R.size.x<=A.canvas.width)D=!0;else{let Z=this._createNewPage();A=Z,M=Z.currentRow,M.height=R.size.y,D=!0}}D||(A.currentRow.height>0&&A.fixedRows.push(A.currentRow),M={x:0,y:A.currentRow.y+A.currentRow.height,height:R.size.y},A.fixedRows.push(M),A.currentRow={x:0,y:M.y+M.height,height:0})}if(M.x+R.size.x<=A.canvas.width)break;M===A.currentRow?(M.x=0,M.y+=M.height,M.height=0):A.fixedRows.splice(A.fixedRows.indexOf(M),1)}return R.texturePage=this._pages.indexOf(A),R.texturePosition.x=M.x,R.texturePosition.y=M.y,R.texturePositionClipSpace.x=M.x/A.canvas.width,R.texturePositionClipSpace.y=M.y/A.canvas.height,R.sizeClipSpace.x/=A.canvas.width,R.sizeClipSpace.y/=A.canvas.height,M.height=Math.max(M.height,R.size.y),M.x+=R.size.x,A.ctx.putImageData(y,R.texturePosition.x-this._workBoundingBox.left,R.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,R.size.x,R.size.y),A.addGlyph(R),A.version++,R}_findGlyphBoundingBox(e,i,s,r,n,o){i.top=0;let l=r?this._config.deviceCellHeight:this._tmpCanvas.height,h=r?this._config.deviceCellWidth:s,a=!1;for(let c=0;c<l;c++){for(let d=0;d<h;d++){let u=c*this._tmpCanvas.width*4+d*4+3;if(e.data[u]!==0){i.top=c,a=!0;break}}if(a)break}i.left=0,a=!1;for(let c=0;c<o+h;c++){for(let d=0;d<l;d++){let u=d*this._tmpCanvas.width*4+c*4+3;if(e.data[u]!==0){i.left=c,a=!0;break}}if(a)break}i.right=h,a=!1;for(let c=o+h-1;c>=o;c--){for(let d=0;d<l;d++){let u=d*this._tmpCanvas.width*4+c*4+3;if(e.data[u]!==0){i.right=c,a=!0;break}}if(a)break}i.bottom=l,a=!1;for(let c=l-1;c>=0;c--){for(let d=0;d<h;d++){let u=c*this._tmpCanvas.width*4+d*4+3;if(e.data[u]!==0){i.bottom=c,a=!0;break}}if(a)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+o+(r||n?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+o+(r||n?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},$s=class{constructor(t,e,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let s of i)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=tl(t,e,e),this.ctx=ve(this.canvas.getContext("2d",{alpha:!0}))}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++}};function Ns(t,e,i,s){let r=e.rgba>>>24,n=e.rgba>>>16&255,o=e.rgba>>>8&255,l=i.rgba>>>24,h=i.rgba>>>16&255,a=i.rgba>>>8&255,c=Math.floor((Math.abs(r-l)+Math.abs(n-h)+Math.abs(o-a))/12),d=!0;for(let u=0;u<t.data.length;u+=4)t.data[u]===r&&t.data[u+1]===n&&t.data[u+2]===o||s&&Math.abs(t.data[u]-r)+Math.abs(t.data[u+1]-n)+Math.abs(t.data[u+2]-o)<c?t.data[u+3]=0:d=!1;return d}function m_(t){for(let e=0;e<t.data.length;e+=4)if(t.data[e+3]>0)return!1;return!0}function tl(t,e,i){let s=t.createElement("canvas");return s.width=e,s.height=i,s}function S_(t,e,i,s,r,n,o,l){let h={foreground:n.foreground,background:n.background,cursor:et,cursorAccent:et,selectionForeground:et,selectionBackgroundTransparent:et,selectionBackgroundOpaque:et,selectionInactiveBackgroundTransparent:et,selectionInactiveBackgroundOpaque:et,overviewRulerBorder:et,scrollbarSliderBackground:et,scrollbarSliderHoverBackground:et,scrollbarSliderActiveBackground:et,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:l,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,deviceCellWidth:t,deviceCellHeight:e,deviceCharWidth:i,deviceCharHeight:s,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:h}}function lo(t,e){for(let i=0;i<t.colors.ansi.length;i++)if(t.colors.ansi[i].rgba!==e.colors.ansi[i].rgba)return!1;return t.devicePixelRatio===e.devicePixelRatio&&t.customGlyphs===e.customGlyphs&&t.lineHeight===e.lineHeight&&t.letterSpacing===e.letterSpacing&&t.fontFamily===e.fontFamily&&t.fontSize===e.fontSize&&t.fontWeight===e.fontWeight&&t.fontWeightBold===e.fontWeightBold&&t.allowTransparency===e.allowTransparency&&t.deviceCharWidth===e.deviceCharWidth&&t.deviceCharHeight===e.deviceCharHeight&&t.drawBoldTextInBrightColors===e.drawBoldTextInBrightColors&&t.minimumContrastRatio===e.minimumContrastRatio&&t.colors.foreground.rgba===e.colors.foreground.rgba&&t.colors.background.rgba===e.colors.background.rgba}function w_(t){return(t&50331648)===16777216||(t&50331648)===33554432}var st=[];function il(t,e,i,s,r,n,o,l,h){let a=S_(s,r,n,o,e,i,l,h);for(let u=0;u<st.length;u++){let _=st[u],f=_.ownedBy.indexOf(t);if(f>=0){if(lo(_.config,a))return _.atlas;_.ownedBy.length===1?(_.atlas.dispose(),st.splice(u,1)):_.ownedBy.splice(f,1);break}}for(let u=0;u<st.length;u++){let _=st[u];if(lo(_.config,a))return _.ownedBy.push(t),_.atlas}let c=t._core,d={atlas:new Pt(document,a,c.unicodeService),config:a,ownedBy:[t]};return st.push(d),d.atlas}function ho(t){for(let e=0;e<st.length;e++){let i=st[e].ownedBy.indexOf(t);if(i!==-1){st[e].ownedBy.length===1?(st[e].atlas.dispose(),st.splice(e,1)):st[e].ownedBy.splice(i,1);break}}}var Xi=600,b_=class{constructor(t,e){this._renderCallback=t,this._coreBrowserService=e,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}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)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(t=Xi){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=Xi-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);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 e=Xi-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Xi)},t)}pause(){this.isCursorVisible=!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)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function co(t,e,i){let s=new e.ResizeObserver(r=>{let n=r.find(h=>h.target===t);if(!n)return;if(!("devicePixelContentBoxSize"in n)){s==null||s.disconnect(),s=void 0;return}let o=n.devicePixelContentBoxSize[0].inlineSize,l=n.devicePixelContentBoxSize[0].blockSize;o>0&&l>0&&i(o,l)});try{s.observe(t,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return Ne(()=>s==null?void 0:s.disconnect())}function y_(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}var uo=class sl extends ni{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ga,this.combinedData=""}static fromCharData(e){let i=new sl;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?y_(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},rl=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function nl(t,e,i){let s=ve(t.createProgram());if(t.attachShader(s,ve(_o(t,t.VERTEX_SHADER,e))),t.attachShader(s,ve(_o(t,t.FRAGMENT_SHADER,i))),t.linkProgram(s),t.getProgramParameter(s,t.LINK_STATUS))return s;console.error(t.getProgramInfoLog(s)),t.deleteProgram(s)}function _o(t,e,i){let s=ve(t.createShader(e));if(t.shaderSource(s,i),t.compileShader(s),t.getShaderParameter(s,t.COMPILE_STATUS))return s;console.error(t.getShaderInfoLog(s)),t.deleteShader(s)}function C_(t,e){let i=Math.min(t.length*2,e),s=new Float32Array(i);for(let r=0;r<t.length;r++)s[r]=t[r];return s}var x_=class{constructor(t){this.texture=t,this.version=-1}},k_=`#version 300 es
|
|
67
56
|
layout (location = 0) in vec2 a_unitquad;
|
|
68
57
|
layout (location = 1) in vec2 a_cellpos;
|
|
69
58
|
layout (location = 2) in vec2 a_offset;
|
|
@@ -83,7 +72,7 @@ void main() {
|
|
|
83
72
|
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
84
73
|
v_texpage = int(a_texpage);
|
|
85
74
|
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
86
|
-
}`;function
|
|
75
|
+
}`;function L_(t){let e="";for(let i=1;i<t;i++)e+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es
|
|
87
76
|
precision lowp float;
|
|
88
77
|
|
|
89
78
|
in vec2 v_texcoord;
|
|
@@ -97,7 +86,7 @@ void main() {
|
|
|
97
86
|
if (v_texpage == 0) {
|
|
98
87
|
outColor = texture(u_texture[0], v_texcoord);
|
|
99
88
|
} ${e}
|
|
100
|
-
}`}var
|
|
89
|
+
}`}var It=11,ei=It*Float32Array.BYTES_PER_ELEMENT,E_=2,le=0,ie,Ws=0,Ci=0,R_=class extends at{constructor(t,e,i,s){super(),this._terminal=t,this._gl=e,this._dimensions=i,this._optionsService=s,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let r=this._gl;Pt.maxAtlasPages===void 0&&(Pt.maxAtlasPages=Math.min(32,ve(r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS))),Pt.maxTextureSize=ve(r.getParameter(r.MAX_TEXTURE_SIZE))),this._program=ve(nl(r,k_,L_(Pt.maxAtlasPages))),this._register(Ne(()=>r.deleteProgram(this._program))),this._projectionLocation=ve(r.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=ve(r.getUniformLocation(this._program,"u_resolution")),this._textureLocation=ve(r.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(Ne(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let l=new Uint8Array([0,1,2,3]),h=r.createBuffer();this._register(Ne(()=>r.deleteBuffer(h))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,h),r.bufferData(r.ELEMENT_ARRAY_BUFFER,l,r.STATIC_DRAW),this._attributesBuffer=ve(r.createBuffer()),this._register(Ne(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,2,r.FLOAT,!1,ei,0),r.vertexAttribDivisor(2,1),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,r.FLOAT,!1,ei,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(3,1),r.enableVertexAttribArray(4),r.vertexAttribPointer(4,1,r.FLOAT,!1,ei,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(4,1),r.enableVertexAttribArray(5),r.vertexAttribPointer(5,2,r.FLOAT,!1,ei,5*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(5,1),r.enableVertexAttribArray(6),r.vertexAttribPointer(6,2,r.FLOAT,!1,ei,7*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(6,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,ei,9*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.useProgram(this._program);let a=new Int32Array(Pt.maxAtlasPages);for(let c=0;c<Pt.maxAtlasPages;c++)a[c]=c;r.uniform1iv(this._textureLocation,a),r.uniformMatrix4fv(this._projectionLocation,!1,rl),this._atlasTextures=[];for(let c=0;c<Pt.maxAtlasPages;c++){let d=new x_(ve(r.createTexture()));this._register(Ne(()=>r.deleteTexture(d.texture))),r.activeTexture(r.TEXTURE0+c),r.bindTexture(r.TEXTURE_2D,d.texture),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[c]=d}r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,e,i,s,r,n,o,l,h){this._updateCell(this._vertices.attributes,t,e,i,s,r,n,o,l,h)}_updateCell(t,e,i,s,r,n,o,l,h,a){if(le=(i*this._terminal.cols+e)*It,s===0||s===void 0){t.fill(0,le,le+It-1-E_);return}this._atlas&&(l&&l.length>1?ie=this._atlas.getRasterizedGlyphCombinedChar(l,r,n,o,!1,this._terminal.element):ie=this._atlas.getRasterizedGlyph(s,r,n,o,!1,this._terminal.element),Ws=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),r!==a&&ie.offset.x>Ws?(Ci=ie.offset.x-Ws,t[le]=-(ie.offset.x-Ci)+this._dimensions.device.char.left,t[le+1]=-ie.offset.y+this._dimensions.device.char.top,t[le+2]=(ie.size.x-Ci)/this._dimensions.device.canvas.width,t[le+3]=ie.size.y/this._dimensions.device.canvas.height,t[le+4]=ie.texturePage,t[le+5]=ie.texturePositionClipSpace.x+Ci/this._atlas.pages[ie.texturePage].canvas.width,t[le+6]=ie.texturePositionClipSpace.y,t[le+7]=ie.sizeClipSpace.x-Ci/this._atlas.pages[ie.texturePage].canvas.width,t[le+8]=ie.sizeClipSpace.y):(t[le]=-ie.offset.x+this._dimensions.device.char.left,t[le+1]=-ie.offset.y+this._dimensions.device.char.top,t[le+2]=ie.size.x/this._dimensions.device.canvas.width,t[le+3]=ie.size.y/this._dimensions.device.canvas.height,t[le+4]=ie.texturePage,t[le+5]=ie.texturePositionClipSpace.x,t[le+6]=ie.texturePositionClipSpace.y,t[le+7]=ie.sizeClipSpace.x,t[le+8]=ie.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Ku(s,h,ie.size.x,this._dimensions.device.cell.width)&&(t[le+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,e=t.cols*t.rows*It;this._vertices.count!==e?this._vertices.attributes=new Float32Array(e):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==e?this._vertices.attributesBuffers[i]=new Float32Array(e):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=e,i=0;for(let s=0;s<t.rows;s++)for(let r=0;r<t.cols;r++)this._vertices.attributes[i+9]=r/t.cols,this._vertices.attributes[i+10]=s/t.rows,i+=It}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],s=0;for(let r=0;r<t.lineLengths.length;r++){let n=r*this._terminal.cols*It,o=this._vertices.attributes.subarray(n,n+t.lineLengths[r]*It);i.set(o,s),s+=o.length}e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,i.subarray(0,s),e.STREAM_DRAW);for(let r=0;r<this._atlas.pages.length;r++)this._atlas.pages[r].version!==this._atlasTextures[r].version&&this._bindAtlasPageTexture(e,this._atlas,r);e.drawElementsInstanced(e.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,s/It)}setAtlas(t){this._atlas=t;for(let e of this._atlasTextures)e.version=-1}_bindAtlasPageTexture(t,e,i){t.activeTexture(t.TEXTURE0+i),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[i].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.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e.pages[i].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[i].version=e.pages[i].version}setDimensions(t){this._dimensions=t}},M_=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,e,i,s=!1){if(this.selectionStart=e,this.selectionEnd=i,!e||!i||e[0]===i[0]&&e[1]===i[1]){this.clear();return}let r=t.buffers.active.ydisp,n=e[1]-r,o=i[1]-r,l=Math.max(n,0),h=Math.min(o,t.rows-1);if(l>=t.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=h,this.startCol=e[0],this.endCol=i[0]}isCellSelected(t,e,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&i>=this.viewportCappedStartRow&&e<this.endCol&&i<=this.viewportCappedEndRow:e<this.startCol&&i>=this.viewportCappedStartRow&&e>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&e>=this.startCol&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&e>=this.startCol):!1}};function B_(){return new M_}var gs=4,ns=1,os=2,zs=3,T_=2147483648,A_=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=B_()}resize(t,e){let i=t*e*gs;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(e))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},D_=`#version 300 es
|
|
101
90
|
layout (location = 0) in vec2 a_position;
|
|
102
91
|
layout (location = 1) in vec2 a_size;
|
|
103
92
|
layout (location = 2) in vec4 a_color;
|
|
@@ -111,7 +100,7 @@ void main() {
|
|
|
111
100
|
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
112
101
|
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
113
102
|
v_color = a_color;
|
|
114
|
-
}`,
|
|
103
|
+
}`,P_=`#version 300 es
|
|
115
104
|
precision lowp float;
|
|
116
105
|
|
|
117
106
|
in vec4 v_color;
|
|
@@ -120,4 +109,15 @@ out vec4 outColor;
|
|
|
120
109
|
|
|
121
110
|
void main() {
|
|
122
111
|
outColor = v_color;
|
|
123
|
-
}`,Ct=8,zs=Ct*Float32Array.BYTES_PER_ELEMENT,E_=20*Ct,lo=class{constructor(){this.attributes=new Float32Array(E_),this.count=0}},yt=0,ho=0,co=0,uo=0,_o=0,fo=0,go=0,R_=class extends at{constructor(t,e,i,s){super(),this._terminal=t,this._gl=e,this._dimensions=i,this._themeService=s,this._vertices=new lo,this._verticesCursor=new lo;let r=this._gl;this._program=pe(Xa(r,k_,L_)),this._register($e(()=>r.deleteProgram(this._program))),this._projectionLocation=pe(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register($e(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let l=new Uint8Array([0,1,2,3]),h=r.createBuffer();this._register($e(()=>r.deleteBuffer(h))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,h),r.bufferData(r.ELEMENT_ARRAY_BUFFER,l,r.STATIC_DRAW),this._attributesBuffer=pe(r.createBuffer()),this._register($e(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,zs,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,zs,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,zs,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors(a=>{this._updateCachedColors(a),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),e.uniformMatrix4fv(this._projectionLocation,!1,ja),e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,t.attributes,e.DYNAMIC_DRAW),e.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,e.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 e=this._terminal,i=this._vertices,s=1,r,n,o,l,h,a,c,d,u,_,f;for(r=0;r<e.rows;r++){for(o=-1,l=0,h=0,a=!1,n=0;n<e.cols;n++)c=(r*e.cols+n)*fs,d=t.cells[c+ns],u=t.cells[c+os],_=!!(u&67108864),(d!==l||u!==h&&(a||_))&&((l!==0||a&&h!==0)&&(f=s++*Ct,this._updateRectangle(i,f,h,l,o,n,r)),o=n,l=d,h=u,a=_);(l!==0||a&&h!==0)&&(f=s++*Ct,this._updateRectangle(i,f,h,l,o,e.cols,r))}i.count=s}updateCursor(t){let e=this._verticesCursor,i=t.cursor;if(!i||i.style==="block"){e.count=0;return}let s,r=0;(i.style==="bar"||i.style==="outline")&&(s=r++*Ct,this._addRectangleFloat(e.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(s=r++*Ct,this._addRectangleFloat(e.attributes,s,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(s=r++*Ct,this._addRectangleFloat(e.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),s=r++*Ct,this._addRectangleFloat(e.attributes,s,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),e.count=r}_updateRectangle(t,e,i,s,r,n,o){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:yt=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:yt=(i&16777215)<<8;break;case 0:default:yt=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:yt=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:yt=(s&16777215)<<8;break;case 0:default:yt=this._themeService.colors.background.rgba}t.attributes.length<e+4&&(t.attributes=g_(t.attributes,this._terminal.rows*this._terminal.cols*Ct)),ho=r*this._dimensions.device.cell.width,co=o*this._dimensions.device.cell.height,uo=(yt>>24&255)/255,_o=(yt>>16&255)/255,fo=(yt>>8&255)/255,go=1,this._addRectangle(t.attributes,e,ho,co,(n-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,uo,_o,fo,go)}_addRectangle(t,e,i,s,r,n,o,l,h,a){t[e]=i/this._dimensions.device.canvas.width,t[e+1]=s/this._dimensions.device.canvas.height,t[e+2]=r/this._dimensions.device.canvas.width,t[e+3]=n/this._dimensions.device.canvas.height,t[e+4]=o,t[e+5]=l,t[e+6]=h,t[e+7]=a}_addRectangleFloat(t,e,i,s,r,n,o){t[e]=i/this._dimensions.device.canvas.width,t[e+1]=s/this._dimensions.device.canvas.height,t[e+2]=r/this._dimensions.device.canvas.width,t[e+3]=n/this._dimensions.device.canvas.height,t[e+4]=o[0],t[e+5]=o[1],t[e+6]=o[2],t[e+7]=o[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])}},M_=class extends at{constructor(t,e,i,s,r,n,o,l){super(),this._container=e,this._alpha=r,this._coreBrowserService=n,this._optionsService=o,this._themeService=l,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-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(t,h),this.reset(t)})),this._register($e(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=pe(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,e,i){}handleSelectionChanged(t,e,i,s=!1){}_setTransparency(t,e){if(e===this._alpha)return;let i=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Ya(t,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,e,i=1){this._ctx.fillRect(t*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*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(t,e,i,s){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(t,e,i,s){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=Oa,this._clipCell(i,s,e.getWidth()),this._ctx.fillText(e.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,e,i){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,e,i){let s=e?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${s} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},B_=class extends M_{constructor(t,e,i,s,r,n,o){super(i,t,"link",e,!0,r,n,o),this._register(s.onShowLinkUnderline(l=>this._handleShowLinkUnderline(l))),this._register(s.onHideLinkUnderline(l=>this._handleHideLinkUnderline(l)))}resize(t,e){super.resize(t,e),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&&u_(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 e=t.y1+1;e<t.y2;e++)this._fillBottomLineAtCells(0,e,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},Kt=typeof window=="object"?window:globalThis,Dr=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ne,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ne,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,e),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,e),this._onDidChangeFullscreen.fire(s)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Dr.INSTANCE=new Dr;var Za=Dr;function T_(t,e,i){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",i)}Za.INSTANCE.onDidChangeZoomLevel;Za.INSTANCE.onDidChangeFullscreen;var ui=typeof navigator=="object"?navigator.userAgent:"";ui.indexOf("Firefox")>=0;ui.indexOf("AppleWebKit")>=0;var A_=ui.indexOf("Chrome")>=0;!A_&&ui.indexOf("Safari")>=0;ui.indexOf("Electron/")>=0;ui.indexOf("Android")>=0;var Hs=!1;if(typeof Kt.matchMedia=="function"){let t=Kt.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=Kt.matchMedia("(display-mode: fullscreen)");Hs=t.matches,T_(Kt,t,({matches:i})=>{Hs&&e.matches||(Hs=i)})}var oi="en",Us=!1,Ja=!1,Xi,as=oi,po=oi,D_,ot,Yt=globalThis,Oe,Do;typeof Yt.vscode<"u"&&typeof Yt.vscode.process<"u"?Oe=Yt.vscode.process:typeof process<"u"&&typeof((Do=process==null?void 0:process.versions)==null?void 0:Do.node)=="string"&&(Oe=process);var Po,P_=typeof((Po=Oe==null?void 0:Oe.versions)==null?void 0:Po.electron)=="string",O_=P_&&(Oe==null?void 0:Oe.type)==="renderer",Oo;if(typeof Oe=="object"){Oe.platform,Oe.platform,Us=Oe.platform==="linux",Us&&Oe.env.SNAP&&Oe.env.SNAP_REVISION,Oe.env.CI||Oe.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Xi=oi,as=oi;let t=Oe.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);Xi=e.userLocale,po=e.osLocale,as=e.resolvedLanguage||oi,D_=(Oo=e.languagePack)==null?void 0:Oo.translationsConfigFile}catch{}Ja=!0}else typeof navigator=="object"&&!O_?(ot=navigator.userAgent,ot.indexOf("Windows")>=0,ot.indexOf("Macintosh")>=0,(ot.indexOf("Macintosh")>=0||ot.indexOf("iPad")>=0||ot.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Us=ot.indexOf("Linux")>=0,(ot==null?void 0:ot.indexOf("Mobi"))>=0,as=globalThis._VSCODE_NLS_LANGUAGE||oi,Xi=navigator.language.toLowerCase(),po=Xi):console.error("Unable to resolve platform.");var vo=Ja,pt=ot,Dt=as,I_;(t=>{function e(){return Dt}t.value=e;function i(){return Dt.length===2?Dt==="en":Dt.length>=3?Dt[0]==="e"&&Dt[1]==="n"&&Dt[2]==="-":!1}t.isDefaultVariant=i;function s(){return Dt==="en"}t.isDefault=s})(I_||(I_={}));var F_=typeof Yt.postMessage=="function"&&!Yt.importScripts;(()=>{if(F_){let t=[];Yt.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.id===i.data.vscodeScheduleAsyncWork){t.splice(s,1),n.callback();return}}});let e=0;return i=>{let s=++e;t.push({id:s,callback:i}),Yt.postMessage({vscodeScheduleAsyncWork:s},"*")}}return t=>setTimeout(t)})();var $_=!!(pt&&pt.indexOf("Chrome")>=0);pt&&pt.indexOf("Firefox")>=0;!$_&&pt&&pt.indexOf("Safari")>=0;pt&&pt.indexOf("Edg/")>=0;pt&&pt.indexOf("Android")>=0;var ti=typeof navigator=="object"?navigator:{};vo||document.queryCommandSupported&&document.queryCommandSupported("copy")||ti&&ti.clipboard&&ti.clipboard.writeText,vo||ti&&ti.clipboard&&ti.clipboard.readText;var Gr=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,e){this._keyCodeToStr[t]=e,this._strToKeyCode[e.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},Ks=new Gr,mo=new Gr,So=new Gr;new Array(230);var N_;(t=>{function e(l){return Ks.keyCodeToStr(l)}t.toString=e;function i(l){return Ks.strToKeyCode(l)}t.fromString=i;function s(l){return mo.keyCodeToStr(l)}t.toUserSettingsUS=s;function r(l){return So.keyCodeToStr(l)}t.toUserSettingsGeneral=r;function n(l){return mo.strToKeyCode(l)||So.strToKeyCode(l)}t.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Ks.keyCodeToStr(l)}t.toElectronAccelerator=o})(N_||(N_={}));var Qa=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),W_;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof z_?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:kt.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Qa})})(W_||(W_={}));var z_=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Qa:(this._emitter||(this._emitter=new ne),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},H_;(t=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}t.settled=e;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}t.withAsyncBody=i})(H_||(H_={}));var wo=class tt{static fromArray(e){return new tt(i=>{i.emitMany(e)})}static fromPromise(e){return new tt(async i=>{i.emitMany(await e)})}static fromPromises(e){return new tt(async i=>{await Promise.all(e.map(async s=>i.emitOne(await s)))})}static merge(e){return new tt(async i=>{await Promise.all(e.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ne,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await kt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(e,i){return new tt(async s=>{for await(let r of e)s.emitOne(i(r))})}map(e){return tt.map(this,e)}static filter(e,i){return new tt(async s=>{for await(let r of e)i(r)&&s.emitOne(r)})}filter(e){return tt.filter(this,e)}static coalesce(e){return tt.filter(e,i=>!!i)}coalesce(){return tt.coalesce(this)}static async toPromise(e){let i=[];for await(let s of e)i.push(s);return i}toPromise(){return tt.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};wo.EMPTY=wo.fromArray([]);var{getWindow:U_}=(function(){let t=new Map,e={window:Kt,disposables:new li};t.set(Kt.vscodeWindowId,e);let i=new ne,s=new ne,r=new ne;function n(o,l){return(typeof o=="number"?t.get(o):void 0)??(l?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(t.has(o.vscodeWindowId))return at.None;let l=new li,h={window:o,disposables:l.add(new li)};return t.set(o.vscodeWindowId,h),l.add($e(()=>{t.delete(o.vscodeWindowId),s.fire(o)})),l.add(Pr(o,q_.BEFORE_UNLOAD,()=>{r.fire(o)})),i.fire(h),l},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return t.has(o)},getWindowById:n,getWindow(o){var a;let l=o;if((a=l==null?void 0:l.ownerDocument)!=null&&a.defaultView)return l.ownerDocument.defaultView.window;let h=o;return h!=null&&h.view?h.view.window:Kt},getDocument(o){return U_(o).document}}})(),K_=class{constructor(t,e,i,s){this._node=t,this._type=e,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Pr(t,e,i,s){return new K_(t,e,i,s)}var q_={BEFORE_UNLOAD:"beforeunload"},V_=class extends at{constructor(t,e,i,s,r,n,o,l,h){super(),this._terminal=t,this._characterJoinerService=e,this._charSizeService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._optionsService=o,this._themeService=l,this._cursorBlinkStateManager=new wi,this._charAtlasDisposable=this._register(new wi),this._observerDisposable=this._register(new wi),this._model=new x_,this._workCell=new oo,this._workCell2=new oo,this._rectangleRenderer=this._register(new wi),this._glyphRenderer=this._register(new wi),this._onChangeTextureAtlas=this._register(new ne),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ne),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ne),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ne),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ne),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let a={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",a),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Nu(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new B_(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=Fu(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Pr(this._canvas,"webglcontextlost",c=>{console.log("webglcontextlost event received"),c.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(c)},3e3)})),this._register(Pr(this._canvas,"webglcontextrestored",c=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,ro(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=no(this._canvas,this._coreBrowserService.window,(c,d)=>this._setCanvasDevicePixelDimensions(c,d)),this._register(this._coreBrowserService.onWindowChange(c=>{this._observerDisposable.value=no(this._canvas,c,(d,u)=>this._setCanvasDevicePixelDimensions(d,u))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register($e(()=>{var c;for(let d of this._renderLayers)d.dispose();(c=this._canvas.parentElement)==null||c.removeChild(this._canvas),ro(this._terminal)}))}get textureAtlas(){var t;return(t=this._charAtlas)==null?void 0:t.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(t,e){var i,s,r,n;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let o of this._renderLayers)o.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`,(i=this._rectangleRenderer.value)==null||i.setDimensions(this.dimensions),(s=this._rectangleRenderer.value)==null||s.handleResize(),(r=this._glyphRenderer.value)==null||r.setDimensions(this.dimensions),(n=this._glyphRenderer.value)==null||n.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var t;for(let e of this._renderLayers)e.handleBlur(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.pause(),this._requestRedrawViewport()}handleFocus(){var t;for(let e of this._renderLayers)e.handleFocus(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,e,i){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,t,e,i);this._model.selection.update(this._core,t,e,i),this._requestRedrawViewport()}handleCursorMove(){var t;for(let e of this._renderLayers)e.handleCursorMove(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new R_(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new w_(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var e;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=Ya(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._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=Ba(kt.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),kt.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),(e=this._glyphRenderer.value)==null||e.setAtlas(this._charAtlas)}_clearModel(t){var e;this._model.clear(),t&&((e=this._glyphRenderer.value)==null||e.clear())}clearTextureAtlas(){var t;(t=this._charAtlas)==null||t.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var t;this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,e){var i;if(!this._isAttached)if((i=this._core.screenElement)!=null&&i.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,t,e);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,e),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 __(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,e){let i=this._core,s=this._workCell,r,n,o,l,h,a,c=0,d=!0,u,_,f,v,b,y,C,L,g;t=bo(t,i.rows-1,0),e=bo(e,i.rows-1,0);let B=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",M=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,I=M-i.buffer.ydisp,N=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),G=-1,Q=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let $=!1;for(n=t;n<=e;n++)for(o=n+i.buffer.ydisp,l=i.buffer.lines.get(o),this._model.lineLengths[n]=0,f=M===o,c=0,h=this._characterJoinerService.getJoinedCharacters(o),L=0;L<i.cols;L++){if(r=this._cellColorResolver.result.bg,l.loadCell(L,s),L===0&&(r=this._cellColorResolver.result.bg),a=!1,d=L>=c,u=L,h.length>0&&L===h[0][0]&&d){_=h.shift();let S=this._model.selection.isCellSelected(this._terminal,_[0],o);for(C=_[0]+1;C<_[1];C++)d&&(d=S===this._model.selection.isCellSelected(this._terminal,C,o));d&&(d=!f||N<_[0]||N>=_[1]),d?(a=!0,s=new Y_(s,l.translateToString(!0,_[0],_[1]),_[1]-_[0]),u=_[1]-1):c=_[1]}if(v=s.getChars(),b=s.getCode(),C=(n*i.cols+L)*fs,this._cellColorResolver.resolve(s,L,o,this.dimensions.device.cell.width),Q&&o===M&&(L===N&&(this._model.cursor={x:N,y:I,width:s.getWidth(),style:this._coreBrowserService.isFocused?B:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},G=N+s.getWidth()-1),L>=N&&L<=G&&(this._coreBrowserService.isFocused&&B==="block"||this._coreBrowserService.isFocused===!1&&i.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)),b!==0&&(this._model.lineLengths[n]=L+1),!(this._model.cells[C]===b&&this._model.cells[C+ns]===this._cellColorResolver.result.bg&&this._model.cells[C+os]===this._cellColorResolver.result.fg&&this._model.cells[C+Ws]===this._cellColorResolver.result.ext)&&($=!0,v.length>1&&(b|=C_),this._model.cells[C]=b,this._model.cells[C+ns]=this._cellColorResolver.result.bg,this._model.cells[C+os]=this._cellColorResolver.result.fg,this._model.cells[C+Ws]=this._cellColorResolver.result.ext,y=s.getWidth(),this._glyphRenderer.value.updateCell(L,n,b,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,v,y,r),a)){for(s=this._workCell,L++;L<=u;L++)g=(n*i.cols+L)*fs,this._glyphRenderer.value.updateCell(L,n,0,0,0,0,Bu,0,0),this._model.cells[g]=0,this._model.cells[g+ns]=this._cellColorResolver.result.bg,this._model.cells[g+os]=this._cellColorResolver.result.fg,this._model.cells[g+Ws]=this._cellColorResolver.result.ext;L--}}$&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_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(t,e){this._canvas.width===t&&this._canvas.height===e||(this._canvas.width=t,this._canvas.height=e,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},Y_=class extends ni{constructor(t,e,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=e,this._width=i}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 bo(t,e,i=0){return Math.max(Math.min(t,e),i)}var yo="di$target",Co="di$dependencies",qs=new Map;function vt(t){if(qs.has(t))return qs.get(t);let e=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");G_(e,i,r)};return e._id=t,qs.set(t,e),e}function G_(t,e,i){e[yo]===e?e[Co].push({id:t,index:i}):(e[Co]=[{id:t,index:i}],e[yo]=e)}vt("BufferService");vt("CoreMouseService");vt("CoreService");vt("CharsetService");vt("InstantiationService");vt("LogService");var j_=vt("OptionsService");vt("OscLinkService");vt("UnicodeService");vt("DecorationService");var X_={trace:0,debug:1,info:2,warn:3,error:4,off:5},Z_="xterm.js: ",xo=class extends at{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=X_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let e=0;e<t.length;e++)typeof t[e]=="function"&&(t[e]=t[e]())}_log(t,e,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":Z_)+e,...i)}trace(t,...e){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,t,e)}debug(t,...e){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,t,e)}info(t,...e){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,t,e)}warn(t,...e){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,t,e)}error(t,...e){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,t,e)}};xo=mu([Su(0,j_)],xo);var J_=class extends at{constructor(t){if(Da&&Mu()<16){let e={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",e))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=t,this._onChangeTextureAtlas=this._register(new ne),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ne),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ne),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ne),this.onContextLoss=this._onContextLoss.event}activate(t){let e=t._core;if(!t.element){this._register(e.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let i=e.coreService,s=e.optionsService,r=e,n=r._renderService,o=r._characterJoinerService,l=r._charSizeService,h=r._coreBrowserService,a=r._decorationService;r._logService;let c=r._themeService;this._renderer=this._register(new V_(t,o,l,h,i,a,s,c,this._preserveDrawingBuffer)),this._register(kt.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(kt.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(kt.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(kt.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register($e(()=>{if(this._terminal._core._store._isDisposed)return;let d=this._terminal._core._renderService;d.setRenderer(this._terminal._core._createRenderer()),d.handleResize(t.cols,t.rows)}))}get textureAtlas(){var t;return(t=this._renderer)==null?void 0:t.textureAtlas}clearTextureAtlas(){var t;(t=this._renderer)==null||t.clearTextureAtlas()}};const Q_={background:"#1a1a1a",foreground:"#f5f0eb",cursor:"#f5f0eb",cursorAccent:"#1a1a1a",selectionBackground:"#6b5e5680",black:"#1a1a1a",red:"#F87171",green:"#34D399",yellow:"#FBBF24",blue:"#60A5FA",magenta:"#A78BFA",cyan:"#22D3EE",white:"#e5e0d8",brightBlack:"#9ca3af",brightRed:"#FCA5A5",brightGreen:"#6EE7B7",brightYellow:"#FCD34D",brightBlue:"#93C5FD",brightMagenta:"#C4B5FD",brightCyan:"#67E8F9",brightWhite:"#ffffff"},ef={background:"#ffffff",foreground:"#333333",cursor:"#333333",cursorAccent:"#ffffff",selectionBackground:"#add6ff80",black:"#000000",red:"#cd3131",green:"#107c10",yellow:"#949800",blue:"#0451a5",magenta:"#bc05bc",cyan:"#0598bc",white:"#555555",brightBlack:"#666666",brightRed:"#cd3131",brightGreen:"#1a991a",brightYellow:"#b58900",brightBlue:"#2472c8",brightMagenta:"#b510b5",brightCyan:"#0b8ba8",brightWhite:"#a5a5a5"};function tf(t){return t==="light"?ef:Q_}function sf(t,e){if(typeof document>"u")return e;const i=getComputedStyle(document.body).getPropertyValue(t).trim();return i.length>0?i:e}function el(t="dark"){const e=tf(t),i=(s,r)=>t==="dark"?sf(s,r):r;return{background:e.background,foreground:e.foreground,cursor:e.cursor,cursorAccent:e.cursorAccent,selectionBackground:e.selectionBackground,black:e.black,red:e.red,green:e.green,yellow:e.yellow,blue:e.blue,magenta:e.magenta,cyan:e.cyan,white:e.white,brightBlack:e.brightBlack,brightRed:i("--color-error",e.brightRed),brightGreen:i("--color-success",e.brightGreen),brightYellow:i("--color-warning",e.brightYellow),brightBlue:i("--color-info",e.brightBlue),brightMagenta:i("--color-purple",e.brightMagenta),brightCyan:e.brightCyan,brightWhite:e.brightWhite}}function rf(t="dark"){return{convertEol:!1,cursorBlink:!0,fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:13,theme:el(t),scrollback:1e4,allowProposedApi:!0,rescaleOverlappingGlyphs:!0,rightClickSelectsWord:!0,macOptionClickForcesSelection:!0,wordSeparator:" ()[]{}',\"`|;:!?"}}const ko="__embeddedTerminalAtlasRepaints";function nf(t,e,i=queueMicrotask){let s=!1,r=!1;const n=()=>{if(s){r=!1;return}try{if(e.clearTextureAtlas(),typeof window<"u"){const h=window;h[ko]=(h[ko]??0)+1}}catch(h){console.debug("[atlas-heal] clearTextureAtlas skipped (term unavailable)",h)}finally{r=!1}},o=()=>{r||s||(r=!0,i(n))},l=[t.onChangeTextureAtlas(o),t.onRemoveTextureAtlasCanvas(o)];return{heal:o,dispose:()=>{s=!0;for(const h of l)try{h.dispose()}catch{}}}}function of(t){try{const e=t._core,i=e==null?void 0:e._renderService;if(i){const s={css:{cell:{width:0,height:0},canvas:{width:0,height:0}},device:{cell:{width:0,height:0},canvas:{width:0,height:0}}};Object.defineProperty(i,"dimensions",{configurable:!0,get:()=>s})}}catch{}}function af(t,e="dark",i=sl()){const s=new lu(rf(e)),r=new du,n=new vu;s.loadAddon(r),s.loadAddon(n),console.info(`[EmbeddedTerminal] renderer=${i}`);let o,l,h=!1,a=!1;if(i==="webgl")try{const d=new J_;d.onContextLoss(()=>{a=!0,h=!1,o==null||o(),o=void 0;try{d.dispose()}catch{}});const u=nf(d,s);o=u.dispose,s.loadAddon(d),h=!a,l=()=>{h&&u.heal()}}catch(d){o==null||o(),o=void 0,l=void 0,console.warn("[EmbeddedTerminal] WebGL renderer unavailable — falling back to Canvas/DOM:",d instanceof Error?d.message:String(d))}s.open(t);try{r.fit()}catch{}return{term:s,fit:r,dispose:()=>{o==null||o(),of(s),s.dispose()},healAtlas:l}}async function lf(){try{return await rl("/api/terminal/claude-theme")}catch{return{theme:null}}}function hf(){var t;return typeof window<"u"&&!!((t=window.matchMedia)!=null&&t.call(window,"(prefers-color-scheme: dark)").matches)}function Or(){return nl({pref:al(),claudeTheme:ol(),systemPrefersDark:hf()})}function cf(t,e){t.options.theme=el(e);try{t.refresh(0,t.rows-1)}catch{}}function df(t,e){const i=x.useRef(Or());x.useEffect(()=>{var d,u;let s=!1;const r=()=>{const _=t.current;if(!_||e.current)return;const f=Or();f!==i.current&&(i.current=f,cf(_,f))},n=()=>{lf().then(({theme:_})=>{s||(ll(_),r())})};n();const o=()=>r(),l=_=>{(_.key===null||_.key.startsWith("shipwright.terminal."))&&r()};window.addEventListener(en,o),window.addEventListener("storage",l);const h=(d=window.matchMedia)==null?void 0:d.call(window,"(prefers-color-scheme: dark)"),a=()=>r();(u=h==null?void 0:h.addEventListener)==null||u.call(h,"change",a);const c=()=>{document.visibilityState==="visible"&&n()};return document.addEventListener("visibilitychange",c),()=>{var _;s=!0,window.removeEventListener(en,o),window.removeEventListener("storage",l),(_=h==null?void 0:h.removeEventListener)==null||_.call(h,"change",a),document.removeEventListener("visibilitychange",c)}},[t,e])}function uf(t){const{taskId:e,containerRef:i,termRef:s,disposedRef:r,onGitignoreSuggestion:n,onPasteImageError:o}=t,l=x.useRef(n),h=x.useRef(o);x.useEffect(()=>{l.current=n},[n]),x.useEffect(()=>{h.current=o},[o]);const a=x.useCallback(async(c,d)=>{var f,v,b;const u=new FormData;u.append("image",c,d);const _=`/api/terminal/${encodeURIComponent(e)}/paste-image`;try{const y=await fetch(_,{method:"POST",body:u});if(!y.ok){let L=`HTTP ${y.status}`;try{const g=await y.json().catch(()=>null);g!=null&&g.error&&(L=g.error)}catch{}(f=h.current)==null||f.call(h,L);return}const C=await y.json().catch(()=>null);C!=null&&C.gitignoreSuggestion&&((v=l.current)==null||v.call(l))}catch(y){(b=h.current)==null||b.call(h,y instanceof Error?y.message:String(y))}},[e]);x.useEffect(()=>{const c=i.current;if(!c)return;const d=u=>{var b,y,C;const _=u.target;if(!_||!c.contains(_))return;const f=(b=u.clipboardData)==null?void 0:b.items;if(!f||f.length===0)return;for(let L=0;L<f.length;L++){const g=f[L];if(g.kind==="file"&&g.type.startsWith("image/")){u.preventDefault(),u.stopPropagation();const B=g.getAsFile();if(!B)return;a(B,`paste-${Date.now()}.png`);return}}if(Array.from(f).some(L=>L.kind==="string"&&L.type==="text/plain")){u.preventDefault(),u.stopPropagation();const L=((y=u.clipboardData)==null?void 0:y.getData("text/plain"))??"";L&&!r.current&&((C=s.current)==null||C.paste(L))}};return document.addEventListener("paste",d,{capture:!0}),()=>{document.removeEventListener("paste",d,{capture:!0})}},[a])}function ai(t,e,i){var s,r,n,o;if(i||!t||!e)return!1;try{const l=e._core;if(l!=null&&l._renderService){const h=l._renderService.dimensions,a=((r=(s=h==null?void 0:h.css)==null?void 0:s.cell)==null?void 0:r.width)??0,c=((o=(n=h==null?void 0:h.css)==null?void 0:n.cell)==null?void 0:o.height)??0;if(!h||a===0||c===0)return!1}return t.fit(),!0}catch{return!1}}const _f=[130,350];function ff(t,e,i={}){const s=i.setTimer??((a,c)=>setTimeout(a,c)),r=i.clearTimer??(a=>clearTimeout(a));let n=[];const o=()=>{for(const a of n)r(a);n=[]},l=()=>{var a,c;try{(c=(a=i.getHealAtlas)==null?void 0:a.call(i))==null||c()}catch{}};return{schedule:()=>{if(o(),!e())for(const a of _f)n.push(s(()=>{if(e())return;const c=t();if(c){try{c.refresh(0,c.rows-1)}catch{}l()}},a))},clear:o}}const gf=5,pf=2;function si(t){return t.cols>=gf&&t.rows>=pf}function Bi(t){const{width:e,height:i}=t.getBoundingClientRect();return e>0&&i>0}const Lo=250;function vf(t){const{containerRef:e,termRef:i,fitAddonRef:s,disposedRef:r,socketSend:n,active:o,layoutRevision:l,settleArmRef:h,atlasHealRef:a}=t,c=x.useRef(n);x.useEffect(()=>{c.current=n},[n]);const d=x.useRef(0),u=x.useRef(null),_=x.useRef({cols:-1,rows:-1}),f=y=>{if(!si(y))return;const{cols:C,rows:L}=y;C===_.current.cols&&L===_.current.rows||(_.current={cols:C,rows:L},c.current({type:"resize",cols:C,rows:L}))},v=x.useRef(o);x.useEffect(()=>{v.current=o},[o]);const b=x.useRef(null);b.current===null&&(b.current=ff(()=>i.current,()=>r.current,{getHealAtlas:()=>v.current?a==null?void 0:a.current:null})),x.useEffect(()=>()=>{var y;return(y=b.current)==null?void 0:y.clear()},[]),x.useEffect(()=>{const y=e.current;if(!y)return;const C=()=>{if(!v.current||!Bi(y))return;const g=s.current,B=i.current;!g||!B||ai(g,B,r.current)&&f(B)},L=new ResizeObserver(()=>{if(r.current)return;const g=Date.now();g-d.current>=Lo?(d.current=g,C()):u.current||(u.current=setTimeout(()=>{u.current=null,!r.current&&(d.current=Date.now(),C())},Lo))});return L.observe(y),()=>{L.disconnect(),u.current&&(clearTimeout(u.current),u.current=null)}},[]),x.useEffect(()=>{var N,G;if(!o)return;const y=s.current,C=i.current;if(!y||!C)return;const L=e.current,g=L!==null&&Bi(L)&&ai(y,C,r.current);if(g&&si(C))try{C.refresh(0,C.rows-1)}catch{}g&&si(C)&&((N=h==null?void 0:h.current)==null||N.call(h));const B=g&&si(C);B&&((G=b.current)==null||G.schedule());let M=null,I=requestAnimationFrame(()=>{I=null,M=requestAnimationFrame(()=>{var p,w;if(M=null,r.current||!v.current)return;const Q=s.current,$=i.current,S=e.current;if(!(!Q||!$)&&!(!S||!Bi(S))&&ai(Q,$,r.current)&&si($)){if(!B){try{$.refresh(0,$.rows-1)}catch{}(p=h==null?void 0:h.current)==null||p.call(h),(w=b.current)==null||w.schedule()}f($)}})});return()=>{I!==null&&cancelAnimationFrame(I),M!==null&&cancelAnimationFrame(M)}},[o,l]),x.useEffect(()=>{const y=()=>{var B,M;if(r.current||!v.current||typeof document<"u"&&document.hidden)return;const C=e.current;if(!C||!Bi(C))return;const L=s.current,g=i.current;if(!(!L||!g)){ai(L,g,r.current);try{g.refresh(0,g.rows-1)}catch{}(B=h==null?void 0:h.current)==null||B.call(h),(M=b.current)==null||M.schedule(),f(g)}};return window.addEventListener("focus",y),window.addEventListener("pageshow",y),document.addEventListener("visibilitychange",y),()=>{window.removeEventListener("focus",y),window.removeEventListener("pageshow",y),document.removeEventListener("visibilitychange",y)}},[])}const mf=8*1024*1024,Eo=t=>new TextEncoder().encode(t).length;class Sf{constructor(e=mf){ws(this,"chunks",[]);ws(this,"bytes",0);this.maxBytes=e}push(e){this.chunks.push(e),this.bytes+=Eo(e);let i=!1;for(;this.bytes>this.maxBytes&&this.chunks.length>1;){const s=this.chunks.shift();if(s===void 0)break;this.bytes-=Eo(s),i=!0}return i}takeAll(){const e=this.chunks.join("");return this.clear(),e}clear(){this.chunks=[],this.bytes=0}get byteLength(){return this.bytes}get length(){return this.chunks.length}}const wf=5e3;function bf(t,e,i,s){const r=x.useRef(i);r.current=i;const n=x.useRef(s);n.current=s;const o=x.useRef(null),l=x.useRef(null),h=x.useRef(!1),a=x.useRef(new Sf),c=x.useRef(0),d=x.useRef(null),u=x.useRef(!1),_=x.useRef(0),f=x.useCallback(()=>{d.current!==null&&(clearTimeout(d.current),d.current=null)},[]),v=x.useCallback(()=>{f(),h.current=!1,a.current.clear(),o.current=null,c.current+=1},[f]),b=x.useCallback((g,B)=>{var N,G;if(c.current!==g)return;c.current+=1,f(),h.current=!1;const M=o.current;if(o.current=null,M&&!e.current&&t.current===B){(N=l.current)==null||N.call(l,M,!0);return}const I=a.current.takeAll();if(!(e.current||t.current!==B)){try{I.length>0&&B.write(I),B.scrollToBottom(),B.refresh(0,B.rows-1)}catch(Q){console.warn(`[terminal] replay drain failed: ${Q.message}`)}(G=r.current)==null||G.call(r)}},[f,e,t]),y=x.useCallback(g=>{var B,M;if(u.current||(u.current=!0),_.current=Date.now(),h.current){a.current.push(g)&&((B=n.current)==null||B.call(n));return}(M=t.current)==null||M.write(g)},[t]),C=x.useCallback((g,B=!1)=>{const M=t.current;if(!M)return;try{const N=g.terminalVersion.split(".")[0];N&&N!=="6"&&console.warn(`[terminal] replay_snapshot served by xterm major ${N}; client xterm.js is major 6 — visual artifacts possible`)}catch{}c.current+=1;const I=c.current;f(),B||a.current.clear(),h.current=!0,d.current=setTimeout(()=>{d.current=null,b(I,M)},wf);try{try{M.reset()}catch{}if(g.cols>0&&g.cols!==M.cols||g.rows>0&&g.rows!==M.rows)try{M.resize(g.cols,g.rows)}catch{}M.write(g.data,()=>{b(I,M)})}catch(N){v(),console.warn(`[terminal] replay_snapshot write failed: ${N.message}`)}},[f,v,b,t]);l.current=C;const L=x.useCallback(g=>{if(h.current){o.current=g,a.current.clear();return}C(g)},[C]);return x.useMemo(()=>({dataSeenInitiallyRef:u,lastPtyDataAtRef:_,onDataChunk:y,onReplaySnapshot:L,resetGate:v}),[y,L,v])}const yf=400;function Cf(t){const{send:e,onBackpressure:i,debounceMs:s=yf}=t,r=x.useRef(e);r.current=e;const n=x.useRef(i);n.current=i;const o=x.useRef(null),l=x.useCallback(()=>{o.current===null&&(o.current=setTimeout(()=>{o.current=null,r.current({type:"resync"})},s))},[s]),h=x.useCallback(a=>{var u,_;if(!(a.droppedBytes>0||a.totalDroppedBytes>0)){(u=n.current)==null||u.call(n,a);return}const d=a.episode===0&&a.droppedChunks===0;(a.episodeEnded||d)&&l(),(_=n.current)==null||_.call(n,a)},[l]);return x.useEffect(()=>()=>{o.current!==null&&(clearTimeout(o.current),o.current=null)},[]),{onBackpressure:h,requestResync:l}}function xf(t){const{containerRef:e,termRef:i,fitAddonRef:s,disposedRef:r,socketSend:n,role:o,active:l}=t,h=x.useCallback(()=>{const d=e.current,u=i.current,_=s.current;return!l||!d||!Bi(d)||!u||!_?!1:ai(_,u,r.current)&&si(u)?(n({type:"resize",cols:u.cols,rows:u.rows}),!0):!1},[l,e,i,s,r,n]),a=x.useRef(o);a.current=o;const c=x.useCallback(()=>{a.current==="writer"&&(h(),n({type:"redraw"}))},[h,n]);return{syncSizeNow:h,onReplaySettled:c}}const kf=250,Lf=1500,Ef=15e3,Ro=50;function Rf(t){const{taskId:e,taskState:i,socket:s,coord:r,gate:n,onBeforeDispatch:o,dispatchReady:l=!0}=t,h=x.useRef(o);h.current=o;const a=x.useRef(new Set),c=x.useRef(!1),d=x.useRef(!1),u=x.useRef(!1),[_,f]=x.useState(null);x.useEffect(()=>{a.current=new Set,c.current=!1,d.current=!1,u.current=!1,f(null),n.dataSeenInitiallyRef.current=!1,n.lastPtyDataAtRef.current=0},[e]),x.useEffect(()=>{s.ready&&s.replayOnly!==!0&&(u.current||(u.current=!0,s.ptyReused===!0&&(d.current=!0)))},[s.ready,s.ptyReused,s.replayOnly]),x.useEffect(()=>{s.terminalReset===!0&&(d.current=!1,f(null),n.dataSeenInitiallyRef.current=!1,n.lastPtyDataAtRef.current=0)},[s.terminalReset]);const v=x.useRef(i);x.useEffect(()=>{const g=v.current;v.current=i,(g==="done"||g==="launch_failed")&&!(i==="done"||i==="launch_failed")&&(d.current=!1,u.current=!1,f(null))},[i]),x.useEffect(()=>{const g=r.pendingLaunch;if(!g||a.current.has(g.launchToken)||c.current||!s.ready||s.role!=="writer"||!s.shellKind||!l||g.expiresAt<=Date.now())return;if(d.current){a.current.add(g.launchToken),f({commands:g.commands}),r.consumeLaunch(g.launchToken);return}let B=!1;return c.current=!0,(async()=>{var G;const M=Date.now();let I=!1;for(;!B&&Date.now()-M<Ef;){const Q=Date.now()-M;if(n.dataSeenInitiallyRef.current&&Date.now()-n.lastPtyDataAtRef.current>=kf){I=!0;break}if(!n.dataSeenInitiallyRef.current&&Q>=Lf){I=!0;break}await new Promise($=>setTimeout($,Ro))}if(B)return;if(!I){a.current.add(g.launchToken),r.cancelLaunch("timeout");return}if(a.current.has(g.launchToken)||!s.ready||s.role!=="writer"||!s.shellKind)return;if(g.expiresAt<=Date.now()){a.current.add(g.launchToken),r.cancelLaunch("timeout");return}for(;!B&&((G=h.current)==null?void 0:G.call(h))===!1;){if(g.expiresAt<=Date.now()){a.current.add(g.launchToken),r.cancelLaunch("timeout");return}await new Promise(Q=>setTimeout(Q,Ro))}if(B)return;const N=Zi(g.commands,s.shellKind);a.current.add(g.launchToken),s.send({type:"data",payload:N+"\r"}),d.current=!0,r.consumeLaunch(g.launchToken)})().finally(()=>{c.current=!1}),()=>{B=!0}},[r,s.ready,s.role,s.shellKind,r.pendingLaunch,l,n.dataSeenInitiallyRef,n.lastPtyDataAtRef]);const b=x.useCallback(()=>{var M;const g=_;if(!g||!s.ready||s.role!=="writer"||!s.shellKind)return;const B=Zi(g.commands,s.shellKind);((M=h.current)==null?void 0:M.call(h))!==!1&&(s.send({type:"data",payload:B+"\r"}),f(null))},[_,s.ready,s.role,s.shellKind,s.send]),y=x.useCallback(()=>{f(null)},[]),C=r.pendingLaunch&&s.shellKind?Zi(r.pendingLaunch.commands,s.shellKind):null;return{manualSendCommand:_&&s.shellKind?Zi(_.commands,s.shellKind):null,previewCommand:C,handleManualSend:b,dismissManualSend:y}}function Zi(t,e){return e==="pwsh"?t.powershell:e==="cmd"?t.cmd:t.posix}const Mf={"copy-failed":"Copy failed","paste-hint":"Keyboard paste needs HTTPS or localhost — use right-click → Paste","paste-failed":"Paste failed — clipboard permission denied"},Bf={"copy-failed":8e3,"paste-hint":8e3,"paste-failed":8e3},Tf={"copy-failed":"border-red-800 bg-[#2a1416] text-red-300","paste-hint":"border-sky-800 bg-[#0f1d2e] text-sky-300","paste-failed":"border-red-800 bg-[#2a1416] text-red-300"};function Af(t){const{reconnecting:e,reconnectStalled:i,readOnly:s,showResetBanner:r,resetScrollbackBytes:n,onDismissResetBanner:o,replayOnly:l,previewCommand:h,manualSendCommand:a,onManualSend:c,onDismissManualSend:d,clipboardNotice:u,onDismissClipboardNotice:_}=t;return J.jsxs(J.Fragment,{children:[e||i?J.jsx("div",{className:"-mx-2 -mt-2 mb-2 border-b border-[var(--color-border,#e0dbd4)] bg-[var(--color-warning-bg,#fff7ed)] px-3 py-1 text-[11px] text-[var(--color-warning,#9a3412)]","data-testid":"embedded-terminal-reconnecting","data-stalled":i?"true":"false",role:"status",children:i?"Connection lost — still retrying, less often now. The server may be unreachable, or this task's folder may no longer exist.":"Connection lost — reconnecting… The terminal keeps retrying on its own; reloading the page is not needed."}):null,s?J.jsx("div",{className:"-mx-2 -mt-2 mb-2 border-b border-[var(--color-border,#e0dbd4)] bg-[var(--color-warning-bg,#fff7ed)] px-3 py-1 text-[11px] text-[var(--color-warning,#9a3412)]","data-testid":"embedded-terminal-readonly",children:"Read-only — another tab is the active writer for this task."}):null,r?J.jsxs("div",{className:"-mx-2 -mt-2 mb-2 flex items-start justify-between gap-2 border-b border-[var(--color-border,#e0dbd4)] bg-[var(--color-warning-bg,#fff7ed)] px-3 py-1 text-[11px] text-[var(--color-warning,#9a3412)]","data-testid":"embedded-terminal-reset",children:[J.jsxs("div",{className:"flex flex-col gap-0.5",children:[J.jsxs("span",{children:["Terminal was reset — the previous Claude session was interrupted (the server may have restarted). Click ",J.jsx("strong",{children:"Resume"})," to continue."]}),n!==null&&n>0?J.jsx("span",{"data-testid":"embedded-terminal-reset-dataloss",children:"Resume rebuilds from Claude's saved transcript — content shown before the interruption that wasn't yet saved may not return. Your last terminal screen is kept in this task's scrollback."}):null]}),J.jsx("button",{type:"button",onClick:o,className:"shrink-0 rounded px-1 leading-none text-[var(--color-warning,#9a3412)] hover:bg-black/5","data-testid":"embedded-terminal-reset-dismiss","aria-label":"Dismiss",children:"✕"})]}):null,l?J.jsx("div",{className:"-mx-2 -mt-2 mb-2 border-b border-[var(--color-border,#e0dbd4)] bg-[var(--color-muted-bg,#ede8e1)] px-3 py-1 text-[11px] text-[var(--color-muted,#6b7280)]","data-testid":"embedded-terminal-replay-only",children:"Session ended — viewing historical terminal scrollback only."}):null,h?J.jsxs("div",{className:"-mx-2 -mt-2 mb-2 max-h-24 shrink-0 overflow-y-auto border-b border-[var(--color-border,#e0dbd4)] bg-[var(--color-info-bg,#eff6ff)] px-3 py-1 font-mono text-[11px] text-[var(--color-info,#1d4ed8)]","data-testid":"embedded-terminal-launch-preview",children:[J.jsx("span",{className:"opacity-70","aria-hidden":!0,children:"About to run:"})," ",J.jsx("span",{className:"break-all",children:h})]}):null,a?J.jsxs("div",{className:"-mx-2 -mt-2 mb-2 flex max-h-32 shrink-0 flex-col gap-1 overflow-y-auto [&>*]:shrink-0 border-b border-[var(--color-border,#e0dbd4)] bg-[var(--color-warning-bg,#fff7ed)] px-3 py-1.5 text-[11px] text-[var(--color-warning,#9a3412)]","data-testid":"embedded-terminal-manual-send",children:[J.jsxs("div",{className:"flex items-start justify-between gap-2",children:[J.jsx("span",{children:"This terminal already has a session — auto-run is disabled so the command can't land inside a running Claude. Send it only when the shell is back at a prompt."}),J.jsx("button",{type:"button",onClick:d,className:"shrink-0 rounded px-1 leading-none hover:bg-black/5","data-testid":"embedded-terminal-manual-send-dismiss","aria-label":"Dismiss",children:"✕"})]}),J.jsxs("div",{className:"flex items-center gap-2",children:[J.jsx("span",{className:"min-w-0 flex-1 break-all font-mono opacity-80",children:a}),J.jsx("button",{type:"button",onClick:c,className:"shrink-0 rounded bg-[var(--color-warning,#9a3412)] px-2 py-0.5 font-semibold text-white transition hover:opacity-90","data-testid":"embedded-terminal-manual-send-button",children:"Send to terminal"})]})]}):null,u?J.jsxs("div",{className:`absolute bottom-3 right-3 z-10 flex max-w-[min(90%,28rem)] items-center gap-2 rounded border px-2.5 py-1 text-[11px] shadow-md ${Tf[u]}`,"data-testid":"embedded-terminal-clipboard-notice","data-notice-kind":u,children:[J.jsx("span",{children:Mf[u]}),J.jsx("button",{type:"button",onClick:_,className:"shrink-0 rounded px-1 leading-none hover:bg-white/10","data-testid":"embedded-terminal-clipboard-notice-dismiss","aria-label":"Dismiss",children:"✕"})]}):null]})}function Df(){const[t,e]=x.useState(null);x.useEffect(()=>{if(!t)return;const r=setTimeout(()=>e(null),Bf[t]);return()=>clearTimeout(r)},[t]);const i=x.useCallback(r=>{e(r)},[]),s=x.useCallback(()=>{e(null)},[]);return{clipboardNotice:t,notify:i,dismissClipboardNotice:s}}const Pf=1500,Of=1500;function If(t){const{socket:e,active:i,termRef:s,fitAddonRef:r,disposedRef:n,setReadOnlyArmed:o,setReconnectingArmed:l,onReadyChange:h,onTerminalMeta:a}=t,c=x.useRef(!1);x.useEffect(()=>{e.ready&&!c.current&&o(!1),c.current=e.ready},[e.ready,o]),x.useEffect(()=>{if(!e.ready||e.role!=="reader"){o(!1);return}const u=setTimeout(()=>o(!0),Pf);return()=>clearTimeout(u)},[e.role,e.ready,o]),x.useEffect(()=>{if(!e.reconnecting){l(!1);return}const u=setTimeout(()=>l(!0),Of);return()=>clearTimeout(u)},[e.reconnecting,l]);const d=x.useRef(!1);x.useEffect(()=>{if(!i){d.current=!1;return}if(!e.ready||d.current)return;d.current=!0;const u=setTimeout(()=>{if(n.current)return;const _=s.current,f=r.current;if(_&&f){ai(f,_,n.current);try{_.refresh(0,_.rows-1)}catch{}}try{_==null||_.focus()}catch{}},0);return()=>clearTimeout(u)},[i,e.ready]),x.useEffect(()=>{h==null||h(e.ready,e.role)},[e.ready,e.role,h]),x.useEffect(()=>{a==null||a({replayOnly:e.replayOnly,scrollbackBytes:e.scrollbackBytes,retentionDays:e.retentionDays,scrollbackDir:e.scrollbackDir})},[e.replayOnly,e.scrollbackBytes,e.retentionDays,e.scrollbackDir,a])}function Ff(t,e){const[i,s]=x.useState(!1),[r,n]=x.useState(!1),[o,l]=x.useState(!1);x.useEffect(()=>{l(!1)},[t]);const h=x.useRef(e);return x.useEffect(()=>{const a=h.current;h.current=e,(a==="done"||a==="launch_failed")&&!(e==="done"||e==="launch_failed")&&l(!1)},[e]),{readOnlyArmed:i,setReadOnlyArmed:s,reconnectingArmed:r,setReconnectingArmed:n,resetBannerDismissed:o,setResetBannerDismissed:l}}function $f(t,e){const i=e?"O":"[";switch(t){case"esc":return"\x1B";case"tab":return" ";case"ctrlc":return"";case"enter":return"\r";case"up":return`\x1B${i}A`;case"down":return`\x1B${i}B`;case"right":return`\x1B${i}C`;case"left":return`\x1B${i}D`}}const Nf=[{id:"esc",label:"Esc",aria:"Escape"},{id:"tab",label:"Tab",aria:"Tab"},{id:"ctrlc",label:"⌃C",aria:"Control C"},{id:"left",label:"←",aria:"Arrow left"},{id:"up",label:"↑",aria:"Arrow up"},{id:"down",label:"↓",aria:"Arrow down"},{id:"right",label:"→",aria:"Arrow right"},{id:"enter",label:"⏎",aria:"Enter"}],Mo="flex h-11 min-w-[44px] shrink-0 items-center justify-center rounded-[6px] border border-white/80 px-3 text-[13px] font-medium text-white bg-white/10 active:bg-white/25 disabled:opacity-40 disabled:active:bg-white/10";function Wf({onKey:t,onFocusTerminal:e,disabled:i}){if(!hl())return null;const r=n=>n.preventDefault();return J.jsxs("div",{role:"toolbar","aria-label":"Terminal keys","data-testid":"terminal-key-bar",className:"flex shrink-0 items-center gap-1.5 overflow-x-auto border-t border-white/10 bg-[#222] px-2 py-2",children:[J.jsx("button",{type:"button","aria-label":"Show keyboard","data-testid":"terminal-key-keyboard",onPointerDown:r,onClick:e,className:Mo,children:"⌨"}),Nf.map(n=>J.jsx("button",{type:"button","aria-label":n.aria,"data-testid":`terminal-key-${n.id}`,disabled:i,onPointerDown:r,onClick:()=>t(n.id),className:Mo,children:n.label},n.id))]})}const lp=x.forwardRef(function({taskId:e,active:i,taskState:s,layoutRevision:r,socketUrlOverride:n,socketEnabled:o=!0,onGitignoreSuggestion:l,onBackpressure:h,onReadyChange:a,onPasteImageError:c,onTerminalMeta:d},u){const _=x.useRef(null),f=x.useRef(null),v=x.useRef(null),b=x.useRef(!1),y=x.useRef(null),C=x.useRef(null),L=Ff(e,s),{readOnlyArmed:g,resetBannerDismissed:B,setResetBannerDismissed:M}=L,I=Df(),N=cl(),G=x.useRef(null),Q=x.useCallback(()=>{var Y;return(Y=G.current)==null?void 0:Y.call(G)},[]),$=x.useRef(null),S=Cf({send:Y=>{var F;return(F=$.current)==null?void 0:F.call($,Y)},onBackpressure:h}),p=bf(f,b,Q,S.requestResync),m=Tl({taskId:e,urlOverride:n,enabled:o,sessionEnded:s===void 0?void 0:s==="done"||s==="launch_failed",onData:p.onDataChunk,onReplaySnapshot:p.onReplaySnapshot,onBackpressure:S.onBackpressure});$.current=m.send;const{syncSizeNow:k,onReplaySettled:E}=xf({containerRef:_,termRef:f,fitAddonRef:v,disposedRef:b,socketSend:m.send,role:m.role,active:i});G.current=E;const{manualSendCommand:A,previewCommand:R,handleManualSend:D,dismissManualSend:z}=Rf({taskId:e,taskState:s,socket:m,coord:N,gate:p,onBeforeDispatch:k,dispatchReady:i});uf({taskId:e,containerRef:_,termRef:f,disposedRef:b,onGitignoreSuggestion:l,onPasteImageError:c}),vf({containerRef:_,termRef:f,fitAddonRef:v,disposedRef:b,socketSend:m.send,active:i,layoutRevision:r,settleArmRef:y,atlasHealRef:C}),If({socket:m,active:i,termRef:f,fitAddonRef:v,disposedRef:b,setReadOnlyArmed:L.setReadOnlyArmed,setReconnectingArmed:L.setReconnectingArmed,onReadyChange:a,onTerminalMeta:d}),df(f,b);const Z=g&&m.role==="reader";x.useImperativeHandle(u,()=>({focus(){var Y;(Y=f.current)==null||Y.focus()},get ready(){return m.ready},get role(){return m.role}}),[m.ready,m.role]),x.useEffect(()=>{const Y=_.current;if(!Y)return;const F=af(Y,Or());f.current=F.term,v.current=F.fit,b.current=!1,window.__embeddedTerminal=F.term,F.term.attachCustomKeyEventHandler(Pl({term:F.term,isDisposed:()=>b.current,notify:I.notify,readClipboard:Dl})),F.term.parser.registerOscHandler(52,Fl({copy:me=>dl(me,{preserveFocus:!0}),isDisposed:()=>b.current,onError:()=>I.notify("copy-failed")}));const X=ql(F.term,Y),q=Xl(F.term,Y,()=>b.current,{getHealAtlas:()=>C.current}),V=Ql(F.term,()=>b.current);y.current=V.arm,C.current=F.healAtlas??null;const ee=F.term.onData(me=>{const Ne=zl(me);Ne&&m.send(Ne)});return()=>{b.current=!0,C.current=null,ee.dispose();try{q(),X(),V.dispose(),y.current=null}catch{}F.dispose(),f.current=null,v.current=null,window.__embeddedTerminal=null}},[]);const H=m.terminalReset===!0&&!N.pendingLaunch&&!B;return J.jsxs("div",{className:"relative flex h-full min-h-0 w-full flex-col bg-[#1a1a1a] p-2","data-testid":"embedded-terminal","data-ws-open":m.open?"true":"false","data-ws-ready":m.ready?"true":"false","data-role":m.role??"unknown",children:[J.jsx(Af,{reconnecting:L.reconnectingArmed,reconnectStalled:m.reconnectStalled,readOnly:Z,showResetBanner:H,resetScrollbackBytes:m.scrollbackBytes,onDismissResetBanner:()=>M(!0),replayOnly:m.replayOnly===!0,previewCommand:R,manualSendCommand:A,onManualSend:D,onDismissManualSend:z,clipboardNotice:I.clipboardNotice,onDismissClipboardNotice:I.dismissClipboardNotice}),J.jsx("div",{ref:_,className:"min-h-0 flex-1 overflow-hidden",tabIndex:-1,"data-testid":"embedded-terminal-canvas"}),J.jsx(Wf,{disabled:m.role!=="writer",onFocusTerminal:()=>{var Y;return(Y=f.current)==null?void 0:Y.focus()},onKey:Y=>{var X,q;if(m.role!=="writer")return;const F=((q=(X=f.current)==null?void 0:X.modes)==null?void 0:q.applicationCursorKeysMode)??!1;m.send({type:"data",payload:$f(Y,F)})}})]})});export{lp as EmbeddedTerminal,mf as REPLAY_DRAIN_MAX_BYTES,wf as REPLAY_DRAIN_TIMEOUT_MS};
|
|
112
|
+
}`,Ct=8,Hs=Ct*Float32Array.BYTES_PER_ELEMENT,I_=20*Ct,fo=class{constructor(){this.attributes=new Float32Array(I_),this.count=0}},yt=0,go=0,po=0,vo=0,mo=0,So=0,wo=0,O_=class extends at{constructor(t,e,i,s){super(),this._terminal=t,this._gl=e,this._dimensions=i,this._themeService=s,this._vertices=new fo,this._verticesCursor=new fo;let r=this._gl;this._program=ve(nl(r,D_,P_)),this._register(Ne(()=>r.deleteProgram(this._program))),this._projectionLocation=ve(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(Ne(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let l=new Uint8Array([0,1,2,3]),h=r.createBuffer();this._register(Ne(()=>r.deleteBuffer(h))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,h),r.bufferData(r.ELEMENT_ARRAY_BUFFER,l,r.STATIC_DRAW),this._attributesBuffer=ve(r.createBuffer()),this._register(Ne(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,Hs,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,Hs,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,Hs,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors(a=>{this._updateCachedColors(a),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),e.uniformMatrix4fv(this._projectionLocation,!1,rl),e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,t.attributes,e.DYNAMIC_DRAW),e.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,e.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 e=this._terminal,i=this._vertices,s=1,r,n,o,l,h,a,c,d,u,_,f;for(r=0;r<e.rows;r++){for(o=-1,l=0,h=0,a=!1,n=0;n<e.cols;n++)c=(r*e.cols+n)*gs,d=t.cells[c+ns],u=t.cells[c+os],_=!!(u&67108864),(d!==l||u!==h&&(a||_))&&((l!==0||a&&h!==0)&&(f=s++*Ct,this._updateRectangle(i,f,h,l,o,n,r)),o=n,l=d,h=u,a=_);(l!==0||a&&h!==0)&&(f=s++*Ct,this._updateRectangle(i,f,h,l,o,e.cols,r))}i.count=s}updateCursor(t){let e=this._verticesCursor,i=t.cursor;if(!i||i.style==="block"){e.count=0;return}let s,r=0;(i.style==="bar"||i.style==="outline")&&(s=r++*Ct,this._addRectangleFloat(e.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(s=r++*Ct,this._addRectangleFloat(e.attributes,s,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(s=r++*Ct,this._addRectangleFloat(e.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),s=r++*Ct,this._addRectangleFloat(e.attributes,s,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),e.count=r}_updateRectangle(t,e,i,s,r,n,o){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:yt=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:yt=(i&16777215)<<8;break;case 0:default:yt=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:yt=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:yt=(s&16777215)<<8;break;case 0:default:yt=this._themeService.colors.background.rgba}t.attributes.length<e+4&&(t.attributes=C_(t.attributes,this._terminal.rows*this._terminal.cols*Ct)),go=r*this._dimensions.device.cell.width,po=o*this._dimensions.device.cell.height,vo=(yt>>24&255)/255,mo=(yt>>16&255)/255,So=(yt>>8&255)/255,wo=1,this._addRectangle(t.attributes,e,go,po,(n-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,vo,mo,So,wo)}_addRectangle(t,e,i,s,r,n,o,l,h,a){t[e]=i/this._dimensions.device.canvas.width,t[e+1]=s/this._dimensions.device.canvas.height,t[e+2]=r/this._dimensions.device.canvas.width,t[e+3]=n/this._dimensions.device.canvas.height,t[e+4]=o,t[e+5]=l,t[e+6]=h,t[e+7]=a}_addRectangleFloat(t,e,i,s,r,n,o){t[e]=i/this._dimensions.device.canvas.width,t[e+1]=s/this._dimensions.device.canvas.height,t[e+2]=r/this._dimensions.device.canvas.width,t[e+3]=n/this._dimensions.device.canvas.height,t[e+4]=o[0],t[e+5]=o[1],t[e+6]=o[2],t[e+7]=o[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])}},F_=class extends at{constructor(t,e,i,s,r,n,o,l){super(),this._container=e,this._alpha=r,this._coreBrowserService=n,this._optionsService=o,this._themeService=l,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-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(t,h),this.reset(t)})),this._register(Ne(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=ve(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,e,i){}handleSelectionChanged(t,e,i,s=!1){}_setTransparency(t,e){if(e===this._alpha)return;let i=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=il(t,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,e,i=1){this._ctx.fillRect(t*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*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(t,e,i,s){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(t,e,i,s){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=Ka,this._clipCell(i,s,e.getWidth()),this._ctx.fillText(e.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,e,i){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,e,i){let s=e?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${s} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},$_=class extends F_{constructor(t,e,i,s,r,n,o){super(i,t,"link",e,!0,r,n,o),this._register(s.onShowLinkUnderline(l=>this._handleShowLinkUnderline(l))),this._register(s.onHideLinkUnderline(l=>this._handleHideLinkUnderline(l)))}resize(t,e){super.resize(t,e),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&&w_(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 e=t.y1+1;e<t.y2;e++)this._fillBottomLineAtCells(0,e,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},Kt=typeof window=="object"?window:globalThis,Or=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new re,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new re,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,e),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,e),this._onDidChangeFullscreen.fire(s)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Or.INSTANCE=new Or;var ol=Or;function N_(t,e,i){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",i)}ol.INSTANCE.onDidChangeZoomLevel;ol.INSTANCE.onDidChangeFullscreen;var ui=typeof navigator=="object"?navigator.userAgent:"";ui.indexOf("Firefox")>=0;ui.indexOf("AppleWebKit")>=0;var W_=ui.indexOf("Chrome")>=0;!W_&&ui.indexOf("Safari")>=0;ui.indexOf("Electron/")>=0;ui.indexOf("Android")>=0;var Us=!1;if(typeof Kt.matchMedia=="function"){let t=Kt.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=Kt.matchMedia("(display-mode: fullscreen)");Us=t.matches,N_(Kt,t,({matches:i})=>{Us&&e.matches||(Us=i)})}var oi="en",Ks=!1,al=!1,Zi,as=oi,bo=oi,z_,ot,Yt=globalThis,Oe,$o;typeof Yt.vscode<"u"&&typeof Yt.vscode.process<"u"?Oe=Yt.vscode.process:typeof process<"u"&&typeof(($o=process==null?void 0:process.versions)==null?void 0:$o.node)=="string"&&(Oe=process);var No,H_=typeof((No=Oe==null?void 0:Oe.versions)==null?void 0:No.electron)=="string",U_=H_&&(Oe==null?void 0:Oe.type)==="renderer",Wo;if(typeof Oe=="object"){Oe.platform,Oe.platform,Ks=Oe.platform==="linux",Ks&&Oe.env.SNAP&&Oe.env.SNAP_REVISION,Oe.env.CI||Oe.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Zi=oi,as=oi;let t=Oe.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);Zi=e.userLocale,bo=e.osLocale,as=e.resolvedLanguage||oi,z_=(Wo=e.languagePack)==null?void 0:Wo.translationsConfigFile}catch{}al=!0}else typeof navigator=="object"&&!U_?(ot=navigator.userAgent,ot.indexOf("Windows")>=0,ot.indexOf("Macintosh")>=0,(ot.indexOf("Macintosh")>=0||ot.indexOf("iPad")>=0||ot.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ks=ot.indexOf("Linux")>=0,(ot==null?void 0:ot.indexOf("Mobi"))>=0,as=globalThis._VSCODE_NLS_LANGUAGE||oi,Zi=navigator.language.toLowerCase(),bo=Zi):console.error("Unable to resolve platform.");var yo=al,pt=ot,Dt=as,K_;(t=>{function e(){return Dt}t.value=e;function i(){return Dt.length===2?Dt==="en":Dt.length>=3?Dt[0]==="e"&&Dt[1]==="n"&&Dt[2]==="-":!1}t.isDefaultVariant=i;function s(){return Dt==="en"}t.isDefault=s})(K_||(K_={}));var q_=typeof Yt.postMessage=="function"&&!Yt.importScripts;(()=>{if(q_){let t=[];Yt.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.id===i.data.vscodeScheduleAsyncWork){t.splice(s,1),n.callback();return}}});let e=0;return i=>{let s=++e;t.push({id:s,callback:i}),Yt.postMessage({vscodeScheduleAsyncWork:s},"*")}}return t=>setTimeout(t)})();var V_=!!(pt&&pt.indexOf("Chrome")>=0);pt&&pt.indexOf("Firefox")>=0;!V_&&pt&&pt.indexOf("Safari")>=0;pt&&pt.indexOf("Edg/")>=0;pt&&pt.indexOf("Android")>=0;var ti=typeof navigator=="object"?navigator:{};yo||document.queryCommandSupported&&document.queryCommandSupported("copy")||ti&&ti.clipboard&&ti.clipboard.writeText,yo||ti&&ti.clipboard&&ti.clipboard.readText;var Zr=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,e){this._keyCodeToStr[t]=e,this._strToKeyCode[e.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},qs=new Zr,Co=new Zr,xo=new Zr;new Array(230);var Y_;(t=>{function e(l){return qs.keyCodeToStr(l)}t.toString=e;function i(l){return qs.strToKeyCode(l)}t.fromString=i;function s(l){return Co.keyCodeToStr(l)}t.toUserSettingsUS=s;function r(l){return xo.keyCodeToStr(l)}t.toUserSettingsGeneral=r;function n(l){return Co.strToKeyCode(l)||xo.strToKeyCode(l)}t.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return qs.keyCodeToStr(l)}t.toElectronAccelerator=o})(Y_||(Y_={}));var ll=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),j_;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof G_?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:kt.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:ll})})(j_||(j_={}));var G_=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?ll:(this._emitter||(this._emitter=new re),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},X_;(t=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}t.settled=e;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}t.withAsyncBody=i})(X_||(X_={}));var ko=class tt{static fromArray(e){return new tt(i=>{i.emitMany(e)})}static fromPromise(e){return new tt(async i=>{i.emitMany(await e)})}static fromPromises(e){return new tt(async i=>{await Promise.all(e.map(async s=>i.emitOne(await s)))})}static merge(e){return new tt(async i=>{await Promise.all(e.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new re,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await kt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(e,i){return new tt(async s=>{for await(let r of e)s.emitOne(i(r))})}map(e){return tt.map(this,e)}static filter(e,i){return new tt(async s=>{for await(let r of e)i(r)&&s.emitOne(r)})}filter(e){return tt.filter(this,e)}static coalesce(e){return tt.filter(e,i=>!!i)}coalesce(){return tt.coalesce(this)}static async toPromise(e){let i=[];for await(let s of e)i.push(s);return i}toPromise(){return tt.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};ko.EMPTY=ko.fromArray([]);var{getWindow:Z_}=(function(){let t=new Map,e={window:Kt,disposables:new li};t.set(Kt.vscodeWindowId,e);let i=new re,s=new re,r=new re;function n(o,l){return(typeof o=="number"?t.get(o):void 0)??(l?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(t.has(o.vscodeWindowId))return at.None;let l=new li,h={window:o,disposables:l.add(new li)};return t.set(o.vscodeWindowId,h),l.add(Ne(()=>{t.delete(o.vscodeWindowId),s.fire(o)})),l.add(Fr(o,Q_.BEFORE_UNLOAD,()=>{r.fire(o)})),i.fire(h),l},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return t.has(o)},getWindowById:n,getWindow(o){var a;let l=o;if((a=l==null?void 0:l.ownerDocument)!=null&&a.defaultView)return l.ownerDocument.defaultView.window;let h=o;return h!=null&&h.view?h.view.window:Kt},getDocument(o){return Z_(o).document}}})(),J_=class{constructor(t,e,i,s){this._node=t,this._type=e,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Fr(t,e,i,s){return new J_(t,e,i,s)}var Q_={BEFORE_UNLOAD:"beforeunload"},ef=class extends at{constructor(t,e,i,s,r,n,o,l,h){super(),this._terminal=t,this._characterJoinerService=e,this._charSizeService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._optionsService=o,this._themeService=l,this._cursorBlinkStateManager=new wi,this._charAtlasDisposable=this._register(new wi),this._observerDisposable=this._register(new wi),this._model=new A_,this._workCell=new uo,this._workCell2=new uo,this._rectangleRenderer=this._register(new wi),this._glyphRenderer=this._register(new wi),this._onChangeTextureAtlas=this._register(new re),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new re),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new re),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new re),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new re),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let a={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",a),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Yu(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new $_(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=qu(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Fr(this._canvas,"webglcontextlost",c=>{console.log("webglcontextlost event received"),c.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(c)},3e3)})),this._register(Fr(this._canvas,"webglcontextrestored",c=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,ho(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=co(this._canvas,this._coreBrowserService.window,(c,d)=>this._setCanvasDevicePixelDimensions(c,d)),this._register(this._coreBrowserService.onWindowChange(c=>{this._observerDisposable.value=co(this._canvas,c,(d,u)=>this._setCanvasDevicePixelDimensions(d,u))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Ne(()=>{var c;for(let d of this._renderLayers)d.dispose();(c=this._canvas.parentElement)==null||c.removeChild(this._canvas),ho(this._terminal)}))}get textureAtlas(){var t;return(t=this._charAtlas)==null?void 0:t.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(t,e){var i,s,r,n;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let o of this._renderLayers)o.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`,(i=this._rectangleRenderer.value)==null||i.setDimensions(this.dimensions),(s=this._rectangleRenderer.value)==null||s.handleResize(),(r=this._glyphRenderer.value)==null||r.setDimensions(this.dimensions),(n=this._glyphRenderer.value)==null||n.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var t;for(let e of this._renderLayers)e.handleBlur(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.pause(),this._requestRedrawViewport()}handleFocus(){var t;for(let e of this._renderLayers)e.handleFocus(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,e,i){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,t,e,i);this._model.selection.update(this._core,t,e,i),this._requestRedrawViewport()}handleCursorMove(){var t;for(let e of this._renderLayers)e.handleCursorMove(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new O_(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new R_(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var e;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=il(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._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=Na(kt.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),kt.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),(e=this._glyphRenderer.value)==null||e.setAtlas(this._charAtlas)}_clearModel(t){var e;this._model.clear(),t&&((e=this._glyphRenderer.value)==null||e.clear())}clearTextureAtlas(){var t;(t=this._charAtlas)==null||t.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var t;this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,e){var i;if(!this._isAttached)if((i=this._core.screenElement)!=null&&i.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,t,e);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,e),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 b_(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,e){let i=this._core,s=this._workCell,r,n,o,l,h,a,c=0,d=!0,u,_,f,p,w,C,k,L,g;t=Lo(t,i.rows-1,0),e=Lo(e,i.rows-1,0);let E=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",T=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,O=T-i.buffer.ydisp,$=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),G=-1,X=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let N=!1;for(n=t;n<=e;n++)for(o=n+i.buffer.ydisp,l=i.buffer.lines.get(o),this._model.lineLengths[n]=0,f=T===o,c=0,h=this._characterJoinerService.getJoinedCharacters(o),L=0;L<i.cols;L++){if(r=this._cellColorResolver.result.bg,l.loadCell(L,s),L===0&&(r=this._cellColorResolver.result.bg),a=!1,d=L>=c,u=L,h.length>0&&L===h[0][0]&&d){_=h.shift();let m=this._model.selection.isCellSelected(this._terminal,_[0],o);for(k=_[0]+1;k<_[1];k++)d&&(d=m===this._model.selection.isCellSelected(this._terminal,k,o));d&&(d=!f||$<_[0]||$>=_[1]),d?(a=!0,s=new tf(s,l.translateToString(!0,_[0],_[1]),_[1]-_[0]),u=_[1]-1):c=_[1]}if(p=s.getChars(),w=s.getCode(),k=(n*i.cols+L)*gs,this._cellColorResolver.resolve(s,L,o,this.dimensions.device.cell.width),X&&o===T&&(L===$&&(this._model.cursor={x:$,y:O,width:s.getWidth(),style:this._coreBrowserService.isFocused?E:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},G=$+s.getWidth()-1),L>=$&&L<=G&&(this._coreBrowserService.isFocused&&E==="block"||this._coreBrowserService.isFocused===!1&&i.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)),w!==0&&(this._model.lineLengths[n]=L+1),!(this._model.cells[k]===w&&this._model.cells[k+ns]===this._cellColorResolver.result.bg&&this._model.cells[k+os]===this._cellColorResolver.result.fg&&this._model.cells[k+zs]===this._cellColorResolver.result.ext)&&(N=!0,p.length>1&&(w|=T_),this._model.cells[k]=w,this._model.cells[k+ns]=this._cellColorResolver.result.bg,this._model.cells[k+os]=this._cellColorResolver.result.fg,this._model.cells[k+zs]=this._cellColorResolver.result.ext,C=s.getWidth(),this._glyphRenderer.value.updateCell(L,n,w,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,p,C,r),a)){for(s=this._workCell,L++;L<=u;L++)g=(n*i.cols+L)*gs,this._glyphRenderer.value.updateCell(L,n,0,0,0,0,$u,0,0),this._model.cells[g]=0,this._model.cells[g+ns]=this._cellColorResolver.result.bg,this._model.cells[g+os]=this._cellColorResolver.result.fg,this._model.cells[g+zs]=this._cellColorResolver.result.ext;L--}}N&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_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(t,e){this._canvas.width===t&&this._canvas.height===e||(this._canvas.width=t,this._canvas.height=e,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},tf=class extends ni{constructor(t,e,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=e,this._width=i}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 Lo(t,e,i=0){return Math.max(Math.min(t,e),i)}var Eo="di$target",Ro="di$dependencies",Vs=new Map;function vt(t){if(Vs.has(t))return Vs.get(t);let e=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");sf(e,i,r)};return e._id=t,Vs.set(t,e),e}function sf(t,e,i){e[Eo]===e?e[Ro].push({id:t,index:i}):(e[Ro]=[{id:t,index:i}],e[Eo]=e)}vt("BufferService");vt("CoreMouseService");vt("CoreService");vt("CharsetService");vt("InstantiationService");vt("LogService");var rf=vt("OptionsService");vt("OscLinkService");vt("UnicodeService");vt("DecorationService");var nf={trace:0,debug:1,info:2,warn:3,error:4,off:5},of="xterm.js: ",Mo=class extends at{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=nf[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let e=0;e<t.length;e++)typeof t[e]=="function"&&(t[e]=t[e]())}_log(t,e,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":of)+e,...i)}trace(t,...e){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,t,e)}debug(t,...e){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,t,e)}info(t,...e){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,t,e)}warn(t,...e){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,t,e)}error(t,...e){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,t,e)}};Mo=Lu([Eu(0,rf)],Mo);var af=class extends at{constructor(t){if(Ha&&Fu()<16){let e={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",e))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=t,this._onChangeTextureAtlas=this._register(new re),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new re),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new re),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new re),this.onContextLoss=this._onContextLoss.event}activate(t){let e=t._core;if(!t.element){this._register(e.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let i=e.coreService,s=e.optionsService,r=e,n=r._renderService,o=r._characterJoinerService,l=r._charSizeService,h=r._coreBrowserService,a=r._decorationService;r._logService;let c=r._themeService;this._renderer=this._register(new ef(t,o,l,h,i,a,s,c,this._preserveDrawingBuffer)),this._register(kt.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(kt.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(kt.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(kt.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(Ne(()=>{if(this._terminal._core._store._isDisposed)return;let d=this._terminal._core._renderService;d.setRenderer(this._terminal._core._createRenderer()),d.handleResize(t.cols,t.rows)}))}get textureAtlas(){var t;return(t=this._renderer)==null?void 0:t.textureAtlas}clearTextureAtlas(){var t;(t=this._renderer)==null||t.clearTextureAtlas()}};/**
|
|
113
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
114
|
+
* @license MIT
|
|
115
|
+
*
|
|
116
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
117
|
+
* @license MIT
|
|
118
|
+
*
|
|
119
|
+
* Originally forked from (with the author's permission):
|
|
120
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
121
|
+
* http://bellard.org/jslinux/
|
|
122
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
123
|
+
*/var lf=class{constructor(t,e,i,s={}){this._terminal=t,this._regex=e,this._handler=i,this._options=s}provideLinks(t,e){let i=cf.computeLink(t,this._regex,this._terminal,this._handler);e(this._addCallbacks(i))}_addCallbacks(t){return t.map(e=>(e.leave=this._options.leave,e.hover=(i,s)=>{if(this._options.hover){let{range:r}=e;this._options.hover(i,s,r)}},e))}};function hf(t){try{let e=new URL(t),i=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return t.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var cf=class ls{static computeLink(e,i,s,r){let n=new RegExp(i.source,(i.flags||"")+"g"),[o,l]=ls._getWindowedLineStrings(e-1,s),h=o.join(""),a,c=[];for(;a=n.exec(h);){let d=a[0];if(!hf(d))continue;let[u,_]=ls._mapStrIdx(s,l,0,a.index),[f,p]=ls._mapStrIdx(s,u,_,d.length);if(u===-1||_===-1||f===-1||p===-1)continue;let w={start:{x:_+1,y:u+1},end:{x:p,y:f+1}};c.push({range:w,text:d,activate:r})}return c}static _getWindowedLineStrings(e,i){let s,r=e,n=e,o=0,l="",h=[];if(s=i.buffer.active.getLine(e)){let a=s.translateToString(!0);if(s.isWrapped&&a[0]!==" "){for(o=0;(s=i.buffer.active.getLine(--r))&&o<2048&&(l=s.translateToString(!0),o+=l.length,h.push(l),!(!s.isWrapped||l.indexOf(" ")!==-1)););h.reverse()}for(h.push(a),o=0;(s=i.buffer.active.getLine(++n))&&s.isWrapped&&o<2048&&(l=s.translateToString(!0),o+=l.length,h.push(l),l.indexOf(" ")===-1););}return[h,r]}static _mapStrIdx(e,i,s,r){let n=e.buffer.active,o=n.getNullCell(),l=s;for(;r;){let h=n.getLine(i);if(!h)return[-1,-1];for(let a=l;a<h.length;++a){h.getCell(a,o);let c=o.getChars();if(o.getWidth()&&(r-=c.length||1,a===h.length-1&&c==="")){let d=n.getLine(i+1);d&&d.isWrapped&&(d.getCell(0,o),o.getWidth()===2&&(r+=1))}if(r<0)return[i,a]}i++,l=0}return[i,l]}},df=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function uf(t,e){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}var _f=class{constructor(t=uf,e={}){this._handler=t,this._options=e}activate(t){this._terminal=t;let e=this._options,i=e.urlRegex||df;this._linkProvider=this._terminal.registerLinkProvider(new lf(this._terminal,i,this._handler,e))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};function ff(t){/^https?:\/\//i.test(t)&&window.open(t,"_blank","noopener,noreferrer")}function gf(){return new _f((t,e)=>ff(e))}const pf={background:"#1a1a1a",foreground:"#f5f0eb",cursor:"#f5f0eb",cursorAccent:"#1a1a1a",selectionBackground:"#6b5e5680",black:"#1a1a1a",red:"#F87171",green:"#34D399",yellow:"#FBBF24",blue:"#60A5FA",magenta:"#A78BFA",cyan:"#22D3EE",white:"#e5e0d8",brightBlack:"#9ca3af",brightRed:"#FCA5A5",brightGreen:"#6EE7B7",brightYellow:"#FCD34D",brightBlue:"#93C5FD",brightMagenta:"#C4B5FD",brightCyan:"#67E8F9",brightWhite:"#ffffff"},vf={background:"#ffffff",foreground:"#333333",cursor:"#333333",cursorAccent:"#ffffff",selectionBackground:"#add6ff80",black:"#000000",red:"#cd3131",green:"#107c10",yellow:"#949800",blue:"#0451a5",magenta:"#bc05bc",cyan:"#0598bc",white:"#555555",brightBlack:"#666666",brightRed:"#cd3131",brightGreen:"#1a991a",brightYellow:"#b58900",brightBlue:"#2472c8",brightMagenta:"#b510b5",brightCyan:"#0b8ba8",brightWhite:"#a5a5a5"};function mf(t){return t==="light"?vf:pf}function Sf(t,e){if(typeof document>"u")return e;const i=getComputedStyle(document.body).getPropertyValue(t).trim();return i.length>0?i:e}function hl(t="dark"){const e=mf(t),i=(s,r)=>t==="dark"?Sf(s,r):r;return{background:e.background,foreground:e.foreground,cursor:e.cursor,cursorAccent:e.cursorAccent,selectionBackground:e.selectionBackground,black:e.black,red:e.red,green:e.green,yellow:e.yellow,blue:e.blue,magenta:e.magenta,cyan:e.cyan,white:e.white,brightBlack:e.brightBlack,brightRed:i("--color-error",e.brightRed),brightGreen:i("--color-success",e.brightGreen),brightYellow:i("--color-warning",e.brightYellow),brightBlue:i("--color-info",e.brightBlue),brightMagenta:i("--color-purple",e.brightMagenta),brightCyan:e.brightCyan,brightWhite:e.brightWhite}}function wf(t="dark"){return{convertEol:!1,cursorBlink:!0,fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:13,theme:hl(t),scrollback:1e4,allowProposedApi:!0,rescaleOverlappingGlyphs:!0,rightClickSelectsWord:!0,macOptionClickForcesSelection:!0,wordSeparator:" ()[]{}',\"`|;:!?"}}const Bo="__embeddedTerminalAtlasRepaints";function bf(t,e,i=queueMicrotask){let s=!1,r=!1;const n=()=>{if(s){r=!1;return}try{if(e.clearTextureAtlas(),typeof window<"u"){const h=window;h[Bo]=(h[Bo]??0)+1}}catch(h){console.debug("[atlas-heal] clearTextureAtlas skipped (term unavailable)",h)}finally{r=!1}},o=()=>{r||s||(r=!0,i(n))},l=[t.onChangeTextureAtlas(o),t.onRemoveTextureAtlasCanvas(o)];return{heal:o,dispose:()=>{s=!0;for(const h of l)try{h.dispose()}catch{}}}}function yf(t){try{const e=t._core,i=e==null?void 0:e._renderService;if(i){const s={css:{cell:{width:0,height:0},canvas:{width:0,height:0}},device:{cell:{width:0,height:0},canvas:{width:0,height:0}}};Object.defineProperty(i,"dimensions",{configurable:!0,get:()=>s})}}catch{}}function Cf(t,e="dark",i=ul()){const s=new yu(wf(e)),r=new ku,n=gf();s.loadAddon(r),s.loadAddon(n),console.info(`[EmbeddedTerminal] renderer=${i}`);let o,l,h=!1,a=!1;if(i==="webgl")try{const d=new af;d.onContextLoss(()=>{a=!0,h=!1,o==null||o(),o=void 0;try{d.dispose()}catch{}});const u=bf(d,s);o=u.dispose,s.loadAddon(d),h=!a,l=()=>{h&&u.heal()}}catch(d){o==null||o(),o=void 0,l=void 0,console.warn("[EmbeddedTerminal] WebGL renderer unavailable — falling back to Canvas/DOM:",d instanceof Error?d.message:String(d))}s.open(t);try{r.fit()}catch{}return{term:s,fit:r,dispose:()=>{o==null||o(),yf(s),s.dispose()},healAtlas:l}}async function xf(){try{return await _l("/api/terminal/claude-theme")}catch{return{theme:null}}}function kf(){var t;return typeof window<"u"&&!!((t=window.matchMedia)!=null&&t.call(window,"(prefers-color-scheme: dark)").matches)}function $r(){return fl({pref:pl(),claudeTheme:gl(),systemPrefersDark:kf()})}function Lf(t,e){t.options.theme=hl(e);try{t.refresh(0,t.rows-1)}catch{}}function Ef(t,e){const i=x.useRef($r());x.useEffect(()=>{var d,u;let s=!1;const r=()=>{const _=t.current;if(!_||e.current)return;const f=$r();f!==i.current&&(i.current=f,Lf(_,f))},n=()=>{xf().then(({theme:_})=>{s||(vl(_),r())})};n();const o=()=>r(),l=_=>{(_.key===null||_.key.startsWith("shipwright.terminal."))&&r()};window.addEventListener(rn,o),window.addEventListener("storage",l);const h=(d=window.matchMedia)==null?void 0:d.call(window,"(prefers-color-scheme: dark)"),a=()=>r();(u=h==null?void 0:h.addEventListener)==null||u.call(h,"change",a);const c=()=>{document.visibilityState==="visible"&&n()};return document.addEventListener("visibilitychange",c),()=>{var _;s=!0,window.removeEventListener(rn,o),window.removeEventListener("storage",l),(_=h==null?void 0:h.removeEventListener)==null||_.call(h,"change",a),document.removeEventListener("visibilitychange",c)}},[t,e])}function Rf(t){const{taskId:e,containerRef:i,termRef:s,disposedRef:r,onGitignoreSuggestion:n,onPasteImageError:o}=t,l=x.useRef(n),h=x.useRef(o);x.useEffect(()=>{l.current=n},[n]),x.useEffect(()=>{h.current=o},[o]);const a=x.useCallback(async(u,_)=>{var w,C,k;const f=new FormData;f.append("image",u,_);const p=`/api/terminal/${encodeURIComponent(e)}/paste-image`;try{const L=await fetch(p,{method:"POST",body:f});if(!L.ok){let E=`HTTP ${L.status}`;try{const T=await L.json().catch(()=>null);T!=null&&T.error&&(E=T.error)}catch{}(w=h.current)==null||w.call(h,E);return}const g=await L.json().catch(()=>null);g!=null&&g.gitignoreSuggestion&&((C=l.current)==null||C.call(l))}catch(L){(k=h.current)==null||k.call(h,L instanceof Error?L.message:String(L))}},[e]);x.useEffect(()=>{const u=i.current;if(!u)return;const _=f=>{var k,L,g;const p=f.target;if(!p||!u.contains(p))return;const w=(k=f.clipboardData)==null?void 0:k.items;if(!w||w.length===0)return;for(let E=0;E<w.length;E++){const T=w[E];if(T.kind==="file"&&T.type.startsWith("image/")){f.preventDefault(),f.stopPropagation();const O=T.getAsFile();if(!O)return;a(O,`paste-${Date.now()}.png`);return}}if(Array.from(w).some(E=>E.kind==="string"&&E.type==="text/plain")){f.preventDefault(),f.stopPropagation();const E=((L=f.clipboardData)==null?void 0:L.getData("text/plain"))??"";E&&!r.current&&((g=s.current)==null||g.paste(E))}};return document.addEventListener("paste",_,{capture:!0}),()=>{document.removeEventListener("paste",_,{capture:!0})}},[a]);const c=x.useRef(a);return c.current=a,{uploadImage:x.useCallback(u=>{c.current(u,`paste-${Date.now()}.png`)},[])}}function ai(t,e,i){var s,r,n,o;if(i||!t||!e)return!1;try{const l=e._core;if(l!=null&&l._renderService){const h=l._renderService.dimensions,a=((r=(s=h==null?void 0:h.css)==null?void 0:s.cell)==null?void 0:r.width)??0,c=((o=(n=h==null?void 0:h.css)==null?void 0:n.cell)==null?void 0:o.height)??0;if(!h||a===0||c===0)return!1}return t.fit(),!0}catch{return!1}}const Mf=[130,350];function Bf(t,e,i={}){const s=i.setTimer??((a,c)=>setTimeout(a,c)),r=i.clearTimer??(a=>clearTimeout(a));let n=[];const o=()=>{for(const a of n)r(a);n=[]},l=()=>{var a,c;try{(c=(a=i.getHealAtlas)==null?void 0:a.call(i))==null||c()}catch{}};return{schedule:()=>{if(o(),!e())for(const a of Mf)n.push(s(()=>{if(e())return;const c=t();if(c){try{c.refresh(0,c.rows-1)}catch{}l()}},a))},clear:o}}const Tf=5,Af=2;function si(t){return t.cols>=Tf&&t.rows>=Af}function Bi(t){const{width:e,height:i}=t.getBoundingClientRect();return e>0&&i>0}const To=250;function Df(t){const{containerRef:e,termRef:i,fitAddonRef:s,disposedRef:r,socketSend:n,active:o,layoutRevision:l,settleArmRef:h,atlasHealRef:a}=t,c=x.useRef(n);x.useEffect(()=>{c.current=n},[n]);const d=x.useRef(0),u=x.useRef(null),_=x.useRef({cols:-1,rows:-1}),f=C=>{if(!si(C))return;const{cols:k,rows:L}=C;k===_.current.cols&&L===_.current.rows||(_.current={cols:k,rows:L},c.current({type:"resize",cols:k,rows:L}))},p=x.useRef(o);x.useEffect(()=>{p.current=o},[o]);const w=x.useRef(null);w.current===null&&(w.current=Bf(()=>i.current,()=>r.current,{getHealAtlas:()=>p.current?a==null?void 0:a.current:null})),x.useEffect(()=>()=>{var C;return(C=w.current)==null?void 0:C.clear()},[]),x.useEffect(()=>{const C=e.current;if(!C)return;const k=()=>{if(!p.current||!Bi(C))return;const g=s.current,E=i.current;!g||!E||ai(g,E,r.current)&&f(E)},L=new ResizeObserver(()=>{if(r.current)return;const g=Date.now();g-d.current>=To?(d.current=g,k()):u.current||(u.current=setTimeout(()=>{u.current=null,!r.current&&(d.current=Date.now(),k())},To))});return L.observe(C),()=>{L.disconnect(),u.current&&(clearTimeout(u.current),u.current=null)}},[]),x.useEffect(()=>{var $,G;if(!o)return;const C=s.current,k=i.current;if(!C||!k)return;const L=e.current,g=L!==null&&Bi(L)&&ai(C,k,r.current);if(g&&si(k))try{k.refresh(0,k.rows-1)}catch{}g&&si(k)&&(($=h==null?void 0:h.current)==null||$.call(h));const E=g&&si(k);E&&((G=w.current)==null||G.schedule());let T=null,O=requestAnimationFrame(()=>{O=null,T=requestAnimationFrame(()=>{var v,S;if(T=null,r.current||!p.current)return;const X=s.current,N=i.current,m=e.current;if(!(!X||!N)&&!(!m||!Bi(m))&&ai(X,N,r.current)&&si(N)){if(!E){try{N.refresh(0,N.rows-1)}catch{}(v=h==null?void 0:h.current)==null||v.call(h),(S=w.current)==null||S.schedule()}f(N)}})});return()=>{O!==null&&cancelAnimationFrame(O),T!==null&&cancelAnimationFrame(T)}},[o,l]),x.useEffect(()=>{const C=()=>{var E,T;if(r.current||!p.current||typeof document<"u"&&document.hidden)return;const k=e.current;if(!k||!Bi(k))return;const L=s.current,g=i.current;if(!(!L||!g)){ai(L,g,r.current);try{g.refresh(0,g.rows-1)}catch{}(E=h==null?void 0:h.current)==null||E.call(h),(T=w.current)==null||T.schedule(),f(g)}};return window.addEventListener("focus",C),window.addEventListener("pageshow",C),document.addEventListener("visibilitychange",C),()=>{window.removeEventListener("focus",C),window.removeEventListener("pageshow",C),document.removeEventListener("visibilitychange",C)}},[])}const Pf=8*1024*1024,Ao=t=>new TextEncoder().encode(t).length;class If{constructor(e=Pf){bs(this,"chunks",[]);bs(this,"bytes",0);this.maxBytes=e}push(e){this.chunks.push(e),this.bytes+=Ao(e);let i=!1;for(;this.bytes>this.maxBytes&&this.chunks.length>1;){const s=this.chunks.shift();if(s===void 0)break;this.bytes-=Ao(s),i=!0}return i}takeAll(){const e=this.chunks.join("");return this.clear(),e}clear(){this.chunks=[],this.bytes=0}get byteLength(){return this.bytes}get length(){return this.chunks.length}}const Of=5e3;function Ff(t,e,i,s){const r=x.useRef(i);r.current=i;const n=x.useRef(s);n.current=s;const o=x.useRef(null),l=x.useRef(null),h=x.useRef(!1),a=x.useRef(new If),c=x.useRef(0),d=x.useRef(null),u=x.useRef(!1),_=x.useRef(0),f=x.useCallback(()=>{d.current!==null&&(clearTimeout(d.current),d.current=null)},[]),p=x.useCallback(()=>{f(),h.current=!1,a.current.clear(),o.current=null,c.current+=1},[f]),w=x.useCallback((g,E)=>{var $,G;if(c.current!==g)return;c.current+=1,f(),h.current=!1;const T=o.current;if(o.current=null,T&&!e.current&&t.current===E){($=l.current)==null||$.call(l,T,!0);return}const O=a.current.takeAll();if(!(e.current||t.current!==E)){try{O.length>0&&E.write(O),E.scrollToBottom(),E.refresh(0,E.rows-1)}catch(X){console.warn(`[terminal] replay drain failed: ${X.message}`)}(G=r.current)==null||G.call(r)}},[f,e,t]),C=x.useCallback(g=>{var E,T;if(u.current||(u.current=!0),_.current=Date.now(),h.current){a.current.push(g)&&((E=n.current)==null||E.call(n));return}(T=t.current)==null||T.write(g)},[t]),k=x.useCallback((g,E=!1)=>{const T=t.current;if(!T)return;try{const $=g.terminalVersion.split(".")[0];$&&$!=="6"&&console.warn(`[terminal] replay_snapshot served by xterm major ${$}; client xterm.js is major 6 — visual artifacts possible`)}catch{}c.current+=1;const O=c.current;f(),E||a.current.clear(),h.current=!0,d.current=setTimeout(()=>{d.current=null,w(O,T)},Of);try{try{T.reset()}catch{}if(g.cols>0&&g.cols!==T.cols||g.rows>0&&g.rows!==T.rows)try{T.resize(g.cols,g.rows)}catch{}T.write(g.data,()=>{w(O,T)})}catch($){p(),console.warn(`[terminal] replay_snapshot write failed: ${$.message}`)}},[f,p,w,t]);l.current=k;const L=x.useCallback(g=>{if(h.current){o.current=g,a.current.clear();return}k(g)},[k]);return x.useMemo(()=>({dataSeenInitiallyRef:u,lastPtyDataAtRef:_,onDataChunk:C,onReplaySnapshot:L,resetGate:p}),[C,L,p])}const $f=400;function Nf(t){const{send:e,onBackpressure:i,debounceMs:s=$f}=t,r=x.useRef(e);r.current=e;const n=x.useRef(i);n.current=i;const o=x.useRef(null),l=x.useCallback(()=>{o.current===null&&(o.current=setTimeout(()=>{o.current=null,r.current({type:"resync"})},s))},[s]),h=x.useCallback(a=>{var u,_;if(!(a.droppedBytes>0||a.totalDroppedBytes>0)){(u=n.current)==null||u.call(n,a);return}const d=a.episode===0&&a.droppedChunks===0;(a.episodeEnded||d)&&l(),(_=n.current)==null||_.call(n,a)},[l]);return x.useEffect(()=>()=>{o.current!==null&&(clearTimeout(o.current),o.current=null)},[]),{onBackpressure:h,requestResync:l}}function Wf(t){const{containerRef:e,termRef:i,fitAddonRef:s,disposedRef:r,socketSend:n,role:o,active:l}=t,h=x.useCallback(()=>{const d=e.current,u=i.current,_=s.current;return!l||!d||!Bi(d)||!u||!_?!1:ai(_,u,r.current)&&si(u)?(n({type:"resize",cols:u.cols,rows:u.rows}),!0):!1},[l,e,i,s,r,n]),a=x.useRef(o);a.current=o;const c=x.useCallback(()=>{a.current==="writer"&&(h(),n({type:"redraw"}))},[h,n]);return{syncSizeNow:h,onReplaySettled:c}}const zf=250,Hf=1500,Uf=15e3,Do=50;function Kf(t){const{taskId:e,taskState:i,socket:s,coord:r,gate:n,onBeforeDispatch:o,dispatchReady:l=!0}=t,h=x.useRef(o);h.current=o;const a=x.useRef(new Set),c=x.useRef(!1),d=x.useRef(!1),u=x.useRef(!1),[_,f]=x.useState(null);x.useEffect(()=>{a.current=new Set,c.current=!1,d.current=!1,u.current=!1,f(null),n.dataSeenInitiallyRef.current=!1,n.lastPtyDataAtRef.current=0},[e]),x.useEffect(()=>{s.ready&&s.replayOnly!==!0&&(u.current||(u.current=!0,s.ptyReused===!0&&(d.current=!0)))},[s.ready,s.ptyReused,s.replayOnly]),x.useEffect(()=>{s.terminalReset===!0&&(d.current=!1,f(null),n.dataSeenInitiallyRef.current=!1,n.lastPtyDataAtRef.current=0)},[s.terminalReset]);const p=x.useRef(i);x.useEffect(()=>{const g=p.current;p.current=i,(g==="done"||g==="launch_failed")&&!(i==="done"||i==="launch_failed")&&(d.current=!1,u.current=!1,f(null))},[i]),x.useEffect(()=>{const g=r.pendingLaunch;if(!g||a.current.has(g.launchToken)||c.current||!s.ready||s.role!=="writer"||!s.shellKind||!l||g.expiresAt<=Date.now())return;if(d.current){a.current.add(g.launchToken),f({commands:g.commands}),r.consumeLaunch(g.launchToken);return}let E=!1;return c.current=!0,(async()=>{var G;const T=Date.now();let O=!1;for(;!E&&Date.now()-T<Uf;){const X=Date.now()-T;if(n.dataSeenInitiallyRef.current&&Date.now()-n.lastPtyDataAtRef.current>=zf){O=!0;break}if(!n.dataSeenInitiallyRef.current&&X>=Hf){O=!0;break}await new Promise(N=>setTimeout(N,Do))}if(E)return;if(!O){a.current.add(g.launchToken),r.cancelLaunch("timeout");return}if(a.current.has(g.launchToken)||!s.ready||s.role!=="writer"||!s.shellKind)return;if(g.expiresAt<=Date.now()){a.current.add(g.launchToken),r.cancelLaunch("timeout");return}for(;!E&&((G=h.current)==null?void 0:G.call(h))===!1;){if(g.expiresAt<=Date.now()){a.current.add(g.launchToken),r.cancelLaunch("timeout");return}await new Promise(X=>setTimeout(X,Do))}if(E)return;const $=Ji(g.commands,s.shellKind);a.current.add(g.launchToken),s.send({type:"data",payload:$+"\r"}),d.current=!0,r.consumeLaunch(g.launchToken)})().finally(()=>{c.current=!1}),()=>{E=!0}},[r,s.ready,s.role,s.shellKind,r.pendingLaunch,l,n.dataSeenInitiallyRef,n.lastPtyDataAtRef]);const w=x.useCallback(()=>{var T;const g=_;if(!g||!s.ready||s.role!=="writer"||!s.shellKind)return;const E=Ji(g.commands,s.shellKind);((T=h.current)==null?void 0:T.call(h))!==!1&&(s.send({type:"data",payload:E+"\r"}),f(null))},[_,s.ready,s.role,s.shellKind,s.send]),C=x.useCallback(()=>{f(null)},[]),k=r.pendingLaunch&&s.shellKind?Ji(r.pendingLaunch.commands,s.shellKind):null;return{manualSendCommand:_&&s.shellKind?Ji(_.commands,s.shellKind):null,previewCommand:k,handleManualSend:w,dismissManualSend:C}}function Ji(t,e){return e==="pwsh"?t.powershell:e==="cmd"?t.cmd:t.posix}const qf={"copy-failed":"Copy failed","paste-hint":"Keyboard paste needs HTTPS or localhost — use right-click → Paste","paste-failed":"Paste failed — clipboard permission denied","link-not-in-session":"Not part of this session"},Vf={"copy-failed":8e3,"paste-hint":8e3,"paste-failed":8e3,"link-not-in-session":4e3},Yf={"copy-failed":"border-red-800 bg-[#2a1416] text-red-300","paste-hint":"border-sky-800 bg-[#0f1d2e] text-sky-300","paste-failed":"border-red-800 bg-[#2a1416] text-red-300","link-not-in-session":"border-[var(--color-line-strong)] bg-[var(--color-card)] text-[var(--color-text)]"};function jf(t){const{reconnecting:e,reconnectStalled:i,readOnly:s,showResetBanner:r,resetScrollbackBytes:n,onDismissResetBanner:o,replayOnly:l,previewCommand:h,manualSendCommand:a,onManualSend:c,onDismissManualSend:d,clipboardNotice:u,onDismissClipboardNotice:_}=t;return J.jsxs(J.Fragment,{children:[e||i?J.jsx("div",{className:"-mx-2 -mt-2 mb-2 border-b border-[var(--color-border,#e0dbd4)] bg-[var(--color-warning-bg,#fff7ed)] px-3 py-1 text-[11px] text-[var(--color-warning,#9a3412)]","data-testid":"embedded-terminal-reconnecting","data-stalled":i?"true":"false",role:"status",children:i?"Connection lost — still retrying, less often now. The server may be unreachable, or this task's folder may no longer exist.":"Connection lost — reconnecting… The terminal keeps retrying on its own; reloading the page is not needed."}):null,s?J.jsx("div",{className:"-mx-2 -mt-2 mb-2 border-b border-[var(--color-border,#e0dbd4)] bg-[var(--color-warning-bg,#fff7ed)] px-3 py-1 text-[11px] text-[var(--color-warning,#9a3412)]","data-testid":"embedded-terminal-readonly",children:"Read-only — another tab is the active writer for this task."}):null,r?J.jsxs("div",{className:"-mx-2 -mt-2 mb-2 flex items-start justify-between gap-2 border-b border-[var(--color-border,#e0dbd4)] bg-[var(--color-warning-bg,#fff7ed)] px-3 py-1 text-[11px] text-[var(--color-warning,#9a3412)]","data-testid":"embedded-terminal-reset",children:[J.jsxs("div",{className:"flex flex-col gap-0.5",children:[J.jsxs("span",{children:["Terminal was reset — the previous Claude session was interrupted (the server may have restarted). Click ",J.jsx("strong",{children:"Resume"})," to continue."]}),n!==null&&n>0?J.jsx("span",{"data-testid":"embedded-terminal-reset-dataloss",children:"Resume rebuilds from Claude's saved transcript — content shown before the interruption that wasn't yet saved may not return. Your last terminal screen is kept in this task's scrollback."}):null]}),J.jsx("button",{type:"button",onClick:o,className:"shrink-0 rounded px-1 leading-none text-[var(--color-warning,#9a3412)] hover:bg-black/5","data-testid":"embedded-terminal-reset-dismiss","aria-label":"Dismiss",children:"✕"})]}):null,l?J.jsx("div",{className:"-mx-2 -mt-2 mb-2 border-b border-[var(--color-border,#e0dbd4)] bg-[var(--color-muted-bg,#ede8e1)] px-3 py-1 text-[11px] text-[var(--color-muted,#6b7280)]","data-testid":"embedded-terminal-replay-only",children:"Session ended — viewing historical terminal scrollback only."}):null,h?J.jsxs("div",{className:"-mx-2 -mt-2 mb-2 max-h-24 shrink-0 overflow-y-auto border-b border-[var(--color-border,#e0dbd4)] bg-[var(--color-info-bg,#eff6ff)] px-3 py-1 font-mono text-[11px] text-[var(--color-info,#1d4ed8)]","data-testid":"embedded-terminal-launch-preview",children:[J.jsx("span",{className:"opacity-70","aria-hidden":!0,children:"About to run:"})," ",J.jsx("span",{className:"break-all",children:h})]}):null,a?J.jsxs("div",{className:"-mx-2 -mt-2 mb-2 flex max-h-32 shrink-0 flex-col gap-1 overflow-y-auto [&>*]:shrink-0 border-b border-[var(--color-border,#e0dbd4)] bg-[var(--color-warning-bg,#fff7ed)] px-3 py-1.5 text-[11px] text-[var(--color-warning,#9a3412)]","data-testid":"embedded-terminal-manual-send",children:[J.jsxs("div",{className:"flex items-start justify-between gap-2",children:[J.jsx("span",{children:"This terminal already has a session — auto-run is disabled so the command can't land inside a running Claude. Send it only when the shell is back at a prompt."}),J.jsx("button",{type:"button",onClick:d,className:"shrink-0 rounded px-1 leading-none hover:bg-black/5","data-testid":"embedded-terminal-manual-send-dismiss","aria-label":"Dismiss",children:"✕"})]}),J.jsxs("div",{className:"flex items-center gap-2",children:[J.jsx("span",{className:"min-w-0 flex-1 break-all font-mono opacity-80",children:a}),J.jsx("button",{type:"button",onClick:c,className:"shrink-0 rounded bg-[var(--color-warning,#9a3412)] px-2 py-0.5 font-semibold text-white transition hover:opacity-90","data-testid":"embedded-terminal-manual-send-button",children:"Send to terminal"})]})]}):null,u?J.jsxs("div",{className:`absolute bottom-3 right-3 z-10 flex max-w-[min(90%,28rem)] items-center gap-2 rounded border px-2.5 py-1 text-[11px] shadow-md ${Yf[u]}`,"data-testid":"embedded-terminal-clipboard-notice","data-notice-kind":u,children:[J.jsx("span",{children:qf[u]}),J.jsx("button",{type:"button",onClick:_,className:"shrink-0 rounded px-1 leading-none hover:bg-white/10","data-testid":"embedded-terminal-clipboard-notice-dismiss","aria-label":"Dismiss",children:"✕"})]}):null]})}function Gf(){const[t,e]=x.useState(null);x.useEffect(()=>{if(!t)return;const r=setTimeout(()=>e(null),Vf[t]);return()=>clearTimeout(r)},[t]);const i=x.useCallback(r=>{e(r)},[]),s=x.useCallback(()=>{e(null)},[]);return{clipboardNotice:t,notify:i,dismissClipboardNotice:s}}const Xf=new Set(["(","[","{","<",'"',"'","`","@","|","│","┃","║"]),Zf=new Set([".",",",";",":","!","?",")","]","}",">",'"',"'","`","|","│","┃","║"]),Jf=/^(.+?)\((\d+)(?:,\d+)?\)$/,Qf=/^[-\w.]+=(?=.)/,eg=/^(?:[A-Za-z]:[\\/]|[\\/]|\.{1,2}[\\/]|~[\\/])/,tg=1024,ig=4;function sg(t){const e=[],i=/\S+/g;let s=!1,r=0;for(let n=i.exec(t);n;n=i.exec(t)){if(n[0].length>tg){s=!1;continue}let o=n.index,l=n.index+n[0].length;const h=Qf.exec(n[0]);for(h&&(o+=h[0].length);o<l&&Xf.has(t[o]);)o++;let a=null;const c=t.slice(o,l).includes("(");for(;l>o&&(a=c&&t[l-1]===")"?Jf.exec(t.slice(o,l)):null,!(a||!Zf.has(t[l-1])));)l--;if(l<=o)continue;const d=t.slice(o,l),u=d.includes("://")||d.startsWith("~")?null:a?nn(a[1]):nn(d),_=s;eg.test(d)&&!d.includes("://")?(s=u===null,r=0):s&&(u!==null||!/[\\/]/.test(d)&&++r>ig)&&(s=!1),!(_||!u)&&e.push({start:o,end:l,ref:a?{path:u.path,line:Number(a[2])}:u})}return e}const Ys=20,rg=6,Ti=t=>t.chars.trim()==="",Po=t=>t.map(e=>e.chars).join("");function ng(t,e,i){const s=t.getLine(e);if(!s)return;const r=[];for(let n=0;n<i;n++){const o=s.getCell(n);if(!o)break;const l=o.getWidth();l!==0&&r.push({x:n,w:l,chars:o.getChars()})}return r}const og=/^(?:[A-Za-z]:[\\/]|[\\/]|\.{1,2}[\\/]|~)/,ag=/^[\w.\-\\/@+%~#:]+$/,lg=/\.[A-Za-z][A-Za-z0-9]{0,7}$/,hg=/[\w-]\.[A-Za-z][A-Za-z0-9]{0,7}$/;function cg(t,e){const i=t[t.length-1];if(!i||Ti(i))return!1;let s=t.length;for(;s>0&&!Ti(t[s-1]);)s--;const r=Po(t.slice(s));if(!/[\\/]/.test(r)||r.includes("://"))return!1;let n=0;for(;n<e.length&&Ti(e[n]);)n++;if(n>rg||n>=e.length)return!1;let o=n;for(;o<e.length&&!Ti(e[o]);)o++;const l=Po(e.slice(n,o)).replace(/[.,;:!?)\]}>"'`]+$/,"");return!l||l.includes("://")||og.test(l)||!ag.test(l)||hg.test(r)?!1:/[\\/]/.test(l)||lg.test(l)}function dg(t,e){const i=t.buffer.active,s=new Map,r=d=>(s.has(d)||s.set(d,ng(i,d,t.cols)),s.get(d)),n=(d,u)=>{var p;if(d<0||!r(u))return null;if((p=i.getLine(u))!=null&&p.isWrapped)return"soft";const _=r(d),f=r(u);return _&&f&&cg(_,f)?"hard":null};if(!r(e))return;let o=e,l=e;const h=new Map;for(let d=n(o-1,o);d&&l-o<Ys;d=n(o-1,o))h.set(o,d),o--;for(let d=n(l,l+1);d&&l-o<Ys;d=n(l,l+1))l++,h.set(l,d);l-o>=Ys&&(o=e,l=e,h.clear());let a="";const c=[];for(let d=o;d<=l;d++){const u=r(d);if(!u)break;let _=0;if(h.get(d)==="hard")for(;_<u.length&&Ti(u[_]);)_++;for(let f=_;f<u.length;f++){const{x:p,w,chars:C}=u[f],k=C||(d<l&&p===t.cols-1?"":" ");for(let L=0;L<k.length;L++)c.push({x:p,y:d+1,w});a+=k}}return{text:a,pos:c}}function ug(t){let e=null,i=!1;const s=n=>{e={x:n.clientX,y:n.clientY},i=!1},r=n=>{e&&(Math.abs(n.clientX-e.x)>4||Math.abs(n.clientY-e.y)>4)&&(i=!0)};return t==null||t.addEventListener("mousedown",s,!0),t==null||t.addEventListener("mousemove",r,!0),{isClick:n=>n.button!==0||n.detail>1?!1:t?e===null||i?!1:Math.abs(n.clientX-e.x)<=4&&Math.abs(n.clientY-e.y)<=4:!0,dispose:()=>{t==null||t.removeEventListener("mousedown",s,!0),t==null||t.removeEventListener("mousemove",r,!0)}}}function _g(t,e,i=()=>!0,s){return{provideLinks(r,n){const o=dg(t,r-1);if(!o)return n(void 0);const{text:l,pos:h}=o,a=[],c=[];for(const u of sg(l)){const _=h[u.start],f=h[u.end-1];!_||!f||r<_.y||r>f.y||(c.push({ref:u.ref}),a.push({range:{start:{x:_.x+1,y:_.y},end:{x:f.x+f.w,y:f.y}},text:l.slice(u.start,u.end),activate:p=>{!i(p)||t.hasSelection()||e(u.ref)}}))}if(!s||a.length===0)return n(a.length?a:void 0);const d=c.map(u=>u.ref);s(d).then(u=>{const _=a.filter((f,p)=>u[p]!==!1);n(_.length?_:void 0)},()=>n(a))}}}async function fg(t,e,i,s,r=()=>!0){if(!i||i.ready===!1)return;const n=zo(t,i.projectRoot,i.cwd??null);if(n){if(n.outside){const o=await wl(e,n.path);if(!r())return;if(o)return s("link-not-in-session")}i.open(n)}}async function gg(t,e,i,s=!1){return!i||i.ready===!1?t.map(()=>!0):Promise.all(t.map(async r=>{const n=zo(r,i.projectRoot,i.cwd??null);if(!n)return!0;if(s){const o=ml(e,n.path);return o||on(e,n.path),o!=="no"}return await on(e,n.path)!=="no"}))}function pg(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(Sl).matches}function vg(t,e,i,s){const r=x.useRef({taskId:e,fileOpen:i,notify:s});r.current={taskId:e,fileOpen:i,notify:s};const n=x.useRef(0);x.useEffect(()=>{n.current++},[e]),x.useEffect(()=>{const o=t.current;if(!o)return;const l=ug(o.element),h=o.registerLinkProvider(_g(o,a=>{const c=r.current,d=++n.current;fg(a,c.taskId,c.fileOpen,c.notify,()=>d===n.current&&r.current.taskId===c.taskId)},l.isClick,a=>{const c=r.current;return gg(a,c.taskId,c.fileOpen,pg())}));return()=>{n.current++,h.dispose(),l.dispose()}},[t])}const mg=1500,Sg=1500;function wg(t){const{socket:e,active:i,termRef:s,fitAddonRef:r,disposedRef:n,setReadOnlyArmed:o,setReconnectingArmed:l,onReadyChange:h,onTerminalMeta:a}=t,c=x.useRef(!1);x.useEffect(()=>{e.ready&&!c.current&&o(!1),c.current=e.ready},[e.ready,o]),x.useEffect(()=>{if(!e.ready||e.role!=="reader"){o(!1);return}const u=setTimeout(()=>o(!0),mg);return()=>clearTimeout(u)},[e.role,e.ready,o]),x.useEffect(()=>{if(!e.reconnecting){l(!1);return}const u=setTimeout(()=>l(!0),Sg);return()=>clearTimeout(u)},[e.reconnecting,l]);const d=x.useRef(!1);x.useEffect(()=>{if(!i){d.current=!1;return}if(!e.ready||d.current)return;d.current=!0;const u=setTimeout(()=>{if(n.current)return;const _=s.current,f=r.current;if(_&&f){ai(f,_,n.current);try{_.refresh(0,_.rows-1)}catch{}}try{_==null||_.focus()}catch{}},0);return()=>clearTimeout(u)},[i,e.ready]),x.useEffect(()=>{h==null||h(e.ready,e.role)},[e.ready,e.role,h]),x.useEffect(()=>{a==null||a({replayOnly:e.replayOnly,scrollbackBytes:e.scrollbackBytes,retentionDays:e.retentionDays,scrollbackDir:e.scrollbackDir})},[e.replayOnly,e.scrollbackBytes,e.retentionDays,e.scrollbackDir,a])}function bg(t,e){const[i,s]=x.useState(!1),[r,n]=x.useState(!1),[o,l]=x.useState(!1);x.useEffect(()=>{l(!1)},[t]);const h=x.useRef(e);return x.useEffect(()=>{const a=h.current;h.current=e,(a==="done"||a==="launch_failed")&&!(e==="done"||e==="launch_failed")&&l(!1)},[e]),{readOnlyArmed:i,setReadOnlyArmed:s,reconnectingArmed:r,setReconnectingArmed:n,resetBannerDismissed:o,setResetBannerDismissed:l}}function yg(t,e){const i=e?"O":"[";switch(t){case"esc":return"\x1B";case"tab":return" ";case"ctrlc":return"";case"enter":return"\r";case"up":return`\x1B${i}A`;case"down":return`\x1B${i}B`;case"right":return`\x1B${i}C`;case"left":return`\x1B${i}D`}}const Cg=[{id:"esc",label:"Esc",aria:"Escape"},{id:"tab",label:"Tab",aria:"Tab"},{id:"ctrlc",label:"⌃C",aria:"Control C"},{id:"left",label:"←",aria:"Arrow left"},{id:"up",label:"↑",aria:"Arrow up"},{id:"down",label:"↓",aria:"Arrow down"},{id:"right",label:"→",aria:"Arrow right"},{id:"enter",label:"⏎",aria:"Enter"}],js="flex h-11 min-w-[44px] shrink-0 items-center justify-center rounded-[6px] border border-white/80 px-3 text-[13px] font-medium text-white bg-white/10 active:bg-white/25 disabled:opacity-40 disabled:active:bg-white/10";function xg({onKey:t,onFocusTerminal:e,onPaste:i,disabled:s}){if(!bl())return null;const n=o=>o.preventDefault();return J.jsxs("div",{role:"toolbar","aria-label":"Terminal keys","data-testid":"terminal-key-bar",className:"flex shrink-0 items-center gap-1.5 overflow-x-auto border-t border-white/10 bg-[#222] px-2 py-2",children:[J.jsx("button",{type:"button","aria-label":"Show keyboard","data-testid":"terminal-key-keyboard",onPointerDown:n,onClick:e,className:js,children:"⌨"}),i&&J.jsx("button",{type:"button","aria-label":"Paste","data-testid":"terminal-key-paste",disabled:s,onPointerDown:n,onClick:i,className:js,children:"Paste"}),Cg.map(o=>J.jsx("button",{type:"button","aria-label":o.aria,"data-testid":`terminal-key-${o.id}`,disabled:s,onPointerDown:n,onClick:()=>t(o.id),className:js,children:o.label},o.id))]})}const Vp=x.forwardRef(function({taskId:e,active:i,taskState:s,layoutRevision:r,socketUrlOverride:n,socketEnabled:o=!0,onGitignoreSuggestion:l,onBackpressure:h,onReadyChange:a,onPasteImageError:c,onTerminalMeta:d,fileLinks:u},_){const f=x.useRef(null),p=x.useRef(null),w=x.useRef(null),C=x.useRef(!1),k=x.useRef(null),L=x.useRef(null),g=bg(e,s),{readOnlyArmed:E,resetBannerDismissed:T,setResetBannerDismissed:O}=g,$=Gf(),G=yl(),X=x.useRef(null),N=x.useCallback(()=>{var z;return(z=X.current)==null?void 0:z.call(X)},[]),m=x.useRef(null),v=Nf({send:z=>{var F;return(F=m.current)==null?void 0:F.call(m,z)},onBackpressure:h}),S=Ff(p,C,N,v.requestResync),b=Kl({taskId:e,urlOverride:n,enabled:o,sessionEnded:s===void 0?void 0:s==="done"||s==="launch_failed",onData:S.onDataChunk,onReplaySnapshot:S.onReplaySnapshot,onBackpressure:v.onBackpressure});m.current=b.send;const{syncSizeNow:R,onReplaySettled:A}=Wf({containerRef:f,termRef:p,fitAddonRef:w,disposedRef:C,socketSend:b.send,role:b.role,active:i});X.current=A;const{manualSendCommand:M,previewCommand:D,handleManualSend:H,dismissManualSend:Z}=Kf({taskId:e,taskState:s,socket:b,coord:G,gate:S,onBeforeDispatch:R,dispatchReady:i}),{uploadImage:U}=Rf({taskId:e,containerRef:f,termRef:p,disposedRef:C,onGitignoreSuggestion:l,onPasteImageError:c});Df({containerRef:f,termRef:p,fitAddonRef:w,disposedRef:C,socketSend:b.send,active:i,layoutRevision:r,settleArmRef:k,atlasHealRef:L}),wg({socket:b,active:i,termRef:p,fitAddonRef:w,disposedRef:C,setReadOnlyArmed:g.setReadOnlyArmed,setReconnectingArmed:g.setReconnectingArmed,onReadyChange:a,onTerminalMeta:d}),Ef(p,C);const ue=E&&b.role==="reader";x.useImperativeHandle(_,()=>({focus(){var z;(z=p.current)==null||z.focus()},get ready(){return b.ready},get role(){return b.role}}),[b.ready,b.role]),x.useEffect(()=>{const z=f.current;if(!z)return;const F=Cf(z,$r());p.current=F.term,w.current=F.fit,C.current=!1,window.__embeddedTerminal=F.term,F.term.attachCustomKeyEventHandler(Yl({term:F.term,isDisposed:()=>C.current,notify:$.notify,readClipboard:qo,readImage:Vl,uploadImage:U})),F.term.parser.registerOscHandler(52,Zl({copy:Se=>Cl(Se,{preserveFocus:!0}),isDisposed:()=>C.current,onError:()=>$.notify("copy-failed")}));const q=nh(F.term,z),Q=ch(F.term,z,()=>C.current,{getHealAtlas:()=>L.current}),Ce=_h(F.term,()=>C.current);k.current=Ce.arm,L.current=F.healAtlas??null;const Ve=F.term.onData(Se=>{const ge=th(Se);ge&&b.send(ge)});return()=>{C.current=!0,L.current=null,Ve.dispose();try{Q(),q(),Ce.dispose(),k.current=null}catch{}F.dispose(),p.current=null,w.current=null,window.__embeddedTerminal=null}},[]),vg(p,e,u,$.notify);const K=b.terminalReset===!0&&!G.pendingLaunch&&!T;return J.jsxs("div",{className:"relative flex h-full min-h-0 w-full flex-col bg-[#1a1a1a] p-2","data-testid":"embedded-terminal","data-ws-open":b.open?"true":"false","data-ws-ready":b.ready?"true":"false","data-role":b.role??"unknown",children:[J.jsx(jf,{reconnecting:g.reconnectingArmed,reconnectStalled:b.reconnectStalled,readOnly:ue,showResetBanner:K,resetScrollbackBytes:b.scrollbackBytes,onDismissResetBanner:()=>O(!0),replayOnly:b.replayOnly===!0,previewCommand:D,manualSendCommand:M,onManualSend:H,onDismissManualSend:Z,clipboardNotice:$.clipboardNotice,onDismissClipboardNotice:$.dismissClipboardNotice}),J.jsx("div",{ref:f,className:"min-h-0 flex-1 overflow-hidden",tabIndex:-1,"data-testid":"embedded-terminal-canvas"}),J.jsx(xg,{disabled:b.role!=="writer",onFocusTerminal:()=>{var z;return(z=p.current)==null?void 0:z.focus()},onPaste:()=>void jl({term:p.current,writer:b.role==="writer",isDisposed:()=>C.current,notify:$.notify,uploadImage:U}),onKey:z=>{var q,Q;if(b.role!=="writer")return;const F=((Q=(q=p.current)==null?void 0:q.modes)==null?void 0:Q.applicationCursorKeysMode)??!1;b.send({type:"data",payload:yg(z,F)})}})]})});export{Vp as EmbeddedTerminal,Pf as REPLAY_DRAIN_MAX_BYTES,Of as REPLAY_DRAIN_TIMEOUT_MS};
|